diff --git a/TwosideKeeper.jar b/TwosideKeeper.jar index de6ce11..0608d79 100644 Binary files a/TwosideKeeper.jar and b/TwosideKeeper.jar differ diff --git a/src/plugin.yml b/src/plugin.yml index 82c22c7..97c3a7c 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: TwosideKeeper main: sig.plugin.TwosideKeeper.TwosideKeeper -version: 3.8.3r1 +version: 3.8.4 commands: money: description: Tells the player the amount of money they are holding. diff --git a/src/sig/plugin/TwosideKeeper/EliteMonster.java b/src/sig/plugin/TwosideKeeper/EliteMonster.java index 47b3b39..8dd76c0 100644 --- a/src/sig/plugin/TwosideKeeper/EliteMonster.java +++ b/src/sig/plugin/TwosideKeeper/EliteMonster.java @@ -370,6 +370,12 @@ public class EliteMonster { } } if (!storingenergy) { + if (storingenergy_hit>0) { + storingenergy_hit/=1.02f; + if (storingenergy_hit<10) { + storingenergy_hit=0; + } + } if (l.getLocation().distanceSquared(m.getLocation())>4096) { //Lose the target. targetlist.remove(l); @@ -470,7 +476,10 @@ public class EliteMonster { targetlist.get(i).sendMessage(ChatColor.GOLD+"The "+m.getCustomName()+ChatColor.GOLD+" is absorbing energy!"); } m.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(0f); - last_storingenergy_health=m.getHealth(); + Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() { + public void run() { + last_storingenergy_health=m.getHealth(); + }},5*1); Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() { public void run() { Player target = ChooseRandomTarget(); @@ -483,6 +492,8 @@ public class EliteMonster { } m.setTarget(target); storingenergy=false; + } else { + storingenergy=false; } } else { storingenergy=false; diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java index b34a35f..6b7556c 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java @@ -2473,10 +2473,13 @@ public class GenericFunctions { } return item; } - + public static boolean HasFullRangerSet(Player p) { - - int rangerarmort1 = 0; //Count the number of each tier of sets. + return ItemSet.hasFullSet(p, ItemSet.ALIKAHN) || + ItemSet.hasFullSet(p, ItemSet.DARNYS) || + ItemSet.hasFullSet(p, ItemSet.JAMDAK) || + ItemSet.hasFullSet(p, ItemSet.LORASAADI); + /*int rangerarmort1 = 0; //Count the number of each tier of sets. //LEGACY CODE. int rangerarmort2 = 0; int rangerarmort3 = 0; int rangerarmort4 = 0; @@ -2510,7 +2513,7 @@ public class GenericFunctions { pd.hasfullrangerset=false; } - return pd.hasfullrangerset; + return pd.hasfullrangerset;*/ } public static ItemStack applyModeName(ItemStack item) { @@ -2948,6 +2951,7 @@ public class GenericFunctions { (int)(NewCombat.CalculateGracefulDodgeTicks(p)), 0) ); + break; } } p.setNoDamageTicks(10); @@ -3092,7 +3096,7 @@ public class GenericFunctions { } else { pd.hitlist.put(p.getUniqueId(), TwosideKeeper.getServerTickTime()); } - } + } else if (entity instanceof Monster) { Monster m = (Monster)entity; MonsterStructure md = MonsterStructure.getMonsterStructure(m); @@ -3232,20 +3236,65 @@ public class GenericFunctions { //Save the tier and type as well. ItemSet set = ItemSet.GetSet(item); int tier = ItemSet.GetTier(item); - - List newlore = new ArrayList(); - - if (GenericFunctions.isHardenedItem(item)) { - newlore.add(ChatColor.GRAY+"Breaks Remaining: "+ChatColor.YELLOW+GenericFunctions.getHardenedItemBreaks(item)); - } - newlore.addAll(ItemSet.GenerateLore(set, tier)); - ItemMeta m = item.getItemMeta(); - m.setLore(newlore); - item.setItemMeta(m); + item = UpdateSetLore(set,tier,item); } + UpdateOldRangerPieces(item); return item; } + private static ItemStack UpdateSetLore(ItemSet set, int tier, ItemStack item) { + List newlore = new ArrayList(); + + if (GenericFunctions.isHardenedItem(item)) { + newlore.add(ChatColor.GRAY+"Breaks Remaining: "+ChatColor.YELLOW+GenericFunctions.getHardenedItemBreaks(item)); + } + newlore.addAll(ItemSet.GenerateLore(set, tier)); + ItemMeta m = item.getItemMeta(); + m.setLore(newlore); + item.setItemMeta(m); + return item; + } + + private static void UpdateOldRangerPieces(ItemStack item) { + if (item!=null + && item.getType()!=Material.AIR && + item.hasItemMeta() && item.getItemMeta().hasLore()) { + boolean rangerarmor=false; + if (item.getItemMeta().getLore().contains(ChatColor.GOLD+""+ChatColor.BOLD+"Jamdak Set") || + item.getItemMeta().getLore().contains(ChatColor.GOLD+""+ChatColor.BOLD+"Darnys Set") || + item.getItemMeta().getLore().contains(ChatColor.GOLD+""+ChatColor.BOLD+"Alikahn Set") || + item.getItemMeta().getLore().contains(ChatColor.GOLD+""+ChatColor.BOLD+"Lorasaadi Set")) { + //This is an old set item. Update it to the new set piece. + ItemSet set = null; + if (item.getItemMeta().getLore().contains(ChatColor.GOLD+""+ChatColor.BOLD+"Jamdak Set")) { + set = ItemSet.JAMDAK; + } + if (item.getItemMeta().getLore().contains(ChatColor.GOLD+""+ChatColor.BOLD+"Darnys Set")) { + set = ItemSet.DARNYS; + } + if (item.getItemMeta().getLore().contains(ChatColor.GOLD+""+ChatColor.BOLD+"Alikahn Set")) { + set = ItemSet.ALIKAHN; + } + if (item.getItemMeta().getLore().contains(ChatColor.GOLD+""+ChatColor.BOLD+"Lorasaadi Set")) { + set = ItemSet.LORASAADI; + } + int tier = 1; + UpdateSetLore(set,tier,item); + /*List currentlore = item.getItemMeta().getLore(); + ItemMeta m = item.getItemMeta(); + currentlore.add(0,ChatColor.LIGHT_PURPLE+"Ranger Gear"); + currentlore.add(1,ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" "+GenericFunctions.CapitalizeFirstLetters(set.name())+" Set"); + currentlore.add(2,ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+"% Dodge Chance"); + m.setLore(currentlore); + item.setItemMeta(m);*/ + /* + lore.add(); + lore.add(); + lore.add();*/ + } + } + } + public static ExperienceOrb spawnXP(Location location, int expAmount) { ExperienceOrb orb = location.getWorld().spawn(location, ExperienceOrb.class); orb.setExperience(orb.getExperience() + expAmount); @@ -3335,6 +3384,7 @@ public class GenericFunctions { (int)(NewCombat.CalculateGracefulDodgeTicks(p)), 0) ); + break; } } p.setNoDamageTicks(10); @@ -3456,6 +3506,7 @@ public class GenericFunctions { (int)(NewCombat.CalculateGracefulDodgeTicks(p)), 0) ); + break; } } p.setNoDamageTicks(10); @@ -3467,11 +3518,13 @@ public class GenericFunctions { public static void DealDamageToNearbyMobs(Location l, double basedmg, int range, boolean knockup, double knockupamt, Entity damager, boolean isLineDrive) { Collection ents = l.getWorld().getNearbyEntities(l, range, range, range); //We cleared the non-living entities, deal damage to the rest. + double origdmg = basedmg; for (Entity e : ents) { double dodgechance = 0.0; if (e instanceof Monster) { Monster m = (Monster)e; if (enoughTicksHavePassed(m,(Player)damager)) { + basedmg=origdmg; if (isLineDrive) { basedmg=TwosideKeeperAPI.getFinalDamage(basedmg, damager, m, false, "Line Drive"); basedmg*=1.0d+(4*((NewCombat.getPercentHealthMissing(m))/100d)); @@ -3598,12 +3651,16 @@ public class GenericFunctions { b.getType()==Material.NETHERRACK || b.getType()==Material.ENDER_STONE || b.getType()==Material.COBBLESTONE || + b.getType()==Material.MOSSY_COBBLESTONE || b.getType()==Material.LOG || b.getType()==Material.LOG_2 || b.getType()==Material.LEAVES || b.getType()==Material.LEAVES_2 || b.getType()==Material.STATIONARY_LAVA || - b.getType()==Material.STATIONARY_WATER) { + b.getType()==Material.STATIONARY_WATER || + b.getType()==Material.SNOW || + b.getType()==Material.ICE || + b.getType()==Material.PACKED_ICE) { return true; } return false; diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java b/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java index bd668ad..f609949 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java @@ -16,8 +16,12 @@ import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; public enum ItemSet { PANROS(1,1, 3,2, 10,10, 20,10), SONGSTEEL(4,2, 6,2, 8,4, 20,10), - DAWNTRACKER(4,4, 6,4, 20,20, 20,20), - LORASYS(0,0, 0,0, 0,0, 0,0); + DAWNTRACKER(4,4, 6,4, 20,10, 20,10), + LORASYS(0,0, 0,0, 0,0, 0,0), + JAMDAK(1,1, 3,9, 4,4, 10,5), + DARNYS(2,1, 6,13, 5,5, 10,8), + ALIKAHN(3,1, 9,15, 6,6, 10,10), + LORASAADI(4,1, 12,17, 8,8, 10,15); int baseval; int increase_val; @@ -206,6 +210,26 @@ public enum ItemSet { lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Lorasys Set"); lore.add(ChatColor.YELLOW+"???"); }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"); + }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"); + }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"); + }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"); + }break; } lore.add(""); @@ -233,19 +257,43 @@ 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)+" Damage"); - lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+"% Debuff Resistance"); - lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4)+"% Lifesteal"); + 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)+" 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."); + lore.add(ChatColor.GRAY+" 10 -> 20 seconds, making it stackable."); }break; case LORASYS:{ 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+" ???"); + 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"); + lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4)+" Max Health"); + lore.add(ChatColor.DARK_AQUA+" 5 - "+ChatColor.WHITE+" Boosts All Modes of Ranger"); + lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Close Range Mode:"); + lore.add(ChatColor.GRAY+" Increases Tumble Invincibility from"); + lore.add(ChatColor.GRAY+" 1 -> 3 seconds"); + lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Sniper Mode:"); + lore.add(ChatColor.GRAY+" Increases Critical Damage by +100%"); + lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Debilitation Mode:"); + lore.add(ChatColor.GRAY+" Increases Armor Penetration by +50%."); + }break; + case JAMDAK: + case DARNYS: + case ALIKAHN: + case LORASAADI:{ + 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"); + lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4)+" Max Health"); + lore.add(ChatColor.DARK_AQUA+" 5 - "+ChatColor.WHITE+" Boosts All Modes of Ranger"); + lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Close Range Mode:"); + lore.add(ChatColor.GRAY+" Increases Tumble Invincibility from"); + lore.add(ChatColor.GRAY+" 1 -> 3 seconds"); + lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Sniper Mode:"); + lore.add(ChatColor.GRAY+" Increases Critical Damage by +100%"); + lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Debilitation Mode:"); + lore.add(ChatColor.GRAY+" Increases Armor Penetration by +50%."); }break; } return lore; diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java index eb0128f..e46a21a 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java @@ -137,6 +137,9 @@ public class Loot { public static ItemStack GenerateSetPiece(ItemStack item, boolean hardened, int tierbonus) { List lore = new ArrayList(); int type = (int)(Math.random()*3); + if (item.getType().name().contains("LEATHER") || item.getType()==Material.BOW) { + type=4+(int)(Math.random()*4); + } String set_name = ""; String prefix = ""; prefix = (hardened)?(ChatColor.LIGHT_PURPLE+""+ChatColor.BOLD+"Hardened Mega "):(ChatColor.AQUA+""+ChatColor.BOLD+"Mega "); @@ -167,6 +170,46 @@ public class Loot { } set_name = prefix+"Lorasys Slayer "+GenericFunctions.UserFriendlyMaterialName(item.getType()); }break; + case 4:{ + set = ItemSet.JAMDAK; + if (item.getType().toString().contains("SWORD")) { + item.setType(Material.BOW); + } + set_name = prefix+"Jamdak Ranger "+GenericFunctions.UserFriendlyMaterialName(item.getType()); + if (Math.random()<=0.5) { + tierbonus+=2; + } + }break; + case 5:{ + set = ItemSet.DARNYS; + if (item.getType().toString().contains("SWORD")) { + //Convert Slayer weapon here. ??? + } + set_name = prefix+"Darnys Ranger "+GenericFunctions.UserFriendlyMaterialName(item.getType()); + if (Math.random()<=0.5) { + tierbonus+=1; + } + }break; + case 6:{ + set = ItemSet.ALIKAHN; + if (item.getType().toString().contains("SWORD")) { + //Convert Slayer weapon here. ??? + } + set_name = prefix+"Alikahn Ranger "+GenericFunctions.UserFriendlyMaterialName(item.getType()); + if (Math.random()<=0.1) { + tierbonus+=1; + } + }break; + case 7:{ + set = ItemSet.LORASAADI; + if (item.getType().toString().contains("SWORD")) { + //Convert Slayer weapon here. ??? + } + set_name = prefix+"Lorasaadi Ranger "+GenericFunctions.UserFriendlyMaterialName(item.getType()); + if (tierbonus>0 && Math.random()<=0.5) { + tierbonus=0; + } + }break; } if (item.getItemMeta().hasLore()) { lore = item.getItemMeta().getLore(); diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/MonsterDifficulty.java b/src/sig/plugin/TwosideKeeper/HelperStructures/MonsterDifficulty.java index 5b5465c..8e52b76 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/MonsterDifficulty.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/MonsterDifficulty.java @@ -38,10 +38,6 @@ public enum MonsterDifficulty { new LootStructure(Material.GOLD_NUGGET,(int)((Math.random()*3)+1)), new LootStructure(Material.ENDER_PEARL,(int)((Math.random()*3)+1)), new LootStructure(Material.ENDER_CHEST), - new LootStructure(Material.LEATHER_HELMET,2), - new LootStructure(Material.LEATHER_CHESTPLATE,2), - new LootStructure(Material.LEATHER_LEGGINGS,2), - new LootStructure(Material.LEATHER_BOOTS,2), } ), DANGEROUS( @@ -60,10 +56,6 @@ public enum MonsterDifficulty { new LootStructure(Material.STONE_HOE, false), new LootStructure(Material.STONE_SPADE, false), new LootStructure(Material.FISHING_ROD, false), - new LootStructure(Material.LEATHER_HELMET,2), - new LootStructure(Material.LEATHER_CHESTPLATE,2), - new LootStructure(Material.LEATHER_LEGGINGS,2), - new LootStructure(Material.LEATHER_BOOTS,2), }, new LootStructure[]{ //Legendary Loot new LootStructure(Material.IRON_SWORD, true), @@ -76,10 +68,10 @@ public enum MonsterDifficulty { new LootStructure(Material.STONE_HOE, true), new LootStructure(Material.STONE_SPADE, true), new LootStructure(Material.FISHING_ROD, true), - new LootStructure(Material.LEATHER_HELMET,2), - new LootStructure(Material.LEATHER_CHESTPLATE,2), - new LootStructure(Material.LEATHER_LEGGINGS,2), - new LootStructure(Material.LEATHER_BOOTS,2), + new LootStructure(Material.LEATHER_HELMET), + new LootStructure(Material.LEATHER_CHESTPLATE), + new LootStructure(Material.LEATHER_LEGGINGS), + new LootStructure(Material.LEATHER_BOOTS), } ), DEADLY( @@ -120,10 +112,10 @@ public enum MonsterDifficulty { new LootStructure(Material.DIAMOND_BOOTS, true), new LootStructure(Material.DIAMOND_HELMET, true), new LootStructure(Material.FISHING_ROD, true), - new LootStructure(Material.LEATHER_HELMET,3), - new LootStructure(Material.LEATHER_CHESTPLATE,3), - new LootStructure(Material.LEATHER_LEGGINGS,3), - new LootStructure(Material.LEATHER_BOOTS,3), + new LootStructure(Material.LEATHER_HELMET), + new LootStructure(Material.LEATHER_CHESTPLATE), + new LootStructure(Material.LEATHER_LEGGINGS), + new LootStructure(Material.LEATHER_BOOTS), } ), HELLFIRE( @@ -174,10 +166,10 @@ public enum MonsterDifficulty { new LootStructure(Material.GOLD_HELMET, true), new LootStructure(Material.BOW, true), new LootStructure(Material.FISHING_ROD, true), - new LootStructure(Material.LEATHER_HELMET,4), - new LootStructure(Material.LEATHER_CHESTPLATE,4), - new LootStructure(Material.LEATHER_LEGGINGS,4), - new LootStructure(Material.LEATHER_BOOTS,4), + new LootStructure(Material.LEATHER_HELMET), + new LootStructure(Material.LEATHER_CHESTPLATE), + new LootStructure(Material.LEATHER_LEGGINGS), + new LootStructure(Material.LEATHER_BOOTS), } ), ELITE( @@ -199,10 +191,10 @@ public enum MonsterDifficulty { new LootStructure(Material.REDSTONE_BLOCK), new LootStructure(Material.IRON_BLOCK), new LootStructure(Material.LAPIS_BLOCK), - new LootStructure(Material.LEATHER_HELMET,4), - new LootStructure(Material.LEATHER_CHESTPLATE,4), - new LootStructure(Material.LEATHER_LEGGINGS,4), - new LootStructure(Material.LEATHER_BOOTS,4), + new LootStructure(Material.LEATHER_HELMET), + new LootStructure(Material.LEATHER_CHESTPLATE), + new LootStructure(Material.LEATHER_LEGGINGS), + new LootStructure(Material.LEATHER_BOOTS), }, new LootStructure[]{ //Legendary Loot new LootStructure(Material.PRISMARINE_SHARD), @@ -401,20 +393,20 @@ public enum MonsterDifficulty { return new ItemStack(ls.GetMaterial(),1,(short)(Math.random()*ls.GetMaterial().getMaxDurability())); } } else { - if (ls.GetMaterial().toString().contains("LEATHER")) { + /*if (ls.GetMaterial().toString().contains("LEATHER")) { //LEGACY CODE. if (isRanger) { return Loot.GenerateRangerPiece(ls.GetMaterial(), ls.GetHardened(), ls.GetAmount()); } else { //Re-roll if a ranger did not kill, as we cannot reward ranger armor to non-rangers. return DistributeRandomLoot(lootlist,isRanger); } - } else { + } else {*/ if (Math.random()<=0.8) { return Loot.GenerateMegaPiece(ls.GetMaterial(), ls.GetHardened(),true); } else { return Loot.GenerateMegaPiece(ls.GetMaterial(), ls.GetHardened(),false); } - } + //} //LEGACY CODE. } } else { //Turn it into a normal item. diff --git a/src/sig/plugin/TwosideKeeper/NewCombat.java b/src/sig/plugin/TwosideKeeper/NewCombat.java index 8d47cfd..63e9d99 100644 --- a/src/sig/plugin/TwosideKeeper/NewCombat.java +++ b/src/sig/plugin/TwosideKeeper/NewCombat.java @@ -376,7 +376,16 @@ public class NewCombat { finaldmg += dmg*GenericFunctions.getAbilityValue(ArtifactAbility.ARMOR_PEN, p.getEquipment().getItemInMainHand())/100d; addToPlayerLogger(p,"Armor Pen",finaldmg); } - return finaldmg; + if (GenericFunctions.HasFullRangerSet(p) && + GenericFunctions.isRanger(p) && + GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.DEBILITATION) { + finaldmg += dmg*0.5; + } + if (finaldmg>=dmg) { + return dmg; + } else { + return finaldmg; + } } static void playerPerformMiscActions(Player p, Entity target) { @@ -610,8 +619,15 @@ public class NewCombat { double dmg = ItemSet.TotalBaseAmountBasedOnSetBonusCount(p,ItemSet.PANROS,2,2); addToPlayerLogger(ent,"Set Bonus",dmg); basedmg += dmg; + + dmg = ItemSet.TotalBaseAmountBasedOnSetBonusCount(p,ItemSet.ALIKAHN,3,3)+ + ItemSet.TotalBaseAmountBasedOnSetBonusCount(p,ItemSet.DARNYS,3,3)+ + ItemSet.TotalBaseAmountBasedOnSetBonusCount(p,ItemSet.LORASAADI,3,3)+ + ItemSet.TotalBaseAmountBasedOnSetBonusCount(p,ItemSet.JAMDAK,3,3); + addToPlayerLogger(ent,"Set Bonus",dmg); + basedmg += dmg; - dmg = ItemSet.TotalBaseAmountBasedOnSetBonusCount(p,ItemSet.DAWNTRACKER,2,2); + dmg = ItemSet.TotalBaseAmountBasedOnSetBonusCount(p,ItemSet.DAWNTRACKER,4,4); addToPlayerLogger(ent,"Set Bonus",dmg); basedmg += dmg; } @@ -946,7 +962,7 @@ public class NewCombat { Player p = (Player)damager; p.playSound(p.getLocation(), Sound.ENTITY_PLAYER_ATTACK_CRIT, 1.0f, 1.0f); } - return criticalstrike?(calculateCriticalStrikeMultiplier(weapon)):1.0; + return criticalstrike?(calculateCriticalStrikeMultiplier(damager,weapon)):1.0; } static double calculateCriticalStrikeChance(ItemStack weapon, Entity damager) { @@ -973,11 +989,20 @@ public class NewCombat { return (Math.random()<=chance || isCriticalStrike); } - static double calculateCriticalStrikeMultiplier(ItemStack weapon) { + static double calculateCriticalStrikeMultiplier(Entity damager, ItemStack weapon) { double critdmg=2.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) && + GenericFunctions.isRanger(p) && + GenericFunctions.getBowMode(weapon)==BowMode.SNIPE) { + critdmg+=1.0; + } + } + TwosideKeeper.log("Crit Damage is "+critdmg, 5); return critdmg; } @@ -1062,7 +1087,7 @@ public class NewCombat { shooter instanceof Player) { Player p = (Player)shooter; PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); - double mult1 = (pd.lastarrowwasinrangermode)?(pd.lastarrowpower/9000000d):(pd.lastarrowpower/9d); + double mult1 = (pd.lastarrowwasinrangermode)?(1.0):(pd.lastarrowpower/9d); addMultiplierToPlayerLogger(damager,"Base Arrow Damage Mult",mult1); mult = mult1; } @@ -1217,15 +1242,19 @@ public class NewCombat { double dmgreduction = 0.0; int protectionlevel = 0; + int projectileprotectionlevel = 0; + int explosionprotectionlevel = 0; int resistlevel = 0; int partylevel = 0; + double rangerdmgdiv = 0; if (target instanceof LivingEntity) { ItemStack[] armor = target.getEquipment().getArmorContents(); if (target instanceof Player) { - if (GenericFunctions.HasFullRangerSet((Player)target)) { - dmgreduction+=20.0; - } + rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target, ItemSet.ALIKAHN, 2, 2)/100d; + rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target, ItemSet.JAMDAK, 2, 2)/100d; + rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target, ItemSet.DARNYS, 2, 2)/100d; + rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target, ItemSet.LORASAADI, 2, 2)/100d; } for (int i=0;i0) { - protectionlevel+=armor[i].getEnchantmentLevel(Enchantment.PROTECTION_PROJECTILE); + projectileprotectionlevel+=armor[i].getEnchantmentLevel(Enchantment.PROTECTION_PROJECTILE); } if ((damager instanceof Creeper) && armor[i].getEnchantmentLevel(Enchantment.PROTECTION_EXPLOSIONS)>0) { - protectionlevel+=armor[i].getEnchantmentLevel(Enchantment.PROTECTION_EXPLOSIONS); + explosionprotectionlevel+=armor[i].getEnchantmentLevel(Enchantment.PROTECTION_EXPLOSIONS); } boolean isBlockArmor = GenericFunctions.isHardenedItem(armor[i]); @@ -1343,8 +1372,11 @@ public class NewCombat { protectionlevel=(protectionlevel>100)?100:protectionlevel; //partylevel=(partylevel>9)?9:partylevel; double finaldmg=(basedmg-(basedmg*(dmgreduction/100.0d))) - *((10-resistlevel)*0.1) - *((100-protectionlevel)*0.01) + *(1d-((resistlevel*10d)/100d)) + *(1d-((protectionlevel)/100d)) + *(1d-((projectileprotectionlevel)/100d)) + *(1d-((explosionprotectionlevel)/100d)) + *(1d-rangerdmgdiv) //*((10-partylevel)*0.1) *setbonus *((target instanceof Player && ((Player)target).isBlocking())?(GenericFunctions.isDefender((Player)target))?0.30:0.50:1) @@ -1378,7 +1410,7 @@ public class NewCombat { public static double calculateLifeStealAmount(Player p) { double lifestealpct = GenericFunctions.getAbilityValue(ArtifactAbility.LIFESTEAL, p.getEquipment().getItemInMainHand())/100; - lifestealpct += ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DAWNTRACKER, 4, 4)/100d; + lifestealpct += ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DAWNTRACKER, 3, 3)/100d; return lifestealpct; } @@ -1621,7 +1653,7 @@ public class NewCombat { p.isOnGround() && p.getLocation().getY()>=0 && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=4) { dodgechance+=0.01*p.getEquipment().getArmorContents()[i].getEnchantmentLevel(Enchantment.LUCK); } - ItemStack equip = p.getEquipment().getArmorContents()[i]; + /*ItemStack equip = p.getEquipment().getArmorContents()[i]; if (GenericFunctions.isRanger(p) && equip!=null && equip.getType()!=Material.AIR && equip.hasItemMeta() && equip.getItemMeta().hasLore()) { @@ -1637,8 +1669,12 @@ public class NewCombat { if (equip.getItemMeta().getLore().contains(ChatColor.GOLD+""+ChatColor.BOLD+"Lorasaadi Set")) { dodgechance+=0.11; } - } + }*/ } + dodgechance+=ItemSet.GetTotalBaseAmount(p, ItemSet.ALIKAHN)/100d; + dodgechance+=ItemSet.GetTotalBaseAmount(p, ItemSet.DARNYS)/100d; + dodgechance+=ItemSet.GetTotalBaseAmount(p, ItemSet.JAMDAK)/100d; + dodgechance+=ItemSet.GetTotalBaseAmount(p, ItemSet.LORASAADI)/100d; PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); @@ -1662,7 +1698,7 @@ public class NewCombat { if (pd.fulldodge) { dodgechance = 1.0; } - return dodgechance; + return dodgechance; } public static double calculateDefenderAbsorbtion(LivingEntity entity, double dmg) { @@ -1700,6 +1736,7 @@ public class NewCombat { for (int i=0;i partymembers) { + //ChatColor.BLUE+""+ChatColor.BOLD+ChatColor.UNDERLINE+"Party "+ChatColor.RESET+ChatColor.GOLD+ChatColor.UNDERLINE+ChatColor.ITALIC+PartyBonusDisplay(partymembers) + String part1 = "Party"; + String part2 = PartyBonusDisplay(partymembers); + int totallength = part1.length()+part2.length(); + double percent = CalculateTotalPartyHealth(partymembers); + TwosideKeeper.log("total length: "+totallength+" of "+part1+part2+".",2); + int slot = (int)(percent*totallength); + TwosideKeeper.log("Selected slot is "+slot,2); + StringBuilder finalstring = new StringBuilder(""); + if (slot partymembers) { + double health = 0.0; + double maxhealth = 0.0; + for (int i=0;i partymembers) { + int membercount = partymembers.size(); + StringBuilder partydisplay = new StringBuilder(""); + if (membercount>=2) { + int dmgbonus=((membercount-1)<10)?(membercount-1)*10:90; + int defbonus=((membercount-1)<10)?(membercount-1)*10:90; + partydisplay.append(" +"+dmgbonus+"%DMG/DEF"); + } + return partydisplay.toString(); + } + public static void sortPlayers(int party, List partyplayers, HashMap> lastorder) { String color = ConvertColor(party); //Sorts the players on the scoreboard by proper health values. diff --git a/src/sig/plugin/TwosideKeeper/PlayerStructure.java b/src/sig/plugin/TwosideKeeper/PlayerStructure.java index 721fa2c..c985583 100644 --- a/src/sig/plugin/TwosideKeeper/PlayerStructure.java +++ b/src/sig/plugin/TwosideKeeper/PlayerStructure.java @@ -91,6 +91,7 @@ public class PlayerStructure { public HashMap hitlist = new HashMap(); public long lastdeath = 0; public int previousparty = -1; + public long lastblock = 0; public double prev_weapondmg=0.0; public double prev_buffdmg=0.0; @@ -106,6 +107,8 @@ public class PlayerStructure { public int storedbowxp=0; public long lasthittarget=0; + public boolean isPlayingSpleef=false; + public long lastrightclick = 0; //Needs the instance of the player object to get all other info. Only to be called at the beginning. @@ -153,6 +156,7 @@ public class PlayerStructure { this.last_rejuvenate=(TwosideKeeper.getServerType()==ServerType.MAIN)?TwosideKeeper.getServerTickTime():0; this.damagedata = new DamageLogger(p); this.damagelogging=false; + this.isPlayingSpleef=false; //Set defaults first, in case this is a new user. setDefaultCooldowns(p); loadConfig(); diff --git a/src/sig/plugin/TwosideKeeper/SpleefGame.java b/src/sig/plugin/TwosideKeeper/SpleefGame.java index cbe0161..5e19967 100644 --- a/src/sig/plugin/TwosideKeeper/SpleefGame.java +++ b/src/sig/plugin/TwosideKeeper/SpleefGame.java @@ -321,6 +321,10 @@ public class SpleefGame implements Listener { matchup+=", "+players.get(i).player; } } + + PlayerStructure pd = PlayerStructure.GetPlayerStructure(Bukkit.getServer().getPlayer(players.get(i).player)); + pd.isPlayingSpleef=true; + //Heal the player. Bukkit.getServer().getPlayer(players.get(i).player).setHealth(Bukkit.getServer().getPlayer(players.get(i).player).getMaxHealth()); Bukkit.getServer().getPlayer(players.get(i).player).setFoodLevel(20); @@ -408,6 +412,8 @@ public class SpleefGame implements Listener { pd.spleef_pts+=registered_players.size()-players.size()-1; Bukkit.getServer().broadcastMessage(ChatColor.GREEN+p.player+ChatColor.GOLD+" "+ChatColor.ITALIC+"has been knocked out of this round of Spleef!"); } + PlayerStructure pd = PlayerStructure.GetPlayerStructure(Bukkit.getServer().getPlayer(p.player)); + pd.isPlayingSpleef=false; } void EndMatch(SpleefPlayerData winner) { diff --git a/src/sig/plugin/TwosideKeeper/SpleefManager.java b/src/sig/plugin/TwosideKeeper/SpleefManager.java index e382026..9968a76 100644 --- a/src/sig/plugin/TwosideKeeper/SpleefManager.java +++ b/src/sig/plugin/TwosideKeeper/SpleefManager.java @@ -58,11 +58,6 @@ public class SpleefManager { } public static boolean playerIsPlayingSpleef(Player p) { - for (int i=0;i