-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit also modifies the behavior of `Effect` to only call `Effect.start` right before ticking. This is helpful for sequential mode, because previously all effects would be started upon instantiation, which is unintuitively non-sequential.
- Loading branch information
Showing
8 changed files
with
74 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+32 Bytes
(100%)
bin/libability_system.macos.template_debug.framework/libability_system.macos.template_debug
Binary file not shown.
Binary file modified
BIN
+16 KB
(100%)
...bability_system.macos.template_release.framework/libability_system.macos.template_release
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include "try_activate_ability_effect.h" | ||
|
||
#include <godot_cpp/variant/utility_functions.hpp> | ||
|
||
#include "../ability_system.h" | ||
|
||
void TryActivateAbilityEffect::_bind_methods() { | ||
BIND_GETSET(TryActivateAbilityEffect, ability); | ||
|
||
OBJECT_PROP(Ability, ability); | ||
} | ||
|
||
void TryActivateAbilityEffect::_start(AbilitySystem *owner) { | ||
if (ability.is_null()) { | ||
print_error("No ability provided!"); | ||
return; | ||
} | ||
|
||
if (!owner->has_ability(ability)) { | ||
String message = fmt( | ||
"Owner is missing ability {0}! Has abilities: {1}", | ||
ability->to_string(), | ||
stringify(owner->get_abilities()) | ||
); | ||
print_error(message); | ||
} else if (!owner->can_activate(ability)) | ||
print_error(fmt("Owner cannot activate ability {0}!", ability->to_string())); | ||
|
||
owner->activate(ability); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#ifndef AS_TRYACTIVATEABILITYEFFECT_HPP | ||
#define AS_TRYACTIVATEABILITYEFFECT_HPP | ||
|
||
#include "../ability.hpp" | ||
#include "effect.h" | ||
|
||
class TryActivateAbilityEffect : public Effect { | ||
GDCLASS(TryActivateAbilityEffect, Effect); | ||
|
||
private: | ||
Ref<Ability> ability; | ||
|
||
protected: | ||
static void _bind_methods(); | ||
|
||
public: | ||
GETSET_RESOURCE(Ref<Ability>, ability) | ||
|
||
virtual void _start(AbilitySystem *owner) override; | ||
virtual int _tick(AbilitySystem *owner, float delta) override { | ||
return Status::FINISHED; | ||
} | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters