public void FearTest() { // Test that Debuffs can be added and have intended effects Monster monster = MonsterManager.GetMonsterByName("LegEater"); Assert.AreEqual(0, monster.GetDebuffStacks(Debuff.Fear)); Assert.AreEqual(180, monster.Fear); int baseFear = monster.Fear; // Ensure stacks are cumulative and remove properly monster.AddDebuff(Debuff.Fear, 1); Assert.AreEqual(1, monster.GetDebuffStacks(Debuff.Fear)); Assert.AreEqual(baseFear + 20, monster.Fear); monster.AddDebuff(Debuff.Fear, 2); Assert.AreEqual(3, monster.GetDebuffStacks(Debuff.Fear)); Assert.AreEqual(baseFear + (3 * 20), monster.Fear); monster.RemoveDebuff(Debuff.Fear); Assert.AreEqual(0, monster.GetDebuffStacks(Debuff.Fear)); Assert.AreEqual(baseFear, monster.Fear); // Check overflow monster.AddDebuff(Debuff.Fear, 13); // 13 * 20 = 260 total Assert.AreEqual(184, monster.Fear); // 180 base + (260 % 256) }
public void GeneralDebuffTest() { // Setup Monster monster = new Monster(); // Test invalid arguments Assert.ThrowsException <ArgumentOutOfRangeException>(() => monster.AddDebuff(Debuff.Fear, -1)); Assert.ThrowsException <ArgumentOutOfRangeException>(() => monster.AddDebuff(Debuff.Fear, 17)); }
private void ApplyDebuff() { if (target.ElementType != elementType) //몬스터 속성타입과 타워 속성값이 같지 않다면 { float roll = Random.Range(0, 100); if (roll <= parent.Proc) //확률계산후 { target.AddDebuff(parent.GetDebuff()); //몬스터에게 디버프 적용 } } target.AddDebuff(parent.GetDebuff()); }
private void ApplyDebuff() { float roll = Random.Range(0, 100); if (roll < parent.ProcChance) { target.AddDebuff((parent.GetDebuff())); } }
private void ApplyDebuff(Monster monster) { if (monster.ElementType != elementType) { float roll = Random.Range(0, 100); if (roll <= parent.Proc) { monster.AddDebuff(parent.GetDebuff()); } } }
private void ApplyDebuff() { if (target.ElementType != elementType) // probability is implemented with applying the debuff only if the projectile element type is not equivalent to the monster's element type { float roll = Random.Range(0, 100); if (roll <= parent.Proc) { target.AddDebuff(parent.GetDebuff()); } } }
private void ApplyDebuff() { if (target.ElementType != elementType) { float roll = Random.Range(0, 100); //chance for debuff to be applied if (roll <= parent.Proc) { target.AddDebuff(parent.GetDebuff()); } } }
/// <summary> /// Tries to apply a debuff to the target /// </summary> private void ApplyDebuff() { //Checks if the target is immune to the debuff if (target.ElementType != element) { //Does a roll to check if we have to apply a debuff float roll = UnityEngine.Random.Range(0, 100); if (roll <= tower.Proc) { //applies the debuff target.AddDebuff(tower.GetDebuff()); } } }