v2.3.0: retrib and psi blast now compute targets first before damaging

This commit is contained in:
Evan Debenham
2024-01-02 20:31:47 -05:00
parent eb7a86451d
commit 025ba0e12d
2 changed files with 32 additions and 14 deletions

View File

@@ -33,6 +33,8 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
import java.util.ArrayList;
public class ScrollOfRetribution extends Scroll {
{
@@ -51,14 +53,21 @@ public class ScrollOfRetribution extends Scroll {
Sample.INSTANCE.play( Assets.Sounds.BLAST );
GLog.i(Messages.get(this, "blast"));
ArrayList<Mob> targets = new ArrayList<>();
//calculate targets first, in case damaging/blinding a target affects hero vision
for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) {
if (Dungeon.level.heroFOV[mob.pos]) {
//deals 10%HT, plus 0-90%HP based on scaling
mob.damage(Math.round(mob.HT/10f + (mob.HP * power * 0.225f)), this);
if (mob.isAlive()) {
Buff.prolong(mob, Blindness.class, Blindness.DURATION);
}
targets.add(mob);
}
}
for (Mob mob : targets){
//deals 10%HT, plus 0-90%HP based on scaling
mob.damage(Math.round(mob.HT/10f + (mob.HP * power * 0.225f)), this);
if (mob.isAlive()) {
Buff.prolong(mob, Blindness.class, Blindness.DURATION);
}
}

View File

@@ -35,6 +35,8 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
import java.util.ArrayList;
public class ScrollOfPsionicBlast extends ExoticScroll {
{
@@ -49,19 +51,26 @@ public class ScrollOfPsionicBlast extends ExoticScroll {
Sample.INSTANCE.play( Assets.Sounds.BLAST );
GLog.i(Messages.get(ScrollOfRetribution.class, "blast"));
int targets = 0;
ArrayList<Mob> targets = new ArrayList<>();
//calculate targets first, in case damaging/blinding a target affects hero vision
for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) {
if (Dungeon.level.heroFOV[mob.pos]) {
targets ++;
mob.damage(Math.round(mob.HT/2f + mob.HP/2f), this);
if (mob.isAlive()) {
Buff.prolong(mob, Blindness.class, Blindness.DURATION);
}
targets.add(mob);
}
}
for (Mob mob : targets){
//always kills non-resistant enemies
//resistant enemies take 50% current HP at full health, scaling to 75% at 1/2 HP, and 100% at 1/3 hp
mob.damage(Math.round(mob.HT/2f + mob.HP/2f), this);
if (mob.isAlive()) {
Buff.prolong(mob, Blindness.class, Blindness.DURATION);
}
}
curUser.damage(Math.max(0, Math.round(curUser.HT*(0.5f * (float)Math.pow(0.9, targets)))), this);
curUser.damage(Math.max(0, Math.round(curUser.HT*(0.5f * (float)Math.pow(0.9, targets.size())))), this);
if (curUser.isAlive()) {
Buff.prolong(curUser, Blindness.class, Blindness.DURATION);
Buff.prolong(curUser, Weakness.class, Weakness.DURATION*5f);