diff --git a/core/src/main/assets/icons.png b/core/src/main/assets/icons.png index f0802a553..400c154f9 100644 Binary files a/core/src/main/assets/icons.png and b/core/src/main/assets/icons.png differ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java index 286c9c5e6..c1ebf9b41 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java @@ -160,7 +160,11 @@ public abstract class Mob extends Char { boolean justAlerted = alerted; alerted = false; - sprite.hideAlert(); + if (justAlerted){ + sprite.showAlert(); + } else { + sprite.hideAlert(); + } if (paralysed > 0) { enemySeen = false; @@ -517,7 +521,9 @@ public abstract class Mob extends Char { if (state == SLEEPING) { state = WANDERING; } - alerted = true; + if (state != HUNTING) { + alerted = true; + } super.damage( dmg, src ); } @@ -631,7 +637,6 @@ public abstract class Mob extends Char { public interface AiState { boolean act( boolean enemyInFOV, boolean justAlerted ); - String status(); } protected class Sleeping implements AiState { @@ -667,11 +672,6 @@ public abstract class Mob extends Char { } return true; } - - @Override - public String status() { - return Messages.get(this, "status", name ); - } } protected class Wandering implements AiState { @@ -685,12 +685,14 @@ public abstract class Mob extends Char { enemySeen = true; notice(); + alerted = true; state = HUNTING; target = enemy.pos; } else { enemySeen = false; + sprite.hideLost(); int oldPos = pos; if (target != -1 && getCloser( target )) { @@ -704,11 +706,6 @@ public abstract class Mob extends Char { } return true; } - - @Override - public String status() { - return Messages.get(this, "status", name ); - } } protected class Hunting implements AiState { @@ -737,17 +734,16 @@ public abstract class Mob extends Char { } else { spend( TICK ); - state = WANDERING; - target = Dungeon.level.randomDestination(); + + if (!enemyInFOV) { + sprite.showLost(); + state = WANDERING; + target = Dungeon.level.randomDestination(); + } return true; } } } - - @Override - public String status() { - return Messages.get(this, "status", name ); - } } protected class Fleeing implements AiState { @@ -781,11 +777,6 @@ public abstract class Mob extends Char { protected void nowhereToRun() { } - - @Override - public String status() { - return Messages.get(this, "status", name ); - } } protected class Passive implements AiState { @@ -798,11 +789,6 @@ public abstract class Mob extends Char { spend( TICK ); return true; } - - @Override - public String status() { - return Messages.get(this, "status", name ); - } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/EmoIcon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/EmoIcon.java index 87b3641f9..a19c46acf 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/EmoIcon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/EmoIcon.java @@ -103,5 +103,24 @@ public class EmoIcon extends Image { y = owner.y - height; } } + + public static class Lost extends EmoIcon { + + public Lost( CharSprite owner ){ + super( owner ); + + copy( Icons.get( Icons.LOST ) ); + + maxSize = 1.25f; + timeScale = 1; + + origin.set( 2.5f, height - 2.5f ); + scale.set( Random.Float( 1, maxSize ) ); + + x = owner.x + owner.width - width / 2; + y = owner.y - height; + } + + } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java index cc809ee03..c4714209e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java @@ -228,8 +228,8 @@ public class GameScene extends PixelScene { emitters = new Group(); effects = new Group(); - emoicons = new Group(); healthIndicators = new Group(); + emoicons = new Group(); mobs = new Group(); add( mobs ); @@ -274,7 +274,11 @@ public class GameScene extends PixelScene { statuses = new Group(); add( statuses ); - + + add( healthIndicators ); + //always appears ontop of other health indicators + add( new TargetHealthIndicator() ); + add( emoicons ); hero = new HeroSprite(); @@ -282,10 +286,6 @@ public class GameScene extends PixelScene { hero.updateArmor(); mobs.add( hero ); - add( healthIndicators ); - //always appears ontop of other health indicators - add( new TargetHealthIndicator() ); - add( cellSelector = new CellSelector( tiles ) ); pane = new StatusPane(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/CharSprite.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/CharSprite.java index d5058208c..dbca076a3 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/CharSprite.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/CharSprite.java @@ -489,6 +489,25 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip } } + public synchronized void showLost() { + if (emo instanceof EmoIcon.Lost) { + + } else { + if (emo != null) { + emo.killAndErase(); + } + emo = new EmoIcon.Lost( this ); + emo.visible = visible; + } + } + + public synchronized void hideLost() { + if (emo instanceof EmoIcon.Lost) { + emo.killAndErase(); + emo = null; + } + } + @Override public void kill() { super.kill(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Icons.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Icons.java index 228457ec7..fc15ca75a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Icons.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Icons.java @@ -45,6 +45,7 @@ public enum Icons { DEPTH, SLEEP, ALERT, + LOST, BACKPACK, SEED_POUCH, SCROLL_HOLDER, @@ -112,7 +113,7 @@ public enum Icons { icon.frame( icon.texture.uvRect( 0, 45, 13, 58 ) ); break; case DEPTH: - icon.frame( icon.texture.uvRect( 34, 46, 50, 62 ) ); + icon.frame( icon.texture.uvRect( 38, 46, 54, 62 ) ); break; case SLEEP: icon.frame( icon.texture.uvRect( 13, 45, 22, 53 ) ); @@ -120,6 +121,9 @@ public enum Icons { case ALERT: icon.frame( icon.texture.uvRect( 22, 45, 30, 53 ) ); break; + case LOST: + icon.frame( icon.texture.uvRect( 30, 45, 38, 53 ) ); + break; case BACKPACK: icon.frame( icon.texture.uvRect( 58, 0, 68, 10 ) ); break; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoMob.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoMob.java index 5aa5c1d90..abfe693a0 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoMob.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoMob.java @@ -34,19 +34,10 @@ public class WndInfoMob extends WndTitledMessage { public WndInfoMob( Mob mob ) { - super( new MobTitle( mob ), desc( mob ) ); + super( new MobTitle( mob ), mob.description() ); } - private static String desc( Mob mob ) { - - StringBuilder builder = new StringBuilder( mob.description() ); - - builder.append( "\n\n" + mob.state.status() ); - - return builder.toString(); - } - private static class MobTitle extends Component { private static final int GAP = 2; diff --git a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/actors/actors.properties b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/actors/actors.properties index 31a9d15f4..a9eb44a23 100644 --- a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/actors/actors.properties +++ b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/actors/actors.properties @@ -456,11 +456,6 @@ actors.mobs.mob.died=You hear something die in the distance. actors.mobs.mob.rage=#$%^ actors.mobs.mob.exp=%+dEXP actors.mobs.mob.rankings_desc=Slain by: %s -actors.mobs.mob$sleeping.status=This %s is sleeping. -actors.mobs.mob$wandering.status=This %s is wandering. -actors.mobs.mob$hunting.status=This %s is hunting. -actors.mobs.mob$fleeing.status=This %s is fleeing. -actors.mobs.mob$passive.status=This %s is passive. actors.mobs.monk.name=dwarf monk actors.mobs.monk.disarm=The monk knocks the %s from your hands!