Skip to content
Snippets Groups Projects
Commit c76e6f07 authored by Noe Caratini's avatar Noe Caratini
Browse files

fix(effect): Fixed HP/MP/CP not updating when receiving a MaxHp/MaxMP/MaxCp effect

The MaxHp/MaxMp/MaxCp effect are calling L2Character#addStatFunc which does not broadcast a status update packet.
Changed the call to L2Character#addStatFuncs which does handle broadcast.
parent f419d82a
No related branches found
No related tags found
No related merge requests found
......@@ -68,21 +68,19 @@ public final class MaxCp extends AbstractEffect {
synchronized (charStat) {
switch (_type) {
case DIFF: {
charStat.getActiveChar().addStatFunc(new FuncAdd(Stats.MAX_CP, 1, this, _power, null));
case DIFF -> {
charStat.getActiveChar().addStatFuncs(new FuncAdd(Stats.MAX_CP, 1, this, _power, null));
if (_heal) {
effected.setCurrentCp((currentCp + _power));
}
break;
}
case PER: {
case PER -> {
final double maxCp = effected.getMaxCp();
charStat.getActiveChar().addStatFunc(new FuncMul(Stats.MAX_CP, 1, this, _power, null));
charStat.getActiveChar().addStatFuncs(new FuncMul(Stats.MAX_CP, 1, this, _power, null));
if (_heal) {
amount = (_power - 1) * maxCp;
effected.setCurrentCp(currentCp + amount);
}
break;
}
}
}
......
......@@ -68,22 +68,19 @@ public final class MaxHp extends AbstractEffect {
synchronized (charStat) {
switch (_type) {
case DIFF: {
charStat.getActiveChar().addStatFunc(new FuncAdd(Stats.MAX_HP, 1, this, _power, null));
case DIFF -> {
charStat.getActiveChar().addStatFuncs(new FuncAdd(Stats.MAX_HP, 1, this, _power, null));
if (_heal) {
effected.setCurrentHp((currentHp + _power));
}
break;
}
case PER: {
case PER -> {
final double maxHp = effected.getMaxHp();
charStat.getActiveChar().addStatFunc(new FuncMul(Stats.MAX_HP, 1, this, _power, null));
charStat.getActiveChar().addStatFuncs(new FuncMul(Stats.MAX_HP, 1, this, _power, null));
if (_heal) {
amount = (_power - 1) * maxHp;
effected.setCurrentHp(currentHp + amount);
}
break;
}
}
}
......
......@@ -70,21 +70,19 @@ public final class MaxMp extends AbstractEffect {
synchronized (charStat) {
switch (_type) {
case DIFF: {
charStat.getActiveChar().addStatFunc(new FuncAdd(Stats.MAX_MP, 1, this, _power, null));
case DIFF -> {
charStat.getActiveChar().addStatFuncs(new FuncAdd(Stats.MAX_MP, 1, this, _power, null));
if (_heal) {
effected.setCurrentMp((currentMp + _power));
}
break;
}
case PER: {
case PER -> {
final double maxMp = effected.getMaxMp();
charStat.getActiveChar().addStatFunc(new FuncMul(Stats.MAX_MP, 1, this, _power, null));
charStat.getActiveChar().addStatFuncs(new FuncMul(Stats.MAX_MP, 1, this, _power, null));
if (_heal) {
amount = (_power - 1) * maxMp;
effected.setCurrentMp(currentMp + amount);
}
break;
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment