本文整理汇总了C#中FuryOfDracula.GameLogic.GameState.HuntersAt方法的典型用法代码示例。如果您正苦于以下问题:C# GameState.HuntersAt方法的具体用法?C# GameState.HuntersAt怎么用?C# GameState.HuntersAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FuryOfDracula.GameLogic.GameState
的用法示例。
在下文中一共展示了GameState.HuntersAt方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ResolveCombat
//.........这里部分代码省略.........
firstRound = false;
}
var health = -1;
foreach (var h in huntersInvolved)
{
Console.WriteLine("How much health does {0} have now?", h.Hunter.Name());
do
{
if (int.TryParse(Console.ReadLine(), out health))
{
health = Math.Max(0, Math.Min(h.MaxHealth, health));
Console.WriteLine(health);
}
} while (health == -1);
h.AdjustHealth(health - h.Health);
}
if (opponent == Opponent.Dracula)
{
Console.WriteLine("How much blood does Dracula have now?");
do
{
if (int.TryParse(Console.ReadLine(), out health))
{
health = Math.Max(0, Math.Min(15, health));
Console.WriteLine(health);
}
} while (health == -1);
game.Dracula.AdjustBlood(health - game.Dracula.Blood);
}
Console.WriteLine("Did {0} win? (An end result is a no)", huntersInvolved.Count() > 1 ? "the Hunters" : huntersInvolved.First().Hunter.Name());
string input;
do
{
input = Console.ReadLine();
} while (!"yes".StartsWith(input.ToLower()) && !"no".StartsWith(input.ToLower()));
if ("yes".StartsWith(input.ToLower()))
{
if (opponent == Opponent.NewVampire)
{
game.AdjustVampires(-1);
}
Console.WriteLine("Don't forget to register any cards discarded, such as Great Strength used to prevent health loss, Events due to enemy Knife wounds, Items consumed, etc.");
return true;
}
if (opponent == Opponent.Dracula)
{
switch (enemyCombatCardChosen)
{
case EnemyCombatCard.Mesmerize:
Console.WriteLine("{0} is bitten and must discard all Items!", enemyTarget.Name());
if (!HunterPlayingGreatStrengthToCancelBite(game, enemyTarget, logic))
{
game.Hunters[(int)enemyTarget].AdjustBites(1);
}
while (game.Hunters[(int)enemyTarget].ItemCount > 0)
{
var line = "";
var itemDiscarded = Item.None;
do
{
Console.WriteLine("What is the name of the Item being discarded?");
line = Console.ReadLine();
itemDiscarded = Enumerations.GetItemFromString(line);
} while (itemDiscarded == Item.None);
game.Hunters[(int)enemyTarget].DiscardItem(game, itemDiscarded);
}
CheckForHunterDeath(game); break;
case EnemyCombatCard.Fangs:
Console.WriteLine("{0} is bitten!", enemyTarget.Name());
if (!HunterPlayingGreatStrengthToCancelBite(game, enemyTarget, logic))
{
game.Hunters[(int)enemyTarget].AdjustBites(1);
}
CheckForHunterDeath(game);
goto case EnemyCombatCard.EscapeBat;
case EnemyCombatCard.EscapeBat:
Console.WriteLine("Dracula escaped in the form of a bat");
Location destination = logic.ChooseEscapeAsBatDestination(game);
game.Dracula.EscapeAsBat(game, destination);
logic.AddEscapeAsBatCardToAllTrails(game);
int position = -1;
if (game.HuntersAt(destination).Any() || destination == Location.CastleDracula)
{
position = game.Dracula.RevealCardInTrailWithLocation(destination);
logic.EliminateTrailsThatDoNotContainLocationAtPosition(game, destination, position);
}
else
{
logic.EliminateTrailsThatHaveHuntersAtPosition(game, game.Dracula.CurrentLocationPosition);
}
break;
}
}
Console.WriteLine("Don't forget to register any cards discarded, such as Great Strength used to prevent health loss or Items due to enemy Knife wounds");
foreach (HunterPlayer h in huntersInvolved)
{
h.LastCombatCardChosen = Item.None;
}
return false;
}
示例2: EndHunterTurn
//.........这里部分代码省略.........
else if (power == Power.WolfForm)
{
logic.AddWolfFormToAllPossibleTrails(game);
game.Dracula.AdjustBlood(-1);
}
else if (power == Power.None && (game.Map.TypeOfLocation(destination) == LocationType.SmallCity ||
game.Map.TypeOfLocation(destination) == LocationType.LargeCity))
{
if (disembarked)
{
logic.AddDisembarkedCardToAllPossibleTrails(game);
}
else
{
logic.AddOrangeBackedCardToAllPossibleTrails(game);
}
}
if (game.Map.TypeOfLocation(destination) == LocationType.Sea)
{
if (power != Power.DoubleBack)
{
logic.AddBlueBackedCardToAllPossibleTrails(game);
}
if ((!game.Dracula.LostBloodFromSeaMovementLastTurn || game.HunterAlly != null && game.HunterAlly.Event == Event.RufusSmith))
{
game.Dracula.AdjustBlood(-1);
game.Dracula.LostBloodFromSeaMovementLastTurn = true;
}
else
{
game.Dracula.LostBloodFromSeaMovementLastTurn = false;
}
}
if (!game.HuntersAt(game.Dracula.CurrentLocation).Any() && game.Map.TypeOfLocation(game.Dracula.CurrentLocation) != LocationType.Sea)
{
logic.EliminateTrailsThatHaveHuntersAtPosition(game, game.Dracula.CurrentLocationPosition);
}
else if (game.HuntersAt(game.Dracula.CurrentLocation).Any() && game.Map.TypeOfLocation(game.Dracula.CurrentLocation) != LocationType.Sea)
{
game.Dracula.Trail[0].DraculaCards.First().IsRevealed = true;
logic.EliminateTrailsThatDoNotContainLocationAtPosition(game, game.Dracula.Trail[0].DraculaCards.First().Location, 0);
}
}
switch (power)
{
case Power.WolfForm:
game.Dracula.AdjustBlood(-1); break;
case Power.Feed:
game.Dracula.AdjustBlood(1); break;
case Power.DarkCall:
game.Dracula.AdjustBlood(-2);
for (int i = 0; i < 10; i++)
{
game.Dracula.DrawEncounter(game.EncounterPool);
}
while (game.Dracula.EncounterHand.Count() > game.Dracula.EncounterHandSize)
{
game.Dracula.DiscardEncounterTile(game, logic.ChooseEncounterTileToDiscardFromEncounterHand(game));
}
break;
}
if (game.Dracula.CurrentLocation == game.Dracula.LocationWhereHideWasUsed && power == Power.DoubleBack &&
game.Dracula.LocationWhereHideWasUsed != Location.Nowhere)
{
int position = game.Dracula.RevealHideCard();
Console.WriteLine("Dracula used Double Back to return to the location where he previously used Hide. Hide was at position {0}.", position + 1);
示例3: PlayEvasion
/// <summary>
/// Resolves the Evasion Event card
/// </summary>
/// <param name="game">The GameState</param>
/// <param name="logic">The artificial intelligence component</param>
private static void PlayEvasion(GameState game, DecisionMaker logic)
{
Console.WriteLine("Dracula played Evasion");
if (HunterPlayingGoodLuckToCancelDraculaEvent(game, Event.Evasion, Event.Evasion, logic) > 0)
{
Console.WriteLine("Evasion cancelled");
return;
}
var destination = logic.ChooseWhereToEvadeTo(game);
int doubleBackSlot = -1;
var cardDroppedOffTrail = game.Dracula.MoveTo(destination, Power.None, out doubleBackSlot);
logic.AddEvasionCardToTrail(game);
if (game.HuntersAt(destination).Any())
{
game.Dracula.RevealCardAtPosition(0);
logic.EliminateTrailsThatDoNotContainLocationAtPosition(game, destination, 0);
}
else
{
logic.EliminateTrailsThatHaveHuntersAtPosition(game, 0);
}
if (doubleBackSlot > -1)
{
Console.WriteLine("Dracula Doubled Back to the location in slot {0}", doubleBackSlot + 1);
}
if (cardDroppedOffTrail != null)
{
DealWithDroppedOffCardSlots(game, new List<DraculaCardSlot> { cardDroppedOffTrail }, logic);
}
if (game.Dracula.Trail[0].EncounterTiles.Count == 0 && !game.HuntersAt(destination).Any())
{
game.Dracula.PlaceEncounterTileOnCard(
logic.ChooseEncounterTileToPlaceOnDraculaCardSlot(game, game.Dracula.Trail[0]),
game.Dracula.Trail[0]);
}
}
示例4: ChooseDestinationAndPower
public Location ChooseDestinationAndPower(GameState game, out Power power)
{
Location destination;
if ((game.Dracula.AdvanceMoveLocation != Location.Nowhere && !game.LocationIsBlocked(game.Dracula.AdvanceMoveLocation)) || game.Dracula.AdvanceMovePower != Power.None)
{
power = game.Dracula.AdvanceMovePower;
destination = game.Dracula.AdvanceMoveLocation;
game.Dracula.AdvanceMoveLocation = Location.Nowhere;
game.Dracula.AdvanceMovePower = Power.None;
return destination;
}
var currentNumberOfPossibleCurrentLocations = NumberOfPossibleCurrentLocations;
var currentActualTrail = GetActualTrail(game);
var possibleMoves = GetPossibleMovesFromTrail(game, currentActualTrail);
var possibleCurrentOrangeBackedLocations = new List<Location>();
foreach (var trail in PossibilityTree)
{
possibleCurrentOrangeBackedLocations.AddRange(GetPossibleCurrentLocationsFromPossibilityTree(AddOrangeBackedCardToTrail(game, trail)));
}
var possibleCurrentBlueBackedLocations = new List<Location>();
foreach (var trail in PossibilityTree)
{
possibleCurrentBlueBackedLocations.AddRange(GetPossibleCurrentLocationsFromPossibilityTree(AddBlueBackedCardToTrail(game, trail)));
}
var possibleWolfFormLocations = new List<Location>();
foreach (var trail in PossibilityTree)
{
possibleCurrentBlueBackedLocations.AddRange(GetPossibleCurrentLocationsFromPossibilityTree(AddWolfFormCardToTrail(game, trail)));
}
var uniquePossibleCurrentOrangeBackedLocations = new List<Location>();
var uniquePossibleCurrentBlueBackedLocations = new List<Location>();
var uniquePossibleWolfFormLocations = new List<Location>();
foreach (var location in possibleCurrentOrangeBackedLocations)
{
if (!uniquePossibleCurrentOrangeBackedLocations.Contains(location))
{
uniquePossibleCurrentOrangeBackedLocations.Add(location);
}
}
foreach (var location in possibleCurrentBlueBackedLocations)
{
if (!uniquePossibleCurrentBlueBackedLocations.Contains(location))
{
uniquePossibleCurrentBlueBackedLocations.Add(location);
}
}
foreach (var location in possibleWolfFormLocations)
{
if (!uniquePossibleWolfFormLocations.Contains(location))
{
uniquePossibleWolfFormLocations.Add(location);
}
}
var numberOfPossibleOrangeBackedLocationsThatWouldBeRevealed = uniquePossibleCurrentOrangeBackedLocations.Count(loc => game.HuntersAt(loc).Any());
var numberOfPossibleLocationsAfterMove = new List<int>();
foreach (var move in possibleMoves)
{
if ((game.HuntersAt(move.Location).Any() && game.Map.TypeOfLocation(move.Location) != LocationType.Sea) || move.Location == Location.CastleDracula)
{
numberOfPossibleLocationsAfterMove.Add(1);
}
else
{
if (move.Power == Power.None || move.Power == Power.Hide)
{
if (move.CardBack == CardBack.Orange)
{
numberOfPossibleLocationsAfterMove.Add(uniquePossibleCurrentOrangeBackedLocations.Count() - numberOfPossibleOrangeBackedLocationsThatWouldBeRevealed);
}
else if (move.CardBack == CardBack.Blue)
{
numberOfPossibleLocationsAfterMove.Add(uniquePossibleCurrentBlueBackedLocations.Count());
}
}
else if (move.Power == Power.Feed || move.Power == Power.DarkCall)
{
numberOfPossibleLocationsAfterMove.Add(currentNumberOfPossibleCurrentLocations);
}
else if (move.Power == Power.DoubleBack)
{
var doubleBackSlot = GetIndexOfLocationInTrail(move.Location, currentActualTrail);
var uniquePossibleDoubleBackLocations = new List<Location>();
foreach (var trail in PossibilityTree)
{
if (DoubleBackToPositionIsValidForTrail(game, trail, doubleBackSlot) && !uniquePossibleDoubleBackLocations.Contains(trail[doubleBackSlot].Location))
{
uniquePossibleDoubleBackLocations.Add(trail[doubleBackSlot].Location);
}
}
numberOfPossibleLocationsAfterMove.Add(uniquePossibleDoubleBackLocations.Count() - uniquePossibleDoubleBackLocations.Count(loc => game.HuntersAt(loc).Any()));
}
else if (move.Power == Power.WolfForm)
{
numberOfPossibleLocationsAfterMove.Add(uniquePossibleWolfFormLocations.Count() - uniquePossibleWolfFormLocations.Count(loc => game.HuntersAt(loc).Any()));
}
}
}
//.........这里部分代码省略.........
示例5: InitialisePossibilityTree
public void InitialisePossibilityTree(GameState game)
{
PossibilityTree.Clear();
List<Location> allLocations = Enumerations.GetAllLocations();
foreach (Location location in allLocations)
{
if (!game.HuntersAt(location).Any() && game.Map.TypeOfLocation(location) != LocationType.Sea && game.Map.TypeOfLocation(location) != LocationType.Castle && game.Map.TypeOfLocation(location) != LocationType.Hospital)
{
PossibilityTree.Add(new PossibleTrailSlot[6] { new PossibleTrailSlot(location, Power.None, game.TimeOfDay, game.Map.TypeOfLocation(location) == LocationType.Sea ? CardBack.Blue : CardBack.Orange), null, null, null, null, null });
}
}
}
示例6: AddEvasionCardToTrail
public void AddEvasionCardToTrail(GameState game)
{
List<PossibleTrailSlot[]> newPossibilityTree = new List<PossibleTrailSlot[]>();
List<Location> allCities = new List<Location>();
List<Location> allLocations = Enumerations.GetAllLocations();
foreach (Location loc in allLocations)
{
if (game.Map.TypeOfLocation(loc) == LocationType.SmallCity || game.Map.TypeOfLocation(loc) == LocationType.LargeCity)
{
allCities.Add(loc);
}
}
foreach (PossibleTrailSlot[] trail in PossibilityTree)
{
foreach (Location location in allCities)
{
if (!game.HuntersAt(location).Any() && !TrailContainsLocation(trail, location) && !game.CatacombsContainsLocation(location))
{
PossibleTrailSlot[] newPossibleTrail = new PossibleTrailSlot[6];
for (int i = 5; i > 0; i--)
{
newPossibleTrail[i] = trail[i - 1];
}
newPossibleTrail[0] = new PossibleTrailSlot(location, Power.None, game.TimeOfDay, CardBack.Orange);
newPossibilityTree.Add(newPossibleTrail);
}
}
}
PossibilityTree = newPossibilityTree;
if (PossibilityTree.Count() == 0)
{
Console.WriteLine("Dracula stopped believing he exists after running AddEvasionCardToTrail");
PossibilityTree.Add(GetActualTrail(game));
}
}
示例7: EliminateTrailsThatHaveHuntersAtPosition
public void EliminateTrailsThatHaveHuntersAtPosition(GameState game, int position)
{
var newPossibilityTree = new List<PossibleTrailSlot[]>();
foreach (var trail in PossibilityTree)
{
if (!game.HuntersAt(trail[position].Location).Any())
{
newPossibilityTree.Add(trail);
}
}
PossibilityTree = newPossibilityTree;
if (PossibilityTree.Count() == 0)
{
Console.WriteLine("Dracula stopped believing he exists after running EliminateTrailsThatHaveHuntersAtPosition");
PossibilityTree.Add(GetActualTrail(game));
}
}
示例8: ChooseWhereToEvadeTo
public Location ChooseWhereToEvadeTo(GameState game)
{
var allLocations = Enumerations.GetAllLocations();
List<Location> locationsToExclude = new List<Location>();
foreach (Location location in allLocations)
{
if ((game.Map.TypeOfLocation(location) != LocationType.SmallCity && game.Map.TypeOfLocation(location) != LocationType.LargeCity) || game.HuntersAt(location).Any() || game.Dracula.TrailContains(location))
{
locationsToExclude.Add(location);
}
}
foreach (Location location in locationsToExclude)
{
allLocations.Remove(location);
}
List<int> distancesToNearestHunter = new List<int>();
foreach (Location location in allLocations)
{
distancesToNearestHunter.Add(game.GetDistanceToClosestHunter(location, true));
}
int totalDistanceWeights = 0;
for (int i = 0; i < distancesToNearestHunter.Count(); i++)
{
distancesToNearestHunter[i] *= distancesToNearestHunter[i];
totalDistanceWeights += distancesToNearestHunter[i];
}
int randomNumber = new Random().Next(0, totalDistanceWeights);
int count = 0;
int index = -1;
foreach (int distance in distancesToNearestHunter)
{
index++;
count += distance;
if (count > randomNumber)
{
break;
}
}
return allLocations[index];
}