mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-20 21:40:27 -07:00
Fix xp of multitarget attacks (like chinchompas, dragon claw/halberd spec) and fix chinchompa attack pattern (square instead of plus).
This commit is contained in:
parent
9c18af8f8d
commit
849273ecb5
5 changed files with 55 additions and 5 deletions
|
|
@ -146,6 +146,7 @@ public final class ChinchompaSwingHandler extends RangeSwingHandler {
|
||||||
s.getVictim().animate(s.getVictim().getProperties().getDefenceAnimation());
|
s.getVictim().animate(s.getVictim().getProperties().getDefenceAnimation());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
addExperience(entity, victim, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -229,6 +229,23 @@ public final class Location extends Node {
|
||||||
return product <= dist;
|
return product <= dist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if a player is within a specified distance using max norm distance.
|
||||||
|
* @param other The other location.
|
||||||
|
* @param dist The amount of distance.
|
||||||
|
* @return If you're within the other distance.
|
||||||
|
*/
|
||||||
|
public boolean withinMaxnormDistance(Location other, int dist) {
|
||||||
|
if (other.z != z) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int a = Math.abs(other.x - x);
|
||||||
|
int b = Math.abs(other.y - y);
|
||||||
|
double max = Math.max(a, b);
|
||||||
|
return max <= dist;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the distance between you and the other.
|
* Returns the distance between you and the other.
|
||||||
* @param other The other location.
|
* @param other The other location.
|
||||||
|
|
|
||||||
|
|
@ -538,11 +538,15 @@ object RegionManager {
|
||||||
*/
|
*/
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun getSurroundingPlayers(n: Node, maximum: Int, vararg ignore: Node): List<Player> {
|
fun getSurroundingPlayers(n: Node, maximum: Int, vararg ignore: Node): List<Player> {
|
||||||
val players = getLocalPlayers(n.location, 1)
|
val players = getLocalPlayers(n.location, 2)
|
||||||
var count = 0
|
var count = 0
|
||||||
val it = players.iterator()
|
val it = players.iterator()
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
val p = it.next()
|
val p = it.next()
|
||||||
|
if(!p.location.withinMaxnormDistance(n.location, 1)) {
|
||||||
|
it.remove()
|
||||||
|
continue
|
||||||
|
}
|
||||||
if (++count >= maximum) {
|
if (++count >= maximum) {
|
||||||
it.remove()
|
it.remove()
|
||||||
continue
|
continue
|
||||||
|
|
@ -577,11 +581,15 @@ object RegionManager {
|
||||||
*/
|
*/
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun getSurroundingNPCs(n: Node, maximum: Int, vararg ignore: Node): List<NPC> {
|
fun getSurroundingNPCs(n: Node, maximum: Int, vararg ignore: Node): List<NPC> {
|
||||||
val npcs = getLocalNpcs(n.location, 1)
|
val npcs = getLocalNpcs(n.location, 2)
|
||||||
var count = 0
|
var count = 0
|
||||||
val it = npcs.iterator()
|
val it = npcs.iterator()
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
val p = it.next()
|
val p = it.next()
|
||||||
|
if(!p.location.withinMaxnormDistance(n.location, 1)) {
|
||||||
|
it.remove()
|
||||||
|
continue
|
||||||
|
}
|
||||||
if (++count > maximum) {
|
if (++count > maximum) {
|
||||||
it.remove()
|
it.remove()
|
||||||
continue
|
continue
|
||||||
|
|
|
||||||
|
|
@ -244,6 +244,18 @@ open class MeleeSwingHandler
|
||||||
if (state.secondaryHit > 0) {
|
if (state.secondaryHit > 0) {
|
||||||
hit += state.secondaryHit
|
hit += state.secondaryHit
|
||||||
}
|
}
|
||||||
|
if(state.targets != null) {
|
||||||
|
for (s in state.targets) {
|
||||||
|
if (s != null) {
|
||||||
|
if(s.estimatedHit > 0) {
|
||||||
|
hit += s.estimatedHit
|
||||||
|
}
|
||||||
|
if(s.secondaryHit > 0) {
|
||||||
|
hit += s.secondaryHit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
var experience = hit * EXPERIENCE_MOD
|
var experience = hit * EXPERIENCE_MOD
|
||||||
val famExp = entity.getAttribute("fam-exp", false) && entity.familiarManager.hasFamiliar()
|
val famExp = entity.getAttribute("fam-exp", false) && entity.familiarManager.hasFamiliar()
|
||||||
if (!famExp) {
|
if (!famExp) {
|
||||||
|
|
|
||||||
|
|
@ -148,6 +148,18 @@ open class RangeSwingHandler
|
||||||
if (state.secondaryHit > 0) {
|
if (state.secondaryHit > 0) {
|
||||||
hit += state.secondaryHit
|
hit += state.secondaryHit
|
||||||
}
|
}
|
||||||
|
if(state.targets != null) {
|
||||||
|
for (s in state.targets) {
|
||||||
|
if (s != null) {
|
||||||
|
if(s.estimatedHit > 0) {
|
||||||
|
hit += s.estimatedHit
|
||||||
|
}
|
||||||
|
if(s.secondaryHit > 0) {
|
||||||
|
hit += s.secondaryHit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
val p = entity.asPlayer()
|
val p = entity.asPlayer()
|
||||||
val famExp = entity.getAttribute("fam-exp", false) && p.familiarManager.hasFamiliar()
|
val famExp = entity.getAttribute("fam-exp", false) && p.familiarManager.hasFamiliar()
|
||||||
if (famExp) {
|
if (famExp) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue