====== Armor Buff - Code References ====== ===== Java Classes ===== * [[https://github.com/NYRDS/remixed-dungeon/blob/master/RemixedDungeon/src/main/java/com/watabou/pixeldungeon/plants/Plant.java|Plant.java]] (base plant class) * [[https://github.com/NYRDS/remixed-dungeon/blob/master/RemixedDungeon/src/main/java/com/nyrds/pixeldungeon/levels/objects/LevelObjectsFactory.java|LevelObjectsFactory.java]] (registers Earthroot plant) ===== JSON Configuration ===== This entity is implemented via Lua scripts, no JSON configuration exists for the buff itself. ===== String Resources ===== Armor Herbal armor Roots have sprouted from the ground providing natural armor. ===== Lua Scripts ===== * Plant script: [[https://github.com/NYRDS/remixed-dungeon/blob/master/RemixedDungeon/src/main/assets/scripts/plants/Earthroot.lua|scripts/plants/Earthroot.lua]] - Applies Armor buff on contact * Buff script: [[https://github.com/NYRDS/remixed-dungeon/blob/master/RemixedDungeon/src/main/assets/scripts/buffs/Armor.lua|scripts/buffs/Armor.lua]] - Armor buff implementation ===== Buff Properties (from scripts/buffs/Armor.lua) ===== * ''icon = 20'' - BuffIndicator.ARMOR * ''name = "EarthrootBuff_Name"'' - String resource for name * ''info = "EarthrootBuff_Info"'' - String resource for description * ''level'' - Stores the damage absorption amount (set to character's HT when applied) * ''pos'' - Stores the position where the buff was applied ===== Buff Implementation ===== act = function(self, buff) local target = buff.target local pos = self.data and self.data.pos if target:getPos() ~= pos then buff:detach() end buff:spend(1) -- STEP end, defenceProc = function(self, buff, enemy, damage) local lvl = buff:level() if damage >= lvl then buff:detach() return damage - lvl else buff:level(lvl - damage) return 0 end end ===== Buff Behavior ===== * Applied when a character steps on an [[mr:earthroot_plant|Earthroot]] plant * Level is set to the character's HT (hit points) when applied * 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:earthroot_plant|Earthroot (Plant)]] * [[mr:barkskin_buff|Barkskin (Buff)]] {{tag> mr buffs armor reference machine-readable}}