Beispiel #1
0
        public Entity(Simulation s, MobType type, int level, int armor = 0, int maxLife = 1, Dictionary <School, int> magicResist = null)
            : base(s)
        {
            Type    = type;
            Level   = level;
            Armor   = armor;
            MaxLife = maxLife;

            ResistChances = new Dictionary <School, Dictionary <double, double> >();
            MagicResist   = new Dictionary <School, int>();
            if (magicResist == null)
            {
                foreach (School school in (School[])Enum.GetValues(typeof(School)))
                {
                    MagicResist.Add(school, 0);
                    ResistChances.Add(school, Simulation.ResistChances(MagicResist[school]));
                }
            }
            else
            {
                foreach (School school in (School[])Enum.GetValues(typeof(School)))
                {
                    MagicResist.Add(school, Math.Max(0, magicResist.ContainsKey(school) ? magicResist[school] : (magicResist.ContainsKey(School.Magical) ? magicResist[School.Magical] : 0)));
                    ResistChances.Add(school, Simulation.ResistChances(MagicResist[school]));
                }
            }

            Reset();
        }