public async Task SetCD(long unitId, double cooldownDuration, int spellId, IVolatileContext volatileContext) { volatileContext.Cooldowns.Add(new Cooldown { UnitId = unitId, SpellId = spellId, EndsOn = DateTime.UtcNow.AddSeconds(cooldownDuration), }); await volatileContext.SaveChangesAsync(CancellationToken.None); }
public async Task SetDuration(long unitId, double effectDuration, double effectPower, string effectType, IVolatileContext volatileContext, IPawContext context) { volatileContext.Durations.Add(new Duration { UnitId = unitId, EffectType = effectType, EffectPower = effectPower, EndsOn = DateTime.UtcNow.AddSeconds(effectDuration), }); await this.BuffHandler(unitId, effectType, effectPower, "+", context); await volatileContext.SaveChangesAsync(CancellationToken.None); await context.SaveChangesAsync(CancellationToken.None); }