Skip to content

Instantly share code, notes, and snippets.

@clooth
Created August 5, 2015 22:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clooth/129bd50c2ccef758c4c0 to your computer and use it in GitHub Desktop.
Save clooth/129bd50c2ccef758c4c0 to your computer and use it in GitHub Desktop.
// Brawl Tests
import * as Brawl from "./brawl"
// Create a new match
let match = new Brawl.Match();
// Enter some players
let friendly = new Brawl.Player("Friendly", match);
let opposing = new Brawl.Player("Opposing", match);
// Create some cards
let slime = Brawl.Card.create("Slime", (card) => {
card.setAttribute(Brawl.Attribute.ATTACK, 4)
card.setAttribute(Brawl.Attribute.HEALTH, 6)
})
let creep = Brawl.Card.create("Creep", (card) => {
card.setAttribute(Brawl.Attribute.ATTACK, 7)
card.setAttribute(Brawl.Attribute.HEALTH, 7)
})
// Creep on the battlefield!
let homer = new Brawl.Creature(slime, friendly);
let moses = new Brawl.Creature(creep, opposing);
// Test combat
match.combat(homer, moses);
/**
* Console Log:
* Slime attacks Creep
* Slime deals 4 damage to Creep
* Creep deals 7 damage to Slime
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment