public void ConditionalDanceMove_ExecutesAppropriateEffectWhenDanceNotInEffect([Values(DanceEffectType.Water, DanceEffectType.Wind)] DanceEffectType danceEffectType) { _testTechnique.ClearEffects(); _testTechnique.SetDanceEffect(DanceEffectType.Soul); RestorationBattleMoveEffect conditionalHealEffect = GetRestoreHealthEffect(danceEffectType); AttackBattleMove attackWithHeal = new AttackBattleMove("foo", TargetType.SingleEnemy, 100, 0, effects: conditionalHealEffect); _human2.SetMove(_testTechnique, 1); _human2.SetSpeed(1); const int initialHealth = 10; _human1.SetHealth(100, initialHealth); _human1.SetMove(attackWithHeal, 1); _chanceService.PushEventsOccur(true, false); //attack hits, is not crit _human1.SetStrength(_enemy1.MaxHealth); _human1.SetMoveTarget(_enemy1); _enemyTeam = new Team(_menuManager, _enemy1); _enemy1.SetDefense(0); _enemy1.SetMove(_doNothingMove); _enemy1.SetMoveTarget(_enemy1); _battleManager.Battle(_humanTeam, _enemyTeam); Assert.AreEqual(initialHealth, _human1.CurrentHealth, "Human1 should not have had their health altered, the active dance effect's didn't match the conditional heal!"); }
public void ConditionalDanceMove_ExecutesAppropriateEffectWhenDanceInEffect([Values(DanceEffectType.Fire, DanceEffectType.Danger)] DanceEffectType danceEffectType) { _testTechnique.ClearEffects(); _testTechnique.SetDanceEffect(danceEffectType); RestorationBattleMoveEffect conditionalHealEffect = GetRestoreHealthEffect(danceEffectType); AttackBattleMove attackWithHeal = new AttackBattleMove("foo", TargetType.SingleEnemy, 100, 0, effects: conditionalHealEffect); _human2.SetMove(_testTechnique, 1); _human2.SetSpeed(1); _human1.SetHealth(100, 10); _human1.SetMove(attackWithHeal, 1); _chanceService.PushEventsOccur(true, false); //attack hits, is not crit _human1.SetStrength(_enemy1.MaxHealth); _human1.SetMoveTarget(_enemy1); _enemyTeam = new Team(_menuManager, _enemy1); _enemy1.SetDefense(0); _enemy1.SetMove(_doNothingMove); _enemy1.SetMoveTarget(_enemy1); _battleManager.Battle(_humanTeam, _enemyTeam); Assert.AreEqual(20, _human1.CurrentHealth, "Human1 should have regained 10 HP when the attack was successful and the dance effect was active"); }
private AttackBattleMove GetNotEvadeRestoreHealthAttack(int percentage) { NotEvadedBattleCondition notEvadedCondition = new NotEvadedBattleCondition(); RestorationBattleMoveEffect restorationEffect = new RestorationBattleMoveEffect(RestorationType.Health, percentage, BattleMoveEffectActivationType.OnAttackHit, notEvadedCondition); CannotBeEvadedBattleMoveEffect cannotBeEvadedEffect = new CannotBeEvadedBattleMoveEffect(); BattleMoveEffect[] effects = { restorationEffect, cannotBeEvadedEffect }; AttackBattleMove attackMove = new AttackBattleMove("foo", TargetType.SingleEnemy, 100, 0, effects: effects); return(attackMove); }
public void RestoreManaEffect_AppropriatelyExecuted_AttackHits([Values(10, 20)] int restoreAmount) { _human.SetHealth(100, 10); _human.SetMana(100, 0); _restoreManaEffect = new RestorationBattleMoveEffect(RestorationType.Mana, restoreAmount, BattleMoveEffectActivationType.OnAttackHit); _attackWithRestoreManaEffect = new AttackBattleMove("", TargetType.SingleEnemy, 100, 0, effects: _restoreManaEffect); _human.SetMove(_attackWithRestoreManaEffect); _human.SetMoveTarget(_enemy); _chanceService.PushAttackHitsNotCrit(); //attack hits, not a crit _enemy.SetMove(_doNothingMove); _enemy.SetMoveTarget(_enemy); _battleManager.Battle(_humanTeam, _enemyTeam); Assert.AreEqual(restoreAmount, _human.CurrentMana, $"humman player's mana should have been restored by {restoreAmount} when the attack hit!"); Assert.AreEqual(10, _human.CurrentHealth, "humman player's health should have been unaffected by the restore effect!"); }
public void BattleManager_AppropriatelyTicksDownDanceEffectCounter([Values(DanceEffectType.Heart, DanceEffectType.Danger)] DanceEffectType danceEffectType) { const int danceDuration = 4; RestorationBattleMoveEffect conditionalHealEffect = GetRestoreHealthEffect(danceEffectType); AttackBattleMove attackWithHeal = new AttackBattleMove("foo", TargetType.SingleEnemy, 100, 0, effects: conditionalHealEffect); _testTechnique.ClearEffects(); _testTechnique.SetDanceEffect(danceEffectType); _testTechnique.SetDuration(danceDuration); _human1.SetMove(_testTechnique, 1); _human1.SetMove(_doNothingMove); _human1.SetMoveTarget(_human1); _human1.SetSpeed(1); _human2.SetHealth(100, 10); _human2.SetMove(attackWithHeal, 6); for (var i = 0; i < 6; ++i) { _chanceService.PushEventsOccur(true, false); //attack hits, does not miss } _human2.SetMove(_runawayMove); _human2.SetMoveTarget(_enemy1); _human2.SetStrength(_enemy1.Defense); _enemy1.SetHealth(100); _enemy1.SetMove(_doNothingMove); _enemy1.SetMoveTarget(_enemy1); _enemy2.SetHealth(100); _enemy2.SetMove(_doNothingMove); _enemy2.SetMoveTarget(_enemy2); _battleManager.Battle(_humanTeam, _enemyTeam); int expectedHealth = 10 + (danceDuration * 10); Assert.AreEqual(expectedHealth, _human2.CurrentHealth); //will be 20 higher if the effect doesn't wear off }
public void SetUp() { _input = new MockInput(); _output = new MockOutput(); _menuManager = new TestMenuManager(_input, _output); _chanceService = new MockChanceService(); _battleManager = new BattleManager(_chanceService, _input, _output); _human = (TestHumanFighter)TestFighterFactory.GetFighter(TestFighterType.TestHuman, 1); _humanTeam = new TestTeam(_menuManager, _human); _enemy = (TestEnemyFighter)TestFighterFactory.GetFighter(TestFighterType.TestEnemy, 1); _enemyTeam = new Team(_menuManager, _enemy); _doNothingMove = (DoNothingMove)MoveFactory.Get(BattleMoveType.DoNothing); _restoreHealthEffect = new RestorationBattleMoveEffect(RestorationType.Health, 5, BattleMoveEffectActivationType.OnAttackHit); _attackWithRestoreHealthEffect = new AttackBattleMove("foo", TargetType.SingleEnemy, 100, 10, effects: _restoreHealthEffect); _restoreManaEffect = new RestorationBattleMoveEffect(RestorationType.Mana, 5, BattleMoveEffectActivationType.OnAttackHit); _attackWithRestoreManaEffect = new AttackBattleMove("foo", TargetType.SingleEnemy, 100, 10, effects: _restoreManaEffect); }
public void MultipleEffects_Fired_OnAttackHit([Values(10, 20)] int restoreAmount) { _human.SetHealth(100, 10); _human.SetMana(100, 10); _restoreManaEffect = new RestorationBattleMoveEffect(RestorationType.Mana, restoreAmount, BattleMoveEffectActivationType.OnAttackHit); _restoreHealthEffect = new RestorationBattleMoveEffect(RestorationType.Health, restoreAmount, BattleMoveEffectActivationType.OnAttackHit); BattleMove attackWithRestoreEffects = new AttackBattleMove("", TargetType.SingleEnemy, 100, 0, effects: new BattleMoveEffect[] { _restoreManaEffect, _restoreHealthEffect }); _human.SetMove(attackWithRestoreEffects); _human.SetMoveTarget(_enemy); _chanceService.PushAttackHitsNotCrit(); //attack hits, not a crit _enemy.SetMove(_doNothingMove); _enemy.SetMoveTarget(_enemy); _battleManager.Battle(_humanTeam, _enemyTeam); int expectedCurrentAmount = 10 + restoreAmount; Assert.AreEqual(expectedCurrentAmount, _human.CurrentMana, $"humman player's mana should have been restored by {restoreAmount} when the attack hit!"); Assert.AreEqual(expectedCurrentAmount, _human.CurrentHealth, $"humman player's health should have been restored by {restoreAmount} when the attack hit!"); }
public void MultipleEffects_OnlyEffectsWhoseConditionsAreMet_AreFired([Values(10, 20)] int restoreAmount) { _human.SetHealth(100, 10); _human.SetMana(100, 10); _restoreManaEffect = new RestorationBattleMoveEffect(RestorationType.Mana, restoreAmount, BattleMoveEffectActivationType.OnAttackHit, new DanceBattleCondition(DanceEffectType.Soul)); _restoreHealthEffect = new RestorationBattleMoveEffect(RestorationType.Health, restoreAmount, BattleMoveEffectActivationType.OnAttackHit, new DanceBattleCondition(DanceEffectType.Fire)); BattleMove attackWithRestoreEffects = new AttackBattleMove("", TargetType.SingleEnemy, 100, 0, effects: new BattleMoveEffect[] { _restoreManaEffect, _restoreHealthEffect }); _human.SetMove(attackWithRestoreEffects); _human.SetMoveTarget(_enemy); _chanceService.PushAttackHitsNotCrit(); //attack hits, not a crit TestHumanFighter dancer = (TestHumanFighter)TestFighterFactory.GetFighter(TestFighterType.TestHuman, 1, "dancer"); TestDanceMove danceMove = new TestDanceMove("bar", TargetType.Field, 2); danceMove.SetDanceEffect(DanceEffectType.Fire); danceMove.AddMove(_doNothingMove); dancer.SetSpeed(1); dancer.SetMove(danceMove); dancer.SetMoveTarget(dancer); _humanTeam.Add(dancer, false); _enemy.SetMove(_doNothingMove); _enemy.SetMoveTarget(_enemy); _battleManager.Battle(_humanTeam, _enemyTeam); int expectedCurrentAmount = 10 + restoreAmount; Assert.AreEqual(10, _human.CurrentMana, "humman player's mana should not have been restored, the dance condition wasn't met!"); Assert.AreEqual(expectedCurrentAmount, _human.CurrentHealth, $"humman player's health should have been restored by {restoreAmount} when the attack hit!"); }