Skip to content

Commit

Permalink
Fixes logging out mid-morph permanently changing your health for that…
Browse files Browse the repository at this point in the history
… lifetime, iChun#589.
  • Loading branch information
iChun committed Oct 5, 2014
1 parent 6ae30ba commit 15110c7
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 18 deletions.
16 changes: 16 additions & 0 deletions src/main/java/morph/common/core/EventHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -1664,6 +1664,22 @@ public void onPlayerLogout(PlayerEvent.PlayerLoggedOutEvent event)
MorphInfo info = Morph.proxy.tickHandlerServer.playerMorphInfo.get(event.player.getCommandSenderName());
if(info != null)
{
if(info.morphProgress < 80)
{
info.morphProgress = 80;
double nextMaxHealth = MathHelper.clamp_double(info.nextState.entInstance.getEntityAttribute(SharedMonsterAttributes.maxHealth).getBaseValue(), 1D, 20D) + info.healthOffset;

if(nextMaxHealth < 1D)
{
nextMaxHealth = 1D;
}

if(nextMaxHealth != event.player.getEntityAttribute(SharedMonsterAttributes.maxHealth).getBaseValue())
{
event.player.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(nextMaxHealth);
}
}

NBTTagCompound tag1 = new NBTTagCompound();
info.writeNBT(tag1);
Morph.proxy.tickHandlerServer.getMorphDataFromPlayer(event.player).setTag("morphData", tag1);
Expand Down
36 changes: 18 additions & 18 deletions src/main/resources/assets/morph/mod/AbilitySupport.json
Original file line number Diff line number Diff line change
Expand Up @@ -628,20 +628,20 @@
"hostile",
"fly|true"
],
+ "f1repl4ce.unlogic.entities.FireSoul": [
+ "hostile",
+ "fly|false",
+ "fireImmunity",
+ "float",
+ "witherResistance",
+ "fear|6,1.05D,f1repl4ce.unlogic.entities.DJACOB"
+ ],
+ "f1repl4ce.unlogic.entities.DJACOB": [
+ ],
+ "f1repl4ce.unlogic.entities.SnackAttackMan": [
+ "witherResistance"
+ ],
"f1repl4ce.unlogic.entities.FireSoul": [
"hostile",
"fly|false",
"fireImmunity",
"float",
"witherResistance",
"fear|6,1.05D,f1repl4ce.unlogic.entities.DJACOB"
],
"f1repl4ce.unlogic.entities.DJACOB": [

],
"f1repl4ce.unlogic.entities.SnackAttackMan": [
"witherResistance"
],
"gaia.entity.EntityGaiaAnubis": [
"hostile"
],
Expand Down Expand Up @@ -1492,7 +1492,7 @@
"tragicneko.tragicmc.entity.boss.EntityYeti": [
"hostile",
"step|2.0F",
"fallNegate",
"fallNegate"
],
"tragicneko.tragicmc.entity.mob.EntityAbomination": [
"hostile",
Expand Down Expand Up @@ -1534,12 +1534,12 @@
],
"tragicneko.tragicmc.entity.mob.EntityPirah": [
"hostile",
"swim|false, 229479, 1.0F, 0.2F, true"
"swim|false,1.0F,0.2F,true"
],
"tragicneko.tragicmc.entity.mob.EntityPlague": [
"hostile",
"fly|false",
"swim|true, 892742, 1.0F, 1.0F, true"
"swim|true,1.0F,1.0F,true"
],
"tragicneko.tragicmc.entity.mob.EntityPumpkinhead": [
"hostile"
Expand All @@ -1559,7 +1559,7 @@
],
"tragicneko.tragicmc.entity.mob.EntityTox": [
"hostile",
"poisonResistance",
"poisonResistance"
],
"tragicneko.tragicmc.entity.mob.EntityTragicNeko": [
"hostile"
Expand Down

0 comments on commit 15110c7

Please sign in to comment.