Block key movement when mounting.

This commit is contained in:
MobiusDev 2018-11-29 20:04:43 +00:00
parent b2f0b7978e
commit d814997976
27 changed files with 413 additions and 122 deletions

View File

@ -248,6 +248,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
/** Movement data of this L2Character */
protected MoveData _move;
private boolean _cursorKeyMovement = false;
private boolean _cursorKeyMovementActive = true;
/** This creature's target. */
private L2Object _target;
@ -2945,6 +2946,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
{
_move.onGeodataPathIndex = -1;
stopMove(getActingPlayer().getLastServerPosition());
_cursorKeyMovementActive = false;
return false;
}
}
@ -3172,6 +3174,11 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
double dz = (z - curZ);
double distance = Math.hypot(dx, dy);
if (!_cursorKeyMovementActive && (distance > 200))
{
return;
}
final boolean verticalMovementOnly = _isFlying && (distance == 0) && (dz != 0);
if (verticalMovementOnly)
{
@ -5367,6 +5374,16 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
_cursorKeyMovement = value;
}
public void setCursorKeyMovementActive(boolean value)
{
_cursorKeyMovementActive = value;
}
public boolean isCursorKeyMovementActive()
{
return _cursorKeyMovementActive;
}
public List<L2ItemInstance> getFakePlayerDrops()
{
return _fakePlayerDrops;

View File

@ -104,6 +104,11 @@ public class MoveBackwardToLocation implements IClientIncomingPacket
// Validate position packets sends head level.
_targetZ += activeChar.getTemplate().getCollisionHeight();
if (!activeChar.isCursorKeyMovementActive() && (activeChar.isInFrontOf(new Location(_targetX, _targetY, _targetZ)) || activeChar.isOnSideOf(new Location(_originX, _originY, _originZ))))
{
activeChar.setCursorKeyMovementActive(true);
}
if (_movementMode == 1)
{
activeChar.setCursorKeyMovement(false);
@ -121,6 +126,10 @@ public class MoveBackwardToLocation implements IClientIncomingPacket
return;
}
activeChar.setCursorKeyMovement(true);
if (!activeChar.isCursorKeyMovementActive())
{
return;
}
}
switch (activeChar.getTeleMode())

View File

@ -248,6 +248,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
/** Movement data of this L2Character */
protected MoveData _move;
private boolean _cursorKeyMovement = false;
private boolean _cursorKeyMovementActive = true;
/** This creature's target. */
private L2Object _target;
@ -2945,6 +2946,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
{
_move.onGeodataPathIndex = -1;
stopMove(getActingPlayer().getLastServerPosition());
_cursorKeyMovementActive = false;
return false;
}
}
@ -3172,6 +3174,11 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
double dz = (z - curZ);
double distance = Math.hypot(dx, dy);
if (!_cursorKeyMovementActive && (distance > 200))
{
return;
}
final boolean verticalMovementOnly = _isFlying && (distance == 0) && (dz != 0);
if (verticalMovementOnly)
{
@ -5367,6 +5374,16 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
_cursorKeyMovement = value;
}
public void setCursorKeyMovementActive(boolean value)
{
_cursorKeyMovementActive = value;
}
public boolean isCursorKeyMovementActive()
{
return _cursorKeyMovementActive;
}
public List<L2ItemInstance> getFakePlayerDrops()
{
return _fakePlayerDrops;

View File

@ -104,6 +104,11 @@ public class MoveBackwardToLocation implements IClientIncomingPacket
// Validate position packets sends head level.
_targetZ += activeChar.getTemplate().getCollisionHeight();
if (!activeChar.isCursorKeyMovementActive() && (activeChar.isInFrontOf(new Location(_targetX, _targetY, _targetZ)) || activeChar.isOnSideOf(new Location(_originX, _originY, _originZ))))
{
activeChar.setCursorKeyMovementActive(true);
}
if (_movementMode == 1)
{
activeChar.setCursorKeyMovement(false);
@ -121,6 +126,10 @@ public class MoveBackwardToLocation implements IClientIncomingPacket
return;
}
activeChar.setCursorKeyMovement(true);
if (!activeChar.isCursorKeyMovementActive())
{
return;
}
}
switch (activeChar.getTeleMode())

View File

@ -248,6 +248,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
/** Movement data of this L2Character */
protected MoveData _move;
private boolean _cursorKeyMovement = false;
private boolean _cursorKeyMovementActive = true;
/** This creature's target. */
private L2Object _target;
@ -2945,6 +2946,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
{
_move.onGeodataPathIndex = -1;
stopMove(getActingPlayer().getLastServerPosition());
_cursorKeyMovementActive = false;
return false;
}
}
@ -3172,6 +3174,11 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
double dz = (z - curZ);
double distance = Math.hypot(dx, dy);
if (!_cursorKeyMovementActive && (distance > 200))
{
return;
}
final boolean verticalMovementOnly = _isFlying && (distance == 0) && (dz != 0);
if (verticalMovementOnly)
{
@ -5367,6 +5374,16 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
_cursorKeyMovement = value;
}
public void setCursorKeyMovementActive(boolean value)
{
_cursorKeyMovementActive = value;
}
public boolean isCursorKeyMovementActive()
{
return _cursorKeyMovementActive;
}
public List<L2ItemInstance> getFakePlayerDrops()
{
return _fakePlayerDrops;

View File

@ -104,6 +104,11 @@ public class MoveBackwardToLocation implements IClientIncomingPacket
// Validate position packets sends head level.
_targetZ += activeChar.getTemplate().getCollisionHeight();
if (!activeChar.isCursorKeyMovementActive() && (activeChar.isInFrontOf(new Location(_targetX, _targetY, _targetZ)) || activeChar.isOnSideOf(new Location(_originX, _originY, _originZ))))
{
activeChar.setCursorKeyMovementActive(true);
}
if (_movementMode == 1)
{
activeChar.setCursorKeyMovement(false);
@ -121,6 +126,10 @@ public class MoveBackwardToLocation implements IClientIncomingPacket
return;
}
activeChar.setCursorKeyMovement(true);
if (!activeChar.isCursorKeyMovementActive())
{
return;
}
}
switch (activeChar.getTeleMode())

View File

@ -248,6 +248,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
/** Movement data of this L2Character */
protected MoveData _move;
private boolean _cursorKeyMovement = false;
private boolean _cursorKeyMovementActive = true;
/** This creature's target. */
private L2Object _target;
@ -2945,6 +2946,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
{
_move.onGeodataPathIndex = -1;
stopMove(getActingPlayer().getLastServerPosition());
_cursorKeyMovementActive = false;
return false;
}
}
@ -3172,6 +3174,11 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
double dz = (z - curZ);
double distance = Math.hypot(dx, dy);
if (!_cursorKeyMovementActive && (distance > 200))
{
return;
}
final boolean verticalMovementOnly = _isFlying && (distance == 0) && (dz != 0);
if (verticalMovementOnly)
{
@ -5367,6 +5374,16 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
_cursorKeyMovement = value;
}
public void setCursorKeyMovementActive(boolean value)
{
_cursorKeyMovementActive = value;
}
public boolean isCursorKeyMovementActive()
{
return _cursorKeyMovementActive;
}
public List<L2ItemInstance> getFakePlayerDrops()
{
return _fakePlayerDrops;

View File

@ -104,6 +104,11 @@ public class MoveBackwardToLocation implements IClientIncomingPacket
// Validate position packets sends head level.
_targetZ += activeChar.getTemplate().getCollisionHeight();
if (!activeChar.isCursorKeyMovementActive() && (activeChar.isInFrontOf(new Location(_targetX, _targetY, _targetZ)) || activeChar.isOnSideOf(new Location(_originX, _originY, _originZ))))
{
activeChar.setCursorKeyMovementActive(true);
}
if (_movementMode == 1)
{
activeChar.setCursorKeyMovement(false);
@ -121,6 +126,10 @@ public class MoveBackwardToLocation implements IClientIncomingPacket
return;
}
activeChar.setCursorKeyMovement(true);
if (!activeChar.isCursorKeyMovementActive())
{
return;
}
}
switch (activeChar.getTeleMode())

View File

@ -248,6 +248,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
/** Movement data of this L2Character */
protected MoveData _move;
private boolean _cursorKeyMovement = false;
private boolean _cursorKeyMovementActive = true;
/** This creature's target. */
private L2Object _target;
@ -2945,6 +2946,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
{
_move.onGeodataPathIndex = -1;
stopMove(getActingPlayer().getLastServerPosition());
_cursorKeyMovementActive = false;
return false;
}
}
@ -3172,6 +3174,11 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
double dz = (z - curZ);
double distance = Math.hypot(dx, dy);
if (!_cursorKeyMovementActive && (distance > 200))
{
return;
}
final boolean verticalMovementOnly = _isFlying && (distance == 0) && (dz != 0);
if (verticalMovementOnly)
{
@ -5367,6 +5374,16 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
_cursorKeyMovement = value;
}
public void setCursorKeyMovementActive(boolean value)
{
_cursorKeyMovementActive = value;
}
public boolean isCursorKeyMovementActive()
{
return _cursorKeyMovementActive;
}
public List<L2ItemInstance> getFakePlayerDrops()
{
return _fakePlayerDrops;

View File

@ -104,6 +104,11 @@ public class MoveBackwardToLocation implements IClientIncomingPacket
// Validate position packets sends head level.
_targetZ += activeChar.getTemplate().getCollisionHeight();
if (!activeChar.isCursorKeyMovementActive() && (activeChar.isInFrontOf(new Location(_targetX, _targetY, _targetZ)) || activeChar.isOnSideOf(new Location(_originX, _originY, _originZ))))
{
activeChar.setCursorKeyMovementActive(true);
}
if (_movementMode == 1)
{
activeChar.setCursorKeyMovement(false);
@ -121,6 +126,10 @@ public class MoveBackwardToLocation implements IClientIncomingPacket
return;
}
activeChar.setCursorKeyMovement(true);
if (!activeChar.isCursorKeyMovementActive())
{
return;
}
}
switch (activeChar.getTeleMode())

View File

@ -248,6 +248,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
/** Movement data of this L2Character */
protected MoveData _move;
private boolean _cursorKeyMovement = false;
private boolean _cursorKeyMovementActive = true;
/** This creature's target. */
private L2Object _target;
@ -2945,6 +2946,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
{
_move.onGeodataPathIndex = -1;
stopMove(getActingPlayer().getLastServerPosition());
_cursorKeyMovementActive = false;
return false;
}
}
@ -3172,6 +3174,11 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
double dz = (z - curZ);
double distance = Math.hypot(dx, dy);
if (!_cursorKeyMovementActive && (distance > 200))
{
return;
}
final boolean verticalMovementOnly = _isFlying && (distance == 0) && (dz != 0);
if (verticalMovementOnly)
{
@ -5367,6 +5374,16 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
_cursorKeyMovement = value;
}
public void setCursorKeyMovementActive(boolean value)
{
_cursorKeyMovementActive = value;
}
public boolean isCursorKeyMovementActive()
{
return _cursorKeyMovementActive;
}
public List<L2ItemInstance> getFakePlayerDrops()
{
return _fakePlayerDrops;

View File

@ -104,6 +104,11 @@ public class MoveBackwardToLocation implements IClientIncomingPacket
// Validate position packets sends head level.
_targetZ += activeChar.getTemplate().getCollisionHeight();
if (!activeChar.isCursorKeyMovementActive() && (activeChar.isInFrontOf(new Location(_targetX, _targetY, _targetZ)) || activeChar.isOnSideOf(new Location(_originX, _originY, _originZ))))
{
activeChar.setCursorKeyMovementActive(true);
}
if (_movementMode == 1)
{
activeChar.setCursorKeyMovement(false);
@ -121,6 +126,10 @@ public class MoveBackwardToLocation implements IClientIncomingPacket
return;
}
activeChar.setCursorKeyMovement(true);
if (!activeChar.isCursorKeyMovementActive())
{
return;
}
}
switch (activeChar.getTeleMode())

View File

@ -131,11 +131,11 @@ public final class HitConditionBonusData implements IGameXmlReader
}
// Get side bonus
if (attacker.isBehindTarget())
if (attacker.isBehind(target))
{
mod += backBonus;
}
else if (attacker.isInFrontOfTarget())
else if (attacker.isInFrontOf(target))
{
mod += frontBonus;
}

View File

@ -0,0 +1,58 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.enums;
import com.l2jmobius.gameserver.model.interfaces.ILocational;
/**
* @author Sdw
*/
public enum Position
{
FRONT,
SIDE,
BACK;
/**
* Position calculation based on the retail-like formulas:<br>
* <ul>
* <li>heading: (unsigned short) abs(heading - (unsigned short)(int)floor(atan2(toY - fromY, toX - fromX) * 65535.0 / 6.283185307179586))</li>
* <li>side: if (heading >= 0x2000 && heading <= 0x6000 || (unsigned int)(heading - 0xA000) <= 0x4000)</li>
* <li>front: else if ((unsigned int)(heading - 0x2000) <= 0xC000)</li>
* <li>back: otherwise.</li>
* </ul>
* @param from
* @param to
* @return
*/
public static Position getPosition(ILocational from, ILocational to)
{
final int heading = Math.abs(to.getHeading() - from.calculateHeadingTo(to));
if (((heading >= 0x2000) && (heading <= 0x6000)) || (Integer.toUnsignedLong(heading - 0xA000) <= 0x4000))
{
return SIDE;
}
else if (Integer.toUnsignedLong(heading - 0x2000) <= 0xC000)
{
return FRONT;
}
else
{
return BACK;
}
}
}

View File

@ -253,6 +253,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
/** Movement data of this L2Character */
protected MoveData _move;
private boolean _cursorKeyMovement = false;
private boolean _cursorKeyMovementActive = true;
/** This creature's target. */
private L2Object _target;
@ -1336,8 +1337,9 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
int attackCountMax = (int) _stat.calcStat(Stats.ATTACK_COUNT_MAX, 1, null, null);
if (attackCountMax > 1)
{
final double headingAngle = Util.convertHeadingToDegree(getHeading());
final int maxRadius = _stat.getPhysicalAttackRange();
final int maxAngleDiff = _stat.getPhysicalAttackAngle();
final int physicalAttackAngle = _stat.getPhysicalAttackAngle();
double attackpercent = 85;
for (L2Character obj : L2World.getInstance().getVisibleObjectsInRange(this, L2Character.class, maxRadius))
{
@ -1360,7 +1362,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
}
// Check if target is within attack angle.
if (!isFacing(obj, maxAngleDiff))
if (Math.abs(calculateDirectionTo(obj) - headingAngle) > physicalAttackAngle)
{
continue;
}
@ -3944,6 +3946,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
{
_move.onGeodataPathIndex = -1;
stopMove(getActingPlayer().getLastServerPosition());
_cursorKeyMovementActive = false;
return false;
}
}
@ -4169,6 +4172,11 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
double dz = (z - curZ);
double distance = Math.hypot(dx, dy);
if (!_cursorKeyMovementActive && (distance > 200))
{
return;
}
final boolean verticalMovementOnly = _isFlying && (distance == 0) && (dz != 0);
if (verticalMovementOnly)
{
@ -5794,117 +5802,6 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
}
}
/**
* @param target
* @return True if the L2Character is behind the target and can't be seen.
*/
public boolean isBehind(L2Object target)
{
double angleChar;
double angleTarget;
double angleDiff;
final double maxAngleDiff = 60;
if (target == null)
{
return false;
}
if (target.isCharacter())
{
final L2Character target1 = (L2Character) target;
angleChar = Util.calculateAngleFrom(this, target1);
angleTarget = Util.convertHeadingToDegree(target1.getHeading());
angleDiff = angleChar - angleTarget;
if (angleDiff <= (-360 + maxAngleDiff))
{
angleDiff += 360;
}
if (angleDiff >= (360 - maxAngleDiff))
{
angleDiff -= 360;
}
if (Math.abs(angleDiff) <= maxAngleDiff)
{
return true;
}
}
return false;
}
public boolean isBehindTarget()
{
return isBehind(_target);
}
/**
* @param target
* @return True if the target is facing the L2Character.
*/
public boolean isInFrontOf(L2Object target)
{
double angleChar;
double angleTarget;
double angleDiff;
final double maxAngleDiff = 60;
if (target == null)
{
return false;
}
angleTarget = Util.calculateAngleFrom(target, this);
angleChar = Util.convertHeadingToDegree(target.getHeading());
angleDiff = angleChar - angleTarget;
if (angleDiff <= (-360 + maxAngleDiff))
{
angleDiff += 360;
}
if (angleDiff >= (360 - maxAngleDiff))
{
angleDiff -= 360;
}
return Math.abs(angleDiff) <= maxAngleDiff;
}
/**
* @param target
* @param maxAngle
* @return true if target is in front of L2Character (shield def etc)
*/
public boolean isFacing(L2Object target, int maxAngle)
{
double angleChar;
double angleTarget;
double angleDiff;
double maxAngleDiff;
if (target == null)
{
return false;
}
maxAngleDiff = maxAngle / 2.;
angleTarget = Util.calculateAngleFrom(this, target);
angleChar = Util.convertHeadingToDegree(getHeading());
angleDiff = angleChar - angleTarget;
if (angleDiff <= (-360 + maxAngleDiff))
{
angleDiff += 360;
}
if (angleDiff >= (360 - maxAngleDiff))
{
angleDiff -= 360;
}
return Math.abs(angleDiff) <= maxAngleDiff;
}
public boolean isInFrontOfTarget()
{
if ((_target != null) && _target.isCharacter())
{
return isInFrontOf(_target);
}
return false;
}
/**
* @return the Level Modifier ((level + 89) / 100).
*/
@ -6815,6 +6712,16 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
_cursorKeyMovement = value;
}
public void setCursorKeyMovementActive(boolean value)
{
_cursorKeyMovementActive = value;
}
public boolean isCursorKeyMovementActive()
{
return _cursorKeyMovementActive;
}
public List<L2ItemInstance> getFakePlayerDrops()
{
return _fakePlayerDrops;

View File

@ -50,39 +50,57 @@ public class ConditionPlayerState extends Condition
switch (_check)
{
case RESTING:
{
if (player != null)
{
return (player.isSitting() == _required);
}
return !_required;
}
case MOVING:
{
return character.isMoving() == _required;
}
case RUNNING:
{
return character.isRunning() == _required;
}
case STANDING:
{
if (player != null)
{
return (_required != (player.isSitting() || player.isMoving()));
}
return (_required != character.isMoving());
}
case FLYING:
{
return (character.isFlying() == _required);
}
case BEHIND:
return (character.isBehindTarget() == _required);
{
return (character.isBehind(effected) == _required);
}
case FRONT:
return (character.isInFrontOfTarget() == _required);
{
return (character.isInFrontOf(effected) == _required);
}
case CHAOTIC:
{
if (player != null)
{
return ((player.getKarma() > 0) == _required);
}
return !_required;
}
case OLYMPIAD:
{
if (player != null)
{
return (player.isInOlympiadMode() == _required);
}
return !_required;
}
}
return !_required;
}

View File

@ -16,6 +16,9 @@
*/
package com.l2jmobius.gameserver.model.interfaces;
import com.l2jmobius.gameserver.enums.Position;
import com.l2jmobius.gameserver.util.Util;
/**
* Object world location storage interface.
* @author xban1x
@ -57,4 +60,40 @@ public interface ILocational
* @return a {@link ILocational} object containing the current position of this object
*/
ILocational getLocation();
/**
* @param to
* @return the heading to the target specified
*/
default int calculateHeadingTo(ILocational to)
{
return Util.calculateHeadingFrom(getX(), getY(), to.getX(), to.getY());
}
/**
* @param target
* @return {@code true} if this location is in front of the target location based on the game's concept of position.
*/
default boolean isInFrontOf(ILocational target)
{
return Position.FRONT == Position.getPosition(this, target);
}
/**
* @param target
* @return {@code true} if this location is in one of the sides of the target location based on the game's concept of position.
*/
default boolean isOnSideOf(ILocational target)
{
return Position.SIDE == Position.getPosition(this, target);
}
/**
* @param target
* @return {@code true} if this location is behind the target location based on the game's concept of position.
*/
default boolean isBehind(ILocational target)
{
return Position.BACK == Position.getPosition(this, target);
}
}

View File

@ -562,7 +562,7 @@ public final class Formulas
final boolean isPvE = attacker.isPlayable() && target.isAttackable();
final double power = skill.getPower(isPvP, isPvE);
double damage = 0;
final double proximityBonus = attacker.isBehindTarget() ? 1.2 : attacker.isInFrontOfTarget() ? 1 : 1.1; // Behind: +20% - Side: +10% (TODO: values are unconfirmed, possibly custom, remove or update when confirmed);
final double proximityBonus = attacker.isBehind(target) ? 1.2 : attacker.isInFrontOf(target) ? 1 : 1.1; // Behind: +20% - Side: +10% (TODO: values are unconfirmed, possibly custom, remove or update when confirmed);
final double ssboost = ss ? 1.458 : 1;
double pvpBonus = 1;
@ -632,7 +632,7 @@ public final class Formulas
final boolean isPvP = attacker.isPlayable() && target.isPlayer();
final boolean isPvE = attacker.isPlayable() && target.isAttackable();
double damage = 0;
final double proximityBonus = attacker.isBehindTarget() ? 1.2 : attacker.isInFrontOfTarget() ? 1 : 1.1; // Behind: +20% - Side: +10%
final double proximityBonus = attacker.isBehind(target) ? 1.2 : attacker.isInFrontOf(target) ? 1 : 1.1; // Behind: +20% - Side: +10%
final double ssboost = ss ? 1.458 : 1;
double pvpBonus = 1;
@ -695,7 +695,7 @@ public final class Formulas
{
final boolean isPvP = attacker.isPlayable() && target.isPlayable();
final boolean isPvE = attacker.isPlayable() && target.isAttackable();
final double proximityBonus = attacker.isBehindTarget() ? 1.2 : attacker.isInFrontOfTarget() ? 1 : 1.1; // Behind: +20% - Side: +10%
final double proximityBonus = attacker.isBehind(target) ? 1.2 : attacker.isInFrontOf(target) ? 1 : 1.1; // Behind: +20% - Side: +10%
double damage = attacker.getPAtk(target);
double defence = target.getPDef(attacker);
@ -1198,7 +1198,7 @@ public final class Formulas
}
final int degreeside = (int) target.calcStat(Stats.SHIELD_DEFENCE_ANGLE, 0, null, null) + 120;
if ((degreeside < 360) && (!target.isFacing(attacker, degreeside)))
if ((degreeside < 360) && (Math.abs(target.calculateDirectionTo(attacker) - Util.convertHeadingToDegree(target.getHeading())) > (degreeside / 2)))
{
return 0;
}
@ -1878,7 +1878,7 @@ public final class Formulas
// Apply DEX Mod.
final double blowChance = skill.getBlowChance();
// Apply Position Bonus (TODO: values are unconfirmed, possibly custom, remove or update when confirmed).
final double sideMod = (activeChar.isInFrontOfTarget()) ? 1 : (activeChar.isBehindTarget()) ? 2 : 1.5;
final double sideMod = (activeChar.isInFrontOf(target)) ? 1 : (activeChar.isBehind(target)) ? 2 : 1.5;
// Apply all mods.
final double baseRate = blowChance * dexMod * sideMod;
// Apply blow rates

View File

@ -106,6 +106,11 @@ public class MoveBackwardToLocation implements IClientIncomingPacket
// Validate position packets sends head level.
_targetZ += activeChar.getTemplate().getCollisionHeight();
if (!activeChar.isCursorKeyMovementActive() && (activeChar.isInFrontOf(new Location(_targetX, _targetY, _targetZ)) || activeChar.isOnSideOf(new Location(_originX, _originY, _originZ))))
{
activeChar.setCursorKeyMovementActive(true);
}
if (_movementMode == 1)
{
activeChar.setCursorKeyMovement(false);
@ -123,6 +128,10 @@ public class MoveBackwardToLocation implements IClientIncomingPacket
return;
}
activeChar.setCursorKeyMovement(true);
if (!activeChar.isCursorKeyMovementActive())
{
return;
}
}
if (activeChar.getTeleMode() > 0)

View File

@ -248,6 +248,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
/** Movement data of this L2Character */
protected MoveData _move;
private boolean _cursorKeyMovement = false;
private boolean _cursorKeyMovementActive = true;
/** This creature's target. */
private L2Object _target;
@ -2945,6 +2946,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
{
_move.onGeodataPathIndex = -1;
stopMove(getActingPlayer().getLastServerPosition());
_cursorKeyMovementActive = false;
return false;
}
}
@ -3172,6 +3174,11 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
double dz = (z - curZ);
double distance = Math.hypot(dx, dy);
if (!_cursorKeyMovementActive && (distance > 200))
{
return;
}
final boolean verticalMovementOnly = _isFlying && (distance == 0) && (dz != 0);
if (verticalMovementOnly)
{
@ -5357,6 +5364,16 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
_cursorKeyMovement = value;
}
public void setCursorKeyMovementActive(boolean value)
{
_cursorKeyMovementActive = value;
}
public boolean isCursorKeyMovementActive()
{
return _cursorKeyMovementActive;
}
public List<L2ItemInstance> getFakePlayerDrops()
{
return _fakePlayerDrops;

View File

@ -104,6 +104,11 @@ public class MoveBackwardToLocation implements IClientIncomingPacket
// Validate position packets sends head level.
_targetZ += activeChar.getTemplate().getCollisionHeight();
if (!activeChar.isCursorKeyMovementActive() && (activeChar.isInFrontOf(new Location(_targetX, _targetY, _targetZ)) || activeChar.isOnSideOf(new Location(_originX, _originY, _originZ))))
{
activeChar.setCursorKeyMovementActive(true);
}
if (_movementMode == 1)
{
activeChar.setCursorKeyMovement(false);
@ -121,6 +126,10 @@ public class MoveBackwardToLocation implements IClientIncomingPacket
return;
}
activeChar.setCursorKeyMovement(true);
if (!activeChar.isCursorKeyMovementActive())
{
return;
}
}
switch (activeChar.getTeleMode())

View File

@ -248,6 +248,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
/** Movement data of this L2Character */
protected MoveData _move;
private boolean _cursorKeyMovement = false;
private boolean _cursorKeyMovementActive = true;
/** This creature's target. */
private L2Object _target;
@ -2945,6 +2946,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
{
_move.onGeodataPathIndex = -1;
stopMove(getActingPlayer().getLastServerPosition());
_cursorKeyMovementActive = false;
return false;
}
}
@ -3172,6 +3174,11 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
double dz = (z - curZ);
double distance = Math.hypot(dx, dy);
if (!_cursorKeyMovementActive && (distance > 200))
{
return;
}
final boolean verticalMovementOnly = _isFlying && (distance == 0) && (dz != 0);
if (verticalMovementOnly)
{
@ -5357,6 +5364,16 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
_cursorKeyMovement = value;
}
public void setCursorKeyMovementActive(boolean value)
{
_cursorKeyMovementActive = value;
}
public boolean isCursorKeyMovementActive()
{
return _cursorKeyMovementActive;
}
public List<L2ItemInstance> getFakePlayerDrops()
{
return _fakePlayerDrops;

View File

@ -104,6 +104,11 @@ public class MoveBackwardToLocation implements IClientIncomingPacket
// Validate position packets sends head level.
_targetZ += activeChar.getTemplate().getCollisionHeight();
if (!activeChar.isCursorKeyMovementActive() && (activeChar.isInFrontOf(new Location(_targetX, _targetY, _targetZ)) || activeChar.isOnSideOf(new Location(_originX, _originY, _originZ))))
{
activeChar.setCursorKeyMovementActive(true);
}
if (_movementMode == 1)
{
activeChar.setCursorKeyMovement(false);
@ -121,6 +126,10 @@ public class MoveBackwardToLocation implements IClientIncomingPacket
return;
}
activeChar.setCursorKeyMovement(true);
if (!activeChar.isCursorKeyMovementActive())
{
return;
}
}
switch (activeChar.getTeleMode())

View File

@ -248,6 +248,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
/** Movement data of this L2Character */
protected MoveData _move;
private boolean _cursorKeyMovement = false;
private boolean _cursorKeyMovementActive = true;
/** This creature's target. */
private L2Object _target;
@ -2945,6 +2946,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
{
_move.onGeodataPathIndex = -1;
stopMove(getActingPlayer().getLastServerPosition());
_cursorKeyMovementActive = false;
return false;
}
}
@ -3172,6 +3174,11 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
double dz = (z - curZ);
double distance = Math.hypot(dx, dy);
if (!_cursorKeyMovementActive && (distance > 200))
{
return;
}
final boolean verticalMovementOnly = _isFlying && (distance == 0) && (dz != 0);
if (verticalMovementOnly)
{
@ -5357,6 +5364,16 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
_cursorKeyMovement = value;
}
public void setCursorKeyMovementActive(boolean value)
{
_cursorKeyMovementActive = value;
}
public boolean isCursorKeyMovementActive()
{
return _cursorKeyMovementActive;
}
public List<L2ItemInstance> getFakePlayerDrops()
{
return _fakePlayerDrops;

View File

@ -104,6 +104,11 @@ public class MoveBackwardToLocation implements IClientIncomingPacket
// Validate position packets sends head level.
_targetZ += activeChar.getTemplate().getCollisionHeight();
if (!activeChar.isCursorKeyMovementActive() && (activeChar.isInFrontOf(new Location(_targetX, _targetY, _targetZ)) || activeChar.isOnSideOf(new Location(_originX, _originY, _originZ))))
{
activeChar.setCursorKeyMovementActive(true);
}
if (_movementMode == 1)
{
activeChar.setCursorKeyMovement(false);
@ -121,6 +126,10 @@ public class MoveBackwardToLocation implements IClientIncomingPacket
return;
}
activeChar.setCursorKeyMovement(true);
if (!activeChar.isCursorKeyMovementActive())
{
return;
}
}
switch (activeChar.getTeleMode())

View File

@ -248,6 +248,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
/** Movement data of this L2Character */
protected MoveData _move;
private boolean _cursorKeyMovement = false;
private boolean _cursorKeyMovementActive = true;
/** This creature's target. */
private L2Object _target;
@ -2945,6 +2946,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
{
_move.onGeodataPathIndex = -1;
stopMove(getActingPlayer().getLastServerPosition());
_cursorKeyMovementActive = false;
return false;
}
}
@ -3172,6 +3174,11 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
double dz = (z - curZ);
double distance = Math.hypot(dx, dy);
if (!_cursorKeyMovementActive && (distance > 200))
{
return;
}
final boolean verticalMovementOnly = _isFlying && (distance == 0) && (dz != 0);
if (verticalMovementOnly)
{
@ -5357,6 +5364,16 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
_cursorKeyMovement = value;
}
public void setCursorKeyMovementActive(boolean value)
{
_cursorKeyMovementActive = value;
}
public boolean isCursorKeyMovementActive()
{
return _cursorKeyMovementActive;
}
public List<L2ItemInstance> getFakePlayerDrops()
{
return _fakePlayerDrops;

View File

@ -104,6 +104,11 @@ public class MoveBackwardToLocation implements IClientIncomingPacket
// Validate position packets sends head level.
_targetZ += activeChar.getTemplate().getCollisionHeight();
if (!activeChar.isCursorKeyMovementActive() && (activeChar.isInFrontOf(new Location(_targetX, _targetY, _targetZ)) || activeChar.isOnSideOf(new Location(_originX, _originY, _originZ))))
{
activeChar.setCursorKeyMovementActive(true);
}
if (_movementMode == 1)
{
activeChar.setCursorKeyMovement(false);
@ -121,6 +126,10 @@ public class MoveBackwardToLocation implements IClientIncomingPacket
return;
}
activeChar.setCursorKeyMovement(true);
if (!activeChar.isCursorKeyMovementActive())
{
return;
}
}
switch (activeChar.getTeleMode())