From d2320e93fdbbe0aae0435893df8bae39e121c706 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sun, 19 Jan 2025 22:19:54 -0500 Subject: [PATCH] v3.0.0: implemented aura of protection minus the glyph sharing property --- .../assets/messages/actors/actors.properties | 2 +- .../shatteredpixeldungeon/actors/Char.java | 16 +++++++++++++++ .../actors/hero/spells/AuraOfProtection.java | 20 ++++++++++++++++++- .../items/armor/Armor.java | 11 +++++++++- 4 files changed, 46 insertions(+), 3 deletions(-) diff --git a/core/src/main/assets/messages/actors/actors.properties b/core/src/main/assets/messages/actors/actors.properties index 04a3cf286..6a480a520 100644 --- a/core/src/main/assets/messages/actors/actors.properties +++ b/core/src/main/assets/messages/actors/actors.properties @@ -566,7 +566,7 @@ actors.hero.abilities.ratmogrify$transmograt.rankings_desc=Slain by: ratmogrifie ##Cleric Spells actors.hero.spells.auraofprotection.name=aura of protection actors.hero.spells.auraofprotection.short_desc=Boosts defence for Paladin and nearby allies. -actors.hero.spells.auraofprotection.desc=The Paladin begins radiating protective energy for 20 turns. Any ally within 2 tiles of the Paladin (including themselves) takes %1$d%% less damage, and gains the effect of the Paladin's armor glyph at +%2$d%% power.\n\nThe power boost will always apply, but this spell cannot cause the Paladin's glyph to apply more than once if a character is already benefitting from it (e.g. the Paladin themselves, or a prismatic image). +actors.hero.spells.auraofprotection.desc=The Paladin begins radiating protective energy in a sparkling aura around themselves for 20 turns. Any ally within 2 tiles of the Paladin (including themselves) takes %1$d%% less damage, and gains the effect of the Paladin's armor glyph at +%2$d%% power.\n\nThis damage reduction takes place before other damage-reducing effects (e.g. armor). The glyph power boost will always apply, but this spell cannot cause the Paladin's glyph to apply more than once if a character is already benefitting from it (e.g. the Paladin themselves, or a prismatic image). actors.hero.spells.auraofprotection$aurabuff.name=aura of protection actors.hero.spells.auraofprotection$aurabuff.desc=The Paladin is radiating protective energy around themselves.\n\nAny nearby ally (including the Paladin themselves) takes reduced damage and gains the effect of the Paladin's armor glyph with boosted power.\n\nTurns Remaining: %s. diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java index 6d9d9230d..649b67e99 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java @@ -80,6 +80,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.duelist.Challenge; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.rogue.DeathMark; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.warrior.Endure; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.spells.AuraOfProtection; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.spells.GuidingLight; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.spells.ShieldOfLight; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Brute; @@ -438,6 +439,12 @@ public abstract class Char extends Actor { dmg *= 0.67f; } + if (Dungeon.hero.alignment == enemy.alignment + && Dungeon.level.distance(enemy.pos, Dungeon.hero.pos) <= 2 + && Dungeon.hero.buff(AuraOfProtection.AuraBuff.class) != null){ + dmg *= 0.925f - 0.075f*Dungeon.hero.pointsInTalent(Talent.AURA_OF_PROTECTION); + } + if (enemy.buff(MonkEnergy.MonkAbility.Meditate.MeditateResistance.class) != null){ dmg *= 0.2f; } @@ -737,6 +744,15 @@ public abstract class Char extends Actor { } } + //if dmg is from a character we already reduced it in defenseProc + if (!(src instanceof Char)) { + if (Dungeon.hero.alignment == alignment + && Dungeon.level.distance(pos, Dungeon.hero.pos) <= 2 + && Dungeon.hero.buff(AuraOfProtection.AuraBuff.class) != null) { + dmg *= 0.925f - 0.075f*Dungeon.hero.pointsInTalent(Talent.AURA_OF_PROTECTION); + } + } + Terror t = buff(Terror.class); if (t != null){ t.recover(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/spells/AuraOfProtection.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/spells/AuraOfProtection.java index eb3bbd939..f23f65b74 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/spells/AuraOfProtection.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/spells/AuraOfProtection.java @@ -21,15 +21,19 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.hero.spells; +import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FlavourBuff; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent; +import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.HolyTome; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; import com.shatteredpixel.shatteredpixeldungeon.ui.HeroIcon; +import com.watabou.noosa.audio.Sample; +import com.watabou.noosa.particles.Emitter; public class AuraOfProtection extends ClericSpell { @@ -57,7 +61,7 @@ public class AuraOfProtection extends ClericSpell { Buff.affect(hero,AuraBuff.class, AuraBuff.DURATION); - //TODO vfx/sfx + Sample.INSTANCE.play(Assets.Sounds.READ); hero.spend( 1f ); hero.busy(); @@ -71,6 +75,8 @@ public class AuraOfProtection extends ClericSpell { public static float DURATION = 20f; + private Emitter particles; + { type = buffType.POSITIVE; } @@ -80,6 +86,18 @@ public class AuraOfProtection extends ClericSpell { return BuffIndicator.PROT_AURA; } + @Override + public void fx(boolean on) { + if (on && (particles == null || particles.parent == null)){ + particles = target.sprite.emitter(); //emitter is much bigger than char so it needs to manage itself + particles.pos(target.sprite, -32, -32, 80, 80); + particles.fillTarget = false; + particles.pour(Speck.factory(Speck.LIGHT), 0.02f); + } else if (!on && particles != null){ + particles.on = false; + } + } + @Override public float iconFadePercent() { return Math.max(0, (DURATION - visualcooldown()) / DURATION); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java index 09e42d590..e2d2169f1 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java @@ -33,6 +33,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.spells.AuraOfProtection; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.spells.HolyWard; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.items.BrokenSeal; @@ -757,7 +758,15 @@ public class Armor extends EquipableItem { } public static float genericProcChanceMultiplier( Char defender ){ - return RingOfArcana.enchantPowerMultiplier(defender); + float multi = RingOfArcana.enchantPowerMultiplier(defender); + + if (Dungeon.hero.alignment == defender.alignment + && Dungeon.level.distance(defender.pos, Dungeon.hero.pos) <= 2 + && Dungeon.hero.buff(AuraOfProtection.AuraBuff.class) != null){ + multi += 0.25f + 0.25f*Dungeon.hero.pointsInTalent(Talent.AURA_OF_PROTECTION); + } + + return multi; } public String name() {