<commit_before>﻿using Scripts.Model.Characters;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using Scripts.Model.Spells;
using System.Linq;
using Scripts.Game.Defined.Serialized.Spells;

namespace Scripts.Model.Characters {

    /// <summary>
    /// A priority brain bases its decisions on a fallthrough list, stopping
    /// at the first condition that evaluates to true.
    /// </summary>
    /// <seealso cref="Scripts.Model.Characters.BasicBrain" />
    public abstract class PriorityBrain : BasicBrain {
        private static readonly SpellBook DEFAULT_ACTION = new Wait();

        /// <summary>
        /// Initializes a new instance of the <see cref="PriorityBrain"/> class.
        /// </summary>
        public PriorityBrain() : base() { }

        protected sealed override Spell GetSpell() {
            Spell chosenPlay = null;
            foreach (Spell spell in GetPriorityPlays()) {
                chosenPlay = spell;
                if (!DEFAULT_ACTION.Equals(chosenPlay)) {
                    return chosenPlay;
                }
            }
            // Unable to find anything, perform a wait so the battle doesn't get stuck
            return brainOwner.Spells.CreateSpell(currentBattle, DEFAULT_ACTION, brainOwner, brainOwner);
        }

        /// <summary>
        /// Setups the priority plays.
        /// </summary>
        /// <returns></returns>
        protected abstract IList<Spell> GetPriorityPlays();
    }
}<commit_msg>fixed deafult action check - was previously doing SpellBook.Equals(Spell)<commit_after>﻿using Scripts.Model.Characters;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using Scripts.Model.Spells;
using System.Linq;
using Scripts.Game.Defined.Serialized.Spells;

namespace Scripts.Model.Characters {

    /// <summary>
    /// A priority brain bases its decisions on a fallthrough list, stopping
    /// at the first condition that evaluates to true.
    /// </summary>
    /// <seealso cref="Scripts.Model.Characters.BasicBrain" />
    public abstract class PriorityBrain : BasicBrain {
        private static readonly SpellBook DEFAULT_ACTION = new Wait();

        /// <summary>
        /// Initializes a new instance of the <see cref="PriorityBrain"/> class.
        /// </summary>
        public PriorityBrain() : base() { }

        protected sealed override Spell GetSpell() {
            Spell chosenPlay = null;
            foreach (Spell spell in GetPriorityPlays()) {
                chosenPlay = spell;
                if (!(chosenPlay.SpellBook).Equals(DEFAULT_ACTION)) {
                    return chosenPlay;
                }
            }
            // Unable to find anything, perform a wait so the battle doesn't get stuck
            return brainOwner.Spells.CreateSpell(currentBattle, DEFAULT_ACTION, brainOwner, brainOwner);
        }

        /// <summary>
        /// Setups the priority plays.
        /// </summary>
        /// <returns></returns>
        protected abstract IList<Spell> GetPriorityPlays();
    }
}
{'fraction_non_alphanumeric': 0.10354838709677419, 'fraction_numerical': 0.0, 'mean_word_length': 2.2642105263157895, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, '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': '5996615', 'n_tokens_mistral': 801, 'n_tokens_neox': 789, 'n_words': 237}