CODE |
using System; using Server.Items; using System.Collections; // needed for ArrayList using System.Collections.Generic; namespace Server.Mobiles { [CorpseName( "a crafting union leader corpse" )] public class MasterOfTheArts : BaseCreature //make it use the creature files/settings { public static TimeSpan TalkDelay = TimeSpan.FromSeconds( 10.0 ); //the delay between talks is 10 seconds public DateTime m_NextTalk; public override int GetIdleSound() { return 573; //play carpentry sound } public override int GetDeathSound() { return 1060; //play death sound } public override int GetAttackSound() { return 42; // play blacksmith sound } public override int GetHurtSound() { if (this.Hits > 1000) { return 1076; //play hurt sound } else if (this.Hits > 500) { return 1078; //play hurt sound } else if (this.Hits > 100) { return 1081; //play hurt sound } else { return 1080; //play hurt sound } } public override int GetAngerSound() { return 42; //play blacksmith sound } public override void OnMovement( Mobile m, Point3D oldLocation ) { if ( DateTime.Now >= m_NextTalk && InRange( m, 4 ) && InLOS( m ) ) // check if it's time to talk & mobile in range & in los. { m_NextTalk = DateTime.Now + TalkDelay; // set next talk time switch ( Utility.Random( 7 )) { case 0: Say("So you really think that crafting is important to ye."); //make it say ... PlaySound(1066); //play giggle sound break; case 1: Say("So you really think you can beat me, I am very crafty you know."); PlaySound(1071); //play huh sound break; case 2: Say("Only the wise can receive these scrolls of knowledge to excel."); PlaySound(1055); //play clear throat sound break; // case 3: Say("I shall not give you these scrolls easily."); PlaySound(1074); //play no!! sound break; case 4: Say("Leave me be, I am waiting for the Master of the Power. You are a pain in my side."); PlaySound(1067); //play groan sound break; case 5: Say("I shall treat thee like I do with the others under me, Ha ha."); PlaySound(1073); //play lough sound break; case 6: Say("Not only your might is a neccesity to wield these scrolls of knowledge, but your mind is also required from thee."); PlaySound(1094); //play spit sound break; }; } } public override WeaponAbility GetWeaponAbility() // add it random special ability, bleed, mortal strike or armor ignore { int ability = Utility.Random(3); if (ability == 1) return WeaponAbility.MortalStrike; else if (ability == 2) return WeaponAbility.BleedAttack; else return WeaponAbility.ArmorIgnore; } //base( AIType.AI_Melee, FightMode.Closest, 10, 1, 0.175, 0.350 ) //The 10 is range perception, the 1 is fight range, 0.1 is active speed, 0.4 is passive speed. set the 10 to like 5 and see what happens. /*private int i_PsCount; public int PsCount{ get{ return i_PsCount; } set { i_PsCount = value; InvalidateProperties(); } } private bool i_ChampionSpawn; public bool ChampionSpawn{ get{ return i_ChampionSpawn; } set { i_ChampionSpawn = value; InvalidateProperties(); } } [Constructable] public MasterOfTheArts() : this ( false ) { }*/ [Constructable] public MasterOfTheArts() : base( AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4 ) { Name = "a master of the arts"; //the name players will see Body = 185; //how it look like in game BaseSoundID = 42; //what sound he makes (I still have problems with sound :( //ChampionSpawn = i_ChampionSpawn; //set if it spawn with champ spawn or normal spawn SetStr( 401, 420 ); //set stats SetDex( 81, 90 ); SetInt( 201, 220 ); SetHits( 1500, 1700 ); //set hp SetDamage( 20, 28 ); //set how much damage ~ SetDamageType( ResistanceType.Physical, 50 ); //which damage type it does SetDamageType( ResistanceType.Poison, 50 ); SetResistance( ResistanceType.Physical, 60, 80 ); //what resists it have SetResistance( ResistanceType.Fire, 40, 50 ); SetResistance( ResistanceType.Cold, 55, 50 ); SetResistance( ResistanceType.Poison, 48, 50 ); SetResistance( ResistanceType.Energy, 55, 60 ); SetSkill( SkillName.Anatomy, 120.0 ); SetSkill( SkillName.Tactics, 120.0 ); SetSkill( SkillName.Meditation, 120.0 ); SetSkill( SkillName.Swords, 120.0 ); SetSkill( SkillName.Wrestling, 120.0 ); SetSkill( SkillName.Parry, 120.0 ); SetSkill( SkillName.MagicResist, 120.0 ); Fame = 30000; //its fame/karma Karma = -30000; VirtualArmor = 50; ActiveSpeed /= Paragon.SpeedBuff; PassiveSpeed /= Paragon.SpeedBuff; RangePerception = 20; PlateChest chest = new PlateChest(); //add its armor and set its hue and not movable so it won't be on loot chest.Hue = 503; chest.Movable = false; AddItem( chest ); PlateArms arms = new PlateArms(); arms.Hue = 503; arms.Movable = false; AddItem( arms ); PlateGloves gloves = new PlateGloves(); gloves.Hue = 503; gloves.Movable = false; AddItem( gloves ); PlateGorget gorget = new PlateGorget(); gorget.Hue = 503; gorget.Movable = false; AddItem( gorget ); PlateLegs legs = new PlateLegs(); legs.Hue = 503; legs.Movable = false; AddItem( legs ); AxeOfTheHeavens weapon = new AxeOfTheHeavens(); //add its weapon and set its hue and not movable so it won't be on loot //weapon.Name = "Crafting Union Leader's Hammer"; weapon.Hue = 503; weapon.Movable = false; AddItem( weapon ); FurBoots boots = new FurBoots(); //add its boots and set its hue and not movable so it won't be on loot boots.Hue = 503; boots.Movable = false; AddItem( boots ); Item hair = new Item( 8251 ); //add its hair and set its hue and not movable so it won't be on loot hair.Hue = 503; hair.Layer = Layer.Hair; hair.Movable = false; AddItem( hair ); AddItem( new Tokens( 500, 1000 )); //if ( Utility.Random(25) == 1 ) //AddItem( new PersonalStatueDeed() ); new IceSteed().Rider = this; //make it ride on mule } public void GiveCraftPowerScroll() //Generate power scroll routine and add to pack { List<Mobile> toGive = new List<Mobile>(); //no idea :( List<AggressorInfo> list = Aggressors; //I think it add list players that attacked it for ( int i = 0; i < list.Count; ++i ) { AggressorInfo info = list[i]; if ( info.Attacker.Player && info.Attacker.Alive && (DateTime.Now - info.LastCombatTime) < TimeSpan.FromSeconds( 30.0 ) && !toGive.Contains( info.Attacker ) ) toGive.Add( info.Attacker ); } list = Aggressed; //I think it add list of players it attacked for ( int i = 0; i < list.Count; ++i ) { AggressorInfo info = list[i]; if ( info.Defender.Player && info.Defender.Alive && (DateTime.Now - info.LastCombatTime) < TimeSpan.FromSeconds( 30.0 ) && !toGive.Contains( info.Defender ) ) toGive.Add( info.Defender ); } if ( toGive.Count == 0 )//if nobody attacked it and it didn't attack anybody then break operation and no ps MUAH return; // Randomize //absolutly no idea for ( int i = 0; i < toGive.Count; ++i ) { int rand = Utility.Random( toGive.Count ); Mobile hold = toGive[i]; toGive[i] = toGive[rand]; toGive[rand] = hold; } //PsCount = ChampionSpawn ? 5 : 2; //set how many ps to give if it spawned using champ spawn or normal spawn for ( int i = 0; i < 1; ++i ) //set to give 1 ps change the "< 1" to anything you want { Mobile m = (Mobile)toGive[i % toGive.Count]; int level; double random = Utility.RandomDouble(); if ( 0.2 >= random ) // select the level of the ps level = 120; else if ( 0.55 >= random ) level = 115; else level = 110; //if ( Daat99OWLTR.Ops[5].Setting ) //m.AddToBackpack( new ResourceRecipe() ); switch ( Utility.Random( 13 )) // select which skill to use in the ps { case 0: m.AddToBackpack( new PowerScroll( SkillName.Blacksmith, level ) ); break; // give blacksmith ps acording to the ps level we selected before case 1: m.AddToBackpack( new PowerScroll( SkillName.Tailoring, level ) ); break; case 2: m.AddToBackpack( new PowerScroll( SkillName.Tinkering, level ) ); break; case 3: m.AddToBackpack( new PowerScroll( SkillName.Mining, level ) ); break; case 4: m.AddToBackpack( new PowerScroll( SkillName.Carpentry, level ) ); break; case 5: m.AddToBackpack( new PowerScroll( SkillName.Alchemy, level ) ); break; case 6: m.AddToBackpack( new PowerScroll( SkillName.Fletching, level ) ); break; case 7: m.AddToBackpack( new PowerScroll( SkillName.Inscribe, level ) ); break; case 8: m.AddToBackpack( new PowerScroll( SkillName.Cooking, level ) ); break; case 9: m.AddToBackpack( new PowerScroll( SkillName.Cartography, level ) ); break; case 10: m.AddToBackpack( new PowerScroll( SkillName.Lumberjacking, level ) ); break; case 11: m.AddToBackpack( new PowerScroll( SkillName.Lockpicking, level ) ); break; case 12: m.AddToBackpack( new PowerScroll( SkillName.Fishing, level ) ); break; } m.SendLocalizedMessage( 1049524 ); // You have received a scroll of power! } } public override bool OnBeforeDeath( ) //what happens before it dies { IMount mount = this.Mount; if ( mount != null ) { mount.Rider = null; if (mount is Mobile) ((Mobile)mount).Delete(); } GiveCraftPowerScroll(); //call the generate ps routine switch (Utility.Random(15)) { case 0: PackItem( new RunicSewingKit( CraftResource.SpinedLeather, 25 ) ); break; case 1: PackItem( new RunicSewingKit( CraftResource.HornedLeather, 25 ) ); break; case 2: PackItem( new RunicSewingKit( CraftResource.BarbedLeather, 25 ) ); break; } switch (Utility.Random(8)) { case 0: PackItem( new DullCopperOre( 25 ) ); break; case 1: PackItem( new ShadowIronOre( 25 ) ); break; case 2: PackItem( new CopperOre( 25 ) ); break; case 3: PackItem( new BronzeOre( 25 ) ); break; case 4: PackItem( new GoldOre( 25 ) ); break; case 5: PackItem( new AgapiteOre( 25 ) ); break; case 6: PackItem( new VeriteOre( 25 ) ); break; case 7: PackItem( new ValoriteOre( 25 ) ); break; } switch ( Utility.Random(20)) { case 0: PackItem( new RunicHammer( CraftResource.DullCopper, 25 ) ); break; case 1: PackItem( new RunicHammer( CraftResource.ShadowIron, 25 ) ); break; case 2: PackItem( new RunicHammer( CraftResource.Copper, 25 ) ); break; case 3: PackItem( new RunicHammer( CraftResource.Bronze, 25 ) ); break; case 4: PackItem( new RunicHammer( CraftResource.Gold, 25 ) ); break; case 5: PackItem( new RunicHammer( CraftResource.Agapite, 25 ) ); break; case 6: PackItem( new RunicHammer( CraftResource.Verite, 25 ) ); break; case 7: PackItem( new RunicHammer( CraftResource.Valorite, 25 ) ); break; //case 9: PackItem( new RunicSewingKit( CraftResource.RegularLeather, 10 ) ); break; // normal leather runic sewing kit with 10 charges //case 10: PackItem( new RunicSewingKit( CraftResource.SpinedLeather, 10 ) ); break; //case 11: PackItem( new RunicSewingKit( CraftResource.HornedLeather, 10 ) ); break; //case 12: PackItem( new RunicSewingKit( CraftResource.BarbedLeather, 10 ) ); break; } return true; } public override bool BardImmune{ get{ return true; } } //make it bardimmune: unpeaceable\unprovokable\undiscorded public override bool AlwaysMurderer{ get{ return true; } } //make the npc red public override bool Unprovokable{ get{ return true; } } public override bool CanRummageCorpses{ get{ return true; } } public override bool AlwaysAttackable{ get{ return true; } } public override bool Uncalmable{ get{ return true; } } public override Poison PoisonImmune{ get{ return Poison.Lethal; } } public override void GenerateLoot() //add normal loot { AddLoot( LootPack.SuperBoss, 2 ); // set the loot type to ultra rich } public MasterOfTheArts( Serial serial ) : base( serial ) // no idea what this does { } public override void Serialize( GenericWriter writer ) // this save the info on the mob so it won't be deleted all the time { base.Serialize( writer ); writer.Write( (int) 0 ); // version } public override void Deserialize( GenericReader reader ) // this load the info on the mob so it won't be deleted all the time { base.Deserialize( reader ); int version = reader.ReadInt(); } } } |
QUOTE |
public override void OnHit( Mobile attacker, Mobile defender, int damage ) { if ( !Validate( attacker ) ) return; if (defender is MasterOfTheArts) return; if ( attacker.Mounted && !(defender.Weapon is Lance) ) // TODO: Should there be a message here? return; ClearCurrentAbility( attacker ); IMount mount = defender.Mount; |