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

View File

@ -8,22 +8,22 @@ import org.bukkit.entity.Zombie;
import mineplex.core.common.util.C;
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.
*
* @see ChallengeInfestation
* @see ChallengeZombieInfection
*/
public class InfestationZombie
{
private ChallengeInfestation _challenge;
private ChallengeZombieInfection _challenge;
private Zombie _wrapper;
private boolean _frozen;
private long _freezeTime;
private float _speed;
public InfestationZombie(ChallengeInfestation challenge)
public InfestationZombie(ChallengeZombieInfection challenge)
{
_challenge = challenge;
}
@ -55,7 +55,7 @@ public class InfestationZombie
return _wrapper.getLocation().clone();
}
public ChallengeInfestation getChallenge()
public ChallengeZombieInfection getChallenge()
{
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.ChallengeType;
public class ChallengeDiamondSeeker extends Challenge
public class ChallengeDiamondHunt extends Challenge
{
public ChallengeDiamondSeeker(BawkBawkBattles host)
public ChallengeDiamondHunt(BawkBawkBattles host)
{
super(
host,
ChallengeType.FirstComplete,
"Diamond Seeker",
"Diamond Hunt",
"Find a diamond in the chests.");
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.ChallengeType;
public class ChallengeDragonEgg extends Challenge
public class ChallengeEggSmash extends Challenge
{
private static int _smashedEggsGoal = 10;
private HashMap<Player, Integer> _score = new HashMap<Player, Integer>();
public ChallengeDragonEgg(BawkBawkBattles host)
public ChallengeEggSmash(BawkBawkBattles host)
{
super(
host,
ChallengeType.FirstComplete,
"Dragon Egg",
"Whack a dragon egg " + _smashedEggsGoal + " times.");
"Egg Smash",
"Smash " + _smashedEggsGoal + " dragon eggs.");
Settings.setUseMapHeight();
Settings.setLockInventory(4);

View File

@ -27,8 +27,6 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.disguise.disguises.DisguiseVillager;
import mineplex.core.hologram.Hologram;
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 nautilus.game.arcade.game.games.mineware.BawkBawkBattles;
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<Player, Integer> _score = new HashMap<Player, Integer>();
private HashMap<Entity, Hologram> _cowIndicator = new HashMap<Entity, Hologram>();
private HashMap<Player, Boolean> _deliverMessage = new HashMap<Player, Boolean>();
String[] _humanNames = new String[] {
"Tom",
@ -143,6 +142,7 @@ public class ChallengeMilkACow extends Challenge implements DataTracker
player.getInventory().setItem(Settings.getLockedSlot(), new ItemStack(Material.BUCKET));
_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
public void onEntityInteract(PlayerInteractEntityEvent event)
{
@ -224,41 +201,20 @@ public class ChallengeMilkACow extends Challenge implements DataTracker
if (item == null)
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)
{
if (!_milked.get(ent).contains(player.getName()))
{
player.setItemInHand(new ItemStack(Material.MILK_BUCKET));
_milked.get(ent).add(player.getName());
}
else
{
player.updateInventory();
}
}
milkCow(player, entity);
event.setCancelled(true);
}
else if (ent == _villager)
else if (item.getType() == Material.MILK_BUCKET && entity.equals(_villager))
{
if (item.getType() == Material.MILK_BUCKET)
{
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);
deliverMilk(player);
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);
if (score >= 5)
{
setCompleted(player);
}
}
int score = incrementScore(player);
displayScore((Villager) entity, player, score);
checkCompletion(player, score);
event.setCancelled(true);
}
@ -275,8 +231,7 @@ public class ChallengeMilkACow extends Challenge implements DataTracker
if (!isPlayerValid(player))
return;
player.updateInventory();
UtilPlayer.message(player, F.main("Game", "Deliver the milk to the farmer!"));
//player.updateInventory();
event.setCancelled(true);
}
@ -292,6 +247,11 @@ public class ChallengeMilkACow extends Challenge implements DataTracker
{
_score.remove(player);
}
if (_deliverMessage.containsKey(player))
{
_score.remove(player);
}
}
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.setProfession(Profession.FARMER);
_villager.setCustomName(C.Bold + "Farmer Joe");
_villager.setCustomName(C.cGreen + C.Bold + "Farmer Joe");
_villager.setCustomNameVisible(true);
}
@ -332,7 +292,7 @@ public class ChallengeMilkACow extends Challenge implements DataTracker
cow.setCustomNameVisible(true);
_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);
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));
}
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
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.ChallengeType;
public class ChallengeMineADiamond extends Challenge
public class ChallengeOreRun extends Challenge
{
private ArrayList<Material> _ores = new ArrayList<Material>(Arrays.asList(
Material.COAL_ORE,
@ -32,13 +32,13 @@ public class ChallengeMineADiamond extends Challenge
private ArrayList<Block> _diamonds = new ArrayList<Block>();
public ChallengeMineADiamond(BawkBawkBattles host)
public ChallengeOreRun(BawkBawkBattles host)
{
super(
host,
ChallengeType.FirstComplete,
"Mine a Diamond",
"Find a diamond around the map.");
"Ore Run",
"Find and mine a diamond around the map.");
Settings.setUseMapHeight();
Settings.setLockInventory(4);

View File

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

View File

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

View File

@ -55,7 +55,8 @@ public class ChallengeWaveCrush extends Challenge implements DataTracker
host,
ChallengeType.LastStanding,
"Wave Crush",
"Avoid the crushing waves.");
"Waves of blocks are coming towards you!",
"Avoid getting him by them.");
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.other.InfestationZombie;
public class ChallengeInfestation extends Challenge
public class ChallengeZombieInfection extends Challenge
{
private InfestationZombie _zombie = new InfestationZombie(this);
private HashSet<Player> _infected = new HashSet<Player>();
public ChallengeInfestation(BawkBawkBattles host)
public ChallengeZombieInfection(BawkBawkBattles host)
{
super(
host,
ChallengeType.LastStanding,
"Infestation",
"Avoid the deadly zombie.",
"The infected can kill humans!");
"Zombie Infection",
"Avoid the infected zombie.",
"Infected humans can infect others!");
Settings.setUseMapHeight();
_zombie.setSpeed(1.5F);