Ejemplo n.º 1
0
 public void OnStartCasting(IObjAiBase owner, ISpell spell, IAttackableUnit target)
 {
 }
Ejemplo n.º 2
0
 public void ApplyEffects(IObjAiBase owner, IAttackableUnit target, ISpell spell, IProjectile projectile)
 {
 }
Ejemplo n.º 3
0
 public void OnStartCasting(IObjAiBase owner, ISpell spell, IAttackableUnit target)
 {
     AddParticleTarget(owner, "ezreal_bow.troy", owner, 1, "L_HAND");
 }
Ejemplo n.º 4
0
        public override void Update(float diff)
        {
            base.Update(diff);

            if (!IsDead && MoveOrder == MoveOrder.MOVE_ORDER_ATTACKMOVE && TargetUnit != null)
            {
                var             objects          = _game.ObjectManager.GetObjects();
                var             distanceToTarget = 25000f;
                IAttackableUnit nextTarget       = null;
                var             range            = Math.Max(Stats.Range.Total, DETECT_RANGE);

                foreach (var it in objects)
                {
                    if (!(it.Value is IAttackableUnit u) ||
                        u.IsDead ||
                        u.Team == Team ||
                        GetDistanceTo(u) > range)
                    {
                        continue;
                    }

                    if (!(GetDistanceTo(u) < distanceToTarget))
                    {
                        continue;
                    }
                    distanceToTarget = GetDistanceTo(u);
                    nextTarget       = u;
                }

                if (nextTarget != null)
                {
                    TargetUnit = nextTarget;
                    _game.PacketNotifier.NotifySetTarget(this, nextTarget);
                }
            }

            if (!Stats.IsGeneratingGold && _game.GameTime >= _game.Map.MapProperties.FirstGoldTime)
            {
                Stats.IsGeneratingGold = true;
                Logger.Debug("Generating Gold!");
            }

            if (RespawnTimer > 0)
            {
                RespawnTimer -= diff;
                if (RespawnTimer <= 0)
                {
                    Respawn();
                }
            }

            var isLevelup = LevelUp();

            if (isLevelup)
            {
                _game.PacketNotifier.NotifyLevelUp(this);
                // TODO: send this in one place only
                _game.PacketNotifier.NotifyUpdatedStats(this, false);
            }

            foreach (var s in Spells.Values)
            {
                s.Update(diff);
            }

            if (_championHitFlagTimer > 0)
            {
                _championHitFlagTimer -= diff;
                if (_championHitFlagTimer <= 0)
                {
                    _championHitFlagTimer = 0;
                }
            }
            Replication.Update();
        }
Ejemplo n.º 5
0
        public override void Die(IAttackableUnit killer)
        {
            RespawnTimer = 5000 + Stats.Level * 2500;
            _game.ObjectManager.StopTargeting(this);
            ChampStats.Deaths += 1;

            _game.PacketNotifier.NotifyUnitAnnounceEvent(UnitAnnounces.DEATH, this, killer);

            var cKiller = killer as IChampion;

            if (cKiller == null && _championHitFlagTimer > 0)
            {
                cKiller = _game.ObjectManager.GetObjectById(_playerHitId) as IChampion;
                Logger.Debug("Killed by turret, minion or monster, but still  give gold to the enemy.");
            }

            if (cKiller == null)
            {
                _game.PacketNotifier.NotifyChampionDie(this, killer, 0);
                return;
            }

            cKiller.ChampionGoldFromMinions = 0;
            cKiller.ChampStats.Kills       += 1;
            // TODO: add assists

            var gold = _game.Map.MapProperties.GetGoldFor(this);

            Logger.Debug($"Before: getGoldFromChamp: {gold} Killer: {cKiller.KillDeathCounter} Victim {KillDeathCounter}");

            if (cKiller.KillDeathCounter < 0)
            {
                cKiller.KillDeathCounter = 0;
            }

            if (cKiller.KillDeathCounter >= 0)
            {
                cKiller.KillDeathCounter += 1;
            }

            if (KillDeathCounter > 0)
            {
                KillDeathCounter = 0;
            }

            if (KillDeathCounter <= 0)
            {
                KillDeathCounter -= 1;
            }

            if (gold < 0)
            {
                _game.PacketNotifier.NotifyChampionDie(this, cKiller, 0);
                return;
            }

            if (_game.Map.MapProperties.IsKillGoldRewardReductionActive &&
                _game.Map.MapProperties.HasFirstBloodHappened)
            {
                gold -= gold * 0.25f;
                //CORE_INFO("Still some minutes for full gold reward on champion kills");
            }

            if (!_game.Map.MapProperties.HasFirstBloodHappened)
            {
                gold += 100;
                _game.Map.MapProperties.HasFirstBloodHappened = true;
            }

            _game.PacketNotifier.NotifyChampionDie(this, cKiller, (int)gold);

            cKiller.Stats.Gold = cKiller.Stats.Gold + gold;
            _game.PacketNotifier.NotifyAddGold(cKiller, this, gold);
            //CORE_INFO("After: getGoldFromChamp: %f Killer: %i Victim: %i", gold, cKiller.killDeathCounter,this.killDeathCounter);

            _game.ObjectManager.StopTargeting(this);
        }
Ejemplo n.º 6
0
 public void ApplyEffects(IChampion owner, IAttackableUnit target, ISpell spell, IProjectile projectile)
 {
 }
Ejemplo n.º 7
0
 public void ApplyEffects(IChampion owner, IAttackableUnit target, ISpell spell, IProjectile projectile)
 {
     target.TakeDamage(owner, 20F + spell.Level * 30F + owner.Stats.AbilityPower.Total * 0.8f,
                       DamageType.DAMAGE_TYPE_MAGICAL, DamageSource.DAMAGE_SOURCE_SPELL, false);
 }
Ejemplo n.º 8
0
 public static void FaceDirection(IAttackableUnit unit, Vector2 direction, bool instant = true, float turnTime = 0.0833f)
 {
     _game.PacketNotifier.NotifyFaceDirection(unit, direction, instant, turnTime); // TODO: Move PacketNotifier usage to less abstract classes (in this case GameObject)
     // TODO: Change direction of actual GameObject
 }
Ejemplo n.º 9
0
 public void OnFinishCasting(IChampion owner, ISpell spell, IAttackableUnit target)
 {
 }
Ejemplo n.º 10
0
 public SetTarget(IAttackableUnit attacker, IAttackableUnit attacked)
     : base(PacketCmd.PKT_S2C_SET_TARGET, attacker.NetId)
 {
     WriteNetId(attacked);
 }