Champs Update
This commit is contained in:
parent
2aaf749414
commit
2f0167ea09
@ -24,7 +24,7 @@ public class Recharge extends MiniPlugin
|
||||
public static Recharge Instance;
|
||||
|
||||
public HashSet<String> informSet = new HashSet<String>();
|
||||
public NautHashMap<String, NautHashMap<String, Long>> _recharge = new NautHashMap<String, NautHashMap<String, Long>>();
|
||||
public NautHashMap<String, NautHashMap<String, RechargeData>> _recharge = new NautHashMap<String, NautHashMap<String, RechargeData>>();
|
||||
|
||||
protected Recharge(JavaPlugin plugin)
|
||||
{
|
||||
@ -42,15 +42,15 @@ public class Recharge extends MiniPlugin
|
||||
Get(event.getEntity().getName()).clear();
|
||||
}
|
||||
|
||||
public NautHashMap<String, Long> Get(String name)
|
||||
public NautHashMap<String, RechargeData> Get(String name)
|
||||
{
|
||||
if (!_recharge.containsKey(name))
|
||||
_recharge.put(name, new NautHashMap<String, Long>());
|
||||
_recharge.put(name, new NautHashMap<String, RechargeData>());
|
||||
|
||||
return _recharge.get(name);
|
||||
}
|
||||
|
||||
public NautHashMap<String, Long> Get(Player player)
|
||||
public NautHashMap<String, RechargeData> Get(Player player)
|
||||
{
|
||||
return Get(player.getName());
|
||||
}
|
||||
@ -58,7 +58,7 @@ public class Recharge extends MiniPlugin
|
||||
@EventHandler
|
||||
public void update(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FASTER)
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
recharge();
|
||||
@ -73,7 +73,7 @@ public class Recharge extends MiniPlugin
|
||||
//Check Recharged
|
||||
for (String ability : Get(cur).keySet())
|
||||
{
|
||||
if (System.currentTimeMillis() > Get(cur).get(ability))
|
||||
if (Get(cur).get(ability).Update())
|
||||
rechargeList.add(ability);
|
||||
}
|
||||
|
||||
@ -91,12 +91,23 @@ public class Recharge extends MiniPlugin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean use(Player player, String ability, long recharge, boolean inform)
|
||||
{
|
||||
return use(player, ability, ability, recharge, inform);
|
||||
return use(player, ability, ability, recharge, inform, false);
|
||||
}
|
||||
|
||||
public boolean use(Player player, String ability, long recharge, boolean inform, boolean attachItem)
|
||||
{
|
||||
return use(player, ability, ability, recharge, inform, attachItem);
|
||||
}
|
||||
|
||||
public boolean use(Player player, String ability, String abilityFull, long recharge, boolean inform)
|
||||
{
|
||||
return use(player, ability, ability, recharge, inform, false);
|
||||
}
|
||||
|
||||
public boolean use(Player player, String ability, String abilityFull, long recharge, boolean inform)
|
||||
public boolean use(Player player, String ability, String abilityFull, long recharge, boolean inform, boolean attachItem)
|
||||
{
|
||||
if (recharge == 0)
|
||||
return true;
|
||||
@ -114,21 +125,21 @@ public class Recharge extends MiniPlugin
|
||||
if (inform)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Recharge", "You cannot use " + F.skill(abilityFull) + " for " +
|
||||
F.time(UtilTime.convertString((Get(player).get(ability)-System.currentTimeMillis()), 1, TimeUnit.FIT)) + "."));
|
||||
F.time(UtilTime.convertString((Get(player).get(ability).Time-System.currentTimeMillis()), 1, TimeUnit.FIT)) + "."));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//Insert
|
||||
UseRecharge(player, ability, recharge);
|
||||
UseRecharge(player, ability, recharge, attachItem);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void useForce(Player player, String ability, long recharge)
|
||||
{
|
||||
UseRecharge(player, ability, recharge);
|
||||
UseRecharge(player, ability, recharge, false);
|
||||
}
|
||||
|
||||
public boolean usable(Player player, String ability)
|
||||
@ -136,16 +147,19 @@ public class Recharge extends MiniPlugin
|
||||
if (!Get(player).containsKey(ability))
|
||||
return true;
|
||||
|
||||
return (System.currentTimeMillis() > Get(player).get(ability));
|
||||
return (System.currentTimeMillis() > Get(player).get(ability).Time);
|
||||
}
|
||||
|
||||
public void UseRecharge(Player player, String ability, long recharge)
|
||||
public void UseRecharge(Player player, String ability, long recharge, boolean attachItem)
|
||||
{
|
||||
//Event
|
||||
RechargeEvent rechargeEvent = new RechargeEvent(player, ability, recharge);
|
||||
UtilServer.getServer().getPluginManager().callEvent(rechargeEvent);
|
||||
|
||||
Get(player).put(ability, System.currentTimeMillis()+rechargeEvent.GetRecharge());
|
||||
if (attachItem)
|
||||
Get(player).put(ability, new RechargeData(player, ability, player.getItemInHand(), System.currentTimeMillis()+rechargeEvent.GetRecharge()));
|
||||
else
|
||||
Get(player).put(ability, new RechargeData(System.currentTimeMillis()+rechargeEvent.GetRecharge()));
|
||||
}
|
||||
|
||||
public void recharge(Player player, String ability)
|
||||
@ -161,6 +175,6 @@ public class Recharge extends MiniPlugin
|
||||
|
||||
public void Reset(Player player)
|
||||
{
|
||||
_recharge.put(player.getName(), new NautHashMap<String, Long>());
|
||||
_recharge.put(player.getName(), new NautHashMap<String, RechargeData>());
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,57 @@
|
||||
package mineplex.core.recharge;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
public class RechargeData
|
||||
{
|
||||
public long Time;
|
||||
|
||||
public org.bukkit.entity.Player Player;
|
||||
public String Name;
|
||||
public ItemStack Item;
|
||||
|
||||
public RechargeData(long time)
|
||||
{
|
||||
Time = time;
|
||||
}
|
||||
|
||||
public RechargeData(org.bukkit.entity.Player player, String name, ItemStack stack, long time)
|
||||
{
|
||||
Player = player;
|
||||
Name = name;
|
||||
Item = stack;
|
||||
Time = time;
|
||||
}
|
||||
|
||||
public boolean Update()
|
||||
{
|
||||
/*
|
||||
if (Item != null && Name != null && Player != null)
|
||||
{
|
||||
ItemMeta itemMeta = Item.getItemMeta();
|
||||
|
||||
if (System.currentTimeMillis() < Time)
|
||||
itemMeta.setDisplayName(C.cRed + C.Bold + Name + ChatColor.RESET + " - " + C.cYellow + C.Bold + UtilTime.MakeStr(Time - System.currentTimeMillis()));
|
||||
else
|
||||
itemMeta.setDisplayName(C.cGreen + C.Bold + Name);
|
||||
|
||||
Item.setItemMeta(itemMeta);
|
||||
|
||||
|
||||
if (System.currentTimeMillis() < Time)
|
||||
Item.removeEnchantment(Enchantment.DURABILITY);
|
||||
else
|
||||
Item.addEnchantment(Enchantment.DURABILITY, 1);
|
||||
}
|
||||
*/
|
||||
|
||||
return System.currentTimeMillis() > Time;
|
||||
}
|
||||
}
|
@ -4,7 +4,6 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.EntityEffect;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
@ -25,7 +24,6 @@ import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
@ -33,29 +31,28 @@ import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillCharge;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||
import mineplex.minecraft.game.classcombat.Skill.event.SkillEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
|
||||
public class BlockToss extends mineplex.minecraft.game.classcombat.Skill.Skill implements IThrown
|
||||
public class BlockToss extends SkillCharge implements IThrown
|
||||
{
|
||||
private HashMap<Player, FallingBlock> _holding = new HashMap<Player, FallingBlock>();
|
||||
private HashMap<Player, Long> _charge = new HashMap<Player, Long>();
|
||||
private HashSet<Player> _charged = new HashSet<Player>();
|
||||
private HashMap<FallingBlock, Player> _falling = new HashMap<FallingBlock, Player>();
|
||||
|
||||
public BlockToss(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels)
|
||||
{
|
||||
super(skills, name, classType, skillType, cost, levels);
|
||||
super(skills, name, classType, skillType, cost, levels,
|
||||
0.01f, 0.005f);
|
||||
|
||||
SetDesc(new String[]
|
||||
{
|
||||
"Hold Block to pick up a block,",
|
||||
"Release Block to throw it, dealing",
|
||||
"up to #7#1 damage.",
|
||||
"up to #3.5#1.5 damage.",
|
||||
"",
|
||||
"Block is thrown at #1#0.2 velocity.",
|
||||
"Charge for 1 second for maximum power.",
|
||||
GetChargeString(),
|
||||
"",
|
||||
"You can only pick up Stone, Dirt,",
|
||||
"Cobblestone, Sand, Gravel or Snow."
|
||||
@ -132,7 +129,6 @@ public class BlockToss extends mineplex.minecraft.game.classcombat.Skill.Skill i
|
||||
player.setPassenger(block);
|
||||
_holding.put(player, block);
|
||||
_falling.put(block, player);
|
||||
_charge.put(player, System.currentTimeMillis());
|
||||
|
||||
//Effect
|
||||
player.getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, block.getMaterial().getId());
|
||||
@ -172,34 +168,25 @@ public class BlockToss extends mineplex.minecraft.game.classcombat.Skill.Skill i
|
||||
throwSet.add(cur);
|
||||
|
||||
//Charged Tick
|
||||
if (!_charged.contains(cur))
|
||||
if (System.currentTimeMillis() - _charge.get(cur) > 1000)
|
||||
{
|
||||
_charged.add(cur);
|
||||
cur.playEffect(cur.getLocation(), Effect.CLICK1, 0);
|
||||
}
|
||||
Charge(cur);
|
||||
}
|
||||
|
||||
for (Player cur : voidSet)
|
||||
{
|
||||
FallingBlock block = _holding.remove(cur);
|
||||
_charge.remove(cur);
|
||||
_charged.remove(cur);
|
||||
block.remove();
|
||||
}
|
||||
|
||||
for (Player cur : throwSet)
|
||||
{
|
||||
FallingBlock block = _holding.remove(cur);
|
||||
_charged.remove(cur);
|
||||
long charge = System.currentTimeMillis() - _charge.remove(cur);
|
||||
float charge = _charge.remove(cur);
|
||||
int level = getLevel(cur);
|
||||
|
||||
//Throw
|
||||
cur.eject();
|
||||
double mult = 1 + (level * 0.2);
|
||||
if (charge < 1000)
|
||||
mult = mult * (charge/1000d);
|
||||
double mult = Math.max(0.4, charge * (1 + 0.1 * level));
|
||||
|
||||
//Condition Indicators
|
||||
Factory.Condition().SetIndicatorVisibility(cur, true);
|
||||
@ -223,7 +210,7 @@ public class BlockToss extends mineplex.minecraft.game.classcombat.Skill.Skill i
|
||||
Player damager = event.GetDamagerPlayer(true);
|
||||
if (damager == null) return;
|
||||
|
||||
if (!event.GetReason().equals(GetName()))
|
||||
if (event.GetReason() != null && !event.GetReason().equals(GetName()))
|
||||
return;
|
||||
|
||||
event.AddKnockback(GetName(), 1.5d);
|
||||
@ -339,6 +326,5 @@ public class BlockToss extends mineplex.minecraft.game.classcombat.Skill.Skill i
|
||||
|
||||
_holding.remove(player);
|
||||
_charge.remove(player);
|
||||
_charged.remove(player);
|
||||
}
|
||||
}
|
||||
|
@ -27,14 +27,12 @@ import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillActive;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillActiveCharge;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||
import mineplex.minecraft.game.classcombat.Skill.event.SkillEvent;
|
||||
|
||||
public class FleshHook extends SkillActive implements IThrown
|
||||
public class FleshHook extends SkillActiveCharge implements IThrown
|
||||
{
|
||||
private WeakHashMap<Player, Integer> _charge = new WeakHashMap<Player, Integer>();
|
||||
private WeakHashMap<Player, Long> _chargeLast = new WeakHashMap<Player, Long>();
|
||||
|
||||
public FleshHook(SkillFactory skills, String name, ClassType classType, SkillType skillType,
|
||||
int cost, int levels,
|
||||
int energy, int energyMod,
|
||||
@ -47,13 +45,16 @@ public class FleshHook extends SkillActive implements IThrown
|
||||
energy, energyMod,
|
||||
recharge, rechargeMod, rechargeInform,
|
||||
itemArray,
|
||||
actionArray);
|
||||
actionArray,
|
||||
0.01f, 0.005f);
|
||||
|
||||
SetDesc(new String[]
|
||||
{
|
||||
"Hold Block to charge Flesh Hook.",
|
||||
"Release Block to release it.",
|
||||
"",
|
||||
GetChargeString(),
|
||||
"",
|
||||
"If Flesh Hook hits a player, it",
|
||||
"deals up to #2#2 damage, and rips them",
|
||||
"towards you with #1.2#0.2 velocity.",
|
||||
@ -76,8 +77,7 @@ public class FleshHook extends SkillActive implements IThrown
|
||||
public void Skill(Player player, int level)
|
||||
{
|
||||
//Start Charge
|
||||
_charge.put(player, 0);
|
||||
_chargeLast.put(player, System.currentTimeMillis());
|
||||
_charge.put(player, 0f);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -99,39 +99,20 @@ public class FleshHook extends SkillActive implements IThrown
|
||||
//Add Charge
|
||||
if (cur.isBlocking())
|
||||
{
|
||||
//Max Charge
|
||||
if (_charge.get(cur) >= 4)
|
||||
continue;
|
||||
|
||||
//Charge Interval
|
||||
if (!UtilTime.elapsed(_chargeLast.get(cur), 400))
|
||||
continue;
|
||||
|
||||
//Energy
|
||||
if (!Factory.Energy().Use(cur, GetName(), 5, true, false))
|
||||
continue;
|
||||
|
||||
//Increase Charge
|
||||
_charge.put(cur, _charge.get(cur) + 1);
|
||||
_chargeLast.put(cur, System.currentTimeMillis());
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(cur, F.main(GetClassType().name(), GetName() + ": " + F.elem("+" + (_charge.get(cur) * 25) + "% Strength")));
|
||||
|
||||
//Effect
|
||||
for (int i=_charge.get(cur) ; i>0 ; i--)
|
||||
cur.playEffect(cur.getLocation(), Effect.CLICK2, 0);
|
||||
Charge(cur);
|
||||
}
|
||||
|
||||
//Release Charge
|
||||
else
|
||||
else if (_charge.containsKey(cur))
|
||||
{
|
||||
double base = 0.8;
|
||||
|
||||
float charge = _charge.remove(cur);
|
||||
|
||||
//Action
|
||||
Item item = cur.getWorld().dropItem(cur.getEyeLocation().add(cur.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(131));
|
||||
UtilAction.velocity(item, cur.getLocation().getDirection(),
|
||||
base + (_charge.remove(cur) * (0.25*base)), false, 0, 0.2, 20, false);
|
||||
base + (charge * base), false, 0, 0.2, 20, false);
|
||||
|
||||
Factory.Projectile().AddThrow(item, cur, this, -1, true, true, true,
|
||||
Sound.FIRE_IGNITE, 1.4f, 0.8f, ParticleType.RED_DUST, UpdateType.TICK, 1.5d);
|
||||
@ -146,13 +127,6 @@ public class FleshHook extends SkillActive implements IThrown
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Reset(Player player)
|
||||
{
|
||||
_charge.remove(player);
|
||||
_chargeLast.remove(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Collide(LivingEntity target, Block block, ProjectileUser data)
|
||||
{
|
||||
|
@ -48,6 +48,9 @@ public class Fortitude extends Skill
|
||||
Player damagee = event.GetDamageePlayer();
|
||||
if (damagee == null) return;
|
||||
|
||||
if (getLevel(damagee) <= 0)
|
||||
return;
|
||||
|
||||
_preHealth.put(damagee, damagee.getHealth());
|
||||
}
|
||||
|
||||
@ -61,6 +64,9 @@ public class Fortitude extends Skill
|
||||
Player damagee = event.GetDamageePlayer();
|
||||
if (damagee == null) return;
|
||||
|
||||
int level = getLevel(damagee);
|
||||
if (level == 0) return;
|
||||
|
||||
if (!_preHealth.containsKey(damagee))
|
||||
return;
|
||||
|
||||
@ -68,9 +74,6 @@ public class Fortitude extends Skill
|
||||
|
||||
System.out.println("Fortitude Diff: " + diff);
|
||||
|
||||
int level = getLevel(damagee);
|
||||
if (level == 0) return;
|
||||
|
||||
_health.put(damagee, Math.min(level,(int)(diff + 0.5)));
|
||||
_last.put(damagee, System.currentTimeMillis());
|
||||
}
|
||||
|
@ -8,7 +8,9 @@ import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillCharge;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillChargeBow;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
@ -19,7 +21,7 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class Barrage extends SkillCharge
|
||||
public class Barrage extends SkillChargeBow
|
||||
{
|
||||
private WeakHashMap<Player, Integer> _chargeArrows = new WeakHashMap<Player, Integer>();
|
||||
private HashSet<Projectile> _arrows = new HashSet<Projectile>();
|
||||
@ -28,20 +30,20 @@ public class Barrage extends SkillCharge
|
||||
SkillType skillType, int cost, int maxLevel)
|
||||
{
|
||||
super(skills, name, classType, skillType, cost, maxLevel,
|
||||
ChargeType.Sword, 0.01f, 0.005f, false, false, false);
|
||||
0.01f, 0.005f, false, false);
|
||||
|
||||
SetDesc(new String[]
|
||||
{
|
||||
"Charge your bow fire bonus arrows.",
|
||||
"",
|
||||
"Charges #"+(int)(_rateBase*2000)+"#"+(int)(_rateBoost*2000)+" % per Second.",
|
||||
GetChargeString(),
|
||||
"",
|
||||
"Fires up to #2#2 additional arrows."
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void DoSkill(Player player, float charge, Arrow arrow)
|
||||
public void DoSkillCustom(Player player, float charge, Arrow arrow)
|
||||
{
|
||||
_chargeArrows.put(player, (int)(charge * (2 + 2* getLevel(player))));
|
||||
}
|
||||
@ -49,7 +51,7 @@ public class Barrage extends SkillCharge
|
||||
@EventHandler
|
||||
public void Skill(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
if (event.getType() != UpdateType.FASTEST)
|
||||
return;
|
||||
|
||||
for (Player cur : GetUsers())
|
||||
@ -78,6 +80,8 @@ public class Barrage extends SkillCharge
|
||||
arrow.setVelocity(cur.getLocation().getDirection().add(random).multiply(3));
|
||||
_arrows.add(arrow);
|
||||
cur.getWorld().playSound(cur.getLocation(), Sound.SHOOT_ARROW, 1f, 1f);
|
||||
|
||||
UtilParticle.PlayParticle(ParticleType.CRIT, arrow.getLocation(), 0, 0, 0, 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -168,12 +168,15 @@ public class HealingShot extends SkillActive
|
||||
|
||||
UtilPlayer.message(damager, F.main(GetClassType().name(),
|
||||
"You hit " + F.name(UtilEnt.getName(damagee)) +" with " + F.skill(GetName(level)) + "."));
|
||||
|
||||
//Particles
|
||||
UtilParticle.PlayParticle(ParticleType.HEART, damagee.getLocation(), (float)(Math.random() - 0.5), (float)(Math.random() + 0.5), (float)(Math.random() - 0.5), 2f, 12);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Particle(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
if (event.getType() != UpdateType.FASTER)
|
||||
return;
|
||||
|
||||
for (Entity ent : _arrows)
|
||||
@ -192,7 +195,7 @@ public class HealingShot extends SkillActive
|
||||
{
|
||||
Entity arrow = arrowIterator.next();
|
||||
|
||||
if (arrow.isDead() || !arrow.isValid())
|
||||
if (arrow.isDead() || !arrow.isValid() || arrow.isOnGround())
|
||||
arrowIterator.remove();
|
||||
}
|
||||
}
|
||||
|
@ -4,9 +4,11 @@ import java.util.Iterator;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillCharge;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillChargeBow;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
|
||||
@ -19,7 +21,7 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
public class Overcharge extends SkillCharge
|
||||
public class Overcharge extends SkillChargeBow
|
||||
{
|
||||
private WeakHashMap<Arrow, Double> _arrows = new WeakHashMap<Arrow, Double>();
|
||||
|
||||
@ -27,20 +29,20 @@ public class Overcharge extends SkillCharge
|
||||
SkillType skillType, int cost, int maxLevel)
|
||||
{
|
||||
super(skills, name, classType, skillType, cost, maxLevel,
|
||||
ChargeType.Sword, 0.01f, 0.005f, false, false, false);
|
||||
0.01f, 0.005f, false, false);
|
||||
|
||||
SetDesc(new String[]
|
||||
{
|
||||
"Charge your bow to deal bonus damage.",
|
||||
"",
|
||||
"Charges #"+(int)(_rateBase*2000)+"#"+(int)(_rateBoost*2000)+" % per Second.",
|
||||
GetChargeString(),
|
||||
"",
|
||||
"Deals up to #2#2 bonus damage."
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void DoSkill(Player player, float charge, Arrow arrow)
|
||||
public void DoSkillCustom(Player player, float charge, Arrow arrow)
|
||||
{
|
||||
double damage = charge * (2 + 2 * getLevel(player));
|
||||
_arrows.put(arrow, damage);
|
||||
|
@ -7,6 +7,7 @@ import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillCharge;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillChargeSword;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
@ -15,9 +16,10 @@ import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
public class Shadowmeld extends SkillCharge
|
||||
public class Shadowmeld extends SkillChargeSword
|
||||
{
|
||||
private HashSet<Player> _active = new HashSet<Player>();
|
||||
|
||||
@ -26,7 +28,7 @@ public class Shadowmeld extends SkillCharge
|
||||
int cost, int maxLevel)
|
||||
{
|
||||
super(skills, name, classType, skillType, cost, maxLevel,
|
||||
ChargeType.Sneak, 0.01f, 0.005f, false, false, true);
|
||||
0.01f, 0.005f, false, false);
|
||||
|
||||
SetDesc(new String[]
|
||||
{
|
||||
@ -42,7 +44,7 @@ public class Shadowmeld extends SkillCharge
|
||||
|
||||
|
||||
@Override
|
||||
public void DoSkill(Player player, float charge, Arrow arrow)
|
||||
public void DoSkillCustom(Player player, float charge)
|
||||
{
|
||||
_active.add(player);
|
||||
}
|
||||
@ -102,6 +104,13 @@ public class Shadowmeld extends SkillCharge
|
||||
{
|
||||
End(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void EndBow(EntityShootBowEvent event)
|
||||
{
|
||||
if (event.getEntity() instanceof Player)
|
||||
End((Player)event.getEntity());
|
||||
}
|
||||
|
||||
public void End(Player player)
|
||||
{
|
||||
|
@ -2,6 +2,7 @@ package mineplex.minecraft.game.classcombat.Skill.Ranger;
|
||||
|
||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
@ -10,7 +11,9 @@ import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.minecraft.game.classcombat.Skill.Skill;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillCharge;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillChargeSword;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
@ -21,23 +24,23 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
public class WolfsPounce extends SkillCharge
|
||||
public class WolfsPounce extends SkillChargeSword
|
||||
{
|
||||
private NautHashMap<Player, Long> _live = new NautHashMap<Player, Long>();
|
||||
|
||||
|
||||
public WolfsPounce(SkillFactory skills, String name,
|
||||
ClassType classType, SkillType skillType,
|
||||
int cost, int maxLevel)
|
||||
{
|
||||
super(skills, name, classType, skillType, cost, maxLevel,
|
||||
ChargeType.Sneak, 0.02f, 0.005f, false, false, false);
|
||||
|
||||
0.01f, 0.005f, false, false);
|
||||
|
||||
SetDesc(new String[]
|
||||
{
|
||||
"Hold Block to charge pounce.",
|
||||
"Release Block to pounce.",
|
||||
"",
|
||||
"Charges #"+(int)(_rateBase*2000)+"#"+(int)(_rateBoost*2000)+" % per Second.",
|
||||
GetChargeString(),
|
||||
"",
|
||||
"Colliding with another player",
|
||||
"mid-air deals #1#1 damage and",
|
||||
@ -45,14 +48,16 @@ public class WolfsPounce extends SkillCharge
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void DoSkill(Player player, float charge, Arrow arrow)
|
||||
public void DoSkillCustom(Player player, float charge)
|
||||
{
|
||||
//Action
|
||||
UtilAction.velocity(player, 0.4 + (1.2*charge), 0.2, 0.6 + (0.6*charge), true);
|
||||
_live.put(player, System.currentTimeMillis());
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(getLevel(player))) + "."));
|
||||
|
||||
//Effect
|
||||
player.getWorld().playSound(player.getLocation(), Sound.WOLF_BARK, 1f, 0.5f + (1.5f * charge));
|
||||
}
|
||||
@ -83,29 +88,29 @@ public class WolfsPounce extends SkillCharge
|
||||
{
|
||||
if (!_live.containsKey(player))
|
||||
continue;
|
||||
|
||||
|
||||
for (Player other : player.getWorld().getPlayers())
|
||||
{
|
||||
if (other.getGameMode() != GameMode.SURVIVAL)
|
||||
continue;
|
||||
|
||||
|
||||
if (other.equals(player))
|
||||
continue;
|
||||
|
||||
|
||||
if (!Factory.Relation().CanHurt(player, other))
|
||||
continue;
|
||||
|
||||
|
||||
if (UtilMath.offset(player, other) > 2)
|
||||
continue;
|
||||
|
||||
|
||||
|
||||
|
||||
HandleCollide(player, other);
|
||||
_live.remove(player);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void HandleCollide(Player damager, LivingEntity damagee)
|
||||
{
|
||||
int level = getLevel(damager);
|
||||
@ -122,11 +127,11 @@ public class WolfsPounce extends SkillCharge
|
||||
//Inform
|
||||
UtilPlayer.message(damager, F.main(GetClassType().name(), "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(GetName(level)) + "."));
|
||||
UtilPlayer.message(damagee, F.main(GetClassType().name(), F.name(damager.getName()) + " hit you with " + F.skill(GetName(level)) + "."));
|
||||
|
||||
|
||||
//Effect
|
||||
damager.getWorld().playSound(damager.getLocation(), Sound.WOLF_BARK, 0.5f, 0.5f);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void Reset(Player player)
|
||||
{
|
||||
|
@ -7,10 +7,13 @@ import java.util.Set;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilDisplay;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||
import mineplex.minecraft.game.classcombat.Skill.repository.token.SkillToken;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -115,8 +118,18 @@ public abstract class Skill implements ISkill, Listener
|
||||
|
||||
if (!_users.containsKey(player))
|
||||
return 0;
|
||||
|
||||
int level = _users.get(player);
|
||||
|
||||
if (GetSkillType() == SkillType.Sword)
|
||||
if (UtilGear.isMat(player.getItemInHand(), Material.GOLD_SWORD))
|
||||
level++;
|
||||
|
||||
return 1;
|
||||
if (GetSkillType() == SkillType.Axe)
|
||||
if (UtilGear.isMat(player.getItemInHand(), Material.GOLD_AXE))
|
||||
level++;
|
||||
|
||||
return level;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -301,7 +314,7 @@ public abstract class Skill implements ISkill, Listener
|
||||
public void DisplayProgress(Player player, String ability, float amount)
|
||||
{
|
||||
player.setExp(amount);
|
||||
UtilDisplay.displayTextBar(Factory.GetPlugin(), player, amount, ability + " " + (int)(amount*100) + "%");
|
||||
UtilDisplay.displayTextBar(Factory.GetPlugin(), player, amount, C.cYellow + C.Bold + ability + ChatColor.RESET + " - " + C.cGreen + C.Bold + (int)(amount*100) + "%");
|
||||
|
||||
player.playSound(player.getLocation(), Sound.NOTE_PIANO, 0.5f, 0.5f + (amount * 1.5f));
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package mineplex.minecraft.game.classcombat.Skill;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
@ -125,7 +124,7 @@ public abstract class SkillActive extends Skill implements Listener
|
||||
return false;
|
||||
|
||||
//Use Recharge
|
||||
if (!Recharge.Instance.use(player, GetName(), GetName(level), Recharge(level), _rechargeInform))
|
||||
if (!Recharge.Instance.use(player, GetName(), GetName(level), Recharge(level), _rechargeInform, true))
|
||||
return false;
|
||||
|
||||
//Use Energy
|
||||
|
@ -0,0 +1,71 @@
|
||||
package mineplex.minecraft.game.classcombat.Skill;
|
||||
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.block.Action;
|
||||
|
||||
public abstract class SkillActiveCharge extends SkillActive
|
||||
{
|
||||
protected WeakHashMap<Player, Float> _charge = new WeakHashMap<Player, Float>();
|
||||
|
||||
protected float _rateBase;
|
||||
protected float _rateBoost;
|
||||
|
||||
public SkillActiveCharge(SkillFactory skills, String name,
|
||||
ClassType classType, SkillType skillType, int cost, int levels,
|
||||
int energy, int energyMod, long recharge, long rechargeMod,
|
||||
boolean rechargeInform, Material[] itemArray, Action[] actionArray,
|
||||
float base, float boost)
|
||||
{
|
||||
super(skills, name, classType, skillType, cost, levels, energy, energyMod,
|
||||
recharge, rechargeMod, rechargeInform, itemArray, actionArray);
|
||||
|
||||
_rateBase = base;
|
||||
_rateBoost = boost;
|
||||
}
|
||||
|
||||
public boolean Charge(Player player)
|
||||
{
|
||||
//Level
|
||||
int level = getLevel(player);
|
||||
if (level == 0)
|
||||
return false;
|
||||
|
||||
//Add & Recharge
|
||||
if (!_charge.containsKey(player))
|
||||
_charge.put(player, 0f);
|
||||
|
||||
float charge = _charge.get(player);
|
||||
|
||||
//Increase Charge
|
||||
charge = Math.min(1f, charge + _rateBase + (_rateBoost * level));
|
||||
_charge.put(player, charge);
|
||||
|
||||
//Display
|
||||
DisplayProgress(player, GetName(level), charge);
|
||||
|
||||
return charge >= 1;
|
||||
}
|
||||
|
||||
public float GetCharge(Player player)
|
||||
{
|
||||
if (!_charge.containsKey(player))
|
||||
return 0f;
|
||||
|
||||
return _charge.get(player);
|
||||
}
|
||||
|
||||
public void Reset(Player player)
|
||||
{
|
||||
_charge.remove(player);
|
||||
}
|
||||
|
||||
public String GetChargeString()
|
||||
{
|
||||
return "Charges #"+(int)(0.02*2000)+"#"+(int)(0.005*2000)+" % per Second.";
|
||||
}
|
||||
}
|
@ -1,296 +1,66 @@
|
||||
package mineplex.minecraft.game.classcombat.Skill;
|
||||
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
public abstract class SkillCharge extends Skill implements Listener
|
||||
public class SkillCharge extends Skill
|
||||
{
|
||||
public enum ChargeType
|
||||
{
|
||||
Sword,
|
||||
Bow,
|
||||
Sneak
|
||||
}
|
||||
|
||||
protected NautHashMap<Player, Float> _charge = new NautHashMap<Player, Float>();
|
||||
|
||||
protected WeakHashMap<Player, Float> _charge = new WeakHashMap<Player, Float>();
|
||||
|
||||
protected float _rateBase;
|
||||
protected float _rateBoost;
|
||||
|
||||
protected boolean _canChargeInWater;
|
||||
protected boolean _canChargeInAir;
|
||||
protected boolean _autoFire;
|
||||
|
||||
protected ChargeType _type;
|
||||
|
||||
|
||||
public SkillCharge(SkillFactory skills, String name, ClassType classType,
|
||||
SkillType skillType, int cost, int maxLevel,
|
||||
ChargeType type, float base, float boost, boolean inWater, boolean inAir, boolean autoFire)
|
||||
float base, float boost)
|
||||
{
|
||||
super(skills, name, classType, skillType, cost, maxLevel);
|
||||
|
||||
_rateBase = base;
|
||||
_rateBoost = boost;
|
||||
_canChargeInWater = inWater;
|
||||
_canChargeInAir = inAir;
|
||||
_autoFire = autoFire;
|
||||
_type = type;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void ChargeSneak(UpdateEvent event)
|
||||
{
|
||||
if (_type != ChargeType.Sneak)
|
||||
return;
|
||||
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
for (Player cur : GetUsers())
|
||||
{
|
||||
//Level
|
||||
int level = getLevel(cur);
|
||||
if (level == 0) continue;
|
||||
|
||||
//Charge
|
||||
if (cur.isSneaking())
|
||||
{
|
||||
//Flags
|
||||
if (_canChargeInAir && !UtilEnt.isGrounded(cur))
|
||||
continue;
|
||||
|
||||
if (_canChargeInWater && cur.getLocation().getBlock().isLiquid())
|
||||
continue;
|
||||
|
||||
//Add & Recharge
|
||||
if (!_charge.containsKey(cur))
|
||||
{
|
||||
if (!Recharge.Instance.use(cur, GetName(level), 1000, false))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
_charge.put(cur, 0f);
|
||||
}
|
||||
|
||||
float charge = _charge.get(cur);
|
||||
|
||||
//Increase Charge
|
||||
charge = Math.min(1f, charge + _rateBase + (_rateBoost * level));
|
||||
_charge.put(cur, charge);
|
||||
|
||||
//Display
|
||||
DisplayProgress(cur, GetName(), charge);
|
||||
|
||||
//Auto
|
||||
if (_autoFire && charge >= 1f)
|
||||
{
|
||||
DoSkill(cur, charge, null);
|
||||
}
|
||||
}
|
||||
//Release Charge
|
||||
else if (_charge.containsKey(cur))
|
||||
{
|
||||
float charge = _charge.remove(cur);
|
||||
|
||||
DoSkill(cur, charge, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void ChargeBlock(UpdateEvent event)
|
||||
public boolean Charge(Player player)
|
||||
{
|
||||
if (_type != ChargeType.Sword)
|
||||
return;
|
||||
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
for (Player cur : GetUsers())
|
||||
{
|
||||
//Level
|
||||
int level = getLevel(cur);
|
||||
if (level == 0) continue;
|
||||
|
||||
//Charge
|
||||
if (cur.isBlocking())
|
||||
{
|
||||
//Flags
|
||||
if (_canChargeInAir && !UtilEnt.isGrounded(cur))
|
||||
continue;
|
||||
|
||||
if (_canChargeInWater && cur.getLocation().getBlock().isLiquid())
|
||||
continue;
|
||||
|
||||
//Add & Recharge
|
||||
if (!_charge.containsKey(cur))
|
||||
{
|
||||
if (!Recharge.Instance.use(cur, GetName(level), 1000, false))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
_charge.put(cur, 0f);
|
||||
}
|
||||
|
||||
|
||||
float charge = _charge.get(cur);
|
||||
|
||||
//Increase Charge
|
||||
charge = Math.min(1f, charge + _rateBase + (_rateBoost * level));
|
||||
|
||||
//Display
|
||||
DisplayProgress(cur, GetName(), charge);
|
||||
|
||||
//Auto
|
||||
if (_autoFire && charge >= 1f)
|
||||
{
|
||||
_charge.remove(cur);
|
||||
DoSkill(cur, charge, null);
|
||||
}
|
||||
}
|
||||
//Release Charge
|
||||
else if (_charge.containsKey(cur))
|
||||
{
|
||||
//Action
|
||||
float charge = _charge.remove(cur);
|
||||
|
||||
DoSkill(cur, charge, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void ChargeBowInit(PlayerInteractEvent event)
|
||||
{
|
||||
if (_type != ChargeType.Bow)
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!UtilGear.isMat(event.getItem(), Material.BOW))
|
||||
return;
|
||||
|
||||
if (!UtilEvent.isAction(event, ActionType.R))
|
||||
return;
|
||||
|
||||
if (!player.getInventory().contains(Material.ARROW))
|
||||
return;
|
||||
|
||||
//Flags
|
||||
if (_canChargeInAir && !UtilEnt.isGrounded(player))
|
||||
return;
|
||||
|
||||
if (_canChargeInWater && player.getLocation().getBlock().isLiquid())
|
||||
return;
|
||||
|
||||
if (UtilBlock.usable(event.getClickedBlock()))
|
||||
return;
|
||||
|
||||
//Level
|
||||
int level = getLevel(player);
|
||||
if (level == 0) return;
|
||||
|
||||
//Start Charge
|
||||
_charge.put(player, 0f);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void ChargeBow(UpdateEvent event)
|
||||
{
|
||||
if (_type != ChargeType.Bow)
|
||||
return;
|
||||
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
for (Player cur : GetUsers())
|
||||
{
|
||||
//Not Charging
|
||||
if (!_charge.containsKey(cur))
|
||||
continue;
|
||||
|
||||
//Level
|
||||
int level = getLevel(cur);
|
||||
if (level == 0)
|
||||
{
|
||||
_charge.remove(cur);
|
||||
continue;
|
||||
}
|
||||
|
||||
//No Longer Holding Bow
|
||||
if (!UtilGear.isMat(cur.getItemInHand(), Material.BOW))
|
||||
{
|
||||
_charge.remove(cur);
|
||||
continue;
|
||||
}
|
||||
|
||||
//Flags
|
||||
if (_canChargeInAir && !UtilEnt.isGrounded(cur))
|
||||
continue;
|
||||
|
||||
if (_canChargeInWater && cur.getLocation().getBlock().isLiquid())
|
||||
continue;
|
||||
|
||||
float charge = _charge.get(cur);
|
||||
|
||||
//Increase Charge
|
||||
charge = Math.min(1f, charge + _rateBase + (_rateBoost * level));
|
||||
|
||||
//Display
|
||||
DisplayProgress(cur, GetName(), charge);
|
||||
|
||||
//Auto
|
||||
if (_autoFire && charge >= 1f)
|
||||
{
|
||||
_charge.remove(cur);
|
||||
DoSkill(cur, charge, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void TriggerBow(EntityShootBowEvent event)
|
||||
{
|
||||
if (_type != ChargeType.Bow)
|
||||
return;
|
||||
|
||||
if (!(event.getEntity() instanceof Player))
|
||||
return;
|
||||
|
||||
if (!(event.getProjectile() instanceof Arrow))
|
||||
return;
|
||||
|
||||
Player player = (Player)event.getEntity();
|
||||
if (level == 0)
|
||||
return false;
|
||||
|
||||
//Add & Recharge
|
||||
if (!_charge.containsKey(player))
|
||||
return;
|
||||
_charge.put(player, 0f);
|
||||
|
||||
DoSkill(player, _charge.remove(player), (Arrow)event.getProjectile());
|
||||
float charge = _charge.get(player);
|
||||
|
||||
//Increase Charge
|
||||
charge = Math.min(1f, charge + _rateBase + (_rateBoost * level));
|
||||
_charge.put(player, charge);
|
||||
|
||||
//Display
|
||||
DisplayProgress(player, GetName(level), charge);
|
||||
|
||||
return charge >= 1;
|
||||
}
|
||||
|
||||
public float GetCharge(Player player)
|
||||
{
|
||||
if (!_charge.containsKey(player))
|
||||
return 0f;
|
||||
|
||||
return _charge.get(player);
|
||||
}
|
||||
|
||||
public abstract void DoSkill(Player player, float charge, Arrow arrow);
|
||||
|
||||
@Override
|
||||
public void Reset(Player player)
|
||||
{
|
||||
_charge.remove(player);
|
||||
}
|
||||
|
||||
public String GetChargeString()
|
||||
{
|
||||
return "Charges #"+(int)(0.02*2000)+"#"+(int)(0.005*2000)+" % per Second.";
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,145 @@
|
||||
package mineplex.minecraft.game.classcombat.Skill;
|
||||
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
public abstract class SkillChargeBow extends SkillCharge implements Listener
|
||||
{
|
||||
protected boolean _canChargeInWater;
|
||||
protected boolean _canChargeInAir;
|
||||
|
||||
public SkillChargeBow(SkillFactory skills, String name, ClassType classType,
|
||||
SkillType skillType, int cost, int maxLevel,
|
||||
float base, float boost, boolean inWater, boolean inAir)
|
||||
{
|
||||
super(skills, name, classType, skillType, cost, maxLevel, base, boost);
|
||||
|
||||
_canChargeInWater = inWater;
|
||||
_canChargeInAir = inAir;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void ChargeBowInit(PlayerInteractEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!UtilGear.isMat(event.getItem(), Material.BOW))
|
||||
return;
|
||||
|
||||
if (!UtilEvent.isAction(event, ActionType.R))
|
||||
return;
|
||||
|
||||
if (!player.getInventory().contains(Material.ARROW))
|
||||
return;
|
||||
|
||||
//Flags
|
||||
if (!_canChargeInAir && !UtilEnt.isGrounded(player))
|
||||
return;
|
||||
|
||||
if (!_canChargeInWater && player.getLocation().getBlock().isLiquid())
|
||||
return;
|
||||
|
||||
if (UtilBlock.usable(event.getClickedBlock()))
|
||||
return;
|
||||
|
||||
//Level
|
||||
int level = getLevel(player);
|
||||
if (level == 0) return;
|
||||
|
||||
//Start Charge
|
||||
_charge.put(player, 0f);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void ChargeBow(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
for (Player cur : GetUsers())
|
||||
{
|
||||
//Not Charging
|
||||
if (!_charge.containsKey(cur))
|
||||
continue;
|
||||
|
||||
//Level
|
||||
int level = getLevel(cur);
|
||||
if (level == 0)
|
||||
{
|
||||
_charge.remove(cur);
|
||||
continue;
|
||||
}
|
||||
|
||||
//No Longer Holding Bow
|
||||
if (!UtilGear.isMat(cur.getItemInHand(), Material.BOW))
|
||||
{
|
||||
_charge.remove(cur);
|
||||
continue;
|
||||
}
|
||||
|
||||
//Flags
|
||||
if (!_canChargeInAir && !UtilEnt.isGrounded(cur))
|
||||
continue;
|
||||
|
||||
if (!_canChargeInWater && cur.getLocation().getBlock().isLiquid())
|
||||
continue;
|
||||
|
||||
float charge = _charge.get(cur);
|
||||
|
||||
//Increase Charge
|
||||
charge = Math.min(1f, charge + _rateBase + (_rateBoost * level));
|
||||
_charge.put(cur, charge);
|
||||
|
||||
//Display
|
||||
DisplayProgress(cur, GetName(), charge);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void TriggerBow(EntityShootBowEvent event)
|
||||
{
|
||||
if (!(event.getEntity() instanceof Player))
|
||||
return;
|
||||
|
||||
if (!(event.getProjectile() instanceof Arrow))
|
||||
return;
|
||||
|
||||
Player player = (Player)event.getEntity();
|
||||
|
||||
if (!_charge.containsKey(player))
|
||||
return;
|
||||
|
||||
DoSkill(player, _charge.remove(player), (Arrow)event.getProjectile());
|
||||
}
|
||||
|
||||
public void DoSkill(Player player, float charge, Arrow arrow)
|
||||
{
|
||||
player.setExp(0f);
|
||||
|
||||
DoSkillCustom(player, charge, arrow);
|
||||
}
|
||||
|
||||
public abstract void DoSkillCustom(Player player, float charge, Arrow arrow);
|
||||
|
||||
@Override
|
||||
public void Reset(Player player)
|
||||
{
|
||||
_charge.remove(player);
|
||||
}
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
package mineplex.minecraft.game.classcombat.Skill;
|
||||
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
public abstract class SkillChargeSword extends SkillCharge implements Listener
|
||||
{
|
||||
protected boolean _canChargeInWater;
|
||||
protected boolean _canChargeInAir;
|
||||
|
||||
public SkillChargeSword(SkillFactory skills, String name, ClassType classType,
|
||||
SkillType skillType, int cost, int maxLevel,
|
||||
float base, float boost,
|
||||
boolean inWater, boolean inAir)
|
||||
{
|
||||
super(skills, name, classType, skillType, cost, maxLevel, base, boost);
|
||||
|
||||
_canChargeInWater = inWater;
|
||||
_canChargeInAir = inAir;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void ChargeBlock(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
for (Player cur : GetUsers())
|
||||
{
|
||||
//Charge
|
||||
if (cur.isBlocking())
|
||||
{
|
||||
//Flags
|
||||
if (!_canChargeInAir && !UtilEnt.isGrounded(cur))
|
||||
continue;
|
||||
|
||||
if (!_canChargeInWater && cur.getLocation().getBlock().isLiquid())
|
||||
continue;
|
||||
|
||||
//Recharge
|
||||
if (!_charge.containsKey(cur))
|
||||
if (!Recharge.Instance.use(cur, GetName(), 2000, false))
|
||||
continue;
|
||||
|
||||
//Charge
|
||||
Charge(cur);
|
||||
}
|
||||
//Release Charge
|
||||
else if (_charge.containsKey(cur))
|
||||
{
|
||||
//Action
|
||||
float charge = _charge.remove(cur);
|
||||
|
||||
DoSkill(cur, charge);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void DoSkill(Player player, float charge)
|
||||
{
|
||||
player.setExp(0f);
|
||||
|
||||
DoSkillCustom(player, charge);
|
||||
}
|
||||
|
||||
public abstract void DoSkillCustom(Player player, float charge);
|
||||
|
||||
@Override
|
||||
public void Reset(Player player)
|
||||
{
|
||||
_charge.remove(player);
|
||||
}
|
||||
}
|
@ -450,7 +450,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
|
||||
AddSkill(new IncendiaryShot(this, "Incendiary Shot", ClassType.Ranger, SkillType.Bow,
|
||||
5, 4,
|
||||
0, 0,
|
||||
18000, -2000, false,
|
||||
18000, -2000, true,
|
||||
new Material[] {Material.BOW},
|
||||
new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK}));
|
||||
|
||||
@ -483,7 +483,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
|
||||
//Passive B
|
||||
AddSkill(new BarbedArrows(this, "Barbed Arrows", ClassType.Ranger, SkillType.PassiveB, 5, 3));
|
||||
AddSkill(new HeavyArrows(this, "Heavy Arrows", ClassType.Ranger, SkillType.PassiveB, 5, 3));
|
||||
AddSkill(new Shadowmeld(this, "Shadowmeld", ClassType.Ranger, SkillType.PassiveB, 5, 3));
|
||||
//AddSkill(new Shadowmeld(this, "Shadowmeld", ClassType.Ranger, SkillType.PassiveB, 5, 3));
|
||||
AddSkill(new Longshot(this, "Longshot", ClassType.Ranger, SkillType.PassiveB, 5, 3));
|
||||
AddSkill(new Sharpshooter(this, "Sharpshooter", ClassType.Ranger, SkillType.PassiveB, 5, 3));
|
||||
//AddSkill(new Fletcher(this, "Fletcher", ClassType.Ranger, SkillType.PassiveB, 5, 3));
|
||||
|
@ -54,29 +54,29 @@ public class Arcade extends JavaPlugin implements INautilusPlugin
|
||||
|
||||
private ArcadeManager _gameManager;
|
||||
|
||||
@Override
|
||||
public void onEnable()
|
||||
{
|
||||
//Delete Old Games Folders
|
||||
DeleteFolders();
|
||||
@Override
|
||||
public void onEnable()
|
||||
{
|
||||
//Delete Old Games Folders
|
||||
DeleteFolders();
|
||||
|
||||
//Configs
|
||||
getConfig().addDefault(WEB_CONFIG, "http://accounts.mineplex.com/");
|
||||
getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG));
|
||||
saveConfig();
|
||||
|
||||
|
||||
_clientManager = CoreClientManager.Initialize(this, GetWebServerAddress());
|
||||
|
||||
|
||||
CommandCenter.Initialize(this, _clientManager);
|
||||
|
||||
ItemStackFactory.Initialize(this, false);
|
||||
Recharge.Initialize(this);
|
||||
|
||||
|
||||
_donationManager = new DonationManager(this, GetWebServerAddress());
|
||||
ConditionManager conditionManager = new ConditionManager(this);
|
||||
|
||||
|
||||
new MessageManager(this, _clientManager);
|
||||
|
||||
|
||||
AntiStack antistack = new AntiStack(this);
|
||||
|
||||
Creature creature = new Creature(this);
|
||||
@ -84,15 +84,15 @@ public class Arcade extends JavaPlugin implements INautilusPlugin
|
||||
Teleport teleport = new Teleport(this, _clientManager, spawn);
|
||||
new FileUpdater(this, new Portal(this));
|
||||
ServerStatusManager serverStatusManager = new ServerStatusManager(this, new LagMeter(this, _clientManager));
|
||||
|
||||
|
||||
PacketHandler packetHandler = new PacketHandler(this);
|
||||
DisguiseManager disguiseManager = new DisguiseManager(this, packetHandler);
|
||||
|
||||
|
||||
_damageManager = new DamageManager(this, new CombatManager(this), new NpcManager(this, creature), disguiseManager);
|
||||
|
||||
Portal portal = new Portal(this);
|
||||
|
||||
//Arcade Manager
|
||||
|
||||
//Arcade Manager
|
||||
_gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, conditionManager, _damageManager, disguiseManager, creature, teleport, new Blood(this), antistack, portal, packetHandler, GetWebServerAddress());
|
||||
|
||||
Punish punish = new Punish(this, GetWebServerAddress(), _clientManager);
|
||||
|
@ -9,6 +9,8 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.ItemDespawnEvent;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
@ -289,4 +291,14 @@ public class Dominate extends TeamGame
|
||||
{
|
||||
// NOTHING
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void InventoryLock(InventoryClickEvent event)
|
||||
{
|
||||
if (event.getInventory().getType() == InventoryType.CRAFTING)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
event.getWhoClicked().closeInventory();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user