User:Draygo Korvan/Damage calculation theory

This is devoted to my study on the interactions of skills, I think Guild Wars has a set way of doing things, certain abilities of skills will always be applied before others.

To the GuildWiki Contributer, mark any fallacies on the talk page, also feel free to provide insight into the game mechanics discussed this essay.

There are two main types of damage in guild wars, health stealing and non health stealing. They are both calculated differently. Health stealing skills ignore the effects of all enchantments and hexes when the actual damage is calculated (they do not ignore prevention spells like Spell Shield and Spell Breaker)

So here is my attempt to quantify everything down to the simplest terms. For one, I think each character has a set of variables associated with it, and enchantments and hexes modifiy those variables.

List of Variables

 * Max Health
 * Max Health Modifier
 * Current Health
 * Current Health Modifier
 * Max Energy
 * Max Energy Modifier
 * Current Energy
 * Current Energy Modifier
 * Base Armor Level
 * Armor Level Modifier
 * Condition X
 * Condition X duration
 * Condition X duration modifier
 * Ignore Condition modifier (bool, yes or no)
 * Damage Cap
 * Damage Absorbtion (X) of target
 * Damage Reduction (%) of target
 * Damage Reduction (%) attacker
 * Damage Reduction (X) of attacker
 * Damage Redirection
 * Redirection Target
 * Can be Target of enemy spells
 * Can be Target of Enchantments
 * Can be Target of Hexes
 * Can be Target of Attacks
 * Block Chance
 * Evade Chance
 * Miss Chance

Application
Whenever something that would modify those variables is changed, the associated variables are recalculated.

Order of Effects
I think this is how Guild Wars Fully calculates damage done to a character.

Calculate hit chance of attacker
First thing guild wars will do is calculate whether an attack or skill will hit or miss a target. This takes in account skill type being used. If it is a Spell, it determines if the target can be a target of enemy spells, if that flag is up, then the spell will fail. A skill like Shadow Form sets the Miss chance to 100%, while the target can still be the target of attacks, it will force them to miss. This step also takes into consideration all skills affecting the attacker, like conditions like Blindness and hexes like Reckless Haste. The outcome of this step is one of the following: Fail, Miss, Blocked, Evaded, Stray, IF Fail, Miss, or Stray is the result the calculation no longer needs to continue.

Damage done via Health stealing are resolved here with no additional consideration.

Calculate total damage of hit
This step takes in account the Total damage of the hit before any factors from the target (except AL) take effect. The formula is simple Add total damage from attack, then add factor AL. AL is factored like this: (Base Armor Level * (1 - Armor Penitration[%])) + Base Armor Level Modifier, in addition if the result is below zero, the result becomes 0. With the 'total' damage calculation step complete, it can now move on. Note if blocked, the total damage calculation step is 0 (and is skipped), same for evaded.

Skill Effect Step (Attacker)
This step takes in Skill effects of the attacker. Skill effects are basically any skill that says IF X skill does Y. In effect the game will do Y if X is present. If the blocked flag is up, and the attack does damage if blocked the total damage is set to that numerical damage. This is also the stage when an interrupt is determined. And any effects of the interrupt are calculated.

Damage Application
Now the total damage is run through several steps

Redirection
Redirection is applied first, either damage to minions or damage to another person (life bond). This can be proven by the effect of Life bond + prot spirit. Life bond can cause damages greater than 10% of the max health for the caster.

Skill Effects step
Now this stage all skill effects are calculated, note that all damage and healing will be added on together at the end of the calculation. If there are any If X do Y on the target they are calculated during this step. (Spirit bond is calculated here, but Prot spirit is not).

Damage Reduction step
This step subtracts damage from the total damage, sheilding hands for instance is calculated here.

Damage Cap step
This is when the damage cap is figured, prot spirit for instance will trigger here, if damage is greater than the damage cap%*Max Health then the damage is reduced to that number.

Damage Application step
This is when the total damage is applied to the current health and the -health above the head appears, any +health -/+energy benifits are also calculated here. If health drops below 0 at the end of this step, it envokes death. All skills that are envoked on death are triggered.

Skills that apply after application are activated here Illusion of Weakness

Condition Application step
This step applies the result of the conditions to the target. It comes after damage application because Eviserate can not kill a target because of the application of deep wound (if target has more current health than the damage Eviserate alone is doing, but the addition of deep wound would drop health below 0)