mr:armor_buff
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| mr:armor_buff [2025/12/25 18:23] – auto lint fix Mikhael | mr:armor_buff [2026/04/04 12:03] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Armor Buff - Code References ====== | ||
| + | |||
| + | ===== Java Classes ===== | ||
| + | * [[https:// | ||
| + | |||
| + | ===== JSON Configuration ===== | ||
| + | This entity is implemented in Java, no JSON configuration exists | ||
| + | |||
| + | ===== String Resources ===== | ||
| + | <code xml> | ||
| + | <string name=" | ||
| + | </ | ||
| + | |||
| + | ===== Lua Scripts ===== | ||
| + | This entity is implemented in Java, no Lua script exists | ||
| + | |||
| + | ===== Buff Properties (from Earthroot.Armor) ===== | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | ===== Buff Implementation ===== | ||
| + | <code java> | ||
| + | public static class Armor extends Buff { | ||
| + | private static final float STEP = 1f; | ||
| + | |||
| + | @Packable | ||
| + | public int pos; | ||
| + | @Packable | ||
| + | public int level; | ||
| + | |||
| + | @Override | ||
| + | public boolean attachTo(@NotNull Char target) { | ||
| + | pos = target.getPos(); | ||
| + | return super.attachTo(target); | ||
| + | } | ||
| + | |||
| + | @Override | ||
| + | public boolean act() { | ||
| + | if (target.getPos() != pos) { | ||
| + | detach(); | ||
| + | } | ||
| + | spend(STEP); | ||
| + | return true; | ||
| + | } | ||
| + | |||
| + | public int absorb(int damage) { | ||
| + | if (damage >= level) { | ||
| + | detach(); | ||
| + | return damage - level; | ||
| + | } else { | ||
| + | level -= damage; | ||
| + | return 0; | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ===== Buff Behavior ===== | ||
| + | * Applied when a character steps on an [[mr: | ||
| + | * Level is set to the character' | ||
| + | * Absorbs incoming damage up to the level amount | ||
| + | * Detaches if the character moves from the position where it was applied | ||
| + | * Detaches after absorbing damage equal to or greater than its level | ||
| + | |||
| + | ===== Related mr Entities ===== | ||
| + | * [[mr: | ||
| + | * [[mr: | ||
