Implement trivia welcome screen with category picker
This commit is contained in:
45
src/main/java/wtf/beatrice/hidekobot/objects/fun/Dice.java
Normal file
45
src/main/java/wtf/beatrice/hidekobot/objects/fun/Dice.java
Normal file
@@ -0,0 +1,45 @@
|
||||
package wtf.beatrice.hidekobot.objects.fun;
|
||||
|
||||
import wtf.beatrice.hidekobot.util.RandomUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class Dice
|
||||
{
|
||||
private final int sides;
|
||||
private int value = 0;
|
||||
private final UUID uuid;
|
||||
|
||||
public Dice(int sides)
|
||||
{
|
||||
this.sides = sides;
|
||||
this.uuid = UUID.randomUUID();
|
||||
}
|
||||
|
||||
public Dice(Dice old)
|
||||
{
|
||||
this.sides = old.sides;
|
||||
this.value = old.value;
|
||||
this.uuid = UUID.randomUUID();
|
||||
}
|
||||
|
||||
public int getValue()
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
public int getSides()
|
||||
{
|
||||
return sides;
|
||||
}
|
||||
|
||||
public void roll()
|
||||
{
|
||||
value = RandomUtil.getRandomNumber(1, sides);
|
||||
}
|
||||
|
||||
public UUID getUUID()
|
||||
{
|
||||
return uuid;
|
||||
}
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
package wtf.beatrice.hidekobot.objects.fun;
|
||||
|
||||
public record TriviaCategory(String categoryName, int categoryId) {
|
||||
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
package wtf.beatrice.hidekobot.objects.fun;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public record TriviaQuestion(String question, String correctAnswer,
|
||||
List<String> wrongAnswers) {
|
||||
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
package wtf.beatrice.hidekobot.objects.fun;
|
||||
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
|
||||
public class TriviaScore
|
||||
{
|
||||
|
||||
private final User user;
|
||||
private int score = 0;
|
||||
|
||||
public TriviaScore(User user)
|
||||
{
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public void changeScore(int add)
|
||||
{
|
||||
score += add;
|
||||
}
|
||||
|
||||
public int getScore() { return score; }
|
||||
|
||||
public User getUser() { return user; }
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "[" + user.getAsTag() + "," + score + "]";
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user