public void TestDifficulty() { GenerationInfo.Difficulty = Difficulty.Easy; var gameEasy = CreateGame(true, 60); Assert.AreEqual(gameEasy.GameManager.GameState.CoreInfo.Difficulty, Difficulty.Easy); var plainEasy = PlainNormalEnemies.First(); var chempEasy = ChampionNormalEnemies.First(); GenerationInfo.Difficulty = Difficulty.Normal; var gameNormal = CreateGame(true); Assert.AreEqual(gameNormal.GameManager.GameState.CoreInfo.Difficulty, Difficulty.Normal); var plainNormal = PlainNormalEnemies.First(); var chempNormal = ChampionNormalEnemies.First(); GenerationInfo.Difficulty = Difficulty.Hard; var gameHard = CreateGame(true); Assert.AreEqual(gameHard.GameManager.GameState.CoreInfo.Difficulty, Difficulty.Hard); var plainHard = PlainNormalEnemies.First(); var chempHard = ChampionNormalEnemies.First(); Assert.Greater(plainNormal.Stats.Defense, plainEasy.Stats.Defense); Assert.Greater(chempNormal.Stats.Defense, chempEasy.Stats.Defense); Assert.Greater(chempHard.Stats.Defense, chempNormal.Stats.Defense); }
public void ScrollPowerVSMeleeTest(bool scroll) { var game = CreateGame(); var hero = game.Hero; Assert.Less(hero.Stats.MeleeAttack, 20); var enemy = PlainNormalEnemies.First(); enemy.Stats.SetNominal(Roguelike.Attributes.EntityStatKind.Health, 350); hero.Stats.SetNominal(Roguelike.Attributes.EntityStatKind.Mana, 250); var enemyHealth = enemy.Stats.Health; for (int i = 0; i < 10; i++) { Assert.True(UseFireBallSpellSource(hero, enemy, scroll)); GotoNextHeroTurn(); } Assert.Greater(enemyHealth, enemy.Stats.Health); var diffScroll = enemyHealth - enemy.Stats.Health; //melee enemyHealth = enemy.Stats.Health; var wpn = GenerateEquipment <Weapon>("rusty_sword"); SetHeroEquipment(wpn, CurrentEquipmentKind.Weapon); for (int i = 0; i < 10; i++) { enemy.OnMelleeHitBy(game.Hero); } var diffMelee = enemyHealth - enemy.Stats.Health; Assert.Greater(diffMelee, 20); Assert.Less(Math.Abs(diffMelee - diffScroll), 30);//TODO % }
public void TestPoisoned() { var game = CreateGame(); var healthStat = game.Hero.Stats.GetStat(EntityStatKind.Health); var health = healthStat.Value.CurrentValue; Assert.Greater(game.Hero.GetChanceToExperienceEffect(EffectType.Poisoned), 0); game.Hero.SetChanceToExperienceEffect(EffectType.Poisoned, 100); //make enemy poisonus var enemy = PlainNormalEnemies.First(); var poisonAttack = enemy.Stats.GetStat(EntityStatKind.PoisonAttack); poisonAttack.Value.Nominal = 10; game.Hero.OnMeleeHitBy(enemy); var le1 = game.Hero.GetFirstLastingEffect(EffectType.Poisoned); Assert.NotNull(le1); Assert.Less(healthStat.Value.CurrentValue, health); var turns = le1.PendingTurns; for (int i = 0; i < turns; i++) { game.GameManager.SkipHeroTurn(); GotoNextHeroTurn(); Assert.Less(healthStat.Value.CurrentValue, health); health = healthStat.Value.CurrentValue; } health = healthStat.Value.CurrentValue; for (int i = 0; i < 5; i++) { game.GameManager.SkipHeroTurn(); GotoNextHeroTurn(); Assert.AreEqual(healthStat.Value.CurrentValue, health); } }
public void TestBasicFightItemFactor(FightItemKind kind) { var game = CreateGame(true, 100); //take one which is active to make sure will have it's turn RevealAllEnemies(game); var enemy = PlainNormalEnemies.First(); PrepareEnemyToBeBeaten(enemy); var hero = game.GameManager.Hero; var fi = ActivateFightItem(kind, hero); var damage1 = fi.Damage; IncreaseAbility(hero, fi, 1); var damage2 = fi.Damage; Assert.Greater(damage2, damage1); Assert.Less(damage2 / damage1, 1.6f); }
public void TestBasicFightItem(FightItemKind kind) { var game = CreateGame(true, 100); //take one which is active to make sure will have it's turn RevealAllEnemies(game); var enemy = PlainNormalEnemies.First(); Assert.True(enemy.Revealed && enemy.Alive); PrepareEnemyToBeBeaten(enemy); var enemyBeginHealth = enemy.Stats.Health; var hero = game.GameManager.Hero; var fi = ActivateFightItem(kind, hero); var damage1 = fi.Damage; if (kind != FightItemKind.WeightedNet) { Assert.Greater(damage1, 0); } //Assert.AreEqual(enemy.OnHitBy(fi), HitResult.Hit); Assert.True(UseFightItem(hero, enemy, hero.ActiveProjectileFightItem)); if (kind != FightItemKind.WeightedNet)//TODO test range? { var chempAfter1HitHealth = enemy.Stats.Health; Assert.Greater(enemyBeginHealth, chempAfter1HitHealth); var firstDamageWithAblity = enemyBeginHealth - chempAfter1HitHealth; IncreaseAbility(hero, fi); fi = ActivateFightItem(kind, hero); var damage2 = fi.Damage; Assert.Greater(damage2, damage1); //Assert.Less(damage2/damage1, 1.6f); GotoNextHeroTurn(); Assert.True(UseFightItem(hero, enemy, hero.ActiveProjectileFightItem)); //enemy.OnHitBy(fi); GotoNextHeroTurn();//effect prolonged - make turn to see effect var chempAfter2HitHealth = enemy.Stats.Health; var secondDamageWithAblity = chempAfter1HitHealth - chempAfter2HitHealth; Assert.Greater(secondDamageWithAblity, firstDamageWithAblity); } else { int counter = 0; while (true) { var le = enemy.GetFirstLastingEffect(Roguelike.Effects.EffectType.WebTrap); if (le == null) { break; } counter++; Assert.AreEqual(le.Description, "Web Trap"); Assert.NotNull(le); Assert.AreEqual(enemyBeginHealth, enemy.Stats.Health); GotoNextHeroTurn(); } Assert.Greater(counter, 1); } }