public AvatarClassDwarf(ChanceProvider chanceProvider) : base(2, 2, 7, 3, new ChanceMovementBehavior(chanceProvider, 2), "Images/MapTiles/HeroDwarf.png", "Dwarf") { ActionStrategies.Add(new SearchForCurrentTileActionsStrategy()); ActionStrategies.Add(new SearchForInterestingLocationsStrategy()); ActionStrategies.Add(new SearchForAdjacentUnvisitedLocationsStrategy()); ActionStrategies.Add(new CheatAndFindUnseenInterestingLocations()); }
override public TurnStepAction FindAction(Avatar currentAvatar, AvatarTurnState avatarTurnState, QuestAnalyzer mapAnalyzer, ChanceProvider chanceProvider) { List<AbstractTileAction> actionsForCurrentLocation = mapAnalyzer.GetActionsAtObserverLocation(currentAvatar); if (actionsForCurrentLocation.Count <= 0) { return null; } AbstractTileAction tileAction = actionsForCurrentLocation[0]; TurnStepAction action = new ActionableTurnStepAction(tileAction, currentAvatar); return action; }
override public TurnStepAction FindAction(Avatar currentAvatar, AvatarTurnState avatarTurnState, QuestAnalyzer mapAnalyzer, ChanceProvider chanceProvider) { List<LocationOfInterest> interestingDestinations = mapAnalyzer.GetInterestingLocationsCheating(currentAvatar); if (interestingDestinations.Count <= 0) { return null; } interestingDestinations = interestingDestinations.OrderBy(item => item.StepsToLocation).ToList(); MovementTurnStepAction action = new MovementTurnStepAction(currentAvatar, interestingDestinations[0].StepsToLocation); return action; }
override public TurnStepAction FindAction(Avatar currentAvatar, AvatarTurnState avatarTurnState, QuestAnalyzer mapAnalyzer, ChanceProvider chanceProvider) { PointList unwalkedTiles = mapAnalyzer.GetAdjacentUnvisitedLocations(currentAvatar); if (unwalkedTiles.Count <= 0) { return null; } // Just pick the first tile, and see if that opens up any other actions... PointList path = new PointList() { unwalkedTiles[0] }; MovementTurnStepAction action = new MovementTurnStepAction(currentAvatar, path); return action; }
private void OnChanceGathererComplete(object sender, EventArgs args) { if (sender is ChanceGatherer) { ChanceGatherer chanceGatherer = (ChanceGatherer)sender; List<ChanceSubmission> submissions = chanceGatherer.Submissions; _chanceProvider = new ChanceProvider(submissions); // Go to the introduction GameIntroduction gameIntroduction = new GameIntroduction(_storyTeller); gameIntroduction.Complete += OnGameIntroductionComplete; _navigationService.Navigate(gameIntroduction); } }
public void TakeOverExperience() { //// First, go to the Chance Gatherer //ChanceGatherer chanceGatherer = new ChanceGatherer(); //chanceGatherer.Complete += OnChanceGathererComplete; //_navigationService.Navigate(chanceGatherer); // This skips straight to the QuestView List<ChanceSubmission> submissions = new List<ChanceSubmission>(); submissions.Add(new ChanceSubmission() { SubmitterName = "Jonathon", Value = 6 }); submissions.Add(new ChanceSubmission() { SubmitterName = "Jonathon", Value = 6 }); submissions.Add(new ChanceSubmission() { SubmitterName = "Jonathon", Value = 6 }); _chanceProvider = new ChanceProvider(submissions); OnGameIntroductionComplete(null, null); }
public QuestView(AbstractQuest quest, ChanceProvider chanceProvider, StoryTeller storyTeller) { InitializeComponent(); _quest = quest; _chanceProvider = chanceProvider; _storyTeller = storyTeller; _turnTakers = new List<Avatar>(); _currentTurnTaker = null; _currentTurnTakerIndex = -1; _turnTimer = new DispatcherTimer(); _turnTimer.Interval = TimeSpan.FromMilliseconds(500); _turnTimer.Tick += OnTurnTimerTick; Loaded += OnLoaded; }
public AvatarClassWizard(ChanceProvider chanceProvider) : base(1, 2, 4, 6, new ChanceMovementBehavior(chanceProvider, 2), "Images/MapTiles/HeroWizard.png", "Wizard") { }
public void DefendAgainst(int attackDamageRolled, ChanceProvider chanceProvider) { BreakFocus(); // If the Avatar is hit, break the focus of the Avatar. // TODO: Defend! }
virtual public TurnStepAction DoTakeTurnStep(QuestAnalyzer mapAnalyzer, ChanceProvider chanceProvider) { if (!IsHeroAlive) // Can't play if dead. { if (_sentDeathMessage) { return null; } else { _sentDeathMessage = true; return new DeadTurnStepAction(this); } } if (TurnState.MovementPointsLeft <= 0 && TurnState.HasTakenAction) // We can continue our turn as long as we have movement points left, and have not taken our action { return null; } // Determine the action to perform TurnStepAction action = null; for (int i = 0; i < _avatarClass.ActionStrategies.Count && action == null; i++) { AbstractActionStrategy strategy = _avatarClass.ActionStrategies[i]; if (_focusAction == null || strategy.CanBreakFocus) { action = strategy.FindAction(this, TurnState, mapAnalyzer, chanceProvider); if (action != null && !MayTakeAction(action, TurnState)) { action = null; } if (action != null) { _focusAction = null; } } } if (_focusAction != null && _focusAction.AcceptsAvatarFocus && _focusAction.HasMoreTurns) // If our focus action still has stuff to do, let it keep focus { if (MayTakeAction(_focusAction, TurnState)) { action = _focusAction; } } if (action == null) // If we can't figure anything else out, then end the turn. { action = new ConfusedTurnStepAction(this); // In the real game, this should never happen. Avatars should always find *something* to do. TurnState.HasTakenAction = true; TurnState.MovementPointsLeft = 0; } if (action.AcceptsAvatarFocus && action.HasMoreTurns) // If the action is multi-step, focus on it until something interrupts us { _focusAction = action; } return action; }
public AvatarClassElf(ChanceProvider chanceProvider) : base(2, 2, 6, 4, new ChanceMovementBehavior(chanceProvider, 2), "Images/MapTiles/HeroElf.png", "Elf") { }
public ChanceMovementBehavior(ChanceProvider chanceProvider, int numberOfMovementDice) : base() { _chanceProvider = chanceProvider; NumberOFMovementDice = numberOfMovementDice; }
public virtual TurnStepAction FindAction(Avatar currentAvatar, AvatarTurnState avatarTurnState, QuestAnalyzer mapAnalyzer, ChanceProvider chanceProvider) { return null; } // Override in subclasses
override public TurnStepAction FindAction(Avatar currentAvatar, AvatarTurnState avatarTurnState, QuestAnalyzer mapAnalyzer, ChanceProvider chanceProvider) { List<Avatar> enemies = mapAnalyzer.GetAdjacentEnemies(currentAvatar, currentAvatar.CanAttackAdjacent); return null; }