summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Cline <zelgadis@sourceforge.net>2009-10-20 13:03:17 -0700
committerMatthew Cline <zelgadis@sourceforge.net>2009-10-20 13:03:17 -0700
commit7d6b9d881b71e0485b842994ee12541c3cc69afc (patch)
treee47bb894015edeb8f359105b80eb88d556a42957
parentbd3a484b40403e4c7f07e7f6c43e5a1331235461 (diff)
downloadcrawl-ref-7d6b9d881b71e0485b842994ee12541c3cc69afc.tar.gz
crawl-ref-7d6b9d881b71e0485b842994ee12541c3cc69afc.zip
arena: Respawn fix, "move_respawns" option, msgs
Give dgn_place_monster() the proper monster level when respawning. New "move_respawns" option teleports respawned monsters as soon as they're placed, so that monsters don't clump up together in a brawl at the center of the arena. Don't filter out monster death messages when dumping messages to arena.result
-rw-r--r--crawl-ref/docs/arena.txt16
-rw-r--r--crawl-ref/source/arena.cc23
2 files changed, 32 insertions, 7 deletions
diff --git a/crawl-ref/docs/arena.txt b/crawl-ref/docs/arena.txt
index 1633f0fe74..f9aac2b43d 100644
--- a/crawl-ref/docs/arena.txt
+++ b/crawl-ref/docs/arena.txt
@@ -65,6 +65,14 @@ and summon monsters with the Shadow Creatures spell:
crawl -arena "test spawner v test spawner"
+If you want a *specific* set of monsters to fight each other endlessly,
+you can use the "respawn" tag, which will cause the initally placed
+monsters to be replaced when they die. For example,
+
+ crawl -arena "respawn rat v rat"
+
+will make it so that when one rat dies another takes it's place,
+resulting in an endless fight between two rats.
Commands
------------------------------------------------------------------------------
@@ -79,7 +87,7 @@ There are a very limited number of command you can issue to the arena:
* You can suspended the arena like in a normal game (Control-Z).
-If the arena has lots of monsters it might take a few second before it
+If the arena has lots of monsters it might take a few seconds before it
responds.
Options and parameters
@@ -132,6 +140,8 @@ The parameters include:
* "arena_place:place" sets the place used when determining which monsters the
spell Shadow Creatures uses. So "arena:Lair:5" would make it
summon the types of monsters you'd find on the 5th lair of the Lair.
+ It also controls what type of monster "random" places, assuming
+ that "random_uniques" isn't used.
(This defaults to the 20th level of the main dungeon).
* real_summons: Summoned monsters are made real as soon as they're placed in
@@ -167,3 +177,7 @@ The parameters include:
be replaced by the same type of monster. This allows for an endless
fight between exactly specified factions, rather than the random
kind you get by pitting two test spawners against each other.
+
+* move_respawns: Moves respawned monsters to a new, random location as
+ soon as they're placed, to avoid monsters clumping up in a massive
+ brawl at the center of the arena.
diff --git a/crawl-ref/source/arena.cc b/crawl-ref/source/arena.cc
index b7c7461df8..a29292cd21 100644
--- a/crawl-ref/source/arena.cc
+++ b/crawl-ref/source/arena.cc
@@ -91,6 +91,7 @@ namespace arena
bool real_summons = false;
bool move_summons = false;
bool respawn = false;
+ bool move_respawns = false;
bool miscasts = false;
@@ -317,6 +318,7 @@ namespace arena
move_summons = strip_tag(spec, "move_summons");
miscasts = strip_tag(spec, "miscasts");
respawn = strip_tag(spec, "respawn");
+ move_respawns = strip_tag(spec, "move_respawns");
summon_throttle = strip_number_tag(spec, "summon_throttle:");
if (real_summons && respawn)
@@ -657,13 +659,20 @@ namespace arena
// Ignore messages generated while the user examines
// the arnea.
case MSGCH_PROMPT:
- case MSGCH_MONSTER_DAMAGE:
case MSGCH_MONSTER_TARGET:
case MSGCH_FLOOR_ITEMS:
case MSGCH_EXAMINE:
case MSGCH_EXAMINE_FILTER:
continue;
+ // If a monster-damage message ends with '!' it's a
+ // death message, otherwise it's an examination message
+ // and should be skipped.
+ case MSGCH_MONSTER_DAMAGE:
+ if (msg[msg.length() - 1] != '!')
+ continue;
+ break;
+
case MSGCH_ERROR: prefix = "ERROR: "; break;
case MSGCH_WARN: prefix = "WARN: "; break;
case MSGCH_DIAGNOSTICS: prefix = "DIAG: "; break;
@@ -777,7 +786,8 @@ namespace arena
if (fac.friendly)
spec.attitude = ATT_FRIENDLY;
- int idx = dgn_place_monster(spec, 0, pos, false, true);
+ int idx = dgn_place_monster(spec, you.your_level, pos, false,
+ true);
if (idx == -1 && fac.active_members == 0
&& mgrd(pos) != NON_MONSTER)
@@ -808,7 +818,8 @@ namespace arena
monster_teleport(other, true);
}
- idx = dgn_place_monster(spec, 0, pos, false, true);
+ idx = dgn_place_monster(spec, you.your_level, pos, false,
+ true);
}
if (idx != -1)
@@ -818,6 +829,9 @@ namespace arena
fac.respawn_pos.erase(fac.respawn_pos.begin() + i);
to_respawn[idx] = spec_idx;
+
+ if (move_respawns)
+ monster_teleport(&menv[idx], true, true);
}
else
{
@@ -1268,9 +1282,6 @@ void arena_monster_died(monsters *monster, killer_type killer,
fac->respawn_pos.push_back(monster->pos());
arena::to_respawn[midx] = -1;
-
- arena::faction_a.won = false;
- arena::faction_b.won = false;
}
}