Adjusted repulsive logic so now snakes slip out from under you... it's quite hilarious looking!

This commit is contained in:
Brendan Robert 2015-08-13 03:05:06 -05:00
parent d4a15117f5
commit 71c8674bbb

View File

@ -6,6 +6,7 @@ import jace.core.RAMEvent;
import jace.core.RAMListener; import jace.core.RAMListener;
public class MontezumasRevengeCheats extends Cheats { public class MontezumasRevengeCheats extends Cheats {
@ConfigurableField(category = "Hack", name = "Repulsive", defaultValue = "false", description = "YOU STINK!") @ConfigurableField(category = "Hack", name = "Repulsive", defaultValue = "false", description = "YOU STINK!")
public static boolean repulsiveHack = false; public static boolean repulsiveHack = false;
@ -27,29 +28,33 @@ public class MontezumasRevengeCheats extends Cheats {
setScopeEnd(0x1518); setScopeEnd(0x1518);
} }
int lastX = 0;
@Override @Override
protected void doEvent(RAMEvent e) { protected void doEvent(RAMEvent e) {
int playerX = computer.getMemory().readRaw(PLAYER_X); int playerX = computer.getMemory().readRaw(PLAYER_X);
int playerY = computer.getMemory().readRaw(PLAYER_Y); int playerY = computer.getMemory().readRaw(PLAYER_Y);
for (int num = 7; num >0; num--) { for (int num = 7; num > 0; num--) {
int monsterX = computer.getMemory().readRaw(PLAYER_X + num); int monsterX = computer.getMemory().readRaw(PLAYER_X + num);
int monsterY = computer.getMemory().readRaw(PLAYER_Y + num); int monsterY = computer.getMemory().readRaw(PLAYER_Y + num);
if (monsterX != 0 && monsterY != 0) { if (monsterX != 0 && monsterY != 0) {
if (Math.abs(monsterY - playerY) < 15) { if (Math.abs(monsterY - playerY) < 19) {
if (Math.abs(monsterX - playerX) < 7) { if (Math.abs(monsterX - playerX) < 7) {
int movement = Math.max(1, Math.abs(lastX - playerX));
if (monsterX > playerX) { if (monsterX > playerX) {
monsterX+=1; monsterX += movement;
} else { } else {
monsterX-=1; monsterX -= movement;
if (monsterX <= 0) { if (monsterX <= 0) {
monsterX = 80; monsterX = 80;
} }
} }
computer.getMemory().write(PLAYER_X+num, (byte) monsterX, false, false); computer.getMemory().write(PLAYER_X + num, (byte) monsterX, false, false);
} }
} }
} }
} }
lastX = playerX;
} }
}); });
} }