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();
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 {

View File

@ -18,7 +18,9 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.GhostSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.sprites.WraithSprite;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndQuest;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Bundle;
import com.watabou.utils.Random;
import java.util.ArrayList;
@ -42,8 +44,9 @@ public class DriedRose extends Artifact {
defaultAction = AC_SUMMON;
}
protected boolean talkedTo = false;
protected boolean firstSummon = false;
protected static boolean talkedTo = false;
protected static boolean firstSummon = false;
protected static boolean spawned = false;
public int droppedPetals = 0;
@ -61,7 +64,8 @@ public class DriedRose extends Artifact {
public void execute( Hero hero, String action ) {
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 (!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 {
ArrayList<Integer> spawnPoints = new ArrayList<Integer>();
@ -76,7 +80,6 @@ public class DriedRose extends Artifact {
GhostHero ghost = new GhostHero();
ghost.pos = Random.element(spawnPoints);
GameScene.add(ghost, 1f);
CellEmitter.get(ghost.pos).start( ShaftParticle.FACTORY, 0.3f, 4 );
CellEmitter.get(ghost.pos).start( Speck.factory(Speck.LIGHT), 0.2f, 3 );
@ -85,7 +88,9 @@ public class DriedRose extends Artifact {
hero.busy();
hero.sprite.operate(hero.pos);
}
spawned = true;
} else
GLog.i("There is no free space near you.");
}
} else{
@ -93,13 +98,47 @@ public class DriedRose extends Artifact {
}
}
@Override
public String desc() {
return "";
}
@Override
protected ArtifactBuff passiveBuff() {
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 {
@Override
public boolean act() {
return super.act();
//TODO: decide on charging logic, put here.
}
}
public static class Petal extends Item {
@ -114,9 +153,8 @@ public class DriedRose extends Artifact {
public boolean doPickUp( Hero hero ) {
DriedRose rose = hero.belongings.getItem( DriedRose.class );
if (rose != null && rose.level < rose.levelCap){
rose.upgrade();
if (rose.level == rose.levelCap) {
GLog.p("The rose is completed!");
@ -124,11 +162,16 @@ public class DriedRose extends Artifact {
GLog.n("sad ghost: Thank you...");
} else
GLog.i("You add the petal to the rose.");
Sample.INSTANCE.play( Assets.SND_DEWDROP );
hero.spendAndNext(TIME_TO_PICK_UP);
return true;
} else {
GLog.w("You have no rose to add this petal to.");
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 " +
"from my love whom I left on the surface.\n\nI cannot return to him, but thanks to you I have a second " +
"chance to complete my journey. When I am able I will respond to your call and fight with you.\n\n" +
"hopefully you may succeed where I failed...";
GhostHero() {
super();
if (!DriedRose.firstSummon){
yell ( VOICE_HELLO );
DriedRose.firstSummon = true;
}
}
@Override
public String defenseVerb() {
@ -200,10 +246,10 @@ public class DriedRose extends Artifact {
@Override
public void interact() {
//if (!talkedTo){
// talkedTo = true;
// GameScene.show(new WndQuest(this, TXT_WELCOME));
//} else {
if (!DriedRose.talkedTo){
DriedRose.talkedTo = true;
GameScene.show(new WndQuest(this, VOICE_INTRODUCE ));
} else {
int curPos = pos;
moveSprite( pos, Dungeon.hero.pos );
@ -214,15 +260,24 @@ public class DriedRose extends Artifact {
Dungeon.hero.spend( 1 / Dungeon.hero.speed() );
Dungeon.hero.busy();
//}
}
}
@Override
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.";
private static final String VOICE_INTRODUCE = "My spirit is bound to this rose, it was very precious to me, a "+
"gift from my love whom I left on the surface.\n\nI cannot return to him, but thanks to you I have a " +
"second chance to complete my journey. When I am able I will respond to your call and fight with you.\n\n" +
"hopefully you may succeed where I failed...";
//enum, for clarity.
public static enum DEPTHS{
@ -235,7 +290,7 @@ public class DriedRose extends Artifact {
}
//1st index - depth type, 2nd index - specific line.
public static final String[][] GHOST_VOICE_AMBIENT = {
public static final String[][] VOICE_AMBIENT = {
{
"These sewers were once safe, some even lived here in the winter...",
"I wonder what happened to the guard patrols, did they give up?...",
@ -262,7 +317,7 @@ public class DriedRose extends Artifact {
};
//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...",
@ -323,7 +378,7 @@ public class DriedRose extends Artifact {
};
//1st index - Yog or not, 2nd index - specific line.
public static final String[][] GHOST_VOICE_BOSSBEATEN = {
public static final String[][] VOICE_BOSSBEATEN = {
{
"Yes!",
"Victory!"
@ -334,7 +389,7 @@ public class DriedRose extends Artifact {
};
//1st index - boss or not, 2nd index - specific line.
public static final String[][] GHOST_VOICE_DEFEATED = {
public static final String[][] VOICE_DEFEATED = {
{
"Good luck...",
"I will return...",
@ -346,15 +401,16 @@ public class DriedRose extends Artifact {
}
};
public static final String[] GHOST_VOICE_HEROKILLED = {
", nooo...",
public static final String[] VOICE_HEROKILLED = {
"nooo...",
"no...",
"I couldn't help them..."
};
public static final String[] GHOST_VOICE_BLESSEDANKH = {
public static final String[] VOICE_BLESSEDANKH = {
"Incredible!...",
"Wish I had one of those...",
"How did you survive that?..."
};
}
}

View File

@ -325,7 +325,7 @@ public class TimekeepersHourglass extends Artifact {
TimekeepersHourglass hourglass = hero.belongings.getItem( TimekeepersHourglass.class );
if (hourglass != null) {
hourglass.upgrade();
Sample.INSTANCE.play( Assets.SND_ITEM );
Sample.INSTANCE.play( Assets.SND_DEWDROP );
if (hourglass.level == hourglass.levelCap)
GLog.p("Your hourglass is filled with magical sand!");
else