From 2319d367c271c63caab44ee8624eac3b2f6e9e45 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Mon, 12 Dec 2022 16:11:08 -0500 Subject: [PATCH] v2.0.0: implemented the weapon recharging talent --- .../assets/messages/actors/actors.properties | 2 +- .../actors/hero/Hero.java | 8 ++++++++ .../actors/hero/Talent.java | 4 ++-- .../items/weapon/melee/MeleeWeapon.java | 19 ++++++++++++++----- 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/core/src/main/assets/messages/actors/actors.properties b/core/src/main/assets/messages/actors/actors.properties index 9dc2abc1e..fd7e4e396 100644 --- a/core/src/main/assets/messages/actors/actors.properties +++ b/core/src/main/assets/messages/actors/actors.properties @@ -811,7 +811,7 @@ actors.hero.talent.focused_meal.meta_desc=_If this talent is gained by a differe actors.hero.talent.restored_agility.title=restored agility actors.hero.talent.restored_agility.desc=_+1:_ The Duelist has _2x evasion_ while drinking potions of healing.\n\n_+2:_ The Duelist has _5x evasion_ while drinking potions of healing.\n\nThis talent also triggers when drinking potions or elixirs based on potions of healing. actors.hero.talent.weapon_recharging.title=weapon recharging -actors.hero.talent.weapon_recharging.desc=_+1:_ Wand and artifact recharging buffs also give the duelist one weapon charge every _15 turns_.\n\n_+2:_ Wand and artifact recharging buffs also give the duelist one weapon charge every _10 turns_. +actors.hero.talent.weapon_recharging.desc=_+1:_ The Duelist gains one weapon charge every _15 turns_ when under the effect of wand or artifact recharging buffs.\n\n_+2:_ The Duelist gains one weapon charge every _10 turns_ when under the effect of wand or artifact recharging buffs. actors.hero.talent.weapon_recharging.meta_desc=_If this talent is gained by a different hero_ it will instead cause them to deal +5% melee damage while recharging at +1, and +7.5% melee damage while recharging at +2. actors.hero.talent.swift_equip.title=swift equip diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java index f8bd5d9d7..df1cbd30a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java @@ -35,6 +35,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.SacrificialFire; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AdrenalineSurge; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Amok; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AnkhInvulnerability; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.ArtifactRecharge; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AscensionChallenge; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Awareness; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Barkskin; @@ -54,6 +55,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MindVision; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Momentum; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.PhysicalEmpower; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Recharging; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Regeneration; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.SnipersMark; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Vertigo; @@ -581,6 +583,12 @@ public class Hero extends Char { Sample.INSTANCE.play(Assets.Sounds.HIT_STRONG, 0.75f, 1.2f); } + if (heroClass != HeroClass.DUELIST + && hasTalent(Talent.WEAPON_RECHARGING) + && (buff(Recharging.class) != null || buff(ArtifactRecharge.class) != null)){ + dmg = Math.round(dmg * 1.025f + (.025f*pointsInTalent(Talent.WEAPON_RECHARGING))); + } + if (dmg < 0) dmg = 0; return dmg; } 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 4097aa238..3c9987ab2 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 - FOCUSED_MEAL(132), RESTORED_AGILITY(133), DUELIST_T2_3(134), DUELIST_T2_4(135), DUELIST_T2_5(136), + FOCUSED_MEAL(132), RESTORED_AGILITY(133), WEAPON_RECHARGING(134), DUELIST_T2_4(135), DUELIST_T2_5(136), //Duelist T3 DUELIST_T3_1(137, 3), DUELIST_T3_2(138, 3), //Duelist S1 T3 @@ -634,7 +634,7 @@ public enum Talent { Collections.addAll(tierTalents, INVIGORATING_MEAL, RESTORED_NATURE, REJUVENATING_STEPS, HEIGHTENED_SENSES, DURABLE_PROJECTILES); break; case DUELIST: - Collections.addAll(tierTalents, FOCUSED_MEAL, RESTORED_AGILITY, DUELIST_T2_3, DUELIST_T2_4, DUELIST_T2_5); + Collections.addAll(tierTalents, FOCUSED_MEAL, RESTORED_AGILITY, WEAPON_RECHARGING, DUELIST_T2_4, DUELIST_T2_5); break; } for (Talent talent : tierTalents){ 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 7e1b0ba51..80ef5ae06 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 @@ -23,9 +23,11 @@ package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.ArtifactRecharge; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Barrier; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LockedFloor; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Recharging; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent; @@ -280,11 +282,18 @@ public class MeleeWeapon extends Weapon { if (charges < chargeCap()){ if (lock == null || lock.regenOn()){ partialCharge += 1/(50f-(chargeCap()-charges)); // 50 to 40 turns per charge - if (partialCharge >= 1){ - charges++; - partialCharge--; - updateQuickslot(); - } + } + + int points = ((Hero)target).pointsInTalent(Talent.WEAPON_RECHARGING); + if (points > 0 && target.buff(Recharging.class) != null || target.buff(ArtifactRecharge.class) != null){ + //1 every 15 turns at +1, 10 turns at +2 + partialCharge += 1/(20f - 5f*points); + } + + if (partialCharge >= 1){ + charges++; + partialCharge--; + updateQuickslot(); } } else { partialCharge = 0;