public void CreateAndModifyHealthWithRescaleStat() { string name = "Strenght"; float value = 20.0f; float firstValue = 0.0f; float secondValue = 0.0f; float firstPercentage = 0.0f; float secondPercentage = 0.0f; Stat stat = new Stat(name, value); // string hName = "Health"; DerivativeStat hp = new DerivativeStat(stat, StatisticConstants.STRENGHT_TO_HEALTH_SCALE); hp.ModifyValue(-100.0f); firstValue = hp.CurrentValue; firstPercentage = hp.Percentage; stat.BaseValue -= value / 2; secondValue = hp.CurrentValue; secondPercentage = hp.Percentage; // Assert.IsTrue(firstValue > secondValue); Assert.IsTrue(firstPercentage == secondPercentage); }
public MokupMember(int id, float agilityValue) { Id = id; Statistics = new List <Stat>(); Attributes = new List <DerivativeStat>(); var str = new Stat("Strenght", 10); Statistics.Add(str); var agi = new Stat("Agility", agilityValue); Statistics.Add(agi); var intel = new Stat("Intelligence", 10); Statistics.Add(intel); var health = new DerivativeStat(str, 10); health.Name = "Health"; var mana = new DerivativeStat(intel, 17); mana.Name = "Mana"; Attributes.Add(health); Attributes.Add(mana); }
public void CreateAndModifyHealthWithRescaleStat() { string name = "Strenght"; float value = 20.0f; float firstValue = 0.0f; float secondValue = 0.0f; float firstPercentage = 0.0f; float secondPercentage = 0.0f; Stat stat = new Stat(name, value); // string hName = "Health"; DerivativeStat hp = new DerivativeStat(stat, StatisticConstants.STRENGHT_TO_HEALTH_SCALE); hp.ModifyValue(-100.0f); firstValue = hp.CurrentValue; firstPercentage = hp.Percentage; stat.BaseValue -= value/2; secondValue = hp.CurrentValue; secondPercentage = hp.Percentage; // Assert.IsTrue(firstValue > secondValue); Assert.IsTrue(firstPercentage == secondPercentage); }
public void CreateAbilityWithCostNotEnoughRessourceWithCooldown() { //create a mana stat float IntManaScale = 17.0f; Stat intStat = new Stat("Intel", 15); DerivativeStat manaPool = new DerivativeStat(intStat, IntManaScale); Ability ability = new Ability("MyAbility", manaPool); ability.Description = "MyDescription"; ability.GetType = AbilityType.Active; ability.Cost = 100.0f; ability.Cooldown = new Osiris.Ability.Cooldown(0, 10); Assert.IsTrue(ability.Cooldown.OnCooldown); Assert.IsFalse(ability.Cooldown.IsReady); ability.Cooldown.Step(2); ability.Cooldown.Step(2); ability.Cooldown.Step(2); ability.Cooldown.Step(2); ability.Cooldown.Step(2); Assert.IsFalse(ability.Cooldown.OnCooldown); Assert.IsTrue(ability.Cooldown.IsReady); }
public Spell(string cName, Stat dmgModifier, DerivativeStat costStat, float DamageScale, float baseDamage, float spellCost) : base(cName, costStat) { Cost = spellCost; DamageModifier = dmgModifier; damageScale = DamageScale; _baseDamage = baseDamage; }
public void CreateAndModifyHealthStat() { string name = "sdsd"; float value = 20.0f; Stat stat = new Stat(name, value); string hName = "Health"; DerivativeStat hp = new DerivativeStat(stat, StatisticConstants.STRENGHT_TO_HEALTH_SCALE); hp.ModifyValue(-100.0f); Assert.IsTrue(hp.CurrentValue == 280); Assert.IsTrue(hp.MaxValue == value * StatisticConstants.STRENGHT_TO_HEALTH_SCALE); }
public void CreateHealthStat() { string name = "sdsd"; float value = 20.0f; Stat stat = new Stat(name, value); string hName = "Health"; DerivativeStat hp = new DerivativeStat(stat, StatisticConstants.STRENGHT_TO_HEALTH_SCALE); Assert.IsTrue(hp.CurrentValue == value * StatisticConstants.STRENGHT_TO_HEALTH_SCALE); Assert.IsTrue(hp.MaxValue == value * StatisticConstants.STRENGHT_TO_HEALTH_SCALE); }
public void CreateAbilityWithCost() { //create a mana stat float IntManaScale = 17.0f; Stat intStat = new Stat("Intel", 15); DerivativeStat manaPool = new DerivativeStat(intStat, IntManaScale); Ability ability = new Ability("MyAbility", manaPool); ability.Description = "MyDescription"; ability.GetType = AbilityType.Active; ability.Cost = 100.0f; Assert.IsTrue(ability.Name == "MyAbility"); Assert.IsTrue(ability.HasEnoughRessourceToCast); }
public void CreateCharacterWithPrimaryStatsAndRemoveMana() { //primary var strenght = new Stat("Strenght", 10f, 1f); var agility = new Stat("Agility", 10f, 1f); var intelligence = new Stat("Intelligence", 10f, 1f); //derivative var health = new DerivativeStat(strenght, 10); var mana = new DerivativeStat(intelligence, 17); var armor = new Armor("Armor", 3); var magicResist = new Armor("Magic Resist", 10, 0.02f); var manaConsumption = 10; mana.ModifyValue(manaConsumption * -1); Assert.IsTrue(mana.CurrentValue == 160); }
public void CreateCharacterWithPrimaryStatsAndInflictMagicDamage() { //primary var strenght = new Stat("Strenght", 10f, 1f); var agility = new Stat("Agility", 10f, 1f); var intelligence = new Stat("Intelligence", 10f, 1f); //derivative var health = new DerivativeStat(strenght, 10); var mana = new DerivativeStat(intelligence, 17); var armor = new Armor("Armor", 3); var magicResist = new Armor("Magic Resist", 10, 0.02f); var dmg = 25; float dmgReducedByArmor = magicResist.ApplyArmor(dmg); Assert.IsTrue(health.CurrentValue == 100); health.ModifyValue(dmgReducedByArmor * -1); Assert.AreEqual(health.CurrentValue, 100 - dmgReducedByArmor); }
public void CreateAbilityWithManaCostFromIntel() { float SpellCost = 133; float spellBaseDmg = 100; float spellScaleFactor = 3; float intelStats = 10; var intel = new Stat("Intelligence", intelStats); var mana = new DerivativeStat(intel, 20); mana.Name = "mana"; var fireballSpell = new Spell("Fireball", intel, mana, spellScaleFactor, spellBaseDmg, SpellCost); Assert.IsTrue(fireballSpell.HasEnoughRessourceToCast); var manaAmmountBeforeSpellcast = mana.CurrentValue; var dmg = fireballSpell.Cast(); var manaAmmountAfterSpellCast = mana.CurrentValue; Assert.IsTrue(manaAmmountBeforeSpellcast - manaAmmountAfterSpellCast == SpellCost); Assert.AreEqual(dmg, (spellBaseDmg + (intelStats * spellScaleFactor))); }
public Ability(string cName, DerivativeStat cDerivative) { Name = cName; costDerivative = cDerivative; Cooldown = new Cooldown(0, 0); }
public void CreateCharacterWithPrimaryStatsAndInflictPhysicDamage() { //primary var strenght = new Stat("Strenght", 10f, 1f); var agility = new Stat("Agility", 10f, 1f); var intelligence = new Stat("Intelligence", 10f, 1f); //derivative var health = new DerivativeStat(strenght, 10); var mana = new DerivativeStat(intelligence, 17); var armor = new Armor("Armor", 3); var magicResist = new Armor("Magic Resist", 10, 0.02f); var dmg = 25; float dmgReducedByArmor = armor.ApplyArmor(dmg); Assert.IsTrue(health.CurrentValue == 100); health.ModifyValue(dmgReducedByArmor * -1); Assert.AreEqual(health.CurrentValue, 100 - dmgReducedByArmor); }