mr:scroll_of_lullaby_item
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| mr:scroll_of_lullaby_item [2026/02/25 13:36] – Improve mr: namespace pages with entity usage analysis Qwen Assistant | mr:scroll_of_lullaby_item [2026/02/25 13:41] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Scroll Of Lullaby Item - Code References ====== | ||
| + | |||
| + | {{ rpd: | ||
| + | |||
| + | ===== Java Classes ===== | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | |||
| + | ===== Java Class Content ===== | ||
| + | <code java> | ||
| + | package com.watabou.pixeldungeon.items.scrolls; | ||
| + | |||
| + | import com.nyrds.pixeldungeon.ml.R; | ||
| + | import com.nyrds.platform.audio.Sample; | ||
| + | import com.nyrds.platform.util.StringsManager; | ||
| + | import com.watabou.pixeldungeon.Assets; | ||
| + | import com.watabou.pixeldungeon.actors.Char; | ||
| + | import com.watabou.pixeldungeon.actors.buffs.Buff; | ||
| + | import com.watabou.pixeldungeon.actors.buffs.Sleep; | ||
| + | import com.watabou.pixeldungeon.actors.mobs.Mob; | ||
| + | import com.watabou.pixeldungeon.effects.Speck; | ||
| + | import com.watabou.pixeldungeon.levels.Level; | ||
| + | import com.watabou.pixeldungeon.utils.GLog; | ||
| + | import com.watabou.pixeldungeon.utils.Utils; | ||
| + | import org.jetbrains.annotations.NotNull; | ||
| + | |||
| + | public class ScrollOfLullaby extends Scroll { | ||
| + | |||
| + | @Override | ||
| + | protected void doRead(@NotNull Char reader) { | ||
| + | reader.getSprite().centerEmitter().start( Speck.factory( Speck.NOTE ), 0.3f, 5 ); | ||
| + | Sample.INSTANCE.play( Assets.SND_LULLABY ); | ||
| + | |||
| + | int count = 0; | ||
| + | Mob affected = null; | ||
| + | Level level = reader.level(); | ||
| + | for (Mob mob : level.getCopyOfMobsArray()) { | ||
| + | if (level.fieldOfView[mob.getPos()]) { | ||
| + | Buff.affect( mob, Sleep.class ); | ||
| + | if (mob.hasBuff( Sleep.class )) { | ||
| + | affected = mob; | ||
| + | count++; | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | |||
| + | switch (count) { | ||
| + | case 0: | ||
| + | GLog.i(StringsManager.getVar(R.string.ScrollOfLullaby_Info1)); | ||
| + | break; | ||
| + | case 1: | ||
| + | GLog.i(Utils.format(R.string.ScrollOfLullaby_Info2, | ||
| + | break; | ||
| + | default: | ||
| + | GLog.i(StringsManager.getVar(R.string.ScrollOfLullaby_Info3)); | ||
| + | } | ||
| + | setKnown(); | ||
| + | |||
| + | reader.spend( TIME_TO_READ ); | ||
| + | } | ||
| + | |||
| + | @Override | ||
| + | public int price() { | ||
| + | return isKnown() ? 50 * quantity() : super.price(); | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ===== JSON Configuration ===== | ||
| + | * [[https:// | ||
| + | |||
| + | ===== String Resources ===== | ||
| + | <code xml> | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | </ | ||
| + | |||
| + | ===== Lua Scripts ===== | ||
| + | This entity is implemented in Java, no Lua script exists | ||
| + | |||
| + | ===== Usage in Code ===== | ||
| + | * Registered in ItemFactory: | ||
| + | * Listed in Scroll.java for common scrolls: [[https:// | ||
| + | * Succubus has 5% chance to drop: [[https:// | ||
| + | |||
| + | ===== Effect ===== | ||
| + | * Puts all visible enemies to sleep | ||
| + | * Applies Sleep buff to affected mobs | ||
| + | * Has sound effect: Assets.SND_LULLABY | ||
| + | * Price: 50 gold when known | ||
| + | |||
| + | ===== Related mr Entities ===== | ||
| + | * [[mr: | ||
| + | * [[mr: | ||
| + | * [[mr: | ||
mr/scroll_of_lullaby_item.txt · Last modified: by 127.0.0.1
