From 2a48f2e944541c7c43c383d00a6fe88a55a66cb8 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sat, 19 Sep 2020 02:04:37 -0400 Subject: [PATCH] v0.9.0: implemented an offensive talent for rogue and huntress --- .../assets/messages/actors/actors.properties | 8 ++--- .../actors/hero/Talent.java | 35 ++++++++++++++++--- .../items/weapon/melee/Gloves.java | 4 +-- 3 files changed, 37 insertions(+), 10 deletions(-) diff --git a/core/src/main/assets/messages/actors/actors.properties b/core/src/main/assets/messages/actors/actors.properties index 1e540db72..3860cec1f 100644 --- a/core/src/main/assets/messages/actors/actors.properties +++ b/core/src/main/assets/messages/actors/actors.properties @@ -316,16 +316,16 @@ actors.hero.talent.rationed_meal.title=rationed meal 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.thiefs_intuition.title=thief's intuition actors.hero.talent.thiefs_intuition.desc=_+1:_ The Rogue identifies rings _2x faster_, and identifies the type of a ring _when he equips it_.\n\n_+2:_ The Rogue identifies rings _when he equips them_, and identifies the type of a ring _when he picks it up_. -actors.hero.talent.test_rogue_3.title=test talent -actors.hero.talent.test_rogue_3.desc=TODO +actors.hero.talent.sucker_punch.title=sucker punch +actors.hero.talent.sucker_punch.desc=_+1:_ The Rogue deals _1 bonus damage_ the first time he surprise attacks an enemy.\n\n_+2:_ The Rogue deals _1-2 bonus damage_ the first time he surprise attacks an enemy. actors.hero.talent.mending_shadows.title=mending shadows actors.hero.talent.mending_shadows.desc=_+1:_ The Rogue heals for 1 HP every _3 consecutive turns_ that he is hidden by his cloak.\n\n_+2:_ The Rogue heals for 1 HP every _2 consecutive turns_ that he is hidden by his cloak. actors.hero.talent.invigorating_meal.title=invigorating meal 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.survivalists_intuition.title=survivalist's intuition actors.hero.talent.survivalists_intuition.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.desc=TODO +actors.hero.talent.followup_strike.title=followup strike +actors.hero.talent.followup_strike.desc=_+1:_ When the Huntress hits an enemy with her bow or a thrown weapon, her next melee attack against that enemy deals _1 bonus damage_.\n\n_+2:_ When the Huntress hits an enemy with her bow or a thrown weapon, her next melee attack against that enemy deals _1-2 bonus damage_ actors.hero.talent.natures_aid.title=nature's aid actors.hero.talent.natures_aid.desc=_+1:_ The Huntress gains 2 armor of barkskin for _4 turns_ when a plant is trampled in her vision.\n\n_+2:_ The Huntress gains 2 armor of barkskin for _6 turns_ when a plant is trampled in her vision. 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 66c5bc489..25be56118 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 @@ -22,10 +22,12 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.hero; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.actors.Char; 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.actors.mobs.Mob; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; @@ -34,8 +36,10 @@ import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.watabou.utils.Bundle; +import com.watabou.utils.Random; import java.util.ArrayList; import java.util.Collections; @@ -55,12 +59,12 @@ public enum Talent { RATIONED_MEAL(32), THIEFS_INTUITION(33), - TEST_ROGUE_3(34), + SUCKER_PUNCH(34), MENDING_SHADOWS(35), INVIGORATING_MEAL(48), SURVIVALISTS_INTUITION(49), - TEST_HUNTRESS_3(50), + FOLLOWUP_STRIKE(50), NATURES_AID(51); int icon; @@ -167,6 +171,29 @@ public enum Talent { } } + public static int onAttackProc( Hero hero, Char enemy, int dmg ){ + if (hero.hasTalent(Talent.SUCKER_PUNCH) + && enemy instanceof Mob && ((Mob) enemy).surprisedBy(hero) + && enemy.buff(SuckerPunchTracker.class) == null){ + dmg += Random.IntRange(1 , hero.pointsInTalent(Talent.SUCKER_PUNCH)); + Buff.affect(enemy, SuckerPunchTracker.class); + } + + if (hero.hasTalent(Talent.FOLLOWUP_STRIKE)) { + if (hero.belongings.weapon instanceof MissileWeapon) { + Buff.affect(enemy, FollowupStrikeTracker.class); + } else if (enemy.buff(FollowupStrikeTracker.class) != null){ + dmg += Random.IntRange(1 , hero.pointsInTalent(Talent.FOLLOWUP_STRIKE)); + enemy.buff(FollowupStrikeTracker.class).detach(); + } + } + + return dmg; + } + + public static class SuckerPunchTracker extends Buff{}; + public static class FollowupStrikeTracker extends Buff{}; + private static final int TALENT_TIERS = 1; public static void initClassTalents( Hero hero ){ @@ -185,10 +212,10 @@ public enum Talent { Collections.addAll(tierTalents, ENERGIZING_MEAL, SCHOLARS_INTUITION, TESTED_HYPOTHESIS, ENERGIZING_UPGRADE); break; case ROGUE: - Collections.addAll(tierTalents, RATIONED_MEAL, THIEFS_INTUITION, TEST_ROGUE_3, MENDING_SHADOWS); + Collections.addAll(tierTalents, RATIONED_MEAL, THIEFS_INTUITION, SUCKER_PUNCH, MENDING_SHADOWS); break; case HUNTRESS: - Collections.addAll(tierTalents, INVIGORATING_MEAL, SURVIVALISTS_INTUITION, TEST_HUNTRESS_3, NATURES_AID); + Collections.addAll(tierTalents, INVIGORATING_MEAL, SURVIVALISTS_INTUITION, FOLLOWUP_STRIKE, NATURES_AID); break; } for (Talent talent : tierTalents){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Gloves.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Gloves.java index eb97e4675..66c2399df 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Gloves.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Gloves.java @@ -39,8 +39,8 @@ public class Gloves extends MeleeWeapon { @Override public int max(int lvl) { - return (int)(3f*(tier+1)) + //6 base, down from 10 - lvl*tier; //+1 per level, down from +2 + return Math.round(2.5f*(tier+1)) + //5 base, down from 10 + lvl*Math.round(0.5f*(tier+1)); //+1 per level, down from +2 } }