-
Notifications
You must be signed in to change notification settings - Fork 0
/
Events.ts
233 lines (205 loc) · 5.84 KB
/
Events.ts
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
import { hitpoint_array } from "./hitpoint"
import { PlayerAttributes } from "./PlayerAttributes"
export class Travel {
player: PlayerAttributes
destination_name: string
distance: number
food_consumed: string
constructor(
player: PlayerAttributes,
destination_name: string,
distance: number,
food_consumed: string
) {
this.player = player
this.destination_name = destination_name
this.distance = distance
this.food_consumed = food_consumed
this.player.home = destination_name
}
getPrompt() {
let options = [
"Seeking adventure and good fortune, our hero travels to ",
"In search of resources, trudges to ",
"With a restless spirit, " + this.player.prefix + " marches to ",
"This chapter begins with a journey to ",
]
let strPrompt =
options[Math.floor(Math.random() * options.length)] +
this.destination_name +
", " +
this.distance +
" hectares away. The travel was not without cost - " +
this.player.prefix +
" consumed " +
this.food_consumed +
" for sustenance."
return strPrompt
}
getMidJourneyPrompt() {
let options = [
"Seeking adventure and good fortune, our hero travels to ",
"In search of resources, " + this.player.name + "trudges to ",
"With a restless spirit, " + this.player.prefix + " marches to ",
"This chapter continues with a journey to ",
]
let strPrompt =
options[Math.floor(Math.random() * options.length)] +
this.destination_name +
", " +
this.distance +
" hectares away. The travel was not without cost. "
return strPrompt
}
}
export class Trade {
player: PlayerAttributes
tradepartner: string
goods_given: string
good_taken: string
constructor(
player: PlayerAttributes,
tradepartner: string,
goods_given: string,
good_taken: string
) {
this.player = player
this.tradepartner = tradepartner
this.goods_given = goods_given
this.good_taken = good_taken
}
getPrompt() {
let strPrompt =
"While traveling the lands of " +
this.player.home +
", " +
this.player.name +
" trades with " +
this.tradepartner +
", who exchanges " +
this.good_taken +
" for our hero's " +
this.goods_given +
"."
return strPrompt
}
getMidJourneyPrompt() {
let strPrompt =
"While traveling the lands of " +
this.player.home +
", " +
this.player.name +
" trades with " +
this.tradepartner +
"."
return strPrompt
}
}
export class Farm {
player: PlayerAttributes
destination_name: string
time_increase: number
food_produced: string
constructor(
player: PlayerAttributes,
destination_name: string,
time_increase: number,
food_produced: string
) {
this.player = player
this.destination_name = destination_name
this.time_increase = time_increase
this.food_produced = food_produced
}
getPrompt() {
let strPrompt =
"Settled in the the lands of " +
this.player.home +
", " +
this.player.prefix +
" has the need to farm resources for the next leg ahead. "
"Over the course of" +
this.time_increase +
" months yielded an increase in resources: " +
this.food_produced
;(".")
return strPrompt
}
getMidJourneyPrompt() {
let strPrompt =
"Settled in the the lands of " +
this.player.home +
", " +
this.player.prefix +
" has the need to farm resources for the next leg ahead. "
"Over the course of" +
this.time_increase +
" months yielded an increase in resources."
return strPrompt
}
}
export class Siege {
player: PlayerAttributes
destination_name: string
number_of_fighters: number
num_hits: number
victor: number
hitpoint_loss: number
constructor(
player: PlayerAttributes,
destination_name: string,
number_of_fighters: number,
num_hits: number,
victor: number,
hitpoint_loss: number
) {
this.player = player
this.destination_name = destination_name
this.number_of_fighters = number_of_fighters
this.num_hits = num_hits
this.victor = victor
this.hitpoint_loss = hitpoint_loss
}
getPrompt() {
let vict: string = ""
if (this.victor == 0) {
vict = "our hero is victorious!"
} else {
vict = "our hero is vanquished!"
}
this.player.hit_points -= this.hitpoint_loss
let strPrompt =
"Behold! A siege befalls our hero. Confronted by " +
this.number_of_fighters +
" foes, " +
"a battle ensues, leaving our protagonist with " +
this.num_hits +
" hits sustained, losing " +
this.hitpoint_loss +
" vital hit points, leaving " +
this.player.name +
hitpoint_array[this.player.hit_points]
"As fate would have it, " + vict
return strPrompt
}
getMidJourneyPrompt() {
let vict: string = ""
if (this.victor == 0) {
vict = "our hero is victorious!"
} else {
vict = "our hero is vanquished!"
}
let strPrompt =
"Behold! A siege befalls our hero. Confronted by " +
this.number_of_fighters +
" foes, " +
"a battle ensues, leaving our protagonist with " +
this.num_hits +
" hits sustained, losing " +
this.hitpoint_loss +
" vital hit points. " +
"As fate would have it, " +
vict
return strPrompt
}
}