->All armor perks implemented.
->All sword perks implemented. ->All shovel perks implemented. ->Auto Repair, Preservation, and Greed perks implemented. ->Ability Points is now calculated based on how many points are consumed on the artifact item. This way "temporary" perks do not result in a complete loss of points. ->Fix /stats not updating damage value until called twice. ->/stats now shows a small upgrade button if you have AP, for easier access than typing a slash command.
This commit is contained in:
parent
5a53a36f67
commit
c9c8906b5d
Binary file not shown.
@ -1,6 +1,6 @@
|
|||||||
name: TwosideKeeper
|
name: TwosideKeeper
|
||||||
main: sig.plugin.TwosideKeeper.TwosideKeeper
|
main: sig.plugin.TwosideKeeper.TwosideKeeper
|
||||||
version: 3.5.1a
|
version: 3.5.2
|
||||||
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.
|
||||||
|
@ -12,6 +12,8 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
|
|
||||||
import net.md_5.bungee.api.chat.ClickEvent;
|
import net.md_5.bungee.api.chat.ClickEvent;
|
||||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||||
import net.md_5.bungee.api.chat.HoverEvent;
|
import net.md_5.bungee.api.chat.HoverEvent;
|
||||||
@ -77,10 +79,23 @@ public class AwakenedArtifact {
|
|||||||
ItemStack item = addLV(artifact,totalval/1000, p);
|
ItemStack item = addLV(artifact,totalval/1000, p);
|
||||||
item = setEXP(item,totalval-1000);
|
item = setEXP(item,totalval-1000);
|
||||||
item = addAP(item,1);
|
item = addAP(item,1);
|
||||||
if (getPotential(item)>10) {
|
double potentialred = 10.0d;
|
||||||
item = addPotential(item,-getPotential(item)/10);
|
potentialred/=1+(ArtifactAbility.calculateValue(ArtifactAbility.PRESERVATION, artifact.getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.PRESERVATION, artifact))/100d);
|
||||||
|
TwosideKeeper.log("Potential reduction is reduced by "+(10-potentialred), 2);
|
||||||
|
if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, item)) {
|
||||||
|
if (ArtifactAbility.getEnchantmentLevel(ArtifactAbility.GREED, item)>1) {
|
||||||
|
item = ArtifactAbility.applyEnchantment(ArtifactAbility.GREED, ArtifactAbility.getEnchantmentLevel(ArtifactAbility.GREED, item)-1, item);
|
||||||
} else {
|
} else {
|
||||||
if (Math.random()<=getPotential(item)/10.0d) {
|
item = ArtifactAbility.removeEnchantment(ArtifactAbility.GREED, item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (getPotential(item)>potentialred) {
|
||||||
|
item = addPotential(item,(int)(-getPotential(item)/potentialred));
|
||||||
|
if (Math.random() < (potentialred % 1)) {
|
||||||
|
item = addPotential(item,1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (Math.random()<=getPotential(item)/potentialred) {
|
||||||
item = addPotential(item,-1);
|
item = addPotential(item,-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -143,8 +158,8 @@ public class AwakenedArtifact {
|
|||||||
List<String> lore = m.getLore();
|
List<String> lore = m.getLore();
|
||||||
DecimalFormat df = new DecimalFormat("000");
|
DecimalFormat df = new DecimalFormat("000");
|
||||||
String apline = lore.get(6);
|
String apline = lore.get(6);
|
||||||
int currentAP = Integer.parseInt(((apline.split("/")[0]).split(": ")[1]));
|
int currentAP = getAP(artifact);
|
||||||
lore.set(6, ChatColor.GOLD+"Ability Points: "+(currentAP+amt)+"/"+getLV(artifact));
|
lore.set(6, ChatColor.GOLD+"Ability Points: "+(currentAP)+"/"+getLV(artifact));
|
||||||
m.setLore(lore);
|
m.setLore(lore);
|
||||||
artifact.setItemMeta(m);
|
artifact.setItemMeta(m);
|
||||||
return artifact;
|
return artifact;
|
||||||
@ -162,7 +177,14 @@ public class AwakenedArtifact {
|
|||||||
List<String> lore = m.getLore();
|
List<String> lore = m.getLore();
|
||||||
DecimalFormat df = new DecimalFormat("000");
|
DecimalFormat df = new DecimalFormat("000");
|
||||||
String apline = lore.get(6);
|
String apline = lore.get(6);
|
||||||
return Integer.parseInt(((apline.split("/")[0]).split(": ")[1]));
|
int level = getLV(artifact); //This is how many total we have.
|
||||||
|
int apused = 0;
|
||||||
|
HashMap<ArtifactAbility,Integer> enchants = ArtifactAbility.getEnchantments(artifact);
|
||||||
|
for (int i=0;i<enchants.values().size();i++) {
|
||||||
|
apused += Iterables.get(enchants.values(), i); //Counts how many levels of each enchantment was applied. This correlates directly with how much AP was used.
|
||||||
|
}
|
||||||
|
return level-apused;
|
||||||
|
//return Integer.parseInt(((apline.split("/")[0]).split(": ")[1]));
|
||||||
}
|
}
|
||||||
TwosideKeeper.log("Could not get the AP value for artifact "+artifact.toString(), 1);
|
TwosideKeeper.log("Could not get the AP value for artifact "+artifact.toString(), 1);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -45,14 +45,14 @@ public enum ArtifactAbility {
|
|||||||
//Bow Abilities
|
//Bow Abilities
|
||||||
MARKSMAN("Marksman","Increases headshot hitbox size by [VAL]% .",new double[]{10.0,15,20,25,30,35,40,45,50,55},
|
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),
|
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"
|
SIEGESTANCE("Siege Stance",ChatColor.GRAY+"[Unimplemented] 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},
|
+ "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,UpgradePath.BOW),
|
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},
|
ARROWSHOWER("Arrow Shower",ChatColor.GRAY+"[Unimplemented] 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,UpgradePath.BOW),
|
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},
|
TARGETING("Targeting",ChatColor.GRAY+"[Unimplemented] 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,UpgradePath.BOW),
|
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},
|
ENDERTURRET("Ender Turret",ChatColor.GRAY+"[Unimplemented] 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,UpgradePath.BOW),
|
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
|
//Armor abilities
|
||||||
@ -64,29 +64,35 @@ public enum ArtifactAbility {
|
|||||||
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),
|
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},
|
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),
|
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},
|
SHADOWWALKER("Shadow Walker",ChatColor.GRAY+"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),
|
new double[]{1.5,1.4,1.3,1.2,1.1,1.0,0.9,0.8,0.7,0.55},100,10,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},
|
SURVIVOR("Survivor",ChatColor.GRAY+"[Unimplemented] Taking fatal damage will not kill you and instead consume this ability, removes all debuffs, and restoring your health.",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),
|
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},
|
DODGE("Dodge",ChatColor.GRAY+"You have a [VAL]% chance to dodge incoming damage from any damage source.",new double[]{0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,0.55},
|
||||||
new double[]{3,3,3,3,3,3,3,3,3,3},100,1000,UpgradePath.ARMOR),
|
new double[]{1.0,1.0,1.0,0.8,0.7,0.6,0.5,0.4,0.3,0.2},100,40,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},
|
GRACEFULDODGE("Graceful Dodge","Whenever a dodge occurs, you will gain [VAL] seconds of invulnerability.",new double[]{0.5,0.6,0.7,0.8,0.9,1.0,1.1,1.2,1.3,1.5},
|
||||||
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),
|
new double[]{1.8,1.78,1.76,1.74,1.72,1.70,1.68,1.66,1.64,1.62},10,40,UpgradePath.ARMOR),
|
||||||
|
|
||||||
//Sword abilities
|
//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},
|
PROVOKE("Provoke","Your attacks provoke enemies for [VAL] seconds.",new double[]{3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.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),
|
new double[]{3.0,2.8,2.6,2.4,2.2,2.2,2.0,1.8,1.6,1.4},100,10,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},
|
COMBO("Belligerent","[VAL]% more damage for each successive strike on a mob. Resets after 2 seconds of no combat.",new double[]{1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,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.SWORD),
|
new double[]{1.0,0.95,0.9,0.85,0.8,0.75,0.7,0.65,0.6,0.55},100,40,UpgradePath.SWORD),
|
||||||
|
|
||||||
//Pickaxe abilities
|
//Pickaxe abilities
|
||||||
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},
|
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),
|
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),
|
||||||
|
MINES("Land Mine",ChatColor.GRAY+"[Unimplemented]While in combat, throw your pickaxe to send land mines towards your enemies. On contact they deal [VAL] damage.",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
|
//Shovel abilities
|
||||||
SUPPRESS("Suppression",ChatColor.GRAY+"[Unimplemented] 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},
|
+ "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,1000,UpgradePath.SHOVEL),
|
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),
|
||||||
|
ERUPTION("Eruption","Sneak while Left-clicking a mob to damage mobs for [VAL] damage and knock them up. The eruption also destroys the ground beneath you.",new double[]{6.0,7,8.0,9,10.0,11,12.0,13,14.0,15},
|
||||||
|
new double[]{1.0,0.925,0.85,0.775,0.7,0.625,0.55,0.475,0.4,0.325},100,40,UpgradePath.SHOVEL),
|
||||||
|
EARTHWAVE("Earth Wave","While in combat, destroy a block to send a wave of earth towards your enemies. Enemies standing inside of the waves take [VAL] damage every second.",new double[]{8,9,10,11,12,13,14,15,16,18},
|
||||||
|
new double[]{2.4,2.2,2.0,1.9,1.8,1.7,1.6,1.5,1.4,1.2},100,100,UpgradePath.SHOVEL),
|
||||||
|
|
||||||
//Axe abilities
|
//Axe abilities
|
||||||
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},
|
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},
|
||||||
@ -101,16 +107,16 @@ public enum ArtifactAbility {
|
|||||||
new double[]{0.6,0.575,0.55,0.525,0.5,0.475,0.45,0.425,0.4,0.375},100,10,UpgradePath.SCYTHE),
|
new double[]{0.6,0.575,0.55,0.525,0.5,0.475,0.45,0.425,0.4,0.375},100,10,UpgradePath.SCYTHE),
|
||||||
|
|
||||||
//General abilities
|
//General abilities
|
||||||
AUTOREPAIR("Auto Repair",ChatColor.GRAY+"[Unimplemented] [REPAIRCHANCE]% chance to repair [VAL] durability to the artifact item every 10 seconds.\n\nThe item must be sitting in your hotbar or must be equipped for this ability to work.",new double[]{10,15,20,25,27.5,30,32.5,35,37.5,40},
|
AUTOREPAIR("Auto Repair","1% chance to repair [VAL] durability to the artifact item every second.\n\nThe item must be sitting in your hotbar or must be equipped for this ability to work.",new double[]{15,16,17,18,19,20,21,22,23,24},
|
||||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},10,1,UpgradePath.ALL),
|
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},10,1,UpgradePath.ALL),
|
||||||
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},
|
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,1000,UpgradePath.ALL),
|
new double[]{2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0},100,10,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},
|
/*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),*/
|
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},
|
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),
|
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},
|
PRESERVATION("Preservation","Potential decays [VAL]% slower.",new double[]{1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,7.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),
|
new double[]{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0},20,1,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},
|
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),
|
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),
|
||||||
|
|
||||||
@ -193,7 +199,7 @@ public enum ArtifactAbility {
|
|||||||
TwosideKeeper.log("Ability "+ability.GetName(), 4);
|
TwosideKeeper.log("Ability "+ability.GetName(), 4);
|
||||||
for(int i=0;i<abilitylevel;i++){
|
for(int i=0;i<abilitylevel;i++){
|
||||||
TwosideKeeper.log("Old Sum:"+sum+"::i:"+i, 5);
|
TwosideKeeper.log("Old Sum:"+sum+"::i:"+i, 5);
|
||||||
sum+=1/(1+(ability.GetDecayValue(artifacttier)*i));
|
sum+=1d/(1d+(ability.GetDecayValue(artifacttier)*(double)i));
|
||||||
TwosideKeeper.log("New Sum:"+sum+"::i:"+i, 5);
|
TwosideKeeper.log("New Sum:"+sum+"::i:"+i, 5);
|
||||||
}
|
}
|
||||||
TwosideKeeper.log("Sum is "+sum, 5);
|
TwosideKeeper.log("Sum is "+sum, 5);
|
||||||
@ -260,6 +266,23 @@ public enum ArtifactAbility {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ItemStack removeEnchantment(ArtifactAbility ability, ItemStack item) {
|
||||||
|
ItemMeta m = item.getItemMeta();
|
||||||
|
List<String> lore = m.getLore();
|
||||||
|
if (containsEnchantment(ability,item)) {
|
||||||
|
for (int i=0;i<lore.size();i++) {
|
||||||
|
if (lore.get(i).contains(ability.GetName())) {
|
||||||
|
//This is the line! Remove it.
|
||||||
|
lore.remove(i);
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m.setLore(lore);
|
||||||
|
item.setItemMeta(m);
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
static boolean hasCurse(ItemStack item) {
|
static boolean hasCurse(ItemStack item) {
|
||||||
HashMap<ArtifactAbility,Integer> map = getEnchantments(item);
|
HashMap<ArtifactAbility,Integer> map = getEnchantments(item);
|
||||||
if (map.containsKey(REDUCEDMG) ||
|
if (map.containsKey(REDUCEDMG) ||
|
||||||
@ -373,6 +396,22 @@ public enum ArtifactAbility {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ItemStack downgradeEnchantment(Player p, ItemStack item, ArtifactAbility ability) {
|
||||||
|
if (isCompatibleWithUpgrade(item,ability.upgrade)) {
|
||||||
|
if (getEnchantmentLevel(ability,item)>1) { //This is more than 1 level, so we just remove one level from it.
|
||||||
|
//This is allowed. Proceed.
|
||||||
|
item = applyEnchantment(ability,getEnchantmentLevel(ability,item)-1,item);
|
||||||
|
AwakenedArtifact.addAP(item, 1);
|
||||||
|
} else {
|
||||||
|
//Just remove it completely.
|
||||||
|
removeEnchantment(ability,item);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
p.sendMessage(ChatColor.RED+"This upgrade is not compatible with this item!");
|
||||||
|
}
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
public static ItemStack upgradeEnchantment(Player p, ItemStack item, ArtifactAbility ability) {
|
public static ItemStack upgradeEnchantment(Player p, ItemStack item, ArtifactAbility ability) {
|
||||||
//Verifies that the enchantment can be upgraded firstly.
|
//Verifies that the enchantment can be upgraded firstly.
|
||||||
//Get the level we are upgrading to.
|
//Get the level we are upgrading to.
|
||||||
@ -516,6 +555,8 @@ public enum ArtifactAbility {
|
|||||||
text=DisplayAbility(EXECUTION,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.SHOVEL) {
|
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");}
|
text=DisplayAbility(SUPPRESS,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||||
|
text=DisplayAbility(ERUPTION,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||||
|
text=DisplayAbility(EARTHWAVE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||||
} else
|
} else
|
||||||
if (path==UpgradePath.PICKAXE) {
|
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");}
|
text=DisplayAbility(SCAVENGE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
|
||||||
@ -538,7 +579,8 @@ public enum ArtifactAbility {
|
|||||||
msg=msg.replace("[PENDMG]", ChatColor.BLUE+df.format(calculateValue(ability,tier,abilitylv)/100*playerdmgval)+ChatColor.RESET); //Based on multiplying [VAL] by the base damage value.
|
msg=msg.replace("[PENDMG]", ChatColor.BLUE+df.format(calculateValue(ability,tier,abilitylv)/100*playerdmgval)+ChatColor.RESET); //Based on multiplying [VAL] by the base damage value.
|
||||||
msg=msg.replace("[HUNGERVAL]", ChatColor.BLUE+df.format(10*abilitylv)+ChatColor.RESET);
|
msg=msg.replace("[HUNGERVAL]", ChatColor.BLUE+df.format(10*abilitylv)+ChatColor.RESET);
|
||||||
msg=msg.replace("[FATALDMG]", ChatColor.BLUE+df.format(120*abilitylv)+ChatColor.RESET);
|
msg=msg.replace("[FATALDMG]", ChatColor.BLUE+df.format(120*abilitylv)+ChatColor.RESET);
|
||||||
msg=msg.replace("[REPAIRCHANCE]", ChatColor.BLUE+df.format(tier)+ChatColor.RESET);
|
msg=msg.replace("[REPAIRCHANCE]", ChatColor.BLUE+df.format(tier/3)+ChatColor.RESET);
|
||||||
|
msg=msg.replace("[DODGEVAL]", ChatColor.BLUE+df.format(tier)+ChatColor.RESET);
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
public static String displayDescriptionUpgrade(ArtifactAbility ability, int tier, int fromlv, int tolv, double playerdmgval) { //Level to display information for.
|
public static String displayDescriptionUpgrade(ArtifactAbility ability, int tier, int fromlv, int tolv, double playerdmgval) { //Level to display information for.
|
||||||
@ -548,7 +590,8 @@ public enum ArtifactAbility {
|
|||||||
msg=msg.replace("[PENDMG]", DisplayChangedValue(df.format(calculateValue(ability,tier,fromlv)/100*playerdmgval),df.format(calculateValue(ability,tier,tolv)/100*playerdmgval))); //Based on multiplying [VAL] by the base damage value.
|
msg=msg.replace("[PENDMG]", DisplayChangedValue(df.format(calculateValue(ability,tier,fromlv)/100*playerdmgval),df.format(calculateValue(ability,tier,tolv)/100*playerdmgval))); //Based on multiplying [VAL] by the base damage value.
|
||||||
msg=msg.replace("[HUNGERVAL]", DisplayBadChangedValue(df.format(10*fromlv),df.format(10*tolv)));
|
msg=msg.replace("[HUNGERVAL]", DisplayBadChangedValue(df.format(10*fromlv),df.format(10*tolv)));
|
||||||
msg=msg.replace("[FATALDMG]", DisplayChangedValue(df.format(120-fromlv),df.format(120-tolv)));
|
msg=msg.replace("[FATALDMG]", DisplayChangedValue(df.format(120-fromlv),df.format(120-tolv)));
|
||||||
msg=msg.replace("[REPAIRCHANCE]", DisplayChangedValue(df.format(tier),df.format(tier)));
|
msg=msg.replace("[REPAIRCHANCE]", DisplayChangedValue(df.format(tier),df.format(tier/3)));
|
||||||
|
msg=msg.replace("[DODGEVAL]", DisplayChangedValue(df.format(tier),df.format(tier)));
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@ import sig.plugin.TwosideKeeper.Artifact;
|
|||||||
import sig.plugin.TwosideKeeper.AwakenedArtifact;
|
import sig.plugin.TwosideKeeper.AwakenedArtifact;
|
||||||
import sig.plugin.TwosideKeeper.MonsterController;
|
import sig.plugin.TwosideKeeper.MonsterController;
|
||||||
import sig.plugin.TwosideKeeper.TwosideKeeper;
|
import sig.plugin.TwosideKeeper.TwosideKeeper;
|
||||||
|
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactAbility;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.WorldShop;
|
import sig.plugin.TwosideKeeper.HelperStructures.WorldShop;
|
||||||
|
|
||||||
public class GenericFunctions {
|
public class GenericFunctions {
|
||||||
@ -1612,7 +1613,8 @@ public class GenericFunctions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isEquip(ItemStack item) {
|
public static boolean isEquip(ItemStack item) {
|
||||||
if (item.getType().toString().contains("SPADE") ||
|
if (item!=null &&
|
||||||
|
item.getType()!=Material.AIR && (item.getType().toString().contains("SPADE") ||
|
||||||
item.getType().toString().contains("AXE") ||
|
item.getType().toString().contains("AXE") ||
|
||||||
item.getType().toString().contains("SWORD") ||
|
item.getType().toString().contains("SWORD") ||
|
||||||
item.getType().toString().contains("BOW") ||
|
item.getType().toString().contains("BOW") ||
|
||||||
@ -1622,7 +1624,7 @@ public class GenericFunctions {
|
|||||||
item.getType().toString().contains("CHESTPLATE") ||
|
item.getType().toString().contains("CHESTPLATE") ||
|
||||||
item.getType().toString().contains("LEGGINGS") ||
|
item.getType().toString().contains("LEGGINGS") ||
|
||||||
item.getType().toString().contains("HELMET") ||
|
item.getType().toString().contains("HELMET") ||
|
||||||
item.getType().toString().contains("FISHING_ROD")) {
|
item.getType().toString().contains("FISHING_ROD"))) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -1630,12 +1632,13 @@ public class GenericFunctions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isTool(ItemStack item) {
|
public static boolean isTool(ItemStack item) {
|
||||||
if (item.getType().toString().contains("SPADE") ||
|
if (item!=null &&
|
||||||
|
item.getType()!=Material.AIR && (item.getType().toString().contains("SPADE") ||
|
||||||
item.getType().toString().contains("AXE") ||
|
item.getType().toString().contains("AXE") ||
|
||||||
item.getType().toString().contains("SWORD") ||
|
item.getType().toString().contains("SWORD") ||
|
||||||
item.getType().toString().contains("HOE") ||
|
item.getType().toString().contains("HOE") ||
|
||||||
item.getType().toString().contains("FISHING_ROD") ||
|
item.getType().toString().contains("FISHING_ROD") ||
|
||||||
item.getType().toString().contains("BOW")) {
|
item.getType().toString().contains("BOW"))) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -1643,9 +1646,10 @@ public class GenericFunctions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isHarvestingTool(ItemStack item) {
|
public static boolean isHarvestingTool(ItemStack item) {
|
||||||
if (item.getType().toString().contains("SPADE") ||
|
if (item!=null &&
|
||||||
|
item.getType()!=Material.AIR && (item.getType().toString().contains("SPADE") ||
|
||||||
item.getType().toString().contains("AXE") ||
|
item.getType().toString().contains("AXE") ||
|
||||||
item.getType().toString().contains("HOE")) {
|
item.getType().toString().contains("HOE"))) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -1653,11 +1657,12 @@ public class GenericFunctions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isWeapon(ItemStack item) {
|
public static boolean isWeapon(ItemStack item) {
|
||||||
if (item.getType().toString().contains("BOW") ||
|
if (item!=null &&
|
||||||
|
item.getType()!=Material.AIR && (item.getType().toString().contains("BOW") ||
|
||||||
item.getType().toString().contains("AXE") ||
|
item.getType().toString().contains("AXE") ||
|
||||||
item.getType().toString().contains("SWORD") ||
|
item.getType().toString().contains("SWORD") ||
|
||||||
item.getType().toString().contains("FISHING_ROD") ||
|
item.getType().toString().contains("FISHING_ROD") ||
|
||||||
item.getType().toString().contains("HOE")) {
|
item.getType().toString().contains("HOE"))) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -1665,10 +1670,11 @@ public class GenericFunctions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isArmor(ItemStack item) {
|
public static boolean isArmor(ItemStack item) {
|
||||||
if (item.getType().toString().contains("BOOTS") ||
|
if (item!=null &&
|
||||||
|
item.getType()!=Material.AIR && (item.getType().toString().contains("BOOTS") ||
|
||||||
item.getType().toString().contains("CHESTPLATE") ||
|
item.getType().toString().contains("CHESTPLATE") ||
|
||||||
item.getType().toString().contains("LEGGINGS") ||
|
item.getType().toString().contains("LEGGINGS") ||
|
||||||
item.getType().toString().contains("HELMET")) {
|
item.getType().toString().contains("HELMET"))) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -1676,21 +1682,23 @@ public class GenericFunctions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isArtifactWeapon(ItemStack item) {
|
public static boolean isArtifactWeapon(ItemStack item) {
|
||||||
if (item.getType().toString().contains("BOW") ||
|
if (item!=null &&
|
||||||
|
item.getType()!=Material.AIR && (item.getType().toString().contains("BOW") ||
|
||||||
item.getType().toString().contains("AXE") ||
|
item.getType().toString().contains("AXE") ||
|
||||||
item.getType().toString().contains("SWORD") ||
|
item.getType().toString().contains("SWORD") ||
|
||||||
item.getType().toString().contains("FISHING_ROD") ||
|
item.getType().toString().contains("FISHING_ROD") ||
|
||||||
item.getType().toString().contains("HOE")) {
|
item.getType().toString().contains("HOE"))) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static boolean isArtifactArmor(ItemStack item) {
|
public static boolean isArtifactArmor(ItemStack item) {
|
||||||
if (item.getType().toString().contains("BOOTS") ||
|
if (item!=null &&
|
||||||
|
item.getType()!=Material.AIR && (item.getType().toString().contains("BOOTS") ||
|
||||||
item.getType().toString().contains("CHESTPLATE") ||
|
item.getType().toString().contains("CHESTPLATE") ||
|
||||||
item.getType().toString().contains("LEGGINGS") ||
|
item.getType().toString().contains("LEGGINGS") ||
|
||||||
item.getType().toString().contains("HELMET")) {
|
item.getType().toString().contains("HELMET"))) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -1698,9 +1706,10 @@ public class GenericFunctions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isArtifactTool(ItemStack item) {
|
public static boolean isArtifactTool(ItemStack item) {
|
||||||
if (item.getType().toString().contains("SPADE") ||
|
if (item!=null &&
|
||||||
|
item.getType()!=Material.AIR && (item.getType().toString().contains("SPADE") ||
|
||||||
item.getType().toString().contains("AXE")||
|
item.getType().toString().contains("AXE")||
|
||||||
item.getType().toString().contains("HOE")) {
|
item.getType().toString().contains("HOE"))) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -2036,4 +2045,97 @@ public class GenericFunctions {
|
|||||||
}
|
}
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static double CalculateDodgeChance(Player p) {
|
||||||
|
double dodgechance = 0.0d;
|
||||||
|
dodgechance+=(ArtifactAbility.calculateValue(ArtifactAbility.DODGE, p.getEquipment().getItemInMainHand().getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.DODGE, p.getEquipment().getItemInMainHand()))/100d);
|
||||||
|
|
||||||
|
for (int i=0;i<p.getEquipment().getArmorContents().length;i++) {
|
||||||
|
if (ArtifactAbility.containsEnchantment(ArtifactAbility.SHADOWWALKER, p.getEquipment().getArmorContents()[i]) &&
|
||||||
|
p.isOnGround() && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=4) {
|
||||||
|
dodgechance+=0.01*p.getEquipment().getArmorContents()[i].getEnchantmentLevel(Enchantment.LUCK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ArtifactAbility.containsEnchantment(ArtifactAbility.SHADOWWALKER, p.getEquipment().getItemInMainHand()) &&
|
||||||
|
p.isOnGround() && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=4) {
|
||||||
|
dodgechance+=0.01*p.getEquipment().getItemInMainHand().getEnchantmentLevel(Enchantment.LUCK);
|
||||||
|
}
|
||||||
|
return dodgechance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AutoRepairItems(Player p) {
|
||||||
|
for (int i=0;i<9;i++) {
|
||||||
|
if (ArtifactAbility.containsEnchantment(ArtifactAbility.AUTOREPAIR, p.getInventory().getItem(i))) {
|
||||||
|
//Chance to auto repair.
|
||||||
|
double repairamt = ArtifactAbility.calculateValue(ArtifactAbility.AUTOREPAIR, p.getInventory().getItem(i).getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.AUTOREPAIR, p.getInventory().getItem(i)));
|
||||||
|
if (Math.random() <= repairamt%1) {
|
||||||
|
repairamt++;
|
||||||
|
}
|
||||||
|
double chance = 1;
|
||||||
|
if (Math.random()<=chance/100d) {
|
||||||
|
if (p.getInventory().getItem(i).getDurability()-repairamt<0) {
|
||||||
|
p.getInventory().getItem(i).setDurability((short)0);
|
||||||
|
TwosideKeeper.log("Repaired "+p.getInventory().getItem(i).toString()+" to full durability.", 5);
|
||||||
|
} else {
|
||||||
|
p.getInventory().getItem(i).setDurability((short)(p.getInventory().getItem(i).getDurability()-repairamt));
|
||||||
|
TwosideKeeper.log("Repaired "+repairamt+" durability to "+p.getInventory().getItem(i).toString()+"", 5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ItemStack[] contents = {p.getEquipment().getHelmet(),p.getEquipment().getChestplate(),p.getEquipment().getLeggings(),p.getEquipment().getBoots()};
|
||||||
|
for (int i=0;i<contents.length;i++) {
|
||||||
|
ItemStack equip = contents[i];
|
||||||
|
if (ArtifactAbility.containsEnchantment(ArtifactAbility.AUTOREPAIR, equip)) {
|
||||||
|
//Chance to auto repair.
|
||||||
|
double repairamt = ArtifactAbility.calculateValue(ArtifactAbility.AUTOREPAIR, equip.getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.AUTOREPAIR, equip));
|
||||||
|
if (Math.random() <= repairamt%1) {
|
||||||
|
repairamt++;
|
||||||
|
}
|
||||||
|
double chance = 1;
|
||||||
|
if (Math.random()<=chance/100d) {
|
||||||
|
if (equip.getDurability()-repairamt<0) {
|
||||||
|
equip.setDurability((short)0);
|
||||||
|
TwosideKeeper.log("Repaired "+equip.toString()+" to full durability.", 5);
|
||||||
|
} else {
|
||||||
|
p.getInventory().getItem(i).setDurability((short)(equip.getDurability()-repairamt));
|
||||||
|
TwosideKeeper.log("Repaired "+repairamt+" durability to "+equip.toString()+"", 5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void DealDamageToMob(double dmg, LivingEntity target, LivingEntity damager, boolean truedmg) {
|
||||||
|
if (damager!=null && (target instanceof Monster)) {
|
||||||
|
Monster m = (Monster)target;
|
||||||
|
m.setTarget(damager);
|
||||||
|
}
|
||||||
|
|
||||||
|
double finaldmg = 0;
|
||||||
|
if (truedmg) {
|
||||||
|
finaldmg = dmg;
|
||||||
|
} else {
|
||||||
|
finaldmg = TwosideKeeper.CalculateDamageReduction(dmg, target, damager);
|
||||||
|
}
|
||||||
|
if ((target instanceof Monster) && damager!=null) {
|
||||||
|
Monster m = (Monster)target;
|
||||||
|
m.setTarget(damager);
|
||||||
|
}
|
||||||
|
if (target.getHealth()>dmg) {
|
||||||
|
target.setHealth(target.getHealth()-dmg);
|
||||||
|
if (damager!=null) {
|
||||||
|
target.damage(0.01);
|
||||||
|
} else {
|
||||||
|
target.damage(0.01,damager);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
target.setHealth(0);
|
||||||
|
if (damager!=null) {
|
||||||
|
target.damage(0.01);
|
||||||
|
} else {
|
||||||
|
target.damage(0.01,damager);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,9 @@ public class PlayerStructure {
|
|||||||
public boolean sounds_enabled=true;
|
public boolean sounds_enabled=true;
|
||||||
public double velocity;
|
public double velocity;
|
||||||
public long last_deathmark=TwosideKeeper.getServerTickTime();
|
public long last_deathmark=TwosideKeeper.getServerTickTime();
|
||||||
|
public long last_shovelspell=TwosideKeeper.getServerTickTime();
|
||||||
|
public int swordcombo=0;
|
||||||
|
public long last_swordhit=TwosideKeeper.getServerTickTime();
|
||||||
|
|
||||||
public double prev_weapondmg=0.0;
|
public double prev_weapondmg=0.0;
|
||||||
public double prev_buffdmg=0.0;
|
public double prev_buffdmg=0.0;
|
||||||
@ -87,6 +90,9 @@ public class PlayerStructure {
|
|||||||
this.sounds_enabled=true;
|
this.sounds_enabled=true;
|
||||||
this.debuffcount=0;
|
this.debuffcount=0;
|
||||||
this.last_deathmark=TwosideKeeper.getServerTickTime();
|
this.last_deathmark=TwosideKeeper.getServerTickTime();
|
||||||
|
this.last_shovelspell=TwosideKeeper.getServerTickTime();
|
||||||
|
this.swordcombo=0;
|
||||||
|
this.last_swordhit=TwosideKeeper.getServerTickTime();
|
||||||
//Set defaults first, in case this is a new user.
|
//Set defaults first, in case this is a new user.
|
||||||
loadConfig();
|
loadConfig();
|
||||||
|
|
||||||
|
@ -16,8 +16,11 @@ import java.util.logging.LogRecord;
|
|||||||
import org.apache.commons.lang.WordUtils;
|
import org.apache.commons.lang.WordUtils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Color;
|
||||||
|
import org.bukkit.Effect;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Particle;
|
||||||
import org.bukkit.Server.Spigot;
|
import org.bukkit.Server.Spigot;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.WorldCreator;
|
import org.bukkit.WorldCreator;
|
||||||
@ -32,6 +35,7 @@ import org.bukkit.configuration.file.FileConfiguration;
|
|||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.Animals;
|
import org.bukkit.entity.Animals;
|
||||||
|
import org.bukkit.entity.AreaEffectCloud;
|
||||||
import org.bukkit.entity.Arrow;
|
import org.bukkit.entity.Arrow;
|
||||||
import org.bukkit.entity.Bat;
|
import org.bukkit.entity.Bat;
|
||||||
import org.bukkit.entity.ComplexLivingEntity;
|
import org.bukkit.entity.ComplexLivingEntity;
|
||||||
@ -46,6 +50,7 @@ import org.bukkit.entity.Horse.Variant;
|
|||||||
import org.bukkit.entity.HumanEntity;
|
import org.bukkit.entity.HumanEntity;
|
||||||
import org.bukkit.entity.Item;
|
import org.bukkit.entity.Item;
|
||||||
import org.bukkit.entity.LightningStrike;
|
import org.bukkit.entity.LightningStrike;
|
||||||
|
import org.bukkit.entity.LingeringPotion;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Monster;
|
import org.bukkit.entity.Monster;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -63,6 +68,7 @@ import org.bukkit.event.block.BlockBreakEvent;
|
|||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
import org.bukkit.event.block.BlockRedstoneEvent;
|
import org.bukkit.event.block.BlockRedstoneEvent;
|
||||||
import org.bukkit.event.block.SignChangeEvent;
|
import org.bukkit.event.block.SignChangeEvent;
|
||||||
|
import org.bukkit.event.entity.AreaEffectCloudApplyEvent;
|
||||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||||
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
@ -132,8 +138,10 @@ import org.bukkit.metadata.MetadataValue;
|
|||||||
import org.bukkit.metadata.Metadatable;
|
import org.bukkit.metadata.Metadatable;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import org.bukkit.potion.PotionData;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
import org.bukkit.potion.PotionType;
|
||||||
import org.bukkit.projectiles.ProjectileSource;
|
import org.bukkit.projectiles.ProjectileSource;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@ -141,6 +149,7 @@ import com.google.common.collect.Iterables;
|
|||||||
import com.google.common.collect.Iterators;
|
import com.google.common.collect.Iterators;
|
||||||
|
|
||||||
import aPlugin.DiscordMessageSender;
|
import aPlugin.DiscordMessageSender;
|
||||||
|
import net.md_5.bungee.api.chat.ClickEvent;
|
||||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||||
import net.md_5.bungee.api.chat.HoverEvent;
|
import net.md_5.bungee.api.chat.HoverEvent;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
@ -508,16 +517,32 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
!p.isDead() && //Um, don't heal them if they're dead...That's just weird.
|
!p.isDead() && //Um, don't heal them if they're dead...That's just weird.
|
||||||
p.getHealth()<p.getMaxHealth() &&
|
p.getHealth()<p.getMaxHealth() &&
|
||||||
p.getFoodLevel()>=16) {
|
p.getFoodLevel()>=16) {
|
||||||
|
|
||||||
|
double totalregen = 1+(p.getMaxHealth()*0.05);
|
||||||
ItemStack[] equips = p.getEquipment().getArmorContents();
|
ItemStack[] equips = p.getEquipment().getArmorContents();
|
||||||
double bonusregen = 0.0;
|
double bonusregen = 0.0;
|
||||||
for (int i1=0;i1<equips.length;i1++) {
|
for (int i1=0;i1<equips.length;i1++) {
|
||||||
if (GenericFunctions.isArtifactEquip(equips[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]));
|
double regenamt = ArtifactAbility.calculateValue(ArtifactAbility.HEALTH_REGEN, equips[i1].getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.HEALTH_REGEN, equips[i1]));
|
||||||
bonusregen += regenamt;
|
bonusregen += regenamt;
|
||||||
log("Bonus regen increased by "+regenamt,2);
|
log("Bonus regen increased by "+regenamt,5);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p.setHealth((p.getHealth()+1+(p.getMaxHealth()*0.05)+bonusregen>p.getMaxHealth())?p.getMaxHealth():p.getHealth()+1+(p.getMaxHealth()*0.05)+bonusregen);
|
|
||||||
|
|
||||||
|
totalregen += bonusregen;
|
||||||
|
|
||||||
|
for (int i1=0;i1<equips.length;i1++) {
|
||||||
|
if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, equips[i1])) {
|
||||||
|
totalregen /= Math.pow(ArtifactAbility.getEnchantmentLevel(ArtifactAbility.GREED, equips[i1]),2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand())) {
|
||||||
|
totalregen /= Math.pow(ArtifactAbility.getEnchantmentLevel(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand()),2);
|
||||||
|
}
|
||||||
|
|
||||||
|
p.setHealth((p.getHealth()+totalregen>p.getMaxHealth())?p.getMaxHealth():p.getHealth()+totalregen);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -556,7 +581,24 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Base Damage: "+ChatColor.RESET+""+ChatColor.DARK_PURPLE+df.format(pd.damagedealt)+" "+ChatColor.GRAY+ChatColor.ITALIC+"Damage Reduction: "+ChatColor.RESET+""+ChatColor.DARK_AQUA+Math.round((1.0-pd.damagereduction)*100)+"%");
|
p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Base Damage: "+ChatColor.RESET+""+ChatColor.DARK_PURPLE+df.format(pd.damagedealt)+" "+ChatColor.GRAY+ChatColor.ITALIC+"Damage Reduction: "+ChatColor.RESET+""+ChatColor.DARK_AQUA+Math.round((1.0-pd.damagereduction)*100)+"%");
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
for (int i3=0;i3<p.getEquipment().getArmorContents().length;i3++) {
|
||||||
|
if (ArtifactAbility.containsEnchantment(ArtifactAbility.SHADOWWALKER, p.getEquipment().getArmorContents()[i3]) &&
|
||||||
|
p.isOnGround() && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=4) {
|
||||||
|
p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,20,2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ArtifactAbility.containsEnchantment(ArtifactAbility.SHADOWWALKER, p.getEquipment().getItemInMainHand()) &&
|
||||||
|
p.isOnGround() && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=4) {
|
||||||
|
p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,20,2));
|
||||||
|
//log("Apply speed. The light level here is "+p.getLocation().add(0,-1,0).getBlock().getLightLevel(),2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ArtifactAbility.containsEnchantment(ArtifactAbility.COMBO, p.getEquipment().getItemInMainHand()) &&
|
||||||
|
pd.last_swordhit+100<getServerTickTime()) {
|
||||||
|
pd.swordcombo=0; //Reset the sword combo meter since the time limit expired.
|
||||||
|
}
|
||||||
|
|
||||||
|
GenericFunctions.AutoRepairItems(p);
|
||||||
|
|
||||||
//Try to fit into an already existing party.
|
//Try to fit into an already existing party.
|
||||||
boolean inParty=false;
|
boolean inParty=false;
|
||||||
@ -683,8 +725,14 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
if (SERVER_TYPE==ServerType.TEST || SERVER_TYPE==ServerType.QUIET) {
|
if (SERVER_TYPE==ServerType.TEST || SERVER_TYPE==ServerType.QUIET) {
|
||||||
|
|
||||||
//ItemStack item = p.getEquipment().getItemInMainHand();
|
for (int i=0;i<p.getEquipment().getArmorContents().length;i++) {
|
||||||
//AwakenedArtifact.addPotentialEXP(item, 100, p);
|
if (GenericFunctions.isArtifactEquip(p.getEquipment().getArmorContents()[i]) &&
|
||||||
|
GenericFunctions.isArtifactArmor(p.getEquipment().getArmorContents()[i])) {
|
||||||
|
AwakenedArtifact.addPotentialEXP(p.getEquipment().getArmorContents()[i], 500, p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ItemStack item = p.getEquipment().getItemInMainHand();
|
||||||
|
AwakenedArtifact.addPotentialEXP(item, 50000, p);
|
||||||
//p.sendMessage(tpstracker.getTPS()+"");
|
//p.sendMessage(tpstracker.getTPS()+"");
|
||||||
//GenericFunctions.addObscureHardenedItemBreaks(p.getEquipment().getItemInMainHand(), 4);
|
//GenericFunctions.addObscureHardenedItemBreaks(p.getEquipment().getItemInMainHand(), 4);
|
||||||
}
|
}
|
||||||
@ -840,6 +888,18 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
if (cmd.getName().equalsIgnoreCase("awakenedartifact")) {
|
if (cmd.getName().equalsIgnoreCase("awakenedartifact")) {
|
||||||
|
if (args.length==2 && args[0].equalsIgnoreCase("menu")) {
|
||||||
|
Player p = Bukkit.getPlayer(sender.getName());
|
||||||
|
if (Integer.parseInt(args[1])>=900) {
|
||||||
|
if (p.getInventory().getArmorContents()[Integer.parseInt(args[1])-900]!=null) {
|
||||||
|
p.spigot().sendMessage(ArtifactAbility.GenerateMenu(ArtifactItemType.getArtifactItemTypeFromItemStack(p.getInventory().getArmorContents()[Integer.parseInt(args[1])-900]).getUpgradePath(), CalculateDamageReduction(1,p,p), p.getInventory().getArmorContents()[Integer.parseInt(args[1])-900]));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (p.getEquipment().getItemInMainHand()!=null) {
|
||||||
|
p.spigot().sendMessage(ArtifactAbility.GenerateMenu(ArtifactItemType.getArtifactItemTypeFromItemStack(p.getEquipment().getItemInMainHand()).getUpgradePath(), CalculateDamageReduction(1,p,p), p.getEquipment().getItemInMainHand()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else
|
||||||
if (args.length==2 && args[0].equalsIgnoreCase("levelup")) {
|
if (args.length==2 && args[0].equalsIgnoreCase("levelup")) {
|
||||||
Player p = (Player)sender;
|
Player p = (Player)sender;
|
||||||
//Argument0 is "levelup"
|
//Argument0 is "levelup"
|
||||||
@ -859,9 +919,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
} else {
|
} else {
|
||||||
//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 &&
|
||||||
|
p.getEquipment().getItemInMainHand().getType()!=Material.AIR) {
|
||||||
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()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else
|
||||||
if (cmd.getName().equalsIgnoreCase("awakenedartifact_ability")) {
|
if (cmd.getName().equalsIgnoreCase("awakenedartifact_ability")) {
|
||||||
@ -3167,13 +3230,37 @@ 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);
|
||||||
|
if (Math.random()<=dodgechance) {
|
||||||
|
//Cancel this event, we dodged the attack.
|
||||||
|
p.playSound(p.getLocation(), Sound.ENTITY_PLAYER_ATTACK_SWEEP, 3.0f, 1.0f);
|
||||||
|
log("Triggered Dodge.",2);
|
||||||
|
for (int i=0;i<p.getEquipment().getArmorContents().length;i++) {
|
||||||
|
ItemStack equip = p.getEquipment().getArmorContents()[i];
|
||||||
|
if (ArtifactAbility.containsEnchantment(ArtifactAbility.GRACEFULDODGE, equip)) {
|
||||||
|
p.addPotionEffect(
|
||||||
|
new PotionEffect(PotionEffectType.GLOWING,
|
||||||
|
(int)(ArtifactAbility.calculateValue(ArtifactAbility.GRACEFULDODGE, equip.getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.GRACEFULDODGE, equip))*20),
|
||||||
|
0)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ev.setCancelled(true);
|
||||||
|
}
|
||||||
|
//If glowing, the player is invulnerable.
|
||||||
|
if (p.hasPotionEffect(PotionEffectType.GLOWING)) {
|
||||||
|
p.setNoDamageTicks(20);
|
||||||
|
ev.setCancelled(true);
|
||||||
|
}
|
||||||
|
log("Dodge chance is "+dodgechance,2);
|
||||||
|
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
|
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
|
||||||
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));
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
,5);
|
,2);
|
||||||
} else {
|
} else {
|
||||||
if (e instanceof Monster) {
|
if (e instanceof Monster) {
|
||||||
final Monster m = (Monster)e;
|
final Monster m = (Monster)e;
|
||||||
@ -3204,6 +3291,15 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ev.getEntity() instanceof Player) {
|
||||||
|
Player p = (Player)ev.getEntity();
|
||||||
|
|
||||||
|
if (ev.getFinalDamage()>=p.getHealth()) {
|
||||||
|
//The player actually died from this attack.
|
||||||
|
log("The player died from this attack. "+ev.getFinalDamage()+">"+p.getHealth(),2);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority=EventPriority.LOW)
|
@EventHandler(priority=EventPriority.LOW)
|
||||||
@ -3373,6 +3469,21 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
//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) {
|
||||||
DealDamageToMob(p.getInventory().getItemInMainHand(),p,m);
|
DealDamageToMob(p.getInventory().getItemInMainHand(),p,m);
|
||||||
|
if (ArtifactAbility.containsEnchantment(ArtifactAbility.PROVOKE, p.getEquipment().getItemInMainHand())) {
|
||||||
|
ArtifactAbility.calculateValue(ArtifactAbility.PROVOKE, p.getEquipment().getItemInMainHand().getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.PROVOKE, p.getEquipment().getItemInMainHand()));
|
||||||
|
ItemStack equip = p.getEquipment().getItemInMainHand();
|
||||||
|
if (ArtifactAbility.containsEnchantment(ArtifactAbility.PROVOKE, equip)) {
|
||||||
|
m.addPotionEffect(
|
||||||
|
new PotionEffect(PotionEffectType.GLOWING,
|
||||||
|
(int)(ArtifactAbility.calculateValue(ArtifactAbility.PROVOKE, equip.getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.PROVOKE, equip))*20),
|
||||||
|
0)
|
||||||
|
);
|
||||||
|
if (m instanceof Monster) {
|
||||||
|
Monster mon = (Monster)m;
|
||||||
|
mon.setTarget(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (m instanceof Monster) {
|
if (m instanceof Monster) {
|
||||||
if (m.getType()==EntityType.SPIDER &&
|
if (m.getType()==EntityType.SPIDER &&
|
||||||
@ -3446,6 +3557,46 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
,100);
|
,100);
|
||||||
|
|
||||||
|
if (ArtifactAbility.containsEnchantment(ArtifactAbility.COMBO, p.getEquipment().getItemInMainHand())) {
|
||||||
|
PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId());
|
||||||
|
if (pd.last_swordhit+40>=getServerTickTime()) {
|
||||||
|
pd.last_swordhit=getServerTickTime();
|
||||||
|
pd.swordcombo++;
|
||||||
|
log("Sword combo count is "+pd.swordcombo,2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId());
|
||||||
|
if (GenericFunctions.isArtifactEquip(p.getEquipment().getItemInMainHand()) &&
|
||||||
|
p.getEquipment().getItemInMainHand().getType().toString().contains("SPADE") && p.isSneaking()) {
|
||||||
|
if (ArtifactAbility.containsEnchantment(ArtifactAbility.ERUPTION, p.getEquipment().getItemInMainHand()) &&
|
||||||
|
pd.last_shovelspell<getServerTickTime()) {
|
||||||
|
//Attempt to dig out the blocks below.
|
||||||
|
for (int x=-1;x<2;x++) {
|
||||||
|
for (int z=-1;z<2;z++) {
|
||||||
|
Block b = p.getLocation().add(x,-1,z).getBlock();
|
||||||
|
if (aPlugin.API.isDestroyable(b)) {
|
||||||
|
//log(b.getType()+" is destroyable.",2);
|
||||||
|
b.breakNaturally();
|
||||||
|
p.playSound(p.getLocation(), Sound.BLOCK_SAND_BREAK, 1.0f, 1.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Detect all nearby mobs and knock them up. Deal damage to them as well.
|
||||||
|
List<Entity> nearby = p.getNearbyEntities(2, 2, 2);
|
||||||
|
for (int i=0;i<nearby.size();i++) {
|
||||||
|
if (nearby.get(i) instanceof Monster) {
|
||||||
|
Monster mon = (Monster)nearby.get(i);
|
||||||
|
GenericFunctions.DealDamageToMob(ArtifactAbility.calculateValue(ArtifactAbility.ERUPTION, p.getEquipment().getItemInMainHand().getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.ERUPTION, p.getEquipment().getItemInMainHand())), mon, p, false);
|
||||||
|
mon.addPotionEffect(new PotionEffect(PotionEffectType.LEVITATION,20,15));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p.playSound(p.getLocation(), Sound.ENTITY_FIREWORK_LARGE_BLAST, 1.0f, 1.0f);
|
||||||
|
p.playEffect(p.getLocation(), Effect.LARGE_SMOKE, 0);
|
||||||
|
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), 100);
|
||||||
|
pd.last_shovelspell=getServerTickTime()+100;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (GenericFunctions.isWeapon(p.getEquipment().getItemInMainHand())) {
|
if (GenericFunctions.isWeapon(p.getEquipment().getItemInMainHand())) {
|
||||||
GenericFunctions.RemovePermEnchantmentChance(p.getEquipment().getItemInMainHand(), p);
|
GenericFunctions.RemovePermEnchantmentChance(p.getEquipment().getItemInMainHand(), p);
|
||||||
@ -3464,7 +3615,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
m.setNoDamageTicks(20);
|
m.setNoDamageTicks(20);
|
||||||
|
|
||||||
//Make this monster the player's new target.
|
//Make this monster the player's new target.
|
||||||
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);
|
||||||
@ -3573,8 +3724,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
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()*8.0);
|
ev.setDamage(ev.getDamage()*2.0);
|
||||||
p.sendMessage(ChatColor.DARK_RED+"Headshot! x8 Damage");
|
p.sendMessage(ChatColor.DARK_RED+"Headshot! x2 Damage");
|
||||||
headshot=true;
|
headshot=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3663,7 +3814,17 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
GenericFunctions.isWeapon(item)) {
|
GenericFunctions.isWeapon(item)) {
|
||||||
dropmult+=item.getEnchantmentLevel(Enchantment.LOOT_BONUS_MOBS)*0.1; //Looting increases drop rate by 10% per level.
|
dropmult+=item.getEnchantmentLevel(Enchantment.LOOT_BONUS_MOBS)*0.1; //Looting increases drop rate by 10% per level.
|
||||||
}
|
}
|
||||||
|
for (int i=0;i<p.getEquipment().getArmorContents().length;i++) {
|
||||||
|
ItemStack equip = p.getEquipment().getArmorContents()[i];
|
||||||
|
if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, equip)) {
|
||||||
|
dropmult+=ArtifactAbility.calculateValue(ArtifactAbility.GREED, equip.getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.GREED, equip))/100d;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand())) {
|
||||||
|
dropmult+=ArtifactAbility.calculateValue(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand().getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand()))/100d;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
isBoss=GenericFunctions.isBossMonster(m);
|
isBoss=GenericFunctions.isBossMonster(m);
|
||||||
|
|
||||||
@ -3862,12 +4023,32 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority=EventPriority.LOW)
|
||||||
|
public void onAreaCloudApply(AreaEffectCloudApplyEvent ev) {
|
||||||
|
List<LivingEntity> affected = ev.getAffectedEntities();
|
||||||
|
for (int i=0;i<affected.size();i++) {
|
||||||
|
if (affected.get(i) instanceof Monster) {
|
||||||
|
if (ev.getEntity().getCustomName()!=null) {
|
||||||
|
log("Custom name is "+ev.getEntity().getCustomName(),2);
|
||||||
|
if (ev.getEntity().getCustomName().contains("EW ")) {
|
||||||
|
double dmgdealt=Double.parseDouble(ev.getEntity().getCustomName().split(" ")[1]);
|
||||||
|
GenericFunctions.DealDamageToMob(dmgdealt, affected.get(i), Bukkit.getPlayer(ev.getEntity().getCustomName().split(" ")[2]), false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
affected.remove(i);
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority=EventPriority.LOW)
|
@EventHandler(priority=EventPriority.LOW)
|
||||||
public void onBlockBreak(BlockBreakEvent ev) {
|
public void onBlockBreak(BlockBreakEvent ev) {
|
||||||
|
|
||||||
TwosideSpleefGames.PassEvent(ev);
|
TwosideSpleefGames.PassEvent(ev);
|
||||||
|
|
||||||
Player p = ev.getPlayer();
|
Player p = ev.getPlayer();
|
||||||
|
PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId());
|
||||||
if (p!=null) {
|
if (p!=null) {
|
||||||
log(p.getName()+" has broken block "+GenericFunctions.UserFriendlyMaterialName(new ItemStack(ev.getBlock().getType())),3);
|
log(p.getName()+" has broken block "+GenericFunctions.UserFriendlyMaterialName(new ItemStack(ev.getBlock().getType())),3);
|
||||||
if (GenericFunctions.isArtifactEquip(p.getEquipment().getItemInMainHand()) &&
|
if (GenericFunctions.isArtifactEquip(p.getEquipment().getItemInMainHand()) &&
|
||||||
@ -3876,6 +4057,55 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
if (GenericFunctions.isTool(p.getEquipment().getItemInMainHand())) {
|
if (GenericFunctions.isTool(p.getEquipment().getItemInMainHand())) {
|
||||||
GenericFunctions.RemovePermEnchantmentChance(p.getEquipment().getItemInMainHand(), p);
|
GenericFunctions.RemovePermEnchantmentChance(p.getEquipment().getItemInMainHand(), p);
|
||||||
|
if (ArtifactAbility.containsEnchantment(ArtifactAbility.EARTHWAVE, p.getEquipment().getItemInMainHand()) &&
|
||||||
|
pd.target!=null && !pd.target.isDead() && pd.last_shovelspell<getServerTickTime()) {
|
||||||
|
if (pd.target.getLocation().distanceSquared(p.getLocation())<=256) {
|
||||||
|
final Player p1 = p;
|
||||||
|
AreaEffectCloud lp = (AreaEffectCloud)p.getWorld().spawnEntity(p.getLocation(), EntityType.AREA_EFFECT_CLOUD);
|
||||||
|
lp.setColor(Color.OLIVE);
|
||||||
|
DecimalFormat df = new DecimalFormat("0.00");
|
||||||
|
lp.setCustomName("EW "+df.format(ArtifactAbility.calculateValue(ArtifactAbility.EARTHWAVE, p.getEquipment().getItemInMainHand().getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.EARTHWAVE, p.getEquipment().getItemInMainHand())))+" "+p.getName());
|
||||||
|
lp.setRadius(3f);
|
||||||
|
lp.setDuration(80);
|
||||||
|
lp.setReapplicationDelay(20);
|
||||||
|
lp.setBasePotionData(new PotionData(PotionType.INSTANT_DAMAGE));
|
||||||
|
lp.setParticle(Particle.SMOKE_NORMAL);
|
||||||
|
p.playSound(p.getLocation(), Sound.ENTITY_SHULKER_SHOOT, 1.0f, 0.5f);
|
||||||
|
pd.last_shovelspell=getServerTickTime()+300;
|
||||||
|
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), 300);
|
||||||
|
|
||||||
|
int mult=2;
|
||||||
|
double xspd=p.getLocation().getDirection().getX()*mult;
|
||||||
|
double yspd=p.getLocation().getDirection().getY()/2;
|
||||||
|
double zspd=p.getLocation().getDirection().getZ()*mult;
|
||||||
|
double xpos=p.getLocation().getX();
|
||||||
|
double ypos=p.getLocation().getY();
|
||||||
|
double zpos=p.getLocation().getZ();
|
||||||
|
int range=8;
|
||||||
|
final String customname = lp.getCustomName();
|
||||||
|
for (int i=0;i<range;i++) {
|
||||||
|
final int tempi=i;
|
||||||
|
final Location newpos=new Location(p.getWorld(),xpos,ypos,zpos).add(i*xspd,i*yspd,i*zspd);
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
AreaEffectCloud lp = (AreaEffectCloud)newpos.getWorld().spawnEntity(newpos, EntityType.AREA_EFFECT_CLOUD);
|
||||||
|
lp.setColor(Color.OLIVE);
|
||||||
|
lp.setCustomName(customname);
|
||||||
|
lp.setBasePotionData(new PotionData(PotionType.INSTANT_DAMAGE));
|
||||||
|
lp.setRadius(3f);
|
||||||
|
lp.setDuration(80);
|
||||||
|
if (tempi%2==0) {
|
||||||
|
lp.setParticle(Particle.SMOKE_LARGE);} else {
|
||||||
|
lp.setParticle(Particle.SMOKE_NORMAL);
|
||||||
|
}
|
||||||
|
p1.playSound(lp.getLocation(), Sound.ENTITY_CAT_HISS, 1.0f, 0.3f);
|
||||||
|
}
|
||||||
|
},i*16);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pd.target=null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5102,10 +5332,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
|
|
||||||
public void setPlayerMaxHealth(Player p) {
|
public void setPlayerMaxHealth(Player p) {
|
||||||
//Determine player max HP based on armor being worn.
|
//Determine player max HP based on armor being worn.
|
||||||
int hp=10; //Get the base max health.
|
double hp=10; //Get the base max health.
|
||||||
//Get all equips.
|
//Get all equips.
|
||||||
ItemStack[] equipment = {p.getInventory().getHelmet(),p.getInventory().getChestplate(),p.getInventory().getLeggings(),p.getInventory().getBoots()};
|
ItemStack[] equipment = {p.getInventory().getHelmet(),p.getInventory().getChestplate(),p.getInventory().getLeggings(),p.getInventory().getBoots()};
|
||||||
|
double maxdeduction=1;
|
||||||
for (int i=0;i<equipment.length;i++) {
|
for (int i=0;i<equipment.length;i++) {
|
||||||
if (equipment[i]!=null) {
|
if (equipment[i]!=null) {
|
||||||
boolean is_block_form=false;
|
boolean is_block_form=false;
|
||||||
@ -5144,10 +5374,20 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (GenericFunctions.isArtifactEquip(equipment[i])) {
|
if (GenericFunctions.isArtifactEquip(equipment[i])) {
|
||||||
hp += ArtifactAbility.calculateValue(ArtifactAbility.HEALTH, equipment[i].getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.HEALTH, equipment[i]));
|
log("Add in "+ArtifactAbility.calculateValue(ArtifactAbility.HEALTH, equipment[i].getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.HEALTH, equipment[i])),5);
|
||||||
|
hp += (double)ArtifactAbility.calculateValue(ArtifactAbility.HEALTH, equipment[i].getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.HEALTH, equipment[i]));
|
||||||
|
|
||||||
|
if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, equipment[i])) {
|
||||||
|
maxdeduction /= Math.pow(ArtifactAbility.getEnchantmentLevel(ArtifactAbility.GREED, equipment[i]),2)+1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
log("Health is now "+hp,5);
|
||||||
|
if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand())) {
|
||||||
|
maxdeduction /= Math.pow(ArtifactAbility.getEnchantmentLevel(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand()),2)+1;
|
||||||
|
}
|
||||||
|
log("maxdeduction is "+maxdeduction,5);
|
||||||
|
|
||||||
if (GenericFunctions.isDefender(p)) {
|
if (GenericFunctions.isDefender(p)) {
|
||||||
hp+=10;
|
hp+=10;
|
||||||
@ -5163,6 +5403,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hp*=maxdeduction;
|
||||||
|
|
||||||
|
if (p.getHealth()>=hp) {
|
||||||
|
p.setHealth(hp);
|
||||||
|
}
|
||||||
p.setMaxHealth(hp);
|
p.setMaxHealth(hp);
|
||||||
if (!p.isDead()) {
|
if (!p.isDead()) {
|
||||||
p.setHealth(p.getHealth());
|
p.setHealth(p.getHealth());
|
||||||
@ -5423,7 +5668,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
if (Math.random()<=0.01*ArtifactAbility.calculateValue(ArtifactAbility.CRITICAL, p.getEquipment().getItemInMainHand().getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.CRITICAL, 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.
|
//Landed a critical strike.
|
||||||
//log("Critical strike!",2);
|
//log("Critical strike!",2);
|
||||||
p.getLocation().getWorld().playSound(p.getLocation(), Sound.ENTITY_PLAYER_ATTACK_CRIT, 1.0f, 1.0f);
|
if (p instanceof Player) {
|
||||||
|
((Player)p).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;
|
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);
|
log("Crit dmg multiplied by x"+dmgamt,4);
|
||||||
basedmg*=dmgamt;
|
basedmg*=dmgamt;
|
||||||
@ -5433,6 +5680,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
log("Highwinder damage is "+dmgamt,5);
|
log("Highwinder damage is "+dmgamt,5);
|
||||||
basedmg+=dmgamt;
|
basedmg+=dmgamt;
|
||||||
|
|
||||||
|
|
||||||
|
double combopct = pd.swordcombo*ArtifactAbility.calculateValue(ArtifactAbility.COMBO, p.getEquipment().getItemInMainHand().getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.COMBO, p.getEquipment().getItemInMainHand()))/100d;
|
||||||
|
log(combopct+" dmg added.",2);
|
||||||
|
basedmg = basedmg + (basedmg*combopct);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pd!=null) {
|
if (pd!=null) {
|
||||||
@ -5698,6 +5949,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
double reductionamt = ArtifactAbility.calculateValue(ArtifactAbility.DAMAGE_REDUCTION, armor[i].getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.DAMAGE_REDUCTION, armor[i]));
|
double reductionamt = ArtifactAbility.calculateValue(ArtifactAbility.DAMAGE_REDUCTION, armor[i].getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.DAMAGE_REDUCTION, armor[i]));
|
||||||
dmgreduction+=reductionamt;
|
dmgreduction+=reductionamt;
|
||||||
log("Reducing damage by "+reductionamt+"%",5);
|
log("Reducing damage by "+reductionamt+"%",5);
|
||||||
|
if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, armor[i])) {
|
||||||
|
dmgreduction /= Math.pow(ArtifactAbility.getEnchantmentLevel(ArtifactAbility.GREED, armor[i]),2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5716,11 +5970,27 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId());
|
PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId());
|
||||||
partylevel = pd.partybonus;
|
partylevel = pd.partybonus;
|
||||||
if (partylevel>9) {partylevel=9;}
|
if (partylevel>9) {partylevel=9;}
|
||||||
|
log("Light level: "+p.getLocation().add(0,0,0).getBlock().getLightLevel(),2);
|
||||||
|
for (int i=0;i<p.getEquipment().getArmorContents().length;i++) {
|
||||||
|
if (ArtifactAbility.containsEnchantment(ArtifactAbility.SHADOWWALKER, p.getEquipment().getArmorContents()[i]) &&
|
||||||
|
p.isOnGround() && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=4) {
|
||||||
|
double dmgreduce = 1d-(ArtifactAbility.calculateValue(ArtifactAbility.SHADOWWALKER, p.getEquipment().getArmorContents()[i].getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.SHADOWWALKER, p.getEquipment().getArmorContents()[i]))/100d);
|
||||||
|
basedmg *= dmgreduce;
|
||||||
|
log("Base damage became "+(dmgreduce*100)+"% of original amount.",2);
|
||||||
|
}
|
||||||
|
if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getArmorContents()[i])) {
|
||||||
|
dmgreduction /= Math.pow(ArtifactAbility.getEnchantmentLevel(ArtifactAbility.GREED, p.getEquipment().getArmorContents()[i]),2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand())) {
|
||||||
|
dmgreduction /= Math.pow(ArtifactAbility.getEnchantmentLevel(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand()),2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Blocking: -((p.isBlocking())?ev.getDamage()*0.33:0) //33% damage will be reduced if we are blocking.
|
//Blocking: -((p.isBlocking())?ev.getDamage()*0.33:0) //33% damage will be reduced if we are blocking.
|
||||||
//Shield: -((p.getEquipment().getItemInOffHand()!=null && p.getEquipment().getItemInOffHand().getType()==Material.SHIELD)?ev.getDamage()*0.05:0) //5% damage will be reduced if we are holding a shield.
|
//Shield: -((p.getEquipment().getItemInOffHand()!=null && p.getEquipment().getItemInOffHand().getType()==Material.SHIELD)?ev.getDamage()*0.05:0) //5% damage will be reduced if we are holding a shield.
|
||||||
|
|
||||||
|
|
||||||
resistlevel=(resistlevel>10)?10:resistlevel;
|
resistlevel=(resistlevel>10)?10:resistlevel;
|
||||||
protectionlevel=(protectionlevel>100)?100:protectionlevel;
|
protectionlevel=(protectionlevel>100)?100:protectionlevel;
|
||||||
partylevel=(partylevel>100)?100:partylevel;
|
partylevel=(partylevel>100)?100:partylevel;
|
||||||
@ -5882,31 +6152,36 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
double old_armordef = pd.prev_armordef;
|
double old_armordef = pd.prev_armordef;
|
||||||
double store1=CalculateDamageReduction(1,p,p);
|
double store1=CalculateDamageReduction(1,p,p);
|
||||||
|
|
||||||
double store2=old_weapondmg;
|
double store2=CalculateWeaponDamage(p,null);
|
||||||
if (GenericFunctions.isWeapon(p.getEquipment().getItemInMainHand())) {
|
|
||||||
store2 = CalculateWeaponDamage(p,null);
|
|
||||||
}
|
|
||||||
pd.damagedealt=store2;
|
pd.damagedealt=store2;
|
||||||
pd.damagereduction=store1;
|
pd.damagereduction=store1;
|
||||||
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(pd.damagedealt));
|
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-pd.damagereduction)*100)+"%");
|
p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Damage Reduction: "+ChatColor.RESET+""+ChatColor.DARK_AQUA+df.format((1.0-store1)*100)+"%");
|
||||||
TextComponent msg = DisplayPerks(p.getEquipment().getItemInMainHand(),"Weapon",p);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);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);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().getLeggings(),"Legging",p);if (!msg.toPlainText().equalsIgnoreCase("")) {p.spigot().sendMessage(msg);};
|
msg = DisplayPerks(p.getEquipment().getLeggings(),"Legging",p,901);if (!msg.toPlainText().equalsIgnoreCase("")) {p.spigot().sendMessage(msg);};
|
||||||
msg = DisplayPerks(p.getEquipment().getBoots(),"Boot",p);if (!msg.toPlainText().equalsIgnoreCase("")) {p.spigot().sendMessage(msg);};
|
msg = DisplayPerks(p.getEquipment().getBoots(),"Boot",p,900);if (!msg.toPlainText().equalsIgnoreCase("")) {p.spigot().sendMessage(msg);};
|
||||||
p.sendMessage("----------");
|
p.sendMessage("----------");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TextComponent DisplayPerks(ItemStack item,String type,Player p) {
|
public static TextComponent DisplayPerks(ItemStack item,String type,Player p, int slot) {
|
||||||
TextComponent tc = new TextComponent("");
|
TextComponent tc = new TextComponent("");
|
||||||
if (GenericFunctions.isArtifactEquip(item) &&
|
if (GenericFunctions.isArtifactEquip(item) &&
|
||||||
ArtifactAbility.getEnchantments(item).size()>0) {
|
ArtifactAbility.getEnchantments(item).size()>0) {
|
||||||
//log("Getting perks...",2);
|
//log("Getting perks...",2);
|
||||||
HashMap enchants = ArtifactAbility.getEnchantments(item);
|
HashMap enchants = ArtifactAbility.getEnchantments(item);
|
||||||
tc.addExtra("");
|
tc.addExtra("");
|
||||||
tc.addExtra(ChatColor.GRAY+""+ChatColor.ITALIC+type+" Perks: \n");
|
tc.addExtra(ChatColor.GRAY+""+ChatColor.ITALIC+type+" Perks: ");
|
||||||
|
if (AwakenedArtifact.getAP(item)>0) {
|
||||||
|
TextComponent tc1 = new TextComponent(ChatColor.GREEN+"["+Character.toString((char)0x25b2)+"]");
|
||||||
|
tc1.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,new ComponentBuilder("Click to upgrade abilities on this artifact. "+ChatColor.GREEN+"Available AP: "+ChatColor.BLUE+AwakenedArtifact.getAP(item)).create()));
|
||||||
|
tc1.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND,"/awakenedartifact menu "+slot));
|
||||||
|
tc.addExtra(tc1);
|
||||||
|
}
|
||||||
|
|
||||||
|
tc.addExtra("\n");
|
||||||
int j=0;
|
int j=0;
|
||||||
for (int i=0;i<enchants.size();i++) {
|
for (int i=0;i<enchants.size();i++) {
|
||||||
//log("Getting perks...",2);
|
//log("Getting perks...",2);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user