Add Halloween Words

This commit is contained in:
Shaun Bennett 2016-10-12 23:30:52 -04:00
parent 7ec530a8c7
commit bb32a06caf
3 changed files with 60 additions and 28 deletions

View File

@ -127,8 +127,10 @@ public class Build extends Game
private int _countdownTimerState = 0; private int _countdownTimerState = 0;
protected String[] _words; protected String[] _words;
protected String[] _holidayWords; protected String[] _christmasWords;
protected boolean _useHolidayWords = false; protected String[] _halloweenWords;
protected boolean _useChristmasWords = false;
protected boolean _useHalloweenWords = true;
protected String _word = "?"; protected String _word = "?";
@ -231,7 +233,7 @@ public class Build extends Game
"Water Gun", "Astronaut", "Wither", "Meteor" "Water Gun", "Astronaut", "Wither", "Meteor"
}; };
_holidayWords = new String[] _christmasWords = new String[]
{ {
"Santa", "Reindeer", "Ornament", "Elf", "North Pole", "Candy Cane", "Xmas Lights", "Christmas Tree", "Santa", "Reindeer", "Ornament", "Elf", "North Pole", "Candy Cane", "Xmas Lights", "Christmas Tree",
"Fireplace", "Hot Chocolate", "Snowflake", "Snowman", "Sleigh", "Toys", "Milk", "Eggnog", "Coal", "Fireplace", "Hot Chocolate", "Snowflake", "Snowman", "Sleigh", "Toys", "Milk", "Eggnog", "Coal",
@ -241,6 +243,16 @@ public class Build extends Game
"Boots", "Gingerbread Man", "Glacier", "Ice Hockey", "Scarf", "Snowboard" "Boots", "Gingerbread Man", "Glacier", "Ice Hockey", "Scarf", "Snowboard"
}; };
_halloweenWords = new String[]
{
"Bat", "Cauldron", "Broomstick", "Witch", "Witch Hat", "Haunted House", "Ghost", "Spider",
"Werewolf", "Full Moon", "Vampire", "Dracula", "Zombie", "Grim Reaper", "Graveyard",
"Gravestone", "Pumpkin", "Pumpkin Patch", "Jack-O-Lantern", "Scarecrow", "Haunted",
"Monster", "Halloween", "Skeleton", "Skull", "Coffin", "Tomb", "Cobweb", "Spider Web",
"Costume", "Frankenstein", "Black Cat", "Bone", "Candy", "Trick or Treat", "Eyeball", "Fangs",
"Goblin", "Potion", "Treat", "Trick"
};
_mobShop = new MobShop(getArcadeManager(), getArcadeManager().GetClients(), getArcadeManager().GetDonation()); _mobShop = new MobShop(getArcadeManager(), getArcadeManager().GetClients(), getArcadeManager().GetDonation());
_optionsShop = new OptionsShop(this, getArcadeManager(), getArcadeManager().GetClients(), getArcadeManager().GetDonation()); _optionsShop = new OptionsShop(this, getArcadeManager(), getArcadeManager().GetClients(), getArcadeManager().GetDonation());
_shopItem = ItemStackFactory.Instance.CreateStack(Material.DIAMOND, (byte) 0, 1, C.cGreen + "Options"); _shopItem = ItemStackFactory.Instance.CreateStack(Material.DIAMOND, (byte) 0, 1, C.cGreen + "Options");
@ -289,10 +301,7 @@ public class Build extends Game
player.setFlySpeed(0.1f); player.setFlySpeed(0.1f);
} }
if (!_useHolidayWords || Math.random() >= 0.5) _word = getNextWord();
_word = _words[UtilMath.r(_words.length)];
else
_word = _holidayWords[UtilMath.r(_holidayWords.length)];
UtilTextMiddle.display(null, C.cYellow + "Build " + C.cWhite + _word, 0, 80, 5); UtilTextMiddle.display(null, C.cYellow + "Build " + C.cWhite + _word, 0, 80, 5);
@ -1665,6 +1674,23 @@ public class Build extends Game
return Arrays.asList(player); return Arrays.asList(player);
} }
protected String getNextWord()
{
// TODO: These should be even no matter what word packs are enabled
if (_useHalloweenWords && Math.random() <= 0.5)
{
return _halloweenWords[UtilMath.r(_halloweenWords.length)];
}
else if (_useChristmasWords && Math.random() <= 0.5)
{
return _christmasWords[UtilMath.r(_christmasWords.length)];
}
else
{
return _words[UtilMath.r(_words.length)];
}
}
public Map<Player, BuildData> getData() public Map<Player, BuildData> getData()
{ {
return _data; return _data;
@ -1680,16 +1706,6 @@ public class Build extends Game
return _word; return _word;
} }
public boolean useHolidayWords()
{
return _useHolidayWords;
}
public String[] getHolidayWords()
{
return _holidayWords;
}
public String[] getWords() public String[] getWords()
{ {
return _words; return _words;

View File

@ -69,10 +69,7 @@ public class TeamBuild extends Build
} }
} }
if (!useHolidayWords() || Math.random() >= 0.5) setWord(getNextWord());
setWord(getWords()[UtilMath.r(getWords().length)]);
else
setWord(getHolidayWords()[UtilMath.r(getHolidayWords().length)]);
UtilTextMiddle.display(null, C.cYellow + "Build " + C.cWhite + getWord(), 0, 80, 5); UtilTextMiddle.display(null, C.cYellow + "Build " + C.cWhite + getWord(), 0, 80, 5);

View File

@ -91,8 +91,10 @@ public class Draw extends SoloGame
private HashSet<Tool> _tools; private HashSet<Tool> _tools;
private String[] _words; private String[] _words;
private String[] _holidayWords; private String[] _christmasWords;
private boolean _useHolidayWords = false; private String[] _halloweenWords;
private boolean _useChristmasWords = false;
private boolean _useHalloweenWords = true;
private HashSet<String> _usedWords = new HashSet<String>(); private HashSet<String> _usedWords = new HashSet<String>();
public Draw(ArcadeManager manager) public Draw(ArcadeManager manager)
@ -187,7 +189,7 @@ public class Draw extends SoloGame
"Strawberry", "Jam", "Sandwich", "Owl", "Watermelon", "Australia", "Canada", "United States", "Diary" "Strawberry", "Jam", "Sandwich", "Owl", "Watermelon", "Australia", "Canada", "United States", "Diary"
}; };
_holidayWords = new String[] _christmasWords = new String[]
{ {
"Santa", "Reindeer", "Ornament", "Elf", "North Pole", "Candy Cane", "Christmas Tree", "Santa", "Reindeer", "Ornament", "Elf", "North Pole", "Candy Cane", "Christmas Tree",
"Fireplace", "Hot Chocolate", "Snowflake", "Snowman", "Sleigh", "Toys", "Milk", "Eggnog", "Coal", "Fireplace", "Hot Chocolate", "Snowflake", "Snowman", "Sleigh", "Toys", "Milk", "Eggnog", "Coal",
@ -197,6 +199,16 @@ public class Draw extends SoloGame
"Boots", "Gingerbread Man", "Glacier", "Ice Hockey", "Scarf", "Snowboard" "Boots", "Gingerbread Man", "Glacier", "Ice Hockey", "Scarf", "Snowboard"
}; };
_halloweenWords = new String[]
{
"Bat", "Cauldron", "Broomstick", "Witch", "Witch Hat", "Haunted House", "Ghost", "Spider",
"Werewolf", "Full Moon", "Vampire", "Dracula", "Zombie", "Grim Reaper", "Graveyard",
"Gravestone", "Pumpkin", "Pumpkin Patch", "Jack-O-Lantern", "Scarecrow", "Haunted",
"Monster", "Halloween", "Skeleton", "Skull", "Coffin", "Tomb", "Cobweb", "Spider Web",
"Costume", "Frankenstein", "Black Cat", "Bone", "Candy", "Trick or Treat", "Eyeball", "Fangs",
"Goblin", "Potion", "Treat", "Trick"
};
_tools = new HashSet<Tool>(); _tools = new HashSet<Tool>();
_tools.add(new ToolLine(this)); _tools.add(new ToolLine(this));
_tools.add(new ToolSquare(this)); _tools.add(new ToolSquare(this));
@ -416,12 +428,19 @@ public class Draw extends SoloGame
private String getRandomWord() private String getRandomWord()
{ {
if (!_useHolidayWords || Math.random() >= 0.30) // TODO: These should be even no matter what word packs are enabled
if (_useHalloweenWords && Math.random() <= 0.3)
{
return _halloweenWords[UtilMath.r(_halloweenWords.length)];
}
else if (_useChristmasWords && Math.random() <= 0.3)
{
return _christmasWords[UtilMath.r(_christmasWords.length)];
}
else
{ {
return _words[UtilMath.r(_words.length)]; return _words[UtilMath.r(_words.length)];
} }
return _holidayWords[UtilMath.r(_holidayWords.length)];
} }
@EventHandler(priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.LOWEST)