diff --git a/MrBigsock/Assets/Code/Item/Items/ItemFourEyes.cs b/MrBigsock/Assets/Code/Item/Items/ItemFourEyes.cs index 03ae1178b541a80612118f05ff38cb5c1b01dc7e..f3401629412b59b8f921a1d530b9aa0c850d8226 100644 --- a/MrBigsock/Assets/Code/Item/Items/ItemFourEyes.cs +++ b/MrBigsock/Assets/Code/Item/Items/ItemFourEyes.cs @@ -13,11 +13,26 @@ namespace BigSock.Item { public class ItemFourEyes : OnHitItemBase { public override ulong Id => 201; public override string Name => "Four Eyes"; - public override string Description => "30% chance to deal double dammage."; + public override string Description => "30% chance to deal double dammage. Has a 2 second cooldown."; public static readonly double CHANCE = 0.3; + public static readonly TimeSpan COOLDOWN = new TimeSpan(0, 0, 0, 2, 0); + + /* + Stores the next time the character can recieve damage. + */ + public DateTime NextTimeCanTrigger { get; private set; } = DateTime.Now; + + public ItemFourEyes() { } public override void Handler(Character source, Character target, AttackStats attack) { + // Check if the cooldown has happened yet. + if(NextTimeCanTrigger > DateTime.Now) return; + + // Start new trigger time. + NextTimeCanTrigger = DateTime.Now + COOLDOWN; + + // Check if it triggers. var roll = RND.NextDouble(); if(roll >= CHANCE) { attack.Damage *= 2;