Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
WarSceneActions.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2018 DIVIDE-Studio
3 Copyright (c) 2009 Ionut Cava
4
5 This file is part of DIVIDE Framework.
6
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software
9 and associated documentation files (the "Software"), to deal in the Software
10 without restriction,
11 including without limitation the rights to use, copy, modify, merge, publish,
12 distribute, sublicense,
13 and/or sell copies of the Software, and to permit persons to whom the
14 Software is furnished to do so,
15 subject to the following conditions:
16
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
19
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 IMPLIED,
22 INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
23 PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
25 DAMAGES OR OTHER LIABILITY,
26 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
27 IN CONNECTION WITH THE SOFTWARE
28 OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
30 */
31#pragma once
32#ifndef DVD_WAR_SCENE_AESOP_ACTION_INTERFACE_H_
33#define DVD_WAR_SCENE_AESOP_ACTION_INTERFACE_H_
34
37
38namespace Divide {
39namespace AI {
40
41enum class ActionType : U8 {
44 SCORE_FLAG = 2,
46 IDLE = 4,
47 ATTACK_ENEMY = 5,
48 RECOVER_FLAG = 6,
49 COUNT
50};
51
52// Some useful predicates
53enum class Fact : U8 {
55 AT_HOME_BASE = 1,
58 IDLING = 4,
59 ENEMY_DEAD = 5,
60 COUNT
61};
62
63inline string WarSceneFactName(GOAPFact fact) {
64 switch (static_cast<Fact>(fact)) {
66 return "NEAR ENEMY FLAG";
68 return "AT HOME BASE";
70 return "HAS ENEMY FLAG";
72 return "ENEMY HAS FLAG";
73 case Fact::IDLING:
74 return "IDLING";
76 return "ENEMY DEAD";
77 case Fact::COUNT: break;
78 }
79
80 return Util::to_string(fact);
81}
82
84class WarSceneAction final : public GOAPAction {
85 public:
86 WarSceneAction(ActionType type, const string& name, F32 cost = 1.0f);
87
88 ActionType actionType() const noexcept { return _type; }
89
90 bool preAction(WarSceneAIProcessor& parentProcessor) const;
91 bool postAction(WarSceneAIProcessor& parentProcessor) const;
92 bool checkImplDependentCondition() const noexcept override { return true; }
93
94 protected:
96};
97
98} // namespace AI
99} // namespace Divide
100
101#endif //DVD_WAR_SCENE_AESOP_ACTION_INTERFACE_H_
bool postAction(WarSceneAIProcessor &parentProcessor) const
ActionType actionType() const noexcept
bool preAction(WarSceneAIProcessor &parentProcessor) const
bool checkImplDependentCondition() const noexcept override
int cost() const noexcept
Definition: Action.h:70
const string & name() const noexcept
Definition: Action.h:72
string WarSceneFactName(GOAPFact fact)
string to_string(GET_PASS_TYPE< T > value)
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
uint8_t U8