All pastes #1591397 Raw Edit

robertj

public text v1 · immutable
#1591397 ·published 2009-10-03 22:46 UTC
rendered paste body
#!/usr/bin/env pythonfrom statMechanics import *class Level(PrimitiveStat): passclass Str(CompoundStat): passclass AttackPower(CompoundStat): passstats = StatCollection()level = Level()str = Str()base_attack_power = CalculatedStat(lambda: (level.value * 2) + str.value, [level,str])attack_power = AttackPower(base_attack_power)level.set(1)attack_power.addToStatCollection(stats)print attack_power.valuea = AttackPower.Adder(43)stats.apply(a)print attack_power.value# would like to be able to do it this way#b = AttackPower + 43#stats.apply(b)