From f8c94e298979f5f937791d32ede358e8aeb0362a Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sat, 17 Mar 2018 23:45:04 -0400 Subject: [PATCH] v0.6.4: significantly nerfed paralysis, now is easier to snap out of --- .../shatteredpixeldungeon/actors/Char.java | 7 +-- .../actors/blobs/Electricity.java | 5 ++ .../actors/blobs/ParalyticGas.java | 5 ++ .../actors/buffs/Paralysis.java | 49 ++++++++++++++++++- .../messages/actors/actors.properties | 2 +- 5 files changed, 60 insertions(+), 8 deletions(-) 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 1535e6560..c1add998d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java @@ -302,12 +302,7 @@ public abstract class Char extends Actor { } if (buff( Paralysis.class ) != null) { - if (Random.Int( dmg ) >= Random.Int( HP )) { - Buff.detach( this, Paralysis.class ); - if (Dungeon.level.heroFOV[pos]) { - GLog.i( Messages.get(Char.class, "out_of_paralysis", name) ); - } - } + buff( Paralysis.class ).processDamage(dmg); } //FIXME: when I add proper damage properties, should add an IGNORES_SHIELDS property to use here. diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Electricity.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Electricity.java index 78b6bada5..ca881513c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Electricity.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Electricity.java @@ -38,6 +38,11 @@ import com.watabou.utils.Random; public class Electricity extends Blob { + { + //acts after mobs, to give them a chance to resist paralysis + actPriority = MOB_PRIO - 1; + } + private boolean[] water; @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/ParalyticGas.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/ParalyticGas.java index cf22e6132..f5518253e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/ParalyticGas.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/ParalyticGas.java @@ -32,6 +32,11 @@ import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; public class ParalyticGas extends Blob { + { + //acts after mobs, to give them a chance to resist paralysis + actPriority = MOB_PRIO - 1; + } + @Override protected void evolve() { super.evolve(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Paralysis.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Paralysis.java index b0df47146..18c6de55e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Paralysis.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Paralysis.java @@ -21,11 +21,14 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.buffs; +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; -import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite; import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; +import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; +import com.watabou.utils.Bundle; +import com.watabou.utils.Random; public class Paralysis extends FlavourBuff { @@ -45,6 +48,21 @@ public class Paralysis extends FlavourBuff { } } + public void processDamage( int damage ){ + if (target == null) return; + ParalysisResist resist = target.buff(ParalysisResist.class); + if (resist == null){ + resist = Buff.affect(target, ParalysisResist.class); + } + resist.damage += damage; + if (Random.NormalIntRange(0, resist.damage) >= Random.NormalIntRange(0, target.HP)){ + detach(); + if (Dungeon.level.heroFOV[target.pos]) { + GLog.i( Messages.get(this, "out", target.name) ); + } + } + } + @Override public void detach() { super.detach(); @@ -81,4 +99,33 @@ public class Paralysis extends FlavourBuff { public static float duration( Char ch ) { return DURATION; } + + public static class ParalysisResist extends Buff { + + private int damage; + + @Override + public boolean act() { + if (target.buff(Paralysis.class) == null) { + damage -= Math.ceil(damage / 10f); + if (damage >= 0) detach(); + } + spend(TICK); + return true; + } + + private static final String DAMAGE = "damage"; + + @Override + public void storeInBundle(Bundle bundle) { + super.storeInBundle(bundle); + damage = bundle.getInt(DAMAGE); + } + + @Override + public void restoreFromBundle(Bundle bundle) { + super.restoreFromBundle(bundle); + bundle.put( DAMAGE, damage ); + } + } } diff --git a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/actors/actors.properties b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/actors/actors.properties index 70bff797a..1f2ce3e58 100644 --- a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/actors/actors.properties +++ b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/actors/actors.properties @@ -171,6 +171,7 @@ actors.buffs.ooze.desc=This sticky acid clings to flesh, slowly melting it away. actors.buffs.paralysis.name=Paralysed actors.buffs.paralysis.heromsg=You are paralysed! +actors.buffs.paralysis.out=The pain snaps %s out of paralysis. actors.buffs.paralysis.desc=Oftentimes the worst thing to do is nothing at all.\n\nParalysis completely halts all actions, forcing the target to wait until the effect wears off. The pain from taking damage can also cause characters to snap out of paralysis.\n\nTurns of paralysis remaining: %s. actors.buffs.poison.name=Poisoned @@ -555,5 +556,4 @@ actors.mobs.yog$larva.desc=Yog-Dzewa is an Old God, a powerful entity from the r actors.char.kill=%s killed you... actors.char.defeat=You defeated %s. -actors.char.out_of_paralysis=The pain snapped %s out of paralysis. actors.char.def_verb=dodged