wavelength 1.0.0
Loading...
Searching...
No Matches
healthcondition.h
Go to the documentation of this file.
1#pragma once
2
4#include "game/triggermgr.h"
5#include "script/dataarray.h"
6
14public:
21 ~HealthCondition() override = default;
22
23 explicit HealthCondition(DataArray *pCondition)
24 : mLow(pCondition->Int(1)), mHigh(pCondition->Int(2)) {
25 }
26
34 bool Test() override {
35 const int nHealth = TheTriggerMgr.GetHealth(TheTriggerMgr.GetPlayer());
36 return mLow <= nHealth && nHealth <= mHigh;
37 }
38
39private:
40 int mLow;
41 int mHigh;
42};
Reference-counted array of script data nodes.
Definition dataarray.h:20
HealthCondition(DataArray *pCondition)
Definition healthcondition.h:23
bool Test() override
Test the condition.
Definition healthcondition.h:34
~HealthCondition() override=default
Destroy the object.
A test a trigger makes before its actions start.
Definition triggercondition.h:11
TriggerMgr TheTriggerMgr
The trigger registry.