Fixes chaos damage bug with the spell system. Fixes various small other bugs. Fixes more merge cast type checks and uses default values.
This commit is contained in:
parent
9542c79ea4
commit
c155c82325
115 changed files with 644 additions and 1041 deletions
|
|
@ -113,8 +113,8 @@ namespace Server.Spells.Chivalry
|
|||
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
if (o is Mobile)
|
||||
m_Owner.Target((Mobile)o);
|
||||
if (o is Mobile mobile)
|
||||
m_Owner.Target(mobile);
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish(Mobile from)
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ namespace Server.Spells.Chivalry
|
|||
{
|
||||
Caster.SendLocalizedMessage(1060178); // You are too far away to perform that action!
|
||||
}
|
||||
else if (m is BaseCreature && ((BaseCreature)m).IsAnimatedDead)
|
||||
else if (m is BaseCreature creature && creature.IsAnimatedDead)
|
||||
{
|
||||
Caster.SendLocalizedMessage(1061654); // You cannot heal that which is not alive.
|
||||
}
|
||||
|
|
@ -72,19 +72,12 @@ namespace Server.Spells.Chivalry
|
|||
* The caster's Karma affects the amount of damage healed.
|
||||
*/
|
||||
|
||||
int toHeal = ComputePowerValue(6) + Utility.RandomMinMax(0, 2);
|
||||
|
||||
// TODO: Should caps be applied?
|
||||
if (toHeal < 7)
|
||||
toHeal = 7;
|
||||
else if (toHeal > 39)
|
||||
toHeal = 39;
|
||||
int toHeal = Math.Min(Math.Max(ComputePowerValue(6) + Utility.RandomMinMax(0, 2), 7), 39);
|
||||
|
||||
if (m.Hits + toHeal > m.HitsMax)
|
||||
toHeal = m.HitsMax - m.Hits;
|
||||
|
||||
//m.Hits += toHeal; //Was previously due to the message
|
||||
//m.Heal( toHeal, Caster, false );
|
||||
SpellHelper.Heal(toHeal, m, Caster, false);
|
||||
|
||||
m.SendLocalizedMessage(1060203,
|
||||
|
|
@ -109,8 +102,8 @@ namespace Server.Spells.Chivalry
|
|||
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
if (o is Mobile)
|
||||
m_Owner.Target((Mobile)o);
|
||||
if (o is Mobile mobile)
|
||||
m_Owner.Target(mobile);
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish(Mobile from)
|
||||
|
|
|
|||
|
|
@ -28,9 +28,7 @@ namespace Server.Spells.Chivalry
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
BaseWeapon weapon = Caster.Weapon as BaseWeapon;
|
||||
|
||||
if (weapon == null || weapon is Fists)
|
||||
if (!(Caster.Weapon is BaseWeapon weapon) || weapon is Fists)
|
||||
{
|
||||
Caster.SendLocalizedMessage(501078); // You must be holding a weapon.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,13 +54,10 @@ namespace Server.Spells.Chivalry
|
|||
for (int i = 0; i < targets.Count; ++i)
|
||||
{
|
||||
Mobile m = targets[i];
|
||||
BaseCreature bc = m as BaseCreature;
|
||||
|
||||
if (bc != null)
|
||||
if (m is BaseCreature bc)
|
||||
{
|
||||
bool dispellable = bc.Summoned && !bc.IsAnimatedDead;
|
||||
|
||||
if (dispellable)
|
||||
if (bc.Summoned && !bc.IsAnimatedDead)
|
||||
{
|
||||
double dispelChance = (50.0 + 100 * (chiv - bc.DispelDifficulty) / (bc.DispelFocus * 2)) / 100;
|
||||
dispelChance *= dispelSkill / 100.0;
|
||||
|
|
|
|||
|
|
@ -50,13 +50,13 @@ namespace Server.Spells.Chivalry
|
|||
m_Table[Caster] = Timer.DelayCall(TimeSpan.FromMinutes(delay), new TimerStateCallback(Expire_Callback),
|
||||
Caster);
|
||||
|
||||
if (Caster is PlayerMobile)
|
||||
if (Caster is PlayerMobile mobile)
|
||||
{
|
||||
((PlayerMobile)Caster).EnemyOfOneType = null;
|
||||
((PlayerMobile)Caster).WaitingForEnemy = true;
|
||||
mobile.EnemyOfOneType = null;
|
||||
mobile.WaitingForEnemy = true;
|
||||
|
||||
BuffInfo.AddBuff(Caster,
|
||||
new BuffInfo(BuffIcon.EnemyOfOne, 1075653, 1044111, TimeSpan.FromMinutes(delay), Caster));
|
||||
BuffInfo.AddBuff(mobile,
|
||||
new BuffInfo(BuffIcon.EnemyOfOne, 1075653, 1044111, TimeSpan.FromMinutes(delay), mobile));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -71,10 +71,10 @@ namespace Server.Spells.Chivalry
|
|||
|
||||
m.PlaySound(0x1F8);
|
||||
|
||||
if (m is PlayerMobile)
|
||||
if (m is PlayerMobile mobile)
|
||||
{
|
||||
((PlayerMobile)m).EnemyOfOneType = null;
|
||||
((PlayerMobile)m).WaitingForEnemy = false;
|
||||
mobile.EnemyOfOneType = null;
|
||||
mobile.WaitingForEnemy = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ namespace Server.Spells.Chivalry
|
|||
|
||||
foreach (Mobile m in Caster.GetMobilesInRange(3)) // TODO: Validate range
|
||||
{
|
||||
if (m is BaseCreature && ((BaseCreature)m).IsAnimatedDead)
|
||||
if (m is BaseCreature creature && creature.IsAnimatedDead)
|
||||
continue;
|
||||
|
||||
if (Caster != m && m.InLOS(Caster) && Caster.CanBeBeneficial(m, false, true) && !(m is Golem))
|
||||
|
|
@ -54,7 +54,7 @@ namespace Server.Spells.Chivalry
|
|||
bool sacrifice = false;
|
||||
|
||||
// TODO: Is there really a resurrection chance?
|
||||
double resChance = 0.1 + 0.9 * ((double)Caster.Karma / 10000);
|
||||
double resChance = 0.1 + 0.9 * Caster.Karma / 10000.0d;
|
||||
|
||||
for (int i = 0; i < targets.Count; ++i)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -76,9 +76,7 @@ namespace Server.Spells.Chivalry
|
|||
Effects.SendMovingParticles(from, to, 0x2255, 1, 0, false, false, 13, 3, 9501, 1, 0, EffectLayer.Head,
|
||||
0x100);
|
||||
|
||||
StatMod mod;
|
||||
|
||||
mod = m.GetStatMod("[Magic] Str Offset");
|
||||
StatMod mod = m.GetStatMod("[Magic] Str Offset");
|
||||
if (mod != null && mod.Offset < 0)
|
||||
m.RemoveStatMod("[Magic] Str Offset");
|
||||
|
||||
|
|
@ -130,8 +128,8 @@ namespace Server.Spells.Chivalry
|
|||
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
if (o is Mobile)
|
||||
m_Owner.Target((Mobile)o);
|
||||
if (o is Mobile mobile)
|
||||
m_Owner.Target(mobile);
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish(Mobile from)
|
||||
|
|
|
|||
|
|
@ -21,11 +21,7 @@ namespace Server.Spells.Chivalry
|
|||
|
||||
private RunebookEntry m_Entry;
|
||||
|
||||
public SacredJourneySpell(Mobile caster, Item scroll) : this(caster, scroll, null, null)
|
||||
{
|
||||
}
|
||||
|
||||
public SacredJourneySpell(Mobile caster, Item scroll, RunebookEntry entry, Runebook book) : base(caster, scroll,
|
||||
public SacredJourneySpell(Mobile caster, Item scroll, RunebookEntry entry = null, Runebook book = null) : base(caster, scroll,
|
||||
m_Info)
|
||||
{
|
||||
m_Entry = entry;
|
||||
|
|
@ -96,9 +92,9 @@ namespace Server.Spells.Chivalry
|
|||
else if (!SpellHelper.CheckTravel(Caster, map, loc, TravelCheckType.RecallTo))
|
||||
{
|
||||
}
|
||||
else if (map == Map.Felucca && Caster is PlayerMobile && ((PlayerMobile)Caster).Young)
|
||||
else if (map == Map.Felucca && Caster is PlayerMobile mobile && mobile.Young)
|
||||
{
|
||||
Caster.SendLocalizedMessage(1049543); // You decide against traveling to Felucca while you are still young.
|
||||
mobile.SendLocalizedMessage(1049543); // You decide against traveling to Felucca while you are still young.
|
||||
}
|
||||
else if (Caster.Kills >= 5 && map != Map.Felucca)
|
||||
{
|
||||
|
|
@ -157,38 +153,32 @@ namespace Server.Spells.Chivalry
|
|||
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
if (o is RecallRune)
|
||||
if (o is RecallRune rune)
|
||||
{
|
||||
RecallRune rune = (RecallRune)o;
|
||||
|
||||
if (rune.Marked)
|
||||
m_Owner.Effect(rune.Target, rune.TargetMap, true);
|
||||
else
|
||||
from.SendLocalizedMessage(501805); // That rune is not yet marked.
|
||||
}
|
||||
else if (o is Runebook)
|
||||
else if (o is Runebook runebook)
|
||||
{
|
||||
RunebookEntry e = ((Runebook)o).Default;
|
||||
RunebookEntry e = runebook.Default;
|
||||
|
||||
if (e != null)
|
||||
m_Owner.Effect(e.Location, e.Map, true);
|
||||
else
|
||||
from.SendLocalizedMessage(502354); // Target is not marked.
|
||||
}
|
||||
else if (o is Key && ((Key)o).KeyValue != 0 && ((Key)o).Link is BaseBoat)
|
||||
else if (o is Key key && key.KeyValue != 0 && key.Link is BaseBoat boat)
|
||||
{
|
||||
BaseBoat boat = ((Key)o).Link as BaseBoat;
|
||||
|
||||
if (!boat.Deleted && boat.CheckKey(((Key)o).KeyValue))
|
||||
if (!boat.Deleted && boat.CheckKey(key.KeyValue))
|
||||
m_Owner.Effect(boat.GetMarkedLocation(), boat.Map, false);
|
||||
else
|
||||
from.Send(new MessageLocalized(from.Serial, from.Body, MessageType.Regular, 0x3B2, 3, 502357,
|
||||
from.Name, "")); // I can not recall from that object.
|
||||
}
|
||||
else if (o is HouseRaffleDeed && ((HouseRaffleDeed)o).ValidLocation())
|
||||
else if (o is HouseRaffleDeed deed && deed.ValidLocation())
|
||||
{
|
||||
HouseRaffleDeed deed = (HouseRaffleDeed)o;
|
||||
|
||||
m_Owner.Effect(deed.PlotLocation, deed.PlotFacet, true);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue