v0.6.2: improved emoicons and removed enemy state from descriptions

This commit is contained in:
Evan Debenham 2017-09-18 00:11:37 -04:00
parent 70a39f4229
commit bb5e798b98
8 changed files with 66 additions and 52 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -160,7 +160,11 @@ public abstract class Mob extends Char {
boolean justAlerted = alerted; boolean justAlerted = alerted;
alerted = false; alerted = false;
sprite.hideAlert(); if (justAlerted){
sprite.showAlert();
} else {
sprite.hideAlert();
}
if (paralysed > 0) { if (paralysed > 0) {
enemySeen = false; enemySeen = false;
@ -517,7 +521,9 @@ public abstract class Mob extends Char {
if (state == SLEEPING) { if (state == SLEEPING) {
state = WANDERING; state = WANDERING;
} }
alerted = true; if (state != HUNTING) {
alerted = true;
}
super.damage( dmg, src ); super.damage( dmg, src );
} }
@ -631,7 +637,6 @@ public abstract class Mob extends Char {
public interface AiState { public interface AiState {
boolean act( boolean enemyInFOV, boolean justAlerted ); boolean act( boolean enemyInFOV, boolean justAlerted );
String status();
} }
protected class Sleeping implements AiState { protected class Sleeping implements AiState {
@ -667,11 +672,6 @@ public abstract class Mob extends Char {
} }
return true; return true;
} }
@Override
public String status() {
return Messages.get(this, "status", name );
}
} }
protected class Wandering implements AiState { protected class Wandering implements AiState {
@ -685,12 +685,14 @@ public abstract class Mob extends Char {
enemySeen = true; enemySeen = true;
notice(); notice();
alerted = true;
state = HUNTING; state = HUNTING;
target = enemy.pos; target = enemy.pos;
} else { } else {
enemySeen = false; enemySeen = false;
sprite.hideLost();
int oldPos = pos; int oldPos = pos;
if (target != -1 && getCloser( target )) { if (target != -1 && getCloser( target )) {
@ -704,11 +706,6 @@ public abstract class Mob extends Char {
} }
return true; return true;
} }
@Override
public String status() {
return Messages.get(this, "status", name );
}
} }
protected class Hunting implements AiState { protected class Hunting implements AiState {
@ -737,17 +734,16 @@ public abstract class Mob extends Char {
} else { } else {
spend( TICK ); spend( TICK );
state = WANDERING;
target = Dungeon.level.randomDestination(); if (!enemyInFOV) {
sprite.showLost();
state = WANDERING;
target = Dungeon.level.randomDestination();
}
return true; return true;
} }
} }
} }
@Override
public String status() {
return Messages.get(this, "status", name );
}
} }
protected class Fleeing implements AiState { protected class Fleeing implements AiState {
@ -781,11 +777,6 @@ public abstract class Mob extends Char {
protected void nowhereToRun() { protected void nowhereToRun() {
} }
@Override
public String status() {
return Messages.get(this, "status", name );
}
} }
protected class Passive implements AiState { protected class Passive implements AiState {
@ -798,11 +789,6 @@ public abstract class Mob extends Char {
spend( TICK ); spend( TICK );
return true; return true;
} }
@Override
public String status() {
return Messages.get(this, "status", name );
}
} }
} }

View File

@ -103,5 +103,24 @@ public class EmoIcon extends Image {
y = owner.y - height; 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;
}
}
} }

View File

@ -228,8 +228,8 @@ public class GameScene extends PixelScene {
emitters = new Group(); emitters = new Group();
effects = new Group(); effects = new Group();
emoicons = new Group();
healthIndicators = new Group(); healthIndicators = new Group();
emoicons = new Group();
mobs = new Group(); mobs = new Group();
add( mobs ); add( mobs );
@ -274,7 +274,11 @@ public class GameScene extends PixelScene {
statuses = new Group(); statuses = new Group();
add( statuses ); add( statuses );
add( healthIndicators );
//always appears ontop of other health indicators
add( new TargetHealthIndicator() );
add( emoicons ); add( emoicons );
hero = new HeroSprite(); hero = new HeroSprite();
@ -282,10 +286,6 @@ public class GameScene extends PixelScene {
hero.updateArmor(); hero.updateArmor();
mobs.add( hero ); mobs.add( hero );
add( healthIndicators );
//always appears ontop of other health indicators
add( new TargetHealthIndicator() );
add( cellSelector = new CellSelector( tiles ) ); add( cellSelector = new CellSelector( tiles ) );
pane = new StatusPane(); pane = new StatusPane();

View File

@ -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 @Override
public void kill() { public void kill() {
super.kill(); super.kill();

View File

@ -45,6 +45,7 @@ public enum Icons {
DEPTH, DEPTH,
SLEEP, SLEEP,
ALERT, ALERT,
LOST,
BACKPACK, BACKPACK,
SEED_POUCH, SEED_POUCH,
SCROLL_HOLDER, SCROLL_HOLDER,
@ -112,7 +113,7 @@ public enum Icons {
icon.frame( icon.texture.uvRect( 0, 45, 13, 58 ) ); icon.frame( icon.texture.uvRect( 0, 45, 13, 58 ) );
break; break;
case DEPTH: case DEPTH:
icon.frame( icon.texture.uvRect( 34, 46, 50, 62 ) ); icon.frame( icon.texture.uvRect( 38, 46, 54, 62 ) );
break; break;
case SLEEP: case SLEEP:
icon.frame( icon.texture.uvRect( 13, 45, 22, 53 ) ); icon.frame( icon.texture.uvRect( 13, 45, 22, 53 ) );
@ -120,6 +121,9 @@ public enum Icons {
case ALERT: case ALERT:
icon.frame( icon.texture.uvRect( 22, 45, 30, 53 ) ); icon.frame( icon.texture.uvRect( 22, 45, 30, 53 ) );
break; break;
case LOST:
icon.frame( icon.texture.uvRect( 30, 45, 38, 53 ) );
break;
case BACKPACK: case BACKPACK:
icon.frame( icon.texture.uvRect( 58, 0, 68, 10 ) ); icon.frame( icon.texture.uvRect( 58, 0, 68, 10 ) );
break; break;

View File

@ -34,19 +34,10 @@ public class WndInfoMob extends WndTitledMessage {
public WndInfoMob( Mob mob ) { 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 class MobTitle extends Component {
private static final int GAP = 2; private static final int GAP = 2;

View File

@ -456,11 +456,6 @@ actors.mobs.mob.died=You hear something die in the distance.
actors.mobs.mob.rage=#$%^ actors.mobs.mob.rage=#$%^
actors.mobs.mob.exp=%+dEXP actors.mobs.mob.exp=%+dEXP
actors.mobs.mob.rankings_desc=Slain by: %s 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.name=dwarf monk
actors.mobs.monk.disarm=The monk knocks the %s from your hands! actors.mobs.monk.disarm=The monk knocks the %s from your hands!