v0.2.3: lots of dried rose implementation + tiny tweaks to hourglass

This commit is contained in:
Evan Debenham 2014-12-12 02:25:54 -05:00
parent 7212451d57
commit 1ed89667ea
3 changed files with 111 additions and 53 deletions

View File

@ -606,7 +606,9 @@ public class Hero extends Char {
Item item = heap.pickUp(); Item item = heap.pickUp();
if (item.doPickUp( this )) { if (item.doPickUp( this )) {
if (item instanceof Dewdrop || item instanceof TimekeepersHourglass.sandBag) { if (item instanceof Dewdrop
|| item instanceof TimekeepersHourglass.sandBag
|| item instanceof DriedRose.Petal) {
} else { } else {

View File

@ -18,7 +18,9 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.GhostSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.sprites.WraithSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.WraithSprite;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndQuest;
import com.watabou.noosa.audio.Sample; import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Bundle;
import com.watabou.utils.Random; import com.watabou.utils.Random;
import java.util.ArrayList; import java.util.ArrayList;
@ -42,8 +44,9 @@ public class DriedRose extends Artifact {
defaultAction = AC_SUMMON; defaultAction = AC_SUMMON;
} }
protected boolean talkedTo = false; protected static boolean talkedTo = false;
protected boolean firstSummon = false; protected static boolean firstSummon = false;
protected static boolean spawned = false;
public int droppedPetals = 0; public int droppedPetals = 0;
@ -61,8 +64,9 @@ public class DriedRose extends Artifact {
public void execute( Hero hero, String action ) { public void execute( Hero hero, String action ) {
if (action.equals(AC_SUMMON)) { if (action.equals(AC_SUMMON)) {
if (!isEquipped( hero )) GLog.i("You need to equip your rose to do that."); if (spawned) GLog.n("sad ghost: I'm already here");
else if (charge != chargeCap) GLog.i("Your rose isn't fully charged yet."); else if (!isEquipped( hero )) GLog.i("You need to equip your rose to do that.");
else if (charge != chargeCap) GLog.i("Your rose isn't fully charged yet.");
else { else {
ArrayList<Integer> spawnPoints = new ArrayList<Integer>(); ArrayList<Integer> spawnPoints = new ArrayList<Integer>();
for (int i = 0; i < Level.NEIGHBOURS8.length; i++) { for (int i = 0; i < Level.NEIGHBOURS8.length; i++) {
@ -76,7 +80,6 @@ public class DriedRose extends Artifact {
GhostHero ghost = new GhostHero(); GhostHero ghost = new GhostHero();
ghost.pos = Random.element(spawnPoints); ghost.pos = Random.element(spawnPoints);
GameScene.add(ghost, 1f); GameScene.add(ghost, 1f);
CellEmitter.get(ghost.pos).start( ShaftParticle.FACTORY, 0.3f, 4 ); CellEmitter.get(ghost.pos).start( ShaftParticle.FACTORY, 0.3f, 4 );
CellEmitter.get(ghost.pos).start( Speck.factory(Speck.LIGHT), 0.2f, 3 ); CellEmitter.get(ghost.pos).start( Speck.factory(Speck.LIGHT), 0.2f, 3 );
@ -85,7 +88,9 @@ public class DriedRose extends Artifact {
hero.busy(); hero.busy();
hero.sprite.operate(hero.pos); hero.sprite.operate(hero.pos);
} spawned = true;
} else
GLog.i("There is no free space near you.");
} }
} else{ } else{
@ -93,13 +98,47 @@ public class DriedRose extends Artifact {
} }
} }
@Override
public String desc() {
return "";
}
@Override @Override
protected ArtifactBuff passiveBuff() { protected ArtifactBuff passiveBuff() {
return new roseRecharge(); return new roseRecharge();
} }
private static final String TALKEDTO = "talkedto";
private static final String FIRSTSUMMON = "firstsummon";
private static final String SPAWNED = "spawned";
@Override
public void storeInBundle( Bundle bundle ) {
super.storeInBundle(bundle);
bundle.put( TALKEDTO, talkedTo );
bundle.put( FIRSTSUMMON, firstSummon );
bundle.put( SPAWNED, spawned );
}
@Override
public void restoreFromBundle( Bundle bundle ) {
super.restoreFromBundle(bundle);
talkedTo = bundle.getBoolean( TALKEDTO );
firstSummon = bundle.getBoolean( FIRSTSUMMON );
spawned = bundle.getBoolean( SPAWNED );
}
public class roseRecharge extends ArtifactBuff { public class roseRecharge extends ArtifactBuff {
@Override
public boolean act() {
return super.act();
//TODO: decide on charging logic, put here.
}
} }
public static class Petal extends Item { public static class Petal extends Item {
@ -114,9 +153,8 @@ public class DriedRose extends Artifact {
public boolean doPickUp( Hero hero ) { public boolean doPickUp( Hero hero ) {
DriedRose rose = hero.belongings.getItem( DriedRose.class ); DriedRose rose = hero.belongings.getItem( DriedRose.class );
if (rose != null && rose.level < rose.levelCap){ if (rose != null && rose.level < rose.levelCap){
rose.upgrade(); rose.upgrade();
if (rose.level == rose.levelCap) { if (rose.level == rose.levelCap) {
GLog.p("The rose is completed!"); GLog.p("The rose is completed!");
@ -124,11 +162,16 @@ public class DriedRose extends Artifact {
GLog.n("sad ghost: Thank you..."); GLog.n("sad ghost: Thank you...");
} else } else
GLog.i("You add the petal to the rose."); GLog.i("You add the petal to the rose.");
Sample.INSTANCE.play( Assets.SND_DEWDROP );
hero.spendAndNext(TIME_TO_PICK_UP); hero.spendAndNext(TIME_TO_PICK_UP);
return true; return true;
} else { } else {
GLog.w("You have no rose to add this petal to."); GLog.w("You have no rose to add this petal to.");
return false; return false;
} }
} }
@ -158,10 +201,13 @@ public class DriedRose extends Artifact {
} }
private static final String TXT_WELCOME = "My spirit is bound to this rose, it was very precious to me, a gift " + GhostHero() {
"from my love whom I left on the surface.\n\nI cannot return to him, but thanks to you I have a second " + super();
"chance to complete my journey. When I am able I will respond to your call and fight with you.\n\n" + if (!DriedRose.firstSummon){
"hopefully you may succeed where I failed..."; yell ( VOICE_HELLO );
DriedRose.firstSummon = true;
}
}
@Override @Override
public String defenseVerb() { public String defenseVerb() {
@ -200,10 +246,10 @@ public class DriedRose extends Artifact {
@Override @Override
public void interact() { public void interact() {
//if (!talkedTo){ if (!DriedRose.talkedTo){
// talkedTo = true; DriedRose.talkedTo = true;
// GameScene.show(new WndQuest(this, TXT_WELCOME)); GameScene.show(new WndQuest(this, VOICE_INTRODUCE ));
//} else { } else {
int curPos = pos; int curPos = pos;
moveSprite( pos, Dungeon.hero.pos ); moveSprite( pos, Dungeon.hero.pos );
@ -214,28 +260,37 @@ 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();
//} }
} }
}
//************************************************************************************ @Override
//This is a bunch strings & string arrays, used in all of the sad ghost's voice lines. public void destroy() {
//************************************************************************************ DriedRose.spawned = false;
super.destroy();
}
//************************************************************************************
//This is a bunch strings & string arrays, used in all of the sad ghost's voice lines.
//************************************************************************************
//public static final String GHOST_HELLO = "Hello again " + Dungeon.hero.className() + "."; public static final String VOICE_HELLO = "Hello again.";
//enum, for clarity. private static final String VOICE_INTRODUCE = "My spirit is bound to this rose, it was very precious to me, a "+
public static enum DEPTHS{ "gift from my love whom I left on the surface.\n\nI cannot return to him, but thanks to you I have a " +
SEWERS, "second chance to complete my journey. When I am able I will respond to your call and fight with you.\n\n" +
PRISON, "hopefully you may succeed where I failed...";
CAVES,
CITY,
HALLS,
AMULET
}
//1st index - depth type, 2nd index - specific line. //enum, for clarity.
public static final String[][] GHOST_VOICE_AMBIENT = { public static enum DEPTHS{
SEWERS,
PRISON,
CAVES,
CITY,
HALLS,
AMULET
}
//1st index - depth type, 2nd index - specific line.
public static final String[][] VOICE_AMBIENT = {
{ {
"These sewers were once safe, some even lived here in the winter...", "These sewers were once safe, some even lived here in the winter...",
"I wonder what happened to the guard patrols, did they give up?...", "I wonder what happened to the guard patrols, did they give up?...",
@ -259,10 +314,10 @@ public class DriedRose extends Artifact {
},{ },{
"... I don't like this place... We should leave as soon as possible..." "... I don't like this place... We should leave as soon as possible..."
} }
}; };
//1st index - depth type, 2nd index - boss or not, 3rd index - specific line. //1st index - depth type, 2nd index - boss or not, 3rd index - specific line.
public static final String[][][] GHOST_VOICE_ENEMIES = { public static final String[][][] VOICE_ENEMIES = {
{ {
{ {
"Let's make the sewers safe again...", "Let's make the sewers safe again...",
@ -320,10 +375,10 @@ public class DriedRose extends Artifact {
"Hello source viewer, I'm writing this here as this line should never trigger. Have a nice day!" "Hello source viewer, I'm writing this here as this line should never trigger. Have a nice day!"
} }
} }
}; };
//1st index - Yog or not, 2nd index - specific line. //1st index - Yog or not, 2nd index - specific line.
public static final String[][] GHOST_VOICE_BOSSBEATEN = { public static final String[][] VOICE_BOSSBEATEN = {
{ {
"Yes!", "Yes!",
"Victory!" "Victory!"
@ -331,10 +386,10 @@ public class DriedRose extends Artifact {
"It's over... we won...", "It's over... we won...",
"I can't believe it... We just killed a god..." "I can't believe it... We just killed a god..."
} }
}; };
//1st index - boss or not, 2nd index - specific line. //1st index - boss or not, 2nd index - specific line.
public static final String[][] GHOST_VOICE_DEFEATED = { public static final String[][] VOICE_DEFEATED = {
{ {
"Good luck...", "Good luck...",
"I will return...", "I will return...",
@ -344,17 +399,18 @@ public class DriedRose extends Artifact {
"I'm sorry.. good luck..", "I'm sorry.. good luck..",
"Finish it off... without me..." "Finish it off... without me..."
} }
}; };
public static final String[] GHOST_VOICE_HEROKILLED = { public static final String[] VOICE_HEROKILLED = {
", nooo...", "nooo...",
"no...", "no...",
"I couldn't help them..." "I couldn't help them..."
}; };
public static final String[] GHOST_VOICE_BLESSEDANKH = { public static final String[] VOICE_BLESSEDANKH = {
"Incredible!...", "Incredible!...",
"Wish I had one of those...", "Wish I had one of those...",
"How did you survive that?..." "How did you survive that?..."
}; };
}
} }

View File

@ -61,9 +61,9 @@ public class TimekeepersHourglass extends Artifact {
public void execute( Hero hero, String action ) { public void execute( Hero hero, String action ) {
if (action.equals(AC_ACTIVATE)){ if (action.equals(AC_ACTIVATE)){
if (!isEquipped( hero )) GLog.i("You need to equip your hourglass to do that."); if (!isEquipped( hero )) GLog.i("You need to equip your hourglass to do that.");
else if (activeBuff != null) GLog.i("Your hourglass is already in use."); else if (activeBuff != null) GLog.i("Your hourglass is already in use.");
else if (charge <= 1) GLog.i("Your hourglass hasn't recharged enough to be usable yet."); else if (charge <= 1) GLog.i("Your hourglass hasn't recharged enough to be usable yet.");
else GameScene.show( else GameScene.show(
new WndOptions(TXT_HGLASS, TXT_DESC, TXT_STASIS, TXT_FREEZE) { new WndOptions(TXT_HGLASS, TXT_DESC, TXT_STASIS, TXT_FREEZE) {
@Override @Override
@ -325,7 +325,7 @@ public class TimekeepersHourglass extends Artifact {
TimekeepersHourglass hourglass = hero.belongings.getItem( TimekeepersHourglass.class ); TimekeepersHourglass hourglass = hero.belongings.getItem( TimekeepersHourglass.class );
if (hourglass != null) { if (hourglass != null) {
hourglass.upgrade(); hourglass.upgrade();
Sample.INSTANCE.play( Assets.SND_ITEM ); Sample.INSTANCE.play( Assets.SND_DEWDROP );
if (hourglass.level == hourglass.levelCap) if (hourglass.level == hourglass.levelCap)
GLog.p("Your hourglass is filled with magical sand!"); GLog.p("Your hourglass is filled with magical sand!");
else else