/// <summary> /// 攻击加倍效果 直到时间结束或进行一次普通攻击 /// </summary> /// <param name="skillId"></param> /// <param name="level"></param> /// <param name="from"></param> /// <param name="to"></param> /// <param name="effect"></param> public static void AttackDouble(int skillId, int level, AIBaseCtrl from, AIBaseCtrl[] to, EffectModel effect) { // 计时器键值 string timeKey = ServerConfig.GetEffectKey(from.Model.Id, skillId, effect.Type); // 添加buff from.AddBuff(effect.Type, timeKey); // 增加攻击 int value = from.Model.Attack * ((int)effect.EffectValue - 1); from.Model.Attack += value; // 更新ui if (from.Model.Id == GameData.HeroData.Id) { (UIManager.Instance.GetPanel(UIPanelType.Battle) as BattlePanel).UpdateView(); } // 恢复攻击 TimerManager.Instance.AddTimer(timeKey, (float)effect.Duration, () => { from.Model.Attack -= value; // 移除buff from.RemoveBuff(effect.Type); // 更新ui if (from.Model.Id == GameData.HeroData.Id) { (UIManager.Instance.GetPanel(UIPanelType.Battle) as BattlePanel).UpdateView(); } }); }
/// <summary> /// 移速加倍 直到时间结束 /// </summary> /// <param name="skillId"></param> /// <param name="level"></param> /// <param name="from"></param> /// <param name="to"></param> /// <param name="effect"></param> public static void SpeedDouble(int skillId, int level, AIBaseCtrl from, AIBaseCtrl[] to, EffectModel effect) { // 计时器键值 string timeKey = ServerConfig.GetEffectKey(from.Model.Id, skillId, effect.Type); // 添加buff from.AddBuff(effect.Type, timeKey); // 增加移速 float value = from.Speed * (float)(effect.EffectValue - 1); from.Speed += value; // 恢复移速 TimerManager.Instance.AddTimer(timeKey, (float)effect.Duration, () => { from.Speed -= value; // 移除buff from.RemoveBuff(effect.Type); }); }
public static void AttackSpeedDouble(int skillId, int level, AIBaseCtrl from, AIBaseCtrl[] to, EffectModel effect) { // 计时器键值 string timeKey = ServerConfig.GetEffectKey(from.Model.Id, skillId, effect.Type); // 添加buff from.AddBuff(effect.Type, timeKey); float original = (float)from.Model.AttackInterval; // 增加攻速 1/攻击间隔 转换为每秒攻击次数 再乘以倍数 from.Model.AttackInterval = 1 / (1 / from.Model.AttackInterval * effect.EffectValue); from.AnimeCtrl.SetAttackSpeed((float)from.Model.AttackInterval); // 恢复攻速 TimerManager.Instance.AddTimer(timeKey, (float)effect.Duration, () => { from.Model.AttackInterval = original; from.AnimeCtrl.SetAttackSpeed(original); // 移除buff from.RemoveBuff(effect.Type); }); }