This commit is contained in:
66
trunk/dist/game/data/scripts/handlers/effecthandlers/AddHate.java
vendored
Normal file
66
trunk/dist/game/data/scripts/handlers/effecthandlers/AddHate.java
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Attackable;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.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);
|
||||
}
|
||||
}
|
||||
}
|
83
trunk/dist/game/data/scripts/handlers/effecthandlers/AttackTrait.java
vendored
Normal file
83
trunk/dist/game/data/scripts/handlers/effecthandlers/AttackTrait.java
vendored
Normal file
@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.stat.CharStat;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.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()]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
100
trunk/dist/game/data/scripts/handlers/effecthandlers/Backstab.java
vendored
Normal file
100
trunk/dist/game/data/scripts/handlers/effecthandlers/Backstab.java
vendored
Normal file
@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.enums.ShotType;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.model.stats.BaseStats;
|
||||
import com.l2jserver.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().isBehindTarget() && !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;
|
||||
}
|
||||
|
||||
L2Character target = info.getEffected();
|
||||
L2Character activeChar = info.getEffector();
|
||||
boolean ss = info.getSkill().useSoulShot() && activeChar.isChargedShot(ShotType.SOULSHOTS);
|
||||
byte shld = Formulas.calcShldUse(activeChar, target, info.getSkill());
|
||||
double damage = Formulas.calcBackstabDamage(activeChar, target, info.getSkill(), shld, ss);
|
||||
|
||||
// Crit rate base crit rate for skill, modified with STR bonus
|
||||
if (Formulas.calcCrit(info.getSkill().getBaseCritRate() * 10 * BaseStats.STR.calcBonus(activeChar), true, target))
|
||||
{
|
||||
damage *= 2;
|
||||
}
|
||||
|
||||
target.reduceCurrentHp(damage, activeChar, info.getSkill());
|
||||
target.notifyDamageReceived(damage, activeChar, info.getSkill(), 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())
|
||||
{
|
||||
L2PcInstance activePlayer = activeChar.getActingPlayer();
|
||||
activePlayer.sendDamageMessage(target, (int) damage, false, true, false);
|
||||
}
|
||||
|
||||
// Check if damage should be reflected
|
||||
Formulas.calcDamageReflected(activeChar, target, info.getSkill(), true);
|
||||
}
|
||||
}
|
69
trunk/dist/game/data/scripts/handlers/effecthandlers/Betray.java
vendored
Normal file
69
trunk/dist/game/data/scripts/handlers/effecthandlers/Betray.java
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.ai.CtrlIntention;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.EffectFlag;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.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());
|
||||
}
|
||||
}
|
88
trunk/dist/game/data/scripts/handlers/effecthandlers/Blink.java
vendored
Normal file
88
trunk/dist/game/data/scripts/handlers/effecthandlers/Blink.java
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.GeoData;
|
||||
import com.l2jserver.gameserver.ai.CtrlIntention;
|
||||
import com.l2jserver.gameserver.model.Location;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.network.serverpackets.FlyToLocation;
|
||||
import com.l2jserver.gameserver.network.serverpackets.FlyToLocation.FlyType;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ValidateLocation;
|
||||
import com.l2jserver.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);
|
||||
|
||||
int x = effected.getX() + x1;
|
||||
int y = effected.getY() + y1;
|
||||
int z = effected.getZ();
|
||||
Location loc = new Location(x, y, z);
|
||||
if (Config.GEODATA > 0)
|
||||
{
|
||||
loc = 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, loc.getX(), loc.getY(), loc.getZ(), FlyType.DUMMY));
|
||||
effected.abortAttack();
|
||||
effected.abortCast();
|
||||
effected.setXYZ(loc);
|
||||
effected.broadcastPacket(new ValidateLocation(effected));
|
||||
}
|
||||
}
|
91
trunk/dist/game/data/scripts/handlers/effecthandlers/BlockAction.java
vendored
Normal file
91
trunk/dist/game/data/scripts/handlers/effecthandlers/BlockAction.java
vendored
Normal file
@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.datatables.BotReportTable;
|
||||
import com.l2jserver.gameserver.instancemanager.PunishmentManager;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.punishment.PunishmentAffect;
|
||||
import com.l2jserver.gameserver.model.punishment.PunishmentTask;
|
||||
import com.l2jserver.gameserver.model.punishment.PunishmentType;
|
||||
import com.l2jserver.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);
|
||||
|
||||
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 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));
|
||||
}
|
||||
}
|
||||
}
|
69
trunk/dist/game/data/scripts/handlers/effecthandlers/BlockBuffSlot.java
vendored
Normal file
69
trunk/dist/game/data/scripts/handlers/effecthandlers/BlockBuffSlot.java
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.skills.AbnormalType;
|
||||
import com.l2jserver.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);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
65
trunk/dist/game/data/scripts/handlers/effecthandlers/BlockChat.java
vendored
Normal file
65
trunk/dist/game/data/scripts/handlers/effecthandlers/BlockChat.java
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.instancemanager.PunishmentManager;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.gameserver.model.punishment.PunishmentAffect;
|
||||
import com.l2jserver.gameserver.model.punishment.PunishmentTask;
|
||||
import com.l2jserver.gameserver.model.punishment.PunishmentType;
|
||||
import com.l2jserver.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));
|
||||
}
|
||||
}
|
58
trunk/dist/game/data/scripts/handlers/effecthandlers/BlockParty.java
vendored
Normal file
58
trunk/dist/game/data/scripts/handlers/effecthandlers/BlockParty.java
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.instancemanager.PunishmentManager;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.punishment.PunishmentAffect;
|
||||
import com.l2jserver.gameserver.model.punishment.PunishmentTask;
|
||||
import com.l2jserver.gameserver.model.punishment.PunishmentType;
|
||||
import com.l2jserver.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));
|
||||
}
|
||||
}
|
42
trunk/dist/game/data/scripts/handlers/effecthandlers/BlockResurrection.java
vendored
Normal file
42
trunk/dist/game/data/scripts/handlers/effecthandlers/BlockResurrection.java
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.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();
|
||||
}
|
||||
}
|
72
trunk/dist/game/data/scripts/handlers/effecthandlers/Bluff.java
vendored
Normal file
72
trunk/dist/game/data/scripts/handlers/effecthandlers/Bluff.java
vendored
Normal file
@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.model.stats.Formulas;
|
||||
import com.l2jserver.gameserver.network.serverpackets.StartRotation;
|
||||
import com.l2jserver.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());
|
||||
}
|
||||
}
|
49
trunk/dist/game/data/scripts/handlers/effecthandlers/Buff.java
vendored
Normal file
49
trunk/dist/game/data/scripts/handlers/effecthandlers/Buff.java
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
|
||||
/**
|
||||
* Buff effect implementation.
|
||||
* @author mkizub
|
||||
*/
|
||||
public class Buff extends AbstractEffect
|
||||
{
|
||||
public Buff(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
||||
{
|
||||
super(attachCond, applyCond, set, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.BUFF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActionTime(BuffInfo info)
|
||||
{
|
||||
return info.getSkill().isPassive() || info.getSkill().isToggle();
|
||||
}
|
||||
}
|
63
trunk/dist/game/data/scripts/handlers/effecthandlers/CallParty.java
vendored
Normal file
63
trunk/dist/game/data/scripts/handlers/effecthandlers/CallParty.java
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.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()))
|
||||
{
|
||||
if (info.getEffector() != partyMember)
|
||||
{
|
||||
partyMember.teleToLocation(info.getEffector().getLocation(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
166
trunk/dist/game/data/scripts/handlers/effecthandlers/CallPc.java
vendored
Normal file
166
trunk/dist/game/data/scripts/handlers/effecthandlers/CallPc.java
vendored
Normal file
@ -0,0 +1,166 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.instancemanager.InstanceManager;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.entity.Instance;
|
||||
import com.l2jserver.gameserver.model.entity.TvTEvent;
|
||||
import com.l2jserver.gameserver.model.holders.SummonRequestHolder;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.model.zone.ZoneId;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ConfirmDlg;
|
||||
import com.l2jserver.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;
|
||||
}
|
||||
|
||||
L2PcInstance target = info.getEffected().getActingPlayer();
|
||||
L2PcInstance activeChar = info.getEffector().getActingPlayer();
|
||||
if (checkSummonTargetStatus(target, activeChar))
|
||||
{
|
||||
if ((_itemId != 0) && (_itemCount != 0))
|
||||
{
|
||||
if (target.getInventory().getInventoryItemCount(_itemId, 0) < _itemCount)
|
||||
{
|
||||
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);
|
||||
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())
|
||||
{
|
||||
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())
|
||||
{
|
||||
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())
|
||||
{
|
||||
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() || !TvTEvent.onEscapeUse(target.getObjectId()))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_USE_SUMMONING_OR_TELEPORTING_IN_THIS_AREA);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (target.inObserverMode())
|
||||
{
|
||||
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))
|
||||
{
|
||||
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)
|
||||
{
|
||||
Instance summonerInstance = InstanceManager.getInstance().getInstance(activeChar.getInstanceId());
|
||||
if (!Config.ALLOW_SUMMON_TO_INSTANCE || !summonerInstance.isSummonAllowed())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_MAY_NOT_SUMMON_FROM_YOUR_CURRENT_LOCATION);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
53
trunk/dist/game/data/scripts/handlers/effecthandlers/CallSkill.java
vendored
Normal file
53
trunk/dist/game/data/scripts/handlers/effecthandlers/CallSkill.java
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.holders.SkillHolder;
|
||||
import com.l2jserver.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);
|
||||
}
|
||||
}
|
95
trunk/dist/game/data/scripts/handlers/effecthandlers/ChameleonRest.java
vendored
Normal file
95
trunk/dist/game/data/scripts/handlers/effecthandlers/ChameleonRest.java
vendored
Normal file
@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.ai.CtrlIntention;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.EffectFlag;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.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())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (info.getEffected().isPlayer())
|
||||
{
|
||||
if (!info.getEffected().getActingPlayer().isSitting())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
60
trunk/dist/game/data/scripts/handlers/effecthandlers/ChangeFace.java
vendored
Normal file
60
trunk/dist/game/data/scripts/handlers/effecthandlers/ChangeFace.java
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.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();
|
||||
}
|
||||
}
|
17
trunk/dist/game/data/scripts/handlers/effecthandlers/ChangeFishingMastery.java
vendored
Normal file
17
trunk/dist/game/data/scripts/handlers/effecthandlers/ChangeFishingMastery.java
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
package handlers.effecthandlers;
|
||||
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.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);
|
||||
}
|
||||
}
|
60
trunk/dist/game/data/scripts/handlers/effecthandlers/ChangeHairColor.java
vendored
Normal file
60
trunk/dist/game/data/scripts/handlers/effecthandlers/ChangeHairColor.java
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.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();
|
||||
}
|
||||
}
|
60
trunk/dist/game/data/scripts/handlers/effecthandlers/ChangeHairStyle.java
vendored
Normal file
60
trunk/dist/game/data/scripts/handlers/effecthandlers/ChangeHairStyle.java
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.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();
|
||||
}
|
||||
}
|
53
trunk/dist/game/data/scripts/handlers/effecthandlers/ClanGate.java
vendored
Normal file
53
trunk/dist/game/data/scripts/handlers/effecthandlers/ClanGate.java
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.L2Clan;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* Clan Gate effect implementation.
|
||||
* @author ZaKaX
|
||||
*/
|
||||
public final class ClanGate extends AbstractEffect
|
||||
{
|
||||
public ClanGate(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
||||
{
|
||||
super(attachCond, applyCond, set, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(BuffInfo info)
|
||||
{
|
||||
if (info.getEffected().isPlayer())
|
||||
{
|
||||
final L2Clan clan = info.getEffected().getActingPlayer().getClan();
|
||||
if (clan != null)
|
||||
{
|
||||
SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.COURT_WIZARD_THE_PORTAL_HAS_BEEN_CREATED);
|
||||
clan.broadcastToOtherOnlineMembers(msg, info.getEffected().getActingPlayer());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
88
trunk/dist/game/data/scripts/handlers/effecthandlers/ClassChange.java
vendored
Normal file
88
trunk/dist/game/data/scripts/handlers/effecthandlers/ClassChange.java
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.datatables.SkillData;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.model.skills.Skill;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ExSubjobInfo;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* @author Sdw
|
||||
*/
|
||||
public class ClassChange extends AbstractEffect
|
||||
{
|
||||
private final int _index;
|
||||
private final static 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 ExSubjobInfo(player));
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
}
|
103
trunk/dist/game/data/scripts/handlers/effecthandlers/Confuse.java
vendored
Normal file
103
trunk/dist/game/data/scripts/handlers/effecthandlers/Confuse.java
vendored
Normal file
@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.ai.CtrlEvent;
|
||||
import com.l2jserver.gameserver.ai.CtrlIntention;
|
||||
import com.l2jserver.gameserver.model.L2Object;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.EffectFlag;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.model.stats.Formulas;
|
||||
import com.l2jserver.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);
|
||||
}
|
||||
}
|
||||
}
|
54
trunk/dist/game/data/scripts/handlers/effecthandlers/ConsumeBody.java
vendored
Normal file
54
trunk/dist/game/data/scripts/handlers/effecthandlers/ConsumeBody.java
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Npc;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.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();
|
||||
}
|
||||
}
|
171
trunk/dist/game/data/scripts/handlers/effecthandlers/ConvertItem.java
vendored
Normal file
171
trunk/dist/game/data/scripts/handlers/effecthandlers/ConvertItem.java
vendored
Normal file
@ -0,0 +1,171 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.Elementals;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.itemcontainer.Inventory;
|
||||
import com.l2jserver.gameserver.model.items.L2Weapon;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.InventoryUpdate;
|
||||
import com.l2jserver.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.isEnchanting())
|
||||
{
|
||||
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());
|
||||
sm.addItemName(item);
|
||||
}
|
||||
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());
|
||||
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.sendPacket(u);
|
||||
|
||||
player.broadcastUserInfo();
|
||||
}
|
||||
}
|
74
trunk/dist/game/data/scripts/handlers/effecthandlers/CpDamPercent.java
vendored
Normal file
74
trunk/dist/game/data/scripts/handlers/effecthandlers/CpDamPercent.java
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
79
trunk/dist/game/data/scripts/handlers/effecthandlers/CpHeal.java
vendored
Normal file
79
trunk/dist/game/data/scripts/handlers/effecthandlers/CpHeal.java
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.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;
|
||||
}
|
||||
|
||||
double amount = _power;
|
||||
|
||||
// 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);
|
||||
}
|
||||
}
|
62
trunk/dist/game/data/scripts/handlers/effecthandlers/CpHealOverTime.java
vendored
Normal file
62
trunk/dist/game/data/scripts/handlers/effecthandlers/CpHealOverTime.java
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.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();
|
||||
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;
|
||||
}
|
||||
}
|
75
trunk/dist/game/data/scripts/handlers/effecthandlers/CpHealPercent.java
vendored
Normal file
75
trunk/dist/game/data/scripts/handlers/effecthandlers/CpHealPercent.java
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.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;
|
||||
double power = _power;
|
||||
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);
|
||||
}
|
||||
}
|
63
trunk/dist/game/data/scripts/handlers/effecthandlers/CrystalGradeModify.java
vendored
Normal file
63
trunk/dist/game/data/scripts/handlers/effecthandlers/CrystalGradeModify.java
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.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);
|
||||
}
|
||||
}
|
46
trunk/dist/game/data/scripts/handlers/effecthandlers/CubicMastery.java
vendored
Normal file
46
trunk/dist/game/data/scripts/handlers/effecthandlers/CubicMastery.java
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
package handlers.effecthandlers;
|
||||
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.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);
|
||||
}
|
||||
}
|
83
trunk/dist/game/data/scripts/handlers/effecthandlers/DamOverTime.java
vendored
Normal file
83
trunk/dist/game/data/scripts/handlers/effecthandlers/DamOverTime.java
vendored
Normal file
@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
* Dam Over Time effect implementation.
|
||||
*/
|
||||
public final class DamOverTime extends AbstractEffect
|
||||
{
|
||||
private final boolean _canKill;
|
||||
private final double _power;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@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().reduceCurrentHpByDOT(damage, info.getEffector(), info.getSkill());
|
||||
info.getEffected().notifyDamageReceived(damage, info.getEffector(), info.getSkill(), false, true);
|
||||
return info.getSkill().isToggle();
|
||||
}
|
||||
}
|
85
trunk/dist/game/data/scripts/handlers/effecthandlers/DamOverTimePercent.java
vendored
Normal file
85
trunk/dist/game/data/scripts/handlers/effecthandlers/DamOverTimePercent.java
vendored
Normal file
@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.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();
|
||||
}
|
||||
}
|
106
trunk/dist/game/data/scripts/handlers/effecthandlers/DeathLink.java
vendored
Normal file
106
trunk/dist/game/data/scripts/handlers/effecthandlers/DeathLink.java
vendored
Normal file
@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.enums.ShotType;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.model.stats.Formulas;
|
||||
import com.l2jserver.gameserver.model.stats.Stats;
|
||||
import com.l2jserver.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)
|
||||
{
|
||||
L2Character target = info.getEffected();
|
||||
L2Character activeChar = info.getEffector();
|
||||
|
||||
if (activeChar.isAlikeDead())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
boolean sps = info.getSkill().useSpiritShot() && activeChar.isChargedShot(ShotType.SPIRITSHOTS);
|
||||
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());
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
41
trunk/dist/game/data/scripts/handlers/effecthandlers/Debuff.java
vendored
Normal file
41
trunk/dist/game/data/scripts/handlers/effecthandlers/Debuff.java
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.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;
|
||||
}
|
||||
}
|
114
trunk/dist/game/data/scripts/handlers/effecthandlers/DefenceTrait.java
vendored
Normal file
114
trunk/dist/game/data/scripts/handlers/effecthandlers/DefenceTrait.java
vendored
Normal file
@ -0,0 +1,114 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.stat.CharStat;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.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()]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
76
trunk/dist/game/data/scripts/handlers/effecthandlers/DeleteHate.java
vendored
Normal file
76
trunk/dist/game/data/scripts/handlers/effecthandlers/DeleteHate.java
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.ai.CtrlIntention;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Attackable;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.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;
|
||||
}
|
||||
|
||||
L2Attackable target = (L2Attackable) info.getEffected();
|
||||
target.clearAggroList();
|
||||
target.setWalking();
|
||||
target.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
|
||||
}
|
||||
}
|
76
trunk/dist/game/data/scripts/handlers/effecthandlers/DeleteHateOfMe.java
vendored
Normal file
76
trunk/dist/game/data/scripts/handlers/effecthandlers/DeleteHateOfMe.java
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.ai.CtrlIntention;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Attackable;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.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;
|
||||
}
|
||||
|
||||
L2Attackable target = (L2Attackable) info.getEffected();
|
||||
target.stopHating(info.getEffector());
|
||||
target.setWalking();
|
||||
target.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
|
||||
}
|
||||
}
|
60
trunk/dist/game/data/scripts/handlers/effecthandlers/DetectHiddenObjects.java
vendored
Normal file
60
trunk/dist/game/data/scripts/handlers/effecthandlers/DetectHiddenObjects.java
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.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();
|
||||
}
|
||||
}
|
||||
}
|
78
trunk/dist/game/data/scripts/handlers/effecthandlers/Detection.java
vendored
Normal file
78
trunk/dist/game/data/scripts/handlers/effecthandlers/Detection.java
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.skills.AbnormalType;
|
||||
import com.l2jserver.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();
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
55
trunk/dist/game/data/scripts/handlers/effecthandlers/Disarm.java
vendored
Normal file
55
trunk/dist/game/data/scripts/handlers/effecthandlers/Disarm.java
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.EffectFlag;
|
||||
import com.l2jserver.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();
|
||||
}
|
||||
}
|
55
trunk/dist/game/data/scripts/handlers/effecthandlers/DispelAll.java
vendored
Normal file
55
trunk/dist/game/data/scripts/handlers/effecthandlers/DispelAll.java
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.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();
|
||||
}
|
||||
}
|
75
trunk/dist/game/data/scripts/handlers/effecthandlers/DispelByCategory.java
vendored
Normal file
75
trunk/dist/game/data/scripts/handlers/effecthandlers/DispelByCategory.java
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.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;
|
||||
}
|
||||
|
||||
final List<BuffInfo> canceled = Formulas.calcCancelStealEffects(info.getEffector(), info.getEffected(), info.getSkill(), _slot, _rate, _max);
|
||||
for (BuffInfo can : canceled)
|
||||
{
|
||||
info.getEffected().getEffectList().stopSkillEffects(true, can.getSkill());
|
||||
}
|
||||
}
|
||||
}
|
113
trunk/dist/game/data/scripts/handlers/effecthandlers/DispelBySlot.java
vendored
Normal file
113
trunk/dist/game/data/scripts/handlers/effecthandlers/DispelBySlot.java
vendored
Normal file
@ -0,0 +1,113 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.CharEffectList;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.gameserver.model.skills.AbnormalType;
|
||||
import com.l2jserver.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(";"))
|
||||
{
|
||||
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))
|
||||
{
|
||||
if (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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
118
trunk/dist/game/data/scripts/handlers/effecthandlers/DispelBySlotProbability.java
vendored
Normal file
118
trunk/dist/game/data/scripts/handlers/effecthandlers/DispelBySlotProbability.java
vendored
Normal file
@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.CharEffectList;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.gameserver.model.skills.AbnormalType;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.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(";"))
|
||||
{
|
||||
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 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))
|
||||
{
|
||||
if (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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
60
trunk/dist/game/data/scripts/handlers/effecthandlers/EnableCloak.java
vendored
Normal file
60
trunk/dist/game/data/scripts/handlers/effecthandlers/EnableCloak.java
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.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);
|
||||
}
|
||||
}
|
109
trunk/dist/game/data/scripts/handlers/effecthandlers/EnemyCharge.java
vendored
Normal file
109
trunk/dist/game/data/scripts/handlers/effecthandlers/EnemyCharge.java
vendored
Normal file
@ -0,0 +1,109 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.GeoData;
|
||||
import com.l2jserver.gameserver.model.Location;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.network.serverpackets.FlyToLocation;
|
||||
import com.l2jserver.gameserver.network.serverpackets.FlyToLocation.FlyType;
|
||||
import com.l2jserver.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
|
||||
double dx = info.getEffected().getX() - curX;
|
||||
double dy = info.getEffected().getY() - curY;
|
||||
double dz = info.getEffected().getZ() - curZ;
|
||||
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
|
||||
double sin = dy / distance;
|
||||
double cos = dx / distance;
|
||||
|
||||
// Calculate the new destination with offset included
|
||||
int x = curX + (int) ((distance - offset) * cos);
|
||||
int y = curY + (int) ((distance - offset) * sin);
|
||||
int z = info.getEffected().getZ();
|
||||
|
||||
if (Config.GEODATA > 0)
|
||||
{
|
||||
Location destiny = GeoData.getInstance().moveCheck(info.getEffector().getX(), info.getEffector().getY(), info.getEffector().getZ(), x, y, z, info.getEffector().getInstanceId());
|
||||
x = destiny.getX();
|
||||
y = destiny.getY();
|
||||
}
|
||||
info.getEffector().broadcastPacket(new FlyToLocation(info.getEffector(), x, y, z, FlyType.CHARGE));
|
||||
|
||||
// maybe is need force set X,Y,Z
|
||||
info.getEffector().setXYZ(x, y, z);
|
||||
info.getEffector().broadcastPacket(new ValidateLocation(info.getEffector()));
|
||||
}
|
||||
}
|
168
trunk/dist/game/data/scripts/handlers/effecthandlers/EnergyAttack.java
vendored
Normal file
168
trunk/dist/game/data/scripts/handlers/effecthandlers/EnergyAttack.java
vendored
Normal file
@ -0,0 +1,168 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.enums.ShotType;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.gameserver.model.items.L2Weapon;
|
||||
import com.l2jserver.gameserver.model.items.type.WeaponType;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.model.skills.Skill;
|
||||
import com.l2jserver.gameserver.model.stats.BaseStats;
|
||||
import com.l2jserver.gameserver.model.stats.Formulas;
|
||||
import com.l2jserver.gameserver.model.stats.Stats;
|
||||
import com.l2jserver.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);
|
||||
int defence = target.getPDef(attacker);
|
||||
|
||||
if (!_ignoreShieldDefence)
|
||||
{
|
||||
byte shield = Formulas.calcShldUse(attacker, target, skill, true);
|
||||
switch (shield)
|
||||
{
|
||||
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)
|
||||
{
|
||||
double damageMultiplier = Formulas.calcWeaponTraitBonus(attacker, target) * Formulas.calcAttributeBonus(attacker, target, skill) * Formulas.calcGeneralTraitBonus(attacker, target, skill.getTraitType(), true);
|
||||
|
||||
boolean ss = info.getSkill().useSoulShot() && attacker.isChargedShot(ShotType.SOULSHOTS);
|
||||
double ssBoost = ss ? 2 : 1.0;
|
||||
|
||||
double weaponTypeBoost;
|
||||
L2Weapon weapon = attacker.getActiveWeaponItem();
|
||||
if ((weapon != null) && ((weapon.getItemType() == WeaponType.BOW) || (weapon.getItemType() == WeaponType.CROSSBOW)))
|
||||
{
|
||||
weaponTypeBoost = 70;
|
||||
}
|
||||
else
|
||||
{
|
||||
weaponTypeBoost = 77;
|
||||
}
|
||||
|
||||
// charge count should be the count before casting the skill but since its reduced before calling effects
|
||||
// we add skill consume charges to current charges
|
||||
double energyChargesBoost = (((attacker.getCharges() + skill.getChargeConsume()) - 1) * 0.2) + 1;
|
||||
|
||||
attack += _power;
|
||||
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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
64
trunk/dist/game/data/scripts/handlers/effecthandlers/EnlargeAbnormalSlot.java
vendored
Normal file
64
trunk/dist/game/data/scripts/handlers/effecthandlers/EnlargeAbnormalSlot.java
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
|
||||
/**
|
||||
* Enlarge Abnormal Slot effect implementation.
|
||||
* @author Zoey76
|
||||
*/
|
||||
public final class EnlargeAbnormalSlot extends AbstractEffect
|
||||
{
|
||||
private final int _slots;
|
||||
|
||||
public EnlargeAbnormalSlot(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
||||
{
|
||||
super(attachCond, applyCond, set, 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(BuffInfo info)
|
||||
{
|
||||
info.getEffected().getStat().setMaxBuffCount(info.getEffected().getStat().getMaxBuffCount() + _slots);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActionTime(BuffInfo info)
|
||||
{
|
||||
return info.getSkill().isPassive();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(BuffInfo info)
|
||||
{
|
||||
info.getEffected().getStat().setMaxBuffCount(Math.max(0, info.getEffected().getStat().getMaxBuffCount() - _slots));
|
||||
}
|
||||
}
|
67
trunk/dist/game/data/scripts/handlers/effecthandlers/Escape.java
vendored
Normal file
67
trunk/dist/game/data/scripts/handlers/effecthandlers/Escape.java
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.instancemanager.MapRegionManager;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.TeleportWhereType;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.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;
|
||||
}
|
||||
|
||||
info.getEffected().teleToLocation(MapRegionManager.getInstance().getTeleToLocation(info.getEffected(), _escapeType), true);
|
||||
info.getEffected().setInstanceId(0);
|
||||
}
|
||||
}
|
92
trunk/dist/game/data/scripts/handlers/effecthandlers/FakeDeath.java
vendored
Normal file
92
trunk/dist/game/data/scripts/handlers/effecthandlers/FakeDeath.java
vendored
Normal file
@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ChangeWaitType;
|
||||
import com.l2jserver.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())
|
||||
{
|
||||
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().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();
|
||||
}
|
||||
}
|
102
trunk/dist/game/data/scripts/handlers/effecthandlers/FatalBlow.java
vendored
Normal file
102
trunk/dist/game/data/scripts/handlers/effecthandlers/FatalBlow.java
vendored
Normal file
@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.enums.ShotType;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.model.stats.BaseStats;
|
||||
import com.l2jserver.gameserver.model.stats.Formulas;
|
||||
|
||||
/**
|
||||
* Fatal Blow effect implementation.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public final class FatalBlow extends AbstractEffect
|
||||
{
|
||||
public FatalBlow(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
||||
{
|
||||
super(attachCond, applyCond, set, params);
|
||||
}
|
||||
|
||||
@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)
|
||||
{
|
||||
L2Character target = info.getEffected();
|
||||
L2Character activeChar = info.getEffector();
|
||||
|
||||
if (activeChar.isAlikeDead())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
boolean ss = info.getSkill().useSoulShot() && activeChar.isChargedShot(ShotType.SOULSHOTS);
|
||||
byte shld = Formulas.calcShldUse(activeChar, target, info.getSkill());
|
||||
double damage = Formulas.calcBlowDamage(activeChar, target, info.getSkill(), shld, ss);
|
||||
|
||||
// Crit rate base crit rate for skill, modified with STR bonus
|
||||
boolean crit = Formulas.calcCrit(info.getSkill().getBaseCritRate() * 10 * BaseStats.STR.calcBonus(activeChar), true, target);
|
||||
if (crit)
|
||||
{
|
||||
damage *= 2;
|
||||
}
|
||||
|
||||
target.reduceCurrentHp(damage, activeChar, info.getSkill());
|
||||
target.notifyDamageReceived(damage, activeChar, info.getSkill(), 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())
|
||||
{
|
||||
L2PcInstance activePlayer = activeChar.getActingPlayer();
|
||||
activePlayer.sendDamageMessage(target, (int) damage, false, true, false);
|
||||
}
|
||||
|
||||
// Check if damage should be reflected
|
||||
Formulas.calcDamageReflected(activeChar, target, info.getSkill(), true);
|
||||
}
|
||||
}
|
118
trunk/dist/game/data/scripts/handlers/effecthandlers/Fear.java
vendored
Normal file
118
trunk/dist/game/data/scripts/handlers/effecthandlers/Fear.java
vendored
Normal file
@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.GeoData;
|
||||
import com.l2jserver.gameserver.ai.CtrlEvent;
|
||||
import com.l2jserver.gameserver.ai.CtrlIntention;
|
||||
import com.l2jserver.gameserver.enums.Race;
|
||||
import com.l2jserver.gameserver.model.Location;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2DefenderInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2FortCommanderInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2SiegeFlagInstance;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.EffectFlag;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* Fear effect implementation.
|
||||
* @author littlecrow
|
||||
*/
|
||||
public final class Fear extends AbstractEffect
|
||||
{
|
||||
public static final int FEAR_RANGE = 500;
|
||||
|
||||
public Fear(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
||||
{
|
||||
super(attachCond, applyCond, set, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canStart(BuffInfo info)
|
||||
{
|
||||
return info.getEffected().isPlayer() || info.getEffected().isSummon() || (info.getEffected().isAttackable() && //
|
||||
!((info.getEffected() instanceof L2DefenderInstance) || (info.getEffected() instanceof L2FortCommanderInstance) || //
|
||||
(info.getEffected() instanceof L2SiegeFlagInstance) || (info.getEffected().getTemplate().getRace() == Race.SIEGE_WEAPON)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEffectFlags()
|
||||
{
|
||||
return EffectFlag.FEAR.getMask();
|
||||
}
|
||||
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.FEAR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTicks()
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActionTime(BuffInfo info)
|
||||
{
|
||||
fearAction(info, false);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(BuffInfo info)
|
||||
{
|
||||
if (info.getEffected().isCastingNow() && info.getEffected().canAbortCast())
|
||||
{
|
||||
info.getEffected().abortCast();
|
||||
}
|
||||
|
||||
info.getEffected().getAI().notifyEvent(CtrlEvent.EVT_AFRAID);
|
||||
fearAction(info, true);
|
||||
}
|
||||
|
||||
private void fearAction(BuffInfo info, boolean start)
|
||||
{
|
||||
double radians = Math.toRadians(start ? Util.calculateAngleFrom(info.getEffector(), info.getEffected()) : Util.convertHeadingToDegree(info.getEffected().getHeading()));
|
||||
|
||||
int posX = (int) (info.getEffected().getX() + (FEAR_RANGE * Math.cos(radians)));
|
||||
int posY = (int) (info.getEffected().getY() + (FEAR_RANGE * Math.sin(radians)));
|
||||
int posZ = info.getEffected().getZ();
|
||||
|
||||
if (Config.GEODATA > 0)
|
||||
{
|
||||
Location destiny = GeoData.getInstance().moveCheck(info.getEffected().getX(), info.getEffected().getY(), info.getEffected().getZ(), posX, posY, posZ, info.getEffected().getInstanceId());
|
||||
posX = destiny.getX();
|
||||
posY = destiny.getY();
|
||||
}
|
||||
|
||||
if (!info.getEffected().isPet())
|
||||
{
|
||||
info.getEffected().setRunning();
|
||||
}
|
||||
|
||||
info.getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(posX, posY, posZ));
|
||||
}
|
||||
}
|
272
trunk/dist/game/data/scripts/handlers/effecthandlers/Fishing.java
vendored
Normal file
272
trunk/dist/game/data/scripts/handlers/effecthandlers/Fishing.java
vendored
Normal file
@ -0,0 +1,272 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.GeoData;
|
||||
import com.l2jserver.gameserver.instancemanager.ZoneManager;
|
||||
import com.l2jserver.gameserver.model.PcCondOverride;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.gameserver.model.itemcontainer.Inventory;
|
||||
import com.l2jserver.gameserver.model.items.L2Weapon;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.model.items.type.EtcItemType;
|
||||
import com.l2jserver.gameserver.model.items.type.WeaponType;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.model.zone.L2ZoneType;
|
||||
import com.l2jserver.gameserver.model.zone.ZoneId;
|
||||
import com.l2jserver.gameserver.model.zone.type.L2FishingZone;
|
||||
import com.l2jserver.gameserver.model.zone.type.L2WaterZone;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.util.Util;
|
||||
import com.l2jserver.util.Rnd;
|
||||
|
||||
/**
|
||||
* Fishing effect implementation.
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public final class Fishing extends AbstractEffect
|
||||
{
|
||||
private static final int MIN_BAIT_DISTANCE = 90;
|
||||
private static final int MAX_BAIT_DISTANCE = 250;
|
||||
|
||||
public Fishing(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
||||
{
|
||||
super(attachCond, applyCond, set, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInstant()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.FISHING_START;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(BuffInfo info)
|
||||
{
|
||||
final L2Character activeChar = info.getEffector();
|
||||
if (!activeChar.isPlayer())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2PcInstance player = activeChar.getActingPlayer();
|
||||
|
||||
if (!Config.ALLOWFISHING && !player.canOverrideCond(PcCondOverride.SKILL_CONDITIONS))
|
||||
{
|
||||
player.sendMessage("Fishing is disabled!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.isFishing())
|
||||
{
|
||||
if (player.getFishCombat() != null)
|
||||
{
|
||||
player.getFishCombat().doDie(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.endFishing(false);
|
||||
}
|
||||
|
||||
player.sendPacket(SystemMessageId.YOUR_ATTEMPT_AT_FISHING_HAS_BEEN_CANCELLED);
|
||||
return;
|
||||
}
|
||||
|
||||
// check for equiped fishing rod
|
||||
L2Weapon equipedWeapon = player.getActiveWeaponItem();
|
||||
if (((equipedWeapon == null) || (equipedWeapon.getItemType() != WeaponType.FISHINGROD)))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_A_FISHING_POLE_EQUIPPED);
|
||||
return;
|
||||
}
|
||||
|
||||
// check for equiped lure
|
||||
L2ItemInstance equipedLeftHand = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LHAND);
|
||||
if ((equipedLeftHand == null) || (equipedLeftHand.getItemType() != EtcItemType.LURE))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_MUST_PUT_BAIT_ON_YOUR_HOOK_BEFORE_YOU_CAN_FISH);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player.isGM())
|
||||
{
|
||||
if (player.isInBoat())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_FISH_WHEN_TRANSFORMED_OR_WHILE_RIDING_AS_A_PASSENGER_OF_A_BOAT_IT_S_AGAINST_THE_RULES);
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.isInCraftMode() || player.isInStoreMode())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_FISH_WHILE_USING_A_RECIPE_BOOK_PRIVATE_WORKSHOP_OR_PRIVATE_STORE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.isInsideZone(ZoneId.WATER))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_FISH_WHILE_UNDER_WATER);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// calculate a position in front of the player with a random distance
|
||||
int distance = Rnd.get(MIN_BAIT_DISTANCE, MAX_BAIT_DISTANCE);
|
||||
final double angle = Util.convertHeadingToDegree(player.getHeading());
|
||||
final double radian = Math.toRadians(angle);
|
||||
final double sin = Math.sin(radian);
|
||||
final double cos = Math.cos(radian);
|
||||
int baitX = (int) (player.getX() + (cos * distance));
|
||||
int baitY = (int) (player.getY() + (sin * distance));
|
||||
|
||||
// search for fishing and water zone
|
||||
L2FishingZone fishingZone = null;
|
||||
L2WaterZone waterZone = null;
|
||||
for (final L2ZoneType zone : ZoneManager.getInstance().getZones(baitX, baitY))
|
||||
{
|
||||
if (zone instanceof L2FishingZone)
|
||||
{
|
||||
fishingZone = (L2FishingZone) zone;
|
||||
}
|
||||
else if (zone instanceof L2WaterZone)
|
||||
{
|
||||
waterZone = (L2WaterZone) zone;
|
||||
}
|
||||
|
||||
if ((fishingZone != null) && (waterZone != null))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int baitZ = computeBaitZ(player, baitX, baitY, fishingZone, waterZone);
|
||||
if (baitZ == Integer.MIN_VALUE)
|
||||
{
|
||||
for (distance = MAX_BAIT_DISTANCE; distance >= MIN_BAIT_DISTANCE; --distance)
|
||||
{
|
||||
baitX = (int) (player.getX() + (cos * distance));
|
||||
baitY = (int) (player.getY() + (sin * distance));
|
||||
|
||||
// search for fishing and water zone again
|
||||
fishingZone = null;
|
||||
waterZone = null;
|
||||
for (final L2ZoneType zone : ZoneManager.getInstance().getZones(baitX, baitY))
|
||||
{
|
||||
if (zone instanceof L2FishingZone)
|
||||
{
|
||||
fishingZone = (L2FishingZone) zone;
|
||||
}
|
||||
else if (zone instanceof L2WaterZone)
|
||||
{
|
||||
waterZone = (L2WaterZone) zone;
|
||||
}
|
||||
|
||||
if ((fishingZone != null) && (waterZone != null))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
baitZ = computeBaitZ(player, baitX, baitY, fishingZone, waterZone);
|
||||
if (baitZ != Integer.MIN_VALUE)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (baitZ == Integer.MIN_VALUE)
|
||||
{
|
||||
if (player.isGM())
|
||||
{
|
||||
baitZ = player.getZ();
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CAN_T_FISH_HERE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!player.destroyItem("Fishing", equipedLeftHand, 1, null, false))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_BAIT);
|
||||
return;
|
||||
}
|
||||
|
||||
player.setLure(equipedLeftHand);
|
||||
player.startFishing(baitX, baitY, baitZ);
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the Z of the bait.
|
||||
* @param player the player
|
||||
* @param baitX the bait x
|
||||
* @param baitY the bait y
|
||||
* @param fishingZone the fishing zone
|
||||
* @param waterZone the water zone
|
||||
* @return the bait z or {@link Integer#MIN_VALUE} when you cannot fish here
|
||||
*/
|
||||
private static int computeBaitZ(final L2PcInstance player, final int baitX, final int baitY, final L2FishingZone fishingZone, final L2WaterZone waterZone)
|
||||
{
|
||||
if ((fishingZone == null))
|
||||
{
|
||||
return Integer.MIN_VALUE;
|
||||
}
|
||||
|
||||
if ((waterZone == null))
|
||||
{
|
||||
return Integer.MIN_VALUE;
|
||||
}
|
||||
|
||||
// always use water zone, fishing zone high z is high in the air...
|
||||
int baitZ = waterZone.getWaterZ();
|
||||
|
||||
if (!GeoData.getInstance().canSeeTarget(player.getX(), player.getY(), player.getZ(), baitX, baitY, baitZ))
|
||||
{
|
||||
return Integer.MIN_VALUE;
|
||||
}
|
||||
|
||||
if (GeoData.getInstance().hasGeo(baitX, baitY))
|
||||
{
|
||||
if (GeoData.getInstance().getHeight(baitX, baitY, baitZ) > baitZ)
|
||||
{
|
||||
return Integer.MIN_VALUE;
|
||||
}
|
||||
|
||||
if (GeoData.getInstance().getHeight(baitX, baitY, player.getZ()) > baitZ)
|
||||
{
|
||||
return Integer.MIN_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
return baitZ;
|
||||
}
|
||||
}
|
54
trunk/dist/game/data/scripts/handlers/effecthandlers/Flag.java
vendored
Normal file
54
trunk/dist/game/data/scripts/handlers/effecthandlers/Flag.java
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
|
||||
/**
|
||||
* Flag effect implementation.
|
||||
* @author BiggBoss
|
||||
*/
|
||||
public final class Flag extends AbstractEffect
|
||||
{
|
||||
public Flag(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)
|
||||
{
|
||||
info.getEffected().getActingPlayer().updatePvPFlag(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(BuffInfo info)
|
||||
{
|
||||
info.getEffected().updatePvPFlag(1);
|
||||
}
|
||||
}
|
57
trunk/dist/game/data/scripts/handlers/effecthandlers/FocusEnergy.java
vendored
Normal file
57
trunk/dist/game/data/scripts/handlers/effecthandlers/FocusEnergy.java
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
|
||||
/**
|
||||
* Focus Energy effect implementation.
|
||||
* @author DS
|
||||
*/
|
||||
public final class FocusEnergy extends AbstractEffect
|
||||
{
|
||||
private final int _charge;
|
||||
|
||||
public FocusEnergy(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
||||
{
|
||||
super(attachCond, applyCond, set, params);
|
||||
|
||||
_charge = params.getInt("charge", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInstant()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(BuffInfo info)
|
||||
{
|
||||
if (!info.getEffected().isPlayer())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
info.getEffected().getActingPlayer().increaseCharges(1, _charge);
|
||||
}
|
||||
}
|
59
trunk/dist/game/data/scripts/handlers/effecthandlers/FocusMaxEnergy.java
vendored
Normal file
59
trunk/dist/game/data/scripts/handlers/effecthandlers/FocusMaxEnergy.java
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* Focus Max Energy effect implementation.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public final class FocusMaxEnergy extends AbstractEffect
|
||||
{
|
||||
public FocusMaxEnergy(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().isPlayer())
|
||||
{
|
||||
final Skill sonicMastery = info.getEffected().getSkills().get(992);
|
||||
final Skill focusMastery = info.getEffected().getSkills().get(993);
|
||||
int maxCharge = (sonicMastery != null) ? sonicMastery.getLevel() : (focusMastery != null) ? focusMastery.getLevel() : 0;
|
||||
if (maxCharge != 0)
|
||||
{
|
||||
int count = maxCharge - info.getEffected().getActingPlayer().getCharges();
|
||||
info.getEffected().getActingPlayer().increaseCharges(count, maxCharge);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
74
trunk/dist/game/data/scripts/handlers/effecthandlers/FocusSouls.java
vendored
Normal file
74
trunk/dist/game/data/scripts/handlers/effecthandlers/FocusSouls.java
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.model.stats.Stats;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
* Focus Souls effect implementation.
|
||||
* @author nBd, Adry_85
|
||||
*/
|
||||
public final class FocusSouls extends AbstractEffect
|
||||
{
|
||||
private final int _charge;
|
||||
|
||||
public FocusSouls(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
||||
{
|
||||
super(attachCond, applyCond, set, params);
|
||||
|
||||
_charge = params.getInt("charge", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInstant()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(BuffInfo info)
|
||||
{
|
||||
if (!info.getEffected().isPlayer() || info.getEffected().isAlikeDead())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2PcInstance target = info.getEffected().getActingPlayer();
|
||||
final int maxSouls = (int) target.calcStat(Stats.MAX_SOULS, 0, null, null);
|
||||
if (maxSouls > 0)
|
||||
{
|
||||
int amount = _charge;
|
||||
if ((target.getChargedSouls() < maxSouls))
|
||||
{
|
||||
int count = ((target.getChargedSouls() + amount) <= maxSouls) ? amount : (maxSouls - target.getChargedSouls());
|
||||
target.increaseSouls(count);
|
||||
}
|
||||
else
|
||||
{
|
||||
target.sendPacket(SystemMessageId.SOUL_CANNOT_BE_INCREASED_ANYMORE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
60
trunk/dist/game/data/scripts/handlers/effecthandlers/GetAgro.java
vendored
Normal file
60
trunk/dist/game/data/scripts/handlers/effecthandlers/GetAgro.java
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.ai.CtrlIntention;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Attackable;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
|
||||
/**
|
||||
* Get Agro effect implementation.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public final class GetAgro extends AbstractEffect
|
||||
{
|
||||
public GetAgro(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
||||
{
|
||||
super(attachCond, applyCond, set, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.AGGRESSION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInstant()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(BuffInfo info)
|
||||
{
|
||||
if (info.getEffected() instanceof L2Attackable)
|
||||
{
|
||||
info.getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, info.getEffector());
|
||||
}
|
||||
}
|
||||
}
|
89
trunk/dist/game/data/scripts/handlers/effecthandlers/GiveRecommendation.java
vendored
Normal file
89
trunk/dist/game/data/scripts/handlers/effecthandlers/GiveRecommendation.java
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ExVoteSystemInfo;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jserver.gameserver.network.serverpackets.UserInfo;
|
||||
|
||||
/**
|
||||
* Give Recommendation effect implementation.
|
||||
* @author NosBit
|
||||
*/
|
||||
public final class GiveRecommendation extends AbstractEffect
|
||||
{
|
||||
private final int _amount;
|
||||
|
||||
public GiveRecommendation(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
||||
{
|
||||
super(attachCond, applyCond, set, params);
|
||||
|
||||
_amount = params.getInt("amount", 0);
|
||||
if (_amount == 0)
|
||||
{
|
||||
_log.warning(getClass().getSimpleName() + ": amount parameter is missing or set to 0. id:" + set.getInt("id", -1));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInstant()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(BuffInfo info)
|
||||
{
|
||||
L2PcInstance target = info.getEffected() instanceof L2PcInstance ? (L2PcInstance) info.getEffected() : null;
|
||||
if (target != null)
|
||||
{
|
||||
int recommendationsGiven = _amount;
|
||||
|
||||
if ((target.getRecomHave() + _amount) >= 255)
|
||||
{
|
||||
recommendationsGiven = 255 - target.getRecomHave();
|
||||
}
|
||||
|
||||
if (recommendationsGiven > 0)
|
||||
{
|
||||
target.setRecomHave(target.getRecomHave() + recommendationsGiven);
|
||||
|
||||
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_OBTAINED_S1_RECOMMENDATION_S);
|
||||
sm.addInt(recommendationsGiven);
|
||||
target.sendPacket(sm);
|
||||
target.sendPacket(new UserInfo(target));
|
||||
target.sendPacket(new ExVoteSystemInfo(target));
|
||||
}
|
||||
else
|
||||
{
|
||||
L2PcInstance player = info.getEffector() instanceof L2PcInstance ? (L2PcInstance) info.getEffector() : null;
|
||||
if (player != null)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.NOTHING_HAPPENED);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
57
trunk/dist/game/data/scripts/handlers/effecthandlers/GiveSp.java
vendored
Normal file
57
trunk/dist/game/data/scripts/handlers/effecthandlers/GiveSp.java
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
|
||||
/**
|
||||
* Give SP effect implementation.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public final class GiveSp extends AbstractEffect
|
||||
{
|
||||
private final int _sp;
|
||||
|
||||
public GiveSp(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
||||
{
|
||||
super(attachCond, applyCond, set, params);
|
||||
|
||||
_sp = params.getInt("sp", 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(0, _sp);
|
||||
}
|
||||
}
|
65
trunk/dist/game/data/scripts/handlers/effecthandlers/Grow.java
vendored
Normal file
65
trunk/dist/game/data/scripts/handlers/effecthandlers/Grow.java
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Npc;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
|
||||
/**
|
||||
* Grow effect implementation.
|
||||
*/
|
||||
public final class Grow extends AbstractEffect
|
||||
{
|
||||
public Grow(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)
|
||||
{
|
||||
if (info.getEffected().isNpc())
|
||||
{
|
||||
L2Npc npc = (L2Npc) info.getEffected();
|
||||
npc.setCollisionHeight(npc.getTemplate().getCollisionHeight());
|
||||
npc.setCollisionRadius(npc.getTemplate().getfCollisionRadius());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(BuffInfo info)
|
||||
{
|
||||
if (info.getEffected().isNpc())
|
||||
{
|
||||
L2Npc npc = (L2Npc) info.getEffected();
|
||||
npc.setCollisionHeight(npc.getTemplate().getCollisionHeightGrown());
|
||||
npc.setCollisionRadius(npc.getTemplate().getCollisionRadiusGrown());
|
||||
}
|
||||
}
|
||||
}
|
145
trunk/dist/game/data/scripts/handlers/effecthandlers/Harvesting.java
vendored
Normal file
145
trunk/dist/game/data/scripts/handlers/effecthandlers/Harvesting.java
vendored
Normal file
@ -0,0 +1,145 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2MonsterInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.holders.ItemHolder;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jserver.util.Rnd;
|
||||
|
||||
/**
|
||||
* Harvesting effect implementation.
|
||||
* @author l3x, Zoey76
|
||||
*/
|
||||
public final class Harvesting extends AbstractEffect
|
||||
{
|
||||
public Harvesting(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.getEffector().isPlayer() || !info.getEffected().isMonster() || !info.getEffected().isDead())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2PcInstance player = info.getEffector().getActingPlayer();
|
||||
final L2MonsterInstance monster = (L2MonsterInstance) info.getEffected();
|
||||
if (player.getObjectId() != monster.getSeederId())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_ARE_NOT_AUTHORIZED_TO_HARVEST);
|
||||
}
|
||||
else if (monster.isSeeded())
|
||||
{
|
||||
if (calcSuccess(player, monster))
|
||||
{
|
||||
final ItemHolder item = monster.takeHarvest();
|
||||
if (item != null)
|
||||
{
|
||||
// Add item
|
||||
player.getInventory().addItem("Harvesting", item.getId(), item.getCount(), player, monster);
|
||||
|
||||
// Send system msg
|
||||
SystemMessage sm = null;
|
||||
if (item.getCount() == 1)
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_OBTAINED_S1);
|
||||
sm.addItemName(item.getId());
|
||||
}
|
||||
else
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_OBTAINED_S2_S1);
|
||||
sm.addItemName(item.getId());
|
||||
sm.addLong(item.getCount());
|
||||
}
|
||||
player.sendPacket(sm);
|
||||
|
||||
// Send msg to party
|
||||
if (player.isInParty())
|
||||
{
|
||||
if (item.getCount() == 1)
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HARVESTED_S2);
|
||||
sm.addString(player.getName());
|
||||
sm.addItemName(item.getId());
|
||||
}
|
||||
else
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HARVESTED_S3_S2_S);
|
||||
sm.addString(player.getName());
|
||||
sm.addLong(item.getCount());
|
||||
sm.addItemName(item.getId());
|
||||
}
|
||||
player.getParty().broadcastToPartyMembers(player, sm);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendPacket(SystemMessageId.THE_HARVEST_HAS_FAILED);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendPacket(SystemMessageId.THE_HARVEST_FAILED_BECAUSE_THE_SEED_WAS_NOT_SOWN);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean calcSuccess(L2PcInstance activeChar, L2MonsterInstance target)
|
||||
{
|
||||
final int levelPlayer = activeChar.getLevel();
|
||||
final int levelTarget = target.getLevel();
|
||||
|
||||
int diff = (levelPlayer - levelTarget);
|
||||
if (diff < 0)
|
||||
{
|
||||
diff = -diff;
|
||||
}
|
||||
|
||||
// apply penalty, target <=> player levels
|
||||
// 5% penalty for each level
|
||||
int basicSuccess = 100;
|
||||
if (diff > 5)
|
||||
{
|
||||
basicSuccess -= (diff - 5) * 5;
|
||||
}
|
||||
|
||||
// success rate can't be less than 1%
|
||||
if (basicSuccess < 1)
|
||||
{
|
||||
basicSuccess = 1;
|
||||
}
|
||||
return Rnd.nextInt(99) < basicSuccess;
|
||||
}
|
||||
}
|
88
trunk/dist/game/data/scripts/handlers/effecthandlers/HeadquarterCreate.java
vendored
Normal file
88
trunk/dist/game/data/scripts/handlers/effecthandlers/HeadquarterCreate.java
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.datatables.NpcData;
|
||||
import com.l2jserver.gameserver.idfactory.IdFactory;
|
||||
import com.l2jserver.gameserver.instancemanager.CHSiegeManager;
|
||||
import com.l2jserver.gameserver.instancemanager.CastleManager;
|
||||
import com.l2jserver.gameserver.instancemanager.FortManager;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2SiegeFlagInstance;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.entity.Castle;
|
||||
import com.l2jserver.gameserver.model.entity.Fort;
|
||||
import com.l2jserver.gameserver.model.entity.clanhall.SiegableHall;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
|
||||
/**
|
||||
* Headquarter Create effect implementation.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public final class HeadquarterCreate extends AbstractEffect
|
||||
{
|
||||
private static final int HQ_NPC_ID = 35062;
|
||||
private final boolean _isAdvanced;
|
||||
|
||||
public HeadquarterCreate(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
||||
{
|
||||
super(attachCond, applyCond, set, params);
|
||||
|
||||
_isAdvanced = params.getBoolean("isAdvanced", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInstant()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(BuffInfo info)
|
||||
{
|
||||
final L2PcInstance player = info.getEffector().getActingPlayer();
|
||||
if ((player.getClan() == null) || (player.getClan().getLeaderId() != player.getObjectId()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2SiegeFlagInstance flag = new L2SiegeFlagInstance(player, IdFactory.getInstance().getNextId(), NpcData.getInstance().getTemplate(HQ_NPC_ID), _isAdvanced, false);
|
||||
flag.setTitle(player.getClan().getName());
|
||||
flag.setCurrentHpMp(flag.getMaxHp(), flag.getMaxMp());
|
||||
flag.setHeading(player.getHeading());
|
||||
flag.spawnMe(player.getX(), player.getY(), player.getZ() + 50);
|
||||
final Castle castle = CastleManager.getInstance().getCastle(player);
|
||||
final Fort fort = FortManager.getInstance().getFort(player);
|
||||
final SiegableHall hall = CHSiegeManager.getInstance().getNearbyClanHall(player);
|
||||
if (castle != null)
|
||||
{
|
||||
castle.getSiege().getFlag(player.getClan()).add(flag);
|
||||
}
|
||||
else if (fort != null)
|
||||
{
|
||||
fort.getSiege().getFlag(player.getClan()).add(flag);
|
||||
}
|
||||
else
|
||||
{
|
||||
hall.getSiege().getFlag(player.getClan()).add(flag);
|
||||
}
|
||||
}
|
||||
}
|
151
trunk/dist/game/data/scripts/handlers/effecthandlers/Heal.java
vendored
Normal file
151
trunk/dist/game/data/scripts/handlers/effecthandlers/Heal.java
vendored
Normal file
@ -0,0 +1,151 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.enums.ShotType;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.model.items.type.CrystalType;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.model.stats.Formulas;
|
||||
import com.l2jserver.gameserver.model.stats.Stats;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ExMagicAttackInfo;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* Heal effect implementation.
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public final class Heal extends AbstractEffect
|
||||
{
|
||||
private final double _power;
|
||||
|
||||
public Heal(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
||||
{
|
||||
super(attachCond, applyCond, set, params);
|
||||
|
||||
_power = params.getDouble("power", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.HEAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInstant()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(BuffInfo info)
|
||||
{
|
||||
L2Character target = info.getEffected();
|
||||
L2Character activeChar = info.getEffector();
|
||||
if ((target == null) || target.isDead() || target.isDoor() || target.isInvul())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
double amount = _power;
|
||||
double staticShotBonus = 0;
|
||||
int mAtkMul = 1;
|
||||
boolean sps = info.getSkill().isMagic() && activeChar.isChargedShot(ShotType.SPIRITSHOTS);
|
||||
boolean bss = info.getSkill().isMagic() && activeChar.isChargedShot(ShotType.BLESSED_SPIRITSHOTS);
|
||||
|
||||
if (((sps || bss) && (activeChar.isPlayer() && activeChar.getActingPlayer().isMageClass())) || activeChar.isSummon())
|
||||
{
|
||||
staticShotBonus = info.getSkill().getMpConsume(); // static bonus for spiritshots
|
||||
mAtkMul = bss ? 4 : 2;
|
||||
staticShotBonus *= bss ? 2.4 : 1.0;
|
||||
}
|
||||
else if ((sps || bss) && activeChar.isNpc())
|
||||
{
|
||||
staticShotBonus = 2.4 * info.getSkill().getMpConsume(); // always blessed spiritshots
|
||||
mAtkMul = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
// no static bonus
|
||||
// grade dynamic bonus
|
||||
final L2ItemInstance weaponInst = activeChar.getActiveWeaponInstance();
|
||||
if (weaponInst != null)
|
||||
{
|
||||
mAtkMul = weaponInst.getItem().getItemGrade() == CrystalType.S84 ? 4 : weaponInst.getItem().getItemGrade() == CrystalType.S80 ? 2 : 1;
|
||||
}
|
||||
// shot dynamic bonus
|
||||
mAtkMul = bss ? mAtkMul * 4 : mAtkMul + 1;
|
||||
}
|
||||
|
||||
if (!info.getSkill().isStatic())
|
||||
{
|
||||
amount += staticShotBonus + Math.sqrt(mAtkMul * activeChar.getMAtk(activeChar, null));
|
||||
amount = target.calcStat(Stats.HEAL_EFFECT, amount, null, null);
|
||||
// Heal critic, since CT2.3 Gracia Final
|
||||
if (info.getSkill().isMagic() && Formulas.calcMCrit(activeChar.getMCriticalHit(target, info.getSkill())))
|
||||
{
|
||||
amount *= 3;
|
||||
activeChar.sendPacket(SystemMessageId.M_CRITICAL);
|
||||
activeChar.sendPacket(new ExMagicAttackInfo(activeChar.getObjectId(), target.getObjectId(), ExMagicAttackInfo.CRITICAL_HEAL));
|
||||
if (target.isPlayer() && (target != activeChar))
|
||||
{
|
||||
target.sendPacket(new ExMagicAttackInfo(activeChar.getObjectId(), target.getObjectId(), ExMagicAttackInfo.CRITICAL_HEAL));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Prevents overheal and negative amount
|
||||
amount = Math.max(Math.min(amount, target.getMaxRecoverableHp() - target.getCurrentHp()), 0);
|
||||
if (amount != 0)
|
||||
{
|
||||
target.setCurrentHp(amount + target.getCurrentHp());
|
||||
}
|
||||
|
||||
if (target.isPlayer())
|
||||
{
|
||||
if (info.getSkill().getId() == 4051)
|
||||
{
|
||||
target.sendPacket(SystemMessageId.REJUVENATING_HP);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (activeChar.isPlayer() && (activeChar != target))
|
||||
{
|
||||
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S2_HP_HAS_BEEN_RESTORED_BY_C1);
|
||||
sm.addString(activeChar.getName());
|
||||
sm.addInt((int) amount);
|
||||
target.sendPacket(sm);
|
||||
}
|
||||
else
|
||||
{
|
||||
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_HP_HAS_BEEN_RESTORED);
|
||||
sm.addInt((int) amount);
|
||||
target.sendPacket(sm);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
73
trunk/dist/game/data/scripts/handlers/effecthandlers/HealOverTime.java
vendored
Normal file
73
trunk/dist/game/data/scripts/handlers/effecthandlers/HealOverTime.java
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.skills.AbnormalType;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ExRegenMax;
|
||||
|
||||
/**
|
||||
* Heal Over Time effect implementation.
|
||||
*/
|
||||
public final class HealOverTime extends AbstractEffect
|
||||
{
|
||||
private final double _power;
|
||||
|
||||
public HealOverTime(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() || info.getEffected().isDoor())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
double hp = info.getEffected().getCurrentHp();
|
||||
double maxhp = info.getEffected().getMaxRecoverableHp();
|
||||
|
||||
// Not needed to set the HP and send update packet if player is already at max HP
|
||||
if (hp >= maxhp)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
hp += _power * getTicksMultiplier();
|
||||
hp = Math.min(hp, maxhp);
|
||||
info.getEffected().setCurrentHp(hp);
|
||||
return info.getSkill().isToggle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(BuffInfo info)
|
||||
{
|
||||
if (info.getEffected().isPlayer() && (getTicks() > 0) && (info.getSkill().getAbnormalType() == AbnormalType.HP_RECOVER))
|
||||
{
|
||||
info.getEffected().sendPacket(new ExRegenMax(info.getAbnormalTime(), getTicks(), _power));
|
||||
}
|
||||
}
|
||||
}
|
90
trunk/dist/game/data/scripts/handlers/effecthandlers/HealPercent.java
vendored
Normal file
90
trunk/dist/game/data/scripts/handlers/effecthandlers/HealPercent.java
vendored
Normal file
@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* Heal Percent effect implementation.
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public final class HealPercent extends AbstractEffect
|
||||
{
|
||||
private final int _power;
|
||||
|
||||
public HealPercent(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
||||
{
|
||||
super(attachCond, applyCond, set, params);
|
||||
|
||||
_power = params.getInt("power", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.HEAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInstant()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(BuffInfo info)
|
||||
{
|
||||
L2Character target = info.getEffected();
|
||||
if ((target == null) || target.isDead() || target.isDoor())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
double amount = 0;
|
||||
double power = _power;
|
||||
boolean full = (power == 100.0);
|
||||
|
||||
amount = full ? target.getMaxHp() : (target.getMaxHp() * power) / 100.0;
|
||||
// Prevents overheal and negative amount
|
||||
amount = Math.max(Math.min(amount, target.getMaxRecoverableHp() - target.getCurrentHp()), 0);
|
||||
if (amount != 0)
|
||||
{
|
||||
target.setCurrentHp(amount + target.getCurrentHp());
|
||||
}
|
||||
SystemMessage sm;
|
||||
if (info.getEffector().getObjectId() != target.getObjectId())
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.S2_HP_HAS_BEEN_RESTORED_BY_C1);
|
||||
sm.addCharName(info.getEffector());
|
||||
}
|
||||
else
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_HP_HAS_BEEN_RESTORED);
|
||||
}
|
||||
sm.addInt((int) amount);
|
||||
target.sendPacket(sm);
|
||||
}
|
||||
}
|
78
trunk/dist/game/data/scripts/handlers/effecthandlers/Hide.java
vendored
Normal file
78
trunk/dist/game/data/scripts/handlers/effecthandlers/Hide.java
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.ai.CtrlIntention;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
|
||||
/**
|
||||
* Hide effect implementation.
|
||||
* @author ZaKaX, nBd
|
||||
*/
|
||||
public final class Hide extends AbstractEffect
|
||||
{
|
||||
public Hide(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
||||
{
|
||||
super(attachCond, applyCond, set, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(BuffInfo info)
|
||||
{
|
||||
if (info.getEffected().isPlayer())
|
||||
{
|
||||
L2PcInstance activeChar = info.getEffected().getActingPlayer();
|
||||
if (!activeChar.inObserverMode())
|
||||
{
|
||||
activeChar.setInvisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(BuffInfo info)
|
||||
{
|
||||
if (info.getEffected().isPlayer())
|
||||
{
|
||||
L2PcInstance activeChar = info.getEffected().getActingPlayer();
|
||||
activeChar.setInvisible(true);
|
||||
|
||||
if ((activeChar.getAI().getNextIntention() != null) && (activeChar.getAI().getNextIntention().getCtrlIntention() == CtrlIntention.AI_INTENTION_ATTACK))
|
||||
{
|
||||
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
|
||||
}
|
||||
|
||||
for (L2Character target : activeChar.getKnownList().getKnownCharacters())
|
||||
{
|
||||
if ((target != null) && (target.getTarget() == activeChar))
|
||||
{
|
||||
target.setTarget(null);
|
||||
target.abortAttack();
|
||||
target.abortCast();
|
||||
target.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
74
trunk/dist/game/data/scripts/handlers/effecthandlers/HpByLevel.java
vendored
Normal file
74
trunk/dist/game/data/scripts/handlers/effecthandlers/HpByLevel.java
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* Hp By Level effect implementation.
|
||||
* @author Zoey76
|
||||
*/
|
||||
public final class HpByLevel extends AbstractEffect
|
||||
{
|
||||
private final double _power;
|
||||
|
||||
public HpByLevel(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
||||
{
|
||||
super(attachCond, applyCond, set, params);
|
||||
|
||||
_power = params.getDouble("power", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.BUFF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInstant()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(BuffInfo info)
|
||||
{
|
||||
if (info.getEffector() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Calculation
|
||||
final double abs = _power;
|
||||
final double absorb = ((info.getEffector().getCurrentHp() + abs) > info.getEffector().getMaxHp() ? info.getEffector().getMaxHp() : (info.getEffector().getCurrentHp() + abs));
|
||||
final int restored = (int) (absorb - info.getEffector().getCurrentHp());
|
||||
info.getEffector().setCurrentHp(absorb);
|
||||
// System message
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_HP_HAS_BEEN_RESTORED);
|
||||
sm.addInt(restored);
|
||||
info.getEffector().sendPacket(sm);
|
||||
}
|
||||
}
|
109
trunk/dist/game/data/scripts/handlers/effecthandlers/HpDrain.java
vendored
Normal file
109
trunk/dist/game/data/scripts/handlers/effecthandlers/HpDrain.java
vendored
Normal file
@ -0,0 +1,109 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.enums.ShotType;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.model.stats.Formulas;
|
||||
|
||||
/**
|
||||
* HP Drain effect implementation.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public final class HpDrain extends AbstractEffect
|
||||
{
|
||||
private final double _power;
|
||||
|
||||
public HpDrain(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
||||
{
|
||||
super(attachCond, applyCond, set, params);
|
||||
|
||||
_power = params.getDouble("power", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.HP_DRAIN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInstant()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(BuffInfo info)
|
||||
{
|
||||
L2Character target = info.getEffected();
|
||||
L2Character activeChar = info.getEffector();
|
||||
|
||||
// TODO: Unhardcode Cubic Skill to avoid double damage
|
||||
if (activeChar.isAlikeDead() || (info.getSkill().getId() == 4050))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
boolean sps = info.getSkill().useSpiritShot() && activeChar.isChargedShot(ShotType.SPIRITSHOTS);
|
||||
boolean bss = info.getSkill().useSpiritShot() && activeChar.isChargedShot(ShotType.BLESSED_SPIRITSHOTS);
|
||||
boolean mcrit = Formulas.calcMCrit(activeChar.getMCriticalHit(target, info.getSkill()));
|
||||
byte shld = Formulas.calcShldUse(activeChar, target, info.getSkill());
|
||||
int damage = (int) Formulas.calcMagicDam(activeChar, target, info.getSkill(), shld, sps, bss, mcrit);
|
||||
|
||||
int drain = 0;
|
||||
int cp = (int) target.getCurrentCp();
|
||||
int hp = (int) target.getCurrentHp();
|
||||
|
||||
if (cp > 0)
|
||||
{
|
||||
drain = (damage < cp) ? 0 : (damage - cp);
|
||||
}
|
||||
else if (damage > hp)
|
||||
{
|
||||
drain = hp;
|
||||
}
|
||||
else
|
||||
{
|
||||
drain = damage;
|
||||
}
|
||||
|
||||
final double hpAdd = (_power * drain);
|
||||
final double hpFinal = ((activeChar.getCurrentHp() + hpAdd) > activeChar.getMaxHp() ? activeChar.getMaxHp() : (activeChar.getCurrentHp() + hpAdd));
|
||||
activeChar.setCurrentHp(hpFinal);
|
||||
|
||||
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();
|
||||
}
|
||||
activeChar.sendDamageMessage(target, damage, mcrit, false, false);
|
||||
target.reduceCurrentHp(damage, activeChar, info.getSkill());
|
||||
target.notifyDamageReceived(damage, activeChar, info.getSkill(), mcrit, false);
|
||||
}
|
||||
}
|
||||
}
|
54
trunk/dist/game/data/scripts/handlers/effecthandlers/ImmobileBuff.java
vendored
Normal file
54
trunk/dist/game/data/scripts/handlers/effecthandlers/ImmobileBuff.java
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.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);
|
||||
}
|
||||
}
|
59
trunk/dist/game/data/scripts/handlers/effecthandlers/ImmobilePetBuff.java
vendored
Normal file
59
trunk/dist/game/data/scripts/handlers/effecthandlers/ImmobilePetBuff.java
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Summon;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
|
||||
/**
|
||||
* Immobile Pet Buff effect implementation.
|
||||
* @author demonia
|
||||
*/
|
||||
public final class ImmobilePetBuff extends AbstractEffect
|
||||
{
|
||||
public ImmobilePetBuff(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)
|
||||
{
|
||||
if (info.getEffected().isSummon() && info.getEffector().isPlayer() && (((L2Summon) info.getEffected()).getOwner() == info.getEffector()))
|
||||
{
|
||||
info.getEffected().setIsImmobilized(true);
|
||||
}
|
||||
}
|
||||
}
|
41
trunk/dist/game/data/scripts/handlers/effecthandlers/Invincible.java
vendored
Normal file
41
trunk/dist/game/data/scripts/handlers/effecthandlers/Invincible.java
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.EffectFlag;
|
||||
|
||||
/**
|
||||
* Invincible effect implementation.
|
||||
*/
|
||||
public final class Invincible extends AbstractEffect
|
||||
{
|
||||
public Invincible(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
||||
{
|
||||
super(attachCond, applyCond, set, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEffectFlags()
|
||||
{
|
||||
return EffectFlag.INVUL.getMask();
|
||||
}
|
||||
}
|
112
trunk/dist/game/data/scripts/handlers/effecthandlers/Lethal.java
vendored
Normal file
112
trunk/dist/game/data/scripts/handlers/effecthandlers/Lethal.java
vendored
Normal file
@ -0,0 +1,112 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.model.stats.Formulas;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.util.Rnd;
|
||||
|
||||
/**
|
||||
* Lethal effect implementation.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public final class Lethal extends AbstractEffect
|
||||
{
|
||||
private final int _fullLethal;
|
||||
private final int _halfLethal;
|
||||
|
||||
public Lethal(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
||||
{
|
||||
super(attachCond, applyCond, set, params);
|
||||
|
||||
_fullLethal = params.getInt("fullLethal", 0);
|
||||
_halfLethal = params.getInt("halfLethal", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInstant()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(BuffInfo info)
|
||||
{
|
||||
L2Character target = info.getEffected();
|
||||
L2Character activeChar = info.getEffector();
|
||||
if (activeChar.isPlayer() && !activeChar.getAccessLevel().canGiveDamage())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (info.getSkill().getMagicLevel() < (target.getLevel() - 6))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!target.isLethalable() || target.isInvul())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
double chanceMultiplier = Formulas.calcAttributeBonus(activeChar, target, info.getSkill()) * Formulas.calcGeneralTraitBonus(activeChar, target, info.getSkill().getTraitType(), false);
|
||||
// Lethal Strike
|
||||
if (Rnd.get(100) < (_fullLethal * chanceMultiplier))
|
||||
{
|
||||
// for Players CP and HP is set to 1.
|
||||
if (target.isPlayer())
|
||||
{
|
||||
target.notifyDamageReceived(target.getCurrentHp() - 1, info.getEffector(), info.getSkill(), true, false);
|
||||
target.setCurrentCp(1);
|
||||
target.setCurrentHp(1);
|
||||
target.sendPacket(SystemMessageId.LETHAL_STRIKE);
|
||||
}
|
||||
// for Monsters HP is set to 1.
|
||||
else if (target.isMonster() || target.isSummon())
|
||||
{
|
||||
target.notifyDamageReceived(target.getCurrentHp() - 1, info.getEffector(), info.getSkill(), true, false);
|
||||
target.setCurrentHp(1);
|
||||
}
|
||||
activeChar.sendPacket(SystemMessageId.HIT_WITH_LETHAL_STRIKE);
|
||||
}
|
||||
// Half-Kill
|
||||
else if (Rnd.get(100) < (_halfLethal * chanceMultiplier))
|
||||
{
|
||||
// for Players CP is set to 1.
|
||||
if (target.isPlayer())
|
||||
{
|
||||
target.setCurrentCp(1);
|
||||
target.sendPacket(SystemMessageId.HALF_KILL);
|
||||
target.sendPacket(SystemMessageId.YOUR_CP_WAS_DRAINED_BECAUSE_YOU_WERE_HIT_WITH_A_HALF_KILL_SKILL);
|
||||
}
|
||||
// for Monsters HP is set to 50%.
|
||||
else if (target.isMonster() || target.isSummon())
|
||||
{
|
||||
target.notifyDamageReceived(target.getCurrentHp() * 0.5, info.getEffector(), info.getSkill(), true, false);
|
||||
target.setCurrentHp(target.getCurrentHp() * 0.5);
|
||||
}
|
||||
activeChar.sendPacket(SystemMessageId.HALF_KILL);
|
||||
}
|
||||
}
|
||||
}
|
48
trunk/dist/game/data/scripts/handlers/effecthandlers/Lucky.java
vendored
Normal file
48
trunk/dist/game/data/scripts/handlers/effecthandlers/Lucky.java
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
|
||||
/**
|
||||
* Lucky effect implementation.
|
||||
* @author Zoey76
|
||||
*/
|
||||
public final class Lucky extends AbstractEffect
|
||||
{
|
||||
public Lucky(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 boolean onActionTime(BuffInfo info)
|
||||
{
|
||||
return info.getSkill().isPassive();
|
||||
}
|
||||
}
|
106
trunk/dist/game/data/scripts/handlers/effecthandlers/MagicalAttack.java
vendored
Normal file
106
trunk/dist/game/data/scripts/handlers/effecthandlers/MagicalAttack.java
vendored
Normal file
@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.enums.ShotType;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.model.stats.Formulas;
|
||||
import com.l2jserver.gameserver.model.stats.Stats;
|
||||
import com.l2jserver.util.Rnd;
|
||||
|
||||
/**
|
||||
* Magical Attack effect implementation.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public final class MagicalAttack extends AbstractEffect
|
||||
{
|
||||
public MagicalAttack(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
||||
{
|
||||
super(attachCond, applyCond, set, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.MAGICAL_ATTACK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInstant()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(BuffInfo info)
|
||||
{
|
||||
L2Character target = info.getEffected();
|
||||
L2Character activeChar = info.getEffector();
|
||||
|
||||
// TODO: Unhardcode Cubic Skill to avoid double damage
|
||||
if (activeChar.isAlikeDead() || (info.getSkill().getId() == 4049))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.isPlayer() && target.getActingPlayer().isFakeDeath())
|
||||
{
|
||||
target.stopFakeDeath(true);
|
||||
}
|
||||
|
||||
boolean sps = info.getSkill().useSpiritShot() && activeChar.isChargedShot(ShotType.SPIRITSHOTS);
|
||||
boolean bss = info.getSkill().useSpiritShot() && activeChar.isChargedShot(ShotType.BLESSED_SPIRITSHOTS);
|
||||
final boolean mcrit = Formulas.calcMCrit(activeChar.getMCriticalHit(target, info.getSkill()));
|
||||
final byte shld = Formulas.calcShldUse(activeChar, target, info.getSkill());
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
103
trunk/dist/game/data/scripts/handlers/effecthandlers/MagicalAttackByAbnormal.java
vendored
Normal file
103
trunk/dist/game/data/scripts/handlers/effecthandlers/MagicalAttackByAbnormal.java
vendored
Normal file
@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.enums.ShotType;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.model.stats.Formulas;
|
||||
import com.l2jserver.gameserver.model.stats.Stats;
|
||||
import com.l2jserver.util.Rnd;
|
||||
|
||||
/**
|
||||
* Magical Attack By Abnormal effect implementation.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public final class MagicalAttackByAbnormal extends AbstractEffect
|
||||
{
|
||||
public MagicalAttackByAbnormal(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
||||
{
|
||||
super(attachCond, applyCond, set, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.MAGICAL_ATTACK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInstant()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(BuffInfo info)
|
||||
{
|
||||
L2Character target = info.getEffected();
|
||||
L2Character activeChar = info.getEffector();
|
||||
|
||||
if (activeChar.isAlikeDead())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.isPlayer() && target.getActingPlayer().isFakeDeath())
|
||||
{
|
||||
target.stopFakeDeath(true);
|
||||
}
|
||||
|
||||
boolean sps = info.getSkill().useSpiritShot() && activeChar.isChargedShot(ShotType.SPIRITSHOTS);
|
||||
boolean bss = info.getSkill().useSpiritShot() && activeChar.isChargedShot(ShotType.BLESSED_SPIRITSHOTS);
|
||||
final boolean mcrit = Formulas.calcMCrit(activeChar.getMCriticalHit(target, info.getSkill()));
|
||||
final byte shld = Formulas.calcShldUse(activeChar, target, info.getSkill());
|
||||
int damage = (int) Formulas.calcMagicDam(activeChar, target, info.getSkill(), shld, sps, bss, mcrit);
|
||||
|
||||
// each buff increase +30%
|
||||
damage *= (((target.getBuffCount() * 0.3) + 1.3) / 4);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
105
trunk/dist/game/data/scripts/handlers/effecthandlers/MagicalAttackMp.java
vendored
Normal file
105
trunk/dist/game/data/scripts/handlers/effecthandlers/MagicalAttackMp.java
vendored
Normal file
@ -0,0 +1,105 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.enums.ShotType;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.model.stats.Formulas;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* Magical Attack MP effect.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public final class MagicalAttackMp extends AbstractEffect
|
||||
{
|
||||
public MagicalAttackMp(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
||||
{
|
||||
super(attachCond, applyCond, set, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean calcSuccess(BuffInfo info)
|
||||
{
|
||||
if (info.getEffected().isInvul() || !Formulas.calcMagicAffected(info.getEffector(), info.getEffected(), info.getSkill()))
|
||||
{
|
||||
info.getEffector().sendPacket(SystemMessageId.YOU_HAVE_MISSED);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.MAGICAL_ATTACK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInstant()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(BuffInfo info)
|
||||
{
|
||||
L2Character target = info.getEffected();
|
||||
L2Character activeChar = info.getEffector();
|
||||
|
||||
if (activeChar.isAlikeDead())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
boolean sps = info.getSkill().useSpiritShot() && activeChar.isChargedShot(ShotType.SPIRITSHOTS);
|
||||
boolean bss = info.getSkill().useSpiritShot() && activeChar.isChargedShot(ShotType.BLESSED_SPIRITSHOTS);
|
||||
final byte shld = Formulas.calcShldUse(activeChar, target, info.getSkill());
|
||||
final boolean mcrit = Formulas.calcMCrit(activeChar.getMCriticalHit(target, info.getSkill()));
|
||||
double damage = Formulas.calcManaDam(activeChar, target, info.getSkill(), shld, sps, bss, mcrit);
|
||||
double mp = (damage > target.getCurrentMp() ? target.getCurrentMp() : damage);
|
||||
|
||||
if (damage > 0)
|
||||
{
|
||||
target.stopEffectsOnDamage(true);
|
||||
target.setCurrentMp(target.getCurrentMp() - mp);
|
||||
}
|
||||
|
||||
if (target.isPlayer())
|
||||
{
|
||||
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S2_S_MP_HAS_BEEN_DRAINED_BY_C1);
|
||||
sm.addCharName(activeChar);
|
||||
sm.addInt((int) mp);
|
||||
target.sendPacket(sm);
|
||||
}
|
||||
|
||||
if (activeChar.isPlayer())
|
||||
{
|
||||
SystemMessage sm2 = SystemMessage.getSystemMessage(SystemMessageId.YOUR_OPPONENT_S_MP_WAS_REDUCED_BY_S1);
|
||||
sm2.addInt((int) mp);
|
||||
activeChar.sendPacket(sm2);
|
||||
}
|
||||
}
|
||||
}
|
107
trunk/dist/game/data/scripts/handlers/effecthandlers/MagicalSoulAttack.java
vendored
Normal file
107
trunk/dist/game/data/scripts/handlers/effecthandlers/MagicalSoulAttack.java
vendored
Normal file
@ -0,0 +1,107 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.enums.ShotType;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.model.stats.Formulas;
|
||||
import com.l2jserver.gameserver.model.stats.Stats;
|
||||
import com.l2jserver.util.Rnd;
|
||||
|
||||
/**
|
||||
* Magical Soul Attack effect implementation.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public final class MagicalSoulAttack extends AbstractEffect
|
||||
{
|
||||
public MagicalSoulAttack(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
||||
{
|
||||
super(attachCond, applyCond, set, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.MAGICAL_ATTACK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInstant()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(BuffInfo info)
|
||||
{
|
||||
L2Character target = info.getEffected();
|
||||
L2Character activeChar = info.getEffector();
|
||||
|
||||
if (activeChar.isAlikeDead())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.isPlayer() && target.getActingPlayer().isFakeDeath())
|
||||
{
|
||||
target.stopFakeDeath(true);
|
||||
}
|
||||
|
||||
boolean sps = info.getSkill().useSpiritShot() && activeChar.isChargedShot(ShotType.SPIRITSHOTS);
|
||||
boolean bss = info.getSkill().useSpiritShot() && activeChar.isChargedShot(ShotType.BLESSED_SPIRITSHOTS);
|
||||
final boolean mcrit = Formulas.calcMCrit(activeChar.getMCriticalHit(target, info.getSkill()));
|
||||
final byte shld = Formulas.calcShldUse(activeChar, target, info.getSkill());
|
||||
int damage = (int) Formulas.calcMagicDam(activeChar, target, info.getSkill(), shld, sps, bss, mcrit);
|
||||
|
||||
if ((info.getSkill().getMaxSoulConsumeCount() > 0) && activeChar.isPlayer())
|
||||
{
|
||||
// Souls Formula (each soul increase +4%)
|
||||
int chargedSouls = (activeChar.getActingPlayer().getChargedSouls() <= info.getSkill().getMaxSoulConsumeCount()) ? activeChar.getActingPlayer().getChargedSouls() : info.getSkill().getMaxSoulConsumeCount();
|
||||
damage *= 1 + (chargedSouls * 0.04);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
59
trunk/dist/game/data/scripts/handlers/effecthandlers/ManaDamOverTime.java
vendored
Normal file
59
trunk/dist/game/data/scripts/handlers/effecthandlers/ManaDamOverTime.java
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
* Mana Damage Over Time effect implementation.
|
||||
*/
|
||||
public final class ManaDamOverTime extends AbstractEffect
|
||||
{
|
||||
private final double _power;
|
||||
|
||||
public ManaDamOverTime(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;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
86
trunk/dist/game/data/scripts/handlers/effecthandlers/ManaHeal.java
vendored
Normal file
86
trunk/dist/game/data/scripts/handlers/effecthandlers/ManaHeal.java
vendored
Normal file
@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.model.stats.Stats;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* Mana Heal effect implementation.
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public final class ManaHeal extends AbstractEffect
|
||||
{
|
||||
private final double _power;
|
||||
|
||||
public ManaHeal(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)
|
||||
{
|
||||
L2Character target = info.getEffected();
|
||||
if ((target == null) || target.isDead() || target.isDoor() || target.isInvul())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
double amount = _power;
|
||||
|
||||
if (!info.getSkill().isStatic())
|
||||
{
|
||||
amount = target.calcStat(Stats.MANA_CHARGE, amount, null, null);
|
||||
}
|
||||
|
||||
// Prevents overheal and negative amount
|
||||
amount = Math.max(Math.min(amount, target.getMaxRecoverableMp() - target.getCurrentMp()), 0);
|
||||
if (amount != 0)
|
||||
{
|
||||
target.setCurrentMp(amount + target.getCurrentMp());
|
||||
}
|
||||
SystemMessage sm;
|
||||
if (info.getEffector().getObjectId() != target.getObjectId())
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.S2_MP_HAS_BEEN_RESTORED_BY_C1);
|
||||
sm.addCharName(info.getEffector());
|
||||
}
|
||||
else
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_MP_HAS_BEEN_RESTORED);
|
||||
}
|
||||
sm.addInt((int) amount);
|
||||
target.sendPacket(sm);
|
||||
}
|
||||
}
|
133
trunk/dist/game/data/scripts/handlers/effecthandlers/ManaHealByLevel.java
vendored
Normal file
133
trunk/dist/game/data/scripts/handlers/effecthandlers/ManaHealByLevel.java
vendored
Normal file
@ -0,0 +1,133 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.model.stats.Stats;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* Mana Heal By Level effect implementation.
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public final class ManaHealByLevel extends AbstractEffect
|
||||
{
|
||||
private final double _power;
|
||||
|
||||
public ManaHealByLevel(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
||||
{
|
||||
super(attachCond, applyCond, set, params);
|
||||
|
||||
_power = params.getDouble("power", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.MANAHEAL_BY_LEVEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInstant()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(BuffInfo info)
|
||||
{
|
||||
L2Character target = info.getEffected();
|
||||
if ((target == null) || target.isDead() || target.isDoor() || target.isInvul())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
double amount = _power;
|
||||
|
||||
// recharged mp influenced by difference between target level and skill level
|
||||
// if target is within 5 levels or lower then skill level there's no penalty.
|
||||
amount = target.calcStat(Stats.MANA_CHARGE, amount, null, null);
|
||||
if (target.getLevel() > info.getSkill().getMagicLevel())
|
||||
{
|
||||
int lvlDiff = target.getLevel() - info.getSkill().getMagicLevel();
|
||||
// if target is too high compared to skill level, the amount of recharged mp gradually decreases.
|
||||
if (lvlDiff == 6)
|
||||
{
|
||||
amount *= 0.9; // only 90% effective
|
||||
}
|
||||
else if (lvlDiff == 7)
|
||||
{
|
||||
amount *= 0.8; // 80%
|
||||
}
|
||||
else if (lvlDiff == 8)
|
||||
{
|
||||
amount *= 0.7; // 70%
|
||||
}
|
||||
else if (lvlDiff == 9)
|
||||
{
|
||||
amount *= 0.6; // 60%
|
||||
}
|
||||
else if (lvlDiff == 10)
|
||||
{
|
||||
amount *= 0.5; // 50%
|
||||
}
|
||||
else if (lvlDiff == 11)
|
||||
{
|
||||
amount *= 0.4; // 40%
|
||||
}
|
||||
else if (lvlDiff == 12)
|
||||
{
|
||||
amount *= 0.3; // 30%
|
||||
}
|
||||
else if (lvlDiff == 13)
|
||||
{
|
||||
amount *= 0.2; // 20%
|
||||
}
|
||||
else if (lvlDiff == 14)
|
||||
{
|
||||
amount *= 0.1; // 10%
|
||||
}
|
||||
else if (lvlDiff >= 15)
|
||||
{
|
||||
amount = 0; // 0mp recharged
|
||||
}
|
||||
}
|
||||
|
||||
// Prevents overheal and negative amount
|
||||
amount = Math.max(Math.min(amount, target.getMaxRecoverableMp() - target.getCurrentMp()), 0);
|
||||
if (amount != 0)
|
||||
{
|
||||
target.setCurrentMp(amount + target.getCurrentMp());
|
||||
}
|
||||
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(info.getEffector().getObjectId() != target.getObjectId() ? SystemMessageId.S2_MP_HAS_BEEN_RESTORED_BY_C1 : SystemMessageId.S1_MP_HAS_BEEN_RESTORED);
|
||||
if (info.getEffector().getObjectId() != target.getObjectId())
|
||||
{
|
||||
sm.addCharName(info.getEffector());
|
||||
}
|
||||
sm.addInt((int) amount);
|
||||
target.sendPacket(sm);
|
||||
}
|
||||
}
|
62
trunk/dist/game/data/scripts/handlers/effecthandlers/ManaHealOverTime.java
vendored
Normal file
62
trunk/dist/game/data/scripts/handlers/effecthandlers/ManaHealOverTime.java
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
|
||||
/**
|
||||
* Mana Heal Over Time effect implementation.
|
||||
*/
|
||||
public final class ManaHealOverTime extends AbstractEffect
|
||||
{
|
||||
private final double _power;
|
||||
|
||||
public ManaHealOverTime(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 mp = info.getEffected().getCurrentMp();
|
||||
double maxmp = info.getEffected().getMaxRecoverableMp();
|
||||
|
||||
// Not needed to set the MP and send update packet if player is already at max MP
|
||||
if (mp >= maxmp)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
mp += _power * getTicksMultiplier();
|
||||
mp = Math.min(mp, maxmp);
|
||||
info.getEffected().setCurrentMp(mp);
|
||||
return info.getSkill().isToggle();
|
||||
}
|
||||
}
|
90
trunk/dist/game/data/scripts/handlers/effecthandlers/ManaHealPercent.java
vendored
Normal file
90
trunk/dist/game/data/scripts/handlers/effecthandlers/ManaHealPercent.java
vendored
Normal file
@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* Mana Heal Percent effect implementation.
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public final class ManaHealPercent extends AbstractEffect
|
||||
{
|
||||
private final double _power;
|
||||
|
||||
public ManaHealPercent(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
||||
{
|
||||
super(attachCond, applyCond, set, params);
|
||||
|
||||
_power = params.getDouble("power", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.MANAHEAL_PERCENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInstant()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(BuffInfo info)
|
||||
{
|
||||
L2Character target = info.getEffected();
|
||||
if ((target == null) || target.isDead() || target.isDoor())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
double amount = 0;
|
||||
double power = _power;
|
||||
boolean full = (power == 100.0);
|
||||
|
||||
amount = full ? target.getMaxMp() : (target.getMaxMp() * power) / 100.0;
|
||||
// Prevents overheal and negative amount
|
||||
amount = Math.max(Math.min(amount, target.getMaxRecoverableMp() - target.getCurrentMp()), 0);
|
||||
if (amount != 0)
|
||||
{
|
||||
target.setCurrentMp(amount + target.getCurrentMp());
|
||||
}
|
||||
SystemMessage sm;
|
||||
if (info.getEffector().getObjectId() != target.getObjectId())
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.S2_MP_HAS_BEEN_RESTORED_BY_C1);
|
||||
sm.addCharName(info.getEffector());
|
||||
}
|
||||
else
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_MP_HAS_BEEN_RESTORED);
|
||||
}
|
||||
sm.addInt((int) amount);
|
||||
target.sendPacket(sm);
|
||||
}
|
||||
}
|
60
trunk/dist/game/data/scripts/handlers/effecthandlers/MpConsumePerLevel.java
vendored
Normal file
60
trunk/dist/game/data/scripts/handlers/effecthandlers/MpConsumePerLevel.java
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
* Mp Consume Per Level effect implementation.
|
||||
*/
|
||||
public final class MpConsumePerLevel extends AbstractEffect
|
||||
{
|
||||
private final double _power;
|
||||
|
||||
public MpConsumePerLevel(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;
|
||||
}
|
||||
|
||||
final double base = _power * getTicksMultiplier();
|
||||
final double consume = (info.getAbnormalTime() > 0) ? ((info.getEffected().getLevel() - 1) / 7.5) * base * info.getAbnormalTime() : base;
|
||||
if (consume > info.getEffected().getCurrentMp())
|
||||
{
|
||||
info.getEffected().sendPacket(SystemMessageId.YOUR_SKILL_WAS_DEACTIVATED_DUE_TO_LACK_OF_MP);
|
||||
return false;
|
||||
}
|
||||
|
||||
info.getEffected().reduceCurrentMp(consume);
|
||||
return info.getSkill().isToggle();
|
||||
}
|
||||
}
|
57
trunk/dist/game/data/scripts/handlers/effecthandlers/Mute.java
vendored
Normal file
57
trunk/dist/game/data/scripts/handlers/effecthandlers/Mute.java
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.ai.CtrlEvent;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.EffectFlag;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
|
||||
/**
|
||||
* Mute effect implementation.
|
||||
*/
|
||||
public final class Mute extends AbstractEffect
|
||||
{
|
||||
public Mute(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
||||
{
|
||||
super(attachCond, applyCond, set, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEffectFlags()
|
||||
{
|
||||
return EffectFlag.MUTED.getMask();
|
||||
}
|
||||
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.MUTE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(BuffInfo info)
|
||||
{
|
||||
info.getEffected().abortCast();
|
||||
info.getEffected().getAI().notifyEvent(CtrlEvent.EVT_MUTED);
|
||||
}
|
||||
}
|
56
trunk/dist/game/data/scripts/handlers/effecthandlers/NoblesseBless.java
vendored
Normal file
56
trunk/dist/game/data/scripts/handlers/effecthandlers/NoblesseBless.java
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.EffectFlag;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
|
||||
/**
|
||||
* Noblesse Blessing effect implementation.
|
||||
* @author earendil
|
||||
*/
|
||||
public final class NoblesseBless extends AbstractEffect
|
||||
{
|
||||
public NoblesseBless(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().isPlayable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEffectFlags()
|
||||
{
|
||||
return EffectFlag.NOBLESS_BLESSING.getMask();
|
||||
}
|
||||
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.NOBLESSE_BLESSING;
|
||||
}
|
||||
}
|
75
trunk/dist/game/data/scripts/handlers/effecthandlers/OpenChest.java
vendored
Normal file
75
trunk/dist/game/data/scripts/handlers/effecthandlers/OpenChest.java
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.ai.CtrlIntention;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2ChestInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
|
||||
/**
|
||||
* Open Chest effect implementation.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public final class OpenChest extends AbstractEffect
|
||||
{
|
||||
public OpenChest(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() instanceof L2ChestInstance))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2PcInstance player = info.getEffector().getActingPlayer();
|
||||
final L2ChestInstance chest = (L2ChestInstance) info.getEffected();
|
||||
if (chest.isDead() || (player.getInstanceId() != chest.getInstanceId()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (((player.getLevel() <= 77) && (Math.abs(chest.getLevel() - player.getLevel()) <= 6)) || ((player.getLevel() >= 78) && (Math.abs(chest.getLevel() - player.getLevel()) <= 5)))
|
||||
{
|
||||
player.broadcastSocialAction(3);
|
||||
chest.setSpecialDrop();
|
||||
chest.setMustRewardExpSp(false);
|
||||
chest.reduceCurrentHp(chest.getMaxHp(), player, info.getSkill());
|
||||
}
|
||||
else
|
||||
{
|
||||
player.broadcastSocialAction(13);
|
||||
chest.addDamageHate(player, 0, 1);
|
||||
chest.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
|
||||
}
|
||||
}
|
||||
}
|
64
trunk/dist/game/data/scripts/handlers/effecthandlers/OpenCommonRecipeBook.java
vendored
Normal file
64
trunk/dist/game/data/scripts/handlers/effecthandlers/OpenCommonRecipeBook.java
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.RecipeController;
|
||||
import com.l2jserver.gameserver.enums.PrivateStoreType;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
* Open Common Recipe Book effect implementation.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public final class OpenCommonRecipeBook extends AbstractEffect
|
||||
{
|
||||
public OpenCommonRecipeBook(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())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
L2PcInstance player = info.getEffector().getActingPlayer();
|
||||
if (player.getPrivateStoreType() != PrivateStoreType.NONE)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.ITEM_CREATION_IS_NOT_POSSIBLE_WHILE_ENGAGED_IN_A_TRADE);
|
||||
return;
|
||||
}
|
||||
|
||||
RecipeController.getInstance().requestBookOpen(player, false);
|
||||
}
|
||||
}
|
104
trunk/dist/game/data/scripts/handlers/effecthandlers/OpenDoor.java
vendored
Normal file
104
trunk/dist/game/data/scripts/handlers/effecthandlers/OpenDoor.java
vendored
Normal file
@ -0,0 +1,104 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.instancemanager.InstanceManager;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.entity.Instance;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.util.Rnd;
|
||||
|
||||
/**
|
||||
* Open Door effect implementation.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public final class OpenDoor extends AbstractEffect
|
||||
{
|
||||
private final int _chance;
|
||||
private final boolean _isItem;
|
||||
|
||||
public OpenDoor(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
||||
{
|
||||
super(attachCond, applyCond, set, params);
|
||||
|
||||
_chance = params.getInt("chance", 0);
|
||||
_isItem = params.getBoolean("isItem", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInstant()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(BuffInfo info)
|
||||
{
|
||||
if (!info.getEffected().isDoor())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2Character effector = info.getEffector();
|
||||
L2DoorInstance door = (L2DoorInstance) info.getEffected();
|
||||
// Check if door in the different instance
|
||||
if (effector.getInstanceId() != door.getInstanceId())
|
||||
{
|
||||
// Search for the instance
|
||||
final Instance inst = InstanceManager.getInstance().getInstance(effector.getInstanceId());
|
||||
if (inst == null)
|
||||
{
|
||||
// Instance not found
|
||||
return;
|
||||
}
|
||||
final L2DoorInstance instanceDoor = inst.getDoor(door.getId());
|
||||
if (instanceDoor != null)
|
||||
{
|
||||
// Door found
|
||||
door = instanceDoor;
|
||||
}
|
||||
|
||||
// Checking instance again
|
||||
if (effector.getInstanceId() != door.getInstanceId())
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ((!door.isOpenableBySkill() && !_isItem) || (door.getFort() != null))
|
||||
{
|
||||
effector.sendPacket(SystemMessageId.THIS_DOOR_CANNOT_BE_UNLOCKED);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((Rnd.get(100) < _chance) && !door.getOpen())
|
||||
{
|
||||
door.openMe();
|
||||
}
|
||||
else
|
||||
{
|
||||
effector.sendPacket(SystemMessageId.YOU_HAVE_FAILED_TO_UNLOCK_THE_DOOR);
|
||||
}
|
||||
}
|
||||
}
|
64
trunk/dist/game/data/scripts/handlers/effecthandlers/OpenDwarfRecipeBook.java
vendored
Normal file
64
trunk/dist/game/data/scripts/handlers/effecthandlers/OpenDwarfRecipeBook.java
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.RecipeController;
|
||||
import com.l2jserver.gameserver.enums.PrivateStoreType;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
* Open Dwarf Recipe Book effect implementation.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public final class OpenDwarfRecipeBook extends AbstractEffect
|
||||
{
|
||||
public OpenDwarfRecipeBook(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())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
L2PcInstance player = info.getEffector().getActingPlayer();
|
||||
if (player.getPrivateStoreType() != PrivateStoreType.NONE)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.ITEM_CREATION_IS_NOT_POSSIBLE_WHILE_ENGAGED_IN_A_TRADE);
|
||||
return;
|
||||
}
|
||||
|
||||
RecipeController.getInstance().requestBookOpen(player, true);
|
||||
}
|
||||
}
|
67
trunk/dist/game/data/scripts/handlers/effecthandlers/Paralyze.java
vendored
Normal file
67
trunk/dist/game/data/scripts/handlers/effecthandlers/Paralyze.java
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.ai.CtrlEvent;
|
||||
import com.l2jserver.gameserver.ai.CtrlIntention;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.EffectFlag;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.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();
|
||||
}
|
||||
}
|
60
trunk/dist/game/data/scripts/handlers/effecthandlers/Passive.java
vendored
Normal file
60
trunk/dist/game/data/scripts/handlers/effecthandlers/Passive.java
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Attackable;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
|
||||
/**
|
||||
* Passive effect implementation.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public final class Passive extends AbstractEffect
|
||||
{
|
||||
public Passive(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
||||
{
|
||||
super(attachCond, applyCond, set, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(BuffInfo info)
|
||||
{
|
||||
info.getEffected().enableAllSkills();
|
||||
info.getEffected().setIsImmobilized(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canStart(BuffInfo info)
|
||||
{
|
||||
return info.getEffected().isAttackable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(BuffInfo info)
|
||||
{
|
||||
L2Attackable target = (L2Attackable) info.getEffected();
|
||||
target.abortAttack();
|
||||
target.abortCast();
|
||||
target.disableAllSkills();
|
||||
target.setIsImmobilized(true);
|
||||
}
|
||||
}
|
58
trunk/dist/game/data/scripts/handlers/effecthandlers/Petrification.java
vendored
Normal file
58
trunk/dist/game/data/scripts/handlers/effecthandlers/Petrification.java
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.ai.CtrlEvent;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.EffectFlag;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
|
||||
/**
|
||||
* Petrification effect implementation.
|
||||
*/
|
||||
public final class Petrification extends AbstractEffect
|
||||
{
|
||||
public Petrification(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
||||
{
|
||||
super(attachCond, applyCond, set, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEffectFlags()
|
||||
{
|
||||
return EffectFlag.PARALYZED.getMask() | EffectFlag.INVUL.getMask();
|
||||
}
|
||||
|
||||
@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().startParalyze();
|
||||
}
|
||||
}
|
122
trunk/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttack.java
vendored
Normal file
122
trunk/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttack.java
vendored
Normal file
@ -0,0 +1,122 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.enums.ShotType;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.model.stats.BaseStats;
|
||||
import com.l2jserver.gameserver.model.stats.Formulas;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* Physical Attack effect implementation.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public final class PhysicalAttack extends AbstractEffect
|
||||
{
|
||||
public PhysicalAttack(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
||||
{
|
||||
super(attachCond, applyCond, set, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean calcSuccess(BuffInfo info)
|
||||
{
|
||||
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)
|
||||
{
|
||||
L2Character target = info.getEffected();
|
||||
L2Character activeChar = info.getEffector();
|
||||
|
||||
if (activeChar.isAlikeDead())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (((info.getSkill().getFlyRadius() > 0) || (info.getSkill().getFlyType() != null)) && activeChar.isMovementDisabled())
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
|
||||
sm.addSkillName(info.getSkill());
|
||||
activeChar.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.isPlayer() && target.getActingPlayer().isFakeDeath())
|
||||
{
|
||||
target.stopFakeDeath(true);
|
||||
}
|
||||
|
||||
int damage = 0;
|
||||
boolean ss = info.getSkill().isPhysical() && activeChar.isChargedShot(ShotType.SOULSHOTS);
|
||||
final byte shld = Formulas.calcShldUse(activeChar, target, info.getSkill());
|
||||
// Physical damage critical rate is only affected by STR.
|
||||
boolean crit = false;
|
||||
if (info.getSkill().getBaseCritRate() > 0)
|
||||
{
|
||||
crit = Formulas.calcCrit(info.getSkill().getBaseCritRate() * 10 * BaseStats.STR.calcBonus(activeChar), true, target);
|
||||
}
|
||||
|
||||
damage = (int) Formulas.calcPhysDam(activeChar, target, info.getSkill(), shld, false, ss);
|
||||
|
||||
if (crit)
|
||||
{
|
||||
damage *= 2;
|
||||
}
|
||||
|
||||
if (damage > 0)
|
||||
{
|
||||
activeChar.sendDamageMessage(target, damage, false, crit, false);
|
||||
target.reduceCurrentHp(damage, activeChar, info.getSkill());
|
||||
target.notifyDamageReceived(damage, activeChar, info.getSkill(), crit, false);
|
||||
|
||||
// Check if damage should be reflected
|
||||
Formulas.calcDamageReflected(activeChar, target, info.getSkill(), crit);
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOUR_ATTACK_HAS_FAILED);
|
||||
}
|
||||
|
||||
if (info.getSkill().isSuicideAttack())
|
||||
{
|
||||
activeChar.doDie(activeChar);
|
||||
}
|
||||
}
|
||||
}
|
107
trunk/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackHpLink.java
vendored
Normal file
107
trunk/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackHpLink.java
vendored
Normal file
@ -0,0 +1,107 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.enums.ShotType;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.model.stats.BaseStats;
|
||||
import com.l2jserver.gameserver.model.stats.Formulas;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* Physical Attack HP Link effect implementation.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public final class PhysicalAttackHpLink extends AbstractEffect
|
||||
{
|
||||
public PhysicalAttackHpLink(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
||||
{
|
||||
super(attachCond, applyCond, set, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean calcSuccess(BuffInfo info)
|
||||
{
|
||||
return !Formulas.calcPhysicalSkillEvasion(info.getEffector(), info.getEffected(), info.getSkill());
|
||||
}
|
||||
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.PHYSICAL_ATTACK_HP_LINK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInstant()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(BuffInfo info)
|
||||
{
|
||||
L2Character target = info.getEffected();
|
||||
L2Character activeChar = info.getEffector();
|
||||
|
||||
if (activeChar.isAlikeDead())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.isMovementDisabled())
|
||||
{
|
||||
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
|
||||
sm.addSkillName(info.getSkill());
|
||||
activeChar.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
final byte shld = Formulas.calcShldUse(activeChar, target, info.getSkill());
|
||||
// Physical damage critical rate is only affected by STR.
|
||||
boolean crit = false;
|
||||
if (info.getSkill().getBaseCritRate() > 0)
|
||||
{
|
||||
crit = Formulas.calcCrit(info.getSkill().getBaseCritRate() * 10 * BaseStats.STR.calcBonus(activeChar), true, target);
|
||||
}
|
||||
|
||||
int damage = 0;
|
||||
boolean ss = info.getSkill().isPhysical() && activeChar.isChargedShot(ShotType.SOULSHOTS);
|
||||
damage = (int) Formulas.calcPhysDam(activeChar, target, info.getSkill(), shld, false, ss);
|
||||
|
||||
if (damage > 0)
|
||||
{
|
||||
activeChar.sendDamageMessage(target, damage, false, crit, false);
|
||||
target.reduceCurrentHp(damage, activeChar, info.getSkill());
|
||||
target.notifyDamageReceived(damage, activeChar, info.getSkill(), crit, false);
|
||||
|
||||
// Check if damage should be reflected.
|
||||
Formulas.calcDamageReflected(activeChar, target, info.getSkill(), crit);
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOUR_ATTACK_HAS_FAILED);
|
||||
}
|
||||
}
|
||||
}
|
49
trunk/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackMute.java
vendored
Normal file
49
trunk/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackMute.java
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.EffectFlag;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
|
||||
/**
|
||||
* Physical Attack Mute effect implementation.
|
||||
* @author -Rnn-
|
||||
*/
|
||||
public final class PhysicalAttackMute extends AbstractEffect
|
||||
{
|
||||
public PhysicalAttackMute(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
||||
{
|
||||
super(attachCond, applyCond, set, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEffectFlags()
|
||||
{
|
||||
return EffectFlag.PSYCHICAL_ATTACK_MUTED.getMask();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(BuffInfo info)
|
||||
{
|
||||
info.getEffected().startPhysicalAttackMuted();
|
||||
}
|
||||
}
|
50
trunk/dist/game/data/scripts/handlers/effecthandlers/PhysicalMute.java
vendored
Normal file
50
trunk/dist/game/data/scripts/handlers/effecthandlers/PhysicalMute.java
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.ai.CtrlEvent;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.EffectFlag;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
|
||||
/**
|
||||
* Physical Mute effect implementation.
|
||||
* @author -Nemesiss-
|
||||
*/
|
||||
public final class PhysicalMute extends AbstractEffect
|
||||
{
|
||||
public PhysicalMute(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
||||
{
|
||||
super(attachCond, applyCond, set, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEffectFlags()
|
||||
{
|
||||
return EffectFlag.PSYCHICAL_MUTED.getMask();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(BuffInfo info)
|
||||
{
|
||||
info.getEffected().getAI().notifyEvent(CtrlEvent.EVT_MUTED);
|
||||
}
|
||||
}
|
128
trunk/dist/game/data/scripts/handlers/effecthandlers/PhysicalSoulAttack.java
vendored
Normal file
128
trunk/dist/game/data/scripts/handlers/effecthandlers/PhysicalSoulAttack.java
vendored
Normal file
@ -0,0 +1,128 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.enums.ShotType;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jserver.gameserver.model.stats.BaseStats;
|
||||
import com.l2jserver.gameserver.model.stats.Formulas;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* Physical Soul Attack effect implementation.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public final class PhysicalSoulAttack extends AbstractEffect
|
||||
{
|
||||
public PhysicalSoulAttack(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
||||
{
|
||||
super(attachCond, applyCond, set, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean calcSuccess(BuffInfo info)
|
||||
{
|
||||
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)
|
||||
{
|
||||
L2Character target = info.getEffected();
|
||||
L2Character activeChar = info.getEffector();
|
||||
|
||||
if (activeChar.isAlikeDead())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (((info.getSkill().getFlyRadius() > 0) || (info.getSkill().getFlyType() != null)) && activeChar.isMovementDisabled())
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
|
||||
sm.addSkillName(info.getSkill());
|
||||
activeChar.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.isPlayer() && target.getActingPlayer().isFakeDeath())
|
||||
{
|
||||
target.stopFakeDeath(true);
|
||||
}
|
||||
|
||||
int damage = 0;
|
||||
boolean ss = info.getSkill().isPhysical() && activeChar.isChargedShot(ShotType.SOULSHOTS);
|
||||
final byte shld = Formulas.calcShldUse(activeChar, target, info.getSkill());
|
||||
// Physical damage critical rate is only affected by STR.
|
||||
boolean crit = false;
|
||||
if (info.getSkill().getBaseCritRate() > 0)
|
||||
{
|
||||
crit = Formulas.calcCrit(info.getSkill().getBaseCritRate() * 10 * BaseStats.STR.calcBonus(activeChar), true, target);
|
||||
}
|
||||
|
||||
damage = (int) Formulas.calcPhysDam(activeChar, target, info.getSkill(), shld, false, ss);
|
||||
|
||||
if ((info.getSkill().getMaxSoulConsumeCount() > 0) && activeChar.isPlayer())
|
||||
{
|
||||
// Souls Formula (each soul increase +4%)
|
||||
int chargedSouls = (activeChar.getActingPlayer().getChargedSouls() <= info.getSkill().getMaxSoulConsumeCount()) ? activeChar.getActingPlayer().getChargedSouls() : info.getSkill().getMaxSoulConsumeCount();
|
||||
damage *= 1 + (chargedSouls * 0.04);
|
||||
}
|
||||
if (crit)
|
||||
{
|
||||
damage *= 2;
|
||||
}
|
||||
|
||||
if (damage > 0)
|
||||
{
|
||||
activeChar.sendDamageMessage(target, damage, false, crit, false);
|
||||
target.reduceCurrentHp(damage, activeChar, info.getSkill());
|
||||
target.notifyDamageReceived(damage, activeChar, info.getSkill(), crit, false);
|
||||
|
||||
// Check if damage should be reflected
|
||||
Formulas.calcDamageReflected(activeChar, target, info.getSkill(), crit);
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOUR_ATTACK_HAS_FAILED);
|
||||
}
|
||||
|
||||
if (info.getSkill().isSuicideAttack())
|
||||
{
|
||||
activeChar.doDie(activeChar);
|
||||
}
|
||||
}
|
||||
}
|
49
trunk/dist/game/data/scripts/handlers/effecthandlers/ProtectionBlessing.java
vendored
Normal file
49
trunk/dist/game/data/scripts/handlers/effecthandlers/ProtectionBlessing.java
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.EffectFlag;
|
||||
import com.l2jserver.gameserver.model.skills.BuffInfo;
|
||||
|
||||
/**
|
||||
* Protection Blessing effect implementation.
|
||||
* @author kerberos_20
|
||||
*/
|
||||
public final class ProtectionBlessing extends AbstractEffect
|
||||
{
|
||||
public ProtectionBlessing(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 int getEffectFlags()
|
||||
{
|
||||
return EffectFlag.PROTECTION_BLESSING.getMask();
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user