public void RemoveAttributeMod( AttributeMod mod ) { if ( mod == null ) return; if ( m_AttributeMods != null ) { m_AttributeMods.Remove( mod ); if ( m_AttributeMods.Count == 0 ) m_AttributeMods = null; } InvalidateProperties(); }
public override void AddEffect( BaseCreature pet ) { base.AddEffect( pet ); AttributeMod dmgMod = new AttributeMod( MagicalAttribute.WeaponDamage, 10 ); pet.AddAttributeMod( dmgMod ); Timer.DelayCall( Duration, new TimerCallback( delegate { pet.RemoveAttributeMod( dmgMod ); } ) ); }
public void AddAttributeMod( AttributeMod mod ) { if ( m_AttributeMods == null ) m_AttributeMods = new List<AttributeMod>( 1 ); m_AttributeMods.Add( mod ); InvalidateProperties(); }
public override void OnDoubleClick( Mobile from ) { PlayerMobile pm = from as PlayerMobile; if ( pm == null ) return; if ( m_Bonuses.Contains( pm ) ) { // You're still feeling lucky from the last time you touched the sculpture. pm.SendLocalizedMessage( 1079534 ); } else if ( pm.NextTenthAnniversarySculptureUse > DateTime.Now ) { TimeSpan delta = pm.NextTenthAnniversarySculptureUse - DateTime.Now; if ( delta < TimeSpan.FromHours( 1.0 ) ) { // You can improve your fortunes in about ~1_TIME~ minutes. pm.SendLocalizedMessage( 1079548, ( (int) delta.TotalMinutes ).ToString() ); } else { // You can improve your fortunes again in about ~1_TIME~ hours. pm.SendLocalizedMessage( 1079550, ( (int) delta.TotalHours ).ToString() ); } } else { int luckBonus = ComputeLuckBonus( pm ); AttributeMod luckMod = new AttributeMod( MagicalAttribute.Luck, luckBonus ); pm.AddAttributeMod( luckMod ); m_Bonuses.Add( pm ); pm.NextTenthAnniversarySculptureUse = DateTime.Now + TimeSpan.FromDays( 1.0 ); pm.SendLocalizedMessage( 1079551 ); // Your luck just improved! Timer.DelayCall( TimeSpan.FromHours( 1.0 ), delegate { pm.RemoveAttributeMod( luckMod ); m_Bonuses.Remove( pm ); pm.SendLocalizedMessage( 1079552 ); // Your luck just ran out. } ); } }