From 73129585e9f5f890d91b7ed16d9d715c8636811a Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Thu, 29 Aug 2024 15:11:36 -0400 Subject: [PATCH] v2.5.0: cleaned up drowsy code, added duration to desc --- .../assets/messages/actors/actors.properties | 2 +- .../actors/buffs/Drowsy.java | 18 ++---------------- .../items/scrolls/ScrollOfLullaby.java | 4 ++-- 3 files changed, 5 insertions(+), 19 deletions(-) diff --git a/core/src/main/assets/messages/actors/actors.properties b/core/src/main/assets/messages/actors/actors.properties index 53c869af3..8ff9ccff9 100644 --- a/core/src/main/assets/messages/actors/actors.properties +++ b/core/src/main/assets/messages/actors/actors.properties @@ -189,7 +189,7 @@ actors.buffs.dread.name=dread actors.buffs.dread.desc=A terror so great that it will cause its target to flee the dungeon entirely!\n\nCreatures affected by dread will run from their opponent at high speed, and will disappear from the dungeon entirely once they are out of sight. Enemies that are defeated this way award half experience and drop no items. The shock of pain will lessen the duration of dread.\n\nTurns of dread remaining: %d. actors.buffs.drowsy.name=drowsy -actors.buffs.drowsy.desc=A magical force is making it difficult to stay awake.\n\nThe hero can resist drowsiness by taking damage or by being at full health.\n\nAfter a few turns, the target will fall into a deep magical sleep. +actors.buffs.drowsy.desc=A magical force is making it difficult to stay awake, after a few turns, the target will fall into a deep magical sleep.\n\nThe hero can resist drowsiness by taking damage or by being at full health.\n\nTurns until sleep: %s. actors.buffs.earthimbue.name=imbued with earth actors.buffs.earthimbue.desc=You are imbued with the power of earth!\n\nAll physical attacks will shift the earth under the enemy, crippling them for a short time.\n\nTurns of earth imbue remaining: %s. diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Drowsy.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Drowsy.java index 86a5409b3..84f72af17 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Drowsy.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Drowsy.java @@ -22,10 +22,9 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.buffs; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; -import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; -public class Drowsy extends Buff { +public class Drowsy extends FlavourBuff { public static final float DURATION = 5f; @@ -44,16 +43,8 @@ public class Drowsy extends Buff { return Math.max(0, (DURATION - visualcooldown()) / DURATION); } - @Override - public String iconTextDisplay() { - return Integer.toString((int)visualcooldown()); - } - public boolean attachTo(Char target ) { if (!target.isImmune(Sleep.class) && super.attachTo(target)) { - if (cooldown() == 0) { - spend(DURATION); - } return true; } return false; @@ -63,12 +54,7 @@ public class Drowsy extends Buff { public boolean act(){ Buff.affect(target, MagicalSleep.class); - detach(); - return true; + return super.act(); } - @Override - public String desc() { - return Messages.get(this, "desc", dispTurns(visualcooldown())); - } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfLullaby.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfLullaby.java index abae60cca..c244dde34 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfLullaby.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfLullaby.java @@ -47,12 +47,12 @@ public class ScrollOfLullaby extends Scroll { for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) { if (Dungeon.level.heroFOV[mob.pos]) { - Buff.affect( mob, Drowsy.class ); + Buff.affect( mob, Drowsy.class, Drowsy.DURATION ); mob.sprite.centerEmitter().start( Speck.factory( Speck.NOTE ), 0.3f, 5 ); } } - Buff.affect( curUser, Drowsy.class ); + Buff.affect( curUser, Drowsy.class, Drowsy.DURATION ); GLog.i( Messages.get(this, "sooth") );