private void DamageTypeMove(RBYPokemon Attacker, RBYPokemon Defender, Attacks atk, AttackingMoveSecondary attacktype, bool nomiss = false) { bool crit_chance = CriticalChance(Attacker, false); Attacker.RecalcStats(crit_chance); Defender.RecalcStats(crit_chance); if (!HitOrMiss(Attacker.Accuracy, Defender.Evasion, atk.Accuracy) && !Unhittable(Defender) && !nomiss) { Displayer.AtkMissed(); Defender.NonDmgHit(); return; } ElementTypes type = atk.MoveType; int basepwr = atk.BasePower; bool physpec = PhysicalSpecial(type); float multipler = TypeMatrixCalc(atk.MoveType, Defender.Type1, Defender.Type2); double stab = 1; int power = physpec == true ? Attacker.InBattleAtk : Attacker.InBattleSpecialAtk; int defense = physpec == true ? Defender.InBattleDef : Defender.InBattleSpecialAtk; if (Attacker.Type1 == type || Attacker.Type2 == type) { stab = 1.5; } int dmg = 0; if (attacktype != AttackingMoveSecondary.Turn2 && attacktype != AttackingMoveSecondary.SpecialMech) { if (crit_chance) { Displayer.RelayMessage("Critical Hit!"); } } switch (attacktype) { case AttackingMoveSecondary.None: dmg = DamageCalculation(power, defense, Attacker.Level, basepwr, stab, multipler, crit_chance); Defender.TakeDamage(dmg, physpec, multipler); break; case AttackingMoveSecondary.MultiHit: MultiHitMove(atk.Name, power, defense, Attacker.Level, basepwr, stab, multipler, Defender, physpec, crit_chance); break; case AttackingMoveSecondary.Recoil: dmg = DamageCalculation(power, defense, Attacker.Level, basepwr, stab, multipler, crit_chance); Defender.TakeDamage(dmg, physpec, multipler); RecoilLogic(Defender, Attacker, dmg); break; case AttackingMoveSecondary.SpecialMech: CallSpecialMove(atk.Name, Attacker, Defender); break; case AttackingMoveSecondary.Trap: dmg = DamageCalculation(power, defense, Attacker.Level, basepwr, stab, multipler, crit_chance); Defender.TakeDamage(dmg, physpec, multipler); TrapLogic(Defender, Attacker); break; case AttackingMoveSecondary.Turn2: Attacker.ActivateTwoTurn(atk); break; case AttackingMoveSecondary.Absorbing: dmg = DamageCalculation(power, defense, Attacker.Level, basepwr, stab, multipler, crit_chance); Defender.TakeDamage(dmg, physpec, multipler); Attacker.HealDamage(dmg / 2); break; case AttackingMoveSecondary.Recharge: dmg = DamageCalculation(power, defense, Attacker.Level, basepwr, stab, multipler, crit_chance); Defender.TakeDamage(dmg, physpec, multipler); RechargeLogic(Defender, Attacker); break; } Defender.LastDmg = dmg; if (Defender.CurrentStatus == StatusConditionInflicted.Freeze && atk.MoveType == ElementTypes.FIRE) { Defender.UnFreez(); } SecondaryAffects(Attacker, Defender, atk); }