Exemple #1
0
 /// <summary>
 /// 这个角色能否对目标进行攻击?
 /// </summary>
 /// <param name="card"></param>
 /// <param name="game"></param>
 /// <param name="player"></param>
 /// <param name="target"></param>
 /// <returns></returns>
 public static bool isAttackable(this Card card, THHGame game, THHPlayer player, Card target, out string tip)
 {
     if (target == player.master || player.field.Contains(target))
     {
         tip = "你不能攻击友方角色";
         return(false);
     }
     if (target.getCurrentLife(game) <= 0)
     {
         tip = "目标随从已经死亡";
         return(false);
     }
     if (game.getOpponent(player).field.Any(c => c.isTaunt(game)) && !target.isTaunt(game))
     {
         tip = "你必须先攻击具有嘲讽的随从";
         return(false);
     }
     if (card.isRush(game) && !card.isReady(game) && game.players.Any(p => p.master == target) && !card.isCharge(game))
     {
         tip = "具有突袭的随从在没有准备好的情况下不能攻击敌方英雄";//除非你具有冲锋
         return(false);
     }
     if (target.isStealth(game))
     {
         tip = "无法攻击潜行的目标";
         return(false);
     }
     tip = null;
     return(true);
 }
Exemple #2
0
 /// <summary>
 /// 这个角色能否进行攻击?
 /// </summary>
 /// <param name="card"></param>
 /// <returns></returns>
 public static bool canAttack(this Card card, THHGame game)
 {
     if (card.pile.name != PileName.FIELD)//你只能在战场上进行攻击。是不是必须得活着,这是个哲学问题。
     {
         return(false);
     }
     if (card.getAttack(game) <= 0)//没有攻击力
     {
         return(false);
     }
     if (!card.isReady(game) &&//还没准备好
         !card.isCharge(game) &&//且没有冲锋
         !(card.isRush(game) && game.getOpponent(card.getOwner()).field.Any(c => card.isAttackable(game, card.getOwner(), c, out _)))   //且并非有突袭且有可以攻击的敌方随从
         )
     {
         return(false);
     }
     if (card.getAttackTimes(game) >= card.getMaxAttackTimes())//已经攻击过了
     {
         return(false);
     }
     if (card.isFreeze(game))
     {
         game.logger.log(card + "被冰冻");
         return(false);
     }
     return(true);
 }
Exemple #3
0
 /// <summary>
 /// 这个角色能否对目标进行攻击?
 /// </summary>
 /// <param name="card"></param>
 /// <param name="game"></param>
 /// <param name="player"></param>
 /// <param name="target"></param>
 /// <returns></returns>
 public static bool isAttackable(this Card card, THHGame game, THHPlayer player, Card target, out string tip)
 {
     if (target == player.master || player.field.Contains(target))
     {
         tip = "你不能攻击友方角色";
         return(false);
     }
     if (game.getOpponent(player).field.Any(c => c.isTaunt()) && !target.isTaunt())
     {
         tip = "你必须先攻击具有嘲讽的随从";
         return(false);
     }
     tip = null;
     return(true);
 }
Exemple #4
0
        public static Pile[] getPiles(this PileFlag flag, THHGame game, Player player)
        {
            List <Pile> pileList = new List <Pile>();

            if (flag.HasFlag(PileFlag.self))
            {
                addPileToList(player, flag, pileList);
            }
            if (flag.HasFlag(PileFlag.oppo))
            {
                player = game.getOpponent(player);
                addPileToList(player, flag, pileList);
            }
            return(pileList.ToArray());
        }
 /// <summary>
 /// 这个角色能否进行攻击?
 /// </summary>
 /// <param name="card"></param>
 /// <returns></returns>
 public static bool canAttack(this Card card, THHGame game, THHPlayer player)
 {
     if (card.getAttack() <= 0)//没有攻击力
     {
         return(false);
     }
     if (!card.isReady() &&//还没准备好
         !card.isCharge() &&//且没有冲锋
         !(card.isRush() && game.getOpponent(player).field.Any(c => card.isAttackable(game, player, c, out _)))   //且并非有突袭且有可以攻击的敌方随从
         )
     {
         return(false);
     }
     if (card.getAttackTimes() >= card.getMaxAttackTimes())//已经攻击过了
     {
         return(false);
     }
     return(true);
 }