sIKE23 / Mage-Wars

Mage Wars for OCTGN
7 stars 5 forks source link

Upkeep and how it is processed #303

Open sIKE23 opened 8 years ago

sIKE23 commented 8 years ago

This is just a holder for thoughts on this topic

sIKE23 commented 8 years ago

we could rework the code to scan the board for faceup creatures and then process effects detetected on that creature

ACG8 commented 8 years ago

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:

  1. Compute all damage from all sources
  2. Compute all healing from all sources
  3. Adjust creature's life by the difference of the two

This way, we don't need to worry about whether it is more advantageous to heal vs. take damage first.

sIKE23 commented 8 years ago

so Damage = 12 Regenerate (-2 damage) Rot (+1 damage)

12 + (-2 + 1) = 11

ACG8 commented 8 years ago

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.

sIKE23 commented 8 years ago

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?

ACG8 commented 8 years ago

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.