Merge pull request #7 from Vorspire/patch-1

Infinite Loop Breakout
This commit is contained in:
Mark Sturgill 2015-07-20 20:06:41 -07:00
commit 0c7dbccb6e

View file

@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
namespace Server.Items
{
@ -180,7 +181,7 @@ namespace Server.Items
private static void ApplySkillBonus( AosSkillBonuses attrs, int min, int max, int index, int low, int high )
{
SkillName[] possibleSkills = ( attrs.Owner is Spellbook ? m_PossibleSpellbookSkills : m_PossibleBonusSkills );
List<SkillName> possibleSkills = new List<SkillName>( attrs.Owner is Spellbook ? m_PossibleSpellbookSkills : m_PossibleBonusSkills );
int count = ( Core.SE ? possibleSkills.Length : possibleSkills.Length - 2 );
SkillName sk, check;
@ -190,11 +191,12 @@ namespace Server.Items
do
{
found = false;
sk = possibleSkills[Utility.Random( count )];
sk = possibleSkills[Utility.Random( count-- )];
possibleSkills.Remove(sk);
for ( int i = 0; !found && i < 5; ++i )
found = ( attrs.GetValues( i, out check, out bonus ) && check == sk );
} while ( found );
} while ( found && count > 0 );
attrs.SetValues( index, sk, Scale( min, max, low, high ) );
}
@ -685,4 +687,4 @@ namespace Server.Items
}
}
}
}
}