From f0bb8746980278c04ebab6a0e2e8bd8fc3c7f7d6 Mon Sep 17 00:00:00 2001
From: Ny Bruker <robinhs@stud.ntnu.no>
Date: Tue, 4 Oct 2022 11:49:30 +0200
Subject: [PATCH] Added crit stats.

---
 MrBigsock/Assets/Code/Core/AttackStats.cs     | 10 ++++++++++
 MrBigsock/Assets/Code/Core/CharacterStats.cs  |  9 +++++++++
 MrBigsock/Assets/Code/Core/IAttackStats.cs    | 13 +++++++++++++
 MrBigsock/Assets/Code/Core/ICharacterStats.cs | 18 ++++++++++++++++++
 4 files changed, 50 insertions(+)

diff --git a/MrBigsock/Assets/Code/Core/AttackStats.cs b/MrBigsock/Assets/Code/Core/AttackStats.cs
index 39cffac4..73076527 100644
--- a/MrBigsock/Assets/Code/Core/AttackStats.cs
+++ b/MrBigsock/Assets/Code/Core/AttackStats.cs
@@ -46,5 +46,15 @@ namespace BigSock {
 		*/
 		public Character Actor { get; set; }
 
+		/*
+			The crit chance of the character.
+		*/
+		public float CritChance { get; set; }
+		
+		/*
+			The how much to modify damage by when critting.
+		*/
+		public float CritDamageModifier { get; set; }
+
 	}
 }
\ No newline at end of file
diff --git a/MrBigsock/Assets/Code/Core/CharacterStats.cs b/MrBigsock/Assets/Code/Core/CharacterStats.cs
index e6e13cba..597fa8da 100644
--- a/MrBigsock/Assets/Code/Core/CharacterStats.cs
+++ b/MrBigsock/Assets/Code/Core/CharacterStats.cs
@@ -41,5 +41,14 @@ namespace BigSock {
 		*/
 		public float AttackSpeed { get; set; }
 
+		/*
+			The crit chance of the character.
+		*/
+		public float CritChance { get; set; }
+		
+		/*
+			The how much to modify damage by when critting.
+		*/
+		public float CritDamageModifier { get; set; }
 	}
 }
\ No newline at end of file
diff --git a/MrBigsock/Assets/Code/Core/IAttackStats.cs b/MrBigsock/Assets/Code/Core/IAttackStats.cs
index 7b601071..6eb78fbf 100644
--- a/MrBigsock/Assets/Code/Core/IAttackStats.cs
+++ b/MrBigsock/Assets/Code/Core/IAttackStats.cs
@@ -45,6 +45,16 @@ namespace BigSock {
 			The character that activated the attack.
 		*/
 		Character Actor { get; }
+
+		/*
+			The crit chance of the character.
+		*/
+		float CritChance { get; }
+		
+		/*
+			The how much to modify damage by when critting.
+		*/
+		float CritDamageModifier { get; }
 	}
 
 
@@ -66,6 +76,9 @@ namespace BigSock {
 				AttackSpeed = a.AttackSpeed * b.AttackSpeed,
 				Source = a.Source,
 				Actor = a.Actor,
+				CritChance = a.CritChance * b.CritChance,
+				CritDamageModifier = a.CritDamageModifier * b.CritDamageModifier,
+
 			};
 		}
 	}
diff --git a/MrBigsock/Assets/Code/Core/ICharacterStats.cs b/MrBigsock/Assets/Code/Core/ICharacterStats.cs
index fdc3f74a..371a7b14 100644
--- a/MrBigsock/Assets/Code/Core/ICharacterStats.cs
+++ b/MrBigsock/Assets/Code/Core/ICharacterStats.cs
@@ -41,6 +41,16 @@ namespace BigSock {
 		*/
 		float AttackSpeed { get; }
 
+		/*
+			The crit chance of the character.
+		*/
+		float CritChance { get; }
+		
+		/*
+			The how much to modify damage by when critting.
+		*/
+		float CritDamageModifier { get; }
+
 	}
 
 	/*
@@ -57,6 +67,8 @@ namespace BigSock {
 			Knockback = 1,
 			Range = 1,
 			AttackSpeed = 1,
+			CritChance = 1,
+			CritDamageModifier = 1,
 		};
 
 		/*
@@ -70,6 +82,8 @@ namespace BigSock {
 				Knockback = a.Knockback + b.Knockback,
 				Range = a.Range + b.Range,
 				AttackSpeed = a.AttackSpeed + b.AttackSpeed,
+				CritChance = a.CritChance + b.CritChance,
+				CritDamageModifier = a.CritDamageModifier + b.CritDamageModifier,
 			};
 		}
 		
@@ -85,6 +99,8 @@ namespace BigSock {
 				Knockback = a.Knockback - b.Knockback,
 				Range = a.Range - b.Range,
 				AttackSpeed = a.AttackSpeed - b.AttackSpeed,
+				CritChance = a.CritChance - b.CritChance,
+				CritDamageModifier = a.CritDamageModifier - b.CritDamageModifier,
 			};
 		}
 
@@ -99,6 +115,8 @@ namespace BigSock {
 				Knockback = a.Knockback * b.Knockback,
 				Range = a.Range * b.Range,
 				AttackSpeed = a.AttackSpeed * b.AttackSpeed,
+				CritChance = a.CritChance * b.CritChance,
+				CritDamageModifier = a.CritDamageModifier * b.CritDamageModifier,
 			};
 		}
 
-- 
GitLab