예제 #1
0
 void Start()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
예제 #2
0
        private void BuildMovesScreen(Pokemon.Pokemon pokemon)
        {
            // Background and Title
            moves_bg.enabled    = true;
            moves_title.enabled = true;
            moves_title.text    = SUMMARY_PAGES[(int)SummaryPages.Moves];

            // General Components
            BuildGeneralComponents(pokemon);

            // Moves Components
            for (int i = 0; i < Constants.NUM_MOVES; i++)
            {
                if (pokemon.moves[i].move == Moves.None)
                {
                    moves_types[i].enabled     = false;
                    moves_names[i].enabled     = false;
                    moves_pp_labels[i].enabled = false;
                    moves_pp[i].enabled        = false;
                }
                else
                {
                    MoveSlot move = pokemon.moves[i];
                    moves_types[i].enabled     = true;
                    moves_types[i].sprite      = types[(int)move.type];
                    moves_names[i].enabled     = true;
                    moves_names[i].text        = move.name;
                    moves_pp_labels[i].enabled = true;
                    moves_pp_labels[i].text    = PP_TEXT;
                    moves_pp[i].enabled        = true;
                    moves_pp[i].text           = pokemon.moves[i].remaining_PP.ToString() + PP_SEPERATOR_TEXT + pokemon.moves[i].total_pp.ToString();
                }
            }
        }
    private void SetCombatPeaceful()
    {
        for (int i = 0; i < SkillSlots.Count; i++)
        {
            if (!SkillSlots[i].IsEmpty)
            {
                SkillSlots[i].SetDisabledState();
            }
        }

        MoveSlot.SetMovableState();
        passSlot.SetDisabledState();
    }
    private void SkillSlotCombatSkillSelected(BattleSkillSlot slot)
    {
        SelectedSkill = slot.Skill;
        for (int i = 0; i < SkillSlots.Count; i++)
        {
            if (SkillSlots[i].IsEmpty)
            {
                continue;
            }

            if (SkillSlots[i] != slot)
            {
                SkillSlots[i].Deselect();
            }
        }
        MoveSlot.Deselect();
    }
예제 #5
0
        public void TestMethod1()
        {
            // 實現角色(client) & 角色附有招式(Command)
            Knight    knight    = new Knight();
            Swordsman swordsman = new Swordsman();

            // 實現招式插槽(Invoker)
            ISlot moveSlot = new MoveSlot();

            // 實現怪物(Receiver)
            IMonster monster = new Slime();

            // 注入招式(Command)至招式插槽(Invoker)
            moveSlot.SetMovesSlot(1, knight.MoveList[2]);
            moveSlot.SetMovesSlot(3, swordsman.MoveList[1]);

            // 透過招式插槽(Invoker)打擊怪物(Receiver)
            moveSlot.Moves[0].Cast(monster);
            moveSlot.Moves[1].Cast(monster);
        }
    private void UpdateCombatSkills()
    {
        if (RaidSceneManager.RaidPanel.SelectedHero.Mode == null)
        {
            int selectedSkills = Mathf.Min(RaidSceneManager.RaidPanel.SelectedHero.SelectedCombatSkills.Count, SkillSlots.Count);

            for (int i = 0; i < selectedSkills; i++)
            {
                SkillSlots[i].UpdateSkill(RaidSceneManager.RaidPanel.SelectedHero,
                                          RaidSceneManager.RaidPanel.SelectedHero.SelectedCombatSkills[i]);
            }

            for (int i = selectedSkills; i < SkillSlots.Count; i++)
            {
                SkillSlots[i].ResetSkill();
            }
        }
        else
        {
            var modeSkills = RaidSceneManager.RaidPanel.SelectedHero.SelectedCombatSkills.FindAll(skill =>
                                                                                                  skill.ValidModes.Contains(RaidSceneManager.RaidPanel.SelectedHero.Mode.Id));
            int selectedSkills = Mathf.Min(RaidSceneManager.RaidPanel.SelectedHero.SelectedCombatSkills.Count, modeSkills.Count);

            for (int i = 0; i < selectedSkills; i++)
            {
                SkillSlots[i].UpdateSkill(RaidSceneManager.RaidPanel.SelectedHero, modeSkills[i]);
            }

            for (int i = selectedSkills; i < SkillSlots.Count; i++)
            {
                SkillSlots[i].ResetSkill();
            }
        }

        MoveSlot.UpdateSkill();
    }
예제 #7
0
 private void SwapMoves(int move_1_index, int move_2_index)
 {
     temp_move_slot = current_pokemon.moves[move_1_index];
     current_pokemon.moves[move_1_index] = current_pokemon.moves[move_2_index];
     current_pokemon.moves[move_2_index] = temp_move_slot;
 }
예제 #8
0
        private void BuildMoveDetailScreen(Pokemon.Pokemon pokemon)
        {
            // Background and Title
            move_detail_bg.enabled    = true;
            move_detail_title.enabled = true;
            move_detail_title.text    = MOVE_DETAIL_PAGE;

            // Move Detail Components
            for (int i = 0; i < Constants.NUM_MOVES; i++)
            {
                if (pokemon.moves[i].move == Moves.None)
                {
                    move_detail_types[i].enabled     = false;
                    move_detail_names[i].enabled     = false;
                    move_detail_pp_labels[i].enabled = false;
                    move_detail_pp[i].enabled        = false;
                }
                else
                {
                    MoveSlot move_slot = pokemon.moves[i];
                    move_detail_types[i].enabled     = true;
                    move_detail_types[i].sprite      = types[(int)move_slot.type];
                    move_detail_names[i].enabled     = true;
                    move_detail_names[i].text        = move_slot.name;
                    move_detail_pp_labels[i].enabled = true;
                    move_detail_pp_labels[i].text    = PP_TEXT;
                    move_detail_pp[i].enabled        = true;
                    move_detail_pp[i].text           = move_slot.remaining_PP.ToString() + PP_SEPERATOR_TEXT + move_slot.total_pp.ToString();
                }
            }
            move_detail_poke_icon.enabled = true;
            move_detail_poke_icon.sprite  = Specie.GetPokemonIcon((uint)pokemon.species, 0, (uint)pokemon.form_id);
            if (pokemon.types[1] == Pokemon.Types.None)
            {
                move_detail_one_type.enabled     = true;
                move_detail_one_type.sprite      = types[(int)pokemon.types[0]];
                move_detail_two_types[0].enabled = false;
                move_detail_two_types[1].enabled = false;
            }
            else
            {
                move_detail_one_type.enabled     = false;
                move_detail_two_types[0].enabled = true;
                move_detail_two_types[0].sprite  = types[(int)pokemon.types[0]];
                move_detail_two_types[1].enabled = true;
                move_detail_two_types[1].sprite  = types[(int)pokemon.types[1]];
            }
            move_detail_info_labels.enabled = true;
            move_detail_info_labels.text    = "";
            for (int i = 0; i < MOVE_INFO_TEXT.Length; i++)
            {
                move_detail_info_labels.text += MOVE_INFO_TEXT[i] + '\n';
            }
            Move move = Move.moves[pokemon.moves[selected_move].move];

            move_detail_category.enabled  = true;
            move_detail_category.sprite   = move_categories[(int)move.damage_category];
            move_detail_info.enabled      = true;
            move_detail_info.text         = move.GetBasePowerText() + '\n' + move.GetAccuracyText();
            move_detail_desc.enabled      = true;
            move_detail_desc.text         = move.description;
            move_detail_sel.enabled       = true;
            move_detail_sel.sprite        = move_sel[0];
            move_detail_selection.enabled = false;
        }
    private void SetUsableCombatSkills()
    {
        BattleFormation allies = RaidSceneManager.RaidPanel.SelectedUnit.Team == Team.Heroes ?
                                 RaidSceneManager.BattleGround.HeroFormation : RaidSceneManager.BattleGround.MonsterFormation;
        BattleFormation enemies = RaidSceneManager.RaidPanel.SelectedUnit.Team == Team.Heroes ?
                                  RaidSceneManager.BattleGround.MonsterFormation : RaidSceneManager.BattleGround.HeroFormation;

        for (int i = 0; i < SkillSlots.Count; i++)
        {
            if (SkillSlots[i].IsEmpty)
            {
                continue;
            }

            if (SkillSlots[i].Skill.LimitPerBattle.HasValue)
            {
                if (RaidSceneManager.RaidPanel.SelectedUnit.CombatInfo.SkillsUsedInBattle.
                    FindAll(skillId => skillId == SkillSlots[i].Skill.Id).Count >= SkillSlots[i].Skill.LimitPerBattle.Value)
                {
                    SkillSlots[i].SetDisabledState();
                    continue;
                }
            }

            if (SkillSlots[i].Skill.LimitPerTurn.HasValue)
            {
                if (RaidSceneManager.RaidPanel.SelectedUnit.CombatInfo.SkillsUsedThisTurn.
                    FindAll(skillId => skillId == SkillSlots[i].Skill.Id).Count >= SkillSlots[i].Skill.LimitPerTurn.Value)
                {
                    SkillSlots[i].SetDisabledState();
                    continue;
                }
            }

            if (SkillSlots[i].Skill.LaunchRanks.IsLaunchableFrom(RaidSceneManager.RaidPanel.SelectedUnit.Rank,
                                                                 RaidSceneManager.RaidPanel.SelectedUnit.Size))
            {
                if (BattleSolver.IsPerformerSkillTargetable(SkillSlots[i].Skill,
                                                            allies, enemies, RaidSceneManager.RaidPanel.SelectedUnit))
                {
                    SkillSlots[i].SetCombatState();

                    if (RaidSceneManager.RaidPanel.SelectedUnit.CombatInfo.LastCombatSkillUsed == SkillSlots[i].Skill.Id)
                    {
                        SkillSlots[i].Select();
                    }

                    continue;
                }
            }
            SkillSlots[i].SetDisabledState();
        }
        if (RaidSceneManager.RaidPanel.SelectedUnit.CombatInfo.IsImmobilized)
        {
            MoveSlot.SetDisabledState();
        }
        else
        {
            MoveSlot.SetCombatState();
        }

        passSlot.SetCombatState();
    }