User Tools

Site Tools


mr:shield_class

Shield Class - Machine Reference

This page contains machine-readable reference information about the Shield mechanics for automated tools and AI assistants. Shields are fully implemented via Lua scripts using the shields library (no Java Shield class exists).

Entity Information

  • Entity Type: Armor (Off-hand/Left Hand)
  • Implementation: Lua (shields library)
  • Parent Class: Armor (Java base for all armor)
  • Equip Slot: left_hand (Belongings.Slot.LEFT_HAND)
  • Package: com.watabou.pixeldungeon.items.armor (base Armor class)

Java Implementation

  • Base Armor Class: Armor.java
  • Shield Logic: Implemented in Lua via shields.lua
  • Slot: Belongings.Slot.LEFT_HAND

Shield Mechanics

  • Block Chance: Based on shield level and hero's STR
  • Block Amount: Based on shield level and item level
  • Recharge Time: Time between blocks, affected by STR penalty
  • Wait After Block: Additional delay after blocking
  • Upgradeable: Can be upgraded with Upgrade Scrolls
  • Tier/Level: Shield level determines base stats (1-4+)

Known Shield Implementations

Shield Buff System

  • When equipped in left_hand, applies ShieldLeft buff
  • When equipped as weapon (two-handed), applies ShieldRight buff
  • Buff level matches shield level
  • Buff source is the shield item

Lua Implementation Pattern

Most shields are implemented in Lua using the shields library:

  • Library: shields.lua
  • makeShield(shieldLevel, shieldDesc, shieldBuff) - Creates shield configuration
  • Typical shieldLevel: 1-4 (Wooden=1, Tough=2, Strong=3, Royal=4)
  • Price formula: 20 * shieldLevel

Drop Configuration

  • Treasury.json: SHIELD category with weights (WoodenShield=1, ToughShield=0.5, StrongShield=0.25, RoyalShield=0.125)
  • SpidersTreasury.json: Same shield drop rates

Code References

String Resources

  • Name pattern: [ShieldName]_Name (e.g., WoodenShield_Name, ToughShield_Name)
  • Description pattern: [ShieldName]_Desc (e.g., WoodenShield_Desc, ToughShield_Desc)
  • English: strings_all.xml
mr/shield_class.txt · Last modified: by 127.0.0.1