本文整理汇总了C#中FuryOfDracula.GameLogic.GameState.LikelihoodOfAnyHunterHavingEventOfType方法的典型用法代码示例。如果您正苦于以下问题:C# GameState.LikelihoodOfAnyHunterHavingEventOfType方法的具体用法?C# GameState.LikelihoodOfAnyHunterHavingEventOfType怎么用?C# GameState.LikelihoodOfAnyHunterHavingEventOfType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FuryOfDracula.GameLogic.GameState
的用法示例。
在下文中一共展示了GameState.LikelihoodOfAnyHunterHavingEventOfType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateStrategy
public void UpdateStrategy(GameState game)
{
int turnsUntilDark = 0;
int turnsUntilLight = 0;
if ((int)game.TimeOfDay > 3)
{
turnsUntilLight = 7 - (int)game.TimeOfDay;
}
if ((int)game.TimeOfDay < 4)
{
turnsUntilDark = 4 - (int)game.TimeOfDay;
}
// if there are any hunters in range
var potentialVictims = game.HuntersWithinDistanceOf(game.Dracula.CurrentLocation, turnsUntilLight);
var victimsToEliminate = new List<HunterPlayer>();
foreach (HunterPlayer h in potentialVictims)
{
// eliminate any that have a stake
if (h.LikelihoodOfHavingItemOfType(game, Item.Stake) > 0.5)
{
// unless they only have 1 and I have a rage card that can discard it
if (h.LikelihoodOfHavingItemOfType(game, Item.Stake) < 2 && game.Dracula.EventHand.Any(card => card.Event == Event.Rage))
{
// but if someone can cancel my rage card and I can't cancel their good luck
if (game.Dracula.EventHand.Count(card => card.Event == Event.DevilishPower) - game.LikelihoodOfAnyHunterHavingEventOfType(Event.GoodLuck) < 0.5)
{
victimsToEliminate.Add(h);
continue;
}
}
else
{
victimsToEliminate.Add(h);
continue;
}
}
// elminate any that have Heavenly Host
if (h.LikelihoodOfHavingItemOfType(game, Item.HeavenlyHost) > 0.75)
{
// unless they only have 1 and I have a rage card that can discard it
if (h.LikelihoodOfHavingItemOfType(game, Item.HeavenlyHost) < 2 && game.Dracula.EventHand.Any(card => card.Event == Event.Rage))
{
// but if someone can cancel my rage card and I can't cancel their good luck
if (game.Dracula.EventHand.Count(card => card.Event == Event.DevilishPower) - game.LikelihoodOfAnyHunterHavingEventOfType(Event.GoodLuck) < 0.5)
{
victimsToEliminate.Add(h);
continue;
}
}
else
{
victimsToEliminate.Add(h);
continue;
}
}
}
foreach (HunterPlayer h in victimsToEliminate)
{
potentialVictims.Remove(h);
}
potentialVictims.Clear();
// if there are any that are in the same location as someone who is not a potential victim, I don't want to attack them both
foreach (HunterPlayer h in potentialVictims)
{
for (int i = 1; i < 5; i++)
{
if (!potentialVictims.Contains(game.Hunters[i]) && h.CurrentLocation == game.Hunters[i].CurrentLocation)
{
victimsToEliminate.Add(h);
}
}
}
foreach (HunterPlayer h in victimsToEliminate)
{
potentialVictims.Remove(h);
}
if (potentialVictims.Any())
{
// if it's worth breaking cover to attack
if ((NumberOfPossibleCurrentLocations < 6 && potentialVictims.Any(hunter => LikelihoodOfHunterDeath(game, hunter) > LikelihoodOfDraculaDeath(game.Dracula.Blood))) || (game.Vampires > 3 && potentialVictims.Any(hunter => LikelihoodOfHunterDeath(game, hunter) > 25)))
{
float highestLikelihoodOfDeath = 0;
foreach (HunterPlayer hunter in potentialVictims)
{
if (LikelihoodOfHunterDeath(game, hunter) > highestLikelihoodOfDeath)
{
victim = hunter;
highestLikelihoodOfDeath = LikelihoodOfHunterDeath(game, hunter);
}
}
if (victim != null)
{
Strategy = Strategy.Aggressive;
return;
}
}
}
//.........这里部分代码省略.........