Ejemplo n.º 1
0
        private static IEnumerable <uint> SpawnLoot(uint creature, string lootTableName, int chance, int attempts)
        {
            var gilfinderLevel      = GetLocalInt(creature, "GILFINDER_LEVEL");
            var gilPercentIncrease  = gilfinderLevel * 0.2f;
            var treasureHunterLevel = GetLocalInt(creature, "TREASURE_HUNTER_LEVEL");

            var table = GetLootTableByName(lootTableName);

            for (int x = 1; x <= attempts; x++)
            {
                if (Random.D100(1) > chance)
                {
                    continue;
                }

                var item     = table.GetRandomItem(treasureHunterLevel);
                var quantity = Random.Next(item.MaxQuantity) + 1;

                // Gilfinder perk - Increase the quantity of gold found.
                if (item.Resref == "nw_it_gold001")
                {
                    quantity += (int)(quantity * gilPercentIncrease);
                }

                yield return(CreateItemOnObject(item.Resref, creature, quantity));
            }
        }
        private static void AttemptSteal(uint activator, uint target, int baseChance)
        {
            var delta = 0.0f;

            // Players who use this ability have their Thievery skill checked against the CR
            // of the target. Other users simply have a delta of zero.
            if (GetIsPC(activator) && !GetIsDM(activator))
            {
                var playerId = GetObjectUUID(activator);
                var dbPlayer = DB.Get <Player>(playerId);
                var cr       = GetChallengeRating(target) * 3;
                var thievery = dbPlayer.Skills[SkillType.Thievery];

                delta = (thievery.Rank - cr) * 0.01f;
            }

            var chance = baseChance + (delta * baseChance);

            if (chance < 1)
            {
                chance = 1;
            }
            else if (chance > 95)
            {
                chance = 95;
            }

            if (Random.D100(1) <= chance)
            {
                for (var item = GetFirstItemInInventory(target); GetIsObjectValid(item); item = GetNextItemInInventory(target))
                {
                    // This item can be stolen. Copy it to the thief now.
                    if (GetLocalBool(item, "STEAL_ITEM"))
                    {
                        DeleteLocalBool(item, "STEAL_ITEM");
                        CopyItem(item, activator, true);

                        Messaging.SendMessageNearbyToPlayers(activator, $"{GetName(activator)} successfully steals '{GetName(item)}' from {GetName(target)}.");

                        DestroyObject(item);
                        break;
                    }
                }
            }
            else
            {
                SendMessageToPC(activator, $"You failed to steal from {GetName(target)}.");
            }

            CombatPoint.AddCombatPoint(activator, target, SkillType.Thievery, 3);
            Enmity.ModifyEnmity(activator, target, 5);
        }
Ejemplo n.º 3
0
        private static void ElectricFist2(AbilityBuilder builder)
        {
            builder.Create(Feat.ElectricFist2, PerkType.ElectricFist)
            .Name("Electric Fist II")
            .HasRecastDelay(RecastGroup.ElectricFist, 120f)
            .UsesActivationType(AbilityActivationType.Weapon)
            .RequirementStamina(6)
            .HasImpactAction((activator, target, level) =>
            {
                var modifier = GetAbilityModifier(AbilityType.Wisdom, activator);
                modifier     = modifier > 0 ? modifier : 0;
                var damage   = Random.D8(2) + modifier;
                ApplyEffectToObject(DurationType.Instant, EffectDamage(damage, DamageType.Electrical), target);
                ApplyEffectToObject(DurationType.Instant, EffectVisualEffect(VisualEffect.Vfx_Com_Hit_Electrical), target);

                if (Random.D100(1) <= 50)
                {
                    StatusEffect.Apply(activator, target, StatusEffectType.Static, 18f);
                }

                CombatPoint.AddCombatPoint(activator, target, SkillType.Chi, 3);
                Enmity.ModifyEnmityOnAll(activator, 8 + damage);
            });
        }