rendered paste body/************************************************************************************
* eventMiniBoss.cs
* *********************************************************************************/
using System;
using System.Collections;
using Server.Items;
using Server.Targeting;
using Server;
using Server.Engines.CannedEvil;
using System.Collections.Generic;
namespace Server.Mobiles
{
[CorpseName("a corpse")]
public class eventMiniBoss : BaseCreature
{
private bool m_EventLootFlagged = false;
[CommandProperty(AccessLevel.GameMaster)]
public bool EventLootFlagged
{
get { return m_EventLootFlagged; }
set { m_EventLootFlagged = value; }
}
[Constructable]
public eventMiniBoss()
: base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
{
Name = "An Enemy Champion";
if (this.Female = Utility.RandomBool())
{
Body = 401;
}
else
{
Body = 400;
}
SetStr(898, 1030);
SetDex(68, 200);
SetInt(488, 620);
SetHits(5000, 7000);
SetDamage(28, 40);
SetDamageType(ResistanceType.Physical, 25);
SetDamageType(ResistanceType.Fire, 25);
SetDamageType(ResistanceType.Cold, 25);
SetDamageType(ResistanceType.Energy, 25);
SetResistance(ResistanceType.Physical, 70, 85);
SetResistance(ResistanceType.Fire, 70, 85);
SetResistance(ResistanceType.Cold, 70, 85);
SetResistance(ResistanceType.Poison, 70, 85);
SetResistance(ResistanceType.Energy, 70, 85);
SetSkill(SkillName.MagicResist, 100.0, 125.0);
SetSkill(SkillName.Tactics, 95.0, 100.0);
SetSkill(SkillName.Wrestling, 105.0, 118.0);
SetSkill(SkillName.Archery, 105.0, 118.0);
SetSkill(SkillName.Fencing, 105.0, 118.0);
SetSkill(SkillName.Macing, 105.0, 118.0);
SetSkill(SkillName.Swords, 105.0, 118.0);
Fame = 22500;
Karma = -22500;
VirtualArmor = 80;
}
public override bool AlwaysMurderer { get { return true; } }
public override bool AutoDispel { get { return true; } }
public override bool BardImmune { get { return true; } }
public override void GenerateLoot()
{
AddLoot(LootPack.UltraRich, 2);
}
//**************************************
public override bool OnBeforeDeath()
{
Map map = this.Map;
if (map != null)
{
for (int x = -9; x <= 9; ++x)
{
for (int y = -9; y <= 9; ++y)
{
double dist = Math.Sqrt(x * x + y * y);
if (dist <= 9)
new GoodiesTimer(map, X + x, Y + y).Start();
}
}
}
return base.OnBeforeDeath();
}
//*********************************************************************
// GoodiesTimer controls gold spawn upon death. This version uses a
// 9x9 area, 200-300gp per tile (ordinary champ gold is 12x12 500-1000)
private class GoodiesTimer : Timer
{
private Map m_Map;
private int m_X, m_Y;
public GoodiesTimer( Map map, int x, int y ) : base( TimeSpan.FromSeconds( Utility.RandomDouble() * 10.0 ) )
{
m_Map = map;
m_X = x;
m_Y = y;
}
protected override void OnTick()
{
int z = m_Map.GetAverageZ( m_X, m_Y );
bool canFit = m_Map.CanFit( m_X, m_Y, z, 6, false, false );
for ( int i = -3; !canFit && i <= 3; ++i )
{
canFit = m_Map.CanFit( m_X, m_Y, z + i, 6, false, false );
if ( canFit )
z += i;
}
if ( !canFit )
return;
Gold g = new Gold( 200, 300 );
g.MoveToWorld( new Point3D( m_X, m_Y, z ), m_Map );
if ( 0.5 >= Utility.RandomDouble() )
{
switch ( Utility.Random( 3 ) )
{
case 0: // Fire column
{
Effects.SendLocationParticles( EffectItem.Create( g.Location, g.Map, EffectItem.DefaultDuration ), 0x3709, 10, 30, 5052 );
Effects.PlaySound( g, g.Map, 0x208 );
break;
}
case 1: // Explosion
{
Effects.SendLocationParticles( EffectItem.Create( g.Location, g.Map, EffectItem.DefaultDuration ), 0x36BD, 20, 10, 5044 );
Effects.PlaySound( g, g.Map, 0x307 );
break;
}
case 2: // Ball of fire
{
Effects.SendLocationParticles( EffectItem.Create( g.Location, g.Map, EffectItem.DefaultDuration ), 0x36FE, 10, 10, 5052 );
break;
}
}
}
}
}
//*******************************************
public eventMiniBoss(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
// Do I really need to have a method for this? I'm sure not really.
// But since I can't nail the syntax otherwise off the top of my head, I DO.
// FROGS.
private PowerScroll CreateRandomPowerScroll()
{
return PowerScroll.CreateRandomNoCraft(15, 15);
}
//Tot selection for prize stuffs on death (Assuming eventloot is flagged)
private static Type[] m_LesserArtifacts = new Type[]
{
typeof( AncientFarmersKasa ), typeof( AncientSamuraiDo ), typeof( ArmsOfTacticalExcellence ), typeof( BlackLotusHood ),
typeof( DaimyosHelm ), typeof( DemonForks ), typeof( DragonNunchaku ), typeof( Exiler ), typeof( GlovesOfTheSun ),
typeof( HanzosBow ), typeof( LegsOfStability ), typeof( PeasantsBokuto ), typeof( PilferedDancerFans ), typeof( TheDestroyer ),
typeof( TomeOfEnlightenment ), typeof( AncientUrn ), typeof( HonorableSwords ), typeof( PigmentsOfTokuno ), typeof( FluteOfRenewal )
};
// Sort out prize stuffs upon death.
public override void OnDeath(Container c)
{
// Figure out who has damage rights and add them to an array
List<DamageStore> rights = BaseCreature.GetLootingRights(this.DamageEntries, this.HitsMax);
List<Mobile> toGive = new List<Mobile>();
for (int i = rights.Count - 1; i >= 0; --i)
{
DamageStore ds = rights[i];
if (ds.m_HasRight)
toGive.Add(ds.m_Mobile);
}
PowerScroll ps = CreateRandomPowerScroll();
toGive[Utility.Random(toGive.Count)].AddToBackpack(ps);
Item tot = null;
try
{
tot = Activator.CreateInstance(m_LesserArtifacts[Utility.Random(m_LesserArtifacts.Length)]) as Item;
toGive[Utility.Random(toGive.Count)].AddToBackpack(tot);
}
catch
{ }
base.OnDeath(c);
}
}
}