public void BattleManager_StopsDanceEffectsIfOwnerDies() { const int expectedHuman2RemainingHealth = 2; const int human2Health = 4; int enemy2Strength = (human2Health + _human2.Defense) - expectedHuman2RemainingHealth; TestDoNothingMove doNothing1 = (TestDoNothingMove)TestMoveFactory.Get(moveType: BattleMoveType.DoNothing); string dangerDanceMessage = "danced the danger dance"; doNothing1.SetMessage(dangerDanceMessage); TestDanceMove dangerDance = (TestDanceMove)TestMoveFactory.Get(moveType: BattleMoveType.Dance); dangerDance.SetDuration(2); dangerDance.AddEffect(new StatMultiplierFieldEffect(TargetType.EnemyTeam, "danger dance", StatType.Strength, 2)); dangerDance.SetDanceEffect(DanceEffectType.Danger); dangerDance.AddMove(doNothing1); _human1.SetMove(dangerDance); _human1.SetMoveTarget(_human1); _human1.SetSpeed(2); _human1.SetHealth(10); _human2.SetHealth(human2Health); _human2.SetMove(_doNothingMove, 1); //end the battle after the first round _human2.SetMove(_runawayMove); _human2.SetMoveTarget(_human2); _human2.SetSpeed(3); _enemy1.SetMove(_basicAttack); _enemy1.SetMoveTarget(_human1); int human1DefenseAndHealth = _human1.Defense + _human1.MaxHealth; int enemy1Strength = human1DefenseAndHealth / 2; _enemy1.SetStrength(enemy1Strength); _enemy1.SetSpeed(1); _enemy2.SetMove(_basicAttack); _enemy2.SetMoveTarget(_human2); _enemy2.SetStrength(enemy2Strength); _chanceService.PushEventsOccur(true, false, true, false); //set up attacks hitting and not crit'ing _battleManager.Battle(_humanTeam, _enemyTeam); Assert.AreEqual(0, _human1.CurrentHealth, "enemy1 attack should have doubled, causing enough damage to kill human1"); Assert.AreEqual(expectedHuman2RemainingHealth, _human2.CurrentHealth, "The effect raising enemy attack should have been lifted when _human1 died"); }
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 TestBattleManager(_chanceService, _input, _output); _combiner = new TestFieldEffectCombiner(); _logger = new EventLogger(); _enemy1 = (TestEnemyFighter)TestFighterFactory.GetFighter(TestFighterType.TestEnemy, 1); _enemy1.SetDefense(OriginalDefense); _enemy2 = (TestEnemyFighter)TestFighterFactory.GetFighter(TestFighterType.TestEnemy, 1); _enemy2.SetDefense(OriginalDefense); _enemyTeam = new Team(_menuManager, _enemy1, _enemy2); _human1 = (TestHumanFighter)TestFighterFactory.GetFighter(TestFighterType.TestHuman, 1); _human1.SetDefense(OriginalDefense); _human2 = (TestHumanFighter)TestFighterFactory.GetFighter(TestFighterType.TestHuman, 1); _human2.SetDefense(OriginalDefense); _humanTeam = new TestTeam(_human1, _human2); _testTechnique = (TestDanceMove)TestMoveFactory.Get(TargetType.Field, moveType: BattleMoveType.Dance); _testTechnique.AddEffect(_raiseTeamDefense50Percent); _testTechnique.AddEffect(_lowerEnemyDefense50Percent); _testTechnique.SetDuration(_testTechniqueDefaultDuration); _testTechnique.SetDanceEffect(DanceEffectType.Fire); var firstTurn = (TestDoNothingMove)TestMoveFactory.Get(moveType: BattleMoveType.DoNothing); firstTurn.SetMessage(FirstTurnMessage); _testTechnique.AddMove(firstTurn); var secondTurn = (TestDoNothingMove)TestMoveFactory.Get(moveType: BattleMoveType.DoNothing); secondTurn.SetMessage("Continue the Defense dance"); _testTechnique.AddMove(secondTurn); }