/// 캐릭터 스탯 (Stats)
///
/// 6대 능력치(STR, CON, DEX, INT, WIS, CHA)와 HP/MP를 관리
class Stats {
  const Stats({
    required this.str,
    required this.con,
    required this.dex,
    required this.intelligence,
    required this.wis,
    required this.cha,
    required this.hpMax,
    required this.mpMax,
    this.hpCurrent,
    this.mpCurrent,
  });

  final int str;
  final int con;
  final int dex;
  final int intelligence;
  final int wis;
  final int cha;
  final int hpMax;
  final int mpMax;

  /// 현재 HP (null이면 hpMax와 동일)
  final int? hpCurrent;

  /// 현재 MP (null이면 mpMax와 동일)
  final int? mpCurrent;

  /// 실제 현재 HP 값
  int get hp => hpCurrent ?? hpMax;

  /// 실제 현재 MP 값
  int get mp => mpCurrent ?? mpMax;

  factory Stats.empty() => const Stats(
    str: 0,
    con: 0,
    dex: 0,
    intelligence: 0,
    wis: 0,
    cha: 0,
    hpMax: 0,
    mpMax: 0,
  );

  Stats copyWith({
    int? str,
    int? con,
    int? dex,
    int? intelligence,
    int? wis,
    int? cha,
    int? hpMax,
    int? mpMax,
    int? hpCurrent,
    int? mpCurrent,
  }) {
    return Stats(
      str: str ?? this.str,
      con: con ?? this.con,
      dex: dex ?? this.dex,
      intelligence: intelligence ?? this.intelligence,
      wis: wis ?? this.wis,
      cha: cha ?? this.cha,
      hpMax: hpMax ?? this.hpMax,
      mpMax: mpMax ?? this.mpMax,
      hpCurrent: hpCurrent ?? this.hpCurrent,
      mpCurrent: mpCurrent ?? this.mpCurrent,
    );
  }
}
