mirror of
https://github.com/2006-Scape/2006Scape.git
synced 2026-07-03 00:31:51 +00:00
Fixup being able to kill monsters without correct slayer level (#220)
* Cannon only fire at npcs on same height level. * Cannon cannot kill monsters if you do not have the slayer level
This commit is contained in:
@@ -404,14 +404,17 @@ public class DwarfCannon {
|
||||
|
||||
private Npc targetNpc() {
|
||||
for (int i = 0; i < NpcHandler.MAX_NPCS; i++) {
|
||||
if (NpcHandler.npcs[i] == null) {
|
||||
Npc npc = NpcHandler.npcs[i];
|
||||
if (npc == null || npc.heightLevel != player.heightLevel || !canAttackSlayer(i)) {
|
||||
continue;
|
||||
}
|
||||
Npc npc = NpcHandler.npcs[i];
|
||||
int myX = player.cannonX;
|
||||
int myY = player.cannonY;
|
||||
int theirX = npc.absX;
|
||||
int theirY = npc.absY;
|
||||
|
||||
|
||||
|
||||
if (!npc.isDead && !npc.isDead && npc.HP != 0 && npc.npcType != 1266 && npc.npcType != 1268 && inDistance(theirX, theirY)) {
|
||||
switch (rotation) {
|
||||
case 1:
|
||||
@@ -464,6 +467,10 @@ public class DwarfCannon {
|
||||
return (npcX >= player.cannonX - maxDistance && npcX <= player.cannonX + maxDistance && npcY >= player.cannonY - maxDistance && npcY <= player.cannonY + maxDistance);
|
||||
}
|
||||
|
||||
public boolean canAttackSlayer(int i){
|
||||
return player.playerLevel[player.playerSlayer] >= player.getSlayer().getRequiredLevel(NpcHandler.npcs[i].npcType);
|
||||
}
|
||||
|
||||
private void cannonProjectile(Npc n) {
|
||||
int oX = player.cannonX+getShootXPos();
|
||||
int oY = player.cannonY+getShootYPos();
|
||||
|
||||
Reference in New Issue
Block a user