diff --git a/TwosideKeeper.jar b/TwosideKeeper.jar index 134c084..b27c79a 100644 Binary files a/TwosideKeeper.jar and b/TwosideKeeper.jar differ diff --git a/src/sig/plugin/TwosideKeeper/Buff.java b/src/sig/plugin/TwosideKeeper/Buff.java index 48b0320..c7b2e8e 100644 --- a/src/sig/plugin/TwosideKeeper/Buff.java +++ b/src/sig/plugin/TwosideKeeper/Buff.java @@ -107,7 +107,12 @@ public class Buff { return null; } } + public static void addBuff(LivingEntity l, String name, Buff buff) { + addBuff(l,name,buff,false); + } + + public static void addBuff(LivingEntity l, String name, Buff buff, boolean stacking) { if (l instanceof Player) { Player p = (Player)l; PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); @@ -116,6 +121,11 @@ public class Buff { if (hasBuff(p,name)) { oldlv = pd.buffs.get(name).getAmplifier(); oldduration = pd.buffs.get(name).getRemainingBuffTime(); + if (stacking) { + buff.setStacks(buff.getAmplifier()+oldlv); + pd.buffs.put(name, buff); + return; + } } else { pd.buffs.put(name, buff); return; @@ -136,6 +146,11 @@ public class Buff { if (hasBuff(l,name)) { oldlv = les.buffs.get(name).getAmplifier(); oldduration = les.buffs.get(name).getRemainingBuffTime(); + if (stacking) { + buff.setStacks(buff.getAmplifier()+oldlv); + les.buffs.put(name, buff); + return; + } } else { les.buffs.put(name, buff); return; diff --git a/src/sig/plugin/TwosideKeeper/CustomDamage.java b/src/sig/plugin/TwosideKeeper/CustomDamage.java index 5fe16e6..0929866 100644 --- a/src/sig/plugin/TwosideKeeper/CustomDamage.java +++ b/src/sig/plugin/TwosideKeeper/CustomDamage.java @@ -274,6 +274,8 @@ public class CustomDamage { dmg += addMultiplierToPlayerLogger(damager,target,"WEAKNESS Mult",dmg * calculateWeaknessEffectMultiplier(shooter,target)); dmg += addMultiplierToPlayerLogger(damager,target,"POISON Mult",dmg * calculatePoisonEffectMultiplier(target)); dmg += addMultiplierToPlayerLogger(damager,target,"Airborne Mult",dmg * calculateAirborneAttackMultiplier(shooter)); + dmg += addMultiplierToPlayerLogger(damager,target,"Dodge Chance Set Bonus Mult",dmg * calculateDodgeChanceSetBonusMultiplier(shooter)); + dmg += addMultiplierToPlayerLogger(damager,target,"Damage Reduction Set Bonus Mult",dmg * calculateDamageReductionSetBonusMultiplier(shooter)); if (reason==null || !reason.equalsIgnoreCase("Test Damage")) { double critdmg = addMultiplierToPlayerLogger(damager,target,"Critical Strike Mult",dmg * calculateCriticalStrikeMultiplier(weapon,shooter,target,reason,flags)); if (critdmg!=0.0) {crit=true; @@ -308,6 +310,30 @@ public class CustomDamage { return dmg; } + private static double calculateDodgeChanceSetBonusMultiplier(LivingEntity shooter) { + double mult = 0.0; + if (shooter instanceof Player) { + Player p = (Player)shooter; + if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.LUCI, 3)) { + double dodgechance = CalculateDodgeChance((Player)shooter); + mult = dodgechance*ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.LUCI, 3, 3); + } + } + return mult; + } + + private static double calculateDamageReductionSetBonusMultiplier(LivingEntity shooter) { + double mult = 0.0; + if (shooter instanceof Player) { + Player p = (Player)shooter; + if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.LUCI, 3)) { + double damagered = 1-CalculateDamageReduction(1,(Player)shooter,null); + mult = damagered*ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.LUCI, 4, 4); + } + } + return mult; + } + private static double getDamageReduction(LivingEntity target) { if (target instanceof Player) { double reduction = 0; @@ -679,6 +705,8 @@ public class CustomDamage { pd.lastcombat=TwosideKeeper.getServerTickTime(); increaseBarbarianStacks(p,weapon); damage = applyBarbarianBonuses(p,target,weapon,damage,reason); + increaseWindCharges(p); + applyWindSlashEffects(p,target,damage,reason); if (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER) { if (isFlagSet(pd.lasthitproperties,IS_CRIT)) { @@ -747,6 +775,32 @@ public class CustomDamage { return damage; } + private static void applyWindSlashEffects(Player p, LivingEntity target, double damage, String reason) { + if (reason!=null && reason.equalsIgnoreCase("Wind Slash")) { + GenericFunctions.knockupEntities(0.4d, target); + if (damage>target.getHealth()) { + //Target killed. + int settier = ItemSet.GetItemTier(p.getEquipment().getItemInMainHand()); + Buff.addBuff(p, "WINDCHARGE", new Buff("Wind",20*60,settier*5,Color.GRAY,"๑",true), true); + CustomDamage.setAbsorptionHearts(p, CustomDamage.getAbsorptionHearts(p)+settier); + } + } + } + + private static void increaseWindCharges(Player p) { + if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.WINDRY, 2)) { + int windchargeamt = (int)ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.WINDRY, 2, 2); + PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); + Buff.addBuff(p, "WINDCHARGE", new Buff("Wind",20*60,windchargeamt,Color.GRAY,"๑",true),true); + Buff b = Buff.getBuff(p, "WINDCHARGE"); + int maxWindStacks = ItemSet.getHighestTierInSet(p,ItemSet.WINDRY)*10; + if (b.getAmplifier()>maxWindStacks) { + b.setStacks(maxWindStacks); + } + GenericFunctions.sendActionBarMessage(p, "", true); + } + } + private static double IncreaseDamageDealtByElites(Player p, Entity damager, double damage) { LivingEntity shooter = getDamagerEntity(damager); if (shooter!=null) { @@ -1851,7 +1905,9 @@ public class CustomDamage { dodgechance=addMultiplicativeValue(dodgechance,ItemSet.GetTotalBaseAmount(p, ItemSet.DARNYS)/100d); dodgechance=addMultiplicativeValue(dodgechance,ItemSet.GetTotalBaseAmount(p, ItemSet.JAMDAK)/100d); dodgechance=addMultiplicativeValue(dodgechance,ItemSet.GetTotalBaseAmount(p, ItemSet.LORASAADI)/100d); - + if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.LUCI, 2)) { + dodgechance=addMultiplicativeValue(dodgechance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.LUCI, 2, 2)/100d); + } PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); if (ArtifactAbility.containsEnchantment(ArtifactAbility.SHADOWWALKER, p.getEquipment().getItemInMainHand()) && @@ -1899,7 +1955,8 @@ public class CustomDamage { dodgechance=0.95; } - if (pd.fulldodge || pd.slayermegahit) { + if (pd.fulldodge || pd.slayermegahit || + Buff.hasBuff(p, "BEASTWITHIN")) { dodgechance = 1.0; } @@ -1923,7 +1980,7 @@ public class CustomDamage { int partylevel = 0; int rangeraegislevel = 0; double magmacubediv = 0; - double rangerdmgdiv = 0; + double dmgreductiondiv = 0; double tacticspct = 0; double darknessdiv = 0; double playermodediv = 0; @@ -1934,8 +1991,8 @@ public class CustomDamage { ItemStack[] armor = GenericFunctions.getEquipment(target,true); if (target instanceof Player) { Player p = (Player)target; - rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DARNYS, 2, 2)/100d; - rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DARNYS, 3, 3)/100d; + dmgreductiondiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DARNYS, 2, 2)/100d; + dmgreductiondiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DARNYS, 3, 3)/100d; /*rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.ALIKAHN, 2, 2)/100d; rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.JAMDAK, 2, 2)/100d; rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DARNYS, 2, 2)/100d; @@ -1944,6 +2001,7 @@ public class CustomDamage { if ((p).getLocation().getY()>=0 && (p).getLocation().getY()<=255 && (p).getLocation().add(0,0,0).getBlock().getLightLevel()<=7) { darknessdiv += ItemSet.GetTotalBaseAmount(p, ItemSet.RUDOLPH)/100d; } + dmgreductiondiv += ItemSet.GetTotalBaseAmount(p, ItemSet.LUCI)/100d; } else { LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(target); if (!les.checkedforcubes) { @@ -2126,7 +2184,7 @@ public class CustomDamage { *(1d-((protectionlevel)/100d)) *(1d-((projectileprotectionlevel)/100d)) *(1d-((explosionprotectionlevel)/100d)) - *(1d-rangerdmgdiv) + *(1d-dmgreductiondiv) *(1d-magmacubediv) *(1d-darknessdiv) *(1d-((partylevel*10d)/100d)) @@ -2147,7 +2205,11 @@ public class CustomDamage { Player p = (Player)target; PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); pd.prev_armordef = finaldmg; + if (Buff.hasBuff(p, "BEASTWITHIN")) { + finaldmg = 0; + } } + return finaldmg; } @@ -2455,6 +2517,7 @@ public class CustomDamage { if (ItemSet.meetsLorasysSwordConditions(40, 4, (Player)shooter)) { dmg += 55; } + dmg += ItemSet.GetTotalBaseAmount((Player)shooter, ItemSet.WINDRY); } return dmg; @@ -2693,6 +2756,10 @@ public class CustomDamage { } } } + if (Buff.hasBuff(p, "WINDCHARGE") && + ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.WINDRY, 4)) { + critchance = addMultiplicativeValue(critchance,Buff.getBuff(p, "WINDCHARGE").getAmplifier()*0.01); + } } } return critchance; @@ -2866,6 +2933,10 @@ public class CustomDamage { finaldmg += dmg*0.5; } finaldmg += dmg*aPlugin.API.getPlayerBonuses(p).getBonusArmorPenetration(); + if (Buff.hasBuff(p, "WINDCHARGE") && + ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.WINDRY, 3)) { + finaldmg += dmg*(Buff.getBuff(p, "WINDCHARGE").getAmplifier()*0.01); + } } if (finaldmg>=dmg) { return dmg; diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java index 9bdd7be..fc34d05 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java @@ -90,6 +90,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.EliteMonsterLocationFinder; import sig.plugin.TwosideKeeper.HelperStructures.ItemSet; import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode; import sig.plugin.TwosideKeeper.HelperStructures.WorldShop; +import sig.plugin.TwosideKeeper.HelperStructures.Effects.WindSlash; import sig.plugin.TwosideKeeper.HelperStructures.Utils.ArrayUtils; import sig.plugin.TwosideKeeper.HelperStructures.Utils.ArtifactUtils; import sig.plugin.TwosideKeeper.HelperStructures.Utils.BlockUtils; @@ -3312,13 +3313,16 @@ public class GenericFunctions { } public static ItemStack UpdateItemLore(ItemStack item) { + //TwosideKeeper.log("Queue Update Item Lore for "+item, 0); if (RemoveInvalidItem(item)) { return item; } if (ItemSet.isSetItem(item)) { + //TwosideKeeper.log("Is Set Item Check", 0); //Update the lore. See if it's hardened. If it is, we will save just that piece. //Save the tier and type as well. ItemSet set = ItemSet.GetItemSet(item); + //TwosideKeeper.log("Set is "+set, 0); int tier = ItemSet.GetItemTier(item); item = UpdateSetLore(set,tier,item); } @@ -5158,4 +5162,39 @@ public class GenericFunctions { TileEntityHopper NMSHopper = (TileEntityHopper) BukkitHopper.getTileEntity(); NMSHopper.a(title); } + + public static void performWindSlash(Player p) { + //Consume wind charge stacks. + if (Buff.hasBuff(p, "WINDCHARGE")) { + PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); + if (pd.lastusedwindslash+GetModifiedCooldown(TwosideKeeper.WINDSLASH_COOLDOWN,p)<=TwosideKeeper.getServerTickTime()) { + int windcharges = Buff.getBuff(p, "WINDCHARGE").getAmplifier(); + Buff.removeBuff(p, "WINDCHARGE"); + TwosideKeeper.windslashes.add( + new WindSlash(p.getLocation(),p,ItemSet.GetItemTier(p.getEquipment().getItemInMainHand())*windcharges,20*10)); + p.setVelocity(p.getLocation().getDirection().multiply(-0.7f-(0.01f*(windcharges/10))*((p.isOnGround())?1d:2d))); + GenericFunctions.sendActionBarMessage(p, "", true); + aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GetModifiedCooldown(TwosideKeeper.WINDSLASH_COOLDOWN,p)); + pd.lastusedwindslash = TwosideKeeper.getServerTickTime(); + } + } //TILTED /////////////////\\\\\\\\\\\\\\\\\\\\\\\\\//////////////// + } + + public static void knockupEntities(double amt, LivingEntity...ents) { + for (LivingEntity l : ents) { + l.setVelocity(new Vector(l.getVelocity().getX(),amt,l.getVelocity().getZ())); + } + } + + public static void performBeastWithin(Player p) { + PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); + if (ItemSet.hasFullSet(p, ItemSet.LUCI) && pd.lastusedbeastwithin+GetModifiedCooldown(TwosideKeeper.BEASTWITHIN_COOLDOWN,p)<=TwosideKeeper.getServerTickTime()) { + GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.NIGHT_VISION, 20, 1, p); + SoundUtils.playGlobalSound(p.getLocation(), Sound.ENTITY_GENERIC_DRINK, 1.0f, 1.0f); + Buff.addBuff(p, "BEASTWITHIN", new Buff("Beast Within",(ItemSet.GetItemTier(p.getEquipment().getItemInMainHand())+ItemSet.BEASTWITHIN_DURATION)*20,1,org.bukkit.Color.MAROON,"♦",true)); + GenericFunctions.sendActionBarMessage(p, "", true); + aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GetModifiedCooldown(TwosideKeeper.BEASTWITHIN_COOLDOWN,p)); + pd.lastusedbeastwithin=TwosideKeeper.getServerTickTime(); + } + } } diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Effects/WindSlash.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Effects/WindSlash.java index be31445..0f79db2 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Effects/WindSlash.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Effects/WindSlash.java @@ -2,6 +2,7 @@ package sig.plugin.TwosideKeeper.HelperStructures.Effects; import org.bukkit.Location; import org.bukkit.Particle; +import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.util.Vector; @@ -9,6 +10,7 @@ import sig.plugin.TwosideKeeper.CustomDamage; import sig.plugin.TwosideKeeper.TwosideKeeper; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; import sig.plugin.TwosideKeeper.HelperStructures.Utils.BlockUtils; +import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils; public class WindSlash { Location loc; @@ -23,11 +25,12 @@ public class WindSlash { final static float SPEED_MULT = 3.5f; public WindSlash(Location loc, Player p, double dmg, int tick_duration) { - this.loc=loc.clone(); + this.loc=loc.clone().add(0,p.getEyeHeight(),0); this.sourcep=p; this.dmg=dmg; this.death_time = TwosideKeeper.getServerTickTime()+tick_duration; this.lasteffect=TwosideKeeper.getServerTickTime(); + SoundUtils.playGlobalSound(loc,Sound.BLOCK_PORTAL_TRIGGER, 0.2f, 2.0f); } public boolean runTick() { @@ -51,6 +54,7 @@ public class WindSlash { Vector move = origloc.getDirection().setY(origloc.getDirection().getY()/1.4).multiply(SPEED_MULT); float dist = SPEED_MULT; loc.add(move); + SoundUtils.playGlobalSound(loc, Sound.ENTITY_PLAYER_ATTACK_NODAMAGE, 0.4f, 1.0f); while (dist-->0) { if (!BlockUtils.isPassThrough(origloc.add(origloc.getDirection()))) { return false; diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java b/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java index c275707..94d0e32 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java @@ -45,7 +45,7 @@ public enum ItemSet { RUDOLPH(5,5, 10,10, 2,1, 0,0), OLIVE(3,2, 10,10, 2,1, 0,0), WINDRY(2,2, 1,1, 1,0, 1,0), - LUCI(2,2, 4,4, 2,2, 2,2), + LUCI(2,2, 4,4, 1,0, 1,0), SHARD(2,1, 10,10, 20,20, 10,10), TOXIN(2,2, 20,5, 10,3, 10,3), PROTECTOR(5,2, 10,5, 10,10, 1,1), @@ -60,6 +60,8 @@ public enum ItemSet { final static String ABILITY_LABEL = ChatColor.BOLD+""+ChatColor.GOLD; final static String ABILITY_LABEL_END = ""+ChatColor.RESET; + final public static int BEASTWITHIN_DURATION = 6; + public static ItemSet[] bauble_sets; int baseval; int increase_val; @@ -813,6 +815,8 @@ public enum ItemSet { lore.add(ChatColor.GRAY+" "); lore.add(ChatColor.GRAY+" Gain +"+(tier*5)+" wind charges for each killing blow dealt"); lore.add(ChatColor.GRAY+" with Wind Slash and gain "+(tier)+" Absorption Health."); + lore.add(ChatColor.GRAY+" "); + lore.add(ChatColor.GRAY+" (5 second cooldown)"); break; case ASSASSIN: lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Increases in power based on "+ChatColor.BOLD+"Total Tier Amount"); @@ -860,7 +864,7 @@ public enum ItemSet { lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" Adds "+ItemSet.GetBaseAmount(set, tier, 4)+"% Damage"); lore.add(ChatColor.DARK_AQUA+" "+ChatColor.GRAY+" for every 1% Damage Reduction"); lore.add(ChatColor.DARK_AQUA+" 5 - "+ABILITY_LABEL+" Beast Within"+ABILITY_LABEL_END); - lore.add(ChatColor.GRAY+" Press the drop key to obtain a buff lasting "+(tier+6)); + lore.add(ChatColor.GRAY+" Press the drop key to obtain a buff lasting "+(tier+BEASTWITHIN_DURATION)); lore.add(ChatColor.GRAY+" seconds, giving you 100% Dodge Chance and"); lore.add(ChatColor.GRAY+" Damage Reduction. Beast Within's Cooldown"); lore.add(ChatColor.GRAY+" decreases by 1 second for each successful"); @@ -1088,6 +1092,20 @@ public enum ItemSet { return ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.LORASYS, 1) && ItemSet.GetBaubleTier(p)>=baubletier && (swordtier==1 || ItemSet.GetItemTier(p.getEquipment().getItemInMainHand())>=swordtier); } + public static int getHighestTierInSet(Player p, ItemSet set) { + PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); + int highest = 0; + if (pd.itemsets.containsKey(set.name())) { + HashMap tiermap = pd.itemsets.get(set.name()); + for (Integer tier : tiermap.keySet()) { + if (tiermap.get(tier)>=highest) { + highest = tiermap.get(tier); + } + } + } + return highest; + } + /** * Purely for API support. DO NOT USE OTHERWISE!! */ diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/BlockUtils.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/BlockUtils.java index b97a859..b192996 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/BlockUtils.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/BlockUtils.java @@ -75,7 +75,8 @@ public class BlockUtils { l.getBlock().getType()==Material.STEP || l.getBlock().getType()==Material.WOOD_STEP || l.getBlock().getType()==Material.PURPUR_SLAB || - l.getBlock().getType()==Material.STONE_SLAB2; + l.getBlock().getType()==Material.STONE_SLAB2 || + l.getBlock().getType()==Material.WEB; } public static boolean isSign(Block b) { diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/EntityUtils.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/EntityUtils.java index 69cdb20..1361b77 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/EntityUtils.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/EntityUtils.java @@ -95,7 +95,11 @@ public class EntityUtils { aec.setRadius(0.1f); },delay); } - + + /** + Use Buff.addBuff() instead. + */ + @Deprecated public static void applyBuff(LivingEntity l, String buffname, Buff buff) { HashMap buffMap; if (l instanceof Player) { @@ -108,7 +112,11 @@ public class EntityUtils { buffMap.put(buffname, buff); updateBuffDisplay(l); } - + + /** + Use Buff.addBuff() instead. + */ + @Deprecated public static void applyBuffs(LivingEntity l, String[] buffnames, Buff ... buffArr) { HashMap buffMap; if (buffnames.length==buffArr.length) { @@ -128,7 +136,11 @@ public class EntityUtils { DebugUtils.showStackTrace(); } } - + + /** + Use Buff.removeBuff() instead. + */ + @Deprecated public static void removeBuff(LivingEntity l, String buffName) { HashMap buffMap; if (l instanceof Player) { @@ -141,7 +153,11 @@ public class EntityUtils { buffMap.remove(buffName); updateBuffDisplay(l); } - + + /** + Use Buff.removeBuff() instead. + */ + @Deprecated public static void removeBuffs(LivingEntity l, String ... buffNames) { HashMap buffMap; if (l instanceof Player) { diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/SoundUtils.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/SoundUtils.java index 7ca499d..5b4361d 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/SoundUtils.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/SoundUtils.java @@ -24,7 +24,9 @@ public class SoundUtils { */ public static void playIndividualGlobalSound(Location loc, Sound sound, float vol, float pitch) { for (Player p : Bukkit.getOnlinePlayers()) { - p.playSound(loc, sound, vol, pitch); + if (p.getLocation().distanceSquared(loc)<=2500) { + p.playSound(loc, sound, vol, pitch); + } } } /** diff --git a/src/sig/plugin/TwosideKeeper/PlayerStructure.java b/src/sig/plugin/TwosideKeeper/PlayerStructure.java index f0028dd..1448d91 100644 --- a/src/sig/plugin/TwosideKeeper/PlayerStructure.java +++ b/src/sig/plugin/TwosideKeeper/PlayerStructure.java @@ -149,6 +149,8 @@ public class PlayerStructure { public long icewandused = TwosideKeeper.getServerTickTime(); public PlayerMode playermode_on_death=PlayerMode.NORMAL; public long lastusedearthwave = TwosideKeeper.getServerTickTime(); + public long lastusedwindslash = TwosideKeeper.getServerTickTime(); + public long lastusedbeastwithin = TwosideKeeper.getServerTickTime(); public long iframetime = 0; @@ -257,7 +259,9 @@ public class PlayerStructure { this.last_rejuvenate=(TwosideKeeper.getServerType()==ServerType.MAIN)?TwosideKeeper.getServerTickTime():0; this.lastassassinatetime=(TwosideKeeper.getServerType()==ServerType.MAIN)?TwosideKeeper.getServerTickTime():0; this.lastlifesavertime=(TwosideKeeper.getServerType()==ServerType.MAIN)?TwosideKeeper.getServerTickTime():0; + this.lastusedwindslash=(TwosideKeeper.getServerType()==ServerType.MAIN)?TwosideKeeper.getServerTickTime():0; this.icewandused=(TwosideKeeper.getServerType()==ServerType.MAIN)?TwosideKeeper.getServerTickTime():0; + this.lastusedbeastwithin=(TwosideKeeper.getServerType()==ServerType.MAIN)?TwosideKeeper.getServerTickTime():0; this.damagedata = new DamageLogger(p); this.damagelogging=false; this.isPlayingSpleef=false; @@ -327,6 +331,8 @@ public class PlayerStructure { aPlugin.API.sendCooldownPacket(p, Material.WATCH, GenericFunctions.GetRemainingCooldownTime(p, pd.icewandused, TwosideKeeper.ICEWAND_COOLDOWN)); aPlugin.API.sendCooldownPacket(p, Material.RAW_FISH, GenericFunctions.GetRemainingCooldownTime(p, pd.lastcandyconsumed, 40)); aPlugin.API.sendCooldownPacket(p, Material.GOLDEN_APPLE, GenericFunctions.GetRemainingCooldownTime(p, pd.lastrevivecandyconsumed, 200)); + applyCooldownToAllTypes(p,"SWORD",GenericFunctions.GetRemainingCooldownTime(p, pd.lastusedwindslash, TwosideKeeper.WINDSLASH_COOLDOWN)); + applyCooldownToAllTypes(p,"SWORD",GenericFunctions.GetRemainingCooldownTime(p, pd.lastusedbeastwithin, TwosideKeeper.BEASTWITHIN_COOLDOWN)); } private static void applyCooldownToAllTypes(Player p, String item, int cooldown) { @@ -407,6 +413,8 @@ public class PlayerStructure { workable.set("COOLDOWN_lastmock", last_mock); workable.set("COOLDOWN_lastassassinatetime", lastassassinatetime); workable.set("COOLDOWN_lastlifesavertime", lastlifesavertime); + workable.set("COOLDOWN_lastusedwindslash", lastusedwindslash); + workable.set("COOLDOWN_lastusedbeastwithin", lastusedbeastwithin); int buffcounter=0; for (String key : buffs.keySet()) { Buff b = buffs.get(key); @@ -500,6 +508,8 @@ public class PlayerStructure { workable.addDefault("COOLDOWN_lastmock", last_mock); workable.addDefault("COOLDOWN_lastassassinatetime", lastassassinatetime); workable.addDefault("COOLDOWN_lastlifesavertime", lastlifesavertime); + workable.addDefault("COOLDOWN_lastusedwindslash", lastusedwindslash); + workable.addDefault("COOLDOWN_lastusedbeastwithin", lastusedbeastwithin); workable.addDefault("BUFFCOUNT", 0); workable.options().copyDefaults(); @@ -556,6 +566,8 @@ public class PlayerStructure { this.last_mock = workable.getLong("COOLDOWN_lastmock"); this.lastassassinatetime = workable.getLong("COOLDOWN_lastassassinatetime"); this.lastlifesavertime = workable.getLong("COOLDOWN_lastlifesavertime"); + this.lastusedwindslash = workable.getLong("COOLDOWN_lastusedwindslash"); + this.lastusedbeastwithin = workable.getLong("COOLDOWN_lastusedbeastwithin"); this.vacuumsuckup = workable.getBoolean("vacuumsuckup"); this.equipweapons = workable.getBoolean("equipweapons"); this.equiparmor = workable.getBoolean("equiparmor"); diff --git a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java index 4fdfbf1..819642a 100644 --- a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java +++ b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java @@ -450,6 +450,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener { public static final int SIPHON_COOLDOWN = 700; public static final int MOCK_COOLDOWN = 400; public static final int ICEWAND_COOLDOWN = 1200; + public static final int WINDSLASH_COOLDOWN = 100; + public static final int BEASTWITHIN_COOLDOWN = 2400; public static int damagequeue = 0; public static List damagequeuelist = new ArrayList(); @@ -1886,6 +1888,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener { //new TemporaryBlock(p.getLocation().getBlock(),Material.STAINED_GLASS,(byte)6,200,"TEST"); //TwosideKeeper.log(TextUtils.outputHashmap(TwosideKeeper.temporaryblocks), 0); }break; + case "RENAME":{ + ItemMeta meta = p.getEquipment().getItemInMainHand().getItemMeta(); + meta.setDisplayName(args[1]); + p.getEquipment().getItemInMainHand().setItemMeta(meta); + }break; } } @@ -4975,6 +4982,25 @@ public class TwosideKeeper extends JavaPlugin implements Listener { return; } + if (ev.getItemDrop().getItemStack().getType().toString().contains("SWORD") && + !GenericFunctions.isViewingInventory(ev.getPlayer())) { + if (ItemSet.hasFullSet(ev.getPlayer(),ItemSet.WINDRY)) { + ev.setCancelled(true); + ev.getPlayer().getEquipment().setItemInMainHand(ev.getItemDrop().getItemStack()); + GenericFunctions.performWindSlash(ev.getPlayer()); + ev.getPlayer().getEquipment().setItemInMainHand(new ItemStack(Material.AIR)); + return; + } else + if (ItemSet.hasFullSet(ev.getPlayer(),ItemSet.LUCI)) { + ev.setCancelled(true); + ev.getPlayer().getEquipment().setItemInMainHand(ev.getItemDrop().getItemStack()); + //GenericFunctions.performWindSlash(ev.getPlayer()); + GenericFunctions.performBeastWithin(ev.getPlayer()); + ev.getPlayer().getEquipment().setItemInMainHand(new ItemStack(Material.AIR)); + return; + } + } + if (GenericFunctions.holdingNoShield(ev.getPlayer()) && ev.getItemDrop().getItemStack().getType().toString().contains("SWORD") && !GenericFunctions.isViewingInventory(ev.getPlayer())) {