Stating to implement the combat system
This commit is contained in:
@@ -54,6 +54,8 @@ struct CharacterData {
|
|||||||
float accuracy = 0.0;
|
float accuracy = 0.0;
|
||||||
float evasion = 0.0;
|
float evasion = 0.0;
|
||||||
float luck = 0.0;
|
float luck = 0.0;
|
||||||
|
|
||||||
|
//TODO: equipment and items
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -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
|
||||||
@@ -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
|
||||||
@@ -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
|
||||||
|
}
|
||||||
@@ -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
|
||||||
@@ -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
|
||||||
@@ -51,6 +51,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
//The main application class
|
//The main application class
|
||||||
|
//TODO: modulate this god class
|
||||||
class ServerApplication {
|
class ServerApplication {
|
||||||
public:
|
public:
|
||||||
//standard functions
|
//standard functions
|
||||||
|
|||||||
@@ -16,24 +16,25 @@ I may also need to rewrite some variable names.
|
|||||||
|
|
||||||
--ServerApplication's methods--
|
--ServerApplication's methods--
|
||||||
|
|
||||||
These interact with the database file, making the server a persistent system.
|
//NOTE: I honestly don't know what I'm doing
|
||||||
|
CreateCombatInstance(roomIndex)
|
||||||
* CreateUserAccount
|
PushCharacterToCombat(charIndex, combatIndex)
|
||||||
* LoadUserAccount
|
UpdateCombatInstances() //handles all combat
|
||||||
* SaveUserAccount
|
|
||||||
* UnloadUserAccount
|
|
||||||
* DeleteUserAccount
|
|
||||||
|
|
||||||
* CreateCharacter
|
|
||||||
* LoadCharacter
|
|
||||||
* SaveCharacter
|
|
||||||
* UnloadCharacter
|
|
||||||
* DeleteCharacter
|
|
||||||
|
|
||||||
--Battle System--
|
--Battle System--
|
||||||
|
|
||||||
CombatPortal:
|
CharacterData:
|
||||||
x, y
|
--stats
|
||||||
list<Character>
|
|
||||||
list<Monster>
|
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>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user