Kit improvements and balancing.

This commit is contained in:
Sarah 2015-07-12 00:21:13 +02:00
parent 64915a0b7d
commit 55a1c311bf
4 changed files with 253 additions and 60 deletions

View File

@ -1,9 +1,12 @@
package nautilus.game.arcade.game.games.snowfight;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
@ -57,6 +60,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
@ -72,11 +76,14 @@ import org.bukkit.potion.PotionType;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
import com.sun.xml.internal.bind.v2.runtime.unmarshaller.XsiNilLoader.Array;
public class SnowFight extends TeamGame
{
private HashMap<Player, Integer> _tiles;
private boolean _meteoroids;
private boolean _peace;
public SnowFight(ArcadeManager manager)
{
@ -100,8 +107,11 @@ public class SnowFight extends TeamGame
this.CompassGiveItem = false;
this.TeamArmor = true;
this.TeamArmorHotbar = true;
this.BlockPlace = true;
this.BlockBreakAllow = new HashSet<>(Arrays.asList(Material.FENCE.getId()));
this._tiles = new HashMap<Player, Integer>();
this._meteoroids = false;
this._peace = false;
}
@EventHandler
@ -120,33 +130,10 @@ public class SnowFight extends TeamGame
world.setWeatherDuration(40);
world.setTime(4000);
}
@EventHandler
public void KitItems(UpdateEvent event)
{
if(!IsLive())
return;
if (event.getType() == UpdateType.SLOWER)
{
for (Player player : GetPlayers(true))
{
if (GetKit(player) instanceof KitTactician)
{
int amount = 0;
if (player.getInventory().getItem(1) != null && player.getInventory().getItem(1).getAmount() <= 2)
amount = 2;
else
amount = 1;
player.getInventory().setItem(1, ItemStackFactory.Instance.CreateStack(Material.EGG, (byte) 0, amount, "Slow Egg"));
}
}
}
}
@EventHandler
public void IceDamage(UpdateEvent event) {
if(event.getType() != UpdateType.SEC)
if(event.getType() != UpdateType.FAST)
return;
if(!IsLive())
@ -170,7 +157,21 @@ public class SnowFight extends TeamGame
if(!IsLive())
return;
if(System.currentTimeMillis() <= getGameLiveTime() + (4 * 60 * 1000))
if(System.currentTimeMillis() <= getGameLiveTime() + (15 * 1000))
return;
if(!_peace)
{
for(Player player : GetPlayers(false))
{
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1F, 1F);
UtilTextMiddle.display(C.cGold + C.Bold + "Peace Phase ended", "Kill your enemies", player);
}
this.Announce(C.cRed + C.Bold + "ALERT: " + ChatColor.RESET + C.Bold + "Peace Phase ended");
_peace = true;
}
if(System.currentTimeMillis() <= getGameLiveTime() + (195 * 1000))
return;
if(!_meteoroids)
@ -356,12 +357,19 @@ public class SnowFight extends TeamGame
public void GenerallDamage(CustomDamageEvent event)
{
if(event.GetCause() == DamageCause.ENTITY_ATTACK)
event.AddMod(event.GetDamagerPlayer(false).getName(), "Melee", 1, true);
event.SetCancelled("No Melee");
}
@EventHandler(priority = EventPriority.HIGH)
public void SnowballEggDamage(CustomDamageEvent event)
{
if(!_peace)
{
event.SetCancelled("Peace Phase");
return;
}
if (event.IsCancelled())
return;
@ -374,13 +382,6 @@ public class SnowFight extends TeamGame
if(proj instanceof Fireball)
return;
if(proj instanceof Egg)
{
event.GetDamageePlayer().addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 100, 1));
event.GetDamageePlayer().addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 40, 0));
event.AddMod("Egg", "Egg", 3, true);
}
if(proj instanceof Snowball)
event.AddMod("Snowball", "Snowball", 2, true);
@ -464,33 +465,45 @@ public class SnowFight extends TeamGame
{
Entity projectile = event.getEntity();
int size = 3;
float size = 2.5F;
double damage = 2.5D;
for(int i = 1; i <= 10; i++)
{
if(System.currentTimeMillis() >= getGameLiveTime() + (((30 * i) + 300) * 1000))
if(System.currentTimeMillis() >= getGameLiveTime() + (((30 * i) + 180) * 1000))
{
size = 3 * i;
size = 2.5F * i;
damage = 2.5D * i;
}
}
if (projectile.hasMetadata("Meteor"))
{
projectile.remove();
CustomExplosion explosion = new CustomExplosion(getArcadeManager().GetDamage(), getArcadeManager().GetExplosion(),
projectile.getLocation(), size, "Meteor");
explosion.setBlockExplosionSize(size);
explosion.setFallingBlockExplosionAmount(20);
explosion.setFallingBlockExplosion(false);
explosion.setDropItems(false);
explosion.setBlocksDamagedEqually(true);
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, projectile.getLocation(), 1.0F, 1.0F, 1.0F, 1, 3, ViewDist.MAX, UtilServer.getPlayers());
for(Player player : UtilServer.getPlayers()) {
player.playSound(projectile.getLocation(), Sound.EXPLODE, 1, 1);
}
boolean fall = true;
for(Entity player : projectile.getNearbyEntities(size, size, size))
{
if(player instanceof Player)
{
Player damagee = (Player) player;
Bukkit.getPluginManager().callEvent(new CustomDamageEvent(damagee, null, null, DamageCause.CUSTOM, damage, false, true, true, "Ice Meteoroid", "Ice Meteoroid", false));
}
}
for(Block block : UtilBlock.getInRadius(event.getEntity().getLocation(), size).keySet())
{
if(block.getType() != Material.AIR)
@ -498,7 +511,16 @@ public class SnowFight extends TeamGame
block.setType(Material.ICE);
if(block.getRelative(BlockFace.DOWN).getType() == Material.AIR)
{
block.getWorld().spawnFallingBlock(block.getLocation(), block.getType(), block.getData());
// to reduce lag
if(fall)
{
block.getWorld().spawnFallingBlock(block.getLocation(), block.getType(), block.getData());
fall = false;
}
else
{
fall = true;
}
block.setType(Material.AIR);
}
}
@ -537,6 +559,18 @@ public class SnowFight extends TeamGame
return null;
}
@EventHandler
public void Place(BlockPlaceEvent event)
{
if(event.getBlock().getRelative(BlockFace.DOWN).getType() == Material.ICE
|| event.getBlock().getRelative(BlockFace.DOWN).getType() == Material.PACKED_ICE
|| event.getBlock().getRelative(BlockFace.DOWN).getType() == Material.FENCE)
{
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cant place a Barrier here!"));
event.setCancelled(true);
}
}
@Override
@EventHandler
public void ScoreboardUpdate(UpdateEvent event)
@ -569,7 +603,7 @@ public class SnowFight extends TeamGame
}
}
long time = 1000 * 60 * 4 - (System.currentTimeMillis() - this.GetStateTime());
long time = 1000 * 195 - (System.currentTimeMillis() - this.GetStateTime());
if (time > 0)
{

View File

@ -1,6 +1,10 @@
package nautilus.game.arcade.game.games.snowfight.kits;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
@ -8,12 +12,19 @@ import nautilus.game.arcade.kit.Perk;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.entity.Egg;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.PotionSplashEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import org.bukkit.potion.Potion;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.potion.PotionType;
public class KitMedic extends Kit
@ -31,8 +42,10 @@ public class KitMedic extends Kit
"Left-Click Snow to pick up Snowballs (Max. 16)",
"Right-Click Snowballs to throw them.",
" ",
"Has 5 Healing Potions.",
"Right-Click Potions to throw them and heal nearby Players."
"Gets 1 Healing Potion every 32 seconds [max. 1]",
"Causes Regeneration II and Slowness II when hit.",
" ",
"Supports all nearby allies with REGENERATION."
},
new Perk[]
@ -48,12 +61,7 @@ public class KitMedic extends Kit
public void GiveItems(Player player)
{
player.getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
Potion potion = new Potion(PotionType.INSTANT_HEAL);
potion.setLevel(2);
potion.setSplash(true);
for(int i = 3; i <= 7; i++) {
player.getInventory().setItem(i, potion.toItemStack(1));
}
player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
}
@Override
@ -65,4 +73,68 @@ public class KitMedic extends Kit
ent.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS));
}
@EventHandler
public void Aura(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!HasKit(player))
continue;
for (Player other : Manager.GetGame().GetPlayers(true))
{
if (other.equals(player))
continue;
if (UtilMath.offset(player, other) > 4)
continue;
if( Manager.GetGame().GetTeam(player).equals(Manager.GetGame().GetTeam(other)))
Manager.GetCondition().Factory().Regen("Aura", other, player, 1.9, 0, false, false, false);
}
}
}
@EventHandler
public void KitItems(UpdateEvent event)
{
if(!Manager.GetGame().IsLive())
return;
if (event.getType() == UpdateType.SLOWER)
{
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!HasKit(player))
continue;
Potion potion = new Potion(PotionType.INSTANT_HEAL);
potion.setSplash(true);
player.getInventory().setItem(1, potion.toItemStack(1));
}
}
}
@EventHandler
public void Splash(PotionSplashEvent event)
{
if(event.getEntity().getShooter() instanceof Player)
{
if(!HasKit((Player) event.getEntity().getShooter()))
return;
for(Entity entity : event.getAffectedEntities())
{
if(entity instanceof Player)
{
Manager.GetCondition().Factory().Slow("Heal Potion", (Player)entity, (Player)event.getEntity().getShooter(), 5.0, 1, false, false, false, false);
}
}
}
}
}

View File

@ -5,16 +5,21 @@ import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import mineplex.core.common.util.UtilMath;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
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.PerkFallDamage;
public class KitSportsman extends Kit
{
@ -31,11 +36,12 @@ public class KitSportsman extends Kit
"Left-Click Snow to pick up Snowballs (Max. 16)",
"Right-Click Snowballs to throw them.",
"",
"Use your compass to find and kill your enemies."
"Supports all nearby allies with SPEED."
},
new Perk[]
{
new PerkFallDamage(5)
},
EntityType.SKELETON,
new ItemStack(Material.SNOW_BALL));
@ -45,10 +51,8 @@ public class KitSportsman extends Kit
@Override
public void GiveItems(Player player)
{
player.getInventory().setItem(1, ItemStackFactory.Instance.CreateStack(Material.COMPASS.getId(), (byte) 0, 1, "§a§lTracking Compass"));
player.getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, 0));
}
@Override
@ -60,4 +64,29 @@ public class KitSportsman extends Kit
ent.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS));
}
@EventHandler
public void Aura(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!HasKit(player))
continue;
for (Player other : Manager.GetGame().GetPlayers(true))
{
if (other.equals(player))
continue;
if (UtilMath.offset(player, other) > 4)
continue;
if( Manager.GetGame().GetTeam(player).equals(Manager.GetGame().GetTeam(other)))
Manager.GetCondition().Factory().Speed("Aura", other, player, 1.9, 0, false, false, false);
}
}
}
}

View File

@ -1,6 +1,12 @@
package nautilus.game.arcade.game.games.snowfight.kits;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
@ -12,8 +18,10 @@ import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import org.bukkit.potion.PotionType;
public class KitTactician extends Kit
{
@ -29,15 +37,16 @@ public class KitTactician extends Kit
"Left-Click Snow to pick up Snowballs (Max. 16)",
"Right-Click Snowballs to throw them.",
" ",
"Gets 1 Slow Egg every 16 seconds (Max. 2)",
"Right-Click Slow Eggs to throw them.",
"Causes Blindness and Slowness II when hit."
"Gets 1 Barrier every 32 seconds [max. 2]",
"Place Barriers to improve your defense.",
"You cant place Barriers above Ice, Packed Ice or Fences.",
" ",
"Supports all nearby allies with RESISTANCE."
}, new Perk[]
{
new PerkFallDamage(2)
},
EntityType.SKELETON,
new ItemStack(Material.EGG));
new ItemStack(Material.FENCE));
}
@ -46,6 +55,7 @@ public class KitTactician extends Kit
{
player.getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
player.getInventory().setItem(7, ItemStackFactory.Instance.CreateStack(Material.COMPASS.getId(), (byte) 0, 1, "§a§lTracking Compass"));
}
@Override
@ -56,5 +66,53 @@ public class KitTactician extends Kit
ent.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));
ent.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS));
}
@EventHandler
public void Aura(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!HasKit(player))
continue;
for (Player other : Manager.GetGame().GetPlayers(true))
{
if (other.equals(player))
continue;
if (UtilMath.offset(player, other) > 4)
continue;
if( Manager.GetGame().GetTeam(player).equals(Manager.GetGame().GetTeam(other)))
Manager.GetCondition().Factory().Protection("Aura", other, player, 1.9, 0, false, false, false);
}
}
}
@EventHandler
public void KitItems(UpdateEvent event)
{
if(!Manager.GetGame().IsLive())
return;
if (event.getType() == UpdateType.SLOWEST)
{
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!HasKit(player))
continue;
int amount = 0;
if (player.getInventory().getItem(1) != null && UtilInv.contains(player, Material.FENCE, (byte) 0, 1))
amount = 2;
else
amount = 1;
player.getInventory().setItem(1, ItemStackFactory.Instance.CreateStack(Material.FENCE, (byte) 0, amount, "Barrier"));
}
}
}
}