<commit_before>﻿using SFML.Window;
using SFML.System;
using SFML.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Iris
{
    public class Explosion : GameObject
    {
        Animation animation;
        bool damaged = false;
        public Actor Owner;

        public Explosion(Vector2f center)
        {
            this.Pos = center;
            animation = new Animation(Content.GetTexture("explosion.png"), 6, 30, 0);
        }

        public Explosion(Vector2f center, Actor Owner)
        {
            this.Owner = Owner;
            this.Pos = center;
            animation = new Animation(Content.GetTexture("explosion.png"), 6, 30, 0);
        }

        public override void Update()
        {
            if (!damaged)
            {

                foreach (Actor a in MainGame.dm.Players)
                {
                    if (a is ClientPlayer)
                    {
                        float angleBetween = Helper.angleBetween(this.Pos, a.Core);
                        if (Helper.Distance(a.Core, this.Pos) < 130)
                        {
                            ((ClientPlayer)a).SetHealth(a.Health - 20);
                            a.ouchTimer = 10;
                        }
                        if (Helper.Distance(a.Core, this.Pos) < 110)
                        {
                            ((ClientPlayer)a).SetHealth(a.Health - 30);
                            a.ouchTimer = 10;
                        }
                        if (Helper.Distance(a.Core, this.Pos) < 80)
                            ((ClientPlayer)a).SetHealth(0);
                    }
                }
                damaged = true;
                for (int i = 0; i < 6; i++)
                {
                    int gibNum = MainGame.rand.Next(1, 3);
                    Gib g = new Gib(new Texture(Content.GetTexture("explosionGib" + gibNum + ".png")), this.Pos, (float)MainGame.rand.NextDouble() * 6.5f,
                        Helper.angleBetween(this.Pos, this.Pos - new Vector2f(0, 4)) + (float)Math.PI + (float)(i - 5 / 10f) + (float)MainGame.rand.NextDouble());

                    MainGame.dm.GameObjects.Add(g);
                }
            }
            animation.Update();
            if (animation.Frame >= animation.Count - 1)
                MainGame.dm.GameObjects.Remove(this);<commit_msg>Fix Health from Explosives<commit_after>﻿using SFML.Window;
using SFML.System;
using SFML.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Iris
{
    public class Explosion : GameObject
    {
        Animation animation;
        bool damaged = false;
        public Actor Owner;

        public Explosion(Vector2f center)
        {
            this.Pos = center;
            animation = new Animation(Content.GetTexture("explosion.png"), 6, 30, 0);
        }

        public Explosion(Vector2f center, Actor Owner)
        {
            this.Owner = Owner;
            this.Pos = center;
            animation = new Animation(Content.GetTexture("explosion.png"), 6, 30, 0);
        }

        public override void Update()
        {
            if (!damaged)
            {

                foreach (Actor a in MainGame.dm.Players)
                {
                    if (a is ClientPlayer && a.Alive)
                    {
                        float angleBetween = Helper.angleBetween(this.Pos, a.Core);
                        if (Helper.Distance(a.Core, this.Pos) < 130)
                        {
                            ((ClientPlayer)a).SetHealth(a.Health - 20);
                            a.ouchTimer = 10;
                        }
                        if (Helper.Distance(a.Core, this.Pos) < 110)
                        {
                            ((ClientPlayer)a).SetHealth(a.Health - 30);
                            a.ouchTimer = 10;
                        }
                        if (Helper.Distance(a.Core, this.Pos) < 80)
                            ((ClientPlayer)a).SetHealth(0);
                    }
                }
                damaged = true;
                for (int i = 0; i < 6; i++)
                {
                    int gibNum = MainGame.rand.Next(1, 3);
                    Gib g = new Gib(new Texture(Content.GetTexture("explosionGib" + gibNum + ".png")), this.Pos, (float)MainGame.rand.NextDouble() * 6.5f,
                        Helper.angleBetween(this.Pos, this.Pos - new Vector2f(0, 4)) + (float)Math.PI + (float)(i - 5 / 10f) + (float)MainGame.rand.NextDouble());

                    MainGame.dm.GameObjects.Add(g);
                }
            }
            animation.Update();
            if (animation.Frame >= animation.Count - 1)
                MainGame.dm.GameObjects.Remove(this);
{'fraction_non_alphanumeric': 0.10821517931609674, 'fraction_numerical': 0.016680567139282735, 'mean_word_length': 1.2280538783093358, 'pattern_counts': {'":': 0, '<': 11, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7358334', 'n_tokens_mistral': 1397, 'n_tokens_neox': 1234, 'n_words': 271}