本文整理汇总了C#中Server.Engines.CannedEvil.ChampionSpawn.IsEligible方法的典型用法代码示例。如果您正苦于以下问题:C# ChampionSpawn.IsEligible方法的具体用法?C# ChampionSpawn.IsEligible怎么用?C# ChampionSpawn.IsEligible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.Engines.CannedEvil.ChampionSpawn
的用法示例。
在下文中一共展示了ChampionSpawn.IsEligible方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GETCHAMPREWARDMOB
public static Mobile GETCHAMPREWARDMOB(TriggerObject trigObject, ChampionSpawn champSpawn, bool removeFromList)
{
if (champSpawn == null)
{
return null;
}
var scores = champSpawn.Scores;
if (scores == null)
{
return null;
}
Mobile value = null;
// first find all eligible receivers
var eligibleMobs = new List<Mobile>();
var eligibleMobScores = new List<double>();
double totalScores = 0.0;
foreach (var pair in scores)
{
if (pair.Key == null)
{
continue;
}
Mobile mob = pair.Key;
bool eligible = champSpawn.IsEligible(mob);
if (!eligible)
{
continue;
}
eligibleMobs.Add(mob);
eligibleMobScores.Add(pair.Value);
totalScores += pair.Value;
}
double currentTestValue = 0.0;
double roll = Utility.RandomDouble() * totalScores;
for (int i = 0; i < eligibleMobScores.Count; i++)
{
currentTestValue += eligibleMobScores[i];
if (!(roll <= currentTestValue))
{
continue;
}
value = eligibleMobs[i];
break;
}
if (value != null && removeFromList)
{
scores.Remove(value);
}
return value;
}