v0.4.2b: fixed bugs with npc interaction
This commit is contained in:
parent
c6d86f42ab
commit
770bbfdb42
|
@ -584,8 +584,7 @@ public class Hero extends Char {
|
|||
|
||||
ready();
|
||||
sprite.turnTo( pos, npc.pos );
|
||||
npc.interact();
|
||||
return false;
|
||||
return npc.interact();
|
||||
|
||||
} else {
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ public class Blacksmith extends NPC {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void interact() {
|
||||
public boolean interact() {
|
||||
|
||||
sprite.turnTo( pos, Dungeon.hero.pos );
|
||||
|
||||
|
@ -136,6 +136,8 @@ public class Blacksmith extends NPC {
|
|||
tell( Messages.get(this, "get_lost") );
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void tell( String text ) {
|
||||
|
|
|
@ -108,7 +108,7 @@ public class Ghost extends NPC {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void interact() {
|
||||
public boolean interact() {
|
||||
sprite.turnTo( pos, Dungeon.hero.pos );
|
||||
|
||||
Sample.INSTANCE.play( Assets.SND_GHOST );
|
||||
|
@ -173,6 +173,8 @@ public class Ghost extends NPC {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static final HashSet<Class<?>> IMMUNITIES = new HashSet<>();
|
||||
|
|
|
@ -85,7 +85,7 @@ public class Imp extends NPC {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void interact() {
|
||||
public boolean interact() {
|
||||
|
||||
sprite.turnTo( pos, Dungeon.hero.pos );
|
||||
if (Quest.given) {
|
||||
|
@ -106,6 +106,8 @@ public class Imp extends NPC {
|
|||
|
||||
Journal.add( Journal.Feature.IMP );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void tell( String text ) {
|
||||
|
|
|
@ -118,7 +118,7 @@ public class MirrorImage extends NPC {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void interact() {
|
||||
public boolean interact() {
|
||||
|
||||
int curPos = pos;
|
||||
|
||||
|
@ -130,6 +130,8 @@ public class MirrorImage extends NPC {
|
|||
|
||||
Dungeon.hero.spend( 1 / Dungeon.hero.speed() );
|
||||
Dungeon.hero.busy();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static final HashSet<Class<?>> IMMUNITIES = new HashSet<>();
|
||||
|
|
|
@ -52,5 +52,5 @@ public abstract class NPC extends Mob {
|
|||
public void beckon( int cell ) {
|
||||
}
|
||||
|
||||
abstract public void interact();
|
||||
abstract public boolean interact();
|
||||
}
|
|
@ -63,7 +63,7 @@ public class RatKing extends NPC {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void interact() {
|
||||
public boolean interact() {
|
||||
sprite.turnTo( pos, Dungeon.hero.pos );
|
||||
if (state == SLEEPING) {
|
||||
notice();
|
||||
|
@ -72,6 +72,7 @@ public class RatKing extends NPC {
|
|||
} else {
|
||||
yell( Messages.get(this, "what_is_it") );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.SheepSprite;
|
||||
|
@ -61,7 +62,8 @@ public class Sheep extends NPC {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void interact() {
|
||||
public boolean interact() {
|
||||
yell( Messages.get(this, Random.element( LINE_KEYS )) );
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -94,7 +94,8 @@ public class Shopkeeper extends NPC {
|
|||
};
|
||||
|
||||
@Override
|
||||
public void interact() {
|
||||
public boolean interact() {
|
||||
sell();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ public class Wandmaker extends NPC {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void interact() {
|
||||
public boolean interact() {
|
||||
|
||||
sprite.turnTo( pos, Dungeon.hero.pos );
|
||||
if (Quest.given) {
|
||||
|
@ -163,6 +163,8 @@ public class Wandmaker extends NPC {
|
|||
Journal.add( Journal.Feature.WANDMAKER );
|
||||
Quest.given = true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class Quest {
|
||||
|
|
|
@ -392,10 +392,11 @@ public class DriedRose extends Artifact {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void interact() {
|
||||
public boolean interact() {
|
||||
if (!DriedRose.talkedTo){
|
||||
DriedRose.talkedTo = true;
|
||||
GameScene.show(new WndQuest(this, Messages.get(this, "introduce") ));
|
||||
return false;
|
||||
} else {
|
||||
int curPos = pos;
|
||||
|
||||
|
@ -407,6 +408,7 @@ public class DriedRose extends Artifact {
|
|||
|
||||
Dungeon.hero.spend( 1 / Dungeon.hero.speed() );
|
||||
Dungeon.hero.busy();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user