->Fixed the order messages appear for automatic updates when players

leave to force a plugin update.
->Fix a bug with the "AOE" ability dealing no extra damage.
->Fix bow damage when hitting mobs regularly with it. (Sharpness still
increases damage)
->Fix bug with /awakenedartifact error'ing out when holding a
non-artifact item.
->Artifact Equipment now has a chance to end up at the Recycling Center
when despawned.
->Artifact Equipment is invulnerable if dropped.
->Dodge Chance now displays in /stats.
->EXP for Artifact bows now gets stored and charged up until you kill
something. EXP is infused into the bow once the kill occurs.
->Improved the calculating efficiency of the "AOE" ability.
->Improve detection of when mobs should be dead. No more mobs that will
be "unkillable" without a proper damage source.
->New loot added to the loot tables. Ranger gear can now be obtained if
the killer is a Ranger. Ranger gear provides bonus dodge chance so you
will never get hit! There are also sets to collect. Getting all 4 pieces
of a set rewards you with +20% increased damage reduction and +20
Health! All the stat bonuses from the pieces only apply when the wearer
is a Ranger.
->Thorns has been buffed! Thorns does flat damage equal to the level of
the enchantment. If you have multiple pieces with thorns, the highest
level piece will be used to calculate damage. This means stacking thorns
on multiple pieces is ineffective! Be careful fighting mobs with Thorns
on them also.
->Transitioning between parties is now smoother, no longer has updating
issues with player names.
->Player mode is now displayed in the player list and can also be viewed
with /stats.
->Health display in player list turns blue when you are full health.
->A notification and sound now plays when strikers activate a
Pre-emptive Strike.
->Information about each combat mode (Defender, Striker, Ranger) can now
be displayed by clicking on it in /stats.

Ranger Mode is now available!
->Defined by holding a Bow in one hand, and no shield in the off-hand.
Can only be wearing leather armor, or no armor.
->Left-clicking mobs will cause them to be knocked back extremely far,
basically in headshot range, when walls permit.
->Base Arrow Damage increased to x4.
->Arrow speed massively increased. Your old max firing speed is the new
minimum drawback speed.
->You can dodge 50% of all damage from any damage sources.
->You have immunity to all Thorns damage.

Shift Right-Click: Change Bow Modes

- Close Range Mode (Default): You gain the ability to deal headshots
from any distance, even directly onto an enemy's face. (Old headshot
behavior)
- Sniping Mode: Headshot collision area increases by x3. Headshots deal
x4 damage, but you also have Slowness VI while in this mode.
- Debilitation Mode: Adds a stack of Poison when hitting non-poisoned
targets. Hitting mobs in this mode refreshes the duration of the poison
stacks. Headshots made in this mode will increase the level of Poison on
the mob, making the mob more and more vulnerable (+50% damage per
stack).
This commit is contained in:
sigonasr2 2016-07-17 04:43:29 -05:00
parent 143f371086
commit e9011cb476
12 changed files with 1861 additions and 1176 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.5.4r6 version: 3.6.0
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.
@ -87,3 +87,8 @@ commands:
usage: /awakenedartifact_ability <ABILITY> <level> usage: /awakenedartifact_ability <ABILITY> <level>
permission: TwosideKeeper.artifact permission: TwosideKeeper.artifact
permission-message: No permissions! permission-message: No permissions!
mode:
description: Displays information about a mode.
usage: /mode <modename>
permission: TwosideKeeper.money
permission-message: No permissions!

View File

@ -185,7 +185,7 @@ public class Artifact {
item.getType()!=Material.AIR && item.getType()!=Material.AIR &&
item.hasItemMeta() && item.hasItemMeta() &&
item.getItemMeta().hasLore() && item.getItemMeta().hasLore() &&
(item.getItemMeta().getLore().contains(ChatColor.GOLD+""+ChatColor.ITALIC+"Artifact Crafting Item") || (GenericFunctions.searchfor(item.getItemMeta().getLore(),ChatColor.GOLD+""+ChatColor.ITALIC+"Artifact Crafting Item") ||
item.getItemMeta().getLore().contains(ChatColor.GOLD+""+ChatColor.ITALIC+"Artifact Item"))) { item.getItemMeta().getLore().contains(ChatColor.GOLD+""+ChatColor.ITALIC+"Artifact Item"))) {
//This is an artifact. //This is an artifact.
return true; return true;

View File

@ -0,0 +1,17 @@
package sig.plugin.TwosideKeeper.HelperStructures;
public enum BowMode {
CLOSE("Close Range"),
SNIPE("Sniping"),
DEBILITATION("Debilitation");
String coolname;
BowMode(String coolname) {
this.coolname=coolname;
}
public String GetCoolName() {
return this.coolname;
}
}

View File

@ -4,10 +4,12 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
@ -36,6 +38,65 @@ public class Loot {
return raresword; return raresword;
} }
public static ItemStack GenerateRangerPiece(Material mat_type, boolean hardened, int tier) {
ItemStack raresword = new ItemStack(mat_type);
ItemMeta sword_meta = raresword.getItemMeta();
List<String> fakelore = new ArrayList<String>();
//Choose a green/yellow/white/brown color.
// Brown - Low Tier (3% - 62% max): Jamdak
// White - Middle Tier (5% - 70% max): Darnys
// Yellow - High Tier (8% - 82% max): Alikahn
// Green - Max Tier (11% - 94% max): Lorasaadi
switch (tier) {
default: {
sword_meta.setDisplayName(ChatColor.AQUA+""+ChatColor.BOLD+"Mega Jamdak Ranger "+GenericFunctions.UserFriendlyMaterialName(mat_type).replace("Leather ", ""));
if (mat_type.toString().contains("LEATHER")) {
fakelore.add(ChatColor.LIGHT_PURPLE+"Ranger Gear");
fakelore.add(ChatColor.GOLD+""+ChatColor.BOLD+"Jamdak Set");
fakelore.add(ChatColor.YELLOW+"+3% Dodge Chance");
}
LeatherArmorMeta lm = (LeatherArmorMeta)sword_meta;
lm.setColor(Color.fromRGB(128, 64, 0));
}break;
case 2: {
sword_meta.setDisplayName(ChatColor.AQUA+""+ChatColor.BOLD+"Mega Darnys Ranger "+GenericFunctions.UserFriendlyMaterialName(mat_type).replace("Leather ", ""));
if (mat_type.toString().contains("LEATHER")) {
fakelore.add(ChatColor.LIGHT_PURPLE+"Ranger Gear");
fakelore.add(ChatColor.GOLD+""+ChatColor.BOLD+"Darnys Set");
fakelore.add(ChatColor.YELLOW+"+5% Dodge Chance");
LeatherArmorMeta lm = (LeatherArmorMeta)sword_meta;
lm.setColor(Color.fromRGB(224, 224, 224));
}
}break;
case 3: {
sword_meta.setDisplayName(ChatColor.LIGHT_PURPLE+""+ChatColor.BOLD+"Hardened Mega Alikahn Ranger "+GenericFunctions.UserFriendlyMaterialName(mat_type).replace("Leather ", ""));
if (mat_type.toString().contains("LEATHER")) {
fakelore.add(ChatColor.LIGHT_PURPLE+"Ranger Gear");
fakelore.add(ChatColor.GOLD+""+ChatColor.BOLD+"Alikahn Set");
fakelore.add(ChatColor.YELLOW+"+8% Dodge Chance");
fakelore.add(ChatColor.GRAY+"Breaks Remaining: "+ChatColor.YELLOW+GetHardenedBreaks(mat_type));
LeatherArmorMeta lm = (LeatherArmorMeta)sword_meta;
lm.setColor(Color.fromRGB(64, 0, 64));
}
}break;
case 4: {
sword_meta.setDisplayName(ChatColor.LIGHT_PURPLE+""+ChatColor.BOLD+"Hardened Mega Lorasaadi Ranger "+GenericFunctions.UserFriendlyMaterialName(mat_type).replace("Leather ", ""));
if (mat_type.toString().contains("LEATHER")) {
fakelore.add(ChatColor.LIGHT_PURPLE+"Ranger Gear");
fakelore.add(ChatColor.GOLD+""+ChatColor.BOLD+"Lorasaadi Set");
fakelore.add(ChatColor.YELLOW+"+11% Dodge Chance");
fakelore.add(ChatColor.GRAY+"Breaks Remaining: "+ChatColor.YELLOW+GetHardenedBreaks(mat_type));
LeatherArmorMeta lm = (LeatherArmorMeta)sword_meta;
lm.setColor(Color.fromRGB(0, 64, 0));
}
}break;
}
sword_meta.setLore(fakelore);
raresword.setItemMeta(sword_meta);
raresword = addEnchantments(raresword,false);
return raresword;
}
private static int GetHardenedBreaks(Material type) { private static int GetHardenedBreaks(Material type) {
if (type.toString().contains("STONE")) { if (type.toString().contains("STONE")) {
return (int)((Math.random()*3)+2); return (int)((Math.random()*3)+2);
@ -49,6 +110,9 @@ public class Loot {
if (type.toString().contains("GOLD")) { if (type.toString().contains("GOLD")) {
return (int)((Math.random()*12)+10); return (int)((Math.random()*12)+10);
} else } else
if (type.toString().contains("LEATHER")) {
return (int)((Math.random()*12)+10);
} else
{ {
return 5; return 5;
} }
@ -76,7 +140,7 @@ public class Loot {
enchantment_level = (int)(((Math.random()*5)+6)*((hardened)?HARDENED_ENCHANT_MULT:1)); enchantment_level = (int)(((Math.random()*5)+6)*((hardened)?HARDENED_ENCHANT_MULT:1));
} else } else
{ {
enchantment_level = (int)(((Math.random()*9)+1)*((hardened)?HARDENED_ENCHANT_MULT:1)); enchantment_level = (int)(((Math.random()*6)+3)*((hardened)?HARDENED_ENCHANT_MULT:1));
} }
if (enchantment_level>MAX_ENCHANT_LEVEL) { if (enchantment_level>MAX_ENCHANT_LEVEL) {

View File

@ -20,6 +20,10 @@ public enum MonsterDifficulty {
new LootStructure(Material.IRON_INGOT), new LootStructure(Material.IRON_INGOT),
new LootStructure(Material.DIAMOND), new LootStructure(Material.DIAMOND),
new LootStructure(Material.GOLD_NUGGET), new LootStructure(Material.GOLD_NUGGET),
new LootStructure(Material.LEATHER_HELMET,1),
new LootStructure(Material.LEATHER_CHESTPLATE,1),
new LootStructure(Material.LEATHER_LEGGINGS,1),
new LootStructure(Material.LEATHER_BOOTS,1),
}, },
new LootStructure[]{ //Legendary Loot new LootStructure[]{ //Legendary Loot
new LootStructure(Material.STONE_SWORD, true), new LootStructure(Material.STONE_SWORD, true),
@ -28,6 +32,10 @@ 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(
@ -46,6 +54,10 @@ 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),
@ -58,6 +70,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_CHESTPLATE,2),
new LootStructure(Material.LEATHER_LEGGINGS,2),
new LootStructure(Material.LEATHER_BOOTS,2),
} }
), ),
DEADLY( DEADLY(
@ -81,6 +97,10 @@ public enum MonsterDifficulty {
new LootStructure(Material.DIAMOND_HELMET, false), new LootStructure(Material.DIAMOND_HELMET, false),
new LootStructure(Material.FISHING_ROD, false), new LootStructure(Material.FISHING_ROD, false),
new LootStructure(Material.BOW, false), new LootStructure(Material.BOW, 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.DIAMOND_SWORD, true), new LootStructure(Material.DIAMOND_SWORD, true),
@ -94,6 +114,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_CHESTPLATE,3),
new LootStructure(Material.LEATHER_LEGGINGS,3),
new LootStructure(Material.LEATHER_BOOTS,3),
} }
), ),
HELLFIRE( HELLFIRE(
@ -122,6 +146,10 @@ public enum MonsterDifficulty {
new LootStructure(Material.GOLD_HELMET, false), new LootStructure(Material.GOLD_HELMET, false),
new LootStructure(Material.BOW, false), new LootStructure(Material.BOW, false),
new LootStructure(Material.FISHING_ROD, false), new LootStructure(Material.FISHING_ROD, false),
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[]{ //Legendary Loot new LootStructure[]{ //Legendary Loot
new LootStructure(Material.GOLD_SWORD, true), new LootStructure(Material.GOLD_SWORD, true),
@ -140,6 +168,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_CHESTPLATE,4),
new LootStructure(Material.LEATHER_LEGGINGS,4),
new LootStructure(Material.LEATHER_BOOTS,4),
} }
); );
@ -158,7 +190,7 @@ public enum MonsterDifficulty {
return null; return null;
} }
public List<ItemStack> RandomizeDrops(double dropmult, boolean isBoss) { public List<ItemStack> RandomizeDrops(double dropmult, boolean isBoss, boolean isRanger) {
List<ItemStack> droplist = new ArrayList<ItemStack>(); List<ItemStack> droplist = new ArrayList<ItemStack>();
dropmult += 1; //Base dropmult is 1.0. dropmult += 1; //Base dropmult is 1.0.
if (Math.random() < dropmult % 1) if (Math.random() < dropmult % 1)
@ -174,7 +206,7 @@ public enum MonsterDifficulty {
if (Math.random()<TwosideKeeper.COMMON_DROP_RATE*dropmult && if (Math.random()<TwosideKeeper.COMMON_DROP_RATE*dropmult &&
this.loot_regular.length>0) { this.loot_regular.length>0) {
//This is a common roll. //This is a common roll.
ItemStack gen_loot = DistributeRandomLoot(this.loot_regular); ItemStack gen_loot = DistributeRandomLoot(this.loot_regular, isRanger);
TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 4); TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 4);
droplist.add(gen_loot); droplist.add(gen_loot);
} }
@ -182,7 +214,7 @@ public enum MonsterDifficulty {
if (Math.random()<TwosideKeeper.RARE_DROP_RATE*dropmult && if (Math.random()<TwosideKeeper.RARE_DROP_RATE*dropmult &&
this.loot_rare.length>0) { this.loot_rare.length>0) {
//This is a common roll. //This is a common roll.
ItemStack gen_loot = DistributeRandomLoot(this.loot_rare); ItemStack gen_loot = DistributeRandomLoot(this.loot_rare, isRanger);
TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 4); TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 4);
droplist.add(gen_loot); droplist.add(gen_loot);
if (Math.random()<=0.2) { if (Math.random()<=0.2) {
@ -206,7 +238,7 @@ public enum MonsterDifficulty {
if (Math.random()<TwosideKeeper.LEGENDARY_DROP_RATE*dropmult && if (Math.random()<TwosideKeeper.LEGENDARY_DROP_RATE*dropmult &&
this.loot_legendary.length>0) { this.loot_legendary.length>0) {
//This is a common roll. //This is a common roll.
ItemStack gen_loot = DistributeRandomLoot(this.loot_legendary); ItemStack gen_loot = DistributeRandomLoot(this.loot_legendary, isRanger);
TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 4); TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 4);
droplist.add(gen_loot); droplist.add(gen_loot);
if (Math.random()<=0.2) { if (Math.random()<=0.2) {
@ -235,13 +267,13 @@ public enum MonsterDifficulty {
} }
if (isBoss) { //50% of the time, we drop something great. if (isBoss) { //50% of the time, we drop something great.
if (Math.random()<=0.5 && this.loot_legendary.length>0) { if (Math.random()<=0.5 && this.loot_legendary.length>0) {
ItemStack gen_loot = DistributeRandomLoot(this.loot_legendary); ItemStack gen_loot = DistributeRandomLoot(this.loot_legendary, isRanger);
TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 4); TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 4);
droplist.add(gen_loot); droplist.add(gen_loot);
} }
else else
if (this.loot_rare.length>0) { //Consolation Prize. if (this.loot_rare.length>0) { //Consolation Prize.
ItemStack gen_loot = DistributeRandomLoot(this.loot_rare); ItemStack gen_loot = DistributeRandomLoot(this.loot_rare, isRanger);
TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 4); TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 4);
droplist.add(gen_loot); droplist.add(gen_loot);
} }
@ -251,7 +283,7 @@ public enum MonsterDifficulty {
return droplist; return droplist;
} }
private ItemStack DistributeRandomLoot(LootStructure[] lootlist) { private ItemStack DistributeRandomLoot(LootStructure[] lootlist, boolean isRanger) {
//Choose an item randomly from the loot list. //Choose an item randomly from the loot list.
if (lootlist.length>0) { if (lootlist.length>0) {
//Choose an element. //Choose an element.
@ -265,7 +297,16 @@ 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 {
return Loot.GenerateMegaPiece(ls.GetMaterial(), ls.GetHardened()); if (ls.GetMaterial().toString().contains("LEATHER")) {
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 {
return Loot.GenerateMegaPiece(ls.GetMaterial(), ls.GetHardened());
}
} }
} else { } else {
//Turn it into a normal item. //Turn it into a normal item.

View File

@ -110,7 +110,7 @@ public class WorldShop {
String message = ""; String message = "";
if (item.hasItemMeta() && if (item.hasItemMeta() &&
item.getItemMeta().hasDisplayName()) { item.getItemMeta().hasDisplayName()) {
message+="\n"+ChatColor.DARK_GRAY+"Item Type: "+ChatColor.ITALIC+ChatColor.GRAY+GenericFunctions.UserFriendlyMaterialName(item)+"\n"; message+="\n"+ChatColor.DARK_GRAY+"Item Type: "+ChatColor.ITALIC+ChatColor.GRAY+GenericFunctions.UserFriendlyMaterialName(item.getType())+"\n";
} }
for (int i=0;i<Enchantment.values().length;i++) { for (int i=0;i<Enchantment.values().length;i++) {
if (item.containsEnchantment(Enchantment.values()[i])) { if (item.containsEnchantment(Enchantment.values()[i])) {

View File

@ -566,7 +566,7 @@ public class MonsterController {
} }
if(isZombieLeader(m)) if(isZombieLeader(m))
{ {
m.setMaxHealth(13); m.setMaxHealth(20);
m.setHealth(m.getMaxHealth()); m.setHealth(m.getMaxHealth());
} }
}break; }break;
@ -582,7 +582,7 @@ public class MonsterController {
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,99999,1)); m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,99999,1));
if(isZombieLeader(m)) if(isZombieLeader(m))
{ {
m.setMaxHealth(26); m.setMaxHealth(50);
m.setHealth(m.getMaxHealth()); m.setHealth(m.getMaxHealth());
} }
}break; }break;
@ -607,7 +607,7 @@ public class MonsterController {
if (Math.random()<=0.2) {m.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION,99999,1));} if (Math.random()<=0.2) {m.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION,99999,1));}
if(isZombieLeader(m)) if(isZombieLeader(m))
{ {
m.setMaxHealth(54); m.setMaxHealth(200);
m.setHealth(m.getMaxHealth()); m.setHealth(m.getMaxHealth());
} }
}break; }break;
@ -621,7 +621,7 @@ public class MonsterController {
} }
if(isZombieLeader(m)) if(isZombieLeader(m))
{ {
m.setMaxHealth(6); m.setMaxHealth(40);
m.setHealth(m.getMaxHealth()); m.setHealth(m.getMaxHealth());
} }
}break; }break;

View File

@ -10,6 +10,8 @@ import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.scoreboard.DisplaySlot; import org.bukkit.scoreboard.DisplaySlot;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
public class Party { public class Party {
public List<Player> partyplayers; public List<Player> partyplayers;
public List<Player> lastorder; public List<Player> lastorder;
@ -102,6 +104,10 @@ public class Party {
} }
Bukkit.dispatchCommand(Bukkit.getServer().getConsoleSender(), "scoreboard players set "+p.getName().toLowerCase()+" Party"+color+" "+partyplayers.size()*-1); Bukkit.dispatchCommand(Bukkit.getServer().getConsoleSender(), "scoreboard players set "+p.getName().toLowerCase()+" Party"+color+" "+partyplayers.size()*-1);
Bukkit.dispatchCommand(Bukkit.getServer().getConsoleSender(), "scoreboard teams option "+p.getName().toLowerCase()+" color "+ConvertColor(color)); Bukkit.dispatchCommand(Bukkit.getServer().getConsoleSender(), "scoreboard teams option "+p.getName().toLowerCase()+" color "+ConvertColor(color));
p.getScoreboard().getTeam(p.getName().toLowerCase()).setSuffix(TwosideKeeper.createHealthbar(((p.getHealth())/p.getMaxHealth())*100,p));
TwosideKeeper.setPlayerMaxHealth(p);
p.getScoreboard().getTeam(p.getName().toLowerCase()).setPrefix(GenericFunctions.PlayerModePrefix(p));
} }
public void sortPlayers() { public void sortPlayers() {
@ -189,6 +195,12 @@ public class Party {
if (partyplayers.size()>=2) { if (partyplayers.size()>=2) {
//partyplayers.get(i).sendMessage(ChatColor.DARK_GRAY+""+ChatColor.ITALIC+"Party buffs removed."); //partyplayers.get(i).sendMessage(ChatColor.DARK_GRAY+""+ChatColor.ITALIC+"Party buffs removed.");
} }
if (partyplayers.get(i)!=null &&
partyplayers.get(i).isOnline()) {
partyplayers.get(i).getScoreboard().getTeam(partyplayers.get(i).getName().toLowerCase()).setSuffix(TwosideKeeper.createHealthbar(((partyplayers.get(i).getHealth())/partyplayers.get(i).getMaxHealth())*100,partyplayers.get(i)));
TwosideKeeper.setPlayerMaxHealth(partyplayers.get(i));
partyplayers.get(i).getScoreboard().getTeam(partyplayers.get(i).getName().toLowerCase()).setPrefix(GenericFunctions.PlayerModePrefix(partyplayers.get(i)));
}
partyplayers.remove(i); partyplayers.remove(i);
i--; i--;
} }

View File

@ -61,6 +61,7 @@ public class PlayerStructure {
public boolean highwinder=false; public boolean highwinder=false;
public double highwinderdmg=0.0; public double highwinderdmg=0.0;
public int nextarrowxp = 0; //How much bonus XP to give to an Artifact Bow. public int nextarrowxp = 0; //How much bonus XP to give to an Artifact Bow.
public boolean hasfullrangerset=false;
public double prev_weapondmg=0.0; public double prev_weapondmg=0.0;
public double prev_buffdmg=0.0; public double prev_buffdmg=0.0;
@ -100,6 +101,7 @@ public class PlayerStructure {
this.highwinder=false; this.highwinder=false;
this.highwinderdmg=0.0; this.highwinderdmg=0.0;
this.nextarrowxp=0; this.nextarrowxp=0;
this.hasfullrangerset=false;
this.last_strikerspell=TwosideKeeper.getServerTickTime(); this.last_strikerspell=TwosideKeeper.getServerTickTime();
//Set defaults first, in case this is a new user. //Set defaults first, in case this is a new user.
loadConfig(); loadConfig();

View File

@ -87,6 +87,7 @@ import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.entity.PotionSplashEvent; import org.bukkit.event.entity.PotionSplashEvent;
import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
import org.bukkit.event.inventory.CraftItemEvent; import org.bukkit.event.inventory.CraftItemEvent;
@ -161,6 +162,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.ArtifactAbility;
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItem; import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItem;
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItemType; import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItemType;
import sig.plugin.TwosideKeeper.HelperStructures.BankSession; import sig.plugin.TwosideKeeper.HelperStructures.BankSession;
import sig.plugin.TwosideKeeper.HelperStructures.BowMode;
import sig.plugin.TwosideKeeper.HelperStructures.CubeType; import sig.plugin.TwosideKeeper.HelperStructures.CubeType;
import sig.plugin.TwosideKeeper.HelperStructures.CustomRecipe; import sig.plugin.TwosideKeeper.HelperStructures.CustomRecipe;
import sig.plugin.TwosideKeeper.HelperStructures.DeathStructure; import sig.plugin.TwosideKeeper.HelperStructures.DeathStructure;
@ -417,6 +419,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
*/ */
//End Advertisements. //End Advertisements.
LASTSERVERCHECK=getServerTickTime(); LASTSERVERCHECK=getServerTickTime();
} }
@ -493,6 +497,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
} }
if (GenericFunctions.isRanger(p) &&
GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.SNIPE) {
p.removePotionEffect(PotionEffectType.SLOW);
p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,20,5));
}
if (TwosideShops.PlayerHasPurchases(p)) { if (TwosideShops.PlayerHasPurchases(p)) {
TwosideShops.PlayerSendPurchases(p); TwosideShops.PlayerSendPurchases(p);
} }
@ -515,7 +525,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (pd.highwinder && pd.target!=null && !pd.target.isDead()) { if (pd.highwinder && pd.target!=null && !pd.target.isDead()) {
aPlugin.API.sendActionBarMessage(p, drawVelocityBar(pd.velocity,pd.highwinderdmg)); aPlugin.API.sendActionBarMessage(p, drawVelocityBar(pd.velocity,pd.highwinderdmg));
} }
if (pd.target!=null && !pd.target.isDead() && pd.target.getLocation().distanceSquared(p.getLocation())>256) { if (pd.target!=null && !pd.target.isDead() && pd.target.getLocation().getWorld().equals(p.getWorld()) && pd.target.getLocation().distanceSquared(p.getLocation())>256) {
pd.target=null; pd.target=null;
} }
@ -565,6 +575,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
//Check damage reduction by sending an artifical "1" damage to the player. //Check damage reduction by sending an artifical "1" damage to the player.
if (!p.isDead()) {log("Player is not dead.",5); setPlayerMaxHealth(p);} if (!p.isDead()) {log("Player is not dead.",5); setPlayerMaxHealth(p);}
p.getScoreboard().getTeam(p.getName().toLowerCase()).setSuffix(createHealthbar(((p.getHealth())/p.getMaxHealth())*100,p)); p.getScoreboard().getTeam(p.getName().toLowerCase()).setSuffix(createHealthbar(((p.getHealth())/p.getMaxHealth())*100,p));
p.getScoreboard().getTeam(p.getName().toLowerCase()).setPrefix(GenericFunctions.PlayerModePrefix(p));
/*double old_weapondmg = pd.prev_weapondmg; /*double old_weapondmg = pd.prev_weapondmg;
double old_buffdmg = pd.prev_buffdmg; double old_buffdmg = pd.prev_buffdmg;
double old_partydmg = pd.prev_partydmg; double old_partydmg = pd.prev_partydmg;
@ -661,6 +672,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
break; break;
} }
} }
PartyList.remove(j); PartyList.remove(j);
j--; j--;
} else { } else {
@ -813,6 +825,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
p.getLocation().add(0,0,0).getBlock().setType(Material.AIR); p.getLocation().add(0,0,0).getBlock().setType(Material.AIR);
} }
if (SERVER_TYPE==ServerType.TEST || SERVER_TYPE==ServerType.QUIET) { if (SERVER_TYPE==ServerType.TEST || SERVER_TYPE==ServerType.QUIET) {
//GenericFunctions.setBowMode(p.getEquipment().getItemInMainHand(), BowMode.SNIPE);
//p.sendMessage("This is bow mode "+GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand()));
/*for (int i=0;i<p.getEquipment().getArmorContents().length;i++) { /*for (int i=0;i<p.getEquipment().getArmorContents().length;i++) {
if (GenericFunctions.isArtifactEquip(p.getEquipment().getArmorContents()[i]) && if (GenericFunctions.isArtifactEquip(p.getEquipment().getArmorContents()[i]) &&
GenericFunctions.isArtifactArmor(p.getEquipment().getArmorContents()[i])) { GenericFunctions.isArtifactArmor(p.getEquipment().getArmorContents()[i])) {
@ -1008,7 +1022,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
//Display the generic levelup message. //Display the generic levelup message.
Player p = Bukkit.getPlayer(sender.getName()); Player p = Bukkit.getPlayer(sender.getName());
if (p.getEquipment().getItemInMainHand()!=null && if (p.getEquipment().getItemInMainHand()!=null &&
p.getEquipment().getItemInMainHand().getType()!=Material.AIR) { p.getEquipment().getItemInMainHand().getType()!=Material.AIR
&& GenericFunctions.isArtifactEquip(p.getEquipment().getItemInMainHand())) {
p.sendMessage("");p.sendMessage(""); p.sendMessage("");p.sendMessage("");
p.spigot().sendMessage(ArtifactAbility.GenerateMenu(ArtifactItemType.getArtifactItemTypeFromItemStack(p.getEquipment().getItemInMainHand()).getUpgradePath(), CalculateDamageReduction(1,p,p), p.getEquipment().getItemInMainHand())); p.spigot().sendMessage(ArtifactAbility.GenerateMenu(ArtifactItemType.getArtifactItemTypeFromItemStack(p.getEquipment().getItemInMainHand()).getUpgradePath(), CalculateDamageReduction(1,p,p), p.getEquipment().getItemInMainHand()));
} }
@ -1023,6 +1038,14 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} else { } else {
sender.sendMessage("Wrong arguments!"); sender.sendMessage("Wrong arguments!");
} }
} else
if (cmd.getName().equalsIgnoreCase("mode")) {
if (args.length==1) {
sender.sendMessage(GenericFunctions.PlayerModeInformation(args[0]));
return true;
} else {
sender.sendMessage("Wrong arguments!");
}
} }
} else { } else {
//Implement console/admin version later (Let's you check any name's money.) //Implement console/admin version later (Let's you check any name's money.)
@ -1080,7 +1103,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
//Update player max health. Check equipment too. //Update player max health. Check equipment too.
setPlayerMaxHealth(ev.getPlayer()); setPlayerMaxHealth(ev.getPlayer());
ev.getPlayer().getScoreboard().getTeam(ev.getPlayer().getName().toLowerCase()).setSuffix(createHealthbar(((ev.getPlayer().getHealth())/ev.getPlayer().getMaxHealth())*100,ev.getPlayer())); ev.getPlayer().getScoreboard().getTeam(ev.getPlayer().getName().toLowerCase()).setSuffix(createHealthbar(((ev.getPlayer().getHealth())/ev.getPlayer().getMaxHealth())*100,ev.getPlayer()));
ev.getPlayer().getScoreboard().getTeam(ev.getPlayer().getName().toLowerCase()).setPrefix(GenericFunctions.PlayerModePrefix(ev.getPlayer()));
ev.getPlayer().getAttribute(Attribute.GENERIC_ATTACK_SPEED).setBaseValue(4.0d); ev.getPlayer().getAttribute(Attribute.GENERIC_ATTACK_SPEED).setBaseValue(4.0d);
} }
@ -1094,15 +1117,19 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
p.playSound(p.getLocation(), Sound.BLOCK_NOTE_PLING, 8, 0.7f); p.playSound(p.getLocation(), Sound.BLOCK_NOTE_PLING, 8, 0.7f);
} }
} }
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
if (Bukkit.getOnlinePlayers().size()==1 && restarting_server) { @Override
Bukkit.savePlayers(); public void run() {
DiscordMessageSender.sendItalicizedRawMessageDiscord("All players have disconnected. Server is shutting down..."); if (Bukkit.getOnlinePlayers().size()==1 && restarting_server) {
for (int i=0;i<Bukkit.getWorlds().size();i++) { Bukkit.savePlayers();
Bukkit.getWorlds().get(i).save(); DiscordMessageSender.sendItalicizedRawMessageDiscord("All players have disconnected. Server is shutting down...");
for (int i=0;i<Bukkit.getWorlds().size();i++) {
Bukkit.getWorlds().get(i).save();
}
Bukkit.shutdown();
}
} }
Bukkit.shutdown(); },5);
}
//Find the player that is getting removed. //Find the player that is getting removed.
PlayerStructure pd = (PlayerStructure)playerdata.get(ev.getPlayer().getUniqueId()); PlayerStructure pd = (PlayerStructure)playerdata.get(ev.getPlayer().getUniqueId());
@ -1665,6 +1692,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
ev.setCancelled(true); ev.setCancelled(true);
} }
//Bukkit.dispatchCommand(Bukkit.getConsoleSender(),"tellraw @a [\"\",{\"text\":\""+ChatColor.GREEN+"[Item]"+ChatColor.WHITE+"\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""+(ev.getPlayer().getEquipment().getItemInMainHand().getType())+"\"}},{\"text\":\" "+ev.getMessage().substring(0, pos)+" \"}]"); //Bukkit.dispatchCommand(Bukkit.getConsoleSender(),"tellraw @a [\"\",{\"text\":\""+ChatColor.GREEN+"[Item]"+ChatColor.WHITE+"\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""+(ev.getPlayer().getEquipment().getItemInMainHand().getType())+"\"}},{\"text\":\" "+ev.getMessage().substring(0, pos)+" \"}]");
} }
} }
} }
@ -1714,6 +1742,32 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
ev.getPlayer().sendMessage(ChatColor.DARK_BLUE+"New Recycling Center successfully created at "+ev.getClickedBlock().getLocation().toString()); ev.getPlayer().sendMessage(ChatColor.DARK_BLUE+"New Recycling Center successfully created at "+ev.getClickedBlock().getLocation().toString());
} }
//Check for a bow shift-right click.
if (ev.getAction()==Action.RIGHT_CLICK_AIR || ev.getAction()==Action.RIGHT_CLICK_BLOCK) {
Player p = ev.getPlayer();
if (GenericFunctions.isRanger(p) && p.isSneaking()) {
//Rotate Bow Modes.
p.removePotionEffect(PotionEffectType.SLOW);
BowMode mode = GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand());
switch (mode) {
case CLOSE:{
p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,20,5));
p.playSound(p.getLocation(), Sound.ENTITY_ZOMBIE_INFECT, 0.5f, 0.1f);
GenericFunctions.setBowMode(p.getEquipment().getItemInMainHand(),BowMode.SNIPE);
}break;
case SNIPE:{
p.playSound(p.getLocation(), Sound.BLOCK_BREWING_STAND_BREW, 0.5f, 0.1f);
GenericFunctions.setBowMode(p.getEquipment().getItemInMainHand(),BowMode.DEBILITATION);
}break;
case DEBILITATION:{
p.playSound(p.getLocation(), Sound.BLOCK_CHEST_LOCKED, 0.5f, 3.5f);
GenericFunctions.setBowMode(p.getEquipment().getItemInMainHand(),BowMode.CLOSE);
}break;
}
GenericFunctions.applyModeName(p.getEquipment().getItemInMainHand());
}
}
//Check for a Sword left click. //Check for a Sword left click.
if (ev.getAction()==Action.LEFT_CLICK_AIR || ev.getAction()==Action.LEFT_CLICK_BLOCK) { if (ev.getAction()==Action.LEFT_CLICK_AIR || ev.getAction()==Action.LEFT_CLICK_BLOCK) {
Player p = ev.getPlayer(); Player p = ev.getPlayer();
@ -1824,6 +1878,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} else { } else {
player.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION,200,0)); player.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION,200,0));
} }
DecimalFormat df = new DecimalFormat("0.0");
player.sendMessage(ChatColor.GRAY+"Damage Reduction: "+ChatColor.DARK_AQUA+df.format(((1-CalculateDamageReduction(1,player,player))*100))+"%");
} }
} }
},8); },8);
@ -3242,6 +3298,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
Monster m = (Monster)loc.getWorld().spawnEntity(loc, EntityType.ZOMBIE); Monster m = (Monster)loc.getWorld().spawnEntity(loc, EntityType.ZOMBIE);
m.setTarget(((Monster)ev.getEntity()).getTarget()); m.setTarget(((Monster)ev.getEntity()).getTarget());
MonsterController.MobHeightControl(m,true); MonsterController.MobHeightControl(m,true);
if (m.getCustomName()!=null) {
m.setCustomName(m.getCustomName()+" Minion");
} else {
m.setCustomName("Zombie Minion");
}
ev.getEntity().remove(); ev.getEntity().remove();
} else } else
if (!MonsterController.MobHeightControl(ev.getEntity(),false)) { if (!MonsterController.MobHeightControl(ev.getEntity(),false)) {
@ -3271,6 +3332,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public void run() { public void run() {
if (p!=null) { if (p!=null) {
p.getScoreboard().getTeam(p.getName().toLowerCase()).setSuffix(createHealthbar(((p.getHealth())/p.getMaxHealth())*100,p)); p.getScoreboard().getTeam(p.getName().toLowerCase()).setSuffix(createHealthbar(((p.getHealth())/p.getMaxHealth())*100,p));
p.getScoreboard().getTeam(p.getName().toLowerCase()).setPrefix(GenericFunctions.PlayerModePrefix(p));
} }
}} }}
,5); ,5);
@ -3345,6 +3407,22 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
log("New damage set to "+ev.getDamage()+" from Poison "+poisonlv,3); log("New damage set to "+ev.getDamage()+" from Poison "+poisonlv,3);
} }
} }
if (l instanceof Monster) {
if (l.hasPotionEffect(PotionEffectType.BLINDNESS)) {
for (int j=0;j<l.getActivePotionEffects().size();j++) {
if (Iterables.get(l.getActivePotionEffects(), j).getType().equals(PotionEffectType.BLINDNESS)) {
poisonlv = Iterables.get(l.getActivePotionEffects(), j).getAmplifier()+1;
break;
}
}
if (poisonlv>0) {
ev.setDamage(ev.getDamage()+(ev.getDamage()*poisonlv*0.5));
log("New damage set to "+ev.getDamage()+" from Poison "+poisonlv,3);
}
}
}
} }
if (e instanceof Player) { if (e instanceof Player) {
@ -3450,6 +3528,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
//final double pcthp = ((p.getHealth())/p.getMaxHealth())*100; //final double pcthp = ((p.getHealth())/p.getMaxHealth())*100;
double dodgechance = GenericFunctions.CalculateDodgeChance(p); double dodgechance = GenericFunctions.CalculateDodgeChance(p);
if (ev.getCause()==DamageCause.THORNS &&
GenericFunctions.isRanger(p)) {
dodgechance=1;
}
if (Math.random()<=dodgechance) { if (Math.random()<=dodgechance) {
//Cancel this event, we dodged the attack. //Cancel this event, we dodged the attack.
p.playSound(p.getLocation(), Sound.ENTITY_PLAYER_ATTACK_SWEEP, 3.0f, 1.0f); p.playSound(p.getLocation(), Sound.ENTITY_PLAYER_ATTACK_SWEEP, 3.0f, 1.0f);
@ -3477,6 +3561,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public void run() { public void run() {
if (p!=null) { if (p!=null) {
p.getScoreboard().getTeam(p.getName().toLowerCase()).setSuffix(createHealthbar(((p.getHealth())/p.getMaxHealth())*100,p)); p.getScoreboard().getTeam(p.getName().toLowerCase()).setSuffix(createHealthbar(((p.getHealth())/p.getMaxHealth())*100,p));
p.getScoreboard().getTeam(p.getName().toLowerCase()).setPrefix(GenericFunctions.PlayerModePrefix(p));
} }
}} }}
,2); ,2);
@ -3659,6 +3744,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
} }
if (ev.getCause()==DamageCause.THORNS) {
ev.setDamage(GenericFunctions.getMaxThornsLevel(m));
}
log("Final dmg is "+ev.getFinalDamage(),4); log("Final dmg is "+ev.getFinalDamage(),4);
//Make this monster the player's new target. //Make this monster the player's new target.
@ -3691,21 +3780,30 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
ev.setDamage(DamageModifier.RESISTANCE,0); ev.setDamage(DamageModifier.RESISTANCE,0);
ev.setDamage(DamageModifier.ARMOR,0); ev.setDamage(DamageModifier.ARMOR,0);
//log("Player dealt "+ev.getDamage(),2);
if (m.getType()==EntityType.ZOMBIE && if (m.getType()==EntityType.ZOMBIE &&
MonsterController.getMonsterDifficulty((Monster)m)==MonsterDifficulty.HELLFIRE && MonsterController.getMonsterDifficulty((Monster)m)==MonsterDifficulty.HELLFIRE &&
!chargezombies.contains((Monster)m)) { !chargezombies.contains((Monster)m)) {
chargezombies.add(new ChargeZombie((Monster)m)); chargezombies.add(new ChargeZombie((Monster)m));
} }
ev.setDamage(CalculateWeaponDamage(p,m));
boolean preemptive = false;
if (GenericFunctions.isStriker(p) && if (GenericFunctions.isStriker(p) &&
p.getHealth()==p.getMaxHealth() && p.getHealth()==p.getMaxHealth() &&
m.getHealth()==m.getMaxHealth()) { m.getHealth()==m.getMaxHealth()) {
//Deal triple damage. //Deal triple damage.
log("Triple damage!",5); log("Triple damage!",5);
ev.setDamage(ev.getDamage()*3); preemptive=true;
p.playSound(p.getLocation(), Sound.ENTITY_SHULKER_TELEPORT, 1f, 3.65f);
} }
double rawdmg = CalculateWeaponDamage(p,m)*((preemptive)?3d:1d);
ev.setDamage(rawdmg);
//Damage dealt by the player is calculated differently, therefore we will cancel the normal damage calculation in favor //Damage dealt by the player is calculated differently, therefore we will cancel the normal damage calculation in favor
//of a new custom damage calculation. //of a new custom damage calculation.
if (p.getInventory().getItemInMainHand().getType()!=Material.BOW) { if (p.getInventory().getItemInMainHand().getType()!=Material.BOW) {
@ -3731,6 +3829,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
} }
} }
} else {
double dmg = 2;
dmg+=p.getInventory().getItemInMainHand().getEnchantmentLevel(Enchantment.DAMAGE_ALL);
ev.setDamage(dmg);
} }
if (m instanceof Monster) { if (m instanceof Monster) {
if (m.getType()==EntityType.SPIDER && if (m.getType()==EntityType.SPIDER &&
@ -3787,6 +3889,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
//Deal AoE damage. //Deal AoE damage.
double checkrange = ArtifactAbility.calculateValue(ArtifactAbility.AOE, p.getEquipment().getItemInMainHand().getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.AOE, p.getEquipment().getItemInMainHand())); double checkrange = ArtifactAbility.calculateValue(ArtifactAbility.AOE, p.getEquipment().getItemInMainHand().getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.AOE, p.getEquipment().getItemInMainHand()));
List<Entity> entities = m.getNearbyEntities(checkrange, checkrange, checkrange); List<Entity> entities = m.getNearbyEntities(checkrange, checkrange, checkrange);
int totalexp = 0;
for (int i=0;i<entities.size();i++) { for (int i=0;i<entities.size();i++) {
if ((entities.get(i) instanceof Monster || entities.get(i) instanceof Animals) && if ((entities.get(i) instanceof Monster || entities.get(i) instanceof Animals) &&
entities.get(i)!=m) { entities.get(i)!=m) {
@ -3807,10 +3910,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
GenericFunctions.ApplyDeathMark(ent); GenericFunctions.ApplyDeathMark(ent);
} }
} }
AwakenedArtifact.addPotentialEXP(p.getEquipment().getItemInMainHand(), (int)(ratio*20)+5, p); totalexp+=(int)(ratio*20)+5;
GenericFunctions.DealDamageToMob(0, ent, p, false); GenericFunctions.DealDamageToMob(rawdmg, ent, p, false);
} }
} }
AwakenedArtifact.addPotentialEXP(p.getEquipment().getItemInMainHand(), totalexp, p);
final List<LivingEntity> finallist = hitlist; final List<LivingEntity> finallist = hitlist;
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() { public void run() {
@ -3871,6 +3975,13 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (GenericFunctions.isWeapon(p.getEquipment().getItemInMainHand())) { if (GenericFunctions.isWeapon(p.getEquipment().getItemInMainHand())) {
GenericFunctions.RemovePermEnchantmentChance(p.getEquipment().getItemInMainHand(), p); GenericFunctions.RemovePermEnchantmentChance(p.getEquipment().getItemInMainHand(), p);
} }
if (GenericFunctions.isRanger(p)) {
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
m.setVelocity(m.getVelocity().setY(0.1).multiply(8));
}}
,1);
}
//Artifact armor will receive a tiny bit of EXP. //Artifact armor will receive a tiny bit of EXP.
for (int i=0;i<p.getEquipment().getArmorContents().length;i++) { for (int i=0;i<p.getEquipment().getArmorContents().length;i++) {
@ -3881,6 +3992,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
ev.setDamage(CalculateDamageReduction(ev.getDamage(),m,p)); ev.setDamage(CalculateDamageReduction(ev.getDamage(),m,p));
if (ev.getCause()==DamageCause.THORNS) {
ev.setDamage(GenericFunctions.getMaxThornsLevel(p));
}
//ev.setCancelled(true); //ev.setCancelled(true);
m.setNoDamageTicks(20); m.setNoDamageTicks(20);
@ -3888,7 +4004,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
//PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId()); //PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId());
//Found the player structure. Set the target. //Found the player structure. Set the target.
pd.target=m; pd.target=m;
updateTitle(p); updateTitle(p,false,preemptive);
} else } else
if ((ev.getDamager() instanceof Arrow && if ((ev.getDamager() instanceof Arrow &&
ev.getEntity() instanceof Player)) { ev.getEntity() instanceof Player)) {
@ -4011,20 +4127,61 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
headshotvaly+=headshotvaly*ArtifactAbility.calculateValue(ArtifactAbility.MARKSMAN, p.getEquipment().getItemInMainHand().getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.MARKSMAN, p.getEquipment().getItemInMainHand()))/100; headshotvaly+=headshotvaly*ArtifactAbility.calculateValue(ArtifactAbility.MARKSMAN, p.getEquipment().getItemInMainHand().getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.MARKSMAN, p.getEquipment().getItemInMainHand()))/100;
headshotvalz+=headshotvalz*ArtifactAbility.calculateValue(ArtifactAbility.MARKSMAN, p.getEquipment().getItemInMainHand().getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.MARKSMAN, p.getEquipment().getItemInMainHand()))/100; headshotvalz+=headshotvalz*ArtifactAbility.calculateValue(ArtifactAbility.MARKSMAN, p.getEquipment().getItemInMainHand().getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.MARKSMAN, p.getEquipment().getItemInMainHand()))/100;
} }
if (GenericFunctions.isRanger(p)) {
if (p.getLocation().distanceSquared(m.getLocation())>=64 || GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.CLOSE) {
headshotvalx*=4;
headshotvaly*=6;
headshotvalz*=4;
}
if (GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.SNIPE) {
headshotvalx*=3;
headshotvaly*=12;
headshotvalz*=3;
}
}
log(headshotvalx+","+headshotvaly+","+headshotvalz,5); log(headshotvalx+","+headshotvaly+","+headshotvalz,5);
if (ev.getDamager().getTicksLived()>=4) { if (ev.getDamager().getTicksLived()>=4 || GenericFunctions.isRanger(p)) {
if (Math.abs(arrowLoc.getY()-monsterHead.getY())<=headshotvaly) { if (Math.abs(arrowLoc.getY()-monsterHead.getY())<=headshotvaly) {
log("Height discrepancy is good.",5);
log("Height discrepancy is good.",5);
if (Math.abs(arrowLoc.getZ()-monsterHead.getZ())<=headshotvalz && if (Math.abs(arrowLoc.getZ()-monsterHead.getZ())<=headshotvalz &&
Math.abs(arrowLoc.getX()-monsterHead.getX())<=headshotvalx) { Math.abs(arrowLoc.getX()-monsterHead.getX())<=headshotvalx) {
ev.setDamage(ev.getDamage()*2.0);
p.sendMessage(ChatColor.DARK_RED+"Headshot! x2 Damage"); if (GenericFunctions.isRanger(p) && GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.SNIPE) {
ev.setDamage(ev.getDamage()*4.0);
p.sendMessage(ChatColor.DARK_RED+"Headshot! x4 Damage");
p.playSound(p.getLocation(), Sound.ENTITY_LIGHTNING_IMPACT, 0.2f, 0.24f);
} else {
ev.setDamage(ev.getDamage()*2.0);
p.sendMessage(ChatColor.DARK_RED+"Headshot! x2 Damage");
}
headshot=true; headshot=true;
} }
} }
} }
if (GenericFunctions.isRanger(p) &&
GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.DEBILITATION) {
if (headshot && m.hasPotionEffect(PotionEffectType.BLINDNESS)) {
//Add to the current stack of BLINDNESS.
for (int i1=0;i1<m.getActivePotionEffects().size();i1++) {
if (Iterables.get(m.getActivePotionEffects(), i1).getType().equals(PotionEffectType.BLINDNESS)) {
int lv = Iterables.get(m.getActivePotionEffects(), i1).getAmplifier();
log("New BLINDNESS level: "+lv,2);
p.playSound(p.getLocation(), Sound.ENTITY_RABBIT_ATTACK, 0.1f, 0.1f+((lv+1)*0.5f));
m.removePotionEffect(PotionEffectType.BLINDNESS);
m.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS,400,lv+1));
break;
}
}
} else {
m.removePotionEffect(PotionEffectType.BLINDNESS);
m.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS,400,0));
p.playSound(p.getLocation(), Sound.ENTITY_RABBIT_ATTACK, 0.1f, 0.1f);
}
}
log("Base damage is now "+ev.getDamage(),5); log("Base damage is now "+ev.getDamage(),5);
double truedmg = 0; double truedmg = 0;
@ -4045,7 +4202,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
GenericFunctions.isArtifactWeapon(p.getEquipment().getItemInMainHand())) { GenericFunctions.isArtifactWeapon(p.getEquipment().getItemInMainHand())) {
log("EXP ratio is "+ratio,5); log("EXP ratio is "+ratio,5);
PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId()); PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId());
pd.nextarrowxp=(int)(ratio*20)+5+(headshot?10:0); pd.nextarrowxp+=(int)(ratio*20)+5+(headshot?10:0);
} }
//Artifact armor will receive a tiny bit of EXP. //Artifact armor will receive a tiny bit of EXP.
@ -4104,6 +4261,16 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (ms!=null && (ms.GetTarget() instanceof Player)) { if (ms!=null && (ms.GetTarget() instanceof Player)) {
Player p = (Player)ms.GetTarget(); Player p = (Player)ms.GetTarget();
if (p!=null && p.isOnline()) { if (p!=null && p.isOnline()) {
if (GenericFunctions.isArtifactEquip(p.getEquipment().getItemInMainHand()) &&
GenericFunctions.isArtifactWeapon(p.getEquipment().getItemInMainHand()) &&
p.getEquipment().getItemInMainHand().getType()==Material.BOW) {
PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId());
if (pd.nextarrowxp>0) {
AwakenedArtifact.addPotentialEXP(p.getEquipment().getItemInMainHand(), pd.nextarrowxp, p);
pd.nextarrowxp=0;
}
}
PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId()); PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId());
dropmult+=pd.partybonus*0.33; //Party bonus increases drop rate by 33% per party member. dropmult+=pd.partybonus*0.33; //Party bonus increases drop rate by 33% per party member.
ItemStack item = p.getEquipment().getItemInMainHand(); ItemStack item = p.getEquipment().getItemInMainHand();
@ -4152,6 +4319,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
int unluckmult = 0; int unluckmult = 0;
ms = (MonsterStructure)monsterdata.get(m.getUniqueId()); ms = (MonsterStructure)monsterdata.get(m.getUniqueId());
Player p = (Player)ms.GetTarget(); Player p = (Player)ms.GetTarget();
boolean isRanger=GenericFunctions.isRanger(p);
if (p.hasPotionEffect(PotionEffectType.LUCK) || if (p.hasPotionEffect(PotionEffectType.LUCK) ||
p.hasPotionEffect(PotionEffectType.UNLUCK)) { p.hasPotionEffect(PotionEffectType.UNLUCK)) {
for (int i=0;i<p.getActivePotionEffects().size();i++) { for (int i=0;i<p.getActivePotionEffects().size();i++) {
@ -4176,7 +4346,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
droplist.remove(i); droplist.remove(i);
i--; i--;
} }
droplist.addAll(MonsterController.getMonsterDifficulty((Monster)ev.getEntity()).RandomizeDrops(dropmult, isBoss)); droplist.addAll(MonsterController.getMonsterDifficulty((Monster)ev.getEntity()).RandomizeDrops(dropmult, isBoss, isRanger));
final List<ItemStack> drop = new ArrayList<ItemStack>(); final List<ItemStack> drop = new ArrayList<ItemStack>();
drop.addAll(droplist); drop.addAll(droplist);
@ -4266,6 +4436,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (p!=null) { if (p!=null) {
p.getScoreboard().getTeam(p.getName().toLowerCase()).setSuffix(createHealthbar(((p.getHealth())/p.getMaxHealth())*100,p)); p.getScoreboard().getTeam(p.getName().toLowerCase()).setSuffix(createHealthbar(((p.getHealth())/p.getMaxHealth())*100,p));
setPlayerMaxHealth(p); setPlayerMaxHealth(p);
p.getScoreboard().getTeam(p.getName().toLowerCase()).setPrefix(GenericFunctions.PlayerModePrefix(p));
} }
}} }}
,5); ,5);
@ -4291,6 +4462,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public void run() { public void run() {
if (p!=null) { if (p!=null) {
p.getScoreboard().getTeam(p.getName().toLowerCase()).setSuffix(createHealthbar(((p.getHealth())/p.getMaxHealth())*100,p)); p.getScoreboard().getTeam(p.getName().toLowerCase()).setSuffix(createHealthbar(((p.getHealth())/p.getMaxHealth())*100,p));
p.getScoreboard().getTeam(p.getName().toLowerCase()).setPrefix(GenericFunctions.PlayerModePrefix(p));
} }
}} }}
,2); ,2);
@ -4387,7 +4559,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
GenericFunctions.RemovePermEnchantmentChance(p.getEquipment().getItemInMainHand(), p); GenericFunctions.RemovePermEnchantmentChance(p.getEquipment().getItemInMainHand(), p);
if (ArtifactAbility.containsEnchantment(ArtifactAbility.EARTHWAVE, p.getEquipment().getItemInMainHand()) && if (ArtifactAbility.containsEnchantment(ArtifactAbility.EARTHWAVE, p.getEquipment().getItemInMainHand()) &&
pd.target!=null && !pd.target.isDead() && pd.last_shovelspell<getServerTickTime()) { pd.target!=null && !pd.target.isDead() && pd.last_shovelspell<getServerTickTime()) {
if (pd.target.getLocation().distanceSquared(p.getLocation())<=256) { if (pd.target.getLocation().getWorld().equals(p.getWorld()) && pd.target.getLocation().distanceSquared(p.getLocation())<=256) {
final Player p1 = p; final Player p1 = p;
AreaEffectCloud lp = (AreaEffectCloud)p.getWorld().spawnEntity(p.getLocation(), EntityType.AREA_EFFECT_CLOUD); AreaEffectCloud lp = (AreaEffectCloud)p.getWorld().spawnEntity(p.getLocation(), EntityType.AREA_EFFECT_CLOUD);
lp.setColor(Color.OLIVE); lp.setColor(Color.OLIVE);
@ -4608,7 +4780,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
ItemStack armor = ev.getItem().getItemStack(); ItemStack armor = ev.getItem().getItemStack();
//See if this armor type is not being worn by the player. //See if this armor type is not being worn by the player.
if (armor.getType().toString().contains("BOOTS") && if (armor.getType().toString().contains("BOOTS") &&
p.getEquipment().getBoots()==null) { p.getEquipment().getBoots()==null &&
(!GenericFunctions.isRanger(p) || (armor.getType().toString().contains("LEATHER")))) {
p.getEquipment().setBoots(armor); p.getEquipment().setBoots(armor);
p.sendMessage(ChatColor.DARK_AQUA+"Automatically equipped "+ChatColor.YELLOW+(ev.getItem().getItemStack().getItemMeta().hasDisplayName()?ev.getItem().getItemStack().getItemMeta().getDisplayName():GenericFunctions.UserFriendlyMaterialName(ev.getItem().getItemStack()))); p.sendMessage(ChatColor.DARK_AQUA+"Automatically equipped "+ChatColor.YELLOW+(ev.getItem().getItemStack().getItemMeta().hasDisplayName()?ev.getItem().getItemStack().getItemMeta().getDisplayName():GenericFunctions.UserFriendlyMaterialName(ev.getItem().getItemStack())));
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_PICKUP, 1.0f, 1.0f); p.playSound(p.getLocation(), Sound.ENTITY_ITEM_PICKUP, 1.0f, 1.0f);
@ -4616,7 +4789,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
ev.setCancelled(true); ev.setCancelled(true);
} else } else
if (armor.getType().toString().contains("LEGGINGS") && if (armor.getType().toString().contains("LEGGINGS") &&
p.getEquipment().getLeggings()==null) { p.getEquipment().getLeggings()==null &&
(!GenericFunctions.isRanger(p) || (armor.getType().toString().contains("LEATHER")))) {
p.getEquipment().setLeggings(armor); p.getEquipment().setLeggings(armor);
p.sendMessage(ChatColor.DARK_AQUA+"Automatically equipped "+ChatColor.YELLOW+(ev.getItem().getItemStack().getItemMeta().hasDisplayName()?ev.getItem().getItemStack().getItemMeta().getDisplayName():GenericFunctions.UserFriendlyMaterialName(ev.getItem().getItemStack()))); p.sendMessage(ChatColor.DARK_AQUA+"Automatically equipped "+ChatColor.YELLOW+(ev.getItem().getItemStack().getItemMeta().hasDisplayName()?ev.getItem().getItemStack().getItemMeta().getDisplayName():GenericFunctions.UserFriendlyMaterialName(ev.getItem().getItemStack())));
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_PICKUP, 1.0f, 1.0f); p.playSound(p.getLocation(), Sound.ENTITY_ITEM_PICKUP, 1.0f, 1.0f);
@ -4624,7 +4798,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
ev.setCancelled(true); ev.setCancelled(true);
} else } else
if (armor.getType().toString().contains("CHESTPLATE") && if (armor.getType().toString().contains("CHESTPLATE") &&
p.getEquipment().getChestplate()==null) { p.getEquipment().getChestplate()==null &&
(!GenericFunctions.isRanger(p) || (armor.getType().toString().contains("LEATHER")))) {
p.getEquipment().setChestplate(armor); p.getEquipment().setChestplate(armor);
p.sendMessage(ChatColor.DARK_AQUA+"Automatically equipped "+ChatColor.YELLOW+(ev.getItem().getItemStack().getItemMeta().hasDisplayName()?ev.getItem().getItemStack().getItemMeta().getDisplayName():GenericFunctions.UserFriendlyMaterialName(ev.getItem().getItemStack()))); p.sendMessage(ChatColor.DARK_AQUA+"Automatically equipped "+ChatColor.YELLOW+(ev.getItem().getItemStack().getItemMeta().hasDisplayName()?ev.getItem().getItemStack().getItemMeta().getDisplayName():GenericFunctions.UserFriendlyMaterialName(ev.getItem().getItemStack())));
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_PICKUP, 1.0f, 1.0f); p.playSound(p.getLocation(), Sound.ENTITY_ITEM_PICKUP, 1.0f, 1.0f);
@ -4632,7 +4807,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
ev.setCancelled(true); ev.setCancelled(true);
} else } else
if (armor.getType().toString().contains("HELMET") && if (armor.getType().toString().contains("HELMET") &&
p.getEquipment().getHelmet()==null) { p.getEquipment().getHelmet()==null &&
(!GenericFunctions.isRanger(p) || (armor.getType().toString().contains("LEATHER")))) {
p.getEquipment().setHelmet(armor); p.getEquipment().setHelmet(armor);
p.sendMessage(ChatColor.DARK_AQUA+"Automatically equipped "+ChatColor.YELLOW+(ev.getItem().getItemStack().getItemMeta().hasDisplayName()?ev.getItem().getItemStack().getItemMeta().getDisplayName():GenericFunctions.UserFriendlyMaterialName(ev.getItem().getItemStack()))); p.sendMessage(ChatColor.DARK_AQUA+"Automatically equipped "+ChatColor.YELLOW+(ev.getItem().getItemStack().getItemMeta().hasDisplayName()?ev.getItem().getItemStack().getItemMeta().getDisplayName():GenericFunctions.UserFriendlyMaterialName(ev.getItem().getItemStack())));
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_PICKUP, 1.0f, 1.0f); p.playSound(p.getLocation(), Sound.ENTITY_ITEM_PICKUP, 1.0f, 1.0f);
@ -4641,7 +4817,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} else } else
if (armor.getType().toString().contains("SHIELD") && if (armor.getType().toString().contains("SHIELD") &&
p.getInventory().getExtraContents()[0]==null && p.getInventory().getExtraContents()[0]==null &&
!GenericFunctions.isStriker(p)) { !GenericFunctions.isStriker(p) &&
(!GenericFunctions.isRanger(p) || (armor.getType().toString().contains("LEATHER")))) {
p.getInventory().setExtraContents(new ItemStack[]{armor}); p.getInventory().setExtraContents(new ItemStack[]{armor});
p.sendMessage(ChatColor.DARK_AQUA+"Automatically equipped "+ChatColor.YELLOW+(ev.getItem().getItemStack().getItemMeta().hasDisplayName()?ev.getItem().getItemStack().getItemMeta().getDisplayName():GenericFunctions.UserFriendlyMaterialName(ev.getItem().getItemStack()))); p.sendMessage(ChatColor.DARK_AQUA+"Automatically equipped "+ChatColor.YELLOW+(ev.getItem().getItemStack().getItemMeta().hasDisplayName()?ev.getItem().getItemStack().getItemMeta().getDisplayName():GenericFunctions.UserFriendlyMaterialName(ev.getItem().getItemStack())));
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_PICKUP, 1.0f, 1.0f); p.playSound(p.getLocation(), Sound.ENTITY_ITEM_PICKUP, 1.0f, 1.0f);
@ -4692,30 +4869,36 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
} }
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
public void onArrowShoot(ProjectileLaunchEvent ev) {
if (ev.getEntity() instanceof Arrow) {
Arrow arr = (Arrow)ev.getEntity();
if (arr.getShooter() instanceof Player) {
Player p = (Player)arr.getShooter();
if (GenericFunctions.isRanger(p)) {
arr.setVelocity(arr.getVelocity().multiply(4));
//p.getWorld().spawnArrow(arr.getLocation(), arr.getLocation().getDirection(), 20, 1);
}
}
}
}
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true) @EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
public void onArrowShot(EntityShootBowEvent ev) { public void onArrowShot(EntityShootBowEvent ev) {
//Check if it's a player. //Check if it's a player.
if (ev.getEntityType()==EntityType.PLAYER &&
GenericFunctions.isArtifactEquip(ev.getEntity().getEquipment().getItemInMainHand()) &&
GenericFunctions.isArtifactWeapon(ev.getEntity().getEquipment().getItemInMainHand())) {
Player p = (Player)ev.getEntity();
PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId());
if (pd.nextarrowxp>0) {
AwakenedArtifact.addPotentialEXP(p.getEquipment().getItemInMainHand(), pd.nextarrowxp, p);
pd.nextarrowxp=0;
}
}
if (ev.getEntityType()==EntityType.PLAYER && if (ev.getEntityType()==EntityType.PLAYER &&
(ev.getProjectile().getType()==EntityType.ARROW || (ev.getProjectile().getType()==EntityType.ARROW ||
ev.getProjectile().getType()==EntityType.TIPPED_ARROW)) { ev.getProjectile().getType()==EntityType.TIPPED_ARROW)) {
//Now we know this is a player who shot a regular old arrow. //Now we know this is a player who shot a regular old arrow.
//We need to give one back to them.
final Player p = (Player)ev.getEntity(); final Player p = (Player)ev.getEntity();
//We need to give one back to them.
if (ev.getProjectile().getType()==EntityType.ARROW) { if (ev.getProjectile().getType()==EntityType.ARROW) {
//This was an arrow quiver. We need to verify that, check the player's inventory for one. //This was an arrow quiver. We need to verify that, check the player's inventory for one.
//Then queue a delayed event to add it back in if it's gone next tick. //Then queue a delayed event to add it back in if it's gone next tick.
if (playerHasArrowQuiver(p)) { if (playerHasArrowQuiver(p)) {
log("A tipped arrow was shot. This could've been the arrow quiver. We will verify in 5 ticks.",5); log("A tipped arrow was shot. This could've been the arrow quiver. We will verify in 1 tick.",5);
final int ArrowQuiver_amt = playerGetArrowQuiverAmt(p,playerGetArrowQuiver(p)); final int ArrowQuiver_amt = playerGetArrowQuiverAmt(p,playerGetArrowQuiver(p));
boolean temp=false; //Check if it went in the off-hand slot. If so, put it back there. boolean temp=false; //Check if it went in the off-hand slot. If so, put it back there.
if (p.getInventory().getItemInOffHand().equals(p.getInventory().getItem(playerGetArrowQuiver(p)))) { if (p.getInventory().getItemInOffHand().equals(p.getInventory().getItem(playerGetArrowQuiver(p)))) {
@ -4750,7 +4933,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
} }
}} }}
,5); ,1);
} }
} }
@ -5401,7 +5584,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
return str.matches("-?\\d+(\\.\\d+)?"); //match a number with optional '-' and decimal. return str.matches("-?\\d+(\\.\\d+)?"); //match a number with optional '-' and decimal.
} }
public String createHealthbar(double pcthp, Player p) { public static String createHealthbar(double pcthp, Player p) {
//IF YOU EVER UPDATE THIS YOU MUST UPDATE THE PLAYERDEATHEVENT DEATH MSG METHOD!!!! //IF YOU EVER UPDATE THIS YOU MUST UPDATE THE PLAYERDEATHEVENT DEATH MSG METHOD!!!!
//Heart character: 2665 //Heart character: 2665
/*String bar = ChatColor.AQUA+" "; /*String bar = ChatColor.AQUA+" ";
@ -5461,6 +5644,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
String bar = " "; String bar = " ";
int length = 0; int length = 0;
if (pcthp==100) {bar += ((isHungry)?ChatColor.BLUE:ChatColor.AQUA)+""+Math.round(p.getHealth())+""+Character.toString((char)0x2665);} else
if (pcthp>66) {bar += ((isHungry)?ChatColor.DARK_GREEN:ChatColor.GREEN)+""+Math.round(p.getHealth())+""+Character.toString((char)0x2665);} if (pcthp>66) {bar += ((isHungry)?ChatColor.DARK_GREEN:ChatColor.GREEN)+""+Math.round(p.getHealth())+""+Character.toString((char)0x2665);}
else if (pcthp>33) {bar += ((isHungry)?ChatColor.GOLD:ChatColor.YELLOW)+""+Math.round(p.getHealth())+""+Character.toString((char)0x2665);} else if (pcthp>33) {bar += ((isHungry)?ChatColor.GOLD:ChatColor.YELLOW)+""+Math.round(p.getHealth())+""+Character.toString((char)0x2665);}
else {bar += ((isHungry)?ChatColor.DARK_RED:ChatColor.RED)+""+Math.round(p.getHealth())+""+Character.toString((char)0x2665);} else {bar += ((isHungry)?ChatColor.DARK_RED:ChatColor.RED)+""+Math.round(p.getHealth())+""+Character.toString((char)0x2665);}
@ -5685,7 +5869,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
} }
public void setPlayerMaxHealth(Player p) { public static void setPlayerMaxHealth(Player p) {
//Determine player max HP based on armor being worn. //Determine player max HP based on armor being worn.
double hp=10; //Get the base max health. double hp=10; //Get the base max health.
//Get all equips. //Get all equips.
@ -5758,6 +5942,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
} }
if (GenericFunctions.HasFullRangerSet(p)) {
hp += 20;
}
hp*=maxdeduction; hp*=maxdeduction;
if (p.getHealth()>=hp) { if (p.getHealth()>=hp) {
@ -5772,6 +5960,20 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public void updateTitle(final Player p, boolean headshot, boolean preemptive) {
if (preemptive) {
updateTitle(p,ChatColor.BLUE+"!");
/*
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
updateTitle(p);
}
},15);*/
} else {
updateTitle(p, headshot);
}
}
public void updateTitle(final Player p, boolean headshot) { public void updateTitle(final Player p, boolean headshot) {
if (headshot) { if (headshot) {
@ -5797,7 +5999,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
final PlayerStructure pd2=pd; final PlayerStructure pd2=pd;
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() { public void run() {
if (Bukkit.getPlayer(pd2.name)!=null) { if (Bukkit.getPlayer(pd2.name)!=null && pd2.target!=null) {
String MonsterName = pd2.target.getType().toString().toLowerCase(); String MonsterName = pd2.target.getType().toString().toLowerCase();
if (pd2.target.getCustomName()!=null) { if (pd2.target.getCustomName()!=null) {
MonsterName = pd2.target.getCustomName(); MonsterName = pd2.target.getCustomName();
@ -5972,9 +6174,13 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
boolean striker=false; boolean striker=false;
boolean ranger=false;
if ((p instanceof Player) && GenericFunctions.isStriker((Player)p)) { if ((p instanceof Player) && GenericFunctions.isStriker((Player)p)) {
striker=true; striker=true;
} }
if ((p instanceof Player) && GenericFunctions.isRanger((Player)p)) {
ranger=true;
}
int partylevel = 0; int partylevel = 0;
@ -6090,7 +6296,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
*(1 + 0.1*partylevel) *(1 + 0.1*partylevel)
*(1 + 0.1*strengthlevel) *(1 + 0.1*strengthlevel)
*((10-weaknesslevel)*0.1) *((10-weaknesslevel)*0.1)
*((striker)?1.1:1); *((striker)?1.1:1)
*((ranger)?4.0:1);
return finalamt; return finalamt;
} }
@ -6120,6 +6327,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
int resistlevel = 0; int resistlevel = 0;
int partylevel = 0; int partylevel = 0;
if (target instanceof Player) {
if (GenericFunctions.HasFullRangerSet((Player)target)) {
dmgreduction+=20.0;
}
}
for (int i=0;i<armor.length;i++) { for (int i=0;i<armor.length;i++) {
if (armor[i]!=null) { if (armor[i]!=null) {
//Check for Protection enchantment. //Check for Protection enchantment.
@ -6188,6 +6401,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
} }
//Check for resistance effect. //Check for resistance effect.
Collection<PotionEffect> target_effects = target.getActivePotionEffects(); Collection<PotionEffect> target_effects = target.getActivePotionEffects();
for (int i=0;i<target_effects.size();i++) { for (int i=0;i<target_effects.size();i++) {
@ -6395,6 +6609,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
DecimalFormat df = new DecimalFormat("0.0"); DecimalFormat df = new DecimalFormat("0.0");
p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Base Damage: "+ChatColor.RESET+""+ChatColor.DARK_PURPLE+df.format(store2)); 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+"Damage Reduction: "+ChatColor.RESET+""+ChatColor.DARK_AQUA+df.format((1.0-store1)*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));
p.spigot().sendMessage(f);
TextComponent msg = DisplayPerks(p.getEquipment().getItemInMainHand(),"Weapon",p,0);if (!msg.toPlainText().equalsIgnoreCase("")) {p.spigot().sendMessage(msg);}; TextComponent msg = DisplayPerks(p.getEquipment().getItemInMainHand(),"Weapon",p,0);if (!msg.toPlainText().equalsIgnoreCase("")) {p.spigot().sendMessage(msg);};
msg = DisplayPerks(p.getEquipment().getHelmet(),"Helmet",p,903);if (!msg.toPlainText().equalsIgnoreCase("")) {p.spigot().sendMessage(msg);}; msg = DisplayPerks(p.getEquipment().getHelmet(),"Helmet",p,903);if (!msg.toPlainText().equalsIgnoreCase("")) {p.spigot().sendMessage(msg);};
msg = DisplayPerks(p.getEquipment().getChestplate(),"Chestplate",p,902);if (!msg.toPlainText().equalsIgnoreCase("")) {p.spigot().sendMessage(msg);}; msg = DisplayPerks(p.getEquipment().getChestplate(),"Chestplate",p,902);if (!msg.toPlainText().equalsIgnoreCase("")) {p.spigot().sendMessage(msg);};