public static void AttakSpeedDouble(RoomBase <MobaPeer> room, int skillId, DtoMinion from, DtoMinion[] to, EffectModel effect) { double original = from.AttackInterval; // 增加攻速 1/攻击间隔 转换为每秒攻击次数 再乘以倍数 from.AttackInterval = 1 / (1 / from.AttackInterval * (effect.EffectValue - 1)); // 恢复攻速 room.StartSchedule(DateTime.UtcNow.AddSeconds(effect.Duration), () => { from.AttackInterval = original; }); }
/// <summary> /// 移速buff/debuff /// </summary> /// <param name="room"></param> /// <param name="skillId"></param> /// <param name="from"></param> /// <param name="to"></param> /// <param name="effect"></param> /// <returns></returns> public static void SpeedDouble(RoomBase <MobaPeer> room, int skillId, DtoMinion from, DtoMinion[] to, EffectModel effect) { // 增加移速 double value = from.Speed * (effect.EffectValue - 1); from.Speed += value; // 恢复移速 room.StartSchedule(DateTime.UtcNow.AddSeconds(effect.Duration), () => { from.Speed -= value; }); }