summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-10 17:38:27 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-10 17:38:27 +0000
commit1beb0abbfd7972efabd7817a0359b2c57cd91524 (patch)
tree91e514b80aaba65b2317817df1725ada648f1d21 /crawl-ref/source
parente5d9773c543dea310c3152f249a8c67e3d8195e3 (diff)
downloadcrawl-ref-1beb0abbfd7972efabd7817a0359b2c57cd91524.tar.gz
crawl-ref-1beb0abbfd7972efabd7817a0359b2c57cd91524.zip
Some more Stealth changes.
(1) Use diminishing returns for passive training depending on skill level. Below skill level 2, chances are unchanged; at level 2 chances are 2/3 of that, and at level 3 at 1/3. From level 4 onwards, Stealth cannot be trained by waiting anymore. (2) Active stealth training only has a 1% chance (instead of 5%) if you're sneaking around monsters while invisible (and the monster cannot see you). Add yet another function for blood potions - I sure hope this works when I eventually get around to actually use them. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4178 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/effects.cc10
-rw-r--r--crawl-ref/source/misc.cc36
-rw-r--r--crawl-ref/source/view.cc28
3 files changed, 55 insertions, 19 deletions
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index 9b08452a0d..31f93b6854 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -594,8 +594,10 @@ void direct_effect(struct bolt &pbolt)
// apply damage and handle death, where appropriate {dlb}
if (damage_taken > 0)
- ouch(damage_taken, pbolt.beam_source, KILLED_BY_BEAM,
+ {
+ ouch(damage_taken, pbolt.beam_source, KILLED_BY_BEAM,
pbolt.aux_source.c_str());
+ }
return;
} // end direct_effect()
@@ -1455,9 +1457,10 @@ bool acquirement(object_class_type class_wanted, int agent,
{
// how sad (and stupid)
if (!silenced(you.pos()) && !quiet)
+ {
mprf(MSGCH_SOUND,
grid_item_destruction_message(grd[you.x_pos][you.y_pos]));
-
+ }
item_was_destroyed(mitm[igrd[you.x_pos][you.y_pos]], NON_MONSTER);
*item_index = NON_ITEM;
}
@@ -2649,7 +2652,8 @@ void handle_time( long time_delta )
return;
}
- if (one_chance_in(18))
+ // diminishing returns for Stealth training by waiting
+ if (you.skills[SK_STEALTH] <= 2 + random2(3) && one_chance_in(18))
exercise(SK_STEALTH, 1);
}
}
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index f5b51aec32..bd124f5d9d 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -202,8 +202,8 @@ void maybe_coagulate_blood_floor(item_def &blood)
ASSERT(is_valid_item(blood));
ASSERT(blood.base_type == OBJ_POTIONS);
- ASSERT (blood.sub_type == POT_BLOOD
- || blood.sub_type == POT_BLOOD_COAGULATED);
+ ASSERT(blood.sub_type == POT_BLOOD
+ || blood.sub_type == POT_BLOOD_COAGULATED);
CrawlHashTable &props = blood.props;
ASSERT(props.exists("timer"));
@@ -221,13 +221,13 @@ void maybe_coagulate_blood_floor(item_def &blood)
int coag_count = 0;
std::vector<long> age_timer;
long current;
- int size = timer.size();
+ const int size = timer.size();
for (int i = 0; i < size; i++)
{
current = timer.pop_back();
if (rot_limit >= current)
rot_count++;
- else if (coag_limit >= current)
+ else if (blood.sub_type == POT_BLOOD && coag_limit >= current)
{
coag_count++;
age_timer.push_back(current);
@@ -243,7 +243,7 @@ void maybe_coagulate_blood_floor(item_def &blood)
if (!rot_count && !coag_count)
return; // nothing to be done
- if (!coag_count)
+ if (!coag_count) // some potions rotted away
{
dec_mitm_item_quantity(blood.link, rot_count);
// timer is already up to date
@@ -260,6 +260,7 @@ void maybe_coagulate_blood_floor(item_def &blood)
if (mitm[o].base_type == OBJ_POTIONS
&& mitm[o].sub_type == POT_BLOOD_COAGULATED)
{
+ // merge with existing stack
CrawlHashTable &props2 = mitm[o].props;
ASSERT(props2.exists("timer"));
CrawlVector &timer2 = props2["timer"];
@@ -274,13 +275,35 @@ void maybe_coagulate_blood_floor(item_def &blood)
timer2.push_back(val);
}
_long_sort(timer2);
+ inc_mitm_item_quantity(o, coag_count);
+ ASSERT(timer2.size() == mitm[o].quantity);
dec_mitm_item_quantity(blood.link, rot_count + coag_count);
return;
}
o = mitm[o].link;
}
+ // If we got here nothing was found!
+
+ // entire stack is gone, rotted or coagulated.
+ // -> change potions to coagulated type
+ if (rot_count + coag_count == blood.quantity)
+ {
+ ASSERT(timer.empty());
+ // update subtype
+ blood.sub_type = POT_BLOOD_COAGULATED;
+ item_colour(blood);
+ // re-fill vector
+ long val;
+ while (!age_timer.empty())
+ {
+ val = age_timer[age_timer.size() - 1];
+ age_timer.pop_back();
+ timer.push_back(val);
+ }
+ dec_mitm_item_quantity(blood.link, rot_count);
+ ASSERT(timer.size() == blood.quantity);
+ }
- // if we got here nothing was found
// create a new stack of potions
o = get_item_slot( 100 + random2(200) );
if (o == NON_ITEM)
@@ -314,6 +337,7 @@ void maybe_coagulate_blood_floor(item_def &blood)
move_item_to_grid( &o, blood.x, blood.y );
dec_mitm_item_quantity(blood.link, rot_count + coag_count);
+ ASSERT(timer.size() == blood.quantity);
}
// used for (q)uaff, (f)ire, and Evaporate
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index 50f96070cc..37676e3e81 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -898,7 +898,9 @@ void handle_monster_shouts(monsters* monster, bool force)
{
if (!force
&& (!you.turn_is_over || random2(30) < you.skills[SK_STEALTH]))
+ {
return;
+ }
// Get it once, since monster might be S_RANDOM, in which case
// mons_shouts() will return a different value every time.
@@ -910,7 +912,9 @@ void handle_monster_shouts(monsters* monster, bool force)
|| (type == S_SILENT && !player_monster_visible(monster))
|| (type != S_SILENT && (silenced(you.x_pos, you.y_pos)
|| silenced(monster->x, monster->y))))
+ {
return;
+ }
int noise_level = get_shout_noise_level(type);
std::string default_msg_key;
@@ -1227,14 +1231,14 @@ bool check_awaken(monsters* monster)
// affected by repel undead, they do sense this type of divine aura.
// -- bwr
if (you.duration[DUR_REPEL_UNDEAD] && mons_is_unholy(monster))
- {
return (true);
- }
// I assume that creatures who can sense invisible are very perceptive
mons_perc = 10 + (mons_intel(monster->type) * 4) + monster->hit_dice
+ mons_sense_invis(monster) * 5;
+ bool unnatural_stealthy = false; // "stealthy" only because of invisibility?
+
// critters that are wandering still have MHITYOU as their foe are
// still actively on guard for the player, even if they can't see
// him. Give them a large bonus (handle_behaviour() will nuke 'foe'
@@ -1243,7 +1247,10 @@ bool check_awaken(monsters* monster)
mons_perc += 15;
if (!mons_player_visible(monster))
+ {
mons_perc -= 75;
+ unnatural_stealthy = true;
+ }
if (monster->behaviour == BEH_SLEEP)
{
@@ -1274,20 +1281,21 @@ bool check_awaken(monsters* monster)
return (true); // Oops, the monster wakes up!
// You didn't wake the monster!
- if (player_light_armour(true)
+ if (player_light_armour(true)
&& you.burden_state == BS_UNENCUMBERED
- && you.special_wield != SPWLD_SHADOW
- && one_chance_in(20))
+ && you.special_wield != SPWLD_SHADOW
+ // if invisible, training happens much more rarely
+ && (!unnatural_stealthy && one_chance_in(25) || one_chance_in(100)))
{
exercise(SK_STEALTH, 1);
}
-
+
return (false);
} // end check_awaken()
static void _set_show_backup( int ex, int ey )
{
- // Must avoid double setting it.
+ // Must avoid double setting it.
// We want the base terrain/item, not the cloud or monster that replaced it.
if (!Show_Backup[ex][ey])
Show_Backup[ex][ey] = env.show[ex][ey];
@@ -1452,11 +1460,11 @@ inline static void _update_cloud_grid(int cloudno)
_set_show_backup(ex, ey);
env.show[ex][ey] = DNGN_CLOUD;
- env.show_col[ex][ey] = which_colour;
+ env.show_col[ex][ey] = which_colour;
#ifdef USE_TILE
- tile_place_cloud(ex, ey, env.cloud[cloudno].type,
- env.cloud[cloudno].decay);
+ tile_place_cloud(ex, ey, env.cloud[cloudno].type,
+ env.cloud[cloudno].decay);
#endif
}