}
MapLevel mapLevel;
+ enum FixLevel { SOMETIMES, NEVER }
+ FixLevel fixLevel;
+
@Inject
LeagueManager(MultiplayerGameManager<AbstractMultiplayerPlayer> gameManager)
{
: level <= 2 ? MapLevel.DISCRETE
: MapLevel.CONTINUOUS;
+ fixLevel = level <= 1 ? FixLevel.SOMETIMES : FixLevel.NEVER;
}
}
case Throw:
try { player.model.consumeStones(player.stoneThrow); }
catch (Model.Player.ThrewMoreStonesThanHad e) {
- if (model.random.nextInt(10) > 0) {
+ boolean FIX_IT;
+ switch (league.fixLevel) {
+ case SOMETIMES:
+ FIX_IT = model.random.nextInt(10) > 0;
+ break;
+ case NEVER:
+ FIX_IT = false;
+ break;
+ default: throw new JavaLimitationError();
+ }
+ if (FIX_IT) {
player.view.threwMoreStonesThanHad();
player.stoneThrow = player.model.consumeMaxStones();
}
}
}
catch (Model.Player.FailedToThrowStonesAndShouldHave e) {
- if (model.random.nextInt(10) > 0) {
+ boolean FIX_IT;
+ switch (league.fixLevel) {
+ case SOMETIMES:
+ FIX_IT = model.random.nextInt(10) > 0;
+ break;
+ case NEVER:
+ FIX_IT = false;
+ break;
+ default: throw new JavaLimitationError();
+ }
+ if (FIX_IT) {
player.view.failedToThrowStonesAndShouldHave();
player.stoneThrow = player.model.consumeMinStones();
}