I'm developing a card-based combat system for my game. (imagine a game like Magic The Gathering, or Hearthstone, or any CCG) I was writing the logic of the effect that I call "thorn". If a player has the thorn effect, everytime he got struck with some damage, he deals damage to his attacker.

I already had an event raised everytime a character is being damaged, so it seemed logical to me to use it.

the thorn effect starts to listen to the onDamage event and then it deals its damage.

The issue with this solution is that it can create an endless chain of thorn effect, if both parties have the thorn effect.

Player 1 attacks player 2.

Player 2 raises onDamage event.

player 2 resolves its thorn effect, and it deals damage to player 1.

player 1 raises onDamage event.

player 1 resolves its thorn effect, and it deals damage to player 2.

and it goes on.

There are many solutions I can think of, but none of them are actually satisfying to me. Any suggestions? Thanks for the answers

  • \$\begingroup\$ You could also rule that thorn activates "on attack" instead of "on damage". That way, thorn wouldn't loop back (since damage from thorn isn't an attack), and the thorn would still activate even if you found a way to mitigate the damage, making a "retaliating citadel" a new build to play the game. \$\endgroup\$ Feb 15, 2019 at 19:34

2 Answers 2


One option is to create a damage type called Reaction Damage, and construct your rules so that Reaction Damage does not trigger Reaction Damage.

The Thorn effect then becomes "When another player deals non-Reaction Damage to you, deal X Reaction Damage to that player"

This way you can cleanly separate initial effects from follow-up effects, and strictly restrict the depth of recursion for this class of abilities.

Once this is a keyword that you use consistently, it opens up new avenues for other cards to interact with these reaction abilities, like...

  • Careful Strike: take no Reaction Damage this turn

  • Counter Master: whenever you deal Reaction Damage, double the amount of Reaction Damage you deal

  • Reactive Vampire: heal 1 health point any time you deal Reaction Damage

Another strategy is to use diminishing returns, so each invocation of Thorn or similar effects does less damage than the last (eg. by subtraction or division), and eventually the recursion "bottoms-out" at zero.

This can be more brittle than the hard recursion limit described above though. If there are enough damage-boosting/vulnerability effects in play, those could potentially counteract the diminishing returns and get us back into an infinite regress.

Usually in such a case one player or the other would eventually be defeated, and we could terminate the loop that way (halt all card effect events emitted by defeated players), but again there could be exotic effects in play that somehow interfere with this soft limit (eg. a zombie effect that lets the player finish one last turn after being reduced to 0 health).

So I think the hard limit on recursion is more robust to other comboing effects.

  • \$\begingroup\$ Alternatively the ruling of "Thorn" can change to something like "When dealt damage by a player/monster/enemy, deal that much damage to opposing player", which would exclude damage from special effects, and makes the thorn more "realistic" as it's only meant to damage people that "touch" it. \$\endgroup\$
    – TomTsagk
    Feb 15, 2019 at 15:12
  • 1
    \$\begingroup\$ This allows for a lot more effects and interactions like maybe your game has magic damage spells, difference between range and melee damage, reaction or retaliate damage. Thorn simply triggers on only a few types of damage and returns a certain type. For example, if it triggers on melee physic damage and would return magic damage, the second creature with thorns would not trigger the effect. \$\endgroup\$
    – Zibelas
    Feb 15, 2019 at 15:25

It’s a feature! More accurately, it’s a measure of protection via mutually assured destruction. If one of you attacks the other, you both immediately die. Instead, you must both continue to build up your army while waiting to find a way to remove the other’s thorn effect.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .