summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2009-07-25 16:25:25 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2009-07-25 16:25:25 +0000
commitb736da84096898e66c6cd777020319d4391b604c (patch)
treeac7b0684ea88b1438eb19a7260bc3d4123ee82d0
parent3cd7d88e4a445431c8ce6f1e8b6c107228649b4e (diff)
downloadcrawl-ref-b736da84096898e66c6cd777020319d4391b604c.tar.gz
crawl-ref-b736da84096898e66c6cd777020319d4391b604c.zip
More milestones and logfile fields for the Crawl tournament.
Add milestones for worshipping and renouncing gods. Record number of kills and all skills at level 27 in the logfile and milestones. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10406 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/Kills.cc15
-rw-r--r--crawl-ref/source/Kills.h2
-rw-r--r--crawl-ref/source/hiscores.cc23
-rw-r--r--crawl-ref/source/hiscores.h3
-rw-r--r--crawl-ref/source/religion.cc12
5 files changed, 55 insertions, 0 deletions
diff --git a/crawl-ref/source/Kills.cc b/crawl-ref/source/Kills.cc
index bc61b59af5..34111138e7 100644
--- a/crawl-ref/source/Kills.cc
+++ b/crawl-ref/source/Kills.cc
@@ -107,6 +107,21 @@ void KillMaster::record_kill(const monsters *mon, int killer, bool ispet)
categorized_kills[kc].record_kill(mon);
}
+long KillMaster::total_kills() const
+{
+ long grandtotal = 0L;
+ for (int i = KC_YOU; i < KC_NCATEGORIES; ++i)
+ {
+ if (categorized_kills[i].empty())
+ continue;
+
+ std::vector<kill_exp> kills;
+ long count = categorized_kills[i].get_kills(kills);
+ grandtotal += count;
+ }
+ return (grandtotal);
+}
+
std::string KillMaster::kill_info() const
{
if (empty())
diff --git a/crawl-ref/source/Kills.h b/crawl-ref/source/Kills.h
index 71cab6bd45..cff0c3525a 100644
--- a/crawl-ref/source/Kills.h
+++ b/crawl-ref/source/Kills.h
@@ -176,6 +176,8 @@ public:
// Number of kills, any category.
long num_kills(const monsters *mon) const;
+ long total_kills() const;
+
std::string kill_info() const;
private:
const char *category_name(kill_category kc) const;
diff --git a/crawl-ref/source/hiscores.cc b/crawl-ref/source/hiscores.cc
index 5207bf3109..03180c5b12 100644
--- a/crawl-ref/source/hiscores.cc
+++ b/crawl-ref/source/hiscores.cc
@@ -43,6 +43,7 @@ REVISION("$Rev$");
#include "itemname.h"
#include "itemprop.h"
#include "items.h"
+#include "Kills.h"
#include "libutil.h"
#include "message.h"
#include "mon-util.h"
@@ -521,6 +522,8 @@ void scorefile_entry::init_from(const scorefile_entry &se)
num_turns = se.num_turns;
num_diff_runes = se.num_diff_runes;
num_runes = se.num_runes;
+ kills = se.kills;
+ maxed_skills = se.maxed_skills;
}
bool scorefile_entry::parse(const std::string &line)
@@ -617,6 +620,9 @@ void scorefile_entry::init_with_fields()
num_diff_runes = fields->int_field("urune");
num_runes = fields->int_field("nrune");
+
+ kills = fields->long_field("kills");
+ maxed_skills = fields->str_field("maxskills");
}
void scorefile_entry::set_base_xlog_fields() const
@@ -679,6 +685,10 @@ void scorefile_entry::set_base_xlog_fields() const
if (num_runes)
fields->add_field("nrune", "%d", num_runes);
+
+ fields->add_field("kills", "%ld", kills);
+ if (!maxed_skills.empty())
+ fields->add_field("maxskills", "%s", maxed_skills.c_str());
}
void scorefile_entry::set_score_fields() const
@@ -874,6 +884,8 @@ void scorefile_entry::reset()
num_turns = -1;
num_diff_runes = 0;
num_runes = 0;
+ kills = 0L;
+ maxed_skills.clear();
}
static int _award_modified_experience()
@@ -1023,6 +1035,17 @@ void scorefile_entry::init()
best_skill = ::best_skill( SK_FIGHTING, NUM_SKILLS - 1, 99 );
best_skill_lvl = you.skills[ best_skill ];
+ // Note all skills at level 27.
+ for (int sk = 0; sk < NUM_SKILLS; ++sk) {
+ if (you.skills[sk] == 27) {
+ if (!maxed_skills.empty())
+ maxed_skills += ",";
+ maxed_skills += skill_name(sk);
+ }
+ }
+
+ kills = you.kills->total_kills();
+
final_hp = you.hp;
final_max_hp = you.hp_max;
final_max_max_hp = get_real_hp(true, true);
diff --git a/crawl-ref/source/hiscores.h b/crawl-ref/source/hiscores.h
index 39308f0e2c..29c99bb715 100644
--- a/crawl-ref/source/hiscores.h
+++ b/crawl-ref/source/hiscores.h
@@ -117,6 +117,9 @@ public:
long num_turns; // number of turns taken
int num_diff_runes; // number of rune types in inventory
int num_runes; // total number of runes in inventory
+ long kills; // number of monsters killed
+ std::string maxed_skills; // comma-separated list of skills
+ // at level 27
mutable std::auto_ptr<xlog_fields> fields;
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index 0611c336aa..a33b7e12c7 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -38,6 +38,7 @@ REVISION("$Rev$");
#include "fight.h"
#include "files.h"
#include "food.h"
+#include "hiscores.h"
#include "invent.h"
#include "it_use2.h"
#include "itemname.h"
@@ -6316,6 +6317,7 @@ void excommunication(god_type new_god)
{
const god_type old_god = you.religion;
ASSERT(old_god != new_god);
+ ASSERT(old_god != GOD_NO_GOD);
const bool was_haloed = you.haloed();
const int old_piety = you.piety;
@@ -6334,6 +6336,10 @@ void excommunication(god_type new_god)
mpr("You have lost your religion!");
more();
+#ifdef DGL_MILESTONES
+ mark_milestone("god.renounce", "abandoned " + god_name(old_god) + ".");
+#endif
+
if (god_hates_your_god(old_god, new_god))
{
simple_god_message(
@@ -7141,6 +7147,12 @@ void god_pitch(god_type which_god)
#ifdef DGL_WHEREIS
whereis_record();
#endif
+
+#ifdef DGL_MILESTONES
+ mark_milestone("god.worship", "became a worshipper of "
+ + god_name(you.religion) + ".");
+#endif
+
simple_god_message(
make_stringf(" welcomes you%s!",
you.worshipped[which_god] ? " back" : "").c_str());