diff --git a/TwosideKeeper.jar b/TwosideKeeper.jar index 262d996..cc8653d 100644 Binary files a/TwosideKeeper.jar and b/TwosideKeeper.jar differ diff --git a/src/plugin.yml b/src/plugin.yml index 115fa1e..d8600b7 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: TwosideKeeper main: sig.plugin.TwosideKeeper.TwosideKeeper -version: 3.5.0a +version: 3.5.1 commands: money: description: Tells the player the amount of money they are holding. diff --git a/src/sig/plugin/TwosideKeeper/AwakenedArtifact.java b/src/sig/plugin/TwosideKeeper/AwakenedArtifact.java index 037a77b..adeb4af 100644 --- a/src/sig/plugin/TwosideKeeper/AwakenedArtifact.java +++ b/src/sig/plugin/TwosideKeeper/AwakenedArtifact.java @@ -26,7 +26,7 @@ public class AwakenedArtifact { public static HashMap name_map = new HashMap(); private static String drawEXPMeter(int exp) { String bar =""; - for (int i=0;i<(exp/100)%1000;i++) { + for (int i=0;i<((exp%1000)/100);i++) { bar+=Character.toString((char)0x2588); } if (exp%100>=50) { @@ -74,32 +74,28 @@ public class AwakenedArtifact { int totalval = getEXP(artifact)+amt; if (totalval>=1000) { //LEVEL UP! - 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 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(ArtifactAbility.GenerateMenu(ArtifactItemType.getArtifactItemTypeFromItemStack(p.getInventory().getItem(GenericFunctions.CalculateSlot(artifact,p))).getUpgradePath(), TwosideKeeper.CalculateWeaponDamage(p,null), artifact,GenericFunctions.CalculateSlot(artifact,p))); - return item; + 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 { - return setEXP(artifact,totalval); + 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 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(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 setEXP(artifact,totalval); } @@ -203,20 +199,15 @@ public class AwakenedArtifact { 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 = 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); - } else { - return addEXP(artifact,(int)expadded,p); - } + 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); } else { - return addEXP(artifact,exp,p); + return addEXP(artifact,(int)expadded,p); } } else { return artifact; diff --git a/src/sig/plugin/TwosideKeeper/DeathManager.java b/src/sig/plugin/TwosideKeeper/DeathManager.java index 53c3644..d41ebd1 100644 --- a/src/sig/plugin/TwosideKeeper/DeathManager.java +++ b/src/sig/plugin/TwosideKeeper/DeathManager.java @@ -94,7 +94,6 @@ public class DeathManager { public static void continueAction(Player p) { //Pick 5 - DeathStructure structure = getDeathStructure(p); Inventory deathinv = Bukkit.getServer().createInventory(p, 45, "Death Loot"); @@ -127,7 +126,7 @@ public class DeathManager { deathinv.addItem(structure.deathinventory.get(i)); } } - double totalmoney = TwosideKeeper.getPlayerMoney(p)+TwosideKeeper.getPlayerBankMoney(p); + double totalmoney = TwosideKeeper.getPlayerMoney(Bukkit.getPlayer(p.getName()))+TwosideKeeper.getPlayerBankMoney(Bukkit.getPlayer(p.getName())); int price = 1; if (structure.deathloc.getBlockY()<=60) { price += 24-(structure.deathloc.getBlockY()/2.5); diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java b/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java index c014bef..2305866 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java @@ -95,16 +95,18 @@ public enum ArtifactAbility { 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 - 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), + AOE("Area of Effect","Deals damage to targets up to [VAL]m from the main target hit.",new double[]{0.4,0.45,0.5,0.55,0.6,0.65,0.70,0.75,0.80,0.85}, + 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.SCYTHE), + DEATHMARK("Death Mark","Applies a Death Mark stack to enemies hit. Death mark stacks 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] true damage.",new double[]{0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0}, + 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 + 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}, + 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}, 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), + /*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}, @@ -521,7 +523,7 @@ public enum ArtifactAbility { } text=DisplayAbility(GREED,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} - text=DisplayAbility(GROWTH,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} + text=DisplayAbility(AUTOREPAIR,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(REMOVE_CURSE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(PRESERVATION,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(EXP_MULT,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} @@ -532,10 +534,11 @@ public enum ArtifactAbility { public static String displayDescription(ArtifactAbility ability, int tier, int abilitylv, double playerdmgval) { //Level to display information for. String msg = ability.GetDescription(); DecimalFormat df = new DecimalFormat("0.00"); - msg=msg.replace("[VAL]", df.format(calculateValue(ability,tier,abilitylv))); - msg=msg.replace("[PENDMG]", df.format(calculateValue(ability,tier,abilitylv)/100*playerdmgval)); //Based on multiplying [VAL] by the base damage value. - msg=msg.replace("[HUNGERVAL]", df.format(10*abilitylv)); - msg=msg.replace("[FATALDMG]", df.format(120*abilitylv)); + msg=msg.replace("[VAL]", ChatColor.BLUE+df.format(calculateValue(ability,tier,abilitylv))+ChatColor.RESET); + 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("[FATALDMG]", ChatColor.BLUE+df.format(120*abilitylv)+ChatColor.RESET); + msg=msg.replace("[REPAIRCHANCE]", ChatColor.BLUE+df.format(tier)+ChatColor.RESET); return msg; } public static String displayDescriptionUpgrade(ArtifactAbility ability, int tier, int fromlv, int tolv, double playerdmgval) { //Level to display information for. @@ -545,6 +548,7 @@ 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("[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("[REPAIRCHANCE]", DisplayChangedValue(df.format(tier),df.format(tier))); return msg; } diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactItemType.java b/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactItemType.java index 6063dc8..19c58ed 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactItemType.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactItemType.java @@ -9,18 +9,19 @@ import org.bukkit.inventory.ShapelessRecipe; import sig.plugin.TwosideKeeper.Artifact; import sig.plugin.TwosideKeeper.TwosideKeeper; +import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; public enum ArtifactItemType { 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 - new ItemStack(Material.WOOD_AXE), //T3 - new ItemStack(Material.STONE_AXE), //T4 - new ItemStack(Material.STONE_AXE), //T5 + new ItemStack(Material.STONE_AXE), //T1 + new ItemStack(Material.STONE_AXE), //T2 + new ItemStack(Material.STONE_AXE), //T3 + new ItemStack(Material.IRON_AXE), //T4 + new ItemStack(Material.IRON_AXE), //T5 new ItemStack(Material.IRON_AXE), //T6 - new ItemStack(Material.IRON_AXE), //T7 - new ItemStack(Material.IRON_AXE), //T8 + new ItemStack(Material.DIAMOND_AXE), //T7 + new ItemStack(Material.DIAMOND_AXE), //T8 new ItemStack(Material.DIAMOND_AXE), //T9 new ItemStack(Material.DIAMOND_AXE), //T10 }, @@ -38,14 +39,14 @@ public enum ArtifactItemType { }), 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 - new ItemStack(Material.WOOD_SWORD), //T3 - new ItemStack(Material.STONE_SWORD), //T4 - new ItemStack(Material.STONE_SWORD), //T5 + new ItemStack(Material.STONE_SWORD), //T1 + new ItemStack(Material.STONE_SWORD), //T2 + new ItemStack(Material.STONE_SWORD), //T3 + new ItemStack(Material.IRON_SWORD), //T4 + new ItemStack(Material.IRON_SWORD), //T5 new ItemStack(Material.IRON_SWORD), //T6 - new ItemStack(Material.IRON_SWORD), //T7 - new ItemStack(Material.IRON_SWORD), //T8 + new ItemStack(Material.DIAMOND_SWORD), //T7 + new ItemStack(Material.DIAMOND_SWORD), //T8 new ItemStack(Material.DIAMOND_SWORD), //T9 new ItemStack(Material.DIAMOND_SWORD), //T10 }, @@ -63,27 +64,27 @@ public enum ArtifactItemType { }), 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 - new ItemStack(Material.WOOD_PICKAXE), //T3 - new ItemStack(Material.STONE_PICKAXE), //T4 - new ItemStack(Material.STONE_PICKAXE), //T5 + new ItemStack(Material.STONE_PICKAXE), //T1 + new ItemStack(Material.STONE_PICKAXE), //T2 + new ItemStack(Material.STONE_PICKAXE), //T3 + new ItemStack(Material.IRON_PICKAXE), //T4 + new ItemStack(Material.IRON_PICKAXE), //T5 new ItemStack(Material.IRON_PICKAXE), //T6 - new ItemStack(Material.IRON_PICKAXE), //T7 - new ItemStack(Material.IRON_PICKAXE), //T8 + new ItemStack(Material.DIAMOND_PICKAXE), //T7 + new ItemStack(Material.DIAMOND_PICKAXE), //T8 new ItemStack(Material.DIAMOND_PICKAXE), //T9 new ItemStack(Material.DIAMOND_PICKAXE), //T10 }), 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 - new ItemStack(Material.WOOD_HOE), //T3 - new ItemStack(Material.STONE_HOE), //T4 - new ItemStack(Material.STONE_HOE), //T5 + new ItemStack(Material.STONE_HOE), //T1 + new ItemStack(Material.STONE_HOE), //T2 + new ItemStack(Material.STONE_HOE), //T3 + new ItemStack(Material.IRON_HOE), //T4 + new ItemStack(Material.IRON_HOE), //T5 new ItemStack(Material.IRON_HOE), //T6 - new ItemStack(Material.IRON_HOE), //T7 - new ItemStack(Material.IRON_HOE), //T8 + new ItemStack(Material.DIAMOND_HOE), //T7 + new ItemStack(Material.DIAMOND_HOE), //T8 new ItemStack(Material.DIAMOND_HOE), //T9 new ItemStack(Material.DIAMOND_HOE), //T10 }), @@ -102,14 +103,14 @@ public enum ArtifactItemType { }), 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 - new ItemStack(Material.WOOD_SPADE), //T3 - new ItemStack(Material.STONE_SPADE), //T4 - new ItemStack(Material.STONE_SPADE), //T5 + new ItemStack(Material.STONE_SPADE), //T1 + new ItemStack(Material.STONE_SPADE), //T2 + new ItemStack(Material.STONE_SPADE), //T3 + new ItemStack(Material.IRON_SPADE), //T4 + new ItemStack(Material.IRON_SPADE), //T5 new ItemStack(Material.IRON_SPADE), //T6 - new ItemStack(Material.IRON_SPADE), //T7 - new ItemStack(Material.IRON_SPADE), //T8 + new ItemStack(Material.DIAMOND_SPADE), //T7 + new ItemStack(Material.DIAMOND_SPADE), //T8 new ItemStack(Material.DIAMOND_SPADE), //T9 new ItemStack(Material.DIAMOND_SPADE), //T10 }), diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java index b0976b5..9fd977f 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java @@ -1924,4 +1924,88 @@ public class GenericFunctions { sender.sendMessage(ErrorMessage); TwosideKeeper.log(ErrorMessage, 1); } + + public static ChatColor getDeathMarkColor(int stacks) { + if (stacks<3) { + return ChatColor.DARK_GREEN; + } else + if (stacks<6) { + return ChatColor.GREEN; + } else + if (stacks<10) { + return ChatColor.YELLOW; + } else + if (stacks<15) { + return ChatColor.GOLD; + } else + if (stacks<20) { + return ChatColor.RED; + } else + if (stacks<30) { + return ChatColor.DARK_RED; + } else { + return ChatColor.DARK_GRAY; + } + } + + public static void ApplyDeathMark(LivingEntity ent) { + int stackamt = 0; + if (ent.hasPotionEffect(PotionEffectType.UNLUCK)) { + //Add to the current stack of unluck. + for (int i1=0;i1=1) { - if (thisp.getLevel()>=value) { - //Take that amount of exp away from the player. Give them money in return. - int startlv = thisp.getLevel(); - double amtgained=0; - for (int i=startlv;i>=startlv-value;i--) { - switch (i) { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - { - amtgained = (2*i+7)*XP_CONVERSION_RATE; - givePlayerMoney(thisp,amtgained); - }break; - case 17: - case 18: - case 19: - case 20: - case 21: - case 22: - case 23: - case 24: - case 25: - case 26: - case 27: - case 28: - case 29: - case 30: - case 31: - { - amtgained = (5*i-38)*XP_CONVERSION_RATE; - givePlayerMoney(thisp,amtgained); - }break; - default:{ - amtgained = (9*i-158)*XP_CONVERSION_RATE; - givePlayerMoney(thisp,amtgained); - } - } - } - thisp.setLevel(thisp.getLevel()-value); - ev.getPlayer().sendMessage(ChatColor.GOLD+"CONVERSION COMPLETE!"+ChatColor.WHITE+" Converted "+value+" levels of experience into "+ChatColor.YELLOW+"$"+df.format(amtgained)+ChatColor.WHITE+"."); + if (aPlugin.API.getTotalExperience(thisp)>=value) { + double amtgained=value/100d; + givePlayerMoney(thisp,amtgained); + aPlugin.API.setTotalExperience(thisp, aPlugin.API.getTotalExperience(thisp)-value); + ev.getPlayer().sendMessage(ChatColor.GOLD+"CONVERSION COMPLETE!"+ChatColor.WHITE+" Converted "+value+" experience points into "+ChatColor.YELLOW+"$"+df.format(amtgained)+ChatColor.WHITE+"."); ev.getPlayer().sendMessage(" Now Holding: "+ChatColor.BLUE+"$"+df.format(getPlayerMoney(ev.getPlayer()))); } else { - thisp.sendMessage(ChatColor.RED+"You do not have that many levels. You can convert as many as "+ChatColor.WHITE+thisp.getLevel()+ChatColor.RED+" levels."); + thisp.sendMessage(ChatColor.RED+"You do not have that many experience points. You can convert up to "+ChatColor.WHITE+thisp.getLevel()+ChatColor.RED+" experience points."); thisp.sendMessage(ChatColor.WHITE+" Cancelled out of Conversion terminal."); } } else { - thisp.sendMessage(ChatColor.RED+"You must convert at least "+ChatColor.WHITE+"1 level."); + thisp.sendMessage(ChatColor.RED+"You must convert at least "+ChatColor.WHITE+"1 experience point."); thisp.sendMessage(ChatColor.WHITE+" Cancelled out of Conversion terminal."); } } else { @@ -1568,6 +1541,49 @@ public class TwosideKeeper extends JavaPlugin implements Listener { ev.getPlayer().sendMessage(ChatColor.DARK_BLUE+"New Recycling Center successfully created at "+ev.getClickedBlock().getLocation().toString()); } + //Check for a Scythe right click here. + if ((ev.getAction()==Action.RIGHT_CLICK_AIR || ev.getAction()==Action.RIGHT_CLICK_BLOCK) && + GenericFunctions.isArtifactEquip(player.getEquipment().getItemInMainHand())) { + PlayerStructure pd = (PlayerStructure)playerdata.get(player.getUniqueId()); //Make sure it's off cooldown. + if (pd.last_deathmark+2400) { + double dmg = ArtifactAbility.calculateValue(ArtifactAbility.DEATHMARK, player.getEquipment().getItemInMainHand().getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.DEATHMARK, player.getEquipment().getItemInMainHand())); + //Look for nearby mobs up to 10 blocks away. + List nearby = player.getNearbyEntities(10, 10, 10); + for (int i=0;i=amounttotake) { - givePlayerMoney(p,getPlayerMoney(p)-amounttotake); + givePlayerMoney(p,-amounttotake); } else { double diff = amounttotake-getPlayerMoney(p); givePlayerMoney(p,-getPlayerMoney(p)); @@ -3281,6 +3297,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { ev.setDamage(DamageModifier.MAGIC,0); ev.setDamage(DamageModifier.RESISTANCE,0); ev.setDamage(DamageModifier.ARMOR,0); + ev.setDamage(DamageModifier.ABSORPTION,0); int dmgmult = 1; @@ -3299,14 +3316,15 @@ public class TwosideKeeper extends JavaPlugin implements Listener { mm.setTarget(p); } - - ev.setDamage(CalculateDamageReduction(ev.getDamage()*dmgmult*ENEMY_DMG_MULT,p,m)); + + double rawdmg = ev.getDamage()*dmgmult*ENEMY_DMG_MULT; + ev.setDamage(CalculateDamageReduction(rawdmg,p,m)); //Artifact armor will receive EXP. for (int i=0;i hitlist = new ArrayList(); + //Apply Death mark to these mobs that got hit. + boolean applyDeathmark=false; + if (ArtifactAbility.getEnchantmentLevel(ArtifactAbility.DEATHMARK, p.getEquipment().getItemInMainHand())>0) { + hitlist.add(m); + applyDeathmark=true; + GenericFunctions.ApplyDeathMark(m); + } + //Deal AoE damage. + double checkrange = ArtifactAbility.calculateValue(ArtifactAbility.AOE, p.getEquipment().getItemInMainHand().getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.AOE, p.getEquipment().getItemInMainHand())); + List entities = m.getNearbyEntities(checkrange, checkrange, checkrange); + for (int i=0;i finallist = hitlist; + Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() { + public void run() { + for (int i=0;i transferlore = artifact_item.getItemMeta().getLore(); ItemMeta m = newartifact.getItemMeta(); m.setLore(transferlore); @@ -5036,7 +5117,16 @@ public class TwosideKeeper extends JavaPlugin implements Listener { if (GenericFunctions.isDefender(p)) { hp+=10; - p.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION,40,(p.isBlocking())?1:0)); + p.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION,60,(p.isBlocking())?1:0)); + } + + if (p.hasPotionEffect(PotionEffectType.ABSORPTION)) { + Collection player_effects = p.getActivePotionEffects(); + for (int i=0;i