Stating to implement the combat system

This commit is contained in:
Kayne Ruse
2014-05-15 23:59:24 +10:00
parent e5a98efd7d
commit f0453375c4
9 changed files with 249 additions and 18 deletions
+2
View File
@@ -54,6 +54,8 @@ struct CharacterData {
float accuracy = 0.0;
float evasion = 0.0;
float luck = 0.0;
//TODO: equipment and items
};
#endif
+37
View File
@@ -0,0 +1,37 @@
/* Copyright: (c) Kayne Ruse 2014
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*/
#ifndef COMBATINSTANCE_HPP_
#define COMBATINSTACNE_HPP_
#include "character_data.hpp"
#include "enemy_data.hpp"
#include <list>
struct CombatInstance {
std::list<CharacterData*> characterList;
std::list<EnemyData> enemyList;
//TODO: more?
};
#endif
+24
View File
@@ -0,0 +1,24 @@
/* Copyright: (c) Kayne Ruse 2014
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*/
#include "server_application.hpp"
//TODO: method definitions
+50
View File
@@ -0,0 +1,50 @@
/* Copyright: (c) Kayne Ruse 2014
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*/
#ifndef ENEMYDATA_HPP_
#define ENEMYDATA_HPP_
#include <string>
struct EnemyData {
//metadata
std::string handle;
std::string avatar;
//TODO: attached lua scripts
//statistics
int level = 0;
int exp = 0;
int maxHP = 0;
int health = 0;
int maxMP = 0;
int mana = 0;
int attack = 0;
int defence = 0;
int intelligence = 0;
int resistance = 0;
float accuracy = 0.0;
float evasion = 0.0;
float luck = 0.0;
};
#endif
+34
View File
@@ -0,0 +1,34 @@
/* Copyright: (c) Kayne Ruse 2014
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*/
#include "enemy_factory_generic.hpp"
EnemyFactoryGeneric::EnemyFactoryGeneric() : EnemyFactoryInterface() {
//
}
EnemyFactoryGeneric::~EnemyFactoryGeneric() noexcept {
//
}
void EnemyFactoryGeneric::Generate(std::list<EnemyData>* container) {
//TODO: fill out
}
+42
View File
@@ -0,0 +1,42 @@
/* Copyright: (c) Kayne Ruse 2014
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*/
#ifndef ENEMYFACTORYGENERIC_HPP_
#define ENEMYFACTORYGENERIC_HPP_
#include "enemy_factory_interface.hpp"
#include "enemy_data.hpp"
#include <list>
//DOCS: Not really intended for use, but rather for copying and tweaking
class EnemyFactoryGeneric : public EnemyFactoryInterface {
public:
EnemyFactoryGeneric();
~EnemyFactoryGeneric() noexcept override;
void Generate(std::list<EnemyData>* container) override;
private:
//TODO: hold the parameters specified by the room
};
#endif
+40
View File
@@ -0,0 +1,40 @@
/* Copyright: (c) Kayne Ruse 2014
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*/
#ifndef ENEMYFACTORYINTERFACE_HPP_
#define ENEMYFACTORYINTERFACE_HPP_
#include "enemy_data.hpp"
#include <list>
//NOTE: Based on biome, world difficulty, etc.
class EnemyFactoryInterface {
public:
EnemyFactoryInterface() = default;
virtual ~EnemyFactoryInterface() = default;
virtual void Generate(std::list<EnemyData>* container) = 0;
private:
//TODO: hold the parameters here?
};
#endif
+1
View File
@@ -51,6 +51,7 @@
#include <string>
//The main application class
//TODO: modulate this god class
class ServerApplication {
public:
//standard functions
+19 -18
View File
@@ -16,24 +16,25 @@ I may also need to rewrite some variable names.
--ServerApplication's methods--
These interact with the database file, making the server a persistent system.
* CreateUserAccount
* LoadUserAccount
* SaveUserAccount
* UnloadUserAccount
* DeleteUserAccount
* CreateCharacter
* LoadCharacter
* SaveCharacter
* UnloadCharacter
* DeleteCharacter
//NOTE: I honestly don't know what I'm doing
CreateCombatInstance(roomIndex)
PushCharacterToCombat(charIndex, combatIndex)
UpdateCombatInstances() //handles all combat
--Battle System--
CombatPortal:
x, y
list<Character>
list<Monster>
//...
CharacterData:
--stats
EnemyData
--stats
CombatInstance
list<CharacterData*>
list<EnemyData>
Room:
RegionPager pager
EnemyFactory enemyFactory --this takes information on the room's data early in the room's construction
list<CombatInstance>