add power faction items
This commit is contained in:
parent
6851c59521
commit
383f6cbada
7 changed files with 550 additions and 0 deletions
|
|
@ -0,0 +1,62 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
using Server.Factions;
|
||||
|
||||
namespace Server {
|
||||
public sealed class BloodRose : PowerFactionItem {
|
||||
public override string DefaultName {
|
||||
get {
|
||||
return "blood rose";
|
||||
}
|
||||
}
|
||||
|
||||
public BloodRose()
|
||||
: base( Utility.RandomList( 6378, 9035 ) ) {
|
||||
Hue = 2118;
|
||||
}
|
||||
|
||||
public BloodRose( Serial serial )
|
||||
: base( serial ) {
|
||||
}
|
||||
|
||||
public override bool Use( Mobile from ) {
|
||||
if ( from.GetStatMod( "blood-rose" ) == null ) {
|
||||
from.PlaySound( Utility.Random( 0x3A, 3 ) );
|
||||
|
||||
if ( from.Body.IsHuman && !from.Mounted ) {
|
||||
from.Animate( 34, 5, 1, true, false, 0 );
|
||||
}
|
||||
|
||||
int amount = Utility.Dice( 3, 3, 3 );
|
||||
int time = Utility.RandomMinMax( 5, 30 );
|
||||
|
||||
from.FixedParticles( 0x373A, 10, 15, 5018, EffectLayer.Waist );
|
||||
|
||||
from.PlaySound( 0x1EE );
|
||||
from.AddStatMod( new StatMod( StatType.All, "blood-rose", amount, TimeSpan.FromMinutes( time ) ) );
|
||||
|
||||
return true;
|
||||
} else {
|
||||
from.SendLocalizedMessage( 1062927 ); // You have eaten one of these recently and eating another would provide no benefit.
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer ) {
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( ( int ) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader ) {
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Multis;
|
||||
using Server.Mobiles;
|
||||
using Server.Factions;
|
||||
|
||||
namespace Server {
|
||||
public sealed class ClarityPotion : PowerFactionItem {
|
||||
public override string DefaultName {
|
||||
get {
|
||||
return "clarity potion";
|
||||
}
|
||||
}
|
||||
|
||||
public ClarityPotion()
|
||||
: base( 3628 ) {
|
||||
Hue = 1154;
|
||||
}
|
||||
|
||||
public ClarityPotion( Serial serial )
|
||||
: base( serial ) {
|
||||
}
|
||||
|
||||
public override bool Use( Mobile from ) {
|
||||
if ( from.BeginAction( typeof( ClarityPotion ) ) ) {
|
||||
int amount = Utility.Dice( 3, 3, 3 );
|
||||
int time = Utility.RandomMinMax( 5, 30 );
|
||||
|
||||
from.PlaySound( 0x2D6 );
|
||||
|
||||
if ( from.Body.IsHuman ) {
|
||||
from.Animate( 34, 5, 1, true, false, 0 );
|
||||
}
|
||||
|
||||
from.FixedParticles( 0x375A, 10, 15, 5011, EffectLayer.Head );
|
||||
from.PlaySound( 0x1EB );
|
||||
|
||||
StatMod mod = from.GetStatMod( "Concussion" );
|
||||
|
||||
if ( mod != null ) {
|
||||
from.RemoveStatMod( "Concussion" );
|
||||
from.Mana -= mod.Offset;
|
||||
}
|
||||
|
||||
from.PlaySound( 0x1EE );
|
||||
from.AddStatMod( new StatMod( StatType.Int, "clarity-potion", amount, TimeSpan.FromMinutes( time ) ) );
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromMinutes( time ), delegate() {
|
||||
from.EndAction( typeof( ClarityPotion ) );
|
||||
} );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer ) {
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( ( int ) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader ) {
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Multis;
|
||||
using Server.Mobiles;
|
||||
using Server.Factions;
|
||||
|
||||
namespace Server {
|
||||
public sealed class GemOfEmpowerment : PowerFactionItem {
|
||||
public override string DefaultName {
|
||||
get {
|
||||
return "gem of empowerment";
|
||||
}
|
||||
}
|
||||
|
||||
public GemOfEmpowerment()
|
||||
: base( 7955 ) {
|
||||
Hue = 1154;
|
||||
}
|
||||
|
||||
public GemOfEmpowerment( Serial serial )
|
||||
: base( serial ) {
|
||||
}
|
||||
|
||||
public override bool Use( Mobile from ) {
|
||||
if ( Faction.ClearSkillLoss( from ) ) {
|
||||
from.LocalOverheadMessage( Server.Network.MessageType.Regular, 2219, false, "The gem shatters as you invoke its power." );
|
||||
from.PlaySound( 909 );
|
||||
|
||||
from.FixedEffect( 0x373A, 10, 30 );
|
||||
from.PlaySound( 0x209 );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer ) {
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( ( int ) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader ) {
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,165 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
using Server.Factions;
|
||||
using System.IO;
|
||||
|
||||
namespace Server {
|
||||
public abstract class PowerFactionItem : Item {
|
||||
public abstract bool Use( Mobile mob );
|
||||
|
||||
private sealed class DestructionTimer : Timer {
|
||||
private Mobile _mobile;
|
||||
|
||||
private bool _screamed;
|
||||
|
||||
public DestructionTimer( Mobile mob )
|
||||
: base( TimeSpan.FromSeconds( 5 ), TimeSpan.FromSeconds( 0.1 ), 10 ) {
|
||||
_mobile = mob;
|
||||
}
|
||||
|
||||
protected override void OnTick() {
|
||||
if ( _mobile.Alive ) {
|
||||
if ( !_screamed ) {
|
||||
_screamed = true;
|
||||
|
||||
_mobile.PlaySound( _mobile.Female ? 814 : 1088 );
|
||||
_mobile.PublicOverheadMessage( Server.Network.MessageType.Regular, 2118, false, "Aaaaah!" );
|
||||
}
|
||||
|
||||
_mobile.Damage( Utility.Dice( 2, 6, 0 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class WeightedItem {
|
||||
private int _weight;
|
||||
private Type _type;
|
||||
|
||||
public int Weight {
|
||||
get {
|
||||
return _weight;
|
||||
}
|
||||
}
|
||||
|
||||
public Type Type {
|
||||
get {
|
||||
return _type;
|
||||
}
|
||||
}
|
||||
|
||||
public WeightedItem( int weight, Type type ) {
|
||||
_weight = weight;
|
||||
_type = type;
|
||||
}
|
||||
|
||||
public Item Construct() {
|
||||
return Activator.CreateInstance( _type ) as Item;
|
||||
}
|
||||
}
|
||||
|
||||
private static WeightedItem[] _items = {
|
||||
new WeightedItem( 30, typeof( GemOfEmpowerment ) ),
|
||||
new WeightedItem( 25, typeof( BloodRose ) ),
|
||||
new WeightedItem( 20, typeof( ClarityPotion ) ),
|
||||
new WeightedItem( 15, typeof( UrnOfAscension ) ),
|
||||
new WeightedItem( 10, typeof( StormsEye ) )
|
||||
};
|
||||
|
||||
public static void CheckSpawn( Mobile killer, Mobile victim ) {
|
||||
if ( killer != null && victim != null ) {
|
||||
PlayerState ps = PlayerState.Find( victim );
|
||||
|
||||
if ( ps != null ) {
|
||||
int chance = ps.Rank.Rank;
|
||||
|
||||
if ( chance > Utility.Random( 100 ) ) {
|
||||
int weight = 0;
|
||||
|
||||
foreach ( WeightedItem item in _items ) {
|
||||
weight += item.Weight;
|
||||
}
|
||||
|
||||
weight = Utility.Random( weight );
|
||||
|
||||
foreach ( WeightedItem item in _items ) {
|
||||
if ( weight < item.Weight ) {
|
||||
Item obj = item.Construct();
|
||||
|
||||
if ( obj != null ) {
|
||||
killer.AddToBackpack( obj );
|
||||
|
||||
killer.SendSound( 1470 );
|
||||
killer.LocalOverheadMessage(
|
||||
Server.Network.MessageType.Regular, 2119, false,
|
||||
"You notice a strange item on the corpse, and decide to pick it up."
|
||||
);
|
||||
|
||||
try {
|
||||
using ( StreamWriter op = new StreamWriter( "faction-power-items.log", true ) ) {
|
||||
op.WriteLine( "{0}\t{1}\t{2}\t{3}", DateTime.UtcNow, killer, victim, obj );
|
||||
}
|
||||
} catch {
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
} else {
|
||||
weight -= item.Weight;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from ) {
|
||||
if ( !IsChildOf( from.Backpack ) ) {
|
||||
from.SendLocalizedMessage( 1042038 ); // You must have the object in your backpack to use it.
|
||||
} else if ( from is PlayerMobile && ((PlayerMobile)from).DuelContext != null ) {
|
||||
from.SendMessage( "You can't use that." );
|
||||
} else if ( Faction.Find( from ) == null ) {
|
||||
from.LocalOverheadMessage( Server.Network.MessageType.Regular, 2119, false, "The object vanishes from your hands as you touch it." );
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), delegate() {
|
||||
from.LocalOverheadMessage( Server.Network.MessageType.Regular, 2118, false, "You feel a strange tingling sensation throughout your body." );
|
||||
} );
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 4.0 ), delegate() {
|
||||
from.LocalOverheadMessage( Server.Network.MessageType.Regular, 2118, false, "Your skin begins to burn." );
|
||||
} );
|
||||
|
||||
new DestructionTimer( from ).Start();
|
||||
Delete();
|
||||
|
||||
//from.SendMessage( "You must be in a faction to use this item." );
|
||||
} else if ( Use( from ) ) {
|
||||
from.RevealingAction();
|
||||
Consume();
|
||||
}
|
||||
}
|
||||
|
||||
public PowerFactionItem( int itemId )
|
||||
: base( itemId ) {
|
||||
}
|
||||
|
||||
public PowerFactionItem( Serial serial )
|
||||
: base( serial ) {
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer ) {
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( ( int ) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader ) {
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
118
Scripts/Engines/Factions/Items/Power Faction Items/StormsEye.cs
Normal file
118
Scripts/Engines/Factions/Items/Power Faction Items/StormsEye.cs
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using Server;
|
||||
using Server.Spells;
|
||||
using Server.Gumps;
|
||||
using Server.Multis;
|
||||
using Server.Mobiles;
|
||||
using Server.Factions;
|
||||
|
||||
namespace Server {
|
||||
public sealed class StormsEye : PowerFactionItem {
|
||||
public override string DefaultName {
|
||||
get {
|
||||
return "storms eye";
|
||||
}
|
||||
}
|
||||
|
||||
public StormsEye()
|
||||
: base( 3967 ) {
|
||||
Hue = 1165;
|
||||
}
|
||||
|
||||
public StormsEye( Serial serial )
|
||||
: base( serial ) {
|
||||
}
|
||||
|
||||
public override bool Use( Mobile user ) {
|
||||
if ( this.Movable ) {
|
||||
user.BeginTarget( 12, true, Server.Targeting.TargetFlags.None, delegate( Mobile from, object obj ) {
|
||||
if ( this.Movable && !this.Deleted ) {
|
||||
IPoint3D pt = obj as IPoint3D;
|
||||
|
||||
if ( pt != null ) {
|
||||
SpellHelper.GetSurfaceTop( ref pt );
|
||||
|
||||
Point3D origin = new Point3D( pt );
|
||||
Map facet = from.Map;
|
||||
|
||||
if ( facet != null && facet.CanFit( pt.X, pt.Y, pt.Z, 16, false, false, true ) ) {
|
||||
this.Movable = false;
|
||||
|
||||
Effects.SendMovingEffect(
|
||||
from, new Entity( Serial.Zero, origin, facet ),
|
||||
this.ItemID & 0x3FFF, 7, 0, false, false, this.Hue - 1, 0
|
||||
);
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 0.5 ), delegate() {
|
||||
this.Delete();
|
||||
|
||||
Effects.PlaySound( origin, facet, 530 );
|
||||
Effects.PlaySound( origin, facet, 263 );
|
||||
|
||||
Effects.SendLocationEffect(
|
||||
origin, facet,
|
||||
14284, 96, 1, 0, 2
|
||||
);
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), delegate() {
|
||||
List<Mobile> targets = new List<Mobile>();
|
||||
|
||||
foreach ( Mobile mob in facet.GetMobilesInRange( origin, 12 ) ) {
|
||||
if ( from.CanBeHarmful( mob, false ) && mob.InLOS( new Point3D( origin, origin.Z + 1 ) ) ) {
|
||||
if ( Faction.Find( mob ) != null ) {
|
||||
targets.Add( mob );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( Mobile mob in targets ) {
|
||||
int damage = ( mob.Hits * 6 ) / 10;
|
||||
|
||||
if ( !mob.Player && damage < 10 ) {
|
||||
damage = 10;
|
||||
} else if ( damage > 75 ) {
|
||||
damage = 75;
|
||||
}
|
||||
|
||||
Effects.SendMovingEffect(
|
||||
new Entity( Serial.Zero, new Point3D( origin, origin.Z + 4 ), facet ), mob,
|
||||
14068, 1, 32, false, false, 1111, 2
|
||||
);
|
||||
|
||||
from.DoHarmful( mob );
|
||||
|
||||
SpellHelper.Damage( TimeSpan.FromSeconds( 0.50 ), mob, from, damage / 3, 0, 0, 0, 0, 100 );
|
||||
SpellHelper.Damage( TimeSpan.FromSeconds( 0.70 ), mob, from, damage / 3, 0, 0, 0, 0, 100 );
|
||||
SpellHelper.Damage( TimeSpan.FromSeconds( 1.00 ), mob, from, damage / 3, 0, 0, 0, 0, 100 );
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 0.50 ), delegate() {
|
||||
mob.PlaySound( 0x1FB );
|
||||
} );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
}
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer ) {
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( ( int ) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader ) {
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Multis;
|
||||
using Server.Mobiles;
|
||||
using Server.Factions;
|
||||
|
||||
namespace Server {
|
||||
public sealed class UrnOfAscension : PowerFactionItem {
|
||||
public override string DefaultName {
|
||||
get {
|
||||
return "urn of ascension";
|
||||
}
|
||||
}
|
||||
|
||||
public UrnOfAscension()
|
||||
: base( 9246 ) {
|
||||
}
|
||||
|
||||
public UrnOfAscension( Serial serial )
|
||||
: base( serial ) {
|
||||
}
|
||||
|
||||
public override bool Use( Mobile from ) {
|
||||
Faction ourFaction = Faction.Find( from );
|
||||
|
||||
bool used = false;
|
||||
|
||||
foreach ( Mobile mob in from.GetMobilesInRange( 8 ) ) {
|
||||
if ( mob.Player && !mob.Alive && from.InLOS( mob ) ) {
|
||||
if ( Faction.Find( mob ) != ourFaction ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
BaseHouse house = BaseHouse.FindHouseAt( mob );
|
||||
|
||||
if ( house == null || ( house.IsFriend( from ) || house.IsFriend( mob ) ) ) {
|
||||
Faction.ClearSkillLoss( mob );
|
||||
|
||||
mob.SendGump( new ResurrectGump( mob, from, ResurrectMessage.Generic ) );
|
||||
used = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( used ) {
|
||||
from.LocalOverheadMessage( Server.Network.MessageType.Regular, 2219, false, "The urn shatters as you invoke its power." );
|
||||
from.PlaySound( 64 );
|
||||
|
||||
Effects.PlaySound( from.Location, from.Map, 1481 );
|
||||
}
|
||||
|
||||
return used;
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer ) {
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( ( int ) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader ) {
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -312,6 +312,12 @@
|
|||
<Compile Include="Engines\Factions\Items\BaseSystemController.cs" />
|
||||
<Compile Include="Engines\Factions\Items\FactionStone.cs" />
|
||||
<Compile Include="Engines\Factions\Items\JoinStone.cs" />
|
||||
<Compile Include="Engines\Factions\Items\Power Faction Items\BloodRose.cs" />
|
||||
<Compile Include="Engines\Factions\Items\Power Faction Items\ClarityPotion.cs" />
|
||||
<Compile Include="Engines\Factions\Items\Power Faction Items\GemOfEmpowerment.cs" />
|
||||
<Compile Include="Engines\Factions\Items\Power Faction Items\PowerFactionItem.cs" />
|
||||
<Compile Include="Engines\Factions\Items\Power Faction Items\StormsEye.cs" />
|
||||
<Compile Include="Engines\Factions\Items\Power Faction Items\UrnOfAscension.cs" />
|
||||
<Compile Include="Engines\Factions\Items\Sigil.cs" />
|
||||
<Compile Include="Engines\Factions\Items\Silver.cs" />
|
||||
<Compile Include="Engines\Factions\Items\StrongholdMonolith.cs" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue