Attached Files |
0001-More-information-when-missing.patch [^] (8,482 bytes) 2010-10-25 22:31 [Show Content] [Hide Content]From f2c23febd71e00a1b0f38c41ff56f73eedb3711a Mon Sep 17 00:00:00 2001
From: Arxale <gafrie@gmail.com>
Date: Mon, 25 Oct 2010 21:44:08 +0400
Subject: [PATCH] More information when missing
---
crawl-ref/source/fight.cc | 65 +++++++++++++++++++++++++++-----------
crawl-ref/source/melee_attack.h | 4 ++-
2 files changed, 49 insertions(+), 20 deletions(-)
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index 066aaaf..291e105 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -108,7 +108,7 @@ static void mons_lose_attack_energy(monster* attacker, int wpn_speed,
*/
// This function is only used when monsters are attacking.
-bool test_melee_hit(int to_hit, int ev, defer_rand& r)
+int test_melee_hit(int to_hit, int ev, defer_rand& r)
{
int roll = -1;
int margin = AUTOMATIC_HIT;
@@ -142,7 +142,7 @@ bool test_melee_hit(int to_hit, int ev, defer_rand& r)
(roll == -1) ? "!!!" : "", margin);
#endif
- return (margin >= 0);
+ return (margin);
}
// This function returns the "extra" stats the player gets because of
@@ -811,7 +811,9 @@ bool melee_attack::player_attack()
coord_def where = defender->pos();
- if (player_hits_monster())
+ ev_margin = player_hits_monster();
+
+ if (ev_margin >= 0)
{
did_hit = true;
if (Hints.hints_left)
@@ -1444,10 +1446,20 @@ std::string melee_attack::attack_strength_punctuation()
}
else
{
- return (damage_done < HIT_WEAK ? "." : "!");
+ return (damage_done < HIT_WEAK ? "." :
+ damage_done < HIT_MED ? "!"
+ : "!!!");
}
}
+std::string melee_attack::evasion_margin_adverb()
+{
+ return((ev_margin <= -20) ? " completely" :
+ (ev_margin <= -12) ? "" :
+ (ev_margin <= -6) ? " closely"
+ : " barely");
+}
+
void melee_attack::player_announce_hit()
{
if (!verb_degree.empty() && verb_degree[0] != ' ')
@@ -1486,24 +1498,29 @@ std::string melee_attack::player_why_missed()
return ("Your shield and " + armour_name
+ " prevent you from hitting ");
}
- return "You miss ";
+
+ return ("You" + evasion_margin_adverb() + " miss ");
}
void melee_attack::player_warn_miss()
{
did_hit = false;
-
// Upset only non-sleeping monsters if we missed.
if (!defender->asleep())
behaviour_event(defender->as_monster(), ME_WHACK, MHITYOU);
+ // XXX Unlike monster version, we cant use attack_strength_punctuation()
+ // instead of "." here, as player_calc_hit_damage() also produce variety
+ // of effects on premise that the hit check is already made, and so cannot
+ // be used to calculate estimated damage.
msg::stream << player_why_missed()
<< defender->name(DESC_NOCAP_THE)
<< "."
<< std::endl;
+ damage_done = 0;
}
-bool melee_attack::player_hits_monster()
+int melee_attack::player_hits_monster()
{
const int evasion = defender->melee_evasion(attacker);
const int helpful_evasion =
@@ -1522,7 +1539,7 @@ bool melee_attack::player_hits_monster()
}
if (to_hit >= helpful_evasion || one_chance_in(20))
- return (true);
+ return (1);
if (to_hit >= evasion
|| ((defender->cannot_act() || defender->asleep())
@@ -1533,7 +1550,7 @@ bool melee_attack::player_hits_monster()
if (defender_visible)
msg::stream << "Helpless, " << defender->name(DESC_NOCAP_THE)
<< " fails to dodge your attack." << std::endl;
- return (true);
+ return (1);
}
const int phaseless_evasion =
@@ -1545,7 +1562,7 @@ bool melee_attack::player_hits_monster()
<< defender->pronoun(PRONOUN_NOCAP)
<< " momentarily phases out." << std::endl;
- return (false);
+ return (to_hit - helpful_evasion);
}
int melee_attack::player_stat_modify_damage(int damage)
@@ -5346,7 +5363,7 @@ void melee_attack::mons_do_spines()
&& attacker->alive()
&& one_chance_in(evp + 1))
{
- if (!test_melee_hit(2+ 4 * mut, attacker->melee_evasion(defender), r))
+ if (test_melee_hit(2+ 4 * mut, attacker->melee_evasion(defender), r) < 0)
{
simple_monster_message(attacker->as_monster(),
" dodges your spines.");
@@ -5649,13 +5666,20 @@ void melee_attack::mons_perform_attack_rounds()
defender_evasion_nophase = defender_evasion;
}
+ // Calculating damage before hit check allows us to print
+ // appropriate number of exlamation marks at the end of "miss"
+ // message.
+ damage_done = mons_calc_damage(attk);
+
+ ev_margin = test_melee_hit(to_hit, defender_evasion_help, r);
+
if (attacker == defender
- || test_melee_hit(to_hit, defender_evasion_help, r))
+ || ev_margin >= 0)
{
// Will hit no matter what.
this_round_hit = true;
}
- else if (test_melee_hit(to_hit, defender_evasion, r))
+ else if (test_melee_hit(to_hit, defender_evasion, r) >= 0)
{
if (needs_message)
{
@@ -5666,16 +5690,17 @@ void melee_attack::mons_perform_attack_rounds()
}
this_round_hit = true;
}
- else if (test_melee_hit(to_hit, defender_evasion_nophase, r))
+ else if (test_melee_hit(to_hit, defender_evasion_nophase, r) >= 0)
{
if (needs_message)
{
mprf("%s momentarily %s out as %s "
- "attack passes through %s.",
+ "attack passes through %s%s",
defender->name(DESC_CAP_THE).c_str(),
defender->conj_verb("phase").c_str(),
atk_name(DESC_NOCAP_ITS).c_str(),
- defender->pronoun(PRONOUN_OBJECTIVE).c_str());
+ defender->pronoun(PRONOUN_OBJECTIVE).c_str(),
+ attack_strength_punctuation().c_str());
}
this_round_hit = false;
}
@@ -5684,9 +5709,11 @@ void melee_attack::mons_perform_attack_rounds()
// Misses no matter what.
if (needs_message)
{
- mprf("%s misses %s.",
+ mprf("%s%s misses %s%s",
atk_name(DESC_CAP_THE).c_str(),
- mons_defender_name().c_str());
+ evasion_margin_adverb().c_str(),
+ mons_defender_name().c_str(),
+ attack_strength_punctuation().c_str());
}
}
@@ -5694,11 +5721,11 @@ void melee_attack::mons_perform_attack_rounds()
{
did_hit = true;
perceived_attack = true;
- damage_done = mons_calc_damage(attk);
}
else
{
perceived_attack = perceived_attack || attacker_visible;
+ damage_done = 0;
}
if (attacker != defender &&
diff --git a/crawl-ref/source/melee_attack.h b/crawl-ref/source/melee_attack.h
index 4312fdc..f32202c 100644
--- a/crawl-ref/source/melee_attack.h
+++ b/crawl-ref/source/melee_attack.h
@@ -21,6 +21,7 @@ public:
int attack_number;
int to_hit;
+ int ev_margin;
int damage_done;
int special_damage;
int aux_damage;
@@ -108,6 +109,7 @@ private:
std::string debug_damage_number();
std::string special_attack_punctuation();
std::string attack_strength_punctuation();
+ std::string evasion_margin_adverb();
std::string atk_name(description_level_type desc) const;
std::string def_name(description_level_type desc) const;
@@ -197,7 +199,7 @@ private:
int player_stab(int damage);
int player_weapon_type_modify(int damage);
- bool player_hits_monster();
+ int player_hits_monster();
int player_calc_base_weapon_damage();
int player_calc_base_unarmed_damage();
void player_exercise_combat_skills();
--
1.7.3-rc1
0002-More-information-when-MR-is-effective.patch [^] (15,268 bytes) 2010-10-25 22:32 [Show Content] [Hide Content]From 4c28a5211e4ec6d0f4f2cd252e09013c61516284 Mon Sep 17 00:00:00 2001
From: Arxale <gafrie@gmail.com>
Date: Mon, 25 Oct 2010 14:20:13 +0400
Subject: [PATCH 2/2] More information when MR is effective
---
crawl-ref/source/actor.cc | 8 ++++----
crawl-ref/source/actor.h | 2 +-
crawl-ref/source/beam.cc | 25 ++++++++++++++-----------
crawl-ref/source/beam.h | 2 +-
crawl-ref/source/fight.cc | 4 ++--
crawl-ref/source/godabil.cc | 18 +++++++++++-------
crawl-ref/source/mon-abil.cc | 10 ++++++----
crawl-ref/source/mon-cast.cc | 8 +++++---
crawl-ref/source/mon-util.cc | 17 ++++++++++++++---
crawl-ref/source/mon-util.h | 3 ++-
crawl-ref/source/spl-damage.cc | 6 ++++--
crawl-ref/source/spl-monench.cc | 4 ++--
12 files changed, 66 insertions(+), 41 deletions(-)
diff --git a/crawl-ref/source/actor.cc b/crawl-ref/source/actor.cc
index 0b5b5dc..0068430 100644
--- a/crawl-ref/source/actor.cc
+++ b/crawl-ref/source/actor.cc
@@ -79,12 +79,12 @@ bool actor::handle_trap()
return (trap != NULL);
}
-bool actor::check_res_magic(int power)
+int actor::check_res_magic(int power)
{
const int mrs = res_magic();
if (mrs == MAG_IMMUNE)
- return (true);
+ return (100);
// Evil, evil hack to make weak one hd monsters easier for first level
// characters who have resistable 1st level spells. Six is a very special
@@ -97,7 +97,7 @@ bool actor::check_res_magic(int power)
// help them out (or building a level or two of their base skill so they
// aren't resisted as often). - bwr
if (atype() == ACT_MONSTER && mrs < 6 && coinflip())
- return (false);
+ return (-1);
power = stepdown_value(power, 30, 40, 100, 120);
@@ -107,7 +107,7 @@ bool actor::check_res_magic(int power)
dprf("Power: %d, MR: %d, target: %d, roll: %d",
power, mrs, mrchance, mrch2);
- return (mrch2 < mrchance);
+ return (mrchance - mrch2);
}
void actor::set_position(const coord_def &c)
diff --git a/crawl-ref/source/actor.h b/crawl-ref/source/actor.h
index 83a828e..b46f3fa 100644
--- a/crawl-ref/source/actor.h
+++ b/crawl-ref/source/actor.h
@@ -238,7 +238,7 @@ public:
virtual int res_negative_energy() const = 0;
virtual int res_torment() const = 0;
virtual int res_magic() const = 0;
- virtual bool check_res_magic(int power);
+ virtual int check_res_magic(int power);
virtual flight_type flight_mode() const = 0;
virtual bool is_levitating() const = 0;
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 8708e71..dbf1b92 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -1837,10 +1837,10 @@ static bool _monster_resists_mass_enchantment(monster* mons,
if (mons->holiness() != MH_UNDEAD)
return (true);
- if (mons->check_res_magic(pow))
+ int res_margin = mons->check_res_magic(pow);
+ if (res_margin > 0)
{
- if (simple_monster_message(mons, mons_immune_magic(mons)
- ? " is unaffected." : " resists."))
+ if (simple_monster_message(mons, mons_resist_string(mons, res_margin).c_str()))
{
*did_msg = true;
}
@@ -1856,10 +1856,10 @@ static bool _monster_resists_mass_enchantment(monster* mons,
return (true);
}
- if (mons->check_res_magic(pow))
+ int res_margin = mons->check_res_magic(pow);
+ if (res_margin > 0)
{
- if (simple_monster_message(mons, mons_immune_magic(mons)
- ? " is unaffected." : " resists."))
+ if (simple_monster_message(mons, mons_resist_string(mons, res_margin).c_str()))
{
*did_msg = true;
}
@@ -3186,7 +3186,7 @@ void bolt::affect_player_enchantment()
ench_power = ench_power * 6 / 5;
if (flavour != BEAM_POLYMORPH && has_saving_throw()
- && you.check_res_magic(ench_power))
+ && you.check_res_magic(ench_power) > 0)
{
// You resisted it.
@@ -3947,7 +3947,8 @@ void bolt::enchantment_affect_monster(monster* mon)
_zap_animation(-1, mon, false);
// Try to hit the monster with the enchantment.
- const mon_resist_type ench_result = try_enchant_monster(mon);
+ int res_margin = 0;
+ const mon_resist_type ench_result = try_enchant_monster(mon, res_margin);
if (mon->alive()) // Aftereffects.
{
@@ -3959,7 +3960,8 @@ void bolt::enchantment_affect_monster(monster* mon)
switch (ench_result)
{
case MON_RESIST:
- if (simple_monster_message(mon, " resists."))
+ if (simple_monster_message(mon,
+ resist_margin_phrase(res_margin).c_str()))
msg_generated = true;
break;
case MON_UNAFFECTED:
@@ -4565,7 +4567,7 @@ bool enchant_monster_with_flavour(monster* mon, actor *foe,
return dummy.obvious_effect;
}
-mon_resist_type bolt::try_enchant_monster(monster* mon)
+mon_resist_type bolt::try_enchant_monster(monster* mon, int &res_margin)
{
// Early out if the enchantment is meaningless.
if (!_ench_flavour_affects_monster(flavour, mon))
@@ -4588,7 +4590,8 @@ mon_resist_type bolt::try_enchant_monster(monster* mon)
}
else
{
- if (mon->check_res_magic(ench_power))
+ res_margin = mon->check_res_magic(ench_power);
+ if (res_margin > 0)
return (MON_RESIST);
}
}
diff --git a/crawl-ref/source/beam.h b/crawl-ref/source/beam.h
index 5aa5fca..d99d7fb 100644
--- a/crawl-ref/source/beam.h
+++ b/crawl-ref/source/beam.h
@@ -259,7 +259,7 @@ public:
void apply_bolt_paralysis(monster* mons);
void apply_bolt_petrify(monster* mons);
void enchantment_affect_monster(monster* mon);
- mon_resist_type try_enchant_monster(monster* mon);
+ mon_resist_type try_enchant_monster(monster* mon, int &res_margin);
void tracer_enchantment_affect_monster(monster* mon);
void tracer_nonenchantment_affect_monster(monster* mon);
void update_hurt_or_helped(monster* mon);
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index 3056814..ef26607 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -4390,7 +4390,7 @@ bool melee_attack::mons_attack_warded_off()
const int warding = defender->warding();
if (warding
&& attacker->is_summoned()
- && !attacker->as_monster()->check_res_magic(warding))
+ && attacker->as_monster()->check_res_magic(warding) <= 0)
{
if (needs_message)
{
@@ -5334,7 +5334,7 @@ void melee_attack::mons_do_eyeball_confusion()
const int ench_pow = player_mutation_level(MUT_EYEBALLS) * 30;
monster* mon = attacker->as_monster();
- if (!mon->check_res_magic(ench_pow)
+ if (mon->check_res_magic(ench_pow) <= 0
&& mons_class_is_confusable(mon->type))
{
mprf("The eyeballs on your body gaze at %s.",
diff --git a/crawl-ref/source/godabil.cc b/crawl-ref/source/godabil.cc
index 87b3b16..52f9747 100644
--- a/crawl-ref/source/godabil.cc
+++ b/crawl-ref/source/godabil.cc
@@ -2252,17 +2252,19 @@ static int _lugonu_warp_monster(monster* mon, int pow)
if (!mon->friendly())
behaviour_event(mon, ME_ANNOY, MHITYOU);
- if (mon->check_res_magic(pow * 2))
+ int res_margin = mon->check_res_magic(pow * 2);
+ if (res_margin > 0)
{
- mprf("%s %s.",
- mon->name(DESC_CAP_THE).c_str(), mons_resist_string(mon));
+ mprf("%s%s",
+ mon->name(DESC_CAP_THE).c_str(),
+ mons_resist_string(mon, res_margin).c_str());
return (1);
}
const int damage = 1 + random2(pow / 6);
if (mons_genus(mon->type) == MONS_BLINK_FROG)
mon->heal(damage, false);
- else if (!mon->check_res_magic(pow))
+ else if (mon->check_res_magic(pow) <= 0)
{
mon->hurt(&you, damage);
if (!mon->alive())
@@ -2349,10 +2351,12 @@ void cheibriados_time_bend(int pow)
monster* mon = monster_at(*ai);
if (mon && !mons_is_stationary(mon))
{
- if (roll_dice(mon->hit_dice, 3) > random2avg(pow, 2))
+ int res_margin = roll_dice(mon->hit_dice, 3) - random2avg(pow, 2);
+ if (res_margin > 0)
{
- mprf("%s %s.",
- mon->name(DESC_CAP_THE).c_str(), mons_resist_string(mon));
+ mprf("%s%s",
+ mon->name(DESC_CAP_THE).c_str(),
+ mons_resist_string(mon, res_margin).c_str());
continue;
}
diff --git a/crawl-ref/source/mon-abil.cc b/crawl-ref/source/mon-abil.cc
index 061bf58..d1abbf0 100644
--- a/crawl-ref/source/mon-abil.cc
+++ b/crawl-ref/source/mon-abil.cc
@@ -881,7 +881,7 @@ bool slime_creature_mutate(monster* slime)
// -- added equivalency for huldra
static bool _siren_movement_effect(const monster* mons)
{
- bool do_resist = (you.attribute[ATTR_HELD] || you.check_res_magic(70)
+ bool do_resist = (you.attribute[ATTR_HELD] || you.check_res_magic(70) > 0
|| you.cannot_act() || you.asleep());
if (!do_resist)
@@ -2699,7 +2699,7 @@ bool mon_special_ability(monster* mons, bolt & beem)
// Once mesmerised by a particular monster, you cannot resist
// anymore.
if (!already_mesmerised
- && (you.species == SP_MERFOLK || you.check_res_magic(100)))
+ && (you.species == SP_MERFOLK || you.check_res_magic(100) > 0))
{
if (!did_resist)
canned_msg(MSG_YOU_RESIST);
@@ -2791,14 +2791,16 @@ void mon_nearby_ability(monster* mons)
if (foe->atype() == ACT_PLAYER && !can_see)
mpr("You feel you are being watched by something.");
- if (foe->check_res_magic((mons->hit_dice * 5) * confuse_power))
+ int res_margin = foe->check_res_magic((mons->hit_dice * 5) * confuse_power);
+ if (res_margin > 0)
{
if (foe->atype() == ACT_PLAYER)
canned_msg(MSG_YOU_RESIST);
else if (foe->atype() == ACT_MONSTER)
{
const monster* foe_mons = foe->as_monster();
- simple_monster_message(foe_mons, mons_resist_string(foe_mons));
+ simple_monster_message(foe_mons,
+ mons_resist_string(foe_mons, res_margin).c_str());
}
break;
}
diff --git a/crawl-ref/source/mon-cast.cc b/crawl-ref/source/mon-cast.cc
index 43b32b6..0f7ae33 100644
--- a/crawl-ref/source/mon-cast.cc
+++ b/crawl-ref/source/mon-cast.cc
@@ -2791,7 +2791,7 @@ void mons_cast(monster* mons, bolt &pbolt, spell_type spell_cast,
flash_view_delay(DARKGREY, 300);
- if (you.check_res_magic(pow))
+ if (you.check_res_magic(pow) > 0)
canned_msg(MSG_YOU_RESIST);
else
{
@@ -2819,9 +2819,11 @@ void mons_cast(monster* mons, bolt &pbolt, spell_type spell_cast,
}
// Check to see if they can get scared, magic immune already dealt with.
- if (mi->check_res_magic(pow))
+ int res_margin = mi->check_res_magic(pow);
+ if (res_margin > 0)
{
- simple_monster_message(*mi, " resists.");
+ simple_monster_message(*mi,
+ mons_resist_string(*mi, res_margin).c_str());
continue;
}
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index b193084..858fefa 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -1323,17 +1323,28 @@ int mons_damage(int mc, int rt)
return (smc->attack[rt].damage);
}
+std::string resist_margin_phrase(int margin)
+{
+ if (margin <= 0)
+ return(" resists.");
+
+ return((margin >= 40) ? " easily resists." :
+ (margin >= 24) ? " resists." :
+ (margin >= 12) ? " resists with some effort."
+ : " resists with visible struggle.");
+}
+
bool mons_immune_magic(const monster* mon)
{
return (get_monster_data(mon->type)->resist_magic == MAG_IMMUNE);
}
-const char* mons_resist_string(const monster* mon)
+std::string mons_resist_string(const monster* mon, int res_margin)
{
if (mons_immune_magic(mon))
- return "is unaffected";
+ return " is unaffected.";
else
- return "resists";
+ return resist_margin_phrase(res_margin);
}
bool mons_has_lifeforce(const monster* mon)
diff --git a/crawl-ref/source/mon-util.h b/crawl-ref/source/mon-util.h
index 4d476e7..ab548da 100644
--- a/crawl-ref/source/mon-util.h
+++ b/crawl-ref/source/mon-util.h
@@ -208,7 +208,8 @@ int hit_points(int hit_dice, int min_hp, int rand_hp);
int mons_class_hit_dice(int mc);
bool mons_immune_magic(const monster* mon);
-const char* mons_resist_string(const monster* mon);
+std::string mons_resist_string(const monster* mon, int res_margin = 0);
+std::string resist_margin_phrase(int margin);
int mons_damage(int mc, int rt);
mon_attack_def mons_attack_spec(const monster* mon, int attk_number);
diff --git a/crawl-ref/source/spl-damage.cc b/crawl-ref/source/spl-damage.cc
index 77361bb..26a9b3b 100644
--- a/crawl-ref/source/spl-damage.cc
+++ b/crawl-ref/source/spl-damage.cc
@@ -1361,7 +1361,7 @@ static int _disperse_monster(monster* mon, int pow)
simple_monster_message(mon, " resists.");
return (1);
}
- else if (mon->check_res_magic(pow))
+ else if (int res_margin = mon->check_res_magic(pow) > 0)
{
// XXX: Note that this might affect magic-immunes!
if (coinflip())
@@ -1370,7 +1370,9 @@ static int _disperse_monster(monster* mon, int pow)
monster_blink(mon);
}
else
- simple_monster_message(mon, " resists.");
+ simple_monster_message(mon,
+ mons_resist_string(mon, res_margin).c_str());
+
return (1);
}
else
diff --git a/crawl-ref/source/spl-monench.cc b/crawl-ref/source/spl-monench.cc
index e0ce599..da32620 100644
--- a/crawl-ref/source/spl-monench.cc
+++ b/crawl-ref/source/spl-monench.cc
@@ -31,7 +31,7 @@ static int _sleep_monsters(coord_def where, int pow, int, actor *)
if (!mons->can_hibernate(true))
return (0);
- if (mons->check_res_magic(pow))
+ if (mons->check_res_magic(pow) > 0)
return (0);
const int res = mons->res_cold();
@@ -95,7 +95,7 @@ static int _tame_beast_monsters(coord_def where, int pow, int, actor *)
if (you.species == SP_HILL_ORC && mons->type == MONS_WARG)
pow += (pow / 2);
- if (mons->check_res_magic(pow))
+ if (mons->check_res_magic(pow) > 0)
return 0;
simple_monster_message(mons, " is tamed!");
--
1.7.3-rc1
0003-Partially-remove-hepless-messages.patch [^] (4,102 bytes) 2010-10-25 22:32 [Show Content] [Hide Content]From 00958d9f8311842b8010d98fcaae206227e08eb3 Mon Sep 17 00:00:00 2001
From: Arxale <gafrie@gmail.com>
Date: Mon, 25 Oct 2010 23:45:18 +0400
Subject: [PATCH 2/2] Partially remove 'hepless' messages
---
crawl-ref/source/fight.cc | 50 +++++++++++++++++++++++++++++++++++++++-----
1 files changed, 44 insertions(+), 6 deletions(-)
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index 291e105..4797458 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -867,7 +867,29 @@ bool melee_attack::player_attack()
}
if (damage_done > 0 || !defender_visible && !shield_blocked)
+ {
+ // Modifying monster flags to apply "helpless" adjective.
+ uint64_t prev_flags = defender->as_monster()->flags;
+ std::string prev_mname = defender->as_monster()->mname;
+ if (defender->as_monster()->props.exists("HELPLESS")
+ && defender->as_monster()->props["HELPLESS"].get_bool())
+ {
+ defender->as_monster()->flags |= MF_NAME_ADJECTIVE;
+ defender->as_monster()->flags |= MF_NAME_DESCRIPTOR;
+ defender->as_monster()->mname = "helpless";
+ }
+
player_announce_hit();
+
+ // Restoring pre-fight MF_NAME_ADJECTIVE flag status.
+ if (defender->as_monster()->props.exists("HELPLESS")
+ && defender->as_monster()->props["HELPLESS"].get_bool())
+ {
+ defender->as_monster()->props.erase("HELPLESS");
+ defender->as_monster()->flags = prev_flags;
+ defender->as_monster()->mname = prev_mname;
+ }
+ }
else if (!shield_blocked && damage_done <= 0)
{
no_damage_message =
@@ -1212,9 +1234,7 @@ bool melee_attack::player_aux_test_hit()
if (!auto_hit && to_hit >= evasion && !(to_hit >= helpful_evasion)
&& defender_visible)
{
- mprf("Helpless, %s fails to dodge your %s.",
- defender->name(DESC_NOCAP_THE).c_str(),
- aux_attack.c_str());
+ defender->as_monster()->props["HELPLESS"] = true;
}
if (to_hit >= evasion || auto_hit)
@@ -1365,12 +1385,32 @@ bool melee_attack::player_aux_apply(unarmed_attack_type atk)
wpn_skill = SK_UNARMED_COMBAT;
player_exercise_combat_skills();
+ // Modifying monster flags to apply "helpless" adjective.
+ uint64_t prev_flags = defender->as_monster()->flags;
+ std::string prev_mname = defender->as_monster()->mname;
+ if (defender->as_monster()->props.exists("HELPLESS")
+ && defender->as_monster()->props["HELPLESS"].get_bool())
+ {
+ defender->as_monster()->flags |= MF_NAME_ADJECTIVE;
+ defender->as_monster()->flags |= MF_NAME_DESCRIPTOR;
+ defender->as_monster()->mname = "helpless";
+ }
+
mprf("You %s %s%s%s",
aux_verb.c_str(),
defender->name(DESC_NOCAP_THE).c_str(),
debug_damage_number().c_str(),
attack_strength_punctuation().c_str());
+ // Restoring pre-fight MF_NAME_ADJECTIVE flag status.
+ if (defender->as_monster()->props.exists("HELPLESS")
+ && defender->as_monster()->props["HELPLESS"].get_bool())
+ {
+ defender->as_monster()->props.erase("HELPLESS");
+ defender->as_monster()->flags = prev_flags;
+ defender->as_monster()->mname = prev_mname;
+ }
+
if (damage_brand == SPWPN_ACID)
{
mprf("%s is splashed with acid.",
@@ -1547,9 +1587,7 @@ int melee_attack::player_hits_monster()
|| defender->as_monster()->petrifying()
&& !one_chance_in(2 + you.skills[SK_STABBING]))
{
- if (defender_visible)
- msg::stream << "Helpless, " << defender->name(DESC_NOCAP_THE)
- << " fails to dodge your attack." << std::endl;
+ defender->as_monster()->props["HELPLESS"] = true;
return (1);
}
--
1.7.3-rc1
0004-Consistent-messages-for-things-coming-into-view.patch [^] (6,595 bytes) 2010-10-28 14:30 [Show Content] [Hide Content]From d437516aeb431ec9857002836634d801ce610af4 Mon Sep 17 00:00:00 2001
From: Arxale <gafrie@gmail.com>
Date: Thu, 28 Oct 2010 15:08:07 +0400
Subject: [PATCH 3/3] Consistent messages for things coming into view
---
crawl-ref/source/delay.cc | 17 +++++++++++++++--
crawl-ref/source/player.cc | 18 ++++++++++++++++++
crawl-ref/source/stairs.cc | 21 +++++++++++++++++++++
crawl-ref/source/travel.cc | 32 ++++++++++++++++++--------------
crawl-ref/source/travel.h | 2 ++
5 files changed, 74 insertions(+), 16 deletions(-)
diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc
index 07dbcbd..fa3bc58 100644
--- a/crawl-ref/source/delay.cc
+++ b/crawl-ref/source/delay.cc
@@ -1469,7 +1469,10 @@ inline static void _monster_warning(activity_interrupt_type ai,
{
if (ai != AI_SEE_MONSTER)
return;
- if (!delay_is_run(atype) && !_is_butcher_delay(atype))
+ if (!delay_is_run(atype) && !_is_butcher_delay(atype)
+ && !(atype == DELAY_NOT_DELAYED))
+ return;
+ if (at.context != "newly seen" && atype == DELAY_NOT_DELAYED)
return;
const monster* mon = static_cast<const monster* >(at.data);
@@ -1479,7 +1482,8 @@ inline static void _monster_warning(activity_interrupt_type ai,
{
// Only say "comes into view" if the monster wasn't in view
// during the previous turn.
- if (testbits(mon->flags, MF_WAS_IN_VIEW))
+ if (testbits(mon->flags, MF_WAS_IN_VIEW)
+ && !(atype == DELAY_NOT_DELAYED))
{
mprf(MSGCH_WARN, "%s is too close now for your liking.",
mon->name(DESC_CAP_THE).c_str());
@@ -1597,7 +1601,16 @@ bool interrupt_activity(activity_interrupt_type ai,
const int delay = current_delay_action();
if (delay == DELAY_NOT_DELAYED)
+ {
+ // Printing "[foo] comes into view." messages even when not
+ // auto-exploring/travelling.
+ if (ai == AI_SEE_MONSTER)
+ {
+ _monster_warning(ai, at, DELAY_NOT_DELAYED);
+ return(true);
+ }
return (false);
+ }
dprf("Activity interrupt: %s", _activity_interrupt_name(ai));
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index f7d43f3..b45827e 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -375,11 +375,29 @@ void move_player_to_grid(const coord_def& p, bool stepped, bool allow_shift)
ASSERT(!monster_at(p) || monster_at(p)->submerged()
|| fedhas_passthrough(monster_at(p)));
+ // Notifying of new things that comes into view.
+ // Storing current env.map_knowledge to use it as a reference after
+ // LOS is updated.
+ int prev_running_mode = you.running;
+ static FixedArray< map_cell, GXM, GYM > mapshadow;
+ if (!prev_running_mode)
+ {
+ you.running = RMODE_EXPLORE;
+ mapshadow = env.map_knowledge;
+ }
+
// Move the player to new location.
you.moveto(p);
viewwindow();
moveto_location_effects(old_grid, stepped, allow_shift, old_pos);
+
+ // Checking new squares for interesting features.
+ if (!prev_running_mode)
+ {
+ check_for_interesting_features(mapshadow);
+ you.running = prev_running_mode;
+ }
}
bool is_feat_dangerous(dungeon_feature_type grid)
diff --git a/crawl-ref/source/stairs.cc b/crawl-ref/source/stairs.cc
index 9276a23..e6705c5 100644
--- a/crawl-ref/source/stairs.cc
+++ b/crawl-ref/source/stairs.cc
@@ -1322,7 +1322,28 @@ void down_stairs(dungeon_feature_type force_stair,
if (!force_dest)
_update_travel_cache(collect_travel_data, old_level, stair_pos);
+ // Notifying of new things that comes into view.
+ // Storing current env.map_knowledge to use it as a reference after
+ // LOS is updated.
+ int prev_running_mode = you.running;
+ static FixedArray< map_cell, GXM, GYM > mapshadow;
+ if (!prev_running_mode)
+ {
+ you.running = RMODE_EXPLORE;
+ mapshadow = env.map_knowledge;
+ // Preventing obvious finding of stairs at your position.
+ mapshadow(you.pos()).flags |= MAP_SEEN_FLAG;
+ }
+
viewwindow();
+
+ // Checking new squares for interesting features.
+ if (!prev_running_mode)
+ {
+ check_for_interesting_features(mapshadow);
+ you.running = prev_running_mode;
+ }
+
maybe_update_stashes();
request_autopickup();
diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc
index cdc0dfe..f336615 100644
--- a/crawl-ref/source/travel.cc
+++ b/crawl-ref/source/travel.cc
@@ -903,21 +903,8 @@ command_type travel()
if (you.running.is_explore())
{
- // Scan through the shadow map, compare it with the actual map, and if
- // there are any squares of the shadow map that have just been
- // discovered and contain an item, or have an interesting dungeon
- // feature, stop exploring.
- explore_discoveries discoveries;
- for (rectangle_iterator ri(1); ri; ++ri)
- {
- const coord_def p(*ri);
- if (!mapshadow(p).seen() && env.map_knowledge(p).seen())
- _check_interesting_square(p, discoveries);
- }
-
- if (discoveries.prompt_stop())
+ if (check_for_interesting_features(mapshadow))
stop_running();
-
mapshadow = env.map_knowledge;
}
@@ -4365,3 +4352,20 @@ int click_travel(const coord_def &gc, bool force)
return _adjacent_cmd(dest, force);
}
+
+bool check_for_interesting_features(FixedArray< map_cell, GXM, GYM > &mapsh)
+{
+ // Scan through the shadow map, compare it with the actual map, and if
+ // there are any squares of the shadow map that have just been
+ // discovered and contain an item, or have an interesting dungeon
+ // feature, stop exploring.
+ explore_discoveries discoveries;
+ for (rectangle_iterator ri(1); ri; ++ri)
+ {
+ const coord_def p(*ri);
+ if (!mapsh(p).seen() && env.map_knowledge(p).seen())
+ _check_interesting_square(p, discoveries);
+ }
+
+ return(discoveries.prompt_stop());
+}
diff --git a/crawl-ref/source/travel.h b/crawl-ref/source/travel.h
index 1025218..fea20a9 100644
--- a/crawl-ref/source/travel.h
+++ b/crawl-ref/source/travel.h
@@ -600,4 +600,6 @@ void do_interlevel_travel();
// If force is true, then the player will attack empty squares/open doors.
int click_travel(const coord_def &gc, bool force);
+bool check_for_interesting_features(FixedArray< map_cell, GXM, GYM > &mapsh);
+
#endif // TRAVEL_H
--
1.7.3-rc1
0001-Colours-for-output-of-Ctrl-F.patch [^] (1,063 bytes) 2010-10-31 19:50 [Show Content] [Hide Content]From 1182611dfbd3bae163114827d6ddf06cdca3c2af Mon Sep 17 00:00:00 2001
From: Arxale <gafrie@gmail.com>
Date: Thu, 28 Oct 2010 20:16:04 +0400
Subject: [PATCH] Colours for output of Ctrl-F
---
crawl-ref/source/stash.cc | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/crawl-ref/source/stash.cc b/crawl-ref/source/stash.cc
index 0a57c42..7768c07 100644
--- a/crawl-ref/source/stash.cc
+++ b/crawl-ref/source/stash.cc
@@ -1943,6 +1943,16 @@ bool StashTracker::display_search_results(
if (res.shop && !res.shop->is_visited())
me->colour = CYAN;
+ if (res.stash && res.stash->get_items().size() > 0)
+ {
+ item_def first = res.stash->get_items()[0];
+ int itemcol = menu_colour(first.name(DESC_PLAIN).c_str(),
+ menu_colour_item_prefix(first),
+ "pickup");
+ if (itemcol != -1)
+ me->colour = itemcol;
+ }
+
stashmenu.add_entry(me);
}
--
1.7.3-rc1
0001-Corrosion-resistance-reporting.patch [^] (1,982 bytes) 2010-10-31 19:50 [Show Content] [Hide Content]From 2d36b6a15bf51250888acdea60398d4a4e20dc78 Mon Sep 17 00:00:00 2001
From: Arxale <gafrie@gmail.com>
Date: Sun, 31 Oct 2010 17:50:19 +0300
Subject: [PATCH 1/4] Corrosion resistance reporting
---
crawl-ref/source/describe.cc | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index 4edf5a2..3281967 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -1015,6 +1015,13 @@ static std::string _describe_weapon(const item_def &item, bool verbose)
}
description += ".";
}
+
+ if (item.plus2 >= 5)
+ description += "\nIts enchantment level renders it immune to "
+ "acidic corrosion.";
+ else if (item.plus2 >= 4)
+ description += "\nIts enchantment level renders it resistant to "
+ "acidic corrosion.";
}
return (description);
@@ -1221,6 +1228,13 @@ static std::string _describe_ammo(const item_def &item)
description += ".";
}
+ if (item.plus >= 5)
+ description += "\nIts enchantment level renders it immune to "
+ "acidic corrosion.";
+ else if (item.plus >= 4)
+ description += "\nIts enchantment level renders it resistant to "
+ "acidic corrosion.";
+
return (description);
}
@@ -1406,6 +1420,13 @@ static std::string _describe_armour(const item_def &item, bool verbose)
}
else
description += "\nIt is maximally enchanted.";
+
+ if (item.plus >= 5)
+ description += "\nIts enchantment level renders it immune to "
+ "acidic corrosion.";
+ else if (item.plus >= 4)
+ description += "\nIts enchantment level renders it resistant to "
+ "acidic corrosion.";
}
return description;
--
1.7.3-rc1
0002-Inscribe-tried-on-foo.patch [^] (5,889 bytes) 2010-10-31 19:51 [Show Content] [Hide Content]From 77233fe0add7609f8d9dc7e91da0a3a2f149db01 Mon Sep 17 00:00:00 2001
From: Arxale <gafrie@gmail.com>
Date: Sun, 31 Oct 2010 19:50:14 +0300
Subject: [PATCH 2/4] Inscribe 'tried on foo'
---
crawl-ref/source/item_use.cc | 8 ++++++++
crawl-ref/source/itemname.cc | 28 ++++++++++++++++++++++++++++
crawl-ref/source/itemname.h | 2 ++
crawl-ref/source/tag-version.h | 3 ++-
crawl-ref/source/tags.cc | 9 +++++++++
5 files changed, 49 insertions(+), 1 deletions(-)
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 7dacc8c..2228e4e 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -4478,14 +4478,19 @@ static bool _scroll_modify_item(item_def scroll)
identify(-1, item_slot);
return (true);
}
+ else
+ get_type_id_props()["SCR_ID"] = item.name(DESC_PLAIN);
break;
case SCR_RECHARGING:
if (item_is_rechargeable(item, false, true))
{
if (recharge_wand(item_slot, false))
return (true);
+ get_type_id_props()["SCR_RC"] = item.name(DESC_PLAIN);
return (false);
}
+ else
+ get_type_id_props()["SCR_RC"] = item.name(DESC_PLAIN);
break;
case SCR_ENCHANT_ARMOUR:
if (is_enchantable_armour(item, true))
@@ -4494,8 +4499,11 @@ static bool _scroll_modify_item(item_def scroll)
// (If so, already prints the "Nothing happens" message.)
if (_handle_enchant_armour(item_slot))
return (true);
+ get_type_id_props()["SCR_EA"] = item.name(DESC_PLAIN);
return (false);
}
+ else
+ get_type_id_props()["SCR_EA"] = item.name(DESC_PLAIN);
break;
default:
mprf("Buggy scroll %d can't modify item!", scroll.sub_type);
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index 5bb8a3a..ce45b5d 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -45,6 +45,9 @@
id_arr type_ids;
+// Additional information, about tried unidentified items.
+// (e.g. name of item, for scrolls of RC, ID, EA)
+CrawlHashTable type_ids_props;
static bool _is_random_name_space(char let);
static bool _is_random_name_vowel(char let);
@@ -288,7 +291,27 @@ std::string item_def::name(description_level_type descrip,
if (id_type == ID_MON_TRIED_TYPE)
tried_str = "tried by monster";
else if (id_type == ID_TRIED_ITEM_TYPE)
+ {
tried_str = "tried on item";
+ if (base_type == OBJ_SCROLLS)
+ {
+ if (sub_type == SCR_IDENTIFY
+ && type_ids_props.exists("SCR_ID"))
+ {
+ tried_str = "tried on " + type_ids_props["SCR_ID"].get_string();
+ }
+ else if (sub_type == SCR_RECHARGING
+ && type_ids_props.exists("SCR_RC"))
+ {
+ tried_str = "tried on " + type_ids_props["SCR_RC"].get_string();
+ }
+ else if (sub_type == SCR_ENCHANT_ARMOUR
+ && type_ids_props.exists("SCR_EA"))
+ {
+ tried_str = "tried on " + type_ids_props["SCR_EA"].get_string();
+ }
+ }
+ }
else
tried_str = "tried";
}
@@ -2045,6 +2068,11 @@ id_arr& get_typeid_array()
return type_ids;
}
+CrawlHashTable& get_type_id_props()
+{
+ return type_ids_props;
+}
+
void set_ident_type(item_def &item, item_type_id_state_type setting,
bool force)
{
diff --git a/crawl-ref/source/itemname.h b/crawl-ref/source/itemname.h
index 14c0c52..92a3635 100644
--- a/crawl-ref/source/itemname.h
+++ b/crawl-ref/source/itemname.h
@@ -122,6 +122,8 @@ const int NUM_ID_SUBTYPE = 50;
typedef FixedArray<item_type_id_state_type, NUM_IDTYPE, NUM_ID_SUBTYPE> id_arr;
id_arr& get_typeid_array();
+CrawlHashTable& get_type_id_props();
+
item_type_id_state_type get_ident_type(const item_def &item);
item_type_id_state_type get_ident_type(object_class_type basetype,
int subtype);
diff --git a/crawl-ref/source/tag-version.h b/crawl-ref/source/tag-version.h
index 0b05a8d..3270fc0 100644
--- a/crawl-ref/source/tag-version.h
+++ b/crawl-ref/source/tag-version.h
@@ -17,7 +17,8 @@ enum tag_minor_version
TAG_MINOR_GRATE = 7, // Iron grates.
TAG_MINOR_XP_STEALING = 8, // Block kill sniping.
TAG_MINOR_EARTH_ATTUNE = 9, // [G]nomes earth attunement.
- TAG_MINOR_VERSION = 9, // Current version. (Keep equal to max.)
+ TAG_MINOR_ADD_ID_INFO = 10, // Additional identification info
+ TAG_MINOR_VERSION = 10, // Current version. (Keep equal to max.)
};
#endif
diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc
index d1cf522..e9af47e 100644
--- a/crawl-ref/source/tags.cc
+++ b/crawl-ref/source/tags.cc
@@ -1234,6 +1234,9 @@ static void tag_construct_you_items(writer &th)
for (j = 0; j < identy.height(); ++j)
marshallUByte(th, identy[i][j]);
+ // Additional identification info
+ get_type_id_props().write(th);
+
// how many unique items?
marshallByte(th, MAX_UNRANDARTS);
for (j = 0; j < MAX_UNRANDARTS; ++j)
@@ -1876,6 +1879,12 @@ static void tag_read_you_items(reader &th, int minorVersion)
}
}
+ // Additional identification info
+#if TAG_MAJOR_VERSION == 31
+ if (minorVersion >= TAG_MINOR_ADD_ID_INFO)
+#endif
+ get_type_id_props().read(th);
+
// how many unique items?
count = unmarshallByte(th);
ASSERT(count >= 0);
--
1.7.3-rc1
0003-Autoinscribe-randarts-after-death.patch [^] (903 bytes) 2010-10-31 19:51 [Show Content] [Hide Content]From b24526664a8e65d298f0d5401d89066276357945 Mon Sep 17 00:00:00 2001
From: Arxale <gafrie@gmail.com>
Date: Sun, 31 Oct 2010 20:31:35 +0300
Subject: [PATCH 3/4] Autoinscribe randarts after death
---
crawl-ref/source/ouch.cc | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc
index 00f07ff..e17967f 100644
--- a/crawl-ref/source/ouch.cc
+++ b/crawl-ref/source/ouch.cc
@@ -1344,6 +1344,12 @@ void end_game(scorefile_entry &se)
if (you.inv[i].base_type != 0)
set_ident_type(you.inv[i], ID_KNOWN_TYPE);
+ if (Options.autoinscribe_artefacts && is_artefact(you.inv[i]))
+ {
+ std::string inscr = artefact_auto_inscription(you.inv[i]);
+ if (inscr != "")
+ add_autoinscription(you.inv[i], inscr);
+ }
}
delete_files();
--
1.7.3-rc1
0004-Colouring-labyrinth-messages.patch [^] (931 bytes) 2010-10-31 19:51 [Show Content] [Hide Content]From 25cb3fe07702b4cd32a4866c01eac700ea526c96 Mon Sep 17 00:00:00 2001
From: Arxale <gafrie@gmail.com>
Date: Sun, 31 Oct 2010 21:17:02 +0300
Subject: [PATCH 4/4] Colouring labyrinth messages
---
crawl-ref/settings/messages.txt | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/crawl-ref/settings/messages.txt b/crawl-ref/settings/messages.txt
index 728dfcd..0fac881 100644
--- a/crawl-ref/settings/messages.txt
+++ b/crawl-ref/settings/messages.txt
@@ -24,7 +24,12 @@ msc = $item_dmg:covered with spores
# Less urgent, but still significant messages
#
msc = $warning:ticking.*clock
+msc = $warning:dying ticks
msc = $warning:distant snort
+msc = $warning:odd grinding sound
+msc = $warning:creaking of ancient gears
+msc = $warning:floor suddenly vibrates
+msc = $warning:a sudden draft
msc = $warning:coins.*counted
msc = $warning:tolling.*bell
msc = lightcyan:LOW MAGIC WARNING
--
1.7.3-rc1
0005-Show-detailed-costs-of-abilities.patch [^] (4,495 bytes) 2010-11-02 23:19 [Show Content] [Hide Content]From bbe6ce3017a9c1b65102f1fa7272e93dc77620aa Mon Sep 17 00:00:00 2001
From: Arxale <gafrie@gmail.com>
Date: Tue, 2 Nov 2010 20:42:33 +0300
Subject: [PATCH 5/6] Show detailed costs of abilities
---
crawl-ref/source/abl-show.cc | 101 +++++++++++++++++++++++++++++++++++++++++-
1 files changed, 100 insertions(+), 1 deletions(-)
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc
index 15ee86b..d5ce44b 100644
--- a/crawl-ref/source/abl-show.cc
+++ b/crawl-ref/source/abl-show.cc
@@ -86,6 +86,7 @@ static bool _activate_talent(const talent& tal);
static bool _do_ability(const ability_def& abil);
static void _pay_ability_costs(const ability_def& abil);
static std::string _describe_talent(const talent& tal);
+static int _scale_piety_cost(ability_type abil, int original_cost);
// this all needs to be split into data/util/show files
// and the struct mechanism here needs to be rewritten (again)
@@ -519,6 +520,103 @@ const std::string make_cost_description(ability_type ability)
return (ret.str());
}
+std::string _get_food_amount_str(int value)
+{
+ return(value > 300 ? "extremely large" :
+ value > 200 ? "large" :
+ value > 100 ? "moderate" :
+ "small");
+}
+
+std::string _get_piety_amount_str(int value)
+{
+ return(value > 15 ? "extremely large" :
+ value > 10 ? "large" :
+ value > 5 ? "moderate" :
+ "small");
+}
+
+const std::string make_detailed_cost_description(ability_type ability)
+{
+ const ability_def& abil = _get_ability_def(ability);
+ std::ostringstream ret;
+ std::vector<std::string> values;
+ std::string str;
+
+ ret << "This ability costs ";
+
+ if (abil.mp_cost > 0)
+ {
+ std::ostringstream ret_values;
+ ret_values << abil.mp_cost;
+ if (abil.flags & ABFLAG_PERMANENT_MP)
+ ret_values << " permanent";
+ ret_values << " MP";
+ values.push_back(ret_values.str());
+ }
+ if (abil.hp_cost)
+ {
+ std::ostringstream ret_values;
+ ret_values << abil.hp_cost.cost(you.hp_max);
+ if (abil.flags & ABFLAG_PERMANENT_HP)
+ ret_values << " permanent";
+ ret_values << " HP";
+ values.push_back(ret_values.str());
+ }
+
+ if (abil.food_cost && you.is_undead != US_UNDEAD
+ && (you.is_undead != US_SEMI_UNDEAD || you.hunger_state > HS_STARVING))
+ {
+ std::ostringstream ret_values;
+ ret_values << article_a(_get_food_amount_str(abil.food_cost
+ + abil.food_cost / 2));
+ ret_values << " amount of nutrition";
+ values.push_back(ret_values.str());
+ }
+
+ if (abil.piety_cost)
+ {
+ std::ostringstream ret_values;
+ int avgcost = abil.piety_cost.base + abil.piety_cost.add / 2;
+ ret_values << article_a(_get_piety_amount_str(avgcost));
+ ret_values << " amount of piety";
+ values.push_back(ret_values.str());
+ }
+
+ if (values.size() == 0)
+ values.push_back("nothing");
+ ret << comma_separated_line(values.begin(), values.end()) << ".\n";
+
+ if (abil.flags & ABFLAG_BREATH)
+ ret << "It is a breathing attack.\n";
+
+ if (abil.flags & ABFLAG_DELAY)
+ ret << "Ability has its own delay.\n";
+
+ if (abil.flags & ABFLAG_PAIN)
+ ret << "Using this ability will hurt you.\n";
+
+ if (abil.flags & ABFLAG_PIETY)
+ ret << "Ability has its own piety cost.\n";
+
+ if (abil.flags & ABFLAG_EXHAUSTION)
+ ret << "It cannot be used when exhausted.\n";
+
+ if (abil.flags & ABFLAG_INSTANT)
+ ret << "Ability doesn't take time to use.\n";
+
+ if (abil.flags & ABFLAG_CONF_OK)
+ ret << "You can use it even if confused.\n";
+
+ if (abil.flags & ABFLAG_FRUIT)
+ ret << "Ability requires fruit.\n";
+
+ if (abil.flags & ABFLAG_VARIABLE_FRUIT)
+ ret << "Ability requires either fruit or piety.\n";
+
+ return (ret.str());
+}
+
static ability_type _fixup_ability(ability_type ability)
{
switch (ability)
@@ -908,7 +1006,8 @@ static void _print_talent_description(const talent& tal)
else
{
std::ostringstream data;
- data << name << "\n\n" << lookup;
+ data << name << "\n\n" << lookup << "\n";
+ data << make_detailed_cost_description(tal.which);
print_description(data.str());
}
wait_for_keypress();
--
1.7.3-rc1
0006-Colouring-partial-rMut-and-rCorr-yellow.patch [^] (3,870 bytes) 2010-11-02 23:20 [Show Content] [Hide Content]From df38b3aff8a2ed4d699e78241cd3a6763b93ff29 Mon Sep 17 00:00:00 2001
From: Arxale <gafrie@gmail.com>
Date: Tue, 2 Nov 2010 22:24:42 +0300
Subject: [PATCH 6/6] Colouring partial rMut and rCorr yellow
---
crawl-ref/source/output.cc | 15 ++++++++++++---
crawl-ref/source/player.cc | 14 ++++++++++++++
crawl-ref/source/player.h | 1 +
3 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index 885fb87..a0fa184 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -1183,6 +1183,8 @@ static const char* _determine_colour_string(int level, int max_level)
{
switch (level)
{
+ case 100:
+ return "<yellow>";
case 3:
case 2:
if (max_level > 1)
@@ -1587,7 +1589,8 @@ static std::vector<formatted_string> _get_overview_resistances(
const int rsust = player_sust_abil(calc_unid);
const int rmuta = (wearing_amulet(AMU_RESIST_MUTATION, calc_unid)
|| player_mutation_level(MUT_MUTATION_RESISTANCE) == 3
- || you.religion == GOD_ZIN && you.piety >= 150);
+ || you.religion == GOD_ZIN && you.piety >= 180) ? 1 :
+ (you.religion == GOD_ZIN && you.piety >= 150) ? 100 : 0;
const int rrott = (you.res_rotting()
|| you.religion == GOD_ZIN && you.piety >= 150);
@@ -1635,7 +1638,13 @@ static std::vector<formatted_string> _get_overview_resistances(
const int rinvi = you.can_see_invisible(calc_unid);
const int rward = wearing_amulet(AMU_WARDING, calc_unid);
const int rcons = player_item_conserve(calc_unid);
- const int rcorr = player_res_acid(calc_unid);
+ // player_res_acid can return values higher than 3, and in that case
+ // _determine_colour_string will color it grey.
+ int racid = (player_res_acid(calc_unid) > 0);
+ const int rcorr = player_res_corrosion(calc_unid);
+ if (racid && !rcorr)
+ racid = 100;
+
const int rclar = player_mental_clarity(calc_unid);
snprintf(buf, sizeof buf,
"%sSee Invis. : %s\n"
@@ -1647,7 +1656,7 @@ static std::vector<formatted_string> _get_overview_resistances(
_determine_colour_string(rinvi, 1), _itosym1(rinvi),
_determine_colour_string(rward, 1), _itosym1(rward),
_determine_colour_string(rcons, 1), _itosym1(rcons),
- _determine_colour_string(rcorr, 1), _itosym1(rcorr),
+ _determine_colour_string(racid, 1), _itosym1(racid),
_determine_colour_string(rclar, 1), _itosym1(rclar));
cols.add_formatted(1, buf, false);
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index b84fd6e..0fc0763 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -1522,6 +1522,20 @@ int player_res_acid(bool calc_unid, bool items)
return (res);
}
+bool player_res_corrosion(bool calc_unid)
+{
+ int res = 0;
+ // items
+ if (wearing_amulet(AMU_RESIST_CORROSION, calc_unid))
+ res++;
+
+ // mutations:
+ if (player_mutation_level(MUT_YELLOW_SCALES) == 3)
+ res++;
+
+ return (res > 0);
+}
+
// Returns a factor X such that post-resistance acid damage can be calculated
// as pre_resist_damage * X / 100.
int player_acid_resist_factor()
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index c679cda..aaa501a 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -730,6 +730,7 @@ int player_res_cold(bool calc_unid = true, bool temp = true,
bool items = true);
int player_res_acid(bool calc_unid = true, bool items = true);
int player_acid_resist_factor();
+bool player_res_corrosion(bool calc_unid = true);
int player_res_torment(bool calc_unid = true, bool temp = true);
--
1.7.3-rc1
0007-Cloak-of-preservation-counts-once-as-rA.patch [^] (751 bytes) 2010-11-02 23:20 [Show Content] [Hide Content]From 153795f23e28a39e72606b64a1bfafcedd337194 Mon Sep 17 00:00:00 2001
From: Arxale <gafrie@gmail.com>
Date: Tue, 2 Nov 2010 22:31:30 +0300
Subject: [PATCH 7/7] Cloak of preservation counts once as rA
---
crawl-ref/source/player.cc | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 0fc0763..ecfa3d1 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -1510,9 +1510,6 @@ int player_res_acid(bool calc_unid, bool items)
{
if (wearing_amulet(AMU_RESIST_CORROSION, calc_unid))
res++;
-
- if (player_equip_ego_type(EQ_CLOAK, SPARM_PRESERVATION))
- res++;
}
// mutations:
--
1.7.3-rc1
0001-More-detailed-corrosion-resistance-reporting.patch [^] (4,833 bytes) 2010-11-12 19:57 [Show Content] [Hide Content]From d713db73c049b2d9f2ad5401a02341c07ce4c58d Mon Sep 17 00:00:00 2001
From: Arxale <gafrie@gmail.com>
Date: Fri, 12 Nov 2010 21:22:25 +0300
Subject: [PATCH] More detailed corrosion resistance reporting
---
crawl-ref/source/dat/descript/items.txt | 2 +-
crawl-ref/source/describe.cc | 49 +++++++++++++++++++++++++++---
2 files changed, 45 insertions(+), 6 deletions(-)
diff --git a/crawl-ref/source/dat/descript/items.txt b/crawl-ref/source/dat/descript/items.txt
index 5539a13..b2169c6 100644
--- a/crawl-ref/source/dat/descript/items.txt
+++ b/crawl-ref/source/dat/descript/items.txt
@@ -399,7 +399,7 @@ A magical device which allows one to see the layout of one's surroundings. It re
%%%%
crystal plate mail
-An incredibly heavy but extremely effective suit of crystalline armour. It is somewhat resistant to corrosion.
+An incredibly heavy but extremely effective suit of crystalline armour. It is very resistant to corrosion.
%%%%
dagger
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index 8ca9815..ac19e46 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -977,9 +977,9 @@ static std::string _describe_weapon(const item_def &item, bool verbose)
iflags_t race = get_equip_race(item);
if (race == ISFLAG_DWARVEN)
- description += "\nIt is well-crafted, durable, and resistant "
- "to corrosion. Dwarves deal slightly more "
- "damage with it.";
+ description += "\nIt is well-crafted, durable, and very "
+ "resistant to corrosion. Dwarves deal slightly "
+ "more damage with it.";
if (race == ISFLAG_ORCISH)
description += "\nOrcs deal slightly more damage with it.";
@@ -1017,6 +1017,19 @@ static std::string _describe_weapon(const item_def &item, bool verbose)
}
}
+ if (item.plus2 >= 5)
+ description += "\nIts enchantment level renders it immune to "
+ "acidic corrosion.";
+ else if (item.plus2 >= 4)
+ description += "\nIts enchantment level renders it extremely "
+ "resistant to acidic corrosion.";
+ else if (item.plus2 >= 3)
+ description += "\nIts enchantment level renders it "
+ "resistant to acidic corrosion.";
+ else if (item.plus2 >= 2)
+ description += "\nIts enchantment level renders it somewhat "
+ "resistant to acidic corrosion.";
+
return (description);
}
@@ -1221,6 +1234,19 @@ static std::string _describe_ammo(const item_def &item)
description += ".";
}
+ if (item.plus >= 5)
+ description += "\nIts enchantment level renders it immune to "
+ "acidic corrosion.";
+ else if (item.plus >= 4)
+ description += "\nIts enchantment level renders it extremely "
+ "resistant to acidic corrosion.";
+ else if (item.plus >= 3)
+ description += "\nIts enchantment level renders it "
+ "resistant to acidic corrosion.";
+ else if (item.plus >= 2)
+ description += "\nIts enchantment level renders it somewhat "
+ "resistant to acidic corrosion.";
+
return (description);
}
@@ -1373,8 +1399,8 @@ static std::string _describe_armour(const item_def &item, bool verbose)
iflags_t race = get_equip_race(item);
if (race == ISFLAG_DWARVEN)
- description += "\nIt is well-crafted, durable, and resistant to "
- "corrosion.";
+ description += "\nIt is well-crafted, durable, and very resistant "
+ "to corrosion.";
else if (race == ISFLAG_ELVEN)
{
description += "\nIt is well-crafted and unobstructive";
@@ -1408,6 +1434,19 @@ static std::string _describe_armour(const item_def &item, bool verbose)
description += "\nIt is maximally enchanted.";
}
+ if (item.plus >= 5)
+ description += "\nIts enchantment level renders it immune to "
+ "acidic corrosion.";
+ else if (item.plus >= 4)
+ description += "\nIts enchantment level renders it extremely "
+ "resistant to acidic corrosion.";
+ else if (item.plus >= 3)
+ description += "\nIts enchantment level renders it "
+ "resistant to acidic corrosion.";
+ else if (item.plus >= 2)
+ description += "\nIts enchantment level renders it somewhat "
+ "resistant to acidic corrosion.";
+
return description;
}
--
1.7.3-rc1
0002-Show-detailed-costs-of-abilities-2.patch [^] (3,920 bytes) 2010-11-12 19:57 [Show Content] [Hide Content]From 39d83fabd67efec41aca369505095c3e1de6d581 Mon Sep 17 00:00:00 2001
From: Arxale <gafrie@gmail.com>
Date: Fri, 12 Nov 2010 21:47:00 +0300
Subject: [PATCH 2/2] Show detailed costs of abilities 2
---
crawl-ref/source/abl-show.cc | 90 +++++++++++++++++++++++++++++++++++++++++-
1 files changed, 89 insertions(+), 1 deletions(-)
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc
index 15ee86b..638eb3f 100644
--- a/crawl-ref/source/abl-show.cc
+++ b/crawl-ref/source/abl-show.cc
@@ -86,6 +86,7 @@ static bool _activate_talent(const talent& tal);
static bool _do_ability(const ability_def& abil);
static void _pay_ability_costs(const ability_def& abil);
static std::string _describe_talent(const talent& tal);
+static int _scale_piety_cost(ability_type abil, int original_cost);
// this all needs to be split into data/util/show files
// and the struct mechanism here needs to be rewritten (again)
@@ -519,6 +520,92 @@ const std::string make_cost_description(ability_type ability)
return (ret.str());
}
+std::string _get_food_amount_str(int value)
+{
+ return(value > 300 ? "extremely large" :
+ value > 200 ? "large" :
+ value > 100 ? "moderate" :
+ "small");
+}
+
+std::string _get_piety_amount_str(int value)
+{
+ return(value > 15 ? "extremely large" :
+ value > 10 ? "large" :
+ value > 5 ? "moderate" :
+ "small");
+}
+
+const std::string make_detailed_cost_description(ability_type ability)
+{
+ const ability_def& abil = _get_ability_def(ability);
+ std::ostringstream ret;
+ std::vector<std::string> values;
+ std::string str;
+
+ bool have_cost = false;
+ ret << "This ability costs: ";
+
+ if (abil.mp_cost > 0)
+ {
+ have_cost = true;
+ ret << "\nMP : ";
+ ret << abil.mp_cost;
+ if (abil.flags & ABFLAG_PERMANENT_MP)
+ ret << " (permanent)";
+ }
+ if (abil.hp_cost)
+ {
+ have_cost = true;
+ ret << "\nHP : ";
+ ret << abil.hp_cost.cost(you.hp_max);
+ if (abil.flags & ABFLAG_PERMANENT_HP)
+ ret << " (permanent)";
+ }
+
+ if (abil.food_cost && you.is_undead != US_UNDEAD
+ && (you.is_undead != US_SEMI_UNDEAD || you.hunger_state > HS_STARVING))
+ {
+ have_cost = true;
+ ret << "\nHunger : ";
+ ret << _get_food_amount_str(abil.food_cost + abil.food_cost / 2);
+ }
+
+ if (abil.piety_cost)
+ {
+ have_cost = true;
+ ret << "\nPiety : ";
+ int avgcost = abil.piety_cost.base + abil.piety_cost.add / 2;
+ ret << _get_piety_amount_str(avgcost);
+ }
+
+ if (!have_cost)
+ ret << "nothing.";
+
+ if (abil.flags & ABFLAG_BREATH)
+ ret << "\nIt is a breathing attack and needs some time between uses.";
+
+ if (abil.flags & ABFLAG_DELAY)
+ ret << "\nIt takes some time before being effective.";
+
+ if (abil.flags & ABFLAG_PAIN)
+ ret << "\nUsing this ability will hurt you.";
+
+ if (abil.flags & ABFLAG_PIETY)
+ ret << "\nIt will drain your piety while it is active.";
+
+ if (abil.flags & ABFLAG_EXHAUSTION)
+ ret << "\nIt cannot be used when exhausted.";
+
+ if (abil.flags & ABFLAG_INSTANT)
+ ret << "\nIt is instantaneous.";
+
+ if (abil.flags & ABFLAG_CONF_OK)
+ ret << "\nYou can use it even if confused.";
+
+ return (ret.str());
+}
+
static ability_type _fixup_ability(ability_type ability)
{
switch (ability)
@@ -908,7 +995,8 @@ static void _print_talent_description(const talent& tal)
else
{
std::ostringstream data;
- data << name << "\n\n" << lookup;
+ data << name << "\n\n" << lookup << "\n";
+ data << make_detailed_cost_description(tal.which);
print_description(data.str());
}
wait_for_keypress();
--
1.7.3-rc1
0004-Add-rAcid-to-resistance-screen.patch [^] (4,852 bytes) 2010-11-26 17:38 [Show Content] [Hide Content]From 6ede76482296cdb61e8c01c671afca9813fee28e Mon Sep 17 00:00:00 2001
From: Arxale <gafrie@gmail.com>
Date: Fri, 26 Nov 2010 19:27:36 +0300
Subject: [PATCH 4/4] Add rAcid to resistance screen
---
crawl-ref/source/output.cc | 28 +++++++++++++++++-----------
1 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index ca51d01..9078bec 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -1182,6 +1182,9 @@ int equip_name_to_slot(const char *s)
// Take maximum possible level into account.
static const char* _determine_colour_string(int level, int max_level)
{
+ if (level > 3)
+ level = 3;
+
switch (level)
{
case 3:
@@ -1582,9 +1585,9 @@ static std::vector<formatted_string> _get_overview_resistances(
const int rfire = player_res_fire(calc_unid);
const int rcold = player_res_cold(calc_unid);
const int rlife = player_prot_life(calc_unid);
+ const int racid = player_res_acid(calc_unid);
const int rpois = player_res_poison(calc_unid);
const int relec = player_res_electricity(calc_unid);
- const int rspir = player_spirit_shield(calc_unid);
const int rsust = player_sust_abil(calc_unid);
const int rmuta = (wearing_amulet(AMU_RESIST_MUTATION, calc_unid)
|| player_mutation_level(MUT_MUTATION_RESISTANCE) == 3
@@ -1596,18 +1599,18 @@ static std::vector<formatted_string> _get_overview_resistances(
"%sRes.Fire : %s\n"
"%sRes.Cold : %s\n"
"%sLife Prot.: %s\n"
+ "%sRes.Acid. : %s\n"
"%sRes.Poison: %s\n"
"%sRes.Elec. : %s\n"
- "%sSpirit.Shd: %s\n"
"%sSust.Abil.: %s\n"
"%sRes.Mut. : %s\n"
"%sRes.Rott. : %s\n",
_determine_colour_string(rfire, 3), _itosym3(rfire),
_determine_colour_string(rcold, 3), _itosym3(rcold),
_determine_colour_string(rlife, 3), _itosym3(rlife),
+ _determine_colour_string(racid, 3), _itosym3(racid),
_determine_colour_string(rpois, 1), _itosym1(rpois),
_determine_colour_string(relec, 1), _itosym1(relec),
- _determine_colour_string(rspir, 1), _itosym1(rspir),
_determine_colour_string(rsust, 2), _itosym2(rsust),
_determine_colour_string(rmuta, 1), _itosym1(rmuta),
_determine_colour_string(rrott, 1), _itosym1(rrott));
@@ -1638,41 +1641,44 @@ static std::vector<formatted_string> _get_overview_resistances(
const int rcons = player_item_conserve(calc_unid);
const int rcorr = player_res_acid(calc_unid);
const int rclar = player_mental_clarity(calc_unid);
+ const int rspir = player_spirit_shield(calc_unid);
snprintf(buf, sizeof buf,
"%sSee Invis. : %s\n"
"%sWarding : %s\n"
"%sConserve : %s\n"
"%sRes.Corr. : %s\n"
"%sClarity : %s\n"
+ "%sSpirit.Shd : %s\n"
,
_determine_colour_string(rinvi, 1), _itosym1(rinvi),
_determine_colour_string(rward, 1), _itosym1(rward),
_determine_colour_string(rcons, 1), _itosym1(rcons),
_determine_colour_string(rcorr, 1), _itosym1(rcorr),
- _determine_colour_string(rclar, 1), _itosym1(rclar));
+ _determine_colour_string(rclar, 1), _itosym1(rclar),
+ _determine_colour_string(rspir, 1), _itosym1(rspir));
cols.add_formatted(1, buf, false);
const int stasis = wearing_amulet(AMU_STASIS, calc_unid);
const int notele = scan_artefacts(ARTP_PREVENT_TELEPORTATION, calc_unid);
+ const int rrtel = !!player_teleport(calc_unid);
if (notele && !stasis)
{
snprintf(buf, sizeof buf, "%sPrev.Telep.: %s",
_determine_colour_string(-1, 1), _itosym1(1));
}
else
+ if (rrtel && !stasis)
+ {
+ snprintf(buf, sizeof buf, "%sRnd.Telep. : %s",
+ _determine_colour_string(-1, 1), _itosym1(1));
+ }
+ else
{
snprintf(buf, sizeof buf, "%sStasis : %s",
_determine_colour_string(stasis, 1), _itosym1(stasis));
}
cols.add_formatted(1, buf, false);
- // If you need extra space, rnd tele conflicts with stasis/-TELE;
- // it currently shows separately to avoid the blank.
- const int rrtel = !!player_teleport(calc_unid);
- snprintf(buf, sizeof buf, "%sRnd.Telep. : %s",
- _determine_colour_string(rrtel, 1), _itosym1(rrtel));
- cols.add_formatted(1, buf, false);
-
const int rctel = player_control_teleport(calc_unid);
const int rlevi = you.airborne();
const int rcfli = wearing_amulet(AMU_CONTROLLED_FLIGHT, calc_unid);
--
1.7.3-rc1
|