Toxic spores tweak (#874)
Created by: cxong
Here's the toxic spores part for #874 (closed), but I'm not sure about the changes so I would like a review first.
- Renamed
onAttack
toonAttacked
, and added anonAttack
trigger. SoonAttack
is when a creature attacks another, andonAttacked
is when a creature is attacked by another. I didn't find an existing trigger for when a creature is attacked, hence adding this new trigger. - Adding an
Ability.triggerFunc()
, which is used whenAbility.trigger
is undefined. This is to implement Toxic Spore's upgrade, which needs to trigger on bothonAttack
andonAttacked
. There's no precedent for dynamic triggers, so this was the one that required the least amount of code changes. If I completely replacedAbility.trigger
with a function, that will require code changes to all the existing ability files. - Also, I removed this line because otherwise Toxic Spore would trigger twice, but I'm not sure if this breaks any existing abilities.