public void Damage(float amount, Type damageType) { //1) account for substitute if (Substitute.IsActive) { Substitute.Damage(amount); } else { Pokemon.Damage(amount); } //2) account for Bide if (Bide.Active) { Bide.Damage(amount); } //3) account for Counter if (damageType == Type.Normal || damageType == Type.Fighting) { DamageForCounter = amount; } //4) account for thawing if (Pokemon.Status == Status.Freeze && damageType == Type.Fire) { Pokemon.ClearStatus(); } CheckForRageAndUpdateAttackStatStageIfNecessary(); }
//this should be referenced exclusively by OneTurnMultiHitAttackMove public void DamageWithoutBideOrCounterSideEffects(float amount) { if (Substitute.IsActive) { Substitute.Damage(amount); } else { Pokemon.Damage(amount); } }
private void DamageFromConfusion() { float damage = AttackMove.DamageFormula( Pokemon.Level, Pokemon.Attack, Pokemon.Defense, 40f, 1f, 1f); Pokemon.Damage(damage); }
public bool UseMove(Pokemon user, Pokemon enemy) { bool defeatedEnemy = false; ushort damage = CalculateDamage(user, enemy); if (damage >= enemy.hp) { defeatedEnemy = true; } enemy.Damage(damage); return(defeatedEnemy); }
//this should only be referenced by the move Counter. public void DamageMethodForCounterOnly(float amount) { DamageForCounter = 0f; if (Substitute.IsActive) { Substitute.Damage(amount); } else { Pokemon.Damage(amount); } if (Bide.Active) { Bide.Damage(amount); } }
public int Damage(int damage, TargetableElement target = null, BattleElement source = null, EffectData effect = null, bool instafaint = false) { if (currentEvent != null) { if (target == null) { target = currentEvent.target; } if (source == null) { source = currentEvent.source; } if (effect == null) { effect = effectInEvent; } } if (target == null || !(target.sourceElement is PokemonCharacter)) { return(0); } Pokemon poke = ((PokemonCharacter)target.sourceElement).pokemonData; if (poke.hp <= 0) { return(0); } if (damage <= 0) { return(0); } //// Struggle recoil is not affected by effects if (effect.id != "struggle-recoil") { if (effect.effectType == Globals.EffectTypes.Weather && poke.HasStatusImmunity(effect.id)) { return(0); } RelayVar relayVar = new RelayVar(integerValue: damage); damage = RunEvent("Damage", target, source, effect, relayVar).integerValue; if (damage <= 0) { return(0); } } damage = poke.Damage(damage, source, effect); if (source is PokemonCharacter && effect != null && effect.effectType == Globals.EffectTypes.Move) { ((PokemonCharacter)source).pokemonData.lastDamage = damage; } if (effect != null && effect.drain != null && source is PokemonCharacter) { //this.heal(Math.ceil(damage * effect.drain[0] / effect.drain[1]), source, target, 'drain'); Heal(Mathf.CeilToInt(damage * effect.drain[0] / effect.drain[1]), target, source, GetPureEffect("drain")); } if (!instafaint && poke.hp > 0) { RelayVar relayVar = new RelayVar(integerValue: damage); damage = RunEvent("AfterDamage", target, source, effect, relayVar).integerValue; } return(damage); }
public void RecoilDamage(float amount) { Pokemon.Damage(amount); DamageForCounter = amount; }
public void DamagePokemonOnlyNoEffects(float amount) { Pokemon.Damage(amount); }