private static bool CanChange( PlayerMobile from, Race targetRace ) { if ( from.Deleted ) return false; if ( from.Race == targetRace ) from.SendLocalizedMessage( 1111918 ); // You are already that race. else if ( !MondainsLegacy.CheckML( from, false ) ) from.SendLocalizedMessage( 1073651 ); // You must have Mondain's Legacy before proceeding... else if ( !from.Alive ) from.SendLocalizedMessage( 1073646 ); // Only the living may proceed... else if ( from.Mounted ) from.SendLocalizedMessage( 1073647 ); // You may not continue while mounted... else if ( !from.CanBeginAction( typeof( PolymorphSpell ) ) || DisguiseTimers.IsDisguised( from ) || AnimalForm.UnderTransformation( from ) || !from.CanBeginAction( typeof( IncognitoSpell ) ) || from.IsBodyMod ) // TODO: Does this cover everything? from.SendLocalizedMessage( 1073648 ); // You may only proceed while in your original state... else if ( from.Spell != null && from.Spell.IsCasting ) from.SendLocalizedMessage( 1073649 ); // One may not proceed while embracing magic... else if ( from.Poisoned ) from.SendLocalizedMessage( 1073652 ); // You must be healthy to proceed... else if ( IsWearingEquipment( from ) ) from.SendLocalizedMessage( 1073650 ); // To proceed you must be unburdened by equipment... else return true; return false; }
public static void OnVirtueAccepted( PlayerMobile protector, PlayerMobile protectee ) { if ( !VirtueHelper.IsSeeker( protector, VirtueName.Justice ) ) { protector.SendLocalizedMessage( 1049610 ); // You must reach the first path in this virtue to invoke it. } else if ( !protector.CanBeginAction( typeof( JusticeVirtue ) ) ) { protector.SendLocalizedMessage( 1049370 ); // You must wait a while before offering your protection again. } else if ( protector.JusticeProtectors.Count > 0 ) { protector.SendLocalizedMessage( 1049542 ); // You cannot protect someone while being protected. } else if ( protector.Map != Map.Felucca ) { protector.SendLocalizedMessage( 1049372 ); // You cannot use this ability here. } else if ( protectee.Map != Map.Felucca ) { protector.SendLocalizedMessage( 1049372 ); // You cannot use this ability here. } else if ( protectee == protector || protectee.Criminal || protectee.Kills >= 5 ) { protector.SendLocalizedMessage( 1049436 ); // That player cannot be protected. } else if ( protectee.JusticeProtectors.Count > 0 ) { protector.SendLocalizedMessage( 1049369 ); // You cannot protect that player right now. } else { protectee.JusticeProtectors.Add( protector ); string args = String.Format( "{0}\t{1}", protector.Name, protectee.Name ); protectee.SendLocalizedMessage( 1049451, args ); // You are now being protected by ~1_NAME~. protector.SendLocalizedMessage( 1049452, args ); // You are now protecting ~2_NAME~. } }
public bool ApplyMagicReflectEffect(PlayerMobile Wearer) { if (Wearer == null) return false; Spell spell = new MagicReflectSpell(Wearer,null); if ( Wearer.MagicDamageAbsorb > 0 ) { Wearer.SendMessage("The magic of this item is already protecting you."); return false; } else if (Wearer.Region.OnBeginSpellCast( Wearer, spell ) == false) { Wearer.SendMessage("The magic normally within this object seems absent."); return false; } else if ( !Wearer.CanBeginAction( typeof( DefensiveSpell ) ) ) { Wearer.SendLocalizedMessage( 1005385 ); // The spell will not adhere to you at this time. return false; } else { if ( Wearer.BeginAction( typeof( DefensiveSpell ) ) ) { int value = (int)((Utility.Random(51) + 50) + (Utility.Random(51) + 50)); // Random value of up to 100 for magery and up to 100 for scribing - lowest though is 50 magery/50 scribing equivalent strength value = (int)(8 + (value/200)*7.0);//absorb from 8 to 15 "circles" Wearer.MagicDamageAbsorb = value; Wearer.FixedParticles( 0x375A, 10, 15, 5037, EffectLayer.Waist ); Wearer.PlaySound( 0x1E9 ); Wearer.SendMessage("You feel the magic of the item envelope you."); return true; } else { Wearer.SendLocalizedMessage( 1005385 ); // The spell will not adhere to you at this time. return false; } } }