Skip to content

Commit 320fa4b

Browse files
committed
v1.0.20
1 parent bf16076 commit 320fa4b

File tree

115 files changed

+4994
-3661
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+4994
-3661
lines changed

Cargo.lock

+74-66
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+20-11
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
[package]
22
name = "rebels"
3-
version = "1.0.19"
3+
version = "1.0.20"
44
edition = "2021"
5+
authors = ["Alessandro Ricottone <[email protected]>"]
6+
license = "GPL-3.0-or-later"
7+
description = "Anarchic spacepirates playing basketball in your terminal"
8+
readme = "README.md"
9+
homepage = "https://github.com/ricott1/rebels-in-the-sky"
10+
repository = "https://github.com/ricott1/rebels-in-the-sky"
11+
keywords = ["cli", "pirates", "rebels", "game"]
12+
categories = ["games"]
513

614
[profile.release]
715
strip = true
@@ -16,17 +24,18 @@ opt-level = 1
1624
opt-level = 3
1725

1826
[dependencies]
19-
anyhow = "1.0.91"
27+
anyhow = "1.0.93"
2028
async-trait = "0.1.83"
2129
chrono = "0.4.38"
2230
clap = { version = "4.5.20", features = ["derive"] }
2331
crossterm = "0.28.1"
2432
directories = "5.0.1"
2533
ed25519-dalek = "2.1.1"
34+
flate2 = { version = "1.0.17", features = ["zlib-ng"], default-features = false }
2635
futures = "0.3.30"
2736
gif = "0.13.1"
28-
glam = "0.29.0"
29-
image = "0.25.4"
37+
glam = "0.29.2"
38+
image = "0.25.5"
3039
imageproc = "0.25.0"
3140
include_dir = "0.7.4"
3241
itertools = "0.13.0"
@@ -48,20 +57,20 @@ rand = "0.8.5"
4857
rand_chacha = "0.3.1"
4958
rand_distr = "0.4.3"
5059
ratatui = { version = "0.29.0", features = ["unstable-backend-writer"] }
51-
rodio = "0.19.0"
52-
russh = "0.45.0"
53-
russh-keys = "0.45.0"
54-
serde = { version = "1.0.212", features = ["derive", "default"] }
60+
rodio = "0.20.1"
61+
russh = "0.46.0"
62+
russh-keys = "0.46.0"
63+
serde = { version = "1.0.214", features = ["derive", "default"] }
5564
serde_json = "1.0.132"
5665
serde_repr = "0.1.19"
5766
sha2 = "0.10.8"
58-
stream-download = { version = "0.9.0", features = ["reqwest-rustls"] }
67+
stream-download = { version = "0.11.2", features = ["reqwest-rustls"] }
5968
strum = { version = "0.26.3", features = ["derive"] }
6069
strum_macros = "0.26.4"
61-
tokio = { version = "1.41.0", features = ["full"] }
70+
tokio = { version = "1.41.1", features = ["full"] }
6271
tokio-util = "0.7.12"
6372
tui-textarea = "0.7.0"
6473
unicode-width = "0.2.0"
65-
url = "2.5.2"
74+
url = "2.5.3"
6675
uuid = { version = "1.11.0", features = ["v4", "serde"] }
6776
void = "1.0.2"

README.md

+22-18
158 Bytes

assets/data/planets_data.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"resources": {},
2626
"filename": "sol",
2727
"rotation_period": 6,
28-
"revolution_period": 180,
28+
"revolution_period": 360,
2929
"gravity": 100,
3030
"asteroid_probability": 0.0,
3131
"planet_type": 1,
@@ -48,7 +48,7 @@
4848
"resources": {},
4949
"filename": "proxima",
5050
"rotation_period": 3,
51-
"revolution_period": 120,
51+
"revolution_period": 360,
5252
"gravity": 80,
5353
"asteroid_probability": 0.0,
5454
"planet_type": 1,
@@ -173,7 +173,7 @@
173173
},
174174
"filename": "earth",
175175
"rotation_period": 9,
176-
"revolution_period": 120,
176+
"revolution_period": 180,
177177
"gravity": 10,
178178
"asteroid_probability": 0.5,
179179
"planet_type": 2,
@@ -296,7 +296,7 @@
296296
},
297297
"filename": "rocky",
298298
"rotation_period": 9,
299-
"revolution_period": 120,
299+
"revolution_period": 360,
300300
"gravity": 2,
301301
"asteroid_probability": 0.0,
302302
"planet_type": 8,
@@ -323,7 +323,7 @@
323323
},
324324
"filename": "phobos",
325325
"rotation_period": 6,
326-
"revolution_period": 120,
326+
"revolution_period": 180,
327327
"gravity": 2,
328328
"asteroid_probability": 0.0,
329329
"planet_type": 8,

assets/head/octopulp1.png

10 Bytes

assets/hull/mask_jester_standard.png

-9 Bytes

assets/hull/mask_pincher_large.png

-12 Bytes

assets/hull/mask_pincher_standard.png

-9 Bytes

assets/hull/mask_shuttle_large.png

-8 Bytes

assets/hull/mask_shuttle_small.png

-4 Bytes

assets/hull/mask_shuttle_standard.png

-2 Bytes

assets/hull/pincher_large.png

-9 Bytes

assets/shooter/jester_double.png

139 Bytes

assets/shooter/jester_quadruple.png

142 Bytes

assets/shooter/pincher_double1.png

141 Bytes

assets/shooter/pincher_double2.png

141 Bytes

assets/shooter/pincher_quadruple1.png

142 Bytes

assets/shooter/pincher_quadruple2.png

142 Bytes

assets/shooter/shuttle_single0.png

135 Bytes

assets/shooter/shuttle_single1.png

135 Bytes

assets/shooter/shuttle_single2.png

135 Bytes

assets/shooter/shuttle_triple0.png

145 Bytes

assets/shooter/shuttle_triple1.png

145 Bytes

assets/shooter/shuttle_triple2.png

144 Bytes
223 Bytes
-8 Bytes
47 Bytes
-262 Bytes
Binary file not shown.
489 Bytes
50 Bytes
-71 Bytes
-468 Bytes
Binary file not shown.
146 Bytes
24 Bytes
0 Bytes
-170 Bytes
Binary file not shown.
-159 Bytes
Binary file not shown.
156 Bytes
156 Bytes

assets/storage/pincher_single.png

-171 Bytes
Binary file not shown.

assets/storage/pincher_single1.png

172 Bytes

assets/storage/pincher_single2.png

171 Bytes

src/app.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use stream_download::StreamDownload;
2020
use tokio::select;
2121
use void::Void;
2222

23-
const NETWORK_HANDLER_INIT_INTERVAL: u128 = 10 * SECONDS;
23+
const NETWORK_HANDLER_INIT_INTERVAL: Tick = 10 * SECONDS;
2424

2525
#[derive(Debug, PartialEq)]
2626
pub enum AppState {
@@ -40,6 +40,7 @@ pub struct App {
4040
seed_ip: Option<String>,
4141
network_port: Option<u16>,
4242
store_prefix: String,
43+
pub new_version_notified: bool,
4344
}
4445

4546
impl App {
@@ -194,6 +195,7 @@ impl App {
194195
seed_ip,
195196
network_port,
196197
store_prefix: store_prefix.to_string(),
198+
new_version_notified: false,
197199
}
198200
}
199201

@@ -227,7 +229,6 @@ impl App {
227229
Some(streaming_data) = Self::conditional_audio_event(& self.audio_player) => self.handle_streaming_data(streaming_data)?,
228230
Some(swarm_event) = Self::conditional_network_event(&mut self.network_handler) => self.handle_network_events(swarm_event)?,
229231
app_event = tui.events.next() => {
230-
231232
match app_event{
232233
TerminalEvent::Tick {tick} => {
233234
self.handle_tick_events(tick)?;
@@ -240,12 +241,13 @@ impl App {
240241
if let Err(e) = tui.draw(&mut self.ui, &self.world, self.audio_player.as_ref()).await {
241242
error!("Drawing error: {e}");
242243
}
243-
},
244-
TerminalEvent::Mouse(mouse_event) => {self.handle_mouse_events(mouse_event)?;
244+
},
245+
TerminalEvent::Mouse(mouse_event) => {
246+
self.handle_mouse_events(mouse_event)?;
245247
if let Err(e) = tui.draw(&mut self.ui, &self.world, self.audio_player.as_ref()).await {
246248
error!("Drawing error: {e}");
247249
}
248-
},
250+
},
249251
TerminalEvent::Resize(w, h) => tui.resize((w, h))?,
250252
TerminalEvent::Quit => self.quit()?,
251253
}

src/game_engine/action.rs

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ pub enum ActionSituation {
3939
AfterOffensiveRebound,
4040
AfterLongOffensiveRebound,
4141
AfterDefensiveRebound,
42+
AfterSubstitution,
4243
MissedShot,
4344
Turnover,
4445
CloseShot,

src/game_engine/game.rs

+31-35
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,12 @@ impl<'game> Game {
189189
game.attendance = attendance as u32;
190190
let mut default_output = ActionOutput::default();
191191
default_output.description = format!(
192-
"{} vs {}. Game is about to start here on {}! There are {} people in the stadium.",
193-
home_name, away_name, planet.name, game.attendance
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 { "" }
194198
);
195199
default_output.random_seed = seed;
196200
game.action_results.push(default_output);
@@ -280,7 +284,7 @@ impl<'game> Game {
280284
ActionSituation::LongShot => Action::LongShot,
281285
ActionSituation::MissedShot => Action::Rebound,
282286
ActionSituation::EndOfQuarter => Action::StartOfQuarter,
283-
ActionSituation::BallInBackcourt => {
287+
ActionSituation::AfterSubstitution | ActionSituation::BallInBackcourt => {
284288
let brawl_probability = BRAWL_ACTION_PROBABILITY
285289
* (self.home_team_in_game.tactic.brawl_probability_modifier()
286290
+ self.away_team_in_game.tactic.brawl_probability_modifier());
@@ -474,9 +478,8 @@ impl<'game> Game {
474478
fn get_rng_seed(&self) -> [u8; 32] {
475479
let mut seed = [0; 32];
476480
seed[0..16].copy_from_slice(self.id.as_bytes());
477-
seed[16..32].copy_from_slice(self.starting_at.to_be_bytes().as_ref());
478-
// Overwrite first two bytes with timer value
479-
seed[0..2].copy_from_slice(self.timer.value.to_be_bytes().as_ref());
481+
seed[16..24].copy_from_slice(self.starting_at.to_be_bytes().as_ref());
482+
seed[24..26].copy_from_slice(self.timer.value.to_be_bytes().as_ref());
480483

481484
seed
482485
}
@@ -719,7 +722,7 @@ impl<'game> Game {
719722
..Default::default()
720723
});
721724
}
722-
_ =>
725+
(false, false) =>
723726
// Check if teams make substitutions. Only if ball is out
724727
{
725728
if let Some(sub) = Substitution::execute(action_input, self, rng) {
@@ -740,7 +743,7 @@ impl<'game> Game {
740743
mod tests {
741744
use super::Game;
742745
use crate::game_engine::types::TeamInGame;
743-
use crate::types::GameId;
746+
use crate::types::{AppResult, GameId};
744747
use crate::types::{SystemTimeTick, Tick};
745748
use crate::world::constants::DEFAULT_PLANET_ID;
746749
use crate::world::world::World;
@@ -749,36 +752,28 @@ mod tests {
749752

750753
#[ignore]
751754
#[test]
752-
fn test_game() {
755+
fn test_game() -> AppResult<()> {
753756
let mut world = World::new(None);
754757
let rng = &mut ChaCha8Rng::seed_from_u64(world.seed);
755758

756-
// world.initialize(true);
757-
758-
// let home_planet = world.planets.get(&DEFAULT_PLANET_ID).unwrap();
759-
let id0 = world
760-
.generate_random_team(
761-
rng,
762-
DEFAULT_PLANET_ID.clone(),
763-
"Testen".to_string(),
764-
"Tosten".to_string(),
765-
)
766-
.unwrap();
767-
let id1 = world
768-
.generate_random_team(
769-
rng,
770-
DEFAULT_PLANET_ID.clone(),
771-
"Holalo".to_string(),
772-
"Halley".to_string(),
773-
)
774-
.unwrap();
775-
776-
let home_team = world.get_team(id0).unwrap().clone();
759+
let id0 = world.generate_random_team(
760+
rng,
761+
DEFAULT_PLANET_ID.clone(),
762+
"Testen".to_string(),
763+
"Tosten".to_string(),
764+
)?;
765+
let id1 = world.generate_random_team(
766+
rng,
767+
DEFAULT_PLANET_ID.clone(),
768+
"Holalo".to_string(),
769+
"Halley".to_string(),
770+
)?;
771+
772+
let home_team = world.get_team(&id0).unwrap().clone();
777773

778774
let checked_player_id = home_team.player_ids[0];
779775
let quickness_before = world
780-
.get_player(checked_player_id)
781-
.unwrap()
776+
.get_player_or_err(&checked_player_id)?
782777
.athletics
783778
.quickness
784779
.clone();
@@ -791,7 +786,7 @@ mod tests {
791786
home_team_in_game.unwrap(),
792787
away_team_in_game.unwrap(),
793788
Tick::now(),
794-
&world.get_planet(DEFAULT_PLANET_ID.clone()).unwrap(),
789+
&world.get_planet(&DEFAULT_PLANET_ID).unwrap(),
795790
);
796791

797792
game.home_team_in_game
@@ -821,11 +816,12 @@ mod tests {
821816
let _ = world.handle_tick_events(Tick::now());
822817
}
823818
let quickness_after = world
824-
.get_player(checked_player_id)
825-
.unwrap()
819+
.get_player_or_err(&checked_player_id)?
826820
.athletics
827821
.quickness
828822
.clone();
829823
println!("{} {}", quickness_before, quickness_after);
824+
825+
Ok(())
830826
}
831827
}

src/game_engine/rebound.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use std::{
1414
collections::HashMap,
1515
};
1616

17-
const MIN_REBOUND_VALUE: u16 = 42;
17+
const MIN_REBOUND_VALUE: u16 = 40;
1818
const REBOUND_POSITION_SCALING: f32 = 12.0;
1919

2020
fn position_rebound_bonus(idx: usize) -> f32 {

0 commit comments

Comments
 (0)