<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
 
using Microsoft.Xna.Framework.Input;
using LeGame.Models.Characters;
using LeGame.Interfaces;
using LeGame.Models;
using Microsoft.Xna.Framework.Graphics;


namespace LeGame.Handlers
{
    internal static class CollisionHandler
    {
        public static Object Collide(Character character)
        {
            List<GameObject> daaa = character.Level.Assets.Concat(character.Level.Enemies).ToList(); // certainly NEEDS to be revamped
            foreach (var item in daaa)// character.Level.Assets)
            {
                Rectangle obj = GfxHandler.GetBBox(item);

                if ((item is ICollisionable || item is IPickable)
                    && GfxHandler.GetBBox(character).Intersects(obj))
                {
                    return item;
                }
            }
            return 1;
        }
        public static void Reaction(Character character, Keys key)
        {
            if (CollisionHandler.Collide(character) == (object) 1) return;
            Vector2 temp = new Vector2(character.Position.X, character.Position.Y);
               
            //movement reactions
            
            if (CollisionHandler.Collide(character) is ICollisionable && key == Keys.D)
            {
                temp.X -= character.Speed;
                character.Position = temp;
            }
            if (CollisionHandler.Collide(character) is ICollisionable && key == Keys.W)
            {
                temp.Y += character.Speed;
                character.Position = temp;
            }
            if (CollisionHandler.Collide(character) is ICollisionable && key == Keys.S)
            {
                temp.Y -= character.Speed;
                character.Position = temp;
            }
            if (CollisionHandler.Collide(character) is ICollisionable && key == Keys.A)
            {
                temp.X += character.Speed;
                character.Position = temp;
            }
            
            if (CollisionHandler.Collide(character) is IPickable)
            {
                GameObject item = (GameObject)CollisionHandler.Collide(character);
                Console.Beep(8000,50); // legit cool gold-pickup sound 
                // the freeze it causes based on the duration is also legit :D
                character.Level.Assets.Remove(item);
            }
        }
    }
}<commit_msg>reverting back CollisionHandler.Reaction change<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
 
using Microsoft.Xna.Framework.Input;
using LeGame.Models.Characters;
using LeGame.Interfaces;
using LeGame.Models;
using Microsoft.Xna.Framework.Graphics;


namespace LeGame.Handlers
{
    internal static class CollisionHandler
    {
        public static Object Collide(Character character)
        {
            List<GameObject> daaa = character.Level.Assets.Concat(character.Level.Enemies).ToList(); // certainly NEEDS to be revamped
            foreach (var item in daaa)// character.Level.Assets)
            {
                Rectangle obj = GfxHandler.GetBBox(item);

                if ((item is ICollisionable || item is IPickable)
                    && GfxHandler.GetBBox(character).Intersects(obj))
                {
                    return item;
                }
            }
            return 1;
        }
        public static void Reaction(Character character, Keys key)
        {
            if (CollisionHandler.Collide(character) != (object)1)
            {
                 Vector2 temp = new Vector2(character.Position.X, character.Position.Y);
               
                //movement reactions
            
                if (CollisionHandler.Collide(character) is ICollisionable && key == Keys.D)
                {
                    temp.X -= character.Speed;
                    character.Position = temp;
                }
                if (CollisionHandler.Collide(character) is ICollisionable && key == Keys.W)
                {
                    temp.Y += character.Speed;
                    character.Position = temp;
                }
                if (CollisionHandler.Collide(character) is ICollisionable && key == Keys.S)
                {
                    temp.Y -= character.Speed;
                    character.Position = temp;
                }
                if (CollisionHandler.Collide(character) is ICollisionable && key == Keys.A)
                {
                    temp.X += character.Speed;
                    character.Position = temp;
                }
            
                if (CollisionHandler.Collide(character) is IPickable)
                {
                    GameObject item = (GameObject)CollisionHandler.Collide(character);
                    Console.Beep(8000,50); // legit cool gold-pickup sound 
                                           // the freeze it causes based on the duration is also legit :D
                    character.Level.Assets.Remove(item);
                }
            }

        }
    }
}
{'fraction_non_alphanumeric': 0.08697332817935834, 'fraction_numerical': 0.003865481252415926, 'mean_word_length': 1.5170233463035019, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1346989', 'n_tokens_mistral': 1349, 'n_tokens_neox': 1259, 'n_words': 289}