Added Milk the Cow
Maps now set Min/Max Y
This commit is contained in:
parent
ea81e558ea
commit
2a65086b70
@ -0,0 +1,20 @@
|
||||
package mineplex.core.disguise.disguises;
|
||||
|
||||
public class DisguiseCow extends DisguiseAnimal
|
||||
{
|
||||
public DisguiseCow(org.bukkit.entity.Entity entity)
|
||||
{
|
||||
super(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int GetEntityTypeId()
|
||||
{
|
||||
return 92;
|
||||
}
|
||||
|
||||
public String getHurtSound()
|
||||
{
|
||||
return "mob.cow.hurt";
|
||||
}
|
||||
}
|
@ -12,6 +12,7 @@ import nautilus.game.arcade.game.games.deathtag.DeathTag;
|
||||
import nautilus.game.arcade.game.games.dragonescape.DragonEscape;
|
||||
import nautilus.game.arcade.game.games.dragons.Dragons;
|
||||
import nautilus.game.arcade.game.games.evolution.Evolution;
|
||||
import nautilus.game.arcade.game.games.milkcow.MilkCow;
|
||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||
import nautilus.game.arcade.game.games.quiver.Quiver;
|
||||
import nautilus.game.arcade.game.games.runner.Runner;
|
||||
@ -41,6 +42,7 @@ public class GameFactory
|
||||
else if (gameType == GameType.DragonEscape) return new DragonEscape(_manager);
|
||||
else if (gameType == GameType.Evolution) return new Evolution(_manager);
|
||||
else if (gameType == GameType.MineWare) return new MineWare(_manager);
|
||||
else if (gameType == GameType.MilkCow) return new MilkCow(_manager);
|
||||
else if (gameType == GameType.Quiver) return new Quiver(_manager);
|
||||
else if (gameType == GameType.Runner) return new Runner(_manager);
|
||||
else if (gameType == GameType.SnowFight) return new SnowFight(_manager);
|
||||
|
@ -12,6 +12,7 @@ public enum GameType
|
||||
Evolution("Evolution"),
|
||||
Horse("Horseback"),
|
||||
MineWare("MineWare"),
|
||||
MilkCow("Milk the Cow"),
|
||||
Quiver("One in the Quiver"),
|
||||
Runner("Runner"),
|
||||
Smash("Super Smash Mobs"),
|
||||
|
@ -140,7 +140,6 @@ public abstract class Game implements Listener
|
||||
|
||||
public int WorldTimeSet = -1;
|
||||
public boolean WorldWeatherEnabled = false;
|
||||
public int WorldHeightLimit = 0;
|
||||
public int WorldWaterDamage = 0;
|
||||
|
||||
public int HungerSet = -1;
|
||||
|
@ -24,7 +24,7 @@ public class KitBrute extends Kit
|
||||
},
|
||||
new Perk[]
|
||||
{
|
||||
new PerkBodySlam()
|
||||
new PerkBodySlam(8, 2)
|
||||
},
|
||||
EntityType.PLAYER,
|
||||
new ItemStack(Material.IRON_AXE));
|
||||
|
@ -60,13 +60,6 @@ public class DeathTag extends SoloGame
|
||||
this.CompassEnabled = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ParseData()
|
||||
{
|
||||
if (!WorldData.GetDataLocs("WHITE").isEmpty())
|
||||
WorldHeightLimit = WorldData.GetDataLocs("WHITE").get(0).getBlockY();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void RestrictKits()
|
||||
{
|
||||
|
@ -0,0 +1,15 @@
|
||||
package nautilus.game.arcade.game.games.milkcow;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CowScore
|
||||
{
|
||||
public org.bukkit.entity.Player Player;
|
||||
public double Score;
|
||||
|
||||
public CowScore(Player player, double i)
|
||||
{
|
||||
Player = player;
|
||||
Score = i;
|
||||
}
|
||||
}
|
@ -0,0 +1,481 @@
|
||||
package nautilus.game.arcade.game.games.milkcow;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftCreature;
|
||||
import org.bukkit.entity.Chicken;
|
||||
import org.bukkit.entity.Cow;
|
||||
import org.bukkit.entity.Creature;
|
||||
import org.bukkit.entity.Pig;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Villager;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scoreboard.DisplaySlot;
|
||||
import org.bukkit.scoreboard.Objective;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.SoloGame;
|
||||
import nautilus.game.arcade.game.games.milkcow.kits.*;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.NullKit;
|
||||
import net.minecraft.server.v1_6_R2.EntityCreature;
|
||||
import net.minecraft.server.v1_6_R2.Navigation;
|
||||
|
||||
public class MilkCow extends SoloGame
|
||||
{
|
||||
private GameTeam _farmers;
|
||||
private GameTeam _cows;
|
||||
|
||||
private ArrayList<Location> _chickens;
|
||||
private ArrayList<Location> _pigs;
|
||||
private ArrayList<Location> _villager;
|
||||
|
||||
private ArrayList<CowScore> _ranks = new ArrayList<CowScore>();
|
||||
private ArrayList<String> _lastScoreboard = new ArrayList<String>();
|
||||
|
||||
private HashSet<Cow> _herd = new HashSet<Cow>();
|
||||
|
||||
private Objective _scoreObj;
|
||||
|
||||
public MilkCow(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.MilkCow,
|
||||
|
||||
new Kit[]
|
||||
{
|
||||
new KitFarmerJump(manager),
|
||||
new NullKit(manager),
|
||||
new KitCow(manager),
|
||||
},
|
||||
|
||||
new String[]
|
||||
{
|
||||
"Each Farmer must gather milk.",
|
||||
"Drink 15 buckets of milk to win!",
|
||||
"",
|
||||
"Cow must stop his herd from being milked.",
|
||||
"Kill all the farmers to win!"
|
||||
});
|
||||
|
||||
this.CompassEnabled = true;
|
||||
|
||||
_scoreObj = GetScoreboard().registerNewObjective("Milk", "dummy");
|
||||
_scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ParseData()
|
||||
{
|
||||
_chickens = WorldData.GetDataLocs("WHITE");
|
||||
_pigs = WorldData.GetDataLocs("PINK");
|
||||
_villager = WorldData.GetDataLocs("PURPLE");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void RestrictKits()
|
||||
{
|
||||
for (Kit kit : GetKits())
|
||||
{
|
||||
for (GameTeam team : GetTeamList())
|
||||
{
|
||||
if (team.GetColor() == ChatColor.RED)
|
||||
{
|
||||
if (kit.GetName().contains("Farmer"))
|
||||
team.GetRestrictedKits().add(kit);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (kit.GetName().contains("Cow"))
|
||||
team.GetRestrictedKits().add(kit);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler
|
||||
public void CustomTeamGeneration(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Recruit)
|
||||
return;
|
||||
|
||||
_farmers = this.GetTeamList().get(0);
|
||||
_farmers.SetName("Farmers");
|
||||
|
||||
//Undead Team
|
||||
_cows = new GameTeam("Cow", ChatColor.RED, _farmers.GetSpawns());
|
||||
GetTeamList().add(_cows);
|
||||
|
||||
RestrictKits();
|
||||
}
|
||||
|
||||
@Override
|
||||
public GameTeam ChooseTeam(Player player)
|
||||
{
|
||||
return _farmers;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void SpawnAnimals(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Live)
|
||||
return;
|
||||
|
||||
for (Location loc : _chickens)
|
||||
{
|
||||
this.CreatureAllowOverride = true;
|
||||
Chicken ent = loc.getWorld().spawn(loc, Chicken.class);
|
||||
if (Math.random() > 0.75)
|
||||
{
|
||||
ent.setBaby();
|
||||
ent.setAgeLock(true);
|
||||
}
|
||||
|
||||
this.CreatureAllowOverride = false;
|
||||
}
|
||||
|
||||
for (Location loc : _pigs)
|
||||
{
|
||||
this.CreatureAllowOverride = true;
|
||||
Pig ent = loc.getWorld().spawn(loc, Pig.class);
|
||||
if (Math.random() > 0.75)
|
||||
{
|
||||
ent.setBaby();
|
||||
ent.setAgeLock(true);
|
||||
}
|
||||
|
||||
this.CreatureAllowOverride = false;
|
||||
}
|
||||
|
||||
for (Location loc : _villager)
|
||||
{
|
||||
this.CreatureAllowOverride = true;
|
||||
Villager ent = loc.getWorld().spawn(loc, Villager.class);
|
||||
if (Math.random() > 0.75)
|
||||
{
|
||||
ent.setCustomName("Bob");
|
||||
ent.setCustomNameVisible(true);
|
||||
}
|
||||
|
||||
this.CreatureAllowOverride = false;
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void HerdUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
return;
|
||||
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (_cows.GetPlayers(true).size() <= 0)
|
||||
return;
|
||||
|
||||
Player host = _cows.GetPlayers(true).get(0);
|
||||
|
||||
Iterator<Cow> herdIterator = _herd.iterator();
|
||||
|
||||
while (herdIterator.hasNext())
|
||||
{
|
||||
Cow cow = herdIterator.next();
|
||||
|
||||
if (!cow.isValid())
|
||||
{
|
||||
cow.remove();
|
||||
herdIterator.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
//Move
|
||||
EntityCreature ec = ((CraftCreature)cow).getHandle();
|
||||
Navigation nav = ec.getNavigation();
|
||||
|
||||
if (UtilMath.offset(cow, host) > 6)
|
||||
{
|
||||
nav.a(host.getLocation().getX(), host.getLocation().getY(),host.getLocation().getZ(), 1.6f);
|
||||
}
|
||||
}
|
||||
|
||||
while (_herd.size() < 8)
|
||||
{
|
||||
this.CreatureAllowOverride = true;
|
||||
Cow cow = host.getWorld().spawn(host.getLocation(), Cow.class);
|
||||
if (Math.random() > 0.5)
|
||||
{
|
||||
cow.setBaby();
|
||||
cow.setAgeLock(true);
|
||||
}
|
||||
|
||||
_herd.add(cow);
|
||||
this.CreatureAllowOverride = false;
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void HerdDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (event.GetDamageeEntity() instanceof Creature)
|
||||
event.SetCancelled("Cow Immunity");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void CowUpdate(UpdateEvent event)
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
int req = 1;
|
||||
|
||||
while (_cows.GetPlayers(true).size() < req && _farmers.GetPlayers(true).size() > 0)
|
||||
{
|
||||
Player player = _farmers.GetPlayers(true).get(UtilMath.r(_farmers.GetPlayers(true).size()));
|
||||
SetCow(player, true);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetCow(Player player, boolean forced)
|
||||
{
|
||||
if (!GetPlaces().contains(player))
|
||||
GetPlaces().add(0, player);
|
||||
|
||||
SetPlayerTeam(player, _cows);
|
||||
|
||||
//Kit
|
||||
Kit newKit = GetKits()[2];
|
||||
|
||||
SetKit(player, newKit, false);
|
||||
newKit.ApplyKit(player);
|
||||
|
||||
//Refresh
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
{
|
||||
other.hidePlayer(player);
|
||||
other.showPlayer(player);
|
||||
}
|
||||
|
||||
if (forced)
|
||||
{
|
||||
AddGems(player, 10, "Forced Cow", false);
|
||||
|
||||
Announce(F.main("Game", F.elem(_farmers.GetColor() + player.getName()) + " has become " +
|
||||
F.elem(_cows.GetColor() + newKit.GetName()) + "."));
|
||||
|
||||
player.getWorld().strikeLightningEffect(player.getLocation());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void GetMilk(PlayerInteractEntityEvent event)
|
||||
{
|
||||
if (!UtilGear.isMat(event.getPlayer().getItemInHand(), Material.BUCKET))
|
||||
return;
|
||||
|
||||
if (!(event.getRightClicked() instanceof Player))
|
||||
return;
|
||||
|
||||
Player cow = (Player)event.getRightClicked();
|
||||
|
||||
if (!_cows.HasPlayer(cow))
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
event.getPlayer().setItemInHand(new ItemStack(Material.MILK_BUCKET));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void DrinkMilk(PlayerItemConsumeEvent event)
|
||||
{
|
||||
if (event.getItem().getType() != Material.MILK_BUCKET)
|
||||
return;
|
||||
|
||||
SetScore(event.getPlayer(), GetScore(event.getPlayer())+1);
|
||||
event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.BURP, 2f, 1f);
|
||||
Manager.GetCondition().Factory().Regen("Drink Milk", event.getPlayer(), event.getPlayer(), 6, 1, false, false, false);
|
||||
}
|
||||
|
||||
public void SetScore(Player player, double level)
|
||||
{
|
||||
_scoreObj.getScore(player).setScore((int)level);
|
||||
|
||||
//Rank
|
||||
for (CowScore score : _ranks)
|
||||
{
|
||||
if (score.Player.equals(player))
|
||||
{
|
||||
score.Score = level;
|
||||
|
||||
if (level == 6)
|
||||
End();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_ranks.add(new CowScore(player, level));
|
||||
}
|
||||
|
||||
public double GetScore(Player player)
|
||||
{
|
||||
if (!IsAlive(player))
|
||||
return 0;
|
||||
|
||||
//Rank
|
||||
for (CowScore score : _ranks)
|
||||
{
|
||||
if (score.Player.equals(player))
|
||||
{
|
||||
return score.Score;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private void SortScores()
|
||||
{
|
||||
for (int i=0 ; i<_ranks.size() ; i++)
|
||||
{
|
||||
for (int j=_ranks.size()-1 ; j>0 ; j--)
|
||||
{
|
||||
if (_ranks.get(j).Score > _ranks.get(j-1).Score)
|
||||
{
|
||||
CowScore temp = _ranks.get(j);
|
||||
_ranks.set(j, _ranks.get(j-1));
|
||||
_ranks.set(j-1, temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void End()
|
||||
{
|
||||
SortScores();
|
||||
|
||||
//Set Places
|
||||
_places.clear();
|
||||
for (int i=0 ; i<_ranks.size() ; i++)
|
||||
_places.add(i, _ranks.get(i).Player);
|
||||
|
||||
//Award Gems
|
||||
if (_ranks.size() >= 1)
|
||||
AddGems(_ranks.get(0).Player, 20, "1st Place", false);
|
||||
|
||||
if (_ranks.size() >= 2)
|
||||
AddGems(_ranks.get(1).Player, 15, "2nd Place", false);
|
||||
|
||||
if (_ranks.size() >= 3)
|
||||
AddGems(_ranks.get(2).Player, 10, "3rd Place", false);
|
||||
|
||||
//Participation
|
||||
for (Player player : GetPlayers(false))
|
||||
if (player.isOnline())
|
||||
AddGems(player, 10, "Participation", false);
|
||||
|
||||
SetState(GameState.End);
|
||||
AnnounceEnd(_places);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void EndCheck()
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (!UtilTime.elapsed(GetStateTime(), 5000))
|
||||
return;
|
||||
|
||||
if (_cows.GetPlayers(true).size() <= 0)
|
||||
End();
|
||||
|
||||
if (_farmers.GetPlayers(true).size() <= 0)
|
||||
{
|
||||
SetScore(_cows.GetPlayers(true).get(0), 20);
|
||||
End();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler
|
||||
public void ScoreboardUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
//Wipe Last
|
||||
for (String string : _lastScoreboard)
|
||||
{
|
||||
GetScoreboard().resetScores(Bukkit.getOfflinePlayer(string));
|
||||
}
|
||||
_lastScoreboard.clear();
|
||||
|
||||
boolean added = false;
|
||||
|
||||
//Write New
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
int score = (int)GetScore(player);
|
||||
|
||||
if (score > 0)
|
||||
added = true;
|
||||
|
||||
GameTeam team = GetTeam(player);
|
||||
if (team == null) continue;
|
||||
|
||||
String out = score + " " + team.GetColor() + player.getName();
|
||||
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
|
||||
_lastScoreboard.add(out);
|
||||
|
||||
GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(out)).setScore(score);
|
||||
}
|
||||
|
||||
if (!added)
|
||||
{
|
||||
String out = "DRINK ITS MILK!";
|
||||
|
||||
_lastScoreboard.add(out);
|
||||
|
||||
GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(out)).setScore(1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean CanJoinTeam(GameTeam team)
|
||||
{
|
||||
if (team.GetColor() == ChatColor.RED)
|
||||
{
|
||||
return team.GetSize() == 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package nautilus.game.arcade.game.games.milkcow.kits;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.disguise.disguises.DisguiseCow;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.SmashKit;
|
||||
import nautilus.game.arcade.kit.perks.*;
|
||||
|
||||
public class KitCow extends SmashKit
|
||||
{
|
||||
public KitCow(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "The Disgusting Cow", KitAvailability.Blue,
|
||||
|
||||
new String[]
|
||||
{
|
||||
},
|
||||
|
||||
new Perk[]
|
||||
{
|
||||
new PerkDamageSet(4),
|
||||
new PerkKnockbackMultiplier(4),
|
||||
new PerkCharge(),
|
||||
new PerkCowBomb(),
|
||||
new PerkBodySlam(6, 5),
|
||||
},
|
||||
EntityType.COW,
|
||||
null);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte)0, 1,
|
||||
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Cow Bomb",
|
||||
new String[]
|
||||
{
|
||||
ChatColor.RESET + "Say goodbye to one of your children",
|
||||
ChatColor.RESET + "and hurl them towards your opponents.",
|
||||
ChatColor.RESET + "Explodes on impact, dealing knockback",
|
||||
}));
|
||||
|
||||
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1,
|
||||
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Body Slam",
|
||||
new String[]
|
||||
{
|
||||
ChatColor.RESET + "Hurl your giant fat cow-body forwards.",
|
||||
ChatColor.RESET + "Deals damage and knockback to anyone it",
|
||||
ChatColor.RESET + "collides with.",
|
||||
}));
|
||||
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.LEATHER, (byte)0, 1,
|
||||
C.cYellow + C.Bold + "Sprint" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Cow Charge",
|
||||
new String[]
|
||||
{
|
||||
ChatColor.RESET + "Charge with great power, flinging",
|
||||
ChatColor.RESET + "filthy farmers out of your way!",
|
||||
}));
|
||||
|
||||
//Disguise
|
||||
DisguiseCow disguise = new DisguiseCow(player);
|
||||
disguise.SetName(C.cRed + player.getName());//+ " the Furious Cow");
|
||||
disguise.SetCustomNameVisible(true);
|
||||
Manager.GetDisguise().disguise(disguise);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void NoDamage(CustomDamageEvent event)
|
||||
{
|
||||
Player player = event.GetDamageePlayer();
|
||||
if (player == null) return;
|
||||
|
||||
if (HasKit(player))
|
||||
event.SetCancelled("Cow Immunity");
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package nautilus.game.arcade.game.games.milkcow.kits;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
|
||||
|
||||
public class KitFarmerJump extends Kit
|
||||
{
|
||||
public KitFarmerJump(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Rabbit Farmer", KitAvailability.Free,
|
||||
|
||||
new String[]
|
||||
{
|
||||
"Learned a thing or two from his rabbits!"
|
||||
},
|
||||
|
||||
new Perk[]
|
||||
{
|
||||
new PerkDoubleJump("Double Jump", 1, 0.8, false)
|
||||
},
|
||||
|
||||
EntityType.VILLAGER,
|
||||
new ItemStack(Material.IRON_HOE));
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void FireItemResist(UpdateEvent event)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_HOE));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BUCKET));
|
||||
}
|
||||
}
|
@ -68,13 +68,6 @@ public class ZombieSurvival extends SoloGame
|
||||
this.HungerSet = 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ParseData()
|
||||
{
|
||||
if (!WorldData.GetDataLocs("WHITE").isEmpty())
|
||||
WorldHeightLimit = WorldData.GetDataLocs("WHITE").get(0).getBlockY();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void RestrictKits()
|
||||
{
|
||||
|
@ -28,12 +28,18 @@ public class PerkBodySlam extends Perk
|
||||
{
|
||||
private HashMap<LivingEntity, Long> _live = new HashMap<LivingEntity, Long>();
|
||||
|
||||
public PerkBodySlam()
|
||||
private int _damage;
|
||||
private double _knockback;
|
||||
|
||||
public PerkBodySlam(int damage, double knockback)
|
||||
{
|
||||
super("Body Slam", new String[]
|
||||
{
|
||||
C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Body Slam"
|
||||
});
|
||||
|
||||
_damage = damage;
|
||||
_knockback = knockback;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -62,7 +68,7 @@ public class PerkBodySlam extends Perk
|
||||
if (!Recharge.Instance.use(player, GetName(), 8000, true))
|
||||
return;
|
||||
|
||||
UtilAction.velocity(player, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 1.2, true);
|
||||
UtilAction.velocity(player, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 0.8, true);
|
||||
|
||||
//Record
|
||||
_live.put(player, System.currentTimeMillis());
|
||||
@ -108,16 +114,14 @@ public class PerkBodySlam extends Perk
|
||||
|
||||
public void DoSlam(Player damager, LivingEntity damagee)
|
||||
{
|
||||
int damage = 8;
|
||||
|
||||
//Damage Event
|
||||
Manager.GetDamage().NewDamageEvent(damager, damagee, null,
|
||||
DamageCause.CUSTOM, damage/3d, true, true, false,
|
||||
DamageCause.CUSTOM, _damage/3d, true, true, false,
|
||||
damager.getName(), GetName() + " Recoil");
|
||||
|
||||
//Damage Event
|
||||
Manager.GetDamage().NewDamageEvent(damagee, damager, null,
|
||||
DamageCause.CUSTOM, damage, true, true, false,
|
||||
DamageCause.CUSTOM, _damage, true, true, false,
|
||||
damager.getName(), GetName());
|
||||
|
||||
//Inform
|
||||
@ -131,6 +135,6 @@ public class PerkBodySlam extends Perk
|
||||
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
|
||||
return;
|
||||
|
||||
event.AddKnockback(GetName(), 2);
|
||||
event.AddKnockback(GetName(), _knockback);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,107 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Cow;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
public class PerkCharge extends Perk
|
||||
{
|
||||
public PerkCharge()
|
||||
{
|
||||
super("Cow Charge", new String[]
|
||||
{
|
||||
C.cYellow + "Sprint" + C.cGray + " to use " + C.cGreen + "Cow Charge"
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Damage(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
for (Player player : Manager.GetGame().GetPlayers(true))
|
||||
{
|
||||
if (!player.isSprinting())
|
||||
continue;
|
||||
|
||||
if (!Kit.HasKit(player))
|
||||
continue;
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.COW_WALK, 2f, 1f);
|
||||
|
||||
Manager.GetCondition().Factory().Speed(GetName(), player, player, 0.9, 2, false, false, false);
|
||||
|
||||
HashMap<LivingEntity, Double> targets = UtilEnt.getInRadius(player.getLocation().add(player.getLocation().getDirection().setY(0).normalize()), 2);
|
||||
for (LivingEntity cur : targets.keySet())
|
||||
{
|
||||
if (cur.equals(player))
|
||||
continue;
|
||||
|
||||
if (cur instanceof Cow)
|
||||
continue;
|
||||
|
||||
Vector dir = UtilAlg.getTrajectory2d(player.getLocation().toVector(), cur.getLocation().toVector());
|
||||
dir.add(player.getLocation().getDirection().setY(0).normalize());
|
||||
dir.setY(0);
|
||||
dir.normalize();
|
||||
|
||||
//Damage Event
|
||||
Manager.GetDamage().NewDamageEvent(cur, player, null,
|
||||
DamageCause.CUSTOM, 2, false, false, false,
|
||||
player.getName(), GetName());
|
||||
|
||||
//Velocity
|
||||
UtilAction.velocity(cur, dir, 1 + 0.8 * targets.get(cur), true, 0, 0.8 + 0.4 * targets.get(cur), 1.6, true);
|
||||
|
||||
//Condition
|
||||
Manager.GetCondition().Factory().Falling(GetName(), cur, player, 10, false, true);
|
||||
|
||||
//Sound
|
||||
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_WOOD, 0.75f, 1f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Charge(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FASTER)
|
||||
return;
|
||||
|
||||
for (Player player : Manager.GetGame().GetPlayers(true))
|
||||
{
|
||||
if (!Kit.HasKit(player))
|
||||
continue;
|
||||
|
||||
if (player.isSprinting())
|
||||
{
|
||||
UtilPlayer.hunger(player, -1);
|
||||
|
||||
if (player.getFoodLevel() <= 0)
|
||||
{
|
||||
player.setSprinting(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.hunger(player, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,134 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Cow;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.projectile.IThrown;
|
||||
import mineplex.core.projectile.ProjectileUser;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
public class PerkCowBomb extends Perk implements IThrown
|
||||
{
|
||||
public PerkCowBomb()
|
||||
{
|
||||
super("Cow Bomb", new String[]
|
||||
{
|
||||
C.cYellow + "Right-Click" + C.cGray + " with Shovel to use " + C.cGreen + "Cow Bomb"
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void Shoot(PlayerInteractEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
||||
return;
|
||||
|
||||
if (UtilBlock.usable(event.getClickedBlock()))
|
||||
return;
|
||||
|
||||
if (event.getPlayer().getItemInHand() == null)
|
||||
return;
|
||||
|
||||
if (!event.getPlayer().getItemInHand().getType().toString().contains("_SPADE"))
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!Kit.HasKit(player))
|
||||
return;
|
||||
|
||||
if (!Recharge.Instance.use(player, GetName(), 3000, true))
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
UtilInv.Update(player);
|
||||
|
||||
Manager.GetGame().CreatureAllowOverride = true;
|
||||
Cow ent = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), Cow.class);
|
||||
Manager.GetGame().CreatureAllowOverride = false;
|
||||
ent.setBaby();
|
||||
ent.setAgeLock(true);
|
||||
ent.setMaxHealth(100);
|
||||
ent.setHealth(100);
|
||||
|
||||
UtilAction.velocity(ent, player.getLocation().getDirection(), 1.4, false, 0, 0.3, 10, false);
|
||||
|
||||
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true,
|
||||
null, 1f, 1f,
|
||||
null, 1, UpdateType.SLOW,
|
||||
2d);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
|
||||
|
||||
//Effect
|
||||
player.getWorld().playSound(player.getLocation(), Sound.COW_IDLE, 2f, 1.5f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Collide(LivingEntity target, Block block, ProjectileUser data)
|
||||
{
|
||||
Explode(data);
|
||||
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
//Damage Event
|
||||
Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null,
|
||||
DamageCause.PROJECTILE, 4, true, true, false,
|
||||
UtilEnt.getName(data.GetThrower()), GetName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Idle(ProjectileUser data)
|
||||
{
|
||||
Explode(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Expire(ProjectileUser data)
|
||||
{
|
||||
Explode(data);
|
||||
}
|
||||
|
||||
public void Explode(ProjectileUser data)
|
||||
{
|
||||
//Effect
|
||||
data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.COW_HURT, 2f, 1.2f);
|
||||
data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.COW_HURT, 2f, 1.2f);
|
||||
|
||||
data.GetThrown().getWorld().createExplosion(data.GetThrown().getLocation(), 0.5f);
|
||||
data.GetThrown().remove();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Knockback(CustomDamageEvent event)
|
||||
{
|
||||
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
|
||||
return;
|
||||
|
||||
event.AddKnockback(GetName(), 5);
|
||||
}
|
||||
}
|
@ -89,7 +89,8 @@ public class PerkFirefly extends Perk
|
||||
if (!UtilTime.elapsed(data.Time, 1000))
|
||||
{
|
||||
data.Player.setVelocity(new Vector(0,0,0));//.teleport(data.Location);
|
||||
data.Player.getWorld().playSound(data.Location, Sound.EXPLODE, 0.2f, 0.6f);
|
||||
data.Player.getWorld().playSound(data.Player.getLocation(), Sound.EXPLODE, 0.2f, 0.6f);
|
||||
data.Location = data.Player.getLocation();
|
||||
|
||||
if (_tick == 0)
|
||||
{
|
||||
@ -111,7 +112,8 @@ public class PerkFirefly extends Perk
|
||||
else if (!UtilTime.elapsed(data.Time, 2000))
|
||||
{
|
||||
data.Player.setVelocity(data.Player.getLocation().getDirection().multiply(0.7).add(new Vector(0,0.1,0)));
|
||||
data.Player.getWorld().playSound(data.Location, Sound.EXPLODE, 0.6f, 1.2f);
|
||||
//data.Player.setVelocity(data.Location.getDirection().multiply(0.7).add(new Vector(0,0.1,0)));
|
||||
data.Player.getWorld().playSound(data.Player.getLocation(), Sound.EXPLODE, 0.6f, 1.2f);
|
||||
|
||||
if (_tick == 0)
|
||||
{
|
||||
@ -172,7 +174,7 @@ public class PerkFirefly extends Perk
|
||||
if (!data.Player.equals(event.GetDamageeEntity()))
|
||||
continue;
|
||||
|
||||
if (!UtilTime.elapsed(data.Time, 1000) && event.GetCause() == DamageCause.PROJECTILE)
|
||||
if (!UtilTime.elapsed(data.Time, 1000))// && event.GetCause() == DamageCause.PROJECTILE)
|
||||
{
|
||||
dataIterator.remove();
|
||||
}
|
||||
|
@ -656,7 +656,8 @@ public class GameFlagManager implements Listener
|
||||
player.getLocation().getX() < game.WorldData.MinX ||
|
||||
player.getLocation().getZ() > game.WorldData.MaxZ ||
|
||||
player.getLocation().getZ() < game.WorldData.MinZ ||
|
||||
(game.WorldHeightLimit > 0 && player.getLocation().getY() > game.WorldHeightLimit && game.IsAlive(player)))
|
||||
((player.getLocation().getY() > game.WorldData.MaxY ||
|
||||
player.getLocation().getY() < game.WorldData.MinY) && game.IsAlive(player)))
|
||||
{
|
||||
if (!Manager.IsAlive(player))
|
||||
{
|
||||
|
@ -15,7 +15,6 @@ import mineplex.core.common.util.MapUtil;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.WorldUtil;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.minecraft.core.utils.ZipUtil;
|
||||
import net.minecraft.server.v1_6_R2.ChunkPreLoadEvent;
|
||||
@ -42,6 +41,9 @@ public class WorldData
|
||||
public int CurX = 0;
|
||||
public int CurZ = 0;
|
||||
|
||||
public int MinY = -1;
|
||||
public int MaxY = 256;
|
||||
|
||||
public String MapName = "Null";
|
||||
public String MapAuthor = "Null";
|
||||
|
||||
@ -265,6 +267,29 @@ public class WorldData
|
||||
System.out.println("World Data Read Error: Invalid MaxZ [" + tokens[1] + "]");
|
||||
}
|
||||
}
|
||||
else if (tokens[0].equalsIgnoreCase("MIN_Y"))
|
||||
{
|
||||
try
|
||||
{
|
||||
MinY = Integer.parseInt(tokens[1]);
|
||||
CurZ = MinZ;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("World Data Read Error: Invalid MinZ [" + tokens[1] + "]");
|
||||
}
|
||||
}
|
||||
else if (tokens[0].equalsIgnoreCase("MAX_Y"))
|
||||
{
|
||||
try
|
||||
{
|
||||
MaxY = Integer.parseInt(tokens[1]);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("World Data Read Error: Invalid MaxZ [" + tokens[1] + "]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
in.close();
|
||||
|
Loading…
Reference in New Issue
Block a user