Example #1
0
    public override void OnKill()
    {
        var position = CollectionsHelper.RandomizeFrequenciesListPosition(_dungeonKeyRarityChances);

        if (position != 0)
        {
            var dungeonKey = User.Instance.DungeonKeys.FirstOrDefault(x => x.Rarity == (Rarity)(position - 1));
            dungeonKey.AddItem();
        }
    }
Example #2
0
    protected void CheckForDungeonKeyDrop()
    {
        var dungeonKeyRarityChances = DungeonKey.CreateRarityChancesList(Health);

        var position = CollectionsHelper.RandomizeFrequenciesListPosition(dungeonKeyRarityChances);

        // Grant dungeon key after if algorithm didn't roll empty loot.
        if (position != 0)
        {
            var dungeonKey = User.Instance.DungeonKeys.FirstOrDefault(x => x.Rarity == (Rarity)(position - 1));
            dungeonKey.AddItem();
        }
    }
Example #3
0
    public void SpawnMonster()
    {
        var frequencyList = Region.MonsterSpawnPatterns.Select(x => x.Frequency).ToList();
        var position      = CollectionsHelper.RandomizeFrequenciesListPosition(frequencyList);

        Monster = Region.MonsterSpawnPatterns[position].Monster.CopyEnemy();

        DataContext = Monster;

        // Set Button's border based on it's spawn rate.
        MainBorder.BorderBrush = ColorsHelper.GetMonsterSpawnRarityColor(Region.MonsterSpawnPatterns.FirstOrDefault(x => x.MonsterId == Monster.Id));

        CombatTimersHelper.StartAuraTimerOnCurrentRegion();
    }