v0.9.3c: player can now collect dew on stairs even at full HP
This commit is contained in:
parent
9c7c0c8b90
commit
4df0062292
|
@ -22,11 +22,14 @@
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.items;
|
package com.shatteredpixel.shatteredpixeldungeon.items;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Barrier;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Barrier;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Terror;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
||||||
|
@ -55,7 +58,8 @@ public class Dewdrop extends Item {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (!consumeDew(1, hero)){
|
int terr = Dungeon.level.map[hero.pos];
|
||||||
|
if (!consumeDew(1, hero, terr == Terrain.ENTRANCE|| terr == Terrain.EXIT || terr == Terrain.UNLOCKED_EXIT)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +71,7 @@ public class Dewdrop extends Item {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean consumeDew(int quantity, Hero hero){
|
public static boolean consumeDew(int quantity, Hero hero, boolean force){
|
||||||
//20 drops for a full heal
|
//20 drops for a full heal
|
||||||
int heal = Math.round( hero.HT * 0.05f * quantity );
|
int heal = Math.round( hero.HT * 0.05f * quantity );
|
||||||
|
|
||||||
|
@ -92,7 +96,7 @@ public class Dewdrop extends Item {
|
||||||
hero.sprite.showStatus( CharSprite.POSITIVE, Messages.get(Dewdrop.class, "shield", shield) );
|
hero.sprite.showStatus( CharSprite.POSITIVE, Messages.get(Dewdrop.class, "shield", shield) );
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else if (!force) {
|
||||||
GLog.i( Messages.get(Dewdrop.class, "already_full") );
|
GLog.i( Messages.get(Dewdrop.class, "already_full") );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,7 +103,7 @@ public class Waterskin extends Item {
|
||||||
int dropsNeeded = (int)Math.ceil((missingHealthPercent / 0.05f) - 0.01f);
|
int dropsNeeded = (int)Math.ceil((missingHealthPercent / 0.05f) - 0.01f);
|
||||||
dropsNeeded = (int)GameMath.gate(1, dropsNeeded, volume);
|
dropsNeeded = (int)GameMath.gate(1, dropsNeeded, volume);
|
||||||
|
|
||||||
if (Dewdrop.consumeDew(dropsNeeded, hero)){
|
if (Dewdrop.consumeDew(dropsNeeded, hero, true)){
|
||||||
volume -= dropsNeeded;
|
volume -= dropsNeeded;
|
||||||
|
|
||||||
hero.spend(TIME_TO_DRINK);
|
hero.spend(TIME_TO_DRINK);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user