Esempio n. 1
0
        public override void Execute(INotification notification)
        {
            GameContainerProxy gameContainerProxy =
                Facade.RetrieveProxy(GameContainerProxy.NAME) as GameContainerProxy;
            PlayerGroupProxy playerGroupProxy =
                Facade.RetrieveProxy(PlayerGroupProxy.NAME) as PlayerGroupProxy;

            switch (notification.Type)
            {
            //根据效果渲染高亮
            case MinionSystemEvent.MINION_SYS_EFFECT_HIGHLIGHT:
                TargetSet targetSetToChoose = notification.Body as TargetSet;
                //通知生物层发生变更重新渲染部分生物
                SendNotification(MinionSystemEvent.MINION_VIEW, GetMinionListByTargetSet(targetSetToChoose, gameContainerProxy), MinionSystemEvent.MINION_VIEW_MINIONS_CHANGE);
                break;

            //根据效果渲染高亮-预定成为目标选择项
            case MinionSystemEvent.MINION_SYS_EFFECT_HIGHLIGHT_BECOME_TARGET:
                TargetSet        targetSetToChooseTarget = notification.Body as TargetSet;
                List <CardEntry> mList = GetMinionListByTargetSet(targetSetToChooseTarget, gameContainerProxy);

                //通知生物层发生变更重新渲染部分生物
                SendNotification(MinionSystemEvent.MINION_VIEW, mList, MinionSystemEvent.MINION_VIEW_MINIONS_CHANGE_TO_CHOOSE_TARGET);
                break;

            case MinionSystemEvent.MINION_SYS_EFFECT_HIGHLIGHT_CLOSE:
                List <CardEntry>         mListClose = new List <CardEntry>();
                List <GameContainerItem> returnGameContainerItemList = gameContainerProxy.GetGameContainerItemGameContainerType("CardBattlefield");
                foreach (GameContainerItem gameContainerItem in returnGameContainerItemList)
                {
                    foreach (CardEntry minionCellItem in gameContainerItem.cardEntryList)
                    {
                        if (minionCellItem.IsEffectTarget == true)
                        {
                            minionCellItem.IsEffectTarget = false;
                        }
                        mListClose.Add(minionCellItem);
                    }
                }
                //通知生物层发生变更重新渲染部分生物
                SendNotification(MinionSystemEvent.MINION_VIEW, mListClose, MinionSystemEvent.MINION_VIEW_MINIONS_CHANGE);
                break;

            //生物死亡
            case MinionSystemEvent.MINION_SYS_ONE_MINION_IS_DEAD:
                CardEntry minionCellItemIsDead = notification.Body as CardEntry;
                //放入墓地
                minionCellItemIsDead.nextGameContainerType = "CardGraveyard";
                minionCellItemIsDead.ttNeedChangeGameContainerType(minionCellItemIsDead);
                break;
            }
        }
Esempio n. 2
0
        public List <CardEntry> GetMinionListByTargetSet(TargetSet targetSetToChoose, GameContainerProxy gameContainerProxy)
        {
            List <CardEntry>         mList = new List <CardEntry>();
            List <GameContainerItem> returnGameContainerItemList = gameContainerProxy.GetGameContainerItemGameContainerType("CardBattlefield");

            foreach (GameContainerItem gameContainerItem in returnGameContainerItemList)
            {
                foreach (CardEntry minionCellItem in gameContainerItem.cardEntryList)
                {
                    if (targetSetToChoose.checkEffectToTargetMinionCellItem(minionCellItem))
                    {
                        UtilityLog.Log(" 检查了生物:" + minionCellItem.cardInfo.code, LogUtType.Special);
                        minionCellItem.IsEffectTarget = true;
                        mList.Add(minionCellItem);
                    }
                }
            }
            return(mList);
        }
Esempio n. 3
0
        public bool FindTargetOrObejct(EffectInfo effectInfo, TargetSet targetSet,
                                       EffectInfoProxy effectInfoProxy,
                                       PlayerGroupProxy playerGroupProxy,
                                       QuestStageCircuitProxy questStageCircuitProxy,
                                       GameContainerProxy gameContainerProxy)
        {
            bool designationTargetOver = false;

            effectInfo.needPlayerToChooseTargetSet = targetSet;
            //先判断是否已经指定了目标
            switch (targetSet.target)
            {
            case "Minion":
                if (targetSet.targetMinionCellItems.Count == targetSet.targetClaimsNums)
                {
                    designationTargetOver = true;
                }
                break;
            }
            if (designationTargetOver)
            {
                targetSet.hasTarget = true;
                return(true);
            }
            //条件
            TargetClaim[] targetClaims = targetSet.targetClaims;

            //目标玩家
            PlayerItem targetPlayer = null;

            //类型
            switch (targetSet.target)
            {
            case "Card":
                List <CardEntry> cardEntries       = new List <CardEntry>();
                string           gameContainerType = targetSet.targetSource;
                PlayerItem       gameContainerControllerPlayerItem = null;
                for (int n = 0; n < targetClaims.Length; n++)
                {
                    //判断所有权
                    if (targetClaims[n].claim == "Owner")
                    {
                        //是自己选
                        if (targetClaims[n].content == "Myself")
                        {
                            gameContainerControllerPlayerItem = effectInfo.player;
                        }
                    }
                }
                GameContainerItem gameContainerItem = gameContainerProxy.GetGameContainerItemByPlayerItemAndGameContainerType(gameContainerControllerPlayerItem, gameContainerType);
                for (int n = 0; n < targetClaims.Length; n++)
                {
                    //判断所有权
                    if (targetClaims[n].claim == "locationIndex")
                    {
                        cardEntries.Add(gameContainerItem.cardEntryList[Convert.ToInt32(targetClaims[n].content)]);
                    }
                    else if (targetClaims[n].claim == "CardCode")
                    {
                        CardEntry cardEntryByCode = gameContainerItem.GetOneCardByCardCode(targetClaims[n].content);
                        if (cardEntryByCode != null)
                        {
                            cardEntries.Add(cardEntryByCode);
                        }
                    }
                }
                if (cardEntries.Count > 0)
                {
                    if (targetSet.targetClaimsNums == 1)
                    {
                        targetSet.hasTarget = true;
                        targetSet.targetCardEntries.Add(cardEntries[0]);
                    }
                }
                break;

            case "Minion":
                List <CardEntry>         minionCellItems             = new List <CardEntry>();
                List <GameContainerItem> returnGameContainerItemList = gameContainerProxy.GetGameContainerItemGameContainerType("CardBattlefield");
                foreach (GameContainerItem gameContainerItemMinion in returnGameContainerItemList)
                {
                    foreach (CardEntry minionCellItem in gameContainerItemMinion.cardEntryList)
                    {
                        for (int n = 0; n < targetClaims.Length; n++)
                        {
                            //判断所有权
                            if (targetClaims[n].claim == "Owner")
                            {
                                //是自己的
                                if (targetClaims[n].content == "Myself")
                                {
                                    targetClaims[n].result.Add(effectInfo.player.playerCode);
                                    if (minionCellItem.controllerPlayerItem.playerCode == effectInfo.player.playerCode)
                                    {
                                        minionCellItems.Add(minionCellItem);
                                    }
                                }
                                //不是自己的
                                else if (targetClaims[n].content == "Enemy")
                                {
                                    targetClaims[n].result.Add(effectInfo.player.playerCode);
                                    if (minionCellItem.controllerPlayerItem.playerCode != effectInfo.player.playerCode)
                                    {
                                        minionCellItems.Add(minionCellItem);
                                    }
                                }
                            }
                        }
                    }
                }
                if (minionCellItems.Count <= targetSet.targetClaimsNums)
                {
                    //符合数量限制
                    targetSet.hasTarget             = true;
                    targetSet.targetMinionCellItems = minionCellItems;
                }
                else
                {
                    //超出目标上限,需要用户选择
                    if (effectInfo.operationalTarget.whoOperate == "MyselfPlayer")
                    {
                        effectInfo.chooseByPlayer = effectInfo.player;
                        //发送已经确认目标的效果到前台进行展示
                        CardEntry oneCardEntry = effectInfo.cardEntry;
                        oneCardEntry.needShowEffectInfo = effectInfo;
                        effectInfoProxy.effectSysItem.showEffectNum++;
                        SendNotification(UIViewSystemEvent.UI_EFFECT_DISPLAY_SYS, oneCardEntry, UIViewSystemEvent.UI_EFFECT_DISPLAY_SYS_ONE_EFFECT_NEED_CHOOSE_TARGET);
                        //发布用户需要选择信号
                        SendNotification(LogicalSysEvent.LOGICAL_SYS, effectInfo, LogicalSysEvent.LOGICAL_SYS_NEED_PLAYER_CHOOSE);
                    }
                    else
                    {
                        UtilityLog.LogError("找不到需要选择的用户");
                    }
                    return(false);
                }

                break;

            //效果选择
            case "ChooseEffect":
                //获取玩家,根据条件筛选出复合条件的释放者和选择者
                //筛选结果
                foreach (PlayerItem playerItem in playerGroupProxy.playerGroup.playerItems.Values)
                {
                    for (int n = 0; n < targetClaims.Length; n++)
                    {
                        //判断所有权
                        if (targetClaims[n].claim == "Owner")
                        {
                            //是自己选
                            if (targetClaims[n].content == "Myself")
                            {
                                if (playerItem.playerCode == effectInfo.player.playerCode)
                                {
                                    targetPlayer = playerItem;
                                }
                            }
                        }
                    }
                }
                if (targetPlayer != null)
                {
                    effectInfo.chooseByPlayer = targetPlayer;
                    //发布用户需要选择信号
                    SendNotification(LogicalSysEvent.LOGICAL_SYS, effectInfo, LogicalSysEvent.LOGICAL_SYS_NEED_PLAYER_CHOOSE);
                    return(false);
                    //
                }
                else
                {
                    UtilityLog.LogError("no player can ChooseEffect");
                }

                break;

            //玩家
            case "Player":
                //获取玩家,根据条件筛选出复合条件的释放者和选择者
                //筛选结果
                foreach (PlayerItem playerItem in playerGroupProxy.playerGroup.playerItems.Values)
                {
                    for (int n = 0; n < targetClaims.Length; n++)
                    {
                        //判断所有权
                        if (targetClaims[n].claim == "Owner")
                        {
                            //是自己选
                            if (targetClaims[n].content == "Myself")
                            {
                                if (playerItem.playerCode == effectInfo.player.playerCode)
                                {
                                    targetPlayer = playerItem;
                                }
                            }
                        }
                    }
                }
                if (targetPlayer != null)
                {
                    //玩家确认
                    targetSet.targetPlayerItems.Add(targetPlayer);
                    targetSet.hasTarget = true;
                }
                else
                {
                    UtilityLog.LogError("no player can add TargetPlayerItems");
                }
                break;
            }
            return(true);
        }