43 lines
1.5 KiB
Markdown
43 lines
1.5 KiB
Markdown
# Consumable Items (Potions) Implementation
|
|
|
|
## Objective
|
|
|
|
Implement a consumable item system to provide immediate effects or short-term buffs during battle.
|
|
|
|
## Features
|
|
|
|
### 1. New Item Type: Consumables
|
|
|
|
- Category: `EquipmentSlot.consumable`
|
|
- Items:
|
|
1. **Healing Potion**: Restores HP immediately.
|
|
2. **Ironskin Potion (Armor)**: Grants Armor immediately.
|
|
3. **Strength Potion**: Grants "Attack Up" buff for 1 turn.
|
|
|
|
### 2. Battle Mechanics
|
|
|
|
- **Usage**: Consumables can be used from the inventory during the player's turn.
|
|
- **Action Cost**: Usage is a **Free Action** (does not consume the turn). Players can use a potion and then Attack/Defend in the same turn.
|
|
- **Effects**:
|
|
- **Heal**: `hp += value` (capped at maxHp)
|
|
- **Armor**: `armor += value`
|
|
- **Buff**: Apply `StatusEffectType.attackUp` (increases damage by 20% or flat amount).
|
|
|
|
### 3. Shop Update
|
|
|
|
- Shop now stocks **6 items** total:
|
|
- 4 Equipment (Weapons/Shields/Armor/Accessories)
|
|
- 2 Consumables (Potions)
|
|
|
|
### 4. UI Updates
|
|
|
|
- **Battle Controls**: Added an "Items" button (Bag icon) to open the battle inventory.
|
|
- **Shop UI**: Updated to display and sell consumable items.
|
|
- **Battle Inventory**: A dialog to view and use owned consumable items.
|
|
|
|
## Technical Details
|
|
|
|
- `Item` model updated to handle `hpBonus` (Heal), `armorBonus` (Armor), and `effects` (Buffs) for consumables.
|
|
- `BattleProvider.useItem(Item)` implements the application logic.
|
|
- `CombatCalculator` logic handles the `Attack Up` status effect multiplier.
|