Added a sniper kit! :D
This commit is contained in:
parent
40afcaf26b
commit
d0e49280a4
@ -24,6 +24,7 @@ import nautilus.game.arcade.game.TeamGame;
|
||||
import nautilus.game.arcade.game.games.paintball.kits.KitMachineGun;
|
||||
import nautilus.game.arcade.game.games.paintball.kits.KitRifle;
|
||||
import nautilus.game.arcade.game.games.paintball.kits.KitShotgun;
|
||||
import nautilus.game.arcade.game.games.paintball.kits.KitSniper;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.stats.KillFastStatTracker;
|
||||
import nautilus.game.arcade.stats.LastStandStatTracker;
|
||||
@ -262,6 +263,10 @@ public class Paintball extends TeamGame
|
||||
{
|
||||
count = 3;
|
||||
}
|
||||
if (GetKit(damager) instanceof KitSniper)
|
||||
{
|
||||
count = ((KitSniper) GetKit(damager)).getPaintDamage(damager);
|
||||
}
|
||||
}
|
||||
|
||||
//Out
|
||||
|
@ -11,6 +11,7 @@ import org.bukkit.inventory.meta.PotionMeta;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.paintball.kits.perks.PerkPaintballMachineGun;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
@ -12,6 +12,7 @@ import org.bukkit.potion.PotionEffectType;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.paintball.kits.perks.PerkPaintballRifle;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
@ -11,6 +11,7 @@ import org.bukkit.inventory.meta.PotionMeta;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.paintball.kits.perks.PerkPaintballShotgun;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
@ -0,0 +1,77 @@
|
||||
package nautilus.game.arcade.game.games.paintball.kits;
|
||||
|
||||
import mineplex.core.achievement.Achievement;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.paintball.kits.perks.PerkPaintballShotgun;
|
||||
import nautilus.game.arcade.game.games.paintball.kits.perks.PerkPaintballSniper;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.PerkSlow;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class KitSniper extends Kit
|
||||
{
|
||||
public KitSniper(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Sniper", KitAvailability.Achievement,
|
||||
|
||||
new String[]
|
||||
{
|
||||
"Long range sniper rifle",
|
||||
C.cGold + "Higher damage every second scoped"
|
||||
},
|
||||
|
||||
new Perk[]
|
||||
{
|
||||
new PerkPaintballShotgun(),
|
||||
new PerkSlow(0)
|
||||
},
|
||||
EntityType.ZOMBIE,
|
||||
new ItemStack(Material.STONE_HOE));
|
||||
|
||||
setAchievementRequirements(new Achievement[]
|
||||
{
|
||||
Achievement.SUPER_PAINTBALL_FLAWLESS_VICTORY,
|
||||
Achievement.SUPER_PAINTBALL_KILLING_SPREE,
|
||||
Achievement.SUPER_PAINTBALL_LAST_STAND,
|
||||
Achievement.SUPER_PAINTBALL_MEDIC,
|
||||
Achievement.SUPER_PAINTBALL_SPEEDRUNNER,
|
||||
Achievement.SUPER_PAINTBALL_WINS
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_HOE, (byte)0, 1, C.cWhite + "Paintball Sniper Rifle"));
|
||||
|
||||
UtilInv.insert(player, ItemStackFactory.Instance.CreateStack(Material.POTION, (byte) 16429, 1, "Water Bomb"));
|
||||
|
||||
player.getInventory().setHelmet(new ItemBuilder(Material.LEATHER_HELMET).setColor(Color.WHITE).build());
|
||||
player.getInventory().setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(Color.WHITE).build());
|
||||
player.getInventory().setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).setColor(Color.WHITE).build());
|
||||
player.getInventory().setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setColor(Color.WHITE).build());
|
||||
}
|
||||
|
||||
public int getPaintDamage(Player player)
|
||||
{
|
||||
for (Perk perk : this.GetPerks())
|
||||
{
|
||||
if (perk instanceof PerkPaintballSniper)
|
||||
{
|
||||
return ((PerkPaintballSniper) perk).getPaintDamage(player);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
package nautilus.game.arcade.game.games.paintball.kits.perks;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
@ -1,4 +1,4 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
package nautilus.game.arcade.game.games.paintball.kits.perks;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
@ -1,4 +1,4 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
package nautilus.game.arcade.game.games.paintball.kits.perks;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
@ -0,0 +1,147 @@
|
||||
package nautilus.game.arcade.game.games.paintball.kits.perks;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.recharge.RechargedEvent;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.EnderPearl;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.entity.Snowball;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
public class PerkPaintballSniper extends Perk
|
||||
{
|
||||
private HashMap<Player, Long> _crouching = new HashMap<Player, Long>();
|
||||
|
||||
public PerkPaintballSniper()
|
||||
{
|
||||
super("Sniper Rifle", new String[]
|
||||
{
|
||||
C.cYellow + "Crouch" + C.cGray + " to use " + C.cGreen + "Scope",
|
||||
C.cYellow + "Right-Click" + C.cGray + " to use " + C.cGreen + "Shotgun"
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Recharge(RechargedEvent event)
|
||||
{
|
||||
if (!event.GetAbility().equals(GetName()))
|
||||
return;
|
||||
|
||||
event.GetPlayer().playSound(event.GetPlayer().getLocation(), Sound.NOTE_STICKS, 2f, 1f);
|
||||
event.GetPlayer().playSound(event.GetPlayer().getLocation(), Sound.NOTE_STICKS, 2f, 1.5f);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Shoot(PlayerInteractEvent event)
|
||||
{
|
||||
if (!Manager.GetGame().IsLive())
|
||||
return;
|
||||
|
||||
if (!UtilEvent.isAction(event, ActionType.R))
|
||||
return;
|
||||
|
||||
if (UtilBlock.usable(event.getClickedBlock()))
|
||||
return;
|
||||
|
||||
if (!UtilGear.isMat(event.getItem(), Material.STONE_HOE))
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!Manager.IsAlive(player))
|
||||
return;
|
||||
|
||||
if (UtilPlayer.isSpectator(player))
|
||||
return;
|
||||
|
||||
if (!Kit.HasKit(player))
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
if (!Recharge.Instance.use(player, GetName(), 1400, true, false))
|
||||
return;
|
||||
|
||||
Projectile proj = player.launchProjectile(Manager.GetGame().GetTeam(player).GetColor() == ChatColor.AQUA ? Snowball.class : EnderPearl.class);
|
||||
|
||||
proj.setVelocity(proj.getVelocity().normalize().multiply(4));
|
||||
|
||||
//Sound
|
||||
player.getWorld().playSound(player.getLocation(), Sound.CHICKEN_EGG_POP, 0.8f, 1f);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onUpdate(UpdateEvent event)
|
||||
{
|
||||
if (!Manager.GetGame().IsLive())
|
||||
return;
|
||||
|
||||
//Cleanup check
|
||||
HashMap<Player, Long> copyMap = new HashMap<Player, Long>();
|
||||
copyMap.putAll(_crouching);
|
||||
for (Player player : copyMap.keySet())
|
||||
{
|
||||
boolean remove = false;
|
||||
if (!Manager.GetGame().IsAlive(player))
|
||||
remove = true;
|
||||
|
||||
if (UtilPlayer.isSpectator(player))
|
||||
remove = true;
|
||||
|
||||
if (!player.isSneaking())
|
||||
remove = true;
|
||||
|
||||
if (remove)
|
||||
{
|
||||
_crouching.remove(player);
|
||||
|
||||
// Zoom
|
||||
if (Manager.GetCondition().HasCondition(player, ConditionType.SLOW, GetName()))
|
||||
Manager.GetCondition().EndCondition(player, ConditionType.SLOW, GetName());
|
||||
}
|
||||
}
|
||||
|
||||
//Add check
|
||||
for (Player player : Manager.GetGame().GetPlayers(true))
|
||||
{
|
||||
if (UtilPlayer.isSpectator(player))
|
||||
continue;
|
||||
|
||||
if (!player.isSneaking())
|
||||
continue;
|
||||
|
||||
if (_crouching.containsKey(player))
|
||||
continue;
|
||||
|
||||
_crouching.put(player, System.currentTimeMillis());
|
||||
|
||||
// Zoom
|
||||
if (!Manager.GetCondition().HasCondition(player, ConditionType.SLOW, GetName()))
|
||||
Manager.GetCondition().Factory().Slow(GetName(), player, null, Double.MAX_VALUE, 5, false, false, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
public int getPaintDamage(Player player)
|
||||
{
|
||||
if (!_crouching.containsKey(player))
|
||||
return 1;
|
||||
|
||||
return (int) Math.max(1, Math.floor((System.currentTimeMillis() - _crouching.get(player)) / 1000));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user