Further implementation of types.
This commit is contained in:
@@ -124,3 +124,8 @@ void Battling::Creature::Damage(uint32_t damage, Battling::DamageSource source)
|
||||
// HOOK: On Damage
|
||||
__CurrentHealth -= damage;
|
||||
}
|
||||
|
||||
const std::vector<uint8_t>& Battling::Creature::GetTypes() const {
|
||||
//HOOK: override types.
|
||||
return this->__Variant->GetTypes();
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ namespace CreatureLib::Battling{
|
||||
BattleSide* GetBattleSide() const;
|
||||
|
||||
bool IsFainted() const;
|
||||
const std::vector<uint8_t>& GetTypes() const;
|
||||
|
||||
//region Stat APIs
|
||||
|
||||
|
||||
@@ -14,31 +14,34 @@ namespace CreatureLib::Battling {
|
||||
uint8_t _basePower = 0;
|
||||
float _effectiveness = 1;
|
||||
uint32_t _damage = 0;
|
||||
uint8_t _type = 0;
|
||||
public:
|
||||
HitData(){}
|
||||
|
||||
inline bool IsCritical() const{ return _critical;}
|
||||
inline uint8_t GetBasePower() const{ return _basePower;}
|
||||
inline float GetEffectiveness() const{ return _effectiveness;}
|
||||
inline uint32_t GetDamage() const{ return _damage;}
|
||||
[[nodiscard]] inline bool IsCritical() const{ return _critical;}
|
||||
[[nodiscard]] inline uint8_t GetBasePower() const{ return _basePower;}
|
||||
[[nodiscard]] inline float GetEffectiveness() const{ return _effectiveness;}
|
||||
[[nodiscard]] inline uint32_t GetDamage() const{ return _damage;}
|
||||
[[nodiscard]] inline uint8_t GetType() const {return _type;}
|
||||
|
||||
inline void SetCritical(bool value) {_critical = value;}
|
||||
inline void SetBasePower(uint8_t value) { _basePower = value; }
|
||||
inline void SetEffectiveness(float value) {_effectiveness = value;}
|
||||
inline void OverrideDamage(uint32_t value) {_damage = value;}
|
||||
inline void SetType(uint8_t value) {_type = value;}
|
||||
};
|
||||
|
||||
class TargetData {
|
||||
bool _isHit = true;
|
||||
std::vector<HitData> _hits;
|
||||
public:
|
||||
TargetData(uint8_t numberOfHits) : _hits(numberOfHits)
|
||||
explicit TargetData(uint8_t numberOfHits) : _hits(numberOfHits)
|
||||
{
|
||||
for (uint8_t i = 0; i < numberOfHits; i++){
|
||||
_hits[i] = HitData();
|
||||
}
|
||||
}
|
||||
TargetData(){}
|
||||
TargetData()= default;
|
||||
|
||||
HitData& GetHit(uint8_t index){
|
||||
return _hits[index];
|
||||
|
||||
Reference in New Issue
Block a user