Ejemplo n.º 1
0
        /// <summary>
        /// 检查是否可以使用
        /// </summary>
        /// <returns></returns>
        public String CheckCondition(Card.CardBasicInfo card)
        {
            //剩余的法力是否足够实际召唤的法力
            String Message = String.Empty;

            if (card.Overload > 0 && OverloadPoint > 0)
            {
                Message = "已经使用过载";
                return(Message);
            }
            if (card.CardType == CardBasicInfo.CardTypeEnum.法术)
            {
                if (((Card.AbilityCard)card).CheckCondition(this) == false)
                {
                    Message = "没有法术使用对象";
                    return(Message);
                }
            }
            if (card.CardType == CardBasicInfo.CardTypeEnum.随从)
            {
                if (MyInfo.BattleField.MinionCount == Card.Client.BattleFieldInfo.MaxMinionCount)
                {
                    Message = "随从已经满员";
                    return(Message);
                }
            }
            if (MyInfo.crystal.CurrentRemainPoint < card.ActualCostPoint)
            {
                Message = "法力水晶不足";
            }
            return(Message);
        }
Ejemplo n.º 2
0
 public void RemoveUsedCard(String CardSn)
 {
     Card.CardBasicInfo removeCard = new CardBasicInfo();
     foreach (var Seekcard in MySelf.handCards)
     {
         if (Seekcard.SN == CardSn)
         {
             removeCard = Seekcard;
         }
     }
     MySelf.handCards.Remove(removeCard);
     MySelf.RoleInfo.HandCardCount = MySelf.handCards.Count;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 使用手牌
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnUseHandCard_Click(object sender, EventArgs e)
        {
            if (((Button)sender).Tag == null) return;
            String CardSn = ((Button)sender).Tag.ToString();
            if (Card.CardUtility.GetCardInfoBySN(CardSn) != null)
            {
                Card.CardBasicInfo card = Card.CardUtility.GetCardInfoBySN(CardSn);
                if (game.MySelf.RoleInfo.crystal.CurrentRemainPoint < card.ActualCostPoint)
                {
                    MessageBox.Show("水晶不够");
                    return;
                }
                var actionlst = RunAction.StartAction(game, CardSn);
                if (actionlst.Count != 0)
                {
                    game.MySelf.RoleInfo.crystal.CurrentRemainPoint -= card.ActualCostPoint;

                    if (((Button)sender).Name != "btnMyHeroAblity")
                    {
                        Card.CardBasicInfo removeCard = new CardBasicInfo();
                        foreach (var Seekcard in game.MySelf.handCards)
                        {
                            if (Seekcard.SN == CardSn)
                            {
                                removeCard = Seekcard;
                            }
                        }
                        game.MySelf.handCards.Remove(removeCard);
                        game.MySelf.RoleInfo.HandCardCount = game.MySelf.handCards.Count;
                    }
                    var action = ActionCode.strCrystal + CardUtility.strSplitMark + CardUtility.strMe + CardUtility.strSplitMark +
                                 game.MySelf.RoleInfo.crystal.CurrentRemainPoint + CardUtility.strSplitMark + game.MySelf.RoleInfo.crystal.CurrentFullPoint;
                    Card.Server.ClientUtlity.WriteAction(game.GameId.ToString(GameServer.GameIdFormat), action);
                }
                foreach (var action in actionlst)
                {
                    Card.Server.ClientUtlity.WriteAction(game.GameId.ToString(GameServer.GameIdFormat), action);
                }
            }
            if (((Button)sender).Name == "btnMyHeroAblity") game.MySelf.RoleInfo.IsUsedHeroAbility = true;
            DisplayMyInfo();
        }