diff --git a/core/src/main/assets/effects/spell_icons.png b/core/src/main/assets/effects/spell_icons.png index f67c8d12b..a3854cadc 100644 Binary files a/core/src/main/assets/effects/spell_icons.png and b/core/src/main/assets/effects/spell_icons.png differ diff --git a/core/src/main/assets/interfaces/buffs.png b/core/src/main/assets/interfaces/buffs.png index 5d724ae27..f77c4ca57 100644 Binary files a/core/src/main/assets/interfaces/buffs.png and b/core/src/main/assets/interfaces/buffs.png differ diff --git a/core/src/main/assets/interfaces/large_buffs.png b/core/src/main/assets/interfaces/large_buffs.png index 3aead2062..216a2b139 100644 Binary files a/core/src/main/assets/interfaces/large_buffs.png and b/core/src/main/assets/interfaces/large_buffs.png differ diff --git a/core/src/main/assets/messages/actors/actors.properties b/core/src/main/assets/messages/actors/actors.properties index 56b9f2ccc..f8524d386 100644 --- a/core/src/main/assets/messages/actors/actors.properties +++ b/core/src/main/assets/messages/actors/actors.properties @@ -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. diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/AnkhInvulnerability.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/AnkhInvulnerability.java new file mode 100644 index 000000000..653bac8a8 --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/AnkhInvulnerability.java @@ -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); + } + +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java index 5e9fbdab4..2516c9f07 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java @@ -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; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/SpellSprite.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/SpellSprite.java index e644bfbdc..eeee21bb2 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/SpellSprite.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/SpellSprite.java @@ -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; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/ChaliceOfBlood.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/ChaliceOfBlood.java index b9071f80e..243c8c460 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/ChaliceOfBlood.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/ChaliceOfBlood.java @@ -52,7 +52,7 @@ public class ChaliceOfBlood extends Artifact { @Override public ArrayList actions( Hero hero ) { ArrayList 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; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java index 2f9828f57..83e5a9e25 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java @@ -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;