mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-13 10:00:17 -07:00
[AI] refactor
This commit is contained in:
parent
3336f3422e
commit
686757d189
4 changed files with 4 additions and 10 deletions
|
|
@ -181,8 +181,6 @@ public class AIPlayer extends Player {
|
||||||
{
|
{
|
||||||
int meX = this.getLocation().getX();
|
int meX = this.getLocation().getX();
|
||||||
int meY = this.getLocation().getY();
|
int meY = this.getLocation().getY();
|
||||||
//int meX2 = this.getLocation().getX();
|
|
||||||
//System.out.println("local " + meX + " real x? " + meX2 );
|
|
||||||
ArrayList<Node> nodes = new ArrayList<Node>();
|
ArrayList<Node> nodes = new ArrayList<Node>();
|
||||||
for (NPC npc : RegionManager.getLocalNpcs(this, range)) {
|
for (NPC npc : RegionManager.getLocalNpcs(this, range)) {
|
||||||
if (npc.getId() == entry)
|
if (npc.getId() == entry)
|
||||||
|
|
@ -399,14 +397,12 @@ public class AIPlayer extends Player {
|
||||||
* @param uid The player's UID.
|
* @param uid The player's UID.
|
||||||
*/
|
*/
|
||||||
public static void deregister(int uid) {
|
public static void deregister(int uid) {
|
||||||
if (!botMapping.containsKey(uid)) {
|
|
||||||
System.err.println("Could not deregister AIP#" + uid + ": UID not added to the mapping!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
AIPlayer player = botMapping.get(uid);
|
AIPlayer player = botMapping.get(uid);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
player.clear();
|
player.clear();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
System.err.println("Could not deregister AIP#" + uid + ": UID not added to the mapping!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,7 @@ public class LowestBot extends PvMBots{
|
||||||
private int tick = 0;
|
private int tick = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tick()
|
public void tick(){
|
||||||
{
|
|
||||||
super.tick();
|
super.tick();
|
||||||
|
|
||||||
//Despawn
|
//Despawn
|
||||||
|
|
|
||||||
|
|
@ -74,8 +74,8 @@ public class PvMBots extends AIPlayer {
|
||||||
if (creatures == null) {
|
if (creatures == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!(creatures.isEmpty())) {
|
|
||||||
bot.attack(creatures.get(RandomFunction.getRandom((creatures.size() - 1))));
|
bot.attack(creatures.get(RandomFunction.getRandom((creatures.size() - 1))));
|
||||||
|
if (!creatures.isEmpty()) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
creatures = FindTargets(bot, radius);
|
creatures = FindTargets(bot, radius);
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,6 @@ public final class AIPCommandPlugin extends CommandPlugin {
|
||||||
PVPAIPActions.syncBotThread(player);
|
PVPAIPActions.syncBotThread(player);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
||||||
case "bot":
|
case "bot":
|
||||||
PvMBotsBuilder.spawnLowest(player.getLocation());
|
PvMBotsBuilder.spawnLowest(player.getLocation());
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue