Artifact Update, with approximately half the intended features included.
A few bugfixes and localization fixes and many artifact upgrades implemented.
This commit is contained in:
parent
727030e2cd
commit
71349af914
Binary file not shown.
@ -82,3 +82,8 @@ commands:
|
||||
usage: /awakenedartifact
|
||||
permission: TwosideKeeper.money
|
||||
permission-message: No permissions!
|
||||
awakenedartifact_ability:
|
||||
description: Apply an awakened artifact ability to an item.
|
||||
usage: /awakenedartifact_ability <ABILITY> <level>
|
||||
permission: TwosideKeeper.artifact
|
||||
permission-message: No permissions!
|
@ -67,9 +67,10 @@ public class AutoUpdatePlugin implements Runnable {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (plugins.get(i).hash==null || !md5.equalsIgnoreCase(plugins.get(i).hash)) {
|
||||
if ((plugins.get(i).hash==null || !md5.equalsIgnoreCase(plugins.get(i).hash)) && !TwosideKeeper.restarting_server) {
|
||||
//This plugin is different! Update the hash for it. Prepare for a restart of the server!
|
||||
restarting=true;
|
||||
TwosideKeeper.restarting_server=true;
|
||||
//Save the new plugin hash.
|
||||
plugins.get(i).hash = md5;
|
||||
SaveHash(plugins.get(i));
|
||||
|
@ -62,7 +62,7 @@ public class AwakenedArtifact {
|
||||
List<String> lore = m.getLore();
|
||||
DecimalFormat df = new DecimalFormat("00");
|
||||
lore.set(3, ChatColor.YELLOW+"EXP"+ChatColor.RESET+" ["+drawEXPMeter(amt)+"] "+df.format((((double)amt/1000)*100))+"%"); //Update the EXP bar.
|
||||
lore.set(4, ChatColor.BLUE+" ("+amt+"/1000) "+"Potential: "+drawPotential(artifact));
|
||||
lore.set(4, ChatColor.BLUE+" ("+amt+"/1000) "+"Potential: "+drawPotential(artifact,getPotential(artifact)));
|
||||
m.setLore(lore);
|
||||
artifact.setItemMeta(m);
|
||||
return artifact;
|
||||
@ -72,25 +72,33 @@ public class AwakenedArtifact {
|
||||
}
|
||||
public static ItemStack addEXP(ItemStack artifact, int amt, Player p) {
|
||||
int totalval = getEXP(artifact)+amt;
|
||||
if (totalval>1000) {
|
||||
if (totalval>=1000) {
|
||||
//LEVEL UP!
|
||||
if (getLV(artifact)<999) {
|
||||
if (getLV(artifact)<1000) {
|
||||
ItemStack item = addLV(artifact,totalval/1000, p);
|
||||
item = setEXP(item,totalval%1000);
|
||||
item = addAP(item,1);
|
||||
if (getPotential(item)>10) {
|
||||
item = addPotential(item,-getPotential(item)/10);
|
||||
} else {
|
||||
if (Math.random()<=getPotential(item)/10.0d) {
|
||||
item = addPotential(item,-1);
|
||||
}
|
||||
}
|
||||
p.sendMessage("Your "+artifact.getItemMeta().getDisplayName()+ChatColor.RESET+" has upgraded to "+ChatColor.YELLOW+"Level "+getLV(artifact)+"!");
|
||||
p.sendMessage("You have "+getAP(item)+" Ability Point"+((getAP(item)==1)?"":"s")+" to spend!");
|
||||
|
||||
TextComponent tc = new TextComponent("Click ");
|
||||
/*TextComponent tc = new TextComponent("Click ");
|
||||
TextComponent ac = new TextComponent(ChatColor.GREEN+"[HERE]"+ChatColor.WHITE);
|
||||
ac.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,new ComponentBuilder(ChatColor.ITALIC+"Click to add another skill point!").create()));
|
||||
ac.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND,"/awakenedartifact"));
|
||||
tc.addExtra(ac);
|
||||
tc.addExtra(" to open up the ability upgrade menu.");
|
||||
p.spigot().sendMessage(tc);
|
||||
p.spigot().sendMessage(tc);*/
|
||||
p.spigot().sendMessage(ArtifactAbility.GenerateMenu(ArtifactItemType.getArtifactItemTypeFromItemStack(p.getInventory().getItem(GenericFunctions.CalculateSlot(artifact,p))).getUpgradePath(), TwosideKeeper.CalculateWeaponDamage(p,null), artifact,GenericFunctions.CalculateSlot(artifact,p)));
|
||||
return item;
|
||||
} else {
|
||||
return artifact;
|
||||
return setEXP(artifact,totalval);
|
||||
}
|
||||
} else {
|
||||
return setEXP(artifact,totalval);
|
||||
@ -166,14 +174,41 @@ public class AwakenedArtifact {
|
||||
public static ItemStack addLV(ItemStack artifact, int amt, Player p) {
|
||||
return setLV(artifact,getLV(artifact)+amt,p);
|
||||
}
|
||||
public static int getPotential(ItemStack artifact) {
|
||||
if (GenericFunctions.isArtifactEquip(artifact)) {
|
||||
ItemMeta m = artifact.getItemMeta();
|
||||
List<String> lore = m.getLore();
|
||||
String potentialline = lore.get(4);
|
||||
return Integer.parseInt(ChatColor.stripColor(potentialline.split("Potential: ")[1].replace("%", "")));
|
||||
} else {
|
||||
TwosideKeeper.log("Could not get the Potential value for artifact "+artifact.toString(), 1);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
public static ItemStack addPotential(ItemStack artifact, int amt) {
|
||||
if (GenericFunctions.isArtifactEquip(artifact)) {
|
||||
ItemMeta m = artifact.getItemMeta();
|
||||
List<String> lore = m.getLore();
|
||||
int potential = getPotential(artifact)+amt;
|
||||
String potentialline = lore.get(4).split("Potential: ")[0]+"Potential: "+drawPotential(artifact,potential);
|
||||
lore.set(4, potentialline);
|
||||
m.setLore(lore);
|
||||
artifact.setItemMeta(m);
|
||||
return artifact;
|
||||
} else {
|
||||
TwosideKeeper.log("Could not get the Potential value for artifact "+artifact.toString(), 1);
|
||||
return artifact;
|
||||
}
|
||||
}
|
||||
public static ItemStack addPotentialEXP(ItemStack artifact,int exp,Player p) {
|
||||
//Adds experience, but only based on the potential of the item.
|
||||
if (GenericFunctions.isArtifactEquip(artifact)) {
|
||||
int missingdurability = artifact.getDurability();
|
||||
if (missingdurability!=0) {
|
||||
double mult = Math.min(10d/missingdurability, 1);
|
||||
double mult = getPotential(artifact)/100d;
|
||||
//Multiply the value. If it's less than 1, there is only a chance exp will be added.
|
||||
double expadded = exp*mult;
|
||||
TwosideKeeper.log("Added EXP.", 5);
|
||||
if (expadded<1 &&
|
||||
Math.random()<=expadded) {
|
||||
return addEXP(artifact,1,p);
|
||||
@ -187,10 +222,8 @@ public class AwakenedArtifact {
|
||||
return artifact;
|
||||
}
|
||||
}
|
||||
public static String drawPotential(ItemStack artifact) {
|
||||
int missingdurability = artifact.getDurability();
|
||||
double mult = Math.min(10d/missingdurability, 1);
|
||||
int potential = (int)(mult*100);
|
||||
public static String drawPotential(ItemStack artifact, int potentialamt) {
|
||||
int potential = potentialamt;
|
||||
ChatColor color = null;
|
||||
if (potential>75) {
|
||||
color = ChatColor.DARK_GREEN;
|
||||
@ -225,7 +258,7 @@ public class AwakenedArtifact {
|
||||
}
|
||||
DecimalFormat df = new DecimalFormat("00");
|
||||
lore.add(ChatColor.YELLOW+"EXP"+ChatColor.RESET+" ["+drawEXPMeter(0)+"] "+df.format(((0d/1000)*100))+"%");
|
||||
lore.add(ChatColor.BLUE+" (0/1000) "+"Potential: "+drawPotential(artifact));
|
||||
lore.add(ChatColor.BLUE+" (0/1000) "+"Potential: "+drawPotential(artifact,100));
|
||||
df = new DecimalFormat("000");
|
||||
lore.add(ChatColor.GRAY+"Level "+df.format(0));
|
||||
lore.add(ChatColor.GOLD+"Ability Points: 0/0");
|
||||
|
@ -7,6 +7,7 @@ import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.WordUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -22,128 +23,131 @@ import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
|
||||
|
||||
public enum ArtifactAbility {
|
||||
//Enum Structure:
|
||||
// "Friendly Name", "Description", base value (per point) (-1 means it's a TEMPORARY ability.), decay value (per point), max level, level requirement (The min level required to get this perk)
|
||||
// "Friendly Name", "Description", base value (per point) (-1 means it's a TEMPORARY ability.), decay value (per point), max level, level requirement (The min level required to get this perk), item type
|
||||
//Temporary abilities: Work for 1 level and wear off afterward.
|
||||
|
||||
//Weapon Abilities
|
||||
DAMAGE("Strike","Improves Base Damage by [VAL]",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1),
|
||||
ARMOR_PEN("Piercing","[VAL]% of your damage is ignored by resistances. ([PENDMG] damage)",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1),
|
||||
EXECUTION("Execute","Deals [VAL] extra damage for every 20% of target's missing health.",new double[]{2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0},
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1),
|
||||
LIFESTEAL("Lifesteal","Heals [VAL]% of the damage dealt to targets back to your health pool.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1),
|
||||
CRITICAL("Critical","[VAL]% chance to deal double damage.",new double[]{2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0},
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1),
|
||||
DAMAGE("Strike","Improves Base Damage by [VAL]",new double[]{1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0},
|
||||
new double[]{1.0,0.9,0.85,0.8,0.75,0.7,0.65,0.6,0.55,0.5},100,1,UpgradePath.BASIC),
|
||||
ARMOR_PEN("Piercing","[VAL]% of your damage is ignored by resistances. ([PENDMG] damage)",new double[]{1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0},
|
||||
new double[]{1.0,1.0,0.9,0.9,0.8,0.8,0.7,0.7,0.6,0.5},100,1,UpgradePath.BASIC),
|
||||
EXECUTION("Execute","Deals [VAL] extra damage for every 20% of target's missing health.",new double[]{0.125,0.25,1.375,0.5,0.625,0.75,0.875,1.0,1.125,1.25},
|
||||
new double[]{1.0,1.0,0.9,0.9,0.8,0.8,0.7,0.7,0.6,0.5},100,1,UpgradePath.BASIC),
|
||||
LIFESTEAL("Lifesteal","Heals [VAL]% of the damage dealt to targets back to your health pool.",new double[]{1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0},
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1,UpgradePath.WEAPON),
|
||||
CRITICAL("Critical","[VAL]% chance to deal critical strikes.",new double[]{2.0,2.25,2.5,2.75,3.0,3.25,3.50,3.75,4.0,4.25},
|
||||
new double[]{1.0,1.0,0.9,0.9,0.8,0.8,0.7,0.7,0.6,0.5},100,1,UpgradePath.WEAPON),
|
||||
CRIT_DMG("Crit Damage","Critical Strikes deal [VAL]% damage.",new double[]{210.0,210.0,210.0,210.0,210.0,210.0,210.0,210.0,210.0,210.0},
|
||||
new double[]{5.0,5.0,5.0,5.0,5.0,5.0,5.0,5.0,5.0,5.0},100,1),
|
||||
PROVOKE("Provoke","Your attacks provoke enemies for [VAL] seconds.",new double[]{3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0},
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,10),
|
||||
HIGHWINDER("Highwinder","While moving, you deal [VAL] extra damage for every 1m of speed.",new double[]{0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5},
|
||||
new double[]{0.7,0.7,0.7,0.7,0.7,0.7,0.7,0.7,0.7,0.7},100,15),
|
||||
COMBO("Belligerent","[VAL]% more damage for each successive strike on a mob. Resets on a failed swing or after 5 seconds of no combat.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,30),
|
||||
new double[]{5.0,5.0,5.0,5.0,5.0,5.0,5.0,5.0,5.0,5.0},100,1,UpgradePath.WEAPON),
|
||||
HIGHWINDER("Highwinder","While moving, you deal [VAL] extra damage for every 1m of speed.",new double[]{0.1,0.125,0.150,0.175,0.2,0.225,0.250,0.275,0.3,0.35},
|
||||
new double[]{0.7,0.675,0.65,0.625,0.6,0.575,0.55,0.525,0.5,0.475},100,15,UpgradePath.WEAPON),
|
||||
|
||||
//Bow Abilities
|
||||
MARKSMAN("Marksman","Increases headshot hitbox size by [VAL]% .",new double[]{8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0,8.0},
|
||||
new double[]{0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8},100,1),
|
||||
MARKSMAN("Marksman","Increases headshot hitbox size by [VAL]% .",new double[]{10.0,15,20,25,30,35,40,45,50,55},
|
||||
new double[]{1.0,0.95,0.9,0.85,0.8,0.75,0.7,0.65,0.6,0.55},10,15,UpgradePath.BOW),
|
||||
SIEGESTANCE("Siege Stance","Activate by Sneaking for three seconds. Sneak again to de-activate.\n\n"
|
||||
+ "Applies Slowness V and Resistance VI. While in Siege Stance you fire clusters of 7 arrows per shot. Each arrow deals [VAL] damage.",new double[]{3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0},
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,20),
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,20,UpgradePath.BOW),
|
||||
ARROWSHOWER("Arrow Shower","Shift-Left Click to activate. Applies Slowness X for three seconds while firing arrows into the sky and onto enemies in a large area in front of you. Each arrow deals [VAL] damage.",new double[]{0.7,0.7,0.7,0.7,0.7,0.7,0.7,0.7,0.7,0.7},
|
||||
new double[]{0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4},100,40),
|
||||
new double[]{0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4},100,40,UpgradePath.BOW),
|
||||
TARGETING("Targeting","Left-click a mob to target them. Fire arrows to release homing missiles at your target. Each missile explodes and deals [VAL] damage.",new double[]{10,10,10,10,10,10,10,10,10,10},
|
||||
new double[]{0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3},100,75),
|
||||
new double[]{0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3},100,75,UpgradePath.BOW),
|
||||
ENDERTURRET("Ender Turret","Place Eyes of Ender in your hotbar to use as ammo. Each eye fired launches forward and upward before releasing a barrage of homing missiles that lock onto enemy targets. Each missile explodes and deals [VAL] damage.",new double[]{25,25,25,25,25,25,25,25,25,25},
|
||||
new double[]{0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5},100,100),
|
||||
new double[]{0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5},100,100,UpgradePath.BOW),
|
||||
|
||||
//Armor abilities
|
||||
DAMAGE_REDUCTION("Defense","Increases Base Damage reduction by [VAL]%",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
|
||||
new double[]{2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0},100,1),
|
||||
HEALTH("Health","Increases Maximum Health by [VAL].",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1),
|
||||
HEALTH_REGEN("Regeneration","Regenerates an extra [VAL] health every 5 seconds.",new double[]{0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5},
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1),
|
||||
STATUS_EFFECT_RESISTANCE("Resistance","When a debuff is applied, there is a [VAL]% chance to remove it.",new double[]{20,20,20,20,20,20,20,20,20,20},
|
||||
new double[]{4.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0},100,1),
|
||||
SHADOWWALKER("Shadow Walker","Increases your speed in dark areas. Damage Reduction increases by [VAL]% in dark areas. Dodge chance increases by [DODGEVAL]% in dark areas.",new double[]{5,5,5,5,5,5,5,5,5,5},
|
||||
new double[]{1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5},100,5),
|
||||
SURVIVOR("Survivor","Taking fatal damage will not kill you and instead consume this ability, removes all debuffs, and leaving you with 1 HP.",new double[]{-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0},
|
||||
new double[]{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0},1,10),
|
||||
DODGE("Dodge","You have a [VAL]% chance to dodge incoming damage from any damage source.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
|
||||
new double[]{3,3,3,3,3,3,3,3,3,3},100,20),
|
||||
GRACEFULDODGE("Graceful Dodge","You have a [VAL]% chance to dodge incoming damage from attacks that deal [FATALDMG] or more damage.",new double[]{10,10,10,10,10,10,10,10,10,10},
|
||||
new double[]{0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8},100,45),
|
||||
DAMAGE_REDUCTION("Defense","Increases Base Damage reduction by [VAL]%",new double[]{1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,5.5},
|
||||
new double[]{2.2,2.1,2.0,1.9,1.8,1.7,1.6,1.5,1.4,1.3},100,1,UpgradePath.ARMOR),
|
||||
HEALTH("Health","Increases Maximum Health by [VAL].",new double[]{0.35,0.70,1.05,1.40,1.70,2.0,2.3,2.6,2.9,3.2},
|
||||
new double[]{1.0,0.95,0.9,0.85,0.8,0.75,0.7,0.75,0.7,0.65},100,1,UpgradePath.ARMOR),
|
||||
HEALTH_REGEN("Regeneration","Regenerates an extra [VAL] health every 5 seconds.",new double[]{0.03125,0.0625,0.09375,0.125,0.15625,0.1875,0.29166666666666666666666666666667,0.33333333333333333333333333333333,0.375,0.41666666666666666666666666666667},
|
||||
new double[]{1.0,0.90,0.85,0.8,0.75,0.7,0.6,0.55,0.5,0.45},100,1,UpgradePath.ARMOR),
|
||||
STATUS_EFFECT_RESISTANCE("Resistance","When a debuff is applied, there is a [VAL]% chance to remove it.",new double[]{3,3.5,4,4.5,5,5.5,6,6.5,7,7.5},
|
||||
new double[]{4.0,3.85,3.70,3.55,3.40,3.25,3.10,2.95,2.80,2.65},100,1,UpgradePath.ARMOR),
|
||||
SHADOWWALKER("Shadow Walker",ChatColor.GRAY+"[Unimplemented] Increases your speed in dark areas. Damage Reduction increases by [VAL]% in dark areas. Dodge chance increases by [DODGEVAL]% in dark areas.",new double[]{5,5,5,5,5,5,5,5,5,5},
|
||||
new double[]{1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5},100,1000,UpgradePath.ARMOR),
|
||||
SURVIVOR("Survivor",ChatColor.GRAY+"[Unimplemented] Taking fatal damage will not kill you and instead consume this ability, removes all debuffs, and leaving you with 1 HP.",new double[]{-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0},
|
||||
new double[]{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0},1,1000,UpgradePath.ARMOR),
|
||||
DODGE("Dodge",ChatColor.GRAY+"[Unimplemented] You have a [VAL]% chance to dodge incoming damage from any damage source.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
|
||||
new double[]{3,3,3,3,3,3,3,3,3,3},100,1000,UpgradePath.ARMOR),
|
||||
GRACEFULDODGE("Graceful Dodge",ChatColor.GRAY+"[Unimplemented] You have a [VAL]% chance to dodge incoming damage from attacks that deal [FATALDMG] or more damage.",new double[]{10,10,10,10,10,10,10,10,10,10},
|
||||
new double[]{0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8},100,1000,UpgradePath.ARMOR),
|
||||
|
||||
//Sword abilities
|
||||
PROVOKE("Provoke",ChatColor.GRAY+"[Unimplemented] Your attacks provoke enemies for [VAL] seconds.",new double[]{3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0},
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1000,UpgradePath.SWORD),
|
||||
COMBO("Belligerent",ChatColor.GRAY+"[Unimplemented] [VAL]% more damage for each successive strike on a mob. Resets on a failed swing or after 5 seconds of no combat.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1000,UpgradePath.SWORD),
|
||||
|
||||
//Pickaxe abilities
|
||||
SCAVENGE("Scavenge","Breaks off resources from armor. [VAL]% chance per hit.",new double[]{5,5,5,5,5,5,5,5,5,5},
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,20),
|
||||
SCAVENGE("Scavenge",ChatColor.GRAY+"[Unimplemented] Breaks off resources from armor. [VAL]% chance per hit.",new double[]{5,5,5,5,5,5,5,5,5,5},
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1000,UpgradePath.PICKAXE),
|
||||
|
||||
//Shovel abilities
|
||||
SUPPRESS("Suppression","Suppresses a mob on hit for [VAL] seconds.\n\n"
|
||||
SUPPRESS("Suppression",ChatColor.GRAY+"[Unimplemented] Suppresses a mob on hit for [VAL] seconds.\n\n"
|
||||
+ "Suppression prevents movement, attacking, and teleportation.",new double[]{0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1},
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,10),
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1000,UpgradePath.SHOVEL),
|
||||
|
||||
//Axe abilities
|
||||
BREAKDOWN("Break Down","Breaks down armor on mobs. Each hit has a [VAL]% chance to remove a piece of armor from a mob.",new double[]{3,3,3,3,3,3,3,3,3,3},
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1),
|
||||
BUTCHERY("Butchery","Broken down armor have a [VAL]% chance to drop onto the ground.",new double[]{10,10,10,10,10,10,10,10,10,10},
|
||||
new double[]{0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8},100,5),
|
||||
BREAKDOWN("Break Down",ChatColor.GRAY+"[Unimplemented] Breaks down armor on mobs. Each hit has a [VAL]% chance to remove a piece of armor from a mob.",new double[]{3,3,3,3,3,3,3,3,3,3},
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1000,UpgradePath.AXE),
|
||||
BUTCHERY("Butchery",ChatColor.GRAY+"[Unimplemented] Broken down armor have a [VAL]% chance to drop onto the ground.",new double[]{10,10,10,10,10,10,10,10,10,10},
|
||||
new double[]{0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8},100,1000,UpgradePath.AXE),
|
||||
|
||||
//Scythe abilities
|
||||
DEATHMARK("Death Mark","Applies a Death Mark stack to a target. Death marks last for 5 seconds, and refresh on each hit.\n\nMarks can be detonated at any time by right-clicking. Each death mark stack applied deals [VAL] damage.",new double[]{0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1},
|
||||
new double[]{0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6},100,10),
|
||||
AOE("Area of Effect","Deals damage to targets up to [VAL]m from the main target hit.",new double[]{0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2},
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1),
|
||||
AOE("Area of Effect",ChatColor.GRAY+"[Unimplemented] Deals damage to targets up to [VAL]m from the main target hit.",new double[]{0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4},
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1000,UpgradePath.SCYTHE),
|
||||
DEATHMARK("Death Mark",ChatColor.GRAY+"[Unimplemented] Applies a Death Mark stack to a target. Death marks last for 5 seconds, and refresh on each hit.\n\nMarks can be detonated at any time by right-clicking. Each death mark stack applied deals [VAL] damage.",new double[]{0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1},
|
||||
new double[]{0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6},100,1000,UpgradePath.SCYTHE),
|
||||
|
||||
//General abilities
|
||||
GREED("Greed","Increases Drop rate by [VAL]% . Health is halved, health regeneration is halved, and damage reduction is halved. Consumes one level of Greed per level up.",new double[]{50,50,50,50,50,50,50,50,50,50},
|
||||
new double[]{2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0},100,10),
|
||||
GROWTH("Growth","Increases artifact EXP gained by [VAL]% . Health is halved, health regeneration is halved, and damage reduction is halved. Consumes one level of Growth per level up.",new double[]{100,100,100,100,100,100,100,100,100,100},
|
||||
new double[]{2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0},100,10),
|
||||
REMOVE_CURSE("Remove Curse","Removes a level of a curse from the Artifact.",new double[]{-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0},
|
||||
new double[]{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0},1,1),
|
||||
PRESERVATION("Preservation","Potential decays [VAL]% slower.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
|
||||
new double[]{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0},1,20),
|
||||
EXP_MULT("Mega XP","Increases experience dropped from monsters by [VAL]% .",new double[]{5,5,5,5,5,5,5,5,5,5},
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,20),
|
||||
GREED("Greed",ChatColor.GRAY+"[Unimplemented] Increases Drop rate by [VAL]% . Health is halved, health regeneration is halved, and damage reduction is halved. Consumes one level of Greed per level up.",new double[]{50,50,50,50,50,50,50,50,50,50},
|
||||
new double[]{2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0},100,1000,UpgradePath.ALL),
|
||||
GROWTH("Growth",ChatColor.GRAY+"[Unimplemented] Increases artifact EXP gained by [VAL]% . Health is halved, health regeneration is halved, and damage reduction is halved. Consumes one level of Growth per level up.",new double[]{100,100,100,100,100,100,100,100,100,100},
|
||||
new double[]{2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0},100,1000,UpgradePath.ALL),
|
||||
REMOVE_CURSE("Remove Curse",ChatColor.GRAY+"[Unimplemented] Removes a level of a curse from the Artifact.",new double[]{-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0},
|
||||
new double[]{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0},1,1000,UpgradePath.ALL),
|
||||
PRESERVATION("Preservation",ChatColor.GRAY+"[Unimplemented] Potential decays [VAL]% slower.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
|
||||
new double[]{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0},20,1000,UpgradePath.ALL),
|
||||
EXP_MULT("Mega XP",ChatColor.GRAY+"[Unimplemented] Increases experience dropped from monsters by [VAL]% .",new double[]{5,5,5,5,5,5,5,5,5,5},
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1000,UpgradePath.ALL),
|
||||
|
||||
//Bad stuff
|
||||
REDUCEDMG("Weakness","[VAL]% Decrease in Base Damage.",new double[]{8,8,8,8,8,8,8,8,8,8},
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,3),
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,3,UpgradePath.ALL),
|
||||
REDUCEDEF("Imperil","[VAL]% Decrease in Damage Reduction",new double[]{8,8,8,8,8,8,8,8,8,8},
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,5),
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,5,UpgradePath.ALL),
|
||||
LIFE_REDUCTION("Health Cut","[VAL]% decrease in maximum health.",new double[]{30,30,30,30,30,30,30,30,30,30},
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,5),
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,5,UpgradePath.ALL),
|
||||
LOWER_DEFENSE("Debilitate","[VAL]% decrease in damage reduction.",new double[]{30,30,30,30,30,30,30,30,30,30},
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,5),
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,5,UpgradePath.ALL),
|
||||
TELEPORT("Teleport","[VAL]% chance to teleport the player to a random location on artifact experience gain.",new double[]{3,3,3,3,3,3,3,3,3,3},
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,10),
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,10,UpgradePath.ALL),
|
||||
DRAINING("Draining","[VAL]% chance to remove a level of experience on artifact experience gain.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,10),
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,10,UpgradePath.ALL),
|
||||
NOREGEN("Weary","No health regenerates.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,15),
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,15,UpgradePath.ALL),
|
||||
STARVATION("Starvation","[VAL]% chance to cause [HUNGERVAL] seconds of Hunger on experience gain.",new double[]{5,5,5,5,5,5,5,5,5,5},
|
||||
new double[]{0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1},100,15),
|
||||
new double[]{0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1},100,15,UpgradePath.ALL),
|
||||
BURN("Flammable","All burn damage deals x[VAL] damage.",new double[]{4.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0},
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,25),
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,25,UpgradePath.ALL),
|
||||
FROZEN("Frozen","Player will be inflicted with increasing levels of slowness and fatigue until finally frozen and killed.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},1,45),
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},1,45,UpgradePath.ALL),
|
||||
PETRIFICATION("Petrification","Player will be inflicted with increasing levels of slowness and fatigue until finally petrified and killed.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},1,45),
|
||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},1,45,UpgradePath.ALL),
|
||||
|
||||
;
|
||||
|
||||
static int LINE_SIZE=50;
|
||||
public static int LINE_SIZE=50;
|
||||
String name;
|
||||
String desc;
|
||||
double[] baseval;
|
||||
double[] decayval;
|
||||
int maxlv;
|
||||
int requirement;
|
||||
UpgradePath upgrade;
|
||||
|
||||
ArtifactAbility(String name, String desc, double[] baseval, double[] decayval, int maxlv, int requirement) {
|
||||
ArtifactAbility(String name, String desc, double[] baseval, double[] decayval, int maxlv, int requirement, UpgradePath upgrade) {
|
||||
this.name=name;
|
||||
this.desc=desc;
|
||||
this.baseval=baseval;
|
||||
@ -152,6 +156,7 @@ public enum ArtifactAbility {
|
||||
this.requirement=requirement;
|
||||
AwakenedArtifact.ability_map.put(this,this.name);
|
||||
AwakenedArtifact.name_map.put(this.name,this);
|
||||
this.upgrade=upgrade;
|
||||
}
|
||||
|
||||
public String GetName() {
|
||||
@ -194,7 +199,7 @@ public enum ArtifactAbility {
|
||||
return sum*ability.GetBaseValue(artifacttier);
|
||||
}
|
||||
|
||||
static HashMap<ArtifactAbility,Integer> getEnchantments(ItemStack item) {
|
||||
public static HashMap<ArtifactAbility,Integer> getEnchantments(ItemStack item) {
|
||||
HashMap<ArtifactAbility,Integer> abilities = new HashMap<ArtifactAbility,Integer>();
|
||||
if (GenericFunctions.isArtifactEquip(item)) {
|
||||
List<String> lore = item.getItemMeta().getLore();
|
||||
@ -229,7 +234,7 @@ public enum ArtifactAbility {
|
||||
}
|
||||
}
|
||||
|
||||
static ItemStack applyEnchantment(ArtifactAbility ability, int lv, ItemStack item) {
|
||||
public static ItemStack applyEnchantment(ArtifactAbility ability, int lv, ItemStack item) {
|
||||
ItemMeta m = item.getItemMeta();
|
||||
List<String> lore = m.getLore();
|
||||
if (containsEnchantment(ability,item)) {
|
||||
@ -272,14 +277,106 @@ public enum ArtifactAbility {
|
||||
}
|
||||
}
|
||||
|
||||
static boolean containsEnchantment(ArtifactAbility ability, ItemStack item) {
|
||||
public static boolean containsEnchantment(ArtifactAbility ability, ItemStack item) {
|
||||
return getEnchantments(item).containsKey(ability);
|
||||
}
|
||||
|
||||
public static boolean isCompatibleWithUpgrade(ItemStack item, UpgradePath upgrade) {
|
||||
TwosideKeeper.log("Checking compatibility with "+upgrade, 4);
|
||||
if (upgrade!=UpgradePath.ALL) {
|
||||
switch (upgrade) {
|
||||
case WEAPON:{
|
||||
if (item.getType().toString().contains("SWORD") ||
|
||||
(item.getType().toString().contains("AXE") && !item.getType().toString().contains("PICKAXE")) ||
|
||||
item.getType().toString().contains("FISHING_ROD") ||
|
||||
item.getType().toString().contains("HOE") ||
|
||||
item.getType().toString().contains("BOW")) {
|
||||
//This is a valid weapon.
|
||||
return true;
|
||||
}
|
||||
}break;
|
||||
case ARMOR:{
|
||||
if (item.getType().toString().contains("HELMET") ||
|
||||
item.getType().toString().contains("CHESTPLATE") ||
|
||||
item.getType().toString().contains("LEGGINGS") ||
|
||||
item.getType().toString().contains("BOOTS")) {
|
||||
//This is a valid armor piece.
|
||||
return true;
|
||||
}
|
||||
}break;
|
||||
case TOOL:{
|
||||
if (item.getType().toString().contains("AXE") ||
|
||||
item.getType().toString().contains("HOE") ||
|
||||
item.getType().toString().contains("SPADE")) {
|
||||
//This is a valid tool.
|
||||
return true;
|
||||
}
|
||||
}break;
|
||||
case SWORD:{
|
||||
if (item.getType().toString().contains("SWORD")) {
|
||||
//This is a valid sword.
|
||||
return true;
|
||||
}
|
||||
}break;
|
||||
case AXE:{
|
||||
if (item.getType().toString().contains("AXE") && !item.getType().toString().contains("PICKAXE")) {
|
||||
//This is a valid axe.
|
||||
return true;
|
||||
}
|
||||
}break;
|
||||
case PICKAXE:{
|
||||
if (item.getType().toString().contains("PICKAXE")) {
|
||||
//This is a valid pickaxe.
|
||||
return true;
|
||||
}
|
||||
}break;
|
||||
case SCYTHE:{
|
||||
if (item.getType().toString().contains("HOE")) {
|
||||
//This is a valid hoe.
|
||||
TwosideKeeper.log("Valid???", 5);
|
||||
return true;
|
||||
}
|
||||
}break;
|
||||
case SHOVEL:{
|
||||
if (item.getType().toString().contains("SPADE")) {
|
||||
//This is a valid shovel.
|
||||
return true;
|
||||
}
|
||||
}break;
|
||||
case BOW:{
|
||||
if (item.getType().toString().contains("BOW")) {
|
||||
//This is a valid bow.
|
||||
return true;
|
||||
}
|
||||
}break;
|
||||
case FISHING_ROD:{
|
||||
if (item.getType().toString().contains("FISHING_ROD")) {
|
||||
//This is a valid fishing rod.
|
||||
return true;
|
||||
}
|
||||
}break;
|
||||
case BASIC:{
|
||||
if (!item.getType().toString().contains("HELMET") &&
|
||||
!item.getType().toString().contains("CHESTPLATE") &&
|
||||
!item.getType().toString().contains("LEGGINGS") &&
|
||||
!item.getType().toString().contains("BOOTS")) {
|
||||
//This is a valid basic piece.
|
||||
return true;
|
||||
}
|
||||
}break;
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static ItemStack upgradeEnchantment(Player p, ItemStack item, ArtifactAbility ability) {
|
||||
//Verifies that the enchantment can be upgraded firstly.
|
||||
//Get the level we are upgrading to.
|
||||
int level = getEnchantmentLevel(ability,item);
|
||||
//Make sure this item is compatible with the enchantment being applied.
|
||||
if (isCompatibleWithUpgrade(item,ability.upgrade)) {
|
||||
if (AwakenedArtifact.getAP(item)>0) {
|
||||
if (ability.GetMaxLevel()>level && ability.GetMinLevel()<=AwakenedArtifact.getLV(item)) {
|
||||
//This is allowed. Proceed.
|
||||
@ -288,13 +385,15 @@ public enum ArtifactAbility {
|
||||
p.sendMessage(ChatColor.AQUA+"Successfully applied "+ChatColor.BLUE+ability.GetName()+" "+(level+1)+ChatColor.AQUA+" to your artifact!");
|
||||
int apamt = AwakenedArtifact.getAP(item);
|
||||
if (apamt>0) {
|
||||
TextComponent tc = new TextComponent(" You have "+ChatColor.GREEN+apamt+ChatColor.WHITE+" ability point"+((apamt==1)?"":"s")+" remaining! Click ");
|
||||
TextComponent tc = new TextComponent(" You have "+ChatColor.GREEN+apamt+ChatColor.WHITE+" ability point"+((apamt==1)?"":"s")+" remaining!");
|
||||
/*TextComponent tc = new TextComponent(" You have "+ChatColor.GREEN+apamt+ChatColor.WHITE+" ability point"+((apamt==1)?"":"s")+" remaining! Click ");
|
||||
TextComponent ac = new TextComponent(ChatColor.GREEN+"[HERE]"+ChatColor.WHITE);
|
||||
ac.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,new ComponentBuilder(ChatColor.ITALIC+"Click to add another skill point!").create()));
|
||||
ac.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND,"/awakenedartifact"));
|
||||
tc.addExtra(ac);
|
||||
tc.addExtra(" to open up the ability upgrade menu.");
|
||||
tc.addExtra(" to open up the ability upgrade menu.");;*/
|
||||
p.spigot().sendMessage(tc);
|
||||
p.spigot().sendMessage(ArtifactAbility.GenerateMenu(ArtifactItemType.getArtifactItemTypeFromItemStack(p.getInventory().getItem(GenericFunctions.CalculateSlot(item,p))).getUpgradePath(), TwosideKeeper.CalculateWeaponDamage(p,null), item,GenericFunctions.CalculateSlot(item,p)));
|
||||
}
|
||||
} else {
|
||||
if (ability.GetMaxLevel()<=level) {
|
||||
@ -306,6 +405,9 @@ public enum ArtifactAbility {
|
||||
} else {
|
||||
p.sendMessage(ChatColor.RED+"Insufficient AP to level up this upgrade! Earn more AP first!");
|
||||
}
|
||||
} else {
|
||||
p.sendMessage(ChatColor.RED+"This upgrade is not compatible with this item!");
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
@ -353,9 +455,47 @@ public enum ArtifactAbility {
|
||||
TextComponent msg1 = new TextComponent("Choose an ability to upgrade "+((targetitem.hasItemMeta() && targetitem.getItemMeta().hasDisplayName())?targetitem.getItemMeta().getDisplayName():GenericFunctions.UserFriendlyMaterialName(targetitem))+ChatColor.RESET+":\n\n");
|
||||
int i=0;
|
||||
TextComponent text = new TextComponent("");
|
||||
switch (path) {
|
||||
//Populate menu lists.
|
||||
case ARMOR:
|
||||
TwosideKeeper.log("Checking path "+path, 5);
|
||||
if (path==UpgradePath.BOW || //Weapon category.
|
||||
path==UpgradePath.WEAPON ||
|
||||
path==UpgradePath.SWORD ||
|
||||
path==UpgradePath.AXE ||
|
||||
path==UpgradePath.FISHING_ROD ||
|
||||
path==UpgradePath.SCYTHE ||
|
||||
path==UpgradePath.BASIC) {
|
||||
text=DisplayAbility(DAMAGE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(ARMOR_PEN,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(EXECUTION,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
if (path!=UpgradePath.BASIC) {
|
||||
text=DisplayAbility(LIFESTEAL,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(CRITICAL,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(CRIT_DMG,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(HIGHWINDER,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
if (path==UpgradePath.SWORD) {
|
||||
text=DisplayAbility(PROVOKE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(COMBO,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
} else
|
||||
if (path==UpgradePath.AXE) {
|
||||
text=DisplayAbility(BREAKDOWN,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(BUTCHERY,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
} else
|
||||
if (path==UpgradePath.FISHING_ROD) {
|
||||
} else
|
||||
if (path==UpgradePath.BOW) {
|
||||
text=DisplayAbility(MARKSMAN,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(SIEGESTANCE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(ARROWSHOWER,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(TARGETING,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(ENDERTURRET,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
} else
|
||||
if (path==UpgradePath.SCYTHE) {
|
||||
text=DisplayAbility(AOE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(DEATHMARK,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
}
|
||||
}
|
||||
} else
|
||||
if (path==UpgradePath.ARMOR //Armor category.
|
||||
) {
|
||||
text=DisplayAbility(DAMAGE_REDUCTION,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(HEALTH,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(HEALTH_REGEN,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
@ -364,49 +504,20 @@ public enum ArtifactAbility {
|
||||
text=DisplayAbility(SURVIVOR,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(DODGE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(GRACEFULDODGE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
break;
|
||||
case BOW:
|
||||
} else
|
||||
if (path==UpgradePath.TOOL || //Tool category.
|
||||
path==UpgradePath.SHOVEL ||
|
||||
path==UpgradePath.PICKAXE
|
||||
) {
|
||||
text=DisplayAbility(DAMAGE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(ARMOR_PEN,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(EXECUTION,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(MARKSMAN,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(CRITICAL,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(CRIT_DMG,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(SIEGESTANCE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(ARROWSHOWER,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(TARGETING,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(ENDERTURRET,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
break;
|
||||
case TOOL:
|
||||
text=DisplayAbility(DAMAGE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(ARMOR_PEN,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(EXECUTION,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(LIFESTEAL,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(CRITICAL,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(CRIT_DMG,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
if (targetitem.getType().toString().contains("PICKAXE")) {
|
||||
text=DisplayAbility(SCAVENGE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
} else if (targetitem.getType().toString().contains("SPADE")) {
|
||||
if (path==UpgradePath.SHOVEL) {
|
||||
text=DisplayAbility(SUPPRESS,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
} else if (targetitem.getType().toString().contains("AXE")) {
|
||||
text=DisplayAbility(BREAKDOWN,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(BUTCHERY,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
} else if (targetitem.getType().toString().contains("HOE")) {
|
||||
text=DisplayAbility(DEATHMARK,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(AOE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
} else
|
||||
if (path==UpgradePath.PICKAXE) {
|
||||
text=DisplayAbility(SCAVENGE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
}
|
||||
break;
|
||||
case WEAPON:
|
||||
text=DisplayAbility(DAMAGE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(ARMOR_PEN,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(EXECUTION,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(LIFESTEAL,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(CRITICAL,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(CRIT_DMG,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(PROVOKE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(HIGHWINDER,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
text=DisplayAbility(COMBO,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
break;
|
||||
}
|
||||
|
||||
text=DisplayAbility(GREED,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||
|
@ -0,0 +1,52 @@
|
||||
package sig.plugin.TwosideKeeper.HelperStructures;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
//NOT USED.
|
||||
public class ArtifactAbilityGroup {
|
||||
public static HashMap<ArtifactAbility,List<ArtifactAbilityGroup>> abilitiesmap = new HashMap();
|
||||
List<ArtifactAbility> abilitylist;
|
||||
List<Material> itemlist;
|
||||
public ArtifactAbilityGroup(Material[] itemlist,ArtifactAbility...abilities) {
|
||||
this.abilitylist = new ArrayList<ArtifactAbility>();
|
||||
if (abilities!=null) {
|
||||
for (int i=0;i<abilities.length;i++) {
|
||||
this.abilitylist.add(abilities[i]);
|
||||
}
|
||||
}
|
||||
this.itemlist = new ArrayList<Material>();
|
||||
if (itemlist!=null) {
|
||||
for (int i=0;i<itemlist.length;i++) {
|
||||
this.itemlist.add(itemlist[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
public ArtifactAbilityGroup() {
|
||||
abilitylist = new ArrayList<ArtifactAbility>();
|
||||
itemlist = new ArrayList<Material>();
|
||||
}
|
||||
|
||||
public boolean isInGroup(ArtifactAbility a) {
|
||||
if (abilitylist.contains(a)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void addToGroup(ArtifactAbility a) {
|
||||
abilitylist.add(a);
|
||||
}
|
||||
public boolean itemIsInGroup(ItemStack item) {
|
||||
if (itemlist.contains(item.getType())) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -11,7 +11,7 @@ import sig.plugin.TwosideKeeper.Artifact;
|
||||
import sig.plugin.TwosideKeeper.TwosideKeeper;
|
||||
|
||||
public enum ArtifactItemType {
|
||||
AXE(0,"AXE",TierType.ALL,UpgradePath.TOOL,new String[]{"EEx","EEx","xEx"},
|
||||
AXE(0,"AXE",TierType.ALL,UpgradePath.AXE,new String[]{"EEx","EEx","xEx"},
|
||||
new ItemStack[]{
|
||||
new ItemStack(Material.GOLD_AXE), //T1
|
||||
new ItemStack(Material.WOOD_AXE), //T2
|
||||
@ -36,7 +36,7 @@ public enum ArtifactItemType {
|
||||
5.0d, //T9
|
||||
6.0d //T10
|
||||
}),
|
||||
SWORD(1,"SWORD",TierType.ALL,UpgradePath.WEAPON,new String[]{"EEE","EEE","EEE"},
|
||||
SWORD(1,"SWORD",TierType.ALL,UpgradePath.SWORD,new String[]{"EEE","EEE","EEE"},
|
||||
new ItemStack[]{
|
||||
new ItemStack(Material.GOLD_SWORD), //T1
|
||||
new ItemStack(Material.WOOD_SWORD), //T2
|
||||
@ -61,7 +61,7 @@ public enum ArtifactItemType {
|
||||
10.0d, //T9
|
||||
12.0d //T10
|
||||
}),
|
||||
PICKAXE(2,"PICKAXE",TierType.ALL,UpgradePath.TOOL,new String[]{"EEE","xEx","xEx"},
|
||||
PICKAXE(2,"PICKAXE",TierType.ALL,UpgradePath.PICKAXE,new String[]{"EEE","xEx","xEx"},
|
||||
new ItemStack[]{
|
||||
new ItemStack(Material.GOLD_PICKAXE), //T1
|
||||
new ItemStack(Material.WOOD_PICKAXE), //T2
|
||||
@ -74,7 +74,7 @@ public enum ArtifactItemType {
|
||||
new ItemStack(Material.DIAMOND_PICKAXE), //T9
|
||||
new ItemStack(Material.DIAMOND_PICKAXE), //T10
|
||||
}),
|
||||
HOE(3,"SCYTHE",TierType.ALL,UpgradePath.TOOL,new String[]{"EEx","xEx","xEx"},
|
||||
HOE(3,"SCYTHE",TierType.ALL,UpgradePath.SCYTHE,new String[]{"EEx","xEx","xEx"},
|
||||
new ItemStack[]{
|
||||
new ItemStack(Material.GOLD_HOE), //T1
|
||||
new ItemStack(Material.WOOD_HOE), //T2
|
||||
@ -100,7 +100,7 @@ public enum ArtifactItemType {
|
||||
new ItemStack(Material.BOW), //T9
|
||||
new ItemStack(Material.BOW), //T10
|
||||
}),
|
||||
SHOVEL(5,"SHOVEL",TierType.ALL,UpgradePath.TOOL,new String[]{"E","E","E"},
|
||||
SHOVEL(5,"SHOVEL",TierType.ALL,UpgradePath.SHOVEL,new String[]{"E","E","E"},
|
||||
new ItemStack[]{
|
||||
new ItemStack(Material.GOLD_SPADE), //T1
|
||||
new ItemStack(Material.WOOD_SPADE), //T2
|
||||
@ -117,14 +117,14 @@ public enum ArtifactItemType {
|
||||
new ItemStack[]{
|
||||
new ItemStack(Material.LEATHER_HELMET), //T1
|
||||
new ItemStack(Material.LEATHER_HELMET), //T2
|
||||
new ItemStack(Material.GOLD_HELMET), //T3
|
||||
new ItemStack(Material.IRON_HELMET), //T4
|
||||
new ItemStack(Material.LEATHER_HELMET), //T3
|
||||
new ItemStack(Material.GOLD_HELMET), //T4
|
||||
new ItemStack(Material.IRON_HELMET), //T5
|
||||
new ItemStack(Material.IRON_HELMET), //T6
|
||||
new ItemStack(Material.DIAMOND_HELMET), //T7
|
||||
new ItemStack(Material.IRON_HELMET), //T7
|
||||
new ItemStack(Material.DIAMOND_HELMET), //T8
|
||||
new ItemStack(Material.DIAMOND_HELMET), //T9
|
||||
new ItemStack(Material.LEATHER_HELMET), //T10
|
||||
new ItemStack(Material.DIAMOND_HELMET), //T10
|
||||
},
|
||||
new double[]{
|
||||
3.75d, //T1
|
||||
@ -154,14 +154,14 @@ public enum ArtifactItemType {
|
||||
new ItemStack[]{
|
||||
new ItemStack(Material.LEATHER_CHESTPLATE), //T1
|
||||
new ItemStack(Material.LEATHER_CHESTPLATE), //T2
|
||||
new ItemStack(Material.GOLD_CHESTPLATE), //T3
|
||||
new ItemStack(Material.IRON_CHESTPLATE), //T4
|
||||
new ItemStack(Material.LEATHER_CHESTPLATE), //T3
|
||||
new ItemStack(Material.GOLD_CHESTPLATE), //T4
|
||||
new ItemStack(Material.IRON_CHESTPLATE), //T5
|
||||
new ItemStack(Material.IRON_CHESTPLATE), //T6
|
||||
new ItemStack(Material.DIAMOND_CHESTPLATE), //T7
|
||||
new ItemStack(Material.IRON_CHESTPLATE), //T7
|
||||
new ItemStack(Material.DIAMOND_CHESTPLATE), //T8
|
||||
new ItemStack(Material.DIAMOND_CHESTPLATE), //T9
|
||||
new ItemStack(Material.LEATHER_CHESTPLATE), //T10
|
||||
new ItemStack(Material.DIAMOND_CHESTPLATE), //T10
|
||||
},
|
||||
new double[]{
|
||||
3.75d, //T1
|
||||
@ -191,14 +191,14 @@ public enum ArtifactItemType {
|
||||
new ItemStack[]{
|
||||
new ItemStack(Material.LEATHER_LEGGINGS), //T1
|
||||
new ItemStack(Material.LEATHER_LEGGINGS), //T2
|
||||
new ItemStack(Material.GOLD_LEGGINGS), //T3
|
||||
new ItemStack(Material.IRON_LEGGINGS), //T4
|
||||
new ItemStack(Material.LEATHER_LEGGINGS), //T3
|
||||
new ItemStack(Material.GOLD_LEGGINGS), //T4
|
||||
new ItemStack(Material.IRON_LEGGINGS), //T5
|
||||
new ItemStack(Material.IRON_LEGGINGS), //T6
|
||||
new ItemStack(Material.DIAMOND_LEGGINGS), //T7
|
||||
new ItemStack(Material.IRON_LEGGINGS), //T7
|
||||
new ItemStack(Material.DIAMOND_LEGGINGS), //T8
|
||||
new ItemStack(Material.DIAMOND_LEGGINGS), //T9
|
||||
new ItemStack(Material.LEATHER_LEGGINGS), //T10
|
||||
new ItemStack(Material.DIAMOND_LEGGINGS), //T10
|
||||
},
|
||||
new double[]{
|
||||
3.75d, //T1
|
||||
@ -228,14 +228,14 @@ public enum ArtifactItemType {
|
||||
new ItemStack[]{
|
||||
new ItemStack(Material.LEATHER_BOOTS), //T1
|
||||
new ItemStack(Material.LEATHER_BOOTS), //T2
|
||||
new ItemStack(Material.GOLD_BOOTS), //T3
|
||||
new ItemStack(Material.IRON_BOOTS), //T4
|
||||
new ItemStack(Material.LEATHER_BOOTS), //T3
|
||||
new ItemStack(Material.GOLD_BOOTS), //T4
|
||||
new ItemStack(Material.IRON_BOOTS), //T5
|
||||
new ItemStack(Material.IRON_BOOTS), //T6
|
||||
new ItemStack(Material.DIAMOND_BOOTS), //T7
|
||||
new ItemStack(Material.IRON_BOOTS), //T7
|
||||
new ItemStack(Material.DIAMOND_BOOTS), //T8
|
||||
new ItemStack(Material.DIAMOND_BOOTS), //T9
|
||||
new ItemStack(Material.LEATHER_BOOTS), //T10
|
||||
new ItemStack(Material.DIAMOND_BOOTS), //T10
|
||||
},
|
||||
new double[]{
|
||||
3.75d, //T1
|
||||
@ -261,7 +261,7 @@ public enum ArtifactItemType {
|
||||
12, //T9
|
||||
14 //T10
|
||||
}),
|
||||
FISHING_ROD(10,"FISHING ROD",TierType.ALL,UpgradePath.WEAPON,new String[]{"xxE","xEE","ExE"},
|
||||
FISHING_ROD(10,"FISHING ROD",TierType.ALL,UpgradePath.FISHING_ROD,new String[]{"xxE","xEE","ExE"},
|
||||
new ItemStack[]{
|
||||
new ItemStack(Material.FISHING_ROD), //T1
|
||||
new ItemStack(Material.FISHING_ROD), //T2
|
||||
@ -398,7 +398,7 @@ public enum ArtifactItemType {
|
||||
for (int i=0;i<10;i++) {
|
||||
ShapelessRecipe upgrade_recipe = new ShapelessRecipe(this.getTieredItem(i+1));
|
||||
upgrade_recipe.addIngredient(Material.STAINED_GLASS_PANE, this.getDataValue());
|
||||
upgrade_recipe.addIngredient(this.getTieredItem(i+1).getType());
|
||||
upgrade_recipe.addIngredient(this.getTieredItem(i+1).getType(),-1);
|
||||
Bukkit.addRecipe(upgrade_recipe);
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,10 @@ import org.bukkit.material.Wool;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
import sig.plugin.TwosideKeeper.Artifact;
|
||||
import sig.plugin.TwosideKeeper.AwakenedArtifact;
|
||||
import sig.plugin.TwosideKeeper.MonsterController;
|
||||
import sig.plugin.TwosideKeeper.TwosideKeeper;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.WorldShop;
|
||||
@ -243,6 +246,10 @@ public class GenericFunctions {
|
||||
item.setItemMeta(m);
|
||||
item.setAmount(1);
|
||||
item.setDurability((short)0);
|
||||
if (isArtifactEquip(item)) {
|
||||
//Restore potential to 100%.
|
||||
AwakenedArtifact.addPotential(item, 100-AwakenedArtifact.getPotential(item));
|
||||
}
|
||||
TwosideKeeper.log("New item is "+item.toString(),2);
|
||||
return item;
|
||||
//By setting the amount to 1, you refresh the item in the player's inventory.
|
||||
@ -1438,6 +1445,9 @@ public class GenericFunctions {
|
||||
}
|
||||
}
|
||||
}
|
||||
case EXP_BOTTLE:{
|
||||
return "Bottle o' Enchanting";
|
||||
}
|
||||
default:{
|
||||
return GenericFunctions.CapitalizeFirstLetters(type.getType().toString().replace("_", " "));
|
||||
}
|
||||
@ -1592,8 +1602,8 @@ public class GenericFunctions {
|
||||
}
|
||||
}
|
||||
public static boolean isArtifactEquip(ItemStack item) {
|
||||
if (isEquip(item) &&
|
||||
Artifact.isArtifact(item) &&
|
||||
if (Artifact.isArtifact(item) &&
|
||||
isEquip(item) &&
|
||||
item.containsEnchantment(Enchantment.LUCK)) {
|
||||
return true;
|
||||
} else {
|
||||
@ -1664,6 +1674,38 @@ public class GenericFunctions {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isArtifactWeapon(ItemStack item) {
|
||||
if (item.getType().toString().contains("BOW") ||
|
||||
item.getType().toString().contains("AXE") ||
|
||||
item.getType().toString().contains("SWORD") ||
|
||||
item.getType().toString().contains("FISHING_ROD") ||
|
||||
item.getType().toString().contains("HOE")) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public static boolean isArtifactArmor(ItemStack item) {
|
||||
if (item.getType().toString().contains("BOOTS") ||
|
||||
item.getType().toString().contains("CHESTPLATE") ||
|
||||
item.getType().toString().contains("LEGGINGS") ||
|
||||
item.getType().toString().contains("HELMET")) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isArtifactTool(ItemStack item) {
|
||||
if (item.getType().toString().contains("SPADE") ||
|
||||
item.getType().toString().contains("AXE")||
|
||||
item.getType().toString().contains("HOE")) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isDefender(LivingEntity p) {
|
||||
if (p.getEquipment().getItemInMainHand()!=null && p.getEquipment().getItemInMainHand().getType()==Material.SHIELD) {
|
||||
return true;
|
||||
@ -1830,6 +1872,53 @@ public class GenericFunctions {
|
||||
}
|
||||
}
|
||||
|
||||
public static int CalculateSlot(ItemStack item, Player p) {
|
||||
//Check all equipment slots for this item.
|
||||
for (int i=0;i<p.getInventory().getSize();i++) {
|
||||
TwosideKeeper.log("Checking item slot "+i, 5);
|
||||
if (p.getInventory().getItem(i)!=null && p.getInventory().getItem(i).equals(item)) {
|
||||
TwosideKeeper.log("Found item in slot "+i, 5);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
//It might be in the armor slot.
|
||||
for (int i=0;i<p.getEquipment().getArmorContents().length;i++) {
|
||||
TwosideKeeper.log("Checking armor slot "+i, 5);
|
||||
if (p.getEquipment().getArmorContents()[i]!=null && p.getEquipment().getArmorContents().equals(item)) {
|
||||
TwosideKeeper.log("Found item in slot "+(i+900), 5);
|
||||
return i+900;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static boolean isBadEffect(PotionEffectType pet) {
|
||||
if (pet.equals(PotionEffectType.BLINDNESS) ||
|
||||
pet.equals(PotionEffectType.CONFUSION) ||
|
||||
pet.equals(PotionEffectType.HARM) ||
|
||||
pet.equals(PotionEffectType.HUNGER) ||
|
||||
pet.equals(PotionEffectType.POISON) ||
|
||||
pet.equals(PotionEffectType.SLOW) ||
|
||||
pet.equals(PotionEffectType.SLOW_DIGGING) ||
|
||||
pet.equals(PotionEffectType.UNLUCK) ||
|
||||
pet.equals(PotionEffectType.WITHER)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static int CountDebuffs(Player p) {
|
||||
int debuffcount=0;
|
||||
for (int i1=0;i1<p.getActivePotionEffects().size();i1++) {
|
||||
if (isBadEffect(Iterables.get(p.getActivePotionEffects(), i1).getType())) {
|
||||
debuffcount++;
|
||||
}
|
||||
}
|
||||
return debuffcount;
|
||||
}
|
||||
|
||||
public static void produceError(int errorCode, CommandSender sender) {
|
||||
String ErrorMessage = ChatColor.RED+"(ERRCODE "+errorCode+") A Fatal Error has occured! "+ChatColor.WHITE+"Please let the server administrator know about this.";
|
||||
sender.sendMessage(ErrorMessage);
|
||||
|
@ -1,8 +1,16 @@
|
||||
package sig.plugin.TwosideKeeper.HelperStructures;
|
||||
|
||||
public enum UpgradePath {
|
||||
WEAPON, //Weapon Upgrade Path - Boosts mostly offensive based statistics.
|
||||
BOW, //Bow Upgrade Path - Boosts mostly offensive based statistics, but for a bow.
|
||||
ARMOR, //Armor Upgrade Path - Boosts mostly defensive based statistics.
|
||||
TOOL //Tool Upgrade Path - Boosts mostly utility based statistics.
|
||||
WEAPON, //Weapon Upgrade Path - Falls under the 'All' category.
|
||||
BOW, //Bow Upgrade Path - Falls under the 'Weapon' category.
|
||||
ARMOR, //Armor Upgrade Path - Falls under the 'All' category.
|
||||
TOOL, //Tool Upgrade Path - Falls under the 'All' category.
|
||||
SWORD, //Falls under the 'Weapon' category.
|
||||
AXE, //Falls under the 'Weapon' and 'Tool' category.
|
||||
PICKAXE, //Falls under the 'Tool' category.
|
||||
SHOVEL, //Falls under the 'Tool' category.
|
||||
SCYTHE, //Falls under the 'Weapon' and 'Tool' category.
|
||||
FISHING_ROD, //Falls under the 'Weapon' category.
|
||||
BASIC, //Every category that is not 'Armor'.
|
||||
ALL //The base category.
|
||||
}
|
@ -15,6 +15,7 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
/*PLAYER STRUCTURE
|
||||
*
|
||||
@ -51,15 +52,19 @@ public class PlayerStructure {
|
||||
public int title_task; //Keeps track of the task last identified for updating titles.
|
||||
public int pickeditems=-1;
|
||||
public boolean sounds_enabled=true;
|
||||
public double velocity;
|
||||
|
||||
public double prev_weapondmg=0.0;
|
||||
public double prev_buffdmg=0.0;
|
||||
public double prev_partydmg=0.0;
|
||||
public double prev_armordef=0.0;
|
||||
|
||||
public int debuffcount=0;
|
||||
|
||||
//Needs the instance of the player object to get all other info. Only to be called at the beginning.
|
||||
public PlayerStructure(Player p, long serverTickTime) {
|
||||
if (p!=null) {
|
||||
this.velocity = 0d;
|
||||
this.name = p.getName();
|
||||
this.joined = serverTickTime;
|
||||
this.firstjoined=serverTickTime;
|
||||
@ -79,6 +84,7 @@ public class PlayerStructure {
|
||||
this.spleef_wins=0;
|
||||
this.title_task=-1;
|
||||
this.sounds_enabled=true;
|
||||
this.debuffcount=0;
|
||||
//Set defaults first, in case this is a new user.
|
||||
loadConfig();
|
||||
|
||||
|
@ -13,6 +13,7 @@ import java.util.Random;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.LogRecord;
|
||||
|
||||
import org.apache.commons.lang.WordUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
@ -101,6 +102,7 @@ import org.bukkit.event.player.PlayerItemBreakEvent;
|
||||
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
||||
import org.bukkit.event.player.PlayerItemHeldEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerPickupArrowEvent;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
@ -206,6 +208,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
public static MysteriousEssenceLogger EssenceLogger; //The logger for Essences.
|
||||
public static AutoUpdatePlugin pluginupdater;
|
||||
public static Lag tpstracker;
|
||||
public static boolean restarting_server=false;
|
||||
|
||||
public int TeamCounter = 0;
|
||||
public static List<Party> PartyList = new ArrayList<Party>();
|
||||
@ -448,6 +451,34 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
Player p = (Player)(Bukkit.getOnlinePlayers().toArray()[i]);
|
||||
PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId());
|
||||
|
||||
if (GenericFunctions.CountDebuffs(p)>pd.debuffcount) {
|
||||
ItemStack[] equips = p.getEquipment().getArmorContents();
|
||||
double removechance = 0.0;
|
||||
log("Debuffcount went up...",5);
|
||||
for (int i1=0;i1<equips.length;i1++) {
|
||||
if (GenericFunctions.isArtifactEquip(equips[i1])) {
|
||||
double resistamt = ArtifactAbility.calculateValue(ArtifactAbility.STATUS_EFFECT_RESISTANCE, equips[i1].getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.STATUS_EFFECT_RESISTANCE, equips[i1]));
|
||||
log("Resist amount is "+resistamt,5);
|
||||
removechance+=resistamt;
|
||||
}
|
||||
}
|
||||
log("Remove chance is "+removechance,5);
|
||||
int longestdur=0;
|
||||
PotionEffectType type=null;
|
||||
for (int i1=0;i1<p.getActivePotionEffects().size();i1++) {
|
||||
if (GenericFunctions.isBadEffect(Iterables.get(p.getActivePotionEffects(), i1).getType()) && Iterables.get(p.getActivePotionEffects(), i1).getDuration()>longestdur) {
|
||||
longestdur=Iterables.get(p.getActivePotionEffects(), i1).getDuration();
|
||||
type=Iterables.get(p.getActivePotionEffects(), i1).getType();
|
||||
}
|
||||
}
|
||||
if (Math.random()<=removechance/100) {
|
||||
p.removePotionEffect(type);
|
||||
p.sendMessage(ChatColor.DARK_GRAY+"You successfully resisted the application of "+ChatColor.WHITE+GenericFunctions.CapitalizeFirstLetters(type.getName().replace("_", " ")));
|
||||
}
|
||||
|
||||
}
|
||||
pd.debuffcount=GenericFunctions.CountDebuffs(p);
|
||||
|
||||
if (banksessions.containsKey(p.getUniqueId())) {
|
||||
//See if it expired.
|
||||
BankSession bs = (BankSession)banksessions.get(p.getUniqueId());
|
||||
@ -466,6 +497,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
TwosideShops.RemoveSession(p);
|
||||
}
|
||||
|
||||
if (pd.velocity>0) {
|
||||
pd.velocity/=2;
|
||||
}
|
||||
|
||||
if (pd.last_regen_time+HEALTH_REGENERATION_RATE<=getServerTickTime()) {
|
||||
pd.last_regen_time=getServerTickTime();
|
||||
//See if this player needs to be healed.
|
||||
@ -473,7 +508,17 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
!p.isDead() && //Um, don't heal them if they're dead...That's just weird.
|
||||
p.getHealth()<p.getMaxHealth() &&
|
||||
p.getFoodLevel()>=16) {
|
||||
p.setHealth((p.getHealth()+1+(p.getMaxHealth()*0.05)>p.getMaxHealth())?p.getMaxHealth():p.getHealth()+1+(p.getMaxHealth()*0.05));
|
||||
ItemStack[] equips = p.getEquipment().getArmorContents();
|
||||
double bonusregen = 0.0;
|
||||
for (int i1=0;i1<equips.length;i1++) {
|
||||
if (GenericFunctions.isArtifactEquip(equips[i1])) {
|
||||
double regenamt = ArtifactAbility.calculateValue(ArtifactAbility.HEALTH_REGEN, equips[i1].getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.HEALTH_REGEN, equips[i1]));
|
||||
bonusregen += regenamt;
|
||||
log("Bonus regen increased by "+regenamt,2);
|
||||
}
|
||||
}
|
||||
p.setHealth((p.getHealth()+1+(p.getMaxHealth()*0.05)+bonusregen>p.getMaxHealth())?p.getMaxHealth():p.getHealth()+1+(p.getMaxHealth()*0.05)+bonusregen);
|
||||
|
||||
}
|
||||
}
|
||||
//See if this player is sleeping.
|
||||
@ -760,7 +805,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
if (Bukkit.getPlayer(args[0])!=null) {
|
||||
//If we can grab their stats, then calculate it.
|
||||
Player p = Bukkit.getPlayer(args[0]);
|
||||
sender.sendMessage("Display stats for "+ChatColor.YELLOW+p.getName());
|
||||
sender.sendMessage("Displaying stats for "+ChatColor.YELLOW+p.getName());
|
||||
showPlayerStats(p);
|
||||
} else {
|
||||
sender.sendMessage("Player "+ChatColor.YELLOW+args[0]+" is not online!");
|
||||
@ -783,7 +828,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
if (args.length==3 && args[0].equalsIgnoreCase("levelup")) {
|
||||
//argument2 is the equip slot to apply it to.
|
||||
Player p = (Player)sender;
|
||||
if (Integer.parseInt(args[2])>=900) {
|
||||
ArtifactAbility.upgradeEnchantment(p,p.getInventory().getArmorContents()[Integer.parseInt(args[2])-900],ArtifactAbility.valueOf(args[1]));
|
||||
} else {
|
||||
ArtifactAbility.upgradeEnchantment(p,p.getInventory().getItem(Integer.parseInt(args[2])),ArtifactAbility.valueOf(args[1]));
|
||||
}
|
||||
} else {
|
||||
//Display the generic levelup message.
|
||||
Player p = Bukkit.getPlayer(sender.getName());
|
||||
@ -791,6 +840,15 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
p.spigot().sendMessage(ArtifactAbility.GenerateMenu(ArtifactItemType.getArtifactItemTypeFromItemStack(p.getEquipment().getItemInMainHand()).getUpgradePath(), CalculateDamageReduction(1,p,p), p.getEquipment().getItemInMainHand()));
|
||||
}
|
||||
return true;
|
||||
} else
|
||||
if (cmd.getName().equalsIgnoreCase("awakenedartifact_ability")) {
|
||||
if (args.length==2) {
|
||||
Player p = (Player)sender;
|
||||
p.getEquipment().setItemInMainHand(ArtifactAbility.applyEnchantment(ArtifactAbility.valueOf(args[0]), Integer.parseInt(args[1]), p.getEquipment().getItemInMainHand()));
|
||||
return true;
|
||||
} else {
|
||||
sender.sendMessage("Wrong arguments!");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//Implement console/admin version later (Let's you check any name's money.)
|
||||
@ -838,7 +896,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
//MESSAGE: Sound.NOTE_STICKS, 0.6f, 0.85f);
|
||||
}
|
||||
}
|
||||
if (SERVER_TYPE==ServerType.MAIN) {
|
||||
if (SERVER_TYPE==ServerType.MAIN && !restarting_server) {
|
||||
pluginupdater.FetchPlugins();
|
||||
}
|
||||
playerdata.put(ev.getPlayer().getUniqueId(), new PlayerStructure(ev.getPlayer(),getServerTickTime()));
|
||||
@ -2068,6 +2126,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
if (GenericFunctions.isArtifactEquip(ev.getItemInHand()) &&
|
||||
ev.getItemInHand().getType().toString().contains("HOE")) {
|
||||
AwakenedArtifact.addPotentialEXP(ev.getItemInHand(), 4, ev.getPlayer());
|
||||
}
|
||||
|
||||
if (ev.getItemInHand().hasItemMeta() &&
|
||||
ev.getItemInHand().getItemMeta().hasLore() &&
|
||||
ev.getItemInHand().getItemMeta().getLore().size()==4 &&
|
||||
@ -3243,6 +3306,14 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
|
||||
ev.setDamage(CalculateDamageReduction(ev.getDamage()*dmgmult*ENEMY_DMG_MULT,p,m));
|
||||
|
||||
//Artifact armor will receive EXP.
|
||||
for (int i=0;i<p.getEquipment().getArmorContents().length;i++) {
|
||||
if (GenericFunctions.isArtifactEquip(p.getEquipment().getArmorContents()[i]) &&
|
||||
GenericFunctions.isArtifactArmor(p.getEquipment().getArmorContents()[i])) {
|
||||
AwakenedArtifact.addPotentialEXP(p.getEquipment().getArmorContents()[i], (int)ev.getFinalDamage()*5, p);
|
||||
}
|
||||
}
|
||||
|
||||
log("Final dmg is "+ev.getFinalDamage(),4);
|
||||
|
||||
//Make this monster the player's new target.
|
||||
@ -3280,7 +3351,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
|
||||
//Damage dealt by the player is calculated differently, therefore we will cancel the normal damage calculation in favor
|
||||
//of a new custom damage calculation.
|
||||
if (p.getInventory().getItemInMainHand().getType()!=Material.BOW) {
|
||||
DealDamageToMob(p.getInventory().getItemInMainHand(),p,m);
|
||||
}
|
||||
if (m instanceof Monster) {
|
||||
if (m.getType()==EntityType.SPIDER &&
|
||||
p.getEquipment().getItemInMainHand().containsEnchantment(Enchantment.DAMAGE_ARTHROPODS)) {
|
||||
@ -3307,9 +3380,17 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
((Monster)m).setTarget(p);
|
||||
}
|
||||
}
|
||||
|
||||
if (GenericFunctions.isArtifactEquip(p.getEquipment().getItemInMainHand()) &&
|
||||
GenericFunctions.isArtifactWeapon(p.getEquipment().getItemInMainHand())) {
|
||||
double ratio = 1.0-CalculateDamageReduction(1,m,p);
|
||||
log("EXP ratio is "+ratio,5);
|
||||
AwakenedArtifact.addPotentialEXP(p.getEquipment().getItemInMainHand(), (int)(ratio*20)+5, p);
|
||||
}
|
||||
|
||||
//ev.setCancelled(true);
|
||||
ev.setDamage(0.01);
|
||||
m.setNoDamageTicks(0);
|
||||
m.setNoDamageTicks(20);
|
||||
|
||||
//Make this monster the player's new target.
|
||||
PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId());
|
||||
@ -3355,6 +3436,13 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
ev.setDamage(CalculateDamageReduction(ev.getDamage()*dmgmult*ENEMY_DMG_MULT,p,ev.getDamager()));
|
||||
|
||||
|
||||
for (int i=0;i<p.getEquipment().getArmorContents().length;i++) {
|
||||
if (GenericFunctions.isArtifactEquip(p.getEquipment().getArmorContents()[i]) &&
|
||||
GenericFunctions.isArtifactArmor(p.getEquipment().getArmorContents()[i])) {
|
||||
AwakenedArtifact.addPotentialEXP(p.getEquipment().getArmorContents()[i], (int)ev.getFinalDamage(), p);
|
||||
}
|
||||
}
|
||||
|
||||
//Make this monster the player's new target.
|
||||
PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId());
|
||||
//Found the player structure. Set the target.
|
||||
@ -3380,22 +3468,59 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
* X and Z have to be within abs(2).
|
||||
* Y has to be within abs(0.15).
|
||||
*/
|
||||
ev.setDamage(DamageModifier.MAGIC,0);
|
||||
ev.setDamage(DamageModifier.RESISTANCE,0);
|
||||
ev.setDamage(DamageModifier.ARMOR,0);
|
||||
|
||||
Location arrowLoc = ((Arrow)(ev.getDamager())).getLocation();
|
||||
Location monsterHead = m.getEyeLocation().add(0,0.105,0);
|
||||
boolean headshot=false;
|
||||
|
||||
ev.setDamage(CalculateWeaponDamage(p,m));
|
||||
|
||||
|
||||
double headshotvalx=3.0/HEADSHOT_ACC;
|
||||
double headshotvalz=3.0/HEADSHOT_ACC;
|
||||
double headshotvaly=0.165/HEADSHOT_ACC;
|
||||
|
||||
if (GenericFunctions.isArtifactEquip(p.getEquipment().getItemInMainHand())) {
|
||||
headshotvalx+=headshotvalx*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;
|
||||
}
|
||||
log(headshotvalx+","+headshotvaly+","+headshotvalz,5);
|
||||
|
||||
if (ev.getDamager().getTicksLived()>=4) {
|
||||
if (Math.abs(arrowLoc.getY()-monsterHead.getY())<=0.165/HEADSHOT_ACC) {
|
||||
if (Math.abs(arrowLoc.getY()-monsterHead.getY())<=headshotvaly) {
|
||||
log("Height discrepancy is good.",5);
|
||||
if (Math.abs(arrowLoc.getZ()-monsterHead.getZ())<=3.0/HEADSHOT_ACC &&
|
||||
Math.abs(arrowLoc.getX()-monsterHead.getX())<=3.0/HEADSHOT_ACC) {
|
||||
log("Height discrepancy is good.",5);
|
||||
if (Math.abs(arrowLoc.getZ()-monsterHead.getZ())<=headshotvalz &&
|
||||
Math.abs(arrowLoc.getX()-monsterHead.getX())<=headshotvalx) {
|
||||
ev.setDamage(ev.getDamage()*8.0);
|
||||
p.sendMessage(ChatColor.DARK_RED+"Headshot! x8 Damage");
|
||||
headshot=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
log("Base damage is now "+ev.getDamage(),5);
|
||||
|
||||
double truedmg = 0;
|
||||
if (GenericFunctions.isArtifactEquip(p.getEquipment().getItemInMainHand())) {
|
||||
double dmgincrease = ArtifactAbility.calculateValue(ArtifactAbility.ARMOR_PEN, p.getEquipment().getItemInMainHand().getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.ARMOR_PEN, p.getEquipment().getItemInMainHand()));
|
||||
truedmg=ev.getDamage()*dmgincrease/100;
|
||||
ev.setDamage(ev.getDamage()-(ev.getDamage()*dmgincrease/100));
|
||||
log("True damage dealt: "+truedmg,5);
|
||||
}
|
||||
ev.setDamage(CalculateDamageReduction(ev.getDamage(),m,p)+truedmg);
|
||||
log("Reduced damage is "+ev.getDamage(),5);
|
||||
|
||||
|
||||
if (GenericFunctions.isArtifactEquip(p.getEquipment().getItemInMainHand()) &&
|
||||
GenericFunctions.isArtifactWeapon(p.getEquipment().getItemInMainHand())) {
|
||||
double ratio = 1.0-CalculateDamageReduction(1,m,p);
|
||||
log("EXP ratio is "+ratio,5);
|
||||
AwakenedArtifact.addPotentialEXP(p.getEquipment().getItemInMainHand(), (int)(ratio*20), p);
|
||||
}
|
||||
|
||||
//Make this monster the player's new target.
|
||||
PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId());
|
||||
@ -3622,15 +3747,30 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
|
||||
}
|
||||
|
||||
@EventHandler(priority=EventPriority.LOW)
|
||||
public void onPlayerMove(PlayerMoveEvent ev) {
|
||||
/*if (SERVER_TYPE==ServerType.TEST || SERVER_TYPE==ServerType.QUIET) {
|
||||
Player p = ev.getPlayer();
|
||||
TwosideKeeperAPI.addArtifactEXP(p.getEquipment().getItemInMainHand(), 100, p);
|
||||
}*/
|
||||
if (ev.getPlayer().isOnGround()) {
|
||||
PlayerStructure pd = (PlayerStructure)playerdata.get(ev.getPlayer().getUniqueId());
|
||||
pd.velocity = new Vector(ev.getFrom().getX(),ev.getFrom().getY(),ev.getFrom().getZ()).distanceSquared(new Vector(ev.getTo().getX(),ev.getTo().getY(),ev.getTo().getZ()));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority=EventPriority.LOW)
|
||||
public void onBlockBreak(BlockBreakEvent ev) {
|
||||
|
||||
TwosideSpleefGames.PassEvent(ev);
|
||||
|
||||
Player p = ev.getPlayer();
|
||||
TwosideKeeperAPI.addArtifactEXP(p.getEquipment().getItemInMainHand(), 100, p);
|
||||
if (p!=null) {
|
||||
log(p.getName()+" has broken block "+GenericFunctions.UserFriendlyMaterialName(new ItemStack(ev.getBlock().getType())),3);
|
||||
if (GenericFunctions.isArtifactEquip(p.getEquipment().getItemInMainHand()) &&
|
||||
GenericFunctions.isArtifactTool(p.getEquipment().getItemInMainHand())) {
|
||||
AwakenedArtifact.addPotentialEXP(p.getEquipment().getItemInMainHand(), 4, p);
|
||||
}
|
||||
}
|
||||
|
||||
if (ev.getBlock().getType()==Material.WALL_SIGN ||
|
||||
@ -4153,10 +4293,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
for (int i=0;i<resultitem.getEnchantments().size();i++) {
|
||||
Enchantment e = (Enchantment)resultitem.getEnchantments().keySet().toArray()[i];
|
||||
if (newartifact.containsEnchantment(e) && artifact_item.getEnchantmentLevel(e)>newartifact.getEnchantmentLevel(e)) {
|
||||
log("Contains "+e.toString()+" "+newartifact.getEnchantmentLevel(e), 2);
|
||||
log("Contains "+e.toString()+" "+newartifact.getEnchantmentLevel(e), 5);
|
||||
//These are the enchantments that clash. If the resultitem ones are greater, apply them to the new item.
|
||||
newartifact.addUnsafeEnchantment(e, artifact_item.getEnchantmentLevel(e));
|
||||
log("Applied "+e.getName()+" "+artifact_item.getEnchantmentLevel(e)+" to the artifact",2);
|
||||
log("Applied "+e.getName()+" "+artifact_item.getEnchantmentLevel(e)+" to the artifact",5);
|
||||
}
|
||||
}
|
||||
for (int i=0;i<artifact_item.getEnchantments().size();i++) {
|
||||
@ -4165,10 +4305,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
//log("Contains "+e.toString()+" "+newartifact.getEnchantmentLevel(e), 2);
|
||||
//These are the enchantments that clash. If the resultitem ones are greater, apply them to the new item.
|
||||
newartifact.addUnsafeEnchantment(e, artifact_item.getEnchantmentLevel(e));
|
||||
log("Applied "+e.getName()+" "+artifact_item.getEnchantmentLevel(e)+" to the artifact",2);
|
||||
log("Applied "+e.getName()+" "+artifact_item.getEnchantmentLevel(e)+" to the artifact",5);
|
||||
}
|
||||
}
|
||||
|
||||
newartifact.setDurability((short)(newartifact.getType().getMaxDurability()*(artifact_item.getDurability()/artifact_item.getType().getMaxDurability())));
|
||||
ev.getInventory().setResult(newartifact);
|
||||
}
|
||||
}
|
||||
@ -4891,6 +5032,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
hp+=(is_block_form)?ARMOR_DIAMOND2_HP:ARMOR_DIAMOND_HP;
|
||||
}
|
||||
}
|
||||
if (GenericFunctions.isArtifactEquip(equipment[i])) {
|
||||
hp += ArtifactAbility.calculateValue(ArtifactAbility.HEALTH, equipment[i].getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.HEALTH, equipment[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -5150,6 +5294,27 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
//Apply Artifact abilities next.
|
||||
if (GenericFunctions.isArtifactEquip(p.getEquipment().getItemInMainHand())) {
|
||||
//ArtifactAbility.calculateValue(ArtifactAbility.ARMOR_PEN, p.getEquipment().getItemInMainHand().getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.ARMOR_PEN, p.getEquipment().getItemInMainHand()));
|
||||
basedmg += ArtifactAbility.calculateValue(ArtifactAbility.DAMAGE, p.getEquipment().getItemInMainHand().getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.DAMAGE, p.getEquipment().getItemInMainHand()));
|
||||
if (target!=null) {
|
||||
basedmg +=(100-(target.getHealth()/target.getMaxHealth()*100))/20*ArtifactAbility.calculateValue(ArtifactAbility.EXECUTION, p.getEquipment().getItemInMainHand().getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.EXECUTION, p.getEquipment().getItemInMainHand()));
|
||||
if (Math.random()<=0.01*ArtifactAbility.calculateValue(ArtifactAbility.CRITICAL, p.getEquipment().getItemInMainHand().getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.CRITICAL, p.getEquipment().getItemInMainHand()))) {
|
||||
//Landed a critical strike.
|
||||
//log("Critical strike!",2);
|
||||
p.getLocation().getWorld().playSound(p.getLocation(), Sound.ENTITY_PLAYER_ATTACK_CRIT, 1.0f, 1.0f);
|
||||
double dmgamt = 2+(ArtifactAbility.calculateValue(ArtifactAbility.CRIT_DMG, p.getEquipment().getItemInMainHand().getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.CRIT_DMG, p.getEquipment().getItemInMainHand()))-200)/100;
|
||||
log("Crit dmg multiplied by x"+dmgamt,4);
|
||||
basedmg*=dmgamt;
|
||||
}
|
||||
}
|
||||
double dmgamt = pd.velocity*100*ArtifactAbility.calculateValue(ArtifactAbility.HIGHWINDER, p.getEquipment().getItemInMainHand().getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.HIGHWINDER, p.getEquipment().getItemInMainHand()));
|
||||
log("Highwinder damage is "+dmgamt,5);
|
||||
basedmg+=dmgamt;
|
||||
|
||||
}
|
||||
|
||||
if (pd!=null) {
|
||||
pd.prev_weapondmg = basedmg;
|
||||
}
|
||||
@ -5276,7 +5441,13 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
double truedmg = 0;
|
||||
if (GenericFunctions.isArtifactEquip(weapon)) {
|
||||
double dmgincrease = ArtifactAbility.calculateValue(ArtifactAbility.ARMOR_PEN, p.getEquipment().getItemInMainHand().getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.ARMOR_PEN, p.getEquipment().getItemInMainHand()));
|
||||
truedmg=basedmg*dmgincrease/100;
|
||||
basedmg-=basedmg*dmgincrease/100;
|
||||
//log("True damage dealt: "+truedmg,2);
|
||||
}
|
||||
|
||||
//Now apply resistances if any.
|
||||
//Resistance effect reduces damage by 10% per level of resistance.
|
||||
@ -5306,7 +5477,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
)
|
||||
*((10-resistlevel)*0.1)
|
||||
*((100-protectionlevel)*0.01)
|
||||
*((hasShield)?0.95:1.00); //Calculated damage amount.
|
||||
*((hasShield)?0.95:1.00)
|
||||
+truedmg; //Calculated damage amount.
|
||||
|
||||
log("Final damage is "+dmgamt,3);
|
||||
|
||||
@ -5357,11 +5529,14 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
}
|
||||
if ((damager instanceof Creeper) && armor[i].getEnchantmentLevel(Enchantment.PROTECTION_EXPLOSIONS)>0) {
|
||||
protectionlevel+=armor[i].getEnchantmentLevel(Enchantment.PROTECTION_EXPLOSIONS);
|
||||
//log("Protection level increased by "+protectionlevel,2);
|
||||
}
|
||||
|
||||
boolean isBlockArmor = GenericFunctions.isHardenedItem(armor[i]);
|
||||
|
||||
if (target instanceof Monster) {
|
||||
isBlockArmor=true;
|
||||
}
|
||||
|
||||
//If this is an artifact armor, we totally override the base damage reduction.
|
||||
if (GenericFunctions.isArmor(armor[i]) && Artifact.isArtifact(armor[i])) {
|
||||
//Let's change up the damage.
|
||||
@ -5398,6 +5573,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
}break;
|
||||
}
|
||||
}
|
||||
|
||||
if (GenericFunctions.isArtifactEquip(armor[i])) {
|
||||
double reductionamt = ArtifactAbility.calculateValue(ArtifactAbility.DAMAGE_REDUCTION, armor[i].getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.DAMAGE_REDUCTION, armor[i]));
|
||||
dmgreduction+=reductionamt;
|
||||
log("Reducing damage by "+reductionamt+"%",5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -5435,6 +5616,17 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
log(finaldmg+" damage calculated for: "+target.getName()+".",5);
|
||||
}
|
||||
|
||||
if (damager instanceof Player) {
|
||||
Player p = (Player)damager;
|
||||
double healamt = finaldmg*ArtifactAbility.calculateValue(ArtifactAbility.LIFESTEAL, p.getEquipment().getItemInMainHand().getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.LIFESTEAL, p.getEquipment().getItemInMainHand()))/100;
|
||||
//log("Healed "+healamt+" damage.",2);
|
||||
double newhealth = p.getHealth()+healamt;
|
||||
if (newhealth>p.getMaxHealth()) {
|
||||
p.setMaxHealth(p.getMaxHealth());
|
||||
} else {
|
||||
p.setHealth(newhealth);
|
||||
}
|
||||
}
|
||||
if (target instanceof Player) {
|
||||
Player p = (Player)target;
|
||||
PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId());
|
||||
@ -5579,6 +5771,38 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
DecimalFormat df = new DecimalFormat("0.0");
|
||||
p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Base Damage: "+ChatColor.RESET+""+ChatColor.DARK_PURPLE+df.format(pd.damagedealt));
|
||||
p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Damage Reduction: "+ChatColor.RESET+""+ChatColor.DARK_AQUA+df.format((1.0-pd.damagereduction)*100)+"%");
|
||||
TextComponent msg = DisplayPerks(p.getEquipment().getItemInMainHand(),"Weapon",p);if (!msg.toPlainText().equalsIgnoreCase("")) {p.spigot().sendMessage(msg);};
|
||||
msg = DisplayPerks(p.getEquipment().getHelmet(),"Helmet",p);if (!msg.toPlainText().equalsIgnoreCase("")) {p.spigot().sendMessage(msg);};
|
||||
msg = DisplayPerks(p.getEquipment().getChestplate(),"Chestplate",p);if (!msg.toPlainText().equalsIgnoreCase("")) {p.spigot().sendMessage(msg);};
|
||||
msg = DisplayPerks(p.getEquipment().getLeggings(),"Legging",p);if (!msg.toPlainText().equalsIgnoreCase("")) {p.spigot().sendMessage(msg);};
|
||||
msg = DisplayPerks(p.getEquipment().getBoots(),"Boot",p);if (!msg.toPlainText().equalsIgnoreCase("")) {p.spigot().sendMessage(msg);};
|
||||
p.sendMessage("----------");
|
||||
}
|
||||
|
||||
public static TextComponent DisplayPerks(ItemStack item,String type,Player p) {
|
||||
TextComponent tc = new TextComponent("");
|
||||
if (GenericFunctions.isArtifactEquip(item) &&
|
||||
ArtifactAbility.getEnchantments(item).size()>0) {
|
||||
//log("Getting perks...",2);
|
||||
HashMap enchants = ArtifactAbility.getEnchantments(item);
|
||||
tc.addExtra("");
|
||||
tc.addExtra(ChatColor.GRAY+""+ChatColor.ITALIC+type+" Perks: \n");
|
||||
int j=0;
|
||||
for (int i=0;i<enchants.size();i++) {
|
||||
//log("Getting perks...",2);
|
||||
ArtifactAbility ab = (ArtifactAbility)enchants.keySet().toArray()[i];
|
||||
//p.sendMessage(ChatColor.BLUE+ab.GetName()+" "+(int)enchants.values().toArray()[i]);
|
||||
TextComponent tc1 = new TextComponent(ChatColor.GREEN+"["+ab.GetName()+" "+(int)enchants.values().toArray()[i]+"] ");
|
||||
tc1.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,new ComponentBuilder(WordUtils.wrap(ArtifactAbility.displayDescription(ab, item.getEnchantmentLevel(Enchantment.LUCK), (int)enchants.values().toArray()[i], CalculateWeaponDamage(p,null)),ArtifactAbility.LINE_SIZE,"\n",true)).create()));
|
||||
j++;
|
||||
if (j>=4 && i!=enchants.size()-1) {
|
||||
tc1.addExtra("\n");
|
||||
j=0;
|
||||
}
|
||||
tc.addExtra(tc1);
|
||||
}
|
||||
}
|
||||
return tc;
|
||||
}
|
||||
|
||||
public static ServerType getServerType() {
|
||||
|
@ -10,6 +10,7 @@ import org.bukkit.entity.Monster;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactAbility;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItem;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Loot;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.MonsterDifficulty;
|
||||
@ -76,6 +77,12 @@ public final class TwosideKeeperAPI {
|
||||
public static ItemStack addArtifactEXP(ItemStack item, int amt, Player p) {
|
||||
return AwakenedArtifact.addPotentialEXP(item, amt, p);
|
||||
}
|
||||
public static boolean hasArtifactAbility(ArtifactAbility ability, ItemStack item) {
|
||||
return ArtifactAbility.containsEnchantment(ability, item);
|
||||
}
|
||||
public static int getArtifactAbilityLevel(ArtifactAbility ability, ItemStack item) {
|
||||
return ArtifactAbility.getEnchantmentLevel(ability, item);
|
||||
}
|
||||
|
||||
//Time Commands.
|
||||
public static long getServerTickTime() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user