MoveLifeHandler & Puppets disrupting mobbuffs patch
Cleared an issue presented recently that would try to "apply a mobskill" when it should be doing a routine check, this resulting on the mob skill not being usable at all (since it'd be in cooldown). Fixed an issue on where casting puppets on the field would disrupt current mob buffs for the caster bowman.
This commit is contained in:
@@ -95,7 +95,7 @@ public final class MoveLifeHandler extends AbstractMovementPacketHandler {
|
||||
if (castPos != -1) {
|
||||
toUse = MobSkillFactory.getMobSkill(useSkillId, useSkillLevel);
|
||||
|
||||
if (monster.canUseSkill(toUse)) {
|
||||
if (monster.canUseSkill(toUse, true)) {
|
||||
int animationTime = MapleMonsterInformationProvider.getInstance().getMobSkillAnimationTime(toUse);
|
||||
if(animationTime > 0 && toUse.getSkillId() != 129) {
|
||||
toUse.applyDelayedEffect(player, monster, true, animationTime);
|
||||
@@ -126,7 +126,7 @@ public final class MoveLifeHandler extends AbstractMovementPacketHandler {
|
||||
nextSkillLevel = skillToUse.getRight();
|
||||
nextUse = MobSkillFactory.getMobSkill(nextSkillId, nextSkillLevel);
|
||||
|
||||
if (!(nextUse != null && monster.canUseSkill(nextUse) && nextUse.getHP() >= (int) (((float) monster.getHp() / monster.getMaxHp()) * 100) && mobMp >= nextUse.getMpCon())) {
|
||||
if (!(nextUse != null && monster.canUseSkill(nextUse, false) && nextUse.getHP() >= (int) (((float) monster.getHp() / monster.getMaxHp()) * 100) && mobMp >= nextUse.getMpCon())) {
|
||||
// thanks OishiiKawaiiDesu for noticing mobs trying to cast skills they are not supposed to be able
|
||||
|
||||
nextSkillId = 0;
|
||||
|
||||
@@ -964,6 +964,19 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
||||
return isBoss() && getTagColor() > 0;
|
||||
}
|
||||
|
||||
public void announceMonsterStatus(MapleClient client) {
|
||||
statiLock.lock();
|
||||
try {
|
||||
if (stati.size() > 0) {
|
||||
for (final MonsterStatusEffect mse : this.stati.values()) {
|
||||
client.announce(MaplePacketCreator.applyMonsterStatus(getObjectId(), mse, null));
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
statiLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendSpawnData(MapleClient client) {
|
||||
if (hp.get() <= 0) { // mustn't monsterLock this function
|
||||
@@ -975,16 +988,7 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
||||
client.announce(MaplePacketCreator.spawnMonster(this, false));
|
||||
}
|
||||
|
||||
statiLock.lock();
|
||||
try {
|
||||
if (stati.size() > 0) {
|
||||
for (final MonsterStatusEffect mse : this.stati.values()) {
|
||||
client.announce(MaplePacketCreator.applyMonsterStatus(getObjectId(), mse, null));
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
statiLock.unlock();
|
||||
}
|
||||
announceMonsterStatus(client);
|
||||
|
||||
if (hasBossHPBar()) {
|
||||
client.announceBossHpBar(this, this.hashCode(), makeBossHPBarPacket());
|
||||
@@ -1395,7 +1399,7 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
||||
return -1;
|
||||
}
|
||||
|
||||
public boolean canUseSkill(MobSkill toUse) {
|
||||
public boolean canUseSkill(MobSkill toUse, boolean apply) {
|
||||
if (toUse == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -1426,7 +1430,9 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
||||
}
|
||||
*/
|
||||
|
||||
this.usedSkill(toUse);
|
||||
if (apply) {
|
||||
this.usedSkill(toUse);
|
||||
}
|
||||
} finally {
|
||||
monsterLock.unlock();
|
||||
}
|
||||
@@ -2072,8 +2078,10 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
||||
}
|
||||
chrController.announce(MaplePacketCreator.removeSummon(puppet, false));
|
||||
|
||||
MapleClient c = chrController.getClient();
|
||||
for (MapleMonster mob : puppetControlled) {
|
||||
chrController.announce(MaplePacketCreator.controlMonster(mob, false, mob.isControllerHasAggro()));
|
||||
mob.announceMonsterStatus(c); // thanks BHB for noticing puppets disrupting mobstatuses for bowmans
|
||||
}
|
||||
chrController.announce(MaplePacketCreator.spawnSummon(puppet, false));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user