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
main: sig.plugin.TwosideKeeper.TwosideKeeper
version: 3.7.3-alpha3
version: 3.7.3-alpha4
commands:
money:
description: Tells the player the amount of money they are holding.

View File

@ -85,6 +85,8 @@ public class NewCombat {
double finaldmg = 0.0;
if (shooter!=null) {
finaldmg += calculateTotalDamage(target, damager);
finaldmg = calculateAbsorptionHearts(target, finaldmg);
if (shooter instanceof Player) {
Player p = (Player)shooter;
playerPerformMiscActions(p,target);
@ -94,8 +96,6 @@ public class NewCombat {
provokeMonster(m,p);
}
}
finaldmg += calculateTotalDamage(target, damager);
finaldmg = calculateAbsorptionHearts(target, finaldmg);
}
if (shooter!=null) {
@ -457,8 +457,8 @@ public class NewCombat {
static boolean isPreemptiveStrike(LivingEntity m,Player p) {
if (GenericFunctions.isStriker(p) &&
m!=null &&
p.getHealth()==p.getMaxHealth() &&
m.getHealth()==m.getMaxHealth()) {
(m instanceof Monster) &&
((Monster)m).getTarget()==null) {
return true;
} else {
return false;
@ -536,7 +536,7 @@ public class NewCombat {
}
}
applyOnHitEffects(weapon,basedmg * basemult,damager,target);
applyOnHitEffects(weapon,basedmg * basemult,damager,target,headshot);
} else {
if (damager instanceof Arrow) {
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);
mult = mult1;
}
TwosideKeeper.log("mult is "+mult,5);
TwosideKeeper.log("mult is "+mult,5);
return mult;
}
static void applyOnHitEffects(ItemStack weapon, double dmg, Entity damager, LivingEntity target) {
if (damager instanceof Player && target!=null) {
Player p = (Player)damager;
private static void applyOnHitEffects(ItemStack weapon, double dmg, Entity damager, LivingEntity target) {
applyOnHitEffects(weapon,dmg,damager,target,false);
}
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()) &&
GenericFunctions.isArtifactWeapon(p.getEquipment().getItemInMainHand())) {
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);
List<LivingEntity> hitlist = getAOEList(weapon,target);

View File

@ -167,7 +167,7 @@ public class RecyclingCenter {
public void AddItemToRecyclingCenter(Item i) {
//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())) {
//Recycle allowed. Now figure out which node to go to.
if (getNumberOfNodes()>0) {

View File

@ -3924,15 +3924,20 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
//ev.setCancelled(true);
if (ev.getEntity() instanceof LivingEntity) {
((LivingEntity)ev.getEntity()).setNoDamageTicks(10);
double oldhp=((LivingEntity)ev.getEntity()).getHealth();
GenericFunctions.subtractHealth((LivingEntity)ev.getEntity(), NewCombat.getDamagerEntity(ev.getDamager()), dmg);
final double oldhp=((LivingEntity)ev.getEntity()).getHealth();
if (NewCombat.getDamagerEntity(ev.getDamager()) instanceof Player) {
if (ev.getDamager() instanceof Projectile) {
ev.getDamager().remove();
}
GenericFunctions.subtractHealth((LivingEntity)ev.getEntity(), NewCombat.getDamagerEntity(ev.getDamager()), dmg);
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.
}