Skip to content

Commit

Permalink
Balance changes
Browse files Browse the repository at this point in the history
  • Loading branch information
benfrankel committed Jul 29, 2024
1 parent 2d44879 commit ee0fe39
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 35 deletions.
18 changes: 12 additions & 6 deletions assets/config/actor.ron
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@

attack: Attack(color: Srgba(Srgba(red: 0.929, green: 0.557, blue: 0.576, alpha: 1.000))),
health: Health(current: 10, max: 10),
deck: Deck(cards: ["step", "step", "pair"]),
xp_reward: 5,
deck: Deck(cards: ["eighth_note", "step"]),
),

"purple": Actor(
Expand All @@ -87,7 +88,8 @@

attack: Attack(color: Srgba(Srgba(red: 0.694, green: 0.529, blue: 0.788, alpha: 1.000))),
health: Health(current: 15, max: 15),
deck: Deck(cards: ["step"]),
xp_reward: 10,
deck: Deck(cards: ["step", "step", "step", "pair"]),
),

"blue": Actor(
Expand All @@ -110,12 +112,14 @@

attack: Attack(color: Srgba(Srgba(red: 0.424, green: 0.694, blue: 0.725, alpha: 1.000))),
health: Health(current: 25, max: 25),
deck: Deck(cards: ["step", "quarter_note"]),
xp_reward: 15,
deck: Deck(cards: ["step", "quarter_note", "eighth_rest", "pair"]),
),

"green": Actor(
name: "Jade",
min_level: 6,
weight: 1.2,

texture: "image/actor/green.png",
texture_atlas_grid: TextureAtlasGrid(
Expand All @@ -132,13 +136,14 @@

attack: Attack(color: Srgba(Srgba(red: 0.557, green: 0.722, blue: 0.518, alpha: 1.000))),
health: Health(current: 40, max: 40),
deck: Deck(cards: ["half_note"]),
xp_reward: 20,
deck: Deck(cards: ["quarter_note", "quarter_note", "quarter_note", "ballet"]),
),

"yellow": Actor(
name: "Lemon",
min_level: 8,
weight: 1.5,
weight: 1.6,

texture: "image/actor/yellow.png",
texture_atlas_grid: TextureAtlasGrid(
Expand All @@ -155,7 +160,8 @@

attack: Attack(color: Srgba(Srgba(red: 0.827, green: 0.761, blue: 0.537, alpha: 1.000))),
health: Health(current: 60, max: 60),
deck: Deck(cards: ["step", "whole_note", "quarter_rest"]),
xp_reward: 40,
deck: Deck(cards: ["step", "quarter_rest", "cartwheel", "half_note"]),
),
},
)
32 changes: 15 additions & 17 deletions assets/config/card.ron
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
action: Move,
action_modifier: CardActionModifier(
remove_on_beat: 4,
movement: Movement(speed: 160.0, facing_offset: 0.25),
movement: Movement(speed: 160.0, direction: 0.25),
contact_damage: 20,
contact_beats: 6,
immunity: 0.4,
Expand All @@ -148,11 +148,11 @@
play_sfx: "audio/sfx/444407__mootmcnoodles__slap.ogg",
action: Move,
action_modifier: CardActionModifier(
remove_on_beat: 8,
movement: Movement(speed: 40.0, facing_offset: 0.5),
remove_on_beat: 12,
movement: Movement(speed: 50.0, direction: 0.5),
contact_damage: 50,
contact_beats: 8,
immunity: 0.5,
contact_beats: 12,
immunity: 0.8,
),
),

Expand Down Expand Up @@ -251,47 +251,45 @@
description: "Heal a little bit",
background: "green",
icon: "eighth_rest",
min_level: 2,
max_level: 4,
weight: 0.5,

action: Heal,
action_modifier: CardActionModifier(heal_flat: 5, immunity: 0.5),
action_modifier: CardActionModifier(heal_flat: 5, immunity: 0.7),
),
"quarter_rest": Card(
name: "Quarter Rest",
description: "Heal 25% health",
background: "green",
icon: "quarter_rest",
min_level: 5,
min_level: 4,
max_level: 8,
weight: 0.5,
weight: 0.7,

action: Heal,
action_modifier: CardActionModifier(heal_percent: 25, immunity: 0.5),
action_modifier: CardActionModifier(heal_percent: 25, immunity: 0.8),
),
"half_rest": Card(
name: "Half Rest",
description: "Heal 50% health",
background: "green",
icon: "half_rest",
min_level: 7,
max_level: 10,
weight: 0.5,
min_level: 6,
max_level: 9,
weight: 0.6,

action: Heal,
action_modifier: CardActionModifier(heal_percent: 50, immunity: 0.5),
action_modifier: CardActionModifier(heal_percent: 50, immunity: 0.9),
),
"whole_rest": Card(
name: "Whole Rest",
description: "Heal 100% health",
background: "green",
icon: "whole_rest",
min_level: 9,
min_level: 8,
weight: 0.5,

action: Heal,
action_modifier: CardActionModifier(heal_percent: 100, immunity: 0.5),
action_modifier: CardActionModifier(heal_percent: 100, immunity: 1.0),
),
}
)
2 changes: 1 addition & 1 deletion assets/config/wave.ron
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
min_distance: 150.0,
max_distance: 180.0,
spawn_count_scale: 0.5,
max_spawn_count: 100,
spawn_cap: 8,
)
14 changes: 13 additions & 1 deletion src/game/actor/level/up.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ use bevy_kira_audio::prelude::*;
use pyri_state::prelude::*;

use crate::core::UpdateSet;
use crate::game::actor::health::Health;
use crate::game::actor::level::xp::Xp;
use crate::game::actor::level::Level;
use crate::game::actor::level::LevelConfig;
use crate::game::actor::player::IsPlayer;
use crate::screen::playing::victory_menu::EndlessMode;
use crate::screen::playing::PlayingAssets;
use crate::screen::playing::PlayingMenu;
Expand All @@ -25,13 +27,16 @@ impl Configure for LevelUp {
app.add_systems(
Update,
(
heal_on_level_up
.in_set(UpdateSet::Update)
.run_if(on_event::<Self>()),
play_level_up_sfx
.in_set(UpdateSet::Update)
.run_if(on_event::<Self>()),
update_level_up_from_xp.in_set(UpdateSet::TriggerLevelUp),
trigger_level_up
.in_set(UpdateSet::TriggerLevelUp)
.run_if(PlayingMenu::is_disabled),
.run_if(PlayingMenu::will_be_disabled),
)
.chain(),
);
Expand Down Expand Up @@ -87,3 +92,10 @@ fn trigger_level_up(
fn play_level_up_sfx(audio: Res<Audio>, assets: Res<PlayingAssets>) {
audio.play(assets.sfx_level_up.clone()).with_volume(0.8);
}

fn heal_on_level_up(mut player_query: Query<&mut Health, With<IsPlayer>>) {
for mut health in &mut player_query {
health.max += 25.0;
health.current = health.max;
}
}
2 changes: 0 additions & 2 deletions src/game/actor/player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use crate::game::actor::facing::FacingIndicator;
use crate::game::actor::faction::Faction;
use crate::game::actor::movement::input::movement_action;
use crate::game::actor::ActorConfig;
use crate::game::combat::damage::HitboxDamage;
use crate::game::combat::death::DeathSfx;
use crate::game::combat::hit::Hitbox;
use crate::game::combat::hit::HurtSfx;
Expand Down Expand Up @@ -75,7 +74,6 @@ pub fn player(key: impl Into<String>) -> impl EntityCommand {
FaceCursor,
// Contact hitbox was for testing, but it's funny, so I'm leaving it in.
Hitbox,
HitboxDamage(0.0),
HitboxKnockback(150.0, false),
HurtSfx(sfx_hurt, 1.8),
DeathSfx(sfx_death, 1.0),
Expand Down
4 changes: 2 additions & 2 deletions src/game/card/movement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ fn apply_move_towards_facing(
for (mut movement, mut controller, facing, move_towards_facing) in &mut movement_query {
*movement = move_towards_facing.0;

let facing_angle = Vec2::from_angle(movement.direction * TAU);
controller.0 += (*facing.0).rotate(facing_angle);
let offset = Vec2::from_angle(movement.direction * TAU);
controller.0 += (*facing.0).rotate(offset);
}
}
4 changes: 2 additions & 2 deletions src/game/combat/damage.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use bevy::prelude::*;

use crate::game::cleanup::RemoveOnTimer;
use crate::game::cleanup::RemoveOnBeat;
use crate::game::combat::hit::OnHit;
use crate::util::prelude::*;

Expand All @@ -17,9 +17,9 @@ pub struct HitboxDamage(pub f32);

impl Configure for HitboxDamage {
fn configure(app: &mut App) {
app.configure::<RemoveOnBeat<Self>>();
app.register_type::<Self>();
app.observe(apply_hitbox_damage);
app.configure::<RemoveOnTimer<Self>>();
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/game/combat/hit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ pub struct Immune;

impl Configure for Immune {
fn configure(app: &mut App) {
app.register_type::<Self>();
app.configure::<RemoveOnTimer<Self>>();
app.register_type::<Self>();
}
}

Expand Down
10 changes: 7 additions & 3 deletions src/game/wave.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use serde::Serialize;
use crate::core::camera::CameraRoot;
use crate::core::UpdateSet;
use crate::game::actor::enemy::enemy;
use crate::game::actor::enemy::IsEnemy;
use crate::game::actor::level::Level;
use crate::game::actor::ActorConfig;
use crate::game::audio::music::on_full_beat;
Expand All @@ -24,7 +25,7 @@ pub struct WaveConfig {
pub min_distance: f32,
pub max_distance: f32,
pub spawn_count_scale: f32,
pub max_spawn_count: usize,
pub spawn_cap: usize,
}

impl Config for WaveConfig {
Expand Down Expand Up @@ -62,6 +63,7 @@ fn spawn_wave_enemies(
actor_config: ConfigRef<ActorConfig>,
camera_root: Res<CameraRoot>,
camera_query: Query<&GlobalTransform>,
enemy_query: Query<(), With<IsEnemy>>,
mut wave_query: Query<(&mut Wave, &Selection)>,
level_query: Query<&Level>,
) {
Expand All @@ -70,6 +72,8 @@ fn spawn_wave_enemies(
let camera_gt = r!(camera_query.get(camera_root.primary));
let center = camera_gt.translation().xy();

let mut spawn_cap = config.spawn_cap.saturating_sub(enemy_query.iter().count());

let mut rng = rand::thread_rng();
for (mut wave, selection) in &mut wave_query {
let level = c!(level_query.get(selection.0));
Expand All @@ -86,8 +90,8 @@ fn spawn_wave_enemies(
.filter(|(_, enemy)| enemy.min_level <= level && level <= enemy.max_level)
.collect::<Vec<_>>();

let spawn_count =
((level as f32 * config.spawn_count_scale) as usize).clamp(1, config.max_spawn_count);
let spawn_count = ((level as f32 * config.spawn_count_scale) as usize).clamp(1, spawn_cap);
spawn_cap = spawn_cap.saturating_sub(spawn_count);
for _ in 0..spawn_count {
let enemy_key = c!(enemy_pool.choose_weighted(&mut rng, |(_, enemy)| enemy.weight)).0;
let offset =
Expand Down

0 comments on commit ee0fe39

Please sign in to comment.