@@ -17,7 +17,7 @@ use crate::{
17
17
} ,
18
18
} ;
19
19
use itertools:: Itertools ;
20
- use rand:: { Rng , SeedableRng } ;
20
+ use rand:: { seq :: SliceRandom , Rng , SeedableRng } ;
21
21
use rand_chacha:: ChaCha8Rng ;
22
22
use serde:: { Deserialize , Serialize } ;
23
23
use std:: fmt:: Debug ;
@@ -125,6 +125,10 @@ pub struct Game {
125
125
}
126
126
127
127
impl < ' game > Game {
128
+ pub fn is_network ( & self ) -> bool {
129
+ self . home_team_in_game . peer_id . is_some ( ) && self . away_team_in_game . peer_id . is_some ( )
130
+ }
131
+
128
132
pub fn new (
129
133
id : GameId ,
130
134
home_team_in_game : TeamInGame ,
@@ -188,14 +192,91 @@ impl<'game> Game {
188
192
* ( 1.0 + bonus_attendance) ;
189
193
game. attendance = attendance as u32 ;
190
194
let mut default_output = ActionOutput :: default ( ) ;
191
- default_output. description = format ! (
192
- "{} vs {}. Game is about to start here on {}! There are {} {}people in the stadium." ,
193
- home_name,
194
- away_name,
195
- planet. name,
196
- game. attendance,
197
- if game. attendance == 69 { "(nice) " } else { "" }
198
- ) ;
195
+
196
+ let opening_text = [
197
+ format ! (
198
+ "{} vs {}. The intergalactic showdown is kicking off on {}! {} fans have packed the arena{}." ,
199
+ home_name,
200
+ away_name,
201
+ planet. name,
202
+ game. attendance,
203
+ if game. attendance == 69 { " (nice)" } else { "" }
204
+ ) ,
205
+ format ! (
206
+ "It's {} against {}! We're live here on {} where {} spectators{} are buzzing with excitement." ,
207
+ home_name,
208
+ away_name,
209
+ planet. name,
210
+ game. attendance,
211
+ if game. attendance == 69 { " (nice)" } else { "" }
212
+ ) ,
213
+ format ! (
214
+ "The stage is set on {} for {} vs {}. A crowd of {}{} fans is ready for the action to unfold!" ,
215
+ planet. name,
216
+ home_name,
217
+ away_name,
218
+ game. attendance,
219
+ if game. attendance == 69 { " (nice)" } else { "" }
220
+ ) ,
221
+ format ! (
222
+ "{} and {} clash today on {}! An electric atmosphere fills the stadium with {} fans{} watching closely." ,
223
+ home_name,
224
+ away_name,
225
+ planet. name,
226
+ game. attendance,
227
+ if game. attendance == 69 { " (nice)" } else { "" }
228
+ ) ,
229
+ format ! (
230
+ "Welcome to {} for an epic battle: {} vs {}. The crowd of {} fans{} is ready to witness greatness!" ,
231
+ planet. name,
232
+ home_name,
233
+ away_name,
234
+ game. attendance,
235
+ if game. attendance == 69 { " (nice)" } else { "" }
236
+ ) ,
237
+ format ! (
238
+ "Tonight on {}, it's {} taking on {}. With {} passionate fans{} in attendance, the game is about to ignite!" ,
239
+ planet. name,
240
+ home_name,
241
+ away_name,
242
+ game. attendance,
243
+ if game. attendance == 69 { " (nice)" } else { "" }
244
+ ) ,
245
+ format ! (
246
+ "Game night on {}! {} faces off against {} before {} eager fans{} under the starry skies." ,
247
+ planet. name,
248
+ home_name,
249
+ away_name,
250
+ game. attendance,
251
+ if game. attendance == 69 { " (nice)" } else { "" }
252
+ ) ,
253
+ format ! (
254
+ "The rivalry continues on {}: {} vs {}. The crowd of {} fans{} is fired up for this clash!" ,
255
+ planet. name,
256
+ home_name,
257
+ away_name,
258
+ game. attendance,
259
+ if game. attendance == 69 { " (nice)" } else { "" }
260
+ ) ,
261
+ format ! (
262
+ "All eyes are on {} as {} battles {}. An audience of {}{} is here to cheer for their team!" ,
263
+ planet. name,
264
+ home_name,
265
+ away_name,
266
+ game. attendance,
267
+ if game. attendance == 69 { " (nice)" } else { "" }
268
+ ) ,
269
+ format ! (
270
+ "Here on {}, it's {} vs {}. A roaring crowd of {} fans{} awaits the start of the showdown!" ,
271
+ planet. name,
272
+ home_name,
273
+ away_name,
274
+ game. attendance,
275
+ if game. attendance == 69 { " (nice)" } else { "" }
276
+ ) ,
277
+ ] . choose ( & mut rng) . expect ( "There should be one option" ) . clone ( ) ;
278
+
279
+ default_output. description = opening_text;
199
280
default_output. random_seed = seed;
200
281
game. action_results . push ( default_output) ;
201
282
game
0 commit comments