//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)); }
//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); }
//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; }
//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 ); }