Ejemplo n.º 1
0
 private void updateSelectedMove(string moveName)
 {
     if (string.IsNullOrEmpty(moveName))
     {
         selectedCategory.sprite        = Resources.Load <Sprite>("null");
         selectedPower.text             = null;
         selectedPowerShadow.text       = selectedPower.text;
         selectedAccuracy.text          = null;
         selectedAccuracyShadow.text    = selectedAccuracy.text;
         selectedDescription.text       = null;
         selectedDescriptionShadow.text = selectedDescription.text;
     }
     else
     {
         MoveData selectedMove = MoveDatabase.getMove(moveName);
         selectedCategory.sprite = Resources.Load <Sprite>("PCSprites/category" + selectedMove.getCategory().ToString());
         selectedPower.text      = "" + selectedMove.getPower();
         if (selectedPower.text == "0")
         {
             selectedPower.text = "-";
         }
         selectedPowerShadow.text = selectedPower.text;
         selectedAccuracy.text    = "" + Mathf.Round(selectedMove.getAccuracy() * 100f);
         if (selectedAccuracy.text == "0")
         {
             selectedAccuracy.text = "-";
         }
         selectedAccuracyShadow.text    = selectedAccuracy.text;
         selectedDescription.text       = selectedMove.getDescription();
         selectedDescriptionShadow.text = selectedDescription.text;
     }
 }
Ejemplo n.º 2
0
 public string getFirstFEInstance(string moveName)
 {
     for (int i = 0; i < moveset.Length; i++)
     {
         if (MoveDatabase.getMove(moveset[i]).getFieldEffect() == moveName)
         {
             return(moveset[i]);
         }
     }
     return(null);
 }
Ejemplo n.º 3
0
    private void updateMoveToLearn(string moveName)
    {
        MoveData move = MoveDatabase.getMove(moveName);

        moveNewName.text         = moveName;
        moveNewNameShadow.text   = moveNewName.text;
        moveNewType.sprite       = Resources.Load <Sprite>("PCSprites/type" + move.getType().ToString());
        moveNewPPText.text       = "PP";
        moveNewPPTextShadow.text = moveNewPPText.text;
        moveNewPP.text           = move.getPP() + "/" + move.getPP();
        moveNewPPShadow.text     = moveNewPP.text;
    }
Ejemplo n.º 4
0
    /// <summary>
    /// New Pokemon with: random IVS, Shininess, default moveset, and EVS (0)
    /// </summary>
    /// <param name="pPokemonID"></param>
    /// <param name="pGender"></param>
    /// <param name="pLevel"></param>
    /// <param name="pCaughtBall"></param>
    /// <param name="pHeldItem"></param>
    /// <param name="pOT"></param>
    /// <param name="pAbility"></param>
    public OwnedPokemon(string pPokemonID, PokemonGender pGender, int pLevel, string pCaughtBall, string pHeldItem, string pOT, int pAbility)
        : this(pPokemonID)
    {
        // Set status.
        CurrentStatus = PokemonStatus.NONE;

        // Set level and experience.
        CurrentLevel      = pLevel;
        CurrentExperience = PokemonLevelingRateHelper.GetRequiredExperienceToTargetLevel(Species.LevelingRate, CurrentLevel);

        // Set friendship.
        CurrentFriendship = Species.BaseFriendship;

        // Set gender.
        generateGender(pGender);

        // Set rare value.
        generateRareValue();

        // Set met data.
        generateMetData(pLevel, pCaughtBall);

        // Set DO n°.
        generateDONumber();

        // Set IVs and EVs.
        generateIVsAndEVs();

        // Set nature.
        Nature = PokemonNatureHelper.GetRandomNature();

        // Set ability.
        generateAbility();

        // ToDo: Set default move set as 4 highest level learnable moves
        //Set moveset based off of the highest level moves possible.
        //_currentMoveset = thisPokemonData.GenerateMoveset(_currentLevel);
        _moveHistory = _currentMoveset;

        //set maxPP and PP to be the regular PP defined by the move in the database.
        PPups = new int[4];
        maxPP = new int[4];
        PP    = new int[4];
        for (int i = 0; i < 4; i++)
        {
            if (!string.IsNullOrEmpty(_currentMoveset[i]))
            {
                maxPP[i] = MoveDatabase.getMove(_currentMoveset[i]).getPP();
                PP[i]    = maxPP[i];
            }
        }
        packMoveset();
    }
Ejemplo n.º 5
0
 public Pokemon getFirstFEUserInParty(string moveName)
 {
     for (int i = 0; i < 6; i++)
     {
         if (boxes[0][i] != null)
         {
             string[] moveset = boxes[0][i].getMoveset();
             for (int i2 = 0; i2 < moveset.Length; i2++)
             {
                 if (moveset[i2] != null)
                 {
                     if (MoveDatabase.getMove(moveset[i2]).getFieldEffect() == moveName)
                     {
                         return(boxes[0][i]);
                     }
                 }
             }
         }
     }
     return(null);
 }
Ejemplo n.º 6
0
    private void updateSelectionMoveset(Pokemon selectedPokemon)
    {
        string[] moveset = selectedPokemon.getMoveset();
        int[]    maxPP   = selectedPokemon.getMaxPP();
        int[]    PP      = selectedPokemon.getPP();
        if (!string.IsNullOrEmpty(moveset[0]))
        {
            move1Name.text         = moveset[0];
            move1NameShadow.text   = move1Name.text;
            move1Type.sprite       = Resources.Load <Sprite>("PCSprites/type" + MoveDatabase.getMove(moveset[0]).getType().ToString());
            move1PPText.text       = "PP";
            move1PPTextShadow.text = move1PPText.text;
            move1PP.text           = PP[0] + "/" + maxPP[0];
            move1PPShadow.text     = move1PP.text;
        }
        else
        {
            move1Name.text         = null;
            move1NameShadow.text   = move1Name.text;
            move1Type.sprite       = Resources.Load <Sprite>("null");
            move1PPText.text       = null;
            move1PPTextShadow.text = move1PPText.text;
            move1PP.text           = null;
            move1PPShadow.text     = move1PP.text;
        }
        if (!string.IsNullOrEmpty(moveset[1]))
        {
            move2Name.text         = moveset[1];
            move2NameShadow.text   = move2Name.text;
            move2Type.sprite       = Resources.Load <Sprite>("PCSprites/type" + MoveDatabase.getMove(moveset[1]).getType().ToString());
            move2PPText.text       = "PP";
            move2PPTextShadow.text = move2PPText.text;
            move2PP.text           = PP[1] + "/" + maxPP[1];
            move2PPShadow.text     = move2PP.text;
        }
        else
        {
            move2Name.text         = null;
            move2NameShadow.text   = move2Name.text;
            move2Type.sprite       = Resources.Load <Sprite>("null");
            move2PPText.text       = null;
            move2PPTextShadow.text = move2PPText.text;
            move2PP.text           = null;
            move2PPShadow.text     = move2PP.text;
        }
        if (!string.IsNullOrEmpty(moveset[2]))
        {
            move3Name.text         = moveset[2];
            move3NameShadow.text   = move3Name.text;
            move3Type.sprite       = Resources.Load <Sprite>("PCSprites/type" + MoveDatabase.getMove(moveset[2]).getType().ToString());
            move3PPText.text       = "PP";
            move3PPTextShadow.text = move3PPText.text;
            move3PP.text           = PP[2] + "/" + maxPP[2];
            move3PPShadow.text     = move3PP.text;
        }
        else
        {
            move3Name.text         = null;
            move3NameShadow.text   = move3Name.text;
            move3Type.sprite       = Resources.Load <Sprite>("null");
            move3PPText.text       = null;
            move3PPTextShadow.text = move3PPText.text;
            move3PP.text           = null;
            move3PPShadow.text     = move3PP.text;
        }
        if (!string.IsNullOrEmpty(moveset[3]))
        {
            move4Name.text         = moveset[3];
            move4NameShadow.text   = move4Name.text;
            move4Type.sprite       = Resources.Load <Sprite>("PCSprites/type" + MoveDatabase.getMove(moveset[3]).getType().ToString());
            move4PPText.text       = "PP";
            move4PPTextShadow.text = move4PPText.text;
            move4PP.text           = PP[3] + "/" + maxPP[3];
            move4PPShadow.text     = move4PP.text;
        }
        else
        {
            move4Name.text         = null;
            move4NameShadow.text   = move4Name.text;
            move4Type.sprite       = Resources.Load <Sprite>("null");
            move4PPText.text       = null;
            move4PPTextShadow.text = move4PPText.text;
            move4PP.text           = null;
            move4PPShadow.text     = move4PP.text;
        }

        updateSelectedMove(null);
    }
Ejemplo n.º 7
0
    // New pokemon with all details
    public Pokemon(int pokemonID, string nickname, Gender gender, int level, bool isShiny, Ball caughtBall, string heldItem, string OT,
                   int IV_HP, int IV_ATK, int IV_DEF, int IV_SPA, int IV_SPD, int IV_SPE, int EV_HP, int EV_ATK, int EV_DEF, int EV_SPA, int EV_SPD, int EV_SPE,
                   string nature, int ability, string[] moveset, int[] PPups)
    {
        PokemonData thisPokemonData = PokemonDatabase.getPokemon(pokemonID);

        this.pokemonID = pokemonID;
        this.nickname  = nickname;
        this.form      = 0;
        this.gender    = gender;

        if (gender == Gender.CALCULATE)
        {
            if (thisPokemonData.getMaleRatio() < 0)
            {
                this.gender = Gender.NONE;
            }
            else if (Random.Range(0f, 100f) <= thisPokemonData.getMaleRatio())
            {
                this.gender = Gender.MALE;
            }
            else
            {
                this.gender = Gender.FEMALE;
            }
        }

        this.level        = level;
        this.exp          = PokemonDatabase.getLevelExp(level);
        this.nextLevelExp = PokemonDatabase.getLevelExp(level + 1);
        this.friendship   = thisPokemonData.getBaseFriendship();
        this.isShiny      = isShiny;
        this.status       = Status.NONE;
        this.sleepTurns   = 0;
        this.caughtBall   = caughtBall;
        this.heldItem     = heldItem;
        this.OT           = (string.IsNullOrEmpty(OT) ? "Unknown" : OT);
        this.metLevel     = level;
        this.metMap       = "Somewhere";
        this.metDate      = System.DateTime.Today.Day + "/" + System.DateTime.Today.Month + "/" + System.DateTime.Today.Year;

        this.IV_HP  = IV_HP;
        this.IV_ATK = IV_ATK;
        this.IV_DEF = IV_DEF;
        this.IV_SPA = IV_SPA;
        this.IV_SPD = IV_SPD;
        this.IV_SPE = IV_SPE;

        this.EV_HP  = EV_HP;
        this.EV_ATK = EV_ATK;
        this.EV_DEF = EV_DEF;
        this.EV_SPA = EV_SPA;
        this.EV_SPD = EV_SPD;
        this.EV_SPE = EV_SPE;

        this.nature = nature;
        this.calculateStats();
        this.currentHP   = HP;
        this.ability     = ability;
        this.moveset     = moveset;
        this.moveHistory = moveset;
        this.PPups       = PPups;
        this.maxPP       = new int[4];
        this.PP          = new int[4];

        for (int i = 0; i < 4; i++)
        {
            if (!string.IsNullOrEmpty(moveset[i]))
            {
                this.maxPP[i] = Mathf.FloorToInt(MoveDatabase.getMove(moveset[i]).getPP() * ((this.PPups[i] * 0.2f) + 1));
                this.PP[i]    = this.maxPP[i];
            }
        }
        packMoveset();
    }
Ejemplo n.º 8
0
    // Caught pokemon, only a few customizable details
    public Pokemon(Pokemon pokemon, string nickname, Ball caughtBall)
    {
        PokemonData thisPokemonData = PokemonDatabase.getPokemon(pokemonID);

        this.pokemonID = pokemon.pokemonID;
        this.nickname  = nickname;
        this.form      = 0;
        this.gender    = pokemon.gender;


        this.level        = pokemon.level;
        this.exp          = pokemon.exp;
        this.nextLevelExp = pokemon.nextLevelExp;
        this.friendship   = pokemon.friendship;

        this.isShiny = pokemon.isShiny;

        this.status     = pokemon.status;
        this.sleepTurns = pokemon.sleepTurns;
        this.caughtBall = caughtBall;
        this.heldItem   = pokemon.heldItem;

        this.OT       = "Unknown";
        this.metLevel = level;
        this.metMap   = "Somewhere";
        this.metDate  = System.DateTime.Today.Day + "/" + System.DateTime.Today.Month + "/" + System.DateTime.Today.Year;

        this.IV_HP  = pokemon.IV_HP;
        this.IV_ATK = pokemon.IV_ATK;
        this.IV_DEF = pokemon.IV_DEF;
        this.IV_SPA = pokemon.IV_SPA;
        this.IV_SPD = pokemon.IV_SPD;
        this.IV_SPE = pokemon.IV_SPE;

        this.EV_HP  = pokemon.EV_HP;
        this.EV_ATK = pokemon.EV_ATK;
        this.EV_DEF = pokemon.EV_DEF;
        this.EV_SPA = pokemon.EV_SPA;
        this.EV_SPD = pokemon.EV_SPD;
        this.EV_SPE = pokemon.EV_SPE;

        this.nature = pokemon.nature;
        this.calculateStats();
        this.currentHP = pokemon.currentHP;
        this.ability   = pokemon.ability;

        this.moveset     = pokemon.moveset;
        this.moveHistory = pokemon.moveHistory;

        this.PPups = pokemon.PPups;
        this.maxPP = new int[4];
        this.PP    = new int[4];

        for (int i = 0; i < 4; i++)
        {
            if (!string.IsNullOrEmpty(moveset[i]))
            {
                this.maxPP[i] = Mathf.FloorToInt(MoveDatabase.getMove(moveset[i]).getPP() * ((this.PPups[i] * 0.2f) + 1));
                this.PP[i]    = this.maxPP[i];
            }
        }
        packMoveset();
    }
Ejemplo n.º 9
0
    // New pokemon with random IVs and shininess, default moveset and 0 EVs
    public Pokemon(int pokemonID, Gender gender, int level, Ball caughtBall, string heldItem, string OT, int ability)
    {
        PokemonData thisPokemonData = PokemonDatabase.getPokemon(pokemonID);

        this.pokemonID = pokemonID;
        this.form      = 0;
        this.gender    = gender;

        if (gender == Gender.CALCULATE)
        {
            if (thisPokemonData.getMaleRatio() < 0)
            {
                this.gender = Gender.NONE;
            }
            else if (Random.Range(0f, 100f) <= thisPokemonData.getMaleRatio())
            {
                this.gender = Gender.MALE;
            }
            else
            {
                this.gender = Gender.FEMALE;
            }
        }

        this.level        = level;
        this.exp          = PokemonDatabase.getLevelExp(level);
        this.nextLevelExp = PokemonDatabase.getLevelExp(level + 1);
        this.friendship   = thisPokemonData.getBaseFriendship();

        this.isShiny = (Random.Range(0, 65536) < 16);

        this.status     = Status.NONE;
        this.sleepTurns = 0;
        this.caughtBall = caughtBall;
        this.heldItem   = heldItem;
        this.OT         = (string.IsNullOrEmpty(OT) ? "Unknown" : OT);
        this.metLevel   = level;
        this.metMap     = "Somewhere";
        this.metDate    = System.DateTime.Today.Day + "/" + System.DateTime.Today.Month + "/" + System.DateTime.Today.Year;

        this.IV_HP  = Random.Range(0, 32);
        this.IV_ATK = Random.Range(0, 32);
        this.IV_DEF = Random.Range(0, 32);
        this.IV_SPA = Random.Range(0, 32);
        this.IV_SPD = Random.Range(0, 32);
        this.IV_SPE = Random.Range(0, 32);

        this.EV_HP  = 0;
        this.EV_ATK = 0;
        this.EV_DEF = 0;
        this.EV_SPA = 0;
        this.EV_SPD = 0;
        this.EV_SPE = 0;

        this.nature = NatureDatabase.getRandomNature().getName();
        this.calculateStats();
        this.currentHP = HP;

        if (ability < 0 || ability > 2)
        {
            this.ability = Random.Range(0, 2);
        }
        else
        {
            this.ability = ability;
        }

        this.moveset     = thisPokemonData.generateMoveset(this.level);
        this.moveHistory = moveset;

        this.PPups = new int[4];
        this.maxPP = new int[4];
        this.PP    = new int[4];

        for (int i = 0; i < 4; i++)
        {
            if (!string.IsNullOrEmpty(moveset[i]))
            {
                this.maxPP[i] = MoveDatabase.getMove(this.moveset[i]).getPP();
                this.PP[i]    = this.maxPP[i];
            }
        }
        packMoveset();
    }
Ejemplo n.º 10
0
 private void ResetPP(int index)
 {
     PPups[index] = 0;
     maxPP[index] = Mathf.FloorToInt(MoveDatabase.getMove(moveset[index]).getPP() * ((PPups[index] * 0.2f) + 1));
     PP[index]    = maxPP[index];
 }
Ejemplo n.º 11
0
    /// <summary>
    /// Adding a caught pokemon (only a few customizable details)
    /// </summary>
    /// <param name="pPokemon"></param>
    /// <param name="pNickname"></param>
    /// <param name="pCaughtBall"></param>
    public OwnedPokemon(OwnedPokemon pPokemon, string pNickname, string pCaughtBall)
        : this(pPokemon.Species.GameId)
    {
        Nickname = pNickname;

        // Set status.
        CurrentStatus = pPokemon.CurrentStatus;

        // Set level and experience.
        CurrentLevel      = pPokemon.CurrentLevel;
        CurrentExperience = pPokemon.CurrentExperience;

        // Set friendship.
        CurrentFriendship = pPokemon.Species.BaseFriendship;

        // Set gender.
        Gender = pPokemon.Gender;

        // Set rare value.
        RareValue = pPokemon.RareValue;

        // Set met data.
        MetData = pPokemon.MetData;

        // Set DO n°.
        generateDONumber();


        // Set nature.
        Nature = pPokemon.Nature;

        // Set ability.
        CurrentAbility = pPokemon.CurrentAbility;

        Stats = pPokemon.Stats;
        //// Copy IVs.
        //Stats[PokemonStatType.HP].IV = pPokemon.GetIV(PokemonStatType.HP);
        //Stats[PokemonStatType.Attack].IV = pPokemon.GetIV(PokemonStatType.Attack);
        //Stats[PokemonStatType.Defence].IV = pPokemon.GetIV(PokemonStatType.Defence);
        //Stats[PokemonStatType.SpecialAttack].IV = pPokemon.GetIV(PokemonStatType.SpecialAttack);
        //Stats[PokemonStatType.SpecialDefence].IV = pPokemon.GetIV(PokemonStatType.SpecialDefence);
        //Stats[PokemonStatType.Speed].IV = pPokemon.GetIV(PokemonStatType.Speed);

        //// Copy EVs.
        //Stats[PokemonStatType.HP].EV = pPokemon.GetEV(PokemonStatType.HP);
        //Stats[PokemonStatType.Attack].EV = pPokemon.GetEV(PokemonStatType.Attack);
        //Stats[PokemonStatType.Defence].EV = pPokemon.GetEV(PokemonStatType.Defence);
        //Stats[PokemonStatType.SpecialAttack].EV = pPokemon.GetEV(PokemonStatType.SpecialAttack);
        //Stats[PokemonStatType.SpecialDefence].EV = pPokemon.GetEV(PokemonStatType.SpecialDefence);
        //Stats[PokemonStatType.Speed].EV = pPokemon.GetEV(PokemonStatType.Speed);

        // MoveSet.
        _currentMoveset = pPokemon._currentMoveset;
        _moveHistory    = pPokemon._moveHistory;

        PPups = pPokemon.PPups;
        //set maxPP and PP to be the regular PP defined by the move in the database.
        maxPP = new int[4];
        PP    = new int[4];
        for (int i = 0; i < 4; i++)
        {
            if (!string.IsNullOrEmpty(_currentMoveset[i]))
            {
                maxPP[i] = Mathf.FloorToInt(MoveDatabase.getMove(_currentMoveset[i]).getPP() * ((PPups[i] * 0.2f) + 1));
                PP[i]    = maxPP[i];
            }
        }
        packMoveset();
    }