﻿using System;
using UnityEngine;

[Serializable]
public struct BattlerStats
{
	[Tooltip("A flat bonus on all attack damage.\n\n1 Attack Damage means each attack deals 1 more damage than it would, usually, making 10 damage 11, instead.")]
	public int AttackDamage;
	
	[Tooltip("A flat bonus on critical strike chance, the base is 10, meaning you need to roll 90+. adding 5 here means you reduce the number to 85+.")]
	public int CriticalAttackChance;
	
	[Tooltip("A flat bonus on all critical attack damage, the base is 30, meaning adding 5 here makes a critical attack deal 35 damage.")]
	public int CriticalAttackDamage;
	
	[Tooltip("A flat bonus to max life. the base is 100, so adding 20 here means the battler would have 120 max life")]
	public int LifeMax;
	
	[Tooltip("A flat bonus to life regen in combat, occuring every second. The default is 1, so adding 2 here means healing 3 hp/sec instead of 1 hp/sec.")]
	public int LifeRegenInCombat;
	[Tooltip("A flat bonus to life regen out of combat, occuring every second while waiting on a round to end. The default is 10, so adding 2 here means healing 12 hp/sec instead of 10 hp/sec.")]
	public int LifeRegenOutOfCombat;

	[Tooltip("The percentage of damage to ignore, when taking a hit.\n\n30 mitigation means 'ignore 30% of damage', making 10 damage apply 7 damage, instead.")]
	public int DamageMitigation;

	[Tooltip("Increases chance to hit by increasing the maximum roll (highest roll is the one who hits)")]
	public int HitChance;

	[Tooltip("Amount of life to restore on a successful hit (lifetap simulation)")]
	public int HealOnHit;

	public static BattlerStats operator +(BattlerStats a, BattlerStats b)
	{
		a.AttackDamage += b.AttackDamage;
		a.CriticalAttackChance += b.CriticalAttackChance;
		a.CriticalAttackDamage += b.CriticalAttackDamage;
		
		a.LifeMax += b.LifeMax;
		a.LifeRegenInCombat += b.LifeRegenInCombat;
		a.LifeRegenOutOfCombat += b.LifeRegenOutOfCombat;

		a.DamageMitigation += b.DamageMitigation;
		a.HitChance += b.HitChance;
		a.HealOnHit += b.HealOnHit;

		return a;
	}
	
	public static BattlerStats operator *(BattlerStats a, int b)
	{
		a.AttackDamage *= b;
		a.CriticalAttackChance *= b;
		a.CriticalAttackDamage *= b;
		
		a.LifeMax *= b;
		a.LifeRegenInCombat *= b;
		a.LifeRegenOutOfCombat *= b;

		a.DamageMitigation *= b;
		a.HitChance *= b;
		a.HealOnHit *= b;

		return a;
	}
	
	
}