Final stuff

This commit is contained in:
Mysticate 2015-07-25 04:18:18 -04:00
parent a002da4c0f
commit d295cead09
4 changed files with 60 additions and 46 deletions

View File

@ -24,6 +24,7 @@ import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.CombatComponent;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
@ -32,7 +33,7 @@ import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.lobbers.events.TNTPreExplodeEvent;
import nautilus.game.arcade.game.games.lobbers.events.TNTThrowEvent;
import nautilus.game.arcade.game.games.lobbers.kits.KitArmorer;
import nautilus.game.arcade.game.games.lobbers.kits.KitDetonator;
import nautilus.game.arcade.game.games.lobbers.kits.KitPitcher;
import nautilus.game.arcade.game.games.lobbers.kits.KitJumper;
import nautilus.game.arcade.game.games.lobbers.kits.KitWaller;
import nautilus.game.arcade.game.games.lobbers.trackers.Tracker6Kill;
@ -43,7 +44,6 @@ import nautilus.game.arcade.game.games.lobbers.trackers.TrackerTNTThrown;
import nautilus.game.arcade.kit.Kit;
import org.bukkit.ChatColor;
import org.bukkit.EntityEffect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
@ -52,6 +52,7 @@ import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.ExplosionPrimeEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.metadata.FixedMetadataValue;
@ -72,7 +73,7 @@ public class BombLobbers extends TeamGame implements IThrown
{
new KitJumper(manager),
new KitArmorer(manager),
new KitDetonator(manager),
new KitPitcher(manager),
// new KitMortar(manager), << Spare time kit for Bobbeh
new KitWaller(manager)
}, new String[]
@ -289,8 +290,11 @@ public class BombLobbers extends TeamGame implements IThrown
if (!IsLive())
return;
for (Entry<TNTPrimed, BombToken> tnt : _tnt.entrySet())
Iterator<Entry<TNTPrimed, BombToken>> iterator = _tnt.entrySet().iterator();
while (iterator.hasNext())
{
Entry<TNTPrimed, BombToken> tnt = iterator.next();
if (tnt.getKey() == null)
continue;
@ -516,15 +520,7 @@ public class BombLobbers extends TeamGame implements IThrown
{
if (!(data.GetThrown() instanceof TNTPrimed))
return;
TNTPrimed tnt = (TNTPrimed) data.GetThrown();
if (_tnt.containsKey(tnt))
{
_tnt.get(tnt).Primed = true;
tnt.setFuseTicks(0);
}
if (!(data.GetThrower() instanceof Player))
return;
@ -537,10 +533,9 @@ public class BombLobbers extends TeamGame implements IThrown
data.GetThrown().setVelocity(new Vector());
if (target != null)
{
UtilAction.velocity(target, UtilAlg.getTrajectory2d(data.GetThrown().getLocation(), target.getLocation()), .2, false, 0, 0.2, .4, true);
target.playEffect(EntityEffect.HURT);
}
Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, DamageCause.PROJECTILE, 6.0, false, false, true, "Throwing TNT", "Throwing TNT Direct Hit");
}
@Override
@ -554,4 +549,12 @@ public class BombLobbers extends TeamGame implements IThrown
{
}
public void knockbackIncrease(CustomDamageEvent event)
{
if (event.GetCause() != DamageCause.ENTITY_EXPLOSION && event.GetCause() != DamageCause.BLOCK_EXPLOSION)
return;
event.AddKnockback("Explosion", 1.5D);
}
}

View File

@ -21,13 +21,14 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
public class KitDetonator extends Kit
public class KitPitcher extends Kit
{
public KitDetonator(ArcadeManager manager)
public KitPitcher(ArcadeManager manager)
{
super(manager, "Detonator", KitAvailability.Gem, 4000, new String[]
super(manager, "Pitcher", KitAvailability.Gem, 4000, new String[]
{
"He doesn't like to wait. ",
"He can easily pitch the perfect shot for any occasion.",
"",
C.cYellow + "Left Click" + C.cGray + " lever to " + C.cGreen + "Decrease Velocity",
C.cYellow + "Right Click" + C.cGray + " lever to " + C.cGreen + "Increase Velocity",
"Maximum Velocity of " + C.cYellow + "3.",
@ -42,7 +43,7 @@ public class KitDetonator extends Kit
@Override
public void GiveItems(Player player)
{
player.getInventory().setItem(1, new ItemBuilder(Material.LEVER).setTitle(F.item("Velocity Selector")).build());
player.getInventory().setItem(1, new ItemBuilder(Material.LEVER).setTitle(F.item("Velocity Selector")).setAmount(3).build());
}
@EventHandler
@ -67,7 +68,7 @@ public class KitDetonator extends Kit
GiveItems(event.getPlayer());
}
UtilAction.velocity(event.getTNT(), event.getPlayer().getLocation().getDirection(), lever.getAmount(), false, 0.0D, 0.1D, 10.0D, false);
UtilAction.velocity(event.getTNT(), event.getPlayer().getLocation().getDirection(), getVelocity(lever.getAmount()), false, 0.0D, 0.1D, 10.0D, false);
}
}
@ -107,4 +108,15 @@ public class KitDetonator extends Kit
UtilInv.Update(event.getPlayer());
}
}
private double getVelocity(int amount)
{
if (amount == 1)
return 1.5;
if (amount == 2)
return 1.75;
return 2.0;
}
}

View File

@ -22,7 +22,7 @@ public class PerkCraftman extends Perk
super("Craftman", new String[]
{
C.cGray + "Recieve 1 TNT every so often. Maximum of 3."
});
}, false);
_recharge = Recharge.Instance;
}
@ -40,8 +40,9 @@ public class PerkCraftman extends Perk
{
if (!Kit.HasKit(player))
continue;
if (!_recharge.use(player, "Bomb Give", (long) (1000 * (8 - Math.floor(Manager.GetGame().getGameLiveTime() / 20))), false, false))
//If game time is 56 seconds - 56000
//8 - 1
if (!_recharge.use(player, "Bomb Give", getRechargeTime(), false, false))
continue;
//Has 3
@ -51,4 +52,23 @@ public class PerkCraftman extends Perk
UtilInv.insert(player, new ItemBuilder(Material.TNT).setTitle(F.item("Throwing TNT")).build());
}
}
private long getRechargeTime()
{
long ingame = Manager.GetGame().getGameLiveTime();
if (ingame <= 20000)
return 8000;
if (ingame <= 40000)
return 7000;
if (ingame <= 60000)
return 6000;
if (ingame <= 620000)
return 5000;
return 4000;
}
}

View File

@ -77,27 +77,6 @@ public class PerkWaller extends Perk
_wallBlocks.addAll(buildWall(event.getClickedBlock().getLocation(), event.getPlayer().getLocation().getYaw()));
}
@EventHandler
public void explodeTNT(UpdateEvent event)
{
if (!Manager.GetGame().IsLive())
return;
if (event.getType() != UpdateType.FAST)
return;
for (TNTPrimed tnt : _tnt)
{
for (Block near : UtilBlock.getInRadius(tnt.getLocation(), 3.0F).keySet())
{
if (_wallBlocks.contains(near.getLocation()))
{
tnt.setFuseTicks(0);
}
}
}
}
@SuppressWarnings("deprecation")
private Set<Location> buildWall(final Location source, final float playerYaw)
{