From 553c17566de4366ea72394f94868915e0f7a616f Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Mon, 12 Dec 2022 15:49:18 -0500 Subject: [PATCH] v2.0.0: implemented the focused meal talent --- .../shatteredpixeldungeon/actors/hero/Talent.java | 13 +++++++++++-- .../items/artifacts/HornOfPlenty.java | 3 ++- .../shatteredpixeldungeon/items/food/Berry.java | 3 ++- .../shatteredpixeldungeon/items/food/Food.java | 3 ++- .../items/weapon/melee/MeleeWeapon.java | 12 ++++++++++++ 5 files changed, 29 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Talent.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Talent.java index d4c9207cc..b80e53976 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Talent.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Talent.java @@ -149,7 +149,7 @@ public enum Talent { //Duelist T1 STRENGTHENING_MEAL(128), ADVENTURERS_INTUITION(129), DUELIST_T1_3(130), AGGRESSIVE_BARRIER(131), //Duelist T2 - DUELIST_T2_1(132), DUELIST_T2_2(133), DUELIST_T2_3(134), DUELIST_T2_4(135), DUELIST_T2_5(136), + FOCUSED_MEAL(132), DUELIST_T2_2(133), DUELIST_T2_3(134), DUELIST_T2_4(135), DUELIST_T2_5(136), //Duelist T3 DUELIST_T3_1(137, 3), DUELIST_T3_2(138, 3), //Duelist S1 T3 @@ -382,6 +382,15 @@ public enum Talent { //2 bonus physical damage for next 2/3 attacks Buff.affect( hero, PhysicalEmpower.class).set(2, 1 + hero.pointsInTalent(STRENGTHENING_MEAL)); } + if (hero.hasTalent(FOCUSED_MEAL)){ + if (hero.heroClass == HeroClass.DUELIST){ + //1/1.5 charge for the duelist + Buff.affect( hero, MeleeWeapon.Charger.class ).gainCharge(0.5f*(hero.pointsInTalent(FOCUSED_MEAL)+1)); + } else { + // lvl/3 / lvl/2 bonus dmg on next hit for other classes + Buff.affect( hero, PhysicalEmpower.class).set(Math.round(hero.lvl / (4f - hero.pointsInTalent(FOCUSED_MEAL))), 1); + } + } } public static class WarriorFoodImmunity extends FlavourBuff{ @@ -621,7 +630,7 @@ public enum Talent { Collections.addAll(tierTalents, INVIGORATING_MEAL, RESTORED_NATURE, REJUVENATING_STEPS, HEIGHTENED_SENSES, DURABLE_PROJECTILES); break; case DUELIST: - Collections.addAll(tierTalents, DUELIST_T2_1, DUELIST_T2_2, DUELIST_T2_3, DUELIST_T2_4, DUELIST_T2_5); + Collections.addAll(tierTalents, FOCUSED_MEAL, DUELIST_T2_2, DUELIST_T2_3, DUELIST_T2_4, DUELIST_T2_5); break; } for (Talent talent : tierTalents){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/HornOfPlenty.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/HornOfPlenty.java index 984eb6160..f373e34da 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/HornOfPlenty.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/HornOfPlenty.java @@ -126,7 +126,8 @@ public class HornOfPlenty extends Artifact { if (Dungeon.hero.hasTalent(Talent.IRON_STOMACH) || Dungeon.hero.hasTalent(Talent.ENERGIZING_MEAL) || Dungeon.hero.hasTalent(Talent.MYSTICAL_MEAL) - || Dungeon.hero.hasTalent(Talent.INVIGORATING_MEAL)){ + || Dungeon.hero.hasTalent(Talent.INVIGORATING_MEAL) + || Dungeon.hero.hasTalent(Talent.FOCUSED_MEAL)){ hero.spend(Food.TIME_TO_EAT - 2); } else { hero.spend(Food.TIME_TO_EAT); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/food/Berry.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/food/Berry.java index 35115bc39..1fb66088e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/food/Berry.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/food/Berry.java @@ -44,7 +44,8 @@ public class Berry extends Food { if (Dungeon.hero.hasTalent(Talent.IRON_STOMACH) || Dungeon.hero.hasTalent(Talent.ENERGIZING_MEAL) || Dungeon.hero.hasTalent(Talent.MYSTICAL_MEAL) - || Dungeon.hero.hasTalent(Talent.INVIGORATING_MEAL)){ + || Dungeon.hero.hasTalent(Talent.INVIGORATING_MEAL) + || Dungeon.hero.hasTalent(Talent.FOCUSED_MEAL)){ return 0; } else { return 1; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/food/Food.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/food/Food.java index 0bb3d3d47..88cba2be8 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/food/Food.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/food/Food.java @@ -96,7 +96,8 @@ public class Food extends Item { if (Dungeon.hero.hasTalent(Talent.IRON_STOMACH) || Dungeon.hero.hasTalent(Talent.ENERGIZING_MEAL) || Dungeon.hero.hasTalent(Talent.MYSTICAL_MEAL) - || Dungeon.hero.hasTalent(Talent.INVIGORATING_MEAL)){ + || Dungeon.hero.hasTalent(Talent.INVIGORATING_MEAL) + || Dungeon.hero.hasTalent(Talent.FOCUSED_MEAL)){ return TIME_TO_EAT - 2; } else { return TIME_TO_EAT; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java index a5dba6886..7e1b0ba51 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java @@ -297,6 +297,18 @@ public class MeleeWeapon extends Weapon { return Math.min(10, 3 + (Dungeon.hero.lvl-1)/3); } + public void gainCharge( float charge ){ + if (charges < chargeCap()) { + partialCharge += charge; + while (partialCharge >= 1f) { + charges++; + partialCharge--; + } + charges = Math.min(charges, chargeCap()); + updateQuickslot(); + } + } + public static final String CHARGES = "charges"; private static final String PARTIALCHARGE = "partialCharge";