diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-29 13:31:45 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-29 13:31:45 +0000 |
commit | 8c38a749feba7593d146377ac6e4b090f8228e64 (patch) | |
tree | 6669be5ff4f09369c112a9414601eed81edc9d25 /crawl-ref | |
parent | d1a6e695915d4d649f3517f4c131f940c7aacc8f (diff) | |
download | crawl-ref-8c38a749feba7593d146377ac6e4b090f8228e64.tar.gz crawl-ref-8c38a749feba7593d146377ac6e4b090f8228e64.zip |
Fix good random secondary choices during character selection.
Re-enable quivering with '(' - still buggy, and I'm trying to work out
why, but at least it works for some ammo now.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6218 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r-- | crawl-ref/source/acr.cc | 8 | ||||
-rw-r--r-- | crawl-ref/source/item_use.cc | 9 | ||||
-rw-r--r-- | crawl-ref/source/monstuff.cc | 3 | ||||
-rw-r--r-- | crawl-ref/source/newgame.cc | 19 | ||||
-rw-r--r-- | crawl-ref/source/quiver.cc | 5 |
5 files changed, 31 insertions, 13 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index fb3514c1be..8bf0afedfb 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -2415,10 +2415,14 @@ void process_command( command_type cmd ) int cur; you.m_quiver->get_desired_item(NULL, &cur); const int next = get_next_fire_item(cur, +1); +#ifdef DEBUG_QUIVER + mprf(MSGCH_DIAGNOSTICS, "next slot: %d, item: %s", next, + next == -1 ? "none" : you.inv[next].name(DESC_PLAIN).c_str()); +#endif if (next != -1) { - // kind of a hacky way to get quiver to change - you.m_quiver->on_item_fired(you.inv[next]); + // Kind of a hacky way to get quiver to change. + you.m_quiver->on_item_fired(you.inv[next], true); } break; } diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index d2ebcec981..becf94c833 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -1276,10 +1276,17 @@ int get_next_fire_item(int current, int direction) for (unsigned i = 0; i < fire_order.size(); i++) { +#ifdef DEBUG_QUIVER + mprf(MSGCH_DIAGNOSTICS, "i: %d, slot: %d", i, fire_order[i]); +#endif if (fire_order[i] == current) { unsigned next = - (i + fire_order.size() + direction) % fire_order.size(); + (i + direction + fire_order.size()) % fire_order.size(); +#ifdef DEBUG_QUIVER + mprf(MSGCH_DIAGNOSTICS, "i: %d (%d), next: %d (%d), size: %d", + i, current, next, fire_order[next], fire_order.size()); +#endif return fire_order[next]; } } diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index de3cc7d7b5..521fa5ef7d 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -2054,7 +2054,7 @@ void behaviour_event(monsters *mon, int event, int src, case ME_SCARE: { - const bool flee_sanct = !mons_wont_attack(mon) + const bool flee_sanct = !mons_wont_attack(mon) && is_sanctuary(mon->x, mon->y); // Berserking monsters don't flee, unless it's from sanctuary. @@ -3233,6 +3233,7 @@ static void _handle_behaviour(monsters *mon) if (need_target && patrolling) { need_target = false; + if (!_choose_random_patrol_target_grid(mon)) { // If we couldn't find a target that is within easy diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc index 8d9f047682..9e97a0b439 100644 --- a/crawl-ref/source/newgame.cc +++ b/crawl-ref/source/newgame.cc @@ -2115,10 +2115,10 @@ static bool _choose_book( item_def& book, int firstbook, int numbooks ) } if (!good_choices) - keyin = random2(numbooks) + 'a'; + keyin = random2(numbooks); } - book.sub_type = firstbook + keyin - 'a'; + book.sub_type = firstbook + keyin; return (true); } @@ -2311,8 +2311,8 @@ static bool _choose_weapon() } } while (keyin != '*' && keyin != '+' - && (keyin < 'a' || keyin > ('a' + num_choices)) - || startwep_restrictions[keyin - 'a'] == CC_BANNED); + && (keyin < 'a' || keyin > ('a' + num_choices) + || startwep_restrictions[keyin - 'a'] == CC_BANNED)); if (keyin != '*' && keyin != '+' @@ -2323,8 +2323,8 @@ static bool _choose_weapon() } } - if (Options.random_pick || Options.weapon == WPN_RANDOM || keyin == '*' - || keyin == '+') + if (Options.random_pick || Options.weapon == WPN_RANDOM + || keyin == '*' || keyin == '+') { Options.weapon = WPN_RANDOM; ng_weapon = WPN_RANDOM; @@ -2334,7 +2334,7 @@ static bool _choose_weapon() { for (int i = 0; i < num_choices; i++) { - if (_weapon_restriction(startwep[keyin]) == CC_UNRESTRICTED + if (_weapon_restriction(startwep[i]) == CC_UNRESTRICTED && one_chance_in(++good_choices)) { keyin = i; @@ -2352,8 +2352,8 @@ static bool _choose_weapon() if (x > -2) break; } - keyin += 'a'; } + keyin += 'a'; } else ng_weapon = startwep[keyin - 'a']; @@ -4827,7 +4827,10 @@ bool _give_items_skills() // fall-through for random case '+': if (keyn == '+' && !_has_good_necromancy_apts()) + { choice = DK_YREDELEMNUL; + break; + } // fall-through for random case '*': choice = coinflip()? DK_NECROMANCY : DK_YREDELEMNUL; diff --git a/crawl-ref/source/quiver.cc b/crawl-ref/source/quiver.cc index 5f764b5eb5..8bf0761065 100644 --- a/crawl-ref/source/quiver.cc +++ b/crawl-ref/source/quiver.cc @@ -233,7 +233,10 @@ void player_quiver::on_item_fired(const item_def& item, bool explicitly_chosen) // Don't do anything if this item is not really fit for throwing. if (projected == LRET_FUMBLED) return; - +#ifdef DEBUG_QUIVER + mprf(MSGCH_DIAGNOSTICS, "item %s is for throwing", + item.name(DESC_PLAIN).c_str()); +#endif m_last_used_of_type[AMMO_THROW] = item; m_last_used_of_type[AMMO_THROW].quantity = 1; m_last_used_type = AMMO_THROW; |