Пример #1
0
        /// <summary>
        /// 运行奥秘
        /// </summary>
        /// <param name="SecretCardSN"></param>
        /// <param name="ActionCode"></param>
        /// <param name="HitMySelf"></param>
        /// <returns></returns>
        public static List <string> RunSecretHit(string SecretCardSN, string ActionCode, bool HitMySelf, ActionStatus game)
        {
            List <string> ActionLst   = new List <string>();
            SecretCard    card        = (SecretCard)CardUtility.GetCardInfoBySN(SecretCardSN);
            var           actiontype  = Server.ActionCode.GetActionType(ActionCode);
            var           actionField = ActionCode.Split(CardUtility.strSplitMark.ToCharArray());

            ActionLst.Add(Server.ActionCode.strHitSecret + CardUtility.strSplitMark + (HitMySelf ? CardUtility.strMe : CardUtility.strYou) +
                          CardUtility.strSplitMark + SecretCardSN);
            //HitMySelf 在自己的回合运行自己的奥秘
            switch (card.Condition)
            {
            case SecretCondition.对方召唤随从:
                //如果是召唤系的
                if (HitMySelf)
                {
                    //在自己的回合运行自己的奥秘
                    //SUMMON#YOU#M000001#POS
                    //例如:亡语的时候可能召唤一个新的随从
                    //PointEffect.RunPointEffect(game.AllRole.YourBattleInfo.BattleMinions[int.Parse(actionField[3]) - 1],card.AdditionInfo);
                    ActionLst.Add(Server.ActionCode.strPoint + CardUtility.strSplitMark + CardUtility.strYou + CardUtility.strSplitMark +
                                  actionField[3] + CardUtility.strSplitMark + card.AdditionInfo);
                }
                else
                {
                    //在自己的回合运行别人的奥秘
                    if (actiontype == Server.ActionCode.ActionType.Summon)
                    {
                        //SUMMON#YOU#M000001#POS
                        //PointEffect.RunPointEffect(game.MyInfo.BattleField.BattleMinions[int.Parse(actionField[3]) - 1], card.AdditionInfo);
                        ActionLst.Add(Server.ActionCode.strPoint + CardUtility.strSplitMark + CardUtility.strMe + CardUtility.strSplitMark +
                                      actionField[3] + CardUtility.strSplitMark + card.AdditionInfo);
                    }
                    else
                    {
                        //MINION#M000001#1
                        //PointEffect.RunPointEffect(game.MyInfo.BattleField.BattleMinions[int.Parse(actionField[2]) - 1], card.AdditionInfo);
                        ActionLst.Add(Server.ActionCode.strPoint + CardUtility.strSplitMark + CardUtility.strMe + CardUtility.strSplitMark +
                                      actionField[2] + CardUtility.strSplitMark + card.AdditionInfo);
                    }
                }
                break;

            default:
                break;
            }
            return(ActionLst);
        }
Пример #2
0
        /// <summary>
        /// 使用手牌
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnUseHandCard_Click(object sender, EventArgs e)
        {
            if (((Button)sender).Tag == null)
            {
                return;
            }
            CardBasicInfo card;

            if (((Button)sender).Name == "btnMyHeroAblity")
            {
                card = CardUtility.GetCardInfoBySN(((Button)sender).Tag.ToString());
            }
            else
            {
                card = (CardBasicInfo)((Button)sender).Tag;
            }
            var msg = game.CheckCondition(card);

            if (!String.IsNullOrEmpty(msg))
            {
                MessageBox.Show(msg);
                return;
            }
            var actionlst = RunAction.StartAction(game, card.SN);

            if (actionlst.Count != 0)
            {
                game.MySelf.RoleInfo.crystal.CurrentRemainPoint -= card.ActualCostPoint;
                if (((Button)sender).Name != "btnMyHeroAblity")
                {
                    game.RemoveUsedCard(card.SN);
                }
                else
                {
                    game.MySelf.RoleInfo.IsUsedHeroAbility = true;
                }
                actionlst.Add(ActionCode.strCrystal + CardUtility.strSplitMark + CardUtility.strMe + CardUtility.strSplitMark +
                              game.MySelf.RoleInfo.crystal.CurrentRemainPoint + CardUtility.strSplitMark + game.MySelf.RoleInfo.crystal.CurrentFullPoint);
                //奥秘计算
                actionlst.AddRange(game.奥秘计算(actionlst));
                game.MySelf.ResetHandCardCost();
                Card.Client.ClientRequest.WriteAction(game.GameId.ToString(GameServer.GameIdFormat), actionlst);
                DisplayMyInfo();
            }
        }
Пример #3
0
        /// <summary>
        /// 初始化
        /// </summary>
        public void Init()
        {
            //手牌设定
            var HandCard = Card.Client.ClientRequest.DrawCard(GameId.ToString(GameServer.GameIdFormat), IsFirst,
                                                              IsFirst ? PlayerBasicInfo.BasicHandCardCount : (PlayerBasicInfo.BasicHandCardCount + 1));

            MySelf.RoleInfo.crystal.CurrentFullPoint   = 0;
            MySelf.RoleInfo.crystal.CurrentRemainPoint = 0;
            YourInfo.crystal.CurrentFullPoint          = 0;
            YourInfo.crystal.CurrentRemainPoint        = 0;
            //DEBUG START
            MySelf.RoleInfo.crystal.CurrentFullPoint   = 5;
            MySelf.RoleInfo.crystal.CurrentRemainPoint = 5;
            YourInfo.crystal.CurrentFullPoint          = 5;
            YourInfo.crystal.CurrentRemainPoint        = 5;

            HandCard.Add("M000024");
            HandCard.Add("M000115");

            //DEBUG END
            //英雄技能:奥术飞弹
            MySelf.RoleInfo.HeroAbility = (Card.AbilityCard)Card.CardUtility.GetCardInfoBySN("A200001");
            YourInfo.HeroAbility        = (Card.AbilityCard)Card.CardUtility.GetCardInfoBySN("A200001");
            if (!IsFirst)
            {
                HandCard.Add(Card.CardUtility.SN幸运币);
            }
            foreach (var card in HandCard)
            {
                MySelf.handCards.Add(CardUtility.GetCardInfoBySN(card));
            }
            MySelf.RoleInfo.HandCardCount = HandCard.Count;
            if (IsFirst)
            {
                MySelf.RoleInfo.RemainCardDeckCount = Card.Client.CardDeck.MaxCards - 3;
                YourInfo.RemainCardDeckCount        = Card.Client.CardDeck.MaxCards - 4;
            }
            else
            {
                MySelf.RoleInfo.RemainCardDeckCount = Card.Client.CardDeck.MaxCards - 4;
                YourInfo.RemainCardDeckCount        = Card.Client.CardDeck.MaxCards - 3;
            }
        }
Пример #4
0
        /// <summary>
        /// 使用手牌
        /// </summary>
        /// <param name="GameId"></param>
        /// <param name="IsHost"></param>
        /// <param name="CardSn"></param>
        /// <returns></returns>
        public static FullServerManager.Interrupt UseHandCard(int GameId, bool IsHost, string CardSn, int Step, string SessionData)
        {
            var gamestatus = GameRunning_BS[GameId].gameStatus(IsHost);

            gamestatus.Interrupt.IsHost      = IsHost;
            gamestatus.Interrupt.GameId      = GameId.ToString(GameIdFormat);
            gamestatus.GameId                = GameId;
            gamestatus.Interrupt.Step        = Step;
            gamestatus.Interrupt.SessionData = SessionData;
            RunAction.StartAction(gamestatus, CardSn);
            if (gamestatus.Interrupt.ActionName == CardUtility.strOK)
            {
                gamestatus.AllRole.MyPublicInfo.crystal.CurrentRemainPoint -= CardUtility.GetCardInfoBySN(CardSn).使用成本;
                gamestatus.AllRole.MyPublicInfo.HandCardCount--;
                gamestatus.AllRole.MyPrivateInfo.RemoveUsedCard(CardSn);
            }
            gamestatus.Interrupt.ActionCard = new MinimizeBattleInfo.HandCardInfo();
            gamestatus.Interrupt.ActionCard.Init(CardUtility.GetCardInfoBySN(CardSn));
            return(gamestatus.Interrupt);
        }
Пример #5
0
        /// <summary>
        /// 奥秘是否命中
        /// </summary>
        /// <param name="SecretCardSN"></param>
        /// <param name="ActionCode"></param>
        /// <param name="HitMySelf">是否检查自己是否触发自己的奥秘</param>
        /// <returns></returns>
        public static bool IsSecretHit(string SecretCardSN, string ActionCode, bool HitMySelf)
        {
            //HitMySelf
            //这里需要关注方向性问题
            SecretCard card        = (SecretCard)CardUtility.GetCardInfoBySN(SecretCardSN);
            var        actiontype  = Server.ActionCode.GetActionType(ActionCode);
            var        actionField = ActionCode.Split(CardUtility.strSplitMark.ToCharArray());
            bool       IsHit       = false;

            switch (card.Condition)
            {
            case SecretCondition.对方召唤随从:
                if (HitMySelf)
                {
                    //在自己的回合检查否触发自己的奥秘,如果是召唤系的
                    //SUMMON#YOU#M000001
                    //HitMySelf的时候,是YOU
                    if (actiontype == Server.ActionCode.ActionType.Summon && actionField[1] == CardUtility.strYou)
                    {
                        IsHit = true;
                    }
                }
                else
                {
                    //在别人的回合检查否触发自己的奥秘,是ME
                    if (actiontype == Server.ActionCode.ActionType.Summon && actionField[1] == CardUtility.strMe)
                    {
                        IsHit = true;
                    }
                    if (actiontype == Server.ActionCode.ActionType.UseMinion)
                    {
                        IsHit = true;
                    }
                }
                break;

            default:
                break;
            }
            return(IsHit);
        }
Пример #6
0
        /// <summary>
        /// 事件处理方法
        /// </summary>
        /// <param name="事件"></param>
        /// <param name="game"></param>
        /// <returns></returns>
        public List <string> 事件处理方法(EventCard.全局事件 事件, ActionStatus game)
        {
            List <string> ActionLst = new List <string>();

            if (!沉默状态 && 自身事件效果.触发效果事件类型 == 事件.触发事件类型)
            {
                if (自身事件效果.触发效果事件方向 != CardUtility.目标选择方向枚举.双方)
                {
                    if (自身事件效果.触发效果事件方向 == CardUtility.目标选择方向枚举.本方 && (!事件.触发位置.本方对方标识))
                    {
                        return(ActionLst);
                    }
                    if (自身事件效果.触发效果事件方向 == CardUtility.目标选择方向枚举.对方 && (事件.触发位置.本方对方标识))
                    {
                        return(ActionLst);
                    }
                }
                if (!string.IsNullOrEmpty(自身事件效果.限制信息) && !SelectUtility.符合选择条件(this, 自身事件效果.限制信息))
                {
                    return(ActionLst);
                }
                ActionLst.Add(Server.ActionCode.strHitEvent + CardUtility.strSplitMark);
                //这里有可能是一个增益表达式!!
                if (自身事件效果.效果编号.StartsWith("A"))
                {
                    ActionLst.AddRange(((SpellCard)CardUtility.GetCardInfoBySN(自身事件效果.效果编号)).UseSpell(game));
                }
                else
                {
                    Effect.PointEffect t   = new Effect.PointEffect();
                    string[]           opt = 自身事件效果.效果编号.Split("/".ToCharArray());
                    t.持续回合 = CardUtility.Max.ToString();
                    t.攻击力  = opt[0];
                    t.生命值  = opt[1];
                    ((Effect.IAtomicEffect)t).DealMinion(game, this);
                }
                潜行特性 = false;
            }
            return(ActionLst);
        }
Пример #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="singleEffect"></param>
        /// <param name="game"></param>
        /// <returns></returns>
        public static List <string> RunEffect(EffectDefine singleEffect, Client.GameManager game, CardUtility.TargetPosition Pos)
        {
            List <string> Result = new List <string>();
            var           Summon = (Card.MinionCard)CardUtility.GetCardInfoBySN(singleEffect.AddtionInfo);

            //一定要初始化,不然的话,生命值是-1;
            Summon.Init();
            if (Pos.MeOrYou)
            {
                game.MySelf.RoleInfo.BattleField.BattleMinions[Pos.Postion - 1] = Summon;
                //TRANSFORM#ME#1#M9000001
                Result.Add(ActionCode.strTransform + Card.CardUtility.strSplitMark + CardUtility.strMe +
                           Card.CardUtility.strSplitMark + Pos.Postion + Card.CardUtility.strSplitMark + singleEffect.AddtionInfo);
            }
            else
            {
                game.YourInfo.BattleField.BattleMinions[Pos.Postion - 1] = Summon;
                Result.Add(ActionCode.strTransform + Card.CardUtility.strSplitMark + CardUtility.strYou +
                           Card.CardUtility.strSplitMark + Pos.Postion + Card.CardUtility.strSplitMark + singleEffect.AddtionInfo);
            }
            return(Result);
        }
Пример #8
0
 /// <summary>
 /// 对方复原操作
 /// </summary>
 /// <param name="game"></param>
 /// <param name="actField"></param>
 public static void ReRunEffect(int GameId, ActionStatus game, string[] actField)
 {
     if (actField[1] == CardUtility.strYou)
     {
         if (actField.Length == 3)
         {
             //如果有第三参数,则获得指定手牌
             game.AllRole.MyPrivateInfo.handCards.Add(CardUtility.GetCardInfoBySN(actField[2]));
             game.AllRole.MyPublicInfo.HandCardCount++;
         }
         else
         {
             var drawCards = ClientRequest.DrawCard(GameId.ToString(GameServer.GameIdFormat), game.IsHost, 1);
             game.AllRole.MyPrivateInfo.handCards.Add(CardUtility.GetCardInfoBySN(drawCards[0]));
             game.AllRole.MyPublicInfo.HandCardCount++;
             game.AllRole.MyPublicInfo.RemainCardDeckCount--;
         }
     }
     else
     {
         game.AllRole.YourPublicInfo.HandCardCount++;
         game.AllRole.YourPublicInfo.RemainCardDeckCount--;
     }
 }
Пример #9
0
        /// <summary>
        /// 初始化手牌(CS)
        /// </summary>
        /// <param name="IsHost"></param>
        public void InitHandCard()
        {
            int DrawCardCnt = IsFirst ? PublicInfo.BasicHandCardCount : (PublicInfo.BasicHandCardCount + 1);

            foreach (var card in ClientRequest.DrawCard(GameId.ToString(GameServer.GameIdFormat), IsHost, DrawCardCnt))
            {
                actionStatus.AllRole.MyPrivateInfo.handCards.Add(CardUtility.GetCardInfoBySN(card));
            }
            if (IsFirst)
            {
                actionStatus.AllRole.MyPublicInfo.RemainCardDeckCount   = CardDeck.MaxCards - 3;
                actionStatus.AllRole.YourPublicInfo.RemainCardDeckCount = CardDeck.MaxCards - 4;
                actionStatus.AllRole.MyPublicInfo.HandCardCount         = PublicInfo.BasicHandCardCount;
                actionStatus.AllRole.YourPublicInfo.HandCardCount       = PublicInfo.BasicHandCardCount + 1 + 1;
            }
            else
            {
                actionStatus.AllRole.MyPrivateInfo.handCards.Add(CardUtility.GetCardInfoBySN(SpellCard.SN幸运币));
                actionStatus.AllRole.MyPublicInfo.RemainCardDeckCount   = CardDeck.MaxCards - 4;
                actionStatus.AllRole.YourPublicInfo.RemainCardDeckCount = CardDeck.MaxCards - 3;
                actionStatus.AllRole.MyPublicInfo.HandCardCount         = PublicInfo.BasicHandCardCount + 1 + 1;
                actionStatus.AllRole.YourPublicInfo.HandCardCount       = PublicInfo.BasicHandCardCount;
            }
        }
Пример #10
0
        /// <summary>
        /// 开始一个动作
        /// </summary>
        /// <param name="game"></param>
        /// <param name="CardSn"></param>
        /// <param name="ConvertPosDirect">亡语的时候,需要倒置方向</param>
        /// <returns></returns>
        public static List <String> StartAction(GameManager game, String CardSn, Boolean ConvertPosDirect = false)
        {
            Card.CardBasicInfo card          = Card.CardUtility.GetCardInfoBySN(CardSn);
            List <String>      ActionCodeLst = new List <string>();

            switch (card.CardType)
            {
            case CardBasicInfo.CardTypeEnum.法术:
                ActionCodeLst.Add(UseAbility(CardSn));
                //初始化 Buff效果等等
                Card.AbilityCard ablity = (Card.AbilityCard)CardUtility.GetCardInfoBySN(CardSn);
                ablity.CardAbility.Init();
                var ResultArg = game.UseAbility(ablity, ConvertPosDirect);
                if (ResultArg.Count != 0)
                {
                    ActionCodeLst.AddRange(ResultArg);
                    //英雄技能的时候,不算[本方施法] A900001 幸运币
                    if (CardSn.Substring(1, 1) != "2")
                    {
                        ActionCodeLst.AddRange(game.MySelf.RoleInfo.BattleField.触发事件(MinionCard.事件类型列表.本方施法, game));
                    }
                }
                else
                {
                    ActionCodeLst.Clear();
                }
                break;

            case CardBasicInfo.CardTypeEnum.随从:
                int MinionPos = GetPutPos(game);
                if (MinionPos != -1)
                {
                    ActionCodeLst.Add(UseMinion(CardSn, MinionPos));
                    var minion = (Card.MinionCard)card;
                    //初始化
                    minion.Init();
                    game.MySelf.RoleInfo.BattleField.PutToBattle(MinionPos, minion);
                    ActionCodeLst.AddRange(minion.发动战吼(game));
                    game.MySelf.RoleInfo.BattleField.ResetBuff();
                }
                else
                {
                    ActionCodeLst.Clear();
                }
                break;

            case CardBasicInfo.CardTypeEnum.武器:
                ActionCodeLst.Add(UseWeapon(CardSn));
                game.MySelf.RoleInfo.Weapon = (Card.WeaponCard)card;
                break;

            case CardBasicInfo.CardTypeEnum.奥秘:
                ActionCodeLst.Add(UseSecret(CardSn));
                game.MySelf.奥秘列表.Add((Card.SecretCard)card);
                break;

            default:
                break;
            }
            return(ActionCodeLst);
        }
Пример #11
0
        /// <summary>
        /// 新的回合
        /// </summary>
        public void TurnStart()
        {
            if (IsMyTurn)
            {
                //对手回合加成属性的去除
                int ExistMinionCount = YourInfo.BattleField.MinionCount;
                for (int i = 0; i < ExistMinionCount; i++)
                {
                    if (YourInfo.BattleField.BattleMinions[i] != null)
                    {
                        YourInfo.BattleField.BattleMinions[i].本回合生命力加成 = 0;
                        YourInfo.BattleField.BattleMinions[i].本回合攻击力加成 = 0;
                        if (YourInfo.BattleField.BattleMinions[i].特殊效果 == MinionCard.特殊效果列表.回合结束死亡)
                        {
                            YourInfo.BattleField.BattleMinions[i] = null;
                        }
                    }
                }
                YourInfo.BattleField.ClearDead(this, false);

                //魔法水晶的增加
                MyInfo.crystal.NewTurn();
                //过载的清算
                if (OverloadPoint != 0)
                {
                    MyInfo.crystal.ReduceCurrentPoint(OverloadPoint);
                    OverloadPoint = 0;
                }
                //连击的重置
                MyInfo.连击状态 = false;
                //手牌
                var NewCardList = Card.Client.ClientRequest.DrawCard(GameId.ToString(GameServer.GameIdFormat), IsFirst, 1);
                foreach (var card in NewCardList)
                {
                    if (MySelfInfo.handCards.Count < PublicInfo.MaxHandCardCount)
                    {
                        MySelfInfo.handCards.Add(CardUtility.GetCardInfoBySN(card));
                    }
                }
                MyInfo.HandCardCount++;
                MyInfo.RemainCardDeckCount--;
                MyInfo.RemainAttactTimes = 1;
                MyInfo.IsUsedHeroAbility = false;
                foreach (var minion in MyInfo.BattleField.BattleMinions)
                {
                    if (minion != null)
                    {
                        switch (minion.冰冻状态)
                        {
                        case CardUtility.EffectTurn.效果命中:
                            //如果上回合被命中的,这回合就是作用中
                            minion.冰冻状态 = CardUtility.EffectTurn.效果作用;
                            break;

                        case CardUtility.EffectTurn.效果作用:
                            //如果上回合作用中的,这回合就是解除
                            minion.冰冻状态 = CardUtility.EffectTurn.无效果;
                            break;
                        }
                    }
                }
                //重置攻击次数,必须放在状态变化之后!
                //原因是剩余攻击回数和状态有关!
                foreach (var minion in MyInfo.BattleField.BattleMinions)
                {
                    if (minion != null)
                    {
                        minion.ResetAttackTimes();
                    }
                }
                //手牌消耗的计算
                MySelfInfo.ResetHandCardCost(this);
            }
            else
            {
                YourInfo.crystal.NewTurn();
                if (YourInfo.HandCardCount < PublicInfo.MaxHandCardCount)
                {
                    YourInfo.HandCardCount++;
                }
                YourInfo.RemainCardDeckCount--;
                YourInfo.RemainAttactTimes = 1;
                YourInfo.IsUsedHeroAbility = false;
                //重置攻击次数
                foreach (var minion in YourInfo.BattleField.BattleMinions)
                {
                    if (minion != null)
                    {
                        minion.ResetAttackTimes();
                    }
                }
                //如果对手有可以解除冰冻的,解除冰冻
                foreach (var minion in YourInfo.BattleField.BattleMinions)
                {
                    if (minion != null)
                    {
                        switch (minion.冰冻状态)
                        {
                        case CardUtility.EffectTurn.效果命中:
                            //如果上回合被命中的,这回合就是作用中
                            minion.冰冻状态 = CardUtility.EffectTurn.效果作用;
                            break;

                        case CardUtility.EffectTurn.效果作用:
                            //如果上回合作用中的,这回合就是解除
                            minion.冰冻状态 = CardUtility.EffectTurn.无效果;
                            break;
                        }
                    }
                }
            }
        }
Пример #12
0
        /// <summary>
        /// 新的回合
        /// </summary>
        public void TurnStart()
        {
            if (IsMyTurn)
            {
                //魔法水晶的增加
                MySelf.RoleInfo.crystal.NewTurn();
                //过载的清算
                if (OverloadPoint != 0)
                {
                    MySelf.RoleInfo.crystal.ReduceCurrentPoint(OverloadPoint);
                    OverloadPoint = 0;
                }
                //手牌
                var NewCardList = Card.Client.ClientRequest.DrawCard(GameId.ToString(GameServer.GameIdFormat), IsFirst, 1);
                foreach (var card in NewCardList)
                {
                    if (MySelf.handCards.Count < PlayerBasicInfo.MaxHandCardCount)
                    {
                        MySelf.handCards.Add(CardUtility.GetCardInfoBySN(card));
                    }
                }
                MySelf.RoleInfo.HandCardCount++;
                MySelf.RoleInfo.RemainCardDeckCount--;
                MySelf.RoleInfo.RemainAttactTimes = 1;
                MySelf.RoleInfo.IsUsedHeroAbility = false;
                foreach (var minion in MySelf.RoleInfo.BattleField.BattleMinions)
                {
                    if (minion != null)
                    {
                        switch (minion.冰冻状态)
                        {
                        case CardUtility.EffectTurn.效果命中:
                            //如果上回合被命中的,这回合就是作用中
                            minion.冰冻状态 = CardUtility.EffectTurn.效果作用;
                            break;

                        case CardUtility.EffectTurn.效果作用:
                            //如果上回合作用中的,这回合就是解除
                            minion.冰冻状态 = CardUtility.EffectTurn.无效果;
                            break;
                        }
                    }
                }
                //重置攻击次数,必须放在状态变化之后!
                //原因是剩余攻击回数和状态有关!
                foreach (var minion in MySelf.RoleInfo.BattleField.BattleMinions)
                {
                    if (minion != null)
                    {
                        minion.ResetAttackTimes();
                    }
                }
                //手牌消耗的计算
                MySelf.ResetHandCardCost();
            }
            else
            {
                YourInfo.crystal.NewTurn();
                if (YourInfo.HandCardCount < PlayerBasicInfo.MaxHandCardCount)
                {
                    YourInfo.HandCardCount++;
                }
                YourInfo.RemainCardDeckCount--;
                YourInfo.RemainAttactTimes = 1;
                YourInfo.IsUsedHeroAbility = false;
                //重置攻击次数
                foreach (var minion in YourInfo.BattleField.BattleMinions)
                {
                    if (minion != null)
                    {
                        minion.ResetAttackTimes();
                    }
                }
                //如果对手有可以解除冰冻的,解除冰冻
                foreach (var minion in YourInfo.BattleField.BattleMinions)
                {
                    if (minion != null)
                    {
                        switch (minion.冰冻状态)
                        {
                        case CardUtility.EffectTurn.效果命中:
                            //如果上回合被命中的,这回合就是作用中
                            minion.冰冻状态 = CardUtility.EffectTurn.效果作用;
                            break;

                        case CardUtility.EffectTurn.效果作用:
                            //如果上回合作用中的,这回合就是解除
                            minion.冰冻状态 = CardUtility.EffectTurn.无效果;
                            break;
                        }
                    }
                }
            }
        }
Пример #13
0
        /// <summary>
        /// 使用法术
        /// </summary>
        /// <param name="game"></param>
        /// <param name="IsMyAction">对象方向转换</param>
        public static void RunBS(ActionStatus game, string CardSn)
        {
            List <string> Result = new List <string>();
            SpellCard     spell  = (SpellCard)CardUtility.GetCardInfoBySN(CardSn);

            //Step1
            CardUtility.抉择枚举        PickAbilityResult = CardUtility.抉择枚举.第一效果;
            SpellCard.AbilityDefine ability           = new SpellCard.AbilityDefine();
            if (game.Interrupt.Step == 1)
            {
                switch (spell.效果选择类型)
                {
                case SpellCard.效果选择类型枚举.无需选择:
                    game.Interrupt.ExternalInfo = "1";
                    break;

                case SpellCard.效果选择类型枚举.主动选择:
                    game.Interrupt.Step         = 2;
                    game.Interrupt.ActionName   = "SPELLDECIDE";
                    game.Interrupt.ExternalInfo = spell.FirstAbilityDefine.描述 + CardUtility.strSplitArrayMark + spell.SecondAbilityDefine.描述;
                    return;

                case SpellCard.效果选择类型枚举.自动判定:
                    game.Interrupt.ExternalInfo = "1";
                    if (!ExpressHandler.AbilityPickCondition(game, spell.效果选择条件))
                    {
                        PickAbilityResult           = CardUtility.抉择枚举.第二效果;
                        game.Interrupt.ExternalInfo = "2";
                    }
                    break;

                default:
                    break;
                }
                game.Interrupt.Step = 2;
            }
            //Step2
            if (game.Interrupt.Step == 2)
            {
                if (spell.效果选择类型 == SpellCard.效果选择类型枚举.主动选择 && SystemManager.游戏类型 == SystemManager.GameType.HTML版)
                {
                    switch (game.Interrupt.SessionDic["SPELLDECIDE"])
                    {
                    case "1":
                        PickAbilityResult = CardUtility.抉择枚举.第一效果;
                        break;

                    case "2":
                        PickAbilityResult = CardUtility.抉择枚举.第二效果;
                        break;

                    default:
                        PickAbilityResult = CardUtility.抉择枚举.取消;
                        break;
                    }
                }
                if (PickAbilityResult != CardUtility.抉择枚举.取消)
                {
                    List <EffectDefine> SingleEffectList = new List <EffectDefine>();
                    if (PickAbilityResult == CardUtility.抉择枚举.第一效果)
                    {
                        ability = spell.FirstAbilityDefine;
                    }
                    else
                    {
                        ability = spell.SecondAbilityDefine;
                    }
                    if (game.ActionName == "USEMINIONCARD")
                    {
                        //如果整个大的动作时随从入场,并且如果这个战吼不需要指定位置,则现在的话,将入场随从设定为指定位置
                        ability.MainAbilityDefine.AbliltyPosPicker.SelectedPos.本方对方标识 = true;
                        ability.MainAbilityDefine.AbliltyPosPicker.SelectedPos.位置     = int.Parse(game.Interrupt.SessionDic["MINIONPOSITION"]);
                    }
                    if (ability.IsNeedTargetSelect())
                    {
                        if (game.ActionName == "USEMINIONCARD" && game.Interrupt.SessionDic.ContainsKey("BATTLECRYPOSITION"))
                        {
                            ability.MainAbilityDefine.AbliltyPosPicker.SelectedPos = CardUtility.指定位置结构体.FromString(game.Interrupt.SessionDic["BATTLECRYPOSITION"]);
                        }
                        else
                        {
                            if (game.ActionName == "USESPELLCARD" && game.Interrupt.SessionDic.ContainsKey("SPELLPOSITION"))
                            {
                                ability.MainAbilityDefine.AbliltyPosPicker.SelectedPos = CardUtility.指定位置结构体.FromString(game.Interrupt.SessionDic["SPELLPOSITION"]);
                            }
                            else
                            {
                                ability.MainAbilityDefine.AbliltyPosPicker.CanNotSelectPos.位置 = BattleFieldInfo.UnknowPos;
                                SelectUtility.SetTargetSelectEnable(ability.MainAbilityDefine.AbliltyPosPicker, game);
                                game.Interrupt.ExternalInfo = SelectUtility.GetTargetListString(game);
                                game.Interrupt.ActionName   = "SPELLPOSITION";
                                return;
                            }
                        }
                    }
                    game.Interrupt.Step = 3;
                }
                else
                {
                    game.Interrupt.Step = -1;
                    return;
                }
            }

            if (game.Interrupt.Step == 3)
            {
                SpellCard.RunAbility(game, ability);
                if (spell.法术卡牌类型 == CardBasicInfo.法术卡牌类型枚举.普通卡牌)
                {
                    game.battleEvenetHandler.事件池.Add(new EventCard.全局事件()
                    {
                        触发事件类型 = EventCard.事件类型枚举.施法,
                        触发位置   = new CardUtility.指定位置结构体()
                        {
                            位置     = BattleFieldInfo.HeroPos,
                            本方对方标识 = true
                        }
                    });
                }
            }
            game.Interrupt.Step       = 99;
            game.Interrupt.ActionName = CardUtility.strOK;
        }
Пример #14
0
 /// <summary>
 /// 开始回合
 /// </summary>
 /// <param name="IsHost"></param>
 public void TurnStart(bool IsHost)
 {
     gameStatus(IsHost).AllRole.MyPrivateInfo.handCards.Add(CardUtility.GetCardInfoBySN(DrawCard(IsHost, 1)[0]));
     TurnAction.TurnStart(gameStatus(IsHost));
 }
Пример #15
0
        /// <summary>
        /// 处理对方的动作
        /// </summary>
        /// <param name="ActionCommand"></param>
        /// <param name="game"></param>
        public static void Process(string ActionCommand, ActionStatus game)
        {
            string[] actField = ActionCommand.Split(CardUtility.strSplitMark.ToCharArray());
            switch (ActionCode.GetActionType(ActionCommand))
            {
            case ActionCode.ActionType.Card:
                CardEffect.ReRunEffect(1, game, actField);
                break;

            case ActionCode.ActionType.UseMinion:
                int Pos    = int.Parse(actField[2]);
                var minion = (MinionCard)CardUtility.GetCardInfoBySN(actField[1]);
                minion.初始化();
                game.AllRole.YourPublicInfo.BattleField.PutToBattle(Pos, minion);
                Buff.ResetBuff(game);
                break;

            case ActionCode.ActionType.UseWeapon:
                game.AllRole.YourPublicInfo.Hero.Weapon = (WeaponCard)CardUtility.GetCardInfoBySN(actField[1]);
                break;

            case ActionCode.ActionType.UseSecret:
                game.AllRole.YourPublicInfo.Hero.SecretCount++;;
                break;

            case ActionCode.ActionType.UseAbility:
                break;

            case ActionCode.ActionType.Fight:
                //FIGHT#1#2
                FightHandler.Fight(int.Parse(actField[2]), int.Parse(actField[1]), game, false);
                break;

            case ActionCode.ActionType.Point:
                IAtomicEffect point = new PointEffect();
                point.ReRunEffect(game, actField);
                break;

            case ActionCode.ActionType.Health:
                IAtomicEffect health = new HealthEffect();
                health.ReRunEffect(game, actField);
                break;

            case ActionCode.ActionType.Status:
                IAtomicEffect status = new StatusEffect();
                status.ReRunEffect(game, actField);
                break;

            case ActionCode.ActionType.Transform:
                IAtomicEffect transform = new TransformEffect();
                transform.ReRunEffect(game, actField);
                break;

            case ActionCode.ActionType.Attack:
                IAtomicEffect attack = new AttackEffect();
                attack.ReRunEffect(game, actField);
                break;

            case ActionCode.ActionType.HitSecret:
                SecretCard.ReRunSecret(game, actField);
                break;

            case ActionCode.ActionType.Control:
                ControlEffect.ReRunEffect(game, actField);
                break;

            case ActionCode.ActionType.Summon:
                SummonEffect.ReRunEffect(game, actField);
                break;

            case ActionCode.ActionType.Crystal:
                CrystalEffect.ReRunEffect(game, actField);
                break;

            case ActionCode.ActionType.WeaponPoint:
                WeaponPointEffect.ReRunEffect(game, actField);
                break;

            case ActionCode.ActionType.Settle:
                ActionStatus.Settle(game);
                break;
            }
        }
Пример #16
0
 /// <summary>
 /// 对方复原操作
 /// </summary>
 /// <param name="game"></param>
 /// <param name="actField"></param>
 void IAtomicEffect.ReRunEffect(ActionStatus game, string[] actField)
 {
     if (actField[1] == CardUtility.strYou)
     {
         //MyInfo
         game.AllRole.MyPublicInfo.BattleField.BattleMinions[int.Parse(actField[2]) - 1] = (Engine.Card.MinionCard)CardUtility.GetCardInfoBySN(actField[3]);
     }
     else
     {
         game.AllRole.YourPublicInfo.BattleField.BattleMinions[int.Parse(actField[2]) - 1] = (Engine.Card.MinionCard)CardUtility.GetCardInfoBySN(actField[3]);
     }
 }
Пример #17
0
        /// <summary>
        /// 初始化
        /// </summary>
        public void InitPlayInfo()
        {
            //位置
            HostStatus.BasicInfo.Hero.战场位置 = new CardUtility.指定位置结构体()
            {
                本方对方标识 = true, 位置 = BattleFieldInfo.HeroPos
            };
            GuestStatus.BasicInfo.Hero.战场位置 = new CardUtility.指定位置结构体()
            {
                本方对方标识 = false, 位置 = BattleFieldInfo.HeroPos
            };
            HostStatus.BasicInfo.BattleField.本方对方标识  = true;
            GuestStatus.BasicInfo.BattleField.本方对方标识 = false;
            //水晶
            HostStatus.BasicInfo.crystal.CurrentFullPoint    = 0;
            HostStatus.BasicInfo.crystal.CurrentRemainPoint  = 0;
            GuestStatus.BasicInfo.crystal.CurrentFullPoint   = 0;
            GuestStatus.BasicInfo.crystal.CurrentRemainPoint = 0;
            HeroCard HostHero  = new HeroCard();
            HeroCard GuestHero = new HeroCard();

            HostStatus.BasicInfo.Hero  = HostHero;
            GuestStatus.BasicInfo.Hero = GuestHero;
            //英雄技能:法术火球
            HostHero.HeroSkillCardSN = "A100002";
            //英雄技能:召唤蜘蛛
            GuestHero.HeroSkillCardSN = "A110002";
            //TEST START
            //法术测试:闷棍
            //HostStatus.SelfInfo.handCards.Add(CardUtility.GetCardInfoBySN("A000073"));
            //战吼测试:叫嚣的中士
            //HostStatus.SelfInfo.handCards.Add(CardUtility.GetCardInfoBySN("M000054"));
            //亡语测试:鬼灵爬行者
            //HostStatus.SelfInfo.handCards.Add(CardUtility.GetCardInfoBySN("M9A0003"));
            //亡语测试:阿努巴尔伏击者[亡语]
            //HostStatus.SelfInfo.handCards.Add(CardUtility.GetCardInfoBySN("A300003"));
            //TEST END
            //初始化双方手牌
            int DrawCardCnt = 0;

            if (HostAsFirst)
            {
                DrawCardCnt = PublicInfo.BasicHandCardCount;
                foreach (var card in DrawCard(true, DrawCardCnt))
                {
                    HostStatus.SelfInfo.handCards.Add(CardUtility.GetCardInfoBySN(card));
                }
                DrawCardCnt = PublicInfo.BasicHandCardCount + 1;
                foreach (var card in DrawCard(false, DrawCardCnt))
                {
                    GuestStatus.SelfInfo.handCards.Add(CardUtility.GetCardInfoBySN(card));
                }
                GuestStatus.SelfInfo.handCards.Add(CardUtility.GetCardInfoBySN(Card.SpellCard.SN幸运币));

                HostStatus.BasicInfo.RemainCardDeckCount  = CardDeck.MaxCards - 3;
                GuestStatus.BasicInfo.RemainCardDeckCount = CardDeck.MaxCards - 4;
                HostStatus.BasicInfo.HandCardCount        = PublicInfo.BasicHandCardCount;
                GuestStatus.BasicInfo.HandCardCount       = PublicInfo.BasicHandCardCount + 1 + 1;
                TurnStart(true);
            }
            else
            {
                DrawCardCnt = PublicInfo.BasicHandCardCount + 1;
                foreach (var card in DrawCard(true, DrawCardCnt))
                {
                    HostStatus.SelfInfo.handCards.Add(CardUtility.GetCardInfoBySN(card));
                }
                HostStatus.SelfInfo.handCards.Add(CardUtility.GetCardInfoBySN(Card.SpellCard.SN幸运币));

                DrawCardCnt = PublicInfo.BasicHandCardCount;
                foreach (var card in DrawCard(false, DrawCardCnt))
                {
                    GuestStatus.SelfInfo.handCards.Add(CardUtility.GetCardInfoBySN(card));
                }
                HostStatus.BasicInfo.RemainCardDeckCount  = CardDeck.MaxCards - 4;
                GuestStatus.BasicInfo.RemainCardDeckCount = CardDeck.MaxCards - 3;
                HostStatus.BasicInfo.HandCardCount        = PublicInfo.BasicHandCardCount + 1 + 1;
                GuestStatus.BasicInfo.HandCardCount       = PublicInfo.BasicHandCardCount;
                TurnStart(false);
            }
        }
Пример #18
0
        /// <summary>
        /// 随从卡牌
        /// </summary>
        /// <param name="game"></param>
        /// <param name="CardSn"></param>
        public static void RunBS(ActionStatus game, string CardSn)
        {
            int        MinionPos = -1;
            MinionCard minion    = minion = (MinionCard)CardUtility.GetCardInfoBySN(CardSn);

            //Step1
            if (game.Interrupt.Step == 1)
            {
                if (game.AllRole.MyPublicInfo.BattleField.MinionCount != 0)
                {
                    game.Interrupt.Step       = 2;
                    game.Interrupt.ActionName = "MINIONPOSITION";
                    return;
                }
                else
                {
                    game.Interrupt.SessionData = "MINIONPOSITION:1|";
                }
                MinionPos           = 1;
                game.Interrupt.Step = 2;
            }
            //Step2
            if (game.Interrupt.Step == 2)
            {
                if (MinionPos == -1)
                {
                    MinionPos = int.Parse(game.Interrupt.SessionDic["MINIONPOSITION"]);
                }
                //初始化
                minion.初始化();
                //随从入场
                game.AllRole.MyPublicInfo.BattleField.PutToBattle(MinionPos, minion);
                //必须在放入之前做得原因是,被放入的随从不能被触发这个事件
                game.battleEvenetHandler.事件池.Add(new EventCard.全局事件()
                {
                    触发事件类型 = EventCard.事件类型枚举.召唤,
                    触发位置   = new CardUtility.指定位置结构体()
                    {
                        位置     = MinionPos,
                        本方对方标识 = game.IsHost
                    }
                });
                game.Interrupt.Step = 3;
            }

            //Step3
            if (game.Interrupt.Step == 3 && !string.IsNullOrEmpty(minion.战吼效果))
            {
                SpellCard spell = (SpellCard)CardUtility.GetCardInfoBySN(minion.战吼效果);
                game.Interrupt.Step = 4;
                if (spell.FirstAbilityDefine.IsNeedTargetSelect())
                {
                    //这里先简单假设所有战吼,如果需要指定位置,则自身不能成为指定位置
                    spell.FirstAbilityDefine.MainAbilityDefine.AbliltyPosPicker.CanNotSelectPos.本方对方标识 = true;
                    spell.FirstAbilityDefine.MainAbilityDefine.AbliltyPosPicker.CanNotSelectPos.位置     = int.Parse(game.Interrupt.SessionDic["MINIONPOSITION"]);
                    SelectUtility.SetTargetSelectEnable(spell.FirstAbilityDefine.MainAbilityDefine.AbliltyPosPicker, game);
                    game.Interrupt.ExternalInfo = SelectUtility.GetTargetListString(game);
                    game.Interrupt.ActionName   = "BATTLECRYPOSITION";
                    return;
                }
            }
            if (game.Interrupt.Step == 4)
            {
                //法术位置信息包含在SessionData中,传递下去
                //这种类型的战吼,直接转换为施法
                //这里约定:战吼是无需抉择的
                game.Interrupt.ActionName = "RUNBATTLECRY";
                game.Interrupt.Step       = 1;
                if (game.Interrupt.SessionDic.ContainsKey("BATTLECRYPOSITION") && game.Interrupt.SessionDic["BATTLECRYPOSITION"] == "-1")
                {
                    //放弃战吼,例如没有友方的时候的叫嚣的中士
                    game.Interrupt.Step = 99;
                }
                else
                {
                    UseSpellAction.RunBS(game, minion.战吼效果);
                }
            }
            game.Interrupt.Step       = 99;
            game.Interrupt.ActionName = CardUtility.strOK;
        }
Пример #19
0
        /// <summary>
        /// 开始一个动作
        /// </summary>
        /// <param name="game"></param>
        /// <param name="CardSn"></param>
        /// <param name="ConvertPosDirect">亡语的时候,需要倒置方向</param>
        /// <returns></returns>
        public static List <String> StartAction(GameManager game, String CardSn, Boolean ConvertPosDirect = false)
        {
            Card.CardBasicInfo card          = Card.CardUtility.GetCardInfoBySN(CardSn);
            List <String>      ActionCodeLst = new List <string>();

            switch (card.CardType)
            {
            case CardBasicInfo.CardTypeEnum.法术:
                ActionCodeLst.Add(UseAbility(CardSn));
                //初始化 Buff效果等等
                Card.AbilityCard ablity = (Card.AbilityCard)CardUtility.GetCardInfoBySN(CardSn);
                //连击效果的法术修改
                if (game.MySelf.RoleInfo.IsCombit && (!String.IsNullOrEmpty(card.连击效果)))
                {
                    ablity = (Card.AbilityCard)CardUtility.GetCardInfoBySN(card.连击效果);
                }
                ablity.CardAbility.Init();
                var ResultArg = game.UseAbility(ablity, ConvertPosDirect);
                if (ResultArg.Count != 0)
                {
                    ActionCodeLst.AddRange(ResultArg);
                    //英雄技能等的时候,不算[本方施法]
                    if (CardSn.Substring(1, 1) == "0")
                    {
                        ActionCodeLst.AddRange(game.MySelf.RoleInfo.BattleField.触发事件(new Card.CardUtility.全局事件()
                        {
                            事件类型 = CardUtility.事件类型列表.施法
                        }, game));
                    }
                }
                else
                {
                    ActionCodeLst.Clear();
                }
                break;

            case CardBasicInfo.CardTypeEnum.随从:
                int MinionPos = 1;
                if (game.MySelf.RoleInfo.BattleField.MinionCount != 0)
                {
                    MinionPos = GetPutPos(game);
                }
                if (MinionPos != -1)
                {
                    ActionCodeLst.Add(UseMinion(CardSn, MinionPos));
                    var minion = (Card.MinionCard)card;
                    //初始化
                    minion.Init();
                    //必须在放入之前做得原因是,被放入的随从不能被触发这个事件
                    ActionCodeLst.AddRange(game.MySelf.RoleInfo.BattleField.触发事件(
                                               new Card.CardUtility.全局事件()
                    {
                        事件类型 = CardUtility.事件类型列表.召唤, 附加信息 = minion.种族.ToString()
                    }, game));
                    switch (minion.战吼类型)
                    {
                    case MinionCard.战吼类型列表.默认:
                        game.MySelf.RoleInfo.BattleField.PutToBattle(MinionPos, minion);
                        ActionCodeLst.AddRange(minion.发动战吼(game));
                        break;

                    case MinionCard.战吼类型列表.抢先:
                        //战吼中,其他 系列的法术效果
                        foreach (var result in minion.发动战吼(game))
                        {
                            var resultArray = result.Split(CardUtility.strSplitMark.ToCharArray());
                            if (int.Parse(resultArray[2]) < MinionPos)
                            {
                                ActionCodeLst.Add(result);
                            }
                            else
                            {
                                ActionCodeLst.Add(resultArray[0] + CardUtility.strSplitMark + resultArray[1] + CardUtility.strSplitMark +
                                                  (int.Parse(resultArray[2]) + 1).ToString() + CardUtility.strSplitMark + resultArray[3]);
                            }
                        }
                        game.MySelf.RoleInfo.BattleField.PutToBattle(MinionPos, minion);
                        break;

                    case MinionCard.战吼类型列表.相邻:
                    case MinionCard.战吼类型列表.自身:
                        game.MySelf.RoleInfo.BattleField.PutToBattle(MinionPos, minion);
                        game.MySelf.RoleInfo.BattleField.发动战吼(MinionPos);
                        break;

                    default:
                        break;
                    }
                    game.MySelf.RoleInfo.BattleField.ResetBuff();
                }
                else
                {
                    ActionCodeLst.Clear();
                }
                break;

            case CardBasicInfo.CardTypeEnum.武器:
                ActionCodeLst.Add(UseWeapon(CardSn));
                game.MySelf.RoleInfo.Weapon = (Card.WeaponCard)card;
                break;

            case CardBasicInfo.CardTypeEnum.奥秘:
                ActionCodeLst.Add(UseSecret(CardSn));
                game.MySelf.奥秘列表.Add((Card.SecretCard)card);
                game.MySelf.RoleInfo.SecretCount = game.MySelf.奥秘列表.Count;
                break;

            default:
                break;
            }
            //连击启动(法术的时候是修改法术内容)
            if (card.CardType != CardBasicInfo.CardTypeEnum.法术 && game.MySelf.RoleInfo.IsCombit)
            {
                if (!String.IsNullOrEmpty(card.连击效果))
                {
                    //初始化 Buff效果等等
                    Card.AbilityCard ablity = (Card.AbilityCard)CardUtility.GetCardInfoBySN(card.连击效果);
                    ablity.CardAbility.Init();
                    var ResultArg = game.UseAbility(ablity, ConvertPosDirect);
                    if (ResultArg.Count != 0)
                    {
                        ActionCodeLst.AddRange(ResultArg);
                        //英雄技能等的时候,不算[本方施法]
                        if (CardSn.Substring(1, 1) == "0")
                        {
                            ActionCodeLst.AddRange(game.MySelf.RoleInfo.BattleField.触发事件(new Card.CardUtility.全局事件()
                            {
                                事件类型 = CardUtility.事件类型列表.施法
                            }, game));
                        }
                    }
                }
            }
            if (ActionCodeLst.Count != 0)
            {
                game.MySelf.RoleInfo.IsCombit = true;
            }
            return(ActionCodeLst);
        }
Пример #20
0
        /// <summary>
        /// 开始一个动作
        /// </summary>
        /// <param name="game"></param>
        /// <param name="CardSn"></param>
        /// <param name="ConvertPosDirect">亡语的时候,需要倒置方向</param>
        /// <returns></returns>
        public static List <String> StartAction(GameManager game, String CardSn, Boolean ConvertPosDirect = false)
        {
            Card.CardBasicInfo card          = Card.CardUtility.GetCardInfoBySN(CardSn);
            List <String>      ActionCodeLst = new List <string>();

            switch (card.CardType)
            {
            case CardBasicInfo.CardTypeEnum.法术:
                ActionCodeLst.Add(UseAbility(CardSn));
                //初始化 Buff效果等等
                Card.AbilityCard ablity = (Card.AbilityCard)CardUtility.GetCardInfoBySN(CardSn);
                ablity.CardAbility.Init();
                var ResultArg = game.UseAbility(ablity, ConvertPosDirect);
                if (ResultArg.Count != 0)
                {
                    ActionCodeLst.AddRange(ResultArg);
                    //英雄技能的时候,不算[本方施法] A900001 幸运币
                    if (CardSn.Substring(1, 1) != "2")
                    {
                        ActionCodeLst.AddRange(game.MySelf.RoleInfo.BattleField.触发事件(MinionCard.事件类型列表.本方施法, game));
                    }
                }
                else
                {
                    ActionCodeLst.Clear();
                }
                break;

            case CardBasicInfo.CardTypeEnum.随从:
                int MinionPos = GetPutPos(game);
                if (MinionPos != -1)
                {
                    ActionCodeLst.Add(UseMinion(CardSn, MinionPos));
                    var minion = (Card.MinionCard)card;
                    //初始化
                    minion.Init();
                    switch (minion.战吼类型)
                    {
                    case MinionCard.战吼类型列表.默认:
                        game.MySelf.RoleInfo.BattleField.PutToBattle(MinionPos, minion);
                        ActionCodeLst.AddRange(minion.发动战吼(game));
                        break;

                    case MinionCard.战吼类型列表.抢先:
                        //战吼中,其他 系列的法术效果
                        foreach (var result in minion.发动战吼(game))
                        {
                            var resultArray = result.Split(CardUtility.strSplitMark.ToCharArray());
                            if (int.Parse(resultArray[2]) < MinionPos)
                            {
                                ActionCodeLst.Add(result);
                            }
                            else
                            {
                                ActionCodeLst.Add(resultArray[0] + CardUtility.strSplitMark + resultArray[1] + CardUtility.strSplitMark +
                                                  (int.Parse(resultArray[2]) + 1).ToString() + CardUtility.strSplitMark + resultArray[3]);
                            }
                        }
                        game.MySelf.RoleInfo.BattleField.PutToBattle(MinionPos, minion);
                        break;

                    case MinionCard.战吼类型列表.相邻:
                    case MinionCard.战吼类型列表.自身:
                        game.MySelf.RoleInfo.BattleField.PutToBattle(MinionPos, minion);
                        game.MySelf.RoleInfo.BattleField.发动战吼(MinionPos);
                        break;

                    default:
                        break;
                    }
                    game.MySelf.RoleInfo.BattleField.ResetBuff();
                }
                else
                {
                    ActionCodeLst.Clear();
                }
                break;

            case CardBasicInfo.CardTypeEnum.武器:
                ActionCodeLst.Add(UseWeapon(CardSn));
                game.MySelf.RoleInfo.Weapon = (Card.WeaponCard)card;
                break;

            case CardBasicInfo.CardTypeEnum.奥秘:
                ActionCodeLst.Add(UseSecret(CardSn));
                game.MySelf.奥秘列表.Add((Card.SecretCard)card);
                break;

            default:
                break;
            }
            return(ActionCodeLst);
        }
Пример #21
0
        /// <summary>
        /// 运行效果
        /// </summary>
        /// <param name="singleEffect"></param>
        /// <param name="game"></param>
        /// <param name="Seed"></param>
        /// <returns></returns>
        public List <string> RunEffect(ActionStatus game, CardUtility.目标选择方向枚举 Direct)
        {
            List <string> Result    = new List <string>();
            var           MinionLst = 指定卡牌编号数组.Split(CardUtility.strSplitMark.ToCharArray());
            Random        random    = new Random(DateTime.Now.Millisecond);
            var           CardSN    = MinionLst[random.Next(0, MinionLst.Length)];
            var           Minion    = (MinionCard)CardUtility.GetCardInfoBySN(CardSN);

            switch (Direct)
            {
            case CardUtility.目标选择方向枚举.本方:
                if (game.AllRole.MyPublicInfo.BattleField.MinionCount < SystemManager.MaxMinionCount)
                {
                    game.AllRole.MyPublicInfo.BattleField.AppendToBattle(Minion);
                    //SUMMON#YOU#M000001#POS
                    Result.Add(Server.ActionCode.strSummon + CardUtility.strSplitMark + CardUtility.strMe +
                               CardUtility.strSplitMark + CardSN + CardUtility.strSplitMark + game.AllRole.MyPublicInfo.BattleField.MinionCount);
                    game.battleEvenetHandler.事件池.Add(new EventCard.全局事件()
                    {
                        触发事件类型 = EventCard.事件类型枚举.召唤,
                        触发位置   = Minion.战场位置
                    });
                }
                break;

            case CardUtility.目标选择方向枚举.对方:
                if (game.AllRole.YourPublicInfo.BattleField.MinionCount < SystemManager.MaxMinionCount)
                {
                    game.AllRole.YourPublicInfo.BattleField.AppendToBattle(Minion);
                    Result.Add(Server.ActionCode.strSummon + CardUtility.strSplitMark + CardUtility.strYou +
                               CardUtility.strSplitMark + CardSN + CardUtility.strSplitMark + game.AllRole.YourPublicInfo.BattleField.MinionCount);
                    game.battleEvenetHandler.事件池.Add(new EventCard.全局事件()
                    {
                        触发事件类型 = EventCard.事件类型枚举.召唤,
                        触发位置   = Minion.战场位置
                    });
                }
                break;

            case CardUtility.目标选择方向枚举.双方:
                if (game.AllRole.MyPublicInfo.BattleField.MinionCount < SystemManager.MaxMinionCount)
                {
                    game.AllRole.MyPublicInfo.BattleField.AppendToBattle(Minion);
                    //SUMMON#YOU#M000001#POS
                    Result.Add(Server.ActionCode.strSummon + CardUtility.strSplitMark + CardUtility.strMe +
                               CardUtility.strSplitMark + CardSN + CardUtility.strSplitMark + game.AllRole.MyPublicInfo.BattleField.MinionCount);
                    game.battleEvenetHandler.事件池.Add(new EventCard.全局事件()
                    {
                        触发事件类型 = EventCard.事件类型枚举.召唤,
                        触发位置   = Minion.战场位置
                    });
                }
                if (game.AllRole.MyPublicInfo.BattleField.MinionCount < SystemManager.MaxMinionCount)
                {
                    game.AllRole.MyPublicInfo.BattleField.AppendToBattle(Minion);
                    Result.Add(Server.ActionCode.strSummon + CardUtility.strSplitMark + CardUtility.strYou +
                               CardUtility.strSplitMark + CardSN + CardUtility.strSplitMark + game.AllRole.MyPublicInfo.BattleField.MinionCount);
                    game.battleEvenetHandler.事件池.Add(new EventCard.全局事件()
                    {
                        触发事件类型 = EventCard.事件类型枚举.召唤,
                        触发位置   = Minion.战场位置
                    });
                }
                break;
            }
            return(Result);
        }
Пример #22
0
        /// <summary>
        /// 卡牌入战场
        /// </summary>
        /// <param name="Position"></param>
        /// <param name="CardSn"></param>
        public void PutToBattle(int Position, string CardSn)
        {
            CardBasicInfo card = CardUtility.GetCardInfoBySN(CardSn);

            PutToBattle(Position, (MinionCard)card);
        }
Пример #23
0
        /// <summary>
        /// 开始一个动作
        /// </summary>
        /// <param name="game"></param>
        /// <param name="CardSn"></param>
        /// <param name="ConvertPosDirect">亡语的时候,需要倒置方向</param>
        /// <returns></returns>
        public static List <String> StartAction(GameManager game, String CardSn, Boolean ConvertPosDirect = false)
        {
            //清除事件池,注意,事件将在动作结束后整体结算
            game.事件池.Clear();
            Card.CardBasicInfo card          = Card.CardUtility.GetCardInfoBySN(CardSn);
            List <String>      ActionCodeLst = new List <string>();

            switch (card.CardType)
            {
            case CardBasicInfo.CardTypeEnum.法术:
                ActionCodeLst.Add(ActionCode.strAbility + CardUtility.strSplitMark + CardSn);
                //初始化 Buff效果等等
                Card.AbilityCard ablity = (Card.AbilityCard)CardUtility.GetCardInfoBySN(CardSn);
                //连击效果的法术修改
                if (game.MyInfo.连击状态 && (!String.IsNullOrEmpty(card.连击效果)))
                {
                    ablity = (Card.AbilityCard)CardUtility.GetCardInfoBySN(card.连击效果);
                }
                ablity.CardAbility.Init();
                var ResultArg = game.UseAbility(ablity, ConvertPosDirect);
                if (ResultArg.Count != 0)
                {
                    ActionCodeLst.AddRange(ResultArg);
                    //英雄技能等的时候,不算[本方施法]
                    if (CardSn.Substring(1, 1) == Card.AbilityCard.原生法术)
                    {
                        game.事件池.Add(new Card.CardUtility.全局事件()
                        {
                            事件类型 = CardUtility.事件类型列表.施法,
                            触发方向 = CardUtility.TargetSelectDirectEnum.本方,
                            触发位置 = Card.Client.BattleFieldInfo.HeroPos
                        });
                    }
                }
                else
                {
                    ActionCodeLst.Clear();
                }
                break;

            case CardBasicInfo.CardTypeEnum.随从:
                int MinionPos = 1;
                if (game.MyInfo.BattleField.MinionCount != 0)
                {
                    MinionPos = GetPutPos(game);
                }
                if (MinionPos != -1)
                {
                    ActionCodeLst.Add(ActionCode.strMinion + CardUtility.strSplitMark + CardSn + CardUtility.strSplitMark + MinionPos.ToString("D1"));
                    var minion = (Card.MinionCard)card;
                    //初始化
                    minion.Init();
                    //必须在放入之前做得原因是,被放入的随从不能被触发这个事件
                    game.事件池.Add(new Card.CardUtility.全局事件()
                    {
                        事件类型 = CardUtility.事件类型列表.召唤,
                        附加信息 = minion.种族.ToString(),
                        触发位置 = MinionPos
                    });
                    switch (minion.战吼类型)
                    {
                    case MinionCard.战吼类型列表.默认:
                        game.MyInfo.BattleField.PutToBattle(MinionPos, minion);
                        ActionCodeLst.AddRange(minion.发动战吼(game));
                        break;

                    case MinionCard.战吼类型列表.抢先:
                        //战吼中,其他 系列的法术效果
                        foreach (var result in minion.发动战吼(game))
                        {
                            var resultArray = result.Split(CardUtility.strSplitMark.ToCharArray());
                            if (int.Parse(resultArray[2]) < MinionPos)
                            {
                                ActionCodeLst.Add(result);
                            }
                            else
                            {
                                ActionCodeLst.Add(resultArray[0] + CardUtility.strSplitMark + resultArray[1] + CardUtility.strSplitMark +
                                                  (int.Parse(resultArray[2]) + 1).ToString() + CardUtility.strSplitMark + resultArray[3]);
                            }
                        }
                        game.MyInfo.BattleField.PutToBattle(MinionPos, minion);
                        break;

                    case MinionCard.战吼类型列表.相邻:
                    case MinionCard.战吼类型列表.自身:
                        game.MyInfo.BattleField.PutToBattle(MinionPos, minion);
                        game.MyInfo.BattleField.发动战吼(MinionPos);
                        break;

                    default:
                        break;
                    }
                    game.MyInfo.BattleField.ResetBuff();
                }
                else
                {
                    ActionCodeLst.Clear();
                }
                break;

            case CardBasicInfo.CardTypeEnum.武器:
                ActionCodeLst.Add(ActionCode.strWeapon + CardUtility.strSplitMark + CardSn);
                game.MyInfo.Weapon = (Card.WeaponCard)card;
                break;

            case CardBasicInfo.CardTypeEnum.奥秘:
                ActionCodeLst.Add(ActionCode.strSecret + CardUtility.strSplitMark + CardSn);
                game.MySelfInfo.奥秘列表.Add((Card.SecretCard)card);
                game.MyInfo.SecretCount = game.MySelfInfo.奥秘列表.Count;
                break;

            default:
                break;
            }
            //随从卡牌的连击效果启动
            if (card.CardType != CardBasicInfo.CardTypeEnum.法术 && game.MyInfo.连击状态)
            {
                if (!String.IsNullOrEmpty(card.连击效果))
                {
                    //初始化 Buff效果等等
                    Card.AbilityCard ablity = (Card.AbilityCard)CardUtility.GetCardInfoBySN(card.连击效果);
                    ablity.CardAbility.Init();
                    var ResultArg = game.UseAbility(ablity, ConvertPosDirect);
                    if (ResultArg.Count != 0)
                    {
                        ActionCodeLst.AddRange(ResultArg);
                        //英雄技能等的时候,不算[本方施法]
                        if (CardSn.Substring(1, 1) == Card.AbilityCard.原生法术)
                        {
                            game.事件池.Add(new Card.CardUtility.全局事件()
                            {
                                事件类型 = CardUtility.事件类型列表.施法,
                                触发方向 = CardUtility.TargetSelectDirectEnum.本方,
                                触发位置 = Card.Client.BattleFieldInfo.HeroPos
                            });
                        }
                    }
                }
            }
            if (ActionCodeLst.Count != 0)
            {
                game.MyInfo.连击状态 = true;
                ActionCodeLst.AddRange(game.事件处理());
            }
            return(ActionCodeLst);
        }