update
This commit is contained in:
@@ -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}!");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user