### Aura example: Stormwind Champion (CS2_222) Source: https://github.com/hearthsim/sabberstone/wiki/Implement-Cards Shows how to implement a static aura that gives +1/+1 to other minions. Uses AuraType.BOARD_EXCEPT_SOURCE and references an enchantment card 'CS2_222o'. ```csharp // --------------------------------------- MINION - NEUTRAL // [CS2_222] Stormwind Champion - COST:7 [ATK:6/HP:6] // - Fac: alliance, Set: core, Rarity: free // -------------------------------------------------------- // Text: Your other minions have +1/+1. // -------------------------------------------------------- // GameTag: // - AURA = 1 // -------------------------------------------------------- cards.Add("CS2_222", new Power { Aura = new Aura(AuraType.BOARD_EXCEPT_SOURCE, "CS2_222o") }); ``` -------------------------------- ### Chillwind Yeti - card without power Source: https://github.com/hearthsim/sabberstone/wiki/Implement-Cards Example of a minion with no text, so its Power is null. The card is added with null to indicate no implementation needed. ```csharp // --------------------------------------- MINION - NEUTRAL // [CS2_182] Chillwind Yeti - COST:4 [ATK:4/HP:5] // - Fac: neutral, Set: core, Rarity: free // -------------------------------------------------------- cards.Add("CS2_182", null); ``` -------------------------------- ### Aura example: Sorcerer's Apprentice (EX1_608) Source: https://github.com/hearthsim/sabberstone/wiki/Implement-Cards Shows how to implement an aura that reduces spell cost by 1. Uses AuraType.HAND, Effects.ReduceCost(1), and a Condition to limit to spells. ```csharp // ------------------------------------------ MINION - MAGE // [EX1_608] Sorcerer's Apprentice - COST:2 [ATK:3/HP:2] // - Fac: neutral, Set: expert1, Rarity: common // -------------------------------------------------------- // Text: Your spells cost (1) less. // -------------------------------------------------------- // GameTag: // - AURA = 1 // -------------------------------------------------------- cards.Add("EX1_608", new Power { Aura = new Aura(AuraType.HAND, Effects.ReduceCost(1)) { Condition = SelfCondition.IsSpell } }); ``` -------------------------------- ### Trigger example: Gadgetzan Auctioneer (EX1_095) Source: https://github.com/hearthsim/sabberstone/wiki/Implement-Cards Shows how to implement a trigger for a card that draws a card whenever you cast a spell. Uses TriggerType.CAST_SPELL, TriggerSource.FRIENDLY, and SingleTask DrawTask. ```csharp // --------------------------------------- MINION - NEUTRAL // [EX1_095] Gadgetzan Auctioneer - COST:6 [ATK:4/HP:4] // - Fac: neutral, Set: expert1, Rarity: rare // -------------------------------------------------------- // Text: Whenever you cast a spell, draw a card. // -------------------------------------------------------- cards.Add("EX1_095", new Power { Trigger = new Trigger(TriggerType.CAST_SPELL) { TriggerSource = TriggerSource.FRIENDLY, SingleTask = new DrawTask() } }); ``` -------------------------------- ### Adaptive Effect example: Spirit Claws (KAR_063) Source: https://github.com/hearthsim/sabberstone/wiki/Implement-Cards Shows how to implement an adaptive aura that changes attack based on spell damage. Uses AdaptiveEffect with a lambda that checks CurrentSpellPower. ```csharp // ---------------------------------------- WEAPON - SHAMAN // [KAR_063] Spirit Claws - COST:2 [ATK:1/HP:0] // - Set: kara, Rarity: common // -------------------------------------------------------- // Text: [x]Has +2 Attack while you // have Spell Damage. // -------------------------------------------------------- // GameTag: // - DURABILITY = 3 // -------------------------------------------------------- // RefTag: // - SPELLPOWER = 1 // -------------------------------------------------------- cards.Add("KAR_063", new Power { Aura = new AdaptiveEffect(GameTag.ATK, EffectOperator.ADD, p => p.Controller.CurrentSpellPower > 0 ? 2 : 0) }); ``` -------------------------------- ### Al'Akir the Windlord - card without power Source: https://github.com/hearthsim/sabberstone/wiki/Implement-Cards Example of a minion with keywords (Charge, Divine Shield, Taunt, Windfury) that are supported by the engine, so its Power is null. ```csharp // ---------------------------------------- MINION - SHAMAN // [NEW1_010] Al'Akir the Windlord - COST:8 [ATK:3/HP:5] // - Race: elemental, Set: expert1, Rarity: legendary // -------------------------------------------------------- // Text: Charge, Divine Shield, Taunt, Windfury // -------------------------------------------------------- // GameTag: // - ELITE = 1 // - WINDFURY = 1 // - TAUNT = 1 // - DIVINE_SHIELD = 1 // - CHARGE = 1 // -------------------------------------------------------- cards.Add("NEW1_010", null); ``` -------------------------------- ### Wickerflame Burnbristle - card without power Source: https://github.com/hearthsim/sabberstone/wiki/Implement-Cards Example of a minion with keywords (Divine Shield, Taunt, Lifesteal) that are supported by the engine, so its Power is null. ```csharp // --------------------------------------- MINION - PALADIN // [CFM_815] Wickerflame Burnbristle - COST:3 [ATK:2/HP:2] // - Set: gangs, Rarity: legendary // -------------------------------------------------------- // Text: Divine Shield, Taunt, Lifesteal // -------------------------------------------------------- // GameTag: // - ELITE = 1 // - TAUNT = 1 // - DIVINE_SHIELD = 1 // - LIFESTEAL = 1 // -------------------------------------------------------- cards.Add("CFM_815", null); ``` -------------------------------- ### Battle Rage Spell Implementation with ComplexTask Source: https://github.com/hearthsim/sabberstone/wiki/Implement-Cards Example of implementing the Battle Rage spell in SabberStone. It uses a ComplexTask composed of IncludeTask, FilterStackTask, CountTask, and DrawNumberTask to draw a card for each damaged friendly character. This demonstrates the builder method ComplexTask.Create(params ISimpleTask tasks). ```csharp // ---------------------------------------- SPELL - WARRIOR // [EX1_392] Battle Rage - COST:2 // - Fac: neutral, Set: expert1, Rarity: common // -------------------------------------------------------- // Text: Draw a card for each damaged friendly character. // -------------------------------------------------------- // PlayReq: // - REQ_MINION_TARGET = 0 // -------------------------------------------------------- cards.Add("EX1_392", new Power { PowerTask = ComplexTask.Create( new IncludeTask(EntityType.FRIENDS), new FilterStackTask(SelfCondition.IsDamaged), new CountTask(EntityType.STACK), new DrawNumberTask()) }); ``` -------------------------------- ### Fireball Spell Implementation with DamageTask Source: https://github.com/hearthsim/sabberstone/wiki/Implement-Cards Example of implementing the Fireball spell in SabberStone. It uses a DamageTask with EntityType.TARGET and damage 6, assigned to the PowerTask property. This is a simple case using a SimpleTask. ```csharp // ------------------------------------------- SPELL - MAGE // [CS2_029] Fireball - COST:4 // - Fac: neutral, Set: core, Rarity: free // -------------------------------------------------------- // Text: Deal $6 damage. @spelldmg // -------------------------------------------------------- // PlayReq: // - REQ_TARGET_TO_PLAY = 0 // -------------------------------------------------------- cards.Add("CS2_029", new Power { PowerTask = new DamageTask(6, EntityType.TARGET, true) }); ``` -------------------------------- ### C# Test Method for Greater Arcane Missiles (CFM_623) Source: https://github.com/hearthsim/sabberstone/wiki/Implement-Cards This test method verifies the behavior of the 'Greater Arcane Missiles' card. It sets up a game with two mage players, draws and plays minions, casts the spell, and checks health totals and spell power. The test includes assertions for health after initial setup, after casting the spell, and after a second cast with spell power. ```csharp [TestMethod] public void GreaterArcaneMissiles_CFM_623() { var game = new Game(new GameConfig { StartPlayer = 1, Player1HeroClass = CardClass.MAGE, Player2HeroClass = CardClass.MAGE, FillDecks = true }); game.StartGame(); game.Player1.BaseMana = 10; game.Player2.BaseMana = 10; var minion1 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Ironfur Grizzly")); game.Process(PlayCardTask.Any(game.CurrentPlayer, (ICharacter)minion1)); var minion2 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Ironfur Grizzly")); game.Process(PlayCardTask.Any(game.CurrentPlayer, (ICharacter)minion2)); game.Process(EndTurnTask.Any(game.CurrentPlayer)); var totHealth = game.CurrentOpponent.Hero.Health; totHealth += ((ICharacter)minion1).Health; totHealth += ((ICharacter)minion2).Health; Assert.AreEqual(36, totHealth); var spell1 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Greater Arcane Missiles")); game.Process(PlayCardTask.Spell(game.CurrentPlayer, spell1)); totHealth = game.CurrentOpponent.Hero.Health; totHealth += ((ICharacter)minion1).IsDead ? 0 : ((ICharacter)minion1).Health; totHealth += ((ICharacter)minion2).IsDead ? 0 : ((ICharacter)minion2).Health; Assert.AreEqual(27, totHealth); var minion3 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Dalaran Mage")); game.Process(PlayCardTask.Minion(game.CurrentPlayer, (ICharacter)minion3)); game.Process(EndTurnTask.Any(game.CurrentPlayer)); game.Process(EndTurnTask.Any(game.CurrentPlayer)); var spell2 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Greater Arcane Missiles")); game.Process(PlayCardTask.Spell(game.CurrentPlayer, spell2)); totHealth = game.CurrentOpponent.Hero.Health; totHealth += ((ICharacter)minion1).IsDead ? 0 : ((ICharacter)minion1).Health; totHealth += ((ICharacter)minion2).IsDead ? 0 : ((ICharacter)minion2).Health; // Spellpower check Assert.AreEqual(1, game.CurrentPlayer.Hero.SpellPower); Assert.AreEqual(15, totHealth); } ``` -------------------------------- ### Preparation Spell and Enchantment Implementation Source: https://github.com/hearthsim/sabberstone/wiki/Implement-Cards Implements Preparation spell and its enchantment. The spell adds a controller enchantment that reduces spell costs by 3 via an aura. ```csharp // ------------------------------------------ SPELL - ROGUE // [EX1_145] Preparation - COST:0 // - Fac: neutral, Set: expert1, Rarity: epic // -------------------------------------------------------- // Text: The next spell you cast this turn costs (3) less. // -------------------------------------------------------- cards.Add("EX1_145", new Power { PowerTask = new AddEnchantmentTask("EX1_145o", EntityType.CONTROLLER) }); // ------------------------------------ ENCHANTMENT - ROGUE // [EX1_145o] Preparation (*) - COST:0 // - Set: expert1, // -------------------------------------------------------- // Text: The next spell you cast this turn costs (3) less. // -------------------------------------------------------- // GameTag: // - TAG_ONE_TURN_EFFECT = 1 // -------------------------------------------------------- cards.Add("EX1_145o", new Power { Aura = new Aura(AuraType.HAND, Effects.ReduceCost(3)) { Condition = SelfCondition.IsSpell, RemoveTrigger = (TriggerType.CAST_SPELL, null) } }); ``` -------------------------------- ### Manual Enchantment Implementation for Greenskin's Command Source: https://github.com/hearthsim/sabberstone/wiki/Implement-Cards Shows how to manually define an enchantment when the automatic parser cannot handle it. The enchantment adds +1/+1 to the target's ATK and DURABILITY. ```csharp // ---------------------------------- ENCHANTMENT - NEUTRAL // [NEW1_024o] Greenskin's Command (*) - COST:0 // - Set: expert1, // -------------------------------------------------------- // Text: +1/+1. // -------------------------------------------------------- cards.Add("NEW1_024o", new Power { Enchant = new Enchant( new Effect(GameTag.ATK, EffectOperator.ADD, 1), new Effect(GameTag.DURABILITY, EffectOperator.ADD, 1)) }); ``` -------------------------------- ### Pregenerated Code for Greater Arcane Missiles Source: https://github.com/hearthsim/sabberstone/wiki/Implement-Cards Shows the pregenerated card definition for Greater Arcane Missiles with a TODO for implementation. ```sh // ------------------------------------------- SPELL - MAGE // [CFM_623] Greater Arcane Missiles - COST:7 // - Set: gangs, Rarity: epic // -------------------------------------------------------- // Text: Shoot three missiles at random enemies that deal $3 damage each. *spelldmg // -------------------------------------------------------- cards.Add("CFM_623", new List { // TODO [CFM_623] Greater Arcane Missiles && Test: Greater Arcane Missiles_CFM_623 new Enchantment { Activation = EnchantmentActivation.SPELL, SingleTask = null, }, }); ``` -------------------------------- ### Power class definition Source: https://github.com/hearthsim/sabberstone/wiki/Implement-Cards Defines the Power class with properties for scripting card effects. InfoCardId is not used at runtime; Aura for passive effects; Enchant for enchantment cards; Trigger for 'Whenever'/'After' effects; PowerTask for battlecries, spells, and hero powers; DeathrattleTask and ComboTask are self-explanatory. ```csharp public class Power { public string InfoCardId { get; set; } = null; public Aura Aura { get; set; } public Enchant Enchant { get; set; } public Trigger Trigger { get; set; } public ISimpleTask PowerTask { get; set; } public ISimpleTask DeathrattleTask { get; set; } public ISimpleTask ComboTask { get; set; } } ``` -------------------------------- ### SingleTask Implementation for Greater Arcane Missiles Source: https://github.com/hearthsim/sabberstone/wiki/Implement-Cards Defines the SingleTask to enqueue three random missiles dealing 3 damage each, with spell damage scaling. ```sh SingleTask = new EnqueueTask( 3, // times we enqueue the task ComplexTask.DamageRandomTargets(3, EntityType.ENEMIES, 1), // 3dmg, targetslist, how many of them true) // if spell damage will increase enqueueing .... like arcane missiles ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.