Ejemplo n.º 1
0
 private void cancelAction()
 {
     if (inOuterMenu)
     {
         if (Actions.Count > 0)
         {
             ThinkAction lastAction = Actions[Actions.Count - 1];
             Actions.RemoveAt(Actions.Count - 1);
             CurrentPartyMember = lastAction.Actor;
             if (!ThinkMenuOption.IsDefaultOptionName(lastAction.OptionName))
             {
                 Inventory inventory = getInventoryFromThinkActionType(lastAction.Type, CurrentPartyMember);
                 if (inventory != null)
                 {
                     inventory.AddItem(lastAction.OptionName, CurrentPartyMember);
                 }
             }
             repopulateMenuOptions();
             Logger.Log("Back to action selection for party member " + (Actions.Count + 1).ToString());
         }
     }
     else
     {
         hideOpenMenu();
     }
 }
Ejemplo n.º 2
0
        private void pushStateForThinkAction(ThinkAction thinkAction)
        {
            if (thinkAction == null)
            {
                return;
            }

            if (!statusEffectsCompleteForAction && thinkAction.Actor.Alive)
            {
                PushState(new HandleStatusEffects(Battle, StatusEffectEvent.BeforeAct, thinkAction: thinkAction));
                return;
            }

            if (!thinkAction.Actor.Alive || !thinkAction.Active)
            {
                if (!ThinkMenuOption.IsDefaultOptionName(thinkAction.OptionName))
                {
                    Inventory inventory = getInventoryFromThinkActionType(thinkAction.Type, thinkAction.Actor);
                    if (inventory != null)
                    {
                        inventory.AddItem(thinkAction.OptionName, thinkAction.Actor);
                    }
                }
                getNextThinkAction();
                return;
            }

            if (thinkAction.Target.Alive)
            {
                if (thinkAction.Type == ThinkActionType.Attack)
                {
                    PushState(new Attack(Battle, thinkAction));
                }
                else
                {
                    PushState(new UseItem(Battle, thinkAction));
                }
            }
            else
            {
                if (Battle.PlayerParty.Count > 0 && Battle.EnemyParty.Count > 0)
                {
                    PushState(new SelectTarget(Battle, thinkAction));
                }
                else
                {
                    Finish();
                }
            }
        }