Open sIKE23 opened 8 years ago
we could rework the code to scan the board for faceup creatures and then process effects detetected on that creature
Yes, that is basically what I am planning. Each creature will have a list of upkeep functions and tags for general functions associated with it, and the game will execute all functions for each creature.
Also, I think the way we should handle upkeep damage is the following:
This way, we don't need to worry about whether it is more advantageous to heal vs. take damage first.
so Damage = 12 Regenerate (-2 damage) Rot (+1 damage)
12 + (-2 + 1) = 11
Excatly. Whether you have full health (and want to take the damage first) or low health (and want to heal first), the difference is what you ultimately want to take.
So if we aggregate damage and healing and apply it at once, how do we say 2 damage applied from a burns, 1 damage from Rot, and 2 Damage removed from healing?
Say all of the sources first (compute the damage from each source and store it in some structure like a dictionary), and then mix it all together.
So you could create an UpkeepEffectsDict for a creature and then pass it through all the various upkeep functions, accumulating values. For instance, it might look like
{"Rot":-1,"Burn":-2,"Healing from Regeneration":2,"Healing from Ring of Constant Healing that Stacks with Regen":1"
You don't actually need standardized names for the sources, because at the end you can just iterate over the dictionary and add up the entries associated with each key to get the final adjustment value (as opposed to having code that knows to subtract rots and add regen, you just make sure each value is positive or negative as appropriate). If you want to state where each number comes from, you can then simply iterate over the dictionary and print the names of the keys.
This is just a holder for thoughts on this topic