本文整理汇总了C#中Armor.ApplyArmor方法的典型用法代码示例。如果您正苦于以下问题:C# Armor.ApplyArmor方法的具体用法?C# Armor.ApplyArmor怎么用?C# Armor.ApplyArmor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Armor
的用法示例。
在下文中一共展示了Armor.ApplyArmor方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateArmorAndApplyItWithNegativeValues
public void CreateArmorAndApplyItWithNegativeValues()
{
string Name = "";
float Value = -10.0f;
float dmgVal = 100;
Armor a = new Armor(Name, Value);
float reduced = a.ApplyArmor(dmgVal);
Assert.IsTrue(reduced == (137.5f));
}
示例2: CreateCharacterWithPrimaryStatsAndScaleArmorAndModifyArmorMeanwhile
public void CreateCharacterWithPrimaryStatsAndScaleArmorAndModifyArmorMeanwhile()
{
//primary
var strenght = new Stat("Strenght", 10f, 1f);
var armorModified = new Armor("Armor", 3);
var armorFlat = new Armor("Armor", 3);
ReferenceStatModifier m = new ReferenceStatModifier(strenght, 0.1f);
armorModified.AddModifier(m);
float dmgValue = 100.0f;
var result1 = armorFlat.ApplyArmor(dmgValue);
var result2 = armorModified.ApplyArmor(dmgValue);
Assert.IsTrue(result1 > result2);
strenght.BaseValue += 10;
var result3 = armorModified.ApplyArmor(dmgValue);
Assert.IsTrue(result2 > result3);
}
示例3: CreateArmorAndApplyIt
public void CreateArmorAndApplyIt()
{
string Name = "";
float Value = 10.0f;
float dmgVal = 100;
Armor a = new Armor(Name, Value);
float reduced = a.ApplyArmor(dmgVal);
Assert.IsTrue(a.Reduction == 0.375f);
Assert.IsTrue(reduced == (62.5f));
}
示例4: CreateCharacterWithPrimaryStatsAndInflictPhysicDamage
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);
}