Ejemplo n.º 1
0
 public void Back()
 {
     DataHolder.BattleSystem().TargetSelectionOff();
     this.blinkSet = -1;
     if(this.lastBMItem == null || this.lastBMItem.type == BattleMenu.ATTACK || !this.lastBMItem.isTarget)
     {
         this.mode = BattleMenuMode.BASE;
         this.list = DataHolder.BattleMenu().BattleMenuList(this.owner);
         this.bmPosition = DataHolder.BattleMenu().dialoguePosition;
         this.UpdateChoices(true);
         this.lastBMItem = null;
     }
     else if(this.lastBMItem.type == BattleMenu.SKILL && this.lastBMItem.isTarget)
     {
         this.mode = BattleMenuMode.SKILL;
         this.list = DataHolder.BattleMenu().GetSkillMenuList(DataHolder.Skill(this.lastBMItem.id).skilltype, this.owner);
         this.bmPosition = DataHolder.BattleMenu().skillPosition;
         this.UpdateChoices(true);
         this.lastBMItem = new BattleMenuItem(new GUIContent(""), -1, BattleMenu.SKILL, false, "");
     }
     else if(this.lastBMItem.type == BattleMenu.ITEM && this.lastBMItem.isTarget)
     {
         this.mode = BattleMenuMode.ITEM;
         this.list = DataHolder.BattleMenu().GetItemMenuList(DataHolder.Item(this.lastBMItem.id).itemType, this.owner);
         this.bmPosition = DataHolder.BattleMenu().itemPosition;
         this.UpdateChoices(true);
         this.lastBMItem = new BattleMenuItem(new GUIContent(""), -1, BattleMenu.ITEM, false, "");
     }
 }
Ejemplo n.º 2
0
 /*
 ============================================================================
 Call functions
 ============================================================================
 */
 public void CallMenu(BattleMenuMode m, BattleMenuItem bmi)
 {
     this.lastUpdate = Time.time;
     this.callMode = m;
     this.mode = m;
     this.Init(bmi);
 }
Ejemplo n.º 3
0
 public void TargetClicked(int battleID)
 {
     bool found = false;
     for(int i=0; i<this.list.Length; i++)
     {
         if(this.list[i].action != null && this.list[i].action.targetID == battleID)
         {
             this.lastBMItem = this.list[i];
             found = true;
             break;
         }
     }
     if(found)
     {
         DataHolder.GameSettings().PlayAcceptAudio(GameHandler.GetLevelHandler().audio);
         BattleAction action = this.lastBMItem.action;
         action.BlinkTargets(false);
         this.owner.EndBattleMenu(false);
         this.owner.AddAction(action);
     }
 }
Ejemplo n.º 4
0
 /*
 ============================================================================
 Interaction functions
 ============================================================================
 */
 public void Select(int index)
 {
     BattleMenuItem prevItem = this.lastBMItem;
     this.lastBMItem = this.list[this.realID[index]];
     if(this.lastBMItem.isTarget)
     {
         if((this.lastBMItem.type == BattleMenu.ATTACK && this.owner.IsBlockAttack()) ||
                 (this.lastBMItem.type == BattleMenu.SKILL && this.owner.IsBlockSkills()) ||
                 (this.lastBMItem.type == BattleMenu.ITEM && this.owner.IsBlockItems()))
         {
             this.lastBMItem = null;
         }
         else if(this.lastBMItem.action == null)
         {
             if(this.lastBMItem.type == BattleMenu.SKILL &&
                 !DataHolder.Skill(this.lastBMItem.id).CanUse(this.owner, this.lastBMItem.useLevel))
             {
                 this.mode = BattleMenuMode.SKILL;
                 this.list = DataHolder.BattleMenu().GetSkillMenuList(DataHolder.Skill(this.lastBMItem.id).skilltype, this.owner);
                 this.bmPosition = DataHolder.BattleMenu().skillPosition;
                 this.UpdateChoices(true);
                 this.lastBMItem = new BattleMenuItem(new GUIContent(""), -1, BattleMenu.SKILL, false, "");
             }
             else
             {
                 BattleMenuItem[] newList = DataHolder.BattleMenu().GetTargetMenuList(this.lastBMItem, this.owner);
                 if((DataHolder.BattleMenu().addBack && newList.Length > 1) ||
                     (!DataHolder.BattleMenu().addBack && newList.Length > 0))
                 {
                     this.mode = BattleMenuMode.TARGET;
                     this.list = newList;
                     this.bmPosition = DataHolder.BattleMenu().targetPosition;
                     this.UpdateChoices(true);
                 }
                 else
                 {
                     this.lastBMItem = prevItem;
                     GameHandler.GetLevelHandler().SetLastBMIndex();
                 }
             }
         }
         else
         {
             BattleAction action = this.lastBMItem.action;
             action.BlinkTargets(false);
             if(action.targetRaycast.NeedInteraction())
             {
                 this.rayTarget = true;
                 this.rayAction = action;
                 this.mode = BattleMenuMode.TARGET;
                 this.list = new BattleMenuItem[0];
                 this.UpdateChoices(true);
                 this.hide = true;
             }
             else
             {
                 if(action.targetRaycast.active)
                 {
                     action.rayTargetSet = true;
                     action.rayPoint = action.targetRaycast.GetRayPoint(this.owner.prefabInstance, VectorHelper.GetScreenCenter());
                 }
                 this.owner.EndBattleMenu(false);
                 this.owner.AddAction(action);
             }
         }
     }
     else
     {
         if(this.lastBMItem.type == BattleMenu.SKILL)
         {
             if(this.owner.IsBlockSkills())
             {
                 this.lastBMItem = null;
             }
             else
             {
                 this.mode = BattleMenuMode.SKILL;
                 this.list = DataHolder.BattleMenu().GetSkillMenuList(this.lastBMItem.id, this.owner);
                 this.bmPosition = DataHolder.BattleMenu().skillPosition;
                 this.UpdateChoices(true);
             }
         }
         else if(this.lastBMItem.type == BattleMenu.ITEM)
         {
             if(this.owner.IsBlockItems())
             {
                 this.lastBMItem = null;
             }
             else
             {
                 this.mode = BattleMenuMode.ITEM;
                 this.list = DataHolder.BattleMenu().GetItemMenuList(this.lastBMItem.id, this.owner);
                 this.bmPosition = DataHolder.BattleMenu().itemPosition;
                 this.UpdateChoices(true);
             }
         }
         else if(this.lastBMItem.type == BattleMenu.DEFEND)
         {
             if(this.owner.IsBlockDefend())
             {
                 this.lastBMItem = null;
             }
             else
             {
                 this.owner.EndBattleMenu(false);
                 this.owner.AddAction(new BattleAction(AttackSelection.DEFEND,
                         this.owner, this.owner.battleID, -1, 0));
             }
         }
         else if(this.lastBMItem.type == BattleMenu.ESCAPE)
         {
             if(this.owner.IsBlockEscape() || !DataHolder.BattleSystem().canEscape)
             {
                 this.lastBMItem = null;
             }
             else
             {
                 this.owner.EndBattleMenu(false);
                 this.owner.AddAction(new BattleAction(AttackSelection.ESCAPE,
                         this.owner, this.owner.battleID, -1, 0));
             }
         }
         else if(this.lastBMItem.type == BattleMenu.ENDTURN)
         {
             this.owner.EndTurn();
         }
         else if(this.lastBMItem.type == BattleMenu.BACK)
         {
             this.lastBMItem = prevItem;
             GameHandler.GetLevelHandler().BattleMenuBack(true);
         }
     }
 }
Ejemplo n.º 5
0
 public void Init(BattleMenuItem bmi)
 {
     this.bmTitle = this.owner.GetName();
     this.blinkSet = -1;
     if(BattleMenuMode.BASE.Equals(this.mode))
     {
         this.bmPosition = DataHolder.BattleMenu().dialoguePosition;
         this.list = DataHolder.BattleMenu().BattleMenuList(this.owner);
     }
     else if(BattleMenuMode.SKILL.Equals(this.mode))
     {
         this.bmPosition = DataHolder.BattleMenu().skillPosition;
         this.list = DataHolder.BattleMenu().GetSkillMenuList(-1, this.owner);
     }
     else if(BattleMenuMode.ITEM.Equals(this.mode))
     {
         this.bmPosition = DataHolder.BattleMenu().itemPosition;
         this.list = DataHolder.BattleMenu().GetItemMenuList(-1, this.owner);
     }
     else if(BattleMenuMode.TARGET.Equals(this.mode))
     {
         this.bmPosition = DataHolder.BattleMenu().targetPosition;
         if(BattleMenu.SKILL == bmi.type &&
             DataHolder.Skill(bmi.id).targetRaycast.NeedInteraction())
         {
             this.rayTarget = true;
             this.rayAction = new BattleAction(AttackSelection.SKILL, this.owner,
                         BattleAction.NONE, bmi.id, bmi.useLevel);
             this.rayAction.targetRaycast = DataHolder.Skill(bmi.id).targetRaycast;
             this.list = new BattleMenuItem[0];
             this.hide = true;
         }
         else if(BattleMenu.ITEM == bmi.type &&
             DataHolder.Item(bmi.id).targetRaycast.NeedInteraction())
         {
             this.rayTarget = true;
             this.rayAction = new BattleAction(AttackSelection.ITEM, this.owner,
                         BattleAction.NONE, bmi.id, bmi.useLevel);
             this.rayAction.targetRaycast = DataHolder.Item(bmi.id).targetRaycast;
             this.list = new BattleMenuItem[0];
             this.hide = true;
         }
         else this.list = DataHolder.BattleMenu().GetTargetMenuList(bmi, this.owner);
     }
     this.UpdateChoices(true);
 }
Ejemplo n.º 6
0
    public BattleMenuItem[] GetTargetMenuList(BattleMenuItem bmi, Character character)
    {
        BattleMenuItem[] list = new BattleMenuItem[0];

        if(this.addBack && this.backFirst)
        {
            list = ArrayHelper.Add(this.GetBackItem(), list);
        }

        if(bmi.type == BattleMenu.ATTACK)
        {
            for(int i=0; i<DataHolder.BattleSystem().enemies.Length; i++)
            {
                Enemy e = DataHolder.BattleSystem().enemies[i];
                list = ArrayHelper.Add(new BattleMenuItem(e.GetContent(), -1, BattleMenu.ATTACK, true, "",
                        new BattleAction(AttackSelection.ATTACK, character, e.battleID, -1, bmi.useLevel)), list);
            }
        }
        else if(bmi.type == BattleMenu.SKILL)
        {
            Skill s = DataHolder.Skill(bmi.id);
            if(s.TargetSingleAlly())
            {
                Character[] party = GameHandler.Party().GetBattleParty();
                for(int i=0; i<party.Length; i++)
                {
                    list = ArrayHelper.Add(new BattleMenuItem(party[i].GetContent(),
                            -1, BattleMenu.SKILL, true, "", new BattleAction(AttackSelection.SKILL, character,
                            party[i].battleID, bmi.id, bmi.useLevel)), list);
                }
            }
            else if(s.TargetSingleEnemy())
            {
                for(int i=0; i<DataHolder.BattleSystem().enemies.Length; i++)
                {
                    Enemy e = DataHolder.BattleSystem().enemies[i];
                    list = ArrayHelper.Add(new BattleMenuItem(e.GetContent(),
                            -1, BattleMenu.SKILL, true, "", new BattleAction(AttackSelection.SKILL, character,
                            e.battleID, bmi.id, bmi.useLevel)), list);
                }
            }
            else if(s.TargetAllyGroup())
            {
                list = ArrayHelper.Add(new BattleMenuItem(new GUIContent(DataHolder.BattleSystemData().GetAllAlliesText()),
                        -1, BattleMenu.SKILL, true, "", new BattleAction(AttackSelection.SKILL, character,
                        BattleAction.ALL_CHARACTERS, bmi.id, bmi.useLevel)), list);
            }
            else if(s.TargetEnemyGroup())
            {
                list = ArrayHelper.Add(new BattleMenuItem(new GUIContent(DataHolder.BattleSystemData().GetAllEnemiesText()),
                        -1, BattleMenu.SKILL, true, "", new BattleAction(AttackSelection.SKILL, character,
                        BattleAction.ALL_ENEMIES, bmi.id, bmi.useLevel)), list);
            }
        }
        else if(bmi.type == BattleMenu.ITEM)
        {
            Item it = DataHolder.Item(bmi.id);
            if(it.TargetSingleAlly())
            {
                Character[] party = GameHandler.Party().GetBattleParty();
                for(int i=0; i<party.Length; i++)
                {
                    list = ArrayHelper.Add(new BattleMenuItem(party[i].GetContent(),
                            -1, BattleMenu.ITEM, true, "", new BattleAction(AttackSelection.ITEM, character,
                            party[i].battleID, bmi.id, bmi.useLevel)), list);
                }
            }
            else if(it.TargetSingleEnemy())
            {
                for(int i=0; i<DataHolder.BattleSystem().enemies.Length; i++)
                {
                    Enemy e = DataHolder.BattleSystem().enemies[i];
                    list = ArrayHelper.Add(new BattleMenuItem(e.GetContent(),
                            -1, BattleMenu.ITEM, true, "", new BattleAction(AttackSelection.ITEM, character,
                            e.battleID, bmi.id, bmi.useLevel)), list);
                }
            }
            else if(it.TargetAllyGroup())
            {
                list = ArrayHelper.Add(new BattleMenuItem(new GUIContent("All allies"), -1, BattleMenu.ITEM, true, "",
                        new BattleAction(AttackSelection.ITEM, character,
                        BattleAction.ALL_CHARACTERS, bmi.id, bmi.useLevel)), list);
            }
            else if(it.TargetEnemyGroup())
            {
                list = ArrayHelper.Add(new BattleMenuItem(new GUIContent("All enemies"), -1, BattleMenu.ITEM, true, "",
                        new BattleAction(AttackSelection.ITEM, character,
                        BattleAction.ALL_ENEMIES, bmi.id, bmi.useLevel)), list);
            }
        }
        if(this.addBack && !this.backFirst)
        {
            list = ArrayHelper.Add(this.GetBackItem(), list);
        }
        return list;
    }
Ejemplo n.º 7
0
    public BattleMenuItem[] GetSkillMenuList(int type, Character character)
    {
        BattleMenuItem[] list = new BattleMenuItem[0];
        if(this.addBack && this.backFirst)
        {
            list = ArrayHelper.Add(this.GetBackItem(), list);
        }

        ArrayList skills = new ArrayList();
        SkillLearn[] s = character.GetSkills();
        for(int i=0; i<s.Length; i++)
        {
            if(DataHolder.Skill(s[i].skillID).useInBattle &&
                (this.combineSkills || DataHolder.Skill(s[i].skillID).skilltype == type))
            {
                skills.Add(s[i].skillID);
            }
        }
        skills.Sort(new SkillNameSorter());
        for(int i=0; i<skills.Count; i++)
        {
            SkillLearn sk = character.GetSkill((int)skills[i]);
            if(sk != null)
            {
                if(DataHolder.Skill(sk.skillID).TargetSelf())
                {
                    list = ArrayHelper.Add(new BattleMenuItem(sk.GetContent(), sk.skillID, sk.GetLevel(), BattleMenu.SKILL, true,
                            DataHolder.Skill(sk.skillID).GetSkillCostString(character, sk.GetLevel()),
                            new BattleAction(AttackSelection.SKILL, character,
                            character.battleID, sk.skillID, sk.GetLevel())), list);
                }
                else if(DataHolder.Skill(sk.skillID).TargetNone())
                {
                    list = ArrayHelper.Add(new BattleMenuItem(sk.GetContent(), sk.skillID, sk.GetLevel(), BattleMenu.SKILL, true,
                            DataHolder.Skill(sk.skillID).GetSkillCostString(character, sk.GetLevel()),
                            new BattleAction(AttackSelection.SKILL, character,
                            BattleAction.NONE, sk.skillID, sk.GetLevel())), list);
                    list[list.Length-1].action.targetRaycast = DataHolder.Skill(sk.skillID).targetRaycast;
                }
                else if(DataHolder.Skill(sk.skillID).TargetSingleEnemy() &&
                    DataHolder.BattleControl().IsAutoUseOnTarget() &&
                    DataHolder.Skill(sk.skillID).InRange(character, DataHolder.BattleControl().partyTarget, sk.GetLevel()))
                {
                    list = ArrayHelper.Add(new BattleMenuItem(sk.GetContent(), sk.skillID, sk.GetLevel(), BattleMenu.SKILL, true,
                            DataHolder.Skill(sk.skillID).GetSkillCostString(character, sk.GetLevel()),
                            new BattleAction(AttackSelection.SKILL, character,
                            BattleAction.PARTY_TARGET, sk.skillID, sk.GetLevel())), list);
                }
                else
                {
                    list = ArrayHelper.Add(new BattleMenuItem(sk.GetContent(), sk.skillID, sk.GetLevel(), BattleMenu.SKILL, true,
                            DataHolder.Skill(sk.skillID).GetSkillCostString(character, sk.GetLevel()), null), list);
                }
            }
        }
        if(this.addBack && !this.backFirst)
        {
            list = ArrayHelper.Add(this.GetBackItem(), list);
        }
        return list;
    }
Ejemplo n.º 8
0
 public static BattleMenuItem[] Add(BattleMenuItem n, BattleMenuItem[] list)
 {
     ArrayList tmp = new ArrayList();
     foreach(BattleMenuItem str in list) tmp.Add(str);
     tmp.Add(n);
     return tmp.ToArray(typeof(BattleMenuItem)) as BattleMenuItem[];
 }
Ejemplo n.º 9
0
    public BattleMenuItem[] BattleMenuList(Character character)
    {
        BattleMenuItem[] list = new BattleMenuItem[0];
        this.LoadIcons();

        if(this.addBack && this.backFirst && DataHolder.BattleSystem().IsRealTime())
        {
            list = ArrayHelper.Add(this.GetBackItem(), list);
        }

        for(int i=0; i<this.order.Length; i++)
        {
            if(this.order[i] == BattleMenu.ATTACK && this.showAttack)
            {
                if(DataHolder.BattleControl().IsAutoUseOnTarget() &&
                    character.InAttackRange(DataHolder.BattleControl().partyTarget))
                {
                    list = ArrayHelper.Add(new BattleMenuItem(
                            new GUIContent(this.attackName[GameHandler.GetLanguage()].ToString(), this.attackIcon),
                            -1, BattleMenu.ATTACK, true, "",
                            new BattleAction(AttackSelection.ATTACK, character, BattleAction.PARTY_TARGET, -1, 0)), list);
                }
                else
                {
                    list = ArrayHelper.Add(new BattleMenuItem(
                            new GUIContent(this.attackName[GameHandler.GetLanguage()].ToString(), this.attackIcon),
                            -1, BattleMenu.ATTACK, true, ""), list);
                }
            }
            else if(this.order[i] == BattleMenu.SKILL && this.showSkills)
            {
                SkillLearn[] skills = character.GetSkills();
                if(this.combineSkills)
                {
                    if(skills.Length > 0)
                    {
                        list = ArrayHelper.Add(new BattleMenuItem(
                            new GUIContent(this.skillName[GameHandler.GetLanguage()].ToString(), this.skillIcon),
                            -1, BattleMenu.SKILL, false, ""), list);
                    }
                }
                else
                {
                    ArrayList types = new ArrayList();
                    for(int j=0; j<skills.Length; j++)
                    {
                        if(DataHolder.Skill(skills[j].skillID).useInBattle)
                        {
                            int st = DataHolder.Skill(skills[j].skillID).skilltype;
                            if(!types.Contains(st))
                            {
                                types.Add(st);
                            }
                        }
                    }
                    types.Sort(new SkillTypeSorter());
                    for(int j=0; j<types.Count; j++)
                    {
                        list = ArrayHelper.Add(new BattleMenuItem(DataHolder.SkillTypes().GetContent(
                                (int)types[j]), (int)types[j], BattleMenu.SKILL, false, ""), list);
                    }
                }
            }
            else if(this.order[i] == BattleMenu.ITEM && this.showItems)
            {
                if(this.combineItems)
                {
                    list = ArrayHelper.Add(new BattleMenuItem(
                        new GUIContent(this.itemName[GameHandler.GetLanguage()].ToString(), this.itemIcon),
                        -1, BattleMenu.ITEM, false, ""), list);
                }
                else
                {
                    ArrayList types = new ArrayList();
                    foreach(int key in GameHandler.Items().Keys)
                    {
                        if(DataHolder.Item(key).useInBattle)
                        {
                            int it = DataHolder.Item(key).itemType;
                            if(!types.Contains(it))
                            {
                                types.Add(it);
                            }
                        }
                    }
                    types.Sort(new ItemTypeSorter());
                    for(int j=0; j<types.Count; j++)
                    {
                        list = ArrayHelper.Add(new BattleMenuItem(DataHolder.ItemTypes().GetContent(
                                (int)types[j]), (int)types[j], BattleMenu.ITEM, false, ""), list);
                    }
                }
            }
            else if(this.order[i] == BattleMenu.DEFEND && this.showDefend)
            {
                list = ArrayHelper.Add(new BattleMenuItem(
                    new GUIContent(this.defendName[GameHandler.GetLanguage()].ToString(), this.defendIcon),
                    -1, BattleMenu.DEFEND, false, ""), list);
            }
            else if(this.order[i] == BattleMenu.ESCAPE && this.showEscape)
            {
                list = ArrayHelper.Add(new BattleMenuItem(
                    new GUIContent(this.escapeName[GameHandler.GetLanguage()].ToString(), this.escapeIcon),
                    -1, BattleMenu.ESCAPE, false, ""), list);
            }
            else if(this.order[i] == BattleMenu.ENDTURN && this.showEndTurn)
            {
                list = ArrayHelper.Add(new BattleMenuItem(
                    new GUIContent(this.endTurnName[GameHandler.GetLanguage()].ToString(), this.endTurnIcon),
                    -1, BattleMenu.ENDTURN, false, ""), list);
            }
        }

        if(this.addBack && !this.backFirst && DataHolder.BattleSystem().IsRealTime())
        {
            list = ArrayHelper.Add(this.GetBackItem(), list);
        }

        return list;
    }
Ejemplo n.º 10
0
    void CharacterMenu()
    {
        cursorHover = true;
        CharacterCursor.SetActive(true);
        PrevMenu = CurrentMenu;
        CurrentMenu = BattleMenuItem.Player;
        ShowButtons(false);
        IList<Battler> characterList = allCharacters;
        // if choosing a healing special ability that can only target live party members
        if (PrevMenu == BattleMenuItem.Special || PrevMenu == BattleMenuItem.Item)
        {
            Action specialAttack = currentCharacter.BattleBehavior.SpecialAbilities[specialIndex];
            if (specialAttack.ActionTarget == ActionTarget.LivePartyMember)
            {
                characterList = allCharacters.Where(c => c.BattleBehavior.Status.StatusEffect != StatusEffect.Defeated).ToList();
            }
        }
        listSize = characterList.Count;
        if (charIndex >= listSize)
        {
            charIndex = listSize - 1;
        }
        MoveCursor(characterList[charIndex]);

        for (int i = 0; i < maxListSize; i++)
        {
            if (i >= listSize)
            {
                Text[i].text = "";
            }
            else
            {
                Text[i].text = characterList[i].BattleBehavior.Name;
            }
        }
    }
Ejemplo n.º 11
0
    void ItemsMenu()
    {
        IList<Item> inventory = currentCharacter.Inventory;
        PrevMenu = CurrentMenu;
        CurrentMenu = BattleMenuItem.Item;
        ShowButtons(false);

        if (inventory.Count > 0)
        {
            listSize = inventory.Count;
            for (int i = 0; i < maxListSize; i++)
            {
                if (i >= listSize)
                {
                    Text[i].text = "";
                }
                else
                {
                    Text[i].text = inventory[i].Name + " (" + inventory[i].Quantity + ")";
                }
            }
        }
        else
        {
            listSize = 1;
            Text[0].text = "No items";
            for (int i = 1; i < maxListSize; i++)
            {
                Text[i].text = "";
            }
        }
    }
Ejemplo n.º 12
0
    void EnemyMenu()
    {
        cursorHover = true;
        CharacterCursor.SetActive(true);
        PrevMenu = CurrentMenu;
        CurrentMenu = BattleMenuItem.Enemy;
        ShowButtons(false);
        MoveCursor(allEnemies[enemyIndex]);
        //If choosing an enemy to attack with a special attack
        switch (PrevMenu)
        {
            //Using a normal attack
            case BattleMenuItem.Main:
                listSize = allEnemies.Count;
                for (int i = 0; i < maxListSize; i++)
                {
                    if (i >= listSize)
                    {
                        Text[i].text = "";
                    }
                    else
                    {
                        Text[i].text = allEnemies[i].BattleBehavior.Name;
                    }
                }
                break;

            //Using a special attack
            case BattleMenuItem.Special:
                Action specialAttack = currentCharacter.BattleBehavior.SpecialAbilities[specialIndex];
                //Individual enemy
                if (specialAttack.ActionTarget == ActionTarget.Enemy)
                {
                    listSize = allEnemies.Count;
                    for (int i = 0; i < maxListSize; i++)
                    {
                        if (i >= listSize)
                        {
                            Text[i].text = "";
                        }
                        else
                        {
                            Text[i].text = allEnemies[i].BattleBehavior.Name;
                        }
                    }
                }
                //All enemies
                else if (specialAttack.ActionTarget == ActionTarget.AllEnemies)
                {
                    listSize = 1;
                    Text[0].text = "All";
                    for (int i = 1; i < maxListSize; i++)
                    {
                        Text[i].text = "";
                    }
                }
                break;
        }
    }
Ejemplo n.º 13
0
    void SpecialMenu()
    {
        IList<Action> specialAbilities = currentCharacter.BattleBehavior.SpecialAbilities;
        PrevMenu = CurrentMenu;
        CurrentMenu = BattleMenuItem.Special;
        ShowButtons(false);

        listSize = specialAbilities.Count;
        for (int i = 0; i < maxListSize; i++)
        {
            if (i >= listSize)
            {
                Text[i].text = "";
            }
            else
            {
                Text[i].text = specialAbilities[i].Name + " (" + specialAbilities[i].RequiredSP + ")";
            }
        }
    }
Ejemplo n.º 14
0
    void MainMenu()
    {
        PrevMenu = CurrentMenu;
        CurrentMenu = BattleMenuItem.Main;
        ShowButtons(true);
        switch (PrevMenu)
        {
            case BattleMenuItem.Enemy:
                //mainIndex = 0;
                break;

            case BattleMenuItem.Special:
                //index = 1;
                break;

            case BattleMenuItem.Item:
                //index = 2;
                break;
        }
        listSize = 4;
        Text[0].text = "Attack";
        Text[1].text = "Special";
        Text[2].text = "Item";
        Text[3].text = "Defend";
    }
Ejemplo n.º 15
0
 /*
 ============================================================================
 Battle menu functions
 ============================================================================
 */
 public void ShowBattleMenu(BattleMenuMode mode, BattleMenuItem bmi)
 {
     if(DataHolder.BattleSystem().IsRealTime())
     {
         if(DataHolder.BattleSystem().blockControlMenu) GameHandler.SetBlockControl(1);
         if(DataHolder.BattleSystem().freezeAction) GameHandler.FreezeTime(true);
     }
     this.battleMenu.SetOwner(this);
     this.battleMenu.CallMenu(mode, bmi);
     this.isChoosingAction = true;
     GameHandler.GetLevelHandler().AddBattleMenuUser(this);
 }
Ejemplo n.º 16
0
    public BattleMenuItem[] GetItemMenuList(int type, Character character)
    {
        BattleMenuItem[] list = new BattleMenuItem[0];
        if(this.addBack && this.backFirst)
        {
            list = ArrayHelper.Add(this.GetBackItem(), list);
        }

        ArrayList items = new ArrayList();
        foreach(int key in GameHandler.Items().Keys)
        {
            if(DataHolder.Item(key).useInBattle &&
                    (this.combineItems || DataHolder.Item(key).itemType == type))
            {
                items.Add(key);
            }
        }
        items.Sort(new ItemNameSorter());
        for(int i=0; i<items.Count; i++)
        {
            int itemID = (int)items[i];
            if(DataHolder.Item(itemID).TargetSelf())
            {
                list = ArrayHelper.Add(new BattleMenuItem(DataHolder.Items().GetContent(itemID), itemID, 0,
                        BattleMenu.ITEM, true, GameHandler.GetItemCount(itemID).ToString(),
                        new BattleAction(AttackSelection.ITEM, character, character.battleID, itemID, 0)), list);
            }
            else if(DataHolder.Item(itemID).TargetNone())
            {
                list = ArrayHelper.Add(new BattleMenuItem(DataHolder.Items().GetContent(itemID), itemID, 0,
                        BattleMenu.ITEM, true, GameHandler.GetItemCount(itemID).ToString(),
                        new BattleAction(AttackSelection.ITEM, character, BattleAction.NONE, itemID, 0)), list);
                list[list.Length-1].action.targetRaycast = DataHolder.Item(itemID).targetRaycast;
            }
            else if(DataHolder.Item(itemID).TargetSingleEnemy() &&
                DataHolder.BattleControl().IsAutoUseOnTarget() &&
                DataHolder.Item(itemID).useRange.InRange(character, DataHolder.BattleControl().partyTarget))
            {
                list = ArrayHelper.Add(new BattleMenuItem(DataHolder.Items().GetContent(itemID), itemID, 0,
                        BattleMenu.ITEM, true, GameHandler.GetItemCount(itemID).ToString(),
                        new BattleAction(AttackSelection.ITEM, character, BattleAction.PARTY_TARGET, itemID, 0)), list);
            }
            else
            {
                list = ArrayHelper.Add(new BattleMenuItem(DataHolder.Items().GetContent(itemID), itemID,
                        BattleMenu.ITEM, true, GameHandler.GetItemCount(itemID).ToString()), list);
            }

        }
        if(this.addBack && !this.backFirst)
        {
            list = ArrayHelper.Add(this.GetBackItem(), list);
        }
        return list;
    }
Ejemplo n.º 17
0
 public void Clear()
 {
     this.mode = BattleMenuMode.BASE;
     this.list = new BattleMenuItem[0];
     this.choices = new ChoiceContent[0];
     this.blinkSet = -1;
     this.lastBMItem = null;
 }
Ejemplo n.º 18
0
 public static BattleMenuItem[] Remove(int index, BattleMenuItem[] list)
 {
     ArrayList tmp = new ArrayList();
     foreach(BattleMenuItem str in list) tmp.Add(str);
     tmp.RemoveAt(index);
     return tmp.ToArray(typeof(BattleMenuItem)) as BattleMenuItem[];
 }