User Tools

Site Tools


mr:armor_buff

Armor Buff - Code References

Java Classes

JSON Configuration

This entity is implemented via Lua scripts, no JSON configuration exists for the buff itself.

String Resources

<string name="Earthroot_ArmorBuff">Armor</string>
<string name="EarthrootBuff_Name">Herbal armor</string>
<string name="EarthrootBuff_Info">Roots have sprouted from the ground providing natural armor.</string>

Lua Scripts

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 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
mr/armor_buff.txt · Last modified: by 127.0.0.1