#ifndef _CDAMAGEVULNERABILITY
#define _CDAMAGEVULNERABILITY

#include "types.h"

#include "MetroidPrime/Weapons/WeaponTypes.hpp"

enum EVulnerability {
  kVN_Weak,
  kVN_Normal,
  kVN_Deflect,
  kVN_Immune,
  kVN_PassThrough,
  kVN_DirectWeak,
  kVN_DirectNormal,
  kVN_DirectImmune,
};

enum EDeflectionType {
  kDT_None,
  kDT_One,
  kDT_Two,
  kDT_Three,
  kDT_Four,
};

class CInputStream;

class CDamageVulnerability {
public:
  CDamageVulnerability(CInputStream& in);
  CDamageVulnerability(EVulnerability power, EVulnerability ice, EVulnerability wave,
                       EVulnerability plasma, EVulnerability bomb, EVulnerability powerBomb,
                       EVulnerability missile, EVulnerability boostBall, EVulnerability phazon,
                       EVulnerability enemyWp1, EVulnerability enemyWp2, EVulnerability enemyWp3,
                       EVulnerability enemyWp4, EVulnerability v1, EVulnerability v2,
                       EDeflectionType deflectType);

  EDeflectionType GetDeflectionType(const CWeaponMode& mode) const;

  bool WeaponHurts(const CWeaponMode&, int ignoreDirect) const;
  bool WeaponHits(const CWeaponMode& mode, int checkDirect) const;
  EVulnerability GetVulnerability(const CWeaponMode& mode, int ignoreDirect) const;

  static const CDamageVulnerability& NormalVulnerabilty() { return sNormalVulnerability; }
  static const CDamageVulnerability& ImmuneVulnerabilty() { return sImmuneVulnerability; }
  static const CDamageVulnerability& ReflectVulnerabilty() { return sReflectVulnerability; }
  static const CDamageVulnerability& PassThroughVulnerabilty() { return sPassThroughVulnerability; }

private:
  EVulnerability x0_normal[15];
  EVulnerability x3c_charged[4];
  EVulnerability x4c_combo[4];
  EDeflectionType x5c_deflect;
  EDeflectionType x60_chargedDeflect;
  EDeflectionType x64_comboDeflect;

  void LoadData(CInputStream& in, int propCount);

  static const CDamageVulnerability sNormalVulnerability;
  static const CDamageVulnerability sImmuneVulnerability;
  static const CDamageVulnerability sReflectVulnerability;
  static const CDamageVulnerability sPassThroughVulnerability;
};
CHECK_SIZEOF(CDamageVulnerability, 0x68)

#endif // _CDAMAGEVULNERABILITY
