CODE |
Errors: + Custom Scripts 2.0/World Book Travel/Rend.cs: CS0029: Line 59: Cannot implicitly convert type 'System.Collections.Generic. List<Server.Mobiles.DamageStore>' to 'System.Collections.ArrayList' Scripts: One or more scripts failed to compile or no script files were found. - Press return to exit, or R to try again. |
CODE |
using System; using Server.Items; using System.Collections; namespace Server.Mobiles { [CorpseName( "Rends corpse" )] public class Rend : BaseCreature { public static Type[] Artifacts = new Type[] { typeof( PadsOfTheCuSidhe ), typeof( RobeOfTheEquinox ), typeof( RobeOfTheEclipse ) }; [Constructable] public Rend() : base( AIType.AI_Melee, FightMode.Closest, 10, 1, 0.1, 0.4 ) { Body = 276; Name = "Rend"; BaseSoundID = 362; Hue = 1175; SetStr( 1270, 1280 ); SetDex( 365, 370 ); SetInt( 635, 650 ); SetHits( 5280, 6030 ); SetDamage( 8, 11 ); SetDamageType( ResistanceType.Physical, 100 ); SetResistance( ResistanceType.Physical, 75, 85 ); SetResistance( ResistanceType.Fire, 80, 85 ); SetResistance( ResistanceType.Cold, 45, 50 ); SetResistance( ResistanceType.Poison, 40, 45 ); SetResistance( ResistanceType.Energy, 50, 55 ); SetSkill( SkillName.Anatomy, 67.0, 70.0 ); SetSkill( SkillName.MagicResist, 97.9, 100.0 ); SetSkill( SkillName.Tactics, 141.4, 145.0 ); SetSkill( SkillName.Wrestling, 148.5, 155.0 ); Fame = 10000; Karma = -10000; } public override void GenerateLoot() { AddLoot( LootPack.SuperBoss, 2 ); AddLoot( LootPack.HighScrolls, Utility.RandomMinMax( 20, 40 ) ); } public override void OnDeath( Container c ) { ArrayList list = GetLootingRights( this.DamageEntries, this.HitsMax ); bool awarded = false; for ( int i = 0; i < list.Count; ++i ) { DamageStore ds = (DamageStore)list[i]; if ( ds.m_HasRight && !awarded ) { Mobile m = ds.m_Mobile; int luck = m.Luck; double chance = ((double)luck + (double)Fame)/500000; if ( chance > 0.1 ) chance = 0.1; if ( Utility.RandomDouble() < chance ) { Item item = (Item)Activator.CreateInstance( Artifacts[Utility.Random(Artifacts.Length)] ); m.AddToBackpack( item ); m.SendLocalizedMessage( 1062317 ); // For your valor in combating the fallen beast, a special artifact has been bestowed to you. } } } base.OnDeath( c ); } public override bool HasBreath{ get{ return true; } } // fire breath enabled public Rend( 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(); } } } |
QUOTE |
public override void OnDeath( Container c ) { List<DamageStore> list = GetLootingRights(this.DamageEntries, this.HitsMax); bool awarded = false; |
CODE |
Mobile m = ds.m_Mobile; int luck = m.Luck; double chance = ((double)luck + (double)Fame)/500000; if ( chance > 0.1 ) chance = 0.1; |
CODE |
Mobile m = ds.m_Mobile; int luck = m.Luck; double chance = ((double)luck + (double)Fame)/500000; if ( chance > 0.1 ) chance = 0.1; if ( Utility.RandomDouble() < chance ) |
CODE |
if ( Utility.RandomDouble() < 0.5) |
QUOTE (ArteGordon @ March 04, 2007 06:23 am) | ||||
The chance is based on luck and fame. So with luck of 1000 and fame of 10000, your chance value would be 11000/500000, or 0.022. That gives you a 2% chance of dropping. If you want it to just drop 50% of the time, independent of luck or fame, just change all of this
to this
|
CODE |
using System; using Server.Items; using System.Collections; using System.Collections.Generic; using Server; namespace Server.Mobiles { [CorpseName( "Rends corpse" )] public class Rend : BaseCreature { public static Type[] Artifacts = new Type[] { typeof( PadsOfTheCuSidhe ), typeof( RobeOfTheEquinox ), typeof( RobeOfTheEclipse ) }; [Constructable] public Rend() : base( AIType.AI_Melee, FightMode.Closest, 10, 1, 0.1, 0.4 ) { Body = 276; Name = "Rend"; BaseSoundID = 362; Hue = 1175; SetStr( 1270, 1280 ); SetDex( 365, 370 ); SetInt( 635, 650 ); SetHits( 5280, 6030 ); SetDamage( 10, 18 ); SetDamageType( ResistanceType.Physical, 100 ); SetResistance( ResistanceType.Physical, 75, 85 ); SetResistance( ResistanceType.Fire, 80, 85 ); SetResistance( ResistanceType.Cold, 45, 50 ); SetResistance( ResistanceType.Poison, 40, 45 ); SetResistance( ResistanceType.Energy, 50, 55 ); SetSkill( SkillName.Anatomy, 67.0, 70.0 ); SetSkill( SkillName.MagicResist, 97.9, 100.0 ); SetSkill( SkillName.Tactics, 141.4, 145.0 ); SetSkill( SkillName.Wrestling, 148.5, 155.0 ); Fame = 10000; Karma = -10000; } public override void GenerateLoot() { AddLoot( LootPack.SuperBoss, 2 ); AddLoot( LootPack.HighScrolls, Utility.RandomMinMax( 20, 40 ) ); } public override void OnDeath( Container c ) { List<DamageStore> list = GetLootingRights(this.DamageEntries, this.HitsMax); bool awarded = false; for ( int i = 0; i < list.Count; ++i ) { DamageStore ds = (DamageStore)list[i]; if ( ds.m_HasRight && !awarded ) { Mobile m = ds.m_Mobile; /*int luck = m.Luck; double chance = ((double)luck + (double)Fame)/500000; if ( chance > 0.1 ) chance = 0.1; if ( Utility.RandomDouble() < chance )*/ if ( Utility.RandomDouble() < 0.5) { Item item = (Item)Activator.CreateInstance( Artifacts[Utility.Random(Artifacts.Length)] ); m.AddToBackpack( item ); m.SendLocalizedMessage( 1062317 ); // For your valor in combating the fallen beast, a special artifact has been bestowed to you. } } } base.OnDeath( c ); } public override bool HasBreath{ get{ return true; } } // fire breath enabled public Rend( 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(); } } } |