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
@@ -33,6 +33,8 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample; import com.watabou.noosa.audio.Sample;
import java.util.ArrayList;
public class ScrollOfRetribution extends Scroll { public class ScrollOfRetribution extends Scroll {
{ {
@@ -52,13 +54,20 @@ public class ScrollOfRetribution extends Scroll {
Sample.INSTANCE.play( Assets.Sounds.BLAST ); Sample.INSTANCE.play( Assets.Sounds.BLAST );
GLog.i(Messages.get(this, "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] )) { for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) {
if (Dungeon.level.heroFOV[mob.pos]) { if (Dungeon.level.heroFOV[mob.pos]) {
//deals 10%HT, plus 0-90%HP based on scaling targets.add(mob);
mob.damage(Math.round(mob.HT/10f + (mob.HP * power * 0.225f)), this); }
if (mob.isAlive()) { }
Buff.prolong(mob, Blindness.class, Blindness.DURATION);
} 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);
} }
} }
@@ -35,6 +35,8 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample; import com.watabou.noosa.audio.Sample;
import java.util.ArrayList;
public class ScrollOfPsionicBlast extends ExoticScroll { public class ScrollOfPsionicBlast extends ExoticScroll {
{ {
@@ -50,18 +52,25 @@ public class ScrollOfPsionicBlast extends ExoticScroll {
Sample.INSTANCE.play( Assets.Sounds.BLAST ); Sample.INSTANCE.play( Assets.Sounds.BLAST );
GLog.i(Messages.get(ScrollOfRetribution.class, "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] )) { for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) {
if (Dungeon.level.heroFOV[mob.pos]) { if (Dungeon.level.heroFOV[mob.pos]) {
targets ++; targets.add(mob);
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); 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.size())))), this);
if (curUser.isAlive()) { if (curUser.isAlive()) {
Buff.prolong(curUser, Blindness.class, Blindness.DURATION); Buff.prolong(curUser, Blindness.class, Blindness.DURATION);
Buff.prolong(curUser, Weakness.class, Weakness.DURATION*5f); Buff.prolong(curUser, Weakness.class, Weakness.DURATION*5f);