From 5a7ba5d6e49a68dbe1239f36a12a633b5e66ff5f Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Mon, 1 May 2023 13:02:10 -0400 Subject: [PATCH] v2.1.0: adjusted exp gain mechanics during ascension challenge: - hero now gains 10xp per kill until level 30 if they would otherwise be over-levelled - at level 30, reducing a curse stack grants 10 xp for recharge effects --- .../actors/buffs/AscensionChallenge.java | 13 ++++++++++--- .../shatteredpixeldungeon/actors/hero/Hero.java | 7 +++++-- .../shatteredpixeldungeon/actors/mobs/Mob.java | 9 +++++++++ .../items/wands/WandOfCorruption.java | 4 ++-- 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/AscensionChallenge.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/AscensionChallenge.java index 1f6a67161..579506b3d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/AscensionChallenge.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/AscensionChallenge.java @@ -26,12 +26,12 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Statistics; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.Ratmogrify; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.*; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Shopkeeper; import com.shatteredpixel.shatteredpixeldungeon.items.Amulet; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose; -import com.shatteredpixel.shatteredpixeldungeon.messages.Languages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; @@ -163,11 +163,18 @@ public class AscensionChallenge extends Buff { if (chal.stacks < 8f && (int)(chal.stacks/2) != (int)(oldStacks/2f)){ GLog.p(Messages.get(AscensionChallenge.class, "weaken")); } + + //if the hero is at the max level, grant them 10 effective xp per stack cleared + // for the purposes of on-xp gain effects + if (oldStacks > chal.stacks && Dungeon.hero.lvl == Hero.MAX_LEVEL){ + Dungeon.hero.earnExp(Math.round(10*(oldStacks - chal.stacks)), chal.getClass()); + } + BuffIndicator.refreshHero(); } - //used for internal calculations like corruption, not actual exp gain - public static int AscensionExp(Mob m){ + public static int AscensionCorruptResist(Mob m){ + //default to just using their EXP value if no ascent challenge is happening if (Dungeon.hero.buff(AscensionChallenge.class) == null){ return m.EXP; } 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 7dffb55b9..72ca93aff 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 @@ -1672,8 +1672,11 @@ public class Hero extends Char { } public void earnExp( int exp, Class source ) { - - this.exp += exp; + + //xp granted by ascension challenge is only for on-exp gain effects + if (source != AscensionChallenge.class) { + this.exp += exp; + } float percent = exp/(float)maxExp(); EtherealChains.chainsRecharge chains = buff(EtherealChains.chainsRecharge.class); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java index 9cf8e94e7..a70d89c65 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java @@ -761,6 +761,15 @@ public abstract class Mob extends Char { AscensionChallenge.processEnemyKill(this); int exp = Dungeon.hero.lvl <= maxLvl ? EXP : 0; + + //during ascent, under-levelled enemies grant 10 xp each until level 30 + // after this enemy kills which reduce the amulet curse still grant 10 effective xp + // for the purposes of on-exp effects, see AscensionChallenge.processEnemyKill + if (Dungeon.hero.buff(AscensionChallenge.class) != null && + exp == 0 && maxLvl > 0 && EXP > 0 && Dungeon.hero.lvl < Hero.MAX_LEVEL){ + exp = Math.round(10 * spawningWeight()); + } + if (exp > 0) { Dungeon.hero.sprite.showStatus(CharSprite.POSITIVE, Messages.get(this, "exp", exp)); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfCorruption.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfCorruption.java index 3ad1814cd..562ab4419 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfCorruption.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfCorruption.java @@ -150,10 +150,10 @@ public class WandOfCorruption extends Wand { enemyResist = (1f + Dungeon.scalingDepth()/4f) / 5f; } else if (ch instanceof Swarm){ //child swarms don't give exp, so we force this here. - enemyResist = 1 + AscensionChallenge.AscensionExp(enemy); + enemyResist = 1 + AscensionChallenge.AscensionCorruptResist(enemy); if (enemyResist == 1) enemyResist = 1 + 3; } else { - enemyResist = 1 + AscensionChallenge.AscensionExp(enemy); + enemyResist = 1 + AscensionChallenge.AscensionCorruptResist(enemy); } //100% health: 5x resist 75%: 3.25x resist 50%: 2x resist 25%: 1.25x resist