v2.2.0: downed guardians now repel items & don't trigger on-hit effects

This commit is contained in:
Evan Debenham
2023-09-29 12:21:20 -04:00
parent 8baea983c0
commit 35022e8075
2 changed files with 26 additions and 11 deletions

View File

@@ -408,20 +408,22 @@ public abstract class Char extends Actor {
}
int effectiveDamage = enemy.defenseProc( this, Math.round(dmg) );
effectiveDamage = Math.max( effectiveDamage - dr, 0 );
//do not trigger on-hit logic if defenseProc returned a negative value
if (effectiveDamage >= 0) {
effectiveDamage = Math.max(effectiveDamage - dr, 0);
if (enemy.buff(Viscosity.ViscosityTracker.class) != null){
effectiveDamage = enemy.buff(Viscosity.ViscosityTracker.class).deferDamage(effectiveDamage);
enemy.buff(Viscosity.ViscosityTracker.class).detach();
}
if (enemy.buff(Viscosity.ViscosityTracker.class) != null) {
effectiveDamage = enemy.buff(Viscosity.ViscosityTracker.class).deferDamage(effectiveDamage);
enemy.buff(Viscosity.ViscosityTracker.class).detach();
}
//vulnerable specifically applies after armor reductions
if ( enemy.buff( Vulnerable.class ) != null){
effectiveDamage *= 1.33f;
//vulnerable specifically applies after armor reductions
if (enemy.buff(Vulnerable.class) != null) {
effectiveDamage *= 1.33f;
}
effectiveDamage = attackProc(enemy, effectiveDamage);
}
effectiveDamage = attackProc( enemy, effectiveDamage );
if (visibleFight) {
if (effectiveDamage > 0 || !enemy.blockSound(Random.Float(0.96f, 1.05f))) {
hitSound(Random.Float(0.87f, 1.15f));

View File

@@ -32,6 +32,7 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.Splash;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CrystalGuardianSprite;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Bundle;
@@ -65,6 +66,7 @@ public class CrystalGuardian extends Mob{
@Override
protected boolean act() {
if (recovering){
throwItems();
HP = Math.min(HT, HP+5);
sprite.emitter().burst(Speck.factory(Speck.HEALING), 1);
if (HP == HT){
@@ -97,6 +99,17 @@ public class CrystalGuardian extends Mob{
return true;
}
@Override
public int defenseProc(Char enemy, int damage) {
if (recovering){
sprite.showStatus(CharSprite.NEGATIVE, Integer.toString(damage));
HP = Math.max(1, HP-damage);
damage = -1;
}
return super.defenseProc(enemy, damage);
}
@Override
public boolean isAlive() {
if (HP <= 0){