forked from Whales/Cataclysm
-
Notifications
You must be signed in to change notification settings - Fork 1
/
mission.h
148 lines (130 loc) · 4.68 KB
/
mission.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#ifndef _MISSION_H_
#define _MISSION_H_
#include <vector>
#include <string>
#include "itype.h"
#include "texthash.h"
#include "npc.h"
struct mission;
class game;
enum talk_topic;
enum mission_id {
MISSION_NULL,
MISSION_GET_ANTIBIOTICS,
MISSION_GET_SOFTWARE,
MISSION_GET_ZOMBIE_BLOOD_ANAL,
MISSION_RESCUE_DOG,
MISSION_KILL_ZOMBIE_MOM,
NUM_MISSION_IDS
};
std::string mission_dialogue(mission_id id, talk_topic state);
enum mission_origin {
ORIGIN_NULL = 0,
ORIGIN_GAME_START, // Given when the game starts
ORIGIN_OPENER_NPC, // NPC comes up to you when the game starts
ORIGIN_SECONDARY, // Given at the end of another mission
NUM_ORIGIN
};
enum mission_goal {
MGOAL_NULL = 0,
MGOAL_GO_TO, // Reach a certain overmap tile
MGOAL_FIND_ITEM, // Find an item of a given type
MGOAL_FIND_ANY_ITEM, // Find an item tagged with this mission
MGOAL_FIND_MONSTER, // Find and retrieve a friendly monster
MGOAL_FIND_NPC, // Find a given NPC
MGOAL_ASSASSINATE, // Kill a given NPC
MGOAL_KILL_MONSTER, // Kill a particular hostile monster
NUM_MGOAL
};
struct mission_place { // Return true if [posx,posy] is valid in overmap
bool never (game *g, int posx, int posy) { return false; }
bool always (game *g, int posx, int posy) { return true; }
bool near_town (game *g, int posx, int posy);
};
/* mission_start functions are first run when a mission is accepted; this
* initializes the mission's key values, like the target and description.
* These functions are also run once a turn for each active mission, to check
* if the current goal has been reached. At that point they either start the
* goal, or run the appropriate mission_end function.
*/
struct mission_start {
void standard (game *, mission *); // Standard for its goal type
void infect_npc (game *, mission *); // DI_INFECTION, remove antibiotics
void place_dog (game *, mission *); // Put a dog in a house!
void place_zombie_mom (game *, mission *); // Put a zombie mom in a house!
void place_npc_software(game *, mission *); // Put NPC-type-dependant software
void reveal_hospital (game *, mission *); // Reveal the nearest hospital
};
struct mission_end { // These functions are run when a mission ends
void standard (game *, mission *){}; // Nothing special happens
void heal_infection (game *, mission *);
};
struct mission_fail {
void standard (game *, mission *){}; // Nothing special happens
void kill_npc (game *, mission *); // Kill the NPC who assigned it!
};
struct mission_type {
int id; // Matches it to a mission_id above
std::string name; // The name the mission is given in menus
mission_goal goal; // The basic goal type
int difficulty; // Difficulty; TODO: come up with a scale
int value; // Value; determines rewards and such
int deadline_low, deadline_high; // Low and high deadlines (turn numbers)
bool urgent; // If true, the NPC will press this mission!
std::vector<mission_origin> origins; // Points of origin
itype_id item_id;
mission_id follow_up;
bool (mission_place::*place)(game *g, int x, int y);
void (mission_start::*start)(game *g, mission *);
void (mission_end ::*end )(game *g, mission *);
void (mission_fail ::*fail )(game *g, mission *);
mission_type(int ID, std::string NAME, mission_goal GOAL, int DIF, int VAL,
bool URGENT,
bool (mission_place::*PLACE)(game *, int x, int y),
void (mission_start::*START)(game *, mission *),
void (mission_end ::*END )(game *, mission *),
void (mission_fail ::*FAIL )(game *, mission *)) :
id (ID), name (NAME), goal (GOAL), difficulty (DIF), value (VAL),
urgent(URGENT), place (PLACE), start (START), end (END), fail (FAIL)
{
deadline_low = 0;
deadline_high = 0;
item_id = itm_null;
follow_up = MISSION_NULL;
};
mission create(game *g, int npc_id = -1); // Create a mission
};
struct mission {
mission_type *type;
std::string description; // Basic descriptive text
bool failed; // True if we've failed it!
int value;
int uid; // Unique ID number, used for referencing elsewhere
point target; // Marked on the player's map. (-1,-1) for none
itype_id item_id; // Item that needs to be found (or whatever)
int count; // How many of that item
int deadline; // Turn number
int npc_id; // ID of a related npc
int good_fac_id, bad_fac_id; // IDs of the protagonist/antagonist factions
int step; // How much have we completed?
mission_id follow_up; // What mission do we get after this succeeds?
text_hash text;
std::string name();
mission()
{
type = NULL;
description = "";
failed = false;
value = 0;
uid = -1;
target = point(-1, -1);
item_id = itm_null;
count = 0;
deadline = 0;
npc_id = -1;
good_fac_id = -1;
bad_fac_id = -1;
step = 0;
}
};
#endif