diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-08-06 23:30:49 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-08-07 00:05:14 -0400 |
commit | 25d8ff14f39cfec20457fd3878cad716b07fe278 (patch) | |
tree | 1cd51f0d3e8aee46c1a97c47aa63877d0f0b27ca | |
parent | b89d9dd87c32dfc3287e4ccc9713bc562ecc2d5d (diff) | |
download | crawl-ref-25d8ff14f39cfec20457fd3878cad716b07fe278.tar.gz crawl-ref-25d8ff14f39cfec20457fd3878cad716b07fe278.zip |
make &_ join the religion directly instead of going through an altar
-rw-r--r-- | crawl-ref/source/main.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/religion.cc | 260 | ||||
-rw-r--r-- | crawl-ref/source/religion.h | 4 | ||||
-rw-r--r-- | crawl-ref/source/wiz-you.cc | 16 | ||||
-rw-r--r-- | crawl-ref/source/wiz-you.h | 1 | ||||
-rw-r--r-- | crawl-ref/source/zotdef.cc | 32 | ||||
-rw-r--r-- | crawl-ref/source/zotdef.h | 2 |
7 files changed, 174 insertions, 143 deletions
diff --git a/crawl-ref/source/main.cc b/crawl-ref/source/main.cc index e33f8ce6cf..7c99c4dc55 100644 --- a/crawl-ref/source/main.cc +++ b/crawl-ref/source/main.cc @@ -745,7 +745,7 @@ static void _do_wizard_command(int wiz_command, bool silent_fail) case '}': wizard_reveal_traps(); break; case '@': wizard_set_stats(); break; case '^': wizard_set_piety(); break; - case '_': zotdef_create_altar(true); break; + case '_': wizard_join_religion(); break; case '-': wizard_get_god_gift(); break; case '\'': wizard_list_items(); break; case 'd': wizard_level_travel(true); break; diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 91fddcdc73..9618b1c54a 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -13,6 +13,7 @@ #include <string.h> #include <stdio.h> #include <cmath> +#include <functional> #include "externs.h" @@ -2701,7 +2702,7 @@ static string _god_hates_your_god_reaction(god_type god, god_type your_god) return ""; } -void excommunication(god_type new_god) +void excommunication(god_type new_god, bool immediate) { const god_type old_god = you.religion; ASSERT(old_god != new_god); @@ -2736,7 +2737,8 @@ void excommunication(god_type new_god) you.redraw_quiver = true; mpr("You have lost your religion!"); - more(); + if (!immediate) + more(); if (old_god == GOD_BEOGH) { @@ -3310,120 +3312,8 @@ static void _god_welcome_handle_gear() } } -void god_pitch(god_type which_god) +void join_religion(god_type which_god, bool immediate) { - if (which_god == GOD_BEOGH && grd(you.pos()) != DNGN_ALTAR_BEOGH) - mpr("You bow before the missionary of Beogh."); - else - { - mprf("You %s the altar of %s.", - you.form == TRAN_WISP ? "swirl around" : - you.form == TRAN_BAT ? "perch on" : - you.form == TRAN_DRAGON ? "bow your head before" : - you.flight_mode() ? "hover solemnly before" : - you.form == TRAN_STATUE ? "place yourself before" : - you.form == TRAN_ICE_BEAST - || you.form == TRAN_PIG ? "bow your head before" : - you.form == TRAN_SPIDER ? "crawl onto" : - you.form == TRAN_TREE ? "sway towards" : - you.form == TRAN_FUNGUS ? "release spores on" : - you.form == TRAN_PORCUPINE ? "curl into a sanctuary of spikes before" : - you.species == SP_NAGA ? "coil in front of" : - you.species == SP_OCTOPODE ? "curl up in front of" : - // < TGWi> you curl up on the altar and go to sleep - you.species == SP_FELID ? "sit before" : - "kneel at", - god_name(which_god).c_str()); - } - more(); - - const int fee = (which_god == GOD_GOZAG) ? gozag_service_fee() : 0; - - // Note: using worship we could make some gods not allow followers to - // return, or not allow worshippers from other religions. - bwr - - // Gods can be racist... - if (!player_can_join_god(which_god)) - { - you.turn_is_over = false; - if (which_god == GOD_SIF_MUNA) - { - simple_god_message(" does not accept worship from the ignorant!", - which_god); - } - else if (which_god == GOD_GOZAG) - { - simple_god_message(" does not accept service from beggars like you!", - which_god); - if (you.gold == 0) - { - mprf("The service fee for joining is currently %d gold; you have" - " none.", fee); - } - else - { - mprf("The service fee for joining is currently %d gold; you only" - " have %d.", fee, you.gold); - } - } - else if (!_transformed_player_can_join_god(which_god)) - { - simple_god_message(" says: How dare you come in such a loathsome" - " form!", - which_god); - } - else - { - simple_god_message(" does not accept worship from those such as" - " you!", - which_god); - } - return; - } - - if (which_god == GOD_LUGONU && you.penance[GOD_LUGONU]) - { - you.turn_is_over = false; - simple_god_message(" refuses to forgive you so easily!", which_god); - return; - } - -#ifdef USE_TILE_WEB - tiles_crt_control show_as_menu(CRT_MENU, "god_pitch"); -#endif - - describe_god(which_god, false); - - string service_fee = ""; - if (which_god == GOD_GOZAG) - { - if (fee == 0) - { - service_fee = string("Gozag will waive the service fee if you ") - + (coinflip() ? "act now" : "join today") + "!\n"; - } - else - { - service_fee = make_stringf( - "The service fee for joining is currently %d gold; you" - " currently have %d.\n", - fee, you.gold); - } - } - snprintf(info, INFO_SIZE, "%sDo you wish to %sjoin this religion?", - service_fee.c_str(), - (you.worshipped[which_god]) ? "re" : ""); - - cgotoxy(1, 18, GOTO_CRT); - textcolor(channel_to_colour(MSGCH_PROMPT)); - if (!yesno(info, false, 'n', true, true, false, NULL, GOTO_CRT)) - { - you.turn_is_over = false; // Okay, opt out. - redraw_screen(); - return; - } - - // OK, so join the new religion. redraw_screen(); const god_type old_god = you.religion; @@ -3431,7 +3321,7 @@ void god_pitch(god_type which_god) // Leave your prior religion first. if (!you_worship(GOD_NO_GOD)) - excommunication(which_god); + excommunication(which_god, immediate); // Welcome to the fold! you.religion = static_cast<god_type>(which_god); @@ -3462,7 +3352,8 @@ void god_pitch(god_type which_god) simple_god_message( make_stringf(" welcomes you%s!", you.worshipped[which_god] ? " back" : "").c_str()); - more(); + if (!immediate) + more(); if (crawl_state.game_is_tutorial()) { // Tutorial needs berserk usable. @@ -3658,6 +3549,7 @@ void god_pitch(god_type which_god) if (you_worship(GOD_GOZAG)) { bool needs_redraw = false; + const int fee = gozag_service_fee(); if (fee > 0) { mprf(MSGCH_GOD, "You pay a service fee of %d gold.", fee); @@ -3709,6 +3601,140 @@ void god_pitch(god_type which_god) learned_something_new(HINT_CONVERT); } +void god_pitch(god_type which_god) +{ + if (which_god == GOD_BEOGH && grd(you.pos()) != DNGN_ALTAR_BEOGH) + mpr("You bow before the missionary of Beogh."); + else + { + mprf("You %s the altar of %s.", + you.form == TRAN_WISP ? "swirl around" : + you.form == TRAN_BAT ? "perch on" : + you.form == TRAN_DRAGON ? "bow your head before" : + you.flight_mode() ? "hover solemnly before" : + you.form == TRAN_STATUE ? "place yourself before" : + you.form == TRAN_ICE_BEAST + || you.form == TRAN_PIG ? "bow your head before" : + you.form == TRAN_SPIDER ? "crawl onto" : + you.form == TRAN_TREE ? "sway towards" : + you.form == TRAN_FUNGUS ? "release spores on" : + you.form == TRAN_PORCUPINE ? "curl into a sanctuary of spikes before" : + you.species == SP_NAGA ? "coil in front of" : + you.species == SP_OCTOPODE ? "curl up in front of" : + // < TGWi> you curl up on the altar and go to sleep + you.species == SP_FELID ? "sit before" : + "kneel at", + god_name(which_god).c_str()); + } + more(); + + const int fee = (which_god == GOD_GOZAG) ? gozag_service_fee() : 0; + + // Note: using worship we could make some gods not allow followers to + // return, or not allow worshippers from other religions. - bwr + + // Gods can be racist... + if (!player_can_join_god(which_god)) + { + you.turn_is_over = false; + if (which_god == GOD_SIF_MUNA) + { + simple_god_message(" does not accept worship from the ignorant!", + which_god); + } + else if (which_god == GOD_GOZAG) + { + simple_god_message(" does not accept service from beggars like you!", + which_god); + if (you.gold == 0) + { + mprf("The service fee for joining is currently %d gold; you have" + " none.", fee); + } + else + { + mprf("The service fee for joining is currently %d gold; you only" + " have %d.", fee, you.gold); + } + } + else if (!_transformed_player_can_join_god(which_god)) + { + simple_god_message(" says: How dare you come in such a loathsome" + " form!", + which_god); + } + else + { + simple_god_message(" does not accept worship from those such as" + " you!", + which_god); + } + return; + } + + if (which_god == GOD_LUGONU && you.penance[GOD_LUGONU]) + { + you.turn_is_over = false; + simple_god_message(" refuses to forgive you so easily!", which_god); + return; + } + +#ifdef USE_TILE_WEB + tiles_crt_control show_as_menu(CRT_MENU, "god_pitch"); +#endif + + describe_god(which_god, false); + + string service_fee = ""; + if (which_god == GOD_GOZAG) + { + if (fee == 0) + { + service_fee = string("Gozag will waive the service fee if you ") + + (coinflip() ? "act now" : "join today") + "!\n"; + } + else + { + service_fee = make_stringf( + "The service fee for joining is currently %d gold; you" + " currently have %d.\n", + fee, you.gold); + } + } + snprintf(info, INFO_SIZE, "%sDo you wish to %sjoin this religion?", + service_fee.c_str(), + (you.worshipped[which_god]) ? "re" : ""); + + cgotoxy(1, 18, GOTO_CRT); + textcolor(channel_to_colour(MSGCH_PROMPT)); + if (!yesno(info, false, 'n', true, true, false, NULL, GOTO_CRT)) + { + you.turn_is_over = false; // Okay, opt out. + redraw_screen(); + return; + } + + // OK, so join the new religion. + join_religion(which_god); +} + +god_type choose_god() +{ + char specs[80]; + + msgwin_get_line("Which god (by name)? ", specs, sizeof(specs)); + + if (specs[0] == '\0') + return GOD_NO_GOD; + + string spec = lowercase_string(specs); + + // Skip GOD_NO_GOD + return find_earliest_match(spec, (god_type) 1, NUM_GODS, + _always_true<god_type>, + bind2nd(ptr_fun(god_name), false)); +} + int had_gods() { int count = 0; diff --git a/crawl-ref/source/religion.h b/crawl-ref/source/religion.h index f38b56a1d1..623b88b8ce 100644 --- a/crawl-ref/source/religion.h +++ b/crawl-ref/source/religion.h @@ -45,7 +45,7 @@ bool active_penance(god_type god); void dec_penance(int val); void dec_penance(god_type god, int val); -void excommunication(god_type new_god = GOD_NO_GOD); +void excommunication(god_type new_god = GOD_NO_GOD, bool immediate = false); bool gain_piety(int pgn, int denominator = 1, bool should_scale_piety = true); void dock_piety(int pietyloss, int penance); @@ -57,7 +57,9 @@ int god_colour(god_type god); colour_t god_message_altar_colour(god_type god); int gozag_service_fee(); bool player_can_join_god(god_type which_god); +void join_religion(god_type which_god, bool immediate = true); void god_pitch(god_type which_god); +god_type choose_god(); static inline bool you_worship(god_type god) { diff --git a/crawl-ref/source/wiz-you.cc b/crawl-ref/source/wiz-you.cc index 57047c3fe3..a28ef23841 100644 --- a/crawl-ref/source/wiz-you.cc +++ b/crawl-ref/source/wiz-you.cc @@ -1151,3 +1151,19 @@ void wizard_load_dump_file() canned_msg(MSG_NOTHING_THERE); } } + +void wizard_join_religion() +{ + god_type god = choose_god(); + if (god == GOD_NO_GOD) + { + if (you_worship(GOD_NO_GOD)) + mpr("You already have no god!"); + else + excommunication(); + } + else + { + join_religion(god, true); + } +} diff --git a/crawl-ref/source/wiz-you.h b/crawl-ref/source/wiz-you.h index c14bff2b0b..f8ac4ca0cf 100644 --- a/crawl-ref/source/wiz-you.h +++ b/crawl-ref/source/wiz-you.h @@ -30,5 +30,6 @@ void wizard_god_wrath(); void wizard_god_mollify(); void wizard_transform(); void wizard_load_dump_file(); +void wizard_join_religion(); #endif diff --git a/crawl-ref/source/zotdef.cc b/crawl-ref/source/zotdef.cc index a945f903de..c3dc83c163 100644 --- a/crawl-ref/source/zotdef.cc +++ b/crawl-ref/source/zotdef.cc @@ -911,36 +911,25 @@ bool create_trap(trap_type spec_type) return result; } -static bool _can_make_altar(god_type g, bool wizmode) +static bool _can_make_altar(god_type g) { - return wizmode || !is_unavailable_god(g); + return !is_unavailable_god(g); } /** * Create an altar to the god of the player's choice. - * @param wizmode if true, bypass some checks. */ -bool zotdef_create_altar(bool wizmode) +bool zotdef_create_altar() { - char specs[80]; - - if (!wizmode && grd(you.pos()) != DNGN_FLOOR) + if (grd(you.pos()) != DNGN_FLOOR) return false; - msgwin_get_line("Which god (by name)? ", specs, sizeof(specs)); + god_type god = choose_god(); - if (specs[0] == '\0') + if (god == GOD_NO_GOD) return false; - string spec = lowercase_string(specs); - - // Skip GOD_NO_GOD - god_type god = find_earliest_match( - spec, (god_type) 1, NUM_GODS, - bind2nd(ptr_fun(_can_make_altar), wizmode), - bind2nd(ptr_fun(god_name), false)); - - if (god == NUM_GODS) + if (god == NUM_GODS || !_can_make_altar(god)) { mpr("That god doesn't seem to be taking followers today."); return false; @@ -950,11 +939,8 @@ bool zotdef_create_altar(bool wizmode) dungeon_feature_type feat = altar_for_god(god); dungeon_terrain_changed(you.pos(), feat, false); - if (wizmode) - pray(); - else - mprf("An altar to %s grows from the floor before you!", - god_name(god).c_str()); + mprf("An altar to %s grows from the floor before you!", + god_name(god).c_str()); return true; } diff --git a/crawl-ref/source/zotdef.h b/crawl-ref/source/zotdef.h index 8a8445279e..c58e064904 100644 --- a/crawl-ref/source/zotdef.h +++ b/crawl-ref/source/zotdef.h @@ -7,7 +7,7 @@ monster* zotdef_spawn(bool boss); void zotdef_set_wave(); bool create_trap(trap_type spec_type); bool create_zotdef_ally(monster_type mtyp, const char *successmsg); -bool zotdef_create_altar(bool wizmode = false); +bool zotdef_create_altar(); void zotdef_create_pond(const coord_def& center, int radius); void zotdef_bosses_check(); |