RuneHive-Game
Loading...
Searching...
No Matches
FiftyFive.java
Go to the documentation of this file.
1package com.runehive.content.gambling.impl;
2
3import com.runehive.content.gambling.Gamble;
4import com.runehive.game.task.Task;
5import com.runehive.game.world.World;
6import com.runehive.game.world.entity.mob.player.Player;
7import com.runehive.util.Utility;
8
9public class FiftyFive extends Gamble {
10
12 super(host, opponent);
13 }
14
15 @Override
16 public String toString() {
17 return "55x2";
18 }
19
20 @Override
21 public void gamble() {
22 World.schedule(new Task(1) {
23 int time = 0;
24 public int randomRoll = 1 + Utility.random(99);
26
27 @Override
28 protected void execute() {
29 switch (time) {
30 case 2:
31 getHost().speak("I rolled " + randomRoll + " on the dice.");
32 getOpponent().speak("The host rolled " + randomRoll + " on the dice.");
33 break;
34 case 4:
35 if (randomRoll > 55) {
36 hostScore = 0;
37 opponentScore = 1;
38 } else if (randomRoll < 55) {
39 hostScore = 1;
40 opponentScore = 0;
41 } else {
42 hostScore = 0;
43 opponentScore = 0;
44 }
46 cancel();
47 break;
48 }
49 time++;
50 }
51 });
52 }
53
54}
int hostScore
Score betwen the players inside the 'gamble'.
Definition Gamble.java:23
Gamble(Player host, Player opponent)
Definition Gamble.java:25
Player host
Players inside the 'gamble'.
Definition Gamble.java:10
void finish(Player host, Player opponent, int hostScore, int opponentScore)
Handles finishing up a automated gamble.
FiftyFive(Player host, Player opponent)
A game representing a cyclic unit of work.
Definition Task.java:11
Represents the game world.
Definition World.java:46
static void schedule(Task task)
Submits a new event.
Definition World.java:247
void speak(String forceChat)
Sets the mob's forced chat.
Definition Mob.java:127
This class represents a character controlled by a player.
Definition Player.java:125
Handles miscellaneous methods.
Definition Utility.java:27
static int random(int bound)
Definition Utility.java:239