Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+2)

Thanks for fixing that bug! Sorry that I opened this Pandora’s box! :D

The way I handled this problem for Souls (don’t look it up, it’s nowhere public, but Stas knows about it) was to have local and global modifiers. And instead of applying them once, I computed the actual power of cards each time a change happened.

Basically, each card had a state with its base power, then a list of modifiers. After each user input, I refreshed the computed power of the card by resetting it to its base value, then applying all the known modifiers to it. Local modifiers are only ever applied to the card, while global modifiers are stuff that impact a list of cards. Like you mentioned, modifiers are linked to a source, and they have conditions and triggers, so they can be temporary (like stuff that last until end of turn). And when a card that created a modifier is removed, I could just look at all the modifiers and remove the ones that were added by that card.

The benefits of this approach is that it’s super easy to remove modifiers, stack them, etc. It’s possible to add stuff like priorities to modifiers to change the order they’re applied in. It’s the most flexible system I could think of for a game that’s as complex as Magic.

Hope that helps! :)