#!/usr/bin/env python from misc import World from ent import Ent from effect import Effect, EffectContainer from items import StatboostEquipment from stats import * from races import Human world = 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 = str mage.cha = cha mage.setRace(Human) hp = CalculatedStat(lambda: level.value * 10, [level]) level.set(4) i = brightAura() print mage.str.value mage.effects.add(i) print mage.str.value mage.effects.remove(i) print mage.str.value print mage.cha.value mage.bodyparts.gloves.equip(sword) print mage.str.value mage.bodyparts.gloves.unequip() print mage.str.value