v0.9.4: improved blessed ankh behaviour

This commit is contained in:
Evan Debenham 2021-06-29 21:28:12 -04:00
parent fa94762a31
commit d261b73272
9 changed files with 61 additions and 7 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 380 B

After

Width:  |  Height:  |  Size: 427 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -53,6 +53,9 @@ actors.buffs.adrenalinesurge.desc=A surge of great might, but sadly not permanen
actors.buffs.amok.name=Amok
actors.buffs.amok.desc=Amok causes a state of great rage and confusion in its target.\n\nWhen a creature is amoked, they will attack whatever is near them, whether they be friend or foe.\n\nTurns of amok remaining: %s.
actors.buffs.ankhinvulnerability.name=Invulnerable
actors.buffs.ankhinvulnerability.desc=Your blessed ankh has expended its energy, granting you some health and a brief period of invulnerability!\n\nTurns remaining: %s.
actors.buffs.arcanearmor.name=Arcane Armor
actors.buffs.arcanearmor.desc=A thin shield is surrounding you, blocking some of the damage from magical attacks.\n\nYour magical armor is currently boosted by: 0-%d.\n\nTurns until arcane armor weakens: %s.

View File

@ -0,0 +1,45 @@
package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
public class AnkhInvulnerability extends FlavourBuff {
{
type = Buff.buffType.POSITIVE;
}
public static final float DURATION = 3f;
@Override
public void fx(boolean on) {
if (on) target.sprite.aura( 0xFFFF00 );
else target.sprite.clearAura();
}
@Override
public int icon() {
return BuffIndicator.ANKH;
}
@Override
public float iconFadePercent() {
return Math.max(0, (DURATION - visualcooldown()) / DURATION);
}
@Override
public String toString() {
return Messages.get(this, "name");
}
@Override
public String desc() {
return Messages.get(this, "desc", dispTurns());
}
{
immunities.add(Paralysis.class);
immunities.add(Frost.class);
}
}

View File

@ -33,6 +33,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Alchemy;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AdrenalineSurge;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Amok;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AnkhInvulnerability;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Awareness;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Barkskin;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Berserk;
@ -61,6 +62,7 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.CheckedCell;
import com.shatteredpixel.shatteredpixeldungeon.effects.Flare;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.effects.SpellSprite;
import com.shatteredpixel.shatteredpixeldungeon.items.Amulet;
import com.shatteredpixel.shatteredpixeldungeon.items.Ankh;
import com.shatteredpixel.shatteredpixeldungeon.items.Dewdrop;
@ -1610,16 +1612,13 @@ public class Hero extends Char {
if (ankh != null && ankh.isBlessed()) {
this.HP = HT/4;
//ensures that you'll get to act first in almost any case, to prevent reviving and then instantly dieing again.
PotionOfHealing.cure(this);
Buff.detach(this, Paralysis.class);
spend(-cooldown());
new Flare(8, 32).color(0xFFFF66, true).show(sprite, 2f);
CellEmitter.get(this.pos).start(Speck.factory(Speck.LIGHT), 0.2f, 3);
Buff.prolong(this, AnkhInvulnerability.class, AnkhInvulnerability.DURATION);
ankh.detach(belongings.backpack);
SpellSprite.show(this, SpellSprite.ANKH);
GameScene.flash(0x80FFFF40);
Sample.INSTANCE.play( Assets.Sounds.TELEPORT );
GLog.w( Messages.get(this, "revive") );
Statistics.ankhsUsed++;
@ -1848,6 +1847,11 @@ public class Hero extends Char {
return super.isImmune(effect);
}
@Override
public boolean isInvulnerable(Class effect) {
return buff(AnkhInvulnerability.class) != null;
}
public boolean search( boolean intentional ) {
if (!isAlive()) return false;

View File

@ -38,6 +38,7 @@ public class SpellSprite extends Image {
public static final int CHARGE = 2;
public static final int MASTERY = 3;
public static final int BERSERK = 4;
public static final int ANKH = 5;
private static final int SIZE = 16;

View File

@ -52,7 +52,7 @@ public class ChaliceOfBlood extends Artifact {
@Override
public ArrayList<String> actions( Hero hero ) {
ArrayList<String> actions = super.actions( hero );
if (isEquipped( hero ) && level() < levelCap && !cursed)
if (isEquipped( hero ) && level() < levelCap && !cursed && !hero.isInvulnerable(getClass()))
actions.add(AC_PRICK);
return actions;
}

View File

@ -98,6 +98,7 @@ public class BuffIndicator extends Component {
public static final int PINCUSHION = 49;
public static final int UPGRADE = 50;
public static final int MOMENTUM = 51;
public static final int ANKH = 52;
public static final int SIZE = 7;