Exemplo n.º 1
0
        private static void Link(NWCreature self, NWCreature nearby)
        {
            float linkRange = self.GetLocalFloat("LINK_RANGE");

            if (linkRange <= 0.0f)
            {
                linkRange = 12.0f;
            }

            // Check distance. If too far away stop processing.
            if (_.GetDistanceBetween(self, nearby) > linkRange)
            {
                return;
            }

            // Is the nearby object an NPC?
            if (!nearby.IsNPC)
            {
                return;
            }

            // Is the nearby creature dead?
            if (nearby.IsDead)
            {
                return;
            }

            // Is the nearby creature an enemy?
            if (_.GetIsEnemy(nearby, self) == TRUE)
            {
                return;
            }

            // Does the calling creature have the same racial type as the nearby creature?
            if (self.RacialType != nearby.RacialType)
            {
                return;
            }

            // Does the nearby creature have anything on its enmity table?
            var nearbyEnmityTable = EnmityService.GetEnmityTable(nearby).OrderByDescending(x => x.Value).FirstOrDefault();

            if (nearbyEnmityTable.Value == null)
            {
                return;
            }

            var target = nearbyEnmityTable.Value.TargetObject;

            // Is the target dead?
            if (target.IsDead)
            {
                return;
            }

            // Add the target of the nearby creature to this creature's enmity table.
            EnmityService.AdjustEnmity(self, target, 0, 1);
        }
Exemplo n.º 2
0
        public void OnImpact(NWCreature creature, NWObject target, int perkLevel, int spellTier)
        {
            NWCreature npc = (target.Object);
            Effect     vfx = _.EffectVisualEffect(_.VFX_IMP_CHARM);

            _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, vfx, target.Object);

            creature.AssignCommand(() =>
            {
                _.ActionPlayAnimation(_.ANIMATION_FIREFORGET_TAUNT, 1f, 1f);
            });

            EnmityService.AdjustEnmity(npc, creature, 120);
        }
Exemplo n.º 3
0
        public void OnImpact(NWCreature creature, NWObject target, int perkLevel, int spellTier)
        {
            NWCreature npc = (target.Object);
            var        vfx = _.EffectVisualEffect(VisualEffect.Vfx_Imp_Charm);

            _.ApplyEffectToObject(DurationType.Instant, vfx, target.Object);

            creature.AssignCommand(() =>
            {
                _.ActionPlayAnimation(Animation.FireForgetTaunt, 1f, 1f);
            });

            EnmityService.AdjustEnmity(npc, creature, 120);
        }
Exemplo n.º 4
0
        private void RunEffect(NWCreature creature, NWObject target)
        {
            var concentrationEffect = AbilityService.GetActiveConcentrationEffect(target.Object);

            if (concentrationEffect.Type == PerkType.MindShield)
            {
                creature.SendMessage("Your target is immune to tranquilization effects.");
                return;
            }

            AbilityResistanceResult result = CombatService.CalculateAbilityResistance(creature, target.Object, SkillType.ForceAlter, ForceBalanceType.Dark);

            // Tranquilization effect - Daze target(s). Occurs on succeeding the DC check.
            Effect successEffect = EffectDazed();

            successEffect = EffectLinkEffects(successEffect, EffectVisualEffect(VisualEffect.Vfx_Dur_Iounstone_Blue));
            successEffect = TagEffect(successEffect, "TRANQUILIZER_EFFECT");

            // AC & AB decrease effect - Occurs on failing the DC check.
            Effect failureEffect = EffectLinkEffects(EffectAttackDecrease(5), EffectACDecrease(5));



            if (!result.IsResisted)
            {
                creature.AssignCommand(() =>
                {
                    ApplyEffectToObject(DurationType.Temporary, successEffect, target, 6.1f);
                });
            }
            else
            {
                creature.AssignCommand(() =>
                {
                    ApplyEffectToObject(DurationType.Temporary, failureEffect, target, 6.1f);
                });
            }

            if (creature.IsPlayer)
            {
                SkillService.RegisterPCToNPCForSkill(creature.Object, target, SkillType.ForceAlter);
            }

            EnmityService.AdjustEnmity(target.Object, creature, 1);
        }
Exemplo n.º 5
0
        protected void AggroTargetInRange(NWCreature self, NWCreature nearby)
        {
            float aggroRange = GetAggroRange(self);

            // Check distance
            if (GetDistanceBetween(self, nearby) > aggroRange)
            {
                return;
            }

            // Is creature dead?
            if (nearby.IsDead)
            {
                return;
            }

            // Does the nearby creature have line of sight to the creature being attacked?
            if (LineOfSightObject(self, nearby) == FALSE)
            {
                return;
            }

            // Is the nearby creature not an enemy?
            if (GetIsEnemy(nearby, self.Object) == FALSE)
            {
                return;
            }

            // Does the nearby creature have sanctuary?
            if (nearby.HasAnyEffect(EFFECT_TYPE_SANCTUARY))
            {
                return;
            }

            // Success. Increase enmity on the nearby target.
            EnmityService.AdjustEnmity(self, nearby, 0, 1);
        }