mr:levitation_buff
Table of Contents
Levitation Buff - Code References
Java Classes
com/watabou/pixeldungeon/actors/buffs/Levitation.java- Main buff implementation- Extends: FlavourBuff
Java Class Content
package com.watabou.pixeldungeon.actors.buffs; import com.watabou.pixeldungeon.Dungeon; import com.watabou.pixeldungeon.actors.Char; import com.watabou.pixeldungeon.sprites.CharSprite; import com.watabou.pixeldungeon.ui.BuffIndicator; import org.jetbrains.annotations.NotNull; public class Levitation extends FlavourBuff { public static final float DURATION = 20f; @Override public boolean attachTo(@NotNull Char target ) { if (super.attachTo( target )) { Roots.detach( target, Roots.class ); return true; } else { return false; } } @Override public void detach() { super.detach(); if(Dungeon.level != null) { Dungeon.level.press(target.getPos(), target); } } @Override public int icon() { return BuffIndicator.LEVITATION; } @Override public CharSprite.State charSpriteStatus() { return CharSprite.State.LEVITATING; } }
Key Constants
- Duration:
DURATION = 20f(20 turns) - Buff Indicator:
BuffIndicator.LEVITATION = 5 - Sprite State:
CharSprite.State.LEVITATING
JSON Configuration
No dedicated JSON configuration file found. Buff is implemented entirely in Java.
String Resources
English (values/strings_all.xml):
<string name="LevitationBuff_Name">Levitating</string> <string name="LevitationBuff_Info">The body hovers above the ground, avoiding traps and other earthly dangers.</string> <string name="PotionOfLevitation_Name">Potion of Levitation</string> <string name="PotionOfLevitation_Info">Drinking this odd substance allows you to hover, effortlessly floating over traps. Fire and gasses fill the air, however, and cannot be passed while hovering.</string>
Russian (values-ru/strings_all.xml):
<string name="LevitationBuff_Name">Левитация</string> <string name="LevitationBuff_Info">Тело парит над землёй, избегая ловушек и других опасностей.</string> <string name="PotionOfLevitation_Name">Зелье Левитации</string> <string name="PotionOfLevitation_Info">Выпив эту занятную субстанцию ты обретёшь способность парить над поверхностью, минуя ловушки. Однако огонь и газы заполняют объём, и облететь их не получится.</string>
Lua Scripts
No Lua script implementation. This buff is implemented entirely in Java.
Usage in Code
Applied by:
- PotionOfLevitation.java - Drinking the potion
- Various spells and abilities
Key behaviors:
- Detaches
Rootsbuff when attached (viaRoots.detach()) - Calls
Dungeon.level.press()when detached (may trigger floor effects) - Sets sprite state to
CharSprite.State.LEVITATING - Uses
BuffIndicator.LEVITATIONfor UI icon
Related Buffs
- Roots Buff - Counteracted by Levitation
- Flavour Buff - Parent class
- Potion of Levitation - Primary source
See Also
mr/levitation_buff.txt · Last modified: by 127.0.0.1
