heart containers

This commit is contained in:
2026-06-23 22:52:25 -05:00
parent 8637c0a52a
commit d8a3f17379
11 changed files with 58 additions and 20 deletions
+7
View File
@@ -79,6 +79,9 @@ pub(crate) enum Action {
/// Add `n` to the player's gem count (negative subtracts; the count is
/// clamped at 0). Zero time cost. Applied to `GameState::player_gems`.
AddGems(i64),
/// Add `dh` to the player's health (clamped to `[0, max_health]`). Zero time
/// cost. Applied to `GameState::player_health`.
AlterHealth(i64),
/// Give (`true`) or take (`false`) the named key color from the player.
///
/// Color must be one of `"blue"`, `"green"`, `"cyan"`, `"red"`, `"purple"`,
@@ -197,6 +200,10 @@ pub(crate) fn action_to_map(action: &Action) -> rhai::Map {
m.insert("type".into(), ds("AddGems"));
m.insert("n".into(), Dynamic::from(*n));
}
Action::AlterHealth(dh) => {
m.insert("type".into(), ds("AlterHealth"));
m.insert("dh".into(), Dynamic::from(*dh));
}
Action::SetKey(color, present) => {
m.insert("type".into(), ds("SetKey"));
m.insert("color".into(), Dynamic::from(color.clone()));