Merge pull request #152 from latifundio/pre-beta

Pre beta
This commit is contained in:
CodeForFame 2012-09-09 10:08:48 -07:00
commit 8f437d3c03
4 changed files with 35 additions and 16 deletions

View File

@ -304,6 +304,10 @@ public class RangeEvent extends DelayedEvent {
npc.setChasing(null); npc.setChasing(null);
} }
}); });
// target is still alive? is still around?
if (!npc.isRemoved() || owner.withinRange(npc)) {
return;
}
this.stop(); this.stop();
} }
} }

View File

@ -67,8 +67,14 @@ public abstract class WalkMobToMobEvent extends DelayedEvent {
if (owner.withinRange(affectedMob, radius)) if (owner.withinRange(affectedMob, radius))
arrived(); arrived();
else if (owner.hasMoved()) else if (affectedMob.hasMoved()){
owner.resetPath();
owner.setPath(new Path(owner.getX(), owner.getY(), affectedMob.getX(), affectedMob.getY()));
return; // Target is moving.. correcting path
}
else if (owner.hasMoved()) {
return; // We're still moving return; // We're still moving
}
else { else {
if (GameEngine.getTime() - startTime <= 10000) // Make NPCs if (GameEngine.getTime() - startTime <= 10000) // Make NPCs
// give a 10 // give a 10
@ -84,6 +90,9 @@ public abstract class WalkMobToMobEvent extends DelayedEvent {
failed(); failed();
return; return;
} }
else if (owner.nextTo(affectedMob) && owner.finishedPath()) {
return; // if stuck behind gate, keep chasing in case it opens
}
} }
if (owner.isBusy()) if (owner.isBusy())

View File

@ -579,6 +579,10 @@ public class Npc extends Mob {
} }
if (now - lastMovement > 2200) { if (now - lastMovement > 2200) {
if (now - getCombatTimer() < (getCombatState() ==
CombatState.WAITING ? 5000 : 500)) {
}
else {
lastMovement = now; lastMovement = now;
int rand = DataConversions.random(0, 1); int rand = DataConversions.random(0, 1);
if (!isBusy() && finishedPath() && rand == 1 && !this.isRemoved()) { if (!isBusy() && finishedPath() && rand == 1 && !this.isRemoved()) {
@ -587,6 +591,7 @@ public class Npc extends Mob {
super.setPath(new Path(getX(), getY(), newX, newY)); super.setPath(new Path(getX(), getY(), newX, newY));
} }
} }
}
super.updatePosition(); super.updatePosition();
} }

View File

@ -64,7 +64,7 @@ public class Mining implements ObjectListener {
if (owner.getClick() == 1) { if (owner.getClick() == 1) {
owner.getActionSender().sendMessage("You examine the rock for ores..."); owner.getActionSender().sendMessage("You examine the rock for ores...");
Instance.getDelayedEventHandler() Instance.getDelayedEventHandler()
.add(new MiniEvent(owner, 1000) { .add(new MiniEvent(owner, 2400) {
@Override @Override
public void action() { public void action() {
owner.getActionSender().sendMessage( owner.getActionSender().sendMessage(
@ -94,22 +94,22 @@ public class Mining implements ObjectListener {
int reqlvl = 1; int reqlvl = 1;
switch (axeID) { switch (axeID) {
case 1258: case 1258:
retrytimes = 2; retrytimes = 1; // 1 retry + initial swing = 2
break; break;
case 1259: case 1259:
retrytimes = 4; retrytimes = 3;
reqlvl = 6; reqlvl = 6;
break; break;
case 1260: case 1260:
retrytimes = 6; retrytimes = 5;
reqlvl = 21; reqlvl = 21;
break; break;
case 1261: case 1261:
retrytimes = 8; retrytimes = 7;
reqlvl = 31; reqlvl = 31;
break; break;
case 1262: case 1262:
retrytimes = 12; retrytimes = 11;
reqlvl = 41; reqlvl = 41;
break; break;
@ -140,9 +140,9 @@ public class Mining implements ObjectListener {
//return; //return;
//} //}
if (Formulae.getOre(def, owner.getCurStat(14), axeID)) { if (Formulae.getOre(def, owner.getCurStat(14), axeID)) {
if (DataConversions.random(0, 200) == 0) { if (DataConversions.random(0, 100) == 0) {
InvItem gem = new InvItem(Formulae.getGem(), 1); InvItem gem = new InvItem(Formulae.getGem(), 1);
owner.incExp(14, 100, true); //owner.incExp(14, 100, true);
owner.getInventory().add(gem); owner.getInventory().add(gem);
owner.getActionSender().sendMessage("You found a gem!"); owner.getActionSender().sendMessage("You found a gem!");
} else { } else {
@ -172,7 +172,8 @@ public class Mining implements ObjectListener {
new SingleEvent(owner, 500) { new SingleEvent(owner, 500) {
public void action() { public void action() {
if(!owner.isMining() || owner.inCombat()) { //if(!owner.isMining() || owner.inCombat()) {
if (owner.inCombat()) {
return; return;
} }
owner.setSkillLoops(swings + 1); owner.setSkillLoops(swings + 1);