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
Tactics3DCombat.h
Go to the documentation of this file.
1 // Copyright (C) 2006-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 TACTICS3DCOMBAT_H
24 #define TACTICS3DCOMBAT_H
25 
26 #include "Tactics3DWarrior.h"
27 
28 #include "../Libs/Core_LIB/CLog.h"
29 #include "../Libs/Utils_LIB/USocket.h"
30 
31 #include <vector>
32 
33 namespace Tactics3D {
34  namespace Combat {
35  struct Initiative {
39 
40  Initiative(Warrior* warrior_, OpenSkyNet::Utils::uint warriorIndex_, int initialDie1_, int initialDie2_,
41  int die1_, int die2_) : _warrior(warrior_), _warriorIndex(warriorIndex_), _initialDie1(initialDie1_),
42  _initialDie2(initialDie2_), _die1(die1_), _die2(die2_), _roll(die1_ + die2_) {
43  PRINTF_LOG("\tObject %s rolled %d.", warrior_->getName().c_str(), _roll);
44  }
45 
46  bool operator<(const Initiative& rhs_) const { return _roll < rhs_._roll; }
47  };
48 
49  bool round(std::vector<Warrior*> warriors_, OpenSkyNet::Utils::Socket* socket_);
50 
51  int attack(int oO_, int oD_, Warrior* attacker_, const AttackRange* attackRange_,
52  bool useAttackerDmgAdj_, int specialMoveDmgAdj_, bool useAbsDmg_, int absDmg_,
53  Warrior* defender_, Action* action_);
54 
59  OpenSkyNet::Utils::uint serializeInitiatives(const std::vector<Initiative>& initiatives_, char (&buffer_)[MAX_STRING_SIZE]);
60  void assembleInitiatives(OpenSkyNet::Utils::uint numWarriors_, char (&buffer_)[MAX_STRING_SIZE], std::vector<OpenSkyNet::Utils::TaggedUnion>& eventParams_);
62  }
63 }
64 
65 #endif //TACTICS3DCOMBAT_H
Initiative(Warrior *warrior_, OpenSkyNet::Utils::uint warriorIndex_, int initialDie1_, int initialDie2_, int die1_, int die2_)
Definition: Tactics3DCombat.h:40
Definition: Tactics3DAction.h:40
Definition: Tactics3DCombat.h:35
bool round(std::vector< Warrior * > warriors_, OpenSkyNet::Utils::Socket *socket_)
#define PRINTF_LOG(...)
Definition: CLog.h:67
int _die2
Definition: Tactics3DCombat.h:38
Definition: Tactics3DWarrior.h:42
int _initialDie2
Definition: Tactics3DCombat.h:38
void assembleInitiatives(OpenSkyNet::Utils::uint numWarriors_, char(&buffer_)[MAX_STRING_SIZE], std::vector< OpenSkyNet::Utils::TaggedUnion > &eventParams_)
int _die1
Definition: Tactics3DCombat.h:38
#define MAX_STRING_SIZE
Definition: UTypes.h:33
Definition: USocket.h:46
Definition: Tactics3DAttackRange.h:33
unsigned int uint
Definition: UTypes.h:39
bool operator<(const Initiative &rhs_) const
Definition: Tactics3DCombat.h:46
OpenSkyNet::Utils::uint serializeInitiatives(const std::vector< Initiative > &initiatives_, char(&buffer_)[MAX_STRING_SIZE])
OpenSkyNet::Utils::uint getInitiativesBufferLen(OpenSkyNet::Utils::uint numWarriors_)
Definition: Tactics3DNetwork.cpp:9
int attack(int oO_, int oD_, Warrior *attacker_, const AttackRange *attackRange_, bool useAttackerDmgAdj_, int specialMoveDmgAdj_, bool useAbsDmg_, int absDmg_, Warrior *defender_, Action *action_)
Definition: Tactics3DCombat.cpp:276
virtual const std::string & getName() const
Definition: IObject.h:104
int _initialDie1
Definition: Tactics3DCombat.h:38
Warrior * _warrior
Definition: Tactics3DCombat.h:36
int _roll
Definition: Tactics3DCombat.h:38
OpenSkyNet::Utils::uint _warriorIndex
Definition: Tactics3DCombat.h:37