예제 #1
0
파일: Pokemon.cs 프로젝트: gyyfifafans/PBO
        internal Pokemon(Controller controller, int id, Player owner, IPokemonData custom)
        {
            Controller = controller;
            Id         = id;
            Owner      = owner;
            TeamId     = owner.TeamId;

            Form         = custom.Form;
            Name         = custom.Name;
            Happiness    = custom.Happiness;
            Gender       = custom.Gender;
            Lv           = custom.Lv;
            Nature       = custom.Nature;
            AbilityIndex = custom.AbilityIndex;
            Moves        = new Move[custom.Moves.Count()];
            int i = 0;

            foreach (var m in custom.Moves)
            {
                Moves[i++] = new Move(m.Move, m.PP);
            }
            _item = custom.Item;
            Iv    = new ReadOnly6D(custom.Iv);
            Ev    = new ReadOnly6D(custom.Ev);
            _hp   = MaxHp = GetMaxHp;
        }
예제 #2
0
 private static Texture[] GetAnimFromID(string folder, string ID, PokemonGender gender, bool isShiny)
 {
     Texture[] animation = new Texture[0];
     // ToDo: implement anim search pattern (with nomeclature).
     //string shiny = (isShiny) ? "s" : "";
     //if (gender == PokemonGender.FEMALE)
     //{
     //    //Attempt to load Female Variant
     //    animation = Resources.LoadAll<Texture>(folder + "/" + convertLongID(ID) + "f" + shiny + "/");
     //    if (animation.Length == 0)
     //    {
     //        Debug.LogWarning("Female Variant NOT Found (may not be required)");
     //        //Attempt to load Base Variant (possibly Shiny)
     //        animation = Resources.LoadAll<Texture>(folder + "/" + convertLongID(ID) + shiny + "/");
     //    }
     //    //	else{ Debug.Log("Female Variant Found");}
     //}
     //else
     //{
     //    //Attempt to load Base Variant (possibly Shiny)
     //    animation = Resources.LoadAll<Texture>(folder + "/" + convertLongID(ID) + shiny + "/");
     //}
     //if (animation.Length == 0 && isShiny)
     //{
     //    Debug.LogWarning("Shiny Variant NOT Found");
     //    //No Shiny Variant exists, Attempt to load Regular Variant
     //    animation = Resources.LoadAll<Texture>(folder + "/" + convertLongID(ID) + "/");
     //}
     return(animation);
 }
예제 #3
0
    public void UpdatePokemonHUD(Pokemon pokemon, Battle battle)
    {
        BTLUI_PokemonHUD pokemonHUD = GetPokemonHUD(pokemon);

        if (pokemonHUD != null)
        {
            pokemonHUD.nameTxt.text = pokemon.nickname;
            PokemonGender gender = pokemon.gender;
            if (gender != PokemonGender.Genderless)
            {
                pokemonHUD.nameTxt.text += (gender == PokemonGender.Male) ? " <color=#8080FF>♂</color>"
                    : " <color=#FF8080>♀</color>";
            }

            pokemonHUD.lvlTxt.text    = "Lv" + pokemon.level;
            pokemonHUD.statusTxt.text = "";
            StatusCondition condition = pokemon.nonVolatileStatus;
            if (condition != null)
            {
                if (condition.statusID != "healthy")
                {
                    pokemonHUD.statusTxt.text = condition.data.shortName;
                }
            }

            pokemonHUD.hpTxt.text = pokemon.currentHP + " / " + pokemon.maxHP;

            float hpPercent = battle.GetPokemonHPAsPercentage(pokemon);
            pokemonHUD.hpBar.fillAmount = hpPercent;

            pokemonHUD.hpBar.color = (hpPercent > 0.5f) ? pokemonHUD.hpHigh
                : (hpPercent > 0.25f) ? pokemonHUD.hpMed
                : pokemonHUD.hpLow;
        }
    }
예제 #4
0
        internal OnboardPokemon(Pokemon pokemon, int x)
        {
            this.pokemon = pokemon;
              conditions = new ConditionsDictionary();
              Owner = pokemon.Owner;

              Type1 = pokemon.PokemonType.Type1;
              Type2 = pokemon.PokemonType.Type2;
              Gender = pokemon.Gender;
              Ability = pokemon.Ability;
              Base = new SixD(pokemon.Base);
              Iv = new SixD(pokemon.Iv);
              Ev = new SixD(pokemon.Ev);
              Static = new SixD(pokemon.Static);
              Lv5D = new SixD();
              Moves = new Move[4] { pokemon.Moves[0], pokemon.Moves[1], pokemon.Moves[2], pokemon.Moves[3] };

              Position = new Position(pokemon.TeamId,x);

              //幻影new完后覆盖属性
              Outward = new PokemonOutward(this, pokemon.Hp);
              Outward.Name = pokemon.Name;
              Outward.Gender = Gender;
              Outward.ImageId = pokemon.PokemonType.Id;
        }
예제 #5
0
 internal OnboardPokemon(Pokemon pokemon, int x)
 {
     Pokemon = pokemon;
     FiveD   = new Simple6D();
     ChangeForm(pokemon.Form);
     Gender = pokemon.Gender;
     lv5D   = new Simple6D();
     X      = x; //CoordY 默认值
     Type1  = pokemon.Form.Type1;
     Type2  = pokemon.Form.Type2;
 }
예제 #6
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();
    }
예제 #7
0
        public static string GetGenderEmojiIcon(this PokemonGender gender)
        {
            var key       = $"gender_{gender.ToString().ToLower()}";
            var emojiId   = MasterFile.Instance.Emojis[key];
            var emojiName = string.IsNullOrEmpty(MasterFile.Instance.CustomEmojis[key])
                ? emojiId > 0
                    ? string.Format(Strings.EmojiSchema, key, emojiId)
                    : gender.ToString()
                : MasterFile.Instance.CustomEmojis[key];

            return(emojiName);
        }
예제 #8
0
    public void CreateFieldTargetBtn(BattlePosition position, Battle battleModel, BTLUI_ButtonFieldTarget btn)
    {
        btn.position = position;
        Pokemon pokemon = battleModel.GetPokemonAtPosition(position);

        btn.RefreshSelf(active: pokemon != null);
        if (pokemon != null)
        {
            btn.nameTxt.text = pokemon.nickname;
            PokemonGender gender = pokemon.gender;
            if (gender != PokemonGender.Genderless)
            {
                btn.nameTxt.text += (gender == PokemonGender.Male) ? " <color=#8080FF>♂</color>"
                    : " <color=#FF8080>♀</color>";
            }

            btn.lvlTxt.text = "<color=yellow>Lv</color>" + pokemon.level;

            StatusCondition condition = pokemon.nonVolatileStatus;
            if (condition.statusID == "healthy")
            {
                btn.statusTxt.text = "";
            }
            else
            {
                btn.statusTxt.text = condition.data.shortName;
            }

            float hpPercent = pokemon.HPPercent;
            btn.hpBar.fillAmount = hpPercent;

            btn.hpBar.color = (hpPercent > 0.5f) ? btn.hpHigh
                : (hpPercent > 0.25f) ? btn.hpMed
                : btn.hpLow;

            // draw icon
            string drawPath = "pokemonSprites/icon/" + pokemon.data.displayID;
            btn.icon.sprite = BattleAssetLoader.instance.nullPokemonIconSprite;
            if (BattleAssetLoader.instance.loadedPokemonSprites.ContainsKey(drawPath))
            {
                btn.icon.sprite = BattleAssetLoader.instance.loadedPokemonSprites[drawPath];
            }
            else
            {
                StartCoroutine(BattleAssetLoader.instance.LegacyLoadPokemon(
                                   pokemon: pokemon,
                                   useicon: true,
                                   imagePokemon: btn.icon
                                   ));
            }
        }
    }
예제 #9
0
    private void CreatePartyBtn(Pokemon pokemon, BTLUI_ButtonParty btn)
    {
        btn.pokemon = pokemon;

        btn.nameTxt.text = pokemon.nickname;
        PokemonGender gender = pokemon.gender;

        if (gender != PokemonGender.Genderless)
        {
            btn.nameTxt.text += (gender == PokemonGender.Male) ? " <color=#8080FF>♂</color>"
                : " <color=#FF8080>♀</color>";
        }

        btn.lvlTxt.text = "Lv" + pokemon.level;
        btn.hpTxt.text  = pokemon.currentHP + " / " + pokemon.maxHP;

        StatusCondition condition = pokemon.nonVolatileStatus;

        if (condition.statusID == "healthy")
        {
            btn.statusTxt.text = "";
        }
        else
        {
            btn.statusTxt.text = condition.data.shortName;
        }

        float hpPercent = pokemon.HPPercent;

        btn.hpBar.fillAmount = hpPercent;

        btn.hpBar.color = (hpPercent > 0.5f) ? btn.hpHigh
            : (hpPercent > 0.25f) ? btn.hpMed
            : btn.hpLow;

        // draw icon
        string drawPath = "pokemonSprites/icon/" + pokemon.data.displayID;

        btn.icon.sprite = BattleAssetLoader.instance.nullPokemonIconSprite;
        if (BattleAssetLoader.instance.loadedPokemonSprites.ContainsKey(drawPath))
        {
            btn.icon.sprite = BattleAssetLoader.instance.loadedPokemonSprites[drawPath];
        }
        else
        {
            StartCoroutine(BattleAssetLoader.instance.LegacyLoadPokemon(
                               pokemon: pokemon,
                               useicon: true,
                               imagePokemon: btn.icon
                               ));
        }
    }
예제 #10
0
 /// <summary>
 /// will not notify property changes
 /// </summary>
 public void SetAll(string name, PokemonForm form, PokemonGender gender, int lv, Position position, bool substitute, int hp, PokemonState state, bool shiny)
 {
     _name        = name;
     Form         = form;
     _gender      = gender;
     Lv           = lv;
     _position.X  = position.X;
     _position.Y  = position.Y;
     IsSubstitute = substitute;
     Hp.Value     = hp;
     _state       = state;
     Shiny        = shiny;
 }
예제 #11
0
        public void CreateFieldTargetBtn(
            BattlePosition position,
            PBS.Battle.View.Model battleModel,
            Panels.FieldTargetButton btn)
        {
            btn.position = position;
            PBS.Battle.View.WifiFriendly.Pokemon pokemon = battleModel.GetPokemonAtPosition(position);

            btn.RefreshSelf(active: pokemon != null);
            if (pokemon != null)
            {
                btn.nameTxt.text = pokemon.nickname;
                PokemonGender gender = pokemon.gender;
                if (gender != PokemonGender.Genderless)
                {
                    btn.nameTxt.text += (gender == PokemonGender.Male) ? " <color=#8080FF>♂</color>"
                        : " <color=#FF8080>♀</color>";
                }
                btn.lvlTxt.text = "<color=yellow>Lv</color>" + pokemon.level;

                btn.statusTxt.text = "";
                if (!string.IsNullOrEmpty(pokemon.nonVolatileStatus))
                {
                    StatusPKData statusData = StatusPKDatabase.instance.GetStatusData(pokemon.nonVolatileStatus);
                    btn.statusTxt.text = statusData.shortName;
                }

                float hpPercent = ((float)pokemon.currentHP) / pokemon.maxHP;
                btn.hpBar.fillAmount = hpPercent;

                btn.hpBar.color = (hpPercent > 0.5f) ? btn.hpHigh
                    : (hpPercent > 0.25f) ? btn.hpMed
                    : btn.hpLow;

                // draw icon
                string drawPath = "pokemonSprites/icon/" + PokemonDatabase.instance.GetPokemonData(pokemon.pokemonID).displayID;
                btn.icon.sprite = BattleAssetLoader.instance.nullPokemonIconSprite;
                if (BattleAssetLoader.instance.loadedPokemonSprites.ContainsKey(drawPath))
                {
                    btn.icon.sprite = BattleAssetLoader.instance.loadedPokemonSprites[drawPath];
                }
                else
                {
                    StartCoroutine(BattleAssetLoader.instance.LoadPokemon(
                                       pokemon: pokemon,
                                       useicon: true,
                                       imagePokemon: btn.icon
                                       ));
                }
            }
        }
예제 #12
0
 public void Transform(OnboardPokemon op)
 {
     //形态(包括种族值)、能力值、能力等级、属性、特性、技能等变为与对方怪兽一样。
     Form = op.Form;
     FiveD.Set5D(op.FiveD);
     lv5D.Set5D(op.lv5D);
     Gender      = op.Gender;
     _accuracyLv = op._accuracyLv;
     _evasionLv  = op._evasionLv;
     Type1       = op.Type1;//无视羽休
     Type2       = op.Type2;
     Ability     = op.Ability;
     _weight     = op.Weight;
 }
예제 #13
0
        public static string GetPokemonGenderIcon(this PokemonGender gender)
        {
            switch (gender)
            {
            case PokemonGender.Male:
                return("♂");   //\u2642

            case PokemonGender.Female:
                return("♀");   //\u2640

            default:
                return("⚲");   //?
            }
        }
예제 #14
0
 public void Update(Pokemon obj)
 {
     uniqueID          = obj.uniqueID;
     pokemonID         = obj.pokemonID;
     nickname          = obj.nickname;
     teamPos           = obj.teamPos;
     battlePos         = obj.battlePos;
     currentHP         = obj.currentHP;
     maxHP             = obj.maxHP;
     isFainted         = obj.isFainted;
     level             = obj.level;
     gender            = obj.gender;
     nonVolatileStatus = obj.nonVolatileStatus;
     dynamaxState      = obj.dynamaxState;
 }
예제 #15
0
 public Pokemon(global:: Pokemon obj)
 {
     uniqueID          = obj.uniqueID;
     pokemonID         = obj.pokemonID;
     nickname          = obj.nickname;
     teamPos           = obj.teamPos;
     battlePos         = obj.battlePos;
     currentHP         = obj.currentHP;
     maxHP             = obj.maxHP;
     isFainted         = !obj.IsAbleToBattle();
     level             = obj.level;
     gender            = obj.gender;
     nonVolatileStatus = (obj.nonVolatileStatus == null)? "" : obj.nonVolatileStatus.statusID;
     dynamaxState      = obj.dynamaxState;
 }
예제 #16
0
        public static string GetGenderChar(PokemonGender gender)
        {
            switch (gender)
            {
            case PokemonGender.Male:
                return("♂");

            case PokemonGender.Female:
                return("♀");

            case PokemonGender.Genderless:
                return(" ");
            }
            return("");
        }
예제 #17
0
    public void SetPartyButton(Pokemon pokemon, BTLUI_ButtonParty button)
    {
        button.nameTxt.text = pokemon.nickname;

        PokemonGender gender = pokemon.gender;

        if (gender != PokemonGender.Genderless)
        {
            button.nameTxt.text += (gender == PokemonGender.Male) ? " <color=#8080FF>♂</color>"
                : (gender == PokemonGender.Female)? " <color=#FF8080>♀</color>"
                : "";
        }

        button.lvlTxt.text    = "Lv." + pokemon.level;
        button.hpTxt.text     = pokemon.currentHP + "/" + pokemon.maxHP;
        button.statusTxt.text = (pokemon.nonVolatileStatus == null) ? ""
            : pokemon.nonVolatileStatus.data.shortName;

        // draw icon
        string drawPath = "pokemonSprites/icon/" + pokemon.data.displayID;

        button.icon.sprite = BattleAssetLoader.instance.nullPokemonIconSprite;
        if (BattleAssetLoader.instance.loadedPokemonSprites.ContainsKey(drawPath))
        {
            button.icon.sprite = BattleAssetLoader.instance.loadedPokemonSprites[drawPath];
        }
        else
        {
            StartCoroutine(BattleAssetLoader.instance.LegacyLoadPokemon(
                               pokemon: pokemon,
                               useicon: true,
                               imagePokemon: button.icon
                               ));
        }

        // HP Bar
        float hpPercent = pokemon.HPPercent;

        button.hpBar.fillAmount = hpPercent;
        button.hpBar.color      = (hpPercent > 0.5f) ? button.hpHigh
            : (hpPercent > 0.25f) ? button.hpMed
            : button.hpLow;

        button.pokemon = pokemon;
        button.UnselectSelf();
    }
예제 #18
0
파일: Party.cs 프로젝트: moto2002/pbs-unity
        public void SetPartyButton(
            PBS.Battle.View.WifiFriendly.Pokemon pokemon, 

            Panels.PartyButton button)
        {
            button.nameTxt.text = pokemon.nickname;

            PokemonGender gender = pokemon.gender;
            if (gender != PokemonGender.Genderless)
            {
                button.nameTxt.text += (gender == PokemonGender.Male) ? " <color=#8080FF>♂</color>"
                    : (gender == PokemonGender.Female)? " <color=#FF8080>♀</color>"
                    : "";
            }

            button.lvlTxt.text = "Lv." + pokemon.level;
            button.hpTxt.text = pokemon.currentHP + "/" + pokemon.maxHP;
            button.statusTxt.text = (string.IsNullOrEmpty(pokemon.nonVolatileStatus)) ? ""
                : StatusPKDatabase.instance.GetStatusData(pokemon.nonVolatileStatus).shortName;

            // draw icon
            string drawPath = "pokemonSprites/icon/" + PokemonDatabase.instance.GetPokemonData(pokemon.pokemonID).displayID;
            button.icon.sprite = BattleAssetLoader.instance.nullPokemonIconSprite;
            if (BattleAssetLoader.instance.loadedPokemonSprites.ContainsKey(drawPath))
            {
                button.icon.sprite = BattleAssetLoader.instance.loadedPokemonSprites[drawPath];
            }
            else
            {
                StartCoroutine(BattleAssetLoader.instance.LoadPokemon(
                    pokemon: pokemon,
                    useicon: true,
                    imagePokemon: button.icon
                    ));
            }

            // HP Bar
            float hpPercent = ((float)pokemon.currentHP) / pokemon.maxHP;
            button.hpBar.fillAmount = hpPercent;
            button.hpBar.color = (hpPercent > 0.5f) ? button.hpHigh
                : (hpPercent > 0.25f) ? button.hpMed
                : button.hpLow;

            button.pokemonUniqueID = pokemon.uniqueID;
            button.UnselectSelf();
        }
예제 #19
0
 public PokemonData(int id, string cp, string iv, string sta, string atk, string def, PokemonGender gender, string lvl, double lat, double lng, string move1, string move2, string height, string weight, DateTime despawn, TimeSpan secondsLeft, string formId = null)
 {
     Id          = id;
     CP          = cp;
     IV          = iv;
     Stamina     = sta;
     Attack      = atk;
     Defense     = def;
     Gender      = gender;
     Level       = lvl;
     Latitude    = lat;
     Longitude   = lng;
     FastMove    = move1;
     ChargeMove  = move2;
     Height      = height;
     Weight      = weight;
     DespawnTime = despawn;
     SecondsLeft = secondsLeft;
     FormId      = formId;
 }
예제 #20
0
        public static bool MatchesGender(PokemonGender gender, string desiredGender)
        {
            desiredGender = desiredGender.ToLower();

            if (desiredGender == "*" || gender == PokemonGender.Genderless || gender == PokemonGender.Unset)
            {
                return(true);
            }

            if (desiredGender == "m" && gender == PokemonGender.Male)
            {
                return(true);
            }

            if (desiredGender == "f" && gender == PokemonGender.Female)
            {
                return(true);
            }

            return(false);
        }
예제 #21
0
 private void generateGender(PokemonGender pGender)
 {
     if (pGender == PokemonGender.CALCULATE)
     {
         if (Species.MaleRatio < 0)
         {
             Gender = PokemonGender.NONE;
         }
         else if (Random.Range(0f, 100f) <= Species.MaleRatio)
         {
             Gender = PokemonGender.MALE;
         }
         else
         {
             Gender = PokemonGender.FEMALE;
         }
     }
     else
     {
         Gender = pGender;
     }
 }
예제 #22
0
        public static BitmapImage GetPokemonIcon(PokemonForm form, PokemonGender gender)
        {
            int         n = form.Species.Number, f = form.Index;
            BitmapImage r;

            if (gender == PokemonGender.Female && (n == 521 || n == 592 || n == 593 || n == 668))
            {
                r = GetImage("icon", n.ToString("000") + ".99");
            }
            else if (f == 0 || n == 493 || n == 649 || n == 710 || n == 711 || n == 773) //arceus/genesect/pumpkaboo/gourgeist
            {
                if (icons[n] == null)
                {
                    icons[n] = GetImage("icon", n.ToString("000") + ".00");
                }
                r = icons[n];
            }
            else
            {
                r = GetImage("icon", string.Format("{0:000}.{1:00}", n, f));
            }
            return(r);
        }
예제 #23
0
        public void UpdatePokemonHUD(
            PBS.Battle.View.WifiFriendly.Pokemon pokemon,
            string nickname            = "",
            PokemonGender gender       = PokemonGender.Genderless,
            int level                  = 1,
            string nonVolatileStatusID = null,
            int currentHP              = 1,
            int maxHP                  = 1)
        {
            HUD.PokemonHUD pokemonHUD = GetPokemonHUD(pokemon);
            if (pokemonHUD != null)
            {
                pokemonHUD.nameTxt.text = nickname;
                if (gender != PokemonGender.Genderless)
                {
                    pokemonHUD.nameTxt.text += (gender == PokemonGender.Male) ? " <color=#8080FF>♂</color>"
                        : " <color=#FF8080>♀</color>";
                }

                pokemonHUD.lvlTxt.text    = "<color=yellow>Lv</color>" + level;
                pokemonHUD.statusTxt.text = "";
                if (!string.IsNullOrEmpty(nonVolatileStatusID))
                {
                    StatusPKData statusData = StatusPKDatabase.instance.GetStatusData(nonVolatileStatusID);
                    pokemonHUD.statusTxt.text = statusData.shortName;
                }

                pokemonHUD.hpTxt.text = currentHP + " / " + maxHP;

                float hpPercent = ((float)currentHP) / maxHP;
                pokemonHUD.hpBar.fillAmount = hpPercent;

                pokemonHUD.hpBar.color = (hpPercent > 0.5f) ? pokemonHUD.hpHigh
                    : (hpPercent > 0.25f) ? pokemonHUD.hpMed
                    : pokemonHUD.hpLow;
            }
        }
예제 #24
0
 public static BitmapImage GetPokemonBack(PokemonForm form, PokemonGender gender, bool shiny)
 {
     return(GetPokemonImage("back", form, gender, shiny));
 }
예제 #25
0
 public static BitmapImage GetPokemonFront(PokemonForm form, PokemonGender gender, bool shiny)
 {
     return(GetPokemonImage("front", form, gender, shiny));
 }
예제 #26
0
        private static BitmapImage GetPokemonImage(string category, PokemonForm form, PokemonGender gender, bool shiny)
        {
            var path = /*shiny ? "shiny/" : */ "normal/" + category;

            return(GetImage(path, form.Species.Number, form.Index, gender == PokemonGender.Female));
        }
예제 #27
0
    public IEnumerator control(int typeSpaces, string defaultString, PokemonGender genderDisplay,
                               Sprite[] iconAnimation)
    {
        typeSpaceCount = typeSpaces;
        iconAnim       = iconAnimation;
        if (iconAnimation == null)
        {
            icon.sprite = (iconAnimation.Length < 1) ? null : iconAnim[0];
        }

        selectorIndex = 0;
        pageIndex     = 0;

        if (genderDisplay == PokemonGender.FEMALE)
        {
            genderText.text  = "♀";
            genderText.color = new Color(1, 0.2f, 0.2f, 1);
        }
        else if (genderDisplay == PokemonGender.MALE)
        {
            genderText.text  = "♂";
            genderText.color = new Color(0.2f, 0.4f, 1, 1);
        }
        else
        {
            genderText.text = null;
        }
        genderTextShadow.text = genderText.text;

        for (int i = 0; i < typeSpaceCount; i++)
        {
            if (i < defaultString.Length)
            {
                typeSpaceText[i].text = defaultString.Substring(i, 1);
                typeSpaceIndex        = i + 1;
            }
            else
            {
                typeSpaceText[i].text = "";
            }
            typeSpaceTextShadow[i].text = typeSpaceText[i].text;
        }

        page[0].localPosition = new Vector3(0, -31, 0);
        for (int i = 1; i < 4; i++)
        {
            page[i].localPosition = new Vector3(-300f, -31, 0);
        }

        panelButton[0].enabled = true;
        for (int i = 1; i < 6; i++)
        {
            panelButton[i].enabled = false;
        }

        float buttonDelay = 0.15f;

        StartCoroutine(animateSelector());
        StartCoroutine(animateTypeSpace());
        StartCoroutine(animateIcon());

        StartCoroutine(ScreenFade.main.Fade(true, ScreenFade.defaultSpeed));

        bool running = true;

        while (running)
        {
            if (Input.GetAxisRaw("Horizontal") > 0)
            {
                if (selectorIndex < 5)
                {
                    setSelectorPosition(selectorIndex + 1);
                    yield return(new WaitForSeconds(buttonDelay));
                }
                else if (selectorIndex == 5)
                {
                    setSelectorPosition(selectorIndex - 5);
                    yield return(new WaitForSeconds(buttonDelay));
                }
                else if (((selectorIndex - 6) - (Mathf.Floor((float)(selectorIndex - 6) / 13f) * 13)) % 13 < 12)
                {
                    setSelectorPosition(selectorIndex + 1);
                    yield return(new WaitForSeconds(buttonDelay));
                }
                else if (((selectorIndex - 6) - (Mathf.Floor((float)(selectorIndex - 6) / 13f) * 13)) % 13 == 12)
                {
                    setSelectorPosition(selectorIndex - 12);
                    yield return(new WaitForSeconds(buttonDelay));
                }
            }
            else if (Input.GetAxisRaw("Horizontal") < 0)
            {
                if (selectorIndex <= 5)
                {
                    if (selectorIndex == 0)
                    {
                        setSelectorPosition(selectorIndex + 5);
                        yield return(new WaitForSeconds(buttonDelay));
                    }
                    else if (selectorIndex > 0)
                    {
                        setSelectorPosition(selectorIndex - 1);
                        yield return(new WaitForSeconds(buttonDelay));
                    }
                }
                else if (((selectorIndex - 6) - (Mathf.Floor((float)(selectorIndex - 6) / 13f) * 13)) % 13 > 0)
                {
                    setSelectorPosition(selectorIndex - 1);
                    yield return(new WaitForSeconds(buttonDelay));
                }
                else if (((selectorIndex - 6) - (Mathf.Floor((float)(selectorIndex - 6) / 13f) * 13)) % 13 == 0)
                {
                    setSelectorPosition(selectorIndex + 12);
                    yield return(new WaitForSeconds(buttonDelay));
                }
            }
            if (Input.GetAxisRaw("Vertical") > 0)
            {
                if (pageIndex == 3)
                {
                    setSelectorPosition(3);
                    yield return(new WaitForSeconds(buttonDelay));
                }
                else if (selectorIndex > 5)
                {
                    //row 0 of keys
                    if (selectorIndex < 19)
                    {
                        if (selectorIndex > 16)
                        {
                            setSelectorPosition(5);
                        }
                        else if (selectorIndex > 13)
                        {
                            setSelectorPosition(4);
                        }
                        else if (selectorIndex > 11)
                        {
                            setSelectorPosition(3);
                        }
                        else if (selectorIndex > 9)
                        {
                            setSelectorPosition(2);
                        }
                        else if (selectorIndex > 7)
                        {
                            setSelectorPosition(1);
                        }
                        else
                        {
                            setSelectorPosition(0);
                        }
                        yield return(new WaitForSeconds(buttonDelay));
                    }
                    else
                    {
                        setSelectorPosition(selectorIndex - 13);
                        yield return(new WaitForSeconds(buttonDelay));
                    }
                }
            }
            else if (Input.GetAxisRaw("Vertical") < 0)
            {
                if (pageIndex == 3)
                {
                    setSelectorPosition(6);
                    yield return(new WaitForSeconds(buttonDelay));
                }
                else if (selectorIndex < 6)
                {
                    if (selectorIndex == 5)
                    {
                        setSelectorPosition(17);
                    }
                    else if (selectorIndex == 4)
                    {
                        setSelectorPosition(14);
                    }
                    else if (selectorIndex == 3)
                    {
                        setSelectorPosition(12);
                    }
                    else if (selectorIndex == 2)
                    {
                        setSelectorPosition(10);
                    }
                    else if (selectorIndex == 1)
                    {
                        setSelectorPosition(8);
                    }
                    else
                    {
                        setSelectorPosition(6);
                    }
                    yield return(new WaitForSeconds(buttonDelay));
                }
                else if (selectorIndex < 58)
                {
                    setSelectorPosition(selectorIndex + 13);
                    yield return(new WaitForSeconds(buttonDelay));
                }
            }
            if (Input.GetButtonDown("Start"))
            {
                setSelectorPosition(5);
                yield return(new WaitForSeconds(buttonDelay));
            }
            else if (Input.GetButtonDown("Back") || Input.GetButtonDown("Run"))
            {
                yield return(StartCoroutine(backspace()));
            }
            else if (Input.GetButtonDown("Select"))
            {
                if (selectorIndex == 0)
                {
                    //Page0
                    yield return(StartCoroutine(swapPages(0)));
                }
                else if (selectorIndex == 1)
                {
                    //Page1
                    yield return(StartCoroutine(swapPages(1)));
                }
                else if (selectorIndex == 2)
                {
                    //Page2
                    yield return(StartCoroutine(swapPages(2)));
                }
                else if (selectorIndex == 3)
                {
                    //Page3
                    yield return(StartCoroutine(swapPages(3)));
                }
                else if (selectorIndex == 4)
                {
                    //Back
                    yield return(StartCoroutine(backspace()));
                }
                else if (selectorIndex == 5)
                {
                    //OK
                    panelButton[5].enabled = true;
                    yield return(new WaitForSeconds(0.1f));

                    panelButton[5].enabled = false;
                    compileString();
                    running = false;
                }
                else
                {
                    if (pageIndex == 3)
                    {
                        //Keyboard
                        yield return(StartCoroutine(typeWithKeyboard()));
                    }
                    else
                    {
                        //Keys
                        addCurrentKeyToString();
                    }
                }
            }

            yield return(null);
        }

        //yield return new WaitForSeconds(sceneTransition.FadeOut());
        yield return(StartCoroutine(ScreenFade.main.Fade(false, ScreenFade.defaultSpeed)));

        gameObject.SetActive(false);
    }
예제 #28
0
 public static bool MatchesGender(PokemonGender gender, PokemonGender desiredGender)
 {
     return(gender == desiredGender ||
            gender == PokemonGender.Unset ||
            gender == PokemonGender.Genderless);
 }
예제 #29
0
        public static InvasionGruntType GruntTypeToTrInvasion(PokemonType type, PokemonGender gender)
        {
            switch (type)
            {
            case PokemonType.None:
                switch (gender)
                {
                case PokemonGender.Male:
                    return(InvasionGruntType.MaleGrunt);

                case PokemonGender.Female:
                    return(InvasionGruntType.FemaleGrunt);
                }
                break;

            case PokemonType.Bug:
                switch (gender)
                {
                case PokemonGender.Male:
                    return(InvasionGruntType.BugMaleGrunt);

                case PokemonGender.Female:
                    return(InvasionGruntType.BugFemaleGrunt);
                }
                break;

            case PokemonType.Dark:
                switch (gender)
                {
                case PokemonGender.Male:
                    return(InvasionGruntType.DarkMaleGrunt);

                case PokemonGender.Female:
                    return(InvasionGruntType.DarkFemaleGrunt);
                }
                break;

            case PokemonType.Dragon:
                switch (gender)
                {
                case PokemonGender.Male:
                    return(InvasionGruntType.DragonMaleGrunt);

                case PokemonGender.Female:
                    return(InvasionGruntType.DragonFemaleGrunt);
                }
                break;

            case PokemonType.Electric:
                switch (gender)
                {
                case PokemonGender.Male:
                    return(InvasionGruntType.ElectricMaleGrunt);

                case PokemonGender.Female:
                    return(InvasionGruntType.ElectricFemaleGrunt);
                }
                break;

            case PokemonType.Fairy:
                switch (gender)
                {
                case PokemonGender.Male:
                    return(InvasionGruntType.FairyMaleGrunt);

                case PokemonGender.Female:
                    return(InvasionGruntType.FairyFemaleGrunt);
                }
                break;

            case PokemonType.Fighting:
                switch (gender)
                {
                case PokemonGender.Male:
                    return(InvasionGruntType.FightingMaleGrunt);

                case PokemonGender.Female:
                    return(InvasionGruntType.FightingFemaleGrunt);
                }
                break;

            case PokemonType.Fire:
                switch (gender)
                {
                case PokemonGender.Male:
                    return(InvasionGruntType.FireMaleGrunt);

                case PokemonGender.Female:
                    return(InvasionGruntType.FireFemaleGrunt);
                }
                break;

            case PokemonType.Flying:
                switch (gender)
                {
                case PokemonGender.Male:
                    return(InvasionGruntType.FlyingMaleGrunt);

                case PokemonGender.Female:
                    return(InvasionGruntType.FlyingFemaleGrunt);
                }
                break;

            case PokemonType.Ghost:
                switch (gender)
                {
                case PokemonGender.Male:
                    //return InvasionGruntType.DarknessMaleGrunt;
                    return(InvasionGruntType.GhostMaleGrunt);

                case PokemonGender.Female:
                    //return InvasionGruntType.DarknessFemaleGrunt;
                    return(InvasionGruntType.GhostFemaleGrunt);
                }
                break;

            case PokemonType.Grass:
                switch (gender)
                {
                case PokemonGender.Male:
                    return(InvasionGruntType.GrassMaleGrunt);

                case PokemonGender.Female:
                    return(InvasionGruntType.GrassFemaleGrunt);
                }
                break;

            case PokemonType.Ground:
                switch (gender)
                {
                case PokemonGender.Male:
                    return(InvasionGruntType.GroundMaleGrunt);

                case PokemonGender.Female:
                    return(InvasionGruntType.GroundFemaleGrunt);
                }
                break;

            case PokemonType.Ice:
                switch (gender)
                {
                case PokemonGender.Male:
                    return(InvasionGruntType.IceMaleGrunt);

                case PokemonGender.Female:
                    return(InvasionGruntType.IceFemaleGrunt);
                }
                break;

            case PokemonType.Normal:
                switch (gender)
                {
                case PokemonGender.Male:
                    return(InvasionGruntType.NormalMaleGrunt);

                case PokemonGender.Female:
                    return(InvasionGruntType.NormalFemaleGrunt);
                }
                break;

            case PokemonType.Poison:
                switch (gender)
                {
                case PokemonGender.Male:
                    return(InvasionGruntType.PoisonMaleGrunt);

                case PokemonGender.Female:
                    return(InvasionGruntType.PoisonFemaleGrunt);
                }
                break;

            case PokemonType.Psychic:
                switch (gender)
                {
                case PokemonGender.Male:
                    return(InvasionGruntType.PsychicMaleGrunt);

                case PokemonGender.Female:
                    return(InvasionGruntType.PsychicFemaleGrunt);
                }
                break;

            case PokemonType.Rock:
                switch (gender)
                {
                case PokemonGender.Male:
                    return(InvasionGruntType.RockMaleGrunt);

                case PokemonGender.Female:
                    return(InvasionGruntType.RockFemaleGrunt);
                }
                break;

            case PokemonType.Steel:
                switch (gender)
                {
                case PokemonGender.Male:
                    return(InvasionGruntType.MetalMaleGrunt);

                case PokemonGender.Female:
                    return(InvasionGruntType.MetalFemaleGrunt);
                }
                break;

            case PokemonType.Water:
                switch (gender)
                {
                case PokemonGender.Male:
                    return(InvasionGruntType.WaterMaleGrunt);

                case PokemonGender.Female:
                    return(InvasionGruntType.WaterFemaleGrunt);
                }
                break;
            }
            return(InvasionGruntType.Unset);
        }
예제 #30
0
        public string GetPokemonIcon(string style, int pokemonId, int form = 0, int evolution = 0, PokemonGender gender = PokemonGender.Unset, int costume = 0, bool shiny = false)
        {
            if (!_availablePokemonForms.ContainsKey(style))
            {
                return(_iconStyles[style] + "pokemon/0.png"); // Substitute Pokemon
            }
            var evolutionSuffixes = (evolution > 0 ? new [] { "-e" + evolution, string.Empty }   : new [] { string.Empty }).ToList();
            var formSuffixes      = (form > 0 ? new [] { "-f" + form, string.Empty }        : new [] { string.Empty }).ToList();
            var costumeSuffixes   = (costume > 0 ? new [] { "-c" + costume, string.Empty }     : new [] { string.Empty }).ToList();
            var genderSuffixes    = (gender > 0 ? new [] { "-g" + (int)gender, string.Empty } : new [] { string.Empty }).ToList();
            var shinySuffixes     = (shiny         ? new [] { "-shiny", string.Empty }           : new [] { string.Empty }).ToList();

            foreach (var evolutionSuffix in evolutionSuffixes)
            {
                foreach (var formSuffix in formSuffixes)
                {
                    foreach (var costumeSuffix in costumeSuffixes)
                    {
                        foreach (var genderSuffix in genderSuffixes)
                        {
                            foreach (var shinySuffix in shinySuffixes)
                            {
                                var result = $"{pokemonId}{evolutionSuffix}{formSuffix}{costumeSuffix}{genderSuffix}{shinySuffix}";
                                if (_availablePokemonForms[style].Contains(result))
                                {
                                    return(_iconStyles[style] + $"pokemon/{result}.png");
                                }
                            }
                        }
                    }
                }
            }
            return(_iconStyles[style] + "pokemon/0.png"); // Substitute Pokemon
        }
예제 #31
0
    private IEnumerator runEvent(CustomEventTree[] treesArray, int index)
    {
        CustomEventDetails currentEvent = treesArray[eventTreeIndex].events[index];
        CustomEventDetails nextEvent    = null;

        if (index + 1 < treesArray[eventTreeIndex].events.Length)
        {
            //if not the last event
            nextEvent = treesArray[eventTreeIndex].events[index + 1];
        }

        NPCHandler targetNPC = null;

        CustomEventDetails.CustomEventType ty = currentEvent.eventType;

        Debug.Log("Run event. Type: " + ty.ToString());

        switch (ty)
        {
        case (CustomEventDetails.CustomEventType.Wait):
            yield return(new WaitForSeconds(currentEvent.float0));

            break;

        case (CustomEventDetails.CustomEventType.Walk):
            if (currentEvent.object0.GetComponent <NPCHandler>() != null)
            {
                targetNPC = currentEvent.object0.GetComponent <NPCHandler>();

                int initialDirection = targetNPC.direction;
                targetNPC.direction = (int)currentEvent.dir;
                for (int i = 0; i < currentEvent.int0; i++)
                {
                    targetNPC.direction = (int)currentEvent.dir;
                    Vector3 forwardsVector = targetNPC.getForwardsVector(true);
                    if (currentEvent.bool0)
                    {
                        //if direction locked in
                        targetNPC.direction = initialDirection;
                    }
                    while (forwardsVector == new Vector3(0, 0, 0))
                    {
                        targetNPC.direction = (int)currentEvent.dir;
                        forwardsVector      = targetNPC.getForwardsVector(true);
                        if (currentEvent.bool0)
                        {
                            //if direction locked in
                            targetNPC.direction = initialDirection;
                        }
                        yield return(new WaitForSeconds(0.1f));
                    }

                    targetNPC.setOverrideBusy(true);
                    yield return(StartCoroutine(targetNPC.move(forwardsVector, currentEvent.float0)));

                    targetNPC.setOverrideBusy(false);
                }
                targetNPC.setFrameStill();
            }     //Move the player if set to player
            if (currentEvent.object0 == PlayerMovement.player.gameObject)
            {
                int initialDirection = PlayerMovement.player.direction;

                PlayerMovement.player.speed = (currentEvent.float0 > 0)
                        ? PlayerMovement.player.walkSpeed / currentEvent.float0
                        : PlayerMovement.player.walkSpeed;
                for (int i = 0; i < currentEvent.int0; i++)
                {
                    PlayerMovement.player.updateDirection((int)currentEvent.dir);
                    Vector3 forwardsVector = PlayerMovement.player.getForwardVector();
                    if (currentEvent.bool0)
                    {
                        //if direction locked in
                        PlayerMovement.player.updateDirection(initialDirection);
                    }

                    PlayerMovement.player.setOverrideAnimPause(true);
                    yield return
                        (StartCoroutine(PlayerMovement.player.move(forwardsVector, false, currentEvent.bool0)));

                    PlayerMovement.player.setOverrideAnimPause(false);
                }
                PlayerMovement.player.speed = PlayerMovement.player.walkSpeed;
            }
            break;

        case (CustomEventDetails.CustomEventType.TurnTo):
            int   direction;
            float xDistance;
            float zDistance;
            if (currentEvent.object0.GetComponent <NPCHandler>() != null)
            {
                targetNPC = currentEvent.object0.GetComponent <NPCHandler>();
            }
            if (targetNPC != null)
            {
                if (currentEvent.object1 != null)
                {
                    //calculate target objects's position relative to this objects's and set direction accordingly.
                    xDistance = targetNPC.hitBox.position.x - currentEvent.object1.transform.position.x;
                    zDistance = targetNPC.hitBox.position.z - currentEvent.object1.transform.position.z;
                    if (xDistance >= Mathf.Abs(zDistance))
                    {
                        //Mathf.Abs() converts zDistance to a positive always.
                        direction = 3;
                    }     //this allows for better accuracy when checking orientation.
                    else if (xDistance <= Mathf.Abs(zDistance) * -1)
                    {
                        direction = 1;
                    }
                    else if (zDistance >= Mathf.Abs(xDistance))
                    {
                        direction = 2;
                    }
                    else
                    {
                        direction = 0;
                    }
                    targetNPC.setDirection(direction);
                }
                if (currentEvent.int0 != 0)
                {
                    direction = targetNPC.direction + currentEvent.int0;
                    while (direction > 3)
                    {
                        direction -= 4;
                    }
                    while (direction < 0)
                    {
                        direction += 4;
                    }
                    targetNPC.setDirection(direction);
                }
            }
            break;

        case (CustomEventDetails.CustomEventType.Dialog):
            for (int i = 0; i < currentEvent.strings.Length; i++)
            {
                Dialog.drawDialogBox();
                yield return(StartCoroutine(Dialog.drawText(currentEvent.strings[i])));

                if (i < currentEvent.strings.Length - 1)
                {
                    while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                    {
                        yield return(null);
                    }
                }
            }
            if (nextEvent != null)
            {
                if (nextEvent.eventType != CustomEventDetails.CustomEventType.Choice)
                {
                    while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                    {
                        yield return(null);
                    }
                    if (!EventRequiresDialogBox(nextEvent.eventType))
                    {
                        Dialog.undrawDialogBox();
                    }     // do not undraw the box if the next event needs it
                }
            }
            else
            {
                while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                {
                    yield return(null);
                }
                Dialog.undrawDialogBox();
            }
            break;

        case (CustomEventDetails.CustomEventType.Choice):
            if (currentEvent.strings.Length > 1)
            {
                Dialog.drawChoiceBox(currentEvent.strings);
                yield return(StartCoroutine(Dialog.choiceNavigate(currentEvent.strings)));
            }
            else
            {
                Dialog.drawChoiceBox();
                yield return(StartCoroutine(Dialog.choiceNavigate()));
            }
            int chosenIndex = Dialog.chosenIndex;
            chosenIndex = currentEvent.ints.Length - 1 - chosenIndex;     //flip it to reflect the original input
            Dialog.undrawChoiceBox();
            Dialog.undrawDialogBox();
            if (chosenIndex < currentEvent.ints.Length)
            {
                //only change tree if index is valid
                if (currentEvent.ints[chosenIndex] != eventTreeIndex &&
                    currentEvent.ints[chosenIndex] < treesArray.Length)
                {
                    JumpToTree(currentEvent.ints[chosenIndex]);
                }
            }
            break;

        case CustomEventDetails.CustomEventType.Sound:
            SfxHandler.Play(currentEvent.sound);
            break;

        case CustomEventDetails.CustomEventType.ReceiveItem:
            //Play Good for TM, Average for Item
            AudioClip itemGetMFX = (currentEvent.bool0)
                    ? Resources.Load <AudioClip>("Audio/mfx/GetGood")
                    : Resources.Load <AudioClip>("Audio/mfx/GetDecent");
            BgmHandler.main.PlayMFX(itemGetMFX);

            string firstLetter = currentEvent.string0.Substring(0, 1).ToLowerInvariant();
            Dialog.drawDialogBox();
            if (currentEvent.bool0)
            {
                Dialog.StartCoroutine("drawText",
                                      SaveData.currentSave.playerName + " received TM" +
                                      ItemDatabase.getItem(currentEvent.string0).getTMNo() + ": " + currentEvent.string0 + "!");
            }
            else
            {
                if (currentEvent.int0 > 1)
                {
                    Dialog.StartCoroutine("drawText",
                                          SaveData.currentSave.playerName + " received " + currentEvent.string0 + "s!");
                }
                else if (firstLetter == "a" || firstLetter == "e" || firstLetter == "i" || firstLetter == "o" ||
                         firstLetter == "u")
                {
                    Dialog.StartCoroutine("drawText",
                                          SaveData.currentSave.playerName + " received an " + currentEvent.string0 + "!");
                }
                else
                {
                    Dialog.StartCoroutine("drawText",
                                          SaveData.currentSave.playerName + " received a " + currentEvent.string0 + "!");
                }
            }
            yield return(new WaitForSeconds(itemGetMFX.length));

            bool itemAdd = SaveData.currentSave.Bag.addItem(currentEvent.string0, currentEvent.int0);

            Dialog.drawDialogBox();
            if (itemAdd)
            {
                if (currentEvent.bool0)
                {
                    yield return
                        (Dialog.StartCoroutine("drawTextSilent",
                                               SaveData.currentSave.playerName + " put the TM" +
                                               ItemDatabase.getItem(currentEvent.string0).getTMNo() + " \\away into the bag."));
                }
                else
                {
                    if (currentEvent.int0 > 1)
                    {
                        yield return
                            (Dialog.StartCoroutine("drawTextSilent",
                                                   SaveData.currentSave.playerName + " put the " + currentEvent.string0 +
                                                   "s \\away into the bag."));
                    }
                    else
                    {
                        yield return
                            (Dialog.StartCoroutine("drawTextSilent",
                                                   SaveData.currentSave.playerName + " put the " + currentEvent.string0 +
                                                   " \\away into the bag."));
                    }
                }
                while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                {
                    yield return(null);
                }
            }
            else
            {
                yield return(Dialog.StartCoroutine("drawTextSilent", "But there was no room..."));

                while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                {
                    yield return(null);
                }
            }
            Dialog.undrawDialogBox();
            break;

        case CustomEventDetails.CustomEventType.ReceivePokemon:
            if (SaveData.currentSave.PC.hasSpace(0))
            {
                //Play Great for Pokemon
                AudioClip pokeGetMFX = Resources.Load <AudioClip>("Audio/mfx/GetGreat");

                var pkmn = GameController.Instance.PokemonDb.GetPokemonSpeciesByGameId(currentEvent.ints[0].ToString());

                string        pkName   = pkmn.Name;
                PokemonGender pkGender = PokemonGender.CALCULATE;

                if (pkmn.MaleRatio < 0)
                {
                    pkGender = PokemonGender.NONE;
                }
                else if (pkmn.MaleRatio == 0)
                {
                    pkGender = PokemonGender.FEMALE;
                }
                else if (pkmn.MaleRatio == 100)
                {
                    pkGender = PokemonGender.MALE;
                }
                else
                {
                    //if not a set gender
                    if (currentEvent.ints[2] == 0)
                    {
                        pkGender = PokemonGender.MALE;
                    }
                    else if (currentEvent.ints[2] == 1)
                    {
                        pkGender = PokemonGender.FEMALE;
                    }
                }

                Dialog.drawDialogBox();
                yield return
                    (Dialog.StartCoroutine("drawText",
                                           SaveData.currentSave.playerName + " received the " + pkName + "!"));

                BgmHandler.main.PlayMFX(pokeGetMFX);
                yield return(new WaitForSeconds(pokeGetMFX.length));

                string nickname = currentEvent.strings[0];
                if (currentEvent.strings[1].Length == 0)
                {
                    //If no OT set, allow nicknaming of Pokemon

                    Dialog.drawDialogBox();
                    yield return
                        (StartCoroutine(
                             Dialog.drawTextSilent("Would you like to give a nickname to \nthe " + pkName +
                                                   " you received?")));

                    Dialog.drawChoiceBox();
                    yield return(StartCoroutine(Dialog.choiceNavigate()));

                    int nicknameCI = Dialog.chosenIndex;
                    Dialog.undrawDialogBox();
                    Dialog.undrawChoiceBox();

                    if (nicknameCI == 1)
                    {
                        //give nickname
                        //SfxHandler.Play(selectClip);
                        yield return(StartCoroutine(ScreenFade.main.Fade(false, 0.4f)));

                        PKUScene.main.Typing.gameObject.SetActive(true);
                        StartCoroutine(PKUScene.main.Typing.control(10, "", pkGender,
                                                                    OwnedPokemon.GetIconsFromID_(currentEvent.ints[0].ToString(), currentEvent.bool0)));
                        while (PKUScene.main.Typing.gameObject.activeSelf)
                        {
                            yield return(null);
                        }
                        if (PKUScene.main.Typing.typedString.Length > 0)
                        {
                            nickname = PKUScene.main.Typing.typedString;
                        }

                        yield return(StartCoroutine(ScreenFade.main.Fade(true, 0.4f)));
                    }
                }
                if (!EventRequiresDialogBox(nextEvent.eventType))
                {
                    Dialog.undrawDialogBox();
                }

                int[] IVs = new int[]
                {
                    Random.Range(0, 32), Random.Range(0, 32), Random.Range(0, 32),
                    Random.Range(0, 32), Random.Range(0, 32), Random.Range(0, 32)
                };
                if (currentEvent.bool1)
                {
                    //if using Custom IVs
                    IVs[0] = currentEvent.ints[5];
                    IVs[1] = currentEvent.ints[6];
                    IVs[2] = currentEvent.ints[7];
                    IVs[3] = currentEvent.ints[8];
                    IVs[4] = currentEvent.ints[9];
                    IVs[5] = currentEvent.ints[10];
                }

                //PokemonNature pkNature = (currentEvent.ints[3] == 0)
                //    ? PokemonNatureHelper.GetRandomNature()
                //    : (PokemonNature)currentEvent.ints[3] - 1;

                //string[] pkMoveset = pkd.GenerateMoveset(currentEvent.ints[1]);
                //for (int i = 0; i < 4; i++)
                //{
                //    if (currentEvent.strings[4 + i].Length > 0)
                //    {
                //        pkMoveset[i] = currentEvent.strings[4 + i];
                //    }
                //}

                //Debug.Log(pkMoveset[0] + ", " + pkMoveset[1] + ", " + pkMoveset[2] + ", " + pkMoveset[3]);


                //OwnedPokemon pk = new OwnedPokemon(currentEvent.ints[0], nickname, pkGender, currentEvent.ints[1],
                //    currentEvent.bool0, currentEvent.strings[2], currentEvent.strings[3],
                //    currentEvent.strings[1], IVs[0], IVs[1], IVs[2], IVs[3], IVs[4], IVs[5], 0, 0, 0, 0, 0, 0,
                //    pkNature, currentEvent.ints[4],
                //    pkMoveset, new int[4]);

                //SaveData.currentSave.PC.addPokemon(pk);
            }
            else
            {
                //jump to new tree
                JumpToTree(currentEvent.int0);
            }
            break;

        case (CustomEventDetails.CustomEventType.SetActive):
            if (currentEvent.bool0)
            {
                currentEvent.object0.SetActive(true);
            }
            else
            {
                if (currentEvent.object0 == this.gameObject)
                {
                    deactivateOnFinish = true;
                }
                else if (currentEvent.object0 != PlayerMovement.player.gameObject)
                {
                    //important to never deactivate the player
                    currentEvent.object0.SetActive(false);
                }
            }
            break;

        case CustomEventDetails.CustomEventType.SetCVariable:
            SaveData.currentSave.setCVariable(currentEvent.string0, currentEvent.float0);
            break;

        case (CustomEventDetails.CustomEventType.LogicCheck):
            bool passedCheck = false;

            CustomEventDetails.Logic lo = currentEvent.logic;

            switch (lo)
            {
            case CustomEventDetails.Logic.CVariableEquals:
                if (currentEvent.float0 == SaveData.currentSave.getCVariable(currentEvent.string0))
                {
                    passedCheck = true;
                }
                break;

            case CustomEventDetails.Logic.CVariableGreaterThan:
                if (SaveData.currentSave.getCVariable(currentEvent.string0) > currentEvent.float0)
                {
                    passedCheck = true;
                }
                break;

            case CustomEventDetails.Logic.CVariableLessThan:
                if (SaveData.currentSave.getCVariable(currentEvent.string0) < currentEvent.float0)
                {
                    passedCheck = true;
                }
                break;

            case CustomEventDetails.Logic.GymBadgeNoOwned:
                if (Mathf.FloorToInt(currentEvent.float0) < SaveData.currentSave.gymsBeaten.Length &&
                    Mathf.FloorToInt(currentEvent.float0) >= 0)
                {
                    //ensure input number is valid
                    if (SaveData.currentSave.gymsBeaten[Mathf.FloorToInt(currentEvent.float0)])
                    {
                        passedCheck = true;
                    }
                }
                break;

            case CustomEventDetails.Logic.GymBadgesEarned:
                int badgeCount = 0;
                for (int bi = 0; bi < SaveData.currentSave.gymsBeaten.Length; bi++)
                {
                    if (SaveData.currentSave.gymsBeaten[bi])
                    {
                        badgeCount += 1;
                    }
                }
                if (badgeCount >= currentEvent.float0)
                {
                    passedCheck = true;
                }
                break;

            case CustomEventDetails.Logic.PokemonIDIsInParty:
                for (int pi = 0; pi < 6; pi++)
                {
                    if (SaveData.currentSave.PC.boxes[0][pi] != null)
                    {
                        // ToDo: Update this script so it uses the right ID.
                        //if (SaveData.currentSave.PC.boxes[0][pi].getID() ==
                        //    Mathf.FloorToInt(currentEvent.float0))
                        //{
                        //    passedCheck = true;
                        //    pi = 6;
                        //}
                    }
                }
                break;

            case CustomEventDetails.Logic.SpaceInParty:
                if (currentEvent.bool0)
                {
                    if (!SaveData.currentSave.PC.hasSpace(0))
                    {
                        passedCheck = true;
                    }
                }
                else
                {
                    if (SaveData.currentSave.PC.hasSpace(0))
                    {
                        passedCheck = true;
                    }
                }
                break;
            }

            if (passedCheck)
            {
                int newTreeIndex = currentEvent.int0;
                if (newTreeIndex != eventTreeIndex &&     //only change tree if index is valid
                    newTreeIndex < treesArray.Length)
                {
                    JumpToTree(newTreeIndex);
                }
            }
            break;

        case CustomEventDetails.CustomEventType.TrainerBattle:

            //custom cutouts not yet implemented
            StartCoroutine(ScreenFade.main.FadeCutout(false, ScreenFade.slowedSpeed, null));

            //Automatic LoopStart usage not yet implemented
            PKUScene.main.Battle.gameObject.SetActive(true);

            Trainer trainer = currentEvent.object0.GetComponent <Trainer>();

            if (trainer.battleBGM != null)
            {
                Debug.Log(trainer.battleBGM.name);
                BgmHandler.main.PlayOverlay(trainer.battleBGM, trainer.samplesLoopStart);
            }
            else
            {
                BgmHandler.main.PlayOverlay(PKUScene.main.Battle.defaultTrainerBGM,
                                            PKUScene.main.Battle.defaultTrainerBGMLoopStart);
            }
            PKUScene.main.Battle.gameObject.SetActive(false);
            yield return(new WaitForSeconds(1.6f));

            PKUScene.main.Battle.gameObject.SetActive(true);
            StartCoroutine(PKUScene.main.Battle.control(true, trainer, currentEvent.bool0));

            while (PKUScene.main.Battle.gameObject.activeSelf)
            {
                yield return(null);
            }

            //yield return new WaitForSeconds(sceneTransition.FadeIn(0.4f));
            yield return(StartCoroutine(ScreenFade.main.Fade(true, 0.4f)));

            if (currentEvent.bool0)
            {
                if (PKUScene.main.Battle.victor == 1)
                {
                    int newTreeIndex = currentEvent.int0;
                    if (newTreeIndex != eventTreeIndex &&     //only change tree if index is valid
                        newTreeIndex < treesArray.Length)
                    {
                        JumpToTree(newTreeIndex);
                    }
                }
            }

            break;
        }
    }