V0.1.1: Ankh/dew vial changes
This commit is contained in:
parent
6a1f093d1e
commit
cf208422d8
|
@ -57,7 +57,6 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.Flare;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Amulet;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Amulet;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Ankh;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Ankh;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.DewVial;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Dewdrop;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Dewdrop;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Heap.Type;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Heap.Type;
|
||||||
|
@ -1097,16 +1096,22 @@ public class Hero extends Char {
|
||||||
|
|
||||||
curAction = null;
|
curAction = null;
|
||||||
|
|
||||||
DewVial.autoDrink( this );
|
Ankh ankh = (Ankh)belongings.getItem( Ankh.class );
|
||||||
if (isAlive()) {
|
if (ankh != null && ankh.isBlessed()) {
|
||||||
new Flare( 8, 32 ).color( 0xFFFF66, true ).show( sprite, 2f ) ;
|
this.HP = HT;
|
||||||
return;
|
new Flare(8, 32).color(0xFFFF66, true).show(sprite, 2f);
|
||||||
}
|
|
||||||
|
ankh.detach(belongings.backpack);
|
||||||
|
|
||||||
|
Sample.INSTANCE.play( Assets.SND_TELEPORT );
|
||||||
|
GLog.w( ankh.TXT_REVIVE );
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Actor.fixTime();
|
Actor.fixTime();
|
||||||
super.die( cause );
|
super.die( cause );
|
||||||
|
|
||||||
Ankh ankh = (Ankh)belongings.getItem( Ankh.class );
|
|
||||||
if (ankh == null) {
|
if (ankh == null) {
|
||||||
|
|
||||||
reallyDie( cause );
|
reallyDie( cause );
|
||||||
|
|
|
@ -17,16 +17,37 @@
|
||||||
*/
|
*/
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.items;
|
package com.shatteredpixel.shatteredpixeldungeon.items;
|
||||||
|
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite.Glowing;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||||
|
import com.watabou.noosa.audio.Sample;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class Ankh extends Item {
|
public class Ankh extends Item {
|
||||||
|
|
||||||
{
|
public static final String AC_BLESS = "BLESS";
|
||||||
|
|
||||||
|
public static final String TXT_DESC_NOBLESS = "Upon resurrection all non-equipped items are lost. " +
|
||||||
|
"Using a full dew vial, the ankh can be blessed with extra strength.";
|
||||||
|
public static final String TXT_DESC_BLESSED = "The ankh has been blessed and is now much stronger. " +
|
||||||
|
"The Ankh will sacrifice itself to save you in a moment of deadly peril.";
|
||||||
|
|
||||||
|
public static final String TXT_BLESS = "You bless the ankh with clean water.";
|
||||||
|
public static final String TXT_REVIVE = "The ankh explodes with life-giving energy!";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
stackable = true;
|
stackable = true;
|
||||||
name = "Ankh";
|
name = "Ankh";
|
||||||
image = ItemSpriteSheet.ANKH;
|
image = ItemSpriteSheet.ANKH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Boolean blessed = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isUpgradable() {
|
public boolean isUpgradable() {
|
||||||
return false;
|
return false;
|
||||||
|
@ -37,13 +58,61 @@ public class Ankh extends Item {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ArrayList<String> actions( Hero hero ) {
|
||||||
|
ArrayList<String> actions = super.actions(hero);
|
||||||
|
DewVial vial = hero.belongings.getItem(DewVial.class);
|
||||||
|
if (vial != null && vial.isFull())
|
||||||
|
actions.add( AC_BLESS );
|
||||||
|
return actions;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute( final Hero hero, String action ) {
|
||||||
|
if (action.equals( AC_BLESS )) {
|
||||||
|
|
||||||
|
DewVial vial = hero.belongings.getItem(DewVial.class);
|
||||||
|
if (vial != null){
|
||||||
|
blessed = true;
|
||||||
|
vial.empty();
|
||||||
|
GLog.p( TXT_BLESS );
|
||||||
|
hero.spend( 1f );
|
||||||
|
hero.busy();
|
||||||
|
|
||||||
|
Sample.INSTANCE.play( Assets.SND_DRINK );
|
||||||
|
hero.sprite.operate( hero.pos );
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
super.execute( hero, action );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String info() {
|
public String info() {
|
||||||
return
|
if (blessed)
|
||||||
"The ancient symbol of immortality grants an ability to return to life after death. " +
|
return
|
||||||
"Upon resurrection all non-equipped items are lost.";
|
"This ancient symbol of immortality grants the ability to return to life after death. " +
|
||||||
|
TXT_DESC_BLESSED;
|
||||||
|
else
|
||||||
|
return
|
||||||
|
"This ancient symbol of immortality grants the ability to return to life after death. " +
|
||||||
|
TXT_DESC_NOBLESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean isBlessed(){
|
||||||
|
return blessed;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Glowing WHITE = new Glowing( 0xFFFFCC );
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Glowing glowing() {
|
||||||
|
return isBlessed() ? WHITE : null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int price() {
|
public int price() {
|
||||||
return 50 * quantity;
|
return 50 * quantity;
|
||||||
|
|
|
@ -19,6 +19,9 @@ package com.shatteredpixel.shatteredpixeldungeon.items;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.ui.QuickSlot;
|
||||||
import com.watabou.noosa.audio.Sample;
|
import com.watabou.noosa.audio.Sample;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||||
|
@ -81,16 +84,18 @@ public class DewVial extends Item {
|
||||||
return actions;
|
return actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final double NUM = 20;
|
|
||||||
private static final double POW = Math.log10( NUM );
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute( final Hero hero, String action ) {
|
public void execute( final Hero hero, String action ) {
|
||||||
if (action.equals( AC_DRINK )) {
|
if (action.equals( AC_DRINK )) {
|
||||||
|
|
||||||
if (volume > 0) {
|
if (volume > 0) {
|
||||||
|
|
||||||
int value = (int)Math.ceil( Math.pow( volume, POW ) / NUM * hero.HT );
|
int value = 1 + (Dungeon.depth - 1) / 5;
|
||||||
|
if (hero.heroClass == HeroClass.HUNTRESS) {
|
||||||
|
value++;
|
||||||
|
}
|
||||||
|
value *= volume;
|
||||||
|
value = (int)Math.max(volume*volume*.01*hero.HT, value);
|
||||||
int effect = Math.min( hero.HT - hero.HP, value );
|
int effect = Math.min( hero.HT - hero.HP, value );
|
||||||
if (effect > 0) {
|
if (effect > 0) {
|
||||||
hero.HP += effect;
|
hero.HP += effect;
|
||||||
|
@ -98,7 +103,7 @@ public class DewVial extends Item {
|
||||||
hero.sprite.showStatus( CharSprite.POSITIVE, TXT_VALUE, effect );
|
hero.sprite.showStatus( CharSprite.POSITIVE, TXT_VALUE, effect );
|
||||||
}
|
}
|
||||||
|
|
||||||
volume = 0;
|
volume = 0;
|
||||||
|
|
||||||
hero.spend( TIME_TO_DRINK );
|
hero.spend( TIME_TO_DRINK );
|
||||||
hero.busy();
|
hero.busy();
|
||||||
|
@ -106,7 +111,8 @@ public class DewVial extends Item {
|
||||||
Sample.INSTANCE.play( Assets.SND_DRINK );
|
Sample.INSTANCE.play( Assets.SND_DRINK );
|
||||||
hero.sprite.operate( hero.pos );
|
hero.sprite.operate( hero.pos );
|
||||||
|
|
||||||
updateQuickslot();
|
QuickSlot.refresh();
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
GLog.w( TXT_EMPTY );
|
GLog.w( TXT_EMPTY );
|
||||||
|
@ -119,6 +125,8 @@ public class DewVial extends Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void empty() {volume = 0; QuickSlot.refresh();}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isUpgradable() {
|
public boolean isUpgradable() {
|
||||||
return false;
|
return false;
|
||||||
|
@ -142,22 +150,12 @@ public class DewVial extends Item {
|
||||||
GLog.p( TXT_FULL );
|
GLog.p( TXT_FULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
updateQuickslot();
|
QuickSlot.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fill() {
|
public void fill() {
|
||||||
volume = MAX_VOLUME;
|
volume = MAX_VOLUME;
|
||||||
updateQuickslot();
|
QuickSlot.refresh();
|
||||||
}
|
|
||||||
|
|
||||||
public static void autoDrink( Hero hero ) {
|
|
||||||
DewVial vial = hero.belongings.getItem( DewVial.class );
|
|
||||||
if (vial != null && vial.isFull()) {
|
|
||||||
vial.execute( hero );
|
|
||||||
hero.sprite.emitter().start( ShaftParticle.FACTORY, 0.2f, 3 );
|
|
||||||
|
|
||||||
GLog.w( TXT_AUTO_DRINK );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Glowing WHITE = new Glowing( 0xFFFFCC );
|
private static final Glowing WHITE = new Glowing( 0xFFFFCC );
|
||||||
|
@ -176,8 +174,8 @@ public class DewVial extends Item {
|
||||||
public String info() {
|
public String info() {
|
||||||
return
|
return
|
||||||
"You can store excess dew in this tiny vessel for drinking it later. " +
|
"You can store excess dew in this tiny vessel for drinking it later. " +
|
||||||
"If the vial is full, in a moment of deadly peril the dew will be " +
|
"The more full the vial is, the more each dew drop will heal you. " +
|
||||||
"consumed automatically.";
|
"A full vial is as strong as a potion of healing.";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue
Block a user