Tactics: Western Philosophers Vs. Musicians  0.12
A turn-based tactical game combining rules and gameplay elements inspired by Final Fantasy Tactics and the Mayfair Exponential Game System. Unlike most games of this type, motion is in full, grid-less 3D.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Tactics3DSuperPower.h
Go to the documentation of this file.
1 // Copyright (C) 2015 Dylan Blair
3 //
4 // email: dblair@alumni.cs.utexas.edu
5 //
6 // This file is part of Tactics3D.
7 //
8 // Tactics3D is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
12 //
13 // Tactics3D is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 
23 #ifndef TACTICS3DSUPER_POWER_H
24 #define TACTICS3DSUPER_POWER_H
25 
26 #include "../Libs/Utils_LIB/UTypes.h"
27 
28 #include <vector>
29 #include <string>
30 #include <map>
31 
32 namespace Tactics3D {
33  class Warrior;
34 
36 
37  struct SuperPower {
39  std::string _name;
40  int _maxUses;
42 
43  typedef std::vector<Warrior*> Warriors;
44  typedef std::vector<OpenSkyNet::Utils::TaggedUnion> Params;
45 
46  static const Warriors s_emptyWarriors;
47  static const Params s_emptyParams;
48 
49  SuperPower(SUPER_POWER id_, const std::string& name_, int maxUses_, int maxRounds_) :
50  _id(id_), _name(name_), _maxUses(maxUses_), _maxRounds(maxRounds_) {}
51  virtual ~SuperPower() {}
52 
53  virtual void use(Warrior* user_, const Warriors& targets_, const Params& params_) const {}
54 
55  virtual void setInactive(Warrior* user_, const Warriors& targets_) const {}
56 
57  virtual void takeDamage(Warrior* user_, int dmg_) const {}
58  virtual void onFirstActiveRoundEnd(Warrior* user_, const Warriors& targets_) const {}
59 
60  virtual void getPlayerInfo(const Warrior* user_, char* buffer_, int bufferLen_) const { memset(buffer_, 0, bufferLen_); }
61  virtual void getPrePerformInfo(char* buffer_, int bufferLen_) const { memset(buffer_, 0, bufferLen_); }
62  virtual void getAnimationName(char* buffer_, int bufferLen_) const { strncpy(buffer_, "attack", bufferLen_); }
63 
64  virtual bool canMoveInSameRound() const { return true; }
65  virtual bool canTranslate() const { return false; }
66  virtual bool canRotate() const { return false; }
67 
68  virtual bool doesMoveCurrCamToWarriorPOV(const Warrior* user_) const { return false; }
69 
70  virtual Warriors filterTargets(const Warrior* user_, const Warriors& targets_) const { return Warriors(); }
71  virtual void formatParams(Params& params_) const { params_.clear(); }
72 
73  static void initAll();
74  };
75 
76  struct Evocation : public SuperPower {
77  Evocation() : SuperPower(EVOCATION, "Evocation", -1, 0) {}
78 
79  virtual void use(Warrior* user_, const Warriors& targets_, const Params& params_) const;
80 
81  virtual void getPlayerInfo(const Warrior* user_, char* buffer_, int bufferLen_) const;
82  virtual void getPrePerformInfo(char* buffer_, int bufferLen_) const;
83  virtual void getAnimationName(char* buffer_, int bufferLen_) const { memset(buffer_, 0, bufferLen_); }
84 
85  virtual bool canRotate() const { return true; }
86 
87  virtual bool doesMoveCurrCamToWarriorPOV(const Warrior* user_) const;
88  };
89  extern const Evocation g_evocation;
90 
91  struct WhatDoesNotKillMe : public SuperPower {
92  WhatDoesNotKillMe() : SuperPower(WHAT_DOES_NOT_KILL_ME, "What Does Not Kill Me Makes Me Stronger", 1, 5) {}
93 
94  virtual void use(Warrior* user_, const Warriors& targets_, const Params& params_) const;
95 
96  virtual void setInactive(Warrior* user_, const Warriors& targets_) const;
97 
98  virtual void takeDamage(Warrior* user_, int dmg_) const;
99 
100  virtual void getPlayerInfo(const Warrior* user_, char* buffer_, int bufferLen_) const;
101  };
102  extern const WhatDoesNotKillMe g_whatDoesNotKillMe;
103 
105  ArgumentAgainstMotion() : SuperPower(ARGUMENT_AGAINST_MOTION, "Argument Against Motion", 1, 2) {}
106 
107  virtual void use(Warrior* user_, const Warriors& targets_, const Params& params_) const;
108 
109  virtual void setInactive(Warrior* user_, const Warriors& targets_) const;
110 
111  virtual void getPlayerInfo(const Warrior* user_, char* buffer_, int bufferLen_) const;
112 
113  virtual Warriors filterTargets(const Warrior* user_, const Warriors& targets_) const;
114  };
115  extern const ArgumentAgainstMotion g_argumentAgainstMotion;
116 
117  struct JamSession : public SuperPower {
118  JamSession() : SuperPower(JAM_SESSION, "Jam Session", 1, 2) {}
119 
120  virtual void use(Warrior* user_, const Warriors& targets_, const Params& params_) const;
121 
122  virtual void setInactive(Warrior* user_, const Warriors& targets_) const;
123 
124  virtual void onFirstActiveRoundEnd(Warrior* user_, const Warriors& targets_) const;
125 
126  virtual void getPlayerInfo(const Warrior* user_, char* buffer_, int bufferLen_) const;
127 
128  virtual Warriors filterTargets(const Warrior* user_, const Warriors& targets_) const;
129  };
130  extern const JamSession g_jamSession;
131 
132  extern std::map<SUPER_POWER, const SuperPower*> g_superPowers;
133 }
134 
135 #endif //TACTICS3DSUPER_POWER_H
virtual void use(Warrior *user_, const Warriors &targets_, const Params &params_) const
Definition: Tactics3DSuperPower.cpp:91
virtual ~SuperPower()
Definition: Tactics3DSuperPower.h:51
virtual void onFirstActiveRoundEnd(Warrior *user_, const Warriors &targets_) const
Definition: Tactics3DSuperPower.cpp:104
virtual void getPlayerInfo(const Warrior *user_, char *buffer_, int bufferLen_) const
Definition: Tactics3DSuperPower.cpp:59
Definition: Tactics3DSuperPower.h:91
virtual Warriors filterTargets(const Warrior *user_, const Warriors &targets_) const
Definition: Tactics3DSuperPower.h:70
virtual void setInactive(Warrior *user_, const Warriors &targets_) const
Definition: Tactics3DSuperPower.h:55
virtual void getAnimationName(char *buffer_, int bufferLen_) const
Definition: Tactics3DSuperPower.h:62
virtual void onFirstActiveRoundEnd(Warrior *user_, const Warriors &targets_) const
Definition: Tactics3DSuperPower.h:58
virtual void setInactive(Warrior *user_, const Warriors &targets_) const
Definition: Tactics3DSuperPower.cpp:95
virtual void getPrePerformInfo(char *buffer_, int bufferLen_) const
Definition: Tactics3DSuperPower.h:61
Definition: Tactics3DSuperPower.h:37
ArgumentAgainstMotion()
Definition: Tactics3DSuperPower.h:105
int _maxRounds
Definition: Tactics3DSuperPower.h:41
Evocation()
Definition: Tactics3DSuperPower.h:77
Definition: Tactics3DWarrior.h:42
Definition: Tactics3DSuperPower.h:117
virtual Warriors filterTargets(const Warrior *user_, const Warriors &targets_) const
Definition: Tactics3DSuperPower.cpp:81
virtual bool canTranslate() const
Definition: Tactics3DSuperPower.h:65
std::vector< Warrior * > Warriors
Definition: Tactics3DSuperPower.h:43
const Evocation g_evocation
Definition: Tactics3DSuperPower.cpp:13
virtual void use(Warrior *user_, const Warriors &targets_, const Params &params_) const
Definition: Tactics3DSuperPower.h:53
virtual void getPlayerInfo(const Warrior *user_, char *buffer_, int bufferLen_) const
Definition: Tactics3DSuperPower.cpp:76
virtual void getAnimationName(char *buffer_, int bufferLen_) const
Definition: Tactics3DSuperPower.h:83
virtual bool canRotate() const
Definition: Tactics3DSuperPower.h:85
virtual bool doesMoveCurrCamToWarriorPOV(const Warrior *user_) const
Definition: Tactics3DSuperPower.h:68
Definition: Tactics3DSuperPower.h:76
virtual bool canMoveInSameRound() const
Definition: Tactics3DSuperPower.h:64
Definition: Tactics3DSuperPower.h:104
virtual bool doesMoveCurrCamToWarriorPOV(const Warrior *user_) const
Definition: Tactics3DSuperPower.cpp:42
virtual void setInactive(Warrior *user_, const Warriors &targets_) const
Definition: Tactics3DSuperPower.cpp:71
virtual bool canRotate() const
Definition: Tactics3DSuperPower.h:66
WhatDoesNotKillMe()
Definition: Tactics3DSuperPower.h:92
virtual void formatParams(Params &params_) const
Definition: Tactics3DSuperPower.h:71
std::map< SUPER_POWER, const SuperPower * > g_superPowers
Definition: Tactics3DSuperPower.cpp:18
SUPER_POWER _id
Definition: Tactics3DSuperPower.h:38
SuperPower(SUPER_POWER id_, const std::string &name_, int maxUses_, int maxRounds_)
Definition: Tactics3DSuperPower.h:49
static const Params s_emptyParams
Definition: Tactics3DSuperPower.h:47
virtual void use(Warrior *user_, const Warriors &targets_, const Params &params_) const
Definition: Tactics3DSuperPower.cpp:46
const WhatDoesNotKillMe g_whatDoesNotKillMe
Definition: Tactics3DSuperPower.cpp:14
virtual void use(Warrior *user_, const Warriors &targets_, const Params &params_) const
Definition: Tactics3DSuperPower.cpp:64
virtual void getPrePerformInfo(char *buffer_, int bufferLen_) const
Definition: Tactics3DSuperPower.cpp:38
virtual void getPlayerInfo(const Warrior *user_, char *buffer_, int bufferLen_) const
Definition: Tactics3DSuperPower.cpp:33
Definition: Tactics3DSuperPower.h:35
JamSession()
Definition: Tactics3DSuperPower.h:118
SUPER_POWER
Definition: Tactics3DSuperPower.h:35
virtual void getPlayerInfo(const Warrior *user_, char *buffer_, int bufferLen_) const
Definition: Tactics3DSuperPower.h:60
int _maxUses
Definition: Tactics3DSuperPower.h:40
static const Warriors s_emptyWarriors
Definition: Tactics3DSuperPower.h:46
Definition: Tactics3DSuperPower.h:35
std::vector< OpenSkyNet::Utils::TaggedUnion > Params
Definition: Tactics3DSuperPower.h:44
virtual void takeDamage(Warrior *user_, int dmg_) const
Definition: Tactics3DSuperPower.h:57
const JamSession g_jamSession
Definition: Tactics3DSuperPower.cpp:16
Definition: Tactics3DSuperPower.h:35
const ArgumentAgainstMotion g_argumentAgainstMotion
Definition: Tactics3DSuperPower.cpp:15
virtual void setInactive(Warrior *user_, const Warriors &targets_) const
Definition: Tactics3DSuperPower.cpp:50
virtual void getPlayerInfo(const Warrior *user_, char *buffer_, int bufferLen_) const
Definition: Tactics3DSuperPower.cpp:122
Definition: Tactics3DSuperPower.h:35
virtual void takeDamage(Warrior *user_, int dmg_) const
Definition: Tactics3DSuperPower.cpp:54
virtual void use(Warrior *user_, const Warriors &targets_, const Params &params_) const
Definition: Tactics3DSuperPower.cpp:28
static void initAll()
Definition: Tactics3DSuperPower.cpp:20
virtual Warriors filterTargets(const Warrior *user_, const Warriors &targets_) const
Definition: Tactics3DSuperPower.cpp:128
Definition: Tactics3DSuperPower.h:35
std::string _name
Definition: Tactics3DSuperPower.h:39