Ejemplo n.º 1
0
        private void SecondaryAffects(RBYPokemon Attacker, RBYPokemon Defender, Attacks atk)
        {
            int chance = 0;

            switch (atk.Attack.Chance)
            {
            case 0:
                return;

            case 1:
                chance = 10;
                break;

            case 2:
                chance = 30;
                break;

            case 3:
                chance = 50;
                break;
            }

            if (Odds(chance, 100))
            {
                StatusTypeMove(Attacker, Defender, atk, true);
                StatBoostTypeMove(Attacker, Defender, atk.Attack, atk.Accuracy, true);
            }
        }
Ejemplo n.º 2
0
        private void StatBoostTypeMove(RBYPokemon Attacker, RBYPokemon Defender, AttackType atk, int accuracy, bool sec = false)
        {
            var query = atk.Stats.Where(p => p.Boost < StatBoostDegree.MeDown);

            if (query.Count() != 0 && !sec)
            {
                Defender.LastDmg = 0;
                Defender.NonDmgHit();
                if (!HitOrMiss(Attacker.Accuracy, Defender.Evasion, accuracy) || Defender.IsMisted && !Unhittable(Defender))
                {
                    Displayer.AtkMissed();
                    return;
                }
            }

            foreach (var p in atk.Stats)
            {
                if (p.Boost < StatBoostDegree.MeDown)
                {
                    Defender.IncreaseStage(p.Stat, DetermineStatDegree(p.Boost));
                }
                else
                {
                    Attacker.IncreaseStage(p.Stat, DetermineStatDegree(p.Boost));
                }
            }
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
        public void METRONOME(RBYPokemon Attacker, RBYPokemon Defender)
        {
            var move = MoveEnyclopedia[RandomNumberGenerator(1, MoveEnyclopedia.Count)];

            Attacker.MetronomedMove = move.Index;
            DeliverAttack(Attacker, Defender, move, move.Attack.Movetype);
        }
Ejemplo n.º 5
0
        private bool PickSwitch(bool dead = false)
        {
            //Write a function to list switchable pokes
            //var alive = Trainer1.Party.Where(p => p.IsAlive == true).ToList();

            //if (alive.Count > 1)
            //    Displayer.DisplayPokesToSwitch(alive.ConvertAll(x => (Pokemon)x));

            Displayer.DisplayPokesToSwitch(Trainer1.Party.ConvertAll(x => (Pokemon)x));

            int selection = Input_Handler();

            if (selection > Trainer1.Party.Count || Trainer1.Party[selection] == Trainer1CurrentPoke || !Trainer1.Party[selection].IsAlive)
            {
                return(false);
            }
            else
            {
                Trainer1CurrentPoke = Trainer1.Party[selection];
                Trainer1.Switch(selection, Trainer1CurrentPoke);

                if (!dead)
                {
                    Displayer.TrainerSwitchedPokemon(Trainer1.Name, Trainer1CurrentPoke.Name);
                }
                else
                {
                    Displayer.RelayMessage($"Trainer threw out {Trainer1CurrentPoke.Name}");
                }
                return(true);
            }
        }
Ejemplo n.º 6
0
        public void MIMIC(RBYPokemon Attacker, RBYPokemon Defender)
        {
            int replace_index;
            var move = MoveEnyclopedia[Defender.Moveset[RandomNumberGenerator(1, 4)].Index];

            if (Attacker.Owner == 0)
            {
                replace_index = Trainer1.IndexPicked;
            }
            else
            {
                replace_index = Trainer2.IndexPicked;
            }

            var query = Attacker.Moveset.Where(p => p.Name == move.Name);

            if (query.Count() == 0)
            {
                Displayer.RelayMessage("The move failed");
                return;
            }

            Attacker.UsedMimic              = true;
            Attacker.MimicIndex             = replace_index;
            Attacker.OldMimic               = Attacker.Moveset[replace_index];
            Attacker.Moveset[replace_index] = move;
            Defender.NonDmgHit();
        }
Ejemplo n.º 7
0
 private void RechargeLogic(RBYPokemon Defender, RBYPokemon Attacker)
 {
     if (Defender.IsAlive)
     {
         Attacker.Recharging = true;
     }
 }
Ejemplo n.º 8
0
        public void THRASH(RBYPokemon Attacker, RBYPokemon Defender)
        {
            var query = MoveEnyclopedia.Where(p => p.Name == "THRASH").ToList()[0];

            DeliverAttack(Attacker, Defender, query, AttackingMoveSecondary.None);
            Attacker.StartDancing(RandomNumberGenerator(2, 3));
        }
Ejemplo n.º 9
0
 private void ConfuseLogic(RBYPokemon Defender)
 {
     if (!Defender.IsConfused)
     {
         Defender.TakeConfusion(RandomNumberGenerator(2, 5));
         Displayer.Confused(Defender.OwnerCall, Defender.Name);
     }
 }
Ejemplo n.º 10
0
 private void YouAreFrozen(RBYPokemon Defender)
 {
     if (Defender.CurrentStatus == StatusConditionInflicted.None)
     {
         Defender.Freeze();
         Displayer.Freezed(Defender.OwnerCall, Defender.Name);
     }
 }
Ejemplo n.º 11
0
 private void TrapLogic(RBYPokemon Defender, RBYPokemon Attacker)
 {
     if (Defender.IsAlive)
     {
         Defender.IsTrapped = true;
         Defender.TrappedSomeone(RandomNumberGenerator(2, 5));
     }
 }
Ejemplo n.º 12
0
 private void RecoilLogic(RBYPokemon Defender, RBYPokemon Attacker, int dmg)
 {
     if (Defender.IsAlive)
     {
         Attacker.TakeDamage(dmg / 10, false);
         Displayer.RecoilHappened(Attacker.OwnerCall, Attacker.Name);
     }
 }
Ejemplo n.º 13
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);
        }
Ejemplo n.º 14
0
        private void SleepLogic(RBYPokemon Defender)
        {
            if (Defender.CurrentStatus == StatusConditionInflicted.None)
            {
                Displayer.PutAsleep(Defender.OwnerCall, Defender.Name);

                Defender.PutToSleep(RandomNumberGenerator(2, 5));
            }
        }
Ejemplo n.º 15
0
        private void FlinchLogic(RBYPokemon Defender, int chance)
        {
            int inchance = 10;

            if (Odds(chance, inchance))
            {
                Defender.Flinched();
            }
        }
Ejemplo n.º 16
0
        public void Switch(int index, RBYPokemon CurrentPoke)
        {
            if (CurrentPoke.Transformed)
            {
                CurrentPoke = (RBYPokemon)TransformedPoke.Clone();
            }

            _iSwitched  = true;
            IndexPicked = index;
        }
Ejemplo n.º 17
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);
 }
Ejemplo n.º 18
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);
 }
Ejemplo n.º 19
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);
 }
Ejemplo n.º 20
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);
 }
Ejemplo n.º 21
0
 public void HAZE(RBYPokemon Attacker, RBYPokemon Defender)
 {
     Attacker.ResetStatBoost();
     Defender.ResetStatBoost();
     Attacker.IsMisted = false;
     Defender.IsMisted = false;
     Defender.NonDmgHit();
     if (Defender.CurrentStatus == StatusConditionInflicted.Freeze)
     {
         Defender.UnFreez();
     }
 }
Ejemplo n.º 22
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();
        }
Ejemplo n.º 23
0
        public void REST(RBYPokemon Attacker, RBYPokemon Defender)
        {
            if (Attacker.SubHPRemaining == Attacker.HealthPoints)
            {
                Displayer.RelayMessage("Pokemon is already healthy");
                return;
            }

            Attacker.PutToSleep(2);
            Attacker.HealDamage(Attacker.HealthPoints);
            Defender.NonDmgHit();
        }
Ejemplo n.º 24
0
 private void LeechedLogic(RBYPokemon Defender)
 {
     if (Defender.Type1 != ElementTypes.GRASS && Defender.Type2 != ElementTypes.GRASS && !Defender.IsSeeded)
     {
         Defender.Leeched();
         Displayer.Seeded(Defender.OwnerCall, Defender.Name);
     }
     else
     {
         Displayer.SuperEffective(0);
     }
 }
Ejemplo n.º 25
0
        private void StatusTypeMove(RBYPokemon Attacker, RBYPokemon Defender, Attacks atk, bool sec = false)
        {
            if (!sec)
            {
                Defender.LastDmg = 0;
                Defender.NonDmgHit();
                if (!HitOrMiss(Attacker.Accuracy, Defender.Evasion, atk.Accuracy) && !Defender.ActiveSub && !Unhittable(Defender))
                {
                    Displayer.AtkMissed();
                    return;
                }
            }

            switch (atk.Attack.Status)
            {
            case StatusConditionInflicted.BadPoison:
                PoisonLogic(Defender, true, sec);
                break;

            case StatusConditionInflicted.Burn:
                BurnLogic(Defender, sec);
                break;

            case StatusConditionInflicted.Confuse:
                ConfuseLogic(Defender);
                break;

            case StatusConditionInflicted.Flinch:
                FlinchLogic(Defender, atk.Attack.Chance);
                break;

            case StatusConditionInflicted.Freeze:
                YouAreFrozen(Defender);
                break;

            case StatusConditionInflicted.Leech:
                LeechedLogic(Defender);
                break;

            case StatusConditionInflicted.Para:
                ParalysisLogic(Defender, atk.MoveType);
                break;

            case StatusConditionInflicted.Poison:
                PoisonLogic(Defender, false, sec);
                break;

            case StatusConditionInflicted.Sleep:
                SleepLogic(Defender);
                break;
            }
        }
Ejemplo n.º 26
0
 public void REFLECT(RBYPokemon Attacker, RBYPokemon Defender)
 {
     Attacker.Reflect = true;
     if (Attacker.Owner == 0)
     {
         Trainer1.Reflect = true;
     }
     else
     {
         Trainer2.Reflect = true;
     }
     Defender.NonDmgHit();
 }
Ejemplo n.º 27
0
        public void DREAM_EATER(RBYPokemon Attacker, RBYPokemon Defender)
        {
            var query = MoveEnyclopedia.Where(p => p.Name == "DREAM EATER").ToList()[0];

            if (Defender.CurrentStatus == StatusConditionInflicted.Sleep)
            {
                DamageTypeMove(Attacker, Defender, query, AttackingMoveSecondary.Absorbing);
            }
            else
            {
                Displayer.RelayMessage("The move failed");
            }
        }
Ejemplo n.º 28
0
 public void FOCUS_ENERGY(RBYPokemon Attacker, RBYPokemon Defender)
 {
     if (!Attacker.IsFocused)
     {
         Attacker.IsFocused = true;
         Displayer.RelayMessage("Getting pumped up");
     }
     else
     {
         Displayer.RelayMessage("The move failed");
     }
     Defender.NonDmgHit();
 }
Ejemplo n.º 29
0
 public void LIGHT_SCREEN(RBYPokemon Attacker, RBYPokemon Defender)
 {
     Attacker.LightScreen = true;
     if (Attacker.Owner == 0)
     {
         Trainer1.LightScreen = true;
     }
     else
     {
         Trainer2.LightScreen = true;
     }
     Defender.NonDmgHit();
 }
Ejemplo n.º 30
0
 private void ParalysisLogic(RBYPokemon Defender, ElementTypes movetype)
 {
     if (Defender.Type1 == ElementTypes.GROUND && Defender.Type2 == ElementTypes.GROUND && movetype == ElementTypes.ELECTRIC)
     {
         Displayer.SuperEffective(0);
     }
     else
     {
         if (Defender.CurrentStatus == StatusConditionInflicted.None)
         {
             Defender.Paralyze();
             Displayer.Paralyzed(Defender.OwnerCall, Defender.Name);
         }
     }
 }