v2.5.0: fixed earthroot and living rock not applying to bone explosion

This commit is contained in:
Evan Debenham
2024-06-30 13:56:15 -04:00
parent b6dd63a649
commit 0ac18035de

View File

@@ -27,8 +27,10 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AscensionChallenge;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfLivingEarth;
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Chasm;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.plants.Earthroot;
import com.shatteredpixel.shatteredpixeldungeon.sprites.SkeletonSprite;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
@@ -70,7 +72,25 @@ public class Skeleton extends Mob {
if (ch != null && ch.isAlive()) {
int damage = Math.round(Char.combatRoll(6, 12));
damage = Math.round( damage * AscensionChallenge.statModifier(this));
//armor is 2x effective against bone explosion
//all sources of DR are 2x effective vs. bone explosion
//this does not consume extra uses of rock armor and earthroot armor
WandOfLivingEarth.RockArmor rockArmor = ch.buff(WandOfLivingEarth.RockArmor.class);
if (rockArmor != null) {
int preDmg = damage;
damage = rockArmor.absorb(damage);
damage *= Math.round(damage/(float)preDmg); //apply the % reduction twice
}
Earthroot.Armor armor = ch.buff( Earthroot.Armor.class );
if (damage > 0 && armor != null) {
int preDmg = damage;
damage = armor.absorb( damage );
damage -= (preDmg - damage); //apply the flat reduction twice
}
//apply DR twice (with 2 rolls for more consistency)
damage = Math.max( 0, damage - (ch.drRoll() + ch.drRoll()) );
ch.damage( damage, this );
if (ch == Dungeon.hero && !ch.isAlive()) {