chore: Use var everywhere (#2294)
This commit is contained in:
parent
0b34cc4417
commit
ebaf104935
267 changed files with 873 additions and 873 deletions
|
|
@ -153,7 +153,7 @@ namespace Server.Spells
|
|||
return false;
|
||||
}
|
||||
|
||||
string option = this switch
|
||||
var option = this switch
|
||||
{
|
||||
Backstab => "Backstab",
|
||||
DeathStrike => "Death Strike",
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ namespace Server.Spells
|
|||
{
|
||||
_contextTable[type] = context = new DelayedDamageContextWrapper();
|
||||
|
||||
for (int i = 0; i < damageStacking.Length; i++)
|
||||
for (var i = 0; i < damageStacking.Length; i++)
|
||||
{
|
||||
_contextTable.Add(damageStacking[i], context);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1017,7 +1017,7 @@ namespace Server.Spells
|
|||
|
||||
bcTarget?.AlterSpellDamageFrom(from, ref dmg);
|
||||
|
||||
if (Feint.GetDamageReduction(from, target, out int feintReduction))
|
||||
if (Feint.GetDamageReduction(from, target, out var feintReduction))
|
||||
{
|
||||
// example: 35 damage * 50 / 100 = 17 damage
|
||||
dmg -= dmg * feintReduction / 100;
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ namespace Server.Spells.Bushido
|
|||
return;
|
||||
}
|
||||
|
||||
Mobile target = queue.PeekRandom();
|
||||
var target = queue.PeekRandom();
|
||||
|
||||
var damageBonus = attacker.Skills.Bushido.Value / 100.0;
|
||||
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ namespace Server.Spells.Chivalry
|
|||
}
|
||||
else
|
||||
{
|
||||
bool sendEffect = false;
|
||||
var sendEffect = false;
|
||||
|
||||
if (m.Poisoned && m.CurePoison(Caster))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ namespace Server.Spells.Chivalry
|
|||
* Chance of removing curse is affected by Caster's Karma.
|
||||
*/
|
||||
|
||||
int chance = Caster.Karma switch
|
||||
var chance = Caster.Karma switch
|
||||
{
|
||||
< -5000 => 0,
|
||||
< 0 => (int)Math.Sqrt(20000 + Caster.Karma) - 122,
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ public class BombardSpell : MysticSpell, ITargetingSpell<Mobile>
|
|||
var damageSkill = GetDamageSkill(Caster);
|
||||
var resist = GetResistSkill(m);
|
||||
|
||||
int secs = Math.Max(0, (int)(damageSkill / 10 - resist / 10));
|
||||
var secs = Math.Max(0, (int)(damageSkill / 10 - resist / 10));
|
||||
|
||||
if (secs > 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public class CleansingWindsSpell : MysticSpell, ITargetingSpell<Mobile>
|
|||
var casterParty = Party.Get(Caster);
|
||||
if (casterParty != null)
|
||||
{
|
||||
foreach (Mobile mob in Caster.Map.GetMobilesInRange(m.Location, 2))
|
||||
foreach (var mob in Caster.Map.GetMobilesInRange(m.Location, 2))
|
||||
{
|
||||
if (mob != m && casterParty.Contains(mob) && Caster.CanBeBeneficial(mob, false))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ public class AnimateDeadSpell : NecromancerSpell, ITargetingSpell<Item>
|
|||
}
|
||||
else
|
||||
{
|
||||
Type type = c.Owner?.GetType();
|
||||
var type = c.Owner?.GetType();
|
||||
|
||||
if (c.ItemID != 0x2006 || c.Animated || type == typeof(PlayerMobile) || type == null ||
|
||||
c.Owner?.Fame < 100 ||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ public class PoisonStrikeSpell : NecromancerSpell, ITargetingSpell<Mobile>
|
|||
var cbc = Caster as BaseCreature;
|
||||
var isMonster = cbc?.Controlled == false && (cbc.IsAnimatedDead || !cbc.Summoned);
|
||||
|
||||
foreach (Mobile targ in m.GetMobilesInRange(2))
|
||||
foreach (var targ in m.GetMobilesInRange(2))
|
||||
{
|
||||
if (targ == Caster || m == targ || !SpellHelper.ValidIndirectTarget(Caster, targ)
|
||||
|| !Caster.CanBeHarmful(targ, false))
|
||||
|
|
|
|||
|
|
@ -386,15 +386,15 @@ public class AnimalForm : NinjaSpell
|
|||
builder.AddButton(10, 374, 0xFB1, 0xFB2, 0);
|
||||
builder.AddHtmlLocalized(45, 376, 450, 20, 1011012, 0x7FFF); // CANCEL
|
||||
|
||||
int ninjitsu = _caster.Skills[SkillName.Ninjitsu].Fixed;
|
||||
int current = 0;
|
||||
var ninjitsu = _caster.Skills[SkillName.Ninjitsu].Fixed;
|
||||
var current = 0;
|
||||
|
||||
for (int i = 0; i < _entries.Length; ++i)
|
||||
for (var i = 0; i < _entries.Length; ++i)
|
||||
{
|
||||
bool enabled = ninjitsu >= _entries[i].ReqSkill && BaseFormTalisman.EntryEnabled(_caster, _entries[i].Type);
|
||||
var enabled = ninjitsu >= _entries[i].ReqSkill && BaseFormTalisman.EntryEnabled(_caster, _entries[i].Type);
|
||||
|
||||
int page = current / 10 + 1;
|
||||
int pos = current % 10;
|
||||
var page = current / 10 + 1;
|
||||
var pos = current % 10;
|
||||
|
||||
if (pos == 0)
|
||||
{
|
||||
|
|
@ -418,11 +418,11 @@ public class AnimalForm : NinjaSpell
|
|||
continue;
|
||||
}
|
||||
|
||||
AnimalFormEntry entry = _entries[i];
|
||||
var entry = _entries[i];
|
||||
|
||||
int y = Math.DivRem(pos, 2, out var rem) * 64 + 44;
|
||||
int x = rem == 0 ? 14 : 264;
|
||||
Rectangle2D b = ItemBounds.Bounds[entry.ItemID];
|
||||
var y = Math.DivRem(pos, 2, out var rem) * 64 + 44;
|
||||
var x = rem == 0 ? 14 : 264;
|
||||
var b = ItemBounds.Bounds[entry.ItemID];
|
||||
|
||||
builder.AddImageTiledButton(x, y, 0x918, 0x919, i + 1, GumpButtonType.Reply, 0, entry.ItemID,
|
||||
entry.Hue, 40 - b.Width / 2 - b.X, 30 - b.Height / 2 - b.Y, entry.Tooltip);
|
||||
|
|
|
|||
|
|
@ -137,9 +137,9 @@ namespace Server.Spells.Second
|
|||
{
|
||||
if (Caster.BeginAction<DefensiveSpell>())
|
||||
{
|
||||
double value = (Caster.Skills.EvalInt.Value +
|
||||
Caster.Skills.Meditation.Value +
|
||||
Caster.Skills.Inscribe.Value) * 10 / 4;
|
||||
var value = (Caster.Skills.EvalInt.Value +
|
||||
Caster.Skills.Meditation.Value +
|
||||
Caster.Skills.Inscribe.Value) * 10 / 4;
|
||||
|
||||
Registry.Add(Caster, Math.Clamp((int)value, 0, 750)); // 75.0% protection from disruption
|
||||
new InternalTimer(Caster).Start();
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public class EnergyFieldSpell : MagerySpell, ITargetingSpell<IPoint3D>
|
|||
|
||||
Effects.PlaySound(loc, Caster.Map, 0x20B);
|
||||
|
||||
TimeSpan duration = Core.AOS
|
||||
var duration = Core.AOS
|
||||
? TimeSpan.FromSeconds((15 + Caster.Skills.Magery.Value * 2) / 7.0)
|
||||
: TimeSpan.FromSeconds(Caster.Skills.Magery.Value * 0.28 + 2.0);
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ namespace Server.Spells.Seventh
|
|||
? GetNewAosDamage(51, 1, 5, playerVsPlayer)
|
||||
: Utility.Random(27, 22);
|
||||
|
||||
int count = queue.Count;
|
||||
var count = queue.Count;
|
||||
|
||||
if (count > 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ namespace Server.Spells.Sixth
|
|||
|
||||
if (Caster.CanBeHarmful(m) && CheckSequence())
|
||||
{
|
||||
Mobile defender = m;
|
||||
var defender = m;
|
||||
|
||||
SpellHelper.Turn(Caster, m);
|
||||
SpellHelper.CheckReflect((int)Circle, Caster, ref m);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ public class UnsummonTimer : Timer
|
|||
_onUnsummon = onUnsummon;
|
||||
_creature = creature;
|
||||
|
||||
ref var timer = ref CollectionsMarshal.GetValueRefOrAddDefault(_timers, creature, out bool exists);
|
||||
ref var timer = ref CollectionsMarshal.GetValueRefOrAddDefault(_timers, creature, out var exists);
|
||||
if (exists)
|
||||
{
|
||||
timer.Stop();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue