diff --git a/Server/src/main/content/global/handlers/item/equipment/special/SweepSpecialHandler.java b/Server/src/main/content/global/handlers/item/equipment/special/SweepSpecialHandler.java index 3c9217d8f..ce7bcd9be 100644 --- a/Server/src/main/content/global/handlers/item/equipment/special/SweepSpecialHandler.java +++ b/Server/src/main/content/global/handlers/item/equipment/special/SweepSpecialHandler.java @@ -96,7 +96,7 @@ public final class SweepSpecialHandler extends MeleeSwingHandler implements Plug Direction dir = Direction.getDirection(x - entity.getLocation().getX(), y - entity.getLocation().getY()); List l = new ArrayList<>(20); l.add(new BattleState(entity, victim)); - List list = findMultihitTargets(vl, entity, null); + List list = findMultihitTargets(vl, entity, CombatStyle.RANGE); //RANGE is correct because halberds are able to attack from a distance for (Entity n : list) { if (n == victim) { continue; diff --git a/Server/src/main/core/game/node/entity/Entity.java b/Server/src/main/core/game/node/entity/Entity.java index 0203fd3e3..ec659429d 100644 --- a/Server/src/main/core/game/node/entity/Entity.java +++ b/Server/src/main/core/game/node/entity/Entity.java @@ -241,6 +241,7 @@ public abstract class Entity extends Node { // In that situation, the NPC never actually got created so it doesn't need to be removed from any chunk. If it had been, however, we do so now. if (this instanceof Player) { location.getChunk().removePlayer(asPlayer()); + location.getRegion().decrementViewAmount(); } if (this instanceof NPC) { location.getChunk().remove(asNpc()); diff --git a/Server/src/main/core/game/node/entity/combat/MultihitTargets.kt b/Server/src/main/core/game/node/entity/combat/MultihitTargets.kt index 26f1c9168..4cbb4b87f 100644 --- a/Server/src/main/core/game/node/entity/combat/MultihitTargets.kt +++ b/Server/src/main/core/game/node/entity/combat/MultihitTargets.kt @@ -8,22 +8,19 @@ import core.game.world.map.Location import core.game.world.map.RegionManager.getLocalEntities import core.game.world.map.zone.impl.WildernessZone -private fun isAttackable(victim: Entity, attacker: Entity, combatStyle: CombatStyle?, wilderness: Boolean): Boolean { - if (combatStyle == null) { - return true - } +private fun isAttackable(victim: Entity, attacker: Entity, combatStyle: CombatStyle, wilderness: Boolean): Boolean { if (wilderness) { return WildernessZone.getInstance().continueAttack(attacker, victim, combatStyle, false) } return victim.isAttackable(attacker, combatStyle, false) } -fun findMultihitTargets(center: Location, attacker: Entity, combatStyle: CombatStyle?): List { +fun findMultihitTargets(center: Location, attacker: Entity, combatStyle: CombatStyle): List { val targets = getLocalEntities(center, 1).filter { it != attacker && isAttackable(it, attacker, combatStyle, false) } return targets.take(9) //https://runescape.wiki/w/Vesta%27s_spear "the opponent and up to 9 additional targets in a 3x3 area around the player"; https://oldschool.runescape.wiki/w/Ice_Barrage "up to nine targets" } -fun findMultihitTargetsForD2h(center: Location, attacker: Entity, combatStyle: CombatStyle?): List { +fun findMultihitTargetsForD2h(center: Location, attacker: Entity, combatStyle: CombatStyle): List { val targets = getLocalEntities(center, 1).filter { it != attacker && isAttackable(it, attacker, combatStyle, false) } return targets.filter { it.location.withinDistance(center, 1) } .take(14) //runescape.wiki/w/Dragon_2h_sword?oldid=859949 "up to 14 enemies in the squares around the player (Only directly in front of and to the sides, it does not attack those diagonal of the player)" } @@ -39,7 +36,7 @@ fun findMultihitTargetsForChinchompa(center: Location, attacker: Entity, victim: } return entity.owner in players && isAttackable(entity.owner, attacker, CombatStyle.RANGE, true) } - targets = targetCandidates.filter { (it is Player && isAttackable(attacker, it, CombatStyle.RANGE, true)) || isFamiliarOf(it, players) } + targets = targetCandidates.filter { (it is Player && isAttackable(it, attacker, CombatStyle.RANGE, true)) || isFamiliarOf(it, players) } } else { val npcs = targetCandidates.filterIsInstance() fun isOwnerOf(entity: Entity, npcs: List): Boolean {