feat: module 02 action queue

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lucas WintherandClaude Opus 5.5 committed 2026-10-29 02:30:26 +01:00
1 parent 78dc09b303
commit 9c50591d3b
36 files changed
+3616

No files matched your search

@@ -0,0 +1,53 @@
//! Content: card definitions. Only this directory may name specific cards.
//!
//! Each effect is a small Rust function that returns engine actions. Module 5
//! replaces these functions with card data the engine interprets.
use crate::engine::{Action, CardDef, CardLibrary, TriggerOn};
/// Every card this game knows.
pub fn library() -> CardLibrary {
CardLibrary::new(vec![
// Fictional test minion with no text.
CardDef::minion("Test Filler", 1, 1),
// "Whenever a friendly minion takes damage, gain 1 Armor."
CardDef::minion("Armorsmith", 1, 4).on(TriggerOn::FriendlyMinionDamaged, |c| {
vec![Action::GainArmor {
player: c.owner,
amount: 1,
}]
}),
// "Whenever this minion takes damage, draw a card."
CardDef::minion("Acolyte of Pain", 1, 4).on(TriggerOn::SelfDamaged, |c| {
vec![Action::Draw { player: c.owner }]
}),
// Fictional: "Whenever a minion takes damage, deal 1 damage to the enemy hero."
CardDef::minion("Test Echo", 1, 5).on(TriggerOn::AnyMinionDamaged, |c| {
vec![Action::Damage {
targets: vec![c.enemy_hero()],
amount: 1,
}]
}),
// Fictional: "Whenever a hero takes damage, gain +1 Attack."
CardDef::minion("Test Reactor", 1, 5).on(TriggerOn::HeroDamaged, |c| {
vec![Action::GainAttack {
id: c.minion(),
amount: 1,
}]
}),
// Expansion Drop: "Whenever a minion takes damage, gain +1 Attack."
CardDef::minion("Frothing Berserker", 2, 4).on(TriggerOn::AnyMinionDamaged, |c| {
vec![Action::GainAttack {
id: c.minion(),
amount: 1,
}]
}),
// "Deal 1 damage to ALL minions."
CardDef::spell("Whirlwind", |c| {
vec![Action::Damage {
targets: c.world.minions_in_play(),
amount: 1,
}]
}),
])
}
@@ -0,0 +1,34 @@
// Content: card definitions. Only this directory may name specific cards.
//
// Each effect is a small function that returns engine actions. Module 5
// replaces these functions with card data the engine interprets.
import { CardLibrary, minion, spell } from "../engine";
/** Every card this game knows. */
export function library(): CardLibrary {
return new CardLibrary([
// Fictional test minion with no text.
minion("Test Filler", 1, 1),
// "Whenever a friendly minion takes damage, gain 1 Armor."
minion("Armorsmith", 1, 4, [
{ on: "friendlyMinionDamaged", effect: (c) => [{ type: "gainArmor", player: c.owner, amount: 1 }] },
]),
// "Whenever this minion takes damage, draw a card."
minion("Acolyte of Pain", 1, 4, [{ on: "selfDamaged", effect: (c) => [{ type: "draw", player: c.owner }] }]),
// Fictional: "Whenever a minion takes damage, deal 1 damage to the enemy hero."
minion("Test Echo", 1, 5, [
{ on: "anyMinionDamaged", effect: (c) => [{ type: "damage", targets: [c.enemyHero()], amount: 1 }] },
]),
// Fictional: "Whenever a hero takes damage, gain +1 Attack."
minion("Test Reactor", 1, 5, [
{ on: "heroDamaged", effect: (c) => [{ type: "gainAttack", id: c.minion(), amount: 1 }] },
]),
// Expansion Drop: "Whenever a minion takes damage, gain +1 Attack."
minion("Frothing Berserker", 2, 4, [
{ on: "anyMinionDamaged", effect: (c) => [{ type: "gainAttack", id: c.minion(), amount: 1 }] },
]),
// "Deal 1 damage to ALL minions."
spell("Whirlwind", (c) => [{ type: "damage", targets: c.world.minionsInPlay(), amount: 1 }]),
]);
}