v0.9.2: implemented the shielding dew talent

This commit is contained in:
Evan Debenham 2021-02-10 23:55:29 -05:00
parent e92b42d5fb
commit bad49ee880
5 changed files with 69 additions and 36 deletions

View File

@ -433,6 +433,8 @@ actors.hero.talent.durable_tips.title=durable tips
actors.hero.talent.durable_tips.desc=_+1:_ Tipped darts have _2x durability_ when the Warden uses them.\n\n_+2:_ Tipped darts have _3x durability_ when the Warden uses them.\n\n_+3:_ Tipped darts have _4x durability_ when the Warden uses them. actors.hero.talent.durable_tips.desc=_+1:_ Tipped darts have _2x durability_ when the Warden uses them.\n\n_+2:_ Tipped darts have _3x durability_ when the Warden uses them.\n\n_+3:_ Tipped darts have _4x durability_ when the Warden uses them.
actors.hero.talent.barkskin.title=barkskin actors.hero.talent.barkskin.title=barkskin
actors.hero.talent.barkskin.desc=_+1:_ When stepping in grass, the Warden gains barkskin equivalent to her level for _1 turn_.\n\n_+2:_ When stepping in grass, the Warden gains barkskin equivalent to her level for _2 turns_.\n\n_+3:_ When stepping in grass, the Warden gains barkskin equivalent to her level for _3 turns_. actors.hero.talent.barkskin.desc=_+1:_ When stepping in grass, the Warden gains barkskin equivalent to her level for _1 turn_.\n\n_+2:_ When stepping in grass, the Warden gains barkskin equivalent to her level for _2 turns_.\n\n_+3:_ When stepping in grass, the Warden gains barkskin equivalent to her level for _3 turns_.
actors.hero.talent.shielding_dew.title=shielding dew
actors.hero.talent.shielding_dew.desc=_+1:_ Dewdrops can shield the Warden for up to _20% of her max HP_.\n\n_+2:_ Dewdrops can shield the Warden for up to _40% of her max HP_.\n\n_+3:_ Dewdrops can shield the Warden for up to _60% of her max HP_.
actors.hero.hero.name=you actors.hero.hero.name=you
actors.hero.hero.leave=You can't leave yet, the rest of the dungeon awaits below! actors.hero.hero.leave=You can't leave yet, the rest of the dungeon awaits below!

View File

@ -1636,13 +1636,14 @@ items.brokenseal.choose_title=Choose a Glyph
items.brokenseal.choose_desc=Both this armor and the broken seal are carrying a glyph. Pick which glyph should be kept.\n\nNote that if you pick the glyph that is currently on the armor, the seal will not be able to transfer it later. items.brokenseal.choose_desc=Both this armor and the broken seal are carrying a glyph. Pick which glyph should be kept.\n\nNote that if you pick the glyph that is currently on the armor, the seal will not be able to transfer it later.
items.dewdrop.name=dewdrop items.dewdrop.name=dewdrop
items.dewdrop.value=%+dHP items.dewdrop.heal=%+dHP
items.dewdrop.shield=%+dSHLD
items.dewdrop.both=%1$+dHP, %2$+dSHLD
items.dewdrop.already_full=You already have full health. items.dewdrop.already_full=You already have full health.
items.dewdrop.desc=A crystal clear dewdrop.\n\nDue to the magic of this place, pure water has minor restorative properties. items.dewdrop.desc=A crystal clear dewdrop.\n\nDue to the magic of this place, pure water has minor restorative properties.
items.dewvial.name=dew vial items.dewvial.name=dew vial
items.dewvial.ac_drink=DRINK items.dewvial.ac_drink=DRINK
items.dewvial.value=%+dHP
items.dewvial.collected=You collect the dewdrop into your dew vial. items.dewvial.collected=You collect the dewdrop into your dew vial.
items.dewvial.full=Your dew vial is full! items.dewvial.full=Your dew vial is full!
items.dewvial.empty=Your dew vial is empty! items.dewvial.empty=Your dew vial is empty!

View File

@ -108,7 +108,7 @@ public enum Talent {
//Sniper T3 //Sniper T3
FARSIGHT(107, 3), SHARED_ENCHANTMENT(108, 3), SNIPER_T3_3(109, 3), FARSIGHT(107, 3), SHARED_ENCHANTMENT(108, 3), SNIPER_T3_3(109, 3),
//Warden T3 //Warden T3
DURABLE_TIPS(110, 3), BARKSKIN(111, 3), WARDEN_T3_3(112, 3); DURABLE_TIPS(110, 3), BARKSKIN(111, 3), SHIELDING_DEW(112, 3);
public static class ImprovisedProjectileCooldown extends FlavourBuff{}; public static class ImprovisedProjectileCooldown extends FlavourBuff{};
public static class LethalMomentumTracker extends FlavourBuff{}; public static class LethalMomentumTracker extends FlavourBuff{};
@ -479,7 +479,7 @@ public enum Talent {
Collections.addAll(tierTalents, FARSIGHT, SHARED_ENCHANTMENT, SNIPER_T3_3); Collections.addAll(tierTalents, FARSIGHT, SHARED_ENCHANTMENT, SNIPER_T3_3);
break; break;
case WARDEN: case WARDEN:
Collections.addAll(tierTalents, DURABLE_TIPS, BARKSKIN, WARDEN_T3_3); Collections.addAll(tierTalents, DURABLE_TIPS, BARKSKIN, SHIELDING_DEW);
break; break;
} }
for (Talent talent : tierTalents){ for (Talent talent : tierTalents){

View File

@ -22,10 +22,10 @@
package com.shatteredpixel.shatteredpixeldungeon.items; package com.shatteredpixel.shatteredpixeldungeon.items;
import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Barrier;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample; import com.watabou.noosa.audio.Sample;
@ -88,30 +88,33 @@ public class DewVial extends Item {
float missingHealthPercent = 1f - (hero.HP / (float)hero.HT); float missingHealthPercent = 1f - (hero.HP / (float)hero.HT);
int curShield = 0;
if (hero.buff(Barrier.class) != null) curShield = hero.buff(Barrier.class).shielding();
int maxShield = Math.round(hero.HT *0.2f*hero.pointsInTalent(Talent.SHIELDING_DEW));
if (hero.hasTalent(Talent.SHIELDING_DEW)){
float missingShieldPercent = 1f - (curShield / (float)maxShield);
missingShieldPercent *= 0.2f*hero.pointsInTalent(Talent.SHIELDING_DEW);
if (missingShieldPercent > 0){
missingHealthPercent += missingShieldPercent;
}
}
//trimming off 0.01 drops helps with floating point errors //trimming off 0.01 drops helps with floating point errors
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);
//20 drops for a full heal normally if (Dewdrop.consumeDew(dropsNeeded, hero)){
int heal = Math.round( hero.HT * 0.05f * dropsNeeded ); volume -= dropsNeeded;
int effect = Math.min( hero.HT - hero.HP, heal ); hero.spend(TIME_TO_DRINK);
if (effect > 0) { hero.busy();
hero.HP += effect;
hero.sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 + dropsNeeded/5 ); Sample.INSTANCE.play(Assets.Sounds.DRINK);
hero.sprite.showStatus( CharSprite.POSITIVE, Messages.get(this, "value", effect) ); hero.sprite.operate(hero.pos);
updateQuickslot();
} }
volume -= dropsNeeded;
hero.spend( TIME_TO_DRINK );
hero.busy();
Sample.INSTANCE.play( Assets.Sounds.DRINK );
hero.sprite.operate( hero.pos );
updateQuickslot();
} else { } else {
GLog.w( Messages.get(this, "empty") ); GLog.w( Messages.get(this, "empty") );

View File

@ -22,7 +22,10 @@
package com.shatteredpixel.shatteredpixeldungeon.items; package com.shatteredpixel.shatteredpixeldungeon.items;
import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Barrier;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
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.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
@ -50,16 +53,7 @@ public class Dewdrop extends Item {
} else { } else {
//20 drops for a full heal if (!consumeDew(1, hero)){
int heal = Math.round( hero.HT * 0.05f * quantity );
int effect = Math.min( hero.HT - hero.HP, heal );
if (effect > 0) {
hero.HP += effect;
hero.sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 );
hero.sprite.showStatus( CharSprite.POSITIVE, Messages.get(this, "value", effect) );
} else {
GLog.i( Messages.get(this, "already_full") );
return false; return false;
} }
@ -71,6 +65,39 @@ public class Dewdrop extends Item {
return true; return true;
} }
public static boolean consumeDew(int quantity, Hero hero){
//20 drops for a full heal
int heal = Math.round( hero.HT * 0.05f * quantity );
int effect = Math.min( hero.HT - hero.HP, heal );
int shield = 0;
if (hero.hasTalent(Talent.SHIELDING_DEW)){
shield = heal - effect;
int maxShield = Math.round(hero.HT *0.2f*hero.pointsInTalent(Talent.SHIELDING_DEW));
int curShield = 0;
if (hero.buff(Barrier.class) != null) curShield = hero.buff(Barrier.class).shielding();
shield = Math.min(shield, maxShield-curShield);
}
if (effect > 0 || shield > 0) {
hero.HP += effect;
if (shield > 0) Buff.affect(hero, Barrier.class).incShield(shield);
hero.sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 );
if (effect > 0 && shield > 0){
hero.sprite.showStatus( CharSprite.POSITIVE, Messages.get(Dewdrop.class, "both", effect, shield) );
} else if (effect > 0){
hero.sprite.showStatus( CharSprite.POSITIVE, Messages.get(Dewdrop.class, "heal", effect) );
} else {
hero.sprite.showStatus( CharSprite.POSITIVE, Messages.get(Dewdrop.class, "shield", shield) );
}
} else {
GLog.i( Messages.get(Dewdrop.class, "already_full") );
return false;
}
return true;
}
@Override @Override
//max of one dew in a stack //max of one dew in a stack
public Item quantity(int value) { public Item quantity(int value) {