many valentine, such wow

This commit is contained in:
Cheese 2016-02-05 13:25:57 +11:00
parent 5c22c841fe
commit 690c2acce8
10 changed files with 666 additions and 120 deletions

View File

@ -99,6 +99,10 @@ public class DamageManager extends MiniPlugin
LivingEntity damager = UtilEvent.GetDamagerEntity(event, true);
Projectile projectile = GetProjectile(event);
/*
* Fishing rods are disabled because of their custom properties
* we want them to behave like default MC.
*/
if (projectile instanceof Fish)
return;
@ -348,9 +352,8 @@ public class DamageManager extends MiniPlugin
}
}
// TODO: What is this required for? Players with books in regular games are spammed. Is it meant for debugging?
// TODO: Temporarily commenting out
//DisplayDamage(event);
//Debug
DisplayDamage(event);
}
private void Damage(CustomDamageEvent event)
@ -669,7 +672,7 @@ public class DamageManager extends MiniPlugin
event.setDamage(damage);
}
private LivingEntity GetDamageeEntity(EntityDamageEvent event)
public LivingEntity GetDamageeEntity(EntityDamageEvent event)
{
if (event.getEntity() instanceof LivingEntity)
return (LivingEntity)event.getEntity();
@ -677,7 +680,7 @@ public class DamageManager extends MiniPlugin
return null;
}
private Projectile GetProjectile(EntityDamageEvent event)
public Projectile GetProjectile(EntityDamageEvent event)
{
if (!(event instanceof EntityDamageByEntityEvent))
return null;

View File

@ -63,6 +63,7 @@ import nautilus.game.arcade.game.games.tug.Tug;
import nautilus.game.arcade.game.games.turfforts.TurfForts;
import nautilus.game.arcade.game.games.typewars.TypeWars;
import nautilus.game.arcade.game.games.uhc.UHC;
import nautilus.game.arcade.game.games.valentines.Valentines;
import nautilus.game.arcade.game.games.wither.WitherGame;
import nautilus.game.arcade.game.games.wizards.Wizards;
import nautilus.game.arcade.game.games.zombiesurvival.ZombieSurvival;

View File

@ -110,7 +110,7 @@ public class Gladiators extends SoloGame
DamageTeamSelf = true;
HungerSet = 20;
DontAllowOverfill = true;
EnableTutorials = false;
EnableTutorials = true;
BlockBreakAllow.add(Material.SUGAR_CANE_BLOCK.getId());
BlockBreakAllow.add(Material.DEAD_BUSH.getId());

View File

@ -4,23 +4,51 @@ import org.bukkit.Material;
public enum ValItem
{
FLOWER1("Red Rose", Material.RED_ROSE),
FLOWER2("Dandelion", Material.YELLOW_FLOWER),
FLOWER3("Other Flower", Material.FLOWER_POT),
WINE("Red Wine", Material.POTION),
GRASS("Organic Grass", Material.LONG_GRASS),
DIAMONDS("Diamond Earings", Material.DIAMOND),
EMERALDS("Emerald Necklace", Material.EMERALD),
BOOK("Book of Poetry", Material.BOOK),
WATCH("Fancy Pocket Watch", Material.WATCH);
FLOWER1("Red Rose",
"She will love this bouquet of roses!",
Material.RED_ROSE),
FLOWER2("Dandelion",
"Oh my, these flowers smell great!",
Material.YELLOW_FLOWER),
FLOWER3("Other Flower",
"MOO",
Material.REDSTONE),
WINE("Red Wine",
"This will go great with our dinner!",
Material.POTION),
GRASS("Organic Grass",
"Only the best for my date!",
Material.LONG_GRASS),
DIAMONDS("Diamond Earings",
"An expensive, but worthwhile gift!",
Material.DIAMOND),
EMERALDS("Emerald Necklace",
"Such necklace, many wow!",
Material.EMERALD),
BOOK("Book of Poetry",
"I will use impress her with poetry!",
Material.BOOK),
WATCH("Fancy Pocket Watch",
"This sure looks good on me!",
Material.WATCH);
private String _title;
private String _endText;
private Material _item;
ValItem(String title, Material item)
ValItem(String title, String endText, Material item)
{
_title = title;
_item = item;
_endText = endText;
}
public String getTitle()
@ -32,4 +60,9 @@ public enum ValItem
{
return _item;
}
public String getEndText()
{
return _endText;
}
}

View File

@ -1,28 +1,52 @@
package nautilus.game.arcade.game.games.valentines;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import org.bukkit.EntityEffect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Cow;
import org.bukkit.entity.Fish;
import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Pig;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.MapUtil;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextBottom;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.noteblock.INoteVerifier;
import mineplex.core.noteblock.NBSReader;
import mineplex.core.noteblock.NotePlayer;
import mineplex.core.noteblock.NoteSong;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
@ -30,26 +54,45 @@ import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.gladiators.tutorial.TutorialGladiators;
import nautilus.game.arcade.game.games.valentines.kit.KitMasterOfLove;
import nautilus.game.arcade.game.games.valentines.tutorial.TutorialValentines;
import nautilus.game.arcade.kit.Kit;
public class Valentines extends SoloGame
{
private String _cowName = "Calvin the Cow";
private Cow _cow;
private NotePlayer _music;
private NoteSong _song;
private int _playersOutPerRound = 1;
private ArrayList<Location> _pigSpawns = null;
private HashSet<Block> _blocks = null;
private HashSet<Block> _blocks = new HashSet<Block>();
private int _blockMapHeight = 0;
private int _round = 0;
private long _roundTime = 0;
private long _roundTimeLimit = 30000;
private long _roundTimeLimit = 60000;
private int _roundState = 0;
//1 = Playing
//2 = Between Rounds
private boolean _finalRound = false;
private ValItem _item = null;
private ArrayList<Pig> _pigs = new ArrayList<Pig>();
private ArrayList<Pig> _pigsStocked = new ArrayList<Pig>();
private ArrayList<Location> _pigSpawns = null;
private HashMap<Pig, Location> _pigs = new HashMap<Pig, Location>();
private HashSet<Pig> _pigsDead = new HashSet<Pig>();
private ArrayList<Player> _hasItem = new ArrayList<Player>();
private ArrayList<Player> _completedRound = new ArrayList<Player>();
private HashSet<ValItem> _unusedGifts = new HashSet<ValItem>();
@ -65,14 +108,28 @@ public class Valentines extends SoloGame
new String[]
{
"Chris the Cow has a Valentines Date,",
"Calvin the Cow has a Valentines Date,",
"but he was robbed by the nasty pigs!",
"Recover his items, and save the day!",
"",
"Slowest players are eliminated!"
});
this.DamageTeamSelf = false;
this.DamageTeamSelf = true;
this.HungerSet = 20;
this.HealthSet = 20;
EnableTutorials = false;
try
{
_song = NBSReader.loadSong("../../update/songs/popcorn.nbs");
}
catch (FileNotFoundException e)
{
e.printStackTrace();
}
}
@Override
@ -81,58 +138,213 @@ public class Valentines extends SoloGame
_pigSpawns = WorldData.GetDataLocs("YELLOW");
//Scan Map
Block source = _pigSpawns.get(0).getBlock();
_blocks = UtilBlock.findConnectedBlocks(source, source, new HashSet<Block>(), 50000, 50);
for (Block block : UtilBlock.getInBoundingBox(WorldData.GetDataLocs("GRAY").get(0), WorldData.GetDataLocs("GRAY").get(1)))
{
if (block.getType() != Material.AIR)
_blocks.add(block);
if (UtilBlock.solid(block))
{
if (block.getY() > _blockMapHeight)
_blockMapHeight = block.getY();
}
}
System.out.println("Scanned " + _blocks.size() + " Arena Blocks");
}
@EventHandler
public void stateChanges(GameStateChangeEvent event)
{
if (event.GetState() == GameState.Prepare)
{
_playersOutPerRound = Math.max(1, (int)(GetPlayers(true).size()/8d));
CreatureAllowOverride = true;
_cow = GetSpectatorLocation().getWorld().spawn(GetSpectatorLocation(), Cow.class);
_cow.setCustomName(C.cGreen + C.Bold + _cowName);
_cow.setCustomNameVisible(true);
UtilEnt.Vegetate(_cow);
UtilEnt.ghost(_cow, true, false);
CreatureAllowOverride = false;
}
if (event.GetState() == GameState.End || event.GetState() == GameState.Dead)
_music.cancel();
}
@Override
public void addTutorials()
{
GetTeamList().get(0).setTutorial(new TutorialValentines(this, Manager));
}
@EventHandler
public void tutorialUpdate(UpdateEvent event)
{
TutorialValentines tutorial = (TutorialValentines) GetTeamList().get(0).getTutorial();
tutorial.update(event);
}
@EventHandler
public void knockback(CustomDamageEvent event)
{
if (event.GetDamageePlayer() != null)
{
if (event.GetCause() == DamageCause.ENTITY_ATTACK)
event.AddKnockback("Hit Reversal", -1);
}
}
@EventHandler
public void knockbackRod(EntityDamageEvent event)
{
if (!(event.getEntity() instanceof LivingEntity))
return;
Projectile projectile = Manager.GetDamage().GetProjectile(event);
if (!(projectile instanceof Fish))
return;
LivingEntity damagee = Manager.GetDamage().GetDamageeEntity(event);
LivingEntity damager = UtilEvent.GetDamagerEntity(event, true);
event.setCancelled(true);
damagee.playEffect(EntityEffect.HURT);
UtilAction.velocity(damagee, UtilAlg.getTrajectory(damagee, damager), 0.6, false, 0, 0.2, 1, true);
}
@EventHandler
public void grabDamage(CustomDamageEvent event)
{
if (event.GetDamagerPlayer(false) == null || !IsAlive(event.GetDamagerPlayer(false)))
if (_finalRound)
return;
Iterator<Pig> pigIter = _pigsStocked.iterator();
if (event.GetDamagerPlayer(false) == null)
return;
while (pigIter.hasNext())
if (_finalRound)
{
Pig pig = pigIter.next();
if (event.GetDamageeEntity().equals(pig) ||
(pig.getPassenger() != null && event.GetDamageeEntity().equals(pig.getPassenger())))
{
grabItem(event.GetDamagerPlayer(false), pig);
pigIter.remove();
}
}
event.GetDamageeEntity().eject();
event.GetDamageeEntity().leaveVehicle();
}
@EventHandler
public void grabDamage(PlayerInteractEntityEvent event)
if (event.GetDamageeEntity() instanceof Pig)
{
Iterator<Pig> pigIter = _pigsStocked.iterator();
while (pigIter.hasNext())
{
Pig pig = pigIter.next();
if (event.getRightClicked().equals(pig) ||
(pig.getPassenger() != null && event.getRightClicked().equals(pig.getPassenger())))
{
grabItem(event.getPlayer(), pig);
pigIter.remove();
grabItem(event.GetDamagerPlayer(false), (Pig)event.GetDamageeEntity());
}
if (!event.IsCancelled())
{
event.SetCancelled("Pig Cancel");
event.GetDamageeEntity().playEffect(EntityEffect.HURT);
}
}
private void grabItem(Player player, Pig pig)
{
player.getInventory().addItem(new ItemStack(_item.getMaterial()));
if (!IsAlive(player))
return;
if (_hasItem.contains(player) || _completedRound.contains(player))
return;
if (!_pigs.containsKey(pig))
return;
_pigs.remove(pig);
pig.playEffect(EntityEffect.DEATH);
_pigsDead.add(pig);
//Remove Item from Pig
if (pig.getPassenger() != null)
pig.getPassenger().remove();
//Give Item to Player
player.getInventory().addItem(new ItemStack(_item.getMaterial()));
_hasItem.add(player);
//Effects
player.playSound(player.getLocation(), Sound.ORB_PICKUP, 1f, 1f);
player.getWorld().playSound(pig.getLocation(), Sound.PIG_DEATH, 1f, 1f);
//Inform
UtilTextMiddle.display(C.cGreen + C.Bold + "Success", "Take " + _item.getTitle() + " back to Calvin!", 0, 80, 20, player);
if (_pigs.size() > 0)
UtilTextBottom.display(C.Bold + _pigs.size() + " Items Left", UtilServer.getPlayers());
}
@EventHandler
public void returnDamage(CustomDamageEvent event)
{
if (event.GetDamagerPlayer(false) == null)
return;
if (event.GetDamageeEntity() instanceof Cow)
{
returnItem(event.GetDamagerPlayer(false), (Cow)event.GetDamageeEntity());
event.SetCancelled("Cow Damage");
}
}
@EventHandler
public void returnInteract(PlayerInteractEntityEvent event)
{
if (event.getRightClicked() instanceof Cow)
{
returnItem(event.getPlayer(), (Cow)event.getRightClicked());
}
}
private void returnItem(Player player, Cow cow)
{
if (!IsAlive(player))
return;
if (!_hasItem.remove(player) && player.getVehicle() == null)
return;
//Remove Item to Player
if (!_finalRound)
{
player.getInventory().remove(_item.getMaterial());
}
else
{
_pigs.clear();
}
_completedRound.add(player);
//Effects
player.playSound(player.getLocation(), Sound.LEVEL_UP, 1f, 1f);
player.getWorld().playSound(cow.getLocation(), Sound.COW_IDLE, 2f, 1f);
UtilParticle.PlayParticle(ParticleType.HEART, _cow.getLocation().add(0, 0.5, 0), 1f, 1f, 1f, 0, 10, ViewDist.NORMAL, UtilServer.getPlayers());
//Inform
UtilTextMiddle.display(C.cGreen + C.Bold + _cowName, _item.getEndText(), 0, 80, 20, player);
if (_pigs.size() > 0)
UtilTextBottom.display(C.Bold + _pigs.size() + " Items Left", UtilServer.getPlayers());
}
public double getRadius()
{
return 24 + (GetPlayers(true).size() * 0.5d);
}
//@EventHandler
public void arenaShrinkUpdate(UpdateEvent event)
{
if (!IsLive())
@ -141,8 +353,7 @@ public class Valentines extends SoloGame
if (event.getType() != UpdateType.TICK)
return;
double radius = 12 + (GetPlayers(true).size() * 0.75d);
double radius = getRadius();
Block bestBlock = null;
double bestDist = 0;
@ -151,7 +362,7 @@ public class Valentines extends SoloGame
{
double dist = UtilMath.offset2d(GetSpectatorLocation(), block.getLocation().add(0.5, 0.5, 0.5));
if (dist > radius)
if (dist < radius)
continue;
if (bestBlock == null || dist > bestDist)
@ -168,59 +379,193 @@ public class Valentines extends SoloGame
_blocks.remove(bestBlock);
if (bestBlock.getType() != Material.AIR)
{
if (Math.random() > 0.75)
bestBlock.getWorld().spawnFallingBlock(bestBlock.getLocation().add(0.5, 0.5, 0.5), bestBlock.getType(), bestBlock.getData());
MapUtil.QuickChangeBlockAt(bestBlock.getLocation(), Material.AIR);
}
}
@EventHandler
public void pigSpawn(GameStateChangeEvent event)
public void pigFall(EntityDamageEvent event)
{
if (event.GetState() == GameState.Live)
if (event.getCause() == DamageCause.FALL)
event.setCancelled(true);
}
public void pigSpawn()
{
CreatureAllowOverride = true;
for (int i=0 ; i <= GetPlayers(true).size()-_playersOutPerRound ; i++)
int toSpawn = GetPlayers(true).size()-_playersOutPerRound;
if (toSpawn == 1)
_finalRound = true;
for (int i=0 ; i < toSpawn ; i++)
{
Location loc = UtilAlg.Random(_pigSpawns);
Pig pig = loc.getWorld().spawn(loc, Pig.class);
_pigs.add(pig);
_pigs.put(pig, pig.getLocation());
UtilEnt.Vegetate(pig);
//Give Item
if (toSpawn > 1)
{
Item item = pig.getWorld().dropItem(pig.getLocation(), new ItemStack(_item.getMaterial()));
if (pig.getPassenger() != null)
pig.getPassenger().remove();
pig.setPassenger(item);
}
}
CreatureAllowOverride = false;
}
}
@EventHandler
public void pigUpdate(UpdateEvent event)
{
for (Pig pig : _pigs)
for (Pig pig : _pigs.keySet())
{
Player bestPlayer = null;
double bestDist = 0;
//Fallen Off Island?! JUMP BACK!
Block block = pig.getLocation().getBlock();
while (block.getType() == Material.AIR)
{
block = block.getRelative(BlockFace.DOWN);
}
if (block.isLiquid())
{
UtilAction.velocity(pig,
UtilAlg.getTrajectory(pig.getLocation(),
GetSpectatorLocation().add(Math.random() * 30 - 15, 0, Math.random() * 30 - 15)),
2 + Math.random(), false, 0, 0.4, 10, true);
for (Player player : GetPlayers(true))
{
double dist = UtilMath.offset(pig, player);
pig.getWorld().playSound(pig.getLocation(), Sound.PIG_IDLE, 2f, 2f);
if (bestPlayer == null || dist < bestDist)
continue;
}
//Player Rider
if (_finalRound && pig.getPassenger() != null && pig.getPassenger() instanceof Player)
{
bestPlayer = player;
bestDist = dist;
Location target = pig.getLocation();
target.add(pig.getPassenger().getLocation().getDirection().multiply(5));
UtilEnt.CreatureMoveFast(pig, target, 2);
continue;
}
Vector threat = new Vector(0,0,0);
//waypoint
Location loc = _pigs.get(pig);
//find new waypoint
if (UtilMath.offset2d(pig.getLocation(), loc) < 5 || targetAtEdge(loc))
{
Location newLoc = getNewWaypoint(pig);
if (newLoc != null)
{
loc.setX(newLoc.getX());
loc.setZ(newLoc.getZ());
}
}
if (bestPlayer == null)
return;
threat.add(UtilAlg.getTrajectory2d(pig.getLocation(), loc).multiply(0.4));
//RUN! JUMP! MEOW!
//run from players
double closestDist = 0;
HashMap<LivingEntity, Double> ents = UtilEnt.getInRadius(pig.getLocation(), 12);
if (ents.size() > 0)
{
for (LivingEntity ent : ents.keySet())
{
if (ent instanceof Player)
{
if (ent.equals(pig))
continue;
if (!IsAlive((Player)ent))
continue;
double score = ents.get(ent);
//Add scaled threat!
threat.add(UtilAlg.getTrajectory2d(ent, pig).multiply(score));
if (score > closestDist)
closestDist = score;
}
if (ent instanceof Pig)
{
if (ents.get(ent) < 0.3)
{
threat.add(UtilAlg.getTrajectory2d(ent, pig).multiply(ents.get(ent) * 0.3));
}
}
}
}
threat.normalize();
//MOVE
Location target = pig.getLocation().add(threat.multiply(4));
//try to skate around edge
int attempts = 0;
while (targetAtEdge(target) && attempts < 10)
{
attempts++;
target.add(UtilAlg.getTrajectory(target, GetSpectatorLocation()));
//too cornered! jump back in
if (UtilMath.offset(pig.getLocation(), target) < 2)
{
UtilEnt.CreatureMoveFast(pig, pig.getLocation().add(UtilAlg.getTrajectory(pig.getLocation(), GetSpectatorLocation())), 2f);
UtilAction.velocity(pig,
UtilAlg.getTrajectory(pig.getLocation(),
GetSpectatorLocation().add(Math.random() * 30 - 15, 0, Math.random() * 30 - 15)),
2 + Math.random(), false, 0, 0.4, 10, true);
pig.getWorld().playSound(pig.getLocation(), Sound.PIG_IDLE, 2f, 2f);
}
}
UtilEnt.CreatureMoveFast(pig, target, 1.5f + (float)(1f * closestDist));
}
}
private Location getNewWaypoint(Pig pig)
{
for (int i=0 ; i<50 ; i++)
{
Location loc = pig.getLocation();
loc.add(Math.random() * 50 - 25, 0, Math.random() * 50 - 25);
if (!targetAtEdge(loc))
return loc;
}
return null;
}
private boolean targetAtEdge(Location target)
{
Block block = target.getWorld().getBlockAt(target.getBlockX(), _blockMapHeight, target.getBlockZ());
for (int x=-1 ; x <= 1 ; x++)
for (int z=-1 ; z <= 1 ; z++)
{
if (block.getRelative(x, -1, z).getType() == Material.AIR)
return true;
}
return false;
}
@EventHandler
@ -232,18 +577,61 @@ public class Valentines extends SoloGame
if (event.getType() != UpdateType.TICK)
return;
if (UtilTime.elapsed(_roundTime, _roundTimeLimit) || _pigsStocked.isEmpty())
if (_roundState == 0)
{
nextRound();
}
else if (_roundState == 1)
{
if (UtilTime.elapsed(_roundTime, _roundTimeLimit) || (_pigs.isEmpty() && _hasItem.isEmpty()))
{
if (_completedRound.isEmpty())
{
//Announce
AnnounceEnd(new ArrayList<Player>());
//End
SetState(GameState.End);
return;
}
//Kill Failed Players
for (Player player : GetPlayers(true))
{
if (!_completedRound.contains(player))
{
UtilTextMiddle.display(C.cRed + C.Bold + "Game Over", "You failed to help Calvin", 0, 80, 20, player);
player.damage(9999);
}
}
//Prepare Next Round
_roundState = 2;
_roundTime = System.currentTimeMillis();
//Cull Excess Pigs
Iterator<Pig> pigIter = _pigs.keySet().iterator();
while (pigIter.hasNext())
{
Pig pig = pigIter.next();
if (pig.getPassenger() != null)
pig.getPassenger().remove();
pig.playEffect(EntityEffect.DEATH);
_pigsDead.add(pig);
pigIter.remove();
}
//Stop Music
_music.cancel();
}
}
else if (_roundState == 2 && UtilTime.elapsed(_roundTime, 5000))
{
nextRound();
}
}
@ -252,6 +640,12 @@ public class Valentines extends SoloGame
{
_round++;
_roundState = 1;
_roundTime = System.currentTimeMillis();
_completedRound.clear();
_hasItem.clear();
//Restock Items (only repeat items if required)
if (_unusedGifts.isEmpty())
for (ValItem gift : ValItem.values())
@ -261,35 +655,44 @@ public class Valentines extends SoloGame
_item = UtilAlg.Random(_unusedGifts);
_unusedGifts.remove(_item);
//Cull Excess Pigs
while (_pigs.size() > GetPlayers(true).size() - _playersOutPerRound)
{
Pig pig = _pigs.remove(0);
//Delete Dead Pigs
for (Pig pig : _pigsDead)
pig.remove();
_pigsDead.clear();
//Clean
for (Pig pig : _pigs.keySet())
{
if (pig.getPassenger() != null)
pig.getPassenger().remove();
pig.remove();
}
_pigs.clear();
//Restock Pigs
for (Pig pig : _pigs)
{
//Remove Old Armor Stand
if (pig.getPassenger() != null)
pig.getPassenger().remove();
//Set Item
ArmorStand stand = pig.getWorld().spawn(pig.getLocation(), ArmorStand.class);
stand.setHelmet(new ItemStack(_item.getMaterial()));
pig.setPassenger(stand);
//Set Live
_pigsStocked.add(pig);
}
pigSpawn();
//Announce
if (_pigs.size() > 1)
UtilTextMiddle.display("Round " + _round, _item.getTitle(), 0, 80, 20);
else
{
UtilTextMiddle.display("Final Round", "Capture the Pig!", 0, 80, 20);
for (Player player : GetPlayers(true))
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.SADDLE, (byte)0, 1, "Pig Saddle"));
}
//Music!
_music = new NotePlayer(Manager.getPlugin(), _song, new INoteVerifier()
{
@Override
public boolean shouldPlay(Player player)
{
return Manager.getPreferences().Get(player).HubMusic;
}
}, 0.7F, true);
}
@Override
@ -310,11 +713,18 @@ public class Valentines extends SoloGame
Scoreboard.WriteBlank();
Scoreboard.Write(C.cGreen + "Items Left");
Scoreboard.Write("" + _pigsStocked.size());
if (_roundState == 1)
Scoreboard.Write("" + _pigs.size());
else
Scoreboard.Write("-");
Scoreboard.WriteBlank();
Scoreboard.Write(C.cGreen + "Time Left");
if (_roundState == 1)
Scoreboard.Write("" + UtilTime.MakeStr(_roundTimeLimit - (System.currentTimeMillis() - _roundTime), 0));
else
Scoreboard.Write("-");
Scoreboard.Draw();
}

View File

@ -5,6 +5,7 @@ import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
@ -32,6 +33,6 @@ public class KitMasterOfLove extends Kit
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.FISHING_ROD, (byte)0, 1, "Cupids Pig Catcher"));
}
}

View File

@ -0,0 +1,47 @@
package nautilus.game.arcade.game.games.valentines.tutorial;
import org.bukkit.Sound;
import mineplex.core.common.util.C;
import nautilus.game.arcade.gametutorial.TutorialPhase;
import nautilus.game.arcade.gametutorial.TutorialText;
public class TutorialPhaseValentines extends TutorialPhase
{
public TutorialPhaseValentines()
{
super(new TutorialText[]
{
new TutorialText(C.cRed + "Moolanie", "Calvin! Did you forget Valentines Day again?!", 1, Sound.COW_IDLE),
new TutorialText(C.cGreen + "Calvin", "...of course not!", 2, Sound.COW_IDLE),
new TutorialText(C.cGreen + "Calvin", "I promise this year will be amazing!", 3, Sound.COW_IDLE),
new TutorialText(C.cRed + "Moolanie", "It better be, or we're finished...", 4, Sound.COW_IDLE),
new TutorialText(C.cGreen + "Calvin", "Good thing I prepared for this!", 5, Sound.COW_IDLE),
});
}
@Override
public int ID()
{
return 1;
}
@Override
public void onStart()
{
}
@Override
public void onEnd()
{
}
@Override
public void onMessageDisplay(TutorialText text)
{
}
}

View File

@ -0,0 +1,34 @@
package nautilus.game.arcade.game.games.valentines.tutorial;
import java.util.ArrayList;
import org.bukkit.entity.Cow;
import org.bukkit.entity.Pig;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.typewars.tutorial.TutorialPhaseTypeWars;
import nautilus.game.arcade.game.games.valentines.Valentines;
import nautilus.game.arcade.gametutorial.GameTutorial;
import nautilus.game.arcade.gametutorial.TutorialPhase;
public class TutorialValentines extends GameTutorial
{
private Valentines Host;
private Cow _cowBoy;
private Cow _cowGirl;
private ArrayList<Pig> _pigs = new ArrayList<Pig>();
public TutorialValentines(Valentines valentines, ArcadeManager manager)
{
super(manager, new TutorialPhase[]{new TutorialPhaseValentines()});
Host = valentines;
}
public void update(UpdateEvent event)
{
}
}

View File

@ -303,6 +303,11 @@ public abstract class GameTutorial
return _phases;
}
public TutorialPhase getCurrentPhase()
{
return _currentPhase;
}
public long getTutorialStart()
{
return _started;

View File

@ -7,31 +7,43 @@ public class TutorialText
{
private String _text;
private String _title;
private int _stayTime;
private int _id;
private Sound _sound;
public TutorialText(String text, int stayTime, int id, Sound sound)
public TutorialText(String title, String text, int stayTime, int id, Sound sound)
{
_text = text;
_title = title;
_id = id;
_stayTime = stayTime;
_sound = sound;
}
public TutorialText(String title, String text, int id, Sound sound)
{
this(title, text, (int) (Math.round(1.5 * text.length()) + 25), id, sound);
}
public TutorialText(String text, int id)
{
this(text, (int) (Math.round(1.5 * text.length()) + 25), id, Sound.NOTE_PLING);
this(null, text, (int) (Math.round(1.5 * text.length()) + 25), id, Sound.NOTE_PLING);
}
public TutorialText(String text, int id, Sound sound)
{
this(text, (int) (Math.round(1.5 * text.length()) + 25), id, sound);
this(null, text, (int) (Math.round(1.5 * text.length()) + 25), id, sound);
}
public TutorialText(String text, int stayTime, int id)
{
this(text, stayTime, id, Sound.NOTE_PLING);
this(null, text, stayTime, id, Sound.NOTE_PLING);
}
public String getTitle()
{
return _title;
}
public String getText()