示例#1
0
        public void InitUnit(Player player)
        {
            int x = player.IsLeft ? 0 : ColumnCount - 1;
            int y = RowCount / 2;

            foreach (var unitInfo in bMap.Info)
            {
                var id = World.WorldInfoManager.GetCardFakeId();
                var heroData = new Monster(unitInfo.UnitId);
                var level = ConfigData.GetLevelExpConfig(player.Level).TowerLevel;
                LiveMonster lm = new LiveMonster(id, level, heroData, new Point((x + (player.IsLeft ? unitInfo.X : (-unitInfo.X))) * CardSize, (y + unitInfo.Y) * CardSize), player.IsLeft);
                BattleManager.Instance.MonsterQueue.Add(lm);
            }

            if (player.InitialMonster != null && player.InitialMonster.Length >= 3)
            {
                for (int i = 0; i < player.InitialMonster.Length; i+=3)
                {
                    int mid = player.InitialMonster[i];
                    int xoff = player.InitialMonster[i+1];
                    int yoff = player.InitialMonster[i+2];

                    var id = World.WorldInfoManager.GetCardFakeId();
                    var level = ConfigData.GetLevelExpConfig(player.Level).TowerLevel;
                    var mon = new Monster(mid);
                    mon.UpgradeToLevel(level);
                    var pos = new Point((x + xoff)*CardSize, yoff*CardSize);
                    LiveMonster lm = new LiveMonster(id, level, mon, pos, player.IsLeft);
                    BattleManager.Instance.MonsterQueue.Add(lm);
                }
            }
        }
示例#2
0
        public void Summon(int type, int id)
        {
            if (IsSummoned)
            {//召唤生物不能继续召唤,防止无限循环
                return;
            }

            List<Point> posLis = new List<Point>();
            if (type == 1)//上下各一个
            {
                int size = BattleManager.Instance.MemMap.CardSize;
                posLis.Add(new Point(Position.X, Position.Y - size));
                posLis.Add(new Point(Position.X, Position.Y + size));
            }
            else if (type == 2)//4格随机位置
            {
                posLis.Add(BattleLocationManager.GetMonsterNearPoint(Position, "around", IsLeft));
            }
            else if (type == 3)//后面
            {
                posLis.Add(BattleLocationManager.GetMonsterNearPoint(Position, "come", IsLeft));
            }
            else if (type == 4)//前面
            {
                posLis.Add(BattleLocationManager.GetMonsterNearPoint(Position, "back", IsLeft));
            }
            else if (type == 5)//4格位置
            {
                int size = BattleManager.Instance.MemMap.CardSize;
                posLis.Add(new Point(Position.X, Position.Y - size));
                posLis.Add(new Point(Position.X, Position.Y + size));
                posLis.Add(new Point(Position.X - size, Position.Y));
                posLis.Add(new Point(Position.X + size, Position.Y));
            }

            foreach (var pos in posLis)
            {
                if (BattleManager.Instance.MemMap.IsMousePositionCanSummon(pos.X, pos.Y))
                {
                    var mon = new Monster(id);
                    mon.UpgradeToLevel(Level);
                    LiveMonster newMon = new LiveMonster(World.WorldInfoManager.GetCardFakeId(), Level, mon, pos, IsLeft);
                    newMon.IsSummoned = true;
                    BattleManager.Instance.MonsterQueue.AddDelay(newMon);
                }
            }
        }
示例#3
0
        public void Transform(int monId)
        {
            if (IsHero)
            {
                NLog.Warn("hero cannot be Transform");
                return;
            }

            int cardId = Weapon == null ? 0 : Weapon.CardId;
            var savedWeapon = Weapon == null ? null : Weapon.GetCopy();
            DeleteWeapon();
            int lifp = Life * 100 / Avatar.Hp;
            MonsterCoverBox.RemoveAllCover();
            SkillManager.CheckRemoveEffect();
            OwnerPlayer.State.CheckMonsterEvent(false, this);
            Avatar = new Monster(monId);
            Avatar.UpgradeToLevel(Level);
            OwnerPlayer.State.CheckMonsterEvent(true, this);
            SetBasicData();
            MonsterCoverBox.CheckCover();
            SkillManager.CheckInitialEffect();
            if (cardId > 0)
            {
                AddWeapon(savedWeapon);
            }
            Life = Avatar.Hp * lifp / 100;
        }
示例#4
0
        public LiveMonster(int id, int level, Monster mon, Point point, bool isLeft)
        {
            hpBar = new HpBar();

            Id = id;
            Level = level;
            Avatar = mon;
            Avatar.UpgradeToLevel(level);          

            Position = point;
            IsLeft = isLeft;
            Action = 0;
            roundPast = 0;
            SkillManager = new SkillManager(this);
            AttackType = (int)CardElements.None;
            CanAttack = true;
            
            BuffManager = new BuffManager(this);
            aiController = new MonsterAi(this);
            LiveMonsterToolTip = new LiveMonsterToolTip(this);

            SetBasicData();
            Life = Avatar.Hp;
            MonsterCoverBox = new MonsterCoverBox(this);
        }
示例#5
0
        internal override void Init(int width, int height)
        {
            base.Init(width, height);

            heroData = new Monster(MonsterConfig.Indexer.KingTowerId);
            heroData.UpgradeToLevel(ConfigData.GetLevelExpConfig(UserProfile.Profile.InfoBasic.Level).TowerLevel);
            RefreshEquip();
            show = true;
        }
示例#6
0
        public void UseSideKick(LiveMonster lm, ActiveCard card)
        {
            if (!CheckUseCard(card))
            {
                return;
            }

            try
            {
                Monster mon = new Monster(card.CardId);
                mon.UpgradeToLevel(card.Level);
                BattleManager.Instance.BattleInfo.GetPlayer(IsLeft).MonsterAdd++;

                var tWeapon = new SideKickWeapon(lm, card.Level, mon);
                lm.AddWeapon(tWeapon);
            }
            catch (Exception e)
            {
                NLog.Warn(e);
                BattleManager.Instance.FlowWordQueue.Add(new FlowWord("未知错误", lm.Position, 0, "Red", 26, 0, 0, 2, 15), false);
                return;
            }

            CardManager.DeleteCardAt(SelectId);
        }
示例#7
0
        public void UseMonster(ActiveCard card, Point location)
        {
            if (!CheckUseCard(card))
            {
                return;
            }

            try
            {
                var mon = new Monster(card.CardId);
                mon.UpgradeToLevel(card.Level);
                BattleManager.Instance.BattleInfo.GetPlayer(IsLeft).MonsterAdd++;

                LiveMonster newMon = new LiveMonster(card.Id, card.Level, mon, location, IsLeft);
                BattleManager.Instance.MonsterQueue.Add(newMon);

                var addon = GetAllMonsterAddonAndClear();//这个属性目前可以来自药水
                if (addon.Length > 0)
                {
                    foreach (var add in addon)
                        newMon.AddBasicData(add[0], add[1]);
                }

                var rival = IsLeft ? BattleManager.Instance.PlayerManager.RightPlayer : BattleManager.Instance.PlayerManager.LeftPlayer;
                rival.CheckTrapOnSummon(newMon, rival, this);
            }
            catch (Exception e)
            {
                NLog.Warn(e);
                BattleManager.Instance.FlowWordQueue.Add(new FlowWord("未知错误", location, 0, "Red", 26, 0, 0, 2, 15), false);
                return;
            }

            CardManager.DeleteCardAt(SelectId);
        }
示例#8
0
 public void AddMonster(int cardId, int level,Point location)
 {
     int size = BattleManager.Instance.MemMap.CardSize;
     var truePos = new Point(location.X/size*size, location.Y/size*size);
     var mon = new Monster(cardId);
     mon.UpgradeToLevel(level);
     LiveMonster newMon = new LiveMonster(World.WorldInfoManager.GetCardFakeId(), level, mon, truePos, IsLeft);
     BattleManager.Instance.MonsterQueue.Add(newMon);
 }
示例#9
0
 public MonsterCard(Monster monster)
 {
     this.monster = monster;
     card = new DeckCard(monster.Id, 1, 0);
 }
示例#10
0
 private void ReinstallCardProducts()
 {
     int index = 1;
     foreach (var monsterConfig in ConfigData.MonsterDict.Values)
     {
         if (monsterConfig.IsSpecial > 0)
             continue;
         Monster mon = new Monster(monsterConfig.Id);
         int rate = GetSellRate(monsterConfig.Id);
         CardProductMarkTypes mark = CardProductMarkTypes.Null;
         if (monsterConfig.IsNew > 0)
         {
             rate = 100;
             mark = CardProductMarkTypes.New;
         }
         if (MathTool.GetRandom(100) < rate)
         {
             if (mark == 0)
             {
                 mark = mon.GetSellMark();
             }
             CardProducts.Add(new CardProduct(index++, mon.Id, (int)mark));
         }
     }
     foreach (var weaponConfig in ConfigData.WeaponDict.Values)
     {
         if (weaponConfig.IsSpecial > 0)
             continue;
         Weapon wpn = new Weapon(weaponConfig.Id);
         int rate = GetSellRate(weaponConfig.Id);
         CardProductMarkTypes mark = CardProductMarkTypes.Null;
         if (weaponConfig.IsNew > 0)
         {
             rate = 100;
             mark = CardProductMarkTypes.New;
         }
         if (MathTool.GetRandom(100) < rate)
         {
             if (mark == 0)
             {
                 mark = wpn.GetSellMark();
             }
             CardProducts.Add(new CardProduct(index++, wpn.Id, (int)mark));
         }
     }
     foreach (var spellConfig in ConfigData.SpellDict.Values)
     {
         if (spellConfig.IsSpecial > 0)
             continue;
         Spell spl = new Spell(spellConfig.Id);
         int rate = GetSellRate(spellConfig.Id);
         CardProductMarkTypes mark = CardProductMarkTypes.Null;
         if (spellConfig.IsNew > 0)
         {
             rate = 100;
             mark = CardProductMarkTypes.New;
         }
         if (MathTool.GetRandom(100) < rate)
         {
             if (mark == 0)
             {
                 mark = spl.GetSellMark();
             }
             CardProducts.Add(new CardProduct(index++, spl.Id, (int)mark));
         }
     }
 }
示例#11
0
 public SideKickWeapon(LiveMonster lm, int level, Monster mon)
 {
     self = lm;
     avatar = mon;
     Level = level;
 }