/// <summary>
        /// 攻击
        /// </summary>
        /// <param name="MyPos"></param>
        private void Fight(int MyPos)
        {
            GameManager.MyClientManager.CurrentActiveCard = GameManager.MyClientManager.actionStatus.AllRole.MyPublicInfo.BattleField.BattleMinions[MyPos - 1];
            var           YourPos   = SelectPanel(SelectUtility.GetFightSelectOpt());
            List <string> actionlst = RunAction.Fight(GameManager.MyClientManager.actionStatus, MyPos, YourPos.位置, true);

            actionlst.AddRange(SecretCard.奥秘计算(actionlst, GameManager.MyClientManager.actionStatus, GameManager.MyClientManager.GameId));
            GameManager.MyClientManager.actionStatus.AllRole.MyPrivateInfo.ResetHandCardCost(GameManager.MyClientManager.actionStatus);
            if (SystemManager.游戏类型 != SystemManager.GameType.单机版)
            {
                ClientRequest.WriteAction(GameManager.MyClientManager.GameId.ToString(GameServer.GameIdFormat), actionlst);
            }
            DisplayMyInfo();
        }
        /// <summary>
        /// 使用手牌
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnUseHandCard_Click(object sender, EventArgs e)
        {
            CardBasicInfo UseHandCard;

            if ((sender.GetType()) == typeof(Button))
            {
                UseHandCard = (CardBasicInfo)((ctlHandCard)(((Button)sender).Parent)).Tag;
            }
            else
            {
                UseHandCard = (CardBasicInfo)(((ctlHeroAbility)sender).Tag);
            }
            GameManager.MyClientManager.CurrentActiveCard = UseHandCard;
            var msg = CardBasicInfo.CheckCondition(UseHandCard, GameManager.MyClientManager.actionStatus.AllRole.MyPublicInfo);

            if (!string.IsNullOrEmpty(msg))
            {
                MessageBox.Show(msg);
                return;
            }
            var actionlst = RunAction.StartAction(GameManager.MyClientManager.actionStatus, UseHandCard.序列号);

            if (actionlst.Count != 0)
            {
                if ((sender.GetType()) == typeof(Button))
                {
                    actionlst.Insert(0, ActionCode.strCard + CardUtility.strSplitMark + CardUtility.strMe);
                    GameManager.MyClientManager.actionStatus.AllRole.MyPublicInfo.crystal.CurrentRemainPoint -= UseHandCard.使用成本;
                    GameManager.MyClientManager.actionStatus.AllRole.MyPublicInfo.HandCardCount--;
                    GameManager.MyClientManager.actionStatus.AllRole.MyPrivateInfo.RemoveUsedCard(UseHandCard.序列号);
                }
                else
                {
                    GameManager.MyClientManager.actionStatus.AllRole.MyPublicInfo.crystal.CurrentRemainPoint -= UseHandCard.使用成本;
                    GameManager.MyClientManager.actionStatus.AllRole.MyPublicInfo.Hero.IsUsedHeroAbility      = true;
                }
                actionlst.Add(ActionCode.strCrystal + CardUtility.strSplitMark + CardUtility.strMe + CardUtility.strSplitMark +
                              GameManager.MyClientManager.actionStatus.AllRole.MyPublicInfo.crystal.CurrentRemainPoint + CardUtility.strSplitMark + GameManager.MyClientManager.actionStatus.AllRole.MyPublicInfo.crystal.CurrentFullPoint);
                //奥秘计算
                actionlst.AddRange(SecretCard.奥秘计算(actionlst, GameManager.MyClientManager.actionStatus, GameManager.MyClientManager.GameId));
                GameManager.MyClientManager.actionStatus.AllRole.MyPrivateInfo.ResetHandCardCost(GameManager.MyClientManager.actionStatus);
                if (SystemManager.游戏类型 != SystemManager.GameType.单机版)
                {
                    ClientRequest.WriteAction(GameManager.MyClientManager.GameId.ToString(GameServer.GameIdFormat), actionlst);
                }
                DisplayMyInfo();
            }
        }
        /// <summary>
        /// 是否HIT对方奥秘
        /// </summary>
        /// <param name="IsFirst">是否为先手</param>
        /// <returns></returns>
        public string SecretHitCheck(String Action, bool IsFirst)
        {
            //奥秘判断 注意:这个动作并不改变FirstSecret和SecondSecret
            //1.例如,发生战斗的时候,如果两个随从都死了,
            //同时两边都有随从死亡的奥秘,则整个动作序列可能触发两边的奥秘
            //<本方奥秘在客户端判断>注意方向
            //2.服务器端只做判断,并且返回命中奥秘的列表,不做任何其他操作!
            List <String> HITCardList = new List <string>();

            foreach (var actionDetail in Action.Split(Card.CardUtility.strSplitArrayMark.ToCharArray()))
            {
                //检查Second
                if (IsFirst && SecondSecret.Count != 0)
                {
                    for (int i = 0; i < SecondSecret.Count; i++)
                    {
                        if (SecretCard.IsSecretHit(SecondSecret[i], actionDetail, false))
                        {
                            HITCardList.Add(SecondSecret[i] + Card.CardUtility.strSplitDiffMark + actionDetail);
                        }
                    }
                }
                //检查First
                if ((!IsFirst) && FirstSecret.Count != 0)
                {
                    for (int i = 0; i < FirstSecret.Count; i++)
                    {
                        if (SecretCard.IsSecretHit(FirstSecret[i], actionDetail, false))
                        {
                            HITCardList.Add(FirstSecret[i] + Card.CardUtility.strSplitDiffMark + actionDetail);
                        }
                    }
                }
            }
            String strRtn = String.Empty;

            if (HITCardList.Count != 0)
            {
                foreach (var card in HITCardList)
                {
                    strRtn += card + Card.CardUtility.strSplitArrayMark;
                }
                strRtn = strRtn.TrimEnd(Card.CardUtility.strSplitArrayMark.ToCharArray());
            }
            return(strRtn);
        }
Beispiel #4
0
        /// <summary>
        /// 奥秘
        /// </summary>
        /// <param name="target"></param>
        /// <param name="workbook"></param>
        private void Secret(dynamic workbook)
        {
            if (Directory.Exists(ExportFolderPicker.SelectedPathOrFileName + "\\Secret\\"))
            {
                Directory.Delete(ExportFolderPicker.SelectedPathOrFileName + "\\Secret\\", true);
            }
            Directory.CreateDirectory(ExportFolderPicker.SelectedPathOrFileName + "\\Secret\\");
            //奥秘的导入
            dynamic worksheet = workbook.Sheets(4);
            int     rowCount  = 4;

            while (!string.IsNullOrEmpty(worksheet.Cells(rowCount, 2).Text))
            {
                SecretCard Secret = new SecretCard();
                Secret.序列号          = worksheet.Cells(rowCount, 2).Text;
                Secret.称            = worksheet.Cells(rowCount, 3).Text;
                Secret.描述           = worksheet.Cells(rowCount, 4).Text;
                Secret.职业           = CSharpUtility.GetEnum <CardUtility.职业枚举>(worksheet.Cells(rowCount, 5).Text, CardUtility.职业枚举.中立);
                Secret.使用成本         = CSharpUtility.GetInt(worksheet.Cells(rowCount, 7).Text);
                Secret.稀有程度         = CSharpUtility.GetEnum <CardBasicInfo.稀有程度枚举>(worksheet.Cells(rowCount, 12).Text, CardBasicInfo.稀有程度枚举.白色);
                Secret.是否启用         = !string.IsNullOrEmpty(worksheet.Cells(rowCount, 13).Text);
                Secret.Condition    = CSharpUtility.GetEnum <SecretCard.SecretCondition>(worksheet.Cells(rowCount, 14).Text, SecretCard.SecretCondition.对方召唤随从);
                Secret.AdditionInfo = worksheet.Cells(rowCount, 15).Text;
                switch (exportType)
                {
                case SystemManager.ExportType.XML:
                    XmlSerializer xml         = new XmlSerializer(typeof(SecretCard));
                    string        XmlFilename = ExportFolderPicker.SelectedPathOrFileName + "\\Secret\\" + Secret.序列号 + ".xml";
                    xml.Serialize(new StreamWriter(XmlFilename), Secret);
                    break;

                case SystemManager.ExportType.JSON:
                    string       JSonFilename = ExportFolderPicker.SelectedPathOrFileName + "\\Secret\\" + Secret.序列号 + ".json";
                    StreamWriter json         = new StreamWriter(JSonFilename);
                    json.Write(Secret.ToJson());
                    json.Close();
                    break;

                default:
                    break;
                }
                rowCount++;
            }
        }
Beispiel #5
0
 /// <summary>
 /// 追加指令
 /// </summary>
 /// <param name="Action"></param>
 public void WriteAction(String Action)
 {
     foreach (var actionDetail in Action.Split(Engine.Utility.CardUtility.strSplitArrayMark.ToCharArray()))
     {
         if (SecretCard.IsSecretAction(actionDetail))
         {
             //TODO:
         }
         else
         {
             ActionInfo.Add(actionDetail);
         }
     }
     //如果是回合结束的指令的时候,翻转是否是先手回合的标志
     if (Action == ActionCode.strEndTurn)
     {
         半局 = !半局;
     }
 }
Beispiel #6
0
        /// <summary>
        /// 从XML文件读取
        /// </summary>
        public static void GetCardInfoFromXml()
        {
            CardCollections.Clear();
            switch (SystemManager.外部资料格式)
            {
            case SystemManager.ExportType.XML:
                //法术
                foreach (var AbilityXml in Directory.GetFiles(CardXmlFolder + "\\Ability\\"))
                {
                    XmlSerializer xml     = new XmlSerializer(typeof(SpellCard));
                    SpellCard     ability = (SpellCard)xml.Deserialize(new StreamReader(AbilityXml));
                    CardCollections.Add(ability.序列号, ability);
                }
                //随从
                foreach (var MinionXml in Directory.GetFiles(CardXmlFolder + "\\Minion\\"))
                {
                    XmlSerializer xml   = new XmlSerializer(typeof(MinionCard));
                    MinionCard    Minio = (MinionCard)xml.Deserialize(new StreamReader(MinionXml));
                    CardCollections.Add(Minio.序列号, Minio);
                }
                //武器
                foreach (var WeaponXml in Directory.GetFiles(CardXmlFolder + "\\Weapon\\"))
                {
                    XmlSerializer xml    = new XmlSerializer(typeof(WeaponCard));
                    WeaponCard    Weapon = (WeaponCard)xml.Deserialize(new StreamReader(WeaponXml));
                    CardCollections.Add(Weapon.序列号, Weapon);
                }
                //奥秘
                foreach (var SecretXml in Directory.GetFiles(CardXmlFolder + "\\Secret\\"))
                {
                    XmlSerializer xml    = new XmlSerializer(typeof(SecretCard));
                    SecretCard    Secret = (SecretCard)xml.Deserialize(new StreamReader(SecretXml));
                    CardCollections.Add(Secret.序列号, Secret);
                }
                break;

            case SystemManager.ExportType.JSON:
                //法术
                foreach (var AbilityXml in Directory.GetFiles(CardXmlFolder + "\\Ability\\"))
                {
                    SpellCard ability = (SpellCard)JsonSerializer.Create().Deserialize(new StreamReader(AbilityXml), typeof(SpellCard));
                    CardCollections.Add(ability.序列号, ability);
                }
                //随从
                foreach (var MinionXml in Directory.GetFiles(CardXmlFolder + "\\Minion\\"))
                {
                    MinionCard Minio = (MinionCard)JsonSerializer.Create().Deserialize(new StreamReader(MinionXml), typeof(MinionCard));
                    CardCollections.Add(Minio.序列号, Minio);
                }
                //武器
                foreach (var WeaponXml in Directory.GetFiles(CardXmlFolder + "\\Weapon\\"))
                {
                    WeaponCard Weapon = (WeaponCard)JsonSerializer.Create().Deserialize(new StreamReader(WeaponXml), typeof(WeaponCard));
                    CardCollections.Add(Weapon.序列号, Weapon);
                }
                //奥秘
                foreach (var SecretXml in Directory.GetFiles(CardXmlFolder + "\\Secret\\"))
                {
                    SecretCard Secret = (SecretCard)JsonSerializer.Create().Deserialize(new StreamReader(SecretXml), typeof(SecretCard));
                    CardCollections.Add(Secret.序列号, Secret);
                }
                break;

            default:
                break;
            }
        }
Beispiel #7
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;
            }
        }
        /// <summary>
        /// 处理对方的动作
        /// </summary>
        /// <param name="item"></param>
        /// <param name="game"></param>
        public static void Process(string item, GameManager game)
        {
            var actField = item.Split(CardUtility.strSplitMark.ToCharArray());

            switch (Card.Server.ActionCode.GetActionType(item))
            {
            case ActionCode.ActionType.UseWeapon:
                game.YourInfo.Weapon = (Card.WeaponCard)Card.CardUtility.GetCardInfoBySN(actField[1]);
                break;

            case ActionCode.ActionType.UseSecret:
                game.YourInfo.SecretCount++;;
                break;

            case ActionCode.ActionType.HitSecret:
                if (actField[1] == CardUtility.strYou)
                {
                    //
                    Card.SecretCard Hit = new SecretCard();
                    foreach (var secret in game.MySelf.奥秘列表)
                    {
                        if (secret.SN == actField[2])
                        {
                            Hit = secret;
                            break;
                        }
                    }
                    game.MySelf.奥秘列表.Remove(Hit);
                }
                else
                {
                    game.YourInfo.SecretCount--;
                }
                break;

            case ActionCode.ActionType.Point:
                if (actField[1] == CardUtility.strYou)
                {
                    Card.Effect.PointEffect.RunPointEffect(game.MySelf.RoleInfo.BattleField.BattleMinions[int.Parse(actField[2]) - 1], actField[3]);
                }
                else
                {
                    Card.Effect.PointEffect.RunPointEffect(game.YourInfo.BattleField.BattleMinions[int.Parse(actField[2]) - 1], actField[3]);
                }
                break;

            case ActionCode.ActionType.UseMinion:
                int Pos    = int.Parse(actField[2]);
                var minion = (Card.MinionCard)Card.CardUtility.GetCardInfoBySN(actField[1]);
                minion.Init();
                game.YourInfo.BattleField.PutToBattle(Pos, minion);
                game.YourInfo.BattleField.ResetBuff();
                break;

            case ActionCode.ActionType.Card:
                if (actField[1] == CardUtility.strYou)
                {
                    var drawCards = Card.Client.ClientRequest.DrawCard(game.GameId.ToString(GameServer.GameIdFormat), game.IsFirst, 1);
                    game.MySelf.handCards.Add(Card.CardUtility.GetCardInfoBySN(drawCards[0]));
                    game.MySelf.RoleInfo.HandCardCount++;
                    game.MySelf.RoleInfo.RemainCardDeckCount--;
                }
                else
                {
                    game.YourInfo.HandCardCount++;
                    game.YourInfo.RemainCardDeckCount--;
                }
                break;

            case ActionCode.ActionType.Summon:
                //不会出现溢出的问题,溢出在Effect里面处理过了
                //SUMMON#YOU#M000001
                //Me代表对方 YOU代表自己,必须反过来
                if (actField[1] == CardUtility.strYou)
                {
                    game.MySelf.RoleInfo.BattleField.AppendToBattle(actField[2]);
                }
                else
                {
                    game.YourInfo.BattleField.AppendToBattle(actField[2]);
                }
                break;

            case ActionCode.ActionType.UseAbility:
                break;

            case ActionCode.ActionType.Health:
                //HEALTH#ME#1#2
                //Me代表对方 YOU代表自己,必须反过来
                if (actField[1] == CardUtility.strYou)
                {
                    if (actField[2] == Card.Client.BattleFieldInfo.HeroPos.ToString())
                    {
                        game.MySelf.RoleInfo.HealthPoint = int.Parse(actField[3]);
                    }
                    else
                    {
                        //位置从1开始,数组从0开始
                        game.MySelf.RoleInfo.BattleField.BattleMinions[int.Parse(actField[2]) - 1].实际生命值 = int.Parse(actField[3]);
                    }
                }
                else
                {
                    if (actField[2] == Card.Client.BattleFieldInfo.HeroPos.ToString())
                    {
                        game.YourInfo.HealthPoint = int.Parse(actField[3]);
                    }
                    else
                    {
                        //位置从1开始,数组从0开始
                        game.YourInfo.BattleField.BattleMinions[int.Parse(actField[2]) - 1].实际生命值 = int.Parse(actField[3]);
                    }
                }
                break;

            case ActionCode.ActionType.Status:
                //STATUS#ME#1#FREEZE
                //Me代表对方 YOU代表自己,必须反过来
                if (actField[1] == CardUtility.strYou)
                {
                    if (actField[2] == Card.Client.BattleFieldInfo.HeroPos.ToString())
                    {
                        switch (actField[3])
                        {
                        case Card.Effect.StatusEffect.strFreeze:
                            game.MySelf.RoleInfo.冰冻状态 = CardUtility.EffectTurn.效果命中;
                            break;

                        default:
                            break;
                        }
                    }
                    else
                    {
                        //位置从1开始,数组从0开始
                        switch (actField[3])
                        {
                        case Card.Effect.StatusEffect.strFreeze:
                            game.MySelf.RoleInfo.BattleField.BattleMinions[int.Parse(actField[2]) - 1].冰冻状态 = CardUtility.EffectTurn.效果命中;
                            break;

                        default:
                            break;
                        }
                    }
                }
                else
                {
                    if (actField[2] == Card.Client.BattleFieldInfo.HeroPos.ToString())
                    {
                        switch (actField[3])
                        {
                        case Card.Effect.StatusEffect.strFreeze:
                            game.YourInfo.冰冻状态 = CardUtility.EffectTurn.效果命中;
                            break;

                        default:
                            break;
                        }
                    }
                    else
                    {
                        //位置从1开始,数组从0开始
                        switch (actField[3])
                        {
                        case Card.Effect.StatusEffect.strFreeze:
                            game.YourInfo.BattleField.BattleMinions[int.Parse(actField[2]) - 1].冰冻状态 = CardUtility.EffectTurn.效果命中;
                            break;

                        default:
                            break;
                        }
                    }
                }
                break;

            case ActionCode.ActionType.Crystal:
                //Crystal#ME#4#4
                //Me代表对方 YOU代表自己,必须反过来
                if (actField[1] == CardUtility.strMe)
                {
                    game.YourInfo.crystal.CurrentRemainPoint = int.Parse(actField[2]);
                    game.YourInfo.crystal.CurrentFullPoint   = int.Parse(actField[3]);
                }
                else
                {
                    game.MySelf.RoleInfo.crystal.CurrentRemainPoint = int.Parse(actField[2]);
                    game.MySelf.RoleInfo.crystal.CurrentFullPoint   = int.Parse(actField[3]);
                }
                break;

            case ActionCode.ActionType.Transform:
                //TRANSFORM#ME#1#M9000001
                //Me代表对方 YOU代表自己,必须反过来
                if (actField[1] == CardUtility.strYou)
                {
                    game.MySelf.RoleInfo.BattleField.BattleMinions[int.Parse(actField[2]) - 1] = (Card.MinionCard)Card.CardUtility.GetCardInfoBySN(actField[3]);
                }
                else
                {
                    game.MySelf.RoleInfo.BattleField.BattleMinions[int.Parse(actField[2]) - 1] = (Card.MinionCard)Card.CardUtility.GetCardInfoBySN(actField[3]);
                }
                break;

            case ActionCode.ActionType.Attack:
                //ATTACK#ME#POS#AP
                //Me代表对方 YOU代表自己,必须反过来
                int AttackPoint = int.Parse(actField[3]);
                if (actField[1] == CardUtility.strYou)
                {
                    if (actField[2] == Card.Client.BattleFieldInfo.HeroPos.ToString())
                    {
                        game.MySelf.RoleInfo.AfterBeAttack(AttackPoint);
                    }
                    else
                    {
                        //位置从1开始,数组从0开始
                        game.MySelf.RoleInfo.BattleField.BattleMinions[int.Parse(actField[2]) - 1].AfterBeAttack(AttackPoint);
                    }
                }
                else
                {
                    if (actField[2] == Card.Client.BattleFieldInfo.HeroPos.ToString())
                    {
                        game.YourInfo.AfterBeAttack(AttackPoint);
                    }
                    else
                    {
                        //位置从1开始,数组从0开始
                        game.YourInfo.BattleField.BattleMinions[int.Parse(actField[2]) - 1].AfterBeAttack(AttackPoint);
                    }
                }
                break;

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

            case ActionCode.ActionType.UnKnown:
                break;
            }
            //这里不需要发送亡语效果,
            //由法术或者攻击发动放将结果发送给接受方
            game.Settle();
        }
Beispiel #9
0
 /// <summary>
 /// 处理对方的动作
 /// </summary>
 /// <param name="item"></param>
 /// <param name="game"></param>
 public static void Process(string item, GameManager game)
 {
     var actField = item.Split(CardUtility.strSplitMark.ToCharArray());
     switch (Card.Server.ActionCode.GetActionType(item))
     {
         case ActionCode.ActionType.UseWeapon:
             game.YourInfo.Weapon = (Card.WeaponCard)Card.CardUtility.GetCardInfoBySN(actField[1]);
             break;
         case ActionCode.ActionType.UseSecret:
             game.YourInfo.SecretCount++; ;
             break;
         case ActionCode.ActionType.HitSecret:
             if (actField[1] == CardUtility.strYou)
             {
                 //
                 Card.SecretCard Hit = new SecretCard();
                 foreach (var secret in game.MySelf.奥秘列表)
                 {
                     if (secret.SN == actField[2])
                     {
                         Hit = secret;
                         break;
                     }
                 }
                 game.MySelf.奥秘列表.Remove(Hit);
             }
             else
             {
                 game.YourInfo.SecretCount--;
             }
             break;
         case ActionCode.ActionType.Point:
             if (actField[1] == CardUtility.strYou)
             {
                 game.MySelf.RoleInfo.BattleField.BattleMinions[int.Parse(actField[2]) - 1].实际生命值 = int.Parse(actField[3].Substring(0, 1));
                 game.MySelf.RoleInfo.BattleField.BattleMinions[int.Parse(actField[2]) - 1].实际攻击力 = int.Parse(actField[3].Substring(2, 1));
             }
             else
             {
                 game.YourInfo.BattleField.BattleMinions[int.Parse(actField[2]) - 1].实际生命值 = int.Parse(actField[3].Substring(0, 1));
                 game.YourInfo.BattleField.BattleMinions[int.Parse(actField[2]) - 1].实际攻击力 = int.Parse(actField[3].Substring(2, 1));
             }
             break;
         case ActionCode.ActionType.UseMinion:
             int Pos = int.Parse(actField[2]);
             var minion = (Card.MinionCard)Card.CardUtility.GetCardInfoBySN(actField[1]);
             minion.Init();
             game.YourInfo.BattleField.PutToBattle(Pos, minion);
             game.YourInfo.BattleField.ResetBuff();
             break;
         case ActionCode.ActionType.Card:
             if (actField[1] == CardUtility.strYou)
             {
                 var drawCards = Card.Server.ClientUtlity.DrawCard(game.GameId.ToString(GameServer.GameIdFormat), game.IsFirst, 1);
                 game.MySelf.handCards.Add(Card.CardUtility.GetCardInfoBySN(drawCards[0]));
                 game.MySelf.RoleInfo.HandCardCount++;
                 game.MySelf.RoleInfo.RemainCardDeckCount--;
             }
             else
             {
                 game.YourInfo.HandCardCount++;
                 game.YourInfo.RemainCardDeckCount--;
             }
             break;
         case ActionCode.ActionType.Summon:
             //不会出现溢出的问题,溢出在Effect里面处理过了
             //SUMMON#YOU#M000001
             //Me代表对方 YOU代表自己,必须反过来
             if (actField[1] == CardUtility.strYou)
             {
                 game.MySelf.RoleInfo.BattleField.AppendToBattle(actField[2]);
             }
             else
             {
                 game.YourInfo.BattleField.AppendToBattle(actField[2]);
             }
             break;
         case ActionCode.ActionType.UseAbility:
             break;
         case ActionCode.ActionType.Health:
             //HEALTH#ME#1#2
             //Me代表对方 YOU代表自己,必须反过来
             if (actField[1] == CardUtility.strYou)
             {
                 if (actField[2] == "0")
                 {
                     game.MySelf.RoleInfo.HealthPoint = int.Parse(actField[3]);
                 }
                 else
                 {
                     //位置从1开始,数组从0开始
                     game.MySelf.RoleInfo.BattleField.BattleMinions[int.Parse(actField[2]) - 1].实际生命值 = int.Parse(actField[3]);
                 }
             }
             else
             {
                 if (actField[2] == "0")
                 {
                     game.YourInfo.HealthPoint = int.Parse(actField[3]);
                 }
                 else
                 {
                     //位置从1开始,数组从0开始
                     game.YourInfo.BattleField.BattleMinions[int.Parse(actField[2]) - 1].实际生命值 = int.Parse(actField[3]);
                 }
             }
             break;
         case ActionCode.ActionType.Status:
             //STATUS#ME#1#FREEZE
             //Me代表对方 YOU代表自己,必须反过来
             if (actField[1] == CardUtility.strYou)
             {
                 if (actField[2] == "0")
                 {
                     switch (actField[3])
                     {
                         case Card.Effect.StatusEffect.strFreeze:
                             game.MySelf.RoleInfo.冰冻状态 = CardUtility.EffectTurn.效果命中;
                             break;
                         default:
                             break;
                     }
                 }
                 else
                 {
                     //位置从1开始,数组从0开始
                     switch (actField[3])
                     {
                         case Card.Effect.StatusEffect.strFreeze:
                             game.MySelf.RoleInfo.BattleField.BattleMinions[int.Parse(actField[2]) - 1].冰冻状态 = CardUtility.EffectTurn.效果命中;
                             break;
                         default:
                             break;
                     }
                 }
             }
             else
             {
                 if (actField[2] == "0")
                 {
                     switch (actField[3])
                     {
                         case Card.Effect.StatusEffect.strFreeze:
                             game.YourInfo.冰冻状态 = CardUtility.EffectTurn.效果命中;
                             break;
                         default:
                             break;
                     }
                 }
                 else
                 {
                     //位置从1开始,数组从0开始
                     switch (actField[3])
                     {
                         case Card.Effect.StatusEffect.strFreeze:
                             game.YourInfo.BattleField.BattleMinions[int.Parse(actField[2]) - 1].冰冻状态 = CardUtility.EffectTurn.效果命中;
                             break;
                         default:
                             break;
                     }
                 }
             }
             break;
         case ActionCode.ActionType.Crystal:
             //Crystal#ME#4#4
             //Me代表对方 YOU代表自己,必须反过来
             if (actField[1] == CardUtility.strMe)
             {
                 game.YourInfo.crystal.CurrentRemainPoint = int.Parse(actField[2]);
                 game.YourInfo.crystal.CurrentFullPoint = int.Parse(actField[3]);
             }
             else
             {
                 game.MySelf.RoleInfo.crystal.CurrentRemainPoint = int.Parse(actField[2]);
                 game.MySelf.RoleInfo.crystal.CurrentFullPoint = int.Parse(actField[3]);
             }
             break;
         case ActionCode.ActionType.Transform:
             //TRANSFORM#ME#1#M9000001
             //Me代表对方 YOU代表自己,必须反过来
             if (actField[1] == CardUtility.strYou)
             {
                 game.MySelf.RoleInfo.BattleField.BattleMinions[int.Parse(actField[2]) - 1] = (Card.MinionCard)Card.CardUtility.GetCardInfoBySN(actField[3]);
             }
             else
             {
                 game.MySelf.RoleInfo.BattleField.BattleMinions[int.Parse(actField[2]) - 1] = (Card.MinionCard)Card.CardUtility.GetCardInfoBySN(actField[3]);
             }
             break;
         case ActionCode.ActionType.Attack:
             //ATTACK#ME#POS#AP
             //Me代表对方 YOU代表自己,必须反过来
             int AttackPoint = int.Parse(actField[3]);
             if (actField[1] == CardUtility.strYou)
             {
                 if (actField[2] == "0")
                 {
                     game.MySelf.RoleInfo.HealthPoint -= AttackPoint;
                 }
                 else
                 {
                     //位置从1开始,数组从0开始
                     game.MySelf.RoleInfo.BattleField.BattleMinions[int.Parse(actField[2]) - 1].AfterBeAttack(AttackPoint);
                 }
             }
             else
             {
                 if (actField[2] == "0")
                 {
                     game.YourInfo.HealthPoint -= AttackPoint;
                 }
                 else
                 {
                     //位置从1开始,数组从0开始
                     game.YourInfo.BattleField.BattleMinions[int.Parse(actField[2]) - 1].AfterBeAttack(AttackPoint);
                 }
             }
             break;
         case ActionCode.ActionType.Fight:
             //FIGHT#1#2
             game.Fight(int.Parse(actField[2]), int.Parse(actField[1]), true);
             break;
         case ActionCode.ActionType.UnKnown:
             break;
     }
     //这里不需要发送亡语效果,
     //由法术或者攻击发动放将结果发送给接受方
     game.Settle();
 }
Beispiel #10
0
        /// <summary>
        /// 处理对方的动作
        /// </summary>
        /// <param name="item"></param>
        /// <param name="game"></param>
        public static void Process(string item, GameManager game)
        {
            var actField = item.Split(CardUtility.strSplitMark.ToCharArray());

            switch (Card.Server.ActionCode.GetActionType(item))
            {
            case ActionCode.ActionType.Card:
                if (actField[1] == CardUtility.strYou)
                {
                    if (actField.Length == 3)
                    {
                        //如果有第三参数,则获得指定手牌
                        game.MySelfInfo.handCards.Add(Card.CardUtility.GetCardInfoBySN(actField[2]));
                        game.MyInfo.HandCardCount++;
                    }
                    else
                    {
                        var drawCards = Card.Client.ClientRequest.DrawCard(game.GameId.ToString(GameServer.GameIdFormat), game.IsFirst, 1);
                        game.MySelfInfo.handCards.Add(Card.CardUtility.GetCardInfoBySN(drawCards[0]));
                        game.MyInfo.HandCardCount++;
                        game.MyInfo.RemainCardDeckCount--;
                    }
                }
                else
                {
                    game.YourInfo.HandCardCount++;
                    game.YourInfo.RemainCardDeckCount--;
                }
                break;

            case ActionCode.ActionType.UseMinion:
                int Pos    = int.Parse(actField[2]);
                var minion = (Card.MinionCard)Card.CardUtility.GetCardInfoBySN(actField[1]);
                minion.Init();
                game.YourInfo.BattleField.PutToBattle(Pos, minion);
                game.YourInfo.BattleField.ResetBuff();
                break;

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

            case ActionCode.ActionType.UseSecret:
                game.YourInfo.SecretCount++;;
                break;

            case ActionCode.ActionType.UseAbility:
                break;

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

            case ActionCode.ActionType.Point:
            case ActionCode.ActionType.Health:
            case ActionCode.ActionType.Status:
            case ActionCode.ActionType.Transform:
            case ActionCode.ActionType.Attack:
                RunNormalEffect(game, actField);
                break;

            case ActionCode.ActionType.HitSecret:
                if (actField[1] == CardUtility.strYou)
                {
                    Card.SecretCard Hit = new SecretCard();
                    foreach (var secret in game.MySelfInfo.奥秘列表)
                    {
                        if (secret.SN == actField[2])
                        {
                            Hit = secret;
                            break;
                        }
                    }
                    game.MySelfInfo.奥秘列表.Remove(Hit);
                }
                else
                {
                    game.YourInfo.SecretCount--;
                }
                break;

            case ActionCode.ActionType.Control:
                game.YourInfo.BattleField.AppendToBattle(game.MyInfo.BattleField.BattleMinions[int.Parse(actField[1]) - 1].深拷贝());
                game.MyInfo.BattleField.BattleMinions[int.Parse(actField[1]) - 1] = null;
                break;

            case ActionCode.ActionType.Summon:
                //不会出现溢出的问题,溢出在Effect里面处理过了
                //SUMMON#YOU#M000001
                //Me代表对方 YOU代表自己,必须反过来
                if (actField[1] == CardUtility.strYou)
                {
                    game.MyInfo.BattleField.AppendToBattle(actField[2]);
                }
                else
                {
                    game.YourInfo.BattleField.AppendToBattle(actField[2]);
                }
                break;

            case ActionCode.ActionType.Crystal:
                //Crystal#ME#4#4
                //Me代表对方 YOU代表自己,必须反过来
                if (actField[1] == CardUtility.strMe)
                {
                    game.YourInfo.crystal.CurrentRemainPoint = int.Parse(actField[2]);
                    game.YourInfo.crystal.CurrentFullPoint   = int.Parse(actField[3]);
                }
                else
                {
                    game.MyInfo.crystal.CurrentRemainPoint = int.Parse(actField[2]);
                    game.MyInfo.crystal.CurrentFullPoint   = int.Parse(actField[3]);
                }
                break;

            case ActionCode.ActionType.UnKnown:
                break;
            }
            //这里不需要发送亡语效果,
            //由法术或者攻击发动放将结果发送给接受方
            game.Settle();
        }