public static Dictionary<string, EntityRace> GetRaces()
 {
     Dictionary<string, EntityRace> entityRaces = new Dictionary<string, EntityRace>();
     entityRaces["Human"] =
         new EntityRace
             {
                 AttributeModifiers = new Attributes(),
                 // no modifiers,
                 Name = "Human"
             };
     return entityRaces;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Return an instance of an entity. The base attributes of an entity
        /// are based on the entity's class (warrior, barbarian, rogue, mage...)
        /// The attribute modifiers are based on the race.
        /// </summary>
        /// <param name="name"> </param>
        /// <param name="class"></param>
        /// <param name="race"></param>
        /// <param name="gender"></param>
        /// <param name="type"> </param>
        public Entity(Game game, string name, Gender gender, EntityType type, EntityClass @class, EntityRace race)
            : base(game)
        {
            this.Name = name;
            Attributes = @class.Attributes;
            AttributeModifiers = race.AttributeModifiers;
            Gender = gender;
            this.Type = type;
            Inventory = new Inventory();

            Health = CalculateVariableAttributeFromFormula(@class.HealthFormula);
            Mana = CalculateVariableAttributeFromFormula(@class.ManaFormula);
            Stamina = CalculateVariableAttributeFromFormula(@class.StaminaFormula);
            Speed = MathHelper.Clamp(CalculateFromFormula(@class.SpeedFormula), 1f, 6f);
            BaseAttack = CalculateFromFormula(@class.AttackFormula);
            BaseDamage = CalculateFromFormula(@class.DamageFormula);
            BaseDefense = CalculateFromFormula(@class.DefenseFormula);

            SpellModifiers = new List<Modifier>();
        }