Exemplo n.º 1
0
        public Dictionary <Feat, AbilityDetail> BuildAbilities()
        {
            var builder = new AbilityBuilder()
                          .Create(Feat.Sleep, PerkType.Sleep)
                          .Name("Sleep")
                          .HasRecastDelay(RecastGroup.Sleep, 12f)
                          .HasActivationDelay(2f)
                          .RequirementMP(8)
                          .UsesActivationType(AbilityActivationType.Casted)
                          .DisplaysVisualEffectWhenActivating()
                          .HasImpactAction((activator, target, level) =>
            {
                var resistance   = Resistance.GetResistance(target, ResistanceType.Sleep);
                var baseDuration = Random.NextFloat(15.0f, 30.0f);
                var duration     = baseDuration * resistance;

                StatusEffect.Apply(activator, target, StatusEffectType.Sleep, duration);
                Resistance.ModifyResistance(target, ResistanceType.Sleep, -0.25f);

                CombatPoint.AddCombatPoint(activator, target, SkillType.BlackMagic, 3);
                Enmity.ModifyEnmity(activator, target, 18);
            });

            return(builder.Build());
        }
        private static void Flash2(AbilityBuilder builder)
        {
            builder.Create(Feat.Flash2, PerkType.Flash)
            .Name("Flash II")
            .HasRecastDelay(RecastGroup.Flash, 60f)
            .RequirementStamina(20)
            .UsesActivationType(AbilityActivationType.Casted)
            .HasImpactAction((activator, target, level) =>
            {
                var nth    = 1;
                var nearby = GetNearestCreature(Type.IsAlive, 1, target, nth);
                while (GetIsObjectValid(nearby))
                {
                    if (GetDistanceBetween(target, nearby) > 5.0f)
                    {
                        break;
                    }

                    ApplyEffectToObject(DurationType.Instant, EffectVisualEffect(VisualEffect.Vfx_Imp_Pdk_Generic_Head_Hit), nearby);
                    StatusEffect.Apply(activator, nearby, StatusEffectType.Blind2, 45f);
                    Enmity.ModifyEnmity(activator, nearby, 50);

                    nth++;
                    nearby = GetNearestCreature(Type.IsAlive, 1, target, nth);
                }

                ApplyEffectToObject(DurationType.Instant, EffectVisualEffect(VisualEffect.Vfx_Imp_Pdk_Generic_Pulse), activator);
            });
        }
        private static void Poisona(AbilityBuilder builder)
        {
            builder.Create(Feat.Poisona, PerkType.Poisona)
            .Name("Poisona")
            .HasRecastDelay(RecastGroup.Raise, 60f)
            .HasActivationDelay(1f)
            .RequirementMP(4)
            .UsesActivationType(AbilityActivationType.Casted)
            .HasCustomValidation((activator, target, level) =>
            {
                if (!StatusEffect.HasStatusEffect(target, StatusEffectType.Poison1) &&
                    !StatusEffect.HasStatusEffect(target, StatusEffectType.Poison2) &&
                    !StatusEffect.HasStatusEffect(target, StatusEffectType.Poison3))
                {
                    return("Your target is not poisoned.");
                }

                return(string.Empty);
            })
            .HasImpactAction((activator, target, level) =>
            {
                StatusEffect.Remove(target, StatusEffectType.Poison1);
                StatusEffect.Remove(target, StatusEffectType.Poison2);
                StatusEffect.Remove(target, StatusEffectType.Poison3);

                ApplyEffectToObject(DurationType.Instant, EffectVisualEffect(VisualEffect.Vfx_Imp_Head_Nature), target);

                CombatPoint.AddCombatPointToAllTagged(activator, SkillType.WhiteMagic, 3);
                Enmity.ModifyEnmity(activator, target, 6);
            });
        }
        public static void ApplyLifeStealRecovery()
        {
            var target             = OBJECT_SELF;
            var lifeStealAmount    = GetLocalFloat(target, LifeStealVariableName);
            var lifeStealActivator = GetLocalObject(target, LifeStealActivatorVariableName);

            if (lifeStealAmount <= 0.0f)
            {
                return;
            }

            var damageDetails = Damage.GetDamageEventData();

            if (lifeStealActivator != damageDetails.Damager)
            {
                return;
            }

            var recoveryAmount = (int)(damageDetails.Total * lifeStealAmount);

            ApplyEffectToObject(DurationType.Instant, EffectHeal(recoveryAmount), lifeStealActivator);
            ApplyEffectToObject(DurationType.Instant, EffectVisualEffect(VisualEffect.Vfx_Imp_Healing_S), lifeStealActivator);

            Enmity.ModifyEnmity(lifeStealActivator, target, recoveryAmount + 6);
            CombatPoint.AddCombatPoint(lifeStealActivator, target, SkillType.Thievery, 2);

            DeleteLocalFloat(target, LifeStealVariableName);
            DeleteLocalObject(target, LifeStealActivatorVariableName);
        }
        private static void Provoke2(AbilityBuilder builder)
        {
            builder.Create(Feat.Provoke2, PerkType.Provoke)
            .Name("Provoke II")
            .HasRecastDelay(RecastGroup.Provoke2, 90f)
            .RequirementStamina(15)
            .UsesActivationType(AbilityActivationType.Casted)
            .HasImpactAction((activator, target, level) =>
            {
                var nth    = 1;
                var nearby = GetNearestCreature(CreatureType.IsAlive, 1, target, nth);
                while (GetIsObjectValid(nearby))
                {
                    if (GetDistanceBetween(target, nearby) > 5.0f)
                    {
                        break;
                    }

                    ApplyEffectToObject(DurationType.Instant, EffectVisualEffect(VisualEffect.Vfx_Imp_Destruction), nearby);
                    Enmity.ModifyEnmity(activator, nearby, 30);

                    nth++;
                    nearby = GetNearestCreature(CreatureType.IsAlive, 1, target, nth);
                }
            });
        }
Exemplo n.º 6
0
        public static void IncreaseEnmityOnBoy()
        {
            var player       = GetLastUsedBy();
            var boy          = GetObjectByTag("ENMITY_TARGET");
            var lastAttacker = GetLastAttacker(player);

            Enmity.ModifyEnmity(boy, lastAttacker, 999);
        }
        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);
        }
 private static void Provoke1(AbilityBuilder builder)
 {
     builder.Create(Feat.Provoke1, PerkType.Provoke)
     .Name("Provoke I")
     .HasRecastDelay(RecastGroup.Provoke1, 30f)
     .RequirementStamina(2)
     .UsesActivationType(AbilityActivationType.Casted)
     .HasImpactAction((activator, target, level) =>
     {
         ApplyEffectToObject(DurationType.Instant, EffectVisualEffect(VisualEffect.Vfx_Imp_Destruction), target);
         Enmity.ModifyEnmity(activator, target, 50);
     });
 }
Exemplo n.º 9
0
        private static void WaspSting3(AbilityBuilder builder)
        {
            builder.Create(Feat.WaspSting3, PerkType.WaspSting)
            .Name("Wasp Sting III")
            .HasRecastDelay(RecastGroup.WaspSting, 60f)
            .RequirementStamina(12)
            .UsesActivationType(AbilityActivationType.Weapon)
            .HasImpactAction((activator, target, level) =>
            {
                ApplyEffectToObject(DurationType.Instant, EffectVisualEffect(VisualEffect.Vfx_Imp_Poison_S), target);
                StatusEffect.Apply(activator, target, StatusEffectType.Poison3, 24f);

                CombatPoint.AddCombatPoint(activator, target, SkillType.Thievery, 3);
                Enmity.ModifyEnmity(activator, target, 20);
            });
        }
Exemplo n.º 10
0
        private static void Blind1(AbilityBuilder builder)
        {
            builder.Create(Feat.Blind1, PerkType.Blind)
            .Name("Blind I")
            .HasRecastDelay(RecastGroup.Blind, 12f)
            .RequirementMP(6)
            .UsesActivationType(AbilityActivationType.Casted)
            .HasActivationDelay(2f)
            .HasImpactAction((activator, target, level) =>
            {
                StatusEffect.Apply(activator, target, StatusEffectType.Blind1, 15f);

                Enmity.ModifyEnmity(activator, target, 4);
                CombatPoint.AddCombatPointToAllTagged(activator, SkillType.RedMagic, 3);
            });
        }
        private static void Shadowstitch2(AbilityBuilder builder)
        {
            builder.Create(Feat.Shadowstitch2, PerkType.Shadowstitch)
            .Name("Shadowstitch II")
            .HasRecastDelay(RecastGroup.Shadowstitch, 60f)
            .RequirementStamina(18)
            .UsesActivationType(AbilityActivationType.Weapon)
            .HasImpactAction((activator, target, level) =>
            {
                var duration = 24f;
                ApplyEffectToObject(DurationType.Temporary, EffectVisualEffect(VisualEffect.Vfx_Dur_Aura_Magenta), target, duration);
                ApplyEffectToObject(DurationType.Temporary, EffectCutsceneImmobilize(), target, duration);

                CombatPoint.AddCombatPoint(activator, target, SkillType.Thievery, 3);
                Enmity.ModifyEnmity(activator, target, 18);
            });
        }
        private static void PiercingStab3(AbilityBuilder builder)
        {
            builder.Create(Feat.PiercingStab3, PerkType.PiercingStab)
            .Name("Piercing Stab III")
            .HasRecastDelay(RecastGroup.PiercingStab, 60f)
            .RequirementStamina(15)
            .UsesActivationType(AbilityActivationType.Weapon)
            .HasImpactAction((activator, target, level) =>
            {
                var duration = CalculateDuration(activator);
                StatusEffect.Apply(activator, target, StatusEffectType.Bleed3, duration);
                ApplyEffectToObject(DurationType.Instant, EffectVisualEffect(VisualEffect.Vfx_Com_Chunk_Red_Small), target);

                CombatPoint.AddCombatPoint(activator, target, SkillType.RedMagic, 2);
                Enmity.ModifyEnmity(activator, target, 14);
            });
        }
Exemplo n.º 13
0
        private static void Dia3(AbilityBuilder builder)
        {
            builder.Create(Feat.Dia3, PerkType.Dia)
            .Name("Dia III")
            .HasRecastDelay(RecastGroup.Dia, 3f)
            .HasActivationDelay(1.0f)
            .RequirementMP(6)
            .UsesActivationType(AbilityActivationType.Casted)
            .DisplaysVisualEffectWhenActivating()
            .HasImpactAction((activator, target, level) =>
            {
                StatusEffect.Apply(activator, target, StatusEffectType.Dia3, 60f);
                ApplyEffectToObject(DurationType.Instant, EffectVisualEffect(VisualEffect.Vfx_Imp_Blind_Deaf_M), target);

                Enmity.ModifyEnmity(activator, target, 10);
                CombatPoint.AddCombatPoint(activator, target, SkillType.WhiteMagic, 3);
            });
        }
Exemplo n.º 14
0
        private static void Blind2(AbilityBuilder builder)
        {
            builder.Create(Feat.Blind2, PerkType.Blind)
            .Name("Blind II")
            .HasRecastDelay(RecastGroup.Blind, 12f)
            .RequirementMP(10)
            .UsesActivationType(AbilityActivationType.Casted)
            .HasActivationDelay(2f)
            .HasImpactAction((activator, target, level) =>
            {
                // Intentional to use Blind I again.
                StatusEffect.Apply(activator, target, StatusEffectType.Blind1, 30f);
                ApplyEffectToObject(DurationType.Instant, EffectVisualEffect(VisualEffect.Vfx_Imp_Dazed_S), target);

                Enmity.ModifyEnmity(activator, target, 6);
                CombatPoint.AddCombatPointToAllTagged(activator, SkillType.RedMagic, 3);
            });
        }
        private static void Jolt3(AbilityBuilder builder)
        {
            builder.Create(Feat.Jolt3, PerkType.Jolt)
            .Name("Jolt III")
            .HasRecastDelay(RecastGroup.Jolt, 4f)
            .RequirementMP(12)
            .UsesActivationType(AbilityActivationType.Casted)
            .HasActivationDelay(2f)
            .HasImpactAction((activator, target, level) =>
            {
                var damage = Random.D10(2);

                ApplyEffectToObject(DurationType.Instant, EffectVisualEffect(VisualEffect.Vfx_Com_Hit_Electrical), target);
                ApplyEffectToObject(DurationType.Instant, EffectDamage(damage), target);

                Enmity.ModifyEnmity(activator, target, damage + 8);
                CombatPoint.AddCombatPoint(activator, target, SkillType.RedMagic, 3);
            });
        }
Exemplo n.º 16
0
        private static void Bash(AbilityBuilder builder)
        {
            builder.Create(Feat.Bash, PerkType.Bash)
            .Name("Bash")
            .HasRecastDelay(RecastGroup.Bash, 12f)
            .RequirementStamina(5)
            .UsesActivationType(AbilityActivationType.Weapon)
            .HasImpactAction((activator, target, level) =>
            {
                var damage = Random.D4(1);
                var length = 1f + GetAbilityModifier(AbilityType.Constitution, activator) * 0.5f;

                ApplyEffectToObject(DurationType.Instant, EffectVisualEffect(VisualEffect.Vfx_Imp_Confusion_S), target);
                ApplyEffectToObject(DurationType.Temporary, EffectStunned(), target, length);
                ApplyEffectToObject(DurationType.Instant, EffectDamage(damage, DamageType.Bludgeoning), target);

                Enmity.ModifyEnmity(activator, target, 4);
                CombatPoint.AddCombatPoint(activator, target, SkillType.Chivalry, 2);
            });
        }
        private static void ApplyBlizzardEffects(uint activator, uint target, int baseDamage, int enmity, float slowLength)
        {
            var multiplier = 1;

            if (StatusEffect.HasStatusEffect(activator, StatusEffectType.ElementalSeal))
            {
                multiplier = 3;
            }

            var damage = baseDamage * multiplier;

            ApplyDamage(activator, target, damage);

            if (slowLength > 0.0f)
            {
                ApplyEffectToObject(DurationType.Temporary, EffectMovementSpeedDecrease(25), target, slowLength);
            }

            CombatPoint.AddCombatPoint(activator, target, SkillType.BlackMagic, 3);
            Enmity.ModifyEnmity(activator, target, enmity);
        }
        private static void SneakAttack2(AbilityBuilder builder)
        {
            builder.Create(Feat.SneakAttack2, PerkType.SneakAttack)
            .Name("Sneak Attack II")
            .HasRecastDelay(RecastGroup.SneakAttack, 60f)
            .RequirementStamina(18)
            .UsesActivationType(AbilityActivationType.Weapon)
            .HasImpactAction((activator, target, level) =>
            {
                var percentIncrease = 0.15f;
                if (IsBehindTarget(activator, target))
                {
                    percentIncrease = 0.50f;
                }

                SetLocalFloat(target, SneakAttackVariableName, percentIncrease);

                CombatPoint.AddCombatPoint(activator, target, SkillType.Thievery, 3);
                Enmity.ModifyEnmity(activator, target, 13);
            });
        }
        private static void ApplyFireEffects(uint activator, uint target, int baseDamage, int enmity, float burnLength)
        {
            var multiplier = 1;

            if (StatusEffect.HasStatusEffect(activator, StatusEffectType.ElementalSeal))
            {
                multiplier = 3;
            }

            var damage = baseDamage * multiplier;

            ApplyDamage(activator, target, damage);

            if (burnLength > 0.0f)
            {
                StatusEffect.Apply(activator, target, StatusEffectType.Burn, burnLength);
            }

            CombatPoint.AddCombatPoint(activator, target, SkillType.BlackMagic, 3);
            Enmity.ModifyEnmity(activator, target, enmity);
        }
Exemplo n.º 20
0
        public static void CreatureAggroEnter()
        {
            var entering = GetEnteringObject();
            var self     = GetAreaOfEffectCreator(OBJECT_SELF);

            if (!GetIsEnemy(entering, self))
            {
                var attackTarget = Enmity.GetHighestEnmityTarget(entering);
                // Non-enemy entered aggro range. If they're the same faction and fighting someone, help them out!
                if (GetFactionEqual(entering, self) &&
                    GetIsEnemy(attackTarget, self))
                {
                    Enmity.ModifyEnmity(attackTarget, self, 1);
                }

                return;
            }

            Enmity.ModifyEnmity(entering, self, 1);

            // All allies within 5m should also aggro the player if they're not already in combat.
            if (_creatureAllies.TryGetValue(self, out var allies))
            {
                foreach (var ally in allies)
                {
                    if (!GetIsEnemy(entering, ally))
                    {
                        continue;
                    }
                    if (GetDistanceBetween(self, ally) > 5f)
                    {
                        continue;
                    }

                    Enmity.ModifyEnmity(entering, ally, 1);
                }
            }
        }
 private static void ApplyStoneEffects(uint activator, uint target, int damage, int enmity)
 {
     ApplyDamage(activator, target, damage);
     CombatPoint.AddCombatPoint(activator, target, SkillType.WhiteMagic, 3);
     Enmity.ModifyEnmity(activator, target, enmity);
 }