コード例 #1
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="mDirect"></param>
 /// <param name="mRole"></param>
 /// <param name="mGame"></param>
 /// <param name="嘲讽限制"></param>
 public TargetSelect(CardUtility.SelectOption opt, GameManager mGame, Boolean m嘲讽限制)
 {
     InitializeComponent();
     SelectOption = opt;
     game = mGame;
     嘲讽限制 = m嘲讽限制;
 }
コード例 #2
0
ファイル: RunAction.cs プロジェクト: EricBlack/HearthStone
 /// <summary>
 /// 开始一个动作
 /// </summary>
 /// <param name="game"></param>
 /// <param name="CardSn"></param>
 /// <returns></returns>
 public static List<String> StartAction(GameManager game, String CardSn)
 {
     Card.CardBasicInfo card = Card.CardUtility.GetCardInfoBySN(CardSn);
     List<String> ActionCodeLst = new List<string>();
     switch (CardSn.Substring(0, 1))
     {
         case "A":
             ActionCodeLst.Add(UseAbility(CardSn));
             //初始化 Buff效果等等
             Card.AbilityCard ablity = (Card.AbilityCard)CardUtility.GetCardInfoBySN(CardSn);
             ablity.CardAbility.Init();
             var ResultArg = game.UseAbility(ablity);
             if (ResultArg.Count != 0) ActionCodeLst.AddRange(ResultArg);
             break;
         case "M":
             int MinionPos = GetPutPos(game);
             ActionCodeLst.Add(UseMinion(CardSn, MinionPos));
             var minion = (Card.MinionCard)card;
             //初始化
             minion.Init();
             game.MySelf.RoleInfo.BattleField.PutToBattle(MinionPos, minion);
             game.MySelf.RoleInfo.BattleField.ResetBuff();
             break;
         case "W":
             ActionCodeLst.Add(UseWeapon(CardSn));
             game.MySelf.RoleInfo.Weapon = (Card.WeaponCard)card;
             break;
         default:
             break;
     }
     return ActionCodeLst;
 }
コード例 #3
0
ファイル: TargetSelect.cs プロジェクト: EricBlack/HearthStone
 /// <summary>
 /// 
 /// </summary>
 /// <param name="mDirect"></param>
 /// <param name="mRole"></param>
 /// <param name="mGame"></param>
 /// <param name="嘲讽限制"></param>
 public TargetSelect(CardUtility.TargetSelectDirectEnum mDirect, CardUtility.TargetSelectRoleEnum mRole, GameManager mGame, Boolean m嘲讽限制)
 {
     InitializeComponent();
     direct = mDirect;
     role = mRole;
     game = mGame;
     嘲讽限制 = m嘲讽限制;
 }
コード例 #4
0
ファイル: RunAction.cs プロジェクト: EricBlack/HearthStone
 /// <summary>
 /// 
 /// </summary>
 /// <param name="game"></param>
 /// <param name="MyPos"></param>
 /// <param name="YourPos"></param>
 /// <returns></returns>
 public static List<String> Fight(GameManager game, int MyPos, int YourPos)
 {
     String actionCode = String.Empty;
     //FIGHT#1#2
     actionCode = ActionCode.strFight + CardUtility.strSplitMark + MyPos + CardUtility.strSplitMark + YourPos;
     List<String> ActionCodeLst = new List<string>();
     ActionCodeLst.Add(actionCode);
     ActionCodeLst.AddRange(game.Fight(MyPos, YourPos, false));
     return ActionCodeLst;
 }
コード例 #5
0
ファイル: CardEffect.cs プロジェクト: jasonroker/HearthStone
 public static List<string> RunEffect(EffectDefine singleEffect, GameManager game)
 {
     List<string> Result = new List<string>();
     switch (singleEffect.SelectOpt.EffectTargetSelectDirect)
     {
         case CardUtility.TargetSelectDirectEnum.本方:
             //#CARD#ME#M000001
             var drawCards = Card.Client.ClientRequest.DrawCard(game.GameId.ToString(GameServer.GameIdFormat), game.IsFirst, 1);
             if (drawCards.Count == 1)
             {
                 game.MySelf.handCards.Add(Card.CardUtility.GetCardInfoBySN(drawCards[0]));
                 game.MySelf.RoleInfo.HandCardCount++;
                 game.MySelf.RoleInfo.RemainCardDeckCount--;
                 Result.Add(ActionCode.strCard + CardUtility.strSplitMark + CardUtility.strMe);
             }
             break;
         case CardUtility.TargetSelectDirectEnum.对方:
             if (game.YourInfo.RemainCardDeckCount > 0)
             {
                 game.YourInfo.HandCardCount++;
                 game.YourInfo.RemainCardDeckCount--;
                 Result.Add(ActionCode.strCard + CardUtility.strSplitMark + CardUtility.strYou);
             }
             break;
         case CardUtility.TargetSelectDirectEnum.双方:
             var drawCardsT = Card.Client.ClientRequest.DrawCard(game.GameId.ToString(GameServer.GameIdFormat), game.IsFirst, 1);
             if (drawCardsT.Count == 1)
             {
                 game.MySelf.handCards.Add(Card.CardUtility.GetCardInfoBySN(drawCardsT[0]));
                 game.MySelf.RoleInfo.HandCardCount++;
                 game.MySelf.RoleInfo.RemainCardDeckCount--;
                 Result.Add(ActionCode.strCard + CardUtility.strSplitMark + CardUtility.strMe);
             }
             if (game.YourInfo.RemainCardDeckCount > 0)
             {
                 game.YourInfo.HandCardCount++;
                 game.YourInfo.RemainCardDeckCount--;
                 Result.Add(ActionCode.strCard + CardUtility.strSplitMark + CardUtility.strYou);
             }
             break;
         default:
             break;
     }
     return Result;
 }
コード例 #6
0
        /// <summary>
        /// 简单检查
        /// </summary>
        /// <param name="gameManager"></param>
        /// <returns></returns>
        public bool CheckCondition(Client.GameManager gameManager)
        {
            if (CardAbility.SecondAbilityDefine.AbilityEffectType != EffectDefine.AbilityEffectEnum.未定义)
            {
                return(true);
            }

            switch (CardAbility.FirstAbilityDefine.AbilityEffectType)
            {
            case EffectDefine.AbilityEffectEnum.点数:
            case EffectDefine.AbilityEffectEnum.变形:
                if (CardAbility.FirstAbilityDefine.SelectOpt.EffectTargetSelectDirect == CardUtility.TargetSelectDirectEnum.本方)
                {
                    return(gameManager.MySelf.RoleInfo.BattleField.MinionCount > 0);
                }
                if (CardAbility.FirstAbilityDefine.SelectOpt.EffectTargetSelectDirect == CardUtility.TargetSelectDirectEnum.对方)
                {
                    return(gameManager.YourInfo.BattleField.MinionCount > 0);
                }
                if (CardAbility.FirstAbilityDefine.SelectOpt.EffectTargetSelectDirect == CardUtility.TargetSelectDirectEnum.双方)
                {
                    return((gameManager.YourInfo.BattleField.MinionCount +
                            gameManager.MySelf.RoleInfo.BattleField.MinionCount) > 0);
                }
                break;

            case EffectDefine.AbilityEffectEnum.召唤:
                if (CardAbility.FirstAbilityDefine.SelectOpt.EffectTargetSelectDirect == CardUtility.TargetSelectDirectEnum.本方)
                {
                    return(gameManager.MySelf.RoleInfo.BattleField.MinionCount < Card.Client.BattleFieldInfo.MaxMinionCount);
                }
                if (CardAbility.FirstAbilityDefine.SelectOpt.EffectTargetSelectDirect == CardUtility.TargetSelectDirectEnum.对方)
                {
                    return(gameManager.YourInfo.BattleField.MinionCount < Card.Client.BattleFieldInfo.MaxMinionCount);
                }
                if (CardAbility.FirstAbilityDefine.SelectOpt.EffectTargetSelectDirect == CardUtility.TargetSelectDirectEnum.双方)
                {
                    return((gameManager.YourInfo.BattleField.MinionCount < Card.Client.BattleFieldInfo.MaxMinionCount) &&
                           (gameManager.MySelf.RoleInfo.BattleField.MinionCount < Card.Client.BattleFieldInfo.MaxMinionCount));
                }
                break;
            }
            return(true);
        }
コード例 #7
0
ファイル: RunAction.cs プロジェクト: GavinHwa/HearthStone
 /// <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);
             break;
         case CardBasicInfo.CardTypeEnum.随从:
             int MinionPos = GetPutPos(game);
             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();
             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;
 }
コード例 #8
0
ファイル: MinionCard.cs プロジェクト: GavinHwa/HearthStone
 /// <summary>
 /// 发动战吼
 /// </summary>
 /// <returns></returns>
 public List<String> 发动战吼(GameManager game)
 {
     List<String> ActionCodeLst = new List<string>();
     //战吼效果
     if (战吼效果 != String.Empty)
     {
         var 战吼Result = RunAction.StartAction(game, 战吼效果);
         //第一条是使用了战吼卡牌的消息,如果不除去,对方客户端会认为使用了一张卡牌
         战吼Result.RemoveAt(0);
         ActionCodeLst.AddRange(战吼Result);
     }
     return ActionCodeLst;
 }
コード例 #9
0
ファイル: BattleField.cs プロジェクト: jasonroker/HearthStone
 /// <summary>
 /// 随从进场位置
 /// </summary>
 /// <param name="game"></param>
 /// <returns></returns>
 private int GetPutPos(GameManager game)
 {
     var frm = new PutMinion(game);
     frm.ShowDialog();
     return frm.MinionPos;
 }
コード例 #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());
     //AttackTargetOffset 在使用手牌或者进行卡牌直接攻击的时候,清零!
     switch (Card.Server.ActionCode.GetActionType(item))
     {
         case ActionCode.ActionType.UseMinion:
             AttackTargetOffsetMe = 0;
             AttackTargetOffsetYou = 0;
             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:
             AttackTargetOffsetMe = 0;
             AttackTargetOffsetYou = 0;
             game.YourInfo.Weapon = (Card.WeaponCard)Card.CardUtility.GetCardInfoBySN(actField[1]);
             break;
         case ActionCode.ActionType.UseSecret:
             AttackTargetOffsetMe = 0;
             AttackTargetOffsetYou = 0;
             game.YourInfo.SecretCount++; ;
             break;
         case ActionCode.ActionType.UseAbility:
             AttackTargetOffsetMe = 0;
             AttackTargetOffsetYou = 0;
             break;
         case ActionCode.ActionType.Fight:
             //FIGHT#1#2
             AttackTargetOffsetMe = 0;
             AttackTargetOffsetYou = 0;
             game.Fight(int.Parse(actField[2]), int.Parse(actField[1]), true);
             break;
         case ActionCode.ActionType.HitSecret:
             AttackTargetOffsetMe = 0;
             AttackTargetOffsetYou = 0;
             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.Control:
             game.YourInfo.BattleField.AppendToBattle(game.MySelf.RoleInfo.BattleField.BattleMinions[int.Parse(actField[1]) - 1].深拷贝());
             game.MySelf.RoleInfo.BattleField.BattleMinions[int.Parse(actField[1]) - 1] = null;
             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.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.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 - AttackTargetOffsetMe].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 - AttackTargetOffsetYou].AfterBeAttack(AttackPoint);
                 }
             }
             break;
         case ActionCode.ActionType.UnKnown:
             break;
     }
     //这里不需要发送亡语效果,
     //由法术或者攻击发动放将结果发送给接受方
     var resultLst = game.Settle();
     foreach (var result in resultLst)
     {
         if (result.StartsWith(Card.Server.ActionCode.strDead + Card.CardUtility.strSplitMark + CardUtility.strMe)) AttackTargetOffsetMe++;
         if (result.StartsWith(Card.Server.ActionCode.strDead + Card.CardUtility.strSplitMark + CardUtility.strYou)) AttackTargetOffsetYou++;
     }
 }
コード例 #11
0
ファイル: MinionCard.cs プロジェクト: jasonroker/HearthStone
 /// <summary>
 /// 发动亡语
 /// </summary>
 /// <param name="game"></param>
 /// <returns></returns>
 public List<String> 发动亡语(GameManager game, Boolean IsNeedConvertPosDirect)
 {
     List<String> ActionCodeLst = new List<string>();
     //亡语效果
     if (亡语效果 != String.Empty && !Is沉默Status)
     {
         var 战吼Result = RunAction.StartAction(game, 亡语效果, IsNeedConvertPosDirect);
         //第一条是使用了亡语卡牌的消息,如果不除去,对方客户端会认为使用了一张卡牌
         战吼Result.RemoveAt(0);
         ActionCodeLst.AddRange(战吼Result);
     }
     return ActionCodeLst;
 }
コード例 #12
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.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].ActualHealthPoint = 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].ActualHealthPoint = 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();
 }
コード例 #13
0
ファイル: PutMinion.cs プロジェクト: jasonroker/HearthStone
 public PutMinion(GameManager mgame)
 {
     InitializeComponent();
     game = mgame;
 }
コード例 #14
0
 /// <summary>
 /// 对法力水晶的法术实施
 /// </summary>
 /// <param name="role"></param>
 /// <param name="Ability"></param>
 public static List<string> RunEffect(EffectDefine singleEffect, GameManager game)
 {
     List<string> Result = new List<string>();
     string[] Op = singleEffect.AddtionInfo.Split("/".ToCharArray());
     int point = 0;
     //±N/±N	增加减少 可用水晶 / 增加减少 空水晶
     //可用水晶
     if (Op[0].Substring(1, 1) != "0")
     {
         point = int.Parse(Op[0].Substring(1, 1));
         if (Op[0].Substring(0, 1) == "+")
         {
             for (int i = 0; i < point; i++)
             {
                 if (singleEffect.EffectTargetSelectDirect == CardUtility.TargetSelectDirectEnum.本方)
                 {
                     game.MySelf.RoleInfo.crystal.AddCurrentPoint();
                 }
                 else
                 {
                     game.YourInfo.crystal.AddCurrentPoint();
                 }
             }
         }
         else
         {
             for (int i = 0; i < point; i++)
             {
                 if (singleEffect.EffectTargetSelectDirect == CardUtility.TargetSelectDirectEnum.本方)
                 {
                     game.MySelf.RoleInfo.crystal.ReduceCurrentPoint();
                 }
                 else
                 {
                     game.YourInfo.crystal.ReduceCurrentPoint();
                 }
             }
         }
     }
     //空水晶
     if (Op[1].Substring(1, 1) != "0")
     {
         point = int.Parse(Op[1].Substring(1, 1));
         if (Op[1].Substring(0, 1) == "+")
         {
             for (int i = 0; i < point; i++)
             {
                 if (singleEffect.EffectTargetSelectDirect == CardUtility.TargetSelectDirectEnum.本方)
                 {
                     game.MySelf.RoleInfo.crystal.AddFullPoint();
                 }
                 else
                 {
                     game.YourInfo.crystal.AddFullPoint();
                 }
             }
         }
         else
         {
             for (int i = 0; i < point; i++)
             {
                 if (singleEffect.EffectTargetSelectDirect == CardUtility.TargetSelectDirectEnum.本方)
                 {
                     game.MySelf.RoleInfo.crystal.ReduceFullPoint();
                 }
                 else
                 {
                     game.YourInfo.crystal.ReduceFullPoint();
                 }
             }
         }
     }
     //Crystal#ME#4#4
     if (singleEffect.EffectTargetSelectDirect == CardUtility.TargetSelectDirectEnum.本方)
     {
         Result.Add(ActionCode.strCrystal + CardUtility.strSplitMark + CardUtility.strMe + CardUtility.strSplitMark + game.MySelf.RoleInfo.crystal.CurrentRemainPoint + CardUtility.strSplitMark + game.MySelf.RoleInfo.crystal.CurrentFullPoint);
     }
     else
     {
         Result.Add(ActionCode.strCrystal + CardUtility.strSplitMark + CardUtility.strYou + CardUtility.strSplitMark + game.YourInfo.crystal.CurrentRemainPoint + CardUtility.strSplitMark + game.YourInfo.crystal.CurrentFullPoint);
     }
     return Result;
 }
コード例 #15
0
ファイル: RunAction.cs プロジェクト: jasonroker/HearthStone
 /// <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;
 }
コード例 #16
0
 /// <summary>
 /// 触发事件
 /// </summary>
 /// <param name="事件"></param>
 /// <param name="game"></param>
 /// <returns></returns>
 public List<String> 触发事件(CardUtility.全局事件 事件, GameManager game)
 {
     List<String> ActionLst = new List<string>();
     for (int i = 0; i < BattleMinions.Length; i++)
     {
         var minion = BattleMinions[i];
         if (minion != null)
         {
             ActionLst.AddRange(minion.触发事件(事件, game));
         }
     }
     return ActionLst;
 }
コード例 #17
0
ファイル: MinionCard.cs プロジェクト: jasonroker/HearthStone
 /// <summary>
 /// 
 /// </summary>
 /// <param name="事件"></param>
 public List<String> 触发事件(Card.CardUtility.全局事件 事件, GameManager game)
 {
     List<String> ActionLst = new List<string>();
     if (!Is沉默Status && 事件.事件类型 == 自身事件.事件类型)
     {
         if (自身事件.触发方向 != CardUtility.TargetSelectDirectEnum.双方)
         {
             if (自身事件.触发方向 != 事件.触发方向) return ActionLst;
         }
         if (!String.IsNullOrEmpty(自身事件.附加信息) && (事件.附加信息 != 自身事件.附加信息)) return ActionLst;
         ActionLst.Add(Card.Server.ActionCode.strHitEvent + CardUtility.strSplitMark);
         if (自身事件.事件效果.StartsWith("A"))
         {
             ActionLst.AddRange(game.UseAbility((Card.AbilityCard)Card.CardUtility.GetCardInfoBySN(自身事件.事件效果), false));
         }
         else
         {
             Card.Effect.PointEffect.RunPointEffect(this, 自身事件.事件效果);
         }
     }
     return ActionLst;
 }
コード例 #18
0
ファイル: MinionCard.cs プロジェクト: jasonroker/HearthStone
 /// <summary>
 /// 回合结束效果
 /// </summary>
 /// <param name="game"></param>
 /// <returns></returns>
 public List<String> 回合结束(GameManager game)
 {
     List<String> ActionCodeLst = new List<string>();
     //回合结束效果
     if (回合结束效果 != String.Empty && !Is沉默Status)
     {
         var 战吼Result = RunAction.StartAction(game, 回合结束效果);
         //第一条是使用了亡语卡牌的消息,如果不除去,对方客户端会认为使用了一张卡牌
         战吼Result.RemoveAt(0);
         ActionCodeLst.AddRange(战吼Result);
     }
     return ActionCodeLst;
 }
コード例 #19
0
ファイル: MinionCard.cs プロジェクト: jasonroker/HearthStone
 /// <summary>
 /// 发动战吼(默认)
 /// </summary>
 /// <param name="game"></param>
 /// <param name="SelfPosition"></param>
 /// <returns></returns>
 public List<String> 发动战吼(GameManager game)
 {
     List<String> ActionCodeLst = new List<string>();
     //战吼效果
     if (战吼效果 != String.Empty && !Is沉默Status)
     {
         var 战吼Result = RunAction.StartAction(game, 战吼效果);
         //第一条是使用了战吼卡牌的消息,如果不除去,对方客户端会认为使用了一张卡牌
         //如果战吼在召唤的时候无法成功,法术机能会误认为是取消
         if (战吼Result.Count > 0) 战吼Result.RemoveAt(0);
         ActionCodeLst.AddRange(战吼Result);
     }
     return ActionCodeLst;
 }