diff --git a/TwosideKeeper.jar b/TwosideKeeper.jar index 272e66c..7ecd8b7 100644 Binary files a/TwosideKeeper.jar and b/TwosideKeeper.jar differ diff --git a/src/plugin.yml b/src/plugin.yml index cbb5e42..7cbe9b8 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -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. diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java index 474bdb3..ab5ae3f 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java @@ -2606,19 +2606,18 @@ public class GenericFunctions { @Deprecated public static void DealDamageToMob(double dmg, LivingEntity target, LivingEntity damager, boolean truedmg) { DealDamageToMob(dmg,target,damager,null,""); - } - + } 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,22 +2639,25 @@ public class GenericFunctions { } } double oldhp=((LivingEntity)target).getHealth(); - GenericFunctions.subtractHealth(target, damager, dmg, artifact); - if (artifact!=null && - GenericFunctions.isArtifactEquip(artifact) && - (damager instanceof Player)) { - Player p = (Player)damager; - double ratio = 1.0-NewCombat.CalculateDamageReduction(1,target,p); - AwakenedArtifact.addPotentialEXP(damager.getEquipment().getItemInMainHand(), (int)((ratio*20)+5), p); - NewCombat.increaseArtifactArmorXP(p,(int)(ratio*10)+1); - } + LivingEntity le = NewCombat.getDamagerEntity(damager); + if (le!=null) { + GenericFunctions.subtractHealth(target, le, dmg, artifact); + if (artifact!=null && + GenericFunctions.isArtifactEquip(artifact) && + (le instanceof Player)) { + Player p = (Player)le; + double ratio = 1.0-NewCombat.CalculateDamageReduction(1,target,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 (GenericFunctions.isEquip(p.getEquipment().getItemInMainHand())) { - aPlugin.API.damageItem(p, p.getEquipment().getItemInMainHand(), 1); + if (le instanceof Player) { + Player p = (Player)le; + if (GenericFunctions.isEquip(p.getEquipment().getItemInMainHand())) { + aPlugin.API.damageItem(p, p.getEquipment().getItemInMainHand(), 1); + } + knockOffGreed(p); } - knockOffGreed(p); } TwosideKeeper.log(ChatColor.BLUE+" "+oldhp+"->"+((LivingEntity)target).getHealth()+" HP",3); @@ -2807,14 +2809,17 @@ 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) { + if (pd.damagelogging) { pd.target=entity; 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; diff --git a/src/sig/plugin/TwosideKeeper/NewCombat.java b/src/sig/plugin/TwosideKeeper/NewCombat.java index f19f9dd..3797196 100644 --- a/src/sig/plugin/TwosideKeeper/NewCombat.java +++ b/src/sig/plugin/TwosideKeeper/NewCombat.java @@ -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; } diff --git a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java index 015a7a8..102ff63 100644 --- a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java +++ b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java @@ -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. } diff --git a/src/sig/plugin/TwosideKeeper/TwosideKeeperAPI.java b/src/sig/plugin/TwosideKeeper/TwosideKeeperAPI.java index f68c833..9f01f86 100644 --- a/src/sig/plugin/TwosideKeeper/TwosideKeeperAPI.java +++ b/src/sig/plugin/TwosideKeeper/TwosideKeeperAPI.java @@ -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) {