This commit is contained in:
2025-12-16 02:13:31 +09:00
parent c029cd1e10
commit f5a7eb2db9
19 changed files with 378 additions and 87 deletions
+17 -4
View File
@@ -90,6 +90,15 @@ class BattleProvider with ChangeNotifier {
turnCount = data['turnCount'];
player = Character.fromJson(data['player']);
// [Fix] Update player image path from latest data (in case of legacy save data)
// This ensures that even if the save file has an old path, the UI uses the correct asset.
if (player.name == "Warrior") {
final template = PlayerTable.get("warrior");
if (template != null && template.image != null) {
player.image = template.image;
}
}
_logManager.clear();
_addLog("Game Loaded! Resuming Stage $stage");
@@ -513,8 +522,7 @@ class BattleProvider with ChangeNotifier {
}
// Process Start-of-Turn Effects
final result = CombatCalculator.processStartTurnEffects(enemy);
bool canAct = !result['isStunned'];
bool canAct = _processStartTurnEffects(enemy);
if (enemy.isDead) {
_onVictory();
@@ -1074,7 +1082,7 @@ class BattleProvider with ChangeNotifier {
}
// Try applying status effects
_tryApplyStatusEffects(attacker, target);
_tryApplyStatusEffects(attacker, target, damageToHp);
// If target is enemy, update intent to reflect potential status changes (e.g. Disarmed)
if (target == enemy) {
@@ -1105,13 +1113,18 @@ class BattleProvider with ChangeNotifier {
}
/// Tries to applyStatus effects from attacker's equipment to the target.
void _tryApplyStatusEffects(Character attacker, Character target) {
void _tryApplyStatusEffects(Character attacker, Character target, int damageToHp) {
List<StatusEffect> effectsToApply = CombatCalculator.getAppliedEffects(
attacker,
random: _random, // Pass injected random
);
for (var effect in effectsToApply) {
// Logic: Bleed requires HP damage (penetrating armor)
if (effect.type == StatusEffectType.bleed && damageToHp <= 0) {
continue;
}
target.addStatusEffect(effect);
_addLog("Applied ${effect.type.name} to ${target.name}!");
}