private void Exept() { //!_exept if (_map.Calls.Any(p => p.IndexLeft == _bullet.PositionX && p.IndexTop == _bullet.PositionY)) { ///Получим ячейку куда попала пуля var call = _map.Calls.Single(p => p.IndexLeft == _bullet.PositionX && p.IndexTop == _bullet.PositionY); if (!call.Block) { if (call.IUnits.Any(p => p.GameObject.EnumCallType == EnumCallType.UnitBlock)) { _bullet.Exept = true; } else { if (!_bullet.Exept) { _bullet.Exept = UnitGenerator.AddDamage(call, _bullet); } else { UnitGenerator.AddDamage(call, _bullet); } } } else { _bullet.Exept = true; } } else { _bullet.Exept = true; } }
private void Exept() { //!_exept if (_map.Calls.Any(p => p.IndexLeft == _bullet.PositionX && p.IndexTop == _bullet.PositionY)) { ///Получим ячейку куда попала пуля var call = _map.Calls.Single(p => p.IndexLeft == _bullet.PositionX && p.IndexTop == _bullet.PositionY); #region Desol for (int i = 0; i < call.IUnits.Count; i++) { if (call.IUnits[i] != _bullet.UnitUsed && call.IUnits[i].GroupType != _bullet.UnitUsed.GroupType) { UnitGenerator.Desolator(_bullet.UnitUsed, call.IUnits[i]); UnitGenerator.Skadi(_bullet.UnitUsed, call.IUnits[i]); if (_bullet.MinusArmor != 0) { UnitGenerator.UnitDesolator(_bullet.UnitUsed, call.IUnits[i], _bullet.MinusArmor); } } } #endregion if (!call.Block) { if (!_bullet.Exept) { _bullet.Exept = UnitGenerator.AddDamage(call, _bullet); } else { UnitGenerator.AddDamage(call, _bullet); } } else { _bullet.Exept = true; } } else { _bullet.Exept = true; } }
/// <summary> /// Обычная атака моба /// </summary> /// <param name="property">Колонка куда наносится удар</param> public void UseSpall(Map map, Game_Object_In_Call obj, IUnit unit, object property) { if (unit.UnitFrozen == false && !_culdaunBool) { ///Флаг кулдауна _culdaunBool = true; _unit = unit; CurrentCall = property as Map_Cell; if (CurrentCall != null) { if (!unit.Hexed) { Bullet bullet = new Bullet() { UnitUsed = unit, DemagePhys = unit.Demage }; UnitGenerator.AddDamage(CurrentCall, bullet); } _firstTimer = new Storyboard() { Duration = TimeSpan.FromSeconds(unit.AttackSpeed) }; _firstTimer.Completed += _firstTimer_Completed; _firstTimer.Begin(); if (Paused) { Pause(); } } } else if (CompletedUseSpell != null) { CompletedUseSpell(this, null); } }
private void Exept() { //!_exept if (_map.Calls.Any(p => p.IndexLeft == _bullet.PositionX && p.IndexTop == _bullet.PositionY)) { ///Получим ячейку куда попала пуля var call = _map.Calls.Single(p => p.IndexLeft == _bullet.PositionX && p.IndexTop == _bullet.PositionY); if (!call.Block) { #region Desol for (int i = 0; i < call.IUnits.Count; i++) { if (call.IUnits[i] != _bullet.UnitUsed && call.IUnits[i].GroupType != _bullet.UnitUsed.GroupType) { UnitGenerator.Desolator(_bullet.UnitUsed, call.IUnits[i]); UnitGenerator.Skadi(_bullet.UnitUsed, call.IUnits[i]); } } #endregion if (!_bullet.Exept) { _bullet.Exept = UnitGenerator.AddDamage(call, _bullet); } else { UnitGenerator.AddDamage(call, _bullet); } } else { _bullet.Exept = true; } if (_bullet.Exept) { if (!call.Block) { foreach (var item in call.IUnits) { Buff buff = item.Buffs.FirstOrDefault(p => p.Name == _bullet.Name + "LiquidFire"); if (buff != null) { buff.Duration = 2; } else { Buff alchBuff = new Buff() { AttackSpeedSlow = _bullet.AttackSpeedSlow, SpeedSlow = _bullet.SpeedSlow, Duration = 2, Name = _bullet.Name + "LiquidFire" }; item.Buffs.Add(alchBuff); } UnitGenerator.Desolator(_bullet.UnitUsed, item); UnitGenerator.Skadi(_bullet.UnitUsed, item); } } } } else { _bullet.Exept = true; } }
/// <summary> /// Этот метод наносит урон /// </summary> private void BoomMethod(int x, int y) { _isBoom = true; ///Если ракета попала или должна исчезнуть ///Берем все ячейки вокруг колбы List <Point> roundPoint = UnitGenerator.BigRoundNumber(x, y); roundPoint.Add(new Point(x, y)); ///Теперь рисуем взрыв for (int i = 0; i < roundPoint.Count; i++) { Map_Cell callBoom = _map.Calls.FirstOrDefault(p => p.IndexLeft == roundPoint[i].X && p.IndexTop == roundPoint[i].Y); if (callBoom != null && !callBoom.Block) { UC_Super_Mega_Death_Rocket arrow = new UC_Super_Mega_Death_Rocket(); if (i == 0 || i == 1) { arrow.ChengAngel(EAngel.Left); } else if (i == 2 || i == 3) { arrow.ChengAngel(EAngel.Right); } else if (i == 4 || i == 5) { arrow.ChengAngel(EAngel.Top); } else if (i == 6 || i == 7) { arrow.ChengAngel(EAngel.Bottom); } else if (i == 8) { ///Центральная ячейка arrow.ChengAngelCenter(); } Bullet bullArrow = new Bullet(); bullArrow.GameObject = new Game_Object_In_Call() { EnumCallType = EnumCallType.Bullet, View = arrow }; bullArrow.UnitUsed = _bullet.UnitUsed; bullArrow.PositionX = (int)roundPoint[i].X; bullArrow.PositionY = (int)roundPoint[i].Y; bullArrow.Speed = 0; if (i != 8) { bullArrow.DemageMagic = _bullet.DemageMagic; } else { bullArrow.DemageMagic = (int)(_bullet.DemageMagic * 0.8); } bullArrow.CurrentMap = _map; bullArrow.Angel = _bullet.UnitUsed.Angel; bullArrow.Range = 0; ///И его же добавим в масив всех объектов _map.GameObjectInCall.Add(bullArrow.GameObject); Canvas.SetLeft(bullArrow.GameObject.View, bullArrow.PositionX * 50); Canvas.SetTop(bullArrow.GameObject.View, bullArrow.PositionY * 50); ///Отображение _map.MapCanvas.Children.Add(bullArrow.GameObject.View); UnitGenerator.AddDamage(callBoom, bullArrow); UnitGenerator.AddStune(callBoom, bullArrow, _bullet.StunDuration); _boom.Add(bullArrow); } } _secondTimer = new Storyboard() { Duration = TimeSpan.FromSeconds(0.5) }; _secondTimer.Completed += _secondTimer_Completed; _secondTimer.Begin(); }
void _firstTimer_Completed(object sender, object e) { _firstTimer.Completed -= _firstTimer_Completed; _firstTimer = null; // if (_unit is Player) // _unit = _unit; ///Так как это юнит мы убираем флаг юзед со старой ячейку var callOld = _map.Calls.Single(p => p.IndexLeft == _unit.PositionX && p.IndexTop == _unit.PositionY); ///Удаляем из старой ячейки ссылку на юнит callOld.IUnits.Remove(_unit); if (!callOld.IUnits.Any(p => p.GameObject.EnumCallType == EnumCallType.UnitBlock)) { ///Делаем ячейку пустой callOld.Used = false; } _unit.PositionX = _xNew; _unit.PositionY = _yNew; ///Получаем новую ячейку var callNew = _map.Calls.Single(p => p.IndexLeft == _unit.PositionX && p.IndexTop == _unit.PositionY); if (!_unit.Dead) { //if (_unit is Player) // callNew = callNew; ///Добавляем в нее ссылку на юнит callNew.IUnits.Add(_unit); ///Убераем то что колонка использывалась, теперь ставим что она все время используется callNew.Used = true; } ///Проверим или получил юнит урон в новой ячейке foreach (var item in callNew.Bullet) { if (!item.BuffDemage) { if (!item.IsRoket) { item.Exept = UnitGenerator.AddDamage(callNew, item); } else { ///Только попадение, урон не наносится item.Exept = UnitGenerator.AddNullDemage(callNew, item); } if (item.Exept) { UnitGenerator.AddStuneTwo(callNew, item, item.StunDuration, item.StunDuration); } } else if (!item.IsRoket)///Значит баф урон, и не бомба { UnitGenerator.AddBufDemageOne(callNew, item, item.DemageMagic); } } callNew.Using = false; Player player = _unit as Player; if (player != null && callNew.Item.Count > 0) { int playerItemCount = player.Items.Count; ItemClass addedItem = callNew.Item.FirstOrDefault(); ///Смотрим можно ли данный итем во что то собрать ItemClass newItem = UnitGenerator.CreateNewItem(player, addedItem); if (newItem != null) { ///Можно собрать ///Разрешаем пропустить итем playerItemCount = 0; addedItem = newItem; } if (addedItem.Bonus)///Если итем бонус, то пропустить его тоже { playerItemCount = 0; } if (playerItemCount < 4) { _map.MapCanvas.Children.Remove(callNew.Item.FirstOrDefault().View); ///Подбираем итем player.AddItem(addedItem); callNew.Item.Remove(callNew.Item.FirstOrDefault()); } } }
public void UseSpall(Map map, Game_Object_In_Call obj, IUnit unit, object property) { bool upSpell = UnitGenerator.UpPlayerSpell(unit, this); _unit = unit; if (unit.UnitFrozen == false && !_culdaunBool && LevelCast != 0 && !upSpell && !unit.Silenced && !unit.Hexed && !Paused) { if (unit.Mana >= ManaCost) ///Проверка есть ли мана на каст { ///Флаг кулдауна _culdaunBool = true; ///Отнимаем нужное количество unit.Mana -= ManaCost; ///Тут кординаты ячеек в которых действует тучка List <Point> callsPoint = new List <Point>(); ///Получаем ячейки которые находятся перед героем int xNew = unit.PositionX; int yNew = unit.PositionY; if (unit.Angel == EAngel.Left) { xNew = xNew - 1; callsPoint.Add(new Point(xNew, yNew)); callsPoint.Add(new Point(xNew, yNew + 2)); callsPoint.Add(new Point(xNew, yNew - 2)); } else if (unit.Angel == EAngel.Right) { xNew = xNew + 1; callsPoint.Add(new Point(xNew, yNew)); callsPoint.Add(new Point(xNew, yNew + 2)); callsPoint.Add(new Point(xNew, yNew - 2)); } else if (unit.Angel == EAngel.Top) { yNew = yNew - 1; callsPoint.Add(new Point(xNew, yNew)); callsPoint.Add(new Point(xNew + 2, yNew)); callsPoint.Add(new Point(xNew - 2, yNew)); } else if (unit.Angel == EAngel.Bottom) { yNew = yNew + 1; callsPoint.Add(new Point(xNew, yNew)); callsPoint.Add(new Point(xNew + 2, yNew)); callsPoint.Add(new Point(xNew - 2, yNew)); } ///Кординаты ячеек есть ///теперь спауним тучку foreach (var item in callsPoint) { Map_Cell call = map.Calls.FirstOrDefault(p => p.IndexLeft == item.X && p.IndexTop == item.Y); if (call != null && !call.Block) { ///Создаем визуальный объект тучка UC_Jinx_Flame_Chompers acidSpray = new UC_Jinx_Flame_Chompers(); acidSpray.ChengAngel(unit.Angel); Bullet bullAcidSpray = new Bullet() { Name = "Jinx_Flame_Chompers" }; bullAcidSpray.GameObject = new Game_Object_In_Call() { EnumCallType = EnumCallType.Bullet, View = acidSpray }; bullAcidSpray.UnitUsed = unit; bullAcidSpray.PositionX = (int)item.X; bullAcidSpray.PositionY = (int)item.Y; bullAcidSpray.Speed = Speed; bullAcidSpray.IsRoket = true; ///Магический урон зависит от прокача стрел ///bullArrow.DemageMagic = 5 * (int)property; if (LevelCast == 1) { bullAcidSpray.DemageMagic = 15; bullAcidSpray.StunDuration = 2; } else if (LevelCast == 2) { bullAcidSpray.DemageMagic = 25; bullAcidSpray.StunDuration = 2; } else if (LevelCast == 3) { bullAcidSpray.DemageMagic = 35; bullAcidSpray.StunDuration = 3; } bullAcidSpray.CurrentMap = map; bullAcidSpray.Angel = unit.Angel; bullAcidSpray.Range = _unit.Range; bullAcidSpray.Duration = Duration; bullAcidSpray.Spells.Add(new SPB_Jinx_Flame_Chompers() { Name = "Jinx_Flame_Chompers" }); ///И его же добавим в масив всех объектов map.GameObjectInCall.Add(bullAcidSpray.GameObject); Canvas.SetLeft(bullAcidSpray.GameObject.View, bullAcidSpray.PositionX * 50); Canvas.SetTop(bullAcidSpray.GameObject.View, bullAcidSpray.PositionY * 50); ///Отображение map.MapCanvas.Children.Add(bullAcidSpray.GameObject.View); _animationControl = (bullAcidSpray.GameObject.View as IAnimationControl); _animationControl.StartMuveAnimation(0); bullAcidSpray.UseSpall("Jinx_Flame_Chompers"); } } if (StartUseSpell != null) { StartUseSpell(this, null); } ///Таймер кулдауна заклинания _firstTimer = new Storyboard() { Duration = TimeSpan.FromSeconds(Culdaun) }; _firstTimer.Completed += _firstTimer_Completed; _firstTimer.Begin(); if (Paused) { Pause(); } UnitGenerator.UpdatePlayerView(unit); } } if (unit.UnitFrozen == false && ///Проверка не в стане ли юнит !Paused) { Map_Cell unitCall = map.Calls.FirstOrDefault(p => p.IndexLeft == unit.PositionX && p.IndexTop == unit.PositionY); ///Может тучка была кинута, тогда можно атаковать if (unitCall.Bullet.Any(p => p.Name == "SP_Alchemist_AcidSpray" && p.UnitUsed == unit) && !CuldaunBoolAttack) { Point attackCallPoint = UnitGenerator.AngelCallPoint(unit.Angel, unit.PositionX, unit.PositionY); Map_Cell attackCallCall = map.Calls.FirstOrDefault(p => p.IndexLeft == attackCallPoint.X && p.IndexTop == attackCallPoint.Y); ///Если на против юнита есть ячейка куда атаковать if (attackCallCall != null && !attackCallCall.Block && attackCallCall.IUnits.Any()) { ///Флаг кулдауна CuldaunBoolAttack = true; Bullet bullet = new Bullet() { UnitUsed = unit, DemagePhys = unit.Demage }; UnitGenerator.MKB_Bush(bullet, unit); UnitGenerator.AddDamage(attackCallCall, bullet); (unit.GameObject.View as IGameControl).ShowAttack(unit.Angel, unit.AttackSpeed); _secondTimer = new Storyboard() { Duration = TimeSpan.FromSeconds(unit.AttackSpeed) }; _secondTimer.Completed += _secondTimer_Completed; _secondTimer.Begin(); if (Paused) { Pause(); } } } } }
public void UseSpall(Map map, Game_Object_In_Call obj, IUnit unit, object property) { bool upSpell = UnitGenerator.UpPlayerSpell(unit, this); _unit = unit; if (unit.UnitFrozen == false && !_culdaunBool && LevelCast != 0 && !upSpell && !unit.Silenced && !unit.Hexed && !Paused) { if (unit.Mana >= ManaCost) ///Проверка есть ли мана на каст { ///Флаг кулдауна _culdaunBool = true; ///Отнимаем нужное количество unit.Mana -= ManaCost; _map = map; ///Тут кординаты ячеек в которых действует тучка _callsPointl = new List <Point>(); ///Получаем ячейки которые находятся перед героем ///использывавшим тучку ///Сначала добавляем ячеку с героем int xNew = unit.PositionX; int yNew = unit.PositionY; if (unit.Angel == EAngel.Left) { for (int i = 0; i <= _size; i++) { xNew = xNew - 1; Map_Cell call = map.Calls.FirstOrDefault(p => p.IndexLeft == xNew && p.IndexTop == yNew); if (call == null || call != null && call.Block) { break; } _callsPointl.Add(new Point(xNew, yNew)); if (_size == i) { _callsPointl.Add(new Point(xNew, yNew + 1)); _callsPointl.Add(new Point(xNew, yNew - 1)); } } } else if (unit.Angel == EAngel.Right) { for (int i = 0; i <= _size; i++) { xNew = xNew + 1; Map_Cell call = map.Calls.FirstOrDefault(p => p.IndexLeft == xNew && p.IndexTop == yNew); if (call == null || call != null && call.Block) { break; } _callsPointl.Add(new Point(xNew, yNew)); if (_size == i) { _callsPointl.Add(new Point(xNew, yNew + 1)); _callsPointl.Add(new Point(xNew, yNew - 1)); } } } else if (unit.Angel == EAngel.Top) { for (int i = 0; i <= _size; i++) { yNew = yNew - 1; Map_Cell call = map.Calls.FirstOrDefault(p => p.IndexLeft == xNew && p.IndexTop == yNew); if (call == null || call != null && call.Block) { break; } _callsPointl.Add(new Point(xNew, yNew)); if (_size == i) { _callsPointl.Add(new Point(xNew + 1, yNew)); _callsPointl.Add(new Point(xNew - 1, yNew)); } } } else if (unit.Angel == EAngel.Bottom) { for (int i = 0; i <= _size; i++) { yNew = yNew + 1; Map_Cell call = map.Calls.FirstOrDefault(p => p.IndexLeft == xNew && p.IndexTop == yNew); if (call == null || call != null && call.Block) { break; } _callsPointl.Add(new Point(xNew, yNew)); if (_size == i) { _callsPointl.Add(new Point(xNew + 1, yNew)); _callsPointl.Add(new Point(xNew - 1, yNew)); } } } if (!_callsPointl.Any()) { (unit.GameObject.View as IGameControl).GetDemage("Miss"); } _attackView = new List <UC_Jakiro_DualBreath>(); ///Кординаты ячеек есть ///теперь спауним атаку foreach (var item in _callsPointl) { Map_Cell call = map.Calls.FirstOrDefault(p => p.IndexLeft == item.X && p.IndexTop == item.Y); if (call != null && !call.Block) { ///Создаем визуальный объект атака UC_Jakiro_DualBreath dualBreath = new UC_Jakiro_DualBreath(); dualBreath.ChengAngel(unit.Angel); _bullDualBreath = new Bullet() { Name = "SP_Jakiro_DualBreath" }; _bullDualBreath.GameObject = new Game_Object_In_Call() { EnumCallType = EnumCallType.Bullet, View = dualBreath }; _bullDualBreath.UnitUsed = unit; _bullDualBreath.PositionX = (int)item.X; _bullDualBreath.PositionY = (int)item.Y; _bullDualBreath.Speed = Speed; ///Магический урон зависит от прокача стрел //bullArrow.DemageMagic = 5 * (int)property; if (LevelCast == 1) { _bullDualBreath.DemageMagic = 16; } else if (LevelCast == 2) { _bullDualBreath.DemageMagic = 26; } else if (LevelCast == 3) { _bullDualBreath.DemageMagic = 36; } // _bullDualBreath.DemageMagic += unit.Demage/2; _bullDualBreath.CurrentMap = map; _bullDualBreath.Angel = unit.Angel; _bullDualBreath.Range = _unit.Range; _bullDualBreath.Duration = Duration; _bullDualBreath.SpeedSlow = 0.5; ///И его же добавим в масив всех объектов //map.GameObjectInCall.Add(_bullDualBreath.GameObject); Canvas.SetLeft(_bullDualBreath.GameObject.View, _bullDualBreath.PositionX * 50); Canvas.SetTop(_bullDualBreath.GameObject.View, _bullDualBreath.PositionY * 50); ///Отображение map.MapCanvas.Children.Add(_bullDualBreath.GameObject.View); _attackView.Add(dualBreath); _animationControl = (_bullDualBreath.GameObject.View as IAnimationControl); _animationControl.StartMuveAnimation(0); UnitGenerator.AddDamage(call, _bullDualBreath); _removeFire = false; } } ///Таймер второго дыхания, замедляющего _secondTimer = new Storyboard() { Duration = TimeSpan.FromSeconds(0.4) }; _secondTimer.Completed += _secondTimer_Completed; _secondTimer.Begin(); if (StartUseSpell != null) { StartUseSpell(this, null); } ///Таймер кулдауна заклинания _firstTimer = new Storyboard() { Duration = TimeSpan.FromSeconds(Culdaun) }; _firstTimer.Completed += _firstTimer_Completed; _firstTimer.Begin(); if (Paused) { Pause(); } UnitGenerator.UpdatePlayerView(unit); } } }
private void Exept() { int stunDuration = 0; int bonusDamsge = 0; if (_power >= 2 && _power <= 3) { stunDuration = 1; } else if (_power >= 4 && _power <= 5) { stunDuration = 2; bonusDamsge = _bullet.BonusDemage / 2; } else if (_power >= 6) { stunDuration = 3; bonusDamsge = _bullet.BonusDemage; } _bullet.StunDuration = stunDuration; _bullet.DemagePhys = _bullet.DemagePhys + bonusDamsge; //!_exept if (_map.Calls.Any(p => p.IndexLeft == _bullet.PositionX && p.IndexTop == _bullet.PositionY)) { ///Получим ячейку куда попала пуля var call = _map.Calls.Single(p => p.IndexLeft == _bullet.PositionX && p.IndexTop == _bullet.PositionY); if (!call.Block) { #region Desol for (int i = 0; i < call.IUnits.Count; i++) { if (call.IUnits[i] != _bullet.UnitUsed && call.IUnits[i].GroupType != _bullet.UnitUsed.GroupType) { UnitGenerator.Desolator(_bullet.UnitUsed, call.IUnits[i]); UnitGenerator.Skadi(_bullet.UnitUsed, call.IUnits[i]); } } #endregion if (!_bullet.Exept) { _bullet.Exept = UnitGenerator.AddDamage(call, _bullet); UnitGenerator.AddStuneTwo(call, _bullet, stunDuration, 5); } else { UnitGenerator.AddDamage(call, _bullet); UnitGenerator.AddStuneTwo(call, _bullet, stunDuration, 5); } } else { _bullet.Exept = true; } } else { _bullet.Exept = true; } }
private void AttackUnits(Map map, IUnit unit, bool attackCount) { ///Кординаты ячеек есть ///теперь спауним атаку foreach (var item in _callsPointl) { Map_Cell call = map.Calls.FirstOrDefault(p => p.IndexLeft == item.X && p.IndexTop == item.Y); if (call != null && !call.Block) { ///Создаем визуальный объект атака UC_Mirana_Starstorm dualBreath = new UC_Mirana_Starstorm(); dualBreath.ChengAngel(unit.Angel); _bullDualBreath = new Bullet() { Name = "SP_Mirana_Starstorm" }; _bullDualBreath.GameObject = new Game_Object_In_Call() { EnumCallType = EnumCallType.Bullet, View = dualBreath }; _bullDualBreath.UnitUsed = unit; _bullDualBreath.PositionX = (int)item.X; _bullDualBreath.PositionY = (int)item.Y; _bullDualBreath.Speed = Speed; ///Магический урон зависит от прокача стрел //bullArrow.DemageMagic = 5 * (int)property; if (LevelCast == 1) { _bullDualBreath.DemageMagic = 16; } else if (LevelCast == 2) { _bullDualBreath.DemageMagic = 26; } else if (LevelCast == 3) { _bullDualBreath.DemageMagic = 36; } if (!attackCount) { _bullDualBreath.DemageMagic = _bullDualBreath.DemageMagic / 2; } _bullDualBreath.CurrentMap = map; _bullDualBreath.Angel = unit.Angel; _bullDualBreath.Range = _unit.Range; _bullDualBreath.Duration = Duration; //_bullDualBreath.SpeedSlow = 0.5; ///И его же добавим в масив всех объектов //map.GameObjectInCall.Add(_bullDualBreath.GameObject); Canvas.SetLeft(_bullDualBreath.GameObject.View, _bullDualBreath.PositionX * 50); Canvas.SetTop(_bullDualBreath.GameObject.View, _bullDualBreath.PositionY * 50); ///Отображение map.MapCanvas.Children.Add(_bullDualBreath.GameObject.View); _attackView.Add(dualBreath); _animationControl = (_bullDualBreath.GameObject.View as IAnimationControl); _animationControl.StartMuveAnimation(0); UnitGenerator.AddDamage(call, _bullDualBreath); } } }