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

@ -86,7 +86,7 @@ public class UtilRadar
UtilTextTop.display(text, player);
if(bossBar)
if (bossBar)
{
UtilTextTop.display(text, player);
}
@ -111,4 +111,4 @@ public class UtilRadar
}
}
}
}
}

View File

@ -572,18 +572,6 @@ public enum Achievement
new int[]{80},
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,
new String[]{"Champions Domination.Assassination", "Champions TDM.Assassination", "Champions CTF.Assassination"},
new String[]{"Kill 40 players with Backstab without", "taking any damage from them"},

View File

@ -68,10 +68,13 @@ public abstract class ArrowEffectGadget extends Gadget
{
if (!_arrows.remove(event.getEntity()))
return;
if (Manager.hideParticles())
return;
doHitEffect((Arrow)event.getEntity());
}
public abstract void doTrail(Arrow arrow);
public abstract void doHitEffect(Arrow arrow);
}
}

View File

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

View File

@ -1,16 +1,5 @@
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.HashMap;
import java.util.HashSet;
@ -21,6 +10,20 @@ import java.util.Map.Entry;
import java.util.Set;
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
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 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);
skillManager.RemoveSkill("Dwarf Toss", "Block Toss");
skillManager.removeSkill("Whirlwind Axe");
@ -400,7 +400,11 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
return 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()
{
@EventHandler

View File

@ -42,7 +42,6 @@ import mineplex.core.movement.Movement;
import mineplex.core.npc.NpcManager;
import mineplex.core.packethandler.PacketHandler;
import mineplex.core.party.PartyManager;
import mineplex.core.personalServer.PersonalServerManager;
import mineplex.core.pet.PetManager;
import mineplex.core.poll.PollManager;
import mineplex.core.portal.GenericServer;
@ -180,7 +179,7 @@ public class Hub extends JavaPlugin implements IRelation
Energy energy = new Energy(this);
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);
ClassManager classManager = new ClassManager(this, clientManager, donationManager, hubManager.GetGadget(), skillManager, itemFactory);
itemFactory.deregisterSelf();

View File

@ -173,7 +173,7 @@ public class ClassManager extends MiniClientPlugin<ClientClass> implements IClas
customBuild.Name = "Default Build";
customBuild.SwordSkill = "Evade";
customBuild.SwordSkillLevel = 2;
customBuild.SwordSkillLevel = 1;
customBuild.AxeSkill = "Leap";
customBuild.AxeSkillLevel = 3;
customBuild.BowSkill = "Smoke Arrow";
@ -195,16 +195,16 @@ public class ClassManager extends MiniClientPlugin<ClientClass> implements IClas
CustomBuildToken customBuild = new CustomBuildToken(ClassType.Mage);
customBuild.Name = "Default Build";
customBuild.SwordSkill = "Blizzard";
customBuild.SwordSkill = "Inferno";
customBuild.SwordSkillLevel = 3;
customBuild.AxeSkill = "Ice Prison";
customBuild.AxeSkill = "Fire Blast";
customBuild.AxeSkillLevel = 3;
customBuild.BowSkill = "";
customBuild.ClassPassiveASkill = "Arctic Armor";
customBuild.ClassPassiveASkillLevel = 2;
customBuild.ClassPassiveBSkill = "Glacial Blade";
customBuild.ClassPassiveASkill = "Immolate";
customBuild.ClassPassiveASkillLevel = 1;
customBuild.ClassPassiveBSkill = "Magma Blade";
customBuild.ClassPassiveBSkillLevel = 2;
customBuild.GlobalPassiveSkill = "Mana Pool";
customBuild.GlobalPassiveSkill = "Break Fall";
customBuild.GlobalPassiveSkillLevel = 2;
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.ClassPassiveASkillLevel = 2;
customBuild.ClassPassiveBSkill = "Crippling Blow";
customBuild.ClassPassiveBSkillLevel = 2;
customBuild.ClassPassiveBSkillLevel = 1;
customBuild.GlobalPassiveSkill = "Recharge";
customBuild.GlobalPassiveSkillLevel = 1;

View File

@ -579,7 +579,7 @@ public class ClientClass
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;
}

View File

@ -11,8 +11,8 @@ import mineplex.minecraft.game.classcombat.item.Item;
public class CustomBuildToken
{
public static int MAX_SKILL_TOKENS = 12;
public static int MAX_ITEM_TOKENS = 12;
public static final int MAX_SKILL_TOKENS = 12;
public static final int MAX_ITEM_TOKENS = 12;
public int CustomBuildId;
@ -42,7 +42,7 @@ public class CustomBuildToken
public String GlobalPassiveSkill = "";
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 ItemTokens = 1;

View File

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

View File

@ -9,6 +9,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.util.Vector;
import mineplex.core.recharge.Recharge;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.minecraft.game.classcombat.Skill.Skill;
@ -23,7 +24,7 @@ public class BackStab extends Skill
SetDesc(new String[]
{
"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)
{
//Damage
event.AddMod(damager.getName(), GetName(), 1 + level, true);
event.AddMod(damager.getName(), GetName(), 1.5 + 1.5 * level, true);
//Effect
damagee.getWorld().playSound(damagee.getLocation(), Sound.HURT_FLESH, 1f, 2f);
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
@ -88,4 +71,4 @@ public class BackStab extends Skill
{
}
}
}

View File

@ -18,6 +18,7 @@ import org.bukkit.util.Vector;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
@ -58,7 +59,7 @@ public class Blink extends SkillActive
"Instantly teleport forwards #9#3 Blocks.",
"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.",
"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."));
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."));
return false;
@ -89,10 +90,12 @@ public class Blink extends SkillActive
//Deblink
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
if (UtilTime.elapsed(_blinkTime.get(player), 500))
if (UtilTime.elapsed(time, 500))
Deblink(player, level);
return false;

View File

@ -1,26 +1,30 @@
package mineplex.minecraft.game.classcombat.Skill.Assassin;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap;
import org.bukkit.Sound;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
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.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.core.damage.CustomDamageEvent;
public class ComboAttack extends Skill
{
private WeakHashMap<Player, Float> _repeat = new WeakHashMap<Player, Float>();
private WeakHashMap<Player, Long> _last = new WeakHashMap<Player, Long>();
private final Map<Player, Float> _repeat = new WeakHashMap<>();
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)
{
@ -48,13 +52,25 @@ public class ComboAttack extends Skill
//Damager
Player damager = event.GetDamagerPlayer(false);
if (damager == null) return;
if (damager == null) return;
int level = getLevel(damager);
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))
{
_repeat.put(damager, 0.5f);
}
//Damage
event.AddMod(damager.getName(), GetName(), _repeat.get(damager), true);
@ -73,16 +89,21 @@ public class ComboAttack extends Skill
if (event.getType() != UpdateType.FAST)
return;
HashSet<Player> remove = new HashSet<Player>();
Set<Player> remove = new HashSet<>();
for (Player cur : _repeat.keySet())
{
if (UtilTime.elapsed(_last.get(cur), 2000))
{
remove.add(cur);
}
}
for (Player cur : remove)
{
_repeat.remove(cur);
_last.remove(cur);
_lastTarget.remove(cur);
}
}
@ -91,5 +112,6 @@ public class ComboAttack extends Skill
{
_repeat.remove(player);
_last.remove(player);
_lastTarget.remove(player);
}
}
}

View File

@ -1,8 +1,8 @@
package mineplex.minecraft.game.classcombat.Skill.Assassin;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import org.bukkit.Effect;
import org.bukkit.Location;
@ -16,26 +16,27 @@ import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
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.UtilAlg;
import mineplex.core.common.util.UtilBlock;
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.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
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.SkillFactory;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
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,
int cost, int levels,
@ -63,7 +64,7 @@ public class Evade extends SkillActive
@Override
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."));
return false;
@ -120,30 +121,37 @@ public class Evade extends SkillActive
damagee.getWorld().playEffect(damagee.getLocation(), Effect.SMOKE, 5);
//Location
Location target = null;
if (damagee.isSneaking()) target = FindLocationBack(damager, damagee);
else target = FindLocationBehind(damager, damagee);
Location target;
if (damagee.isSneaking())
{
target = FindLocationBack(damager, damagee);
}
else
{
target = FindLocationBehind(damager, damagee);
}
if (target == null)
return;
//Effect
UtilParticle.PlayParticle(ParticleType.LARGE_SMOKE, damagee.getLocation(),
(float)(Math.random() - 0.5), (float)(Math.random() * 1.4), (float)(Math.random() - 0.5), 0, 10,
ViewDist.NORMAL, UtilServer.getPlayers());
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);
//Action
damagee.teleport(target);
//Cloak
if (damagee.isSneaking())
{
Factory.Condition().Factory().Cloak(GetName(), damagee, damagee, 0.1, false, false);
}
//Invul/Cloak
Factory.Condition().Factory().Invulnerable(GetName(), damagee, damagee, 0.5, false, false);
event.SetCancelled("Evaded");
//Inform
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)) + "."));
Recharge.Instance.useForce(damagee, GetName(), 250, true);
}
private Location FindLocationBehind(LivingEntity damager, Player damagee)
@ -218,7 +226,7 @@ public class Evade extends SkillActive
{
activeIter.remove();
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.Map;
import net.minecraft.server.v1_8_R3.AxisAlignedBB;
import net.minecraft.server.v1_8_R3.Entity;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@ -17,57 +20,57 @@ import org.bukkit.util.Vector;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilItem;
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.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.SkillFactory;
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
{
private Map<Player, Integer> _flash = new HashMap<>();
private boolean _allowTrapping = false;
public Flash(SkillFactory skills, String name, ClassType classType, SkillType skillType,
int cost, int levels,
int energy, int energyMod,
long recharge, long rechargeMod, boolean rechargeInform,
Material[] itemArray,
Action[] actionArray)
private final Map<Player, Integer> _flash = new HashMap<>();
private boolean _allowTrapping = false, _startWithCharges = true;
public Flash(SkillFactory skills, String name, ClassType classType, SkillType skillType,
int cost, int levels,
int energy, int energyMod,
long recharge, long rechargeMod, boolean rechargeInform,
Material[] itemArray,
Action[] actionArray)
{
super(skills, name, classType, skillType,
cost, levels,
energy, energyMod,
recharge, rechargeMod, rechargeInform,
energy, energyMod,
recharge, rechargeMod, rechargeInform,
itemArray,
actionArray);
SetDesc(new String[]
SetDesc(new String[]
{
"Teleport forwards 6 Blocks.",
"Store up to #1#1 Flash Charges.",
"Cannot be used while Slowed."
"Teleport forwards 6 Blocks.",
"Store up to #1#1 Flash Charges.",
"Cannot be used while Slowed."
});
}
@Override
public String GetRechargeString()
{
return "Recharge: #8#-1 Seconds per Charge";
return "Recharge: 4 Seconds per Charge";
}
@SuppressWarnings("deprecation")
@Override
public boolean CustomCheck(Player player, int level)
public boolean CustomCheck(Player player, int level)
{
if (player.hasPotionEffect(PotionEffectType.SLOW))
{
@ -75,21 +78,23 @@ public class Flash extends SkillActive
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."));
return false;
}
// Check to see if teleporting event is valid
Location destination = getDestination(player, getMaxRange(player));
SkillTeleportEvent teleportEvent = new SkillTeleportEvent(player, destination);
Bukkit.getPluginManager().callEvent(teleportEvent);
if (teleportEvent.isCancelled()) return false; // Teleport cancelled
if (teleportEvent.isCancelled()) return false; // Teleport cancelled
//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") + "."));
return false;
@ -101,34 +106,32 @@ public class Flash extends SkillActive
@EventHandler
public void recharge(UpdateEvent event)
{
for (Player cur : GetUsers())
if (event.getType() != UpdateType.TICK)
{
if (!_flash.containsKey(cur))
{
_flash.put(cur, 0);
}
else
{
int charges = _flash.get(cur);
int level = getLevel(cur);
if (charges >= 1 + level)
continue;
if (!Recharge.Instance.use(cur, "Flash Recharge", 8000 - (1000 * level), false, false))
continue;
_flash.put(cur, charges + 1);
//Inform
UtilPlayer.message(cur, F.main(GetClassType().name(), "Flash Charges: " + F.elem((charges + 1) + "")));
}
return;
}
_flash.entrySet().forEach(entry ->
{
Player cur = entry.getKey();
int charges = entry.getValue();
int level = getLevel(cur);
if (charges >= 1 + level || !Recharge.Instance.use(cur, "Flash Recharge", 4000, false, false))
{
return;
}
entry.setValue(charges + 1);
//Inform
UtilPlayer.message(cur, F.main(GetClassType().name(), "Flash Charges: " + F.elem((charges + 1) + "")));
});
}
@SuppressWarnings("deprecation")
@Override
public void Skill(Player player, int level)
public void Skill(Player player, int level)
{
//Use Recharge
Recharge.Instance.use(player, "Flash Recharge", 8000, false, false);
@ -137,17 +140,18 @@ public class Flash extends SkillActive
//Inform
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 test = null;
Location test;
Location end = start.clone();
Vector dir = player.getLocation().getDirection();
AxisAlignedBB box = null;
Entity ent = ((CraftEntity)player).getHandle();
AxisAlignedBB box;
Entity ent = ((CraftEntity) player).getHandle();
double maxRange = getMaxRange(player);
double range = 0;
rangeLoop: while (range <= maxRange)
rangeLoop:
while (range <= maxRange)
{
test = start.clone().add(dir.clone().multiply(range));
float halfWidth = ent.width / 2;
@ -163,9 +167,9 @@ public class Flash extends SkillActive
{
bottom = true;
}
boolean locIsBottom = (Math.max(test.getY(), b.getY()) - Math.min(test.getY(), b.getY())) < 0.5;
if (bottom == locIsBottom)
{
break rangeLoop;
@ -183,49 +187,48 @@ public class Flash extends SkillActive
break rangeLoop;
}
}
range += 0.1;
end = test.clone();
//Smoke Trail
UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, end.clone().add(0, 0.5, 0), 0, 0, 0, 0, 1,
ViewDist.LONGER, UtilServer.getPlayers());
UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, end.clone().add(0, 0.5, 0), 0, 0, 0, 0, 1, ViewDist.LONG);
}
if (range > 0)
{
player.teleport(end);
}
player.setFallDistance(0);
//Effect
player.getWorld().playSound(player.getLocation(), Sound.WITHER_SHOOT, 0.4f, 1.2f);
player.getWorld().playSound(player.getLocation(), Sound.SILVERFISH_KILL, 1f, 1.6f);
}
@Override
public void Reset(Player player)
public void Reset(Player player)
{
_flash.remove(player);
}
private double getMaxRange(Player player)
{
return 6;
}
private Location getDestination(Player player, double range)
{
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)
{
_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.Sound;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton;
@ -17,20 +16,23 @@ import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.inventory.ItemStack;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import com.mojang.authlib.GameProfile;
import mineplex.core.common.util.F;
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.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.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
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.SkillFactory;
import mineplex.minecraft.game.classcombat.event.ClassCombatCreatureAllowSpawnEvent;
@ -75,7 +77,7 @@ public class Illusion extends SkillActive
@Override
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."));
return false;
@ -115,11 +117,21 @@ public class Illusion extends SkillActive
inRange.add(other.getUniqueId());
//Disguise
DisguisePlayer disguise = new DisguisePlayer(skel, ((CraftPlayer)player).getHandle().getProfile());
Factory.Disguise().disguise(disguise, attempted -> inRange.contains(attempted.getUniqueId()));
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()));
}
catch (ReflectiveOperationException ex)
{
ex.printStackTrace();
}
//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);
@ -140,7 +152,7 @@ public class Illusion extends SkillActive
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) ||
//!Factory.Energy().Use(cur, getName(), 0.625 - (getLevel(cur) * 0.025), true, true) ||
skel == null ||
@ -190,6 +202,11 @@ public class Illusion extends SkillActive
{
if (cur.equals(player))
continue;
if (cur instanceof Player && !Factory.Relation().canHurt(player, (Player)cur))
{
continue;
}
//Condition
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.block.Block;
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.entity.EntityDamageEvent.DamageCause;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
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.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.SkillFactory;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class Leap extends SkillActive
{
@ -41,7 +46,8 @@ public class Leap extends SkillActive
"",
"Wall Kick by using Leap with your",
"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."
});
@ -50,7 +56,7 @@ public class Leap extends SkillActive
@Override
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."));
return false;
@ -108,7 +114,7 @@ public class Leap extends SkillActive
if (level == 0) return false;
//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;
//Direction
@ -180,10 +186,28 @@ public class Leap extends SkillActive
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
public void Reset(Player player)
{
}
}
}

View File

@ -1,8 +1,7 @@
package mineplex.minecraft.game.classcombat.Skill.Assassin;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import org.bukkit.Material;
import org.bukkit.Sound;
@ -14,58 +13,57 @@ import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityShootBowEvent;
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.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
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.UtilParticle.ParticleType;
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.SkillFactory;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class MarkedForDeath extends SkillActive
{
private HashSet<Entity> _arrows = new HashSet<Entity>();
private HashSet<Player> _active = new HashSet<Player>();
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,
int cost, int levels,
int energy, int energyMod,
long recharge, long rechargeMod, boolean rechargeInform,
Material[] itemArray,
Action[] actionArray)
private final Map<Player, MarkedData> _data = new HashMap<>();
public MarkedForDeath(SkillFactory skills, String name, ClassType classType, SkillType skillType,
int cost, int levels,
int energy, int energyMod,
long recharge, long rechargeMod, boolean rechargeInform,
Material[] itemArray,
Action[] actionArray)
{
super(skills, name, classType, skillType,
super(skills, name, classType, skillType,
cost, levels,
energy, energyMod,
recharge, rechargeMod, rechargeInform,
energy, energyMod,
recharge, rechargeMod, rechargeInform,
itemArray,
actionArray);
SetDesc(new String[]
SetDesc(new String[]
{
"Your next arrow will mark players,",
"making them take #2.5#1.5 more damage",
"from the next melee attack.",
"",
"Lasts for #3#1 seconds."
"Your next arrow will mark players,",
"making them take #2.5#1.5 more damage",
"from the next melee attack.",
"",
"Lasts for #3#1 seconds."
});
}
@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."));
return false;
@ -75,10 +73,9 @@ public class MarkedForDeath extends SkillActive
}
@Override
public void Skill(Player player, int level)
public void Skill(Player player, int level)
{
//Action
_active.add(player);
_data.put(player, new MarkedData(player));
//Inform
UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + "."));
@ -90,144 +87,152 @@ public class MarkedForDeath extends SkillActive
@EventHandler
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;
Player player = (Player)event.getEntity();
if (!_active.remove(player))
Player player = (Player) event.getEntity();
MarkedData data = _data.get(player);
if (data == null || data.Arrow != null)
{
return;
}
//Inform
UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(getLevel(player))) + "."));
_arrows.add(event.getProjectile());
data.Arrow = event.getProjectile();
}
@EventHandler(priority = EventPriority.HIGH)
public void DamageMark(CustomDamageEvent event)
{
if (event.IsCancelled())
{
return;
if (event.GetCause() != DamageCause.PROJECTILE)
return;
}
Projectile projectile = event.GetProjectile();
if (projectile == null) return;
if (!_arrows.contains((Entity)projectile))
if (projectile == null)
{
return;
LivingEntity damagee = event.GetDamageeEntity();
if (damagee == null) return;
}
Player damager = event.GetDamagerPlayer(true);
if (damager == null) return;
//Level
MarkedData data = _data.get(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
damagee.getWorld().playSound(damagee.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f);
//Inform
UtilPlayer.message(event.GetDamageePlayer(), F.main(GetClassType().name(), F.name(damager.getName()) +" hit you with " + F.skill(GetName(level)) + "."));
UtilPlayer.message(damager, F.main(GetClassType().name(), "You hit " + F.name(UtilEnt.getName(damagee)) +" with " + F.skill(GetName(level)) + "."));
UtilPlayer.message(event.GetDamageePlayer(), F.main(GetClassType().name(), F.name(damager.getName()) + " hit you 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
_markedTime.put(damagee, System.currentTimeMillis() + (3000 + 1000 * level));
_markedDamage.put(damagee, 2.5 + 1.5 * level);
data.Timeout = System.currentTimeMillis() + (3000 + 1000 * level);
data.Damage = 2.5 + 1.5 * level;
data.Marked = damagee;
//Remove
projectile.remove();
}
@EventHandler(priority = EventPriority.HIGH)
public void DamageAmplify(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
if (event.GetCause() != DamageCause.ENTITY_ATTACK)
if (event.IsCancelled() || event.GetCause() != DamageCause.ENTITY_ATTACK)
{
return;
}
LivingEntity damagee = event.GetDamageeEntity();
if (damagee == null) return;
Player damager = event.GetDamagerPlayer(false);
if (!_markedTime.containsKey(damagee) || !_markedDamage.containsKey(damagee))
if (damager == null)
{
return;
long time = _markedTime.remove(damagee);
double damage = _markedDamage.remove(damagee);
if (System.currentTimeMillis() > time)
}
MarkedData data = _data.get(damager);
if (data == null || !event.GetDamageeEntity().equals(data.Marked) || data.isExpired())
{
return;
event.AddMod(GetName(), GetName(), damage, true);
}
_data.remove(damager);
event.AddMod(GetName(), GetName(), data.Damage, true);
}
@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;
}
UtilPlayer.health(killer, 2 + getLevel(killer));
}
@EventHandler
public void Particle(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
for (Entity ent : _arrows)
{
UtilParticle.PlayParticle(ParticleType.MOB_SPELL, ent.getLocation(), 0, 0, 0, 0, 1,
ViewDist.MAX, UtilServer.getPlayers());
}
}
@EventHandler
public void Clean(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
return;
for (Iterator<Entity> arrowIterator = _arrows.iterator(); arrowIterator.hasNext();)
_data.values().forEach(data ->
{
Entity arrow = arrowIterator.next();
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();
}
if (data.Arrow != null && data.Arrow.isValid())
{
UtilParticle.PlayParticleToAll(ParticleType.MOB_SPELL, data.Arrow.getLocation(), null, 0, 1, ViewDist.LONG);
}
});
}
@Override
public void Reset(Player player)
public void Reset(Player player)
{
_active.remove(player);
_markedTime.remove(player);
_markedDamage.remove(player);
_data.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.LinkedList;
import java.util.Map;
import org.bukkit.Bukkit;
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.event.EventHandler;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.potion.PotionEffectType;
import mineplex.core.common.util.F;
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.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.UtilServer;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
@ -32,8 +31,10 @@ import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
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)
{
@ -43,16 +44,21 @@ public class Recall extends Skill
{
"Drop Axe/Sword to Use.",
"",
"Go back in time #2#2 seconds,",
"Go back in time #3#1 seconds,",
"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
public String GetRechargeString()
{
return "Recharge: #60#-10 Seconds";
return "Recharge: #35#-5 Seconds";
}
@EventHandler
@ -68,13 +74,21 @@ public class Recall extends Skill
return;
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;
}
//Check Allowed
SkillTriggerEvent trigger = new SkillTriggerEvent(player, GetName(), GetClassType());
Bukkit.getServer().getPluginManager().callEvent(trigger);
@ -82,29 +96,34 @@ public class Recall extends Skill
if (trigger.IsCancelled())
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;
LinkedList<Location> locs = _locMap.remove(player);
LinkedList<Location> locs = secondary ? _secondaryLocMap.remove(player) : _mainLocMap.remove(player);
if (locs == null)
return;
LinkedList<Double> health = _healthMap.remove(player);
LinkedList<Double> health = _secondaryHealthMap.remove(player);
if (health == null)
return;
Factory.runSync(() -> {
if (player.isDead())
Factory.runSync(() ->
{
if (player.isDead() || !player.getWorld().equals(locs.getLast().getWorld()))
{
return;
}
if (!player.getWorld().equals(locs.getLast().getWorld()))
if (secondary)
{
return;
//Heal
double newHealth = Math.min(health.getLast(), player.getHealth() + 1.5 + (level / 2D));
player.setHealth(newHealth);
}
else
{
Factory.Condition().Factory().Regen(GetName(), player, player, 1 + level, 2, false, true, false);
}
//Heal
double newHealth = Math.min(health.getLast(), player.getHealth() + 3 + level);
player.setHealth(newHealth);
//Effect
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f);
@ -116,21 +135,19 @@ public class Recall extends Skill
player.teleport(target);
//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
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,
ViewDist.LONGER, UtilServer.getPlayers());
UtilParticle.PlayParticleToAll(ParticleType.WITCH_MAGIC, current, 0, 1f, 0, 0, 1, ViewDist.LONG);
current = current.add(UtilAlg.getTrajectory(current, target).multiply(0.1));
}
});
}
@EventHandler
public void storeLocation(UpdateEvent event)
{
@ -139,32 +156,39 @@ public class Recall extends Skill
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
_locMap.get(cur).addFirst(cur.getLocation());
_healthMap.get(cur).addFirst(cur.getHealth());
_mainLocMap.computeIfAbsent(cur, (key) -> new LinkedList<>()).addFirst(cur.getLocation());
_secondaryLocMap.computeIfAbsent(cur, (key) -> new LinkedList<>()).addFirst(cur.getLocation());
_secondaryHealthMap.computeIfAbsent(cur, (key) -> new LinkedList<>()).addFirst(cur.getHealth());
int level = getLevel(cur);
//Cull
if (_locMap.get(cur).size() > (2 + 2 * level) * 20)
_locMap.get(cur).removeLast();
long maxMainSize = (3 + level) * 20;
long maxSecondarySize = 2 * 20;
if (_healthMap.get(cur).size() > (2 + 2 * level) * 20)
_healthMap.get(cur).removeLast();
//Cull
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
public void Reset(Player player)
{
_locMap.remove(player);
_healthMap.remove(player);
_mainLocMap.remove(player);
_secondaryLocMap.remove(player);
_secondaryHealthMap.remove(player);
}
}
}

View File

@ -1,5 +1,8 @@
package mineplex.minecraft.game.classcombat.Skill.Assassin;
import java.util.Map;
import java.util.WeakHashMap;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -7,13 +10,17 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.core.common.util.UtilGear;
import mineplex.core.recharge.Recharge;
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.SkillFactory;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
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)
{
super(skills, name, classType, skillType, cost, levels);
@ -21,8 +28,10 @@ public class ShockingStrikes extends Skill
SetDesc(new String[]
{
"Your attacks shock targets for",
"#0#1 seconds, giving them Slow 1 and",
"Screen-Shake."
"#0#1 seconds, giving them:",
"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();
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().Slow(GetName(), damagee, damager, level, 0, false, false, true, false);
if (data.Amount % 3 == 0)
{
Factory.Condition().Factory().Slow(GetName(), damagee, damager, level, 0, false, false, true, false);
}
//Damage
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
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.Iterator;
import java.util.Set;
import org.bukkit.Material;
import org.bukkit.Sound;
@ -32,8 +33,9 @@ import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
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,
int cost, int levels,
@ -52,7 +54,7 @@ public class SilencingArrow extends SkillActive
SetDesc(new String[]
{
"Your next arrow will Silence",
"target for #2#2 seconds.",
"target for 3 seconds.",
"",
"Silence stops skills being used."
});
@ -61,7 +63,7 @@ public class SilencingArrow extends SkillActive
@Override
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."));
return false;
@ -129,7 +131,7 @@ public class SilencingArrow extends SkillActive
if (level == 0) return;
//Confuse
Factory.Condition().Factory().Silence(GetName(), damagee, damager, 2 + 2*level, true, true);
Factory.Condition().Factory().Silence(GetName(), damagee, damager, 3, true, true);
//Effect
damagee.getWorld().playSound(damagee.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f);

View File

@ -59,7 +59,7 @@ public class SmokeArrow extends SkillActive
@Override
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."));
return false;

View File

@ -1,24 +1,5 @@
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.Effect;
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.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 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",
"Blindness to players within #2#1 Blocks",
"for #1#2 seconds.",
"for #1#1 seconds.",
"",
"You go invisible for #1#2 seconds."
});
@ -51,7 +50,7 @@ public class SmokeBomb extends Skill
@Override
public String GetRechargeString()
{
return "Recharge: #60#-10 Seconds";
return "Recharge: #45#-5 Seconds";
}
@EventHandler
@ -79,26 +78,29 @@ public class SmokeBomb extends Skill
if (trigger.IsCancelled())
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."));
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;
//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
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, player.getLocation(), 0, 0, 0, 0, 1,
ViewDist.MAX, UtilServer.getPlayers());
UtilParticle.PlayParticleToAll(ParticleType.HUGE_EXPLOSION, player.getLocation(), 0, 0, 0, 0, 1, ViewDist.LONG);
for (Player other : UtilPlayer.getNearby(player.getLocation(), 2 + level))
{
if (!other.equals(player))
Factory.Condition().Factory().Blind(GetName(), other, player, 1 + 2 * level, 0, false, false, false);
if (other.equals(player) || !Factory.Relation().canHurt(player, other))
{
continue;
}
Factory.Condition().Factory().Blind(GetName(), other, player, 1 + level, 0, false, false, false);
}
for (int i=0 ; i<3 ; i++)
@ -108,17 +110,22 @@ public class SmokeBomb extends Skill
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)
{
if (event.IsCancelled())
{
return;
}
Player damagee = event.GetDamageePlayer();
if (damagee == null) return;
if (getLevel(damagee) == 0)
return;
if (event.GetDamage() <= 0)
return;
//End
Factory.Condition().EndCondition(damagee, null, GetName());
@ -169,7 +176,7 @@ public class SmokeBomb extends Skill
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.GetReason().equals(GetName()))
@ -186,4 +193,4 @@ public class SmokeBomb extends Skill
//Remove Condition
Factory.Condition().EndCondition(player, null, GetName());
}
}
}

View File

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

View File

@ -96,7 +96,7 @@ public class BlockToss extends SkillCharge implements IThrown
@Override
public String GetRechargeString()
{
return "Recharge: " + "#5.5#-0.5 Seconds";
return "Recharge: " + "1.5 Seconds";
}
@EventHandler
@ -129,7 +129,7 @@ public class BlockToss extends SkillCharge implements IThrown
return;
//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."));
return;
@ -245,7 +245,7 @@ public class BlockToss extends SkillCharge implements IThrown
}
//Throw
if (!cur.isBlocking() || (_charge.containsKey(cur) && _charge.get(cur) >= 1))
if (!cur.isBlocking())
throwSet.add(cur);
//Charged Tick
@ -262,7 +262,7 @@ public class BlockToss extends SkillCharge implements IThrown
for (Player cur : throwSet)
{
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);
float charge = _charge.remove(cur);

View File

@ -1,5 +1,6 @@
package mineplex.minecraft.game.classcombat.Skill.Brute;
import java.util.Map;
import java.util.WeakHashMap;
import org.bukkit.Sound;
@ -8,26 +9,24 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
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.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
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.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.SkillFactory;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
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)
{
@ -35,8 +34,9 @@ public class Bloodlust extends Skill
SetDesc(new String[]
{
"When you kill an enemy, you go into",
"a Bloodlust, receiving Speed 1 and",
"Killing an enemy within 4#4 blocks",
"you go into a Bloodlust,",
"receiving Speed 1 and",
"Strength 1 for #4#2 seconds.",
"You also heal #0#1 health.",
"",
@ -117,8 +117,7 @@ public class Bloodlust extends Skill
if (System.currentTimeMillis() > _time.get(player))
{
int str = _str.remove(player);
UtilPlayer.message(player, F.main(GetClassType().name(), "Your " + F.skill(GetName(getLevel(player))) +
" has ended at " + F.elem("Level " + (str+1)) + "."));
UtilPlayer.message(player, F.main(GetClassType().name(), "Your " + F.skill(GetName(getLevel(player))) + " has ended at " + F.elem("Level " + (str+1)) + "."));
_time.remove(player);
return true;
@ -135,9 +134,9 @@ public class Bloodlust extends Skill
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,
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.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
@ -18,7 +19,9 @@ public class Colossus extends Skill
SetDesc(new String[]
{
"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)
{
if (event.IsCancelled())
{
return;
}
Player damagee = event.GetDamageePlayer();
if (damagee == null) return;
Player damagee = event.GetDamageePlayer(), damager = event.GetDamagerPlayer(true);
int level = getLevel(damagee);
if (level == 0) return;
if (damagee == null || damager == null)
{
return;
}
//Damage
event.AddMod(damagee.getName(), GetName(), 0, false);
event.AddKnockback(GetName(), 0.65);
int damageeeLevel = getLevel(damagee), damagerLevel = getLevel(damager);
DamageCause cause = event.GetCause();
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

View File

@ -1,8 +1,10 @@
package mineplex.minecraft.game.classcombat.Skill.Brute;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.bukkit.Bukkit;
import org.bukkit.EntityEffect;
import org.bukkit.Material;
import org.bukkit.entity.LivingEntity;
@ -15,7 +17,6 @@ import org.spigotmc.event.entity.EntityDismountEvent;
import mineplex.core.Managers;
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;
@ -33,13 +34,12 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
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;
public DwarfToss(SkillFactory skills, String name, ClassType classType, SkillType skillType,
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,
int cost, int levels,
int energy, int energyMod,
long recharge, long rechargeMod, boolean rechargeInform,
@ -68,10 +68,7 @@ public class DwarfToss extends SkillActive
@Override
public boolean CustomCheck(Player player, int level)
{
if (_used.contains(player))
return false;
return true;
return !_used.contains(player);
}
@Override
@ -94,7 +91,7 @@ public class DwarfToss extends SkillActive
int level = getLevel(player);
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."));
return false;
@ -112,11 +109,7 @@ public class DwarfToss extends SkillActive
return false;
//Check Energy/Recharge
if (!EnergyRechargeCheck(player, level))
return false;
//Allow
return true;
return EnergyRechargeCheck(player, level);
}
//getEntity is the vehicle
@ -126,17 +119,16 @@ public class DwarfToss extends SkillActive
if (event.isCancelled())
return;
System.out.println(UtilEnt.getName(event.getDismounted()));
System.out.println(UtilEnt.getName(event.getEntity()));
if (!(event.getDismounted() instanceof Player))
return;
if (!(event.getEntity() instanceof Player))
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);
}
}
@EventHandler
@ -179,13 +171,14 @@ public class DwarfToss extends SkillActive
}
//Hold Loop
if (target instanceof Player && _holding.containsKey((Player)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."));
return;
}
if (target instanceof Player && _holding.containsKey(target))
{
if (_holding.get(target).equals(player))
{
UtilPlayer.message(player, F.main(GetClassType().name(), F.name(target.getName()) + " is already holding you."));
return;
}
}
if (_holding.containsValue(target))
{
@ -279,8 +272,8 @@ public class DwarfToss extends SkillActive
if (event.getType() != UpdateType.TICK)
return;
HashSet<Player> voidSet = new HashSet<Player>();
HashSet<Player> throwSet = new HashSet<Player>();
Set<Player> voidSet = new HashSet<>();
Set<Player> throwSet = new HashSet<>();
for (Player cur : _holding.keySet())
{
@ -332,9 +325,11 @@ public class DwarfToss extends SkillActive
//Time Reduce
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!
@ -352,19 +347,15 @@ public class DwarfToss extends SkillActive
Factory.Condition().Factory().Invulnerable(GetName(), target, target, 1.25, false, false);
//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);
//Condition
Factory.Condition().Factory().Falling(GetName(), target, cur, 10, false, true);
//Effect
target.playEffect(EntityEffect.HURT);
}
UtilAction.velocity(target, cur.getLocation().getDirection(), mult, false, 0, 0.2, 1.2, true);
//Condition
Factory.Condition().Factory().Falling(GetName(), target, cur, 10, false, true);
//Effect
target.playEffect(EntityEffect.HURT);
}, 5);
//Inform

View File

@ -10,11 +10,13 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.core.common.util.UtilEnt;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.core.common.util.F;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilAction;
@ -60,7 +62,7 @@ public class FleshHook extends SkillActiveCharge implements IThrown
@Override
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."));
return false;
@ -117,6 +119,7 @@ public class FleshHook extends SkillActiveCharge implements IThrown
//Effect
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;
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.event.EventHandler;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.scheduler.BukkitRunnable;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilParticle.ParticleType;
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.SkillFactory;
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
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)
{
super(skills, name, classType, skillType, cost, levels);
SetDesc(new String[]
{
"Drop Axe/Sword to Use.",
"",
"You intimidate nearby enemies;",
"Enemies within #4#2 blocks receive Slow 1.",
"Enemies within #10#1 blocks receive Slow 1.",
"",
"Lasts for #10#1."
});
}
@EventHandler
public void Update(UpdateEvent event)
@Override
public String GetRechargeString()
{
if (event.getType() != UpdateType.TICK)
return;
return "Recharge: #15#-1.5 Seconds.";
}
for (Player cur : GetUsers())
@EventHandler
public void Use(PlayerDropItemEvent event)
{
Player player = event.getPlayer();
if (!(player.getOpenInventory().getTopInventory() instanceof CraftInventoryCrafting))
{
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);
}
return;
}
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
public void Reset(Player player)
{
_active.remove(player);
player.setExp(0);
}
}

View File

@ -88,7 +88,7 @@ public class SeismicSlam extends SkillActive
@Override
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."));
return false;

View File

@ -2,24 +2,6 @@ package mineplex.minecraft.game.classcombat.Skill.Brute;
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.entity.Entity;
import org.bukkit.entity.LivingEntity;
@ -29,6 +11,21 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
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
{
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",
"sprint. You gain a level of Speed",
"for every #5#-1 seconds, up to a max",
"of Speed 3.",
"of Speed 2.",
"",
"Attacking during stampede deals",
"#0#0.5 bonus damage per speed level,",
"#0.25#0.25 bonus damage,",
"and +50% knockback per speed level.",
"",
"Resets if you take damage."
@ -89,7 +86,7 @@ public class Stampede extends Skill
_sprintTime.put(cur, System.currentTimeMillis());
if (str < 3)
if (str < 2)
{
_sprintStr.put(cur, str+1);
@ -156,7 +153,7 @@ public class Stampede extends Skill
damager.removePotionEffect(PotionEffectType.SPEED);
//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);
//Inform

View File

@ -1,9 +1,8 @@
package mineplex.minecraft.game.classcombat.Skill.Brute;
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.Sound;
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.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.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.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.SkillFactory;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
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,
int cost, int levels,
@ -53,7 +51,7 @@ public class Takedown extends SkillActive
{
"Hurl yourself towards an opponent.",
"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."
});
}
@ -61,7 +59,7 @@ public class Takedown extends SkillActive
@Override
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."));
return false;
@ -114,58 +112,31 @@ public class Takedown extends SkillActive
_live.remove(player);
}
//Collide
for (Player player : GetUsers())
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)
{
DoTakeDown(player, other);
_live.remove(player);
return;
}
_live.keySet().removeIf(entity ->
{
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);
return true;
}
return false;
});
}
/**
@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)
private void DoTakeDown(Player damager, LivingEntity damagee)
{
int level = getLevel(damager);
int damage = 3 + (level);
int damage = 5 + level;
//Damage Event
CustomDamageEvent customDamageEvent = Factory.Damage().NewDamageEvent(damagee, damager, null,
@ -174,14 +145,17 @@ public class Takedown extends SkillActive
if (!customDamageEvent.IsCancelled())
{
//Damage Event
Factory.Damage().NewDamageEvent(damager, damagee, null,
DamageCause.CUSTOM, damage / 2, false, true, false,
damager.getName(), GetName() + " Recoil");
//Conditions
Factory.Condition().Factory().Slow(GetName(), damagee, damager, 2.5 + 0.5 * level, 3, false, true, true, true);
Factory.Condition().Factory().Slow(GetName(), damager, damager, 2.5 + 0.5 * level, 3, false, true, true, true);
double duration = 2.5 + (level / 2D);
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
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())
{
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,
ViewDist.LONG, UtilServer.getPlayers());
ViewDist.LONG);
}
}

View File

@ -58,7 +58,7 @@ public class Taunt extends SkillActive
@Override
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."));
return false;

View File

@ -54,7 +54,7 @@ public class WhirlwindAxe extends SkillActive
@Override
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."));
return false;

View File

@ -19,7 +19,7 @@ public class BreakFall extends Skill
SetDesc(new String[]
{
"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);
if (level == 0) return;
event.AddMod(null, GetName(), -(2 * level), false);
event.AddMod(null, GetName(), -0.5 - (1.5 * level), false);
}
@Override
@ -46,4 +46,4 @@ public class BreakFall extends Skill
{
}
}
}

View File

@ -9,6 +9,7 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.block.Action;
import mineplex.core.common.util.UtilEnt;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
@ -43,7 +44,7 @@ public class Pistol extends SkillActive
@Override
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."));
return false;

View File

@ -18,36 +18,42 @@ public class Resistance extends Skill
SetDesc(new String[]
{
"Your body and mind is exceptionally resistant.",
"Durations on you are #0#25 % shorter for;",
"Slow, Fire, Shock, Confusion, Poison, Blindness."
"Durations on you are #20#15 % shorter for;",
"Slow, Fire, Shock, Confusion, Poison,",
"Blindness and Jump Prevention"
});
}
@EventHandler
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
if (event.GetCondition().GetReason().equalsIgnoreCase("Hold Position"))
{
return;
}
int level = getLevel(event.GetCondition().GetEnt());
if (level <= 0)
return;
double reduction = -(0.25f * level);
event.GetCondition().ModifyTicks((int) (event.GetCondition().GetTicksTotal() * reduction));
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());
if (level == 0)
{
return;
}
double reduction = -0.20f - (0.15f * level);
event.GetCondition().ModifyTicks((int) (event.GetCondition().GetTicksTotal() * reduction));
break;
}
}
@Override

View File

@ -67,7 +67,7 @@ public class AxeThrow extends SkillActive implements IThrown
@Override
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."));
return false;

View File

@ -54,7 +54,7 @@ public class BullsCharge extends SkillActive
@Override
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."));
return false;

View File

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

View File

@ -103,7 +103,7 @@ public class HiltSmash extends SkillActive
return false;
//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."));
return false;

View File

@ -1,5 +1,6 @@
package mineplex.minecraft.game.classcombat.Skill.Knight;
import mineplex.core.common.util.UtilEnt;
import mineplex.minecraft.game.core.condition.events.ConditionExpireEvent;
import org.bukkit.Effect;
import org.bukkit.Material;
@ -57,8 +58,7 @@ public class HoldPosition extends SkillActive
@Override
public boolean CustomCheck(Player player, int level)
{
Material type = player.getLocation().getBlock().getType();
if (type == Material.WATER || type == Material.STATIONARY_WATER)
if (UtilEnt.isInWater(player))
{
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
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().Protection(GetName(), player, player, duration, 2, false, false, true);
Factory.Condition().Factory().ArcadeHungerDisable(GetName(), player, player, duration, false);
Factory.Condition().Factory().Jump(GetName(), player, player, duration, 250, false, false, false);
//Inform
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;
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.event.EventHandler;
import org.bukkit.event.EventPriority;
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.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.F;
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.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.SkillFactory;
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class LevelField extends Skill
{
public LevelField(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels)
private final Set<Player> _active = new HashSet<>();
public LevelField(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels)
{
super(skills, name, classType, skillType, cost, levels);
SetDesc(new String[]
SetDesc(new String[]
{
/*
"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 take X less damage.",
"X = (Nearby Enemies) - (Nearby Allies)",
"Players within #4#2 Blocks are considered.",
"",
"Damage can be altered a maximum of #1#1.",
"",
"You can not deal less damage, or take",
"more damage via this."
"Drop Axe/Sword to Use.",
"",
"You deal X more damage.",
"You take X less damage.",
"X = (Nearby Enemies) - (Nearby Allies)",
"Players within #4#2 Blocks are considered.",
"",
"Damage can be altered a maximum of #1#1.",
"You can not deal less damage, or take",
"more damage via this.",
"",
"Lasts for #6#1."
});
}
@EventHandler(priority = EventPriority.HIGH)
public void Decrease(CustomDamageEvent event)
@Override
public String GetRechargeString()
{
if (event.IsCancelled())
return;
if (event.GetCause() != DamageCause.ENTITY_ATTACK)
return;
return "Recharge: #16#-1 Seconds";
}
//Damager
Player damagee = event.GetDamageePlayer();
if (damagee == null) return;
@EventHandler
public void Use(PlayerDropItemEvent event)
{
Player player = event.getPlayer();
LivingEntity damager = event.GetDamagerEntity(false);
if (damager == null) return;
//Level
int level = getLevel(damagee);
if (level == 0) return;
int alt = 0;
for (Player cur : UtilPlayer.getNearby(damagee.getLocation(), 4 + (2 * level)))
if (!(player.getOpenInventory().getTopInventory() instanceof CraftInventoryCrafting))
{
if (cur.equals(damagee))
alt += 1;
else if (Factory.Relation().canHurt(damagee, cur))
alt -= 1;
else
alt += 1;
}
int limit = 1 + level;
if (alt > limit) alt = limit;
if (alt < -limit) alt = -limit;
if (alt >= 0)
return;
//Decrease Damage
event.AddMod(damagee.getName(), GetName(), alt, false);
}
int level = getLevel(player);
if (level == 0 || !UtilGear.isWeapon(event.getItemDrop().getItemStack()) || !Recharge.Instance.usable(player, GetName(), true))
{
return;
}
event.setCancelled(true);
//Check Allowed
SkillTriggerEvent trigger = new SkillTriggerEvent(player, GetName(), GetClassType());
UtilServer.CallEvent(trigger);
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 Increase(CustomDamageEvent event)
public void alterDamage(CustomDamageEvent event)
{
if (event.IsCancelled())
if (event.IsCancelled() || event.GetCause() != DamageCause.ENTITY_ATTACK)
{
return;
if (event.GetCause() != DamageCause.ENTITY_ATTACK)
}
Player damagee = event.GetDamageePlayer(), damager = event.GetDamagerPlayer(false);
if (damagee == null || damager == null)
{
return;
}
//Damager
Player damagee = event.GetDamageePlayer();
if (damagee == null) return;
{
int level = getLevel(damagee);
Player damager = event.GetDamagerPlayer(false);
if (damager == null) return;
if (level == 0)
{
return;
}
//Level
int level = getLevel(damager);
if (level == 0) return;
event.AddMod(damagee.getName(), GetName(), getAlteration(damagee, level, false), false);
}
{
int level = getLevel(damager);
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;
for (Player cur : UtilPlayer.getNearby(damager.getLocation(), 4 + (2 * level)))
for (Player other : UtilPlayer.getNearby(player.getLocation(), 4 + (2 * level)))
{
if (cur.equals(damager))
alt -= 1;
else if (Factory.Relation().canHurt(damager, cur))
alt += 1;
if (player.equals(other))
{
alt--;
}
else if (Factory.Relation().canHurt(player, other))
{
alt++;
}
else
alt -= 1;
{
alt--;
}
}
int limit = 1 + level;
if (alt > limit) alt = limit;
if (alt < -limit) alt = -limit;
if (alt <= 0)
return;
alt = Math.min(alt, limit);
alt = Math.max(alt, -limit);
//Decrease Damage
event.AddMod(damager.getName(), GetName(), alt, false);
if (positive)
{
return Math.max(0, alt);
}
else
{
return Math.min(0, -alt);
}
}
@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.entity.EntityDamageEvent.DamageCause;
import mineplex.core.common.util.UtilEnt;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.F;
@ -51,16 +52,13 @@ public class PowerChop extends SkillActive
@Override
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."));
return false;
}
if (!mineplex.core.recharge.Recharge.Instance.use(player, GetName() + " Cooldown", 250, false, false))
return false;
return true;
return mineplex.core.recharge.Recharge.Instance.use(player, GetName() + " Cooldown", 250, false, false);
}
@Override

View File

@ -12,6 +12,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
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.core.damage.CustomDamageEvent;
import mineplex.core.common.util.F;
@ -59,7 +60,7 @@ public class Riposte extends SkillActive
@Override
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."));
return false;

View File

@ -9,6 +9,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.block.Action;
import org.bukkit.util.Vector;
import mineplex.core.common.util.UtilEnt;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
@ -47,7 +48,7 @@ public class ShieldSmash extends SkillActive
@Override
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."));
return false;

View File

@ -1,37 +1,40 @@
package mineplex.minecraft.game.classcombat.Skill.Mage;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerDropItemEvent;
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.UtilBlock;
import mineplex.core.common.util.UtilGear;
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.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.SkillFactory;
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
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)
{
@ -45,14 +48,14 @@ public class ArcticArmor extends Skill
"in a #3#1 Block radius. Allies inside",
"this area receive Protection 2.",
"",
"You receive Protection 1."
"You receive Protection 2."
});
}
@Override
public String GetEnergyString()
{
return "Energy: #7#-1 per Second";
return "Energy: #11#-1 per Second";
}
@EventHandler
@ -90,13 +93,13 @@ public class ArcticArmor extends Skill
public void Add(Player 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)
{
_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());
}
@ -139,27 +142,47 @@ public class ArcticArmor extends Skill
}
//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);
continue;
}
//Blocks
Location location = cur.getLocation();
double duration = 2000;
HashMap<Block, Double> blocks = UtilBlock.getInRadius(cur.getLocation().getBlock().getLocation(), 3d + 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))));
int radius = 3 + level;
//Snow
Factory.BlockRestore().snow(block, (byte) 0, (byte) 0, (long) (duration * (1 + blocks.get(block))), 250, 0);
UtilBlock.getInRadius(location, radius).forEach((block, scale) ->
{
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)
{
if (event.getType() != UpdateType.FAST)
{
return;
}
for (Player cur : _active)
{
{
//Protection
for (Player other : UtilPlayer.getNearby(cur.getLocation(), 3 + getLevel(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))
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;
closest = dist;
@ -219,20 +248,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
public void Reset(Player player)

View File

@ -1,15 +1,15 @@
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.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.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
@ -17,26 +17,26 @@ import org.bukkit.entity.Snowball;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
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.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
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.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.SkillFactory;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
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,
int cost, int levels,
@ -56,24 +56,20 @@ public class Blizzard extends SkillActive
{
"Hold Block to release a Blizzard.",
"Releases #1#1 snowballs per wave",
"which push players away from you.",
"",
"Target the ground to create snow.",
"Maximum range of #7#1 Blocks.",
"Maximum height of #0#1 Blocks.",
"which push players away from you."
});
}
@Override
public String GetEnergyString()
{
return "Energy: #42#-2 per Second";
return "Energy: 31#-1 per Second";
}
@Override
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."));
return false;
@ -114,14 +110,12 @@ public class Blizzard extends SkillActive
}
//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);
continue;
}
}
}
@EventHandler
public void Snow(UpdateEvent event)

View File

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

View File

@ -1,6 +1,7 @@
package mineplex.minecraft.game.classcombat.Skill.Mage;
import java.util.HashSet;
import java.util.Set;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@ -18,7 +19,8 @@ import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
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,
int cost, int levels,
@ -52,7 +54,7 @@ public class Fissure extends SkillActive
@Override
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."));
return false;
@ -81,19 +83,20 @@ public class Fissure extends SkillActive
public void Update(UpdateEvent event)
{
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);
data.Clear();
}
return;
}
_active.removeIf(data ->
{
if (data.Update())
{
data.Clear();
return true;
}
return false;
});
}
@Override

View File

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

View File

@ -12,6 +12,7 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.block.Action;
import mineplex.core.common.util.UtilEnt;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.core.common.util.F;
import mineplex.core.itemstack.ItemStackFactory;
@ -54,7 +55,7 @@ public class FreezingBlast extends SkillActive implements IThrown
@Override
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."));
return false;

View File

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

View File

@ -15,6 +15,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockFadeEvent;
import mineplex.core.common.util.UtilEnt;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.core.common.util.F;
import mineplex.core.itemstack.ItemStackFactory;
@ -55,7 +56,7 @@ public class IcePrison extends SkillActive implements IThrown
@Override
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."));
return false;

View File

@ -9,26 +9,24 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.util.Vector;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
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.UtilGear;
import mineplex.core.common.util.UtilPlayer;
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.SkillFactory;
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class Immolate extends Skill
{
@ -44,8 +42,7 @@ public class Immolate extends Skill
"",
"Ignite yourself in flaming fury.",
"You receive Strength #1#1 , Speed 1,",
"Fire Resistance and take #0#1 more",
"damage from attacks.",
"Fire Resistance",
"",
"You leave a trail of fire, which",
"ignites players for #0.25#0.25 seconds."
@ -105,25 +102,6 @@ public class Immolate extends Skill
Factory.Condition().EndCondition(player, null, GetName());
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
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().Strength(GetName(), cur, cur, 1.9, level, 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.Sound;
import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
@ -13,16 +14,19 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.util.Vector;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
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.UtilMath;
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.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
{
@ -53,15 +57,15 @@ public class Inferno extends SkillActive
@Override
public String GetEnergyString()
{
return "Energy: #42#-2 per Second";
return "Energy: #34#-1 per Second";
}
@Override
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;
}
@ -100,7 +104,7 @@ public class Inferno extends SkillActive
}
//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);
continue;
@ -113,7 +117,7 @@ public class Inferno extends SkillActive
itemStack.setItemMeta(meta);
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());
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
public void Reset(Player player)
{

View File

@ -1,38 +1,48 @@
package mineplex.minecraft.game.classcombat.Skill.Mage;
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.BlockFace;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
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.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
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.UtilAlg;
import mineplex.core.common.util.UtilEnt;
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.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.SkillFactory;
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
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)
{
@ -53,7 +63,7 @@ public class LifeBonds extends Skill
@Override
public String GetEnergyString()
{
return "Energy: #4.5#-0.5 per Second";
return "Energy: #9#-1 per Second";
}
@EventHandler
@ -129,11 +139,10 @@ public class LifeBonds extends Skill
}
//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);
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);
amount = Math.min((double)(cur.getHealth() - lowestHp) / 2d, amount);
amount = Math.min((cur.getHealth() - lowestHp) / 2d, amount);
//Steal
UtilPlayer.health(cur, -amount);
UtilPlayer.health(cur, -amount * .25);
//Hearts
_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);
}
}
@ -228,16 +233,8 @@ public class LifeBonds extends Skill
{
if (event.getType() != UpdateType.FASTEST)
return;
Iterator<LifeBondsData> heartIterator = _hearts.iterator();
while (heartIterator.hasNext())
{
LifeBondsData data = heartIterator.next();
if (data.Update())
heartIterator.remove();
}
_hearts.removeIf(LifeBondsData::update);
}
@EventHandler
@ -260,34 +257,55 @@ public class LifeBonds extends Skill
if (event.getType() != UpdateType.TICK)
return;
if (_items.isEmpty())
return;
HashSet<Item> remove = new HashSet<Item>();
for (Item cur : _items)
if (UtilEnt.isGrounded(cur) || cur.getTicksLived() > 40 || cur.isDead() || !cur.isValid())
remove.add(cur);
for (Item cur : remove)
_items.removeIf(cur ->
{
Block block = cur.getLocation().getBlock();
if (block.getTypeId() == 0)
if (UtilEnt.isGrounded(cur) || cur.getTicksLived() > 40 || cur.isDead() || !cur.isValid())
{
int below = block.getRelative(BlockFace.DOWN).getTypeId();
if (below == 2 || below == 3)
Block block = cur.getLocation().getBlock();
if (block.getType() == Material.AIR)
{
byte data = 0;
if (cur.getItemStack().getData() != null)
data = cur.getItemStack().getData().getData();
int below = block.getRelative(BlockFace.DOWN).getTypeId();
if (below == 2 || below == 3)
{
byte data = 0;
if (cur.getItemStack().getData() != null)
data = cur.getItemStack().getData().getData();
Factory.BlockRestore().add(block, cur.getItemStack().getTypeId(), data, 2000);
Factory.BlockRestore().add(block, cur.getItemStack().getTypeId(), data, 2000);
}
}
cur.remove();
return true;
}
_items.remove(cur);
cur.remove();
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
@ -295,4 +313,36 @@ public class LifeBonds extends Skill
{
_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;
import java.util.ArrayList;
import java.util.HashMap;
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.Material;
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.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 static class LightningOrbEvent extends PlayerEvent
@ -51,7 +50,7 @@ public class LightningOrb extends SkillActive implements IThrown
private final List<LivingEntity> _struck;
public LightningOrbEvent(Player who, List<LivingEntity> struck)
LightningOrbEvent(Player who, List<LivingEntity> struck)
{
super(who);
@ -81,7 +80,7 @@ public class LightningOrb extends SkillActive implements IThrown
SetDesc(new String[]
{
"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 ",
"with lightning, dealing #4#1 damage and",
"giving Slow 2 for 4 seconds."
@ -91,7 +90,7 @@ public class LightningOrb extends SkillActive implements IThrown
@Override
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."));
return false;
@ -106,7 +105,7 @@ public class LightningOrb extends SkillActive implements IThrown
//Action
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());
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);
//Inform
@ -119,22 +118,28 @@ public class LightningOrb extends SkillActive implements IThrown
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
Strike(target, data);
Strike(data);
}
@Override
public void Idle(ProjectileUser data)
{
Strike(null, data);
Strike(data);
}
@Override
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
data.getThrown().remove();
@ -149,40 +154,28 @@ public class LightningOrb extends SkillActive implements IThrown
int level = getLevel(player);
if (level == 0) return;
HashMap<LivingEntity, Double> hit = UtilEnt.getInRadius(data.getThrown().getLocation(), 3 + 0.5 * level);
List<LivingEntity> struck = new ArrayList<>();
//Lightning
for (LivingEntity cur : hit.keySet())
UtilEnt.getInRadius(data.getThrown().getLocation(), 3 + 0.5 * level).forEach((cur, scale) ->
{
if (cur.equals(player))
continue;
if (cur.equals(player) || (cur instanceof Player && !Factory.Relation().canHurt(player, (Player) cur)))
{
return;
}
//Inform
UtilPlayer.message(cur, F.main(GetClassType().name(), F.name(player.getName()) + " hit you with " + F.skill(GetName(level)) + "."));
//Lightning
cur.getWorld().strikeLightningEffect(cur.getLocation());
//Damage Event
Factory.Damage().NewDamageEvent(cur, player, null,
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;
//Damage Event
Factory.Damage().NewDamageEvent(cur, player, null, DamageCause.LIGHTNING, 4 + level, false, true, false, player.getName(), GetName());
Factory.Condition().Factory().Slow(GetName(), cur, player, 4, 1, false, true, true, true);
Factory.Condition().Factory().Shock(GetName(), cur, player, 1, false, true);
}
struck.add(cur);
});
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[]
{
"Your sword deals an additional,",
"#0.25#0.25 damage to burning opponents,",
"#0#1 damage to burning opponents,",
"but also extinguishes them.",
});
}
@ -54,7 +54,7 @@ public class MagmaBlade extends Skill
if (level == 0) return;
//Damage
event.AddMod(damager.getName(), GetName(), 0.25 + 0.25 * level, true);
event.AddMod(damager.getName(), GetName(), level, true);
//Effect
damager.getWorld().playSound(damager.getLocation(), Sound.FIZZ, 0.8f, 0f);
@ -68,4 +68,4 @@ public class MagmaBlade extends Skill
{
}
}
}

View File

@ -6,11 +6,10 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
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.core.damage.CustomDamageEvent;
import mineplex.minecraft.game.classcombat.Skill.Skill;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class NullBlade extends Skill
{
@ -21,7 +20,7 @@ public class NullBlade extends Skill
SetDesc(new String[]
{
"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;
//Energy
Factory.Energy().ModifyEnergy(damager, 2 + 2 * level);
Factory.Energy().ModifyEnergy(damager, 4 + 2 * level);
//Damage
event.AddMod(damager.getName(), GetName(), 0, false);

View File

@ -83,7 +83,7 @@ public class Rupture extends SkillActiveCharge
@Override
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."));
return false;
@ -226,13 +226,15 @@ public class Rupture extends SkillActiveCharge
public boolean CanTravel(Block block)
{
int id = block.getTypeId();
return !UtilBlock.liquid(block)
//return true
/*int id = block.getTypeId();
return (id == 1 ||
id == 2 ||
id == 3 ||
id == 12 ||
id == 13);
id == 13)*/;
}
public void DisplayRupture(Player cur)

View File

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

View File

@ -1,6 +1,7 @@
package mineplex.minecraft.game.classcombat.Skill.Mage;
import java.util.HashSet;
import java.util.Set;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
@ -8,6 +9,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerDropItemEvent;
import mineplex.core.common.util.UtilEnt;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.F;
@ -22,7 +24,8 @@ import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
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)
{
@ -37,7 +40,7 @@ public class Void extends Skill
"use no energy to swing weapons.",
"",
"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))
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."));
_active.remove(cur);
@ -184,7 +187,7 @@ public class Void extends Skill
int level = getLevel(damagee);
if (level == 0) return;
double dmgToEnergy = 11 - level;
double dmgToEnergy = 8 - level;
int dmgLower = 1 + level;
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.potion.PotionEffectType;
import mineplex.core.common.util.UtilEnt;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.F;
@ -57,7 +58,7 @@ public class Agility extends SkillActive
@Override
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."));
return false;

View File

@ -1,27 +1,28 @@
package mineplex.minecraft.game.classcombat.Skill.Ranger;
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.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityShootBowEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
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.SkillFactory;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
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)
{
super(skills, name, classType, skillType, cost, levels);
@ -35,67 +36,75 @@ public class BarbedArrows extends Skill
"Duration scales with arrow velocity."
});
}
@EventHandler (priority = EventPriority.MONITOR)
public void bowShoot(EntityShootBowEvent event)
{
int level = getLevel(event.getEntity());
if (level == 0)
if (level == 0)
{
return;
if (!(event.getProjectile() instanceof Projectile))
return;
_arrows.add((Projectile)event.getProjectile());
}
_arrows.add(event.getProjectile());
}
@EventHandler(priority = EventPriority.HIGH)
public void damage(CustomDamageEvent event)
{
if (event.IsCancelled())
{
return;
if (event.GetCause() != DamageCause.PROJECTILE)
return;
}
Projectile projectile = event.GetProjectile();
if (projectile == null) return;
if (projectile == null || !_arrows.remove(projectile))
{
return;
}
LivingEntity damagee = event.GetDamageeEntity();
if (damagee == null) return;
Player damager = event.GetDamagerPlayer(true);
if (damager == null) return;
if (damagee == null || damager == null)
{
return;
}
//Level
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();
if (damageePlayer != null)
{
damageePlayer.setFoodLevel(2);
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
public void clean(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
return;
for (Iterator<Projectile> arrowIterator = _arrows.iterator(); arrowIterator.hasNext();)
if (event.getType() != UpdateType.SLOW)
{
Projectile arrow = arrowIterator.next();
if (arrow.isDead() || !arrow.isValid())
arrowIterator.remove();
return;
}
_arrows.removeIf(arrow -> !arrow.isValid());
}
@Override

View File

@ -61,7 +61,7 @@ public class Disengage extends SkillActive
@Override
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."));
return false;

View File

@ -3,9 +3,7 @@ package mineplex.minecraft.game.classcombat.Skill.Ranger;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.bukkit.Location;
@ -41,8 +39,9 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
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,
int cost, int levels,
@ -74,7 +73,7 @@ public class ExplosiveShot extends SkillActive
@Override
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."));
return false;

View File

@ -1,7 +1,7 @@
package mineplex.minecraft.game.classcombat.Skill.Ranger;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.bukkit.Effect;
import org.bukkit.EntityEffect;
@ -9,35 +9,31 @@ import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
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.EntityDamageEvent.DamageCause;
import org.bukkit.potion.PotionEffectType;
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.UtilEnt;
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.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.SkillFactory;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
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,
int cost, int levels,
@ -70,7 +66,7 @@ public class HealingShot extends SkillActive
@Override
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."));
return false;
@ -112,46 +108,31 @@ public class HealingShot extends SkillActive
_arrows.add(event.getProjectile());
}
@SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.NORMAL)
public void arrowHit(EntityDamageEvent event)
@EventHandler
public void arrowHit(CustomDamageEvent event)
{
if (event.getCause() != DamageCause.PROJECTILE)
return;
if (!(event instanceof EntityDamageByEntityEvent))
return;
EntityDamageByEntityEvent eventEE = (EntityDamageByEntityEvent)event;
if (!(eventEE.getDamager() instanceof Projectile))
return;
Projectile projectile = (Projectile)eventEE.getDamager();
Player damager = event.GetDamagerPlayer(true);
Projectile projectile = event.GetProjectile();
//Not Pin Down Arrow
if (!_arrows.contains((Entity)projectile))
if (!_arrows.remove(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
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();
//Regen
@ -184,9 +165,9 @@ public class HealingShot extends SkillActive
"You hit " + F.name(UtilEnt.getName(damagee)) +" with " + F.skill(GetName(level)) + "."));
//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,
ViewDist.MAX, UtilServer.getPlayers());
ViewDist.LONG);
//Remove
projectile.remove();
@ -200,8 +181,7 @@ public class HealingShot extends SkillActive
for (Entity ent : _arrows)
{
UtilParticle.PlayParticle(ParticleType.HEART, ent.getLocation(), 0, 0, 0, 0, 1,
ViewDist.MAX, UtilServer.getPlayers());
UtilParticle.PlayParticleToAll(ParticleType.HEART, ent.getLocation(), 0, 0, 0, 0, 1, ViewDist.LONG);
}
}
@ -210,14 +190,8 @@ public class HealingShot extends SkillActive
{
if (event.getType() != UpdateType.SEC)
return;
for (Iterator<Entity> arrowIterator = _arrows.iterator(); arrowIterator.hasNext();)
{
Entity arrow = arrowIterator.next();
if (arrow.isDead() || !arrow.isValid() || arrow.isOnGround())
arrowIterator.remove();
}
_arrows.removeIf(arrow -> !arrow.isValid() || arrow.isOnGround());
}
@Override

View File

@ -36,11 +36,11 @@ public class HeavyArrows extends Skill
SetDesc(new String[]
{
"Your arrows are extremely heavy,",
"moving #5#5 % slower and dealing",
"moving 20% slower and dealing",
"an additional #10#10 % knockback",
"as well as #1#1 additional damage.",
"",
"You also receive #12#6 % reversed",
"You also receive 30% reversed",
"velocity of your arrows while not",
"sneaking.",
});
@ -64,13 +64,13 @@ public class HeavyArrows extends Skill
//Backboost
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,
false, 0, 0.3, 0.6, true);
}
//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());
}

View File

@ -59,7 +59,7 @@
// @Override
// 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."));
// return false;

View File

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

View File

@ -70,7 +70,7 @@ public class NapalmShot extends SkillActive
@Override
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."));
return false;
@ -125,7 +125,7 @@ public class NapalmShot extends SkillActive
Projectile projectile = event.GetProjectile();
if (projectile == null) return;
if (!_arrows.contains((Entity)projectile))
if (!_arrows.contains(projectile))
return;
LivingEntity damagee = event.GetDamageeEntity();
@ -205,14 +205,8 @@ public class NapalmShot extends SkillActive
{
if (event.getType() != UpdateType.SEC)
return;
for (Iterator<Entity> arrowIterator = _arrows.iterator(); arrowIterator.hasNext();)
{
Entity arrow = arrowIterator.next();
if (arrow.isDead() || !arrow.isValid() || arrow.isOnGround())
arrowIterator.remove();
}
_arrows.removeIf(arrow -> !arrow.isValid() || arrow.isOnGround());
}
@Override

View File

@ -1,21 +1,8 @@
package mineplex.minecraft.game.classcombat.Skill.Ranger;
import java.util.Iterator;
import java.util.Map;
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.entity.Arrow;
import org.bukkit.entity.Entity;
@ -26,15 +13,26 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
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
{
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,
SkillType skillType, int cost, int maxLevel)
{
super(skills, name, classType, skillType, cost, maxLevel,
0.016f, 0.008f, false, true);
0.0225f, 0.005f, false, true);
SetDesc(new String[]
{
@ -42,15 +40,22 @@ public class Overcharge extends SkillChargeBow
"",
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
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);
if (charge >= 1)
{
//Increase Speed
arrow.setVelocity(arrow.getVelocity().multiply(1 + (.05 * getLevel(player))));
}
}
@EventHandler(priority = EventPriority.HIGH)
@ -95,8 +100,7 @@ public class Overcharge extends SkillChargeBow
for (Entity ent : _arrows.keySet())
{
UtilParticle.PlayParticle(ParticleType.RED_DUST, ent.getLocation(), 0, 0, 0, 0, 1,
ViewDist.MAX, UtilServer.getPlayers());
UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, ent.getLocation(), null, 0, 1, ViewDist.LONG);
}
}
@ -105,13 +109,7 @@ public class Overcharge extends SkillChargeBow
{
if (event.getType() != UpdateType.SEC)
return;
for (Iterator<Arrow> arrowIterator = _arrows.keySet().iterator(); arrowIterator.hasNext();)
{
Arrow arrow = arrowIterator.next();
if (arrow.isDead() || !arrow.isValid() || arrow.isOnGround())
arrowIterator.remove();
}
_arrows.keySet().removeIf(arrow -> !arrow.isValid() || arrow.isOnGround());
}
}
}

View File

@ -1,6 +1,9 @@
package mineplex.minecraft.game.classcombat.Skill.Ranger;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.bukkit.Effect;
import org.bukkit.EntityEffect;
@ -15,6 +18,8 @@ import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
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.core.common.util.F;
import mineplex.core.updater.event.UpdateEvent;
@ -27,7 +32,9 @@ import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
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,
int cost, int levels,
@ -53,7 +60,7 @@ public class PinDown extends SkillActive
@Override
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."));
return false;
@ -119,6 +126,8 @@ public class PinDown extends SkillActive
//Cripple
double dur = 3 + level;
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
event.AddMod(damager.getName(), GetName(), -2, true);
@ -127,7 +136,14 @@ public class PinDown extends SkillActive
//Effect
for (int i=0 ; i<3 ; i++)
damagee.playEffect(EntityEffect.HURT);
Player damgeePlayer = event.GetDamageePlayer();
if (damgeePlayer != null)
{
_foodLevel.put(damgeePlayer, damgeePlayer.getFoodLevel());
damgeePlayer.setFoodLevel(1);
}
//Clean
_arrows.remove(projectile);
projectile.remove();
@ -141,15 +157,29 @@ public class PinDown extends SkillActive
public void Clean(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
{
return;
HashSet<Projectile> remove = new HashSet<Projectile>();
}
for (Projectile cur : _arrows)
if (cur.isDead() || !cur.isValid())
remove.add(cur);
_arrows.removeIf(projectile -> projectile.isDead() || !projectile.isValid());
_foodLevel.keySet().removeIf(player -> !player.isOnline());
}
for (Projectile cur : remove)
_arrows.remove(cur);
@EventHandler
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

View File

@ -28,7 +28,7 @@ public class VitalitySpores extends Skill
SetDesc(new String[]
{
"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",
});
}
@ -62,7 +62,7 @@ public class VitalitySpores extends Skill
{
Entry<Player, Long> entry = iterator.next();
if (UtilTime.elapsed(entry.getValue(), 10000))
if (UtilTime.elapsed(entry.getValue(), 8000))
{
iterator.remove();
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;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap;
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.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.UtilGear;
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.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.UtilParticle;
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.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.SkillFactory;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class WolfsFury extends SkillActive
{
private WeakHashMap<Player, Long> _active = new WeakHashMap<Player, Long>();
private HashSet<Player> _swing = new HashSet<Player>();
private HashSet<Player> _miss = new HashSet<Player>();
private final Map<Player, Long> _active = new WeakHashMap<>();
private final Set<Player> _swing = new HashSet<>();
private final Set<Player> _miss = new HashSet<>();
public WolfsFury(SkillFactory skills, String name, ClassType classType, SkillType skillType,
int cost, int levels,
@ -53,7 +57,7 @@ public class WolfsFury extends SkillActive
SetDesc(new String[]
{
"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.",
"",
"If you miss two consecutive attacks,",
@ -64,7 +68,7 @@ public class WolfsFury extends SkillActive
@Override
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."));
return false;
@ -80,7 +84,7 @@ public class WolfsFury extends SkillActive
_active.put(player, System.currentTimeMillis() + 8000);
//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
UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + "."));
@ -92,18 +96,21 @@ public class WolfsFury extends SkillActive
@EventHandler
public void Expire(UpdateEvent event)
{
//End Skill
if (event.getType() == UpdateType.FAST)
if (event.getType() != UpdateType.FAST)
{
HashSet<Player> expired = new HashSet<Player>();
for (Player cur : _active.keySet())
if (System.currentTimeMillis() > _active.get(cur))
expired.add(cur);
for (Player cur : expired)
End(cur);
return;
}
_active.entrySet().removeIf(entry ->
{
if (System.currentTimeMillis() > entry.getValue())
{
End(entry.getKey());
return true;
}
return false;
});
}
@EventHandler
@ -157,26 +164,23 @@ public class WolfsFury extends SkillActive
public void Miss(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
HashSet<Player> expired = new HashSet<Player>();
for (Player cur : _swing)
expired.add(cur);
for (Player cur : expired)
{
_swing.remove(cur);
if (_miss.remove(cur))
return;
}
_swing.removeIf(player ->
{
if (_miss.remove(player))
{
End(cur);
End(player);
}
else
{
_miss.add(cur);
_miss.add(player);
}
}
return true;
});
}
public void End(Player player)
@ -198,9 +202,9 @@ public class WolfsFury extends SkillActive
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,
ViewDist.LONG, UtilServer.getPlayers());
ViewDist.LONG);
}
}

View File

@ -1,20 +1,5 @@
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.entity.LivingEntity;
import org.bukkit.entity.Player;
@ -22,6 +7,20 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
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
{
private NautHashMap<Player, Long> _live = new NautHashMap<Player, Long>();
@ -82,7 +81,7 @@ public class WolfsPounce extends SkillChargeSword
//End
for (Player player : GetUsers())
{
if (!UtilEnt.isGrounded(player))
if (!UtilEnt.onBlock(player))
continue;
if (!_live.containsKey(player))
@ -173,4 +172,4 @@ public class WolfsPounce extends SkillChargeSword
_charge.remove(player);
_live.remove(player);
}
}
}

View File

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

View File

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

View File

@ -1,18 +1,5 @@
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.entity.Arrow;
import org.bukkit.entity.Player;
@ -21,6 +8,17 @@ import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityShootBowEvent;
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
{
protected boolean _canChargeInWater;

View File

@ -145,8 +145,8 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
_movement = movement;
_teleport = teleport;
_energy = energy;
_skillMap = new HashMap<String, Skill>();
_skillSalesPackageMap = new HashMap<Integer, ISkill>();
_skillMap = new HashMap<>();
_skillSalesPackageMap = new HashMap<>();
PopulateSkills();
}
@ -181,7 +181,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
for (Skill skill : _skillMap.values())
getPlugin().getServer().getPluginManager().registerEvents(skill, getPlugin());
List<SkillToken> skillTokens = new ArrayList<SkillToken>();
List<SkillToken> skillTokens = new ArrayList<>();
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,
1, 4,
0, 0,
12000, 0, true,
9000, 1000, true,
new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE},
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,
1, 4,
0, 0,
20000, -2000, true,
20000, -3000, true,
new Material[] {Material.BOW},
new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK}));
@ -453,7 +453,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
//Axe
AddSkill(new FireBlast(this, "Fire Blast", ClassType.Mage, SkillType.Axe,
1, 5,
60, -3,
54, -4,
13000, -1000, true,
new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE},
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,
1, 5,
60, -3,
53, -3,
13000, -1000, true,
new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
@ -501,8 +501,8 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
//Passive B
AddSkill(new GlacialBlade(this, "Glacial Blade", ClassType.Mage, SkillType.PassiveB,
1, 3,
16, -2,
1200, -250, false,
11, -2,
1000, -100, false,
new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD},
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,
1, 4,
0, 0,
18000, 2000, true,
17000, 2000, true,
new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE},
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,
1, 4,
0, 0,
20000, -2000, false,
22000, -2000, false,
new Material[] {Material.BOW},
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
{
protected ItemFactory Factory;
private Material _type;
private String _name;
private String[] _desc;
private int _amount;
protected final ItemFactory Factory;
private final Material _type;
private final String _name;
private final String[] _desc;
private final int _amount;
private boolean _free;
private int _gemCost;
private boolean _canDamage;
private final int _gemCost;
private final boolean _canDamage;
private int _tokenCost;

View File

@ -7,6 +7,7 @@ import java.util.HashSet;
import mineplex.core.MiniPlugin;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.minecraft.game.core.IRelation;
import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.core.energy.Energy;
import mineplex.minecraft.game.core.fire.Fire;
@ -22,23 +23,25 @@ import org.bukkit.plugin.java.JavaPlugin;
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 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 HashMap<String, Item> _items;
private HashSet<String> _ignore;
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)
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);
@ -49,8 +52,9 @@ public class ItemFactory extends MiniPlugin implements IItemFactory
_fire = fire;
_projectileManager = projectileManager;
_proxyManager = new ProximityManager();
_items = new HashMap<String, Item>();
_relation = relation;
_items = new HashMap<>();
_ignore = ignore;
try
@ -58,16 +62,12 @@ public class ItemFactory extends MiniPlugin implements IItemFactory
_itemMaxDurability = net.minecraft.server.v1_8_R3.Item.class.getDeclaredField("durability");
_itemMaxDurability.setAccessible(true);
}
catch (SecurityException e)
catch (SecurityException | NoSuchFieldException e)
{
e.printStackTrace();
}
catch (NoSuchFieldException e)
{
e.printStackTrace();
}
PopulateFactory();
PopulateFactory();
}
private void PopulateFactory()
@ -120,7 +120,7 @@ public class ItemFactory extends MiniPlugin implements IItemFactory
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.L, true, 500, 0, 1f,
-1, true, true, true, false));
@ -234,7 +234,17 @@ public class ItemFactory extends MiniPlugin implements IItemFactory
{
return _projectileManager;
}
public IRelation getRelation()
{
return _relation;
}
public ProximityManager getProximityManager()
{
return _proxyManager;
}
@Override
public void registerSelf()
{
@ -256,9 +266,4 @@ public class ItemFactory extends MiniPlugin implements IItemFactory
HandlerList.unregisterAll(_proxyManager);
}
public ProximityManager getProximityManager()
{
return _proxyManager;
}
}
}

View File

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

View File

@ -1,22 +1,41 @@
package mineplex.minecraft.game.classcombat.item.Throwable;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
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.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.projectile.ProjectileUser;
import mineplex.minecraft.game.classcombat.item.ItemFactory;
import mineplex.minecraft.game.classcombat.item.ItemUsable;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
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,
int amount, boolean canDamage, int gemCost, int tokenCost,
ActionType useAction, boolean useStock, long useDelay,
@ -45,14 +64,25 @@ public class WaterBottle extends ItemUsable
{
Player player = event.getPlayer();
if (((CraftPlayer)player).getHandle().spectating)
if (UtilPlayer.isSpectator(player))
{
return;
}
//Extinguish
player.setFireTicks(-20);
//Resist
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
player.getWorld().playSound(player.getLocation(), Sound.SPLASH, 1f, 1.4f);
@ -85,10 +115,18 @@ public class WaterBottle extends ItemUsable
public void Break(ProjectileUser data)
{
if (!(data.getThrower() instanceof Player))
{
return;
}
Player thrower = (Player) data.getThrower();
Location location = data.getThrown().getLocation();
//Splash
data.getThrown().getWorld().playEffect(data.getThrown().getLocation(), Effect.STEP_SOUND, 20);
data.getThrown().getWorld().playEffect(data.getThrown().getLocation(), Effect.STEP_SOUND, 8);
data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.SPLASH, 1f, 1.4f);
data.getThrown().getWorld().playEffect(location, Effect.STEP_SOUND, 20);
data.getThrown().getWorld().playEffect(location, Effect.STEP_SOUND, 8);
data.getThrown().getWorld().playSound(location, Sound.SPLASH, 1f, 1.4f);
//Extinguish
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))
{
if (Factory.getRelation().canHurt(player, thrower))
{
continue;
}
//Extinguish
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;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.Location;
@ -7,12 +10,15 @@ import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.Vector;
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.UtilMath;
import mineplex.core.projectile.ProjectileUser;
import mineplex.minecraft.game.classcombat.item.ItemFactory;
import mineplex.minecraft.game.classcombat.item.ItemUsable;
@ -20,6 +26,9 @@ import mineplex.minecraft.game.classcombat.item.event.WebTossEvent;
public class Web extends ItemUsable
{
private final Map<Block, LivingEntity> _owner = new HashMap<>();
public Web(ItemFactory factory, Material type,
int amount, boolean canDamage, int gemCost, int tokenCost,
ActionType useAction, boolean useStock, long useDelay,
@ -54,19 +63,19 @@ public class Web extends ItemUsable
}
}
CreateWeb(data.getThrown());
createWeb(data.getThrown());
}
@Override
public void Idle(ProjectileUser data)
{
CreateWeb(data.getThrown());
createWeb(data.getThrown());
}
@Override
public void Expire(ProjectileUser data)
{
CreateWeb(data.getThrown());
createWeb(data.getThrown());
}
@Override
@ -75,7 +84,7 @@ public class Web extends ItemUsable
data.getThrown().remove();
}
public void CreateWeb(Entity ent)
private void createWeb(Entity ent)
{
LivingEntity thrower = Factory.Throw().getThrower(ent);
@ -85,8 +94,12 @@ public class Web extends ItemUsable
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);
}
}
private boolean canWeb(LivingEntity thrower, Location location)
@ -96,4 +109,21 @@ public class Web extends ItemUsable
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)
{
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

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

View File

@ -9,6 +9,6 @@ public class BoosterSword extends Item
{
public BoosterSword(ItemFactory factory, int gemCost, int tokenCost)
{
super(factory, "Booster Sword", new String[] { "Increases Sword Skill level by 1" }, Material.GOLD_SWORD, 1, 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()
{
PermissionGroup.CONTENT.setPermission(Perm.SKILL_UNLOCK, true, true);
PermissionGroup.TRAINEE.setPermission(Perm.SKILL_UNLOCK, true, true);
PermissionGroup.ULTRA.setPermission(Perm.SKILL_UNLOCK_LEGACY, true, true);
}

View File

@ -1,16 +1,23 @@
package mineplex.minecraft.game.classcombat.shop.button;
import org.bukkit.Material;
import org.bukkit.entity.Player;
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.minecraft.game.classcombat.Class.repository.token.CustomBuildToken;
import mineplex.minecraft.game.classcombat.shop.page.CustomBuildPage;
public class DeleteCustomBuildButton implements IButton
{
private CustomBuildPage _page;
private CustomBuildToken _customBuild;
private final CustomBuildPage _page;
private final CustomBuildToken _customBuild;
public DeleteCustomBuildButton(CustomBuildPage page, CustomBuildToken customBuild)
{
@ -21,6 +28,23 @@ public class DeleteCustomBuildButton implements IButton
@Override
public void onClick(Player player, ClickType clickType)
{
_page.DeleteCustomBuild(_customBuild);
_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);
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
{
CLOAK,
UNTRUE_CLOAK,
SHOCK,
POISON_SHOCK,
SILENCE,

View File

@ -2,15 +2,12 @@ package mineplex.minecraft.game.core.condition;
import java.util.Iterator;
import mineplex.core.Managers;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilTime;
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;
import net.minecraft.server.v1_8_R3.Packet;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntity;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntity.PacketPlayOutEntityLook;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntity.PacketPlayOutRelEntityMove;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityTeleport;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
@ -24,14 +21,34 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityTargetEvent;
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)
{
Manager = manager;
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)
@ -62,7 +79,7 @@ public class ConditionEffect implements Listener
LivingEntity ent = event.GetDamageeEntity();
if (ent == null) return;
if (!Manager.IsCloaked(ent))
if (!Manager.IsCloaked(ent) && !Manager.isUntrueCloaked(ent))
return;
//Set Damage
@ -445,4 +462,53 @@ public class ConditionEffect implements Listener
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));
}
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,
int mult, double duration, boolean extend, boolean showIndicator)
{

View File

@ -540,6 +540,11 @@ public class ConditionManager extends MiniPlugin
return false;
}
public boolean isUntrueCloaked(LivingEntity ent)
{
return _activeConditions.containsKey(ent) && _activeConditions.get(ent).stream().anyMatch(condition -> condition.GetCondition().GetType() == ConditionType.UNTRUE_CLOAK);
}
@EventHandler
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;
import mineplex.core.Managers;
import mineplex.core.newnpc.NewNPCManager;
import mineplex.core.npc.NpcManager;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
@ -23,5 +25,15 @@ public class NpcProtectListener implements Listener
{
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");
}
}
}
}

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