private void MultiHitMove(string name, int atk, int def, int lvl, int basepw, double stab, double multiplier, RBYPokemon Defender, bool physpec, bool crit_chance)
        {
            int hits = RandomNumberGenerator(2, 5);
            int dmg;

            if (name == "DOUBLE KICK")
            {
                hits = 2;
            }

            for (int i = 0; i < hits; i++)
            {
                dmg = DamageCalculation(atk, def, lvl, basepw, stab, multiplier, crit_chance);
                Defender.TakeDamage(dmg, physpec);

                if (i != hits - 1)
                {
                    Displayer.AttackContiunes();
                }

                if (!Defender.IsAlive)
                {
                    break;
                }
            }
        }
Exemple #2
0
        public void SELFDESTRUCT(RBYPokemon Attacker, RBYPokemon Defender)
        {
            var query = MoveEnyclopedia.Where(p => p.Name == "SELFDESTRUCT").ToList()[0];

            DamageTypeMove(Attacker, Defender, query, BattleEngine.AttackingMoveSecondary.None);
            Attacker.TakeDamage(Attacker.HealthPoints, true, 1, true);
        }
 private void RecoilLogic(RBYPokemon Defender, RBYPokemon Attacker, int dmg)
 {
     if (Defender.IsAlive)
     {
         Attacker.TakeDamage(dmg / 10, false);
         Displayer.RecoilHappened(Attacker.OwnerCall, Attacker.Name);
     }
 }
Exemple #4
0
        public void EXPLOSION(RBYPokemon Attacker, RBYPokemon Defender)
        {
            var query = MoveEnyclopedia.Where(p => p.Name == "EXPLOSION").ToList()[0];

            DamageTypeMove(Attacker, Defender, query, AttackingMoveSecondary.None);

            Attacker.TakeDamage(Attacker.HealthPoints, true, 1, true);
        }
Exemple #5
0
 public void GUILLOTINE(RBYPokemon Attacker, RBYPokemon Defender)
 {
     if (!HitOrMiss(Attacker.Accuracy, Defender.Evasion, 30))
     {
         Displayer.AtkMissed();
         Displayer.Enter();
         Defender.NonDmgHit();
         return;
     }
     Defender.TakeDamage(Defender.SubHPRemaining, true, 1, true);
 }
Exemple #6
0
 public void DRAGON_RAGE(RBYPokemon Attacker, RBYPokemon Defender)
 {
     if (!HitOrMiss(Attacker.Accuracy, Defender.Evasion, 100))
     {
         Displayer.AtkMissed();
         Displayer.Enter();
         Defender.NonDmgHit();
         return;
     }
     Defender.TakeDamage(40, false, 1, true);
 }
Exemple #7
0
 public void SUPER_FANG(RBYPokemon Attacker, RBYPokemon Defender)
 {
     if (!HitOrMiss(Attacker.Accuracy, Defender.Evasion, 100))
     {
         Displayer.AtkMissed();
         Displayer.Enter();
         Defender.NonDmgHit();
         return;
     }
     Defender.TakeDamage(Attacker.SubHPRemaining / 2, true);
 }
Exemple #8
0
 public void SONICBOOM(RBYPokemon Attacker, RBYPokemon Defender)
 {
     if (!HitOrMiss(Attacker.Accuracy, Defender.Evasion, 100))
     {
         Displayer.AtkMissed();
         Displayer.Enter();
         Defender.NonDmgHit();
         return;
     }
     Defender.TakeDamage(20, true, 1, true);
 }
Exemple #9
0
        public void COUNTER(RBYPokemon Attacker, RBYPokemon Defender)
        {
            var type = MoveEnyclopedia[Attacker.OppPrevAtk].MoveType;

            if (type == ElementTypes.NORMAL || type == ElementTypes.FIGHTING && Attacker.LastDmg != 0)
            {
                Defender.TakeDamage(Defender.LastDmg << 1, true, 1, true);
            }


            Defender.NonDmgHit();
        }
Exemple #10
0
        public void PSYWAVE(RBYPokemon Attacker, RBYPokemon Defender)
        {
            if (!HitOrMiss(Attacker.Accuracy, Defender.Evasion, 100))
            {
                Displayer.AtkMissed();
                Displayer.Enter();
                Defender.NonDmgHit();
                return;
            }

            int rng = RandomNumberGenerator(10, 15);
            int dmg = (rng * Attacker.Level) / 10;

            Defender.TakeDamage(dmg, false, 1, true);
        }
        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);
        }
        private void ExecuteAttack(RBYPokemon Attacker, RBYPokemon Defender, Trainer Agressor)
        {
            if (Agressor.ISwitched)
            {
                Agressor.FinishSwitch();
                return;
            }

            if (!Attacker.IsAlive)
            {
                return;
            }

            if (Attacker.Biding)
            {
                int dmg = Attacker.PokemonBide();
                if (!Attacker.Biding)
                {
                    if (dmg == 0)
                    {
                        Displayer.RelayMessage("Nothing was unleashed");
                    }
                    else
                    {
                        Defender.TakeDamage(dmg, true);
                    }
                }
                return;
            }

            if (Attacker.Recharging)
            {
                Displayer.Recharging(); Attacker.Recharging = false; return;
            }

            if (Attacker.IsFlinched)
            {
                Displayer.FlinchMsg(Attacker); return;
            }

            if (Attacker.IsTrapped)
            {
                return;
            }

            if (Defender.IsTrapped)
            {
                if (Defender.StillTrapped())
                {
                    Displayer.StillWrapped();
                    Defender.TakeDamage(1, false);
                }
                else
                {
                    Displayer.WrappedUp();
                }
                return;
            }

            if (Attacker.CurrentStatus == StatusConditionInflicted.Para)
            {
                if (FullParalyzed())
                {
                    Displayer.ParalyzedMsg(Attacker); Attacker.FinishTwoTurn(); return;
                }
            }
            else if (Attacker.CurrentStatus == StatusConditionInflicted.Sleep)
            {
                if (Attacker.Snoozing())
                {
                    Displayer.AsleepMsg(Attacker);
                }
                else
                {
                    Displayer.WokeUpMsg(Attacker);
                }
                return;
            }

            if (Attacker.IsConfused)
            {
                if (Confused())
                {
                    int dmg = DamageCalculation(Attacker.InBattleAtk, Attacker.InBattleDef, Attacker.Level, 20, 1, 1, false);
                    Displayer.ConfusedHitMsg();
                    Attacker.FinishTwoTurn();
                    Attacker.TakeDamage(dmg, true);
                    return;
                }
                Displayer.OutOfConfusionMsg();
            }

            var TheAttack = Attacker.Moveset[Agressor.IndexPicked];


            if (Attacker.TwoTurnMove && TheAttack.Name == "METRONOME")
            {
                TheAttack = MoveEnyclopedia[Attacker.MetronomedMove];
            }


            DeliverAttack(Attacker, Defender, TheAttack, TheAttack.Attack.Movetype);

            if (Attacker.IsAlive && Defender.IsAlive)
            {
                EndOfTurnEffects(Attacker, Defender);
            }
        }