diff --git a/TwosideKeeper.jar b/TwosideKeeper.jar index 6cab269..9c364d9 100644 Binary files a/TwosideKeeper.jar and b/TwosideKeeper.jar differ diff --git a/src/sig/plugin/TwosideKeeper/CustomDamage.java b/src/sig/plugin/TwosideKeeper/CustomDamage.java index 6ae944a..f2b7507 100644 --- a/src/sig/plugin/TwosideKeeper/CustomDamage.java +++ b/src/sig/plugin/TwosideKeeper/CustomDamage.java @@ -68,6 +68,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.MonsterDifficulty; import sig.plugin.TwosideKeeper.HelperStructures.MonsterType; import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode; import sig.plugin.TwosideKeeper.HelperStructures.WorldShop; +import sig.plugin.TwosideKeeper.HelperStructures.Common.BaublePouch; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; import sig.plugin.TwosideKeeper.HelperStructures.Effects.TemporaryBlockNode; import sig.plugin.TwosideKeeper.HelperStructures.Utils.ArtifactUtils; @@ -284,6 +285,7 @@ public class CustomDamage { dmg += addMultiplierToPlayerLogger(damager,target,"Damage Reduction Set Bonus Mult",dmg * calculateDamageReductionSetBonusMultiplier(shooter)); dmg += addMultiplierToPlayerLogger(damager,target,"Weapon Charge Bonus Mult",dmg * calculateWeaponChargeBonusMultiplier(shooter)); dmg += addMultiplierToPlayerLogger(damager,target,"Damage Pool Bonus Mult",dmg * calculateDamagePoolBonusMultiplier(shooter)); + dmg += addMultiplierToPlayerLogger(damager,target,"Stealth Mult",dmg * calculateStealthMultiplier(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; @@ -319,6 +321,18 @@ public class CustomDamage { return dmg; } + private static double calculateStealthMultiplier(LivingEntity shooter) { + double mult = 0.0; + if (shooter instanceof Player) { + Player p = (Player)shooter; + if (GenericFunctions.hasStealth(p) && + ItemSet.meetsSlayerSwordConditions(ItemSet.STEALTH, 18, 2, p)) { + mult += 0.5; + } + } + return mult; + } + private static double calculateDamagePoolBonusMultiplier(LivingEntity shooter) { double mult = 0.0; if (shooter instanceof Player) { @@ -601,6 +615,7 @@ public class CustomDamage { reduceSwiftAegisBuff(p); restoreHealthToPartyMembersWithProtectorSet(p); applySustenanceSetonHitEffects(p); + reduceStrengthAmountForStealthSet(p); if (!isFlagSet(flags,NOAOE)) { if (damage ds = new ArrayList(); public static void addNewDeathStructure(List deathinv, Location deathloc, Player p) { - ds.add(new DeathStructure(deathinv,deathloc,p)); - TwosideKeeper.log("Added a new Death Structure: "+ds.get(ds.size()-1).toString(),5); + ds.add(new DeathStructure(deathinv,deathloc.clone(),p)); + TwosideKeeper.log("Added a new Death Structure: "+ds.get(ds.size()-1).toString(),0); } public static void removeDeathStructure(Player p) { ds.remove(getDeathStructure(p)); diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java index 4afb15b..b55fcdf 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java @@ -4382,9 +4382,13 @@ public class GenericFunctions { int duration = getPotionEffectDuration(type,p); int currentlv = getPotionEffectLevel(type,p); PotionEffect neweffect = new PotionEffect(type,tick_duration,(currentlv+incr_amt= duration) { logAndApplyPotionEffectToEntity(neweffect.getType(), neweffect.getDuration(),neweffect.getAmplifier(), p, true); //} + } } else { PotionEffect neweffect = new PotionEffect(type,tick_duration,incr_amt-1); logAndApplyPotionEffectToEntity(neweffect.getType(), neweffect.getDuration(),neweffect.getAmplifier(), p, true); @@ -4639,6 +4643,7 @@ public class GenericFunctions { aPlugin.API.sendCooldownPacket(player, name, GetModifiedCooldown(TwosideKeeper.ASSASSINATE_COOLDOWN,player)); } pd.lastassassinatetime=TwosideKeeper.getServerTickTime(); + pd.lastusedassassinate=TwosideKeeper.getServerTickTime(); if (ItemSet.HasSetBonusBasedOnSetBonusCount(player, ItemSet.WOLFSBANE, 5)) { GenericFunctions.addIFrame(player, (int)ItemSet.TotalBaseAmountBasedOnSetBonusCount(player, ItemSet.WOLFSBANE, 5, 4)); } else { @@ -4703,6 +4708,7 @@ public class GenericFunctions { teleportloc.setDirection(dir); player.teleport(teleportloc); PlayerStructure pd = PlayerStructure.GetPlayerStructure(player); + pd.lastusedassassinate=TwosideKeeper.getServerTickTime(); if (name!=Material.SKULL_ITEM || pd.lastlifesavertime+GetModifiedCooldown(TwosideKeeper.LIFESAVER_COOLDOWN,player)=1 && - ItemSet.GetBaubleTier(p)>=27 && ItemSet.GetItemTier(p.getEquipment().getItemInMainHand())>=3) { + if (ItemSet.meetsSlayerSwordConditions(ItemSet.LORASYS, 27, 3, p) || + ItemSet.meetsSlayerSwordConditions(ItemSet.STEALTH, 9, 1, p)) { return; } else { if (!aPlugin.API.isAFK(p)) { @@ -5344,6 +5350,47 @@ public class GenericFunctions { TwosideKeeper.sendNotReadyCastMessage(p,ChatColor.RED+"Beast Within"); } } + + public static boolean isFood(ItemStack item) { + Material mat = item.getType(); + //Because Storm is boosted. + return (mat==Material.GOLDEN_CARROT || + mat==Material.GOLDEN_APPLE || + mat==Material.COOKED_BEEF || + mat==Material.PORK || + mat==Material.COOKED_MUTTON || + mat==Material.COOKED_FISH || + mat==Material.SPIDER_EYE || + mat==Material.COOKED_CHICKEN || + mat==Material.COOKED_RABBIT || + mat==Material.MUSHROOM_SOUP || + mat==Material.BEETROOT_SOUP || + mat==Material.BREAD || + mat==Material.CARROT_ITEM || + //I hate you Orni. + mat==Material.BAKED_POTATO || + mat==Material.BEETROOT || + mat==Material.RABBIT_STEW || + mat==Material.PUMPKIN_PIE || + mat==Material.APPLE || + mat==Material.RAW_BEEF || + mat==Material.GRILLED_PORK || + //Really hate. + mat==Material.RAW_CHICKEN || + mat==Material.MUTTON || + mat==Material.RABBIT || + mat==Material.POISONOUS_POTATO || + mat==Material.MELON || + mat==Material.POTATO_ITEM || + mat==Material.CHORUS_FRUIT || + mat==Material.COOKIE || + mat==Material.ROTTEN_FLESH || + mat==Material.RAW_FISH || + mat==Material.MILK_BUCKET || + mat==Material.POTION + //Tilted. TILTED. + ); + } public static void dropItem(ItemStack oldMainHand, Location l) { Chunk c = l.getChunk(); @@ -5357,4 +5404,37 @@ public class GenericFunctions { TwosideKeeper.temporary_chunks.remove(c); c.unload(); } + + public static void removeAggroFromNearbyTargets(Player p) { + List ents = p.getNearbyEntities(16, 16, 16); + for (Entity e : ents) { + if (e instanceof LivingEntity) { + LivingEntity l = (LivingEntity)e; + LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l); + if (les.GetTarget()!=null && + les.GetTarget().equals(p)) { + l.setAI(false); + les.SetTarget(null); + Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{ + if (l!=null && l.isValid()) { + l.setAI(true); + } + }, 1); + } + if (l instanceof Monster) { + Monster m = (Monster)l; + if (m.getTarget()!=null && + m.getTarget().equals(p)) { + m.setAI(false); + m.setTarget(null); + Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{ + if (m!=null && m.isValid()) { + m.setAI(true); + } + }, 1); + } + } + } + } + } } diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java b/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java index 82037da..527f6d3 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java @@ -14,6 +14,7 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import aPlugin.API; +import sig.plugin.TwosideKeeper.CustomDamage; import sig.plugin.TwosideKeeper.PlayerStructure; import sig.plugin.TwosideKeeper.TwosideKeeper; import sig.plugin.TwosideKeeper.HelperStructures.Common.BaublePouch; @@ -838,7 +839,8 @@ public enum ItemSet { if (tier>=4) { lore.add(ChatColor.DARK_AQUA+" T40 - "); lore.add(ChatColor.WHITE+" +30% Cooldown Reduction"); - lore.add(ChatColor.WHITE+" +100% Critical Strike Chance"); + lore.add(ChatColor.WHITE+" +30% Critical Strike Chance"); + lore.add(ChatColor.WHITE+" +100% Critical Strike Damage"); } } } @@ -1136,4 +1138,18 @@ public enum ItemSet { } else return 1; } + + public static double GetMultiplicativeTotalBaseAmount(Player p, ItemSet set) { + PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); + double val = 0; + if (pd.itemsets.containsKey(set.name())) { + HashMap tiermap = pd.itemsets.get(set.name()); + for (Integer tier : tiermap.keySet()) { + for (int i=0;igetServerTickTime()) { if (!GenericFunctions.hasStealth(p)) { + GenericFunctions.removeAggroFromNearbyTargets(p); GenericFunctions.applyStealth(p,true); } else { GenericFunctions.removeStealth(p); @@ -5408,7 +5411,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } public void DropDeathInventoryContents(Player p, Location deathloc, int tickdelay) { List list = PrepareDropItems(p); - Bukkit.getScheduler().scheduleSyncDelayedTask(this,new DropDeathItems(p,list,deathloc),tickdelay); + Bukkit.getScheduler().scheduleSyncDelayedTask(this,new DropDeathItems(p,list,deathloc.clone()),tickdelay); } public List PrepareDropItems(Player p) { Inventory contents = Bukkit.createInventory(p, 45); @@ -6806,6 +6809,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener { public static void updateHealthbarDisplay(Player p, LivingEntity target, double damage, int flags) { PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); updateHealthbarDisplay(p,target); + if (CustomDamage.isFlagSet(pd.lasthitproperties, CustomDamage.IS_PREEMPTIVE)) { + pd.customtitle.modifyLargeCenterTitle(ChatColor.BLUE+"!", 20); + } if (pd.damagenumbers) { if (Bukkit.getPlayer(pd.name)!=null && target!=null) { if (Bukkit.getPlayer(pd.name)!=null && target!=null) { @@ -6815,7 +6821,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { col = ChatColor.YELLOW; } else if (CustomDamage.isFlagSet(pd.lasthitproperties, CustomDamage.IS_PREEMPTIVE)) { - pd.customtitle.modifyLargeCenterTitle(ChatColor.BLUE+"!", 20); + //pd.customtitle.modifyLargeCenterTitle(ChatColor.BLUE+"!", 20); col = ChatColor.BLUE; } else if (CustomDamage.isFlagSet(pd.lasthitproperties, CustomDamage.IS_HEADSHOT)) { @@ -7469,7 +7475,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); if (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER) { - if (pd.lastassassinatetime+20>getServerTickTime()) { //Successful Assassination. + if (pd.lastusedassassinate+20>getServerTickTime()) { //Successful Assassination. pd.lastassassinatetime=0; ItemStack[] inv = p.getInventory().getContents(); for (int i=0;i<9;i++) { @@ -7493,7 +7499,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } } GenericFunctions.addStackingPotionEffect(p, PotionEffectType.INCREASE_DAMAGE, 10*20, 39, 2); - } else { + } else + if (ItemSet.meetsSlayerSwordConditions(ItemSet.STEALTH, 27, 3, p)) { + GenericFunctions.addStackingPotionEffect(p, PotionEffectType.INCREASE_DAMAGE, 20*60, 19); + } else + { GenericFunctions.addStackingPotionEffect(p, PotionEffectType.INCREASE_DAMAGE, 10*20, 9); } if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.GLADOMAIN, 7)) { @@ -7719,6 +7729,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener { GenericFunctions.spawnXP(mer.getLocation(), (int)(expdrop*0.25)); }} ,50); + } else { + droplist.addAll(originaldroplist); } break; case HELLFIRE: @@ -7753,6 +7765,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener { GenericFunctions.spawnXP(mer1.getLocation(), (int)(expdrop1*0.25)); }} ,50); + } else { + droplist.addAll(originaldroplist); } break; case END: @@ -7787,6 +7801,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener { GenericFunctions.spawnXP(mer4.getLocation(), (int)(expdrop4*0.25)); }} ,50); + } else { + droplist.addAll(originaldroplist); } break; case ELITE: @@ -8032,6 +8048,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener { p.getEquipment().setItemInMainHand(oldMainHand); oldOffHand.setAmount(oldOffHand.getAmount()-1); p.getEquipment().setItemInOffHand(oldOffHand); + Bukkit.getScheduler().runTaskLater(this, new VerifyItemWasMovedTask(oldMainHand.clone(),p,ItemSlot.MAINHAND), 1); + Bukkit.getScheduler().runTaskLater(this, new VerifyItemWasMovedTask(oldOffHand.clone(),p,ItemSlot.OFFHAND), 1); } else { TwosideKeeper.log("WARNING!! Could not give recovered item for eating soup from off-hand back! Dropping "+oldMainHand+" at Location "+l, 1); GenericFunctions.dropItem(oldMainHand, l); @@ -8043,7 +8061,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { private boolean EatingSoupFromOffHand(Player p) { return isSoup(p.getEquipment().getItemInOffHand()) && p.getEquipment().getItemInOffHand().getAmount()>1 && - !isSoup(p.getEquipment().getItemInMainHand()); + !GenericFunctions.isFood(p.getEquipment().getItemInMainHand()); } private boolean isSoup(ItemStack item) { return item.getType()==Material.MUSHROOM_SOUP || diff --git a/src/sig/plugin/TwosideKeeper/runServerHeartbeat.java b/src/sig/plugin/TwosideKeeper/runServerHeartbeat.java index d1740fe..b6ce5a4 100644 --- a/src/sig/plugin/TwosideKeeper/runServerHeartbeat.java +++ b/src/sig/plugin/TwosideKeeper/runServerHeartbeat.java @@ -267,6 +267,8 @@ final class runServerHeartbeat implements Runnable { TwosideKeeper.HeartbeatLogger.AddEntry("Auto Consume Food", (int)(System.nanoTime()-time));time=System.nanoTime(); } + PerformStealthSetRegen(p,pd); + updateCustomTitle(p, pd); TwosideKeeper.HeartbeatLogger.AddEntry("Update Custom Title", (int)(System.nanoTime()-time));time=System.nanoTime(); } @@ -350,6 +352,20 @@ final class runServerHeartbeat implements Runnable { TwosideKeeper.HeartbeatLogger.AddEntry(ChatColor.LIGHT_PURPLE+"Total Server Heartbeat", (int)(System.nanoTime()-totaltime));totaltime=System.nanoTime(); } + private void PerformStealthSetRegen(Player p, PlayerStructure pd) { + if (pd.laststealthheal+100<=TwosideKeeper.getServerTickTime() && + GenericFunctions.hasStealth(p) && + ItemSet.meetsSlayerSwordConditions(ItemSet.STEALTH, 40, 4, p)) { + GenericFunctions.HealEntity(p, 2); + if (pd.slayermodehp+20) { - double spdmult = ItemSet.GetTotalBaseAmount(p, ItemSet.DASHER)/100d; - aPlugin.API.setPlayerSpeedMultiplier(p, (float)(1.0f+spdmult)); + spdmult += ItemSet.GetTotalBaseAmount(p, ItemSet.DASHER)/100d; } + spdmult += ItemSet.GetTotalBaseAmount(p, ItemSet.STEALTH)/100d; + aPlugin.API.setPlayerSpeedMultiplier(p, (float)(1.0f+spdmult)); } private void EndShopSession(Player p) {