コード例 #1
0
        protected override void SequenceMainBranch()
        {
            switch (SequenceStep)
            {
            case 0:
                //Wait a bit
                CurSequenceAction = new WaitSeqAction(300d);
                break;

            case 1:
                //Deal damage
                InteractionResult[] interactions = AttemptDamage(BaseDamage, EntitiesAffected[0], Action.DamageProperties, false);

                //Switch only if the victim was hit, damage was greater than 0, and the victim didn't perform any defensive actions
                if (interactions[0] != null && interactions[0].WasVictimHit == true &&
                    interactions[0].VictimResult.TotalDamage > 0 &&
                    interactions[0].VictimResult.DefensiveActionsPerformed == Enumerations.DefensiveActionTypes.None)
                {
                    //Find a Partner to swap to
                    List <BattlePartner> allPartners = new List <BattlePartner>();
                    Inventory.Instance.partnerInventory.GetAllPartners(allPartners);

                    //Remove the current Partner from being selected
                    allPartners.Remove(User.BManager.Partner);

                    //Filter out all dead Partners
                    BattleManagerUtils.FilterDeadEntities(allPartners);

                    //If there's another Partner available, choose it
                    if (allPartners.Count != 0)
                    {
                        int randIndex = RandomGlobals.Randomizer.Next(0, allPartners.Count);

                        SwapPartnerBattleEvent swapPartnerBattleEvent = new SwapPartnerBattleEvent(User.BManager.Partner, allPartners[randIndex],
                                                                                                   300d, 300d);
                        User.BManager.battleEventManager.QueueBattleEvent((int)BattleGlobals.BattleEventPriorities.SwapPartner,
                                                                          new BattleGlobals.BattleState[] { BattleGlobals.BattleState.Turn },
                                                                          swapPartnerBattleEvent);
                    }
                }

                CurSequenceAction = new WaitSeqAction(0d);
                ChangeSequenceBranch(SequenceBranch.End);
                break;

            default:
                PrintInvalidSequence();
                break;
            }
        }
コード例 #2
0
        protected override void SequenceStartBranch()
        {
            switch (SequenceStep)
            {
            case 0:
                SwapPartnerBattleEvent swapPartnerBattleEvent = new SwapPartnerBattleEvent(User.BManager.Partner, NewPartner, 300d, 300d);

                User.BManager.battleEventManager.QueueBattleEvent((int)BattleGlobals.BattleEventPriorities.SwapPartner,
                                                                  new BattleGlobals.BattleState[] { BattleGlobals.BattleState.Turn },
                                                                  swapPartnerBattleEvent);

                CurSequenceAction = new WaitForBattleEventSeqAction(swapPartnerBattleEvent);
                ChangeSequenceBranch(SequenceBranch.End);
                break;

            default:
                PrintInvalidSequence();
                break;
            }
        }