Moved score multiplier field into GameMod enum.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han
2015-01-11 00:29:26 -05:00
parent 5a09689b4c
commit 6f7b2b6554
2 changed files with 37 additions and 15 deletions

View File

@@ -29,12 +29,16 @@ import org.newdawn.slick.util.Log;
* Game mods.
*/
public enum GameMod {
EASY (0, "selection-mod-easy.png"),
NO_FAIL (1, "selection-mod-nofail.png"),
HARD_ROCK (2, "selection-mod-hardrock.png"),
EASY (0, "selection-mod-easy.png", 0.5f),
NO_FAIL (1, "selection-mod-nofail.png", 0.5f),
HARD_ROCK (2, "selection-mod-hardrock.png", 1.06f),
SUDDEN_DEATH (3, "selection-mod-suddendeath.png"),
SPUN_OUT (4, "selection-mod-spunout.png"),
SPUN_OUT (4, "selection-mod-spunout.png", 0.9f),
AUTO (5, "selection-mod-autoplay.png");
// HALF_TIME (, "selection-mod-halftime.png", 0.3f),
// DOUBLE_TIME (, "selection-mod-doubletime.png", 1.12f),
// HIDDEN (, "selection-mod-hidden.png", 1.06f),
// FLASHLIGHT (, "selection-mod-flashlight.png", 1.12f);
/**
* The ID of the mod (used for positioning).
@@ -46,6 +50,11 @@ public enum GameMod {
*/
private String filename;
/**
* Score multiplier.
*/
private float multiplier;
/**
* Whether or not this mod is active.
*/
@@ -85,6 +94,19 @@ public enum GameMod {
GameMod(int id, String filename) {
this.id = id;
this.filename = filename;
this.multiplier = 1f;
}
/**
* Constructor.
* @param id the ID of the mod (for positioning).
* @param filename the image file name
* @param multiplier the score multiplier
*/
GameMod(int id, String filename, float multiplier) {
this.id = id;
this.filename = filename;
this.multiplier = multiplier;
}
/**
@@ -113,6 +135,12 @@ public enum GameMod {
}
}
/**
* Returns the score multiplier for the mod.
* @return the multiplier
*/
public float getMultiplier() { return multiplier; }
/**
* Toggles the active status of the mod.
* @param checkInverse if true, perform checks for mutual exclusivity