diff --git a/TwosideKeeper.jar b/TwosideKeeper.jar index cb06c62..16b9f23 100644 Binary files a/TwosideKeeper.jar and b/TwosideKeeper.jar differ diff --git a/src/plugin.yml b/src/plugin.yml index f452405..97e4984 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: TwosideKeeper main: sig.plugin.TwosideKeeper.TwosideKeeper -version: 3.7.3-alpha6 +version: 3.7.3 commands: money: description: Tells the player the amount of money they are holding. @@ -106,4 +106,14 @@ commands: description: DPS Logger. usage: /dps permission: TwosideKeeper.money + permission-message: No permissions! + muchlogsmuchwow: + description: D00d. + usage: /muchlogsmuchwow + permission: TwosideKeeper.muchlogsmuchwow + permission-message: No permissions! + make_set_item: + description: Turns an item into a set. + usage: /make_set_item + permission: TwosideKeeper.makesetitem permission-message: No permissions! \ No newline at end of file diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java index 5d30955..a613d04 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java @@ -57,6 +57,7 @@ import sig.plugin.TwosideKeeper.PlayerStructure; import sig.plugin.TwosideKeeper.TwosideKeeper; import sig.plugin.TwosideKeeper.HelperStructures.ArtifactAbility; import sig.plugin.TwosideKeeper.HelperStructures.BowMode; +import sig.plugin.TwosideKeeper.HelperStructures.ItemSet; import sig.plugin.TwosideKeeper.HelperStructures.WorldShop; public class GenericFunctions { @@ -1869,7 +1870,8 @@ public class GenericFunctions { item.getType().toString().contains("CHESTPLATE") || item.getType().toString().contains("LEGGINGS") || item.getType().toString().contains("HELMET") || - item.getType().toString().contains("FISHING_ROD"))) { + item.getType().toString().contains("FISHING_ROD") || + item.getType().toString().contains("SHIELD"))) { return true; } else { return false; @@ -2069,7 +2071,7 @@ public class GenericFunctions { + ChatColor.GRAY+"->Swinging your weapon stops nearby flying arrows. Each arrow deflected will give you a Strength buff. Stacks up to Strength V (Lasts five seconds.)\n" + ChatColor.WHITE+"->Throwing your weapon will perform a line drive. Enemies you charge through take x7 your base damage. This costs 5% of your durability (Unbreaking decreases this amount.)\n" + ChatColor.GRAY+"->Strikers have a 20% chance to dodge incoming attacks from any damage source while moving.\n" - + ChatColor.WHITE+"->Hitting a target when both the player and the enemy are at full health deals x3 normal damage.\n" + + ChatColor.WHITE+"->Hitting a target when they have not noticed you yet does x3 normal damage.\n" ; } case "ranger":{ @@ -2501,6 +2503,10 @@ public class GenericFunctions { p.isOnGround() && p.getLocation().getY()>=0 && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=4) { dodgechance+=0.01*p.getEquipment().getItemInMainHand().getEnchantmentLevel(Enchantment.LUCK); } + + if (ItemSet.GetSetCount(ItemSet.PANROS, p)>=3) { + dodgechance+=0.20; + } if (isStriker(p) && pd.velocity>0) { @@ -2684,6 +2690,14 @@ public class GenericFunctions { AwakenedArtifact.addPotentialEXP(damager.getEquipment().getItemInMainHand(), (int)((ratio*20)+5), p); NewCombat.increaseArtifactArmorXP(p,(int)(ratio*10)+1); } + + if (damager instanceof Player) { + Player p = (Player)damager; + if (GenericFunctions.isEquip(p.getEquipment().getItemInMainHand())) { + aPlugin.API.damageItem(p, p.getEquipment().getItemInMainHand(), 1); + } + } + TwosideKeeper.log(ChatColor.BLUE+" "+oldhp+"->"+((LivingEntity)target).getHealth()+" HP",3); } @@ -2894,4 +2908,14 @@ public class GenericFunctions { } return false; } + + public static ItemStack[] getEquipment(LivingEntity ent) { + return new ItemStack[]{ + ent.getEquipment().getItemInMainHand(), + ent.getEquipment().getHelmet(), + ent.getEquipment().getChestplate(), + ent.getEquipment().getLeggings(), + ent.getEquipment().getBoots() + }; + } } diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/Habitation.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/Habitation.java index 5309e91..ab2184c 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/Habitation.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/Habitation.java @@ -47,7 +47,10 @@ public class Habitation { } public void addKillToLocation(LivingEntity l) { - String hash = getLocationHash(startinglocs.get(l.getUniqueId())); + String hash = getLocationHash(l.getLocation()); + if (startinglocs.containsKey(l.getUniqueId())) { + hash = getLocationHash(startinglocs.get(l.getUniqueId())); + } if (locationhashes.containsKey(hash)) { int spawnamt = locationhashes.get(hash); locationhashes.put(hash,++spawnamt); diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java b/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java new file mode 100644 index 0000000..3031f3d --- /dev/null +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java @@ -0,0 +1,88 @@ +package sig.plugin.TwosideKeeper.HelperStructures; + +import java.util.List; + +import org.bukkit.ChatColor; +import org.bukkit.entity.LivingEntity; +import org.bukkit.inventory.ItemStack; + +import sig.plugin.TwosideKeeper.TwosideKeeper; +import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; + +public enum ItemSet { + PANROS(1,2,3), + SONGSTEEL(4,6,10), + DAWNTRACKER(3,5,8), + LORASYS(0,0,0); + + int val1; + int val2; + int val3; + + ItemSet(int val1,int val2, int val3) { + this.val1=val1; + this.val2=val2; + this.val3=val3; + } + + public static boolean isSetItem(ItemStack item) { + return GetSet(item)!=null; + } + + public static ItemSet GetSet(ItemStack item) { + if (GenericFunctions.isEquip(item) && + item.getItemMeta().hasLore()) { + List lore = item.getItemMeta().getLore(); + for (int i=0;i lore = item.getItemMeta().getLore(); + for (int i=0;i lore = new ArrayList(); + int type = (int)(Math.random()*3); + String set_name = ""; + String prefix = ""; + prefix = (hardened)?(ChatColor.LIGHT_PURPLE+""+ChatColor.BOLD+"Hardened Mega "):(ChatColor.AQUA+""+ChatColor.BOLD+"Mega "); + switch (type) { + case 0:{ + set_name = prefix+"Panros Striker "+GenericFunctions.UserFriendlyMaterialName(item.getType()); //Striker set. + }break; + case 1:{ + if (item.getType().toString().contains("SWORD")) { + item.setType(Material.SHIELD); + } + set_name = prefix+"Songsteel Defender "+GenericFunctions.UserFriendlyMaterialName(item.getType()); //Defender set. + }break; + case 2:{ + if (item.getType().toString().contains("SWORD")) { + item.setType(Material.valueOf(item.getType().toString().replace("SWORD","")+"AXE")); + } + set_name = prefix+"Dawntracker Barbarian "+GenericFunctions.UserFriendlyMaterialName(item.getType()); + }break; + case 3:{ + if (item.getType().toString().contains("SWORD")) { + //Convert Slayer weapon here. ??? + } + set_name = prefix+"Lorasys Slayer "+GenericFunctions.UserFriendlyMaterialName(item.getType()); + }break; } + if (item.getItemMeta().hasLore()) { + lore = item.getItemMeta().getLore(); + } + if (item.getType().toString().contains("STONE") || item.getType().toString().contains("IRON")) { //This is a tier 1/2 piece. + int tier = (item.getType().toString().contains("STONE")?1:2); + switch (type) { + case 0:{ + lore.add(ChatColor.LIGHT_PURPLE+"Striker Gear"); + lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Panros Set"); + lore.add(ChatColor.YELLOW+"+1 Damage"); + }break; + case 1:{ + lore.add(ChatColor.LIGHT_PURPLE+"Defender Gear"); + lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Songsteel Set"); + lore.add(ChatColor.YELLOW+"+4 Health"); + }break; + case 2:{ + lore.add(ChatColor.LIGHT_PURPLE+"Barbarian Gear"); + lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Dawntracker Set"); + lore.add(ChatColor.YELLOW+"+3% Lifesteal"); + }break; + case 3:{ + lore.add(ChatColor.LIGHT_PURPLE+"Slayer Gear"); + lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Lorasys Set"); + lore.add(ChatColor.YELLOW+"???"); + }break; + } + } else + if (item.getType().toString().contains("DIAMOND")) { //This is a tier 3 piece. + switch (type) { + case 0:{ + lore.add(ChatColor.LIGHT_PURPLE+"Striker Gear"); + lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T3 Panros Set"); + lore.add(ChatColor.YELLOW+"+2 Damage"); + }break; + case 1:{ + lore.add(ChatColor.LIGHT_PURPLE+"Defender Gear"); + lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T3 Songsteel Set"); + lore.add(ChatColor.YELLOW+"+6 Health"); + }break; + case 2:{ + lore.add(ChatColor.LIGHT_PURPLE+"Barbarian Gear"); + lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T3 Dawntracker Set"); + lore.add(ChatColor.YELLOW+"+5% Lifesteal"); + }break; + case 3:{ + lore.add(ChatColor.LIGHT_PURPLE+"Slayer Gear"); + lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T3 Lorasys Set"); + lore.add(ChatColor.YELLOW+"???"); + }break; + } + } else + if (item.getType().toString().contains("GOLD")) { //This is a tier 4 piece. + switch (type) { + case 0:{ + lore.add(ChatColor.LIGHT_PURPLE+"Striker Gear"); + lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T4 Panros Set"); + lore.add(ChatColor.YELLOW+"+3 Damage"); + }break; + case 1:{ + lore.add(ChatColor.LIGHT_PURPLE+"Defender Gear"); + lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T4 Songsteel Set"); + lore.add(ChatColor.YELLOW+"+10 Health"); + }break; + case 2:{ + lore.add(ChatColor.LIGHT_PURPLE+"Barbarian Gear"); + lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T4 Dawntracker Set"); + lore.add(ChatColor.YELLOW+"+8% Lifesteal"); + }break; + case 3:{ + lore.add(ChatColor.LIGHT_PURPLE+"Slayer Gear"); + lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T4 Lorasys Set"); + lore.add(ChatColor.YELLOW+"???"); + }break; + } + } else + { + lore.add(ChatColor.LIGHT_PURPLE+"Defender Gear"); + lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T4 Songsteel Set"); + lore.add(ChatColor.YELLOW+"+10 Health"); + } + + lore.add(""); + + switch (type) { + case 0:{ + lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); + lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +5 Damage"); + lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +20% Dodge Chance"); + lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +40% Critical Chance"); + lore.add(ChatColor.DARK_AQUA+" 5 - "+ChatColor.WHITE+" Powered Line Drive"); + lore.add(ChatColor.GRAY+" Press the drop key while performing the"); + lore.add(ChatColor.GRAY+" first line drive to line drive a second"); + lore.add(ChatColor.GRAY+" time in another direction."); + }break; + case 1:{ + lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); + lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +8 Max Health"); + lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +12 Absorption (30 seconds)"); + lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +30% Damage Reduction"); + lore.add(ChatColor.DARK_AQUA+" 5 - "+ChatColor.WHITE+" Vendetta"); + lore.add(ChatColor.GRAY+" Blocking stores 30% of mitigation damage."); + lore.add(ChatColor.GRAY+" Attacking with a shield unleashes all stored"); + lore.add(ChatColor.GRAY+" mitigation damage."); + }break; + case 2:{ + lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); + lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +3 Damage"); + lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +10% Lifesteal"); + lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +6 Damage"); + lore.add(ChatColor.DARK_AQUA+" 5 - "+ChatColor.WHITE+" Powered Mock"); + lore.add(ChatColor.GRAY+" Mock debuff duration increases from"); + lore.add(ChatColor.GRAY+" 10->20 seconds, making it stackable."); + }break; + case 3:{ + lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); + lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" ???"); + lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" ???"); + lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" ???"); + lore.add(ChatColor.DARK_AQUA+" 5 - "+ChatColor.WHITE+" ???"); + }break; + } + ItemMeta m = item.getItemMeta(); + m.setLore(lore); + m.setDisplayName(set_name); + item.setItemMeta(m); return item; } diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/MonsterDifficulty.java b/src/sig/plugin/TwosideKeeper/HelperStructures/MonsterDifficulty.java index bccedb6..fa003aa 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/MonsterDifficulty.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/MonsterDifficulty.java @@ -298,7 +298,11 @@ public enum MonsterDifficulty { //Turn it into a Mega Piece. if (GenericFunctions.isTool(new ItemStack(ls.GetMaterial()))) { if (Math.random()<=0.1) { - return Loot.GenerateMegaPiece(ls.GetMaterial(), ls.GetHardened()); + if (Math.random()<=0.8) { + return Loot.GenerateMegaPiece(ls.GetMaterial(), ls.GetHardened(),true); + } else { + return Loot.GenerateMegaPiece(ls.GetMaterial(), ls.GetHardened(),false); + } } else { return new ItemStack(ls.GetMaterial(),1,(short)(Math.random()*ls.GetMaterial().getMaxDurability())); } @@ -311,7 +315,11 @@ public enum MonsterDifficulty { return DistributeRandomLoot(lootlist,isRanger); } } else { - return Loot.GenerateMegaPiece(ls.GetMaterial(), ls.GetHardened()); + if (Math.random()<=0.8) { + return Loot.GenerateMegaPiece(ls.GetMaterial(), ls.GetHardened(),true); + } else { + return Loot.GenerateMegaPiece(ls.GetMaterial(), ls.GetHardened(),false); + } } } } else { diff --git a/src/sig/plugin/TwosideKeeper/NewCombat.java b/src/sig/plugin/TwosideKeeper/NewCombat.java index 51e43b2..e71e371 100644 --- a/src/sig/plugin/TwosideKeeper/NewCombat.java +++ b/src/sig/plugin/TwosideKeeper/NewCombat.java @@ -45,6 +45,7 @@ import com.google.common.collect.Iterables; import sig.plugin.TwosideKeeper.HelperStructures.ArtifactAbility; import sig.plugin.TwosideKeeper.HelperStructures.ArtifactAbilityApplyEffects; import sig.plugin.TwosideKeeper.HelperStructures.BowMode; +import sig.plugin.TwosideKeeper.HelperStructures.ItemSet; import sig.plugin.TwosideKeeper.HelperStructures.MonsterDifficulty; import sig.plugin.TwosideKeeper.HelperStructures.MonsterType; import sig.plugin.TwosideKeeper.HelperStructures.Common.DamageType; @@ -126,7 +127,7 @@ public class NewCombat { double finaldmg = calculateBonusMultiplier(totaldmg,bonusmult); playerAddArtifactEXP(target,finaldmg); - applyOnHitMobEffects(target,damager); + applyOnHitMobEffects(target,damager,finaldmg); finaldmg = CalculateDamageReduction(finaldmg,target,damager); return calculateAbsorptionHearts(target, finaldmg); @@ -141,7 +142,13 @@ public class NewCombat { if (shooter!=null) { if (shooter instanceof Player) { + Player p = (Player)shooter; + ItemStack weapon = p.getEquipment().getItemInMainHand(); + totaldmg+=CalculateWeaponDamage(damager, target); + double mult1 = calculatePlayerCriticalStrike(weapon,damager); + addMultiplierToPlayerLogger(damager,"Critical Strike Mult",mult1); + bonusmult*=mult1; } } @@ -499,6 +506,49 @@ public class NewCombat { addToPlayerLogger(ent,"Weapon Base Damage",dmg); basedmg += dmg; } + + for (int i=0;i=5) { + PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); + if (pd.vendetta_amt>0.0) { + p.playSound(p.getLocation(), Sound.BLOCK_GLASS_BREAK, 1.0f, 0.5f); + double dmg = pd.vendetta_amt; + addToPlayerLogger(ent,"Vendetta",dmg); + basedmg += dmg; + pd.vendetta_amt=0.0; + aPlugin.API.sendActionBarMessage(p, ChatColor.YELLOW+"Vendetta: "+ChatColor.GREEN+Math.round(pd.vendetta_amt)+" dmg stored"); + } + } + } + + if (ItemSet.GetSetCount(ItemSet.PANROS, shooter)>=2) { + double dmg = 5; + addToPlayerLogger(ent,"Set Bonus",dmg); + basedmg += dmg; + } + if (ItemSet.GetSetCount(ItemSet.DAWNTRACKER, shooter)>=2) { + double dmg = 3; + addToPlayerLogger(ent,"Set Bonus",dmg); + basedmg += dmg; + } + if (ItemSet.GetSetCount(ItemSet.DAWNTRACKER, shooter)>=4) { + double dmg = 3; + addToPlayerLogger(ent,"Set Bonus",dmg); + basedmg += dmg; + } + if (GenericFunctions.isHardenedItem(weapon) && !GenericFunctions.isArtifactEquip(weapon)) { double mult = 2.0; addMultiplierToPlayerLogger(ent,"Hardened Item Mult",mult); @@ -766,10 +816,7 @@ public class NewCombat { static double calculateArtifactAbilityMultiplier(ItemStack weapon, Entity damager, LivingEntity target) { double mult = 1.0; - double mult1 = calculatePlayerCriticalStrike(weapon,damager); - addMultiplierToPlayerLogger(damager,"Critical Strike Mult",mult1); - mult*=mult1; - mult1 = calculateBeliggerentMultiplier(weapon,damager); + double mult1 = calculateBeliggerentMultiplier(weapon,damager); addMultiplierToPlayerLogger(damager,"Belliggerent Mult",mult1); mult*=mult1; return mult; @@ -777,8 +824,10 @@ public class NewCombat { static double calculatePlayerCriticalStrike(ItemStack weapon, Entity damager) { boolean criticalstrike=false; - TwosideKeeper.log("Crit Strike chance is "+0.01*GenericFunctions.getAbilityValue(ArtifactAbility.CRITICAL,weapon), 4); - criticalstrike = isCriticalStrike(0.01*GenericFunctions.getAbilityValue(ArtifactAbility.CRITICAL,weapon)); + double critchance = 0.0; + critchance += calculateCriticalStrikeChance(weapon, damager); + TwosideKeeper.log("Crit Strike chance is "+critchance,2); + criticalstrike = isCriticalStrike(critchance); if (damager instanceof Player && criticalstrike) { Player p = (Player)damager; p.playSound(p.getLocation(), Sound.ENTITY_PLAYER_ATTACK_CRIT, 1.0f, 1.0f); @@ -786,6 +835,20 @@ public class NewCombat { return criticalstrike?(calculateCriticalStrikeMultiplier(weapon)):1.0; } + static double calculateCriticalStrikeChance(ItemStack weapon, Entity damager) { + double critchance = 0.0; + critchance += 0.01*GenericFunctions.getAbilityValue(ArtifactAbility.CRITICAL,weapon); + LivingEntity shooter = getDamagerEntity(damager); + if (shooter!=null) { + if (shooter instanceof Player) { + Player p = (Player)shooter; + critchance += (GenericFunctions.isStriker(p)?0.2:0.0); + } + critchance += (ItemSet.GetSetCount(ItemSet.PANROS, shooter)>=4)?0.4:0.0; + } + return critchance; + } + //Chance is between 0.0-1.0. 1.0 is 100%. static boolean isCriticalStrike(double chance) { return (Math.random()<=chance); @@ -928,11 +991,19 @@ public class NewCombat { }} ,100); + healDefenderSaturation(p); + increaseSwordComboCount(weapon, p); } } } + private static void healDefenderSaturation(Player p) { + if (GenericFunctions.isDefender(p) && p.getSaturation()<20) { + p.setSaturation(p.getSaturation()+1); + } + } + public static void increaseArtifactArmorXP(Player p, int exp) { for (int i=0;i=4) { + dmgreduction *= 1.3; + } } //Blocking: -((p.isBlocking())?ev.getDamage()*0.33:0) //33% damage will be reduced if we are blocking. @@ -1119,7 +1193,9 @@ public class NewCombat { if (damager instanceof Player) { Player p = (Player)damager; - double healamt = finaldmg*GenericFunctions.getAbilityValue(ArtifactAbility.LIFESTEAL, p.getEquipment().getItemInMainHand())/100; + double lifestealpct = calculateLifeStealAmount(p); + + double healamt = finaldmg*lifestealpct; //log("Healed "+healamt+" damage.",2); double newhealth = p.getHealth()+healamt; if (newhealth>p.getMaxHealth()) { @@ -1136,6 +1212,23 @@ public class NewCombat { return finaldmg; } + public static double calculateLifeStealAmount(Player p) { + double lifestealpct = GenericFunctions.getAbilityValue(ArtifactAbility.LIFESTEAL, p.getEquipment().getItemInMainHand())/100; + + for (int i=0;i=3) { + lifestealpct += 0.10; + } + return lifestealpct; + } + private static void playerAddArtifactEXP(LivingEntity target, double dmg) { if (target instanceof Player) { Player p = (Player)target; @@ -1259,7 +1352,7 @@ public class NewCombat { return Math.abs(arrowLoc.getY()-monsterHead.getY())<=headshot_acc || arrowLoc.getY()>monsterHead.getY(); } - private static void applyOnHitMobEffects(LivingEntity target, Entity damager) { + private static void applyOnHitMobEffects(LivingEntity target, Entity damager, double dmg) { if (target instanceof Player) { Player p = (Player)target; if (GenericFunctions.isDefender(p)) { @@ -1271,6 +1364,12 @@ public class NewCombat { p.removePotionEffect(PotionEffectType.DAMAGE_RESISTANCE); p.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,100,resistlevel)); } + if (p.isBlocking() && ItemSet.GetSetCount(ItemSet.SONGSTEEL, p)>=5) { + PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); + pd.vendetta_amt+=(dmg-CalculateDamageReduction(dmg,target,damager))*0.3; + aPlugin.API.sendActionBarMessage(p, ChatColor.YELLOW+"Vendetta: "+ChatColor.GREEN+Math.round(pd.vendetta_amt)+" dmg stored"); + } + } if (damager instanceof Enderman) { if (MonsterController.getMonsterDifficulty(((Monster)damager))==MonsterDifficulty.HELLFIRE) { diff --git a/src/sig/plugin/TwosideKeeper/PlayerStructure.java b/src/sig/plugin/TwosideKeeper/PlayerStructure.java index 85a8bc7..0df6c93 100644 --- a/src/sig/plugin/TwosideKeeper/PlayerStructure.java +++ b/src/sig/plugin/TwosideKeeper/PlayerStructure.java @@ -85,6 +85,7 @@ public class PlayerStructure { public double deathloc_z = 0; public String deathloc_world = ""; public List deathloot = new ArrayList(); + public double vendetta_amt = 0.0; public double prev_weapondmg=0.0; public double prev_buffdmg=0.0; diff --git a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java index 5d3d926..70e08f8 100644 --- a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java +++ b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java @@ -189,6 +189,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.CustomRecipe; import sig.plugin.TwosideKeeper.HelperStructures.DeathStructure; import sig.plugin.TwosideKeeper.HelperStructures.ItemCube; import sig.plugin.TwosideKeeper.HelperStructures.ItemRarity; +import sig.plugin.TwosideKeeper.HelperStructures.ItemSet; import sig.plugin.TwosideKeeper.HelperStructures.MalleableBaseQuest; import sig.plugin.TwosideKeeper.HelperStructures.MonsterDifficulty; import sig.plugin.TwosideKeeper.HelperStructures.MonsterType; @@ -441,7 +442,23 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } getServer().getScheduler().runTaskLaterAsynchronously(this, new DiscordStatusUpdater(), 300l); - + + getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){ + public void run(){ + for (int i=0;i=3) { + if (p.hasPotionEffect(PotionEffectType.ABSORPTION)) { + int oldlv = GenericFunctions.getPotionEffectLevel(PotionEffectType.ABSORPTION, p)+1; + p.removePotionEffect(PotionEffectType.ABSORPTION); + p.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION,599,2+oldlv)); + } else { + p.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION,599,2)); + } + } + } + } + },0l,600l); //This is the constant timing method. getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){ public void run(){ @@ -882,7 +899,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } if (SERVER_TYPE==ServerType.TEST || SERVER_TYPE==ServerType.QUIET) { //TwosideKeeperAPI.spawnAdjustedMonster(MonsterType.GIANT, p.getLocation()); - Skeleton s = (Skeleton)p.getWorld().spawnEntity(p.getLocation(), EntityType.SKELETON); + //TwosideKeeper.log("This is from set "+ItemSet.GetSet(p.getEquipment().getItemInMainHand())+" T"+ItemSet.GetTier(p.getEquipment().getItemInMainHand()),2); + /*Skeleton s = (Skeleton)p.getWorld().spawnEntity(p.getLocation(), EntityType.SKELETON); Horse h = (Horse)p.getWorld().spawnEntity(p.getLocation(), EntityType.HORSE); s.setSkeletonType(SkeletonType.NORMAL); @@ -893,7 +911,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { h.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(0.385f); h.getInventory().setArmor(new ItemStack(Material.DIAMOND_BARDING)); h.getInventory().setItem(0, new ItemStack(Material.DIAMOND_BARDING)); - h.setPassenger(s); + h.setPassenger(s);*/ //Arrow newar = p.getWorld().spawnArrow(p.getLocation(), p.getLocation().getDirection(), 1f, 12f); //GenericFunctions.setBowMode(p.getEquipment().getItemInMainHand(), BowMode.SNIPE); @@ -1128,7 +1146,28 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } pd.damagelogging=!pd.damagelogging; return true; + } else + if (cmd.getName().equalsIgnoreCase("muchlogsmuchwow")) { + Player p = (Player)sender; + for (int i=0;i<64;i++) { + Item it = p.getWorld().dropItemNaturally(p.getLocation(), new ItemStack(Material.LOG,64,(short)3)); + it.setPickupDelay(0); + } + return true; + } else + if (cmd.getName().equalsIgnoreCase("make_set_item")) { + Player p = (Player)sender; + List lore = new ArrayList(); + if (p.getEquipment().getItemInMainHand().getItemMeta().hasLore()) { + lore = p.getEquipment().getItemInMainHand().getItemMeta().getLore(); + } + lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+Integer.parseInt(args[1])+" "+ItemSet.valueOf(args[0])+" Set"); + ItemMeta m = p.getEquipment().getItemInMainHand().getItemMeta(); + m.setLore(lore); + p.getEquipment().getItemInMainHand().setItemMeta(m); + return true; } + } else { //Implement console/admin version later (Let's you check any name's money.) } @@ -1984,7 +2023,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { if (GenericFunctions.isDefender(player)) { player.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION,200,1)); List entities = player.getNearbyEntities(16, 16, 16); - for (int i=0;i=5; ev.getItemDrop().setPickupDelay(0); - final Vector facing = ev.getPlayer().getLocation().getDirection().setY(0); - ev.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SLOW,15,20)); - aPlugin.API.sendCooldownPacket(ev.getPlayer(), ev.getItemDrop().getItemStack(), 160); - aPlugin.API.sendCooldownPacket(ev.getPlayer(), ev.getItemDrop().getItemStack(), 160); - pd.last_strikerspell=getServerTickTime(); + Vector facing = ev.getPlayer().getLocation().getDirection(); + if (!second_charge) { + facing = ev.getPlayer().getLocation().getDirection().setY(0); + ev.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SLOW,(ex_version)?7:15,20)); + } + if (!ex_version || second_charge) { + aPlugin.API.sendCooldownPacket(ev.getPlayer(), ev.getItemDrop().getItemStack(), 160); + aPlugin.API.sendCooldownPacket(ev.getPlayer(), ev.getItemDrop().getItemStack(), 160); + pd.last_strikerspell=getServerTickTime(); + } ev.getPlayer().playSound(ev.getPlayer().getLocation(), Sound.UI_BUTTON_CLICK, 1.0f, 1.0f); aPlugin.API.damageItem(ev.getPlayer(), ev.getItemDrop().getItemStack(), ev.getItemDrop().getItemStack().getType().getMaxDurability()/20); final PlayerDropItemEvent ev1 = ev; @@ -2763,18 +2810,25 @@ public class TwosideKeeper extends JavaPlugin implements Listener { int mult=2; final double xspd=ev1.getPlayer().getLocation().getDirection().getX()*mult; - final double yspd=0; + double tempyspd=0; + final double yspd=tempyspd; final double zspd=ev1.getPlayer().getLocation().getDirection().getZ()*mult; final double xpos=ev1.getPlayer().getLocation().getX(); final double ypos=ev1.getPlayer().getLocation().getY(); final double zpos=ev1.getPlayer().getLocation().getZ(); + + final Vector facing1 = facing; Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() { public void run() { - ev1.getPlayer().setVelocity(facing.multiply(8)); + ev1.getPlayer().setVelocity(facing1.multiply(8)); GenericFunctions.addIFrame(ev1.getPlayer(), 10); ev1.getPlayer().playSound(ev1.getPlayer().getLocation(), Sound.ITEM_CHORUS_FRUIT_TELEPORT, 1.0f, 1.0f); - - AreaEffectCloud lp = (AreaEffectCloud)ev1.getPlayer().getWorld().spawnEntity(ev1.getPlayer().getLocation(), EntityType.AREA_EFFECT_CLOUD); + + final Location newpos=new Location(ev1.getPlayer().getWorld(),xpos,ypos,zpos); + final double xpos=ev1.getPlayer().getLocation().getX(); + final double ypos=ev1.getPlayer().getLocation().getY(); + final double zpos=ev1.getPlayer().getLocation().getZ(); + AreaEffectCloud lp = (AreaEffectCloud)ev1.getPlayer().getWorld().spawnEntity(newpos, EntityType.AREA_EFFECT_CLOUD); lp.setColor(Color.OLIVE); DecimalFormat df = new DecimalFormat("0.00"); lp.setCustomName("LD "+df.format(NewCombat.CalculateWeaponDamage(ev1.getPlayer(),null)*7)+" "+ev1.getPlayer().getName()); @@ -2789,10 +2843,13 @@ public class TwosideKeeper extends JavaPlugin implements Listener { final String customname = lp.getCustomName(); for (int i=0;i"+((LivingEntity)ev.getEntity()).getHealth()+" HP",3); }},1); + if (ev.getDamager() instanceof Player) { + Player p = (Player)ev.getDamager(); + if (GenericFunctions.isEquip(p.getEquipment().getItemInMainHand())) { + aPlugin.API.damageItem(p, p.getEquipment().getItemInMainHand(), 1); + } + } } } //Negative damage doesn't make sense. We'd apply it normally. } @@ -4159,7 +4231,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener { Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() { public void run() { for (int i=0;i=2) { + hp += 8; + } + /* if (p.hasPotionEffect(PotionEffectType.ABSORPTION)) { Collection player_effects = p.getActivePotionEffects(); @@ -6037,6 +6124,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener { p.sendMessage("Habitat Quality: "+habitat_data.getHabitationLevel(p.getLocation())); p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Base Damage: "+ChatColor.RESET+""+ChatColor.DARK_PURPLE+df.format(store2)); p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Damage Reduction: "+ChatColor.RESET+""+ChatColor.DARK_AQUA+df.format((1.0-store1)*100)+"%"); + p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Life Steal: "+ChatColor.RESET+""+ChatColor.DARK_AQUA+df.format(NewCombat.calculateLifeStealAmount(p)*100)+"%"); + p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Critical Strike Chance: "+ChatColor.RESET+""+ChatColor.DARK_AQUA+df.format((NewCombat.calculateCriticalStrikeChance(p.getEquipment().getItemInMainHand(), p))*100)+"%"); p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Dodge Chance: "+ChatColor.RESET+""+ChatColor.DARK_AQUA+df.format((GenericFunctions.CalculateDodgeChance(p))*100)+"%"); TextComponent f = new TextComponent(ChatColor.GRAY+""+ChatColor.ITALIC+"Current Mode: "); f.addExtra(GenericFunctions.PlayerModeName(p)); diff --git a/src/sig/plugin/TwosideKeeper/TwosideKeeperAPI.java b/src/sig/plugin/TwosideKeeper/TwosideKeeperAPI.java index 09c0fc9..f68c833 100644 --- a/src/sig/plugin/TwosideKeeper/TwosideKeeperAPI.java +++ b/src/sig/plugin/TwosideKeeper/TwosideKeeperAPI.java @@ -123,6 +123,9 @@ public final class TwosideKeeperAPI { public static ItemStack generateMegaPiece(Material item, boolean hardened) { return Loot.GenerateMegaPiece(item, hardened); } + public static ItemStack generateMegaPiece(Material item, boolean hardened, boolean isSetPiece) { + return Loot.GenerateMegaPiece(item, hardened, isSetPiece); + } //Server COMMANDS. public static ServerType getServerType() {