Fixes dupe exception (#258)
- [X] Cleans up ActivatorUtil - [X] Fixes dupe exception - [X] Fixes a bug in BasePotion - [X] Fixes a few possible memory leaks Bumps release version
This commit is contained in:
parent
4d6e584b6c
commit
e9c1e4cbba
66 changed files with 597 additions and 496 deletions
|
|
@ -2820,17 +2820,9 @@ namespace Server.Mobiles
|
|||
m_SpellDefense.Add(type);
|
||||
}
|
||||
|
||||
public Spell GetAttackSpellRandom()
|
||||
{
|
||||
var type = m_SpellAttack.RandomElement();
|
||||
return type == null ? null : ActivatorUtil.CreateInstance(type, this, null) as Spell;
|
||||
}
|
||||
public Spell GetAttackSpellRandom() => m_SpellAttack.RandomElement()?.CreateInstance<Spell>(this, null);
|
||||
|
||||
public Spell GetDefenseSpellRandom()
|
||||
{
|
||||
var type = m_SpellDefense.RandomElement();
|
||||
return type == null ? null : ActivatorUtil.CreateInstance(type, this, null) as Spell;
|
||||
}
|
||||
public Spell GetDefenseSpellRandom() => m_SpellDefense.RandomElement()?.CreateInstance<Spell>(this, null);
|
||||
|
||||
public Spell GetSpellSpecific(Type type)
|
||||
{
|
||||
|
|
@ -2840,7 +2832,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
if (m_SpellAttack[i] == type)
|
||||
{
|
||||
return ActivatorUtil.CreateInstance(type, this, null) as Spell;
|
||||
return type.CreateInstance<Spell>(this, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2848,7 +2840,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
if (m_SpellDefense[i] == type)
|
||||
{
|
||||
return ActivatorUtil.CreateInstance(type, this, null) as Spell;
|
||||
return type.CreateInstance<Spell>(this, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue