diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-04 07:23:40 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-04 07:23:40 +0000 |
commit | 4fb433c499f4dd091ca5db56268a729579a420a0 (patch) | |
tree | b13801f662665a14ad98c202d828f8fd70cb573d /crawl-ref/source/religion.cc | |
parent | 02eb6893037ce2da9fd70848e2734032283b793e (diff) | |
download | crawl-ref-4fb433c499f4dd091ca5db56268a729579a420a0.tar.gz crawl-ref-4fb433c499f4dd091ca5db56268a729579a420a0.zip |
Fix zombies of wrong habitat on land. It turns out that all those
careful checks for habitat were ignored (default is HT_LAND) because the
base type for undead wasn't chosen until after the position. I now added
another habitat check during the base type selection loop and now
everything works. :)
Add a warning inscription !D that ignores such items during actions like
sacrificing items, destroying weapons (Ely), burning books (Trog) or
casting sticks to snakes. The failure messages are very clumsy now, but
they do get the point across, I hope.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5472 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/religion.cc')
-rw-r--r-- | crawl-ref/source/religion.cc | 93 |
1 files changed, 58 insertions, 35 deletions
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 6ce4951b70..05511e8693 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -2756,6 +2756,13 @@ bool ely_destroy_weapons() continue; } + if (!check_warning_inscriptions(mitm[i], OPER_DESTROY)) + { + mpr("Won't destroy {!D} inscribed item."); + i = next; + continue; + } + const int value = item_value( mitm[i], true ); #ifdef DEBUG_DIAGNOSTICS mprf(MSGCH_DIAGNOSTICS, "Destroyed weapon value: %d", value); @@ -2775,6 +2782,7 @@ bool ely_destroy_weapons() _print_sacrifice_message(GOD_ELYVILON, mitm[i], pgain); if (is_evil_weapon) { + // Print this is addition to the above! simple_god_message(" welcomes the destruction of this evil weapon.", GOD_ELYVILON); } @@ -2817,41 +2825,48 @@ bool trog_burn_books() for (int xpos = you.x_pos - 8; xpos < you.x_pos + 8; xpos++) for (int ypos = you.y_pos - 8; ypos < you.y_pos + 8; ypos++) { - // checked above - if (xpos == you.x_pos && ypos == you.y_pos) - continue; - - // burn only squares in sight - if (!see_grid(xpos, ypos)) - continue; - - // if a grid is blocked, books lying there will be ignored - // allow bombing of monsters - const int cloud = env.cgrid[xpos][ypos]; - if (grid_is_solid(grd[ xpos ][ ypos ]) || -// mgrd[ xpos ][ ypos ] != NON_MONSTER || - (cloud != EMPTY_CLOUD && env.cloud[cloud].type != CLOUD_FIRE)) - { - continue; - } + // Checked above. + if (xpos == you.x_pos && ypos == you.y_pos) + continue; - int count = 0; - int rarity = 0; - i = igrd[xpos][ypos]; - while (i != NON_ITEM) - { - const int next = mitm[i].link; // in case we can't get it later. + // Burn only squares in sight. + if (!see_grid(xpos, ypos)) + continue; - if (mitm[i].base_type != OBJ_BOOKS - || mitm[i].sub_type == BOOK_MANUAL - || mitm[i].sub_type == BOOK_DESTRUCTION) - { - i = next; - continue; - } + // If a grid is blocked, books lying there will be ignored. + // Allow bombing of monsters. + const int cloud = env.cgrid[xpos][ypos]; + if (grid_is_solid(grd[ xpos ][ ypos ]) + || cloud != EMPTY_CLOUD && env.cloud[cloud].type != CLOUD_FIRE) + { + continue; + } + + int count = 0; + int rarity = 0; + i = igrd[xpos][ypos]; + while (i != NON_ITEM) + { + const int next = mitm[i].link; // in case we can't get it later + + if (mitm[i].base_type != OBJ_BOOKS + || mitm[i].sub_type == BOOK_MANUAL + || mitm[i].sub_type == BOOK_DESTRUCTION) + { + i = next; + continue; + } + + // Ignore {!D} inscribed books. + if (!check_warning_inscriptions(mitm[i], OPER_DESTROY)) + { + mpr("Won't ignite {!D} inscribed book."); + i = next; + continue; + } rarity += book_rarity(mitm[i].sub_type); - // piety increases by 2 for books never picked up, else by 1 + // Piety increases by 2 for books never picked up, else by 1. if (mitm[i].flags & ISFLAG_DROPPED || mitm[i].flags & ISFLAG_THROWN) { @@ -4854,8 +4869,16 @@ void offer_items() continue; } - if ( _is_risky_sacrifice(item) - || item.inscription.find("=p") != std::string::npos) + // Ignore {!D} inscribed items. + if (!check_warning_inscriptions(item, OPER_DESTROY)) + { + mpr("Won't sacrifice {!D} inscribed item."); + i = next; + continue; + } + + if (_is_risky_sacrifice(item) + || item.inscription.find("=p") != std::string::npos) { const std::string msg = "Really sacrifice " + item.name(DESC_NOCAP_A) + "?"; @@ -4884,8 +4907,8 @@ void offer_items() you.attribute[ATTR_CARD_COUNTDOWN]); #endif } - if ((item.base_type == OBJ_CORPSES && - one_chance_in(2+you.piety/50)) + if (item.base_type == OBJ_CORPSES + && one_chance_in(2+you.piety/50) // Nemelex piety gain is fairly fast...at least // when you have low piety. || value/2 >= random2(30 + you.piety/2)) |