X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Fxtra2.c;h=797624cf4ce826fc65bf4a90a366dceecdac88a9;hb=9c3545e756dbf1b752dd833400aaf6eb90be780b;hp=6e9e95c69dca5976b59401b7e98ff81e77f0c5dc;hpb=25274d7233d8ff36a37aa11d260019d0faa02959;p=hengband%2Fhengband.git diff --git a/src/xtra2.c b/src/xtra2.c index 6e9e95c69..797624cf4 100644 --- a/src/xtra2.c +++ b/src/xtra2.c @@ -377,12 +377,55 @@ static bool kind_is_hafted(int k_idx) } +void complete_quest(int quest_num) +{ + switch (quest[quest_num].type) + { + case QUEST_TYPE_RANDOM: + if (record_rand_quest) do_cmd_write_nikki(NIKKI_RAND_QUEST_C, quest_num, NULL); + break; + default: + if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_C, quest_num, NULL); + break; + } + + quest[quest_num].status = QUEST_STATUS_COMPLETED; + quest[quest_num].complev = (byte)p_ptr->lev; + + if (!(quest[quest_num].flags & QUEST_FLAG_SILENT)) + { + msg_print(_("¥¯¥¨¥¹¥È¤òãÀ®¤·¤¿¡ª", "You just completed your quest!")); + msg_print(NULL); + } +} + +static int count_all_hostile_monsters(void) +{ + int x, y; + int number_mon = 0; + + for (x = 0; x < cur_wid; ++ x) + { + for (y = 0; y < cur_hgt; ++ y) + { + int m_idx = cave[y][x].m_idx; + + if (m_idx > 0 && is_hostile(&m_list[m_idx])) + { + ++ number_mon; + } + } + } + + return number_mon; +} + /* * Check for "Quest" completion when a quest monster is killed or charmed. */ void check_quest_completion(monster_type *m_ptr) { - int i, j, y, x, ny, nx, i2, j2; + int i, j, y, x, ny, nx; int quest_num; @@ -453,21 +496,7 @@ void check_quest_completion(monster_type *m_ptr) if (quest[i].cur_num >= quest[i].num_mon) { - if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_C, i, NULL); - /* completed quest */ - quest[i].status = QUEST_STATUS_COMPLETED; - quest[i].complev = (byte)p_ptr->lev; - - if (!(quest[i].flags & QUEST_FLAG_SILENT)) - { -#ifdef JP -msg_print("¥¯¥¨¥¹¥È¤òãÀ®¤·¤¿¡ª"); -#else - msg_print("You just completed your quest!"); -#endif - - msg_print(NULL); - } + complete_quest(i); quest[i].cur_num = 0; } @@ -475,36 +504,17 @@ msg_print(" } case QUEST_TYPE_KILL_ALL: { - int number_mon = 0; - if (!is_hostile(m_ptr)) break; - /* Count all hostile monsters */ - for (i2 = 0; i2 < cur_wid; ++i2) - for (j2 = 0; j2 < cur_hgt; j2++) - if (cave[j2][i2].m_idx > 0) - if (is_hostile(&m_list[cave[j2][i2].m_idx])) - number_mon++; - - if ((number_mon - 1) == 0) + if (count_all_hostile_monsters() == 1) { - if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_C, i, NULL); - /* completed */ if (quest[i].flags & QUEST_FLAG_SILENT) { quest[i].status = QUEST_STATUS_FINISHED; } else { - quest[i].status = QUEST_STATUS_COMPLETED; - quest[i].complev = (byte)p_ptr->lev; -#ifdef JP -msg_print("¥¯¥¨¥¹¥È¤òãÀ®¤·¤¿¡ª"); -#else - msg_print("You just completed your quest!"); -#endif - - msg_print(NULL); + complete_quest(i); } } break; @@ -520,28 +530,14 @@ msg_print(" if (quest[i].cur_num >= quest[i].max_num) { - if (record_fix_quest && (quest[i].type == QUEST_TYPE_KILL_LEVEL)) do_cmd_write_nikki(NIKKI_FIX_QUEST_C, i, NULL); - if (record_rand_quest && (quest[i].type == QUEST_TYPE_RANDOM)) do_cmd_write_nikki(NIKKI_RAND_QUEST_C, i, NULL); - /* completed quest */ - quest[i].status = QUEST_STATUS_COMPLETED; - quest[i].complev = (byte)p_ptr->lev; + complete_quest(i); + if (!(quest[i].flags & QUEST_FLAG_PRESET)) { create_stairs = TRUE; p_ptr->inside_quest = 0; } - if (!(quest[i].flags & QUEST_FLAG_SILENT)) - { -#ifdef JP -msg_print("¥¯¥¨¥¹¥È¤òãÀ®¤·¤¿¡ª"); -#else - msg_print("You just completed your quest!"); -#endif - - msg_print(NULL); - } - /* Finish the two main quests without rewarding */ if ((i == QUEST_OBERON) || (i == QUEST_SERPENT)) { @@ -561,57 +557,25 @@ msg_print(" quest[i].cur_num++; if (quest[i].cur_num >= quest[i].max_num) { - if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_C, i, NULL); - /* completed quest */ - quest[i].status = QUEST_STATUS_COMPLETED; - quest[i].complev = (byte)p_ptr->lev; - - if (!(quest[i].flags & QUEST_FLAG_SILENT)) - { -#ifdef JP -msg_print("¥¯¥¨¥¹¥È¤òãÀ®¤·¤¿¡ª"); -#else - msg_print("You just completed your quest!"); -#endif - - msg_print(NULL); - } + complete_quest(i); quest[i].cur_num = 0; } break; } case QUEST_TYPE_TOWER: { - int number_mon = 0; - if (!is_hostile(m_ptr)) break; - /* Count all hostile monsters */ - for (i2 = 0; i2 < cur_wid; ++i2) - for (j2 = 0; j2 < cur_hgt; j2++) - if (cave[j2][i2].m_idx > 0) - if (is_hostile(&m_list[cave[j2][i2].m_idx])) - number_mon++; - - if ((number_mon - 1) == 0) + if (count_all_hostile_monsters() == 1) { - if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_C, i, NULL); - quest[i].status = QUEST_STATUS_STAGE_COMPLETED; - /* completed */ + if((quest[QUEST_TOWER1].status == QUEST_STATUS_STAGE_COMPLETED) && (quest[QUEST_TOWER2].status == QUEST_STATUS_STAGE_COMPLETED) && (quest[QUEST_TOWER3].status == QUEST_STATUS_STAGE_COMPLETED)) { - quest[QUEST_TOWER1].status = QUEST_STATUS_COMPLETED; - quest[QUEST_TOWER1].complev = (byte)p_ptr->lev;; - -#ifdef JP -msg_print("¥¯¥¨¥¹¥È¤òãÀ®¤·¤¿¡ª"); -#else - msg_print("You just completed your quest!"); -#endif - msg_print(NULL); + + complete_quest(QUEST_TOWER1); } } break; @@ -670,6 +634,21 @@ msg_print(" } +void check_find_art_quest_completion(object_type *o_ptr) +{ + int i; + /* Check if completed a quest */ + for (i = 0; i < max_quests; i++) + { + if ((quest[i].type == QUEST_TYPE_FIND_ARTIFACT) && + (quest[i].status == QUEST_STATUS_TAKEN) && + (quest[i].k_idx == o_ptr->name1)) + { + complete_quest(i); + } + } +} + /* * Return monster death string */ @@ -1717,6 +1696,20 @@ static void get_exp_from_mon(int dam, monster_type *m_ptr) s64b_RSHIFT(new_exp, new_exp_frac, 2); } } + + /* Special penalty for rest_and_shoot exp scum */ + if ((m_ptr->dealt_damage > m_ptr->max_maxhp) && (m_ptr->hp >= 0)) + { + int over_damage = m_ptr->dealt_damage / m_ptr->max_maxhp; + if (over_damage > 32) over_damage = 32; + + while (over_damage--) + { + /* 9/10 for once */ + s64b_mul(&new_exp, &new_exp_frac, 0, 9); + s64b_div(&new_exp, &new_exp_frac, 0, 10); + } + } /* Finally multiply base experience point of the monster */ s64b_mul(&new_exp, &new_exp_frac, 0, r_ptr->mexp); @@ -1766,12 +1759,12 @@ bool mon_take_hit(int m_idx, int dam, bool *fear, cptr note) bool innocent = TRUE, thief = FALSE; int i; int expdam; + int dealt_damage; - COPY(&exp_mon, m_ptr, monster_type); + (void)COPY(&exp_mon, m_ptr, monster_type); if (!(r_ptr->flags7 & RF7_KILL_EXP)) { expdam = (m_ptr->hp > dam) ? dam : m_ptr->hp; - if (r_ptr->flags6 & RF6_HEAL) expdam = (expdam+1) * 2 / 3; get_exp_from_mon(expdam, &exp_mon); @@ -1794,9 +1787,20 @@ bool mon_take_hit(int m_idx, int dam, bool *fear, cptr note) /* Genocided by chaos patron */ if (!m_idx) return TRUE; + + /* Remember dealt_damage before this attack*/ + dealt_damage = m_ptr->dealt_damage; /* Hurt it */ m_ptr->hp -= dam; + + m_ptr->dealt_damage += dam; + if(m_ptr->dealt_damage > m_ptr->max_maxhp * 100) m_ptr->dealt_damage = m_ptr->max_maxhp * 100; + if (p_ptr->wizard) + { + msg_format( _("¹ç·×%d/%d¤Î¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¡£","You do %d (out of %d) damage."), + m_ptr->dealt_damage, m_ptr->maxhp); + } /* It is dead now */ if (m_ptr->hp < 0) @@ -2151,9 +2155,17 @@ msg_format("%s /* Prevent bug of chaos patron's reward */ if (r_ptr->flags7 & RF7_KILL_EXP) + { get_exp_from_mon((long)exp_mon.max_maxhp*2, &exp_mon); + } else - get_exp_from_mon(((long)exp_mon.max_maxhp+1L) * 9L / 10L, &exp_mon); + { + u32b destroy_exp = exp_mon.max_maxhp + 1; + /* Add remained exp*/ + if(dealt_damage < m_ptr->maxhp) + destroy_exp += m_ptr->maxhp - dealt_damage; + get_exp_from_mon(destroy_exp, &exp_mon); + } /* Not afraid */ (*fear) = FALSE; @@ -2381,6 +2393,24 @@ bool change_panel(int dy, int dx) return (FALSE); } +bool change_panel_xy(int y, int x) +{ + int dy = 0, dx = 0; + int wid, hgt; + + /* Get size */ + get_screen_size(&wid, &hgt); + + if (y < panel_row_min) dy = -1; + if (y > panel_row_max) dy = 1; + if (x < panel_col_min) dx = -1; + if (x > panel_col_max) dx = 1; + + if (!dy && !dx) return (FALSE); + + return change_panel(dy, dx); +} + /* * Given an row (y) and col (x), this routine detects when a move @@ -3018,14 +3048,32 @@ static bool target_set_accept(int y, int x) static void target_set_prepare(int mode) { int y, x; + int min_hgt, max_hgt, min_wid, max_wid; + + if (mode & TARGET_KILL) + { + /* Inner range */ + min_hgt = MAX((py - MAX_RANGE), 0); + max_hgt = MIN((py + MAX_RANGE), cur_hgt - 1); + min_wid = MAX((px - MAX_RANGE), 0); + max_wid = MIN((px + MAX_RANGE), cur_wid - 1); + } + else /* not targetting */ + { + /* Inner panel */ + min_hgt = panel_row_min; + max_hgt = panel_row_max; + min_wid = panel_col_min; + max_wid = panel_col_max; + } /* Reset "temp" array */ temp_n = 0; /* Scan the current panel */ - for (y = panel_row_min; y <= panel_row_max; y++) + for (y = min_hgt; y <= max_hgt; y++) { - for (x = panel_col_min; x <= panel_col_max; x++) + for (x = min_wid; x <= max_wid; x++) { cave_type *c_ptr; @@ -3639,7 +3687,7 @@ static int target_set_aux(int y, int x, int mode, cptr info) p_ptr->inside_quest = c_ptr->special; /* Get the quest text */ - init_flags = INIT_SHOW_TEXT; + init_flags = INIT_NAME_ONLY; process_dungeon_file("q_info.txt", 0, 0, 0, 0); @@ -3731,7 +3779,7 @@ static int target_set_aux(int y, int x, int mode, cptr info) if (c_ptr->mimic) sprintf(f_idx_str, "%d/%d", c_ptr->feat, c_ptr->mimic); else sprintf(f_idx_str, "%d", c_ptr->feat); #ifdef JP - sprintf(out_val, "%s%s%s%s[%s] %x %s %d %d %d (%d,%d)", s1, name, s2, s3, info, c_ptr->info, f_idx_str, c_ptr->dist, c_ptr->cost, c_ptr->when, y, x); + sprintf(out_val, "%s%s%s%s[%s] %x %s %d %d %d (%d,%d) %d", s1, name, s2, s3, info, c_ptr->info, f_idx_str, c_ptr->dist, c_ptr->cost, c_ptr->when, y, x, travel.cost[y][x]); #else sprintf(out_val, "%s%s%s%s [%s] %x %s %d %d %d (%d,%d)", s1, s2, s3, name, info, c_ptr->info, f_idx_str, c_ptr->dist, c_ptr->cost, c_ptr->when, y, x); #endif @@ -3844,6 +3892,9 @@ bool target_set(int mode) y = temp_y[m]; x = temp_x[m]; + /* Set forcus */ + change_panel_xy(y, x); + if (!(mode & TARGET_LOOK)) prt_path(y, x); /* Access */ @@ -4471,6 +4522,7 @@ msg_print(" bool get_rep_dir(int *dp, bool under) { int dir; + cptr prompt; /* Initialize */ (*dp) = 0; @@ -4488,24 +4540,36 @@ bool get_rep_dir(int *dp, bool under) #endif /* ALLOW_REPEAT -- TNB */ + if (under) + { + prompt = _("Êý¸þ ('.'­¸µ, ESC¤ÇÃæÃÇ)? ", "Direction ('.' at feet, Escape to cancel)? "); + } + else + { + prompt = _("Êý¸þ (ESC¤ÇÃæÃÇ)? ", "Direction (Escape to cancel)? "); + } + /* Get a direction */ while (!dir) { char ch; /* Get a command (or Cancel) */ -#ifdef JP -if (!get_com("Êý¸þ (ESC¤ÇÃæÃÇ)? ", &ch, TRUE)) break; -#else - if (!get_com("Direction (Escape to cancel)? ", &ch, TRUE)) break; -#endif + if (!get_com(prompt, &ch, TRUE)) break; + /* Look down */ + if ((under) && ((ch == '5') || (ch == '-') || (ch == '.'))) + { + dir = 5; + } + else + { + /* Look up the direction */ + dir = get_keymap_dir(ch); - /* Look up the direction */ - dir = get_keymap_dir(ch); - - /* Oops */ - if (!dir) bell(); + /* Oops */ + if (!dir) bell(); + } } /* Prevent weirdness */ @@ -6315,7 +6379,7 @@ void display_rumor(bool ex) { char *zz[4]; cptr rumor_msg = NULL; - cptr rumor_eff = NULL; + cptr rumor_eff_format = NULL; char fullname[1024] = ""; if (tokenize(Rumor + 2, 3, zz, TOKENIZE_CHECKQUOTE) == 3) @@ -6353,11 +6417,7 @@ void display_rumor(bool ex) if (r_ptr->name) break; } -#ifdef JP strcpy(fullname, r_name + r_ptr->name); -#else - strcpy(fullname, r_name + r_ptr->E_name); -#endif /* Remember this monster */ if (!r_ptr->r_sights) @@ -6382,11 +6442,7 @@ void display_rumor(bool ex) if (!max_dlv[d_idx]) { max_dlv[d_idx] = d_ptr->mindepth; -#ifdef JP - rumor_eff = format("%s¤Ëµ¢´Ô¤Ç¤­¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£", fullname); -#else - rumor_eff = format("You can recall to %s.", fullname); -#endif + rumor_eff_format = _("%s¤Ëµ¢´Ô¤Ç¤­¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£", "You can recall to %s."); } } else if (strcmp(zz[0], "TOWN") == 0) @@ -6406,20 +6462,16 @@ void display_rumor(bool ex) if ((t_idx != SECRET_TOWN) && !(p_ptr->visit & visit)) { p_ptr->visit |= visit; -#ifdef JP - rumor_eff = format("%s¤Ë¹Ô¤Ã¤¿¤³¤È¤¬¤¢¤ëµ¤¤¬¤¹¤ë¡£", fullname); -#else - rumor_eff = format("You feel you have been to %s.", fullname); -#endif + rumor_eff_format = _("%s¤Ë¹Ô¤Ã¤¿¤³¤È¤¬¤¢¤ëµ¤¤¬¤¹¤ë¡£", "You feel you have been to %s."); } } rumor_msg = rumor_bind_name(zz[2], fullname); msg_print(rumor_msg); - if (rumor_eff) + if (rumor_eff_format) { msg_print(NULL); - msg_print(rumor_eff); + msg_format(rumor_eff_format, fullname); } err = FALSE; }