From ff4e454f7c26403119b64f25c27d0ae5006ba6f6 Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Thu, 6 Jan 2022 22:20:04 +0000 Subject: [PATCH] Minor Creature class cleanup. --- .../gameserver/model/actor/Creature.java | 30 +++------- .../gameserver/model/actor/Creature.java | 30 +++------- .../gameserver/model/actor/Creature.java | 30 +++------- .../gameserver/model/actor/Creature.java | 30 +++------- .../gameserver/model/actor/Creature.java | 30 +++------- .../gameserver/model/actor/Creature.java | 30 +++------- .../gameserver/model/actor/Creature.java | 30 +++------- .../gameserver/model/actor/Creature.java | 30 +++------- .../gameserver/model/actor/Creature.java | 30 +++------- .../gameserver/model/actor/Creature.java | 30 +++------- .../gameserver/model/actor/Creature.java | 30 +++------- .../gameserver/model/actor/Creature.java | 56 +++++++++---------- .../gameserver/model/actor/Creature.java | 56 +++++++++---------- .../gameserver/model/actor/Creature.java | 8 +-- .../gameserver/model/actor/Creature.java | 8 +-- .../gameserver/model/actor/Creature.java | 30 +++------- .../gameserver/model/actor/Creature.java | 30 +++------- .../gameserver/model/actor/Creature.java | 30 +++------- .../gameserver/model/actor/Creature.java | 30 +++------- .../gameserver/model/actor/Creature.java | 30 +++------- .../gameserver/model/actor/Creature.java | 30 +++------- .../gameserver/model/actor/Creature.java | 30 +++------- .../gameserver/model/actor/Creature.java | 25 +++------ .../gameserver/model/actor/Creature.java | 25 +++------ .../gameserver/model/actor/Creature.java | 25 +++------ 25 files changed, 246 insertions(+), 497 deletions(-) diff --git a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/Creature.java index ca29f16fca..f466d833b7 100644 --- a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -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,18 +3919,11 @@ 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); - } + target.setCurrentCp(0); } } diff --git a/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/model/actor/Creature.java index ca29f16fca..f466d833b7 100644 --- a/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -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,18 +3919,11 @@ 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); - } + target.setCurrentCp(0); } } diff --git a/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/model/actor/Creature.java index 6adcaf1a89..523e628e84 100644 --- a/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -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,18 +3919,11 @@ 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); - } + target.setCurrentCp(0); } } diff --git a/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/Creature.java index 6adcaf1a89..523e628e84 100644 --- a/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -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,18 +3919,11 @@ 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); - } + target.setCurrentCp(0); } } diff --git a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/actor/Creature.java index ea226b3955..954cb611aa 100644 --- a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -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,18 +3919,11 @@ 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); - } + target.setCurrentCp(0); } } diff --git a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/Creature.java index ea226b3955..954cb611aa 100644 --- a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -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,18 +3919,11 @@ 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); - } + target.setCurrentCp(0); } } diff --git a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/Creature.java index ea226b3955..954cb611aa 100644 --- a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -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,18 +3919,11 @@ 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); - } + target.setCurrentCp(0); } } diff --git a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/Creature.java index 1ccda35fe0..3350da98b0 100644 --- a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -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,18 +3918,11 @@ 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); - } + target.setCurrentCp(0); } } diff --git a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/model/actor/Creature.java index 361cce92cf..718bda3868 100644 --- a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -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,18 +3918,11 @@ 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); - } + target.setCurrentCp(0); } } diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/actor/Creature.java index 361cce92cf..718bda3868 100644 --- a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -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,18 +3918,11 @@ 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); - } + target.setCurrentCp(0); } } diff --git a/L2J_Mobius_10.0_MasterClass/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_10.0_MasterClass/java/org/l2jmobius/gameserver/model/actor/Creature.java index ed06caecfe..c767625d9d 100644 --- a/L2J_Mobius_10.0_MasterClass/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_10.0_MasterClass/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -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,18 +3918,11 @@ 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); - } + target.setCurrentCp(0); } } diff --git a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/model/actor/Creature.java index 25f23e5c77..dc0b60ca3c 100644 --- a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -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 targets = skill.getTargetList(creature); + final List 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; } /** diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java index 27a7b7fe18..48e67b74f1 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -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 targets = skill.getTargetList(creature); + final List 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; } /** diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/actor/Creature.java index 2256e75161..a04707d7ad 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -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); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Creature.java index 52601646f0..988829a35f 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -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); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Creature.java index fdd395f78d..6f01ea6e2e 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -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,18 +3919,11 @@ 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); - } + target.setCurrentCp(0); } } diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/Creature.java index fdd395f78d..6f01ea6e2e 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -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,18 +3919,11 @@ 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); - } + target.setCurrentCp(0); } } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/Creature.java index 1460357a31..f36e865a04 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -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,18 +3919,11 @@ 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); - } + target.setCurrentCp(0); } } diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Creature.java index 5dd9d46e29..ab9cbb9ad3 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -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,18 +3932,11 @@ 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); - } + target.setCurrentCp(0); } } diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Creature.java index 5dd9d46e29..ab9cbb9ad3 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -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,18 +3932,11 @@ 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); - } + target.setCurrentCp(0); } } diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Creature.java index ee0b39b010..bbf825d5a8 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -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,18 +3931,11 @@ 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); - } + target.setCurrentCp(0); } } diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java index fdd395f78d..6f01ea6e2e 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -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,18 +3919,11 @@ 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); - } + target.setCurrentCp(0); } } diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/Creature.java index 4ee3be1dc7..38b42569e5 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -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); } diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/actor/Creature.java index 4902a7489e..06fcb2729c 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -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); } diff --git a/L2J_Mobius_Essence_6.0_BattleChronicle/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Essence_6.0_BattleChronicle/java/org/l2jmobius/gameserver/model/actor/Creature.java index 42c530327e..9c893b204a 100644 --- a/L2J_Mobius_Essence_6.0_BattleChronicle/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Essence_6.0_BattleChronicle/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -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); }