All pastes #1558583 Raw Edit

robertj

public text v1 · immutable
#1558583 ·published 2009-09-08 16:50 UTC
rendered paste body
#!/usr/bin/env pythonfrom misc import Worldfrom ent import Entfrom effect import Effect, EffectContainerfrom items import StatboostEquipmentfrom stats import * from races import Humanworld = World()mage = Ent()class TwoHandedSword(StatboostEquipment):    def describeBuff(self, ent): return [(ent.str.bonuses, 10)]sword = TwoHandedSword()class brightAura(Effect):    name = "brutal power"    flavor = "str increased by 10%"    def onApply(self, ent):        self.str_bonus = Bonus(5)        ent.str.bonuses.apply(self.str_bonus)    def onRemove(self, ent):        self.str_bonus.cancel()level = PrimitiveStat()str = CompoundStat()dex = CompoundStat()con = CompoundStat()int = CompoundStat()wis = CompoundStat()cha = CompoundStat()Armor = CompoundStat()base_attack_power = CalculatedStat(lambda: (level.value * 2) + str.value, [level,str])attack_power = CompoundStat(base_attack_power)str.base.set(13)cha = CompoundStat()cha.base.set(17)mage.str = strmage.cha = chamage.setRace(Human)hp = CalculatedStat(lambda: level.value * 10, [level])level.set(4)i = brightAura()print mage.str.valuemage.effects.add(i)print mage.str.valuemage.effects.remove(i)print mage.str.valueprint mage.cha.valuemage.bodyparts.gloves.equip(sword)print mage.str.valuemage.bodyparts.gloves.unequip()print mage.str.value