Modify challenge names and challenge intro titles

This commit is contained in:
Thanos paravantis 2016-04-25 12:47:55 +03:00
parent c214431cbf
commit a6bf059e6c
10 changed files with 136 additions and 101 deletions

View File

@ -86,18 +86,18 @@ import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeChickenS
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeCloudFall; import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeCloudFall;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeColorChange; import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeColorChange;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeDeadlyTnt; import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeDeadlyTnt;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeDiamondSeeker; import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeDiamondHunt;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeDogsVersusCats; import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeDogsVersusCats;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeDragonEgg; import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeEggSmash;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeFallingBlocks; import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeFallingBlocks;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeFastFood; import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeFastFood;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeFishingDay; import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeFishingDay;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeInfestation; import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeZombieInfection;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeKangarooJump; import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeKangarooJump;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeKingOfTheLadder; import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeKingOfTheLadder;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeLavaRun; import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeLavaRun;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeMilkACow; import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeMilkACow;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeMineADiamond; import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeOreRun;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeMinecartDance; import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeMinecartDance;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeMiniOneInTheQuiver; import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeMiniOneInTheQuiver;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeNavigationMaze; import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeNavigationMaze;
@ -178,9 +178,9 @@ public class BawkBawkBattles extends TeamGame implements IThrown
* - Fix TNT knockback on Deadly TNT * - Fix TNT knockback on Deadly TNT
* - Fix double life lost on Minecart Dance * - Fix double life lost on Minecart Dance
* - Fix obsidian not spawning on Lava Run * - Fix obsidian not spawning on Lava Run
* - Fix impossible maze on Maze Runner * - Fix impossible maze on Navigation Maze
* - Fix fishing day lives issue * - Fix fishing day lives issue
* - Fix milk sound on Milk a Cow * - Fix milk sound on Milk a Cow
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -243,22 +243,21 @@ public class BawkBawkBattles extends TeamGame implements IThrown
ChallengeBouncingBlock.class, ChallengeBouncingBlock.class,
ChallengeBuildRace.class, ChallengeBuildRace.class,
ChallengeChickenShooting.class, ChallengeChickenShooting.class,
ChallengeDiamondSeeker.class,
ChallengeCloudFall.class, ChallengeCloudFall.class,
ChallengeColorChange.class, ChallengeColorChange.class,
ChallengeDeadlyTnt.class, ChallengeDeadlyTnt.class,
ChallengeDiamondHunt.class,
ChallengeDogsVersusCats.class, ChallengeDogsVersusCats.class,
ChallengeDragonEgg.class, ChallengeEggSmash.class,
ChallengeFallingBlocks.class, ChallengeFallingBlocks.class,
ChallengeFastFood.class, ChallengeFastFood.class,
ChallengeFishingDay.class, ChallengeFishingDay.class,
ChallengeWaterHorror.class, ChallengeWaterHorror.class,
ChallengeInfestation.class,
ChallengeKangarooJump.class, ChallengeKangarooJump.class,
ChallengeKingOfTheLadder.class, ChallengeKingOfTheLadder.class,
ChallengeLavaRun.class, ChallengeLavaRun.class,
ChallengeMilkACow.class, ChallengeMilkACow.class,
ChallengeMineADiamond.class, ChallengeOreRun.class,
ChallengeMinecartDance.class, ChallengeMinecartDance.class,
ChallengeMiniOneInTheQuiver.class, ChallengeMiniOneInTheQuiver.class,
ChallengeNavigationMaze.class, ChallengeNavigationMaze.class,
@ -270,7 +269,8 @@ public class BawkBawkBattles extends TeamGame implements IThrown
ChallengeSmashOff.class, ChallengeSmashOff.class,
ChallengeTreasureDigger.class, ChallengeTreasureDigger.class,
ChallengeVolleyPig.class, ChallengeVolleyPig.class,
ChallengeWaveCrush.class); ChallengeWaveCrush.class,
ChallengeZombieInfection.class);
_list.copy(); _list.copy();
} }
@ -804,7 +804,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
_settings.markMessagesAsSending(true); _settings.markMessagesAsSending(true);
_settings.markMessagesAsSent(false); _settings.markMessagesAsSent(false);
int looped = 0; int index = 0;
List<String> messages = Lists.newArrayList(challenge.getDescription()); List<String> messages = Lists.newArrayList(challenge.getDescription());
@ -828,31 +828,42 @@ public class BawkBawkBattles extends TeamGame implements IThrown
UtilPlayer.message(player, ""); UtilPlayer.message(player, "");
} }
messages.add(0, C.cGray + "Bawk Bawk says...");
while (true) while (true)
{ {
if (!IsLive()) if (!IsLive())
break; break;
String message = C.cYellow + messages.get(looped); String title = null;
String subtitle = C.cYellow + messages.get(index);
if (index > 0)
{
title = challenge.getName();
}
for (Player player : GetPlayers(true)) // Show to alive players only. for (Player player : GetPlayers(true)) // Show to alive players only.
UtilTextMiddle.display(challenge.getName(), message, 0, 60, 20, player); UtilTextMiddle.display(title, subtitle, 0, 60, 20, player);
for (Player player : GetPlayers(true)) if (index > 0)
player.playSound(player.getLocation(), Sound.CHICKEN_IDLE, 1.5F, 1.0F); {
for (Player player : GetPlayers(true))
player.playSound(player.getLocation(), Sound.CHICKEN_IDLE, 1.5F, 1.0F);
}
try try
{ {
Thread.sleep(1000 + (55 * messages.get(looped).length())); Thread.sleep(1000 + (55 * messages.get(index).length()));
} }
catch (InterruptedException e) catch (InterruptedException e)
{ {
e.printStackTrace(); e.printStackTrace();
} }
looped++; index++;
if (looped >= messages.size()) if (index >= messages.size())
{ {
prepareCountdown(); prepareCountdown();
break; break;

View File

@ -8,22 +8,22 @@ import org.bukkit.entity.Zombie;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeInfestation; import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeZombieInfection;
/** /**
* This is a zombie wrapper class that holds the speed and a freeze timer. * This is a zombie wrapper class that holds the speed and a freeze timer.
* *
* @see ChallengeInfestation * @see ChallengeZombieInfection
*/ */
public class InfestationZombie public class InfestationZombie
{ {
private ChallengeInfestation _challenge; private ChallengeZombieInfection _challenge;
private Zombie _wrapper; private Zombie _wrapper;
private boolean _frozen; private boolean _frozen;
private long _freezeTime; private long _freezeTime;
private float _speed; private float _speed;
public InfestationZombie(ChallengeInfestation challenge) public InfestationZombie(ChallengeZombieInfection challenge)
{ {
_challenge = challenge; _challenge = challenge;
} }
@ -55,7 +55,7 @@ public class InfestationZombie
return _wrapper.getLocation().clone(); return _wrapper.getLocation().clone();
} }
public ChallengeInfestation getChallenge() public ChallengeZombieInfection getChallenge()
{ {
return _challenge; return _challenge;
} }

View File

@ -22,14 +22,14 @@ import nautilus.game.arcade.game.games.mineware.BawkBawkBattles;
import nautilus.game.arcade.game.games.mineware.challenge.Challenge; import nautilus.game.arcade.game.games.mineware.challenge.Challenge;
import nautilus.game.arcade.game.games.mineware.challenge.ChallengeType; import nautilus.game.arcade.game.games.mineware.challenge.ChallengeType;
public class ChallengeDiamondSeeker extends Challenge public class ChallengeDiamondHunt extends Challenge
{ {
public ChallengeDiamondSeeker(BawkBawkBattles host) public ChallengeDiamondHunt(BawkBawkBattles host)
{ {
super( super(
host, host,
ChallengeType.FirstComplete, ChallengeType.FirstComplete,
"Diamond Seeker", "Diamond Hunt",
"Find a diamond in the chests."); "Find a diamond in the chests.");
Settings.setUseMapHeight(); Settings.setUseMapHeight();

View File

@ -23,18 +23,18 @@ import nautilus.game.arcade.game.games.mineware.BawkBawkBattles;
import nautilus.game.arcade.game.games.mineware.challenge.Challenge; import nautilus.game.arcade.game.games.mineware.challenge.Challenge;
import nautilus.game.arcade.game.games.mineware.challenge.ChallengeType; import nautilus.game.arcade.game.games.mineware.challenge.ChallengeType;
public class ChallengeDragonEgg extends Challenge public class ChallengeEggSmash extends Challenge
{ {
private static int _smashedEggsGoal = 10; private static int _smashedEggsGoal = 10;
private HashMap<Player, Integer> _score = new HashMap<Player, Integer>(); private HashMap<Player, Integer> _score = new HashMap<Player, Integer>();
public ChallengeDragonEgg(BawkBawkBattles host) public ChallengeEggSmash(BawkBawkBattles host)
{ {
super( super(
host, host,
ChallengeType.FirstComplete, ChallengeType.FirstComplete,
"Dragon Egg", "Egg Smash",
"Whack a dragon egg " + _smashedEggsGoal + " times."); "Smash " + _smashedEggsGoal + " dragon eggs.");
Settings.setUseMapHeight(); Settings.setUseMapHeight();
Settings.setLockInventory(4); Settings.setLockInventory(4);

View File

@ -27,8 +27,6 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.disguise.disguises.DisguiseVillager; import mineplex.core.disguise.disguises.DisguiseVillager;
import mineplex.core.hologram.Hologram; import mineplex.core.hologram.Hologram;
import mineplex.core.hologram.Hologram.HologramTarget; import mineplex.core.hologram.Hologram.HologramTarget;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; import nautilus.game.arcade.game.games.mineware.BawkBawkBattles;
import nautilus.game.arcade.game.games.mineware.challenge.Challenge; import nautilus.game.arcade.game.games.mineware.challenge.Challenge;
@ -41,6 +39,7 @@ public class ChallengeMilkACow extends Challenge implements DataTracker
private HashMap<Entity, ArrayList<String>> _milked = new HashMap<Entity, ArrayList<String>>(); private HashMap<Entity, ArrayList<String>> _milked = new HashMap<Entity, ArrayList<String>>();
private HashMap<Player, Integer> _score = new HashMap<Player, Integer>(); private HashMap<Player, Integer> _score = new HashMap<Player, Integer>();
private HashMap<Entity, Hologram> _cowIndicator = new HashMap<Entity, Hologram>(); private HashMap<Entity, Hologram> _cowIndicator = new HashMap<Entity, Hologram>();
private HashMap<Player, Boolean> _deliverMessage = new HashMap<Player, Boolean>();
String[] _humanNames = new String[] { String[] _humanNames = new String[] {
"Tom", "Tom",
@ -143,6 +142,7 @@ public class ChallengeMilkACow extends Challenge implements DataTracker
player.getInventory().setItem(Settings.getLockedSlot(), new ItemStack(Material.BUCKET)); player.getInventory().setItem(Settings.getLockedSlot(), new ItemStack(Material.BUCKET));
_score.put(player, 0); _score.put(player, 0);
_deliverMessage.put(player, false);
} }
} }
@ -185,29 +185,6 @@ public class ChallengeMilkACow extends Challenge implements DataTracker
} }
} }
@EventHandler
public void onCowIndicatorUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
return;
if (!isChallengeValid())
return;
for (Entity cow : _milked.keySet())
{
for (String playerName : _milked.get(cow))
{
Hologram holo = _cowIndicator.get(cow);
if (!holo.containsPlayer(playerName))
{
holo.addPlayer(playerName);
}
}
}
}
@EventHandler @EventHandler
public void onEntityInteract(PlayerInteractEntityEvent event) public void onEntityInteract(PlayerInteractEntityEvent event)
{ {
@ -224,41 +201,20 @@ public class ChallengeMilkACow extends Challenge implements DataTracker
if (item == null) if (item == null)
return; return;
Entity ent = event.getRightClicked(); Entity entity = event.getRightClicked();
if (_milked.containsKey(ent)) if (item.getType() == Material.BUCKET && _milked.containsKey(entity))
{ {
if (item.getType() == Material.BUCKET) milkCow(player, entity);
{
if (!_milked.get(ent).contains(player.getName()))
{
player.setItemInHand(new ItemStack(Material.MILK_BUCKET));
_milked.get(ent).add(player.getName());
}
else
{
player.updateInventory();
}
}
event.setCancelled(true); event.setCancelled(true);
} }
else if (ent == _villager) else if (item.getType() == Material.MILK_BUCKET && entity.equals(_villager))
{ {
if (item.getType() == Material.MILK_BUCKET) deliverMilk(player);
{
player.setItemInHand(new ItemStack(Material.BUCKET));
player.playSound(player.getLocation(), Sound.ORB_PICKUP, 2, 0);
int score = _score.get(player) + 1;
_score.put(player, score);
displayCount(player, ((Villager) ent).getEyeLocation().add(0, 0.3, 0), (score >= 5 ? C.cDGreen : score >= 3 ? C.cGreen : score >= 2 ? C.cRed : C.cDRed) + score); int score = incrementScore(player);
displayScore((Villager) entity, player, score);
if (score >= 5) checkCompletion(player, score);
{
setCompleted(player);
}
}
event.setCancelled(true); event.setCancelled(true);
} }
@ -275,8 +231,7 @@ public class ChallengeMilkACow extends Challenge implements DataTracker
if (!isPlayerValid(player)) if (!isPlayerValid(player))
return; return;
player.updateInventory(); //player.updateInventory();
UtilPlayer.message(player, F.main("Game", "Deliver the milk to the farmer!"));
event.setCancelled(true); event.setCancelled(true);
} }
@ -292,6 +247,11 @@ public class ChallengeMilkACow extends Challenge implements DataTracker
{ {
_score.remove(player); _score.remove(player);
} }
if (_deliverMessage.containsKey(player))
{
_score.remove(player);
}
} }
private void spawnCowsAndFarmer() private void spawnCowsAndFarmer()
@ -319,7 +279,7 @@ public class ChallengeMilkACow extends Challenge implements DataTracker
{ {
_villager = (Villager) getCenter().getWorld().spawnEntity(getCenter().add(0, 1, 0), EntityType.VILLAGER); _villager = (Villager) getCenter().getWorld().spawnEntity(getCenter().add(0, 1, 0), EntityType.VILLAGER);
_villager.setProfession(Profession.FARMER); _villager.setProfession(Profession.FARMER);
_villager.setCustomName(C.Bold + "Farmer Joe"); _villager.setCustomName(C.cGreen + C.Bold + "Farmer Joe");
_villager.setCustomNameVisible(true); _villager.setCustomNameVisible(true);
} }
@ -332,7 +292,7 @@ public class ChallengeMilkACow extends Challenge implements DataTracker
cow.setCustomNameVisible(true); cow.setCustomNameVisible(true);
_milked.put(cow, new ArrayList<String>()); _milked.put(cow, new ArrayList<String>());
_cowIndicator.put(cow, new Hologram(Host.Manager.getHologramManager(), cow.getLocation().add(0, 2.5, 0), C.cRed + "Already Milked!")); _cowIndicator.put(cow, new Hologram(Host.Manager.getHologramManager(), cow.getLocation().add(0, 2.1, 0), C.cRed + "Already Milked"));
Hologram holo = _cowIndicator.get(cow); Hologram holo = _cowIndicator.get(cow);
holo.setHologramTarget(HologramTarget.WHITELIST); holo.setHologramTarget(HologramTarget.WHITELIST);
@ -345,6 +305,69 @@ public class ChallengeMilkACow extends Challenge implements DataTracker
return getCenter().add(UtilMath.r(((getArenaSize() * 2) - 1) - (getArenaSize() - 1)), 1, UtilMath.r((getArenaSize() * 2) - 1) - (getArenaSize() - 1)); return getCenter().add(UtilMath.r(((getArenaSize() * 2) - 1) - (getArenaSize() - 1)), 1, UtilMath.r((getArenaSize() * 2) - 1) - (getArenaSize() - 1));
} }
private void milkCow(Player player, Entity entity)
{
ArrayList<String> names = _milked.get(entity);
if (!names.contains(player.getName()))
{
player.setItemInHand(new ItemStack(Material.MILK_BUCKET));
_milked.get(entity).add(player.getName());
showDeliverMilkMessage(player);
displayMilkedIndicator(player, entity);
}
// else
// {
// player.updateInventory();
// }
}
private void displayMilkedIndicator(Player player, Entity entity)
{
Hologram indicator = _cowIndicator.get(entity);
if (!indicator.containsPlayer(player))
{
indicator.addPlayer(player);
}
}
private void showDeliverMilkMessage(Player player)
{
if (!_deliverMessage.get(player))
{
_deliverMessage.put(player, true);
UtilPlayer.message(player, F.main("Game", "Deliver the milk to the villager."));
}
}
private void deliverMilk(Player player)
{
player.setItemInHand(new ItemStack(Material.BUCKET));
player.playSound(player.getLocation(), Sound.ORB_PICKUP, 2, 0);
}
private int incrementScore(Player player)
{
int score = _score.get(player) + 1;
_score.put(player, score);
return score;
}
private void displayScore(Villager villager, Player player, int score)
{
Location displayLoc = villager.getEyeLocation().add(0, 0.3, 0);
displayCount(player, displayLoc, (score >= 5 ? C.cDGreen : score >= 3 ? C.cGreen : score >= 2 ? C.cRed : C.cDRed) + score);
}
private void checkCompletion(Player player, int score)
{
if (score >= 5)
{
setCompleted(player);
}
}
@Override @Override
public Number getData(Player player) public Number getData(Player player)
{ {

View File

@ -20,7 +20,7 @@ import nautilus.game.arcade.game.games.mineware.BawkBawkBattles;
import nautilus.game.arcade.game.games.mineware.challenge.Challenge; import nautilus.game.arcade.game.games.mineware.challenge.Challenge;
import nautilus.game.arcade.game.games.mineware.challenge.ChallengeType; import nautilus.game.arcade.game.games.mineware.challenge.ChallengeType;
public class ChallengeMineADiamond extends Challenge public class ChallengeOreRun extends Challenge
{ {
private ArrayList<Material> _ores = new ArrayList<Material>(Arrays.asList( private ArrayList<Material> _ores = new ArrayList<Material>(Arrays.asList(
Material.COAL_ORE, Material.COAL_ORE,
@ -32,13 +32,13 @@ public class ChallengeMineADiamond extends Challenge
private ArrayList<Block> _diamonds = new ArrayList<Block>(); private ArrayList<Block> _diamonds = new ArrayList<Block>();
public ChallengeMineADiamond(BawkBawkBattles host) public ChallengeOreRun(BawkBawkBattles host)
{ {
super( super(
host, host,
ChallengeType.FirstComplete, ChallengeType.FirstComplete,
"Mine a Diamond", "Ore Run",
"Find a diamond around the map."); "Find and mine a diamond around the map.");
Settings.setUseMapHeight(); Settings.setUseMapHeight();
Settings.setLockInventory(4); Settings.setLockInventory(4);

View File

@ -32,7 +32,7 @@ public class ChallengeRushPush extends Challenge
host, host,
ChallengeType.LastStanding, ChallengeType.LastStanding,
"Rush Push", "Rush Push",
"Rush to your enemy.", "Attack to the enemy team.",
"Push them off the platform."); "Push them off the platform.");
Settings.setUseMapHeight(); Settings.setUseMapHeight();

View File

@ -19,7 +19,7 @@ public class ChallengeSmashOff extends Challenge
host, host,
ChallengeType.LastStanding, ChallengeType.LastStanding,
"Smash Off", "Smash Off",
"Knock all others off the platform."); "Knock other players off their platform.");
Settings.setUseMapHeight(); Settings.setUseMapHeight();
Settings.setCanCruble(); Settings.setCanCruble();

View File

@ -55,7 +55,8 @@ public class ChallengeWaveCrush extends Challenge implements DataTracker
host, host,
ChallengeType.LastStanding, ChallengeType.LastStanding,
"Wave Crush", "Wave Crush",
"Avoid the crushing waves."); "Waves of blocks are coming towards you!",
"Avoid getting him by them.");
Settings.setUseMapHeight(); Settings.setUseMapHeight();
} }

View File

@ -30,19 +30,19 @@ import nautilus.game.arcade.game.games.mineware.challenge.Challenge;
import nautilus.game.arcade.game.games.mineware.challenge.ChallengeType; import nautilus.game.arcade.game.games.mineware.challenge.ChallengeType;
import nautilus.game.arcade.game.games.mineware.challenge.other.InfestationZombie; import nautilus.game.arcade.game.games.mineware.challenge.other.InfestationZombie;
public class ChallengeInfestation extends Challenge public class ChallengeZombieInfection extends Challenge
{ {
private InfestationZombie _zombie = new InfestationZombie(this); private InfestationZombie _zombie = new InfestationZombie(this);
private HashSet<Player> _infected = new HashSet<Player>(); private HashSet<Player> _infected = new HashSet<Player>();
public ChallengeInfestation(BawkBawkBattles host) public ChallengeZombieInfection(BawkBawkBattles host)
{ {
super( super(
host, host,
ChallengeType.LastStanding, ChallengeType.LastStanding,
"Infestation", "Zombie Infection",
"Avoid the deadly zombie.", "Avoid the infected zombie.",
"The infected can kill humans!"); "Infected humans can infect others!");
Settings.setUseMapHeight(); Settings.setUseMapHeight();
_zombie.setSpeed(1.5F); _zombie.setSpeed(1.5F);