mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2026-08-01 14:39:13 -06:00
fixed a few regressions, fortunately already covered by tests that are to be done anyway
This commit is contained in:
parent
bd5d495847
commit
09344d4d66
3 changed files with 6 additions and 8 deletions
|
|
@ -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<BattleState> l = new ArrayList<>(20);
|
||||
l.add(new BattleState(entity, victim));
|
||||
List<Entity> list = findMultihitTargets(vl, entity, null);
|
||||
List<Entity> 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;
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -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<Entity> {
|
||||
fun findMultihitTargets(center: Location, attacker: Entity, combatStyle: CombatStyle): List<Entity> {
|
||||
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<Entity> {
|
||||
fun findMultihitTargetsForD2h(center: Location, attacker: Entity, combatStyle: CombatStyle): List<Entity> {
|
||||
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<NPC>()
|
||||
fun isOwnerOf(entity: Entity, npcs: List<NPC>): Boolean {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue