Пример #1
0
 private static object Extract(PowerTaskList list)
 {
     if (list == null) return null;
     List<object> l = new List<object>();
     foreach (var item in list.GetTaskList())
     {
         l.Add(Extract(item));
     }
     return l.ToArray();
 }
Пример #2
0
 public void SetPrevious(PowerTaskList taskList)
 {
     this.m_previous = taskList;
     taskList.m_next = this;
 }
Пример #3
0
 public bool IsInBlock(PowerTaskList taskList)
 {
     return((this == taskList) || (this.IsEarlierInBlockThan(taskList) || this.IsLaterInBlockThan(taskList)));
 }
Пример #4
0
    private void PrepareHistoryForCurrentTaskList()
    {
        object[] args = new object[] { this.m_currentTaskList.GetId() };
        Log.Power.Print("PowerProcessor.PrepareHistoryForCurrentTaskList() - m_currentTaskList={0}", args);
        Network.HistActionStart sourceAction = this.m_currentTaskList.GetSourceAction();
        if (sourceAction != null)
        {
            if (sourceAction.BlockType != HistoryBlock.Type.ATTACK)
            {
                if (sourceAction.BlockType == HistoryBlock.Type.PLAY)
                {
                    Entity playedEntity = GameState.Get().GetEntity(sourceAction.Entity);
                    if (playedEntity != null)
                    {
                        if (this.m_currentTaskList.IsSourceActionOrigin())
                        {
                            Entity targetedEntity = GameState.Get().GetEntity(sourceAction.Target);
                            HistoryManager.Get().CreateCardPlayedTile(playedEntity, targetedEntity);
                            this.m_currentTaskList.SetSpawnedHistoryTile(true);
                            if (playedEntity.IsControlledByFriendlySidePlayer())
                            {
                                GameState.Get().GetGameEntity().NotifyOfFriendlyPlayedCard(playedEntity);
                            }
                            if (this.ShouldShowPlayedBigCard(playedEntity))
                            {
                                if (playedEntity.IsControlledByOpposingSidePlayer())
                                {
                                    GameState.Get().GetGameEntity().NotifyOfOpponentPlayedCard(playedEntity);
                                }
                                bool wasCountered = this.m_currentTaskList.WasThePlayedSpellCountered(playedEntity);
                                this.m_historyBlocking         = true;
                                this.m_historyBlockingTaskList = this.m_currentTaskList;
                                HistoryManager.Get().CreatePlayedBigCard(playedEntity, new HistoryManager.FinishedCallback(this.OnBigCardFinished), wasCountered);
                            }
                        }
                        this.m_currentTaskList.NotifyHistoryOfAdditionalTargets();
                    }
                }
                else if (sourceAction.BlockType == HistoryBlock.Type.POWER)
                {
                    this.m_currentTaskList.NotifyHistoryOfAdditionalTargets();
                }
                else if (sourceAction.BlockType == HistoryBlock.Type.JOUST)
                {
                    this.m_currentTaskList.NotifyHistoryOfAdditionalTargets();
                }
                else if (sourceAction.BlockType == HistoryBlock.Type.TRIGGER)
                {
                    Entity triggeredEntity = GameState.Get().GetEntity(sourceAction.Entity);
                    if (triggeredEntity != null)
                    {
                        if (triggeredEntity.IsSecret())
                        {
                            if (this.m_currentTaskList.IsSourceActionOrigin())
                            {
                                HistoryManager.Get().CreateTriggerTile(triggeredEntity);
                                this.m_currentTaskList.SetSpawnedHistoryTile(true);
                                this.m_historyBlocking         = true;
                                this.m_historyBlockingTaskList = this.m_currentTaskList;
                                HistoryManager.Get().CreateSecretBigCard(triggeredEntity, new HistoryManager.FinishedCallback(this.OnBigCardFinished));
                            }
                            this.m_currentTaskList.NotifyHistoryOfAdditionalTargets();
                        }
                        else
                        {
                            if (this.m_currentTaskList.IsSourceActionOrigin())
                            {
                                PowerHistoryInfo powerHistoryInfo = triggeredEntity.GetPowerHistoryInfo(sourceAction.Index);
                                if ((powerHistoryInfo != null) && powerHistoryInfo.ShouldShowInHistory())
                                {
                                    if (triggeredEntity.HasTag(GAME_TAG.HISTORY_PROXY))
                                    {
                                        Entity entity6 = GameState.Get().GetEntity(triggeredEntity.GetTag(GAME_TAG.HISTORY_PROXY));
                                        HistoryManager.Get().CreateCardPlayedTile(entity6, null);
                                        if ((triggeredEntity.GetController() != GameState.Get().GetFriendlySidePlayer()) || !triggeredEntity.HasTag(GAME_TAG.HISTORY_PROXY_NO_BIG_CARD))
                                        {
                                            this.m_historyBlocking         = true;
                                            this.m_historyBlockingTaskList = this.m_currentTaskList;
                                            HistoryManager.Get().CreateTriggeredBigCard(entity6, new HistoryManager.FinishedCallback(this.OnBigCardFinished));
                                        }
                                    }
                                    else
                                    {
                                        if (this.ShouldShowTriggeredBigCard(triggeredEntity))
                                        {
                                            this.m_historyBlocking         = true;
                                            this.m_historyBlockingTaskList = this.m_currentTaskList;
                                            HistoryManager.Get().CreateTriggeredBigCard(triggeredEntity, new HistoryManager.FinishedCallback(this.OnBigCardFinished));
                                        }
                                        HistoryManager.Get().CreateTriggerTile(triggeredEntity);
                                    }
                                    this.m_currentTaskList.SetSpawnedHistoryTile(true);
                                }
                            }
                            if (this.m_currentTaskList.DidBlockSpawnHistoryTile())
                            {
                                this.m_currentTaskList.NotifyHistoryOfAdditionalTargets();
                            }
                        }
                    }
                }
                else if (sourceAction.BlockType == HistoryBlock.Type.FATIGUE)
                {
                    if (this.m_currentTaskList.IsSourceActionOrigin())
                    {
                        HistoryManager.Get().CreateFatigueTile();
                        this.m_currentTaskList.SetSpawnedHistoryTile(true);
                    }
                    this.m_currentTaskList.NotifyHistoryOfAdditionalTargets();
                }
            }
            else
            {
                AttackType attackType = this.m_currentTaskList.GetAttackType();
                Entity     attacker   = null;
                Entity     defender   = null;
                switch (attackType)
                {
                case AttackType.REGULAR:
                    attacker = this.m_currentTaskList.GetAttacker();
                    defender = this.m_currentTaskList.GetDefender();
                    break;

                case AttackType.CANCELED:
                    attacker = this.m_currentTaskList.GetAttacker();
                    defender = this.m_currentTaskList.GetProposedDefender();
                    break;
                }
                if ((attacker != null) && (defender != null))
                {
                    HistoryManager.Get().CreateAttackTile(attacker, defender, this.m_currentTaskList);
                    this.m_currentTaskList.SetSpawnedHistoryTile(true);
                    this.m_currentTaskList.NotifyHistoryOfAdditionalTargets();
                }
            }
        }
    }
Пример #5
0
 public void SetParent(PowerTaskList parent)
 {
     this.m_parent = parent;
 }
Пример #6
0
 private TriggerSpellController CreateTriggerSpellController(PowerTaskList taskList)
 {
     return(this.CreateSpellController <TriggerSpellController>(taskList, null));
 }
Пример #7
0
    private bool DoTaskListWithSpellController(GameState state, PowerTaskList taskList, Entity sourceEntity)
    {
        Network.HistActionStart sourceAction = taskList.GetSourceAction();
        switch (sourceAction.BlockType)
        {
        case HistoryBlock.Type.ATTACK:
        {
            AttackSpellController spellController = this.CreateAttackSpellController(taskList);
            if (!this.DoTaskListUsingController(spellController, taskList, new SpellController.FinishedCallback(this.OnSpellControllerFinished)))
            {
                this.DestroySpellController(spellController);
                return(false);
            }
            return(true);
        }

        case HistoryBlock.Type.POWER:
        {
            PowerSpellController controller2 = this.CreatePowerSpellController(taskList);
            if (!this.DoTaskListUsingController(controller2, taskList, new SpellController.FinishedCallback(this.OnSpellControllerFinished)))
            {
                this.DestroySpellController(controller2);
                return(false);
            }
            return(true);
        }

        case HistoryBlock.Type.TRIGGER:
            if (sourceEntity.IsSecret())
            {
                SecretSpellController controller3 = this.CreateSecretSpellController(taskList);
                if (!this.DoTaskListUsingController(controller3, taskList, new SpellController.FinishedCallback(this.OnSpellControllerFinished)))
                {
                    this.DestroySpellController(controller3);
                    return(false);
                }
            }
            else
            {
                TriggerSpellController controller4 = this.CreateTriggerSpellController(taskList);
                Card card = sourceEntity.GetCard();
                if (TurnStartManager.Get().IsCardDrawHandled(card))
                {
                    if (!controller4.AttachPowerTaskList(taskList))
                    {
                        this.DestroySpellController(controller4);
                        return(false);
                    }
                    controller4.AddFinishedTaskListCallback(new SpellController.FinishedTaskListCallback(this.OnSpellControllerFinishedTaskList));
                    controller4.AddFinishedCallback(new SpellController.FinishedCallback(this.OnSpellControllerFinished));
                    TurnStartManager.Get().NotifyOfSpellController(controller4);
                }
                else if (!this.DoTaskListUsingController(controller4, taskList, new SpellController.FinishedCallback(this.OnSpellControllerFinished)))
                {
                    this.DestroySpellController(controller4);
                    return(false);
                }
            }
            return(true);

        case HistoryBlock.Type.DEATHS:
        {
            DeathSpellController controller5 = this.CreateDeathSpellController(taskList);
            if (!this.DoTaskListUsingController(controller5, taskList, new SpellController.FinishedCallback(this.OnSpellControllerFinished)))
            {
                this.DestroySpellController(controller5);
                return(false);
            }
            return(true);
        }

        case HistoryBlock.Type.FATIGUE:
        {
            FatigueSpellController controller6 = this.CreateFatigueSpellController(taskList);
            if (!controller6.AttachPowerTaskList(taskList))
            {
                this.DestroySpellController(controller6);
                return(false);
            }
            controller6.AddFinishedTaskListCallback(new SpellController.FinishedTaskListCallback(this.OnSpellControllerFinishedTaskList));
            controller6.AddFinishedCallback(new SpellController.FinishedCallback(this.OnSpellControllerFinished));
            if (state.IsTurnStartManagerActive())
            {
                TurnStartManager.Get().NotifyOfSpellController(controller6);
            }
            else
            {
                controller6.DoPowerTaskList();
            }
            return(true);
        }

        case HistoryBlock.Type.JOUST:
        {
            JoustSpellController controller7 = this.CreateJoustSpellController(taskList);
            if (!this.DoTaskListUsingController(controller7, taskList, new SpellController.FinishedCallback(this.OnSpellControllerFinished)))
            {
                this.DestroySpellController(controller7);
                return(false);
            }
            return(true);
        }
        }
        object[] args = new object[] { sourceAction.BlockType, sourceEntity };
        Log.Power.Print("PowerProcessor.DoTaskListForCard() - actionStart has unhandled BlockType {0} for sourceEntity {1}", args);
        return(false);
    }
Пример #8
0
 private SecretSpellController CreateSecretSpellController(PowerTaskList taskList)
 {
     return(this.CreateSpellController <SecretSpellController>(taskList, "SecretSpellController"));
 }
Пример #9
0
 private JoustSpellController CreateJoustSpellController(PowerTaskList taskList)
 {
     return(this.CreateSpellController <JoustSpellController>(taskList, "JoustSpellController"));
 }
Пример #10
0
 private FatigueSpellController CreateFatigueSpellController(PowerTaskList taskList)
 {
     return(this.CreateSpellController <FatigueSpellController>(taskList, null));
 }
Пример #11
0
 private AttackSpellController CreateAttackSpellController(PowerTaskList taskList)
 {
     return(this.CreateSpellController <AttackSpellController>(taskList, "AttackSpellController"));
 }
Пример #12
0
 public void Clear()
 {
     this.m_powerQueue.Clear();
     this.m_currentTaskList = null;
 }