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