Files
UE5-Modular-Game-Framework/docs/blueprints/08-weapons/79_BPC_ShieldDefenseSystem.md

63 lines
2.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# BPC_ShieldDefenseSystem — Actor Component
> **⚡ C++ Status: Stub** — `Source/PG_Framework/Public/Weapons/BPC_ShieldDefenseSystem.h` provides the UCLASS shell, `ShieldHealth`, `MaxShieldHealth`, `BlockAngle`, `bShieldBroken`. **The C++ stub has NO gameplay logic.** **Create a BP child** and build ALL logic: shield raise/lower, block detection, damage reduction while blocking, break effect, stamina drain. Attach to player pawn. See `docs/developer/cpp-integration-guide.md`.
>
> ---
**File:** [`Content/Framework/Weapons/BPC_ShieldDefenseSystem`](Content/Framework/Weapons/BPC_ShieldDefenseSystem.uasset)
**Parent Class:** `UActorComponent`
**Dependencies:** [`BPC_DamageReceptionSystem`](BPC_DamageReceptionSystem.md), [`BPC_StaminaSystem`](../02-player/09_BPC_StaminaSystem.md)
**Purpose:** Manages defensive tools: shields, blocking, parrying. Works in both melee and ranged defense contexts.
---
## Variables
| Name | Type | Description |
|------|------|-------------|
| `bIsBlocking` | Bool | Block active |
| `BlockDamageReduction` | Float | % reduction while blocking (0.01.0) |
| `ParryWindow` | Float | Perfect parry timing window in seconds |
| `ShieldDurability` | Float | Current shield durability (0 = broken) |
| `MaxShieldDurability` | Float | Maximum durability |
| `BlockAngle` | Float | Max angle from forward vector for block to cover |
| `StaminaCostPerBlock` | Float | Stamina drain per blocked hit |
| `bCanParry` | Bool | Whether parry mechanic is enabled |
## Functions / Events
| Name | Inputs | Outputs | What it does |
|------|--------|---------|--------------|
| `BeginBlock` | — | — | Raises shield, starts blocking |
| `EndBlock` | — | — | Lowers shield, ends blocking |
| `ProcessHit` | Damage: S_DamageEvent | Bool (blocked) | Evaluates if hit was blocked or parried |
| `TryParry` | — | Bool | Checks if parry window is active |
| `BreakShield` | — | — | Reduces durability to 0, triggers break anim |
## Event Dispatchers
| Name | Parameters | Fired when |
|------|-----------|-----------|
| `OnBlockStarted` | — | Shield raised |
| `OnBlockEnded` | — | Shield lowered |
| `OnHitBlocked` | Damage: S_DamageEvent | Incoming hit blocked |
| `OnHitParried` | Instigator: Actor | Perfect parry executed |
| `OnShieldBroken` | — | Durability reaches 0 |
---
## Communications With
| Target System | Method | Why |
|---------------|--------|-----|
| `BPC_DamageReceptionSystem` | Interface hook | Intercepts incoming damage |
| `BPC_StaminaSystem` | Direct `ConsumeStamina` | Stamina cost per block |
| `BPC_HitReactionSystem` | Direct | Triggers parry follow-up window |
| `ABP_PlayerBody` | Animation Notify | Block/parry animation states |
## Reuse Notes
- ParryWindow drives a perfect-parry mechanic; set to 0 to disable parries
- BlockDamageReduction is per-shield from DA_WeaponData or DA_EquipmentConfig
- Shield durability adds wear mechanic; set MaxShieldDurability to 0 for indestructible shields