From 6118d4c4bde3120d95eccdaaae38b421313766cc Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Tue, 7 Oct 2025 15:45:43 -0400 Subject: [PATCH] v3.3.0: Duelist's weapon charge buff is no longer lost in rankings --- .../shatteredpixeldungeon/Rankings.java | 6 +++++- .../shatteredpixeldungeon/actors/hero/Hero.java | 13 +++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Rankings.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Rankings.java index aeb764d27..57dc5712b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Rankings.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Rankings.java @@ -34,6 +34,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.quest.CorpseDust; import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll; import com.shatteredpixel.shatteredpixeldungeon.items.trinkets.Trinket; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon; import com.shatteredpixel.shatteredpixeldungeon.journal.Notes; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.ui.QuickSlotButton; @@ -272,7 +273,10 @@ public enum Rankings { //remove all buffs (ones tied to equipment will be re-applied) for(Buff b : Dungeon.hero.buffs()){ - Dungeon.hero.remove(b); + //except Duelist's melee weapon charge buff + if (!(b instanceof MeleeWeapon.Charger)) { + Dungeon.hero.remove(b); + } } rec.gameData.put( HERO, Dungeon.hero ); 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 935c563a3..69a21a180 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 @@ -139,6 +139,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Crossbow; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Flail; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Quarterstaff; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.RoundShield; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Sai; @@ -2091,6 +2092,18 @@ public class Hero extends Char { return false; } + @Override + protected synchronized void onRemove() { + //same as super, except we retain charger for rankings purposes + for (Buff buff : buffs()) { + if (buff instanceof MeleeWeapon.Charger){ + Actor.remove(buff); + } else { + buff.detach(); + } + } + } + @Override public void die( Object cause ) {