1.1 KiB
1.1 KiB
70. Fix Player Action Crash and Double Damage
1. 문제 (Problem)
- Crash:
BattleProvider.playerAction에서 생성하는EffectEvent에attacker,targetEntity,damageValue등이 누락되어 있어, UI가handleImpact를 호출할 때event.attacker!등에서 Null Pointer Exception이 발생함. - Double Damage:
playerAction메서드 내부에 구버전의 데미지 적용 로직이 남아 있어, 이를 수정하지 않으면 데미지가 두 번 들어감.
2. 해결 방안 (Solution)
playerAction메서드를 대대적으로 수정하여_enemyTurn과 동일한 패턴을 적용합니다.- 즉시 데미지 적용 로직 삭제: HP/Armor 감소 로직을 제거합니다.
EffectEvent완전체 생성:attacker,targetEntity,damageValue등을 모두 채워서 이벤트를 생성합니다.- 위임: 모든 데미지 처리는
EffectEvent를 통해handleImpact->_processAttackImpact로 위임됩니다.
3. 기대 효과 (Expected Outcome)
- 앱 크래시 해결.
- 플레이어 공격 시 애니메이션과 데미지 적용 시점이 정확히 일치.
- 데미지 중복 적용 방지.