# Bleeding Logic and Item Selling Fixes

## 1. Magic Item Prefix Chance
- **Issue:** Users felt that magic items often lacked prefixes, making them indistinguishable from normal items in terms of stats.
- **Fix:** Increased `ItemConfig.magicPrefixChance` from `0.5` (50%) to `1.0` (100%). Now, all items generated with `ItemRarity.magic` will guaranteed have a prefix (and associated stat boost).

## 2. Enemy Bleed Damage Bug
- **Issue:** Enemies were applying bleed to players, but when enemies themselves were bleeding, they took no damage at the start of their turn.
- **Fix:** Updated `BattleProvider._startEnemyTurn` to properly call `_processStartTurnEffects(enemy)`. This ensures that bleed damage is calculated and applied to the enemy's HP, and stun status is checked correctly.

## 3. Item Selling Price UI
- **Issue:** The "Sell Item" confirmation dialog displayed the item's *base price* instead of the actual *selling price* (which is 60% of base). This confused players into thinking they were getting full price, or that the system was broken when they received less gold.
- **Fix:** Updated `InventoryGridWidget` (`_showItemActionDialog` and `_showSellConfirmationDialog`) to calculate and display the final sell price: `floor(item.price * GameConfig.sellPriceMultiplier)`.

## 4. Bleed Application Logic
- **Issue:** Bleed status was being applied even when an attack was fully blocked by armor (0 HP damage).
- **Change:** Modified `BattleProvider._tryApplyStatusEffects` and its call site in `_processAttackImpact`.
- **New Logic:** Bleed status is now only applied if `damageToHp > 0`. If an attack is fully absorbed by armor, bleed will not be applied.
- **Note:** Once applied, bleed damage (at start of turn) continues to ignore armor and directly reduces HP, regardless of how much armor the target gains afterwards.

## 5. Dynamic Attack Animation Images
- **Feature:** Added support for changing character images during attack animation phases (Start, Middle, End).
- **Implementation:**
  - Modified `BattleAnimationWidget` to accept callbacks for `onAnimationStart`, `onAnimationMiddle`, and `onAnimationEnd`.
  - Updated `BattleScreen` to manage animation phase state and pass override images to `CharacterStatusCard`.
  - Configured phase logic:
    - **Risky:** Start -> ScaleUp -> Middle -> Dash -> End -> Impact.
    - **Safe/Normal:** Start -> Middle -> Impact (No End phase).
- **Assets:** Applied `warrior_attack_1.png` for Start and `warrior_attack_2.png` for End phases.

## 6. Story Screen & Navigation
- **Feature:** Added a `StoryScreen` sequence after character selection and before the main game.
- **Details:** 3-page PageView with "Next" and "Skip" buttons. Uses `ResponsiveContainer` and consistent styling.
- **Navigation:** `CharacterSelectionScreen` -> `StoryScreen` -> `MainWrapper`.

## 7. Player Image & UI Fixes
- **Fix:** Corrected `PlayerTemplate.createCharacter` to pass the image path properly.
- **Fix:** Added logic in `BattleProvider.loadFromSave` to force update the player's image path from the latest data, fixing issues with old save files.
- **Refactor:** Extracted hardcoded UI constants in `CharacterStatusCard` to `ThemeConfig`.

## Files Changed
- `lib/game/config/item_config.dart`
- `lib/providers/battle_provider.dart`
- `lib/widgets/inventory/inventory_grid_widget.dart`
- `lib/screens/battle_screen.dart`
- `lib/widgets/battle/battle_animation_widget.dart`
- `lib/widgets/battle/character_status_card.dart`
- `lib/screens/story_screen.dart`
- `lib/game/data/player_table.dart`
- `lib/game/config/theme_config.dart`