Example #1
0
        public void BuffCreature(BaseLinkedCreature creature)
        {
            //the buff process is as follows:

            //*give 10% of the killed creature's max hits
            //*increase their resists by 5% of the killed creature, to a maximum of 95

            creature.Hits += creature.HitsMax / 10;

            for (int i = 0; i < 5; i++)
            {
                int newresist = Math.Min(95, creature.Resistances[i] + (int)(this.Resistances[i] * .05));

                creature.SetResistance((ResistanceType)i, newresist, newresist);
            }
        }
Example #2
0
        public void Unlink(BaseLinkedCreature creature)
        {
            if (_LinkedCreatures.IndexOf(creature) != -1)
            {
                if (DebugLinkedCreatures)
                {
                    PublicOverheadMessage(MessageType.Emote, EmoteHue, false, "*Unlinking a fallen linked creature*");
                }

                PlaySound(KillLinkedSound);
                FixedEffect(KillLinkedEffect, 10, 5);



                _LinkedCreatures.Remove(creature);
            }
        }
Example #3
0
        //this begins the attempt to link this creature to another creature
        protected bool LinkToCreature(BaseLinkedCreature creature)
        {
            Type linktype = null;

            //determine what type to link to
            if (CrossCreatureLink)
            {
                //attempt to link to any base linked creature
                linktype = typeof(BaseLinkedCreature);
            }
            else
            {
                //link to only creatures of this same type
                linktype = this.GetType();
            }

            //check for matching types
            if ((creature.GetType() != linktype && !CrossCreatureLink) || creature == this)
            {
                return(false);
            }

            //will not link if it has achieved maximum link count
            if (MaxLinkNum > 0 && _LinkedCreatures.Count >= MaxLinkNum)
            {
                return(false);
            }


            //check if these two creatures can link.  During this check, the other creature will link up
            //if they're compatable
            if (!creature.LinkTo(this))
            {
                return(false);
            }

            //use this method in reverse to perform the local link operation
            return(LinkTo(creature));
        }
Example #4
0
        //this determines if the item is "guarded" by linked creatures.  Depending on this object's
        public static bool IsAccessible(Item item)
        {
            Type guardtype = null;

            //if the item supports the ILinkedCreatureObject interface, then it can be custom defined
            if (item is ILinkedCreatureObject)
            {
                guardtype = ((ILinkedCreatureObject)item).LinkedCreatureGuardType;
            }

            //default checks is on BaseLinkedCreature
            if (guardtype == null)
            {
                guardtype = typeof(BaseLinkedCreature);
            }


            //instance the guard type to determine its guarding scope

            BaseLinkedCreature testcreature = null;


            try
            {
                testcreature = (BaseLinkedCreature)Activator.CreateInstance(guardtype);
            }
            catch
            {
                //cheap, but effective
                testcreature = new BaseLinkedCreature(AIType.AI_Melee, FightMode.Closest, 0, 0, 0, 0);
            }

            bool globalguard     = testcreature.GlobalScopeLink;
            int  guardcheckrange = testcreature.LocalLinkPerceptionRange;

            //clean up after self
            testcreature.Delete();

            if (globalguard)
            {
                foreach (Mobile m in World.Mobiles.Values)
                {
                    //if a guard is still found
                    if (m.GetType() == guardtype || m.GetType().IsSubclassOf(guardtype))
                    {
                        //this recloses doors and such if they're sitting open
                        if (item is ILinkedCreatureObject)
                        {
                            ((ILinkedCreatureObject)item).Lockdown();
                        }


                        return(false);
                    }
                }
            }
            else
            {
                IPooledEnumerable en = item.Map.GetMobilesInRange(item.Location, guardcheckrange);

                foreach (Mobile m in en)
                {
                    //if a guard is still found
                    if (m.GetType() == guardtype || m.GetType().IsSubclassOf(guardtype))
                    {
                        en.Free();

                        //this recloses doors and such if they're sitting open
                        if (item is ILinkedCreatureObject)
                        {
                            ((ILinkedCreatureObject)item).Lockdown();
                        }
                        return(false);
                    }
                }

                en.Free();
            }
            return(true);
        }
Example #5
0
        //this continues the attempt to link.  it is called when another base linked creature tries to link up
        public bool LinkTo(BaseLinkedCreature creature)
        {
            //will not link if it has achieved maximum link count
            //note: it counts itself in the linking!
            if (MaxLinkNum > 0 && _LinkedCreatures.Count >= MaxLinkNum)
            {
                if (DebugLinkedCreatures)
                {
                    PublicOverheadMessage(MessageType.Emote, EmoteHue, false, "*Too many links*");
                }
                return(false);
            }

            //if they don't want to cross-creature link
            if (creature.GetType() != this.GetType() && !CrossCreatureLink)
            {
                if (DebugLinkedCreatures)
                {
                    PublicOverheadMessage(MessageType.Emote, EmoteHue, false, "*Incompatable*");
                }
                return(false);
            }


            //if they don't want to link to the same creature type
            if (creature.GetType() == this.GetType() && !LinkToSameClass)
            {
                if (DebugLinkedCreatures)
                {
                    PublicOverheadMessage(MessageType.Emote, EmoteHue, false, "*Won't link to same class*");
                }
                return(false);
            }

            //if they have incompatable scopes
            if ((!CrossScopeLink || !creature.CrossScopeLink) && GlobalScopeLink != creature.GlobalScopeLink)
            {
                if (DebugLinkedCreatures)
                {
                    PublicOverheadMessage(MessageType.Emote, EmoteHue, false, "*Cannot cross scope link*");
                }
                return(false);
            }

            //if this creature is not in global scope mode, and the other one is out of range
            if (!GlobalScopeLink && !this.InRange(creature, LocalLinkPerceptionRange))
            {
                if (DebugLinkedCreatures)
                {
                    PublicOverheadMessage(MessageType.Emote, EmoteHue, false, "*Out of range*");
                }
                return(false);
            }

            //if they're already linked
            if (_LinkedCreatures.IndexOf(creature) > -1)
            {
                if (DebugLinkedCreatures)
                {
                    PublicOverheadMessage(MessageType.Emote, EmoteHue, false, "*Already linked*");
                }
                return(false);
            }

            //otherwise, add em and link up
            _LinkedCreatures.Add(creature);

            if (DebugLinkedCreatures)
            {
                PublicOverheadMessage(MessageType.Emote, EmoteHue, false, "*Forming link*");
            }

            //this checks if the creature is ready to fight (ie: enough links have been formed and it is ready for players
            //note: it counts itself in the linking!
            if (_LinkedCreatures.Count >= MinLinkNum)
            {
                Blessed = false;
                Frozen  = false;
                Hidden  = false;
            }


            //this tells the creature requesting the link to also link up
            return(true);
        }
Example #6
0
		//this determines if the item is "guarded" by linked creatures.  Depending on this object's
		public static bool IsAccessible( Item item )
		{
			
			Type guardtype = null;
			
			//if the item supports the ILinkedCreatureObject interface, then it can be custom defined 
			if( item is ILinkedCreatureObject )
			{
				guardtype = ((ILinkedCreatureObject)item).LinkedCreatureGuardType;
				
			}
			
			//default checks is on BaseLinkedCreature
			if( guardtype == null )
			{
				guardtype = typeof( BaseLinkedCreature );
			}
				
			
			//instance the guard type to determine its guarding scope
			
			BaseLinkedCreature testcreature = null;
			
			
			try
			{
				testcreature = (BaseLinkedCreature)Activator.CreateInstance( guardtype );
			}
			catch
			{
				//cheap, but effective
				testcreature = new BaseLinkedCreature( AIType.AI_Melee, FightMode.Closest, 0, 0, 0, 0 );
			}
			
			bool globalguard = testcreature.GlobalScopeLink; 
			int guardcheckrange = testcreature.LocalLinkPerceptionRange;
			
			//clean up after self
			testcreature.Delete();
			
			if( globalguard )
			{
				foreach( Mobile m in World.Mobiles.Values )
				{
					//if a guard is still found
					if( m.GetType() == guardtype || m.GetType().IsSubclassOf( guardtype ) )
					{
						//this recloses doors and such if they're sitting open
						if( item is ILinkedCreatureObject )
						{
							((ILinkedCreatureObject)item).Lockdown();
						}
			
						
						return false;
					}
				}
			}
			else
			{
				IPooledEnumerable en = item.Map.GetMobilesInRange( item.Location, guardcheckrange );	
				
				foreach( Mobile m in en )
				{
					//if a guard is still found
					if( m.GetType() == guardtype || m.GetType().IsSubclassOf( guardtype ) )
					{
						en.Free();
						
						//this recloses doors and such if they're sitting open
						if( item is ILinkedCreatureObject )
						{
							((ILinkedCreatureObject)item).Lockdown();
						}
						return false;
					}
				}
				
				en.Free();
			}
			return true;
		}
Example #7
0
		public void BuffCreature( BaseLinkedCreature creature )
		{
			//the buff process is as follows:
			
			//*give 10% of the killed creature's max hits
			//*increase their resists by 5% of the killed creature, to a maximum of 95
			
			creature.Hits += creature.HitsMax / 10;
			
			for( int i = 0; i < 5; i++ )
			{
				int newresist = Math.Min( 95, creature.Resistances[i] + (int)( this.Resistances[i]* .05 ) );
				
				creature.SetResistance( (ResistanceType)i, newresist, newresist );
			}
		}
Example #8
0
		public void Unlink( BaseLinkedCreature creature )
		{
			if( _LinkedCreatures.IndexOf( creature ) != -1 )
			{
				if( DebugLinkedCreatures )
				{
					PublicOverheadMessage( MessageType.Emote, EmoteHue, false, "*Unlinking a fallen linked creature*" );
				}
				
				PlaySound( KillLinkedSound );
				FixedEffect( KillLinkedEffect, 10, 5 );

				
					
				_LinkedCreatures.Remove( creature );
			}
		}
Example #9
0
		//this continues the attempt to link.  it is called when another base linked creature tries to link up
		public bool LinkTo( BaseLinkedCreature creature )
		{
			//will not link if it has achieved maximum link count
			//note: it counts itself in the linking!
			if( MaxLinkNum > 0 && _LinkedCreatures.Count >= MaxLinkNum )
			{
				if( DebugLinkedCreatures )
				{
					PublicOverheadMessage( MessageType.Emote, EmoteHue, false, "*Too many links*" );
				}
				return false;
			}
			
			//if they don't want to cross-creature link
			if( creature.GetType() != this.GetType() && !CrossCreatureLink  )
			{
				if( DebugLinkedCreatures )
				{
					PublicOverheadMessage( MessageType.Emote, EmoteHue, false, "*Incompatable*" );
				}
				return false;
			}
			
			
			//if they don't want to link to the same creature type
			if( creature.GetType() == this.GetType() && !LinkToSameClass  )
			{
				if( DebugLinkedCreatures )
				{
					PublicOverheadMessage( MessageType.Emote, EmoteHue, false, "*Won't link to same class*" );
				}
				return false;
			}
			
			//if they have incompatable scopes
			if( ( !CrossScopeLink || !creature.CrossScopeLink ) && GlobalScopeLink != creature.GlobalScopeLink )
			{
				if( DebugLinkedCreatures )
				{
					PublicOverheadMessage( MessageType.Emote, EmoteHue, false, "*Cannot cross scope link*" );
				}
				return false;
			}
			
			//if this creature is not in global scope mode, and the other one is out of range
			if( !GlobalScopeLink && !this.InRange( creature, LocalLinkPerceptionRange ) )
			{
				if( DebugLinkedCreatures )
				{
					PublicOverheadMessage( MessageType.Emote, EmoteHue, false, "*Out of range*" );
				}
				return false;
			}
			
			//if they're already linked
			if( _LinkedCreatures.IndexOf( creature ) > -1 )
			{
				if( DebugLinkedCreatures )
				{
					PublicOverheadMessage( MessageType.Emote, EmoteHue, false, "*Already linked*" );
				}
				return false;
			}
			
			//otherwise, add em and link up
			_LinkedCreatures.Add( creature );

			if( DebugLinkedCreatures )
			{
				PublicOverheadMessage( MessageType.Emote, EmoteHue, false, "*Forming link*" );
			}
			
			//this checks if the creature is ready to fight (ie: enough links have been formed and it is ready for players
			//note: it counts itself in the linking!
			if( _LinkedCreatures.Count >= MinLinkNum )
			{
				Blessed = false;
				Frozen = false;
				Hidden = false;
			}
			
						
			//this tells the creature requesting the link to also link up
			return true;
		}
Example #10
0
		//this begins the attempt to link this creature to another creature
		protected bool LinkToCreature( BaseLinkedCreature creature )
		{
			
			Type linktype = null;
			//determine what type to link to
			if( CrossCreatureLink )
			{
				//attempt to link to any base linked creature
				linktype = typeof( BaseLinkedCreature );
			}
			else
			{
				//link to only creatures of this same type
				linktype = this.GetType();
			}
			
			//check for matching types
			if( ( creature.GetType() != linktype && !CrossCreatureLink ) || creature == this )
			{
				return false;
			}
			
			//will not link if it has achieved maximum link count 
			if( MaxLinkNum > 0 && _LinkedCreatures.Count >= MaxLinkNum )
			{
				return false;
			}
			
			
			//check if these two creatures can link.  During this check, the other creature will link up
			//if they're compatable
			if( !creature.LinkTo( this ) )
			{
				return false;
			}
			
			//use this method in reverse to perform the local link operation
			return LinkTo( creature );
		}