Minor Creature class cleanup.

This commit is contained in:
MobiusDevelopment
2022-01-06 22:20:04 +00:00
parent eb59d00dac
commit ff4e454f7c
25 changed files with 246 additions and 497 deletions

View File

@@ -980,13 +980,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
if (!isAlikeDead())
{
if ((isNpc() && target.isAlikeDead()) || !isInSurroundingRegion(target))
{
getAI().setIntention(AI_INTENTION_ACTIVE);
sendPacket(ActionFailed.STATIC_PACKET);
return;
}
else if (isPlayer() && target.isDead())
if (((isNpc() && target.isAlikeDead()) || !isInSurroundingRegion(target)) || (isPlayer() && target.isDead()))
{
getAI().setIntention(AI_INTENTION_ACTIVE);
sendPacket(ActionFailed.STATIC_PACKET);
@@ -1000,9 +994,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
}
}
// Get the active weapon item corresponding to the active weapon instance (always equipped in the right hand)
final Weapon weaponItem = getActiveWeaponItem();
final WeaponType weaponType = getAttackType();
if (getActingPlayer() != null)
{
if (getActingPlayer().inObserverMode())
@@ -1049,6 +1040,10 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
return;
}
// Get the active weapon item corresponding to the active weapon instance (always equipped in the right hand)
final Weapon weaponItem = getActiveWeaponItem();
final WeaponType weaponType = getAttackType();
// BOW and CROSSBOW checks
if (weaponItem != null)
{
@@ -3950,14 +3945,10 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
{
final Player player = getActingPlayer();
if (player.isCursedWeaponEquipped())
// If hit by a cursed weapon, CP is reduced to 0.
// If a cursed weapon is hit by a Hero, CP is reduced to 0.
if (player.isCursedWeaponEquipped() || (player.isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped()))
{
// If hit by a cursed weapon, CP is reduced to 0
target.setCurrentCp(0);
}
else if (player.isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())
{
// If a cursed weapon is hit by a Hero, CP is reduced to 0
target.setCurrentCp(0);
}