update
This commit is contained in:
@@ -7,7 +7,9 @@ import '../game/model/item.dart';
|
||||
import '../game/model/status_effect.dart';
|
||||
import '../game/model/stage.dart';
|
||||
import '../game/data/item_table.dart';
|
||||
|
||||
import '../game/data/enemy_table.dart';
|
||||
import '../game/data/player_table.dart';
|
||||
import '../utils/game_math.dart';
|
||||
import '../game/enums.dart';
|
||||
import '../game/model/damage_event.dart'; // DamageEvent import
|
||||
@@ -70,16 +72,24 @@ class BattleProvider with ChangeNotifier {
|
||||
void initializeBattle() {
|
||||
stage = 1;
|
||||
turnCount = 1;
|
||||
player = Character(
|
||||
name: "Player",
|
||||
maxHp: 80,
|
||||
armor: 0,
|
||||
atk: 5,
|
||||
baseDefense: 5,
|
||||
);
|
||||
// Load player from PlayerTable
|
||||
final playerTemplate = PlayerTable.get("warrior");
|
||||
if (playerTemplate != null) {
|
||||
player = playerTemplate.createCharacter();
|
||||
} else {
|
||||
// Fallback if data is missing
|
||||
player = Character(
|
||||
name: "Player",
|
||||
maxHp: 50,
|
||||
armor: 0,
|
||||
atk: 5,
|
||||
baseDefense: 5,
|
||||
);
|
||||
}
|
||||
|
||||
// Provide starter equipment
|
||||
final starterSword = Item(
|
||||
id: "starter_sword",
|
||||
name: "Wooden Sword",
|
||||
description: "A basic sword",
|
||||
atkBonus: 5,
|
||||
@@ -87,6 +97,7 @@ class BattleProvider with ChangeNotifier {
|
||||
slot: EquipmentSlot.weapon,
|
||||
);
|
||||
final starterArmor = Item(
|
||||
id: "starter_armor",
|
||||
name: "Leather Armor",
|
||||
description: "Basic protection",
|
||||
atkBonus: 0,
|
||||
@@ -94,6 +105,7 @@ class BattleProvider with ChangeNotifier {
|
||||
slot: EquipmentSlot.armor,
|
||||
);
|
||||
final starterShield = Item(
|
||||
id: "starter_shield",
|
||||
name: "Wooden Shield",
|
||||
description: "A small shield",
|
||||
atkBonus: 0,
|
||||
@@ -102,6 +114,7 @@ class BattleProvider with ChangeNotifier {
|
||||
slot: EquipmentSlot.shield,
|
||||
);
|
||||
final starterRing = Item(
|
||||
id: "starter_ring",
|
||||
name: "Copper Ring",
|
||||
description: "A simple ring",
|
||||
atkBonus: 1,
|
||||
@@ -436,6 +449,9 @@ class BattleProvider with ChangeNotifier {
|
||||
_applyDamage(player, damageToHp, targetType: DamageTarget.player);
|
||||
_addLog("Enemy dealt $damageToHp damage to Player HP.");
|
||||
}
|
||||
|
||||
// Try applying status effects from enemy equipment
|
||||
_tryApplyStatusEffects(enemy, player);
|
||||
} else {
|
||||
_addLog("Enemy's ${intent.risk.name} attack missed!");
|
||||
_effectEventController.sink.add(
|
||||
|
||||
Reference in New Issue
Block a user