示例#1
0
    private string FindRevealedCardId(PowerTaskList taskList)
    {
        Network.HistActionStart sourceAction = taskList.GetSourceAction();
        List <PowerTask>        list         = taskList.GetTaskList();

        for (int i = 0; i < list.Count; i++)
        {
            PowerTask task = list[i];
            Network.HistShowEntity power = task.GetPower() as Network.HistShowEntity;
            if ((power != null) && (power.Entity.ID == sourceAction.Entity))
            {
                return(power.Entity.CardID);
            }
        }
        return(null);
    }
示例#2
0
    private void CancelSpellsForEarlyConcede(PowerTaskList taskList)
    {
        Entity sourceEntity = taskList.GetSourceEntity();

        if (sourceEntity != null)
        {
            Card card = sourceEntity.GetCard();
            if ((card != null) && (taskList.GetSourceAction().BlockType == HistoryBlock.Type.POWER))
            {
                Spell playSpell = card.GetPlaySpell(true);
                if (playSpell != null)
                {
                    SpellStateType activeState = playSpell.GetActiveState();
                    if ((activeState != SpellStateType.NONE) && (activeState != SpellStateType.CANCEL))
                    {
                        playSpell.ActivateState(SpellStateType.CANCEL);
                    }
                }
            }
        }
    }
示例#3
0
 private void NotifyWillProcessTaskList(PowerTaskList taskList)
 {
     if (ThinkEmoteManager.Get() != null)
     {
         ThinkEmoteManager.Get().NotifyOfActivity();
     }
     if (taskList.IsSourceActionOrigin())
     {
         Network.HistActionStart sourceAction = taskList.GetSourceAction();
         if (sourceAction.BlockType == HistoryBlock.Type.PLAY)
         {
             Entity entity = GameState.Get().GetEntity(sourceAction.Entity);
             if (entity.GetController().IsOpposingSide())
             {
                 string cardId = entity.GetCardId();
                 if (string.IsNullOrEmpty(cardId))
                 {
                     cardId = this.FindRevealedCardId(taskList);
                 }
                 GameState.Get().GetGameEntity().NotifyOfOpponentWillPlayCard(cardId);
             }
         }
     }
 }
示例#4
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);
    }