Esempio n. 1
0
		public void DestroyBlight (Location location, Blight blight, GameState gameState)
		{
			if (location.Blights.Contains (blight)) {
				location.Blights.Remove (blight);
				gameState.BlightPool.Add (blight);
			}
		}
		public LocationViewModel (Location location)
		{
			Location = location;
			Spawns = new ObservableCollection<ISpawnViewModel> ();
			foreach (var blight in location.Blights)
				Spawns.Add (new BlightViewModel (blight));
		}
		public LocationXViewModel (
			HeroTurnViewModel parent,
			Location location)
		{
			Location = location;
			_parent = parent;

			Blights = new ObservableCollection<BlightViewModel> ();
			Blights.Add (new BlightViewModel (null));
			foreach (var blight in location.Blights)
				AddBlightViewModel (new BlightViewModel (blight));
		}
Esempio n. 4
0
		/// <summary>
		/// Spawns a blight at the specified locaiton. 
		/// If the location is already at capacity then it spawns a blight at the monastery instead.
		/// </summary>
		/// <returns>A typle containting the blight spawned and the locaiton spawned at.</returns>
		/// <param name="location">Location.</param>
		/// <param name="gameState">Game state.</param>
		public Tuple<Location, Blight> SpawnBlight (Location location, GameState gameState)
		{
			if (location.BlightCount >= 4)
				location = gameState.Locations.Single (l => l.Id == (int)LocationIds.Monastery);
			
			var card = gameState.MapCards.Draw ();
			var blightName = card.Rows.Single (r => r.LocationId == location.Id).BlightName;
			var blight = gameState.BlightPool.FirstOrDefault (x => x.Name == blightName);
			gameState.MapCards.Discard (card);

			if (blight != null) {
				location.Blights.Add (blight);
				gameState.BlightPool.Remove (blight);
			} else //if there are no blights of that type left to spawn try the next card
				return SpawnBlight (location, gameState);

			return new Tuple<Location, Blight>(location, blight);
		}
		public HeroPhaseLocationViewModel(Location location, IEnumerable<Hero> heroes)
				: base(location)
		{
			Spawns.Add(new BlightViewModel(null));

			Heroes = new ObservableCollection<HeroSummaryViewModel>(heroes.Select(x => new HeroSummaryViewModel(x)));

		}
		public SpawnLocationViewModel (Location location, IEnumerable<Blight> blights)
		{
			Location = location;
			Spawns = new ObservableCollection<ISpawnViewModel> ();

			if (blights != null) {
				foreach (var blight in blights) {
					Spawns.Add (new BlightViewModel (blight));
				}
			}
		}
		public NecromancerSpawnResult Spawn (GameState gameState, Location newLocation, int necromancerRoll)
		{
			var result = new NecromancerSpawnResult() { NewBlights = new List<Tuple<Location, Blight>>()};

			//check if a quest needs to be spawned
			if (gameState.UseQuests && (necromancerRoll == 3 || necromancerRoll == 4))
				result.SpawnQuest = true;

			var initialBlightCount = newLocation.BlightCount;
			var monastery = gameState.Locations.Single (l => l.Id == (int)LocationIds.Monastery);

			//spawn blight at necromancer's new location
			result.NewBlights.Add (_blightService.SpawnBlight (newLocation, gameState));		

			//standard darkness track effects
			if (gameState.DarknessTrackEffectsActive) {
				if (gameState.Darkness >= 10 && newLocation.BlightCount == 0)
					result.NewBlights.Add (_blightService.SpawnBlight (newLocation, gameState));

				if (gameState.Darkness >= 20 && (necromancerRoll == 1 || necromancerRoll == 2))
					result.NewBlights.Add (_blightService.SpawnBlight (newLocation, gameState));
			}

			//darkness card effects
			//if (gameState.Mode != DarknessCardsMode.None) {
				if (gameState.Necromancer.FocusedRituals
					&& !gameState.Heroes.Active.Any (x => x.LocationId == newLocation.Id))
					result.NewBlights.Add (_blightService.SpawnBlight (newLocation, gameState));

				if (gameState.Necromancer.CreepingShadows && (necromancerRoll == 5 || necromancerRoll == 6))
					result.NewBlights.Add (_blightService.SpawnBlight (newLocation, gameState));

				if (gameState.Necromancer.DyingLand) {
					if (gameState.DarknessTrackEffectsActive
						&& gameState.Darkness >= 10
					&& initialBlightCount == 1)
						result.NewBlights.Add (_blightService.SpawnBlight (newLocation, gameState));
					else if ((!gameState.DarknessTrackEffectsActive
						|| gameState.Darkness < 10)
					&& initialBlightCount == 0)
						result.NewBlights.Add (_blightService.SpawnBlight (newLocation, gameState));
				}

				if (gameState.Necromancer.EncroachingShadows && necromancerRoll == 6)
					result.NewBlights.Add (_blightService.SpawnBlight (monastery, gameState));

				if (gameState.Necromancer.Overwhelm && initialBlightCount < 4 && newLocation.BlightCount >= 4)
					result.NewBlights.Add (_blightService.SpawnBlight (monastery, gameState));

			//}

			//darkness tipping over 30
			if (gameState.Darkness > 30) {
				var overflowCount = gameState.Darkness - 30;

				for (int i = 0; i < overflowCount; i++)
					result.NewBlights.Add (_blightService.SpawnBlight (monastery, gameState));

				gameState.Darkness = 30;
			}

			return result;
		}