<commit_before>﻿using System.Collections.Generic;
using System.Linq;
using HarryPotterUnity.Enums;

namespace HarryPotterUnity.Cards.Charms.Locations
{
    public class WandShop : BaseLocation
    {

        private IEnumerable<BaseLesson> AllLessons
        {
            get
            {
                return Player.InPlay.Lessons.Cast<BaseLesson>()
                    .Concat(Player.OppositePlayer.InPlay.Lessons.Cast<BaseLesson>())
                    .Where(c => c.LessonType == LessonTypes.Charms);
            }
        }
        public override void OnEnterInPlayAction()
        {
            foreach (var lesson in AllLessons)
            {
                lesson.AmountLessonsProvided = 2;
            }

            Player.OnCardPlayedEvent += DoubleLessonsProvided;
            Player.OppositePlayer.OnCardPlayedEvent += DoubleLessonsProvided;
        }
        
        public override void OnExitInPlayAction()
        {
            foreach (var lesson in AllLessons)
            {
                lesson.AmountLessonsProvided = 1;
            }

            Player.OnCardPlayedEvent -= DoubleLessonsProvided;
            Player.OppositePlayer.OnCardPlayedEvent -= DoubleLessonsProvided;
        }

        private void DoubleLessonsProvided(BaseCard card, List<BaseCard> targets)
        {
            var lesson = card as BaseLesson;

            if (lesson != null && lesson.LessonType == LessonTypes.Charms)
            {
                lesson.AmountLessonsProvided = 2;
            }
        }
    }
}<commit_msg>use extension method to grab lessons in wand shop<commit_after>﻿using System.Collections.Generic;
using System.Linq;
using HarryPotterUnity.Enums;
using HarryPotterUnity.Utils;

namespace HarryPotterUnity.Cards.Charms.Locations
{
    public class WandShop : BaseLocation
    {

        private IEnumerable<BaseLesson> AllLessons
        {
            get
            {
                return Player.InPlay.LessonsOfType(LessonTypes.Charms)
                    .Concat(Player.OppositePlayer.InPlay.LessonsOfType(LessonTypes.Charms))
                    .Cast<BaseLesson>();
            }
        }
        public override void OnEnterInPlayAction()
        {
            foreach (var lesson in AllLessons)
            {
                lesson.AmountLessonsProvided = 2;
            }

            Player.OnCardPlayedEvent += DoubleLessonsProvided;
            Player.OppositePlayer.OnCardPlayedEvent += DoubleLessonsProvided;
        }
        
        public override void OnExitInPlayAction()
        {
            foreach (var lesson in AllLessons)
            {
                lesson.AmountLessonsProvided = 1;
            }

            Player.OnCardPlayedEvent -= DoubleLessonsProvided;
            Player.OppositePlayer.OnCardPlayedEvent -= DoubleLessonsProvided;
        }

        private void DoubleLessonsProvided(BaseCard card, List<BaseCard> targets)
        {
            var lesson = card as BaseLesson;

            if (lesson != null && lesson.LessonType == LessonTypes.Charms)
            {
                lesson.AmountLessonsProvided = 2;
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.07289002557544758, 'fraction_numerical': 0.0019181585677749361, 'mean_word_length': 1.7544014084507042, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 11, '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': '6614654', 'n_tokens_mistral': 866, 'n_tokens_neox': 822, 'n_words': 148}