示例#1
0
        public int CatchTest(PokemonCharacter Mewtwo)
        {
            const double BURN_CATCH_RATE = 1.5;

            int    shakes = 0;
            double valueForCatch;
            double pokemonCatch;

            // determine catch value
            valueForCatch = ((3 * Mewtwo.MaxHP - 2 * Mewtwo.HP) * (Mewtwo.CatchRate * this.CatchValue) / (3 * Mewtwo.MaxHP));

            // check if mewtwo is burned
            if (Mewtwo.Burned == true)
            {
                catchValue = catchValue * BURN_CATCH_RATE;
            }

            // test for automatic capture
            if (catchValue >= 255 || this.catchValue == 999)
            {
                shakes = 4;
            }

            // calculate catch (shake probability #)
            else
            {
                pokemonCatch = 65536 / Math.Pow((255 / catchValue), .25);

                int randCatchCheck = Fight.RandomCatch();

                // start test for shake ONE
                if (pokemonCatch > randCatchCheck)
                {
                    randCatchCheck = Fight.RandomCatch();
                    shakes++;

                    // start test for shake TWO
                    if (pokemonCatch > randCatchCheck)
                    {
                        randCatchCheck = Fight.RandomCatch();
                        shakes++;

                        // start test for shake THREE
                        if (pokemonCatch > randCatchCheck)
                        {
                            randCatchCheck = Fight.RandomCatch();
                            shakes++;

                            // start test for CAPTURE
                            if (pokemonCatch > randCatchCheck)
                            {
                                shakes++;
                            }
                        }
                    }
                }
            }

            return(shakes);
        }
示例#2
0
        public int RestoredBy(PokemonCharacter Charizard)
        {
            int restoredBy;

            restoredBy   = Charizard.MaxHP - Charizard.HP;
            Charizard.HP = Charizard.MaxHP;

            return(restoredBy);
        }
示例#3
0
        // does burn damage
        public int BurnDamage(PokemonCharacter Mewtwo)
        {
            int damage;

            damage = (Mewtwo.MaxHP / 8);

            // prevents hp from being in the negatives
            if (damage > Mewtwo.HP)
            {
                damage = Mewtwo.HP;
            }

            return(damage);
        }
示例#4
0
        // determines if psychic sp def drop
        public bool DropSpecialDef(PokemonCharacter Charizard)
        {
            const double LOWER_STAT_1 = .66;
            const double LOWER_STAT_2 = .5;
            const double LOWER_STAT_3 = .4;
            const double LOWER_STAT_4 = .33;
            const double LOWER_STAT_5 = .285;
            const double LOWER_STAT_6 = .25;

            bool   dropped;
            double decimalSpDef = 0;

            if (RandomNum() > 90)
            {
                dropped = true;

                // lower the stat if it isn't the bottom
                if (spDefStage != 6)
                {
                    spDefStage--;
                }

                // drop the stats
                if (spDefStage == -1)
                {
                    decimalSpDef = Charizard.MaxSpDef * LOWER_STAT_1;
                }


                else if (spDefStage == -2)
                {
                    decimalSpDef = Charizard.MaxSpDef * LOWER_STAT_2;
                }

                else if (spDefStage == -3)
                {
                    decimalSpDef = Charizard.MaxSpDef * LOWER_STAT_3;
                }

                else if (spDefStage == -4)
                {
                    decimalSpDef = Charizard.MaxSpDef * LOWER_STAT_4;
                }

                else if (spDefStage == -5)
                {
                    decimalSpDef = Charizard.MaxSpDef * LOWER_STAT_5;
                }

                else if (spDefStage == -6)
                {
                    decimalSpDef = Charizard.MaxSpDef * LOWER_STAT_6;
                }
            }

            else
            {
                dropped = false;
            }

            return(dropped);
        }
示例#5
0
            // calculates how much damage is done
            public int CalculateDamage(PokemonCharacter Charizard, PokemonCharacter Mewtwo, double crit)
            {
                const double STAB_YES           = 1.5;
                const double STAB_NO            = 1.0;
                const double NORMAL_EFFECTIVE   = 1.0;
                const double NOT_VERY_EFFECTIVE = .5;
                const double LEVEL = 100;

                double stab          = 0;
                double effectiveness = 0;

                int    attackerAtkStat = 0;
                string attackerType1;
                string attackerType2;

                int defenderDefStat = 0;
                int defenderHPStat  = 0;


                // determine who is attacking

                // charizard attacking
                if (this.atkName == "Flamethrower" || this.atkName == "Air Slash" || this.atkName == "Slash" || this.atkName == "SolarBeam")
                {
                    // determine if move is physical or special
                    if (this.atkType == "PHYSICAL")
                    {
                        attackerAtkStat = Charizard.atk;
                        defenderDefStat = Mewtwo.def;
                    }

                    else if (this.atkType == "SPECIAL")
                    {
                        attackerAtkStat = Charizard.spAtk;
                        defenderDefStat = Mewtwo.spDef;
                    }

                    attackerType1  = Charizard.type1;
                    attackerType2  = Charizard.type2;
                    defenderHPStat = Mewtwo.hp;
                }

                // mewtwo attacking
                else
                {
                    // determine if move is physical or special
                    if (this.atkType == "PHYSICAL")
                    {
                        attackerAtkStat = Mewtwo.atk;
                        defenderDefStat = Charizard.def;
                    }

                    else if (this.atkType == "SPECIAL")
                    {
                        attackerAtkStat = Mewtwo.spAtk;
                        defenderDefStat = Charizard.spDef;
                    }

                    attackerType1  = Mewtwo.type1;
                    attackerType2  = Mewtwo.type2;
                    defenderHPStat = Charizard.hp;
                }

                // determine if the move has STAB
                if (this.type == attackerType1 || this.type == attackerType2)
                {
                    stab = STAB_YES;
                }

                else
                {
                    stab = STAB_NO;
                }

                // determine type effectiveness of move
                if (this.atkName == "Aura Sphere")
                {
                    effectiveness = NOT_VERY_EFFECTIVE;
                }

                else
                {
                    effectiveness = NORMAL_EFFECTIVE;
                }

                double modifier = stab * effectiveness * crit * 1 * Attack.RandomDamage() / 100;

                double first  = 2 * LEVEL + 10;
                double second = first / 250 * attackerAtkStat / defenderDefStat * this.power + 2;

                double damage = second * modifier;

                int damageInt = (int)damage;

                // prevents hp from being in the negatives
                if (damageInt > defenderHPStat)
                {
                    damageInt = defenderHPStat;
                }

                return(damageInt);
            }