Make hearts not as ridiculous. Mob Healthbars display in all damage
scenarios now.
This commit is contained in:
parent
79c3577469
commit
f56eec16dc
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
name: TwosideKeeper
|
||||
main: sig.plugin.TwosideKeeper.TwosideKeeper
|
||||
version: 3.7.3cr4
|
||||
version: 3.7.3cr5
|
||||
commands:
|
||||
money:
|
||||
description: Tells the player the amount of money they are holding.
|
||||
|
@ -2609,16 +2609,15 @@ public class GenericFunctions {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void DealDamageToMob(double dmg, LivingEntity target, Entity damager) {
|
||||
DealDamageToMob(dmg,target,NewCombat.getDamagerEntity(damager),null,"");
|
||||
}
|
||||
|
||||
public static void DealDamageToMob(double dmg, LivingEntity target, LivingEntity damager, ItemStack artifact) {
|
||||
public static void DealDamageToMob(double dmg, LivingEntity target, Entity damager, ItemStack artifact) {
|
||||
DealDamageToMob(dmg,target,damager,artifact,"");
|
||||
}
|
||||
|
||||
public static void DealDamageToMob(double dmg, LivingEntity target, LivingEntity damager, ItemStack artifact, String reason) {
|
||||
public static void DealDamageToMob(double dmg, LivingEntity target, Entity damager, ItemStack artifact, String reason) {
|
||||
if (damager!=null && (target instanceof Monster)) {
|
||||
Monster m = (Monster)target;
|
||||
if (damager instanceof Player) {
|
||||
@ -2640,23 +2639,26 @@ public class GenericFunctions {
|
||||
}
|
||||
}
|
||||
double oldhp=((LivingEntity)target).getHealth();
|
||||
GenericFunctions.subtractHealth(target, damager, dmg, artifact);
|
||||
LivingEntity le = NewCombat.getDamagerEntity(damager);
|
||||
if (le!=null) {
|
||||
GenericFunctions.subtractHealth(target, le, dmg, artifact);
|
||||
if (artifact!=null &&
|
||||
GenericFunctions.isArtifactEquip(artifact) &&
|
||||
(damager instanceof Player)) {
|
||||
Player p = (Player)damager;
|
||||
(le instanceof Player)) {
|
||||
Player p = (Player)le;
|
||||
double ratio = 1.0-NewCombat.CalculateDamageReduction(1,target,p);
|
||||
AwakenedArtifact.addPotentialEXP(damager.getEquipment().getItemInMainHand(), (int)((ratio*20)+5), p);
|
||||
AwakenedArtifact.addPotentialEXP(le.getEquipment().getItemInMainHand(), (int)((ratio*20)+5), p);
|
||||
NewCombat.increaseArtifactArmorXP(p,(int)(ratio*10)+1);
|
||||
}
|
||||
|
||||
if (damager instanceof Player) {
|
||||
Player p = (Player)damager;
|
||||
if (le instanceof Player) {
|
||||
Player p = (Player)le;
|
||||
if (GenericFunctions.isEquip(p.getEquipment().getItemInMainHand())) {
|
||||
aPlugin.API.damageItem(p, p.getEquipment().getItemInMainHand(), 1);
|
||||
}
|
||||
knockOffGreed(p);
|
||||
}
|
||||
}
|
||||
|
||||
TwosideKeeper.log(ChatColor.BLUE+" "+oldhp+"->"+((LivingEntity)target).getHealth()+" HP",3);
|
||||
}
|
||||
@ -2807,7 +2809,7 @@ public class GenericFunctions {
|
||||
|
||||
TwosideKeeper.log("Damage goes from "+dmg+"->"+(dmg+TwosideKeeper.CUSTOM_DAMAGE_IDENTIFIER),5);
|
||||
entity.damage(dmg+TwosideKeeper.CUSTOM_DAMAGE_IDENTIFIER,damager);
|
||||
aPlugin.API.showDamage(entity, (int)(dmg/10));
|
||||
aPlugin.API.showDamage(entity, GetHeartAmount(dmg));
|
||||
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
if (pd.damagelogging) {
|
||||
@ -2815,6 +2817,9 @@ public class GenericFunctions {
|
||||
DecimalFormat df = new DecimalFormat("0.0");
|
||||
TwosideKeeper.updateTitle(p,ChatColor.AQUA+df.format(dmg));
|
||||
TwosideKeeper.log("In here",2);
|
||||
} else {
|
||||
pd.target=entity;
|
||||
TwosideKeeper.updateTitle(p);
|
||||
}
|
||||
//Bukkit.getPluginManager().callEvent(new EntityDamageByEntityEvent(damager,entity,DamageCause.CUSTOM,dmg+TwosideKeeper.CUSTOM_DAMAGE_IDENTIFIER));
|
||||
} else {
|
||||
@ -2842,7 +2847,7 @@ public class GenericFunctions {
|
||||
if (entity.getHealth()>dmg && entity instanceof Player) {
|
||||
if (!AttemptRevive((Player)entity,dmg)) {
|
||||
entity.setHealth(((Player)entity).getHealth()-dmg);
|
||||
aPlugin.API.showDamage(entity, (int)(dmg/10));
|
||||
aPlugin.API.showDamage(entity, GetHeartAmount(dmg));
|
||||
aPlugin.API.sendEntityHurtAnimation((Player)entity);
|
||||
}
|
||||
}
|
||||
@ -2879,6 +2884,16 @@ public class GenericFunctions {
|
||||
}
|
||||
}
|
||||
|
||||
private static int GetHeartAmount(double dmg) {
|
||||
int heartcount = 1;
|
||||
double dmgamountcopy = dmg;
|
||||
while (dmgamountcopy>10) {
|
||||
dmgamountcopy/=2;
|
||||
heartcount++;
|
||||
}
|
||||
return heartcount;
|
||||
}
|
||||
|
||||
public static boolean isViewingInventory(Player p) {
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
return pd.isViewingInventory;
|
||||
|
@ -150,7 +150,7 @@ public class NewCombat {
|
||||
double mult1 = calculatePlayerCriticalStrike(weapon,damager);
|
||||
addMultiplierToPlayerLogger(damager,"Critical Strike Mult",mult1);
|
||||
if (mult1>1.0) {
|
||||
aPlugin.API.critEntity(target, 10);
|
||||
aPlugin.API.critEntity(target, 15);
|
||||
}
|
||||
bonusmult*=mult1;
|
||||
}
|
||||
|
@ -4037,9 +4037,6 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
log("Stored Damage is "+storeddmg+". CUSTOM_DAMAGE_IDENTIFIER:"+CUSTOM_DAMAGE_IDENTIFIER+"\n...Subtracted damage is "+(storeddmg-CUSTOM_DAMAGE_IDENTIFIER),4);
|
||||
ev.setDamage(DamageModifier.BASE,storeddmg-CUSTOM_DAMAGE_IDENTIFIER);
|
||||
ev.setDamage(storeddmg-CUSTOM_DAMAGE_IDENTIFIER);
|
||||
if (ev.getEntity() instanceof LivingEntity) {
|
||||
aPlugin.API.showDamage((LivingEntity)ev.getEntity(), (int)((storeddmg-CUSTOM_DAMAGE_IDENTIFIER)/10));
|
||||
}
|
||||
log("New Damage: "+ev.getFinalDamage(),4);
|
||||
} else {
|
||||
double dmg = 0.0;
|
||||
@ -4133,7 +4130,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
}
|
||||
GenericFunctions.knockOffGreed(p);
|
||||
}
|
||||
aPlugin.API.showDamage((LivingEntity)ev.getEntity(), (int)(dmg/10));
|
||||
//aPlugin.API.showDamage((LivingEntity)ev.getEntity(), (int)(dmg/10));
|
||||
}
|
||||
} //Negative damage doesn't make sense. We'd apply it normally.
|
||||
}
|
||||
|
@ -159,6 +159,9 @@ public final class TwosideKeeperAPI {
|
||||
public static void DealDamageToEntity(double dmg, LivingEntity target, Entity damager) {
|
||||
GenericFunctions.DealDamageToMob(dmg, target, damager);
|
||||
}
|
||||
public static void DealDamageToEntity(double dmg, LivingEntity target, Entity damager, String reason) {
|
||||
GenericFunctions.DealDamageToMob(dmg, target, damager, null, reason);
|
||||
}
|
||||
|
||||
//Message COMMANDS.
|
||||
public static void playMessageNotification(Player sender) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user