Support for Resurrection effects with HP MP CP percent parameters.

This commit is contained in:
MobiusDevelopment
2020-11-28 22:05:34 +00:00
parent 5ad9a3f918
commit 36328f9d1e
94 changed files with 1081 additions and 85 deletions

View File

@ -149,7 +149,7 @@ public abstract class Playable extends Creature
{
if (player.isInSiege())
{
getActingPlayer().reviveRequest(getActingPlayer(), false, 0);
getActingPlayer().reviveRequest(getActingPlayer(), false, 0, 0, 0, 0);
}
player.setCharmOfCourage(false);
player.sendPacket(new EtcStatusUpdate(player));

View File

@ -750,6 +750,9 @@ public class PlayerInstance extends Playable
private boolean _canRevive = true;
private int _reviveRequested = 0;
private double _revivePower = 0;
private int _reviveHpPercent = 0;
private int _reviveMpPercent = 0;
private int _reviveCpPercent = 0;
private boolean _revivePet = false;
private double _cpUpdateIncCheck = .0;
@ -10085,7 +10088,7 @@ public class PlayerInstance extends Playable
restoreExp(revivePower);
}
public void reviveRequest(PlayerInstance reviver, boolean isPet, int power)
public void reviveRequest(PlayerInstance reviver, boolean isPet, int power, int reviveHp, int reviveMp, int reviveCp)
{
if (isResurrectionBlocked())
{
@ -10112,6 +10115,9 @@ public class PlayerInstance extends Playable
{
_reviveRequested = 1;
_revivePower = Formulas.calculateSkillResurrectRestorePercent(power, reviver);
_reviveHpPercent = reviveHp;
_reviveMpPercent = reviveMp;
_reviveCpPercent = reviveCp;
_revivePet = isPet;
if (hasCharmOfCourage())
{
@ -10164,6 +10170,43 @@ public class PlayerInstance extends Playable
}
_reviveRequested = 0;
_revivePower = 0;
// Support for specific HP/MP/CP percentage restored.
final Creature effected = _revivePet ? _pet : this;
if (effected == null)
{
_reviveHpPercent = 0;
_reviveMpPercent = 0;
_reviveCpPercent = 0;
return;
}
if (_reviveHpPercent > 0)
{
final double amount = (effected.getMaxHp() * _reviveHpPercent) / 100;
if (amount > 0)
{
effected.setCurrentHp(amount, true);
}
_reviveHpPercent = 0;
}
if (_reviveMpPercent > 0)
{
final double amount = (effected.getMaxMp() * _reviveMpPercent) / 100;
if (amount > 0)
{
effected.setCurrentMp(amount, true);
}
_reviveMpPercent = 0;
}
if (_reviveCpPercent > 0)
{
final double amount = (effected.getMaxCp() * _reviveCpPercent) / 100;
if (amount > 0)
{
effected.setCurrentCp(amount, true);
}
_reviveCpPercent = 0;
}
}
public boolean isReviveRequested()