L2Character attack rework.

Adapted from: L2jUnity free files.
This commit is contained in:
MobiusDev
2017-12-06 18:29:40 +00:00
parent 52e54b75ce
commit 86b76fd312
189 changed files with 3462 additions and 3804 deletions

View File

@@ -44,6 +44,7 @@ public final class EffectMasterHandler
EffectHandler.getInstance().registerHandler("AttackAttribute", AttackAttribute::new);
EffectHandler.getInstance().registerHandler("AttackAttributeAdd", AttackAttributeAdd::new);
EffectHandler.getInstance().registerHandler("AttackBehind", AttackBehind::new);
EffectHandler.getInstance().registerHandler("AttackDamagePosition", AttackDamagePosition::new);
EffectHandler.getInstance().registerHandler("AttackTrait", AttackTrait::new);
EffectHandler.getInstance().registerHandler("Backstab", Backstab::new);
EffectHandler.getInstance().registerHandler("Betray", Betray::new);
@@ -236,6 +237,7 @@ public final class EffectMasterHandler
EffectHandler.getInstance().registerHandler("PhysicalSoulAttack", PhysicalSoulAttack::new);
EffectHandler.getInstance().registerHandler("PkCount", PkCount::new);
EffectHandler.getInstance().registerHandler("Plunder", Plunder::new);
EffectHandler.getInstance().registerHandler("PolearmSingleTarget", PolearmSingleTarget::new);
EffectHandler.getInstance().registerHandler("ProtectionBlessing", ProtectionBlessing::new);
EffectHandler.getInstance().registerHandler("ProtectDeathPenalty", ProtectDeathPenalty::new);
EffectHandler.getInstance().registerHandler("PullBack", PullBack::new);

View File

@@ -0,0 +1,53 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.effecthandlers;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.enums.Position;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* @author Nik
*/
public class AttackDamagePosition extends AbstractEffect
{
protected final double _amount;
protected final Position _position;
public AttackDamagePosition(StatsSet params)
{
_amount = params.getDouble("amount");
_position = params.getEnum("position", Position.class);
}
@Override
public void pump(L2Character effected, Skill skill)
{
effected.getStat().mergePositionTypeValue(Stats.ATTACK_DAMAGE, _position, (_amount / 100) + 1, MathUtil::mul);
}
@Override
public void onExit(BuffInfo info)
{
info.getEffected().getStat().mergePositionTypeValue(Stats.ATTACK_DAMAGE, _position, (_amount / 100) + 1, MathUtil::div);
}
}

View File

@@ -88,7 +88,7 @@ public final class Backstab extends AbstractEffect
}
// Check if damage should be reflected
Formulas.calcDamageReflected(effector, effected, skill, true);
Formulas.calcCounterAttack(effector, effected, skill, true);
final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT);
if (damageCap > 0)

View File

@@ -163,7 +163,7 @@ public final class EnergyAttack extends AbstractEffect
damage = Math.max(0, damage);
// Check if damage should be reflected
Formulas.calcDamageReflected(attacker, effected, skill, critical);
Formulas.calcCounterAttack(attacker, effected, skill, critical);
final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT);
if (damageCap > 0)

View File

@@ -119,7 +119,7 @@ public final class FatalBlow extends AbstractEffect
}
// Check if damage should be reflected
Formulas.calcDamageReflected(effector, effected, skill, true);
Formulas.calcCounterAttack(effector, effected, skill, true);
final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT);
if (damageCap > 0)

View File

@@ -115,6 +115,6 @@ public final class Lethal extends AbstractEffect
}
// No matter if lethal succeeded or not, its reflected.
Formulas.calcDamageReflected(effector, effected, skill, false);
Formulas.calcCounterAttack(effector, effected, skill, false);
}
}

View File

@@ -173,7 +173,7 @@ public final class PhysicalAttack extends AbstractEffect
}
// Check if damage should be reflected
Formulas.calcDamageReflected(effector, effected, skill, critical);
Formulas.calcCounterAttack(effector, effected, skill, critical);
final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT);
if (damageCap > 0)
{

View File

@@ -135,7 +135,7 @@ public final class PhysicalAttackHpLink extends AbstractEffect
}
// Check if damage should be reflected.
Formulas.calcDamageReflected(effector, effected, skill, critical);
Formulas.calcCounterAttack(effector, effected, skill, critical);
final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT);
if (damageCap > 0)

View File

@@ -145,7 +145,7 @@ public final class PhysicalAttackSaveHp extends AbstractEffect
}
// Check if damage should be reflected
Formulas.calcDamageReflected(effector, effected, skill, critical);
Formulas.calcCounterAttack(effector, effected, skill, critical);
final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT);
if (damageCap > 0)

View File

@@ -166,7 +166,7 @@ public final class PhysicalAttackWeaponBonus extends AbstractEffect
}
// Check if damage should be reflected
Formulas.calcDamageReflected(effector, effected, skill, critical);
Formulas.calcCounterAttack(effector, effected, skill, critical);
final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT);
if (damageCap > 0)

View File

@@ -160,7 +160,7 @@ public final class PhysicalSoulAttack extends AbstractEffect
}
// Check if damage should be reflected
Formulas.calcDamageReflected(effector, effected, skill, critical);
Formulas.calcCounterAttack(effector, effected, skill, critical);
final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT);
if (damageCap > 0)

View File

@@ -0,0 +1,52 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.effecthandlers;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* @author Sdw
*/
public class PolearmSingleTarget extends AbstractEffect
{
public PolearmSingleTarget(StatsSet params)
{
}
@Override
public void onStart(L2Character effector, L2Character effected, Skill skill)
{
if (effected.isPlayer())
{
effected.getStat().addFixedValue(Stats.PHYSICAL_POLEARM_TARGET_SINGLE, 1.0);
}
}
@Override
public void onExit(BuffInfo info)
{
if (info.getEffected().isPlayer())
{
info.getEffected().getStat().removeFixedValue(Stats.PHYSICAL_POLEARM_TARGET_SINGLE);
}
}
}

View File

@@ -93,7 +93,7 @@ public final class SoulBlow extends AbstractEffect
}
// Check if damage should be reflected
Formulas.calcDamageReflected(effector, effected, skill, true);
Formulas.calcCounterAttack(effector, effected, skill, true);
final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT);
if (damageCap > 0)

View File

@@ -98,7 +98,7 @@ public class SummonHallucination extends AbstractEffect
clone.setSummoner(player);
clone.spawnMe(x, y, z);
clone.scheduleDespawn(_despawnDelay);
clone.doAttack(effected);
clone.doAutoAttack(effected);
}
}
}

View File

@@ -865,14 +865,14 @@ public final class MemoryOfDisaster extends AbstractInstance
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.NO_WAY2);
npc.doDie(null);
attacker.doAttack(world.getNpc(SILVERA));
attacker.doAutoAttack(world.getNpc(SILVERA));
break;
}
case SILVERA:
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.MY_GOD);
npc.doDie(null);
world.getNpc(SIEGE_GOLEM).doAttack(attacker);
world.getNpc(SIEGE_GOLEM).doAutoAttack(attacker);
break;
}
}

View File

@@ -821,13 +821,7 @@
<hitTime>2000</hitTime>
<targetType>NONE</targetType>
<effects>
<effect name="HitNumber">
<amount>1</amount>
<mode>DIFF</mode>
<weaponType>
<item>POLE</item>
</weaponType>
</effect>
<effect name="PolearmSingleTarget" />
<effect name="Accuracy">
<amount>
<value level="1">2</value>

View File

@@ -902,7 +902,15 @@
<!-- Rear Damage + 3%. -->
<operateType>P</operateType>
<icon>icon.skill0030</icon>
<!-- TODO: Handle rear damage stat -->
<effects>
<effect name="AttackDamagePosition">
<amount>
<value level="1">3</value>
<value level="2">6</value>
</amount>
<position>BACK</position>
</effect>
</effects>
</skill>
<skill id="19145" toLevel="2" name="Noble Death Whisper">
<!-- Physical Critical Damage + 3%. -->

View File

@@ -13,6 +13,7 @@ AreaDamage: Topography (Danger Zone) resistance stat.
AttackAttribute: Stat that increases specific attack attribute.
AttackAttributeAdd: Stat that increases all attack attribute.
AttackBehind: Enables all attacks regardless of position to land towards the back.
AttackDamagePosition: Bonus damage depending on player position towards the target.
AttackTrait: Stat that manages all attack traits.
Backstab: Inflicts physical damage according to the backstab formula.
Betray: Causes the target summon to attack its owner.
@@ -205,6 +206,7 @@ PhysicalSkillPower: Physical Skill Power stat.
PhysicalSoulAttack: Physical attack depending on souls.
PkCount: Increases PK kills.
Plunder: Takes bonus item from monster. Sweep effect.
PolearmSingleTarget: Effect used by Focus Attack (317) skill.
ProtectDeathPenalty: Unable to acquire death penalty.
ProtectionBlessing: Keeps you safe from a PK if he is 10 levels or higher.
PullBack: Pulls the target towards you.