BritainKnights/Scripts/Mobiles/Towns/Guard.cs

202 lines
No EOL
5.8 KiB
C#

using System;
using System.Collections;
using Server.Items;
using Server.ContextMenus;
using Server.Misc;
using Server.Network;
using Server.Spells.Seventh;
namespace Server.Mobiles
{
public class Guard : BaseCreature
{
public override bool ClickTitle{ get{ return false; } }
public override bool DeleteCorpseOnDeath{ get{ return true; } }
[Constructable]
public Guard() : base( AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4 )
{
SpeechHue = Utility.RandomSpeechHue();
Title = "the guard";
Hue = Utility.RandomSkinHue();
NameHue = 1154;
Clan = Clan.Citizen;
int hair = Utility.RandomHairHue();
if ( this.Female = Utility.RandomBool() )
{
Body = 0x191;
Name = NameList.RandomName( "female" );
}
else
{
Body = 0x190;
Name = NameList.RandomName( "male" );
if ( Utility.RandomBool() ){ Utility.AssignRandomFacialHair( this, hair ); }
}
Utility.AssignRandomHair( this, hair );
SetStr( 300 );
SetDex( 100 );
SetInt( 75 );
SetDamage( 30, 50 );
SetSkill( SkillName.MagicResist, 100.0 );
SetSkill( SkillName.Swords, 100.0 );
SetSkill( SkillName.Fencing, 100.0 );
SetSkill( SkillName.Parry, 100.0 );
SetSkill( SkillName.Tactics, 100.0 );
}
public override void OnAfterSpawn()
{
if ( X > 936 && Y > 694 && X < 1660 && Y < 1040 ) // YEW
{
AddItem( new Bascinet() );
AddItem( new StuddedArms() );
AddItem( new StuddedChest() );
AddItem( new StuddedGorget() );
AddItem( new StuddedLegs() );
AddItem( new StuddedGloves() );
AddItem( new Longsword() );
AddItem( new WoodenShield() );
AddItem( new Boots() );
}
else if ( X > 1867 && Y > 1953 && X < 2147 && Y < 2204 ) // PAWS
{
AddItem( new Helmet() );
AddItem( new RingmailArms() );
AddItem( new RingmailChest() );
AddItem( new StuddedGorget() );
AddItem( new RingmailLegs() );
AddItem( new RingmailGloves() );
AddItem( new Spear() );
AddItem( new Boots() );
}
else if ( X > 2439 && Y > 1354 && X < 2844 && Y < 1528 ) // COVE
{
AddItem( new ChainCoif() );
AddItem( new LeatherArms() );
AddItem( new LeatherChest() );
AddItem( new LeatherGorget() );
AddItem( new LeatherLegs() );
AddItem( new LeatherGloves() );
AddItem( new Longsword() );
AddItem( new WoodenKiteShield() );
AddItem( new Boots() );
}
else if ( X > 2565 && Y > 322 && X < 3096 && Y < 655 ) // MINOC
{
AddItem( new NorseHelm() );
AddItem( new RingmailArms() );
AddItem( new RingmailChest() );
AddItem( new StuddedGorget() );
AddItem( new RingmailLegs() );
AddItem( new RingmailGloves() );
AddItem( new Pike() );
AddItem( new Cloak( Utility.RandomNeutralHue() ) );
AddItem( new Boots() );
}
else
{
AddItem( new PlateHelm() );
AddItem( new PlateArms() );
AddItem( new PlateChest() );
AddItem( new PlateGorget() );
AddItem( new PlateLegs() );
AddItem( new PlateGloves() );
AddItem( new Halberd() );
}
}
public override bool IsEnemy( Mobile m )
{
if ( !(this.CanSee( m )) || !(this.InLOS( m )) )
return false;
if ( m.AccessLevel > AccessLevel.Player )
return false;
if ( DisguiseTimers.IsDisguised( m ) )
return false;
if( !m.CanBeginAction( typeof( PolymorphSpell ) ) )
return false;
if ( m is Guard )
return false;
if ( m is PlayerMobile && ( m.Kills >= 5 || m.Criminal ) )
return true;
if ( m is BaseCreature && ((BaseCreature)m).ControlMaster != null && ((BaseCreature)m).ControlMaster is PlayerMobile && ((BaseCreature)m).ControlMaster == m && ( m.Kills >= 5 || m.Criminal ) )
return true;
if ( m is BaseCreature && ((BaseCreature)m).SummonMaster != null && ((BaseCreature)m).SummonMaster is PlayerMobile && ((BaseCreature)m).SummonMaster == m && ( m.Kills >= 5 || m.Criminal ) )
return true;
if ( m is BaseCreature && ((BaseCreature)m).FightMode == FightMode.Closest )
return true;
if ( m is BaseCreature && ((BaseCreature)m).FightMode == FightMode.Aggressor && ((BaseCreature)m).AI == AIType.AI_Animal && m.Fame > 150 && m.Combatant is PlayerMobile )
return true;
return false;
}
public override void OnGotMeleeAttack( Mobile attacker )
{
base.OnGotMeleeAttack( attacker );
Hits = HitsMax;
Stam = StamMax;
}
public override void OnThink()
{
if ( ( Math.Abs( this.X-this.Home.X ) > 8 || Math.Abs( this.Y-this.Home.Y ) > 8 || Math.Abs( this.Z-this.Home.Z ) > 8 ) && Combatant == null )
{
this.Location = this.Home;
}
base.OnThink();
}
public override void OnGaveMeleeAttack( Mobile defender )
{
base.OnGaveMeleeAttack( defender );
Hits = HitsMax;
Stam = StamMax;
switch ( Utility.Random( 8 ))
{
case 0: Say("Die villian!"); break;
case 1: Say("I will bring you justice!"); break;
case 2: Say("So, " + defender.Name + "? Your evil ends here!"); break;
case 3: Say("We have been told to watch for " + defender.Name + "!"); break;
case 4: Say("Fellow guardsmen, " + defender.Name + " is here!"); break;
case 5: Say("We have ways of dealing with the likes of " + defender.Name + "!"); break;
case 6: Say("Give up! We do not fear " + defender.Name + "!"); break;
case 7: Say("So, " + defender.Name + "? I sentence you to death!"); break;
};
}
public Guard( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}