Sync with L2jServer HighFive Sep 8th 2015.

This commit is contained in:
MobiusDev
2015-09-08 19:52:45 +00:00
parent 4e2af7c19a
commit 40380c4860
738 changed files with 14444 additions and 13328 deletions

View File

@@ -78,10 +78,10 @@ public class L2NpcActionShift implements IActionShiftHandler
html.replace("%mp%", String.valueOf((int) ((L2Character) target).getCurrentMp()));
html.replace("%mpmax%", String.valueOf(((L2Character) target).getMaxMp()));
html.replace("%patk%", String.valueOf(((L2Character) target).getPAtk(null)));
html.replace("%matk%", String.valueOf(((L2Character) target).getMAtk(null, null)));
html.replace("%pdef%", String.valueOf(((L2Character) target).getPDef(null)));
html.replace("%mdef%", String.valueOf(((L2Character) target).getMDef(null, null)));
html.replace("%patk%", String.valueOf((int) ((L2Character) target).getPAtk(null)));
html.replace("%matk%", String.valueOf((int) ((L2Character) target).getMAtk(null, null)));
html.replace("%pdef%", String.valueOf((int) ((L2Character) target).getPDef(null)));
html.replace("%mdef%", String.valueOf((int) ((L2Character) target).getMDef(null, null)));
html.replace("%accu%", String.valueOf(((L2Character) target).getAccuracy()));
html.replace("%evas%", String.valueOf(((L2Character) target).getEvasionRate(null)));
html.replace("%crit%", String.valueOf(((L2Character) target).getCriticalHit(null, null)));
@@ -126,8 +126,8 @@ public class L2NpcActionShift implements IActionShiftHandler
html.replace("%spawntype%", "Fixed");
html.replace("%spawn%", ((L2Npc) target).getSpawn().getX() + " " + ((L2Npc) target).getSpawn().getY() + " " + ((L2Npc) target).getSpawn().getZ());
}
html.replace("%loc2d%", String.valueOf((int) target.calculateDistance(((L2Npc) target).getSpawn().getLocation(target), false, false)));
html.replace("%loc3d%", String.valueOf((int) target.calculateDistance(((L2Npc) target).getSpawn().getLocation(target), true, false)));
html.replace("%loc2d%", String.valueOf((int) activeChar.calculateDistance(((L2Npc) target).getSpawn().getLocation(target), false, false)));
html.replace("%loc3d%", String.valueOf((int) activeChar.calculateDistance(((L2Npc) target).getSpawn().getLocation(target), true, false)));
if (((L2Npc) target).getSpawn().getRespawnMinDelay() == 0)
{
html.replace("%resp%", "None");

View File

@@ -1000,10 +1000,10 @@ public class AdminEditChar implements IAdminCommandHandler
adminReply.replace("%currentload%", String.valueOf(player.getCurrentLoad()));
adminReply.replace("%maxload%", String.valueOf(player.getMaxLoad()));
adminReply.replace("%percent%", String.valueOf(Util.roundTo(((float) player.getCurrentLoad() / (float) player.getMaxLoad()) * 100, 2)));
adminReply.replace("%patk%", String.valueOf(player.getPAtk(null)));
adminReply.replace("%matk%", String.valueOf(player.getMAtk(null, null)));
adminReply.replace("%pdef%", String.valueOf(player.getPDef(null)));
adminReply.replace("%mdef%", String.valueOf(player.getMDef(null, null)));
adminReply.replace("%patk%", String.valueOf((int) player.getPAtk(null)));
adminReply.replace("%matk%", String.valueOf((int) player.getMAtk(null, null)));
adminReply.replace("%pdef%", String.valueOf((int) player.getPDef(null)));
adminReply.replace("%mdef%", String.valueOf((int) player.getMDef(null, null)));
adminReply.replace("%accuracy%", String.valueOf(player.getAccuracy()));
adminReply.replace("%evasion%", String.valueOf(player.getEvasionRate(null)));
adminReply.replace("%critical%", String.valueOf(player.getCriticalHit(null, null)));

View File

@@ -222,7 +222,7 @@ public class AdminFightCalculator implements IAdminCommandHandler
{
shld1++;
}
boolean _crit1 = Formulas.calcCrit(npc1.getCriticalHit(npc2, null), false, npc2);
boolean _crit1 = Formulas.calcCrit(npc1, npc2);
if (_crit1)
{
crit1++;
@@ -255,7 +255,7 @@ public class AdminFightCalculator implements IAdminCommandHandler
{
shld2++;
}
boolean _crit2 = Formulas.calcCrit(npc2.getCriticalHit(npc1, null), false, npc1);
boolean _crit2 = Formulas.calcCrit(npc2, npc1);
if (_crit2)
{
crit2++;

View File

@@ -44,7 +44,6 @@ public class AdminHeal implements IAdminCommandHandler
@Override
public boolean useAdminCommand(String command, L2PcInstance activeChar)
{
if (command.equals("admin_heal"))
{
handleHeal(activeChar);

View File

@@ -187,11 +187,11 @@ public class NpcViewMod implements IBypassHandler
html.replace("%atktype%", Util.capitalizeFirst(npc.getAttackType().name().toLowerCase()));
html.replace("%atkrange%", npc.getStat().getPhysicalAttackRange());
html.replace("%patk%", npc.getPAtk(activeChar));
html.replace("%pdef%", npc.getPDef(activeChar));
html.replace("%patk%", (int) npc.getPAtk(activeChar));
html.replace("%pdef%", (int) npc.getPDef(activeChar));
html.replace("%matk%", npc.getMAtk(activeChar, null));
html.replace("%mdef%", npc.getMDef(activeChar, null));
html.replace("%matk%", (int) npc.getMAtk(activeChar, null));
html.replace("%mdef%", (int) npc.getMDef(activeChar, null));
html.replace("%atkspd%", npc.getPAtkSpd());
html.replace("%castspd%", npc.getMAtkSpd());

View File

@@ -84,6 +84,10 @@ public class QuestLink implements IBypassHandler
private static void showQuestChooseWindow(L2PcInstance player, L2Npc npc, Collection<Quest> quests)
{
final StringBuilder sb = StringUtil.startAppend(150, "<html><body>");
final StringBuilder qStarted = StringUtil.startAppend(150, "");
final StringBuilder qCanStart = StringUtil.startAppend(150, "");
final StringBuilder qCannotstart = StringUtil.startAppend(150, "");
final StringBuilder qComplete = StringUtil.startAppend(150, "");
String state = "";
String color = "";
@@ -121,35 +125,72 @@ public class QuestLink implements IBypassHandler
state = quest.isCustomQuest() ? " (Done)" : "03";
color = "787878";
}
StringUtil.append(sb, "<font color=\"" + color + "\">");
StringUtil.append(sb, "<button icon=\"quest\" align=\"left\" action=\"bypass -h npc_", String.valueOf(npc.getObjectId()), "_Quest ", quest.getName(), "\">");
if (quest.isCustomQuest())
switch (color)
{
StringUtil.append(sb, quest.getDescr(), state);
}
else
{
int questId = quest.getId();
if (questId > 10000)
case "ffdd66": // started
{
questId -= 5000;
StringUtil.append(qStarted, "<font color=\"" + color + "\">");
StringUtil.append(qStarted, "<button icon=\"quest\" align=\"left\" action=\"bypass -h npc_", String.valueOf(npc.getObjectId()), "_Quest ", quest.getName(), "\">");
appendToText(quest, qStarted, state);
break;
}
else if (questId == 146)
case "bbaa88": // can start
{
questId = 640;
StringUtil.append(qCanStart, "<font color=\"" + color + "\">");
StringUtil.append(qCanStart, "<button icon=\"quest\" align=\"left\" action=\"bypass -h npc_", String.valueOf(npc.getObjectId()), "_Quest ", quest.getName(), "\">");
appendToText(quest, qCanStart, state);
break;
}
case "a62f31": // cannot start
{
StringUtil.append(qCannotstart, "<font color=\"" + color + "\">");
StringUtil.append(qCannotstart, "<button icon=\"quest\" align=\"left\" action=\"bypass -h npc_", String.valueOf(npc.getObjectId()), "_Quest ", quest.getName(), "\">");
appendToText(quest, qCannotstart, state);
break;
}
case "787878": // complete
{
StringUtil.append(qComplete, "<font color=\"" + color + "\">");
StringUtil.append(qComplete, "<button icon=\"quest\" align=\"left\" action=\"bypass -h npc_", String.valueOf(npc.getObjectId()), "_Quest ", quest.getName(), "\">");
appendToText(quest, qComplete, state);
break;
}
StringUtil.append(sb, "<fstring>", String.valueOf(questId), state, "</fstring>");
}
sb.append("</button></font>");
}
sb.append(qStarted);
sb.append(qCanStart);
sb.append(qCannotstart);
sb.append(qComplete);
sb.append("</body></html>");
// Send a Server->Client packet NpcHtmlMessage to the L2PcInstance in order to display the message of the L2NpcInstance
npc.insertObjectIdAndShowChatWindow(player, sb.toString());
}
private static void appendToText(Quest quest, StringBuilder sb, String state)
{
if (quest.isCustomQuest())
{
StringUtil.append(sb, quest.getDescr(), state);
}
else
{
int questId = quest.getId();
if (questId > 10000)
{
questId -= 5000;
}
else if (questId == 146)
{
questId = 640;
}
StringUtil.append(sb, "<fstring>", String.valueOf(questId), state, "</fstring>");
}
sb.append("</button></font>");
}
/**
* Open a quest window on client with the text of the L2NpcInstance.<br>
* <b><u>Actions</u>:</b><br>

View File

@@ -26,7 +26,7 @@ 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.skills.Skill;
import com.l2jserver.gameserver.model.stats.Formulas;
/**
@@ -43,7 +43,7 @@ public final class Backstab extends AbstractEffect
@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());
return !info.getEffector().isInFrontOf(info.getEffected()) && !Formulas.calcPhysicalSkillEvasion(info.getEffector(), info.getEffected(), info.getSkill()) && Formulas.calcBlowSuccess(info.getEffector(), info.getEffected(), info.getSkill());
}
@Override
@@ -68,18 +68,19 @@ public final class Backstab extends AbstractEffect
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);
Skill skill = info.getSkill();
boolean ss = skill.useSoulShot() && activeChar.isChargedShot(ShotType.SOULSHOTS);
byte shld = Formulas.calcShldUse(activeChar, target, skill);
double damage = Formulas.calcBackstabDamage(activeChar, target, skill, shld, ss);
// Crit rate base crit rate for skill, modified with STR bonus
if (Formulas.calcCrit(info.getSkill().getBaseCritRate() * 10 * BaseStats.STR.calcBonus(activeChar), true, target))
if (Formulas.calcCrit(activeChar, target, skill))
{
damage *= 2;
}
target.reduceCurrentHp(damage, activeChar, info.getSkill());
target.notifyDamageReceived(damage, activeChar, info.getSkill(), true, false);
target.reduceCurrentHp(damage, activeChar, skill);
target.notifyDamageReceived(damage, activeChar, skill, true, false);
// Manage attack or cast break of the target (calculating rate, sending message...)
if (!target.isRaid() && Formulas.calcAtkBreak(target, damage))
@@ -95,6 +96,6 @@ public final class Backstab extends AbstractEffect
}
// Check if damage should be reflected
Formulas.calcDamageReflected(activeChar, target, info.getSkill(), true);
Formulas.calcDamageReflected(activeChar, target, skill, true);
}
}

View File

@@ -28,6 +28,7 @@ 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.AcquireSkillList;
import com.l2jserver.gameserver.network.serverpackets.ExSubjobInfo;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
@@ -80,8 +81,8 @@ public class ClassChange extends AbstractEffect
msg.addClassId(activeClass);
msg.addClassId(player.getClassId().getId());
player.sendPacket(msg);
player.broadcastUserInfo();
player.sendPacket(new AcquireSkillList(player));
player.sendPacket(new ExSubjobInfo(player, SubclassInfoType.CLASS_CHANGED));
}, 1000);
}

View File

@@ -32,6 +32,7 @@ public final class DamOverTime extends AbstractEffect
{
private final boolean _canKill;
private final double _power;
private final int _charge;
public DamOverTime(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
@@ -39,6 +40,7 @@ public final class DamOverTime extends AbstractEffect
_canKill = params.getBoolean("canKill", false);
_power = params.getDouble("power", 0);
_charge = params.getInt("charge", 0);
}
@Override
@@ -76,6 +78,16 @@ public final class DamOverTime extends AbstractEffect
}
}
if ((_charge != 0) && (info.getEffected().getActingPlayer().getCharges() >= _charge))
{
info.getEffected().sendPacket(SystemMessageId.YOUR_FORCE_HAS_REACHED_MAXIMUM_CAPACITY);
return false;
}
else if (_charge != 0)
{
info.getEffected().getActingPlayer().increaseCharges(1, _charge);
}
info.getEffected().reduceCurrentHpByDOT(damage, info.getEffector(), info.getSkill());
info.getEffected().notifyDamageReceived(damage, info.getEffector(), info.getSkill(), false, true);
return info.getSkill().isToggle();

View File

@@ -85,7 +85,7 @@ public final class EnergyAttack extends AbstractEffect
final Skill skill = info.getSkill();
double attack = attacker.getPAtk(target);
int defence = target.getPDef(attacker);
double defence = target.getPDef(attacker);
if (!_ignoreShieldDefence)
{
@@ -130,11 +130,27 @@ public final class EnergyAttack extends AbstractEffect
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;
double energyChargesBoost = 1;
if (attacker.getCharges() == 1)
{
energyChargesBoost = 1.1;
attacker.decreaseCharges(1);
}
else if (attacker.getCharges() == 2)
{
energyChargesBoost = 1.2;
attacker.decreaseCharges(2);
}
else if (attacker.getCharges() >= 3)
{
energyChargesBoost = 1.3;
attacker.decreaseCharges(3);
}
double addPower = (attacker.getStat().calcStat(Stats.MOMENTUM_SKILL_POWER, 1, null, null));
attack += _power;
attack *= addPower;
attack *= ssBoost;
attack *= energyChargesBoost;
attack *= weaponTypeBoost;
@@ -157,6 +173,13 @@ public final class EnergyAttack extends AbstractEffect
if (damage > 0)
{
// reduce damage if target has maxdamage buff
double maxDamage = (target.getStat().calcStat(Stats.MAX_SKILL_DAMAGE, 0, null, null));
if (maxDamage > 0)
{
damage = (int) maxDamage;
}
attacker.sendDamageMessage(target, (int) damage, false, critical, false);
target.reduceCurrentHp(damage, attacker, skill);
target.notifyDamageReceived(damage, attacker, skill, critical, false);

View File

@@ -18,6 +18,8 @@
*/
package handlers.effecthandlers;
import java.util.StringTokenizer;
import com.l2jserver.gameserver.enums.ShotType;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.actor.L2Character;
@@ -25,9 +27,11 @@ 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.AbnormalType;
import com.l2jserver.gameserver.model.skills.BuffInfo;
import com.l2jserver.gameserver.model.stats.BaseStats;
import com.l2jserver.gameserver.model.skills.Skill;
import com.l2jserver.gameserver.model.stats.Formulas;
import com.l2jserver.gameserver.model.stats.Stats;
/**
* Fatal Blow effect implementation.
@@ -35,9 +39,15 @@ import com.l2jserver.gameserver.model.stats.Formulas;
*/
public final class FatalBlow extends AbstractEffect
{
private final String _targetAbnormalType;
private final double _skillAddPower;
public FatalBlow(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
_targetAbnormalType = params.getString("targetAbnormalType", "NULL");
_skillAddPower = params.getDouble("skillAddPower", 1);
}
@Override
@@ -63,25 +73,46 @@ public final class FatalBlow extends AbstractEffect
{
L2Character target = info.getEffected();
L2Character activeChar = info.getEffector();
Skill skill = info.getSkill();
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);
boolean ss = skill.useSoulShot() && activeChar.isChargedShot(ShotType.SOULSHOTS);
byte shld = Formulas.calcShldUse(activeChar, target, skill);
double damage = Formulas.calcBlowDamage(activeChar, target, skill, 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 (_targetAbnormalType != "NULL")
{
StringTokenizer st = new StringTokenizer(_targetAbnormalType, ",");
while (st.hasMoreTokens())
{
String abnormal = st.nextToken().trim();
if (target.getEffectList().getBuffInfoByAbnormalType(AbnormalType.valueOf(abnormal)) != null)
{
damage *= _skillAddPower;
break;
}
}
}
boolean crit = Formulas.calcCrit(activeChar, target, skill);
if (crit)
{
damage *= 2;
}
target.reduceCurrentHp(damage, activeChar, info.getSkill());
target.notifyDamageReceived(damage, activeChar, info.getSkill(), crit, false);
// reduce damage if target has maxdamage buff
double maxDamage = (target.getStat().calcStat(Stats.MAX_SKILL_DAMAGE, 0, null, null));
if (maxDamage > 0)
{
damage = (int) maxDamage;
}
target.reduceCurrentHp(damage, activeChar, skill);
target.notifyDamageReceived(damage, activeChar, skill, crit, false);
// Manage attack or cast break of the target (calculating rate, sending message...)
if (!target.isRaid() && Formulas.calcAtkBreak(target, damage))
@@ -97,6 +128,6 @@ public final class FatalBlow extends AbstractEffect
}
// Check if damage should be reflected
Formulas.calcDamageReflected(activeChar, target, info.getSkill(), true);
Formulas.calcDamageReflected(activeChar, target, skill, true);
}
}

View File

@@ -48,7 +48,8 @@ public final class FocusMaxEnergy extends AbstractEffect
{
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;
final Skill maximumForceMastery = info.getEffected().getSkills().get(10301);
int maxCharge = (sonicMastery != null) ? sonicMastery.getLevel() : (focusMastery != null) ? focusMastery.getLevel() : (maximumForceMastery != null) ? 15 : 0;
if (maxCharge != 0)
{
int count = maxCharge - info.getEffected().getActingPlayer().getCharges();

View File

@@ -130,7 +130,7 @@ public final class HpCpHeal extends AbstractEffect
{
target.sendPacket(SystemMessageId.REJUVENATING_HP);
}
else
else if (healAmount != 0)
{
if (activeChar.isPlayer() && (activeChar != target))
{
@@ -152,20 +152,20 @@ public final class HpCpHeal extends AbstractEffect
if (amount != 0)
{
target.setCurrentCp(amount + target.getCurrentCp());
}
if (activeChar.isPlayer() && (activeChar != target))
{
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S2_CP_HAS_BEEN_RESTORED_BY_C1);
sm.addString(activeChar.getName());
sm.addInt((int) amount);
target.sendPacket(sm);
}
else
{
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CP_HAS_BEEN_RESTORED);
sm.addInt((int) healAmount);
target.sendPacket(sm);
if (activeChar.isPlayer() && (activeChar != target))
{
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S2_CP_HAS_BEEN_RESTORED_BY_C1);
sm.addString(activeChar.getName());
sm.addInt((int) amount);
target.sendPacket(sm);
}
else
{
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CP_HAS_BEEN_RESTORED);
sm.addInt((int) amount);
target.sendPacket(sm);
}
}
}
}

View File

@@ -25,6 +25,8 @@ 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.effects.L2EffectType;
import com.l2jserver.gameserver.model.skills.BuffInfo;
import com.l2jserver.gameserver.network.serverpackets.FlyToLocation;
import com.l2jserver.gameserver.network.serverpackets.FlyToLocation.FlyType;
@@ -53,6 +55,18 @@ public final class KnockDown extends AbstractEffect
}
}
@Override
public int getEffectFlags()
{
return EffectFlag.STUNNED.getMask();
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.STUN;
}
@Override
public void onStart(BuffInfo info)
{

View File

@@ -79,6 +79,13 @@ public final class MagicalAttackByAbnormal extends AbstractEffect
if (damage > 0)
{
// reduce damage if target has maxdamage buff
double maxDamage = (target.getStat().calcStat(Stats.MAX_SKILL_DAMAGE, 0, null, null));
if (maxDamage > 0)
{
damage = (int) maxDamage;
}
// Manage attack or cast break of the target (calculating rate, sending message...)
if (!target.isRaid() && Formulas.calcAtkBreak(target, damage))
{

View File

@@ -83,6 +83,13 @@ public final class MagicalSoulAttack extends AbstractEffect
if (damage > 0)
{
// reduce damage if target has maxdamage buff
double maxDamage = (target.getStat().calcStat(Stats.MAX_SKILL_DAMAGE, 0, null, null));
if (maxDamage > 0)
{
damage = (int) maxDamage;
}
// Manage attack or cast break of the target (calculating rate, sending message...)
if (!target.isRaid() && Formulas.calcAtkBreak(target, damage))
{

View File

@@ -18,15 +18,19 @@
*/
package handlers.effecthandlers;
import java.util.StringTokenizer;
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.type.WeaponType;
import com.l2jserver.gameserver.model.skills.BuffInfo;
import com.l2jserver.gameserver.model.stats.BaseStats;
import com.l2jserver.gameserver.model.skills.Skill;
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.SystemMessage;
@@ -36,9 +40,21 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
*/
public final class PhysicalAttack extends AbstractEffect
{
private final String _type1;
private final double _valueReduce;
private final String _type2;
private final double _valueIncrease;
private final boolean _isLastAttack;
public PhysicalAttack(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
_type1 = params.getString("weaponTypeDec", "NONE");
_valueReduce = params.getDouble("valueDec", 1);
_type2 = params.getString("weaponTypeInc", "NONE");
_valueIncrease = params.getDouble("valueInc", 1);
_isLastAttack = params.getBoolean("isLastAttack", false);
}
@Override
@@ -64,16 +80,17 @@ public final class PhysicalAttack extends AbstractEffect
{
L2Character target = info.getEffected();
L2Character activeChar = info.getEffector();
Skill skill = info.getSkill();
if (activeChar.isAlikeDead())
{
return;
}
if (((info.getSkill().getFlyRadius() > 0) || (info.getSkill().getFlyType() != null)) && activeChar.isMovementDisabled())
if (((info.getSkill().getFlyRadius() > 0) || (skill.getFlyType() != null)) && activeChar.isMovementDisabled())
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
sm.addSkillName(info.getSkill());
sm.addSkillName(skill);
activeChar.sendPacket(sm);
return;
}
@@ -84,37 +101,82 @@ public final class PhysicalAttack extends AbstractEffect
}
int damage = 0;
boolean ss = info.getSkill().isPhysical() && activeChar.isChargedShot(ShotType.SOULSHOTS);
final byte shld = Formulas.calcShldUse(activeChar, target, info.getSkill());
boolean ss = skill.isPhysical() && activeChar.isChargedShot(ShotType.SOULSHOTS);
final byte shld = Formulas.calcShldUse(activeChar, target, skill);
// Physical damage critical rate is only affected by STR.
boolean crit = false;
if (info.getSkill().getBaseCritRate() > 0)
if (skill.getBaseCritRate() > 0)
{
crit = Formulas.calcCrit(info.getSkill().getBaseCritRate() * 10 * BaseStats.STR.calcBonus(activeChar), true, target);
crit = Formulas.calcCrit(activeChar, target, skill);
}
damage = (int) Formulas.calcPhysDam(activeChar, target, info.getSkill(), shld, false, ss);
damage = (int) Formulas.calcPhysDam(activeChar, target, skill, shld, false, ss);
if (crit)
{
damage *= 2;
}
if ((activeChar.getActiveWeaponItem() != null) && (_type1 != "NONE") && (_type2 != "NONE"))
{
StringTokenizer st = new StringTokenizer(_type1, ",");
while (st.hasMoreTokens())
{
String item = st.nextToken().trim();
if (activeChar.getActiveWeaponItem().getItemType() == WeaponType.valueOf(item))
{
damage *= _valueReduce;
break;
}
}
st = new StringTokenizer(_type2, ",");
while (st.hasMoreTokens())
{
String item = st.nextToken().trim();
if (activeChar.getActiveWeaponItem().getItemType() == WeaponType.valueOf(item))
{
damage *= _valueIncrease;
break;
}
}
}
if (damage > 0)
{
// reduce damage if target has maxdamage buff
double maxDamage = (target.getStat().calcStat(Stats.MAX_SKILL_DAMAGE, 0, null, null));
if (maxDamage > 0)
{
damage = (int) maxDamage;
}
activeChar.sendDamageMessage(target, damage, false, crit, false);
target.reduceCurrentHp(damage, activeChar, info.getSkill());
target.notifyDamageReceived(damage, activeChar, info.getSkill(), crit, false);
if (_isLastAttack && !target.isPlayer() && !target.isRaid())
{
if (damage < target.getCurrentHp())
{
target.setCurrentHp(1);
}
else
{
target.reduceCurrentHp(damage, activeChar, skill);
}
}
else
{
target.reduceCurrentHp(damage, activeChar, skill);
target.notifyDamageReceived(damage, activeChar, skill, crit, false);
}
// Check if damage should be reflected
Formulas.calcDamageReflected(activeChar, target, info.getSkill(), crit);
Formulas.calcDamageReflected(activeChar, target, skill, crit);
}
else
{
activeChar.sendPacket(SystemMessageId.YOUR_ATTACK_HAS_FAILED);
}
if (info.getSkill().isSuicideAttack())
if (skill.isSuicideAttack())
{
activeChar.doDie(activeChar);
}

View File

@@ -25,8 +25,9 @@ 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.skills.Skill;
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.SystemMessage;
@@ -64,6 +65,7 @@ public final class PhysicalAttackHpLink extends AbstractEffect
{
L2Character target = info.getEffected();
L2Character activeChar = info.getEffector();
Skill skill = info.getSkill();
if (activeChar.isAlikeDead())
{
@@ -73,31 +75,38 @@ public final class PhysicalAttackHpLink extends AbstractEffect
if (activeChar.isMovementDisabled())
{
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
sm.addSkillName(info.getSkill());
sm.addSkillName(skill);
activeChar.sendPacket(sm);
return;
}
final byte shld = Formulas.calcShldUse(activeChar, target, info.getSkill());
final byte shld = Formulas.calcShldUse(activeChar, target, skill);
// Physical damage critical rate is only affected by STR.
boolean crit = false;
if (info.getSkill().getBaseCritRate() > 0)
if (skill.getBaseCritRate() > 0)
{
crit = Formulas.calcCrit(info.getSkill().getBaseCritRate() * 10 * BaseStats.STR.calcBonus(activeChar), true, target);
crit = Formulas.calcCrit(activeChar, target, skill);
}
int damage = 0;
boolean ss = info.getSkill().isPhysical() && activeChar.isChargedShot(ShotType.SOULSHOTS);
damage = (int) Formulas.calcPhysDam(activeChar, target, info.getSkill(), shld, false, ss);
boolean ss = skill.isPhysical() && activeChar.isChargedShot(ShotType.SOULSHOTS);
damage = (int) Formulas.calcPhysDam(activeChar, target, skill, shld, false, ss);
if (damage > 0)
{
// reduce damage if target has maxdamage buff
double maxDamage = (target.getStat().calcStat(Stats.MAX_SKILL_DAMAGE, 0, null, null));
if (maxDamage > 0)
{
damage = (int) maxDamage;
}
activeChar.sendDamageMessage(target, damage, false, crit, false);
target.reduceCurrentHp(damage, activeChar, info.getSkill());
target.notifyDamageReceived(damage, activeChar, info.getSkill(), crit, false);
target.reduceCurrentHp(damage, activeChar, skill);
target.notifyDamageReceived(damage, activeChar, skill, crit, false);
// Check if damage should be reflected.
Formulas.calcDamageReflected(activeChar, target, info.getSkill(), crit);
Formulas.calcDamageReflected(activeChar, target, skill, crit);
}
else
{

View File

@@ -25,8 +25,9 @@ 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.skills.Skill;
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.SystemMessage;
@@ -64,16 +65,17 @@ public final class PhysicalSoulAttack extends AbstractEffect
{
L2Character target = info.getEffected();
L2Character activeChar = info.getEffector();
Skill skill = info.getSkill();
if (activeChar.isAlikeDead())
{
return;
}
if (((info.getSkill().getFlyRadius() > 0) || (info.getSkill().getFlyType() != null)) && activeChar.isMovementDisabled())
if (((skill.getFlyRadius() > 0) || (skill.getFlyType() != null)) && activeChar.isMovementDisabled())
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
sm.addSkillName(info.getSkill());
sm.addSkillName(skill);
activeChar.sendPacket(sm);
return;
}
@@ -84,21 +86,21 @@ public final class PhysicalSoulAttack extends AbstractEffect
}
int damage = 0;
boolean ss = info.getSkill().isPhysical() && activeChar.isChargedShot(ShotType.SOULSHOTS);
final byte shld = Formulas.calcShldUse(activeChar, target, info.getSkill());
boolean ss = skill.isPhysical() && activeChar.isChargedShot(ShotType.SOULSHOTS);
final byte shld = Formulas.calcShldUse(activeChar, target, skill);
// Physical damage critical rate is only affected by STR.
boolean crit = false;
if (info.getSkill().getBaseCritRate() > 0)
if (skill.getBaseCritRate() > 0)
{
crit = Formulas.calcCrit(info.getSkill().getBaseCritRate() * 10 * BaseStats.STR.calcBonus(activeChar), true, target);
crit = Formulas.calcCrit(activeChar, target, skill);
}
damage = (int) Formulas.calcPhysDam(activeChar, target, info.getSkill(), shld, false, ss);
damage = (int) Formulas.calcPhysDam(activeChar, target, skill, shld, false, ss);
if ((info.getSkill().getMaxSoulConsumeCount() > 0) && activeChar.isPlayer())
if ((skill.getMaxSoulConsumeCount() > 0) && activeChar.isPlayer())
{
// Souls Formula (each soul increase +4%)
int chargedSouls = (activeChar.getActingPlayer().getChargedSouls() <= info.getSkill().getMaxSoulConsumeCount()) ? activeChar.getActingPlayer().getChargedSouls() : info.getSkill().getMaxSoulConsumeCount();
int chargedSouls = (activeChar.getActingPlayer().getChargedSouls() <= skill.getMaxSoulConsumeCount()) ? activeChar.getActingPlayer().getChargedSouls() : skill.getMaxSoulConsumeCount();
damage *= 1 + (chargedSouls * 0.04);
}
if (crit)
@@ -108,19 +110,26 @@ public final class PhysicalSoulAttack extends AbstractEffect
if (damage > 0)
{
// reduce damage if target has maxdamage buff
double maxDamage = (target.getStat().calcStat(Stats.MAX_SKILL_DAMAGE, 0, null, null));
if (maxDamage > 0)
{
damage = (int) maxDamage;
}
activeChar.sendDamageMessage(target, damage, false, crit, false);
target.reduceCurrentHp(damage, activeChar, info.getSkill());
target.notifyDamageReceived(damage, activeChar, info.getSkill(), crit, false);
target.reduceCurrentHp(damage, activeChar, skill);
target.notifyDamageReceived(damage, activeChar, skill, crit, false);
// Check if damage should be reflected
Formulas.calcDamageReflected(activeChar, target, info.getSkill(), crit);
Formulas.calcDamageReflected(activeChar, target, skill, crit);
}
else
{
activeChar.sendPacket(SystemMessageId.YOUR_ATTACK_HAS_FAILED);
}
if (info.getSkill().isSuicideAttack())
if (skill.isSuicideAttack())
{
activeChar.doDie(activeChar);
}

View File

@@ -22,6 +22,7 @@ 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.Stats;
/**
* Static Damage effect implementation.
@@ -29,7 +30,7 @@ import com.l2jserver.gameserver.model.skills.BuffInfo;
*/
public final class StaticDamage extends AbstractEffect
{
private final int _power;
private int _power;
public StaticDamage(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
@@ -52,6 +53,13 @@ public final class StaticDamage extends AbstractEffect
return;
}
// reduce damage if target has maxdamage buff
double maxDamage = (info.getEffected().getStat().calcStat(Stats.MAX_SKILL_DAMAGE, 0, null, null));
if (maxDamage > 0)
{
_power = (int) maxDamage;
}
info.getEffected().reduceCurrentHp(_power, info.getEffector(), info.getSkill());
info.getEffected().notifyDamageReceived(_power, info.getEffector(), info.getSkill(), false, false);

View File

@@ -28,6 +28,7 @@ import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
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.holders.SkillHolder;
import com.l2jserver.gameserver.model.skills.BuffInfo;
/**
@@ -42,6 +43,7 @@ public final class Summon extends AbstractEffect
private final int _lifeTime;
private final int _consumeItemInterval;
private final int _summonPoints;
private final SkillHolder _debuff;
public Summon(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
@@ -58,6 +60,7 @@ public final class Summon extends AbstractEffect
_consumeItemInterval = params.getInt("consumeItemInterval", 0);
_lifeTime = params.getInt("lifeTime", 3600) * 1000;
_summonPoints = params.getInt("summonPoints", 0);
_debuff = new SkillHolder(params.getInt("debuffId", 0), 1);
}
@Override
@@ -115,5 +118,9 @@ public final class Summon extends AbstractEffect
summon.setShowSummonAnimation(true);
summon.setRunning();
summon.spawnMe();
if (_debuff.getSkillId() != 0)
{
_debuff.getSkill().applyEffects(player, player);
}
}
}

View File

@@ -44,6 +44,7 @@ public final class TriggerSkillBySkill extends AbstractEffect
private final int _chance;
private final SkillHolder _skill;
private final L2TargetType _targetType;
private final int AQUAMARINE = 17822;
/**
* @param attachCond
@@ -64,12 +65,12 @@ public final class TriggerSkillBySkill extends AbstractEffect
public void onSkillUseEvent(OnCreatureSkillUse event)
{
if ((_chance == 0) || ((_skill.getSkillId() == 0) || (_skill.getSkillLvl() == 0) || (_castSkillId == 0)))
if ((_chance == 0) || ((_skill.getSkillId() == 0) || (_skill.getSkillLvl() == 0) || ((_castSkillId == 0) && (_skill.getSkillId() != AQUAMARINE))))
{
return;
}
if (_castSkillId != event.getSkill().getId())
if ((_castSkillId != event.getSkill().getId()) && (_skill.getSkillId() != AQUAMARINE))
{
return;
}

View File

@@ -175,9 +175,9 @@ public class PlayerHandler implements ITelnetHandler
itemType = 0;
}
if (enchant > 65535)
if (enchant > 127)
{
enchant = 65535;
enchant = 127;
}
else if (enchant < 0)
{