So i ripped Xyle combat to winterLove because my combat was realy bad, so i got almost everything to work fine but only 1 bugs that i cant seem to fix.
So for some reason my mage/range follow is fucked it walks towards the player no matter what
Some help would be nice
Code:
public void followPlayer() {
facePlayer(c.followID);
if (PlayerHandler.players[c.followID] == null || PlayerHandler.players[c.followID].deathStage > 0) {
resetFollow();
return;
}
if (freezeTimer > 0) {
return;
}
if (c.deathStage > 0 || c.currentHealth <= 0)
return;
int otherX = PlayerHandler.players[c.followID].getX();
int otherY = PlayerHandler.players[c.followID].getY();
boolean sameSpot = (c.absX == otherX && c.absY == otherY);
boolean rangeWeaponDistance = c.GoodDistance(otherX, otherY, c.getX(),
c.getY(), 4);
boolean bowDistance = c.GoodDistance(otherX, otherY, c.getX(),
c.getY(), 6);
boolean mageDistance = c.GoodDistance(otherX, otherY, c.getX(),
c.getY(), 7);
boolean castingMagic = (c.cast || mageFollow || c.autocasting || MagicHandler.spellID > 0)
&& mageDistance;
boolean playerRanging = (usingRangeWeapon)
&& rangeWeaponDistance;
boolean playerBowOrCross = (c.usingBow) && bowDistance;
if (!c.GoodDistance(otherX, otherY, c.getX(), c.getY(), 25)) {
c.followID = 0;
resetFollow();
return;
}
faceUpdate(c.followID + 32768);
facePlayer(c.followID);
if (!sameSpot) {
if (c.playerIndex > 0 && c.isInWilderness(c.absX, c.absY, 1)) {
if (c.usingSpecial && (playerRanging || playerBowOrCross)) {
return;
}
if (c.autocasting || playerRanging || playerBowOrCross) {
return;
}
}
}
if (otherX == c.absX && otherY == c.absY) {
int r = Misc.random(3);
switch (r) {
case 0:
walkTo(0, -1);
break;
case 1:
walkTo(0, 1);
break;
case 2:
walkTo(1, 0);
break;
case 3:
walkTo(-1, 0);
break;
}
} else if (c.isRunning2) {
if (otherY > c.getY() && otherX == c.getX()) {
playerWalk(otherX, otherY - 1);
} else if (otherY < c.getY() && otherX == c.getX()) {
playerWalk(otherX, otherY + 1);
} else if (otherX > c.getX() && otherY == c.getY()) {
playerWalk(otherX - 1, otherY);
} else if (otherX < c.getX() && otherY == c.getY()) {
playerWalk(otherX + 1, otherY);
} else if (otherX < c.getX() && otherY < c.getY()) {
playerWalk(otherX + 1, otherY + 1);
} else if (otherX > c.getX() && otherY > c.getY()) {
playerWalk(otherX - 1, otherY - 1);
} else if (otherX < c.getX() && otherY > c.getY()) {
playerWalk(otherX + 1, otherY - 1);
} else if (otherX > c.getX() && otherY < c.getY()) {
playerWalk(otherX + 1, otherY - 1);
}
} else {
if (otherY > c.getY() && otherX == c.getX()) {
playerWalk(otherX, otherY - 1);
} else if (otherY < c.getY() && otherX == c.getX()) {
playerWalk(otherX, otherY + 1);
} else if (otherX > c.getX() && otherY == c.getY()) {
playerWalk(otherX - 1, otherY);
} else if (otherX < c.getX() && otherY == c.getY()) {
playerWalk(otherX + 1, otherY);
} else if (otherX < c.getX() && otherY < c.getY()) {
playerWalk(otherX + 1, otherY + 1);
} else if (otherX > c.getX() && otherY > c.getY()) {
playerWalk(otherX - 1, otherY - 1);
} else if (otherX < c.getX() && otherY > c.getY()) {
playerWalk(otherX + 1, otherY - 1);
} else if (otherX > c.getX() && otherY < c.getY()) {
playerWalk(otherX - 1, otherY + 1);
}
}
faceUpdate(c.followID+32768);
}