Modernization Fixes & Updates to Default Values (#3)

This commit is contained in:
Kamron Batman 2018-10-28 00:33:16 -07:00 • committed by GitHub
parent 445eddff68
commit dcf64091b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
768 changed files with 10507 additions and 14196 deletions

View file

@ -128,20 +128,16 @@ namespace Server.Mobiles
if (defender.Alive)
{
defender.Frozen = true;
Timer.DelayCall(TimeSpan.FromSeconds(5.0), new TimerStateCallback(Recover_Callback), defender);
Timer.DelayCall(TimeSpan.FromSeconds(5.0), Recover_Callback, defender);
}
}
}
private void Recover_Callback(object state)
private void Recover_Callback(Mobile defender)
{
if (state is Mobile defender)
{
defender.Frozen = false;
defender.Combatant = null;
defender.LocalOverheadMessage(MessageType.Regular, 0x3B2, false, "You recover your senses.");
}
defender.Frozen = false;
defender.Combatant = null;
defender.LocalOverheadMessage(MessageType.Regular, 0x3B2, false, "You recover your senses.");
m_Stunning = false;
}

View file

@ -1,5 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Server.Items;
using Server.Spells;
@ -118,11 +120,11 @@ namespace Server.Mobiles
if (Map == null)
return;
ArrayList list = new ArrayList();
List<SavageShaman> list = new List<SavageShaman>();
foreach (Mobile m in GetMobilesInRange(8))
if (m != this && m is SavageShaman)
list.Add(m);
if (m != this && m is SavageShaman ss)
list.Add(ss);
Animate(111, 5, 1, true, false, 0); // Do a little dance...
@ -133,7 +135,7 @@ namespace Server.Mobiles
{
for (int i = 0; i < list.Count; ++i)
{
SavageShaman dancer = (SavageShaman)list[i];
SavageShaman dancer = list[i];
dancer.Animate(111, 5, 1, true, false, 0); // Get down tonight...
@ -150,120 +152,118 @@ namespace Server.Mobiles
if (Deleted)
return;
ArrayList list = new ArrayList();
foreach (Mobile m in GetMobilesInRange(8))
list.Add(m);
if (list.Count > 0)
switch (Utility.Random(3))
IPooledEnumerable<Mobile> eable = GetMobilesInRange(8);
switch (Utility.Random(3))
{
case 0: /* greater heal */
{
case 0: /* greater heal */
foreach (Mobile m in eable)
{
foreach (Mobile m in list)
{
bool isFriendly = m is Savage || m is SavageRider || m is SavageShaman || m is SavageRidgeback;
bool isFriendly = m is Savage || m is SavageRider || m is SavageShaman || m is SavageRidgeback;
if (!isFriendly)
continue;
if (!isFriendly)
continue;
if (m.Poisoned || MortalStrike.IsWounded(m) || !CanBeBeneficial(m))
continue;
if (m.Poisoned || MortalStrike.IsWounded(m) || !CanBeBeneficial(m))
continue;
DoBeneficial(m);
DoBeneficial(m);
// Algorithm: (40% of magery) + (1-10)
// Algorithm: (40% of magery) + (1-10)
int toHeal = (int)(Skills[SkillName.Magery].Value * 0.4);
toHeal += Utility.Random(1, 10);
int toHeal = (int)(Skills.Magery.Value * 0.4);
toHeal += Utility.Random(1, 10);
m.Heal(toHeal, this);
m.Heal(toHeal, this);
m.FixedParticles(0x376A, 9, 32, 5030, EffectLayer.Waist);
m.PlaySound(0x202);
}
break;
m.FixedParticles(0x376A, 9, 32, 5030, EffectLayer.Waist);
m.PlaySound(0x202);
}
case 1: /* lightning */
{
foreach (Mobile m in list)
{
bool isFriendly = m is Savage || m is SavageRider || m is SavageShaman || m is SavageRidgeback;
if (isFriendly)
continue;
if (!CanBeHarmful(m))
continue;
DoHarmful(m);
double damage;
if (Core.AOS)
{
int baseDamage = 6 + (int)(Skills[SkillName.EvalInt].Value / 5.0);
damage = Utility.RandomMinMax(baseDamage, baseDamage + 3);
}
else
{
damage = Utility.Random(12, 9);
}
m.BoltEffect(0);
SpellHelper.Damage(TimeSpan.FromSeconds(0.25), m, this, damage, 0, 0, 0, 0, 100);
}
break;
}
case 2: /* poison */
{
foreach (Mobile m in list)
{
bool isFriendly = m is Savage || m is SavageRider || m is SavageShaman || m is SavageRidgeback;
if (isFriendly)
continue;
if (!CanBeHarmful(m))
continue;
DoHarmful(m);
m.Spell?.OnCasterHurt();
m.Paralyzed = false;
double total = Skills[SkillName.Magery].Value + Skills[SkillName.Poisoning].Value;
double dist = GetDistanceToSqrt(m);
if (dist >= 3.0)
total -= (dist - 3.0) * 10.0;
int level;
if (total >= 200.0 && Utility.Random(1, 100) <= 10)
level = 3;
else if (total > 170.0)
level = 2;
else if (total > 130.0)
level = 1;
else
level = 0;
m.ApplyPoison(this, Poison.GetPoison(level));
m.FixedParticles(0x374A, 10, 15, 5021, EffectLayer.Waist);
m.PlaySound(0x474);
}
break;
}
break;
}
case 1: /* lightning */
{
foreach (Mobile m in eable)
{
bool isFriendly = m is Savage || m is SavageRider || m is SavageShaman || m is SavageRidgeback;
if (isFriendly)
continue;
if (!CanBeHarmful(m))
continue;
DoHarmful(m);
double damage;
if (Core.AOS)
{
int baseDamage = 6 + (int)(Skills.EvalInt.Value / 5.0);
damage = Utility.RandomMinMax(baseDamage, baseDamage + 3);
}
else
{
damage = Utility.Random(12, 9);
}
m.BoltEffect(0);
SpellHelper.Damage(TimeSpan.FromSeconds(0.25), m, this, damage, 0, 0, 0, 0, 100);
}
break;
}
case 2: /* poison */
{
foreach (Mobile m in eable)
{
bool isFriendly = m is Savage || m is SavageRider || m is SavageShaman || m is SavageRidgeback;
if (isFriendly)
continue;
if (!CanBeHarmful(m))
continue;
DoHarmful(m);
m.Spell?.OnCasterHurt();
m.Paralyzed = false;
double total = Skills.Magery.Value + Skills.Poisoning.Value;
double dist = GetDistanceToSqrt(m);
if (dist >= 3.0)
total -= (dist - 3.0) * 10.0;
int level;
if (total >= 200.0 && Utility.Random(1, 100) <= 10)
level = 3;
else if (total > 170.0)
level = 2;
else if (total > 130.0)
level = 1;
else
level = 0;
m.ApplyPoison(this, Poison.GetPoison(level));
m.FixedParticles(0x374A, 10, 15, 5021, EffectLayer.Waist);
m.PlaySound(0x474);
}
break;
}
}
eable.Free();
}
public override void Serialize(GenericWriter writer)

View file

@ -58,21 +58,15 @@ namespace Server.Mobiles
public void DrainLife()
{
ArrayList list = new ArrayList();
IPooledEnumerable<Mobile> eable = GetMobilesInRange(2);
foreach (Mobile m in GetMobilesInRange(2))
foreach (Mobile m in eable)
{
if (m == this || !CanBeHarmful(m))
if (m == this || !CanBeHarmful(m) ||
!(m is BaseCreature creature && (creature.Controlled || creature.Summoned || creature.Team != Team) ||
m.Player))
continue;
if (m is BaseCreature creature && (creature.Controlled || creature.Summoned || creature.Team != Team))
list.Add(m);
else if (m.Player)
list.Add(m);
}
foreach (Mobile m in list)
{
DoHarmful(m);
m.FixedParticles(0x374A, 10, 15, 5013, 0x496, 0, EffectLayer.Waist);
@ -85,6 +79,8 @@ namespace Server.Mobiles
Hits += toDrain;
m.Damage(toDrain, this);
}
eable.Free();
}
public override void OnGaveMeleeAttack(Mobile defender)

View file

@ -9,7 +9,7 @@ namespace Server.Mobiles
{
SpeechHue = Utility.RandomDyedHue();
Title = "the brigand";
Hue = Utility.RandomSkinHue();
Hue = Race.Human.RandomSkinHue();
if (Female = Utility.RandomBool())
{

View file

@ -9,7 +9,7 @@ namespace Server.Mobiles
{
SpeechHue = Utility.RandomDyedHue();
Title = "the executioner";
Hue = Utility.RandomSkinHue();
Hue = Race.Human.RandomSkinHue();
if (Female = Utility.RandomBool())
{

View file

@ -12,7 +12,7 @@ namespace Server.Mobiles
SpeechHue = Utility.RandomDyedHue();
Hue = Utility.RandomSkinHue();
Hue = Race.Human.RandomSkinHue();
if (Female = Utility.RandomBool())
{
@ -58,11 +58,11 @@ namespace Server.Mobiles
PackItem(new Arrow(250));
PackGold(250, 500);
Skills[SkillName.Anatomy].Base = 120.0;
Skills[SkillName.Tactics].Base = 120.0;
Skills[SkillName.Archery].Base = 120.0;
Skills[SkillName.MagicResist].Base = 120.0;
Skills[SkillName.DetectHidden].Base = 100.0;
Skills.Anatomy.Base = 120.0;
Skills.Tactics.Base = 120.0;
Skills.Archery.Base = 120.0;
Skills.MagicResist.Base = 120.0;
Skills.DetectHidden.Base = 100.0;
}
public Guardian(Serial serial) : base(serial)

View file

@ -6,7 +6,7 @@ namespace Server.Mobiles
public HeadlessOne() : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
{
Body = 31;
Hue = Utility.RandomSkinHue() & 0x7FFF;
Hue = Race.Human.RandomSkinHue() & 0x7FFF;
BaseSoundID = 0x39D;
SetStr(26, 50);

View file

@ -124,20 +124,16 @@ namespace Server.Mobiles
if (defender.Alive)
{
defender.Frozen = true;
Timer.DelayCall(TimeSpan.FromSeconds(5.0), new TimerStateCallback(Recover_Callback), defender);
Timer.DelayCall(TimeSpan.FromSeconds(5.0), Recover_Callback, defender);
}
}
}
private void Recover_Callback(object state)
private void Recover_Callback(Mobile defender)
{
if (state is Mobile defender)
{
defender.Frozen = false;
defender.Combatant = null;
defender.LocalOverheadMessage(MessageType.Regular, 0x3B2, false, "You recover your senses.");
}
defender.Frozen = false;
defender.Combatant = null;
defender.LocalOverheadMessage(MessageType.Regular, 0x3B2, false, "You recover your senses.");
m_Stunning = false;
}

View file

@ -1,12 +1,13 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Items;
namespace Server.Mobiles
{
public class KhaldunRevenant : BaseCreature
{
private static Hashtable m_Table = new Hashtable();
private static HashSet<Mobile> m_Set = new HashSet<Mobile>();
private DateTime m_ExpireTime;
private Mobile m_Target;
@ -47,9 +48,7 @@ namespace Server.Mobiles
VirtualArmor = 60;
Halberd weapon = new Halberd();
weapon.Hue = 0x41CE;
weapon.Movable = false;
Halberd weapon = new Halberd { Hue = 0x41CE, Movable = false };
AddItem(weapon);
}
@ -81,7 +80,7 @@ namespace Server.Mobiles
if (lastKiller is BaseCreature)
lastKiller = ((BaseCreature)lastKiller).GetMaster();
if (IsInsideKhaldun(m) && IsInsideKhaldun(lastKiller) && lastKiller.Player && !m_Table.Contains(lastKiller))
if (IsInsideKhaldun(m) && IsInsideKhaldun(lastKiller) && lastKiller.Player && !m_Set.Contains(lastKiller))
foreach (AggressorInfo ai in m.Aggressors)
if (ai.Attacker == lastKiller && ai.CanReportMurder)
{
@ -99,12 +98,12 @@ namespace Server.Mobiles
revenant.FixedParticles(0, 0, 0, 0x13A7, EffectLayer.Waist);
Effects.PlaySound(revenant.Location, revenant.Map, 0x29);
m_Table.Add(killer, null);
m_Set.Add(killer);
}
public static bool IsInsideKhaldun(Mobile from)
{
return from?.Region != null && from.Region.IsPartOf("Khaldun");
return from?.Region?.IsPartOf("Khaldun") == true;
}
public override void DisplayPaperdollTo(Mobile to)
@ -152,7 +151,7 @@ namespace Server.Mobiles
public override void OnDelete()
{
if (m_Target != null)
m_Table.Remove(m_Target);
m_Set.Remove(m_Target);
base.OnDelete();
}
@ -173,4 +172,4 @@ namespace Server.Mobiles
Delete();
}
}
}
}

View file

@ -1,3 +1,4 @@
using System.Linq;
using Server.Items;
namespace Server.Mobiles
@ -108,35 +109,15 @@ namespace Server.Mobiles
if (map == null)
return;
int orcs = 0;
foreach (Mobile m in GetMobilesInRange(10))
if (m is OrcishLord)
++orcs;
IPooledEnumerable<OrcishLord> eable = GetMobilesInRange<OrcishLord>(10);
int orcs = eable.Count();
eable.Free();
if (orcs < 10)
{
BaseCreature orc = new SpawnedOrcishLord();
orc.Team = Team;
Point3D loc = target.Location;
bool validLocation = false;
for (int j = 0; !validLocation && j < 10; ++j)
{
int x = target.X + Utility.Random(3) - 1;
int y = target.Y + Utility.Random(3) - 1;
int z = map.GetAverageZ(x, y);
if (validLocation = map.CanFit(x, y, Z, 16, false, false))
loc = new Point3D(x, y, Z);
else if (validLocation = map.CanFit(x, y, z, 16, false, false))
loc = new Point3D(x, y, z);
}
orc.MoveToWorld(loc, map);
BaseCreature orc = new SpawnedOrcishLord{ Team = Team };
orc.MoveToWorld(map.GetRandomNearbyLocation(target.Location), map);
orc.Combatant = target;
}
}
@ -153,4 +134,4 @@ namespace Server.Mobiles
int version = reader.ReadInt();
}
}
}
}