1 ////////////////////////////////////////////////////////////////////////////////
2 //            Copyright (C) 2004-2011 by The Allacrost Project
3 //            Copyright (C) 2012-2016 by Bertram (Valyria Tear)
4 //                         All Rights Reserved
5 //
6 // This code is licensed under the GNU GPL version 2. It is free software
7 // and you may modify it and/or redistribute it under the terms of this license.
8 // See http://www.gnu.org/copyleft/gpl.html for details.
9 ////////////////////////////////////////////////////////////////////////////////
10 
11 #include "global_target.h"
12 
13 #include "common/global/status_effects/status_effect_enums.h"
14 
15 #include "engine/system.h"
16 
17 #include "utils/utils_common.h"
18 
19 using namespace vt_system;
20 
21 namespace vt_global
22 {
23 
GetTargetText(GLOBAL_TARGET target)24 std::string GetTargetText(GLOBAL_TARGET target)
25 {
26     switch(target) {
27     case GLOBAL_TARGET_SELF_POINT:
28         return Translate("Self — Point");
29     case GLOBAL_TARGET_ALLY_POINT:
30         return Translate("Ally — Point");
31     case GLOBAL_TARGET_FOE_POINT:
32         return Translate("Foe — Point");
33     case GLOBAL_TARGET_SELF:
34         return Translate("Self");
35     case GLOBAL_TARGET_ALLY:
36         return Translate("Ally");
37     case GLOBAL_TARGET_ALLY_EVEN_DEAD:
38         return Translate("Ally (Even KO)");
39     case GLOBAL_TARGET_DEAD_ALLY_ONLY:
40         return Translate("Ally (Only KO)");
41     case GLOBAL_TARGET_FOE:
42         return Translate("Foe");
43     case GLOBAL_TARGET_ALL_ALLIES:
44         return Translate("All Allies");
45     case GLOBAL_TARGET_ALL_FOES:
46         return Translate("All Foes");
47     default:
48         return Translate("Invalid Target");
49     }
50 }
51 
IsTargetPoint(GLOBAL_TARGET target)52 bool IsTargetPoint(GLOBAL_TARGET target)
53 {
54     if((target == GLOBAL_TARGET_SELF_POINT) || (target == GLOBAL_TARGET_ALLY_POINT) || (target == GLOBAL_TARGET_FOE_POINT))
55         return true;
56     else
57         return false;
58 }
59 
IsTargetActor(GLOBAL_TARGET target)60 bool IsTargetActor(GLOBAL_TARGET target)
61 {
62     switch(target) {
63     case GLOBAL_TARGET_SELF:
64     case GLOBAL_TARGET_ALLY:
65     case GLOBAL_TARGET_ALLY_EVEN_DEAD:
66     case GLOBAL_TARGET_DEAD_ALLY_ONLY:
67     case GLOBAL_TARGET_FOE:
68         return true;
69     default:
70         break;
71     }
72 
73     return false;
74 }
75 
IsTargetParty(GLOBAL_TARGET target)76 bool IsTargetParty(GLOBAL_TARGET target)
77 {
78     if((target == GLOBAL_TARGET_ALL_ALLIES) || (target == GLOBAL_TARGET_ALL_FOES))
79         return true;
80     else
81         return false;
82 }
83 
IsTargetSelf(GLOBAL_TARGET target)84 bool IsTargetSelf(GLOBAL_TARGET target)
85 {
86     if((target == GLOBAL_TARGET_SELF_POINT) || (target == GLOBAL_TARGET_SELF))
87         return true;
88     else
89         return false;
90 }
91 
IsTargetAlly(GLOBAL_TARGET target)92 bool IsTargetAlly(GLOBAL_TARGET target)
93 {
94     switch(target) {
95     case GLOBAL_TARGET_SELF:
96     case GLOBAL_TARGET_ALLY:
97     case GLOBAL_TARGET_ALLY_EVEN_DEAD:
98     case GLOBAL_TARGET_DEAD_ALLY_ONLY:
99     case GLOBAL_TARGET_ALLY_POINT:
100     case GLOBAL_TARGET_ALL_ALLIES:
101         return true;
102     default:
103         break;
104     }
105     return false;
106 }
107 
IsTargetFoe(GLOBAL_TARGET target)108 bool IsTargetFoe(GLOBAL_TARGET target)
109 {
110     if((target == GLOBAL_TARGET_FOE_POINT) || (target == GLOBAL_TARGET_FOE) || (target == GLOBAL_TARGET_ALL_FOES))
111         return true;
112     else
113         return false;
114 }
115 
116 } // namespace vt_global
117