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());
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -244,6 +244,18 @@ open class MeleeSwingHandler
|
|||
if (state.secondaryHit > 0) {
|
||||
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
|
||||
val famExp = entity.getAttribute("fam-exp", false) && entity.familiarManager.hasFamiliar()
|
||||
if (!famExp) {
|
||||
|
|
|
|||
|
|
@ -148,6 +148,18 @@ open class RangeSwingHandler
|
|||
if (state.secondaryHit > 0) {
|
||||
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 famExp = entity.getAttribute("fam-exp", false) && p.familiarManager.hasFamiliar()
|
||||
if (famExp) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue