Skip to content

Commit

Permalink
Do not update health mid-morph if player dies. Closes iChun#541
Browse files Browse the repository at this point in the history
  • Loading branch information
iChun committed Jul 17, 2014
1 parent 97fdb00 commit 472917d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/main/java/morph/client/core/TickHandlerClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,10 @@ else if(info.prevState != null && info.player != null)
if(nextMaxHealth != info.player.getEntityAttribute(SharedMonsterAttributes.maxHealth).getBaseValue())
{
info.player.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(nextMaxHealth);
info.player.setHealth((float)nextMaxHealth);
if(info.player.getHealth() < nextMaxHealth)
{
info.player.setHealth((float)nextMaxHealth);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/morph/common/core/TickHandlerServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ else if(info.prevState != null && player != null)
{
targetHealth = 1.0F;
}
if(nextMaxHealth > prevMaxHealth && player.getHealth() + 0.5F < (float)Math.floor(targetHealth) || prevMaxHealth > nextMaxHealth)
if((nextMaxHealth > prevMaxHealth && player.getHealth() + 0.5F < (float)Math.floor(targetHealth) || prevMaxHealth > nextMaxHealth) && player.isEntityAlive())
{
player.setHealth(targetHealth);
}
Expand Down

0 comments on commit 472917d

Please sign in to comment.