getHpRatio? Rnd.chance?
Yea... ignore
Your fix is partially working. Exactly this part:
Index: java/org/l2jmobius/gameserver/handler/skillhandlers/Pdam.java
===================================================================
--- java/org/l2jmobius/gameserver/handler/skillhandlers/Pdam.java (revision 9918)
+++ java/org/l2jmobius/gameserver/handler/skillhandlers/Pdam.java (working copy)
@@ -353,8 +353,8 @@
if (skill.isSuicideAttack() && !creature.isInvul())
{
+ creature.setCurrentHp(0);
creature.doDie(null);
- creature.setCurrentHp(0);
}
}
Mob is dieing and changing into corpse.
However the first part is not workig correctly. I left my debugs in actor.Creature.doCast and added new one. I have used your code to avoid any mistunderstandings... (with suicide doubled condition)
for (Skill sk : skills)
{
LOGGER.warning("try to use skill: " + sk.getName());
if (sk.isSuicideAttack())
{
LOGGER.warning("suicide");
if (sk.isSuicideAttack() && ((_actor.getCurrentHp() > (_actor.getMaxHp() / 3)) || (sk.getMaxChance() < Rnd.get(100))))
{
LOGGER.warning("fail");
continue;
}
}
This is a debug right after hitting a mob (mob has over 90% hp):
2022.03.22 15:55:44,558 WARNING 18 org.l2jmobius.gameserver.model.actor.Creature creature.doCast skill : Hold
2022.03.22 15:55:45,527 WARNING 31 org.l2jmobius.gameserver.ai.CreatureAI try to use skill: Races
2022.03.22 15:55:45,527 WARNING 31 org.l2jmobius.gameserver.ai.CreatureAI try to use skill: Strong Type
2022.03.22 15:55:45,527 WARNING 31 org.l2jmobius.gameserver.ai.CreatureAI try to use skill: Hold
2022.03.22 15:55:45,527 WARNING 31 org.l2jmobius.gameserver.ai.CreatureAI try to use skill: NPC High Level
2022.03.22 15:55:45,527 WARNING 31 org.l2jmobius.gameserver.ai.CreatureAI try to use skill: NPC Death Bomb
2022.03.22 15:55:45,527 WARNING 31 org.l2jmobius.gameserver.ai.CreatureAI suicide
2022.03.22 15:55:45,527 WARNING 31 org.l2jmobius.gameserver.ai.CreatureAI fail
2022.03.22 15:55:45,528 WARNING 31 org.l2jmobius.gameserver.ai.CreatureAI try to use skill: P. Def. Modifiers
2022.03.22 15:55:52,527 WARNING 30 org.l2jmobius.gameserver.model.actor.Creature creature.doCast skill : NPC Death Bomb
After first death bomb use game client started the animation. Mob exploded but did no damage. Condition was true, but why client started the animation?
With second usage (mob still had over 90% hp) - poof, npc used death bomb and exploded. Somehow, I really dont know how but it looks like it was triggered from somewhere else - not via CreatureAI.
Im really confused... Maybe Im doing something wrong?