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

@ -976,13 +976,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);
@ -996,9 +990,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())
@ -1045,6 +1036,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)
{
@ -3924,19 +3919,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
weapon.applyConditionalSkills(this, target, null, ItemSkillType.ON_CRITICAL_SKILL);
}
if (isPlayer() && !target.isHpBlocked())
// 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 (isPlayer() && !target.isHpBlocked() && (((Player) this).isCursedWeaponEquipped() || (((Player) this).isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())))
{
if (((Player) this).isCursedWeaponEquipped())
{
// If hit by a cursed weapon, CP is reduced to 0
target.setCurrentCp(0);
}
else if (((Player) this).isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())
{
// If a cursed weapon is hit by a Hero, CP is reduced to 0
target.setCurrentCp(0);
}
}
}
private void onAttackFinish(Attack attack)

View File

@ -976,13 +976,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);
@ -996,9 +990,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())
@ -1045,6 +1036,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)
{
@ -3924,19 +3919,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
weapon.applyConditionalSkills(this, target, null, ItemSkillType.ON_CRITICAL_SKILL);
}
if (isPlayer() && !target.isHpBlocked())
// 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 (isPlayer() && !target.isHpBlocked() && (((Player) this).isCursedWeaponEquipped() || (((Player) this).isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())))
{
if (((Player) this).isCursedWeaponEquipped())
{
// If hit by a cursed weapon, CP is reduced to 0
target.setCurrentCp(0);
}
else if (((Player) this).isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())
{
// If a cursed weapon is hit by a Hero, CP is reduced to 0
target.setCurrentCp(0);
}
}
}
private void onAttackFinish(Attack attack)

View File

@ -976,13 +976,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);
@ -996,9 +990,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())
@ -1045,6 +1036,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)
{
@ -3924,19 +3919,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
weapon.applyConditionalSkills(this, target, null, ItemSkillType.ON_CRITICAL_SKILL);
}
if (isPlayer() && !target.isHpBlocked())
// 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 (isPlayer() && !target.isHpBlocked() && (((Player) this).isCursedWeaponEquipped() || (((Player) this).isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())))
{
if (((Player) this).isCursedWeaponEquipped())
{
// If hit by a cursed weapon, CP is reduced to 0
target.setCurrentCp(0);
}
else if (((Player) this).isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())
{
// If a cursed weapon is hit by a Hero, CP is reduced to 0
target.setCurrentCp(0);
}
}
}
private void onAttackFinish(Attack attack)

View File

@ -976,13 +976,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);
@ -996,9 +990,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())
@ -1045,6 +1036,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)
{
@ -3924,19 +3919,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
weapon.applyConditionalSkills(this, target, null, ItemSkillType.ON_CRITICAL_SKILL);
}
if (isPlayer() && !target.isHpBlocked())
// 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 (isPlayer() && !target.isHpBlocked() && (((Player) this).isCursedWeaponEquipped() || (((Player) this).isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())))
{
if (((Player) this).isCursedWeaponEquipped())
{
// If hit by a cursed weapon, CP is reduced to 0
target.setCurrentCp(0);
}
else if (((Player) this).isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())
{
// If a cursed weapon is hit by a Hero, CP is reduced to 0
target.setCurrentCp(0);
}
}
}
private void onAttackFinish(Attack attack)

View File

@ -976,13 +976,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);
@ -996,9 +990,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())
@ -1045,6 +1036,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)
{
@ -3924,19 +3919,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
weapon.applyConditionalSkills(this, target, null, ItemSkillType.ON_CRITICAL_SKILL);
}
if (isPlayer() && !target.isHpBlocked())
// 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 (isPlayer() && !target.isHpBlocked() && (((Player) this).isCursedWeaponEquipped() || (((Player) this).isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())))
{
if (((Player) this).isCursedWeaponEquipped())
{
// If hit by a cursed weapon, CP is reduced to 0
target.setCurrentCp(0);
}
else if (((Player) this).isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())
{
// If a cursed weapon is hit by a Hero, CP is reduced to 0
target.setCurrentCp(0);
}
}
}
private void onAttackFinish(Attack attack)

View File

@ -976,13 +976,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);
@ -996,9 +990,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())
@ -1045,6 +1036,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)
{
@ -3924,19 +3919,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
weapon.applyConditionalSkills(this, target, null, ItemSkillType.ON_CRITICAL_SKILL);
}
if (isPlayer() && !target.isHpBlocked())
// 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 (isPlayer() && !target.isHpBlocked() && (((Player) this).isCursedWeaponEquipped() || (((Player) this).isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())))
{
if (((Player) this).isCursedWeaponEquipped())
{
// If hit by a cursed weapon, CP is reduced to 0
target.setCurrentCp(0);
}
else if (((Player) this).isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())
{
// If a cursed weapon is hit by a Hero, CP is reduced to 0
target.setCurrentCp(0);
}
}
}
private void onAttackFinish(Attack attack)

View File

@ -976,13 +976,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);
@ -996,9 +990,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())
@ -1045,6 +1036,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)
{
@ -3924,19 +3919,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
weapon.applyConditionalSkills(this, target, null, ItemSkillType.ON_CRITICAL_SKILL);
}
if (isPlayer() && !target.isHpBlocked())
// 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 (isPlayer() && !target.isHpBlocked() && (((Player) this).isCursedWeaponEquipped() || (((Player) this).isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())))
{
if (((Player) this).isCursedWeaponEquipped())
{
// If hit by a cursed weapon, CP is reduced to 0
target.setCurrentCp(0);
}
else if (((Player) this).isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())
{
// If a cursed weapon is hit by a Hero, CP is reduced to 0
target.setCurrentCp(0);
}
}
}
private void onAttackFinish(Attack attack)

View File

@ -976,13 +976,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);
@ -996,9 +990,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())
@ -1045,6 +1036,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)
{
@ -3923,19 +3918,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
weapon.applyConditionalSkills(this, target, null, ItemSkillType.ON_CRITICAL_SKILL);
}
if (isPlayer() && !target.isHpBlocked())
// 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 (isPlayer() && !target.isHpBlocked() && (((Player) this).isCursedWeaponEquipped() || (((Player) this).isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())))
{
if (((Player) this).isCursedWeaponEquipped())
{
// If hit by a cursed weapon, CP is reduced to 0
target.setCurrentCp(0);
}
else if (((Player) this).isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())
{
// If a cursed weapon is hit by a Hero, CP is reduced to 0
target.setCurrentCp(0);
}
}
}
private void onAttackFinish(Attack attack)

View File

@ -976,13 +976,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);
@ -996,9 +990,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())
@ -1045,6 +1036,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)
{
@ -3923,19 +3918,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
weapon.applyConditionalSkills(this, target, null, ItemSkillType.ON_CRITICAL_SKILL);
}
if (isPlayer() && !target.isHpBlocked())
// 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 (isPlayer() && !target.isHpBlocked() && (((Player) this).isCursedWeaponEquipped() || (((Player) this).isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())))
{
if (((Player) this).isCursedWeaponEquipped())
{
// If hit by a cursed weapon, CP is reduced to 0
target.setCurrentCp(0);
}
else if (((Player) this).isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())
{
// If a cursed weapon is hit by a Hero, CP is reduced to 0
target.setCurrentCp(0);
}
}
}
private void onAttackFinish(Attack attack)

View File

@ -976,13 +976,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);
@ -996,9 +990,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())
@ -1045,6 +1036,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)
{
@ -3923,19 +3918,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
weapon.applyConditionalSkills(this, target, null, ItemSkillType.ON_CRITICAL_SKILL);
}
if (isPlayer() && !target.isHpBlocked())
// 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 (isPlayer() && !target.isHpBlocked() && (((Player) this).isCursedWeaponEquipped() || (((Player) this).isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())))
{
if (((Player) this).isCursedWeaponEquipped())
{
// If hit by a cursed weapon, CP is reduced to 0
target.setCurrentCp(0);
}
else if (((Player) this).isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())
{
// If a cursed weapon is hit by a Hero, CP is reduced to 0
target.setCurrentCp(0);
}
}
}
private void onAttackFinish(Attack attack)

View File

@ -976,13 +976,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);
@ -996,9 +990,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())
@ -1045,6 +1036,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)
{
@ -3923,19 +3918,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
weapon.applyConditionalSkills(this, target, null, ItemSkillType.ON_CRITICAL_SKILL);
}
if (isPlayer() && !target.isHpBlocked())
// 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 (isPlayer() && !target.isHpBlocked() && (((Player) this).isCursedWeaponEquipped() || (((Player) this).isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())))
{
if (((Player) this).isCursedWeaponEquipped())
{
// If hit by a cursed weapon, CP is reduced to 0
target.setCurrentCp(0);
}
else if (((Player) this).isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())
{
// If a cursed weapon is hit by a Hero, CP is reduced to 0
target.setCurrentCp(0);
}
}
}
private void onAttackFinish(Attack attack)

View File

@ -738,9 +738,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
}
}
// Get the active weapon instance (always equipped in the right hand)
final Item weaponInst = getActiveWeaponInstance();
// Get the active weapon item corresponding to the active weapon instance (always equipped in the right hand)
final Weapon weaponItem = getActiveWeaponItem();
if ((weaponItem != null) && (weaponItem.getItemType() == WeaponType.ROD))
@ -850,6 +847,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
((Summon) this).getOwner().rechargeAutoSoulShot(true, false, true);
}
// Get the active weapon instance (always equipped in the right hand)
final Item weaponInst = getActiveWeaponInstance();
// Verify if soulshots are charged.
boolean wasSSCharged;
if ((this instanceof Summon) && !(this instanceof Pet))
@ -1132,15 +1132,16 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
*/
private boolean doAttackHitByPole(Attack attack, int sAtk)
{
if (_target == null)
{
return false;
}
boolean hitted = false;
double angleChar;
double angleTarget;
final int maxRadius = (int) getStat().calcStat(Stat.POWER_ATTACK_RANGE, 66, null, null);
final int maxAngleDiff = (int) getStat().calcStat(Stat.POWER_ATTACK_ANGLE, 120, null, null);
if (_target == null)
{
return false;
}
angleTarget = Util.calculateAngleFrom(this, _target);
setHeading((int) ((angleTarget / 9.0) * 1610.0));
@ -1280,7 +1281,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
*/
public void doCast(Skill skill)
{
final Creature creature = this;
if (skill == null)
{
getAI().notifyEvent(CtrlEvent.EVT_CANCEL);
@ -1312,14 +1312,14 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
}
// Can't use Hero and resurrect skills during Olympiad
if ((creature instanceof Player) && ((Player) creature).isInOlympiadMode() && (skill.isHeroSkill() || (skill.getSkillType() == SkillType.RESURRECT)))
if ((this instanceof Player) && ((Player) this).isInOlympiadMode() && (skill.isHeroSkill() || (skill.getSkillType() == SkillType.RESURRECT)))
{
sendPacket(new SystemMessage(SystemMessageId.YOU_CANNOT_USE_THAT_SKILL_IN_A_GRAND_OLYMPIAD_GAMES_MATCH));
return;
}
// Like L2OFF you can't use skills when you are attacking now
if ((creature instanceof Player) && !skill.isPotion())
if ((this instanceof Player) && !skill.isPotion())
{
final Item rhand = ((Player) this).getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
if (((rhand != null) && (rhand.getItemType() == WeaponType.BOW)) && isAttackingNow())
@ -1361,29 +1361,29 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
// Recharge AutoSoulShot
if (skill.useSoulShot())
{
if (creature instanceof Player)
if (this instanceof Player)
{
((Player) creature).rechargeAutoSoulShot(true, false, false);
((Player) this).rechargeAutoSoulShot(true, false, false);
}
else if (this instanceof Summon)
{
((Summon) creature).getOwner().rechargeAutoSoulShot(true, false, true);
((Summon) this).getOwner().rechargeAutoSoulShot(true, false, true);
}
}
if (skill.useSpiritShot())
{
if (creature instanceof Player)
if (this instanceof Player)
{
((Player) creature).rechargeAutoSoulShot(false, true, false);
((Player) this).rechargeAutoSoulShot(false, true, false);
}
else if (this instanceof Summon)
{
((Summon) creature).getOwner().rechargeAutoSoulShot(false, true, true);
((Summon) this).getOwner().rechargeAutoSoulShot(false, true, true);
}
}
// Get all possible targets of the skill in a table in function of the skill target type
final List<Creature> targets = skill.getTargetList(creature);
final List<Creature> targets = skill.getTargetList(this);
// Set the target of the skill in function of Skill Type and Target Type
Creature target = null;
if ((skill.getTargetType() == SkillTargetType.TARGET_AURA) || (skill.getTargetType() == SkillTargetType.TARGET_GROUND) || skill.isPotion())
@ -1411,19 +1411,19 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
}
// Player can't heal rb config
if (!Config.PLAYERS_CAN_HEAL_RB && (creature instanceof Player) && !((Player) creature).isGM() && ((target instanceof RaidBoss) || (target instanceof GrandBoss)) && ((skill.getSkillType() == SkillType.HEAL) || (skill.getSkillType() == SkillType.HEAL_PERCENT)))
if (!Config.PLAYERS_CAN_HEAL_RB && (this instanceof Player) && !((Player) this).isGM() && ((target instanceof RaidBoss) || (target instanceof GrandBoss)) && ((skill.getSkillType() == SkillType.HEAL) || (skill.getSkillType() == SkillType.HEAL_PERCENT)))
{
sendPacket(ActionFailed.STATIC_PACKET);
return;
}
if ((creature instanceof Player) && (target instanceof Npc) && Config.DISABLE_ATTACK_NPC_TYPE)
if ((this instanceof Player) && (target instanceof Npc) && Config.DISABLE_ATTACK_NPC_TYPE)
{
final String mobtype = ((Npc) target).getTemplate().getType();
if (!Config.LIST_ALLOWED_NPC_TYPES.contains(mobtype))
{
((Player) creature).sendMessage("Npc Type " + mobtype + " has Protection - No Attack Allowed!");
((Player) creature).sendPacket(ActionFailed.STATIC_PACKET);
((Player) this).sendMessage("Npc Type " + mobtype + " has Protection - No Attack Allowed!");
((Player) this).sendPacket(ActionFailed.STATIC_PACKET);
return;
}
}
@ -1460,10 +1460,10 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
// Don't modify the skill time for FORCE_BUFF skills. The skill time for those skills represent the buff time.
if (!effectWhileCasting && !forceBuff && !skill.isStaticHitTime())
{
hitTime = Formulas.getInstance().calcMAtkSpd(creature, skill, hitTime);
hitTime = Formulas.getInstance().calcMAtkSpd(this, skill, hitTime);
if (coolTime > 0)
{
coolTime = Formulas.getInstance().calcMAtkSpd(creature, skill, coolTime);
coolTime = Formulas.getInstance().calcMAtkSpd(this, skill, coolTime);
}
}
@ -1490,7 +1490,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
// Init the reuse time of the skill
int reuseDelay = skill.getReuseDelay();
if ((creature instanceof Player) && Formulas.getInstance().calcSkillMastery(creature))
if ((this instanceof Player) && Formulas.getInstance().calcSkillMastery(this))
{
reuseDelay = 0;
}
@ -1531,7 +1531,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
}
// Send a system message USE_S1 to the Creature
if ((creature instanceof Player) && (magicId != 1312))
if ((this instanceof Player) && (magicId != 1312))
{
if (skill.isPotion())
{
@ -1634,7 +1634,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
if (hitTime > 210)
{
// Send a Server->Client packet SetupGauge with the color of the gauge and the casting time
if ((creature instanceof Player) && !forceBuff)
if ((this instanceof Player) && !forceBuff)
{
sendPacket(new SetupGauge(SetupGauge.BLUE, hitTime));
}
@ -5623,7 +5623,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
*/
public float getWeaponExpertisePenalty()
{
return 1.f;
return 1;
}
/**
@ -5632,7 +5632,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
*/
public float getArmourExpertisePenalty()
{
return 1.f;
return 1;
}
/**

View File

@ -764,9 +764,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
}
}
// Get the active weapon instance (always equipped in the right hand)
final Item weaponInst = getActiveWeaponInstance();
// Get the active weapon item corresponding to the active weapon instance (always equipped in the right hand)
final Weapon weaponItem = getActiveWeaponItem();
if ((weaponItem != null) && (weaponItem.getItemType() == WeaponType.ROD))
@ -876,6 +873,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
((Summon) this).getOwner().rechargeAutoSoulShot(true, false, true);
}
// Get the active weapon instance (always equipped in the right hand)
final Item weaponInst = getActiveWeaponInstance();
// Verify if soulshots are charged.
boolean wasSSCharged;
if ((this instanceof Summon) && !(this instanceof Pet))
@ -1175,15 +1175,16 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
*/
private boolean doAttackHitByPole(Attack attack, int sAtk)
{
if (_target == null)
{
return false;
}
boolean hitted = false;
double angleChar;
double angleTarget;
final int maxRadius = (int) getStat().calcStat(Stat.POWER_ATTACK_RANGE, 66, null, null);
final int maxAngleDiff = (int) getStat().calcStat(Stat.POWER_ATTACK_ANGLE, 120, null, null);
if (_target == null)
{
return false;
}
angleTarget = Util.calculateAngleFrom(this, _target);
setHeading((int) ((angleTarget / 9.0) * 1610.0));
@ -1323,7 +1324,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
*/
public void doCast(Skill skill)
{
final Creature creature = this;
if (skill == null)
{
getAI().notifyEvent(CtrlEvent.EVT_CANCEL);
@ -1355,14 +1355,14 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
}
// Can't use Hero and resurrect skills during Olympiad
if ((creature instanceof Player) && ((Player) creature).isInOlympiadMode() && (skill.isHeroSkill() || (skill.getSkillType() == SkillType.RESURRECT)))
if ((this instanceof Player) && ((Player) this).isInOlympiadMode() && (skill.isHeroSkill() || (skill.getSkillType() == SkillType.RESURRECT)))
{
sendPacket(new SystemMessage(SystemMessageId.YOU_CANNOT_USE_THAT_SKILL_IN_A_GRAND_OLYMPIAD_GAMES_MATCH));
return;
}
// Like L2OFF you can't use skills when you are attacking now
if ((creature instanceof Player) && !skill.isPotion())
if ((this instanceof Player) && !skill.isPotion())
{
final Item rhand = ((Player) this).getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
if (((rhand != null) && (rhand.getItemType() == WeaponType.BOW)) && isAttackingNow())
@ -1404,29 +1404,29 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
// Recharge AutoSoulShot
if (skill.useSoulShot())
{
if (creature instanceof Player)
if (this instanceof Player)
{
((Player) creature).rechargeAutoSoulShot(true, false, false);
((Player) this).rechargeAutoSoulShot(true, false, false);
}
else if (this instanceof Summon)
{
((Summon) creature).getOwner().rechargeAutoSoulShot(true, false, true);
((Summon) this).getOwner().rechargeAutoSoulShot(true, false, true);
}
}
if (skill.useSpiritShot())
{
if (creature instanceof Player)
if (this instanceof Player)
{
((Player) creature).rechargeAutoSoulShot(false, true, false);
((Player) this).rechargeAutoSoulShot(false, true, false);
}
else if (this instanceof Summon)
{
((Summon) creature).getOwner().rechargeAutoSoulShot(false, true, true);
((Summon) this).getOwner().rechargeAutoSoulShot(false, true, true);
}
}
// Get all possible targets of the skill in a table in function of the skill target type
final List<Creature> targets = skill.getTargetList(creature);
final List<Creature> targets = skill.getTargetList(this);
// Set the target of the skill in function of Skill Type and Target Type
Creature target = null;
if ((skill.getTargetType() == SkillTargetType.TARGET_AURA) || (skill.getTargetType() == SkillTargetType.TARGET_GROUND) || skill.isPotion())
@ -1454,19 +1454,19 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
}
// Player can't heal rb config
if (!Config.PLAYERS_CAN_HEAL_RB && (creature instanceof Player) && !((Player) creature).isGM() && ((target instanceof RaidBoss) || (target instanceof GrandBoss)) && ((skill.getSkillType() == SkillType.HEAL) || (skill.getSkillType() == SkillType.HEAL_PERCENT)))
if (!Config.PLAYERS_CAN_HEAL_RB && (this instanceof Player) && !((Player) this).isGM() && ((target instanceof RaidBoss) || (target instanceof GrandBoss)) && ((skill.getSkillType() == SkillType.HEAL) || (skill.getSkillType() == SkillType.HEAL_PERCENT)))
{
sendPacket(ActionFailed.STATIC_PACKET);
return;
}
if ((creature instanceof Player) && (target instanceof Npc) && Config.DISABLE_ATTACK_NPC_TYPE)
if ((this instanceof Player) && (target instanceof Npc) && Config.DISABLE_ATTACK_NPC_TYPE)
{
final String mobtype = ((Npc) target).getTemplate().getType();
if (!Config.LIST_ALLOWED_NPC_TYPES.contains(mobtype))
{
((Player) creature).sendMessage("Npc Type " + mobtype + " has Protection - No Attack Allowed!");
((Player) creature).sendPacket(ActionFailed.STATIC_PACKET);
((Player) this).sendMessage("Npc Type " + mobtype + " has Protection - No Attack Allowed!");
((Player) this).sendPacket(ActionFailed.STATIC_PACKET);
return;
}
}
@ -1503,10 +1503,10 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
// Don't modify the skill time for FORCE_BUFF skills. The skill time for those skills represent the buff time.
if (!effectWhileCasting && !forceBuff && !skill.isStaticHitTime())
{
hitTime = Formulas.getInstance().calcMAtkSpd(creature, skill, hitTime);
hitTime = Formulas.getInstance().calcMAtkSpd(this, skill, hitTime);
if (coolTime > 0)
{
coolTime = Formulas.getInstance().calcMAtkSpd(creature, skill, coolTime);
coolTime = Formulas.getInstance().calcMAtkSpd(this, skill, coolTime);
}
}
@ -1533,7 +1533,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
// Init the reuse time of the skill
int reuseDelay = skill.getReuseDelay();
if ((creature instanceof Player) && Formulas.getInstance().calcSkillMastery(creature))
if ((this instanceof Player) && Formulas.getInstance().calcSkillMastery(this))
{
reuseDelay = 0;
}
@ -1574,7 +1574,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
}
// Send a system message USE_S1 to the Creature
if ((creature instanceof Player) && (magicId != 1312))
if ((this instanceof Player) && (magicId != 1312))
{
if (skill.isPotion())
{
@ -1677,7 +1677,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
if (hitTime > 210)
{
// Send a Server->Client packet SetupGauge with the color of the gauge and the casting time
if ((creature instanceof Player) && !forceBuff)
if ((this instanceof Player) && !forceBuff)
{
sendPacket(new SetupGauge(SetupGauge.BLUE, hitTime));
}
@ -5669,7 +5669,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
*/
public float getWeaponExpertisePenalty()
{
return 1.f;
return 1;
}
/**
@ -5678,7 +5678,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
*/
public float getArmourExpertisePenalty()
{
return 1.f;
return 1;
}
/**

View File

@ -1764,9 +1764,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
return;
}
// Get the Identifier of the skill
final int magicId = skill.getId();
// Get the Base Casting Time of the Skills.
int skillTime = (skill.getHitTime() + skill.getCoolTime());
if (!skill.isChanneling() || (skill.getChannelingSkillId() == 0))
@ -1927,7 +1924,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
if (isPlayer() && !skill.isAbnormalInstant())
{
SystemMessage sm = null;
switch (magicId)
switch (skill.getId())
{
case 1312: // Fishing
{
@ -5663,8 +5660,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
{
try
{
final Weapon activeWeapon = getActiveWeaponItem();
// Check if the toggle skill effects are already in progress on the Creature
if (skill.isToggle() && isAffectedBySkill(skill.getId()))
{
@ -5717,6 +5712,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
if (!skill.isStatic())
{
// Launch weapon Special ability skill effect if available
final Weapon activeWeapon = getActiveWeaponItem();
if ((activeWeapon != null) && !target.isDead())
{
activeWeapon.castOnMagicSkill(this, target, skill);

View File

@ -1765,9 +1765,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
return;
}
// Get the Identifier of the skill
final int magicId = skill.getId();
// Get the Base Casting Time of the Skills.
int skillTime = (skill.getHitTime() + skill.getCoolTime());
if (!skill.isChanneling() || (skill.getChannelingSkillId() == 0))
@ -1929,7 +1926,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
if (isPlayer() && !skill.isAbnormalInstant())
{
SystemMessage sm = null;
switch (magicId)
switch (skill.getId())
{
case 1312: // Fishing
{
@ -5665,8 +5662,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
{
try
{
final Weapon activeWeapon = getActiveWeaponItem();
// Check if the toggle skill effects are already in progress on the Creature
if (skill.isToggle() && isAffectedBySkill(skill.getId()))
{
@ -5719,6 +5714,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
if (!skill.isStatic())
{
// Launch weapon Special ability skill effect if available
final Weapon activeWeapon = getActiveWeaponItem();
if ((activeWeapon != null) && !target.isDead())
{
activeWeapon.castOnMagicSkill(this, target, skill);

View File

@ -976,13 +976,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);
@ -996,9 +990,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())
@ -1045,6 +1036,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)
{
@ -3924,19 +3919,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
weapon.applyConditionalSkills(this, target, null, ItemSkillType.ON_CRITICAL_SKILL);
}
if (isPlayer() && !target.isHpBlocked())
// 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 (isPlayer() && !target.isHpBlocked() && (((Player) this).isCursedWeaponEquipped() || (((Player) this).isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())))
{
if (((Player) this).isCursedWeaponEquipped())
{
// If hit by a cursed weapon, CP is reduced to 0
target.setCurrentCp(0);
}
else if (((Player) this).isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())
{
// If a cursed weapon is hit by a Hero, CP is reduced to 0
target.setCurrentCp(0);
}
}
}
private void onAttackFinish(Attack attack)

View File

@ -976,13 +976,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);
@ -996,9 +990,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())
@ -1045,6 +1036,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)
{
@ -3924,19 +3919,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
weapon.applyConditionalSkills(this, target, null, ItemSkillType.ON_CRITICAL_SKILL);
}
if (isPlayer() && !target.isHpBlocked())
// 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 (isPlayer() && !target.isHpBlocked() && (((Player) this).isCursedWeaponEquipped() || (((Player) this).isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())))
{
if (((Player) this).isCursedWeaponEquipped())
{
// If hit by a cursed weapon, CP is reduced to 0
target.setCurrentCp(0);
}
else if (((Player) this).isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())
{
// If a cursed weapon is hit by a Hero, CP is reduced to 0
target.setCurrentCp(0);
}
}
}
private void onAttackFinish(Attack attack)

View File

@ -976,13 +976,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);
@ -996,9 +990,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())
@ -1045,6 +1036,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)
{
@ -3924,19 +3919,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
weapon.applyConditionalSkills(this, target, null, ItemSkillType.ON_CRITICAL_SKILL);
}
if (isPlayer() && !target.isHpBlocked())
// 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 (isPlayer() && !target.isHpBlocked() && (((Player) this).isCursedWeaponEquipped() || (((Player) this).isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())))
{
if (((Player) this).isCursedWeaponEquipped())
{
// If hit by a cursed weapon, CP is reduced to 0
target.setCurrentCp(0);
}
else if (((Player) this).isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())
{
// If a cursed weapon is hit by a Hero, CP is reduced to 0
target.setCurrentCp(0);
}
}
}
private void onAttackFinish(Attack attack)

View File

@ -977,13 +977,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);
@ -997,9 +991,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())
@ -1046,6 +1037,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)
{
@ -3937,19 +3932,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
weapon.applyConditionalSkills(this, target, null, ItemSkillType.ON_CRITICAL_SKILL);
}
if (isPlayer() && !target.isHpBlocked())
// 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 (isPlayer() && !target.isHpBlocked() && (((Player) this).isCursedWeaponEquipped() || (((Player) this).isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())))
{
if (((Player) this).isCursedWeaponEquipped())
{
// If hit by a cursed weapon, CP is reduced to 0
target.setCurrentCp(0);
}
else if (((Player) this).isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())
{
// If a cursed weapon is hit by a Hero, CP is reduced to 0
target.setCurrentCp(0);
}
}
}
private void onAttackFinish(Attack attack)

View File

@ -977,13 +977,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);
@ -997,9 +991,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())
@ -1046,6 +1037,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)
{
@ -3937,19 +3932,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
weapon.applyConditionalSkills(this, target, null, ItemSkillType.ON_CRITICAL_SKILL);
}
if (isPlayer() && !target.isHpBlocked())
// 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 (isPlayer() && !target.isHpBlocked() && (((Player) this).isCursedWeaponEquipped() || (((Player) this).isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())))
{
if (((Player) this).isCursedWeaponEquipped())
{
// If hit by a cursed weapon, CP is reduced to 0
target.setCurrentCp(0);
}
else if (((Player) this).isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())
{
// If a cursed weapon is hit by a Hero, CP is reduced to 0
target.setCurrentCp(0);
}
}
}
private void onAttackFinish(Attack attack)

View File

@ -977,13 +977,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);
@ -997,9 +991,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())
@ -1046,6 +1037,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)
{
@ -3936,19 +3931,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
weapon.applyConditionalSkills(this, target, null, ItemSkillType.ON_CRITICAL_SKILL);
}
if (isPlayer() && !target.isHpBlocked())
// 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 (isPlayer() && !target.isHpBlocked() && (((Player) this).isCursedWeaponEquipped() || (((Player) this).isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())))
{
if (((Player) this).isCursedWeaponEquipped())
{
// If hit by a cursed weapon, CP is reduced to 0
target.setCurrentCp(0);
}
else if (((Player) this).isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())
{
// If a cursed weapon is hit by a Hero, CP is reduced to 0
target.setCurrentCp(0);
}
}
}
private void onAttackFinish(Attack attack)

View File

@ -976,13 +976,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);
@ -996,9 +990,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())
@ -1045,6 +1036,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)
{
@ -3924,19 +3919,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
weapon.applyConditionalSkills(this, target, null, ItemSkillType.ON_CRITICAL_SKILL);
}
if (isPlayer() && !target.isHpBlocked())
// 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 (isPlayer() && !target.isHpBlocked() && (((Player) this).isCursedWeaponEquipped() || (((Player) this).isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())))
{
if (((Player) this).isCursedWeaponEquipped())
{
// If hit by a cursed weapon, CP is reduced to 0
target.setCurrentCp(0);
}
else if (((Player) this).isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())
{
// If a cursed weapon is hit by a Hero, CP is reduced to 0
target.setCurrentCp(0);
}
}
}
private void onAttackFinish(Attack attack)

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)
{
@ -3943,14 +3938,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);
}

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);
}

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);
}