make gem feature more battle.net like and adapted it to xleave's code style

This commit is contained in:
Christian Kroll 2012-06-14 06:06:35 +02:00
parent ef9f37e12f
commit 5278dc13e6
1 changed files with 23 additions and 12 deletions

View File

@ -16,6 +16,7 @@ public class TheGame implements StatemachineListener, GuiEventListener, IRCEvent
private int gamerRating = 3;
private Thread discoThread;
private boolean shouldStopDisco;
private boolean gemActivated = false;
public TheGame(IGuiControl guiControl) {
this.guiControl = guiControl;
@ -274,18 +275,8 @@ public class TheGame implements StatemachineListener, GuiEventListener, IRCEvent
disco();
} else if(message.startsWith("disco stop")) {
discoStop();
} else if(message.startsWith("gem activate")) {
java.util.Random random = new java.util.Random();
int scry = random.nextInt(100);
if (scry >= 98) {
ircClient.say("Perfect Gem Activated");
} else if (scry >= 90) {
ircClient.say("Moooooooo!");
} else {
ircClient.say("Gem Activated");
}
} else if(message.startsWith("gem deactivate")) {
ircClient.say("Gem Deactivated");
} else if(message.startsWith("gem")) {
handleGem();
} else {
ircClient.say("y u no use valid command?");
}
@ -319,6 +310,8 @@ public class TheGame implements StatemachineListener, GuiEventListener, IRCEvent
machine.pauseTimer(true);
} else if(params.startsWith("resume")) {
machine.pauseTimer(false);
} else if(params.startsWith("gem")) {
ircClient.say("You don't say?");
}
}
@ -342,6 +335,24 @@ public class TheGame implements StatemachineListener, GuiEventListener, IRCEvent
}
}
// Yes, it makes no sense, but I want have it anyway. For more Spass am Geraet!
private void handleGem() {
if (!gemActivated) {
java.util.Random random = new java.util.Random();
int scry = random.nextInt(100);
if (scry >= 99) {
ircClient.say("Perfect Gem Activated");
} else if (scry >= 90) {
ircClient.say("Moooooooo!");
} else {
ircClient.say("Gem Activated");
}
} else {
ircClient.say("Gem Deactivated");
}
gemActivated = !gemActivated;
}
private void handleRelaisCommand(final String message) {
String params = message.substring("relais".length()).trim().toLowerCase();