コード例 #1
0
ファイル: EnhanctedBandage.cs プロジェクト: Evad-lab/ServUOX
            private void EndHeal()
            {
                if (Context.ContainsKey(Healer))
                    Context.Remove(Healer);

                if (Patient != Healer && Patient.InRange(Healer.Location, 2))
                {
                    Healer.PlaySound(0x57);

                    if (EnchantedApple.GetTotalCurses(Patient) == 0)
                        Healer.SendLocalizedMessage(500968); // You apply the bandages, but they barely help.
                    else
                        Healer.SendLocalizedMessage(500969); // You finish applying the bandages.

                    EvilOmenSpell.TryEndEffect(Patient);
                    StrangleSpell.RemoveCurse(Patient);
                    CorpseSkinSpell.RemoveCurse(Patient);
                    WeakenSpell.RemoveEffects(Patient);
                    FeeblemindSpell.RemoveEffects(Patient);
                    ClumsySpell.RemoveEffects(Patient);
                    CurseSpell.RemoveEffect(Patient);
                    MortalStrike.EndWound(Patient);
                    BloodOathSpell.RemoveCurse(Patient);
                    MindRotSpell.ClearMindRotScalar(Patient);
                    SpellPlagueSpell.RemoveFromList(Patient);
                    SleepSpell.EndSleep(Patient);

                    BuffInfo.RemoveBuff(Patient, BuffIcon.MassCurse);
                }
                else
                {
                    Healer.SendLocalizedMessage(500295); // You are too far away to do that.
                }
            }
コード例 #2
0
        public override void OnDoubleClick(Mobile from)
        {
            if (from.InRange(GetWorldLocation(), 2))
            {
                if (FactionEquipment.CanUse(this, from))
                {
                    from.RevealingAction();

                    from.SendLocalizedMessage(500948); // Who will you use the bandages on?

                    from.BeginTarget(-1, false, Server.Targeting.TargetFlags.Beneficial, (healer, targeted) =>
                    {
                        Mobile patient = targeted as Mobile;

                        if (patient != null)
                        {
                            if (EnchantedApple.GetTotalCurses(patient) == 0)
                            {
                                healer.SendLocalizedMessage(500955);     // That being is not damaged!
                            }
                            else if (!Deleted && healer.CanBeBeneficial(patient, true, true))
                            {
                                healer.DoBeneficial(patient);

                                bool onSelf = (healer == patient);
                                int dex     = healer.Dex;

                                double seconds;
                                double resDelay = (patient.Alive ? 0.0 : 5.0);

                                if (onSelf)
                                {
                                    seconds = 9.4 + (0.6 * ((double)(120 - dex) / 10));
                                }
                                else
                                {
                                    seconds = Math.Ceiling((double)4 - healer.Dex / 60);
                                    seconds = Math.Max(seconds, 2);
                                }

                                if (Context.ContainsKey(healer))
                                {
                                    Context[healer].Stop();
                                }

                                Context[healer] = new InternalTimer(this, patient, healer, seconds);

                                if (!onSelf)
                                {
                                    patient.SendLocalizedMessage(1008078, false, healer.Name);     //  : Attempting to heal you.
                                }

                                healer.SendLocalizedMessage(500956);     // You begin applying the bandages.

                                if (healer.NetState != null && healer.NetState.IsEnhancedClient)
                                {
                                    healer.NetState.Send(new BandageTimerPacket((int)(seconds)));
                                }

                                Consume();
                            }
                        }
                    });
                }
            }
            else
            {
                from.SendLocalizedMessage(500295); // You are too far away to do that.
            }
        }
コード例 #3
0
        public void Target(Mobile targeted)
        {
            if (!Caster.CanSee(targeted))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (CheckBSequence(targeted))
            {
                SpellHelper.Turn(Caster, targeted);

                /* Soothing winds attempt to neutralize poisons, lift curses, and heal a valid
                 * Target. The Caster's Mysticism and either Focus or Imbuing (whichever is
                 * greater) skills determine the effectiveness of the Cleansing Winds.
                 */

                targeted.PlaySound(0x64C);

                var targets = new List <Mobile> {
                    targeted
                };

                var map = targeted.Map;

                if (map != null)
                {
                    foreach (var m in map.GetMobilesInRange(targeted.Location, 2))
                    {
                        if (targets.Count >= 3)
                        {
                            break;
                        }

                        if (targeted != m && IsValidTarget(m))
                        {
                            targets.Add(m);
                        }
                    }
                }

                var baseToHeal = (int)((GetBaseSkill(Caster) + GetBoostSkill(Caster)) / 4.0) + Utility.RandomMinMax(-3, 3);
                baseToHeal /= targets.Count;

                foreach (var m in targets)
                {
                    Caster.DoBeneficial(m);

                    m.FixedParticles(0x3709, 1, 30, 9963, 13, 3, EffectLayer.Head);

                    IEntity from = new DummyEntity(Serial.Zero, new Point3D(m.X, m.Y, m.Z - 10), Caster.Map);
                    IEntity to   = new DummyEntity(Serial.Zero, new Point3D(m.X, m.Y, m.Z + 50), Caster.Map);
                    Effects.SendMovingParticles(@from, to, 0x2255, 1, 0, false, false, 13, 3, 9501, 1, 0, EffectLayer.Head, 0x100);

                    Poison poison  = m.Poison;
                    var    toHeal  = baseToHeal;
                    var    canHeal = true;

                    if (MortalStrike.IsWounded(m))
                    {
                        // Cleansing Winds will not heal the target after removing mortal wound.
                        canHeal = false;
                    }

                    // Each Curse reduces healing by 3 points + 1% per curse level.
                    var cursePower = EnchantedApple.GetCursePower(m);
                    toHeal -= cursePower * 3;
                    toHeal -= (int)(toHeal * cursePower * 0.01);

                    // Curse removal no longer based on chance.
                    RemoveCurses(m);

                    if (poison != null)
                    {
                        int chanceBonus = (int)((GetBaseSkill(Caster) + GetBoostSkill(Caster)) * 37.5);
                        int cureChance  = 10000 + chanceBonus - ((poison.Level + 1) * 3500);

                        if (cureChance > Utility.Random(10000))
                        {
                            m.CurePoison(Caster);

                            // Poison reduces healing factor by 15% per level of poison.
                            toHeal -= (int)(toHeal * (poison.Level + 1) * 0.15);
                        }
                        else
                        {
                            // If the cure fails, the target will not be healed.
                            canHeal = false;
                        }
                    }

                    if (canHeal)
                    {
                        m.Heal(toHeal, Caster);
                    }
                }
            }

            FinishSequence();
        }