예제 #1
0
        /// <summary>
        /// 将一名随从从手牌中移到场上
        /// </summary>
        /// <param name="userCode"></param>
        /// <param name="cardInGameCode"></param>
        /// <param name="location"></param>
        public void CastServant(BaseServant servant, int location, int target)
        {
            var user = GameContext.GetActivationUserContext();

            user.Power -= servant.Cost < 0 ? 0 : servant.Cost;


            location = GameContext.AutoShiftServant(GameContext.ShiftServant(location));
            GameContext.ParachuteCard = servant;
            servant.CardLocation      = CardLocation.降落伞;

            ActionParameter para = new ActionParameter()
            {
                PrimaryCard   = servant,
                GameContext   = GameContext,
                DeskIndex     = location,
                SecondaryCard = target > -1 ? GameContext.DeskCards[target] : null
            };
            var cardAbilityParameter = new ActionParameter()
            {
                GameContext      = GameContext,
                PrimaryCard      = servant,
                SecondaryCard    = target > -1 ? GameContext.DeskCards[target] : null,
                PrimaryCardIndex = location,
            };

            new BattlecryEvent()
            {
                EventCard = servant, Parameter = cardAbilityParameter
            }.Settlement();
            GameContext.QueueSettlement();

            new CastServantAction().Action(para);
            GameContext.ParachuteCard = null;
            // user.ComboSwitch = true;
            GameContext.AddActionStatement(new ComboOnAction(), para);
            // GameContext.AddEndOfPlayerActionEvent();
            GameContext.EventQueueSettlement();
            GameContext.QueueSettlement();

            _gameCache.SetContext(GameContext);
        }