So I've been trying to mess with my getNearestPvPChar method to change it from being able to only attack one character at a time to
everyone within range. So far, all my attempts have ended up in failure. Think anyone can lead me to the right direction?
For anyone who wants to see my getNearestPvPChar method~
PHP Code:public Collection<MapleCharacter> getNearestPvPChar(Point attacker, double maxRange, double maxHeight, Collection<MapleCharacter> chr) {
Collection<MapleCharacter> character = new LinkedList<MapleCharacter>();
for (MapleCharacter a : characters) {
if (chr.contains(a.getClient().getPlayer())) {
Point attackedPlayer = a.getPosition();
MaplePortal Port = a.getMap().findClosestSpawnpoint(a.getPosition());
Point nearestPort = Port.getPosition();
double safeDis = attackedPlayer.distance(nearestPort);
double distanceX = attacker.distance(attackedPlayer.getX(), attackedPlayer.getY());
if (MaplePvP.isLeft) {
if (attacker.x > attackedPlayer.x && distanceX < maxRange && distanceX > 2 && attackedPlayer.y >= attacker.y - maxHeight && attackedPlayer.y <= attacker.y + maxHeight && safeDis > 2) {
character.add(a);
}
}
if (MaplePvP.isRight) {
if (attacker.x < attackedPlayer.x && distanceX < maxRange && distanceX > 2 && attackedPlayer.y >= attacker.y - maxHeight && attackedPlayer.y <= attacker.y + maxHeight && safeDis > 2) {
character.add(a);
}
}
}
}
return character;
}



Reply With Quote![[Help] Modifying how PvP Works](http://ragezone.com/hyper728.png)


