public FighterGrouping GetGrouping(FighterGroupingConfiguration config) { FighterGrouping generatedGrouping = null; ShadeGroupingConfiguration shadeConfig = config as ShadeGroupingConfiguration; if (shadeConfig != null) { List <Shade> generatedFighters = new List <Shade>(); int minLevel = shadeConfig.MinLevel; for (int i = 0; i < shadeConfig.NumberOfShades; ++i) { int level = shadeConfig.MaxLevel == null ? minLevel : _chanceService.WhichEventOccurs(shadeConfig.MaxLevel.Value - minLevel) + minLevel; Shade generatedShade = FighterFactory.GetShade(level); generatedFighters.Add(generatedShade); } generatedGrouping = new ShadeFighterGrouping(_chanceService, generatedFighters.ToArray()); } return(generatedGrouping); }
public void BloodMove_MoreEffectiveForCopperBellThanCopperBell() { //arrange Shade shade = FighterFactory.GetShade(1); BattleMoveWithTarget moveWithTarget = new BattleMoveWithTargetAndNumberInput(_bloodMove, shade, _fighter, 0); _chanceService.PushEventsOccur(false, false); //act _copperBell.ExecuteMove(moveWithTarget); _silverBell.ExecuteMove(moveWithTarget); //assert List <double> chances = _chanceService.LastChanceVals; Assert.Greater(chances[0], chances[1]); }
public void CorrectlyRaisesMoveExecutorsMaxHealth_ByShadeLevel_DominatingMoveSucceeds([Range(1, 4)] int shadeLevel) { Shade shade = FighterFactory.GetShade(1, shadeLevel: shadeLevel); TestHumanFighter fighter = (TestHumanFighter)TestFighterFactory.GetFighter(TestFighterType.TestHuman, 1); const int initialMaxHealth = 10; fighter.SetHealth(initialMaxHealth); BattleMoveWithTargetAndNumberInput moveWithTarget = new BattleMoveWithTargetAndNumberInput(_bloodMove, shade, fighter, 1); _chanceService.PushEventOccurs(true); //act _copperBell.ExecuteMove(moveWithTarget); //assert int expectedMaxHealth = initialMaxHealth + shadeLevel; Assert.AreEqual(expectedMaxHealth, fighter.MaxHealth); }
public void BloodMove_DifferentShadeLevels_CorrectlyGeneratesDifferentChanceSuccessRates( [Range(1, 5)] int shadeLevel, [Range(0, 1)] int damage) { double expectedChance = damage == 0 ? 1.0 / 3 : 0.5; int levelDiff = shadeLevel - 1; double chanceDecrease = levelDiff * 0.1; expectedChance = Math.Max(expectedChance - chanceDecrease, 0.1); expectedChance += .05; Shade shade = FighterFactory.GetShade(1, shadeLevel: shadeLevel); shade.PhysicalDamage(damage); BattleMoveWithTargetAndNumberInput moveWithTarget = new BattleMoveWithTargetAndNumberInput(_bloodMove, shade, _fighter, 1); _chanceService.PushEventOccurs(true); //act _silverBell.ExecuteMove(moveWithTarget); //assert Assert.AreEqual(expectedChance, _chanceService.LastChanceVals[0]); }