Add C interface for ExecutingAttack.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-04-06 17:05:32 +02:00
parent 9ff5df1b70
commit 70fc8d2d5f
4 changed files with 73 additions and 21 deletions

View File

@@ -22,19 +22,19 @@ namespace CreatureLib::Battling {
uint8_t _type = 0;
public:
HitData() {}
HitData() noexcept {}
[[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; }
[[nodiscard]] inline bool IsCritical() const noexcept { return _critical; }
[[nodiscard]] inline uint8_t GetBasePower() const noexcept { return _basePower; }
[[nodiscard]] inline float GetEffectiveness() const noexcept { return _effectiveness; }
[[nodiscard]] inline uint32_t GetDamage() const noexcept { return _damage; }
[[nodiscard]] inline uint8_t GetType() const noexcept { 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 SetDamage(uint32_t value) { _damage = value; }
inline void SetType(uint8_t value) { _type = value; }
inline void SetCritical(bool value) noexcept { _critical = value; }
inline void SetBasePower(uint8_t value) noexcept { _basePower = value; }
inline void SetEffectiveness(float value) noexcept { _effectiveness = value; }
inline void SetDamage(uint32_t value) noexcept { _damage = value; }
inline void SetType(uint8_t value) noexcept { _type = value; }
};
class TargetData {
@@ -51,9 +51,9 @@ namespace CreatureLib::Battling {
HitData* GetHit(uint8_t index) { return &_hits[index]; }
uint8_t GetNumberOfHits() const { return _hits.Count(); }
uint8_t GetNumberOfHits() const noexcept { return _hits.Count(); }
bool IsHit() const { return _isHit; }
bool IsHit() const noexcept { return _isHit; }
};
private:
@@ -73,17 +73,17 @@ namespace CreatureLib::Battling {
}
}
virtual ~ExecutingAttack() { delete _script; };
virtual ~ExecutingAttack() noexcept { delete _script; };
TargetData* GetAttackDataForTarget(Creature* creature) { return &_targets[creature]; }
bool IsCreatureTarget(Creature* creature) { return _targets.Has(creature); }
bool IsCreatureTarget(Creature* creature) noexcept { return _targets.Has(creature); }
Dictionary<Creature*, TargetData>& GetTargets() { return _targets; }
Dictionary<Creature*, TargetData>& GetTargets() noexcept { return _targets; }
Creature* GetUser() { return _user; }
Creature* GetUser() noexcept { return _user; }
LearnedAttack* GetAttack() { return _attack; }
LearnedAttack* GetAttack() noexcept { return _attack; }
protected:
void GetActiveScripts(Arbutils::Collections::List<ScriptWrapper>& scripts) override {