コード例 #1
0
ファイル: GameManager.cs プロジェクト: bluexray/HearthStone
        /// <summary>
        /// 使用法术
        /// </summary>
        /// <param name="card"></param>
        /// <param name="ConvertPosDirect">对象方向转换</param>
        public List <String> UseAbility(Card.AbilityCard card, Boolean ConvertPosDirect)
        {
            List <String> Result = new List <string>();

            //法术伤害
            if (MyInfo.BattleField.AbilityEffect != 0)
            {
                card.JustfyEffectPoint(MyInfo.BattleField.AbilityEffect);
            }
            Card.CardUtility.PickEffect PickEffectResult = CardUtility.PickEffect.第一效果;
            if (card.CardAbility.IsNeedSelect())
            {
                PickEffectResult = PickEffect(card.CardAbility.FirstAbilityDefine.Description, card.CardAbility.SecondAbilityDefine.Description);
                if (PickEffectResult == CardUtility.PickEffect.取消)
                {
                    return(new List <string>());
                }
            }
            var SingleEffectList = card.CardAbility.GetSingleEffectList(PickEffectResult == CardUtility.PickEffect.第一效果);

            //Pos放在循环外部,这样的话,达到继承的效果
            Card.CardUtility.TargetPosition TargetPosInfo = new CardUtility.TargetPosition();
            for (int i = 0; i < SingleEffectList.Count; i++)
            {
                var singleEffect = SingleEffectList[i];
                singleEffect.StandardEffectCount = 1;
                if (singleEffect.IsNeedSelectTarget())
                {
                    TargetPosInfo = GetSelectTarget(singleEffect.SelectOpt, false);
                    //取消处理
                    if (TargetPosInfo.Postion == -1)
                    {
                        return(new List <string>());
                    }
                }
                else
                {
                    if (ConvertPosDirect)
                    {
                        switch (singleEffect.SelectOpt.EffectTargetSelectDirect)
                        {
                        case CardUtility.TargetSelectDirectEnum.本方:
                            singleEffect.SelectOpt.EffectTargetSelectDirect = CardUtility.TargetSelectDirectEnum.对方;
                            break;

                        case CardUtility.TargetSelectDirectEnum.对方:
                            singleEffect.SelectOpt.EffectTargetSelectDirect = CardUtility.TargetSelectDirectEnum.本方;
                            break;

                        case CardUtility.TargetSelectDirectEnum.双方:
                            break;

                        default:
                            break;
                        }
                    }
                }
                Result.AddRange(Effecthandler.RunSingleEffect(singleEffect, this, TargetPosInfo, Seed));
                Seed++;
                //每次原子操作后进行一次清算
                //将亡语效果也发送给对方
                Result.AddRange(Settle());
            }
            return(Result);
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="singleEffect"></param>
        /// <param name="game"></param>
        /// <param name="Pos"></param>
        /// <param name="Seed"></param>
        /// <returns></returns>
        public static List <string> GetTargetList(EffectDefine singleEffect, Client.GameManager game, CardUtility.TargetPosition Pos, int Seed)
        {
            //切记,这里的EffectCount都是1
            List <string> Result = new List <string>();

            switch (singleEffect.EffictTargetSelectMode)
            {
            case CardUtility.TargetSelectModeEnum.随机:
                Random t = new Random(DateTime.Now.Millisecond + Seed);
                switch (singleEffect.EffectTargetSelectDirect)
                {
                case CardUtility.TargetSelectDirectEnum.本方:
                    switch (singleEffect.EffectTargetSelectRole)
                    {
                    case CardUtility.TargetSelectRoleEnum.随从:
                        Pos.Postion = t.Next(1, game.MySelf.RoleInfo.BattleField.MinionCount + 1);
                        Pos.MeOrYou = true;
                        break;

                    case CardUtility.TargetSelectRoleEnum.所有角色:
                        Pos.Postion = t.Next(Client.BattleFieldInfo.HeroPos, game.MySelf.RoleInfo.BattleField.MinionCount + 1);
                        Pos.MeOrYou = true;
                        break;
                    }
                    //ME#POS
                    Result.Add(CardUtility.strMe + CardUtility.strSplitMark + Pos.Postion.ToString("D1"));
                    break;

                case CardUtility.TargetSelectDirectEnum.对方:
                    switch (singleEffect.EffectTargetSelectRole)
                    {
                    case CardUtility.TargetSelectRoleEnum.随从:
                        Pos.Postion = t.Next(1, game.YourInfo.BattleField.MinionCount + 1);
                        Pos.MeOrYou = false;
                        break;

                    case CardUtility.TargetSelectRoleEnum.所有角色:
                        Pos.Postion = t.Next(Client.BattleFieldInfo.HeroPos, game.YourInfo.BattleField.MinionCount + 1);
                        Pos.MeOrYou = false;
                        break;
                    }
                    //ME#POS
                    Result.Add(CardUtility.strYou + CardUtility.strSplitMark + Pos.Postion.ToString("D1"));
                    break;

                case CardUtility.TargetSelectDirectEnum.双方:
                    //本方对方
                    int MinionCount;
                    if (t.Next(1, 3) == 1)
                    {
                        Pos.MeOrYou = true;
                        MinionCount = game.MySelf.RoleInfo.BattleField.MinionCount;
                    }
                    else
                    {
                        Pos.MeOrYou = false;
                        MinionCount = game.YourInfo.BattleField.MinionCount;
                    }
                    switch (singleEffect.EffectTargetSelectRole)
                    {
                    case CardUtility.TargetSelectRoleEnum.随从:
                        Pos.Postion = t.Next(1, MinionCount + 1);
                        break;

                    case CardUtility.TargetSelectRoleEnum.所有角色:
                        Pos.Postion = t.Next(Client.BattleFieldInfo.HeroPos, MinionCount + 1);
                        break;
                    }
                    //ME#POS
                    Result.Add((Pos.MeOrYou ? CardUtility.strMe : CardUtility.strYou) + CardUtility.strSplitMark + Pos.Postion.ToString("D1"));
                    break;

                default:
                    break;
                }
                break;

            case CardUtility.TargetSelectModeEnum.全体:
                switch (singleEffect.EffectTargetSelectDirect)
                {
                case CardUtility.TargetSelectDirectEnum.本方:
                    switch (singleEffect.EffectTargetSelectRole)
                    {
                    case CardUtility.TargetSelectRoleEnum.随从:
                        for (int i = 0; i < game.MySelf.RoleInfo.BattleField.MinionCount; i++)
                        {
                            Result.Add(CardUtility.strMe + CardUtility.strSplitMark + (i + 1).ToString("D1"));
                        }
                        break;

                    case CardUtility.TargetSelectRoleEnum.英雄:
                        Result.Add(CardUtility.strMe + CardUtility.strSplitMark + Client.BattleFieldInfo.HeroPos.ToString("D1"));
                        break;

                    case CardUtility.TargetSelectRoleEnum.所有角色:
                        Result.Add(CardUtility.strMe + CardUtility.strSplitMark + Client.BattleFieldInfo.HeroPos.ToString("D1"));
                        for (int i = 0; i < game.MySelf.RoleInfo.BattleField.MinionCount; i++)
                        {
                            Result.Add(CardUtility.strMe + CardUtility.strSplitMark + (i + 1).ToString("D1"));
                        }
                        break;
                    }
                    break;

                case CardUtility.TargetSelectDirectEnum.对方:
                    switch (singleEffect.EffectTargetSelectRole)
                    {
                    case CardUtility.TargetSelectRoleEnum.随从:
                        for (int i = 0; i < game.YourInfo.BattleField.MinionCount; i++)
                        {
                            Result.Add(CardUtility.strYou + CardUtility.strSplitMark + (i + 1).ToString("D1"));
                        }
                        break;

                    case CardUtility.TargetSelectRoleEnum.英雄:
                        Result.Add(CardUtility.strYou + CardUtility.strSplitMark + Client.BattleFieldInfo.HeroPos.ToString("D1"));
                        break;

                    case CardUtility.TargetSelectRoleEnum.所有角色:
                        Result.Add(CardUtility.strYou + CardUtility.strSplitMark + Client.BattleFieldInfo.HeroPos.ToString("D1"));
                        for (int i = 0; i < game.YourInfo.BattleField.MinionCount; i++)
                        {
                            Result.Add(CardUtility.strYou + CardUtility.strSplitMark + (i + 1).ToString("D1"));
                        }
                        break;
                    }
                    break;

                case CardUtility.TargetSelectDirectEnum.双方:
                    switch (singleEffect.EffectTargetSelectRole)
                    {
                    case CardUtility.TargetSelectRoleEnum.随从:
                        for (int i = 0; i < game.MySelf.RoleInfo.BattleField.MinionCount; i++)
                        {
                            Result.Add(CardUtility.strMe + CardUtility.strSplitMark + (i + 1).ToString("D1"));
                        }
                        for (int i = 0; i < game.YourInfo.BattleField.MinionCount; i++)
                        {
                            Result.Add(CardUtility.strYou + CardUtility.strSplitMark + (i + 1).ToString("D1"));
                        }
                        break;

                    case CardUtility.TargetSelectRoleEnum.英雄:
                        Result.Add(CardUtility.strMe + CardUtility.strSplitMark + Client.BattleFieldInfo.HeroPos.ToString("D1"));
                        Result.Add(CardUtility.strYou + CardUtility.strSplitMark + Client.BattleFieldInfo.HeroPos.ToString("D1"));
                        break;

                    case CardUtility.TargetSelectRoleEnum.所有角色:
                        Result.Add(CardUtility.strMe + CardUtility.strSplitMark + Client.BattleFieldInfo.HeroPos.ToString("D1"));
                        Result.Add(CardUtility.strYou + CardUtility.strSplitMark + Client.BattleFieldInfo.HeroPos.ToString("D1"));
                        for (int i = 0; i < game.MySelf.RoleInfo.BattleField.MinionCount; i++)
                        {
                            Result.Add(CardUtility.strMe + CardUtility.strSplitMark + (i + 1).ToString("D1"));
                        }
                        for (int i = 0; i < game.YourInfo.BattleField.MinionCount; i++)
                        {
                            Result.Add(CardUtility.strYou + CardUtility.strSplitMark + (i + 1).ToString("D1"));
                        }
                        break;
                    }
                    break;
                }
                break;

            case CardUtility.TargetSelectModeEnum.指定:
                Result.Add((Pos.MeOrYou ? CardUtility.strMe : CardUtility.strYou) + CardUtility.strSplitMark + Pos.Postion.ToString("D1"));
                break;

            case CardUtility.TargetSelectModeEnum.用选择:
                if (singleEffect.EffectTargetSelectRole == CardUtility.TargetSelectRoleEnum.英雄)
                {
                    switch (singleEffect.EffectTargetSelectDirect)
                    {
                    case CardUtility.TargetSelectDirectEnum.本方:
                        Result.Add(CardUtility.strMe + CardUtility.strSplitMark + Client.BattleFieldInfo.HeroPos.ToString("D1"));
                        break;

                    case CardUtility.TargetSelectDirectEnum.对方:
                        Result.Add(CardUtility.strYou + CardUtility.strSplitMark + Client.BattleFieldInfo.HeroPos.ToString("D1"));
                        break;

                    case CardUtility.TargetSelectDirectEnum.双方:
                        Result.Add(CardUtility.strMe + CardUtility.strSplitMark + Client.BattleFieldInfo.HeroPos.ToString("D1"));
                        Result.Add(CardUtility.strYou + CardUtility.strSplitMark + Client.BattleFieldInfo.HeroPos.ToString("D1"));
                        break;

                    default:
                        break;
                    }
                }
                break;
            }
            return(Result);
        }
コード例 #3
0
        /// <summary>
        /// 使用法术
        /// </summary>
        /// <param name="card"></param>
        /// <param name="ConvertPosDirect">对象方向转换</param>
        public List <String> UseAbility(Card.AbilityCard card, Boolean ConvertPosDirect)
        {
            List <String> Result = new List <string>();

            //法术伤害
            if (MySelf.RoleInfo.BattleField.AbilityEffect != 0)
            {
                //法术强度本意是增加法术卡的总伤。以奥术飞弹为例,法术强度+1会令奥术飞弹多1发伤害,而非单发伤害+1。法术强度不影响治疗效果。
                switch (card.CardAbility.FirstAbilityDefine.AbilityEffectType)
                {
                case EffectDefine.AbilityEffectEnum.攻击:
                    if (card.CardAbility.FirstAbilityDefine.StandardEffectCount == 1)
                    {
                        card.CardAbility.FirstAbilityDefine.ActualEffectPoint = card.CardAbility.FirstAbilityDefine.StandardEffectPoint + MySelf.RoleInfo.BattleField.AbilityEffect;
                    }
                    else
                    {
                        card.CardAbility.FirstAbilityDefine.ActualEffectCount = card.CardAbility.FirstAbilityDefine.StandardEffectCount + MySelf.RoleInfo.BattleField.AbilityEffect;
                    }
                    break;

                case EffectDefine.AbilityEffectEnum.回复:
                    card.CardAbility.FirstAbilityDefine.ActualEffectPoint = card.CardAbility.FirstAbilityDefine.StandardEffectPoint + MySelf.RoleInfo.BattleField.AbilityEffect;
                    break;
                }
                if (card.CardAbility.SecondAbilityDefine.AbilityEffectType != EffectDefine.AbilityEffectEnum.未定义)
                {
                    switch (card.CardAbility.SecondAbilityDefine.AbilityEffectType)
                    {
                    case EffectDefine.AbilityEffectEnum.攻击:
                        if (card.CardAbility.SecondAbilityDefine.StandardEffectCount == 1)
                        {
                            card.CardAbility.SecondAbilityDefine.ActualEffectPoint = card.CardAbility.SecondAbilityDefine.StandardEffectPoint + MySelf.RoleInfo.BattleField.AbilityEffect;
                        }
                        else
                        {
                            card.CardAbility.SecondAbilityDefine.ActualEffectCount = card.CardAbility.SecondAbilityDefine.StandardEffectCount + MySelf.RoleInfo.BattleField.AbilityEffect;
                        }
                        break;

                    case EffectDefine.AbilityEffectEnum.回复:
                        card.CardAbility.SecondAbilityDefine.ActualEffectPoint = card.CardAbility.SecondAbilityDefine.StandardEffectPoint + MySelf.RoleInfo.BattleField.AbilityEffect;
                        break;
                    }
                }
            }
            Card.CardUtility.PickEffect PickEffectResult = CardUtility.PickEffect.第一效果;
            if (card.CardAbility.IsNeedSelect())
            {
                PickEffectResult = PickEffect(card.CardAbility.FirstAbilityDefine.Description, card.CardAbility.SecondAbilityDefine.Description);
                if (PickEffectResult == CardUtility.PickEffect.取消)
                {
                    return(new List <string>());
                }
            }
            var SingleEffectList = card.CardAbility.GetSingleEffectList(PickEffectResult == CardUtility.PickEffect.第一效果);

            for (int i = 0; i < SingleEffectList.Count; i++)
            {
                Card.CardUtility.TargetPosition Pos = new CardUtility.TargetPosition();
                var singleEff = SingleEffectList[i];
                singleEff.StandardEffectCount = 1;
                if (singleEff.IsNeedSelectTarget())
                {
                    Pos = GetSelectTarget(singleEff.EffectTargetSelectDirect, singleEff.EffectTargetSelectRole, false);
                    //取消处理
                    if (Pos.Postion == -1)
                    {
                        return(new List <string>());
                    }
                }
                else
                {
                    if (ConvertPosDirect)
                    {
                        switch (singleEff.EffectTargetSelectDirect)
                        {
                        case CardUtility.TargetSelectDirectEnum.本方:
                            singleEff.EffectTargetSelectDirect = CardUtility.TargetSelectDirectEnum.对方;
                            break;

                        case CardUtility.TargetSelectDirectEnum.对方:
                            singleEff.EffectTargetSelectDirect = CardUtility.TargetSelectDirectEnum.本方;
                            break;

                        case CardUtility.TargetSelectDirectEnum.双方:
                            break;

                        default:
                            break;
                        }
                    }
                }
                Result.AddRange(EffectDefine.RunSingleEffect(singleEff, this, Pos, Seed));
                Seed++;
                //每次原子操作后进行一次清算
                //将亡语效果也发送给对方
                Result.AddRange(Settle());
            }
            return(Result);
        }
コード例 #4
0
ファイル: GameManager.cs プロジェクト: GavinHwa/HearthStone
 /// <summary>
 /// 使用法术
 /// </summary>
 /// <param name="card"></param>
 /// <param name="ConvertPosDirect">对象方向转换</param>
 public List<String> UseAbility(Card.AbilityCard card, Boolean ConvertPosDirect)
 {
     List<String> Result = new List<string>();
     Card.CardUtility.PickEffect PickEffectResult = CardUtility.PickEffect.第一效果;
     if (card.CardAbility.IsNeedSelect())
     {
         PickEffectResult = PickEffect(card.CardAbility.FirstAbilityDefine.Description, card.CardAbility.SecondAbilityDefine.Description);
         if (PickEffectResult == CardUtility.PickEffect.取消) return new List<string>();
     }
     var SingleEffectList = card.CardAbility.GetSingleEffectList(PickEffectResult == CardUtility.PickEffect.第一效果);
     for (int i = 0; i < SingleEffectList.Count; i++)
     {
         Card.CardUtility.TargetPosition Pos = new CardUtility.TargetPosition();
         //取消处理
         if (Pos.Postion == -1) return new List<string>();
         var singleEff = SingleEffectList[i];
         singleEff.EffectCount = 1;
         if (singleEff.IsNeedSelectTarget())
         {
             Pos = GetSelectTarget(singleEff.EffectTargetSelectDirect, singleEff.EffectTargetSelectRole, false);
         }
         else
         {
             if (ConvertPosDirect)
             {
                 switch (singleEff.EffectTargetSelectDirect)
                 {
                     case CardUtility.TargetSelectDirectEnum.本方:
                         singleEff.EffectTargetSelectDirect = CardUtility.TargetSelectDirectEnum.对方;
                         break;
                     case CardUtility.TargetSelectDirectEnum.对方:
                         singleEff.EffectTargetSelectDirect = CardUtility.TargetSelectDirectEnum.本方;
                         break;
                     case CardUtility.TargetSelectDirectEnum.双方:
                         break;
                     default:
                         break;
                 }
             }
         }
         Result.AddRange(EffectDefine.RunSingleEffect(singleEff, this, Pos, Seed));
         Seed++;
         //每次原子操作后进行一次清算
         //将亡语效果也发送给对方
         Result.AddRange(Settle());
     }
     return Result;
 }
コード例 #5
0
ファイル: GameManager.cs プロジェクト: jasonroker/HearthStone
 /// <summary>
 /// 使用法术
 /// </summary>
 /// <param name="card"></param>
 /// <param name="ConvertPosDirect">对象方向转换</param>
 public List<String> UseAbility(Card.AbilityCard card, Boolean ConvertPosDirect)
 {
     List<String> Result = new List<string>();
     //法术伤害
     if (MySelf.RoleInfo.BattleField.AbilityEffect != 0)
     {
         card.JustfyEffectPoint(MySelf.RoleInfo.BattleField.AbilityEffect);
     }
     Card.CardUtility.PickEffect PickEffectResult = CardUtility.PickEffect.第一效果;
     if (card.CardAbility.IsNeedSelect())
     {
         PickEffectResult = PickEffect(card.CardAbility.FirstAbilityDefine.Description, card.CardAbility.SecondAbilityDefine.Description);
         if (PickEffectResult == CardUtility.PickEffect.取消) return new List<string>();
     }
     var SingleEffectList = card.CardAbility.GetSingleEffectList(PickEffectResult == CardUtility.PickEffect.第一效果);
     //Pos放在循环外部,这样的话,达到继承的效果
     Card.CardUtility.TargetPosition TargetPosInfo = new CardUtility.TargetPosition();
     for (int i = 0; i < SingleEffectList.Count; i++)
     {
         var singleEffect = SingleEffectList[i];
         singleEffect.StandardEffectCount = 1;
         if (singleEffect.IsNeedSelectTarget())
         {
             TargetPosInfo = GetSelectTarget(singleEffect.SelectOpt, false);
             //取消处理
             if (TargetPosInfo.Postion == -1) return new List<string>();
         }
         else
         {
             if (ConvertPosDirect)
             {
                 switch (singleEffect.SelectOpt.EffectTargetSelectDirect)
                 {
                     case CardUtility.TargetSelectDirectEnum.本方:
                         singleEffect.SelectOpt.EffectTargetSelectDirect = CardUtility.TargetSelectDirectEnum.对方;
                         break;
                     case CardUtility.TargetSelectDirectEnum.对方:
                         singleEffect.SelectOpt.EffectTargetSelectDirect = CardUtility.TargetSelectDirectEnum.本方;
                         break;
                     case CardUtility.TargetSelectDirectEnum.双方:
                         break;
                     default:
                         break;
                 }
             }
         }
         Result.AddRange(EffectDefine.RunSingleEffect(singleEffect, this, TargetPosInfo, Seed));
         Seed++;
         //每次原子操作后进行一次清算
         //将亡语效果也发送给对方
         Result.AddRange(Settle());
     }
     return Result;
 }
コード例 #6
0
ファイル: GameManager.cs プロジェクト: EricBlack/HearthStone
 /// <summary>
 /// 使用法术
 /// </summary>
 /// <param name="CardSn"></param>
 public List<String> UseAbility(Card.AbilityCard card)
 {
     List<String> Result = new List<string>();
     Card.CardUtility.PickEffect PickEffectResult = CardUtility.PickEffect.第一效果;
     if (card.CardAbility.IsNeedSelect())
     {
         PickEffectResult = PickEffect(card.CardAbility.FirstAbilityDefine.Description, card.CardAbility.SecondAbilityDefine.Description);
         if (PickEffectResult == CardUtility.PickEffect.取消) return new List<string>();
     }
     var SingleEffectList = card.CardAbility.GetSingleEffectList(PickEffectResult == CardUtility.PickEffect.第一效果);
     for (int i = 0; i < SingleEffectList.Count; i++)
     {
         Card.CardUtility.TargetPosition Pos = new CardUtility.TargetPosition();
         //取消处理
         if (Pos.Postion == -1) return new List<string>();
         var singleEff = SingleEffectList[i];
         singleEff.EffectCount = 1;
         if (singleEff.IsNeedSelectTarget())
         {
             Pos = GetSelectTarget(singleEff.EffectTargetSelectDirect, singleEff.EffectTargetSelectRole, false);
         }
         Result.AddRange(EffectDefine.RunSingleEffect(singleEff, this, Pos, Seed));
         Seed++;
         //每次原子操作后进行一次清算
         Settle();
     }
     return Result;
 }
コード例 #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);
        }