Champions Update (#613)

This commit is contained in:
Sam 2018-06-01 02:59:42 +01:00 committed by Alexander Meech
parent 4bbd8a94ac
commit 266336bc74
119 changed files with 2624 additions and 1880 deletions

View File

@ -572,18 +572,6 @@ public enum Achievement
new int[]{80}, new int[]{80},
AchievementCategory.CHAMPIONS), AchievementCategory.CHAMPIONS),
CHAMPIONS_FLAWLESS_VICTORY("Flawless Victory", 800,
new String[]{"Champions TDM.FlawlessVictory"},
new String[]{"Win TDM without losing a player"},
new int[]{1},
AchievementCategory.CHAMPIONS),
CHAMPIONS_ACE("Ace", 2000,
new String[]{"Champions TDM.Ace"},
new String[]{"Kill all enemies in a game of TDM"},
new int[]{1},
AchievementCategory.CHAMPIONS),
CHAMPIONS_ASSASSINATION("Assassination", 1000, CHAMPIONS_ASSASSINATION("Assassination", 1000,
new String[]{"Champions Domination.Assassination", "Champions TDM.Assassination", "Champions CTF.Assassination"}, new String[]{"Champions Domination.Assassination", "Champions TDM.Assassination", "Champions CTF.Assassination"},
new String[]{"Kill 40 players with Backstab without", "taking any damage from them"}, new String[]{"Kill 40 players with Backstab without", "taking any damage from them"},

View File

@ -69,6 +69,9 @@ public abstract class ArrowEffectGadget extends Gadget
if (!_arrows.remove(event.getEntity())) if (!_arrows.remove(event.getEntity()))
return; return;
if (Manager.hideParticles())
return;
doHitEffect((Arrow)event.getEntity()); doHitEffect((Arrow)event.getEntity());
} }

View File

@ -546,7 +546,7 @@ public class NewNPCManager extends MiniPlugin
* @param entity The entity you want to check. * @param entity The entity you want to check.
* @return true if the entity is a {@link NPC}. * @return true if the entity is a {@link NPC}.
*/ */
private boolean isNPC(Entity entity) public boolean isNPC(Entity entity)
{ {
return getNPC(entity) != null; return getNPC(entity) != null;
} }

View File

@ -1,16 +1,5 @@
package mineplex.core.packethandler; package mineplex.core.packethandler;
import com.mineplex.spigot.PacketProcessor;
import mineplex.core.MiniPlugin;
import mineplex.core.ReflectivelyCreateMiniPlugin;
import net.minecraft.server.v1_8_R3.Packet;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -21,6 +10,20 @@ import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
import java.util.TreeMap; import java.util.TreeMap;
import net.minecraft.server.v1_8_R3.Packet;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import com.mineplex.spigot.PacketProcessor;
import mineplex.core.MiniPlugin;
import mineplex.core.ReflectivelyCreateMiniPlugin;
@ReflectivelyCreateMiniPlugin @ReflectivelyCreateMiniPlugin
public class PacketHandler extends MiniPlugin public class PacketHandler extends MiniPlugin
{ {

View File

@ -371,7 +371,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
itemIgnore.add("Proximity Explosive"); itemIgnore.add("Proximity Explosive");
itemIgnore.add("Proximity Zapper"); itemIgnore.add("Proximity Zapper");
ItemFactory itemFactory = new ItemFactory(plugin, blockRestore, _condition, _damageManager, energy, fire, _projectileManager, itemIgnore); ItemFactory itemFactory = new ItemFactory(plugin, blockRestore, _condition, _damageManager, energy, fire, _projectileManager, this, itemIgnore);
SkillFactory skillManager = new SkillFactory(plugin, _damageManager, this, _combatManager, _condition, _projectileManager, _disguiseManager, blockRestore, fire, new Movement(plugin), teleport, energy); SkillFactory skillManager = new SkillFactory(plugin, _damageManager, this, _combatManager, _condition, _projectileManager, _disguiseManager, blockRestore, fire, new Movement(plugin), teleport, energy);
skillManager.RemoveSkill("Dwarf Toss", "Block Toss"); skillManager.RemoveSkill("Dwarf Toss", "Block Toss");
skillManager.removeSkill("Whirlwind Axe"); skillManager.removeSkill("Whirlwind Axe");
@ -400,7 +400,11 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
return true; return true;
}); });
((Blink)skillManager.GetSkill("Blink")).setAllowTrapping(true); ((Blink)skillManager.GetSkill("Blink")).setAllowTrapping(true);
((Flash)skillManager.GetSkill("Flash")).setAllowTrapping(true);
Flash flashSkill = (Flash) skillManager.GetSkill("Flash");
flashSkill.setAllowTrapping(true);
flashSkill.setStartWithCharges(false);
registerEvents(new Listener() registerEvents(new Listener()
{ {
@EventHandler @EventHandler

View File

@ -42,7 +42,6 @@ import mineplex.core.movement.Movement;
import mineplex.core.npc.NpcManager; import mineplex.core.npc.NpcManager;
import mineplex.core.packethandler.PacketHandler; import mineplex.core.packethandler.PacketHandler;
import mineplex.core.party.PartyManager; import mineplex.core.party.PartyManager;
import mineplex.core.personalServer.PersonalServerManager;
import mineplex.core.pet.PetManager; import mineplex.core.pet.PetManager;
import mineplex.core.poll.PollManager; import mineplex.core.poll.PollManager;
import mineplex.core.portal.GenericServer; import mineplex.core.portal.GenericServer;
@ -180,7 +179,7 @@ public class Hub extends JavaPlugin implements IRelation
Energy energy = new Energy(this); Energy energy = new Energy(this);
energy.setEnabled(false); energy.setEnabled(false);
ItemFactory itemFactory = new ItemFactory(this, blockRestore, conditionManager, damage, energy, fire, throwManager); ItemFactory itemFactory = new ItemFactory(this, blockRestore, conditionManager, damage, energy, fire, throwManager, this);
SkillFactory skillManager = new SkillFactory(this, damage, this, combatManager, conditionManager, throwManager, disguiseManager, blockRestore, fire, new Movement(this), teleport, energy); SkillFactory skillManager = new SkillFactory(this, damage, this, combatManager, conditionManager, throwManager, disguiseManager, blockRestore, fire, new Movement(this), teleport, energy);
ClassManager classManager = new ClassManager(this, clientManager, donationManager, hubManager.GetGadget(), skillManager, itemFactory); ClassManager classManager = new ClassManager(this, clientManager, donationManager, hubManager.GetGadget(), skillManager, itemFactory);
itemFactory.deregisterSelf(); itemFactory.deregisterSelf();

View File

@ -173,7 +173,7 @@ public class ClassManager extends MiniClientPlugin<ClientClass> implements IClas
customBuild.Name = "Default Build"; customBuild.Name = "Default Build";
customBuild.SwordSkill = "Evade"; customBuild.SwordSkill = "Evade";
customBuild.SwordSkillLevel = 2; customBuild.SwordSkillLevel = 1;
customBuild.AxeSkill = "Leap"; customBuild.AxeSkill = "Leap";
customBuild.AxeSkillLevel = 3; customBuild.AxeSkillLevel = 3;
customBuild.BowSkill = "Smoke Arrow"; customBuild.BowSkill = "Smoke Arrow";
@ -195,16 +195,16 @@ public class ClassManager extends MiniClientPlugin<ClientClass> implements IClas
CustomBuildToken customBuild = new CustomBuildToken(ClassType.Mage); CustomBuildToken customBuild = new CustomBuildToken(ClassType.Mage);
customBuild.Name = "Default Build"; customBuild.Name = "Default Build";
customBuild.SwordSkill = "Blizzard"; customBuild.SwordSkill = "Inferno";
customBuild.SwordSkillLevel = 3; customBuild.SwordSkillLevel = 3;
customBuild.AxeSkill = "Ice Prison"; customBuild.AxeSkill = "Fire Blast";
customBuild.AxeSkillLevel = 3; customBuild.AxeSkillLevel = 3;
customBuild.BowSkill = ""; customBuild.BowSkill = "";
customBuild.ClassPassiveASkill = "Arctic Armor"; customBuild.ClassPassiveASkill = "Immolate";
customBuild.ClassPassiveASkillLevel = 2; customBuild.ClassPassiveASkillLevel = 1;
customBuild.ClassPassiveBSkill = "Glacial Blade"; customBuild.ClassPassiveBSkill = "Magma Blade";
customBuild.ClassPassiveBSkillLevel = 2; customBuild.ClassPassiveBSkillLevel = 2;
customBuild.GlobalPassiveSkill = "Mana Pool"; customBuild.GlobalPassiveSkill = "Break Fall";
customBuild.GlobalPassiveSkillLevel = 2; customBuild.GlobalPassiveSkillLevel = 2;
AddClass(new PvpClass(this, 4, ClassType.Mage, customBuild, new String[] { "Trained in the ancient arts.", AddClass(new PvpClass(this, 4, ClassType.Mage, customBuild, new String[] { "Trained in the ancient arts.",
@ -226,7 +226,7 @@ public class ClassManager extends MiniClientPlugin<ClientClass> implements IClas
customBuild.ClassPassiveASkill = "Stampede"; customBuild.ClassPassiveASkill = "Stampede";
customBuild.ClassPassiveASkillLevel = 2; customBuild.ClassPassiveASkillLevel = 2;
customBuild.ClassPassiveBSkill = "Crippling Blow"; customBuild.ClassPassiveBSkill = "Crippling Blow";
customBuild.ClassPassiveBSkillLevel = 2; customBuild.ClassPassiveBSkillLevel = 1;
customBuild.GlobalPassiveSkill = "Recharge"; customBuild.GlobalPassiveSkill = "Recharge";
customBuild.GlobalPassiveSkillLevel = 1; customBuild.GlobalPassiveSkillLevel = 1;

View File

@ -579,7 +579,7 @@ public class ClientClass
return false; return false;
} }
if (!skillName.isEmpty() && (skill == null || skill.GetSkillType() != expectedType || (!skill.IsFree() && !_donor.ownsUnknownSalesPackage("Champions " + skillName) && !_client.hasPermission(ClassShopManager.Perm.SKILL_UNLOCK_LEGACY) && !_donor.ownsUnknownSalesPackage("Competitive ULTRA")))) if (!skillName.isEmpty() && (skill.GetSkillType() != expectedType || !skill.IsFree() && !_donor.ownsUnknownSalesPackage("Champions " + skillName) && !_client.hasPermission(ClassShopManager.Perm.SKILL_UNLOCK_LEGACY) && !_donor.ownsUnknownSalesPackage("Competitive ULTRA")))
{ {
return false; return false;
} }

View File

@ -11,8 +11,8 @@ import mineplex.minecraft.game.classcombat.item.Item;
public class CustomBuildToken public class CustomBuildToken
{ {
public static int MAX_SKILL_TOKENS = 12; public static final int MAX_SKILL_TOKENS = 12;
public static int MAX_ITEM_TOKENS = 12; public static final int MAX_ITEM_TOKENS = 12;
public int CustomBuildId; public int CustomBuildId;
@ -42,7 +42,7 @@ public class CustomBuildToken
public String GlobalPassiveSkill = ""; public String GlobalPassiveSkill = "";
public Integer GlobalPassiveSkillLevel = 0; public Integer GlobalPassiveSkillLevel = 0;
public List<SlotToken> Slots = new ArrayList<SlotToken>(9); public final List<SlotToken> Slots = new ArrayList<>(9);
public int SkillTokens = MAX_SKILL_TOKENS; public int SkillTokens = MAX_SKILL_TOKENS;
public int ItemTokens = 1; public int ItemTokens = 1;

View File

@ -1,5 +1,6 @@
package mineplex.minecraft.game.classcombat.Skill.Assassin; package mineplex.minecraft.game.classcombat.Skill.Assassin;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
@ -23,7 +24,8 @@ public class Assassin extends Skill
SetDesc(new String[] SetDesc(new String[]
{ {
"Permanent Speed II.", "Permanent Speed II.",
"Fall damage reduced by 1.5." "Fall damage reduced by 1.5.",
"Arrows deal 37.5% less damage."
}); });
} }
@ -69,26 +71,40 @@ public class Assassin extends Skill
if (level == 0) return; if (level == 0) return;
event.SetKnockback(false); event.SetKnockback(false);
event.AddMod(damager.getName(), "Assassin Class", 0, false); event.AddMod(damager.getName(), GetName(), 0, false);
} }
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
public void FallDamage(CustomDamageEvent event) public void FallDamage(CustomDamageEvent event)
{ {
if (event.IsCancelled()) if (event.IsCancelled())
{
return; return;
}
if (event.GetCause() != DamageCause.FALL)
return;
Player player = event.GetDamageePlayer(); Player player = event.GetDamageePlayer();
if (player == null) return;
if (player == null)
{
return;
}
int level = getLevel(player); int level = getLevel(player);
if (level == 0) return;
if (level == 0)
{
return;
}
if (event.GetCause() == DamageCause.FALL)
{
event.AddMod(null, GetName(), -1.5, false); event.AddMod(null, GetName(), -1.5, false);
} }
else if (event.GetCause() == DamageCause.PROJECTILE && event.GetProjectile() instanceof Arrow)
{
event.AddMod(null, GetName(), -event.GetDamage() * 0.375, false);
}
}
@EventHandler @EventHandler
public void CancelEnergy(EnergyEvent event) public void CancelEnergy(EnergyEvent event)

View File

@ -9,6 +9,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import mineplex.core.recharge.Recharge;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.minecraft.game.classcombat.Skill.Skill; import mineplex.minecraft.game.classcombat.Skill.Skill;
@ -23,7 +24,7 @@ public class BackStab extends Skill
SetDesc(new String[] SetDesc(new String[]
{ {
"Attacks from behind opponents", "Attacks from behind opponents",
"deal #1#1 additional damage.", "deal #1.5#1.5 additional damage.",
}); });
} }
@ -57,30 +58,12 @@ public class BackStab extends Skill
if (check.subtract(from).length() < 0.8) if (check.subtract(from).length() < 0.8)
{ {
//Damage //Damage
event.AddMod(damager.getName(), GetName(), 1 + level, true); event.AddMod(damager.getName(), GetName(), 1.5 + 1.5 * level, true);
//Effect //Effect
damagee.getWorld().playSound(damagee.getLocation(), Sound.HURT_FLESH, 1f, 2f); damagee.getWorld().playSound(damagee.getLocation(), Sound.HURT_FLESH, 1f, 2f);
damagee.getWorld().playEffect(damagee.getLocation(), Effect.STEP_SOUND, 55); damagee.getWorld().playEffect(damagee.getLocation(), Effect.STEP_SOUND, 55);
return;
} }
/*
check = new Vector(look.getZ() * -1, 0, look.getX());
if (check.subtract(from).length() < 0.7)
{
//Damage
event.AddMod(damager.getName(), "Sidestab", level * 1, true);
return;
}
check = new Vector(look.getZ(), 0, look.getX() * -1);
if (check.subtract(from).length() < 0.7)
{
//Damage
event.AddMod(damager.getName(), "Sidestab", level * 1, true);
return;
}*/
} }
@Override @Override

View File

@ -18,6 +18,7 @@ import org.bukkit.util.Vector;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
@ -58,7 +59,7 @@ public class Blink extends SkillActive
"Instantly teleport forwards #9#3 Blocks.", "Instantly teleport forwards #9#3 Blocks.",
"Cannot be used while Slowed.", "Cannot be used while Slowed.",
"", "",
"Using again within 5 seconds De-Blinks,", "Using again within #6#-1 seconds De-Blinks,",
"returning you to your original location.", "returning you to your original location.",
"Cannot be used while Slowed." "Cannot be used while Slowed."
}); });
@ -73,7 +74,7 @@ public class Blink extends SkillActive
UtilPlayer.message(player, F.main(GetClassType().name(), "You cannot use " + F.skill(GetName()) + " while Slowed.")); UtilPlayer.message(player, F.main(GetClassType().name(), "You cannot use " + F.skill(GetName()) + " while Slowed."));
return false; return false;
} }
else if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) else if (UtilEnt.isInWater(player))
{ {
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false; return false;
@ -89,10 +90,12 @@ public class Blink extends SkillActive
//Deblink //Deblink
if (_loc.containsKey(player) && _blinkTime.containsKey(player)) if (_loc.containsKey(player) && _blinkTime.containsKey(player))
{ {
if (!UtilTime.elapsed(_blinkTime.get(player), 5000)) long time = _blinkTime.get(player);
if (!UtilTime.elapsed(time, 6000 - (1000 * level)))
{ {
//Require 500ms after blink to deblink //Require 500ms after blink to deblink
if (UtilTime.elapsed(_blinkTime.get(player), 500)) if (UtilTime.elapsed(time, 500))
Deblink(player, level); Deblink(player, level);
return false; return false;

View File

@ -1,26 +1,30 @@
package mineplex.minecraft.game.classcombat.Skill.Assassin; package mineplex.minecraft.game.classcombat.Skill.Assassin;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.classcombat.Skill.Skill; import mineplex.minecraft.game.classcombat.Skill.Skill;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class ComboAttack extends Skill public class ComboAttack extends Skill
{ {
private WeakHashMap<Player, Float> _repeat = new WeakHashMap<Player, Float>(); private final Map<Player, Float> _repeat = new WeakHashMap<>();
private WeakHashMap<Player, Long> _last = new WeakHashMap<Player, Long>(); private final Map<Player, Long> _last = new WeakHashMap<>();
private final Map<Player, Integer> _lastTarget = new WeakHashMap<>();
public ComboAttack(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) public ComboAttack(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels)
{ {
@ -53,8 +57,20 @@ public class ComboAttack extends Skill
int level = getLevel(damager); int level = getLevel(damager);
if (level == 0) return; if (level == 0) return;
LivingEntity target = event.GetDamageeEntity();
if (target == null) return;
Integer lastId = _lastTarget.put(damager, target.getEntityId());
if (lastId == null || lastId != target.getEntityId())
{
_repeat.remove(damager);
_last.remove(damager);
}
if (!_repeat.containsKey(damager)) if (!_repeat.containsKey(damager))
{
_repeat.put(damager, 0.5f); _repeat.put(damager, 0.5f);
}
//Damage //Damage
event.AddMod(damager.getName(), GetName(), _repeat.get(damager), true); event.AddMod(damager.getName(), GetName(), _repeat.get(damager), true);
@ -73,16 +89,21 @@ public class ComboAttack extends Skill
if (event.getType() != UpdateType.FAST) if (event.getType() != UpdateType.FAST)
return; return;
HashSet<Player> remove = new HashSet<Player>(); Set<Player> remove = new HashSet<>();
for (Player cur : _repeat.keySet()) for (Player cur : _repeat.keySet())
{
if (UtilTime.elapsed(_last.get(cur), 2000)) if (UtilTime.elapsed(_last.get(cur), 2000))
{
remove.add(cur); remove.add(cur);
}
}
for (Player cur : remove) for (Player cur : remove)
{ {
_repeat.remove(cur); _repeat.remove(cur);
_last.remove(cur); _last.remove(cur);
_lastTarget.remove(cur);
} }
} }
@ -91,5 +112,6 @@ public class ComboAttack extends Skill
{ {
_repeat.remove(player); _repeat.remove(player);
_last.remove(player); _last.remove(player);
_lastTarget.remove(player);
} }
} }

View File

@ -1,8 +1,8 @@
package mineplex.minecraft.game.classcombat.Skill.Assassin; package mineplex.minecraft.game.classcombat.Skill.Assassin;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map;
import org.bukkit.Effect; import org.bukkit.Effect;
import org.bukkit.Location; import org.bukkit.Location;
@ -16,26 +16,27 @@ import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilParticle; 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.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.recharge.Recharge; 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 mineplex.minecraft.game.classcombat.Skill.SkillActive; import mineplex.minecraft.game.classcombat.Skill.SkillActive;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class Evade extends SkillActive public class Evade extends SkillActive
{ {
private HashMap<Player, Long> _active = new HashMap<Player, Long>();
private final Map<Player, Long> _active = new HashMap<>();
public Evade(SkillFactory skills, String name, ClassType classType, SkillType skillType, public Evade(SkillFactory skills, String name, ClassType classType, SkillType skillType,
int cost, int levels, int cost, int levels,
@ -63,7 +64,7 @@ public class Evade extends SkillActive
@Override @Override
public boolean CustomCheck(Player player, int level) public boolean CustomCheck(Player player, int level)
{ {
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) if (UtilEnt.isInWater(player))
{ {
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false; return false;
@ -120,30 +121,37 @@ public class Evade extends SkillActive
damagee.getWorld().playEffect(damagee.getLocation(), Effect.SMOKE, 5); damagee.getWorld().playEffect(damagee.getLocation(), Effect.SMOKE, 5);
//Location //Location
Location target = null; Location target;
if (damagee.isSneaking()) target = FindLocationBack(damager, damagee); if (damagee.isSneaking())
else target = FindLocationBehind(damager, damagee); {
target = FindLocationBack(damager, damagee);
}
else
{
target = FindLocationBehind(damager, damagee);
}
if (target == null) if (target == null)
return; return;
//Effect //Effect
UtilParticle.PlayParticle(ParticleType.LARGE_SMOKE, damagee.getLocation(), UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, damagee.getLocation(), (float)(Math.random() - 0.5), (float)(Math.random() * 1.4), (float)(Math.random() - 0.5), 0, 10, ViewDist.NORMAL);
(float)(Math.random() - 0.5), (float)(Math.random() * 1.4), (float)(Math.random() - 0.5), 0, 10,
ViewDist.NORMAL, UtilServer.getPlayers());
//Action //Action
damagee.teleport(target); damagee.teleport(target);
//Cloak //Cloak
if (damagee.isSneaking()) if (damagee.isSneaking())
{
Factory.Condition().Factory().Cloak(GetName(), damagee, damagee, 0.1, false, false); Factory.Condition().Factory().Cloak(GetName(), damagee, damagee, 0.1, false, false);
}
//Invul/Cloak event.SetCancelled("Evaded");
Factory.Condition().Factory().Invulnerable(GetName(), damagee, damagee, 0.5, false, false);
//Inform //Inform
UtilPlayer.message(damagee, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + ".")); UtilPlayer.message(damagee, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + "."));
UtilPlayer.message(damager, F.main(GetClassType().name(), F.name(damagee.getName()) +" used " + F.skill(GetName(level)) + ".")); UtilPlayer.message(damager, F.main(GetClassType().name(), F.name(damagee.getName()) +" used " + F.skill(GetName(level)) + "."));
Recharge.Instance.useForce(damagee, GetName(), 250, true);
} }
private Location FindLocationBehind(LivingEntity damager, Player damagee) private Location FindLocationBehind(LivingEntity damager, Player damagee)
@ -218,7 +226,7 @@ public class Evade extends SkillActive
{ {
activeIter.remove(); activeIter.remove();
UtilPlayer.message(player, F.main(GetClassType().name(), "You failed to " + F.skill(GetName()) + ".")); UtilPlayer.message(player, F.main(GetClassType().name(), "You failed to " + F.skill(GetName()) + "."));
Recharge.Instance.useForce(player, GetName(), 10000l, true); Recharge.Instance.useForce(player, GetName(), 16000, true);
} }
} }
} }

View File

@ -3,6 +3,9 @@ package mineplex.minecraft.game.classcombat.Skill.Assassin;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import net.minecraft.server.v1_8_R3.AxisAlignedBB;
import net.minecraft.server.v1_8_R3.Entity;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -17,25 +20,25 @@ import org.bukkit.util.Vector;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.classcombat.Skill.SkillActive; import mineplex.minecraft.game.classcombat.Skill.SkillActive;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.classcombat.Skill.event.SkillTeleportEvent; import mineplex.minecraft.game.classcombat.Skill.event.SkillTeleportEvent;
import net.minecraft.server.v1_8_R3.AxisAlignedBB;
import net.minecraft.server.v1_8_R3.Entity;
public class Flash extends SkillActive public class Flash extends SkillActive
{ {
private Map<Player, Integer> _flash = new HashMap<>();
private boolean _allowTrapping = false; private final Map<Player, Integer> _flash = new HashMap<>();
private boolean _allowTrapping = false, _startWithCharges = true;
public Flash(SkillFactory skills, String name, ClassType classType, SkillType skillType, public Flash(SkillFactory skills, String name, ClassType classType, SkillType skillType,
int cost, int levels, int cost, int levels,
@ -62,7 +65,7 @@ public class Flash extends SkillActive
@Override @Override
public String GetRechargeString() public String GetRechargeString()
{ {
return "Recharge: #8#-1 Seconds per Charge"; return "Recharge: 4 Seconds per Charge";
} }
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@ -75,7 +78,7 @@ public class Flash extends SkillActive
return false; return false;
} }
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) if (UtilEnt.isInWater(player))
{ {
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false; return false;
@ -89,7 +92,9 @@ public class Flash extends SkillActive
if (teleportEvent.isCancelled()) return false; // Teleport cancelled if (teleportEvent.isCancelled()) return false; // Teleport cancelled
//No Flash //No Flash
if (!_flash.containsKey(player) || _flash.get(player) == 0) _flash.putIfAbsent(player, _startWithCharges ? 1 + level : 1);
if (_flash.get(player) == 0)
{ {
UtilPlayer.message(player, F.main("Skill", "You have no " + F.skill(GetName() + " Charges") + ".")); UtilPlayer.message(player, F.main("Skill", "You have no " + F.skill(GetName() + " Charges") + "."));
return false; return false;
@ -101,29 +106,27 @@ public class Flash extends SkillActive
@EventHandler @EventHandler
public void recharge(UpdateEvent event) public void recharge(UpdateEvent event)
{ {
for (Player cur : GetUsers()) if (event.getType() != UpdateType.TICK)
{ {
if (!_flash.containsKey(cur)) return;
{
_flash.put(cur, 0);
} }
else
_flash.entrySet().forEach(entry ->
{ {
int charges = _flash.get(cur); Player cur = entry.getKey();
int charges = entry.getValue();
int level = getLevel(cur); int level = getLevel(cur);
if (charges >= 1 + level) if (charges >= 1 + level || !Recharge.Instance.use(cur, "Flash Recharge", 4000, false, false))
continue; {
return;
}
if (!Recharge.Instance.use(cur, "Flash Recharge", 8000 - (1000 * level), false, false)) entry.setValue(charges + 1);
continue;
_flash.put(cur, charges + 1);
//Inform //Inform
UtilPlayer.message(cur, F.main(GetClassType().name(), "Flash Charges: " + F.elem((charges + 1) + ""))); UtilPlayer.message(cur, F.main(GetClassType().name(), "Flash Charges: " + F.elem((charges + 1) + "")));
} });
}
} }
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@ -139,15 +142,16 @@ public class Flash extends SkillActive
UtilPlayer.message(player, F.main(GetClassType().name(), "Flash Charges: " + F.elem(_flash.get(player) + ""))); UtilPlayer.message(player, F.main(GetClassType().name(), "Flash Charges: " + F.elem(_flash.get(player) + "")));
Location start = player.getLocation().add(new Vector(0, 0.2, 0)); Location start = player.getLocation().add(new Vector(0, 0.2, 0));
Location test = null; Location test;
Location end = start.clone(); Location end = start.clone();
Vector dir = player.getLocation().getDirection(); Vector dir = player.getLocation().getDirection();
AxisAlignedBB box = null; AxisAlignedBB box;
Entity ent = ((CraftEntity) player).getHandle(); Entity ent = ((CraftEntity) player).getHandle();
double maxRange = getMaxRange(player); double maxRange = getMaxRange(player);
double range = 0; double range = 0;
rangeLoop: while (range <= maxRange) rangeLoop:
while (range <= maxRange)
{ {
test = start.clone().add(dir.clone().multiply(range)); test = start.clone().add(dir.clone().multiply(range));
float halfWidth = ent.width / 2; float halfWidth = ent.width / 2;
@ -187,8 +191,7 @@ public class Flash extends SkillActive
range += 0.1; range += 0.1;
end = test.clone(); end = test.clone();
//Smoke Trail //Smoke Trail
UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, end.clone().add(0, 0.5, 0), 0, 0, 0, 0, 1, UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, end.clone().add(0, 0.5, 0), 0, 0, 0, 0, 1, ViewDist.LONG);
ViewDist.LONGER, UtilServer.getPlayers());
} }
if (range > 0) if (range > 0)
@ -219,13 +222,13 @@ public class Flash extends SkillActive
return player.getLocation().add(player.getLocation().getDirection().multiply(range).add(new Vector(0, 0.4, 0))); return player.getLocation().add(player.getLocation().getDirection().multiply(range).add(new Vector(0, 0.4, 0)));
} }
public boolean isAllowTrapping()
{
return _allowTrapping;
}
public void setAllowTrapping(boolean allowTrapping) public void setAllowTrapping(boolean allowTrapping)
{ {
_allowTrapping = allowTrapping; _allowTrapping = allowTrapping;
} }
public void setStartWithCharges(boolean startWithCharges)
{
_startWithCharges = startWithCharges;
}
} }

View File

@ -7,7 +7,6 @@ import java.util.UUID;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton; import org.bukkit.entity.Skeleton;
@ -17,20 +16,23 @@ import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import com.mojang.authlib.GameProfile;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.core.disguise.disguises.DisguisePlayer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.utils.UtilGameProfile;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.classcombat.Skill.SkillActive; import mineplex.minecraft.game.classcombat.Skill.SkillActive;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.classcombat.event.ClassCombatCreatureAllowSpawnEvent; import mineplex.minecraft.game.classcombat.event.ClassCombatCreatureAllowSpawnEvent;
@ -75,7 +77,7 @@ public class Illusion extends SkillActive
@Override @Override
public boolean CustomCheck(Player player, int level) public boolean CustomCheck(Player player, int level)
{ {
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) if (UtilEnt.isInWater(player))
{ {
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false; return false;
@ -115,11 +117,21 @@ public class Illusion extends SkillActive
inRange.add(other.getUniqueId()); inRange.add(other.getUniqueId());
//Disguise //Disguise
DisguisePlayer disguise = new DisguisePlayer(skel, ((CraftPlayer)player).getHandle().getProfile()); GameProfile profile = UtilGameProfile.getGameProfile(player);
try
{
UtilGameProfile.changeId(profile, UUID.randomUUID());
DisguisePlayer disguise = new DisguisePlayer(skel, profile);
Factory.Disguise().disguise(disguise, attempted -> inRange.contains(attempted.getUniqueId())); Factory.Disguise().disguise(disguise, attempted -> inRange.contains(attempted.getUniqueId()));
}
catch (ReflectiveOperationException ex)
{
ex.printStackTrace();
}
//Invis //Invis
Factory.Condition().Factory().Cloak(GetName(), player, player, 2 + 1*level, false, true); Factory.Condition().Factory().untrueCloak(GetName(), player, player, 2 + 1*level, false);
_active.put(player, skel); _active.put(player, skel);
@ -140,7 +152,7 @@ public class Illusion extends SkillActive
Skeleton skel = _active.get(cur); Skeleton skel = _active.get(cur);
if (Factory.Condition().GetActiveCondition(cur, ConditionType.CLOAK) == null || if (Factory.Condition().GetActiveCondition(cur, ConditionType.UNTRUE_CLOAK) == null ||
!UtilPlayer.isBlocking(cur) || !UtilPlayer.isBlocking(cur) ||
//!Factory.Energy().Use(cur, getName(), 0.625 - (getLevel(cur) * 0.025), true, true) || //!Factory.Energy().Use(cur, getName(), 0.625 - (getLevel(cur) * 0.025), true, true) ||
skel == null || skel == null ||
@ -191,6 +203,11 @@ public class Illusion extends SkillActive
if (cur.equals(player)) if (cur.equals(player))
continue; continue;
if (cur instanceof Player && !Factory.Relation().canHurt(player, (Player)cur))
{
continue;
}
//Condition //Condition
Factory.Condition().Factory().Slow(GetName(), cur, player, 4 * targets.get(cur), 1, false, false, false, false); Factory.Condition().Factory().Slow(GetName(), cur, player, 4 * targets.get(cur), 1, false, false, false, false);
} }

View File

@ -5,19 +5,24 @@ import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.recharge.Recharge;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.classcombat.Skill.SkillActive; import mineplex.minecraft.game.classcombat.Skill.SkillActive;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class Leap extends SkillActive public class Leap extends SkillActive
{ {
@ -41,7 +46,8 @@ public class Leap extends SkillActive
"", "",
"Wall Kick by using Leap with your", "Wall Kick by using Leap with your",
"back against a wall. This doesn't", "back against a wall. This doesn't",
"trigger Leaps Recharge.", "trigger Leaps Recharge but has a cooldown",
"of 1.5 seconds.",
"", "",
"Cannot be used while Slowed." "Cannot be used while Slowed."
}); });
@ -50,7 +56,7 @@ public class Leap extends SkillActive
@Override @Override
public boolean CustomCheck(Player player, int level) public boolean CustomCheck(Player player, int level)
{ {
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) if (UtilEnt.isInWater(player))
{ {
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false; return false;
@ -108,7 +114,7 @@ public class Leap extends SkillActive
if (level == 0) return false; if (level == 0) return false;
//Recharge & Energy //Recharge & Energy
if (!mineplex.core.recharge.Recharge.Instance.use(player, "Wall Kick", 1500, false, false)) if (!Recharge.Instance.use(player, "Wall Kick", 1500, false, false))
return false; return false;
//Direction //Direction
@ -181,6 +187,24 @@ public class Leap extends SkillActive
return false; return false;
} }
@EventHandler(priority = EventPriority.HIGH)
public void Damage(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
if (event.GetCause() != DamageCause.FALL)
return;
Player player = event.GetDamageePlayer();
if (player == null) return;
int level = getLevel(player);
if (level == 0) return;
event.AddMod(null, GetName(), -2, false);
}
@Override @Override
public void Reset(Player player) public void Reset(Player player)
{ {

View File

@ -1,8 +1,7 @@
package mineplex.minecraft.game.classcombat.Skill.Assassin; package mineplex.minecraft.game.classcombat.Skill.Assassin;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.Map;
import java.util.Iterator;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
@ -14,29 +13,28 @@ import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.classcombat.Skill.SkillActive; import mineplex.minecraft.game.classcombat.Skill.SkillActive;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class MarkedForDeath extends SkillActive public class MarkedForDeath extends SkillActive
{ {
private HashSet<Entity> _arrows = new HashSet<Entity>();
private HashSet<Player> _active = new HashSet<Player>(); private final Map<Player, MarkedData> _data = new HashMap<>();
private HashMap<LivingEntity, Long> _markedTime = new HashMap<LivingEntity, Long>();
private HashMap<LivingEntity, Double> _markedDamage = new HashMap<LivingEntity, Double>();
public MarkedForDeath(SkillFactory skills, String name, ClassType classType, SkillType skillType, public MarkedForDeath(SkillFactory skills, String name, ClassType classType, SkillType skillType,
int cost, int levels, int cost, int levels,
@ -65,7 +63,7 @@ public class MarkedForDeath extends SkillActive
@Override @Override
public boolean CustomCheck(Player player, int level) public boolean CustomCheck(Player player, int level)
{ {
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) if (UtilEnt.isInWater(player))
{ {
UtilPlayer.message(player, F.main(GetClassType().name(), "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main(GetClassType().name(), "You cannot use " + F.skill(GetName()) + " in water."));
return false; return false;
@ -77,8 +75,7 @@ public class MarkedForDeath extends SkillActive
@Override @Override
public void Skill(Player player, int level) public void Skill(Player player, int level)
{ {
//Action _data.put(player, new MarkedData(player));
_active.add(player);
//Inform //Inform
UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + ".")); UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + "."));
@ -90,47 +87,49 @@ public class MarkedForDeath extends SkillActive
@EventHandler @EventHandler
public void ShootBow(EntityShootBowEvent event) public void ShootBow(EntityShootBowEvent event)
{ {
if (!(event.getEntity() instanceof Player)) if (!(event.getEntity() instanceof Player) || !(event.getProjectile() instanceof Arrow))
return; {
if (!(event.getProjectile() instanceof Arrow))
return; return;
}
Player player = (Player) event.getEntity(); Player player = (Player) event.getEntity();
MarkedData data = _data.get(player);
if (!_active.remove(player)) if (data == null || data.Arrow != null)
{
return; return;
}
//Inform //Inform
UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(getLevel(player))) + ".")); UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(getLevel(player))) + "."));
data.Arrow = event.getProjectile();
_arrows.add(event.getProjectile());
} }
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
public void DamageMark(CustomDamageEvent event) public void DamageMark(CustomDamageEvent event)
{ {
if (event.IsCancelled()) if (event.IsCancelled())
{
return; return;
}
if (event.GetCause() != DamageCause.PROJECTILE)
return;
Projectile projectile = event.GetProjectile(); Projectile projectile = event.GetProjectile();
if (projectile == null) return;
if (!_arrows.contains((Entity)projectile)) if (projectile == null)
{
return; return;
}
LivingEntity damagee = event.GetDamageeEntity();
if (damagee == null) return;
Player damager = event.GetDamagerPlayer(true); Player damager = event.GetDamagerPlayer(true);
if (damager == null) return; MarkedData data = _data.get(damager);
//Level
int level = getLevel(damager); int level = getLevel(damager);
if (level == 0) return;
if (damager == null || data == null || level == 0 || !projectile.equals(data.Arrow))
{
return;
}
LivingEntity damagee = event.GetDamageeEntity();
//Effect //Effect
damagee.getWorld().playSound(damagee.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f); damagee.getWorld().playSound(damagee.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f);
@ -140,8 +139,9 @@ public class MarkedForDeath extends SkillActive
UtilPlayer.message(damager, F.main(GetClassType().name(), "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(GetName(level)) + ".")); UtilPlayer.message(damager, F.main(GetClassType().name(), "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(GetName(level)) + "."));
//Mark //Mark
_markedTime.put(damagee, System.currentTimeMillis() + (3000 + 1000 * level)); data.Timeout = System.currentTimeMillis() + (3000 + 1000 * level);
_markedDamage.put(damagee, 2.5 + 1.5 * level); data.Damage = 2.5 + 1.5 * level;
data.Marked = damagee;
//Remove //Remove
projectile.remove(); projectile.remove();
@ -150,84 +150,89 @@ public class MarkedForDeath extends SkillActive
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
public void DamageAmplify(CustomDamageEvent event) public void DamageAmplify(CustomDamageEvent event)
{ {
if (event.IsCancelled()) if (event.IsCancelled() || event.GetCause() != DamageCause.ENTITY_ATTACK)
{
return; return;
}
if (event.GetCause() != DamageCause.ENTITY_ATTACK) Player damager = event.GetDamagerPlayer(false);
if (damager == null)
{
return; return;
}
LivingEntity damagee = event.GetDamageeEntity(); MarkedData data = _data.get(damager);
if (damagee == null) return;
if (!_markedTime.containsKey(damagee) || !_markedDamage.containsKey(damagee)) if (data == null || !event.GetDamageeEntity().equals(data.Marked) || data.isExpired())
{
return; return;
}
long time = _markedTime.remove(damagee); _data.remove(damager);
double damage = _markedDamage.remove(damagee); event.AddMod(GetName(), GetName(), data.Damage, true);
}
if (System.currentTimeMillis() > time) @EventHandler
public void playerDeath(PlayerDeathEvent event)
{
Player killed = event.getEntity(), killer = killed.getKiller();
MarkedData data = _data.get(killer);
if (data == null || !killed.equals(data.Marked))
{
return; return;
}
event.AddMod(GetName(), GetName(), damage, true); UtilPlayer.health(killer, 2 + getLevel(killer));
} }
@EventHandler @EventHandler
public void Particle(UpdateEvent event) public void Particle(UpdateEvent event)
{ {
if (event.getType() != UpdateType.TICK) if (event.getType() != UpdateType.TICK)
{
return; return;
for (Entity ent : _arrows)
{
UtilParticle.PlayParticle(ParticleType.MOB_SPELL, ent.getLocation(), 0, 0, 0, 0, 1,
ViewDist.MAX, UtilServer.getPlayers());
}
} }
@EventHandler _data.values().forEach(data ->
public void Clean(UpdateEvent event)
{ {
if (event.getType() != UpdateType.SEC) if (data.Arrow != null && data.Arrow.isValid())
return;
for (Iterator<Entity> arrowIterator = _arrows.iterator(); arrowIterator.hasNext();)
{ {
Entity arrow = arrowIterator.next(); UtilParticle.PlayParticleToAll(ParticleType.MOB_SPELL, data.Arrow.getLocation(), null, 0, 1, ViewDist.LONG);
if (arrow.isDead() || !arrow.isValid() || arrow.isOnGround())
arrowIterator.remove();
}
for (Iterator<Player> activeIterator = _active.iterator(); activeIterator.hasNext();)
{
Player player = activeIterator.next();
if (!player.isOnline())
activeIterator.remove();
}
for (Iterator<LivingEntity> markedTimeIterator = _markedTime.keySet().iterator(); markedTimeIterator.hasNext();)
{
LivingEntity markedTime = markedTimeIterator.next();
if (markedTime.isDead() || !markedTime.isValid())
markedTimeIterator.remove();
}
for (Iterator<LivingEntity> markedDamageIterator = _markedDamage.keySet().iterator(); markedDamageIterator.hasNext();)
{
LivingEntity markedDamage = markedDamageIterator.next();
if (markedDamage.isDead() || !markedDamage.isValid())
markedDamageIterator.remove();
} }
});
} }
@Override @Override
public void Reset(Player player) public void Reset(Player player)
{ {
_active.remove(player); _data.remove(player);
_markedTime.remove(player); }
_markedDamage.remove(player);
@EventHandler
public void playerQuit(PlayerQuitEvent event)
{
Reset(event.getPlayer());
}
private class MarkedData
{
final Player Shooter;
LivingEntity Marked;
Entity Arrow;
double Damage;
long Timeout;
MarkedData(Player shooter)
{
Shooter = shooter;
}
boolean isExpired()
{
return Timeout > 0 && System.currentTimeMillis() > Timeout;
}
} }
} }

View File

@ -2,26 +2,25 @@ package mineplex.minecraft.game.classcombat.Skill.Assassin;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.Map;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftInventoryCrafting;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.potion.PotionEffectType;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
@ -32,8 +31,10 @@ import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
public class Recall extends Skill public class Recall extends Skill
{ {
private HashMap<Player, LinkedList<Location>> _locMap = new HashMap<Player, LinkedList<Location>>();
private HashMap<Player, LinkedList<Double>> _healthMap = new HashMap<Player, LinkedList<Double>>(); private final Map<Player, LinkedList<Location>> _mainLocMap = new HashMap<>();
private final Map<Player, LinkedList<Location>> _secondaryLocMap = new HashMap<>();
private final Map<Player, LinkedList<Double>> _secondaryHealthMap = new HashMap<>();
public Recall(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) public Recall(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels)
{ {
@ -43,16 +44,21 @@ public class Recall extends Skill
{ {
"Drop Axe/Sword to Use.", "Drop Axe/Sword to Use.",
"", "",
"Go back in time #2#2 seconds,", "Go back in time #3#1 seconds,",
"restoring your location and", "restoring your location and",
"up to #3#1 health." "regeneration 3 for #2#+1 seconds",
"Cannot be used while Slowed.",
"",
"Hold shift when using to go",
"back 2 seconds, restoring your",
"location and up to #1.5#0.5 health.",
}); });
} }
@Override @Override
public String GetRechargeString() public String GetRechargeString()
{ {
return "Recharge: #60#-10 Seconds"; return "Recharge: #35#-5 Seconds";
} }
@EventHandler @EventHandler
@ -69,9 +75,17 @@ public class Recall extends Skill
event.setCancelled(true); event.setCancelled(true);
if (UtilBlock.water(player.getLocation().getBlock())) boolean secondary = player.isSneaking();
if (!secondary && player.hasPotionEffect(PotionEffectType.SLOW))
{ {
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " while Slowed."));
return;
}
if (UtilEnt.isInWater(player))
{
player.sendMessage(F.main("Skill", "You cannot use " + F.skill(GetName()) +" while in water."));
return; return;
} }
@ -82,29 +96,34 @@ public class Recall extends Skill
if (trigger.IsCancelled()) if (trigger.IsCancelled())
return; return;
if (!Recharge.Instance.use(player, GetName(), GetName(level), 60000 - (level * 10000), true, false)) if (!Recharge.Instance.use(player, GetName(), GetName(level), secondary ? 18000 - (level * 2000) : 35000 - (level * 5000), true, false))
return; return;
LinkedList<Location> locs = _locMap.remove(player); LinkedList<Location> locs = secondary ? _secondaryLocMap.remove(player) : _mainLocMap.remove(player);
if (locs == null) if (locs == null)
return; return;
LinkedList<Double> health = _healthMap.remove(player); LinkedList<Double> health = _secondaryHealthMap.remove(player);
if (health == null) if (health == null)
return; return;
Factory.runSync(() -> { Factory.runSync(() ->
if (player.isDead()) {
if (player.isDead() || !player.getWorld().equals(locs.getLast().getWorld()))
{ {
return; return;
} }
if (!player.getWorld().equals(locs.getLast().getWorld()))
if (secondary)
{ {
return;
}
//Heal //Heal
double newHealth = Math.min(health.getLast(), player.getHealth() + 3 + level); double newHealth = Math.min(health.getLast(), player.getHealth() + 1.5 + (level / 2D));
player.setHealth(newHealth); player.setHealth(newHealth);
}
else
{
Factory.Condition().Factory().Regen(GetName(), player, player, 1 + level, 2, false, true, false);
}
//Effect //Effect
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f); player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f);
@ -116,21 +135,19 @@ public class Recall extends Skill
player.teleport(target); player.teleport(target);
//Inform //Inform
UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + ".")); UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill((secondary ? "Secondary " : "") + GetName(level)) + "."));
//Effect //Effect
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f); player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f);
while (UtilMath.offset(current, target) > 0.5) while (UtilMath.offsetSquared(current, target) > 0.25)
{ {
UtilParticle.PlayParticle(ParticleType.WITCH_MAGIC, current, 0, 1f, 0, 0, 1, UtilParticle.PlayParticleToAll(ParticleType.WITCH_MAGIC, current, 0, 1f, 0, 0, 1, ViewDist.LONG);
ViewDist.LONGER, UtilServer.getPlayers());
current = current.add(UtilAlg.getTrajectory(current, target).multiply(0.1)); current = current.add(UtilAlg.getTrajectory(current, target).multiply(0.1));
} }
}); });
} }
@EventHandler @EventHandler
public void storeLocation(UpdateEvent event) public void storeLocation(UpdateEvent event)
{ {
@ -139,32 +156,39 @@ public class Recall extends Skill
for (Player cur : GetUsers()) for (Player cur : GetUsers())
{ {
//Create
if (!_locMap.containsKey(cur))
_locMap.put(cur, new LinkedList<Location>());
if (!_healthMap.containsKey(cur))
_healthMap.put(cur, new LinkedList<Double>());
//Store //Store
_locMap.get(cur).addFirst(cur.getLocation()); _mainLocMap.computeIfAbsent(cur, (key) -> new LinkedList<>()).addFirst(cur.getLocation());
_healthMap.get(cur).addFirst(cur.getHealth()); _secondaryLocMap.computeIfAbsent(cur, (key) -> new LinkedList<>()).addFirst(cur.getLocation());
_secondaryHealthMap.computeIfAbsent(cur, (key) -> new LinkedList<>()).addFirst(cur.getHealth());
int level = getLevel(cur); int level = getLevel(cur);
//Cull long maxMainSize = (3 + level) * 20;
if (_locMap.get(cur).size() > (2 + 2 * level) * 20) long maxSecondarySize = 2 * 20;
_locMap.get(cur).removeLast();
if (_healthMap.get(cur).size() > (2 + 2 * level) * 20) //Cull
_healthMap.get(cur).removeLast(); if (_mainLocMap.get(cur).size() > maxMainSize)
{
_mainLocMap.get(cur).removeLast();
}
if (_secondaryLocMap.get(cur).size() > maxSecondarySize)
{
_secondaryLocMap.get(cur).removeLast();
}
if (_secondaryHealthMap.get(cur).size() > maxSecondarySize)
{
_secondaryHealthMap.get(cur).removeLast();
}
} }
} }
@Override @Override
public void Reset(Player player) public void Reset(Player player)
{ {
_locMap.remove(player); _mainLocMap.remove(player);
_healthMap.remove(player); _secondaryLocMap.remove(player);
_secondaryHealthMap.remove(player);
} }
} }

View File

@ -1,5 +1,8 @@
package mineplex.minecraft.game.classcombat.Skill.Assassin; package mineplex.minecraft.game.classcombat.Skill.Assassin;
import java.util.Map;
import java.util.WeakHashMap;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -7,13 +10,17 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilGear;
import mineplex.core.recharge.Recharge;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.minecraft.game.classcombat.Skill.Skill; import mineplex.minecraft.game.classcombat.Skill.Skill;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class ShockingStrikes extends Skill public class ShockingStrikes extends Skill
{ {
private final Map<Player, ComboData> _combos = new WeakHashMap<>();
public ShockingStrikes(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) public ShockingStrikes(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);
@ -21,8 +28,10 @@ public class ShockingStrikes extends Skill
SetDesc(new String[] SetDesc(new String[]
{ {
"Your attacks shock targets for", "Your attacks shock targets for",
"#0#1 seconds, giving them Slow 1 and", "#0#1 seconds, giving them:",
"Screen-Shake." "Slow 1: Every third hit",
"Blindness: Every #6#-1 seconds",
"Screen-Shake: Every time",
}); });
} }
@ -47,17 +56,49 @@ public class ShockingStrikes extends Skill
LivingEntity damagee = event.GetDamageeEntity(); LivingEntity damagee = event.GetDamageeEntity();
if (damagee == null) return; if (damagee == null) return;
//Confuse ComboData data = _combos.get(damager);
if (data == null || data.Amount > 0 && !damagee.equals(data.Damagee))
{
data = new ComboData(damagee);
_combos.put(damager, data);
}
data.Amount++;
Factory.Condition().Factory().Shock(GetName(), damagee, damager, level, false, false); Factory.Condition().Factory().Shock(GetName(), damagee, damager, level, false, false);
if (data.Amount % 3 == 0)
{
Factory.Condition().Factory().Slow(GetName(), damagee, damager, level, 0, false, false, true, false); Factory.Condition().Factory().Slow(GetName(), damagee, damager, level, 0, false, false, true, false);
}
//Damage //Damage
event.AddMod(damager.getName(), GetName(), 0, true); event.AddMod(damager.getName(), GetName(), 0, true);
String name = "Blinding Strike";
if (Recharge.Instance.use(damager, name, name + " " + level, 6000 + (1000 * level), false, false))
{
Factory.Condition().Factory().Blind(name, damagee, damager, level, 1, true, true, false);
}
} }
@Override @Override
public void Reset(Player player) public void Reset(Player player)
{ {
_combos.remove(player);
}
private class ComboData
{
final LivingEntity Damagee;
int Amount;
ComboData(LivingEntity damagee)
{
Damagee = damagee;
}
} }
} }

View File

@ -2,6 +2,7 @@ package mineplex.minecraft.game.classcombat.Skill.Assassin;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.Set;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
@ -32,8 +33,9 @@ import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
public class SilencingArrow extends SkillActive public class SilencingArrow extends SkillActive
{ {
private HashSet<Entity> _arrows = new HashSet<Entity>();
private HashSet<Player> _silence = new HashSet<Player>(); private final Set<Entity> _arrows = new HashSet<>();
private final Set<Player> _silence = new HashSet<>();
public SilencingArrow(SkillFactory skills, String name, ClassType classType, SkillType skillType, public SilencingArrow(SkillFactory skills, String name, ClassType classType, SkillType skillType,
int cost, int levels, int cost, int levels,
@ -52,7 +54,7 @@ public class SilencingArrow extends SkillActive
SetDesc(new String[] SetDesc(new String[]
{ {
"Your next arrow will Silence", "Your next arrow will Silence",
"target for #2#2 seconds.", "target for 3 seconds.",
"", "",
"Silence stops skills being used." "Silence stops skills being used."
}); });
@ -61,7 +63,7 @@ public class SilencingArrow extends SkillActive
@Override @Override
public boolean CustomCheck(Player player, int level) public boolean CustomCheck(Player player, int level)
{ {
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) if (UtilEnt.isInWater(player))
{ {
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false; return false;
@ -129,7 +131,7 @@ public class SilencingArrow extends SkillActive
if (level == 0) return; if (level == 0) return;
//Confuse //Confuse
Factory.Condition().Factory().Silence(GetName(), damagee, damager, 2 + 2*level, true, true); Factory.Condition().Factory().Silence(GetName(), damagee, damager, 3, true, true);
//Effect //Effect
damagee.getWorld().playSound(damagee.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f); damagee.getWorld().playSound(damagee.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f);

View File

@ -59,7 +59,7 @@ public class SmokeArrow extends SkillActive
@Override @Override
public boolean CustomCheck(Player player, int level) public boolean CustomCheck(Player player, int level)
{ {
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) if (UtilEnt.isInWater(player))
{ {
UtilPlayer.message(player, F.main(GetClassType().name(), "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main(GetClassType().name(), "You cannot use " + F.skill(GetName()) + " in water."));
return false; return false;

View File

@ -1,24 +1,5 @@
package mineplex.minecraft.game.classcombat.Skill.Assassin; package mineplex.minecraft.game.classcombat.Skill.Assassin;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import net.minecraft.server.v1_8_R3.Material;
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.UtilGear;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.condition.Condition;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
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.Bukkit;
import org.bukkit.Effect; import org.bukkit.Effect;
import org.bukkit.Sound; import org.bukkit.Sound;
@ -30,6 +11,24 @@ import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
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 mineplex.minecraft.game.classcombat.Skill.Skill;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
import mineplex.minecraft.game.core.condition.Condition;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class SmokeBomb extends Skill public class SmokeBomb extends Skill
{ {
public SmokeBomb(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) public SmokeBomb(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels)
@ -42,7 +41,7 @@ public class SmokeBomb extends Skill
"", "",
"Create a smokey explosion, giving", "Create a smokey explosion, giving",
"Blindness to players within #2#1 Blocks", "Blindness to players within #2#1 Blocks",
"for #1#2 seconds.", "for #1#1 seconds.",
"", "",
"You go invisible for #1#2 seconds." "You go invisible for #1#2 seconds."
}); });
@ -51,7 +50,7 @@ public class SmokeBomb extends Skill
@Override @Override
public String GetRechargeString() public String GetRechargeString()
{ {
return "Recharge: #60#-10 Seconds"; return "Recharge: #45#-5 Seconds";
} }
@EventHandler @EventHandler
@ -79,26 +78,29 @@ public class SmokeBomb extends Skill
if (trigger.IsCancelled()) if (trigger.IsCancelled())
return; return;
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) if (UtilEnt.isInWater(player))
{ {
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return; return;
} }
if (!Recharge.Instance.use(player, GetName(), GetName(level), 60000 - (level * 10000), true, false)) if (!Recharge.Instance.use(player, GetName(), GetName(level), 45000 - (level * 5000), true, false))
return; return;
//Action //Action
Factory.Condition().Factory().Cloak(GetName(), player, player, 1 + 2 * level, false, true); Factory.Condition().Factory().untrueCloak(GetName(), player, player, 1 + level * 2, false);
//Effect //Effect
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, player.getLocation(), 0, 0, 0, 0, 1, UtilParticle.PlayParticleToAll(ParticleType.HUGE_EXPLOSION, player.getLocation(), 0, 0, 0, 0, 1, ViewDist.LONG);
ViewDist.MAX, UtilServer.getPlayers());
for (Player other : UtilPlayer.getNearby(player.getLocation(), 2 + level)) for (Player other : UtilPlayer.getNearby(player.getLocation(), 2 + level))
{ {
if (!other.equals(player)) if (other.equals(player) || !Factory.Relation().canHurt(player, other))
Factory.Condition().Factory().Blind(GetName(), other, player, 1 + 2 * level, 0, false, false, false); {
continue;
}
Factory.Condition().Factory().Blind(GetName(), other, player, 1 + level, 0, false, false, false);
} }
for (int i=0 ; i<3 ; i++) for (int i=0 ; i<3 ; i++)
@ -108,11 +110,13 @@ public class SmokeBomb extends Skill
UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + ".")); UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + "."));
} }
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.MONITOR)
public void EndDamagee(CustomDamageEvent event) public void EndDamagee(CustomDamageEvent event)
{ {
if (event.IsCancelled()) if (event.IsCancelled())
{
return; return;
}
Player damagee = event.GetDamageePlayer(); Player damagee = event.GetDamageePlayer();
if (damagee == null) return; if (damagee == null) return;
@ -120,6 +124,9 @@ public class SmokeBomb extends Skill
if (getLevel(damagee) == 0) if (getLevel(damagee) == 0)
return; return;
if (event.GetDamage() <= 0)
return;
//End //End
Factory.Condition().EndCondition(damagee, null, GetName()); Factory.Condition().EndCondition(damagee, null, GetName());
} }
@ -169,7 +176,7 @@ public class SmokeBomb extends Skill
for (Player cur : GetUsers()) for (Player cur : GetUsers())
{ {
Condition cond = Factory.Condition().GetActiveCondition(cur, ConditionType.CLOAK); Condition cond = Factory.Condition().GetActiveCondition(cur, ConditionType.UNTRUE_CLOAK);
if (cond == null) continue; if (cond == null) continue;
if (!cond.GetReason().equals(GetName())) if (!cond.GetReason().equals(GetName()))

View File

@ -25,7 +25,7 @@ public class ViperStrikes extends Skill
{ {
"Your attacks give", "Your attacks give",
"enemies Poison 1", "enemies Poison 1",
"for #0#1 seconds." "for #2#2 seconds."
}); });
} }
@ -50,8 +50,8 @@ public class ViperStrikes extends Skill
LivingEntity damagee = event.GetDamageeEntity(); LivingEntity damagee = event.GetDamageeEntity();
if (damagee == null) return; if (damagee == null) return;
Factory.Damage().NewDamageEvent(damagee, damager, null, DamageCause.POISON, 0, false, true, true, damager.getName(), GetName()); Factory.Damage().NewDamageEvent(damagee, damager, null, DamageCause.CUSTOM, 0, false, true, true, damager.getName(), GetName());
damagee.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 20 * (2 + level), 0)); damagee.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 20 * (2 + (2 * level)), 0));
//Sound //Sound
damager.getWorld().playSound(damager.getLocation(), Sound.SPIDER_IDLE, 1f, 2f); damager.getWorld().playSound(damager.getLocation(), Sound.SPIDER_IDLE, 1f, 2f);

View File

@ -96,7 +96,7 @@ public class BlockToss extends SkillCharge implements IThrown
@Override @Override
public String GetRechargeString() public String GetRechargeString()
{ {
return "Recharge: " + "#5.5#-0.5 Seconds"; return "Recharge: " + "1.5 Seconds";
} }
@EventHandler @EventHandler
@ -129,7 +129,7 @@ public class BlockToss extends SkillCharge implements IThrown
return; return;
//Water //Water
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) if (UtilEnt.isInWater(player))
{ {
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return; return;
@ -245,7 +245,7 @@ public class BlockToss extends SkillCharge implements IThrown
} }
//Throw //Throw
if (!cur.isBlocking() || (_charge.containsKey(cur) && _charge.get(cur) >= 1)) if (!cur.isBlocking())
throwSet.add(cur); throwSet.add(cur);
//Charged Tick //Charged Tick
@ -262,7 +262,7 @@ public class BlockToss extends SkillCharge implements IThrown
for (Player cur : throwSet) for (Player cur : throwSet)
{ {
Recharge.Instance.recharge(cur, GetName()); Recharge.Instance.recharge(cur, GetName());
Recharge.Instance.use(cur, GetName(), 5500 - (500 * getLevel(cur)), false, true); Recharge.Instance.use(cur, GetName(), 1500, false, true);
FallingBlock block = _holding.remove(cur); FallingBlock block = _holding.remove(cur);
float charge = _charge.remove(cur); float charge = _charge.remove(cur);

View File

@ -1,5 +1,6 @@
package mineplex.minecraft.game.classcombat.Skill.Brute; package mineplex.minecraft.game.classcombat.Skill.Brute;
import java.util.Map;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import org.bukkit.Sound; import org.bukkit.Sound;
@ -8,26 +9,24 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import com.mysql.jdbc.Util;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.classcombat.Skill.Skill; import mineplex.minecraft.game.classcombat.Skill.Skill;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
public class Bloodlust extends Skill public class Bloodlust extends Skill
{ {
private WeakHashMap<Player, Long> _time = new WeakHashMap<Player, Long>();
private WeakHashMap<Player, Integer> _str = new WeakHashMap<Player, Integer>(); private final Map<Player, Long> _time = new WeakHashMap<>();
private final Map<Player, Integer> _str = new WeakHashMap<>();
public Bloodlust(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) public Bloodlust(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels)
{ {
@ -35,8 +34,9 @@ public class Bloodlust extends Skill
SetDesc(new String[] SetDesc(new String[]
{ {
"When you kill an enemy, you go into", "Killing an enemy within 4#4 blocks",
"a Bloodlust, receiving Speed 1 and", "you go into a Bloodlust,",
"receiving Speed 1 and",
"Strength 1 for #4#2 seconds.", "Strength 1 for #4#2 seconds.",
"You also heal #0#1 health.", "You also heal #0#1 health.",
"", "",
@ -117,8 +117,7 @@ public class Bloodlust extends Skill
if (System.currentTimeMillis() > _time.get(player)) if (System.currentTimeMillis() > _time.get(player))
{ {
int str = _str.remove(player); int str = _str.remove(player);
UtilPlayer.message(player, F.main(GetClassType().name(), "Your " + F.skill(GetName(getLevel(player))) + UtilPlayer.message(player, F.main(GetClassType().name(), "Your " + F.skill(GetName(getLevel(player))) + " has ended at " + F.elem("Level " + (str+1)) + "."));
" has ended at " + F.elem("Level " + (str+1)) + "."));
_time.remove(player); _time.remove(player);
return true; return true;
@ -135,9 +134,9 @@ public class Bloodlust extends Skill
for (Entity ent : _str.keySet()) for (Entity ent : _str.keySet())
{ {
UtilParticle.PlayParticle(ParticleType.RED_DUST, ent.getLocation(), UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, ent.getLocation(),
(float)(Math.random() - 0.5), 0.2f + (float)Math.random(), (float)(Math.random() - 0.5), 0, _str.get(ent) * 2, (float)(Math.random() - 0.5), 0.2f + (float)Math.random(), (float)(Math.random() - 0.5), 0, _str.get(ent) * 2,
ViewDist.NORMAL, UtilServer.getPlayers()); ViewDist.NORMAL);
} }
} }

View File

@ -3,6 +3,7 @@ package mineplex.minecraft.game.classcombat.Skill.Brute;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
@ -18,7 +19,9 @@ public class Colossus extends Skill
SetDesc(new String[] SetDesc(new String[]
{ {
"You are so huge that you take", "You are so huge that you take",
"35% less knockback from attacks." "33% less knockback from attacks",
"and while sneaking you take no",
"knockback."
}); });
} }
@ -26,17 +29,36 @@ public class Colossus extends Skill
public void Damage(CustomDamageEvent event) public void Damage(CustomDamageEvent event)
{ {
if (event.IsCancelled()) if (event.IsCancelled())
{
return; return;
}
Player damagee = event.GetDamageePlayer(); Player damagee = event.GetDamageePlayer(), damager = event.GetDamagerPlayer(true);
if (damagee == null) return;
int level = getLevel(damagee); if (damagee == null || damager == null)
if (level == 0) return; {
return;
}
//Damage int damageeeLevel = getLevel(damagee), damagerLevel = getLevel(damager);
event.AddMod(damagee.getName(), GetName(), 0, false); DamageCause cause = event.GetCause();
event.AddKnockback(GetName(), 0.65);
if (damageeeLevel > 0 && (cause == DamageCause.ENTITY_ATTACK || cause == DamageCause.PROJECTILE))
{
if (damagee.isSneaking())
{
event.SetKnockback(false);
}
else
{
event.AddKnockback(GetName(), 0.66);
}
}
if (damagerLevel > 0)
{
event.AddMod(GetName(), -0.5);
}
} }
@Override @Override

View File

@ -1,8 +1,10 @@
package mineplex.minecraft.game.classcombat.Skill.Brute; package mineplex.minecraft.game.classcombat.Skill.Brute;
import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.bukkit.Bukkit;
import org.bukkit.EntityEffect; import org.bukkit.EntityEffect;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
@ -15,7 +17,6 @@ import org.spigotmc.event.entity.EntityDismountEvent;
import mineplex.core.Managers; import mineplex.core.Managers;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
@ -33,11 +34,10 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class DwarfToss extends SkillActive public class DwarfToss extends SkillActive
{ {
private HashSet<Player> _used = new HashSet<Player>();
private NautHashMap<Player, LivingEntity> _holding = new NautHashMap<Player, LivingEntity>();
private NautHashMap<Player, Long> _time = new NautHashMap<Player, Long>();
private long _chargeTime = 2500; private final Set<Player> _used = new HashSet<>();
private final Map<Player, LivingEntity> _holding = new HashMap<>();
private final Map<Player, Long> _time = new HashMap<>();
public DwarfToss(SkillFactory skills, String name, ClassType classType, SkillType skillType, public DwarfToss(SkillFactory skills, String name, ClassType classType, SkillType skillType,
int cost, int levels, int cost, int levels,
@ -68,10 +68,7 @@ public class DwarfToss extends SkillActive
@Override @Override
public boolean CustomCheck(Player player, int level) public boolean CustomCheck(Player player, int level)
{ {
if (_used.contains(player)) return !_used.contains(player);
return false;
return true;
} }
@Override @Override
@ -94,7 +91,7 @@ public class DwarfToss extends SkillActive
int level = getLevel(player); int level = getLevel(player);
if (level == 0) return false; if (level == 0) return false;
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) if (UtilEnt.isInWater(player))
{ {
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false; return false;
@ -112,11 +109,7 @@ public class DwarfToss extends SkillActive
return false; return false;
//Check Energy/Recharge //Check Energy/Recharge
if (!EnergyRechargeCheck(player, level)) return EnergyRechargeCheck(player, level);
return false;
//Allow
return true;
} }
//getEntity is the vehicle //getEntity is the vehicle
@ -126,18 +119,17 @@ public class DwarfToss extends SkillActive
if (event.isCancelled()) if (event.isCancelled())
return; return;
System.out.println(UtilEnt.getName(event.getDismounted()));
System.out.println(UtilEnt.getName(event.getEntity()));
if (!(event.getDismounted() instanceof Player)) if (!(event.getDismounted() instanceof Player))
return; return;
if (!(event.getEntity() instanceof Player)) if (!(event.getEntity() instanceof Player))
return; return;
if (_holding.containsKey((Player)event.getEntity()) && _holding.get((Player)event.getEntity()) == event.getDismounted()) if (event.getDismounted().equals(_holding.get(event.getEntity())))
{
event.setCancelled(true); event.setCancelled(true);
} }
}
@EventHandler @EventHandler
public void Grab(PlayerInteractEntityEvent event) public void Grab(PlayerInteractEntityEvent event)
@ -179,13 +171,14 @@ public class DwarfToss extends SkillActive
} }
//Hold Loop //Hold Loop
if (target instanceof Player && _holding.containsKey((Player)target)) if (target instanceof Player && _holding.containsKey(target))
if (_holding.get((Player)target).equals(player))
if (target instanceof Player)
{ {
UtilPlayer.message(player, F.main(GetClassType().name(), F.name(((Player)target).getName()) + " is already holding you.")); if (_holding.get(target).equals(player))
{
UtilPlayer.message(player, F.main(GetClassType().name(), F.name(target.getName()) + " is already holding you."));
return; return;
} }
}
if (_holding.containsValue(target)) if (_holding.containsValue(target))
{ {
@ -279,8 +272,8 @@ public class DwarfToss extends SkillActive
if (event.getType() != UpdateType.TICK) if (event.getType() != UpdateType.TICK)
return; return;
HashSet<Player> voidSet = new HashSet<Player>(); Set<Player> voidSet = new HashSet<>();
HashSet<Player> throwSet = new HashSet<Player>(); Set<Player> throwSet = new HashSet<>();
for (Player cur : _holding.keySet()) for (Player cur : _holding.keySet())
{ {
@ -332,9 +325,11 @@ public class DwarfToss extends SkillActive
//Time Reduce //Time Reduce
double timeScale = 1; double timeScale = 1;
if (time < _chargeTime) long chargeTime = 2500;
if (time < chargeTime)
{ {
timeScale = Math.max(0.25, ((double)time/(double)_chargeTime)); timeScale = Math.max(0.25, ((double)time/(double) chargeTime));
} }
//Show! //Show!
@ -352,10 +347,7 @@ public class DwarfToss extends SkillActive
Factory.Condition().Factory().Invulnerable(GetName(), target, target, 1.25, false, false); Factory.Condition().Factory().Invulnerable(GetName(), target, target, 1.25, false, false);
//Delay //Delay
Bukkit.getScheduler().scheduleSyncDelayedTask(Factory.getPlugin(), new Runnable() Factory.runSyncLater(() ->
{
@Override
public void run()
{ {
UtilAction.velocity(target, cur.getLocation().getDirection(), mult, false, 0, 0.2, 1.2, true); UtilAction.velocity(target, cur.getLocation().getDirection(), mult, false, 0, 0.2, 1.2, true);
@ -364,7 +356,6 @@ public class DwarfToss extends SkillActive
//Effect //Effect
target.playEffect(EntityEffect.HURT); target.playEffect(EntityEffect.HURT);
}
}, 5); }, 5);
//Inform //Inform

View File

@ -10,11 +10,13 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.core.common.util.UtilEnt;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.projectile.IThrown; import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser; import mineplex.core.projectile.ProjectileUser;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
@ -60,7 +62,7 @@ public class FleshHook extends SkillActiveCharge implements IThrown
@Override @Override
public boolean CustomCheck(Player player, int level) public boolean CustomCheck(Player player, int level)
{ {
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) if (UtilEnt.isInWater(player))
{ {
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false; return false;
@ -117,6 +119,7 @@ public class FleshHook extends SkillActiveCharge implements IThrown
//Effect //Effect
item.getWorld().playSound(item.getLocation(), Sound.IRONGOLEM_THROW, 2f, 0.8f); item.getWorld().playSound(item.getLocation(), Sound.IRONGOLEM_THROW, 2f, 0.8f);
Recharge.Instance.useForce(cur, GetName(), Recharge(level));
} }
} }
} }

View File

@ -1,60 +1,129 @@
package mineplex.minecraft.game.classcombat.Skill.Brute; package mineplex.minecraft.game.classcombat.Skill.Brute;
import java.util.HashMap; import java.util.HashSet;
import java.util.Set;
import org.bukkit.Bukkit;
import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftInventoryCrafting;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.scheduler.BukkitRunnable;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.core.common.util.F;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.common.util.UtilGear;
import mineplex.core.updater.UpdateType; import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.particles.ColoredParticle;
import mineplex.core.common.util.particles.DustSpellColor;
import mineplex.core.recharge.Recharge;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.classcombat.Skill.Skill; import mineplex.minecraft.game.classcombat.Skill.Skill;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
public class Intimidation extends Skill public class Intimidation extends Skill
{ {
private final Set<Player> _active = new HashSet<>();
private final DustSpellColor _color = new DustSpellColor(Color.PURPLE);
public Intimidation(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) public Intimidation(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);
SetDesc(new String[] SetDesc(new String[]
{ {
"Drop Axe/Sword to Use.",
"",
"You intimidate nearby enemies;", "You intimidate nearby enemies;",
"Enemies within #4#2 blocks receive Slow 1.", "Enemies within #10#1 blocks receive Slow 1.",
"",
"Lasts for #10#1."
}); });
} }
@Override
public String GetRechargeString()
{
return "Recharge: #15#-1.5 Seconds.";
}
@EventHandler @EventHandler
public void Update(UpdateEvent event) public void Use(PlayerDropItemEvent event)
{
Player player = event.getPlayer();
if (!(player.getOpenInventory().getTopInventory() instanceof CraftInventoryCrafting))
{ {
if (event.getType() != UpdateType.TICK)
return; return;
for (Player cur : GetUsers())
{
int level = getLevel(cur);
if (level == 0) continue;
HashMap<Player, Double> targets = UtilPlayer.getInRadius(cur.getLocation(), 3 + (level * 2));
for (Player other : targets.keySet())
if (!other.equals(cur))
if (Factory.Relation().canHurt(cur, other))
if (getLevel(other) < level)
{
double dist = targets.get(other);
int mult = 0;
//if (dist <= 1 + level) mult = 2;
//else if (dist <= 2 + (2 * level)) mult = 1;
Factory.Condition().Factory().Slow(GetName(), other, cur, 0.9, mult, false, true, false, true);
} }
int level = getLevel(player);
if (level == 0 || !UtilGear.isWeapon(event.getItemDrop().getItemStack()) || _active.contains(player) || !Recharge.Instance.usable(player, GetName(), true))
{
return;
} }
event.setCancelled(true);
//Check Allowed
SkillTriggerEvent trigger = new SkillTriggerEvent(player, GetName(), GetClassType());
Bukkit.getServer().getPluginManager().callEvent(trigger);
if (trigger.IsCancelled())
{
return;
}
_active.add(player);
player.getWorld().playSound(player.getLocation(), Sound.HORSE_SKELETON_HIT, 1, 1);
player.sendMessage(F.main("Skill", "You used " + F.skill(GetName(level)) + "."));
long start = System.currentTimeMillis(), length = 10000 + (level * 1000);
Factory.runSyncTimer(new BukkitRunnable()
{
@Override
public void run()
{
if (!_active.contains(player) || UtilTime.elapsed(start, length))
{
Recharge.Instance.use(player, GetName(), 15000 - (1500 * level), true, false);
Reset(player);
cancel();
return;
}
player.setExp(1 - ((System.currentTimeMillis() - start) / (float) length));
Location location = player.getLocation();
new ColoredParticle(ParticleType.RED_DUST, _color, location.clone().add(Math.random() - 0.5, Math.random() + 0.5, Math.random() - 0.5))
.display();
UtilPlayer.getInRadius(location, 10 + level).forEach((other, scale) ->
{
if (other.equals(player) || !Factory.Relation().canHurt(player, other))
{
return;
}
Factory.Condition().Factory().Slow(GetName(), other, player, 0.9, 0, false, true, false, true);
});
}
}, 0, 1);
} }
@Override @Override
public void Reset(Player player) public void Reset(Player player)
{ {
_active.remove(player);
player.setExp(0);
} }
} }

View File

@ -88,7 +88,7 @@ public class SeismicSlam extends SkillActive
@Override @Override
public boolean CustomCheck(Player player, int level) public boolean CustomCheck(Player player, int level)
{ {
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) if (UtilEnt.isInWater(player))
{ {
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false; return false;

View File

@ -2,24 +2,6 @@ package mineplex.minecraft.game.classcombat.Skill.Brute;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.F;
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.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.minecraft.game.classcombat.Skill.Skill;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.classcombat.Skill.event.SkillEvent;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
@ -29,6 +11,21 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.classcombat.Skill.Skill;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.classcombat.Skill.event.SkillEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class Stampede extends Skill public class Stampede extends Skill
{ {
private WeakHashMap<Player, Long> _sprintTime = new WeakHashMap<Player, Long>(); private WeakHashMap<Player, Long> _sprintTime = new WeakHashMap<Player, Long>();
@ -43,10 +40,10 @@ public class Stampede extends Skill
"You slowly build up speed as you", "You slowly build up speed as you",
"sprint. You gain a level of Speed", "sprint. You gain a level of Speed",
"for every #5#-1 seconds, up to a max", "for every #5#-1 seconds, up to a max",
"of Speed 3.", "of Speed 2.",
"", "",
"Attacking during stampede deals", "Attacking during stampede deals",
"#0#0.5 bonus damage per speed level,", "#0.25#0.25 bonus damage,",
"and +50% knockback per speed level.", "and +50% knockback per speed level.",
"", "",
"Resets if you take damage." "Resets if you take damage."
@ -89,7 +86,7 @@ public class Stampede extends Skill
_sprintTime.put(cur, System.currentTimeMillis()); _sprintTime.put(cur, System.currentTimeMillis());
if (str < 3) if (str < 2)
{ {
_sprintStr.put(cur, str+1); _sprintStr.put(cur, str+1);
@ -156,7 +153,7 @@ public class Stampede extends Skill
damager.removePotionEffect(PotionEffectType.SPEED); damager.removePotionEffect(PotionEffectType.SPEED);
//Damage //Damage
event.AddMod(damager.getName(), GetName(), str * (0.5 * level), true); event.AddMod(damager.getName(), GetName(), 0.25 + (0.25 * level), true);
event.AddKnockback(GetName(), 1 + 0.5 * str); event.AddKnockback(GetName(), 1 + 0.5 * str);
//Inform //Inform

View File

@ -1,9 +1,8 @@
package mineplex.minecraft.game.classcombat.Skill.Brute; package mineplex.minecraft.game.classcombat.Skill.Brute;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import org.bukkit.GameMode;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
@ -14,26 +13,25 @@ import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle; 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.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.classcombat.Skill.SkillActive; import mineplex.minecraft.game.classcombat.Skill.SkillActive;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class Takedown extends SkillActive public class Takedown extends SkillActive
{ {
private HashMap<LivingEntity, Long> _live = new HashMap<LivingEntity, Long>();
private final Map<LivingEntity, Long> _live = new HashMap<>();
public Takedown(SkillFactory skills, String name, ClassType classType, SkillType skillType, public Takedown(SkillFactory skills, String name, ClassType classType, SkillType skillType,
int cost, int levels, int cost, int levels,
@ -53,7 +51,7 @@ public class Takedown extends SkillActive
{ {
"Hurl yourself towards an opponent.", "Hurl yourself towards an opponent.",
"If you collide with them, you deal", "If you collide with them, you deal",
"#3#1 damage and take #1.5#0.5 damage.", "#5#1 damage and take #1.5#0.5 damage.",
"You both receive Slow 4 for #2.5#0.5 seconds." "You both receive Slow 4 for #2.5#0.5 seconds."
}); });
} }
@ -61,7 +59,7 @@ public class Takedown extends SkillActive
@Override @Override
public boolean CustomCheck(Player player, int level) public boolean CustomCheck(Player player, int level)
{ {
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) if (UtilEnt.isInWater(player))
{ {
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false; return false;
@ -116,56 +114,29 @@ public class Takedown extends SkillActive
} }
//Collide //Collide
for (Player player : GetUsers()) _live.keySet().removeIf(entity ->
if (_live.containsKey(player))
for (Player other : player.getWorld().getPlayers())
if (!UtilPlayer.isSpectator(other))
if (!other.equals(player))
if (Factory.Relation().canHurt(player, other))
if (UtilMath.offset(player, other) < 2)
{ {
Player player = (Player) entity;
for (Player other : UtilPlayer.getNearby(player.getLocation(), 2))
{
if (player.equals(other) || !Factory.Relation().canHurt(player, other))
{
continue;
}
DoTakeDown(player, other); DoTakeDown(player, other);
_live.remove(player); return true;
return;
} }
return false;
});
} }
/** private void DoTakeDown(Player damager, LivingEntity damagee)
@EventHandler(priority = EventPriority.LOW)
public void Damage(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
if (event.GetCause() != DamageCause.ENTITY_ATTACK)
return;
Player damager = event.GetDamagerPlayer(false);
if (damager == null) return;
int level = GetLevel(damager);
if (level == 0) return;
LivingEntity damagee = event.GetDamageeEntity();
if (damagee == null) return;
if (UtilMath.offset(damager, damagee) > 3)
return;
if (_live.remove(damager) == null)
return;
event.SetCancelled("Takedown Cancel");
DoTakeDown(damager, damagee);
}
**/
public void DoTakeDown(Player damager, LivingEntity damagee)
{ {
int level = getLevel(damager); int level = getLevel(damager);
int damage = 3 + (level); int damage = 5 + level;
//Damage Event //Damage Event
CustomDamageEvent customDamageEvent = Factory.Damage().NewDamageEvent(damagee, damager, null, CustomDamageEvent customDamageEvent = Factory.Damage().NewDamageEvent(damagee, damager, null,
@ -174,14 +145,17 @@ public class Takedown extends SkillActive
if (!customDamageEvent.IsCancelled()) if (!customDamageEvent.IsCancelled())
{ {
//Damage Event
Factory.Damage().NewDamageEvent(damager, damagee, null,
DamageCause.CUSTOM, damage / 2, false, true, false,
damager.getName(), GetName() + " Recoil");
//Conditions //Conditions
Factory.Condition().Factory().Slow(GetName(), damagee, damager, 2.5 + 0.5 * level, 3, false, true, true, true); double duration = 2.5 + (level / 2D);
Factory.Condition().Factory().Slow(GetName(), damager, damager, 2.5 + 0.5 * level, 3, false, true, true, true);
Factory.Condition().Factory().Slow(GetName(), damagee, damager, duration, 3, false, true, true, true);
Factory.Condition().Factory().Slow(GetName(), damager, damager, duration, 3, false, true, true, true);
Factory.Condition().Factory().Jump(GetName(), damagee, damager, duration, 250, false, false, false);
Factory.Condition().Factory().Jump(GetName(), damager, damager, duration, 250, false, false, false);
Factory.Damage().NewDamageEvent(damager, damagee, null, DamageCause.CUSTOM, 1.5 + (level / 2D), false, true, false, GetName(), GetName() + " Recoil");
UtilAction.zeroVelocity(damagee);
UtilAction.zeroVelocity(damager);
//Inform //Inform
UtilPlayer.message(damager, F.main(GetClassType().name(), "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(GetName(level)) + ".")); UtilPlayer.message(damager, F.main(GetClassType().name(), "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(GetName(level)) + "."));
@ -200,9 +174,9 @@ public class Takedown extends SkillActive
for (Entity ent : _live.keySet()) for (Entity ent : _live.keySet())
{ {
UtilParticle.PlayParticle(ParticleType.CRIT, ent.getLocation(), UtilParticle.PlayParticleToAll(ParticleType.CRIT, ent.getLocation(),
(float)(Math.random() - 0.5), (float)(Math.random() * 1.4), (float)(Math.random() - 0.5), 0, 4, (float)(Math.random() - 0.5), (float)(Math.random() * 1.4), (float)(Math.random() - 0.5), 0, 4,
ViewDist.LONG, UtilServer.getPlayers()); ViewDist.LONG);
} }
} }

View File

@ -58,7 +58,7 @@ public class Taunt extends SkillActive
@Override @Override
public boolean CustomCheck(Player player, int level) public boolean CustomCheck(Player player, int level)
{ {
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) if (UtilEnt.isInWater(player))
{ {
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false; return false;

View File

@ -54,7 +54,7 @@ public class WhirlwindAxe extends SkillActive
@Override @Override
public boolean CustomCheck(Player player, int level) public boolean CustomCheck(Player player, int level)
{ {
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) if (UtilEnt.isInWater(player))
{ {
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false; return false;

View File

@ -19,7 +19,7 @@ public class BreakFall extends Skill
SetDesc(new String[] SetDesc(new String[]
{ {
"You roll when you hit the ground;", "You roll when you hit the ground;",
"Fall damage is reduced by #0#2.", "Fall damage is reduced by #0.5#1.5 .",
}); });
} }
@ -38,7 +38,7 @@ public class BreakFall extends Skill
int level = getLevel(player); int level = getLevel(player);
if (level == 0) return; if (level == 0) return;
event.AddMod(null, GetName(), -(2 * level), false); event.AddMod(null, GetName(), -0.5 - (1.5 * level), false);
} }
@Override @Override

View File

@ -9,6 +9,7 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import mineplex.core.common.util.UtilEnt;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
@ -43,7 +44,7 @@ public class Pistol extends SkillActive
@Override @Override
public boolean CustomCheck(Player player, int level) public boolean CustomCheck(Player player, int level)
{ {
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) if (UtilEnt.isInWater(player))
{ {
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false; return false;

View File

@ -18,36 +18,42 @@ public class Resistance extends Skill
SetDesc(new String[] SetDesc(new String[]
{ {
"Your body and mind is exceptionally resistant.", "Your body and mind is exceptionally resistant.",
"Durations on you are #0#25 % shorter for;", "Durations on you are #20#15 % shorter for;",
"Slow, Fire, Shock, Confusion, Poison, Blindness." "Slow, Fire, Shock, Confusion, Poison,",
"Blindness and Jump Prevention"
}); });
} }
@EventHandler @EventHandler
public void Resist(ConditionApplyEvent event) public void Resist(ConditionApplyEvent event)
{ {
if (event.GetCondition().GetType() != ConditionType.BURNING &&
event.GetCondition().GetType() != ConditionType.SLOW &&
event.GetCondition().GetType() != ConditionType.SHOCK &&
event.GetCondition().GetType() != ConditionType.CONFUSION &&
event.GetCondition().GetType() != ConditionType.POISON &&
event.GetCondition().GetType() != ConditionType.BLINDNESS)
return;
//Dont Resist Self Condition //Dont Resist Self Condition
if (event.GetCondition().GetReason().equalsIgnoreCase("Hold Position")) if (event.GetCondition().GetReason().equalsIgnoreCase("Hold Position"))
{ {
return; return;
} }
ConditionType type = event.GetCondition().GetType();
switch (type)
{
case BURNING:
case SLOW:
case SHOCK:
case CONFUSION:
case POISON:
case BLINDNESS:
int level = getLevel(event.GetCondition().GetEnt()); int level = getLevel(event.GetCondition().GetEnt());
if (level <= 0)
if (level == 0)
{
return; return;
}
double reduction = -(0.25f * level); double reduction = -0.20f - (0.15f * level);
event.GetCondition().ModifyTicks((int) (event.GetCondition().GetTicksTotal() * reduction)); event.GetCondition().ModifyTicks((int) (event.GetCondition().GetTicksTotal() * reduction));
break;
}
} }
@Override @Override

View File

@ -67,7 +67,7 @@ public class AxeThrow extends SkillActive implements IThrown
@Override @Override
public boolean CustomCheck(Player player, int level) public boolean CustomCheck(Player player, int level)
{ {
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) if (UtilEnt.isInWater(player))
{ {
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false; return false;

View File

@ -54,7 +54,7 @@ public class BullsCharge extends SkillActive
@Override @Override
public boolean CustomCheck(Player player, int level) public boolean CustomCheck(Player player, int level)
{ {
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) if (UtilEnt.isInWater(player))
{ {
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false; return false;

View File

@ -40,7 +40,7 @@ public class DefensiveStance extends SkillActive
SetDesc(new String[] SetDesc(new String[]
{ {
"While Blocking, you take 75% less", "While Blocking, you take 80% less",
"damage from attacks infront of you." "damage from attacks infront of you."
}); });
} }
@ -111,12 +111,12 @@ public class DefensiveStance extends SkillActive
if (damagee.getLocation().getDirection().subtract(from).length() > 1.4) if (damagee.getLocation().getDirection().subtract(from).length() > 1.4)
{ {
//event.AddMod(damagee.getName(), getName(), -0.5 - (0.5 * level), true);
return; return;
} }
//Damage //Damage
event.AddMult(GetName(), GetName(), 0.25, false); event.AddMult(GetName(), GetName(), 0.2, false);
event.SetKnockback(false);
//Effect //Effect
damagee.getWorld().playSound(damagee.getLocation(), Sound.ZOMBIE_METAL, 1f, 2f); damagee.getWorld().playSound(damagee.getLocation(), Sound.ZOMBIE_METAL, 1f, 2f);

View File

@ -103,7 +103,7 @@ public class HiltSmash extends SkillActive
return false; return false;
//Water //Water
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) if (UtilEnt.isInWater(player))
{ {
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false; return false;

View File

@ -1,5 +1,6 @@
package mineplex.minecraft.game.classcombat.Skill.Knight; package mineplex.minecraft.game.classcombat.Skill.Knight;
import mineplex.core.common.util.UtilEnt;
import mineplex.minecraft.game.core.condition.events.ConditionExpireEvent; import mineplex.minecraft.game.core.condition.events.ConditionExpireEvent;
import org.bukkit.Effect; import org.bukkit.Effect;
import org.bukkit.Material; import org.bukkit.Material;
@ -57,8 +58,7 @@ public class HoldPosition extends SkillActive
@Override @Override
public boolean CustomCheck(Player player, int level) public boolean CustomCheck(Player player, int level)
{ {
Material type = player.getLocation().getBlock().getType(); if (UtilEnt.isInWater(player))
if (type == Material.WATER || type == Material.STATIONARY_WATER)
{ {
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false; return false;
@ -76,6 +76,7 @@ public class HoldPosition extends SkillActive
Factory.Condition().Factory().Slow(GetName(), player, player, duration, 2, false, true, false, true); Factory.Condition().Factory().Slow(GetName(), player, player, duration, 2, false, true, false, true);
Factory.Condition().Factory().Protection(GetName(), player, player, duration, 2, false, false, true); Factory.Condition().Factory().Protection(GetName(), player, player, duration, 2, false, false, true);
Factory.Condition().Factory().ArcadeHungerDisable(GetName(), player, player, duration, false); Factory.Condition().Factory().ArcadeHungerDisable(GetName(), player, player, duration, false);
Factory.Condition().Factory().Jump(GetName(), player, player, duration, 250, false, false, false);
//Inform //Inform
UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + ".")); UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + "."));

View File

@ -1,141 +1,189 @@
package mineplex.minecraft.game.classcombat.Skill.Knight; package mineplex.minecraft.game.classcombat.Skill.Knight;
import org.bukkit.entity.LivingEntity; import java.util.HashSet;
import java.util.Set;
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftInventoryCrafting;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.scheduler.BukkitRunnable;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.core.common.util.F;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.recharge.Recharge;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.classcombat.Skill.Skill; import mineplex.minecraft.game.classcombat.Skill.Skill;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class LevelField extends Skill public class LevelField extends Skill
{ {
private final Set<Player> _active = new HashSet<>();
public LevelField(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) public LevelField(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);
SetDesc(new String[] SetDesc(new String[]
{ {
/* "Drop Axe/Sword to Use.",
"For every enemy within #4#2 blocks",
"that is closer than your nearest ally,",
"you deal 1 more damage and take 1 less.",
"", "",
"Damage can be altered a maximum of #1#1.",
*/
"Even the battlefield with courage!",
"You deal X more damage.", "You deal X more damage.",
"You take X less damage.", "You take X less damage.",
"X = (Nearby Enemies) - (Nearby Allies)", "X = (Nearby Enemies) - (Nearby Allies)",
"Players within #4#2 Blocks are considered.", "Players within #4#2 Blocks are considered.",
"", "",
"Damage can be altered a maximum of #1#1.", "Damage can be altered a maximum of #1#1.",
"",
"You can not deal less damage, or take", "You can not deal less damage, or take",
"more damage via this." "more damage via this.",
"",
"Lasts for #6#1."
}); });
} }
@EventHandler(priority = EventPriority.HIGH) @Override
public void Decrease(CustomDamageEvent event) public String GetRechargeString()
{
return "Recharge: #16#-1 Seconds";
}
@EventHandler
public void Use(PlayerDropItemEvent event)
{
Player player = event.getPlayer();
if (!(player.getOpenInventory().getTopInventory() instanceof CraftInventoryCrafting))
{ {
if (event.IsCancelled())
return; return;
}
if (event.GetCause() != DamageCause.ENTITY_ATTACK) int level = getLevel(player);
if (level == 0 || !UtilGear.isWeapon(event.getItemDrop().getItemStack()) || !Recharge.Instance.usable(player, GetName(), true))
{
return; return;
}
//Damager event.setCancelled(true);
Player damagee = event.GetDamageePlayer();
if (damagee == null) return;
LivingEntity damager = event.GetDamagerEntity(false); //Check Allowed
if (damager == null) return; SkillTriggerEvent trigger = new SkillTriggerEvent(player, GetName(), GetClassType());
UtilServer.CallEvent(trigger);
//Level if (trigger.IsCancelled())
{
return;
}
long start = System.currentTimeMillis();
_active.add(player);
player.sendMessage(F.main("Skill", "You used " + F.skill(GetName(level)) + "."));
Factory.runSyncTimer(new BukkitRunnable()
{
@Override
public void run()
{
if (!player.isOnline() || UtilTime.elapsed(start, 6000 + (1000 * level)))
{
Recharge.Instance.use(player, GetName(), 16000 - (1000 * level), true, false);
Reset(player);
cancel();
return;
}
UtilParticle.playParticleFor(player, ParticleType.HAPPY_VILLAGER, player.getLocation().add(0, 0.5, 0), 1, 0.3F, 1, 0, 1, ViewDist.LONG);
}
}, 0, 2);
}
@EventHandler(priority = EventPriority.HIGH)
public void alterDamage(CustomDamageEvent event)
{
if (event.IsCancelled() || event.GetCause() != DamageCause.ENTITY_ATTACK)
{
return;
}
Player damagee = event.GetDamageePlayer(), damager = event.GetDamagerPlayer(false);
if (damagee == null || damager == null)
{
return;
}
{
int level = getLevel(damagee); int level = getLevel(damagee);
if (level == 0) return;
int alt = 0; if (level == 0)
for (Player cur : UtilPlayer.getNearby(damagee.getLocation(), 4 + (2 * level)))
{ {
if (cur.equals(damagee)) return;
alt += 1;
else if (Factory.Relation().canHurt(damagee, cur))
alt -= 1;
else
alt += 1;
} }
int limit = 1 + level; event.AddMod(damagee.getName(), GetName(), getAlteration(damagee, level, false), false);
if (alt > limit) alt = limit;
if (alt < -limit) alt = -limit;
if (alt >= 0)
return;
//Decrease Damage
event.AddMod(damagee.getName(), GetName(), alt, false);
} }
@EventHandler(priority = EventPriority.HIGH)
public void Increase(CustomDamageEvent event)
{ {
if (event.IsCancelled())
return;
if (event.GetCause() != DamageCause.ENTITY_ATTACK)
return;
//Damager
Player damagee = event.GetDamageePlayer();
if (damagee == null) return;
Player damager = event.GetDamagerPlayer(false);
if (damager == null) return;
//Level
int level = getLevel(damager); int level = getLevel(damager);
if (level == 0) return;
if (level == 0)
{
return;
}
event.AddMod(damager.getName(), GetName(), getAlteration(damager, level, true), false);
}
}
private int getAlteration(Player player, int level, boolean positive)
{
int alt = 0; int alt = 0;
for (Player cur : UtilPlayer.getNearby(damager.getLocation(), 4 + (2 * level))) for (Player other : UtilPlayer.getNearby(player.getLocation(), 4 + (2 * level)))
{ {
if (cur.equals(damager)) if (player.equals(other))
alt -= 1; {
alt--;
else if (Factory.Relation().canHurt(damager, cur)) }
alt += 1; else if (Factory.Relation().canHurt(player, other))
{
alt++;
}
else else
alt -= 1; {
alt--;
}
} }
int limit = 1 + level; int limit = 1 + level;
if (alt > limit) alt = limit; alt = Math.min(alt, limit);
if (alt < -limit) alt = -limit; alt = Math.max(alt, -limit);
if (alt <= 0) if (positive)
return; {
return Math.max(0, alt);
//Decrease Damage }
event.AddMod(damager.getName(), GetName(), alt, false); else
{
return Math.min(0, -alt);
}
} }
@Override @Override
public void Reset(Player player) public void Reset(Player player)
{ {
_active.remove(player);
} }
} }

View File

@ -10,6 +10,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.core.common.util.UtilEnt;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
@ -51,16 +52,13 @@ public class PowerChop extends SkillActive
@Override @Override
public boolean CustomCheck(Player player, int level) public boolean CustomCheck(Player player, int level)
{ {
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) if (UtilEnt.isInWater(player))
{ {
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false; return false;
} }
if (!mineplex.core.recharge.Recharge.Instance.use(player, GetName() + " Cooldown", 250, false, false)) return mineplex.core.recharge.Recharge.Instance.use(player, GetName() + " Cooldown", 250, false, false);
return false;
return true;
} }
@Override @Override

View File

@ -12,6 +12,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.core.common.util.UtilEnt;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
@ -59,7 +60,7 @@ public class Riposte extends SkillActive
@Override @Override
public boolean CustomCheck(Player player, int level) public boolean CustomCheck(Player player, int level)
{ {
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) if (UtilEnt.isInWater(player))
{ {
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false; return false;

View File

@ -9,6 +9,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import mineplex.core.common.util.UtilEnt;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
@ -47,7 +48,7 @@ public class ShieldSmash extends SkillActive
@Override @Override
public boolean CustomCheck(Player player, int level) public boolean CustomCheck(Player player, int level)
{ {
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) if (UtilEnt.isInWater(player))
{ {
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false; return false;

View File

@ -1,37 +1,40 @@
package mineplex.minecraft.game.classcombat.Skill.Mage; package mineplex.minecraft.game.classcombat.Skill.Mage;
import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set;
import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.event.player.PlayerDropItemEvent;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.classcombat.Skill.Skill; import mineplex.minecraft.game.classcombat.Skill.Skill;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
public class ArcticArmor extends Skill public class ArcticArmor extends Skill
{ {
private HashSet<Player> _active = new HashSet<Player>();
private static final double DELTA_THETA = Math.PI / 10;
private final Set<Player> _active = new HashSet<>();
public ArcticArmor(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) public ArcticArmor(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels)
{ {
@ -45,14 +48,14 @@ public class ArcticArmor extends Skill
"in a #3#1 Block radius. Allies inside", "in a #3#1 Block radius. Allies inside",
"this area receive Protection 2.", "this area receive Protection 2.",
"", "",
"You receive Protection 1." "You receive Protection 2."
}); });
} }
@Override @Override
public String GetEnergyString() public String GetEnergyString()
{ {
return "Energy: #7#-1 per Second"; return "Energy: #11#-1 per Second";
} }
@EventHandler @EventHandler
@ -90,13 +93,13 @@ public class ArcticArmor extends Skill
public void Add(Player player) public void Add(Player player)
{ {
_active.add(player); _active.add(player);
UtilPlayer.message(player, F.main(GetClassType().name(), GetName() + ": " + F.oo("Enabled", true))); UtilPlayer.message(player, F.main(GetClassType().name(), F.skill(GetName()) + ": " + F.oo("Enabled", true)));
} }
public void Remove(Player player) public void Remove(Player player)
{ {
_active.remove(player); _active.remove(player);
UtilPlayer.message(player, F.main(GetClassType().name(), GetName() + ": " + F.oo("Disabled", false))); UtilPlayer.message(player, F.main(GetClassType().name(), F.skill(GetName()) + ": " + F.oo("Disabled", false)));
Factory.Condition().EndCondition(player, null, GetName()); Factory.Condition().EndCondition(player, null, GetName());
} }
@ -139,27 +142,47 @@ public class ArcticArmor extends Skill
} }
//Energy //Energy
if (!Factory.Energy().Use(cur, GetName(), 0.35 - (level * 0.05), true, true)) if (!Factory.Energy().Use(cur, GetName(), 0.55 - (level * 0.05), true, true))
{ {
Remove(cur); Remove(cur);
continue; continue;
} }
//Blocks //Blocks
Location location = cur.getLocation();
double duration = 2000; double duration = 2000;
HashMap<Block, Double> blocks = UtilBlock.getInRadius(cur.getLocation().getBlock().getLocation(), 3d + level); int radius = 3 + level;
for (Block block : blocks.keySet())
{
if (block.getType().toString().contains("BANNER") || block.getRelative(BlockFace.UP).getType().toString().contains("BANNER"))
continue;
//Freeze
if (!block.getRelative(BlockFace.UP).isLiquid())
if (block.getLocation().getY() <= cur.getLocation().getY())
if (block.getTypeId() == 8 || block.getTypeId() == 9 || block.getTypeId() == 79)
Factory.BlockRestore().add(block, 79, (byte) 0, (long) (duration * (1 + blocks.get(block))));
//Snow UtilBlock.getInRadius(location, radius).forEach((block, scale) ->
Factory.BlockRestore().snow(block, (byte) 0, (byte) 0, (long) (duration * (1 + blocks.get(block))), 250, 0); {
Block up = block.getRelative(BlockFace.UP);
if (block.getType().toString().contains("BANNER") || up.getType().toString().contains("BANNER"))
{
return;
}
//Freeze
if (!up.isLiquid() && block.getLocation().getY() <= cur.getLocation().getY())
{
if (block.getTypeId() == 8 || block.getTypeId() == 9 || block.getTypeId() == 79)
{
Factory.BlockRestore().add(block, 79, (byte) 0, (long) (duration * (1 + scale)));
}
}
});
location.add(0, 0.1, 0);
for (double t = 0; t < 2 * Math.PI; t += DELTA_THETA)
{
double x = radius * Math.cos(t), z = radius * Math.sin(t);
location.add(x, 0, z);
UtilParticle.PlayParticleToAll(ParticleType.SNOW_SHOVEL, location, 0.5F, 0.5F, 0.5F, 0, 1, ViewDist.LONG);
location.subtract(x, 0, z);
} }
} }
} }
@ -168,14 +191,20 @@ public class ArcticArmor extends Skill
public void ProtectionAura(UpdateEvent event) public void ProtectionAura(UpdateEvent event)
{ {
if (event.getType() != UpdateType.FAST) if (event.getType() != UpdateType.FAST)
{
return; return;
}
for (Player cur : _active) for (Player cur : _active)
{ {
//Protection //Protection
for (Player other : UtilPlayer.getNearby(cur.getLocation(), 3 + getLevel(cur))) for (Player other : UtilPlayer.getNearby(cur.getLocation(), 3 + getLevel(cur)))
{
if (!Factory.Relation().canHurt(cur, other) || other.equals(cur)) if (!Factory.Relation().canHurt(cur, other) || other.equals(cur))
Factory.Condition().Factory().Protection(GetName(), other, cur, 1.9, cur.equals(other) ? 0 : 1, false, true, true); {
Factory.Condition().Factory().Protection(GetName(), other, cur, 1.9, 1, false, true, true);
}
}
} }
} }
@ -203,9 +232,9 @@ public class ArcticArmor extends Skill
if (player.equals(cur)) if (player.equals(cur))
continue; continue;
double dist = UtilMath.offset(player, cur); double dist = UtilMath.offsetSquared(player, cur);
if (dist < 5 && (damager == null || dist < closest)) if (dist < 25 && (damager == null || dist < closest))
{ {
damager = player; damager = player;
closest = dist; closest = dist;
@ -220,20 +249,6 @@ public class ArcticArmor extends Skill
} }
} }
@EventHandler
public void Particle(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Entity ent : _active)
{
UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, ent.getLocation(),
(float)(Math.random() - 0.5), 0.2f + (float)Math.random(), (float)(Math.random() - 0.5), 0, 3,
ViewDist.NORMAL, UtilServer.getPlayers());
}
}
@Override @Override
public void Reset(Player player) public void Reset(Player player)
{ {

View File

@ -1,15 +1,15 @@
package mineplex.minecraft.game.classcombat.Skill.Mage; package mineplex.minecraft.game.classcombat.Skill.Mage;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.WeakHashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.WeakHashMap;
import org.bukkit.Effect;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile; import org.bukkit.entity.Projectile;
@ -17,26 +17,26 @@ import org.bukkit.entity.Snowball;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.classcombat.Skill.SkillActive; import mineplex.minecraft.game.classcombat.Skill.SkillActive;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class Blizzard extends SkillActive public class Blizzard extends SkillActive
{ {
private HashSet<Player> _active = new HashSet<Player>();
private WeakHashMap<Projectile, Player> _snowball = new WeakHashMap<Projectile, Player>(); private final Set<Player> _active = new HashSet<>();
private final Map<Projectile, Player> _snowball = new WeakHashMap<>();
public Blizzard(SkillFactory skills, String name, ClassType classType, SkillType skillType, public Blizzard(SkillFactory skills, String name, ClassType classType, SkillType skillType,
int cost, int levels, int cost, int levels,
@ -56,24 +56,20 @@ public class Blizzard extends SkillActive
{ {
"Hold Block to release a Blizzard.", "Hold Block to release a Blizzard.",
"Releases #1#1 snowballs per wave", "Releases #1#1 snowballs per wave",
"which push players away from you.", "which push players away from you."
"",
"Target the ground to create snow.",
"Maximum range of #7#1 Blocks.",
"Maximum height of #0#1 Blocks.",
}); });
} }
@Override @Override
public String GetEnergyString() public String GetEnergyString()
{ {
return "Energy: #42#-2 per Second"; return "Energy: 31#-1 per Second";
} }
@Override @Override
public boolean CustomCheck(Player player, int level) public boolean CustomCheck(Player player, int level)
{ {
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) if (UtilEnt.isInWater(player))
{ {
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false; return false;
@ -114,15 +110,13 @@ public class Blizzard extends SkillActive
} }
//Energy //Energy
if (!Factory.Energy().Use(cur, GetName(), 2.1 - (0.1 * level), true, true)) if (!Factory.Energy().Use(cur, GetName(), 1.55 - level * 0.05, true, true))
{ {
_active.remove(cur); _active.remove(cur);
continue;
} }
} }
} }
@EventHandler @EventHandler
public void Snow(UpdateEvent event) public void Snow(UpdateEvent event)
{ {

View File

@ -1,12 +1,8 @@
package mineplex.minecraft.game.classcombat.Skill.Mage; package mineplex.minecraft.game.classcombat.Skill.Mage;
import java.util.HashMap;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.Item;
import org.bukkit.entity.LargeFireball; import org.bukkit.entity.LargeFireball;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile; import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -14,14 +10,13 @@ import org.bukkit.event.block.Action;
import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.classcombat.Skill.SkillActive; import mineplex.minecraft.game.classcombat.Skill.SkillActive;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.classcombat.event.FireballHitEntityEvent; import mineplex.minecraft.game.classcombat.event.FireballHitEntityEvent;
@ -54,7 +49,7 @@ public class FireBlast extends SkillActive
@Override @Override
public boolean CustomCheck(Player player, int level) public boolean CustomCheck(Player player, int level)
{ {
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) if (UtilEnt.isInWater(player))
{ {
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false; return false;
@ -103,18 +98,14 @@ public class FireBlast extends SkillActive
if (level == 0) return; if (level == 0) return;
//Velocity Players //Velocity Players
HashMap<LivingEntity, Double> hitMap = UtilEnt.getInRadius(proj.getLocation(), 5.5 + (0.5 * level)); UtilEnt.getInRadius(proj.getLocation(), 5.5 + (0.5 * level)).forEach((cur, range) ->
for (LivingEntity cur : hitMap.keySet())
{ {
double range = hitMap.get(cur); FireballHitEntityEvent fireballEvent = new FireballHitEntityEvent(proj, cur);
UtilServer.CallEvent(fireballEvent);
FireballHitEntityEvent evt = new FireballHitEntityEvent(proj, cur); if (fireballEvent.isCancelled())
UtilServer.getServer().getPluginManager().callEvent(evt);
if (evt.isCancelled())
{ {
continue; return;
} }
//Damage Event //Damage Event
@ -124,9 +115,8 @@ public class FireBlast extends SkillActive
Factory.Condition().Factory().Falling(GetName(), cur, player, 10, false, true); Factory.Condition().Factory().Falling(GetName(), cur, player, 10, false, true);
//Velocity //Velocity
UtilAction.velocity(cur, UtilAlg.getTrajectory(proj.getLocation().add(0, -0.5, 0), cur.getEyeLocation()), UtilAction.velocity(cur, UtilAlg.getTrajectory(proj.getLocation().add(0, -0.5, 0), cur.getEyeLocation()), 1.6 * range, false, 0, 0.8 * range, 1.2, true);
1.6 * range, false, 0, 0.8 * range, 1.2, true); });
}
} }
@Override @Override

View File

@ -1,6 +1,7 @@
package mineplex.minecraft.game.classcombat.Skill.Mage; package mineplex.minecraft.game.classcombat.Skill.Mage;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -18,7 +19,8 @@ import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
public class Fissure extends SkillActive public class Fissure extends SkillActive
{ {
private HashSet<FissureData> _active = new HashSet<FissureData>();
private final Set<FissureData> _active = new HashSet<>();
public Fissure(SkillFactory skills, String name, ClassType classType, SkillType skillType, public Fissure(SkillFactory skills, String name, ClassType classType, SkillType skillType,
int cost, int levels, int cost, int levels,
@ -52,7 +54,7 @@ public class Fissure extends SkillActive
@Override @Override
public boolean CustomCheck(Player player, int level) public boolean CustomCheck(Player player, int level)
{ {
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) if (UtilEnt.isInWater(player))
{ {
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false; return false;
@ -81,19 +83,20 @@ public class Fissure extends SkillActive
public void Update(UpdateEvent event) public void Update(UpdateEvent event)
{ {
if (event.getType() != UpdateType.TICK) if (event.getType() != UpdateType.TICK)
return;
HashSet<FissureData> remove = new HashSet<FissureData>();
for (FissureData data : _active)
if (data.Update())
remove.add(data);
for (FissureData data : remove)
{ {
_active.remove(data); return;
data.Clear();
} }
_active.removeIf(data ->
{
if (data.Update())
{
data.Clear();
return true;
}
return false;
});
} }
@Override @Override

View File

@ -120,11 +120,8 @@ public class FissureData
Block block = _path.get(_handled); Block block = _path.get(_handled);
//Cannot raise TNT/ICE/WATER //Cannot raise TNT/WATER
if (block.getTypeId() == 46 if (block.getType() == Material.TNT || block.isLiquid())
|| block.getTypeId() == 79
|| block.getTypeId() == 8
|| block.getTypeId() == 9)
{ {
return false; return false;
} }

View File

@ -12,6 +12,7 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import mineplex.core.common.util.UtilEnt;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
@ -54,7 +55,7 @@ public class FreezingBlast extends SkillActive implements IThrown
@Override @Override
public boolean CustomCheck(Player player, int level) public boolean CustomCheck(Player player, int level)
{ {
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) if (UtilEnt.isInWater(player))
{ {
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false; return false;

View File

@ -57,10 +57,7 @@ public class GlacialBlade extends SkillActive implements IThrown
else if (Factory.Relation().canHurt(cur, player)) else if (Factory.Relation().canHurt(cur, player))
return false; return false;
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) return !UtilEnt.isInWater(player);
return false;
return true;
} }
@Override @Override

View File

@ -15,6 +15,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockFadeEvent; import org.bukkit.event.block.BlockFadeEvent;
import mineplex.core.common.util.UtilEnt;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
@ -55,7 +56,7 @@ public class IcePrison extends SkillActive implements IThrown
@Override @Override
public boolean CustomCheck(Player player, int level) public boolean CustomCheck(Player player, int level)
{ {
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) if (UtilEnt.isInWater(player))
{ {
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false; return false;

View File

@ -9,26 +9,24 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.Item; import org.bukkit.entity.Item;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.classcombat.Skill.Skill; import mineplex.minecraft.game.classcombat.Skill.Skill;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class Immolate extends Skill public class Immolate extends Skill
{ {
@ -44,8 +42,7 @@ public class Immolate extends Skill
"", "",
"Ignite yourself in flaming fury.", "Ignite yourself in flaming fury.",
"You receive Strength #1#1 , Speed 1,", "You receive Strength #1#1 , Speed 1,",
"Fire Resistance and take #0#1 more", "Fire Resistance",
"damage from attacks.",
"", "",
"You leave a trail of fire, which", "You leave a trail of fire, which",
"ignites players for #0.25#0.25 seconds." "ignites players for #0.25#0.25 seconds."
@ -106,25 +103,6 @@ public class Immolate extends Skill
Factory.Condition().Factory().FireResist(GetName(), player, player, 1.9, 0, false, true, true); Factory.Condition().Factory().FireResist(GetName(), player, player, 1.9, 0, false, true, true);
} }
@EventHandler(priority = EventPriority.HIGH)
public void Damage(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
Player damagee = event.GetDamageePlayer();
if (damagee == null) return;
if (!_active.contains(damagee))
return;
int level = getLevel(damagee);
if (level == 0) return;
//Damage
event.AddMod(GetName(), GetName() + " Weakness", level*1, true);
}
@EventHandler @EventHandler
public void Aura(UpdateEvent event) public void Aura(UpdateEvent event)
{ {
@ -200,6 +178,20 @@ public class Immolate extends Skill
Factory.Condition().Factory().Speed(GetName(), cur, cur, 1.9, 0, false, true, true); Factory.Condition().Factory().Speed(GetName(), cur, cur, 1.9, 0, false, true, true);
Factory.Condition().Factory().Strength(GetName(), cur, cur, 1.9, level, false, true, true); Factory.Condition().Factory().Strength(GetName(), cur, cur, 1.9, level, false, true, true);
Factory.Condition().Factory().FireResist(GetName(), cur, cur, 1.9, 0, false, true, true); Factory.Condition().Factory().FireResist(GetName(), cur, cur, 1.9, 0, false, true, true);
for (Player other : UtilPlayer.getNearby(cur.getLocation(), 6))
{
if (cur.equals(other))
{
continue;
}
else if (Factory.Relation().canHurt(cur, other))
{
continue;
}
Factory.Condition().Factory().FireResist("Allied Immolate", other, cur, 2, 0, true, true, false);
}
} }
} }

View File

@ -6,6 +6,7 @@ import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.Item; import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
@ -13,16 +14,19 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.classcombat.Skill.SkillActive; import mineplex.minecraft.game.classcombat.Skill.SkillActive;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.core.condition.Condition;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.condition.events.ConditionApplyEvent;
public class Inferno extends SkillActive public class Inferno extends SkillActive
{ {
@ -53,15 +57,15 @@ public class Inferno extends SkillActive
@Override @Override
public String GetEnergyString() public String GetEnergyString()
{ {
return "Energy: #42#-2 per Second"; return "Energy: #34#-1 per Second";
} }
@Override @Override
public boolean CustomCheck(Player player, int level) public boolean CustomCheck(Player player, int level)
{ {
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) if (UtilEnt.isInWater(player))
{ {
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " .in water."));
return false; return false;
} }
@ -100,7 +104,7 @@ public class Inferno extends SkillActive
} }
//Energy //Energy
if (!Factory.Energy().Use(cur, GetName(), 2.1 - (0.1 * level), true, false)) if (!Factory.Energy().Use(cur, GetName(), 1.7 - (0.05 * level), true, false))
{ {
_active.remove(cur); _active.remove(cur);
continue; continue;
@ -113,7 +117,7 @@ public class Inferno extends SkillActive
itemStack.setItemMeta(meta); itemStack.setItemMeta(meta);
Item fire = cur.getWorld().dropItem(cur.getEyeLocation().add(cur.getLocation().getDirection()), itemStack); Item fire = cur.getWorld().dropItem(cur.getEyeLocation().add(cur.getLocation().getDirection()), itemStack);
Factory.Fire().Add(fire, cur, 0.7, 0, 0.3 + (0.1 * level), .25, GetName(), false); Factory.Fire().Add(fire, cur, 0.7, 0, 0.3 + (0.1 * level), .375, GetName(), false);
fire.teleport(cur.getEyeLocation()); fire.teleport(cur.getEyeLocation());
double x = 0.07 - (UtilMath.r(14)/100d); double x = 0.07 - (UtilMath.r(14)/100d);
@ -126,6 +130,28 @@ public class Inferno extends SkillActive
} }
} }
@EventHandler
public void ignite(ConditionApplyEvent event)
{
Condition condition = event.GetCondition();
LivingEntity entity = condition.GetEnt(), source = condition.GetSource();
if (condition.GetType() != ConditionType.BURNING || source == null)
{
return;
}
if (!(entity instanceof Player) || !(source instanceof Player))
{
return;
}
if (!Factory.Relation().canHurt((Player) source, (Player) entity))
{
event.setCancelled(true);
}
}
@Override @Override
public void Reset(Player player) public void Reset(Player player)
{ {

View File

@ -1,38 +1,48 @@
package mineplex.minecraft.game.classcombat.Skill.Mage; package mineplex.minecraft.game.classcombat.Skill.Mage;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Set;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.entity.Item; import org.bukkit.entity.Item;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.inventory.InventoryPickupItemEvent; import org.bukkit.event.inventory.InventoryPickupItemEvent;
import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.common.util.UtilAlg;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.classcombat.Skill.Skill; import mineplex.minecraft.game.classcombat.Skill.Skill;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class LifeBonds extends Skill public class LifeBonds extends Skill
{ {
private HashSet<Player> _active = new HashSet<Player>();
private HashSet<Item> _items = new HashSet<Item>();
private HashSet<LifeBondsData> _hearts = new HashSet<LifeBondsData>(); private final Set<Player> _active = new HashSet<>();
private final Set<Item> _items = new HashSet<>();
private final Set<LifeBondsData> _hearts = new HashSet<>();
public LifeBonds(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) public LifeBonds(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels)
{ {
@ -53,7 +63,7 @@ public class LifeBonds extends Skill
@Override @Override
public String GetEnergyString() public String GetEnergyString()
{ {
return "Energy: #4.5#-0.5 per Second"; return "Energy: #9#-1 per Second";
} }
@EventHandler @EventHandler
@ -129,11 +139,10 @@ public class LifeBonds extends Skill
} }
//Energy //Energy
if (!Factory.Energy().Use(cur, GetName(), 0.225 - (level * 0.025), true, true)) if (!Factory.Energy().Use(cur, GetName(), 0.45 - (level * 0.05), true, true))
{ {
_active.remove(cur); _active.remove(cur);
UtilPlayer.message(cur, F.main(GetClassType().name(), GetName() + ": " + F.oo("Disabled", false))); UtilPlayer.message(cur, F.main(GetClassType().name(), GetName() + ": " + F.oo("Disabled", false)));
continue;
} }
} }
} }
@ -209,17 +218,13 @@ public class LifeBonds extends Skill
double amount = 0.5 + (0.5 * level); double amount = 0.5 + (0.5 * level);
amount = Math.min((double)(cur.getHealth() - lowestHp) / 2d, amount); amount = Math.min((cur.getHealth() - lowestHp) / 2d, amount);
//Steal //Steal
UtilPlayer.health(cur, -amount); UtilPlayer.health(cur, -amount * .25);
//Hearts //Hearts
_hearts.add(new LifeBondsData(cur.getLocation().add(0, 0.8, 0), lowest, amount)); _hearts.add(new LifeBondsData(cur.getLocation().add(0, 0.8, 0), lowest, amount));
//Effect
//highest.getWorld().playEffect(highest.getLocation(), Effect.STEP_SOUND, 18);
//lowest.getWorld().playEffect(lowest.getLocation(), Effect.STEP_SOUND, 18);
} }
} }
@ -229,15 +234,7 @@ public class LifeBonds extends Skill
if (event.getType() != UpdateType.FASTEST) if (event.getType() != UpdateType.FASTEST)
return; return;
Iterator<LifeBondsData> heartIterator = _hearts.iterator(); _hearts.removeIf(LifeBondsData::update);
while (heartIterator.hasNext())
{
LifeBondsData data = heartIterator.next();
if (data.Update())
heartIterator.remove();
}
} }
@EventHandler @EventHandler
@ -260,19 +257,12 @@ public class LifeBonds extends Skill
if (event.getType() != UpdateType.TICK) if (event.getType() != UpdateType.TICK)
return; return;
if (_items.isEmpty()) _items.removeIf(cur ->
return; {
HashSet<Item> remove = new HashSet<Item>();
for (Item cur : _items)
if (UtilEnt.isGrounded(cur) || cur.getTicksLived() > 40 || cur.isDead() || !cur.isValid()) if (UtilEnt.isGrounded(cur) || cur.getTicksLived() > 40 || cur.isDead() || !cur.isValid())
remove.add(cur);
for (Item cur : remove)
{ {
Block block = cur.getLocation().getBlock(); Block block = cur.getLocation().getBlock();
if (block.getTypeId() == 0) if (block.getType() == Material.AIR)
{ {
int below = block.getRelative(BlockFace.DOWN).getTypeId(); int below = block.getRelative(BlockFace.DOWN).getTypeId();
if (below == 2 || below == 3) if (below == 2 || below == 3)
@ -285,9 +275,37 @@ public class LifeBonds extends Skill
} }
} }
_items.remove(cur);
cur.remove(); cur.remove();
return true;
} }
return false;
});
}
@EventHandler(priority = EventPriority.HIGH)
public void damage(CustomDamageEvent event)
{
if (event.IsCancelled() || event.GetCause() != DamageCause.ENTITY_ATTACK)
{
return;
}
Player damagee = event.GetDamageePlayer(), damager = event.GetDamagerPlayer(false);
if (damagee == null || damager == null)
{
return;
}
int level = getLevel(damager);
if (level == 0 || !_active.contains(damager))
{
return;
}
UtilPlayer.health(damager, 0.25 + 0.25 * level);
} }
@Override @Override
@ -295,4 +313,36 @@ public class LifeBonds extends Skill
{ {
_active.remove(player); _active.remove(player);
} }
private class LifeBondsData
{
Location _loc;
Player _target;
double _health;
LifeBondsData(org.bukkit.Location loc, Player target, double amount)
{
_loc = loc;
_target = target;
_health = amount;
}
boolean update()
{
if (!_target.isValid() || !_target.isOnline())
return true;
if (UtilMath.offsetSquared(_loc, _target.getLocation()) < 1)
{
UtilPlayer.health(_target, _health);
return true;
}
_loc.add(UtilAlg.getTrajectory(_loc, _target.getLocation().add(0, 0.8, 0)).multiply(2.5));
UtilParticle.PlayParticleToAll(ParticleType.HEART, _loc, 0, 0, 0, 0, 1, ViewDist.LONG);
return false;
}
}
} }

View File

@ -1,44 +0,0 @@
package mineplex.minecraft.game.classcombat.Skill.Mage;
import mineplex.core.common.util.UtilAlg;
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.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import org.bukkit.Location;
import org.bukkit.entity.Player;
public class LifeBondsData
{
private Location _loc;
private Player _target;
private double _health;
public LifeBondsData(org.bukkit.Location loc, Player target, double amount)
{
_loc = loc;
_target = target;
_health = amount;
}
public boolean Update()
{
if (!_target.isValid() || !_target.isOnline())
return true;
if (UtilMath.offset(_loc, _target.getLocation()) < 1)
{
UtilPlayer.health(_target, _health);
return true;
}
_loc.add(UtilAlg.getTrajectory(_loc, _target.getLocation().add(0, 0.8, 0)).multiply(0.9));
UtilParticle.PlayParticle(ParticleType.HEART, _loc, 0, 0, 0, 0, 1,
ViewDist.LONG, UtilServer.getPlayers());
return false;
}
}

View File

@ -1,22 +1,8 @@
package mineplex.minecraft.game.classcombat.Skill.Mage; package mineplex.minecraft.game.classcombat.Skill.Mage;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.updater.UpdateType;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.classcombat.Skill.SkillActive;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
@ -32,6 +18,19 @@ import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerEvent; import org.bukkit.event.player.PlayerEvent;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.updater.UpdateType;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.classcombat.Skill.SkillActive;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
public class LightningOrb extends SkillActive implements IThrown public class LightningOrb extends SkillActive implements IThrown
{ {
public static class LightningOrbEvent extends PlayerEvent public static class LightningOrbEvent extends PlayerEvent
@ -51,7 +50,7 @@ public class LightningOrb extends SkillActive implements IThrown
private final List<LivingEntity> _struck; private final List<LivingEntity> _struck;
public LightningOrbEvent(Player who, List<LivingEntity> struck) LightningOrbEvent(Player who, List<LivingEntity> struck)
{ {
super(who); super(who);
@ -81,7 +80,7 @@ public class LightningOrb extends SkillActive implements IThrown
SetDesc(new String[] SetDesc(new String[]
{ {
"Launch a lightning orb. Upon a direct", "Launch a lightning orb. Upon a direct",
"hit with player, or #5#-0.4 seconds, it will", "hit with player, or 1.7 seconds, it will",
"strike all enemies within #3#0.5 Blocks ", "strike all enemies within #3#0.5 Blocks ",
"with lightning, dealing #4#1 damage and", "with lightning, dealing #4#1 damage and",
"giving Slow 2 for 4 seconds." "giving Slow 2 for 4 seconds."
@ -91,7 +90,7 @@ public class LightningOrb extends SkillActive implements IThrown
@Override @Override
public boolean CustomCheck(Player player, int level) public boolean CustomCheck(Player player, int level)
{ {
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) if (UtilEnt.isInWater(player))
{ {
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false; return false;
@ -106,7 +105,7 @@ public class LightningOrb extends SkillActive implements IThrown
//Action //Action
Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()),new ItemBuilder(Material.DIAMOND_BLOCK).setTitle(UtilMath.random.nextDouble() + "").build()); Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()),new ItemBuilder(Material.DIAMOND_BLOCK).setTitle(UtilMath.random.nextDouble() + "").build());
item.setVelocity(player.getLocation().getDirection()); item.setVelocity(player.getLocation().getDirection());
Factory.Projectile().AddThrow(item, player, this, 5000 - (400 * level), true, true, false, false, Factory.Projectile().AddThrow(item, player, this, 1700, true, true, false, false,
Sound.FIZZ, 0.6f, 1.6f, ParticleType.FIREWORKS_SPARK, UpdateType.TICK, 0.4f); Sound.FIZZ, 0.6f, 1.6f, ParticleType.FIREWORKS_SPARK, UpdateType.TICK, 0.4f);
//Inform //Inform
@ -119,22 +118,28 @@ public class LightningOrb extends SkillActive implements IThrown
@Override @Override
public void Collide(LivingEntity target, Block block, ProjectileUser data) public void Collide(LivingEntity target, Block block, ProjectileUser data)
{ {
Strike(target, data); Strike(data);
} }
@Override @Override
public void Idle(ProjectileUser data) public void Idle(ProjectileUser data)
{ {
Strike(null, data); Strike(data);
} }
@Override @Override
public void Expire(ProjectileUser data) public void Expire(ProjectileUser data)
{ {
Strike(null, data); Strike(data);
} }
public void Strike(LivingEntity target, ProjectileUser data) @Override
public void ChunkUnload(ProjectileUser data)
{
data.getThrown().remove();
}
public void Strike(ProjectileUser data)
{ {
//Remove //Remove
data.getThrown().remove(); data.getThrown().remove();
@ -149,16 +154,14 @@ public class LightningOrb extends SkillActive implements IThrown
int level = getLevel(player); int level = getLevel(player);
if (level == 0) return; if (level == 0) return;
HashMap<LivingEntity, Double> hit = UtilEnt.getInRadius(data.getThrown().getLocation(), 3 + 0.5 * level);
List<LivingEntity> struck = new ArrayList<>(); List<LivingEntity> struck = new ArrayList<>();
//Lightning UtilEnt.getInRadius(data.getThrown().getLocation(), 3 + 0.5 * level).forEach((cur, scale) ->
for (LivingEntity cur : hit.keySet())
{ {
if (cur.equals(player)) if (cur.equals(player) || (cur instanceof Player && !Factory.Relation().canHurt(player, (Player) cur)))
continue; {
return;
}
//Inform //Inform
UtilPlayer.message(cur, F.main(GetClassType().name(), F.name(player.getName()) + " hit you with " + F.skill(GetName(level)) + ".")); UtilPlayer.message(cur, F.main(GetClassType().name(), F.name(player.getName()) + " hit you with " + F.skill(GetName(level)) + "."));
@ -167,22 +170,12 @@ public class LightningOrb extends SkillActive implements IThrown
cur.getWorld().strikeLightningEffect(cur.getLocation()); cur.getWorld().strikeLightningEffect(cur.getLocation());
//Damage Event //Damage Event
Factory.Damage().NewDamageEvent(cur, player, null, Factory.Damage().NewDamageEvent(cur, player, null, DamageCause.LIGHTNING, 4 + level, false, true, false, player.getName(), GetName());
DamageCause.LIGHTNING, 4 + level, false, true, false,
player.getName(), GetName());
struck.add(cur);
}
//Apply Conditions
for (LivingEntity cur : hit.keySet())
{
if (cur.equals(player))
continue;
Factory.Condition().Factory().Slow(GetName(), cur, player, 4, 1, false, true, true, true); Factory.Condition().Factory().Slow(GetName(), cur, player, 4, 1, false, true, true, true);
Factory.Condition().Factory().Shock(GetName(), cur, player, 1, false, true); Factory.Condition().Factory().Shock(GetName(), cur, player, 1, false, true);
}
struck.add(cur);
});
Bukkit.getPluginManager().callEvent(new LightningOrbEvent(player, struck)); Bukkit.getPluginManager().callEvent(new LightningOrbEvent(player, struck));
} }
@ -199,10 +192,4 @@ public class LightningOrb extends SkillActive implements IThrown
{ {
} }
@Override
public void ChunkUnload(ProjectileUser data)
{
data.getThrown().remove();
}
} }

View File

@ -22,7 +22,7 @@ public class MagmaBlade extends Skill
SetDesc(new String[] SetDesc(new String[]
{ {
"Your sword deals an additional,", "Your sword deals an additional,",
"#0.25#0.25 damage to burning opponents,", "#0#1 damage to burning opponents,",
"but also extinguishes them.", "but also extinguishes them.",
}); });
} }
@ -54,7 +54,7 @@ public class MagmaBlade extends Skill
if (level == 0) return; if (level == 0) return;
//Damage //Damage
event.AddMod(damager.getName(), GetName(), 0.25 + 0.25 * level, true); event.AddMod(damager.getName(), GetName(), level, true);
//Effect //Effect
damager.getWorld().playSound(damager.getLocation(), Sound.FIZZ, 0.8f, 0f); damager.getWorld().playSound(damager.getLocation(), Sound.FIZZ, 0.8f, 0f);

View File

@ -6,11 +6,10 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.core.common.util.UtilGear;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.minecraft.game.classcombat.Skill.Skill; import mineplex.minecraft.game.classcombat.Skill.Skill;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class NullBlade extends Skill public class NullBlade extends Skill
{ {
@ -21,7 +20,7 @@ public class NullBlade extends Skill
SetDesc(new String[] SetDesc(new String[]
{ {
"Your attacks suck the life from", "Your attacks suck the life from",
"opponents, restoring #2#2 energy." "opponents, restoring #4#2 energy."
}); });
} }
@ -46,7 +45,7 @@ public class NullBlade extends Skill
if (damagee == null) return; if (damagee == null) return;
//Energy //Energy
Factory.Energy().ModifyEnergy(damager, 2 + 2 * level); Factory.Energy().ModifyEnergy(damager, 4 + 2 * level);
//Damage //Damage
event.AddMod(damager.getName(), GetName(), 0, false); event.AddMod(damager.getName(), GetName(), 0, false);

View File

@ -83,7 +83,7 @@ public class Rupture extends SkillActiveCharge
@Override @Override
public boolean CustomCheck(Player player, int level) public boolean CustomCheck(Player player, int level)
{ {
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) if (UtilEnt.isInWater(player))
{ {
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false; return false;
@ -226,13 +226,15 @@ public class Rupture extends SkillActiveCharge
public boolean CanTravel(Block block) public boolean CanTravel(Block block)
{ {
int id = block.getTypeId(); return !UtilBlock.liquid(block)
//return true
/*int id = block.getTypeId();
return (id == 1 || return (id == 1 ||
id == 2 || id == 2 ||
id == 3 || id == 3 ||
id == 12 || id == 12 ||
id == 13); id == 13)*/;
} }
public void DisplayRupture(Player cur) public void DisplayRupture(Player cur)

View File

@ -2,32 +2,30 @@ package mineplex.minecraft.game.classcombat.Skill.Mage;
import java.util.HashMap; import java.util.HashMap;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilFirework;
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.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.minecraft.game.classcombat.Skill.SkillChargeSword;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import org.bukkit.Color; import org.bukkit.Color;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.classcombat.Skill.SkillChargeSword;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class StaticLazer extends SkillChargeSword public class StaticLazer extends SkillChargeSword
{ {
public StaticLazer(SkillFactory skills, String name, public StaticLazer(SkillFactory skills, String name,
@ -36,7 +34,7 @@ public class StaticLazer extends SkillChargeSword
{ {
super(skills, name, classType, skillType, cost, maxLevel, super(skills, name, classType, skillType, cost, maxLevel,
0.012f, 0.004f, 0.012f, 0.004f,
15000, -1000, true, true, 9500, -500, true, true,
false, true); false, true);
SetDesc(new String[] SetDesc(new String[]
@ -47,7 +45,7 @@ public class StaticLazer extends SkillChargeSword
GetChargeString(), GetChargeString(),
"Taking damage cancels charge.", "Taking damage cancels charge.",
"", "",
"Deals #6#1 damage and travels up to", "Deals #6#2 damage and travels up to",
"#20#10 blocks.", "#20#10 blocks.",
}); });
@ -59,7 +57,7 @@ public class StaticLazer extends SkillChargeSword
@Override @Override
public String GetRechargeString() public String GetRechargeString()
{ {
return "Recharge: " + "#12#-1 Seconds"; return "Recharge: " + "#9#-0.5 Seconds";
} }
@Override @Override
@ -77,7 +75,7 @@ public class StaticLazer extends SkillChargeSword
//Action //Action
double curRange = 0; double curRange = 0;
double maxRange = 10 + 5 * level; double maxRange = 20 + 10 * level;
while (curRange <= maxRange) while (curRange <= maxRange)
{ {
Location newTarget = player.getEyeLocation().add(player.getLocation().getDirection().multiply(curRange)); Location newTarget = player.getEyeLocation().add(player.getLocation().getDirection().multiply(curRange));
@ -115,7 +113,7 @@ public class StaticLazer extends SkillChargeSword
if (other.equals(player)) if (other.equals(player))
continue; continue;
double damage = 7 + 1*level; double damage = 6 + 2 * level;
//Damage Event //Damage Event
Factory.Damage().NewDamageEvent(other, player, null, Factory.Damage().NewDamageEvent(other, player, null,
DamageCause.CUSTOM, damage * charge, true, true, false, DamageCause.CUSTOM, damage * charge, true, true, false,

View File

@ -1,6 +1,7 @@
package mineplex.minecraft.game.classcombat.Skill.Mage; package mineplex.minecraft.game.classcombat.Skill.Mage;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -8,6 +9,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.event.player.PlayerDropItemEvent;
import mineplex.core.common.util.UtilEnt;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
@ -22,7 +24,8 @@ import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
public class Void extends Skill public class Void extends Skill
{ {
private HashSet<Player> _active = new HashSet<Player>();
private final Set<Player> _active = new HashSet<>();
public Void(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) public Void(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels)
{ {
@ -37,7 +40,7 @@ public class Void extends Skill
"use no energy to swing weapons.", "use no energy to swing weapons.",
"", "",
"Reduces incoming damage by #1#1 , but", "Reduces incoming damage by #1#1 , but",
"burns #11#-1 Energy per 1 damage reduced." "burns #8#-1 Energy per 1 damage reduced."
}); });
} }
@ -117,7 +120,7 @@ public class Void extends Skill
if (!_active.contains(cur)) if (!_active.contains(cur))
continue; continue;
if (cur.getLocation().getBlock().getTypeId() == 8 || cur.getLocation().getBlock().getTypeId() == 9) if (UtilEnt.isInWater(cur))
{ {
UtilPlayer.message(cur, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(cur, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
_active.remove(cur); _active.remove(cur);
@ -184,7 +187,7 @@ public class Void extends Skill
int level = getLevel(damagee); int level = getLevel(damagee);
if (level == 0) return; if (level == 0) return;
double dmgToEnergy = 11 - level; double dmgToEnergy = 8 - level;
int dmgLower = 1 + level; int dmgLower = 1 + level;
int currentEnergy = (int)Factory.Energy().GetCurrent(damagee); int currentEnergy = (int)Factory.Energy().GetCurrent(damagee);

View File

@ -11,6 +11,7 @@ import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import mineplex.core.common.util.UtilEnt;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
@ -57,7 +58,7 @@ public class Agility extends SkillActive
@Override @Override
public boolean CustomCheck(Player player, int level) public boolean CustomCheck(Player player, int level)
{ {
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) if (UtilEnt.isInWater(player))
{ {
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false; return false;

View File

@ -1,26 +1,27 @@
package mineplex.minecraft.game.classcombat.Skill.Ranger; package mineplex.minecraft.game.classcombat.Skill.Ranger;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Set;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile; import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityShootBowEvent; import org.bukkit.event.entity.EntityShootBowEvent;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.minecraft.game.classcombat.Skill.Skill; import mineplex.minecraft.game.classcombat.Skill.Skill;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class BarbedArrows extends Skill public class BarbedArrows extends Skill
{ {
private HashSet<Projectile> _arrows = new HashSet<Projectile>();
private final Set<Entity> _arrows = new HashSet<>();
public BarbedArrows(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) public BarbedArrows(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels)
{ {
@ -40,62 +41,70 @@ public class BarbedArrows extends Skill
public void bowShoot(EntityShootBowEvent event) public void bowShoot(EntityShootBowEvent event)
{ {
int level = getLevel(event.getEntity()); int level = getLevel(event.getEntity());
if (level == 0) if (level == 0)
{
return; return;
}
if (!(event.getProjectile() instanceof Projectile)) _arrows.add(event.getProjectile());
return;
_arrows.add((Projectile)event.getProjectile());
} }
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
public void damage(CustomDamageEvent event) public void damage(CustomDamageEvent event)
{ {
if (event.IsCancelled()) if (event.IsCancelled())
{
return; return;
}
if (event.GetCause() != DamageCause.PROJECTILE)
return;
Projectile projectile = event.GetProjectile(); Projectile projectile = event.GetProjectile();
if (projectile == null) return;
if (projectile == null || !_arrows.remove(projectile))
{
return;
}
LivingEntity damagee = event.GetDamageeEntity(); LivingEntity damagee = event.GetDamageeEntity();
if (damagee == null) return;
Player damager = event.GetDamagerPlayer(true); Player damager = event.GetDamagerPlayer(true);
if (damager == null) return;
if (damagee == null || damager == null)
{
return;
}
//Level //Level
int level = getLevel(damager); int level = getLevel(damager);
if (level == 0) return; if (level == 0)
{
return;
}
//Condition
int duration = 3 + level;
Factory.Condition().Factory().Slow(GetName(), damagee, damager, duration, 0, false, true, true, true);
Factory.Condition().Factory().Regen(GetName(), damagee, damager, duration, 0, false, false, false);
Factory.Condition().Factory().ArcadeHungerDisable(GetName(), damagee, damager, duration, false);
Player damageePlayer = event.GetDamageePlayer(); Player damageePlayer = event.GetDamageePlayer();
if (damageePlayer != null) if (damageePlayer != null)
{
damageePlayer.setFoodLevel(2);
damageePlayer.setSprinting(false); damageePlayer.setSprinting(false);
}
//Damage
event.AddMod(damager.getName(), GetName(), 0, false);
//Condition
Factory.Condition().Factory().Slow(GetName(), damagee, damager, (projectile.getVelocity().length() / 3) * (2 + level), 0, false, true, true, true);
} }
@EventHandler @EventHandler
public void clean(UpdateEvent event) public void clean(UpdateEvent event)
{ {
if (event.getType() != UpdateType.SEC) if (event.getType() != UpdateType.SLOW)
return;
for (Iterator<Projectile> arrowIterator = _arrows.iterator(); arrowIterator.hasNext();)
{ {
Projectile arrow = arrowIterator.next(); return;
if (arrow.isDead() || !arrow.isValid())
arrowIterator.remove();
} }
_arrows.removeIf(arrow -> !arrow.isValid());
} }
@Override @Override

View File

@ -61,7 +61,7 @@ public class Disengage extends SkillActive
@Override @Override
public boolean CustomCheck(Player player, int level) public boolean CustomCheck(Player player, int level)
{ {
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) if (UtilEnt.isInWater(player))
{ {
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false; return false;

View File

@ -3,9 +3,7 @@ package mineplex.minecraft.game.classcombat.Skill.Ranger;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.Set;
import org.bukkit.Location; import org.bukkit.Location;
@ -41,8 +39,9 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class ExplosiveShot extends SkillActive public class ExplosiveShot extends SkillActive
{ {
private HashSet<Arrow> _arrows = new HashSet<Arrow>();
private HashSet<Player> _active = new HashSet<Player>(); private final Set<Arrow> _arrows = new HashSet<>();
private final Set<Player> _active = new HashSet<>();
public ExplosiveShot(SkillFactory skills, String name, ClassType classType, SkillType skillType, public ExplosiveShot(SkillFactory skills, String name, ClassType classType, SkillType skillType,
int cost, int levels, int cost, int levels,
@ -74,7 +73,7 @@ public class ExplosiveShot extends SkillActive
@Override @Override
public boolean CustomCheck(Player player, int level) public boolean CustomCheck(Player player, int level)
{ {
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) if (UtilEnt.isInWater(player))
{ {
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false; return false;

View File

@ -1,7 +1,7 @@
package mineplex.minecraft.game.classcombat.Skill.Ranger; package mineplex.minecraft.game.classcombat.Skill.Ranger;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Set;
import org.bukkit.Effect; import org.bukkit.Effect;
import org.bukkit.EntityEffect; import org.bukkit.EntityEffect;
@ -9,35 +9,31 @@ import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.Arrow; import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile; import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityShootBowEvent; import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.classcombat.Skill.SkillActive; import mineplex.minecraft.game.classcombat.Skill.SkillActive;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class HealingShot extends SkillActive public class HealingShot extends SkillActive
{ {
private HashSet<Entity> _arrows = new HashSet<Entity>();
private HashSet<Player> _active = new HashSet<Player>(); private final Set<Entity> _arrows = new HashSet<>();
private final Set<Player> _active = new HashSet<>();
public HealingShot(SkillFactory skills, String name, ClassType classType, SkillType skillType, public HealingShot(SkillFactory skills, String name, ClassType classType, SkillType skillType,
int cost, int levels, int cost, int levels,
@ -70,7 +66,7 @@ public class HealingShot extends SkillActive
@Override @Override
public boolean CustomCheck(Player player, int level) public boolean CustomCheck(Player player, int level)
{ {
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) if (UtilEnt.isInWater(player))
{ {
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false; return false;
@ -112,46 +108,31 @@ public class HealingShot extends SkillActive
_arrows.add(event.getProjectile()); _arrows.add(event.getProjectile());
} }
@SuppressWarnings("deprecation") @EventHandler
@EventHandler(priority = EventPriority.NORMAL) public void arrowHit(CustomDamageEvent event)
public void arrowHit(EntityDamageEvent event) {
Player damager = event.GetDamagerPlayer(true);
Projectile projectile = event.GetProjectile();
if (!_arrows.remove(projectile))
{ {
if (event.getCause() != DamageCause.PROJECTILE)
return; return;
}
if (!(event instanceof EntityDamageByEntityEvent))
return;
EntityDamageByEntityEvent eventEE = (EntityDamageByEntityEvent)event;
if (!(eventEE.getDamager() instanceof Projectile))
return;
Projectile projectile = (Projectile)eventEE.getDamager();
//Not Pin Down Arrow
if (!_arrows.contains((Entity)projectile))
return;
if (!(event.getEntity() instanceof Player))
return;
Player damagee = (Player)event.getEntity();
if (projectile.getShooter() == null)
return;
if (!(projectile.getShooter() instanceof Player))
return;
Player damager = (Player)projectile.getShooter();
//Level //Level
int level = getLevel(damager); int level = getLevel(damager);
if (level == 0) return; if (level == 0)
{
return;
}
Player damagee = event.GetDamageePlayer();
if (damagee == null)
{
return;
}
//Remove
_arrows.remove(projectile);
projectile.remove(); projectile.remove();
//Regen //Regen
@ -184,9 +165,9 @@ public class HealingShot extends SkillActive
"You hit " + F.name(UtilEnt.getName(damagee)) +" with " + F.skill(GetName(level)) + ".")); "You hit " + F.name(UtilEnt.getName(damagee)) +" with " + F.skill(GetName(level)) + "."));
//Particles //Particles
UtilParticle.PlayParticle(ParticleType.HEART, damagee.getLocation(), UtilParticle.PlayParticleToAll(ParticleType.HEART, damagee.getLocation(),
(float)(Math.random() - 0.5), (float)(Math.random() + 0.5), (float)(Math.random() - 0.5), 2f, 12, (float)(Math.random() - 0.5), (float)(Math.random() + 0.5), (float)(Math.random() - 0.5), 2f, 12,
ViewDist.MAX, UtilServer.getPlayers()); ViewDist.LONG);
//Remove //Remove
projectile.remove(); projectile.remove();
@ -200,8 +181,7 @@ public class HealingShot extends SkillActive
for (Entity ent : _arrows) for (Entity ent : _arrows)
{ {
UtilParticle.PlayParticle(ParticleType.HEART, ent.getLocation(), 0, 0, 0, 0, 1, UtilParticle.PlayParticleToAll(ParticleType.HEART, ent.getLocation(), 0, 0, 0, 0, 1, ViewDist.LONG);
ViewDist.MAX, UtilServer.getPlayers());
} }
} }
@ -211,13 +191,7 @@ public class HealingShot extends SkillActive
if (event.getType() != UpdateType.SEC) if (event.getType() != UpdateType.SEC)
return; return;
for (Iterator<Entity> arrowIterator = _arrows.iterator(); arrowIterator.hasNext();) _arrows.removeIf(arrow -> !arrow.isValid() || arrow.isOnGround());
{
Entity arrow = arrowIterator.next();
if (arrow.isDead() || !arrow.isValid() || arrow.isOnGround())
arrowIterator.remove();
}
} }
@Override @Override

View File

@ -36,11 +36,11 @@ public class HeavyArrows extends Skill
SetDesc(new String[] SetDesc(new String[]
{ {
"Your arrows are extremely heavy,", "Your arrows are extremely heavy,",
"moving #5#5 % slower and dealing", "moving 20% slower and dealing",
"an additional #10#10 % knockback", "an additional #10#10 % knockback",
"as well as #1#1 additional damage.", "as well as #1#1 additional damage.",
"", "",
"You also receive #12#6 % reversed", "You also receive 30% reversed",
"velocity of your arrows while not", "velocity of your arrows while not",
"sneaking.", "sneaking.",
}); });
@ -64,13 +64,13 @@ public class HeavyArrows extends Skill
//Backboost //Backboost
if (!player.isSneaking() && Recharge.Instance.use(player, GetName(), 750, false, false)) if (!player.isSneaking() && Recharge.Instance.use(player, GetName(), 750, false, false))
{ {
double vel = (event.getProjectile().getVelocity().length() * (0.12 + 0.06 * level)); double vel = (event.getProjectile().getVelocity().length() * 0.30);
UtilAction.velocity(player, player.getLocation().getDirection().multiply(-1), vel, UtilAction.velocity(player, player.getLocation().getDirection().multiply(-1), vel,
false, 0, 0.3, 0.6, true); false, 0, 0.3, 0.6, true);
} }
//Decrease Speed //Decrease Speed
event.getProjectile().setVelocity(event.getProjectile().getVelocity().multiply(0.95 - (level * 0.05))); event.getProjectile().setVelocity(event.getProjectile().getVelocity().multiply(.80));
_arrows.add(event.getProjectile()); _arrows.add(event.getProjectile());
} }

View File

@ -59,7 +59,7 @@
// @Override // @Override
// public boolean CustomCheck(Player player, int level) // public boolean CustomCheck(Player player, int level)
// { // {
// if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) // if (UtilEnt.isInWater(player))
// { // {
// UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(getName()) + " in water.")); // UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(getName()) + " in water."));
// return false; // return false;

View File

@ -1,19 +1,21 @@
package mineplex.minecraft.game.classcombat.Skill.Ranger; package mineplex.minecraft.game.classcombat.Skill.Ranger;
import org.bukkit.*; import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile; import org.bukkit.entity.Projectile;
import org.bukkit.event.*; import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.*; import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.metadata.FixedMetadataValue;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.recharge.Recharge;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.classcombat.Skill.Skill; import mineplex.minecraft.game.classcombat.Skill.Skill;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import org.bukkit.metadata.FixedMetadataValue;
public class Longshot extends Skill public class Longshot extends Skill
{ {
@ -24,49 +26,66 @@ public class Longshot extends Skill
SetDesc(new String[] SetDesc(new String[]
{ {
"Arrows do an additional 1 damage", "Active by default, hold sneak to not use it.",
"for every #4.5#-0.5 Blocks they travelled,",
"however, their base damage is",
"reduced by 5.",
"", "",
"Maximum of #6#6 additional damage." "Arrows fire 20% faster and",
"deal an additional 1 damage",
"for every #4.5#-0.5 Blocks they travelled.",
"",
"Maximum of 12 additional damage."
}); });
} }
@Override
public String GetRechargeString()
{
return "Recharge: 7#-1 Seconds.";
}
@EventHandler @EventHandler
public void ShootBow(EntityShootBowEvent event) public void ShootBow(EntityShootBowEvent event)
{ {
if (!(event.getEntity() instanceof Player)) int level = getLevel(event.getEntity());
return;
int level = getLevel((Player) event.getEntity());
if (level == 0) if (level == 0)
{
return; return;
}
// Save Player player = (Player) event.getEntity();
event.getProjectile().setMetadata("ShotFrom", Entity projectile = event.getProjectile();
new FixedMetadataValue(this.Factory.getPlugin(), event.getProjectile().getLocation()));
if (player.isSneaking() || !Recharge.Instance.use(player, GetName(), 7000 - (1000 * level), true, false))
{
return;
}
player.getWorld().playSound(player.getLocation(), Sound.FIZZ, 1, 1);
projectile.setVelocity(projectile.getVelocity().multiply(1.2));
projectile.setMetadata("ShotFrom", new FixedMetadataValue(Factory.getPlugin(), projectile.getLocation()));
} }
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
public void Damage(CustomDamageEvent event) public void Damage(CustomDamageEvent event)
{ {
if (event.IsCancelled()) if (event.IsCancelled())
{
return; return;
}
if (event.GetCause() != DamageCause.PROJECTILE)
return;
Projectile projectile = event.GetProjectile(); Projectile projectile = event.GetProjectile();
if (projectile == null)
return;
if (!projectile.hasMetadata("ShotFrom")) if (projectile == null || !projectile.hasMetadata("ShotFrom"))
{
return; return;
}
Player damager = event.GetDamagerPlayer(true); Player damager = event.GetDamagerPlayer(true);
if (damager == null) if (damager == null)
{
return; return;
}
int level = getLevel(damager); int level = getLevel(damager);
@ -74,10 +93,8 @@ public class Longshot extends Skill
double length = UtilMath.offset(loc, projectile.getLocation()); double length = UtilMath.offset(loc, projectile.getLocation());
// Damage // Damage
double damage = Math.min(6 + 6 * level, (length / (4.5 - 0.5 * level)) - 5); double damage = length / (4.5 - 0.5 * level);
damage = Math.max(Math.min(damage, 12), 0);
if (damage < 0)
damage = 0;
event.AddMod(damager.getName(), GetName(), damage, damage > 0); event.AddMod(damager.getName(), GetName(), damage, damage > 0);
} }

View File

@ -70,7 +70,7 @@ public class NapalmShot extends SkillActive
@Override @Override
public boolean CustomCheck(Player player, int level) public boolean CustomCheck(Player player, int level)
{ {
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) if (UtilEnt.isInWater(player))
{ {
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false; return false;
@ -125,7 +125,7 @@ public class NapalmShot extends SkillActive
Projectile projectile = event.GetProjectile(); Projectile projectile = event.GetProjectile();
if (projectile == null) return; if (projectile == null) return;
if (!_arrows.contains((Entity)projectile)) if (!_arrows.contains(projectile))
return; return;
LivingEntity damagee = event.GetDamageeEntity(); LivingEntity damagee = event.GetDamageeEntity();
@ -206,13 +206,7 @@ public class NapalmShot extends SkillActive
if (event.getType() != UpdateType.SEC) if (event.getType() != UpdateType.SEC)
return; return;
for (Iterator<Entity> arrowIterator = _arrows.iterator(); arrowIterator.hasNext();) _arrows.removeIf(arrow -> !arrow.isValid() || arrow.isOnGround());
{
Entity arrow = arrowIterator.next();
if (arrow.isDead() || !arrow.isValid() || arrow.isOnGround())
arrowIterator.remove();
}
} }
@Override @Override

View File

@ -1,21 +1,8 @@
package mineplex.minecraft.game.classcombat.Skill.Ranger; package mineplex.minecraft.game.classcombat.Skill.Ranger;
import java.util.Iterator; import java.util.Map;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.minecraft.game.classcombat.Skill.SkillChargeBow;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.Arrow; import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
@ -26,15 +13,26 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.classcombat.Skill.SkillChargeBow;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class Overcharge extends SkillChargeBow public class Overcharge extends SkillChargeBow
{ {
private WeakHashMap<Arrow, Double> _arrows = new WeakHashMap<Arrow, Double>();
private final Map<Arrow, Double> _arrows = new WeakHashMap<>();
public Overcharge(SkillFactory skills, String name, ClassType classType, public Overcharge(SkillFactory skills, String name, ClassType classType,
SkillType skillType, int cost, int maxLevel) SkillType skillType, int cost, int maxLevel)
{ {
super(skills, name, classType, skillType, cost, maxLevel, super(skills, name, classType, skillType, cost, maxLevel,
0.016f, 0.008f, false, true); 0.0225f, 0.005f, false, true);
SetDesc(new String[] SetDesc(new String[]
{ {
@ -42,15 +40,22 @@ public class Overcharge extends SkillChargeBow
"", "",
GetChargeString(), GetChargeString(),
"", "",
"Deals up to #1.5#1.5 bonus damage." "Deals up to #1.5#1.5 bonus damage.",
"Fully charging increases arrow speed by #5#5 %"
}); });
} }
@Override @Override
public void DoSkillCustom(Player player, float charge, Arrow arrow) public void DoSkillCustom(Player player, float charge, Arrow arrow)
{ {
double damage = charge * (1.5 + 1.5 * getLevel(player)); double damage = charge * (1.5 * getLevel(player));
_arrows.put(arrow, damage); _arrows.put(arrow, damage);
if (charge >= 1)
{
//Increase Speed
arrow.setVelocity(arrow.getVelocity().multiply(1 + (.05 * getLevel(player))));
}
} }
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
@ -95,8 +100,7 @@ public class Overcharge extends SkillChargeBow
for (Entity ent : _arrows.keySet()) for (Entity ent : _arrows.keySet())
{ {
UtilParticle.PlayParticle(ParticleType.RED_DUST, ent.getLocation(), 0, 0, 0, 0, 1, UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, ent.getLocation(), null, 0, 1, ViewDist.LONG);
ViewDist.MAX, UtilServer.getPlayers());
} }
} }
@ -106,12 +110,6 @@ public class Overcharge extends SkillChargeBow
if (event.getType() != UpdateType.SEC) if (event.getType() != UpdateType.SEC)
return; return;
for (Iterator<Arrow> arrowIterator = _arrows.keySet().iterator(); arrowIterator.hasNext();) _arrows.keySet().removeIf(arrow -> !arrow.isValid() || arrow.isOnGround());
{
Arrow arrow = arrowIterator.next();
if (arrow.isDead() || !arrow.isValid() || arrow.isOnGround())
arrowIterator.remove();
}
} }
} }

View File

@ -1,6 +1,9 @@
package mineplex.minecraft.game.classcombat.Skill.Ranger; package mineplex.minecraft.game.classcombat.Skill.Ranger;
import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.bukkit.Effect; import org.bukkit.Effect;
import org.bukkit.EntityEffect; import org.bukkit.EntityEffect;
@ -15,6 +18,8 @@ import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.condition.Condition;
import mineplex.minecraft.game.core.condition.events.ConditionExpireEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
@ -27,7 +32,9 @@ import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
public class PinDown extends SkillActive public class PinDown extends SkillActive
{ {
private HashSet<Projectile> _arrows = new HashSet<Projectile>();
private final Set<Projectile> _arrows = new HashSet<>();
private final Map<Player, Integer> _foodLevel = new HashMap<>();
public PinDown(SkillFactory skills, String name, ClassType classType, SkillType skillType, public PinDown(SkillFactory skills, String name, ClassType classType, SkillType skillType,
int cost, int levels, int cost, int levels,
@ -53,7 +60,7 @@ public class PinDown extends SkillActive
@Override @Override
public boolean CustomCheck(Player player, int level) public boolean CustomCheck(Player player, int level)
{ {
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) if (UtilEnt.isInWater(player))
{ {
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false; return false;
@ -119,6 +126,8 @@ public class PinDown extends SkillActive
//Cripple //Cripple
double dur = 3 + level; double dur = 3 + level;
Factory.Condition().Factory().Slow(GetName(), damagee, damager, dur, 3, false, true, true, true); Factory.Condition().Factory().Slow(GetName(), damagee, damager, dur, 3, false, true, true, true);
Factory.Condition().Factory().Jump(GetName(), damagee, damager, dur, 250, false, true, true);
Factory.Condition().Factory().ArcadeHungerDisable(GetName(), damagee, damager, dur, false);
//Damage //Damage
event.AddMod(damager.getName(), GetName(), -2, true); event.AddMod(damager.getName(), GetName(), -2, true);
@ -128,6 +137,13 @@ public class PinDown extends SkillActive
for (int i=0 ; i<3 ; i++) for (int i=0 ; i<3 ; i++)
damagee.playEffect(EntityEffect.HURT); damagee.playEffect(EntityEffect.HURT);
Player damgeePlayer = event.GetDamageePlayer();
if (damgeePlayer != null)
{
_foodLevel.put(damgeePlayer, damgeePlayer.getFoodLevel());
damgeePlayer.setFoodLevel(1);
}
//Clean //Clean
_arrows.remove(projectile); _arrows.remove(projectile);
projectile.remove(); projectile.remove();
@ -141,15 +157,29 @@ public class PinDown extends SkillActive
public void Clean(UpdateEvent event) public void Clean(UpdateEvent event)
{ {
if (event.getType() != UpdateType.SEC) if (event.getType() != UpdateType.SEC)
{
return; return;
HashSet<Projectile> remove = new HashSet<Projectile>(); }
for (Projectile cur : _arrows) _arrows.removeIf(projectile -> projectile.isDead() || !projectile.isValid());
if (cur.isDead() || !cur.isValid()) _foodLevel.keySet().removeIf(player -> !player.isOnline());
remove.add(cur); }
for (Projectile cur : remove) @EventHandler
_arrows.remove(cur); public void conditionEnd(ConditionExpireEvent event)
{
Condition condition = event.getCondition();
LivingEntity entity = condition.GetEnt();
if (event.getCondition().GetReason().equals(GetName()))
{
Integer food = _foodLevel.remove(entity);
if (food != null && entity instanceof Player)
{
((Player) entity).setFoodLevel(food);
}
}
} }
@Override @Override

View File

@ -28,7 +28,7 @@ public class VitalitySpores extends Skill
SetDesc(new String[] SetDesc(new String[]
{ {
"After getting hit, if no damage is taken", "After getting hit, if no damage is taken",
"for 10 Seconds then you will receive", "for 8 Seconds then you will receive",
"Regeneration #2#0 for #5#1 Seconds", "Regeneration #2#0 for #5#1 Seconds",
}); });
} }
@ -62,7 +62,7 @@ public class VitalitySpores extends Skill
{ {
Entry<Player, Long> entry = iterator.next(); Entry<Player, Long> entry = iterator.next();
if (UtilTime.elapsed(entry.getValue(), 10000)) if (UtilTime.elapsed(entry.getValue(), 8000))
{ {
iterator.remove(); iterator.remove();
entry.getKey().addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, (20 * (5 + getLevel(entry.getKey()))), 1)); entry.getKey().addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, (20 * (5 + getLevel(entry.getKey()))), 1));

View File

@ -1,6 +1,8 @@
package mineplex.minecraft.game.classcombat.Skill.Ranger; package mineplex.minecraft.game.classcombat.Skill.Ranger;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import org.bukkit.Material; import org.bukkit.Material;
@ -13,28 +15,30 @@ import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilServer;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.condition.Condition.ConditionType; import mineplex.core.common.util.UtilServer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.classcombat.Skill.SkillActive; import mineplex.minecraft.game.classcombat.Skill.SkillActive;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class WolfsFury extends SkillActive public class WolfsFury extends SkillActive
{ {
private WeakHashMap<Player, Long> _active = new WeakHashMap<Player, Long>();
private HashSet<Player> _swing = new HashSet<Player>(); private final Map<Player, Long> _active = new WeakHashMap<>();
private HashSet<Player> _miss = new HashSet<Player>(); private final Set<Player> _swing = new HashSet<>();
private final Set<Player> _miss = new HashSet<>();
public WolfsFury(SkillFactory skills, String name, ClassType classType, SkillType skillType, public WolfsFury(SkillFactory skills, String name, ClassType classType, SkillType skillType,
int cost, int levels, int cost, int levels,
@ -53,7 +57,7 @@ public class WolfsFury extends SkillActive
SetDesc(new String[] SetDesc(new String[]
{ {
"Summon the power of the wolf, gaining", "Summon the power of the wolf, gaining",
"Strength 3 for #2#2 seconds, and giving", "Strength 4 for #2#2 seconds, and giving",
"no knockback on your attacks.", "no knockback on your attacks.",
"", "",
"If you miss two consecutive attacks,", "If you miss two consecutive attacks,",
@ -64,7 +68,7 @@ public class WolfsFury extends SkillActive
@Override @Override
public boolean CustomCheck(Player player, int level) public boolean CustomCheck(Player player, int level)
{ {
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) if (UtilEnt.isInWater(player))
{ {
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false; return false;
@ -80,7 +84,7 @@ public class WolfsFury extends SkillActive
_active.put(player, System.currentTimeMillis() + 8000); _active.put(player, System.currentTimeMillis() + 8000);
//Condition //Condition
Factory.Condition().Factory().Strength(GetName(), player, player, 2 + 2*level, 2, false, true, true); Factory.Condition().Factory().Strength(GetName(), player, player, 2 + 2*level, 3, false, true, true);
//Inform //Inform
UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + ".")); UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + "."));
@ -92,18 +96,21 @@ public class WolfsFury extends SkillActive
@EventHandler @EventHandler
public void Expire(UpdateEvent event) public void Expire(UpdateEvent event)
{ {
//End Skill if (event.getType() != UpdateType.FAST)
if (event.getType() == UpdateType.FAST)
{ {
HashSet<Player> expired = new HashSet<Player>(); return;
for (Player cur : _active.keySet())
if (System.currentTimeMillis() > _active.get(cur))
expired.add(cur);
for (Player cur : expired)
End(cur);
} }
_active.entrySet().removeIf(entry ->
{
if (System.currentTimeMillis() > entry.getValue())
{
End(entry.getKey());
return true;
}
return false;
});
} }
@EventHandler @EventHandler
@ -157,26 +164,23 @@ public class WolfsFury extends SkillActive
public void Miss(UpdateEvent event) public void Miss(UpdateEvent event)
{ {
if (event.getType() != UpdateType.TICK) if (event.getType() != UpdateType.TICK)
{
return; return;
}
HashSet<Player> expired = new HashSet<Player>(); _swing.removeIf(player ->
for (Player cur : _swing)
expired.add(cur);
for (Player cur : expired)
{ {
_swing.remove(cur); if (_miss.remove(player))
if (_miss.remove(cur))
{ {
End(cur); End(player);
} }
else else
{ {
_miss.add(cur); _miss.add(player);
}
} }
return true;
});
} }
public void End(Player player) public void End(Player player)
@ -198,9 +202,9 @@ public class WolfsFury extends SkillActive
for (Player player : _active.keySet()) for (Player player : _active.keySet())
{ {
UtilParticle.PlayParticle(ParticleType.RED_DUST, player.getLocation(), UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, player.getLocation(),
(float)(Math.random() - 0.5), 0.2f + (float)(Math.random() * 1), (float)(Math.random() - 0.5), 0, 4, (float)(Math.random() - 0.5), 0.2f + (float)(Math.random() * 1), (float)(Math.random() - 0.5), 0, 4,
ViewDist.LONG, UtilServer.getPlayers()); ViewDist.LONG);
} }
} }

View File

@ -1,20 +1,5 @@
package mineplex.minecraft.game.classcombat.Skill.Ranger; package mineplex.minecraft.game.classcombat.Skill.Ranger;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.core.common.util.F;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction;
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.SkillChargeSword;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import org.bukkit.GameMode;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -22,6 +7,20 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction;
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.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.classcombat.Skill.SkillChargeSword;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class WolfsPounce extends SkillChargeSword public class WolfsPounce extends SkillChargeSword
{ {
private NautHashMap<Player, Long> _live = new NautHashMap<Player, Long>(); private NautHashMap<Player, Long> _live = new NautHashMap<Player, Long>();
@ -82,7 +81,7 @@ public class WolfsPounce extends SkillChargeSword
//End //End
for (Player player : GetUsers()) for (Player player : GetUsers())
{ {
if (!UtilEnt.isGrounded(player)) if (!UtilEnt.onBlock(player))
continue; continue;
if (!_live.containsKey(player)) if (!_live.containsKey(player))

View File

@ -127,13 +127,13 @@ public abstract class Skill implements ISkill, Listener
if (GetSkillType() == SkillType.Sword) if (GetSkillType() == SkillType.Sword)
if (UtilGear.isMat(player.getItemInHand(), Material.GOLD_SWORD)) if (UtilGear.isMat(player.getItemInHand(), Material.GOLD_SWORD))
level++; level += 2;
if (GetSkillType() == SkillType.Axe) if (GetSkillType() == SkillType.Axe)
if (UtilGear.isMat(player.getItemInHand(), Material.GOLD_AXE)) if (UtilGear.isMat(player.getItemInHand(), Material.GOLD_AXE))
level++; level += 2;
return level; return Math.min(level, _maxLevel + 1);
} }
@Override @Override

View File

@ -1,6 +1,8 @@
package mineplex.minecraft.game.classcombat.Skill; package mineplex.minecraft.game.classcombat.Skill;
import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
@ -28,8 +30,8 @@ public abstract class SkillActive extends Skill implements Listener
protected long _rechargeMod; protected long _rechargeMod;
protected boolean _rechargeInform; protected boolean _rechargeInform;
protected HashSet<Material> _itemSet = new HashSet<Material>(); protected final Set<Material> _itemSet = new HashSet<>();
protected HashSet<Action> _actionSet = new HashSet<Action>(); protected final Set<Action> _actionSet = new HashSet<>();
public SkillActive(SkillFactory skills, public SkillActive(SkillFactory skills,
String name, ClassType classType, SkillType skillType, String name, ClassType classType, SkillType skillType,
@ -47,19 +49,16 @@ public abstract class SkillActive extends Skill implements Listener
_rechargeMod = rechargeMod; _rechargeMod = rechargeMod;
_rechargeInform = rechargeInform; _rechargeInform = rechargeInform;
for (Material cur : itemArray) Collections.addAll(_itemSet, itemArray);
_itemSet.add(cur); Collections.addAll(_actionSet, actionArray);
for (Action cur : actionArray)
_actionSet.add(cur);
} }
public HashSet<Material> GetItems() public Set<Material> GetItems()
{ {
return _itemSet; return _itemSet;
} }
public HashSet<Action> GetActions() public Set<Action> GetActions()
{ {
return _actionSet; return _actionSet;
} }

View File

@ -1,18 +1,5 @@
package mineplex.minecraft.game.classcombat.Skill; 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.UtilTime;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilPlayer;
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.Material;
import org.bukkit.entity.Arrow; import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -21,6 +8,17 @@ import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityShootBowEvent; import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
public abstract class SkillChargeBow extends SkillCharge implements Listener public abstract class SkillChargeBow extends SkillCharge implements Listener
{ {
protected boolean _canChargeInWater; protected boolean _canChargeInWater;

View File

@ -145,8 +145,8 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
_movement = movement; _movement = movement;
_teleport = teleport; _teleport = teleport;
_energy = energy; _energy = energy;
_skillMap = new HashMap<String, Skill>(); _skillMap = new HashMap<>();
_skillSalesPackageMap = new HashMap<Integer, ISkill>(); _skillSalesPackageMap = new HashMap<>();
PopulateSkills(); PopulateSkills();
} }
@ -181,7 +181,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
for (Skill skill : _skillMap.values()) for (Skill skill : _skillMap.values())
getPlugin().getServer().getPluginManager().registerEvents(skill, getPlugin()); getPlugin().getServer().getPluginManager().registerEvents(skill, getPlugin());
List<SkillToken> skillTokens = new ArrayList<SkillToken>(); List<SkillToken> skillTokens = new ArrayList<>();
for (Skill skill : _skillMap.values()) for (Skill skill : _skillMap.values())
{ {
@ -247,7 +247,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
AddSkill(new Blink(this, "Blink", ClassType.Assassin, SkillType.Axe, AddSkill(new Blink(this, "Blink", ClassType.Assassin, SkillType.Axe,
1, 4, 1, 4,
0, 0, 0, 0,
12000, 0, true, 9000, 1000, true,
new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
@ -283,7 +283,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
AddSkill(new SilencingArrow(this, "Silencing Arrow", ClassType.Assassin, SkillType.Bow, AddSkill(new SilencingArrow(this, "Silencing Arrow", ClassType.Assassin, SkillType.Bow,
1, 4, 1, 4,
0, 0, 0, 0,
20000, -2000, true, 20000, -3000, true,
new Material[] {Material.BOW}, new Material[] {Material.BOW},
new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK})); new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK}));
@ -453,7 +453,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
//Axe //Axe
AddSkill(new FireBlast(this, "Fire Blast", ClassType.Mage, SkillType.Axe, AddSkill(new FireBlast(this, "Fire Blast", ClassType.Mage, SkillType.Axe,
1, 5, 1, 5,
60, -3, 54, -4,
13000, -1000, true, 13000, -1000, true,
new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
@ -475,7 +475,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
AddSkill(new Fissure(this, "Fissure", ClassType.Mage, SkillType.Axe, AddSkill(new Fissure(this, "Fissure", ClassType.Mage, SkillType.Axe,
1, 5, 1, 5,
60, -3, 53, -3,
13000, -1000, true, 13000, -1000, true,
new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
@ -501,8 +501,8 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
//Passive B //Passive B
AddSkill(new GlacialBlade(this, "Glacial Blade", ClassType.Mage, SkillType.PassiveB, AddSkill(new GlacialBlade(this, "Glacial Blade", ClassType.Mage, SkillType.PassiveB,
1, 3, 1, 3,
16, -2, 11, -2,
1200, -250, false, 1000, -100, false,
new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD}, new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD},
new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK})); new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK}));
@ -535,7 +535,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
AddSkill(new WolfsFury(this, "Wolfs Fury", ClassType.Ranger, SkillType.Axe, AddSkill(new WolfsFury(this, "Wolfs Fury", ClassType.Ranger, SkillType.Axe,
1, 4, 1, 4,
0, 0, 0, 0,
18000, 2000, true, 17000, 2000, true,
new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
@ -578,7 +578,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
AddSkill(new ExplosiveShot(this, "Explosive Arrow", ClassType.Ranger, SkillType.Bow, AddSkill(new ExplosiveShot(this, "Explosive Arrow", ClassType.Ranger, SkillType.Bow,
1, 4, 1, 4,
0, 0, 0, 0,
20000, -2000, false, 22000, -2000, false,
new Material[] {Material.BOW}, new Material[] {Material.BOW},
new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK})); new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK}));

View File

@ -10,15 +10,16 @@ import org.bukkit.event.Listener;
public class Item implements IItem, Listener public class Item implements IItem, Listener
{ {
protected ItemFactory Factory;
private Material _type; protected final ItemFactory Factory;
private String _name;
private String[] _desc; private final Material _type;
private int _amount; private final String _name;
private final String[] _desc;
private final int _amount;
private boolean _free; private boolean _free;
private int _gemCost; private final int _gemCost;
private boolean _canDamage; private final boolean _canDamage;
private int _tokenCost; private int _tokenCost;

View File

@ -7,6 +7,7 @@ import java.util.HashSet;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.blockrestore.BlockRestore; import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.minecraft.game.core.IRelation;
import mineplex.minecraft.game.core.condition.ConditionManager; import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.core.energy.Energy; import mineplex.core.energy.Energy;
import mineplex.minecraft.game.core.fire.Fire; import mineplex.minecraft.game.core.fire.Fire;
@ -22,23 +23,25 @@ import org.bukkit.plugin.java.JavaPlugin;
public class ItemFactory extends MiniPlugin implements IItemFactory public class ItemFactory extends MiniPlugin implements IItemFactory
{ {
private BlockRestore _blockRestore;
private ConditionManager _condition;
private DamageManager _damage;
private Energy _energy;
private Fire _fire;
private ProjectileManager _projectileManager;
private ProximityManager _proxyManager;
private java.lang.reflect.Field _itemMaxDurability;
private HashMap<String, Item> _items;
private HashSet<String> _ignore;
public ItemFactory(JavaPlugin plugin, BlockRestore blockRestore, ConditionManager condition, DamageManager damage, Energy energy, Fire fire, ProjectileManager projectileManager) private final BlockRestore _blockRestore;
private final ConditionManager _condition;
private final DamageManager _damage;
private final Energy _energy;
private final Fire _fire;
private final ProjectileManager _projectileManager;
private final ProximityManager _proxyManager;
private final IRelation _relation;
private java.lang.reflect.Field _itemMaxDurability;
private final HashMap<String, Item> _items;
private final HashSet<String> _ignore;
public ItemFactory(JavaPlugin plugin, BlockRestore blockRestore, ConditionManager condition, DamageManager damage, Energy energy, Fire fire, ProjectileManager projectileManager, IRelation relation)
{ {
this(plugin, blockRestore, condition, damage, energy, fire, projectileManager, new HashSet<String>()); this(plugin, blockRestore, condition, damage, energy, fire, projectileManager, relation, new HashSet<>());
} }
public ItemFactory(JavaPlugin plugin, BlockRestore blockRestore, ConditionManager condition, DamageManager damage, Energy energy, Fire fire, ProjectileManager projectileManager, HashSet<String> ignore) public ItemFactory(JavaPlugin plugin, BlockRestore blockRestore, ConditionManager condition, DamageManager damage, Energy energy, Fire fire, ProjectileManager projectileManager, IRelation relation, HashSet<String> ignore)
{ {
super("Item Factory", plugin); super("Item Factory", plugin);
@ -49,8 +52,9 @@ public class ItemFactory extends MiniPlugin implements IItemFactory
_fire = fire; _fire = fire;
_projectileManager = projectileManager; _projectileManager = projectileManager;
_proxyManager = new ProximityManager(); _proxyManager = new ProximityManager();
_relation = relation;
_items = new HashMap<String, Item>(); _items = new HashMap<>();
_ignore = ignore; _ignore = ignore;
try try
@ -58,11 +62,7 @@ public class ItemFactory extends MiniPlugin implements IItemFactory
_itemMaxDurability = net.minecraft.server.v1_8_R3.Item.class.getDeclaredField("durability"); _itemMaxDurability = net.minecraft.server.v1_8_R3.Item.class.getDeclaredField("durability");
_itemMaxDurability.setAccessible(true); _itemMaxDurability.setAccessible(true);
} }
catch (SecurityException e) catch (SecurityException | NoSuchFieldException e)
{
e.printStackTrace();
}
catch (NoSuchFieldException e)
{ {
e.printStackTrace(); e.printStackTrace();
} }
@ -120,7 +120,7 @@ public class ItemFactory extends MiniPlugin implements IItemFactory
private void AddThrowable() private void AddThrowable()
{ {
AddItem(new WaterBottle(this, Material.POTION, 1, false, 0, 1, AddItem(new WaterBottle(this, Material.POTION, 1, false, 0, 2,
ActionType.R, true, 500, 0, ActionType.R, true, 500, 0,
ActionType.L, true, 500, 0, 1f, ActionType.L, true, 500, 0, 1f,
-1, true, true, true, false)); -1, true, true, true, false));
@ -235,6 +235,16 @@ public class ItemFactory extends MiniPlugin implements IItemFactory
return _projectileManager; return _projectileManager;
} }
public IRelation getRelation()
{
return _relation;
}
public ProximityManager getProximityManager()
{
return _proxyManager;
}
@Override @Override
public void registerSelf() public void registerSelf()
{ {
@ -256,9 +266,4 @@ public class ItemFactory extends MiniPlugin implements IItemFactory
HandlerList.unregisterAll(_proxyManager); HandlerList.unregisterAll(_proxyManager);
} }
public ProximityManager getProximityManager()
{
return _proxyManager;
}
} }

View File

@ -76,6 +76,11 @@ public class ProximityZapper extends ItemUsable
@Override @Override
public void Collide(LivingEntity target, Block block, ProjectileUser data) public void Collide(LivingEntity target, Block block, ProjectileUser data)
{ {
if (UtilEnt.hasFlag(target, UtilEnt.FLAG_ENTITY_COMPONENT))
{
return;
}
//Arm //Arm
_armed.put(data.getThrown(), data.getThrower()); _armed.put(data.getThrown(), data.getThrower());

View File

@ -1,22 +1,41 @@
package mineplex.minecraft.game.classcombat.item.Throwable; package mineplex.minecraft.game.classcombat.item.Throwable;
import org.bukkit.Effect; import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.scheduler.BukkitTask;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.projectile.ProjectileUser; import mineplex.core.projectile.ProjectileUser;
import mineplex.minecraft.game.classcombat.item.ItemFactory; import mineplex.minecraft.game.classcombat.item.ItemFactory;
import mineplex.minecraft.game.classcombat.item.ItemUsable; import mineplex.minecraft.game.classcombat.item.ItemUsable;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
public class WaterBottle extends ItemUsable public class WaterBottle extends ItemUsable
{ {
private static final ConditionType[] NEGATIVE_TYPES =
{
ConditionType.BLINDNESS,
ConditionType.CONFUSION,
ConditionType.HARM,
ConditionType.HUNGER,
ConditionType.POISON,
ConditionType.POISON_SHOCK,
ConditionType.SHOCK,
ConditionType.SLOW,
ConditionType.SLOW_DIGGING,
ConditionType.WEAKNESS,
ConditionType.WITHER,
ConditionType.SILENCE
};
public WaterBottle(ItemFactory factory, Material type, public WaterBottle(ItemFactory factory, Material type,
int amount, boolean canDamage, int gemCost, int tokenCost, int amount, boolean canDamage, int gemCost, int tokenCost,
ActionType useAction, boolean useStock, long useDelay, ActionType useAction, boolean useStock, long useDelay,
@ -45,8 +64,10 @@ public class WaterBottle extends ItemUsable
{ {
Player player = event.getPlayer(); Player player = event.getPlayer();
if (((CraftPlayer)player).getHandle().spectating) if (UtilPlayer.isSpectator(player))
{
return; return;
}
//Extinguish //Extinguish
player.setFireTicks(-20); player.setFireTicks(-20);
@ -54,6 +75,15 @@ public class WaterBottle extends ItemUsable
//Resist //Resist
Factory.Condition().Factory().FireResist(GetName(), player, player, 4, 0, false, true, true); Factory.Condition().Factory().FireResist(GetName(), player, player, 4, 0, false, true, true);
BukkitTask task = UtilServer.runSyncTimer(() ->
{
for (ConditionType type : NEGATIVE_TYPES)
{
Factory.Condition().EndCondition(player, type, null);
}
}, 0, 10);
UtilServer.runSyncLater(task::cancel, 20 * 4);
//Effect //Effect
player.getWorld().playSound(player.getLocation(), Sound.SPLASH, 1f, 1.4f); player.getWorld().playSound(player.getLocation(), Sound.SPLASH, 1f, 1.4f);
player.getWorld().playEffect(player.getEyeLocation(), Effect.STEP_SOUND, 8); player.getWorld().playEffect(player.getEyeLocation(), Effect.STEP_SOUND, 8);
@ -85,10 +115,18 @@ public class WaterBottle extends ItemUsable
public void Break(ProjectileUser data) public void Break(ProjectileUser data)
{ {
if (!(data.getThrower() instanceof Player))
{
return;
}
Player thrower = (Player) data.getThrower();
Location location = data.getThrown().getLocation();
//Splash //Splash
data.getThrown().getWorld().playEffect(data.getThrown().getLocation(), Effect.STEP_SOUND, 20); data.getThrown().getWorld().playEffect(location, Effect.STEP_SOUND, 20);
data.getThrown().getWorld().playEffect(data.getThrown().getLocation(), Effect.STEP_SOUND, 8); data.getThrown().getWorld().playEffect(location, Effect.STEP_SOUND, 8);
data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.SPLASH, 1f, 1.4f); data.getThrown().getWorld().playSound(location, Sound.SPLASH, 1f, 1.4f);
//Extinguish //Extinguish
Factory.Fire().RemoveNear(data.getThrown().getLocation(), 3); Factory.Fire().RemoveNear(data.getThrown().getLocation(), 3);
@ -98,8 +136,18 @@ public class WaterBottle extends ItemUsable
for (Player player : UtilPlayer.getNearby(data.getThrown().getLocation(), 3)) for (Player player : UtilPlayer.getNearby(data.getThrown().getLocation(), 3))
{ {
if (Factory.getRelation().canHurt(player, thrower))
{
continue;
}
//Extinguish //Extinguish
player.setFireTicks(-20); player.setFireTicks(-20);
for (ConditionType type : NEGATIVE_TYPES)
{
Factory.Condition().EndCondition(player, type, null);
}
} }
} }
} }

View File

@ -1,5 +1,8 @@
package mineplex.minecraft.game.classcombat.item.Throwable; package mineplex.minecraft.game.classcombat.item.Throwable;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Effect; import org.bukkit.Effect;
import org.bukkit.Location; import org.bukkit.Location;
@ -7,12 +10,15 @@ import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilMath;
import mineplex.core.projectile.ProjectileUser; import mineplex.core.projectile.ProjectileUser;
import mineplex.minecraft.game.classcombat.item.ItemFactory; import mineplex.minecraft.game.classcombat.item.ItemFactory;
import mineplex.minecraft.game.classcombat.item.ItemUsable; import mineplex.minecraft.game.classcombat.item.ItemUsable;
@ -20,6 +26,9 @@ import mineplex.minecraft.game.classcombat.item.event.WebTossEvent;
public class Web extends ItemUsable public class Web extends ItemUsable
{ {
private final Map<Block, LivingEntity> _owner = new HashMap<>();
public Web(ItemFactory factory, Material type, public Web(ItemFactory factory, Material type,
int amount, boolean canDamage, int gemCost, int tokenCost, int amount, boolean canDamage, int gemCost, int tokenCost,
ActionType useAction, boolean useStock, long useDelay, ActionType useAction, boolean useStock, long useDelay,
@ -54,19 +63,19 @@ public class Web extends ItemUsable
} }
} }
CreateWeb(data.getThrown()); createWeb(data.getThrown());
} }
@Override @Override
public void Idle(ProjectileUser data) public void Idle(ProjectileUser data)
{ {
CreateWeb(data.getThrown()); createWeb(data.getThrown());
} }
@Override @Override
public void Expire(ProjectileUser data) public void Expire(ProjectileUser data)
{ {
CreateWeb(data.getThrown()); createWeb(data.getThrown());
} }
@Override @Override
@ -75,7 +84,7 @@ public class Web extends ItemUsable
data.getThrown().remove(); data.getThrown().remove();
} }
public void CreateWeb(Entity ent) private void createWeb(Entity ent)
{ {
LivingEntity thrower = Factory.Throw().getThrower(ent); LivingEntity thrower = Factory.Throw().getThrower(ent);
@ -85,7 +94,11 @@ public class Web extends ItemUsable
if (canWeb(thrower, ent.getLocation())) if (canWeb(thrower, ent.getLocation()))
{ {
Factory.BlockRestore().add(ent.getLocation().getBlock(), 30, (byte) 0, 6000); Block block = ent.getLocation().getBlock();
Factory.BlockRestore().add(block, 30, (byte) 0, 6000);
_owner.put(block, thrower);
Factory.runSyncLater(() -> _owner.remove(block), 120);
} }
} }
@ -96,4 +109,21 @@ public class Web extends ItemUsable
return !webEvent.isCancelled() && UtilBlock.airFoliage(location.getBlock()) && !location.getBlock().getType().toString().contains("BANNER"); return !webEvent.isCancelled() && UtilBlock.airFoliage(location.getBlock()) && !location.getBlock().getType().toString().contains("BANNER");
} }
@EventHandler(priority = EventPriority.MONITOR)
public void onRightClick(PlayerInteractEvent event)
{
if (!UtilEvent.isAction(event, ActionType.R_BLOCK))
{
return;
}
Block block = event.getClickedBlock();
LivingEntity owner = _owner.remove(block);
if (event.getPlayer().equals(owner))
{
Factory.BlockRestore().restore(block);
}
}
} }

View File

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

View File

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

View File

@ -42,7 +42,7 @@ public class ClassShopManager extends MiniPlugin
private void generatePermissions() private void generatePermissions()
{ {
PermissionGroup.CONTENT.setPermission(Perm.SKILL_UNLOCK, true, true);
PermissionGroup.TRAINEE.setPermission(Perm.SKILL_UNLOCK, true, true); PermissionGroup.TRAINEE.setPermission(Perm.SKILL_UNLOCK, true, true);
PermissionGroup.ULTRA.setPermission(Perm.SKILL_UNLOCK_LEGACY, true, true); PermissionGroup.ULTRA.setPermission(Perm.SKILL_UNLOCK_LEGACY, true, true);
} }

View File

@ -1,16 +1,23 @@
package mineplex.minecraft.game.classcombat.shop.button; package mineplex.minecraft.game.classcombat.shop.button;
import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.Inventory;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.shop.confirmation.ConfirmationCallback;
import mineplex.core.shop.confirmation.ConfirmationPage;
import mineplex.core.shop.confirmation.ConfirmationProcessor;
import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.IButton;
import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken; import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken;
import mineplex.minecraft.game.classcombat.shop.page.CustomBuildPage; import mineplex.minecraft.game.classcombat.shop.page.CustomBuildPage;
public class DeleteCustomBuildButton implements IButton public class DeleteCustomBuildButton implements IButton
{ {
private CustomBuildPage _page; private final CustomBuildPage _page;
private CustomBuildToken _customBuild; private final CustomBuildToken _customBuild;
public DeleteCustomBuildButton(CustomBuildPage page, CustomBuildToken customBuild) public DeleteCustomBuildButton(CustomBuildPage page, CustomBuildToken customBuild)
{ {
@ -20,7 +27,24 @@ public class DeleteCustomBuildButton implements IButton
@Override @Override
public void onClick(Player player, ClickType clickType) public void onClick(Player player, ClickType clickType)
{
_page.getShop().openPageForPlayer(player, new ConfirmationPage<>(player, _page, new ConfirmationProcessor()
{
@Override
public void init(Inventory inventory)
{
}
@Override
public void process(ConfirmationCallback callback)
{ {
_page.DeleteCustomBuild(_customBuild); _page.DeleteCustomBuild(_customBuild);
callback.resolve("Deleted.");
}
}, new ItemBuilder(Material.TNT)
.setTitle(C.cRedB + "Delete Build")
.addLore("Confirming will delete your", "build, forever. That's a really", "long time.")
.build()));
} }
} }

View File

@ -15,6 +15,7 @@ public class Condition
public enum ConditionType public enum ConditionType
{ {
CLOAK, CLOAK,
UNTRUE_CLOAK,
SHOCK, SHOCK,
POISON_SHOCK, POISON_SHOCK,
SILENCE, SILENCE,

View File

@ -2,15 +2,12 @@ package mineplex.minecraft.game.core.condition;
import java.util.Iterator; import java.util.Iterator;
import mineplex.core.Managers; import net.minecraft.server.v1_8_R3.Packet;
import mineplex.core.common.util.UtilEnt; import net.minecraft.server.v1_8_R3.PacketPlayOutEntity;
import mineplex.core.common.util.UtilTime; import net.minecraft.server.v1_8_R3.PacketPlayOutEntity.PacketPlayOutEntityLook;
import mineplex.core.recharge.Recharge; import net.minecraft.server.v1_8_R3.PacketPlayOutEntity.PacketPlayOutRelEntityMove;
import mineplex.core.updater.UpdateType; import net.minecraft.server.v1_8_R3.PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook;
import mineplex.core.updater.event.UpdateEvent; import net.minecraft.server.v1_8_R3.PacketPlayOutEntityTeleport;
import mineplex.core.visibility.VisibilityManager;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Effect; import org.bukkit.Effect;
@ -24,14 +21,34 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
public class ConditionEffect implements Listener import mineplex.core.Managers;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilTime;
import mineplex.core.packethandler.IPacketHandler;
import mineplex.core.packethandler.PacketHandler;
import mineplex.core.packethandler.PacketInfo;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.visibility.VisibilityManager;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class ConditionEffect implements Listener, IPacketHandler
{ {
protected ConditionManager Manager;
protected final ConditionManager Manager;
public ConditionEffect(ConditionManager manager) public ConditionEffect(ConditionManager manager)
{ {
Manager = manager; Manager = manager;
Manager.getPlugin().getServer().getPluginManager().registerEvents(this, Manager.getPlugin()); Manager.getPlugin().getServer().getPluginManager().registerEvents(this, Manager.getPlugin());
Managers.require(PacketHandler.class).addPacketHandler(this,
PacketPlayOutEntityLook.class,
PacketPlayOutRelEntityMove.class,
PacketPlayOutRelEntityMoveLook.class,
PacketPlayOutEntityTeleport.class
);
} }
@EventHandler(priority = EventPriority.LOW) @EventHandler(priority = EventPriority.LOW)
@ -62,7 +79,7 @@ public class ConditionEffect implements Listener
LivingEntity ent = event.GetDamageeEntity(); LivingEntity ent = event.GetDamageeEntity();
if (ent == null) return; if (ent == null) return;
if (!Manager.IsCloaked(ent)) if (!Manager.IsCloaked(ent) && !Manager.isUntrueCloaked(ent))
return; return;
//Set Damage //Set Damage
@ -445,4 +462,53 @@ public class ConditionEffect implements Listener
Manager.EndCondition(ent, ConditionType.FALLING , null); Manager.EndCondition(ent, ConditionType.FALLING , null);
} }
} }
@Override
public void handle(PacketInfo packetInfo)
{
Player player = packetInfo.getPlayer();
Packet packet = packetInfo.getPacket();
Player packetPlayer = null;
if (packet instanceof PacketPlayOutEntity)
{
PacketPlayOutEntity entityPacket = (PacketPlayOutEntity) packet;
for (Player other : player.getWorld().getPlayers())
{
if (entityPacket.a == other.getEntityId())
{
packetPlayer = other;
break;
}
}
if (packetPlayer == null || !Manager.isUntrueCloaked(packetPlayer))
{
return;
}
packetInfo.setCancelled(true);
}
else if (packet instanceof PacketPlayOutEntityTeleport)
{
PacketPlayOutEntityTeleport entityPacket = (PacketPlayOutEntityTeleport) packet;
for (Player other : player.getWorld().getPlayers())
{
if (entityPacket.a == other.getEntityId())
{
packetPlayer = other;
break;
}
}
if (packetPlayer == null || !Manager.isUntrueCloaked(packetPlayer))
{
return;
}
packetInfo.setCancelled(true);
}
}
} }

View File

@ -51,6 +51,11 @@ public class ConditionFactory
Material.GHAST_TEAR, (byte)0, false)); Material.GHAST_TEAR, (byte)0, false));
} }
public Condition untrueCloak(String reason, LivingEntity ent, LivingEntity source, double duration, boolean extend)
{
return Manager.AddCondition(new UntrueCloak(Manager, reason, ent, source, ConditionType.UNTRUE_CLOAK, 0, (int)(20 * duration), extend, Material.GHAST_TEAR, (byte)0, false));
}
public Condition Explosion(String reason, LivingEntity ent, LivingEntity source, public Condition Explosion(String reason, LivingEntity ent, LivingEntity source,
int mult, double duration, boolean extend, boolean showIndicator) int mult, double duration, boolean extend, boolean showIndicator)
{ {

View File

@ -540,6 +540,11 @@ public class ConditionManager extends MiniPlugin
return false; return false;
} }
public boolean isUntrueCloaked(LivingEntity ent)
{
return _activeConditions.containsKey(ent) && _activeConditions.get(ent).stream().anyMatch(condition -> condition.GetCondition().GetType() == ConditionType.UNTRUE_CLOAK);
}
@EventHandler @EventHandler
public void CleanUpdate(UpdateEvent event) public void CleanUpdate(UpdateEvent event)
{ {

View File

@ -0,0 +1,82 @@
package mineplex.minecraft.game.core.condition.conditions;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityTeleport;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.condition.Condition;
import mineplex.minecraft.game.core.condition.ConditionManager;
public class UntrueCloak extends Condition
{
public UntrueCloak(ConditionManager manager, String reason, LivingEntity ent,
LivingEntity source, ConditionType type, int mult, int ticks,
boolean add, Material visualType, byte visualData,
boolean showIndicator)
{
super(manager, reason, ent, source, type, mult, ticks, add, visualType,
visualData, showIndicator, false);
_informOn = "You are now invisible.";
_informOff = "You are no longer invisible.";
}
@Override
public boolean needsForceRemove()
{
return true;
}
@Override
public void Add()
{
if (!(_ent instanceof Player))
{
return;
}
PacketPlayOutEntityTeleport packet = new PacketPlayOutEntityTeleport(((CraftPlayer) _ent).getHandle());
Location location = _ent.getLocation();
packet.b = location.getBlockX() * 32;
packet.c = location.getWorld().getMaxHeight() * 32;
packet.d = location.getBlockZ() * 32;
packet.g = false;
for (Player player : _ent.getWorld().getPlayers())
{
if (player.equals(_ent))
{
continue;
}
UtilPlayer.sendPacket(player, packet);
}
}
@Override
public void Remove()
{
if (!(_ent instanceof Player))
{
return;
}
PacketPlayOutEntityTeleport packet = new PacketPlayOutEntityTeleport(((CraftPlayer) _ent).getHandle());
for (Player player : _ent.getWorld().getPlayers())
{
if (player.equals(_ent))
{
continue;
}
UtilPlayer.sendPacket(player, packet);
}
}
}

View File

@ -1,5 +1,7 @@
package mineplex.minecraft.game.core.damage.compatibility; package mineplex.minecraft.game.core.damage.compatibility;
import mineplex.core.Managers;
import mineplex.core.newnpc.NewNPCManager;
import mineplex.core.npc.NpcManager; import mineplex.core.npc.NpcManager;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
@ -23,5 +25,15 @@ public class NpcProtectListener implements Listener
{ {
event.SetCancelled("NPC"); event.SetCancelled("NPC");
} }
else
{
// This is bad but /shrug
NewNPCManager manager = Managers.get(NewNPCManager.class);
if (manager != null && manager.isNPC(event.GetDamageeEntity()))
{
event.SetCancelled("New NPC");
}
}
} }
} }

View File

@ -6,6 +6,7 @@ import java.util.HashSet;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
@ -69,12 +70,10 @@ public class Fire extends MiniPlugin
for (LivingEntity ent : fire.getWorld().getEntitiesByClass(LivingEntity.class)) for (LivingEntity ent : fire.getWorld().getEntitiesByClass(LivingEntity.class))
{ {
if (ent instanceof Player) if (UtilPlayer.isSpectator(ent) || ent.hasPotionEffect(PotionEffectType.FIRE_RESISTANCE))
if (((CraftPlayer)ent).getHandle().spectating) {
continue;
if (ent.hasPotionEffect(PotionEffectType.FIRE_RESISTANCE))
continue; continue;
}
if (ent.getLocation().getBlock().getTypeId() == 8 || ent.getLocation().getBlock().getTypeId() == 9) if (ent.getLocation().getBlock().getTypeId() == 8 || ent.getLocation().getBlock().getTypeId() == 9)
continue; continue;
@ -116,8 +115,7 @@ public class Fire extends MiniPlugin
if (!_fire.get(fire).canHitOwner() && _fire.get(fire).GetOwner().equals(player)) if (!_fire.get(fire).canHitOwner() && _fire.get(fire).GetOwner().equals(player))
return; return;
if (UtilPlayer.isSpectator(player))
if (((CraftPlayer)player).getHandle().spectating)
return; return;
if (player.hasPotionEffect(PotionEffectType.FIRE_RESISTANCE)) if (player.hasPotionEffect(PotionEffectType.FIRE_RESISTANCE))

View File

@ -366,8 +366,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
//Champions Modules //Champions Modules
_energy = new Energy(plugin); _energy = new Energy(plugin);
_itemFactory = new ItemFactory(_plugin, _blockRestore, _conditionManager, damageManager, _energy, _itemFactory = new ItemFactory(_plugin, _blockRestore, _conditionManager, damageManager, _energy, _fire, _projectileManager, this);
_fire, _projectileManager);
_skillFactory = new SkillFactory(plugin, damageManager, this, _damageManager.GetCombatManager(), _skillFactory = new SkillFactory(plugin, damageManager, this, _damageManager.GetCombatManager(),
_conditionManager, _projectileManager, _disguiseManager, _blockRestore, _fire, new Movement(plugin), teleport, _conditionManager, _projectileManager, _disguiseManager, _blockRestore, _fire, new Movement(plugin), teleport,

Some files were not shown because too many files have changed in this diff Show More