public override void OnHit( Mobile attacker, Mobile defender, int damage )
		{
			if( !Validate( attacker ) || !CheckMana( attacker, true ) )
				return;

			ClearCurrentAbility( attacker );

			attacker.SendLocalizedMessage( 1063353 ); // You perform a masterful defense!

			attacker.FixedParticles( 0x375A, 1, 17, 0x7F2, 0x3E8, 0x3, EffectLayer.Waist );

			int modifier = (int)(30.0 * ((Math.Max( attacker.Skills[SkillName.Bushido].Value, attacker.Skills[SkillName.Ninjitsu].Value ) - 50.0) / 70.0));

			DefenseMasteryInfo info = m_Table[attacker] as DefenseMasteryInfo;

			if( info != null )
				EndDefense( (object)info );

			ResistanceMod mod = new ResistanceMod( ResistanceType.Physical, 50 + modifier );
			attacker.AddResistanceMod( mod );

			info = new DefenseMasteryInfo( attacker, 80 - modifier, mod );
			info.m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 3.0 ), new TimerStateCallback( EndDefense ), info );

			m_Table[attacker] = info;

			attacker.Delta( MobileDelta.WeaponDamage );
		}
        public static void AddContext( Mobile m, TransformContext context )
        {
            m_Table[m] = context;

            if ( context.Type == typeof( HorrificBeastSpell ) )
                m.Delta( MobileDelta.WeaponDamage );
        }
Example #3
0
        public override void OnEnter(Mobile m)
        {
            if (!Controller.InUse)
                return;

            m.Delta(MobileDelta.Noto);
            m.InvalidateProperties();
        }
Example #4
0
 public static void Cure( Mobile who )
 {
     if ( who == null )
         return;
     PoisonAttachment attachment = XmlAttach.FindAttachment( who, typeof( PoisonAttachment ) ) as PoisonAttachment;
     if ( attachment != null )
     {
         attachment.Delete();
         who.SendMessage( 83, "You have been cured of poison." );
         who.Delta( MobileDelta.Flags ); // update bar
     }
 }
Example #5
0
        public static void RemoveBuff(Mobile from, FishPieEffect type)
        {
            if(!m_EffectsList.ContainsKey(from))
                return;

            if (m_EffectsList[from] != null && m_EffectsList[from].Contains(type))
                m_EffectsList[from].Remove(type);

            if (m_EffectsList[from] == null || m_EffectsList[from].Count == 0)
                m_EffectsList.Remove(from);

            BuffInfo.RemoveBuff(from, BuffIcon.FishPie);
            from.Delta(MobileDelta.WeaponDamage);
        }
        public override void OnEnter(Mobile m)
        {
        	if (!Controller.InUse)
                return;
                
			m.SendMessage("Your mana is being regenerated faster!");
			
            if (m is PlayerMobile) 
            { 
            	HealManaTimer timer = new HealManaTimer( m );
            	PlayerTimers.Add(timer);
          		timer.Start();
            }

            m.Delta(MobileDelta.Noto);
            m.InvalidateProperties();
        }
Example #7
0
        public override void OnEnter(Mobile m)
        {
            if (!Controller.InUse)
                return;
                
            if (m is EnergyVortex)
            {
            	EnergyVortex ev = (EnergyVortex) m;
            	Controller.EVsAndBSsAdd(ev);
            }
            else if( m is BladeSpirits )
            {
            	BladeSpirits bs = (BladeSpirits) m;
            	Controller.EVsAndBSsAdd(bs);
            }

            m.Delta(MobileDelta.Noto);
            m.InvalidateProperties();
        }
Example #8
0
		public virtual void OnEnter(PvPRegion region, Mobile m)
		{
			if (region == null || m == null || m.Deleted)
			{
				return;
			}

			var pm = m as PlayerMobile;

			if (pm != null)
			{
				if (region.IsPartOf(BattleRegion))
				{
					pm.SendMessage("You have entered {0}", Name);
				}
				else if (region.IsPartOf(SpectateRegion))
				{
					pm.SendMessage("You have entered {0} spectator area.", Name);

					if (!IsSpectator(pm))
					{
						AddSpectator(pm, false);
					}
				}
			}

			m.Delta(MobileDelta.Noto);
		}
Example #9
0
        public void AddMember( Mobile mob )
        {
            Members.Add( new PlayerState( mob, this, Members ) );
            Item item = mob.FindItemOnLayer( Layer.OuterTorso ) as Item;
            if( item != null )
            {
                if ( item.Movable == false )
                {
                    mob.AddToBackpack( FactionItem.Imbue( new Robe(), this, false, Definition.HuePrimary ) );
                    mob.SendAsciiMessage( "You have been granted a robe which signifies your faction." );
                }

                if ( item.Movable == true )
                {
                    mob.AddToBackpack( item );
                    mob.EquipItem( FactionItem.Imbue( new Robe(), this, false, Definition.HuePrimary ) );
                    mob.SendAsciiMessage( "You have been granted a robe which signifies your faction." );
                }
            }
            else
            {
                mob.EquipItem( FactionItem.Imbue( new Robe(), this, false, Definition.HuePrimary ) );
                mob.SendAsciiMessage( "You have been granted a robe which signifies your faction." );
            }

            mob.InvalidateProperties();
            mob.Delta( MobileDelta.Noto );
        }
Example #10
0
        public static void DoEffects(Mobile from)
        {
            if (Table == null)
                Table = new Dictionary<Mobile, Timer>();

            if (!Table.ContainsKey(from))
            {
                Table[from] = Timer.DelayCall(TimeSpan.FromSeconds(5), () =>
                    {
                        EndEffects(from);
                    });

                from.Send(SpeedControl.WalkSpeed);
                from.SendLocalizedMessage(1150886); // Splashes from the creature encrust your weapon and equipment, slowing your movement.

                from.Delta(MobileDelta.WeaponDamage);
            }
        }
Example #11
0
		public void SwitchTeams( Mobile from, CTFTeam team )
		{
			CTFTeam old = GetTeam( from );
			if ( old == team )
				return;
			else if ( old != null )
				old.RemoveMember( from );

			team.AddMember( from );
			from.Delta( MobileDelta.Noto );
                        from.Blessed = true;

			Item robe = from.FindItemOnLayer( Layer.OuterTorso );
			if ( robe is CTFRobe )
			{
				robe.Name = "Game Robe";
				robe.Hue = 0;
			}
			else
			{
				if ( robe != null )
				{
					if ( robe.Movable )
						from.AddToBackpack( robe );
					else
						robe.Delete();
				}
				
				robe = new CTFRobe( team );
				from.EquipItem( robe );
			}
		}
Example #12
0
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		public void LeaveGame( Mobile m )
		{
                        m.MoveToWorld( new Point3D( 1563, 1739, 15 ), Map.Felucca );
			CTFTeam t = GetTeam( m );
			if ( t != null )
				t.RemoveMember( m );
                        m.SolidHueOverride = -1;
			
			Item robe = m.FindItemOnLayer( Layer.OuterTorso );
			if ( robe is CTFRobe )
				robe.Delete();
			if ( m.Backpack != null )
			{
				Item[] robes = m.Backpack.FindItemsByType( typeof( CTFRobe ) );
				for(int i=0;i<robes.Length;i++)
					robes[i].Delete();
			}

			m.Delta( MobileDelta.Noto );

				
		}
Example #13
0
		public static void RemoveStatBonuses( Mobile from, Item item )
		{			
			string modName = item.Serial.ToString();
			
			from.RemoveStatMod( modName + "SetStr" );
			from.RemoveStatMod( modName + "SetDex" );
			from.RemoveStatMod( modName + "SetInt" );
			
			from.Delta( MobileDelta.Armor );
			from.CheckStatTimers();
		}
        /// <summary>
        /// Will remove the player from the game.
        /// </summary>
        /// <param name="m"></param>
        public static void LeaveGame(Mobile m)
        {
            if (!CTFGame.Running)
                return;

            CTFPlayerGameData pgd = GameData.GetPlayerData(m);

            if (pgd != null)
            {
                pgd.InGame = false;
                RemoveItems(m);
                SunnySystem.DisArmPlayer(m);

                m.Criminal = false;
                m.InvalidateProperties();
                m.Warmode = false;
                m.Aggressed.Clear();
                m.Aggressors.Clear();

                EventSystem.RemoveToRandomLoc(m);
                SunnySystem.ReDress(m);
                m.Delta(MobileDelta.Noto);
                m.InvalidateProperties();
            }
            else if (PlayerJoinList.Contains(m)) {
                try {
                    PlayerJoinList.Remove(m);
                    EventSystem.RemoveToRandomLoc(m);
                    SunnySystem.ReDress(m);
                } catch {}
            } else
                EventSystem.RemoveToRandomLoc(m);
        }
Example #15
0
        public override bool IsHarmfulCriminal(Mobile target)
        {
            if (SkillHandlers.Stealing.ClassicMode && target is PlayerMobile && ((PlayerMobile)target).m_PermaFlags.Count > 0)
            {
                int noto = Notoriety.Compute(this, target);

                if (noto == Notoriety.Innocent)
                    target.Delta(MobileDelta.Noto);

                return false;
            }

            if (target is BaseCreature && ((BaseCreature)target).InitialInnocent && !((BaseCreature)target).Controlled)
                return false;

            return base.IsHarmfulCriminal(target);
        }
Example #16
0
		public void AddFriend( Mobile from, Mobile targ )
		{
			if ( !IsCoOwner( from ) || m_Friends == null || m_CoOwners == null )
				return;

			if ( IsOwner( targ ) )
			{
				from.SendLocalizedMessage( 501370 ); // This person is already an owner of the house!
			}
			else if ( m_CoOwners.Contains( targ ) )
			{
				from.SendLocalizedMessage( 501369 ); // This person is already on your co-owner list!
			}
			else if ( !targ.Player )
			{
				from.SendLocalizedMessage( 501371 ); // That can't be a friend of the house.
			}
			else if ( IsBanned( targ ) )
			{
				from.SendLocalizedMessage( 501374 ); // This person is banned!  Unban them first.
			}
			else if ( m_Friends.Count >= MaxFriends )
			{
				from.SendLocalizedMessage( 501375 ); // Your friends list is full!
			}
			else if ( m_Friends.Contains( targ ) )
			{
				from.SendLocalizedMessage( 501376 ); // This person is already on your friends list!
			}
			else
			{
				m_Friends.Add( targ );

				targ.Delta( MobileDelta.Noto );
				targ.SendLocalizedMessage( 501337 ); // You have been made a friend of this house.
			}
		}
Example #17
0
		public void AddCoOwner( Mobile from, Mobile targ )
		{
			if ( !IsOwner( from ) || m_CoOwners == null || m_Friends == null )
				return;

			if ( IsOwner( targ ) )
			{
				from.SendLocalizedMessage( 501360 ); // This person is already the house owner!
			}
			else if ( m_Friends.Contains( targ ) )
			{
				from.SendLocalizedMessage( 501361 ); // This person is a friend of the house. Remove them first.
			}
			else if ( !targ.Player )
			{
				from.SendLocalizedMessage( 501362 ); // That can't be a co-owner of the house.
			}
			else if ( HasAccountHouse( targ ) )
			{
				from.SendLocalizedMessage( 501364 ); // That person is already a house owner.
			}
			else if ( IsBanned( targ ) )
			{
				from.SendLocalizedMessage( 501367 ); // This person is banned!  Unban them first.
			}
			else if ( m_CoOwners.Count >= MaxCoOwners )
			{
				from.SendLocalizedMessage( 501368 ); // Your co-owner list is full!
			}
			else if ( m_CoOwners.Contains( targ ) )
			{
				from.SendLocalizedMessage( 501369 ); // This person is already on your co-owner list!
			}
			else
			{
				m_CoOwners.Add( targ );

				targ.Delta( MobileDelta.Noto );
				targ.SendLocalizedMessage( 501343 ); // You have been made a co-owner of this house.
			}
		}
Example #18
0
        public static void EndEffects(Mobile from)
        {
            if (IsUnderEffects(from))
            {
                Table.Remove(from);
                from.SendLocalizedMessage(1150887); // You are no longer slowed and encrusted.

                from.Send(SpeedControl.Disable);

                from.Delta(MobileDelta.WeaponDamage);
            }
        }
Example #19
0
        public void AddMember( Mobile mob )
        {
            Members.Add( new PlayerState( mob, this, Members ) );

            mob.AddToBackpack( FactionItem.Imbue( new Robe(), this, false, Definition.HuePrimary ) );
            mob.SendLocalizedMessage( 1010374 ); // You have been granted a robe which signifies your faction

            mob.InvalidateProperties();
            mob.Delta( MobileDelta.Noto );

            var followers = World.Instance.Mobiles
                .OfType<BaseCreature>()
                .Where( bc => bc.Controlled && bc.ControlMaster == mob );

            foreach ( Mobile follower in followers )
            {
                follower.InvalidateProperties();
                follower.Delta( MobileDelta.Noto );
            }

            mob.FixedEffect( 0x373A, 10, 30 );
            mob.PlaySound( 0x209 );
        }
Example #20
0
        public void RemoveMember( Mobile mob )
        {
            PlayerState pl = PlayerState.Find( mob );

            if ( pl == null || !Members.Contains( pl ) )
                return;

            Members.Remove( pl );

            if ( mob is PlayerMobile )
                ( (PlayerMobile) mob ).FactionPlayerState = null;

            mob.InvalidateProperties();
            mob.Delta( MobileDelta.Noto );

            // TODO: refactor this, maybe a Mobile.GetFollowers() ?
            var followers = World.Instance.Mobiles
                .OfType<BaseCreature>()
                .Where( bc => bc.Controlled && bc.ControlMaster == mob );

            foreach ( Mobile follower in followers )
            {
                follower.InvalidateProperties();
                follower.Delta( MobileDelta.Noto );
            }

            if ( Election.IsCandidate( mob ) )
                Election.RemoveCandidate( mob );

            Election.RemoveVoter( mob );

            if ( pl.Finance != null )
                pl.Finance.Finance = null;

            if ( pl.Sheriff != null )
                pl.Sheriff.Sheriff = null;

            if ( Commander == mob )
                Commander = null;

            if ( mob is PlayerMobile )
                ( (PlayerMobile) mob ).ValidateEquipment();
        }
        public void SetHue( Mobile m, int id )
        {
            if( m is PlayerMobile && !m_IgnoreChecks && !m_HairDressing )
                ( (PlayerMobile)m ).Disguise.Hue = id;
            else
                m.Hue = id;

            m.Delta( MobileDelta.Hue );
            m.Delta( MobileDelta.Hair );
            m.Delta( MobileDelta.FacialHair );
        }
Example #22
0
		public virtual void OnExit(PvPRegion region, Mobile m)
		{
			if (region == null || m == null || m.Deleted)
			{
				return;
			}

			var pm = m as PlayerMobile;

			if (pm != null)
			{
				if (region.IsPartOf(BattleRegion))
				{
					if (IsParticipant(pm))
					{
						Eject(pm, false);
					}

					pm.SendMessage("You have left {0}", Name);
				}
				else if (region.IsPartOf(SpectateRegion))
				{
					pm.SendMessage("You have left {0} spectator area", Name);

					if (IsSpectator(pm))
					{
						RemoveSpectator(pm, false);
					}
				}
			}

			m.Delta(MobileDelta.Noto);
		}
Example #23
0
		public virtual void AddMember( Mobile mob )
		{
			Members.Insert( ZeroRankOffset, new PlayerState( mob, this, Members ) );

			mob.AddToBackpack( FactionItem.Imbue( new Robe(), this, false, Definition.HuePrimary ) );
			mob.SendLocalizedMessage( 1010374 ); // You have been granted a robe which signifies your faction

			mob.InvalidateProperties();
			mob.Delta( MobileDelta.Noto );

			mob.FixedEffect( 0x373A, 10, 30 );
			mob.PlaySound( 0x209 );
		}
Example #24
0
        public void RemoveMember( Mobile mob )
        {
            PlayerState pl = PlayerState.Find( mob );

            if ( pl == null || !Members.Contains( pl ) )
                return;

            Members.Remove( pl );

            if ( mob is PlayerMobile )
                ((PlayerMobile)mob).FactionPlayerState = null;

            mob.InvalidateProperties();
            mob.Delta( MobileDelta.Noto );

            if ( Election.IsCandidate( mob ) )
                Election.RemoveCandidate( mob );

            Election.RemoveVoter( mob );

            if ( pl.Finance != null )
                pl.Finance.Finance = null;

            if ( pl.Sheriff != null )
                pl.Sheriff.Sheriff = null;

            if ( Commander == mob )
                Commander = null;

            if ( mob is PlayerMobile )
                ((PlayerMobile)mob).ValidateEquipment();
        }
Example #25
0
		public void RemoveCoOwner( Mobile from, Mobile targ )
		{
			if ( !IsOwner( from ) || m_CoOwners == null )
				return;

			if ( m_CoOwners.Contains( targ ) )
			{
				m_CoOwners.Remove( targ );

				targ.Delta( MobileDelta.Noto );

				from.SendLocalizedMessage( 501299 ); // Co-owner removed from list.
				targ.SendLocalizedMessage( 501300 ); // You have been removed as a house co-owner.

				foreach ( SecureInfo info in m_Secures )
				{
					Container c = info.Item;

					if ( c is StrongBox && ((StrongBox)c).Owner == targ )
					{
						c.IsLockedDown = false;
						c.IsSecure = false;
						m_Secures.Remove( c );
						c.Destroy();
						break;
					}
				}
			}
		}
Example #26
0
		public void RemoveMember( Mobile mob )
		{
			PlayerState pl = PlayerState.Find( mob );

			if ( pl == null || !Members.Contains( pl ) )
				return;

			int killPoints = pl.KillPoints;

			if( mob.Backpack != null )
			{
				//Ordinarily, through normal faction removal, this will never find any sigils.
				//Only with a leave delay less than the ReturnPeriod or a Faction Kick/Ban, will this ever do anything
				Item[] sigils = mob.Backpack.FindItemsByType( typeof( Sigil ) );

				for ( int i = 0; i < sigils.Length; ++i )
					((Sigil)sigils[i]).ReturnHome();
			}

			if ( pl.RankIndex != -1 ) {
				while ( ( pl.RankIndex + 1 ) < ZeroRankOffset ) {
					PlayerState pNext = Members[pl.RankIndex+1];
					Members[pl.RankIndex+1] = pl;
					Members[pl.RankIndex] = pNext;
					pl.RankIndex++;
					pNext.RankIndex--;
				}

				ZeroRankOffset--;
			}

			Members.Remove( pl );

			if ( mob is PlayerMobile )
				((PlayerMobile)mob).FactionPlayerState = null;

			mob.InvalidateProperties();
			mob.Delta( MobileDelta.Noto );

			if ( Election.IsCandidate( mob ) )
				Election.RemoveCandidate( mob );

			Election.RemoveVoter( mob );

			if ( pl.Finance != null )
				pl.Finance.Finance = null;

			if ( pl.Sheriff != null )
				pl.Sheriff.Sheriff = null;

			if ( Commander == mob )
				Commander = null;

			if ( mob is PlayerMobile )
				((PlayerMobile)mob).ValidateEquipment();

			if ( killPoints > 0 )
				DistributePoints( killPoints );
		}
Example #27
0
		public void RemoveFriend( Mobile from, Mobile targ )
		{
			if ( !IsCoOwner( from ) || m_Friends == null )
				return;

			if ( m_Friends.Contains( targ ) )
			{
				m_Friends.Remove( targ );

				targ.Delta( MobileDelta.Noto );

				from.SendLocalizedMessage( 501298 ); // Friend removed from list.
				targ.SendLocalizedMessage( 1060751 ); // You are no longer a friend of this house.
			}
		}
Example #28
0
 /// <summary>
 /// Remove all ill effects from a player.
 /// </summary>
 /// <param name="pm"></param>
 public void CleanPlayer(Mobile pm)
 {
     //Cure Poison
     pm.CurePoison(pm);
     //Reset Hit Points
     pm.Hits = pm.HitsMax;
     //Rest Mana
     pm.Mana = pm.ManaMax;
     //Reset Stam
     pm.Stam = pm.StamMax;
     //Cancel any targeting
     Targeting.Target.Cancel(pm);
     //remove abosorption for magic
     pm.MagicDamageAbsorb = 0;
     //remove absorption for melee
     pm.MeleeDamageAbsorb = 0;
     //clear protection spell
     Spells.Second.ProtectionSpell.Registry.Remove(pm);
     //clear curse effect
     Spells.Fourth.CurseSpell.RemoveEffect(pm);
     //clear corpseskin
     Server.Spells.Necromancy.CorpseSkinSpell.RemoveCurse(pm);
     //clear blodd oath
     Server.Spells.Necromancy.BloodOathSpell.RemoveCurse(pm);
     //clear evil omen
     //Server.Spells.Necromancy.EvilOmenSpell.RemoveCurse(pm);
     //remove strangle
     Server.Spells.Necromancy.StrangleSpell.RemoveCurse(pm);
     //clear Paralyzed
     pm.Paralyzed = false;
     //clear defensive spell
     DefensiveSpell.Nullify(pm);
     //remove any combatant
     pm.Combatant = null;
     //remove war mode
     pm.Warmode = false;
     //remove criminal
     pm.Criminal = false;
     //clear agressed list
     pm.Aggressed.Clear();
     //clear agressor list
     pm.Aggressors.Clear();
     //clear delta notoriety
     pm.Delta(MobileDelta.Noto);
     //invalidate any properties due to the previous changes
     pm.InvalidateProperties();
 }
Example #29
0
        public void RemoveMember( Mobile m, int message )
        {
            if ( m_Members.Contains( m ) )
            {
                m_Members.Remove( m );

                Guild guild = m.Guild as Guild;

                m.Guild = null;

                if( m is PlayerMobile )
                    ((PlayerMobile)m).GuildRank = RankDefinition.Lowest;

                if( message > 0 )
                    m.SendLocalizedMessage( message );

                if ( m == m_Leader )
                {
                    CalculateGuildmaster();

                    if ( m_Leader == null )
                        Disband();
                }

                if ( m_Members.Count == 0 )
                    Disband();

                if ( guild != null )
                    guild.InvalidateWarNotoriety();

                m.Delta( MobileDelta.Noto );
            }
        }
		public static void RemoveContext( Mobile m, TransformContext context, bool resetGraphics )
		{
			m_Table.Remove( m );

			List<ResistanceMod> mods = context.Mods;

			for ( int i = 0; i < mods.Count; ++i )
				m.RemoveResistanceMod( mods[i] );

			if ( resetGraphics )
			{
				m.HueMod = -1;
				m.BodyMod = 0;
			}

			context.Timer.Stop();

			if ( context.Type == typeof( HorrificBeastSpell ) )
				m.Delta( MobileDelta.WeaponDamage );
		}