v0.2.3: refactored logic to distinguish between a Hero's class name, and given name.

Note that given name is only going to be set by donation features, which are not in the open source, but the refactor is generally beneficial so I'm putting it in anyway.
This commit is contained in:
Evan Debenham 2014-12-19 16:31:10 -05:00
parent b62090ae33
commit 353dc49fa4
5 changed files with 10 additions and 6 deletions

View File

@ -242,6 +242,10 @@ public class Hero extends Char {
return subClass == null || subClass == HeroSubClass.NONE ? heroClass.title() : subClass.title();
}
public String givenName(){
return name.equals("you") ? className() : name;
}
public void live() {
Buff.affect( this, Regeneration.class );
Buff.affect( this, Hunger.class );

View File

@ -78,7 +78,7 @@ public class Imp extends NPC {
if (!Quest.given && Dungeon.visible[pos]) {
if (!seenBefore) {
yell( Utils.format( TXT_HEY, Dungeon.hero.className() ) );
yell( Utils.format( TXT_HEY, Dungeon.hero.givenName() ) );
}
seenBefore = true;
} else {
@ -123,7 +123,7 @@ public class Imp extends NPC {
if (tokens != null && (tokens.quantity() >= 8 || (!Quest.alternative && tokens.quantity() >= 6))) {
GameScene.show( new WndImp( this, tokens ) );
} else {
tell( Quest.alternative ? TXT_MONKS2 : TXT_GOLEMS2, Dungeon.hero.className() );
tell( Quest.alternative ? TXT_MONKS2 : TXT_GOLEMS2, Dungeon.hero.givenName() );
}
} else {
@ -142,7 +142,7 @@ public class Imp extends NPC {
public void flee() {
yell( Utils.format( TXT_CYA, Dungeon.hero.className() ) );
yell( Utils.format( TXT_CYA, Dungeon.hero.givenName() ) );
destroy();
sprite.die();

View File

@ -129,7 +129,7 @@ public class Wandmaker extends NPC {
if (item != null) {
GameScene.show( new WndWandmaker( this, item ) );
} else {
tell( Quest.alternative ? TXT_DUST2 : TXT_BERRY2, Dungeon.hero.className() );
tell( Quest.alternative ? TXT_DUST2 : TXT_BERRY2, Dungeon.hero.givenName() );
}
} else {

View File

@ -98,7 +98,7 @@ public class DriedRose extends Artifact {
hero.sprite.operate(hero.pos);
if (!firstSummon) {
ghost.yell(ghost.VOICE_HELLO + Dungeon.hero.className());
ghost.yell(ghost.VOICE_HELLO + Dungeon.hero.givenName());
Sample.INSTANCE.play( Assets.SND_GHOST );
firstSummon = true;
} else

View File

@ -94,7 +94,7 @@ public class WndWandmaker extends Window {
Dungeon.level.drop( reward, wandmaker.pos ).sprite.drop();
}
wandmaker.yell( Utils.format( TXT_FARAWELL, Dungeon.hero.className() ) );
wandmaker.yell( Utils.format( TXT_FARAWELL, Dungeon.hero.givenName() ) );
wandmaker.destroy();
wandmaker.sprite.die();