Exemple #1
0
        public virtual void die(Unit killer)
        {
            setToRemove();
            map.stopTargeting(this);

            PacketNotifier.notifyNpcDie(this, killer);

            float exp    = map.getExperienceFor(this);
            var   champs = map.getChampionsInRange(this, EXP_RANGE, true);

            //Cull allied champions
            champs.RemoveAll(l => l.getTeam() == getTeam());

            if (champs.Count > 0)
            {
                float expPerChamp = exp / champs.Count;
                foreach (var c in champs)
                {
                    c.getStats().setExp(c.getStats().getExperience() + expPerChamp);
                }
            }

            if (killer != null)
            {
                var cKiller = killer as Champion;

                if (cKiller == null)
                {
                    return;
                }

                float gold = map.getGoldFor(this);
                if (gold <= 0)
                {
                    return;
                }

                cKiller.getStats().setGold(cKiller.getStats().getGold() + gold);
                PacketNotifier.notifyAddGold(cKiller, this, gold);

                if (cKiller.killDeathCounter < 0)
                {
                    cKiller.setChampionGoldFromMinions(cKiller.getChampionGoldFromMinions() + gold);
                    Logger.LogCoreInfo("Adding gold form minions to reduce death spree: " + cKiller.getChampionGoldFromMinions());
                }

                if (cKiller.getChampionGoldFromMinions() >= 50 && cKiller.killDeathCounter < 0)
                {
                    cKiller.setChampionGoldFromMinions(0);
                    cKiller.killDeathCounter += 1;
                }
            }
        }
Exemple #2
0
        public override void die(Unit killer)
        {
            respawnTimer = 5000 + getStats().getLevel() * 2500;
            map.stopTargeting(this);

            var cKiller = killer as Champion;

            if (cKiller == null && championHitFlagTimer > 0)
            {
                cKiller = map.getObjectById(playerHitId) as Champion;
                Logger.LogCoreInfo("Killed by turret, minion or monster, but still  give gold to the enemy.");
            }

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

            cKiller.setChampionGoldFromMinions(0);

            float gold = map.getGoldFor(this);

            Logger.LogCoreInfo("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)
            {
                PacketNotifier.notifyChampionDie(this, cKiller, 0);
                return;
            }

            if (map.getKillReduction() && !map.getFirstBlood())
            {
                gold -= gold * 0.25f;
                //CORE_INFO("Still some minutes for full gold reward on champion kills");
            }

            if (map.getFirstBlood())
            {
                gold += 100;
                map.setFirstBlood(false);
            }

            PacketNotifier.notifyChampionDie(this, cKiller, (int)gold);

            cKiller.getStats().setGold(cKiller.getStats().getGold() + gold);
            PacketNotifier.notifyAddGold(cKiller, this, gold);

            //CORE_INFO("After: getGoldFromChamp: %f Killer: %i Victim: %i", gold, cKiller.killDeathCounter,this.killDeathCounter);

            map.stopTargeting(this);
        }