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:
+2
-1
@@ -146,6 +146,7 @@ public final class ChinchompaSwingHandler extends RangeSwingHandler {
|
||||
s.getVictim().animate(s.getVictim().getProperties().getDefenceAnimation());
|
||||
}
|
||||
}
|
||||
addExperience(entity, victim, state);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -155,4 +156,4 @@ public final class ChinchompaSwingHandler extends RangeSwingHandler {
|
||||
public static ChinchompaSwingHandler getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,6 +229,23 @@ public final class Location extends Node {
|
||||
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.
|
||||
* @param other The other location.
|
||||
@@ -455,4 +472,4 @@ public final class Location extends Node {
|
||||
public void setZ(int z) {
|
||||
this.z = z;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -538,11 +538,15 @@ object RegionManager {
|
||||
*/
|
||||
@JvmStatic
|
||||
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
|
||||
val it = players.iterator()
|
||||
while (it.hasNext()) {
|
||||
val p = it.next()
|
||||
if(!p.location.withinMaxnormDistance(n.location, 1)) {
|
||||
it.remove()
|
||||
continue
|
||||
}
|
||||
if (++count >= maximum) {
|
||||
it.remove()
|
||||
continue
|
||||
@@ -577,11 +581,15 @@ object RegionManager {
|
||||
*/
|
||||
@JvmStatic
|
||||
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
|
||||
val it = npcs.iterator()
|
||||
while (it.hasNext()) {
|
||||
val p = it.next()
|
||||
if(!p.location.withinMaxnormDistance(n.location, 1)) {
|
||||
it.remove()
|
||||
continue
|
||||
}
|
||||
if (++count > maximum) {
|
||||
it.remove()
|
||||
continue
|
||||
@@ -806,4 +814,4 @@ object RegionManager {
|
||||
|
||||
val lock: ReentrantLock
|
||||
@JvmStatic get() = LOCK
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user