Esempio n. 1
0
        public static Attack AttackConstructor(MonsterTypes type, Entity attaker, List <Point> zone)
        {
            var multiplier = 1.0;

            switch (type)
            {
            case MonsterTypes.Dragon:
                multiplier = 2;
                break;

            case MonsterTypes.Hydra:
                multiplier = 2;
                break;

            case MonsterTypes.Wyvern:
                multiplier = 2;
                break;

            case MonsterTypes.Troll:
                multiplier = 2;
                break;

            case MonsterTypes.Orc:
                multiplier = 2;
                break;

            case MonsterTypes.Spider:
                multiplier = 1.5;
                break;
            }
            return(new Attack(zone, (int)(attaker.Stats.Strength * multiplier), attaker.Energy));
        }
Esempio n. 2
0
        public Monster NewRandomMonster(ILocation level, Point position, int floor)
        {
            var modifier = Utilities.PassPercentileRoll(SpecialMonsterChance) ?
                           Utilities.GetRandomFromList(MonsterModifiers) : null;

            return(new Monster(level, position, MonsterTypes[LevelFactor(floor, MonsterTypes.Count())], modifier));
        }
Esempio n. 3
0
        /// <summary>
        /// 获取副本地图中的总的怪物的个数 excludePets为true 表示排除 玩家的宠物怪【类型DSPetMonster】
        /// </summary>
        /// <param name="mapCode"></param>
        /// <param name="copyMapID"></param>
        /// <param name="monsterType"></param>
        /// <returns></returns>
        public int GetMapTotalMonsterNum(int mapCode, MonsterTypes monsterType, Boolean excludePets = true)
        {
            List <MonsterZone> monsterZoneList = null;

            if (!Map2MonsterZoneDict.TryGetValue(mapCode, out monsterZoneList))
            {
                return(0);
            }

            int totalNum = 0;

            for (int i = 0; i < monsterZoneList.Count; i++)
            {
                if (MonsterTypes.None != monsterType) //None表示获取所有的怪物
                {
                    if (monsterZoneList[i].MonsterType != monsterType)
                    {
                        continue;
                    }
                }

                //动态刷怪区域刷出的怪,都是属于玩家的怪,玩家可以带走并穿越地图
                if (excludePets && monsterZoneList[i].IsDynamicZone())
                {
                    continue;
                }

                totalNum += monsterZoneList[i].TotalNum;
            }

            return(totalNum);
        }
        public IMonster MakeCompletelyRandomMonster()
        {
            IMonster monster = MonsterRegistry.GetRandomMonster();

            // Get a random monster out of the 4 types, and name out of the pre-made list
            MonsterTypes type = (MonsterTypes)random.Next(4);
            string       name = names[random.Next(names.Count)];

            monster.Initialize(name, type);

            return(monster);
        }
Esempio n. 5
0
        public int GetBestTarget(int monsterIndex)
        {
            Monster mon         = (Monster)User.Field.Monsters[monsterIndex];
            int     targetIndex = -1;
            int     strongest   = 0;

            foreach (int i in GetViableTargets(monsterIndex))
            {
                Monster target = (Monster)Opponent.Field.Monsters[i];
                if (target.Attack > strongest || MonsterTypes.GetWeakness(target.Type) == mon.Type)
                {
                    strongest   = target.Attack;
                    targetIndex = i;
                }
            }
            return(targetIndex);
        }
        /// <summary>
        /// Добавить координаты точки появления монстров
        /// </summary>
        /// <param name="x">Координата по оси Х</param>
        /// <param name="y">Координата по оси У</param>
        public void AddMonsterSpawn(int x, int y, MonsterTypes type)
        {
            switch (type)
            {
            case MonsterTypes.BLINKY:
                MonsterSpawns.Add(new Blinky(x, y, 10));
                break;

            case MonsterTypes.INKY:
                MonsterSpawns.Add(new Inky(x, y, 10));
                break;

            case MonsterTypes.PINKY:
                MonsterSpawns.Add(new Pinky(x, y, 10));
                break;

            case MonsterTypes.CLYDE:
                MonsterSpawns.Add(new Clyde(x, y, 10));
                break;
            }
        }
Esempio n. 7
0
        public List <int> GetViableTargets(int monsterIndex)
        {
            List <int> targets = new List <int>();
            Monster    mon     = (Monster)User.Field.Monsters[monsterIndex];

            if (mon != null)
            {
                for (int i = 0; i < Opponent.Field.Length; i++)
                {
                    if (Opponent.Field.Monsters[i] != null)
                    {
                        Monster target = (Monster)Opponent.Field.Monsters[i];
                        if (target.Defense < mon.Attack || MonsterTypes.GetWeakness(target.Type) == mon.Type)
                        {
                            targets.Add(i);
                        }
                    }
                }
            }
            return(targets);
        }
Esempio n. 8
0
        public int GetMapTotalMonsterNum(int mapCode, MonsterTypes monsterType, bool excludePets = true)
        {
            List <MonsterZone> monsterZoneList = null;
            int result;

            if (!this.Map2MonsterZoneDict.TryGetValue(mapCode, out monsterZoneList))
            {
                result = 0;
            }
            else
            {
                int totalNum = 0;
                int i        = 0;
                while (i < monsterZoneList.Count)
                {
                    if (MonsterTypes.None == monsterType)
                    {
                        goto IL_47;
                    }
                    if (monsterZoneList[i].MonsterType == monsterType)
                    {
                        goto IL_47;
                    }
IL_76:
                    i++;
                    continue;
IL_47:
                    if (excludePets && monsterZoneList[i].IsDynamicZone())
                    {
                        goto IL_76;
                    }
                    totalNum += monsterZoneList[i].TotalNum;
                    goto IL_76;
                }
                result = totalNum;
            }
            return(result);
        }
Esempio n. 9
0
        public static string GetMonsterDescription(MonsterTypes monsterType, bool alive)
        {
            switch (monsterType)
            {
            case MonsterTypes.Fenrir:
                if (alive)
                {
                    return("The snarling wolf stares at you, the legendary Fenrir, you understand why the norse gods fear him");
                }
                else
                {
                    return("The wolf body lays on the floor, its coat could supply a whole village, Odin may now rest easy");
                }

            case MonsterTypes.Snake:
                if (alive)
                {
                    return("The giant snake surpasses moutains in size, destined to devour to world");
                }
                else
                {
                    return("The only the skin of the snake is left, will Loki seek revenge for this");
                }

            case MonsterTypes.IceGiant:
                if (alive)
                {
                    return("You feel your spine shiver with the cold, this giant is 4 times larger than you, and looks angry");
                }
                else
                {
                    return("The villagers will surely sing sonnets of your triumph over this abomination");
                }
            }
            return("");
        }
Esempio n. 10
0
 public Zombie(Coord position) : base(Color.Firebrick, Color.Black, 'Z', name: "Zombie", position)
 {
     Type = MonsterTypes.UNDEAD;
 }
Esempio n. 11
0
 public MonsterTile(MonsterTypes monsterType)
 {
     _monsterType = monsterType;
 }
 public void Initialize(string name, MonsterTypes type)
 {
     Name = name;
     Type = type;
 }
 public WellKnownMonster(string name, MonsterTypes type)
 {
     _isEvil = true;
     Initialize(name, type);
 }
Esempio n. 14
0
        public Monster(MonsterTypes type, Point position, Map map)
        {
            Type     = type;
            Position = position;
            map[Position].Content.Entity = this;
            switch (type)
            {
            case MonsterTypes.Slime:
                Skin           = Properties.Resources.slime;
                Stats          = new StatList(1, 1, 1, 1);
                HungerRate     = 0;
                DangerousLevel = 1;
                break;

            case MonsterTypes.Spider:
                Skin           = Properties.Resources.Spider;
                Stats          = new StatList(5, 5, 1, 4);
                HungerRate     = 1;
                DangerousLevel = 1;
                break;

            case MonsterTypes.Wolf:
                Skin           = Properties.Resources.wolf;
                Stats          = new StatList(5, 5, 10, 4);
                HungerRate     = 3;
                DangerousLevel = 1;
                break;

            case MonsterTypes.Goblin:
                Skin           = Properties.Resources.goblin;
                Stats          = new StatList(5, 5, 5, 7);
                HungerRate     = 2;
                DangerousLevel = 2;
                break;

            case MonsterTypes.Orc:
                Skin           = Properties.Resources.orc;
                Stats          = new StatList(10, 7, 10, 7);
                HungerRate     = 2;
                DangerousLevel = 2;
                break;

            case MonsterTypes.Troll:
                Skin           = Properties.Resources.troll;
                Stats          = new StatList(15, 5, 20, 5);
                HungerRate     = 1;
                DangerousLevel = 2;
                break;

            case MonsterTypes.Wyvern:
                Skin           = Properties.Resources.wyvern;
                Stats          = new StatList(15, 10, 20, 10);
                HungerRate     = 3;
                DangerousLevel = 3;
                break;

            case MonsterTypes.Hydra:
                Skin           = Properties.Resources.Hydra;
                Stats          = new StatList(20, 10, 50, 10);
                HungerRate     = 4;
                DangerousLevel = 3;
                break;

            case MonsterTypes.Dragon:
                Skin           = Properties.Resources.dragon;
                Stats          = new StatList(30, 10, 30, 15);
                HungerRate     = 5;
                DangerousLevel = 3;
                break;
            }
            if (monsterAttackZones.ContainsKey(type))
            {
                AttackZone = monsterAttackZones[type];
            }
            ViewRadius = Stats.Perception / 3 + 2;
            MaxEnergy  = Stats.Stamina;
            Energy     = MaxEnergy;
            MaxHP      = Stats.Stamina * 2;
            HP         = MaxHP;
            ExpGain    = Stats.Average();
            IsHungry   = true;
        }
Esempio n. 15
0
        /// <summary>
        /// 初始化怪
        /// </summary>
        public void LoadMonsters()
        {
            string fileName = string.Format("Config/Monsters.xml");

            XElement xml = GameManager.MonsterZoneMgr.AllMonstersXml;

            if (xml == null)
            {
                throw new Exception(string.Format("加载系统怪物配置文件:{0}, 失败。没有找到相关XML配置文件!", fileName));
            }

            XElement monsterXml = Global.GetSafeXElement(xml, "Monster", "ID", Code.ToString());

            //添加到怪物名称管理
            MonsterNameManager.AddMonsterName(Code, Global.GetSafeAttributeStr(monsterXml, "SName"));

            //首先根据地图编号定位地图文件

            fileName = string.Format("GuaiWu/{0}.xml",
                                     Global.GetSafeAttributeStr(monsterXml, "ResName"));

            string defaultFileName = string.Format("GuaiWu/ceshi_guaiwu.unity3d.xml");

            try
            {
                xml = XElement.Load(Global.ResPath(fileName));
            }
            catch (Exception)
            {
                xml = null;
            }

            if (null == xml)
            {
                LogManager.WriteLog(LogTypes.Info, string.Format("加载指定怪物的衣服文件:{0}, {1}, 失败。启用默认XML配置文件!", Global.GetSafeAttributeStr(monsterXml, "SName"), fileName));
                fileName = defaultFileName;

                xml = XElement.Load(Global.ResPath(fileName));
                if (null == xml)
                {
                    throw new Exception(string.Format("加载指定怪物的衣服代号:{0}, 失败。没有找到相关XML配置文件!", fileName));
                }
            }

            //先取子节点,便于获取
            XElement xmlFrameConfig = Global.GetSafeXElement(xml, "FrameConfig");
            XElement xmlSpeedConfig = Global.GetSafeXElement(xml, "SpeedConfig");
            double   moveSpeed      = Global.GetSafeAttributeDouble(xmlSpeedConfig, "UnitSpeed") / 100.0;

            double monsterSpeed = Global.GetSafeAttributeDouble(monsterXml, "MonsterSpeed"); //怪物移动的速度

            moveSpeed *= monsterSpeed;

            double maxLifeV  = (int)Global.GetSafeAttributeLong(monsterXml, "MaxLife");  //当前生命值
            double maxMagicV = (int)Global.GetSafeAttributeLong(monsterXml, "MaxMagic"); //当前魔法值

            if (maxLifeV <= 0)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("怪物部署的时,怪物的数据配置错误,生命值不能小于等于0: MonsterID={0}, MonsterName={1}",
                                                                  (int)Global.GetSafeAttributeLong(monsterXml, "ID"), Global.GetSafeAttributeStr(monsterXml, "SName")));

                return;
            }

            Monster monster = null;

            if (!IsFuBenMap) //如果不是副本地图
            {
                for (int i = 0; i < TotalNum; i++)
                {
                    //初始化怪物数据
                    monster = InitMonster(monsterXml, maxLifeV, maxMagicV, xmlFrameConfig, /*xmlPictureConfig, */ moveSpeed /*, speedTickList*/);
                    if (MonsterTypes.None == MonsterType)
                    {
                        MonsterType = (MonsterTypes)monster.MonsterType;
                    }

                    //加入当前区域队列
                    MonsterList.Add(monster);

                    //添加到全局的队列
                    GameManager.MonsterMgr.AddNewMonster(monster);
                }
            }
            else //如果是副本地图,则只生成一个怪物的样本
            {
                //初始化怪物数据
                monster = InitMonster(monsterXml, maxLifeV, maxMagicV, xmlFrameConfig, /*xmlPictureConfig, */ moveSpeed /*, speedTickList*/);
                if (MonsterTypes.None == MonsterType)
                {
                    MonsterType = (MonsterTypes)monster.MonsterType;
                }

                // SeedMonster = monster;
            }
        }
Esempio n. 16
0
 public BossLoot()
 {
     LootPoolList.Add(new LootPoolEntry(SettlersBuiltIn.ItemTypes.MANA, 1, 20));
     MonsterTypes.Add("Boss");
 }
Esempio n. 17
0
 public DynamicPlayerGeneratedMonster(string name, MonsterTypes type)
 {
     _isEvil = false;
     Initialize(name, type);
 }
Esempio n. 18
0
 public MonsterCard(string name, int attack, Element element, MonsterTypes mType) : base(name, attack, element, CardType.Monster)
 {
     this.monstertype = mType;
 }