mirror of
https://github.com/2006-Scape/2006Scape.git
synced 2026-07-07 16:49:07 +00:00
Finally should fix aggressiveness smh (#165)
closes #160 Let me know if this doesn't work, but hoping it does. My local testing had it working perfectly
This commit is contained in:
committed by
Daniel Ginovker
parent
679fad7b18
commit
d53ed61064
@@ -6,21 +6,26 @@ import redone.game.npcs.NpcHandler;
|
|||||||
|
|
||||||
public class NpcAggressive {
|
public class NpcAggressive {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Aggressive monsters
|
||||||
|
*/
|
||||||
|
private static final int[] AGGRESSIVE_MONSTERS = {
|
||||||
|
1155, 374, 1157, 1158, 1159, 1160, 141, 1459, 1456, 96, 97, 142,
|
||||||
|
2550, 2551, 2552, 2553, 2558, 2559, 2560, 2561, 2562, 2563,
|
||||||
|
2564, 2565, 2892, 2894, 2881, 2882, 2883, 172, 1593, 144, 112, 84, 3068,
|
||||||
|
50, 1590, 1591, 1592, 53, 54, 55, 178, 49, 174, 2455, 2456, 2454,
|
||||||
|
82, 752, 1608, 1609, 1610, 1827, 2783, 1926, 1931, 2457, 412, 1604, 1612,
|
||||||
|
110, 1611, 83, 941, 49, 117, 111, 125, 1154, 107, 1342, 1338, 447, 448, 449, 917,
|
||||||
|
1265, 1267
|
||||||
|
};
|
||||||
|
|
||||||
public static boolean isAggressive(int i) {
|
public static boolean isAggressive(int i) {
|
||||||
int[] data = {
|
boolean aggressive = NpcHandler.npcs[i].inWild() || PestControl.npcIsPCMonster(NpcHandler.npcs[i].npcType) || FightCaves.isFightCaveNpc(i);
|
||||||
1155, 374, 1157, 1158, 1159, 1160, 141, 1459, 1456, 96, 97, 142,
|
for (int element : AGGRESSIVE_MONSTERS) {
|
||||||
2550, 2551, 2552, 2553, 2558, 2559, 2560, 2561, 2562, 2563,
|
if (NpcHandler.npcs[i].npcType == element || aggressive) {
|
||||||
2564, 2565, 2892, 2894, 2881, 2882, 2883, 172, 1593, 144, 112, 84, 3068, 1265,
|
|
||||||
50, 1590, 1591, 1592, 53, 54, 55, 178, 1267, 49, 174, 2455, 2456, 2454,
|
|
||||||
82, 752, 1608, 1609, 1610, 1827, 2783, 1926, 1931, 2457, 412, 1604, 1612,
|
|
||||||
110, 1611, 83, 941, 49, 117, 111, 125, 1154, 107, 1342, 1338, 447, 448, 449, 917
|
|
||||||
};
|
|
||||||
for (int element : data) {
|
|
||||||
if ((NpcHandler.npcs[i].npcType == element || PestControl.npcIsPCMonster(NpcHandler.npcs[i].npcType) || FightCaves.isFightCaveNpc(i)) && NpcHandler.npcs[i].MaxHP > 0) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -415,8 +415,8 @@ public class NpcHandler {
|
|||||||
|
|
||||||
Client client = (Client) PlayerHandler.players[NpcData.getCloseRandomPlayer(i)];
|
Client client = (Client) PlayerHandler.players[NpcData.getCloseRandomPlayer(i)];
|
||||||
if (client != null) {
|
if (client != null) {
|
||||||
boolean aggressive = (NpcAggressive.isAggressive(i) && getNpcListCombat(npcs[i].npcType) * 2 > client.combatLevel) || npcs[i].inWild();
|
boolean aggressive = (NpcAggressive.isAggressive(i) || getNpcListCombat(npcs[i].npcType) * 2 > client.combatLevel);
|
||||||
if (aggressive && !npcs[i].underAttack && !npcs[i].isDead) {
|
if (aggressive && !npcs[i].underAttack && !npcs[i].isDead && npcs[i].MaxHP > 0) {
|
||||||
npcs[i].killerId = NpcData.getCloseRandomPlayer(i);
|
npcs[i].killerId = NpcData.getCloseRandomPlayer(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user