Beispiel #1
0
        /// <summary>
        /// 运行奥秘
        /// </summary>
        /// <param name="SecretCardSN"></param>
        /// <param name="ActionCode"></param>
        /// <param name="HitMySelf"></param>
        /// <returns></returns>
        public static List <String> RunSecretHit(String SecretCardSN, String ActionCode, Boolean HitMySelf, Card.Client.GameManager game)
        {
            List <String> ActionLst   = new List <string>();
            SecretCard    card        = (SecretCard)CardUtility.GetCardInfoBySN(SecretCardSN);
            var           actiontype  = Card.Server.ActionCode.GetActionType(ActionCode);
            var           actionField = ActionCode.Split(Card.CardUtility.strSplitMark.ToCharArray());

            ActionLst.Add(Card.Server.ActionCode.strHitSecret + CardUtility.strSplitMark + (HitMySelf ? CardUtility.strMe : CardUtility.strYou) +
                          CardUtility.strSplitMark + SecretCardSN);
            //HitMySelf 在自己的回合运行自己的奥秘
            switch (card.Condition)
            {
            case SecretCondition.对方召唤随从:
                //如果是召唤系的
                if (HitMySelf)
                {
                    //在自己的回合运行自己的奥秘
                    //SUMMON#YOU#M000001#POS
                    //例如:亡语的时候可能召唤一个新的随从
                    PointEffect.RunPointEffect(game.YourInfo.BattleField.BattleMinions[int.Parse(actionField[3]) - 1], card.AdditionInfo);
                    ActionLst.Add(Card.Server.ActionCode.strPoint + Card.CardUtility.strSplitMark + CardUtility.strYou + Card.CardUtility.strSplitMark +
                                  actionField[3] + Card.CardUtility.strSplitMark + card.AdditionInfo);
                }
                else
                {
                    //在自己的回合运行别人的奥秘
                    if (actiontype == Server.ActionCode.ActionType.Summon)
                    {
                        //SUMMON#YOU#M000001#POS
                        PointEffect.RunPointEffect(game.MyInfo.BattleField.BattleMinions[int.Parse(actionField[3]) - 1], card.AdditionInfo);
                        ActionLst.Add(Card.Server.ActionCode.strPoint + Card.CardUtility.strSplitMark + CardUtility.strMe + Card.CardUtility.strSplitMark +
                                      actionField[3] + Card.CardUtility.strSplitMark + card.AdditionInfo);
                    }
                    else
                    {
                        //MINION#M000001#1
                        PointEffect.RunPointEffect(game.MyInfo.BattleField.BattleMinions[int.Parse(actionField[2]) - 1], card.AdditionInfo);
                        ActionLst.Add(Card.Server.ActionCode.strPoint + Card.CardUtility.strSplitMark + CardUtility.strMe + Card.CardUtility.strSplitMark +
                                      actionField[2] + Card.CardUtility.strSplitMark + card.AdditionInfo);
                    }
                }
                break;

            default:
                break;
            }
            return(ActionLst);
        }
Beispiel #2
0
        /// <summary>
        /// 奥秘
        /// </summary>
        /// <param name="target"></param>
        /// <param name="workbook"></param>
        private void Secret(TargetType target, dynamic workbook)
        {
            if (Directory.Exists(XmlFolderPicker.SelectedPathOrFileName + "\\Secret\\"))
            {
                Directory.Delete(XmlFolderPicker.SelectedPathOrFileName + "\\Secret\\", true);
            }
            Directory.CreateDirectory(XmlFolderPicker.SelectedPathOrFileName + "\\Secret\\");
            //奥秘的导入
            dynamic worksheet = workbook.Sheets(4);
            int     rowCount  = 4;

            while (!String.IsNullOrEmpty(worksheet.Cells(rowCount, 2).Text))
            {
                Card.SecretCard Secret = new Card.SecretCard();
                Secret.SN                = worksheet.Cells(rowCount, 2).Text;
                Secret.Name              = worksheet.Cells(rowCount, 3).Text;
                Secret.Description       = worksheet.Cells(rowCount, 4).Text;
                Secret.Class             = CardUtility.GetEnum <Card.CardUtility.ClassEnum>(worksheet.Cells(rowCount, 5).Text, Card.CardUtility.ClassEnum.中立);
                Secret.StandardCostPoint = CardUtility.GetInt(worksheet.Cells(rowCount, 7).Text);
                Secret.ActualCostPoint   = Secret.StandardCostPoint;
                Secret.Rare              = CardUtility.GetEnum <Card.CardBasicInfo.稀有程度>(worksheet.Cells(rowCount, 12).Text, CardBasicInfo.稀有程度.白色);
                Secret.IsCardReady       = !String.IsNullOrEmpty(worksheet.Cells(rowCount, 13).Text);
                Secret.Condition         = CardUtility.GetEnum <Card.SecretCard.SecretCondition>(worksheet.Cells(rowCount, 14).Text, SecretCard.SecretCondition.对方召唤随从);
                Secret.AdditionInfo      = worksheet.Cells(rowCount, 15).Text;
                switch (target)
                {
                case TargetType.MongoDB:
                    //innerCollection.Insert<Card.SecretCard>(Secret);
                    break;

                case TargetType.Xml:
                    XmlSerializer xml         = new XmlSerializer(typeof(Card.SecretCard));
                    String        XmlFilename = XmlFolderPicker.SelectedPathOrFileName + "\\Secret\\" + Secret.SN + ".xml";
                    xml.Serialize(new StreamWriter(XmlFilename), Secret);
                    break;

                default:
                    break;
                }
                rowCount++;
            }
        }
Beispiel #3
0
        /// <summary>
        /// 奥秘是否命中
        /// </summary>
        /// <param name="SecretCardSN"></param>
        /// <param name="ActionCode"></param>
        /// <param name="HitMySelf">是否检查自己是否触发自己的奥秘</param>
        /// <returns></returns>
        public static Boolean IsSecretHit(String SecretCardSN, String ActionCode, Boolean HitMySelf)
        {
            //HitMySelf
            //这里需要关注方向性问题
            SecretCard card        = (SecretCard)CardUtility.GetCardInfoBySN(SecretCardSN);
            var        actiontype  = Card.Server.ActionCode.GetActionType(ActionCode);
            var        actionField = ActionCode.Split(Card.CardUtility.strSplitMark.ToCharArray());
            Boolean    IsHit       = false;

            switch (card.Condition)
            {
            case SecretCondition.对方召唤随从:
                if (HitMySelf)
                {
                    //在自己的回合检查否触发自己的奥秘,如果是召唤系的
                    //SUMMON#YOU#M000001
                    //HitMySelf的时候,是YOU
                    if (actiontype == Server.ActionCode.ActionType.Summon && actionField[1] == CardUtility.strYou)
                    {
                        IsHit = true;
                    }
                }
                else
                {
                    //在别人的回合检查否触发自己的奥秘,是ME
                    if (actiontype == Server.ActionCode.ActionType.Summon && actionField[1] == CardUtility.strMe)
                    {
                        IsHit = true;
                    }
                    if (actiontype == Server.ActionCode.ActionType.UseMinion)
                    {
                        IsHit = true;
                    }
                }
                break;

            default:
                break;
            }
            return(IsHit);
        }
Beispiel #4
0
 /// <summary>
 /// 奥秘
 /// </summary>
 /// <param name="target"></param>
 /// <param name="workbook"></param>
 private void Secret(TargetType target, dynamic workbook)
 {
     if (Directory.Exists(XmlFolderPicker.SelectedPathOrFileName + "\\Secret\\"))
     {
         Directory.Delete(XmlFolderPicker.SelectedPathOrFileName + "\\Secret\\", true);
     }
     Directory.CreateDirectory(XmlFolderPicker.SelectedPathOrFileName + "\\Secret\\");
     //奥秘的导入
     dynamic worksheet = workbook.Sheets(4);
     int rowCount = 4;
     while (!String.IsNullOrEmpty(worksheet.Cells(rowCount, 2).Text))
     {
         Card.SecretCard Secret = new Card.SecretCard();
         Secret.SN = worksheet.Cells(rowCount, 2).Text;
         Secret.Name = worksheet.Cells(rowCount, 3).Text;
         Secret.Description = worksheet.Cells(rowCount, 4).Text;
         Secret.Class = CardUtility.GetEnum<Card.CardUtility.ClassEnum>(worksheet.Cells(rowCount, 5).Text, Card.CardUtility.ClassEnum.中立);
         Secret.StandardCostPoint = CardUtility.GetInt(worksheet.Cells(rowCount, 7).Text);
         Secret.ActualCostPoint = Secret.StandardCostPoint;
         Secret.Rare = CardUtility.GetEnum<Card.CardBasicInfo.稀有程度>(worksheet.Cells(rowCount, 12).Text, CardBasicInfo.稀有程度.白色);
         Secret.IsCardReady = !String.IsNullOrEmpty(worksheet.Cells(rowCount, 13).Text);
         Secret.Condition = CardUtility.GetEnum<Card.SecretCard.SecretCondition>(worksheet.Cells(rowCount, 14).Text,SecretCard.SecretCondition.对方召唤随从);
         Secret.AdditionInfo = worksheet.Cells(rowCount, 15).Text;
         switch (target)
         {
             case TargetType.MongoDB:
                 //innerCollection.Insert<Card.SecretCard>(Secret);
                 break;
             case TargetType.Xml:
                 XmlSerializer xml = new XmlSerializer(typeof(Card.SecretCard));
                 String XmlFilename = XmlFolderPicker.SelectedPathOrFileName + "\\Secret\\" + Secret.SN + ".xml";
                 xml.Serialize(new StreamWriter(XmlFilename), Secret);
                 break;
             default:
                 break;
         }
         rowCount++;
     }
 }