public override void OnCast() { BaseWeapon wep = GetWeapon(); if (wep != null && CheckSequence()) { wep.PlaySwingAnimation(Caster); TimeSpan duration = TimeSpan.FromMinutes(1); double skill = (Caster.Skills[CastSkill].Value + Caster.Skills[DamageSkill].Value) / 2; _HCIBonus = (int)Math.Max(45, skill / 2.667); _SSIBonus = (int)Math.Max(30, skill / 4); string args = String.Format("{0}\t{1}\t{2}", Caster.Name, _HCIBonus.ToString(), _SSIBonus.ToString()); BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.PlayingTheOddsDebuff, 1155913, 1156091, duration, Caster)); //Your bow range has been reduced as you play the odds. List <Mobile> list = GetParty(); foreach (Mobile m in list.Where(mob => mob is PlayerMobile)) { m.PlaySound(0x101); m.FixedEffect(0x13B2, 10, 20, 2728, 5); m.FixedEffect(0x37C4, 10, 20, 2728, 5); if (m != Caster) { BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.PlayingTheOdds, 1155913, 1155998, duration, m, args)); } //~1_NAME~ grants you the following:<br>+~2_VAl~% Hit Chance Increase.<br>+~3_VAL~% Swing Speed Increase. } ColUtility.Free(list); Caster.SendLocalizedMessage(1156091); // Your bow range has been reduced as you play the odds. Expires = DateTime.UtcNow + duration; BeginTimer(); AddToCooldown(TimeSpan.FromSeconds(90)); IPooledEnumerable eable = Caster.Map.GetMobilesInRange(Caster.Location, 5); List <Mobile> targets = new List <Mobile>(); foreach (Mobile m in eable) { if (Caster != m && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false)) { if (!Caster.InLOS(m)) { continue; } targets.Add(m); } } eable.Free(); foreach (Mobile mob in targets) { if (HitLower.ApplyDefense(mob)) { if (wep is BaseRanged && !(wep is BaseThrown)) { Caster.MovingEffect(mob, ((BaseRanged)wep).EffectID, 18, 1, false, false); } mob.PlaySound(0x28E); Effects.SendTargetEffect(mob, 0x37BE, 1, 4, 0x23, 3); Caster.DoHarmful(mob); } } wep.InvalidateProperties(); } FinishSequence(); }
public static TimeSpan OnUse(Mobile m) { m.RevealingAction(); if (m.Target != null) { m.SendLocalizedMessage(501845); // You are busy doing something else and cannot focus. return(TimeSpan.FromSeconds(5.0)); } if (!Core.AOS && m.Hits < m.HitsMax / 10) // Less than 10% health { m.SendLocalizedMessage(501849); // The mind is strong but the body is weak. return(TimeSpan.FromSeconds(5.0)); } if (m.Mana >= m.ManaMax) { m.SendLocalizedMessage(501846); // You are at peace. return(TimeSpan.FromSeconds(Core.AOS ? 10.0 : 5.0)); } if (Core.AOS && RegenRates.GetArmorOffset(m) > 0) { m.SendLocalizedMessage(500135); // Regenerative forces cannot penetrate your armor! return(TimeSpan.FromSeconds(10.0)); } Item oneHanded = m.FindItemOnLayer(Layer.OneHanded); Item twoHanded = m.FindItemOnLayer(Layer.TwoHanded); if (Core.AOS && m.Player) { if (!CheckOkayHolding(oneHanded)) { m.AddToBackpack(oneHanded); } if (!CheckOkayHolding(twoHanded)) { m.AddToBackpack(twoHanded); } } else if (!CheckOkayHolding(oneHanded) || !CheckOkayHolding(twoHanded)) { m.SendLocalizedMessage(502626); // Your hands must be free to cast spells or meditate. return(TimeSpan.FromSeconds(2.5)); } double skillVal = m.Skills.Meditation.Value; double chance = (50.0 + (skillVal - (m.ManaMax - m.Mana)) * 2) / 100; if (chance > Utility.RandomDouble()) { m.CheckSkill(SkillName.Meditation, 0.0, 100.0); m.SendLocalizedMessage(501851); // You enter a meditative trance. m.Meditating = true; BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.ActiveMeditation, 1075657)); if (m.Player || m.Body.IsHuman) { m.PlaySound(0xF9); } } else { m.SendLocalizedMessage(501850); // You cannot focus your concentration. } return(TimeSpan.FromSeconds(10.0)); }
public override void OnHit(Mobile attacker, Mobile defender, int damage) { if (!Validate(attacker)) //Mana check after check that there are targets { return; } ClearCurrentAbility(attacker); Map map = attacker.Map; if (map == null) { return; } BaseWeapon weapon = attacker.Weapon as BaseWeapon; if (weapon == null) { return; } List <Mobile> targets = new List <Mobile>(); targets.Add(defender); IPooledEnumerable eable = attacker.GetMobilesInRange(2); foreach (Mobile m in eable) { if (m != attacker && SpellHelper.ValidIndirectTarget(attacker, m)) { if (m == null || m.Deleted || m.Map != attacker.Map || !m.Alive || !attacker.CanSee(m) || !attacker.CanBeHarmful(m) || !attacker.InLOS(m)) { continue; } if (m is PlayerMobile) { BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.SplinteringEffect, 1153804, 1028852, TimeSpan.FromSeconds(2.0), m)); } targets.Add(m); } } eable.Free(); if (targets.Count > 0) { if (!CheckMana(attacker, true)) { return; } attacker.FixedEffect(0x3728, 10, 15); attacker.PlaySound(0x2A1); if (m_Registry.ContainsKey(attacker)) { RemoveFromRegistry(attacker); } m_Registry[attacker] = new InternalTimer(attacker, targets); if (defender is PlayerMobile && attacker is PlayerMobile) { defender.SendSpeedControl(SpeedControlType.WalkSpeed); BuffInfo.AddBuff(defender, new BuffInfo(BuffIcon.SplinteringEffect, 1153804, 1152144, TimeSpan.FromSeconds(2.0), defender)); Timer.DelayCall <Mobile>(TimeSpan.FromSeconds(2), mob => mob.SendSpeedControl(SpeedControlType.Disable), defender); } if (attacker is BaseCreature) { PetTrainingHelper.OnWeaponAbilityUsed((BaseCreature)attacker, SkillName.Ninjitsu); } } }
public override void OnCast() { BaseWeapon weapon = this.Caster.Weapon as BaseWeapon; if (weapon == null || weapon is Fists) { this.Caster.SendLocalizedMessage(501078); // You must be holding a weapon. } else if (this.CheckSequence()) { /* Temporarily enchants the weapon the caster is currently wielding. * The type of damage the weapon inflicts when hitting a target will * be converted to the target's worst Resistance type. * Duration of the effect is affected by the caster's Karma and lasts for 3 to 11 seconds. */ int itemID, soundID; switch (weapon.Skill) { case SkillName.Macing: itemID = 0xFB4; soundID = 0x232; break; case SkillName.Archery: itemID = 0x13B1; soundID = 0x145; break; default: itemID = 0xF5F; soundID = 0x56; break; } this.Caster.PlaySound(0x20C); this.Caster.PlaySound(soundID); this.Caster.FixedParticles(0x3779, 1, 30, 9964, 3, 3, EffectLayer.Waist); IEntity from = new Entity(Serial.Zero, new Point3D(this.Caster.X, this.Caster.Y, this.Caster.Z), this.Caster.Map); IEntity to = new Entity(Serial.Zero, new Point3D(this.Caster.X, this.Caster.Y, this.Caster.Z + 50), this.Caster.Map); Effects.SendMovingParticles(from, to, itemID, 1, 0, false, false, 33, 3, 9501, 1, 0, EffectLayer.Head, 0x100); double seconds = this.ComputePowerValue(20); // TODO: Should caps be applied? int pkarma = this.Caster.Karma; if (pkarma > 5000) { seconds = 11.0; } else if (pkarma >= 4999) { seconds = 10.0; } else if (pkarma >= 3999) { seconds = 9.00; } else if (pkarma >= 2999) { seconds = 8.0; } else if (pkarma >= 1999) { seconds = 7.0; } else if (pkarma >= 999) { seconds = 6.0; } else { seconds = 5.0; } TimeSpan duration = TimeSpan.FromSeconds(seconds); Timer t = (Timer)m_Table[weapon]; if (t != null) { t.Stop(); } weapon.Consecrated = true; m_Table[weapon] = t = new ExpireTimer(weapon, duration); BuffInfo.AddBuff(this.Caster, new BuffInfo(BuffIcon.ConsecrateWeapon, 1028830, 1044111, TimeSpan.FromSeconds(seconds), this.Caster)); t.Start(); } this.FinishSequence(); }
public void ApplyEffects(Mobile m, double strength = 1.0) { /* Transmogrifies the flesh of the target creature or player to resemble rotted corpse flesh, * making them more vulnerable to Fire and Poison damage, * but increasing their resistance to Physical and Cold damage. * * The effect lasts for ((Spirit Speak skill level - target's Resist Magic skill level) / 25 ) + 40 seconds. * * NOTE: Algorithm above is fixed point, should be: * ((ss-mr)/2.5) + 40 * * NOTE: Resistance is not checked if targeting yourself */ if (m_Table.ContainsKey(m)) { m_Table[m].DoExpire(false); } m.SendLocalizedMessage(1061689); // Your skin turns dry and corpselike. if (m.Spell != null) { m.Spell.OnCasterHurt(); } m.FixedParticles(0x373A, 1, 15, 9913, 67, 7, EffectLayer.Head); m.PlaySound(0x1BB); double ss = GetDamageSkill(Caster); double mr = GetResistSkill(m); m.CheckSkill(SkillName.MagicResist, 0.0, m.Skills[SkillName.MagicResist].Cap); //Skill check for gain TimeSpan duration = TimeSpan.FromSeconds((((ss - mr) / 2.5) + 40.0) * strength); int malus = (int)Math.Min(15, (Caster.Skills[CastSkill].Value + Caster.Skills[DamageSkill].Value) * 0.075); ResistanceMod[] mods = new ResistanceMod[4] { new ResistanceMod(ResistanceType.Fire, (int)(-malus * strength)), new ResistanceMod(ResistanceType.Poison, (int)(-malus * strength)), new ResistanceMod(ResistanceType.Cold, (int)(+10.0 * strength)), new ResistanceMod(ResistanceType.Physical, (int)(+10.0 * strength)) }; ExpireTimer timer = new ExpireTimer(m, mods, malus, duration); timer.Start(); BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.CorpseSkin, 1075663, duration, m)); m_Table[m] = timer; m.UpdateResistances(); for (int i = 0; i < mods.Length; ++i) { m.AddResistanceMod(mods[i]); } HarmfulSpell(m); }
public void DoGaze() { Mobile target = FindRandomMedusaTarget(); Map map = Map; if (map == null || target == null) { return; } if ((target is BaseCreature && ((BaseCreature)target).SummonMaster != this) || CanBeHarmful(target)) { if (CheckBlockGaze(target)) { if (GorgonLense.TotalCharges(target) == 0) { target.SendLocalizedMessage(1112600); // Your lenses crumble. You are no longer protected from Medusa's gaze! } else { target.SendLocalizedMessage(1112599); //Your Gorgon Lens deflect Medusa's petrifying gaze! } } else { BaseCreature clone = new MedusaClone(target); bool validLocation = false; Point3D loc = Location; for (int j = 0; !validLocation && j < 10; ++j) { int x = X + Utility.Random(10) - 1; int y = Y + Utility.Random(10) - 1; int z = map.GetAverageZ(x, y); if (validLocation = map.CanFit(x, y, Z, 16, false, false)) { loc = new Point3D(x, y, Z); } else if (validLocation = map.CanFit(x, y, z, 16, false, false)) { loc = new Point3D(x, y, z); } } Effects.SendLocationEffect(loc, target.Map, 0x37B9, 10, 5); clone.Frozen = clone.Blessed = true; clone.SolidHueOverride = 761; target.Frozen = target.Blessed = true; target.SolidHueOverride = 761; //clone.MoveToWorld(loc, target.Map); BaseCreature.Summon(clone, false, this, loc, 0, TimeSpan.FromMinutes(90)); if (target is BaseCreature && !((BaseCreature)target).Summoned && ((BaseCreature)target).GetMaster() != null) { ((BaseCreature)target).GetMaster().SendLocalizedMessage(1113281, null, 43); // Your pet has been petrified! } else { target.SendLocalizedMessage(1112768); // You have been turned to stone!!! } new GazeTimer(target, clone, this, Utility.RandomMinMax(5, 10)).Start(); m_GazeDelay = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(45, 75)); m_Helpers.Add(clone); m_TurnedToStone.Add(target); BuffInfo.AddBuff(target, new BuffInfo(BuffIcon.MedusaStone, 1153790, 1153825)); return; } } m_GazeDelay = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(25, 65)); }
public static BandageContext BeginHeal(Mobile healer, Mobile patient, bool enhanced) { bool isDeadPet = (patient is BaseCreature && ((BaseCreature)patient).IsDeadPet); if (patient is IRepairableMobile && ((IRepairableMobile)patient).RepairResource != typeof(Bandage)) { healer.SendLocalizedMessage(500970); // Bandages cannot be used on that. } else if (patient is BaseCreature && ((BaseCreature)patient).IsAnimatedDead) { healer.SendLocalizedMessage(500951); // You cannot heal that. } else if (!patient.Poisoned && patient.Hits == patient.HitsMax && !BleedAttack.IsBleeding(patient) && !isDeadPet) { healer.SendLocalizedMessage(500955); // That being is not damaged! } else if (!patient.Alive && (patient.Map == null || !patient.Map.CanFit(patient.Location, 16, false, false))) { healer.SendLocalizedMessage(501042); // Target cannot be resurrected at that location. } else if (healer.CanBeBeneficial(patient, true, true)) { healer.DoBeneficial(patient); BandageContext context = GetContext(healer); if (context != null) { context.StopHeal(); } TimeSpan delay = GetDelay(healer, patient); if (patient is PlayerMobile) { BuffInfo.AddBuff(healer, new BuffInfo(BuffIcon.Healing, 1002082, 1151400, delay, healer, string.Format("{0}", patient.Name))); } else { BuffInfo.AddBuff(healer, new BuffInfo(BuffIcon.Veterinary, 1002167, 1151400, delay, healer, string.Format("{0}", patient.Name))); } context = new BandageContext(healer, patient, delay, enhanced); m_Table[healer] = context; if (healer != patient) { 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)delay.TotalSeconds)); } return(context); } return(null); }
public static void OnMasteryChanged(Mobile m, SkillName oldMastery) { PassiveSpell passive = GetActivePassive(m); SkillName newMastery = m.Skills.CurrentMastery; if (oldMastery != newMastery) { List <SkillMasterySpell> list = SkillMasterySpell.GetSpells(m); if (list != null) { list.ForEach(spell => { spell.Expire(); }); list.Clear(); list.TrimExcess(); } SpecialMove move = SpecialMove.GetCurrentMove(m); if (move is SkillMasteryMove) { SpecialMove.ClearCurrentMove(m); } m.RemoveStatMod("SavingThrow_Str"); ColUtility.Free(list); RemovePassiveBuffs(m); } if (passive != PassiveSpell.None && passive != PassiveSpell.AnticipateHit) { switch (passive) { case PassiveSpell.EnchantedSummoning: BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.EnchantedSummoning, 1155904, 1156090, String.Format("{0}\t{0}", EnchantedSummoningBonus(m).ToString()), true)); // +~1_STAMINA~ Stamina Regeneration and +~2_HP~% Hit Points for summoned pets.<br>Increased difficulty for summoned pets to be dispelled. break; case PassiveSpell.Intuition: BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Intuition, 1155907, 1156089, IntuitionBonus(m).ToString(), true)); // Mana Increase ~1_VAL~ break; case PassiveSpell.SavingThrow: { string args = null; switch (GetMasteryLevel(m, newMastery)) { default: args = "5\t0\t0\t0"; break; case 2: args = "5\t5\t0\t0"; break; case 3: args = "5\t5\t5\t5"; break; } m.AddStatMod(new StatMod(StatType.Str, "SavingThrow_Str", 5, TimeSpan.Zero)); BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.SavingThrow, 1156031, 1156032, args, true)); // Provides a chance to block disarm attempts based on Mastery level, weapon skill level and tactics skill level. } break; case PassiveSpell.Potency: BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Potency, 1155928, 1156195, NonPoisonConsumeChance(m).ToString(), true)); // ~1_VAL~% chance to not consume poison charges when using infecting strike or injected strike. break; case PassiveSpell.Knockout: BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Knockout, 1155931, 1156030, String.Format("{0}\t{1}", GetKnockoutModifier(m).ToString(), GetKnockoutModifier(m, true).ToString(), true))); // Wrestling Damage Bonus:<br>+~1_VAL~% PvM<br>+~2_VAL~% PvP break; case PassiveSpell.Boarding: BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Boarding, 1155934, 1156194, BoardingSlotIncrease(m).ToString(), true)); // Your number of stable slots has been increased by ~1_VAL~. break; } m.Delta(MobileDelta.WeaponDamage); m.UpdateResistances(); if (m.Mana > m.ManaMax) { m.Mana = m.ManaMax; } } if (m.Backpack != null) { foreach (Item item in m.Backpack.FindItemsByType(typeof(BookOfMasteries))) { BookOfMasteries book = item as BookOfMasteries; if (book != null) { book.InvalidateProperties(); } } } foreach (Item item in m.Items.Where(i => i is BookOfMasteries)) { BookOfMasteries book = item as BookOfMasteries; if (book != null) { book.InvalidateProperties(); } } }
public override void OnCast() { BaseWeapon wep = Caster.Weapon as BaseWeapon; if (wep == null || wep != Weapon) { Caster.SendLocalizedMessage(501078); // You must be holding a weapon. } else if (IsUnderSpellEffects(Caster, Weapon)) { Caster.SendLocalizedMessage(501775); // This spell is already in effect. } else if (ImmolatingWeaponSpell.IsImmolating(Caster, Weapon) || Weapon.ConsecratedContext != null) { Caster.SendLocalizedMessage(1080128); //You cannot use this ability while your weapon is enchanted. } else if (Weapon.FocusWeilder != null) { Caster.SendLocalizedMessage(1080446); // You cannot enchant an item that is under the effects of the ninjitsu focus attack ability. } else if (Weapon.WeaponAttributes.HitLightning > 0 || Weapon.WeaponAttributes.HitFireball > 0 || Weapon.WeaponAttributes.HitHarm > 0 || Weapon.WeaponAttributes.HitMagicArrow > 0 || Weapon.WeaponAttributes.HitDispel > 0) { Caster.SendLocalizedMessage(1080127); // This weapon already has a hit spell effect and cannot be enchanted. } else if (CheckSequence() && Caster.Weapon == Weapon) { Caster.PlaySound(0x64E); Caster.FixedEffect(0x36CB, 1, 9, 1915, 0); int prim = (int)Caster.Skills[CastSkill].Value; int sec = (int)Caster.Skills[DamageSkill].Value; int value = (60 * (prim + sec)) / 240; double duration = ((prim + sec) / 2.0) + 30.0; int malus = 0; if (Table == null) { Table = new Dictionary <Mobile, EnchantmentTimer>(); } Enhancement.SetValue(Caster, Attribute, value, ModName); if (prim >= 80 && sec >= 80 && Weapon.Attributes.SpellChanneling == 0) { Enhancement.SetValue(Caster, AosAttribute.SpellChanneling, 1, ModName); Enhancement.SetValue(Caster, AosAttribute.CastSpeed, -1, ModName); malus = 1; } Table[Caster] = new EnchantmentTimer(Caster, Weapon, Attribute, value, malus, duration); int loc; switch (Attribute) { default: case AosWeaponAttribute.HitLightning: loc = 1060423; break; case AosWeaponAttribute.HitFireball: loc = 1060420; break; case AosWeaponAttribute.HitHarm: loc = 1060421; break; case AosWeaponAttribute.HitMagicArrow: loc = 1060426; break; case AosWeaponAttribute.HitDispel: loc = 1060417; break; } BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.Enchant, 1080126, loc, TimeSpan.FromSeconds(duration), Caster, value.ToString())); Weapon.EnchantedWeilder = Caster; Weapon.InvalidateProperties(); } FinishSequence(); }
public static void OnVirtueUsed(Mobile from) { if (VirtueHelper.GetLevel(from, VirtueName.Humility) < VirtueLevel.Seeker) { from.SendLocalizedMessage(1155812); // You must be at least a Seeker of Humility to Invoke this ability. } else if (from.Alive) { from.SendLocalizedMessage(1155817); // Target the pet you wish to embrace with your Humility. from.BeginTarget( 10, false, TargetFlags.None, (m, targeted) => { if (targeted is BaseCreature bc) { if (!bc.Alive) { from.SendLocalizedMessage(1155815); // You cannot embrace Humility on the dead! } else if (VirtueHelper.GetLevel(m, VirtueName.Humility) < VirtueLevel.Seeker) { from.SendLocalizedMessage(1155812); // You must be at least a Seeker of Humility to Invoke this ability. } else if (!bc.Controlled && !bc.Summoned) { from.SendLocalizedMessage(1155813); // You can only embrace your Humility on a pet. } else if (ActiveTable.ContainsKey(bc)) { from.SendLocalizedMessage(1156047); // That pet has already embraced Humility. } else { VirtueHelper.Atrophy(from, VirtueName.Humility, 3200); from.SendLocalizedMessage(1155818); // You have lost some Humility. ActiveTable[bc] = from; m.PrivateOverheadMessage( MessageType.Regular, 1150, 1155819, from.NetState); // *Your pet surges with the power of your Humility!* bc.FixedEffect(0x373A, 10, 16); BuffInfo.AddBuff( from, new BuffInfo( BuffIcon.Humility, 1156049, 1156050, TimeSpan.FromMinutes(20), from, string.Format("{0}\t{1}", bc.Name, GetRegenBonus(bc)))); // Pet: ~1_NAME~<br>+~2_VAL~ HPR<br> CheckTimer(); bc.ResetStatTimers(); Timer.DelayCall( TimeSpan.FromMinutes(20), mob => { if (mob != null && ActiveTable.ContainsKey(mob)) { Mobile user = ActiveTable[mob]; ActiveTable.Remove(mob); BuffInfo.RemoveBuff(user, BuffIcon.Humility); user.PrivateOverheadMessage( MessageType.Regular, 1150, 1155823, from.NetState); // *Your pet's power returns to normal* CheckTimer(); } }, bc); } } else { from.SendLocalizedMessage(1155813); // You can only embrace your Humility on a pet. } }); } }
public override void OnCast() { if (Factions.Sigil.ExistsOn(Caster)) { Caster.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil. } else if (!Caster.CanBeginAction(typeof(PolymorphSpell))) { Caster.SendLocalizedMessage(1061628); // You can't do that while polymorphed. } else if (!Caster.CanBeginAction(typeof(IncognitoSpell)) || (Caster.IsBodyMod && !UnderEffect(Caster))) { Caster.SendLocalizedMessage(1063218); // You cannot use that ability in this form. } else if (CheckSequence()) { if (UnderEffect(Caster)) { RemoveEffects(Caster); Caster.PlaySound(0xFA); Caster.Delta(MobileDelta.Resistances); } else { var mount = Caster.Mount; if (mount != null) { mount.Rider = null; } Caster.BodyMod = 0x2C1; Caster.HueMod = 0; var offset = (int)((GetBaseSkill(Caster) + GetBoostSkill(Caster)) / 24.0); var mods = new List <ResistanceMod> { new ResistanceMod(ResistanceType.Physical, offset), new ResistanceMod(ResistanceType.Fire, offset), new ResistanceMod(ResistanceType.Cold, offset), new ResistanceMod(ResistanceType.Poison, offset), new ResistanceMod(ResistanceType.Energy, offset) }; foreach (var mod in mods) { Caster.AddResistanceMod(mod); } m_Table[Caster] = mods; Caster.PlaySound(0x65A); Caster.Delta(MobileDelta.Resistances); BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.StoneForm, 1080145, 1080146, string.Format("-10\t-2\t{0}\t{1}\t{2}", offset, GetResistCapBonus(Caster), GetDIBonus(Caster)), false)); } } FinishSequence(); }
public void ApplyEffects(Mobile m, double strength = 1.0) { //SpellHelper.CheckReflect( (int)this.Circle, Caster, ref m ); //Irrelevent after AoS /* Temporarily chokes off the air suply of the target with poisonous fumes. * The target is inflicted with poison damage over time. * The amount of damage dealt each "hit" is based off of the caster's Spirit Speak skill and the Target's current Stamina. * The less Stamina the target has, the more damage is done by Strangle. * Duration of the effect is Spirit Speak skill level / 10 rounds, with a minimum number of 4 rounds. * The first round of damage is dealt after 5 seconds, and every next round after that comes 1 second sooner than the one before, until there is only 1 second between rounds. * The base damage of the effect lies between (Spirit Speak skill level / 10) - 2 and (Spirit Speak skill level / 10) + 1. * Base damage is multiplied by the following formula: (3 - (target's current Stamina / target's maximum Stamina) * 2). * Example: * For a target at full Stamina the damage multiplier is 1, * for a target at 50% Stamina the damage multiplier is 2 and * for a target at 20% Stamina the damage multiplier is 2.6 */ if (m.Spell != null) { m.Spell.OnCasterHurt(); } m.PlaySound(0x22F); m.FixedParticles(0x36CB, 1, 9, 9911, 67, 5, EffectLayer.Head); m.FixedParticles(0x374A, 1, 17, 9502, 1108, 4, (EffectLayer)255); if (Server.Spells.Mysticism.StoneFormSpell.CheckImmunity(m)) { Caster.SendLocalizedMessage(1095250); // Your target resists strangle. } else if (!m_Table.ContainsKey(m)) { Timer t = new InternalTimer(m, Caster, strength); t.Start(); m_Table[m] = t; //Calculations for the buff bar double spiritlevel = Caster.Skills[SkillName.SpiritSpeak].Value / 10; if (spiritlevel < 4) { spiritlevel = 4; } int d_MinDamage = (int)(4.0 * strength); int d_MaxDamage = (int)(((spiritlevel + 1) * 3) * strength); string args = String.Format("{0}\t{1}", d_MinDamage, d_MaxDamage); int i_Count = (int)spiritlevel; int i_MaxCount = i_Count; int i_HitDelay = 5; int i_Length = i_HitDelay; while (i_Count > 1) { --i_Count; if (i_HitDelay > 1) { if (i_MaxCount < 5) { --i_HitDelay; } else { int delay = (int)(Math.Ceiling((1.0 + (5 * i_Count)) / i_MaxCount)); if (delay <= 5) { i_HitDelay = delay; } else { i_HitDelay = 5; } } } i_Length += i_HitDelay; } TimeSpan t_Duration = TimeSpan.FromSeconds(i_Length * strength); BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Strangle, 1075794, 1075795, t_Duration, m, args.ToString())); } HarmfulSpell(m); }
public override void OnCast() { if (Factions.Sigil.ExistsOn(Caster)) { Caster.SendLocalizedMessage(1010445); // You cannot incognito if you have a sigil } else if (!Caster.CanBeginAction(typeof(IncognitoSpell))) { Caster.SendLocalizedMessage(1005559); // This spell is already in effect. } else if (Caster.BodyMod == 183 || Caster.BodyMod == 184) { Caster.SendLocalizedMessage(1042402); // You cannot use incognito while wearing body paint } else if (!Caster.CanBeginAction(typeof(PolymorphSpell)) || Caster.IsBodyMod) { DoFizzle(); } else if (CheckSequence()) { if (Caster.BeginAction(typeof(IncognitoSpell))) { DisguiseGump.StopTimer(Caster); Caster.HueMod = Caster.Race.RandomSkinHue(); Caster.NameMod = Caster.Female ? NameList.RandomName("female") : NameList.RandomName("male"); PlayerMobile pm = Caster as PlayerMobile; if (pm != null && pm.Race != null) { pm.SetHairMods(pm.Race.RandomHair(pm.Female), pm.Race.RandomFacialHair(pm.Female)); pm.HairHue = pm.Race.RandomHairHue(); pm.FacialHairHue = pm.Race.RandomHairHue(); } Caster.FixedParticles(0x373A, 10, 15, 5036, EffectLayer.Head); Caster.PlaySound(0x3BD); BaseArmor.ValidateMobile(Caster); BaseClothing.ValidateMobile(Caster); StopTimer(Caster); int timeVal = ((6 * Caster.Skills.Magery.Fixed) / 50) + 1; if (timeVal > 144) { timeVal = 144; } TimeSpan length = TimeSpan.FromSeconds(timeVal); Timer t = new InternalTimer(Caster, length); m_Timers[Caster] = t; t.Start(); BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.Incognito, 1075819, length, Caster)); } else { Caster.SendLocalizedMessage(1079022); // You're already incognitoed! } } FinishSequence(); }
private void UpdateBuffInfo() { // TODO: display friendly name attribute when target is not null. BuffInfo.AddBuff(m_Owner, new BuffInfo(BuffIcon.EnemyOfOne, 1075653, 1075902, m_Expire - DateTime.UtcNow, m_Owner, String.Format("{0}\t{1}", m_DamageScalar.ToString(), 100.ToString()))); }
public void Target(Mobile m) { if (CheckHSequence(m)) { SpellHelper.Turn(Caster, m); /* Transmogrifies the flesh of the target creature or player to resemble rotted corpse flesh, * making them more vulnerable to Fire and Poison damage, * but increasing their resistance to Physical and Cold damage. * * The effect lasts for ((Spirit Speak skill level - target's Resist Magic skill level) / 25 ) + 40 seconds. * * NOTE: Algorithm above is fixed point, should be: * ((ss-mr)/2.5) + 40 * * NOTE: Resistance is not checked if targeting yourself */ ExpireTimer timer = (ExpireTimer)m_Table[m]; if (timer != null) { timer.DoExpire(); } else { m.SendLocalizedMessage(1061689); // Your skin turns dry and corpselike. } if (m.Spell != null) { m.Spell.OnCasterHurt(); } m.FixedParticles(0x373A, 1, 15, 9913, 67, 7, EffectLayer.Head); m.PlaySound(0x1BB); double ss = GetDamageSkill(Caster); double mr = (Caster == m ? 0.0 : GetResistSkill(m)); m.CheckSkill(SkillName.MagicResist, 0.0, 120.0); //Skill check for gain TimeSpan duration = TimeSpan.FromSeconds(((ss - mr) / 2.5) + 40.0); int nBenefit1 = 0; int nBenefit2 = 0; if (Caster is PlayerMobile) // WIZARD { nBenefit1 = (int)(Caster.Skills[SkillName.Necromancy].Value / 10); nBenefit2 = (int)(Caster.Skills[SkillName.Necromancy].Value / 5); } ResistanceMod[] mods = new ResistanceMod[4] { new ResistanceMod(ResistanceType.Fire, (-15 + nBenefit1)), new ResistanceMod(ResistanceType.Poison, (-15 + nBenefit1)), new ResistanceMod(ResistanceType.Cold, (10 + nBenefit2)), new ResistanceMod(ResistanceType.Physical, (10 + nBenefit2)) }; timer = new ExpireTimer(m, mods, duration); timer.Start(); BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.CorpseSkin, 1075663, duration, m)); m_Table[m] = timer; for (int i = 0; i < mods.Length; ++i) { m.AddResistanceMod(mods[i]); } HarmfulSpell(m); } FinishSequence(); }
public virtual bool Apply(Mobile from) { if (TryAddBuff(from, Effect)) { switch (Effect) { default: case FishPieEffect.None: break; case FishPieEffect.MedBoost: TimedSkillMod mod1 = new TimedSkillMod(SkillName.Meditation, true, 10.0, Duration); mod1.ObeyCap = true; from.AddSkillMod(mod1); break; case FishPieEffect.FocusBoost: TimedSkillMod mod2 = new TimedSkillMod(SkillName.Focus, true, 10.0, Duration); mod2.ObeyCap = true; from.AddSkillMod(mod2); break; case FishPieEffect.ColdSoak: break; case FishPieEffect.EnergySoak: break; case FishPieEffect.PoisonSoak: break; case FishPieEffect.FireSoak: break; case FishPieEffect.PhysicalSoak: break; case FishPieEffect.WeaponDam: break; case FishPieEffect.HitChance: break; case FishPieEffect.DefChance: break; case FishPieEffect.SpellDamage: break; case FishPieEffect.ManaRegen: break; case FishPieEffect.StamRegen: break; case FishPieEffect.HitsRegen: break; case FishPieEffect.SoulCharge: break; case FishPieEffect.CastFocus: break; } if (Effect != FishPieEffect.None) { new InternalTimer(Duration, from, Effect); BuffInfo.AddBuff(from, new BuffInfo(BuffIcon.FishPie, 1116340, LabelNumber)); } return(true); } else { from.SendLocalizedMessage(502173); // You are already under a similar effect. } return(false); }
private static void Honor(PlayerMobile source, Mobile target) { var honorTarget = target as IHonorTarget; var reg = (GuardedRegion)source.Region.GetRegion(typeof(GuardedRegion)); var map = source.Map; if (honorTarget == null) { return; } if (honorTarget.ReceivedHonorContext != null) { if (honorTarget.ReceivedHonorContext.Source == source) { source.SendLocalizedMessage( 1115882); // You don't need to declare again. You are already under Honorable Combat with this target. return; } if (honorTarget.ReceivedHonorContext.CheckDistance()) { source.SendLocalizedMessage(1063233); // Somebody else is honoring this opponent return; } } if (target.Hits < target.HitsMax) { source.SendLocalizedMessage(1063166); // You cannot honor this monster because it is too damaged. return; } var cret = target as BaseCreature; if (target.Body.IsHuman && (cret == null || (!cret.AlwaysAttackable && !cret.AlwaysMurderer))) { if (reg == null || reg.IsDisabled()) { //Allow honor on blue if Out of guardzone } else if (map != null && (map.Rules & MapRules.HarmfulRestrictions) == 0) { //Allow honor on blue if in Fel } else { source.SendLocalizedMessage(1001018); // You cannot perform negative acts return; //cannot honor in trammel town on blue } } if (target is PlayerMobile) { source.SendLocalizedMessage(1075614); // You cannot honor other players. return; } if (source.SentHonorContext != null) { source.SentHonorContext.Cancel(); } new HonorContext(source, target); source.Direction = source.GetDirectionTo(target); source.SendLocalizedMessage(1115884); // You Started Honorable Combat! if (!source.Mounted && !source.IsBodyMod) { source.Animate(32, 5, 1, true, true, 0); } BuffInfo.AddBuff(source, new BuffInfo(BuffIcon.Honored, 1075649, 1153815, String.Format("{0}", target.Name, true))); BuffInfo.AddBuff(source, new BuffInfo(BuffIcon.Perfection, 1153786, 1151394, String.Format("0\t{0}", target.Name))); }
public override void OnUse(Mobile m) { base.OnUse(m); BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.MomentumStrike, 1060600, 1063268)); }
public override void OnCast() { if (Core.AOS) { /* The reactive armor spell increases the caster's physical resistance, while lowering the caster's elemental resistances. * 15 + (Inscription/20) Physcial bonus * -5 Elemental * The reactive armor spell has an indefinite duration, becoming active when cast, and deactivated when re-cast. * Reactive Armor, Protection, and Magic Reflection will stay on�even after logging out, even after dying�until you �turn them off� by casting them again. * (+20 physical -5 elemental at 100 Inscription) */ if (CheckSequence()) { var targ = Caster; if (m_Table.Remove(targ, out var mods)) { targ.PlaySound(0x1ED); targ.FixedParticles(0x376A, 9, 32, 5008, EffectLayer.Waist); for (var i = 0; i < mods.Length; ++i) { targ.RemoveResistanceMod(mods[i]); } BuffInfo.RemoveBuff(Caster, BuffIcon.ReactiveArmor); } else { targ.PlaySound(0x1E9); targ.FixedParticles(0x376A, 9, 32, 5008, EffectLayer.Waist); mods = new[] { new ResistanceMod( ResistanceType.Physical, 15 + (int)(targ.Skills.Inscribe.Value / 20) ), new ResistanceMod(ResistanceType.Fire, -5), new ResistanceMod(ResistanceType.Cold, -5), new ResistanceMod(ResistanceType.Poison, -5), new ResistanceMod(ResistanceType.Energy, -5) }; m_Table[targ] = mods; for (var i = 0; i < mods.Length; ++i) { targ.AddResistanceMod(mods[i]); } var physresist = 15 + (int)(targ.Skills.Inscribe.Value / 20); var args = $"{physresist}\t{5}\t{5}\t{5}\t{5}"; BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.ReactiveArmor, 1075812, 1075813, args)); } } FinishSequence(); } else { if (Caster.MeleeDamageAbsorb > 0) { Caster.SendLocalizedMessage(1005559); // This spell is already in effect. } else if (!Caster.CanBeginAction <DefensiveSpell>()) { Caster.SendLocalizedMessage(1005385); // The spell will not adhere to you at this time. } else if (CheckSequence()) { if (Caster.BeginAction <DefensiveSpell>()) { var value = Math.Clamp( (int)(Caster.Skills.Magery.Value + Caster.Skills.Meditation.Value + Caster.Skills.Inscribe.Value) / 3, 1, 75 ); Caster.MeleeDamageAbsorb = value; Caster.FixedParticles(0x376A, 9, 32, 5008, EffectLayer.Waist); Caster.PlaySound(0x1F2); } else { Caster.SendLocalizedMessage(1005385); // The spell will not adhere to you at this time. } } FinishSequence(); } }
public override void OnHit(Mobile attacker, Mobile defender, int damage) { if (!Validate(attacker) || !CheckMana(attacker, true)) { return; } BaseWeapon weapon = attacker.Weapon as BaseWeapon; if (weapon != null && !HasOnslaught(attacker, defender)) { ClearCurrentMove(attacker); int phys, fire, cold, pois, nrgy, chaos, direct; weapon.GetDamageTypes(null, out phys, out fire, out cold, out pois, out nrgy, out chaos, out direct); int highest = phys; int type = 0; if (fire > phys) { type = 1; highest = fire; } if (cold > highest) { type = 2; highest = cold; } if (pois > highest) { type = 3; highest = pois; } if (nrgy > highest) { type = 4; highest = nrgy; } ResistanceType resistType = (ResistanceType)type; int amount = (int)((attacker.Skills[MoveSkill].Value + attacker.Skills[SkillName.Tactics].Value) / 12); int duration = (MasteryInfo.GetMasteryLevel(attacker, MoveSkill) * 2) + 1; if (defender is PlayerMobile) { amount /= 2; } ResistanceMod mod = new ResistanceMod(resistType, -amount); defender.AddResistanceMod(mod); attacker.PrivateOverheadMessage(MessageType.Regular, 1150, 1156008, attacker.NetState); // You deliver an onslaught of sword strikes! BuffInfo.AddBuff(defender, new BuffInfo(BuffIcon.Onslaught, 1156009, 1156010, TimeSpan.FromSeconds(duration), defender, $"{amount.ToString()}\t{resistType.ToString()}")); // -~2_VAL~% ~1_RESIST~ Debuff. defender.FixedEffect(0x37B9, 10, 5, 632, 0); if (_Table == null) { _Table = new Dictionary <Mobile, Mobile>(); } _Table[attacker] = defender; Timer.DelayCall(TimeSpan.FromSeconds(duration), () => { defender.RemoveResistanceMod(mod); _Table.Remove(attacker); }); } }
public void Target(Mobile m) { if (!Caster.CanSee(m)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (CheckHSequence(m)) { SpellHelper.Turn(Caster, m); SpellHelper.CheckReflect((int)Circle, Caster, ref m); if (Mysticism.StoneFormSpell.CheckImmunity(m)) { Caster.SendLocalizedMessage(1080192); // Your target resists your ability reduction magic. return; } int oldOffset = SpellHelper.GetCurseOffset(m, StatType.Int); int newOffset = SpellHelper.GetOffset(Caster, m, StatType.Int, true, true); if (-newOffset > oldOffset || newOffset == 0) { DoHurtFizzle(); } else { if (m.Spell != null) { m.Spell.OnCasterHurt(); } m.Paralyzed = false; m.FixedParticles(0x3779, 10, 15, 5002, EffectLayer.Head); m.PlaySound(0x1DF); HarmfulSpell(m); if (-newOffset < oldOffset) { SpellHelper.AddStatCurse(this.Caster, m, StatType.Int, false, newOffset); int percentage = (int)(SpellHelper.GetOffsetScalar(this.Caster, m, true) * 100); TimeSpan length = SpellHelper.GetDuration(this.Caster, m); BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Clumsy, 1075831, length, m, percentage.ToString())); if (m_Table.ContainsKey(m)) { m_Table[m].Stop(); } m_Table[m] = Timer.DelayCall(length, () => { RemoveEffects(m); }); } } } FinishSequence(); }
public override void OnHit(Mobile attacker, Mobile defender, int damage) { if (!Validate(attacker) || !CheckMana(attacker, true)) { return; } ClearCurrentMove(attacker); double ninjitsu = attacker.Skills[SkillName.Ninjitsu].Value; double chance; bool isRanged = attacker.Weapon is BaseRanged; if (ninjitsu < 100) //This formula is an approximation from OSI data. TODO: find correct formula { chance = 30 + (ninjitsu - 85) * 2.2; } else { chance = 63 + (ninjitsu - 100) * 1.1; } if ((chance / 100) < Utility.RandomDouble()) { attacker.SendLocalizedMessage(1070779); // You missed your opponent with a Death Strike. return; } DeathStrikeInfo info; int damageBonus = 0; if (m_Table.Contains(defender)) { defender.SendLocalizedMessage(1063092); // Your opponent lands another Death Strike! info = (DeathStrikeInfo)m_Table[defender]; if (info.m_Steps > 0) { damageBonus = attacker.Skills[SkillName.Ninjitsu].Fixed / 150; } if (info.m_Timer != null) { info.m_Timer.Stop(); } m_Table.Remove(defender); } else { defender.SendLocalizedMessage(1063093); // You have been hit by a Death Strike! Move with caution! } attacker.SendLocalizedMessage(1063094); // You inflict a Death Strike upon your opponent! defender.FixedParticles(0x374A, 1, 17, 0x26BC, EffectLayer.Waist); attacker.PlaySound(attacker.Female ? 0x50D : 0x50E); info = new DeathStrikeInfo(defender, attacker, damageBonus, isRanged); info.m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(5.0), new TimerStateCallback(ProcessDeathStrike), defender); m_Table[defender] = info; BuffInfo.AddBuff(defender, new BuffInfo(BuffIcon.DeathStrike, 1075645, TimeSpan.FromSeconds(5.0), defender, string.Format("{0}", damageBonus))); CheckGain(attacker); }
public void Target(Mobile m) { if (m == null) { return; } if (CheckHSequence(m)) { SpellHelper.Turn(Caster, m); // SpellHelper.CheckReflect( (int)this.Circle, Caster, ref m ); // Irrelevent after AoS /* Temporarily chokes off the air suply of the target with poisonous fumes. * The target is inflicted with poison damage over time. * The amount of damage dealt each "hit" is based off of the caster's Spirit Speak skill and the Target's current Stamina. * The less Stamina the target has, the more damage is done by Strangle. * Duration of the effect is Spirit Speak skill level / 10 rounds, with a minimum number of 4 rounds. * The first round of damage is dealt after 5 seconds, and every next round after that comes 1 second sooner than the one before, until there is only 1 second between rounds. * The base damage of the effect lies between (Spirit Speak skill level / 10) - 2 and (Spirit Speak skill level / 10) + 1. * Base damage is multiplied by the following formula: (3 - (target's current Stamina / target's maximum Stamina) * 2). * Example: * For a target at full Stamina the damage multiplier is 1, * for a target at 50% Stamina the damage multiplier is 2 and * for a target at 20% Stamina the damage multiplier is 2.6 */ m.Spell?.OnCasterHurt(); m.PlaySound(0x22F); m.FixedParticles(0x36CB, 1, 9, 9911, 67, 5, EffectLayer.Head); m.FixedParticles(0x374A, 1, 17, 9502, 1108, 4, (EffectLayer)255); if (!m_Table.TryGetValue(m, out var timer)) { m_Table[m] = timer = new InternalTimer(m, Caster); timer.Start(); } HarmfulSpell(m); } // Calculations for the buff bar var spiritlevel = Caster.Skills.SpiritSpeak.Value / 10; if (spiritlevel < 4) { spiritlevel = 4; } var d_MinDamage = 4; var d_MaxDamage = ((int)spiritlevel + 1) * 3; var args = $"{d_MinDamage}\t{d_MaxDamage}"; var i_Count = (int)spiritlevel; var i_MaxCount = i_Count; var i_HitDelay = 5; var i_Length = i_HitDelay; while (i_Count > 1) { --i_Count; if (i_HitDelay > 1) { if (i_MaxCount < 5) { --i_HitDelay; } else { var delay = (int)Math.Ceiling((1.0 + 5 * i_Count) / i_MaxCount); i_HitDelay = delay <= 5 ? delay : 5; } } i_Length += i_HitDelay; } var t_Duration = TimeSpan.FromSeconds(i_Length); BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Strangle, 1075794, 1075795, t_Duration, m, args)); FinishSequence(); }
public override void OnHit(Mobile defender, ref int damage) { BaseWeapon weapon = GetWeapon(); if (!CheckWeapon()) { return; } Poison p = weapon.Poison; if (p == null || weapon.PoisonCharges <= 0) { Caster.SendLocalizedMessage(1061141); // Your weapon must have a dose of poison to perform an infectious strike! return; } // Skill Masteries int noChargeChance = MasteryInfo.NonPoisonConsumeChance(Caster); if (noChargeChance == 0 || noChargeChance < Utility.Random(100)) { --weapon.PoisonCharges; } else { Caster.SendLocalizedMessage(1156095); // Your mastery of poisoning allows you to use your poison charge without consuming it. } int maxLevel = Caster.Skills[SkillName.Poisoning].Fixed / 200; if (maxLevel < 0) { maxLevel = 0; } #region Mondain's Legacy if (p == Poison.DarkGlow) { p = Poison.GetPoison(10 + Math.Min(maxLevel, 2)); } else if (p == Poison.Parasitic) { p = Poison.GetPoison(14 + Math.Min(maxLevel, 3)); } else if (p.Level > maxLevel) { p = Poison.GetPoison(maxLevel); } #endregion if ((Caster.Skills[SkillName.Poisoning].Value / 100.0) > Utility.RandomDouble() && p.Level < 3) { int level = p.Level + 1; Poison newPoison = Poison.GetPoison(level); if (newPoison != null) { p = newPoison; Caster.SendLocalizedMessage(1060080); // Your precise strike has increased the level of the poison by 1 defender.SendLocalizedMessage(1060081); // The poison seems extra effective! } } defender.PlaySound(0xDD); defender.FixedParticles(0x3728, 244, 25, 9941, 1266, 0, EffectLayer.Waist); if (defender.ApplyPoison(Caster, p) != ApplyPoisonResult.Immune) { Caster.SendLocalizedMessage(1008096, true, defender.Name); // You have poisoned your target : defender.SendLocalizedMessage(1008097, false, Caster.Name); // : poisoned you! } int malus = 30; if (defender is PlayerMobile) { malus /= 2; } if (weapon is BaseRanged) { malus /= 2; } ResistanceMod mod = new ResistanceMod(ResistanceType.Poison, -malus); defender.AddResistanceMod(mod); // ~2_NAME~ reduces your poison resistance by ~1_VAL~. BuffInfo.AddBuff(defender, new BuffInfo(BuffIcon.InjectedStrikeDebuff, 1155927, 1156133, TimeSpan.FromSeconds(7), defender, String.Format("{0}\t{1}", malus, Caster.Name))); Server.Timer.DelayCall(TimeSpan.FromSeconds(7), () => { defender.RemoveResistanceMod(mod); }); Expire(); }
public override void OnCast() { if (Core.AOS) { /* The magic reflection spell decreases the caster's physical resistance, while increasing the caster's elemental resistances. * Physical decrease = 25 - (Inscription/20). * Elemental resistance = +10 (-20 physical, +10 elemental at GM Inscription) * The magic reflection spell has an indefinite duration, becoming active when cast, and deactivated when re-cast. * Reactive Armor, Protection, and Magic Reflection will stay on—even after logging out, even after dying—until you “turn them off” by casting them again. */ if (CheckSequence()) { Mobile targ = Caster; ResistanceMod[] mods = (ResistanceMod[])m_Table[targ]; if (mods == null) { targ.PlaySound(0x1E9); targ.FixedParticles(0x375A, 10, 15, 5037, EffectLayer.Waist); int physiMod = -25 + (int)(targ.Skills[SkillName.Inscribe].Value / 20); int otherMod = 10; mods = new ResistanceMod[5] { new ResistanceMod(ResistanceType.Physical, physiMod), new ResistanceMod(ResistanceType.Fire, otherMod), new ResistanceMod(ResistanceType.Cold, otherMod), new ResistanceMod(ResistanceType.Poison, otherMod), new ResistanceMod(ResistanceType.Energy, otherMod) }; m_Table[targ] = mods; for (int i = 0; i < mods.Length; ++i) { targ.AddResistanceMod(mods[i]); } string buffFormat = String.Format("{0}\t+{1}\t+{1}\t+{1}\t+{1}", physiMod, otherMod); BuffInfo.AddBuff(targ, new BuffInfo(BuffIcon.MagicReflection, 1075817, buffFormat, true)); } else { targ.PlaySound(0x1ED); targ.FixedParticles(0x375A, 10, 15, 5037, EffectLayer.Waist); m_Table.Remove(targ); for (int i = 0; i < mods.Length; ++i) { targ.RemoveResistanceMod(mods[i]); } BuffInfo.RemoveBuff(targ, BuffIcon.MagicReflection); } } FinishSequence(); } else { if (Caster.MagicDamageAbsorb > 0) { Caster.SendLocalizedMessage(1005559); // This spell is already in effect. } else if (!Caster.CanBeginAction(typeof(DefensiveSpell))) { Caster.SendLocalizedMessage(1005385); // The spell will not adhere to you at this time. } else if (CheckSequence()) { if (Caster.BeginAction(typeof(DefensiveSpell))) { int value = (int)(Caster.Skills[SkillName.Magery].Value + Caster.Skills[SkillName.Inscribe].Value); value = (int)(8 + (value / 200) * 7.0); //absorb from 8 to 15 "circles" Caster.MagicDamageAbsorb = value; Caster.FixedParticles(0x375A, 10, 15, 5037, EffectLayer.Waist); Caster.PlaySound(0x1E9); } else { Caster.SendLocalizedMessage(1005385); // The spell will not adhere to you at this time. } } FinishSequence(); } }
public void Target(Mobile m) { if (m == null) { Caster.SendLocalizedMessage(1060508); // You can't curse that. } // only PlayerMobile and BaseCreature implement blood oath checking else if (Caster == m || !(m is PlayerMobile || m is BaseCreature)) { Caster.SendLocalizedMessage(1060508); // You can't curse that. } else if (m_OathTable.ContainsKey(Caster)) { Caster.SendLocalizedMessage(1061607); // You are already bonded in a Blood Oath. } else if (m_OathTable.ContainsKey(m)) { if (m.Player) { Caster.SendLocalizedMessage(1061608); // That player is already bonded in a Blood Oath. } else { Caster.SendLocalizedMessage(1061609); // That creature is already bonded in a Blood Oath. } } else if (CheckHSequence(m)) { SpellHelper.Turn(Caster, m); /* Temporarily creates a dark pact between the caster and the target. * Any damage dealt by the target to the caster is increased, but the target receives the same amount of damage. * The effect lasts for ((Spirit Speak skill level - target's Resist Magic skill level) / 80 ) + 8 seconds. * * NOTE: The above algorithm must be fixed point, it should be: * ((ss-rm)/8)+8 */ m_Table.TryGetValue(m, out ExpireTimer timer); timer?.DoExpire(); m_OathTable[Caster] = Caster; m_OathTable[m] = Caster; m.Spell?.OnCasterHurt(); Caster.PlaySound(0x175); Caster.FixedParticles(0x375A, 1, 17, 9919, 33, 7, EffectLayer.Waist); Caster.FixedParticles(0x3728, 1, 13, 9502, 33, 7, (EffectLayer)255); m.FixedParticles(0x375A, 1, 17, 9919, 33, 7, EffectLayer.Waist); m.FixedParticles(0x3728, 1, 13, 9502, 33, 7, (EffectLayer)255); TimeSpan duration = TimeSpan.FromSeconds((GetDamageSkill(Caster) - GetResistSkill(m)) / 8 + 8); m.CheckSkill(SkillName.MagicResist, 0.0, 120.0); // Skill check for gain timer = new ExpireTimer(Caster, m, duration); timer.Start(); BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.BloodOathCaster, 1075659, duration, Caster, m.Name)); BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.BloodOathCurse, 1075661, duration, m, Caster.Name)); m_Table[m] = timer; HarmfulSpell(m); } FinishSequence(); }
public override void OnCast() { if (Core.AOS) { /* The reactive armor spell increases the caster's physical resistance, while lowering the caster's elemental resistances. * 15 + (Inscription/20) Physcial bonus * -5 Elemental * The reactive armor spell has an indefinite duration, becoming active when cast, and deactivated when re-cast. * Reactive Armor, Protection, and Magic Reflection will stay on—even after logging out, even after dying—until you “turn them off” by casting them again. * (+20 physical -5 elemental at 100 Inscription) */ if (CheckSequence()) { Mobile targ = Caster; ResistanceMod[] mods = (ResistanceMod[])m_Table[targ]; if (mods == null) { targ.PlaySound(0x1E9); targ.FixedParticles(0x376A, 9, 32, 5008, EffectLayer.Waist); mods = new ResistanceMod[5] { new ResistanceMod(ResistanceType.Physical, 15 + (int)(targ.Skills[SkillName.Inscribe].Value / 20)), new ResistanceMod(ResistanceType.Fire, -5), new ResistanceMod(ResistanceType.Cold, -5), new ResistanceMod(ResistanceType.Poison, -5), new ResistanceMod(ResistanceType.Energy, -5) }; m_Table[targ] = mods; for (int i = 0; i < mods.Length; ++i) { targ.AddResistanceMod(mods[i]); } int physresist = 15 + (int)(targ.Skills[SkillName.Inscribe].Value / 20); string args = String.Format("{0}\t{1}\t{2}\t{3}\t{4}", physresist, 5, 5, 5, 5); BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.ReactiveArmor, 1075812, 1075813, args.ToString())); } else { targ.PlaySound(0x1ED); targ.FixedParticles(0x376A, 9, 32, 5008, EffectLayer.Waist); m_Table.Remove(targ); for (int i = 0; i < mods.Length; ++i) { targ.RemoveResistanceMod(mods[i]); } BuffInfo.RemoveBuff(Caster, BuffIcon.ReactiveArmor); } } FinishSequence(); } else { if (Caster.MeleeDamageAbsorb > 0) { Caster.SendLocalizedMessage(1005559); // This spell is already in effect. } else if (!Caster.CanBeginAction(typeof(DefensiveSpell))) { Caster.SendLocalizedMessage(1005385); // The spell will not adhere to you at this time. } else if (CheckSequence()) { if (Caster.BeginAction(typeof(DefensiveSpell))) { int value = (int)(Caster.Skills[SkillName.Magery].Value + Caster.Skills[SkillName.Meditation].Value + Caster.Skills[SkillName.Inscribe].Value); value /= 3; if (value < 0) { value = 1; } else if (value > 75) { value = 75; } Caster.MeleeDamageAbsorb = value; Caster.FixedParticles(0x376A, 9, 32, 5008, EffectLayer.Waist); Caster.PlaySound(0x1F2); } else { Caster.SendLocalizedMessage(1005385); // The spell will not adhere to you at this time. } } FinishSequence(); } }
public void Target(Mobile m) { if (m == null) { return; } if (!Caster.CanSee(m)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (m_Table.ContainsKey(m)) { Caster.SendLocalizedMessage(501775); // This spell is already in effect. } else if (!Caster.CanBeginAction <GiftOfRenewalSpell>()) { Caster.SendLocalizedMessage(501789); // You must wait before trying again. } else if (CheckBSequence(m)) { SpellHelper.Turn(Caster, m); Caster.FixedEffect(0x374A, 10, 20); Caster.PlaySound(0x5C9); if (m.Poisoned) { m.CurePoison(m); } else { double skill = Caster.Skills.Spellweaving.Value; int hitsPerRound = 5 + (int)(skill / 24) + FocusLevel; TimeSpan duration = TimeSpan.FromSeconds(30 + FocusLevel * 10); GiftOfRenewalInfo info = new GiftOfRenewalInfo(Caster, m, hitsPerRound); Timer.DelayCall(duration, delegate { if (StopEffect(m)) { m.PlaySound(0x455); m.SendLocalizedMessage(1075071); // The Gift of Renewal has faded. } }); m_Table[m] = info; Caster.BeginAction <GiftOfRenewalSpell>(); BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.GiftOfRenewal, 1031602, 1075797, duration, m, hitsPerRound.ToString())); } } FinishSequence(); }
public static BandageContext BeginHeal(Mobile healer, Mobile patient, bool enhanced) // TODO: Implement Pub 71 healing changes { bool isDeadPet = (patient is BaseCreature && ((BaseCreature)patient).IsDeadPet); if (patient is IRepairableMobile) { healer.SendLocalizedMessage(500970); // Bandages cannot be used on that. } else if (patient is BaseCreature && ((BaseCreature)patient).IsAnimatedDead) { healer.SendLocalizedMessage(500951); // You cannot heal that. } else if (!patient.Poisoned && patient.Hits == patient.HitsMax && !BleedAttack.IsBleeding(patient) && !SplinteringWeaponContext.IsBleeding(patient) && !isDeadPet) { healer.SendLocalizedMessage(500955); // That being is not damaged! } else if (!patient.Alive && (patient.Map == null || !patient.Map.CanFit(patient.Location, 16, false, false))) { healer.SendLocalizedMessage(501042); // Target cannot be resurrected at that location. } else if (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) { if (Core.AOS) { seconds = Math.Min(8, Math.Ceiling(11.0 - healer.Dex / 20)); seconds = Math.Max(seconds, 4); } else { seconds = 9.4 + (0.6 * ((double)(120 - dex) / 10)); } } else { if (Core.AOS && GetPrimarySkill(patient) == SkillName.Veterinary) { seconds = 2.0; } else if (Core.AOS) { seconds = Math.Ceiling((double)4 - healer.Dex / 60); seconds = Math.Max(seconds, 2); } else { if (dex >= 100) { seconds = 3.0 + resDelay; } else if (dex >= 40) { seconds = 4.0 + resDelay; } else { seconds = 5.0 + resDelay; } } } BandageContext context = GetContext(healer); if (context != null) { context.StopHeal(); } if (patient is PlayerMobile) { BuffInfo.AddBuff(healer, new BuffInfo(BuffIcon.Healing, 1002082, 1151400, TimeSpan.FromSeconds(seconds), healer, String.Format("{0}", patient.Name))); } else { BuffInfo.AddBuff(healer, new BuffInfo(BuffIcon.Veterinary, 1002167, 1151400, TimeSpan.FromSeconds(seconds), healer, String.Format("{0}", patient.Name))); } seconds *= 1000; context = new BandageContext(healer, patient, TimeSpan.FromMilliseconds(seconds), enhanced); m_Table[healer] = context; if (!onSelf) { patient.SendLocalizedMessage(1008078, false, healer.Name); // : Attempting to heal you. } healer.SendLocalizedMessage(500956); // You begin applying the bandages. return(context); } return(null); }
public override void OnHit(Mobile attacker, Mobile defender, int damage) { if (!Validate(attacker)) { return; } ClearCurrentAbility(attacker); if (IsImmune(defender)) { attacker.SendLocalizedMessage(1111827); // Your opponent is gripping their weapon too tightly to be disarmed. defender.SendLocalizedMessage(1111828); // You will not be caught off guard by another disarm attack for some time. return; } Item toDisarm = defender.FindItemOnLayer(Layer.OneHanded); if (toDisarm == null || !toDisarm.Movable) { toDisarm = defender.FindItemOnLayer(Layer.TwoHanded); } Container pack = defender.Backpack; if (pack == null || (toDisarm != null && !toDisarm.Movable)) { attacker.SendLocalizedMessage(1004001); // You cannot disarm your opponent. } else if (toDisarm == null || toDisarm is BaseShield) { attacker.SendLocalizedMessage(1060849); // Your target is already unarmed! } else if (CheckMana(attacker, true)) { attacker.SendLocalizedMessage(1060092); // You disarm their weapon! defender.SendLocalizedMessage(1060093); // Your weapon has been disarmed! defender.PlaySound(0x3B9); defender.FixedParticles(0x37BE, 232, 25, 9948, EffectLayer.LeftHand); pack.DropItem(toDisarm); BuffInfo.AddBuff(defender, new BuffInfo(BuffIcon.NoRearm, 1075637, BlockEquipDuration, defender)); BaseWeapon.BlockEquip(defender, BlockEquipDuration); if (defender is BaseCreature && _AutoRearms.Any(t => t == defender.GetType())) { Timer.DelayCall(BlockEquipDuration + TimeSpan.FromSeconds(Utility.RandomMinMax(3, 10)), () => { if (toDisarm != null && !toDisarm.Deleted && toDisarm.IsChildOf(defender.Backpack)) { defender.EquipItem(toDisarm); } }); } AddImmunity(defender, attacker.Weapon is Fists ? TimeSpan.FromSeconds(10) : TimeSpan.FromSeconds(15)); } }