public void AddTo(Mobile m) { Remove(); for (int i = 0; i < 5; ++i) { SkillName skill; double bonus; if (!GetValues(i, out skill, out bonus)) { continue; } if (m_Mods == null) { m_Mods = new List <SkillMod>(); } SkillMod sk = new DefaultSkillMod(skill, true, bonus); sk.ObeyCap = true; m.AddSkillMod(sk); m_Mods.Add(sk); } }
public override void OnCast() { Caster.Hidden = true; if (Caster.CanBeginAction(typeof(RogueShadowSpell))) { Caster.BeginAction(typeof(RogueShadowSpell)); DefaultSkillMod mod = new DefaultSkillMod(SkillName.Stealth, true, 50.0); m_Table.Add(Caster, mod); Caster.AddSkillMod(mod); new InternalTimer(Caster, DateTime.Now.AddSeconds(15*(Caster.Skills[DamageSkill].Base / 10))).Start(); } else Caster.SendMessage("You are already in the shadows!"); }
public void AddTo(Mobile m) { Remove(); for (int i = 0; i < 5; ++i) { SkillName skill; double bonus; if (!GetValues(i, out skill, out bonus)) continue; if (m_Mods == null) m_Mods = new ArrayList(); if ((int)skill == (int)SkillName.Hiding) skill = SkillName.Stealth; SkillMod sk = new DefaultSkillMod(skill, true, bonus); sk.ObeyCap = false; m.AddSkillMod(sk); m_Mods.Add(sk); } }
public void AddTo( Mobile m ) { Remove(); for( int i = 0; i < 5; ++i ) { SkillName skill; double bonus; if( !GetValues( i, out skill, out bonus ) ) continue; if( m_Mods == null ) m_Mods = new List<SkillMod>(); SkillMod sk = new DefaultSkillMod( skill, true, bonus ); sk.ObeyCap = true; m.AddSkillMod( sk ); m_Mods.Add( sk ); } }
public static void ApplySkillLoss( Mobile mob ) { SkillLossContext context = (SkillLossContext)m_SkillLoss[mob]; if ( context != null ) return; context = new SkillLossContext(); m_SkillLoss[mob] = context; ArrayList mods = context.m_Mods = new ArrayList(); for ( int i = 0; i < mob.Skills.Length; ++i ) { Skill sk = mob.Skills[i]; double baseValue = sk.Base; if ( baseValue > 0 ) { SkillMod mod = new DefaultSkillMod( sk.SkillName, true, -(baseValue * SkillLossFactor) ); mods.Add( mod ); mob.AddSkillMod( mod ); } } context.m_Timer = Timer.DelayCall( SkillLossPeriod, new TimerStateCallback( ClearSkillLoss_Callback ), mob ); }
public override void OnDoubleClick( Mobile mob ) { SkillGainContext context = (SkillGainContext)m_SkillGain[mob]; if ( context != null ) return; context = new SkillGainContext(); m_SkillGain[mob] = context; ArrayList mods = context.m_Mods = new ArrayList(); for ( int i = 0; i < mob.Skills.Length; ++i ) { Skill sk = mob.Skills[i]; double baseValue = sk.Base; if ( mob.InRange( this.GetWorldLocation(), 2 ) ) { Container pack = mob.Backpack; int m_Amount = mob.Backpack.GetAmount( typeof( BabyPowder ) ); if ( pack != null && pack.ConsumeTotal( typeof( BabyPowder ), m_Amount) ) { if( m_Amount != 1 ) { mob.AddToBackpack( new BabyPowder( m_Amount-1 )); } if ( baseValue > 0 ) { SkillMod mod = new DefaultSkillMod( SkillName.Fencing, true, +(baseValue * SkillGainFactor) ); SkillMod mod1 = new DefaultSkillMod( SkillName.Parry, true, +(baseValue * SkillGainFactor) ); SkillMod mod2 = new DefaultSkillMod( SkillName.Swords, true, +(baseValue * SkillGainFactor) ); SkillMod mod3 = new DefaultSkillMod( SkillName.Archery, true, +(baseValue * SkillGainFactor) ); SkillMod mod4 = new DefaultSkillMod( SkillName.Macing, true, +(baseValue * SkillGainFactor) ); SkillMod mod5 = new DefaultSkillMod( SkillName.Tactics, true, +(baseValue * SkillGainFactor) ); SkillMod mod6 = new DefaultSkillMod( SkillName.Wrestling, true, +(baseValue * SkillGainFactor) ); mods.Add( mod ); mods.Add( mod1 ); mods.Add( mod2 ); mods.Add( mod3 ); mods.Add( mod4 ); mods.Add( mod5 ); mods.Add( mod6 ); mob.AddSkillMod( mod ); mob.AddSkillMod( mod1 ); mob.AddSkillMod( mod2 ); mob.AddSkillMod( mod3 ); mob.AddSkillMod( mod4 ); mob.AddSkillMod( mod5 ); mob.AddSkillMod( mod6 ); mob.SendMessage("You sprinkle some baby powder on your body and it makes your skin more resistant in combat."); } else { mob.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that. } } } } context.m_Timer = Timer.DelayCall( SkillGainPeriod, new TimerStateCallback( ClearSkillGain_Callback ), mob ); }
public static void ApplySkillLoss( Mobile mob ) { SkillLossContext context = (SkillLossContext) m_SkillLoss[mob]; if ( context != null ) return; context = new SkillLossContext(); m_SkillLoss[mob] = context; ArrayList mods = context.m_Mods = new ArrayList(); for ( int i = 0; i < mob.Skills.Length; ++i ) { Skill sk = mob.Skills[i]; double baseValue = sk.Base; if ( baseValue > 0 ) { SkillMod mod = new DefaultSkillMod( sk.SkillName, true, -( baseValue * SkillLossFactor ) ); mods.Add( mod ); mob.AddSkillMod( mod ); } } context.m_Timer = Timer.DelayCall( SkillLossPeriod, new TimerStateCallback( ClearSkillLoss_Callback ), mob ); // Stat Loss / All of your skills have been reduced by one third. mob.AddBuff( new BuffInfo( BuffIcon.FactionStatLoss, 1153800, 1153826, SkillLossPeriod, mob, true ) ); }
public void Start() { _Mob.AddStatMod(new StatMod(StatType.Str, "TempStatLossStr", -(int)Math.Round(_Mob.RawStr * _Perc), TimeSpan.Zero)); _Mob.AddStatMod(new StatMod(StatType.Dex, "TempStatLossDex", -(int)Math.Round(_Mob.RawDex * _Perc), TimeSpan.Zero)); _Mob.AddStatMod(new StatMod(StatType.Int, "TempStatLossInt", -(int)Math.Round(_Mob.RawInt * _Perc), TimeSpan.Zero)); for (int s = 0; s < (int)SkillName.Spellweaving; s++) { SkillMod sm = new DefaultSkillMod((SkillName)s, true, -(_Mob.Skills[s].Base * _Perc)); _SkillMods.Add( sm ); _Mob.AddSkillMod( sm ); } Resume(); }
public static MorphResult Morph( Mobile m, int entryID ) { if ( entryID < 0 || entryID >= m_Entries.Length ) return MorphResult.Fail; AnimalFormEntry entry = m_Entries[entryID]; m_LastAnimalForms[m] = entryID; // On OSI, it's the last /attempted/ one not the last succeeded one if ( m.Skills.Ninjitsu.Value < entry.ReqSkill ) { string args = String.Format( "{0}\t{1}\t ", entry.ReqSkill.ToString( "F1" ), SkillName.Ninjitsu ); m.SendLocalizedMessage( 1063013, args ); // You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability. return MorphResult.NoSkill; } double minSkill = entry.ReqSkill - 12.5; double maxSkill = entry.ReqSkill + 37.5; if ( !m.CheckSkill( SkillName.Ninjitsu, minSkill, maxSkill ) ) return MorphResult.Fail; BaseMount.Dismount( m ); m.BodyMod = entry.BodyMod; if ( entry.HueMod >= 0 ) m.HueMod = entry.HueMod; if ( entry.SpeedBoost ) m.ForcedRun = true; SkillMod mod = null; if ( entry.StealthBonus ) { mod = new DefaultSkillMod( SkillName.Stealth, true, 20.0 ); mod.ObeyCap = true; m.AddSkillMod( mod ); } #region Heritage Items /* else if ( entry.StealingBonus ) { mod = new DefaultSkillMod( SkillName.Stealing, true, 10.0 ); mod.ObeyCap = true; m.AddSkillMod( mod ); } */ #endregion Timer timer = new AnimalFormTimer( m, entry.BodyMod, m.HueMod ); timer.Start(); AddContext( m, new AnimalFormContext( timer, mod, entry.SpeedBoost, entry.Type ) ); Effects.SendLocationParticles( EffectItem.Create( m.Location, m.Map, EffectItem.DefaultDuration ), 0x3728, 1, 13, 0x7F3 ); BuffInfo.AddBuff( m, new BuffInfo( BuffIcon.AnimalForm, 1075822, 1075823, String.Format( "{0}\t{1}", entry.ArticleCliloc, entry.FormCliloc ) ) ); m.Target = null; return MorphResult.Success; }
public static void ApplySkillLoss( Mobile mob ) { SkillLossContext context = (SkillLossContext)m_SkillLoss[mob]; if ( context != null ) return; context = new SkillLossContext(); m_SkillLoss[mob] = context; ArrayList mods = context.m_Mods = new ArrayList(); int ShortsLost = mob.ShortTermMurders/2; double SkillLossFactor = Math.Min(ShortsLost*0.01,0.5); //1 percent per short. Max 50%. TimeSpan SkillLossPeriod = TimeSpan.FromMinutes(10 + Math.Min(50, ShortsLost)); //10 to 60 minutes. //mob.ShortTermMurders -= ShortsLost; //Lose half your shorts. Disable till title system set up. for ( int i = 0; i < mob.Skills.Length; ++i ) { Skill sk = mob.Skills[i]; double baseValue = sk.Base; if ( baseValue > 0 ) { SkillMod mod = new DefaultSkillMod( sk.SkillName, true, -(baseValue * SkillLossFactor) ); mods.Add( mod ); mob.AddSkillMod( mod ); } } mob.SendMessage(String.Format("You have lost {0}% of your skill for {1} minutes for being a criminal.", (int)(SkillLossFactor*100), 10 + Math.Min(50, ShortsLost))); context.m_Timer = Timer.DelayCall( SkillLossPeriod, new TimerStateCallback( ClearSkillLoss_Callback ), mob ); }
public override void OnCast() { if (!CheckSequence()) return; else if (Caster.Mounted) { Caster.SendLocalizedMessage(1042561); //Please dismount first. } else if (!Caster.CanBeginAction(typeof(AncientPeerSpell))) { Caster.SendLocalizedMessage(1005559); // This spell is already in effect. } else if (Server.Spells.TransformationSpellHelper.UnderTransformation(Caster)) { Caster.SendMessage("Your eyes stay firmly inside your body."); } else if (DisguiseGump.IsDisguised(Caster)) { Caster.SendMessage("Your eyes stay firmly inside your body."); } else if (Caster.BodyMod == 183 || Caster.BodyMod == 184) { Caster.SendMessage("Your eyes stay firmly inside your body."); } else if (!Caster.CanBeginAction(typeof(IncognitoSpell)) || Caster.IsBodyMod) { DoFizzle(); } else if (CheckSequence()) { if (Caster.BeginAction(typeof(AncientPeerSpell))) { if (this.Scroll != null) Scroll.Consume(); Caster.PlaySound(0x2DF); Caster.SendMessage("Your sight leaves your body."); Souless dg = new Souless(this); dg.Body = Caster.Body; dg.Hue = Caster.Hue; dg.Name = Caster.Name; dg.SpeechHue = Caster.SpeechHue; dg.Fame = Caster.Fame; dg.Karma = Caster.Karma; dg.EmoteHue = Caster.EmoteHue; dg.Title = Caster.Title; dg.Criminal = (Caster.Criminal); dg.AccessLevel = Caster.AccessLevel; dg.Str = Caster.Str; dg.Int = Caster.Int; dg.Hits = Caster.Hits; dg.Dex = Caster.Dex; dg.Mana = Caster.Mana; dg.Stam = Caster.Stam; dg.VirtualArmor = (Caster.VirtualArmor); dg.SetSkill(SkillName.Wrestling, Caster.Skills[SkillName.Wrestling].Value); dg.SetSkill(SkillName.Tactics, Caster.Skills[SkillName.Tactics].Value); dg.SetSkill(SkillName.Anatomy, Caster.Skills[SkillName.Anatomy].Value); dg.SetSkill(SkillName.Magery, Caster.Skills[SkillName.Magery].Value); dg.SetSkill(SkillName.MagicResist, Caster.Skills[SkillName.MagicResist].Value); dg.SetSkill(SkillName.Meditation, Caster.Skills[SkillName.Meditation].Value); dg.SetSkill(SkillName.EvalInt, Caster.Skills[SkillName.EvalInt].Value); dg.SetSkill(SkillName.Archery, Caster.Skills[SkillName.Archery].Value); dg.SetSkill(SkillName.Macing, Caster.Skills[SkillName.Macing].Value); dg.SetSkill(SkillName.Swords, Caster.Skills[SkillName.Swords].Value); dg.SetSkill(SkillName.Fencing, Caster.Skills[SkillName.Fencing].Value); dg.SetSkill(SkillName.Lumberjacking, Caster.Skills[SkillName.Lumberjacking].Value); dg.SetSkill(SkillName.Alchemy, Caster.Skills[SkillName.Alchemy].Value); dg.SetSkill(SkillName.Parry, Caster.Skills[SkillName.Parry].Value); dg.SetSkill(SkillName.Focus, Caster.Skills[SkillName.Focus].Value); dg.SetSkill(SkillName.Necromancy, Caster.Skills[SkillName.Necromancy].Value); dg.SetSkill(SkillName.Chivalry, Caster.Skills[SkillName.Chivalry].Value); dg.SetSkill(SkillName.ArmsLore, Caster.Skills[SkillName.ArmsLore].Value); dg.SetSkill(SkillName.Poisoning, Caster.Skills[SkillName.Poisoning].Value); dg.SetSkill(SkillName.SpiritSpeak, Caster.Skills[SkillName.SpiritSpeak].Value); dg.SetSkill(SkillName.Stealing, Caster.Skills[SkillName.Stealing].Value); dg.SetSkill(SkillName.Inscribe, Caster.Skills[SkillName.Inscribe].Value); dg.Kills = (Caster.Kills); m_PeerMod = new ArrayList(); double loss = (0 - Caster.Skills[SkillName.AnimalTaming].Base); SkillMod sk = new DefaultSkillMod(SkillName.AnimalTaming, true, loss); Caster.AddSkillMod(sk); m_PeerMod.Add(sk); double loss1 = (0 - Caster.Skills[SkillName.AnimalLore].Base); SkillMod sk1 = new DefaultSkillMod(SkillName.AnimalLore, true, loss1);// Druidry Caster.AddSkillMod(sk1); m_PeerMod.Add(sk1); double loss3 = (0 - Caster.Skills[SkillName.Necromancy].Base); SkillMod sk3 = new DefaultSkillMod(SkillName.Necromancy, true, loss3); Caster.AddSkillMod(sk3); m_PeerMod.Add(sk3); double loss4 = (0 - Caster.Skills[SkillName.TasteID].Base); SkillMod sk4 = new DefaultSkillMod(SkillName.TasteID, true, loss4); Caster.AddSkillMod(sk4); m_PeerMod.Add(sk4); // Clear Items RemoveFromAllLayers(dg); // Then copy CopyFromLayer(Caster, dg, Layer.FirstValid); CopyFromLayer(Caster, dg, Layer.OneHanded); CopyFromLayer(Caster, dg, Layer.TwoHanded); CopyFromLayer(Caster, dg, Layer.Shoes); CopyFromLayer(Caster, dg, Layer.Pants); CopyFromLayer(Caster, dg, Layer.Shirt); CopyFromLayer(Caster, dg, Layer.Helm); CopyFromLayer(Caster, dg, Layer.Gloves); CopyFromLayer(Caster, dg, Layer.Ring); CopyFromLayer(Caster, dg, Layer.Talisman); CopyFromLayer(Caster, dg, Layer.Neck); CopyFromLayer(Caster, dg, Layer.Hair); CopyFromLayer(Caster, dg, Layer.Waist); CopyFromLayer(Caster, dg, Layer.InnerTorso); CopyFromLayer(Caster, dg, Layer.Bracelet); CopyFromLayer(Caster, dg, Layer.Unused_xF); CopyFromLayer(Caster, dg, Layer.FacialHair); CopyFromLayer(Caster, dg, Layer.MiddleTorso); CopyFromLayer(Caster, dg, Layer.Earrings); CopyFromLayer(Caster, dg, Layer.Arms); CopyFromLayer(Caster, dg, Layer.Cloak); CopyFromLayer(Caster, dg, Layer.Backpack); CopyFromLayer(Caster, dg, Layer.OuterTorso); CopyFromLayer(Caster, dg, Layer.OuterLegs); CopyFromLayer(Caster, dg, Layer.InnerLegs); CopyFromLayer(Caster, dg, Layer.LastUserValid); CopyFromLayer(Caster, dg, Layer.Mount); dg.Owner = Caster; dg.OldBody = m_OldBody; m_Fake = dg; dg.Map = Caster.Map; dg.Location = Caster.Location; BaseArmor.ValidateMobile(Caster); m_OldBody = Caster.Body; Caster.BodyValue = 903; Caster.Blessed = true; StopTimer(Caster); Timer t = new InternalTimer(Caster, m_OldBody, m_Fake, this); m_Timers[Caster] = t; t.Start(); } else { Caster.SendLocalizedMessage(1005559); // This spell is already in effect. } } FinishSequence(); }
public InternalTimer(Mobile owner, int body, Souless m_Fake, AncientPeerSpell spell) : base(TimeSpan.FromSeconds(0)) { m_Owner = owner; m_OldBody = body; fake = m_Fake; m_spell = spell; int val = (int)owner.Skills[SkillName.Magery].Value; if (val > 100) val = 100; double loss2 = (0 - m_Owner.Skills[SkillName.Magery].Base); SkillMod sk2 = new DefaultSkillMod(SkillName.Magery, true, loss2); m_Owner.AddSkillMod(sk2); m_spell.m_PeerMod.Add(sk2); Delay = TimeSpan.FromSeconds(val); Priority = TimerPriority.TwoFiftyMS; }
public static void ApplySkillLoss( Mobile mob ) { SkillLossContext context; m_SkillLoss.TryGetValue( mob, out context ); if ( context == null ) { context = new SkillLossContext(); m_SkillLoss[mob] = context; List<SkillMod> mods = context.m_Mods = new List<SkillMod>(); for ( int i = 0; i < mob.Skills.Length; ++i ) { Skill sk = mob.Skills[i]; double baseValue = sk.Base; if ( baseValue > 0 ) { SkillMod mod = new DefaultSkillMod( sk.SkillName, true, -(baseValue * SkillLossFactor) ); mods.Add( mod ); mob.AddSkillMod( mod ); } } // Added by Silver: Skill Loss Reduction Faction faction = Faction.Find( mob ); int towns = faction.OwnedTowns; TimeSpan lossReduction = TimeSpan.FromMinutes( 0.25 - ( 0.025 * towns ) ); //PlayerState ps = PlayerState.Find( mob ); context.m_Timer = Timer.DelayCall( SkillLossPeriod - lossReduction, new TimerStateCallback( ClearSkillLoss_Callback ), mob ); } }
public override void OnDoubleClick( Mobile from ) { if ( IsLockedDown ) { if ( !from.InRange( this.Location, 2 ) ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that. return; } IHouse house = HousingHelper.FindHouseAt( from ); if ( house != null ) { from.PublicOverheadMessage( MessageType.Regular, 0x3B2, 1071131 ); // Praying… if ( m_CooldownList.Contains( from ) ) { from.SendLocalizedMessage( 1071145 ); // In order to summon an undead again, you have to wait for at least 90 minutes. } else { Timer.DelayCall( TimeSpan.FromSeconds( 5.0 ), new TimerCallback( delegate { // Add the skill mod SkillMod mod = new DefaultSkillMod( SkillName.SpiritSpeak, true, 5.0 ); mod.ObeyCap = true; from.AddSkillMod( mod ); m_Table[from] = new BonusContext( Timer.DelayCall( Duration, new TimerStateCallback<Mobile>( RemoveEffect ), from ), mod ); // Set the cooldown m_CooldownList.Add( from ); Timer.DelayCall( Cooldown, new TimerCallback( delegate { m_CooldownList.Remove( from ); } ) ); // Spawn our undead friend :) SummonUndead( from ); from.SendLocalizedMessage( 1071148 ); // You feel a greater sense. } ) ); } } else from.SendLocalizedMessage( 502436 ); // That is not accessible. } else from.SendLocalizedMessage( 502692 ); // This must be in a house and be locked down to work. }
public static MorphResult Morph( Mobile m, int entryID ) { if ( entryID < 0 || entryID >= m_Entries.Length ) return MorphResult.Fail; AnimalFormEntry entry = m_Entries[entryID]; m_LastAnimalForms[m] = entryID; //On OSI, it's the last /attempted/ one not the last succeeded one if ( m.Skills.Ninjitsu.Value < entry.ReqSkill ) { string args = String.Format( "{0}\t{1}\t ", entry.ReqSkill.ToString( "F1" ), SkillName.Ninjitsu ); m.SendLocalizedMessage( 1063013, args ); // You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability. return MorphResult.NoSkill; } /* if( !m.CheckSkill( SkillName.Ninjitsu, entry.ReqSkill, entry.ReqSkill + 37.5 ) ) return MorphResult.Fail; * * On OSI,it seems you can only gain starting at '0' using Animal form. */ double ninjitsu = m.Skills.Ninjitsu.Value; if ( ninjitsu < entry.ReqSkill + 37.5 ) { double chance = (ninjitsu - entry.ReqSkill) / 37.5; if ( chance < Utility.RandomDouble() ) return MorphResult.Fail; } m.CheckSkill( SkillName.Ninjitsu, 0.0, 37.5 ); BaseMount.Dismount( m ); m.BodyMod = entry.BodyMod; if ( entry.HueMod > 0 ) m.HueMod = entry.HueMod; if ( entry.SpeedBoost ) m.Send( SpeedControl.MountSpeed ); SkillMod mod = null; if ( entry.StealthBonus ) { mod = new DefaultSkillMod( SkillName.Stealth, true, 20.0 ); mod.ObeyCap = true; m.AddSkillMod( mod ); } Timer timer = new AnimalFormTimer( m, entry.BodyMod, entry.HueMod ); timer.Start(); AddContext( m, new AnimalFormContext( timer, mod, entry.SpeedBoost, entry.Type ) ); return MorphResult.Success; }
public static void ApplySkillLoss( Mobile mob ) { PlayerMobile Killer = mob as PlayerMobile; if ( mob.ShortTermMurders >= 5 && Killer.MurderBounty <= 0) { double loss = (100.0 - (19.0 + (mob.ShortTermMurders / 5.0))) / 100.0; // 20 to 30% loss if( loss < 0.75 ) loss = 0.60;// changed to .80 from .95 else if( loss > 0.95 ) loss = 0.60; // changed to .80 from /95 TimeSpan lossperiod = TimeSpan.FromMinutes( 240.0 ); loss = 1.0 - loss; ClearSkillLoss( mob ); SkillLossContext context = new SkillLossContext(); m_SkillLoss[mob] = context; List<SkillMod> mods = context.m_SkillMods = new List<SkillMod>(); for ( int i = 0; i < mob.Skills.Length; ++i ) { Skill sk = mob.Skills[i]; double baseValue = sk.Base; if ( baseValue > 0 ) { SkillMod mod = new DefaultSkillMod( sk.SkillName, true, -(baseValue * loss) ); mods.Add( mod ); mob.AddSkillMod( mod ); } } mob.AddStatMod( new StatMod( StatType.Str, "Murder Penalty Str", -(int)(mob.RawStr * loss), lossperiod ) ); mob.AddStatMod( new StatMod( StatType.Dex, "Murder Penalty Dex", -(int)(mob.RawDex * loss), lossperiod ) ); mob.AddStatMod( new StatMod( StatType.Int, "Murder Penalty Int", -(int)(mob.RawInt * loss), lossperiod ) ); context.m_Timer = Timer.DelayCall<Mobile>( lossperiod, new TimerStateCallback<Mobile>( ClearSkillLoss_Callback ), mob ); } else ///Removed short term statloss. if ( mob.ShortTermMurders < 5 && Killer.MurderBounty > 0 ) { double loss = (100.0 - (19.0 + (Killer.MurderBounty / 10000.0))) / 100.0; // 20 to 30% loss if( loss < 0.75 ) loss = 0.60;// changed to .80 from .95 else if( loss > 0.95 ) loss = 0.60; // changed to .80 from /95 mob.SendMessage( "Current MurderBounty: " + Killer.MurderBounty); double timeloss = (double)Killer.MurderBounty/33.3; TimeSpan lossperiod = TimeSpan.FromMinutes( timeloss ); int m = (int)Math.Round( timeloss ); mob.SendMessage( "You have entered a bounty statloss for: " + m + " minutes."); loss = 1.0 - loss; ClearSkillLoss( mob ); SkillLossContext context = new SkillLossContext(); m_SkillLoss[mob] = context; List<SkillMod> mods = context.m_SkillMods = new List<SkillMod>(); for ( int i = 0; i < mob.Skills.Length; ++i ) { Skill sk = mob.Skills[i]; double baseValue = sk.Base; if ( baseValue > 0 ) { SkillMod mod = new DefaultSkillMod( sk.SkillName, true, -(baseValue * loss) ); mods.Add( mod ); mob.AddSkillMod( mod ); } } mob.AddStatMod( new StatMod( StatType.Str, "Murder Penalty Str", -(int)(mob.RawStr * loss), lossperiod ) ); mob.AddStatMod( new StatMod( StatType.Dex, "Murder Penalty Dex", -(int)(mob.RawDex * loss), lossperiod ) ); mob.AddStatMod( new StatMod( StatType.Int, "Murder Penalty Int", -(int)(mob.RawInt * loss), lossperiod ) ); context.m_Timer = Timer.DelayCall<Mobile>( lossperiod, new TimerStateCallback<Mobile>( ClearSkillLoss_Callback ), mob ); } else if ( mob.ShortTermMurders >= 5 && Killer.MurderBounty > 0 ) { double loss = (100.0 - (19.0 + (mob.ShortTermMurders / 5.0))) / 100.0; // 20 to 30% loss if( loss < 0.75 ) loss = 0.60;// changed to .80 from .95 else if( loss > 0.95 ) loss = 0.60; // changed to .80 from /95 mob.SendMessage( "Current MurderBounty: " + Killer.MurderBounty); double timeloss = (double)Killer.MurderBounty/33.3; TimeSpan lossperiod = TimeSpan.FromMinutes( timeloss + 240.0); Killer.MurderBounty = 0; int m = (int)Math.Round( timeloss + 240.0); mob.SendMessage( "You have entered statloss for: " + m + " minutes."); loss = 1.0 - loss; ClearSkillLoss( mob ); SkillLossContext context = new SkillLossContext(); m_SkillLoss[mob] = context; List<SkillMod> mods = context.m_SkillMods = new List<SkillMod>(); for ( int i = 0; i < mob.Skills.Length; ++i ) { Skill sk = mob.Skills[i]; double baseValue = sk.Base; if ( baseValue > 0 ) { SkillMod mod = new DefaultSkillMod( sk.SkillName, true, -(baseValue * loss) ); mods.Add( mod ); mob.AddSkillMod( mod ); } } mob.AddStatMod( new StatMod( StatType.Str, "Murder Penalty Str", -(int)(mob.RawStr * loss), lossperiod ) ); mob.AddStatMod( new StatMod( StatType.Dex, "Murder Penalty Dex", -(int)(mob.RawDex * loss), lossperiod ) ); mob.AddStatMod( new StatMod( StatType.Int, "Murder Penalty Int", -(int)(mob.RawInt * loss), lossperiod ) ); context.m_Timer = Timer.DelayCall<Mobile>( lossperiod, new TimerStateCallback<Mobile>( ClearSkillLoss_Callback ), mob ); } }
public static void ApplySkillLoss( Mobile mob ) { SkillLossContext context = (SkillLossContext)m_SkillLoss[mob]; if ( context != null ) return; context = new SkillLossContext(); m_SkillLoss[mob] = context; ArrayList mods = context.m_Mods = new ArrayList(); for ( int i = 0; i < mob.Skills.Length; ++i ) { Skill sk = mob.Skills[i]; double baseValue = sk.Base; if ( baseValue > 0 ) { SkillMod mod = new DefaultSkillMod( sk.SkillName, true, -(baseValue * SkillLossFactor) ); mods.Add( mod ); mob.AddSkillMod( mod ); } } // jakob, added this to shorten skillloss timer by 1 minute per owned town int ownedTowns = 0; PlayerState ps = PlayerState.Find( mob ); if ( ps != null ) foreach ( Town town in Town.Towns ) { if ( town.Owner == ps.Faction ) ownedTowns++; } context.m_Timer = Timer.DelayCall( SkillLossPeriod - TimeSpan.FromMinutes( (double)ownedTowns ), new TimerStateCallback( ClearSkillLoss_Callback ), mob ); // end }