}
+void complete_quest(int quest_num)
+{
+ quest_type* const q_ptr = &quest[quest_num];
+
+ switch (q_ptr->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;
+ }
+
+ q_ptr->status = QUEST_STATUS_COMPLETED;
+ q_ptr->complev = (byte)p_ptr->lev;
+ update_playtime();
+ q_ptr->comptime = playtime;
+
+ if (!(q_ptr->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 y, x;
int quest_num;
x = m_ptr->fx;
/* Inside a quest */
- quest_num = p_ptr->inside_quest;
+ quest_num = p_ptr->inside_quest;
/* Search for an active quest on this dungeon level */
if (!quest_num)
{
+ int i;
+
for (i = max_quests - 1; i > 0; i--)
{
+ quest_type* const q_ptr = &quest[i];
+
/* Quest is not active */
- if (quest[i].status != QUEST_STATUS_TAKEN)
+ if (q_ptr->status != QUEST_STATUS_TAKEN)
continue;
/* Quest is not a dungeon quest */
- if (quest[i].flags & QUEST_FLAG_PRESET)
+ if (q_ptr->flags & QUEST_FLAG_PRESET)
continue;
/* Quest is not on this level */
- if ((quest[i].level != dun_level) &&
- (quest[i].type != QUEST_TYPE_KILL_ANY_LEVEL))
+ if ((q_ptr->level != dun_level) &&
+ (q_ptr->type != QUEST_TYPE_KILL_ANY_LEVEL))
continue;
/* Not a "kill monster" quest */
- if ((quest[i].type == QUEST_TYPE_FIND_ARTIFACT) ||
- (quest[i].type == QUEST_TYPE_FIND_EXIT))
+ if ((q_ptr->type == QUEST_TYPE_FIND_ARTIFACT) ||
+ (q_ptr->type == QUEST_TYPE_FIND_EXIT))
continue;
/* Interesting quest */
- if ((quest[i].type == QUEST_TYPE_KILL_NUMBER) ||
- (quest[i].type == QUEST_TYPE_TOWER) ||
- (quest[i].type == QUEST_TYPE_KILL_ALL))
+ if ((q_ptr->type == QUEST_TYPE_KILL_NUMBER) ||
+ (q_ptr->type == QUEST_TYPE_TOWER) ||
+ (q_ptr->type == QUEST_TYPE_KILL_ALL))
break;
/* Interesting quest */
- if (((quest[i].type == QUEST_TYPE_KILL_LEVEL) ||
- (quest[i].type == QUEST_TYPE_KILL_ANY_LEVEL) ||
- (quest[i].type == QUEST_TYPE_RANDOM)) &&
- (quest[i].r_idx == m_ptr->r_idx))
+ if (((q_ptr->type == QUEST_TYPE_KILL_LEVEL) ||
+ (q_ptr->type == QUEST_TYPE_KILL_ANY_LEVEL) ||
+ (q_ptr->type == QUEST_TYPE_RANDOM)) &&
+ (q_ptr->r_idx == m_ptr->r_idx))
break;
}
if (quest_num && (quest[quest_num].status == QUEST_STATUS_TAKEN))
{
/* Current quest */
- i = quest_num;
+ quest_type* const q_ptr = &quest[quest_num];
- switch (quest[i].type)
+ switch (q_ptr->type)
{
case QUEST_TYPE_KILL_NUMBER:
{
- quest[i].cur_num++;
+ q_ptr->cur_num++;
- if (quest[i].cur_num >= quest[i].num_mon)
+ if (q_ptr->cur_num >= q_ptr->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(quest_num);
- quest[i].cur_num = 0;
+ q_ptr->cur_num = 0;
}
break;
}
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)
+ if (q_ptr->flags & QUEST_FLAG_SILENT)
{
- quest[i].status = QUEST_STATUS_FINISHED;
+ q_ptr->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(quest_num);
}
}
break;
case QUEST_TYPE_RANDOM:
{
/* Only count valid monsters */
- if (quest[i].r_idx != m_ptr->r_idx)
+ if (q_ptr->r_idx != m_ptr->r_idx)
break;
- quest[i].cur_num++;
+ q_ptr->cur_num++;
- if (quest[i].cur_num >= quest[i].max_num)
+ if (q_ptr->cur_num >= q_ptr->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;
- if (!(quest[i].flags & QUEST_FLAG_PRESET))
+ complete_quest(quest_num);
+
+ if (!(q_ptr->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))
+ if ((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT))
{
- quest[i].status = QUEST_STATUS_FINISHED;
+ q_ptr->status = QUEST_STATUS_FINISHED;
}
- if (quest[i].type == QUEST_TYPE_RANDOM)
+ if (q_ptr->type == QUEST_TYPE_RANDOM)
{
reward = TRUE;
- quest[i].status = QUEST_STATUS_FINISHED;
+ q_ptr->status = QUEST_STATUS_FINISHED;
}
}
break;
}
case QUEST_TYPE_KILL_ANY_LEVEL:
{
- quest[i].cur_num++;
- if (quest[i].cur_num >= quest[i].max_num)
+ q_ptr->cur_num++;
+ if (q_ptr->cur_num >= q_ptr->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);
- }
- quest[i].cur_num = 0;
+ complete_quest(quest_num);
+ q_ptr->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 */
+ q_ptr->status = QUEST_STATUS_STAGE_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;
/* Create a magical staircase */
if (create_stairs)
{
+ int ny, nx;
+
/* Stagger around */
while (cave_perma_bold(y, x) || cave[y][x].o_idx || (cave[y][x].info & CAVE_OBJECT) )
{
*/
if (reward)
{
- for (j = 0; j < (dun_level / 15)+1; j++)
+ int i;
+
+ for (i = 0; i < (dun_level / 15)+1; i++)
{
/* Get local object */
q_ptr = &forge;
}
+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
*/
break;
case MON_SURTUR:
- a_idx = ART_TWILIGHT;
- chance = 66;
+ if (!one_in_(3))
+ {
+ a_idx = ART_TWILIGHT;
+ chance = 100;
+ }
+ else
+ {
+ a_idx = ART_ORB_OF_FATE;
+ chance = 100;
+ }
break;
case MON_SARUMAN:
a_idx = ART_ROBIN_HOOD;
chance = 5;
break;
+
+ case MON_KOGAN:
+ a_idx = ART_NANACHO;
+ chance = 80;
+ break;
+
}
if ((a_idx > 0) && ((randint0(100) < chance) || p_ptr->wizard))
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);
bool innocent = TRUE, thief = FALSE;
int i;
int expdam;
+ int dealt_damage;
- 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);
+ (void)COPY(&exp_mon, m_ptr, monster_type);
+
+ expdam = (m_ptr->hp > dam) ? dam : m_ptr->hp;
- /* Genocided by chaos patron */
- if (!m_ptr->r_idx) m_idx = 0;
- }
+ get_exp_from_mon(expdam, &exp_mon);
+ /* Genocided by chaos patron */
+ if (!m_ptr->r_idx) m_idx = 0;
+
/* Redraw (later) if needed */
if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
/* 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)
delete_monster_idx(m_idx);
}
- /* 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);
+ get_exp_from_mon((long)exp_mon.max_maxhp*2, &exp_mon);
/* Not afraid */
(*fear) = FALSE;
n++;
- while(n < temp_n) /* Skip stairs which have defferent distance */
+ /* Skip stairs which have defferent distance */
+ for (; n < temp_n; ++ n)
{
cave_type *c_ptr = &cave[temp_y[n]][temp_x[n]];
- if (ch == '>')
- {
- if (cave_have_flag_grid(c_ptr, FF_LESS) ||
- cave_have_flag_grid(c_ptr, FF_QUEST_ENTER))
- n++;
- else
- break;
- }
- else /* if (ch == '<') */
+ if (cave_have_flag_grid(c_ptr, FF_STAIRS) &&
+ cave_have_flag_grid(c_ptr, ch == '>' ? FF_MORE : FF_LESS))
{
- if (cave_have_flag_grid(c_ptr, FF_MORE) ||
- cave_have_flag_grid(c_ptr, FF_QUEST_EXIT))
- n++;
- else
- break;
+ /* Found */
+ break;
}
}
{
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)
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)
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;
}