->Fixed a bug where a Ranger's Dodge buff would be consumed when the

player was hit while invulnerable.
->Essences no longer spawn due to projectiles causing teleports and
water causing teleports.
->Armor penetration formula has been fixed.
->If /dps is on, damage per hit is displayed on screen.
->Rangers that shoot Endermen send them to oblivion...
->Damage from explosions is now x1.0 intended value (Up from x0.375)
->Damage dealt from Line Drive now scales from x1-x5, based on how much
health the mob is missing when performed.
->Line Drive Cooldown increased by 4 seconds.
->Habitats influence nearby habitats now.
->Killing a mob with Line Drive now lowers the cooldown of Line Drive by
2 seconds per kill.
->Improved internal settings for cleaning up the monster list of
despawned monsters.
->Leaders now gain their red glow back if they lost it after a few
seconds.
->'Greed' perk nerfed heavily. Requires a lot of point investments and
knocks off of items frequently. Only divides stats for each piece that
has Greed on it, instead of how many levels of greed exist.
->Fixed a bug where Greed divided all stats more than one time per
piece.
->Death count now shows in player list.
This commit is contained in:
sigonasr2 2016-08-03 22:59:46 -05:00
parent 029275305c
commit b170a0ad5d
11 changed files with 233 additions and 81 deletions

Binary file not shown.

View File

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

View File

@ -80,7 +80,7 @@ public class AwakenedArtifact {
item = setEXP(item,totalval%1000); item = setEXP(item,totalval%1000);
item = addAP(item,1); item = addAP(item,1);
double potentialred = 10.0d; double potentialred = 10.0d;
potentialred/=1+(GenericFunctions.getAbilityValue(ArtifactAbility.PRESERVATION, artifact)/100d); potentialred *= 1 - GenericFunctions.getAbilityValue(ArtifactAbility.PRESERVATION, artifact)/100d;
TwosideKeeper.log("Potential reduction is reduced by "+(10-potentialred), 4); TwosideKeeper.log("Potential reduction is reduced by "+(10-potentialred), 4);
if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, item)) { if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, item)) {
if (ArtifactAbility.getEnchantmentLevel(ArtifactAbility.GREED, item)>1) { if (ArtifactAbility.getEnchantmentLevel(ArtifactAbility.GREED, item)>1) {

View File

@ -106,17 +106,19 @@ public enum ArtifactAbility {
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), 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}, 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), 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),
CRIPPLE("Cripple","Every 10 death marks applied on a monster increases damage dealt from all damage sources by [VAL]%.",new double[]{1,2,3,4,5,6,7,8,10,12},
new double[]{0.3,0.3,0.27,0.27,0.24,0.24,0.21,0.21,0.18,0.18},100,10,UpgradePath.SCYTHE),
//General abilities //General abilities
AUTOREPAIR("Auto Repair","1% chance every second to repair [VAL] durability to the artifact item\n\nThe item must be sitting in your hotbar or must be equipped for this ability to work. This ability is less effective with no sunlight!",new double[]{3,3.5,4,4.5,5,5.5,6,6.5,7,7.5}, AUTOREPAIR("Auto Repair","1% chance every second to repair [VAL] durability to the artifact item\n\nThe item must be sitting in your hotbar or must be equipped for this ability to work. This ability is less effective with no sunlight!",new double[]{3,3.5,4,4.5,5,5.5,6,6.5,7,7.5},
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","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,55,60,65,70,75,80,85,90,95}, GREED("Greed","Increases Drop rate by [VAL]% . Health is halved, health regeneration is halved. Each hit has a [GREEDCHANCE]% chance to consume the Greed buff.\n\n"+ChatColor.RED+"Costs 1 Artifact Level.",new double[]{1,2,3,4,5,7,9,11,13,15},
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), new double[]{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0},10,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","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}, PRESERVATION("Preservation","Potential decays [VAL]% slower.",new double[]{1.0,1.25,1.5,1.75,2.0,2.5,3.0,3.5,4.0,5.0},
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), 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),
@ -426,6 +428,10 @@ public enum ArtifactAbility {
item = applyEnchantment(ability,level+1,item); item = applyEnchantment(ability,level+1,item);
AwakenedArtifact.addAP(item, -1); AwakenedArtifact.addAP(item, -1);
p.sendMessage(ChatColor.AQUA+"Successfully applied "+ChatColor.BLUE+ability.GetName()+" "+(level+1)+ChatColor.AQUA+" to your artifact!"); p.sendMessage(ChatColor.AQUA+"Successfully applied "+ChatColor.BLUE+ability.GetName()+" "+(level+1)+ChatColor.AQUA+" to your artifact!");
if (ability==ArtifactAbility.GREED) {
//Remove a level from using Greed.
AwakenedArtifact.setLV(item, AwakenedArtifact.getLV(item)-1, p);
}
int apamt = AwakenedArtifact.getAP(item); int apamt = AwakenedArtifact.getAP(item);
if (apamt>0) { if (apamt>0) {
TextComponent tc = new TextComponent(" You have "+ChatColor.GREEN+apamt+ChatColor.WHITE+" ability point"+((apamt==1)?"":"s")+" remaining!"); TextComponent tc = new TextComponent(" You have "+ChatColor.GREEN+apamt+ChatColor.WHITE+" ability point"+((apamt==1)?"":"s")+" remaining!");
@ -583,6 +589,7 @@ public enum ArtifactAbility {
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/3)+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); msg=msg.replace("[DODGEVAL]", ChatColor.BLUE+df.format(tier)+ChatColor.RESET);
msg=msg.replace("[GREEDCHANCE]", ChatColor.BLUE+df.format((11-tier)*5)+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.
@ -592,8 +599,9 @@ 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/3))); msg=msg.replace("[REPAIRCHANCE]", df.format(tier/3));
msg=msg.replace("[DODGEVAL]", DisplayChangedValue(df.format(tier),df.format(tier))); msg=msg.replace("[DODGEVAL]", df.format(tier));
msg=msg.replace("[GREEDCHANCE]", ChatColor.BLUE+df.format((11-tier)*5)+ChatColor.RESET);
return msg; return msg;
} }

View File

@ -2621,7 +2621,7 @@ public class GenericFunctions {
MonsterStructure ms = (MonsterStructure)TwosideKeeper.monsterdata.get(m.getUniqueId()); MonsterStructure ms = (MonsterStructure)TwosideKeeper.monsterdata.get(m.getUniqueId());
ms.SetTarget(damager); ms.SetTarget(damager);
} else { } else {
TwosideKeeper.monsterdata.put(m.getUniqueId(),new MonsterStructure(damager)); TwosideKeeper.monsterdata.put(m.getUniqueId(),new MonsterStructure(m,damager));
} }
TwosideKeeper.habitat_data.addNewStartingLocation(target); TwosideKeeper.habitat_data.addNewStartingLocation(target);
} }
@ -2645,11 +2645,43 @@ public class GenericFunctions {
if (GenericFunctions.isEquip(p.getEquipment().getItemInMainHand())) { if (GenericFunctions.isEquip(p.getEquipment().getItemInMainHand())) {
aPlugin.API.damageItem(p, p.getEquipment().getItemInMainHand(), 1); aPlugin.API.damageItem(p, p.getEquipment().getItemInMainHand(), 1);
} }
knockOffGreed(p);
} }
TwosideKeeper.log(ChatColor.BLUE+" "+oldhp+"->"+((LivingEntity)target).getHealth()+" HP",3); TwosideKeeper.log(ChatColor.BLUE+" "+oldhp+"->"+((LivingEntity)target).getHealth()+" HP",3);
} }
public static void knockOffGreed(Player p) {
// Chance: (11-tier)*5
//Check for artifacts on all equips.
boolean brokeone = false;
for (int i=0;i<p.getEquipment().getArmorContents().length;i++) {
ItemStack item = p.getEquipment().getArmorContents()[i];
if (isArtifactEquip(item) &&
ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, item)) {
TwosideKeeper.log("Found one.",2);
int tier = item.getEnchantmentLevel(Enchantment.LUCK);
item = ArtifactAbility.downgradeEnchantment(p, item, ArtifactAbility.GREED);
if (Math.random()<=((11-tier)*5)/100d) {p.sendMessage(ChatColor.DARK_AQUA+"A level of "+ChatColor.YELLOW+"Greed"+ChatColor.DARK_AQUA+" has been knocked off of your "+((item.hasItemMeta() && item.getItemMeta().hasDisplayName())?item.getItemMeta().getDisplayName():UserFriendlyMaterialName(item)));
brokeone=true;
break;
}
}
}
if (!brokeone) {
//Try the main hand.
ItemStack item = p.getEquipment().getItemInMainHand();
if (isArtifactEquip(item) &&
ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, item)) {
int tier = item.getEnchantmentLevel(Enchantment.LUCK);
item = ArtifactAbility.downgradeEnchantment(p, item, ArtifactAbility.GREED);
if (Math.random()<=((11-tier)*5)/100d) {p.sendMessage(ChatColor.DARK_AQUA+"A level of "+ChatColor.YELLOW+"Greed"+ChatColor.DARK_AQUA+" has been knocked off of your "+((item.hasItemMeta() && item.getItemMeta().hasDisplayName())?item.getItemMeta().getDisplayName():UserFriendlyMaterialName(item)));
brokeone=true;
}
}
}
}
public static boolean searchfor(List<String> stringy, String searchfor) { public static boolean searchfor(List<String> stringy, String searchfor) {
for (int i=0;i<stringy.size();i++) { for (int i=0;i<stringy.size();i++) {
if (stringy.get(i).contains(searchfor)) { if (stringy.get(i).contains(searchfor)) {

View File

@ -53,7 +53,26 @@ public class Habitation {
} }
if (locationhashes.containsKey(hash)) { if (locationhashes.containsKey(hash)) {
int spawnamt = locationhashes.get(hash); int spawnamt = locationhashes.get(hash);
locationhashes.put(hash,++spawnamt); spawnamt+=5;
locationhashes.put(hash,spawnamt);
for (int x=-2;x<3;x++) {
for (int z=-2;z<3;z++) {
if (x!=0^z!=0) {
addKillToLocation(l.getLocation().add(x,0,z));
}
}
}
}
else {
locationhashes.put(hash,1);
}
}
public void addKillToLocation(Location l) {
String hash = getLocationHash(l);
if (locationhashes.containsKey(hash)) {
int spawnamt = locationhashes.get(hash);
spawnamt+=2;
locationhashes.put(hash,spawnamt);
} }
else { else {
locationhashes.put(hash,1); locationhashes.put(hash,1);

View File

@ -17,6 +17,7 @@ public class DamageLogger {
double actualtotaldmg=0.0; double actualtotaldmg=0.0;
double calculatedtotaldmg=0.0; double calculatedtotaldmg=0.0;
double totalmult=0.0; double totalmult=0.0;
double lasttotaldmg=0.0;
int totalhits=0; int totalhits=0;
String player; String player;
long recordtime; long recordtime;
@ -30,6 +31,7 @@ public class DamageLogger {
public void startRecording() { public void startRecording() {
this.totaldmg=0; this.totaldmg=0;
this.lasttotaldmg=0;
this.calculatedtotaldmg=0.0; this.calculatedtotaldmg=0.0;
this.actualtotaldmg=0.0; this.actualtotaldmg=0.0;
this.breakdownlist.clear(); this.breakdownlist.clear();
@ -73,6 +75,7 @@ public class DamageLogger {
public void addCalculatedTotalDamage(double val) { public void addCalculatedTotalDamage(double val) {
this.calculatedtotaldmg+=val; this.calculatedtotaldmg+=val;
this.lasttotaldmg=val;
} }
public String OutputResults() { public String OutputResults() {
@ -129,4 +132,8 @@ public class DamageLogger {
pd.damagedata.addCalculatedActualDamage(val); pd.damagedata.addCalculatedActualDamage(val);
pd.damagedata.addCalculatedTotalDamage(reducedval); pd.damagedata.addCalculatedTotalDamage(reducedval);
} }
public double getLastDamageDealt() {
return this.lasttotaldmg;
}
} }

View File

@ -63,6 +63,9 @@ public class MonsterController {
if (isZombieLeader(ent)) { if (isZombieLeader(ent)) {
//Zombie leaders have faster movement. //Zombie leaders have faster movement.
ent.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,Integer.MAX_VALUE,1)); ent.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,Integer.MAX_VALUE,1));
Monster m = (Monster)ent;
MonsterStructure ms = TwosideKeeper.monsterdata.get(ent.getUniqueId());
ms.SetLeader(true);
//Set the HP of the leader to a more proper amount. //Set the HP of the leader to a more proper amount.
} }
if (ylv>=128) { if (ylv>=128) {

View File

@ -1,18 +1,23 @@
package sig.plugin.TwosideKeeper; package sig.plugin.TwosideKeeper;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Monster;
public class MonsterStructure { public class MonsterStructure {
public LivingEntity target; public LivingEntity target;
public String original_name; public String original_name;
public Monster m;
public boolean isLeader;
public MonsterStructure() { public MonsterStructure(Monster m) {
target=null; target=null;
original_name=""; original_name="";
this.m=m;
} }
public MonsterStructure(LivingEntity target) { public MonsterStructure(Monster m, LivingEntity target) {
this.target=target; this.target=target;
original_name=""; original_name="";
this.m=m;
} }
public LivingEntity GetTarget() { public LivingEntity GetTarget() {
@ -26,6 +31,9 @@ public class MonsterStructure {
public void SetTarget(LivingEntity target) { public void SetTarget(LivingEntity target) {
this.target=target; this.target=target;
} }
public void SetLeader(boolean leader) {
this.isLeader=leader;
}
public boolean hasOriginalName() { public boolean hasOriginalName() {
return !this.original_name.equalsIgnoreCase(""); return !this.original_name.equalsIgnoreCase("");
@ -38,4 +46,8 @@ public class MonsterStructure {
return ""; return "";
} }
} }
public boolean getLeader() {
return this.isLeader;
}
} }

View File

@ -1,5 +1,6 @@
package sig.plugin.TwosideKeeper; package sig.plugin.TwosideKeeper;
import java.text.DecimalFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
@ -166,7 +167,7 @@ public class NewCombat {
armorpendmg = calculateArmorPen(p, finaldmg); armorpendmg = calculateArmorPen(p, finaldmg);
} }
return CalculateDamageReduction(finaldmg,target,damager) + return CalculateDamageReduction(finaldmg-armorpendmg,target,damager) +
armorpendmg; armorpendmg;
} }
@ -400,7 +401,7 @@ public class NewCombat {
if (TwosideKeeper.monsterdata.containsKey(m.getUniqueId())) { if (TwosideKeeper.monsterdata.containsKey(m.getUniqueId())) {
MonsterStructure ms = (MonsterStructure)TwosideKeeper.monsterdata.get(m.getUniqueId()); MonsterStructure ms = (MonsterStructure)TwosideKeeper.monsterdata.get(m.getUniqueId());
} else { } else {
TwosideKeeper.monsterdata.put(m.getUniqueId(),new MonsterStructure(p)); TwosideKeeper.monsterdata.put(m.getUniqueId(),new MonsterStructure(m,p));
} }
} }
@ -427,7 +428,7 @@ public class NewCombat {
MonsterStructure ms = (MonsterStructure)TwosideKeeper.monsterdata.get(mm.getUniqueId()); MonsterStructure ms = (MonsterStructure)TwosideKeeper.monsterdata.get(mm.getUniqueId());
ms.SetTarget(p); ms.SetTarget(p);
} else { } else {
TwosideKeeper.monsterdata.put(mm.getUniqueId(),new MonsterStructure(p)); TwosideKeeper.monsterdata.put(mm.getUniqueId(),new MonsterStructure(m,p));
} }
} }
} }
@ -607,9 +608,15 @@ public class NewCombat {
if (shooter instanceof Player) { if (shooter instanceof Player) {
pd.target=getDamagerEntity(target); pd.target=getDamagerEntity(target);
} }
if (pd.damagelogging) {
DecimalFormat df = new DecimalFormat("0.0");
TwosideKeeper.updateTitle(pl,ChatColor.AQUA+df.format(pd.damagedata.getLastDamageDealt()));
} else {
TwosideKeeper.updateTitle(pl,headshot,preemptive); TwosideKeeper.updateTitle(pl,headshot,preemptive);
} }
} }
}
private static void performMegaKnockback(Entity damager,final LivingEntity target) { private static void performMegaKnockback(Entity damager,final LivingEntity target) {
if (damager instanceof Player) { if (damager instanceof Player) {
@ -1121,9 +1128,9 @@ public class NewCombat {
double reductionamt = GenericFunctions.getAbilityValue(ArtifactAbility.DAMAGE_REDUCTION, armor[i]); double reductionamt = GenericFunctions.getAbilityValue(ArtifactAbility.DAMAGE_REDUCTION, armor[i]);
dmgreduction+=reductionamt; dmgreduction+=reductionamt;
TwosideKeeper.log("Reducing damage by "+reductionamt+"%",5); TwosideKeeper.log("Reducing damage by "+reductionamt+"%",5);
if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, armor[i])) { /*if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, armor[i])) {
dmgreduction /= Math.pow(ArtifactAbility.getEnchantmentLevel(ArtifactAbility.GREED, armor[i]),2); dmgreduction /= ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, armor[i])?2:1;
} }*/
} }
} }
} }
@ -1155,11 +1162,11 @@ public class NewCombat {
TwosideKeeper.log("Base damage became "+(dmgreduce*100)+"% of original amount.",5); TwosideKeeper.log("Base damage became "+(dmgreduce*100)+"% of original amount.",5);
} }
if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getArmorContents()[i])) { if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getArmorContents()[i])) {
dmgreduction /= Math.pow(ArtifactAbility.getEnchantmentLevel(ArtifactAbility.GREED, p.getEquipment().getArmorContents()[i]),2); dmgreduction /= ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getArmorContents()[i])?2:1;
} }
} }
if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand())) { if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand())) {
dmgreduction /= Math.pow(ArtifactAbility.getEnchantmentLevel(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand()),2); dmgreduction /= ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand())?2:1;
} }
dmgreduction *= 1.0+(ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.SONGSTEEL, 4, 4)/100d); dmgreduction *= 1.0+(ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.SONGSTEEL, 4, 4)/100d);
} }

View File

@ -251,7 +251,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public static final int DEATHMARK_COOLDOWN=240; public static final int DEATHMARK_COOLDOWN=240;
public static final int EARTHWAVE_COOLDOWN=300; public static final int EARTHWAVE_COOLDOWN=300;
public static final int ERUPTION_COOLDOWN=100; public static final int ERUPTION_COOLDOWN=100;
public static final int LINEDRIVE_COOLDOWN=160; public static final int LINEDRIVE_COOLDOWN=240;
public static final int REJUVENATE_COOLDOWN=2400; public static final int REJUVENATE_COOLDOWN=2400;
public static File filesave; public static File filesave;
@ -265,6 +265,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public static AutoUpdatePlugin pluginupdater; public static AutoUpdatePlugin pluginupdater;
public static boolean restarting_server=false; public static boolean restarting_server=false;
long LastClearStructureTime = 0;
public int TeamCounter = 0; public int TeamCounter = 0;
public static int time_passed = 0; //The total amount of time lost due to modifications to FullTime(). public static int time_passed = 0; //The total amount of time lost due to modifications to FullTime().
public static List<Party> PartyList = new ArrayList<Party>(); public static List<Party> PartyList = new ArrayList<Party>();
@ -338,6 +340,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
habitat_data = new Habitation(); habitat_data = new Habitation();
habitat_data.loadLocationHashesFromConfig(); habitat_data.loadLocationHashesFromConfig();
LastClearStructureTime = getServerTickTime();
TwosideRecyclingCenter = new RecyclingCenter(); TwosideRecyclingCenter = new RecyclingCenter();
TwosideRecyclingCenter.loadConfig(); TwosideRecyclingCenter.loadConfig();
TwosideRecyclingCenter.populateItemListFromAllNodes(); TwosideRecyclingCenter.populateItemListFromAllNodes();
@ -525,6 +529,23 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
} }
if (getServerTickTime()-LastClearStructureTime>=100) {
//Perform a clear of Monster Structure.
for (int i=0;i<monsterdata.size();i++) {
MonsterStructure mon = monsterdata.get(monsterdata.keySet().toArray()[i]);
Monster m = mon.m;
if (!m.isValid() || m.isDead()) {
monsterdata.remove(monsterdata.keySet().toArray()[i]);
i--;
log("Removed one from Structure",5);
}
if (mon.isLeader) {
//Make it glow red.
GlowAPI.setGlowing(m, GlowAPI.Color.DARK_RED, Bukkit.getOnlinePlayers());
}
}
}
//See if each player needs to regenerate their health. //See if each player needs to regenerate their health.
for (int i=0;i<Bukkit.getOnlinePlayers().size();i++) { for (int i=0;i<Bukkit.getOnlinePlayers().size();i++) {
Player p = (Player)(Bukkit.getOnlinePlayers().toArray()[i]); Player p = (Player)(Bukkit.getOnlinePlayers().toArray()[i]);
@ -627,11 +648,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
for (int i1=0;i1<equips.length;i1++) { for (int i1=0;i1<equips.length;i1++) {
if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, equips[i1])) { if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, equips[i1])) {
totalregen /= Math.pow(ArtifactAbility.getEnchantmentLevel(ArtifactAbility.GREED, equips[i1]),2); totalregen /= ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, equips[i1])?2:1;
} }
} }
if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand())) { if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand())) {
totalregen /= Math.pow(ArtifactAbility.getEnchantmentLevel(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand()),2); totalregen /= ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand())?2:1;
} }
p.setHealth((p.getHealth()+totalregen>p.getMaxHealth())?p.getMaxHealth():p.getHealth()+totalregen); p.setHealth((p.getHealth()+totalregen>p.getMaxHealth())?p.getMaxHealth():p.getHealth()+totalregen);
@ -2835,7 +2856,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
AreaEffectCloud lp = (AreaEffectCloud)ev1.getPlayer().getWorld().spawnEntity(newpos, EntityType.AREA_EFFECT_CLOUD); AreaEffectCloud lp = (AreaEffectCloud)ev1.getPlayer().getWorld().spawnEntity(newpos, EntityType.AREA_EFFECT_CLOUD);
lp.setColor(Color.OLIVE); lp.setColor(Color.OLIVE);
DecimalFormat df = new DecimalFormat("0.00"); DecimalFormat df = new DecimalFormat("0.00");
lp.setCustomName("LD "+df.format(NewCombat.CalculateWeaponDamage(ev1.getPlayer(),null)*7)+" "+ev1.getPlayer().getName()); lp.setCustomName("LD "+df.format(NewCombat.CalculateWeaponDamage(ev1.getPlayer(),null))+" "+ev1.getPlayer().getName());
lp.setRadius(2f); lp.setRadius(2f);
lp.setDuration(1); lp.setDuration(1);
lp.setReapplicationDelay(5); lp.setReapplicationDelay(5);
@ -3505,6 +3526,19 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true) @EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
public void MonsterSpawnEvent(CreatureSpawnEvent ev) { public void MonsterSpawnEvent(CreatureSpawnEvent ev) {
if (ev.getEntity() instanceof Monster) {
Monster m = (Monster)ev.getEntity();
if (!habitat_data.addNewStartingLocation(ev.getEntity())) {
ev.getEntity().remove();
ev.setCancelled(true);
}
if (!monsterdata.containsKey(m.getUniqueId())) {
monsterdata.put(m.getUniqueId(), new MonsterStructure(m));
}
}
if ((ev.getSpawnReason().equals(SpawnReason.DISPENSE_EGG) || if ((ev.getSpawnReason().equals(SpawnReason.DISPENSE_EGG) ||
ev.getSpawnReason().equals(SpawnReason.EGG)) && ev.getSpawnReason().equals(SpawnReason.EGG)) &&
NewCombat.trimNonLivingEntities(ev.getEntity().getNearbyEntities(8, 8, 8)).size()>20) { NewCombat.trimNonLivingEntities(ev.getEntity().getNearbyEntities(8, 8, 8)).size()>20) {
@ -3546,13 +3580,6 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
log("Prevented a skeleton horse from spawning at Location "+ev.getLocation().toString()+".",3); log("Prevented a skeleton horse from spawning at Location "+ev.getLocation().toString()+".",3);
} }
} }
if (ev.getEntity() instanceof Monster) {
if (!habitat_data.addNewStartingLocation(ev.getEntity())) {
ev.getEntity().remove();
ev.setCancelled(true);
}
}
} }
//A fix to make achievemnt announcements not show the healthbar! //A fix to make achievemnt announcements not show the healthbar!
@ -3860,20 +3887,34 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
if (ev.getEntityType()==EntityType.ENDERMAN) { if (ev.getEntityType()==EntityType.ENDERMAN) {
//There is a small chance to drop a Mysterious Essence. //There is a small chance to drop a Mysterious Essence.
if (/*Math.random()<=0.0625*ARTIFACT_RARITY &&*/ ((Monster)ev.getEntity()).getTarget()==null) { //We won't drop it when they are targeting a player, only when they are doing their own thing. if (/*Math.random()<=0.0625*ARTIFACT_RARITY &&*/ ((Monster)ev.getEntity()).getTarget()==null &&
((!monsterdata.containsKey(ev.getEntity().getUniqueId())) ||
monsterdata.get(ev.getEntity().getUniqueId()).GetTarget()==null)) { //We won't drop it when they are targeting a player, only when they are doing their own thing.
Block block_teleported_on = ev.getFrom().add(0,0,0).getBlock();
log("Teleported on "+block_teleported_on.getType()+".",2);
if (block_teleported_on.isLiquid()) {
if (MonsterController.getMonsterDifficulty(((Monster)ev.getEntity()))==MonsterDifficulty.HELLFIRE) { if (MonsterController.getMonsterDifficulty(((Monster)ev.getEntity()))==MonsterDifficulty.HELLFIRE) {
EssenceLogger.AddHellfireEssence(); ItemStack i=new ItemStack(Material.PUMPKIN_SEEDS,1);
ItemStack
i=new ItemStack(Material.PUMPKIN_SEEDS,1);
Item it = ev.getFrom().getWorld().dropItem(ev.getFrom().add(0,200,0), Artifact.convert(Artifact.setName(i,ArtifactItem.MYSTERIOUS_ESSENCE),ArtifactItem.MYSTERIOUS_ESSENCE,true)); Item it = ev.getFrom().getWorld().dropItem(ev.getFrom().add(0,200,0), Artifact.convert(Artifact.setName(i,ArtifactItem.MYSTERIOUS_ESSENCE),ArtifactItem.MYSTERIOUS_ESSENCE,true));
it.setVelocity(new Vector(0,0,0)); it.setVelocity(new Vector(0,0,0));
EssenceLogger.AddHellfireEssence();
} else { } else {
//EssenceLogger.AddGeneralEssence(); EssenceLogger.AddGeneralEssence();
Item it = ev.getFrom().getWorld().dropItem(ev.getFrom().add(0,200,0), Artifact.createArtifactItem(ArtifactItem.MYSTERIOUS_ESSENCE)); Item it = ev.getFrom().getWorld().dropItem(ev.getFrom().add(0,200,0), Artifact.createArtifactItem(ArtifactItem.MYSTERIOUS_ESSENCE));
it.setVelocity(new Vector(0,0,0)); it.setVelocity(new Vector(0,0,0));
} }
} }
} }
Monster m = (Monster)ev.getEntity();
if (m.getTarget() instanceof Player) {
Player p = (Player)m.getTarget();
if (GenericFunctions.isRanger(p)) {
//Teleport it into oblivion.
log("Going into another dimension...",2);
m.teleport(new Location(Bukkit.getWorld("world_nether"),m.getLocation().getX(),m.getLocation().getY(),m.getLocation().getZ()));
}
}
}
} }
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true) @EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
@ -3976,6 +4017,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (p.hasPotionEffect(PotionEffectType.GLOWING)) { if (p.hasPotionEffect(PotionEffectType.GLOWING)) {
ev.setCancelled(true); ev.setCancelled(true);
} }
if (!ev.isCancelled()) {
double dodgechance = NewCombat.CalculateDodgeChance(p); double dodgechance = NewCombat.CalculateDodgeChance(p);
if (ev.getCause()==DamageCause.THORNS && if (ev.getCause()==DamageCause.THORNS &&
GenericFunctions.isRanger(p)) { GenericFunctions.isRanger(p)) {
@ -4008,6 +4050,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
ev.setCancelled(true); ev.setCancelled(true);
} }
} }
}
if (!ev.isCancelled()) { if (!ev.isCancelled()) {
if (ev.getEntity() instanceof LivingEntity) { if (ev.getEntity() instanceof LivingEntity) {
dmg = NewCombat.applyDamage((LivingEntity)ev.getEntity(), ev.getDamager()); dmg = NewCombat.applyDamage((LivingEntity)ev.getEntity(), ev.getDamager());
@ -4045,6 +4088,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (GenericFunctions.isEquip(p.getEquipment().getItemInMainHand())) { if (GenericFunctions.isEquip(p.getEquipment().getItemInMainHand())) {
aPlugin.API.damageItem(p, p.getEquipment().getItemInMainHand(), 1); aPlugin.API.damageItem(p, p.getEquipment().getItemInMainHand(), 1);
} }
GenericFunctions.knockOffGreed(p);
} }
} }
} //Negative damage doesn't make sense. We'd apply it normally. } //Negative damage doesn't make sense. We'd apply it normally.
@ -4391,12 +4435,21 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
GenericFunctions.DealDamageToMob(reduceddmg, affected.get(i), Bukkit.getPlayer(ev.getEntity().getCustomName().split(" ")[2]), Bukkit.getPlayer(ev.getEntity().getCustomName().split(" ")[2]).getEquipment().getItemInMainHand()); GenericFunctions.DealDamageToMob(reduceddmg, affected.get(i), Bukkit.getPlayer(ev.getEntity().getCustomName().split(" ")[2]), Bukkit.getPlayer(ev.getEntity().getCustomName().split(" ")[2]).getEquipment().getItemInMainHand());
} else } else
if (ev.getEntity().getCustomName().contains("LD ")) { if (ev.getEntity().getCustomName().contains("LD ")) {
Player p = Bukkit.getPlayer(ev.getEntity().getCustomName().split(" ")[2]);
double dmgdealt=Double.parseDouble(ev.getEntity().getCustomName().split(" ")[1]); double dmgdealt=Double.parseDouble(ev.getEntity().getCustomName().split(" ")[1]);
log("Dealing "+dmgdealt+" damage. Player is "+Bukkit.getPlayer(ev.getEntity().getCustomName().split(" ")[2]).getName(),4); dmgdealt*=1.0d+(4*((100-NewCombat.getPercentHealthRemaining((Monster)affected.get(i)))/100d));
log("Dealing "+dmgdealt+" damage. Player is "+p.getName(),4);
double reduceddmg = CalculateDamageReduction(dmgdealt,affected.get(i),null); double reduceddmg = CalculateDamageReduction(dmgdealt,affected.get(i),null);
DamageLogger.AddNewCalculation(Bukkit.getPlayer(ev.getEntity().getCustomName().split(" ")[2]), ChatColor.GREEN+"Line Drive", dmgdealt, reduceddmg); DamageLogger.AddNewCalculation(Bukkit.getPlayer(ev.getEntity().getCustomName().split(" ")[2]), ChatColor.GREEN+"Line Drive", dmgdealt, reduceddmg);
GenericFunctions.DealDamageToMob(reduceddmg, affected.get(i), Bukkit.getPlayer(ev.getEntity().getCustomName().split(" ")[2]), Bukkit.getPlayer(ev.getEntity().getCustomName().split(" ")[2]).getEquipment().getItemInMainHand()); GenericFunctions.DealDamageToMob(reduceddmg, affected.get(i), Bukkit.getPlayer(ev.getEntity().getCustomName().split(" ")[2]), Bukkit.getPlayer(ev.getEntity().getCustomName().split(" ")[2]).getEquipment().getItemInMainHand());
((Monster)affected.get(i)).addPotionEffect(new PotionEffect(PotionEffectType.LEVITATION,2,100));} ((Monster)affected.get(i)).addPotionEffect(new PotionEffect(PotionEffectType.LEVITATION,2,100));
if (affected.get(i).isDead()) {
//Restore the cooldown a little for the player. Refresh the cooldown amount.
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
pd.last_strikerspell = pd.last_strikerspell-40;
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), (int)(LINEDRIVE_COOLDOWN-(TwosideKeeper.getServerTickTime()-pd.last_strikerspell)));
}
}
} }
} else { } else {
affected.remove(i); affected.remove(i);
@ -4707,12 +4760,23 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true) @EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
public void onArrowShoot(ProjectileLaunchEvent ev) { public void onArrowShoot(ProjectileLaunchEvent ev) {
if (ev.getEntity() instanceof Arrow) { if (ev.getEntity() instanceof Projectile) {
Arrow arr = (Arrow)ev.getEntity(); Projectile arr = (Projectile)ev.getEntity();
//Arrow newarrow = arr.getLocation().getWorld().spawnArrow(arr.getLocation(), arr.getVelocity(), 1, 12); //Arrow newarrow = arr.getLocation().getWorld().spawnArrow(arr.getLocation(), arr.getVelocity(), 1, 12);
if (arr.getShooter() instanceof Player && if (arr.getShooter() instanceof Player &&
arr.getCustomName()==null) { arr.getCustomName()==null && (arr instanceof Arrow)) {
Player p = (Player)arr.getShooter(); Player p = (Player)arr.getShooter();
LivingEntity checkent = aPlugin.API.getTargetEntity(p, 100);
if (checkent!=null && (checkent instanceof Monster)) {
if (!monsterdata.containsKey(checkent.getUniqueId())) {
MonsterStructure newstruct = new MonsterStructure((Monster)checkent);
newstruct.SetTarget(p);
monsterdata.put(checkent.getUniqueId(), newstruct);
Monster m = (Monster)checkent;
m.setTarget(p);
}
log("Setup new target: "+p.getName(),5);
}
if (GenericFunctions.isRanger(p)) { if (GenericFunctions.isRanger(p)) {
if (GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.SNIPE) {arr.setVelocity(arr.getVelocity().multiply(1000));} if (GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.SNIPE) {arr.setVelocity(arr.getVelocity().multiply(1000));}
log(arr.getVelocity().lengthSquared()+"",5); log(arr.getVelocity().lengthSquared()+"",5);
@ -5799,14 +5863,14 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
hp += (double)GenericFunctions.getAbilityValue(ArtifactAbility.HEALTH, equipment[i]); hp += (double)GenericFunctions.getAbilityValue(ArtifactAbility.HEALTH, equipment[i]);
if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, equipment[i])) { if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, equipment[i])) {
maxdeduction /= Math.pow(ArtifactAbility.getEnchantmentLevel(ArtifactAbility.GREED, equipment[i]),2)+1; maxdeduction /= ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, equipment[i])?2:1;
} }
} }
} }
} }
log("Health is now "+hp,5); log("Health is now "+hp,5);
if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand())) { if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand())) {
maxdeduction /= Math.pow(ArtifactAbility.getEnchantmentLevel(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand()),2)+1; maxdeduction /= ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand())?2:1;
} }
log("maxdeduction is "+maxdeduction,5); log("maxdeduction is "+maxdeduction,5);