v3.0.0: fixed exploits involving juggling salt cube

This commit is contained in:
Evan Debenham
2025-01-15 14:46:17 -05:00
parent 034f7897c8
commit 3d212b6a9e
2 changed files with 34 additions and 0 deletions

View File

@@ -86,6 +86,23 @@ public class Regeneration extends Buff {
return true;
}
//helper method for resetting the delay when salt cube buff changes, to counter exploits
public void resetDelay( SaltCube cube ){
ChaliceOfBlood.chaliceRegen regenBuff = Dungeon.hero.buff( ChaliceOfBlood.chaliceRegen.class);
float delay = REGENERATION_DELAY;
if (regenBuff != null && target.buff(MagicImmune.class) == null) {
if (regenBuff.isCursed()) {
delay *= 1.5f;
} else {
//15% boost at +0, scaling to a 500% boost at +10
delay -= 1.33f + regenBuff.itemLevel()*0.667f;
delay /= RingOfEnergy.artifactChargeMultiplier(target);
}
}
delay /= SaltCube.healthRegenMultiplier(cube.level());
postpone( delay );
}
public int regencap(){
return target.HT;

View File

@@ -21,6 +21,10 @@
package com.shatteredpixel.shatteredpixeldungeon.items.trinkets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Regeneration;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
@@ -36,6 +40,19 @@ public class SaltCube extends Trinket {
return 6+2*level();
}
@Override
protected void onDetach() {
//resets regen delay to counter exploits involving juggling the salt cube.
Buff.affect(Dungeon.hero, Regeneration.class).resetDelay(this);
}
@Override
public boolean doPickUp(Hero hero, int pos) {
//resets regen delay to counter exploits involving juggling the salt cube.
Buff.affect(Dungeon.hero, Regeneration.class).resetDelay(this);
return super.doPickUp(hero, pos);
}
@Override
public String statsDesc() {
if (isIdentified()){