->2-piece Dawntracker set bonus has been moved to the 4-piece set bonus.

The 2-set bonus is now Debuff Resistance while the 3-set bonus is now
Lifesteal %.
->Ranger pieces are now officially implemented as part of the new set
system. Their stats no longer apply to just Ranger mode, just like the
other sets.
->Ranger pieces now drop just like all other set pieces, no longer
requiring the killer to be in Ranger mode.
->All old Ranger set pieces will be automatically converted to the new
set system.
->Rangers can now shoot through players and damage mobs properly.
->Detecting if players are playing Spleef has been optimized.
->All non-monster damage entities no longer deal damage at 20 ticks per
second.
->Fixed a bug where Line Drive's damage ramped up massively based on
number of targets hit.
->Getting killed now displays how much damage the killing blow dealt to
them.
->Blocking now displays your Block Chance % alongside your Damage
Reduction %.
->Fixed a bug causing the Damage Reduction % message to display twice
when blocking.
->Projectile Protection and Blast Protection are no longer additive with
the total Protection level. Each is calculated separately and is a
separate multiplier in calculations involving Damage Reduction.
This commit is contained in:
sigonasr2 2016-08-16 21:22:17 -05:00
parent 83b6b419b7
commit 173c2d539f
13 changed files with 387 additions and 101 deletions

Binary file not shown.

View File

@ -1,6 +1,6 @@
name: TwosideKeeper name: TwosideKeeper
main: sig.plugin.TwosideKeeper.TwosideKeeper main: sig.plugin.TwosideKeeper.TwosideKeeper
version: 3.8.3r1 version: 3.8.4
commands: commands:
money: money:
description: Tells the player the amount of money they are holding. description: Tells the player the amount of money they are holding.

View File

@ -370,6 +370,12 @@ public class EliteMonster {
} }
} }
if (!storingenergy) { if (!storingenergy) {
if (storingenergy_hit>0) {
storingenergy_hit/=1.02f;
if (storingenergy_hit<10) {
storingenergy_hit=0;
}
}
if (l.getLocation().distanceSquared(m.getLocation())>4096) { if (l.getLocation().distanceSquared(m.getLocation())>4096) {
//Lose the target. //Lose the target.
targetlist.remove(l); targetlist.remove(l);
@ -470,7 +476,10 @@ public class EliteMonster {
targetlist.get(i).sendMessage(ChatColor.GOLD+"The "+m.getCustomName()+ChatColor.GOLD+" is absorbing energy!"); targetlist.get(i).sendMessage(ChatColor.GOLD+"The "+m.getCustomName()+ChatColor.GOLD+" is absorbing energy!");
} }
m.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(0f); 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() { Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() {
public void run() { public void run() {
Player target = ChooseRandomTarget(); Player target = ChooseRandomTarget();
@ -483,6 +492,8 @@ public class EliteMonster {
} }
m.setTarget(target); m.setTarget(target);
storingenergy=false; storingenergy=false;
} else {
storingenergy=false;
} }
} else { } else {
storingenergy=false; storingenergy=false;

View File

@ -2475,8 +2475,11 @@ public class GenericFunctions {
} }
public static boolean HasFullRangerSet(Player p) { public static boolean HasFullRangerSet(Player p) {
return ItemSet.hasFullSet(p, ItemSet.ALIKAHN) ||
int rangerarmort1 = 0; //Count the number of each tier of sets. 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 rangerarmort2 = 0;
int rangerarmort3 = 0; int rangerarmort3 = 0;
int rangerarmort4 = 0; int rangerarmort4 = 0;
@ -2510,7 +2513,7 @@ public class GenericFunctions {
pd.hasfullrangerset=false; pd.hasfullrangerset=false;
} }
return pd.hasfullrangerset; return pd.hasfullrangerset;*/
} }
public static ItemStack applyModeName(ItemStack item) { public static ItemStack applyModeName(ItemStack item) {
@ -2948,6 +2951,7 @@ public class GenericFunctions {
(int)(NewCombat.CalculateGracefulDodgeTicks(p)), (int)(NewCombat.CalculateGracefulDodgeTicks(p)),
0) 0)
); );
break;
} }
} }
p.setNoDamageTicks(10); p.setNoDamageTicks(10);
@ -3092,7 +3096,7 @@ public class GenericFunctions {
} else { } else {
pd.hitlist.put(p.getUniqueId(), TwosideKeeper.getServerTickTime()); pd.hitlist.put(p.getUniqueId(), TwosideKeeper.getServerTickTime());
} }
} } else
if (entity instanceof Monster) { if (entity instanceof Monster) {
Monster m = (Monster)entity; Monster m = (Monster)entity;
MonsterStructure md = MonsterStructure.getMonsterStructure(m); MonsterStructure md = MonsterStructure.getMonsterStructure(m);
@ -3232,20 +3236,65 @@ public class GenericFunctions {
//Save the tier and type as well. //Save the tier and type as well.
ItemSet set = ItemSet.GetSet(item); ItemSet set = ItemSet.GetSet(item);
int tier = ItemSet.GetTier(item); int tier = ItemSet.GetTier(item);
item = UpdateSetLore(set,tier,item);
List<String> newlore = new ArrayList<String>();
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);
} }
UpdateOldRangerPieces(item);
return item; return item;
} }
private static ItemStack UpdateSetLore(ItemSet set, int tier, ItemStack item) {
List<String> newlore = new ArrayList<String>();
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<String> 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) { public static ExperienceOrb spawnXP(Location location, int expAmount) {
ExperienceOrb orb = location.getWorld().spawn(location, ExperienceOrb.class); ExperienceOrb orb = location.getWorld().spawn(location, ExperienceOrb.class);
orb.setExperience(orb.getExperience() + expAmount); orb.setExperience(orb.getExperience() + expAmount);
@ -3335,6 +3384,7 @@ public class GenericFunctions {
(int)(NewCombat.CalculateGracefulDodgeTicks(p)), (int)(NewCombat.CalculateGracefulDodgeTicks(p)),
0) 0)
); );
break;
} }
} }
p.setNoDamageTicks(10); p.setNoDamageTicks(10);
@ -3456,6 +3506,7 @@ public class GenericFunctions {
(int)(NewCombat.CalculateGracefulDodgeTicks(p)), (int)(NewCombat.CalculateGracefulDodgeTicks(p)),
0) 0)
); );
break;
} }
} }
p.setNoDamageTicks(10); 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) { public static void DealDamageToNearbyMobs(Location l, double basedmg, int range, boolean knockup, double knockupamt, Entity damager, boolean isLineDrive) {
Collection<Entity> ents = l.getWorld().getNearbyEntities(l, range, range, range); Collection<Entity> ents = l.getWorld().getNearbyEntities(l, range, range, range);
//We cleared the non-living entities, deal damage to the rest. //We cleared the non-living entities, deal damage to the rest.
double origdmg = basedmg;
for (Entity e : ents) { for (Entity e : ents) {
double dodgechance = 0.0; double dodgechance = 0.0;
if (e instanceof Monster) { if (e instanceof Monster) {
Monster m = (Monster)e; Monster m = (Monster)e;
if (enoughTicksHavePassed(m,(Player)damager)) { if (enoughTicksHavePassed(m,(Player)damager)) {
basedmg=origdmg;
if (isLineDrive) { if (isLineDrive) {
basedmg=TwosideKeeperAPI.getFinalDamage(basedmg, damager, m, false, "Line Drive"); basedmg=TwosideKeeperAPI.getFinalDamage(basedmg, damager, m, false, "Line Drive");
basedmg*=1.0d+(4*((NewCombat.getPercentHealthMissing(m))/100d)); basedmg*=1.0d+(4*((NewCombat.getPercentHealthMissing(m))/100d));
@ -3598,12 +3651,16 @@ public class GenericFunctions {
b.getType()==Material.NETHERRACK || b.getType()==Material.NETHERRACK ||
b.getType()==Material.ENDER_STONE || b.getType()==Material.ENDER_STONE ||
b.getType()==Material.COBBLESTONE || b.getType()==Material.COBBLESTONE ||
b.getType()==Material.MOSSY_COBBLESTONE ||
b.getType()==Material.LOG || b.getType()==Material.LOG ||
b.getType()==Material.LOG_2 || b.getType()==Material.LOG_2 ||
b.getType()==Material.LEAVES || b.getType()==Material.LEAVES ||
b.getType()==Material.LEAVES_2 || b.getType()==Material.LEAVES_2 ||
b.getType()==Material.STATIONARY_LAVA || 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 true;
} }
return false; return false;

View File

@ -16,8 +16,12 @@ import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
public enum ItemSet { public enum ItemSet {
PANROS(1,1, 3,2, 10,10, 20,10), PANROS(1,1, 3,2, 10,10, 20,10),
SONGSTEEL(4,2, 6,2, 8,4, 20,10), SONGSTEEL(4,2, 6,2, 8,4, 20,10),
DAWNTRACKER(4,4, 6,4, 20,20, 20,20), DAWNTRACKER(4,4, 6,4, 20,10, 20,10),
LORASYS(0,0, 0,0, 0,0, 0,0); 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 baseval;
int increase_val; int increase_val;
@ -206,6 +210,26 @@ public enum ItemSet {
lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Lorasys Set"); lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Lorasys Set");
lore.add(ChatColor.YELLOW+"???"); lore.add(ChatColor.YELLOW+"???");
}break; }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(""); lore.add("");
@ -233,19 +257,43 @@ public enum ItemSet {
}break; }break;
case DAWNTRACKER:{ case DAWNTRACKER:{
lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); 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+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+"% Debuff Resistance");
lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+"% 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)+"% 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.DARK_AQUA+" 5 - "+ChatColor.WHITE+" Powered Mock");
lore.add(ChatColor.GRAY+" Mock debuff duration increases from"); 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; }break;
case LORASYS:{ case LORASYS:{
lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:");
lore.add(ChatColor.DARK_AQUA+" 2 - "+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+" ???"); lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+" Damage");
lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" ???"); lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4)+" Max Health");
lore.add(ChatColor.DARK_AQUA+" 5 - "+ChatColor.WHITE+" ???"); 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; }break;
} }
return lore; return lore;

View File

@ -137,6 +137,9 @@ public class Loot {
public static ItemStack GenerateSetPiece(ItemStack item, boolean hardened, int tierbonus) { public static ItemStack GenerateSetPiece(ItemStack item, boolean hardened, int tierbonus) {
List<String> lore = new ArrayList<String>(); List<String> lore = new ArrayList<String>();
int type = (int)(Math.random()*3); 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 set_name = "";
String prefix = ""; String prefix = "";
prefix = (hardened)?(ChatColor.LIGHT_PURPLE+""+ChatColor.BOLD+"Hardened Mega "):(ChatColor.AQUA+""+ChatColor.BOLD+"Mega "); 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()); set_name = prefix+"Lorasys Slayer "+GenericFunctions.UserFriendlyMaterialName(item.getType());
}break; }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()) { if (item.getItemMeta().hasLore()) {
lore = item.getItemMeta().getLore(); lore = item.getItemMeta().getLore();

View File

@ -38,10 +38,6 @@ public enum MonsterDifficulty {
new LootStructure(Material.GOLD_NUGGET,(int)((Math.random()*3)+1)), new LootStructure(Material.GOLD_NUGGET,(int)((Math.random()*3)+1)),
new LootStructure(Material.ENDER_PEARL,(int)((Math.random()*3)+1)), new LootStructure(Material.ENDER_PEARL,(int)((Math.random()*3)+1)),
new LootStructure(Material.ENDER_CHEST), 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( DANGEROUS(
@ -60,10 +56,6 @@ public enum MonsterDifficulty {
new LootStructure(Material.STONE_HOE, false), new LootStructure(Material.STONE_HOE, false),
new LootStructure(Material.STONE_SPADE, false), new LootStructure(Material.STONE_SPADE, false),
new LootStructure(Material.FISHING_ROD, 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[]{ //Legendary Loot
new LootStructure(Material.IRON_SWORD, true), new LootStructure(Material.IRON_SWORD, true),
@ -76,10 +68,10 @@ public enum MonsterDifficulty {
new LootStructure(Material.STONE_HOE, true), new LootStructure(Material.STONE_HOE, true),
new LootStructure(Material.STONE_SPADE, true), new LootStructure(Material.STONE_SPADE, true),
new LootStructure(Material.FISHING_ROD, true), new LootStructure(Material.FISHING_ROD, true),
new LootStructure(Material.LEATHER_HELMET,2), new LootStructure(Material.LEATHER_HELMET),
new LootStructure(Material.LEATHER_CHESTPLATE,2), new LootStructure(Material.LEATHER_CHESTPLATE),
new LootStructure(Material.LEATHER_LEGGINGS,2), new LootStructure(Material.LEATHER_LEGGINGS),
new LootStructure(Material.LEATHER_BOOTS,2), new LootStructure(Material.LEATHER_BOOTS),
} }
), ),
DEADLY( DEADLY(
@ -120,10 +112,10 @@ public enum MonsterDifficulty {
new LootStructure(Material.DIAMOND_BOOTS, true), new LootStructure(Material.DIAMOND_BOOTS, true),
new LootStructure(Material.DIAMOND_HELMET, true), new LootStructure(Material.DIAMOND_HELMET, true),
new LootStructure(Material.FISHING_ROD, true), new LootStructure(Material.FISHING_ROD, true),
new LootStructure(Material.LEATHER_HELMET,3), new LootStructure(Material.LEATHER_HELMET),
new LootStructure(Material.LEATHER_CHESTPLATE,3), new LootStructure(Material.LEATHER_CHESTPLATE),
new LootStructure(Material.LEATHER_LEGGINGS,3), new LootStructure(Material.LEATHER_LEGGINGS),
new LootStructure(Material.LEATHER_BOOTS,3), new LootStructure(Material.LEATHER_BOOTS),
} }
), ),
HELLFIRE( HELLFIRE(
@ -174,10 +166,10 @@ public enum MonsterDifficulty {
new LootStructure(Material.GOLD_HELMET, true), new LootStructure(Material.GOLD_HELMET, true),
new LootStructure(Material.BOW, true), new LootStructure(Material.BOW, true),
new LootStructure(Material.FISHING_ROD, true), new LootStructure(Material.FISHING_ROD, true),
new LootStructure(Material.LEATHER_HELMET,4), new LootStructure(Material.LEATHER_HELMET),
new LootStructure(Material.LEATHER_CHESTPLATE,4), new LootStructure(Material.LEATHER_CHESTPLATE),
new LootStructure(Material.LEATHER_LEGGINGS,4), new LootStructure(Material.LEATHER_LEGGINGS),
new LootStructure(Material.LEATHER_BOOTS,4), new LootStructure(Material.LEATHER_BOOTS),
} }
), ),
ELITE( ELITE(
@ -199,10 +191,10 @@ public enum MonsterDifficulty {
new LootStructure(Material.REDSTONE_BLOCK), new LootStructure(Material.REDSTONE_BLOCK),
new LootStructure(Material.IRON_BLOCK), new LootStructure(Material.IRON_BLOCK),
new LootStructure(Material.LAPIS_BLOCK), new LootStructure(Material.LAPIS_BLOCK),
new LootStructure(Material.LEATHER_HELMET,4), new LootStructure(Material.LEATHER_HELMET),
new LootStructure(Material.LEATHER_CHESTPLATE,4), new LootStructure(Material.LEATHER_CHESTPLATE),
new LootStructure(Material.LEATHER_LEGGINGS,4), new LootStructure(Material.LEATHER_LEGGINGS),
new LootStructure(Material.LEATHER_BOOTS,4), new LootStructure(Material.LEATHER_BOOTS),
}, },
new LootStructure[]{ //Legendary Loot new LootStructure[]{ //Legendary Loot
new LootStructure(Material.PRISMARINE_SHARD), new LootStructure(Material.PRISMARINE_SHARD),
@ -401,20 +393,20 @@ public enum MonsterDifficulty {
return new ItemStack(ls.GetMaterial(),1,(short)(Math.random()*ls.GetMaterial().getMaxDurability())); return new ItemStack(ls.GetMaterial(),1,(short)(Math.random()*ls.GetMaterial().getMaxDurability()));
} }
} else { } else {
if (ls.GetMaterial().toString().contains("LEATHER")) { /*if (ls.GetMaterial().toString().contains("LEATHER")) { //LEGACY CODE.
if (isRanger) { if (isRanger) {
return Loot.GenerateRangerPiece(ls.GetMaterial(), ls.GetHardened(), ls.GetAmount()); return Loot.GenerateRangerPiece(ls.GetMaterial(), ls.GetHardened(), ls.GetAmount());
} else { } else {
//Re-roll if a ranger did not kill, as we cannot reward ranger armor to non-rangers. //Re-roll if a ranger did not kill, as we cannot reward ranger armor to non-rangers.
return DistributeRandomLoot(lootlist,isRanger); return DistributeRandomLoot(lootlist,isRanger);
} }
} else { } else {*/
if (Math.random()<=0.8) { if (Math.random()<=0.8) {
return Loot.GenerateMegaPiece(ls.GetMaterial(), ls.GetHardened(),true); return Loot.GenerateMegaPiece(ls.GetMaterial(), ls.GetHardened(),true);
} else { } else {
return Loot.GenerateMegaPiece(ls.GetMaterial(), ls.GetHardened(),false); return Loot.GenerateMegaPiece(ls.GetMaterial(), ls.GetHardened(),false);
} }
} //} //LEGACY CODE.
} }
} else { } else {
//Turn it into a normal item. //Turn it into a normal item.

View File

@ -376,7 +376,16 @@ public class NewCombat {
finaldmg += dmg*GenericFunctions.getAbilityValue(ArtifactAbility.ARMOR_PEN, p.getEquipment().getItemInMainHand())/100d; finaldmg += dmg*GenericFunctions.getAbilityValue(ArtifactAbility.ARMOR_PEN, p.getEquipment().getItemInMainHand())/100d;
addToPlayerLogger(p,"Armor Pen",finaldmg); 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) { static void playerPerformMiscActions(Player p, Entity target) {
@ -611,7 +620,14 @@ public class NewCombat {
addToPlayerLogger(ent,"Set Bonus",dmg); addToPlayerLogger(ent,"Set Bonus",dmg);
basedmg += dmg; basedmg += dmg;
dmg = ItemSet.TotalBaseAmountBasedOnSetBonusCount(p,ItemSet.DAWNTRACKER,2,2); 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,4,4);
addToPlayerLogger(ent,"Set Bonus",dmg); addToPlayerLogger(ent,"Set Bonus",dmg);
basedmg += dmg; basedmg += dmg;
} }
@ -946,7 +962,7 @@ public class NewCombat {
Player p = (Player)damager; Player p = (Player)damager;
p.playSound(p.getLocation(), Sound.ENTITY_PLAYER_ATTACK_CRIT, 1.0f, 1.0f); 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) { static double calculateCriticalStrikeChance(ItemStack weapon, Entity damager) {
@ -973,11 +989,20 @@ public class NewCombat {
return (Math.random()<=chance || isCriticalStrike); return (Math.random()<=chance || isCriticalStrike);
} }
static double calculateCriticalStrikeMultiplier(ItemStack weapon) { static double calculateCriticalStrikeMultiplier(Entity damager, ItemStack weapon) {
double critdmg=2.0; double critdmg=2.0;
if (ArtifactAbility.containsEnchantment(ArtifactAbility.CRIT_DMG, weapon)) { if (ArtifactAbility.containsEnchantment(ArtifactAbility.CRIT_DMG, weapon)) {
critdmg+=(GenericFunctions.getAbilityValue(ArtifactAbility.CRIT_DMG,weapon))/100d; 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; return critdmg;
} }
@ -1062,7 +1087,7 @@ public class NewCombat {
shooter instanceof Player) { shooter instanceof Player) {
Player p = (Player)shooter; Player p = (Player)shooter;
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); 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); addMultiplierToPlayerLogger(damager,"Base Arrow Damage Mult",mult1);
mult = mult1; mult = mult1;
} }
@ -1217,15 +1242,19 @@ public class NewCombat {
double dmgreduction = 0.0; double dmgreduction = 0.0;
int protectionlevel = 0; int protectionlevel = 0;
int projectileprotectionlevel = 0;
int explosionprotectionlevel = 0;
int resistlevel = 0; int resistlevel = 0;
int partylevel = 0; int partylevel = 0;
double rangerdmgdiv = 0;
if (target instanceof LivingEntity) { if (target instanceof LivingEntity) {
ItemStack[] armor = target.getEquipment().getArmorContents(); ItemStack[] armor = target.getEquipment().getArmorContents();
if (target instanceof Player) { if (target instanceof Player) {
if (GenericFunctions.HasFullRangerSet((Player)target)) { rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target, ItemSet.ALIKAHN, 2, 2)/100d;
dmgreduction+=20.0; 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;i<armor.length;i++) { for (int i=0;i<armor.length;i++) {
@ -1236,10 +1265,10 @@ public class NewCombat {
protectionlevel+=armor[i].getEnchantmentLevel(Enchantment.PROTECTION_ENVIRONMENTAL); protectionlevel+=armor[i].getEnchantmentLevel(Enchantment.PROTECTION_ENVIRONMENTAL);
} }
if ((damager instanceof Projectile) && armor[i].getEnchantmentLevel(Enchantment.PROTECTION_PROJECTILE)>0) { if ((damager instanceof Projectile) && armor[i].getEnchantmentLevel(Enchantment.PROTECTION_PROJECTILE)>0) {
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) { 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]); boolean isBlockArmor = GenericFunctions.isHardenedItem(armor[i]);
@ -1343,8 +1372,11 @@ public class NewCombat {
protectionlevel=(protectionlevel>100)?100:protectionlevel; protectionlevel=(protectionlevel>100)?100:protectionlevel;
//partylevel=(partylevel>9)?9:partylevel; //partylevel=(partylevel>9)?9:partylevel;
double finaldmg=(basedmg-(basedmg*(dmgreduction/100.0d))) double finaldmg=(basedmg-(basedmg*(dmgreduction/100.0d)))
*((10-resistlevel)*0.1) *(1d-((resistlevel*10d)/100d))
*((100-protectionlevel)*0.01) *(1d-((protectionlevel)/100d))
*(1d-((projectileprotectionlevel)/100d))
*(1d-((explosionprotectionlevel)/100d))
*(1d-rangerdmgdiv)
//*((10-partylevel)*0.1) //*((10-partylevel)*0.1)
*setbonus *setbonus
*((target instanceof Player && ((Player)target).isBlocking())?(GenericFunctions.isDefender((Player)target))?0.30:0.50:1) *((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) { public static double calculateLifeStealAmount(Player p) {
double lifestealpct = GenericFunctions.getAbilityValue(ArtifactAbility.LIFESTEAL, p.getEquipment().getItemInMainHand())/100; 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; return lifestealpct;
} }
@ -1621,7 +1653,7 @@ public class NewCombat {
p.isOnGround() && p.getLocation().getY()>=0 && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=4) { 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); 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 if (GenericFunctions.isRanger(p) && equip!=null
&& equip.getType()!=Material.AIR && && equip.getType()!=Material.AIR &&
equip.hasItemMeta() && equip.getItemMeta().hasLore()) { equip.hasItemMeta() && equip.getItemMeta().hasLore()) {
@ -1637,8 +1669,12 @@ public class NewCombat {
if (equip.getItemMeta().getLore().contains(ChatColor.GOLD+""+ChatColor.BOLD+"Lorasaadi Set")) { if (equip.getItemMeta().getLore().contains(ChatColor.GOLD+""+ChatColor.BOLD+"Lorasaadi Set")) {
dodgechance+=0.11; 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); PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
@ -1700,6 +1736,7 @@ public class NewCombat {
for (int i=0;i<equips.length;i++) { for (int i=0;i<equips.length;i++) {
totalduration+=GenericFunctions.getAbilityValue(ArtifactAbility.GRACEFULDODGE, equips[i]); totalduration+=GenericFunctions.getAbilityValue(ArtifactAbility.GRACEFULDODGE, equips[i]);
} }
TwosideKeeper.log("Graceful Dodge Ticks: "+((int)(totalduration*20)), 3);
return (int)(totalduration*20); return (int)(totalduration*20);
} }

View File

@ -7,6 +7,7 @@ import java.util.List;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import net.md_5.bungee.api.ChatColor;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
public class PartyManager { public class PartyManager {
@ -49,7 +50,8 @@ public class PartyManager {
String color = ConvertColor(party); String color = ConvertColor(party);
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "scoreboard objectives remove Party"+party); //Make sure the party is cleared out if it was used for something before... Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "scoreboard objectives remove Party"+party); //Make sure the party is cleared out if it was used for something before...
//Bukkit.getScoreboardManager().getMainScoreboard().registerNewObjective("Party"+color, "dummy"); //Bukkit.getScoreboardManager().getMainScoreboard().registerNewObjective("Party"+color, "dummy");
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "scoreboard objectives add Party"+party+" dummy Party"); //Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "scoreboard objectives add Party"+party+" dummy "+ColorPartyListDisplay(partymembers)+"");
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "scoreboard objectives add Party"+party+" dummy "+ChatColor.BLUE+""+ChatColor.BOLD+ChatColor.UNDERLINE+"Party "+ChatColor.RESET+ChatColor.DARK_GRAY+ChatColor.UNDERLINE+ChatColor.ITALIC+PartyBonusDisplay(partymembers)+"");
//Bukkit.getScoreboardManager().getMainScoreboard().getObjective("Party"+color).setDisplaySlot(DisplaySlot.SIDEBAR); //Bukkit.getScoreboardManager().getMainScoreboard().getObjective("Party"+color).setDisplaySlot(DisplaySlot.SIDEBAR);
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "scoreboard objectives setdisplay sidebar.team."+color+" Party"+party); Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "scoreboard objectives setdisplay sidebar.team."+color+" Party"+party);
@ -61,13 +63,60 @@ public class PartyManager {
TwosideKeeper.log("Adding Player "+p.getName()+" to Scoreboard..", 5); TwosideKeeper.log("Adding Player "+p.getName()+" to Scoreboard..", 5);
Bukkit.dispatchCommand(Bukkit.getServer().getConsoleSender(), "scoreboard players set "+p.getName().toLowerCase()+" Party"+party+" "+((i+1)*-1)); Bukkit.dispatchCommand(Bukkit.getServer().getConsoleSender(), "scoreboard players set "+p.getName().toLowerCase()+" Party"+party+" "+((i+1)*-1));
Bukkit.dispatchCommand(Bukkit.getServer().getConsoleSender(), "scoreboard teams option "+p.getName().toLowerCase()+" color "+color); Bukkit.dispatchCommand(Bukkit.getServer().getConsoleSender(), "scoreboard teams option "+p.getName().toLowerCase()+" color "+color);
p.getScoreboard().getTeam(p.getName().toLowerCase()).setAllowFriendlyFire(false); p.getScoreboard().getTeam(p.getName().toLowerCase()).setAllowFriendlyFire(true);
p.getScoreboard().getTeam(p.getName().toLowerCase()).setSuffix(TwosideKeeper.createHealthbar(((p.getHealth())/p.getMaxHealth())*100,p)); p.getScoreboard().getTeam(p.getName().toLowerCase()).setSuffix(TwosideKeeper.createHealthbar(((p.getHealth())/p.getMaxHealth())*100,p));
TwosideKeeper.setPlayerMaxHealth(p); TwosideKeeper.setPlayerMaxHealth(p);
p.getScoreboard().getTeam(p.getName().toLowerCase()).setPrefix(GenericFunctions.PlayerModePrefix(p)); p.getScoreboard().getTeam(p.getName().toLowerCase()).setPrefix(GenericFunctions.PlayerModePrefix(p));
} }
} }
private static String ColorPartyListDisplay(List<Player> 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<part1.length()) {
finalstring.append(ChatColor.BLUE+""+ChatColor.BOLD+ChatColor.UNDERLINE+part1.substring(0, slot)+ChatColor.GOLD+part1.substring(slot, part1.length()-slot));
finalstring.append(part2);
} else {
finalstring.append(part1);
slot-=part1.length();
TwosideKeeper.log("Slot adjusted to "+slot,2);
TwosideKeeper.log("part2 is of length "+part2.length(),2);
finalstring.append(ChatColor.BLUE+""+ChatColor.BOLD+ChatColor.UNDERLINE+part2.substring(0, slot));
TwosideKeeper.log("part2 is of length "+part2.length(),2);
TwosideKeeper.log("Difference is "+(part2.length()-slot), 2);
finalstring.append(ChatColor.GOLD+part2.substring(slot, part2.length()));
}
return finalstring.toString();
}
private static double CalculateTotalPartyHealth(List<Player> partymembers) {
double health = 0.0;
double maxhealth = 0.0;
for (int i=0;i<partymembers.size();i++) {
health+=partymembers.get(i).getHealth();
maxhealth+=partymembers.get(i).getMaxHealth();
}
return health/maxhealth;
}
private static String PartyBonusDisplay(List<Player> 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<Player> partyplayers, HashMap<Integer,List<Player>> lastorder) { public static void sortPlayers(int party, List<Player> partyplayers, HashMap<Integer,List<Player>> lastorder) {
String color = ConvertColor(party); String color = ConvertColor(party);
//Sorts the players on the scoreboard by proper health values. //Sorts the players on the scoreboard by proper health values.

View File

@ -91,6 +91,7 @@ public class PlayerStructure {
public HashMap<UUID,Long> hitlist = new HashMap<UUID,Long>(); public HashMap<UUID,Long> hitlist = new HashMap<UUID,Long>();
public long lastdeath = 0; public long lastdeath = 0;
public int previousparty = -1; public int previousparty = -1;
public long lastblock = 0;
public double prev_weapondmg=0.0; public double prev_weapondmg=0.0;
public double prev_buffdmg=0.0; public double prev_buffdmg=0.0;
@ -106,6 +107,8 @@ public class PlayerStructure {
public int storedbowxp=0; public int storedbowxp=0;
public long lasthittarget=0; public long lasthittarget=0;
public boolean isPlayingSpleef=false;
public long lastrightclick = 0; public long lastrightclick = 0;
//Needs the instance of the player object to get all other info. Only to be called at the beginning. //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.last_rejuvenate=(TwosideKeeper.getServerType()==ServerType.MAIN)?TwosideKeeper.getServerTickTime():0;
this.damagedata = new DamageLogger(p); this.damagedata = new DamageLogger(p);
this.damagelogging=false; this.damagelogging=false;
this.isPlayingSpleef=false;
//Set defaults first, in case this is a new user. //Set defaults first, in case this is a new user.
setDefaultCooldowns(p); setDefaultCooldowns(p);
loadConfig(); loadConfig();

View File

@ -321,6 +321,10 @@ public class SpleefGame implements Listener {
matchup+=", "+players.get(i).player; matchup+=", "+players.get(i).player;
} }
} }
PlayerStructure pd = PlayerStructure.GetPlayerStructure(Bukkit.getServer().getPlayer(players.get(i).player));
pd.isPlayingSpleef=true;
//Heal the player. //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).setHealth(Bukkit.getServer().getPlayer(players.get(i).player).getMaxHealth());
Bukkit.getServer().getPlayer(players.get(i).player).setFoodLevel(20); 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; 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!"); 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) { void EndMatch(SpleefPlayerData winner) {

View File

@ -58,11 +58,6 @@ public class SpleefManager {
} }
public static boolean playerIsPlayingSpleef(Player p) { public static boolean playerIsPlayingSpleef(Player p) {
for (int i=0;i<spleef_game_list.size();i++) { return PlayerStructure.GetPlayerStructure(p).isPlayingSpleef;
if (spleef_game_list.get(i).registered_players.contains(p)) {
return true;
}
}
return false;
} }
} }

View File

@ -628,7 +628,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
removechance+=resistamt; removechance+=resistamt;
} }
} }
removechance+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DAWNTRACKER, 3, 3); removechance+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DAWNTRACKER, 2, 2);
log("Remove chance is "+removechance,5); log("Remove chance is "+removechance,5);
int longestdur=0; int longestdur=0;
int level=0; int level=0;
@ -2148,31 +2148,54 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
player.sendMessage(ChatColor.ITALIC+" Good luck on your adventure!"); player.sendMessage(ChatColor.ITALIC+" Good luck on your adventure!");
} }
},45); },45);
if (Math.random()<=0.2) {
GenericFunctions.generateNewElite();
}
player.setCompassTarget(TwosideKeeper.ELITE_LOCATION); player.setCompassTarget(TwosideKeeper.ELITE_LOCATION);
} }
} }
} }
//Check for a bow shift-right click. //Check for a bow shift-right click.
if (ev.getAction()==Action.RIGHT_CLICK_AIR || ev.getAction()==Action.RIGHT_CLICK_BLOCK) { if (ev.getAction()==Action.RIGHT_CLICK_AIR || ev.getAction()==Action.RIGHT_CLICK_BLOCK
|| ev.getAction()==Action.LEFT_CLICK_BLOCK
|| ev.getAction()==Action.LEFT_CLICK_AIR) {
Player p = ev.getPlayer(); Player p = ev.getPlayer();
if (GenericFunctions.isRanger(p) && p.isSneaking() && p.getEquipment().getItemInMainHand().getType()==Material.BOW) { if (GenericFunctions.isRanger(p) && p.isSneaking() && p.getEquipment().getItemInMainHand().getType()==Material.BOW) {
//Rotate Bow Modes. //Rotate Bow Modes.
p.removePotionEffect(PotionEffectType.SLOW); p.removePotionEffect(PotionEffectType.SLOW);
BowMode mode = GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand()); BowMode mode = GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand());
switch (mode) {
case CLOSE:{ if (ev.getAction().name().contains("RIGHT")) {
p.playSound(p.getLocation(), Sound.ENTITY_ZOMBIE_INFECT, 0.5f, 0.1f); switch (mode) {
GenericFunctions.setBowMode(p.getEquipment().getItemInMainHand(),BowMode.SNIPE); case CLOSE:{
}break; p.playSound(p.getLocation(), Sound.ENTITY_ZOMBIE_INFECT, 0.5f, 0.1f);
case SNIPE:{ GenericFunctions.setBowMode(p.getEquipment().getItemInMainHand(),BowMode.SNIPE);
p.playSound(p.getLocation(), Sound.BLOCK_BREWING_STAND_BREW, 0.5f, 0.1f); }break;
GenericFunctions.setBowMode(p.getEquipment().getItemInMainHand(),BowMode.DEBILITATION); case SNIPE:{
}break; p.playSound(p.getLocation(), Sound.BLOCK_BREWING_STAND_BREW, 0.5f, 0.1f);
case DEBILITATION:{ GenericFunctions.setBowMode(p.getEquipment().getItemInMainHand(),BowMode.DEBILITATION);
p.playSound(p.getLocation(), Sound.BLOCK_CHEST_LOCKED, 0.5f, 3.5f); }break;
GenericFunctions.setBowMode(p.getEquipment().getItemInMainHand(),BowMode.CLOSE); case DEBILITATION:{
}break; p.playSound(p.getLocation(), Sound.BLOCK_CHEST_LOCKED, 0.5f, 3.5f);
GenericFunctions.setBowMode(p.getEquipment().getItemInMainHand(),BowMode.CLOSE);
}break;
}
} else {
switch (mode) {
case CLOSE:{
p.playSound(p.getLocation(), Sound.BLOCK_BREWING_STAND_BREW, 0.5f, 0.1f);
GenericFunctions.setBowMode(p.getEquipment().getItemInMainHand(),BowMode.DEBILITATION);
}break;
case SNIPE:{
p.playSound(p.getLocation(), Sound.BLOCK_CHEST_LOCKED, 0.5f, 3.5f);
GenericFunctions.setBowMode(p.getEquipment().getItemInMainHand(),BowMode.CLOSE);
}break;
case DEBILITATION:{
p.playSound(p.getLocation(), Sound.ENTITY_ZOMBIE_INFECT, 0.5f, 0.1f);
GenericFunctions.setBowMode(p.getEquipment().getItemInMainHand(),BowMode.SNIPE);
}break;
}
} }
GenericFunctions.applyModeName(p.getEquipment().getItemInMainHand()); GenericFunctions.applyModeName(p.getEquipment().getItemInMainHand());
} }
@ -2291,7 +2314,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
player.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION,200,0)); player.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION,200,0));
} }
DecimalFormat df = new DecimalFormat("0.0"); DecimalFormat df = new DecimalFormat("0.0");
player.sendMessage(ChatColor.GRAY+"Damage Reduction: "+ChatColor.DARK_AQUA+df.format(((1-NewCombat.CalculateDamageReduction(1,player,player))*100))+"%"); PlayerStructure pd = PlayerStructure.GetPlayerStructure(player);
if (pd.lastblock+20*5<=getServerTickTime()) {
player.sendMessage(ChatColor.GRAY+"Damage Reduction: "+ChatColor.DARK_AQUA+df.format(((1-NewCombat.CalculateDamageReduction(1,player,player))*100))+"% "+ChatColor.GRAY+"Block Chance: "+ChatColor.DARK_AQUA+df.format(((NewCombat.CalculateDodgeChance(player))*100))+"% ");
pd.lastblock=getServerTickTime();
}
} }
} }
},8); },8);
@ -4128,6 +4155,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
(int)(NewCombat.CalculateGracefulDodgeTicks(p)), (int)(NewCombat.CalculateGracefulDodgeTicks(p)),
0) 0)
); );
break;
} }
} }
p.setNoDamageTicks(10); p.setNoDamageTicks(10);
@ -4440,6 +4468,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
(int)(NewCombat.CalculateGracefulDodgeTicks(p)), (int)(NewCombat.CalculateGracefulDodgeTicks(p)),
0) 0)
); );
break;
} }
} }
p.setNoDamageTicks(10); p.setNoDamageTicks(10);
@ -4490,6 +4519,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
ev.setCancelled(true); ev.setCancelled(true);
} }
dmg = NewCombat.calculateDefenderAbsorbtion(((LivingEntity)ev.getEntity()), dmg); dmg = NewCombat.calculateDefenderAbsorbtion(((LivingEntity)ev.getEntity()), dmg);
if (ev.getDamager() instanceof LivingEntity) {
GenericFunctions.updateNoDamageTickMap((Player)ev.getEntity(),(LivingEntity) ev.getDamager());
}
} }
if (NewCombat.getDamagerEntity(ev.getDamager()) instanceof Monster && if (NewCombat.getDamagerEntity(ev.getDamager()) instanceof Monster &&
ev.getEntity() instanceof LivingEntity) { ev.getEntity() instanceof LivingEntity) {
@ -4675,7 +4707,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
StringBuilder participants_list = new StringBuilder(); StringBuilder participants_list = new StringBuilder();
for (int i=0;i<participants.size();i++) { for (int i=0;i<participants.size();i++) {
Player pl = participants.get(i); Player pl = participants.get(i);
if (pl!=null && pl.isValid() && pl.isOnline()) { if (pl!=null && pl.isOnline()) {
ExperienceOrb exp = GenericFunctions.spawnXP(pl.getLocation(), ev.getDroppedExp()*300); ExperienceOrb exp = GenericFunctions.spawnXP(pl.getLocation(), ev.getDroppedExp()*300);
exp.setInvulnerable(true); exp.setInvulnerable(true);
GenericFunctions.giveItem(pl,aPlugin.API.getEliteBox()); GenericFunctions.giveItem(pl,aPlugin.API.getEliteBox());
@ -5334,8 +5366,19 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
log("Setup new target: "+p.getName(),5); log("Setup new target: "+p.getName(),5);
} }
if (GenericFunctions.isRanger(p)) { if (GenericFunctions.isRanger(p)) {
if (GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.SNIPE) {arr.setVelocity(arr.getVelocity().multiply(1000));} LivingEntity findtarget = aPlugin.API.rayTraceTargetEntity(p,100);
log(arr.getVelocity().lengthSquared()+"",5); if (findtarget==null || !p.hasLineOfSight(findtarget)) {
if (GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.SNIPE) {arr.setVelocity(arr.getVelocity().multiply(1000));}
} else {
//We found a target, we are going to disable this arrow and create an artifical arrow hit from here.
//p.getWorld().spawnArrow(aPlugin.API.getProjectedArrowHitLocation(findtarget, p), arr.get, arg2, arg3);
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
arr.teleport(aPlugin.API.getProjectedArrowHitLocation(findtarget, p).subtract(arr.getVelocity()));
log("Teleported to calculated hit location: "+arr.getLocation(),5);
}},1);
}
log(arr.getVelocity().lengthSquared()+"",2);
//arr.setVelocity(arr.getVelocity().multiply(3.0/arr.getVelocity().lengthSquared())); //arr.setVelocity(arr.getVelocity().multiply(3.0/arr.getVelocity().lengthSquared()));
if (GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.SNIPE) { if (GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.SNIPE) {
aPlugin.API.damageItem(p, p.getEquipment().getItemInMainHand(), 3); aPlugin.API.damageItem(p, p.getEquipment().getItemInMainHand(), 3);
@ -6505,9 +6548,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
}*/ }*/
if (GenericFunctions.HasFullRangerSet(p)) { hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.ALIKAHN, 4, 4)+
hp += 20; ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DARNYS, 4, 4)+
} ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.LORASAADI, 4, 4)+
ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.JAMDAK, 4, 4);
hp*=maxdeduction; hp*=maxdeduction;