diff --git a/TwosideKeeper.jar b/TwosideKeeper.jar index 4f9df1c..c8f6bde 100644 Binary files a/TwosideKeeper.jar and b/TwosideKeeper.jar differ diff --git a/src/sig/plugin/TwosideKeeper/AwakenedArtifact.java b/src/sig/plugin/TwosideKeeper/AwakenedArtifact.java index eb584c1..1f5ca9f 100644 --- a/src/sig/plugin/TwosideKeeper/AwakenedArtifact.java +++ b/src/sig/plugin/TwosideKeeper/AwakenedArtifact.java @@ -98,7 +98,7 @@ public class AwakenedArtifact { item = setEXP(item,totalval%1000); item = addAP(item,totalval/1000); double potentialred = 0.1d * getPotential(item); //5 - potentialred *= 1d - (5d+GenericFunctions.getAbilityValue(ArtifactAbility.PRESERVATION, artifact))/100d; + potentialred *= 1d - (5d+GenericFunctions.getAbilityValue(ArtifactAbility.PRESERVATION, artifact,p))/100d; TwosideKeeper.log("Potential is reduced by "+(potentialred)+"% from "+getPotential(item), 0); if (getPotential(item)>potentialred) { item = setPotential(item,(int)(getPotential(item)-potentialred)); diff --git a/src/sig/plugin/TwosideKeeper/Buff.java b/src/sig/plugin/TwosideKeeper/Buff.java index a11b38b..fccc88a 100644 --- a/src/sig/plugin/TwosideKeeper/Buff.java +++ b/src/sig/plugin/TwosideKeeper/Buff.java @@ -232,6 +232,9 @@ public class Buff { oldlv = pd.buffs.get(name).getAmplifier(); oldduration = pd.buffs.get(name).getRemainingBuffTime(); if (stacking) { + if (PVP.isPvPing(p)) { + oldlv=1; + } buff.setStacks(buff.getAmplifier()+oldlv); pd.buffs.put(name, buff); return; diff --git a/src/sig/plugin/TwosideKeeper/CustomDamage.java b/src/sig/plugin/TwosideKeeper/CustomDamage.java index 5a3b44c..c5e5650 100644 --- a/src/sig/plugin/TwosideKeeper/CustomDamage.java +++ b/src/sig/plugin/TwosideKeeper/CustomDamage.java @@ -182,6 +182,7 @@ public class CustomDamage { dmg = CalculateDamage(damage, damager, target, weapon, reason, flags); } dmg += CalculateBonusTrueDamage(damager, target, dmg); + dmg += CalculatePVPDamageReduction(damager,target,dmg); if (damager!=null) { TwosideKeeper.logHealth(target,target.getHealth(),dmg,damager); } @@ -193,6 +194,12 @@ public class CustomDamage { setupDamagePropertiesForPlayer(damager,((reason!=null && reason.equalsIgnoreCase("thorns"))?IS_THORNS:0)); if (!ev.isCancelled()) { //TwosideKeeper.log("Inside of here.", 0); + LivingEntity shooter = getDamagerEntity(damager); + if (shooter instanceof Player && target instanceof Player) { + PlayerStructure pd = PlayerStructure.GetPlayerStructure((Player)target); + pd.lastplayerHitBy=((Player)shooter).getName(); + TwosideKeeper.log("Set last hit by to "+pd.lastplayerHitBy+" for player "+((Player)target).getName(), 2); + } DealDamageToEntity(dmg, damager, target, weapon, reason, flags); addToLoggerTotal(damager,dmg); TwosideKeeper.HeartbeatLogger.AddEntry("Damage Calculations", (int)(System.nanoTime()-time));time=System.nanoTime(); @@ -205,6 +212,20 @@ public class CustomDamage { } } + private static double CalculatePVPDamageReduction(Entity damager, LivingEntity target, double dmg) { + double dmgIncrease=0; + LivingEntity shooter = getDamagerEntity(damager); + if (shooter!=null && shooter instanceof Player) { + Player p = (Player)shooter; + if (PVP.isPvPing(p)) { + dmgIncrease = -(dmg*0.6); + //TwosideKeeper.log("Damage reduced due to PvP from "+dmg+" to "+(dmg+dmgIncrease), 2); + return dmgIncrease; //Reduce damage by 60% in PVP. + } + } + return dmgIncrease; + } + private static void UpdateWeaponUsedForShooting(Entity damager) { if (getDamagerEntity(damager) instanceof Player) { PlayerStructure pd = PlayerStructure.GetPlayerStructure((Player)(getDamagerEntity(damager))); @@ -220,6 +241,9 @@ public class CustomDamage { Player p = (Player)getDamagerEntity(damager); bonus_truedmg += API.getPlayerBonuses(p).getBonusTrueDamage(); bonus_truedmg += ItemSet.HasSetBonusBasedOnSetBonusCount((Player)shooter, ItemSet.ALUSTINE, 7)?((Player)shooter).getLevel():0; + if (PVP.isPvPing(p)) { + bonus_truedmg += target.getMaxHealth()*0.01; + } return bonus_truedmg; } else { double bonus_truedmg = 0; @@ -299,7 +323,9 @@ public class CustomDamage { } } } - dmg += addToPlayerLogger(damager,target,"Execute",(((GenericFunctions.getAbilityValue(ArtifactAbility.EXECUTION, weapon)*5.0)*(1-(target.getHealth()/target.getMaxHealth()))))); + if (shooter!=null && shooter instanceof Player) { + dmg += addToPlayerLogger(damager,target,"Execute",(((GenericFunctions.getAbilityValue(ArtifactAbility.EXECUTION, weapon, (Player)shooter)*5.0)*(1-(target.getHealth()/target.getMaxHealth()))))); + } dmg += addMultiplierToPlayerLogger(damager,target,"Challenge Base Damage Mult",calculateChallengeBaseDmgIncrease(shooter,target)); if (shooter instanceof Player) { dmg += addToPlayerLogger(damager,target,"Tactics Bonus Damage",API.getPlayerBonuses((Player)shooter).getBonusDamage()); @@ -568,7 +594,10 @@ public class CustomDamage { } } dmg += calculateEnchantmentDamageIncrease(weapon,damager,target); - dmg += addToPlayerLogger(damager,target,"Strike",GenericFunctions.getAbilityValue(ArtifactAbility.DAMAGE, weapon)); + LivingEntity shooter = getDamagerEntity(damager); + if (shooter!=null && shooter instanceof Player) { + dmg += addToPlayerLogger(damager,target,"Strike",GenericFunctions.getAbilityValue(ArtifactAbility.DAMAGE, weapon, (Player)shooter)); + } dmg += addToPlayerLogger(damager,target,"Highwinder",calculateHighwinderDamage(weapon,damager)); dmg += addToPlayerLogger(damager,target,"Dancer Speed Bonus",calculateDancerSpeedDamage(weapon,damager)); dmg += addToPlayerLogger(damager,target,"Set Bonus",calculateSetBonusDamage(damager)); @@ -585,9 +614,9 @@ public class CustomDamage { Player p = (Player)damager; PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); if (ItemSet.GetTotalBaseAmount(p, ItemSet.DANCER)>0) { - dmg += 93.182445*pd.velocity*ItemSet.GetTotalBaseAmount(p, ItemSet.DANCER); + dmg += Math.min(93.182445*pd.velocity*ItemSet.GetTotalBaseAmount(p, ItemSet.DANCER),10); pd.lasthighwinderhit=TwosideKeeper.getServerTickTime(); - GenericFunctions.sendActionBarMessage(p, TwosideKeeper.drawVelocityBar(pd.velocity,ItemSet.GetTotalBaseAmount(p, ItemSet.DANCER)),true); + GenericFunctions.sendActionBarMessage(p, TwosideKeeper.drawVelocityBar(pd.velocity,ItemSet.GetTotalBaseAmount(p, ItemSet.DANCER)/10d),true); } } return dmg; @@ -788,8 +817,8 @@ public class CustomDamage { } } damage=0; - } - + GenericFunctions.AttemptRevive(p, damager, damage, reason); + } else if (damage>0 && GenericFunctions.AttemptRevive(p, damager, damage, reason)) { damage=0; } @@ -823,7 +852,7 @@ public class CustomDamage { TwosideKeeper.log("In here", 5); //TwosideKeeper.log("Exploding Arrow", 0); Location hitloc = aPlugin.API.getArrowHitLocation(target, a); - GenericFunctions.DealExplosionDamageToEntities(hitloc, getBaseWeaponDamage(weapon,damager,target)+60, 6); + GenericFunctions.DealExplosionDamageToEntities(hitloc, getBaseWeaponDamage(weapon,damager,target)+60, 6, damager); SoundUtils.playGlobalSound(hitloc, Sound.ENTITY_ENDERDRAGON_FIREBALL_EXPLODE, 0.5f, 1.0f); aPlugin.API.sendSoundlessExplosion(hitloc, 2); } @@ -907,7 +936,7 @@ public class CustomDamage { if ((damager!=null && damager instanceof Arrow) || (weapon!=null && weapon.getType()!=Material.BOW)) { //TwosideKeeper.log("Entered here.", 0); removePermEnchantments(p,weapon); - applyShrapnel(damager,p,target); + applyShrapnel(damager,p,target,reason); applyDoTs(damager,p,target); } //GenericFunctions.knockOffGreed(p); @@ -1174,12 +1203,12 @@ public class CustomDamage { } } - private static void applyShrapnel(Entity damager, Player p, LivingEntity target) { - if (damager instanceof Projectile) { + private static void applyShrapnel(Entity damager, Player p, LivingEntity target, String reason) { + if (damager instanceof Projectile && (reason==null || !reason.equalsIgnoreCase("Shrapnel Explosion"))) { if (ItemSet.hasFullSet(p, ItemSet.SHARD)) { int shrapnellv = ItemSet.getHighestTierInSet(p, ItemSet.SHARD); Buff.addBuff(target, "SHRAPNEL", new Buff("Shrapnel",20*10,shrapnellv,Color.RED,ChatColor.RED+"❂",false), true); - GenericFunctions.DealExplosionDamageToEntities(target.getLocation(), 40f+target.getHealth()*0.1, 2, null, "Shrapnel Explosion"); + GenericFunctions.DealExplosionDamageToEntities(target.getLocation(), 40f+target.getHealth()*0.1, 2, damager, "Shrapnel Explosion"); aPlugin.API.sendSoundlessExplosion(target.getLocation(), 1); SoundUtils.playGlobalSound(target.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 0.6f, 0.5f); } @@ -1888,7 +1917,7 @@ public class CustomDamage { //double finaldmg = CalculateDamageReduction(GenericFunctions.getAbilityValue(ArtifactAbility.ERUPTION, p.getEquipment().getItemInMainHand()),mon,null); //GenericFunctions.DealDamageToMob(finaldmg, mon, p, p.getEquipment().getItemInMainHand()); TwosideKeeperAPI.removeNoDamageTick(p, (LivingEntity)mon); - CustomDamage.ApplyDamage(35+GenericFunctions.getAbilityValue(ArtifactAbility.ERUPTION, weapon), + CustomDamage.ApplyDamage(35+GenericFunctions.getAbilityValue(ArtifactAbility.ERUPTION, weapon, p), p,mon,null,"Eruption",CustomDamage.NONE); mon.addPotionEffect(new PotionEffect(PotionEffectType.LEVITATION,20,15)); //Attempt to dig out the blocks below. @@ -1963,7 +1992,7 @@ public class CustomDamage { //This is allowed, get the level on the weapon. setMonsterTarget(m,p); //TwosideKeeper.log("Aggro tick time: "+(int)(GenericFunctions.getAbilityValue(ArtifactAbility.PROVOKE, weapon)*20), 0); - setAggroGlowTickTime(m,(int)(GenericFunctions.getAbilityValue(ArtifactAbility.PROVOKE, weapon)*20)); + setAggroGlowTickTime(m,(int)(GenericFunctions.getAbilityValue(ArtifactAbility.PROVOKE, weapon, p)*20)); } } @@ -2058,6 +2087,13 @@ public class CustomDamage { } } } + } else { + if (SniperSkeleton.isSniperSkeleton(m) && !TwosideKeeper.custommonsters.containsKey(m.getUniqueId())) { + TwosideKeeper.custommonsters.put(m.getUniqueId(),new SniperSkeleton(m)); + } else + if (Knight.isKnight(m) && !TwosideKeeper.custommonsters.containsKey(m.getUniqueId())) { + TwosideKeeper.custommonsters.put(m.getUniqueId(),new Knight(m)); + } } if (addChallengeZombieToList(m)) {return;} @@ -2225,12 +2261,14 @@ public class CustomDamage { static List getAOEList(ItemStack weapon, LivingEntity target) { List list = new ArrayList(); - if (ArtifactAbility.containsEnchantment(ArtifactAbility.AOE, weapon)) { - double aoerange = 1+GenericFunctions.getAbilityValue(ArtifactAbility.AOE, weapon); - if (target!=null) { - List nearbylist=target.getNearbyEntities(aoerange,aoerange,aoerange); - list = trimNonLivingEntities(nearbylist); - //list.remove(target); + if (target instanceof Player) { + if (ArtifactAbility.containsEnchantment(ArtifactAbility.AOE, weapon)) { + double aoerange = 1+GenericFunctions.getAbilityValue(ArtifactAbility.AOE, weapon, (Player)target); + if (target!=null) { + List nearbylist=target.getNearbyEntities(aoerange,aoerange,aoerange); + list = trimNonLivingEntities(nearbylist); + //list.remove(target); + } } } list.add(target); @@ -2276,7 +2314,7 @@ public class CustomDamage { return true; //Cancel all damage events if they are dead. } LivingEntity shooter = getDamagerEntity(damager); - if (shooter!=null && shooter.isDead()) { + if ((shooter!=null && shooter.isDead()) || (target!=null && target.isDead())) { return true; } target.setLastDamage(0); @@ -2285,15 +2323,21 @@ public class CustomDamage { if (shooter instanceof Player && target instanceof Player) { //PvP Checks //!((Player)target).isOnline() //!damager.getWorld().getPVP() - Player attacker = (Player)damager; + Player attacker = (Player)shooter; Player defender = (Player)target; + if (attacker.getGameMode()==GameMode.SPECTATOR || + attacker.getGameMode()==GameMode.CREATIVE || + defender.getGameMode()==GameMode.SPECTATOR || + defender.getGameMode()==GameMode.CREATIVE) { + return true; + } if (attacker.getWorld().getPVP() && (!defender.isOnline() || PVP.isFriendly(attacker,defender) || !PVP.isPvPing(defender))) { if (PVP.isWaitingForPlayers(defender)) { PVP session = PVP.getMatch(defender); session.joinMatch(attacker); } else - if (weapon==null || (weapon.getType()==Material.AIR && weapon.isSimilar(attacker.getEquipment().getItemInMainHand()))) { + if (!PVP.isPvPing(defender) && (weapon==null || (weapon.getType()==Material.AIR && weapon.isSimilar(attacker.getEquipment().getItemInMainHand())))) { PlayerStructure pd = PlayerStructure.GetPlayerStructure(attacker); PlayerStructure pd2 = PlayerStructure.GetPlayerStructure(defender); if (pd.lastStartedPlayerClicks+200<=TwosideKeeper.getServerTickTime() && @@ -2453,7 +2497,7 @@ public class CustomDamage { double duration = 0.0; for (int i=0;i=0 && p.isOnGround() && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=7) { - double dmgreduce = 1d-(GenericFunctions.getAbilityValue(ArtifactAbility.SHADOWWALKER, p.getEquipment().getArmorContents()[i])/100d); + double dmgreduce = 1d-(GenericFunctions.getAbilityValue(ArtifactAbility.SHADOWWALKER, p.getEquipment().getArmorContents()[i], p)/100d); basedmg *= dmgreduce; TwosideKeeper.log("Base damage became "+(dmgreduce*100)+"% of original amount.",5); } @@ -2829,6 +2877,10 @@ public class CustomDamage { setbonus = ((100-ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.SONGSTEEL, 4, 4))/100d); playermodediv=(PlayerMode.getPlayerMode(p)==PlayerMode.NORMAL)?0.2d:0; + + if (PVP.isPvPing(p)) { + dodgechancemult=CalculateDodgeChance(p,damager)*0.25; + } } //Blocking: -((p.isBlocking())?ev.getDamage()*0.33:0) //33% damage will be reduced if we are blocking. @@ -2871,6 +2923,7 @@ public class CustomDamage { *(1d-witherdiv) *(1d-tankydiv) *(1d-artifactmult) + *(1d-dodgechancemult) *setbonus *((target instanceof Player && ((Player)target).isBlocking())?(PlayerMode.isDefender((Player)target))?0.30:0.50:1) *((target instanceof Player)?((PlayerMode.isDefender((Player)target))?0.9:(target.getEquipment().getItemInOffHand()!=null && target.getEquipment().getItemInOffHand().getType()==Material.SHIELD)?0.95:1):1); @@ -3141,7 +3194,7 @@ public class CustomDamage { Player p = (Player)damager; PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); if (ArtifactAbility.containsEnchantment(ArtifactAbility.HIGHWINDER, weapon)) { - dmg += 93.182445*pd.velocity*GenericFunctions.getAbilityValue(ArtifactAbility.HIGHWINDER, weapon); + dmg += Math.min(93.182445*pd.velocity*GenericFunctions.getAbilityValue(ArtifactAbility.HIGHWINDER, weapon, p),10); pd.lasthighwinderhit=TwosideKeeper.getServerTickTime(); GenericFunctions.sendActionBarMessage(p, TwosideKeeper.drawVelocityBar(pd.velocity,pd.highwinderdmg),true); } @@ -3155,7 +3208,7 @@ public class CustomDamage { if (shooter instanceof Player) { Player p = (Player)shooter; PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); - mult+=pd.swordcombo*GenericFunctions.getAbilityValue(ArtifactAbility.COMBO, weapon)/100d; + mult+=pd.swordcombo*GenericFunctions.getAbilityValue(ArtifactAbility.COMBO, weapon, p)/100d; } return mult; } @@ -3250,7 +3303,7 @@ public class CustomDamage { if (GenericFunctions.isArtifactEquip(weapon) && ArtifactAbility.containsEnchantment(ArtifactAbility.MARKSMAN, weapon)) { - headshotvaly *= 1+(GenericFunctions.getAbilityValue(ArtifactAbility.MARKSMAN, weapon)/100d); + headshotvaly *= 1+(GenericFunctions.getAbilityValue(ArtifactAbility.MARKSMAN, weapon, p)/100d); } if (proj.getTicksLived()>=4 || PlayerMode.isRanger(p)) { @@ -3427,7 +3480,6 @@ public class CustomDamage { static double calculateCriticalStrikeChance(ItemStack weapon, Entity damager, String reason) { double critchance = 0.0; - critchance = addMultiplicativeValue(critchance,0.01*GenericFunctions.getAbilityValue(ArtifactAbility.CRITICAL,weapon)); LivingEntity shooter = getDamagerEntity(damager); if (shooter!=null) { if (shooter instanceof Player) { @@ -3440,6 +3492,7 @@ public class CustomDamage { critchance = addMultiplicativeValue(critchance,ItemSet.GetMultiplicativeTotalBaseAmount(p, ItemSet.WOLFSBANE)); critchance = addMultiplicativeValue(critchance,API.getPlayerBonuses(p).getBonusCriticalChance()); critchance = addMultiplicativeValue(critchance,(pd.slayermegahit)?1.0:0.0); + critchance = addMultiplicativeValue(critchance,0.01*GenericFunctions.getAbilityValue(ArtifactAbility.CRITICAL,weapon,p)); if (reason!=null && reason.equalsIgnoreCase("power swing")) { critchance = addMultiplicativeValue(critchance,1.0d); } @@ -3447,11 +3500,14 @@ public class CustomDamage { int baubletier = ItemSet.GetBaubleTier((Player)shooter); int swordtier = ItemSet.GetItemTier(shooter.getEquipment().getItemInMainHand()); if (baubletier>=18 && swordtier>=2) { - critchance = addMultiplicativeValue(critchance,0.1d); + critchance = addMultiplicativeValue(critchance,0.1d); + TwosideKeeper.log("Crit Chance: "+critchance, 1); if (baubletier>=27 && swordtier>=3) { - critchance = addMultiplicativeValue(critchance,0.2d); + critchance = addMultiplicativeValue(critchance,0.2d); + TwosideKeeper.log("Crit Chance: "+critchance, 1); if (baubletier>=40 && swordtier>=4) { - critchance = addMultiplicativeValue(critchance,0.45d); + critchance = addMultiplicativeValue(critchance,0.45d); + TwosideKeeper.log("Crit Chance: "+critchance, 1); } } } @@ -3509,9 +3565,6 @@ public class CustomDamage { public static double calculateCriticalStrikeMultiplier(Entity damager, ItemStack weapon) { double critdmg=1.0; - if (ArtifactAbility.containsEnchantment(ArtifactAbility.CRIT_DMG, weapon)) { - critdmg+=(GenericFunctions.getAbilityValue(ArtifactAbility.CRIT_DMG,weapon))/100d; - } if (getDamagerEntity(damager) instanceof Player) { Player p = (Player)getDamagerEntity(damager); if (GenericFunctions.HasFullRangerSet(p) && @@ -3519,6 +3572,9 @@ public class CustomDamage { GenericFunctions.getBowMode(p)==BowMode.SNIPE) { critdmg+=1.0; } + if (ArtifactAbility.containsEnchantment(ArtifactAbility.CRIT_DMG, weapon)) { + critdmg+=(GenericFunctions.getAbilityValue(ArtifactAbility.CRIT_DMG,weapon, p))/100d; + } critdmg+=API.getPlayerBonuses(p).getBonusCriticalDamage(); critdmg+=ItemSet.GetTotalBaseAmount(p, ItemSet.MOONSHADOW)/100d; if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.SHARD, 3)) { @@ -3559,6 +3615,10 @@ public class CustomDamage { MonsterController.getLivingEntityDifficulty(target)==LivingEntityDifficulty.T3_MINIBOSS) { mult = 0.1; } + } else { + if (PVP.isPvPing((Player)target)) { + mult = 0.1; + } } return mult; } @@ -3617,7 +3677,16 @@ public class CustomDamage { public static void setAbsorptionHearts(LivingEntity l, float new_absorption_val) { if (l instanceof LivingEntity) { - ((org.bukkit.craftbukkit.v1_9_R1.entity.CraftLivingEntity)l).getHandle().setAbsorptionHearts(new_absorption_val); + if (l instanceof Player) { + Player p = (Player)l; + if (PVP.isPvPing(p)) { + ((org.bukkit.craftbukkit.v1_9_R1.entity.CraftLivingEntity)l).getHandle().setAbsorptionHearts(new_absorption_val*0.25f); + } else { + ((org.bukkit.craftbukkit.v1_9_R1.entity.CraftLivingEntity)l).getHandle().setAbsorptionHearts(new_absorption_val); + } + } else { + ((org.bukkit.craftbukkit.v1_9_R1.entity.CraftLivingEntity)l).getHandle().setAbsorptionHearts(new_absorption_val); + } } } @@ -3659,7 +3728,7 @@ public class CustomDamage { PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); if (GenericFunctions.isArtifactEquip(weapon) && ArtifactAbility.containsEnchantment(ArtifactAbility.ARMOR_PEN, weapon)) { - finaldmg += dmg*(GenericFunctions.getAbilityValue(ArtifactAbility.ARMOR_PEN, weapon)/100d)*armorpenmult; + finaldmg += dmg*(GenericFunctions.getAbilityValue(ArtifactAbility.ARMOR_PEN, weapon, p)/100d)*armorpenmult; } TextUtils.outputHashmap(pd.itemsets); if (GenericFunctions.HasFullRangerSet(p) @@ -3714,10 +3783,10 @@ public class CustomDamage { finaldmg += dmg*(Buff.getBuff(p, "WINDCHARGE").getAmplifier()*0.01)*armorpenmult; } } - if (finaldmg>=dmg) { + if (finaldmg*armorpenmult>=dmg) { return dmg; } else { - return finaldmg; + return finaldmg*armorpenmult; } } @@ -3909,7 +3978,7 @@ public class CustomDamage { /*0.0-1.0*/ public static double calculateLifeStealAmount(Player p, ItemStack weapon, String reason) { - double lifestealpct = GenericFunctions.getAbilityValue(ArtifactAbility.LIFESTEAL, weapon)/100; + double lifestealpct = GenericFunctions.getAbilityValue(ArtifactAbility.LIFESTEAL, weapon, p)/100; PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); lifestealpct += ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DAWNTRACKER, 3, 3)/100d; lifestealpct += pd.lifestealstacks/100d; @@ -4072,14 +4141,16 @@ public class CustomDamage { */ public static double calculateCooldownReduction(Player p) { double cooldown = 0.0; - cooldown=addMultiplicativeValue(cooldown,ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.GLADOMAIN, 2, 2)/100d); - cooldown=addMultiplicativeValue(cooldown,ItemSet.GetMultiplicativeTotalBaseAmount(p, ItemSet.VIXEN)); - if (ItemSet.meetsSlayerSwordConditions(ItemSet.LORASYS, 40, 4, p)) { - cooldown = addMultiplicativeValue(cooldown,0.45d); - } - cooldown=addMultiplicativeValue(cooldown,ItemSet.GetMultiplicativeTotalBaseAmount(p, ItemSet.ASSASSIN)); - if (ItemSet.meetsSlayerSwordConditions(ItemSet.ASSASSIN, 40, 4, p)) { - cooldown = addMultiplicativeValue(cooldown,0.3d); + if (!PVP.isPvPing(p)) { + cooldown=addMultiplicativeValue(cooldown,ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.GLADOMAIN, 2, 2)/100d); + cooldown=addMultiplicativeValue(cooldown,ItemSet.GetMultiplicativeTotalBaseAmount(p, ItemSet.VIXEN)); + if (ItemSet.meetsSlayerSwordConditions(ItemSet.LORASYS, 40, 4, p)) { + cooldown = addMultiplicativeValue(cooldown,0.45d); + } + cooldown=addMultiplicativeValue(cooldown,ItemSet.GetMultiplicativeTotalBaseAmount(p, ItemSet.ASSASSIN)); + if (ItemSet.meetsSlayerSwordConditions(ItemSet.ASSASSIN, 40, 4, p)) { + cooldown = addMultiplicativeValue(cooldown,0.3d); + } } return cooldown; } @@ -4091,7 +4162,7 @@ public class CustomDamage { ItemStack[] equips = p.getEquipment().getArmorContents(); for (ItemStack equip : equips) { if (GenericFunctions.isArtifactEquip(equip)) { - double resistamt = GenericFunctions.getAbilityValue(ArtifactAbility.STATUS_EFFECT_RESISTANCE, equip)/100d; + double resistamt = GenericFunctions.getAbilityValue(ArtifactAbility.STATUS_EFFECT_RESISTANCE, equip, p)/100d; TwosideKeeper.log("Resist amount is "+resistamt,5); removechance=addMultiplicativeValue(removechance,resistamt); } @@ -4105,10 +4176,14 @@ public class CustomDamage { double mult = 0.0; if (target!=null && shooter!=null && isBackstab(target,shooter) && (shooter instanceof Player) && PlayerMode.getPlayerMode((Player)shooter)==PlayerMode.SLAYER) { - if (ItemSet.meetsSlayerSwordConditions(ItemSet.ASSASSIN, 27, 3, (Player)shooter)) { - mult+=5.0; + if (!PVP.isPvPing((Player)shooter)) { + if (ItemSet.meetsSlayerSwordConditions(ItemSet.ASSASSIN, 27, 3, (Player)shooter)) { + mult+=5.0; + } else { + mult+=2.0; + } } else { - mult+=2.0; + mult += 0.5; } if (ItemSet.meetsSlayerSwordConditions(ItemSet.ASSASSIN, 18, 2, (Player)shooter)) { Material name = ((Player)shooter).getEquipment().getItemInMainHand().getType(); @@ -4187,7 +4262,7 @@ public class CustomDamage { PVP.isEnemy((Player)target, p)) { suppressDurationMult=0.5; } - GenericFunctions.addSuppressionTime(target, (int)(GenericFunctions.getAbilityValue(ArtifactAbility.SUPPRESS, weapon)*20*suppressDurationMult)); + GenericFunctions.addSuppressionTime(target, (int)(GenericFunctions.getAbilityValue(ArtifactAbility.SUPPRESS, weapon, p)*20*suppressDurationMult)); } } diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java b/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java index 755fbc2..45ba8ea 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java @@ -17,8 +17,10 @@ import net.md_5.bungee.api.chat.HoverEvent; import net.md_5.bungee.api.chat.TextComponent; import sig.plugin.TwosideKeeper.AwakenedArtifact; import sig.plugin.TwosideKeeper.CustomDamage; +import sig.plugin.TwosideKeeper.PVP; import sig.plugin.TwosideKeeper.TwosideKeeper; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; +import sig.plugin.TwosideKeeper.HelperStructures.Common.PVPValue; import sig.plugin.TwosideKeeper.HelperStructures.Utils.ArtifactUtils; public enum ArtifactAbility { @@ -27,25 +29,25 @@ public enum ArtifactAbility { //Temporary abilities: Work for 1 level and wear off afterward. //Weapon Abilities - DAMAGE("Strike","Improves Base Damage by [VAL]",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0}, - new double[]{0.5,0.575,0.6,0.625,0.65,0.675,0.7,0.725,0.75,0.83,0.86,0.89,0.92,0.95,1.0},10000,1,UpgradePath.BASIC,1), - ARMOR_PEN("Piercing","[VAL]% of your damage is ignored by resistances. ([PENDMG] damage)",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0}, - new double[]{0.5,0.575,0.6,0.625,0.65,0.675,0.7,0.725,0.75,0.83,0.86,0.89,0.92,0.95,1.0},100,1,UpgradePath.BASIC,1), - EXECUTION("Execute","Deals [VAL] extra damage for every 20% of target's missing health.",new double[]{0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3}, - new double[]{0.5,0.575,0.6,0.625,0.65,0.675,0.7,0.725,0.75,0.83,0.86,0.89,0.92,0.95,1.0},10000,1,UpgradePath.BASIC,1), - LIFESTEAL("Lifesteal","Heals [VAL]% of the damage dealt to targets back to your health pool.",new double[]{0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1}, - new double[]{0.5,0.575,0.6,0.625,0.65,0.675,0.7,0.725,0.75,0.83,0.86,0.89,0.92,0.95,1.0},1000,1,UpgradePath.WEAPON,1), - CRITICAL("Critical","[VAL]% chance to deal critical strikes.",new double[]{0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5}, - new double[]{0.5,0.575,0.6,0.625,0.65,0.675,0.7,0.725,0.75,0.83,0.86,0.89,0.92,0.95,1.0},100,1,UpgradePath.WEAPON,1), - CRIT_DMG("Crit Damage","Critical Strikes deal [200VAL]% damage.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0}, - new double[]{0.5,0.575,0.6,0.625,0.65,0.675,0.7,0.725,0.75,0.83,0.86,0.89,0.92,0.95,1.0},10000,1,UpgradePath.WEAPON,1), - HIGHWINDER("Highwinder","While moving fast or sprinting, you deal [VAL] extra damage for every 1m of speed.",new double[]{0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5}, - new double[]{0.5,0.575,0.6,0.625,0.65,0.675,0.7,0.725,0.75,0.83,0.86,0.89,0.92,0.95,1.0},10000,15,UpgradePath.WEAPON,1), + DAMAGE("Strike","Improves Base Damage by [VAL]",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0}, + new PVPValue(30,1.0),10000,1,UpgradePath.BASIC,1), + ARMOR_PEN("Piercing","[VAL]% of your damage is ignored by resistances. ([PENDMG] damage)",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0}, + new PVPValue(30,1.0),100,1,UpgradePath.BASIC,1), + EXECUTION("Execute","Deals [VAL] extra damage for every 20% of target's missing health.",new double[]{0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3}, + new PVPValue(30,0.3),10000,1,UpgradePath.BASIC,1), + LIFESTEAL("Lifesteal","Heals [VAL]% of the damage dealt to targets back to your health pool.",new double[]{0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1}, + new PVPValue(15,0.1),1000,1,UpgradePath.WEAPON,1), + CRITICAL("Critical","[VAL]% chance to deal critical strikes.",new double[]{0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5}, + new PVPValue(30,0.5),100,1,UpgradePath.WEAPON,1), + CRIT_DMG("Crit Damage","Critical Strikes deal [200VAL]% damage.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0}, + new PVPValue(30,1.0),10000,1,UpgradePath.WEAPON,1), + HIGHWINDER("Highwinder","While moving fast or sprinting, you deal [VAL] extra damage for every 1m of speed.",new double[]{0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05}, + new PVPValue(1,0.5),10000,15,UpgradePath.WEAPON,1), //Bow Abilities - MARKSMAN("Marksman","Increases headshot hitbox size by [VAL]% .",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0}, - new double[]{1.0,0.975,0.95,0.875,0.85,0.825,0.8,0.775,0.75,0.725,0.70,0.675,0.65,0.55,0.45},10000,15,UpgradePath.BOW,1), - SIEGESTANCE("Siege Stance",ChatColor.GRAY+"[Unimplemented] Activate by Sneaking for three seconds. Sneak again to de-activate.\n\n" + MARKSMAN("Marksman","Increases headshot hitbox size by [VAL]% .",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0}, + new PVPValue(30,1.0),10000,15,UpgradePath.BOW,1), + /*SIEGESTANCE("Siege Stance",ChatColor.GRAY+"[Unimplemented] Activate by Sneaking for three seconds. Sneak again to de-activate.\n\n" + "Applies Slowness V and Resistance VI. While in Siege Stance you fire clusters of 7 arrows per shot. Each arrow deals [VAL] damage.",new double[]{3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0}, new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1000,UpgradePath.BOW,1), ARROWSHOWER("Arrow Shower",ChatColor.GRAY+"[Unimplemented] Shift-Left Click to activate. Applies Slowness X for three seconds while firing arrows into the sky and onto enemies in a large area in front of you. Each arrow deals [VAL] damage.",new double[]{0.7,0.7,0.7,0.7,0.7,0.7,0.7,0.7,0.7,0.7}, @@ -53,31 +55,31 @@ public enum ArtifactAbility { TARGETING("Targeting",ChatColor.GRAY+"[Unimplemented] Left-click a mob to target them. Fire arrows to release homing missiles at your target. Each missile explodes and deals [VAL] damage.",new double[]{10,10,10,10,10,10,10,10,10,10}, new double[]{0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3},100,1000,UpgradePath.BOW,1), ENDERTURRET("Ender Turret",ChatColor.GRAY+"[Unimplemented] Place Eyes of Ender in your hotbar to use as ammo. Each eye fired launches forward and upward before releasing a barrage of homing missiles that lock onto enemy targets. Each missile explodes and deals [VAL] damage.",new double[]{25,25,25,25,25,25,25,25,25,25}, - new double[]{0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5},100,1000,UpgradePath.BOW,1), + new double[]{0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5},100,1000,UpgradePath.BOW,1),*/ //Armor abilities - DAMAGE_REDUCTION("Defense","Increases Base Damage reduction by [VAL]%\n\n"+PlayerMode.RANGER.getColor()+PlayerMode.RANGER.getName()+" Mode "+ChatColor.WHITE+" only receives half the effect.",new double[]{0.245,0.245,0.245,0.245,0.245,0.245,0.245,0.245,0.245,0.245,0.245,0.245,0.245,0.245,0.245,0.245}, - new double[]{2.2,2.1,2.0,1.9,1.8,1.7,1.6,1.55,1.5,1.475,1.45,1.425,1.4,1.35,1.3},100,1,UpgradePath.ARMOR,1), - HEALTH("Health","Increases Maximum Health by [VAL].\n\n"+PlayerMode.RANGER.getColor()+PlayerMode.RANGER.getName()+" Mode "+ChatColor.WHITE+" only receives half the effect.",new double[]{0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25}, - new double[]{1.0,0.95,0.9,0.85,0.8,0.75,0.7,0.75,0.7,0.675,0.65,0.625,0.6,0.55,0.5},10000,1,UpgradePath.ARMOR,1), + DAMAGE_REDUCTION("Defense","Increases Base Damage reduction by [VAL]%\n\n"+PlayerMode.RANGER.getColor()+PlayerMode.RANGER.getName()+" Mode "+ChatColor.WHITE+" only receives half the effect.",new double[]{0.245,0.245,0.245,0.245,0.245,0.245,0.245,0.245,0.245,0.245,0.245,0.245,0.245,0.245,0.245,0.245,0.245}, + new PVPValue(80,0.245),100,1,UpgradePath.ARMOR,1), + HEALTH("Health","Increases Maximum Health by [VAL].\n\n"+PlayerMode.RANGER.getColor()+PlayerMode.RANGER.getName()+" Mode "+ChatColor.WHITE+" only receives half the effect.",new double[]{0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25}, + new PVPValue(40,0.25),10000,1,UpgradePath.ARMOR,1), HEALTH_REGEN("Regeneration","Regenerates an extra [VAL] health every 5 seconds.",new double[]{0.125,0.125,0.125,0.125,0.125,0.125,0.125,0.125,0.125,0.125,0.125,0.125,0.125,0.125,0.125,0.125}, - new double[]{1.0,0.95,0.9,0.85,0.8,0.75,0.7,0.65,0.6,0.55,0.5,0.475,0.45,0.425,0.4},10000,1,UpgradePath.ARMOR,1), + new PVPValue(1,0.125),10000,1,UpgradePath.ARMOR,1), STATUS_EFFECT_RESISTANCE("Resistance","When a debuff is applied, there is a [VAL]% chance to remove it.",new double[]{0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25}, - new double[]{4.0,3.85,3.70,3.55,3.40,3.25,3.10,2.95,2.80,2.775,2.75,2.725,2.7,2.675,2.65},100,1,UpgradePath.ARMOR,1), + new PVPValue(40,0.25),100,1,UpgradePath.ARMOR,1), SHADOWWALKER("Shadow Walker","Increases your speed in dark areas. Damage Reduction increases by [VAL]% in dark areas. Dodge chance increases by [DODGEVAL]% in dark areas.",new double[]{0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2}, - new double[]{1.5,1.4,1.3,1.2,1.1,1.0,0.9,0.8,0.7,0.65,0.625,0.6,0.585,0.565,0.55},100,100,UpgradePath.ARMOR,1), + new PVPValue(0,0.2),100,100,UpgradePath.ARMOR,1), SURVIVOR("Survivor","Taking fatal damage will not kill you and instead consumes this ability, removes all debuffs, and restores your health by [VAL]%"+TemporarySkill(true),new double[]{10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10}, - new double[]{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0},10,25,UpgradePath.ARMOR,1), + new PVPValue(0,10),10,25,UpgradePath.ARMOR,1), DODGE("Dodge","You have a [VAL]% chance to dodge incoming damage from any damage source."+LevelCost(2),new double[]{0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2}, - new double[]{1.0,0.95,0.9,0.85,0.8,0.75,0.7,0.65,0.6,0.55,0.5,0.45,0.35,0.25,0.2},100,40,UpgradePath.ARMOR,2), + new PVPValue(0,0.2),100,40,UpgradePath.ARMOR,2), GRACEFULDODGE("Graceful Dodge","Whenever a dodge occurs, you will gain [GRACEFULVAL] seconds of invulnerability."+LevelCost(10),new double[]{0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05}, - new double[]{1.8,1.79,1.78,1.77,1.76,1.75,1.74,1.73,1.72,1.71,1.70,1.69,1.67,1.65,1.62},100,40,UpgradePath.ARMOR,10), + new PVPValue(0,0.05),100,40,UpgradePath.ARMOR,10), //Sword abilities PROVOKE("Provoke","Your attacks provoke enemies for [VAL] seconds.",new double[]{0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1}, - new double[]{3.0,2.9,2.8,2.7,2.6,2.5,2.4,2.3,2.2,2.1,2.0,1.9,1.8,1.7,1.6,1.5,1.4,1.3,1.2,1.1},10000,10,UpgradePath.PROVOKE,1), + new PVPValue(0,1.0),10000,10,UpgradePath.PROVOKE,1), COMBO("Belligerent","[VAL]% more damage for each successive strike on a mob. Resets after 2 seconds of no combat.",new double[]{0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1}, - 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},10000,40,UpgradePath.SWORD,1), + new PVPValue(50,0.1),10000,40,UpgradePath.SWORD,1), //Pickaxe abilities /*SCAVENGE("Scavenge",ChatColor.GRAY+"[Unimplemented] Breaks off resources from armor. [VAL]% chance per hit.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0}, @@ -85,22 +87,22 @@ public enum ArtifactAbility { MINES("Land Mine",ChatColor.GRAY+"[Unimplemented]While in combat, throw your pickaxe to send land mines towards your enemies. On contact they deal [VAL] damage.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0}, new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1000,UpgradePath.PICKAXE,1),*/ MINES("Land Mine",ChatColor.GOLD+"Shift+Right-click"+ChatColor.RESET+" air to place down a land mine. Land mines detonate when enemies step near the mine location, dealing [VAL] damage. Mines will automatically detonate after 15 seconds of no activity.\n\nYou can place a maximum of "+ChatColor.GOLD+"[MINEAMT]"+ChatColor.RESET+" mine[MINEAMTPLURAL] at once.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0}, - new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},10000,40,UpgradePath.PICKAXE,1), + new PVPValue(100,1.0),10000,40,UpgradePath.PICKAXE,1), OREHARVESTER("Ore Harvester",ChatColor.GOLD+"Shift+Right-click"+ChatColor.RESET+" an ore block to convert the block into a temporary buff. The buff lasts for [VAL] seconds. Duration can be stacked for longer buffs.\n\n "+DisplayOreBonus("Coal Ore","+[COALORE_BONUS]% Critical Damage")+"\n"+DisplayOreBonus("Iron Ore","+[IRONORE_BONUS]% Block Chance")+"\n"+DisplayOreBonus("Gold Ore","+[GOLDORE_BONUS]% Critical Strike Chance")+"\n"+DisplayOreBonus("Redstone Ore","+[REDSTONEORE_BONUS] Maximum Health")+"\n"+DisplayOreBonus("Lapis Lazuli Ore","+[LAPISORE_BONUS] Health Regeneration")+"\n"+DisplayOreBonus("Diamond Ore","+[COALORE_BONUS]% Damage Reduction")+"\n"+DisplayOreBonus("Emerald Ore","+[COALORE_BONUS] Base Damage")+"\n"+LevelCost(40),new double[]{10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0}, - new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},10000,100,UpgradePath.PICKAXE,40), + new PVPValue(100,10.0),10000,100,UpgradePath.PICKAXE,40), IMPACT("Impact","Damaging an enemy deals [VAL]% of an enemy's health as bonus physical damage on hit."+LevelCost(5),new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0}, - new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},250,20,UpgradePath.PICKAXE,5), + new PVPValue(100,1.0),250,20,UpgradePath.PICKAXE,5), FORCESTRIKE("Force Strike","Perform an attack that slams an enemy against a wall. Enemies take [FORCESTRIKEVAL] damage on a successful slam, crumbling the walls behind them.\n\n"+ChatColor.YELLOW+"15 second cooldown",new double[]{2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0}, - new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},10000,350,UpgradePath.PICKAXE,1), + new PVPValue(100,2.0),10000,350,UpgradePath.PICKAXE,1), //Shovel abilities SUPPRESS("Suppression","Suppresses a mob on hit for [VAL] seconds.\n\n" + "Suppression prevents movement, attacking, exploding, and teleportation."+LevelCost(10),new double[]{0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.02}, - new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,10,UpgradePath.SHOVEL,10), + new PVPValue(10,0.02),100,10,UpgradePath.SHOVEL,10), ERUPTION("Eruption","Sneak while Left-clicking a mob to damage mobs for [ERUPTIONVAL] damage and knock them up. The eruption also destroys the ground beneath you.",new double[]{3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0}, - new double[]{1.0,0.925,0.85,0.775,0.7,0.625,0.55,0.475,0.45,0.425,0.4,0.375,0.35,0.325,0.3},10000,40,UpgradePath.SHOVEL,1), + new PVPValue(30,3.0),10000,40,UpgradePath.SHOVEL,1), EARTHWAVE("Earth Wave","While in mid-air, right-click to instantly slam into the ground and launch soft blocks. This attack ignores fall damage. The larger the fall, the larger the wave.\n\nDeals [EARTHWAVEVAL] damage to every enemy hit by the wave. Deals double damage and knocks up on soft blocks.",new double[]{2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0}, - new double[]{2.4,2.2,2.0,1.9,1.8,1.7,1.6,1.5,1.4,1.2,1.1,1.0,0.9,0.8,0.7},10000,100,UpgradePath.SHOVEL,1), + new PVPValue(30,2.0),10000,100,UpgradePath.SHOVEL,1), //Axe abilities /*BREAKDOWN("Break Down",ChatColor.GRAY+"[Unimplemented] Breaks down armor on mobs. Each hit has a [VAL]% chance to remove a piece of armor from a mob.",new double[]{3,3,3,3,3,3,3,3,3,3}, @@ -109,63 +111,62 @@ public enum ArtifactAbility { new double[]{0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8},100,1000,UpgradePath.AXE,1),*/ DAMAGEPOOL("Damage Pool Recovery","Removes [VAL] points from Barbarian's Damage Pool with each attack.", new double[]{0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5}, - new double[]{},10000,1,UpgradePath.AXE,1), + new PVPValue(30,0.5),10000,1,UpgradePath.AXE,1), LIFESTACK("Life Stack","Increases Barbarian's lifesteal stacks by [VAL] per hit.", new double[]{0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5}, - new double[]{},10000,1,UpgradePath.AXE,1), + new PVPValue(30,0.5),10000,1,UpgradePath.AXE,1), LIFESUCK("Life Sucker","Directly heals [VAL]% of damage dealt as health, with a maximum of [LIFESUCKVAL] health healed per hit."+LevelCost(3), new double[]{0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8}, - new double[]{},100,40,UpgradePath.AXE,3), + new PVPValue(30,0.8),100,40,UpgradePath.AXE,3), HIGHDIVE("High Dive","Sneak while pressing the drop key to become rooted for 3 seconds, storing [VAL]% damage taken and gaining 100% knockback resistance. Then leap up high into the air and slam the ground. High Dive increases the base damage of Barbarian's Leaping Strike by the amount of damage stored."+LevelCost(3), new double[]{0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8}, - new double[]{},100,100,UpgradePath.AXE,3), + new PVPValue(30,0.8),100,100,UpgradePath.AXE,3), //Scythe abilities AOE("Area of Effect","Deals damage to targets up to [AOEVAL]m from the main target hit.",new double[]{0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1}, - new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.9,0.7,0.5},10000,1,UpgradePath.SCYTHE,1), + new PVPValue(3,1.0),10000,1,UpgradePath.SCYTHE,1), DEATHMARK("Death Mark","Applies a Death Mark stack to enemies hit. Death mark stacks last for 5 seconds, and refresh on each hit.\n\nMarks can be detonated at any time by right-clicking. Targets killed with Death Mark resets the cooldown. Targets not killed lose half their Death Mark stacks.\n\n Each death mark stack applied deals [VAL] true damage.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0}, - new double[]{0.6,0.575,0.55,0.525,0.5,0.475,0.45,0.425,0.4,0.375,0.35,0.325,0.3,0.275,0.25},10000,10,UpgradePath.SCYTHE,1), + new PVPValue(3,1.0),10000,10,UpgradePath.SCYTHE,1), CRIPPLE("Cripple","Every 10 death marks applied on a monster increases damage dealt from all damage sources by [VAL]%.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0}, - new double[]{0.3,0.3,0.27,0.27,0.24,0.24,0.21,0.21,0.18,0.18},100,1000,UpgradePath.SCYTHE,1), + new PVPValue(1,1.0),100,1000,UpgradePath.SCYTHE,1), //General abilities AUTOREPAIR("Auto Repair","1% chance every second to repair [VAL] durability to the artifact item\n\nThe item must be sitting in your hotbar or must be equipped for this ability to work. This ability is less effective with no sunlight!",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0}, - new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},10000,1,UpgradePath.ALL,1), + new PVPValue(30,1.0),10000,1,UpgradePath.ALL,1), GREED("Greed","Increases Drop rate by [VAL]% . Health is halved, health regeneration is halved. Each kill has a [GREEDCHANCE]% chance to consume the Greed buff."+TemporarySkill(true),new double[]{10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,15.0,15.0,15.0,20.0,25.0,30.0,40.0}, - new double[]{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0},10,10,UpgradePath.ALL,1), + new PVPValue(0,10.0),10,10,UpgradePath.ALL,1), GROWTH("Growth","Sets the Potential of your Artifact to 20%."+TemporarySkill(false),new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0}, - new double[]{2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0},1,10,UpgradePath.ALL,1), + new PVPValue(0,1.0),1,10,UpgradePath.ALL,1), /*REMOVE_CURSE("Remove Curse",ChatColor.GRAY+"[Unimplemented] Removes a level of a curse from the Artifact.",new double[]{-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0}, new double[]{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0},1,1000,UpgradePath.ALL),*/ PRESERVATION("Preservation","Potential decays [POTVAL]% slower.",new double[]{0.90,0.90,0.90,0.90,0.90,0.90,0.90,0.90,0.90,0.90,0.90,0.90,0.90,0.90,0.90,0.90}, - new double[]{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0},100,1,UpgradePath.ALL,1), + new PVPValue(100,0.9),100,1,UpgradePath.ALL,1), /*EXP_MULT("Mega XP",ChatColor.GRAY+"[Unimplemented] Increases experience dropped from monsters by [VAL]% .",new double[]{5,5,5,5,5,5,5,5,5,5,5,5,5,5,5}, new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1000,UpgradePath.ALL),*/ //Bad stuff REDUCEDMG("Weakness","[VAL]% Decrease in Base Damage.",new double[]{8,8,8,8,8,8,8,8,8,8}, - new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,3,UpgradePath.ALL,1), + new PVPValue(30,8),100,3,UpgradePath.ALL,1), REDUCEDEF("Imperil","[VAL]% Decrease in Damage Reduction",new double[]{8,8,8,8,8,8,8,8,8,8}, - new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,5,UpgradePath.ALL,1), + new PVPValue(30,8),100,5,UpgradePath.ALL,1), LIFE_REDUCTION("Health Cut","[VAL]% decrease in maximum health.",new double[]{30,30,30,30,30,30,30,30,30,30}, - new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,5,UpgradePath.ALL,1), + new PVPValue(30,30),100,5,UpgradePath.ALL,1), LOWER_DEFENSE("Debilitate","[VAL]% decrease in damage reduction.",new double[]{30,30,30,30,30,30,30,30,30,30}, - new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,5,UpgradePath.ALL,1), + new PVPValue(30,30),100,5,UpgradePath.ALL,1), TELEPORT("Teleport","[VAL]% chance to teleport the player to a random location on artifact experience gain.",new double[]{3,3,3,3,3,3,3,3,3,3}, - new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,10,UpgradePath.ALL,1), + new PVPValue(30,3),100,10,UpgradePath.ALL,1), DRAINING("Draining","[VAL]% chance to remove a level of experience on artifact experience gain.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0}, - new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,10,UpgradePath.ALL,1), + new PVPValue(30,1.0),100,10,UpgradePath.ALL,1), NOREGEN("Weary","No health regenerates.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0}, - new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,15,UpgradePath.ALL,1), + new PVPValue(30,1.0),100,15,UpgradePath.ALL,1), STARVATION("Starvation","[VAL]% chance to cause [HUNGERVAL] seconds of Hunger on experience gain.",new double[]{5,5,5,5,5,5,5,5,5,5}, - new double[]{0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1},100,15,UpgradePath.ALL,1), + new PVPValue(30,5),100,15,UpgradePath.ALL,1), BURN("Flammable","All burn damage deals x[VAL] damage.",new double[]{4.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0}, - new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,25,UpgradePath.ALL,1), + new PVPValue(30,0.4),100,25,UpgradePath.ALL,1), FROZEN("Frozen","Player will be inflicted with increasing levels of slowness and fatigue until finally frozen and killed.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0}, - new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},1,45,UpgradePath.ALL,1), + new PVPValue(30,1.0),1,45,UpgradePath.ALL,1), PETRIFICATION("Petrification","Player will be inflicted with increasing levels of slowness and fatigue until finally petrified and killed.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0}, - new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},1,45,UpgradePath.ALL,1), - + new PVPValue(30,1.0),1,45,UpgradePath.ALL,1), ; final static double[] decayvals = new double[]{0.5,0.588,0.6505,0.6990,0.7386,0.7720,0.8010,0.8266,0.8495,0.8702,0.8891,0.9225,0.9515,0.9771,1.0}; @@ -179,18 +180,23 @@ public enum ArtifactAbility { int requirement; UpgradePath upgrade; int apcost; + PVPValue pvpval; - ArtifactAbility(String name, String desc, double[] baseval, double[] decayval, int maxlv, int requirement, UpgradePath upgrade, int apcost) { + ArtifactAbility(String name, String desc, double[] baseval, PVPValue pvpval, int maxlv, int requirement, UpgradePath upgrade, int apcost) { this.name=name; this.desc=desc; this.baseval=baseval; - this.decayval=decayval; this.maxlv=maxlv; this.requirement=requirement; AwakenedArtifact.ability_map.put(this,this.name); AwakenedArtifact.name_map.put(this.name,this); this.upgrade=upgrade; this.apcost=apcost; + this.pvpval=pvpval; + } + + public PVPValue getPVPValue() { + return pvpval; } private static String LevelCost(int i) { @@ -215,12 +221,22 @@ public enum ArtifactAbility { public double GetBaseValue(int tier) { if (tier<=0) {tier=1;} - return this.baseval[tier-1]; + if (tier-1 getEnchantments(ItemStack item) { HashMap abilities = new HashMap(); if (GenericFunctions.isArtifactEquip(item)) { @@ -518,7 +517,7 @@ public enum ArtifactAbility { tc.addExtra(ac); tc.addExtra(" to open up the ability upgrade menu.");;*/ p.spigot().sendMessage(tc); - p.spigot().sendMessage(ArtifactAbility.GenerateMenu(ArtifactItemType.getArtifactItemTypeFromItemStack(p.getInventory().getItem(GenericFunctions.CalculateSlot(item,p))).getUpgradePath(), CustomDamage.getBaseWeaponDamage(item, p, null), item,GenericFunctions.CalculateSlot(item,p))); + p.spigot().sendMessage(ArtifactAbility.GenerateMenu(ArtifactItemType.getArtifactItemTypeFromItemStack(p.getInventory().getItem(GenericFunctions.CalculateSlot(item,p))).getUpgradePath(), CustomDamage.getBaseWeaponDamage(item, p, null), item,GenericFunctions.CalculateSlot(item,p),p)); } } else { if (ability.GetMaxLevel()<=level) { @@ -536,7 +535,7 @@ public enum ArtifactAbility { return item; } - public static TextComponent DisplayAbility(ArtifactAbility ability, double playerdmgval, ItemStack targetitem, int slot) { + public static TextComponent DisplayAbility(ArtifactAbility ability, double playerdmgval, ItemStack targetitem, int slot, Player p) { boolean unlocked=true; String lockedreason = ""; if (AwakenedArtifact.getLV(targetitem)=ability.GetMaxLevel() || AwakenedArtifact.getAP(targetitem)0) { - displaystring = displayDescriptionUpgrade(ability,ArtifactUtils.getArtifactTier(targetitem),enchantlevel,enchantlevel+1,playerdmgval); + displaystring = displayDescriptionUpgrade(ability,ArtifactUtils.getArtifactTier(targetitem),enchantlevel,enchantlevel+1,playerdmgval, PVP.isPvPing(p)); } else { - displaystring = displayDescription(ability,ArtifactUtils.getArtifactTier(targetitem),enchantlevel+1,playerdmgval); + displaystring = displayDescription(ability,ArtifactUtils.getArtifactTier(targetitem),enchantlevel+1,playerdmgval, PVP.isPvPing(p)); } TextComponent tc = new TextComponent(((unlocked)?ChatColor.GREEN:ChatColor.RED)+"["+ability.GetName()+" "+(enchantlevel+1)+"] "); tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,new ComponentBuilder(WordUtils.wrap(ChatColor.BLUE+ability.GetName()+"\n\n"+displaystring+((lockedreason.equalsIgnoreCase(""))?"":"\n\n"),LINE_SIZE,"\n",true)+WordUtils.wrap(lockedreason,LINE_SIZE,"\n"+net.md_5.bungee.api.ChatColor.GRAY,true)).create())); @@ -574,11 +573,11 @@ public enum ArtifactAbility { } } - public static TextComponent GenerateMenu(UpgradePath path, double playerdmgval, ItemStack targetitem) { - return GenerateMenu(path,playerdmgval,targetitem,0); + public static TextComponent GenerateMenu(UpgradePath path, double playerdmgval, ItemStack targetitem, Player p) { + return GenerateMenu(path,playerdmgval,targetitem,0,p); } - public static TextComponent GenerateMenu(UpgradePath path, double playerdmgval, ItemStack targetitem, int slot) { + public static TextComponent GenerateMenu(UpgradePath path, double playerdmgval, ItemStack targetitem, int slot, Player p) { TextComponent msg1 = new TextComponent("Choose an ability to upgrade "+((targetitem.hasItemMeta() && targetitem.getItemMeta().hasDisplayName())?targetitem.getItemMeta().getDisplayName():GenericFunctions.UserFriendlyMaterialName(targetitem))+ChatColor.RESET+":\n\n"); int i=0; TextComponent text = new TextComponent(""); @@ -590,83 +589,83 @@ public enum ArtifactAbility { path==UpgradePath.FISHING_ROD || path==UpgradePath.SCYTHE || path==UpgradePath.BASIC) { - text=DisplayAbility(DAMAGE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} - text=DisplayAbility(ARMOR_PEN,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} - text=DisplayAbility(EXECUTION,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(DAMAGE,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(ARMOR_PEN,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(EXECUTION,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} if (path!=UpgradePath.BASIC) { - text=DisplayAbility(LIFESTEAL,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} - text=DisplayAbility(CRITICAL,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} - text=DisplayAbility(CRIT_DMG,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} - text=DisplayAbility(HIGHWINDER,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(LIFESTEAL,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(CRITICAL,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(CRIT_DMG,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(HIGHWINDER,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} if (path==UpgradePath.SWORD) { - text=DisplayAbility(PROVOKE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} - text=DisplayAbility(COMBO,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(PROVOKE,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(COMBO,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} } else if (path==UpgradePath.AXE) { - text=DisplayAbility(PROVOKE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(PROVOKE,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} //text=DisplayAbility(BREAKDOWN,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} //text=DisplayAbility(BUTCHERY,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} if (TwosideKeeper.NEWARTIFACTABILITIES_ACTIVATED) { - text=DisplayAbility(DAMAGEPOOL,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} - text=DisplayAbility(LIFESTACK,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} - text=DisplayAbility(LIFESUCK,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} - text=DisplayAbility(HIGHDIVE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(DAMAGEPOOL,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(LIFESTACK,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(LIFESUCK,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(HIGHDIVE,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} } } else if (path==UpgradePath.FISHING_ROD) { } else if (path==UpgradePath.BOW) { - text=DisplayAbility(MARKSMAN,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} - text=DisplayAbility(SIEGESTANCE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(MARKSMAN,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + /*text=DisplayAbility(SIEGESTANCE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(ARROWSHOWER,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(TARGETING,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} - text=DisplayAbility(ENDERTURRET,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(ENDERTURRET,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}*/ } else if (path==UpgradePath.SCYTHE) { - text=DisplayAbility(AOE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} - text=DisplayAbility(DEATHMARK,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(AOE,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(DEATHMARK,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} } } } else if (path==UpgradePath.ARMOR //Armor category. ) { - text=DisplayAbility(DAMAGE_REDUCTION,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} - text=DisplayAbility(HEALTH,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} - text=DisplayAbility(HEALTH_REGEN,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} - text=DisplayAbility(STATUS_EFFECT_RESISTANCE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} - text=DisplayAbility(SHADOWWALKER,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} - text=DisplayAbility(SURVIVOR,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} - text=DisplayAbility(DODGE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} - text=DisplayAbility(GRACEFULDODGE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(DAMAGE_REDUCTION,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(HEALTH,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(HEALTH_REGEN,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(STATUS_EFFECT_RESISTANCE,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(SHADOWWALKER,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(SURVIVOR,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(DODGE,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(GRACEFULDODGE,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} } else if (path==UpgradePath.TOOL || //Tool category. path==UpgradePath.SHOVEL || path==UpgradePath.PICKAXE ) { - text=DisplayAbility(DAMAGE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} - text=DisplayAbility(ARMOR_PEN,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} - text=DisplayAbility(EXECUTION,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(DAMAGE,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(ARMOR_PEN,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(EXECUTION,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} if (path==UpgradePath.SHOVEL) { - text=DisplayAbility(SUPPRESS,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} - text=DisplayAbility(ERUPTION,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} - text=DisplayAbility(EARTHWAVE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(SUPPRESS,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(ERUPTION,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(EARTHWAVE,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} } else if (path==UpgradePath.PICKAXE) { //text=DisplayAbility(SCAVENGE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} if (TwosideKeeper.NEWARTIFACTABILITIES_ACTIVATED) { - text=DisplayAbility(MINES,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} - text=DisplayAbility(OREHARVESTER,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} - text=DisplayAbility(IMPACT,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} - text=DisplayAbility(FORCESTRIKE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(MINES,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(OREHARVESTER,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(IMPACT,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(FORCESTRIKE,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} } } } - text=DisplayAbility(GREED,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} - text=DisplayAbility(AUTOREPAIR,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} - text=DisplayAbility(GROWTH,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(GREED,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(AUTOREPAIR,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(GROWTH,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} //text=DisplayAbility(REMOVE_CURSE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} - text=DisplayAbility(PRESERVATION,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(PRESERVATION,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} //text=DisplayAbility(EXP_MULT,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} return msg1; @@ -676,42 +675,42 @@ public enum ArtifactAbility { return ChatColor.LIGHT_PURPLE+oretype+": "+ChatColor.YELLOW+" "+bonus; } - public static String displayDescription(ArtifactAbility ability, int tier, int abilitylv, double playerdmgval) { //Level to display information for. + public static String displayDescription(ArtifactAbility ability, int tier, int abilitylv, double playerdmgval, boolean pvp) { //Level to display information for. String msg = ability.GetDescription(); DecimalFormat df = new DecimalFormat("0.00"); - msg=msg.replace("[VAL]", ChatColor.BLUE+df.format(calculateValue(ability,tier,abilitylv))+ChatColor.RESET); - msg=msg.replace("[200VAL]", ChatColor.BLUE+df.format(200+calculateValue(ability,tier,abilitylv))+ChatColor.RESET); - msg=msg.replace("[PENDMG]", ChatColor.BLUE+df.format(calculateValue(ability,tier,abilitylv)/100*playerdmgval)+ChatColor.RESET); //Based on multiplying [VAL] by the base damage value. + msg=msg.replace("[VAL]", ChatColor.BLUE+df.format(calculateValue(ability,tier,abilitylv,pvp))+ChatColor.RESET); + msg=msg.replace("[200VAL]", ChatColor.BLUE+df.format(200+calculateValue(ability,tier,abilitylv,pvp))+ChatColor.RESET); + msg=msg.replace("[PENDMG]", ChatColor.BLUE+df.format(calculateValue(ability,tier,abilitylv,pvp)/100*playerdmgval)+ChatColor.RESET); //Based on multiplying [VAL] by the base damage value. msg=msg.replace("[HUNGERVAL]", ChatColor.BLUE+df.format(10*abilitylv)+ChatColor.RESET); msg=msg.replace("[FATALDMG]", ChatColor.BLUE+df.format(120*abilitylv)+ChatColor.RESET); msg=msg.replace("[REPAIRCHANCE]", ChatColor.BLUE+df.format(tier/3)+ChatColor.RESET); msg=msg.replace("[DODGEVAL]", ChatColor.BLUE+df.format(tier)+ChatColor.RESET); msg=msg.replace("[GREEDCHANCE]", ChatColor.BLUE+df.format(8-(tier/2d))+ChatColor.RESET); - msg=msg.replace("[ERUPTIONVAL]", ChatColor.BLUE+df.format(35+calculateValue(ability,tier,abilitylv))+ChatColor.RESET); - msg=msg.replace("[EARTHWAVEVAL]", ChatColor.BLUE+df.format(20+calculateValue(ability,tier,abilitylv))+ChatColor.RESET); - msg=msg.replace("[AOEVAL]", ChatColor.BLUE+df.format(1+calculateValue(ability,tier,abilitylv))+ChatColor.RESET); - msg=msg.replace("[POTVAL]", ChatColor.BLUE+df.format(5+calculateValue(ability,tier,abilitylv))+ChatColor.RESET); - msg=msg.replace("[GRACEFULVAL]", ChatColor.BLUE+df.format(0.1+calculateValue(ability,tier,abilitylv))+ChatColor.RESET); - msg=msg.replace("[FORCESTRIKEVAL]", ChatColor.BLUE+df.format(60+calculateValue(ability,tier,abilitylv))+ChatColor.RESET); + msg=msg.replace("[ERUPTIONVAL]", ChatColor.BLUE+df.format(35+calculateValue(ability,tier,abilitylv,pvp))+ChatColor.RESET); + msg=msg.replace("[EARTHWAVEVAL]", ChatColor.BLUE+df.format(20+calculateValue(ability,tier,abilitylv,pvp))+ChatColor.RESET); + msg=msg.replace("[AOEVAL]", ChatColor.BLUE+df.format(1+calculateValue(ability,tier,abilitylv,pvp))+ChatColor.RESET); + msg=msg.replace("[POTVAL]", ChatColor.BLUE+df.format(5+calculateValue(ability,tier,abilitylv,pvp))+ChatColor.RESET); + msg=msg.replace("[GRACEFULVAL]", ChatColor.BLUE+df.format(0.1+calculateValue(ability,tier,abilitylv,pvp))+ChatColor.RESET); + msg=msg.replace("[FORCESTRIKEVAL]", ChatColor.BLUE+df.format(60+calculateValue(ability,tier,abilitylv,pvp))+ChatColor.RESET); return msg; } - public static String displayDescriptionUpgrade(ArtifactAbility ability, int tier, int fromlv, int tolv, double playerdmgval) { //Level to display information for. + public static String displayDescriptionUpgrade(ArtifactAbility ability, int tier, int fromlv, int tolv, double playerdmgval, boolean pvp) { //Level to display information for. String msg = ability.GetDescription(); DecimalFormat df = new DecimalFormat("0.00"); - msg=msg.replace("[VAL]", DisplayChangedValue(df.format(calculateValue(ability,tier,fromlv)),df.format(calculateValue(ability,tier,tolv)))); - msg=msg.replace("[200VAL]", ChatColor.BLUE+DisplayChangedValue(df.format(200+calculateValue(ability,tier,fromlv)),df.format(200+calculateValue(ability,tier,tolv)))+ChatColor.RESET); - msg=msg.replace("[PENDMG]", DisplayChangedValue(df.format(calculateValue(ability,tier,fromlv)/100*playerdmgval),df.format(calculateValue(ability,tier,tolv)/100*playerdmgval))); //Based on multiplying [VAL] by the base damage value. + msg=msg.replace("[VAL]", DisplayChangedValue(df.format(calculateValue(ability,tier,fromlv,pvp)),df.format(calculateValue(ability,tier,tolv,pvp)))); + msg=msg.replace("[200VAL]", ChatColor.BLUE+DisplayChangedValue(df.format(200+calculateValue(ability,tier,fromlv,pvp)),df.format(200+calculateValue(ability,tier,tolv,pvp)))+ChatColor.RESET); + msg=msg.replace("[PENDMG]", DisplayChangedValue(df.format(calculateValue(ability,tier,fromlv,pvp)/100*playerdmgval),df.format(calculateValue(ability,tier,tolv,pvp)/100*playerdmgval))); //Based on multiplying [VAL] by the base damage value. msg=msg.replace("[HUNGERVAL]", DisplayBadChangedValue(df.format(10*fromlv),df.format(10*tolv))); msg=msg.replace("[FATALDMG]", DisplayChangedValue(df.format(120-fromlv),df.format(120-tolv))); msg=msg.replace("[REPAIRCHANCE]", df.format(tier/3)); msg=msg.replace("[DODGEVAL]", df.format(tier)); msg=msg.replace("[GREEDCHANCE]", ChatColor.BLUE+df.format(8-(tier/2d))+ChatColor.RESET); - msg=msg.replace("[ERUPTIONVAL]", DisplayChangedValue(df.format(35+calculateValue(ability,tier,fromlv))+ChatColor.RESET,df.format(35+calculateValue(ability,tier,tolv))+ChatColor.RESET)); - msg=msg.replace("[EARTHWAVEVAL]", DisplayChangedValue(df.format(20+calculateValue(ability,tier,fromlv))+ChatColor.RESET,df.format(20+calculateValue(ability,tier,tolv))+ChatColor.RESET)); - msg=msg.replace("[AOEVAL]", DisplayChangedValue(df.format(1+calculateValue(ability,tier,fromlv))+ChatColor.RESET,df.format(1+calculateValue(ability,tier,tolv))+ChatColor.RESET)); - msg=msg.replace("[POTVAL]", DisplayChangedValue(df.format(5+calculateValue(ability,tier,fromlv))+ChatColor.RESET,df.format(5+calculateValue(ability,tier,tolv))+ChatColor.RESET)); - msg=msg.replace("[GRACEFULVAL]", DisplayChangedValue(df.format(0.1+calculateValue(ability,tier,fromlv))+ChatColor.RESET,df.format(0.1+calculateValue(ability,tier,tolv))+ChatColor.RESET)); - msg=msg.replace("[FORCESTRIKEVAL]", DisplayChangedValue(df.format(60+calculateValue(ability,tier,fromlv))+ChatColor.RESET,df.format(60+calculateValue(ability,tier,tolv))+ChatColor.RESET)); + msg=msg.replace("[ERUPTIONVAL]", DisplayChangedValue(df.format(35+calculateValue(ability,tier,fromlv,pvp))+ChatColor.RESET,df.format(35+calculateValue(ability,tier,tolv,pvp))+ChatColor.RESET)); + msg=msg.replace("[EARTHWAVEVAL]", DisplayChangedValue(df.format(20+calculateValue(ability,tier,fromlv,pvp))+ChatColor.RESET,df.format(20+calculateValue(ability,tier,tolv,pvp))+ChatColor.RESET)); + msg=msg.replace("[AOEVAL]", DisplayChangedValue(df.format(1+calculateValue(ability,tier,fromlv,pvp))+ChatColor.RESET,df.format(1+calculateValue(ability,tier,tolv,pvp))+ChatColor.RESET)); + msg=msg.replace("[POTVAL]", DisplayChangedValue(df.format(5+calculateValue(ability,tier,fromlv,pvp))+ChatColor.RESET,df.format(5+calculateValue(ability,tier,tolv,pvp))+ChatColor.RESET)); + msg=msg.replace("[GRACEFULVAL]", DisplayChangedValue(df.format(0.1+calculateValue(ability,tier,fromlv,pvp))+ChatColor.RESET,df.format(0.1+calculateValue(ability,tier,tolv,pvp))+ChatColor.RESET)); + msg=msg.replace("[FORCESTRIKEVAL]", DisplayChangedValue(df.format(60+calculateValue(ability,tier,fromlv,pvp))+ChatColor.RESET,df.format(60+calculateValue(ability,tier,tolv,pvp))+ChatColor.RESET)); return msg; } @@ -721,5 +720,24 @@ public enum ArtifactAbility { static String DisplayBadChangedValue(String val1,String val2) { return ChatColor.DARK_RED+""+ChatColor.STRIKETHROUGH+val1+ChatColor.RESET+ChatColor.RED+val2+ChatColor.DARK_RED+ChatColor.BOLD+"v"+ChatColor.RESET; } + + public static double calculateValue(ArtifactAbility ab, int artifactTier, int enchantmentLevel, boolean pvp) { + double sum=0; + TwosideKeeper.log("Ability "+ab.GetName(), 4); + /*for(int i=0;i stringy, String searchfor) { + for (int i=0;i0) { ItemStack equip = equips_with_survivor.get((int)(Math.random()*equips_with_survivor.size())); //We can revive! - RevivePlayer(p, Math.min(p.getMaxHealth()*(getAbilityValue(ArtifactAbility.SURVIVOR,equip)/100d),p.getMaxHealth())); + RevivePlayer(p, Math.min(p.getMaxHealth()*(getAbilityValue(ArtifactAbility.SURVIVOR,equip,p)/100d),p.getMaxHealth())); ArtifactAbility.removeEnchantment(ArtifactAbility.SURVIVOR, equip); //AwakenedArtifact.setLV(equip, AwakenedArtifact.getLV(equip)-1, p); AwakenedArtifact.setMaxAP(equip, AwakenedArtifact.getMaxAP(equip)-1); @@ -3872,6 +3889,10 @@ public class GenericFunctions { } public static void RevivePlayer(Player p, double healdmg) { + RevivePlayer(p,healdmg,false); + } + + public static void RevivePlayer(Player p, double healdmg, boolean completeRespawn) { p.setHealth(Math.min(healdmg,p.getMaxHealth())); SoundUtils.playLocalSound(p, Sound.BLOCK_REDSTONE_TORCH_BURNOUT, 1.0f, 1.5f); for (PotionEffect eff : p.getActivePotionEffects()) { @@ -3882,11 +3903,22 @@ public class GenericFunctions { }, 1); } } + for (String s : Buff.getBuffData(p).keySet()) { + Buff b = Buff.getBuffData(p).get(s); + if (b.isDebuff()) { + /*TwosideKeeper.ScheduleRemoval(Buff.getBuffData(m), s); + return;*/ + Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{ + Buff.removeBuff(p, s); + }, 1); + } + } PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); pd.slayermodehp = Math.min(healdmg,p.getMaxHealth()); pd.vendetta_amt=0; pd.lastvendettastack=0; pd.thorns_amt=0; + pd.damagepool=0; p.setFireTicks(0); CustomDamage.addIframe(40, p); GenericFunctions.sendActionBarMessage(p, ""); @@ -3908,7 +3940,8 @@ public class GenericFunctions { //nearbyentities.addAll(); final double rangeSquared=range*range; for (Entity ent: l.getWorld().getNearbyEntities(l, range, range, range)) { - if (ent instanceof LivingEntity) { + if (ent instanceof LivingEntity && + l.getWorld().equals(ent.getWorld())) { //double damage_mult = 2.0d/(l.distance(nearbyentities.get(i).getLocation())+1.0); double dmg; double damage_mult=Math.max(0d, 1 - l.distanceSquared(ent.getLocation())/rangeSquared); @@ -4227,7 +4260,8 @@ public class GenericFunctions { for (int i=-x/2;i{ + Buff.removeBuff(p, key); + },1); p.sendMessage(ChatColor.DARK_GRAY+"You successfully resisted the application of "+ChatColor.WHITE+GenericFunctions.CapitalizeFirstLetters(b.getDisplayName().replace("_", " "))); } } @@ -4732,17 +4784,19 @@ public class GenericFunctions { } 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 { - GenericFunctions.addIFrame(player, 10); + if (!PVP.isPvPing(player)) { + 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(player, ItemSet.WOLFSBANE, 3)) { GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.SPEED, 100, 4, player); GenericFunctions.addSuppressionTime(target, (int)ItemSet.TotalBaseAmountBasedOnSetBonusCount(player, ItemSet.WOLFSBANE, 3, 3)); } if (ItemSet.HasSetBonusBasedOnSetBonusCount(player, ItemSet.WOLFSBANE, 7) && - target.getLocation().distanceSquared(originalloc)<=25) { + target!=null && originalloc!=null && 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) lore = item.getItemMeta().getLore(); for (int i=0;i tiermap = pd.itemsets.get(set.name()); for (Integer tier : tiermap.keySet()) { - val += set.GetBaseAmount(tier)*tiermap.get(tier); + val += set.GetBaseAmount(tier,p)*tiermap.get(tier); } } return val; @@ -345,62 +392,62 @@ public enum ItemSet { HashMap tiermap = pd.itemsets.get(set.name()); for (Integer tier : tiermap.keySet()) { if (tiermap.get(tier)>=count) { - amt+=ItemSet.GetBaseAmount(set, tier, set_bonus); + amt+=ItemSet.GetBaseAmount(set, tier, set_bonus, p); } } } return amt; } - public static Collection GenerateLore(ItemSet set, int tier) { + public static Collection GenerateLore(ItemSet set, int tier, Player p) { List lore = new ArrayList(); switch (set) { case PANROS:{ lore.add(ChatColor.LIGHT_PURPLE+"Striker Gear"); lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Panros Set"); - lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+" Damage"); + lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1, p)+" Damage"); }break; case SONGSTEEL:{ lore.add(ChatColor.LIGHT_PURPLE+"Defender Gear"); lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Songsteel Set"); - lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+"% Block Chance"); + lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1, p)+"% Block Chance"); }break; case DAWNTRACKER:{ lore.add(ChatColor.LIGHT_PURPLE+"Barbarian Gear"); lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Dawntracker Set"); - if (((ItemSet.GetBaseAmount(set, tier, 1))/3)>0) { - lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+" Health"); + if (((ItemSet.GetBaseAmount(set, tier, 1, p))/3)>0) { + lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1, p)+" Health"); } }break; case LORASYS:{ lore.add(ChatColor.LIGHT_PURPLE+"Slayer Gear"); lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Lorasys Set"); - lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+" Damage"); + lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1, p)+" Damage"); }break; case JAMDAK:{ lore.add(ChatColor.LIGHT_PURPLE+"Ranger Gear"); lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Jamdak Set"); - lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+"% Dodge Chance"); + lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1, p)+"% Dodge Chance"); }break; case DARNYS:{ lore.add(ChatColor.LIGHT_PURPLE+"Ranger Gear"); lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Darnys Set"); - lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+"% Dodge Chance"); + lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1, p)+"% Dodge Chance"); }break; case ALIKAHN:{ lore.add(ChatColor.LIGHT_PURPLE+"Ranger Gear"); lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Alikahn Set"); - lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+"% Dodge Chance"); + lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1, p)+"% Dodge Chance"); }break; case LORASAADI:{ lore.add(ChatColor.LIGHT_PURPLE+"Ranger Gear"); lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Lorasaadi Set"); - lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+"% Dodge Chance"); + lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1, p)+"% Dodge Chance"); }break; case GLADOMAIN:{ lore.add(ChatColor.LIGHT_PURPLE+"Slayer Amulet"); lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Gladomain Set"); - lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+" HP"); + lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1, p)+" HP"); lore.add(""); lore.add(ChatColor.GRAY+" Must be inserted into a "+ChatColor.BLUE+"Bauble Pouch"); lore.add(ChatColor.GRAY+" to benefit from the effects."); @@ -409,7 +456,7 @@ public enum ItemSet { case MOONSHADOW:{ lore.add(ChatColor.LIGHT_PURPLE+"Slayer Trinket"); lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Moonshadow Set"); - lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+"% Crit Damage"); + lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1, p)+"% Crit Damage"); lore.add(""); lore.add(ChatColor.GRAY+" Must be inserted into a "+ChatColor.BLUE+"Bauble Pouch"); lore.add(ChatColor.GRAY+" to benefit from the effects."); @@ -418,7 +465,7 @@ public enum ItemSet { case WOLFSBANE:{ lore.add(ChatColor.LIGHT_PURPLE+"Slayer Ornament"); lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Wolfsbane Set"); - lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+"% Critical Chance"); + lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1, p)+"% Critical Chance"); lore.add(""); lore.add(ChatColor.GRAY+" Must be inserted into a "+ChatColor.BLUE+"Bauble Pouch"); lore.add(ChatColor.GRAY+" to benefit from the effects."); @@ -427,7 +474,7 @@ public enum ItemSet { case ALUSTINE:{ lore.add(ChatColor.LIGHT_PURPLE+"Slayer Charm"); lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Alustine Set"); - lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+"% EXP Gain"); + lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1, p)+"% EXP Gain"); lore.add(""); lore.add(ChatColor.GRAY+" Must be inserted into a "+ChatColor.BLUE+"Bauble Pouch"); lore.add(ChatColor.GRAY+" to benefit from the effects."); @@ -436,102 +483,103 @@ public enum ItemSet { case BLITZEN: lore.add(ChatColor.BLUE+"Holiday Gear"); lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" "+GenericFunctions.CapitalizeFirstLetters(set.name())+" Set"); - lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+"% Attack Rate"); + lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1, p)+"% Attack Rate"); break; case COMET: lore.add(ChatColor.BLUE+"Holiday Gear"); lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" "+GenericFunctions.CapitalizeFirstLetters(set.name())+" Set"); - lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+"% Regeneration to Party Members"); + lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1, p)+"% Regeneration to Party Members"); break; case CUPID: lore.add(ChatColor.BLUE+"Holiday Gear"); lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" "+GenericFunctions.CapitalizeFirstLetters(set.name())+" Set"); - lore.add(ChatColor.YELLOW+"Absorbs "+ItemSet.GetBaseAmount(set, tier, 1)+"% of Damage Taken from Party Members"); + lore.add(ChatColor.YELLOW+"Absorbs "+ItemSet.GetBaseAmount(set, tier, 1, p)+"% of Damage Taken from Party Members"); break; case DANCER: lore.add(ChatColor.BLUE+"Holiday Gear"); lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" "+GenericFunctions.CapitalizeFirstLetters(set.name())+" Set"); - lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+" Damage per 1m of Movement Speed"); + DecimalFormat df = new DecimalFormat("0.00"); + lore.add(ChatColor.YELLOW+"+"+df.format(ItemSet.GetBaseAmount(set, tier, 1, p)/10d)+" Damage per 1m of Movement Speed"); break; case DASHER: lore.add(ChatColor.BLUE+"Holiday Gear"); lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" "+GenericFunctions.CapitalizeFirstLetters(set.name())+" Set"); - lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+"% Movement Speed"); + lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1, p)+"% Movement Speed"); break; case DONNER: lore.add(ChatColor.BLUE+"Holiday Gear"); lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" "+GenericFunctions.CapitalizeFirstLetters(set.name())+" Set"); - lore.add(ChatColor.YELLOW+"Attacking aggros enemies for "+ItemSet.GetBaseAmount(set, tier, 1)+" seconds"); + lore.add(ChatColor.YELLOW+"Attacking aggros enemies for "+ItemSet.GetBaseAmount(set, tier, 1, p)+" seconds"); break; case OLIVE: lore.add(ChatColor.BLUE+"Holiday Gear"); lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" "+GenericFunctions.CapitalizeFirstLetters(set.name())+" Set"); - lore.add(ChatColor.YELLOW+"When blocking, attackers take "+ItemSet.GetBaseAmount(set, tier, 1)+" True Damage"); + lore.add(ChatColor.YELLOW+"When blocking, attackers take "+ItemSet.GetBaseAmount(set, tier, 1, p)+" True Damage"); break; case PRANCER: lore.add(ChatColor.BLUE+"Holiday Gear"); lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" "+GenericFunctions.CapitalizeFirstLetters(set.name())+" Set"); - lore.add(ChatColor.YELLOW+"Deals +"+ItemSet.GetBaseAmount(set, tier, 1)+" Additional Damage in Mid-Air"); + lore.add(ChatColor.YELLOW+"Deals +"+ItemSet.GetBaseAmount(set, tier, 1, p)+" Additional Damage in Mid-Air"); break; case RUDOLPH: lore.add(ChatColor.BLUE+"Holiday Gear"); lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" "+GenericFunctions.CapitalizeFirstLetters(set.name())+" Set"); - lore.add(ChatColor.YELLOW+"In Dark Areas, gain "+ItemSet.GetBaseAmount(set, tier, 1)+"% Damage Reduction"); + lore.add(ChatColor.YELLOW+"In Dark Areas, gain "+ItemSet.GetBaseAmount(set, tier, 1, p)+"% Damage Reduction"); break; case VIXEN: lore.add(ChatColor.BLUE+"Holiday Gear"); lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" "+GenericFunctions.CapitalizeFirstLetters(set.name())+" Set"); - lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+"% Cooldown Reduction"); + lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1, p)+"% Cooldown Reduction"); break; case WINDRY: lore.add(ChatColor.LIGHT_PURPLE+"Striker Gear"); lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" "+GenericFunctions.CapitalizeFirstLetters(set.name())+" Set"); - lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+" Damage"); + lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1, p)+" Damage"); break; case ASSASSIN: lore.add(ChatColor.LIGHT_PURPLE+"Slayer Gear"); lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Assassin Set"); - lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+"% Cooldown Reduction"); + lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1, p)+"% Cooldown Reduction"); break; case LEGION: lore.add(ChatColor.LIGHT_PURPLE+"Barbarian Gear"); lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Legion Set"); - lore.add(ChatColor.YELLOW+"-"+ItemSet.GetBaseAmount(set, tier, 1)+"% Damage Pool Reduction"); + lore.add(ChatColor.YELLOW+"-"+ItemSet.GetBaseAmount(set, tier, 1, p)+"% Damage Pool Reduction"); break; case LUCI: lore.add(ChatColor.LIGHT_PURPLE+"Striker Gear"); lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Luci Set"); - lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+"% Damage Reduction"); + lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1, p)+"% Damage Reduction"); break; case PRIDE: lore.add(ChatColor.LIGHT_PURPLE+"Barbarian Gear"); lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Pride Set"); - lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+"% Lifesteal Stacks"); + lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1, p)+"% Lifesteal Stacks"); break; case PROTECTOR: lore.add(ChatColor.LIGHT_PURPLE+"Defender Gear"); lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Protector Set"); - lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+"% Damage Reduction"); + lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1, p)+"% Damage Reduction"); break; case SHARD: lore.add(ChatColor.LIGHT_PURPLE+"Ranger Gear"); lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Shard Set"); - lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+"% Dodge Chance"); + lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1, p)+"% Dodge Chance"); break; case STEALTH: lore.add(ChatColor.LIGHT_PURPLE+"Slayer Gear"); lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Stealth Set"); - lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+"% Movement Speed"); + lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1, p)+"% Movement Speed"); break; case SUSTENANCE: lore.add(ChatColor.LIGHT_PURPLE+"Defender Gear"); lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Sustenance Set"); - lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+" Health"); + lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1, p)+" Health"); break; case TOXIN: lore.add(ChatColor.LIGHT_PURPLE+"Ranger Gear"); lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Toxin Set"); - lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+"% Debuff Chance"); + lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1, p)+"% Debuff Chance"); break; } @@ -540,9 +588,9 @@ public enum ItemSet { switch (set) { case PANROS:{ lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); - lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+" Damage"); - lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+"% Dodge Chance"); - lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4)+"% Critical Chance"); + lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2, p)+" Damage"); + lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3, p)+"% Dodge Chance"); + lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4, p)+"% Critical Chance"); lore.add(ChatColor.DARK_AQUA+" 5 - "+ABILITY_LABEL+" Powered Line Drive"+ABILITY_LABEL_END); lore.add(ChatColor.WHITE+" +50% Armor Penetration"); lore.add(ChatColor.WHITE+" +15 Damage"); @@ -556,9 +604,9 @@ public enum ItemSet { lore.add(ABILITY_LABEL+"Rejuvenation"+ABILITY_LABEL_END+" by 2 seconds."); lore.add(ChatColor.WHITE+""+ChatColor.ITALIC+""); 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 Health (30 seconds)"); - lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4)+"% Damage Reduction"); + lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2, p)+" Max Health"); + lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3, p)+" Absorption Health (30 seconds)"); + lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4, p)+"% Damage Reduction"); lore.add(ChatColor.DARK_AQUA+" 5 - "+ABILITY_LABEL+" Vendetta"+ABILITY_LABEL_END); lore.add(ChatColor.GRAY+" Blocking stores 40% of mitigation damage."); lore.add(ChatColor.GRAY+" 1% of damage is stored as thorns true damage."); @@ -569,9 +617,9 @@ public enum ItemSet { }break; case DAWNTRACKER:{ lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); - lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+"% Debuff Resistance"); - lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+"% Lifesteal"); - lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4)+" Max Health"); + lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2, p)+"% Debuff Resistance"); + lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3, p)+"% Lifesteal"); + lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4, p)+" Max Health"); lore.add(ChatColor.DARK_AQUA+" 5 - +50% Armor Penetration"); lore.add(ChatColor.WHITE+" +15 Damage"); lore.add(ChatColor.WHITE+" "+ABILITY_LABEL+" Powered Mock"+ABILITY_LABEL_END); @@ -611,10 +659,10 @@ public enum ItemSet { }break; case JAMDAK: { lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); - lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+"% Dodge Chance"); - lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+"% Dodge Chance"); - lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+(ItemSet.GetBaseAmount(set, tier, 4)/20d)+"s Graceful Dodge"); - lore.add(ChatColor.GRAY+" Gives you invulnerability and "+(ItemSet.GetBaseAmount(set, tier, 4)/4)+" absorption"); + lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2, p)+"% Dodge Chance"); + lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3, p)+"% Dodge Chance"); + lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+(ItemSet.GetBaseAmount(set, tier, 4, p)/20d)+"s Graceful Dodge"); + lore.add(ChatColor.GRAY+" Gives you invulnerability and "+(ItemSet.GetBaseAmount(set, tier, 4, p)/4)+" absorption"); lore.add(ChatColor.GRAY+" health for each successful dodge."); lore.add(ChatColor.DARK_AQUA+" 5 - "+ABILITY_LABEL+" Boosts All Modes of Ranger"+ABILITY_LABEL_END); lore.add(ChatColor.WHITE+" +50% Armor Penetration"); @@ -625,11 +673,11 @@ public enum ItemSet { }break; case DARNYS: { lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); - lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+"% Damage Reduction"); - lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+"% Damage Reduction"); - lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" Swift Aegis "+WorldShop.toRomanNumeral(ItemSet.GetBaseAmount(set, tier, 4))); - lore.add(ChatColor.GRAY+" Builds "+ItemSet.GetBaseAmount(set, tier, 4)+" stack"+((ItemSet.GetBaseAmount(set, tier, 4))!=1?"s":"")+" of Resist"); - lore.add(ChatColor.GRAY+" ("+(ItemSet.GetBaseAmount(set, tier, 4)*10)+"% Damage Reduction) every 5 seconds of sprinting,"); + lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2, p)+"% Damage Reduction"); + lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3, p)+"% Damage Reduction"); + lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" Swift Aegis "+WorldShop.toRomanNumeral(ItemSet.GetBaseAmount(set, tier, 4, p))); + lore.add(ChatColor.GRAY+" Builds "+ItemSet.GetBaseAmount(set, tier, 4, p)+" stack"+((ItemSet.GetBaseAmount(set, tier, 4, p))!=1?"s":"")+" of Resist"); + lore.add(ChatColor.GRAY+" ("+(ItemSet.GetBaseAmount(set, tier, 4, p)*10)+"% Damage Reduction) every 5 seconds of sprinting,"); lore.add(ChatColor.GRAY+" and with every Tumble. Each hit taken removes one"); lore.add(ChatColor.GRAY+" stack of Resist. Caps at Resist 10. Lasts 20 seconds."); lore.add(ChatColor.DARK_AQUA+" 5 - "+ABILITY_LABEL+" Boosts All Modes of Ranger"+ABILITY_LABEL_END); @@ -641,9 +689,9 @@ public enum ItemSet { }break; case ALIKAHN: { 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)+" Max Health"); - lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4)+" Regen / 5 seconds"); + lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2, p)+" Max Health"); + lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3, p)+" Max Health"); + lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4, p)+" Regen / 5 seconds"); lore.add(ChatColor.DARK_AQUA+" 5 - "+ABILITY_LABEL+" Boosts All Modes of Ranger"+ABILITY_LABEL_END); lore.add(ChatColor.WHITE+" +50% Armor Penetration"); lore.add(ChatColor.WHITE+" +15 Damage"); @@ -653,9 +701,9 @@ public enum ItemSet { }break; case LORASAADI:{ lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); - lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+" Damage"); - lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+" Damage"); - lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4)+" Execution Damage"); + lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2, p)+" Damage"); + lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3, p)+" Damage"); + lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4, p)+" Execution Damage"); lore.add(ChatColor.DARK_AQUA+" per 20% Missing Health"); lore.add(ChatColor.DARK_AQUA+" 5 - "+ABILITY_LABEL+" Boosts All Modes of Ranger"+ABILITY_LABEL_END); lore.add(ChatColor.WHITE+" +50% Armor Penetration"); @@ -666,8 +714,8 @@ public enum ItemSet { }break; case GLADOMAIN:{ lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); - lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+"% Cooldown Reduction"); - lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+"% Dodge Chance"); + lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2, p)+"% Cooldown Reduction"); + lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3, p)+"% Dodge Chance"); lore.add(ChatColor.DARK_AQUA+" 5 - "+ChatColor.WHITE+" Life Saver "); lore.add(ChatColor.GRAY+" When about to be killed, puts you into"); lore.add(ChatColor.GRAY+" stealth, applies Speed IV for 10 seconds, adds"); @@ -678,14 +726,14 @@ public enum ItemSet { lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"A successful Assassination grants 100%"); lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Critical Strike Chance and 100% Dodge"); lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"chance for the next hit. Dodge Chance"); - lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"increases by +"+(5+ItemSet.GetBaseAmount(set, tier, 4))+"% per 1m/sec of movement"); + lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"increases by +"+(5+ItemSet.GetBaseAmount(set, tier, 4, p))+"% per 1m/sec of movement"); lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"speed."); }break; case MOONSHADOW:{ lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); - lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" Applies Poison "+WorldShop.toRomanNumeral(ItemSet.GetBaseAmount(set, tier, 2))+ChatColor.GRAY+" (0:15)"); - lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+"% Damage"); - lore.add(ChatColor.DARK_AQUA+" 5 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4)+"% Critical Chance"); + lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" Applies Poison "+WorldShop.toRomanNumeral(ItemSet.GetBaseAmount(set, tier, 2, p))+ChatColor.GRAY+" (0:15)"); + lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3, p)+"% Damage"); + lore.add(ChatColor.DARK_AQUA+" 5 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4, p)+"% Critical Chance"); lore.add(ChatColor.DARK_AQUA+" 7 - "+ChatColor.WHITE+" Provides the Following Bonuses:"); lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Strength Cap Increases to 40. 2 Stacks per kill."); lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Successful Assassinations apply damage"); @@ -697,10 +745,10 @@ public enum ItemSet { }break; case WOLFSBANE:{ lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); - lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" Recovers "+ItemSet.GetBaseAmount(set, tier, 2)+"% Cooldown on Assassination per kill"); + lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" Recovers "+ItemSet.GetBaseAmount(set, tier, 2, p)+"% Cooldown on Assassination per kill"); lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" Applies Speed V when Assassination is casted. Suppresses"); - lore.add(ChatColor.DARK_AQUA+" "+ChatColor.WHITE+" the target for "+(ItemSet.GetBaseAmount(set, tier, 3)/20d)+"s"); - lore.add(ChatColor.DARK_AQUA+" 5 - "+ChatColor.WHITE+" Gain "+(ItemSet.GetBaseAmount(set, tier, 4)/20d)+" seconds of invulnerability after"); + lore.add(ChatColor.DARK_AQUA+" "+ChatColor.WHITE+" the target for "+(ItemSet.GetBaseAmount(set, tier, 3, p)/20d)+"s"); + lore.add(ChatColor.DARK_AQUA+" 5 - "+ChatColor.WHITE+" Gain "+(ItemSet.GetBaseAmount(set, tier, 4, p)/20d)+" seconds of invulnerability after"); lore.add(ChatColor.DARK_AQUA+" "+ChatColor.WHITE+" Assassination is casted."); lore.add(ChatColor.DARK_AQUA+" 7 - "+ChatColor.WHITE+" Provides the Following Bonuses:"); lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Backstabs heal 2 HP (1 Heart). Assassination cooldown reduced"); @@ -709,13 +757,13 @@ public enum ItemSet { case ALUSTINE:{ lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" Gain immunity to Explosions."); - lore.add(ChatColor.DARK_AQUA+" "+ChatColor.WHITE+" Consumes "+ChatColor.YELLOW+ItemSet.GetBaseAmount(set, tier, 2)+" XP"+ChatColor.WHITE+" per absorbed hit."); - lore.add(ChatColor.DARK_AQUA+" "+ChatColor.GRAY+ChatColor.ITALIC+"Must have at least "+ChatColor.YELLOW+ChatColor.ITALIC+ItemSet.GetBaseAmount(set, tier, 2)+" XP"+ChatColor.GRAY+ChatColor.ITALIC+" to trigger."); + lore.add(ChatColor.DARK_AQUA+" "+ChatColor.WHITE+" Consumes "+ChatColor.YELLOW+ItemSet.GetBaseAmount(set, tier, 2, p)+" XP"+ChatColor.WHITE+" per absorbed hit."); + lore.add(ChatColor.DARK_AQUA+" "+ChatColor.GRAY+ChatColor.ITALIC+"Must have at least "+ChatColor.YELLOW+ChatColor.ITALIC+ItemSet.GetBaseAmount(set, tier, 2, p)+" XP"+ChatColor.GRAY+ChatColor.ITALIC+" to trigger."); lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" Resists all fire, poison, bleeding, infection and wither damage."); - lore.add(ChatColor.DARK_AQUA+" "+ChatColor.WHITE+" Consumes "+ChatColor.YELLOW+ItemSet.GetBaseAmount(set, tier, 3)+" XP"+ChatColor.WHITE+" per absorbed hit."); - lore.add(ChatColor.DARK_AQUA+" "+ChatColor.GRAY+ChatColor.ITALIC+"Must have at least "+ChatColor.YELLOW+ChatColor.ITALIC+ItemSet.GetBaseAmount(set, tier, 3)+" XP"+ChatColor.GRAY+ChatColor.ITALIC+" to trigger."); - lore.add(ChatColor.DARK_AQUA+" 5 - "+ChatColor.WHITE+" Backstabs spill "+ChatColor.YELLOW+ItemSet.GetBaseAmount(set, tier, 4)+" XP"+ChatColor.WHITE+" out from the target hit."); - lore.add(ChatColor.DARK_AQUA+" "+ChatColor.WHITE+" Collecting experience has a "+Math.min((ItemSet.GetBaseAmount(set, tier, 4)/20d)*100d,100)+"% chance"); + lore.add(ChatColor.DARK_AQUA+" "+ChatColor.WHITE+" Consumes "+ChatColor.YELLOW+ItemSet.GetBaseAmount(set, tier, 3, p)+" XP"+ChatColor.WHITE+" per absorbed hit."); + lore.add(ChatColor.DARK_AQUA+" "+ChatColor.GRAY+ChatColor.ITALIC+"Must have at least "+ChatColor.YELLOW+ChatColor.ITALIC+ItemSet.GetBaseAmount(set, tier, 3, p)+" XP"+ChatColor.GRAY+ChatColor.ITALIC+" to trigger."); + lore.add(ChatColor.DARK_AQUA+" 5 - "+ChatColor.WHITE+" Backstabs spill "+ChatColor.YELLOW+ItemSet.GetBaseAmount(set, tier, 4, p)+" XP"+ChatColor.WHITE+" out from the target hit."); + lore.add(ChatColor.DARK_AQUA+" "+ChatColor.WHITE+" Collecting experience has a "+Math.min((ItemSet.GetBaseAmount(set, tier, 4, p)/20d)*100d,100)+"% chance"); lore.add(ChatColor.DARK_AQUA+" "+ChatColor.WHITE+" to restore 2 HP (1 Heart)."); lore.add(ChatColor.DARK_AQUA+" 7 - "+ChatColor.WHITE+" Provides the Following Bonuses:"); lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Deals true damage equal to the number"); @@ -724,16 +772,16 @@ public enum ItemSet { }break; case BLITZEN: lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); - lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+" Damage"); - lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+" Health"); + lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2, p)+" Damage"); + lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3, p)+" Health"); lore.add(ChatColor.DARK_AQUA+" 4 - "+ABILITY_LABEL+" Storm Onward!"+ABILITY_LABEL_END); lore.add(ChatColor.GRAY+" Attacks occasionally send Lightning bolts"); lore.add(ChatColor.GRAY+" down on foes dealing true damage."); break; case COMET: lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); - lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+" Health"); - lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+" Damage"); + lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2, p)+" Health"); + lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3, p)+" Damage"); lore.add(ChatColor.DARK_AQUA+" 4 - "+ABILITY_LABEL+" More Health For You"+ABILITY_LABEL_END); lore.add(ChatColor.GRAY+" Right-Clicking players will take away"); lore.add(ChatColor.GRAY+" 10% of your health to heal 20% of"); @@ -741,8 +789,8 @@ public enum ItemSet { break; case CUPID: lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); - lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+" Health"); - lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+" Damage"); + lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2, p)+" Health"); + lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3, p)+" Damage"); lore.add(ChatColor.DARK_AQUA+" 4 - "+ABILITY_LABEL+" Linked for Life"+ABILITY_LABEL_END); lore.add(ChatColor.GRAY+" Right-Clicking players will link yourself"); lore.add(ChatColor.GRAY+" to them. Teleporting via any means sends"); @@ -750,55 +798,55 @@ public enum ItemSet { break; case DANCER: lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); - lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+" Damage"); - lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+" Health"); + lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2, p)+" Damage"); + lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3, p)+" Health"); lore.add(ChatColor.DARK_AQUA+" 4 - "+ABILITY_LABEL+" Can't Catch Me!"+ABILITY_LABEL_END); lore.add(ChatColor.GRAY+" Changing your movement direction constantly"); lore.add(ChatColor.GRAY+" makes you invulnerable to incoming attacks."); break; case DASHER: lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); - lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+" Damage"); - lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+" Health"); + lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2, p)+" Damage"); + lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3, p)+" Health"); lore.add(ChatColor.DARK_AQUA+" 4 - "+ABILITY_LABEL+" Marathon Runner"+ABILITY_LABEL_END); lore.add(ChatColor.GRAY+" Sprinting will restore missing hunger."); break; case DONNER: lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); - lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+" Health"); - lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+" Damage"); + lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2, p)+" Health"); + lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3, p)+" Damage"); lore.add(ChatColor.DARK_AQUA+" 4 - "+ABILITY_LABEL+" Come At Me"+ABILITY_LABEL_END); lore.add(ChatColor.GRAY+" Monsters attacking your party members"); lore.add(ChatColor.GRAY+" will automatically be provoked to you."); break; case OLIVE: lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); - lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+" Health"); - lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+" Damage"); + lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2, p)+" Health"); + lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3, p)+" Damage"); lore.add(ChatColor.DARK_AQUA+" 4 - "+ABILITY_LABEL+" Right Back At You"+ABILITY_LABEL_END); lore.add(ChatColor.GRAY+" Gain 20 Absorption Health each time"); lore.add(ChatColor.GRAY+" damage is taken. (30 sec cooldown)"); break; case PRANCER: lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); - lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+" Damage"); - lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+" Health"); + lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2, p)+" Damage"); + lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3, p)+" Health"); lore.add(ChatColor.DARK_AQUA+" 4 - "+ABILITY_LABEL+" Will You Just Sit Down?"+ABILITY_LABEL_END); lore.add(ChatColor.GRAY+" Your next strike ignores 50% of the"); lore.add(ChatColor.GRAY+" target's armor. (10 sec cooldown)"); break; case RUDOLPH: lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); - lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+" Health"); - lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+" Damage"); + lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2, p)+" Health"); + lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3, p)+" Damage"); lore.add(ChatColor.DARK_AQUA+" 4 - "+ABILITY_LABEL+" Light the Way"+ABILITY_LABEL_END); lore.add(ChatColor.GRAY+" You and your party gain Permanent"); lore.add(ChatColor.GRAY+" Night Vision."); break; case VIXEN: lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); - lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+" Damage"); - lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+" Health"); + lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2, p)+" Damage"); + lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3, p)+" Health"); lore.add(ChatColor.DARK_AQUA+" 4 - "+ABILITY_LABEL+" Untouchable, Unkillable"+ABILITY_LABEL_END); lore.add(ChatColor.GRAY+" Increases Dodge Chance by 20%. Dodging"); lore.add(ChatColor.GRAY+" successfully restores 10% of your max"); @@ -808,9 +856,9 @@ public enum ItemSet { lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Attacks build up "+WINDCHARGE_PLURAL_LABEL+"."); lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+" "+WINDCHARGE_PLURAL_LABEL+" cap at "+(tier*10)+" stacks"); - lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+" "+(ItemSet.GetBaseAmount(set, tier, 2)!=1?WINDCHARGE_PLURAL_LABEL:WINDCHARGE_LABEL)+" per hit"); - lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+"% Armor Pen per "+WINDCHARGE_LABEL); - lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4)+"% Critical Chance per "+WINDCHARGE_LABEL); + lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2, p)+" "+(ItemSet.GetBaseAmount(set, tier, 2, p)!=1?WINDCHARGE_PLURAL_LABEL:WINDCHARGE_LABEL)+" per hit"); + lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3, p)+"% Armor Pen per "+WINDCHARGE_LABEL); + lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4, p)+"% Critical Chance per "+WINDCHARGE_LABEL); lore.add(ChatColor.DARK_AQUA+" 5 - "+ABILITY_LABEL+" Wind Slash"+ABILITY_LABEL_END); lore.add(ChatColor.GRAY+" Press the drop key to send a Wind Slash forward,"); lore.add(ChatColor.GRAY+" knocking up all targets hit and dealing "+tier); @@ -853,10 +901,10 @@ public enum ItemSet { break; case LEGION: lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); - lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+"% Lifesteal"); - lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+"% Damage per 10 Weapon Charges"); - lore.add(ChatColor.AQUA+" ( Max. 200 stacks - "+(ItemSet.GetBaseAmount(set, tier, 3)*20)+"% Damage )"); - lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4)+"% Damage per 100 Damage Pool Stacks"); + lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2, p)+"% Lifesteal"); + lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3, p)+"% Damage per 10 Weapon Charges"); + lore.add(ChatColor.AQUA+" ( Max. 200 stacks - "+(ItemSet.GetBaseAmount(set, tier, 3, p)*20)+"% Damage )"); + lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4, p)+"% Damage per 100 Damage Pool Stacks"); lore.add(ChatColor.DARK_AQUA+" 5 - "+ABILITY_LABEL+" Undying Rage"+ABILITY_LABEL_END); lore.add(ChatColor.GRAY+" When taking fatal damage, removes all Damage"); lore.add(ChatColor.GRAY+" Pool stacks and prevents your health from"); @@ -873,10 +921,10 @@ public enum ItemSet { break; case LUCI: lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); - lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+"% Dodge Chance"); - lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" Adds "+ItemSet.GetBaseAmount(set, tier, 3)+"% Damage"); + lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2, p)+"% Dodge Chance"); + lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" Adds "+ItemSet.GetBaseAmount(set, tier, 3, p)+"% Damage"); lore.add(ChatColor.DARK_AQUA+" "+ChatColor.GRAY+" for every 1% Dodge Chance"); - lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" Adds "+ItemSet.GetBaseAmount(set, tier, 4)+"% Damage"); + lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" Adds "+ItemSet.GetBaseAmount(set, tier, 4, p)+"% Damage"); lore.add(ChatColor.DARK_AQUA+" "+ChatColor.GRAY+" for every 1% Damage Reduction"); lore.add(ChatColor.DARK_AQUA+" 5 - "+ABILITY_LABEL+" Beast Within"+ABILITY_LABEL_END); lore.add(ChatColor.GRAY+" Press the drop key to obtain a buff lasting "+(tier+BEASTWITHIN_DURATION)); @@ -892,12 +940,12 @@ public enum ItemSet { break; case PRIDE: lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); - lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+(ItemSet.GetBaseAmount(set, tier, 2)/2)+" Weapon Charges when left-clicking."); + lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+(ItemSet.GetBaseAmount(set, tier, 2, p)/2)+" Weapon Charges when left-clicking."); lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" "+ABILITY_LABEL+"Power Swing"+ABILITY_LABEL_END+" (Right-Click) provides double"); lore.add(" "+ChatColor.WHITE+" the lifesteal stacks and increases Regeneration"); - lore.add(" "+ChatColor.WHITE+" level by "+ItemSet.GetBaseAmount(set, tier, 3)+" for 15 seconds. (Max. 10 Levels)"); + lore.add(" "+ChatColor.WHITE+" level by "+ItemSet.GetBaseAmount(set, tier, 3, p)+" for 15 seconds. (Max. 10 Levels)"); lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" "+ABILITY_LABEL+"Forceful Strike"+ABILITY_LABEL_END+" (Shift+Left-Click) applies"); - lore.add(" "+ChatColor.WHITE+" Poison "+ItemSet.GetBaseAmount(set, tier, 4)+" to everything it hits for 15 seconds."); + lore.add(" "+ChatColor.WHITE+" Poison "+ItemSet.GetBaseAmount(set, tier, 4, p)+" to everything it hits for 15 seconds."); lore.add(ChatColor.DARK_AQUA+" 5 - "+ChatColor.WHITE+" "+ABILITY_LABEL+"Sweep Up"+ABILITY_LABEL_END+" (Shift+Right-Click) heals"); lore.add(" "+ChatColor.WHITE+" half the health it deals as HP directly."); lore.add(ChatColor.GRAY+" "); @@ -912,10 +960,10 @@ public enum ItemSet { lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+PlayerMode.SLAYER.getColor()+PlayerMode.SLAYER.getName()+"s"+ChatColor.GOLD+" do not benefit from party effects"); lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"of this set. "+PlayerMode.RANGER.getColor()+PlayerMode.RANGER.getName()+"s"+ChatColor.GOLD+" receive only half the effects."); lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); - lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+"% Damage Reduction to other party members"); - lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+" Health to other party members."); + lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2, p)+"% Damage Reduction to other party members"); + lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3, p)+" Health to other party members."); lore.add(ChatColor.DARK_AQUA+" 4 - "+ABILITY_LABEL+" Reinforce"+ABILITY_LABEL_END+" - Each hit taken restores"); - lore.add(" "+ChatColor.WHITE+" "+ItemSet.GetBaseAmount(set, tier, 4)+" Health to other party members."); + lore.add(" "+ChatColor.WHITE+" "+ItemSet.GetBaseAmount(set, tier, 4, p)+" Health to other party members."); lore.add(ChatColor.DARK_AQUA+" 5 - "+ABILITY_LABEL+" Unstoppable Team"+ABILITY_LABEL_END); lore.add(ChatColor.GRAY+" Press the swap item key to channel for 3 seconds,"); lore.add(ChatColor.GRAY+" creating a "+(tier*20)+" Health shield for 30"); @@ -928,9 +976,9 @@ public enum ItemSet { break; case SHARD: lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); - lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+"% Headshot Damage"); - lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+"% Critical Damage"); - lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4)+" Health"); + lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2, p)+"% Headshot Damage"); + lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3, p)+"% Critical Damage"); + lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4, p)+" Health"); lore.add(ChatColor.DARK_AQUA+" 5 - "+ABILITY_LABEL+" Shrapnel Bombs"+ABILITY_LABEL_END); lore.add(ChatColor.GRAY+" When projectiles land or hit a target, they explode"); lore.add(ChatColor.GRAY+" into shrapnel, dealing damage to all nearby targets"); @@ -969,11 +1017,11 @@ public enum ItemSet { break; case SUSTENANCE: lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); - lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+" to Regeneration Pool every hit taken"); - lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+" Regeneration Level"+(ItemSet.GetBaseAmount(set, tier, 3)==1?"":"s")+" per hit"); + lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2, p)+" to Regeneration Pool every hit taken"); + lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3, p)+" Regeneration Level"+(ItemSet.GetBaseAmount(set, tier, 3, p)==1?"":"s")+" per hit"); lore.add(ChatColor.GRAY+" (Max. Regeneration "+WorldShop.toRomanNumeral(Math.min(2*tier,10))+")"); lore.add(ChatColor.GRAY+" Decays at 1 Regeneration Level per second."); - lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4)+"% Healing per Regeneration tick"); + lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4, p)+"% Healing per Regeneration tick"); lore.add(ChatColor.DARK_AQUA+" 5 - "+ABILITY_LABEL+" Share the Life"+ABILITY_LABEL_END); lore.add(ChatColor.GRAY+" Increases the Regeneration Pool for other party"); lore.add(ChatColor.GRAY+" members by "+(tier)+" whenever you get hit."); @@ -983,13 +1031,13 @@ public enum ItemSet { break; case TOXIN: lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); - lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+"% Chance of projectiles applying Bleeding "+WorldShop.toRomanNumeral(tier)+" to target (15 sec)."); + lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2, p)+"% Chance of projectiles applying Bleeding "+WorldShop.toRomanNumeral(tier)+" to target (15 sec)."); lore.add(ChatColor.GRAY+" (Bleed deals faster damage over time compared to Poison."); lore.add(ChatColor.GRAY+" it is not affected by Poison Resistance.)"); - lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+"% Chance of projectiles applying Infection "+WorldShop.toRomanNumeral(tier)+" to target (10 sec)."); + lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3, p)+"% Chance of projectiles applying Infection "+WorldShop.toRomanNumeral(tier)+" to target (10 sec)."); lore.add(ChatColor.GRAY+" (Infection deals damage over time and applies all debuffs"); lore.add(ChatColor.GRAY+" this target has to nearby targets.)"); - lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4)+"% Chance of projectiles applying Cripple "+WorldShop.toRomanNumeral(tier)+" to target (10 sec)."); + lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4, p)+"% Chance of projectiles applying Cripple "+WorldShop.toRomanNumeral(tier)+" to target (10 sec)."); lore.add(ChatColor.GRAY+" (Cripple slows the target and decreases target's damage"); lore.add(ChatColor.GRAY+" output by 10% per level.)"); lore.add(ChatColor.DARK_AQUA+" 5 - "+ABILITY_LABEL+" Fire Cesspool"+ABILITY_LABEL_END); @@ -1139,7 +1187,11 @@ public enum ItemSet { } } } - return highest; + if (PVP.isPvPing(p)) { + return 1; + } else { + return highest; + } } /** @@ -1176,10 +1228,26 @@ public enum ItemSet { HashMap tiermap = pd.itemsets.get(set.name()); for (Integer tier : tiermap.keySet()) { for (int i=0;i losers = new ArrayList(); PVPOption style; PVPOption battlefield; + PVPArena currentArena; CHOICEENGINE state; + public static List arenas; long timer; private long lastSelected=0; int scorelimit; @@ -34,6 +44,9 @@ public class PVP { long timelimit; long nextRoundTime=0; boolean scorematch = false; //If true, uses score limit. If false uses timer. + BossBar matchTimer = null; + int duration = 0; + boolean isTeamMatch=false; //NEUTRAL team //Team1 @@ -42,9 +55,11 @@ public class PVP { public PVP(Player...players) { for (Player p : players) { this.players.put(p.getName(),new PVPPlayer()); + //Bukkit.getServer().broadcastMessage(ChatColor.GREEN+"Waiting for any additional players to join the PVP Match..."); + //Bukkit.getServer().broadcastMessage(ChatColor.GREEN+"Players must click on "+getParticipants()+" to join in."); p.sendMessage(ChatColor.GREEN+"Waiting for any additional players to join the PVP Match..."); - p.sendMessage(ChatColor.GREEN+"Players must click on a participant to join in."); } + Bukkit.getServer().broadcastMessage(ChatColor.GREEN+"A new PvP Match Request is underway. Click on "+getParticipants(true)+" to join in."); state = CHOICEENGINE.WAITFORPLAYERS; timer = TwosideKeeper.getServerTickTime(); } @@ -67,19 +82,19 @@ public class PVP { private void leaveMatch(String s) { TwosideKeeper.ScheduleRemoval(players,s); - Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{ - for (String ss : players.keySet()) { - Player pl = Bukkit.getPlayer(ss); - if (pl!=null && pl.isValid() && pl.isOnline()) { - pl.sendMessage(ChatColor.YELLOW+ss+" has left the match. Current Participants: "+ChatColor.YELLOW+getParticipants()); - } else { - leaveMatch(ss); - } + for (String ss : players.keySet()) { + Player pl = Bukkit.getPlayer(ss); + if (pl!=null && pl.isValid() && pl.isOnline() && !s.equalsIgnoreCase(ss)) { + pl.sendMessage(ChatColor.YELLOW+ss+" has left the match. Current Participants: "+ChatColor.YELLOW+getParticipants()); } - }, 2); + } } private String getParticipants() { + return getParticipants(false); + } + + private String getParticipants(boolean OR) { StringBuilder sb = new StringBuilder(""); int count=0; for (String s : players.keySet()) { @@ -87,11 +102,11 @@ public class PVP { sb.append(s); } else { if (players.size()==2) { - sb.append(" and "); + sb.append(" "+(OR?"or":"and")+" "); sb.append(s); } else { if (count+1==players.size()) { - sb.append(", and "); + sb.append(", "+(OR?"or":"and")+" "); sb.append(s); } else { sb.append(", "); @@ -105,6 +120,9 @@ public class PVP { } public boolean runTick() { + removeInactivePlayers(); + moveToActiveSpectatorTarget(); + movePlayersOutsideArenaBackIn(); switch (state) { /*case ACCEPTREQUEST:{ if (timer+200<=TwosideKeeper.getServerTickTime()) { @@ -157,6 +175,7 @@ public class PVP { } if (players.size()>2 && style.name().contains("ROUNDS")) { state = CHOICEENGINE.WAITFORTEAMCHOICES; + isTeamMatch=true; lastSelected=TwosideKeeper.getServerTickTime(); resetPlayerChoices(); DisplayTeamChoices(); @@ -200,26 +219,38 @@ public class PVP { case WAITFORSTAGECHOICES:{ if (timer+400<=TwosideKeeper.getServerTickTime() || allPlayersPicked()) { if (players.size()>=2) { - List choices = new ArrayList(); + List choices = new ArrayList(); for (String s : players.keySet()) { if (players.containsKey(s)) { PVPPlayer pp = players.get(s); + if (pp.arenaChoice!=-1) { + choices.add(pp.arenaChoice); + } else if (pp.choice!=PVPOption.NONE) { choices.add(pp.choice); } } } if (choices.size()==0) { - PVPOption[] options = new PVPOption[]{PVPOption.OPENWORLD,PVPOption.SMALLBATTLEFIELD, - PVPOption.AQUATICFORT,PVPOption.NETHERFORTRESS,PVPOption.THEEND}; + PVPOption[] options = new PVPOption[]{PVPOption.OPENWORLD}; battlefield = options[(int)(Math.random()*options.length)]; } else { - battlefield = choices.get((int)(Math.random()*choices.size())); + int choice = (int)(Math.random()*choices.size()); + if (choices.get(choice) instanceof PVPOption) { + battlefield = PVPOption.OPENWORLD; + currentArena=null; + } else { + currentArena = arenas.get((Integer)(choices.get(choice))); + } } for (String s : players.keySet()) { Player p = Bukkit.getPlayer(s); if (p!=null && p.isValid() && p.isOnline()) { - p.sendMessage(ChatColor.YELLOW+battlefield.getTitle()+ChatColor.GREEN+" has been voted as the battlefield for this PVP match!"); + if (currentArena==null) { + p.sendMessage(ChatColor.YELLOW+battlefield.getTitle()+ChatColor.GREEN+" has been voted as the battlefield for this PVP match!"); + } else { + p.sendMessage(ChatColor.YELLOW+currentArena.getArenaName()+ChatColor.GREEN+" has been voted as the battlefield for this PVP match!"); + } } } state = CHOICEENGINE.PREPAREFORBATTLE; @@ -250,14 +281,20 @@ public class PVP { } }break; case FIGHTING:{ - removeInactivePlayers(); + updateBar(); if (conditionsToWin() || notEnoughPlayers()) { - StringBuilder sb = PrepareCurrentScores(); - Bukkit.getServer().broadcastMessage(sb.toString()); - aPlugin.API.discordSendRaw("```"+sb.toString()+"```"); + if (players.size()>0) { + StringBuilder sb = PrepareCurrentScores(); + Bukkit.getServer().broadcastMessage(sb.toString()); + aPlugin.API.discordSendRaw("```"+sb.toString()+"```"); + } computeWinner(); + TwosideKeeper.log("Players: "+players, 1); announceWinner(); resetTeams(); + if (matchTimer!=null) { + matchTimer.removeAll(); + } return false; } else { setupNextRound(); @@ -274,6 +311,65 @@ public class PVP { return true; } + private void movePlayersOutsideArenaBackIn() { + if (currentArena!=null) { + for (String s : players.keySet()) { + PVPPlayer pp = players.get(s); + Player p = Bukkit.getPlayer(s); + if (p!=null && pp.isAlive) { + if (!currentArena.insideBounds(p.getLocation())) { + p.teleport(currentArena.pickRandomLocation()); + p.sendMessage(ChatColor.RED+"You cannot leave the arena!"); + } + } + } + } + } + + private void moveToActiveSpectatorTarget() { + for (String s : players.keySet()) { + Player p = Bukkit.getPlayer(s); + if (p!=null && p.getGameMode()==GameMode.SPECTATOR) { + //This is a spectator. Verify if they are watching an alive target. + if (p.getSpectatorTarget()!=null && + p.getSpectatorTarget() instanceof Player) { + Player watching = (Player)p.getSpectatorTarget(); + if (watching.isDead() && (players.containsKey(watching.getName()) && + !players.get(watching.getName()).isAlive)) { + ChooseNewSpectatorTarget(p); + } + } else { + ChooseNewSpectatorTarget(p); + } + } + } + } + + private void ChooseNewSpectatorTarget(Player p) { + for (String s : players.keySet()) { + PVPPlayer pp = players.get(s); + if (pp.isAlive && Bukkit.getPlayer(s)!=null) { + p.setSpectatorTarget(Bukkit.getPlayer(s)); + } + } + } + + private void updateBar() { + if (matchTimer!=null) { + if ((timelimit - TwosideKeeper.getServerTickTime())<=20*60) { + matchTimer.setColor(BarColor.RED); + } + matchTimer.setProgress(Math.max((timelimit - TwosideKeeper.getServerTickTime()) / (double)duration,0)); + matchTimer.removeAll(); + for (String s : players.keySet()) { + Player p = Bukkit.getPlayer(s); + if (p!=null && p.isOnline()) { + matchTimer.addPlayer(p); + } + } + } + } + private void setupNextRound() { boolean deadTeam=false; if (scorematch) { @@ -318,7 +414,15 @@ public class PVP { p.setGameMode(GameMode.SURVIVAL); Location myLoc = p.getLocation().clone(); //myLoc.setY(p.getLocation().getChunk().getChunkSnapshot().getHighestBlockYAt(Math.floorMod(p.getLocation().getBlockX(),16), Math.floorMod(p.getLocation().getBlockZ(),16))); - p.teleport(pp.startingLoc); + if (currentArena==null) { + p.teleport(pp.startingLoc.add(Math.random()*32-16,0,Math.random()*32-16)); + Chunk c = p.getLocation().getChunk(); + ChunkSnapshot cs = c.getChunkSnapshot(); + int highestY = cs.getHighestBlockYAt(Math.floorMod(p.getLocation().getBlockX(),16), Math.floorMod(p.getLocation().getBlockZ(),16)); + p.teleport(p.getLocation().add(0, highestY-p.getLocation().getBlockY()+2, 0)); + } else { + p.teleport(currentArena.pickRandomLocation()); + } } }, 120); } @@ -329,7 +433,7 @@ public class PVP { private StringBuilder PrepareCurrentScores() { StringBuilder sb = new StringBuilder("\n\n"); sb.append("------- PVP Match -------\n"); - if ((scorematch && players.size()==2) || (!scorematch)) { + if ((scorematch && !isTeamMatch) || (!scorematch)) { DisplaySortedScoreboard(sb); } else { DisplayTeamScoreboard(sb); @@ -413,11 +517,18 @@ public class PVP { } private void resetTeams() { + currentArena=null; for (String s : players.keySet()) { PVP.setTeam("NEUTRAL", s); Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{ if (Bukkit.getPlayer(s)!=null && Bukkit.getPlayer(s).isOnline()) { Bukkit.getPlayer(s).setGameMode(GameMode.SURVIVAL); + Player p = Bukkit.getPlayer(s); + PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); + TwosideKeeper.setPlayerMaxHealth(p, p.getHealth()/p.getMaxHealth(), true); + p.teleport(pd.locBeforeInstance); + pd.locBeforeInstance=null; + GenericFunctions.RevivePlayer(p, p.getMaxHealth()); } }, 5); } @@ -426,6 +537,12 @@ public class PVP { Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{ if (Bukkit.getPlayer(s)!=null && Bukkit.getPlayer(s).isOnline()) { Bukkit.getPlayer(s).setGameMode(GameMode.SURVIVAL); + Player p = Bukkit.getPlayer(s); + PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); + TwosideKeeper.setPlayerMaxHealth(p, p.getHealth()/p.getMaxHealth(), true); + p.teleport(pd.locBeforeInstance); + pd.locBeforeInstance=null; + GenericFunctions.RevivePlayer(p, p.getMaxHealth()); } }, 5); } @@ -488,6 +605,7 @@ public class PVP { private void announceWinner() { String firstPlayer = null; determineWinnerByEliminatingLosers(); + TwosideKeeper.log("Players: "+players, 1); for (String s : players.keySet()) { firstPlayer = s; break; @@ -497,6 +615,7 @@ public class PVP { List winners = PVP.getTeammates(p); List winnernames = new ArrayList(); for (Player pl : winners) { + TwosideKeeper.log("Adding "+pl.getName()+" to winners.", 1); winnernames.add(pl.getName()); } StringBuilder sb = new StringBuilder(ChatColor.GREEN+"Congratulations to "+ChatColor.YELLOW); @@ -512,7 +631,7 @@ public class PVP { } private void determineWinnerByEliminatingLosers() { - if (players.size()==2) { + if (!isTeamMatch) { String higherscoreplayer = ""; int higherscore = Integer.MIN_VALUE; for (String s : players.keySet()) { @@ -572,7 +691,16 @@ public class PVP { scorematch=true; } else { int minutes = Integer.parseInt(style.name().replaceAll("MIN", "")); - timelimit = TwosideKeeper.getServerTickTime() + (20*60*minutes); + duration = (20*60*minutes); + timelimit = TwosideKeeper.getServerTickTime() + duration; + matchTimer = Bukkit.createBossBar("Time Remaining", BarColor.GREEN, BarStyle.SEGMENTED_10, BarFlag.CREATE_FOG); + matchTimer.setProgress((timelimit - TwosideKeeper.getServerTickTime()) / (double)duration); + for (String s : players.keySet()) { + Player p = Bukkit.getPlayer(s); + if (p!=null && p.isOnline()) { + matchTimer.addPlayer(p); + } + } scorematch=false; } } @@ -621,11 +749,21 @@ public class PVP { pp.startingLoc = baseloc; } if (Bukkit.getPlayer(s)!=null) { + Player p = Bukkit.getPlayer(s); + PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); + pd.locBeforeInstance = p.getLocation(); + p.setHealth(p.getMaxHealth()); + TwosideKeeper.setPlayerMaxHealth(p, p.getHealth()/p.getMaxHealth(), true); if (pp.team!=0) { - PVP.setTeam(s+"_TEAM"+pp.team, Bukkit.getPlayer(s)); + String firstMember = GetFirstMemberOfTeam(pp.team); + PVP.setTeam(firstMember+"_TEAM"+pp.team, Bukkit.getPlayer(s)); } else { PVP.setTeam(s+"_PVP", Bukkit.getPlayer(s)); } + if (currentArena!=null) { + p.teleport(currentArena.pickRandomLocation()); + } + //TwosideKeeper.log("Set team of "+s+" to "+PVP.getTeam(Bukkit.getPlayer(s)), 2); pp.lastLoc = Bukkit.getPlayer(s).getLocation().clone(); Bukkit.getPlayer(s).sendMessage(ChatColor.GREEN+"The PVP Match between "+getParticipants()+" has begun!"); } @@ -633,6 +771,18 @@ public class PVP { aPlugin.API.discordSendRawItalicized("The PVP Match between **"+getParticipants()+"** has begun!"); } + private String GetFirstMemberOfTeam(int team) { + for (String s : players.keySet()) { + PVPPlayer pp = players.get(s); + if (pp.team==team) { + return s; + } + } + TwosideKeeper.log("WARNING! Could not get first member of team. This should not be happening!",1); + DebugUtils.showStackTrace(); + return null; + } + private void DisplayStageChoices() { for (String s : players.keySet()) { Player p = Bukkit.getPlayer(s); @@ -640,10 +790,14 @@ public class PVP { p.sendMessage(ChatColor.GREEN+"Please pick a type of PVP Stage:"); p.sendMessage(""); TextComponent tc = PVPOption.OPENWORLD.getComponent(); - tc.addExtra(" ");tc.addExtra(PVPOption.SMALLBATTLEFIELD.getComponent()); + int arenaID = 0; + for (PVPArena arena : arenas) { + tc.addExtra(" ");tc.addExtra(arena.getComponent(arenaID++)); + } + /*tc.addExtra(" ");tc.addExtra(PVPOption.SMALLBATTLEFIELD.getComponent()); tc.addExtra(" ");tc.addExtra(PVPOption.AQUATICFORT.getComponent()); tc.addExtra("\n");tc.addExtra(PVPOption.NETHERFORTRESS.getComponent()); - tc.addExtra(" ");tc.addExtra(PVPOption.THEEND.getComponent()); + tc.addExtra(" ");tc.addExtra(PVPOption.THEEND.getComponent());*/ p.spigot().sendMessage(tc); } } @@ -676,6 +830,7 @@ public class PVP { tc.addExtra("\n");tc.addExtra(PVPOption.MIN10.getComponent()); p.spigot().sendMessage(tc); } + GenericFunctions.deAggroNearbyTargets(p); } } @@ -689,13 +844,21 @@ public class PVP { private boolean allPlayersPicked() { for (String p : players.keySet()) { PVPPlayer pp = players.get(p); - if (pp.choice==PVPOption.NONE) { + if (pp.choice==PVPOption.NONE && pp.arenaChoice==-1) { return false; } } return true; } + public void addStageChoice(Player p, String choice) { + if (players.containsKey(p.getName())) { + PVPPlayer pp = players.get(p.getName()); + pp.arenaChoice = 9000-Integer.parseInt(choice); + p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Your choice for "+ChatColor.GREEN+arenas.get(pp.arenaChoice).getArenaName()+ChatColor.RESET+" has been entered."); + } + } + public void addChoice(Player p, String choice) { if (players.containsKey(p.getName())) { PVPPlayer pp = players.get(p.getName()); @@ -840,8 +1003,17 @@ public class PVP { } public static boolean isPvPing(Player p) { - addPlayerToTeamStructure(p); - return !teams.get(p.getName()).equalsIgnoreCase("NEUTRAL") || PVP.getMatch(p)!=null; + if (p!=null) { + PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); + if (pd.temporaryPVP) { + return true; + } else { + addPlayerToTeamStructure(p); + return !teams.get(p.getName()).equalsIgnoreCase("NEUTRAL") || PVP.getMatch(p)!=null; + } + } else { + return false; + } } public static List getTeammates(Player p) { @@ -901,7 +1073,7 @@ public class PVP { public static boolean isEnemy(Player p, Player checkEnemy) { addPlayerToTeamStructure(p); addPlayerToTeamStructure(checkEnemy); - return !getTeam(p).equalsIgnoreCase(getTeam(checkEnemy)) && !getTeam(checkEnemy).equalsIgnoreCase("NEUTRAL"); + return !getTeam(p).equalsIgnoreCase(getTeam(checkEnemy)) && !getTeam(checkEnemy).equalsIgnoreCase("NEUTRAL") && !getTeam(p).equalsIgnoreCase("NEUTRAL"); } public static void sendPvPRequest(Player attacker, Player defender) { @@ -928,18 +1100,56 @@ public class PVP { PVPPlayer myself = players.get(p.getName()); if (!scorematch) { myself.score--; + StringBuilder sb = PrepareCurrentScores(); + //myself.respawnTimer = TwosideKeeper.getServerTickTime()+120; + pd.customtitle.modifySmallCenterTitle(ChatColor.GREEN+"Respawning...", 100); + for (int i=0;i<5;i++) { + final int counter = i; + Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{ + if (p!=null && p.isOnline()) { + pd.customtitle.modifyLargeCenterTitle(ChatColor.GREEN+Integer.toString(5-counter), 20); + pd.customtitle.update(); + } + }, 20*i); + } + Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{ + if (p!=null && p.isOnline()) { + myself.isAlive=true; + p.setGameMode(GameMode.SURVIVAL); + Location myLoc = p.getLocation().clone(); + //myLoc.setY(p.getLocation().getChunk().getChunkSnapshot().getHighestBlockYAt(Math.floorMod(p.getLocation().getBlockX(),16), Math.floorMod(p.getLocation().getBlockZ(),16))); + if (currentArena==null) { + p.teleport(myself.startingLoc.add(Math.random()*32-16,0,Math.random()*32-16)); + Chunk c = p.getLocation().getChunk(); + ChunkSnapshot cs = c.getChunkSnapshot(); + int highestY = cs.getHighestBlockYAt(Math.floorMod(p.getLocation().getBlockX(),16), Math.floorMod(p.getLocation().getBlockZ(),16)); + p.teleport(p.getLocation().add(0, highestY-p.getLocation().getBlockY()+2, 0)); + } else { + p.teleport(currentArena.pickRandomLocation()); + } + } + }, 120); + for (String s : players.keySet()) { + Player pl = Bukkit.getPlayer(s); + if (pl!=null && pl.isOnline()) { + pl.sendMessage(sb.toString()); + } + } } myself.isAlive=false; p.setGameMode(GameMode.SPECTATOR); p.setSpectatorTarget(Bukkit.getPlayer(killedByPlayer)); p.sendMessage(" Killed by "+ChatColor.RED+killedByPlayer+ChatColor.RESET+"."); + Player killerp = Bukkit.getPlayer(pd.lastplayerHitBy); + if (killerp!=null) { + killerp.sendMessage(" Killed "+ChatColor.GREEN+p.getName()+ChatColor.RESET+"."); + } } /*if (getPlayersInTeam(1).contains(killer)) { team1score++; } else { team2score++; }*/ - } } @@ -948,6 +1158,7 @@ class PVPPlayer { Location startingLoc; Location lastLoc; PVPOption choice; + int arenaChoice; int team; boolean isAlive; long respawnTimer; @@ -959,6 +1170,8 @@ class PVPPlayer { lastLoc=null; team=0; isAlive=true; + respawnTimer=0; + arenaChoice=-1; } } diff --git a/src/sig/plugin/TwosideKeeper/PVPArena.java b/src/sig/plugin/TwosideKeeper/PVPArena.java new file mode 100644 index 0000000..021b30f --- /dev/null +++ b/src/sig/plugin/TwosideKeeper/PVPArena.java @@ -0,0 +1,91 @@ +package sig.plugin.TwosideKeeper; + +import org.bukkit.Location; +import org.bukkit.block.Block; +import org.bukkit.util.Vector; + +import net.md_5.bungee.api.chat.ClickEvent; +import net.md_5.bungee.api.chat.ComponentBuilder; +import net.md_5.bungee.api.chat.HoverEvent; +import net.md_5.bungee.api.chat.TextComponent; + +public class PVPArena { + Location startCorner; + Location endCorner; + String name; + String desc; + + public PVPArena(Location startCorner, Location endCorner, String arenaName, String desc) { + this.startCorner = new Location(startCorner.getWorld(),Math.min(startCorner.getBlockX(), endCorner.getBlockX()),Math.min(startCorner.getBlockY(), endCorner.getBlockY()),Math.min(startCorner.getBlockZ(), endCorner.getBlockZ())); + this.endCorner = new Location(startCorner.getWorld(),Math.max(startCorner.getBlockX(), endCorner.getBlockX()),Math.max(startCorner.getBlockY(), endCorner.getBlockY()),Math.max(startCorner.getBlockZ(), endCorner.getBlockZ())); + this.name=arenaName; + this.desc=desc; + } + + public Location getStartCorner() { + return startCorner; + } + public Location getEndCorner() { + return endCorner; + } + public String getArenaName() { + return name; + } + public boolean insideBounds(Location loc) { + return (loc.getBlockX()>startCorner.getBlockX() && + loc.getBlockX()startCorner.getBlockY() && + loc.getBlockY()startCorner.getBlockZ() && + loc.getBlockZ()0) { + //Find a safe Y Location + int ytries=50; + while (ytries>0) { + Block testBlock = startCorner.clone().add(randomx,y-1,randomz).getBlock(); + if (testBlock.isLiquid() || !testBlock.getType().isSolid()) { + y--; + ytries--; + } else { + break; + } + } + finalloc = new Location(startCorner.getWorld(), + startCorner.getBlockX()+randomx, + startCorner.getBlockY()+y, + startCorner.getBlockZ()+randomz); + if (!finalloc.getBlock().isLiquid() && + insideBounds(finalloc)) { + return finalloc.clone(); + } else { + tries--; + randomx = ((int)(Math.random()*(endCorner.getBlockX()-startCorner.getBlockX()))) + 1; + randomz = ((int)(Math.random()*(endCorner.getBlockZ()-startCorner.getBlockZ()))) + 1; + y = endCorner.getBlockX()-startCorner.getBlockX()-1; + } + } + TwosideKeeper.log("WARNING! Could not find a safe random location. Dropping them in with what we got...", 1); + return finalloc.clone(); + } + + public String getDescription() { + return desc; + } + + public TextComponent getComponent(int index) { + TextComponent tc = new TextComponent("["+name+"]"); + tc.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND,"/pvp _ARENA_ "+(9000+index)+"")); + tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,new ComponentBuilder(desc).create())); + return tc; + } +} diff --git a/src/sig/plugin/TwosideKeeper/PlayerStructure.java b/src/sig/plugin/TwosideKeeper/PlayerStructure.java index 9a4cab4..99ef5e3 100644 --- a/src/sig/plugin/TwosideKeeper/PlayerStructure.java +++ b/src/sig/plugin/TwosideKeeper/PlayerStructure.java @@ -173,6 +173,9 @@ public class PlayerStructure { public long lastStartedPlayerClicks = 0; public int pvpState = 0; //1=Selecting Type, 2=Selecting Stage public int pvpChoice = 0; + public boolean temporaryPVP=false; //Used for /stats PVP emulation. + public Location arenaLocRef=null; + public Location playerLocRef=null; /*State 1 * 1: Best of 3 Rounds * 2: Best of 5 Rounds @@ -274,6 +277,7 @@ public class PlayerStructure { public boolean isAFKState = false; public int unafkLength = 0; public int gracePeriod = 0; + public long lastActiveActivity = 0; //Includes disenchanting / alchemizing. //Prevent Automatic AFK moving the camera just to avoid the system. public long lastAdjustmentReading = 0; //When the last adjustment reading started. @@ -797,7 +801,7 @@ public class PlayerStructure { public static double getAFKMultiplier(Player p) { //Returns how harsh the AFK'ing multiplier is on a player. PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); double mult = 1; - mult += Math.min(Math.pow(pd.actionRecords, 1.25)-1,1000); + mult += Math.max(Math.min(Math.pow(pd.actionRecords/10, 1.05)-1,1000),0); return mult; } } diff --git a/src/sig/plugin/TwosideKeeper/Rooms/DPSChallengeRoom.java b/src/sig/plugin/TwosideKeeper/Rooms/DPSChallengeRoom.java index 1dc4b9a..6183a1f 100644 --- a/src/sig/plugin/TwosideKeeper/Rooms/DPSChallengeRoom.java +++ b/src/sig/plugin/TwosideKeeper/Rooms/DPSChallengeRoom.java @@ -73,8 +73,8 @@ public class DPSChallengeRoom extends Room{ PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); pd.locBeforeInstance = p.getLocation().clone(); pd.inTankChallengeRoom=true; - p.teleport(new Location(instance,ROOM_WIDTH/2,24,ROOM_LENGTH/2)); - GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.LEVITATION, 20*4, -30, p, true); + p.teleport(new Location(instance,ROOM_WIDTH/2,4,ROOM_LENGTH/2)); + //GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.LEVITATION, 20*4, -30, p, true); Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{ setupChallengeRoom(); }, 5); diff --git a/src/sig/plugin/TwosideKeeper/Rooms/ParkourChallengeRoom.java b/src/sig/plugin/TwosideKeeper/Rooms/ParkourChallengeRoom.java index d9d8fd1..9262d75 100644 --- a/src/sig/plugin/TwosideKeeper/Rooms/ParkourChallengeRoom.java +++ b/src/sig/plugin/TwosideKeeper/Rooms/ParkourChallengeRoom.java @@ -54,13 +54,13 @@ public class ParkourChallengeRoom extends Room{ PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); pd.locBeforeInstance = p.getLocation().clone(); pd.inParkourChallengeRoom=true; - p.teleport(new Location(instance,ROOM_WIDTH/2,24,ROOM_LENGTH/2)); + //GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.LEVITATION, 20*4, -30, p, true); + p.teleport(new Location(instance,ROOM_WIDTH/2,4,ROOM_LENGTH/2)); storedinv = Bukkit.createInventory(p, 63); for (int i=0;i{ setupChallengeRoom(); }, 5); @@ -99,6 +99,7 @@ public class ParkourChallengeRoom extends Room{ if (p!=null && p.isValid()) { verifySign(); updateLava(); + updateBlockAboveChest(); finishCourse(); if (roomFinished) { return false; @@ -110,6 +111,13 @@ public class ParkourChallengeRoom extends Room{ } + private void updateBlockAboveChest() { + Block b = instance.getBlockAt(ROOM_WIDTH/2, 2, ROOM_LENGTH/2); + if (b.getType()!=Material.AIR) { + b.setType(Material.AIR); + } + } + private void finishCourse() { //TwosideKeeper.log(p.getLocation().getBlockY()+","+p.getLocation().getBlock().getRelative(0, -1, 0).getType(), 0); if (p.getLocation().getBlockY()>=81 && diff --git a/src/sig/plugin/TwosideKeeper/Rooms/TankChallengeRoom.java b/src/sig/plugin/TwosideKeeper/Rooms/TankChallengeRoom.java index ef43b03..f5ca0f9 100644 --- a/src/sig/plugin/TwosideKeeper/Rooms/TankChallengeRoom.java +++ b/src/sig/plugin/TwosideKeeper/Rooms/TankChallengeRoom.java @@ -57,8 +57,8 @@ public class TankChallengeRoom extends Room { PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); pd.locBeforeInstance = p.getLocation().clone(); pd.inTankChallengeRoom=true; - p.teleport(new Location(instance,ROOM_WIDTH/2,24,ROOM_LENGTH/2)); - GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.LEVITATION, 20*4, -30, p, true); + p.teleport(new Location(instance,ROOM_WIDTH/2,4,ROOM_LENGTH/2)); + //GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.LEVITATION, 20*4, -30, p, true); Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{ setupChallengeRoom(); }, 5); diff --git a/src/sig/plugin/TwosideKeeper/SpleefManager.java b/src/sig/plugin/TwosideKeeper/SpleefManager.java index 342adda..78132f8 100644 --- a/src/sig/plugin/TwosideKeeper/SpleefManager.java +++ b/src/sig/plugin/TwosideKeeper/SpleefManager.java @@ -57,6 +57,6 @@ public class SpleefManager { } public static boolean playerIsPlayingSpleef(Player p) { - return PlayerStructure.GetPlayerStructure(p).isPlayingSpleef; + return PlayerStructure.GetPlayerStructure(p).isPlayingSpleef || PlayerStructure.GetPlayerStructure(p).inTankChallengeRoom; } } \ No newline at end of file diff --git a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java index 06dc541..6561946 100644 --- a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java +++ b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java @@ -152,6 +152,7 @@ import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.event.player.PlayerSwapHandItemsEvent; import org.bukkit.event.player.PlayerTeleportEvent; +import org.bukkit.event.player.PlayerToggleFlightEvent; import org.bukkit.event.player.PlayerToggleSneakEvent; import org.bukkit.event.player.PlayerToggleSprintEvent; import org.bukkit.event.server.ServerCommandEvent; @@ -454,6 +455,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { public static CustomPotion HARDENING_VIAL; public static ItemStack DEAL_OF_THE_DAY_ITEM; public static ShapelessRecipe BAUBLE_POUCH_RECIPE; + public static int ARENA_ID = 0; public static int DAMAGE_LOG = 0; //Goes up to 8, then starts at 0 again. public static File DAMAGE_LOG_FILE; @@ -1028,13 +1030,21 @@ public class TwosideKeeper extends JavaPlugin implements Listener { double regenamt = GetNaturalRegen(p); if (p.getHealth()=16) { - GenericFunctions.HealEntity(p, regenamt); + if (PVP.isPvPing(p)) { + GenericFunctions.HealEntity(p, regenamt*0.1); + } else { + GenericFunctions.HealEntity(p, regenamt); + } pd.last_regen_time=TwosideKeeper.getServerTickTime(); } if (pd.regenpool>0) { double healamt = Math.min(pd.regenpool, regenamt); pd.regenpool = Math.max(pd.regenpool-regenamt, 0); - GenericFunctions.HealEntity(p, healamt); + if (PVP.isPvPing(p)) { + GenericFunctions.HealEntity(p, healamt*0.1); + } else { + GenericFunctions.HealEntity(p, healamt); + } GenericFunctions.sendActionBarMessage(p, ""); } } @@ -1075,7 +1085,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { List diffs = new ArrayList(); for (int i=0;i<9;i++) { ItemStack item = p.getInventory().getItem(i); - if (ItemUtils.isValidItem(item) && GenericFunctions.isEquip(item)) { + if (ItemUtils.isValidItem(item) && GenericFunctions.isEquip(item) && pd.durability.get(i)!=-1) { diffs.add(item.getDurability()-pd.durability.get(i)); if (item.getDurability()-pd.durability.get(i)>0) { TwosideKeeper.log("Difference dected in item slot #"+i+" for Player "+p.getName(), 2); @@ -1094,7 +1104,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { if (ItemUtils.isValidItem(item) && GenericFunctions.isEquip(item)) { pd.durability.add((int)item.getDurability()); } else { - pd.durability.add(0); + pd.durability.add(-1); } } } @@ -1110,7 +1120,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { final ItemStack[] equips = GenericFunctions.getEquipment(p); for (ItemStack equip : equips) { if (GenericFunctions.isArtifactEquip(equip)) { - double regenamt = GenericFunctions.getAbilityValue(ArtifactAbility.HEALTH_REGEN, equip); + double regenamt = GenericFunctions.getAbilityValue(ArtifactAbility.HEALTH_REGEN, equip, p); totalregen += regenamt; if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, equip)) { totalregen /= ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, equip)?2:1; @@ -1211,6 +1221,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener { habitat_data = new Habitation(); habitat_data.loadLocationHashesFromConfig(); + PVP.arenas = new ArrayList(); + LastClearStructureTime = getServerTickTime(); TwosideRecyclingCenter = new RecyclingCenter(); @@ -1642,6 +1654,13 @@ public class TwosideKeeper extends JavaPlugin implements Listener { session.addChoice(p,args[1]); } }break; + case "_ARENA_":{ + Player p = (Player)sender; + PVP session = PVP.getMatch(p); + if (session!=null) { + session.addStageChoice(p,args[1]); + } + }break; case "_TEAM_":{ Player p = (Player)sender; PVP session = PVP.getMatch(p); @@ -1679,6 +1698,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener { if (args[0].equalsIgnoreCase("offhand")) { showPlayerStats(p,sender,"offhand"); } else + if (args[0].equalsIgnoreCase("pvp")) { + showPlayerStats(p,sender,"pvp"); + } else if (args[0].equalsIgnoreCase("all")) { showPlayerStats(p,sender,"all"); } else { @@ -1694,6 +1716,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener { if (args[0].equalsIgnoreCase("offhand")) { showPlayerStats((Player)sender,"offhand"); } else + if (args[0].equalsIgnoreCase("pvp")) { + showPlayerStats((Player)sender,"pvp"); + } else if (args[0].equalsIgnoreCase("all")) { showPlayerStats((Player)sender,"all"); } else @@ -2430,6 +2455,99 @@ public class TwosideKeeper extends JavaPlugin implements Listener { tankchallenge_records.resetRecords(); tankchallenge_recordsHOF.resetRecords(); }break; + case "ARTIFACTS":{ + int vals = 0; + for (ArtifactItemType ait : ArtifactItemType.values()) { + ItemStack newitem = ArtifactItemType.getTypeFromData(vals).getTieredItem(1); + + //Add more information for this. + newitem = AwakenedArtifact.convertToAwakenedArtifact(newitem, 1, vals); + TwosideKeeperAPI.addArtifactEXP(newitem, 1000000, p); + GenericFunctions.giveItem(p, newitem); + vals++; + } + }break; + case "ITEMSETS":{ + int tier = 5; + if (args.length==2) { + tier = Integer.parseInt(args[1]); + } + List items = new ArrayList(); + for (ItemSet is : ItemSet.values()) { + if (ItemSet.isTrinketSet(is)) { + ItemStack item = TwosideKeeperAPI.generateSetPiece(Material.SKULL_ITEM, is, true, tier); + setTier(item,tier); + item.setAmount(9); + items.add(item); + } else { + if (ItemSet.isAssassinSet(is)) { + ItemStack item = TwosideKeeperAPI.generateSetPiece(Material.GOLD_SWORD, is, true, tier); + setTier(item,tier); + items.add(item); + } else { + ItemStack item = TwosideKeeperAPI.generateSetPiece(Material.GOLD_SWORD, is, true, tier); + setTier(item,tier); + items.add(item); + item = TwosideKeeperAPI.generateSetPiece(Material.GOLD_HELMET, is, true, tier); + setTier(item,tier); + items.add(item); + item = TwosideKeeperAPI.generateSetPiece(Material.GOLD_CHESTPLATE, is, true, tier); + setTier(item,tier); + items.add(item); + item = TwosideKeeperAPI.generateSetPiece(Material.GOLD_LEGGINGS, is, true, tier); + setTier(item,tier); + items.add(item); + item = TwosideKeeperAPI.generateSetPiece(Material.GOLD_BOOTS, is, true, tier); + setTier(item,tier); + items.add(item); + } + } + } + Inventory itemset_inv = Bukkit.createInventory(p, ((((items.size()-1)/9)+1)*9), "Item Sets"); + itemset_inv.addItem(items.toArray(new ItemStack[items.size()])); + p.openInventory(itemset_inv); + }break; + case "ARTIFACTTIER":{ + if (args.length==2) { + ItemUtils.ModifyLoreLineContainingSubstring(p.getEquipment().getItemInMainHand(), ChatColor.GOLD+""+ChatColor.BOLD+"T", ChatColor.GOLD+""+ChatColor.BOLD+"T"+Integer.parseInt(args[1])+" Artifact"); + } else { + p.sendMessage("/fix ARTIFACTTIER "); + } + }break; + case "DEFINEARENA":{ + PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); + if (pd.arenaLocRef==null) { + Set types = null; + pd.arenaLocRef = p.getTargetBlock(types, 100).getLocation().clone(); + pd.playerLocRef=p.getLocation().clone(); + p.sendMessage(ChatColor.LIGHT_PURPLE+"Set Ref Location of Arena corner 1 to "+pd.arenaLocRef); + } else { + if (args.length==3) { + Set types = null; + PVPArena arena = new PVPArena(pd.arenaLocRef,p.getTargetBlock(types, 100).getLocation().clone(), + args[1],args[2]); + PVP.arenas.add(arena); + p.sendMessage(ChatColor.LIGHT_PURPLE+"Set Ref Location of Arena corner 2 to "+p.getTargetBlock(types, 100).getLocation().clone()); + p.sendMessage(ChatColor.YELLOW+"Successfully created Arena "+arena.getArenaName()+" with Description "+arena.getDescription()); + p.teleport(pd.playerLocRef); + pd.playerLocRef=null; + pd.arenaLocRef=null; + } else { + if (args.length==2) { + if (args[1].equalsIgnoreCase("exit")) { + p.teleport(pd.playerLocRef); + pd.playerLocRef=null; + pd.arenaLocRef=null; + p.sendMessage("Arena creation cancelled."); + } else { + p.sendMessage("Use /fix DEFINEARENA exit to quit."); + } + } else { + p.sendMessage("Use /fix DEFINEARENA to define the arena."); + } + } + } + }break; } } //LivingEntity m = MonsterController.convertMonster((Monster)p.getWorld().spawnEntity(p.getLocation(),EntityType.ZOMBIE), MonsterDifficulty.ELITE); @@ -2696,11 +2814,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener { Player p = Bukkit.getPlayer(sender.getName()); if (Integer.parseInt(args[1])>=900) { if (p.getInventory().getArmorContents()[Integer.parseInt(args[1])-900]!=null) { - p.spigot().sendMessage(ArtifactAbility.GenerateMenu(ArtifactItemType.getArtifactItemTypeFromItemStack(p.getInventory().getArmorContents()[Integer.parseInt(args[1])-900]).getUpgradePath(), CustomDamage.getBaseWeaponDamage(p.getInventory().getArmorContents()[Integer.parseInt(args[1])-900], p, null), p.getInventory().getArmorContents()[Integer.parseInt(args[1])-900],Integer.parseInt(args[1]))); + p.spigot().sendMessage(ArtifactAbility.GenerateMenu(ArtifactItemType.getArtifactItemTypeFromItemStack(p.getInventory().getArmorContents()[Integer.parseInt(args[1])-900]).getUpgradePath(), CustomDamage.getBaseWeaponDamage(p.getInventory().getArmorContents()[Integer.parseInt(args[1])-900], p, null), p.getInventory().getArmorContents()[Integer.parseInt(args[1])-900],Integer.parseInt(args[1]),p)); } } else { if (p.getInventory().getItem(Integer.parseInt(args[1]))!=null && GenericFunctions.isArtifactEquip(p.getInventory().getItem(Integer.parseInt(args[1])))) { - p.spigot().sendMessage(ArtifactAbility.GenerateMenu(ArtifactItemType.getArtifactItemTypeFromItemStack(p.getInventory().getItem(Integer.parseInt(args[1]))).getUpgradePath(), CustomDamage.getBaseWeaponDamage(p.getInventory().getItem(Integer.parseInt(args[1])), p, null), p.getInventory().getItem(Integer.parseInt(args[1])),Integer.parseInt(args[1]))); + p.spigot().sendMessage(ArtifactAbility.GenerateMenu(ArtifactItemType.getArtifactItemTypeFromItemStack(p.getInventory().getItem(Integer.parseInt(args[1]))).getUpgradePath(), CustomDamage.getBaseWeaponDamage(p.getInventory().getItem(Integer.parseInt(args[1])), p, null), p.getInventory().getItem(Integer.parseInt(args[1])),Integer.parseInt(args[1]),p)); } } } else @@ -2727,7 +2845,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { p.getEquipment().getItemInMainHand().getType()!=Material.AIR && GenericFunctions.isArtifactEquip(p.getEquipment().getItemInMainHand())) { p.sendMessage("");p.sendMessage(""); - p.spigot().sendMessage(ArtifactAbility.GenerateMenu(ArtifactItemType.getArtifactItemTypeFromItemStack(p.getEquipment().getItemInMainHand()).getUpgradePath(), CustomDamage.CalculateDamageReduction(1,p,null), p.getEquipment().getItemInMainHand())); + p.spigot().sendMessage(ArtifactAbility.GenerateMenu(ArtifactItemType.getArtifactItemTypeFromItemStack(p.getEquipment().getItemInMainHand()).getUpgradePath(), CustomDamage.CalculateDamageReduction(1,p,null), p.getEquipment().getItemInMainHand(),p)); } } return true; @@ -2899,6 +3017,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } return false; } + private void setTier(ItemStack piece, int tier) { + TwosideKeeperAPI.setItemTier(piece, tier); + } private void CreateDarkReveriePool(Player p, int tier) { AreaEffectCloud aec = (AreaEffectCloud)p.getWorld().spawnEntity(p.getLocation(), EntityType.AREA_EFFECT_CLOUD); aec.setColor(Color.BLACK); @@ -3223,7 +3344,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { GenericFunctions.logAndRemovePotionEffectFromEntity(PotionEffectType.NIGHT_VISION,ev.getPlayer()); GenericFunctions.logAndRemovePotionEffectFromEntity(PotionEffectType.LEVITATION,ev.getPlayer()); GenericFunctions.logAndRemovePotionEffectFromEntity(PotionEffectType.JUMP,ev.getPlayer()); - if (TwosideKeeper.SERVER_TYPE!=ServerType.TEST) { + if (TwosideKeeper.SERVER_TYPE!=ServerType.TEST || ev.getPlayer().getGameMode()==GameMode.SPECTATOR) { ev.getPlayer().setGameMode(GameMode.SURVIVAL); } runServerHeartbeat.UpdatePlayerScoreboardAndHealth(ev.getPlayer()); @@ -3251,6 +3372,14 @@ public class TwosideKeeper extends JavaPlugin implements Listener { p.sendMessage("--------------------"); } + @EventHandler(priority=EventPriority.LOW,ignoreCancelled = true) + public void onPlayerFlight(PlayerToggleFlightEvent ev) { + Player p = ev.getPlayer(); + if (ev.isFlying() && PVP.isPvPing(p)) { + ev.setCancelled(true); + } + } + @EventHandler(priority=EventPriority.LOW,ignoreCancelled = true) public void onPlayerLeave(PlayerQuitEvent ev) { Player p = ev.getPlayer(); @@ -3274,7 +3403,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener { for (UUID id : livingentitydata.keySet()) { LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(livingentitydata.get(id).m); - les.setGlow(ev.getPlayer(), null); + if (les!=null) { + les.setGlow(ev.getPlayer(), null); + } } for (Player pl :Bukkit.getOnlinePlayers()) { @@ -3283,6 +3414,13 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } } + /*PVP session = PVP.getMatch(p); + if (session!=null) { + if (session.matchTimer!=null) { + session.matchTimer.removePlayer(p); + } + }*/ + //Bukkit.getScheduler().scheduleSyncDelayedTask(this, new ShutdownServerForUpdate(),5); //Find the player that is getting removed. @@ -3309,6 +3447,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener { if (ev.getMessage().length()>=1) { //See if we're using a bank terminal. Player thisp = ev.getPlayer(); + PlayerStructure pd = PlayerStructure.GetPlayerStructure(thisp); + pd.afkLength = Math.min(pd.afkLength+5, 60); if (banksessions.containsKey(thisp.getUniqueId())) { switch (((BankSession)banksessions.get(ev.getPlayer().getUniqueId())).GetState()) { case WITHDRAW:{ @@ -4023,6 +4163,13 @@ public class TwosideKeeper extends JavaPlugin implements Listener { PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); pd.adjustmentReading++; + if (ev.getClickedBlock()!=null && (ev.getClickedBlock().getType()==Material.ENCHANTMENT_TABLE || + ev.getClickedBlock().getType()==Material.CAULDRON) && ev.getAction()==Action.LEFT_CLICK_BLOCK && + p.isSneaking()) { + //We are alchemizing or disenchanting. + pd.lastActiveActivity = TwosideKeeper.getServerTickTime(); + } + Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() { @Override public void run() { @@ -4208,7 +4355,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { weapon.toString().contains("SPADE")) { if (ArtifactAbility.containsEnchantment(ArtifactAbility.EARTHWAVE, weapon) && pd.lastusedearthwave+100) { - double dmg = GenericFunctions.getAbilityValue(ArtifactAbility.DEATHMARK, player.getEquipment().getItemInMainHand()); + double dmg = GenericFunctions.getAbilityValue(ArtifactAbility.DEATHMARK, player.getEquipment().getItemInMainHand(), player); //Look for nearby mobs up to 10 blocks away. List nearby = player.getNearbyEntities(10, 10, 10); boolean reset=false; @@ -5178,6 +5325,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener { public void onBlockPlace(BlockPlaceEvent ev) { TwosideSpleefGames.PassEvent(ev); + PlayerStructure pd = PlayerStructure.GetPlayerStructure(ev.getPlayer()); + if (pd.inTankChallengeRoom) { + ev.setCancelled(true); + return; + } if (CustomItem.isDailyToken(ev.getItemInHand())) { ev.setCancelled(true); return; @@ -8235,11 +8387,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener { for (int i=0;i{ - Block baseblock = ev.getPlayer().getLocation().getBlock().getRelative(0, 1, 0); - Block targetblock = ev.getBlock(); - Vector diffs = new Vector(targetblock.getLocation().getBlockX()-baseblock.getLocation().getBlockX(), - targetblock.getLocation().getBlockY()-baseblock.getLocation().getBlockY(), - targetblock.getLocation().getBlockZ()-baseblock.getLocation().getBlockZ()); - //TwosideKeeper.log("Vector is "+diffs, 1); - diffs = diffs.multiply(1d/largestVector(diffs)); - Location pointerloc = p.getLocation().add(new Vector(0,p.getEyeHeight()+0.01,0)); - //TwosideKeeper.log("Vector is "+diffs, 1); - int iterations = 0; - int distance = (int)baseblock.getLocation().distance(targetblock.getLocation())+1; - while (iterations{ + Block baseblock = ev.getPlayer().getLocation().getBlock().getRelative(0, 1, 0); + Block targetblock = ev.getBlock(); + Vector diffs = new Vector(targetblock.getLocation().getBlockX()-baseblock.getLocation().getBlockX(), + targetblock.getLocation().getBlockY()-baseblock.getLocation().getBlockY(), + targetblock.getLocation().getBlockZ()-baseblock.getLocation().getBlockZ()); + //TwosideKeeper.log("Vector is "+diffs, 1); + diffs = diffs.multiply(1d/largestVector(diffs)); + Location pointerloc = p.getLocation().add(new Vector(0,p.getEyeHeight()+0.01,0)); + //TwosideKeeper.log("Vector is "+diffs, 1); + int iterations = 0; + int distance = (int)baseblock.getLocation().distance(targetblock.getLocation())+1; + while (iterations Is Block Form Check", (int)(System.nanoTime()-time));time = System.nanoTime(); if (equip.getType().toString().contains("LEATHER")) { //This is a leather piece. - hp+=ARMOR_LEATHER_HP; + bonushp+=ARMOR_LEATHER_HP; } else if (equip.getType().toString().contains("IRON")) { //This is an iron piece. - hp+=(is_block_form)?ARMOR_IRON2_HP:ARMOR_IRON_HP; + bonushp+=(is_block_form)?ARMOR_IRON2_HP:ARMOR_IRON_HP; } else if (equip.getType().toString().contains("GOLD")) { //This is a gold piece. - hp+=(is_block_form)?ARMOR_GOLD2_HP:ARMOR_GOLD_HP; + bonushp+=(is_block_form)?ARMOR_GOLD2_HP:ARMOR_GOLD_HP; } else if (equip.getType().toString().contains("DIAMOND")) { //This is a diamond piece. - hp+=(is_block_form)?ARMOR_DIAMOND2_HP:ARMOR_DIAMOND_HP; + bonushp+=(is_block_form)?ARMOR_DIAMOND2_HP:ARMOR_DIAMOND_HP; } TwosideKeeper.HeartbeatLogger.AddEntry("----====]> Increase Health for Block Armor", (int)(System.nanoTime()-time));time = System.nanoTime(); } @@ -11242,11 +11400,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener { //log("Add in "+GenericFunctions.getAbilityValue(ArtifactAbility.HEALTH, equip),5); if (PlayerMode.getPlayerMode(p)==PlayerMode.RANGER) { long time = System.nanoTime(); - hp += (double)GenericFunctions.getAbilityValue(ArtifactAbility.HEALTH, equip)/2; + hp += (double)GenericFunctions.getAbilityValue(ArtifactAbility.HEALTH, equip,p)/2; TwosideKeeper.HeartbeatLogger.AddEntry("----====]> Increase Health for Ranger Armor", (int)(System.nanoTime()-time));time = System.nanoTime(); } else { long time = System.nanoTime(); - hp += (double)GenericFunctions.getAbilityValue(ArtifactAbility.HEALTH, equip); + hp += (double)GenericFunctions.getAbilityValue(ArtifactAbility.HEALTH, equip,p); TwosideKeeper.HeartbeatLogger.AddEntry("----====]> Increase Health for Normal Armor", (int)(System.nanoTime()-time));time = System.nanoTime(); } @@ -11262,7 +11420,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { long time = System.nanoTime(); //Check the hotbar for set equips. - hp+=ItemSet.GetTotalBaseAmount(p, ItemSet.GLADOMAIN); + bonushp+=ItemSet.GetTotalBaseAmount(p, ItemSet.GLADOMAIN); TwosideKeeper.HeartbeatLogger.AddEntry("----====]> Gladomain Set Increase", (int)(System.nanoTime()-time));time = System.nanoTime(); log("Health is now "+hp,5); if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand())) { @@ -11272,20 +11430,20 @@ public class TwosideKeeper extends JavaPlugin implements Listener { log("maxdeduction is "+maxdeduction,5); if (PlayerMode.isDefender(p)) { - hp+=10; + bonushp+=10; } TwosideKeeper.HeartbeatLogger.AddEntry("----====]> Defender HP and Regeneration", (int)(System.nanoTime()-time));time = System.nanoTime(); if (PlayerMode.isBarbarian(p)) { double red = 1-CustomDamage.CalculateDamageReduction(1,p,null); - hp+=(red*2)*100; + bonushp+=(red*2)*100; } TwosideKeeper.HeartbeatLogger.AddEntry("----====]> Barbarian HP Calculation", (int)(System.nanoTime()-time));time = System.nanoTime(); - hp+=ItemSet.GetTotalBaseAmount(p, ItemSet.DAWNTRACKER); - hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DAWNTRACKER, 4, 4); + bonushp+=ItemSet.GetTotalBaseAmount(p, ItemSet.DAWNTRACKER); + bonushp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DAWNTRACKER, 4, 4); TwosideKeeper.HeartbeatLogger.AddEntry("----====]> Dawntracker HP Calculation", (int)(System.nanoTime()-time));time = System.nanoTime(); - hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.SONGSTEEL, 2, 2); + bonushp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.SONGSTEEL, 2, 2); TwosideKeeper.HeartbeatLogger.AddEntry("----====]> Songsteel HP Calculation", (int)(System.nanoTime()-time));time = System.nanoTime(); /* @@ -11297,35 +11455,35 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } } }*/ - hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.ALIKAHN, 2, 2)+ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.ALIKAHN, 3, 3); + bonushp+=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(p, ItemSet.COMET, 2, 2); + bonushp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.COMET, 2, 2); TwosideKeeper.HeartbeatLogger.AddEntry("----====]> Comet HP Calculation", (int)(System.nanoTime()-time));time = System.nanoTime(); - hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.CUPID, 2, 2); + bonushp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.CUPID, 2, 2); TwosideKeeper.HeartbeatLogger.AddEntry("----====]> Cupid HP Calculation", (int)(System.nanoTime()-time));time = System.nanoTime(); - hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DONNER, 2, 2); + bonushp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DONNER, 2, 2); TwosideKeeper.HeartbeatLogger.AddEntry("----====]> Donner HP Calculation", (int)(System.nanoTime()-time));time = System.nanoTime(); - hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.RUDOLPH, 2, 2); + bonushp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.RUDOLPH, 2, 2); TwosideKeeper.HeartbeatLogger.AddEntry("----====]> Rudolph HP Calculation", (int)(System.nanoTime()-time));time = System.nanoTime(); - hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.OLIVE, 2, 2); + bonushp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.OLIVE, 2, 2); TwosideKeeper.HeartbeatLogger.AddEntry("----====]> Olive HP Calculation", (int)(System.nanoTime()-time));time = System.nanoTime(); - hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DASHER, 3, 3); + bonushp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DASHER, 3, 3); TwosideKeeper.HeartbeatLogger.AddEntry("----====]> Dasher HP Calculation", (int)(System.nanoTime()-time));time = System.nanoTime(); - hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DANCER, 3, 3); + bonushp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DANCER, 3, 3); TwosideKeeper.HeartbeatLogger.AddEntry("----====]> Dancer HP Calculation", (int)(System.nanoTime()-time));time = System.nanoTime(); - hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.PRANCER, 3, 3); + bonushp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.PRANCER, 3, 3); TwosideKeeper.HeartbeatLogger.AddEntry("----====]> Prancer HP Calculation", (int)(System.nanoTime()-time));time = System.nanoTime(); - hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.VIXEN, 3, 3); + bonushp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.VIXEN, 3, 3); TwosideKeeper.HeartbeatLogger.AddEntry("----====]> Vixen HP Calculation", (int)(System.nanoTime()-time));time = System.nanoTime(); - hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.BLITZEN, 3, 3); + bonushp+=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)+ + /*bonushp+=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);*/ - hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.SHARD, 4, 4); + bonushp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.SHARD, 4, 4); TwosideKeeper.HeartbeatLogger.AddEntry("----====]> Shard HP Calculation", (int)(System.nanoTime()-time));time = System.nanoTime(); - hp+=ItemSet.GetTotalBaseAmount(p, ItemSet.SUSTENANCE); + bonushp+=ItemSet.GetTotalBaseAmount(p, ItemSet.SUSTENANCE); TwosideKeeper.HeartbeatLogger.AddEntry("----====]> Sustenance HP Calculation", (int)(System.nanoTime()-time));time = System.nanoTime(); if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.DAWNTRACKER,6) || ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.LEGION,6) || @@ -11354,9 +11512,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } for (Player pl : PartyManager.getPartyMembers(p)) { - if (!pl.equals(p)) { + if (pl!=null && p!=null && !pl.equals(p)) { //TwosideKeeper.log("Found a Defender: "+pl.getName(), 0); - hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(pl, ItemSet.PROTECTOR, 3, 3)*ItemSet.GetPlayerModeSpecificMult(p); + bonushp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(pl, ItemSet.PROTECTOR, 3, 3)*ItemSet.GetPlayerModeSpecificMult(p); //TwosideKeeper.log("Increased health by: "+(ItemSet.TotalBaseAmountBasedOnSetBonusCount(pl, ItemSet.PROTECTOR, 3, 3)*ItemSet.GetPlayerModeSpecificMult(p))+" HP.", 0); } } @@ -11364,10 +11522,16 @@ public class TwosideKeeper extends JavaPlugin implements Listener { if (PlayerMode.getPlayerMode(p)==PlayerMode.NORMAL) { TwosideKeeper.log("Player Mode is Normal.", 5); - hp+=10; + bonushp+=10; } TwosideKeeper.HeartbeatLogger.AddEntry("----====]> Adventurer Mode HP Calculation", (int)(System.nanoTime()-time));time = System.nanoTime(); + hp+=bonushp*(PVP.isPvPing(p)?PlayerMode.isRanger(p)?0.25:0.5:1); + + if (PlayerMode.isSlayer(p) && PVP.isPvPing(p)) { + hp/=2; + } + if (Buff.hasBuff(p, "DARKSUBMISSION")) { Buff b = Buff.getBuff(p, "DARKSUBMISSION"); if (b.getAmplifier()>=50) { @@ -11378,9 +11542,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener { hp*=maxdeduction; p.resetMaxHealth(); - if (p.getHealth()>=hp) { - p.setHealth(hp); - } + if (p.getHealth()>=hp) { + p.setHealth(hp); + } p.setMaxHealth(hp); TwosideKeeper.HeartbeatLogger.AddEntry("----====]> Reset Health", (int)(System.nanoTime()-time));time = System.nanoTime(); if (!p.isDead()) { @@ -11624,6 +11788,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener { public void showPlayerStats(Player p, CommandSender receiver, String additional) { PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId()); + if (additional.equalsIgnoreCase("pvp")) { + pd.temporaryPVP=true; + } double store1=CustomDamage.CalculateDamageReduction(1,p,null); double store2=CustomDamage.getBaseWeaponDamage((additional.equalsIgnoreCase("offhand"))?p.getEquipment().getItemInOffHand():p.getEquipment().getItemInMainHand(), p, null); pd.damagedealt=store2; @@ -11714,6 +11881,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } else { receiver.sendMessage("----------"); } + pd.temporaryPVP=false; } public static TextComponent DisplayPerks(ItemStack item,String type,Player p, int slot, boolean all) { @@ -11741,7 +11909,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { ArtifactAbility ab = (ArtifactAbility)enchants.keySet().toArray()[i]; //p.sendMessage(ChatColor.BLUE+ab.GetName()+" "+(int)enchants.values().toArray()[i]); TextComponent tc1 = new TextComponent(ChatColor.GREEN+"["+ab.GetName()+" "+(int)enchants.values().toArray()[i]+"] "); - tc1.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,new ComponentBuilder(WordUtils.wrap(ArtifactAbility.displayDescription(ab, ArtifactUtils.getArtifactTier(item), (int)enchants.values().toArray()[i], CustomDamage.getBaseWeaponDamage(item, p, null)),ArtifactAbility.LINE_SIZE,"\n",true)).create())); + tc1.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,new ComponentBuilder(WordUtils.wrap(ArtifactAbility.displayDescription(ab, ArtifactUtils.getArtifactTier(item), (int)enchants.values().toArray()[i], CustomDamage.getBaseWeaponDamage(item, p, null),PVP.isPvPing(p)),ArtifactAbility.LINE_SIZE,"\n",true)).create())); j++; if (j>=4 && i!=enchants.size()-1) { tc1.addExtra("\n"); @@ -11797,7 +11965,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { public static String drawVelocityBar(double vel,double additionaldmg) { DecimalFormat df = new DecimalFormat("0.00"); - StringBuilder finalstring = new StringBuilder(ChatColor.BLUE+"Velocity - |||||||||||||||||||| "+(((vel*93.182445)>4.317)?ChatColor.BLUE:ChatColor.RED)+df.format(vel*93.182445)+"m/sec "+ChatColor.YELLOW+"(+"+df.format(additionaldmg*(vel*93.182445))+" dmg)"); + StringBuilder finalstring = new StringBuilder(ChatColor.BLUE+"Velocity - |||||||||||||||||||| "+(((vel*93.182445)>4.317)?ChatColor.BLUE:ChatColor.RED)+df.format(vel*93.182445)+"m/sec "+ChatColor.YELLOW+"(+"+df.format(Math.min(additionaldmg*(vel*93.182445),10))+" dmg)"); finalstring.insert(((vel*93.182445)<20)?(int)((vel*93.182445)+12):31, ChatColor.GRAY+""); return finalstring.toString(); } diff --git a/src/sig/plugin/TwosideKeeper/TwosideKeeperAPI.java b/src/sig/plugin/TwosideKeeper/TwosideKeeperAPI.java index 7273338..99499c8 100644 --- a/src/sig/plugin/TwosideKeeper/TwosideKeeperAPI.java +++ b/src/sig/plugin/TwosideKeeper/TwosideKeeperAPI.java @@ -208,6 +208,9 @@ public final class TwosideKeeperAPI { public static double getArtifactAbilityValue(ArtifactAbility ability, ItemStack item) { return GenericFunctions.getAbilityValue(ability, item); } + public static double getArtifactAbilityValue(ArtifactAbility ability, ItemStack item, Player p) { + return GenericFunctions.getAbilityValue(ability, item, p); + } public static ItemStack removeAllArtifactAbilityPoints(ItemStack item) { return ArtifactAbility.removeAllEnchantments(item); } diff --git a/src/sig/plugin/TwosideKeeper/aPluginAPIWrapper.java b/src/sig/plugin/TwosideKeeper/aPluginAPIWrapper.java index 1b510e6..3a1b402 100644 --- a/src/sig/plugin/TwosideKeeper/aPluginAPIWrapper.java +++ b/src/sig/plugin/TwosideKeeper/aPluginAPIWrapper.java @@ -16,7 +16,7 @@ public class aPluginAPIWrapper { public static boolean playerIsActive(Player p) { PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); - if (pd.lastLocationChange+(20*pd.afkLength)>Player "+p.getName()+" has been detected as AFK.", 2); diff --git a/src/sig/plugin/TwosideKeeper/runServerHeartbeat.java b/src/sig/plugin/TwosideKeeper/runServerHeartbeat.java index a7fc85e..2f9f3d4 100644 --- a/src/sig/plugin/TwosideKeeper/runServerHeartbeat.java +++ b/src/sig/plugin/TwosideKeeper/runServerHeartbeat.java @@ -405,7 +405,8 @@ final public class runServerHeartbeat implements Runnable { pd.lastLocationChange = TwosideKeeper.getServerTickTime(); pd.adjustmentReading++; pd.unafkLength = Math.min(pd.unafkLength+1, 60); - if (pd.unafkLength==60) { + if (pd.unafkLength>=30) { + pd.unafkLength = Math.min(pd.unafkLength+1, 60); pd.afkLength = Math.min(pd.afkLength+1, 60); //TwosideKeeper.log("AFK Length: "+pd.afkLength, 2); } @@ -863,7 +864,7 @@ final public class runServerHeartbeat implements Runnable { private void ManageHighwinder(Player p, PlayerStructure pd) { pd.highwinder=ArtifactAbility.containsEnchantment(ArtifactAbility.HIGHWINDER, p.getEquipment().getItemInMainHand()); if (pd.highwinder) { - pd.highwinderdmg=GenericFunctions.getAbilityValue(ArtifactAbility.HIGHWINDER, p.getEquipment().getItemInMainHand()); + pd.highwinderdmg=GenericFunctions.getAbilityValue(ArtifactAbility.HIGHWINDER, p.getEquipment().getItemInMainHand(), p); } if (93.182445*pd.velocity>4.317) { pd.velocity/=2; @@ -1135,11 +1136,13 @@ final public class runServerHeartbeat implements Runnable { } public static void runVacuumCubeSuckup(Player p, List ignoredItems) { + long time1 = System.nanoTime(); if (InventoryUtils.isCarryingVacuumCube(p)) { //Suck up nearby item entities. PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); List ents = p.getNearbyEntities(6, 6, 6); int count=0; + List itemsToInsert = new ArrayList(); for (Entity ent : ents) { if (ent instanceof Item && GenericFunctions.itemCanBeSuckedUp((Item)ent,p)) { //Pull towards the player. @@ -1168,38 +1171,15 @@ final public class runServerHeartbeat implements Runnable { if (deltaz<-0.25) { zvel=SPD*(Math.min(10, Math.abs(deltaz))); } + long collectiontime = System.nanoTime(); + time1 = System.nanoTime(); if (Math.abs(deltax)<=1 && Math.abs(deltay)<=1 && Math.abs(deltaz)<=1 && InventoryUtils.hasFullInventory(p) && ((Item)ent).getPickupDelay()<=0) { - //Collect this item. if (((Item)ent).getItemStack().getType().isBlock()) { - events.PlayerManualPickupItemEvent ev = new events.PlayerManualPickupItemEvent(p, ((Item) ent).getItemStack()); - Bukkit.getPluginManager().callEvent(ev); - if (!ev.isCancelled()) { - ItemStack[] remaining = InventoryUtils.insertItemsInVacuumCube(p, ((Item) ent).getItemStack()); - if (remaining.length==0) { - SoundUtils.playGlobalSound(p.getLocation(), Sound.ENTITY_ITEM_PICKUP, 0.6f, SoundUtils.DetermineItemPitch(((Item) ent).getItemStack())); - TwosideKeeper.PlayPickupParticle(p,(Item)ent); - InventoryUpdateEvent.TriggerUpdateInventoryEvent(ev.getPlayer(),ev.getItemStack(),UpdateReason.PICKEDUPITEM); - ent.remove(); - return; - } - } else { - InventoryUpdateEvent.TriggerUpdateInventoryEvent(ev.getPlayer(),ev.getItemStack(),UpdateReason.PICKEDUPITEM); - ent.remove(); - return; - } - } - count++; - if (ent.isValid()) { - if (ignoredItems.contains(ent.getUniqueId())) { - pd.ignoreItemsList.add(ent.getUniqueId()); - } - } - if (count>8) { - return; + itemsToInsert.add(((Item)ent)); } } else { ent.setVelocity(new Vector(xvel,yvel,zvel)); @@ -1221,7 +1201,48 @@ final public class runServerHeartbeat implements Runnable { }*/ } } + if (itemsToInsert.size()>0) { + List itemsToRemove = new ArrayList(); + for (Item it : itemsToInsert) { + events.PlayerManualPickupItemEvent ev = new events.PlayerManualPickupItemEvent(p, it.getItemStack()); + Bukkit.getPluginManager().callEvent(ev); + if (ev.isCancelled()) { + InventoryUpdateEvent.TriggerUpdateInventoryEvent(ev.getPlayer(),ev.getItemStack(),UpdateReason.PICKEDUPITEM); + it.remove(); + itemsToRemove.add(it); + return; + } + } + List itemstacks = new ArrayList(); + for (Item it : itemsToInsert) { + if (it.isValid()) { + itemstacks.add(it.getItemStack()); + } + } + Item[] item = itemsToInsert.toArray(new Item[itemsToInsert.size()]); + ItemStack[] items = itemstacks.toArray(new ItemStack[itemstacks.size()]); + ItemStack[] remaining = InventoryUtils.insertItemsInVacuumCube(p, items); + for (Item it : item) { + it.remove(); + } + for (ItemStack itemstack : remaining) { + Item it = GenericFunctions.dropItem(itemstack, p.getLocation()); + if (!ignoredItems.contains(it.getUniqueId())) { + pd.ignoreItemsList.add(it.getUniqueId()); + } + } + //TwosideKeeper.HeartbeatLogger.AddEntry("VAC -> Insert item into Vacuum Cube", (int)(System.nanoTime()-time1));time1=System.nanoTime(); + if (remaining.length Inventory Update Trigger", (int)(System.nanoTime()-time1));time1=System.nanoTime(); + return; + } + //Collect this item. + + } } + TwosideKeeper.HeartbeatLogger.AddEntry("VAC -> Entire Check", (int)(System.nanoTime()-time1));time1=System.nanoTime(); } private void PopRandomLavaBlock(Player p) {