示例#1
0
 /// <summary>
 /// create harmphase
 /// </summary>
 /// <param name="player"></param>
 /// <param name="source"></param>
 /// <param name="harm"></param>
 /// <param name="card"></param>
 public HarmPhase(Player player, Player source, int harm, Attack card) : base(player)
 {
     this.source = source;
     this.harm   = harm;
     this.card   = card;
 }
        public override PhaseList responseUseCardAction(Card card, Player[] targets, IGame game)
        {
            PhaseList ret = new PhaseList(this);

            if (card is BasicCard)
            {
                Attack attack = card as Attack;
                if (attack != null)
                {
                    ret.push(new AttackPhase(player, attack, targets, this));
                    return(ret);
                }
                Wine wine = card as Wine;
                if (wine != null)
                {
                    if (drunk)
                    {
                        return(null);
                    }
                    player.discardCard(wine, game);
                    drunk = true;
                    return(ret);
                }
                Peach peach = card as Peach;
                if (peach != null)
                {
                    if (player.health == player.healthLimit)
                    {
                        return(null);
                    }
                    player.discardCard(peach, game);
                    ret.push(new RecoverPhase(player, 1));
                    return(ret);
                }
            }
            else if (card is ToolCard)
            {
                Wealth wealth = card as Wealth;
                if (wealth != null)
                {
                    player.drawCards(2, game);
                    player.discardCard(wealth, game);
                    return(ret);
                }

                PeachGarden peachgarden = card as PeachGarden;
                if (peachgarden != null)
                {
                    player.discardCard(peachgarden, game);

                    foreach (Player x in game.players)
                    {
                        ret.push(new RecoverPhase(x, 1));
                    }

                    return(ret);
                }
            }
            else if (card is Equipment)
            {
                throw new NotImplementedException();
                //return new PhaseList(new UseEquipmentPhase(player, card as Equipment), this);
            }
            game.log("" + card + Legends_of_the_Three_Kingdoms.Properties.Resources.Cannot_be_uese);
            return(null);
        }