diff --git a/TwosideKeeper.jar b/TwosideKeeper.jar index fc26ea7..6966683 100644 Binary files a/TwosideKeeper.jar and b/TwosideKeeper.jar differ diff --git a/src/plugin.yml b/src/plugin.yml index 6276017..dad4ef5 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: TwosideKeeper main: sig.plugin.TwosideKeeper.TwosideKeeper -version: 3.10.10 +version: 3.11.0 loadbefore: [aPlugin] commands: money: diff --git a/src/sig/plugin/TwosideKeeper/ActionBarBuffUpdater.java b/src/sig/plugin/TwosideKeeper/ActionBarBuffUpdater.java index d7f95cc..cdc13f7 100644 --- a/src/sig/plugin/TwosideKeeper/ActionBarBuffUpdater.java +++ b/src/sig/plugin/TwosideKeeper/ActionBarBuffUpdater.java @@ -68,7 +68,7 @@ public class ActionBarBuffUpdater{ effectString.append(" "); } if (pd.lastvendettastack+200>TwosideKeeper.getServerTickTime() && - ItemSet.hasFullSet(GenericFunctions.getEquipment(p), p, ItemSet.SONGSTEEL)) { + ItemSet.hasFullSet((Player)p, ItemSet.SONGSTEEL)) { effectString.append(ChatColor.GRAY); effectString.append("☉"); effectString.append(AppendAmplifier(((int)((pd.lastvendettastack+200)-TwosideKeeper.getServerTickTime())/20)-1,false)); diff --git a/src/sig/plugin/TwosideKeeper/CustomDamage.java b/src/sig/plugin/TwosideKeeper/CustomDamage.java index 328596a..30116b2 100644 --- a/src/sig/plugin/TwosideKeeper/CustomDamage.java +++ b/src/sig/plugin/TwosideKeeper/CustomDamage.java @@ -186,7 +186,7 @@ public class CustomDamage { double bonus_truedmg = 0; Player p = (Player)getDamagerEntity(damager); bonus_truedmg += API.getPlayerBonuses(p).getBonusTrueDamage(); - bonus_truedmg += ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getBaubles(shooter), (Player)shooter, ItemSet.ALUSTINE, 7)?((Player)shooter).getLevel():0; + bonus_truedmg += ItemSet.HasSetBonusBasedOnSetBonusCount((Player)shooter, ItemSet.ALUSTINE, 7)?((Player)shooter).getLevel():0; return bonus_truedmg; } else { return 0.0; @@ -251,8 +251,8 @@ public class CustomDamage { dmg += addToPlayerLogger(damager,target,"Execute",(((GenericFunctions.getAbilityValue(ArtifactAbility.EXECUTION, weapon)*5.0)*(1-(target.getHealth()/target.getMaxHealth()))))); if (shooter instanceof Player) { dmg += addToPlayerLogger(damager,target,"Tactics Bonus Damage",API.getPlayerBonuses((Player)shooter).getBonusDamage()); - dmg += addToPlayerLogger(damager,target,"Execute Set Bonus",(((ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(shooter),(Player)shooter, ItemSet.LORASAADI, 4, 4)*5.0)*(1-(target.getHealth()/target.getMaxHealth()))))); - if (!((Player)shooter).isOnGround()) {dmg += addToPlayerLogger(damager,target,"Prancer Set Bonus",ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(shooter), (Player)shooter, ItemSet.PRANCER));} + dmg += addToPlayerLogger(damager,target,"Execute Set Bonus",(((ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.LORASAADI, 4, 4)*5.0)*(1-(target.getHealth()/target.getMaxHealth()))))); + if (!((Player)shooter).isOnGround()) {dmg += addToPlayerLogger(damager,target,"Prancer Set Bonus",ItemSet.GetTotalBaseAmount((Player)shooter, ItemSet.PRANCER));} if (PlayerMode.getPlayerMode((Player)shooter)==PlayerMode.BARBARIAN) { dmg += addMultiplierToPlayerLogger(damager,target,"Barbarian Execute Mult",dmg * (1-(target.getHealth()/target.getMaxHealth()))); } @@ -339,7 +339,7 @@ public class CustomDamage { private static double getDamageFromBarbarianSetBonus(LivingEntity target) { if (target instanceof Player) { Player p = (Player)target; - return (ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p,true), p, ItemSet.DAWNTRACKER)+1)/3; + return (ItemSet.GetTotalBaseAmount(p, ItemSet.DAWNTRACKER)+1)/3; } return 0.0; } @@ -400,10 +400,10 @@ public class CustomDamage { if (damager instanceof Player) { Player p = (Player)damager; PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); - if (ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.DANCER)>0) { - dmg += 93.182445*pd.velocity*ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.DANCER); + if (ItemSet.GetTotalBaseAmount(p, ItemSet.DANCER)>0) { + dmg += 93.182445*pd.velocity*ItemSet.GetTotalBaseAmount(p, ItemSet.DANCER); pd.lasthighwinderhit=TwosideKeeper.getServerTickTime(); - GenericFunctions.sendActionBarMessage(p, TwosideKeeper.drawVelocityBar(pd.velocity,ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.DANCER)),true); + GenericFunctions.sendActionBarMessage(p, TwosideKeeper.drawVelocityBar(pd.velocity,ItemSet.GetTotalBaseAmount(p, ItemSet.DANCER)),true); } } return dmg; @@ -489,7 +489,7 @@ public class CustomDamage { PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); if (PlayerMode.isDefender(p)) { GenericFunctions.addStackingPotionEffect(p, PotionEffectType.DAMAGE_RESISTANCE, 20*5, 4); - if (p.isBlocking() && ItemSet.hasFullSet(GenericFunctions.getEquipment(p), p, ItemSet.SONGSTEEL)) { + if (p.isBlocking() && ItemSet.hasFullSet(p, ItemSet.SONGSTEEL)) { ApplyVendettaStackTimer(pd); pd.vendetta_amt+=((1-CalculateDamageReduction(1,target,damager))*pd.lastrawdamage)*0.40; if (TwosideKeeper.getMaxThornsLevelOnEquipment(target)>0) { @@ -683,7 +683,7 @@ public class CustomDamage { GenericFunctions.addSuppressionTime(target, 15); } if (isFlagSet(pd.lasthitproperties,IS_PREEMPTIVE)) { - if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getBaubles(p), p, ItemSet.WOLFSBANE, 7)) { + if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.WOLFSBANE, 7)) { if (pd.slayermodehp+2 partymembers = PartyManager.getPartyMembers(p); for (Player pl : partymembers) { - if (!pl.equals(p) && ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getArmor(pl), pl, ItemSet.DONNER, 4)) { + if (!pl.equals(p) && ItemSet.HasSetBonusBasedOnSetBonusCount(pl, ItemSet.DONNER, 4)) { //Aggro to them instead. if (!m.hasPotionEffect(PotionEffectType.GLOWING)) { setMonsterTarget(m,pl); @@ -925,7 +925,7 @@ public class CustomDamage { } private static void applyLightningStriketoFoe(Player p, LivingEntity target) { - if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getArmor(p),p,ItemSet.BLITZEN,4)) { + if (ItemSet.HasSetBonusBasedOnSetBonusCount(p,ItemSet.BLITZEN,4)) { PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); if (pd.lastlightningstrike+1000) { - CustomDamage.ApplyDamage(ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.OLIVE), p, shooter, null, "Retaliation", TRUEDMG); + ItemSet.GetTotalBaseAmount(p, ItemSet.OLIVE)>0) { + CustomDamage.ApplyDamage(ItemSet.GetTotalBaseAmount(p, ItemSet.OLIVE), p, shooter, null, "Retaliation", TRUEDMG); } } } @@ -1067,7 +1067,7 @@ public class CustomDamage { public static void IncreaseWeaponCharges(Player p, int amt) { PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); if (pd.rage_time<=TwosideKeeper.getServerTickTime()) { - if (ItemSet.hasFullSet(GenericFunctions.getEquipment(p,true), p, ItemSet.DAWNTRACKER)) { + if (ItemSet.hasFullSet(p, ItemSet.DAWNTRACKER)) { amt*=2; } pd.weaponcharges+=amt; @@ -1077,7 +1077,7 @@ public class CustomDamage { public static void IncreaseLifestealStacks(Player p, int amt) { PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); - if (ItemSet.hasFullSet(GenericFunctions.getEquipment(p,true), p, ItemSet.DAWNTRACKER)) { + if (ItemSet.hasFullSet(p, ItemSet.DAWNTRACKER)) { amt*=2; } pd.lifestealstacks=Math.min(100,pd.lifestealstacks+amt*((pd.rage_time>TwosideKeeper.getServerTickTime())?2:1)); @@ -1119,7 +1119,7 @@ public class CustomDamage { } private static void removeExperienceFromAlustineSetBonus(Player p) { - if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getBaubles(p), p, ItemSet.ALUSTINE, 7)) { + if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.ALUSTINE, 7)) { aPlugin.API.setTotalExperience(p, aPlugin.API.getTotalExperience(p)-p.getLevel()); } } @@ -1428,7 +1428,7 @@ public class CustomDamage { } private static void applyDonnerSetAggro(Monster m, Player p) { - double aggrotime = ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.DONNER)*20; + double aggrotime = ItemSet.GetTotalBaseAmount(p, ItemSet.DONNER)*20; setAggroGlowTickTime(m,(int)aggrotime); } @@ -1640,14 +1640,14 @@ public class CustomDamage { TwosideKeeper.log("Enough ticks have passed.", 5); if (CanResistExplosionsWithExperienceSet(damager, target, reason)) { - aPlugin.API.setTotalExperience((Player)target, (int)Math.max(aPlugin.API.getTotalExperience((Player)target)-ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getBaubles(target), (Player)target, ItemSet.ALUSTINE, 2, 2),0)); + aPlugin.API.setTotalExperience((Player)target, (int)Math.max(aPlugin.API.getTotalExperience((Player)target)-ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target, ItemSet.ALUSTINE, 2, 2),0)); SoundUtils.playGlobalSound(((Player)target).getLocation(), Sound.ENTITY_PLAYER_ATTACK_SWEEP, 3.0f, 1.0f); ((Player)target).playSound(((Player)target).getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1.0f, 0.5f); GenericFunctions.updateNoDamageTickMap(target, damager); return true; } if (CanResistDotsWithExperienceSet(damager, target, reason)) { - aPlugin.API.setTotalExperience((Player)target, (int)Math.max(aPlugin.API.getTotalExperience((Player)target)-ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getBaubles(target), (Player)target, ItemSet.ALUSTINE, 3, 3),0)); + aPlugin.API.setTotalExperience((Player)target, (int)Math.max(aPlugin.API.getTotalExperience((Player)target)-ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target, ItemSet.ALUSTINE, 3, 3),0)); SoundUtils.playGlobalSound(((Player)target).getLocation(), Sound.ENTITY_PLAYER_ATTACK_SWEEP, 3.0f, 1.0f); ((Player)target).playSound(((Player)target).getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1.0f, 0.5f); GenericFunctions.updateNoDamageTickMap(target, damager); @@ -1710,7 +1710,7 @@ public class CustomDamage { double attackrate = 0.0; if (damager instanceof Player) { Player p = (Player)damager; - attackrate += ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.BLITZEN)/100d; + attackrate += ItemSet.GetTotalBaseAmount(p, ItemSet.BLITZEN)/100d; } return attackrate; } @@ -1725,16 +1725,16 @@ public class CustomDamage { } public static boolean CanResistExplosionsWithExperienceSet(Entity damager, LivingEntity target, String reason) { - return target instanceof Player && ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getBaubles(target), (Player)target, ItemSet.ALUSTINE, 2) && + return target instanceof Player && ItemSet.HasSetBonusBasedOnSetBonusCount((Player)target, ItemSet.ALUSTINE, 2) && ((reason!=null && (reason.equalsIgnoreCase("explosion") || reason.equalsIgnoreCase("entity_explosion"))) || damager instanceof Creeper) && - aPlugin.API.getTotalExperience((Player)target)>=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getBaubles(target), (Player)target, ItemSet.ALUSTINE, 2, 2); + aPlugin.API.getTotalExperience((Player)target)>=ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target, ItemSet.ALUSTINE, 2, 2); } public static boolean CanResistDotsWithExperienceSet(Entity damager, LivingEntity target, String reason) { - return target instanceof Player && ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getBaubles(target), (Player)target, ItemSet.ALUSTINE, 3) && + return target instanceof Player && ItemSet.HasSetBonusBasedOnSetBonusCount((Player)target, ItemSet.ALUSTINE, 3) && ((reason!=null && (reason.equalsIgnoreCase("poison") || reason.equalsIgnoreCase("wither") || reason.equalsIgnoreCase("fire_tick") || reason.equalsIgnoreCase("lava") || reason.equalsIgnoreCase("fire")))) && - aPlugin.API.getTotalExperience((Player)target)>=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getBaubles(target), (Player)target, ItemSet.ALUSTINE, 3, 3); + aPlugin.API.getTotalExperience((Player)target)>=ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target, ItemSet.ALUSTINE, 3, 3); } private static boolean canHitMobDueToWeakness(Entity damager) { @@ -1762,7 +1762,7 @@ public class CustomDamage { duration += 0.1+GenericFunctions.getAbilityValue(ArtifactAbility.GRACEFULDODGE, equip[i]); } } - duration+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(target), (Player)target,ItemSet.JAMDAK,4,4)/20d; + duration+=ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target,ItemSet.JAMDAK,4,4)/20d; //Convert from seconds to ticks. int tick_duration = (int)(duration*20); //Apply iframes. @@ -1784,7 +1784,7 @@ public class CustomDamage { Player p = (Player)target; PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); double rawdmg = CalculateDamage(0,damager,target,null,null,NONE)*(1d/CalculateDamageReduction(1,target,damager)); - if (p.isBlocking() && ItemSet.hasFullSet(GenericFunctions.getEquipment(p), p, ItemSet.SONGSTEEL)) { + if (p.isBlocking() && ItemSet.hasFullSet(p, ItemSet.SONGSTEEL)) { ApplyVendettaStackTimer(pd); pd.vendetta_amt+=((1-CalculateDamageReduction(1,target,damager))*(rawdmg*0.40)); if (TwosideKeeper.getMaxThornsLevelOnEquipment(target)>0) { @@ -1793,7 +1793,7 @@ public class CustomDamage { DecimalFormat df = new DecimalFormat("0.00"); GenericFunctions.sendActionBarMessage(p, ChatColor.YELLOW+" Vendetta: "+ChatColor.GREEN+Math.round(pd.vendetta_amt)+((pd.thorns_amt>0)?"/"+ChatColor.GOLD+df.format(pd.thorns_amt):"")+ChatColor.GREEN+" dmg stored",true); } - if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getArmor(p), p, ItemSet.VIXEN, 4)) { + if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.VIXEN, 4)) { p.setHealth(Math.min(p.getHealth()+(p.getMaxHealth()*0.1), p.getMaxHealth())); } return true; @@ -1845,10 +1845,10 @@ public class CustomDamage { } dodgechance=addMultiplicativeValue(dodgechance,API.getPlayerBonuses(p).getBonusDodgeChance()); - dodgechance=addMultiplicativeValue(dodgechance,ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.ALIKAHN)/100d); - dodgechance=addMultiplicativeValue(dodgechance,ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.DARNYS)/100d); - dodgechance=addMultiplicativeValue(dodgechance,ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.JAMDAK)/100d); - dodgechance=addMultiplicativeValue(dodgechance,ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.LORASAADI)/100d); + dodgechance=addMultiplicativeValue(dodgechance,ItemSet.GetTotalBaseAmount(p, ItemSet.ALIKAHN)/100d); + 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); PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); @@ -1857,14 +1857,14 @@ public class CustomDamage { dodgechance=addMultiplicativeValue(dodgechance,0.01*ArtifactUtils.getArtifactTier(p.getEquipment().getItemInMainHand())); } - dodgechance=addMultiplicativeValue(dodgechance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p,ItemSet.PANROS,3,3)/100d); + dodgechance=addMultiplicativeValue(dodgechance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(p,ItemSet.PANROS,3,3)/100d); if (p.isBlocking()) { - dodgechance=addMultiplicativeValue(dodgechance,ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.SONGSTEEL)/100d); + dodgechance=addMultiplicativeValue(dodgechance,ItemSet.GetTotalBaseAmount(p, ItemSet.SONGSTEEL)/100d); } - dodgechance=addMultiplicativeValue(dodgechance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p,ItemSet.JAMDAK,2,2)/100d); - dodgechance=addMultiplicativeValue(dodgechance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p,ItemSet.JAMDAK,3,3)/100d); + dodgechance=addMultiplicativeValue(dodgechance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(p,ItemSet.JAMDAK,2,2)/100d); + dodgechance=addMultiplicativeValue(dodgechance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(p,ItemSet.JAMDAK,3,3)/100d); - if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getArmor(p), p, ItemSet.VIXEN, 4)) { + if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.VIXEN, 4)) { dodgechance=addMultiplicativeValue(dodgechance,0.2); } @@ -1876,11 +1876,11 @@ public class CustomDamage { } } - dodgechance=addMultiplicativeValue(dodgechance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getBaubles(p), p, ItemSet.GLADOMAIN, 3, 3)/100d); - if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getBaubles(p), p, ItemSet.GLADOMAIN, 7)) { - dodgechance=addMultiplicativeValue(dodgechance,(93.182445*pd.velocity)*(0.05+(0.01*ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getBaubles(p), p, ItemSet.GLADOMAIN, 7, 4)))); //For every 1m, give 5%. + dodgechance=addMultiplicativeValue(dodgechance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.GLADOMAIN, 3, 3)/100d); + if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.GLADOMAIN, 7)) { + dodgechance=addMultiplicativeValue(dodgechance,(93.182445*pd.velocity)*(0.05+(0.01*ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.GLADOMAIN, 7, 4)))); //For every 1m, give 5%. } - if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getBaubles(p), p, ItemSet.MOONSHADOW, 7) && + if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.MOONSHADOW, 7) && GenericFunctions.hasStealth(p)) { dodgechance=addMultiplicativeValue(dodgechance,0.4); } @@ -1932,15 +1932,15 @@ public class CustomDamage { ItemStack[] armor = GenericFunctions.getEquipment(target,true); if (target instanceof Player) { Player p = (Player)target; - rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(target), p, ItemSet.DARNYS, 2, 2)/100d; - rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(target), p, ItemSet.DARNYS, 3, 3)/100d; + rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DARNYS, 2, 2)/100d; + rangerdmgdiv += 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; rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.LORASAADI, 2, 2)/100d;*/ rangeraegislevel += GenericFunctions.getSwiftAegisAmt(p); if ((p).getLocation().getY()>=0 && (p).getLocation().getY()<=255 && (p).getLocation().add(0,0,0).getBlock().getLightLevel()<=7) { - darknessdiv += ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.RUDOLPH)/100d; + darknessdiv += ItemSet.GetTotalBaseAmount(p, ItemSet.RUDOLPH)/100d; } } else { LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(target); @@ -2089,7 +2089,7 @@ public class CustomDamage { dmgreduction /= ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand())?2:1; }*/ tacticspct = API.getPlayerBonuses(p).getBonusPercentDamageReduction(); - setbonus = ((100-ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.SONGSTEEL, 4, 4))/100d); + setbonus = ((100-ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.SONGSTEEL, 4, 4))/100d); playermodediv=(PlayerMode.getPlayerMode(p)==PlayerMode.NORMAL)?0.2d:0; } @@ -2152,7 +2152,7 @@ public class CustomDamage { private static double ShredDamageReduction(double dmgreduction, LivingEntity target, Entity damager) { LivingEntity shooter = getDamagerEntity(damager); if (shooter!=null && (shooter instanceof Player) && - ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getArmor((Player)shooter), (Player)shooter, ItemSet.PRANCER, 4)) { + ItemSet.HasSetBonusBasedOnSetBonusCount((Player)shooter, ItemSet.PRANCER, 4)) { PlayerStructure pd = PlayerStructure.GetPlayerStructure((Player)shooter); if (pd.ignoretargetarmor+200=9) || + dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.DASHER, 2, 2); + dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.DANCER, 2, 2); + dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.PRANCER, 2, 2); + dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.VIXEN, 2, 2); + dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.BLITZEN, 2, 2); + dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.COMET, 3, 3); + dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.CUPID, 3, 3); + dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.DONNER, 3, 3); + dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.RUDOLPH, 3, 3); + dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.OLIVE, 3, 3); + if (ItemSet.HasSetBonusBasedOnSetBonusCount((Player)shooter, ItemSet.PANROS, 5) || + ItemSet.HasSetBonusBasedOnSetBonusCount((Player)shooter, ItemSet.DAWNTRACKER, 5) || + (ItemSet.meetsLorasysSwordConditions(9, 1, (Player)shooter)) || GenericFunctions.HasFullRangerSet((Player)shooter)) { dmg += 15; } - if ((ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getEquipment(shooter), (Player)shooter, ItemSet.LORASYS, 1) && - ItemSet.GetBaubleTier((Player)shooter)>=40) && ItemSet.GetTier(shooter.getEquipment().getItemInMainHand())>=4) { + if (ItemSet.meetsLorasysSwordConditions(40, 4, (Player)shooter)) { dmg += 55; } } @@ -2613,9 +2611,9 @@ public class CustomDamage { !p.equals(check) && NotTankReason(reason)) { //This is a defender. Transfer half the damage to them! double origdmg = dmg; - dmg = origdmg-(origdmg*(ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(check), check, ItemSet.CUPID)/100d)); + dmg = origdmg-(origdmg*(ItemSet.GetTotalBaseAmount(check, ItemSet.CUPID)/100d)); //Send the rest of the damage to the defender. - double defenderdmg = origdmg*(ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(check), check, ItemSet.CUPID)/100d); + double defenderdmg = origdmg*(ItemSet.GetTotalBaseAmount(check, ItemSet.CUPID)/100d); //defenderdmg=CalculateDamageReduction(dmg, check, entity); ApplyDamage(defenderdmg, shooter, check, null, "Cupid Set Tank", IGNOREDODGE|IGNORE_DAMAGE_TICK); //TwosideKeeper.log("Damage was absorbed by "+check.getName()+". Took "+defenderdmg+" reduced damage. Original damage: "+dmg,0); @@ -2634,7 +2632,7 @@ public class CustomDamage { } private static boolean isCupidTank(Player p) { - if (ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.CUPID)>0) { + if (ItemSet.GetTotalBaseAmount(p, ItemSet.CUPID)>0) { return true; } else { return false; @@ -2671,24 +2669,26 @@ public class CustomDamage { Player p = (Player)shooter; PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); critchance = addMultiplicativeValue(critchance,(PlayerMode.isStriker(p)?0.2:0.0)); - critchance = addMultiplicativeValue(critchance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p,ItemSet.PANROS,4,4)/100d); + critchance = addMultiplicativeValue(critchance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(p,ItemSet.PANROS,4,4)/100d); critchance = addMultiplicativeValue(critchance,(PlayerMode.isRanger(p)?(GenericFunctions.getPotionEffectLevel(PotionEffectType.SLOW, p)+1)*0.1:0.0)); - critchance = addMultiplicativeValue(critchance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getBaubles(p), p, ItemSet.MOONSHADOW, 5, 4)/100d); - critchance = addMultiplicativeValue(critchance,ItemSet.GetTotalBaseAmount(GenericFunctions.getBaubles(p), p, ItemSet.WOLFSBANE)/100d); + critchance = addMultiplicativeValue(critchance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.MOONSHADOW, 5, 4)/100d); + critchance = addMultiplicativeValue(critchance,ItemSet.GetTotalBaseAmount(p, ItemSet.WOLFSBANE)/100d); critchance = addMultiplicativeValue(critchance,API.getPlayerBonuses(p).getBonusCriticalChance()); critchance = addMultiplicativeValue(critchance,(pd.slayermegahit)?1.0:0.0); if (reason!=null && reason.equalsIgnoreCase("power swing")) { critchance = addMultiplicativeValue(critchance,1.0d); } - if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getEquipment(shooter), (Player)shooter, ItemSet.LORASYS, 1)) { - if (ItemSet.GetBaubleTier((Player)shooter)>=18 && ItemSet.GetTier(shooter.getEquipment().getItemInMainHand())>=2) { + if (ItemSet.HasSetBonusBasedOnSetBonusCount((Player)shooter, ItemSet.LORASYS, 1)) { + int baubletier = ItemSet.GetBaubleTier((Player)shooter); + int swordtier = ItemSet.GetItemTier(shooter.getEquipment().getItemInMainHand()); + if (baubletier>=18 && swordtier>=2) { critchance = addMultiplicativeValue(critchance,0.1d); - } - if (ItemSet.GetBaubleTier((Player)shooter)>=27 && ItemSet.GetTier(shooter.getEquipment().getItemInMainHand())>=3) { - critchance = addMultiplicativeValue(critchance,0.2d); - } - if (ItemSet.GetBaubleTier((Player)shooter)>=40 && ItemSet.GetTier(shooter.getEquipment().getItemInMainHand())>=4) { - critchance = addMultiplicativeValue(critchance,0.45d); + if (baubletier>=27 && swordtier>=3) { + critchance = addMultiplicativeValue(critchance,0.2d); + if (baubletier>=40 && swordtier>=4) { + critchance = addMultiplicativeValue(critchance,0.45d); + } + } } } } @@ -2733,7 +2733,7 @@ public class CustomDamage { critdmg+=1.0; } critdmg+=API.getPlayerBonuses(p).getBonusCriticalDamage(); - critdmg+=ItemSet.GetTotalBaseAmount(GenericFunctions.getBaubles(p), p, ItemSet.MOONSHADOW)/100d; + critdmg+=ItemSet.GetTotalBaseAmount(p, ItemSet.MOONSHADOW)/100d; } TwosideKeeper.log("Crit Damage is "+critdmg, 5); return critdmg; @@ -2854,14 +2854,13 @@ public class CustomDamage { } finaldmg += dmg*0.5; } - if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.PANROS, 5)) { + if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.PANROS, 5)) { finaldmg += dmg*0.5; } else - if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getEquipment(p,true), p, ItemSet.DAWNTRACKER, 5)) { + if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.DAWNTRACKER, 5)) { finaldmg += dmg*0.5; } else - if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.LORASYS, 1) && - ItemSet.GetBaubleTier(p)>=9) { + if (ItemSet.meetsLorasysSwordConditions(9, 1, p)) { finaldmg += dmg*0.5; } finaldmg += dmg*aPlugin.API.getPlayerBonuses(p).getBonusArmorPenetration(); @@ -3058,7 +3057,7 @@ public class CustomDamage { public static double calculateLifeStealAmount(Player p, ItemStack weapon, String reason) { double lifestealpct = GenericFunctions.getAbilityValue(ArtifactAbility.LIFESTEAL, weapon)/100; PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); - lifestealpct += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p,true), p, ItemSet.DAWNTRACKER, 3, 3)/100d; + lifestealpct += ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DAWNTRACKER, 3, 3)/100d; lifestealpct += pd.lifestealstacks/100d; lifestealpct += API.getPlayerBonuses(p).getBonusLifesteal(); if (reason!=null && reason.equalsIgnoreCase("power swing")) { @@ -3067,8 +3066,8 @@ public class CustomDamage { if (pd.rage_time>TwosideKeeper.getServerTickTime()) { lifestealpct += (pd.rage_amt/2)*0.01; } - if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getEquipment(p, true), p, ItemSet.DAWNTRACKER,6)) { - lifestealpct+=0.25d*ItemSet.GetTier(p.getEquipment().getItemInMainHand()); + if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.DAWNTRACKER,6)) { + lifestealpct+=0.25d*ItemSet.GetItemTier(p.getEquipment().getItemInMainHand()); } if (reason!=null && reason.equalsIgnoreCase("sweep up")) { lifestealpct*=2; @@ -3208,9 +3207,9 @@ public class CustomDamage { */ public static double calculateCooldownReduction(Player p) { double cooldown = 0.0; - cooldown=addMultiplicativeValue(cooldown,ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getBaubles(p), p, ItemSet.GLADOMAIN, 2, 2)/100d); - cooldown=addMultiplicativeValue(cooldown,ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.VIXEN)/100d); - if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.LORASYS, 1) && ItemSet.GetBaubleTier(p)>=40 && ItemSet.GetTier(p.getEquipment().getItemInMainHand())>=4) { + cooldown=addMultiplicativeValue(cooldown,ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.GLADOMAIN, 2, 2)/100d); + cooldown=addMultiplicativeValue(cooldown,ItemSet.GetTotalBaseAmount(p, ItemSet.VIXEN)/100d); + if (ItemSet.meetsLorasysSwordConditions(40, 4, p)) { cooldown = addMultiplicativeValue(cooldown,0.45d); } return cooldown; @@ -3228,7 +3227,7 @@ public class CustomDamage { removechance=addMultiplicativeValue(removechance,resistamt); } } - removechance=addMultiplicativeValue(removechance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p,true), p, ItemSet.DAWNTRACKER, 2, 2)/100d); + removechance=addMultiplicativeValue(removechance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DAWNTRACKER, 2, 2)/100d); return removechance*100d; } @@ -3293,7 +3292,7 @@ public class CustomDamage { double mult = 0.0; LivingEntity shooter = getDamagerEntity(damager); if (shooter instanceof Player) { - mult += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getBaubles(shooter), (Player)shooter, ItemSet.MOONSHADOW, 3, 3)/100; + mult += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.MOONSHADOW, 3, 3)/100; } return mult; } @@ -3318,7 +3317,7 @@ public class CustomDamage { } public static int GetDamageReductionFromDawntrackerPieces(Player p) { - return (ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p,true), p, ItemSet.DAWNTRACKER))/3; + return (ItemSet.GetTotalBaseAmount(p, ItemSet.DAWNTRACKER))/3; } private static double increaseDamageDealtByFireTicks(Player p, double damage, String reason) { diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java index 83d352d..5f92426 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java @@ -525,7 +525,7 @@ public class GenericFunctions { type.getType()!=Material.AIR) { if (type.hasItemMeta() && type.getItemMeta().hasDisplayName()) { - return type.getItemMeta().getDisplayName()+((ItemSet.isSetItem(type) && displayTier)?" (T"+ItemSet.GetTier(type)+")":""); + return type.getItemMeta().getDisplayName()+((ItemSet.isSetItem(type) && displayTier)?" (T"+ItemSet.GetItemTier(type)+")":""); } switch (type.getType()) { case ACACIA_DOOR_ITEM:{ @@ -2603,10 +2603,10 @@ public class GenericFunctions { } public static boolean HasFullRangerSet(Player p) { - return ItemSet.hasFullSet(GenericFunctions.getEquipment(p), p, ItemSet.ALIKAHN) || - ItemSet.hasFullSet(GenericFunctions.getEquipment(p), p, ItemSet.DARNYS) || - ItemSet.hasFullSet(GenericFunctions.getEquipment(p), p, ItemSet.JAMDAK) || - ItemSet.hasFullSet(GenericFunctions.getEquipment(p), p, ItemSet.LORASAADI); + return ItemSet.hasFullSet(p, ItemSet.ALIKAHN) || + ItemSet.hasFullSet(p, ItemSet.DARNYS) || + ItemSet.hasFullSet(p, ItemSet.JAMDAK) || + ItemSet.hasFullSet(p, ItemSet.LORASAADI); /*int rangerarmort1 = 0; //Count the number of each tier of sets. //LEGACY CODE. int rangerarmort2 = 0; int rangerarmort3 = 0; @@ -3317,8 +3317,8 @@ public class GenericFunctions { if (ItemSet.isSetItem(item)) { //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.GetSet(item); - int tier = ItemSet.GetTier(item); + ItemSet set = ItemSet.GetItemSet(item); + int tier = ItemSet.GetItemTier(item); item = UpdateSetLore(set,tier,item); } UpdateOldRangerPieces(item); @@ -3658,9 +3658,8 @@ public class GenericFunctions { pd.slayermodehp = p.getMaxHealth(); ItemStack[] equips = p.getEquipment().getArmorContents(); - ItemStack[] hotbar = GenericFunctions.getBaubles(p); - if (ItemSet.HasSetBonusBasedOnSetBonusCount(hotbar, p, ItemSet.GLADOMAIN, 5) && + if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.GLADOMAIN, 5) && pd.lastlifesavertime+GenericFunctions.GetModifiedCooldown(TwosideKeeper.LIFESAVER_COOLDOWN, p)<=TwosideKeeper.getServerTickTime()) { pd.lastlifesavertime=TwosideKeeper.getServerTickTime(); RevivePlayer(p,p.getMaxHealth()); @@ -3718,7 +3717,7 @@ public class GenericFunctions { Inventory inv = d.getInventory(); for (int i=0;i0) { TwosideKeeper.log("Applying "+swiftaegislv+" levels of Swift Aegis.",5); int resistancelv = 0; @@ -4493,7 +4492,7 @@ public class GenericFunctions { Bukkit.getPluginManager().callEvent(ev); if (!ev.isCancelled()) { PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); - boolean ex_version = ItemSet.hasFullSet(GenericFunctions.getEquipment(p), p, ItemSet.PANROS); + boolean ex_version = ItemSet.hasFullSet(p, ItemSet.PANROS); Vector facing = p.getLocation().getDirection(); if (!second_charge) { facing = p.getLocation().getDirection().setY(0); @@ -4585,16 +4584,16 @@ public class GenericFunctions { aPlugin.API.sendCooldownPacket(player, name, GetModifiedCooldown(TwosideKeeper.ASSASSINATE_COOLDOWN,player)); } pd.lastassassinatetime=TwosideKeeper.getServerTickTime(); - if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getBaubles(player), player, ItemSet.WOLFSBANE, 5)) { - GenericFunctions.addIFrame(player, (int)ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getBaubles(player), player, ItemSet.WOLFSBANE, 5, 4)); + if (ItemSet.HasSetBonusBasedOnSetBonusCount(player, ItemSet.WOLFSBANE, 5)) { + GenericFunctions.addIFrame(player, (int)ItemSet.TotalBaseAmountBasedOnSetBonusCount(player, ItemSet.WOLFSBANE, 5, 4)); } else { GenericFunctions.addIFrame(player, 10); } - if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getBaubles(player), player, ItemSet.WOLFSBANE, 3)) { + if (ItemSet.HasSetBonusBasedOnSetBonusCount(player, ItemSet.WOLFSBANE, 3)) { GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.SPEED, 100, 4, player); - GenericFunctions.addSuppressionTime(target, (int)ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getBaubles(player), player, ItemSet.WOLFSBANE, 3, 3)); + GenericFunctions.addSuppressionTime(target, (int)ItemSet.TotalBaseAmountBasedOnSetBonusCount(player, ItemSet.WOLFSBANE, 3, 3)); } - if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getBaubles(player), player, ItemSet.WOLFSBANE, 7) && + if (ItemSet.HasSetBonusBasedOnSetBonusCount(player, ItemSet.WOLFSBANE, 7) && target.getLocation().distanceSquared(originalloc)<=25) { pd.lastassassinatetime = TwosideKeeper.getServerTickTime()-GetModifiedCooldown(TwosideKeeper.ASSASSINATE_COOLDOWN,player)+40; if (name!=Material.SKULL_ITEM || pd.lastlifesavertime+GetModifiedCooldown(TwosideKeeper.LIFESAVER_COOLDOWN,player)=1 && - ItemSet.GetBaubleTier(p)>=27 && ItemSet.GetTier(p.getEquipment().getItemInMainHand())>=3) { + if (ItemSet.GetSetCount(ItemSet.LORASYS, p)>=1 && + ItemSet.GetBaubleTier(p)>=27 && ItemSet.GetItemTier(p.getEquipment().getItemInMainHand())>=3) { return; } else { if (!aPlugin.API.isAFK(p)) { diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java b/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java index a12ed2c..49c7899 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java @@ -7,15 +7,19 @@ import java.util.List; import java.util.Map; import org.bukkit.ChatColor; +import org.bukkit.Material; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import aPlugin.API; +import sig.plugin.TwosideKeeper.PlayerStructure; import sig.plugin.TwosideKeeper.TwosideKeeper; import sig.plugin.TwosideKeeper.HelperStructures.Common.BaublePouch; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; +import sig.plugin.TwosideKeeper.HelperStructures.Utils.DebugUtils; +import sig.plugin.TwosideKeeper.HelperStructures.Utils.TextUtils; public enum ItemSet { PANROS(1,1, 6,4, 10,10, 20,10), @@ -41,6 +45,7 @@ public enum ItemSet { RUDOLPH(5,5, 10,10, 2,1, 0,0), OLIVE(3,2, 10,10, 2,1, 0,0); + public static ItemSet[] bauble_sets; int baseval; int increase_val; int baseval_bonus2; @@ -101,10 +106,10 @@ public enum ItemSet { } public static boolean isSetItem(ItemStack item) { - return GetSet(item)!=null; + return GetItemSet(item)!=null; } - public static ItemSet GetSet(ItemStack item) { + public static ItemSet GetItemSet(ItemStack item) { if ((GenericFunctions.isEquip(item) || GenericFunctions.isSkullItem(item)) && !GenericFunctions.isArtifactEquip(item) && item.getItemMeta().hasLore()) { @@ -119,7 +124,7 @@ public enum ItemSet { return null; } - public static int GetTier(ItemStack item) { + public static int GetItemTier(ItemStack item) { if (isSetItem(item) && item.getItemMeta().hasLore()) { List lore = item.getItemMeta().getLore(); @@ -142,7 +147,7 @@ public enum ItemSet { for (int i=0;i tiermap = pd.itemsets.get(set.name()); + for (Integer tier : tiermap.keySet()) { + count += tiermap.get(tier); + } + } return count; } - public static int GetTierSetCount(ItemStack[] equips, ItemSet set, int tier, LivingEntity ent) { - int count = 0; + public static int GetTierSetCount(ItemSet set, int tier, Player p) { + /*int count = 0; for (ItemStack item : equips) { ItemSet temp = ItemSet.GetSet(item); if (temp!=null) { @@ -209,11 +224,21 @@ public enum ItemSet { } } TwosideKeeper.log("Currently have "+count+" pieces from the "+set.name()+" set of Tier +"+tier+".", 5); + return count;*/ + + PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); + int count = 0; + if (pd.itemsets.containsKey(set.name())) { + HashMap tiermap = pd.itemsets.get(set.name()); + if (tiermap.containsKey(tier)) { + count += tiermap.get(tier); + } + } return count; } - public static int GetTotalBaseAmount(ItemStack[] equips, LivingEntity ent, ItemSet set) { - int count = 0; + public static int GetTotalBaseAmount(Player p, ItemSet set) { + /*int count = 0; for (ItemStack item : equips) { ItemSet temp = ItemSet.GetSet(item); if (temp!=null) { @@ -223,12 +248,21 @@ public enum ItemSet { } } TwosideKeeper.log("Base Total of all equipment from this set is "+count, 5); - return count; + return count;*/ + PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); + int val = 0; + if (pd.itemsets.containsKey(set.name())) { + HashMap tiermap = pd.itemsets.get(set.name()); + for (Integer tier : tiermap.keySet()) { + val += set.GetBaseAmount(tier)*tiermap.get(tier); + } + } + return val; } - public static boolean hasFullSet(ItemStack[] equips, LivingEntity ent, ItemSet set) { + public static boolean hasFullSet(Player p, ItemSet set) { //Return a mapping of all tier values that meet the count requirement for that set. - for (ItemStack item : equips) { + /*for (ItemStack item : equips) { ItemSet temp = ItemSet.GetSet(item); if (temp!=null) { int tier = ItemSet.GetTier(item); @@ -239,12 +273,22 @@ public enum ItemSet { } } } + return false;*/ + PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); + if (pd.itemsets.containsKey(set.name()) && pd.itemsets.get(set.name()).size()==1) { //We can only possibly have a full set if we only have one tier of that set. + HashMap tiermap = pd.itemsets.get(set.name()); + for (Integer tier : tiermap.keySet()) { + if (tiermap.get(tier)>=5) { + return true; + } + } + } return false; } - public static List GetSetBonusCount(ItemStack[] equips, LivingEntity ent, ItemSet set, int count) { + /*public static List GetSetBonusCount(ItemStack[] equips, LivingEntity ent, ItemSet set, int count) { //Return a mapping of all tier values that meet the count requirement for that set. - List mapping = new ArrayList(); + /*List mapping = new ArrayList(); for (ItemStack item : equips) { ItemSet temp = ItemSet.GetSet(item); if (temp!=null) { @@ -257,19 +301,25 @@ public enum ItemSet { } } return mapping; - } + }*/ - public static boolean HasSetBonusBasedOnSetBonusCount(ItemStack[] equips, Player p, ItemSet set, int count) { - //Similar to HasFullSet, but lets you decide how many pieces to check for from that particular set and matching tiers. - return ItemSet.GetSetBonusCount(equips, p, set, count).size()>0; - } - - public static double TotalBaseAmountBasedOnSetBonusCount(ItemStack[] equips, Player p, ItemSet set, int count, int set_bonus) { - double amt = 0.0; + public static double TotalBaseAmountBasedOnSetBonusCount(Player p, ItemSet set, int count, int set_bonus) { + /*double amt = 0.0; List mapping = ItemSet.GetSetBonusCount(equips, p, set, count); for (Integer tier : mapping) { amt+=ItemSet.GetBaseAmount(set, tier, set_bonus); } + return amt;*/ + double amt = 0.0; + PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); + if (pd.itemsets.containsKey(set.name())) { + HashMap tiermap = pd.itemsets.get(set.name()); + for (Integer tier : tiermap.keySet()) { + if (tiermap.get(tier)>=count) { + amt+=ItemSet.GetBaseAmount(set, tier, set_bonus); + } + } + } return amt; } @@ -685,7 +735,7 @@ public enum ItemSet { for (int i=0;i contents = BaublePouch.getBaublePouchContents(id); + /*List contents = BaublePouch.getBaublePouchContents(id); for (ItemStack item : contents) { tier += ItemSet.GetTier(item); + }*/ + PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); + for (ItemSet set : bauble_sets) { + TwosideKeeper.log("Checking for set "+set.name(), 5); + if (pd.itemsets.containsKey(set.name())) { + tier+=GetTotalBaubleTier(pd.itemsets,set.name()); + } } } return tier; } + + private static int GetTotalBaubleTier(HashMap> itemsets, String name) { + if (itemsets.containsKey(name)) { + //TwosideKeeper.log("Found key "+name, 0); + HashMap tiermap = itemsets.get(name); + int tiers = 0; + for (Integer tier : tiermap.keySet()) { + tiers += tier*tiermap.get(tier); + TwosideKeeper.log("Tiers increased by: "+(tier*tiermap.get(tier))+". Total: "+tiers, 5); + } + return tiers; + } + TwosideKeeper.log("Set does not exist in map! Could not get tier! THIS SHOULD NOT BE HAPPENING!!", 0); + DebugUtils.showStackTrace(); + return -1; + } + + public static void updateItemSets(Player p) { + PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); + HashMap> map = pd.itemsets; + map.clear(); + for (ItemStack item : GenericFunctions.getEquipment(p, true)) { + if (isSetItem(item) && item.getType()!=Material.SKULL_ITEM) { + ItemSet set = GetItemSet(item); + Integer tier = GetItemTier(item); + insertSetIntoMap(map,set,tier); + } else + if (p.getInventory().getExtraContents()[0]!=null && p.getInventory().getExtraContents()[0].equals(item) && BaublePouch.isBaublePouch(item)) { + List contents = BaublePouch.getBaublePouchContents(BaublePouch.getBaublePouchID(item)); + for (ItemStack it : contents) { + if (isSetItem(it)) { + ItemSet set = GetItemSet(it); + Integer tier = GetItemTier(it); + insertSetIntoMap(map,set,tier); + } + } + } + TwosideKeeper.log("Offhand: "+p.getInventory().getExtraContents()[0]+";;"+item+ChatColor.RESET+"Is equal? "+p.getInventory().getExtraContents()[0].equals(item)+";; Is Bauble Pouch? "+BaublePouch.isBaublePouch(item), 5); + } + TwosideKeeper.log("Updated HashMap for player "+p.getName()+". New Map: \n"+TextUtils.outputHashmap(map), 5); + } + + private static void insertSetIntoMap(HashMap> map, ItemSet set, Integer tier) { + String keystring = set.name(); + if (map.containsKey(keystring)) { + HashMap innermap = map.get(keystring); + if (innermap.containsKey(tier)) { + innermap.put(tier, innermap.get(tier)+1); + } else { + innermap.put(tier, 1); + } + //map.put(keystring, innermap); + } else { + HashMap innermap = new HashMap(); + innermap.put(tier, 1); + map.put(keystring, innermap); + //map.put(keystring, 1); + } + } + + public static boolean HasSetBonusBasedOnSetBonusCount(Player player, ItemSet set, int count) { + PlayerStructure pd = PlayerStructure.GetPlayerStructure(player); + if (pd.itemsets.containsKey(set.name())) { + HashMap tiermap = pd.itemsets.get(set.name()); + for (Integer tier : tiermap.keySet()) { + if (tiermap.get(tier)>=count) { + return true; + } + } + } + return false; + } + + public static boolean meetsLorasysSwordConditions(int baubletier, int swordtier, Player p) { + //TwosideKeeper.log("["+baubletier+"||"+swordtier+"] Is a Lorasys Set? "+ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.LORASYS, 1)+";;Bauble Tier: "+(ItemSet.GetBaubleTier(p))+"/"+baubletier+";;Meets Sword Requirement? "+((swordtier==1 || ItemSet.GetItemTier(p.getEquipment().getItemInMainHand())>=swordtier)), 0); + return ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.LORASYS, 1) && ItemSet.GetBaubleTier(p)>=baubletier && (swordtier==1 || ItemSet.GetItemTier(p.getEquipment().getItemInMainHand())>=swordtier); + } + + /** + * Purely for API support. DO NOT USE OTHERWISE!! + */ + public static ItemSet GetSet(ItemStack item) { + return GetItemSet(item); + } + + /** + * Purely for API support. DO NOT USE OTHERWISE!! + */ + public static int GetTier(ItemStack item) { + return GetItemTier(item); + } } diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/StringConverter.java b/src/sig/plugin/TwosideKeeper/HelperStructures/StringConverter.java index d29f059..48d0e89 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/StringConverter.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/StringConverter.java @@ -20,7 +20,7 @@ public class StringConverter { return EntityType.valueOf(val); } case "Color":{ - return Color.(val); + //return Color.(val); } default:{ TwosideKeeper.log("WARNING! Could not convert String to Object class type "+c.getSimpleName(), 1); diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/TextUtils.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/TextUtils.java index 2c6bef0..1aae1ed 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/TextUtils.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/TextUtils.java @@ -2,6 +2,7 @@ package sig.plugin.TwosideKeeper.HelperStructures.Utils; import java.util.HashMap; import java.util.List; +import java.util.Map; import org.bukkit.ChatColor; @@ -63,6 +64,17 @@ public class TextUtils { builder.append("\n "+obj.toString()); } } + } else + if (val instanceof Map) { + builder.append("\n"); + boolean first=true; + for (Object obj : ((Map) val).keySet()) { + if (first) { + builder.append(" "+obj.toString()+": "+((Map) val).get(obj).toString()); + } else { + builder.append("\n "+obj.toString()+": "+((Map) val).get(obj).toString()); + } + } } else { builder.append(val.toString()); } diff --git a/src/sig/plugin/TwosideKeeper/PlayerStructure.java b/src/sig/plugin/TwosideKeeper/PlayerStructure.java index a4f2554..f0028dd 100644 --- a/src/sig/plugin/TwosideKeeper/PlayerStructure.java +++ b/src/sig/plugin/TwosideKeeper/PlayerStructure.java @@ -207,6 +207,7 @@ public class PlayerStructure { public HashMap> filtercubestructure = new HashMap>(); public List ignoreItemsList = new ArrayList(); public HashMap buffs = new HashMap(); + public HashMap> itemsets = new HashMap>(); //HashMap<"Set Name",HashMap<"Tier","Amt">> //Needs the instance of the player object to get all other info. Only to be called at the beginning. @SuppressWarnings("deprecation") @@ -311,24 +312,24 @@ public class PlayerStructure { //Joined always gets set to new time. this.joined = serverTickTime; - setDefaultCooldowns(p); } } - private void setDefaultCooldowns(Player p) { - aPlugin.API.sendCooldownPacket(p, Material.BOW, GenericFunctions.GetRemainingCooldownTime(p, last_dodge, TwosideKeeper.DODGE_COOLDOWN)); - applyCooldownToAllTypes(p,"HOE",GenericFunctions.GetRemainingCooldownTime(p, last_deathmark, TwosideKeeper.DEATHMARK_COOLDOWN)); - applyCooldownToAllTypes(p,"SPADE",GenericFunctions.GetRemainingCooldownTime(p, lastusedearthwave, TwosideKeeper.EARTHWAVE_COOLDOWN)); - applyCooldownToAllTypes(p,"SWORD",GenericFunctions.GetRemainingCooldownTime(p, last_strikerspell, TwosideKeeper.LINEDRIVE_COOLDOWN)); - aPlugin.API.sendCooldownPacket(p, Material.SHIELD, GenericFunctions.GetRemainingCooldownTime(p, last_rejuvenate, TwosideKeeper.REJUVENATE_COOLDOWN)); - aPlugin.API.sendCooldownPacket(p, Material.SKULL_ITEM, GenericFunctions.GetRemainingCooldownTime(p, lastlifesavertime, TwosideKeeper.LIFESAVER_COOLDOWN)); - aPlugin.API.sendCooldownPacket(p, Material.CHORUS_FLOWER, GenericFunctions.GetRemainingCooldownTime(p, lastlifesavertime, TwosideKeeper.LIFESAVER_COOLDOWN)); - aPlugin.API.sendCooldownPacket(p, Material.WATCH, GenericFunctions.GetRemainingCooldownTime(p, icewandused, TwosideKeeper.ICEWAND_COOLDOWN)); - aPlugin.API.sendCooldownPacket(p, Material.RAW_FISH, GenericFunctions.GetRemainingCooldownTime(p, lastcandyconsumed, 40)); - aPlugin.API.sendCooldownPacket(p, Material.GOLDEN_APPLE, GenericFunctions.GetRemainingCooldownTime(p, lastrevivecandyconsumed, 200)); + public static void setDefaultCooldowns(Player p) { + PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); + aPlugin.API.sendCooldownPacket(p, Material.BOW, GenericFunctions.GetRemainingCooldownTime(p, pd.last_dodge, TwosideKeeper.DODGE_COOLDOWN)); + applyCooldownToAllTypes(p,"HOE",GenericFunctions.GetRemainingCooldownTime(p, pd.last_deathmark, TwosideKeeper.DEATHMARK_COOLDOWN)); + applyCooldownToAllTypes(p,"SPADE",GenericFunctions.GetRemainingCooldownTime(p, pd.lastusedearthwave, TwosideKeeper.EARTHWAVE_COOLDOWN)); + applyCooldownToAllTypes(p,"SWORD",GenericFunctions.GetRemainingCooldownTime(p, pd.last_strikerspell, TwosideKeeper.LINEDRIVE_COOLDOWN)); + aPlugin.API.sendCooldownPacket(p, Material.SHIELD, GenericFunctions.GetRemainingCooldownTime(p, pd.last_rejuvenate, TwosideKeeper.REJUVENATE_COOLDOWN)); + aPlugin.API.sendCooldownPacket(p, Material.SKULL_ITEM, GenericFunctions.GetRemainingCooldownTime(p, pd.lastlifesavertime, TwosideKeeper.LIFESAVER_COOLDOWN)); + aPlugin.API.sendCooldownPacket(p, Material.CHORUS_FLOWER, GenericFunctions.GetRemainingCooldownTime(p, pd.lastlifesavertime, TwosideKeeper.LIFESAVER_COOLDOWN)); + 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)); } - private void applyCooldownToAllTypes(Player p, String item, int cooldown) { + private static void applyCooldownToAllTypes(Player p, String item, int cooldown) { aPlugin.API.sendCooldownPacket(p, Material.valueOf("WOOD_"+item), cooldown); aPlugin.API.sendCooldownPacket(p, Material.valueOf("IRON_"+item), cooldown); aPlugin.API.sendCooldownPacket(p, Material.valueOf("STONE_"+item), cooldown); diff --git a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java index 382672c..3dcfc15 100644 --- a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java +++ b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java @@ -670,7 +670,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { private final class ReapplyAbsorptionHeartsFromSet implements Runnable { public void run(){ for (Player p : Bukkit.getOnlinePlayers()) { - double absorption_amt = ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.SONGSTEEL, 3, 3)-4; + double absorption_amt = ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.SONGSTEEL, 3, 3)-4; if (absorption_amt>0) { if (p.hasPotionEffect(PotionEffectType.ABSORPTION)) { int oldlv = GenericFunctions.getPotionEffectLevel(PotionEffectType.ABSORPTION, p); @@ -926,13 +926,13 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } } } - totalregen += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.ALIKAHN, 4, 4)/2; + totalregen += ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.ALIKAHN, 4, 4)/2; if (p.hasPotionEffect(PotionEffectType.REGENERATION)) { totalregen += (GenericFunctions.getPotionEffectLevel(PotionEffectType.REGENERATION, p)+1)*baseregen; } totalregen += (totalregen+baseregen)*pd.pctbonusregen; - if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getEquipment(p, true), p, ItemSet.DAWNTRACKER,6)) { - totalregen += (totalregen+baseregen) * (0.25d*ItemSet.GetTier(p.getEquipment().getItemInMainHand())); + if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.DAWNTRACKER,6)) { + totalregen += (totalregen+baseregen) * (0.25d*ItemSet.GetItemTier(p.getEquipment().getItemInMainHand())); } return totalregen+baseregen; } @@ -1054,6 +1054,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener { validsetitems.add(Material.GOLD_SWORD); validsetitems.add(Material.SKULL_ITEM); + ItemSet.bauble_sets = new ItemSet[]{ItemSet.MOONSHADOW,ItemSet.GLADOMAIN,ItemSet.WOLFSBANE,ItemSet.ALUSTINE}; + TEMPORARYABILITIES.add(ArtifactAbility.GREED); TEMPORARYABILITIES.add(ArtifactAbility.SURVIVOR); @@ -1420,6 +1422,14 @@ public class TwosideKeeper extends JavaPlugin implements Listener { if (args.length>0) { ((org.bukkit.craftbukkit.v1_9_R1.entity.CraftLivingEntity)p).getHandle().setAbsorptionHearts(Float.valueOf(args[0])); }*/ + Set set = null; + long timer = System.nanoTime(); + /*TwosideKeeper.log("Target block is "+p.getTargetBlock(set, 100)+" Time: "+((System.nanoTime()-(timer))/1000000)+"ms", 0);timer=System.nanoTime(); + TwosideKeeper.log("Line of sight is:", 0); + for (Block b : p.getLineOfSight(set,100)) { + TwosideKeeper.log(" "+b, 0); + } + TwosideKeeper.log("Time: "+((System.nanoTime()-(timer))/1000000)+"ms", 0);*/ if (args.length>0) { switch (args[0]) { case "ADD":{ @@ -2587,6 +2597,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener { AnnounceDealOfTheDay(ev.getPlayer()); playerdata.put(ev.getPlayer().getUniqueId(), new PlayerStructure(ev.getPlayer(),getServerTickTime())); + PlayerStructure.setDefaultCooldowns(ev.getPlayer()); + ItemSet.updateItemSets(ev.getPlayer()); log("[TASK] New Player Data has been added. Size of array: "+playerdata.size(),4); PLAYERJOINTOGGLE=true; @@ -3218,7 +3230,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } } } - if (p.getHealth()>p.getMaxHealth()*0.1 && ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getArmor(p), p, ItemSet.COMET, 4)) { + if (p.getHealth()>p.getMaxHealth()*0.1 && ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.COMET, 4)) { if (ev.getRightClicked() instanceof Player) { Player pl = (Player)ev.getRightClicked(); if (pl.getHealth()0 && - ItemSet.GetBaubleTier((Player)ev.getEntity())>=18 && ItemSet.GetTier(((Player)ev.getEntity()).getEquipment().getItemInMainHand())>=2) { + ItemSet.meetsLorasysSwordConditions(18, 2, (Player)ev.getEntity())) { dmgdealt=0.0; } } @@ -6408,7 +6422,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { if (CustomDamage.getDamagerEntity(ev.getDamager()) instanceof Player) { Player p = (Player)CustomDamage.getDamagerEntity(ev.getDamager()); PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); - if (PlayerMode.isDefender(p) && p.isSneaking() && ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.SONGSTEEL,5) && pd.vendetta_amt>0.0) { //Deal Vendetta damage instead. + if (PlayerMode.isDefender(p) && p.isSneaking() && ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.SONGSTEEL,5) && pd.vendetta_amt>0.0) { //Deal Vendetta damage instead. SoundUtils.playLocalSound(p, Sound.BLOCK_GLASS_BREAK, 1.0f, 0.5f); GenericFunctions.removeNoDamageTick((LivingEntity)ev.getEntity(), ev.getDamager()); CustomDamage.ApplyDamage(pd.vendetta_amt, ev.getDamager(), (LivingEntity)ev.getEntity(), null, "Vendetta"); @@ -6648,10 +6662,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener { if (amt>500) { testamt=500; } - ev.setAmount((int)(ev.getAmount()+(ev.getAmount()*(ItemSet.GetTotalBaseAmount(GenericFunctions.getBaubles(ev.getPlayer()), ev.getPlayer(), ItemSet.ALUSTINE)/100d)))); + ev.setAmount((int)(ev.getAmount()+(ev.getAmount()*(ItemSet.GetTotalBaseAmount(ev.getPlayer(), ItemSet.ALUSTINE)/100d)))); - if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getBaubles(p), p, ItemSet.ALUSTINE, 5)) { - if (Math.random()<=Math.min((ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getBaubles(p), p, ItemSet.ALUSTINE, 5, 4)/20d),1)) { + if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.ALUSTINE, 5)) { + if (Math.random()<=Math.min((ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.ALUSTINE, 5, 4)/20d),1)) { PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); if (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER) { if (pd.slayermodehp+2 mobs = GenericFunctions.getNearbyMobs(m.getLocation(), 8); List mobs = CustomDamage.trimNonMonsterEntities(m.getNearbyEntities(8, 8, 8)); @@ -7046,13 +7060,13 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } else { GenericFunctions.addStackingPotionEffect(p, PotionEffectType.INCREASE_DAMAGE, 10*20, 9); } - if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getBaubles(p), p, ItemSet.GLADOMAIN, 7)) { + if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.GLADOMAIN, 7)) { pd.slayermegahit=true; } GenericFunctions.applyStealth(p, false); } else { //Failed Assassination. - if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getBaubles(p), p, ItemSet.WOLFSBANE, 2)) { - pd.lastassassinatetime-=GenericFunctions.GetModifiedCooldown(TwosideKeeper.ASSASSINATE_COOLDOWN,p)*(ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getBaubles(p), p, ItemSet.WOLFSBANE, 2, 2)/100d); + if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.WOLFSBANE, 2)) { + pd.lastassassinatetime-=GenericFunctions.GetModifiedCooldown(TwosideKeeper.ASSASSINATE_COOLDOWN,p)*(ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.WOLFSBANE, 2, 2)/100d); ItemStack[] inv = p.getInventory().getContents(); for (int i=0;i<9;i++) { if (inv[i]!=null && (inv[i].getType()!=Material.SKULL_ITEM || pd.lastlifesavertime+GenericFunctions.GetModifiedCooldown(TwosideKeeper.LIFESAVER_COOLDOWN,p)0) { - if (ItemSet.GetBaubleTier(p)>=18 && ItemSet.GetTier((p).getEquipment().getItemInMainHand())>=2) { - restore_amt = 4; - } else - if (ItemSet.GetBaubleTier(p)>=27 && ItemSet.GetTier((p).getEquipment().getItemInMainHand())>=3) { - restore_amt = 6; - } + if (ItemSet.meetsLorasysSwordConditions(18, 2, p)) { + restore_amt = 4; + } else + if (ItemSet.meetsLorasysSwordConditions(27, 3, p)) { + restore_amt = 6; } if (pd.slayermodehp+restore_amt Gladomain Set Increase", (int)(System.nanoTime()-time));time = System.nanoTime(); log("Health is now "+hp,5); if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand())) { @@ -9601,9 +9596,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener { TwosideKeeper.HeartbeatLogger.AddEntry("----====]> Barbarian HP Calculation", (int)(System.nanoTime()-time));time = System.nanoTime(); - hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p,true), p, ItemSet.DAWNTRACKER, 4, 4); + hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DAWNTRACKER, 4, 4); TwosideKeeper.HeartbeatLogger.AddEntry("----====]> Dawntracker HP Calculation", (int)(System.nanoTime()-time));time = System.nanoTime(); - hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.SONGSTEEL, 2, 2); + hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.SONGSTEEL, 2, 2); TwosideKeeper.HeartbeatLogger.AddEntry("----====]> Songsteel HP Calculation", (int)(System.nanoTime()-time));time = System.nanoTime(); /* @@ -9615,35 +9610,35 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } } }*/ - hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.ALIKAHN, 2, 2)+ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.ALIKAHN, 3, 3); + hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.ALIKAHN, 2, 2)+ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.ALIKAHN, 3, 3); TwosideKeeper.HeartbeatLogger.AddEntry("----====]> Alikahn HP Calculation", (int)(System.nanoTime()-time));time = System.nanoTime(); - hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.COMET, 2, 2); + hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.COMET, 2, 2); TwosideKeeper.HeartbeatLogger.AddEntry("----====]> Comet HP Calculation", (int)(System.nanoTime()-time));time = System.nanoTime(); - hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.CUPID, 2, 2); + hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.CUPID, 2, 2); TwosideKeeper.HeartbeatLogger.AddEntry("----====]> Cupid HP Calculation", (int)(System.nanoTime()-time));time = System.nanoTime(); - hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.DONNER, 2, 2); + hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DONNER, 2, 2); TwosideKeeper.HeartbeatLogger.AddEntry("----====]> Donner HP Calculation", (int)(System.nanoTime()-time));time = System.nanoTime(); - hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.RUDOLPH, 2, 2); + hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.RUDOLPH, 2, 2); TwosideKeeper.HeartbeatLogger.AddEntry("----====]> Rudolph HP Calculation", (int)(System.nanoTime()-time));time = System.nanoTime(); - hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.OLIVE, 2, 2); + hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.OLIVE, 2, 2); TwosideKeeper.HeartbeatLogger.AddEntry("----====]> Olive HP Calculation", (int)(System.nanoTime()-time));time = System.nanoTime(); - hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.DASHER, 3, 3); + hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DASHER, 3, 3); TwosideKeeper.HeartbeatLogger.AddEntry("----====]> Dasher HP Calculation", (int)(System.nanoTime()-time));time = System.nanoTime(); - hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.DANCER, 3, 3); + hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DANCER, 3, 3); TwosideKeeper.HeartbeatLogger.AddEntry("----====]> Dancer HP Calculation", (int)(System.nanoTime()-time));time = System.nanoTime(); - hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.PRANCER, 3, 3); + hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.PRANCER, 3, 3); TwosideKeeper.HeartbeatLogger.AddEntry("----====]> Prancer HP Calculation", (int)(System.nanoTime()-time));time = System.nanoTime(); - hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.VIXEN, 3, 3); + hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.VIXEN, 3, 3); TwosideKeeper.HeartbeatLogger.AddEntry("----====]> Vixen HP Calculation", (int)(System.nanoTime()-time));time = System.nanoTime(); - hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.BLITZEN, 3, 3); + hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.BLITZEN, 3, 3); TwosideKeeper.HeartbeatLogger.AddEntry("----====]> Blitzen HP Calculation", (int)(System.nanoTime()-time));time = System.nanoTime(); /*hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.ALIKAHN, 4, 4)+ ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DARNYS, 4, 4)+ ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.LORASAADI, 4, 4)+ ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.JAMDAK, 4, 4);*/ - if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getEquipment(p, true), p, ItemSet.DAWNTRACKER,6)) { - hp+=0.25d*ItemSet.GetTier(p.getEquipment().getItemInMainHand()); + if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.DAWNTRACKER,6)) { + hp+=0.25d*ItemSet.GetItemTier(p.getEquipment().getItemInMainHand()); } if (PlayerMode.getPlayerMode(p)==PlayerMode.NORMAL) { @@ -10091,7 +10086,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { if (PlayerMode.isDefender(p)) { double dodgechance=0.0; if (!p.isBlocking()) { - dodgechance+=ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.SONGSTEEL)/100d; + dodgechance+=ItemSet.GetTotalBaseAmount(p, ItemSet.SONGSTEEL)/100d; } if (all || dodgechance>0) { receiver.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Block Chance: "+ChatColor.RESET+""+ChatColor.DARK_AQUA+df.format((CustomDamage.CalculateDodgeChance(p)+dodgechance)*100)+"%"); diff --git a/src/sig/plugin/TwosideKeeper/runServerHeartbeat.java b/src/sig/plugin/TwosideKeeper/runServerHeartbeat.java index 60b09c3..ac8833b 100644 --- a/src/sig/plugin/TwosideKeeper/runServerHeartbeat.java +++ b/src/sig/plugin/TwosideKeeper/runServerHeartbeat.java @@ -516,8 +516,8 @@ final class runServerHeartbeat implements Runnable { } private void ModifyDasherSetSpeedMultiplier(Player p) { - if (ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.DASHER)>0) { - double spdmult = ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.DASHER)/100d; + if (ItemSet.GetTotalBaseAmount(p, ItemSet.DASHER)>0) { + double spdmult = ItemSet.GetTotalBaseAmount(p, ItemSet.DASHER)/100d; aPlugin.API.setPlayerSpeedMultiplier(p, (float)(1.0f+spdmult)); } } @@ -599,13 +599,13 @@ final class runServerHeartbeat implements Runnable { private void DasherFoodRegenPerk(Player p) { if (p.isSprinting() && p.getFoodLevel()<20 - && ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getArmor(p), p, ItemSet.DASHER, 4)) { + && ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.DASHER, 4)) { p.setFoodLevel(p.getFoodLevel()+1); } } private void GivePartyNightVision(Player p) { - if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getArmor(p), p, ItemSet.RUDOLPH, 4)) { + if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.RUDOLPH, 4)) { if (!p.hasPotionEffect(PotionEffectType.NIGHT_VISION)) { GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.NIGHT_VISION, Integer.MAX_VALUE, 1, p, true); } @@ -619,7 +619,7 @@ final class runServerHeartbeat implements Runnable { } private void ApplyCometRegenBonus(Player p) { - double regenbuff = ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.COMET); + double regenbuff = ItemSet.GetTotalBaseAmount(p, ItemSet.COMET); if (regenbuff>0) { List partymembers = PartyManager.getPartyMembers(p); for (Player pl : partymembers) { @@ -634,7 +634,7 @@ final class runServerHeartbeat implements Runnable { if (PlayerMode.isSlayer(p)) { if (pd.lastsneak+50<=serverTickTime && p.isSneaking() && - ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getBaubles(p), p, ItemSet.MOONSHADOW, 7)) { + ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.MOONSHADOW, 7)) { GenericFunctions.deAggroNearbyTargets(p); GenericFunctions.applyStealth(p, true); }