diff options
author | Adam Borowski <kilobyte@angband.pl> | 2009-10-22 11:05:44 +0200 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2009-10-22 11:44:33 +0200 |
commit | c15a9271c743a96caeb958e945d9e1a8b69c5ece (patch) | |
tree | ac440f775d2bc2b5f1505c0c55dae6ee394ec130 | |
parent | 052fcd7f52e68aeb93a15a164f02301c8e5436e1 (diff) | |
download | crawl-ref-c15a9271c743a96caeb958e945d9e1a8b69c5ece.tar.gz crawl-ref-c15a9271c743a96caeb958e945d9e1a8b69c5ece.zip |
Yank some god invocations from religion.cc into godabil.cc
-rw-r--r-- | crawl-ref/source/abl-show.cc | 1 | ||||
-rw-r--r-- | crawl-ref/source/acr.cc | 1 | ||||
-rw-r--r-- | crawl-ref/source/describe.cc | 1 | ||||
-rw-r--r-- | crawl-ref/source/godabil.cc | 499 | ||||
-rw-r--r-- | crawl-ref/source/godabil.h | 31 | ||||
-rw-r--r-- | crawl-ref/source/makefile.obj | 1 | ||||
-rw-r--r-- | crawl-ref/source/monstuff.cc | 1 | ||||
-rw-r--r-- | crawl-ref/source/mutation.cc | 1 | ||||
-rw-r--r-- | crawl-ref/source/ouch.cc | 1 | ||||
-rw-r--r-- | crawl-ref/source/output.cc | 1 | ||||
-rw-r--r-- | crawl-ref/source/player.cc | 1 | ||||
-rw-r--r-- | crawl-ref/source/religion.cc | 472 | ||||
-rw-r--r-- | crawl-ref/source/religion.h | 19 | ||||
-rw-r--r-- | crawl-ref/source/spl-cast.cc | 1 | ||||
-rw-r--r-- | crawl-ref/source/spl-util.cc | 1 | ||||
-rw-r--r-- | crawl-ref/source/terrain.cc | 1 | ||||
-rw-r--r-- | crawl-ref/source/view.cc | 1 |
17 files changed, 544 insertions, 490 deletions
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc index c53fab3509..11a07508b9 100644 --- a/crawl-ref/source/abl-show.cc +++ b/crawl-ref/source/abl-show.cc @@ -30,6 +30,7 @@ #include "describe.h" #include "effects.h" #include "food.h" +#include "godabil.h" #include "it_use2.h" #include "itemprop.h" #include "macro.h" diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index 8e46be80e6..91d5d5ba60 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -63,6 +63,7 @@ #include "fight.h" #include "files.h" #include "food.h" +#include "godabil.h" #include "hiscores.h" #include "initfile.h" #include "invent.h" diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc index 26366907cb..93c7428f93 100644 --- a/crawl-ref/source/describe.cc +++ b/crawl-ref/source/describe.cc @@ -29,6 +29,7 @@ #include "fight.h" #include "food.h" #include "ghost.h" +#include "godabil.h" #include "goditem.h" #include "invent.h" #include "itemname.h" diff --git a/crawl-ref/source/godabil.cc b/crawl-ref/source/godabil.cc new file mode 100644 index 0000000000..6d24483f78 --- /dev/null +++ b/crawl-ref/source/godabil.cc @@ -0,0 +1,499 @@ +/* + * File: godabil.cc + * Summary: God-granted abilities. + */ + +#include "AppHdr.h" + +#include "cloud.h" +#include "database.h" +#include "files.h" +#include "godabil.h" +#include "invent.h" +#include "items.h" +#include "kills.h" +#include "message.h" +#include "mon-util.h" +#include "monstuff.h" +#include "mstuff2.h" +#include "mutation.h" +#include "religion.h" +#include "shopping.h" +#include "spells3.h" +#include "spl-book.h" +#include "spl-util.h" +#include "stuff.h" +#include "terrain.h" +#include "view.h" + +bool yred_injury_mirror(bool actual) +{ + return (you.religion == GOD_YREDELEMNUL && !player_under_penance() + && you.piety >= piety_breakpoint(1) + && (!actual || you.duration[DUR_PRAYER])); +} + +bool beogh_water_walk() +{ + return (you.religion == GOD_BEOGH && !player_under_penance() + && you.piety >= piety_breakpoint(4)); +} + +bool jiyva_grant_jelly(bool actual) +{ + return (you.religion == GOD_JIYVA && !player_under_penance() + && you.piety >= piety_breakpoint(2) + && (!actual || you.duration[DUR_PRAYER])); +} + +bool jiyva_remove_bad_mutation() +{ + if (!how_mutated()) + { + mpr("You have no bad mutations to be cured!"); + return (false); + } + + // Ensure that only bad mutations are removed. + if (!delete_mutation(RANDOM_BAD_MUTATION, true, false, true, true)) + { + canned_msg(MSG_NOTHING_HAPPENS); + return (false); + } + + mpr("You feel cleansed."); + return (true); +} + +bool vehumet_supports_spell(spell_type spell) +{ + if (spell_typematch(spell, SPTYP_CONJURATION | SPTYP_SUMMONING)) + return (true); + + if (spell == SPELL_SHATTER + || spell == SPELL_FRAGMENTATION + || spell == SPELL_SANDBLAST) + { + return (true); + } + + return (false); +} + +// Returns false if the invocation fails (no spellbooks in sight, etc.). +bool trog_burn_spellbooks() +{ + if (you.religion != GOD_TROG) + return (false); + + god_acting gdact; + + for (stack_iterator si(you.pos()); si; ++si) + { + if (si->base_type == OBJ_BOOKS + && si->sub_type != BOOK_MANUAL + && si->sub_type != BOOK_DESTRUCTION) + { + mpr("Burning your own feet might not be such a smart idea!"); + return (false); + } + } + + int totalpiety = 0; + + for (radius_iterator ri(you.pos(), LOS_RADIUS, true, true, true); ri; ++ri) + { + // If a grid is blocked, books lying there will be ignored. + // Allow bombing of monsters. + const unsigned short cloud = env.cgrid(*ri); + if (feat_is_solid(grd(*ri)) + || cloud != EMPTY_CLOUD && env.cloud[cloud].type != CLOUD_FIRE) + { + continue; + } + + int count = 0; + int rarity = 0; + for (stack_iterator si(*ri); si; ++si) + { + if (si->base_type != OBJ_BOOKS + || si->sub_type == BOOK_MANUAL + || si->sub_type == BOOK_DESTRUCTION) + { + continue; + } + + // Ignore {!D} inscribed books. + if (!check_warning_inscriptions(*si, OPER_DESTROY)) + { + mpr("Won't ignite {!D} inscribed book."); + continue; + } + + rarity += book_rarity(si->sub_type); + // Piety increases by 2 for books never cracked open, else 1. + // Conversely, rarity influences the duration of the pyre. + if (!item_type_known(*si)) + totalpiety += 2; + else + totalpiety++; + +#ifdef DEBUG_DIAGNOSTICS + mprf(MSGCH_DIAGNOSTICS, "Burned book rarity: %d", rarity); +#endif + destroy_item(si.link()); + count++; + } + + if (count) + { + if (cloud != EMPTY_CLOUD) + { + // Reinforce the cloud. + mpr("The fire roars with new energy!"); + const int extra_dur = count + random2(rarity / 2); + env.cloud[cloud].decay += extra_dur * 5; + env.cloud[cloud].set_whose(KC_YOU); + continue; + } + + const int duration = std::min(4 + count + random2(rarity/2), 23); + place_cloud(CLOUD_FIRE, *ri, duration, KC_YOU); + + mprf(MSGCH_GOD, "The book%s burst%s into flames.", + count == 1 ? "" : "s", + count == 1 ? "s" : ""); + } + } + + if (!totalpiety) + { + mpr("You cannot see a spellbook to ignite!"); + return (false); + } + else + { + simple_god_message(" is delighted!", GOD_TROG); + gain_piety(totalpiety); + } + + return (true); +} + +static bool _is_yred_enslaved_soul(const monsters* mon) +{ + return (mon->alive() && mons_enslaved_soul(mon)); +} + +static bool _yred_enslaved_souls_on_level_disappear() +{ + bool success = false; + + for (int i = 0; i < MAX_MONSTERS; ++i) + { + monsters *monster = &menv[i]; + if (_is_yred_enslaved_soul(monster)) + { +#ifdef DEBUG_DIAGNOSTICS + mprf(MSGCH_DIAGNOSTICS, "Undead soul disappearing: %s on level %d, branch %d", + monster->name(DESC_PLAIN).c_str(), + static_cast<int>(you.your_level), + static_cast<int>(you.where_are_you)); +#endif + + simple_monster_message(monster, " is freed."); + + // The monster disappears. + monster_die(monster, KILL_DISMISSED, NON_MONSTER); + + success = true; + } + } + + return (success); +} + +static bool _yred_souls_disappear() +{ + return (apply_to_all_dungeons(_yred_enslaved_souls_on_level_disappear)); +} + +void yred_make_enslaved_soul(monsters *mon, bool force_hostile, + bool quiet, bool unrestricted) +{ + if (!unrestricted) + _yred_souls_disappear(); + + const int type = mon->type; + monster_type soul_type = mons_species(type); + const std::string whose = + you.can_see(mon) ? apostrophise(mon->name(DESC_CAP_THE)) + : mon->pronoun(PRONOUN_CAP_POSSESSIVE); + const bool twisted = + !unrestricted ? !x_chance_in_y(you.skills[SK_INVOCATIONS] * 20 / 9 + 20, + 100) + : false; + int corps = -1; + + // If the monster's held in a net, get it out. + mons_clear_trapping_net(mon); + + const monsters orig = *mon; + + if (twisted) + { + mon->type = mons_zombie_size(soul_type) == Z_BIG ? + MONS_ABOMINATION_LARGE : MONS_ABOMINATION_SMALL; + mon->base_monster = MONS_PROGRAM_BUG; + } + else + { + // Drop the monster's corpse, so that it can be properly + // re-equipped below. + corps = place_monster_corpse(mon, true, true); + } + + // Drop the monster's equipment. + monster_drop_ething(mon); + + // Recreate the monster as an abomination, or as itself before + // turning it into a spectral thing below. + define_monster(*mon); + + mon->colour = ETC_UNHOLY; + + mon->flags |= MF_CREATED_FRIENDLY; + mon->flags |= MF_ENSLAVED_SOUL; + + if (twisted) + // Mark abominations as undead. + mon->flags |= MF_HONORARY_UNDEAD; + else if (corps != -1) + { + // Turn the monster into a spectral thing, minus the usual + // adjustments for zombified monsters. + mon->type = MONS_SPECTRAL_THING; + mon->base_monster = soul_type; + + // Re-equip the spectral thing. + equip_undead(mon->pos(), corps, monster_index(mon), + mon->base_monster); + + // Destroy the monster's corpse, as it's no longer needed. + destroy_item(corps); + } + + name_zombie(mon, &orig); + + mons_make_god_gift(mon, GOD_YREDELEMNUL); + + mon->attitude = !force_hostile ? ATT_FRIENDLY : ATT_HOSTILE; + behaviour_event(mon, ME_ALERT, !force_hostile ? MHITNOT : MHITYOU); + + if (!quiet) + { + mprf("%s soul %s, and %s.", whose.c_str(), + twisted ? "becomes twisted" : "remains intact", + !force_hostile ? "is now yours" : "fights you"); + } +} + +static void _print_converted_orc_speech(const std::string key, + monsters *mon, + msg_channel_type channel) +{ + std::string msg = getSpeakString("beogh_converted_orc_" + key); + + if (!msg.empty()) + { + msg = do_mon_str_replacements(msg, mon); + mpr(msg.c_str(), channel); + } +} + +// Orcs may turn friendly when encountering followers of Beogh, and be +// made gifts of Beogh. +void beogh_convert_orc(monsters *orc, bool emergency, + bool converted_by_follower) +{ + ASSERT(mons_species(orc->type) == MONS_ORC); + + if (you.can_see(orc)) // show reaction + { + if (emergency || !orc->alive()) + { + if (converted_by_follower) + { + _print_converted_orc_speech("reaction_battle_follower", orc, + MSGCH_FRIEND_ENCHANT); + _print_converted_orc_speech("speech_battle_follower", orc, + MSGCH_TALK); + } + else + { + _print_converted_orc_speech("reaction_battle", orc, + MSGCH_FRIEND_ENCHANT); + _print_converted_orc_speech("speech_battle", orc, MSGCH_TALK); + } + } + else + { + _print_converted_orc_speech("reaction_sight", orc, + MSGCH_FRIEND_ENCHANT); + + if (!one_chance_in(3)) + _print_converted_orc_speech("speech_sight", orc, MSGCH_TALK); + } + } + + orc->attitude = ATT_FRIENDLY; + + // The monster is not really *created* friendly, but should it + // become hostile later on, it won't count as a good kill. + orc->flags |= MF_CREATED_FRIENDLY; + + // Prevent assertion if the orc was previously worshipping a + // different god, rather than already worshipping Beogh or being an + // atheist. + orc->god = GOD_NO_GOD; + + mons_make_god_gift(orc, GOD_BEOGH); + + if (orc->is_patrolling()) + { + // Make orcs stop patrolling and forget their patrol point, + // they're supposed to follow you now. + orc->patrol_point = coord_def(0, 0); + } + + if (!orc->alive()) + orc->hit_points = std::min(random_range(1, 4), orc->max_hit_points); + + // Avoid immobile "followers". + behaviour_event(orc, ME_ALERT, MHITNOT); +} + +void feawn_neutralise_plant(monsters *plant) +{ + if (!plant + || !feawn_neutralises(plant) + || plant->attitude != ATT_HOSTILE + || testbits(plant->flags, MF_ATT_CHANGE_ATTEMPT)) + { + return; + } + + plant->attitude = ATT_GOOD_NEUTRAL; + plant->flags |= MF_WAS_NEUTRAL; +} + +// During prayer feawn allows worshipers to walk on top of stationary plants +// and fungi. +bool feawn_passthrough(const monsters * target) +{ + return (target && you.religion == GOD_FEAWN + && you.duration[DUR_PRAYER] + && mons_is_plant(target) + && mons_is_stationary(target)); +} + +void jiyva_convert_slime(monsters* slime) +{ + ASSERT(mons_is_slime(slime)); + + if (you.can_see(slime)) + { + if (mons_genus(slime->type) == MONS_GIANT_EYEBALL) + { + mprf(MSGCH_GOD, "%s stares at you suspiciously for a moment, " + "then relaxes.", + + slime->name(DESC_CAP_THE).c_str()); + } + else + { + mprf(MSGCH_GOD, "%s trembles before you.", + slime->name(DESC_CAP_THE).c_str()); + } + } + + slime->attitude = ATT_STRICT_NEUTRAL; + slime->flags |= MF_WAS_NEUTRAL; + + if (!mons_eats_items(slime)) + { + slime->add_ench(ENCH_EAT_ITEMS); + + mprf(MSGCH_MONSTER_ENCHANT, "%s looks hungrier.", + slime->name(DESC_CAP_THE).c_str()); + } + + // Prevent assertion if the slime was previously worshipping a + // different god, rather than already worshipping Jiyva or being an + // atheist. + slime->god = GOD_NO_GOD; + + mons_make_god_gift(slime, GOD_JIYVA); +} + +bool ponderousify_armour() +{ + int item_slot = -1; + do + { + if (item_slot == -1) + { + item_slot = prompt_invent_item("Make which item ponderous?", + MT_INVLIST, OSEL_ENCH_ARM, true, true, false); + } + + if (prompt_failed(item_slot)) + return (false); + + item_def& arm(you.inv[item_slot]); + + if (!is_enchantable_armour(arm, true, true) + || get_armour_ego_type(arm) != SPARM_NORMAL) + { + mpr("Choose some type of armour to enchant, or Esc to abort."); + if (Options.auto_list) + more(); + + item_slot = -1; + mpr("You can't enchant that."); //does not appear + continue; + } + + //make item desc runed if desc was vanilla? + + set_item_ego_type(arm, OBJ_ARMOUR, SPARM_PONDEROUSNESS); + + you.redraw_armour_class = true; + you.redraw_evasion = true; + + simple_god_message(" says: Dude, use this wisely!"); + + return (true); + } + while (true); + + return true; +} + +static int _slouch_monsters(coord_def where, int pow, int, actor* agent) +{ + monsters* mon = monster_at(where); + if (mon == NULL) + return (0); + + int dmg = (mon->speed - player_movement_speed()); + dmg = (dmg > 0 ? dmg * dmg : 0); + + mon->hurt(agent, dmg, BEAM_MMISSILE, true); + return (1); +} + +int chronos_slouch(int pow) +{ + return (apply_area_visible(_slouch_monsters, pow)); +} diff --git a/crawl-ref/source/godabil.h b/crawl-ref/source/godabil.h new file mode 100644 index 0000000000..ae23045c54 --- /dev/null +++ b/crawl-ref/source/godabil.h @@ -0,0 +1,31 @@ +/* + * File: godabil.h + * Summary: God-granted abilities. + */ + +#ifndef GODABIL_H +#define GODABILN_H + +#include "enum.h" +#include "externs.h" + +bool ponderousify_armour(); +int chronos_slouch(int); +bool zin_sustenance(bool actual = true); +bool zin_remove_all_mutations(); +bool yred_injury_mirror(bool actual = true); +bool jiyva_grant_jelly(bool actual = true); +bool jiyva_remove_bad_mutation(); +bool beogh_water_walk(); +void yred_make_enslaved_soul(monsters *mon, bool force_hostile = false, + bool quiet = false, bool unrestricted = false); +void beogh_convert_orc(monsters *orc, bool emergency, + bool converted_by_follower = false); +void jiyva_convert_slime(monsters* slime); +void feawn_neutralise_plant(monsters *plant); +bool feawn_passthrough(const monsters * target); + +bool vehumet_supports_spell(spell_type spell); + +bool trog_burn_spellbooks(); +#endif diff --git a/crawl-ref/source/makefile.obj b/crawl-ref/source/makefile.obj index 9c244722f3..070cecb0e4 100644 --- a/crawl-ref/source/makefile.obj +++ b/crawl-ref/source/makefile.obj @@ -29,6 +29,7 @@ files.o \ food.o \ format.o \ ghost.o \ +godabil.o \ goditem.o \ hiscores.o \ initfile.o \ diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 8ec912817a..08eaeb0cef 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -30,6 +30,7 @@ #include "fight.h" #include "files.h" #include "ghost.h" +#include "godabil.h" #include "hiscores.h" #include "it_use2.h" #include "itemname.h" diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc index 934cf96750..45a2661b90 100644 --- a/crawl-ref/source/mutation.cc +++ b/crawl-ref/source/mutation.cc @@ -29,6 +29,7 @@ #include "defines.h" #include "effects.h" #include "format.h" +#include "godabil.h" #include "itemprop.h" #include "macro.h" #include "menu.h" diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc index 349d92c005..2b1eeef209 100644 --- a/crawl-ref/source/ouch.cc +++ b/crawl-ref/source/ouch.cc @@ -39,6 +39,7 @@ #include "effects.h" #include "files.h" #include "fight.h" +#include "godabil.h" #include "hiscores.h" #include "invent.h" #include "itemname.h" diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc index 57429b714c..2d240716c2 100644 --- a/crawl-ref/source/output.cc +++ b/crawl-ref/source/output.cc @@ -24,6 +24,7 @@ #include "directn.h" #include "format.h" #include "fight.h" +#include "godabil.h" #include "initfile.h" #include "itemname.h" #include "itemprop.h" diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index bd46ae0f69..ea9b516513 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -29,6 +29,7 @@ #include "effects.h" #include "fight.h" #include "food.h" +#include "godabil.h" #include "goditem.h" #include "itemname.h" #include "itemprop.h" diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 3e9f4fbe25..86a3e2c54b 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -36,6 +36,7 @@ #include "fight.h" #include "files.h" #include "food.h" +#include "godabil.h" #include "goditem.h" #include "hiscores.h" #include "invent.h" @@ -987,51 +988,12 @@ bool zin_remove_all_mutations() return (true); } -bool yred_injury_mirror(bool actual) -{ - return (you.religion == GOD_YREDELEMNUL && !player_under_penance() - && you.piety >= piety_breakpoint(1) - && (!actual || you.duration[DUR_PRAYER])); -} - -bool beogh_water_walk() -{ - return (you.religion == GOD_BEOGH && !player_under_penance() - && you.piety >= piety_breakpoint(4)); -} - static bool _need_water_walking() { return (!player_is_airborne() && you.species != SP_MERFOLK && grd(you.pos()) == DNGN_DEEP_WATER); } -bool jiyva_grant_jelly(bool actual) -{ - return (you.religion == GOD_JIYVA && !player_under_penance() - && you.piety >= piety_breakpoint(2) - && (!actual || you.duration[DUR_PRAYER])); -} - -bool jiyva_remove_bad_mutation() -{ - if (!how_mutated()) - { - mpr("You have no bad mutations to be cured!"); - return (false); - } - - // Ensure that only bad mutations are removed. - if (!delete_mutation(RANDOM_BAD_MUTATION, true, false, true, true)) - { - canned_msg(MSG_NOTHING_HAPPENS); - return (false); - } - - mpr("You feel cleansed."); - return (true); -} - bool jiyva_is_dead() { return (you.royal_jelly_dead @@ -1468,11 +1430,6 @@ static bool _is_yred_enslaved_body_and_soul(const monsters* mon) return (mon->alive() && mons_enslaved_body_and_soul(mon)); } -static bool _is_yred_enslaved_soul(const monsters* mon) -{ - return (mon->alive() && mons_enslaved_soul(mon)); -} - bool is_undead_slave(const monsters* mon) { return (mon->alive() && mons_holiness(mon) == MH_UNDEAD @@ -3887,21 +3844,6 @@ static bool _destroyed_valuable_weapon(int value, int type) return (false); } -bool vehumet_supports_spell(spell_type spell) -{ - if (spell_typematch(spell, SPTYP_CONJURATION | SPTYP_SUMMONING)) - return (true); - - if (spell == SPELL_SHATTER - || spell == SPELL_FRAGMENTATION - || spell == SPELL_SANDBLAST) - { - return (true); - } - - return (false); -} - bool ely_destroy_weapons() { if (you.religion != GOD_ELYVILON) @@ -3978,106 +3920,6 @@ bool ely_destroy_weapons() return (success); } -// Returns false if the invocation fails (no spellbooks in sight, etc.). -bool trog_burn_spellbooks() -{ - if (you.religion != GOD_TROG) - return (false); - - god_acting gdact; - - for (stack_iterator si(you.pos()); si; ++si) - { - if (si->base_type == OBJ_BOOKS - && si->sub_type != BOOK_MANUAL - && si->sub_type != BOOK_DESTRUCTION) - { - mpr("Burning your own feet might not be such a smart idea!"); - return (false); - } - } - - int totalpiety = 0; - - for (radius_iterator ri(you.pos(), LOS_RADIUS, true, true, true); ri; ++ri) - { - // If a grid is blocked, books lying there will be ignored. - // Allow bombing of monsters. - const unsigned short cloud = env.cgrid(*ri); - if (feat_is_solid(grd(*ri)) - || cloud != EMPTY_CLOUD && env.cloud[cloud].type != CLOUD_FIRE) - { - continue; - } - - int count = 0; - int rarity = 0; - for (stack_iterator si(*ri); si; ++si) - { - if (si->base_type != OBJ_BOOKS - || si->sub_type == BOOK_MANUAL - || si->sub_type == BOOK_DESTRUCTION) - { - continue; - } - - // Ignore {!D} inscribed books. - if (!check_warning_inscriptions(*si, OPER_DESTROY)) - { - mpr("Won't ignite {!D} inscribed book."); - continue; - } - - rarity += book_rarity(si->sub_type); - // Piety increases by 2 for books never cracked open, else 1. - // Conversely, rarity influences the duration of the pyre. - if (!item_type_known(*si)) - totalpiety += 2; - else - totalpiety++; - -#ifdef DEBUG_DIAGNOSTICS - mprf(MSGCH_DIAGNOSTICS, "Burned book rarity: %d", rarity); -#endif - destroy_item(si.link()); - count++; - } - - if (count) - { - if (cloud != EMPTY_CLOUD) - { - // Reinforce the cloud. - mpr("The fire roars with new energy!"); - const int extra_dur = count + random2(rarity / 2); - env.cloud[cloud].decay += extra_dur * 5; - env.cloud[cloud].set_whose(KC_YOU); - continue; - } - - const int duration = std::min(4 + count + random2(rarity/2), 23); - place_cloud(CLOUD_FIRE, *ri, duration, KC_YOU); - - mprf(MSGCH_GOD, "The book%s burst%s into flames.", - count == 1 ? "" : "s", - count == 1 ? "s" : ""); - } - } - - if (!totalpiety) - { - mpr("You cannot see a spellbook to ignite!"); - return (false); - } - else - { - simple_god_message(" is delighted!", GOD_TROG); - gain_piety(totalpiety); - } - - return (true); -} - void lose_piety(int pgn) { if (pgn <= 0) @@ -5573,34 +5415,6 @@ static bool _make_god_gifts_hostile(bool level_only) return (apply_to_all_dungeons(_god_gifts_hostile_wrapper) || success); } -static bool _yred_enslaved_souls_on_level_disappear() -{ - bool success = false; - - for (int i = 0; i < MAX_MONSTERS; ++i) - { - monsters *monster = &menv[i]; - if (_is_yred_enslaved_soul(monster)) - { -#ifdef DEBUG_DIAGNOSTICS - mprf(MSGCH_DIAGNOSTICS, "Undead soul disappearing: %s on level %d, branch %d", - monster->name(DESC_PLAIN).c_str(), - static_cast<int>(you.your_level), - static_cast<int>(you.where_are_you)); -#endif - - simple_monster_message(monster, " is freed."); - - // The monster disappears. - monster_die(monster, KILL_DISMISSED, NON_MONSTER); - - success = true; - } - } - - return (success); -} - static bool _yred_slaves_on_level_abandon_you() { bool success = false; @@ -5697,11 +5511,6 @@ static bool _jiyva_slimes_on_level_abandon_you() return (success); } -static bool _yred_souls_disappear() -{ - return (apply_to_all_dungeons(_yred_enslaved_souls_on_level_disappear)); -} - // Upon excommunication, ex-Yredelemnulites lose all their undead // slaves. When under penance, Yredelemnulites can lose all undead // slaves in sight. @@ -6082,185 +5891,6 @@ static bool _tso_holy_revenge() return (false); } -void yred_make_enslaved_soul(monsters *mon, bool force_hostile, - bool quiet, bool unrestricted) -{ - if (!unrestricted) - _yred_souls_disappear(); - - const int type = mon->type; - monster_type soul_type = mons_species(type); - const std::string whose = - you.can_see(mon) ? apostrophise(mon->name(DESC_CAP_THE)) - : mon->pronoun(PRONOUN_CAP_POSSESSIVE); - const bool twisted = - !unrestricted ? !x_chance_in_y(you.skills[SK_INVOCATIONS] * 20 / 9 + 20, - 100) - : false; - int corps = -1; - - // If the monster's held in a net, get it out. - mons_clear_trapping_net(mon); - - const monsters orig = *mon; - - if (twisted) - { - mon->type = mons_zombie_size(soul_type) == Z_BIG ? - MONS_ABOMINATION_LARGE : MONS_ABOMINATION_SMALL; - mon->base_monster = MONS_PROGRAM_BUG; - } - else - { - // Drop the monster's corpse, so that it can be properly - // re-equipped below. - corps = place_monster_corpse(mon, true, true); - } - - // Drop the monster's equipment. - monster_drop_ething(mon); - - // Recreate the monster as an abomination, or as itself before - // turning it into a spectral thing below. - define_monster(*mon); - - mon->colour = ETC_UNHOLY; - - mon->flags |= MF_CREATED_FRIENDLY; - mon->flags |= MF_ENSLAVED_SOUL; - - if (twisted) - // Mark abominations as undead. - mon->flags |= MF_HONORARY_UNDEAD; - else if (corps != -1) - { - // Turn the monster into a spectral thing, minus the usual - // adjustments for zombified monsters. - mon->type = MONS_SPECTRAL_THING; - mon->base_monster = soul_type; - - // Re-equip the spectral thing. - equip_undead(mon->pos(), corps, monster_index(mon), - mon->base_monster); - - // Destroy the monster's corpse, as it's no longer needed. - destroy_item(corps); - } - - name_zombie(mon, &orig); - - mons_make_god_gift(mon, GOD_YREDELEMNUL); - - mon->attitude = !force_hostile ? ATT_FRIENDLY : ATT_HOSTILE; - behaviour_event(mon, ME_ALERT, !force_hostile ? MHITNOT : MHITYOU); - - if (!quiet) - { - mprf("%s soul %s, and %s.", whose.c_str(), - twisted ? "becomes twisted" : "remains intact", - !force_hostile ? "is now yours" : "fights you"); - } -} - -static void _print_converted_orc_speech(const std::string key, - monsters *mon, - msg_channel_type channel) -{ - std::string msg = getSpeakString("beogh_converted_orc_" + key); - - if (!msg.empty()) - { - msg = do_mon_str_replacements(msg, mon); - mpr(msg.c_str(), channel); - } -} - -// Orcs may turn friendly when encountering followers of Beogh, and be -// made gifts of Beogh. -void beogh_convert_orc(monsters *orc, bool emergency, - bool converted_by_follower) -{ - ASSERT(mons_species(orc->type) == MONS_ORC); - - if (you.can_see(orc)) // show reaction - { - if (emergency || !orc->alive()) - { - if (converted_by_follower) - { - _print_converted_orc_speech("reaction_battle_follower", orc, - MSGCH_FRIEND_ENCHANT); - _print_converted_orc_speech("speech_battle_follower", orc, - MSGCH_TALK); - } - else - { - _print_converted_orc_speech("reaction_battle", orc, - MSGCH_FRIEND_ENCHANT); - _print_converted_orc_speech("speech_battle", orc, MSGCH_TALK); - } - } - else - { - _print_converted_orc_speech("reaction_sight", orc, - MSGCH_FRIEND_ENCHANT); - - if (!one_chance_in(3)) - _print_converted_orc_speech("speech_sight", orc, MSGCH_TALK); - } - } - - orc->attitude = ATT_FRIENDLY; - - // The monster is not really *created* friendly, but should it - // become hostile later on, it won't count as a good kill. - orc->flags |= MF_CREATED_FRIENDLY; - - // Prevent assertion if the orc was previously worshipping a - // different god, rather than already worshipping Beogh or being an - // atheist. - orc->god = GOD_NO_GOD; - - mons_make_god_gift(orc, GOD_BEOGH); - - if (orc->is_patrolling()) - { - // Make orcs stop patrolling and forget their patrol point, - // they're supposed to follow you now. - orc->patrol_point = coord_def(0, 0); - } - - if (!orc->alive()) - orc->hit_points = std::min(random_range(1, 4), orc->max_hit_points); - - // Avoid immobile "followers". - behaviour_event(orc, ME_ALERT, MHITNOT); -} - -void feawn_neutralise_plant(monsters *plant) -{ - if (!plant - || !feawn_neutralises(plant) - || plant->attitude != ATT_HOSTILE - || testbits(plant->flags, MF_ATT_CHANGE_ATTEMPT)) - { - return; - } - - plant->attitude = ATT_GOOD_NEUTRAL; - plant->flags |= MF_WAS_NEUTRAL; -} - -// During prayer feawn allows worshipers to walk on top of stationary plants -// and fungi. -bool feawn_passthrough(const monsters * target) -{ - return (target && you.religion == GOD_FEAWN - && you.duration[DUR_PRAYER] - && mons_is_plant(target) - && mons_is_stationary(target)); -} - // Feawn worshipers are on the hook for most plants and fungi // // If feawn worshipers kill a protected monster they lose piety, @@ -6283,45 +5913,6 @@ bool feawn_neutralises(const monsters * target) return (target && mons_is_plant(target)); } -void jiyva_convert_slime(monsters* slime) -{ - ASSERT(mons_is_slime(slime)); - - if (you.can_see(slime)) - { - if (mons_genus(slime->type) == MONS_GIANT_EYEBALL) - { - mprf(MSGCH_GOD, "%s stares at you suspiciously for a moment, " - "then relaxes.", - - slime->name(DESC_CAP_THE).c_str()); - } - else - { - mprf(MSGCH_GOD, "%s trembles before you.", - slime->name(DESC_CAP_THE).c_str()); - } - } - - slime->attitude = ATT_STRICT_NEUTRAL; - slime->flags |= MF_WAS_NEUTRAL; - - if (!mons_eats_items(slime)) - { - slime->add_ench(ENCH_EAT_ITEMS); - - mprf(MSGCH_MONSTER_ENCHANT, "%s looks hungrier.", - slime->name(DESC_CAP_THE).c_str()); - } - - // Prevent assertion if the slime was previously worshipping a - // different god, rather than already worshipping Jiyva or being an - // atheist. - slime->god = GOD_NO_GOD; - - mons_make_god_gift(slime, GOD_JIYVA); -} - void excommunication(god_type new_god) { const god_type old_god = you.religion; @@ -6532,67 +6123,6 @@ void excommunication(god_type new_god) coord_def((int)new_god, old_piety)); } -bool ponderousify_armour(){ - int item_slot = -1; - do - { - if (item_slot == -1) - { - item_slot = prompt_invent_item("Make which item ponderous?", - MT_INVLIST, OSEL_ENCH_ARM, true, true, false); - } - - if (prompt_failed(item_slot)) - return (false); - - item_def& arm(you.inv[item_slot]); - - if (!is_enchantable_armour(arm, true, true) - || get_armour_ego_type(arm) != SPARM_NORMAL) - { - mpr("Choose some type of armour to enchant, or Esc to abort."); - if (Options.auto_list) - more(); - - item_slot = -1; - mpr("You can't enchant that."); //does not appear - continue; - } - - //make item desc runed if desc was vanilla? - - set_item_ego_type(arm, OBJ_ARMOUR, SPARM_PONDEROUSNESS); - - you.redraw_armour_class = true; - you.redraw_evasion = true; - - simple_god_message(" says: Dude, use this wisely!"); - - return (true); - } - while (true); - - return true; -} - -static int _slouch_monsters(coord_def where, int pow, int, actor* agent) -{ - monsters* mon = monster_at(where); - if (mon == NULL) - return (0); - - int dmg = (mon->speed - player_movement_speed()); - dmg = (dmg > 0 ? dmg * dmg : 0); - - mon->hurt(agent, dmg, BEAM_MMISSILE, true); - return (1); -} - -int chronos_slouch(int pow) -{ - return (apply_area_visible(_slouch_monsters, pow)); -} - static bool _bless_weapon(god_type god, brand_type brand, int colour) { item_def& wpn = *you.weapon(); diff --git a/crawl-ref/source/religion.h b/crawl-ref/source/religion.h index 5148e2203e..a34119e39f 100644 --- a/crawl-ref/source/religion.h +++ b/crawl-ref/source/religion.h @@ -75,8 +75,6 @@ void enable_attack_conducts(god_conduct_trigger conduct[3]); void disable_attack_conducts(god_conduct_trigger conduct[3]); void excommunication(god_type new_god = GOD_NO_GOD); -bool ponderousify_armour(); -int chronos_slouch(int); void gain_piety(int pgn); void god_speaks(god_type god, const char *mesg); @@ -103,30 +101,13 @@ bool god_hates_butchery(god_type god); harm_protection_type god_protects_from_harm(god_type god, bool actual = true); bool divine_retribution(god_type god); -bool zin_sustenance(bool actual = true); -bool zin_remove_all_mutations(); -bool yred_injury_mirror(bool actual = true); -bool jiyva_grant_jelly(bool actual = true); -bool jiyva_remove_bad_mutation(); bool jiyva_is_dead(); bool remove_all_jiyva_altars(); -bool beogh_water_walk(); void good_god_holy_attitude_change(monsters *holy); void good_god_holy_fail_attitude_change(monsters *holy); -void yred_make_enslaved_soul(monsters *mon, bool force_hostile = false, - bool quiet = false, bool unrestricted = false); -void beogh_convert_orc(monsters *orc, bool emergency, - bool converted_by_follower = false); -void jiyva_convert_slime(monsters* slime); -void feawn_neutralise_plant(monsters *plant); -bool feawn_passthrough(const monsters * target); bool feawn_protects(const monsters * target); bool feawn_protects_species(int mc); bool feawn_neutralises(const monsters * target); - -bool vehumet_supports_spell(spell_type spell); - -bool trog_burn_spellbooks(); bool ely_destroy_weapons(); bool tso_unchivalric_attack_safe_monster(const monsters *mon); diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc index 4abad0c49f..1f0802af03 100644 --- a/crawl-ref/source/spl-cast.cc +++ b/crawl-ref/source/spl-cast.cc @@ -18,6 +18,7 @@ #include "effects.h" #include "food.h" #include "format.h" +#include "godabil.h" #include "goditem.h" #include "invent.h" #include "it_use2.h" diff --git a/crawl-ref/source/spl-util.cc b/crawl-ref/source/spl-util.cc index cabbeb0519..a8721ddf87 100644 --- a/crawl-ref/source/spl-util.cc +++ b/crawl-ref/source/spl-util.cc @@ -21,6 +21,7 @@ #include "beam.h" #include "directn.h" #include "debug.h" +#include "godabil.h" #include "stuff.h" #include "los.h" #include "macro.h" diff --git a/crawl-ref/source/terrain.cc b/crawl-ref/source/terrain.cc index 4fbadb45e2..2b4c0c1eb8 100644 --- a/crawl-ref/source/terrain.cc +++ b/crawl-ref/source/terrain.cc @@ -15,6 +15,7 @@ #include "cloud.h" #include "dgnevent.h" #include "directn.h" +#include "godabil.h" #include "itemprop.h" #include "items.h" #include "los.h" diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index e14b942bbb..9e2e9d348d 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -33,6 +33,7 @@ #include "dungeon.h" #include "format.h" #include "ghost.h" +#include "godabil.h" #include "goditem.h" #include "itemprop.h" #include "los.h" |