Crumble undead now more effective against zogres and skogres

This commit is contained in:
Oven Bread 2025-04-06 09:01:29 +00:00 committed by Ryan
parent 02c1835016
commit 3a7dfab628
4 changed files with 43 additions and 2 deletions

View file

@ -1,5 +1,7 @@
package content.global.skill.magic.modern; package content.global.skill.magic.modern;
import content.region.kandarin.feldip.quest.zogreflesheaters.SkogreBehavior;
import content.region.kandarin.feldip.quest.zogreflesheaters.ZogreBehavior;
import core.game.node.entity.combat.spell.Runes; import core.game.node.entity.combat.spell.Runes;
import core.game.node.Node; import core.game.node.Node;
import core.game.node.entity.Entity; import core.game.node.entity.Entity;
@ -15,8 +17,12 @@ import core.game.world.update.flag.context.Animation;
import core.game.world.update.flag.context.Graphics; import core.game.world.update.flag.context.Graphics;
import core.plugin.Initializable; import core.plugin.Initializable;
import core.plugin.Plugin; import core.plugin.Plugin;
import org.rs09.consts.NPCs;
import org.rs09.consts.Sounds; import org.rs09.consts.Sounds;
import java.util.Arrays;
import java.util.List;
/** /**
* Handles the crumble undead spell. * Handles the crumble undead spell.
* @author Emperor * @author Emperor
@ -35,6 +41,15 @@ public final class CrumbleUndead extends CombatSpell {
@Override @Override
public boolean cast(Entity entity, Node target) { public boolean cast(Entity entity, Node target) {
NPC npc = target instanceof NPC ? (NPC) target : null; NPC npc = target instanceof NPC ? (NPC) target : null;
// Exception for Zogres and Skogres because they are classified as OGRES in npc.getTask() as not undead,
// so you couldn't use crumble undead on it. This bypasses that.
if (
Arrays.stream(ZogreBehavior.zogreIds).anyMatch(i -> i == npc.getId()) ||
Arrays.stream(SkogreBehavior.skogreIds).anyMatch(i -> i == npc.getId()) ||
npc.getId() == NPCs.SLASH_BASH_2060
) {
return super.cast(entity, target);
}
if (npc == null || npc.getTask() == null || !npc.getTask().undead) { if (npc == null || npc.getTask() == null || !npc.getTask().undead) {
((Player) entity).getPacketDispatch().sendMessage("This spell only affects the undead."); ((Player) entity).getPacketDispatch().sendMessage("This spell only affects the undead.");
return false; return false;

View file

@ -4,6 +4,7 @@ import core.api.getOrStartTimer
import core.api.inEquipment import core.api.inEquipment
import core.game.node.entity.Entity import core.game.node.entity.Entity
import core.game.node.entity.combat.BattleState import core.game.node.entity.combat.BattleState
import core.game.node.entity.combat.spell.SpellType
import core.game.node.entity.npc.NPC import core.game.node.entity.npc.NPC
import core.game.node.entity.npc.NPCBehavior import core.game.node.entity.npc.NPCBehavior
import core.game.node.entity.player.Player import core.game.node.entity.player.Player
@ -13,7 +14,8 @@ import org.rs09.consts.NPCs
class SkogreBehavior : NPCBehavior(*skogreIds) { class SkogreBehavior : NPCBehavior(*skogreIds) {
companion object { companion object {
private val skogreIds = intArrayOf( @JvmField
val skogreIds = intArrayOf(
NPCs.SKOGRE_2050, NPCs.SKOGRE_2050,
NPCs.SKOGRE_2056, NPCs.SKOGRE_2056,
NPCs.SKOGRE_2057, NPCs.SKOGRE_2057,
@ -25,6 +27,13 @@ class SkogreBehavior : NPCBehavior(*skogreIds) {
if (inEquipment(attacker, Items.COMP_OGRE_BOW_4827)) { if (inEquipment(attacker, Items.COMP_OGRE_BOW_4827)) {
return return
} }
if (state.spell != null && state.spell.type == SpellType.CRUMBLE_UNDEAD) {
state.estimatedHit = (state.estimatedHit * 0.5).toInt()
if (state.secondaryHit > 0) {
state.secondaryHit = (state.secondaryHit * 0.5).toInt()
}
return
}
state.estimatedHit = (state.estimatedHit * 0.25).toInt() state.estimatedHit = (state.estimatedHit * 0.25).toInt()
if (state.secondaryHit > 0) { if (state.secondaryHit > 0) {
state.secondaryHit = (state.secondaryHit * 0.25).toInt() state.secondaryHit = (state.secondaryHit * 0.25).toInt()

View file

@ -8,6 +8,7 @@ import core.game.node.entity.combat.CombatStyle
import core.game.node.entity.combat.CombatSwingHandler import core.game.node.entity.combat.CombatSwingHandler
import core.game.node.entity.combat.MultiSwingHandler import core.game.node.entity.combat.MultiSwingHandler
import core.game.node.entity.combat.equipment.SwitchAttack import core.game.node.entity.combat.equipment.SwitchAttack
import core.game.node.entity.combat.spell.SpellType
import core.game.node.entity.npc.NPC import core.game.node.entity.npc.NPC
import core.game.node.entity.npc.NPCBehavior import core.game.node.entity.npc.NPCBehavior
import core.game.node.entity.player.Player import core.game.node.entity.player.Player
@ -42,6 +43,13 @@ class SlashBashBehavior : NPCBehavior(NPCs.SLASH_BASH_2060) {
if (inEquipment(attacker, Items.COMP_OGRE_BOW_4827)) { if (inEquipment(attacker, Items.COMP_OGRE_BOW_4827)) {
return return
} }
if (state.spell != null && state.spell.type == SpellType.CRUMBLE_UNDEAD) {
state.estimatedHit = (state.estimatedHit * 0.5).toInt()
if (state.secondaryHit > 0) {
state.secondaryHit = (state.secondaryHit * 0.5).toInt()
}
return
}
state.estimatedHit = (state.estimatedHit * 0.25).toInt() state.estimatedHit = (state.estimatedHit * 0.25).toInt()
if (state.secondaryHit > 0) { if (state.secondaryHit > 0) {
state.secondaryHit = (state.secondaryHit * 0.25).toInt() state.secondaryHit = (state.secondaryHit * 0.25).toInt()

View file

@ -4,6 +4,7 @@ import core.api.getOrStartTimer
import core.api.inEquipment import core.api.inEquipment
import core.game.node.entity.Entity import core.game.node.entity.Entity
import core.game.node.entity.combat.BattleState import core.game.node.entity.combat.BattleState
import core.game.node.entity.combat.spell.SpellType
import core.game.node.entity.npc.NPC import core.game.node.entity.npc.NPC
import core.game.node.entity.npc.NPCBehavior import core.game.node.entity.npc.NPCBehavior
import core.game.node.entity.player.Player import core.game.node.entity.player.Player
@ -13,7 +14,8 @@ import org.rs09.consts.NPCs
class ZogreBehavior : NPCBehavior(*zogreIds) { class ZogreBehavior : NPCBehavior(*zogreIds) {
companion object { companion object {
private val zogreIds = intArrayOf( @JvmField
val zogreIds = intArrayOf(
NPCs.ZOGRE_2044, NPCs.ZOGRE_2044,
NPCs.ZOGRE_2045, NPCs.ZOGRE_2045,
NPCs.ZOGRE_2046, NPCs.ZOGRE_2046,
@ -33,6 +35,13 @@ class ZogreBehavior : NPCBehavior(*zogreIds) {
if (inEquipment(attacker, Items.COMP_OGRE_BOW_4827)) { if (inEquipment(attacker, Items.COMP_OGRE_BOW_4827)) {
return return
} }
if (state.spell != null && state.spell.type == SpellType.CRUMBLE_UNDEAD) {
state.estimatedHit = (state.estimatedHit * 0.5).toInt()
if (state.secondaryHit > 0) {
state.secondaryHit = (state.secondaryHit * 0.5).toInt()
}
return
}
state.estimatedHit = (state.estimatedHit * 0.25).toInt() state.estimatedHit = (state.estimatedHit * 0.25).toInt()
if (state.secondaryHit > 0) { if (state.secondaryHit > 0) {
state.secondaryHit = (state.secondaryHit * 0.25).toInt() state.secondaryHit = (state.secondaryHit * 0.25).toInt()