public void GameElementKnowsToRenderItselfAsString() { //Given a game element BigMonster bigMonster = new BigMonster(); string expected = "BigMonster / 10; "; //When it is rendered string actual = bigMonster.Render(); //Then is should present its name and its remaining life Assert.Equal(expected, actual); }
void Visit(BigMonster bigMonster) { FightManager.Combat(this, bigMonster, Constants.BigMonsterMaxDamage, Constants.BigMonsterReward); }
static GameElement[,] CreateGameElements(int mapSize, int monsterCount, int toxicPotionCount, int healingPotionCount) { Random random = new Random(); int emptyCellCount = mapSize * mapSize - monsterCount - toxicPotionCount - healingPotionCount - 2; GameElement[,] gameElements = new GameElement[mapSize, mapSize]; //Predefined Player and Big Monster gameElements[mapSize - 1, 0] = new EmptyCell(0); gameElements[mapSize - 1, mapSize - 1] = new BigMonster(); while (monsterCount > 0 || toxicPotionCount > 0 || healingPotionCount > 0 || emptyCellCount > 0) { int matrixIndex = random.Next(1, mapSize * mapSize); if (gameElements[(matrixIndex - 1) / mapSize, (matrixIndex - 1) % mapSize] != null) { continue; } if (monsterCount > 0) { gameElements[(matrixIndex - 1) / mapSize, (matrixIndex - 1) % mapSize] = new Monster(); monsterCount--; continue; } if (toxicPotionCount > 0) { gameElements[(matrixIndex - 1) / mapSize, (matrixIndex - 1) % mapSize] = new ToxicPotion(); toxicPotionCount--; continue; } if (healingPotionCount > 0) { gameElements[(matrixIndex - 1) / mapSize, (matrixIndex - 1) % mapSize] = new HealingPotion(); healingPotionCount--; continue; } if (emptyCellCount > 0) { gameElements[(matrixIndex - 1) / mapSize, (matrixIndex - 1) % mapSize] = new EmptyCell(); emptyCellCount--; continue; } } return(gameElements); }