fix: Fixes starting champion with valor (#1088)
This commit is contained in:
parent
087cc15f39
commit
bc2ed44440
1 changed files with 108 additions and 115 deletions
|
|
@ -3,146 +3,139 @@ using Server.Engines.CannedEvil;
|
||||||
using Server.Mobiles;
|
using Server.Mobiles;
|
||||||
using Server.Targeting;
|
using Server.Targeting;
|
||||||
|
|
||||||
namespace Server
|
namespace Server;
|
||||||
{
|
|
||||||
public static class ValorVirtue
|
|
||||||
{
|
|
||||||
private const int LossAmount = 250;
|
|
||||||
private static readonly TimeSpan LossDelay = TimeSpan.FromDays(7.0);
|
|
||||||
|
|
||||||
public static void Initialize()
|
public static class ValorVirtue
|
||||||
|
{
|
||||||
|
private const int LossAmount = 250;
|
||||||
|
private static readonly TimeSpan LossDelay = TimeSpan.FromDays(7.0);
|
||||||
|
|
||||||
|
public static void Initialize()
|
||||||
|
{
|
||||||
|
VirtueGump.Register(112, OnVirtueUsed);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void OnVirtueUsed(Mobile from)
|
||||||
|
{
|
||||||
|
if (from.Alive)
|
||||||
{
|
{
|
||||||
VirtueGump.Register(112, OnVirtueUsed);
|
from.SendLocalizedMessage(1054034); // Target the Champion Idol of the Champion you wish to challenge!.
|
||||||
|
from.Target = new InternalTarget();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void CheckAtrophy(Mobile from)
|
||||||
|
{
|
||||||
|
if (from is not PlayerMobile pm)
|
||||||
|
{
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void OnVirtueUsed(Mobile from)
|
try
|
||||||
{
|
{
|
||||||
if (from.Alive)
|
if (pm.LastValorLoss + LossDelay < Core.Now)
|
||||||
{
|
{
|
||||||
from.SendLocalizedMessage(1054034); // Target the Champion Idol of the Champion you wish to challenge!.
|
if (VirtueHelper.Atrophy(from, VirtueName.Valor, LossAmount))
|
||||||
from.Target = new InternalTarget();
|
{
|
||||||
|
from.SendLocalizedMessage(1054040); // You have lost some Valor.
|
||||||
|
}
|
||||||
|
|
||||||
|
pm.LastValorLoss = Core.Now;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch
|
||||||
public static void CheckAtrophy(Mobile from)
|
|
||||||
{
|
{
|
||||||
if (from is not PlayerMobile pm)
|
// ignored
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Valor(Mobile from, object targ)
|
||||||
|
{
|
||||||
|
if (targ is not IdolOfTheChampion idol || idol.Deleted || idol.Spawn?.Deleted != false)
|
||||||
|
{
|
||||||
|
from.SendLocalizedMessage(1054035); // You must target a Champion Idol to challenge the Champion's spawn!
|
||||||
|
}
|
||||||
|
else if (from.Hidden)
|
||||||
|
{
|
||||||
|
from.SendLocalizedMessage(1052015); // You cannot do that while hidden.
|
||||||
|
}
|
||||||
|
else if (idol.Spawn.HasBeenAdvanced)
|
||||||
|
{
|
||||||
|
from.SendLocalizedMessage(1054038); // The Champion of this region has already been challenged!
|
||||||
|
}
|
||||||
|
else if (idol.Spawn.Active)
|
||||||
|
{
|
||||||
|
if (idol.Spawn.Champion != null) // TODO: Message?
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
int needed, consumed;
|
||||||
|
switch (idol.Spawn.GetSubLevel())
|
||||||
{
|
{
|
||||||
if (pm.LastValorLoss + LossDelay < Core.Now)
|
case 0:
|
||||||
{
|
|
||||||
if (VirtueHelper.Atrophy(from, VirtueName.Valor, LossAmount))
|
|
||||||
{
|
{
|
||||||
from.SendLocalizedMessage(1054040); // You have lost some Valor.
|
needed = consumed = 2500;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
needed = consumed = 5000;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
needed = 10000;
|
||||||
|
consumed = 7500;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
needed = 20000;
|
||||||
|
consumed = 10000;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pm.LastValorLoss = Core.Now;
|
if (from.Virtues.GetValue((int)VirtueName.Valor) >= needed)
|
||||||
}
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
{
|
||||||
// ignored
|
VirtueHelper.Atrophy(from, VirtueName.Valor, consumed);
|
||||||
}
|
// Your challenge is heard by the Champion of this region! Beware its wrath!
|
||||||
}
|
from.SendLocalizedMessage(1054037);
|
||||||
|
idol.Spawn.HasBeenAdvanced = true;
|
||||||
public static void Valor(Mobile from, object targ)
|
idol.Spawn.AdvanceLevel();
|
||||||
{
|
|
||||||
if (targ is not IdolOfTheChampion idol || idol.Deleted || idol.Spawn?.Deleted != false)
|
|
||||||
{
|
|
||||||
from.SendLocalizedMessage(1054035); // You must target a Champion Idol to challenge the Champion's spawn!
|
|
||||||
}
|
|
||||||
else if (from.Hidden)
|
|
||||||
{
|
|
||||||
from.SendLocalizedMessage(1052015); // You cannot do that while hidden.
|
|
||||||
}
|
|
||||||
else if (idol.Spawn.HasBeenAdvanced)
|
|
||||||
{
|
|
||||||
from.SendLocalizedMessage(1054038); // The Champion of this region has already been challenged!
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var vl = VirtueHelper.GetLevel(from, VirtueName.Valor);
|
// The Champion of this region ignores your challenge. You must further prove your valor.
|
||||||
if (idol.Spawn.Active)
|
from.SendLocalizedMessage(1054039);
|
||||||
{
|
|
||||||
if (idol.Spawn.Champion != null) // TODO: Message?
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int needed, consumed;
|
|
||||||
switch (idol.Spawn.GetSubLevel())
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
{
|
|
||||||
needed = consumed = 2500;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 1:
|
|
||||||
{
|
|
||||||
needed = consumed = 5000;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 2:
|
|
||||||
{
|
|
||||||
needed = 10000;
|
|
||||||
consumed = 7500;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
needed = 20000;
|
|
||||||
consumed = 10000;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (from.Virtues.GetValue((int)VirtueName.Valor) >= needed)
|
|
||||||
{
|
|
||||||
VirtueHelper.Atrophy(from, VirtueName.Valor, consumed);
|
|
||||||
// Your challenge is heard by the Champion of this region! Beware its wrath!
|
|
||||||
from.SendLocalizedMessage(1054037);
|
|
||||||
idol.Spawn.HasBeenAdvanced = true;
|
|
||||||
idol.Spawn.AdvanceLevel();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// The Champion of this region ignores your challenge. You must further prove your valor.
|
|
||||||
from.SendLocalizedMessage(1054039);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (vl == VirtueLevel.Knight)
|
|
||||||
{
|
|
||||||
VirtueHelper.Atrophy(from, VirtueName.Valor, 11000);
|
|
||||||
// Your challenge is heard by the Champion of this region! Beware its wrath!
|
|
||||||
from.SendLocalizedMessage(1054037);
|
|
||||||
idol.Spawn.EndRestart();
|
|
||||||
idol.Spawn.HasBeenAdvanced = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// You must be a Knight of Valor to summon the champion's spawn in this manner!
|
|
||||||
from.SendLocalizedMessage(1054036);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (VirtueHelper.GetLevel(from, VirtueName.Valor) == VirtueLevel.Knight)
|
||||||
private class InternalTarget : Target
|
|
||||||
{
|
{
|
||||||
public InternalTarget() : base(14, false, TargetFlags.None)
|
VirtueHelper.Atrophy(from, VirtueName.Valor, 11000);
|
||||||
{
|
// Your challenge is heard by the Champion of this region! Beware its wrath!
|
||||||
}
|
from.SendLocalizedMessage(1054037);
|
||||||
|
idol.Spawn.Start();
|
||||||
|
// Uncomment to not allow advancing level after starting with valor.
|
||||||
|
// idol.Spawn.HasBeenAdvanced = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// You must be a Knight of Valor to summon the champion's spawn in this manner!
|
||||||
|
from.SendLocalizedMessage(1054036);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnTarget(Mobile from, object targeted)
|
private class InternalTarget : Target
|
||||||
{
|
{
|
||||||
Valor(from, targeted);
|
public InternalTarget() : base(14, false, TargetFlags.None)
|
||||||
}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnTarget(Mobile from, object targeted)
|
||||||
|
{
|
||||||
|
Valor(from, targeted);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue