ModernUO/Scripts/Engines/Virtues/Sacrifice.cs
daedalus 95de3595cd - You can't anymore place castles or keeps in Malas facet
(http://www.runuo.com/bugs/index.php?cmd=view&id=38)

- Unfilled commodity deeds now carry the etching "Unfilled"
(http://www.runuo.com/bugs/index.php?cmd=view&id=40)

- Empty scrolls can be deeded in a commodity deed
(http://www.uodemise.com/discussion/showthread.php?t=127485)

- Dying tubs, if locked down, can allow security level choices
(http://www.uodemise.com/discussion/showthread.php?t=128546)

- Changes in Energy Vortex skills: they'll have 120 wrestling (it was 100) and 100 tactics (it was 90)
(http://www.uodemise.com/discussion/showthread.php?t=122733)

- Wooden Footlockers now show the correct container gump
(http://www.uodemise.com/discussion/showthread.php?t=126452)

- Changes to Interior Decorator (still not includes the fix to turn paragon chests):
--> single item addons can be raised/lowered
--> the gump stays visible until target is cancelled
--> target won't be cancelled automatically when the decorator is used on a target
(http://www.uodemise.com/discussion/showthread.php?t=126668)

- Doom Lever Puzzle item list changed to generics
(http://www.uodemise.com/discussion/showthread.php?t=130396)

- Morphed forms will check now the current skill level: the morph effect is lost if skill level goes under the minimum required.
(http://www.uodemise.com/discussion/showthread.php?t=116542)

- Mage NPC vendors now buy necro scrolls; the price of scrolls got tweaked (= raised) to match OSI
(http://www.runuo.com/bugs/index.php?cmd=view&id=90)
(http://www.runuo.com/bugs/index.php?cmd=view&id=113)

- You can't anymore discord NPC vendors
(http://www.runuo.com/bugs/index.php?cmd=view&id=33)

- Removing a rune from runebook won't change the default rune set
(http://www.runuo.com/bugs/index.php?cmd=view&id=41)

- Various runebook security changes (see link for the list)
(http://www.runuo.com/bugs/index.php?cmd=view&id=39)

- You can't use the Sacrifice virtue while hidden
(http://www.runuo.com/bugs/index.php?cmd=view&id=42)

- Added the Deceit Brazier: doubleclicking it will summon a random "britannian" monster (check [props for delays)
(http://www.uodemise.com/discussion/showthread.php?t=123805)

- Casting spells will raise also the secondary skill associated (example: Necro and SpiritSpeak)
(http://www.runuo.com/bugs/index.php?cmd=view&id=43)

- Word of Death changes:
--> the "pitful damage" is much powerful now
--> you have to bring the target health below (5*arcanefocus)% to strike the powerful blast of 300 chaos damage
--> the damage is influenced by SDI
(http://www.runuo.com/bugs/index.php?cmd=view&id=36)

- Teleporters generated by [telgen got corrected for the Wrong dungeon
(http://www.runuo.com/bugs/index.php?cmd=view&id=34)
2009-11-09 19:29:19 +00:00

194 lines
No EOL
5 KiB
C#

using System;
using Server;
using Server.Gumps;
using Server.Mobiles;
using Server.Targeting;
using Server.Network;
namespace Server
{
public class SacrificeVirtue
{
private static TimeSpan GainDelay = TimeSpan.FromDays( 1.0 );
private static TimeSpan LossDelay = TimeSpan.FromDays( 7.0 );
private const int LossAmount = 500;
public static void Initialize()
{
VirtueGump.Register( 110, new OnVirtueUsed( OnVirtueUsed ) );
}
public static void OnVirtueUsed( Mobile from )
{
if ( !from.Hidden )
{
if ( from.Alive )
from.Target = new InternalTarget();
else
Resurrect( from );
}
else
from.SendLocalizedMessage( 1052015 ); // You cannot do that while hidden.
}
public static void CheckAtrophy( Mobile from )
{
PlayerMobile pm = from as PlayerMobile;
if ( pm == null )
return;
try
{
if ( (pm.LastSacrificeLoss + LossDelay) < DateTime.Now )
{
if ( VirtueHelper.Atrophy( from, VirtueName.Sacrifice, LossAmount ) )
from.SendLocalizedMessage( 1052041 ); // You have lost some Sacrifice.
VirtueLevel level = VirtueHelper.GetLevel( from, VirtueName.Sacrifice );
pm.AvailableResurrects = (int)level;
pm.LastSacrificeLoss = DateTime.Now;
}
}
catch
{
}
}
public static void Resurrect( Mobile from )
{
if ( from.Alive )
return;
PlayerMobile pm = from as PlayerMobile;
if ( pm == null )
return;
if ( from.Criminal )
{
from.SendLocalizedMessage( 1052007 ); // You cannot use this ability while flagged as a criminal.
}
else if ( !VirtueHelper.IsSeeker( from, VirtueName.Sacrifice ) )
{
from.SendLocalizedMessage( 1052004 ); // You cannot use this ability.
}
else if ( pm.AvailableResurrects <= 0 )
{
from.SendLocalizedMessage( 1052005 ); // You do not have any resurrections left.
}
else
{
/*
* We need to wait for them to accept the gump or they can just use
* Sacrifice and cancel to have items in their backpack for free.
*/
from.CloseGump( typeof( ResurrectGump ) );
from.SendGump( new ResurrectGump( from, true ) );
}
}
public static void Sacrifice( Mobile from, object targeted )
{
if ( !from.CheckAlive() )
return;
PlayerMobile pm = from as PlayerMobile;
if ( pm == null )
return;
Mobile targ = targeted as Mobile;
if ( targ == null )
return;
if ( !ValidateCreature( targ ) )
{
from.SendLocalizedMessage( 1052014 ); // You cannot sacrifice your fame for that creature.
}
else if ( ((targ.Hits * 100) / Math.Max( targ.HitsMax, 1 )) < 90 )
{
from.SendLocalizedMessage( 1052013 ); // You cannot sacrifice for this monster because it is too damaged.
}
else if ( from.Hidden )
{
from.SendLocalizedMessage( 1052015 ); // You cannot do that while hidden.
}
else if ( VirtueHelper.IsHighestPath( from, VirtueName.Sacrifice ) )
{
from.SendLocalizedMessage( 1052068 ); // You have already attained the highest path in this virtue.
}
else if ( from.Fame < 2500 )
{
from.SendLocalizedMessage( 1052017 ); // You do not have enough fame to sacrifice.
}
else if ( DateTime.Now < (pm.LastSacrificeGain + GainDelay) )
{
from.SendLocalizedMessage( 1052016 ); // You must wait approximately one day before sacrificing again.
}
else
{
int toGain;
if( from.Fame < 5000 )
toGain = 500;
else if( from.Fame < 10000 )
toGain = 1000;
else
toGain = 2000;
from.Fame = 0;
// I have seen the error of my ways!
targ.PublicOverheadMessage( MessageType.Regular, 0x3B2, 1052009 );
from.SendLocalizedMessage( 1052010 ); // You have set the creature free.
Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerCallback( targ.Delete ) );
pm.LastSacrificeGain = DateTime.Now;
bool gainedPath = false;
if ( VirtueHelper.Award( from, VirtueName.Sacrifice, toGain, ref gainedPath ) )
{
if ( gainedPath )
{
from.SendLocalizedMessage( 1052008 ); // You have gained a path in Sacrifice!
if ( pm.AvailableResurrects < 3 )
++pm.AvailableResurrects;
}
else
{
from.SendLocalizedMessage( 1054160 ); // You have gained in sacrifice.
}
}
from.SendLocalizedMessage( 1052016 ); // You must wait approximately one day before sacrificing again.
}
}
public static bool ValidateCreature( Mobile m )
{
if ( m is BaseCreature && (((BaseCreature)m).Controlled || ((BaseCreature)m).Summoned) )
return false;
return ( m is Lich || m is Succubus || m is Daemon || m is EvilMage || m is EnslavedGargoyle || m is GargoyleEnforcer );
}
private class InternalTarget : Target
{
public InternalTarget() : base( 8, false, TargetFlags.None )
{
}
protected override void OnTarget( Mobile from, object targeted )
{
Sacrifice( from, targeted );
}
}
}
}