Example #1
0
        public async Task OnTargetAsync(ITargetResponse <Mobile> response)
        {
            var magery = Caster.Skills[SkillName.Magery].Value;

            Caster.FireHook(h => h.OnModifyWithMagicEfficiency(Caster, ref magery));

            if (!response.HasValue)
            {
                if (response.InvalidTarget is IDispellable {
                    Dispellable : true
                } item)
                {
                    Effects.SendLocationParticles(
                        EffectItem.Create(item.Location, item.Map, EffectItem.DefaultDuration),
                        0x3729, 9, 20, 5042);
                    Effects.PlaySound(item.Location, Caster.Map, 0x201);

                    if (!Caster.ShilCheckSkill(SkillName.MagicResist, (int)magery, 25))
                    {
                        item.Delete();
                    }
                    else
                    {
                        Caster.SendFailureMessage("You failed to dispel the field.");
                    }
                }
                else
                {
                    Caster.SendLocalizedMessage(1005049); // That cannot be dispelled.
                }

                return;
            }
        public async Task OnTargetAsync(ITargetResponse <IPoint3D> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var point = SpellHelper.GetSurfaceTop(response.Target);

            var range = Caster.Skills[SkillName.Magery].Value / 15.0;

            Caster.FireHook(h => h.OnModifyWithMagicEfficiency(Caster, ref range));

            var eable = Caster.Map.GetMobilesInRange(point, (int)range);

            foreach (var target in eable)
            {
                if (!SpellHelper.ValidIndirectTarget(Caster, target) ||
                    !Caster.CanBeHarmful(target, false) ||
                    !Caster.InLOS(target)
                    )
                {
                    continue;
                }

                var damage = SpellHelper.CalcSpellDamage(Caster, target, this, true);
                target.BoltEffect(0);
                SpellHelper.Damage(damage, target, Caster, this);
            }
            eable.Free();

            Caster.PlaySound(0x29);
        }
Example #3
0
        public async Task OnTargetAsync(ITargetResponse <Mobile> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var mobile = response.Target;

            SpellHelper.Turn(Caster, mobile);
            var healed = Utility.Random(1, 6) + Caster.Skills[SkillName.Magery].Value / 20 + 5;

            Caster.FireHook(h => h.OnModifyWithMagicEfficiency(Caster, ref healed));

            // Cheating here, it's 20 for non-classed and 30 for classed mages
            // But we don't want to tightly couple the spell to the Mage class, it could be Priest etc later
            const int maxHeal = 30;

            if (healed > maxHeal)
            {
                healed = maxHeal;
            }

            mobile.FixedParticles(0x376A, 9, 32, 5005, EffectLayer.Waist);
            mobile.PlaySound(0x1F2);

            if (mobile is BaseCreature {
                CreatureType : CreatureType.Undead
            })
        public async Task OnTargetAsync(ITargetResponse <Mobile> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var target = response.Target;

            SpellHelper.Turn(Caster, target);

            var damage = SpellHelper.CalcSpellDamage(Caster, target, this);

            target.FixedParticles(0x37CC, 30, 30, 5028, EffectLayer.Waist);
            target.PlaySound(0x0107);
            target.PlaySound(0x0108);

            SpellHelper.Damage(damage, target, Caster, this);

            var magery = Caster.Skills[SkillName.Magery].Value / 10;

            // TODO: Check for cursed to amplify magery?

            var kickbackX = Utility.Random((int)magery) - (int)(magery / 2);
            var kickbackY = Utility.Random((int)magery) - (int)(magery / 2);

            var newTargetLocation = new Point3D(target.Location.X + kickbackX, target.Location.Y + kickbackY,
                                                target.Location.Z);
            var map = target.Map;

            if (map.LineOfSight(Caster, newTargetLocation) && map.CanSpawnMobile(newTargetLocation))
            {
                target.Location = newTargetLocation;
            }
        }
Example #5
0
        public async Task OnTargetAsync(ITargetResponse <RecallRune> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var target = response.Target;

            if (!SpellHelper.CheckTravel(Caster, TravelCheckType.Mark))
            {
                // Thy spell doth not appear to work...
                Caster.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 501802, Caster.NetState);
                return;
            }

            if (Caster.GetMulti()?.IsMultiOwner(Caster) == false)
            {
                Caster.SendFailureMessage(1010587); // You are not a co-owner of this house.
                return;
            }

            if (!target.IsChildOf(Caster.Backpack))
            {
                // You must have this rune in your backpack in order to mark it.
                Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1062422);
                return;
            }

            target.Mark(Caster);

            Caster.PlaySound(0x1FA);
            Effects.SendLocationEffect(Caster, 14201, 16);
        }
        public async Task OnTargetAsync(ITargetResponse <IPoint3D> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var point = SpellHelper.GetSurfaceTop(response.Target);

            SpellHelper.Turn(Caster, point);

            Effects.PlaySound(new Point3D(point), Caster.Map, 0x1F6);

            var durationSeconds = Caster.Skills[SkillName.Magery].Value * 3.0;

            Caster.FireHook(h => h.OnModifyWithMagicEfficiency(Caster, ref durationSeconds));
            var duration = TimeSpan.FromSeconds(durationSeconds);

            FieldItem.CreateField(
                (0x58, 0x57),
                point,
                Caster,
                duration,
                TimeSpan.Zero,
                onCreate: item => Effects.SendLocationParticles(item, 0x376A, 9, 10, 5025)
                );
        }
        public async Task OnTargetAsync(ITargetResponse <Mobile> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var target = response.Target;

            if (!Caster.CanBuff(target, true, BuffIcon.Protection, BuffIcon.ArchProtection, BuffIcon.Resilience))
            {
                return;
            }

            target.TryAddBuff(new ArmorBuff
            {
                ArmorMod = (int)(SpellHelper.GetModAmount(Caster, target) / 2.0),
                Duration = SpellHelper.GetDuration(Caster, target),
            });

            SpellHelper.Turn(Caster, target);

            target.FixedParticles(0x373B, 9, 20, 5027, EffectLayer.Waist);
            target.PlaySound(0x1ED);
        }
 /// <summary>
 /// Handles the SelectedIndexChanged event of the ddlTargetStatus control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 protected void cmdStatusChange_OnClick(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(txtSelectedTargetId.Value))
     {
         ICampaignTarget target = EntityFactory.GetRepository <ICampaignTarget>().Get(txtSelectedTargetId.Value);
         if (target != null)
         {
             target.Status = txtNewStatusValue.Value;
             target.Save();
             if (target.Status.Equals(GetLocalResourceObject("Status_Response").ToString()))
             {
                 bool            isLead         = target.TargetType.Equals("Lead");
                 ITargetResponse targetResponse = EntityFactory.Create <ITargetResponse>();
                 targetResponse.CampaignTarget = target;
                 targetResponse.Campaign       = target.Campaign;
                 if (isLead)
                 {
                     targetResponse.Lead = EntityFactory.GetById <ILead>(target.EntityId);
                 }
                 else
                 {
                     targetResponse.Contact = EntityFactory.GetById <IContact>(target.EntityId);
                 }
                 ShowResponseView(targetResponse, isLead);
             }
         }
         txtSelectedTargetId.Value = String.Empty;
         txtNewStatusValue.Value   = String.Empty;
     }
 }
Example #9
0
    /// <summary>
    /// Handles the ClickAction event of the cmdOK control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void cmdOK_ClickAction(object sender, EventArgs e)
    {
        ITargetResponse targetResponse = BindingSource.Current as ITargetResponse;

        // contact must be selected
        if (!IsLead)
        {
            if (lueContact.Text.Trim().Length == 0)
            {
                throw new ValidationException(GetLocalResourceObject("error_NoContact.Text").ToString());
            }
        }
        else
        {
            if (lueLead.Text.Trim().Length == 0)
            {
                throw new ValidationException(GetLocalResourceObject("error_NoLead.Text").ToString());
            }
        }

        AssignCampaignTarget();

        if (targetResponse.CampaignTarget != null && !targetResponse.CampaignTarget.PersistentState.Equals(PersistentState.New))
        {
            targetResponse.CampaignTarget.Save();
        }

        targetResponse.Save();
        RefreshData();
    }
        public async Task OnTargetAsync(ITargetResponse <Mobile> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var target = response.Target;

            SpellHelper.Turn(Caster, target);

            if (!Caster.CanBuff(target, true, BuffIcon.NightSight, BuffIcon.Shadow))
            {
                return;
            }

            target.TryAddBuff(new NightSight
            {
                Value    = LightCycle.DayLevel,
                Duration = TimeSpan.FromSeconds(Caster.Skills.Magery.Value * 60),
            });

            target.FixedParticles(0x376A, 9, 32, 5007, EffectLayer.Waist);
            target.PlaySound(0x1E3);
        }
Example #11
0
        public async Task OnTargetAsync(ITargetResponse <Mobile> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var target = response.Target;

            if (!Caster.CanBuff(target, icons: BuffIcon.Weaken))
            {
                return;
            }

            target.TryAddBuff(new StatBuff(StatType.Str)
            {
                Value    = SpellHelper.GetModAmount(Caster, target, StatType.Str) * -1,
                Duration = SpellHelper.GetDuration(Caster, target),
            });

            SpellHelper.Turn(Caster, target);

            target.Spell?.OnCasterHurt();
            target.Paralyzed = false;

            target.FixedParticles(0x3779, 10, 15, 5009, EffectLayer.Waist);
            target.PlaySound(0x1E6);
        }
        public async Task OnTargetAsync(ITargetResponse <Mobile> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var target = response.Target;

            SpellHelper.Turn(Caster, target);
            var healed = (double)Utility.Dice(6, 8, 30);

            Caster.FireHook(h => h.OnModifyWithMagicEfficiency(Caster, ref healed));

            SpellHelper.Heal((int)healed, target, Caster, this);

            target.FixedParticles(0x376A, 9, 32, 5030, EffectLayer.Waist);
            target.PlaySound(0x202);

            Caster.SendSuccessMessage($"Nature's touch has restored {(int) healed} damage.");

            if (target != Caster)
            {
                target.SendSuccessMessage($"Nature's touch has restored {(int) healed} damage.");
            }
        }
        public async Task OnTargetAsync(ITargetResponse <Mobile> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var target = response.Target;

            SpellHelper.Turn(Caster, target);

            var damage = SpellHelper.CalcSpellDamage(Caster, target, this);

            target.FixedParticles(0x3789, 10, 10, 5028, EffectLayer.Waist);
            target.PlaySound(0x020D);

            SpellHelper.Damage(damage, target, Caster, this);

            if (!Caster.CanBuff(target, true, BuffIcon.Clumsy, BuffIcon.Agility))
            {
                return;
            }

            target.TryAddBuff(new StatBuff(StatType.Dex)
            {
                Value    = SpellHelper.GetModAmount(Caster, target, StatType.Dex) * -1,
                Duration = SpellHelper.GetDuration(Caster, target),
            });
        }
Example #14
0
        public async Task OnTargetAsync(ITargetResponse <IPoint3D> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var target = SpellHelper.GetSurfaceTop(response.Target);

            var range = 4.0;

            Caster.FireHook(h => h.OnModifyWithMagicEfficiency(Caster, ref range));

            var eable = Caster.Map.GetMobilesInRange(target, (int)range);

            foreach (var mobile in eable)
            {
                if (!Caster.CanBuff(mobile, false, BuffIcon.Curse, BuffIcon.Bless))
                {
                    return;
                }

                Caster.DoHarmful(mobile);
                mobile.TryAddBuff(new StatBuff(StatType.All)
                {
                    Value    = SpellHelper.GetModAmount(Caster, mobile, StatType.All) * -1,
                    Duration = SpellHelper.GetDuration(Caster, mobile),
                });

                mobile.FixedParticles(0x374A, 10, 15, 5028, EffectLayer.Waist);
                mobile.PlaySound(0x1FB);
            }
            eable.Free();
        }
 /// <summary>
 /// Shows the response view.
 /// </summary>
 /// <param name="targetResponse">The target response.</param>
 private void ShowResponseView(ITargetResponse targetResponse)
 {
     if (DialogService != null)
     {
         string caption = GetLocalResourceObject("AddResponse_DialogCaption").ToString();
         if (targetResponse != null && targetResponse.Id != null)
         {
             caption = GetLocalResourceObject("EditResponse_DialogCaption").ToString();
         }
         DialogService.SetSpecs(200, 200, 550, 800, "AddEditTargetResponse", caption, true);
         DialogService.EntityType = typeof(ITargetResponse);
         if (targetResponse != null && targetResponse.Id != null)
         {
             DialogService.EntityID = targetResponse.Id.ToString();
         }
         //if the conversion fails or they don't run it.
         if (targetResponse.Lead == null)
         {
             targetResponse.Lead = BindingSource.Current as ILead;
         }
         DialogService.DialogParameters.Add("ResponseDataSource", targetResponse);
         DialogService.DialogParameters.Add("IsLead", true);
         DialogService.ShowDialog();
     }
 }
        public async Task OnTargetAsync(ITargetResponse <Item> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            switch (response.Target)
            {
            case RecallRune rune:
            {
                if (rune.Marked)
                {
                    Effect(rune.Target, rune.TargetMap, true);
                }
                else
                {
                    Caster.SendFailureMessage(501805);     // That rune is not yet marked.
                }
                return;
            }

            case Key key when key.KeyValue != 0 && key.Link is BaseBoat boat:
            {
                if (!boat.Deleted && boat.CheckKey(key.KeyValue))
                {
                    Effect(boat.GetMarkedLocation(), boat.Map, false);
                }
                return;
            }
            }

            Caster.SendFailureMessage(501030); // I can not gate travel from that object.
        }
Example #17
0
        public async Task OnTargetAsync(ITargetResponse <Mobile> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var target = response.Target;

            if (!Caster.CanBuff(target, icons: BuffIcon.Cunning))
            {
                return;
            }

            target.TryAddBuff(new StatBuff(StatType.Int)
            {
                Value    = SpellHelper.GetModAmount(Caster, target, StatType.Int),
                Duration = SpellHelper.GetDuration(Caster, target),
            });

            SpellHelper.Turn(Caster, target);

            target.FixedParticles(0x375A, 10, 15, 5011, EffectLayer.Head);
            target.PlaySound(0x1EB);
        }
Example #18
0
    /// <summary>
    /// Shows the response view.
    /// </summary>
    /// <param name="targetResponse">The target response.</param>
    private void ShowResponseView(ITargetResponse targetResponse)
    {
        if (DialogService != null)
        {
            string caption = GetLocalResourceObject("AddResponse_DialogCaption").ToString();
            if (targetResponse != null && targetResponse.Id != null)
            {
                caption = GetLocalResourceObject("EditResponse_DialogCaption").ToString();
            }
            DialogService.SetSpecs(200, 200, 550, 800, "AddEditTargetResponse", caption, true);
            DialogService.EntityType = typeof(ITargetResponse);
            if (targetResponse != null && targetResponse.Id != null)
            {
                DialogService.EntityID = targetResponse.Id.ToString();
            }
            DialogService.DialogParameters.Add("ResponseDataSource", targetResponse);
            // added account id in the case that a contact is needed for association to an account
            if (EntityContext != null)
            {
                DialogService.DialogParameters.Add("AccountId", EntityContext.EntityID);
            }

            DialogService.ShowDialog();
        }
    }
Example #19
0
    /// <summary>
    /// Loads the campaign stages.
    /// </summary>
    private void LoadCampaignStages()
    {
        lbxStages.Items.Clear();
        lbxStages.Items.Add(string.Empty);
        ITargetResponse targetResponse = BindingSource.Current as ITargetResponse;

        if (targetResponse == null)
        {
            return;
        }
        ICampaign campaign = targetResponse.Campaign;

        if (campaign == null)
        {
            return;
        }
        bool valueFound = false;

        foreach (ICampaignStage stage in campaign.CampaignStages)
        {
            lbxStages.Items.Add(stage.Description);
            if (stage.Description != targetResponse.Stage)
            {
                continue;
            }
            lbxStages.SelectedValue = stage.Description;
            valueFound = true;
        }

        if (!valueFound && !string.IsNullOrEmpty(targetResponse.Stage))
        {
            lbxStages.Items.Add(targetResponse.Stage);
        }
    }
        public async Task OnTargetAsync(ITargetResponse <IPoint3D> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var point = SpellHelper.GetSurfaceTop(response.Target);

            var range = 3.0;

            Caster.FireHook(h => h.OnModifyWithMagicEfficiency(Caster, ref range));

            var eable = Caster.Map.GetMobilesInRange(point, (int)range);

            var targets = eable.Where(target =>
                                      SpellHelper.ValidIndirectTarget(Caster, target) &&
                                      Caster.CanBeHarmful(target, false) &&
                                      Caster.InLOS(target)
                                      ).ToList();

            eable.Free();

            targets.ForEach(DealDamage);
            await Timer.Pause(1000);

            targets.ForEach(DealDamage);
        }
        public async Task OnTargetAsync(ITargetResponse <Mobile> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var target = response.Target;

            if (!Caster.CanBuff(target, icons: BuffIcon.ReactiveArmor))
            {
                return;
            }

            var charges  = Caster.Skills[SkillName.Magery].Value / 15;
            var duration = Caster.Skills[SkillName.Magery].Value / 5;

            Caster.FireHook(h => h.OnModifyWithMagicEfficiency(Caster, ref charges));
            Caster.FireHook(h => h.OnModifyWithMagicEfficiency(Caster, ref duration));

            target.TryAddBuff(new ReactiveArmor
            {
                Value    = (int)charges,
                Duration = TimeSpan.FromSeconds(duration),
            });

            target.FixedParticles(0x376A, 9, 32, 5008, EffectLayer.Waist);
            target.PlaySound(0x1E9);
        }
        public async Task OnTargetAsync(ITargetResponse <TrapableContainer> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var item = response.Target;

            if (item.TrapType != TrapType.None && item.TrapType != TrapType.MagicTrap)
            {
                base.DoFizzle();
                return;
            }

            SpellHelper.Turn(Caster, item);

            var loc = item.GetWorldLocation();

            Effects.SendLocationParticles(EffectItem.Create(loc, item.Map, EffectItem.DefaultDuration), 0x376A, 9,
                                          32, 5015);
            Effects.PlaySound(loc, item.Map, 0x1F0);

            item.TrapType     = TrapType.None;
            item.TrapStrength = 0;
            item.TrapLevel    = 0;
        }
 /// <summary>
 /// Adds the response and target.
 /// </summary>
 private void AddResponseAndTarget()
 {
     if (DialogService != null)
     {
         ITargetResponse targetResponse = EntityFactory.Create <ITargetResponse>();
         ShowResponseView(targetResponse);
     }
 }
    /// <summary>
    /// Handles the RowCommand event of the ContactMarketing control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.Web.UI.WebControls.GridViewCommandEventArgs"/> instance containing the event data.</param>
    protected void ContactMarketing_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        ITargetResponse targetResponse = null;
        string targetId = String.Empty;
        string responseId = String.Empty;
        try
        {
            int rowIndex = Convert.ToInt32(e.CommandArgument);
            targetId = grdContactMarketing.DataKeys[rowIndex].Values[0].ToString();
            responseId = grdContactMarketing.DataKeys[rowIndex].Values[1].ToString();
            if (!string.IsNullOrEmpty(responseId))
                targetResponse = EntityFactory.GetRepository<ITargetResponse>().Get(responseId);
        }
        catch
        {
        }

        switch (e.CommandName.ToUpper())
        {
            case "EDIT":
                if (String.IsNullOrEmpty(targetId))
                {
                    AddResponseAndTarget();
                }
                else
                {
                    if (targetResponse == null)
                    {
                        targetResponse = EntityFactory.Create<ITargetResponse>();
                        ICampaignTarget target = EntityFactory.GetRepository<ICampaignTarget>().Get(targetId);
                        targetResponse.Campaign = target.Campaign;
                        targetResponse.CampaignTarget = target;
                    }
                    ShowResponseView(targetResponse);
                }
                break;
            case "DELETE":
                if (targetResponse != null)
                {
                    ICampaignTarget campaignTarget = targetResponse.CampaignTarget;
                    if (campaignTarget.TargetResponses.Count <= 1)
                        campaignTarget.Status = GetLocalResourceObject("TargetStatus_Removed").ToString();
                    campaignTarget.TargetResponses.Remove(targetResponse);
                    targetResponse.Delete();
                    LoadMarketing();
                }
                else
                {
                    RemoveTargetAssociation(targetId);
                }
                break;
            case "REMOVE":
                RemoveTargetAssociation(targetId);
                break;
            case "SORT":
                break;
        }
    }
Example #25
0
        public async Task OnTargetAsync(ITargetResponse <IPoint3D> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var point = SpellHelper.GetSurfaceTop(response.Target);

            var magery = Caster.Skills[SkillName.Magery].Value;
            var range  = magery / 15.0;

            Caster.FireHook(h => h.OnModifyWithMagicEfficiency(Caster, ref range));

            var eable = Caster.Map.GetMobilesInRange(point, (int)range);

            foreach (var target in eable)
            {
                if (!SpellHelper.ValidIndirectTarget(Caster, target) ||
                    !Caster.CanBeHarmful(target, false) ||
                    !Caster.InLOS(target)
                    )
                {
                    continue;
                }

                target.DoHarmful(target, true);
                (target as IBuffable)?.BuffManager.DispelBuffs();

                if (target is BaseCreature {
                    Summoned: true
                } creature)
                {
                    if (!creature.ShilCheckSkill(SkillName.MagicResist, (int)magery, 50))
                    {
                        // Your summoned creature has been dispelled.
                        (creature.ControlMaster as PlayerMobile)?.SendLocalizedMessage(1153193);
                        creature.Delete();
                    }
                    else
                    {
                        target.PrivateOverheadMessage(
                            MessageType.Regular,
                            ZhConfig.Messaging.FailureHue,
                            1010084,
                            Caster.NetState
                            );
                    }
                }

                Effects.SendLocationParticles(
                    EffectItem.Create(target.Location, target.Map, EffectItem.DefaultDuration),
                    0x3728, 8, 20, 5042
                    );
                Effects.PlaySound(target, 0x201);
            }
            eable.Free();
        }
        public async Task OnTargetAsync(ITargetResponse <Mobile> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var target = response.Target;

            SpellHelper.Turn(Caster, target);

            if (!Caster.CanBuff(target, true, BuffIcon.NightSight, BuffIcon.Shadow))
            {
                return;
            }

            var level = 20.0 + Caster.Skills.Magery.Value / 15.0;

            Caster.FireHook(h => h.OnModifyWithMagicEfficiency(Caster, ref level));
            var duration = SpellHelper.GetDuration(Caster, target).TotalSeconds;

            if (level > 30)
            {
                level = 30;
            }

            var protection = target.GetResist(Info.DamageType);

            if (protection > 0)
            {
                var modifier = 100.0 - protection;
                duration *= modifier / 100;

                if (duration < 1)
                {
                    target.PrivateOverheadMessage(
                        MessageType.Regular,
                        0x3B2,
                        true,
                        "The nature of the target prevents it from being affected by that spell!",
                        Caster.NetState
                        );
                    return;
                }
            }

            target.TryAddBuff(new NightSight
            {
                Title    = "Darkness",
                Icon     = BuffIcon.Shadow,
                Value    = LightCycle.DungeonLevel,
                Duration = TimeSpan.FromSeconds(duration),
            });

            target.FixedParticles(0x373B, 10, 10, 5007, EffectLayer.Waist);
            target.PlaySound(0x1E3);
        }
Example #27
0
        public async Task OnTargetAsync(ITargetResponse <Mobile> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var target = response.Target;

            SpellHelper.Turn(Caster, target);

            if (!Caster.CanSee(target))
            {
                Caster.SendFailureMessage(500237); // Target can not be seen.
                return;
            }

            if (target == Caster)
            {
                Caster.SendFailureMessage(501039); // Thou can not resurrect thyself.
                return;
            }

            if (!Caster.Alive)
            {
                Caster.SendFailureMessage(501040); // The resurrecter must be alive.
                return;
            }

            if (target.Map == null || !target.Map.CanFit(target.Location, 16, false, false))
            {
                Caster.SendFailureMessage(501042); // Target can not be resurrected at that location.
                target.SendFailureMessage(502391); // Thou can not be resurrected there!
                return;
            }

            if (target.Region != null && target.Region.IsPartOf("Khaldun"))
            {
                // The veil of death in this area is too strong and resists thy efforts to restore life.
                Caster.SendFailureMessage(1010395);
                return;
            }

            target.PlaySound(0x214);
            target.FixedEffect(0x376A, 10, 16);

            switch (target)
            {
            case BaseCreature {
                    CreatureType: CreatureType.Undead
            } :
                {
                    // Note: this seems OP? One sots undead if they don't resist it
                    var damage = SpellHelper.TryResist(Caster, target, SpellCircle.Eighth) ? target.Hits / 2 : target.Hits;
                    target.Damage(damage, Caster); // Raw damage
                    return;
                }
        public async Task OnTargetAsync(ITargetResponse <BaseCreature> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var target = response.Target;

            SpellHelper.Turn(Caster, target);

            if (target.ControlMaster != Caster)
            {
                Caster.SendMessage("You can only sacrifice one of yours pets");
                return;
            }

            const int range = 4;
            var       hp    = (double)target.Hits;
            var       loc   = target.Location;

            target.BoltEffect(0);
            target.DeleteCorpseOnDeath = true;
            target.Kill();

            var eable   = Caster.Map.GetMobilesInRange(loc, range);
            var victims = eable.Where(m => m != Caster).ToList();

            eable.Free();

            var damage = hp / victims.Count;

            Caster.FireHook(h => h.OnModifyWithMagicEfficiency(Caster, ref damage));

            if (damage < 1)
            {
                damage = 1;
            }

            foreach (var mobile in victims)
            {
                if (Caster == mobile ||
                    !SpellHelper.ValidIndirectTarget(Caster, mobile) ||
                    !Caster.CanBeHarmful(mobile, false) ||
                    !Caster.InLOS(mobile))
                {
                    continue;
                }

                SpellHelper.Damage((int)(mobile is BaseCreature ? damage : damage / 2), mobile, Caster, this);

                mobile.FixedParticles(0x36B1, 7, 16, 5021, EffectLayer.Waist);
                mobile.PlaySound(0x207);
            }
        }
        public async Task OnTargetAsync(ITargetResponse <IPoint3D> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var point = SpellHelper.GetSurfaceTop(response.Target);

            SpellHelper.Turn(Caster, point);


            Effects.PlaySound(point, Caster.Map, 0x20B);

            var power = 2.0;

            Caster.FireHook(h => h.OnModifyWithMagicEfficiency(Caster, ref power));

            var seconds = Caster.Skills[SkillName.Magery].Value / 5.0 + 20.0;

            Caster.FireHook(h => h.OnModifyWithMagicEfficiency(Caster, ref seconds));
            var duration = TimeSpan.FromSeconds(seconds);

            FieldItem.CreateField(
                (0x3915, 0x3922),
                point,
                Caster,
                duration,
                TimeSpan.FromSeconds(1.0),
                onCreate: item => Effects.SendLocationParticles(item, 0x376A, 9, 10, 5025),
                onTick: item =>
            {
                var eable = item.GetMobilesInRange(0);

                foreach (var m in eable)
                {
                    if (m.Z + 16 > item.Z && item.Z + 12 > m.Z &&
                        SpellHelper.ValidIndirectTarget(Caster, m) &&
                        Caster.CanBeHarmful(m, false)
                        )
                    {
                        TryPoison(Caster, m, power);
                    }
                }

                eable.Free();
            },
                onMoveOver: mobile =>
            {
                TryPoison(Caster, mobile, power);
                return(null);
            }
                );
        }
Example #30
0
    /// <summary>
    /// Handles the Click event of the AddResponse control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.Web.UI.ImageClickEventArgs"/> instance containing the event data.</param>
    protected void AddResponse_Click(object sender, ImageClickEventArgs e)
    {
        ITargetResponse targetResponse = EntityFactory.Create <ITargetResponse>();

        targetResponse.CampaignTarget = EntityFactory.Create <ICampaignTarget>();
        if (BindingSource.Current != null)
        {
            targetResponse.Campaign = BindingSource.Current as ICampaign;
            targetResponse.CampaignTarget.Campaign = targetResponse.Campaign;
        }
        ShowResponseView(targetResponse, false);
    }
 /// <summary>
 /// Shows the response view.
 /// </summary>
 /// <param name="targetResponse">The target response.</param>
 private void ShowResponseView(ITargetResponse targetResponse)
 {
     if (DialogService != null)
     {
         string caption = GetLocalResourceObject("AddTargetResponse_DialogCaption").ToString();
         if (targetResponse != null && targetResponse.Id != null)
         {
             caption = GetLocalResourceObject("EditTargetResponse_DialogCaption").ToString();
         }
         DialogService.SetSpecs(200, 200, 550, 800, "AddEditTargetResponse", caption, true);
         DialogService.EntityType = typeof(ITargetResponse);
         if (targetResponse != null && targetResponse.Id != null)
             DialogService.EntityID = targetResponse.Id.ToString();
         //if the conversion fails or they don't run it.
         if (targetResponse.Contact == null)
             targetResponse.Contact = BindingSource.Current as IContact;
         DialogService.DialogParameters.Add("ResponseDataSource", targetResponse);
         DialogService.ShowDialog();
     }
 }
 /// <summary>
 /// Shows the response view.
 /// </summary>
 /// <param name="targetResponse">The target response.</param>
 /// <param name="isLead">if set to <c>true</c> [is lead].</param>
 private void ShowResponseView(ITargetResponse targetResponse, Boolean isLead)
 {
     if (DialogService != null)
     {
         string caption = GetLocalResourceObject("AddTargetResponse_DialogCaption").ToString();
         if (isLead)
         {
             DialogService.DialogParameters.Add("IsLead", isLead);
         }
         DialogService.SetSpecs(200, 200, 550, 800, "AddEditTargetResponse", caption, true);
         DialogService.EntityType = typeof(ITargetResponse);
         DialogService.DialogParameters.Add("ResponseDataSource", targetResponse);
         DialogService.ShowDialog();
     }
 }
    /// <summary>
    /// Shows the response view.
    /// </summary>
    /// <param name="targetResponse">The target response.</param>
    private void ShowResponseView(ITargetResponse targetResponse)
    {
        if (DialogService != null)
        {
            string caption = GetLocalResourceObject("AddResponse_DialogCaption").ToString();
            if (targetResponse != null && targetResponse.Id != null)
            {
                caption = GetLocalResourceObject("EditResponse_DialogCaption").ToString();
            }
            DialogService.SetSpecs(200, 200, 550, 800, "AddEditTargetResponse", caption, true);
            DialogService.EntityType = typeof(ITargetResponse);
            if (targetResponse != null && targetResponse.Id != null)
                DialogService.EntityID = targetResponse.Id.ToString();
            DialogService.DialogParameters.Add("ResponseDataSource", targetResponse);
            // added account id in the case that a contact is needed for association to an account
            if(EntityContext != null)
                DialogService.DialogParameters.Add("AccountId", EntityContext.EntityID);

            DialogService.ShowDialog();
        }
    }
 /// <summary>
 /// Shows the response view.
 /// </summary>
 /// <param name="targetResponse">The target response.</param>
 private void ShowResponseView(ITargetResponse targetResponse)
 {
     //TODO: Can these dialog calls be placed in the Link Handler?
     if (DialogService != null)
     {
         string caption = GetLocalResourceObject("AddResponse_DialogCaption").ToString();
         DialogService.SetSpecs(200, 200, 550, 800, "AddEditTargetResponse", caption, true);
         DialogService.EntityType = typeof(ITargetResponse);
         if (targetResponse != null && targetResponse.Id != null)
             DialogService.EntityID = targetResponse.Id.ToString();
         DialogService.DialogParameters.Add("ResponseDataSource", targetResponse);
         DialogService.ShowDialog();
     }
 }
    /// <summary>
    /// Shows the response view.
    /// </summary>
    /// <param name="targetResponse">The target response.</param>
    private void ShowResponseView(ITargetResponse targetResponse)
    {
        if (DialogService != null)
        {
            string caption = GetLocalResourceObject("AddTargetResponse_DialogCaption").ToString();
            if (targetResponse != null && targetResponse.Id != null)
            {
                caption = GetLocalResourceObject("EditTargetResponse_DialogCaption").ToString();
            }
            DialogService.SetSpecs(200, 200, 550, 800, "AddEditTargetResponse", caption, true);
            DialogService.EntityType = typeof(ITargetResponse);
            if (targetResponse != null && targetResponse.Id != null)
            {
                DialogService.EntityID = targetResponse.Id.ToString();
                targetResponse.Contact = EntityFactory.GetById<IContact>(targetResponse.CampaignTarget.EntityId);
            }

            DialogService.DialogParameters.Add("ResponseDataSource", targetResponse);
            DialogService.ShowDialog();
        }
    }
 /// <summary>
 /// Shows the response view.
 /// </summary>
 /// <param name="targetResponse">The target response.</param>
 private void ShowResponseView(ITargetResponse targetResponse)
 {
     if (DialogService != null)
     {
         string caption = GetLocalResourceObject("AddResponse_DialogCaption").ToString();
         if (targetResponse != null && targetResponse.Id != null)
         {
             caption = GetLocalResourceObject("EditResponse_DialogCaption").ToString();
         }
         DialogService.SetSpecs(200, 200, 550, 800, "AddEditTargetResponse", caption);
         DialogService.EntityType = typeof(ITargetResponse);
         if (targetResponse != null && targetResponse.Id != null)
             DialogService.EntityID = targetResponse.Id.ToString();
         DialogService.DialogParameters.Add("ResponseDataSource", targetResponse);
         DialogService.ShowDialog();
     }
 }