Bow Artifacts gain EXP again. Death messages no longer appear twice.

This commit is contained in:
sigonasr2 2016-07-29 23:13:07 -05:00
parent c9ddbb7bc7
commit a2e6449ab7
5 changed files with 25 additions and 15 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.3-alpha3 version: 3.7.3-alpha4
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

@ -85,6 +85,8 @@ public class NewCombat {
double finaldmg = 0.0; double finaldmg = 0.0;
if (shooter!=null) { if (shooter!=null) {
finaldmg += calculateTotalDamage(target, damager);
finaldmg = calculateAbsorptionHearts(target, finaldmg);
if (shooter instanceof Player) { if (shooter instanceof Player) {
Player p = (Player)shooter; Player p = (Player)shooter;
playerPerformMiscActions(p,target); playerPerformMiscActions(p,target);
@ -94,8 +96,6 @@ public class NewCombat {
provokeMonster(m,p); provokeMonster(m,p);
} }
} }
finaldmg += calculateTotalDamage(target, damager);
finaldmg = calculateAbsorptionHearts(target, finaldmg);
} }
if (shooter!=null) { if (shooter!=null) {
@ -457,8 +457,8 @@ public class NewCombat {
static boolean isPreemptiveStrike(LivingEntity m,Player p) { static boolean isPreemptiveStrike(LivingEntity m,Player p) {
if (GenericFunctions.isStriker(p) && if (GenericFunctions.isStriker(p) &&
m!=null && m!=null &&
p.getHealth()==p.getMaxHealth() && (m instanceof Monster) &&
m.getHealth()==m.getMaxHealth()) { ((Monster)m).getTarget()==null) {
return true; return true;
} else { } else {
return false; return false;
@ -536,7 +536,7 @@ public class NewCombat {
} }
} }
applyOnHitEffects(weapon,basedmg * basemult,damager,target); applyOnHitEffects(weapon,basedmg * basemult,damager,target,headshot);
} else { } else {
if (damager instanceof Arrow) { if (damager instanceof Arrow) {
return 4.5; //This is a basic arrow with no shooter. Deal some damage. return 4.5; //This is a basic arrow with no shooter. Deal some damage.
@ -877,17 +877,22 @@ public class NewCombat {
addMultiplierToPlayerLogger(damager,"Base Arrow Damage Mult",mult1); addMultiplierToPlayerLogger(damager,"Base Arrow Damage Mult",mult1);
mult = mult1; mult = mult1;
} }
TwosideKeeper.log("mult is "+mult,5); TwosideKeeper.log("mult is "+mult,5);
return mult; return mult;
} }
static void applyOnHitEffects(ItemStack weapon, double dmg, Entity damager, LivingEntity target) { private static void applyOnHitEffects(ItemStack weapon, double dmg, Entity damager, LivingEntity target) {
if (damager instanceof Player && target!=null) { applyOnHitEffects(weapon,dmg,damager,target,false);
Player p = (Player)damager; }
static void applyOnHitEffects(ItemStack weapon, double dmg, Entity damager, LivingEntity target, boolean headshot) {
LivingEntity shooter = getDamagerEntity(damager);
if ((shooter instanceof Player) && target!=null) {
Player p = (Player)shooter;
if (GenericFunctions.isArtifactEquip(p.getEquipment().getItemInMainHand()) && if (GenericFunctions.isArtifactEquip(p.getEquipment().getItemInMainHand()) &&
GenericFunctions.isArtifactWeapon(p.getEquipment().getItemInMainHand())) { GenericFunctions.isArtifactWeapon(p.getEquipment().getItemInMainHand())) {
double ratio = 1.0-CalculateDamageReduction(1,target,p); double ratio = 1.0-CalculateDamageReduction(1,target,p);
AwakenedArtifact.addPotentialEXP(p.getEquipment().getItemInMainHand(), (int)(ratio*20)+5, p); AwakenedArtifact.addPotentialEXP(p.getEquipment().getItemInMainHand(), (int)((ratio*20)+5)*((headshot)?2:1), p);
increaseArtifactArmorXP(p,(int)(ratio*10)+1); increaseArtifactArmorXP(p,(int)(ratio*10)+1);
List<LivingEntity> hitlist = getAOEList(weapon,target); List<LivingEntity> hitlist = getAOEList(weapon,target);

View File

@ -167,7 +167,7 @@ public class RecyclingCenter {
public void AddItemToRecyclingCenter(Item i) { public void AddItemToRecyclingCenter(Item i) {
//There is a % chance of it going to a recycling center. //There is a % chance of it going to a recycling center.
if (Math.random()*100<=TwosideKeeper.RECYCLECHANCE && if ((Math.random()*100<=TwosideKeeper.RECYCLECHANCE || GenericFunctions.isArtifactEquip(i.getItemStack())) &&
IsItemAllowed(i.getItemStack())) { IsItemAllowed(i.getItemStack())) {
//Recycle allowed. Now figure out which node to go to. //Recycle allowed. Now figure out which node to go to.
if (getNumberOfNodes()>0) { if (getNumberOfNodes()>0) {

View File

@ -3924,15 +3924,20 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
//ev.setCancelled(true); //ev.setCancelled(true);
if (ev.getEntity() instanceof LivingEntity) { if (ev.getEntity() instanceof LivingEntity) {
((LivingEntity)ev.getEntity()).setNoDamageTicks(10); ((LivingEntity)ev.getEntity()).setNoDamageTicks(10);
double oldhp=((LivingEntity)ev.getEntity()).getHealth(); final double oldhp=((LivingEntity)ev.getEntity()).getHealth();
GenericFunctions.subtractHealth((LivingEntity)ev.getEntity(), NewCombat.getDamagerEntity(ev.getDamager()), dmg);
if (NewCombat.getDamagerEntity(ev.getDamager()) instanceof Player) { if (NewCombat.getDamagerEntity(ev.getDamager()) instanceof Player) {
if (ev.getDamager() instanceof Projectile) { if (ev.getDamager() instanceof Projectile) {
ev.getDamager().remove(); ev.getDamager().remove();
} }
GenericFunctions.subtractHealth((LivingEntity)ev.getEntity(), NewCombat.getDamagerEntity(ev.getDamager()), dmg);
ev.setCancelled(true); ev.setCancelled(true);
} else {
ev.setDamage(dmg);
} }
log(ChatColor.BLUE+" "+oldhp+"->"+((LivingEntity)ev.getEntity()).getHealth()+" HP",3); Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
log(ChatColor.BLUE+" "+oldhp+"->"+((LivingEntity)ev.getEntity()).getHealth()+" HP",3);
}},1);
} }
} //Negative damage doesn't make sense. We'd apply it normally. } //Negative damage doesn't make sense. We'd apply it normally.
} }