void mouveTimer_Tick(object sender, object e) { _firstTimer.Completed -= mouveTimer_Tick; _firstTimer = null; foreach (var item in _unit.Spells) { if (item.GetType() == typeof(SP_FireArrow)) { SP_FireArrow arrowSpell = (SP_FireArrow)item; arrowSpell.Culdaun = _oldCuldaun; } } _unit.AttackSpeed = _unit.OrijAttackSpeed; }
public void UseSpall(Map map, Game_Object_In_Call obj, IUnit unit, object property) { bool upSpell = UnitGenerator.UpPlayerSpell(unit, this); if (unit.UnitFrozen == false && !_culdaunBool && LevelCast != 0 && !upSpell && !unit.Silenced && !unit.Hexed) { if (unit.Mana >= ManaCost) ///Проверка есть ли мана на каст { ///Флаг кулдауна _culdaunBool = true; ///Отнимаем нужное количество unit.Mana -= ManaCost; _unit = unit; foreach (var item in unit.Spells) { if (item.GetType() == typeof(SP_FireArrow)) { SP_FireArrow arrowSpell = (SP_FireArrow)item; _oldCuldaun = arrowSpell.Culdaun; arrowSpell.Culdaun = arrowSpell.Culdaun / 3; } } _unit.AttackSpeed = _unit.OrijAttackSpeed / 2; /// lvl 1 - 3 - 15 /// lvl 2 - 5 - 15 /// lvl 3 - 6 - 14 if (LevelCast == 1) { Duration = 3; Culdaun = 15; } else if (LevelCast == 2) { Duration = 5; Culdaun = 15; } else if (LevelCast == 3) { Duration = 6; Culdaun = 14; } _firstTimer = new Storyboard() { Duration = TimeSpan.FromSeconds(Duration) }; _firstTimer.Completed += mouveTimer_Tick; _firstTimer.Begin(); _secondTimer = new Storyboard() { Duration = TimeSpan.FromSeconds(Culdaun) }; _secondTimer.Completed += mouveTimerCuldaun_Tick; _secondTimer.Begin(); if (Paused) { Pause(); } if (StartUseSpell != null) { StartUseSpell(this, null); } UnitGenerator.UpdatePlayerView(unit); } } }