Ejemplo n.º 1
0
        private void onCharacterKilled(CharacterInstance target, CharacterInstance killer, bool critted, SkillType fromSkill)
        {
            Player        player        = GameLogic.Binder.GameState.Player;
            ActiveDungeon activeDungeon = GameLogic.Binder.GameState.ActiveDungeon;

            if (((killer != null) && !target.IsPlayerCharacter) && (killer.IsPlayerCharacter && !activeDungeon.isTutorialDungeon()))
            {
                Vector3 positionAtTimeOfDeath = target.PositionAtTimeOfDeath;
                if (target.IsBoss && (activeDungeon.ActiveRoom.numberOfBossesAlive() == 0))
                {
                    activeDungeon.LastBossKillWorldPt = positionAtTimeOfDeath;
                }
                else if (!activeDungeon.ActiveRoom.MainBossSummoned)
                {
                    if (!activeDungeon.hasDungeonModifier(DungeonModifierType.MonsterNoCoins))
                    {
                        double baseCoinReward = App.Binder.ConfigMeta.MinionCoinDropCurve(activeDungeon.Floor);
                        double num2           = player.calculateStandardCoinRoll(baseCoinReward, target.Type, 1);
                        CmdGainResources.ExecuteStatic(player, ResourceType.Coin, num2, true, "TRACKING_ID_GAMEPLAY_LOOT_GAIN", new Vector3?(positionAtTimeOfDeath));
                    }
                    CharacterInstance primaryPlayerCharacter = activeDungeon.PrimaryPlayerCharacter;
                    double            amount = App.Binder.ConfigMeta.XpFromMinionKill(activeDungeon.Floor);
                    float             num4   = primaryPlayerCharacter.getCharacterTypeXpModifier(target.Type) + primaryPlayerCharacter.UniversalXpBonus(true);
                    amount += amount * num4;
                    CmdGainResources.ExecuteStatic(player, ResourceType.Xp, amount, true, string.Empty, new Vector3?(positionAtTimeOfDeath));
                    CmdRollDropLootTable.ExecuteStatic(App.Binder.ConfigLootTables.MinionDropLootTable, player, positionAtTimeOfDeath, target.Type, null, ChestType.NONE);
                }
                if (target.IsWildBoss && !target.IsBossClone)
                {
                    GameLogic.Binder.LootSystem.awardBossRewards(activeDungeon, target.Type, true);
                }
            }
        }
Ejemplo n.º 2
0
        public void triggerResourceExplosion(ResourceType resourceType, Vector3 centerWorldPos, double amountPerDrop, int dropCount, [Optional, DefaultParameterValue("")] string trackingId)
        {
            Player player = GameLogic.Binder.GameState.Player;

            for (int i = 0; i < dropCount; i++)
            {
                Vector2 normalized = UnityEngine.Random.insideUnitCircle.normalized;
                Vector3 vector2    = centerWorldPos + new Vector3(normalized.x, 0f, normalized.y);
                CmdGainResources.ExecuteStatic(player, resourceType, amountPerDrop, true, trackingId, new Vector3?(vector2));
            }
        }
Ejemplo n.º 3
0
        private void grantMultikillReward(int killCount)
        {
            ActiveDungeon activeDungeon = GameLogic.Binder.GameState.ActiveDungeon;

            if (!activeDungeon.isTutorialDungeon())
            {
                Player player     = GameLogic.Binder.GameState.Player;
                double baseAmount = App.Binder.ConfigMeta.MultikillCoinGainCurve(killCount, activeDungeon.Floor);
                baseAmount = CharacterStatModifierUtil.ApplyCoinBonuses(player.ActiveCharacter, GameLogic.CharacterType.UNSPECIFIED, baseAmount, false);
                CmdGainResources.ExecuteStatic(player, ResourceType.Coin, baseAmount, true, "TRACKING_ID_GAMEPLAY_LOOT_GAIN", null);
                GameLogic.Binder.EventBus.MultikillBonusGranted(player, killCount, baseAmount);
            }
        }
Ejemplo n.º 4
0
 private void onDungeonBoostActivated(DungeonBoost dungeonBoost, SkillType fromSkill)
 {
     if (dungeonBoost.Properties.Type == DungeonBoostType.EmptyBox)
     {
         ActiveDungeon activeDungeon  = GameLogic.Binder.GameState.ActiveDungeon;
         Player        player         = GameLogic.Binder.GameState.Player;
         double        baseCoinReward = App.Binder.ConfigMeta.MinionCoinDropCurve(activeDungeon.Floor);
         double        v = player.calculateStandardCoinRoll(baseCoinReward, GameLogic.CharacterType.UNSPECIFIED, 1) * App.Binder.ConfigMeta.DUNGEON_BOOST_EMPTY_BOX_COIN_GAIN_CONTROLLER;
         if (activeDungeon.hasDungeonModifier(DungeonModifierType.DungeonBoostBoxBonusCoins))
         {
             v *= ConfigDungeonModifiers.DungeonBoostBoxBonusCoins.CoinMultiplier;
         }
         v = MathUtil.Clamp(v, 1.0, double.MaxValue);
         CmdGainResources.ExecuteStatic(player, ResourceType.Coin, v, true, "TRACKING_ID_GAMEPLAY_LOOT_GAIN", new Vector3?(dungeonBoost.Transform.position));
     }
 }
Ejemplo n.º 5
0
        public void awardBossRewards(ActiveDungeon ad, GameLogic.CharacterType killedBossType, bool wildBoss)
        {
            ad.VisualizableBossRewards = new ActiveDungeon.BossRewards();
            CharacterInstance primaryPlayerCharacter = ad.PrimaryPlayerCharacter;
            Player            owningPlayer           = primaryPlayerCharacter.OwningPlayer;
            int    floor          = ad.Floor;
            double baseCoinReward = App.Binder.ConfigMeta.BossCoinDropCurve(floor, owningPlayer.BossTrain.Active);
            double num3           = owningPlayer.calculateStandardCoinRoll(baseCoinReward, killedBossType, 1);

            ad.VisualizableBossRewards.CoinDropCount = UnityEngine.Random.Range(3, 7);
            ad.VisualizableBossRewards.CoinsPerDrop  = num3 / ((double)ad.VisualizableBossRewards.CoinDropCount);
            bool   isHighestFloor = ad.Floor == owningPlayer.getHighestFloorReached();
            double num4           = App.Binder.ConfigMeta.XpFromBossKill(ad.Floor, isHighestFloor) / ((double)ad.VisualizableBossRewards.CoinDropCount);
            float  num5           = primaryPlayerCharacter.getCharacterTypeXpModifier(killedBossType) + primaryPlayerCharacter.UniversalXpBonus(true);

            num4 += num4 * num5;
            ad.VisualizableBossRewards.XpPerDrop = num4;
            bool flag2 = !ad.hasDungeonModifier(DungeonModifierType.MonsterNoCoins);

            for (int i = 0; i < ad.VisualizableBossRewards.CoinDropCount; i++)
            {
                if (flag2)
                {
                    Vector3?nullable = null;
                    CmdGainResources.ExecuteStatic(owningPlayer, ResourceType.Coin, ad.VisualizableBossRewards.CoinsPerDrop, true, "TRACKING_ID_GAMEPLAY_LOOT_GAIN", nullable);
                }
                Vector3?worldPt = null;
                CmdGainResources.ExecuteStatic(owningPlayer, ResourceType.Xp, ad.VisualizableBossRewards.XpPerDrop, true, string.Empty, worldPt);
            }
            bool flag3 = false;

            if (!wildBoss)
            {
                flag3 = this.grantRetirementTriggerChestIfAllowed();
            }
            if (!wildBoss && owningPlayer.canRetire())
            {
                Reward reward = owningPlayer.getFirstUnclaimedRetirementTriggerChest();
                ad.VisualizableBossRewards.Tokens = App.Binder.ConfigMeta.RetirementTokenReward(primaryPlayerCharacter, ad.Floor);
                reward.TokenDrops.Add(ad.VisualizableBossRewards.Tokens);
                if (App.Binder.ConfigMeta.BossShouldDropFrenzyPotionAtFloor(ad.Floor))
                {
                    ad.VisualizableBossRewards.FrenzyPotions = 1;
                    reward.FrenzyPotions += ad.VisualizableBossRewards.FrenzyPotions;
                }
            }
            if ((wildBoss || owningPlayer.hasRetired()) || !flag3)
            {
                ad.VisualizableBossRewards.MainDrops.Add(CmdRollDropLootTable.ExecuteStatic(App.Binder.ConfigLootTables.BossDropLootTable, owningPlayer, Vector3.zero, killedBossType, null, ChestType.NONE));
                int num7 = owningPlayer.CumulativeRetiredHeroStats.BossesBeat + owningPlayer.ActiveCharacter.HeroStats.BossesBeat;
                if ((owningPlayer.getPerkInstanceCount(PerkType.ChesterChestDrop) > 0) && ((((float)num7) % Mathf.Floor(ConfigPerks.GetBestModifier(PerkType.ChesterChestDrop))) == 0f))
                {
                    ad.VisualizableBossRewards.MainDrops.Add(CmdRollDropLootTable.ExecuteStatic(App.Binder.ConfigLootTables.BossDropLootTable, owningPlayer, Vector3.zero, killedBossType, null, ChestType.ChesterChest));
                }
            }
            if ((!wildBoss && owningPlayer.canRetire()) && ConfigMeta.BOSS_ADDITIONAL_DROPS_ENABLED)
            {
                if (flag3 && !owningPlayer.hasRetired())
                {
                    Reward item = CmdRollDropLootTable.ExecuteStatic(App.Binder.ConfigLootTables.BossAdditionalDropLootTable, owningPlayer, Vector3.zero, killedBossType, ChestType.RewardBoxCommon.ToString(), ChestType.NONE);
                    item.clearContent();
                    item.ShopEntryId = "CoinBundleSmall";
                    double num8 = App.Binder.ConfigMeta.CoinBundleSize(owningPlayer, item.ShopEntryId, 0.0);
                    item.CoinDrops.Add(num8);
                    ad.VisualizableBossRewards.RiggedRewards.Add(item);
                }
                else if (App.Binder.ConfigMeta.BossShouldDropRewardBoxAtFloor(ad.Floor))
                {
                    ad.VisualizableBossRewards.AdditionalDrop = CmdRollDropLootTable.ExecuteStatic(App.Binder.ConfigLootTables.BossAdditionalDropLootTable, owningPlayer, Vector3.zero, killedBossType, null, ChestType.NONE);
                }
            }
        }