Exemplo n.º 1
0
 public override void SetData(ActiveCard card1)
 {
     card = card1.Card;
     if (card1.Level > 1)
     {
         monster.UpgradeToLevel(card1.Level);
     }
 }
Exemplo n.º 2
0
 public override void SetData(DeckCard card1)
 {
     card = card1;
     if (card1.Level > 1)
     {
         monster.UpgradeToLevel(card1.Level);
     }
 }
Exemplo n.º 3
0
 public void ChangeDeck(DeckCard[] decks)
 {
     Page = 0;
     tar = -1;
     isDirty = true;
     dcards = decks;
     Array.Sort(dcards, new DeckSelectCardRegion.CompareDeckCardByStar());
     CardTotalCount = decks.Length;
 }
Exemplo n.º 4
0
        private static void MakeLoad(string name, int level)
        {
            int cardLevel = ConfigData.GetLevelExpConfig(level).TowerLevel;

            var          deck = new List <DeckCard>();
            StreamReader sr   = new StreamReader(DataLoader.Read("Deck", string.Format("{0}.txt", name)));

            int[] starCount = { 0, 0, 0, 0, 0, 0, 0, 0 }; //1-7
            for (int i = 0; i < GameConstants.DeckCardCount; i++)
            {
                var line = sr.ReadLine();
                if (line == null)
                {
                    break;
                }
                if (line.Contains("//"))
                {
                    int index = line.IndexOf("//"); //去除注释
                    line = line.Substring(0, index);
                }

                string[] datas  = line.Split('=');
                int      cardId = 0;

                string tpStr  = datas[0].Trim();
                string valStr = datas[1].Trim();
                if (tpStr == "Id")
                {
                    cardId = int.Parse(valStr);
                }
                else if (tpStr == "Rand")
                {
                    var    infos      = valStr.Split('|');
                    string catalog    = infos[0];
                    var    keyId      = int.Parse(infos[1]);
                    string pickMethod = "atwill";
                    if (infos.Length > 2)
                    {
                        pickMethod = infos[2];
                    }
                    cardId = CheckRandom(catalog, keyId, pickMethod, starCount);
                }
                else
                {
                    throw new ApplicationException("card type error " + tpStr + "@" + name);
                }

                starCount[CardConfigManager.GetCardConfig(cardId).Star]++;
                var card = new DeckCard(cardId, (byte)cardLevel, 0);
                deck.Add(card);
            }
            sr.Close();
            deckCacheDict[name] = deck.ToArray();
        }
Exemplo n.º 5
0
        public void SetInfo(DeckCard dcard)
        {
            cid = dcard.BaseId;
            level = dcard.Level;
            lastCell = -1;
            skills = new List<MonsterSkill>();
            string effectName = "";
            if (cid > 0)
            {
                card = CardAssistant.GetCard(cid);
                virtualRegion.SetRegionInfo(3, CardConfigManager.GetCardConfig(cid).Quality+1);
                var jobId = CardConfigManager.GetCardConfig(cid).JobId;
                if (jobId > 0)
                {
                    jobId = ConfigData.GetJobConfig(jobId).JobIndex;
                }
                virtualRegion.SetRegionInfo(4, jobId);
                card.SetData(dcard);
                if (card.GetCardType() == CardTypes.Monster)
                {
                    MonsterCard monsterCard = card as MonsterCard;
                    if (monsterCard != null)
                    {
                        CheckMonster(monsterCard, ref effectName);
                    }
                }
            }

            string nowEffectName = "";
            if (coverEffect != null)
            {
                nowEffectName = coverEffect.Name;
            }

            if (effectName != nowEffectName)
            {
                if (effectName == "")
                {
                    coverEffect = null;
                }
                else
                {
                    coverEffect = new CoverEffect(EffectBook.GetEffect(effectName), new Point(X + 20, Y + 20), new Size(160, 180));
                }
            }

            tooltip.Hide(parent);

            if (Invalidate != null)
            {
                Invalidate();
            }
        }
Exemplo n.º 6
0
        public static DeckCard[] GetDeckByName(string name, int level)
        {
            deck = new List<DeckCard>();
            StreamReader sr = new StreamReader(DataLoader.Read("Deck", string.Format("{0}.dek", name)));

            for (int i = 0; i < GameConstants.DeckCardCount; i++)
            {
                string[] datas = sr.ReadLine().Split('\t');

                var readLevel = byte.Parse(datas[1]);//todo 需要做差异化,暂时只做角色等级/10
                var card = new DeckCard(int.Parse(datas[0]), (byte)(level/10+1), 0);
                deck.Add(card);
            }
            sr.Close();

            return deck.ToArray();
        }
Exemplo n.º 7
0
        public static DeckCard[] GetDeckByName(string name, int level)
        {
            if (!deckCacheDict.ContainsKey(name))
            {
                MakeLoad(name, level);
            }

            var deckTpCopy = deckCacheDict[name];
            var cards      = new DeckCard[30];

            for (int i = 0; i < cards.Length; i++)
            {
                cards[i] = new DeckCard(deckTpCopy[i].BaseId, deckTpCopy[i].Level, deckTpCopy[i].Exp);
            }

            return(cards);
        }
Exemplo n.º 8
0
 internal ActiveCards(DeckCard[] itsCards)
 {
     ActiveCard[] tcards = new ActiveCard[GameConstants.DeckCardCount];
     for (int i = 0; i < GameConstants.DeckCardCount; i++)
     {
         tcards[i] = new ActiveCard(itsCards[i]);
     }
     for (int i = 0; i < 100; i++)
     {
         int x = MathTool.GetRandom(GameConstants.DeckCardCount);
         int y = MathTool.GetRandom(GameConstants.DeckCardCount);
         ActiveCard temp = tcards[x];
         tcards[x] = tcards[y];
         tcards[y] = temp;
     }
     cards = new List<ActiveCard>(tcards);
     index = 0;
 }
Exemplo n.º 9
0
        public RandomPlayer(int id, bool isLeft, bool isplayerControl)
            : base(isplayerControl, isLeft)
        {
            PeopleId = id;

            PeopleConfig peopleConfig = ConfigData.GetPeopleConfig(id);
            Level = peopleConfig.Level;
            Job = UserProfile.InfoBasic.Job;

            EnergyGenerator.SetRateNpc(peopleConfig);

            DeckCard[] cd = new DeckCard[GameConstants.DeckCardCount];
            for (int i = 0; i < GameConstants.DeckCardCount; i++)
            {
                cd[i] = new DeckCard(CardConfigManager.GetRandomCard(0, -1), 1, 0);
            }
            Cards = new ActiveCards(cd);
            InitBase();
        }
Exemplo n.º 10
0
        public HumanPlayer(bool isLeft)
            : base(true, isLeft)
        {
            PeopleId = 0;
            Level = UserProfile.InfoBasic.Level;
            Job = UserProfile.InfoBasic.Job;
            
            DeckCard[] cd = new DeckCard[GameConstants.DeckCardCount];
            for (int i = 0; i < GameConstants.DeckCardCount; i++)
            {
                int id = UserProfile.InfoCard.SelectedDeck.GetCardAt(i);
                cd[i] = UserProfile.InfoCard.GetDeckCardById(id);
            }
            Cards = new ActiveCards(cd);

            int[] energyRate = {0, 0, 0};
            CalculateEquipAndSkill(UserProfile.InfoEquip.Equipon, energyRate);
            EnergyGenerator.SetRate(energyRate, UserProfile.InfoBasic.Job);

            InitBase();
        }
Exemplo n.º 11
0
        /// <summary>
        /// 添加卡牌,外层都会检查cid的合法性,所以里面不用在判断了
        /// </summary>
        /// <param name="cid">卡牌id</param>
        public DeckCard AddCard(int cid)
        {
            DeckCard card = new DeckCard(cid, 1, 0);
            var cardData = CardConfigManager.GetCardConfig(cid);
            if (GetCardCount(cid) >= GameConstants.CardLimit)
            {
                var myCard = GetDeckCardById(cid);
                myCard.AddExp(1);//多余的卡转化为经验值
                return myCard;//每种卡牌只能拥有1张
            }

            Cards.Add(card.BaseId, card);
            Newcards.Add(card.BaseId);
            if (Newcards.Count > 10)
                Newcards.RemoveAt(0);

            AchieveBook.CheckByCheckType("card");
            MainForm.Instance.AddTip(string.Format("|获得卡片-|{0}|{1}", HSTypes.I2QualityColor(cardData.Quality), cardData.Name), "White");

            return card;
        }
Exemplo n.º 12
0
        public void Update(DeckCard[] dcards)
        {
            int[] starCount = new []{0, 0, 0, 0, 0, 0, 0};
            string[] typeArray = new string[] { "直伤", "范围","控制", "辅助", "铺场", "防御" };
            int[] typeCount = new[] { 0, 0, 0, 0, 0, 0 };
            foreach (var deckCard in dcards)
            {
                if (deckCard.BaseId == 0)
                    continue;
                starCount[deckCard.Star-1]++;

                var cardData = CardConfigManager.GetCardConfig(deckCard.BaseId);
                if (cardData.Remark.Contains("直伤")) typeCount[0]++;
                if (cardData.Remark.Contains("范围")) typeCount[1]++;
                if (cardData.Remark.Contains("状态")) typeCount[2]++;
                if (cardData.Remark.Contains("治疗") || cardData.Remark.Contains("能量") || cardData.Remark.Contains("手牌")) typeCount[3]++;
                if (cardData.Remark.Contains("召唤")) typeCount[4]++;
                if (cardData.Remark.Contains("防御")) typeCount[5]++;
            }
            chartStar.SetData(new[]{"1","2","3","4","5","6","7"}, starCount);
            chartType.SetData(typeArray, typeCount);
        }
Exemplo n.º 13
0
        public int AddCard(DeckCard card)
        {
            int firstBlank = -1;
            int count = 0;
            int newCardJob = CardConfigManager.GetCardConfig(card.BaseId).JobId;
            for (int i = 0; i < GameConstants.DeckCardCount; i++)
            {
                var dcard = CardIds[i];

                if (dcard == -1 && firstBlank == -1)
                {
                    firstBlank = i;
                }
                else if (dcard != -1)
                {
                    DeckCard tCard = UserProfile.InfoCard.GetDeckCardById(dcard);
                    if (tCard.BaseId == card.BaseId)
                        return HSErrorTypes.DeckCardAlreadyIn;

                    int cardJob = CardConfigManager.GetCardConfig(tCard.BaseId).JobId;
                    if (newCardJob > 0 && cardJob > 0 && newCardJob != cardJob)
                        return HSErrorTypes.CardJobTwice;
                }
            }

            if (count >= GameConstants.CardLimit)
            {
                return HSErrorTypes.DeckCardTypeLimit;
            }
            if (firstBlank==-1)
            {
                return HSErrorTypes.DeckIsFull;
            }
            SetCardAt(firstBlank, card.BaseId);

            return HSErrorTypes.OK;
        }
Exemplo n.º 14
0
 public void ClearCard()
 {
     dcards[tar] = new DeckCard(0, 0, 0);
 }
Exemplo n.º 15
0
 public ActiveCard GetCopy()
 {
     DeckCard dc = new DeckCard(Card.BaseId, Card.Level, Card.Exp);
     var ac = new ActiveCard(dc);
     ac.MpCostChange = MpCostChange;
     ac.LpCostChange = LpCostChange;
     ac.PpCostChange = PpCostChange;
     ac.Lp2Mp = Lp2Mp;
     return ac;
 }
Exemplo n.º 16
0
 public ActiveCard(int baseid, byte level, ushort exp)
 {
     Id = World.WorldInfoManager.GetCardFakeId();
     Card = new DeckCard(baseid, level, exp);
     Level = Card.Level;
 }
Exemplo n.º 17
0
 public ActiveCard(DeckCard card)
 {
     this.Card = card;
     Id = World.WorldInfoManager.GetCardFakeId();
     Level = card.Level;
 }
Exemplo n.º 18
0
 public ActiveCard()
 {
     Card = new DeckCard(0,0,0);
 }
Exemplo n.º 19
0
 public WeaponCard(Weapon weapon)
 {
     this.weapon = weapon;
     card = new DeckCard(weapon.Id, 1, 0);
 }
Exemplo n.º 20
0
 public MonsterCard(Monster monster)
 {
     this.monster = monster;
     card = new DeckCard(monster.Id, 1, 0);
 }
Exemplo n.º 21
0
 public override void SetData(DeckCard card1)
 {
 }
Exemplo n.º 22
0
 public SpellCard(Spell spell)
 {
     this.spell = spell;
     card = new DeckCard(spell.Id, 1, 0);
 }
Exemplo n.º 23
0
        private void DrawOnDeckView(Graphics g, DeckCard card, int x, int y, bool isSelected, string attr)
        {
            CardAssistant.DrawBase(g, card.BaseId, x, y, cardWidth, cardHeight);
            if (isSelected)
            {
                var brushes = new SolidBrush(Color.FromArgb(130, Color.Yellow));
                g.FillRectangle(brushes, x, y, cardWidth, cardHeight);
                brushes.Dispose();
            }

            if (card.BaseId <= 0)
            {
                return;
            }

            var cardConfigData = CardConfigManager.GetCardConfig(card.BaseId);
            Font font = new Font("宋体", 5*1.33f, FontStyle.Regular, GraphicsUnit.Pixel);
            g.DrawString(("★★★★★★★★★★").Substring(10 - cardConfigData.Star), font, Brushes.Yellow, x + 3, y + 3);
            font.Dispose();

            var quality = cardConfigData.Quality + 1;
            g.DrawImage(HSIcons.GetIconsByEName("gem" + quality), x + cardWidth / 2 - 8, y + cardHeight - 20, 16, 16);

            var jobId = cardConfigData.JobId;
            if (jobId > 0)
            {
                var jobConfig = ConfigData.GetJobConfig(jobId);
                Brush brush = new SolidBrush(Color.FromName(jobConfig.Color));
                g.FillRectangle(brush, x + cardWidth - 24, y + 4, 20, 20);
                g.DrawImage(HSIcons.GetIconsByEName("job" + jobConfig.JobIndex), x + cardWidth - 24, y + 4, 20, 20);
                brush.Dispose();
            }

            if (attr.Contains("D"))
            {
                Image mark = PicLoader.Read("System", "MarkSelect.PNG");
                g.DrawImage(mark, x, y, cardWidth, cardHeight);
                mark.Dispose();
            }
            if (attr.Contains("N"))
            {
                Image mark = PicLoader.Read("System", "MarkNew.PNG");
                g.DrawImage(mark, x, y, 30, 30);
                mark.Dispose();
            }

            g.FillEllipse(Brushes.Black, x + 3, y + 4 + cardHeight - 26,16,16);
            Font fontsong = new Font("宋体", 9*1.33f, FontStyle.Bold, GraphicsUnit.Pixel);
            string text = string.Format("{0:00}", card.Level);
            g.DrawString(text, fontsong, Brushes.Yellow, x + 4, y + 4 + cardHeight-23);
            if (card.Exp >= ConfigData.GetLevelExpConfig(card.Level).CardExp)//可以升级
            {
                g.DrawString(text, fontsong, Brushes.Lime, x + 4, y + 4 + cardHeight - 23);
                Image mark = PicLoader.Read("System", "ArrowU.PNG");
                g.DrawImage(mark, x + 2, y + 4 + cardHeight - 43, 18, 16);
                mark.Dispose();
            }
            fontsong.Dispose();
        }