Esempio n. 1
0
        /// <summary>
        /// 阶段检索,即在每一个结算队列结算完之后,开始的检索,包括死亡检索、受伤检索等
        /// </summary>
        /// <param name="context"></param>
        public static void StageRetrieval(this GameContext context)
        {
            bool hasQueueSettlement = false;

            if (context.DeskCards.Any(c => c != null && (c.Life < 1 || c.IsDeathing)))
            {
                //先按入场顺序排列
                var lstBiology = context.DeskCards.Where(c => c != null && (c.Life < 1 || c.IsDeathing)).OrderBy(x => x.CastIndex);
                foreach (var bio in lstBiology)
                {
                    ActionParameter para = new ActionParameter()
                    {
                        PrimaryCard = bio,
                        GameContext = context
                    };
                    CardActionFactory.CreateAction(bio, ActionType.死亡).Action(para);
                }
                hasQueueSettlement = true;
            }
            if (context.DeskCards.Any(c => c != null && c.CardType == CardType.英雄 && (c as BaseHero).Equip != null && (c as BaseHero).Equip.Durable < 1))
            {
                var heros = context.DeskCards.Where(c => c != null && c.CardType == CardType.英雄 && (c as BaseHero).Equip != null && (c as BaseHero).Equip.Durable < 1);
                foreach (var hero in heros)
                {
                    UnloadAction    unloadAction = new UnloadAction();
                    ActionParameter equipPara    = new ActionParameter()
                    {
                        GameContext = context,
                        Equip       = (hero as BaseHero).Equip,
                    };
                    unloadAction.Action(equipPara);
                }
                hasQueueSettlement = true;
            }
            if (hasQueueSettlement)
            {
                QueueSettlement(context);
            }
        }