Addition of hit task for pistol weapons.

Contributed by champzix1.
This commit is contained in:
MobiusDevelopment 2023-01-04 22:20:31 +00:00
parent b7810037fe
commit 346f8241a2
3 changed files with 36 additions and 0 deletions

View File

@ -1252,6 +1252,18 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
_hitTask = ThreadPool.schedule(() -> onHitTimeNotDual(weaponItem, attack, timeToHit, timeAtk), timeToHit);
break;
}
case PISTOLS:
{
final int reuse = Formulas.calculateReuseTime(this, weaponItem);
_disableRangedAttackEndTime = currentTime + TimeUnit.MILLISECONDS.toNanos(reuse);
// Precaution. It happened in the past for _attackEndTime. Will not risk it.
if (_disableRangedAttackEndTime < currentTime)
{
_disableRangedAttackEndTime = currentTime + TimeUnit.MILLISECONDS.toNanos(Integer.MAX_VALUE);
}
_hitTask = ThreadPool.schedule(() -> onHitTimeNotDual(weaponItem, attack, timeToHit, timeAtk), timeToHit);
break;
}
case FIST:
{
if (!isPlayer())

View File

@ -1262,6 +1262,18 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
_hitTask = ThreadPool.schedule(() -> onHitTimeNotDual(weaponItem, attack, timeToHit, timeAtk), timeToHit);
break;
}
case PISTOLS:
{
final int reuse = Formulas.calculateReuseTime(this, weaponItem);
_disableRangedAttackEndTime = currentTime + TimeUnit.MILLISECONDS.toNanos(reuse);
// Precaution. It happened in the past for _attackEndTime. Will not risk it.
if (_disableRangedAttackEndTime < currentTime)
{
_disableRangedAttackEndTime = currentTime + TimeUnit.MILLISECONDS.toNanos(Integer.MAX_VALUE);
}
_hitTask = ThreadPool.schedule(() -> onHitTimeNotDual(weaponItem, attack, timeToHit, timeAtk), timeToHit);
break;
}
case FIST:
{
if (!isPlayer())

View File

@ -1262,6 +1262,18 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
_hitTask = ThreadPool.schedule(() -> onHitTimeNotDual(weaponItem, attack, timeToHit, timeAtk), timeToHit);
break;
}
case PISTOLS:
{
final int reuse = Formulas.calculateReuseTime(this, weaponItem);
_disableRangedAttackEndTime = currentTime + TimeUnit.MILLISECONDS.toNanos(reuse);
// Precaution. It happened in the past for _attackEndTime. Will not risk it.
if (_disableRangedAttackEndTime < currentTime)
{
_disableRangedAttackEndTime = currentTime + TimeUnit.MILLISECONDS.toNanos(Integer.MAX_VALUE);
}
_hitTask = ThreadPool.schedule(() -> onHitTimeNotDual(weaponItem, attack, timeToHit, timeAtk), timeToHit);
break;
}
case FIST:
{
if (!isPlayer())