Exemple #1
0
        protected void AttackHighestEnmity(NWCreature self)
        {
            var enmityTable = EnmityService.GetEnmityTable(self);
            var target      = enmityTable.Values
                              .OrderByDescending(o => o.TotalAmount)
                              .FirstOrDefault(x => x.TargetObject.IsValid &&
                                              x.TargetObject.Area.Equals(self.Area));
            var currentAttackTarget = GetAttackTarget(self.Object);

            // We have a target and it's not who we're currently attacking. Switch to attacking them.
            if (target != null && currentAttackTarget != target.TargetObject.Object)
            {
                self.AssignCommand(() =>
                {
                    ClearAllActions();
                    ActionAttack(target.TargetObject.Object);
                });
            }
            // We don't have a valid target but we're still attacking someone. We shouldn't be attacking them anymore. Clear all actions.
            else if (target == null && GetCurrentAction(self) == ActionType.AttackObject)
            {
                self.AssignCommand(() =>
                {
                    ClearAllActions();
                });
            }
        }
Exemple #2
0
        private void ApplyEffect(NWCreature creature, NWObject target, int spellTier)
        {
            float radiusSize = _.RADIUS_SIZE_SMALL;

            Effect confusionEffect = _.EffectConfused();

            // Handle effects for differing spellTier values
            switch (spellTier)
            {
            case 1:
                if ((creature.Wisdom > _.GetAbilityModifier(_.ABILITY_WISDOM, target) || creature == target) && _.GetDistanceBetween(creature.Object, target) <= radiusSize)
                {
                    creature.AssignCommand(() =>
                    {
                        _.ApplyEffectToObject(_.DURATION_TYPE_TEMPORARY, confusionEffect, target, 6.1f);
                        // Play VFX
                        _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, _.EffectVisualEffect(_.VFX_IMP_CONFUSION_S), target);
                    });
                    if (creature.IsPlayer)
                    {
                        SkillService.RegisterPCToNPCForSkill(creature.Object, target, SkillType.ForceAlter);
                    }
                }
                break;

            case 2:
                NWCreature targetCreature = _.GetFirstObjectInShape(_.SHAPE_SPHERE, radiusSize, creature.Location, 1, _.OBJECT_TYPE_CREATURE);
                while (targetCreature.IsValid)
                {
                    if (targetCreature.RacialType == (int)CustomRaceType.Robot || _.GetIsReactionTypeHostile(targetCreature, creature) == 0)
                    {
                        // Do nothing against droids or non-hostile creatures, skip object
                        targetCreature = _.GetNextObjectInShape(_.SHAPE_SPHERE, radiusSize, creature.Location, 1, _.OBJECT_TYPE_CREATURE);
                        continue;
                    }

                    if (creature.Wisdom > targetCreature.Wisdom)
                    {
                        var targetCreatureCopy = targetCreature;     // Closure can modify the iteration variable so we copy it first.
                        creature.AssignCommand(() =>
                        {
                            _.ApplyEffectToObject(_.DURATION_TYPE_TEMPORARY, confusionEffect, targetCreatureCopy, 6.1f);
                            // Play VFX
                            _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, _.EffectVisualEffect(_.VFX_IMP_CONFUSION_S), targetCreatureCopy);
                        });

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

                    targetCreature = _.GetNextObjectInShape(_.SHAPE_SPHERE, radiusSize, creature.Location, 1, _.OBJECT_TYPE_CREATURE);
                }
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(spellTier));
            }
        }
Exemple #3
0
        protected void EquipBestWeapon(NWCreature self)
        {
            if (!self.IsInCombat)
            {
                return;
            }

            if (!self.IsInCombat ||
                self.RightHand.IsRanged)
            {
                return;
            }

            if (self.RightHand.IsRanged)
            {
                self.AssignCommand(() =>
                {
                    ActionEquipMostDamagingRanged(new Object());
                });
            }
            else
            {
                self.AssignCommand(() =>
                {
                    ActionEquipMostDamagingMelee(new Object());
                });
            }
        }
Exemple #4
0
        private void ApplyEffect(NWCreature creature, NWObject target, int spellTier)
        {
            Effect effectMindShield;

            // Handle effects for differing spellTier values
            switch (spellTier)
            {
            case 1:
                effectMindShield = _.EffectImmunity(ImmunityType.Dazed);

                creature.AssignCommand(() =>
                {
                    _.ApplyEffectToObject(DurationType.Temporary, effectMindShield, target, 6.1f);
                });
                break;

            case 2:
                effectMindShield = _.EffectImmunity(ImmunityType.Dazed);
                effectMindShield = _.EffectLinkEffects(effectMindShield, _.EffectImmunity(ImmunityType.Confused));
                effectMindShield = _.EffectLinkEffects(effectMindShield, _.EffectImmunity(ImmunityType.Dominate));     // Force Pursuade is DOMINATION effect

                creature.AssignCommand(() =>
                {
                    _.ApplyEffectToObject(DurationType.Temporary, effectMindShield, target, 6.1f);
                });
                break;

            case 3:
                effectMindShield = _.EffectImmunity(ImmunityType.Dazed);
                effectMindShield = _.EffectLinkEffects(effectMindShield, _.EffectImmunity(ImmunityType.Confused));
                effectMindShield = _.EffectLinkEffects(effectMindShield, _.EffectImmunity(ImmunityType.Dominate));     // Force Pursuade is DOMINATION effect

                if (target.GetLocalInt("FORCE_DRAIN_IMMUNITY") == 1)
                {
                    creature.SetLocalInt("FORCE_DRAIN_IMMUNITY", 0);
                }
                creature.DelayAssignCommand(() =>
                {
                    creature.DeleteLocalInt("FORCE_DRAIN_IMMUNITY");
                }, 6.1f);

                creature.AssignCommand(() =>
                {
                    _.ApplyEffectToObject(DurationType.Temporary, effectMindShield, target, 6.1f);
                });
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(spellTier));
            }

            // Play VFX
            _.ApplyEffectToObject(DurationType.Instant, _.EffectVisualEffect(VisualEffect.Dur_Mind_Affecting_Positive), target);

            if (creature.IsPlayer)
            {
                SkillService.RegisterPCToAllCombatTargetsForSkill(creature.Object, SkillType.ForceControl, null);
            }
        }
Exemple #5
0
        private void ApplyEffect(NWCreature creature, NWObject target, int spellTier)
        {
            Effect effectMindShield;

            // Handle effects for differing spellTier values
            switch (spellTier)
            {
            case 1:
                effectMindShield = _.EffectImmunity(IMMUNITY_TYPE_DAZED);

                creature.AssignCommand(() =>
                {
                    _.ApplyEffectToObject(_.DURATION_TYPE_TEMPORARY, effectMindShield, target, 6.1f);
                });
                break;

            case 2:
                effectMindShield = _.EffectImmunity(IMMUNITY_TYPE_DAZED);
                effectMindShield = _.EffectLinkEffects(effectMindShield, _.EffectImmunity(IMMUNITY_TYPE_CONFUSED));
                effectMindShield = _.EffectLinkEffects(effectMindShield, _.EffectImmunity(IMMUNITY_TYPE_DOMINATE));     // Force Pursuade is DOMINATION effect

                creature.AssignCommand(() =>
                {
                    _.ApplyEffectToObject(_.DURATION_TYPE_TEMPORARY, effectMindShield, target, 6.1f);
                });
                break;

            case 3:
                effectMindShield = _.EffectImmunity(IMMUNITY_TYPE_DAZED);
                effectMindShield = _.EffectLinkEffects(effectMindShield, _.EffectImmunity(IMMUNITY_TYPE_CONFUSED));
                effectMindShield = _.EffectLinkEffects(effectMindShield, _.EffectImmunity(IMMUNITY_TYPE_DOMINATE));     // Force Pursuade is DOMINATION effect

                if (target.GetLocalInt("FORCE_DRAIN_IMMUNITY") == 1)
                {
                    creature.SetLocalInt("FORCE_DRAIN_IMMUNITY", 0);
                }
                creature.DelayAssignCommand(() =>
                {
                    creature.DeleteLocalInt("FORCE_DRAIN_IMMUNITY");
                }, 6.1f);

                creature.AssignCommand(() =>
                {
                    _.ApplyEffectToObject(_.DURATION_TYPE_TEMPORARY, effectMindShield, target, 6.1f);
                });
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(spellTier));
            }

            // Play VFX
            _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, _.EffectVisualEffect(_.VFX_DUR_MIND_AFFECTING_POSITIVE), target);
        }
Exemple #6
0
        public void Tick(NWCreature oCaster, NWObject oTarget, int currentTick, int effectiveLevel, string data)
        {
            if (currentTick % 2 == 0)
            {
                return;
            }

            Location    location = oTarget.Location;
            NWPlaceable oBlood   = (_.CreateObject(ObjectType.Placeable, "plc_bloodstain", location));

            oBlood.Destroy(48.0f);

            int amount = 1;

            if (!string.IsNullOrWhiteSpace(data))
            {
                amount = Convert.ToInt32(data);
            }

            oTarget.SetLocalInt(AbilityService.LAST_ATTACK + oCaster.GlobalID, AbilityService.ATTACK_DOT);

            oCaster.AssignCommand(() =>
            {
                Effect damage = _.EffectDamage(amount);
                _.ApplyEffectToObject(DurationType.Instant, damage, oTarget.Object);
            });
        }
        public bool Run(object[] args)
        {
            NWCreature self        = (NWCreature)args[0];
            var        enmityTable = _enmity.GetEnmityTable(self);
            var        target      = enmityTable.Values
                                     .OrderByDescending(o => o.TotalAmount)
                                     .FirstOrDefault(x => x.TargetObject.IsValid &&
                                                     x.TargetObject.Area.Equals(self.Area));

            self.AssignCommand(() =>
            {
                if (target == null)
                {
                    _.ClearAllActions();
                }
                else
                {
                    if (_.GetAttackTarget(self.Object) != target.TargetObject.Object)
                    {
                        _.ClearAllActions();
                        _.ActionAttack(target.TargetObject.Object);
                    }
                }
            });

            return(true);
        }
Exemple #8
0
        public void Main()
        {
            NWCreature looter = _.GetLastDisturbed();
            NWItem     item   = _.GetInventoryDisturbItem();
            var        type   = _.GetInventoryDisturbType();

            looter.AssignCommand(() =>
            {
                _.ActionPlayAnimation(Animation.LoopingGetLow, 1.0f, 1.0f);
            });

            if (type == DisturbType.Added)
            {
                ItemService.ReturnItem(looter, item);
                looter.SendMessage("You cannot place items inside of corpses.");
            }
            else if (type == DisturbType.Removed)
            {
                NWItem copy = item.GetLocalObject("CORPSE_ITEM_COPY");

                if (copy.IsValid)
                {
                    copy.Destroy();
                }

                item.DeleteLocalObject("CORPSE_ITEM_COPY");
            }
        }
Exemple #9
0
        public void Main()
        {
            NWCreature looter = _.GetLastDisturbed();
            NWItem     item   = _.GetInventoryDisturbItem();
            int        type   = _.GetInventoryDisturbType();

            looter.AssignCommand(() =>
            {
                _.ActionPlayAnimation(_.ANIMATION_LOOPING_GET_LOW, 1.0f, 1.0f);
            });

            if (type == _.INVENTORY_DISTURB_TYPE_ADDED)
            {
                ItemService.ReturnItem(looter, item);
                looter.SendMessage("You cannot place items inside of corpses.");
            }
            else if (type == _.INVENTORY_DISTURB_TYPE_REMOVED)
            {
                NWItem copy = item.GetLocalObject("CORPSE_ITEM_COPY");

                if (copy.IsValid)
                {
                    copy.Destroy();
                }

                item.DeleteLocalObject("CORPSE_ITEM_COPY");
            }
        }
        public void Tick(NWCreature oCaster, NWObject oTarget, int currentTick, int effectiveLevel, string data)
        {
            int damage = 0;

            switch (effectiveLevel)
            {
            case 2:
            case 3:
            case 4:
                damage = 1;
                break;

            case 5:
            case 6:
            case 7:
                damage = 2;
                break;

            case 8:
            case 9:
            case 10:
            case 11:
                damage = 4;
                break;
            }

            oCaster.AssignCommand(() =>
            {
                Effect effect = _.EffectDamage(damage, DAMAGE_TYPE_SONIC);
                _.ApplyEffectToObject(DURATION_TYPE_INSTANT, effect, oTarget);
            });
        }
        public BehaviourTreeBuilder Build(BehaviourTreeBuilder builder, params object[] args)
        {
            NWCreature self = (NWCreature)args[0];

            return(builder.Do("RandomWalk", t =>
            {
                if (self.IsInCombat || !_enmity.IsEnmityTableEmpty(self))
                {
                    if (_.GetCurrentAction(self.Object) == NWScript.ACTION_RANDOMWALK)
                    {
                        self.ClearAllActions();
                    }

                    return BehaviourTreeStatus.Failure;
                }

                if (_.GetCurrentAction(self.Object) == NWScript.ACTION_INVALID &&
                    _.IsInConversation(self.Object) == NWScript.FALSE &&
                    _.GetCurrentAction(self.Object) != NWScript.ACTION_RANDOMWALK &&
                    _random.Random(100) <= 25)
                {
                    self.AssignCommand(() => _.ActionRandomWalk());
                }
                return BehaviourTreeStatus.Running;
            }));
        }
Exemple #12
0
        public void Tick(NWCreature oCaster, NWObject oTarget, int currentTick, int effectiveLevel, string data)
        {
            if (currentTick % 2 == 0)
            {
                return;
            }

            Location    location = oTarget.Location;
            NWPlaceable oBlood   = (_.CreateObject(NWScript.OBJECT_TYPE_PLACEABLE, "plc_bloodstain", location));

            oBlood.Destroy(48.0f);

            int amount = 1;

            if (!string.IsNullOrWhiteSpace(data))
            {
                amount = Convert.ToInt32(data);
            }

            oCaster.AssignCommand(() =>
            {
                Effect damage = _.EffectDamage(amount);
                _.ApplyEffectToObject(NWScript.DURATION_TYPE_INSTANT, damage, oTarget.Object);
            });
        }
Exemple #13
0
        public BehaviourTreeBuilder Build(BehaviourTreeBuilder builder, params object[] args)
        {
            NWCreature self = (NWCreature)args[0];

            return(builder.Do("AttackHighestEnmity", t =>
            {
                var enmityTable = _enmity.GetEnmityTable(self);

                var target = enmityTable.Values
                             .OrderByDescending(o => o.TotalAmount)
                             .FirstOrDefault(x => x.TargetObject.IsValid &&
                                             x.TargetObject.Area.Equals(self.Area));

                self.AssignCommand(() =>
                {
                    if (target == null)
                    {
                        _.ClearAllActions();
                    }
                    else
                    {
                        if (_.GetAttackTarget(self.Object) != target.TargetObject.Object)
                        {
                            _.ClearAllActions();
                            _.ActionAttack(target.TargetObject.Object);
                        }
                    }
                });

                return BehaviourTreeStatus.Running;
            }));
        }
Exemple #14
0
        public void OnConcentrationTick(NWCreature creature, NWObject target, int spellTier, int tick)
        {
            int amount;

            switch (spellTier)
            {
            case 1:
                amount = 5;
                break;

            case 2:
                amount = 6;
                break;

            case 3:
                amount = 7;
                break;

            case 4:
                amount = 8;
                break;

            case 5:
                amount = 10;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(spellTier));
            }

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

            // +/- percent change based on resistance
            float delta = 0.01f * result.Delta;

            amount = amount + (int)(amount * delta);

            if (target.GetLocalInt("FORCE_DRAIN_IMMUNITY") == 1)
            {
                amount = 0;
            }

            creature.AssignCommand(() =>
            {
                _.ApplyEffectToObject(DurationType.Instant, _.EffectDamage(amount, DamageType.Negative), target);
            });

            // Only apply a heal if caster is not at max HP. Otherwise they'll get unnecessary spam.
            if (creature.CurrentHP < creature.MaxHP)
            {
                _.ApplyEffectToObject(DurationType.Instant, _.EffectHeal(amount), creature);
            }

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

            _.ApplyEffectToObject(DurationType.Instant, _.EffectVisualEffect(VisualEffect.Vfx_Com_Hit_Negative), target);
        }
Exemple #15
0
        public void OnImpact(NWCreature creature, NWObject target, int perkLevel, int spellTier)
        {
            int damage;
            int intMod = creature.IntelligenceModifier;

            switch (spellTier)
            {
            case 1:
                damage = 10 + intMod;
                break;

            case 2:
                damage = 15 + intMod;
                break;

            case 3:
                damage = 20 + ((intMod * 15) / 10);
                break;

            case 4:
                damage = 25 + ((intMod * 17) / 10);
                break;

            case 5:
                damage = 30 + (intMod * 2);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(spellTier));
            }

            var result = CombatService.CalculateAbilityResistance(creature, target.Object, SkillType.ForceAlter, ForceBalanceType.Universal, true);

            // +/- percent change based on resistance
            float delta = 0.01f * result.Delta;

            damage = damage + (int)(damage * delta);
            var targetLocation = _.GetLocation(creature);
            var delay          = _.GetDistanceBetweenLocations(creature.Location, targetLocation) / 18.0f + 0.35f;

            creature.AssignCommand(() =>
            {
                _.PlaySound("plr_force_blast");
                DoFireball(target);
            });

            creature.DelayAssignCommand(() =>
            {
                _.ApplyEffectToObject(DurationType.Instant, _.EffectDamage(damage), target);
                _.ApplyEffectToObject(DurationType.Instant, _.EffectVisualEffect(VisualEffect.Vfx_Imp_Silence), target);
                _.ApplyEffectToObject(DurationType.Instant, _.EffectVisualEffect(VisualEffect.VFX_IMP_KIN_L), target);
            }, delay);


            if (creature.IsPlayer)
            {
                SkillService.RegisterPCToNPCForSkill(creature.Object, target, SkillType.ForceAlter);
            }
        }
Exemple #16
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);
        }
Exemple #17
0
        public void OnImpact(NWCreature creature, NWObject target, int perkLevel, int spellTier)
        {
            int damage;
            int mod = creature.WisdomModifier;

            switch (spellTier)
            {
            case 1:
                damage = 5 + mod;
                break;

            case 2:
                damage = 10 + ((mod * 125) / 100);
                break;

            case 3:
                damage = 10 + ((mod * 15) / 10);
                break;

            case 4:
                damage = 15 + ((mod * 175) / 100);
                break;

            case 5:
                damage = 15 + (mod * 2);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(spellTier));
            }

            var result = CombatService.CalculateAbilityResistance(creature, target.Object, SkillType.ForceAlter, ForceBalanceType.Universal, true);

            // +/- percent change based on resistance
            var delta = 0.01f * result.Delta;

            damage = damage + (int)(damage * delta);
            var targetLocation = _.GetLocation(creature);
            var delay          = _.GetDistanceBetweenLocations(creature.Location, targetLocation) / 18.0f + 0.35f;

            creature.AssignCommand(() =>
            {
                DoRock(target);
                _.PlaySound("plr_force_throw");
            });

            creature.DelayAssignCommand(() =>
            {
                _.ApplyEffectToObject(DurationType.Instant, _.EffectDamage(damage, DamageType.Bludgeoning), target);
                _.ApplyEffectToObject(DurationType.Instant, _.EffectVisualEffect(VisualEffect.Vfx_Imp_Dust_Explosion), target);
            }, delay);

            if (creature.IsPlayer)
            {
                SkillService.RegisterPCToNPCForSkill(creature.Object, target, SkillType.ForceAlter);
            }
        }
Exemple #18
0
 public void Tick(NWCreature oCaster, NWObject oTarget, int currentTick, int effectiveLevel, string data)
 {
     if (currentTick % 2 != 0) return;
     int damage = _random.D4(1);
     oCaster.AssignCommand(() =>
     {
         _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectDamage(damage, DAMAGE_TYPE_FIRE), oTarget);
     });
 }
Exemple #19
0
        private static void ProcessPerkFeats(NWCreature self)
        {
            // Bail early if any of the following is true:
            //      - Creature has a weapon skill queued.
            //      - Creature does not have a PerkFeat cache.
            //      - There are no perk feats in the cache.
            //      - Creature has no target.

            if (self.GetLocalInt("ACTIVE_WEAPON_SKILL") > 0)
            {
                return;
            }
            if (!self.Data.ContainsKey("PERK_FEATS"))
            {
                return;
            }

            Dictionary <int, AIPerkDetails> cache = self.Data["PERK_FEATS"];

            if (cache.Count <= 0)
            {
                return;
            }

            NWObject target = _.GetAttackTarget(self);

            if (!target.IsValid)
            {
                return;
            }

            // Pull back whatever concentration effect is currently active, if any.
            var concentration = AbilityService.GetActiveConcentrationEffect(self);

            // Exclude any concentration effects, if necessary, then randomize potential feats to use.
            var randomizedFeatIDs = concentration.Type == PerkType.Unknown
                ? cache.Values                                                                        // No concentration exclusions
                : cache.Values.Where(x => x.ExecutionType != PerkExecutionType.ConcentrationAbility); // Exclude concentration abilities

            randomizedFeatIDs = randomizedFeatIDs.OrderBy(o => RandomService.Random());

            foreach (var perkDetails in randomizedFeatIDs)
            {
                // Move to next feat if this creature cannot use this one.
                if (!AbilityService.CanUsePerkFeat(self, target, perkDetails.FeatID))
                {
                    continue;
                }

                self.AssignCommand(() =>
                {
                    _.ActionUseFeat(perkDetails.FeatID, target);
                });

                break;
            }
        }
Exemple #20
0
        public void Tick(NWCreature oCaster, NWObject oTarget, int currentTick, int effectiveLevel, string data)
        {
            int damage = Convert.ToInt32(data);

            oCaster.AssignCommand(() =>
            {
                Effect effect = _.EffectDamage(damage, DAMAGE_TYPE_ELECTRICAL);
                _.ApplyEffectToObject(DURATION_TYPE_INSTANT, effect, oTarget);
            });
        }
Exemple #21
0
        public void Tick(NWCreature oCaster, NWObject oTarget, int currentTick, int effectiveLevel, string data)
        {
            Random random = new Random();
            int    amount = random.Next(3, 7);

            oCaster.AssignCommand(() =>
            {
                Effect damage = _.EffectDamage(amount);
                _.ApplyEffectToObject(NWScript.DURATION_TYPE_INSTANT, damage, oTarget.Object);
            });

            Effect decreaseAC = _.EffectACDecrease(2);

            oCaster.AssignCommand(() =>
            {
                _.ApplyEffectToObject(NWScript.DURATION_TYPE_TEMPORARY, decreaseAC, oTarget.Object, 1.0f);
            });

            _.ApplyEffectToObject(NWScript.DURATION_TYPE_INSTANT, _.EffectVisualEffect(NWScript.VFX_IMP_ACID_S), oTarget.Object);
        }
        public void Tick(NWCreature oCaster, NWObject oTarget)
        {
            Random random = new Random();
            int    amount = random.Next(3, 7);

            oCaster.AssignCommand(() =>
            {
                Effect damage = _.EffectDamage(amount);
                _.ApplyEffectToObject(DURATION_TYPE_INSTANT, damage, oTarget.Object);
            });

            Effect decreaseAC = _.EffectACDecrease(2);

            oCaster.AssignCommand(() =>
            {
                _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, decreaseAC, oTarget.Object, 6.1f);
            });

            _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectVisualEffect(VFX_IMP_ACID_S), oTarget.Object);
        }
Exemple #23
0
        public void Tick(NWCreature oCaster, NWObject oTarget, int currentTick, int effectiveLevel, string data)
        {
            int damage = Convert.ToInt32(data);

            oTarget.SetLocalInt(AbilityService.LAST_ATTACK + oCaster.GlobalID, AbilityService.ATTACK_DOT);

            oCaster.AssignCommand(() =>
            {
                Effect effect = _.EffectDamage(damage, DAMAGE_TYPE_ELECTRICAL);
                _.ApplyEffectToObject(DURATION_TYPE_INSTANT, effect, oTarget);
            });
        }
Exemple #24
0
        public void Tick(NWCreature oCaster, NWObject oTarget, int currentTick, int effectiveLevel, string data)
        {
            if (currentTick % 2 != 0) return;
            int damage = RandomService.D4(1);
            oTarget.SetLocalInt(AbilityService.LAST_ATTACK + oCaster.GlobalID, AbilityService.ATTACK_DOT);

            oCaster.AssignCommand(() =>
            {
                _.ApplyEffectToObject(DurationType.Instant, _.EffectDamage(damage, DamageType.Divine), oTarget);
            });
            
        }
Exemple #25
0
        public void Tick(NWCreature oCaster, NWObject oTarget, int currentTick, int effectiveLevel, string data)
        {
            int damage = Convert.ToInt32(data);

            oTarget.SetLocalInt(AbilityService.LAST_ATTACK + oCaster.GlobalID, AbilityService.ATTACK_DOT);

            oCaster.AssignCommand(() =>
            {
                Effect effect = _.EffectDamage(damage, DamageType.Electrical);
                _.ApplyEffectToObject(DurationType.Instant, effect, oTarget);
            });
        }
Exemple #26
0
        public void OnConcentrationTick(NWCreature creature, NWObject target, int spellTier, int tick)
        {
            int amount;
            int mod = ((creature.WisdomModifier + creature.IntelligenceModifier) / 2);

            switch (spellTier)
            {
            case 1:
                amount = 2 + mod;
                break;

            case 2:
                amount = 3 + mod;
                break;

            case 3:
                amount = 4 + mod;
                break;

            case 4:
                amount = 5 + mod;
                break;

            case 5:
                amount = 6 + mod;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(spellTier));
            }

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

            // +/- percent change based on resistance
            float delta = 0.01f * result.Delta;

            amount = amount + (int)(amount * delta);


            creature.AssignCommand(() =>
            {
                _.ApplyEffectToObject(DurationType.Instant, _.EffectDamage(amount, DamageType.Bludgeoning), target);
            });

            if (creature.IsPlayer)
            {
                SkillService.RegisterPCToNPCForSkill(creature.Object, target, SkillType.ForceAlter);
            }
            _.PlaySound("plr_force_choke");
            _.ApplyEffectToObject(DurationType.Temporary, _.EffectVisualEffect(VisualEffect.Vfx_Fnf_Demon_Hand), target, 6.1f);
            _.ApplyEffectToObject(DurationType.Temporary, _.EffectVisualEffect(VisualEffect.Vfx_Imp_Starburst_Red), target, 6.1f);
        }
Exemple #27
0
        public void Tick(NWCreature oCaster, NWObject oTarget, int currentTick, int effectiveLevel, string data)
        {
            Random random = new Random();
            int    amount = random.Next(3, 7);

            oTarget.SetLocalInt(AbilityService.LAST_ATTACK + oCaster.GlobalID, AbilityService.ATTACK_DOT);

            oCaster.AssignCommand(() =>
            {
                Effect damage = _.EffectDamage(amount);
                _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, damage, oTarget.Object);
            });

            Effect decreaseAC = _.EffectACDecrease(2);

            oCaster.AssignCommand(() =>
            {
                _.ApplyEffectToObject(_.DURATION_TYPE_TEMPORARY, decreaseAC, oTarget.Object, 1.0f);
            });

            _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, _.EffectVisualEffect(_.VFX_IMP_ACID_S), oTarget.Object);
        }
Exemple #28
0
        public void Tick(NWCreature oCaster, NWObject oTarget, int currentTick, int effectiveLevel, string data)
        {
            Random random = new Random();
            int    amount = random.Next(3, 7);

            oTarget.SetLocalInt(AbilityService.LAST_ATTACK + oCaster.GlobalID, AbilityService.ATTACK_DOT);

            oCaster.AssignCommand(() =>
            {
                Effect damage = _.EffectDamage(amount);
                _.ApplyEffectToObject(DurationType.Instant, damage, oTarget.Object);
            });

            Effect decreaseAC = _.EffectACDecrease(2);

            oCaster.AssignCommand(() =>
            {
                _.ApplyEffectToObject(DurationType.Temporary, decreaseAC, oTarget.Object, 1.0f);
            });

            _.ApplyEffectToObject(DurationType.Instant, _.EffectVisualEffect(VisualEffect.Vfx_Imp_Acid_S), oTarget.Object);
        }
Exemple #29
0
        public void Tick(NWCreature oCaster, NWObject oTarget, int currentTick, int effectiveLevel, string data)
        {
            if (currentTick % 2 != 0)
            {
                return;
            }
            int damage = RandomService.D4(1);

            oCaster.AssignCommand(() =>
            {
                _.ApplyEffectToObject(DurationType.Instant, _.EffectDamage(damage, DamageType.Cold), oTarget);
            });
        }
Exemple #30
0
        public void Tick(NWCreature oCaster, NWObject oTarget)
        {
            Location    location = oTarget.Location;
            NWPlaceable oBlood   = NWPlaceable.Wrap(_.CreateObject(OBJECT_TYPE_PLACEABLE, "plc_bloodstain", location));

            oBlood.Destroy(48.0f);

            oCaster.AssignCommand(() =>
            {
                Effect damage = _.EffectDamage(1);
                _.ApplyEffectToObject(DURATION_TYPE_INSTANT, damage, oTarget.Object);
            });
        }