add more monsters

This commit is contained in:
Andrew Pamment 2025-04-22 12:31:58 +10:00
parent 4d7183f380
commit a8ab13f978

32
Map.cpp
View File

@ -187,11 +187,34 @@ void Map::createRoom(bool first, int x1, int y1, int x2, int y2, bool withActors
void Map::addMonster(int x, int y) { void Map::addMonster(int x, int y) {
TCODRandom* rng = TCODRandom::getInstance(); TCODRandom* rng = TCODRandom::getInstance();
if (rng->getInt(0, 100) < 80) { if (rng->getInt(0, 100) < 80) {
// create weak monster
if (engine->level < 5) {
// create an rat
Actor* orc = new Actor(x, y, "r", "rat",
engine->gui->purple);
orc->destructible = new MonsterDestructible(10, 0, "dead rat", 5);
orc->attacker = new Attacker(3);
orc->ai = new MonsterAi();
engine->actors.push(orc);
}
else {
// create an orc // create an orc
Actor* orc = new Actor(x, y, "o", "orc", Actor* orc = new Actor(x, y, "o", "orc",
engine->gui->green); engine->gui->green);
orc->destructible = new MonsterDestructible(10, 0, "dead orc", 5); orc->destructible = new MonsterDestructible(15, 0, "dead orc", 7);
orc->attacker = new Attacker(3); orc->attacker = new Attacker(4.5f);
orc->ai = new MonsterAi();
engine->actors.push(orc);
}
}
else {
// create strong monster
if (engine->level < 5) {
// create an snake
Actor* orc = new Actor(x, y, "S", "snake",
engine->gui->green);
orc->destructible = new MonsterDestructible(16, 0, "dead snake", 10);
orc->attacker = new Attacker(4);
orc->ai = new MonsterAi(); orc->ai = new MonsterAi();
engine->actors.push(orc); engine->actors.push(orc);
} }
@ -199,12 +222,13 @@ void Map::addMonster(int x, int y) {
// create a troll // create a troll
Actor* troll = new Actor(x, y, "T", "troll", Actor* troll = new Actor(x, y, "T", "troll",
engine->gui->lightGreen); engine->gui->lightGreen);
troll->destructible = new MonsterDestructible(16, 1, "troll carcass", 10); troll->destructible = new MonsterDestructible(20, 1, "troll carcass", 15);
troll->attacker = new Attacker(4); troll->attacker = new Attacker(7);
troll->ai = new MonsterAi(); troll->ai = new MonsterAi();
engine->actors.push(troll); engine->actors.push(troll);
} }
} }
}
void Map::addItem(int x, int y) { void Map::addItem(int x, int y) {
TCODRandom* rng = TCODRandom::getInstance(); TCODRandom* rng = TCODRandom::getInstance();