Beispiel #1
0
        // Parameters are separated by comma in order of: Action Name, Action Option, Target Options, and Action Cost
        public void GetCommandInformation(string parameters, bool skipChooseTarget = false)
        {
            var splitParams = parameters.Split(',');

            var commandActionName          = splitParams[0];
            var commandActionOptionString  = splitParams[1];
            var commandTargetOptionsString = splitParams[2];
            var commandCostString          = splitParams[3];

            var commandActionOption  = int.Parse(commandActionOptionString);
            var commandTargetOptions = int.Parse(commandTargetOptionsString);
            var commandCost          = int.Parse(commandCostString);

            commandCost += character.Unit.conversionLevel;

            var notEnoughAP = character.CurrentAP - commandCost < 0;

            if (notEnoughAP)
            {
                var amountToBorrow = commandCost - character.CurrentAP;
                if (Unit.CanBorrow(amountToBorrow))
                {
                    character.Unit.borrowAP(amountToBorrow);
                }
                else
                {
                    return;
                }
            }

            if (skipChooseTarget)
            {
                character.Unit.commandActionName   = commandActionName;
                character.Unit.commandActionOption = commandActionOption;
                Battle.Engine.skipChooseTarget     = true;
            }
            else
            {
                ChooseTarget._targetOptions = commandTargetOptions;
                ChooseTarget.GetCurrentCommand(commandActionName, commandActionOption);
            }

            character.Unit.actionCost = commandCost;

            anim.SetTrigger(AnimationHandler.Panel);
            if (Battle.Engine.choosingAbility)
            {
                Battle.Engine.choosingAbility = false;
            }
            else if (Battle.Engine.choosingSpell)
            {
                Battle.Engine.choosingSpell = false;
            }
            else
            {
                Battle.Engine.choosingOption = false;
            }
        }
Beispiel #2
0
        protected virtual IEnumerator <float> SpecialAttackInterruption(PartyMember character)
        {
            nextTurnIsSpecialAttack = false;
            if (!character.GetStatus() || character.CurrentAP == 0)
            {
                BattleEvents.SkipTurnEvent.Raise(character, BattleEvents.SkipTurnEvent);
            }
            activeUnit = character;

            BattleInput._canPressBack      = false;
            character.Unit.specialAttackAP = character.Unit.currentAP;
            character.Unit.currentAbility  = character.specialAttack;

            ChooseTarget._targetOptions = 1;
            ChooseTarget.GetCurrentCommand("UniversalAction", 2);

            BattleEvents.ChooseTargetEvent.Raise(character, BattleEvents.ChooseTargetEvent);

            yield return(Timing.WaitUntilFalse(() => choosingTarget));

            character.CurrentAP -= character.Unit.currentAP;

            yield return(Timing.WaitUntilDone(character.InflictStatus
                                                  (Rate.BeforeEveryAction, 0.5f, true)));

            if (!canGiveCommand)
            {
                canGiveCommand = true;
            }
            else
            {
                var attacker = character.Unit.hasSummon ? (UnitBase)character.Unit.currentSummon : character;
                BattleEvents.CharacterAttackEvent.Raise(attacker, BattleEvents.CharacterAttackEvent);
                BattleEvents.CommandEvent.Raise(attacker, BattleEvents.CommandEvent);
            }

            yield return(Timing.WaitUntilFalse(() => performingAction));

            yield return(Timing.WaitUntilDone(character.InflictStatus
                                                  (Rate.AfterEveryAction, 0.5f, true)));

            endThisMembersTurn = false;
            BattleEvents.EndOfTurnEvent.Raise(character, BattleEvents.EndOfTurnEvent);
            character.inventoryDisplay.SetActive(false);
        }