fixed no damage on weapons

items not usable until game is live
fixed proxies not triggering
some skill balance/fixes
players with null kit are now given default knight
This commit is contained in:
Chiss 2014-04-21 10:48:04 +10:00
parent ddc8e435e8
commit 07098b0b82
26 changed files with 198 additions and 75 deletions

View File

@ -115,6 +115,7 @@ public class ShopItem implements IShopItem, Listener
return _deliveryName;
}
/*
@EventHandler
public void Damage(CustomDamageEvent event)
{
@ -127,6 +128,7 @@ public class ShopItem implements IShopItem, Listener
if (!_canDamage)
event.SetCancelled("Item Damage Cancel");
}
*/
@Override
public boolean IsFree()

View File

@ -46,7 +46,7 @@ public class Blink extends SkillActive
SetDesc(new String[]
{
"Instantly teleport forwards #5#3 Blocks.",
"Instantly teleport forwards #9#3 Blocks.",
"Cannot be used while Slowed.",
"",
"Using again within 5 seconds De-Blinks,",
@ -87,7 +87,7 @@ public class Blink extends SkillActive
//Smoke Trail
Block lastSmoke = player.getLocation().getBlock();
double maxRange = 5 + (level*3);
double maxRange = 9 + (level*3);
double curRange = 0;
while (curRange <= maxRange)
{

View File

@ -93,7 +93,7 @@ public class Recall extends Skill
while (UtilMath.offset(current, target) > 0.5)
{
UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, current, 0, 1f, 0, 0, 1);
UtilParticle.PlayParticle(ParticleType.WITCH_MAGIC, current, 0, 1f, 0, 0, 1);
current = current.add(UtilAlg.getTrajectory(current, target).multiply(0.1));
}
}

View File

@ -21,7 +21,7 @@ public class ShockingStrikes extends Skill
SetDesc(new String[]
{
"Your attacks shock targets for",
"#0#1 seconds, giving them Slow #0#1 and",
"#0#1 seconds, giving them Slow 1 and",
"Screen-Shake."
});
}
@ -49,7 +49,7 @@ public class ShockingStrikes extends Skill
//Confuse
Factory.Condition().Factory().Shock(GetName(), damagee, damager, level, false, false);
Factory.Condition().Factory().Slow(GetName(), damagee, damager, level, level-1, false, false, true, false);
Factory.Condition().Factory().Slow(GetName(), damagee, damager, level, 0, false, false, true, false);
//Damage
event.AddMod(damager.getName(), GetName(), 0, true);

View File

@ -14,7 +14,9 @@ import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.classcombat.Skill.Skill;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
@ -46,7 +48,7 @@ public class SmokeBomb extends Skill
{
return "Recharge: #90#-15 Seconds";
}
@EventHandler
public void Use(PlayerDropItemEvent event)
{
@ -54,12 +56,19 @@ public class SmokeBomb extends Skill
int level = getLevel(player);
if (level == 0) return;
if (!UtilGear.isWeapon(event.getItemDrop().getItemStack()))
return;
event.setCancelled(true);
//Check Allowed
SkillTriggerEvent trigger = new SkillTriggerEvent(player, GetName(), GetClassType());
Bukkit.getServer().getPluginManager().callEvent(trigger);
if (trigger.IsCancelled())
return;
if (!Recharge.Instance.use(player, GetName(), GetName(level), 90000 - (level * 15000), true, false))
return;
@ -73,10 +82,10 @@ public class SmokeBomb extends Skill
{
Factory.Condition().Factory().Blind(GetName(), other, player, 2 * level, 0, false, false, false);
}
for (int i=0 ; i<3 ; i++)
player.getWorld().playSound(player.getLocation(), Sound.FIZZ, 2f, 0.5f);
//Inform
UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + "."));
}
@ -96,7 +105,7 @@ public class SmokeBomb extends Skill
//End
Factory.Condition().EndCondition(damagee, null, GetName());
}
@EventHandler(priority = EventPriority.HIGH)
public void EndDamager(CustomDamageEvent event)
{
@ -112,7 +121,7 @@ public class SmokeBomb extends Skill
//End
Factory.Condition().EndCondition(damager, null, GetName());
}
@EventHandler
public void EndInteract(PlayerInteractEvent event)
{

View File

@ -102,6 +102,9 @@ public class SeismicSlam extends SkillActive
if (!UtilTime.elapsed(_live.get(player), 1000))
continue;
if (!UtilTime.elapsed(_live.get(player), 4000) && !UtilEnt.isGrounded(player))
continue;
_live.remove(player);

View File

@ -1,5 +1,6 @@
package mineplex.minecraft.game.classcombat.item;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_7_R2.entity.CraftPlayer;
@ -18,8 +19,10 @@ import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.recharge.Recharge;
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
import mineplex.minecraft.game.classcombat.item.Item;
import mineplex.minecraft.game.classcombat.item.ItemFactory;
import mineplex.minecraft.game.classcombat.item.event.ItemTriggerEvent;
public abstract class ItemUsable extends Item implements IThrown
{
@ -27,19 +30,19 @@ public abstract class ItemUsable extends Item implements IThrown
private boolean _useStock;
private long _useDelay;
private int _useEnergy;
private ActionType _throwAction;
private boolean _throwStock;
private long _throwDelay;
private int _throwEnergy;
private float _throwPower;
private long _throwExpire;
private boolean _throwPlayer;
private boolean _throwBlock;
private boolean _throwIdle;
private boolean _throwPickup;
public ItemUsable(ItemFactory factory, String name, String[] desc,
Material type, int amount, boolean canDamage, int gemCost, int tokenCost,
ActionType useAction, boolean useStock, long useDelay, int useEnergy,
@ -52,7 +55,7 @@ public abstract class ItemUsable extends Item implements IThrown
_useStock = useStock;
_useDelay = useDelay;
_useEnergy = useEnergy;
_throwStock = throwStock;
_throwDelay = throwDelay;
_throwPower = throwPower;
@ -69,20 +72,27 @@ public abstract class ItemUsable extends Item implements IThrown
{
if (_useAction == null)
return;
Player player = event.getPlayer();
if (!UtilGear.isMat(player.getItemInHand(), GetType()))
return;
if (!UtilEvent.isAction(event, _useAction))
return;
if (UtilBlock.usable(event.getClickedBlock()))
return;
event.setCancelled(true);
//Check Allowed
ItemTriggerEvent trigger = new ItemTriggerEvent(player, this);
Bukkit.getServer().getPluginManager().callEvent(trigger);
if (trigger.IsCancelled())
return;
if (!EnergyRecharge(player, GetName(), _useEnergy, _useDelay))
return;
@ -95,34 +105,41 @@ public abstract class ItemUsable extends Item implements IThrown
UtilInv.Update(player);
}
UseAction(event);
}
public abstract void UseAction(PlayerInteractEvent event);
@EventHandler
public void Throw(PlayerInteractEvent event)
{
if (_throwAction == null)
return;
Player player = event.getPlayer();
if (((CraftPlayer)player).getHandle().spectating)
return;
if (!UtilGear.isMat(player.getItemInHand(), GetType()))
return;
if (!UtilEvent.isAction(event, _throwAction))
return;
if (UtilBlock.usable(event.getClickedBlock()))
return;
event.setCancelled(true);
//Check Allowed
ItemTriggerEvent trigger = new ItemTriggerEvent(player, this);
Bukkit.getServer().getPluginManager().callEvent(trigger);
if (trigger.IsCancelled())
return;
if (!EnergyRecharge(player, GetName(), _throwEnergy, _throwDelay))
return;
@ -132,19 +149,19 @@ public abstract class ItemUsable extends Item implements IThrown
player.getItemInHand().setAmount(player.getItemInHand().getAmount() - 1);
else
player.setItemInHand(null);
UtilInv.Update(player);
}
//Throw
long expire = -1;
if (_throwExpire >= 0)
expire = System.currentTimeMillis() + _throwExpire;
org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(GetType()));
UtilAction.velocity(ent, player.getLocation().getDirection(), _throwPower, false, 0, 0.2, 10, false);
Factory.Throw().AddThrow(ent, player, this, expire, _throwPlayer, _throwBlock, _throwIdle, _throwPickup, 1d);
ThrowCustom(event, ent);
}
@ -158,21 +175,21 @@ public abstract class ItemUsable extends Item implements IThrown
@Override
public abstract void Idle(ProjectileUser data);
@Override
public abstract void Expire(ProjectileUser data);
private boolean EnergyRecharge(Player player, String ability, int energy, long recharge)
{
if (!Factory.Energy().Use(player, ability, energy, false, true))
return false;
if (!Recharge.Instance.use(player, ability, recharge, (recharge > 2000), false))
return false;
if (!Factory.Energy().Use(player, ability, energy, true, true))
return false;
return true;
}
}

View File

@ -25,8 +25,10 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.minecraft.game.classcombat.item.ItemFactory;
import mineplex.minecraft.game.classcombat.item.ItemUsable;
@ -87,9 +89,6 @@ public class ProximityExplosive extends ItemUsable
@EventHandler(priority = EventPriority.LOW)
public void Pickup(PlayerPickupItemEvent event)
{
if (event.isCancelled())
return;
if (((CraftPlayer)event.getPlayer()).getHandle().spectating)
return;
@ -135,7 +134,8 @@ public class ProximityExplosive extends ItemUsable
//Effect
ent.getWorld().playSound(ent.getLocation(), Sound.NOTE_PLING, 0.5f, 0.5f);
ent.getWorld().createExplosion(ent.getLocation(), 0f);
ent.getWorld().playSound(ent.getLocation(), Sound.EXPLODE, 4f, 0.8f);
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, ent.getLocation(), 0, 0.5f, 0, 0, 1);
}
@EventHandler
@ -148,7 +148,7 @@ public class ProximityExplosive extends ItemUsable
for (Entity ent : _armed.keySet())
{
if (ent.isDead() || !ent.isValid() || ent.getTicksLived() >= 6000)
if (ent.isDead() || !ent.isValid() || ent.getTicksLived() >= 3600)
expired.add(ent);
}

View File

@ -22,6 +22,8 @@ import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.minecraft.game.classcombat.item.ItemFactory;
@ -84,9 +86,6 @@ public class ProximityZapper extends ItemUsable
@EventHandler(priority = EventPriority.LOW)
public void Pickup(PlayerPickupItemEvent event)
{
if (event.isCancelled())
return;
if (((CraftPlayer)event.getPlayer()).getHandle().spectating)
return;
@ -129,7 +128,7 @@ public class ProximityZapper extends ItemUsable
//Effect
ent.getWorld().playSound(ent.getLocation(), Sound.NOTE_PLING, 0.5f, 0.5f);
ent.getWorld().createExplosion(ent.getLocation(), 0f);
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, ent.getLocation(), 0, 0.5f, 0, 0, 1);
}
@EventHandler
@ -142,7 +141,7 @@ public class ProximityZapper extends ItemUsable
for (Entity ent : _armed.keySet())
{
if (ent.isDead() || !ent.isValid() || ent.getTicksLived() >= 6000)
if (ent.isDead() || !ent.isValid() || ent.getTicksLived() >= 3600)
expired.add(ent);
}

View File

@ -0,0 +1,51 @@
package mineplex.minecraft.game.classcombat.item.event;
import mineplex.minecraft.game.classcombat.item.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class ItemTriggerEvent extends Event
{
private static final HandlerList handlers = new HandlerList();
private Player _player;
private Item _item;
private boolean _cancelled = false;
public ItemTriggerEvent(Player player, Item item)
{
_player = player;
_item = item;
}
public HandlerList getHandlers()
{
return handlers;
}
public static HandlerList getHandlerList()
{
return handlers;
}
public Player GetPlayer()
{
return _player;
}
public Item GetItemType()
{
return _item;
}
public boolean IsCancelled() {
return _cancelled;
}
public void SetCancelled(boolean cancelled)
{
this._cancelled = cancelled;
}
}

View File

@ -9,6 +9,6 @@ public class BoosterAxe extends Item
{
public BoosterAxe(ItemFactory factory, int gemCost, int tokenCost)
{
super(factory, "Booster Axe", new String [] { "Increases Axe Skill level by 1." }, Material.GOLD_AXE, 1, false, gemCost, tokenCost);
super(factory, "Booster Axe", new String [] { "Increases Axe Skill level by 1." }, Material.GOLD_AXE, 1, true, gemCost, tokenCost);
}
}

View File

@ -9,6 +9,6 @@ public class BoosterBow extends Item
{
public BoosterBow(ItemFactory factory, int gemCost, int tokenCost)
{
super(factory, "Booster Bow", new String [] { "Increases Bow Skill level by 1." }, Material.BOW, 1, false, gemCost, tokenCost);
super(factory, "Booster Bow", new String [] { "Increases Bow Skill level by 1." }, Material.BOW, 1, true, gemCost, tokenCost);
}
}

View File

@ -9,6 +9,6 @@ public class BoosterSword extends Item
{
public BoosterSword(ItemFactory factory, int gemCost, int tokenCost)
{
super(factory, "Booster Sword", new String[] { "Increases Sword Skill level by 1" }, Material.GOLD_SWORD, 1, false, gemCost, tokenCost);
super(factory, "Booster Sword", new String[] { "Increases Sword Skill level by 1" }, Material.GOLD_SWORD, 1, true, gemCost, tokenCost);
}
}

View File

@ -9,6 +9,6 @@ public class PowerAxe extends Item
{
public PowerAxe(ItemFactory factory, int gemCost, int tokenCost)
{
super(factory, "Power Axe", new String [] { "Increases Axe damage by 1." }, Material.DIAMOND_AXE, 1, false, gemCost, tokenCost);
super(factory, "Power Axe", new String [] { "Increases Axe damage by 1." }, Material.DIAMOND_AXE, 1, true, gemCost, tokenCost);
}
}

View File

@ -9,6 +9,6 @@ public class PowerBow extends Item
{
public PowerBow(ItemFactory factory, int gemCost, int tokenCost)
{
super(factory, "Power Bow", new String [] { "Increases Bow damage by 1." }, Material.BOW, 1, false, gemCost, tokenCost);
super(factory, "Power Bow", new String [] { "Increases Bow damage by 1." }, Material.BOW, 1, true, gemCost, tokenCost);
}
}

View File

@ -9,6 +9,6 @@ public class PowerSword extends Item
{
public PowerSword(ItemFactory factory, int gemCost, int tokenCost)
{
super(factory, "Power Sword", new String[] { "Increases sword damage by 1." }, Material.DIAMOND_SWORD, 1, false, gemCost, tokenCost);
super(factory, "Power Sword", new String[] { "Increases sword damage by 1." }, Material.DIAMOND_SWORD, 1, true, gemCost, tokenCost);
}
}

View File

@ -9,6 +9,6 @@ public class StandardAxe extends Item
{
public StandardAxe(ItemFactory factory, int gemCost, int tokenCost)
{
super(factory, "Standard Axe", new String[] { "Pretty standard." }, Material.IRON_AXE, 1, false, gemCost, tokenCost);
super(factory, "Standard Axe", new String[] { "Pretty standard." }, Material.IRON_AXE, 1, true, gemCost, tokenCost);
}
}

View File

@ -9,6 +9,6 @@ public class StandardBow extends Item
{
public StandardBow(ItemFactory factory, int gemCost, int tokenCost)
{
super(factory, "Standard Bow", new String[] { "Pretty standard." }, Material.BOW, 1, false, gemCost, tokenCost);
super(factory, "Standard Bow", new String[] { "Pretty standard." }, Material.BOW, 1, true, gemCost, tokenCost);
}
}

View File

@ -9,6 +9,6 @@ public class StandardSword extends Item
{
public StandardSword(ItemFactory factory, int gemCost, int tokenCost)
{
super(factory, "Standard Sword", new String[] { "Pretty standard." }, Material.IRON_SWORD, 1, false, gemCost, tokenCost);
super(factory, "Standard Sword", new String[] { "Pretty standard." }, Material.IRON_SWORD, 1, true, gemCost, tokenCost);
}
}

View File

@ -80,7 +80,7 @@ public class DamageManager extends MiniPlugin
{
if (!_enabled)
return;
boolean preCancel = false;
if (event.isCancelled())
preCancel = true;

View File

@ -36,6 +36,7 @@ import mineplex.minecraft.game.classcombat.Condition.SkillConditionManager;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
import mineplex.minecraft.game.classcombat.item.ItemFactory;
import mineplex.minecraft.game.classcombat.item.event.ItemTriggerEvent;
import mineplex.minecraft.game.classcombat.shop.ClassCombatShop;
import mineplex.minecraft.game.classcombat.shop.ClassShopManager;
import mineplex.minecraft.game.core.IRelation;
@ -618,4 +619,13 @@ public class ArcadeManager extends MiniPlugin implements IRelation
event.SetCancelled(true);
}
}
@EventHandler
public void ItemTrigger(ItemTriggerEvent event)
{
if (_game == null || !_game.IsLive())
{
event.SetCancelled(true);
}
}
}

View File

@ -28,9 +28,9 @@ public class ChampionsDominate extends Domination
new KitMage(manager),
new KitAssassin(manager),
});
_help = new String[]
{
{
"Capture Beacons faster with more people!",
"Make sure you use all of your Skill/Item Tokens",
"Collect Emeralds to get 300 Points",
@ -41,17 +41,22 @@ public class ChampionsDominate extends Domination
"Gold Weapons deal 5 damage",
"Iron Weapons deal 6 damage",
"Diamond Weapons deal 7 damage",
};
};
this.Manager.GetDamage().UseSimpleWeaponDamage = false;
}
@Override
@Override
public void ValidateKit(Player player, GameTeam team)
{
// NOTHING
{
//Set to Default Knight
if (GetKit(player) == null)
{
SetKit(player, GetKits()[2], true);
player.closeInventory();
}
}
@Override

View File

@ -180,10 +180,15 @@ public class ChampionsTDM extends TeamGame
return "Team Deathmatch";
}
@Override
@Override
public void ValidateKit(Player player, GameTeam team)
{
// NOTHING
{
//Set to Default Knight
if (GetKit(player) == null)
{
SetKit(player, GetKits()[2], true);
player.closeInventory();
}
}
@Override

View File

@ -44,6 +44,13 @@ public class KitKnight extends Kit
@Override
public void Selected(Player player)
{
AddPlayer(player);
Manager.openClassShop(player);
}
public void AddPlayer(Player player)
{
_class.put(player, Manager.getClassManager().Get(player));
ClientClass clientClass = _class.get(player);
@ -56,8 +63,6 @@ public class KitKnight extends Kit
if (!Manager.GetGame().InProgress())
clientClass.SetActiveCustomBuild(pvpClass, pvpClass.getDefaultBuild());
Manager.openClassShop(player);
}
@Override

View File

@ -27,6 +27,7 @@ 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.events.PlayerGameRespawnEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame;
@ -306,6 +307,13 @@ public class Domination extends TeamGame
return "Domination";
}
@EventHandler
public void RespawnRegen(PlayerGameRespawnEvent event)
{
Manager.GetCondition().Factory().Regen("Respawn", event.GetPlayer(), event.GetPlayer(), 8, 3, false, false, false);
Manager.GetCondition().Factory().Protection("Respawn", event.GetPlayer(), event.GetPlayer(), 8, 3, false, false, false);
}
public PlayerData GetStats(Player player)
{
if (!_stats.containsKey(player.getName()))

View File

@ -24,6 +24,7 @@ import nautilus.game.arcade.shop.KitPackage;
import net.minecraft.server.v1_7_R2.PacketPlayOutEntityMetadata;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_7_R2.entity.CraftEntity;
@ -242,13 +243,16 @@ public class GamePlayerManager implements Listener
}
}
@EventHandler(priority = EventPriority.HIGH)
@EventHandler(priority = EventPriority.LOWEST)
public void KitInteract(PlayerInteractEntityEvent event)
{
if (event.getRightClicked() == null)
return;
Player player = event.getPlayer();
if (player.getGameMode() != GameMode.SURVIVAL)
return;
Kit kit = Manager.GetLobby().GetClickedKit(event.getRightClicked());
@ -256,6 +260,8 @@ public class GamePlayerManager implements Listener
return;
KitClick(player, kit, event.getRightClicked());
event.setCancelled(true);
}
@EventHandler
@ -266,9 +272,12 @@ public class GamePlayerManager implements Listener
if (event.GetCause() != DamageCause.ENTITY_ATTACK)
return;
Player player = event.GetDamagerPlayer(false);
if (player == null) return;
if (player.getGameMode() != GameMode.SURVIVAL)
return;
LivingEntity target = event.GetDamageeEntity();