L2JMobius
Public Development => Shares/Contributions => Topic started by: BazookaRpm on April 04, 2025, 02:58:35 AM
-
Hello, good afternoon. I have a question about Vengance ID: 368.
I understand that the mechanics of these abilities are to provoke the enemy into attacking you, but in a PvP or Farm situation, mobs don't perceive aggression as a provocation to attack me.
So, to correct this problem, we must modify the Handler that controls the behavior of this ability.
Handlers TargetMeProbability
Here's the code.
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.effecthandlers;
import org.l2jmobius.gameserver.ai.CtrlIntention;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.conditions.Condition;
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
import org.l2jmobius.gameserver.model.skill.Skill;
import org.l2jmobius.gameserver.model.stats.Formulas;
/**
* Target Me Probability effect implementation.
* @author Adry_85.
* fix Nattox - JorgeConsalvo - BazookaRpm
*/
public class TargetMeProbability extends AbstractEffect
{
private final int _chance;
public TargetMeProbability(Condition attachCond, Condition applyCond, StatSet set, StatSet params)
{
super(attachCond, applyCond, set, params);
_chance = params.getInt("chance", 100);
}
[member=79]override[/member]
public boolean calcSuccess(Creature effector, Creature effected, Skill skill)
{
return Formulas.calcProbability(_chance, effector, effected, skill);
}
[member=79]override[/member]
public boolean isInstant()
{
return true;
}
[member=79]override[/member]
public void onStart(Creature effector, Creature effected, Skill skill)
{
if (effected == null)
{
return;
}
if (effected.isPlayable())
{
final Player player = effector.asPlayer();
if ((player == null) || player.checkPvpSkill(effected, skill))
{
// Set target and attack intention for PvP
effected.setTarget(effector);
effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, effector);
}
}
else if (effected.isAttackable())
{
// IA mobs
effected.setTarget(effector);
effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, effector);
}
}
[member=79]override[/member]
public void onExit(Creature effector, Creature effected, Skill skill)
{
// Finish
}
}