mr:wand_of_lightning_item
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| mr:wand_of_lightning_item [2025/12/25 18:23] – auto lint fix Mikhael | mr:wand_of_lightning_item [2026/04/08 20:00] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== mr: | ||
| + | |||
| + | Machine-readable reference page for Wand of Lightning item in Remixed Dungeon. | ||
| + | |||
| + | ==== Java Implementation ==== | ||
| + | |||
| + | **Class File:** | ||
| + | * File: [[https:// | ||
| + | * Package: com.watabou.pixeldungeon.items.wands | ||
| + | * Extends: SimpleWand | ||
| + | * Entity Kind: WandOfLightning | ||
| + | |||
| + | **Item Properties: | ||
| + | * Type: Wand (ranged magical weapon) | ||
| + | * Image: From items/ | ||
| + | * Rarity: Uncommon | ||
| + | * Charges: Starts with 3 charges, maximum of 8 | ||
| + | * Price: 50 gold when identified | ||
| + | |||
| + | ==== Code Implementation ==== | ||
| + | |||
| + | <code java> | ||
| + | package com.watabou.pixeldungeon.items.wands; | ||
| + | |||
| + | import com.nyrds.pixeldungeon.ml.R; | ||
| + | import com.nyrds.platform.util.StringsManager; | ||
| + | import com.watabou.noosa.Camera; | ||
| + | import com.watabou.pixeldungeon.Dungeon; | ||
| + | import com.watabou.pixeldungeon.ResultDescriptions; | ||
| + | import com.watabou.pixeldungeon.actors.Actor; | ||
| + | import com.watabou.pixeldungeon.actors.Char; | ||
| + | import com.watabou.pixeldungeon.effects.CellEmitter; | ||
| + | import com.watabou.pixeldungeon.effects.Lightning; | ||
| + | import com.watabou.pixeldungeon.effects.particles.SparkParticle; | ||
| + | import com.watabou.pixeldungeon.levels.Level; | ||
| + | import com.watabou.pixeldungeon.levels.traps.LightningTrap; | ||
| + | import com.watabou.pixeldungeon.scenes.GameScene; | ||
| + | import com.watabou.pixeldungeon.utils.GLog; | ||
| + | import com.watabou.pixeldungeon.utils.Utils; | ||
| + | import com.watabou.utils.Callback; | ||
| + | import com.watabou.utils.Random; | ||
| + | |||
| + | import java.util.ArrayList; | ||
| + | import java.util.Arrays; | ||
| + | import java.util.HashSet; | ||
| + | |||
| + | public class WandOfLightning extends SimpleWand | ||
| + | |||
| + | private final ArrayList< | ||
| + | |||
| + | private final int[] points = new int[20]; | ||
| + | private int nPoints; | ||
| + | |||
| + | @Override | ||
| + | protected void onZap( int cell, Char ch ) { | ||
| + | |||
| + | if ((getOwner() == Dungeon.hero) && !getOwner().isAlive()) { | ||
| + | Dungeon.fail( Utils.format( ResultDescriptions.getDescription(ResultDescriptions.Reason.WAND), | ||
| + | GLog.n(StringsManager.getVar(R.string.WandOfLightning_Info1)); | ||
| + | } | ||
| + | } | ||
| + | |||
| + | private void hit( Char ch, int damage ) { | ||
| + | |||
| + | if (damage < 1) { | ||
| + | return; | ||
| + | } | ||
| + | |||
| + | if (ch == Dungeon.hero) { | ||
| + | Camera.main.shake( 2, 0.3f ); | ||
| + | } | ||
| + | |||
| + | affected.add( ch ); | ||
| + | ch.damage( Dungeon.level.water[ch.getPos()] && !ch.isFlying() ? damage * 2 : damage, LightningTrap.LIGHTNING | ||
| + | |||
| + | ch.getSprite().centerEmitter().burst( SparkParticle.FACTORY, | ||
| + | ch.getSprite().flash(); | ||
| + | |||
| + | points[nPoints++] = ch.getPos(); | ||
| + | |||
| + | HashSet< | ||
| + | for (int i=0; i < Level.NEIGHBOURS8.length; | ||
| + | Char n = Actor.findChar( ch.getPos() + Level.NEIGHBOURS8[i] ); | ||
| + | if (n != null && !affected.contains( n )) { | ||
| + | ns.add( n ); | ||
| + | } | ||
| + | } | ||
| + | |||
| + | if (!ns.isEmpty()) { | ||
| + | hit( Random.element( ns ), Random.Int( damage / 2, damage ) ); | ||
| + | } | ||
| + | } | ||
| + | |||
| + | @Override | ||
| + | protected void fx( int cell, Callback callback ) { | ||
| + | |||
| + | nPoints = 0; | ||
| + | points[nPoints++] = getOwner().getPos(); | ||
| + | |||
| + | Char ch = Actor.findChar( cell ); | ||
| + | if (ch != null) { | ||
| + | affected.clear(); | ||
| + | int lvl = effectiveLevel(); | ||
| + | hit( ch, Random.Int( 5 + lvl / 2, 10 + lvl ) ); | ||
| + | } else { | ||
| + | points[nPoints++] = cell; | ||
| + | CellEmitter.center( cell ).burst( SparkParticle.FACTORY, | ||
| + | } | ||
| + | GameScene.addToMobLayer(new Lightning(Arrays.copyOfRange(points, | ||
| + | } | ||
| + | |||
| + | @Override | ||
| + | public String desc() { | ||
| + | return StringsManager.getVar(R.string.WandOfLightning_Info); | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==== Key Properties from Code ==== | ||
| + | |||
| + | **Damage Calculation: | ||
| + | * Base damage: Random.Int(5 + lvl/2, 10 + lvl) where lvl is effective wand level | ||
| + | * Chain damage: Random.Int(damage/ | ||
| + | * Water bonus: Damage doubled if target is in water and not flying | ||
| + | |||
| + | **Chain Lightning Mechanics: | ||
| + | * Hits primary target, then chains to adjacent enemies | ||
| + | * Uses recursive hit() method to find next target | ||
| + | * Tracks affected characters to avoid hitting same target twice | ||
| + | * Maximum chain range: 8 neighboring cells (Level.NEIGHBOURS8) | ||
| + | * Maximum lightning points tracked: 20 | ||
| + | |||
| + | **Visual Effects:** | ||
| + | * Lightning effect rendered via GameScene.addToMobLayer() | ||
| + | * Spark particles emitted on hit (3 particles per target) | ||
| + | * Camera shake effect when hero is hit (2 intensity, 0.3f duration) | ||
| + | * Target sprite flashes on hit | ||
| + | |||
| + | ==== String Resources ==== | ||
| + | |||
| + | **English (values/ | ||
| + | * WandOfLightning_Name - "Wand of Lightning" | ||
| + | * WandOfLightning_Info - "This wand conjures forth deadly arcs of electricity, | ||
| + | * WandOfLightning_Info1 - "You zapped yourself with your own Wand of Lightning..." | ||
| + | * WandOfLightning_Gender - " | ||
| + | |||
| + | **Russian (values-ru/ | ||
| + | * WandOfLightning_Name - Russian item name | ||
| + | * WandOfLightning_Info - Russian description | ||
| + | * WandOfLightning_Info1 - Russian self-zap message | ||
| + | * WandOfLightning_Gender - Russian gender | ||
| + | |||
| + | ==== Acquisition ==== | ||
| + | |||
| + | **Primary Source:** | ||
| + | * Found in dungeon chests | ||
| + | * Available in shops | ||
| + | * Dropped by certain enemies | ||
| + | |||
| + | ==== Mechanics ==== | ||
| + | |||
| + | **Charge-Based: | ||
| + | * Uses charges for each zap (typically 1 charge per use) | ||
| + | * Gradually regains charges over time | ||
| + | |||
| + | **Multi-Target Damage:** | ||
| + | * Excellent against groups of enemies due to chain effect | ||
| + | * Good for clearing rooms filled with weak enemies | ||
| + | * Effective against enemies positioned in clusters | ||
| + | |||
| + | **Self-Damage Risk:** | ||
| + | * Can damage the user if targeting fails | ||
| + | * Death from own wand triggers failure message | ||
| + | |||
| + | **Water Interaction: | ||
| + | * Deals double damage to targets in water | ||
| + | * Does not affect flying targets | ||
| + | |||
| + | ==== Strategy ==== | ||
| + | |||
| + | * Excellent against groups of enemies due to chain effect | ||
| + | * Good for clearing rooms filled with weak enemies | ||
| + | * Effective against enemies positioned in clusters | ||
| + | * Conserve charges for critical group situations | ||
| + | * Use in water-filled areas for maximum damage | ||
| + | |||
| + | ==== Related Entities ==== | ||
| + | |||
| + | **Related Items:** | ||
| + | * [[mr: | ||
| + | * [[mr: | ||
| + | * [[mr: | ||
| + | |||
| + | **Related Traps:** | ||
| + | * [[mr: | ||
| + | |||
| + | ==== Wiki Pages ==== | ||
| + | |||
| + | **English: | ||
| + | * [[en: | ||
| + | |||
| + | **Russian: | ||
| + | * [[ru: | ||
| + | |||
| + | ==== Code References ==== | ||
| + | |||
| + | * Item implementation: | ||
| + | * Parent class: [[https:// | ||
| + | * Registration: | ||
| + | * String resources: [[https:// | ||
| + | |||
| + | {{tag> mr items wands lightning magic chain_lightning reference machine-readable}} | ||
