Example #1
0
    void Awake()
    {
        PlayerTurn = true;
        ep         = enemy.GetComponent <EnemyPokemon>();
        pHealth    = 100;
        pMana      = 100;

        HealthText = PhealthText.GetComponent <Text>();
        ManaText   = PManaText.GetComponent <Text>();
    }
 // Start is called before the first frame update
 void Start()
 {
     if (typeOfPokemon == TypeOfPokemon.Ally)
     {
         allyPokemon = new AllyPokemon(moveList, type, stats, level, maxExperience, experience, name, sprite);
     }
     else if (typeOfPokemon == TypeOfPokemon.Enemy)
     {
         enemyPokemon = new EnemyPokemon(moveList, type, stats, level, name, sprite);
     }
 }
Example #3
0
    //Attacking pokemon 0 is ally 1 is the enemy
    public void useMove(AllyPokemon allyPokemon, EnemyPokemon enemyPokemon, int attackingPokemon)
    {
        //Check what type of move
        //Attacking
        if (this.m_typeOfMove == MoveType.Physical)
        {
            //Checks if the move hits through accuracy
            if (m_accuracy * 100 >= m_random.Next(1, 101))
            {
                float moveDamage = 0;
                //Ally Pokemon attacks
                if (attackingPokemon == 0)
                {
                    moveDamage = (((((2 * allyPokemon.m_level) / 5f) + 2) * this.m_power * ((allyPokemon.m_stats[1] / (float)enemyPokemon.m_stats[2])) / 50f) + 2) * Type.checkEffectiveness(this.m_type, enemyPokemon.m_type);

                    //Checks for crit 1/16
                    if (m_random.Next(1, 17) == 1)
                    {
                        moveDamage *= 2;
                    }
                    this.m_powerPoints--;
                    enemyPokemon.m_stats[6] -= (int)moveDamage;
                }
                else if (attackingPokemon == 1)
                {
                    moveDamage = (((((2 * enemyPokemon.m_level) / 5f) + 2) * this.m_power * ((enemyPokemon.m_stats[1] / (float)allyPokemon.m_stats[2])) / 50f) + 2) * Type.checkEffectiveness(this.m_type, allyPokemon.m_type) / 2.5f;

                    //Checks for crit 1/16
                    if (m_random.Next(1, 17) == 1)
                    {
                        moveDamage *= 2;
                    }
                    this.m_powerPoints--;
                    allyPokemon.m_stats[6] -= (int)moveDamage;
                }
            }
        }
        else if (this.m_typeOfMove == MoveType.Special)
        {
            //Checks if the move hits through accuracy
            if (m_accuracy * 100 >= m_random.Next(1, 101))
            {
                float moveDamage = 0;
                //Ally Pokemon attacks
                if (attackingPokemon == 0)
                {
                    moveDamage = (((((2 * allyPokemon.m_level) / 5f) + 2) * this.m_power * ((allyPokemon.m_stats[3] / (float)enemyPokemon.m_stats[4])) / 50f) + 2) * Type.checkEffectiveness(this.m_type, enemyPokemon.m_type);

                    //Checks for crit 1/16
                    if (m_random.Next(1, 17) == 1)
                    {
                        moveDamage *= 2;
                    }
                    this.m_powerPoints--;
                    enemyPokemon.m_stats[6] -= (int)moveDamage;
                }
                else if (attackingPokemon == 1)
                {
                    moveDamage = (((((2 * enemyPokemon.m_level) / 5f) + 2) * this.m_power * ((enemyPokemon.m_stats[3] / (float)allyPokemon.m_stats[4])) / 50f) + 2) * Type.checkEffectiveness(this.m_type, allyPokemon.m_type) / 2.5f;

                    //Checks for crit 1/16
                    if (m_random.Next(1, 17) == 1)
                    {
                        moveDamage *= 2;
                    }
                    this.m_powerPoints--;
                    allyPokemon.m_stats[6] -= (int)moveDamage;
                }
            }
        }
        //Defensive
        else if (this.m_typeOfMove == MoveType.Defensive)
        {
            if (attackingPokemon == 0)
            {
                allyPokemon.m_stats[6] += allyPokemon.m_stats[0] / 10;
                if (allyPokemon.m_stats[6] > allyPokemon.m_stats[0])
                {
                    allyPokemon.m_stats[6] = allyPokemon.m_stats[0];
                }
            }
            else if (attackingPokemon == 1)
            {
                enemyPokemon.m_stats[6] += enemyPokemon.m_stats[0] / 8;
                if (enemyPokemon.m_stats[6] > enemyPokemon.m_stats[0])
                {
                    enemyPokemon.m_stats[6] = enemyPokemon.m_stats[0];
                }
            }
        }
    }
Example #4
0
    public void startBattle()
    {
        //Change starter to actual pokemon
        battleCamera.SetActive(true);
        overworldCamera.SetActive(false);
        battleUI.SetActive(true);
        //Changing starterpokemon to GameObject
        GameObject         player        = GameObject.FindGameObjectWithTag("Player");
        player_controller  script        = player.GetComponent <player_controller>();
        GameObject         Playerpokemon = GameObject.FindGameObjectWithTag("PlayerPokemon");
        pokemon_controller pokemonScript = Playerpokemon.GetComponent <pokemon_controller>();

        Playerpokemon.GetComponent <Image>().overrideSprite = script.starter.m_sprite;
        pokemonScript.name          = script.starter.m_name;
        pokemonScript.level         = script.starter.m_level;
        pokemonScript.stats         = script.starter.m_stats;
        pokemonScript.experience    = script.starter.m_experience;
        pokemonScript.maxExperience = script.starter.m_maxExperience;
        pokemonScript.moveList      = script.starter.m_moveList;
        pokemonScript.type          = script.starter.m_type;
        //Changing Enemy to GameObject
        //Checks what wave it is depending on the wave it changes the enemy
        EnemyPokemon enemyPokemon = new EnemyPokemon();

        //Wave 1
        //Pokemon Level 20-25
        //Types Normal, Bug, and Fighting
        if (defeatedPokemon < 5)
        {
            wave = 1;
            int choosePokemon = random.Next(1, 4);
            int lvl           = random.Next(20, 26);
            if (choosePokemon == 1)
            {
                enemyPokemon = new EnemyPokemon(new Move[] { moveList[0], moveList[1], moveList[30], moveList[31] }, new Type(Type.type.Bug), new int[] { lvl * 4, lvl * 2 - 10, lvl * 2, lvl * 2 - 10, lvl * 2, lvl * 2, lvl * 4 }, lvl, "Wormy", battle_controller.pokemonStaticSprites[3]);
            }
            else if (choosePokemon == 2)
            {
                enemyPokemon = new EnemyPokemon(new Move[] { moveList[0], moveList[1], moveList[21], moveList[20] }, new Type(Type.type.Fighting), new int[] { lvl * 4, lvl * 2 - 10, lvl * 2, lvl * 2 - 10, lvl * 2, lvl * 2, lvl * 4 }, lvl, "Fighter Joe", battle_controller.pokemonStaticSprites[4]);
            }
            else if (choosePokemon == 3)
            {
                enemyPokemon = new EnemyPokemon(new Move[] { moveList[0], moveList[1], moveList[36], moveList[37] }, new Type(Type.type.Normal), new int[] { lvl * 4, lvl * 2 - 10, lvl * 2, lvl * 2 - 10, lvl * 2, lvl * 2, lvl * 4 }, lvl, "Sciuridae", battle_controller.pokemonStaticSprites[5]);
            }
        }
        //Wave 2
        //Pokemon Level 25-30
        //Types Rock, Steel, and Ground
        else if (defeatedPokemon < 10 && defeatedPokemon >= 5)
        {
            wave = 2;
            if (defeatedPokemon == 5 && startWave)
            {
                pokemonScript.stats[6] = pokemonScript.stats[0];
                for (int i = 0; i < 7; i++)
                {
                    pokemonScript.stats[i] += 10;
                }
                pokemonScript.allyPokemon.m_experience += 100;
                pokemonScript.allyPokemon.checkLevelUp();
                startWave = false;
            }
            int choosePokemon = random.Next(1, 4);
            int lvl           = random.Next(25, 31);
            if (choosePokemon == 1)
            {
                enemyPokemon = new EnemyPokemon(new Move[] { moveList[0], moveList[1], moveList[28], moveList[29] }, new Type(Type.type.Rock), new int[] { lvl * 4, lvl * 2 - 10, lvl * 2, lvl * 2 - 10, lvl * 2, lvl * 2, lvl * 4 }, lvl, "Rock Man", battle_controller.pokemonStaticSprites[6]);
            }
            else if (choosePokemon == 2)
            {
                enemyPokemon = new EnemyPokemon(new Move[] { moveList[0], moveList[1], moveList[34], moveList[35] }, new Type(Type.type.Steel), new int[] { lvl * 4, lvl * 2 - 10, lvl * 2, lvl * 2 - 10, lvl * 2, lvl * 2, lvl * 4 }, lvl, "Roboto", battle_controller.pokemonStaticSprites[7]);
            }
            else if (choosePokemon == 3)
            {
                enemyPokemon = new EnemyPokemon(new Move[] { moveList[0], moveList[1], moveList[26], moveList[27] }, new Type(Type.type.Ground), new int[] { lvl * 4, lvl * 2 - 10, lvl * 2, lvl * 2 - 10, lvl * 2, lvl * 2, lvl * 4 }, lvl, "Agent Turtle", battle_controller.pokemonStaticSprites[8]);
            }
        }
        //Wave 3
        //Pokemon Level 30-35
        //Types Ice, Electric, and Flying
        else if (defeatedPokemon < 15 && defeatedPokemon >= 10)
        {
            wave = 3;
            if (defeatedPokemon == 10 && !startWave)
            {
                pokemonScript.stats[6] = pokemonScript.stats[0];
                for (int i = 0; i < 7; i++)
                {
                    pokemonScript.stats[i] += 10;
                }
                pokemonScript.allyPokemon.m_experience += 100;
                pokemonScript.allyPokemon.checkLevelUp();
                startWave = true;
            }
            int choosePokemon = random.Next(1, 4);
            int lvl           = random.Next(30, 36);
            if (choosePokemon == 1)
            {
                enemyPokemon = new EnemyPokemon(new Move[] { moveList[0], moveList[1], moveList[12], moveList[13] }, new Type(Type.type.Ice), new int[] { lvl * 4, lvl * 2 - 10, lvl * 2, lvl * 2 - 10, lvl * 2, lvl * 2, lvl * 4 }, lvl, "Icy King", battle_controller.pokemonStaticSprites[9]);
            }
            else if (choosePokemon == 2)
            {
                enemyPokemon = new EnemyPokemon(new Move[] { moveList[0], moveList[1], moveList[7], moveList[8] }, new Type(Type.type.Electric), new int[] { lvl * 4, lvl * 2 - 10, lvl * 2, lvl * 2 - 10, lvl * 2, lvl * 2, lvl * 4 }, lvl, "Batteroid", battle_controller.pokemonStaticSprites[10]);
            }
            else if (choosePokemon == 3)
            {
                enemyPokemon = new EnemyPokemon(new Move[] { moveList[0], moveList[1], moveList[22], moveList[23] }, new Type(Type.type.Flying), new int[] { lvl * 4, lvl * 2 - 10, lvl * 2, lvl * 2 - 10, lvl * 2, lvl * 2, lvl * 4 }, lvl, "Porkeet", battle_controller.pokemonStaticSprites[11]);
            }
        }
        //Wave 4
        //Pokemon Level 35-40
        //Types Ghost, Dark, and Poison
        else if (defeatedPokemon < 20 && defeatedPokemon >= 15)
        {
            wave = 4;
            if (defeatedPokemon == 15 && startWave)
            {
                pokemonScript.stats[6] = pokemonScript.stats[0];
                for (int i = 0; i < 7; i++)
                {
                    pokemonScript.stats[i] += 10;
                }
                pokemonScript.allyPokemon.m_experience += 100;
                pokemonScript.allyPokemon.checkLevelUp();
                startWave = false;
            }
            int choosePokemon = random.Next(1, 4);
            int lvl           = random.Next(35, 41);
            if (choosePokemon == 1)
            {
                enemyPokemon = new EnemyPokemon(new Move[] { moveList[0], moveList[1], moveList[32], moveList[33] }, new Type(Type.type.Ghost), new int[] { lvl * 4, lvl * 2 - 10, lvl * 2, lvl * 2 - 10, lvl * 2, lvl * 2, lvl * 4 }, lvl, "Tablooo", battle_controller.pokemonStaticSprites[12]);
            }
            else if (choosePokemon == 2)
            {
                enemyPokemon = new EnemyPokemon(new Move[] { moveList[0], moveList[1], moveList[16], moveList[17] }, new Type(Type.type.Dark), new int[] { lvl * 4, lvl * 2 - 10, lvl * 2, lvl * 2 - 10, lvl * 2, lvl * 2, lvl * 4 }, lvl, "Dark Wizard", battle_controller.pokemonStaticSprites[13]);
            }
            else if (choosePokemon == 3)
            {
                enemyPokemon = new EnemyPokemon(new Move[] { moveList[0], moveList[1], moveList[24], moveList[25] }, new Type(Type.type.Poison), new int[] { lvl * 4, lvl * 2 - 10, lvl * 2, lvl * 2 - 10, lvl * 2, lvl * 2, lvl * 4 }, lvl, "Aranid", battle_controller.pokemonStaticSprites[14]);
            }
        }
        //Wave 5
        //Pokemon Level 40-45
        //Types Fairy and Psychic
        else if (defeatedPokemon < 25 && defeatedPokemon >= 20)
        {
            wave = 5;
            if (defeatedPokemon == 20 && !startWave)
            {
                pokemonScript.stats[6] = pokemonScript.stats[0];
                for (int i = 0; i < 7; i++)
                {
                    pokemonScript.stats[i] += 10;
                }
                pokemonScript.allyPokemon.m_experience += 100;
                pokemonScript.allyPokemon.checkLevelUp();
                startWave = true;
            }
            int choosePokemon = random.Next(1, 3);
            int lvl           = random.Next(40, 46);
            if (choosePokemon == 1)
            {
                enemyPokemon = new EnemyPokemon(new Move[] { moveList[0], moveList[1], moveList[18], moveList[19] }, new Type(Type.type.Fairy), new int[] { lvl * 4, lvl * 2 - 10, lvl * 2, lvl * 2 - 10, lvl * 2, lvl * 2, lvl * 4 }, lvl, "Cuppy", battle_controller.pokemonStaticSprites[15]);
            }
            else if (choosePokemon == 2)
            {
                enemyPokemon = new EnemyPokemon(new Move[] { moveList[0], moveList[1], moveList[10], moveList[11] }, new Type(Type.type.Psychic), new int[] { lvl * 4, lvl * 2 - 10, lvl * 2, lvl * 2 - 10, lvl * 2, lvl * 2, lvl * 4 }, lvl, "Monka", battle_controller.pokemonStaticSprites[16]);
            }
        }
        //Wave 6
        //Pokemon Level 50
        //Types Dragon
        else if (defeatedPokemon == 25)
        {
            wave = 6;
            if (defeatedPokemon == 25 && startWave)
            {
                pokemonScript.stats[6] = pokemonScript.stats[0];
                for (int i = 0; i < 7; i++)
                {
                    pokemonScript.stats[i] += 10;
                }
                pokemonScript.allyPokemon.m_experience += 100;
                pokemonScript.allyPokemon.checkLevelUp();
                startWave = false;
            }
            int lvl = 60;
            enemyPokemon = new EnemyPokemon(new Move[] { moveList[0], moveList[1], moveList[14], moveList[15] }, new Type(Type.type.Dragon), new int[] { lvl * 4, lvl * 2 - 10, lvl * 2, lvl * 2 - 10, lvl * 2, lvl * 2, lvl * 4 }, lvl, "Kaito Dragoon", battle_controller.pokemonStaticSprites[17]);
        }
        //Win GameScreen
        //otherwaves
        GameObject         Enemypokemon       = GameObject.FindGameObjectWithTag("EnemyPokemon");
        pokemon_controller enemyPokemonScript = Enemypokemon.GetComponent <pokemon_controller>();

        Enemypokemon.GetComponent <Image>().overrideSprite = enemyPokemon.m_sprite;
        enemyPokemonScript.name     = enemyPokemon.m_name;
        enemyPokemonScript.level    = enemyPokemon.m_level;
        enemyPokemonScript.stats    = enemyPokemon.m_stats;
        enemyPokemonScript.moveList = enemyPokemon.m_moveList;
        enemyPokemonScript.type     = enemyPokemon.m_type;
        pokemonScript.allyPokemon   = script.starter;
        pokemonScript.enemyPokemon  = enemyPokemon;
    }