diff --git a/TwosideKeeper.jar b/TwosideKeeper.jar index 38372f9..d1913e0 100644 Binary files a/TwosideKeeper.jar and b/TwosideKeeper.jar differ diff --git a/src/plugin.yml b/src/plugin.yml index cc13c9b..e615723 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: TwosideKeeper main: sig.plugin.TwosideKeeper.TwosideKeeper -version: 3.8.5dBUGSPLEASEGOAWAYWTFWHYAREYOUSTILLHEREOMGIHATETHISPLSFIXNOCOPYPASTERINO +version: 3.8.5e commands: money: description: Tells the player the amount of money they are holding. diff --git a/src/sig/plugin/TwosideKeeper/CustomDamage.java b/src/sig/plugin/TwosideKeeper/CustomDamage.java index 13aabcb..2d46963 100644 --- a/src/sig/plugin/TwosideKeeper/CustomDamage.java +++ b/src/sig/plugin/TwosideKeeper/CustomDamage.java @@ -347,6 +347,12 @@ public class CustomDamage { reduceSwiftAegisBuff(p); if (damage=9) { + p.playSound(p.getLocation(), Sound.BLOCK_ANVIL_LAND, 1.0f, 3.6f); return false; } } @@ -1965,4 +1978,20 @@ public class CustomDamage { public static double calculateCooldownReduction(Player p) { return 0.0; } + + //REturns 0-100. + public static double CalculateDebuffResistance(Player p) { + TwosideKeeper.log("Debuffcount went up...",5); + double removechance = 0.0; + ItemStack[] equips = p.getEquipment().getArmorContents(); + for (ItemStack equip : equips) { + if (GenericFunctions.isArtifactEquip(equip)) { + double resistamt = GenericFunctions.getAbilityValue(ArtifactAbility.STATUS_EFFECT_RESISTANCE, equip); + TwosideKeeper.log("Resist amount is "+resistamt,5); + removechance+=resistamt; + } + } + removechance+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DAWNTRACKER, 2, 2); + return removechance; + } } diff --git a/src/sig/plugin/TwosideKeeper/EliteMonster.java b/src/sig/plugin/TwosideKeeper/EliteMonster.java index b63290e..d3f008a 100644 --- a/src/sig/plugin/TwosideKeeper/EliteMonster.java +++ b/src/sig/plugin/TwosideKeeper/EliteMonster.java @@ -106,11 +106,11 @@ public class EliteMonster { regenerateHealth(); moveFasterToTarget(); resetToSpawn(); - createBossHealthbar(); + //createBossHealthbar(); ignoreAllOtherTargets(); if (m.isValid() && targetlist.size()>0) { adjustWillpower(); - //weakenTeam(); + weakenTeam(); retargetInAir(); destroyLiquids(2); reapplyGlow(); @@ -274,6 +274,8 @@ public class EliteMonster { willpower=0; bar.removeAll(); willpower_bar.removeAll(); + } else { + createBossHealthbar(); } if (!m.getLocation().getWorld().equals(myspawn.getWorld())) { myspawn = m.getLocation(); //Then this is my new spawn... @@ -752,4 +754,9 @@ public class EliteMonster { } return finalstr.toString(); } + + public void Cleanup() { + // Remove all healthbars before destroying. + removeAllHealthbars(); + } } diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java b/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java index a49cbb2..115db57 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java @@ -28,10 +28,10 @@ public enum ArtifactAbility { //Weapon Abilities DAMAGE("Strike","Improves Base Damage by [VAL]",new double[]{1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,5.5,6.0,6.5,7.0,8.0,9.0,10.0}, new double[]{1.0,0.975,0.95,0.925,0.9,0.875,0.85,0.8,0.75,0.7,0.65,0.6,0.55,0.5,0.4},100,1,UpgradePath.BASIC), - ARMOR_PEN("Piercing","[VAL]% of your damage is ignored by resistances. ([PENDMG] damage)",new double[]{1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,5.5,6.0,6.5,7.0,8.0,9.0,10.0}, + ARMOR_PEN("Piercing","[VAL]% of your damage is ignored by resistances. ([PENDMG] damage)",new double[]{0.4,0.8,1.2,1.6,2.0,2.4,2.8,3.2,3.6,4.0,4.4,4.8,5.2,5.7,6.4,7.5}, + new double[]{1.0,0.975,0.95,0.925,0.9,0.875,0.85,0.8,0.75,0.7,0.65,0.6,0.55,0.5,0.4},100,1,UpgradePath.BASIC), + EXECUTION("Execute","Deals [VAL] extra damage for every 20% of target's missing health.",new double[]{0.3,0.45,0.6,0.75,0.9,1.05,1.2,1.35,1.50,1.65,1.80,1.95,2.10,2.40,2.70}, new double[]{1.0,0.975,0.95,0.925,0.9,0.875,0.85,0.8,0.75,0.7,0.65,0.6,0.55,0.5,0.4},100,1,UpgradePath.BASIC), - EXECUTION("Execute","Deals [VAL] extra damage for every 20% of target's missing health.",new double[]{0.1,0.125,0.15,0.175,0.2,0.225,0.25,0.275,0.3,0.35,0.4,0.5,0.7,0.9,1.25}, - new double[]{1.0,0.975,0.95,0.925,0.9,0.875,0.85,0.825,0.8,0.75,0.7,0.65,0.6,0.55,0.5},100,1,UpgradePath.BASIC), LIFESTEAL("Lifesteal","Heals [VAL]% of the damage dealt to targets back to your health pool.",new double[]{0.8,1.2,1.6,2.0,2.4,2.8,3.2,3.6,4.0,4.4,4.8,5.6,6.4,7.2,8.0,8.8}, new double[]{1.0,1.0,0.9,0.9,0.8,0.8,0.75,0.75,0.7,0.7,0.6,0.6,0.5,0.5,0.4},100,1,UpgradePath.WEAPON), CRITICAL("Critical","[VAL]% chance to deal critical strikes.",new double[]{1.0,1.25,1.5,1.75,2.0,2.25,2.50,2.75,3.0,3.25,3.50,3.75,4.00,4.25,4.50}, diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactItemType.java b/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactItemType.java index 46c3e95..b71311e 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactItemType.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactItemType.java @@ -536,7 +536,8 @@ public enum ArtifactItemType { ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 2); } }break; - case 3:{ + case 3: + case 4:{ if (upgrade==UpgradePath.WEAPON || upgrade==UpgradePath.SWORD || upgrade==UpgradePath.AXE || @@ -568,7 +569,8 @@ public enum ArtifactItemType { ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 3); } }break; - case 4:{ + case 5: + case 6:{ if (upgrade==UpgradePath.WEAPON || upgrade==UpgradePath.SWORD || upgrade==UpgradePath.AXE || @@ -600,7 +602,8 @@ public enum ArtifactItemType { ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 4); } }break; - case 5:{ + case 7: + case 8:{ if (upgrade==UpgradePath.WEAPON || upgrade==UpgradePath.SWORD || upgrade==UpgradePath.AXE || @@ -633,7 +636,8 @@ public enum ArtifactItemType { ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 5); } }break; - case 6:{ + case 9: + case 10:{ if (upgrade==UpgradePath.WEAPON || upgrade==UpgradePath.SWORD || upgrade==UpgradePath.AXE || @@ -667,7 +671,7 @@ public enum ArtifactItemType { ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 6); } }break; - case 7:{ + case 11:{ if (upgrade==UpgradePath.WEAPON || upgrade==UpgradePath.SWORD || upgrade==UpgradePath.AXE || @@ -704,7 +708,8 @@ public enum ArtifactItemType { ouritem.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 1); } }break; - case 8:{ + case 12: + case 13:{ if (upgrade==UpgradePath.WEAPON || upgrade==UpgradePath.SWORD || upgrade==UpgradePath.AXE || @@ -741,7 +746,7 @@ public enum ArtifactItemType { ouritem.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 1); } }break; - case 9:{ + case 14:{ if (upgrade==UpgradePath.WEAPON || upgrade==UpgradePath.SWORD || upgrade==UpgradePath.AXE || @@ -814,7 +819,7 @@ public enum ArtifactItemType { ouritem.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 10); ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 10); ouritem.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 2); - ouritem.addUnsafeEnchantment(Enchantment.ARROW_INFINITE, 1); + ouritem.addUnsafeEnchantment(Enchantment.ARROW_INFINITE, 10); } } } diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java index d44e87a..75212a7 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java @@ -1,5 +1,6 @@ package sig.plugin.TwosideKeeper.HelperStructures.Common; +import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -2737,7 +2738,11 @@ public class GenericFunctions { TwosideKeeper.log(ChatColor.RED+" This should not be overwritten due to no FORCE!", TwosideKeeper.POTION_DEBUG_LEVEL); } } - p.addPotionEffect(new PotionEffect(type,ticks,amplifier),force); + Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() { + public void run() { + p.addPotionEffect(new PotionEffect(type,ticks,amplifier),force); + } + },1); TwosideKeeper.log(ChatColor.GRAY+" Effect on Player "+p.getName()+" is now "+type.getName()+" "+WorldShop.toRomanNumeral((amplifier+1))+"("+amplifier+"), Duration: "+ticks+" ticks", TwosideKeeper.POTION_DEBUG_LEVEL); if (amplifier==-1 || ticks==0) { //Something really bad happened!!! @@ -2752,8 +2757,9 @@ public class GenericFunctions { } public static void logAndRemovePotionEffectFromPlayer(PotionEffectType type, Player p) { - TwosideKeeper.log(ChatColor.WHITE+"Removing Potion Effect "+type+" "+WorldShop.toRomanNumeral((getPotionEffectLevel(type,p)+1))+"("+getPotionEffectLevel(type,p)+") on Player "+p.getName()+" Duration: "+getPotionEffectDuration(type,p)+" ticks", TwosideKeeper.POTION_DEBUG_LEVEL); - p.removePotionEffect(type); + TwosideKeeper.log(ChatColor.WHITE+"Removing Potion Effect "+type+" "+WorldShop.toRomanNumeral((getPotionEffectLevel(type,p)+1))+"("+getPotionEffectLevel(type,p)+") on Player "+p.getName()+" Duration: "+getPotionEffectDuration(type,p)+" ticks by adding a 0 duration version of this effect.", TwosideKeeper.POTION_DEBUG_LEVEL); + //p.removePotionEffect(type); + logAndApplyPotionEffectToPlayer(type,0,0,p,true); if (p.hasPotionEffect(type)) { TwosideKeeper.log(ChatColor.DARK_RED+" Effect on Player "+p.getName()+" is now "+type+" "+WorldShop.toRomanNumeral((getPotionEffectLevel(type,p)+1))+"("+getPotionEffectLevel(type,p)+"), Duration: "+getPotionEffectDuration(type,p)+" ticks", TwosideKeeper.POTION_DEBUG_LEVEL); TwosideKeeper.log(ChatColor.RED+"THIS SHOULD NOT BE HAPPENING! Reporting", TwosideKeeper.POTION_DEBUG_LEVEL); @@ -2894,6 +2900,12 @@ public class GenericFunctions { Monster m = (Monster)entity; MonsterStructure md = MonsterStructure.getMonsterStructure(m); if (damager!=null) { + if (damager instanceof Player) { + Player p = (Player)damager; + if (GenericFunctions.getPotionEffectLevel(PotionEffectType.WEAKNESS, p)>=9) { + p.removePotionEffect(PotionEffectType.WEAKNESS); + } + } md.hitlist.remove(damager.getUniqueId()); } else { md.hitlist.remove(m.getUniqueId()); @@ -3491,8 +3503,8 @@ public class GenericFunctions { b.getType()==Material.CLAY || b.getType()==Material.GRASS || b.getType()==Material.STONE || - b.getType()==Material.WATER || - b.getType()==Material.LAVA || + /*b.getType()==Material.WATER || + b.getType()==Material.LAVA ||*/ b.getType()==Material.NETHERRACK || b.getType()==Material.ENDER_STONE || b.getType()==Material.COBBLESTONE || @@ -3501,8 +3513,8 @@ public class GenericFunctions { b.getType()==Material.LOG_2 || b.getType()==Material.LEAVES || b.getType()==Material.LEAVES_2 || - b.getType()==Material.STATIONARY_LAVA || - b.getType()==Material.STATIONARY_WATER || + /*b.getType()==Material.STATIONARY_LAVA || + b.getType()==Material.STATIONARY_WATER ||*/ b.getType()==Material.SNOW || b.getType()==Material.ICE || b.getType()==Material.PACKED_ICE) { @@ -3724,4 +3736,29 @@ public class GenericFunctions { } return hasArmor; } + + public static void RemoveNewDebuffs(Player p) { + PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); + double removechance = CustomDamage.CalculateDebuffResistance(p); + if (removechance>0) { + if (!pd.lasteffectlist.containsAll(p.getActivePotionEffects())) { + int level=0; + PotionEffectType type=null; + for (PotionEffect pe : p.getActivePotionEffects()) { + if (GenericFunctions.isBadEffect(pe.getType())) { + type=pe.getType(); + level=pe.getAmplifier(); + } + } + if (Math.random()<=removechance/100) { + if (type!=null && (!type.equals(PotionEffectType.WEAKNESS) || level<9)) { + GenericFunctions.logAndRemovePotionEffectFromPlayer(type,p); + p.sendMessage(ChatColor.DARK_GRAY+"You successfully resisted the application of "+ChatColor.WHITE+GenericFunctions.CapitalizeFirstLetters(type.getName().replace("_", " "))); + } + } + } + pd.lasteffectlist.clear(); + pd.lasteffectlist.addAll(p.getActivePotionEffects()); + } + } } diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java b/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java index d0a0994..d241ffd 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java @@ -15,7 +15,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; public enum ItemSet { PANROS(1,1, 3,2, 10,10, 20,10), - SONGSTEEL(4,2, 6,2, 8,4, 20,10), + SONGSTEEL(4,2, 6,2, 8,8, 20,10), DAWNTRACKER(4,4, 20,10, 20,10, 6,4), LORASYS(2,2, 0,0, 0,0, 0,0), JAMDAK(1,1, 5,1, 10,1, 10,2), //Graceful Dodge is in ticks. @@ -285,7 +285,7 @@ public enum ItemSet { case SONGSTEEL:{ lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+" Max Health"); - lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+" Absorption (30 seconds)"); + lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+" Absorption Health (30 seconds)"); lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4)+"% Damage Reduction"); lore.add(ChatColor.DARK_AQUA+" 5 - "+ChatColor.WHITE+" Vendetta"); lore.add(ChatColor.GRAY+" Blocking stores 30% of mitigation damage."); diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java index b3f87b2..418d980 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java @@ -567,10 +567,10 @@ public class Loot { return (int)((Math.random()*4)+3); } else if (type.toString().contains("DIAMOND")) { - return (int)((Math.random()*5)+4); + return (int)((Math.random()*6)+5); } else if (type.toString().contains("GOLD")) { - return (int)((Math.random()*6)+5); + return (int)((Math.random()*12)+3); } else if (type.toString().contains("LEATHER")) { return (int)((Math.random()*7)+6); @@ -598,7 +598,7 @@ public class Loot { enchantment_level = (int)(((Math.random()*5)+6)*((hardened)?HARDENED_ENCHANT_MULT:1)); } else { - enchantment_level = (int)(((Math.random()*6)+3)*((hardened)?HARDENED_ENCHANT_MULT:1)); + enchantment_level = (int)(((Math.random()*7)+2)*((hardened)?HARDENED_ENCHANT_MULT:1)); } if (enchantment_level>MAX_ENCHANT_LEVEL) { @@ -610,10 +610,10 @@ public class Loot { public static ItemStack addEnchantments(ItemStack item, boolean hardened) { if (GenericFunctions.isHarvestingTool(item)) { - item.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, GetEnchantmentLevels(item.getType(),hardened)); + if (Math.random()<0.5*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, GetEnchantmentLevels(item.getType(),hardened));} item.addUnsafeEnchantment(Enchantment.DIG_SPEED, GetEnchantmentLevels(item.getType(),hardened)); item.addUnsafeEnchantment(Enchantment.DURABILITY, GetEnchantmentLevels(item.getType(),hardened)); - item.addUnsafeEnchantment(Enchantment.KNOCKBACK, 2); + if (Math.random()<0.5*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.KNOCKBACK, 2);} if (item.getType().toString().contains("HOE")) {item.addUnsafeEnchantment(Enchantment.KNOCKBACK, 10);} if (Math.random()<0.2*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.SILK_TOUCH, GetEnchantmentLevels(item.getType(),hardened));} if (Math.random()<0.001*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.MENDING, GetEnchantmentLevels(item.getType(),hardened));} @@ -622,18 +622,18 @@ public class Loot { if (item.getType()==Material.BOW) { item.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, GetEnchantmentLevels(item.getType(),hardened)); item.addUnsafeEnchantment(Enchantment.ARROW_FIRE, GetEnchantmentLevels(item.getType(),hardened)); - item.addUnsafeEnchantment(Enchantment.DURABILITY, GetEnchantmentLevels(item.getType(),hardened)); + if (Math.random()<0.5*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.DURABILITY, GetEnchantmentLevels(item.getType(),hardened));} item.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 2); if (Math.random()<0.2*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.ARROW_INFINITE, GetEnchantmentLevels(item.getType(),hardened));} if (Math.random()<0.001*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.MENDING, GetEnchantmentLevels(item.getType(),hardened));} } else if (GenericFunctions.isWeapon(item)) { item.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, GetEnchantmentLevels(item.getType(),hardened)); - item.addUnsafeEnchantment(Enchantment.DAMAGE_ARTHROPODS, GetEnchantmentLevels(item.getType(),hardened)); - item.addUnsafeEnchantment(Enchantment.DAMAGE_UNDEAD, GetEnchantmentLevels(item.getType(),hardened)); - item.addUnsafeEnchantment(Enchantment.DURABILITY, GetEnchantmentLevels(item.getType(),hardened)); - item.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, GetEnchantmentLevels(item.getType(),hardened)); - item.addUnsafeEnchantment(Enchantment.KNOCKBACK, 1); + if (Math.random()<0.5*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.DAMAGE_ARTHROPODS, GetEnchantmentLevels(item.getType(),hardened));} + if (Math.random()<0.5*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.DAMAGE_UNDEAD, GetEnchantmentLevels(item.getType(),hardened));} + if (Math.random()<0.5*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.DURABILITY, GetEnchantmentLevels(item.getType(),hardened));} + if (Math.random()<0.5*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, GetEnchantmentLevels(item.getType(),hardened));} + if (Math.random()<0.5*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.KNOCKBACK, 1);} if (Math.random()<0.001*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.MENDING, GetEnchantmentLevels(item.getType(),hardened));} if (Math.random()<0.001*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, GetEnchantmentLevels(item.getType(),hardened));} } else @@ -663,6 +663,7 @@ public class Loot { if (Math.random()<0.2*HARDENED_ENCHANT_MULT && item.getType().toString().contains("BOOTS")) {item.addUnsafeEnchantment(Enchantment.FROST_WALKER, GetEnchantmentLevels(item.getType(),hardened));} if (Math.random()<0.08*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.THORNS, GetEnchantmentLevels(item.getType(),hardened));} //item.addUnsafeEnchantment(Enchantment.KNOCKBACK, 1); + if (Math.random()<0.001*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.DURABILITY, GetEnchantmentLevels(item.getType(),hardened));} if (Math.random()<0.001*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.MENDING, GetEnchantmentLevels(item.getType(),hardened));} } else { //Generic Random Enchantments. diff --git a/src/sig/plugin/TwosideKeeper/MonsterController.java b/src/sig/plugin/TwosideKeeper/MonsterController.java index 6913644..26e4c36 100644 --- a/src/sig/plugin/TwosideKeeper/MonsterController.java +++ b/src/sig/plugin/TwosideKeeper/MonsterController.java @@ -147,7 +147,7 @@ public class MonsterController { TwosideKeeper.log("Trying for an elite monster.", 4); if (GenericFunctions.PercentBlocksAroundArea(ent.getLocation().getBlock(),Material.AIR,16,8,16)>=75 && GenericFunctions.AllNaturalBlocks(ent.getLocation().getBlock(),16,8,16) && - ent.getNearbyEntities(128, 32, 128).size()<=2) { + ent.getNearbyEntities(64, 32, 64).size()<=3) { TwosideKeeper.LAST_ELITE_SPAWN=TwosideKeeper.getServerTickTime(); return true; } diff --git a/src/sig/plugin/TwosideKeeper/PlayerStructure.java b/src/sig/plugin/TwosideKeeper/PlayerStructure.java index 5edb939..7ee07be 100644 --- a/src/sig/plugin/TwosideKeeper/PlayerStructure.java +++ b/src/sig/plugin/TwosideKeeper/PlayerStructure.java @@ -17,6 +17,7 @@ import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; +import org.bukkit.potion.PotionEffect; import sig.plugin.TwosideKeeper.HelperStructures.DeathStructure; import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode; @@ -99,6 +100,7 @@ public class PlayerStructure { public long lastsprintcheck=0; public int swiftaegisamt=0; public PlayerMode lastmode=PlayerMode.NORMAL; + public List lasteffectlist=null; public long iframetime = 0; @@ -148,6 +150,8 @@ public class PlayerStructure { this.title_task=-1; this.sounds_enabled=true; this.debuffcount=0; + this.lasteffectlist = new ArrayList(); + this.lasteffectlist.addAll(p.getActivePotionEffects()); this.last_deathmark=(TwosideKeeper.getServerType()==ServerType.MAIN)?TwosideKeeper.getServerTickTime():0; this.last_shovelspell=(TwosideKeeper.getServerType()==ServerType.MAIN)?TwosideKeeper.getServerTickTime()+300:0; this.swordcombo=0; diff --git a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java index e5cfdb9..da19e69 100644 --- a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java +++ b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java @@ -116,6 +116,7 @@ import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.event.player.PlayerTeleportEvent; +import org.bukkit.event.player.PlayerToggleSneakEvent; import org.bukkit.event.player.PlayerToggleSprintEvent; import org.bukkit.event.server.ServerCommandEvent; import org.bukkit.event.server.ServerListPingEvent; @@ -393,36 +394,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { for (Player p : Bukkit.getOnlinePlayers()) { if (!p.isDead()) { PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId()); - log(pd.velocity+"",5); - if (GenericFunctions.CountDebuffs(p)>pd.debuffcount) { - ItemStack[] equips = p.getEquipment().getArmorContents(); - double removechance = 0.0; - log("Debuffcount went up...",5); - for (ItemStack equip : equips) { - if (GenericFunctions.isArtifactEquip(equip)) { - double resistamt = GenericFunctions.getAbilityValue(ArtifactAbility.STATUS_EFFECT_RESISTANCE, equip); - log("Resist amount is "+resistamt,5); - removechance+=resistamt; - } - } - removechance+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DAWNTRACKER, 2, 2); - log("Remove chance is "+removechance,5); - int level=0; - PotionEffectType type=null; - for (PotionEffect pe : p.getActivePotionEffects()) { - if (GenericFunctions.isBadEffect(pe.getType()) && Math.random()<=0.5) { - type=pe.getType(); - level=pe.getAmplifier(); - } - } - if (Math.random()<=removechance/100) { - if (type!=null && (!type.equals(PotionEffectType.WEAKNESS) || level<9)) { - GenericFunctions.logAndRemovePotionEffectFromPlayer(type,p); - p.sendMessage(ChatColor.DARK_GRAY+"You successfully resisted the application of "+ChatColor.WHITE+GenericFunctions.CapitalizeFirstLetters(type.getName().replace("_", " "))); - } - } - } - pd.debuffcount=GenericFunctions.CountDebuffs(p); + GenericFunctions.RemoveNewDebuffs(p); if (p.isSprinting() && pd.lastsprintcheck+(20*5)0) { if (p.hasPotionEffect(PotionEffectType.ABSORPTION)) { - int oldlv = GenericFunctions.getPotionEffectLevel(PotionEffectType.ABSORPTION, p)+1; + int oldlv = GenericFunctions.getPotionEffectLevel(PotionEffectType.ABSORPTION, p); GenericFunctions.logAndRemovePotionEffectFromPlayer(PotionEffectType.ABSORPTION,p); GenericFunctions.logAndApplyPotionEffectToPlayer(PotionEffectType.ABSORPTION,599,(int)(absorption_amt/4)+oldlv,p); } else { @@ -848,7 +820,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { public static ShapedRecipe INCREASE_ARTIFACT_CRAFTING_TIER_RECIPE; public static ShapedRecipe DECREASE_ARTIFACT_CRAFTING_TIER_RECIPE; public static ShapedRecipe EMPOWER_ARTIFACT_CRAFTING_ITEM_RECIPE; - public static ShapedRecipe MONEY_CHECK_RECIPE; + public static ShapedRecipe MONEY_CHECK_RECIPE; public static ShapedRecipe HANDMADE_ARROW_RECIPE; public static ShapedRecipe DIAMONDTIPPED_ARROW_RECIPE; public static ShapedRecipe POISON_ARROW_RECIPE; @@ -858,7 +830,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { public static CustomPotion LIFE_VIAL; public static CustomPotion HARDENING_VIAL; - public static final int POTION_DEBUG_LEVEL=1; + public static final int POTION_DEBUG_LEVEL=5; public static final int DODGE_COOLDOWN=100; public static final int DEATHMARK_COOLDOWN=240; @@ -2076,6 +2048,21 @@ public class TwosideKeeper extends JavaPlugin implements Listener { ///if (ev.getHand()==EquipmentSlot.OFF_HAND) {aPlugin.API.swingOffHand(ev.getPlayer());}; } + + @EventHandler(priority=EventPriority.LOW,ignoreCancelled=true) + public void onPlayerSneak(PlayerToggleSneakEvent ev) { + Player p = ev.getPlayer(); + if (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER) { + if (ev.isSneaking()) { + GenericFunctions.logAndApplyPotionEffectToPlayer(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 111, p, true); + GenericFunctions.logAndApplyPotionEffectToPlayer(PotionEffectType.BLINDNESS, 20*4, 111, p); + p.playSound(p.getLocation(), Sound.ENTITY_GENERIC_EXTINGUISH_FIRE, 1.0f, 0.8f); + } else { + GenericFunctions.logAndRemovePotionEffectFromPlayer(PotionEffectType.INVISIBILITY, p); + } + } + } + @EventHandler(priority=EventPriority.LOW) public void onPlayerInteract(PlayerInteractEvent ev) { if (ev.isCancelled() && ev.getAction() == Action.RIGHT_CLICK_BLOCK) { @@ -2151,7 +2138,15 @@ public class TwosideKeeper extends JavaPlugin implements Listener { player.sendMessage(ChatColor.ITALIC+" Good luck on your adventure!"); } },45); - if (Math.random()<=0.2) { + boolean pointToExistingElite=false; + for (int i=0;i0) {receiver.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Dodge Chance: "+ChatColor.RESET+""+ChatColor.DARK_AQUA+df.format(dodgechance)+"%");} } + double debuffresistchance = CustomDamage.CalculateDebuffResistance(p); + if (all || debuffresistchance>0) {receiver.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Debuff Resistance: "+ChatColor.RESET+""+ChatColor.DARK_AQUA+df.format(debuffresistchance)+"%");} TextComponent f = new TextComponent(ChatColor.GRAY+""+ChatColor.ITALIC+"Current Mode: "); f.addExtra(GenericFunctions.PlayerModeName(p)); if (receiver instanceof Player) {