<commit_before>using System;

/// <summary>
/// Represents armor which provides resistance against various kinds of attacks.
///
/// an armor rating of 100 indicates complete resistance against that kind of attack.
/// 0 indicates no resistance.
/// negative values indicate weakness to that kind of attack.
///
/// Each value represents a protection percentage, should be between 0 and 100.
/// </summary>
[Serializable]
public class Armor
{
	public float Melee;
	public float Bullet;
	public float Laser;
	public float Energy;
	public float Bomb;
	public float Rad;
	public float Fire;
	public float Acid;
	public float Magic;
	public float Bio;

	/// <summary>
	/// Calculates how much damage would be done based on armor resistance
	/// </summary>
	/// <param name="damage">base damage</param>
	/// <param name="attackType">type of attack</param>
	/// <returns>new damage after applying protection values</returns>
	public float GetDamage(float damage, AttackType attackType)
	{
		return damage * (100 - GetRating(attackType)) * .01f;
	}

	/// <summary>
	/// Get the armor rating against a certain type of attack
	/// </summary>
	/// <param name="attackType"></param>
	/// <returns>a value no greater than 100, indicating how much protection
	/// the armor provides against this kind of attack</returns>
	public float GetRating(AttackType attackType)
	{
		switch (attackType)
		{
			case AttackType.Melee:
				return Melee;
			case AttackType.Bullet:
				return Bullet;
			case AttackType.Laser:
				return Laser;
			case AttackType.Energy:
				return Energy;
			case AttackType.Bomb:
				return Bomb;
			case AttackType.Bio:
				return Bio;
			case AttackType.Rad:
				return Rad;
			case AttackType.Fire:
				return Fire;
			case AttackType.Acid:
				return Acid;
			case AttackType.Magic:
				return Magic;

		}

		return 0;
	}

	/// <summary>
	/// Operator override to add all armor types with ease. Thank you, Redline.
	/// </summary>
	public static Armor operator +(Armor a, Armor b)
	{
		var armor = new Armor
		{
			Melee = a.Melee + b.Melee,
			Bullet = a.Bullet + b.Bullet,
			Laser = a.Laser + b.Laser,
			Energy = a.Energy + b.Energy,
			Bomb = a.Bomb + b.Bomb,
			Rad = a.Rad + b.Rad,
			Fire = a.Fire + b.Fire,
			Acid = a.Acid + b.Acid,
			Magic = a.Magic + b.Magic,
			Bio = a.Bio + b.Bio
		};

		return armor;
	}

	/// <summary>
	/// Operator override to substract all armor types with ease. Thank you, Redline.
	/// </summary>
	public static Armor operator -(Armor a, Armor b)
	{
		var armor = new Armor
		{
			Melee = a.Melee - b.Melee,
			Bullet = a.Bullet - b.Bullet,
			Laser = a.Laser - b.Laser,
			Energy = a.Energy - b.Energy,
			Bomb = a.Bomb - b.Bomb,
			Rad = a.Rad - b.Rad,
			Fire = a.Fire - b.Fire,
			Acid = a.Acid - b.Acid,
			Magic = a.Magic - b.Magic,
			Bio = a.Bio - b.Bio
		};

		return armor;
	}
}

<commit_msg>Armor tweaks<commit_after>using System;
using UnityEngine;

/// <summary>
/// Represents armor which provides resistance against various kinds of attacks.
///
/// an armor rating of 100 indicates complete resistance against that kind of attack.
/// 0 indicates no resistance.
/// negative values indicate weakness to that kind of attack.
///
/// Each value represents a protection percentage, should be between 0 and 100.
/// </summary>
[Serializable]
public class Armor
{
	[Range(0,100)] public float Melee;
	[Range(0,100)] public float Bullet;
	[Range(0,100)] public float Laser;
	[Range(0,100)] public float Energy;
	[Range(0,100)] public float Bomb;
	[Range(0,100)] public float Rad;
	[Range(0,100)] public float Fire;
	[Range(0,100)] public float Acid;
	[Range(0,100)] public float Magic;
	[Range(0,100)] public float Bio;

	/// <summary>
	/// Calculates how much damage would be done based on armor resistance
	/// </summary>
	/// <param name="damage">base damage</param>
	/// <param name="attackType">type of attack</param>
	/// <returns>new damage after applying protection values</returns>
	public float GetDamage(float damage, AttackType attackType)
	{
		float rating = GetRating(attackType);
		if (rating > 100)
		{
			rating = 100;
		}
		return damage * (1 - rating / 100);
	}

	/// <summary>
	/// Get the armor rating against a certain type of attack
	/// </summary>
	/// <param name="attackType"></param>
	/// <returns>a value no greater than 100, indicating how much protection
	/// the armor provides against this kind of attack</returns>
	public float GetRating(AttackType attackType)
	{
		switch (attackType)
		{
			case AttackType.Melee:
				return Melee;
			case AttackType.Bullet:
				return Bullet;
			case AttackType.Laser:
				return Laser;
			case AttackType.Energy:
				return Energy;
			case AttackType.Bomb:
				return Bomb;
			case AttackType.Bio:
				return Bio;
			case AttackType.Rad:
				return Rad;
			case AttackType.Fire:
				return Fire;
			case AttackType.Acid:
				return Acid;
			case AttackType.Magic:
				return Magic;

		}

		return 0;
	}

	/// <summary>
	/// Operator override to add all armor types with ease. Thank you, Redline.
	/// </summary>
	public static Armor operator +(Armor a, Armor b)
	{
		var armor = new Armor
		{
			Melee = a.Melee + b.Melee,
			Bullet = a.Bullet + b.Bullet,
			Laser = a.Laser + b.Laser,
			Energy = a.Energy + b.Energy,
			Bomb = a.Bomb + b.Bomb,
			Rad = a.Rad + b.Rad,
			Fire = a.Fire + b.Fire,
			Acid = a.Acid + b.Acid,
			Magic = a.Magic + b.Magic,
			Bio = a.Bio + b.Bio
		};

		return armor;
	}

	/// <summary>
	/// Operator override to subtract all armor types with ease. Thank you, Redline.
	/// </summary>
	public static Armor operator -(Armor a, Armor b)
	{
		var armor = new Armor
		{
			Melee = a.Melee - b.Melee,
			Bullet = a.Bullet - b.Bullet,
			Laser = a.Laser - b.Laser,
			Energy = a.Energy - b.Energy,
			Bomb = a.Bomb - b.Bomb,
			Rad = a.Rad - b.Rad,
			Fire = a.Fire - b.Fire,
			Acid = a.Acid - b.Acid,
			Magic = a.Magic - b.Magic,
			Bio = a.Bio - b.Bio
		};

		return armor;
	}
}
{'fraction_non_alphanumeric': 0.12575757575757576, 'fraction_numerical': 0.0132996632996633, 'mean_word_length': 2.741183879093199, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 44, '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': '3865448', 'n_tokens_mistral': 2372, 'n_tokens_neox': 1975, 'n_words': 659}