Ejemplo n.º 1
0
        public void SerializeSkills()
        {
            IEntitySkills skills      = new EntitySkills(skillValues);
            IEntitySkills skillsClone = Serializer.DeepClone(skills);

            Assert.AreEqual(skillsClone.Get(SkillType.LightArmor), skills.Get(SkillType.LightArmor));
            Assert.AreEqual(skillsClone.Get(SkillType.HeavyArmor), skills.Get(SkillType.HeavyArmor));
            Assert.AreEqual(skillsClone.Get(SkillType.LightBlade), skills.Get(SkillType.LightBlade));
            Assert.AreEqual(skillsClone.Get(SkillType.HeavyBlade), skills.Get(SkillType.HeavyBlade));
            Assert.AreEqual(skillsClone.Get(SkillType.BluntWeapon), skills.Get(SkillType.BluntWeapon));
            Assert.AreEqual(skillsClone.Get(SkillType.Sneak), skills.Get(SkillType.Sneak));
            Assert.AreEqual(skillsClone.Get(SkillType.Pickpocket), skills.Get(SkillType.Pickpocket));
            Assert.AreEqual(skillsClone.Get(SkillType.LockPicking), skills.Get(SkillType.LockPicking));
        }
Ejemplo n.º 2
0
        public Entity(Guid id, IEntityInfo info, IEntitySkills skills, IEntityStats stats, IInventory inventory, IEntityAbility abilities)
        {
            Debug.Assert(info != null, "Info cannot be null");
            Debug.Assert(stats != null, "Stats cannot be null");
            Debug.Assert(inventory != null, "inventory cannot be null");
            Debug.Assert(id != null && id != Guid.Empty, "invalid ID");

            this.ID        = id;
            this.Stats     = stats;
            this.Skills    = skills;
            this.Info      = info;
            this.Inventory = inventory;
            this.Abilities = abilities;
            this.MaxHealth = this.Stats.Get(StatType.Constitution) * 10;
            this.Health    = this.MaxHealth;
            this.Effects   = new List <Effect>();
        }