Skip to content
Snippets Groups Projects
Commit dd645dba authored by Robin Halseth Sandvik's avatar Robin Halseth Sandvik
Browse files

Added cooldown to the four eyes item.

parent c905ac69
No related branches found
No related tags found
1 merge request!23Created ItemService.
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment