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);
}
});
// target is still alive? is still around?
if (!npc.isRemoved() || owner.withinRange(npc)) {
return;
}
this.stop();
}
}

View File

@ -67,8 +67,14 @@ public abstract class WalkMobToMobEvent extends DelayedEvent {
if (owner.withinRange(affectedMob, radius))
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
}
else {
if (GameEngine.getTime() - startTime <= 10000) // Make NPCs
// give a 10
@ -84,6 +90,9 @@ public abstract class WalkMobToMobEvent extends DelayedEvent {
failed();
return;
}
else if (owner.nextTo(affectedMob) && owner.finishedPath()) {
return; // if stuck behind gate, keep chasing in case it opens
}
}
if (owner.isBusy())

View File

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

View File

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