//! 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, }] }), ]) }