<commit_before>﻿using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Animation;
using TCC.Annotations;
using TCC.Data;
using TCC.ViewModels;

namespace TCC.Controls
{
    /// <summary>
    /// Interaction logic for DragonControl.xaml
    /// </summary>
    public partial class DragonControl : UserControl, INotifyPropertyChanged
    {
        public DragonControl()
        {
            InitializeComponent();
            shieldArcAn = new DoubleAnimation(0, 359.99, TimeSpan.FromSeconds(BossGageWindowViewModel.PH1SHIELD_DURATION));

        }

        Boss dc;
        private string _enrageLabel;
        public string EnrageLabel
        {
            get => _enrageLabel;
            set
            {
                if (_enrageLabel == value) return;
                _enrageLabel = value;
                NotifyPropertyChanged(nameof(EnrageLabel));
            }
        }
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            dc = (Boss)DataContext;
            dc.PropertyChanged += Dc_PropertyChanged;
            enrageLine.LayoutTransform = dc.CurrentPercentage > dc.EnragePattern.Percentage ? new RotateTransform((dc.CurrentPercentage - dc.EnragePattern.Percentage) * 3.6) : new RotateTransform(0);

        }

        DoubleAnimation shieldArcAn;

        private void Dc_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if(e.PropertyName == nameof(dc.Shield))
            {
                if (dc.Shield == ShieldStatus.On)
                {
                    shieldArcAn = new DoubleAnimation(0, 359.99, TimeSpan.FromSeconds(BossGageWindowViewModel.PH1SHIELD_DURATION));
                    shieldArc.BeginAnimation(Arc.EndAngleProperty, shieldArcAn);
                }
                else
                {
                    shieldArcAn.BeginTime = null;
                    shieldArc.BeginAnimation(Arc.EndAngleProperty, shieldArcAn);
                }
            }
            else if(e.PropertyName == nameof(dc.Enraged))
            {
                if (dc.Enraged)
                {
                    enrageArc.BeginAnimation(Arc.EndAngleProperty, new DoubleAnimation(359.99, 0, TimeSpan.FromSeconds(dc.EnragePattern.Duration)));
                }
                else
                {
                    enrageLine.LayoutTransform = dc.CurrentPercentage > dc.EnragePattern.Percentage ? new RotateTransform((dc.CurrentPercentage - dc.EnragePattern.Percentage) * 3.6) : new RotateTransform(0);
                }
            }
            else if(e.PropertyName == nameof(dc.CurrentHP))<commit_msg>fixed ph1 dragons not being deleted<commit_after>﻿using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Animation;
using TCC.Annotations;
using TCC.Data;
using TCC.ViewModels;

namespace TCC.Controls
{
    /// <summary>
    /// Interaction logic for DragonControl.xaml
    /// </summary>
    public partial class DragonControl : UserControl, INotifyPropertyChanged
    {
        public DragonControl()
        {
            InitializeComponent();
            shieldArcAn = new DoubleAnimation(0, 359.99, TimeSpan.FromSeconds(BossGageWindowViewModel.PH1SHIELD_DURATION));

        }

        Boss dc;
        private string _enrageLabel;
        public string EnrageLabel
        {
            get => _enrageLabel;
            set
            {
                if (_enrageLabel == value) return;
                _enrageLabel = value;
                NotifyPropertyChanged(nameof(EnrageLabel));
            }
        }
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            dc = (Boss)DataContext;
            dc.PropertyChanged += Dc_PropertyChanged;
            dc.DeleteEvent += Dc_DeleteEvent;
            enrageLine.LayoutTransform = dc.CurrentPercentage > dc.EnragePattern.Percentage ? new RotateTransform((dc.CurrentPercentage - dc.EnragePattern.Percentage) * 3.6) : new RotateTransform(0);

        }

        DoubleAnimation shieldArcAn;
        private void Dc_DeleteEvent() => Dispatcher.Invoke(() =>
        {
            try
            {
                BossGageWindowViewModel.Instance.RemoveMe((Boss)DataContext);
            }
            catch { }
        });

        private void Dc_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if(e.PropertyName == nameof(dc.Shield))
            {
                if (dc.Shield == ShieldStatus.On)
                {
                    shieldArcAn = new DoubleAnimation(0, 359.99, TimeSpan.FromSeconds(BossGageWindowViewModel.PH1SHIELD_DURATION));
                    shieldArc.BeginAnimation(Arc.EndAngleProperty, shieldArcAn);
                }
                else
                {
                    shieldArcAn.BeginTime = null;
                    shieldArc.BeginAnimation(Arc.EndAngleProperty, shieldArcAn);
                }
            }
            else if(e.PropertyName == nameof(dc.Enraged))
            {
                if (dc.Enraged)
                {
                    enrageArc.BeginAnimation(Arc.EndAngleProperty, new DoubleAnimation(359.99, 0, TimeSpan.FromSeconds(dc.EnragePattern.Duration)));
                }
                else
                {
                    enrageLine.LayoutTransform = dc.CurrentPercentage > dc.EnragePattern.Percentage ? new RotateTransform((dc.CurrentPercentage - dc.EnragePattern.Percentage) * 3.6) : new RotateTransform(0);
                }
            }
            else if(e.PropertyName == nameof(dc.CurrentHP))
{'fraction_non_alphanumeric': 0.0859790629826669, 'fraction_numerical': 0.009095589497168355, 'mean_word_length': 1.902390438247012, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, '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': '1199257', 'n_tokens_mistral': 1587, 'n_tokens_neox': 1494, 'n_words': 267}