Ejemplo n.º 1
0
        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;
            }
        }
Ejemplo n.º 2
0
        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;
            }
        }
Ejemplo n.º 3
0
        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 &&
                !Paused &&
                !unit.Hexed)
            {
                if (unit.Mana >= ManaCost)
                ///Проверка есть ли мана на каст
                {
                    ///Флаг кулдауна
                    _culdaunBool = true;

                    ///Отнимаем нужное количество
                    unit.Mana -= ManaCost;

                    ///Тут кординаты ячеек в которых действует тучка
                    List <Point> callsPoint = new List <Point>();
                    ///Получаем ячейки которые находятся перед героем
                    ///использывавшим тучку
                    ///Сначала добавляем ячеку с героем
                    callsPoint.Add(new Point(unit.PositionX, unit.PositionY));
                    int xNew = unit.PositionX;
                    int yNew = unit.PositionY;
                    if (unit.Angel == EAngel.Left)
                    {
                        for (int i = 0; i <= _size; i++)
                        {
                            xNew = xNew - 1;
                            callsPoint.Add(new Point(xNew, yNew));
                            callsPoint.Add(new Point(xNew, yNew + 1));
                            callsPoint.Add(new Point(xNew, yNew + 2));
                            callsPoint.Add(new Point(xNew, yNew - 1));
                            callsPoint.Add(new Point(xNew, yNew - 2));
                        }
                    }
                    else if (unit.Angel == EAngel.Right)
                    {
                        for (int i = 0; i <= _size; i++)
                        {
                            xNew = xNew + 1;
                            callsPoint.Add(new Point(xNew, yNew));
                            callsPoint.Add(new Point(xNew, yNew + 1));
                            callsPoint.Add(new Point(xNew, yNew + 2));
                            callsPoint.Add(new Point(xNew, yNew - 1));
                            callsPoint.Add(new Point(xNew, yNew - 2));
                        }
                    }
                    else if (unit.Angel == EAngel.Top)
                    {
                        for (int i = 0; i <= _size; i++)
                        {
                            yNew = yNew - 1;
                            callsPoint.Add(new Point(xNew, yNew));
                            callsPoint.Add(new Point(xNew + 1, yNew));
                            callsPoint.Add(new Point(xNew + 2, yNew));
                            callsPoint.Add(new Point(xNew - 1, yNew));
                            callsPoint.Add(new Point(xNew - 2, yNew));
                        }
                    }
                    else if (unit.Angel == EAngel.Bottom)
                    {
                        for (int i = 0; i <= _size; i++)
                        {
                            yNew = yNew + 1;
                            callsPoint.Add(new Point(xNew, yNew));
                            callsPoint.Add(new Point(xNew + 1, yNew));
                            callsPoint.Add(new Point(xNew + 2, yNew));
                            callsPoint.Add(new Point(xNew - 1, 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_Alchemist_AcidSpray acidSpray = new UC_Alchemist_AcidSpray();
                            acidSpray.ChengAngel(unit.Angel);

                            Bullet bullAcidSpray = new Bullet()
                            {
                                Name = "SP_Alchemist_AcidSpray"
                            };
                            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;
                            ///Магический урон зависит от прокача стрел
                            //bullArrow.DemageMagic = 5 * (int)property;

                            if (LevelCast == 1)
                            {
                                bullAcidSpray.MinusArmor  = 4;
                                bullAcidSpray.DemageMagic = 4;
                            }
                            else if (LevelCast == 2)
                            {
                                bullAcidSpray.MinusArmor  = 6;
                                bullAcidSpray.DemageMagic = 6;
                            }
                            else if (LevelCast == 3)
                            {
                                bullAcidSpray.MinusArmor  = 8;
                                bullAcidSpray.DemageMagic = 8;
                            }

                            bullAcidSpray.CurrentMap = map;
                            bullAcidSpray.Angel      = unit.Angel;
                            bullAcidSpray.Range      = _unit.Range;
                            bullAcidSpray.Duration   = Duration;

                            bullAcidSpray.Spells.Add(new SPB_Alchemist_AcidSpray()
                            {
                                Name = "AcidSpray"
                            });

                            ///И его же добавим в масив всех объектов
                            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("AcidSpray");
                        }
                    }

                    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 &&
                !unit.Hexed)
            {
                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);

                        #region Desol
                        for (int i = 0; i < attackCallCall.IUnits.Count; i++)
                        {
                            if (attackCallCall.IUnits[i] != bullet.UnitUsed &&
                                attackCallCall.IUnits[i].GroupType != bullet.UnitUsed.GroupType)
                            {
                                UnitGenerator.Desolator(_unit, attackCallCall.IUnits[i]);
                                UnitGenerator.Skadi(_unit, attackCallCall.IUnits[i]);
                            }
                        }
                        #endregion

                        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();
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
        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;
            }
        }