<commit_before>package com.hearthsim.test.helpers

import com.hearthsim.card.Card
import com.hearthsim.card.minion.Minion
import com.hearthsim.card.weapon.WeaponCard
import com.hearthsim.model.BoardModel
import com.hearthsim.model.PlayerSide

class BoardModelBuilder {

    private BoardModel boardModel
    private PlayerSide playerSide;

    BoardModel make(Closure definition) {
        if (!boardModel)
            boardModel = new BoardModel()

        runClosure definition

        boardModel
    }

    private hand(List cardsInHand) {
        // currently assuming it's a list of classes
        cardsInHand.each { boardModel.placeCardHand(playerSide, it.newInstance()) }
    }

    private field(List field) {
        field.each {
            def mana = it.mana
            def attack = it.attack
            def maxHealth = it.maxHealth
            def health
            if (it.health) {
                health = it.health
            } else {
                health = maxHealth
            }

            def minion
            if (it.minion) {
                minion = it.minion.newInstance()
                if (health)
                    minion.health = health
                if (it.maxHealth)
                    minion.maxHealth = maxHealth
            } else {
                minion = new Minion("" + 0, (byte) mana, (byte) attack, (byte) health, (byte) attack, (byte) health, (byte) maxHealth)
            }
            boardModel.placeMinion(playerSide, minion);
        }
    }
    
    private deck(List cardsInDeck) {
        cardsInDeck.each {
            boardModel.placeCardDeck(playerSide, it.newInstance())
        }
    }

    private updateMinion(int position, Map options){
        def minion = boardModel.getMinion(playerSide, position)
        minion.attack += options.deltaAttack ? options.deltaAttack : 0;
        minion.extraAttackUntilTurnEnd += options.deltaExtraAttack ? options.deltaExtraAttack : 0;

        minion.health += options.deltaHealth ? options.deltaHealth : 0;
        minion.maxHealth += options.deltaMaxHealth ? options.deltaMaxHealth : 0;
        
        minion.auraAttack += options.deltaAuraAttack ? options.deltaAuraAttack : 0;
        minion.auraHealth += options.deltaAuraHealth ? options.deltaAuraHealth : 0;
        
        minion.spellDamage += options.deltaSpellDamage ? options.deltaSpellDamage : 0;
        
        minion.hasAttacked_ = options.containsKey('hasAttacked') ? options.hasAttacked : minion.hasAttacked_
        minion.hasBeenUsed = options.containsKey('hasBeenUsed') ? options.hasBeenUsed : minion.hasBeenUsed
        minion.stealthed = options.containsKey('stealthed') ? options.stealthed : minion.stealthed
        
        minion.frozen = options.containsKey('frozen') ? options.frozen : minion.frozen
        
    }

    private fatigueDamage(Number fatigueDamage) {
        playerSide.getPlayer(boardModel).setFatigueDamage((byte) fatigueDamage)
    }

    private overload(Number overload) {
        boardModel.modelForSide(playerSide).overload = (byte) overload
    }

    private windFury(Boolean hasWindFury) {
        boardModel.modelForSide(playerSide).hero.windfury = hasWindFury
    }

    private heroHealth(Number health){
        def side = boardModel.modelForSide(playerSide)
        side.hero.health = health
    }<commit_msg>Add some more options to the groovy tests<commit_after>package com.hearthsim.test.helpers

import com.hearthsim.card.Card
import com.hearthsim.card.minion.Minion
import com.hearthsim.card.weapon.WeaponCard
import com.hearthsim.model.BoardModel
import com.hearthsim.model.PlayerSide

class BoardModelBuilder {

    private BoardModel boardModel
    private PlayerSide playerSide;

    BoardModel make(Closure definition) {
        if (!boardModel)
            boardModel = new BoardModel()

        runClosure definition

        boardModel
    }

    private hand(List cardsInHand) {
        // currently assuming it's a list of classes
        cardsInHand.each { boardModel.placeCardHand(playerSide, it.newInstance()) }
    }

    private field(List field) {
        field.each {
            def mana = it.mana
            def attack = it.attack
            def maxHealth = it.maxHealth
            def health
            if (it.health) {
                health = it.health
            } else {
                health = maxHealth
            }

            def minion
            if (it.minion) {
                minion = it.minion.newInstance()
                if (health)
                    minion.health = health
                if (it.maxHealth)
                    minion.maxHealth = maxHealth
            } else {
                minion = new Minion("" + 0, (byte) mana, (byte) attack, (byte) health, (byte) attack, (byte) health, (byte) maxHealth)
            }
            boardModel.placeMinion(playerSide, minion);
        }
    }
    
    private deck(List cardsInDeck) {
        cardsInDeck.each {
            boardModel.placeCardDeck(playerSide, it.newInstance())
        }
    }

    private updateMinion(int position, Map options){
        def minion = boardModel.getMinion(playerSide, position)
        minion.attack += options.deltaAttack ? options.deltaAttack : 0;
        minion.extraAttackUntilTurnEnd += options.deltaExtraAttack ? options.deltaExtraAttack : 0;

        minion.health = options.containsKey('health') ? options.health : minion.health;
        minion.maxHealth = options.containsKey('maxHealth') ? options.maxHealth : minion.maxHealth;

        minion.health += options.deltaHealth ? options.deltaHealth : 0;
        minion.maxHealth += options.deltaMaxHealth ? options.deltaMaxHealth : 0;

        minion.auraAttack += options.deltaAuraAttack ? options.deltaAuraAttack : 0;
        minion.auraHealth += options.deltaAuraHealth ? options.deltaAuraHealth : 0;
        
        minion.spellDamage += options.deltaSpellDamage ? options.deltaSpellDamage : 0;
        
        minion.hasAttacked_ = options.containsKey('hasAttacked') ? options.hasAttacked : minion.hasAttacked_
        minion.hasBeenUsed = options.containsKey('hasBeenUsed') ? options.hasBeenUsed : minion.hasBeenUsed
        minion.stealthed = options.containsKey('stealthed') ? options.stealthed : minion.stealthed
        
        minion.charge = options.containsKey('charge') ? options.charge : minion.charge
        minion.frozen = options.containsKey('frozen') ? options.frozen : minion.frozen
        minion.taunt = options.containsKey('taunt') ? options.taunt : minion.taunt
    }

    private fatigueDamage(Number fatigueDamage) {
        playerSide.getPlayer(boardModel).setFatigueDamage((byte) fatigueDamage)
    }

    private overload(Number overload) {
        boardModel.modelForSide(playerSide).overload = (byte) overload
    }

    private windFury(Boolean hasWindFury) {
        boardModel.modelForSide(playerSide).hero.windfury = hasWindFury
    }

    private heroHealth(Number health){
        def side = boardModel.modelForSide(playerSide)
        side.hero.health = health
    }
{'fraction_non_alphanumeric': 0.089900426742532, 'fraction_numerical': 0.002275960170697013, 'mean_word_length': 2.3738003838771595, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3436691', 'n_tokens_mistral': 2070, 'n_tokens_neox': 1977, 'n_words': 387}