From aa0d58baceef214f0fd7400ddc968bd59c56d6df Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Fri, 12 Apr 2024 13:41:13 -0400 Subject: [PATCH] v2.4.0: redesigned secondary charge talent, it is now varied charge --- .../assets/messages/actors/actors.properties | 4 ++-- .../actors/hero/Talent.java | 24 ++++++++++++++++--- .../items/weapon/melee/MeleeWeapon.java | 22 +++++++++++++++++ 3 files changed, 45 insertions(+), 5 deletions(-) diff --git a/core/src/main/assets/messages/actors/actors.properties b/core/src/main/assets/messages/actors/actors.properties index b769464e8..b22413d53 100644 --- a/core/src/main/assets/messages/actors/actors.properties +++ b/core/src/main/assets/messages/actors/actors.properties @@ -913,8 +913,8 @@ actors.hero.talent.precise_assault.meta_desc=_If this talent is gained by a diff actors.hero.talent.deadly_followup.title=deadly followup actors.hero.talent.deadly_followup.desc=_+1:_ When the Duelist hits an enemy with a thrown weapon, she will deal _8% more melee damage_ to them for 5 turns.\n\n_+2:_ When the Duelist hits an enemy with a thrown weapon, she will deal _16% more melee damage_ to them for 5 turns.\n\n_+3:_ When the Duelist hits an enemy with a thrown weapon, she will deal _24% more melee damage_ to them for 5 turns. -actors.hero.talent.secondary_charge.title=secondary charge -actors.hero.talent.secondary_charge.desc=_+1:_ The Champion's secondary weapon charge speed and charge cap are increased to _58%_ of her primary, from 50%.\n\n_+2:_ The Champion's secondary weapon charge speed and charge cap are increased to _67%_ of her primary, from 50%.\n\n_+3:_ The Champion's secondary weapon charge speed and charge cap are increased to _75%_ of her primary, from 50%. +actors.hero.talent.varied_charge.title=varied charge +actors.hero.talent.varied_charge.desc=_+1:_ The Champion instantly regains _1/6 of a weapon charge_ when she uses two different weapon abilities, with no time limit.\n\n_+2:_ The Champion instantly regains _1/3 of a weapon charge_ when she uses two different weapon abilities, with no time limit.\n\n_+3:_ The Champion instantly regains _1/2 of a weapon charge_ when she uses two different weapon abilities, with no time limit. actors.hero.talent.twin_upgrades.title=twin upgrades actors.hero.talent.twin_upgrades.desc=_+1:_ If one of the Champion's two equipped weapons has a lower level and is _2 or more tiers lower_ than the other weapon, it will be boosted to the other weapon's level.\n\n_+2:_ If one of the Champion's two equipped weapons has a lower level and is _1 or more tiers lower_ than the other weapon, it will be boosted to the other weapon's level.\n\n_+3:_ If one of the Champion's two equipped weapons has a lower level and is _the same tier or lower_ than the other weapon, it will be boosted to the other weapon's level. actors.hero.talent.combined_lethality.title=combined lethality 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 af5b5ab02..735a7c28c 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 @@ -159,7 +159,7 @@ public enum Talent { //Duelist T3 PRECISE_ASSAULT(137, 3), DEADLY_FOLLOWUP(138, 3), //Champion T3 - SECONDARY_CHARGE(139, 3), TWIN_UPGRADES(140, 3), COMBINED_LETHALITY(141, 3), + VARIED_CHARGE(139, 3), TWIN_UPGRADES(140, 3), COMBINED_LETHALITY(141, 3), //Monk T3 UNENCUMBERED_SPIRIT(142, 3), MONASTIC_VIGOR(143, 3), COMBINED_ENERGY(144, 3), //Challenge T4 @@ -319,6 +319,21 @@ public enum Talent { public void tintIcon(Image icon) { icon.hardlight(1f, 1f, 0.0f); } public float iconFadePercent() { return Math.max(0, 1f - (visualcooldown() / 5)); } }; + public static class VariedChargeTracker extends Buff{ + public Class weapon; + + private static final String WEAPON = "weapon"; + @Override + public void storeInBundle(Bundle bundle) { + super.storeInBundle(bundle); + bundle.put(WEAPON, weapon); + } + @Override + public void restoreFromBundle(Bundle bundle) { + super.restoreFromBundle(bundle); + weapon = bundle.getClass(WEAPON); + } + } public static class CombinedLethalityAbilityTracker extends FlavourBuff{ public MeleeWeapon weapon; }; @@ -441,7 +456,7 @@ public enum Talent { Dungeon.observe(); } - if (talent == SECONDARY_CHARGE || talent == TWIN_UPGRADES || talent == DESPERATE_POWER){ + if (talent == TWIN_UPGRADES || talent == DESPERATE_POWER){ Item.updateQuickslot(); } @@ -892,7 +907,7 @@ public enum Talent { Collections.addAll(tierTalents, DURABLE_TIPS, BARKSKIN, SHIELDING_DEW); break; case CHAMPION: - Collections.addAll(tierTalents, SECONDARY_CHARGE, TWIN_UPGRADES, COMBINED_LETHALITY); + Collections.addAll(tierTalents, VARIED_CHARGE, TWIN_UPGRADES, COMBINED_LETHALITY); break; case MONK: Collections.addAll(tierTalents, UNENCUMBERED_SPIRIT, MONASTIC_VIGOR, COMBINED_ENERGY); @@ -957,6 +972,9 @@ public enum Talent { private static final HashMap renamedTalents = new HashMap<>(); static{ + //v2.4.0 + renamedTalents.put("SECONDARY_CHARGE", "VARIED_CHARGE"); + //v2.2.0 renamedTalents.put("RESTORED_WILLPOWER", "LIQUID_WILLPOWER"); renamedTalents.put("ENERGIZING_UPGRADE", "INSCRIBED_POWER"); 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 ce6e1582d..e731d2d2a 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 @@ -39,6 +39,7 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.FloatingText; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon; import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfForce; +import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.CellSelector; @@ -222,6 +223,27 @@ public class MeleeWeapon extends Weapon { if (hero.hasTalent(Talent.PRECISE_ASSAULT)){ Buff.prolong(hero, Talent.PreciseAssaultTracker.class, hero.cooldown()+4f); } + if (hero.hasTalent(Talent.VARIED_CHARGE)){ + Talent.VariedChargeTracker tracker = hero.buff(Talent.VariedChargeTracker.class); + if (tracker == null || tracker.weapon == getClass() || tracker.weapon == null){ + Buff.affect(hero, Talent.VariedChargeTracker.class).weapon = getClass(); + } else { + tracker.detach(); + Charger charger = Buff.affect(hero, Charger.class); + if (charger.charges < charger.chargeCap()) { + charger.partialCharge += hero.pointsInTalent(Talent.VARIED_CHARGE) / 6f; + if (charger.partialCharge >= 1f) { + charger.partialCharge -= 1f; + charger.charges++; + if (charger.charges == charger.chargeCap()){ + charger.partialCharge = 0; + } + updateQuickslot(); + } + } + ScrollOfRecharging.charge(hero); + } + } if (hero.hasTalent(Talent.COMBINED_LETHALITY)) { Talent.CombinedLethalityAbilityTracker tracker = hero.buff(Talent.CombinedLethalityAbilityTracker.class); if (tracker == null || tracker.weapon == this || tracker.weapon == null){