Merged with released L2J-Unity files.

This commit is contained in:
mobiusdev
2016-06-12 01:34:09 +00:00
parent e003e87887
commit 635557f5da
18352 changed files with 3245113 additions and 2892959 deletions

View File

@@ -1,60 +1,61 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.EffectFlag;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
/**
* Stun effect implementation.
* @author mkizub
*/
public final class Stun extends AbstractEffect
{
public Stun(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
}
@Override
public int getEffectFlags()
{
return EffectFlag.STUNNED.getMask();
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.STUN;
}
@Override
public void onExit(BuffInfo info)
{
info.getEffected().stopStunning(false);
}
@Override
public void onStart(BuffInfo info)
{
info.getEffected().startStunning();
}
}
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.EffectFlag;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
/**
* An effect that blocks a debuff. Acts like DOTA's Linken Sphere.
* @author Nik
*/
public final class AbnormalShield extends AbstractEffect
{
private final int _times;
public AbnormalShield(StatsSet params)
{
_times = params.getInt("times", -1);
}
@Override
public void onStart(BuffInfo info)
{
info.getEffected().setAbnormalShieldBlocks(_times);
}
@Override
public long getEffectFlags()
{
return EffectFlag.ABNORMAL_SHIELD.getMask();
}
@Override
public void onExit(BuffInfo info)
{
info.getEffected().setAbnormalShieldBlocks(Integer.MIN_VALUE);
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.ABNORMAL_SHIELD;
}
}

View File

@@ -0,0 +1,152 @@
/*
* 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 java.util.Collections;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.AbnormalType;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.serverpackets.AbnormalStatusUpdate;
import com.l2jmobius.gameserver.network.serverpackets.ExAbnormalStatusUpdateFromTarget;
/**
* @author Sdw
*/
public class AbnormalTimeChange extends AbstractEffect
{
private final Set<AbnormalType> _abnormals;
private final int _time;
private final int _mode;
public AbnormalTimeChange(StatsSet params)
{
final String abnormals = params.getString("slot", null);
if ((abnormals != null) && !abnormals.isEmpty())
{
_abnormals = new HashSet<>();
for (String slot : abnormals.split(";"))
{
_abnormals.add(AbnormalType.getAbnormalType(slot));
}
}
else
{
_abnormals = Collections.<AbnormalType> emptySet();
}
_time = params.getInt("time", -1);
switch (params.getString("mode", "DEBUFF"))
{
case "DIFF":
{
_mode = 0;
break;
}
case "DEBUFF":
{
_mode = 1;
break;
}
default:
{
throw new IllegalArgumentException("Mode should be DIFF or DEBUFF for skill id:" + params.getInt("id"));
}
}
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
final AbnormalStatusUpdate asu = new AbnormalStatusUpdate();
switch (_mode)
{
case 0: // DIFF
{
if (_abnormals.isEmpty())
{
effected.getEffectList().getEffects().stream().filter(b -> b.getSkill().canBeDispelled()).forEach(b ->
{
b.resetAbnormalTime(b.getTime() + _time);
asu.addSkill(b);
});
}
else
{
effected.getEffectList().getEffects().stream().filter(b -> b.getSkill().canBeDispelled() && _abnormals.contains(b.getSkill().getAbnormalType())).forEach(b ->
{
b.resetAbnormalTime(b.getTime() + _time);
asu.addSkill(b);
});
}
break;
}
case 1: // DEBUFF
{
if (_abnormals.isEmpty())
{
effected.getEffectList().getDebuffs().stream().filter(b -> b.getSkill().canBeDispelled()).forEach(b ->
{
b.resetAbnormalTime(b.getAbnormalTime());
asu.addSkill(b);
});
}
else
{
effected.getEffectList().getDebuffs().stream().filter(b -> b.getSkill().canBeDispelled() && _abnormals.contains(b.getSkill().getAbnormalType())).forEach(b ->
{
b.resetAbnormalTime(b.getAbnormalTime());
asu.addSkill(b);
});
}
break;
}
}
effected.sendPacket(asu);
final ExAbnormalStatusUpdateFromTarget upd = new ExAbnormalStatusUpdateFromTarget(effected);
// @formatter:off
effected.getStatus().getStatusListener().stream()
.filter(Objects::nonNull)
.filter(L2Object::isPlayer)
.map(L2Character::getActingPlayer)
.forEach(upd::sendTo);
// @formatter:on
if (effected.isPlayer() && (effected.getTarget() == effected))
{
effected.sendPacket(upd);
}
}
}

View File

@@ -0,0 +1,75 @@
/*
* 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 java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.events.EventType;
import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureDamageReceived;
import com.l2jmobius.gameserver.model.events.listeners.FunctionEventListener;
import com.l2jmobius.gameserver.model.events.returns.DamageReturn;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
/**
* @author Sdw
*/
public class AbsorbDamage extends AbstractEffect
{
private final double _damage;
private static final Map<Integer, Double> _damageHolder = new ConcurrentHashMap<>();
public AbsorbDamage(StatsSet params)
{
_damage = params.getDouble("damage", 0);
}
private DamageReturn onDamageReceivedEvent(OnCreatureDamageReceived event)
{
// DOT effects are not taken into account.
if (event.isDamageOverTime())
{
return null;
}
final int objectId = event.getTarget().getObjectId();
final double damageLeft = _damageHolder.get(objectId);
final double newDamageLeft = Math.max(damageLeft - event.getDamage(), 0);
final double newDamage = Math.max(event.getDamage() - damageLeft, 0);
_damageHolder.put(objectId, newDamageLeft);
return new DamageReturn(false, true, false, newDamage);
}
@Override
public void onExit(BuffInfo info)
{
info.getEffected().removeListenerIf(EventType.ON_CREATURE_DAMAGE_RECEIVED, listener -> listener.getOwner() == this);
_damageHolder.remove(info.getEffected().getObjectId());
}
@Override
public void onStart(BuffInfo info)
{
_damageHolder.put(info.getEffected().getObjectId(), _damage);
info.getEffected().addListener(new FunctionEventListener(info.getEffected(), EventType.ON_CREATURE_DAMAGE_RECEIVED, (OnCreatureDamageReceived event) -> onDamageReceivedEvent(event), this));
}
}

View File

@@ -0,0 +1,42 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* @author UnAfraid
*/
public abstract class AbstractConditionalHpEffect extends AbstractStatEffect
{
private final int _hpPercent;
protected AbstractConditionalHpEffect(StatsSet params, Stats stat)
{
super(params, stat);
_hpPercent = params.getInt("hpPercent", -1);
}
@Override
public boolean canPump(L2Character effector, L2Character effected, Skill skill)
{
return ((_hpPercent <= 0) || (effected.getCurrentHpPercent() <= _hpPercent));
}
}

View File

@@ -0,0 +1,44 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* @author Sdw
*/
public class AbstractStatAddEffect extends AbstractEffect
{
private final Stats _stat;
private final double _amount;
public AbstractStatAddEffect(StatsSet params, Stats stat)
{
_stat = stat;
_amount = params.getDouble("amount", 0);
}
@Override
public void pump(L2Character effected, Skill skill)
{
effected.getStat().mergeAdd(_stat, _amount);
}
}

View File

@@ -0,0 +1,131 @@
/*
* 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 java.util.ArrayList;
import java.util.List;
import com.l2jmobius.gameserver.enums.StatModifierType;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.conditions.ConditionPlayerIsInCombat;
import com.l2jmobius.gameserver.model.conditions.ConditionUsingItemType;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.items.type.ArmorType;
import com.l2jmobius.gameserver.model.items.type.WeaponType;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* @author Sdw
*/
public abstract class AbstractStatEffect extends AbstractEffect
{
protected final Stats _addStat;
protected final Stats _mulStat;
protected final double _amount;
protected final StatModifierType _mode;
protected final List<Condition> _conditions = new ArrayList<>();
public AbstractStatEffect(StatsSet params, Stats stat)
{
this(params, stat, stat);
}
public AbstractStatEffect(StatsSet params, Stats mulStat, Stats addStat)
{
_addStat = addStat;
_mulStat = mulStat;
_amount = params.getDouble("amount", 0);
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
int weaponTypesMask = 0;
final List<String> weaponTypes = params.getList("weaponType", String.class);
if (weaponTypes != null)
{
for (String weaponType : weaponTypes)
{
try
{
weaponTypesMask |= WeaponType.valueOf(weaponType).mask();
}
catch (IllegalArgumentException e)
{
final IllegalArgumentException exception = new IllegalArgumentException("weaponType should contain WeaponType enum value but found " + weaponType);
exception.addSuppressed(e);
throw exception;
}
}
}
int armorTypesMask = 0;
final List<String> armorTypes = params.getList("armorType", String.class);
if (armorTypes != null)
{
for (String armorType : armorTypes)
{
try
{
armorTypesMask |= ArmorType.valueOf(armorType).mask();
}
catch (IllegalArgumentException e)
{
final IllegalArgumentException exception = new IllegalArgumentException("armorTypes should contain ArmorType enum value but found " + armorType);
exception.addSuppressed(e);
throw exception;
}
}
}
if (weaponTypesMask != 0)
{
_conditions.add(new ConditionUsingItemType(weaponTypesMask));
}
if (armorTypesMask != 0)
{
_conditions.add(new ConditionUsingItemType(armorTypesMask));
}
if (params.contains("inCombat"))
{
_conditions.add(new ConditionPlayerIsInCombat(params.getBoolean("inCombat")));
}
}
@Override
public void pump(L2Character effected, Skill skill)
{
if (_conditions.isEmpty() || _conditions.stream().allMatch(cond -> cond.test(effected, effected, skill)))
{
switch (_mode)
{
case DIFF:
{
effected.getStat().mergeAdd(_addStat, _amount);
break;
}
case PER:
{
effected.getStat().mergeMul(_mulStat, (_amount / 100) + 1);
break;
}
}
}
}
}

View File

@@ -0,0 +1,31 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* @author Sdw
*/
public class Accuracy extends AbstractStatEffect
{
public Accuracy(StatsSet params)
{
super(params, Stats.ACCURACY_COMBAT);
}
}

View File

@@ -1,64 +1,70 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Attackable;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
/**
* Add Hate effect implementation.
* @author Adry_85
*/
public final class AddHate extends AbstractEffect
{
private final double _power;
public AddHate(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
_power = params.getDouble("power", 0);
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void onStart(BuffInfo info)
{
if (!info.getEffected().isAttackable())
{
return;
}
final double val = _power;
if (val > 0)
{
((L2Attackable) info.getEffected()).addDamageHate(info.getEffector(), 0, (int) val);
}
else if (val < 0)
{
((L2Attackable) info.getEffected()).reduceHate(info.getEffector(), (int) -val);
}
}
}
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Attackable;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* Add Hate effect implementation.
* @author Adry_85
*/
public final class AddHate extends AbstractEffect
{
private final double _power;
private final boolean _affectSummoner;
public AddHate(StatsSet params)
{
_power = params.getDouble("power", 0);
_affectSummoner = params.getBoolean("affectSummoner", false);
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
if (_affectSummoner && (effector.getSummoner() != null))
{
effector = effector.getSummoner();
}
if (!effected.isAttackable())
{
return;
}
final double val = _power;
if (val > 0)
{
((L2Attackable) effected).addDamageHate(effector, 0, (int) val);
}
else if (val < 0)
{
((L2Attackable) effected).reduceHate(effector, (int) -val);
}
}
}

View File

@@ -0,0 +1,58 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.SystemMessageId;
/**
* Item Effect: Gives teleport bookmark slots to the owner.
* @author Nik
*/
public final class AddTeleportBookmarkSlot extends AbstractEffect
{
private final int _amount;
public AddTeleportBookmarkSlot(StatsSet params)
{
_amount = params.getInt("amount", 0);
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
if (!effected.isPlayer())
{
return;
}
final L2PcInstance player = effected.getActingPlayer();
player.setBookMarkSlot(player.getBookMarkSlot() + _amount);
player.sendPacket(SystemMessageId.THE_NUMBER_OF_MY_TELEPORTS_SLOTS_HAS_BEEN_INCREASED);
}
}

View File

@@ -0,0 +1,31 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* @author Sdw
*/
public class AreaDamage extends AbstractStatEffect
{
public AreaDamage(StatsSet params)
{
super(params, Stats.DAMAGE_ZONE_VULN);
}
}

View File

@@ -0,0 +1,75 @@
/*
* 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 com.l2jmobius.gameserver.enums.AttributeType;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* @author Sdw
*/
public class AttackAttribute extends AbstractEffect
{
private final AttributeType _attribute;
private final double _amount;
public AttackAttribute(StatsSet params)
{
_amount = params.getDouble("amount", 0);
_attribute = params.getEnum("attribute", AttributeType.class, AttributeType.FIRE);
}
@Override
public void pump(L2Character effected, Skill skill)
{
Stats stat = Stats.FIRE_POWER;
switch (_attribute)
{
case WATER:
{
stat = Stats.WATER_POWER;
break;
}
case WIND:
{
stat = Stats.WIND_POWER;
break;
}
case EARTH:
{
stat = Stats.EARTH_POWER;
break;
}
case HOLY:
{
stat = Stats.HOLY_POWER;
break;
}
case DARK:
{
stat = Stats.DARK_POWER;
break;
}
}
effected.getStat().mergeAdd(stat, _amount);
}
}

View File

@@ -1,39 +1,37 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
/**
* Debuff effect implementation.
*/
public final class Debuff extends AbstractEffect
{
public Debuff(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.DEBUFF;
}
}
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.EffectFlag;
/**
* @author Nik
*/
public class AttackBehind extends AbstractEffect
{
public AttackBehind(StatsSet params)
{
}
@Override
public long getEffectFlags()
{
return EffectFlag.ATTACK_BEHIND.getMask();
}
}

View File

@@ -1,81 +1,80 @@
/*
* 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 java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.stat.CharStat;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.stats.TraitType;
/**
* Attack Trait effect implementation.
* @author NosBit
*/
public final class AttackTrait extends AbstractEffect
{
private final Map<TraitType, Float> _attackTraits = new HashMap<>();
public AttackTrait(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
if (params.isEmpty())
{
_log.warning(getClass().getSimpleName() + ": this effect must have parameters!");
return;
}
for (Entry<String, Object> param : params.getSet().entrySet())
{
_attackTraits.put(TraitType.valueOf(param.getKey()), (Float.parseFloat((String) param.getValue()) + 100) / 100);
}
}
@Override
public void onExit(BuffInfo info)
{
final CharStat charStat = info.getEffected().getStat();
synchronized (charStat.getAttackTraits())
{
for (Entry<TraitType, Float> trait : _attackTraits.entrySet())
{
charStat.getAttackTraits()[trait.getKey().getId()] /= trait.getValue();
charStat.getAttackTraitsCount()[trait.getKey().getId()]--;
}
}
}
@Override
public void onStart(BuffInfo info)
{
final CharStat charStat = info.getEffected().getStat();
synchronized (charStat.getAttackTraits())
{
for (Entry<TraitType, Float> trait : _attackTraits.entrySet())
{
charStat.getAttackTraits()[trait.getKey().getId()] *= trait.getValue();
charStat.getAttackTraitsCount()[trait.getKey().getId()]++;
}
}
}
}
/*
* 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 java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.stat.CharStat;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.TraitType;
/**
* Attack Trait effect implementation.
* @author NosBit
*/
public final class AttackTrait extends AbstractEffect
{
private final Map<TraitType, Float> _attackTraits = new HashMap<>();
public AttackTrait(StatsSet params)
{
if (params.isEmpty())
{
_log.warning(getClass().getSimpleName() + ": this effect must have parameters!");
return;
}
for (Entry<String, Object> param : params.getSet().entrySet())
{
_attackTraits.put(TraitType.valueOf(param.getKey()), (Float.parseFloat((String) param.getValue()) + 100) / 100);
}
}
@Override
public void onExit(BuffInfo info)
{
final CharStat charStat = info.getEffected().getStat();
synchronized (charStat.getAttackTraits())
{
for (Entry<TraitType, Float> trait : _attackTraits.entrySet())
{
charStat.getAttackTraits()[trait.getKey().getId()] /= trait.getValue();
charStat.getAttackTraitsCount()[trait.getKey().getId()]--;
}
}
}
@Override
public void onStart(L2Character effector, L2Character effected, Skill skill)
{
final CharStat charStat = effected.getStat();
synchronized (charStat.getAttackTraits())
{
for (Entry<TraitType, Float> trait : _attackTraits.entrySet())
{
charStat.getAttackTraits()[trait.getKey().getId()] *= trait.getValue();
charStat.getAttackTraitsCount()[trait.getKey().getId()]++;
}
}
}
}

View File

@@ -1,97 +1,113 @@
/*
* 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 com.l2jmobius.gameserver.enums.ShotType;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Formulas;
/**
* Backstab effect implementation.
* @author Adry_85
*/
public final class Backstab extends AbstractEffect
{
public Backstab(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
}
@Override
public boolean calcSuccess(BuffInfo info)
{
return !info.getEffector().isInFrontOf(info.getEffected()) && !Formulas.calcPhysicalSkillEvasion(info.getEffector(), info.getEffected(), info.getSkill()) && Formulas.calcBlowSuccess(info.getEffector(), info.getEffected(), info.getSkill());
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.PHYSICAL_ATTACK;
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void onStart(BuffInfo info)
{
if (info.getEffector().isAlikeDead())
{
return;
}
final L2Character target = info.getEffected();
final L2Character activeChar = info.getEffector();
final Skill skill = info.getSkill();
final boolean ss = skill.useSoulShot() && activeChar.isChargedShot(ShotType.SOULSHOTS);
final byte shld = Formulas.calcShldUse(activeChar, target, skill);
double damage = Formulas.calcBackstabDamage(activeChar, target, skill, shld, ss);
// Crit rate base crit rate for skill, modified with STR bonus
if (Formulas.calcCrit(activeChar, target, skill))
{
damage *= 2;
}
target.reduceCurrentHp(damage, activeChar, skill);
target.notifyDamageReceived(damage, activeChar, skill, true, false);
// Manage attack or cast break of the target (calculating rate, sending message...)
if (!target.isRaid() && Formulas.calcAtkBreak(target, damage))
{
target.breakAttack();
target.breakCast();
}
if (activeChar.isPlayer())
{
activeChar.getActingPlayer().sendDamageMessage(target, (int) damage, false, true, false);
}
// Check if damage should be reflected
Formulas.calcDamageReflected(activeChar, target, skill, true);
}
/*
* 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 com.l2jmobius.gameserver.enums.ShotType;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Attackable;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Formulas;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* Backstab effect implementation.
* @author Adry_85
*/
public final class Backstab extends AbstractEffect
{
private final double _power;
private final double _chance;
private final double _criticalChance;
private final boolean _overHit;
public Backstab(StatsSet params)
{
_power = params.getDouble("power", 0);
_chance = params.getDouble("chance", 0);
_criticalChance = params.getDouble("criticalChance", 0);
_overHit = params.getBoolean("overHit", false);
}
@Override
public boolean calcSuccess(L2Character effector, L2Character effected, Skill skill)
{
return !effector.isInFrontOf(effected) && !Formulas.calcPhysicalSkillEvasion(effector, effected, skill) && Formulas.calcBlowSuccess(effector, effected, skill, _chance);
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.PHYSICAL_ATTACK;
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
if (effector.isAlikeDead())
{
return;
}
if (_overHit && effected.isAttackable())
{
((L2Attackable) effected).overhitEnabled(true);
}
final boolean ss = skill.useSoulShot() && effector.isChargedShot(ShotType.SOULSHOTS);
final byte shld = Formulas.calcShldUse(effector, effected);
double damage = Formulas.calcBlowDamage(effector, effected, skill, true, _power, shld, ss);
if (Formulas.calcCrit(_criticalChance, effector, effected, skill))
{
damage *= 2;
}
// Check if damage should be reflected
Formulas.calcDamageReflected(effector, effected, skill, true);
final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT);
if (damageCap > 0)
{
damage = Math.min(damage, damageCap);
}
effected.reduceCurrentHp(damage, effector, skill, false, true, true, false);
// Manage attack or cast break of the target (calculating rate, sending message...)
if (!effected.isRaid() && Formulas.calcAtkBreak(effected, damage))
{
effected.breakAttack();
effected.breakCast();
}
if (effector.isPlayer())
{
final L2PcInstance activePlayer = effector.getActingPlayer();
activePlayer.sendDamageMessage(effected, skill, (int) damage, true, false);
}
}
}

View File

@@ -1,67 +1,60 @@
/*
* 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 com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.EffectFlag;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
/**
* Betray effect implementation.
* @author decad
*/
public final class Betray extends AbstractEffect
{
public Betray(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
}
@Override
public boolean canStart(BuffInfo info)
{
return info.getEffector().isPlayer() && info.getEffected().isSummon();
}
@Override
public int getEffectFlags()
{
return EffectFlag.BETRAYED.getMask();
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.DEBUFF;
}
@Override
public void onExit(BuffInfo info)
{
info.getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
}
@Override
public void onStart(BuffInfo info)
{
info.getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, info.getEffected().getActingPlayer());
}
}
/*
* 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 com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.EffectFlag;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* Betray effect implementation.
* @author decad
*/
public final class Betray extends AbstractEffect
{
public Betray(StatsSet params)
{
}
@Override
public boolean canStart(BuffInfo info)
{
return info.getEffector().isPlayer() && info.getEffected().isSummon();
}
@Override
public long getEffectFlags()
{
return EffectFlag.BETRAYED.getMask();
}
@Override
public void onStart(L2Character effector, L2Character effected, Skill skill)
{
effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, effected.getActingPlayer());
}
@Override
public void onExit(BuffInfo info)
{
info.getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
}
}

View File

@@ -1,82 +1,100 @@
/*
* 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 com.l2jmobius.gameserver.GeoData;
import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.network.serverpackets.FlyToLocation;
import com.l2jmobius.gameserver.network.serverpackets.FlyToLocation.FlyType;
import com.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
import com.l2jmobius.gameserver.util.Util;
/**
* Blink effect implementation.<br>
* This class handles warp effects, disappear and quickly turn up in a near location.<br>
* If geodata enabled and an object is between initial and final point, flight is stopped just before colliding with object.<br>
* Flight course and radius are set as skill properties (flyCourse and flyRadius):
* <ul>
* <li>Fly Radius means the distance between starting point and final point, it must be an integer.</li>
* <li>Fly Course means the movement direction: imagine a compass above player's head, making north player's heading. So if fly course is 180, player will go backwards (good for blink, e.g.).</li>
* </ul>
* By the way, if flyCourse = 360 or 0, player will be moved in in front of him. <br>
* If target is effector, put in XML self="1", this will make _actor = getEffector(). This, combined with target type, allows more complex actions like flying target's backwards or player's backwards.
* @author DrHouse
*/
public final class Blink extends AbstractEffect
{
public Blink(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void onStart(BuffInfo info)
{
final L2Character effected = info.getEffected();
final int radius = info.getSkill().getFlyRadius();
final double angle = Util.convertHeadingToDegree(effected.getHeading());
final double radian = Math.toRadians(angle);
final double course = Math.toRadians(info.getSkill().getFlyCourse());
final int x1 = (int) (Math.cos(Math.PI + radian + course) * radius);
final int y1 = (int) (Math.sin(Math.PI + radian + course) * radius);
final int x = effected.getX() + x1;
final int y = effected.getY() + y1;
final int z = effected.getZ();
final Location destination = GeoData.getInstance().moveCheck(effected.getX(), effected.getY(), effected.getZ(), x, y, z, effected.getInstanceId());
effected.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
effected.broadcastPacket(new FlyToLocation(effected, destination, FlyType.DUMMY));
effected.abortAttack();
effected.abortCast();
effected.setXYZ(destination);
effected.broadcastPacket(new ValidateLocation(effected));
}
}
/*
* 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 com.l2jmobius.gameserver.GeoData;
import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.serverpackets.FlyToLocation;
import com.l2jmobius.gameserver.network.serverpackets.FlyToLocation.FlyType;
import com.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
import com.l2jmobius.gameserver.util.Util;
/**
* Blink effect implementation.<br>
* This class handles warp effects, disappear and quickly turn up in a near location.<br>
* If geodata enabled and an object is between initial and final point, flight is stopped just before colliding with object.<br>
* Flight course and radius are set as skill properties (flyCourse and flyRadius):
* <ul>
* <li>Fly Radius means the distance between starting point and final point, it must be an integer.</li>
* <li>Fly Course means the movement direction: imagine a compass above player's head, making north player's heading. So if fly course is 180, player will go backwards (good for blink, e.g.).</li>
* </ul>
* By the way, if flyCourse = 360 or 0, player will be moved in in front of him. <br>
* If target is effector, put in XML self="1", this will make _actor = getEffector(). This, combined with target type, allows more complex actions like flying target's backwards or player's backwards.
* @author DrHouse
*/
public final class Blink extends AbstractEffect
{
private final int _flyCourse;
private final int _flyRadius;
private final FlyType _flyType;
private final int _flySpeed;
private final int _flyDelay;
private final int _animationSpeed;
public Blink(StatsSet params)
{
_flyCourse = params.getInt("angle", 0);
_flyRadius = params.getInt("range", 0);
_flyType = params.getEnum("flyType", FlyType.class, FlyType.DUMMY);
_flySpeed = params.getInt("speed", 0);
_flyDelay = params.getInt("delay", 0);
_animationSpeed = params.getInt("animationSpeed", 0);
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public boolean canStart(BuffInfo info)
{
// While affected by escape blocking effect you cannot use Blink or Scroll of Escape
return !info.getEffected().cannotEscape();
}
@Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
final double angle = Util.convertHeadingToDegree(effected.getHeading());
final double radian = Math.toRadians(angle);
final double course = Math.toRadians(_flyCourse);
final int x1 = (int) (Math.cos(Math.PI + radian + course) * _flyRadius);
final int y1 = (int) (Math.sin(Math.PI + radian + course) * _flyRadius);
final int x = effected.getX() + x1;
final int y = effected.getY() + y1;
final int z = effected.getZ();
final Location destination = GeoData.getInstance().moveCheck(effected.getX(), effected.getY(), effected.getZ(), x, y, z, effected.getInstanceWorld());
effected.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
effected.broadcastPacket(new FlyToLocation(effected, destination, _flyType, _flySpeed, _flyDelay, _animationSpeed));
effected.setXYZ(destination);
effected.broadcastPacket(new ValidateLocation(effected));
effected.revalidateZone(true);
}
}

View File

@@ -0,0 +1,69 @@
/*
* 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 com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.serverpackets.FlyToLocation;
import com.l2jmobius.gameserver.network.serverpackets.FlyToLocation.FlyType;
import com.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
/**
* This Blink effect switches the location of the caster and the target.<br>
* This effect is totally done based on client description. <br>
* Assume that geodata checks are done on the skill cast and not needed to repeat here.
* @author Nik
*/
public final class BlinkSwap extends AbstractEffect
{
public BlinkSwap(StatsSet params)
{
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
final Location effectorLoc = effector.getLocation();
final Location effectedLoc = effected.getLocation();
effector.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
effector.broadcastPacket(new FlyToLocation(effector, effectedLoc, FlyType.DUMMY));
effector.abortAttack();
effector.abortCast();
effector.setXYZ(effectedLoc);
effector.broadcastPacket(new ValidateLocation(effector));
effected.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
effected.broadcastPacket(new FlyToLocation(effected, effectorLoc, FlyType.DUMMY));
effected.abortAttack();
effected.abortCast();
effected.setXYZ(effectorLoc);
effected.broadcastPacket(new ValidateLocation(effected));
effected.revalidateZone(true);
}
}

View File

@@ -1,67 +1,66 @@
/*
* 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 java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.AbnormalType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
/**
* Block Buff Slot effect implementation.
* @author Zoey76
*/
public final class BlockBuffSlot extends AbstractEffect
{
private final Set<AbnormalType> _blockBuffSlots;
public BlockBuffSlot(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
final String blockBuffSlots = params.getString("slot", null);
if ((blockBuffSlots != null) && !blockBuffSlots.isEmpty())
{
_blockBuffSlots = new HashSet<>();
for (String slot : blockBuffSlots.split(";"))
{
_blockBuffSlots.add(AbnormalType.getAbnormalType(slot));
}
}
else
{
_blockBuffSlots = Collections.<AbnormalType> emptySet();
}
}
@Override
public void onExit(BuffInfo info)
{
info.getEffected().getEffectList().removeBlockedBuffSlots(_blockBuffSlots);
}
@Override
public void onStart(BuffInfo info)
{
info.getEffected().getEffectList().addBlockedBuffSlots(_blockBuffSlots);
}
}
/*
* 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 java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.AbnormalType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* Block Buff Slot effect implementation.
* @author Zoey76
*/
public final class BlockAbnormalSlot extends AbstractEffect
{
private final Set<AbnormalType> _blockAbnormalSlots;
public BlockAbnormalSlot(StatsSet params)
{
final String blockAbnormalSlots = params.getString("slot", null);
if ((blockAbnormalSlots != null) && !blockAbnormalSlots.isEmpty())
{
_blockAbnormalSlots = new HashSet<>();
for (String slot : blockAbnormalSlots.split(";"))
{
_blockAbnormalSlots.add(AbnormalType.getAbnormalType(slot));
}
}
else
{
_blockAbnormalSlots = Collections.<AbnormalType> emptySet();
}
}
@Override
public void onStart(L2Character effector, L2Character effected, Skill skill)
{
effected.getEffectList().addBlockedAbnormalTypes(_blockAbnormalSlots);
}
@Override
public void onExit(BuffInfo info)
{
info.getEffected().getEffectList().removeBlockedAbnormalTypes(_blockAbnormalSlots);
}
}

View File

@@ -1,88 +1,88 @@
/*
* 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 java.util.HashSet;
import java.util.Set;
import com.l2jmobius.gameserver.datatables.BotReportTable;
import com.l2jmobius.gameserver.instancemanager.PunishmentManager;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.punishment.PunishmentAffect;
import com.l2jmobius.gameserver.model.punishment.PunishmentTask;
import com.l2jmobius.gameserver.model.punishment.PunishmentType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
/**
* Block Action effect implementation.
* @author BiggBoss
*/
public final class BlockAction extends AbstractEffect
{
private final Set<Integer> _blockedActions = new HashSet<>();
public BlockAction(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
for (String action : params.getString("blockedActions").split(","))
{
_blockedActions.add(Integer.parseInt(action));
}
}
@Override
public boolean canStart(BuffInfo info)
{
return (info.getEffected() != null) && info.getEffected().isPlayer();
}
@Override
public boolean checkCondition(Object id)
{
return !_blockedActions.contains(id);
}
@Override
public void onExit(BuffInfo info)
{
if (_blockedActions.contains(BotReportTable.PARTY_ACTION_BLOCK_ID))
{
PunishmentManager.getInstance().stopPunishment(info.getEffected().getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.PARTY_BAN);
}
if (_blockedActions.contains(BotReportTable.CHAT_BLOCK_ID))
{
PunishmentManager.getInstance().stopPunishment(info.getEffected().getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN);
}
}
@Override
public void onStart(BuffInfo info)
{
if (_blockedActions.contains(BotReportTable.PARTY_ACTION_BLOCK_ID))
{
PunishmentManager.getInstance().startPunishment(new PunishmentTask(0, info.getEffected().getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.PARTY_BAN, 0, "block action debuff", "system", true));
}
if (_blockedActions.contains(BotReportTable.CHAT_BLOCK_ID))
{
PunishmentManager.getInstance().startPunishment(new PunishmentTask(0, info.getEffected().getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN, 0, "block action debuff", "system", true));
}
}
}
/*
* 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 java.util.HashSet;
import java.util.Set;
import com.l2jmobius.gameserver.datatables.BotReportTable;
import com.l2jmobius.gameserver.instancemanager.PunishmentManager;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.punishment.PunishmentAffect;
import com.l2jmobius.gameserver.model.punishment.PunishmentTask;
import com.l2jmobius.gameserver.model.punishment.PunishmentType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* Block Action effect implementation.
* @author BiggBoss
*/
public final class BlockAction extends AbstractEffect
{
private final Set<Integer> _blockedActions = new HashSet<>();
public BlockAction(StatsSet params)
{
final String[] actions = params.getString("blockedActions").split(",");
for (String action : actions)
{
_blockedActions.add(Integer.parseInt(action));
}
}
@Override
public boolean canStart(BuffInfo info)
{
return (info.getEffected() != null) && info.getEffected().isPlayer();
}
@Override
public boolean checkCondition(Object id)
{
return !_blockedActions.contains(id);
}
@Override
public void onStart(L2Character effector, L2Character effected, Skill skill)
{
if (_blockedActions.contains(BotReportTable.PARTY_ACTION_BLOCK_ID))
{
PunishmentManager.getInstance().startPunishment(new PunishmentTask(0, effected.getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.PARTY_BAN, 0, "block action debuff", "system", true));
}
if (_blockedActions.contains(BotReportTable.CHAT_BLOCK_ID))
{
PunishmentManager.getInstance().startPunishment(new PunishmentTask(0, effected.getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN, 0, "block action debuff", "system", true));
}
}
@Override
public void onExit(BuffInfo info)
{
if (_blockedActions.contains(BotReportTable.PARTY_ACTION_BLOCK_ID))
{
PunishmentManager.getInstance().stopPunishment(info.getEffected().getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.PARTY_BAN);
}
if (_blockedActions.contains(BotReportTable.CHAT_BLOCK_ID))
{
PunishmentManager.getInstance().stopPunishment(info.getEffected().getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN);
}
}
}

View File

@@ -1,67 +1,75 @@
/*
* 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 com.l2jmobius.gameserver.ai.CtrlEvent;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.EffectFlag;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
/**
* Sleep effect implementation.
* @author mkizub
*/
public final class Sleep extends AbstractEffect
{
public Sleep(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
}
@Override
public int getEffectFlags()
{
return EffectFlag.SLEEP.getMask();
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.SLEEP;
}
@Override
public void onExit(BuffInfo info)
{
if (!info.getEffected().isPlayer())
{
info.getEffected().getAI().notifyEvent(CtrlEvent.EVT_THINK);
}
}
@Override
public void onStart(BuffInfo info)
{
info.getEffected().abortAttack();
info.getEffected().abortCast();
info.getEffected().stopMove(null);
info.getEffected().getAI().notifyEvent(CtrlEvent.EVT_SLEEPING);
}
}
/*
* 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 java.util.Arrays;
import java.util.Set;
import java.util.stream.Collectors;
import com.l2jmobius.gameserver.ai.CtrlEvent;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.EffectFlag;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* Block Actions effect implementation.
* @author mkizub
*/
public final class BlockActions extends AbstractEffect
{
private final Set<Integer> _allowedSkills;
public BlockActions(StatsSet params)
{
final String[] allowedSkills = params.getString("allowedSkills", "").split(";");
_allowedSkills = Arrays.stream(allowedSkills).filter(s -> !s.isEmpty()).map(Integer::parseInt).collect(Collectors.toSet());
}
@Override
public long getEffectFlags()
{
return _allowedSkills.isEmpty() ? EffectFlag.BLOCK_ACTIONS.getMask() : EffectFlag.CONDITIONAL_BLOCK_ACTIONS.getMask();
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.BLOCK_ACTIONS;
}
@Override
public void onStart(L2Character effector, L2Character effected, Skill skill)
{
_allowedSkills.stream().forEach(effected::addBlockActionsAllowedSkill);
effected.startParalyze();
}
@Override
public void onExit(BuffInfo info)
{
final L2Character effected = info.getEffected();
_allowedSkills.stream().forEach(effected::removeBlockActionsAllowedSkill);
if (!effected.isPlayer())
{
effected.getAI().notifyEvent(CtrlEvent.EVT_THINK);
}
}
}

View File

@@ -1,63 +1,63 @@
/*
* 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 com.l2jmobius.gameserver.instancemanager.PunishmentManager;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.punishment.PunishmentAffect;
import com.l2jmobius.gameserver.model.punishment.PunishmentTask;
import com.l2jmobius.gameserver.model.punishment.PunishmentType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
/**
* Block Chat effect implementation.
* @author BiggBoss
*/
public final class BlockChat extends AbstractEffect
{
public BlockChat(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
}
@Override
public boolean canStart(BuffInfo info)
{
return (info.getEffected() != null) && info.getEffected().isPlayer();
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.CHAT_BLOCK;
}
@Override
public void onExit(BuffInfo info)
{
PunishmentManager.getInstance().stopPunishment(info.getEffected().getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN);
}
@Override
public void onStart(BuffInfo info)
{
PunishmentManager.getInstance().startPunishment(new PunishmentTask(0, info.getEffected().getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN, 0, "Chat banned bot report", "system", true));
}
}
/*
* 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 com.l2jmobius.gameserver.instancemanager.PunishmentManager;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.EffectFlag;
import com.l2jmobius.gameserver.model.punishment.PunishmentAffect;
import com.l2jmobius.gameserver.model.punishment.PunishmentTask;
import com.l2jmobius.gameserver.model.punishment.PunishmentType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* Block Chat effect implementation.
* @author BiggBoss
*/
public final class BlockChat extends AbstractEffect
{
public BlockChat(StatsSet params)
{
}
@Override
public boolean canStart(BuffInfo info)
{
return (info.getEffected() != null) && info.getEffected().isPlayer();
}
@Override
public long getEffectFlags()
{
return EffectFlag.CHAT_BLOCK.getMask();
}
@Override
public void onStart(L2Character effector, L2Character effected, Skill skill)
{
PunishmentManager.getInstance().startPunishment(new PunishmentTask(0, effected.getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN, 0, "Chat banned bot report", "system", true));
}
@Override
public void onExit(BuffInfo info)
{
PunishmentManager.getInstance().stopPunishment(info.getEffected().getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN);
}
}

View File

@@ -1,46 +1,46 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.EffectFlag;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
/**
* @author Zealar
*/
public final class BlockBuff extends AbstractEffect
{
public BlockBuff(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
}
@Override
public int getEffectFlags()
{
return EffectFlag.BLOCK_BUFF.getMask();
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.BLOCK_BUFF;
}
}
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.EffectFlag;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
/**
* An effect that blocks the player (NPC?) control. <br>
* It prevents moving, casting, social actions, etc.
* @author Nik
*/
public class BlockControl extends AbstractEffect
{
public BlockControl(StatsSet params)
{
}
@Override
public long getEffectFlags()
{
return EffectFlag.BLOCK_CONTROL.getMask();
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.BLOCK_CONTROL;
}
}

View File

@@ -1,55 +0,0 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.EffectFlag;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
/**
* @author Zealar
*/
public final class BlockDamage extends AbstractEffect
{
private enum BlockType
{
HP,
MP
}
private final BlockType _type;
public BlockDamage(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
_type = params.getEnum("type", BlockType.class, BlockType.HP);
}
@Override
public int getEffectFlags()
{
return _type == BlockType.HP ? EffectFlag.BLOCK_HP.getMask() : EffectFlag.BLOCK_MP.getMask();
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.BLOCK_DAMAGE;
}
}

View File

@@ -1,46 +1,38 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.EffectFlag;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
/**
* @author Zealar
*/
public final class BlockDebuff extends AbstractEffect
{
public BlockDebuff(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
}
@Override
public int getEffectFlags()
{
return EffectFlag.BLOCK_DEBUFF.getMask();
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.BLOCK_DEBUFF;
}
}
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.EffectFlag;
/**
* Block escape effect implementation
* @author UnAfraid
*/
public class BlockEscape extends AbstractEffect
{
public BlockEscape(StatsSet params)
{
}
@Override
public long getEffectFlags()
{
return EffectFlag.CANNOT_ESCAPE.getMask();
}
}

View File

@@ -1,52 +1,46 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
/**
* Immobile Buff effect implementation.
* @author mkizub
*/
public final class ImmobileBuff extends Buff
{
public ImmobileBuff(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.BUFF;
}
@Override
public void onExit(BuffInfo info)
{
info.getEffected().setIsImmobilized(false);
}
@Override
public void onStart(BuffInfo info)
{
info.getEffected().setIsImmobilized(true);
}
}
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* Immobile Buff effect implementation.
* @author mkizub
*/
public final class BlockMove extends AbstractEffect
{
public BlockMove(StatsSet params)
{
}
@Override
public void onStart(L2Character effector, L2Character effected, Skill skill)
{
effected.setIsImmobilized(true);
}
@Override
public void onExit(BuffInfo info)
{
info.getEffected().setIsImmobilized(false);
}
}

View File

@@ -1,56 +1,56 @@
/*
* 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 com.l2jmobius.gameserver.instancemanager.PunishmentManager;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.punishment.PunishmentAffect;
import com.l2jmobius.gameserver.model.punishment.PunishmentTask;
import com.l2jmobius.gameserver.model.punishment.PunishmentType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
/**
* Block Party effect implementation.
* @author BiggBoss
*/
public final class BlockParty extends AbstractEffect
{
public BlockParty(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
}
@Override
public boolean canStart(BuffInfo info)
{
return (info.getEffected() != null) && info.getEffected().isPlayer();
}
@Override
public void onExit(BuffInfo info)
{
PunishmentManager.getInstance().stopPunishment(info.getEffected().getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.PARTY_BAN);
}
@Override
public void onStart(BuffInfo info)
{
PunishmentManager.getInstance().startPunishment(new PunishmentTask(0, info.getEffected().getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.PARTY_BAN, 0, "Party banned by bot report", "system", true));
}
}
/*
* 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 com.l2jmobius.gameserver.instancemanager.PunishmentManager;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.punishment.PunishmentAffect;
import com.l2jmobius.gameserver.model.punishment.PunishmentTask;
import com.l2jmobius.gameserver.model.punishment.PunishmentType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* Block Party effect implementation.
* @author BiggBoss
*/
public final class BlockParty extends AbstractEffect
{
public BlockParty(StatsSet params)
{
}
@Override
public boolean canStart(BuffInfo info)
{
return (info.getEffected() != null) && info.getEffected().isPlayer();
}
@Override
public void onStart(L2Character effector, L2Character effected, Skill skill)
{
PunishmentManager.getInstance().startPunishment(new PunishmentTask(0, effected.getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.PARTY_BAN, 0, "Party banned by bot report", "system", true));
}
@Override
public void onExit(BuffInfo info)
{
PunishmentManager.getInstance().stopPunishment(info.getEffected().getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.PARTY_BAN);
}
}

View File

@@ -1,40 +1,38 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.EffectFlag;
/**
* Block Resurrection effect implementation.
* @author UnAfraid
*/
public final class BlockResurrection extends AbstractEffect
{
public BlockResurrection(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
}
@Override
public int getEffectFlags()
{
return EffectFlag.BLOCK_RESURRECTION.getMask();
}
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.EffectFlag;
/**
* Block Resurrection effect implementation.
* @author UnAfraid
*/
public final class BlockResurrection extends AbstractEffect
{
public BlockResurrection(StatsSet params)
{
}
@Override
public long getEffectFlags()
{
return EffectFlag.BLOCK_RESURRECTION.getMask();
}
}

View File

@@ -0,0 +1,68 @@
/*
* 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 com.l2jmobius.commons.util.CommonUtil;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.events.EventType;
import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureSkillUse;
import com.l2jmobius.gameserver.model.events.listeners.FunctionEventListener;
import com.l2jmobius.gameserver.model.events.returns.TerminateReturn;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
/**
* Block Skills by isMagic type.
* @author Nik
*/
public final class BlockSkill extends AbstractEffect
{
private final int[] _magicTypes;
public BlockSkill(StatsSet params)
{
_magicTypes = params.getIntArray("magicTypes", ";");
}
public TerminateReturn onSkillUseEvent(OnCreatureSkillUse event)
{
if (CommonUtil.contains(_magicTypes, event.getSkill().getMagicType()))
{
return new TerminateReturn(true, true, true);
}
return null;
}
@Override
public void onStart(BuffInfo info)
{
if ((_magicTypes == null) || (_magicTypes.length == 0))
{
return;
}
info.getEffected().addListener(new FunctionEventListener(info.getEffected(), EventType.ON_CREATURE_SKILL_USE, (OnCreatureSkillUse event) -> onSkillUseEvent(event), this));
}
@Override
public void onExit(BuffInfo info)
{
info.getEffected().removeListenerIf(EventType.ON_CREATURE_SKILL_USE, listener -> listener.getOwner() == this);
}
}

View File

@@ -1,57 +1,53 @@
/*
* 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 com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Playable;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
/**
* @author NviX
*/
public final class BlockTarget extends AbstractEffect
{
public BlockTarget(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
}
@Override
public void onStart(BuffInfo info)
{
if (info.getEffected().isPlayable())
{
info.getEffected().setTarget(null);
info.getEffected().abortAttack();
info.getEffected().abortCast();
info.getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, info.getEffected());
((L2Playable) info.getEffected()).setLockedTarget(info.getEffected());
}
}
@Override
public void onExit(BuffInfo info)
{
if (info.getEffected().isPlayable())
{
((L2Playable) info.getEffected()).setLockedTarget(null);
}
}
}
/*
* 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 com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author UnAfraid
*/
public class BlockTarget extends AbstractEffect
{
public BlockTarget(StatsSet params)
{
}
@Override
public void onStart(L2Character effector, L2Character effected, Skill skill)
{
effected.setTargetable(false);
L2World.getInstance().forEachVisibleObject(effected, L2Character.class, target ->
{
if ((target.getTarget() == effected))
{
target.setTarget(null);
}
});
}
@Override
public void onExit(BuffInfo info)
{
info.getEffected().setTargetable(true);
}
}

View File

@@ -1,70 +1,66 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.stats.Formulas;
import com.l2jmobius.gameserver.network.serverpackets.StartRotation;
import com.l2jmobius.gameserver.network.serverpackets.StopRotation;
/**
* Bluff effect implementation.
* @author decad
*/
public final class Bluff extends AbstractEffect
{
private final int _chance;
public Bluff(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
_chance = params.getInt("chance", 100);
}
@Override
public boolean calcSuccess(BuffInfo info)
{
return Formulas.calcProbability(_chance, info.getEffector(), info.getEffected(), info.getSkill());
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void onStart(BuffInfo info)
{
final L2Character effected = info.getEffected();
// Headquarters NPC should not rotate
if ((effected.getId() == 35062) || effected.isRaid() || effected.isRaidMinion())
{
return;
}
final L2Character effector = info.getEffector();
effected.broadcastPacket(new StartRotation(effected.getObjectId(), effected.getHeading(), 1, 65535));
effected.broadcastPacket(new StopRotation(effected.getObjectId(), effector.getHeading(), 65535));
effected.setHeading(effector.getHeading());
}
}
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Formulas;
import com.l2jmobius.gameserver.network.serverpackets.StartRotation;
import com.l2jmobius.gameserver.network.serverpackets.StopRotation;
/**
* Bluff effect implementation.
* @author decad
*/
public final class Bluff extends AbstractEffect
{
private final int _chance;
public Bluff(StatsSet params)
{
_chance = params.getInt("chance", 100);
}
@Override
public boolean calcSuccess(L2Character effector, L2Character effected, Skill skill)
{
return Formulas.calcProbability(_chance, effector, effected, skill);
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
// Headquarters NPC should not rotate
if ((effected.getId() == 35062) || effected.isRaid() || effected.isRaidMinion())
{
return;
}
effected.broadcastPacket(new StartRotation(effected.getObjectId(), effected.getHeading(), 1, 65535));
effected.broadcastPacket(new StopRotation(effected.getObjectId(), effector.getHeading(), 65535));
effected.setHeading(effector.getHeading());
}
}

View File

@@ -0,0 +1,31 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* @author Sdw
*/
public class Breath extends AbstractStatEffect
{
public Breath(StatsSet params)
{
super(params, Stats.BREATH);
}
}

View File

@@ -1,46 +1,38 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.EffectFlag;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
/**
* @author Zealar
*/
public final class SingleTarget extends AbstractEffect
{
public SingleTarget(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
}
@Override
public int getEffectFlags()
{
return EffectFlag.SINGLE_TARGET.getMask();
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.SINGLE_TARGET;
}
}
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.EffectFlag;
/**
* Effect that blocks all incoming debuffs.
* @author Nik
*/
public final class BuffBlock extends AbstractEffect
{
public BuffBlock(StatsSet params)
{
}
@Override
public long getEffectFlags()
{
return EffectFlag.BUFF_BLOCK.getMask();
}
}

View File

@@ -1,58 +1,63 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
/**
* Call Party effect implementation.
* @author Adry_85
*/
public final class CallParty extends AbstractEffect
{
public CallParty(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void onStart(BuffInfo info)
{
if (!info.getEffector().isInParty())
{
return;
}
for (L2PcInstance partyMember : info.getEffector().getParty().getMembers())
{
if (CallPc.checkSummonTargetStatus(partyMember, info.getEffector().getActingPlayer()) && (info.getEffector() != partyMember))
{
partyMember.teleToLocation(info.getEffector().getLocation(), true);
}
}
}
}
/*
* 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 com.l2jmobius.gameserver.model.L2Party;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* Call Party effect implementation.
* @author Adry_85
*/
public final class CallParty extends AbstractEffect
{
public CallParty(StatsSet params)
{
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
final L2Party party = effector.getParty();
if (party == null)
{
return;
}
for (L2PcInstance partyMember : party.getMembers())
{
if (CallPc.checkSummonTargetStatus(partyMember, effector.getActingPlayer()))
{
if (effector != partyMember)
{
partyMember.teleToLocation(effector.getLocation(), true);
}
}
}
}
}

View File

@@ -1,160 +1,158 @@
/*
* 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 com.l2jmobius.Config;
import com.l2jmobius.gameserver.instancemanager.InstanceManager;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.entity.TvTEvent;
import com.l2jmobius.gameserver.model.holders.SummonRequestHolder;
import com.l2jmobius.gameserver.model.olympiad.OlympiadManager;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.zone.ZoneId;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.ConfirmDlg;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
/**
* Call Pc effect implementation.
* @author Adry_85
*/
public final class CallPc extends AbstractEffect
{
private final int _itemId;
private final int _itemCount;
public CallPc(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
_itemId = params.getInt("itemId", 0);
_itemCount = params.getInt("itemCount", 0);
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void onStart(BuffInfo info)
{
if (info.getEffected() == info.getEffector())
{
return;
}
final L2PcInstance target = info.getEffected().getActingPlayer();
final L2PcInstance activeChar = info.getEffector().getActingPlayer();
if (checkSummonTargetStatus(target, activeChar))
{
if ((_itemId != 0) && (_itemCount != 0))
{
if (target.getInventory().getInventoryItemCount(_itemId, 0) < _itemCount)
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_IS_REQUIRED_FOR_SUMMONING);
sm.addItemName(_itemId);
target.sendPacket(sm);
return;
}
target.getInventory().destroyItemByItemId("Consume", _itemId, _itemCount, activeChar, target);
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_DISAPPEARED);
sm.addItemName(_itemId);
target.sendPacket(sm);
}
target.addScript(new SummonRequestHolder(activeChar, info.getSkill()));
final ConfirmDlg confirm = new ConfirmDlg(SystemMessageId.C1_WISHES_TO_SUMMON_YOU_FROM_S2_DO_YOU_ACCEPT.getId());
confirm.addCharName(activeChar);
confirm.addZoneName(activeChar.getX(), activeChar.getY(), activeChar.getZ());
confirm.addTime(30000);
confirm.addRequesterId(activeChar.getObjectId());
target.sendPacket(confirm);
}
}
public static boolean checkSummonTargetStatus(L2PcInstance target, L2PcInstance activeChar)
{
if (target == activeChar)
{
return false;
}
if (target.isAlikeDead())
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_DEAD_AT_THE_MOMENT_AND_CANNOT_BE_SUMMONED_OR_TELEPORTED);
sm.addPcName(target);
activeChar.sendPacket(sm);
return false;
}
if (target.isInStoreMode())
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_CURRENTLY_TRADING_OR_OPERATING_A_PRIVATE_STORE_AND_CANNOT_BE_SUMMONED_OR_TELEPORTED);
sm.addPcName(target);
activeChar.sendPacket(sm);
return false;
}
if (target.isRooted() || target.isInCombat())
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ENGAGED_IN_COMBAT_AND_CANNOT_BE_SUMMONED_OR_TELEPORTED);
sm.addPcName(target);
activeChar.sendPacket(sm);
return false;
}
if (target.isInOlympiadMode() || OlympiadManager.getInstance().isRegisteredInComp(target))
{
activeChar.sendPacket(SystemMessageId.A_USER_PARTICIPATING_IN_THE_OLYMPIAD_CANNOT_USE_SUMMONING_OR_TELEPORTING);
return false;
}
if (target.isFlyingMounted() || target.isCombatFlagEquipped() || !TvTEvent.onEscapeUse(target.getObjectId()))
{
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_USE_SUMMONING_OR_TELEPORTING_IN_THIS_AREA);
return false;
}
if (target.inObserverMode())
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING_OR_TELEPORTING);
sm.addCharName(target);
activeChar.sendPacket(sm);
return false;
}
if (target.isInsideZone(ZoneId.NO_SUMMON_FRIEND) || target.isInsideZone(ZoneId.JAIL))
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING_OR_TELEPORTING);
sm.addString(target.getName());
activeChar.sendPacket(sm);
return false;
}
if ((activeChar.getInstanceId() > 0) && (!Config.ALLOW_SUMMON_IN_INSTANCE || !InstanceManager.getInstance().getInstance(activeChar.getInstanceId()).isSummonAllowed()))
{
activeChar.sendPacket(SystemMessageId.YOU_MAY_NOT_SUMMON_FROM_YOUR_CURRENT_LOCATION);
return false;
}
return true;
}
}
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.holders.SummonRequestHolder;
import com.l2jmobius.gameserver.model.instancezone.Instance;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.olympiad.OlympiadManager;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.zone.ZoneId;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.ConfirmDlg;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
/**
* Call Pc effect implementation.
* @author Adry_85
*/
public final class CallPc extends AbstractEffect
{
private final int _itemId;
private final int _itemCount;
public CallPc(StatsSet params)
{
_itemId = params.getInt("itemId", 0);
_itemCount = params.getInt("itemCount", 0);
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
if (effector == effected)
{
return;
}
final L2PcInstance target = effected.getActingPlayer();
final L2PcInstance activeChar = effector.getActingPlayer();
if (checkSummonTargetStatus(target, activeChar))
{
if ((_itemId != 0) && (_itemCount != 0))
{
if (target.getInventory().getInventoryItemCount(_itemId, 0) < _itemCount)
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_IS_REQUIRED_FOR_SUMMONING);
sm.addItemName(_itemId);
target.sendPacket(sm);
return;
}
target.getInventory().destroyItemByItemId("Consume", _itemId, _itemCount, activeChar, target);
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_DISAPPEARED);
sm.addItemName(_itemId);
target.sendPacket(sm);
}
target.addScript(new SummonRequestHolder(activeChar, skill));
final ConfirmDlg confirm = new ConfirmDlg(SystemMessageId.C1_WISHES_TO_SUMMON_YOU_FROM_S2_DO_YOU_ACCEPT.getId());
confirm.addCharName(activeChar);
confirm.addZoneName(activeChar.getX(), activeChar.getY(), activeChar.getZ());
confirm.addTime(30000);
confirm.addRequesterId(activeChar.getObjectId());
target.sendPacket(confirm);
}
}
public static boolean checkSummonTargetStatus(L2PcInstance target, L2Character activeChar)
{
if (target == activeChar)
{
return false;
}
if (target.isAlikeDead())
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_DEAD_AT_THE_MOMENT_AND_CANNOT_BE_SUMMONED_OR_TELEPORTED);
sm.addPcName(target);
activeChar.sendPacket(sm);
return false;
}
if (target.isInStoreMode())
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_CURRENTLY_TRADING_OR_OPERATING_A_PRIVATE_STORE_AND_CANNOT_BE_SUMMONED_OR_TELEPORTED);
sm.addPcName(target);
activeChar.sendPacket(sm);
return false;
}
if (target.isRooted() || target.isInCombat())
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ENGAGED_IN_COMBAT_AND_CANNOT_BE_SUMMONED_OR_TELEPORTED);
sm.addPcName(target);
activeChar.sendPacket(sm);
return false;
}
if (target.isInOlympiadMode())
{
activeChar.sendPacket(SystemMessageId.A_USER_PARTICIPATING_IN_THE_OLYMPIAD_CANNOT_USE_SUMMONING_OR_TELEPORTING);
return false;
}
if (target.isFlyingMounted() || target.isCombatFlagEquipped())
{
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_USE_SUMMONING_OR_TELEPORTING_IN_THIS_AREA);
return false;
}
if (target.inObserverMode() || OlympiadManager.getInstance().isRegisteredInComp(target))
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING_OR_TELEPORTING2);
sm.addCharName(target);
activeChar.sendPacket(sm);
return false;
}
if (target.isInsideZone(ZoneId.NO_SUMMON_FRIEND) || target.isInsideZone(ZoneId.JAIL))
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING_OR_TELEPORTING);
sm.addString(target.getName());
activeChar.sendPacket(sm);
return false;
}
final Instance instance = activeChar.getInstanceWorld();
if ((instance != null) && !instance.isPlayerSummonAllowed())
{
activeChar.sendPacket(SystemMessageId.YOU_MAY_NOT_SUMMON_FROM_YOUR_CURRENT_LOCATION);
return false;
}
return true;
}
}

View File

@@ -1,51 +1,80 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.holders.SkillHolder;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
/**
* Call Skill effect implementation.
* @author NosBit
*/
public final class CallSkill extends AbstractEffect
{
private final SkillHolder _skill;
public CallSkill(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
_skill = new SkillHolder(params.getInt("skillId"), params.getInt("skillLevel", 1));
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void onStart(BuffInfo info)
{
info.getEffector().makeTriggerCast(_skill.getSkill(), info.getEffected(), true);
}
}
/*
* 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 com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.holders.SkillHolder;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.skills.SkillCaster;
/**
* Call Skill effect implementation.
* @author NosBit
*/
public final class CallSkill extends AbstractEffect
{
private final SkillHolder _skill;
private final int _skillLevelScaleTo;
public CallSkill(StatsSet params)
{
_skill = new SkillHolder(params.getInt("skillId"), params.getInt("skillLevel", 1));
_skillLevelScaleTo = params.getInt("skillLevelScaleTo", 0);
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
final Skill triggerSkill;
if (_skillLevelScaleTo <= 0)
{
triggerSkill = _skill.getSkill();
}
else
{
final BuffInfo buffInfo = effected.getEffectList().getBuffInfoBySkillId(_skill.getSkillId());
if (buffInfo != null)
{
triggerSkill = SkillData.getInstance().getSkill(_skill.getSkillId(), Math.min(_skillLevelScaleTo, buffInfo.getSkill().getLevel() + 1));
}
else
{
triggerSkill = _skill.getSkill();
}
}
if (triggerSkill != null)
{
SkillCaster.triggerCast(effector, effected, triggerSkill);
}
else
{
_log.warning("Skill not found effect called from " + skill);
}
}
}

View File

@@ -0,0 +1,79 @@
/*
* 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 com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.holders.SkillHolder;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.skills.SkillCaster;
/**
* Dam Over Time effect implementation.
*/
public final class CallSkillOnActionTime extends AbstractEffect
{
private final SkillHolder _skill;
public CallSkillOnActionTime(StatsSet params)
{
_skill = new SkillHolder(params.getInt("skillId"), params.getInt("skillLevel", 1));
setTicks(params.getInt("ticks"));
}
@Override
public boolean onActionTime(BuffInfo info)
{
return castSkill(info);
}
private boolean castSkill(BuffInfo info)
{
if (info.getEffector().isDead())
{
return false;
}
final Skill skill = _skill.getSkill();
if (skill != null)
{
if (skill.isSynergySkill())
{
skill.applyEffects(info.getEffector(), info.getEffector());
}
L2World.getInstance().forEachVisibleObjectInRange(info.getEffector(), L2Character.class, _skill.getSkill().getAffectRange(), c ->
{
final L2Object target = skill.getTarget(info.getEffector(), c, false, false, false);
if ((target != null) && target.isCharacter())
{
SkillCaster.triggerCast(info.getEffector(), (L2Character) target, skill);
}
});
}
else
{
_log.warning("Skill not found effect called from " + info.getSkill());
}
return info.getSkill().isToggle();
}
}

View File

@@ -1,56 +1,58 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Attackable;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
public class ShiftTarget extends AbstractEffect
{
public ShiftTarget(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void onStart(BuffInfo info)
{
if (info.getEffected().isAlikeDead())
{
return;
}
for (L2Character obj : info.getEffector().getKnownList().getKnownCharactersInRadius(info.getSkill().getEffectRange()))
{
if (!obj.isMonster() || obj.isDead() || (obj.getTarget() == null) || (obj.getTarget() != info.getEffector()))
{
continue;
}
((L2Attackable) obj).addDamageHate(info.getEffected(), 0, ((L2Attackable) obj).getHating(info.getEffector()) + 1);
}
}
}
/*
* 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 com.l2jmobius.gameserver.model.L2Party;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* GM Effect: Call Target's Party around target effect implementation.
* @author Nik
*/
public final class CallTargetParty extends AbstractEffect
{
public CallTargetParty(StatsSet params)
{
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
final L2PcInstance player = effected.getActingPlayer();
if ((player == null))
{
return;
}
final L2Party party = player.getParty();
if (party != null)
{
party.getMembers().stream().filter(p -> (p != player) && CallPc.checkSummonTargetStatus(p, effector)).forEach(p -> p.teleToLocation(player.getLocation(), true));
}
}
}

View File

@@ -1,85 +1,93 @@
/*
* 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 com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.EffectFlag;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.network.SystemMessageId;
/**
* Chameleon Rest effect implementation.
*/
public final class ChameleonRest extends AbstractEffect
{
private final double _power;
public ChameleonRest(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
_power = params.getDouble("power", 0);
}
@Override
public int getEffectFlags()
{
return EffectFlag.SILENT_MOVE.getMask() | EffectFlag.RELAXING.getMask();
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.RELAXING;
}
@Override
public boolean onActionTime(BuffInfo info)
{
if (info.getEffected().isDead() || (info.getEffected().isPlayer() && !info.getEffected().getActingPlayer().isSitting()))
{
return false;
}
final double manaDam = _power * getTicksMultiplier();
if (manaDam > info.getEffected().getCurrentMp())
{
info.getEffected().sendPacket(SystemMessageId.YOUR_SKILL_WAS_DEACTIVATED_DUE_TO_LACK_OF_MP);
return false;
}
info.getEffected().reduceCurrentMp(manaDam);
return info.getSkill().isToggle();
}
@Override
public void onStart(BuffInfo info)
{
if (info.getEffected().isPlayer())
{
info.getEffected().getActingPlayer().sitDown(false);
}
else
{
info.getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_REST);
}
}
}
/*
* 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 com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.EffectFlag;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.SystemMessageId;
/**
* Chameleon Rest effect implementation.
*/
public final class ChameleonRest extends AbstractEffect
{
private final double _power;
public ChameleonRest(StatsSet params)
{
_power = params.getDouble("power", 0);
setTicks(params.getInt("ticks"));
}
@Override
public long getEffectFlags()
{
return (EffectFlag.SILENT_MOVE.getMask() | EffectFlag.RELAXING.getMask());
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.RELAXING;
}
@Override
public boolean onActionTime(BuffInfo info)
{
if (info.getEffected().isDead())
{
return false;
}
if (info.getEffected().isPlayer())
{
if (!info.getEffected().getActingPlayer().isSitting())
{
return false;
}
}
final double manaDam = _power * getTicksMultiplier();
if (manaDam > info.getEffected().getCurrentMp())
{
info.getEffected().sendPacket(SystemMessageId.YOUR_SKILL_WAS_DEACTIVATED_DUE_TO_LACK_OF_MP);
return false;
}
info.getEffected().reduceCurrentMp(manaDam);
return info.getSkill().isToggle();
}
@Override
public void onStart(L2Character effector, L2Character effected, Skill skill)
{
if (effected.isPlayer())
{
effected.getActingPlayer().sitDown(false);
}
else
{
effected.getAI().setIntention(CtrlIntention.AI_INTENTION_REST);
}
}
}

View File

@@ -0,0 +1,70 @@
/*
* 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 java.util.HashSet;
import java.util.Set;
import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.holders.TemplateChanceHolder;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* Transformation type effect, which disables attack or use of skills.
* @author Nik
*/
public final class ChangeBody extends AbstractEffect
{
private final Set<TemplateChanceHolder> _transformations = new HashSet<>();
public ChangeBody(StatsSet params)
{
for (StatsSet item : params.getList("templates", StatsSet.class))
{
_transformations.add(new TemplateChanceHolder(item.getInt(".templateId"), item.getInt(".minChance"), item.getInt(".maxChance")));
}
}
@Override
public boolean canStart(BuffInfo info)
{
return !info.getEffected().isDoor();
}
@Override
public void onStart(L2Character effector, L2Character effected, Skill skill)
{
final int chance = Rnd.get(100);
//@formatter:off
_transformations.stream()
.filter(t -> t.calcChance(chance)) // Calculate chance for each transformation.
.mapToInt(TemplateChanceHolder::getTemplateId)
.findAny()
.ifPresent(id -> effected.transform(id, false)); // Transform effected to whatever successful random template without adding skills.
//@formatter:on
}
@Override
public void onExit(BuffInfo info)
{
info.getEffected().stopTransformation(false);
}
}

View File

@@ -1,58 +1,57 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
/**
* Change Face effect implementation.
* @author Zoey76
*/
public final class ChangeFace extends AbstractEffect
{
private final int _value;
public ChangeFace(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
_value = params.getInt("value", 0);
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void onStart(BuffInfo info)
{
if ((info.getEffector() == null) || (info.getEffected() == null) || !info.getEffector().isPlayer() || !info.getEffected().isPlayer() || info.getEffected().isAlikeDead())
{
return;
}
final L2PcInstance player = info.getEffector().getActingPlayer();
player.getAppearance().setFace(_value);
player.broadcastUserInfo();
}
}
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* Change Face effect implementation.
* @author Zoey76
*/
public final class ChangeFace extends AbstractEffect
{
private final int _value;
public ChangeFace(StatsSet params)
{
_value = params.getInt("value", 0);
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
if (!effected.isPlayer())
{
return;
}
final L2PcInstance player = effected.getActingPlayer();
player.getAppearance().setFace(_value);
player.broadcastUserInfo();
}
}

View File

@@ -1,33 +1,31 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
/**
* Change Fishing Mastery dummy effect implementation.
* @author Zoey76
*/
public final class ChangeFishingMastery extends AbstractEffect
{
public ChangeFishingMastery(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
}
}
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
/**
* Change Fishing Mastery dummy effect implementation.
* @author Zoey76
*/
public final class ChangeFishingMastery extends AbstractEffect
{
public ChangeFishingMastery(StatsSet params)
{
}
}

View File

@@ -1,58 +1,57 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
/**
* Change Hair Color effect implementation.
* @author Zoey76
*/
public final class ChangeHairColor extends AbstractEffect
{
private final int _value;
public ChangeHairColor(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
_value = params.getInt("value", 0);
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void onStart(BuffInfo info)
{
if ((info.getEffector() == null) || (info.getEffected() == null) || !info.getEffector().isPlayer() || !info.getEffected().isPlayer() || info.getEffected().isAlikeDead())
{
return;
}
final L2PcInstance player = info.getEffector().getActingPlayer();
player.getAppearance().setHairColor(_value);
player.broadcastUserInfo();
}
}
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* Change Hair Color effect implementation.
* @author Zoey76
*/
public final class ChangeHairColor extends AbstractEffect
{
private final int _value;
public ChangeHairColor(StatsSet params)
{
_value = params.getInt("value", 0);
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
if (!effected.isPlayer())
{
return;
}
final L2PcInstance player = effected.getActingPlayer();
player.getAppearance().setHairColor(_value);
player.broadcastUserInfo();
}
}

View File

@@ -1,58 +1,57 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
/**
* Change Hair Style effect implementation.
* @author Zoey76
*/
public final class ChangeHairStyle extends AbstractEffect
{
private final int _value;
public ChangeHairStyle(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
_value = params.getInt("value", 0);
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void onStart(BuffInfo info)
{
if ((info.getEffector() == null) || (info.getEffected() == null) || !info.getEffector().isPlayer() || !info.getEffected().isPlayer() || info.getEffected().isAlikeDead())
{
return;
}
final L2PcInstance player = info.getEffector().getActingPlayer();
player.getAppearance().setHairStyle(_value);
player.broadcastUserInfo();
}
}
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* Change Hair Style effect implementation.
* @author Zoey76
*/
public final class ChangeHairStyle extends AbstractEffect
{
private final int _value;
public ChangeHairStyle(StatsSet params)
{
_value = params.getInt("value", 0);
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
if (!effected.isPlayer())
{
return;
}
final L2PcInstance player = effected.getActingPlayer();
player.getAppearance().setHairStyle(_value);
player.broadcastUserInfo();
}
}

View File

@@ -0,0 +1,37 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.EffectFlag;
/**
* @author Sdw
*/
public class CheapShot extends AbstractEffect
{
public CheapShot(StatsSet params)
{
}
@Override
public long getEffectFlags()
{
return EffectFlag.CHEAPSHOT.getMask();
}
}

View File

@@ -1,88 +1,88 @@
/*
* 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 com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.enums.SubclassInfoType;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.AcquireSkillList;
import com.l2jmobius.gameserver.network.serverpackets.ExSubjobInfo;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
/**
* @author Sdw
*/
public class ClassChange extends AbstractEffect
{
private final int _index;
private static final int IDENTITY_CRISIS_SKILL_ID = 1570;
public ClassChange(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
_index = params.getInt("index", 0);
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void onStart(BuffInfo info)
{
if (info.getEffector().isPlayer())
{
final L2PcInstance player = info.getEffector().getActingPlayer();
// TODO: FIX ME - Executing 1 second later otherwise interupted exception during storeCharBase()
ThreadPoolManager.getInstance().scheduleGeneral(() ->
{
final int activeClass = player.getClassId().getId();
if (!player.setActiveClass(_index))
{
player.sendMessage("You cannot switch your class right now!.");
return;
}
final Skill identifyCrisis = SkillData.getInstance().getSkill(IDENTITY_CRISIS_SKILL_ID, 1);
if (identifyCrisis != null)
{
identifyCrisis.applyEffects(player, player);
}
final SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_SUCCESSFULLY_SWITCHED_S1_TO_S2);
msg.addClassId(activeClass);
msg.addClassId(player.getClassId().getId());
player.sendPacket(msg);
player.broadcastUserInfo();
player.sendPacket(new AcquireSkillList(player));
player.sendPacket(new ExSubjobInfo(player, SubclassInfoType.CLASS_CHANGED));
}, 1000);
}
}
}
/*
* 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 com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.enums.SubclassInfoType;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.AcquireSkillList;
import com.l2jmobius.gameserver.network.serverpackets.ExSubjobInfo;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
import com.l2jmobius.gameserver.network.serverpackets.ability.ExAcquireAPSkillList;
/**
* @author Sdw
*/
public class ClassChange extends AbstractEffect
{
private final int _index;
private final static int IDENTITY_CRISIS_SKILL_ID = 1570;
public ClassChange(StatsSet params)
{
_index = params.getInt("index", 0);
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
if (effected.isPlayer())
{
final L2PcInstance player = effected.getActingPlayer();
// TODO: FIX ME - Executing 1 second later otherwise interupted exception during storeCharBase()
ThreadPoolManager.getInstance().scheduleGeneral(() ->
{
final int activeClass = player.getClassId().getId();
if (!player.setActiveClass(_index))
{
player.sendMessage("You cannot switch your class right now!");
return;
}
final Skill identifyCrisis = SkillData.getInstance().getSkill(IDENTITY_CRISIS_SKILL_ID, 1);
if (identifyCrisis != null)
{
identifyCrisis.applyEffects(player, player);
}
final SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_SUCCESSFULLY_SWITCHED_S1_TO_S2);
msg.addClassId(activeClass);
msg.addClassId(player.getClassId().getId());
player.sendPacket(msg);
player.broadcastUserInfo();
player.sendPacket(new AcquireSkillList(player));
player.sendPacket(new ExSubjobInfo(player, SubclassInfoType.CLASS_CHANGED));
player.sendPacket(new ExAcquireAPSkillList(player));
}, 1000);
}
}
}

View File

@@ -1,101 +1,85 @@
/*
* 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 java.util.ArrayList;
import java.util.List;
import com.l2jmobius.gameserver.ai.CtrlEvent;
import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.EffectFlag;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.stats.Formulas;
import com.l2jmobius.util.Rnd;
/**
* Confuse effect implementation.
* @author littlecrow
*/
public final class Confuse extends AbstractEffect
{
private final int _chance;
public Confuse(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
_chance = params.getInt("chance", 100);
}
@Override
public boolean calcSuccess(BuffInfo info)
{
return Formulas.calcProbability(_chance, info.getEffector(), info.getEffected(), info.getSkill());
}
@Override
public int getEffectFlags()
{
return EffectFlag.CONFUSED.getMask();
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void onExit(BuffInfo info)
{
if (!info.getEffected().isPlayer())
{
info.getEffected().getAI().notifyEvent(CtrlEvent.EVT_THINK);
}
}
@Override
public void onStart(BuffInfo info)
{
info.getEffected().getAI().notifyEvent(CtrlEvent.EVT_CONFUSED);
final List<L2Character> targetList = new ArrayList<>();
// Getting the possible targets
for (L2Object obj : info.getEffected().getKnownList().getKnownObjects().values())
{
if (((info.getEffected().isMonster() && obj.isAttackable()) || (obj instanceof L2Character)) && (obj != info.getEffected()))
{
targetList.add((L2Character) obj);
}
}
// if there is no target, exit function
if (!targetList.isEmpty())
{
// Choosing randomly a new target
final L2Character target = targetList.get(Rnd.nextInt(targetList.size()));
// Attacking the target
info.getEffected().setTarget(target);
info.getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
}
}
}
/*
* 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 java.util.ArrayList;
import java.util.List;
import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.ai.CtrlEvent;
import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.EffectFlag;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Formulas;
/**
* Confuse effect implementation.
* @author littlecrow
*/
public final class Confuse extends AbstractEffect
{
private final int _chance;
public Confuse(StatsSet params)
{
_chance = params.getInt("chance", 100);
}
@Override
public boolean calcSuccess(L2Character effector, L2Character effected, Skill skill)
{
return Formulas.calcProbability(_chance, effector, effected, skill);
}
@Override
public long getEffectFlags()
{
return EffectFlag.CONFUSED.getMask();
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
effected.getAI().notifyEvent(CtrlEvent.EVT_CONFUSED);
final List<L2Character> targetList = new ArrayList<>();
// Getting the possible targets
L2World.getInstance().forEachVisibleObject(effected, L2Character.class, targetList::add);
// if there is no target, exit function
if (!targetList.isEmpty())
{
// Choosing randomly a new target
final L2Character target = targetList.get(Rnd.nextInt(targetList.size()));
// Attacking the target
effected.setTarget(target);
effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
}
}
}

View File

@@ -1,52 +1,52 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
/**
* Consume Body effect implementation.
* @author Zoey76
*/
public final class ConsumeBody extends AbstractEffect
{
public ConsumeBody(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void onStart(BuffInfo info)
{
if ((info.getEffector() == null) || (info.getEffected() == null) || !info.getEffected().isNpc() || !info.getEffected().isDead())
{
return;
}
((L2Npc) info.getEffected()).endDecayTask();
}
}
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* Consume Body effect implementation.
* @author Zoey76
*/
public final class ConsumeBody extends AbstractEffect
{
public ConsumeBody(StatsSet params)
{
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
if (!effected.isNpc() || !effected.isDead())
{
return;
}
((L2Npc) effected).endDecayTask();
}
}

View File

@@ -1,167 +1,168 @@
/*
* 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 com.l2jmobius.gameserver.model.Elementals;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.itemcontainer.Inventory;
import com.l2jmobius.gameserver.model.items.L2Weapon;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.InventoryUpdate;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
/**
* Convert Item effect implementation.
* @author Zoey76
*/
public final class ConvertItem extends AbstractEffect
{
public ConvertItem(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void onStart(BuffInfo info)
{
if ((info.getEffector() == null) || (info.getEffected() == null) || info.getEffected().isAlikeDead() || !info.getEffected().isPlayer())
{
return;
}
final L2PcInstance player = info.getEffected().getActingPlayer();
if (player.hasItemRequest())
{
return;
}
final L2Weapon weaponItem = player.getActiveWeaponItem();
if (weaponItem == null)
{
return;
}
L2ItemInstance wpn = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
if (wpn == null)
{
wpn = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LHAND);
}
if ((wpn == null) || wpn.isAugmented() || (weaponItem.getChangeWeaponId() == 0))
{
return;
}
final int newItemId = weaponItem.getChangeWeaponId();
if (newItemId == -1)
{
return;
}
final int enchantLevel = wpn.getEnchantLevel();
final Elementals elementals = wpn.getElementals() == null ? null : wpn.getElementals()[0];
final L2ItemInstance[] unequiped = player.getInventory().unEquipItemInBodySlotAndRecord(wpn.getItem().getBodyPart());
final InventoryUpdate iu = new InventoryUpdate();
for (L2ItemInstance item : unequiped)
{
iu.addModifiedItem(item);
}
player.sendPacket(iu);
if (unequiped.length <= 0)
{
return;
}
byte count = 0;
for (L2ItemInstance item : unequiped)
{
if (!(item.getItem() instanceof L2Weapon))
{
count++;
continue;
}
final SystemMessage sm;
if (item.getEnchantLevel() > 0)
{
sm = SystemMessage.getSystemMessage(SystemMessageId.THE_EQUIPMENT_S1_S2_HAS_BEEN_REMOVED);
sm.addInt(item.getEnchantLevel());
}
else
{
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_HAS_BEEN_UNEQUIPPED);
}
sm.addItemName(item);
player.sendPacket(sm);
}
if (count == unequiped.length)
{
return;
}
final L2ItemInstance destroyItem = player.getInventory().destroyItem("ChangeWeapon", wpn, player, null);
if (destroyItem == null)
{
return;
}
final L2ItemInstance newItem = player.getInventory().addItem("ChangeWeapon", newItemId, 1, player, destroyItem);
if (newItem == null)
{
return;
}
if ((elementals != null) && (elementals.getElement() != -1) && (elementals.getValue() != -1))
{
newItem.setElementAttr(elementals.getElement(), elementals.getValue());
}
newItem.setEnchantLevel(enchantLevel);
player.getInventory().equipItem(newItem);
final SystemMessage msg;
if (newItem.getEnchantLevel() > 0)
{
msg = SystemMessage.getSystemMessage(SystemMessageId.EQUIPPED_S1_S2);
msg.addInt(newItem.getEnchantLevel());
}
else
{
msg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_EQUIPPED_YOUR_S1);
}
msg.addItemName(newItem);
player.sendPacket(msg);
final InventoryUpdate u = new InventoryUpdate();
u.addRemovedItem(destroyItem);
u.addItem(newItem);
player.sendPacket(u);
player.broadcastUserInfo();
}
}
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.itemcontainer.Inventory;
import com.l2jmobius.gameserver.model.items.L2Weapon;
import com.l2jmobius.gameserver.model.items.enchant.attribute.AttributeHolder;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.InventoryUpdate;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
/**
* Convert Item effect implementation.
* @author Zoey76
*/
public final class ConvertItem extends AbstractEffect
{
public ConvertItem(StatsSet params)
{
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
if (effected.isAlikeDead() || !effected.isPlayer())
{
return;
}
final L2PcInstance player = effected.getActingPlayer();
if (player.hasItemRequest())
{
return;
}
final L2Weapon weaponItem = player.getActiveWeaponItem();
if (weaponItem == null)
{
return;
}
L2ItemInstance wpn = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
if (wpn == null)
{
wpn = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LHAND);
}
if ((wpn == null) || wpn.isAugmented() || (weaponItem.getChangeWeaponId() == 0))
{
return;
}
final int newItemId = weaponItem.getChangeWeaponId();
if (newItemId == -1)
{
return;
}
final int enchantLevel = wpn.getEnchantLevel();
final AttributeHolder elementals = wpn.getAttributes() == null ? null : wpn.getAttackAttribute();
final L2ItemInstance[] unequiped = player.getInventory().unEquipItemInBodySlotAndRecord(wpn.getItem().getBodyPart());
final InventoryUpdate iu = new InventoryUpdate();
for (L2ItemInstance unequippedItem : unequiped)
{
iu.addModifiedItem(unequippedItem);
}
player.sendInventoryUpdate(iu);
if (unequiped.length <= 0)
{
return;
}
byte count = 0;
for (L2ItemInstance unequippedItem : unequiped)
{
if (!(unequippedItem.getItem() instanceof L2Weapon))
{
count++;
continue;
}
final SystemMessage sm;
if (item.getEnchantLevel() > 0)
{
sm = SystemMessage.getSystemMessage(SystemMessageId.THE_EQUIPMENT_S1_S2_HAS_BEEN_REMOVED);
sm.addInt(item.getEnchantLevel());
sm.addItemName(unequippedItem);
}
else
{
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_HAS_BEEN_UNEQUIPPED);
sm.addItemName(unequippedItem);
}
player.sendPacket(sm);
}
if (count == unequiped.length)
{
return;
}
final L2ItemInstance destroyItem = player.getInventory().destroyItem("ChangeWeapon", wpn, player, null);
if (destroyItem == null)
{
return;
}
final L2ItemInstance newItem = player.getInventory().addItem("ChangeWeapon", newItemId, 1, player, destroyItem);
if (newItem == null)
{
return;
}
if (elementals != null)
{
newItem.setAttribute(elementals);
}
newItem.setEnchantLevel(enchantLevel);
player.getInventory().equipItem(newItem);
final SystemMessage msg;
if (newItem.getEnchantLevel() > 0)
{
msg = SystemMessage.getSystemMessage(SystemMessageId.EQUIPPED_S1_S2);
msg.addInt(newItem.getEnchantLevel());
msg.addItemName(newItem);
}
else
{
msg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_EQUIPPED_YOUR_S1);
msg.addItemName(newItem);
}
player.sendPacket(msg);
final InventoryUpdate u = new InventoryUpdate();
u.addRemovedItem(destroyItem);
u.addItem(newItem);
player.sendInventoryUpdate(u);
player.broadcastUserInfo();
}
}

View File

@@ -0,0 +1,31 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* @author Sdw
*/
public class CounterPhysicalSkill extends AbstractStatAddEffect
{
public CounterPhysicalSkill(StatsSet params)
{
super(params, Stats.VENGEANCE_SKILL_PHYSICAL_DAMAGE);
}
}

View File

@@ -0,0 +1,96 @@
/*
* 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 com.l2jmobius.gameserver.enums.StatModifierType;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
/**
* CP change effect. It is mostly used for potions and static damage.
* @author Nik
*/
public final class Cp extends AbstractEffect
{
private final int _amount;
private final StatModifierType _mode;
public Cp(StatsSet params)
{
_amount = params.getInt("amount", 0);
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
if (effected.isDead() || effected.isDoor() || effected.isHpBlocked())
{
return;
}
double amount = 0;
switch (_mode)
{
case DIFF:
{
amount = Math.min(_amount, effected.getMaxRecoverableCp() - effected.getCurrentCp());
break;
}
case PER:
{
amount = Math.min((effected.getCurrentCp() * _amount) / 100.0, effected.getMaxRecoverableCp() - effected.getCurrentCp());
break;
}
}
if (amount != 0)
{
final double newCp = amount + effected.getCurrentCp();
effected.setCurrentCp(newCp, false);
effected.broadcastStatusUpdate(effector);
}
if (amount >= 0)
{
if ((effector != null) && (effector != effected))
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S2_CP_HAS_BEEN_RESTORED_BY_C1);
sm.addCharName(effector);
sm.addInt((int) amount);
effected.sendPacket(sm);
}
else
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CP_HAS_BEEN_RESTORED);
sm.addInt((int) amount);
effected.sendPacket(sm);
}
}
}
}

View File

@@ -1,72 +0,0 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.stats.Formulas;
/**
* CP Damage Percent effect implementation.
* @author Zoey76, Adry_85
*/
public final class CpDamPercent extends AbstractEffect
{
private final double _power;
public CpDamPercent(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
_power = params.getDouble("power", 0);
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void onStart(BuffInfo info)
{
if (!info.getEffected().isPlayer())
{
return;
}
if (info.getEffected().isPlayer() && info.getEffected().getActingPlayer().isFakeDeath())
{
info.getEffected().stopFakeDeath(true);
}
final int damage = (int) ((info.getEffected().getCurrentCp() * _power) / 100);
// Manage attack or cast break of the target (calculating rate, sending message)
if (!info.getEffected().isRaid() && Formulas.calcAtkBreak(info.getEffected(), damage))
{
info.getEffected().breakAttack();
info.getEffected().breakCast();
}
if (damage > 0)
{
info.getEffected().setCurrentCp(info.getEffected().getCurrentCp() - damage);
}
}
}

View File

@@ -1,75 +1,76 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
/**
* Cp Heal effect implementation.
* @author UnAfraid
*/
public final class CpHeal extends AbstractEffect
{
private final double _power;
public CpHeal(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
_power = params.getDouble("power", 0);
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.CPHEAL;
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void onStart(BuffInfo info)
{
final L2Character target = info.getEffected();
if ((target == null) || target.isDead() || target.isDoor())
{
return;
}
// Prevents overheal and negative amount
final double amount = Math.max(Math.min(_power, target.getMaxRecoverableCp() - target.getCurrentCp()), 0);
if (amount != 0)
{
target.setCurrentCp(amount + target.getCurrentCp());
}
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CP_HAS_BEEN_RESTORED);
sm.addInt((int) amount);
target.sendPacket(sm);
}
}
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
/**
* Cp Heal effect implementation.
* @author UnAfraid
*/
public final class CpHeal extends AbstractEffect
{
private final double _power;
public CpHeal(StatsSet params)
{
_power = params.getDouble("power", 0);
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.CPHEAL;
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
if (effected.isDead() || effected.isDoor() || effected.isHpBlocked())
{
return;
}
double amount = _power;
// Prevents overheal and negative amount
amount = Math.max(Math.min(amount, effected.getMaxRecoverableCp() - effected.getCurrentCp()), 0);
if (amount != 0)
{
final double newCp = amount + effected.getCurrentCp();
effected.setCurrentCp(newCp, false);
effected.broadcastStatusUpdate(effector);
}
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CP_HAS_BEEN_RESTORED);
sm.addInt((int) amount);
effected.sendPacket(sm);
}
}

View File

@@ -1,60 +1,59 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
/**
* Cp Heal Over Time effect implementation.
*/
public final class CpHealOverTime extends AbstractEffect
{
private final double _power;
public CpHealOverTime(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
_power = params.getDouble("power", 0);
}
@Override
public boolean onActionTime(BuffInfo info)
{
if (info.getEffected().isDead())
{
return false;
}
double cp = info.getEffected().getCurrentCp();
final double maxcp = info.getEffected().getMaxRecoverableCp();
// Not needed to set the CP and send update packet if player is already at max CP
if (cp >= maxcp)
{
return false;
}
cp += _power * getTicksMultiplier();
cp = Math.min(cp, maxcp);
info.getEffected().setCurrentCp(cp);
return true;
}
}
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
/**
* Cp Heal Over Time effect implementation.
*/
public final class CpHealOverTime extends AbstractEffect
{
private final double _power;
public CpHealOverTime(StatsSet params)
{
_power = params.getDouble("power", 0);
setTicks(params.getInt("ticks"));
}
@Override
public boolean onActionTime(BuffInfo info)
{
if (info.getEffected().isDead())
{
return false;
}
double cp = info.getEffected().getCurrentCp();
final double maxcp = info.getEffected().getMaxRecoverableCp();
// Not needed to set the CP and send update packet if player is already at max CP
if (cp >= maxcp)
{
return false;
}
cp += _power * getTicksMultiplier();
cp = Math.min(cp, maxcp);
info.getEffected().setCurrentCp(cp, false);
info.getEffected().broadcastStatusUpdate(info.getEffector());
return true;
}
}

View File

@@ -1,73 +1,72 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
/**
* Cp Heal Percent effect implementation.
* @author UnAfraid
*/
public final class CpHealPercent extends AbstractEffect
{
private final double _power;
public CpHealPercent(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
_power = params.getDouble("power", 0);
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void onStart(BuffInfo info)
{
final L2Character target = info.getEffected();
if ((target == null) || target.isDead() || target.isDoor())
{
return;
}
double amount = 0;
final double power = _power;
final boolean full = power == 100.0;
amount = full ? target.getMaxCp() : (target.getMaxCp() * power) / 100.0;
// Prevents overheal and negative amount
amount = Math.max(Math.min(amount, target.getMaxRecoverableCp() - target.getCurrentCp()), 0);
if (amount != 0)
{
target.setCurrentCp(amount + target.getCurrentCp());
}
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CP_HAS_BEEN_RESTORED);
sm.addInt((int) amount);
target.sendPacket(sm);
}
}
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
/**
* Cp Heal Percent effect implementation.
* @author UnAfraid
*/
public final class CpHealPercent extends AbstractEffect
{
private final double _power;
public CpHealPercent(StatsSet params)
{
_power = params.getDouble("power", 0);
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
if (effected.isDead() || effected.isDoor() || effected.isHpBlocked())
{
return;
}
double amount = 0;
final double power = _power;
final boolean full = (power == 100.0);
amount = full ? effected.getMaxCp() : (effected.getMaxCp() * power) / 100.0;
// Prevents overheal and negative amount
amount = Math.max(Math.min(amount, effected.getMaxRecoverableCp() - effected.getCurrentCp()), 0);
if (amount != 0)
{
final double newCp = amount + effected.getCurrentCp();
effected.setCurrentCp(newCp, false);
effected.broadcastStatusUpdate(effector);
}
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CP_HAS_BEEN_RESTORED);
sm.addInt((int) amount);
effected.sendPacket(sm);
}
}

View File

@@ -0,0 +1,31 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* @author Sdw
*/
public class CpRegen extends AbstractStatEffect
{
public CpRegen(StatsSet params)
{
super(params, Stats.REGENERATE_CP_RATE);
}
}

View File

@@ -0,0 +1,87 @@
/*
* 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 java.util.logging.Logger;
import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.holders.ItemChanceHolder;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.SystemMessageId;
/**
* @author UnAfraid
*/
public class CreateItemRandom extends AbstractEffect
{
private static final Logger LOGGER = Logger.getLogger(CreateItemRandom.class.getName());
public CreateItemRandom(StatsSet params)
{
}
@Override
public boolean isInstant()
{
return Boolean.TRUE;
}
@Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
final L2PcInstance player = effected.getActingPlayer();
if (player == null)
{
return;
}
else if (item == null)
{
LOGGER.warning("" + player + " Attempting to cast skill: " + skill + " without item defined!");
return;
}
else if (item.getItem().getCreateItems().isEmpty())
{
LOGGER.warning("" + player + " Attempting to cast skill: " + skill + " with item " + item + " without createItems defined!");
return;
}
ItemChanceHolder selectedItem = null;
final double random = Rnd.nextDouble() * 100;
double comulativeChance = 0;
for (ItemChanceHolder holder : item.getItem().getCreateItems())
{
if ((comulativeChance += holder.getChance()) >= random)
{
selectedItem = holder;
break;
}
}
if (selectedItem == null)
{
player.sendPacket(SystemMessageId.THERE_WAS_NOTHING_FOUND_INSIDE);
return;
}
player.addItem("CreateItems", selectedItem.getId(), selectedItem.getCount(), player, true);
}
}

View File

@@ -0,0 +1,31 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* @author Sdw
*/
public class CriticalDamage extends AbstractStatEffect
{
public CriticalDamage(StatsSet params)
{
super(params, Stats.CRITICAL_DAMAGE, Stats.CRITICAL_DAMAGE_ADD);
}
}

View File

@@ -1,55 +1,51 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
/**
* Give XP effect implementation.
* @author Mobius
*/
public final class GiveXp extends AbstractEffect
{
private final int _xp;
public GiveXp(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
_xp = params.getInt("xp", 0);
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void onStart(BuffInfo info)
{
if ((info.getEffector() == null) || (info.getEffected() == null) || !info.getEffector().isPlayer() || !info.getEffected().isPlayer() || info.getEffected().isAlikeDead())
{
return;
}
info.getEffector().getActingPlayer().addExpAndSp(_xp, 0);
}
}
/*
* 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 com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.enums.Position;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* @author Sdw
*/
public class CriticalDamagePosition extends AbstractEffect
{
protected final double _amount;
protected final Position _position;
public CriticalDamagePosition(StatsSet params)
{
_amount = params.getDouble("amount", 0);
_position = params.getEnum("position", Position.class, Position.FRONT);
}
@Override
public void onStart(BuffInfo info)
{
info.getEffected().getStat().mergePositionTypeValue(Stats.CRITICAL_DAMAGE, _position, (_amount / 100) + 1, MathUtil::mul);
}
@Override
public void onExit(BuffInfo info)
{
info.getEffected().getStat().mergePositionTypeValue(Stats.CRITICAL_DAMAGE, _position, (_amount / 100) + 1, MathUtil::div);
}
}

View File

@@ -0,0 +1,55 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* @author Sdw
*/
public class CriticalRate extends AbstractConditionalHpEffect
{
public CriticalRate(StatsSet params)
{
super(params, Stats.CRITICAL_RATE);
}
@Override
public void pump(L2Character effected, Skill skill)
{
if (_conditions.isEmpty() || _conditions.stream().allMatch(cond -> cond.test(effected, effected, skill)))
{
switch (_mode)
{
case DIFF:
{
effected.getStat().mergeAdd(_addStat, _amount);
break;
}
case PER:
{
effected.getStat().mergeMul(_mulStat, (_amount / 100));
break;
}
}
}
}
}

View File

@@ -0,0 +1,51 @@
/*
* 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 com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.enums.Position;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* @author Sdw
*/
public class CriticalRatePositionBonus extends AbstractEffect
{
protected final double _amount;
protected final Position _position;
public CriticalRatePositionBonus(StatsSet params)
{
_amount = params.getDouble("amount", 0);
_position = params.getEnum("position", Position.class, Position.FRONT);
}
@Override
public void onStart(BuffInfo info)
{
info.getEffected().getStat().mergePositionTypeValue(Stats.CRITICAL_RATE, _position, (_amount / 100) + 1, MathUtil::mul);
}
@Override
public void onExit(BuffInfo info)
{
info.getEffected().getStat().mergePositionTypeValue(Stats.CRITICAL_RATE, _position, (-_amount / 100) - 1, MathUtil::div);
}
}

View File

@@ -1,61 +1,60 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
/**
* Crystal Grade Modify effect implementation.
* @author Zoey76
*/
public final class CrystalGradeModify extends AbstractEffect
{
private final int _grade;
public CrystalGradeModify(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
_grade = params.getInt("grade", 0);
}
@Override
public boolean canStart(BuffInfo info)
{
return info.getEffected().isPlayer();
}
@Override
public void onExit(BuffInfo info)
{
final L2PcInstance player = info.getEffected().getActingPlayer();
if (player != null)
{
player.setExpertisePenaltyBonus(0);
}
}
@Override
public void onStart(BuffInfo info)
{
info.getEffected().getActingPlayer().setExpertisePenaltyBonus(_grade);
}
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* Crystal Grade Modify effect implementation.
* @author Zoey76
*/
public final class CrystalGradeModify extends AbstractEffect
{
private final int _grade;
public CrystalGradeModify(StatsSet params)
{
_grade = params.getInt("grade", 0);
}
@Override
public boolean canStart(BuffInfo info)
{
return info.getEffected().isPlayer();
}
@Override
public void onStart(L2Character effector, L2Character effected, Skill skill)
{
effected.getActingPlayer().setExpertisePenaltyBonus(_grade);
}
@Override
public void onExit(BuffInfo info)
{
final L2PcInstance player = info.getEffected().getActingPlayer();
if (player != null)
{
player.setExpertisePenaltyBonus(0);
}
}
}

View File

@@ -1,62 +1,31 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
/**
* Cubic Mastery effect implementation.
* @author Zoey76
*/
public final class CubicMastery extends AbstractEffect
{
private final int _cubicCount;
public CubicMastery(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
_cubicCount = params.getInt("cubicCount", 1);
}
@Override
public boolean canStart(BuffInfo info)
{
return (info.getEffector() != null) && (info.getEffected() != null) && info.getEffected().isPlayer();
}
@Override
public void onStart(BuffInfo info)
{
info.getEffected().getActingPlayer().getStat().setMaxCubicCount(_cubicCount);
}
@Override
public boolean onActionTime(BuffInfo info)
{
return info.getSkill().isPassive();
}
@Override
public void onExit(BuffInfo info)
{
info.getEffected().getActingPlayer().getStat().setMaxCubicCount(1);
}
}
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* @author Sdw
*/
public final class CubicMastery extends AbstractStatAddEffect
{
public CubicMastery(StatsSet params)
{
super(params, Stats.MAX_CUBIC);
}
}

View File

@@ -1,93 +1,100 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.network.SystemMessageId;
/**
* Dam Over Time effect implementation.
*/
public final class DamOverTime extends AbstractEffect
{
private final boolean _canKill;
private final double _power;
private final int _charge;
public DamOverTime(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
_canKill = params.getBoolean("canKill", false);
_power = params.getDouble("power", 0);
_charge = params.getInt("charge", 0);
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.DMG_OVER_TIME;
}
@Override
public boolean onActionTime(BuffInfo info)
{
if (info.getEffected().isDead())
{
return false;
}
double damage = _power * getTicksMultiplier();
if (damage >= (info.getEffected().getCurrentHp() - 1))
{
if (info.getSkill().isToggle())
{
info.getEffected().sendPacket(SystemMessageId.YOUR_SKILL_HAS_BEEN_CANCELED_DUE_TO_LACK_OF_HP);
return false;
}
// For DOT skills that will not kill effected player.
if (!_canKill)
{
// Fix for players dying by DOTs if HP < 1 since reduceCurrentHP method will kill them
if (info.getEffected().getCurrentHp() <= 1)
{
return info.getSkill().isToggle();
}
damage = info.getEffected().getCurrentHp() - 1;
}
}
if ((_charge != 0) && (info.getEffected().getActingPlayer().getCharges() >= _charge))
{
info.getEffected().sendPacket(SystemMessageId.YOUR_FORCE_HAS_REACHED_MAXIMUM_CAPACITY);
return false;
}
if (_charge != 0)
{
info.getEffected().getActingPlayer().increaseCharges(1, _charge);
}
info.getEffected().reduceCurrentHpByDOT(damage, info.getEffector(), info.getSkill());
info.getEffected().notifyDamageReceived(damage, info.getEffector(), info.getSkill(), false, true);
return info.getSkill().isToggle();
}
}
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.stats.Formulas;
import com.l2jmobius.gameserver.network.SystemMessageId;
/**
* Dam Over Time effect implementation.
*/
public final class DamOverTime extends AbstractEffect
{
private final boolean _canKill;
private final double _power;
public DamOverTime(StatsSet params)
{
_canKill = params.getBoolean("canKill", false);
_power = params.getDouble("power");
setTicks(params.getInt("ticks"));
}
@Override
public void onStart(BuffInfo info)
{
if (!info.getSkill().isToggle() && info.getSkill().isMagic())
{
// TODO: M.Crit can occur even if this skill is resisted. Only then m.crit damage is applied and not debuff
final boolean mcrit = Formulas.calcCrit(info.getSkill().getMagicCriticalRate(), info.getEffector(), info.getEffected(), info.getSkill());
if (mcrit)
{
double damage = _power * 10; // Tests show that 10 times HP DOT is taken during magic critical.
if (!_canKill && (damage >= (info.getEffected().getCurrentHp() - 1)))
{
damage = info.getEffected().getCurrentHp() - 1;
}
info.getEffected().reduceCurrentHp(damage, info.getEffector(), info.getSkill(), true, false, true, false);
}
}
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.DMG_OVER_TIME;
}
@Override
public boolean onActionTime(BuffInfo info)
{
if (info.getEffected().isDead())
{
return false;
}
double damage = _power * getTicksMultiplier();
if (damage >= (info.getEffected().getCurrentHp() - 1))
{
if (info.getSkill().isToggle())
{
info.getEffected().sendPacket(SystemMessageId.YOUR_SKILL_HAS_BEEN_CANCELED_DUE_TO_LACK_OF_HP);
return false;
}
// For DOT skills that will not kill effected player.
if (!_canKill)
{
// Fix for players dying by DOTs if HP < 1 since reduceCurrentHP method will kill them
if (info.getEffected().getCurrentHp() <= 1)
{
return info.getSkill().isToggle();
}
damage = info.getEffected().getCurrentHp() - 1;
}
}
info.getEffected().reduceCurrentHp(damage, info.getEffector(), info.getSkill(), true, false, false, false);
return info.getSkill().isToggle();
}
}

View File

@@ -1,83 +1,81 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.network.SystemMessageId;
/**
* Damage Over Time Percent effect implementation.
* @author Adry_85
*/
public final class DamOverTimePercent extends AbstractEffect
{
private final boolean _canKill;
private final double _power;
public DamOverTimePercent(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
_canKill = params.getBoolean("canKill", false);
_power = params.getDouble("power", 0);
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.DMG_OVER_TIME_PERCENT;
}
@Override
public boolean onActionTime(BuffInfo info)
{
if (info.getEffected().isDead())
{
return false;
}
double damage = info.getEffected().getCurrentHp() * _power * getTicksMultiplier();
if (damage >= (info.getEffected().getCurrentHp() - 1))
{
if (info.getSkill().isToggle())
{
info.getEffected().sendPacket(SystemMessageId.YOUR_SKILL_HAS_BEEN_CANCELED_DUE_TO_LACK_OF_HP);
return false;
}
// For DOT skills that will not kill effected player.
if (!_canKill)
{
// Fix for players dying by DOTs if HP < 1 since reduceCurrentHP method will kill them
if (info.getEffected().getCurrentHp() <= 1)
{
return info.getSkill().isToggle();
}
damage = info.getEffected().getCurrentHp() - 1;
}
}
info.getEffected().reduceCurrentHpByDOT(damage, info.getEffector(), info.getSkill());
info.getEffected().notifyDamageReceived(damage, info.getEffector(), info.getSkill(), false, true);
return info.getSkill().isToggle();
}
}
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.network.SystemMessageId;
/**
* Damage Over Time Percent effect implementation.
* @author Adry_85
*/
public final class DamOverTimePercent extends AbstractEffect
{
private final boolean _canKill;
private final double _power;
public DamOverTimePercent(StatsSet params)
{
_canKill = params.getBoolean("canKill", false);
_power = params.getDouble("power");
setTicks(params.getInt("ticks"));
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.DMG_OVER_TIME_PERCENT;
}
@Override
public boolean onActionTime(BuffInfo info)
{
if (info.getEffected().isDead())
{
return false;
}
double damage = info.getEffected().getCurrentHp() * _power * getTicksMultiplier();
if (damage >= (info.getEffected().getCurrentHp() - 1))
{
if (info.getSkill().isToggle())
{
info.getEffected().sendPacket(SystemMessageId.YOUR_SKILL_HAS_BEEN_CANCELED_DUE_TO_LACK_OF_HP);
return false;
}
// For DOT skills that will not kill effected player.
if (!_canKill)
{
// Fix for players dying by DOTs if HP < 1 since reduceCurrentHP method will kill them
if (info.getEffected().getCurrentHp() <= 1)
{
return info.getSkill().isToggle();
}
damage = info.getEffected().getCurrentHp() - 1;
}
}
info.getEffected().reduceCurrentHp(damage, info.getEffector(), info.getSkill(), true, false, false, false);
return info.getSkill().isToggle();
}
}

View File

@@ -0,0 +1,45 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.EffectFlag;
/**
* Effect that blocks damage and heals to HP/MP. <BR>
* Regeneration or DOT shouldn't be blocked, Vampiric Rage and Balance Life as well.
* @author Nik
*/
public final class DamageBlock extends AbstractEffect
{
private final boolean _blockHp;
private final boolean _blockMp;
public DamageBlock(StatsSet params)
{
final String type = params.getString("type", null);
_blockHp = type.equalsIgnoreCase("BLOCK_HP");
_blockMp = type.equalsIgnoreCase("BLOCK_MP");
}
@Override
public long getEffectFlags()
{
return _blockHp ? EffectFlag.HP_BLOCK.getMask() : (_blockMp ? EffectFlag.MP_BLOCK.getMask() : EffectFlag.NONE.getMask());
}
}

View File

@@ -0,0 +1,31 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* @author Sdw
*/
public class DamageShield extends AbstractStatAddEffect
{
public DamageShield(StatsSet params)
{
super(params, Stats.REFLECT_DAMAGE_PERCENT);
}
}

View File

@@ -0,0 +1,31 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* @author Sdw
*/
public class DamageShieldResist extends AbstractStatAddEffect
{
public DamageShieldResist(StatsSet params)
{
super(params, Stats.REFLECT_DAMAGE_PERCENT_DEFENSE);
}
}

View File

@@ -1,104 +1,95 @@
/*
* 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 com.l2jmobius.gameserver.enums.ShotType;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.stats.Formulas;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.util.Rnd;
/**
* Death Link effect implementation.
* @author Adry_85
*/
public final class DeathLink extends AbstractEffect
{
public DeathLink(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.DEATH_LINK;
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void onStart(BuffInfo info)
{
final L2Character target = info.getEffected();
final L2Character activeChar = info.getEffector();
if (activeChar.isAlikeDead())
{
return;
}
final boolean sps = info.getSkill().useSpiritShot() && activeChar.isChargedShot(ShotType.SPIRITSHOTS);
final boolean bss = info.getSkill().useSpiritShot() && activeChar.isChargedShot(ShotType.BLESSED_SPIRITSHOTS);
if (target.isPlayer() && target.getActingPlayer().isFakeDeath())
{
target.stopFakeDeath(true);
}
final boolean mcrit = Formulas.calcMCrit(activeChar.getMCriticalHit(target, info.getSkill()));
final byte shld = Formulas.calcShldUse(activeChar, target, info.getSkill());
final int damage = (int) Formulas.calcMagicDam(activeChar, target, info.getSkill(), shld, sps, bss, mcrit);
if (damage > 0)
{
// Manage attack or cast break of the target (calculating rate, sending message...)
if (!target.isRaid() && Formulas.calcAtkBreak(target, damage))
{
target.breakAttack();
target.breakCast();
}
// Shield Deflect Magic: Reflect all damage on caster.
if (target.getStat().calcStat(Stats.VENGEANCE_SKILL_MAGIC_DAMAGE, 0, target, info.getSkill()) > Rnd.get(100))
{
activeChar.reduceCurrentHp(damage, target, info.getSkill());
activeChar.notifyDamageReceived(damage, target, info.getSkill(), mcrit, false);
}
else
{
target.reduceCurrentHp(damage, activeChar, info.getSkill());
target.notifyDamageReceived(damage, activeChar, info.getSkill(), mcrit, false);
activeChar.sendDamageMessage(target, damage, mcrit, false, false);
}
}
if (info.getSkill().isSuicideAttack())
{
activeChar.doDie(activeChar);
}
}
/*
* 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 com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.enums.ShotType;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Formulas;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* Death Link effect implementation.
* @author Adry_85
*/
public final class DeathLink extends AbstractEffect
{
private final double _power;
public DeathLink(StatsSet params)
{
_power = params.getDouble("power", 0);
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.DEATH_LINK;
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
if (effector.isAlikeDead())
{
return;
}
final boolean sps = skill.useSpiritShot() && effector.isChargedShot(ShotType.SPIRITSHOTS);
final boolean bss = skill.useSpiritShot() && effector.isChargedShot(ShotType.BLESSED_SPIRITSHOTS);
if (effected.isPlayer() && effected.getActingPlayer().isFakeDeath())
{
effected.stopFakeDeath(true);
}
final boolean mcrit = Formulas.calcCrit(skill.getMagicCriticalRate(), effector, effected, skill);
final double damage = Formulas.calcMagicDam(effector, effected, skill, effector.getMAtk(), _power * (-((effector.getCurrentHp() * 2) / effector.getMaxHp()) + 2), effected.getMDef(), sps, bss, mcrit);
if (damage > 0)
{
// Manage attack or cast break of the target (calculating rate, sending message...)
if (!effected.isRaid() && Formulas.calcAtkBreak(effected, damage))
{
effected.breakAttack();
effected.breakCast();
}
// Shield Deflect Magic: Reflect all damage on caster.
if (effected.getStat().getValue(Stats.VENGEANCE_SKILL_MAGIC_DAMAGE, 0) > Rnd.get(100))
{
effector.reduceCurrentHp(damage, effected, skill, false, false, mcrit, true);
}
else
{
effected.reduceCurrentHp(damage, effector, skill, false, false, mcrit, false);
effector.sendDamageMessage(effected, skill, (int) damage, mcrit, false);
}
}
}
}

View File

@@ -0,0 +1,38 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.EffectFlag;
/**
* Effect that blocks all incoming debuffs.
* @author Nik
*/
public final class DebuffBlock extends AbstractEffect
{
public DebuffBlock(StatsSet params)
{
}
@Override
public long getEffectFlags()
{
return EffectFlag.DEBUFF_BLOCK.getMask();
}
}

View File

@@ -0,0 +1,75 @@
/*
* 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 com.l2jmobius.gameserver.enums.AttributeType;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* @author Sdw
*/
public class DefenceAttribute extends AbstractEffect
{
private final AttributeType _attribute;
private final double _amount;
public DefenceAttribute(StatsSet params)
{
_amount = params.getDouble("amount", 0);
_attribute = params.getEnum("attribute", AttributeType.class, AttributeType.FIRE);
}
@Override
public void pump(L2Character effected, Skill skill)
{
Stats stat = Stats.FIRE_RES;
switch (_attribute)
{
case WATER:
{
stat = Stats.WATER_RES;
break;
}
case WIND:
{
stat = Stats.WIND_RES;
break;
}
case EARTH:
{
stat = Stats.EARTH_RES;
break;
}
case HOLY:
{
stat = Stats.HOLY_RES;
break;
}
case DARK:
{
stat = Stats.DARK_RES;
break;
}
}
effected.getStat().mergeAdd(stat, _amount);
}
}

View File

@@ -0,0 +1,31 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* @author Sdw
*/
public class DefenceCriticalDamage extends AbstractStatEffect
{
public DefenceCriticalDamage(StatsSet params)
{
super(params, Stats.DEFENCE_CRITICAL_DAMAGE, Stats.DEFENCE_CRITICAL_DAMAGE_ADD);
}
}

View File

@@ -0,0 +1,31 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* @author Sdw
*/
public class DefenceCriticalRate extends AbstractStatEffect
{
public DefenceCriticalRate(StatsSet params)
{
super(params, Stats.DEFENCE_CRITICAL_RATE, Stats.DEFENCE_CRITICAL_RATE_ADD);
}
}

View File

@@ -0,0 +1,31 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* @author Sdw
*/
public class DefenceMagicCriticalDamage extends AbstractStatEffect
{
public DefenceMagicCriticalDamage(StatsSet params)
{
super(params, Stats.DEFENCE_MAGIC_CRITICAL_DAMAGE);
}
}

View File

@@ -0,0 +1,31 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* @author Sdw
*/
public class DefenceMagicCriticalRate extends AbstractStatEffect
{
public DefenceMagicCriticalRate(StatsSet params)
{
super(params, Stats.DEFENCE_MAGIC_CRITICAL_RATE, Stats.DEFENCE_MAGIC_CRITICAL_RATE_ADD);
}
}

View File

@@ -1,112 +1,109 @@
/*
* 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 java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.stat.CharStat;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.stats.TraitType;
/**
* Defence Trait effect implementation.
* @author NosBit
*/
public final class DefenceTrait extends AbstractEffect
{
private final Map<TraitType, Float> _defenceTraits = new HashMap<>();
public DefenceTrait(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
if (params.isEmpty())
{
_log.warning(getClass().getSimpleName() + ": must have parameters.");
return;
}
for (Entry<String, Object> param : params.getSet().entrySet())
{
try
{
final TraitType traitType = TraitType.valueOf(param.getKey());
final float value = Float.parseFloat((String) param.getValue());
if (value == 0)
{
continue;
}
_defenceTraits.put(traitType, (value + 100) / 100);
}
catch (NumberFormatException e)
{
_log.warning(getClass().getSimpleName() + ": value of " + param.getKey() + " must be float value " + param.getValue() + " found.");
}
catch (Exception e)
{
_log.warning(getClass().getSimpleName() + ": value of L2TraitType enum required but found: " + param.getValue());
}
}
}
@Override
public void onExit(BuffInfo info)
{
final CharStat charStat = info.getEffected().getStat();
synchronized (charStat.getDefenceTraits())
{
for (Entry<TraitType, Float> trait : _defenceTraits.entrySet())
{
if (trait.getValue() < 2.0f)
{
charStat.getDefenceTraits()[trait.getKey().getId()] /= trait.getValue();
charStat.getDefenceTraitsCount()[trait.getKey().getId()]--;
}
else
{
charStat.getTraitsInvul()[trait.getKey().getId()]--;
}
}
}
}
@Override
public void onStart(BuffInfo info)
{
final CharStat charStat = info.getEffected().getStat();
synchronized (charStat.getDefenceTraits())
{
for (Entry<TraitType, Float> trait : _defenceTraits.entrySet())
{
if (trait.getValue() < 2.0f)
{
charStat.getDefenceTraits()[trait.getKey().getId()] *= trait.getValue();
charStat.getDefenceTraitsCount()[trait.getKey().getId()]++;
}
else
{
charStat.getTraitsInvul()[trait.getKey().getId()]++;
}
}
}
}
}
/*
* 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 java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.stat.CharStat;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.stats.TraitType;
/**
* Defence Trait effect implementation.
* @author NosBit
*/
public final class DefenceTrait extends AbstractEffect
{
private final Map<TraitType, Float> _defenceTraits = new HashMap<>();
public DefenceTrait(StatsSet params)
{
if (params.isEmpty())
{
_log.warning(getClass().getSimpleName() + ": must have parameters.");
return;
}
for (Entry<String, Object> param : params.getSet().entrySet())
{
try
{
final TraitType traitType = TraitType.valueOf(param.getKey());
final float value = Float.parseFloat((String) param.getValue());
if (value == 0)
{
continue;
}
_defenceTraits.put(traitType, (value + 100) / 100);
}
catch (NumberFormatException e)
{
_log.warning(getClass().getSimpleName() + ": value of " + param.getKey() + " must be float value " + param.getValue() + " found.");
}
catch (Exception e)
{
_log.warning(getClass().getSimpleName() + ": value of L2TraitType enum required but found: " + param.getKey());
}
}
}
@Override
public void onExit(BuffInfo info)
{
final CharStat charStat = info.getEffected().getStat();
synchronized (charStat.getDefenceTraits())
{
for (Entry<TraitType, Float> trait : _defenceTraits.entrySet())
{
if (trait.getValue() < 2.0f)
{
charStat.getDefenceTraits()[trait.getKey().getId()] /= trait.getValue();
charStat.getDefenceTraitsCount()[trait.getKey().getId()]--;
}
else
{
charStat.getTraitsInvul()[trait.getKey().getId()]--;
}
}
}
}
@Override
public void onStart(BuffInfo info)
{
final CharStat charStat = info.getEffected().getStat();
synchronized (charStat.getDefenceTraits())
{
for (Entry<TraitType, Float> trait : _defenceTraits.entrySet())
{
if (trait.getValue() < 2.0f)
{
charStat.getDefenceTraits()[trait.getKey().getId()] *= trait.getValue();
charStat.getDefenceTraitsCount()[trait.getKey().getId()]++;
}
else
{
charStat.getTraitsInvul()[trait.getKey().getId()]++;
}
}
}
}
}

View File

@@ -1,74 +1,73 @@
/*
* 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 com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Attackable;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.stats.Formulas;
/**
* Delete Hate effect implementation.
* @author Adry_85
*/
public final class DeleteHate extends AbstractEffect
{
private final int _chance;
public DeleteHate(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
_chance = params.getInt("chance", 100);
}
@Override
public boolean calcSuccess(BuffInfo info)
{
return Formulas.calcProbability(_chance, info.getEffector(), info.getEffected(), info.getSkill());
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.HATE;
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void onStart(BuffInfo info)
{
if (!info.getEffected().isAttackable())
{
return;
}
final L2Attackable target = (L2Attackable) info.getEffected();
target.clearAggroList();
target.setWalking();
target.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
}
}
/*
* 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 com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Attackable;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Formulas;
/**
* Delete Hate effect implementation.
* @author Adry_85
*/
public final class DeleteHate extends AbstractEffect
{
private final int _chance;
public DeleteHate(StatsSet params)
{
_chance = params.getInt("chance", 100);
}
@Override
public boolean calcSuccess(L2Character effector, L2Character effected, Skill skill)
{
return Formulas.calcProbability(_chance, effector, effected, skill);
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.HATE;
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
if (!effected.isAttackable())
{
return;
}
final L2Attackable target = (L2Attackable) effected;
target.clearAggroList();
target.setWalking();
target.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
}
}

View File

@@ -1,74 +1,73 @@
/*
* 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 com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Attackable;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.stats.Formulas;
/**
* Delete Hate Of Me effect implementation.
* @author Adry_85
*/
public final class DeleteHateOfMe extends AbstractEffect
{
private final int _chance;
public DeleteHateOfMe(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
_chance = params.getInt("chance", 100);
}
@Override
public boolean calcSuccess(BuffInfo info)
{
return Formulas.calcProbability(_chance, info.getEffector(), info.getEffected(), info.getSkill());
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.HATE;
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void onStart(BuffInfo info)
{
if (!info.getEffected().isAttackable())
{
return;
}
final L2Attackable target = (L2Attackable) info.getEffected();
target.stopHating(info.getEffector());
target.setWalking();
target.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
}
}
/*
* 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 com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Attackable;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Formulas;
/**
* Delete Hate Of Me effect implementation.
* @author Adry_85
*/
public final class DeleteHateOfMe extends AbstractEffect
{
private final int _chance;
public DeleteHateOfMe(StatsSet params)
{
_chance = params.getInt("chance", 100);
}
@Override
public boolean calcSuccess(L2Character effector, L2Character effected, Skill skill)
{
return Formulas.calcProbability(_chance, effector, effected, skill);
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.HATE;
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
if (!effected.isAttackable())
{
return;
}
final L2Attackable target = (L2Attackable) effected;
target.stopHating(effector);
target.setWalking();
target.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
}
}

View File

@@ -1,65 +1,72 @@
/*
* 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 com.l2jmobius.gameserver.ai.CtrlEvent;
import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.EffectFlag;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
/**
* Paralyze effect implementation.
*/
public final class Paralyze extends AbstractEffect
{
public Paralyze(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
}
@Override
public int getEffectFlags()
{
return EffectFlag.PARALYZED.getMask();
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.PARALYZE;
}
@Override
public void onExit(BuffInfo info)
{
if (!info.getEffected().isPlayer())
{
info.getEffected().getAI().notifyEvent(CtrlEvent.EVT_THINK);
}
}
@Override
public void onStart(BuffInfo info)
{
info.getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, info.getEffector());
info.getEffected().startParalyze();
}
}
/*
* 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 com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Attackable;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Formulas;
/**
* @author Sdw
*/
public class DeleteTopAgro extends AbstractEffect
{
private final int _chance;
public DeleteTopAgro(StatsSet params)
{
_chance = params.getInt("chance", 100);
}
@Override
public boolean calcSuccess(L2Character effector, L2Character effected, Skill skill)
{
return Formulas.calcProbability(_chance, effector, effected, skill);
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.HATE;
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
if (!effected.isAttackable())
{
return;
}
final L2Attackable target = (L2Attackable) effected;
target.stopHating(target.getMostHated());
target.setWalking();
target.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
}
}

View File

@@ -1,58 +1,59 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.instance.L2DoorInstance;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
/**
* Detect Hidden Objects effect implementation.
* @author UnAfraid
*/
public final class DetectHiddenObjects extends AbstractEffect
{
public DetectHiddenObjects(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void onStart(BuffInfo info)
{
if (!info.getEffected().isDoor())
{
return;
}
final L2DoorInstance door = (L2DoorInstance) info.getEffected();
if (door.getTemplate().isStealth())
{
door.setMeshIndex(1);
door.setTargetable(door.getTemplate().getOpenType() != 0);
door.broadcastStatusUpdate();
}
}
}
/*
* 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 com.l2jmobius.gameserver.enums.DoorOpenType;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2DoorInstance;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* Detect Hidden Objects effect implementation.
* @author UnAfraid
*/
public final class DetectHiddenObjects extends AbstractEffect
{
public DetectHiddenObjects(StatsSet params)
{
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
if (!effected.isDoor())
{
return;
}
final L2DoorInstance door = (L2DoorInstance) effected;
if (door.getTemplate().isStealth())
{
door.setMeshIndex(1);
door.setTargetable(door.getTemplate().getOpenType() != DoorOpenType.NONE);
door.broadcastStatusUpdate();
}
}
}

View File

@@ -1,59 +1,76 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.AbnormalType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
/**
* Detection effect implementation.
* @author UnAfraid
*/
public final class Detection extends AbstractEffect
{
public Detection(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void onStart(BuffInfo info)
{
if (!info.getEffector().isPlayer() || !info.getEffected().isPlayer())
{
return;
}
final L2PcInstance player = info.getEffector().getActingPlayer();
final L2PcInstance target = info.getEffected().getActingPlayer();
if (!target.isInvisible() || player.isInPartyWith(target) || player.isInClanWith(target) || player.isInAllyWith(target))
{
return;
}
// Remove Hide.
target.getEffectList().stopSkillEffects(true, AbnormalType.HIDE);
}
}
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.AbnormalType;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* Detection effect implementation.
* @author UnAfraid
*/
public final class Detection extends AbstractEffect
{
public Detection(StatsSet params)
{
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
if (!effector.isPlayer() || !effected.isPlayer())
{
return;
}
final L2PcInstance player = effector.getActingPlayer();
final L2PcInstance target = effected.getActingPlayer();
final boolean hasParty = player.isInParty();
final boolean hasClan = player.getClanId() > 0;
final boolean hasAlly = player.getAllyId() > 0;
if (target.isInvisible())
{
if (hasParty && (target.isInParty()) && (player.getParty().getLeaderObjectId() == target.getParty().getLeaderObjectId()))
{
return;
}
else if (hasClan && (player.getClanId() == target.getClanId()))
{
return;
}
else if (hasAlly && (player.getAllyId() == target.getAllyId()))
{
return;
}
// Remove Hide.
target.getEffectList().stopSkillEffects(true, AbnormalType.HIDE);
}
}
}

View File

@@ -1,49 +1,50 @@
/*
* 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 com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
public class RemoveTarget extends AbstractEffect
{
public RemoveTarget(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.REMOVE_TARGET;
}
@Override
public void onStart(BuffInfo info)
{
final L2Character effected = info.getEffected();
effected.setTarget(null);
effected.abortAttack();
effected.abortCast();
effected.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, info.getEffector());
}
}
/*
* 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 com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.EffectFlag;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* Targeting disable effect implementation. When affected, player will lose target and be unable to target for the duration.
* @author Nik
*/
public final class DisableTargeting extends AbstractEffect
{
public DisableTargeting(StatsSet params)
{
}
@Override
public void onStart(L2Character effector, L2Character effected, Skill skill)
{
effected.setTarget(null);
effected.abortAttack();
effected.abortCast();
effected.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
}
@Override
public long getEffectFlags()
{
return EffectFlag.TARGETING_DISABLED.getMask();
}
}

View File

@@ -1,53 +1,59 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.EffectFlag;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
/**
* Disarm effect implementation.
* @author nBd
*/
public final class Disarm extends AbstractEffect
{
public Disarm(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
}
@Override
public boolean canStart(BuffInfo info)
{
return info.getEffected().isPlayer();
}
@Override
public int getEffectFlags()
{
return EffectFlag.DISARMED.getMask();
}
@Override
public void onStart(BuffInfo info)
{
info.getEffected().getActingPlayer().disarmWeapons();
}
}
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.EffectFlag;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* Disarm effect implementation.
* @author nBd
*/
public final class Disarm extends AbstractEffect
{
public Disarm(StatsSet params)
{
}
@Override
public boolean canStart(BuffInfo info)
{
return info.getEffected().isPlayer();
}
@Override
public long getEffectFlags()
{
return EffectFlag.DISARMED.getMask();
}
@Override
public void continuousInstant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
final L2PcInstance player = effected.getActingPlayer();
if (player != null)
{
player.disarmWeapons();
}
}
}

View File

@@ -0,0 +1,142 @@
/*
* 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 java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import com.l2jmobius.gameserver.datatables.ItemTable;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.InventoryUpdate;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
/**
* Disarm by inventory slot effect implementation. At end of effect, it re-equips that item.
* @author Nik
*/
public final class Disarmor extends AbstractEffect
{
private final Map<Integer, Integer> _unequippedItems; // PlayerObjId, ItemObjId
private final int _slot;
public Disarmor(StatsSet params)
{
_unequippedItems = new ConcurrentHashMap<>();
final String slot = params.getString("slot", "chest");
_slot = ItemTable._slots.getOrDefault(slot, L2Item.SLOT_NONE);
if (_slot == L2Item.SLOT_NONE)
{
_log.severe("Unknown bodypart slot for effect: " + slot);
}
}
@Override
public boolean canStart(BuffInfo info)
{
return (_slot != L2Item.SLOT_NONE) && info.getEffected().isPlayer();
}
@Override
public void continuousInstant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
if (!effected.isPlayer())
{
return;
}
final L2PcInstance player = effected.getActingPlayer();
final L2ItemInstance[] unequiped = player.getInventory().unEquipItemInBodySlotAndRecord(_slot);
if (unequiped.length > 0)
{
final InventoryUpdate iu = new InventoryUpdate();
for (L2ItemInstance itm : unequiped)
{
iu.addModifiedItem(itm);
}
player.sendInventoryUpdate(iu);
player.broadcastUserInfo();
SystemMessage sm = null;
if (unequiped[0].getEnchantLevel() > 0)
{
sm = SystemMessage.getSystemMessage(SystemMessageId.THE_EQUIPMENT_S1_S2_HAS_BEEN_REMOVED);
sm.addInt(unequiped[0].getEnchantLevel());
sm.addItemName(unequiped[0]);
}
else
{
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_HAS_BEEN_UNEQUIPPED);
sm.addItemName(unequiped[0]);
}
player.sendPacket(sm);
effected.getInventory().blockItemSlot(_slot);
_unequippedItems.put(effected.getObjectId(), unequiped[0].getObjectId());
}
}
@Override
public void onExit(BuffInfo info)
{
if (!info.getEffected().isPlayer())
{
return;
}
final Integer disarmedObjId = _unequippedItems.remove(info.getEffected().getObjectId());
if ((disarmedObjId != null) && (disarmedObjId > 0))
{
final L2PcInstance player = info.getEffected().getActingPlayer();
info.getEffected().getInventory().unblockItemSlot(_slot);
final L2ItemInstance item = player.getInventory().getItemByObjectId(disarmedObjId);
if (item != null)
{
player.getInventory().equipItem(item);
final InventoryUpdate iu = new InventoryUpdate();
iu.addModifiedItem(item);
player.sendInventoryUpdate(iu);
SystemMessage sm = null;
if (item.isEquipped())
{
if (item.getEnchantLevel() > 0)
{
sm = SystemMessage.getSystemMessage(SystemMessageId.EQUIPPED_S1_S2);
sm.addInt(item.getEnchantLevel());
sm.addItemName(item);
}
else
{
sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_EQUIPPED_YOUR_S1);
sm.addItemName(item);
}
player.sendPacket(sm);
}
}
}
super.onExit(info);
}
}

View File

@@ -1,53 +1,53 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
/**
* Dispel All effect implementation.
* @author UnAfraid
*/
public final class DispelAll extends AbstractEffect
{
public DispelAll(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.DISPEL;
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void onStart(BuffInfo info)
{
info.getEffected().stopAllEffects();
}
}
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* Dispel All effect implementation.
* @author UnAfraid
*/
public final class DispelAll extends AbstractEffect
{
public DispelAll(StatsSet params)
{
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.DISPEL;
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
effected.stopAllEffects();
}
}

View File

@@ -1,70 +1,74 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.stats.Formulas;
/**
* Dispel By Category effect implementation.
* @author DS, Adry_85
*/
public final class DispelByCategory extends AbstractEffect
{
private final String _slot;
private final int _rate;
private final int _max;
public DispelByCategory(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
_slot = params.getString("slot", null);
_rate = params.getInt("rate", 0);
_max = params.getInt("max", 0);
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.DISPEL;
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void onStart(BuffInfo info)
{
if (info.getEffected().isDead())
{
return;
}
for (BuffInfo can : Formulas.calcCancelStealEffects(info.getEffector(), info.getEffected(), info.getSkill(), _slot, _rate, _max))
{
info.getEffected().getEffectList().stopSkillEffects(true, can.getSkill());
}
}
/*
* 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 java.util.List;
import com.l2jmobius.gameserver.enums.DispelSlotType;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Formulas;
/**
* Dispel By Category effect implementation.
* @author DS, Adry_85
*/
public final class DispelByCategory extends AbstractEffect
{
private final DispelSlotType _slot;
private final int _rate;
private final int _max;
public DispelByCategory(StatsSet params)
{
_slot = params.getEnum("slot", DispelSlotType.class, DispelSlotType.BUFF);
_rate = params.getInt("rate", 0);
_max = params.getInt("max", 0);
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.DISPEL;
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
if (effected.isDead())
{
return;
}
final List<BuffInfo> canceled = Formulas.calcCancelStealEffects(effector, effected, skill, _slot, _rate, _max);
for (BuffInfo can : canceled)
{
effected.getEffectList().stopSkillEffects(true, can.getSkill());
}
}
}

View File

@@ -1,108 +1,109 @@
/*
* 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 java.util.Collections;
import java.util.EnumMap;
import java.util.Map;
import java.util.Map.Entry;
import com.l2jmobius.gameserver.model.CharEffectList;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.skills.AbnormalType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
/**
* Dispel By Slot effect implementation.
* @author Gnacik, Zoey76, Adry_85
*/
public final class DispelBySlot extends AbstractEffect
{
private final String _dispel;
private final Map<AbnormalType, Short> _dispelAbnormals;
public DispelBySlot(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
_dispel = params.getString("dispel", null);
if ((_dispel != null) && !_dispel.isEmpty())
{
_dispelAbnormals = new EnumMap<>(AbnormalType.class);
for (String ngtStack : _dispel.split(";"))
{
final String[] ngt = ngtStack.split(",");
_dispelAbnormals.put(AbnormalType.getAbnormalType(ngt[0]), Short.parseShort(ngt[1]));
}
}
else
{
_dispelAbnormals = Collections.<AbnormalType, Short> emptyMap();
}
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.DISPEL_BY_SLOT;
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void onStart(BuffInfo info)
{
if (_dispelAbnormals.isEmpty())
{
return;
}
final L2Character effected = info.getEffected();
final CharEffectList effectList = effected.getEffectList();
// There is no need to iterate over all buffs,
// Just iterate once over all slots to dispel and get the buff with that abnormal if exists,
// Operation of O(n) for the amount of slots to dispel (which is usually small) and O(1) to get the buff.
for (Entry<AbnormalType, Short> entry : _dispelAbnormals.entrySet())
{
// Dispel transformations (buff and by GM)
if ((entry.getKey() == AbnormalType.TRANSFORM) && (effected.isTransformed() || effected.isPlayer() || (entry.getValue() == effected.getActingPlayer().getTransformationId()) || (entry.getValue() < 0)))
{
info.getEffected().stopTransformation(true);
continue;
}
final BuffInfo toDispel = effectList.getBuffInfoByAbnormalType(entry.getKey());
if (toDispel == null)
{
continue;
}
if ((entry.getKey() == toDispel.getSkill().getAbnormalType()) && ((entry.getValue() < 0) || (entry.getValue() >= toDispel.getSkill().getAbnormalLvl())))
{
effectList.stopSkillEffects(true, entry.getKey());
}
}
}
}
/*
* 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 java.util.Collections;
import java.util.EnumMap;
import java.util.Map;
import java.util.Map.Entry;
import com.l2jmobius.gameserver.model.CharEffectList;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.AbnormalType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* Dispel By Slot effect implementation.
* @author Gnacik, Zoey76, Adry_85
*/
public final class DispelBySlot extends AbstractEffect
{
private final String _dispel;
private final Map<AbnormalType, Short> _dispelAbnormals;
public DispelBySlot(StatsSet params)
{
_dispel = params.getString("dispel", null);
if ((_dispel != null) && !_dispel.isEmpty())
{
_dispelAbnormals = new EnumMap<>(AbnormalType.class);
for (String ngtStack : _dispel.split(";"))
{
final String[] ngt = ngtStack.split(",");
_dispelAbnormals.put(AbnormalType.getAbnormalType(ngt[0]), Short.parseShort(ngt[1]));
}
}
else
{
_dispelAbnormals = Collections.<AbnormalType, Short> emptyMap();
}
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.DISPEL_BY_SLOT;
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
if (_dispelAbnormals.isEmpty())
{
return;
}
final CharEffectList effectList = effected.getEffectList();
// There is no need to iterate over all buffs,
// Just iterate once over all slots to dispel and get the buff with that abnormal if exists,
// Operation of O(n) for the amount of slots to dispel (which is usually small) and O(1) to get the buff.
for (Entry<AbnormalType, Short> entry : _dispelAbnormals.entrySet())
{
// Dispel transformations (buff and by GM)
if ((entry.getKey() == AbnormalType.TRANSFORM))
{
if ((entry.getValue() == effected.getTransformationId()) || (entry.getValue() < 0))
{
effected.stopTransformation(true);
continue;
}
}
final BuffInfo toDispel = effectList.getBuffInfoByAbnormalType(entry.getKey());
if (toDispel == null)
{
continue;
}
if ((entry.getKey() == toDispel.getSkill().getAbnormalType()) && ((entry.getValue() < 0) || (entry.getValue() >= toDispel.getSkill().getAbnormalLvl())))
{
effectList.stopSkillEffects(true, entry.getKey());
}
}
}
}

View File

@@ -0,0 +1,87 @@
/*
* 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 java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import com.l2jmobius.gameserver.model.CharEffectList;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.AbnormalType;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* Dispel By Slot effect implementation.
* @author Gnacik, Zoey76, Adry_85
*/
public final class DispelBySlotMyself extends AbstractEffect
{
private final Set<AbnormalType> _dispelAbnormals;
public DispelBySlotMyself(StatsSet params)
{
final String dispel = params.getString("dispel", null);
if ((dispel != null) && !dispel.isEmpty())
{
_dispelAbnormals = new HashSet<>();
for (String slot : dispel.split(";"))
{
_dispelAbnormals.add(AbnormalType.getAbnormalType(slot));
}
}
else
{
_dispelAbnormals = Collections.<AbnormalType> emptySet();
}
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.DISPEL_BY_SLOT;
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
if (_dispelAbnormals.isEmpty())
{
return;
}
final CharEffectList effectList = effected.getEffectList();
// There is no need to iterate over all buffs,
// Just iterate once over all slots to dispel and get the buff with that abnormal if exists,
// Operation of O(n) for the amount of slots to dispel (which is usually small) and O(1) to get the buff.
for (AbnormalType entry : _dispelAbnormals)
{
// The effectlist should already check if it has buff with this abnormal type or not.
effectList.stopSkillEffects(true, entry);
}
}
}

View File

@@ -1,113 +1,114 @@
/*
* 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 java.util.Collections;
import java.util.EnumMap;
import java.util.Map;
import java.util.Map.Entry;
import com.l2jmobius.gameserver.model.CharEffectList;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.skills.AbnormalType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.util.Rnd;
/**
* Dispel By Slot Probability effect implementation.
* @author Adry_85, Zoey76
*/
public final class DispelBySlotProbability extends AbstractEffect
{
private final String _dispel;
private final Map<AbnormalType, Short> _dispelAbnormals;
private final int _rate;
public DispelBySlotProbability(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
_dispel = params.getString("dispel", null);
_rate = params.getInt("rate", 0);
if ((_dispel != null) && !_dispel.isEmpty())
{
_dispelAbnormals = new EnumMap<>(AbnormalType.class);
for (String ngtStack : _dispel.split(";"))
{
final String[] ngt = ngtStack.split(",");
_dispelAbnormals.put(AbnormalType.getAbnormalType(ngt[0]), (ngt.length > 1) ? Short.parseShort(ngt[1]) : Short.MAX_VALUE);
}
}
else
{
_dispelAbnormals = Collections.<AbnormalType, Short> emptyMap();
}
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.DISPEL;
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void onStart(BuffInfo info)
{
if (_dispelAbnormals.isEmpty())
{
return;
}
final L2Character effected = info.getEffected();
final CharEffectList effectList = effected.getEffectList();
// There is no need to iterate over all buffs,
// Just iterate once over all slots to dispel and get the buff with that abnormal if exists,
// Operation of O(n) for the amount of slots to dispel (which is usually small) and O(1) to get the buff.
for (Entry<AbnormalType, Short> entry : _dispelAbnormals.entrySet())
{
if (Rnd.get(100) < _rate)
{
// Dispel transformations (buff and by GM)
if ((entry.getKey() == AbnormalType.TRANSFORM) && (effected.isTransformed() || effected.isPlayer() || (entry.getValue() == effected.getActingPlayer().getTransformationId()) || (entry.getValue() < 0)))
{
info.getEffected().stopTransformation(true);
}
final BuffInfo toDispel = effectList.getBuffInfoByAbnormalType(entry.getKey());
if (toDispel == null)
{
continue;
}
if ((toDispel.getSkill().getAbnormalType() == entry.getKey()) && (entry.getValue() >= toDispel.getSkill().getAbnormalLvl()))
{
effectList.stopSkillEffects(true, entry.getKey());
}
}
}
}
}
/*
* 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 java.util.Collections;
import java.util.EnumMap;
import java.util.Map;
import java.util.Map.Entry;
import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.model.CharEffectList;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.AbnormalType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* Dispel By Slot Probability effect implementation.
* @author Adry_85, Zoey76
*/
public final class DispelBySlotProbability extends AbstractEffect
{
private final String _dispel;
private final Map<AbnormalType, Short> _dispelAbnormals;
private final int _rate;
public DispelBySlotProbability(StatsSet params)
{
_dispel = params.getString("dispel", null);
_rate = params.getInt("rate", 100);
if ((_dispel != null) && !_dispel.isEmpty())
{
_dispelAbnormals = new EnumMap<>(AbnormalType.class);
for (String ngtStack : _dispel.split(";"))
{
final String[] ngt = ngtStack.split(",");
_dispelAbnormals.put(AbnormalType.getAbnormalType(ngt[0]), Short.MAX_VALUE);
}
}
else
{
_dispelAbnormals = Collections.<AbnormalType, Short> emptyMap();
}
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.DISPEL;
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
if (_dispelAbnormals.isEmpty())
{
return;
}
final CharEffectList effectList = effected.getEffectList();
// There is no need to iterate over all buffs,
// Just iterate once over all slots to dispel and get the buff with that abnormal if exists,
// Operation of O(n) for the amount of slots to dispel (which is usually small) and O(1) to get the buff.
for (Entry<AbnormalType, Short> entry : _dispelAbnormals.entrySet())
{
if ((Rnd.get(100) < _rate))
{
// Dispel transformations (buff and by GM)
if ((entry.getKey() == AbnormalType.TRANSFORM))
{
if ((entry.getValue() == effected.getTransformationId()) || (entry.getValue() < 0))
{
effected.stopTransformation(true);
}
}
final BuffInfo toDispel = effectList.getBuffInfoByAbnormalType(entry.getKey());
if (toDispel == null)
{
continue;
}
if ((toDispel.getSkill().getAbnormalType() == entry.getKey()) && (entry.getValue() >= toDispel.getSkill().getAbnormalLvl()))
{
effectList.stopSkillEffects(true, entry.getKey());
}
}
}
}
}

View File

@@ -0,0 +1,89 @@
/*
* 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 java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.EffectFlag;
import com.l2jmobius.gameserver.model.holders.SkillHolder;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* Double Casting effect implementation.
* @author Nik
*/
public final class DoubleCast extends AbstractEffect
{
private static final SkillHolder[] TOGGLE_SKILLS = new SkillHolder[]
{
new SkillHolder(11007, 1),
new SkillHolder(11009, 1),
new SkillHolder(11008, 1),
new SkillHolder(11010, 1)
};
private final Map<Integer, List<SkillHolder>> _addedToggles;
public DoubleCast(StatsSet params)
{
_addedToggles = new HashMap<>();
}
@Override
public long getEffectFlags()
{
return EffectFlag.DOUBLE_CAST.getMask();
}
@Override
public void onStart(BuffInfo info)
{
if (info.getEffected().isPlayer())
{
for (SkillHolder holder : TOGGLE_SKILLS)
{
final Skill skill = holder.getSkill();
if ((skill != null) && !info.getEffected().isAffectedBySkill(holder))
{
_addedToggles.computeIfAbsent(info.getEffected().getObjectId(), v -> new ArrayList<>()).add(holder);
skill.applyEffects(info.getEffected(), info.getEffected());
}
}
}
super.onStart(info);
}
@Override
public void onExit(BuffInfo info)
{
if (info.getEffected().isPlayer())
{
_addedToggles.computeIfPresent(info.getEffected().getObjectId(), (k, v) ->
{
v.forEach(h -> info.getEffected().stopSkillEffects(h.getSkill()));
return null;
});
}
super.onExit(info);
}
}

View File

@@ -1,66 +0,0 @@
/*
* 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 com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.model.PcCondOverride;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author NviX
*/
public final class Duel extends AbstractEffect
{
public Duel(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
}
@Override
public void onStart(BuffInfo info)
{
final L2PcInstance effector = info.getEffector().getActingPlayer();
final L2PcInstance effected = info.getEffected().getActingPlayer();
if (effected.isDead() || (effector == null) || (effected.getPvpFlag() == 0))
{
return;
}
final Skill skill = SkillData.getInstance().getSkill(10319, 1);
skill.applyEffects(effector, effector);
effector.setIsInvul(true);
effected.addOverrideCond(PcCondOverride.VULNERABLE_ALL_PLAYERS);
effected.setTarget(effector);
effected.setLockedTarget(effector);
}
@Override
public void onExit(BuffInfo info)
{
info.getEffected().getActingPlayer().setLockedTarget(null);
info.getEffected().removeOverridedCond(PcCondOverride.VULNERABLE_ALL_PLAYERS);
info.getEffector().setIsInvul(false);
info.getEffector().getEffectList().remove(true, info.getEffector().getEffectList().getBuffInfoBySkillId(10319));
}
}

View File

@@ -1,58 +1,52 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
/**
* Enable Cloak effect implementation.
* @author Adry_85
*/
public final class EnableCloak extends AbstractEffect
{
public EnableCloak(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
}
@Override
public boolean canStart(BuffInfo info)
{
return (info.getEffector() != null) && (info.getEffected() != null) && info.getEffected().isPlayer();
}
@Override
public void onStart(BuffInfo info)
{
info.getEffected().getActingPlayer().getStat().setCloakSlotStatus(true);
}
@Override
public boolean onActionTime(BuffInfo info)
{
return info.getSkill().isPassive();
}
@Override
public void onExit(BuffInfo info)
{
info.getEffected().getActingPlayer().getStat().setCloakSlotStatus(false);
}
}
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* Enable Cloak effect implementation.
* @author Adry_85
*/
public final class EnableCloak extends AbstractEffect
{
public EnableCloak(StatsSet params)
{
}
@Override
public boolean canStart(BuffInfo info)
{
return (info.getEffector() != null) && (info.getEffected() != null) && info.getEffected().isPlayer();
}
@Override
public void onStart(L2Character effector, L2Character effected, Skill skill)
{
effected.getActingPlayer().getStat().setCloakSlotStatus(true);
}
@Override
public void onExit(BuffInfo info)
{
info.getEffected().getActingPlayer().getStat().setCloakSlotStatus(false);
}
}

View File

@@ -1,102 +1,109 @@
/*
* 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 com.l2jmobius.gameserver.GeoData;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.network.serverpackets.FlyToLocation;
import com.l2jmobius.gameserver.network.serverpackets.FlyToLocation.FlyType;
import com.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
/**
* Enemy Charge effect implementation.
*/
public final class EnemyCharge extends AbstractEffect
{
public EnemyCharge(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void onStart(BuffInfo info)
{
if (info.getEffected().isMovementDisabled())
{
return;
}
// Get current position of the L2Character
final int curX = info.getEffector().getX();
final int curY = info.getEffector().getY();
final int curZ = info.getEffector().getZ();
// Calculate distance (dx,dy) between current position and destination
final double dx = info.getEffected().getX() - curX;
final double dy = info.getEffected().getY() - curY;
final double dz = info.getEffected().getZ() - curZ;
final double distance = Math.sqrt((dx * dx) + (dy * dy));
if (distance > 2000)
{
_log.info("EffectEnemyCharge was going to use invalid coordinates for characters, getEffector: " + curX + "," + curY + " and getEffected: " + info.getEffected().getX() + "," + info.getEffected().getY());
return;
}
int offset = Math.max((int) distance - info.getSkill().getFlyRadius(), 30);
// approximation for moving closer when z coordinates are different
// TODO: handle Z axis movement better
offset -= Math.abs(dz);
if (offset < 5)
{
offset = 5;
}
// If no distance
if ((distance < 1) || ((distance - offset) <= 0))
{
return;
}
// Calculate movement angles needed
final double sin = dy / distance;
final double cos = dx / distance;
// Calculate the new destination with offset included
final int x = curX + (int) ((distance - offset) * cos);
final int y = curY + (int) ((distance - offset) * sin);
final int z = info.getEffected().getZ();
final Location destination = GeoData.getInstance().moveCheck(info.getEffector().getX(), info.getEffector().getY(), info.getEffector().getZ(), x, y, z, info.getEffector().getInstanceId());
info.getEffector().broadcastPacket(new FlyToLocation(info.getEffector(), destination, FlyType.CHARGE));
// maybe is need force set X,Y,Z
info.getEffector().setXYZ(destination);
info.getEffector().broadcastPacket(new ValidateLocation(info.getEffector()));
}
}
/*
* 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 com.l2jmobius.gameserver.GeoData;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.serverpackets.FlyToLocation;
import com.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
/**
* Enemy Charge effect implementation.
*/
public final class EnemyCharge extends AbstractEffect
{
private final int _speed;
private final int _delay;
private final int _animationSpeed;
public EnemyCharge(StatsSet params)
{
_speed = params.getInt("speed", 0);
_delay = params.getInt("delay", 0);
_animationSpeed = params.getInt("animationSpeed", 0);
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
if (effected.isMovementDisabled())
{
return;
}
// Get current position of the L2Character
final int curX = effector.getX();
final int curY = effector.getY();
final int curZ = effector.getZ();
// Calculate distance (dx,dy) between current position and destination
final double dx = effected.getX() - curX;
final double dy = effected.getY() - curY;
final double dz = effected.getZ() - curZ;
final double distance = Math.sqrt((dx * dx) + (dy * dy));
if (distance > 2000)
{
_log.info("EffectEnemyCharge was going to use invalid coordinates for characters, getEffector: " + curX + "," + curY + " and getEffected: " + effected.getX() + "," + effected.getY());
return;
}
int offset = Math.max((int) distance - skill.getFlyRadius(), 30);
// approximation for moving closer when z coordinates are different
// TODO: handle Z axis movement better
offset -= Math.abs(dz);
if (offset < 5)
{
offset = 5;
}
// If no distance
if ((distance < 1) || ((distance - offset) <= 0))
{
return;
}
// Calculate movement angles needed
final double sin = dy / distance;
final double cos = dx / distance;
// Calculate the new destination with offset included
final int x = curX + (int) ((distance - offset) * cos);
final int y = curY + (int) ((distance - offset) * sin);
final int z = effected.getZ();
final Location destination = GeoData.getInstance().moveCheck(effector.getX(), effector.getY(), effector.getZ(), x, y, z, effector.getInstanceWorld());
effector.broadcastPacket(new FlyToLocation(effector, destination, skill.getFlyType(), _speed, _delay, _animationSpeed));
// maybe is need force set X,Y,Z
effected.setXYZ(destination);
effected.broadcastPacket(new ValidateLocation(effector));
effected.revalidateZone(true);
}
}

View File

@@ -1,188 +1,163 @@
/*
* 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 com.l2jmobius.gameserver.enums.ShotType;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.items.L2Weapon;
import com.l2jmobius.gameserver.model.items.type.WeaponType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.BaseStats;
import com.l2jmobius.gameserver.model.stats.Formulas;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.util.Rnd;
/**
* Energy Attack effect implementation.
* @author NosBit
*/
public final class EnergyAttack extends AbstractEffect
{
private final double _power;
private final int _criticalChance;
private final boolean _ignoreShieldDefence;
public EnergyAttack(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
_power = params.getDouble("power", 0);
_criticalChance = params.getInt("criticalChance", 0);
_ignoreShieldDefence = params.getBoolean("ignoreShieldDefence", false);
}
@Override
public boolean calcSuccess(BuffInfo info)
{
// TODO: Verify this on retail
return !Formulas.calcPhysicalSkillEvasion(info.getEffector(), info.getEffected(), info.getSkill());
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.PHYSICAL_ATTACK;
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void onStart(BuffInfo info)
{
final L2PcInstance attacker = info.getEffector() instanceof L2PcInstance ? (L2PcInstance) info.getEffector() : null;
if (attacker == null)
{
return;
}
final L2Character target = info.getEffected();
final Skill skill = info.getSkill();
double attack = attacker.getPAtk(target);
double defence = target.getPDef(attacker);
if (!_ignoreShieldDefence)
{
switch (Formulas.calcShldUse(attacker, target, skill, true))
{
case Formulas.SHIELD_DEFENSE_FAILED:
{
break;
}
case Formulas.SHIELD_DEFENSE_SUCCEED:
{
defence += target.getShldDef();
break;
}
case Formulas.SHIELD_DEFENSE_PERFECT_BLOCK:
{
defence = -1;
break;
}
}
}
double damage = 1;
boolean critical = false;
if (defence != -1)
{
final double damageMultiplier = Formulas.calcWeaponTraitBonus(attacker, target) * Formulas.calcAttributeBonus(attacker, target, skill) * Formulas.calcGeneralTraitBonus(attacker, target, skill.getTraitType(), true);
final boolean ss = info.getSkill().useSoulShot() && attacker.isChargedShot(ShotType.SOULSHOTS);
final double ssBoost = ss ? 2 : 1.0;
double weaponTypeBoost;
final L2Weapon weapon = attacker.getActiveWeaponItem();
if ((weapon != null) && ((weapon.getItemType() == WeaponType.BOW) || (weapon.getItemType() == WeaponType.CROSSBOW)))
{
weaponTypeBoost = 70;
}
else
{
weaponTypeBoost = 77;
}
double energyChargesBoost = 1;
if (attacker.getCharges() == 1)
{
energyChargesBoost = 1.1;
attacker.decreaseCharges(1);
}
else if (attacker.getCharges() == 2)
{
energyChargesBoost = 1.2;
attacker.decreaseCharges(2);
}
else if (attacker.getCharges() >= 3)
{
energyChargesBoost = 1.3;
attacker.decreaseCharges(3);
}
final double addPower = attacker.getStat().calcStat(Stats.MOMENTUM_SKILL_POWER, 1, null, null);
attack += _power;
attack *= addPower;
attack *= ssBoost;
attack *= energyChargesBoost;
attack *= weaponTypeBoost;
damage = attack / defence;
damage *= damageMultiplier;
if (target instanceof L2PcInstance)
{
damage *= attacker.getStat().calcStat(Stats.PVP_PHYS_SKILL_DMG, 1.0);
damage *= target.getStat().calcStat(Stats.PVP_PHYS_SKILL_DEF, 1.0);
damage = attacker.getStat().calcStat(Stats.PHYSICAL_SKILL_POWER, damage);
}
critical = (BaseStats.STR.calcBonus(attacker) * _criticalChance) > (Rnd.nextDouble() * 100);
if (critical)
{
damage *= 2;
}
}
if (damage > 0)
{
// reduce damage if target has maxdamage buff
final double maxDamage = target.getStat().calcStat(Stats.MAX_SKILL_DAMAGE, 0, null, null);
if (maxDamage > 0)
{
damage = (int) maxDamage;
}
attacker.sendDamageMessage(target, (int) damage, false, critical, false);
target.reduceCurrentHp(damage, attacker, skill);
target.notifyDamageReceived(damage, attacker, skill, critical, false);
// Check if damage should be reflected
Formulas.calcDamageReflected(attacker, target, skill, critical);
}
}
}
/*
* 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 com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.enums.ShotType;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Attackable;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.BaseStats;
import com.l2jmobius.gameserver.model.stats.Formulas;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
/**
* Energy Attack effect implementation.
* @author NosBit
*/
public final class EnergyAttack extends AbstractEffect
{
private final double _power;
private final int _chargeConsume;
private final int _criticalChance;
private final boolean _ignoreShieldDefence;
private final boolean _overHit;
public EnergyAttack(StatsSet params)
{
_power = params.getDouble("power", 0);
_criticalChance = params.getInt("criticalChance", 0);
_ignoreShieldDefence = params.getBoolean("ignoreShieldDefence", false);
_overHit = params.getBoolean("overHit", false);
_chargeConsume = params.getInt("chargeConsume", 0);
}
@Override
public boolean calcSuccess(L2Character effector, L2Character effected, Skill skill)
{
// TODO: Verify this on retail
return !Formulas.calcPhysicalSkillEvasion(effector, effected, skill);
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.PHYSICAL_ATTACK;
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
if (!effector.isPlayer())
{
return;
}
final L2PcInstance attacker = effector.getActingPlayer();
final int charge = Math.min(_chargeConsume, attacker.getCharges());
if (!attacker.decreaseCharges(charge))
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
sm.addSkillName(skill);
attacker.sendPacket(sm);
return;
}
final double distance = attacker.calculateDistance(effected, true, false);
if (distance > effected.getStat().getValue(Stats.SPHERIC_BARRIER_RANGE, Integer.MAX_VALUE))
{
return;
}
if (_overHit && effected.isAttackable())
{
((L2Attackable) effected).overhitEnabled(true);
}
int defence = effected.getPDef();
if (!_ignoreShieldDefence)
{
final byte shield = Formulas.calcShldUse(attacker, effected);
switch (shield)
{
case Formulas.SHIELD_DEFENSE_SUCCEED:
{
defence += effected.getShldDef();
break;
}
case Formulas.SHIELD_DEFENSE_PERFECT_BLOCK:
{
defence = -1;
break;
}
}
}
double damage = 1;
final boolean critical = (_criticalChance > 0) && ((BaseStats.STR.calcBonus(attacker) * _criticalChance) > (Rnd.nextDouble() * 100));
if (defence != -1)
{
// Trait, elements
final double weaponTraitMod = Formulas.calcWeaponTraitBonus(attacker, effected);
final double generalTraitMod = Formulas.calcGeneralTraitBonus(attacker, effected, skill.getTraitType(), false);
final double attributeMod = Formulas.calcAttributeBonus(attacker, effected, skill);
final double pvpPveMod = Formulas.calculatePvpPveBonus(attacker, effected, skill, true);
// Skill specific mods.
final double energyChargesBoost = 1 + (charge * 0.1); // 10% bonus damage for each charge used.
final double critMod = critical ? Formulas.calcCritDamage(attacker, effected, skill) : 1;
final double ssmod = (skill.useSoulShot() && attacker.isChargedShot(ShotType.SOULSHOTS)) ? attacker.getStat().getValue(Stats.SHOTS_BONUS, 2) : 1; // 2.04 for dual weapon?
// ...................________Initial Damage_________...__Charges Additional Damage__...____________________________________
// ATTACK CALCULATION ((77 * ((pAtk * lvlMod) + power) * (1 + (0.1 * chargesConsumed)) / pdef) * skillPower) + skillPowerAdd
// ```````````````````^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^```^^^^^^^^^^^^^^^^^^^^^^^^^^^^^```^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
final double baseMod = (77 * ((attacker.getPAtk() * attacker.getLevelMod()) + _power)) / defence;
damage = baseMod * ssmod * critMod * weaponTraitMod * generalTraitMod * attributeMod * energyChargesBoost * pvpPveMod;
damage = attacker.getStat().getValue(Stats.PHYSICAL_SKILL_POWER, damage);
}
damage = Math.max(0, damage);
// Check if damage should be reflected
Formulas.calcDamageReflected(attacker, effected, skill, critical);
final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT);
if (damageCap > 0)
{
damage = Math.min(damage, damageCap);
}
effected.reduceCurrentHp(damage, effector, skill, false, false, critical, false);
attacker.sendDamageMessage(effected, skill, (int) damage, critical, false);
}
}

View File

@@ -0,0 +1,55 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* Enlarge Abnormal Slot effect implementation.
* @author Zoey76
*/
public final class EnlargeAbnormalSlot extends AbstractEffect
{
private final int _slots;
public EnlargeAbnormalSlot(StatsSet params)
{
_slots = params.getInt("slots", 0);
}
@Override
public boolean canStart(BuffInfo info)
{
return (info.getEffector() != null) && (info.getEffected() != null) && info.getEffected().isPlayer();
}
@Override
public void onStart(L2Character effector, L2Character effected, Skill skill)
{
effected.getStat().setMaxBuffCount(effected.getStat().getMaxBuffCount() + _slots);
}
@Override
public void onExit(BuffInfo info)
{
info.getEffected().getStat().setMaxBuffCount(Math.max(0, info.getEffected().getStat().getMaxBuffCount() - _slots));
}
}

View File

@@ -0,0 +1,75 @@
/*
* 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 com.l2jmobius.gameserver.enums.StorageType;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* @author Sdw
*/
public class EnlargeSlot extends AbstractEffect
{
private final StorageType _type;
private final double _amount;
public EnlargeSlot(StatsSet params)
{
_amount = params.getDouble("amount", 0);
_type = params.getEnum("type", StorageType.class, StorageType.INVENTORY_NORMAL);
}
@Override
public void pump(L2Character effected, Skill skill)
{
Stats stat = Stats.INVENTORY_NORMAL;
switch (_type)
{
case TRADE_BUY:
{
stat = Stats.TRADE_BUY;
break;
}
case TRADE_SELL:
{
stat = Stats.TRADE_SELL;
break;
}
case RECIPE_DWARVEN:
{
stat = Stats.RECIPE_DWARVEN;
break;
}
case RECIPE_COMMON:
{
stat = Stats.RECIPE_COMMON;
break;
}
case STORAGE_PRIVATE:
{
stat = Stats.STORAGE_PRIVATE;
break;
}
}
effected.getStat().mergeAdd(stat, _amount);
}
}

View File

@@ -1,75 +1,68 @@
/*
* 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 com.l2jmobius.gameserver.instancemanager.MapRegionManager;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.TeleportWhereType;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2GuardInstance;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
/**
* Escape effect implementation.
* @author Adry_85
*/
public final class Escape extends AbstractEffect
{
private final TeleportWhereType _escapeType;
public Escape(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
_escapeType = params.getEnum("escapeType", TeleportWhereType.class, null);
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.TELEPORT;
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void onStart(BuffInfo info)
{
if (_escapeType == null)
{
return;
}
if (info.getEffected() instanceof L2GuardInstance)
{
info.getEffected().teleToLocation(((L2Npc) info.getEffected()).getSpawn());
info.getEffected().setHeading(((L2Npc) info.getEffected()).getSpawn().getHeading());
}
else
{
info.getEffected().teleToLocation(MapRegionManager.getInstance().getTeleToLocation(info.getEffected(), _escapeType), true);
info.getEffected().setInstanceId(0);
}
}
}
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.TeleportWhereType;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* Escape effect implementation.
* @author Adry_85
*/
public final class Escape extends AbstractEffect
{
private final TeleportWhereType _escapeType;
public Escape(StatsSet params)
{
_escapeType = params.getEnum("escapeType", TeleportWhereType.class, null);
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.TELEPORT;
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public boolean canStart(BuffInfo info)
{
// While affected by escape blocking effect you cannot use Blink or Scroll of Escape
return super.canStart(info) && !info.getEffected().cannotEscape();
}
@Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
if (_escapeType != null)
{
effected.teleToLocation(_escapeType, null);
}
}
}

View File

@@ -0,0 +1,31 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* @author Sdw
*/
public class ExpModify extends AbstractStatEffect
{
public ExpModify(StatsSet params)
{
super(params, Stats.BONUS_EXP);
}
}

View File

@@ -1,53 +1,58 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.EffectFlag;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
/**
* Disarm effect implementation.
* @author hitnar
*/
public final class RemoveArmor extends AbstractEffect
{
public RemoveArmor(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
}
@Override
public boolean canStart(BuffInfo info)
{
return info.getEffected().isPlayer();
}
@Override
public int getEffectFlags()
{
return EffectFlag.DISARMED.getMask();
}
@Override
public void onStart(BuffInfo info)
{
info.getEffected().getActingPlayer().disarmArmor();
}
}
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.EffectFlag;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
/**
* @author Sdw
*/
public class Faceoff extends AbstractEffect
{
public Faceoff(StatsSet params)
{
}
@Override
public long getEffectFlags()
{
return EffectFlag.FACEOFF.getMask();
}
@Override
public boolean canStart(BuffInfo info)
{
return info.getEffected().isPlayer();
}
@Override
public void onStart(BuffInfo info)
{
info.getEffector().getActingPlayer().setAttackerObjId(info.getEffected().getObjectId());
info.getEffected().getActingPlayer().setAttackerObjId(info.getEffector().getObjectId());
}
@Override
public void onExit(BuffInfo info)
{
info.getEffector().getActingPlayer().setAttackerObjId(0);
info.getEffected().getActingPlayer().setAttackerObjId(0);
}
}

View File

@@ -1,87 +1,87 @@
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.ChangeWaitType;
import com.l2jmobius.gameserver.network.serverpackets.Revive;
/**
* Fake Death effect implementation.
* @author mkizub
*/
public final class FakeDeath extends AbstractEffect
{
private final double _power;
public FakeDeath(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
_power = params.getDouble("power", 0);
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.FAKE_DEATH;
}
@Override
public boolean onActionTime(BuffInfo info)
{
if (info.getEffected().isDead())
{
return false;
}
final double manaDam = _power * getTicksMultiplier();
if ((manaDam > info.getEffected().getCurrentMp()) && info.getSkill().isToggle())
{
info.getEffected().sendPacket(SystemMessageId.YOUR_SKILL_WAS_DEACTIVATED_DUE_TO_LACK_OF_MP);
return false;
}
info.getEffected().reduceCurrentMp(manaDam);
return info.getSkill().isToggle();
}
@Override
public void onExit(BuffInfo info)
{
if (info.getEffected().isPlayer())
{
info.getEffected().getActingPlayer().setIsFakeDeath(false);
info.getEffected().getActingPlayer().setRecentFakeDeath(true);
}
info.getEffected().broadcastPacket(new ChangeWaitType(info.getEffected(), ChangeWaitType.WT_STOP_FAKEDEATH));
info.getEffected().broadcastPacket(new Revive(info.getEffected()));
}
@Override
public void onStart(BuffInfo info)
{
info.getEffected().startFakeDeath();
}
}
/*
* 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 com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.EffectFlag;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.ChangeWaitType;
import com.l2jmobius.gameserver.network.serverpackets.Revive;
/**
* Fake Death effect implementation.
* @author mkizub
*/
public final class FakeDeath extends AbstractEffect
{
private final double _power;
public FakeDeath(StatsSet params)
{
_power = params.getDouble("power", 0);
setTicks(params.getInt("ticks"));
}
@Override
public long getEffectFlags()
{
return EffectFlag.FAKE_DEATH.getMask();
}
@Override
public boolean onActionTime(BuffInfo info)
{
if (info.getEffected().isDead())
{
return false;
}
final double manaDam = _power * getTicksMultiplier();
if (manaDam > info.getEffected().getCurrentMp())
{
if (info.getSkill().isToggle())
{
info.getEffected().sendPacket(SystemMessageId.YOUR_SKILL_WAS_DEACTIVATED_DUE_TO_LACK_OF_MP);
return false;
}
}
info.getEffected().reduceCurrentMp(manaDam);
return info.getSkill().isToggle();
}
@Override
public void onExit(BuffInfo info)
{
if (info.getEffected().isPlayer())
{
info.getEffected().getActingPlayer().setRecentFakeDeath(true);
}
info.getEffected().broadcastPacket(new ChangeWaitType(info.getEffected(), ChangeWaitType.WT_STOP_FAKEDEATH));
info.getEffected().broadcastPacket(new Revive(info.getEffected()));
}
@Override
public void onStart(BuffInfo info)
{
info.getEffected().startFakeDeath();
}
}

View File

@@ -1,128 +1,141 @@
/*
* 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 java.util.StringTokenizer;
import com.l2jmobius.gameserver.enums.ShotType;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.skills.AbnormalType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Formulas;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* Fatal Blow effect implementation.
* @author Adry_85
*/
public final class FatalBlow extends AbstractEffect
{
private final String _targetAbnormalType;
private final double _skillAddPower;
public FatalBlow(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
_targetAbnormalType = params.getString("targetAbnormalType", "NULL");
_skillAddPower = params.getDouble("skillAddPower", 1);
}
@Override
public boolean calcSuccess(BuffInfo info)
{
return !Formulas.calcPhysicalSkillEvasion(info.getEffector(), info.getEffected(), info.getSkill()) && Formulas.calcBlowSuccess(info.getEffector(), info.getEffected(), info.getSkill());
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.PHYSICAL_ATTACK;
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void onStart(BuffInfo info)
{
final L2Character target = info.getEffected();
final L2Character activeChar = info.getEffector();
final Skill skill = info.getSkill();
if (activeChar.isAlikeDead())
{
return;
}
final boolean ss = skill.useSoulShot() && activeChar.isChargedShot(ShotType.SOULSHOTS);
final byte shld = Formulas.calcShldUse(activeChar, target, skill);
double damage = Formulas.calcBlowDamage(activeChar, target, skill, shld, ss);
if (_targetAbnormalType != "NULL")
{
final StringTokenizer st = new StringTokenizer(_targetAbnormalType, ",");
while (st.hasMoreTokens())
{
if (target.getEffectList().getBuffInfoByAbnormalType(AbnormalType.valueOf(st.nextToken().trim())) != null)
{
damage *= _skillAddPower;
break;
}
}
}
final boolean crit = Formulas.calcCrit(activeChar, target, skill);
if (crit)
{
damage *= 2;
}
// reduce damage if target has maxdamage buff
final double maxDamage = target.getStat().calcStat(Stats.MAX_SKILL_DAMAGE, 0, null, null);
if (maxDamage > 0)
{
damage = (int) maxDamage;
}
target.reduceCurrentHp(damage, activeChar, skill);
target.notifyDamageReceived(damage, activeChar, skill, crit, false);
// Manage attack or cast break of the target (calculating rate, sending message...)
if (!target.isRaid() && Formulas.calcAtkBreak(target, damage))
{
target.breakAttack();
target.breakCast();
}
if (activeChar.isPlayer())
{
activeChar.getActingPlayer().sendDamageMessage(target, (int) damage, false, true, false);
}
// Check if damage should be reflected
Formulas.calcDamageReflected(activeChar, target, skill, true);
}
/*
* 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 java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import com.l2jmobius.gameserver.enums.ShotType;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Attackable;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.AbnormalType;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Formulas;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* Fatal Blow effect implementation.
* @author Adry_85
*/
public final class FatalBlow extends AbstractEffect
{
private final double _power;
private final double _chance;
private final double _criticalChance;
private final boolean _overHit;
private final Set<AbnormalType> _abnormals;
private final double _abnormalPower;
public FatalBlow(StatsSet params)
{
_power = params.getDouble("power", 0);
_chance = params.getDouble("chance", 0);
_criticalChance = params.getDouble("criticalChance", 0);
_overHit = params.getBoolean("overHit", false);
final String abnormals = params.getString("abnormalType", null);
if ((abnormals != null) && !abnormals.isEmpty())
{
_abnormals = new HashSet<>();
for (String slot : abnormals.split(";"))
{
_abnormals.add(AbnormalType.getAbnormalType(slot));
}
}
else
{
_abnormals = Collections.<AbnormalType> emptySet();
}
_abnormalPower = params.getDouble("abnormalPower", 1);
}
@Override
public boolean calcSuccess(L2Character effector, L2Character effected, Skill skill)
{
return !Formulas.calcPhysicalSkillEvasion(effector, effected, skill) && Formulas.calcBlowSuccess(effector, effected, skill, _chance);
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.PHYSICAL_ATTACK;
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
if (effector.isAlikeDead())
{
return;
}
if (_overHit && effected.isAttackable())
{
((L2Attackable) effected).overhitEnabled(true);
}
double power = _power;
// Check if we apply an abnormal modifier
if (_abnormals.stream().anyMatch(effected::hasAbnormalType))
{
power += _abnormalPower;
}
final boolean ss = skill.useSoulShot() && effector.isChargedShot(ShotType.SOULSHOTS);
final byte shld = Formulas.calcShldUse(effector, effected);
double damage = Formulas.calcBlowDamage(effector, effected, skill, false, power, shld, ss);
final boolean crit = Formulas.calcCrit(_criticalChance, effector, effected, skill);
if (crit)
{
damage *= 2;
}
// Check if damage should be reflected
Formulas.calcDamageReflected(effector, effected, skill, true);
final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT);
if (damageCap > 0)
{
damage = Math.min(damage, damageCap);
}
effected.reduceCurrentHp(damage, effector, skill, false, false, true, false);
// Manage attack or cast break of the target (calculating rate, sending message...)
if (!effected.isRaid() && Formulas.calcAtkBreak(effected, damage))
{
effected.breakAttack();
effected.breakCast();
}
effector.sendDamageMessage(effected, skill, (int) damage, true, false);
}
}

Some files were not shown because too many files have changed in this diff Show More