-
Notifications
You must be signed in to change notification settings - Fork 1
/
battle.h
84 lines (74 loc) · 1.31 KB
/
battle.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#ifndef _BATTLE_H_
#define _BATTLE_H_
#include "ship.h"
#include "globals.h"
#include "window.h"
#include <string>
#include <vector>
enum Crew_task
{
CREW_NULL = 0,
CREW_REPAIR,
CREW_EMP_REPAIR,
CREW_ENGINE,
CREW_WEAPONS,
NUM_CREW_TASKS
};
enum Engine_task
{
ENGINE_NULL = 0,
ENGINE_EVADE,
ENGINE_FLEE,
ENGINE_CLOSE,
ENGINE_JUMP,
NUM_ENGINE_TASKS
};
const std::string Crew_task_name[NUM_CREW_TASKS] = {
"Idle",
"Repairing",
"Fix EMP",
"Engine",
"Weapons"
};
const std::string Engine_task_name[NUM_ENGINE_TASKS] = {
"NULL",
"Evading",
"Fleeing",
"Closing",
"Jumping"
};
struct Combat_ship
{
Ship ship;
Crew_task crew;
Engine_task engine;
int range;
// TODO: Morale? Objective?
};
struct Battle
{
std::vector<Combat_ship> enemies;
std::vector<std::string> messages;
Crew_task crew;
Engine_task engine;
int target;
// Constructor/Destructor
Battle();
~Battle();
// Init functions
void add_enemy(Ship enemy);
void init();
// In-battle functions
void main_loop();
void update_ranges();
void player_turn();
void enemy_turn();
void hit_with_weapon(Ship &ship, Ship_part &weapon);
// Interface functions
void add_message(std::string message);
void set_crew_task();
void set_engine_task();
void set_target(Window &w_battle);
void display_weapon_symbols();
};
#endif