summaryrefslogtreecommitdiff
path: root/src/q_rand.c
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2011-02-22 06:45:48 +0100
committerBardur Arantsson <bardur@scientician.net>2012-03-29 21:22:23 +0200
commitaef0a9a6670ec219c3fc00e9cd9bc30458a5cab5 (patch)
tree46834896de02d7c430360c45a59a1c861f421936 /src/q_rand.c
parent3b4cbce560800a5cf8326904d70623b6bb910241 (diff)
Refactor: Generalize dynamic quest description for C-based quests
Diffstat (limited to 'src/q_rand.c')
-rw-r--r--src/q_rand.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/q_rand.c b/src/q_rand.c
index 84f7d3d3..50617bb8 100644
--- a/src/q_rand.c
+++ b/src/q_rand.c
@@ -429,6 +429,36 @@ bool_ quest_random_dump_hook(char *fmt)
return (FALSE);
}
+
+bool_ quest_random_describe(FILE *fff)
+{
+ if (!(dungeon_flags1 & DF1_PRINCIPAL)) return FALSE;
+ if ((dun_level < 1) || (dun_level >= MAX_RANDOM_QUEST)) return FALSE;
+ if (!random_quests[dun_level].type) return FALSE;
+ if (random_quests[dun_level].done) return FALSE;
+ if (p_ptr->inside_quest) return FALSE;
+ if (!dun_level) return FALSE;
+
+ if (!is_randhero(dun_level))
+ {
+ fprintf(fff, "#####yCaptured princess!\n");
+ fprintf(fff, "A princess is being held prisoner and tortured here!\n");
+ fprintf(fff, "Save her from the horrible %s.\n",
+ r_info[random_quests[dun_level].r_idx].name + r_name);
+ }
+ else
+ {
+ fprintf(fff, "#####yLost sword!\n");
+ fprintf(fff, "An adventurer lost his sword to a bunch of %s!\n",
+ r_info[random_quests[dun_level].r_idx].name + r_name);
+ fprintf(fff, "Kill them all to get it back.\n");
+ }
+ fprintf(fff, "Number: %d, Killed: %ld.\n",
+ random_quests[dun_level].type, (long int) quest[QUEST_RANDOM].data[0]);
+ fprintf(fff, "\n");
+ return TRUE;
+}
+
bool_ quest_random_init_hook(int q_idx)
{
add_hook(HOOK_MONSTER_DEATH, quest_random_death_hook, "rand_death");