public void ShouldSpawnShrinesAccordingToMapConfigurationAtRolledPosition() { //given var shrinePosition = new Position(2, 2); const int roomCount = 1; var mapConfiguration = new MapConfiguration { RoomCountBetween = Tuple.Create(roomCount, roomCount), MinRoomNeighboursCount = 1, MaxRoomNeighboursCount = 3, HealingShrines = new HealingShrinesConfiguration { ShrinePercentageSpawnChance = 30 } }; A.CallTo(() => _dice.RollBetween(mapConfiguration.RoomCountBetween.Item1, mapConfiguration.RoomCountBetween.Item2)).Returns(roomCount); A.CallTo(() => _dice.RollChance(mapConfiguration.HealingShrines.ShrinePercentageSpawnChance)).Returns(true); A.CallTo(() => _dice.RollPosition(A <int> .Ignored, A <int> .Ignored)).Returns(shrinePosition); var shrine = new HealingShrine(1, 1); A.CallTo(() => _healingShrineFactory.GetShrine(A <HealingShrinesConfiguration> .Ignored)).Returns(shrine); //when var map = _mapFactory.GenerateMap(mapConfiguration); //then var firstRoom = map.Rooms[0]; Assert.That(firstRoom.Tiles[shrinePosition.X, shrinePosition.Y].Shrine, Is.EqualTo(shrine)); Assert.That(firstRoom.Tiles[shrinePosition.X, shrinePosition.Y].HasShrine); }
public void ShouldHealProperNumberOfHitpoints() { //given const int hitpointsToBeHealed = 2; var canHeal = A.Fake <ICanHeal>(); var shrine = new HealingShrine(DefaultShrineUseCount, hitpointsToBeHealed); //when shrine.Heal(canHeal); //then A.CallTo(() => canHeal.Heal(hitpointsToBeHealed)).MustHaveHappened(); }
private Map GetMapWithARoomWithHealingShrineAt(Position roomStartingPosition, int shrineHealingPower, Position shrinePosition) { var roomWithAShrine = RoomFactory.CreateEmptyRoom(RoomSize, roomStartingPosition); var shrine = new HealingShrine(1, shrineHealingPower); roomWithAShrine.BuildShrine(shrine, shrinePosition); var map = new Map { Rooms = new List <Room> { roomWithAShrine } }; return(map); }
public void ShouldHealLimitedNumberOfTimes() { //given var canHeal = A.Fake <ICanHeal>(); const int hitpointsToBeHealed = 2; const int shrineUseCount = 1; var shrine = new HealingShrine(shrineUseCount, hitpointsToBeHealed); //when shrine.Heal(canHeal); shrine.Heal(canHeal); //then A.CallTo(() => canHeal.Heal(hitpointsToBeHealed)).MustHaveHappened(Repeated.Exactly.Once); }
public void BuildShrine(HealingShrine newShrine) { Shrine = newShrine; }
public void BuildShrine(HealingShrine newShrine, Position shrinePosition) { Tiles[shrinePosition.X, shrinePosition.Y].BuildShrine(newShrine); }