Skip to content

Commit

Permalink
Rebalance heal cards
Browse files Browse the repository at this point in the history
  • Loading branch information
benfrankel committed Aug 21, 2024
1 parent f4fb8cf commit 71ad2a3
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 25 deletions.
6 changes: 3 additions & 3 deletions assets/config/actor.ron
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
),
sprite_animation: SpriteAnimation(
frames: [
SpriteAnimationFrame(index: 0, beats: 8),
SpriteAnimationFrame(index: 1, beats: 8),
SpriteAnimationFrame(index: 0, beats: 8),
],
),

attack: Attack(color: Srgba(Srgba(red: 0.855, green: 0.576, blue: 0.800, alpha: 1.000))),
health: Health(max: 100, current: 100),
deck: Deck(cards: ["step", "pair", "half_rest"]),
deck: Deck(cards: ["eighth_rest", "quarter_rest", "half_rest", "whole_rest"]),
),
},

Expand All @@ -36,8 +36,8 @@
),
sprite_animation: SpriteAnimation(
frames: [
SpriteAnimationFrame(index: 0, beats: 8),
SpriteAnimationFrame(index: 1, beats: 8),
SpriteAnimationFrame(index: 0, beats: 8),
],
),
Expand Down
36 changes: 24 additions & 12 deletions assets/config/card.ron
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@
},
// TODO: "contact damage" -> something more thematic?
card_map: {
/********/
/* Move */
/********/

"step": Card(
name: "Simple Step",
description: "Step forwards for 8 contact damage.\n\n\"fancy footwork starts here\"",
Expand Down Expand Up @@ -159,6 +163,10 @@
),
),

/**********/
/* Attack */
/**********/

"eighth_note": Card(
name: "Eighth Note",
description: "Sing an eighth note.",
Expand Down Expand Up @@ -296,23 +304,27 @@
),
),

/********/
/* Heal */
/********/

"eighth_rest": Card(
name: "Eighth Rest",
description: "Heal a little bit.",
description: "Restore 5 health.",
background: "green",
icon: "eighth_rest",
max_level: 4,

action: Heal,
action_modifier: CardActionModifier(
heal_flat: 10,
immunity: 0.5,
heal_flat: 5,
immunity: 0.15,
attack: Attack(projectile: Some("eighth_rest"), offset: 8.0),
),
),
"quarter_rest": Card(
name: "Quarter Rest",
description: "Heal a good amount.",
description: "Restore 10 health.",
background: "green",
icon: "quarter_rest",
min_level: 4,
Expand All @@ -321,14 +333,14 @@

action: Heal,
action_modifier: CardActionModifier(
heal_flat: 30,
immunity: 0.666,
heal_flat: 10,
immunity: 0.25,
attack: Attack(projectile: Some("quarter_rest"), offset: 8.0),
),
),
"half_rest": Card(
name: "Half Rest",
description: "Heal for 25%.",
description: "Restore 25% of missing health.",
background: "green",
icon: "half_rest",
min_level: 6,
Expand All @@ -337,23 +349,23 @@

action: Heal,
action_modifier: CardActionModifier(
heal_percent: 25,
immunity: 0.833,
heal_percent_missing: 25,
immunity: 0.4,
attack: Attack(projectile: Some("half_rest"), offset: 8.0),
),
),
"whole_rest": Card(
name: "Whole Rest",
description: "Heal for 50%.",
description: "Restore 50% of missing health.",
background: "green",
icon: "whole_rest",
min_level: 8,
weight: 0.5,

action: Heal,
action_modifier: CardActionModifier(
heal_percent: 50,
immunity: 1.0,
heal_percent_missing: 50,
immunity: 0.65,
attack: Attack(projectile: Some("whole_rest"), offset: 8.0),
),
),
Expand Down
8 changes: 4 additions & 4 deletions assets/config/projectile.ron
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
"eighth_rest": Projectile(
name: "Eighth Rest",
texture: "image/projectile/eighth_rest.png",
lifetime: 0.55,
lifetime: 0.3,
),
"quarter_rest": Projectile(
name: "Quarter Rest",
texture: "image/projectile/quarter_rest.png",
lifetime: 0.716,
lifetime: 0.4,
),
"half_rest": Projectile(
name: "Half Rest",
texture: "image/projectile/half_rest.png",
lifetime: 0.9,
lifetime: 0.55,
),
"whole_rest": Projectile(
name: "Whole Rest",
texture: "image/projectile/whole_rest.png",
lifetime: 1.05,
lifetime: 0.8,
),
"eighth_note": Projectile(
name: "Eighth Note",
Expand Down
Binary file modified assets/image/card/icon/half_rest.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/image/card/icon/icons.aseprite
Binary file not shown.
Binary file modified assets/image/card/icon/whole_rest.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/image/projectile/projectiles.aseprite
Binary file not shown.
Binary file modified assets/image/projectile/quarter_rest.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 16 additions & 6 deletions src/game/card/action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,10 @@ impl FromWorld for CardActionMap {
let mut entity = r!(world.get_entity_mut(entity));

let mut health = r!(entity.get_mut::<Health>());
health.current += modifier.heal_percent_missing / 100.0
* (health.max - health.current).max(0.0);
health.current += modifier.heal_percent_max / 100.0 * health.max;
health.current += modifier.heal_flat;
health.current += modifier.heal_percent / 100.0 * health.max;

let mut attack_controller = r!(entity.get_mut::<AttackController>());
attack_controller.aim = Vec2::Y;
Expand Down Expand Up @@ -153,18 +155,22 @@ impl Default for CardAction {
}

#[derive(Reflect, Serialize, Deserialize, Clone)]
#[serde(default)]
#[serde(deny_unknown_fields, default)]
pub struct CardActionModifier {
/// Remove component after this many eighth-beats.
remove_on_beat: usize,
/// Remove component when this timer finishes.
remove_on_timer: Timer,

movement: Movement,

attack: Attack,
attack_on_beat: usize,
movement: Movement,
contact_damage: f32,
contact_beats: usize,
heal_percent: f32,

heal_percent_max: f32,
heal_percent_missing: f32,
heal_flat: f32,
immunity: f32,
}
Expand All @@ -174,12 +180,16 @@ impl Default for CardActionModifier {
Self {
remove_on_beat: 0,
remove_on_timer: Timer::default(),

movement: Movement::default(),

attack: Attack::default(),
attack_on_beat: 4,
movement: Movement::default(),
contact_damage: 0.0,
contact_beats: 0,
heal_percent: 0.0,

heal_percent_max: 0.0,
heal_percent_missing: 0.0,
heal_flat: 0.0,
immunity: 0.0,
}
Expand Down

0 comments on commit 71ad2a3

Please sign in to comment.