Exemplo n.º 1
0
 public void OnStartCasting(Champion owner, Spell spell, AttackableUnit target)
 {
     ApiFunctionManager.CreateTimer(1.0f, () => {
         var ap     = owner.GetStats().AbilityPower.Total * 0.2f;
         var damage = 7 + spell.Level * 9 + ap;
         target.TakeDamage(owner, damage, DamageType.DAMAGE_TYPE_MAGICAL, DamageSource.DAMAGE_SOURCE_SPELL, false);
     });
     ApiFunctionManager.CreateTimer(2.0f, () => {
         var ap     = owner.GetStats().AbilityPower.Total * 0.2f;
         var damage = 7 + spell.Level * 9 + ap;
         target.TakeDamage(owner, damage, DamageType.DAMAGE_TYPE_MAGICAL, DamageSource.DAMAGE_SOURCE_SPELL, false);
     });
     ApiFunctionManager.CreateTimer(3.0f, () => {
         var ap     = owner.GetStats().AbilityPower.Total * 0.2f;
         var damage = 7 + spell.Level * 9 + ap;
         target.TakeDamage(owner, damage, DamageType.DAMAGE_TYPE_MAGICAL, DamageSource.DAMAGE_SOURCE_SPELL, false);
     });
     ApiFunctionManager.CreateTimer(4.0f, () => {
         var ap     = owner.GetStats().AbilityPower.Total * 0.2f;
         var damage = 7 + spell.Level * 9 + ap;
         target.TakeDamage(owner, damage, DamageType.DAMAGE_TYPE_MAGICAL, DamageSource.DAMAGE_SOURCE_SPELL, false);
     });
     ApiFunctionManager.CreateTimer(5.0f, () => {
         var ap     = owner.GetStats().AbilityPower.Total * 0.2f;
         var damage = 7 + spell.Level * 9 + ap;
         target.TakeDamage(owner, damage, DamageType.DAMAGE_TYPE_MAGICAL, DamageSource.DAMAGE_SOURCE_SPELL, false);
     });
 }
Exemplo n.º 2
0
        public bool IsInLane()
        {
            bool isLane = false;

            foreach (var point in _mainWaypoints)
            {
                if (Vector2.Distance(GetPosition(), point) <= 2000)
                {
                    isLane = true;
                }
            }
            if (!isLane)
            {
                _game.PacketNotifier.NotifyNPC_InstantStopAttack(this, false);
                IsAttacking = false;
                _aiPaused   = true;
                var path = _game.Map.NavigationGrid.GetPath(GetPosition(), _mainWaypoints[_curMainWaypoint + 1]);
                if (path == null)
                {
                    TeleportTo(_mainWaypoints[_curMainWaypoint].X, _mainWaypoints[_curMainWaypoint].Y);
                    return(false);
                }
                if (path.Count > 1)
                {
                    SetWaypoints(path);
                    isReturning = true;
                    ApiFunctionManager.CreateTimer(3.0f, () => { isReturning = false; _aiPaused = false; });
                }
                return(false);
            }
            else
            {
                return(true);
            }
        }
        public void OnStartCasting(Champion owner, Spell spell, AttackableUnit target)
        {
            var      visualBuff = ApiFunctionManager.AddBuffHUDVisual("SummonerDot", 5.0f, 1, (ObjAIBase)target);
            Particle p          = ApiFunctionManager.AddParticleTarget(owner, "Global_SS_Ignite.troy", target, 1);
            var      damage     = 10 + owner.GetStats().Level * 4;

            target.TakeDamage(owner, damage, DamageType.DAMAGE_TYPE_TRUE, DamageSource.DAMAGE_SOURCE_SPELL, false);
            ApiFunctionManager.CreateTimer(1.0f,
                                           () =>
            {
                target.TakeDamage(owner, damage, DamageType.DAMAGE_TYPE_TRUE, DamageSource.DAMAGE_SOURCE_SPELL,
                                  false);
            });
            ApiFunctionManager.CreateTimer(2.0f,
                                           () =>
            {
                target.TakeDamage(owner, damage, DamageType.DAMAGE_TYPE_TRUE, DamageSource.DAMAGE_SOURCE_SPELL,
                                  false);
            });
            ApiFunctionManager.CreateTimer(3.0f,
                                           () =>
            {
                target.TakeDamage(owner, damage, DamageType.DAMAGE_TYPE_TRUE, DamageSource.DAMAGE_SOURCE_SPELL,
                                  false);
            });
            ApiFunctionManager.CreateTimer(4.0f, () =>
            {
                target.TakeDamage(owner, damage, DamageType.DAMAGE_TYPE_TRUE, DamageSource.DAMAGE_SOURCE_SPELL, false);
                ApiFunctionManager.RemoveParticle(p);
                ApiFunctionManager.RemoveBuffHUDVisual(visualBuff);
            });
        }
Exemplo n.º 4
0
        public void OnFinishCasting(Champion owner, Spell spell, AttackableUnit target)
        {
            Target  ZoneCenter;
            Vector2 ownerLocation  = new Vector2(owner.X, owner.Y);
            Vector2 targetLocation = new Vector2(spell.X, spell.Y);
            var     spellData      = spell.SpellData;
            float   distance       = Vector2.Distance(ownerLocation, targetLocation);

            if (distance > spellData.CastRange[0])
            {
                var to         = Vector2.Normalize(targetLocation - ownerLocation);
                var range      = to * 800;
                var trueCoords = ownerLocation + range;
                ZoneCenter = new Target(trueCoords.X, trueCoords.Y);
            }
            else
            {
                ZoneCenter = new Target(spell.X, spell.Y);
            }
            Particle p = ApiFunctionManager.AddParticleTarget(owner, "missFortune_makeItRain_incoming.troy", ZoneCenter);

            for (byte i = 0; i < 8; ++i)
            {
                ApiFunctionManager.CreateTimer(0.25f * i, () =>
                {
                    DamageTargetsInZone(owner, spell, target, ZoneCenter);
                });
            }
            ApiFunctionManager.CreateTimer(2.0f, () =>
            {
                ApiFunctionManager.RemoveParticle(p);
            });
        }
Exemplo n.º 5
0
        public void OnFinishCasting(Champion owner, Spell spell, AttackableUnit target)
        {
            Target  ZoneCenter;
            Vector2 ownerLocation  = new Vector2(owner.X, owner.Y);
            Vector2 targetLocation = new Vector2(spell.X, spell.Y);
            var     spellData      = spell.SpellData;
            float   distance       = Vector2.Distance(ownerLocation, targetLocation);

            if (distance > spellData.CastRange[0])
            {
                var to         = Vector2.Normalize(targetLocation - ownerLocation);
                var range      = to * 650;
                var trueCoords = ownerLocation + range;

                ZoneCenter = new Target(trueCoords.X, trueCoords.Y);
            }
            else
            {
                ZoneCenter = new Target(spell.X, spell.Y);
            }

            Particle p = ApiFunctionManager.AddParticleTarget(owner, "Evelynn_R_cas.troy", ZoneCenter);

            spell.spellAnimation("SPELL4", owner);

            List <AttackableUnit> units = ApiFunctionManager.GetUnitsInRange(ZoneCenter, 250, true);
            var ap = owner.GetStats().AbilityPower.Total * 0.01f;
            var percentHealthDamage = ((new float[] { 0.15f, 0.20f, 0.25f })[spell.Level]) + ap;
            var damage        = 0.0f;
            var monsterDamage = 0.0f;

            foreach (AttackableUnit unit in units)
            {
                if (unit.Team != owner.Team)
                {
                    if (unit is Champion || unit is Minion)
                    {
                        damage = unit.GetStats().CurrentHealth *percentHealthDamage;
                        unit.TakeDamage(owner, damage, DamageType.DAMAGE_TYPE_MAGICAL, DamageSource.DAMAGE_SOURCE_SPELL, false);
                    }
                    else if (unit is Monster)
                    {
                        damage        = unit.GetStats().CurrentHealth *percentHealthDamage;
                        monsterDamage = Math.Max(damage, 1000);
                        unit.TakeDamage(owner, damage, DamageType.DAMAGE_TYPE_MAGICAL, DamageSource.DAMAGE_SOURCE_SPELL, false);
                    }
                }
            }

            //TODO:Give evelynn her shield per champion hit.

            ApiFunctionManager.CreateTimer(2.0f, () =>
            {
                ApiFunctionManager.RemoveParticle(p);
            });
        }
        public void OnStartCasting(Champion owner, Spell spell, AttackableUnit target)
        {
            ChampionStatModifier statMod = new ChampionStatModifier();

            statMod.MoveSpeed.PercentBonus = 27 / 100.0f;
            owner.AddStatModifier(statMod);
            var hasteBuff = ApiFunctionManager.AddBuffHUDVisual("SummonerHaste", 10.0f, 1, owner, 10.0f);

            ApiFunctionManager.CreateTimer(10.0f, () => { owner.RemoveStatModifier(statMod); });
        }
Exemplo n.º 7
0
        public void OnFinishCasting(Champion owner, Spell spell, AttackableUnit target)
        {
            var buff       = ((ObjAIBase)target).AddBuffGameScript("ImpureShotsActive", "ImpureShotsActive", spell, -1, true);
            var visualBuff = ApiFunctionManager.AddBuffHUDVisual("MissFortuneViciousStrikes", 5.0f, 1, owner);

            ApiFunctionManager.CreateTimer(6.0f, () =>
            {
                owner.RemoveBuffGameScript(buff);
                ApiFunctionManager.RemoveBuffHUDVisual(visualBuff);
            });
        }
Exemplo n.º 8
0
        public void ApplyEffects(Champion owner, AttackableUnit target, Spell spell, Projectile projectile)
        {
            float time       = 5;
            var   visualBuff = ApiFunctionManager.AddBuffHUDVisual("ExplosiveShotDebuff", time, 5, (ObjAIBase)target);

            ApiFunctionManager.CreateTimer(time, () =>
            {
                ApiFunctionManager.RemoveBuffHUDVisual(visualBuff);
            });
            projectile.setToRemove();
        }
Exemplo n.º 9
0
        public void OnStartCasting(Champion owner, Spell spell, AttackableUnit target)
        {
            var buff       = ((ObjAIBase)target).AddBuffGameScript("TristanaQ", "TristanaQ", spell);
            var visualBuff = ApiFunctionManager.AddBuffHUDVisual("RapidFire", 5.0f, 1, owner);

            ApiFunctionManager.CreateTimer(5.0f, () =>
            {
                ApiFunctionManager.RemoveBuffHUDVisual(visualBuff);
                owner.RemoveBuffGameScript(buff);
            });
        }
Exemplo n.º 10
0
        public void OnStartCasting(Champion owner, Spell spell, AttackableUnit target)
        {
            Particle p          = ApiFunctionManager.AddParticleTarget(owner, "Overdrive_buf.troy", target, 1);
            var      buff       = ((ObjAIBase)target).AddBuffGameScript("Overdrive", "Overdrive", spell);
            var      visualBuff = ApiFunctionManager.AddBuffHUDVisual("Overdrive", 8.0f, 1, owner);

            ApiFunctionManager.CreateTimer(8.0f, () =>
            {
                ApiFunctionManager.RemoveParticle(p);
                ApiFunctionManager.RemoveBuffHUDVisual(visualBuff);
                ((ObjAIBase)target).RemoveBuffGameScript(buff);
            });
        }
Exemplo n.º 11
0
        public BuffGameScriptController(Game game, IObjAiBase unit, string buffNamespace, string buffClass, ISpell ownerSpell, float duration = -1f)
        {
            _scriptEngine = game.ScriptEngine;
            BuffNamespace = buffNamespace;
            BuffClass     = buffClass;
            OwnerSpell    = ownerSpell;
            Unit          = unit;
            _duration     = duration;
            GameScript    = _scriptEngine.CreateObject <IBuffGameScript>(buffNamespace, buffClass);

            if (_duration >= 0)
            {
                ApiFunctionManager.CreateTimer(_duration, DeactivateBuff);
            }
        }
Exemplo n.º 12
0
        public void OnStartCasting(Champion owner, Spell spell, AttackableUnit target)
        {
            Particle p          = ApiFunctionManager.AddParticleTarget(owner, "Garen_Base_E_Spin.troy", owner, 1);
            var      visualBuff = ApiFunctionManager.AddBuffHUDVisual("GarenE", 3.0f, 1, owner);

            ApiFunctionManager.CreateTimer(3.0f, () =>
            {
                ApiFunctionManager.RemoveBuffHUDVisual(visualBuff);
                ApiFunctionManager.RemoveParticle(p);
            });
            for (float i = 0.0f; i < 3.0; i += 0.5f)
            {
                ApiFunctionManager.CreateTimer(i, () => { ApplySpinDamage(owner, spell, target); });
            }
        }
Exemplo n.º 13
0
        public BuffGameScriptController(ObjAIBase unit, String buffNamespace, String buffClass, Spell ownerSpell, float duration = -1f)
        {
            _buffNamespace = buffNamespace;
            _buffClass     = buffClass;
            _ownerSpell    = ownerSpell;
            _unit          = unit;
            _duration      = duration;
            _gameScript    = _scriptEngine.CreateObject <BuffGameScript>(buffNamespace, buffClass);

            if (_duration >= 0)
            {
                ApiFunctionManager.CreateTimer(_duration, () => {
                    DeactivateBuff();
                });
            }
        }
Exemplo n.º 14
0
        public void ApplyEffects(Champion owner, AttackableUnit target, Spell spell, Projectile projectile)
        {
            var ap     = owner.GetStats().AbilityPower.Total * 0.8f;
            var damage = 35 + spell.Level * 45 + ap;

            target.TakeDamage(owner, damage, DamageType.DAMAGE_TYPE_MAGICAL, DamageSource.DAMAGE_SOURCE_SPELL, false);
            float time       = 1.25f + 0.25f * spell.Level;
            var   buff       = ((ObjAIBase)target).AddBuffGameScript("Blind", "Blind", spell);
            var   visualBuff = ApiFunctionManager.AddBuffHUDVisual("Blind", time, 1, (ObjAIBase)target);

            ApiFunctionManager.CreateTimer(time, () =>
            {
                ApiFunctionManager.RemoveBuffHUDVisual(visualBuff);
                ((ObjAIBase)target).RemoveBuffGameScript(buff);
            });
        }
Exemplo n.º 15
0
        public void OnFinishCasting(Champion owner, Spell spell, AttackableUnit target)
        {
            ChampionStatModifier statMod = new ChampionStatModifier();

            statMod.MoveSpeed.PercentBonus   -= 30.0f / 100.0f;
            statMod.AttackSpeed.PercentBonus -= 30.0f / 100.0f;
            statMod.Armor.BaseBonus          -= 10;
            statMod.MagicResist.BaseBonus    -= 10;
            target.AddStatModifier(statMod);
            ApiFunctionManager.AddParticleTarget(owner, "Global_SS_Exhaust.troy", target);
            var visualBuff = ApiFunctionManager.AddBuffHUDVisual("SummonerExhaustDebuff", 2.5f, 1, (ObjAIBase)target);

            ApiFunctionManager.CreateTimer(2.5f, () =>
            {
                ApiFunctionManager.RemoveBuffHUDVisual(visualBuff);
                target.RemoveStatModifier(statMod);
            });
        }
Exemplo n.º 16
0
        public void OnFinishCasting(Champion owner, Spell spell, AttackableUnit target)
        {
            var current    = new Vector2(owner.X, owner.Y);
            var to         = Vector2.Normalize(new Vector2(spell.X, spell.Y) - current);
            var range      = to * 1150;
            var trueCoords = current + range;

            spell.AddProjectile("EzrealMysticShotMissile", trueCoords.X, trueCoords.Y);

            var buff       = owner.AddBuffGameScript("Quickdraw", "Quickdraw", spell);
            var visualBuff = ApiFunctionManager.AddBuffHUDVisual("Quickdraw", 6.0f, 0, owner);

            ApiFunctionManager.CreateTimer(6.0f, () =>
            {
                ApiFunctionManager.RemoveBuffHUDVisual(visualBuff);
                owner.RemoveBuffGameScript(buff);
            });
        }
Exemplo n.º 17
0
        public void OnFinishCasting(Champion owner, Spell spell, AttackableUnit target)
        {
            var current    = new Vector2(owner.X, owner.Y);
            var to         = Vector2.Normalize(new Vector2(spell.X, spell.Y) - current);
            var range      = to * 425;
            var trueCoords = current + range;

            ApiFunctionManager.DashToLocation(owner, trueCoords.X, trueCoords.Y, 1200, false, "Spell3");
            Particle p          = ApiFunctionManager.AddParticleTarget(owner, "Graves_Move_OnBuffActivate.troy", owner);
            var      visualBuff = ApiFunctionManager.AddBuffHUDVisual("GravesSteroid", 5.0f, 90, owner);
            var      buff       = owner.AddBuffGameScript("Quickdraw", "Quickdraw", spell, -1, true);

            ApiFunctionManager.CreateTimer(4.0f, () =>
            {
                ApiFunctionManager.RemoveParticle(p);
                ApiFunctionManager.RemoveBuffHUDVisual(visualBuff);
                owner.RemoveBuffGameScript(buff);
            });
        }
Exemplo n.º 18
0
        public void Recall(ObjAIBase owner, float timer = 8.0f)
        {
            var spawnPos = GetRespawnPosition();

            IsRecalling  = true;
            _visualBuff  = ApiFunctionManager.AddBuffHUDVisual("Recall", timer, 1, this);
            _addParticle = ApiFunctionManager.AddParticleTarget(this, "TeleportHome.troy", this);
            _canRecall   = true;

            ApiFunctionManager.CreateTimer(timer, () =>
            {
                if (_canRecall)
                {
                    ApiFunctionManager.RemoveBuffHUDVisual(_visualBuff);
                    ApiFunctionManager.RemoveParticle(_addParticle);
                    ApiFunctionManager.TeleportTo(owner, spawnPos.X, spawnPos.Y);
                    IsRecalling = false;
                }
            });
        }
Exemplo n.º 19
0
        public void ApplyEffects(Champion owner, AttackableUnit target, Spell spell, Projectile projectile)
        {
            Champion champion   = (Champion)target;
            float    time       = 1 + 0.25f * spell.Level;
            var      buff       = ((ObjAIBase)target).AddBuffGameScript("LuluWDebuff", "LuluWDebuff", spell);
            var      visualBuff = ApiFunctionManager.AddBuffHUDVisual("LuluWDebuff", time, 1, (ObjAIBase)target);
            string   model      = champion.Model;

            ChangeModel(owner.Skin, target);

            Particle p = ApiFunctionManager.AddParticleTarget(owner, "Lulu_W_polymorph_01.troy", target, 1);

            ApiFunctionManager.CreateTimer(time, () =>
            {
                ApiFunctionManager.RemoveParticle(p);
                ApiFunctionManager.RemoveBuffHUDVisual(visualBuff);
                owner.RemoveBuffGameScript(buff);
                ApiFunctionManager.SetChampionModel((Champion)target, model);
            });
            projectile.setToRemove();
        }
        public void OnFinishCasting(Champion owner, Spell spell, AttackableUnit target)
        {
            if (!owner.IsDead)
            {
                return;
            }

            owner.Respawn();

            ChampionStatModifier statMod = new ChampionStatModifier();

            statMod.MoveSpeed.PercentBonus = 125.0f / 100.0f;
            owner.AddStatModifier(statMod);
            ApiFunctionManager.AddParticleTarget(owner, "Global_SS_Revive.troy", owner);
            var visualBuff = ApiFunctionManager.AddBuffHUDVisual("SummonerReviveSpeedBoost", 12.0f, 1, owner);

            ApiFunctionManager.CreateTimer(12.0f, () =>
            {
                ApiFunctionManager.RemoveBuffHUDVisual(visualBuff);
                owner.RemoveStatModifier(statMod);
            });
        }
Exemplo n.º 21
0
        public void OnFinishCasting(Champion owner, Spell spell, AttackableUnit target)
        {
            Champion champion = (Champion)target;

            if (champion.Team != owner.Team)
            {
                spell.AddProjectileTarget("LuluWTwo", target);
            }
            else
            {
                Particle p = ApiFunctionManager.AddParticleTarget(owner, "Lulu_W_buf_02.troy", target, 1);
                ApiFunctionManager.AddParticleTarget(owner, "Lulu_W_buf_01.troy", target, 1);
                float time       = 2.5f + 0.5f * spell.Level;
                var   buff       = ((ObjAIBase)target).AddBuffGameScript("LuluWBuff", "LuluWBuff", spell);
                var   visualBuff = ApiFunctionManager.AddBuffHUDVisual("LuluWBuff", time, 1, (ObjAIBase)target);
                ApiFunctionManager.CreateTimer(time, () =>
                {
                    ApiFunctionManager.RemoveParticle(p);
                    ApiFunctionManager.RemoveBuffHUDVisual(visualBuff);
                    owner.RemoveBuffGameScript(buff);
                });
            }
        }
Exemplo n.º 22
0
        public void OnFinishCasting(Champion owner, Spell spell, AttackableUnit target)
        {
            var      units = ApiFunctionManager.GetChampionsInRange(owner, 850, true);
            Champion mostWoundedAlliedChampion = null;
            float    lowestHealthPercentage    = 100;
            float    maxHealth;
            float    newHealth;

            for (var i = 0; i <= units.Count - 1; i++)
            {
                var value = units[i];
                if (owner.Team == value.Team && i != 0)
                {
                    var currentHealth = value.GetStats().CurrentHealth;
                    maxHealth = value.GetStats().HealthPoints.Total;
                    if (currentHealth * 100 / maxHealth < lowestHealthPercentage && owner != value)
                    {
                        lowestHealthPercentage    = currentHealth * 100 / maxHealth;
                        mostWoundedAlliedChampion = value;
                    }
                }
            }

            if (mostWoundedAlliedChampion != null)
            {
                newHealth = mostWoundedAlliedChampion.GetStats().CurrentHealth + 75 + owner.GetStats().GetLevel() * 15;
                maxHealth = mostWoundedAlliedChampion.GetStats().HealthPoints.Total;
                if (newHealth >= maxHealth)
                {
                    mostWoundedAlliedChampion.GetStats().CurrentHealth = maxHealth;
                }
                else
                {
                    mostWoundedAlliedChampion.GetStats().CurrentHealth = newHealth;
                }

                ApiFunctionManager.AddBuffHUDVisual("SummonerHeal", 1.0f, 1, mostWoundedAlliedChampion, 1.0f);
                ChampionStatModifier statMod2 = new ChampionStatModifier();
                statMod2.MoveSpeed.PercentBonus = 30 / 100.0f;
                mostWoundedAlliedChampion.AddStatModifier(statMod2);
                ApiFunctionManager.CreateTimer(1.0f, () => { mostWoundedAlliedChampion.RemoveStatModifier(statMod2); });
                ApiFunctionManager.AddParticleTarget(mostWoundedAlliedChampion, "global_ss_heal_02.troy",
                                                     mostWoundedAlliedChampion);
                ApiFunctionManager.AddParticleTarget(mostWoundedAlliedChampion, "global_ss_heal_speedboost.troy",
                                                     mostWoundedAlliedChampion);
            }

            newHealth = owner.GetStats().CurrentHealth + 75 + owner.GetStats().GetLevel() * 15;
            maxHealth = owner.GetStats().HealthPoints.Total;
            if (newHealth >= maxHealth)
            {
                owner.GetStats().CurrentHealth = maxHealth;
            }
            else
            {
                owner.GetStats().CurrentHealth = newHealth;
            }

            ApiFunctionManager.AddBuffHUDVisual("SummonerHeal", 1.0f, 1, owner, 1.0f);
            ChampionStatModifier statMod = new ChampionStatModifier();

            statMod.MoveSpeed.PercentBonus = 30 / 100.0f;
            owner.AddStatModifier(statMod);
            ApiFunctionManager.CreateTimer(1.0f, () => { owner.RemoveStatModifier(statMod); });
            ApiFunctionManager.AddParticleTarget(owner, "global_ss_heal.troy", owner);
            ApiFunctionManager.AddParticleTarget(owner, "global_ss_heal_speedboost.troy", owner);
        }