Created
February 21, 2014 15:17
-
-
Save Sdwz/9136025 to your computer and use it in GitHub Desktop.
Pole damage + pole VR calculation attempt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: java/com/l2jserver/gameserver/model/actor/L2Character.java | |
=================================================================== | |
--- java/com/l2jserver/gameserver/model/actor/L2Character.java (révision 6374) | |
+++ java/com/l2jserver/gameserver/model/actor/L2Character.java (copie de travail) | |
@@ -1416,9 +1416,10 @@ | |
int attackcount = 0; | |
// if (angleChar <= 0) angleChar += 360; | |
+ double attackpercent = 100; | |
+ boolean hitted = doAttackHitSimple(attack, target, attackpercent, sAtk); | |
+ int targetNumber = 0; | |
- boolean hitted = doAttackHitSimple(attack, target, 100, sAtk); | |
- double attackpercent = 85; | |
L2Character temp; | |
Collection<L2Object> objs = getKnownList().getKnownObjects().values(); | |
@@ -1474,8 +1475,8 @@ | |
{ | |
if ((temp == getAI().getAttackTarget()) || temp.isAutoAttackable(this)) | |
{ | |
- hitted |= doAttackHitSimple(attack, temp, attackpercent, sAtk); | |
- attackpercent /= 1.15; | |
+ hitted |= doAttackHitSimple(attack, temp, attackpercent, sAtk, targetNumber); | |
+ targetNumber++; | |
attackcount++; | |
if (attackcount > attackRandomCountMax) | |
@@ -1509,11 +1510,16 @@ | |
*/ | |
private boolean doAttackHitSimple(Attack attack, L2Character target, int sAtk) | |
{ | |
- return doAttackHitSimple(attack, target, 100, sAtk); | |
+ return doAttackHitSimple(attack, target, 100, sAtk, 0); | |
} | |
private boolean doAttackHitSimple(Attack attack, L2Character target, double attackpercent, int sAtk) | |
{ | |
+ return doAttackHitSimple(attack, target, 100, sAtk, 0); | |
+ } | |
+ | |
+ private boolean doAttackHitSimple(Attack attack, L2Character target, double attackpercent, int sAtk, int targetNumber) | |
+ { | |
int damage1 = 0; | |
byte shld1 = 0; | |
boolean crit1 = false; | |
@@ -1540,7 +1546,7 @@ | |
} | |
// Create a new hit task with Medium priority | |
- ThreadPoolManager.getInstance().scheduleAi(new HitTask(this, target, damage1, crit1, miss1, attack.hasSoulshot(), shld1), sAtk); | |
+ ThreadPoolManager.getInstance().scheduleAi(new HitTask(this, target, damage1, crit1, miss1, attack.hasSoulshot(), shld1, targetNumber), sAtk); | |
// Add this hit to the Server-Client packet Attack | |
attack.addHit(target, damage1, miss1, crit1, shld1); | |
@@ -4958,6 +4964,28 @@ | |
*/ | |
public void onHitTimer(L2Character target, int damage, boolean crit, boolean miss, boolean soulshot, byte shld) | |
{ | |
+ onHitTimer(target, damage, crit, miss, soulshot, shld, 0); | |
+ } | |
+ | |
+ /** | |
+ * Manage hit process (called by Hit Task).<br> | |
+ * <B><U>Actions</U>:</B> | |
+ * <ul> | |
+ * <li>If the attacker/target is dead or use fake death, notify the AI with EVT_CANCEL and send a Server->Client packet ActionFailed (if attacker is a L2PcInstance)</li> | |
+ * <li>If attack isn't aborted, send a message system (critical hit, missed...) to attacker/target if they are L2PcInstance</li> | |
+ * <li>If attack isn't aborted and hit isn't missed, reduce HP of the target and calculate reflection damage to reduce HP of attacker if necessary</li> | |
+ * <li>if attack isn't aborted and hit isn't missed, manage attack or cast break of the target (calculating rate, sending message...)</li> | |
+ * </ul> | |
+ * @param target The L2Character targeted | |
+ * @param damage Nb of HP to reduce | |
+ * @param crit True if hit is critical | |
+ * @param miss True if hit is missed | |
+ * @param soulshot True if SoulShot are charged | |
+ * @param shld True if shield is efficient | |
+ * @param targetNumber Hit number | |
+ */ | |
+ public void onHitTimer(L2Character target, int damage, boolean crit, boolean miss, boolean soulshot, byte shld, int targetNumber) | |
+ { | |
// If the attacker/target is dead or use fake death, notify the AI with EVT_CANCEL | |
// and send a Server->Client packet ActionFailed (if attacker is a L2PcInstance) | |
if ((target == null) || isAlikeDead() || (isNpc() && ((L2Npc) this).isEventMob())) | |
@@ -5071,6 +5099,18 @@ | |
// Absorb HP from the damage inflicted | |
double absorbPercent = getStat().calcStat(Stats.ABSORB_DAMAGE_PERCENT, 0, null, null); | |
+ if (targetNumber > 0) | |
+ { | |
+ if (targetNumber >= 10) | |
+ { | |
+ absorbPercent = 0.; | |
+ } | |
+ else | |
+ { | |
+ absorbPercent = absorbPercent - (absorbPercent * (1. - ((10. * targetNumber) / 100.))); | |
+ } | |
+ } | |
+ | |
if (absorbPercent > 0) | |
{ | |
int maxCanAbsorb = (int) (getMaxRecoverableHp() - getCurrentHp()); | |
Index: java/com/l2jserver/gameserver/model/actor/tasks/character/HitTask.java | |
=================================================================== | |
--- java/com/l2jserver/gameserver/model/actor/tasks/character/HitTask.java (révision 6374) | |
+++ java/com/l2jserver/gameserver/model/actor/tasks/character/HitTask.java (copie de travail) | |
@@ -40,6 +40,7 @@ | |
private final boolean _miss; | |
private final byte _shld; | |
private final boolean _soulshot; | |
+ private final int _targetNumber; | |
public HitTask(L2Character character, L2Character target, int damage, boolean crit, boolean miss, boolean soulshot, byte shld) | |
{ | |
@@ -50,14 +51,27 @@ | |
_shld = shld; | |
_miss = miss; | |
_soulshot = soulshot; | |
+ _targetNumber = 0; | |
} | |
+ public HitTask(L2Character character, L2Character target, int damage, boolean crit, boolean miss, boolean soulshot, byte shld, int targetNumber) | |
+ { | |
+ _character = character; | |
+ _hitTarget = target; | |
+ _damage = damage; | |
+ _crit = crit; | |
+ _shld = shld; | |
+ _miss = miss; | |
+ _soulshot = soulshot; | |
+ _targetNumber = targetNumber; | |
+ } | |
+ | |
@Override | |
public void run() | |
{ | |
if (_character != null) | |
{ | |
- _character.onHitTimer(_hitTarget, _damage, _crit, _miss, _soulshot, _shld); | |
+ _character.onHitTimer(_hitTarget, _damage, _crit, _miss, _soulshot, _shld, _targetNumber); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment