Skip to content

Commit

Permalink
fix(effects): fix Air Shield errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rudnovd committed Feb 27, 2022
1 parent a6c30e4 commit a6fee76
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/modules/effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,12 +292,25 @@ export const Effects = {
}
},

airShield: (initiator: DamageCalculatorBattleSide, target: CreatureInstance): CreatureInstance => {
/**
* Set Air Shield effect to creature
* (Air Shield reduces damage taken from ranged attacks)
* @param initiator Battle side (attacker or defender) who casts effect
* @param target Creature who accept effect
* @param defender Battle side who deal damage
* @return {CreatureInstance} Creature with Air Shield effect
*/
airShield: (
initiator: DamageCalculatorBattleSide,
defender: DamageCalculatorBattleSide,
target: CreatureInstance
): CreatureInstance => {
// get creature values for modify them
let {
calculation: { defenseMagicBonus },
} = target

if (target.ranged) {
if (defender.activeCreature?.ranged) {
if (!initiator.hero || initiator.hero.skills.air < 2) {
defenseMagicBonus += 0.25
} else if (initiator.hero.skills.air > 1) {
Expand Down

0 comments on commit a6fee76

Please sign in to comment.