v0.9.0: implemented a food-related talent for each class

This commit is contained in:
Evan Debenham 2020-09-11 13:52:15 -04:00
parent 24c4ae4185
commit 8f33bf5925
7 changed files with 70 additions and 55 deletions

View File

@ -296,34 +296,34 @@ actors.buffs.wellfed.desc=You feel quite satisfied and full.\n\nWhile well fed,
###hero ###hero
actors.hero.talent.test_warrior_1.title=hearty meal actors.hero.talent.hearty_meal.title=hearty meal
actors.hero.talent.test_warrior_1.desc=_+1:_ Eating at below 50% health heals the Warrior for _4 HP_.\n\n_+2:_ Eating at below 50% health heals the Warrior for _6 HP_. actors.hero.talent.hearty_meal.desc=_+1:_ Eating at below 50% health heals the Warrior for _4 HP_.\n\n_+2:_ Eating at below 50% health heals the Warrior for _6 HP_.
actors.hero.talent.test_warrior_2.title=armsmaster's intuition actors.hero.talent.test_warrior_2.title=armsmaster's intuition
actors.hero.talent.test_warrior_2.desc=_+1:_ The warrior identifies Weapons and Armor _3x faster_.\n\n_+2:_ The warrior identifies Weapons and Armor _when he equips them_. actors.hero.talent.test_warrior_2.desc=_+1:_ The Warrior identifies weapons and armor _2x faster_.\n\n_+2:_ The Warrior identifies weapons and armor _when he equips them_.
actors.hero.talent.test_warrior_3.title=test talent actors.hero.talent.test_warrior_3.title=test talent
actors.hero.talent.test_warrior_3.desc=_+1:_ Whenever he identifies a potion, the warrior heals for _3 HP_.\n\n_+2:_ Whenever he identifies a potion, the warrior heals for _5 HP_. actors.hero.talent.test_warrior_3.desc=_+1:_ Whenever he identifies a potion, the warrior heals for _3 HP_.\n\n_+2:_ Whenever he identifies a potion, the warrior heals for _5 HP_.
actors.hero.talent.test_warrior_4.title=iron will actors.hero.talent.test_warrior_4.title=iron will
actors.hero.talent.test_warrior_4.desc=_+1:_ The max shield provided by the warrior's seal is _increased by 1_.\n\n_+2:_ The max shield provided by the warrior's seal is _increased by 2_. actors.hero.talent.test_warrior_4.desc=_+1:_ The max shield provided by the warrior's seal is _increased by 1_.\n\n_+2:_ The max shield provided by the warrior's seal is _increased by 2_.
actors.hero.talent.test_mage_1.title=test talent actors.hero.talent.energizing_meal.title=energizing meal
actors.hero.talent.test_mage_1.desc=TODO actors.hero.talent.energizing_meal.desc=_+1:_ Eating at below 50% health grants the Mage _4 turns of wand recharging_.\n\n_+2:_ Eating at below 50% health grants the Mage _6 turns of wand recharging_.
actors.hero.talent.test_mage_2.title=test talent actors.hero.talent.test_mage_2.title=scholar's intuition
actors.hero.talent.test_mage_2.desc=TODO actors.hero.talent.test_mage_2.desc=_+1:_ The Mage identifies wands _2x faster_.\n\n_+2:_ The Mage identifies wands _when he uses them_.
actors.hero.talent.test_mage_3.title=test talent actors.hero.talent.test_mage_3.title=test talent
actors.hero.talent.test_mage_3.desc=TODO actors.hero.talent.test_mage_3.desc=TODO
actors.hero.talent.test_mage_4.title=test talent actors.hero.talent.test_mage_4.title=test talent
actors.hero.talent.test_mage_4.desc=TODO actors.hero.talent.test_mage_4.desc=TODO
actors.hero.talent.test_rogue_1.title=test talent actors.hero.talent.rationed_meal.title=rationed meal
actors.hero.talent.test_rogue_1.desc=TODO actors.hero.talent.rationed_meal.desc=_+1:_ Eating at below 50% health gives the Rogue _20% more satiety_.\n\n_+2:_ Eating at below 50% health gives the Rogue _30% more satiety_.
actors.hero.talent.test_rogue_2.title=test talent actors.hero.talent.test_rogue_2.title=thief's intuition
actors.hero.talent.test_rogue_2.desc=TODO actors.hero.talent.test_rogue_2.desc=_+1:_ The Rogue identifies the type of a ring _when he equips it_.\n\n_+2:_ The Rogue identifies the type of a ring _when he examines it_.
actors.hero.talent.test_rogue_3.title=test talent actors.hero.talent.test_rogue_3.title=test talent
actors.hero.talent.test_rogue_3.desc=TODO actors.hero.talent.test_rogue_3.desc=TODO
actors.hero.talent.test_rogue_4.title=test talent actors.hero.talent.test_rogue_4.title=test talent
actors.hero.talent.test_rogue_4.desc=TODO actors.hero.talent.test_rogue_4.desc=TODO
actors.hero.talent.test_huntress_1.title=test talent actors.hero.talent.invigorating_meal.title=invigorating meal
actors.hero.talent.test_huntress_1.desc=TODO actors.hero.talent.invigorating_meal.desc=_+1:_ Eating at below 50% health takes 1 turn and grants the Huntress _2 turns of haste_.\n\n_+2:_ Eating at below 50% health takes 1 turn and grants the Huntress _3 turns of haste_.
actors.hero.talent.test_huntress_2.title=test talent actors.hero.talent.test_huntress_2.title=survivalist's intuition
actors.hero.talent.test_huntress_2.desc=TODO actors.hero.talent.test_huntress_2.desc=_+1:_ The Huntress identifies all equipment _1.5x faster_.\n\n_+2:_ The Huntress identifies all equipment _2x faster_.
actors.hero.talent.test_huntress_3.title=test talent actors.hero.talent.test_huntress_3.title=test talent
actors.hero.talent.test_huntress_3.desc=TODO actors.hero.talent.test_huntress_3.desc=TODO
actors.hero.talent.test_huntress_4.title=test talent actors.hero.talent.test_huntress_4.title=test talent

View File

@ -118,14 +118,17 @@ public class Hunger extends Buff implements Hero.Doom {
GLog.n( Messages.get(this, "cursedhorn") ); GLog.n( Messages.get(this, "cursedhorn") );
} }
reduceHunger( energy ); affectHunger( energy, false );
} }
//directly interacts with hunger, no checks. public void affectHunger(float energy ){
public void reduceHunger( float energy ) { affectHunger( energy, false );
}
public void affectHunger(float energy, boolean overrideLimits ) {
level -= energy; level -= energy;
if (level < 0) { if (level < 0 && !overrideLimits) {
level = 0; level = 0;
} else if (level > STARVING) { } else if (level > STARVING) {
float excess = level - STARVING; float excess = level - STARVING;

View File

@ -1866,9 +1866,9 @@ public class Hero extends Char {
if (!Dungeon.level.locked) { if (!Dungeon.level.locked) {
if (cursed) { if (cursed) {
GLog.n(Messages.get(this, "search_distracted")); GLog.n(Messages.get(this, "search_distracted"));
Buff.affect(this, Hunger.class).reduceHunger(TIME_TO_SEARCH - (2 * HUNGER_FOR_SEARCH)); Buff.affect(this, Hunger.class).affectHunger(TIME_TO_SEARCH - (2 * HUNGER_FOR_SEARCH));
} else { } else {
Buff.affect(this, Hunger.class).reduceHunger(TIME_TO_SEARCH - HUNGER_FOR_SEARCH); Buff.affect(this, Hunger.class).affectHunger(TIME_TO_SEARCH - HUNGER_FOR_SEARCH);
} }
} }
spendAndNext(TIME_TO_SEARCH); spendAndNext(TIME_TO_SEARCH);

View File

@ -21,6 +21,12 @@
package com.shatteredpixel.shatteredpixeldungeon.actors.hero; package com.shatteredpixel.shatteredpixeldungeon.actors.hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Haste;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Recharging;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.watabou.utils.Bundle; import com.watabou.utils.Bundle;
@ -30,22 +36,22 @@ import java.util.LinkedHashMap;
public enum Talent { public enum Talent {
TEST_WARRIOR_1(0), HEARTY_MEAL(0),
TEST_WARRIOR_2(1), TEST_WARRIOR_2(1),
TEST_WARRIOR_3(2), TEST_WARRIOR_3(2),
TEST_WARRIOR_4(3), TEST_WARRIOR_4(3),
TEST_MAGE_1(16), ENERGIZING_MEAL(16),
TEST_MAGE_2(17), TEST_MAGE_2(17),
TEST_MAGE_3(18), TEST_MAGE_3(18),
TEST_MAGE_4(19), TEST_MAGE_4(19),
TEST_ROGUE_1(32), RATIONED_MEAL(32),
TEST_ROGUE_2(33), TEST_ROGUE_2(33),
TEST_ROGUE_3(34), TEST_ROGUE_3(34),
TEST_ROGUE_4(35), TEST_ROGUE_4(35),
TEST_HUNTRESS_1(48), INVIGORATING_MEAL(48),
TEST_HUNTRESS_2(49), TEST_HUNTRESS_2(49),
TEST_HUNTRESS_3(50), TEST_HUNTRESS_3(50),
TEST_HUNTRESS_4(51); TEST_HUNTRESS_4(51);
@ -72,6 +78,32 @@ public enum Talent {
return Messages.get(this, name() + ".desc"); return Messages.get(this, name() + ".desc");
} }
public static void onFoodEaten( Hero hero, float foodVal ){
if (hero.hasTalent(HEARTY_MEAL) && hero.HP <= hero.HT/2){
//4/6 HP healed
hero.HP = Math.min( hero.HP + 2*(1+hero.pointsInTalent(HEARTY_MEAL)), hero.HT );
hero.sprite.emitter().burst( Speck.factory( Speck.HEALING ), hero.pointsInTalent(HEARTY_MEAL) );
}
if (hero.hasTalent(ENERGIZING_MEAL) && hero.HP <= hero.HT/2){
//4/6 turns of recharging
Buff.affect( hero, Recharging.class, 2*(1+hero.pointsInTalent(ENERGIZING_MEAL)) );
ScrollOfRecharging.charge( hero );
}
if (hero.hasTalent(RATIONED_MEAL) && hero.HP <= hero.HT/2){
//20%/30% bonus food value
float bonusSatiety = foodVal * 0.1f*(1+hero.pointsInTalent(RATIONED_MEAL));
Buff.affect(hero, Hunger.class).affectHunger(bonusSatiety, true);
//TODO vfx
}
if (hero.hasTalent(INVIGORATING_MEAL) && hero.HP <= hero.HT/2){
//eating food takes 1 turn, instead of 3
hero.spend(-2);
//effectively 2/3 turns of haste
Buff.affect( hero, Haste.class, 2+hero.pointsInTalent(INVIGORATING_MEAL));
//TODO VFX
}
}
private static final int TALENT_TIERS = 1; private static final int TALENT_TIERS = 1;
public static void initClassTalents( Hero hero ){ public static void initClassTalents( Hero hero ){
@ -84,16 +116,16 @@ public enum Talent {
//tier 1 //tier 1
switch (hero.heroClass){ switch (hero.heroClass){
case WARRIOR: default: case WARRIOR: default:
Collections.addAll(tierTalents, TEST_WARRIOR_1, TEST_WARRIOR_2, TEST_WARRIOR_3, TEST_WARRIOR_4); Collections.addAll(tierTalents, HEARTY_MEAL, TEST_WARRIOR_2, TEST_WARRIOR_3, TEST_WARRIOR_4);
break; break;
case MAGE: case MAGE:
Collections.addAll(tierTalents, TEST_MAGE_1, TEST_MAGE_2, TEST_MAGE_3, TEST_MAGE_4); Collections.addAll(tierTalents, ENERGIZING_MEAL, TEST_MAGE_2, TEST_MAGE_3, TEST_MAGE_4);
break; break;
case ROGUE: case ROGUE:
Collections.addAll(tierTalents, TEST_ROGUE_1, TEST_ROGUE_2, TEST_ROGUE_3, TEST_ROGUE_4); Collections.addAll(tierTalents, RATIONED_MEAL, TEST_ROGUE_2, TEST_ROGUE_3, TEST_ROGUE_4);
break; break;
case HUNTRESS: case HUNTRESS:
Collections.addAll(tierTalents, TEST_HUNTRESS_1, TEST_HUNTRESS_2, TEST_HUNTRESS_3, TEST_HUNTRESS_4); Collections.addAll(tierTalents, INVIGORATING_MEAL, TEST_HUNTRESS_2, TEST_HUNTRESS_3, TEST_HUNTRESS_4);
break; break;
} }
for (Talent talent : tierTalents){ for (Talent talent : tierTalents){

View File

@ -51,7 +51,7 @@ public class Metabolism extends Glyph {
if (!hunger.isStarving()) { if (!hunger.isStarving()) {
hunger.reduceHunger( healing * -10 ); hunger.affectHunger( healing * -10 );
defender.HP += healing; defender.HP += healing;
defender.sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 ); defender.sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 );

View File

@ -29,6 +29,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Statistics;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger;
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.SpellSprite; import com.shatteredpixel.shatteredpixeldungeon.effects.SpellSprite;
import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit; import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit;
@ -97,7 +98,7 @@ public class HornOfPlenty extends Artifact {
if (chargesToUse > charge) chargesToUse = charge; if (chargesToUse > charge) chargesToUse = charge;
hunger.satisfy(satietyPerCharge * chargesToUse); hunger.satisfy(satietyPerCharge * chargesToUse);
Food.foodProc( hero ); Talent.onFoodEaten(hero, satietyPerCharge * chargesToUse);
Statistics.foodEaten++; Statistics.foodEaten++;

View File

@ -28,12 +28,10 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.Statistics; import com.shatteredpixel.shatteredpixeldungeon.Statistics;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Recharging;
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.effects.SpellSprite; import com.shatteredpixel.shatteredpixeldungeon.effects.SpellSprite;
import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
@ -76,7 +74,7 @@ public class Food extends Item {
satisfy(hero); satisfy(hero);
GLog.i( message ); GLog.i( message );
foodProc( hero ); Talent.onFoodEaten(hero, energy);
hero.sprite.operate( hero.pos ); hero.sprite.operate( hero.pos );
hero.busy(); hero.busy();
@ -99,25 +97,6 @@ public class Food extends Item {
} }
} }
public static void foodProc( Hero hero ){
switch (hero.heroClass) {
case WARRIOR:
if (hero.HP < hero.HT) {
hero.HP = Math.min( hero.HP + 5, hero.HT );
hero.sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 );
}
break;
case MAGE:
//1 charge
Buff.affect( hero, Recharging.class, 4f );
ScrollOfRecharging.charge( hero );
break;
case ROGUE:
case HUNTRESS:
break;
}
}
@Override @Override
public boolean isUpgradable() { public boolean isUpgradable() {
return false; return false;