public void PassiveMagicSkillTest() { // Check the basics Assert.AreEqual(0, passiveMagicSkill.Id); Assert.AreEqual("A +10 Buff to the user's strength.", passiveMagicSkill.Description); Assert.AreEqual("ShadowStrength (Cost: 10, Body +10 for 10 sec)", passiveMagicSkill.ToString()); // Check if the combination matches Assert.IsFalse(passiveMagicSkill.Match(new int[] { })); Assert.IsFalse(passiveMagicSkill.Match(new int[] { coin.Id })); Assert.IsFalse(passiveMagicSkill.Match(new int[] { herb.Id, coin.Id })); Assert.IsFalse(passiveMagicSkill.Match(new int[] { coin.Id, herb.Id })); Assert.IsTrue(passiveMagicSkill.Match(new int[] { herb.Id })); // Player triggers a Skill that is not learned yet bool triggered = player.TriggerMagicSkill(passiveMagicSkill.Id); Assert.IsFalse(triggered); // Player learns the Skill and triggers it player.LearnMagicSkill(passiveMagicSkill.Id); triggered = player.TriggerMagicSkill(passiveMagicSkill.Id); Assert.IsTrue(triggered); // Check the effect on the modified attribute Assert.AreEqual(10, player.Stats.Body.Value); // Player triggers it again right away, which is not possible due to cooldown time triggered = player.TriggerMagicSkill(passiveMagicSkill.Id); Assert.IsFalse(triggered); // Enemy uses the same passive skill enemy.LearnMagicSkill(passiveMagicSkill.Id); triggered = enemy.TriggerMagicSkill(passiveMagicSkill.Id); Assert.IsTrue(triggered); // Advance in Time and trigger again GameTime.time = 5; triggered = player.TriggerMagicSkill(passiveMagicSkill.Id); Assert.IsTrue(triggered); // Take the use costs into account GameTime.time = 10; triggered = player.TriggerMagicSkill(passiveMagicSkill.Id); Assert.IsFalse(triggered); }
protected override void WriteDataXML(XElement ele, ElderScrollsPlugin master) { XElement subEle; ele.TryPathTo("CreatureType", true, out subEle); subEle.Value = CreatureType.ToString(); ele.TryPathTo("Skill/Combat", true, out subEle); subEle.Value = CombatSkill.ToString(); ele.TryPathTo("Skill/Magic", true, out subEle); subEle.Value = MagicSkill.ToString(); ele.TryPathTo("Skill/Stealth", true, out subEle); subEle.Value = StealthSkill.ToString(); ele.TryPathTo("Health", true, out subEle); subEle.Value = Health.ToString(); WriteUnusedXML(ele, master); ele.TryPathTo("Damage", true, out subEle); subEle.Value = Damage.ToString(); ele.TryPathTo("Strength", true, out subEle); subEle.Value = Strength.ToString(); ele.TryPathTo("Perception", true, out subEle); subEle.Value = Perception.ToString(); ele.TryPathTo("Endurance", true, out subEle); subEle.Value = Endurance.ToString(); ele.TryPathTo("Charisma", true, out subEle); subEle.Value = Charisma.ToString(); ele.TryPathTo("Intelligence", true, out subEle); subEle.Value = Intelligence.ToString(); ele.TryPathTo("Agility", true, out subEle); subEle.Value = Agility.ToString(); ele.TryPathTo("Luck", true, out subEle); subEle.Value = Luck.ToString(); }