added flag to projectiles

work on cow kit
This commit is contained in:
Cheese 2015-10-12 14:39:14 +11:00
parent aa30c866fd
commit 6a173073a4
31 changed files with 336 additions and 72 deletions

View File

@ -45,7 +45,7 @@ public class ItemFleshHook extends ItemGadget implements IThrown
UtilAction.velocity(item, player.getLocation().getDirection(),
1.6, false, 0, 0.2, 10, false);
Manager.getProjectileManager().AddThrow(item, player, this, -1, true, true, true,
Manager.getProjectileManager().AddThrow(item, player, this, -1, true, true, true, true,
Sound.FIRE_IGNITE, 1.4f, 0.8f, ParticleType.CRIT, null, 0, UpdateType.TICK, 0.5f);
//Inform

View File

@ -57,7 +57,7 @@ public class ItemMelonLauncher extends ItemGadget implements IThrown
UtilAction.velocity(item, player.getLocation().getDirection(),
1, false, 0, 0.2, 10, false);
Manager.getProjectileManager().AddThrow(item, player, this, -1, true, true, true,
Manager.getProjectileManager().AddThrow(item, player, this, -1, true, true, true, true,
null, 1f, 1f, null, null, 0, UpdateType.TICK, 0.5f);
//Inform

View File

@ -114,7 +114,7 @@ public class MorphBat extends MorphGadget implements IThrown
UtilAction.velocity(item, player.getLocation().getDirection(),
0.01, true, -0.3, 0, 10, false);
Manager.getProjectileManager().AddThrow(item, player, this, -1, true, true, true,
Manager.getProjectileManager().AddThrow(item, player, this, -1, true, true, true, true,
null, 1f, 1f, null, null, 0, UpdateType.TICK, 0.5f);
//Inform

View File

@ -97,7 +97,7 @@ public class MorphVillager extends MorphGadget implements IThrown
UtilAction.velocity(gem, player.getLocation().getDirection(), 1, false, 0, 0.2, 1, false);
//Throw
Manager.getProjectileManager().AddThrow(gem, player, this, -1, true, true, true,
Manager.getProjectileManager().AddThrow(gem, player, this, -1, true, true, true, true,
null, 1.4f, 0.8f, null, null, 0, UpdateType.TICK, 0.5f);
Manager.getDonationManager().RewardGems(null, this.GetName() + " Throw", player.getName(), player.getUniqueId(), -20);

View File

@ -31,107 +31,107 @@ public class ProjectileManager extends MiniPlugin
}
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, float hitboxGrow)
long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle, float hitboxGrow)
{
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
expireTime, hitPlayer, hitBlock, idle, false,
expireTime, hitPlayer, hitNonPlayerEntity, hitBlock, idle, false,
null, 1f, 1f, null, 0, null, null, 0F, 0F, 0F, 0F, 1, hitboxGrow));
}
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, boolean pickup, float hitboxGrow)
long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle, boolean pickup, float hitboxGrow)
{
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
expireTime, hitPlayer, hitBlock, idle, pickup,
expireTime, hitPlayer, hitNonPlayerEntity, hitBlock, idle, pickup,
null, 1f, 1f, null, 0, null, null, 0F, 0F, 0F, 0F, 1, hitboxGrow));
}
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle,
long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle,
Sound sound, float soundVolume, float soundPitch, Effect effect, int effectData, UpdateType effectRate , float hitboxGrow)
{
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
expireTime, hitPlayer, hitBlock, idle, false,
expireTime, hitPlayer, hitNonPlayerEntity, hitBlock, idle, false,
sound, soundVolume, soundPitch, effect, effectData, effectRate, null, 0F, 0F, 0F, 0F, 1, hitboxGrow));
}
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle,
long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle,
Sound sound, float soundVolume, float soundPitch, ParticleType particle, Effect effect, int effectData, UpdateType effectRate, float hitboxGrow)
{
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
expireTime, hitPlayer, hitBlock, idle, false,
expireTime, hitPlayer, hitNonPlayerEntity, hitBlock, idle, false,
sound, soundVolume, soundPitch, effect, effectData, effectRate, particle, 0F, 0F, 0F, 0F, 1, hitboxGrow));
}
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle,
long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle,
Sound sound, float soundVolume, float soundPitch, ParticleType particle, UpdateType effectRate, float hitboxMult)
{
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
expireTime, hitPlayer, hitBlock, idle, false,
expireTime, hitPlayer, hitNonPlayerEntity, hitBlock, idle, false,
sound, soundVolume, soundPitch, null, 0, effectRate, particle, 0F, 0F, 0F, 0F, 1, hitboxMult));
}
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle,
long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle,
Sound sound, float soundVolume, float soundPitch, ParticleType particle, float pX, float pY, float pZ, float pS, int pC, UpdateType effectRate, float hitboxMult)
{
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
expireTime, hitPlayer, hitBlock, idle, false,
expireTime, hitPlayer, hitNonPlayerEntity, hitBlock, idle, false,
sound, soundVolume, soundPitch, null, 0, effectRate, particle, pX, pY, pZ, pS, pC, hitboxMult));
}
// WITH CAN HIT PLAYERS LIST:
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, float hitboxGrow, List<Player> canHit)
long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle, float hitboxGrow, List<Player> canHit)
{
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
expireTime, hitPlayer, hitBlock, idle, false,
expireTime, hitPlayer, hitNonPlayerEntity, hitBlock, idle, false,
null, 1f, 1f, null, 0, null, null, 0F, 0F, 0F, 0F, 1, hitboxGrow, canHit));
}
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, boolean pickup, float hitboxGrow, List<Player> canHit)
long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle, boolean pickup, float hitboxGrow, List<Player> canHit)
{
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
expireTime, hitPlayer, hitBlock, idle, pickup,
expireTime, hitPlayer, hitNonPlayerEntity, hitBlock, idle, pickup,
null, 1f, 1f, null, 0, null, null, 0F, 0F, 0F, 0F, 1, hitboxGrow, canHit));
}
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle,
long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle,
Sound sound, float soundVolume, float soundPitch, Effect effect, int effectData, UpdateType effectRate , float hitboxGrow, List<Player> canHit)
{
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
expireTime, hitPlayer, hitBlock, idle, false,
expireTime, hitPlayer, hitNonPlayerEntity, hitBlock, idle, false,
sound, soundVolume, soundPitch, effect, effectData, effectRate, null, 0F, 0F, 0F, 0F, 1, hitboxGrow, canHit));
}
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle,
long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle,
Sound sound, float soundVolume, float soundPitch, ParticleType particle, Effect effect, int effectData, UpdateType effectRate, float hitboxGrow, List<Player> canHit)
{
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
expireTime, hitPlayer, hitBlock, idle, false,
expireTime, hitPlayer, hitNonPlayerEntity, hitBlock, idle, false,
sound, soundVolume, soundPitch, effect, effectData, effectRate, particle, 0F, 0F, 0F, 0F, 1, hitboxGrow, canHit));
}
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle,
long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle,
Sound sound, float soundVolume, float soundPitch, ParticleType particle, UpdateType effectRate, float hitboxMult, List<Player> canHit)
{
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
expireTime, hitPlayer, hitBlock, idle, false,
expireTime, hitPlayer, hitNonPlayerEntity, hitBlock, idle, false,
sound, soundVolume, soundPitch, null, 0, effectRate, particle, 0F, 0F, 0F, 0F, 1, hitboxMult, canHit));
}
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle,
long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle,
Sound sound, float soundVolume, float soundPitch, ParticleType particle, float pX, float pY, float pZ, float pS, int pC, UpdateType effectRate, float hitboxMult, List<Player> canHit)
{
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
expireTime, hitPlayer, hitBlock, idle, false,
expireTime, hitPlayer, hitNonPlayerEntity, hitBlock, idle, false,
sound, soundVolume, soundPitch, null, 0, effectRate, particle, pX, pY, pZ, pS, pC, hitboxMult, canHit));
}

View File

@ -37,6 +37,7 @@ public class ProjectileUser
private long _expireTime;
private boolean _hitPlayer = false;
private boolean _hitNonPlayerEntity = false;
private boolean _hitBlock = false;
private boolean _idle = false;
private boolean _pickup = false;
@ -61,7 +62,7 @@ public class ProjectileUser
private List<Player> _canHit;
public ProjectileUser(ProjectileManager throwInput, Entity thrown, LivingEntity thrower, IThrown callback,
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, boolean pickup,
long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle, boolean pickup,
Sound sound, float soundVolume, float soundPitch,
Effect effect, int effectData, UpdateType effectRate,
ParticleType particle, float particleX, float particleY,
@ -75,6 +76,7 @@ public class ProjectileUser
_expireTime = expireTime;
_hitPlayer = hitPlayer;
_hitNonPlayerEntity = hitNonPlayerEntity;
_hitBlock = hitBlock;
_idle = idle;
_pickup = pickup;
@ -97,7 +99,7 @@ public class ProjectileUser
}
public ProjectileUser(ProjectileManager throwInput, Entity thrown, LivingEntity thrower, IThrown callback,
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, boolean pickup,
long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle, boolean pickup,
Sound sound, float soundVolume, float soundPitch,
Effect effect, int effectData, UpdateType effectRate,
ParticleType particle, float particleX, float particleY,
@ -111,6 +113,7 @@ public class ProjectileUser
_expireTime = expireTime;
_hitPlayer = hitPlayer;
_hitNonPlayerEntity = hitNonPlayerEntity;
_hitBlock = hitBlock;
_idle = idle;
_pickup = pickup;
@ -157,7 +160,7 @@ public class ProjectileUser
return true;
}
if (_hitPlayer)
if (_hitPlayer || _hitNonPlayerEntity)
{
double distanceToEntity = 0.0D;
LivingEntity victim = null;
@ -181,6 +184,9 @@ public class ProjectileUser
((CraftEntity)_thrown).getHandle().motY,
((CraftEntity)_thrown).getHandle().motZ).grow(_hitboxGrow, _hitboxGrow, _hitboxGrow)))
{
if (!_hitNonPlayerEntity && !(entity instanceof Player))
continue;
if (entity instanceof net.minecraft.server.v1_7_R4.Entity)
{
Entity bukkitEntity = ((net.minecraft.server.v1_7_R4.Entity) entity).getBukkitEntity();

View File

@ -204,7 +204,7 @@ public class BlockToss extends SkillCharge implements IThrown
//Action
UtilAction.velocity(block, cur.getLocation().getDirection(), mult, false, 0, 0, 1, true);
Factory.Projectile().AddThrow(block, cur, this, -1, true, true, true,
Factory.Projectile().AddThrow(block, cur, this, -1, true, true, true, true,
null, 0, 0, null, 0, UpdateType.FASTEST, 1.2f);
//Event

View File

@ -107,7 +107,7 @@ public class FleshHook extends SkillActiveCharge implements IThrown
UtilAction.velocity(item, cur.getLocation().getDirection(),
1 + charge , false, 0, 0.2, 20, false);
Factory.Projectile().AddThrow(item, cur, this, -1, true, true, true,
Factory.Projectile().AddThrow(item, cur, this, -1, true, true, true, true,
Sound.FIRE_IGNITE, 1.4f, 0.8f, ParticleType.CRIT, UpdateType.TICK, 0.6f);
//Inform

View File

@ -69,7 +69,7 @@ public class FreezingBlast extends SkillActive implements IThrown
//Action
Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(79));
item.setVelocity(player.getLocation().getDirection());
Factory.Projectile().AddThrow(item, player, this, -1, true, true, true,
Factory.Projectile().AddThrow(item, player, this, -1, true, true, true, true,
Sound.FIZZ, 0.6f, 1.6f, null, 0, UpdateType.FASTEST, 1f);
//Inform

View File

@ -72,7 +72,7 @@ public class GlacialBlade extends SkillActive implements IThrown
//Action
Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()).subtract(0, 0.2, 0), ItemStackFactory.Instance.CreateStack(370));
UtilAction.velocity(item, player.getLocation().getDirection(), 1.6, false, 0, 0.2, 10, false);
Factory.Projectile().AddThrow(item, player, this, -1, true, true, true,
Factory.Projectile().AddThrow(item, player, this, -1, true, true, true, true,
null, 0, 0, ParticleType.SNOW_SHOVEL, UpdateType.TICK, 0.3f);
//Effect

View File

@ -70,7 +70,7 @@ public class IcePrison extends SkillActive implements IThrown
//Action
Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(79));
item.setVelocity(player.getLocation().getDirection());
Factory.Projectile().AddThrow(item, player, this, -1, true, true, true,
Factory.Projectile().AddThrow(item, player, this, -1, true, true, true, true,
Sound.FIZZ, 0.6f, 1.6f, ParticleType.SNOW_SHOVEL, UpdateType.TICK, 1.5f);
//Inform

View File

@ -101,7 +101,7 @@ public class LightningOrb extends SkillActive implements IThrown
//Action
Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(57));
item.setVelocity(player.getLocation().getDirection());
Factory.Projectile().AddThrow(item, player, this, System.currentTimeMillis() + 5000 - (400 * level), true, false, false,
Factory.Projectile().AddThrow(item, player, this, System.currentTimeMillis() + 5000 - (400 * level), true, true, false, false,
Sound.FIZZ, 0.6f, 1.6f, ParticleType.FIREWORKS_SPARK, UpdateType.TICK, 0.4f);
//Inform

View File

@ -11,6 +11,6 @@
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/httpclient-4.2.jar"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/commons-codec-1.6.jar"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/gson-2.2.1.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre1.8.0_60"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.8.0_60"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -158,7 +158,7 @@ public class PerkBlockTossEVO extends Perk implements IThrown
//Action
UtilAction.velocity(block, cur.getLocation().getDirection(), mult, false, 0.2, 0, 1, true);
Manager.GetProjectile().AddThrow(block, cur, this, -1, true, true, true,
Manager.GetProjectile().AddThrow(block, cur, this, -1, true, true, true, true,
null, 0, 0, null, 0, UpdateType.FASTEST, 1f);
//Event

View File

@ -78,7 +78,7 @@ public class PerkSulphurBombEVO extends Perk implements IThrown
UtilAction.velocity(ent, player.getLocation().getDirection(), 1, false, 0, 0.2, 10, false);
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true,
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, true,
null, 1f, 1f,
Effect.SMOKE, 1, UpdateType.SLOW,
1f);

View File

@ -229,7 +229,7 @@ public class BombLobbers extends TeamGame implements IThrown
canHit.add(pos);
}
Manager.GetProjectile().AddThrow(tnt, player, this, -1L, true, false, true, .2F, canHit);
Manager.GetProjectile().AddThrow(tnt, player, this, -1L, true, true, false, true, .2F, canHit);
Manager.getPlugin().getServer().getPluginManager().callEvent(new TNTThrowEvent(player, tnt));
@ -343,7 +343,7 @@ public class BombLobbers extends TeamGame implements IThrown
newTNT.setVelocity(tnt.getKey().getVelocity());
newTNT.setFuseTicks(60);
Manager.GetProjectile().AddThrow(newTNT, thrower, this, -1L, true, false, true, .2F);
Manager.GetProjectile().AddThrow(newTNT, thrower, this, -1L, true, true, false, true, .2F);
tnt.getKey().remove();

View File

@ -68,7 +68,7 @@ public class PerkMortar extends Perk
tnt.setFuseTicks(40);
UtilAction.velocity(tnt, player.getLocation().getDirection(), 2.0D, false, 0.0D, 0.1D, 10.0D, false);
Manager.GetProjectile().AddThrow(tnt, player, l, -1L, true, false, false, .2F);
Manager.GetProjectile().AddThrow(tnt, player, l, -1L, true, true, false, false, .2F);
player.playSound(player.getLocation(), Sound.CREEPER_HISS, 3.0F, 1.0F);
@ -107,7 +107,7 @@ public class PerkMortar extends Perk
tnt.setFuseTicks(60);
UtilAction.velocity(tnt, event.getTNT().getVelocity().add(new Vector(i / 5, 0, i / 5)).normalize(), 2.0D, false, 0.0D, 0.1D, 10.0D, false);
Manager.GetProjectile().AddThrow(tnt, event.getPlayer(), l, -1L, true, false, false, .2F);
Manager.GetProjectile().AddThrow(tnt, event.getPlayer(), l, -1L, true, true, false, false, .2F);
// l.addThrower(event.getPlayer(), tnt);
_scatter.add(tnt);

View File

@ -26,6 +26,7 @@ import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.games.smash.kits.KitBlaze;
import nautilus.game.arcade.game.games.smash.kits.KitChicken;
import nautilus.game.arcade.game.games.smash.kits.KitCow;
import nautilus.game.arcade.game.games.smash.kits.KitCreeper;
import nautilus.game.arcade.game.games.smash.kits.KitEnderman;
import nautilus.game.arcade.game.games.smash.kits.KitGolem;
@ -109,6 +110,7 @@ public abstract class SuperSmash extends Game
new KitWitherSkeleton(manager),
new KitMagmaCube(manager),
new KitZombie(manager),
new KitCow(manager),
new KitSheep(manager)

View File

@ -11,6 +11,7 @@ import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseCow;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.smash.perks.PerkCowStampede;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
@ -20,7 +21,7 @@ public class KitCow extends SmashKit
{
public KitCow(ArcadeManager manager)
{
super(manager, "Mad Cow", KitAvailability.Gem, 5000,
super(manager, "Cow", KitAvailability.Gem, 6000,
new String[]
{
@ -28,14 +29,15 @@ public class KitCow extends SmashKit
new Perk[]
{
new PerkSmashStats(7, 1.0, 0.25, 8),
new PerkSmashStats(7, 1.0, 0.25, 7.5),
new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkCowStampede(),
},
EntityType.COW,
new ItemStack(Material.MILK_BUCKET),
"", 0, null);
"Cowpocalypse", 0, null);
}
@Override
@ -61,7 +63,7 @@ public class KitCow extends SmashKit
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_BOOTS));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS));
}
@Override

View File

@ -0,0 +1,36 @@
package nautilus.game.arcade.game.games.smash.perks;
import org.bukkit.Location;
import org.bukkit.entity.Cow;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
public class DataCowCharge
{
public long Time;
public Player Player;
public Vector Direction;
public Cow Cow;
public Location LastLoc;
public long LastMoveTime;
public DataCowCharge(Player player, Cow cow)
{
Time = System.currentTimeMillis();
Player = player;
Direction = player.getLocation().getDirection();
Direction.setY(0);
Direction.normalize();
Direction.multiply(0.75);
Direction.setY(-0.2);
Cow = cow;
LastLoc = Cow.getLocation();
LastMoveTime = System.currentTimeMillis();
}
}

View File

@ -0,0 +1,225 @@
package nautilus.game.arcade.game.games.smash.perks;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
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.Cow;
import org.bukkit.entity.Item;
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 org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
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.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
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.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.SmashPerk;
public class PerkCowStampede extends SmashPerk implements IThrown
{
private ArrayList<DataCowCharge> _active = new ArrayList<DataCowCharge>();
public PerkCowStampede()
{
super("Fish Flurry", new String[]
{
C.cYellow + "Right-Click" + C.cGray + " with Spade to use " + C.cGreen + "Fish Flurry"
});
}
@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("_AXE"))
return;
Player player = event.getPlayer();
if (isSuperActive(player))
return;
if (!Kit.HasKit(player))
return;
if (!Recharge.Instance.use(player, GetName(), 8000, true, true))
return;
event.setCancelled(true);
for (double i=-3 ; i<4 ; i++)
{
Vector dir = player.getLocation().getDirection();
dir.setY(0);
dir.normalize();
Location loc = player.getLocation();
loc.add(dir);
loc.add(UtilAlg.getLeft(dir).multiply(i*1.5));
Manager.GetGame().CreatureAllowOverride = true;
Cow cow = player.getWorld().spawn(loc, Cow.class);
Manager.GetGame().CreatureAllowOverride = false;
Manager.GetProjectile().AddThrow(cow, player, this,
-1, true, false, false, false,
null, 1f, 1f,
null, UpdateType.TICK, 2.5f);
_active.add(new DataCowCharge(player, cow));
}
//Sound
player.getWorld().playSound(player.getLocation(), Sound.COW_IDLE, 2f, 0.6f);
//Inform
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
}
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
Iterator<DataCowCharge> activeIter = _active.iterator();
while (activeIter.hasNext())
{
DataCowCharge data = activeIter.next();
//Expire
if (UtilTime.elapsed(data.Time, 3000))
{
if (data.Cow.isValid())
{
data.Cow.remove();
UtilParticle.PlayParticle(ParticleType.EXPLODE, data.Cow.getLocation().add(0, 1, 0), 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers());
}
activeIter.remove();
continue;
}
//Set Moved
if (UtilMath.offset(data.Cow.getLocation(), data.LastLoc) > 1)
{
data.LastLoc = data.Cow.getLocation();
data.LastMoveTime = System.currentTimeMillis();
}
//Stuck Remove
if (UtilTime.elapsed(data.LastMoveTime, 2000))
{
if (data.Cow.isValid())
{
data.Cow.remove();
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, data.Cow.getLocation().add(0, 1, 0), 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers());
}
activeIter.remove();
continue;
}
//Gravity
if (UtilEnt.isGrounded(data.Cow))
{
data.Direction.setY(-0.1);
}
else
{
data.Direction.setY(Math.max(-1, data.Direction.getY() - 0.03));
}
//Move
data.Cow.setVelocity(data.Direction);
if (Math.random() > 0.99)
data.Cow.getWorld().playSound(data.Cow.getLocation(), Sound.COW_IDLE, 1f, 1f);
if (Math.random() > 0.97)
data.Cow.getWorld().playSound(data.Cow.getLocation(), Sound.COW_WALK, 1f, 1.2f);
}
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
if (target != null && target instanceof Player)
{
//Damage Event
Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null,
DamageCause.PROJECTILE, 6, true, true, false,
UtilEnt.getName(data.GetThrower()), GetName());
UtilParticle.PlayParticle(ParticleType.EXPLODE, target.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 12, ViewDist.LONG, UtilServer.getPlayers());
}
Manager.GetProjectile().AddThrow(data.GetThrown(), data.GetThrower(), this,
-1, true, false, false, false,
null, 1f, 1f,
null, UpdateType.TICK, 2.5f);
}
@Override
public void Idle(ProjectileUser data)
{
}
@Override
public void Expire(ProjectileUser data)
{
}
@EventHandler
public void Knockback(CustomDamageEvent event)
{
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
return;
event.AddKnockback(GetName(), 2);
}
}

View File

@ -152,7 +152,7 @@ public class PerkFishFlurry extends SmashPerk implements IThrown
UtilAction.velocity(fish, random, 0.25 + 0.4 * Math.random(), false, 0, 0.2, 10, false);
Manager.GetProjectile().AddThrow(fish, data.Player, this,
-1, true, true, true,
-1, true, false, true, true,
null, 1f, 1f,
null, UpdateType.TICK, 1f);
}

View File

@ -69,7 +69,7 @@ public class PerkBaconBlast extends Perk implements IThrown
UtilAction.velocity(ent, player.getLocation().getDirection(), 1, false, 0, 0.2, 10, false);
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true,
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, true,
null, 1f, 1f,
null, 1, UpdateType.SLOW,
0.5f);

View File

@ -150,7 +150,7 @@ public class PerkBlockToss extends SmashPerk implements IThrown
//Action
UtilAction.velocity(block, cur.getLocation().getDirection(), mult, false, 0.2, 0, 1, true);
Manager.GetProjectile().AddThrow(block, cur, this, -1, true, true, true,
Manager.GetProjectile().AddThrow(block, cur, this, -1, true, true, true, true,
null, 0, 0, null, 0, UpdateType.FASTEST, 1f);
//Event

View File

@ -75,7 +75,7 @@ public class PerkCowBomb extends Perk implements IThrown
UtilAction.velocity(ent, player.getLocation().getDirection(), 1.4, false, 0, 0.3, 10, false);
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true,
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, true,
null, 1f, 1f,
null, 1, UpdateType.SLOW,
0.5f);

View File

@ -78,7 +78,7 @@ public class PerkCreeperSulphurBomb extends SmashPerk implements IThrown
UtilAction.velocity(ent, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, false);
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true,
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, true,
null, 1f, 1f,
null, 1, UpdateType.SLOW,
0.65f);

View File

@ -89,7 +89,7 @@ public class PerkInkBlast extends SmashPerk implements IThrown
UtilAction.velocity(ent, player.getLocation().getDirection().add(random), 1 + 0.4 * Math.random(), false, 0, 0.2, 10, false);
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true,
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, true,
null, 1f, 1f,
ParticleType.EXPLODE, UpdateType.TICK,
0.5f);

View File

@ -63,7 +63,7 @@ public class PerkIronHook extends Perk implements IThrown
UtilAction.velocity(item, player.getLocation().getDirection(),
1.8, false, 0, 0.2, 10, false);
Manager.GetProjectile().AddThrow(item, player, this, -1, true, true, true,
Manager.GetProjectile().AddThrow(item, player, this, -1, true, true, true, true,
Sound.FIRE_IGNITE, 1.4f, 0.8f, ParticleType.CRIT, null, 0, UpdateType.TICK, 0.6f);
//Inform

View File

@ -195,7 +195,7 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown
UtilAction.velocity(slime, player.getLocation().getDirection(), 1 + charge/2d, false, 0, 0.2, 10, true);
Manager.GetProjectile().AddThrow(slime, player, this, -1, true, true, true,
Manager.GetProjectile().AddThrow(slime, player, this, -1, true, true, true, true,
null, 0, 0, null, 0, UpdateType.FASTEST, 1f);
}

View File

@ -107,7 +107,7 @@ public class PerkWoolBomb extends Perk implements IThrown
UtilAction.velocity(ent, player.getLocation().getDirection(), 1, false, 0, 0.2, 10, false);
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true,
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, true,
null, 1f, 1f,
null, 1, UpdateType.SLOW,
0.5f);

View File

@ -518,24 +518,17 @@ public class GameLobbyManager implements Listener, IPacketHandler
{
// WriteKitLine("Free", 0, 159, (byte)15);
// WriteKitLine("Kits", 1, 159, (byte)4);
ArrayList<Kit> kitsA = new ArrayList<Kit>();
ArrayList<Kit> kitsB = new ArrayList<Kit>();
for (int i=0 ; i<kits.size() ; i++)
{
if (kits.get(i).GetCost() < 5000) kitsA.add(kits.get(i));
else kitsB.add(kits.get(i));
}
int divide = kits.size()/2;
{
//Positions
double space = 4;
double offset = (kitsA.size()-1)*space/2d;
double offset = (divide-1)*space/2d;
for (int i=0 ; i<kitsA.size() ; i++)
for (int i=0 ; i<divide ; i++)
{
Kit kit = kitsA.get(i);
Kit kit = kits.get(i);
if (kit.GetAvailability() == KitAvailability.Null)
continue;
@ -562,11 +555,11 @@ public class GameLobbyManager implements Listener, IPacketHandler
{
//Positions
double space = 4;
double offset = (kitsB.size()-1)*space/2d;
double offset = (divide-1)*space/2d;
for (int i=0 ; i<kitsB.size() ; i++)
for (int i=divide ; i<kits.size() ; i++)
{
Kit kit = kitsB.get(i);
Kit kit = kits.get(i);
if (kit.GetAvailability() == KitAvailability.Null)
continue;