here in the code https://github.com/ImpulseDAO/Vara-Arena/blob/master/contracts/arena/src/battle.rs#L200
it shows what happens to a players battle action if their enemy has cast a fire_haste or chilling_touch spell on them.
if the player has been affected by the fire_haste spell, their fire_haste value of 0 is set to 4 and decrements back down to 0 each turn. if they are affected by that spell where fire_haste > 0 - that increases the modifier, which increases more the more intelligence they have
if the player has been affected by chilling_touch, their chilling_touch value of 0 is set to 4 and decrements back down to 0 each turn. if they are affected by that spell where chilling_touch > 0 - that decreases the modifier, which decreases more the more intelligence they have
basically that modifier output value is the output of combining the impacts of the above spells, and is used to affect that players battle action.
then if the player character has config attributes ofdisable_agiim = true, which requires their parry = true (defending themselves) to be set first, then the fire_haste and chilling_touch spells have no further impact on their battle action against the enemy.
but if the player character has config attributes ofdisable_agiim = false (not defending themselves), the intensity of the battle action undertaken by the player is changed by the modifier output value (more if the player has a higher agility), so in that case a:
- higher fire_haste spell on that player would cause their battle action to have less impact, whereas a;
- higher chilling_touch spell on them would cause their battle action to have a higher impact since
base_initiative - (u16::from(player.attributes.agility) * modifier), where the modifier is a negative number, so subtracting a negative modifier results in an increase (x - (y * -z)) = (x - (-yz)). so i don't think the chilling_touch spell makes sense, why would you cast a chilling_touch spell on an enemy if it actually increases the impact of their battle action? shouldn't it decrease the impact of their battle action instead?
the player and enemy each have an attribute parry = false set by default.
and the only way the player or enemy can have their default disable_agiim = false changed to disable_agiim = true seems to be by somehow changing their attribute to parry = true.
note that parry is in the dictionary, it means "deflect or ward off a thrust or blow, evade, or avoid".
for the player or enemy to parry (defensive battle action), the player or enemy would have to run the BattleAction::Parry on themselves.
BattleAction::Parry is defined here https://github.com/ImpulseDAO/Vara-Arena/blob/master/contracts/arena/src/execute.rs#L216, but i think we need to add a new line of code player.parry = true below that line for it to work.
then the opponent would have to run the BattleAction::Guardbreak to break that player's defense, which first checks if enemy.parry is true (if they are defending themselves) and then sets enemy.disable_agiim = true;,
but i also think Guardbreak should reset the enemy parry value back to its default of not defending enemy.parry = false; here https://github.com/ImpulseDAO/Vara-Arena/blob/master/contracts/arena/src/execute.rs#L234C21-L234C48 since the just broke their defence, and;
i also think the success log here https://github.com/ImpulseDAO/Vara-Arena/blob/master/contracts/arena/src/execute.rs#L239 should be changed to success: !enemy.parry,, since success is when the enemy isn't parrying anymore since we broke their defense.
but i don't actually know what agiim is an abbreviation for... so maybe the BattleAction::Parry should actually have an extra line to set player.disable_agiim = true too, and then BattleAction::Guardbreak would actually set enemy.disable_agiim = false; (back to default value) instead of enemy.disable_agiim = true; so they can be impacted by those spells.
we'd also need pub struct CharacterState { to include parry: boolean