Repository navigation
Shields
The shield system is introduced as part of Sprint 2 to allow the player to block incoming damage. It is implemented as a piece of loot that the player finds and picks up in the world, and it works with the existing player combat and health systems rather than replacing them.
Unlike stackable loot such as potions or weapons, a shield doesn't take up an inventory slot when collected. Picking one up grants it directly to the player, the same way gold is collected, so a full inventory never prevents the player from picking up a shield.
When the shield is activated using the B key:
- incoming damage can be blocked
- the shield remains active for 30 seconds
- the shield expires automatically once its duration ends
- damage returns to normal once the shield is no longer active
Activation only succeeds if the player is currently holding a shield and doesn't already have one active — pressing B with no shield held, or while a shield is already running, has no effect. Once activated, a shield is consumed; the player needs to pick up another one to use it again.
The shield system is connected to the player's combat and health components, and is designed to work alongside other effects without replacing the existing combat system.
The shield functionality was tested for:
- shield activation
- blocking incoming damage
- shield duration
- shield expiry
- behaviour when no shield is active
These tests confirm that a shield can only be activated when one is held, damage is fully blocked while active, the shield deactivates automatically once its 30-second duration ends, and that pressing the activation key with no shield held is safely ignored.