*.userprefs
# Build results
+[Ee]nglish-[Dd]ebug/
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
player_ptr->exit_bldg = FALSE;
reset_tim_flags(player_ptr);
-
- /* Save the surface floor as saved floor */
prepare_change_floor_mode(player_ptr, CFM_SAVE_FLOORS);
player_ptr->current_floor_ptr->inside_arena = TRUE;
deck[i] = i;
}
- /* shuffle cards */
for (int i = 0; i < 53; i++) {
int tmp1 = randint0(53 - i) + i;
int tmp2 = deck[i];
bool joker_is_used = FALSE;
bool straight = FALSE;
- /* get lowest */
for (int i = 0; i < 5; i++)
{
if (NUM_OF(cards[i]) < lowest && !IS_JOKER(cards[i]))
lowest = NUM_OF(cards[i]);
}
- /* Check Royal Straight Flush */
if (poker_hand_check_flush())
{
int i;
}
}
- if (i == 4) return 3; /* Wow! Royal Straight Flush!!! */
+ if (i == 4) return 3;
}
if (lowest == 9)
break;
}
- if (i == 3 && have_joker()) return 3; /* Wow! Royal Straight Flush!!! */
+ if (i == 3 && have_joker()) return 3;
}
}
joker_is_used = FALSE;
- /* Straight Only Check */
- /* (10 - J - Q - K)[JOKER] - A */
if (lowest == 0)
{
int i;
if (have_joker() && !joker_is_used)
joker_is_used = TRUE;
else
- break; /* None */
+ break;
}
}
else col = TERM_WHITE;
c_put_str(col, _("決定", "Sure"), 16, 38);
- /* Hilite current option */
if (hoge < 5) move_cursor(14, 5 + hoge * 16);
else move_cursor(16, 38);
}
*/
static int do_poker(void)
{
- int is_put[5]; /* 0:kaenai 1:kaeru */
+ int is_put[5];
bool done = FALSE;
bool decision = TRUE;
if (cmd == BACT_GAMBLE_RULES)
{
- /* Peruse the gambling help file */
(void)show_file(player_ptr, TRUE, _("jgambling.txt", "gambling.txt"), NULL, 0, 0);
screen_load();
return TRUE;
}
- /* No money */
if (player_ptr->au < 1)
{
msg_print(_("おい!おまえ一文なしじゃないか!こっから出ていけ!",
}
clear_bldg(5, 23);
-
maxbet = player_ptr->lev * 200;
-
- /* We can't bet more than we have */
maxbet = MIN(maxbet, player_ptr->au);
- /* Get the wager */
strcpy(out_val, "");
sprintf(tmp_str, _("賭け金 (1-%ld)?", "Your wager (1-%ld) ? "), (long int)maxbet);
return TRUE;
}
- /* Strip spaces */
for (p = out_val; *p == ' '; p++);
- /* Get the wager */
wager = atol(p);
-
if (wager > player_ptr->au)
{
msg_print(_("おい!金が足りないじゃないか!出ていけ!", "Hey! You don't have the gold - get out of here!"));
return FALSE;
}
- int i;
-
clear_bldg(4, 10);
prt(_("モンスター 倍率",
"Monsters Odds"), 4, 4);
- for (i = 0; i < 4; i++)
+ for (int i = 0; i < 4; i++)
{
char buf[80];
monster_race *r_ptr = &r_info[battle_mon[i]];
prt(_("どれに賭けますか:", "Which monster: "), 0, 0);
while (TRUE)
{
- i = inkey();
+ int i = inkey();
if (i == ESCAPE)
{
}
clear_bldg(4, 4);
- for (i = 0; i < 4; i++)
+ for (int i = 0; i < 4; i++)
if (i != sel_monster) clear_bldg(i + 5, i + 5);
maxbet = player_ptr->lev * 200;
return FALSE;
}
- /* Strip spaces */
for (p = out_val; *p == ' '; p++);
- /* Get the wager */
wager = atol(p);
-
if (wager > player_ptr->au)
{
msg_print(_("おい!金が足りないじゃないか!出ていけ!", "Hey! You don't have the gold - get out of here!"));
player_ptr->au -= wager;
reset_tim_flags(player_ptr);
- /* Save the surface floor as saved floor */
prepare_change_floor_mode(player_ptr, CFM_SAVE_FLOORS);
player_ptr->phase_out = TRUE;
GAME_TEXT o_name[MAX_NLEN];
object_type *o_ptr;
- /* Loop for inventory and right/left arm */
for (INVENTORY_IDX i = 0; i <= INVEN_LARM; i++)
{
o_ptr = &player_ptr->inventory_list[i];
-
- /* Living Tsuchinoko worthes $1000000 */
if ((o_ptr->tval == TV_CAPTURE) && (o_ptr->pval == MON_TSUCHINOKO))
{
char buf[MAX_NLEN + 20];
player_ptr->redraw |= (PR_GOLD);
vary_item(player_ptr, i, -o_ptr->number);
}
+
change = TRUE;
}
}
for (INVENTORY_IDX i = 0; i < INVEN_PACK; i++)
{
o_ptr = &player_ptr->inventory_list[i];
-
- /* Corpse of Tsuchinoko worthes $200000 */
if ((o_ptr->tval == TV_CORPSE) && (o_ptr->sval == SV_CORPSE) && (o_ptr->pval == MON_TSUCHINOKO))
{
char buf[MAX_NLEN + 20];
player_ptr->redraw |= (PR_GOLD);
vary_item(player_ptr, i, -o_ptr->number);
}
+
change = TRUE;
}
}
for (INVENTORY_IDX i = 0; i < INVEN_PACK; i++)
{
o_ptr = &player_ptr->inventory_list[i];
-
- /* Bones of Tsuchinoko worthes $100000 */
if ((o_ptr->tval == TV_CORPSE) && (o_ptr->sval == SV_SKELETON) && (o_ptr->pval == MON_TSUCHINOKO))
{
char buf[MAX_NLEN + 20];
player_ptr->redraw |= (PR_GOLD);
vary_item(player_ptr, i, -o_ptr->number);
}
+
change = TRUE;
}
}
sprintf(buf, _("%sを渡しますか?", "Hand %s over? "), o_name);
if (!get_check(buf)) continue;
- /* Hand it first */
vary_item(player_ptr, i, -o_ptr->number);
-
chg_virtue(player_ptr, V_JUSTICE, 5);
current_world_ptr->bounty_r_idx[j] += 10000;
- /* Count number of unique corpses already handed */
for (num = 0, k = 0; k < MAX_BOUNTY; k++)
{
if (current_world_ptr->bounty_r_idx[k] >= 10000) num++;
msg_format(_("これで合計 %d ポイント獲得しました。", "You earned %d point%s total."), num, (num > 1 ? "s" : ""));
- /* Prepare to make a prize */
object_prep(&forge, lookup_kind(prize_list[num - 1].tval, prize_list[num - 1].sval));
apply_magic(player_ptr, &forge, player_ptr->current_floor_ptr->object_level, AM_NO_FIXED_ART);
* there is at least one empty slot.
*/
item_new = inven_carry(player_ptr, &forge);
-
object_desc(player_ptr, o_name, &forge, 0);
msg_format(_("%s(%c)を貰った。", "You get %s (%c). "), o_name, index_to_label(item_new));
- /* Auto-inscription */
autopick_alter_item(player_ptr, item_new, FALSE);
handle_stuff(player_ptr);
-
change = TRUE;
}
}
{
msg_print(_("眠りに就くと恐ろしい光景が心をよぎった。", "Horrible visions flit through your mind as you sleep."));
- /* Have some nightmares */
while (TRUE)
{
sanity_blast(customer_ptr, NULL, FALSE);
quest_text_line = 0;
- /* Set the quest number temporary */
floor_type *floor_ptr = player_ptr->current_floor_ptr;
QUEST_IDX old_quest = floor_ptr->inside_quest;
floor_ptr->inside_quest = questnum;
- /* Get the quest text */
init_flags = INIT_SHOW_TEXT;
if (do_init) init_flags |= INIT_ASSIGN;
process_dungeon_file(player_ptr, "q_info.txt", 0, 0, 0, 0);
-
- /* Reset the old quest number */
floor_ptr->inside_quest = old_quest;
- /* Print the quest info */
GAME_TEXT tmp_str[80];
sprintf(tmp_str, _("クエスト情報 (危険度: %d 階相当)", "Quest Information (Danger level: %d)"), (int)quest[questnum].level);
-
prt(tmp_str, 5, 0);
-
prt(quest[questnum].name, 7, 0);
for (int i = 0; i < 10; i++)
if (q_ptr->r_idx == 0)
{
- /* Random monster at least 5 - 10 levels out of deep */
q_ptr->r_idx = get_mon_num(player_ptr, q_ptr->level + 4 + randint1(6));
}
monster_race *r_ptr;
r_ptr = &r_info[q_ptr->r_idx];
-
while ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->rarity != 1))
{
q_ptr->r_idx = get_mon_num(player_ptr, q_ptr->level) + 4 + randint1(6);
if (q_ptr->max_num == 0)
{
- /* Random monster number */
if (randint1(10) > 7)
q_ptr->max_num = 1;
else
bool force = FALSE;
bool dokubari = FALSE;
- /* Effective dices */
int eff_dd = o_ptr->dd + owner_ptr->to_dd[0];
int eff_ds = o_ptr->ds + owner_ptr->to_ds[0];
int vorpal_div = 1;
int dmg_bonus = o_ptr->to_d + owner_ptr->to_d[0];
-
- /* Get the flags of the weapon */
object_flags(o_ptr, flgs);
-
if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_POISON_NEEDLE)) dokubari = TRUE;
-
- /* Show Critical Damage*/
mindam = calc_expect_crit(owner_ptr, o_ptr->weight, o_ptr->to_h, mindice, owner_ptr->to_h[0], dokubari);
maxdam = calc_expect_crit(owner_ptr, o_ptr->weight, o_ptr->to_h, maxdice, owner_ptr->to_h[0], dokubari);
-
show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("会心:", "Critical:"), TERM_L_RED);
-
-
- /* Vorpal Hit*/
if ((have_flag(flgs, TR_VORPAL) || hex_spelling(owner_ptr, HEX_RUNESWORD)))
{
if ((o_ptr->name1 == ART_VORPAL_BLADE) || (o_ptr->name1 == ART_CHAINSWORD))
show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("理力:", "Force :"), TERM_L_BLUE);
}
- /* Print the relevant lines */
if (have_flag(flgs, TR_KILL_ANIMAL))
{
mindam = calc_expect_dice(owner_ptr, mindice, 4, 1, force, o_ptr->weight, o_ptr->to_h, owner_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
DICE_SID eff_ds = o_ptr->ds + player_ptr->to_ds[0];
HIT_RELIABILITY reli = player_ptr->skill_thn + (player_ptr->to_h[0] + o_ptr->to_h) * BTH_PLUS_ADJ;
- /* Print the weapon name */
object_desc(player_ptr, o_name, o_ptr, OD_NAME_ONLY);
c_put_str(TERM_YELLOW, o_name, row, col);
-
- /* Print the player's number of blows */
sprintf(tmp_str, _("攻撃回数: %d", "Number of Blows: %d"), player_ptr->num_blow[0]);
put_str(tmp_str, row + 1, col);
- /* Print to_hit and to_dam of the weapon */
sprintf(tmp_str, _("命中率: 0 50 100 150 200 (敵のAC)", "To Hit: 0 50 100 150 200 (AC)"));
put_str(tmp_str, row + 2, col);
-
- /* Print the weapons base damage dice */
sprintf(tmp_str, " %2d %2d %2d %2d %2d (%%)",
(int)hit_chance(player_ptr, reli, 0),
(int)hit_chance(player_ptr, reli, 50),
put_str(tmp_str, row + 3, col);
c_put_str(TERM_YELLOW, _("可能なダメージ:", "Possible Damage:"), row + 5, col);
- /* Damage for one blow (if it hits) */
sprintf(tmp_str, _("攻撃一回につき %d-%d", "One Strike: %d-%d damage"),
(int)(eff_dd + o_ptr->to_d + player_ptr->to_d[0]),
(int)(eff_ds * eff_dd + o_ptr->to_d + player_ptr->to_d[0]));
put_str(tmp_str, row + 6, col + 1);
- /* Damage for the complete attack (if all blows hit) */
sprintf(tmp_str, _("1ターンにつき %d-%d", "One Attack: %d-%d damage"),
(int)(player_ptr->num_blow[0] * (eff_dd + o_ptr->to_d + player_ptr->to_d[0])),
(int)(player_ptr->num_blow[0] * (eff_ds * eff_dd + o_ptr->to_d + player_ptr->to_d[0])));
screen_save();
clear_bldg(0, 22);
-
- /* Store copy of original wielded weapon */
i_ptr = &customer_ptr->inventory_list[INVEN_RARM];
object_copy(&orig_weapon, i_ptr);
item_tester_hook = item_tester_hook_orthodox_melee_weapons;
-
- /* Get the first weapon */
concptr q = _("第一の武器は?", "What is your first weapon? ");
concptr s = _("比べるものがありません。", "You have nothing to compare.");
while (TRUE)
{
clear_bldg(0, 22);
-
- /* Only compare melee weapons */
item_tester_hook = item_tester_hook_orthodox_melee_weapons;
-
- /* Hack -- prevent "icky" message */
current_world_ptr->character_xtra = TRUE;
-
- /* Diaplay selected weapon's infomation */
for (int i = 0; i < n; i++)
{
int col = (wid * i + mgn);
-
- /* Copy i-th weapon into the weapon slot (if it's not already there) */
if (o_ptr[i] != i_ptr) object_copy(i_ptr, o_ptr[i]);
customer_ptr->update |= PU_BONUS;
handle_stuff(customer_ptr);
- /* List the new values */
list_weapon(customer_ptr, o_ptr[i], row, col);
compare_weapon_aux(customer_ptr, o_ptr[i], col, row + 8);
-
- /* Copy back the original weapon into the weapon slot */
object_copy(i_ptr, &orig_weapon);
}
- /* Reset the values for the old weapon */
customer_ptr->update |= PU_BONUS;
handle_stuff(customer_ptr);
current_world_ptr->character_xtra = old_character_xtra;
-
#ifdef JP
put_str(format("[ 比較対象: 's'で変更 ($%d) ]", cost), 1, (wid + mgn));
put_str("(一番高いダメージが適用されます。複数の倍打効果は足し算されません。)", row + 4, 0);
flush();
ch = inkey();
-
if (ch != 's') break;
if (total + cost > customer_ptr->au)
q = _("第二の武器は?", "What is your second weapon? ");
s = _("比べるものがありません。", "You have nothing to compare.");
-
- /* Get the second weapon */
OBJECT_IDX item2;
o_ptr[1] = choose_object(customer_ptr, &item2, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT), 0);
if (!o_ptr[1]) continue;
cost = bcost / 2;
n = 2;
}
- screen_load();
+ screen_load();
return total;
}
DEPTH lvl;
char buf[80 * 20], *t;
- /* AC lower than zero has no effect */
if (iAC < 0) iAC = 0;
- /* ダメージ軽減率を計算 */
protection = 100 * MIN(iAC, 150) / 250;
-
screen_save();
clear_bldg(0, 22);
put_str(format("%3d", average), row + 2, col);
}
- /* Display note */
roff_to_buf(memo, 70, buf, sizeof(buf));
for (t = buf; t[0]; t += strlen(t) + 1)
put_str(t, (row++) + 4, 4);
concptr q = _("どの折れた武器を修復しますか?", "Repair which broken weapon? ");
concptr s = _("修復できる折れた武器がありません。", "You have no broken weapon to repair.");
-
- /* Only forge broken weapons */
item_tester_hook = item_tester_hook_broken_weapon;
OBJECT_IDX item;
o_ptr = choose_object(player_ptr, &item, q, s, (USE_INVEN | USE_EQUIP), 0);
if (!o_ptr) return 0;
- /* It is worthless */
if (!object_is_ego(o_ptr) && !object_is_artifact(o_ptr))
{
msg_format(_("それは直してもしょうがないぜ。", "It is worthless to repair."));
return 0;
}
- /* They are too many */
if (o_ptr->number > 1)
{
msg_format(_("一度に複数を修復することはできません!", "They are too many to repair at once!"));
return 0;
}
- /* Display item name */
char basenm[MAX_NLEN];
object_desc(player_ptr, basenm, o_ptr, OD_NAME_ONLY);
prt(format(_("修復する武器 : %s", "Repairing: %s"), basenm), row + 3, 2);
q = _("材料となる武器は?", "Which weapon for material? ");
s = _("材料となる武器がありません。", "You have no material to repair.");
- /* Only forge broken weapons */
item_tester_hook = item_tester_hook_orthodox_melee_weapons;
-
OBJECT_IDX mater;
object_type *mo_ptr;
mo_ptr = choose_object(player_ptr, &mater, q, s, (USE_INVEN | USE_EQUIP), 0);
return 0;
}
- /* Display item name */
object_desc(player_ptr, basenm, mo_ptr, OD_NAME_ONLY);
prt(format(_("材料とする武器: %s", "Material : %s"), basenm), row + 4, 2);
-
- /* Get the value of one of the items (except curses) */
PRICE cost = bcost + object_value_real(o_ptr) * 2;
-
if (!get_check(format(_("$%dかかりますがよろしいですか? ", "Costs %d gold, okay? "), cost))) return 0;
- /* Check if the player has enough money */
if (player_ptr->au < cost)
{
object_desc(player_ptr, basenm, o_ptr, OD_NAME_ONLY);
}
player_ptr->total_weight -= o_ptr->weight;
-
KIND_OBJECT_IDX k_idx;
if (o_ptr->sval == SV_BROKEN_DAGGER)
{
- KIND_OBJECT_IDX j;
int n = 1;
-
- /* Suppress compiler warning */
k_idx = 0;
-
- for (j = 1; j < max_k_idx; j++)
+ for (KIND_OBJECT_IDX j = 1; j < max_k_idx; j++)
{
object_kind *k_aux_ptr = &k_info[j];
}
}
}
- else /* TV_BROKEN_SWORD */
+ else
{
- /* Repair to a sword or sometimes material's type weapon */
OBJECT_TYPE_VALUE tval = (one_in_(5) ? mo_ptr->tval : TV_SWORD);
-
while (TRUE)
{
object_kind *ck_ptr;
-
k_idx = lookup_kind(tval, SV_ANY);
ck_ptr = &k_info[k_idx];
}
}
- /* Calculate dice bonuses */
int dd_bonus = o_ptr->dd - k_info[o_ptr->k_idx].dd;
int ds_bonus = o_ptr->ds - k_info[o_ptr->k_idx].ds;
dd_bonus += mo_ptr->dd - k_info[mo_ptr->k_idx].dd;
ds_bonus += mo_ptr->ds - k_info[mo_ptr->k_idx].ds;
- /* Change base object */
object_kind *k_ptr;
k_ptr = &k_info[k_idx];
o_ptr->k_idx = k_idx;
o_ptr->dd = k_ptr->dd;
o_ptr->ds = k_ptr->ds;
- /* Copy base object's ability */
for (int i = 0; i < TR_FLAG_SIZE; i++) o_ptr->art_flags[i] |= k_ptr->flags[i];
if (k_ptr->pval) o_ptr->pval = MAX(o_ptr->pval, randint1(k_ptr->pval));
if (have_flag(k_ptr->flags, TR_ACTIVATE)) o_ptr->xtra2 = (byte_hack)k_ptr->act_idx;
o_ptr->pval = MIN(o_ptr->pval, bmax);
}
- /* Add one random ability from material weapon */
give_one_ability_of_object(o_ptr, mo_ptr);
-
- /* Add to-dam, to-hit and to-ac from material weapon */
o_ptr->to_d += MAX(0, (mo_ptr->to_d / 3));
o_ptr->to_h += MAX(0, (mo_ptr->to_h / 3));
o_ptr->to_a += MAX(0, (mo_ptr->to_a));
(object_is_random_artifact(o_ptr) && one_in_(1)) ||
(object_is_ego(o_ptr) && one_in_(7)))
{
- /* Forge it */
if (object_is_ego(o_ptr))
{
add_flag(o_ptr->art_flags, TR_IGNORE_FIRE);
add_flag(o_ptr->art_flags, TR_IGNORE_ACID);
}
- /* Add one random ability from material weapon */
give_one_ability_of_object(o_ptr, mo_ptr);
-
- /* Add one random activation */
if (!activation_index(o_ptr)) one_activation(o_ptr);
- /* Narsil */
if (o_ptr->name1 == ART_NARSIL)
{
one_high_resistance(o_ptr);
msg_format("Repaired into %s for %d gold.", basenm, cost);
#endif
msg_print(NULL);
-
- /* Remove BROKEN flag */
o_ptr->ident &= ~(IDENT_BROKEN);
-
- /* Add repaired flag */
o_ptr->discount = 99;
player_ptr->total_weight += o_ptr->weight;
calc_android_exp(player_ptr);
-
- /* Decrease material object */
inven_item_increase(player_ptr, mater, -1);
inven_item_optimize(player_ptr, mater);
o_ptr = choose_object(player_ptr, &item, q, s, (USE_INVEN | USE_EQUIP | IGNORE_BOTHHAND_SLOT), item_tester_tval);
if (!o_ptr) return FALSE;
- /* Check if the player has enough money */
char tmp_str[MAX_NLEN];
if (player_ptr->au < (cost * o_ptr->number))
{
return FALSE;
}
- /* Enchant to hit */
bool okay = FALSE;
for (int i = 0; i < to_hit; i++)
{
}
}
- /* Enchant to damage */
for (int i = 0; i < to_dam; i++)
{
if ((o_ptr->to_d < maxenchant) && enchant(player_ptr, o_ptr, 1, (ENCH_TODAM | ENCH_FORCE)))
}
}
- /* Enchant to AC */
for (int i = 0; i < to_ac; i++)
{
if ((o_ptr->to_a < maxenchant) && enchant(player_ptr, o_ptr, 1, (ENCH_TOAC | ENCH_FORCE)))
}
}
- /* Failure */
if (!okay)
{
if (flush_failure) flush();
object_desc(player_ptr, tmp_str, o_ptr, 0);
msg_format(_("%s です。", "You have: %s."), tmp_str);
- /* Auto-inscription */
autopick_alter_item(player_ptr, item, FALSE);
-
- /* Update the gold display */
building_prt_gold(player_ptr);
}
return;
}
- /* Extract the object "level" */
DEPTH lev = k_info[o_ptr->k_idx].level;
PRICE price;
if (o_ptr->tval == TV_ROD)
{
if (o_ptr->timeout > 0)
{
- /* Fully recharge */
price = (lev * 50 * o_ptr->timeout) / k_ptr->pval;
}
else
{
- /* No recharge necessary */
price = 0;
msg_format(_("それは再充填する必要はありません。", "That doesn't need to be recharged."));
return;
price = MAX(10, price);
}
- /* Limit the number of charges for wands and staffs */
if (o_ptr->tval == TV_WAND
&& (o_ptr->pval / o_ptr->number >= k_ptr->pval))
{
return;
}
- /* Check if the player has enough money */
if (player_ptr->au < price)
{
object_desc(player_ptr, tmp_str, o_ptr, OD_NAME_ONLY);
#endif
{
- /* Recharge fully */
o_ptr->timeout = 0;
}
else
else
max_charges = o_ptr->number * k_ptr->pval - o_ptr->pval;
- /* Get the quantity for staves and wands */
charges = (PARAMETER_VALUE)get_quantity(format(_("一回分$%d で何回分充填しますか?", "Add how many charges for %d gold? "), price),
MIN(player_ptr->au / price, max_charges));
- /* Do nothing */
if (charges < 1) return;
price *= charges;
object_type *o_ptr;
o_ptr = &player_ptr->inventory_list[i];
- /* skip non magic device */
if (o_ptr->tval < TV_STAFF || o_ptr->tval > TV_ROD) continue;
-
- /* need identified */
if (!object_is_known(o_ptr)) total_cost += 50;
- /* Extract the object "level" */
DEPTH lev = k_info[o_ptr->k_idx].level;
object_kind *k_ptr;
k_ptr = &k_info[o_ptr->k_idx];
break;
case TV_STAFF:
- /* Price per charge ( = double the price paid by shopkeepers for the charge) */
price = (k_info[o_ptr->k_idx].cost / 10) * o_ptr->number;
-
- /* Pay at least 10 gold per charge */
price = MAX(10, price);
-
- /* Fully charge */
price = (k_ptr->pval - o_ptr->pval) * price;
break;
case TV_WAND:
- /* Price per charge ( = double the price paid by shopkeepers for the charge) */
price = (k_info[o_ptr->k_idx].cost / 10);
-
- /* Pay at least 10 gold per charge */
price = MAX(10, price);
-
- /* Fully charge */
price = (o_ptr->number * k_ptr->pval - o_ptr->pval) * price;
break;
}
- /* if price <= 0 then item have enough charge */
if (price > 0) total_cost += price;
}
return;
}
- /* Check if the player has enough money */
if (player_ptr->au < total_cost)
{
msg_format(_("すべてのアイテムを再充填するには$%d 必要です!", "You need %d gold to recharge all items!"), total_cost);
object_kind *k_ptr;
k_ptr = &k_info[o_ptr->k_idx];
- /* skip non magic device */
if (o_ptr->tval < TV_STAFF || o_ptr->tval > TV_ROD) continue;
if (!object_is_known(o_ptr))
{
identify_item(player_ptr, o_ptr);
-
- /* Auto-inscription */
autopick_alter_item(player_ptr, i, FALSE);
}
- /* Recharge */
switch (o_ptr->tval)
{
case TV_ROD:
break;
case TV_STAFF:
if (o_ptr->pval < k_ptr->pval) o_ptr->pval = k_ptr->pval;
- /* We no longer think the item is empty */
+
o_ptr->ident &= ~(IDENT_EMPTY);
break;
case TV_WAND:
if (o_ptr->pval < o_ptr->number * k_ptr->pval)
o_ptr->pval = o_ptr->number * k_ptr->pval;
- /* We no longer think the item is empty */
+
o_ptr->ident &= ~(IDENT_EMPTY);
break;
}
player_ptr->au -= total_cost;
}
+
/*!
* @brief 施設でモンスターの情報を知るメインルーチン / research_mon -KMW-
* @param player_ptr プレーヤーへの参照ポインタ
u16b why = 0;
MONSTER_IDX *who;
- /* XTRA HACK WHATSEARCH */
bool all = FALSE;
bool uniq = FALSE;
bool norm = FALSE;
char temp[80] = "";
- /* XTRA HACK REMEMBER_IDX */
static int old_sym = '\0';
static IDX old_i = 0;
-
screen_save();
- /* Get a character, or abort */
char sym;
if (!get_com(_("モンスターの文字を入力して下さい(記号 or ^A全,^Uユ,^N非ユ,^M名前):",
"Enter character to be identified(^A:All,^U:Uniqs,^N:Non uniqs,^M:Name): "), &sym, FALSE))
return FALSE;
}
- /* Find that character info, and describe it */
IDX i;
for (i = 0; ident_info[i]; ++i)
{
C_MAKE(who, max_r_idx, MONRACE_IDX);
/* Collect matching monsters */
- int n;
- for (n = 0, i = 1; i < max_r_idx; i++)
+ int n = 0;
+ for (i = 1; i < max_r_idx; i++)
{
monster_race *r_ptr = &r_info[i];
}
}
- /* Nothing to recall */
- if (!n)
+ if (n == 0)
{
- /* Free the "who" array */
C_KILL(who, max_r_idx, MONRACE_IDX);
screen_load();
return FALSE;
}
- /* Sort by level */
why = 2;
char query = 'y';
- /* Sort if needed */
if (why)
{
ang_sort(who, &why, n, ang_sort_comp_hook, ang_sort_swap_hook);
}
- /* Start at the end */
- /* XTRA HACK REMEMBER_IDX */
if (old_sym == sym && old_i < n) i = old_i;
else i = n - 1;
notpicked = TRUE;
-
- /* Scan the monster memory */
MONRACE_IDX r_idx;
while (notpicked)
{
r_idx = who[i];
-
- /* Hack -- Begin the prompt */
roff_top(r_idx);
-
- /* Hack -- Complete the prompt */
Term_addstr(-1, TERM_WHITE, _(" ['r'思い出, ' 'で続行, ESC]", " [(r)ecall, ESC, space to continue]"));
-
- /* Interact */
while (TRUE)
{
if (recall)
{
- /*** Recall on screen ***/
-
- /* Get maximal info about this monster */
lore_do_probe(player_ptr, r_idx);
-
- /* Save this monster ID */
monster_race_track(player_ptr, r_idx);
handle_stuff(player_ptr);
-
- /* know every thing mode */
screen_roff(player_ptr, r_idx, 0x01);
notpicked = FALSE;
-
- /* XTRA HACK REMEMBER_IDX */
old_sym = sym;
old_i = i;
}
query = inkey();
-
- /* Normal commands */
if (query != 'r') break;
recall = !recall;
}
- /* Stop scanning */
if (query == ESCAPE) break;
- /* Move to "prev" monster */
if (query == '-')
{
if (++i == n)
return;
}
- /* check gold (HACK - Recharge uses variable costs) */
BACT_IDX bact = bldg->actions[i];
if ((bact != BACT_RECHARGE) &&
(((bldg->member_costs[i] > player_ptr->au) && is_owner(player_ptr, bldg)) ||
case BACT_RECHARGE_ALL:
building_recharge_all(player_ptr);
break;
- case BACT_IDENTS: /* needs work */
+ case BACT_IDENTS:
if (!get_check(_("持ち物を全て鑑定してよろしいですか?", "Do you pay for identify all your possession? "))) break;
identify_pack(player_ptr);
msg_print(_(" 持ち物全てが鑑定されました。", "Your possessions have been identified."));
paid = TRUE;
break;
- case BACT_IDENT_ONE: /* needs work */
+ case BACT_IDENT_ONE:
paid = ident_spell(player_ptr, FALSE);
break;
case BACT_LEARN:
do_cmd_study(player_ptr);
break;
- case BACT_HEALING: /* needs work */
+ case BACT_HEALING:
paid = cure_critical_wounds(player_ptr, 200);
break;
- case BACT_RESTORE: /* needs work */
+ case BACT_RESTORE:
paid = restore_all_status(player_ptr);
break;
case BACT_ENCHANT_ARROWS:
building_type *bldg;
bldg = &building[which];
- /* Don't re-init the wilderness */
reinit_wilderness = FALSE;
if ((which == 2) && (player_ptr->arena_number < 0))
}
else
{
- /* Don't save the arena as saved floor */
prepare_change_floor_mode(player_ptr, CFM_SAVE_FLOORS | CFM_NO_RETURN);
-
player_ptr->current_floor_ptr->inside_arena = FALSE;
player_ptr->leaving = TRUE;
-
- /* Re-enter the arena */
command_new = SPECIAL_KEY_BUILDING;
-
- /* No energy needed to re-enter the arena */
free_turn(player_ptr);
}
}
else if (player_ptr->phase_out)
{
- /* Don't save the arena as saved floor */
prepare_change_floor_mode(player_ptr, CFM_SAVE_FLOORS | CFM_NO_RETURN);
-
player_ptr->leaving = TRUE;
player_ptr->phase_out = FALSE;
-
- /* Re-enter the monster arena */
command_new = SPECIAL_KEY_BUILDING;
-
- /* No energy needed to re-enter the arena */
free_turn(player_ptr);
-
return;
}
else
forget_lite(player_ptr->current_floor_ptr);
forget_view(player_ptr->current_floor_ptr);
-
- /* Hack -- Increase "icky" depth */
current_world_ptr->character_icky++;
command_arg = 0;
show_building(player_ptr, bldg);
player_ptr->leave_bldg = FALSE;
-
play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_BUILD);
bool validcmd;
msg_flag = FALSE;
msg_erase();
- /* Reinit wilderness to activate quests ... */
if (reinit_wilderness) player_ptr->leaving = TRUE;
- /* Hack -- Decrease "icky" depth */
current_world_ptr->character_icky--;
-
Term_clear();
player_ptr->update |= (PU_VIEW | PU_MONSTERS | PU_BONUS | PU_LITE | PU_MON_LITE);
}
}
- /* Sort them */
for (int i = 0; i < MAX_BOUNTY - 1; i++)
{
for (int j = i; j < MAX_BOUNTY; j++)
"are included in all such copies."
};
-bool can_save = FALSE; /* Game can be saved */
+bool can_save = FALSE;
COMMAND_CODE now_message;
-bool repair_monsters; /* Hack -- optimize detect monsters */
-bool repair_objects; /* Hack -- optimize detect objects */
+bool repair_monsters;
+bool repair_objects;
-concptr ANGBAND_SYS = "xxx"; //!< Hack -- The special Angband "System Suffix" This variable is used to choose an appropriate "pref-xxx" file
+concptr ANGBAND_SYS = "xxx";
#ifdef JP
-concptr ANGBAND_KEYBOARD = "JAPAN"; //!< Hack -- The special Angband "Keyboard Suffix" This variable is used to choose an appropriate macro-trigger definition
+concptr ANGBAND_KEYBOARD = "JAPAN";
#else
concptr ANGBAND_KEYBOARD = "0";
#endif
-concptr ANGBAND_GRAF = "ascii"; //!< Hack -- The special Angband "Graphics Suffix" This variable is used to choose an appropriate "graf-xxx" file
+concptr ANGBAND_GRAF = "ascii";
static bool load = TRUE; /*!<ロード処理中の分岐フラグ*/
static int wild_regen = 20; /*!<広域マップ移動時の自然回復処理カウンタ(広域マップ1マス毎に20回処理を基本とする)*/
byte feel;
object_type *o_ptr = &creature_ptr->inventory_list[slot];
GAME_TEXT o_name[MAX_NLEN];
-
- /* We know about it already, do not tell us again */
if (o_ptr->ident & (IDENT_SENSE))return;
-
- /* It is fully known, no information needed */
if (object_is_known(o_ptr)) return;
- /* Check for a feeling */
feel = (heavy ? value_check_aux1(o_ptr) : value_check_aux2(o_ptr));
-
- /* Skip non-feelings */
if (!feel) return;
- /* Bad luck */
if ((creature_ptr->muta3 & MUT3_BAD_LUCK) && !randint0(13))
{
switch (feel)
}
}
- /* Stop everything */
if (disturb_minor) disturb(creature_ptr, FALSE, FALSE);
- /* Get an object description */
object_desc(creature_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
-
- /* Message (equipment) */
if (slot >= INVEN_RARM)
{
#ifdef JP
}
o_ptr->ident |= (IDENT_SENSE);
-
- /* Set the "inscription" */
o_ptr->feeling = feel;
- /* Auto-inscription/destroy */
autopick_alter_item(creature_ptr, slot, destroy_feeling);
creature_ptr->update |= (PU_COMBINE | PU_REORDER);
creature_ptr->window |= (PW_INVEN | PW_EQUIP);
*/
static void sense_inventory1(player_type *creature_ptr)
{
- INVENTORY_IDX i;
PLAYER_LEVEL plev = creature_ptr->lev;
bool heavy = FALSE;
object_type *o_ptr;
-
-
- /*** Check for "sensing" ***/
-
- /* No sensing when confused */
if (creature_ptr->confused) return;
- /* Analyze the class */
switch (creature_ptr->pclass)
{
case CLASS_WARRIOR:
case CLASS_SAMURAI:
case CLASS_CAVALRY:
{
- /* Good sensing */
if (0 != randint0(9000L / (plev * plev + 40))) return;
- /* Heavy sensing */
heavy = TRUE;
-
break;
}
-
case CLASS_SMITH:
{
- /* Good sensing */
if (0 != randint0(6000L / (plev * plev + 50))) return;
- /* Heavy sensing */
heavy = TRUE;
-
break;
}
-
case CLASS_MAGE:
case CLASS_HIGH_MAGE:
case CLASS_SORCERER:
case CLASS_MAGIC_EATER:
{
- /* Very bad (light) sensing */
if (0 != randint0(240000L / (plev + 5))) return;
break;
}
-
case CLASS_PRIEST:
case CLASS_BARD:
{
- /* Good (light) sensing */
if (0 != randint0(10000L / (plev * plev + 40))) return;
break;
}
-
case CLASS_ROGUE:
case CLASS_NINJA:
{
- /* Okay sensing */
if (0 != randint0(20000L / (plev * plev + 40))) return;
- /* Heavy sensing */
heavy = TRUE;
-
break;
}
-
case CLASS_RANGER:
{
- /* Bad sensing */
if (0 != randint0(95000L / (plev * plev + 40))) return;
- /* Changed! */
heavy = TRUE;
-
break;
}
-
case CLASS_PALADIN:
case CLASS_SNIPER:
{
- /* Bad sensing */
if (0 != randint0(77777L / (plev * plev + 40))) return;
- /* Heavy sensing */
heavy = TRUE;
-
break;
}
-
case CLASS_WARRIOR_MAGE:
case CLASS_RED_MAGE:
{
- /* Bad sensing */
if (0 != randint0(75000L / (plev * plev + 40))) return;
break;
}
-
case CLASS_MINDCRAFTER:
case CLASS_IMITATOR:
case CLASS_BLUE_MAGE:
case CLASS_MIRROR_MASTER:
{
- /* Bad sensing */
if (0 != randint0(55000L / (plev * plev + 40))) return;
break;
}
-
case CLASS_CHAOS_WARRIOR:
{
- /* Bad sensing */
if (0 != randint0(80000L / (plev * plev + 40))) return;
- /* Changed! */
heavy = TRUE;
-
break;
}
-
case CLASS_MONK:
case CLASS_FORCETRAINER:
{
- /* Okay sensing */
if (0 != randint0(20000L / (plev * plev + 40))) return;
break;
}
-
case CLASS_TOURIST:
{
- /* Good sensing */
if (0 != randint0(20000L / ((plev + 50)*(plev + 50)))) return;
- /* Heavy sensing */
heavy = TRUE;
-
break;
}
-
case CLASS_BEASTMASTER:
{
- /* Bad sensing */
if (0 != randint0(65000L / (plev * plev + 40))) return;
break;
}
case CLASS_BERSERKER:
{
- /* Heavy sensing */
heavy = TRUE;
-
break;
}
}
if (compare_virtue(creature_ptr, V_KNOWLEDGE, 100, VIRTUE_LARGE)) heavy = TRUE;
- /*** Sense everything ***/
-
- /* Check everything */
- for (i = 0; i < INVEN_TOTAL; i++)
+ for (INVENTORY_IDX i = 0; i < INVEN_TOTAL; i++)
{
bool okay = FALSE;
o_ptr = &creature_ptr->inventory_list[i];
- /* Skip empty slots */
if (!o_ptr->k_idx) continue;
- /* Valid "tval" codes */
switch (o_ptr->tval)
{
case TV_SHOT:
}
}
- /* Skip non-sense machines */
if (!okay) continue;
-
- /* Occasional failure on creature_ptr->inventory_list items */
if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
- /* Good luck */
if ((creature_ptr->muta3 & MUT3_GOOD_LUCK) && !randint0(13))
{
heavy = TRUE;
}
}
+
/*!
* @brief 1プレイヤーターン毎に武器、防具以外の擬似鑑定が行われるかを判定する。
* @return なし
*/
static void sense_inventory2(player_type *creature_ptr)
{
- INVENTORY_IDX i;
PLAYER_LEVEL plev = creature_ptr->lev;
object_type *o_ptr;
-
- /*** Check for "sensing" ***/
-
- /* No sensing when confused */
if (creature_ptr->confused) return;
- /* Analyze the class */
switch (creature_ptr->pclass)
{
case CLASS_WARRIOR:
{
return;
}
-
case CLASS_SMITH:
case CLASS_PALADIN:
case CLASS_CHAOS_WARRIOR:
case CLASS_BEASTMASTER:
case CLASS_NINJA:
{
- /* Very bad (light) sensing */
if (0 != randint0(240000L / (plev + 5))) return;
break;
}
-
case CLASS_RANGER:
case CLASS_WARRIOR_MAGE:
case CLASS_RED_MAGE:
case CLASS_MONK:
{
- /* Bad sensing */
if (0 != randint0(95000L / (plev * plev + 40))) return;
break;
}
-
case CLASS_PRIEST:
case CLASS_BARD:
case CLASS_ROGUE:
case CLASS_FORCETRAINER:
case CLASS_MINDCRAFTER:
{
- /* Good sensing */
if (0 != randint0(20000L / (plev * plev + 40))) return;
break;
}
-
case CLASS_MAGE:
case CLASS_HIGH_MAGE:
case CLASS_SORCERER:
case CLASS_MIRROR_MASTER:
case CLASS_BLUE_MAGE:
{
- /* Good sensing */
if (0 != randint0(9000L / (plev * plev + 40))) return;
break;
}
-
case CLASS_TOURIST:
{
- /* Good sensing */
if (0 != randint0(20000L / ((plev + 50)*(plev + 50)))) return;
break;
}
}
- /*** Sense everything ***/
-
- /* Check everything */
- for (i = 0; i < INVEN_TOTAL; i++)
+ for (INVENTORY_IDX i = 0; i < INVEN_TOTAL; i++)
{
bool okay = FALSE;
-
o_ptr = &creature_ptr->inventory_list[i];
-
- /* Skip empty slots */
if (!o_ptr->k_idx) continue;
- /* Valid "tval" codes */
switch (o_ptr->tval)
{
case TV_RING:
}
}
- /* Skip non-sense machines */
if (!okay) continue;
-
- /* Occasional failure on creature_ptr->inventory_list items */
if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
sense_inventory_aux(creature_ptr, i, TRUE);
DEPTH min_level = 0;
DEPTH max_level = 99;
- /* Ask for level */
if (get_check(_("他の階にテレポートしますか?", "Teleport level? ")))
{
char ppp[80];
char tmp_val[160];
- /* Only downward in ironman mode */
if (ironman_downward)
min_level = creature_ptr->current_floor_ptr->dun_level;
- /* Maximum level */
if (creature_ptr->dungeon_idx == DUNGEON_ANGBAND)
{
if (creature_ptr->current_floor_ptr->dun_level > 100)
min_level = d_info[creature_ptr->dungeon_idx].mindepth;
}
- /* Prompt */
sprintf(ppp, _("テレポート先:(%d-%d)", "Teleport to level (%d-%d): "), (int)min_level, (int)max_level);
-
- /* Default */
sprintf(tmp_val, "%d", (int)creature_ptr->current_floor_ptr->dun_level);
-
- /* Ask for a level */
if (!get_string(ppp, tmp_val, 10)) return;
- /* Extract request */
command_arg = (COMMAND_ARG)atoi(tmp_val);
}
else if (get_check(_("通常テレポート?", "Normal teleport? ")))
{
return;
}
+
if (command_arg < min_level) command_arg = (COMMAND_ARG)min_level;
if (command_arg > max_level) command_arg = (COMMAND_ARG)max_level;
- /* Accept request */
msg_format(_("%d 階にテレポートしました。", "You teleport to dungeon level %d."), command_arg);
-
if (autosave_l) do_cmd_save_game(creature_ptr, TRUE);
- /* Change level */
creature_ptr->current_floor_ptr->dun_level = command_arg;
-
leave_quest_check(creature_ptr);
-
if (record_stair) exe_write_diary(creature_ptr, DIARY_PAT_TELE, 0, NULL);
creature_ptr->current_floor_ptr->inside_quest = 0;
creature_ptr->leaving = TRUE;
}
+
/*!
* @brief 各種パターン地形上の特別な処理 / Returns TRUE if we are on the Pattern...
* @return 実際にパターン地形上にプレイヤーが居た場合はTRUEを返す。
*/
static bool pattern_effect(player_type *creature_ptr)
{
- int pattern_type;
-
floor_type *floor_ptr = creature_ptr->current_floor_ptr;
if (!pattern_tile(floor_ptr, creature_ptr->y, creature_ptr->x)) return FALSE;
wreck_the_pattern(creature_ptr);
}
- pattern_type = f_info[floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat].subtype;
-
+ int pattern_type = f_info[floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat].subtype;
switch (pattern_type)
{
case PATTERN_TILE_END:
*/
static void regenhp(player_type *creature_ptr, int percent)
{
- HIT_POINT new_chp;
- u32b new_chp_frac;
- HIT_POINT old_chp;
-
if (creature_ptr->special_defense & KATA_KOUKIJIN) return;
if (creature_ptr->action == ACTION_HAYAGAKE) return;
- /* Save the old hitpoints */
- old_chp = creature_ptr->chp;
+ HIT_POINT old_chp = creature_ptr->chp;
/*
* Extract the new hitpoints
*
* 'percent' is the Regen factor in unit (1/2^16)
*/
- new_chp = 0;
- new_chp_frac = (creature_ptr->mhp * percent + PY_REGEN_HPBASE);
-
- /* Convert the unit (1/2^16) to (1/2^32) */
+ HIT_POINT new_chp = 0;
+ u32b new_chp_frac = (creature_ptr->mhp * percent + PY_REGEN_HPBASE);
s64b_LSHIFT(new_chp, new_chp_frac, 16);
-
- /* Regenerating */
s64b_add(&(creature_ptr->chp), &(creature_ptr->chp_frac), new_chp, new_chp_frac);
-
-
- /* Fully healed */
if (0 < s64b_cmp(creature_ptr->chp, creature_ptr->chp_frac, creature_ptr->mhp, 0))
{
creature_ptr->chp = creature_ptr->mhp;
creature_ptr->chp_frac = 0;
}
- /* Notice changes */
if (old_chp != creature_ptr->chp)
{
creature_ptr->redraw |= (PR_HP);
*/
if (creature_ptr->csp > creature_ptr->msp)
{
- /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
s32b decay = 0;
u32b decay_frac = (creature_ptr->msp * 32 * PY_REGEN_NORMAL + PY_REGEN_MNBASE);
-
- /* Convert the unit (1/2^16) to (1/2^32) */
s64b_LSHIFT(decay, decay_frac, 16);
-
- /* Decay */
s64b_sub(&(creature_ptr->csp), &(creature_ptr->csp_frac), decay, decay_frac);
-
- /* Stop decaying */
if (creature_ptr->csp < creature_ptr->msp)
{
creature_ptr->csp = creature_ptr->msp;
/* Regenerating mana (unless the player has excess mana) */
else if (regen_rate > 0)
{
- /* (percent/100) is the Regen factor in unit (1/2^16) */
MANA_POINT new_mana = 0;
u32b new_mana_frac = (creature_ptr->msp * regen_rate / 100 + PY_REGEN_MNBASE);
-
- /* Convert the unit (1/2^16) to (1/2^32) */
s64b_LSHIFT(new_mana, new_mana_frac, 16);
-
- /* Regenerate */
s64b_add(&(creature_ptr->csp), &(creature_ptr->csp_frac), new_mana, new_mana_frac);
-
- /* Must set frac to zero even if equal */
if (creature_ptr->csp >= creature_ptr->msp)
{
creature_ptr->csp = creature_ptr->msp;
}
}
-
/* Reduce mana (even when the player has excess mana) */
if (regen_rate < 0)
{
- /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
s32b reduce_mana = 0;
u32b reduce_mana_frac = (creature_ptr->msp * (-1) * regen_rate / 100 + PY_REGEN_MNBASE);
-
- /* Convert the unit (1/2^16) to (1/2^32) */
s64b_LSHIFT(reduce_mana, reduce_mana_frac, 16);
-
- /* Reduce mana */
s64b_sub(&(creature_ptr->csp), &(creature_ptr->csp_frac), reduce_mana, reduce_mana_frac);
-
- /* Check overflow */
if (creature_ptr->csp < 0)
{
creature_ptr->csp = 0;
}
}
+
/*!
* @brief プレイヤーのMP自然回復処理 / Regenerate magic regen_amount: PY_REGEN_NORMAL * 2 (if resting) * 2 (if having regenarate)
* @param regen_amount 回復量
static void regenmagic(player_type *creature_ptr, int regen_amount)
{
MANA_POINT new_mana;
- int i;
int dev = 30;
int mult = (dev + adj_mag_mana[creature_ptr->stat_ind[A_INT]]); /* x1 to x2 speed bonus for recharging */
- for (i = 0; i < EATER_EXT * 2; i++)
+ for (int i = 0; i < EATER_EXT * 2; i++)
{
if (!creature_ptr->magic_num2[i]) continue;
if (creature_ptr->magic_num1[i] == ((long)creature_ptr->magic_num2[i] << 16)) continue;
{
creature_ptr->magic_num1[i] = ((long)creature_ptr->magic_num2[i] << 16);
}
+
wild_regen = 20;
}
- for (i = EATER_EXT * 2; i < EATER_EXT * 3; i++)
+
+ for (int i = EATER_EXT * 2; i < EATER_EXT * 3; i++)
{
if (!creature_ptr->magic_num1[i]) continue;
if (!creature_ptr->magic_num2[i]) continue;
{
for (int i = 1; i < player_ptr->current_floor_ptr->m_max; i++)
{
- /* Check the i'th monster */
monster_type *m_ptr = &player_ptr->current_floor_ptr->m_list[i];
monster_race *r_ptr = &r_info[m_ptr->r_idx];
if (!monster_is_valid(m_ptr)) continue;
- /* Allow regeneration (if needed) */
if (m_ptr->hp < m_ptr->maxhp)
{
- /* Hack -- Base regeneration */
int frac = m_ptr->maxhp / 100;
-
- /* Hack -- Minimal regeneration rate */
if (!frac) if (one_in_(2)) frac = 1;
- /* Hack -- Some monsters regenerate quickly */
if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
- /* Hack -- Regenerate */
m_ptr->hp += frac;
-
- /* Do not over-regenerate */
if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
- /* Redraw (later) if needed */
if (player_ptr->health_who == i) player_ptr->redraw |= (PR_HEALTH);
if (player_ptr->riding == i) player_ptr->redraw |= (PR_UHEALTH);
}
*/
static void regenerate_captured_monsters(player_type *creature_ptr)
{
- int i, frac;
bool heal = FALSE;
-
- /* Regenerate everyone */
- for (i = 0; i < INVEN_TOTAL; i++)
+ for (int i = 0; i < INVEN_TOTAL; i++)
{
monster_race *r_ptr;
object_type *o_ptr = &creature_ptr->inventory_list[i];
-
if (!o_ptr->k_idx) continue;
if (o_ptr->tval != TV_CAPTURE) continue;
if (!o_ptr->pval) continue;
heal = TRUE;
-
r_ptr = &r_info[o_ptr->pval];
-
- /* Allow regeneration (if needed) */
if (o_ptr->xtra4 < o_ptr->xtra5)
{
- /* Hack -- Base regeneration */
- frac = o_ptr->xtra5 / 100;
-
- /* Hack -- Minimal regeneration rate */
+ int frac = o_ptr->xtra5 / 100;
if (!frac) if (one_in_(2)) frac = 1;
- /* Hack -- Some monsters regenerate quickly */
if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
- /* Hack -- Regenerate */
o_ptr->xtra4 += (XTRA16)frac;
-
- /* Do not over-regenerate */
if (o_ptr->xtra4 > o_ptr->xtra5) o_ptr->xtra4 = o_ptr->xtra5;
}
}
if (heal)
{
- /* Combine pack */
creature_ptr->update |= (PU_COMBINE);
creature_ptr->window |= (PW_INVEN);
creature_ptr->window |= (PW_EQUIP);
}
}
+
/*!
* @brief 寿命つき光源の警告メッセージ処理
* @param creature_ptr プレーヤーへの参照ポインタ
*/
static void notice_lite_change(player_type *creature_ptr, object_type *o_ptr)
{
- /* Hack -- notice interesting fuel steps */
if ((o_ptr->xtra4 < 100) || (!(o_ptr->xtra4 % 100)))
{
creature_ptr->window |= (PW_EQUIP);
}
- /* Hack -- Special treatment when blind */
if (creature_ptr->blind)
{
- /* Hack -- save some light for later */
if (o_ptr->xtra4 == 0) o_ptr->xtra4++;
}
-
- /* The light is now out */
else if (o_ptr->xtra4 == 0)
{
disturb(creature_ptr, FALSE, TRUE);
msg_print(_("明かりが消えてしまった!", "Your light has gone out!"));
-
- /* Recalculate torch radius */
creature_ptr->update |= (PU_TORCH);
-
- /* Some ego light lose its effects without fuel */
creature_ptr->update |= (PU_BONUS);
}
-
- /* The light is getting dim */
else if (o_ptr->name2 == EGO_LITE_LONG)
{
if ((o_ptr->xtra4 < 50) && (!(o_ptr->xtra4 % 5))
msg_print(_("明かりが微かになってきている。", "Your light is growing faint."));
}
}
-
- /* The light is getting dim */
else if ((o_ptr->xtra4 < 100) && (!(o_ptr->xtra4 % 10)))
{
if (disturb_minor) disturb(creature_ptr, FALSE, TRUE);
*/
static void recharged_notice(player_type *owner_ptr, object_type *o_ptr)
{
- GAME_TEXT o_name[MAX_NLEN];
-
- concptr s;
-
- /* No inscription */
if (!o_ptr->inscription) return;
- /* Find a '!' */
- s = my_strchr(quark_str(o_ptr->inscription), '!');
-
- /* Process notification request. */
+ concptr s = my_strchr(quark_str(o_ptr->inscription), '!');
while (s)
{
- /* Find another '!' */
if (s[1] == '!')
{
- /* Describe (briefly) */
+ GAME_TEXT o_name[MAX_NLEN];
object_desc(owner_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
-
- /* Notify the player */
#ifdef JP
msg_format("%sは再充填された。", o_name);
#else
else
msg_format("Your %s is recharged.", o_name);
#endif
-
disturb(owner_ptr, FALSE, FALSE);
-
- /* Done. */
return;
}
- /* Keep looking for '!'s */
s = my_strchr(s + 1, '!');
}
}
+
/*!
* @brief プレイヤーの歌に関する継続処理
* @return なし
*/
static void check_music(player_type *caster_ptr)
{
- const magic_type *s_ptr;
- int spell;
- MANA_POINT need_mana;
- u32b need_mana_frac;
-
- /* Music singed by player */
if (caster_ptr->pclass != CLASS_BARD) return;
if (!SINGING_SONG_EFFECT(caster_ptr) && !INTERUPTING_SONG_EFFECT(caster_ptr)) return;
return;
}
- spell = SINGING_SONG_ID(caster_ptr);
+ int spell = SINGING_SONG_ID(caster_ptr);
+ const magic_type *s_ptr;
s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][spell];
- need_mana = mod_need_mana(caster_ptr, s_ptr->smana, spell, REALM_MUSIC);
- need_mana_frac = 0;
+ MANA_POINT need_mana = mod_need_mana(caster_ptr, s_ptr->smana, spell, REALM_MUSIC);
+ u32b need_mana_frac = 0;
- /* Divide by 2 */
s64b_RSHIFT(need_mana, need_mana_frac, 1);
-
if (s64b_cmp(caster_ptr->csp, caster_ptr->csp_frac, need_mana, need_mana_frac) < 0)
{
stop_singing(caster_ptr);
caster_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
}
}
+
if (caster_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER)
caster_ptr->spell_exp[spell] += 5;
else if (caster_ptr->spell_exp[spell] < SPELL_EXP_SKILLED)
if (one_in_(5) && ((caster_ptr->current_floor_ptr->dun_level + 5) > caster_ptr->lev) && (caster_ptr->current_floor_ptr->dun_level > s_ptr->slevel)) caster_ptr->spell_exp[spell] += 1;
}
- /* Do any effects of continual song */
exe_spell(caster_ptr, REALM_MUSIC, spell, SPELL_CONT);
}
+
/*!
* @brief 現在呪いを保持している装備品を一つランダムに探し出す / Choose one of items that have cursed flag
* @param flag 探し出したい呪いフラグ配列
*/
static object_type *choose_cursed_obj_name(player_type *player_ptr, BIT_FLAGS flag)
{
- int i;
int choices[INVEN_TOTAL - INVEN_RARM];
int number = 0;
-
- /* Paranoia -- Player has no warning-item */
if (!(player_ptr->cursed & flag)) return NULL;
- /* Search Inventry */
- for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
+ for (int i = INVEN_RARM; i < INVEN_TOTAL; i++)
{
object_type *o_ptr = &player_ptr->inventory_list[i];
-
if (o_ptr->curse_flags & flag)
{
choices[number] = i;
{
if (!creature_ptr->phase_out)
{
- /* Digest quickly when gorged */
if (creature_ptr->food >= PY_FOOD_MAX)
{
- /* Digest a lot of food */
(void)set_food(creature_ptr, creature_ptr->food - 100);
}
-
- /* Digest normally -- Every 50 game turns */
else if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 5)))
{
- /* Basic digestion rate based on speed */
int digestion = SPEED_TO_ENERGY(creature_ptr->pspeed);
-
- /* Regeneration takes more food */
if (creature_ptr->regenerate)
digestion += 20;
if (creature_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
if (creature_ptr->cursed & TRC_FAST_DIGEST)
digestion += 30;
- /* Slow digestion takes less food */
if (creature_ptr->slow_digest)
digestion -= 5;
- /* Minimal digestion */
if (digestion < 1) digestion = 1;
- /* Maximal digestion */
if (digestion > 100) digestion = 100;
- /* Digest some food */
(void)set_food(creature_ptr, creature_ptr->food - digestion);
}
-
- /* Getting Faint */
if ((creature_ptr->food < PY_FOOD_FAINT))
{
- /* Faint occasionally */
if (!creature_ptr->paralyzed && (randint0(100) < 10))
{
msg_print(_("あまりにも空腹で気絶してしまった。", "You faint from the lack of food."));
disturb(creature_ptr, TRUE, TRUE);
-
- /* Hack -- faint (bypass free action) */
(void)set_paralyzed(creature_ptr, creature_ptr->paralyzed + 1 + randint0(5));
}
- /* Starve to death (slowly) */
if (creature_ptr->food < PY_FOOD_STARVE)
{
- /* Calculate damage */
HIT_POINT dam = (PY_FOOD_STARVE - creature_ptr->food) / 10;
-
if (!IS_INVULN(creature_ptr)) take_hit(creature_ptr, DAMAGE_LOSELIFE, dam, _("空腹", "starvation"), -1);
}
}
}
}
+
/*!
* @brief 10ゲームターンが進行するごとにプレイヤーのHPとMPの増減処理を行う。
* / Handle timed damage and regeneration every 10 game turns
feature_type *f_ptr = &f_info[creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat];
bool cave_no_regen = FALSE;
int upkeep_factor = 0;
-
- /* Default regeneration */
int regen_amount = PY_REGEN_NORMAL;
-
-
- /*** Damage over Time ***/
-
- /* Take damage from poison */
if (creature_ptr->poisoned && !IS_INVULN(creature_ptr))
{
take_hit(creature_ptr, DAMAGE_NOESCAPE, 1, _("毒", "poison"), -1);
}
- /* Take damage from cuts */
if (creature_ptr->cut && !IS_INVULN(creature_ptr))
{
HIT_POINT dam;
-
- /* Mortal wound or Deep Gash */
if (creature_ptr->cut > 1000)
{
dam = 200;
}
-
else if (creature_ptr->cut > 200)
{
dam = 80;
}
-
- /* Severe cut */
else if (creature_ptr->cut > 100)
{
dam = 32;
}
-
else if (creature_ptr->cut > 50)
{
dam = 16;
}
-
else if (creature_ptr->cut > 25)
{
dam = 7;
}
-
else if (creature_ptr->cut > 10)
{
dam = 3;
}
-
- /* Other cuts */
else
{
dam = 1;
take_hit(creature_ptr, DAMAGE_NOESCAPE, dam, _("致命傷", "a fatal wound"), -1);
}
- /* (Vampires) Take damage from sunlight */
if (PRACE_IS_(creature_ptr, RACE_VAMPIRE) || (creature_ptr->mimic_form == MIMIC_VAMPIRE))
{
if (!creature_ptr->current_floor_ptr->dun_level && !creature_ptr->resist_lite && !IS_INVULN(creature_ptr) && is_daytime())
object_type *o_ptr = &creature_ptr->inventory_list[INVEN_LITE];
GAME_TEXT o_name[MAX_NLEN];
char ouch[MAX_NLEN + 40];
-
- /* Get an object description */
object_desc(creature_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
msg_format(_("%sがあなたのアンデッドの肉体を焼き焦がした!", "The %s scorches your undead flesh!"), o_name);
cave_no_regen = TRUE;
-
- /* Get an object description */
object_desc(creature_ptr, o_name, o_ptr, OD_NAME_ONLY);
sprintf(ouch, _("%sを装備したダメージ", "wielding %s"), o_name);
}
}
-
- /*** handle regeneration ***/
-
- /* Getting Weak */
if (creature_ptr->food < PY_FOOD_WEAK)
{
- /* Lower regeneration */
if (creature_ptr->food < PY_FOOD_STARVE)
{
regen_amount = 0;
}
}
- /* Are we walking the pattern? */
if (pattern_effect(creature_ptr))
{
cave_no_regen = TRUE;
}
else
{
- /* Regeneration ability */
if (creature_ptr->regenerate)
{
regen_amount = regen_amount * 2;
}
}
-
- /* Searching or Resting */
if ((creature_ptr->action == ACTION_SEARCH) || (creature_ptr->action == ACTION_REST))
{
regen_amount = regen_amount * 2;
}
upkeep_factor = calculate_upkeep(creature_ptr);
-
- /* No regeneration while special action */
if ((creature_ptr->action == ACTION_LEARN) ||
(creature_ptr->action == ACTION_HAYAGAKE) ||
(creature_ptr->special_defense & KATA_KOUKIJIN))
upkeep_factor += 100;
}
- /* Regenerate the mana */
regenmana(creature_ptr, upkeep_factor, regen_amount);
-
-
- /* Recharge magic eater's power */
if (creature_ptr->pclass == CLASS_MAGIC_EATER)
{
regenmagic(creature_ptr, regen_amount);
}
}
- /* Poisoned or cut yields no healing */
if (creature_ptr->poisoned) regen_amount = 0;
if (creature_ptr->cut) regen_amount = 0;
-
- /* Special floor -- Pattern, in a wall -- yields no healing */
if (cave_no_regen) regen_amount = 0;
regen_amount = (regen_amount * creature_ptr->mutant_regenerate_mod) / 100;
-
- /* Regenerate Hit Points if needed */
if ((creature_ptr->chp < creature_ptr->mhp) && !cave_no_regen)
{
regenhp(creature_ptr, regen_amount);
}
}
+
/*!
* @brief 10ゲームターンが進行するごとに魔法効果の残りターンを減らしていく処理
* / Handle timeout every 10 game turns
static void process_world_aux_timeout(player_type *creature_ptr)
{
const int dec_count = (easy_band ? 2 : 1);
-
- /*** Timeout Various Things ***/
-
- /* Mimic */
if (creature_ptr->tim_mimic)
{
(void)set_mimic(creature_ptr, creature_ptr->tim_mimic - 1, creature_ptr->mimic_form, TRUE);
}
- /* Hack -- Hallucinating */
if (creature_ptr->image)
{
(void)set_image(creature_ptr, creature_ptr->image - dec_count);
}
- /* Blindness */
if (creature_ptr->blind)
{
(void)set_blind(creature_ptr, creature_ptr->blind - dec_count);
}
- /* Times see-invisible */
if (creature_ptr->tim_invis)
{
(void)set_tim_invis(creature_ptr, creature_ptr->tim_invis - 1, TRUE);
creature_ptr->suppress_multi_reward = FALSE;
}
- /* Timed esp */
if (creature_ptr->tim_esp)
{
(void)set_tim_esp(creature_ptr, creature_ptr->tim_esp - 1, TRUE);
}
- /* Timed temporary elemental brands. -LM- */
if (creature_ptr->ele_attack)
{
creature_ptr->ele_attack--;
-
- /* Clear all temporary elemental brands. */
if (!creature_ptr->ele_attack) set_ele_attack(creature_ptr, 0, 0);
}
- /* Timed temporary elemental immune. -LM- */
if (creature_ptr->ele_immune)
{
creature_ptr->ele_immune--;
-
- /* Clear all temporary elemental brands. */
if (!creature_ptr->ele_immune) set_ele_immune(creature_ptr, 0, 0);
}
- /* Timed infra-vision */
if (creature_ptr->tim_infra)
{
(void)set_tim_infra(creature_ptr, creature_ptr->tim_infra - 1, TRUE);
}
- /* Timed stealth */
if (creature_ptr->tim_stealth)
{
(void)set_tim_stealth(creature_ptr, creature_ptr->tim_stealth - 1, TRUE);
}
- /* Timed levitation */
if (creature_ptr->tim_levitation)
{
(void)set_tim_levitation(creature_ptr, creature_ptr->tim_levitation - 1, TRUE);
}
- /* Timed sh_touki */
if (creature_ptr->tim_sh_touki)
{
(void)set_tim_sh_touki(creature_ptr, creature_ptr->tim_sh_touki - 1, TRUE);
}
- /* Timed sh_fire */
if (creature_ptr->tim_sh_fire)
{
(void)set_tim_sh_fire(creature_ptr, creature_ptr->tim_sh_fire - 1, TRUE);
}
- /* Timed sh_holy */
if (creature_ptr->tim_sh_holy)
{
(void)set_tim_sh_holy(creature_ptr, creature_ptr->tim_sh_holy - 1, TRUE);
}
- /* Timed eyeeye */
if (creature_ptr->tim_eyeeye)
{
(void)set_tim_eyeeye(creature_ptr, creature_ptr->tim_eyeeye - 1, TRUE);
}
- /* Timed resist-magic */
if (creature_ptr->resist_magic)
{
(void)set_resist_magic(creature_ptr, creature_ptr->resist_magic - 1, TRUE);
}
- /* Timed regeneration */
if (creature_ptr->tim_regen)
{
(void)set_tim_regen(creature_ptr, creature_ptr->tim_regen - 1, TRUE);
}
- /* Timed resist nether */
if (creature_ptr->tim_res_nether)
{
(void)set_tim_res_nether(creature_ptr, creature_ptr->tim_res_nether - 1, TRUE);
}
- /* Timed resist time */
if (creature_ptr->tim_res_time)
{
(void)set_tim_res_time(creature_ptr, creature_ptr->tim_res_time - 1, TRUE);
}
- /* Timed reflect */
if (creature_ptr->tim_reflect)
{
(void)set_tim_reflect(creature_ptr, creature_ptr->tim_reflect - 1, TRUE);
}
- /* Multi-shadow */
if (creature_ptr->multishadow)
{
(void)set_multishadow(creature_ptr, creature_ptr->multishadow - 1, TRUE);
}
- /* Timed Robe of dust */
if (creature_ptr->dustrobe)
{
(void)set_dustrobe(creature_ptr, creature_ptr->dustrobe - 1, TRUE);
}
- /* Timed infra-vision */
if (creature_ptr->kabenuke)
{
(void)set_kabenuke(creature_ptr, creature_ptr->kabenuke - 1, TRUE);
}
- /* Paralysis */
if (creature_ptr->paralyzed)
{
(void)set_paralyzed(creature_ptr, creature_ptr->paralyzed - dec_count);
}
- /* Confusion */
if (creature_ptr->confused)
{
(void)set_confused(creature_ptr, creature_ptr->confused - dec_count);
}
- /* Afraid */
if (creature_ptr->afraid)
{
(void)set_afraid(creature_ptr, creature_ptr->afraid - dec_count);
}
- /* Fast */
if (creature_ptr->fast)
{
(void)set_fast(creature_ptr, creature_ptr->fast - 1, TRUE);
}
- /* Slow */
if (creature_ptr->slow)
{
(void)set_slow(creature_ptr, creature_ptr->slow - dec_count, TRUE);
}
- /* Protection from evil */
if (creature_ptr->protevil)
{
(void)set_protevil(creature_ptr, creature_ptr->protevil - 1, TRUE);
}
- /* Invulnerability */
if (creature_ptr->invuln)
{
(void)set_invuln(creature_ptr, creature_ptr->invuln - 1, TRUE);
}
- /* Wraith form */
if (creature_ptr->wraith_form)
{
(void)set_wraith_form(creature_ptr, creature_ptr->wraith_form - 1, TRUE);
}
- /* Heroism */
if (creature_ptr->hero)
{
(void)set_hero(creature_ptr, creature_ptr->hero - 1, TRUE);
}
- /* Super Heroism */
if (creature_ptr->shero)
{
(void)set_shero(creature_ptr, creature_ptr->shero - 1, TRUE);
}
- /* Blessed */
if (creature_ptr->blessed)
{
(void)set_blessed(creature_ptr, creature_ptr->blessed - 1, TRUE);
}
- /* Shield */
if (creature_ptr->shield)
{
(void)set_shield(creature_ptr, creature_ptr->shield - 1, TRUE);
}
- /* Tsubureru */
if (creature_ptr->tsubureru)
{
(void)set_tsubureru(creature_ptr, creature_ptr->tsubureru - 1, TRUE);
}
- /* Magicdef */
if (creature_ptr->magicdef)
{
(void)set_magicdef(creature_ptr, creature_ptr->magicdef - 1, TRUE);
}
- /* Tsuyoshi */
if (creature_ptr->tsuyoshi)
{
(void)set_tsuyoshi(creature_ptr, creature_ptr->tsuyoshi - 1, TRUE);
}
- /* Oppose Acid */
if (creature_ptr->oppose_acid)
{
(void)set_oppose_acid(creature_ptr, creature_ptr->oppose_acid - 1, TRUE);
}
- /* Oppose Lightning */
if (creature_ptr->oppose_elec)
{
(void)set_oppose_elec(creature_ptr, creature_ptr->oppose_elec - 1, TRUE);
}
- /* Oppose Fire */
if (creature_ptr->oppose_fire)
{
(void)set_oppose_fire(creature_ptr, creature_ptr->oppose_fire - 1, TRUE);
}
- /* Oppose Cold */
if (creature_ptr->oppose_cold)
{
(void)set_oppose_cold(creature_ptr, creature_ptr->oppose_cold - 1, TRUE);
}
- /* Oppose Poison */
if (creature_ptr->oppose_pois)
{
(void)set_oppose_pois(creature_ptr, creature_ptr->oppose_pois - 1, TRUE);
(void)set_ultimate_res(creature_ptr, creature_ptr->ult_res - 1, TRUE);
}
- /*** Poison and Stun and Cut ***/
-
- /* Poison */
if (creature_ptr->poisoned)
{
int adjust = adj_con_fix[creature_ptr->stat_ind[A_CON]] + 1;
-
- /* Apply some healing */
(void)set_poisoned(creature_ptr, creature_ptr->poisoned - adjust);
}
- /* Stun */
if (creature_ptr->stun)
{
int adjust = adj_con_fix[creature_ptr->stat_ind[A_CON]] + 1;
-
- /* Apply some healing */
(void)set_stun(creature_ptr, creature_ptr->stun - adjust);
}
- /* Cut */
if (creature_ptr->cut)
{
int adjust = adj_con_fix[creature_ptr->stat_ind[A_CON]] + 1;
-
- /* Hack -- Truly "mortal" wound */
if (creature_ptr->cut > 1000) adjust = 0;
-
- /* Apply some healing */
(void)set_cut(creature_ptr, creature_ptr->cut - adjust);
}
}
*/
static void process_world_aux_light(player_type *creature_ptr)
{
- /* Check for light being wielded */
object_type *o_ptr = &creature_ptr->inventory_list[INVEN_LITE];
-
- /* Burn some fuel in the current lite */
if (o_ptr->tval == TV_LITE)
{
- /* Hack -- Use some fuel (except on artifacts) */
if (!(object_is_fixed_artifact(o_ptr) || o_ptr->sval == SV_LITE_FEANOR) && (o_ptr->xtra4 > 0))
{
- /* Decrease life-span */
if (o_ptr->name2 == EGO_LITE_LONG)
{
if (current_world_ptr->game_turn % (TURNS_PER_TICK * 2)) o_ptr->xtra4--;
}
else o_ptr->xtra4--;
- /* Notice interesting fuel steps */
notice_lite_change(creature_ptr, o_ptr);
}
}
*/
static void process_world_aux_mutation(player_type *creature_ptr)
{
- /* No mutation with effects */
if (!creature_ptr->muta2) return;
-
- /* No effect on monster arena */
if (creature_ptr->phase_out) return;
-
- /* No effect on the global map */
if (creature_ptr->wild_mode) return;
if ((creature_ptr->muta2 & MUT2_BERS_RAGE) && one_in_(3000))
if (!creature_ptr->current_floor_ptr->dun_level && creature_ptr->town_num)
{
int n;
-
- /* Pick a random shop (except home) */
do
{
n = randint0(MAX_STORES);
msg_print(_("影につつまれた。", "A shadow passes over you."));
msg_print(NULL);
- /* Absorb light from the current possition */
if ((creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
{
hp_player(creature_ptr, 10);
o_ptr = &creature_ptr->inventory_list[INVEN_LITE];
- /* Absorb some fuel in the current lite */
if (o_ptr->tval == TV_LITE)
{
- /* Use some fuel (except on artifacts) */
if (!object_is_fixed_artifact(o_ptr) && (o_ptr->xtra4 > 0))
{
- /* Heal the player a bit */
hp_player(creature_ptr, o_ptr->xtra4 / 20);
-
- /* Decrease life-span of lite */
o_ptr->xtra4 /= 2;
msg_print(_("光源からエネルギーを吸収した!", "You absorb energy from your light!"));
-
- /* Notice interesting fuel steps */
notice_lite_change(creature_ptr, o_ptr);
}
}
msg_print(NULL);
fire_ball(creature_ptr, GF_CHAOS, 0, creature_ptr->lev, 8);
}
+
if ((creature_ptr->muta2 & MUT2_NORMALITY) && one_in_(5000))
{
if (!lose_mutation(creature_ptr, 0))
msg_print(_("奇妙なくらい普通になった気がする。", "You feel oddly normal."));
}
+
if ((creature_ptr->muta2 & MUT2_WRAITH) && !creature_ptr->anti_magic && one_in_(3000))
{
disturb(creature_ptr, FALSE, TRUE);
msg_print(NULL);
set_wraith_form(creature_ptr, randint1(creature_ptr->lev / 2) + (creature_ptr->lev / 2), FALSE);
}
+
if ((creature_ptr->muta2 & MUT2_POLY_WOUND) && one_in_(3000))
{
do_poly_wounds(creature_ptr);
}
+
if ((creature_ptr->muta2 & MUT2_WASTING) && one_in_(3000))
{
int which_stat = randint0(A_MAX);
(void)dec_stat(creature_ptr, which_stat, randint1(6) + 6, one_in_(3));
}
}
+
if ((creature_ptr->muta2 & MUT2_ATT_DRAGON) && !creature_ptr->anti_magic && one_in_(3000))
{
bool pet = one_in_(5);
disturb(creature_ptr, FALSE, TRUE);
}
}
+
if ((creature_ptr->muta2 & MUT2_WEIRD_MIND) && !creature_ptr->anti_magic && one_in_(3000))
{
if (creature_ptr->tim_esp > 0)
set_tim_esp(creature_ptr, creature_ptr->lev, FALSE);
}
}
+
if ((creature_ptr->muta2 & MUT2_NAUSEA) && !creature_ptr->slow_digest && one_in_(9000))
{
disturb(creature_ptr, FALSE, TRUE);
if ((creature_ptr->muta2 & MUT2_WARNING) && one_in_(1000))
{
int danger_amount = 0;
- MONSTER_IDX monster;
-
- for (monster = 0; monster < creature_ptr->current_floor_ptr->m_max; monster++)
+ for (MONSTER_IDX monster = 0; monster < creature_ptr->current_floor_ptr->m_max; monster++)
{
monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[monster];
monster_race *r_ptr = &r_info[m_ptr->r_idx];
drop_from_inventory(creature_ptr, slot, 1);
}
}
-
}
+
/*!
* @brief 10ゲームターンが進行するごとに装備効果の発動判定を行う処理
* / Handle curse effects once every 10 game turns
{
GAME_TEXT o_name[MAX_NLEN];
object_type *o_ptr;
- int i, i_keep = 0, count = 0;
-
- /* Scan the equipment with random teleport ability */
- for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
+ int i_keep = 0, count = 0;
+ for (int i = INVEN_RARM; i < INVEN_TOTAL; i++)
{
BIT_FLAGS flgs[TR_FLAG_SIZE];
o_ptr = &creature_ptr->inventory_list[i];
disturb(creature_ptr, TRUE, TRUE);
}
}
- /* Make a chainsword noise */
+
if ((creature_ptr->cursed & TRC_CHAINSWORD) && one_in_(CHAINSWORD_NOISE))
{
char noise[1024];
msg_print(noise);
disturb(creature_ptr, FALSE, FALSE);
}
- /* TY Curse */
+
if ((creature_ptr->cursed & TRC_TY_CURSE) && one_in_(TY_CURSE_CHANCE))
{
int count = 0;
(void)activate_ty_curse(creature_ptr, FALSE, &count);
}
- /* Handle experience draining */
+
if (creature_ptr->prace != RACE_ANDROID && ((creature_ptr->cursed & TRC_DRAIN_EXP) && one_in_(4)))
{
creature_ptr->exp -= (creature_ptr->lev + 1) / 2;
if (creature_ptr->max_exp < 0) creature_ptr->max_exp = 0;
check_experience(creature_ptr);
}
- /* Add light curse (Later) */
+
if ((creature_ptr->cursed & TRC_ADD_L_CURSE) && one_in_(2000))
{
- BIT_FLAGS new_curse;
object_type *o_ptr;
-
o_ptr = choose_cursed_obj_name(creature_ptr, TRC_ADD_L_CURSE);
-
- new_curse = get_curse(0, o_ptr);
+ BIT_FLAGS new_curse = get_curse(0, o_ptr);
if (!(o_ptr->curse_flags & new_curse))
{
GAME_TEXT o_name[MAX_NLEN];
-
object_desc(creature_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
-
o_ptr->curse_flags |= new_curse;
msg_format(_("悪意に満ちた黒いオーラが%sをとりまいた...", "There is a malignant black aura surrounding your %s..."), o_name);
-
o_ptr->feeling = FEEL_NONE;
-
creature_ptr->update |= (PU_BONUS);
}
}
- /* Add heavy curse (Later) */
+
if ((creature_ptr->cursed & TRC_ADD_H_CURSE) && one_in_(2000))
{
- BIT_FLAGS new_curse;
object_type *o_ptr;
-
o_ptr = choose_cursed_obj_name(creature_ptr, TRC_ADD_H_CURSE);
-
- new_curse = get_curse(1, o_ptr);
+ BIT_FLAGS new_curse = get_curse(1, o_ptr);
if (!(o_ptr->curse_flags & new_curse))
{
GAME_TEXT o_name[MAX_NLEN];
creature_ptr->update |= (PU_BONUS);
}
}
- /* Call animal */
+
if ((creature_ptr->cursed & TRC_CALL_ANIMAL) && one_in_(2500))
{
if (summon_specific(creature_ptr, 0, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_ANIMAL, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
{
GAME_TEXT o_name[MAX_NLEN];
-
object_desc(creature_ptr, o_name, choose_cursed_obj_name(creature_ptr, TRC_CALL_ANIMAL), (OD_OMIT_PREFIX | OD_NAME_ONLY));
msg_format(_("%sが動物を引き寄せた!", "Your %s has attracted an animal!"), o_name);
disturb(creature_ptr, FALSE, TRUE);
}
}
- /* Call demon */
+
if ((creature_ptr->cursed & TRC_CALL_DEMON) && one_in_(1111))
{
if (summon_specific(creature_ptr, 0, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
{
GAME_TEXT o_name[MAX_NLEN];
-
object_desc(creature_ptr, o_name, choose_cursed_obj_name(creature_ptr, TRC_CALL_DEMON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
msg_format(_("%sが悪魔を引き寄せた!", "Your %s has attracted a demon!"), o_name);
disturb(creature_ptr, FALSE, TRUE);
}
}
- /* Call dragon */
+
if ((creature_ptr->cursed & TRC_CALL_DRAGON) && one_in_(800))
{
if (summon_specific(creature_ptr, 0, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_DRAGON,
(PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
{
GAME_TEXT o_name[MAX_NLEN];
-
object_desc(creature_ptr, o_name, choose_cursed_obj_name(creature_ptr, TRC_CALL_DRAGON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
msg_format(_("%sがドラゴンを引き寄せた!", "Your %s has attracted an dragon!"), o_name);
disturb(creature_ptr, FALSE, TRUE);
}
}
- /* Call undead */
+
if ((creature_ptr->cursed & TRC_CALL_UNDEAD) && one_in_(1111))
{
if (summon_specific(creature_ptr, 0, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_UNDEAD,
(PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
{
GAME_TEXT o_name[MAX_NLEN];
-
object_desc(creature_ptr, o_name, choose_cursed_obj_name(creature_ptr, TRC_CALL_UNDEAD), (OD_OMIT_PREFIX | OD_NAME_ONLY));
msg_format(_("%sが死霊を引き寄せた!", "Your %s has attracted an undead!"), o_name);
disturb(creature_ptr, FALSE, TRUE);
}
}
+
if ((creature_ptr->cursed & TRC_COWARDICE) && one_in_(1500))
{
if (!creature_ptr->resist_fear)
set_afraid(creature_ptr, creature_ptr->afraid + 13 + randint1(26));
}
}
- /* Teleport player */
+
if ((creature_ptr->cursed & TRC_TELEPORT) && one_in_(200) && !creature_ptr->anti_tele)
{
disturb(creature_ptr, FALSE, TRUE);
-
- /* Teleport player */
teleport_player(creature_ptr, 40, TELEPORT_PASSIVE);
}
- /* Handle HP draining */
+
if ((creature_ptr->cursed & TRC_DRAIN_HP) && one_in_(666))
{
GAME_TEXT o_name[MAX_NLEN];
-
object_desc(creature_ptr, o_name, choose_cursed_obj_name(creature_ptr, TRC_DRAIN_HP), (OD_OMIT_PREFIX | OD_NAME_ONLY));
msg_format(_("%sはあなたの体力を吸収した!", "Your %s drains HP from you!"), o_name);
take_hit(creature_ptr, DAMAGE_LOSELIFE, MIN(creature_ptr->lev * 2, 100), o_name, -1);
}
- /* Handle mana draining */
+
if ((creature_ptr->cursed & TRC_DRAIN_MANA) && creature_ptr->csp && one_in_(666))
{
GAME_TEXT o_name[MAX_NLEN];
-
object_desc(creature_ptr, o_name, choose_cursed_obj_name(creature_ptr, TRC_DRAIN_MANA), (OD_OMIT_PREFIX | OD_NAME_ONLY));
msg_format(_("%sはあなたの魔力を吸収した!", "Your %s drains mana from you!"), o_name);
creature_ptr->csp -= MIN(creature_ptr->lev, 50);
creature_ptr->csp = 0;
creature_ptr->csp_frac = 0;
}
+
creature_ptr->redraw |= PR_MANA;
}
}
- /* Rarely, take damage from the Jewel of Judgement */
if (one_in_(999) && !creature_ptr->anti_magic)
{
object_type *o_ptr = &creature_ptr->inventory_list[INVEN_LITE];
-
if (o_ptr->name1 == ART_JUDGE)
{
if (object_is_known(o_ptr))
int i;
bool changed;
- /* Process equipment */
for (changed = FALSE, i = INVEN_RARM; i < INVEN_TOTAL; i++)
{
- /* Get the object */
object_type *o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx) continue;
- /* Recharge activatable objects */
if (o_ptr->timeout > 0)
{
- /* Recharge */
o_ptr->timeout--;
-
- /* Notice changes */
if (!o_ptr->timeout)
{
recharged_notice(creature_ptr, o_ptr);
}
}
- /* Notice changes */
if (changed)
{
creature_ptr->window |= (PW_EQUIP);
object_kind *k_ptr = &k_info[o_ptr->k_idx];
if (!o_ptr->k_idx) continue;
- /* Examine all charging rods or stacks of charging rods. */
if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
{
- /* Determine how many rods are charging. */
TIME_EFFECT temp = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
if (temp > o_ptr->number) temp = (TIME_EFFECT)o_ptr->number;
- /* Decrease timeout by that number. */
o_ptr->timeout -= temp;
-
- /* Boundary control. */
if (o_ptr->timeout < 0) o_ptr->timeout = 0;
- /* Notice changes, provide message if object is inscribed. */
if (!(o_ptr->timeout))
{
recharged_notice(creature_ptr, o_ptr);
changed = TRUE;
}
-
- /* One of the stack of rod is charged */
else if (o_ptr->timeout % k_ptr->pval)
{
changed = TRUE;
}
}
- /* Notice changes */
if (changed)
{
creature_ptr->window |= (PW_INVEN);
wild_regen = 20;
}
- /* Process objects on floor */
for (i = 1; i < creature_ptr->current_floor_ptr->o_max; i++)
{
object_type *o_ptr = &creature_ptr->current_floor_ptr->o_list[i];
-
if (!OBJECT_IS_VALID(o_ptr)) continue;
- /* Recharge rods on the ground. No messages. */
if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
{
- /* Charge it */
o_ptr->timeout -= (TIME_EFFECT)o_ptr->number;
-
- /* Boundary control. */
if (o_ptr->timeout < 0) o_ptr->timeout = 0;
}
}
static void process_world_aux_movement(player_type *creature_ptr)
{
floor_type *floor_ptr = creature_ptr->current_floor_ptr;
- /* Delayed Word-of-Recall */
if (creature_ptr->word_recall)
{
/*
if (autosave_l && (creature_ptr->word_recall == 1) && !creature_ptr->phase_out)
do_cmd_save_game(creature_ptr, TRUE);
- /* Count down towards recall */
creature_ptr->word_recall--;
-
creature_ptr->redraw |= (PR_STATUS);
-
- /* Activate the recall */
if (!creature_ptr->word_recall)
{
- /* Disturbing! */
disturb(creature_ptr, FALSE, TRUE);
-
- /* Determine the level */
if (floor_ptr->dun_level || creature_ptr->current_floor_ptr->inside_quest || creature_ptr->enter_dungeon)
{
msg_print(_("上に引っ張りあげられる感じがする!", "You feel yourself yanked upwards!"));
-
if (creature_ptr->dungeon_idx) creature_ptr->recall_dungeon = creature_ptr->dungeon_idx;
if (record_stair)
exe_write_diary(creature_ptr, DIARY_RECALL, floor_ptr->dun_level, NULL);
floor_ptr->dun_level = 0;
creature_ptr->dungeon_idx = 0;
-
leave_quest_check(creature_ptr);
leave_tower_check(creature_ptr);
-
creature_ptr->current_floor_ptr->inside_quest = 0;
-
creature_ptr->leaving = TRUE;
}
else
{
msg_print(_("下に引きずり降ろされる感じがする!", "You feel yourself yanked downwards!"));
-
creature_ptr->dungeon_idx = creature_ptr->recall_dungeon;
-
if (record_stair)
exe_write_diary(creature_ptr, DIARY_RECALL, floor_ptr->dun_level, NULL);
- /* New depth */
floor_ptr->dun_level = max_dlv[creature_ptr->dungeon_idx];
if (floor_ptr->dun_level < 1) floor_ptr->dun_level = 1;
-
- /* Nightmare mode makes recall more dangerous */
if (ironman_nightmare && !randint0(666) && (creature_ptr->dungeon_idx == DUNGEON_ANGBAND))
{
if (floor_ptr->dun_level < 50)
}
else
{
- /* Save player position */
creature_ptr->oldpx = creature_ptr->x;
creature_ptr->oldpy = creature_ptr->y;
}
+
creature_ptr->wild_mode = FALSE;
/*
if (creature_ptr->dungeon_idx == DUNGEON_ANGBAND)
{
- int i;
-
- for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
+ for (int i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
{
quest_type* const q_ptr = &quest[i];
-
-
if ((q_ptr->type == QUEST_TYPE_RANDOM) &&
(q_ptr->status == QUEST_STATUS_TAKEN) &&
(q_ptr->level < floor_ptr->dun_level))
}
}
-
- /* Delayed Alter reality */
if (creature_ptr->alter_reality)
{
if (autosave_l && (creature_ptr->alter_reality == 1) && !creature_ptr->phase_out)
do_cmd_save_game(creature_ptr, TRUE);
- /* Count down towards alter */
creature_ptr->alter_reality--;
-
creature_ptr->redraw |= (PR_STATUS);
-
- /* Activate the alter reality */
if (!creature_ptr->alter_reality)
{
- /* Disturbing! */
disturb(creature_ptr, FALSE, TRUE);
-
- /* Determine the level */
if (!quest_number(creature_ptr, floor_ptr->dun_level) && floor_ptr->dun_level)
{
msg_print(_("世界が変わった!", "The world changes!"));
}
}
+
/*!
* @brief 10ゲームターンが進行する毎にゲーム世界全体の処理を行う。
* / Handle certain things once every 10 game turns
*/
static void process_world(player_type *player_ptr)
{
- int day, hour, min;
-
const s32b A_DAY = TURNS_PER_TICK * TOWN_DAWN;
s32b prev_turn_in_today = ((current_world_ptr->game_turn - TURNS_PER_TICK) % A_DAY + A_DAY / 4) % A_DAY;
int prev_min = (1440 * prev_turn_in_today / A_DAY) % 60;
+ int day, hour, min;
extract_day_hour_min(player_ptr, &day, &hour, &min);
-
- /* Update dungeon feeling, and announce it if changed */
update_dungeon_feeling(player_ptr);
/* 帰還無しモード時のレベルテレポバグ対策 / Fix for level teleport bugs on ironman_downward.*/
player_ptr->leaving = TRUE;
}
- /*** Check monster arena ***/
if (player_ptr->phase_out && !player_ptr->leaving)
{
- int i2, j2;
int win_m_idx = 0;
int number_mon = 0;
-
- /* Count all hostile monsters */
- for (i2 = 0; i2 < floor_ptr->width; ++i2)
- for (j2 = 0; j2 < floor_ptr->height; j2++)
+ for (int i2 = 0; i2 < floor_ptr->width; ++i2)
+ {
+ for (int j2 = 0; j2 < floor_ptr->height; j2++)
{
grid_type *g_ptr = &floor_ptr->grid_array[j2][i2];
-
if ((g_ptr->m_idx > 0) && (g_ptr->m_idx != player_ptr->riding))
{
number_mon++;
win_m_idx = g_ptr->m_idx;
}
}
+ }
if (number_mon == 0)
{
{
GAME_TEXT m_name[MAX_NLEN];
monster_type *wm_ptr;
-
wm_ptr = &floor_ptr->m_list[win_m_idx];
-
monster_desc(player_ptr, m_name, wm_ptr, 0);
msg_format(_("%sが勝利した!", "%s won!"), m_name);
msg_print(NULL);
{
msg_print(_("残念でした。", "You lost gold."));
}
+
msg_print(NULL);
player_ptr->energy_need = 0;
update_gambling_monsters(player_ptr);
}
}
- /* Every 10 game turns */
if (current_world_ptr->game_turn % TURNS_PER_TICK) return;
- /*** Attempt timed autosave ***/
if (autosave_t && autosave_freq && !player_ptr->phase_out)
{
if (!(current_world_ptr->game_turn % ((s32b)autosave_freq * TURNS_PER_TICK)))
msg_print(_("何かが聞こえた。", "You hear noise."));
}
- /*** Handle the wilderness/town (sunshine) ***/
-
- /* While in town/wilderness */
if (!floor_ptr->dun_level && !floor_ptr->inside_quest && !player_ptr->phase_out && !floor_ptr->inside_arena)
{
- /* Hack -- Daybreak/Nighfall in town */
if (!(current_world_ptr->game_turn % ((TURNS_PER_TICK * TOWN_DAWN) / 2)))
{
- bool dawn;
-
- /* Check for dawn */
- dawn = (!(current_world_ptr->game_turn % (TURNS_PER_TICK * TOWN_DAWN)));
-
+ bool dawn = (!(current_world_ptr->game_turn % (TURNS_PER_TICK * TOWN_DAWN)));
if (dawn) day_break(player_ptr);
else night_falls(player_ptr);
}
}
-
- /* While in the dungeon (vanilla_town or lite_town mode only) */
else if ((vanilla_town || (lite_town && !floor_ptr->inside_quest && !player_ptr->phase_out && !floor_ptr->inside_arena)) && floor_ptr->dun_level)
{
- /*** Shuffle the Storekeepers ***/
-
- /* Chance is only once a day (while in dungeon) */
if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * STORE_TICKS)))
{
- /* Sometimes, shuffle the shop-keepers */
if (one_in_(STORE_SHUFFLE))
{
int n;
- FEAT_IDX i;
-
- /* Pick a random shop (except home and museum) */
do
{
n = randint0(MAX_STORES);
} while ((n == STORE_HOME) || (n == STORE_MUSEUM));
- /* Check every feature */
- for (i = 1; i < max_f_idx; i++)
+ for (FEAT_IDX i = 1; i < max_f_idx; i++)
{
feature_type *f_ptr = &f_info[i];
-
- /* Skip empty index */
if (!f_ptr->name) continue;
-
- /* Skip non-store features */
if (!have_flag(f_ptr->flags, FF_STORE)) continue;
- /* Verify store type */
if (f_ptr->subtype == n)
{
- if (cheat_xtra) msg_format(_("%sの店主をシャッフルします。", "Shuffle a Shopkeeper of %s."), f_name + f_ptr->name);
+ if (cheat_xtra)
+ msg_format(_("%sの店主をシャッフルします。", "Shuffle a Shopkeeper of %s."), f_name + f_ptr->name);
- /* Shuffle it */
store_shuffle(player_ptr, n);
-
break;
}
}
}
}
- /*** Process the monsters ***/
-
- /* Check for creature generation. */
if (one_in_(d_info[player_ptr->dungeon_idx].max_m_alloc_chance) &&
!floor_ptr->inside_arena && !floor_ptr->inside_quest && !player_ptr->phase_out)
{
- /* Make a new monster */
(void)alloc_monster(player_ptr, MAX_SIGHT + 5, 0);
}
- /* Hack -- Check for creature regeneration */
- if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 10)) && !player_ptr->phase_out) regenerate_monsters(player_ptr);
- if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 3))) regenerate_captured_monsters(player_ptr);
+ if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 10)) && !player_ptr->phase_out)
+ regenerate_monsters(player_ptr);
+ if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 3)))
+ regenerate_captured_monsters(player_ptr);
if (!player_ptr->leaving)
{
- int i;
-
- /* Hack -- Process the counters of monsters if needed */
- for (i = 0; i < MAX_MTIMED; i++)
+ for (int i = 0; i < MAX_MTIMED; i++)
{
if (floor_ptr->mproc_max[i] > 0) process_monsters_mtimed(player_ptr, i);
}
}
- /* Date changes */
if (!hour && !min)
{
if (min != prev_min)
* Nightmare mode activates the TY_CURSE at midnight
* Require exact minute -- Don't activate multiple times in a minute
*/
-
if (ironman_nightmare && (min != prev_min))
{
-
- /* Every 15 minutes after 11:00 pm */
if ((hour == 23) && !(min % 15))
{
disturb(player_ptr, FALSE, TRUE);
-
switch (min / 15)
{
case 0:
}
}
- /* TY_CURSE activates at midnight! */
if (!hour && !min)
{
-
disturb(player_ptr, TRUE, TRUE);
msg_print(_("遠くで鐘が何回も鳴り、死んだような静けさの中へ消えていった。", "A distant bell tolls many times, fading into an deathly silence."));
-
if (player_ptr->wild_mode)
{
- /* Go into large wilderness view */
player_ptr->oldpy = randint1(MAX_HGT - 2);
player_ptr->oldpx = randint1(MAX_WID - 2);
change_wild_mode(player_ptr, TRUE);
-
- /* Give first move to monsters */
take_turn(player_ptr, 100);
}
process_world_aux_movement(player_ptr);
}
+
/*!
* @brief ウィザードモードへの導入処理
* / Verify use of "wizard" mode
*/
static bool enter_wizard_mode(player_type *player_ptr)
{
- /* Ask first time */
if (!current_world_ptr->noscore)
{
- /* Wizard mode is not permitted */
if (!allow_debug_opts || arg_wizard)
{
msg_print(_("ウィザードモードは許可されていません。 ", "Wizard mode is not permitted."));
return FALSE;
}
- /* Mention effects */
msg_print(_("ウィザードモードはデバッグと実験のためのモードです。 ", "Wizard mode is for debugging and experimenting."));
msg_print(_("一度ウィザードモードに入るとスコアは記録されません。", "The game will not be scored if you enter wizard mode."));
msg_print(NULL);
-
- /* Verify request */
if (!get_check(_("本当にウィザードモードに入りたいのですか? ", "Are you sure you want to enter wizard mode? ")))
{
return FALSE;
}
exe_write_diary(player_ptr, DIARY_DESCRIPTION, 0, _("ウィザードモードに突入してスコアを残せなくなった。", "give up recording score to enter wizard mode."));
- /* Mark savefile */
current_world_ptr->noscore |= 0x0002;
}
- /* Success */
return TRUE;
}
*/
static bool enter_debug_mode(player_type *player_ptr)
{
- /* Ask first time */
if (!current_world_ptr->noscore)
{
- /* Debug mode is not permitted */
if (!allow_debug_opts)
{
msg_print(_("デバッグコマンドは許可されていません。 ", "Use of debug command is not permitted."));
return FALSE;
}
- /* Mention effects */
msg_print(_("デバッグ・コマンドはデバッグと実験のためのコマンドです。 ", "The debug commands are for debugging and experimenting."));
msg_print(_("デバッグ・コマンドを使うとスコアは記録されません。", "The game will not be scored if you use debug commands."));
-
msg_print(NULL);
-
- /* Verify request */
if (!get_check(_("本当にデバッグ・コマンドを使いますか? ", "Are you sure you want to use debug commands? ")))
{
return FALSE;
}
exe_write_diary(player_ptr, DIARY_DESCRIPTION, 0, _("デバッグモードに突入してスコアを残せなくなった。", "give up sending score to use debug commands."));
- /* Mark savefile */
current_world_ptr->noscore |= 0x0008;
}
- /* Success */
return TRUE;
}
/*
+ * todo これが多重インクルード問題の原因 (の1つ)かもしれない、wizard2.cに同名の関数が存在する
* Hack -- Declare the Debug Routines
*/
extern void do_cmd_debug(player_type *creature_ptr);
static void process_command(player_type *creature_ptr)
{
COMMAND_CODE old_now_message = now_message;
-
- /* Handle repeating the last command */
repeat_check();
-
now_message = 0;
-
- /* Sniper */
if ((creature_ptr->pclass == CLASS_SNIPER) && (creature_ptr->concent))
creature_ptr->reset_concent = TRUE;
- /* Parse the command */
floor_type *floor_ptr = creature_ptr->current_floor_ptr;
switch (command_cmd)
{
- /* Ignore */
case ESCAPE:
case ' ':
{
+ /* Ignore */
break;
}
-
- /* Ignore return */
case '\r':
case '\n':
{
+ /* todo 嘘。returnしていない
+ * Ignore return
+ */
break;
}
-
- /*** Wizard Commands ***/
case KTRL('W'):
{
if (current_world_ptr->wizard)
break;
}
-
- /* Special "debug" commands */
case KTRL('A'):
{
if (enter_debug_mode(creature_ptr))
}
break;
}
-
- /*** Inventory Commands ***/
- /* Wear/wield equipment */
case 'w':
{
if (!creature_ptr->wild_mode) do_cmd_wield(creature_ptr);
break;
}
-
- /* Take off equipment */
case 't':
{
if (!creature_ptr->wild_mode) do_cmd_takeoff(creature_ptr);
break;
}
-
- /* Drop an item */
case 'd':
{
if (!creature_ptr->wild_mode) do_cmd_drop(creature_ptr);
break;
}
-
- /* Destroy an item */
case 'k':
{
do_cmd_destroy(creature_ptr);
break;
}
-
- /* Equipment list */
case 'e':
{
do_cmd_equip(creature_ptr);
break;
}
-
- /* Inventory list */
case 'i':
{
do_cmd_inven(creature_ptr);
break;
}
-
-
- /*** Various commands ***/
-
- /* Identify an object */
case 'I':
{
do_cmd_observe(creature_ptr);
toggle_inventory_equipment(creature_ptr);
break;
}
-
-
- /*** Standard "Movement" Commands ***/
-
- /* Alter a grid */
case '+':
{
if (!creature_ptr->wild_mode) do_cmd_alter(creature_ptr);
break;
}
-
- /* Dig a tunnel */
case 'T':
{
if (!creature_ptr->wild_mode) do_cmd_tunnel(creature_ptr);
break;
}
-
- /* Move (usually pick up things) */
case ';':
{
do_cmd_walk(creature_ptr, FALSE);
break;
}
-
- /* Move (usually do not pick up) */
case '-':
{
do_cmd_walk(creature_ptr, TRUE);
break;
}
-
-
- /*** Running, Resting, Searching, Staying */
-
- /* Begin Running -- Arg is Max Distance */
case '.':
{
if (!creature_ptr->wild_mode) do_cmd_run(creature_ptr);
break;
}
-
- /* Stay still (usually pick things up) */
case ',':
{
do_cmd_stay(creature_ptr, always_pickup);
break;
}
-
- /* Stay still (usually do not pick up) */
case 'g':
{
do_cmd_stay(creature_ptr, !always_pickup);
break;
}
-
- /* Rest -- Arg is time */
case 'R':
{
do_cmd_rest(creature_ptr);
break;
}
-
- /* Search for traps/doors */
case 's':
{
do_cmd_search(creature_ptr);
break;
}
-
case 'S':
{
if (creature_ptr->action == ACTION_SEARCH) set_action(creature_ptr, ACTION_NONE);
else set_action(creature_ptr, ACTION_SEARCH);
break;
}
-
-
- /*** Stairs and Doors and Chests and Traps ***/
-
- /* Enter store */
case SPECIAL_KEY_STORE:
{
do_cmd_store(creature_ptr);
break;
}
-
- /* Enter building -KMW- */
case SPECIAL_KEY_BUILDING:
{
do_cmd_bldg(creature_ptr);
break;
}
-
- /* Enter quest level -KMW- */
case SPECIAL_KEY_QUEST:
{
do_cmd_quest(creature_ptr);
break;
}
-
- /* Go up staircase */
case '<':
{
if (!creature_ptr->wild_mode && !floor_ptr->dun_level && !floor_ptr->inside_arena && !floor_ptr->inside_quest)
}
else
do_cmd_go_up(creature_ptr);
+
break;
}
-
- /* Go down staircase */
case '>':
{
if (creature_ptr->wild_mode)
do_cmd_go_down(creature_ptr);
break;
}
-
- /* Open a door or chest */
case 'o':
{
do_cmd_open(creature_ptr);
break;
}
-
- /* Close a door */
case 'c':
{
do_cmd_close(creature_ptr);
break;
}
-
- /* Jam a door with spikes */
case 'j':
{
do_cmd_spike(creature_ptr);
break;
}
-
- /* Bash a door */
case 'B':
{
do_cmd_bash(creature_ptr);
break;
}
-
- /* Disarm a trap or chest */
case 'D':
{
do_cmd_disarm(creature_ptr);
break;
}
-
-
- /*** Magic and Prayers ***/
-
- /* Gain new spells/prayers */
case 'G':
{
if ((creature_ptr->pclass == CLASS_SORCERER) || (creature_ptr->pclass == CLASS_RED_MAGE))
do_cmd_study(creature_ptr);
break;
}
-
- /* Browse a book */
case 'b':
{
if ((creature_ptr->pclass == CLASS_MINDCRAFTER) ||
else do_cmd_browse(creature_ptr);
break;
}
-
- /* Cast a spell */
case 'm':
{
- /* -KMW- */
if (!creature_ptr->wild_mode)
{
if ((creature_ptr->pclass == CLASS_WARRIOR) || (creature_ptr->pclass == CLASS_ARCHER) || (creature_ptr->pclass == CLASS_CAVALRY))
do_cmd_cast(creature_ptr);
}
}
+
break;
}
-
- /* Issue a pet command */
case 'p':
{
do_cmd_pet(creature_ptr);
break;
}
-
- /*** Use various objects ***/
-
- /* Inscribe an object */
case '{':
{
do_cmd_inscribe(creature_ptr);
break;
}
-
- /* Uninscribe an object */
case '}':
{
do_cmd_uninscribe(creature_ptr);
break;
}
-
- /* Activate an artifact */
case 'A':
{
do_cmd_activate(creature_ptr);
break;
}
-
- /* Eat some food */
case 'E':
{
do_cmd_eat_food(creature_ptr);
break;
}
-
- /* Fuel your lantern/torch */
case 'F':
{
do_cmd_refill(creature_ptr);
break;
}
-
- /* Fire an item */
case 'f':
{
do_cmd_fire(creature_ptr, SP_NONE);
break;
}
-
- /* Throw an item */
case 'v':
{
do_cmd_throw(creature_ptr, 1, FALSE, -1);
break;
}
-
- /* Aim a wand */
case 'a':
{
do_cmd_aim_wand(creature_ptr);
break;
}
-
- /* Zap a rod */
case 'z':
{
if (use_command && rogue_like_commands)
}
break;
}
-
- /* Quaff a potion */
case 'q':
{
do_cmd_quaff_potion(creature_ptr);
break;
}
-
- /* Read a scroll */
case 'r':
{
do_cmd_read_scroll(creature_ptr);
break;
}
-
- /* Use a staff */
case 'u':
{
if (use_command && !rogue_like_commands)
do_cmd_use_staff(creature_ptr);
break;
}
-
- /* Use racial power */
case 'U':
{
do_cmd_racial_power(creature_ptr);
break;
}
-
-
- /*** Looking at Things (nearby or on map) ***/
-
- /* Full dungeon map */
case 'M':
{
do_cmd_view_map(creature_ptr);
break;
}
-
- /* Locate player on map */
case 'L':
{
do_cmd_locate(creature_ptr);
break;
}
-
- /* Look around */
case 'l':
{
do_cmd_look(creature_ptr);
break;
}
-
- /* Target monster or location */
case '*':
{
do_cmd_target(creature_ptr);
break;
}
-
-
-
- /*** Help and Such ***/
-
- /* Help */
case '?':
{
do_cmd_help(creature_ptr);
break;
}
-
- /* Identify symbol */
case '/':
{
do_cmd_query_symbol(creature_ptr);
break;
}
-
- /* Character description */
case 'C':
{
do_cmd_player_status(creature_ptr);
break;
}
-
-
- /*** System Commands ***/
-
- /* Hack -- User interface */
case '!':
{
(void)Term_user(0);
break;
}
-
- /* Single line from a pref file */
case '"':
{
do_cmd_pref(creature_ptr);
break;
}
-
case '$':
{
do_cmd_reload_autopick(creature_ptr);
break;
}
-
case '_':
{
do_cmd_edit_autopick(creature_ptr);
break;
}
-
- /* Interact with macros */
case '@':
{
do_cmd_macros(creature_ptr);
break;
}
-
- /* Interact with visuals */
case '%':
{
do_cmd_visuals(creature_ptr);
do_cmd_redraw(creature_ptr);
break;
}
-
- /* Interact with colors */
case '&':
{
do_cmd_colors(creature_ptr);
do_cmd_redraw(creature_ptr);
break;
}
-
- /* Interact with options */
case '=':
{
do_cmd_options();
do_cmd_redraw(creature_ptr);
break;
}
-
- /*** Misc Commands ***/
-
- /* Take notes */
case ':':
{
do_cmd_note();
break;
}
-
- /* Version info */
case 'V':
{
do_cmd_version();
break;
}
-
- /* Repeat level feeling */
case KTRL('F'):
{
do_cmd_feeling(creature_ptr);
break;
}
-
- /* Show previous message */
case KTRL('O'):
{
do_cmd_message_one();
break;
}
-
- /* Show previous messages */
case KTRL('P'):
{
do_cmd_messages(old_now_message);
break;
}
-
- /* Show quest status -KMW- */
case KTRL('Q'):
{
do_cmd_checkquest(creature_ptr);
break;
}
-
- /* Redraw the screen */
case KTRL('R'):
{
now_message = old_now_message;
do_cmd_redraw(creature_ptr);
break;
}
-
- /* Hack -- Save and don't quit */
case KTRL('S'):
{
do_cmd_save_game(creature_ptr, FALSE);
break;
}
-
case KTRL('T'):
{
do_cmd_time(creature_ptr);
break;
}
-
- /* Save and quit */
case KTRL('X'):
case SPECIAL_KEY_QUIT:
{
do_cmd_save_and_exit(creature_ptr);
break;
}
-
- /* Quit (commit suicide) */
case 'Q':
{
do_cmd_suicide(creature_ptr);
break;
}
-
case '|':
{
do_cmd_diary(creature_ptr);
break;
}
-
- /* Check artifacts, uniques, objects */
case '~':
{
do_cmd_knowledge(creature_ptr);
break;
}
-
- /* Load "screen dump" */
case '(':
{
do_cmd_load_screen();
break;
}
-
- /* Save "screen dump" */
case ')':
{
do_cmd_save_screen(creature_ptr);
break;
}
-
- /* Record/stop "Movie" */
case ']':
{
prepare_movie_hooks();
break;
}
-
- /* Make random artifact list */
case KTRL('V'):
{
spoil_random_artifact(creature_ptr, "randifact.txt");
break;
}
-
-#ifdef TRAVEL
case '`':
{
if (!creature_ptr->wild_mode) do_cmd_travel(creature_ptr);
}
break;
}
-#endif
-
- /* Hack -- Unknown command */
default:
{
if (flush_failure) flush();
break;
}
}
+
if (!creature_ptr->energy_use && !now_message)
now_message = old_now_message;
}
+
/*!
* @brief アイテムの所持種類数が超えた場合にアイテムを床に落とす処理 / Hack -- Pack Overflow
* @return なし
GAME_TEXT o_name[MAX_NLEN];
object_type *o_ptr;
-
- /* Is auto-destroy done? */
update_creature(owner_ptr);
if (!owner_ptr->inventory_list[INVEN_PACK].k_idx) return;
- /* Access the slot to be dropped */
o_ptr = &owner_ptr->inventory_list[INVEN_PACK];
-
disturb(owner_ptr, FALSE, TRUE);
-
- /* Warning */
msg_print(_("ザックからアイテムがあふれた!", "Your pack overflows!"));
- object_desc(owner_ptr, o_name, o_ptr, 0);
+ object_desc(owner_ptr, o_name, o_ptr, 0);
msg_format(_("%s(%c)を落とした。", "You drop %s (%c)."), o_name, index_to_label(INVEN_PACK));
-
- /* Drop it (carefully) near the player */
(void)drop_near(owner_ptr, o_ptr, 0, owner_ptr->y, owner_ptr->x);
vary_item(owner_ptr, INVEN_PACK, -255);
handle_stuff(owner_ptr);
}
+
/*!
* @brief プレイヤーの行動エネルギーが充填される(=プレイヤーのターンが回る)毎に行われる処理 / process the effects per 100 energy at player speed.
* @return なし
*/
static void process_upkeep_with_speed(player_type *creature_ptr)
{
- /* Give the player some energy */
if (!load && creature_ptr->enchant_energy_need > 0 && !creature_ptr->leaving)
{
creature_ptr->enchant_energy_need -= SPEED_TO_ENERGY(creature_ptr->pspeed);
}
- /* No turn yet */
if (creature_ptr->enchant_energy_need > 0) return;
while (creature_ptr->enchant_energy_need <= 0)
{
- /* Handle the player song */
if (!load) check_music(creature_ptr);
-
- /* Hex - Handle the hex spells */
if (!load) check_hex(creature_ptr);
if (!load) revenge_spell(creature_ptr);
- /* There is some randomness of needed energy */
creature_ptr->enchant_energy_need += ENERGY_NEED();
}
}
+
static void process_fishing(player_type *creature_ptr)
{
Term_xtra(TERM_XTRA_DELAY, 10);
success = TRUE;
}
}
+
if (!success)
{
msg_print(_("餌だけ食われてしまった!くっそ~!", "Damn! The fish stole your bait!"));
}
+
disturb(creature_ptr, FALSE, TRUE);
}
}
+
/*!
* @brief プレイヤーの行動処理 / Process the player
* @return なし
*/
static void process_player(player_type *creature_ptr)
{
- MONSTER_IDX m_idx;
-
- /*** Apply energy ***/
-
if (creature_ptr->hack_mutation)
{
msg_print(_("何か変わった気がする!", "You feel different!"));
if (creature_ptr->phase_out)
{
- for (m_idx = 1; m_idx < creature_ptr->current_floor_ptr->m_max; m_idx++)
+ for (MONSTER_IDX m_idx = 1; m_idx < creature_ptr->current_floor_ptr->m_max; m_idx++)
{
monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[m_idx];
-
if (!monster_is_valid(m_ptr)) continue;
m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
print_time(creature_ptr);
}
-
- /* Give the player some energy */
else if (!(load && creature_ptr->energy_need <= 0))
{
creature_ptr->energy_need -= SPEED_TO_ENERGY(creature_ptr->pspeed);
}
- /* No turn yet */
if (creature_ptr->energy_need > 0) return;
if (!command_rep) print_time(creature_ptr);
- /*** Check for interupts ***/
-
- /* Complete resting */
if (creature_ptr->resting < 0)
{
- /* Basic resting */
if (creature_ptr->resting == COMMAND_ARG_REST_FULL_HEALING)
{
- /* Stop resting */
if ((creature_ptr->chp == creature_ptr->mhp) &&
(creature_ptr->csp >= creature_ptr->msp))
{
set_action(creature_ptr, ACTION_NONE);
}
}
-
- /* Complete resting */
else if (creature_ptr->resting == COMMAND_ARG_REST_UNTIL_DONE)
{
- /* Stop resting */
if ((creature_ptr->chp == creature_ptr->mhp) &&
(creature_ptr->csp >= creature_ptr->msp) &&
!creature_ptr->blind && !creature_ptr->confused &&
if (creature_ptr->action == ACTION_FISH) process_fishing(creature_ptr);
- /* Handle "abort" */
if (check_abort)
{
- /* Check for "player abort" (semi-efficiently for resting) */
if (creature_ptr->running || travel.run || command_rep || (creature_ptr->action == ACTION_REST) || (creature_ptr->action == ACTION_FISH))
{
- /* Do not wait */
inkey_scan = TRUE;
-
- /* Check for a key */
if (inkey())
{
- flush(); /* Flush input */
-
+ flush();
disturb(creature_ptr, FALSE, TRUE);
-
- /* Hack -- Show a Message */
msg_print(_("中断しました。", "Canceled."));
}
}
{
monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[creature_ptr->riding];
monster_race *r_ptr = &r_info[m_ptr->r_idx];
-
if (MON_CSLEEP(m_ptr))
{
GAME_TEXT m_name[MAX_NLEN];
-
- /* Recover fully */
(void)set_monster_csleep(creature_ptr, creature_ptr->riding, 0);
monster_desc(creature_ptr, m_name, m_ptr, 0);
msg_format(_("%^sを起こした。", "You have woken %s up."), m_name);
if (MON_STUNNED(m_ptr))
{
- /* Hack -- Recover from stun */
if (set_monster_stunned(creature_ptr, creature_ptr->riding,
(randint0(r_ptr->level) < creature_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_STUNNED(m_ptr) - 1)))
{
if (MON_CONFUSED(m_ptr))
{
- /* Hack -- Recover from confusion */
if (set_monster_confused(creature_ptr, creature_ptr->riding,
(randint0(r_ptr->level) < creature_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_CONFUSED(m_ptr) - 1)))
{
if (MON_MONFEAR(m_ptr))
{
- /* Hack -- Recover from fear */
if (set_monster_monfear(creature_ptr, creature_ptr->riding,
(randint0(r_ptr->level) < creature_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_MONFEAR(m_ptr) - 1)))
{
}
load = FALSE;
-
- /* Fast */
if (creature_ptr->lightspeed)
{
(void)set_lightspeed(creature_ptr, creature_ptr->lightspeed - 1, TRUE);
}
+
if ((creature_ptr->pclass == CLASS_FORCETRAINER) && P_PTR_KI)
{
if (P_PTR_KI < 40) P_PTR_KI = 0;
else P_PTR_KI -= 40;
creature_ptr->update |= (PU_BONUS);
}
+
if (creature_ptr->action == ACTION_LEARN)
{
s32b cost = 0L;
u32b cost_frac = (creature_ptr->msp + 30L) * 256L;
-
- /* Convert the unit (1/2^16) to (1/2^32) */
s64b_LSHIFT(cost, cost_frac, 16);
-
if (s64b_cmp(creature_ptr->csp, creature_ptr->csp_frac, cost, cost_frac) < 0)
{
- /* Mana run out */
creature_ptr->csp = 0;
creature_ptr->csp_frac = 0;
set_action(creature_ptr, ACTION_NONE);
}
else
{
- /* Reduce mana */
s64b_sub(&(creature_ptr->csp), &(creature_ptr->csp_frac), cost, cost_frac);
}
+
creature_ptr->redraw |= PR_MANA;
}
}
/*** Handle actual user input ***/
-
- /* Repeat until out of energy */
while (creature_ptr->energy_need <= 0)
{
creature_ptr->window |= PW_PLAYER;
creature_ptr->now_damaged = FALSE;
handle_stuff(creature_ptr);
-
- /* Place the cursor on the player */
move_cursor_relative(creature_ptr->y, creature_ptr->x);
-
- /* Refresh (optional) */
if (fresh_before) Term_fresh();
- /* Hack -- Pack Overflow */
pack_overflow(creature_ptr);
-
- /* Hack -- cancel "lurking browse mode" */
if (!command_new) command_see = FALSE;
- /* Assume free turn */
free_turn(creature_ptr);
-
if (creature_ptr->phase_out)
{
- /* Place the cursor on the player */
move_cursor_relative(creature_ptr->y, creature_ptr->x);
-
command_cmd = SPECIAL_KEY_BUILDING;
-
- /* Process the command */
process_command(creature_ptr);
}
-
- /* Paralyzed or Knocked Out */
else if (creature_ptr->paralyzed || (creature_ptr->stun >= 100))
{
take_turn(creature_ptr, 100);
}
-
- /* Resting */
else if (creature_ptr->action == ACTION_REST)
{
- /* Timed rest */
if (creature_ptr->resting > 0)
{
- /* Reduce rest count */
creature_ptr->resting--;
-
if (!creature_ptr->resting) set_action(creature_ptr, ACTION_NONE);
creature_ptr->redraw |= (PR_STATE);
}
take_turn(creature_ptr, 100);
}
-
- /* Fishing */
else if (creature_ptr->action == ACTION_FISH)
{
take_turn(creature_ptr, 100);
}
-
- /* Running */
else if (creature_ptr->running)
{
- /* Take a step */
run_step(creature_ptr, 0);
}
-
-#ifdef TRAVEL
- /* Traveling */
else if (travel.run)
{
- /* Take a step */
travel_step(creature_ptr);
}
-#endif
-
- /* Repeated command */
else if (command_rep)
{
- /* Count this execution */
command_rep--;
-
creature_ptr->redraw |= (PR_STATE);
handle_stuff(creature_ptr);
-
- /* Hack -- Assume messages were seen */
msg_flag = FALSE;
-
- /* Clear the top line */
prt("", 0, 0);
-
- /* Process the command */
process_command(creature_ptr);
}
-
- /* Normal command */
else
{
- /* Place the cursor on the player */
move_cursor_relative(creature_ptr->y, creature_ptr->x);
-
can_save = TRUE;
- /* Get a command (normal) */
request_command(creature_ptr, FALSE);
can_save = FALSE;
-
- /* Process the command */
process_command(creature_ptr);
}
- /* Hack -- Pack Overflow */
pack_overflow(creature_ptr);
-
- /*** Clean up ***/
-
- /* Significant */
if (creature_ptr->energy_use)
{
- /* Use some energy */
if (creature_ptr->timewalk || creature_ptr->energy_use > 400)
{
- /* The Randomness is irrelevant */
creature_ptr->energy_need += creature_ptr->energy_use * TURNS_PER_TICK / 10;
}
else
{
- /* There is some randomness of needed energy */
creature_ptr->energy_need += (s16b)((s32b)creature_ptr->energy_use * ENERGY_NEED() / 100L);
}
- /* Hack -- constant hallucination */
if (creature_ptr->image) creature_ptr->redraw |= (PR_MAP);
- /* Shimmer multi-hued monsters */
- for (m_idx = 1; m_idx < creature_ptr->current_floor_ptr->m_max; m_idx++)
+ for (MONSTER_IDX m_idx = 1; m_idx < creature_ptr->current_floor_ptr->m_max; m_idx++)
{
monster_type *m_ptr;
monster_race *r_ptr;
-
m_ptr = &creature_ptr->current_floor_ptr->m_list[m_idx];
if (!monster_is_valid(m_ptr)) continue;
-
- /* Skip unseen monsters */
if (!m_ptr->ml) continue;
- /* Access the monster race */
r_ptr = &r_info[m_ptr->ap_r_idx];
-
- /* Skip non-multi-hued monsters */
if (!(r_ptr->flags1 & (RF1_ATTR_MULTI | RF1_SHAPECHANGER)))
continue;
- /* Redraw regardless */
lite_spot(creature_ptr, m_ptr->fy, m_ptr->fx);
}
-
- /* Handle monster detection */
if (repair_monsters)
{
- /* Reset the flag */
repair_monsters = FALSE;
-
- /* Rotate detection flags */
- for (m_idx = 1; m_idx < creature_ptr->current_floor_ptr->m_max; m_idx++)
+ for (MONSTER_IDX m_idx = 1; m_idx < creature_ptr->current_floor_ptr->m_max; m_idx++)
{
monster_type *m_ptr;
m_ptr = &creature_ptr->current_floor_ptr->m_list[m_idx];
if (!monster_is_valid(m_ptr)) continue;
- /* Nice monsters get mean */
if (m_ptr->mflag & MFLAG_NICE)
{
- /* Nice monsters get mean */
m_ptr->mflag &= ~(MFLAG_NICE);
}
- /* Handle memorized monsters */
if (m_ptr->mflag2 & MFLAG2_MARK)
{
- /* Maintain detection */
if (m_ptr->mflag2 & MFLAG2_SHOW)
{
- /* Forget flag */
m_ptr->mflag2 &= ~(MFLAG2_SHOW);
-
- /* Still need repairs */
repair_monsters = TRUE;
}
-
- /* Remove detection */
else
{
- /* Forget flag */
m_ptr->mflag2 &= ~(MFLAG2_MARK);
-
- /* Assume invisible */
m_ptr->ml = FALSE;
update_monster(creature_ptr, m_idx, FALSE);
-
if (creature_ptr->health_who == m_idx) creature_ptr->redraw |= (PR_HEALTH);
if (creature_ptr->riding == m_idx) creature_ptr->redraw |= (PR_UHEALTH);
- /* Redraw regardless */
lite_spot(creature_ptr, m_ptr->fy, m_ptr->fx);
}
}
}
}
+
if (creature_ptr->pclass == CLASS_IMITATOR)
{
- int j;
if (creature_ptr->mane_num > (creature_ptr->lev > 44 ? 3 : creature_ptr->lev > 29 ? 2 : 1))
{
creature_ptr->mane_num--;
- for (j = 0; j < creature_ptr->mane_num; j++)
+ for (int j = 0; j < creature_ptr->mane_num; j++)
{
creature_ptr->mane_spell[j] = creature_ptr->mane_spell[j + 1];
creature_ptr->mane_dam[j] = creature_ptr->mane_dam[j + 1];
}
}
+
creature_ptr->new_mane = FALSE;
creature_ptr->redraw |= (PR_IMITATION);
}
+
if (creature_ptr->action == ACTION_LEARN)
{
creature_ptr->new_mane = FALSE;
}
}
- /* Hack -- notice death */
if (!creature_ptr->playing || creature_ptr->is_dead)
{
creature_ptr->timewalk = FALSE;
break;
}
- /* Sniper */
- if (creature_ptr->energy_use && creature_ptr->reset_concent) reset_concentration(creature_ptr, TRUE);
+ if (creature_ptr->energy_use && creature_ptr->reset_concent)
+ reset_concentration(creature_ptr, TRUE);
- /* Handle "leaving" */
if (creature_ptr->leaving) break;
}
- /* Update scent trail */
update_smell(creature_ptr->current_floor_ptr, creature_ptr);
}
+
/*!
* @brief 現在プレイヤーがいるダンジョンの全体処理 / Interact with the current dungeon level.
* @return なし
*/
static void dungeon(player_type *player_ptr, bool load_game)
{
- int quest_num = 0;
-
- /* Set the base level */
floor_type *floor_ptr = player_ptr->current_floor_ptr;
floor_ptr->base_level = floor_ptr->dun_level;
-
- /* Reset various flags */
current_world_ptr->is_loading_now = FALSE;
-
- /* Not leaving */
player_ptr->leaving = FALSE;
- /* Reset the "command" vars */
command_cmd = 0;
command_rep = 0;
command_arg = 0;
command_dir = 0;
- /* Cancel the target */
target_who = 0;
player_ptr->pet_t_m_idx = 0;
player_ptr->riding_t_m_idx = 0;
player_ptr->ambush_flag = FALSE;
-
health_track(player_ptr, 0);
-
- /* Check visual effects */
repair_monsters = TRUE;
repair_objects = TRUE;
-
disturb(player_ptr, TRUE, TRUE);
-
- /* Get index of current quest (if any) */
- quest_num = quest_number(player_ptr, floor_ptr->dun_level);
-
- /* Inside a quest? */
+ int quest_num = quest_num = quest_number(player_ptr, floor_ptr->dun_level);
if (quest_num)
{
- /* Mark the quest monster */
r_info[quest[quest_num].r_idx].flags1 |= RF1_QUESTOR;
}
- /* Track maximum player level */
if (player_ptr->max_plv < player_ptr->lev)
{
player_ptr->max_plv = player_ptr->lev;
}
-
- /* Track maximum dungeon level (if not in quest -KMW-) */
if ((max_dlv[player_ptr->dungeon_idx] < floor_ptr->dun_level) && !floor_ptr->inside_quest)
{
max_dlv[player_ptr->dungeon_idx] = floor_ptr->dun_level;
}
(void)calculate_upkeep(player_ptr);
-
- /* Validate the panel */
panel_bounds_center();
-
- /* Verify the panel */
verify_panel(player_ptr);
-
msg_erase();
-
- /* Enter "xtra" mode */
current_world_ptr->character_xtra = TRUE;
-
player_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_MONSTER | PW_OVERHEAD | PW_DUNGEON);
player_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_EQUIPPY | PR_MAP);
player_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS | PU_VIEW | PU_LITE | PU_MON_LITE | PU_TORCH | PU_MONSTERS | PU_DISTANCE | PU_FLOW);
-
handle_stuff(player_ptr);
- /* Leave "xtra" mode */
current_world_ptr->character_xtra = FALSE;
-
player_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
player_ptr->update |= (PU_COMBINE | PU_REORDER);
handle_stuff(player_ptr);
if (quest_num && (is_fixed_quest_idx(quest_num) &&
!((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
- !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) do_cmd_feeling(player_ptr);
+ !(quest[quest_num].flags & QUEST_FLAG_PRESET))))
+ do_cmd_feeling(player_ptr);
if (player_ptr->phase_out)
{
if ((player_ptr->pclass == CLASS_BARD) && (SINGING_SONG_EFFECT(player_ptr) > MUSIC_DETECT))
SINGING_SONG_EFFECT(player_ptr) = MUSIC_DETECT;
- /* Hack -- notice death or departure */
if (!player_ptr->playing || player_ptr->is_dead) return;
- /* Print quest message if appropriate */
if (!floor_ptr->inside_quest && (player_ptr->dungeon_idx == DUNGEON_ANGBAND))
{
quest_discovery(random_quest_number(player_ptr, floor_ptr->dun_level));
if (!load_game && (player_ptr->special_defense & NINJA_S_STEALTH)) set_superstealth(player_ptr, FALSE);
- /*** Process this dungeon level ***/
-
- /* Reset the monster generation level */
floor_ptr->monster_level = floor_ptr->base_level;
-
- /* Reset the object generation level */
floor_ptr->object_level = floor_ptr->base_level;
-
current_world_ptr->is_loading_now = TRUE;
-
if (player_ptr->energy_need > 0 && !player_ptr->phase_out &&
(floor_ptr->dun_level || player_ptr->leaving_dungeon || floor_ptr->inside_arena))
player_ptr->energy_need = 0;
- /* Not leaving dungeon */
player_ptr->leaving_dungeon = FALSE;
-
- /* Initialize monster process */
mproc_init(floor_ptr);
- /* Main loop */
while (TRUE)
{
- /* Hack -- Compact the monster list occasionally */
- if ((floor_ptr->m_cnt + 32 > current_world_ptr->max_m_idx) && !player_ptr->phase_out) compact_monsters(player_ptr, 64);
+ if ((floor_ptr->m_cnt + 32 > current_world_ptr->max_m_idx) && !player_ptr->phase_out)
+ compact_monsters(player_ptr, 64);
- /* Hack -- Compress the monster list occasionally */
- if ((floor_ptr->m_cnt + 32 < floor_ptr->m_max) && !player_ptr->phase_out) compact_monsters(player_ptr, 0);
+ if ((floor_ptr->m_cnt + 32 < floor_ptr->m_max) && !player_ptr->phase_out)
+ compact_monsters(player_ptr, 0);
+ if (floor_ptr->o_cnt + 32 > current_world_ptr->max_o_idx)
+ compact_objects(player_ptr, 64);
- /* Hack -- Compact the object list occasionally */
- if (floor_ptr->o_cnt + 32 > current_world_ptr->max_o_idx) compact_objects(player_ptr, 64);
+ if (floor_ptr->o_cnt + 32 < floor_ptr->o_max)
+ compact_objects(player_ptr, 0);
- /* Hack -- Compress the object list occasionally */
- if (floor_ptr->o_cnt + 32 < floor_ptr->o_max) compact_objects(player_ptr, 0);
-
- /* Process the player */
process_player(player_ptr);
process_upkeep_with_speed(player_ptr);
-
handle_stuff(player_ptr);
- /* Hack -- Hilite the player */
move_cursor_relative(player_ptr->y, player_ptr->x);
-
- /* Optional fresh */
if (fresh_after) Term_fresh();
- /* Hack -- Notice death or departure */
if (!player_ptr->playing || player_ptr->is_dead) break;
- /* Process all of the monsters */
process_monsters(player_ptr);
-
handle_stuff(player_ptr);
- /* Hack -- Hilite the player */
move_cursor_relative(player_ptr->y, player_ptr->x);
-
- /* Optional fresh */
if (fresh_after) Term_fresh();
- /* Hack -- Notice death or departure */
if (!player_ptr->playing || player_ptr->is_dead) break;
- /* Process the world */
process_world(player_ptr);
-
handle_stuff(player_ptr);
- /* Hack -- Hilite the player */
move_cursor_relative(player_ptr->y, player_ptr->x);
-
- /* Optional fresh */
if (fresh_after) Term_fresh();
- /* Hack -- Notice death or departure */
if (!player_ptr->playing || player_ptr->is_dead) break;
- /* Count game turns */
current_world_ptr->game_turn++;
-
if (current_world_ptr->dungeon_turn < current_world_ptr->dungeon_turn_limit)
{
if (!player_ptr->wild_mode || wild_regen) current_world_ptr->dungeon_turn++;
prevent_turn_overflow(player_ptr);
- /* Handle "leaving" */
if (player_ptr->leaving) break;
if (wild_regen) wild_regen--;
}
- /* Inside a quest and non-unique questor? */
if (quest_num && !(r_info[quest[quest_num].r_idx].flags1 & RF1_UNIQUE))
{
- /* Un-mark the quest monster */
r_info[quest[quest_num].r_idx].flags1 &= ~RF1_QUESTOR;
}
- /* Not save-and-quit and not dead? */
if (player_ptr->playing && !player_ptr->is_dead)
{
/*
* floor, then prepare next floor
*/
leave_floor(player_ptr);
-
- /* Forget the flag */
reinit_wilderness = FALSE;
}
- /* Write about current level on the play record once per level */
write_level = TRUE;
}
static void load_all_pref_files(player_type *player_ptr)
{
char buf[1024];
-
- /* Access the "user" pref file */
sprintf(buf, "user.prf");
-
- /* Process that file */
process_pref_file(player_ptr, buf);
-
- /* Access the "user" system pref file */
sprintf(buf, "user-%s.prf", ANGBAND_SYS);
-
- /* Process that file */
process_pref_file(player_ptr, buf);
-
- /* Access the "race" pref file */
sprintf(buf, "%s.prf", rp_ptr->title);
-
- /* Process that file */
process_pref_file(player_ptr, buf);
-
- /* Access the "class" pref file */
sprintf(buf, "%s.prf", cp_ptr->title);
-
- /* Process that file */
process_pref_file(player_ptr, buf);
-
- /* Access the "character" pref file */
sprintf(buf, "%s.prf", player_ptr->base_name);
-
- /* Process that file */
process_pref_file(player_ptr, buf);
-
- /* Access the "realm 1" pref file */
if (player_ptr->realm1 != REALM_NONE)
{
sprintf(buf, "%s.prf", realm_names[player_ptr->realm1]);
-
- /* Process that file */
process_pref_file(player_ptr, buf);
}
- /* Access the "realm 2" pref file */
if (player_ptr->realm2 != REALM_NONE)
{
sprintf(buf, "%s.prf", realm_names[player_ptr->realm2]);
-
- /* Process that file */
process_pref_file(player_ptr, buf);
}
-
- /* Load an autopick preference file */
autopick_load_pref(player_ptr, FALSE);
}
*/
void play_game(player_type *player_ptr, bool new_game)
{
- MONSTER_IDX i;
bool load_game = TRUE;
bool init_random_seed = FALSE;
}
player_ptr->hack_mutation = FALSE;
-
- /* Hack -- Character is "icky" */
current_world_ptr->character_icky = TRUE;
-
- /* Make sure main term is active */
Term_activate(angband_term[0]);
-
- /* Initialise the resize hooks */
angband_term[0]->resize_hook = resize_map;
-
- for (i = 1; i < 8; i++)
+ for (MONSTER_IDX i = 1; i < 8; i++)
{
- /* Does the term exist? */
if (angband_term[i])
{
- /* Add the redraw on resize hook */
angband_term[i]->resize_hook = redraw_window;
}
}
- /* Hack -- turn off the cursor */
(void)Term_set_cursor(0);
-
-
- /* Attempt to load */
if (!load_player(player_ptr))
{
quit(_("セーブファイルが壊れています", "broken savefile"));
}
- /* Extract the options */
extract_option_vars();
-
- /* Report waited score */
if (player_ptr->wait_report_score)
{
char buf[1024];
player_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
update_creature(player_ptr);
-
player_ptr->is_dead = TRUE;
-
current_world_ptr->start_time = (u32b)time(NULL);
-
- /* No suspending now */
signals_ignore_tstp();
-
- /* Hack -- Character is now "icky" */
current_world_ptr->character_icky = TRUE;
path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
-
- /* Open the high score file, for reading/writing */
highscore_fd = fd_open(buf, O_RDWR);
/* 町名消失バグ対策(#38205)のためここで世界マップ情報を読み出す */
process_dungeon_file(player_ptr, "w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
-
- /* Handle score, show Top scores */
success = send_world_score(player_ptr, TRUE);
if (!success && !get_check_strict(_("スコア登録を諦めますか?", "Do you give up score registration? "), CHECK_NO_HISTORY))
top_twenty(player_ptr);
if (!save_player(player_ptr)) msg_print(_("セーブ失敗!", "death save failed!"));
}
- /* Shut the high score file */
- (void)fd_close(highscore_fd);
- /* Forget the high score fd */
+ (void)fd_close(highscore_fd);
highscore_fd = -1;
-
- /* Allow suspending now */
signals_handle_tstp();
quit(0);
current_world_ptr->creating_savefile = new_game;
- /* Nothing loaded */
if (!current_world_ptr->character_loaded)
{
- /* Make new player */
new_game = TRUE;
-
- /* The dungeon is not ready */
current_world_ptr->character_dungeon = FALSE;
-
- /* Prepare to init the RNG */
init_random_seed = TRUE;
-
- /* Initialize the saved floors data */
init_saved_floors(player_ptr, FALSE);
}
-
- /* Old game is loaded. But new game is requested. */
else if (new_game)
{
- /* Initialize the saved floors data */
init_saved_floors(player_ptr, TRUE);
}
- /* Process old character */
if (!new_game)
{
- /* Process the player name */
process_player_name(player_ptr, FALSE);
}
- /* Init the RNG */
if (init_random_seed)
{
Rand_state_init();
}
- /* Roll new character */
floor_type *floor_ptr = player_ptr->current_floor_ptr;
if (new_game)
{
- /* The dungeon is not ready */
current_world_ptr->character_dungeon = FALSE;
- /* Start in town */
floor_ptr->dun_level = 0;
floor_ptr->inside_quest = 0;
floor_ptr->inside_arena = FALSE;
player_ptr->phase_out = FALSE;
-
write_level = TRUE;
- /* Hack -- seed for flavors */
current_world_ptr->seed_flavor = randint0(0x10000000);
-
- /* Hack -- seed for town layout */
current_world_ptr->seed_town = randint0(0x10000000);
- /* Roll up a new character */
player_birth(player_ptr);
-
counts_write(player_ptr, 2, 0);
player_ptr->count = 0;
-
load = FALSE;
-
determine_bounty_uniques(player_ptr);
determine_daily_bounty(player_ptr, FALSE);
-
- /* Initialize object array */
wipe_o_list(floor_ptr);
}
else
{
write_level = FALSE;
-
exe_write_diary(player_ptr, DIARY_GAMESTART, 1,
_(" ----ゲーム再開----",
" ---- Restart Game ----"));
/*
+ * todo もう2.2.Xなので互換性は打ち切ってもいいのでは?
* 1.0.9 以前はセーブ前に player_ptr->riding = -1 としていたので、再設定が必要だった。
* もう不要だが、以前のセーブファイルとの互換のために残しておく。
*/
if (player_ptr->riding == -1)
{
player_ptr->riding = 0;
- for (i = floor_ptr->m_max; i > 0; i--)
+ for (MONSTER_IDX i = floor_ptr->m_max; i > 0; i--)
{
if (player_bold(player_ptr, floor_ptr->m_list[i].fy, floor_ptr->m_list[i].fx))
{
current_world_ptr->start_time = time(NULL) - 1;
record_o_name[0] = '\0';
- /* Reset map panel */
panel_row_min = floor_ptr->height;
panel_col_min = floor_ptr->width;
-
- /* Sexy gal gets bonus to maximum weapon skill of whip */
if (player_ptr->pseikaku == SEIKAKU_SEXY)
s_info[player_ptr->pclass].w_max[TV_HAFTED - TV_WEAPON_BEGIN][SV_WHIP] = WEAPON_EXP_MASTER;
- /* Fill the arrays of floors and walls in the good proportions */
set_floor_and_wall(player_ptr->dungeon_idx);
-
- /* Flavor the objects */
flavor_init();
-
- /* Flash a message */
prt(_("お待ち下さい...", "Please wait..."), 0, 0);
-
- /* Flush the message */
Term_fresh();
-
- /* Hack -- Enter wizard mode */
if (arg_wizard)
{
if (enter_wizard_mode(player_ptr))
if (player_ptr->is_dead || !player_ptr->y || !player_ptr->x)
{
- /* Initialize the saved floors data */
init_saved_floors(player_ptr, TRUE);
-
- /* Avoid crash */
floor_ptr->inside_quest = 0;
-
- /* Avoid crash in update_view() */
player_ptr->y = player_ptr->x = 10;
}
}
}
}
- /* Initialize the town-buildings if necessary */
if (!floor_ptr->dun_level && !floor_ptr->inside_quest)
{
process_dungeon_file(player_ptr, "w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
select_floor_music(player_ptr);
}
- /* Generate a dungeon level if needed */
if (!current_world_ptr->character_dungeon)
{
change_floor(player_ptr);
}
else
{
- /* HACK -- Restore from panic-save */
if (player_ptr->panic_save)
{
- /* No player? -- Try to regenerate floor */
if (!player_ptr->y || !player_ptr->x)
{
msg_print(_("プレイヤーの位置がおかしい。フロアを再生成します。", "What a strange player location, regenerate the dungeon floor."));
change_floor(player_ptr);
}
- /* Still no player? -- Try to locate random place */
if (!player_ptr->y || !player_ptr->x) player_ptr->y = player_ptr->x = 10;
- /* No longer in panic */
player_ptr->panic_save = 0;
}
}
- /* Character is now "complete" */
current_world_ptr->character_generated = TRUE;
-
- /* Hack -- Character is no longer "icky" */
current_world_ptr->character_icky = FALSE;
if (new_game)
exe_write_diary(player_ptr, DIARY_DESCRIPTION, 0, buf);
}
- /* Start game */
player_ptr->playing = TRUE;
-
- /* Reset the visual mappings */
reset_visuals(player_ptr);
-
- /* Load the "pref" files */
load_all_pref_files(player_ptr);
-
- /* Give startup outfit (after loading pref files) */
if (new_game)
{
player_outfit(player_ptr);
}
- /* React to changes */
Term_xtra(TERM_XTRA_REACT, 0);
player_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
player_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
handle_stuff(player_ptr);
- /* Set or clear "rogue_like_commands" if requested */
if (arg_force_original) rogue_like_commands = FALSE;
if (arg_force_roguelike) rogue_like_commands = TRUE;
- /* Hack -- Enforce "delayed death" */
if (player_ptr->chp < 0) player_ptr->is_dead = TRUE;
if (player_ptr->prace == RACE_ANDROID) calc_android_exp(player_ptr);
(void)combine_and_reorder_home(STORE_HOME);
(void)combine_and_reorder_home(STORE_MUSEUM);
-
select_floor_music(player_ptr);
- /* Process */
while (TRUE)
{
- /* Process the level */
dungeon(player_ptr, load_game);
-
- /* Hack -- prevent "icky" message */
current_world_ptr->character_xtra = TRUE;
-
handle_stuff(player_ptr);
current_world_ptr->character_xtra = FALSE;
-
- /* Cancel the target */
target_who = 0;
-
health_track(player_ptr, 0);
-
forget_lite(floor_ptr);
forget_view(floor_ptr);
clear_mon_lite(floor_ptr);
-
- /* Handle "quit and save" */
if (!player_ptr->playing && !player_ptr->is_dead) break;
wipe_o_list(floor_ptr);
if (!player_ptr->is_dead) wipe_monsters_list(player_ptr);
-
msg_print(NULL);
-
load_game = FALSE;
-
- /* Accidental Death */
if (player_ptr->playing && player_ptr->is_dead)
{
if (floor_ptr->inside_arena)
player_ptr->chp_frac = 0;
player_ptr->exit_bldg = TRUE;
reset_tim_flags(player_ptr);
-
- /* Leave through the exit */
prepare_change_floor_mode(player_ptr, CFM_SAVE_FLOORS | CFM_RAND_CONNECT);
-
- /* prepare next floor */
leave_floor(player_ptr);
}
else
{
- /* Mega-Hack -- Allow player to cheat death */
if ((current_world_ptr->wizard || cheat_live) && !get_check(_("死にますか? ", "Die? ")))
{
cheat_death(player_ptr);
}
}
- /* Handle "death" */
if (player_ptr->is_dead) break;
- /* Make a new level */
change_floor(player_ptr);
}
- /* Close stuff */
close_game(player_ptr);
-
- /* Quit */
quit(NULL);
}
+
/*!
* @brief ゲームターンからの実時間換算を行うための補正をかける
* @param hoge ゲームターン
*/
void prevent_turn_overflow(player_type *player_ptr)
{
- int rollback_days, i, j;
- s32b rollback_turns;
-
if (current_world_ptr->game_turn < current_world_ptr->game_turn_limit) return;
- rollback_days = 1 + (current_world_ptr->game_turn - current_world_ptr->game_turn_limit) / (TURNS_PER_TICK * TOWN_DAWN);
- rollback_turns = TURNS_PER_TICK * TOWN_DAWN * rollback_days;
+ int rollback_days = 1 + (current_world_ptr->game_turn - current_world_ptr->game_turn_limit) / (TURNS_PER_TICK * TOWN_DAWN);
+ s32b rollback_turns = TURNS_PER_TICK * TOWN_DAWN * rollback_days;
if (current_world_ptr->game_turn > rollback_turns) current_world_ptr->game_turn -= rollback_turns;
else current_world_ptr->game_turn = 1;
if (player_ptr->feeling_turn > rollback_turns) player_ptr->feeling_turn -= rollback_turns;
else player_ptr->feeling_turn = 1;
- for (i = 1; i < max_towns; i++)
+ for (int i = 1; i < max_towns; i++)
{
- for (j = 0; j < MAX_STORES; j++)
+ for (int j = 0; j < MAX_STORES; j++)
{
store_type *st_ptr = &town_info[i].store[j];
{
char buf[1024];
bool do_send = TRUE;
-
- /* concptr p = "[i:キャラクタの情報, f:ファイル書き出し, t:スコア, x:*鑑定*, ESC:ゲーム終了]"; */
handle_stuff(player_ptr);
- /* Flush the messages */
msg_print(NULL);
-
- /* Flush the input */
flush();
-
- /* No suspending now */
signals_ignore_tstp();
-
- /* Hack -- Character is now "icky" */
current_world_ptr->character_icky = TRUE;
-
path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
-
- /* Grab permissions */
safe_setuid_grab();
-
- /* Open the high score file, for reading/writing */
highscore_fd = fd_open(buf, O_RDWR);
-
- /* Drop permissions */
safe_setuid_drop();
- /* Handle death */
if (player_ptr->is_dead)
{
- /* Handle retirement */
if (current_world_ptr->total_winner) kingly(player_ptr);
- /* Save memories */
if (!cheat_save || get_check(_("死んだデータをセーブしますか? ", "Save death? ")))
{
if (!save_player(player_ptr)) msg_print(_("セーブ失敗!", "death save failed!"));
}
else do_send = FALSE;
- /* You are dead */
print_tomb(player_ptr);
-
flush();
- /* Show more info */
show_info(player_ptr);
Term_clear();
display_scores_aux(0, 10, -1, NULL);
}
}
-
- /* Still alive */
else
{
- /* Save the game */
do_cmd_save_game(player_ptr, FALSE);
-
- /* Prompt for scores */
prt(_("リターンキーか ESC キーを押して下さい。", "Press Return (or Escape)."), 0, 40);
play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_EXIT);
-
- /* Predict score (or ESCAPE) */
if (inkey() != ESCAPE) predict_score(player_ptr);
}
-
- /* Shut the high score file */
(void)fd_close(highscore_fd);
-
- /* Forget the high score fd */
highscore_fd = -1;
-
- /* Kill all temporary files */
clear_saved_floor_files(player_ptr);
-
- /* Allow suspending now */
signals_handle_tstp();
}
-
-#include "angband.h"
-#include "util.h"
-#include "core.h"
-
-#include "files.h"
-#include "dungeon-file.h"
-#include "rooms-vault.h"
-#include "feature.h"
-#include "grid.h"
-#include "quest.h"
-#include "monster.h"
-#include "files.h"
-#include "player-skill.h"
-#include "player-race.h"
-#include "dungeon.h"
-#include "floor.h"
-#include "bldg.h"
-#include "world.h"
-#include "rooms-vault.h"
-#include "objectkind.h"
-#include "object-ego.h"
-#include "monsterrace.h"
-#include "floor-town.h"
-#include "realm.h"
-
-dungeon_grid letter[255];
-
-/*!
+/*!
* @file init1.c
* @brief ゲームデータ初期化1 / Initialization (part 1) -BEN-
* @date 2014/01/28
*/
#include "angband.h"
+#include "util.h"
+#include "core.h"
+
+#include "files.h"
#include "dungeon-file.h"
-#include "trap.h"
+#include "rooms-vault.h"
+#include "feature.h"
#include "grid.h"
+#include "quest.h"
#include "monster.h"
+#include "files.h"
+#include "player-skill.h"
+#include "player-race.h"
+#include "dungeon.h"
+#include "floor.h"
+#include "bldg.h"
+#include "world.h"
+#include "rooms-vault.h"
+#include "objectkind.h"
+#include "object-ego.h"
+#include "monsterrace.h"
+#include "floor-town.h"
+#include "realm.h"
+
+#include "trap.h"
#include "artifact.h"
#include "cmd-activate.h"
#include "term.h"
#include "wild.h"
-#include "quest.h"
#include "view-mainwindow.h"
#include "player-class.h"
#include "init.h"
- /*** Helper arrays for parsing ascii template files ***/
+dungeon_grid letter[255];
+
+/*** Helper arrays for parsing ascii template files ***/
- /*!
- * モンスターの打撃手段トークンの定義 /
- * Monster Blow Methods
- */
+ /*!
+ * モンスターの打撃手段トークンの定義 /
+ * Monster Blow Methods
+ */
static concptr r_info_blow_method[] =
{
"",
*/
static bool add_text(u32b *offset, header *head, concptr buf, bool normal_text)
{
- /* Hack -- Verify space */
if (head->text_size + strlen(buf) + 8 > FAKE_TEXT_SIZE)
return FALSE;
- /* New text? */
if (*offset == 0)
{
- /* Advance and save the text index */
*offset = ++head->text_size;
}
-
- /* Additional text */
else if (normal_text)
{
/*
#endif
)
{
- /* Append a space */
*(head->text_ptr + head->text_size) = ' ';
-
- /* Advance the index */
head->text_size++;
}
}
*/
static bool add_name(u32b *offset, header *head, concptr buf)
{
- /* Hack -- Verify space */
if (head->name_size + strlen(buf) + 8 > FAKE_NAME_SIZE)
return FALSE;
- /* New name? */
if (*offset == 0)
{
- /* Advance and save the name index */
*offset = ++head->name_size;
}
- /* Append chars to the names */
strcpy(head->name_ptr + head->name_size, buf);
-
- /* Advance the index */
head->name_size += strlen(buf);
-
- /* Success */
return TRUE;
}
static bool add_tag(STR_OFFSET *offset, header *head, concptr buf)
{
u32b i;
-
- /* Search for an existing (fake) tag */
for (i = 1; i < head->tag_size; i += strlen(&head->tag_ptr[i]) + 1)
{
- /* Found it */
if (streq(&head->tag_ptr[i], buf)) break;
}
- /* There was no existing tag */
if (i >= head->tag_size)
{
- /* Hack -- Verify space */
if (head->tag_size + strlen(buf) + 8 > FAKE_TAG_SIZE)
return FALSE;
- /* Append chars to the tags */
strcpy(head->tag_ptr + head->tag_size, buf);
-
- /* Point the new tag */
i = head->tag_size;
-
- /* Advance the index */
head->tag_size += strlen(buf) + 1;
}
}
-/*** Initialize from ascii template files ***/
-
-
/*!
* @brief パース関数に基づいてデータファイルからデータを読み取る /
* Initialize an "*_info" array, by parsing an ascii "template" file
*/
errr init_info_txt(FILE *fp, char *buf, header *head, parse_info_txt_func parse_info_txt_line)
{
- /* Just before the first record */
error_idx = -1;
-
- /* Just before the first line */
error_line = 0;
- /* Prepare the "fake" stuff */
head->name_size = 0;
head->text_size = 0;
head->tag_size = 0;
- /* Parse */
errr err;
while (my_fgets(fp, buf, 1024) == 0)
{
- /* Advance the line number */
error_line++;
-
- /* Skip comments and blank lines */
if (!buf[0] || (buf[0] == '#')) continue;
- /* Verify correct "colon" format */
if (buf[1] != ':') return (PARSE_ERROR_GENERIC);
-
- /* Hack -- Process 'V' for "Version" */
if (buf[0] == 'V')
{
- /* ignore */
continue;
}
- /* Mega Hack -- Calculate Check Sum */
if (buf[0] != 'N' && buf[0] != 'D')
{
int i;
}
}
- /* Parse the line */
if ((err = (*parse_info_txt_line)(buf, head)) != 0)
return (err);
}
-
- /* Complete the "name" and "text" sizes */
if (head->name_size) head->name_size++;
if (head->text_size) head->text_size++;
- /* Success */
return 0;
}
*/
errr parse_v_info(char *buf, header *head)
{
- int i;
char *s;
-
- /* Current entry */
static vault_type *v_ptr = NULL;
- /* Process 'N' for "New/Number/Name" */
if (buf[0] == 'N')
{
- /* Find the colon before the name */
s = my_strchr(buf + 2, ':');
-
- /* Verify that colon */
if (!s) return 1;
- /* Nuke the colon, advance to the name */
*s++ = '\0';
-
- /* Paranoia -- require a name */
if (!*s) return 1;
- /* Get the index */
- i = atoi(buf + 2);
-
- /* Verify information */
+ int i = atoi(buf + 2);
if (i <= error_idx) return 4;
-
- /* Verify information */
if (i >= head->info_num) return 2;
- /* Save the index */
error_idx = i;
-
- /* Point at the "info" */
v_ptr = &v_info[i];
-
- /* Store the name */
if (!add_name(&v_ptr->name, head, s)) return 7;
}
-
- /* There better be a current v_ptr */
else if (!v_ptr) return 3;
-
- /* Process 'D' for "Description" */
else if (buf[0] == 'D')
{
- /* Acquire the text */
s = buf + 2;
-
- /* Store the text */
if (!add_text(&v_ptr->text, head, s, FALSE)) return 7;
}
-
- /* Process 'X' for "Extra info" (one line only) */
else if (buf[0] == 'X')
{
EFFECT_ID typ, rat, hgt, wid;
-
- /* Scan for the values */
if (4 != sscanf(buf + 2, "%d:%d:%d:%d",
&typ, &rat, &hgt, &wid)) return 1;
- /* Save the values */
v_ptr->typ = (ROOM_IDX)typ;
v_ptr->rat = (PROB)rat;
v_ptr->hgt = (POSITION)hgt;
v_ptr->wid = (POSITION)wid;
}
+ else
+ return 6;
- else return 6;
-
- /* Success */
return 0;
}
*/
errr parse_s_info(char *buf, header *head)
{
- int i;
-
- /* Current entry */
static skill_table *s_ptr = NULL;
-
-
- /* Process 'N' for "New/Number/Name" */
if (buf[0] == 'N')
{
- /* Get the index */
- i = atoi(buf + 2);
-
- /* Verify information */
+ int i = atoi(buf + 2);
if (i <= error_idx) return 4;
-
- /* Verify information */
if (i >= head->info_num) return 2;
- /* Save the index */
error_idx = i;
-
- /* Point at the "info" */
s_ptr = &s_info[i];
}
-
- /* There better be a current s_ptr */
- else if (!s_ptr) return 3;
-
- /* Process 'W' for "Weapon exp" */
+ else if (!s_ptr)
+ {
+ return 3;
+ }
else if (buf[0] == 'W')
{
int tval, sval, start, max;
WEAPON_EXP_EXPERT, WEAPON_EXP_MASTER
};
- /* Scan for the values */
if (4 != sscanf(buf + 2, "%d:%d:%d:%d",
&tval, &sval, &start, &max)) return 1;
if (start < EXP_LEVEL_UNSKILLED || start > EXP_LEVEL_MASTER
|| max < EXP_LEVEL_UNSKILLED || max > EXP_LEVEL_MASTER) return 8;
- /* Save the values */
s_ptr->w_start[tval][sval] = exp_conv_table[start];
s_ptr->w_max[tval][sval] = exp_conv_table[max];
}
-
- /* Process 'S' for "Skill exp" */
else if (buf[0] == 'S')
{
int num, start, max;
-
- /* Scan for the values */
if (3 != sscanf(buf + 2, "%d:%d:%d",
&num, &start, &max)) return 1;
if (start < WEAPON_EXP_UNSKILLED || start > WEAPON_EXP_MASTER
|| max < WEAPON_EXP_UNSKILLED || max > WEAPON_EXP_MASTER) return 8;
- /* Save the values */
s_ptr->s_start[num] = (SUB_EXP)start;
s_ptr->s_max[num] = (SUB_EXP)max;
}
+ else
+ return 6;
-
- else return 6;
-
- /* Success */
return 0;
}
*/
errr parse_m_info(char *buf, header *head)
{
- int i;
-
- char *s;
-
- /* Current entry */
static player_magic *m_ptr = NULL;
-
- /* ---Hack--- */
static int realm, magic_idx = 0, readable = 0;
-
- /* Process 'N' for "New/Number/Name" */
if (buf[0] == 'N')
{
- /* Get the index */
- i = atoi(buf + 2);
+ int i = atoi(buf + 2);
- /* Verify information */
if (i <= error_idx) return 4;
-
- /* Verify information */
if (i >= head->info_num) return 2;
- /* Save the index */
error_idx = i;
-
- /* Point at the "info" */
m_ptr = &m_info[i];
}
-
- /* There better be a current m_ptr */
- else if (!m_ptr) return 3;
-
- /* Process 'I' for "Info" (one line only) */
+ else if (!m_ptr)
+ {
+ return 3;
+ }
else if (buf[0] == 'I')
{
char *book, *stat;
int xtra, type, first, weight;
-
- /* Find the colon before the name */
+ char *s;
s = my_strchr(buf + 2, ':');
/* Verify that colon */
else return 5;
stat = s;
-
- /* Find the colon before the name */
s = my_strchr(s, ':');
-
- /* Verify that colon */
if (!s) return 1;
-
- /* Nuke the colon, advance to the name */
*s++ = '\0';
if (streq(stat, "STR")) m_ptr->spell_stat = A_STR;
else if (streq(stat, "CHR")) m_ptr->spell_stat = A_CHR;
else return 5;
-
- /* Scan for the values */
if (4 != sscanf(s, "%x:%d:%d:%d",
(uint *)&xtra, &type, &first, &weight)) return 1;
m_ptr->spell_first = first;
m_ptr->spell_weight = weight;
}
-
-
- /* Process 'R' for "Realm" (one line only) */
else if (buf[0] == 'R')
{
- /* Scan for the values */
if (2 != sscanf(buf + 2, "%d:%d",
&realm, &readable)) return 1;
magic_idx = 0;
}
-
else if (buf[0] == 'T')
{
int level, mana, fail, exp;
if (!readable) return 1;
- /* Scan for the values */
if (4 != sscanf(buf + 2, "%d:%d:%d:%d",
&level, &mana, &fail, &exp)) return 1;
m_ptr->info[realm][magic_idx].sexp = (EXP)exp;
magic_idx++;
}
- else return 6;
+ else
+ return 6;
return 0;
}
*/
static errr grab_one_feat_flag(feature_type *f_ptr, concptr what)
{
- /* Check flags */
for (int i = 0; i < FF_FLAG_MAX; i++)
{
if (streq(what, f_info_flags[i]))
*/
static errr grab_one_feat_action(feature_type *f_ptr, concptr what, int count)
{
- /* Check flags */
for (FF_FLAGS_IDX i = 0; i < FF_FLAG_MAX; i++)
{
if (streq(what, f_info_flags[i]))
*/
errr parse_f_info(char *buf, header *head)
{
- /* Current entry */
static feature_type *f_ptr = NULL;
-
- /* Process 'N' for "New/Number/Name" */
int i;
char *s, *t;
if (buf[0] == 'N')
{
- /* Find the colon before the name */
s = my_strchr(buf + 2, ':');
if (s)
{
- /* Nuke the colon, advance to the name */
*s++ = '\0';
}
- /* Get the index */
i = atoi(buf + 2);
-
- /* Verify information */
if (i <= error_idx) return 4;
-
- /* Verify information */
if (i >= head->info_num) return 2;
- /* Save the index */
error_idx = i;
-
- /* Point at the "info" */
f_ptr = &f_info[i];
-
- /* Tag name is given */
if (s)
{
- /* Store the tag */
if (!add_tag(&f_ptr->tag, head, s)) return 7;
}
- /* Default "mimic" */
f_ptr->mimic = (FEAT_IDX)i;
-
- /* Default "destroyed state" -- if not specified */
f_ptr->destroyed = (FEAT_IDX)i;
-
- /* Default "states" */
- for (i = 0; i < MAX_FEAT_STATES; i++) f_ptr->state[i].action = FF_FLAG_MAX;
+ for (i = 0; i < MAX_FEAT_STATES; i++)
+ f_ptr->state[i].action = FF_FLAG_MAX;
+ }
+ else if (!f_ptr)
+ {
+ return 3;
}
-
- /* There better be a current f_ptr */
- else if (!f_ptr) return 3;
-
#ifdef JP
else if (buf[0] == 'J')
{
- /* Store the name */
if (!add_name(&f_ptr->name, head, buf + 2)) return 7;
}
-
else if (buf[0] == 'E')
{
- /* Ignore english name */
}
#else
else if (buf[0] == 'J')
{
- /* Ignore Japanese name */
}
-
else if (buf[0] == 'E')
{
- /* Acquire the Text */
s = buf + 2;
-
- /* Store the name */
if (!add_name(&f_ptr->name, head, s)) return 7;
}
#endif
-
-
- /* Process 'M' for "Mimic" (one line only) */
else if (buf[0] == 'M')
{
STR_OFFSET offset;
+ if (!add_tag(&offset, head, buf + 2))
+ return PARSE_ERROR_OUT_OF_MEMORY;
- if (!add_tag(&offset, head, buf + 2)) return PARSE_ERROR_OUT_OF_MEMORY;
-
- /* Record a fake tag index */
f_ptr->mimic_tag = offset;
}
-
-
- /* Process 'G' for "Graphics" (one line only) */
else if (buf[0] == 'G')
{
int j;
if (buf[3] != ':') return 1;
if (!buf[4]) return 1;
- /* Extract the char */
char_tmp[F_LIT_STANDARD] = buf[2];
-
- /* Extract the color */
s_attr = color_char_to_attr(buf[4]);
if (s_attr > 127) return 1;
- /* Save the standard values */
f_ptr->d_attr[F_LIT_STANDARD] = s_attr;
f_ptr->d_char[F_LIT_STANDARD] = char_tmp[F_LIT_STANDARD];
-
- /* Is this feature supports lighting? */
if (buf[5] == ':')
{
- /* G:c:a:LIT (default) */
apply_default_feat_lighting(f_ptr->d_attr, f_ptr->d_char);
-
- /* G:c:a:lc:la:dc:da */
if (!streq(buf + 6, "LIT"))
{
char attr_lite_tmp[F_LIT_MAX - F_LIT_NS_BEGIN];
}
else return 1;
}
-
- /* Hack -- Process 'F' for flags */
else if (buf[0] == 'F')
{
- /* Parse every entry textually */
for (s = buf + 2; *s; )
{
- /* Find the end of this entry */
- for (t = s; *t && (*t != ' ') && (*t != '|'); ++t) /* loop */;
+ /* loop */
+ for (t = s; *t && (*t != ' ') && (*t != '|'); ++t);
- /* Nuke and skip any dividers */
if (*t)
{
*t++ = '\0';
while (*t == ' ' || *t == '|') t++;
}
- /* Hack -- Read feature subtype */
if (1 == sscanf(s, "SUBTYPE_%d", &i))
{
- /* Extract a "subtype" */
f_ptr->subtype = (FEAT_SUBTYPE)i;
-
- /* Start at next entry */
s = t;
continue;
}
- /* Hack -- Read feature power */
if (1 == sscanf(s, "POWER_%d", &i))
{
- /* Extract a "power" */
f_ptr->power = (FEAT_POWER)i;
-
- /* Start at next entry */
s = t;
continue;
}
- /* Parse this entry */
- if (0 != grab_one_feat_flag(f_ptr, s)) return (PARSE_ERROR_INVALID_FLAG);
+ if (0 != grab_one_feat_flag(f_ptr, s))
+ return (PARSE_ERROR_INVALID_FLAG);
- /* Start the next entry */
s = t;
}
}
-
- /* Process 'W' for "More Info" (one line only) */
else if (buf[0] == 'W')
{
int priority;
-
- /* Scan for the value */
- if (1 != sscanf(buf + 2, "%d", &priority)) return (PARSE_ERROR_GENERIC);
-
- /* Save the value */
+ if (1 != sscanf(buf + 2, "%d", &priority))
+ return (PARSE_ERROR_GENERIC);
f_ptr->priority = (FEAT_PRIORITY)priority;
}
-
- /* Process 'K' for "States" (up to four lines + default (which cannot be last)) */
else if (buf[0] == 'K')
{
STR_OFFSET offset;
+ for (i = 0; i < MAX_FEAT_STATES; i++)
+ if (f_ptr->state[i].action == FF_FLAG_MAX) break;
- /* Find the next empty state slot (if any) */
- for (i = 0; i < MAX_FEAT_STATES; i++) if (f_ptr->state[i].action == FF_FLAG_MAX) break;
-
- /* Oops, no more slots */
if (i == MAX_FEAT_STATES) return PARSE_ERROR_GENERIC;
- /* Analyze the first field */
- for (s = t = buf + 2; *t && (*t != ':'); t++) /* loop */;
+ /* loop */
+ for (s = t = buf + 2; *t && (*t != ':'); t++);
- /* Terminate the field (if necessary) */
if (*t == ':') *t++ = '\0';
- /* Is this default entry? */
if (streq(s, "DESTROYED"))
{
if (!add_tag(&offset, head, t)) return PARSE_ERROR_OUT_OF_MEMORY;
- /* Record a fake tag index */
f_ptr->destroyed_tag = offset;
}
else
{
- /* Reset */
f_ptr->state[i].action = 0;
-
- /* Parse this entry */
if (0 != grab_one_feat_action(f_ptr, s, i)) return PARSE_ERROR_INVALID_FLAG;
-
if (!add_tag(&offset, head, t)) return PARSE_ERROR_OUT_OF_MEMORY;
- /* Record a fake tag index */
f_ptr->state[i].result_tag = offset;
}
}
- else return 6;
+ else
+ {
+ return 6;
+ }
return 0;
}
*/
s16b f_tag_to_index(concptr str)
{
- u16b i;
-
- /* Search for real index corresponding to this fake tag */
- for (i = 0; i < f_head.info_num; i++)
+ for (u16b i = 0; i < f_head.info_num; i++)
{
if (streq(f_tag + f_info[i].tag, str))
{
- /* Return the index */
return (s16b)i;
}
}
- /* Not found */
return -1;
}
*/
static FEAT_IDX search_real_feat(STR_OFFSET feat)
{
- /* Don't convert non-fake tag */
if (feat <= 0)
{
return -1;
}
- /* Search for real index corresponding to this fake tag */
for (FEAT_IDX i = 0; i < f_head.info_num; i++)
{
if (feat == f_info[i].tag)
{
- /* Record real index */
return i;
}
}
- /* Undefined tag */
msg_format(_("未定義のタグ '%s'。", "%s is undefined."), f_tag + feat);
return -1;
}
*/
void retouch_f_info(header *head)
{
- /* Convert fake tags to real feat indices */
for (int i = 0; i < head->info_num; i++)
{
feature_type *f_ptr = &f_info[i];
- FEAT_IDX j, k;
-
- k = search_real_feat(f_ptr->mimic_tag);
+ FEAT_IDX k = search_real_feat(f_ptr->mimic_tag);
f_ptr->mimic = k < 0 ? f_ptr->mimic : k;
k = search_real_feat(f_ptr->destroyed_tag);
f_ptr->destroyed = k < 0 ? f_ptr->destroyed : k;
- for (j = 0; j < MAX_FEAT_STATES; j++)
+ for (FEAT_IDX j = 0; j < MAX_FEAT_STATES; j++)
{
k = search_real_feat(f_ptr->state[j].result_tag);
f_ptr->state[j].result = k < 0 ? f_ptr->state[j].result : k;
*/
static errr grab_one_kind_flag(object_kind *k_ptr, concptr what)
{
- /* Check flags */
for (int i = 0; i < TR_FLAG_MAX; i++)
{
if (streq(what, k_info_flags[i]))
*/
errr parse_k_info(char *buf, header *head)
{
- /* Current entry */
static object_kind *k_ptr = NULL;
- /* Process 'N' for "New/Number/Name" */
- int i;
char *s, *t;
if (buf[0] == 'N')
{
#ifdef JP
char *flavor;
#endif
-
- /* Find the colon before the name */
s = my_strchr(buf + 2, ':');
-
- /* Verify that colon */
if (!s) return 1;
- /* Nuke the colon, advance to the name */
*s++ = '\0';
+ int i = atoi(buf + 2);
- /* Get the index */
- i = atoi(buf + 2);
-
- /* Verify information */
if (i <= error_idx) return 4;
-
- /* Verify information */
if (i >= head->info_num) return 2;
- /* Save the index */
error_idx = i;
-
- /* Point at the "info" */
k_ptr = &k_info[i];
#ifdef JP
- /* Paranoia -- require a name */
if (!*s) return 1;
- /* Find the colon before the flavor */
flavor = my_strchr(s, ':');
-
- /* Verify that colon */
if (flavor)
{
- /* Nuke the colon, advance to the flavor */
*flavor++ = '\0';
-
- /* Store the flavor */
if (!add_name(&k_ptr->flavor_name, head, flavor)) return 7;
}
- /* Store the name */
if (!add_name(&k_ptr->name, head, s)) return 7;
#endif
}
-
- /* There better be a current k_ptr */
- else if (!k_ptr) return 3;
-
-
+ else if (!k_ptr)
+ {
+ return 3;
+ }
#ifdef JP
/* 英語名を読むルーチンを追加 */
/* 'E' から始まる行は英語名としている */
else if (buf[0] == 'E')
{
char *flavor;
-
- /* Acquire the name */
s = buf + 2;
-
- /* Find the colon before the flavor */
flavor = my_strchr(s, ':');
-
- /* Verify that colon */
if (flavor)
{
- /* Nuke the colon, advance to the flavor */
*flavor++ = '\0';
-
- /* Store the flavor */
if (!add_name(&k_ptr->flavor_name, head, flavor)) return 7;
}
- /* Store the name */
if (!add_name(&k_ptr->name, head, s)) return 7;
}
#endif
-
- /* Process 'D' for "Description" */
else if (buf[0] == 'D')
{
#ifdef JP
if (buf[2] == '$')
return 0;
- /* Acquire the text */
s = buf + 2;
#else
if (buf[2] != '$')
return 0;
- /* Acquire the text */
s = buf + 3;
#endif
-
- /* Store the text */
if (!add_text(&k_ptr->text, head, s, TRUE)) return 7;
}
-
- /* Process 'G' for "Graphics" (one line only) */
else if (buf[0] == 'G')
{
char sym;
if (buf[3] != ':') return 1;
if (!buf[4]) return 1;
- /* Extract the char */
sym = buf[2];
-
- /* Extract the attr */
tmp = color_char_to_attr(buf[4]);
if (tmp > 127) return 1;
- /* Save the values */
k_ptr->d_attr = tmp;
k_ptr->d_char = sym;
}
-
- /* Process 'I' for "Info" (one line only) */
else if (buf[0] == 'I')
{
int tval, sval, pval;
-
- /* Scan for the values */
if (3 != sscanf(buf + 2, "%d:%d:%d",
&tval, &sval, &pval)) return 1;
- /* Save the values */
k_ptr->tval = (OBJECT_TYPE_VALUE)tval;
k_ptr->sval = (OBJECT_SUBTYPE_VALUE)sval;
k_ptr->pval = (PARAMETER_VALUE)pval;
}
-
- /* Process 'W' for "More Info" (one line only) */
else if (buf[0] == 'W')
{
int level, extra, wgt;
long cost;
-
- /* Scan for the values */
if (4 != sscanf(buf + 2, "%d:%d:%d:%ld",
&level, &extra, &wgt, &cost)) return 1;
- /* Save the values */
k_ptr->level = (DEPTH)level;
k_ptr->extra = (BIT_FLAGS8)extra;
k_ptr->weight = (WEIGHT)wgt;
k_ptr->cost = (PRICE)cost;
}
-
- /* Process 'A' for "Allocation" (one line only) */
else if (buf[0] == 'A')
{
-
- /* Simply read each number following a colon */
- for (i = 0, s = buf + 1; s && (s[0] == ':') && s[1]; ++i)
+ int i = 0;
+ for (s = buf + 1; s && (s[0] == ':') && s[1]; ++i)
{
- /* Default chance */
k_ptr->chance[i] = 1;
-
- /* Store the attack damage index */
k_ptr->locale[i] = atoi(s + 1);
-
- /* Find the slash */
t = my_strchr(s + 1, '/');
-
- /* Find the next colon */
s = my_strchr(s + 1, ':');
-
- /* If the slash is "nearby", use it */
if (t && (!s || t < s))
{
int chance = atoi(t + 1);
}
}
}
-
- /* Hack -- Process 'P' for "power" and such */
else if (buf[0] == 'P')
{
int ac, hd1, hd2, th, td, ta;
-
- /* Scan for the values */
if (6 != sscanf(buf + 2, "%d:%dd%d:%d:%d:%d",
&ac, &hd1, &hd2, &th, &td, &ta)) return 1;
k_ptr->to_d = (HIT_POINT)td;
k_ptr->to_a = (ARMOUR_CLASS)ta;
}
-
- /* Hack -- Process 'U' for activation index */
else if (buf[0] == 'U')
{
byte n;
return 5;
}
}
-
- /* Hack -- Process 'F' for flags */
else if (buf[0] == 'F')
{
- /* Parse every entry textually */
for (s = buf + 2; *s; )
{
- /* Find the end of this entry */
- for (t = s; *t && (*t != ' ') && (*t != '|'); ++t) /* loop */;
+ /* loop */
+ for (t = s; *t && (*t != ' ') && (*t != '|'); ++t);
- /* Nuke and skip any dividers */
if (*t)
{
*t++ = '\0';
while (*t == ' ' || *t == '|') t++;
}
- /* Parse this entry */
if (0 != grab_one_kind_flag(k_ptr, s)) return 5;
-
- /* Start the next entry */
s = t;
}
}
- else return 6;
+ else
+ {
+ return 6;
+ }
return 0;
}
*/
static errr grab_one_artifact_flag(artifact_type *a_ptr, concptr what)
{
- /* Check flags */
for (int i = 0; i < TR_FLAG_MAX; i++)
{
if (streq(what, k_info_flags[i]))
*/
errr parse_a_info(char *buf, header *head)
{
- /* Current entry */
static artifact_type *a_ptr = NULL;
-
- /* Process 'N' for "New/Number/Name" */
- int i;
char *s, *t;
if (buf[0] == 'N')
{
- /* Find the colon before the name */
s = my_strchr(buf + 2, ':');
-
- /* Verify that colon */
if (!s) return 1;
- /* Nuke the colon, advance to the name */
*s++ = '\0';
#ifdef JP
- /* Paranoia -- require a name */
if (!*s) return 1;
#endif
- /* Get the index */
- i = atoi(buf + 2);
-
- /* Verify information */
+ int i = atoi(buf + 2);
if (i < error_idx) return 4;
-
- /* Verify information */
if (i >= head->info_num) return 2;
- /* Save the index */
error_idx = i;
-
- /* Point at the "info" */
a_ptr = &a_info[i];
-
- /* Ignore everything */
add_flag(a_ptr->flags, TR_IGNORE_ACID);
add_flag(a_ptr->flags, TR_IGNORE_ELEC);
add_flag(a_ptr->flags, TR_IGNORE_FIRE);
add_flag(a_ptr->flags, TR_IGNORE_COLD);
#ifdef JP
- /* Store the name */
if (!add_name(&a_ptr->name, head, s)) return 7;
#endif
}
-
- /* There better be a current a_ptr */
- else if (!a_ptr) return 3;
-
-
+ else if (!a_ptr)
+ {
+ return 3;
+ }
#ifdef JP
/* 英語名を読むルーチンを追加 */
/* 'E' から始まる行は英語名としている */
#else
else if (buf[0] == 'E')
{
- /* Acquire the Text */
s = buf + 2;
-
- /* Store the name */
if (!add_name(&a_ptr->name, head, s)) return 7;
}
#endif
-
- /* Process 'D' for "Description" */
else if (buf[0] == 'D')
{
#ifdef JP
if (buf[2] == '$')
return 0;
- /* Acquire the text */
s = buf + 2;
#else
if (buf[2] != '$')
return 0;
- /* Acquire the text */
s = buf + 3;
#endif
-
- /* Store the text */
if (!add_text(&a_ptr->text, head, s, TRUE)) return 7;
}
-
-
- /* Process 'I' for "Info" (one line only) */
else if (buf[0] == 'I')
{
int tval, sval, pval;
-
- /* Scan for the values */
if (3 != sscanf(buf + 2, "%d:%d:%d",
&tval, &sval, &pval)) return 1;
- /* Save the values */
a_ptr->tval = (OBJECT_TYPE_VALUE)tval;
a_ptr->sval = (OBJECT_SUBTYPE_VALUE)sval;
a_ptr->pval = (PARAMETER_VALUE)pval;
}
-
- /* Process 'W' for "More Info" (one line only) */
else if (buf[0] == 'W')
{
int level, rarity, wgt;
long cost;
-
- /* Scan for the values */
if (4 != sscanf(buf + 2, "%d:%d:%d:%ld",
&level, &rarity, &wgt, &cost)) return 1;
- /* Save the values */
a_ptr->level = (DEPTH)level;
a_ptr->rarity = (RARITY)rarity;
a_ptr->weight = (WEIGHT)wgt;
a_ptr->cost = (PRICE)cost;
}
-
- /* Hack -- Process 'P' for "power" and such */
else if (buf[0] == 'P')
{
int ac, hd1, hd2, th, td, ta;
-
- /* Scan for the values */
if (6 != sscanf(buf + 2, "%d:%dd%d:%d:%d:%d",
&ac, &hd1, &hd2, &th, &td, &ta)) return 1;
a_ptr->to_d = (HIT_POINT)td;
a_ptr->to_a = (ARMOUR_CLASS)ta;
}
-
- /* Hack -- Process 'U' for activation index */
else if (buf[0] == 'U')
{
byte n;
return 5;
}
}
-
- /* Hack -- Process 'F' for flags */
else if (buf[0] == 'F')
{
- /* Parse every entry textually */
for (s = buf + 2; *s; )
{
- /* Find the end of this entry */
- for (t = s; *t && (*t != ' ') && (*t != '|'); ++t) /* loop */;
+ /* loop */
+ for (t = s; *t && (*t != ' ') && (*t != '|'); ++t);
- /* Nuke and skip any dividers */
if (*t)
{
*t++ = '\0';
while ((*t == ' ') || (*t == '|')) t++;
}
- /* Parse this entry */
if (0 != grab_one_artifact_flag(a_ptr, s)) return 5;
- /* Start the next entry */
s = t;
}
}
- else return 6;
+ else
+ {
+ return 6;
+ }
return 0;
}
*/
static bool grab_one_ego_item_flag(ego_item_type *e_ptr, concptr what)
{
- /* Check flags */
for (int i = 0; i < TR_FLAG_MAX; i++)
{
if (streq(what, k_info_flags[i]))
*/
errr parse_e_info(char *buf, header *head)
{
- /* Current entry */
static ego_item_type *e_ptr = NULL;
-
- /* Just before the first record */
error_idx = -1;
-
- /* Just before the first line */
error_line = -1;
-
- /* Process 'N' for "New/Number/Name" */
- int i;
char *s, *t;
if (buf[0] == 'N')
{
- /* Find the colon before the name */
s = my_strchr(buf + 2, ':');
-
- /* Verify that colon */
if (!s) return 1;
- /* Nuke the colon, advance to the name */
*s++ = '\0';
#ifdef JP
- /* Paranoia -- require a name */
if (!*s) return 1;
#endif
- /* Get the index */
- i = atoi(buf + 2);
-
- /* Verify information */
+ int i = atoi(buf + 2);
if (i < error_idx) return 4;
-
- /* Verify information */
if (i >= head->info_num) return 2;
- /* Save the index */
error_idx = i;
-
- /* Point at the "info" */
e_ptr = &e_info[i];
#ifdef JP
- /* Store the name */
if (!add_name(&e_ptr->name, head, s)) return 7;
#endif
}
-
- /* There better be a current e_ptr */
- else if (!e_ptr) return 3;
-
-
+ else if (!e_ptr)
+ {
+ return 3;
+ }
#ifdef JP
/* 英語名を読むルーチンを追加 */
/* 'E' から始まる行は英語名 */
#else
else if (buf[0] == 'E')
{
- /* Acquire the Text */
s = buf + 2;
-
- /* Store the name */
if (!add_name(&e_ptr->name, head, s)) return 7;
}
#endif
- /* Process 'X' for "Xtra" (one line only) */
else if (buf[0] == 'X')
{
int slot, rating;
-
- /* Scan for the values */
if (2 != sscanf(buf + 2, "%d:%d",
&slot, &rating)) return 1;
- /* Save the values */
e_ptr->slot = (INVENTORY_IDX)slot;
e_ptr->rating = (PRICE)rating;
}
-
- /* Process 'W' for "More Info" (one line only) */
else if (buf[0] == 'W')
{
int level, rarity, pad2;
long cost;
- /* Scan for the values */
if (4 != sscanf(buf + 2, "%d:%d:%d:%ld",
&level, &rarity, &pad2, &cost)) return 1;
- /* Save the values */
e_ptr->level = level;
e_ptr->rarity = (RARITY)rarity;
- /* e_ptr->weight = wgt; */
e_ptr->cost = cost;
}
-
- /* Hack -- Process 'C' for "creation" */
else if (buf[0] == 'C')
{
int th, td, ta, pval;
- /* Scan for the values */
if (4 != sscanf(buf + 2, "%d:%d:%d:%d",
&th, &td, &ta, &pval)) return 1;
e_ptr->max_to_a = (ARMOUR_CLASS)ta;
e_ptr->max_pval = (PARAMETER_VALUE)pval;
}
-
- /* Hack -- Process 'U' for activation index */
else if (buf[0] == 'U')
{
byte n;
return 5;
}
}
-
- /* Hack -- Process 'F' for flags */
else if (buf[0] == 'F')
{
- /* Parse every entry textually */
for (s = buf + 2; *s; )
{
- /* Find the end of this entry */
- for (t = s; *t && (*t != ' ') && (*t != '|'); ++t) /* loop */;
+ /* loop */
+ for (t = s; *t && (*t != ' ') && (*t != '|'); ++t);
- /* Nuke and skip any dividers */
if (*t)
{
*t++ = '\0';
while ((*t == ' ') || (*t == '|')) t++;
}
- /* Parse this entry */
if (0 != grab_one_ego_item_flag(e_ptr, s)) return 5;
- /* Start the next entry */
s = t;
}
}
- else return 6;
+ else
+ {
+ return 6;
+ }
return 0;
}
*/
errr parse_r_info(char *buf, header *head)
{
- /* Current entry */
static monster_race *r_ptr = NULL;
-
- /* Process 'N' for "New/Number/Name" */
- int i;
char *s, *t;
if (buf[0] == 'N')
{
- /* Find the colon before the name */
s = my_strchr(buf + 2, ':');
-
- /* Verify that colon */
if (!s) return 1;
- /* Nuke the colon, advance to the name */
*s++ = '\0';
#ifdef JP
- /* Paranoia -- require a name */
if (!*s) return 1;
#endif
- /* Get the index */
- i = atoi(buf + 2);
- /* Verify information */
+ int i = atoi(buf + 2);
if (i < error_idx) return 4;
-
- /* Verify information */
if (i >= head->info_num) return 2;
- /* Save the index */
error_idx = i;
-
- /* Point at the "info" */
r_ptr = &r_info[i];
#ifdef JP
- /* Store the name */
if (!add_name(&r_ptr->name, head, s)) return 7;
#endif
}
-
- /* There better be a current r_ptr */
- else if (!r_ptr) return 3;
-
-
+ else if (!r_ptr)
+ {
+ return 3;
+ }
#ifdef JP
/* 英語名を読むルーチンを追加 */
/* 'E' から始まる行は英語名 */
else if (buf[0] == 'E')
{
- /* Acquire the Text */
s = buf + 2;
-
- /* Store the name */
if (!add_name(&r_ptr->E_name, head, s)) return 7;
}
#else
else if (buf[0] == 'E')
{
- /* Acquire the Text */
s = buf + 2;
-
- /* Store the name */
if (!add_name(&r_ptr->name, head, s)) return 7;
}
#endif
- /* Process 'D' for "Description" */
else if (buf[0] == 'D')
{
#ifdef JP
if (buf[2] == '$')
return 0;
- /* Acquire the text */
s = buf + 2;
#else
if (buf[2] != '$')
return 0;
- /* Acquire the text */
s = buf + 3;
#endif
-
- /* Store the text */
if (!add_text(&r_ptr->text, head, s, TRUE)) return 7;
}
-
- /* Process 'G' for "Graphics" (one line only) */
else if (buf[0] == 'G')
{
- char sym;
- byte tmp;
if (buf[1] != ':') return 1;
if (!buf[2]) return 1;
if (buf[3] != ':') return 1;
if (!buf[4]) return 1;
- /* Extract the char */
- sym = buf[2];
-
- /* Extract the attr */
- tmp = color_char_to_attr(buf[4]);
+ char sym = buf[2];
+ byte tmp = color_char_to_attr(buf[4]);
if (tmp > 127) return 1;
- /* Save the values */
r_ptr->d_char = sym;
r_ptr->d_attr = tmp;
}
-
- /* Process 'I' for "Info" (one line only) */
else if (buf[0] == 'I')
{
int spd, hp1, hp2, aaf, ac, slp;
- /* Scan for the other values */
if (6 != sscanf(buf + 2, "%d:%dd%d:%d:%d:%d",
&spd, &hp1, &hp2, &aaf, &ac, &slp)) return 1;
- /* Save the values */
r_ptr->speed = (SPEED)spd;
r_ptr->hdice = (DICE_NUMBER)MAX(hp1, 1);
r_ptr->hside = (DICE_SID)MAX(hp2, 1);
r_ptr->ac = (ARMOUR_CLASS)ac;
r_ptr->sleep = (SLEEP_DEGREE)slp;
}
-
- /* Process 'W' for "More Info" (one line only) */
else if (buf[0] == 'W')
{
int lev, rar, pad;
long exp;
long nextexp;
int nextmon;
-
- /* Scan for the values */
if (6 != sscanf(buf + 2, "%d:%d:%d:%ld:%ld:%d",
&lev, &rar, &pad, &exp, &nextexp, &nextmon)) return 1;
- /* Save the values */
r_ptr->level = (DEPTH)lev;
r_ptr->rarity = (RARITY)rar;
r_ptr->extra = (BIT_FLAGS16)pad;
r_ptr->next_exp = (EXP)nextexp;
r_ptr->next_r_idx = (MONRACE_IDX)nextmon;
}
-
- /* Process 'R' for "Reinforcement" (up to six lines) */
else if (buf[0] == 'R')
{
int id, ds, dd;
- /* Find the next empty blow slot (if any) */
- for (i = 0; i < A_MAX; i++) if (r_ptr->reinforce_id[i] == 0) break;
+ int i = 0;
+ for (; i < A_MAX; i++) if (r_ptr->reinforce_id[i] == 0) break;
- /* Oops, no more slots */
if (i == 6) return 1;
- /* Scan for the values */
if (3 != sscanf(buf + 2, "%d:%dd%d", &id, &dd, &ds)) return 1;
r_ptr->reinforce_id[i] = (MONRACE_IDX)id;
r_ptr->reinforce_dd[i] = (DICE_NUMBER)dd;
r_ptr->reinforce_ds[i] = (DICE_SID)ds;
}
-
- /* Process 'B' for "Blows" (up to four lines) */
else if (buf[0] == 'B')
{
int n1, n2;
-
- /* Find the next empty blow slot (if any) */
+ int i = 0;
for (i = 0; i < 4; i++) if (!r_ptr->blow[i].method) break;
- /* Oops, no more slots */
if (i == 4) return 1;
- /* Analyze the first field */
- for (s = t = buf + 2; *t && (*t != ':'); t++) /* loop */;
+ /* loop */
+ for (s = t = buf + 2; *t && (*t != ':'); t++);
- /* Terminate the field (if necessary) */
if (*t == ':') *t++ = '\0';
- /* Analyze the method */
for (n1 = 0; r_info_blow_method[n1]; n1++)
{
if (streq(s, r_info_blow_method[n1])) break;
}
- /* Invalid method */
if (!r_info_blow_method[n1]) return 1;
- /* Analyze the second field */
- for (s = t; *t && (*t != ':'); t++) /* loop */;
+ /* loop */
+ for (s = t; *t && (*t != ':'); t++);
- /* Terminate the field (if necessary) */
if (*t == ':') *t++ = '\0';
- /* Analyze effect */
for (n2 = 0; r_info_blow_effect[n2]; n2++)
{
if (streq(s, r_info_blow_effect[n2])) break;
}
- /* Invalid effect */
if (!r_info_blow_effect[n2]) return 1;
- /* Analyze the third field */
- for (s = t; *t && (*t != 'd'); t++) /* loop */;
+ /* loop */
+ for (s = t; *t && (*t != 'd'); t++);
- /* Terminate the field (if necessary) */
if (*t == 'd') *t++ = '\0';
- /* Save the method */
r_ptr->blow[i].method = (BLOW_METHOD)n1;
-
- /* Save the effect */
r_ptr->blow[i].effect = (BLOW_EFFECT)n2;
-
- /* Extract the damage dice and sides */
r_ptr->blow[i].d_dice = atoi(s);
r_ptr->blow[i].d_side = atoi(t);
}
-
- /* Process 'F' for "Basic Flags" (multiple lines) */
else if (buf[0] == 'F')
{
- /* Parse every entry */
for (s = buf + 2; *s; )
{
- /* Find the end of this entry */
- for (t = s; *t && (*t != ' ') && (*t != '|'); ++t) /* loop */;
+ /* loop */
+ for (t = s; *t && (*t != ' ') && (*t != '|'); ++t);
- /* Nuke and skip any dividers */
if (*t)
{
*t++ = '\0';
while (*t == ' ' || *t == '|') t++;
}
- /* Parse this entry */
if (0 != grab_one_basic_flag(r_ptr, s)) return 5;
- /* Start the next entry */
s = t;
}
}
-
- /* Process 'S' for "Spell Flags" (multiple lines) */
else if (buf[0] == 'S')
{
- /* Parse every entry */
for (s = buf + 2; *s; )
{
- /* Find the end of this entry */
- for (t = s; *t && (*t != ' ') && (*t != '|'); ++t) /* loop */;
- /* Nuke and skip any dividers */
+ /* loop */
+ for (t = s; *t && (*t != ' ') && (*t != '|'); ++t);
+
if (*t)
{
*t++ = '\0';
while ((*t == ' ') || (*t == '|')) t++;
}
- /* Hack -- Read spell frequency */
+ int i;
if (1 == sscanf(s, "1_IN_%d", &i))
{
- /* Extract a "frequency" */
r_ptr->freq_spell = 100 / i;
-
- /* Start at next entry */
s = t;
continue;
}
- /* Parse this entry */
if (0 != grab_one_spell_flag(r_ptr, s)) return 5;
- /* Start the next entry */
s = t;
}
}
-
- /* Process 'A' for "Artifact Flags" (multiple lines) */
else if (buf[0] == 'A')
{
int id, per, rarity;
-
- /* Find the next empty blow slot (if any) */
+ int i = 0;
for (i = 0; i < 4; i++) if (!r_ptr->artifact_id[i]) break;
- /* Oops, no more slots */
if (i == 4) return 1;
if (3 != sscanf(buf + 2, "%d:%d:%d", &id, &rarity, &per)) return 1;
r_ptr->artifact_rarity[i] = (RARITY)rarity;
r_ptr->artifact_percent[i] = (PERCENTAGE)per;
}
-
- /* Process 'V' for "Arena power value ratio" */
else if (buf[0] == 'V')
{
int val;
if (3 != sscanf(buf + 2, "%d", &val)) return 1;
r_ptr->arena_ratio = (PERCENTAGE)val;
}
- else return 6;
+ else
+ {
+ return 6;
+ }
return 0;
}
*/
errr parse_d_info(char *buf, header *head)
{
- /* Current entry */
static dungeon_type *d_ptr = NULL;
-
- /* Process 'N' for "New/Number/Name" */
- int i;
char *s, *t;
if (buf[0] == 'N')
{
- /* Find the colon before the name */
s = my_strchr(buf + 2, ':');
-
- /* Verify that colon */
if (!s) return 1;
- /* Nuke the colon, advance to the name */
*s++ = '\0';
#ifdef JP
- /* Paranoia -- require a name */
if (!*s) return 1;
#endif
- /* Get the index */
- i = atoi(buf + 2);
- /* Verify information */
+ int i = atoi(buf + 2);
if (i < error_idx) return 4;
-
- /* Verify information */
if (i >= head->info_num) return 2;
- /* Save the index */
error_idx = i;
-
- /* Point at the "info" */
d_ptr = &d_info[i];
#ifdef JP
- /* Store the name */
if (!add_name(&d_ptr->name, head, s)) return 7;
#endif
}
-
#ifdef JP
else if (buf[0] == 'E') return 0;
#else
if (!add_name(&d_ptr->name, head, s)) return 7;
}
#endif
-
- /* Process 'D' for "Description */
else if (buf[0] == 'D')
{
#ifdef JP
if (buf[2] == '$')
return 0;
- /* Acquire the text */
s = buf + 2;
#else
if (buf[2] != '$')
return 0;
- /* Acquire the text */
s = buf + 3;
#endif
-
- /* Store the text */
if (!add_text(&d_ptr->text, head, s, TRUE)) return 7;
}
-
- /* Process 'W' for "More Info" (one line only) */
else if (buf[0] == 'W')
{
int min_lev, max_lev;
int obj_good, obj_great;
int pit, nest;
- /* Scan for the values */
if (10 != sscanf(buf + 2, "%d:%d:%d:%d:%d:%d:%d:%d:%x:%x",
&min_lev, &max_lev, &min_plev, &mode, &min_alloc, &max_chance, &obj_good, &obj_great, (unsigned int *)&pit, (unsigned int *)&nest)) return 1;
- /* Save the values */
d_ptr->mindepth = (DEPTH)min_lev;
d_ptr->maxdepth = (DEPTH)max_lev;
d_ptr->min_plev = (PLAYER_LEVEL)min_plev;
d_ptr->pit = (BIT_FLAGS16)pit;
d_ptr->nest = (BIT_FLAGS16)nest;
}
-
- /* Process 'P' for "Place Info" */
else if (buf[0] == 'P')
{
int dy, dx;
-
- /* Scan for the values */
if (2 != sscanf(buf + 2, "%d:%d", &dy, &dx)) return 1;
- /* Save the values */
d_ptr->dy = dy;
d_ptr->dx = dx;
}
-
- /* Process 'L' for "fLoor type" (one line only) */
else if (buf[0] == 'L')
{
char *zz[16];
-
- /* Scan for the values */
if (tokenize(buf + 2, DUNGEON_FEAT_PROB_NUM * 2 + 1, zz, 0) != (DUNGEON_FEAT_PROB_NUM * 2 + 1)) return 1;
- /* Save the values */
- for (i = 0; i < DUNGEON_FEAT_PROB_NUM; i++)
+ for (int i = 0; i < DUNGEON_FEAT_PROB_NUM; i++)
{
d_ptr->floor[i].feat = f_tag_to_index(zz[i * 2]);
if (d_ptr->floor[i].feat < 0) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
d_ptr->floor[i].percent = (PERCENTAGE)atoi(zz[i * 2 + 1]);
}
+
d_ptr->tunnel_percent = atoi(zz[DUNGEON_FEAT_PROB_NUM * 2]);
}
-
- /* Process 'A' for "wAll type" (one line only) */
else if (buf[0] == 'A')
{
char *zz[16];
-
- /* Scan for the values */
if (tokenize(buf + 2, DUNGEON_FEAT_PROB_NUM * 2 + 4, zz, 0) != (DUNGEON_FEAT_PROB_NUM * 2 + 4)) return 1;
- /* Save the values */
- for (i = 0; i < DUNGEON_FEAT_PROB_NUM; i++)
+ for (int i = 0; i < DUNGEON_FEAT_PROB_NUM; i++)
{
d_ptr->fill[i].feat = f_tag_to_index(zz[i * 2]);
if (d_ptr->fill[i].feat < 0) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
d_ptr->stream2 = f_tag_to_index(zz[DUNGEON_FEAT_PROB_NUM * 2 + 3]);
if (d_ptr->stream2 < 0) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
}
-
- /* Process 'F' for "Dungeon Flags" (multiple lines) */
else if (buf[0] == 'F')
{
int artif = 0, monst = 0;
- /* Parse every entry */
for (s = buf + 2; *s; )
{
- /* Find the end of this entry */
- for (t = s; *t && (*t != ' ') && (*t != '|'); ++t) /* loop */;
+ /* loop */
+ for (t = s; *t && (*t != ' ') && (*t != '|'); ++t);
- /* Nuke and skip any dividers */
if (*t)
{
*t++ = '\0';
while (*t == ' ' || *t == '|') t++;
}
- /* Hack -- Read Final Artifact */
if (1 == sscanf(s, "FINAL_ARTIFACT_%d", &artif))
{
- /* Extract a "Final Artifact" */
d_ptr->final_artifact = (ARTIFACT_IDX)artif;
-
- /* Start at next entry */
s = t;
continue;
}
- /* Hack -- Read Final Object */
if (1 == sscanf(s, "FINAL_OBJECT_%d", &artif))
{
- /* Extract a "Final Artifact" */
d_ptr->final_object = (KIND_OBJECT_IDX)artif;
-
- /* Start at next entry */
s = t;
continue;
}
- /* Hack -- Read Artifact Guardian */
if (1 == sscanf(s, "FINAL_GUARDIAN_%d", &monst))
{
- /* Extract a "Artifact Guardian" */
d_ptr->final_guardian = (MONRACE_IDX)monst;
-
- /* Start at next entry */
s = t;
continue;
}
- /* Hack -- Read Special Percentage */
if (1 == sscanf(s, "MONSTER_DIV_%d", &monst))
{
- /* Extract a "Special %" */
d_ptr->special_div = (PROB)monst;
-
- /* Start at next entry */
s = t;
continue;
}
- /* Parse this entry */
if (0 != grab_one_dungeon_flag(d_ptr, s)) return 5;
- /* Start the next entry */
s = t;
}
}
-
- /* Process 'M' for "Basic Flags" (multiple lines) */
else if (buf[0] == 'M')
{
- /* Parse every entry */
for (s = buf + 2; *s; )
{
- /* Find the end of this entry */
- for (t = s; *t && (*t != ' ') && (*t != '|'); ++t) /* loop */;
+ /* loop */
+ for (t = s; *t && (*t != ' ') && (*t != '|'); ++t);
- /* Nuke and skip any dividers */
if (*t)
{
*t++ = '\0';
while (*t == ' ' || *t == '|') t++;
}
- /* Hack -- Read monster symbols */
if (!strncmp(s, "R_CHAR_", 7))
{
- /* Skip "R_CHAR_" */
s += 7;
-
- /* Read a string */
strncpy(d_ptr->r_char, s, sizeof(d_ptr->r_char));
-
- /* Start at next entry */
s = t;
continue;
}
- /* Parse this entry */
if (0 != grab_one_basic_monster_flag(d_ptr, s)) return 5;
- /* Start the next entry */
s = t;
}
}
-
- /* Process 'S' for "Spell Flags" (multiple lines) */
else if (buf[0] == 'S')
{
- /* Parse every entry */
for (s = buf + 2; *s; )
{
- /* Find the end of this entry */
- for (t = s; *t && (*t != ' ') && (*t != '|'); ++t) /* loop */;
+ /* loop */
+ for (t = s; *t && (*t != ' ') && (*t != '|'); ++t);
- /* Nuke and skip any dividers */
if (*t)
{
*t++ = '\0';
while ((*t == ' ') || (*t == '|')) t++;
}
- /* Hack -- Read spell frequency */
+ int i;
if (1 == sscanf(s, "1_IN_%d", &i))
{
- /* Start at next entry */
s = t;
continue;
}
- /* Parse this entry */
if (0 != grab_one_spell_monster_flag(d_ptr, s)) return 5;
- /* Start the next entry */
s = t;
}
}
- else return 6;
+ else
+ {
+ return 6;
+ }
return 0;
}
{
if (init_flags & INIT_ONLY_BUILDINGS) return 0;
- /* Tokenize the line */
char *zz[9];
int num = tokenize(buf + 2, 9, zz, 0);
if (num <= 1) return 1;
- /* Letter to assign */
int index = zz[0][0];
-
- /* Reset the info for the letter */
letter[index].feature = feat_none;
letter[index].monster = 0;
letter[index].object = 0;
letter[index].special = 0;
letter[index].random = RANDOM_NONE;
+ /* Fall through */
switch (num)
{
- /* Special */
case 9:
letter[index].special = (s16b)atoi(zz[8]);
- /* Fall through */
- /* Trap */
case 8:
if ((zz[7][0] == '*') && !zz[7][1])
{
letter[index].trap = f_tag_to_index(zz[7]);
if (letter[index].trap < 0) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
}
- /* Fall through */
- /* Artifact */
case 7:
if (zz[6][0] == '*')
{
{
letter[index].artifact = (ARTIFACT_IDX)atoi(zz[6]);
}
- /* Fall through */
- /* Ego-item */
case 6:
if (zz[5][0] == '*')
{
{
letter[index].ego = (EGO_IDX)atoi(zz[5]);
}
- /* Fall through */
- /* Object */
case 5:
if (zz[4][0] == '*')
{
{
letter[index].object = (IDX)atoi(zz[4]);
}
- /* Fall through */
- /* Monster */
case 4:
if (zz[3][0] == '*')
{
{
letter[index].monster = (IDX)atoi(zz[3]);
}
- /* Fall through */
- /* Cave info */
case 3:
letter[index].cave_info = atoi(zz[2]);
- /* Fall through */
- /* Feature */
case 2:
if ((zz[1][0] == '*') && !zz[1][1])
{
letter[index].feature = f_tag_to_index(zz[1]);
if (letter[index].feature < 0) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
}
+
break;
}
*/
static errr parse_line_building(char *buf)
{
- int i;
char *zz[1000];
- int index;
char *s;
#ifdef JP
return 0;
s = buf + 3;
#endif
- /* Get the building number */
- index = atoi(s);
-
- /* Find the colon after the building number */
+ int index = atoi(s);
s = my_strchr(s, ':');
-
- /* Verify that colon */
if (!s) return 1;
- /* Nuke the colon, advance to the sub-index */
*s++ = '\0';
-
- /* Paranoia -- require a sub-index */
if (!*s) return 1;
- /* Building definition sub-index */
switch (s[0])
{
- /* Building name, owner, race */
case 'N':
{
if (tokenize(s + 2, 3, zz, 0) == 3)
{
- /* Name of the building */
strcpy(building[index].name, zz[0]);
-
- /* Name of the owner */
strcpy(building[index].owner_name, zz[1]);
-
- /* Race of the owner */
strcpy(building[index].owner_race, zz[2]);
-
break;
}
return (PARSE_ERROR_TOO_FEW_ARGUMENTS);
}
-
- /* Building Action */
case 'A':
{
if (tokenize(s + 2, 8, zz, 0) >= 7)
{
- /* Index of the action */
int action_index = atoi(zz[0]);
-
- /* Name of the action */
strcpy(building[index].act_names[action_index], zz[1]);
-
- /* Cost of the action for members */
building[index].member_costs[action_index] = (PRICE)atoi(zz[2]);
-
- /* Cost of the action for non-members */
building[index].other_costs[action_index] = (PRICE)atoi(zz[3]);
-
- /* Letter assigned to the action */
building[index].letters[action_index] = zz[4][0];
-
- /* Action code */
building[index].actions[action_index] = (BACT_IDX)atoi(zz[5]);
-
- /* Action restriction */
building[index].action_restr[action_index] = (BACT_RESTRICT_IDX)atoi(zz[6]);
-
break;
}
return (PARSE_ERROR_TOO_FEW_ARGUMENTS);
}
-
- /* Building Classes */
case 'C':
{
int n;
n = tokenize(s + 2, MAX_CLASS, zz, 0);
- for (i = 0; i < MAX_CLASS; i++)
+ for (int i = 0; i < MAX_CLASS; i++)
{
building[index].member_class[i] = ((i < n) ? (CLASS_IDX)atoi(zz[i]) : 1);
}
+
break;
}
-
- /* Building Races */
case 'R':
{
int n;
n = tokenize(s + 2, MAX_RACES, zz, 0);
- for (i = 0; i < MAX_RACES; i++)
+ for (int i = 0; i < MAX_RACES; i++)
{
building[index].member_race[i] = ((i < n) ? (RACE_IDX)atoi(zz[i]) : 1);
}
+
break;
}
-
- /* Building Realms */
case 'M':
{
int n;
n = tokenize(s + 2, MAX_MAGIC, zz, 0);
- for (i = 0; i < MAX_MAGIC; i++)
+ for (int i = 0; i < MAX_MAGIC; i++)
{
building[index].member_realm[i + 1] = ((i < n) ? (REALM_IDX)atoi(zz[i]) : 1);
}
+
break;
}
-
case 'Z':
{
- /* Ignore scripts */
break;
}
-
default:
{
return (PARSE_ERROR_UNDEFINED_DIRECTIVE);
*/
static errr process_dungeon_file_aux(player_type *player_ptr, char *buf, int ymin, int xmin, int ymax, int xmax, int *y, int *x)
{
- int i;
char *zz[33];
- /* Skip "empty" lines */
if (!buf[0]) return 0;
-
- /* Skip "blank" lines */
if (iswspace(buf[0])) return 0;
-
- /* Skip comments */
if (buf[0] == '#') return 0;
-
- /* Require "?:*" format */
if (buf[1] != ':') return 1;
-
- /* Process "%:<fname>" */
if (buf[0] == '%')
{
- /* Attempt to Process the given file */
return process_dungeon_file(player_ptr, buf + 2, ymin, xmin, ymax, xmax);
}
{
return parse_line_feature(player_ptr->current_floor_ptr, buf);
}
-
- /* Process "D:<dungeon>" -- info for the floor grids */
else if (buf[0] == 'D')
{
object_type object_type_body;
-
- /* Acquire the text */
char *s = buf + 2;
-
- /* Length of the text */
int len = strlen(s);
-
if (init_flags & INIT_ONLY_BUILDINGS) return 0;
- for (*x = xmin, i = 0; ((*x < xmax) && (i < len)); (*x)++, s++, i++)
+ *x = xmin;
+ for (int i = 0; ((*x < xmax) && (i < len)); (*x)++, s++, i++)
{
grid_type *g_ptr = &floor_ptr->grid_array[*y][*x];
-
int idx = s[0];
-
OBJECT_IDX object_index = letter[idx].object;
MONSTER_IDX monster_index = letter[idx].monster;
int random = letter[idx].random;
ARTIFACT_IDX artifact_index = letter[idx].artifact;
-
- /* Lay down a floor */
g_ptr->feat = conv_dungeon_feat(floor_ptr, letter[idx].feature);
-
- /* Only the features */
if (init_flags & INIT_ONLY_FEATURES) continue;
- /* Cave info */
g_ptr->info = letter[idx].cave_info;
-
- /* Create a monster */
if (random & RANDOM_MONSTER)
{
floor_ptr->monster_level = floor_ptr->base_level + monster_index;
monster_index = -monster_index;
clone = TRUE;
}
+
old_cur_num = r_info[monster_index].cur_num;
old_max_num = r_info[monster_index].max_num;
- /* Make alive again */
if (r_info[monster_index].flags1 & RF1_UNIQUE)
{
r_info[monster_index].cur_num = 0;
r_info[monster_index].max_num = 1;
}
-
- /* Make alive again */
- /* Hack -- Non-unique Nazguls are semi-unique */
else if (r_info[monster_index].flags7 & RF7_NAZGUL)
{
if (r_info[monster_index].cur_num == r_info[monster_index].max_num)
}
}
- /* Place it */
place_monster_aux(player_ptr, 0, *y, *x, monster_index, (PM_ALLOW_SLEEP | PM_NO_KAGE));
if (clone)
{
- /* clone */
floor_ptr->m_list[hack_m_idx_ii].smart |= SM_CLONED;
-
- /* Make alive again for real unique monster */
r_info[monster_index].cur_num = old_cur_num;
r_info[monster_index].max_num = old_max_num;
}
}
- /* Object (and possible trap) */
if ((random & RANDOM_OBJECT) && (random & RANDOM_TRAP))
{
floor_ptr->object_level = floor_ptr->base_level + object_index;
else if (random & RANDOM_OBJECT)
{
floor_ptr->object_level = floor_ptr->base_level + object_index;
-
- /* Create an out of deep object */
if (randint0(100) < 75)
place_object(player_ptr, *y, *x, 0L);
else if (randint0(100) < 80)
floor_ptr->object_level = floor_ptr->base_level;
}
- /* Random trap */
else if (random & RANDOM_TRAP)
{
place_trap(player_ptr, *y, *x);
}
- /* Hidden trap (or door) */
else if (letter[idx].trap)
{
g_ptr->mimic = g_ptr->feat;
{
object_type *o_ptr = &object_type_body;
object_prep(o_ptr, object_index);
-
if (o_ptr->tval == TV_GOLD)
{
coin_type = object_index - OBJ_GOLD_LIST;
coin_type = 0;
}
- /* Apply magic (no messages, no artifacts) */
apply_magic(player_ptr, o_ptr, floor_ptr->base_level, AM_NO_FIXED_ART | AM_GOOD);
-
drop_here(floor_ptr, o_ptr, *y, *x);
}
- /* Artifact */
if (artifact_index)
{
if (a_info[artifact_index].cur_num)
}
}
- /* Terrain special */
g_ptr->special = letter[idx].special;
}
(*y)++;
-
return 0;
}
-
- /* Process "Q:<number>:<command>:... -- quest info */
else if (buf[0] == 'Q')
{
int num;
num = tokenize(buf + 3, 33, zz, 0);
#endif
- /* Have we enough parameters? */
if (num < 3) return (PARSE_ERROR_TOO_FEW_ARGUMENTS);
- /* Get the quest */
q_ptr = &(quest[atoi(zz[0])]);
-
- /* Process "Q:<q_index>:Q:<type>:<num_mon>:<cur_num>:<max_num>:<level>:<r_idx>:<k_idx>:<flags>" -- quest info */
if (zz[1][0] == 'Q')
{
if (init_flags & INIT_ASSIGN)
a_ptr = &a_info[q_ptr->k_idx];
a_ptr->gen_flags |= TRG_QUESTITEM;
}
+
return 0;
}
-
else if (zz[1][0] == 'R')
{
if (init_flags & INIT_ASSIGN)
if (reward_idx)
{
- /* Set quest's rewarding artifact */
q_ptr->k_idx = reward_idx;
a_info[reward_idx].gen_flags |= TRG_QUESTITEM;
}
else
{
- /* Change a quest type to KILL_ALL when all artifact of reward list are got */
q_ptr->type = QUEST_TYPE_KILL_ALL;
}
}
return 0;
}
-
- /* Process "Q:<q_index>:N:<name>" -- quest name */
else if (zz[1][0] == 'N')
{
if (init_flags & (INIT_ASSIGN | INIT_SHOW_TEXT | INIT_NAME_ONLY))
return 0;
}
-
- /* Process "Q:<q_index>:T:<text>" -- quest description line */
else if (zz[1][0] == 'T')
{
if (init_flags & INIT_SHOW_TEXT)
return 0;
}
}
-
- /* Process "W:<command>: ..." -- info for the wilderness */
else if (buf[0] == 'W')
{
return parse_line_wilderness(player_ptr, buf, xmin, xmax, y, x);
}
-
- /* Process "P:<y>:<x>" -- player position */
else if (buf[0] == 'P')
{
if (init_flags & INIT_CREATE_DUNGEON)
{
int panels_x, panels_y;
- /* Hack - Set the dungeon size */
panels_y = (*y / SCREEN_HGT);
if (*y % SCREEN_HGT) panels_y++;
floor_ptr->height = panels_y * SCREEN_HGT;
if (*x % SCREEN_WID) panels_x++;
floor_ptr->width = panels_x * SCREEN_WID;
- /* Assume illegal panel */
panel_row_min = floor_ptr->height;
panel_col_min = floor_ptr->width;
- /* Place player in a quest level */
if (floor_ptr->inside_quest)
{
- POSITION py, px;
-
- /* Delete the monster (if any) */
delete_monster(player_ptr, player_ptr->y, player_ptr->x);
- py = atoi(zz[0]);
- px = atoi(zz[1]);
+ POSITION py = atoi(zz[0]);
+ POSITION px = atoi(zz[1]);
player_ptr->y = py;
player_ptr->x = px;
}
- /* Place player in the town */
else if (!player_ptr->oldpx && !player_ptr->oldpy)
{
player_ptr->oldpy = atoi(zz[0]);
return 0;
}
-
- /* Process "B:<Index>:<Command>:..." -- Building definition */
else if (buf[0] == 'B')
{
return parse_line_building(buf);
}
-
- /* Process "M:<type>:<maximum>" -- set maximum values */
else if (buf[0] == 'M')
{
if (tokenize(buf + 2, 2, zz, 0) == 2)
{
- /* Maximum towns */
if (zz[0][0] == 'T')
{
max_towns = (TOWN_IDX)atoi(zz[1]);
}
-
- /* Maximum quests */
else if (zz[0][0] == 'Q')
{
max_q_idx = (QUEST_IDX)atoi(zz[1]);
}
-
- /* Maximum r_idx */
else if (zz[0][0] == 'R')
{
max_r_idx = (RACE_IDX)atoi(zz[1]);
}
-
- /* Maximum k_idx */
else if (zz[0][0] == 'K')
{
max_k_idx = (KIND_OBJECT_IDX)atoi(zz[1]);
}
-
- /* Maximum v_idx */
else if (zz[0][0] == 'V')
{
max_v_idx = (VAULT_IDX)atoi(zz[1]);
}
-
- /* Maximum f_idx */
else if (zz[0][0] == 'F')
{
max_f_idx = (FEAT_IDX)atoi(zz[1]);
}
-
- /* Maximum a_idx */
else if (zz[0][0] == 'A')
{
max_a_idx = (ARTIFACT_IDX)atoi(zz[1]);
}
-
- /* Maximum e_idx */
else if (zz[0][0] == 'E')
{
max_e_idx = (EGO_IDX)atoi(zz[1]);
}
-
- /* Maximum d_idx */
else if (zz[0][0] == 'D')
{
current_world_ptr->max_d_idx = (DUNGEON_IDX)atoi(zz[1]);
}
-
- /* Maximum o_idx */
else if (zz[0][0] == 'O')
{
current_world_ptr->max_o_idx = (OBJECT_IDX)atoi(zz[1]);
}
-
- /* Maximum m_idx */
else if (zz[0][0] == 'M')
{
current_world_ptr->max_m_idx = (MONSTER_IDX)atoi(zz[1]);
}
-
- /* Wilderness size */
else if (zz[0][0] == 'W')
{
- /* Maximum wild_x_size */
if (zz[0][1] == 'X')
current_world_ptr->max_wild_x = (POSITION)atoi(zz[1]);
- /* Maximum wild_y_size */
+
if (zz[0][1] == 'Y')
current_world_ptr->max_wild_y = (POSITION)atoi(zz[1]);
}
char *s;
s = (*sp);
- /* Skip spaces */
while (iswspace(*s)) s++;
- /* Save start */
char *b;
b = s;
-
- /* Default */
concptr v = "?o?o?";
-
- /* Analyze */
if (*s == b1)
{
concptr p;
concptr t;
-
- /* Skip b1 */
s++;
-
- /* First */
t = process_dungeon_file_expr(player_ptr, &s, &f);
-
if (!*t)
{
/* Nothing */
}
-
- /* Function: IOR */
else if (streq(t, "IOR"))
{
v = "0";
if (*t && !streq(t, "0")) v = "1";
}
}
-
- /* Function: AND */
else if (streq(t, "AND"))
{
v = "1";
if (*t && streq(t, "0")) v = "0";
}
}
-
- /* Function: NOT */
else if (streq(t, "NOT"))
{
v = "1";
if (*t && streq(t, "1")) v = "0";
}
}
-
- /* Function: EQU */
else if (streq(t, "EQU"))
{
v = "0";
{
t = process_dungeon_file_expr(player_ptr, &s, &f);
}
+
while (*s && (f != b2))
{
p = process_dungeon_file_expr(player_ptr, &s, &f);
if (streq(t, p)) v = "1";
}
}
-
- /* Function: LEQ */
else if (streq(t, "LEQ"))
{
v = "1";
{
t = process_dungeon_file_expr(player_ptr, &s, &f);
}
+
while (*s && (f != b2))
{
p = t;
if (*t && atoi(p) > atoi(t)) v = "0";
}
}
-
- /* Function: GEQ */
else if (streq(t, "GEQ"))
{
v = "1";
{
t = process_dungeon_file_expr(player_ptr, &s, &f);
}
+
while (*s && (f != b2))
{
p = t;
t = process_dungeon_file_expr(player_ptr, &s, &f);
-
- /* Compare two numbers instead of string */
if (*t && atoi(p) < atoi(t)) v = "0";
}
}
-
else
{
while (*s && (f != b2))
}
}
- /* Verify ending */
if (f != b2) v = "?x?x?";
-
- /* Extract final and Terminate */
if ((f = *s) != '\0') *s++ = '\0';
(*fp) = f;
return v;
}
- /* Accept all printables except spaces and brackets */
#ifdef JP
while (iskanji(*s) || (isprint(*s) && !my_strchr(" []", *s)))
{
#else
while (isprint(*s) && !my_strchr(" []", *s)) ++s;
#endif
-
- /* Extract final and Terminate */
if ((f = *s) != '\0') *s++ = '\0';
- /* Variable */
if (*b != '$')
{
v = b;
return v;
}
- /* System */
if (streq(b + 1, "SYS"))
{
v = ANGBAND_SYS;
}
-
- /* Graphics */
else if (streq(b + 1, "GRAF"))
{
v = ANGBAND_GRAF;
}
-
else if (streq(b + 1, "MONOCHROME"))
{
if (arg_monochrome)
else
v = "OFF";
}
-
- /* Race */
else if (streq(b + 1, "RACE"))
{
v = _(rp_ptr->E_title, rp_ptr->title);
}
-
- /* Class */
else if (streq(b + 1, "CLASS"))
{
v = _(cp_ptr->E_title, cp_ptr->title);
}
-
- /* First realm */
else if (streq(b + 1, "REALM1"))
{
v = _(E_realm_names[player_ptr->realm1], realm_names[player_ptr->realm1]);
}
-
- /* Second realm */
else if (streq(b + 1, "REALM2"))
{
v = _(E_realm_names[player_ptr->realm2], realm_names[player_ptr->realm2]);
}
-
- /* Player name */
else if (streq(b + 1, "PLAYER"))
{
static char tmp_player_name[32];
#endif
*tpn = my_strchr(" []", *pn) ? '_' : *pn;
}
+
*tpn = '\0';
v = tmp_player_name;
}
-
- /* Town */
else if (streq(b + 1, "TOWN"))
{
sprintf(tmp, "%d", player_ptr->town_num);
v = tmp;
}
-
- /* Level */
else if (streq(b + 1, "LEVEL"))
{
sprintf(tmp, "%d", player_ptr->lev);
v = tmp;
}
-
- /* Current quest number */
else if (streq(b + 1, "QUEST_NUMBER"))
{
sprintf(tmp, "%d", player_ptr->current_floor_ptr->inside_quest);
v = tmp;
}
-
- /* Number of last quest */
else if (streq(b + 1, "LEAVING_QUEST"))
{
sprintf(tmp, "%d", leaving_quest);
v = tmp;
}
-
- /* Quest type */
else if (prefix(b + 1, "QUEST_TYPE"))
{
- /* "QUEST_TYPE" uses a special parameter to determine the type of the quest */
sprintf(tmp, "%d", quest[atoi(b + 11)].type);
v = tmp;
}
-
- /* Quest status */
else if (prefix(b + 1, "QUEST"))
{
- /* "QUEST" uses a special parameter to determine the number of the quest */
sprintf(tmp, "%d", quest[atoi(b + 6)].status);
v = tmp;
}
-
- /* Random */
else if (prefix(b + 1, "RANDOM"))
{
- /* "RANDOM" uses a special parameter to determine the number of the quest */
sprintf(tmp, "%d", (int)(current_world_ptr->seed_town%atoi(b + 7)));
v = tmp;
}
-
- /* Variant name */
else if (streq(b + 1, "VARIANT"))
{
v = variant;
}
-
- /* Wilderness */
else if (streq(b + 1, "WILDERNESS"))
{
if (vanilla_town)
FILE *fp;
fp = my_fopen(buf, "r");
- /* No such file */
if (!fp) return -1;
- /* Process the file */
int num = -1;
errr err = 0;
bool bypass = FALSE;
int x = xmin, y = ymin;
while (my_fgets(fp, buf, sizeof(buf)) == 0)
{
- /* Count lines */
num++;
-
-
- /* Skip "empty" lines */
if (!buf[0]) continue;
-
- /* Skip "blank" lines */
if (iswspace(buf[0])) continue;
-
- /* Skip comments */
if (buf[0] == '#') continue;
-
-
- /* Process "?:<expr>" */
if ((buf[0] == '?') && (buf[1] == ':'))
{
char f;
- concptr v;
char *s;
-
- /* Start */
s = buf + 2;
-
- /* Parse the expr */
- v = process_dungeon_file_expr(player_ptr, &s, &f);
-
- /* Set flag */
+ concptr v = process_dungeon_file_expr(player_ptr, &s, &f);
bypass = (streq(v, "0") ? TRUE : FALSE);
continue;
}
- /* Apply conditionals */
if (bypass) continue;
- /* Process the line */
err = process_dungeon_file_aux(player_ptr, buf, ymin, xmin, ymax, xmax, &y, &x);
-
if (err) break;
}
- if (err)
+ if (err != 0)
{
concptr oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "unknown");
msg_format("Error %d (%s) at line %d of '%s'.", err, oops, num, name);
((d_info[floor_ptr->dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR);
}
- /* Create secret door */
place_closed_door(player_ptr, y, x, type);
-
grid_type *g_ptr = &floor_ptr->grid_array[y][x];
if (type != DOOR_CURTAIN)
{
- /* Hide by inner wall because this is used in rooms only */
g_ptr->mimic = feat_wall_inner;
-
- /* Floor type terrain cannot hide a door */
if (feat_supports_los(g_ptr->mimic) && !feat_supports_los(g_ptr->feat))
{
if (have_flag(f_info[g_ptr->mimic].flags, FF_MOVE) || have_flag(f_info[g_ptr->mimic].flags, FF_CAN_FLY))
{ -1, 0, 0, 0,-1 },
};
- /* Loop the age and adjust scent values when necessary */
if (++scent_when == 254)
{
- /* Scan the entire dungeon */
for (POSITION y = 0; y < floor_ptr->height; y++)
{
for (POSITION x = 0; x < floor_ptr->width; x++)
}
}
- /* Restart */
scent_when = 126;
}
- /* Lay down new scent */
for (POSITION i = 0; i < 5; i++)
{
for (POSITION j = 0; j < 5; j++)
{
grid_type *g_ptr;
-
- /* Translate table to map grids */
POSITION y = i + subject_ptr->y - 2;
POSITION x = j + subject_ptr->x - 2;
-
- /* Check Bounds */
if (!in_bounds(floor_ptr, y, x)) continue;
g_ptr = &floor_ptr->grid_array[y][x];
-
- /* Walls, water, and lava cannot hold scent. */
if (!cave_have_flag_grid(g_ptr, FF_MOVE) && !is_closed_door(subject_ptr, g_ptr->feat)) continue;
-
- /* Grid must not be blocked by walls from the character */
if (!player_has_los_bold(subject_ptr, y, x)) continue;
-
- /* Note grids that are too far away */
if (scent_adjust[i][j] == -1) continue;
- /* Mark the grid with new scent */
g_ptr->when = scent_when + scent_adjust[i][j];
}
}
*/
void forget_flow(floor_type *floor_ptr)
{
- /* Check the entire dungeon */
for (POSITION y = 0; y < floor_ptr->height; y++)
{
for (POSITION x = 0; x < floor_ptr->width; x++)
{
- /* Forget the old data */
floor_ptr->grid_array[y][x].dist = 0;
floor_ptr->grid_array[y][x].cost = 0;
floor_ptr->grid_array[y][x].when = 0;
*/
void add_door(player_type *player_ptr, POSITION x, POSITION y)
{
- /* Need to have a wall in the center square */
floor_type *floor_ptr = player_ptr->current_floor_ptr;
if (!is_outer_bold(floor_ptr, y, x)) return;
if (is_floor_bold(floor_ptr, y - 1, x) && is_floor_bold(floor_ptr, y + 1, x) &&
(is_outer_bold(floor_ptr, y, x - 1) && is_outer_bold(floor_ptr, y, x + 1)))
{
- /* secret door */
place_secret_door(player_ptr, y, x, DOOR_DEFAULT);
-
- /* set boundarys so don't get wide doors */
place_bold(player_ptr, y, x - 1, gb_solid);
place_bold(player_ptr, y, x + 1, gb_solid);
}
if (is_outer_bold(floor_ptr, y - 1, x) && is_outer_bold(floor_ptr, y + 1, x) &&
is_floor_bold(floor_ptr, y, x - 1) && is_floor_bold(floor_ptr, y, x + 1))
{
- /* secret door */
place_secret_door(player_ptr, y, x, DOOR_DEFAULT);
-
- /* set boundarys so don't get wide doors */
place_bold(player_ptr, y - 1, x, gb_solid);
place_bold(player_ptr, y + 1, x, gb_solid);
}
if (floor_ptr->dun_level >= d_info[player_ptr->dungeon_idx].maxdepth) down_stairs = FALSE;
if (quest_number(player_ptr, floor_ptr->dun_level) && (floor_ptr->dun_level > 1)) down_stairs = FALSE;
- /* We can't place both */
if (down_stairs && up_stairs)
{
- /* Choose a staircase randomly */
if (randint0(100) < 50) up_stairs = FALSE;
else down_stairs = FALSE;
}
- /* Place the stairs */
if (up_stairs) set_cave_feat(floor_ptr, y, x, feat_up_stair);
else if (down_stairs) set_cave_feat(floor_ptr, y, x, feat_down_stair);
}
*/
bool los(player_type *player_ptr, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
{
- /* Extract the offset */
POSITION dy = y2 - y1;
POSITION dx = x2 - x1;
-
- /* Extract the absolute offset */
POSITION ay = ABS(dy);
POSITION ax = ABS(dx);
-
- /* Handle adjacent (or identical) grids */
if ((ax < 2) && (ay < 2)) return TRUE;
/* Directly South/North */
}
}
- /* Assume los */
return TRUE;
}
- /* Extract some signs */
POSITION sx = (dx < 0) ? -1 : 1;
POSITION sy = (dy < 0) ? -1 : 1;
- /* Vertical "knights" */
if (ax == 1)
{
if (ay == 2)
if (cave_los_bold(floor_ptr, y1 + sy, x1)) return TRUE;
}
}
-
- /* Horizontal "knights" */
else if (ay == 1)
{
if (ax == 2)
}
}
- /* Calculate scale factor div 2 */
POSITION f2 = (ax * ay);
-
- /* Calculate scale factor */
POSITION f1 = f2 << 1;
-
- /* Travel horizontally */
POSITION qy;
POSITION m;
if (ax >= ay)
{
- /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
qy = ay * ay;
m = qy << 1;
-
tx = x1 + sx;
-
- /* Consider the special case where slope == 1. */
if (qy == f2)
{
ty = y1 + sy;
}
/* Travel vertically */
- /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
POSITION qx = ax * ax;
m = qx << 1;
-
ty = y1 + sy;
-
if (qx == f2)
{
tx = x1 + sx;
*/
bool projectable(player_type *player_ptr, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
{
- /* Check the projection path */
u16b grid_g[512];
int grid_n = project_path(player_ptr, grid_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, 0);
-
- /* Identical grid */
if (!grid_n) return TRUE;
- /* Final grid */
POSITION y = GRID_Y(grid_g[grid_n - 1]);
POSITION x = GRID_X(grid_g[grid_n - 1]);
-
- /* May not end in an unrequested grid */
if ((y != y2) || (x != x2)) return FALSE;
return TRUE;
*/
void vault_monsters(player_type *player_ptr, POSITION y1, POSITION x1, int num)
{
- /* Try to summon "num" monsters "near" the given location */
floor_type *floor_ptr = player_ptr->current_floor_ptr;
for (int k = 0; k < num; k++)
{
- /* Try nine locations */
for (int i = 0; i < 9; i++)
{
int d = 1;
-
- /* Pick a nearby location */
POSITION y, x;
scatter(player_ptr, &y, &x, y1, x1, d, 0);
-
- /* Require "empty" floor grids */
grid_type *g_ptr;
g_ptr = &player_ptr->current_floor_ptr->grid_array[y][x];
if (!is_cave_empty_grid(player_ptr, g_ptr)) continue;
- /* Place the monster (allow groups) */
floor_ptr->monster_level = floor_ptr->base_level + 2;
(void)place_monster(player_ptr, y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
floor_ptr->monster_level = floor_ptr->base_level;
*/
bool cave_valid_bold(floor_type *floor_ptr, POSITION y, POSITION x)
{
- /* Forbid perma-grids */
grid_type *g_ptr = &floor_ptr->grid_array[y][x];
if (cave_perma_grid(g_ptr)) return FALSE;
- /* Check objects */
OBJECT_IDX next_o_idx = 0;
for (OBJECT_IDX this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
{
object_type *o_ptr;
o_ptr = &floor_ptr->o_list[this_o_idx];
next_o_idx = o_ptr->next_o_idx;
-
- /* Forbid artifact grids */
if (object_is_artifact(o_ptr)) return FALSE;
}
feature_type *f_ptr = &f_info[feat];
if (!current_world_ptr->character_dungeon)
{
- /* Clear mimic type */
g_ptr->mimic = 0;
-
- /* Change the feature */
g_ptr->feat = feat;
-
- /* Hack -- glow the GLOW terrain */
if (have_flag(f_ptr->flags, FF_GLOW) && !(d_info[floor_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
{
- DIRECTION i;
- POSITION yy, xx;
-
- for (i = 0; i < 9; i++)
+ for (DIRECTION i = 0; i < 9; i++)
{
- yy = y + ddy_ddd[i];
- xx = x + ddx_ddd[i];
+ POSITION yy = y + ddy_ddd[i];
+ POSITION xx = x + ddx_ddd[i];
if (!in_bounds2(floor_ptr, yy, xx)) continue;
floor_ptr->grid_array[yy][xx].info |= CAVE_GLOW;
}
bool old_los = cave_have_flag_bold(floor_ptr, y, x, FF_LOS);
bool old_mirror = is_mirror_grid(g_ptr);
- /* Clear mimic type */
g_ptr->mimic = 0;
-
- /* Change the feature */
g_ptr->feat = feat;
-
- /* Remove flag for mirror/glyph */
g_ptr->info &= ~(CAVE_OBJECT);
-
if (old_mirror && (d_info[floor_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
{
g_ptr->info &= ~(CAVE_GLOW);
update_local_illumination(player_ptr, y, x);
}
- /* Check for change to boring grid */
if (!have_flag(f_ptr->flags, FF_REMEMBER)) g_ptr->info &= ~(CAVE_MARK);
if (g_ptr->m_idx) update_monster(player_ptr, g_ptr->m_idx, FALSE);
note_spot(player_ptr, y, x);
lite_spot(player_ptr, y, x);
-
- /* Check if los has changed */
if (old_los ^ have_flag(f_ptr->flags, FF_LOS))
{
#endif /* COMPLEX_WALL_ILLUMINATION */
- /* Update the visuals */
player_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE | PU_MONSTERS);
}
- /* Hack -- glow the GLOW terrain */
if (!have_flag(f_ptr->flags, FF_GLOW) || (d_info[player_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
return;
one_in_((d_info[floor_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) ? 16 : 256)) ? DOOR_CURTAIN :
((d_info[floor_ptr->dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR);
- /* Choose an object */
int tmp = randint0(1000);
-
- /* Open doors (300/1000) */
FEAT_IDX feat = feat_none;
if (tmp < 300)
{
- /* Create open door */
feat = feat_door[type].open;
}
-
- /* Broken doors (100/1000) */
else if (tmp < 400)
{
- /* Create broken door */
feat = feat_door[type].broken;
}
-
- /* Secret doors (200/1000) */
else if (tmp < 600)
{
- /* Create secret door */
place_closed_door(player_ptr, y, x, type);
if (type != DOOR_CURTAIN)
{
- /* Hide. If on the edge of room, use outer wall. */
g_ptr->mimic = room ? feat_wall_outer : feat_wall_type[randint0(100)];
-
- /* Floor type terrain cannot hide a door */
if (feat_supports_los(g_ptr->mimic) && !feat_supports_los(g_ptr->feat))
{
if (have_flag(f_info[g_ptr->mimic].flags, FF_MOVE) || have_flag(f_info[g_ptr->mimic].flags, FF_CAN_FLY))
}
}
}
-
- /* Closed, locked, or stuck doors (400/1000) */
- else place_closed_door(player_ptr, y, x, type);
+ else
+ {
+ place_closed_door(player_ptr, y, x, type);
+ }
if (tmp >= 400)
{
*/
void wipe_o_list(floor_type *floor_ptr)
{
- /* Delete the existing objects */
for (int i = 1; i < floor_ptr->o_max; i++)
{
object_type *o_ptr = &floor_ptr->o_list[i];
-
if (!OBJECT_IS_VALID(o_ptr)) continue;
- /* Mega-Hack -- preserve artifacts */
if (!current_world_ptr->character_dungeon || preserve_mode)
{
- /* Hack -- Preserve unknown artifacts */
if (object_is_fixed_artifact(o_ptr) && !object_is_known(o_ptr))
{
- /* Mega-Hack -- Preserve the artifact */
a_info[o_ptr->name1].cur_num = 0;
}
}
{
monster_type *m_ptr;
m_ptr = &floor_ptr->m_list[o_ptr->held_m_idx];
-
- /* Hack -- see above */
m_ptr->hold_o_idx = 0;
object_wipe(o_ptr);
continue;
}
- /* Dungeon */
grid_type *g_ptr;
-
- /* Access location */
POSITION y = o_ptr->iy;
POSITION x = o_ptr->ix;
- /* Access grid */
g_ptr = &floor_ptr->grid_array[y][x];
-
- /* Hack -- see above */
g_ptr->o_idx = 0;
object_wipe(o_ptr);
}
return;
}
- /* Choose an object */
int tmp = randint0(400);
-
- /* Closed doors (300/400) */
FEAT_IDX feat = feat_none;
if (tmp < 300)
{
/* Create closed door */
feat = feat_door[type].closed;
}
-
- /* Locked doors (99/400) */
else if (tmp < 399)
{
- /* Create locked door */
feat = feat_locked_door_random(type);
}
-
- /* Stuck doors (1/400) */
else
{
- /* Create jammed door */
feat = feat_jammed_door_random(type);
}
void vault_trap_aux(player_type *player_ptr, POSITION y, POSITION x, POSITION yd, POSITION xd)
{
grid_type *g_ptr;
-
- /* Place traps */
floor_type *floor_ptr = player_ptr->current_floor_ptr;
int y1 = y, x1 = x;
int dummy = 0;
for (int count = 0; count <= 5; count++)
{
- /* Get a location */
while (dummy < SAFE_MAX_ATTEMPTS)
{
y1 = rand_spread(y, yd);
msg_print(_("警告!地下室のトラップを配置できません!", "Warning! Could not place vault trap!"));
}
- /* Require "naked" floor grids */
g_ptr = &floor_ptr->grid_array[y1][x1];
if (!is_floor_grid(g_ptr) || g_ptr->o_idx || g_ptr->m_idx) continue;
- /* Place the trap */
place_trap(player_ptr, y1, x1);
-
break;
}
}
{
if (!in_bounds(floor_ptr, y, x))
{
- /* Out of bounds */
return FALSE;
}
- /* Do the real check */
if (is_floor_bold(floor_ptr, y, x)) return TRUE;
return FALSE;
*/
static int next_to_corr(floor_type *floor_ptr, POSITION y1, POSITION x1)
{
- /* Scan adjacent grids */
int k = 0;
for (int i = 0; i < 4; i++)
{
grid_type *g_ptr;
g_ptr = &floor_ptr->grid_array[y][x];
- /* Skip non floors */
if (cave_have_flag_grid(g_ptr, FF_WALL)) continue;
-
- /* Skip non "empty floor" grids */
- if (!is_floor_grid(g_ptr))
- continue;
-
- /* Skip grids inside rooms */
+ if (!is_floor_grid(g_ptr)) continue;
if (g_ptr->info & (CAVE_ROOM)) continue;
- /* Count these grids */
k++;
}
- /* Return the number of corridors */
return k;
}
*/
static bool possible_doorway(floor_type *floor_ptr, POSITION y, POSITION x)
{
- /* Count the adjacent corridors */
if (next_to_corr(floor_ptr, y, x) < 2) return FALSE;
/* Check Vertical */
floor_type *floor_ptr = player_ptr->current_floor_ptr;
if (!in_bounds(floor_ptr, y, x)) return;
- /* Ignore walls */
if (cave_have_flag_bold(floor_ptr, y, x, FF_WALL)) return;
-
- /* Ignore room grids */
if (floor_ptr->grid_array[y][x].info & (CAVE_ROOM)) return;
- /* Occasional door (if allowed) */
- if ((randint0(100) < dun_tun_jct) && possible_doorway(floor_ptr, y, x) && !(d_info[player_ptr->dungeon_idx].flags1 & DF1_NO_DOORS))
+ bool can_place_door = randint0(100) < dun_tun_jct;
+ can_place_door &= possible_doorway(floor_ptr, y, x);
+ can_place_door &= !(d_info[player_ptr->dungeon_idx].flags1 & DF1_NO_DOORS);
+ if (can_place_door)
{
- /* Place a door */
place_random_door(player_ptr, y, x, FALSE);
}
}
void vault_objects(player_type *player_ptr, POSITION y, POSITION x, int num)
{
floor_type *floor_ptr = player_ptr->current_floor_ptr;
-
- /* Attempt to place 'num' objects */
for (; num > 0; --num)
{
- /* Try up to 11 spots looking for empty space */
int j = y, k = x;
int dummy = 0;
for (int i = 0; i < 11; ++i)
{
- /* Pick a random location */
while (dummy < SAFE_MAX_ATTEMPTS)
{
j = rand_spread(y, 2);
msg_print(_("警告!地下室のアイテムを配置できません!", "Warning! Could not place vault object!"));
}
- /* Require "clean" floor space */
grid_type *g_ptr;
g_ptr = &floor_ptr->grid_array[j][k];
if (!is_floor_grid(g_ptr) || g_ptr->o_idx) continue;
place_gold(player_ptr, j, k);
}
- /* Placement accomplished */
break;
}
}
*/
sint project_path(player_type *player_ptr, u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y2, POSITION x2, BIT_FLAGS flg)
{
- /* No path necessary (or allowed) */
if ((x1 == x2) && (y1 == y2)) return 0;
- /* Analyze "dy" */
POSITION y, x;
POSITION ay, ax;
POSITION sy, sx;
sy = 1;
}
- /* Analyze "dx" */
if (x2 < x1)
{
ax = (x1 - x2);
sx = 1;
}
- /* Number of "units" in one "half" grid */
int half = (ay * ax);
-
- /* Number of "units" in one "full" grid */
int full = half << 1;
/* Vertical */
int k = 0;
if (ay > ax)
{
- /* Let m = ((dx/dy) * full) = (dx * dx * 2) */
m = ax * ax * 2;
-
- /* Start */
y = y1 + sy;
x = x1;
-
frac = m;
-
if (frac > half)
{
- /* Advance (X) part 2 */
x += sx;
-
- /* Advance (X) part 3 */
frac -= full;
-
- /* Track distance */
k++;
}
- /* Create the projection path */
while (TRUE)
{
- /* Save grid */
gp[n++] = GRID(y, x);
-
- /* Hack -- Check maximum range */
if ((n + (k >> 1)) >= range) break;
- /* Sometimes stop at destination grid */
if (!(flg & (PROJECT_THRU)))
{
if ((x == x2) && (y == y2)) break;
}
else if (!(flg & (PROJECT_PATH)))
{
- /* Always stop at non-initial wall grids */
if ((n > 0) && !cave_have_flag_bold(floor_ptr, y, x, FF_PROJECT)) break;
}
- /* Sometimes stop at non-initial monsters/players */
if (flg & (PROJECT_STOP))
{
if ((n > 0) &&
if (!in_bounds(floor_ptr, y, x)) break;
- /* Slant */
if (m)
{
- /* Advance (X) part 1 */
frac += m;
-
- /* Horizontal change */
if (frac > half)
{
- /* Advance (X) part 2 */
x += sx;
-
- /* Advance (X) part 3 */
frac -= full;
-
- /* Track distance */
k++;
}
}
- /* Advance (Y) */
y += sy;
}
/* Horizontal */
if (ax > ay)
{
- /* Let m = ((dy/dx) * full) = (dy * dy * 2) */
m = ay * ay * 2;
-
- /* Start */
y = y1;
x = x1 + sx;
-
frac = m;
-
- /* Vertical change */
if (frac > half)
{
- /* Advance (Y) part 2 */
y += sy;
-
- /* Advance (Y) part 3 */
frac -= full;
-
- /* Track distance */
k++;
}
- /* Create the projection path */
while (TRUE)
{
- /* Save grid */
gp[n++] = GRID(y, x);
-
- /* Hack -- Check maximum range */
if ((n + (k >> 1)) >= range) break;
- /* Sometimes stop at destination grid */
if (!(flg & (PROJECT_THRU)))
{
if ((x == x2) && (y == y2)) break;
}
else if (!(flg & (PROJECT_PATH)))
{
- /* Always stop at non-initial wall grids */
if ((n > 0) && !cave_have_flag_bold(floor_ptr, y, x, FF_PROJECT)) break;
}
- /* Sometimes stop at non-initial monsters/players */
if (flg & (PROJECT_STOP))
{
if ((n > 0) &&
if (!in_bounds(floor_ptr, y, x)) break;
- /* Slant */
if (m)
{
- /* Advance (Y) part 1 */
frac += m;
-
- /* Vertical change */
if (frac > half)
{
- /* Advance (Y) part 2 */
y += sy;
-
- /* Advance (Y) part 3 */
frac -= full;
-
- /* Track distance */
k++;
}
}
- /* Advance (X) */
x += sx;
}
return n;
}
- /* Diagonal */
y = y1 + sy;
x = x1 + sx;
- /* Create the projection path */
while (TRUE)
{
- /* Save grid */
gp[n++] = GRID(y, x);
-
- /* Hack -- Check maximum range */
if ((n + (n >> 1)) >= range) break;
- /* Sometimes stop at destination grid */
if (!(flg & (PROJECT_THRU)))
{
if ((x == x2) && (y == y2)) break;
}
else if (!(flg & (PROJECT_PATH)))
{
- /* Always stop at non-initial wall grids */
if ((n > 0) && !cave_have_flag_bold(floor_ptr, y, x, FF_PROJECT)) break;
}
- /* Sometimes stop at non-initial monsters/players */
if (flg & (PROJECT_STOP))
{
if ((n > 0) &&
floor_type *floor_ptr = player_ptr->current_floor_ptr;
if (!in_bounds(floor_ptr, y, x))
{
- /* Out of bounds */
return;
}
if (floor_ptr->grid_array[y][x].info & CAVE_ROOM)
{
- /* A room border don't touch. */
return;
}
- /* Set to be floor if is a wall (don't touch lakes). */
if (is_extra_bold(floor_ptr, y, x))
place_bold(player_ptr, y, x, gb_floor);
}
void place_object(player_type *owner_ptr, POSITION y, POSITION x, BIT_FLAGS mode)
{
floor_type *floor_ptr = owner_ptr->current_floor_ptr;
-
- /* Acquire grid */
grid_type *g_ptr = &floor_ptr->grid_array[y][x];
-
object_type forge;
object_type *q_ptr;
-
- /* Paranoia -- check bounds */
if (!in_bounds(floor_ptr, y, x)) return;
-
- /* Require floor space */
if (!cave_drop_bold(floor_ptr, y, x)) return;
-
- /* Avoid stacking on other objects */
if (g_ptr->o_idx) return;
q_ptr = &forge;
object_wipe(q_ptr);
-
- /* Make an object (if possible) */
if (!make_object(owner_ptr, q_ptr, mode)) return;
OBJECT_IDX o_idx = o_pop(floor_ptr);
-
- /* Success */
if (o_idx == 0)
{
- /* Hack -- Preserve artifacts */
if (object_is_fixed_artifact(q_ptr))
{
a_info[q_ptr->name1].cur_num = 0;
object_type *o_ptr;
o_ptr = &floor_ptr->o_list[o_idx];
-
- /* Structure Copy */
object_copy(o_ptr, q_ptr);
o_ptr->iy = y;
o_ptr->ix = x;
-
- /* Build a stack */
o_ptr->next_o_idx = g_ptr->o_idx;
g_ptr->o_idx = o_idx;
*/
void place_gold(player_type *player_ptr, POSITION y, POSITION x)
{
- /* Acquire grid */
floor_type *floor_ptr = player_ptr->current_floor_ptr;
grid_type *g_ptr = &floor_ptr->grid_array[y][x];
-
- /* Paranoia -- check bounds */
if (!in_bounds(floor_ptr, y, x)) return;
-
- /* Require floor space */
if (!cave_drop_bold(floor_ptr, y, x)) return;
-
- /* Avoid stacking on other objects */
if (g_ptr->o_idx) return;
object_type forge;
object_type *q_ptr;
q_ptr = &forge;
object_wipe(q_ptr);
-
- /* Make some gold */
if (!make_gold(floor_ptr, q_ptr)) return;
OBJECT_IDX o_idx = o_pop(floor_ptr);
-
- /* Success */
if (o_idx == 0) return;
object_type *o_ptr;
o_ptr = &floor_ptr->o_list[o_idx];
object_copy(o_ptr, q_ptr);
- /* Save location */
o_ptr->iy = y;
o_ptr->ix = x;
-
- /* Build a stack */
o_ptr->next_o_idx = g_ptr->o_idx;
g_ptr->o_idx = o_idx;
floor_type *floor_ptr = player_ptr->current_floor_ptr;
if (!in_bounds(floor_ptr, y, x)) return;
- /* Check the grid */
g_ptr = &floor_ptr->grid_array[y][x];
-
- /* Delete the monster (if any) */
if (g_ptr->m_idx) delete_monster_idx(player_ptr, g_ptr->m_idx);
}
*/
static void compact_objects_aux(floor_type *floor_ptr, OBJECT_IDX i1, OBJECT_IDX i2)
{
- /* Do nothing */
if (i1 == i2) return;
- /* Repair objects */
object_type *o_ptr;
for (OBJECT_IDX i = 1; i < floor_ptr->o_max; i++)
{
o_ptr = &floor_ptr->o_list[i];
-
- /* Skip "dead" objects */
if (!o_ptr->k_idx) continue;
- /* Repair "next" pointers */
if (o_ptr->next_o_idx == i1)
{
- /* Repair */
o_ptr->next_o_idx = i2;
}
}
{
monster_type *m_ptr;
m_ptr = &floor_ptr->m_list[o_ptr->held_m_idx];
-
- /* Repair monster */
if (m_ptr->hold_o_idx == i1)
{
- /* Repair */
m_ptr->hold_o_idx = i2;
}
}
-
- /* Dungeon */
else
{
- POSITION y, x;
-
- /* Acquire location */
- y = o_ptr->iy;
- x = o_ptr->ix;
-
- /* Acquire grid */
+ POSITION y = o_ptr->iy;
+ POSITION x = o_ptr->ix;
grid_type *g_ptr;
g_ptr = &floor_ptr->grid_array[y][x];
- /* Repair grid */
if (g_ptr->o_idx == i1)
{
- /* Repair */
g_ptr->o_idx = i2;
}
}
void compact_objects(player_type *player_ptr, int size)
{
object_type *o_ptr;
-
- /* Compact */
if (size)
{
msg_print(_("アイテム情報を圧縮しています...", "Compacting objects..."));
player_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
}
- /* Compact at least 'size' objects */
floor_type *floor_ptr = player_ptr->current_floor_ptr;
for (int num = 0, cnt = 1; num < size; cnt++)
{
- /* Get more vicious each iteration */
int cur_lev = 5 * cnt;
-
- /* Get closer each iteration */
int cur_dis = 5 * (20 - cnt);
-
- /* Examine the objects */
for (OBJECT_IDX i = 1; i < floor_ptr->o_max; i++)
{
o_ptr = &floor_ptr->o_list[i];
if (!OBJECT_IS_VALID(o_ptr)) continue;
-
- /* Hack -- High level objects start out "immune" */
if (k_info[o_ptr->k_idx].level > cur_lev) continue;
POSITION y, x;
{
monster_type *m_ptr;
m_ptr = &floor_ptr->m_list[o_ptr->held_m_idx];
-
y = m_ptr->fy;
x = m_ptr->fx;
- /* Monsters protect their objects */
if (randint0(100) < 90) continue;
}
-
- /* Dungeon */
else
{
y = o_ptr->iy;
x = o_ptr->ix;
}
- /* Nearby objects start out "immune" */
if ((cur_dis > 0) && (distance(player_ptr->y, player_ptr->x, y, x) < cur_dis)) continue;
- /* Saving throw */
int chance = 90;
-
- /* Hack -- only compact artifacts in emergencies */
if ((object_is_fixed_artifact(o_ptr) || o_ptr->art_name) &&
(cnt < 1000)) chance = 100;
- /* Apply the saving throw */
if (randint0(100) < chance) continue;
delete_object_idx(player_ptr, i);
}
}
- /* Excise dead objects (backwards!) */
for (OBJECT_IDX i = floor_ptr->o_max - 1; i >= 1; i--)
{
o_ptr = &floor_ptr->o_list[i];
-
- /* Skip real objects */
if (o_ptr->k_idx) continue;
- /* Move last object into open hole */
compact_objects_aux(floor_ptr, floor_ptr->o_max - 1, i);
-
- /* Compress "floor_ptr->o_max" */
floor_ptr->o_max--;
}
}
*/
void scatter(player_type *player_ptr, POSITION *yp, POSITION *xp, POSITION y, POSITION x, POSITION d, BIT_FLAGS mode)
{
- /* Pick a location */
floor_type *floor_ptr = player_ptr->current_floor_ptr;
POSITION nx, ny;
while (TRUE)
{
- /* Pick a new location */
ny = rand_spread(y, d);
nx = rand_spread(x, d);
- /* Ignore annoying locations */
if (!in_bounds(floor_ptr, ny, nx)) continue;
-
- /* Ignore "excessively distant" locations */
if ((d > 1) && (distance(y, x, ny, nx) > d)) continue;
-
if (mode & PROJECT_LOS)
{
if (los(player_ptr, y, x, ny, nx)) break;
*yp = ny;
*xp = nx;
}
+
+
+/*
+ * @brief 指定のマスが光を通すか(LOSフラグを持つか)を返す。 / Aux function -- see below
+ * @param floor_ptr 配置するフロアの参照ポインタ
+ * @param y 指定Y座標
+ * @param x 指定X座標
+ * @return 光を通すならばtrueを返す。
+ */
+bool cave_los_bold(floor_type *floor_ptr, POSITION y, POSITION x)
+{
+ return feat_supports_los(floor_ptr->grid_array[y][x].feat);
+}
(have_flag(f_info[(F)].flags, FF_LOS))
-/*
- * Determine if a "legal" grid supports "los"
- */
-#define cave_los_bold(F,Y,X) \
- (feat_supports_los((F)->grid_array[(Y)][(X)].feat))
-
#define cave_los_grid(C) \
(feat_supports_los((C)->feat))
extern void compact_objects(player_type *owner_ptr, int size);
extern void vault_traps(player_type *player_ptr, POSITION y, POSITION x, POSITION yd, POSITION xd, int num);
extern void scatter(player_type *player_ptr, POSITION *yp, POSITION *xp, POSITION y, POSITION x, POSITION d, BIT_FLAGS mode);
+
+extern bool cave_los_bold(floor_type *floor_ptr, POSITION y, POSITION x);
#define OLD_MAX_MANE 22
- /* Old hidden trap flag */
+/* Old hidden trap flag */
#define CAVE_TRAP 0x8000
/*** Terrain Feature Indexes (see "lib/edit/f_info.txt") ***/
*/
static bool h_older_than(byte major, byte minor, byte patch, byte extra)
{
- /* Much older, or much more recent */
if (current_world_ptr->h_ver_major < major) return TRUE;
if (current_world_ptr->h_ver_major > major) return FALSE;
- /* Distinctly older, or distinctly more recent */
if (current_world_ptr->h_ver_minor < minor) return TRUE;
if (current_world_ptr->h_ver_minor > minor) return FALSE;
- /* Barely older, or barely more recent */
if (current_world_ptr->h_ver_patch < patch) return TRUE;
if (current_world_ptr->h_ver_patch > patch) return FALSE;
- /* Barely older, or barely more recent */
if (current_world_ptr->h_ver_extra < extra) return TRUE;
if (current_world_ptr->h_ver_extra > extra) return FALSE;
- /* Identical versions */
return FALSE;
}
*/
static bool z_older_than(byte x, byte y, byte z)
{
- /* Much older, or much more recent */
if (current_world_ptr->z_major < x) return TRUE;
if (current_world_ptr->z_major > x) return FALSE;
- /* Distinctly older, or distinctly more recent */
if (current_world_ptr->z_minor < y) return TRUE;
if (current_world_ptr->z_minor > y) return FALSE;
- /* Barely older, or barely more recent */
if (current_world_ptr->z_patch < z) return TRUE;
if (current_world_ptr->z_patch > z) return FALSE;
- /* Identical versions */
return FALSE;
}
static void note(concptr msg)
{
static TERM_LEN y = 2;
-
- /* Draw the message */
prt(msg, y, 0);
-
- /* Advance one line (wrap if needed) */
if (++y >= 24) y = 2;
- /* Flush it */
Term_fresh();
}
*/
static byte sf_get(void)
{
- /* Get a character, decode the value */
byte c = getc(fff) & 0xFF;
byte v = c ^ xor_byte;
xor_byte = c;
- /* Maintain the checksum info */
v_check += v;
x_check += xor_byte;
-
- /* Return the value */
return v;
}
*/
static void rd_string(char *str, int max)
{
- /* Read the string */
for (int i = 0; TRUE; i++)
{
byte tmp8u;
rd_byte(&tmp8u);
-
- /* Collect string while legal */
if (i < max) str[i] = tmp8u;
- /* End of string */
if (!tmp8u) break;
}
- /* Terminate */
str[max - 1] = '\0';
-
#ifdef JP
- /* Convert Kanji code */
switch (kanji_code)
{
#ifdef SJIS
case 2:
- /* EUC to SJIS */
euc2sjis(str);
break;
#endif
#ifdef EUC
case 3:
- /* SJIS to EUC */
sjis2euc(str);
break;
#endif
case 0:
{
- /* 不明の漢字コードからシステムの漢字コードに変換 */
byte code = codeconv(str);
/* 漢字コードが判明したら、それを記録 */
break;
}
default:
- /* No conversion needed */
break;
}
#endif
if (o_ptr->tval == 110) o_ptr->tval = TV_HISSATSU_BOOK;
}
- /* Special pval */
rd_s16b(&o_ptr->pval);
-
rd_byte(&o_ptr->discount);
rd_byte(&tmp8u);
o_ptr->number = (ITEM_NUMBER)tmp8u;
o_ptr->name2 = tmp8u;
rd_s16b(&o_ptr->timeout);
-
rd_s16b(&o_ptr->to_h);
-
rd_s16b(&tmp16s);
o_ptr->to_d = tmp16s;
- rd_s16b(&o_ptr->to_a);
+ rd_s16b(&o_ptr->to_a);
rd_s16b(&o_ptr->ac);
-
rd_byte(&tmp8u);
o_ptr->dd = tmp8u;
+
rd_byte(&tmp8u);
o_ptr->ds = tmp8u;
rd_byte(&o_ptr->ident);
-
rd_byte(&o_ptr->marked);
-
- /* Object flags */
rd_u32b(&o_ptr->art_flags[0]);
rd_u32b(&o_ptr->art_flags[1]);
rd_u32b(&o_ptr->art_flags[2]);
rd_u32b(&o_ptr->curse_flags);
}
- /* Monster holding object */
rd_s16b(&o_ptr->held_m_idx);
-
- /* Special powers */
rd_byte(&o_ptr->xtra1);
rd_byte(&o_ptr->xtra2);
char buf[128];
rd_string(buf, sizeof(buf));
-
- /* Save the inscription */
if (buf[0]) o_ptr->inscription = quark_add(buf);
rd_string(buf, sizeof(buf));
- if (buf[0]) o_ptr->art_name = quark_add(buf);
- /* The Python object */
+ /* todo 元々このif文には末尾に";"が付いていた、バグかもしれない */
+ if (buf[0]) o_ptr->art_name = quark_add(buf);
{
s32b tmp32s;
strip_bytes(tmp32s);
}
- /* Mega-Hack -- handle "dungeon objects" later */
if ((o_ptr->k_idx >= 445) && (o_ptr->k_idx <= 479)) return;
if (z_older_than(10, 4, 10) && (o_ptr->name2 == EGO_YOIYAMI)) o_ptr->k_idx = lookup_kind(TV_SOFT_ARMOR, SV_YOIYAMI_ROBE);
add_flag(o_ptr->art_flags, TR_DEC_MANA);
}
}
+
if (object_is_fixed_artifact(o_ptr))
{
artifact_type *a_ptr;
-
- /* Obtain the artifact info */
a_ptr = &a_info[o_ptr->name1];
-
- /* Verify that artifact */
if (!a_ptr->name) o_ptr->name1 = 0;
}
+
if (object_is_ego(o_ptr))
{
ego_item_type *e_ptr;
-
- /* Obtain the ego-item info */
e_ptr = &e_info[o_ptr->name2];
-
- /* Verify that ego-item */
if (!e_ptr->name) o_ptr->name2 = 0;
-
}
}
BIT_FLAGS flags;
rd_u32b(&flags);
-
- /*** Read un-obvious elements ***/
- /* Kind */
rd_s16b(&o_ptr->k_idx);
byte_hack tmp8u;
rd_byte(&tmp8u);
o_ptr->ix = (POSITION)tmp8u;
- /* Type/Subtype */
object_kind *k_ptr;
k_ptr = &k_info[o_ptr->k_idx];
o_ptr->tval = k_ptr->tval;
o_ptr->sval = k_ptr->sval;
- /* Special pval */
if (flags & SAVE_ITEM_PVAL) rd_s16b(&o_ptr->pval);
else o_ptr->pval = 0;
else
rd_byte(&m_ptr->sub_align);
- /* Read the other information */
byte tmp8u;
rd_byte(&tmp8u);
m_ptr->fy = (POSITION)tmp8u;
}
rd_s16b(&m_ptr->mtimed[MTIMED_CSLEEP]);
-
rd_byte(&tmp8u);
m_ptr->mspeed = tmp8u;
return;
}
- /*** Monster save flags ***/
BIT_FLAGS flags;
rd_u32b(&flags);
-
- /*** Read un-obvious elements ***/
-
- /* Read the monster race */
rd_s16b(&m_ptr->r_idx);
-
- /* Read the other information */
byte tmp8u;
rd_byte(&tmp8u);
m_ptr->fy = (POSITION)tmp8u;
rd_s32b(&m_ptr->dealt_damage);
}
- /* Monster race index of its appearance */
if (flags & SAVE_MON_AP_R_IDX) rd_s16b(&m_ptr->ap_r_idx);
else m_ptr->ap_r_idx = m_ptr->r_idx;
{
monster_race *r_ptr = &r_info[r_idx];
- /* Count sights/deaths/kills */
s16b tmp16s;
rd_s16b(&tmp16s);
r_ptr->r_sights = (MONSTER_NUMBER)tmp16s;
+
rd_s16b(&tmp16s);
r_ptr->r_deaths = (MONSTER_NUMBER)tmp16s;
+
rd_s16b(&tmp16s);
r_ptr->r_pkills = (MONSTER_NUMBER)tmp16s;
+
if (h_older_than(1, 7, 0, 5))
{
r_ptr->r_akills = r_ptr->r_pkills;
rd_s16b(&tmp16s);
r_ptr->r_tkills = (MONSTER_NUMBER)tmp16s;
- /* Count wakes and ignores */
rd_byte(&r_ptr->r_wake);
rd_byte(&r_ptr->r_ignore);
-
- /* Extra stuff */
rd_byte(&r_ptr->r_xtra1);
rd_byte(&r_ptr->r_xtra2);
- /* Count drops */
byte tmp8u;
rd_byte(&tmp8u);
r_ptr->r_drop_gold = (ITEM_NUMBER)tmp8u;
rd_byte(&tmp8u);
r_ptr->r_drop_item = (ITEM_NUMBER)tmp8u;
- /* Count spells */
rd_byte(&tmp8u);
rd_byte(&r_ptr->r_cast_spell);
- /* Count blows of each type */
rd_byte(&r_ptr->r_blows[0]);
rd_byte(&r_ptr->r_blows[1]);
rd_byte(&r_ptr->r_blows[2]);
rd_byte(&r_ptr->r_blows[3]);
- /* Memorize flags */
rd_u32b(&r_ptr->r_flags1);
rd_u32b(&r_ptr->r_flags2);
rd_u32b(&r_ptr->r_flags3);
if (h_older_than(1, 5, 0, 3))
{
r_ptr->r_flagsr = 0L;
-
- /* Move RF3 resistance flags to RFR */
MOVE_RF3_TO_RFR(r_ptr, RF3_IM_ACID, RFR_IM_ACID);
MOVE_RF3_TO_RFR(r_ptr, RF3_IM_ELEC, RFR_IM_ELEC);
MOVE_RF3_TO_RFR(r_ptr, RF3_IM_FIRE, RFR_IM_FIRE);
MOVE_RF3_TO_RFR(r_ptr, RF3_RES_DISE, RFR_RES_DISE);
MOVE_RF3_TO_RFR(r_ptr, RF3_RES_ALL, RFR_RES_ALL);
- /* Separate breathers resistance from RF4 to RFR */
RF4_BR_TO_RFR(r_ptr, RF4_BR_LITE, RFR_RES_LITE);
RF4_BR_TO_RFR(r_ptr, RF4_BR_DARK, RFR_RES_DARK);
RF4_BR_TO_RFR(r_ptr, RF4_BR_SOUN, RFR_RES_SOUN);
RF4_BR_TO_RFR(r_ptr, RF4_BR_SHAR, RFR_RES_SHAR);
RF4_BR_TO_RFR(r_ptr, RF4_BR_WALL, RFR_RES_WALL);
- /* Resist confusion is merged to RF3_NO_CONF */
if (r_ptr->r_flags4 & RF4_BR_CONF) r_ptr->r_flags3 |= RF3_NO_CONF;
-
- /* Misc resistance hack to RFR */
if (r_idx == MON_STORMBRINGER) r_ptr->r_flagsr |= RFR_RES_CHAO;
if (r_ptr->r_flags3 & RF3_ORC) r_ptr->r_flagsr |= RFR_RES_DARK;
}
rd_u32b(&r_ptr->r_flagsr);
}
- /* Read the "Racial" monster limit per level */
rd_byte(&tmp8u);
r_ptr->max_num = (MONSTER_NUMBER)tmp8u;
- /* Location in saved floor */
rd_s16b(&r_ptr->floor_id);
-
- /* Later (?) */
rd_byte(&tmp8u);
- /* Repair the lore flags */
r_ptr->r_flags1 &= r_ptr->flags1;
r_ptr->r_flags2 &= r_ptr->flags2;
r_ptr->r_flags3 &= r_ptr->flags3;
r_ptr->r_flagsr &= r_ptr->flagsr;
}
+
/*!
* @brief 店置きのアイテムオブジェクトを読み込む / Add the item "o_ptr" to the inventory of the "Home"
* @param player_ptr プレーヤーへの参照ポインタ
*/
static void home_carry(player_type *player_ptr, store_type *st_ptr, object_type *o_ptr)
{
- /* Check each existing item (try to combine) */
for (int i = 0; i < st_ptr->stock_num; i++)
{
- /* Get the existing item */
object_type *j_ptr;
j_ptr = &st_ptr->stock[i];
-
- /* The home acts just like the player */
if (!object_similar(j_ptr, o_ptr)) continue;
object_absorb(j_ptr, o_ptr);
return;
}
- /* No space? */
if (st_ptr->stock_num >= STORE_INVEN_MAX * 10) return;
- /* Determine the "value" of the item */
s32b value = object_value(o_ptr);
-
- /* Check existing slots to see if we must "slide" */
int slot;
for (slot = 0; slot < st_ptr->stock_num; slot++)
{
if (object_sort_comp(o_ptr, value, &st_ptr->stock[slot])) break;
}
- /* Slide the others up */
for (int i = st_ptr->stock_num; i > slot; i--)
{
st_ptr->stock[i] = st_ptr->stock[i - 1];
}
- /* More stuff now */
st_ptr->stock_num++;
-
- /* Insert the new item */
st_ptr->stock[slot] = *o_ptr;
-
chg_virtue(player_ptr, V_SACRIFICE, -1);
}
+
/*!
* @brief 店舗情報を読み込む / Read a store
* @param player_ptr プレーヤーへの参照ポインタ
st_ptr = &town_info[town_number].store[store_number];
}
- /* Read the basic info */
byte own;
byte tmp8u;
s16b num;
rd_s16b(&st_ptr->good_buy);
rd_s16b(&st_ptr->bad_buy);
- /* Read last visit */
rd_s32b(&st_ptr->last_visit);
-
- /* Extract the owner (see above) */
st_ptr->owner = own;
- /* Read the items */
for (int j = 0; j < num; j++)
{
object_type forge;
q_ptr = &forge;
object_wipe(q_ptr);
- /* Read the item */
rd_item(q_ptr);
bool is_valid_item = st_ptr->stock_num < (store_number == STORE_HOME ? STORE_INVEN_MAX * 10 : store_number == STORE_MUSEUM ? STORE_INVEN_MAX * 50 : STORE_INVEN_MAX);
*/
static void rd_options(void)
{
- /* Ignore old options */
strip_bytes(16);
- /*** Special info */
-
- /* Read "delay_factor" */
byte b;
rd_byte(&b);
delay_factor = b;
- /* Read "hitpoint_warn" */
rd_byte(&b);
hitpoint_warn = b;
- /* Read "mana_warn" */
if (h_older_than(1, 7, 0, 0))
{
mana_warn = 2;
mana_warn = b;
}
- /*** Cheating options ***/
u16b c;
rd_u16b(&c);
rd_byte((byte *)&autosave_t);
rd_s16b(&autosave_freq);
- /*** Normal Options ***/
- /* Read the option flags */
BIT_FLAGS flag[8];
for (int n = 0; n < 8; n++) rd_u32b(&flag[n]);
- /* Read the option masks */
BIT_FLAGS mask[8];
for (int n = 0; n < 8; n++) rd_u32b(&mask[n]);
- /* Analyze the options */
for (int n = 0; n < 8; n++)
{
- /* Analyze the options */
for (int i = 0; i < 32; i++)
{
- /* Process valid flags */
if (!(mask[n] & (1L << i))) continue;
-
- /* Process valid flags */
if (!(option_mask[n] & (1L << i))) continue;
- /* Set */
if (flag[n] & (1L << i))
{
- /* Set */
option_flag[n] |= (1L << i);
}
else
else option_flag[5] |= (0x00000001 << 3);
}
- /* Extract the options */
extract_option_vars();
-
- /*** Window Options ***/
-
- /* Read the window flags */
for (int n = 0; n < 8; n++) rd_u32b(&flag[n]);
- /* Read the window masks */
for (int n = 0; n < 8; n++) rd_u32b(&mask[n]);
- /* Analyze the options */
for (int n = 0; n < 8; n++)
{
- /* Analyze the options */
for (int i = 0; i < 32; i++)
{
- /* Process valid flags */
if (!(mask[n] & (1L << i))) continue;
-
- /* Process valid flags */
if (!(window_mask[n] & (1L << i))) continue;
- /* Set */
if (flag[n] & (1L << i))
{
- /* Set */
window_flag[n] |= (1L << i);
}
else
for (int i = 0; i < 4; i++) rd_string(previous_char.history[i], sizeof(previous_char.history[i]));
- /* UNUSED : Was number of random quests */
- rd_byte(&tmp8u);
-
rd_byte(&tmp8u);
previous_char.quick_ok = (bool)tmp8u;
}
+
/*!
* @brief その他の情報を読み込む / Read the "extra" information
* @return なし
static void rd_extra(player_type *creature_ptr)
{
rd_string(creature_ptr->name, sizeof(creature_ptr->name));
-
rd_string(creature_ptr->died_from, sizeof(creature_ptr->died_from));
-
if (!h_older_than(1, 7, 0, 1))
{
char buf[1024];
-
- /* Read the message */
rd_string(buf, sizeof buf);
if (buf[0]) creature_ptr->last_message = string_make(buf);
}
load_quick_start();
-
for (int i = 0; i < 4; i++)
{
rd_string(creature_ptr->history[i], sizeof(creature_ptr->history[i]));
}
- /* Class/Race/Seikaku/Gender/Spells */
byte tmp8u;
rd_byte(&tmp8u);
creature_ptr->prace = (RACE_IDX)tmp8u;
+
rd_byte(&tmp8u);
creature_ptr->pclass = (CLASS_IDX)tmp8u;
+
rd_byte(&tmp8u);
creature_ptr->pseikaku = (CHARACTER_IDX)tmp8u;
+
rd_byte(&creature_ptr->psex);
rd_byte(&tmp8u);
creature_ptr->realm1 = (REALM_IDX)tmp8u;
+
rd_byte(&tmp8u);
creature_ptr->realm2 = (REALM_IDX)tmp8u;
- rd_byte(&tmp8u);
+ rd_byte(&tmp8u);
if (z_older_than(10, 4, 4))
{
if (creature_ptr->realm1 == 9) creature_ptr->realm1 = REALM_MUSIC;
if (creature_ptr->realm2 == 10) creature_ptr->realm2 = REALM_HISSATSU;
}
- /* Special Race/Class info */
rd_byte(&tmp8u);
creature_ptr->hitdie = tmp8u;
rd_u16b(&creature_ptr->expfact);
- /* Age/Height/Weight */
rd_s16b(&creature_ptr->age);
rd_s16b(&creature_ptr->ht);
rd_s16b(&creature_ptr->wt);
- /* Read the stat info */
for (int i = 0; i < A_MAX; i++) rd_s16b(&creature_ptr->stat_max[i]);
for (int i = 0; i < A_MAX; i++) rd_s16b(&creature_ptr->stat_max_max[i]);
for (int i = 0; i < A_MAX; i++) rd_s16b(&creature_ptr->stat_cur[i]);
}
rd_s16b(&creature_ptr->town_num);
-
- /* Read arena and rewards information */
rd_s16b(&creature_ptr->arena_number);
if (h_older_than(1, 5, 0, 1))
{
- /* Arena loser of previous version was marked number 99 */
if (creature_ptr->arena_number >= 99) creature_ptr->arena_number = ARENA_DEFEATED_OLD_VER;
}
rd_s16b(&tmp16s);
creature_ptr->phase_out = (bool)tmp16s;
}
+
rd_byte(&creature_ptr->exit_bldg);
rd_byte(&tmp8u);
rd_s16b(&tmp16s);
creature_ptr->oldpx = (POSITION)tmp16s;
+
rd_s16b(&tmp16s);
creature_ptr->oldpy = (POSITION)tmp16s;
-
if (z_older_than(10, 3, 13) && !creature_ptr->current_floor_ptr->dun_level && !creature_ptr->current_floor_ptr->inside_arena) { creature_ptr->oldpy = 33; creature_ptr->oldpx = 131; }
- /* Was creature_ptr->rewards[MAX_BACT] */
rd_s16b(&tmp16s);
for (int i = 0; i < tmp16s; i++)
{
}
}
- /* Repair maximum player level */
if (creature_ptr->max_plv < creature_ptr->lev) creature_ptr->max_plv = creature_ptr->lev;
- /* More info */
strip_bytes(8);
rd_s16b(&creature_ptr->sc);
rd_s16b(&creature_ptr->concent);
- /* Read the flags */
strip_bytes(2); /* Old "rest" */
rd_s16b(&creature_ptr->blind);
rd_s16b(&creature_ptr->paralyzed);
creature_ptr->mimic_form = 0;
creature_ptr->tim_mimic = 0;
creature_ptr->tim_sh_fire = 0;
-
- /* by henkma */
creature_ptr->tim_reflect = 0;
creature_ptr->multishadow = 0;
creature_ptr->dustrobe = 0;
-
creature_ptr->chaos_patron = ((creature_ptr->age + creature_ptr->sc) % MAX_PATRON);
creature_ptr->muta1 = 0;
creature_ptr->muta2 = 0;
rd_s16b(&creature_ptr->tim_eyeeye);
}
- /* by henkma */
if (z_older_than(11, 0, 3)) {
creature_ptr->tim_reflect = 0;
creature_ptr->multishadow = 0;
creature_ptr->dustrobe = 0;
}
- else {
+ else
+ {
rd_s16b(&creature_ptr->tim_reflect);
rd_s16b(&creature_ptr->multishadow);
rd_s16b(&creature_ptr->dustrobe);
rd_s16b(&creature_ptr->vir_types[i]);
}
- /* Calc the regeneration modifier for mutations */
creature_ptr->mutant_regenerate_mod = calc_mutant_regenerate_mod(creature_ptr);
-
if (z_older_than(10, 0, 9))
{
rd_byte(&tmp8u);
}
rd_byte(&creature_ptr->knowledge);
-
rd_byte(&tmp8u);
creature_ptr->autopick_autoregister = tmp8u ? TRUE : FALSE;
rd_byte((byte *)&preserve_mode);
rd_byte((byte *)&creature_ptr->wait_report_score);
- /* Future use */
for (int i = 0; i < 48; i++) rd_byte(&tmp8u);
- /* Skip the flags */
strip_bytes(12);
-
- /* Hack -- the two "special seeds" */
rd_u32b(¤t_world_ptr->seed_flavor);
rd_u32b(¤t_world_ptr->seed_town);
- /* Special stuff */
rd_u16b(&creature_ptr->panic_save);
rd_u16b(¤t_world_ptr->total_winner);
rd_u16b(¤t_world_ptr->noscore);
- /* Read "death" */
rd_byte(&tmp8u);
creature_ptr->is_dead = tmp8u;
- /* Read "feeling" */
rd_byte(&creature_ptr->feeling);
switch (creature_ptr->start_race)
current_world_ptr->game_turn_limit = TURNS_PER_TICK * TOWN_DAWN * (MAX_DAYS - 1) + TURNS_PER_TICK * TOWN_DAWN * 3 / 4;
break;
}
- current_world_ptr->dungeon_turn_limit = TURNS_PER_TICK * TOWN_DAWN * (MAX_DAYS - 1) + TURNS_PER_TICK * TOWN_DAWN * 3 / 4;
- /* Turn when level began */
+ current_world_ptr->dungeon_turn_limit = TURNS_PER_TICK * TOWN_DAWN * (MAX_DAYS - 1) + TURNS_PER_TICK * TOWN_DAWN * 3 / 4;
rd_s32b(&creature_ptr->current_floor_ptr->generated_turn);
-
if (h_older_than(1, 7, 0, 4))
{
creature_ptr->feeling_turn = creature_ptr->current_floor_ptr->generated_turn;
}
else
{
- /* Turn of last "feeling" */
rd_s32b(&creature_ptr->feeling_turn);
}
- /* Current turn */
rd_s32b(¤t_world_ptr->game_turn);
-
if (z_older_than(10, 3, 12))
{
current_world_ptr->dungeon_turn = current_world_ptr->game_turn;
rd_s16b(&creature_ptr->riding);
}
- /* Current floor_id */
if (h_older_than(1, 5, 0, 0))
{
creature_ptr->floor_id = 0;
}
else
{
- /* Get number of party_mon array */
rd_s16b(&tmp16s);
-
- /* Strip old temporary preserved pets */
for (int i = 0; i < tmp16s; i++)
{
monster_type dummy_mon;
-
rd_monster(creature_ptr, &dummy_mon);
}
}
static errr rd_inventory(player_type *player_ptr)
{
player_ptr->total_weight = 0;
-
- /* No items */
player_ptr->inven_cnt = 0;
player_ptr->equip_cnt = 0;
if (player_ptr->inventory_list != NULL) C_WIPE(player_ptr->inventory_list, INVEN_TOTAL, object_type);
C_MAKE(player_ptr->inventory_list, INVEN_TOTAL, object_type);
- /* Read until done */
int slot = 0;
while (TRUE)
{
- /* Get the next item index */
u16b n;
rd_u16b(&n);
- /* Nope, we reached the end */
if (n == 0xFFFF) break;
object_type forge;
object_type *q_ptr;
q_ptr = &forge;
object_wipe(q_ptr);
- /* Read the item */
rd_item(q_ptr);
-
- /* Hack -- verify item */
if (!q_ptr->k_idx) return (53);
- /* Wield equipment */
if (n >= INVEN_RARM)
{
q_ptr->marked |= OM_TOUCHED;
object_copy(&player_ptr->inventory_list[n], q_ptr);
-
- /* Add the weight */
player_ptr->total_weight += (q_ptr->number * q_ptr->weight);
-
- /* One more item */
player_ptr->equip_cnt++;
continue;
}
- /* Warning -- backpack is full */
if (player_ptr->inven_cnt == INVEN_PACK)
{
note(_("持ち物の中のアイテムが多すぎる!", "Too many items in the inventory"));
-
- /* Fail */
return (54);
}
- /* Get a slot */
n = slot++;
-
q_ptr->marked |= OM_TOUCHED;
object_copy(&player_ptr->inventory_list[n], q_ptr);
-
- /* Add the weight */
player_ptr->total_weight += (q_ptr->number * q_ptr->weight);
-
- /* One more item */
player_ptr->inven_cnt++;
}
*/
static errr rd_dungeon_old(player_type *creature_ptr)
{
- /*** Basic info ***/
- /* Header info */
s16b tmp16s;
rd_s16b(&tmp16s);
floor_type *floor_ptr = creature_ptr->current_floor_ptr;
creature_ptr->dungeon_idx = (IDX)tmp8u;
}
- /* Set the base level for old versions */
floor_ptr->base_level = floor_ptr->dun_level;
-
rd_s16b(&tmp16s);
floor_ptr->base_level = (DEPTH)tmp16s;
rd_s16b(&tmp16s); /* max_panel_rows */
rd_s16b(&tmp16s); /* max_panel_cols */
- /* Maximal size */
int ymax = floor_ptr->height;
int xmax = floor_ptr->width;
- /* Load the dungeon data */
for (int x = 0, y = 0; y < ymax; )
{
u16b info;
-
- /* Grab RLE info */
byte count;
rd_byte(&count);
if (z_older_than(10, 3, 6))
else
{
rd_u16b(&info);
-
- /* Decline invalid flags */
info &= ~(CAVE_LITE | CAVE_VIEW | CAVE_MNLT | CAVE_MNDK);
}
- /* Apply the RLE info */
for (int i = count; i > 0; i--)
{
grid_type *g_ptr;
g_ptr = &floor_ptr->grid_array[y][x];
-
- /* Extract "info" */
g_ptr->info = info;
-
- /* Advance/Wrap */
if (++x >= xmax)
{
- /* Wrap */
x = 0;
-
- /* Advance/Wrap */
if (++y >= ymax) break;
}
}
}
- /* Load the dungeon data */
for (int x = 0, y = 0; y < ymax; )
{
- /* Grab RLE info */
byte count;
rd_byte(&count);
byte tmp8u;
rd_byte(&tmp8u);
-
- /* Apply the RLE info */
for (int i = count; i > 0; i--)
{
grid_type *g_ptr;
g_ptr = &floor_ptr->grid_array[y][x];
-
- /* Extract "feat" */
g_ptr->feat = (s16b)tmp8u;
-
- /* Advance/Wrap */
if (++x >= xmax)
{
- /* Wrap */
x = 0;
-
- /* Advance/Wrap */
if (++y >= ymax) break;
}
}
}
- /* Load the dungeon data */
for (int x = 0, y = 0; y < ymax; )
{
- /* Grab RLE info */
byte count;
rd_byte(&count);
byte tmp8u;
rd_byte(&tmp8u);
-
- /* Apply the RLE info */
for (int i = count; i > 0; i--)
{
grid_type *g_ptr;
g_ptr = &floor_ptr->grid_array[y][x];
-
- /* Extract "mimic" */
g_ptr->mimic = (s16b)tmp8u;
-
- /* Advance/Wrap */
if (++x >= xmax)
{
- /* Wrap */
x = 0;
-
- /* Advance/Wrap */
if (++y >= ymax) break;
}
}
}
- /*** Run length decoding ***/
-
- /* Load the dungeon data */
for (int x = 0, y = 0; y < ymax; )
{
- /* Grab RLE info */
byte count;
rd_byte(&count);
rd_s16b(&tmp16s);
-
- /* Apply the RLE info */
for (int i = count; i > 0; i--)
{
grid_type *g_ptr;
g_ptr = &floor_ptr->grid_array[y][x];
-
- /* Extract "feat" */
g_ptr->special = tmp16s;
-
- /* Advance/Wrap */
if (++x >= xmax)
{
- /* Wrap */
x = 0;
-
- /* Advance/Wrap */
if (++y >= ymax) break;
}
}
{
for (int x = 0; x < xmax; x++)
{
- /* Wipe old unused flags */
floor_ptr->grid_array[y][x].info &= ~(CAVE_MASK);
}
}
{
g_ptr->mimic = feat_mirror;
}
-
- /* Runes will be mimics and flags */
else if ((g_ptr->feat == OLD_FEAT_MINOR_GLYPH) ||
(g_ptr->feat == OLD_FEAT_GLYPH))
{
g_ptr->mimic = g_ptr->feat;
g_ptr->feat = feat_floor;
}
-
- /* Hidden traps will be trap terrains mimicing floor */
else if (g_ptr->info & CAVE_TRAP)
{
g_ptr->info &= ~CAVE_TRAP;
g_ptr->mimic = g_ptr->feat;
g_ptr->feat = choose_random_trap(creature_ptr);
}
-
- /* Another hidden trap */
else if (g_ptr->feat == OLD_FEAT_INVIS)
{
g_ptr->mimic = feat_floor;
}
}
- /*** Objects ***/
-
- /* Read the item count */
u16b limit;
rd_u16b(&limit);
-
- /* Verify maximum */
if (limit > current_world_ptr->max_o_idx)
{
note(format(_("アイテムの配列が大きすぎる(%d)!", "Too many (%d) object entries!"), limit));
return (151);
}
- /* Read the dungeon items */
for (int i = 1; i < limit; i++)
{
OBJECT_IDX o_idx = o_pop(floor_ptr);
-
if (i != o_idx)
{
note(format(_("アイテム配置エラー (%d <> %d)", "Object allocation error (%d <> %d)"), i, o_idx));
object_type *o_ptr;
o_ptr = &floor_ptr->o_list[o_idx];
rd_item(o_ptr);
-
if (OBJECT_IS_HELD_MONSTER(o_ptr))
{
monster_type *m_ptr;
g_ptr->o_idx = o_idx;
}
- /*** Monsters ***/
- /* Read the monster count */
rd_u16b(&limit);
-
- /* Hack -- verify */
if (limit > current_world_ptr->max_m_idx)
{
note(format(_("モンスターの配列が大きすぎる(%d)!", "Too many (%d) monster entries!"), limit));
return (161);
}
- /* Read the monsters */
for (int i = 1; i < limit; i++)
{
MONSTER_IDX m_idx;
monster_type *m_ptr;
-
- /* Get a new record */
m_idx = m_pop(creature_ptr);
-
if (i != m_idx)
{
note(format(_("モンスター配置エラー (%d <> %d)", "Monster allocation error (%d <> %d)"), i, m_idx));
real_r_ptr(m_ptr)->cur_num++;
}
- /* The dungeon is ready */
if (z_older_than(10, 3, 13) && !floor_ptr->dun_level && !floor_ptr->inside_arena)
current_world_ptr->character_dungeon = FALSE;
else
current_world_ptr->character_dungeon = TRUE;
+
return 0;
}
grid_template_type *templates;
floor_type *floor_ptr = player_ptr->current_floor_ptr;
clear_cave(player_ptr);
-
- /* Mega-Hack -- no player yet */
player_ptr->x = player_ptr->y = 0;
- /*** Basic info ***/
- /* Dungeon floor specific info follows */
-
if (!sf_ptr)
{
- /*** Not a saved floor ***/
s16b tmp16s;
rd_s16b(&tmp16s);
floor_ptr->dun_level = (DEPTH)tmp16s;
}
else
{
- /*** The saved floor ***/
s16b tmp16s;
rd_s16b(&tmp16s);
if (tmp16s != sf_ptr->floor_id) return 171;
rd_byte(&player_ptr->feeling);
- /*** Read template for grid_type ***/
-
- /* Read the template count */
u16b limit;
rd_u16b(&limit);
-
- /* Allocate the "template" array */
C_MAKE(templates, limit, grid_template_type);
- /* Read the templates */
for (int i = 0; i < limit; i++)
{
grid_template_type *ct_ptr = &templates[i];
-
- /* Read it */
rd_u16b(&tmp16u);
ct_ptr->info = (BIT_FLAGS)tmp16u;
if (h_older_than(1, 7, 0, 2))
rd_s16b(&ct_ptr->feat);
rd_s16b(&ct_ptr->mimic);
}
+
rd_s16b(&ct_ptr->special);
}
- /* Maximal size */
POSITION ymax = floor_ptr->height;
POSITION xmax = floor_ptr->width;
-
- /* Load the dungeon data */
for (POSITION x = 0, y = 0; y < ymax; )
{
- u16b id;
-
- /* Grab RLE info */
byte count;
rd_byte(&count);
- id = 0;
+ u16b id = 0;
byte tmp8u;
do
{
id += tmp8u;
} while (tmp8u == MAX_UCHAR);
- /* Apply the RLE info */
for (int i = count; i > 0; i--)
{
grid_type *g_ptr = &floor_ptr->grid_array[y][x];
g_ptr->mimic = templates[id].mimic;
g_ptr->special = templates[id].special;
- /* Advance/Wrap */
if (++x >= xmax)
{
- /* Wrap */
x = 0;
-
- /* Advance/Wrap */
if (++y >= ymax) break;
}
}
}
}
- /* Free the "template" array */
C_KILL(templates, limit, grid_template_type);
-
-
- /*** Objects ***/
-
- /* Read the item count */
rd_u16b(&limit);
-
- /* Verify maximum */
if (limit > current_world_ptr->max_o_idx) return 151;
-
- /* Read the dungeon items */
for (int i = 1; i < limit; i++)
{
OBJECT_IDX o_idx;
object_type *o_ptr;
-
-
- /* Get a new record */
o_idx = o_pop(floor_ptr);
-
if (i != o_idx) return 152;
- /* Acquire place */
o_ptr = &floor_ptr->o_list[o_idx];
-
- /* Read the item */
rd_item(o_ptr);
if (OBJECT_IS_HELD_MONSTER(o_ptr))
{
monster_type *m_ptr;
m_ptr = &floor_ptr->m_list[o_ptr->held_m_idx];
-
- /* Build a stack */
o_ptr->next_o_idx = m_ptr->hold_o_idx;
-
m_ptr->hold_o_idx = o_idx;
}
-
- /* Dungeon */
else
{
- /* Access the item location */
grid_type *g_ptr = &floor_ptr->grid_array[o_ptr->iy][o_ptr->ix];
-
- /* Build a stack */
o_ptr->next_o_idx = g_ptr->o_idx;
-
g_ptr->o_idx = o_idx;
}
}
-
- /*** Monsters ***/
-
- /* Read the monster count */
rd_u16b(&limit);
-
- /* Hack -- verify */
if (limit > current_world_ptr->max_m_idx) return 161;
- /* Read the monsters */
for (int i = 1; i < limit; i++)
{
grid_type *g_ptr;
MONSTER_IDX m_idx;
monster_type *m_ptr;
-
- /* Get a new record */
m_idx = m_pop(player_ptr);
-
if (i != m_idx) return 162;
m_ptr = &floor_ptr->m_list[m_idx];
-
- /* Read the monster */
rd_monster(player_ptr, m_ptr);
-
-
- /* Access grid */
g_ptr = &floor_ptr->grid_array[m_ptr->fy][m_ptr->fx];
-
- /* Mark the location */
g_ptr->m_idx = m_idx;
-
- /* Count */
real_r_ptr(m_ptr)->cur_num++;
}
*/
static errr rd_dungeon(player_type *player_ptr)
{
- /* Initialize saved_floors array and temporary files */
init_saved_floors(player_ptr, FALSE);
-
- /* Older method */
errr err = 0;
if (h_older_than(1, 5, 0, 0))
{
err = rd_dungeon_old(player_ptr);
-
- /* Prepare floor_id of current floor */
if (player_ptr->dungeon_idx)
{
player_ptr->floor_id = get_new_floor_id(player_ptr);
return err;
}
- /*** Meta info ***/
- /* Number of floor_id used from birth */
rd_s16b(&max_floor_id);
-
- /* Current dungeon type */
byte_hack tmp8u;
rd_byte(&tmp8u);
player_ptr->dungeon_idx = (DUNGEON_IDX)tmp8u;
-
- /* Number of the saved_floors array elements */
byte num;
rd_byte(&num);
-
- /*** No saved floor (On the surface etc.) ***/
- if (!num)
+ if (num == 0)
{
- /* Read the current floor data */
err = rd_saved_floor(player_ptr, NULL);
}
-
- /*** In the dungeon ***/
else
{
-
- /* Read the saved_floors array */
for (int i = 0; i < num; i++)
{
saved_floor_type *sf_ptr = &saved_floors[i];
rd_s16b(&sf_ptr->lower_floor_id);
}
-
- /* Move saved floors data to temporary files */
for (int i = 0; i < num; i++)
{
saved_floor_type *sf_ptr = &saved_floors[i];
-
- /* Unused element */
if (!sf_ptr->floor_id) continue;
-
- /* Read the failure mark */
rd_byte(&tmp8u);
if (tmp8u) continue;
- /* Read from the save file */
err = rd_saved_floor(player_ptr, sf_ptr);
-
- /* Error? */
if (err) break;
- /* Re-save as temporary saved floor file */
if (!save_floor(player_ptr, sf_ptr, SLF_SECOND)) err = 182;
- /* Error? */
if (err) break;
}
- /* Finally load current floor data from temporary file */
- if (!err)
+ if (err == 0)
{
if (!load_floor(player_ptr, get_sf_ptr(player_ptr->floor_id), SLF_SECOND)) err = 183;
}
}
-
- /*** Error messages ***/
switch (err)
{
case 151:
u32b n_x_check, n_v_check;
u32b o_x_check, o_v_check;
- /* Strip the version bytes */
strip_bytes(4);
-
- /* Hack -- decrypt */
xor_byte = current_world_ptr->sf_extra;
-
- /* Clear the checksums */
v_check = 0L;
x_check = 0L;
- /* Read the version number of the savefile */
/* Old savefile will be version 0.0.0.3 */
rd_byte(¤t_world_ptr->h_ver_extra);
rd_byte(¤t_world_ptr->h_ver_patch);
rd_byte(¤t_world_ptr->h_ver_minor);
rd_byte(¤t_world_ptr->h_ver_major);
- /* Mention the savefile version */
note(format(
_("バージョン %d.%d.%d.%d のセーブ・ファイルをロード中...", "Loading a %d.%d.%d.%d savefile..."),
(current_world_ptr->h_ver_major > 9) ? current_world_ptr->h_ver_major - 10 : current_world_ptr->h_ver_major, current_world_ptr->h_ver_minor, current_world_ptr->h_ver_patch, current_world_ptr->h_ver_extra));
- /* Operating system info */
rd_u32b(¤t_world_ptr->sf_system);
-
- /* Time of savefile creation */
rd_u32b(¤t_world_ptr->sf_when);
-
- /* Number of resurrections */
rd_u16b(¤t_world_ptr->sf_lives);
-
- /* Number of times played */
rd_u16b(¤t_world_ptr->sf_saves);
- /* Later use (always zero) */
u32b tmp32u;
rd_u32b(&tmp32u);
- /* Later use (always zero) */
u16b tmp16u;
rd_u16b(&tmp16u);
- /* Later use (always zero) */
byte tmp8u;
rd_byte(&tmp8u);
-
- /* Kanji code */
rd_byte(&kanji_code);
- /* Read RNG state */
rd_randomizer();
if (arg_fiddle) note(_("乱数情報をロードしました", "Loaded Randomizer Info"));
- /* Then the options */
rd_options();
if (arg_fiddle) note(_("オプションをロードしました", "Loaded Option Flags"));
- /* Then the "messages" */
rd_messages();
if (arg_fiddle) note(_("メッセージをロードしました", "Loaded Messages"));
for (int i = 0; i < max_r_idx; i++)
{
- /* Access that monster */
monster_race *r_ptr = &r_info[i];
-
- /* Hack -- Reset the death counter */
r_ptr->max_num = 100;
if (r_ptr->flags1 & RF1_UNIQUE) r_ptr->max_num = 1;
-
- /* Hack -- Non-unique Nazguls are semi-unique */
else if (r_ptr->flags7 & RF7_NAZGUL) r_ptr->max_num = MAX_NAZGUL_NUM;
}
- /* Monster Memory */
rd_u16b(&tmp16u);
-
- /* Incompatible save files */
if (tmp16u > max_r_idx)
{
note(format(_("モンスターの種族が多すぎる(%u)!", "Too many (%u) monster races!"), tmp16u));
return (21);
}
- /* Read the available records */
for (int i = 0; i < tmp16u; i++)
{
- /* Read the lore */
rd_lore((MONRACE_IDX)i);
}
if (arg_fiddle) note(_("モンスターの思い出をロードしました", "Loaded Monster Memory"));
- /* Object Memory */
rd_u16b(&tmp16u);
-
- /* Incompatible save files */
if (tmp16u > max_k_idx)
{
note(format(_("アイテムの種類が多すぎる(%u)!", "Too many (%u) object kinds!"), tmp16u));
return (22);
}
- /* Read the object memory */
for (int i = 0; i < tmp16u; i++)
{
object_kind *k_ptr = &k_info[i];
-
rd_byte(&tmp8u);
-
k_ptr->aware = (tmp8u & 0x01) ? TRUE : FALSE;
k_ptr->tried = (tmp8u & 0x02) ? TRUE : FALSE;
}
byte max_rquests_load;
s16b old_inside_quest = creature_ptr->current_floor_ptr->inside_quest;
- /* Number of towns */
rd_u16b(&max_towns_load);
-
- /* Incompatible save files */
if (max_towns_load > max_towns)
{
note(format(_("町が多すぎる(%u)!", "Too many (%u) towns!"), max_towns_load));
return (23);
}
- /* Number of quests */
rd_u16b(&max_quests_load);
-
if (z_older_than(11, 0, 7))
{
max_rquests_load = 10;
rd_byte(&max_rquests_load);
}
- /* Incompatible save files */
if (max_quests_load > max_q_idx)
{
note(format(_("クエストが多すぎる(%u)!", "Too many (%u) quests!"), max_quests_load));
q_ptr->max_num = (MONSTER_NUMBER)tmp16s;
rd_s16b(&q_ptr->type);
- /* Load quest monster index */
rd_s16b(&q_ptr->r_idx);
-
if ((q_ptr->type == QUEST_TYPE_RANDOM) && (!q_ptr->r_idx))
{
determine_random_questor(creature_ptr, &quest[i]);
}
- /* Load quest item index */
rd_s16b(&q_ptr->k_idx);
-
if (q_ptr->k_idx)
a_info[q_ptr->k_idx].gen_flags |= TRG_QUESTITEM;
quest[OLD_QUEST_WATER_CAVE].status = QUEST_STATUS_UNTAKEN;
}
- /* Position in the wilderness */
rd_s32b(&creature_ptr->wilderness_x);
rd_s32b(&creature_ptr->wilderness_y);
if (z_older_than(10, 3, 13))
rd_s32b(&wild_x_size);
rd_s32b(&wild_y_size);
- /* Incompatible save files */
if ((wild_x_size > current_world_ptr->max_wild_x) || (wild_y_size > current_world_ptr->max_wild_y))
{
note(format(_("荒野が大きすぎる(%u/%u)!", "Wilderness is too big (%u/%u)!"), wild_x_size, wild_y_size));
return (23);
}
- /* Load the wilderness seeds */
for (int i = 0; i < wild_x_size; i++)
{
for (int j = 0; j < wild_y_size; j++)
if (arg_fiddle) note(_("クエスト情報をロードしました", "Loaded Quests"));
- /* Load the Artifacts */
rd_u16b(&tmp16u);
-
- /* Incompatible save files */
if (tmp16u > max_a_idx)
{
note(format(_("伝説のアイテムが多すぎる(%u)!", "Too many (%u) artifacts!"), tmp16u));
return (24);
}
- /* Read the artifact flags */
for (int i = 0; i < tmp16u; i++)
{
artifact_type *a_ptr = &a_info[i];
rd_s16b(&a_ptr->floor_id);
}
}
+
if (arg_fiddle) note(_("伝説のアイテムをロードしました", "Loaded Artifacts"));
- /* Read the extra stuff */
rd_extra(creature_ptr);
if (creature_ptr->energy_need < -999) creature_ptr->timewalk = TRUE;
if (arg_fiddle) note(_("特別情報をロードしました", "Loaded extra information"));
-
- /* Read the player_hp array */
rd_u16b(&tmp16u);
-
- /* Incompatible save files */
if (tmp16u > PY_MAX_LEVEL)
{
note(format(_("ヒットポイント配列が大きすぎる(%u)!", "Too many (%u) hitpoint entries!"), tmp16u));
return (25);
}
- /* Read the player_hp array */
for (int i = 0; i < tmp16u; i++)
{
s16b tmp16s;
creature_ptr->player_hp[i] = (HIT_POINT)tmp16s;
}
- /* Important -- Initialize the sex */
sp_ptr = &sex_info[creature_ptr->psex];
-
- /* Important -- Initialize the race/class */
rp_ptr = &race_info[creature_ptr->prace];
cp_ptr = &class_info[creature_ptr->pclass];
ap_ptr = &seikaku_info[creature_ptr->pseikaku];
creature_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
roll_hitdice(creature_ptr, 0L);
}
+
if (z_older_than(10, 3, 2) && (creature_ptr->pclass == CLASS_ARCHER) && !creature_ptr->is_dead)
{
creature_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
roll_hitdice(creature_ptr, 0L);
}
+
if (z_older_than(10, 2, 6) && (creature_ptr->pclass == CLASS_SORCERER) && !creature_ptr->is_dead)
{
creature_ptr->hitdie = rp_ptr->r_mhp / 2 + cp_ptr->c_mhp + ap_ptr->a_mhp;
roll_hitdice(creature_ptr, 0L);
}
+
if (z_older_than(10, 4, 7) && (creature_ptr->pclass == CLASS_BLUE_MAGE) && !creature_ptr->is_dead)
{
creature_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
roll_hitdice(creature_ptr, 0L);
}
- /* Important -- Initialize the magic */
mp_ptr = &m_info[creature_ptr->pclass];
- /* Read spell info */
rd_u32b(&creature_ptr->spell_learned1);
rd_u32b(&creature_ptr->spell_learned2);
rd_u32b(&creature_ptr->spell_worked1);
creature_ptr->learned_spells = 0;
for (int i = 0; i < 64; i++)
{
- /* Count known spells */
if ((i < 32) ?
(creature_ptr->spell_learned1 & (1L << i)) :
(creature_ptr->spell_learned2 & (1L << (i - 32))))
return (21);
}
- /* Read number of towns */
rd_u16b(&tmp16u);
int town_count = tmp16u;
- /* Read the stores */
rd_u16b(&tmp16u);
for (int i = 1; i < town_count; i++)
{
if (!creature_ptr->is_dead)
{
- /* Dead players have no dungeon */
note(_("ダンジョン復元中...", "Restoring Dungeon..."));
-
if (rd_dungeon(creature_ptr))
{
note(_("ダンジョンデータ読み込み失敗", "Error reading dungeon data"));
return (34);
}
- /* Read the ghost info */
rd_ghost();
-
{
s32b tmp32s;
}
}
- /* Save the checksum */
n_v_check = v_check;
-
- /* Read the old checksum */
rd_u32b(&o_v_check);
-
- /* Verify */
if (o_v_check != n_v_check)
{
note(_("チェックサムがおかしい", "Invalid checksum"));
return 11;
}
- /* Save the encoded checksum */
n_x_check = x_check;
-
- /* Read the checksum */
rd_u32b(&o_x_check);
-
- /* Verify */
if (o_x_check != n_x_check)
{
note(_("エンコードされたチェックサムがおかしい", "Invalid encoded checksum"));
*/
errr rd_savefile_new(player_type *player_ptr)
{
- /* Grab permissions */
safe_setuid_grab();
-
- /* The savefile is a binary file */
fff = my_fopen(savefile, "rb");
-
- /* Drop permissions */
safe_setuid_drop();
if (!fff) return -1;
-
- /* Call the sub-function */
errr err = rd_savefile_new_aux(player_ptr);
- /* Check for errors */
if (ferror(fff)) err = -1;
my_fclose(fff);
return err;
u32b n_x_check, n_v_check;
u32b o_x_check, o_v_check;
- /* Hack -- decrypt (read xor_byte) */
xor_byte = 0;
byte tmp8u;
rd_byte(&tmp8u);
- /* Clear the checksums */
v_check = 0L;
x_check = 0L;
- /* Set the version number to current version */
- /* Never load old temporary files */
current_world_ptr->h_ver_extra = H_VER_EXTRA;
current_world_ptr->h_ver_patch = H_VER_PATCH;
current_world_ptr->h_ver_minor = H_VER_MINOR;
current_world_ptr->h_ver_major = H_VER_MAJOR;
- /* Verify the sign */
u32b tmp32u;
rd_u32b(&tmp32u);
if (saved_floor_file_sign != tmp32u) return FALSE;
- /* Read -- have error? */
if (rd_saved_floor(player_ptr, sf_ptr)) return FALSE;
- /* Save the checksum */
n_v_check = v_check;
-
- /* Read the old checksum */
rd_u32b(&o_v_check);
- /* Verify */
if (o_v_check != n_v_check) return FALSE;
- /* Save the encoded checksum */
n_x_check = x_check;
-
- /* Read the checksum */
rd_u32b(&o_x_check);
- /* Verify */
if (o_x_check != n_x_check) return FALSE;
return TRUE;
}
*/
#ifdef JP
# ifdef EUC
- /* EUC kanji code */
kanji_code = 2;
# endif
# ifdef SJIS
- /* SJIS kanji code */
kanji_code = 3;
# endif
#else
- /* ASCII */
kanji_code = 1;
#endif
- /* We have one file already opened */
FILE *old_fff = NULL;
byte old_xor_byte = 0;
u32b old_v_check = 0;
byte old_h_ver_extra = 0;
if (mode & SLF_SECOND)
{
- /* Backup original values */
old_fff = fff;
old_xor_byte = xor_byte;
old_v_check = v_check;
old_h_ver_extra = current_world_ptr->h_ver_extra;
}
- /* floor savefile */
char floor_savefile[1024];
sprintf(floor_savefile, "%s.F%02d", savefile, (int)sf_ptr->savefile_id);
- /* Grab permissions */
safe_setuid_grab();
-
- /* The savefile is a binary file */
fff = my_fopen(floor_savefile, "rb");
-
- /* Drop permissions */
safe_setuid_drop();
- /* Couldn't read */
bool is_save_successful = TRUE;
if (!fff) is_save_successful = FALSE;
- /* Attempt to load */
if (is_save_successful)
{
- /* Load saved floor data from file */
is_save_successful = load_floor_aux(player_ptr, sf_ptr);
-
- /* Check for errors */
if (ferror(fff)) is_save_successful = FALSE;
my_fclose(fff);
- /* Grab permissions */
safe_setuid_grab();
-
- /* Delete the file */
if (!(mode & SLF_NO_KILL)) (void)fd_kill(floor_savefile);
- /* Drop permissions */
safe_setuid_drop();
}
- /* We have one file already opened */
if (mode & SLF_SECOND)
{
- /* Restore original values */
fff = old_fff;
xor_byte = old_xor_byte;
v_check = old_v_check;
current_world_ptr->h_ver_extra = old_h_ver_extra;
}
- /* Restore old knowledge */
byte old_kanji_code = kanji_code;
kanji_code = old_kanji_code;
return is_save_successful;
# endif
#endif
- /*
- * Available graphic modes
- */
+/*
+ * Available graphic modes
+ */
#define GRAPHICS_NONE 0
#define GRAPHICS_ORIGINAL 1
#define GRAPHICS_ADAM_BOLT 2
#define GRAPHICS_HENGBAND 3
- /*
- * Hack -- allow use of "screen saver" mode
- */
-#define USE_SAVER
-
-
- /*
- * Menu constants -- see "ANGBAND.RC"
- */
-
+/*
+ * Menu constants -- see "ANGBAND.RC"
+ */
#define IDM_FILE_NEW 100
#define IDM_FILE_OPEN 101
#define IDM_FILE_SAVE 110
#define IDM_HELP_CONTENTS 901
- /*
- * Exclude parts of WINDOWS.H that are not needed
- */
+/*
+ * Exclude parts of WINDOWS.H that are not needed
+ */
#define NOCOMM /* Comm driver APIs and definitions */
#define NOLOGERROR /* LogError() and related definitions */
#define NOPROFILER /* Profiler APIs */
#define NOMDI /* MDI support */
#define NOHELP /* Help support */
- /* Not defined since it breaks Borland C++ 5.5 */
- /* #define NOCTLMGR */ /* Control management and controls */
+/* Not defined since it breaks Borland C++ 5.5 */
+/* #define NOCTLMGR */ /* Control management and controls */
- /*
- * Exclude parts of WINDOWS.H that are not needed (Win32)
- */
+/*
+ * Exclude parts of WINDOWS.H that are not needed (Win32)
+ */
#define WIN32_LEAN_AND_MEAN
#define NONLS /* All NLS defines and routines */
#define NOSERVICE /* All Service Controller routines, SERVICE_ equates, etc. */
#define NOKANJI /* Kanji support stuff. */
#define NOMCX /* Modem Configuration Extensions */
- /*
- * Include the "windows" support file
- */
+/*
+ * Include the "windows" support file
+ */
#include <windows.h>
- /*
- * Exclude parts of MMSYSTEM.H that are not needed
- */
+/*
+* Exclude parts of MMSYSTEM.H that are not needed
+*/
#define MMNODRV /* Installable driver support */
#define MMNOWAVE /* Waveform support */
#define MMNOMIDI /* MIDI support */
#define MMNOMMIO /* Multimedia file I/O support */
#define MMNOMMSYSTEM /* General MMSYSTEM functions */
-
- /*
- * Standard sound names
- */
+/*
+ * Standard sound names
+ */
const concptr angband_sound_name[SOUND_MAX] =
{
"dummy",
#include <mmsystem.h>
#include <commdlg.h>
- /*
- * HTML-Help requires htmlhelp.h and htmlhelp.lib from Microsoft's
- * HTML Workshop < http://msdn.microsoft.com/workshop/author/htmlhelp/ >.
- */
- /* #define HTML_HELP */
-
-#ifdef HTML_HELP
-#include <htmlhelp.h>
-#endif /* HTML_HELP */
-
/*
* Include the support for loading bitmaps
*/
static int use_bg = 0; //!< 背景使用フラグ、1なら私用。
static char bg_bitmap_file[1024] = "bg.bmp"; //!< 現在の背景ビットマップファイル名。
-#ifdef USE_SAVER
-
/*
* The screen saver window
*/
static HWND hwndSaver;
-#endif /* USE_SAVER */
-
-
/*!
* 現在使用中のタイルID(0ならば未使用)
* Flag set once "graphics" has been initialized
*/
static DIBINIT infMask;
-
/*
* Flag set once "sound" has been initialized
*/
(use_bg ? MF_CHECKED : MF_UNCHECKED));
#ifdef JP
#else
-
CheckMenuItem(hm, IDM_OPTIONS_SAVER,
(hwndSaver ? MF_CHECKED : MF_UNCHECKED));
#endif
-
- /* Menu "Options", Item "Graphics" */
EnableMenuItem(hm, IDM_OPTIONS_NO_GRAPHICS, MF_ENABLED);
- /* Menu "Options", Item "Graphics" */
EnableMenuItem(hm, IDM_OPTIONS_OLD_GRAPHICS, MF_ENABLED);
- /* Menu "Options", Item "Graphics" */
EnableMenuItem(hm, IDM_OPTIONS_NEW_GRAPHICS, MF_ENABLED);
- /* Menu "Options", Item "Graphics" */
EnableMenuItem(hm, IDM_OPTIONS_BIGTILE, MF_ENABLED);
-
- /* Menu "Options", Item "Sound" */
EnableMenuItem(hm, IDM_OPTIONS_SOUND, MF_ENABLED);
-
-#ifdef USE_SAVER
- /* Menu "Options", Item "ScreenSaver" */
EnableMenuItem(hm, IDM_OPTIONS_SAVER,
MF_BYCOMMAND | MF_ENABLED);
-#endif /* USE_SAVER */
}
*/
static void process_menus(player_type *player_ptr, WORD wCmd)
{
- int i;
-
term_data *td;
-
OPENFILENAME ofn;
-
- /* Analyze */
switch (wCmd)
{
- /* New game */
case IDM_FILE_NEW:
{
if (!initialized)
}
break;
}
-
- /* Open game */
case IDM_FILE_OPEN:
{
if (!initialized)
if (GetOpenFileName(&ofn))
{
- /* Load 'savefile' */
validate_file(savefile);
game_in_progress = TRUE;
Term_flush();
}
break;
}
-
- /* Save game */
case IDM_FILE_SAVE:
{
if (game_in_progress && current_world_ptr->character_generated)
break;
}
- /* Hack -- Forget messages */
msg_flag = FALSE;
-
- /* Save the game */
do_cmd_save_game(player_ptr, FALSE);
}
else
{
plog(_("今、セーブすることは出来ません。", "You may not do that right now."));
}
+
break;
}
-
case IDM_FILE_EXIT:
{
if (game_in_progress && current_world_ptr->character_generated)
break;
}
- /* Hack -- Forget messages */
msg_flag = FALSE;
-
forget_lite(player_ptr->current_floor_ptr);
forget_view(player_ptr->current_floor_ptr);
clear_mon_lite(player_ptr->current_floor_ptr);
Term_key_push(SPECIAL_KEY_QUIT);
break;
}
+
quit(NULL);
break;
}
-
- /* Show scores */
case IDM_FILE_SCORE:
{
char buf[1024];
path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
-
- /* Open the binary high score file, for reading */
highscore_fd = fd_open(buf, O_RDONLY);
-
- /* Paranoia -- No score file */
if (highscore_fd < 0)
{
msg_print("Score file unavailable.");
{
screen_save();
Term_clear();
-
- /* Display the scores */
display_scores_aux(0, MAX_HISCORES, -1, NULL);
-
- /* Shut the high score file */
(void)fd_close(highscore_fd);
-
- /* Forget the high score fd */
highscore_fd = -1;
screen_load();
-
- /* Hack - Flush it */
Term_fresh();
}
break;
}
-
- /* Open game */
case IDM_FILE_MOVIE:
{
if (!initialized)
if (GetOpenFileName(&ofn))
{
- /* Load 'savefile' */
prepare_browse_movie_aux(savefile);
play_game(player_ptr, FALSE);
quit(NULL);
}
break;
}
-
-
case IDM_WINDOW_VIS_0:
{
plog(_("メインウィンドウは非表示にできません!", "You are not allowed to do that!"));
break;
}
-
- /* Window visibility */
case IDM_WINDOW_VIS_1:
case IDM_WINDOW_VIS_2:
case IDM_WINDOW_VIS_3:
case IDM_WINDOW_VIS_6:
case IDM_WINDOW_VIS_7:
{
- i = wCmd - IDM_WINDOW_VIS_0;
-
+ int i = wCmd - IDM_WINDOW_VIS_0;
if ((i < 0) || (i >= MAX_TERM_DATA)) break;
td = &data[i];
break;
}
-
- /* Window fonts */
case IDM_WINDOW_FONT_0:
case IDM_WINDOW_FONT_1:
case IDM_WINDOW_FONT_2:
case IDM_WINDOW_FONT_6:
case IDM_WINDOW_FONT_7:
{
- i = wCmd - IDM_WINDOW_FONT_0;
-
+ int i = wCmd - IDM_WINDOW_FONT_0;
if ((i < 0) || (i >= MAX_TERM_DATA)) break;
td = &data[i];
-
term_change_font(td);
-
break;
}
-
- /* Window Z Position */
case IDM_WINDOW_POS_1:
case IDM_WINDOW_POS_2:
case IDM_WINDOW_POS_3:
case IDM_WINDOW_POS_6:
case IDM_WINDOW_POS_7:
{
- i = wCmd - IDM_WINDOW_POS_0;
-
+ int i = wCmd - IDM_WINDOW_POS_0;
if ((i < 0) || (i >= MAX_TERM_DATA)) break;
td = &data[i];
-
if (!td->posfix && td->visible)
{
td->posfix = TRUE;
break;
}
-
- /* Bizarre Display */
case IDM_WINDOW_BIZ_0:
case IDM_WINDOW_BIZ_1:
case IDM_WINDOW_BIZ_2:
case IDM_WINDOW_BIZ_6:
case IDM_WINDOW_BIZ_7:
{
- i = wCmd - IDM_WINDOW_BIZ_0;
-
+ int i = wCmd - IDM_WINDOW_BIZ_0;
if ((i < 0) || (i >= MAX_TERM_DATA)) break;
td = &data[i];
-
td->bizarre = !td->bizarre;
-
term_getsize(td);
-
term_window_resize(td);
-
break;
}
-
- /* Increase Tile Width */
case IDM_WINDOW_I_WID_0:
case IDM_WINDOW_I_WID_1:
case IDM_WINDOW_I_WID_2:
case IDM_WINDOW_I_WID_6:
case IDM_WINDOW_I_WID_7:
{
- i = wCmd - IDM_WINDOW_I_WID_0;
-
+ int i = wCmd - IDM_WINDOW_I_WID_0;
if ((i < 0) || (i >= MAX_TERM_DATA)) break;
td = &data[i];
-
td->tile_wid += 1;
-
term_getsize(td);
-
term_window_resize(td);
-
break;
}
-
- /* Decrease Tile Height */
case IDM_WINDOW_D_WID_0:
case IDM_WINDOW_D_WID_1:
case IDM_WINDOW_D_WID_2:
case IDM_WINDOW_D_WID_6:
case IDM_WINDOW_D_WID_7:
{
- i = wCmd - IDM_WINDOW_D_WID_0;
-
+ int i = wCmd - IDM_WINDOW_D_WID_0;
if ((i < 0) || (i >= MAX_TERM_DATA)) break;
td = &data[i];
-
td->tile_wid -= 1;
-
term_getsize(td);
-
term_window_resize(td);
-
break;
}
-
- /* Increase Tile Height */
case IDM_WINDOW_I_HGT_0:
case IDM_WINDOW_I_HGT_1:
case IDM_WINDOW_I_HGT_2:
case IDM_WINDOW_I_HGT_6:
case IDM_WINDOW_I_HGT_7:
{
- i = wCmd - IDM_WINDOW_I_HGT_0;
-
+ int i = wCmd - IDM_WINDOW_I_HGT_0;
if ((i < 0) || (i >= MAX_TERM_DATA)) break;
td = &data[i];
-
td->tile_hgt += 1;
-
term_getsize(td);
-
term_window_resize(td);
-
break;
}
-
- /* Decrease Tile Height */
case IDM_WINDOW_D_HGT_0:
case IDM_WINDOW_D_HGT_1:
case IDM_WINDOW_D_HGT_2:
case IDM_WINDOW_D_HGT_6:
case IDM_WINDOW_D_HGT_7:
{
- i = wCmd - IDM_WINDOW_D_HGT_0;
-
+ int i = wCmd - IDM_WINDOW_D_HGT_0;
if ((i < 0) || (i >= MAX_TERM_DATA)) break;
td = &data[i];
-
td->tile_hgt -= 1;
-
term_getsize(td);
-
term_window_resize(td);
-
break;
}
-
case IDM_OPTIONS_NO_GRAPHICS:
{
if (!inkey_flag)
break;
}
-
case IDM_OPTIONS_OLD_GRAPHICS:
{
if (!inkey_flag)
break;
}
-
case IDM_OPTIONS_NEW_GRAPHICS:
{
if (!inkey_flag)
break;
}
-
case IDM_OPTIONS_NEW2_GRAPHICS:
{
if (!inkey_flag)
break;
}
-
case IDM_OPTIONS_BIGTILE:
{
td = &data[0];
InvalidateRect(td->w, NULL, TRUE);
break;
}
-
case IDM_OPTIONS_MUSIC:
{
if (!inkey_flag)
Term_key_push(KTRL('R'));
break;
}
-
case IDM_OPTIONS_SOUND:
{
if (!inkey_flag)
Term_key_push(KTRL('R'));
break;
}
-
- /* bg */
case IDM_OPTIONS_BG:
{
if (!inkey_flag)
Term_key_push(KTRL('R'));
break;
}
-
- /* bg */
case IDM_OPTIONS_OPEN_BG:
{
if (!inkey_flag)
if (GetOpenFileName(&ofn))
{
- /* Load 'savefile' */
use_bg = 1;
init_bg();
}
- /* React to changes */
term_xtra_win_react(player_ptr);
-
- /* Hack -- Force redraw */
Term_key_push(KTRL('R'));
}
+
break;
}
-
case IDM_DUMP_SCREEN_HTML:
{
static char buf[1024] = "";
}
break;
}
-
-#ifdef USE_SAVER
-
case IDM_OPTIONS_SAVER:
{
if (hwndSaver)
}
else
{
- /* Create a screen scaver window */
hwndSaver = CreateWindowEx(WS_EX_TOPMOST, "WindowsScreenSaverClass",
"Angband Screensaver",
WS_POPUP | WS_MAXIMIZE | WS_VISIBLE,
if (hwndSaver)
{
- /* Push the window to the bottom */
SetWindowPos(hwndSaver, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
}
else
plog(_("ウィンドウを作成出来ません", "Failed to create saver window"));
}
}
+
break;
}
-
-#endif
-
case IDM_OPTIONS_MAP:
{
windows_map(player_ptr);
case IDM_HELP_CONTENTS:
{
-#ifdef HTML_HELP
- char tmp[1024];
- path_build(tmp, sizeof(tmp), ANGBAND_DIR_XTRA_HELP, "zangband.chm");
- if (check_file(tmp))
- {
- HtmlHelp(data[0].w, tmp, HH_DISPLAY_TOPIC, 0);
- }
- else
- {
- plog_fmt(_("ヘルプファイル[%s]が見付かりません。", "Cannot find help file: %s"), tmp);
- plog(_("代わりにオンラインヘルプを使用してください。", "Use the online help files instead."));
- }
- break;
-#else /* HTML_HELP */
char buf[1024];
char tmp[1024];
path_build(tmp, sizeof(tmp), ANGBAND_DIR_XTRA_HELP, "zangband.hlp");
}
break;
-#endif /* HTML_HELP */
}
}
}
static bool process_keydown(WPARAM wParam, LPARAM lParam)
{
- int i;
bool mc = FALSE;
bool ms = FALSE;
bool ma = FALSE;
term_no_press = (ma) ? TRUE : FALSE;
- /* Handle "special" keys */
if (special_key[(byte)(wParam)] || (ma && !ignore_key[(byte)(wParam)]))
{
bool ext_key = (lParam & 0x1000000L) ? TRUE : FALSE;
bool numpad = FALSE;
- /* Begin the macro trigger */
Term_keypress(31);
-
- /* Send the modifiers */
if (mc) Term_keypress('C');
if (ms) Term_keypress('S');
if (ma) Term_keypress('A');
- /* Extract "scan code" */
- i = LOBYTE(HIWORD(lParam));
-
- /* Introduce the scan code */
+ int i = LOBYTE(HIWORD(lParam));
Term_keypress('x');
-
- /* Extended key bit */
switch (wParam)
{
- /* Numpad Enter and '/' are extended key */
case VK_DIVIDE:
term_no_press = TRUE;
- case VK_RETURN: /* Enter */
+ case VK_RETURN:
numpad = ext_key;
break;
- /* Other extended keys are on full keyboard */
case VK_NUMPAD0:
case VK_NUMPAD1:
case VK_NUMPAD2:
case VK_CLEAR:
case VK_HOME:
case VK_END:
- case VK_PRIOR: /* Page Up */
- case VK_NEXT: /* Page Down */
+ case VK_PRIOR:
+ case VK_NEXT:
case VK_INSERT:
case VK_DELETE:
case VK_UP:
numpad = !ext_key;
}
- /* Special modifiers for keypad keys */
if (numpad) Term_keypress('K');
- /* Encode the hexidecimal scan code */
Term_keypress(hexsym[i / 16]);
Term_keypress(hexsym[i % 16]);
-
- /* End the macro trigger */
Term_keypress(13);
return 1;
PAINTSTRUCT ps;
HDC hdc;
term_data *td;
- int i;
-
-
- /* Acquire proper "term_data" info */
td = (term_data *)GetWindowLong(hWnd, 0);
- /* Handle message */
switch (uMsg)
{
case WM_NCCREATE:
SetWindowLong(hWnd, 0, (LONG)(my_td));
break;
}
-
case WM_CREATE:
{
mop.dwCallback = (DWORD)hWnd;
return 0;
}
-
case WM_GETMINMAXINFO:
{
MINMAXINFO FAR *lpmmi;
RECT rc;
lpmmi = (MINMAXINFO FAR *)lParam;
-
- /* this message was sent before WM_NCCREATE */
if (!td) return 1;
- /* Minimum window size is 80x24 */
rc.left = rc.top = 0;
rc.right = rc.left + 80 * td->tile_wid + td->size_ow1 + td->size_ow2;
rc.bottom = rc.top + 24 * td->tile_hgt + td->size_oh1 + td->size_oh2 + 1;
- /* Adjust */
AdjustWindowRectEx(&rc, td->dwStyle, TRUE, td->dwExStyle);
- /* Save minimum size */
lpmmi->ptMinTrackSize.x = rc.right - rc.left;
lpmmi->ptMinTrackSize.y = rc.bottom - rc.top;
return 0;
}
-
case WM_PAINT:
{
BeginPaint(hWnd, &ps);
ValidateRect(hWnd, NULL);
return 0;
}
-
case MM_MCINOTIFY:
{
if (wParam == MCI_NOTIFY_SUCCESSFUL)
mciSendCommand(mop.wDeviceID, MCI_SEEK, MCI_SEEK_TO_START, 0);
mciSendCommand(mop.wDeviceID, MCI_PLAY, MCI_NOTIFY, (DWORD)&mop);
}
+
return 0;
}
-
case WM_SYSKEYDOWN:
case WM_KEYDOWN:
{
return 0;
break;
}
-
case WM_CHAR:
{
if (term_no_press) term_no_press = FALSE;
else Term_keypress(wParam);
return 0;
}
-
case WM_LBUTTONDOWN:
{
mousex = MIN(LOWORD(lParam) / td->tile_wid, td->cols - 1);
oldy = mousey;
return 0;
}
-
case WM_LBUTTONUP:
{
HGLOBAL hGlobal;
LPSTR lpStr;
- int j, sz;
TERM_LEN dx = abs(oldx - mousex) + 1;
TERM_LEN dy = abs(oldy - mousey) + 1;
TERM_LEN ox = (oldx > mousex) ? mousex : oldx;
paint_rect = FALSE;
#ifdef JP
- sz = (dx + 3) * dy;
+ int sz = (dx + 3) * dy;
#else
- sz = (dx + 2) * dy;
+ int sz = (dx + 2) * dy;
#endif
hGlobal = GlobalAlloc(GHND, sz + 1);
if (hGlobal == NULL) return 0;
lpStr = (LPSTR)GlobalLock(hGlobal);
- for (i = 0; i < dy; i++)
+ for (int i = 0; i < dy; i++)
{
#ifdef JP
char *s;
if (iskanji(scr[oy + i][ox + dx - 1])) s[dx - 1] = ' ';
}
- for (j = 0; j < dx; j++)
+ for (int j = 0; j < dx; j++)
{
if (s[j] == 127) s[j] = '#';
*lpStr++ = s[j];
return 0;
}
-
case WM_MOUSEMOVE:
{
if (mouse_down)
oldx = cx;
oldy = cy;
}
+
return 0;
}
-
case WM_INITMENU:
{
setup_menus();
return 0;
}
-
case WM_CLOSE:
{
if (game_in_progress && current_world_ptr->character_generated)
return 0;
}
- /* Hack -- Forget messages */
msg_flag = FALSE;
-
forget_lite(p_ptr->current_floor_ptr);
forget_view(p_ptr->current_floor_ptr);
clear_mon_lite(p_ptr->current_floor_ptr);
-
Term_key_push(SPECIAL_KEY_QUIT);
return 0;
}
+
quit(NULL);
return 0;
}
-
case WM_QUERYENDSESSION:
{
if (game_in_progress && current_world_ptr->character_generated)
{
- /* Hack -- Forget messages */
msg_flag = FALSE;
-
- /* Mega-Hack -- Delay death */
if (p_ptr->chp < 0) p_ptr->is_dead = FALSE;
exe_write_diary(p_ptr, DIARY_GAMESTART, 0, _("----ゲーム中断----", "---- Save and Exit Game ----"));
- /* Hardcode panic save */
p_ptr->panic_save = 1;
-
- /* Forbid suspend */
signals_ignore_tstp();
-
- /* Indicate panic save */
(void)strcpy(p_ptr->died_from, _("(緊急セーブ)", "(panic save)"));
-
- /* Panic save */
(void)save_player(p_ptr);
}
+
quit(NULL);
return 0;
}
-
case WM_QUIT:
{
quit(NULL);
return 0;
}
-
case WM_COMMAND:
{
process_menus(p_ptr, LOWORD(wParam));
return 0;
}
-
case WM_SIZE:
{
- /* this message was sent before WM_NCCREATE */
if (!td) return 1;
-
- /* it was sent from inside CreateWindowEx */
if (!td->w) return 1;
-
- /* was sent from WM_SIZE */
if (td->size_hack) return 1;
switch (wParam)
case SIZE_MINIMIZED:
{
/* Hide sub-windows */
- for (i = 1; i < MAX_TERM_DATA; i++)
+ for (int i = 1; i < MAX_TERM_DATA; i++)
{
if (data[i].visible) ShowWindow(data[i].w, SW_HIDE);
}
+
return 0;
}
-
case SIZE_MAXIMIZED:
{
/* fall through */
}
-
case SIZE_RESTORED:
{
TERM_LEN cols = (LOWORD(lParam) - td->size_ow1) / td->tile_wid;
TERM_LEN rows = (HIWORD(lParam) - td->size_oh1) / td->tile_hgt;
-
- /* New size */
if ((td->cols != cols) || (td->rows != rows))
{
- /* Save the new size */
td->cols = cols;
td->rows = rows;
-
if (!IsZoomed(td->w) && !IsIconic(td->w))
{
normsize.x = td->cols;
normsize.y = td->rows;
}
- /* Activate */
Term_activate(&td->t);
-
- /* Resize the term */
Term_resize(td->cols, td->rows);
-
- /* Redraw later */
InvalidateRect(td->w, NULL, TRUE);
}
td->size_hack = TRUE;
-
- /* Show sub-windows */
- for (i = 1; i < MAX_TERM_DATA; i++)
+ for (int i = 1; i < MAX_TERM_DATA; i++)
{
if (data[i].visible) ShowWindow(data[i].w, SW_SHOW);
}
return 0;
}
}
+
break;
}
-
case WM_PALETTECHANGED:
{
- /* Ignore if palette change caused by itself */
if ((HWND)wParam == hWnd) return 0;
-
- /* Fall through... */
}
-
case WM_QUERYNEWPALETTE:
{
if (!paletted) return 0;
hdc = GetDC(hWnd);
-
SelectPalette(hdc, hPal, FALSE);
-
- i = RealizePalette(hdc);
-
- /* if any palette entries changed, repaint the window. */
+ int i = RealizePalette(hdc);
if (i) InvalidateRect(hWnd, NULL, TRUE);
ReleaseDC(hWnd, hdc);
-
return 0;
}
-
case WM_ACTIVATE:
{
if (wParam && !HIWORD(lParam))
{
- /* Do something to sub-windows */
- for (i = 1; i < MAX_TERM_DATA; i++)
+ for (int i = 1; i < MAX_TERM_DATA; i++)
{
if (!data[i].posfix) term_window_pos(&data[i], hWnd);
}
- /* Focus on main window */
SetFocus(hWnd);
-
return 0;
}
break;
}
-
case WM_ACTIVATEAPP:
{
if (IsIconic(td->w)) break;
- for (i = 1; i < MAX_TERM_DATA; i++)
+ for (int i = 1; i < MAX_TERM_DATA; i++)
{
if (data[i].visible)
{
term_data *td;
PAINTSTRUCT ps;
HDC hdc;
- int i;
-
-
- /* Acquire proper "term_data" info */
td = (term_data *)GetWindowLong(hWnd, 0);
- /* Process message */
switch (uMsg)
{
case WM_NCCREATE:
SetWindowLong(hWnd, 0, (LONG)(my_td));
break;
}
-
case WM_CREATE:
{
return 0;
}
-
case WM_GETMINMAXINFO:
{
MINMAXINFO FAR *lpmmi;
RECT rc;
lpmmi = (MINMAXINFO FAR *)lParam;
-
- /* this message was sent before WM_NCCREATE */
if (!td) return 1;
- /* Minimum window size is 80x24 */
rc.left = rc.top = 0;
rc.right = rc.left + 20 * td->tile_wid + td->size_ow1 + td->size_ow2;
rc.bottom = rc.top + 3 * td->tile_hgt + td->size_oh1 + td->size_oh2 + 1;
- /* Adjust */
AdjustWindowRectEx(&rc, td->dwStyle, TRUE, td->dwExStyle);
-
- /* Save minimum size */
lpmmi->ptMinTrackSize.x = rc.right - rc.left;
lpmmi->ptMinTrackSize.y = rc.bottom - rc.top;
return 0;
}
-
case WM_SIZE:
{
- TERM_LEN cols;
- TERM_LEN rows;
-
- /* this message was sent before WM_NCCREATE */
if (!td) return 1;
-
- /* it was sent from inside CreateWindowEx */
if (!td->w) return 1;
-
- /* was sent from inside WM_SIZE */
if (td->size_hack) return 1;
td->size_hack = TRUE;
- cols = (LOWORD(lParam) - td->size_ow1) / td->tile_wid;
- rows = (HIWORD(lParam) - td->size_oh1) / td->tile_hgt;
-
- /* New size */
+ TERM_LEN cols = (LOWORD(lParam) - td->size_ow1) / td->tile_wid;
+ TERM_LEN rows = (HIWORD(lParam) - td->size_oh1) / td->tile_hgt;
if ((td->cols != cols) || (td->rows != rows))
{
- /* Save old term */
term *old_term = Term;
-
- /* Save the new size */
td->cols = cols;
td->rows = rows;
-
- /* Activate */
Term_activate(&td->t);
-
- /* Resize the term */
Term_resize(td->cols, td->rows);
-
- /* Activate */
Term_activate(old_term);
-
- /* Redraw later */
InvalidateRect(td->w, NULL, TRUE);
-
- /* HACK - Redraw all windows */
p_ptr->window = 0xFFFFFFFF;
handle_stuff(p_ptr);
}
return 0;
}
-
case WM_PAINT:
{
BeginPaint(hWnd, &ps);
EndPaint(hWnd, &ps);
return 0;
}
-
case WM_SYSKEYDOWN:
case WM_KEYDOWN:
{
return 0;
break;
}
-
case WM_CHAR:
{
if (term_no_press) term_no_press = FALSE;
else Term_keypress(wParam);
return 0;
}
-
case WM_PALETTECHANGED:
{
- /* ignore if palette change caused by itself */
if ((HWND)wParam == hWnd) return FALSE;
- /* otherwise, fall through!!! */
}
-
case WM_QUERYNEWPALETTE:
{
if (!paletted) return 0;
hdc = GetDC(hWnd);
SelectPalette(hdc, hPal, FALSE);
- i = RealizePalette(hdc);
- /* if any palette entries changed, repaint the window. */
+ int i = RealizePalette(hdc);
if (i) InvalidateRect(hWnd, NULL, TRUE);
ReleaseDC(hWnd, hdc);
return 0;
}
-
case WM_NCLBUTTONDOWN:
{
-
#ifdef HTCLOSE
if (wParam == HTCLOSE) wParam = HTSYSMENU;
#endif /* HTCLOSE */
}
-#ifdef USE_SAVER
-
#define MOUSE_SENS 40
#ifdef __MWERKS__
static WORD xMouse = 0;
static WORD yMouse = 0;
- int dx, dy;
-
-
- /* Process */
switch (uMsg)
{
case WM_NCCREATE:
SendMessage(hWnd, WM_CLOSE, 0, 0);
return 0;
}
-
case WM_MOUSEMOVE:
{
if (iMouse)
{
- dx = LOWORD(lParam) - xMouse;
- dy = HIWORD(lParam) - yMouse;
+ int dx = LOWORD(lParam) - xMouse;
+ int dy = HIWORD(lParam) - yMouse;
if (dx < 0) dx = -dx;
if (dy < 0) dy = -dy;
}
}
- /* Save last location */
iMouse = 1;
xMouse = LOWORD(lParam);
yMouse = HIWORD(lParam);
return 0;
}
-
case WM_CLOSE:
{
DestroyWindow(hwndSaver);
return DefWindowProc(hWnd, uMsg, wParam, lParam);
}
-#endif /* USE_SAVER */
-
-
-
-
-
-/*** Temporary Hooks ***/
-
/*
* Display warning message (see "z-util.c")
*/
static void hack_plog(concptr str)
{
- /* Give a warning */
if (str)
{
#ifdef JP
*/
static void hack_quit(concptr str)
{
- /* Give a warning */
if (str)
{
#ifdef JP
}
- /* Unregister the classes */
UnregisterClass(AppName, hInstance);
-
- /* Destroy the icon */
if (hIcon) DestroyIcon(hIcon);
exit(0);
}
-
-/*** Various hooks ***/
-
-
/*
* Display warning message (see "z-util.c")
*/
static void hook_plog(concptr str)
{
- /* Warning */
if (str)
{
#ifdef JP
*/
static void hook_quit(concptr str)
{
- int i;
-
-
- /* Give a warning */
if (str)
{
#ifdef JP
MessageBox(data[0].w, str, "Error",
MB_ICONEXCLAMATION | MB_OK | MB_ICONSTOP);
#endif
-
}
-
- /* Save the preferences */
save_prefs();
-
- /* Destroy all windows */
- for (i = MAX_TERM_DATA - 1; i >= 0; --i)
+ for (int i = MAX_TERM_DATA - 1; i >= 0; --i)
{
term_force_font(&data[i], NULL);
if (data[i].font_want) string_free(data[i].font_want);
data[i].w = 0;
}
- /* Free the bitmap stuff */
if (infGraph.hPalette) DeleteObject(infGraph.hPalette);
if (infGraph.hBitmap) DeleteObject(infGraph.hBitmap);
-
if (infMask.hPalette) DeleteObject(infMask.hPalette);
if (infMask.hBitmap) DeleteObject(infMask.hBitmap);
- /*** Free some other stuff ***/
-
DeleteObject(hbrYellow);
-
- /* bg */
delete_bg();
if (hPal) DeleteObject(hPal);
UnregisterClass(AppName, hInstance);
-
if (hIcon) DestroyIcon(hIcon);
exit(0);
}
-
-/*** Initialize ***/
-
-
/*
* Init some stuff
*/
static void init_stuff(void)
{
- int i;
-
char path[1024];
-
-
- /* Get program name with full path */
GetModuleFileName(hInstance, path, 512);
-
- /* Save the "program name" */
argv0 = path;
-
- /* Get the name of the "*.ini" file */
strcpy(path + strlen(path) - 4, ".INI");
-
- /* Save the the name of the ini-file */
ini_file = string_make(path);
+ int i = strlen(path);
- /* Analyze the path */
- i = strlen(path);
-
- /* Get the path */
for (; i > 0; i--)
{
if (path[i] == '\\')
{
- /* End of path */
break;
}
}
- /* Add "lib" to the path */
strcpy(path + i + 1, "lib\\");
-
- /* Validate the path */
validate_dir(path, TRUE);
-
- /* Init the file paths */
init_file_paths(path);
-
- /* Hack -- Validate the paths */
validate_dir(ANGBAND_DIR_APEX, FALSE);
validate_dir(ANGBAND_DIR_BONE, FALSE);
-
- /* Allow missing 'edit' directory */
if (!check_dir(ANGBAND_DIR_EDIT))
{
- /* Must have 'data'! */
validate_dir(ANGBAND_DIR_DATA, TRUE);
}
else
{
- /* Don't need 'data' */
validate_dir(ANGBAND_DIR_DATA, FALSE);
}
validate_dir(ANGBAND_DIR_XTRA, TRUE);
path_build(path, sizeof(path), ANGBAND_DIR_FILE, _("news_j.txt", "news.txt"));
- /* Hack -- Validate the "news.txt" file */
validate_file(path);
-
- /* Build the "graf" path */
path_build(path, sizeof(path), ANGBAND_DIR_XTRA, "graf");
-
- /* Allocate the path */
ANGBAND_DIR_XTRA_GRAF = string_make(path);
-
- /* Validate the "graf" directory */
validate_dir(ANGBAND_DIR_XTRA_GRAF, TRUE);
- /* Build the "sound" path */
path_build(path, sizeof(path), ANGBAND_DIR_XTRA, "sound");
-
- /* Allocate the path */
ANGBAND_DIR_XTRA_SOUND = string_make(path);
-
- /* Validate the "sound" directory */
validate_dir(ANGBAND_DIR_XTRA_SOUND, FALSE);
- /* Build the "music" path */
path_build(path, sizeof(path), ANGBAND_DIR_XTRA, "music");
-
- /* Allocate the path */
ANGBAND_DIR_XTRA_MUSIC = string_make(path);
-
- /* Validate the "music" directory */
validate_dir(ANGBAND_DIR_XTRA_MUSIC, FALSE);
- /* Build the "help" path */
path_build(path, sizeof(path), ANGBAND_DIR_XTRA, "help");
-
- /* Allocate the path */
ANGBAND_DIR_XTRA_HELP = string_make(path);
-
- /* Validate the "help" directory */
- /* validate_dir(ANGBAND_DIR_XTRA_HELP); */
}
/*!
+ * todo よく見るとhMutexはちゃんと使われていない……?
* @brief (Windows固有)変愚蛮怒が起動済かどうかのチェック
*/
static bool is_already_running(void)
{
- bool result = FALSE;
HANDLE hMutex;
-
hMutex = CreateMutex(NULL, TRUE, VERSION_NAME);
if (GetLastError() == ERROR_ALREADY_EXISTS)
{
- result = TRUE;
+ return TRUE;
}
- return result;
+
+ return FALSE;
}
int FAR PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrevInst,
LPSTR lpCmdLine, int nCmdShow)
{
- int i;
-
WNDCLASS wc;
HDC hdc;
MSG msg;
setlocale(LC_ALL, "ja_JP.utf8");
-
- /* Unused */
(void)nCmdShow;
-
- /* Save globally */
hInstance = hInst;
-
-
- /* Prevent multiple run */
if (is_already_running())
{
MessageBox(NULL,
wc.style = CS_CLASSDC;
wc.lpfnWndProc = AngbandWndProc;
wc.cbClsExtra = 0;
- wc.cbWndExtra = 4; /* one long pointer to term_data */
+ wc.cbWndExtra = 4;
wc.hInstance = hInst;
wc.hIcon = hIcon = LoadIcon(hInst, AppName);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
if (!RegisterClass(&wc)) exit(2);
-#ifdef USE_SAVER
-
wc.style = CS_VREDRAW | CS_HREDRAW | CS_SAVEBITS | CS_DBLCLKS;
wc.lpfnWndProc = AngbandSaverProc;
wc.hCursor = NULL;
wc.lpszClassName = "WindowsScreenSaverClass";
if (!RegisterClass(&wc)) exit(3);
-
-#endif
-
}
- /* Temporary hooks */
plog_aux = hack_plog;
quit_aux = hack_quit;
core_aux = hack_quit;
- /* Prepare the filepaths */
init_stuff();
-
- /* Initialize the keypress analyzer */
- for (i = 0; special_key_list[i]; ++i)
+ for (int i = 0; special_key_list[i]; ++i)
{
special_key[special_key_list[i]] = TRUE;
}
- /* Initialize the keypress analyzer */
- for (i = 0; ignore_key_list[i]; ++i)
+
+ for (int i = 0; ignore_key_list[i]; ++i)
{
ignore_key[ignore_key_list[i]] = TRUE;
}
- /* Determine if display is 16/256/true color */
hdc = GetDC(NULL);
colors16 = (GetDeviceCaps(hdc, BITSPIXEL) == 4);
paletted = ((GetDeviceCaps(hdc, RASTERCAPS) & RC_PALETTE) ? TRUE : FALSE);
ReleaseDC(NULL, hdc);
- /* Initialize the colors */
- for (i = 0; i < 256; i++)
+ for (int i = 0; i < 256; i++)
{
- byte rv, gv, bv;
-
- /* Extract desired values */
- rv = angband_color_table[i][1];
- gv = angband_color_table[i][2];
- bv = angband_color_table[i][3];
-
- /* Extract the "complex" code */
+ byte rv = angband_color_table[i][1];
+ byte gv = angband_color_table[i][2];
+ byte bv = angband_color_table[i][3];
win_clr[i] = PALETTERGB(rv, gv, bv);
-
- /* Save the "simple" code */
angband_color_table[i][0] = win_pal[i];
}
- /* Prepare the windows */
init_windows();
-
- /* bg */
init_bg();
- /* Activate hooks */
plog_aux = hook_plog;
quit_aux = hook_quit;
core_aux = hook_quit;
- /* Set the system suffix */
ANGBAND_SYS = "win";
-
- /* Set the keyboard suffix */
if (7 != GetKeyboardType(0))
ANGBAND_KEYBOARD = "0";
else
{
- /* Japanese keyboard */
+ /* todo PC-98のサポートは打ち切ったので削除したい */
switch (GetKeyboardType(1))
{
case 0x0D01: case 0x0D02:
}
}
- /* Catch nasty signals */
signals_init();
-
Term_activate(term_screen);
init_angband(p_ptr);
-
- /* We are now initialized */
initialized = TRUE;
#ifdef CHUUKEI
if (lpCmdLine[0] == '-') {
#endif
#ifdef CHUUKEI
- /* Did the user double click on a save file? */
if (!chuukei_server) check_for_save_file(lpCmdLine);
#else
- /* Did the user double click on a save file? */
check_for_save_file(p_ptr, lpCmdLine);
#endif
- /* Prompt the user */
prt(_("[ファイル] メニューの [新規] または [開く] を選択してください。", "[Choose 'New' or 'Open' from the 'File' menu]"), 23, _(8, 17));
-
Term_fresh();
-
- /* Process messages forever */
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
+
quit(NULL);
return 0;
}
-
-
#endif /* WINDOWS */
POSITION y = m_ptr->fy;
POSITION x = m_ptr->fx;
- /* Hack -- Reduce the racial counter */
real_r_ptr(m_ptr)->cur_num--;
-
- /* Hack -- count the number of "reproducers" */
if (r_ptr->flags2 & (RF2_MULTIPLY)) floor_ptr->num_repro--;
if (MON_CSLEEP(m_ptr)) (void)set_monster_csleep(player_ptr, i, 0);
if (MON_MONFEAR(m_ptr)) (void)set_monster_monfear(player_ptr, i, 0);
if (MON_INVULNER(m_ptr)) (void)set_monster_invulner(player_ptr, i, 0, FALSE);
- /* Hack -- remove target monster */
if (i == target_who) target_who = 0;
- /* Hack -- remove tracked monster */
if (i == player_ptr->health_who) health_track(player_ptr, 0);
if (player_ptr->pet_t_m_idx == i) player_ptr->pet_t_m_idx = 0;
if (player_ptr->riding_t_m_idx == i) player_ptr->riding_t_m_idx = 0;
if (player_ptr->riding == i) player_ptr->riding = 0;
- /* Monster is gone */
floor_ptr->grid_array[y][x].m_idx = 0;
-
OBJECT_IDX next_o_idx = 0;
for (OBJECT_IDX this_o_idx = m_ptr->hold_o_idx; this_o_idx; this_o_idx = next_o_idx)
{
{
if (i1 == i2) return;
- /* Old monster */
floor_type *floor_ptr = player_ptr->current_floor_ptr;
monster_type *m_ptr;
m_ptr = &floor_ptr->m_list[i1];
POSITION y = m_ptr->fy;
POSITION x = m_ptr->fx;
-
- /* Cave grid */
grid_type *g_ptr;
g_ptr = &floor_ptr->grid_array[y][x];
-
g_ptr->m_idx = i2;
- /* Repair objects being carried by monster */
OBJECT_IDX next_o_idx = 0;
for (OBJECT_IDX this_o_idx = m_ptr->hold_o_idx; this_o_idx; this_o_idx = next_o_idx)
{
object_type *o_ptr;
o_ptr = &floor_ptr->o_list[this_o_idx];
next_o_idx = o_ptr->next_o_idx;
-
- /* Reset monster pointer */
o_ptr->held_m_idx = i2;
}
- /* Hack -- Update the target */
if (target_who == i1) target_who = i2;
- /* Hack -- Update the target */
if (player_ptr->pet_t_m_idx == i1) player_ptr->pet_t_m_idx = i2;
if (player_ptr->riding_t_m_idx == i1) player_ptr->riding_t_m_idx = i2;
- /* Hack -- Update the riding */
if (player_ptr->riding == i1) player_ptr->riding = i2;
- /* Hack -- Update the health bar */
if (player_ptr->health_who == i1) health_track(player_ptr, i2);
- /* Hack -- Update parent index */
if (is_pet(m_ptr))
{
for (int i = 1; i < floor_ptr->m_max; i++)
}
}
- /* Structure copy */
(void)COPY(&floor_ptr->m_list[i2], &floor_ptr->m_list[i1], monster_type);
-
- /* Wipe the hole */
(void)WIPE(&floor_ptr->m_list[i1], monster_type);
for (int i = 0; i < MAX_MTIMED; i++)
floor_type *floor_ptr = player_ptr->current_floor_ptr;
for (int num = 0, cnt = 1; num < size; cnt++)
{
- /* Get more vicious each iteration */
int cur_lev = 5 * cnt;
-
- /* Get closer each iteration */
int cur_dis = 5 * (20 - cnt);
-
- /* Check all the monsters */
for (MONSTER_IDX i = 1; i < floor_ptr->m_max; i++)
{
monster_type *m_ptr = &floor_ptr->m_list[i];
-
monster_race *r_ptr = &r_info[m_ptr->r_idx];
-
- /* Paranoia -- skip "dead" monsters */
if (!monster_is_valid(m_ptr)) continue;
-
- /* Hack -- High level monsters start out "immune" */
if (r_ptr->level > cur_lev) continue;
-
if (i == player_ptr->riding) continue;
-
- /* Ignore nearby monsters */
if ((cur_dis > 0) && (m_ptr->cdis < cur_dis)) continue;
- /* Saving throw chance */
int chance = 90;
-
- /* Only compact "Quest" Monsters in emergencies */
if ((r_ptr->flags1 & (RF1_QUESTOR)) && (cnt < 1000)) chance = 100;
- /* Try not to compact Unique Monsters */
if (r_ptr->flags1 & (RF1_UNIQUE)) chance = 100;
- /* All monsters get a saving throw */
if (randint0(100) < chance) continue;
if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
*/
void wipe_monsters_list(player_type *player_ptr)
{
- /* Hack -- if Banor or Lupart dies, stay another dead */
if (!r_info[MON_BANORLUPART].max_num)
{
if (r_info[MON_BANOR].max_num)
}
}
- /* Delete all the monsters */
floor_type *floor_ptr = player_ptr->current_floor_ptr;
for (int i = floor_ptr->m_max - 1; i >= 1; i--)
{
monster_type *m_ptr = &floor_ptr->m_list[i];
if (!monster_is_valid(m_ptr)) continue;
- /* Monster is gone */
floor_ptr->grid_array[m_ptr->fy][m_ptr->fx].m_idx = 0;
-
(void)WIPE(m_ptr, monster_type);
-
}
/*
* counters of monsters in party_mon[] are required to prevent multiple
* generation of unique monster who is the minion of player.
*/
-
- /* Hack -- Wipe the racial counter of all monster races */
for (int i = 1; i < max_r_idx; i++) r_info[i].cur_num = 0;
- /* Reset "floor_ptr->m_max" */
floor_ptr->m_max = 1;
-
- /* Reset "floor_ptr->m_cnt" */
floor_ptr->m_cnt = 0;
-
- /* Reset "floor_ptr->mproc_max[]" */
for (int i = 0; i < MAX_MTIMED; i++) floor_ptr->mproc_max[i] = 0;
floor_ptr->num_repro = 0;
return i;
}
- /* Warn the player (except during dungeon creation) */
if (current_world_ptr->character_dungeon) msg_print(_("モンスターが多すぎる!", "Too many monsters!"));
return 0;
}
monster_race *r_ptr = &r_info[r_idx];
bool is_match = FALSE;
- /* Check our requirements */
switch (summon_specific_type)
{
case SUMMON_ANT:
is_match = (r_ptr->d_char == 'a');
break;
}
-
case SUMMON_SPIDER:
{
is_match = (r_ptr->d_char == 'S');
break;
}
-
case SUMMON_HOUND:
{
is_match = ((r_ptr->d_char == 'C') || (r_ptr->d_char == 'Z'));
break;
}
-
case SUMMON_HYDRA:
{
is_match = (r_ptr->d_char == 'M');
break;
}
-
case SUMMON_ANGEL:
{
is_match = (r_ptr->d_char == 'A' && ((r_ptr->flags3 & RF3_EVIL) || (r_ptr->flags3 & RF3_GOOD)));
break;
}
-
case SUMMON_DEMON:
{
is_match = (r_ptr->flags3 & RF3_DEMON);
break;
}
-
case SUMMON_UNDEAD:
{
is_match = (r_ptr->flags3 & RF3_UNDEAD);
break;
}
-
case SUMMON_DRAGON:
{
is_match = (r_ptr->flags3 & RF3_DRAGON);
break;
}
-
case SUMMON_HI_UNDEAD:
{
is_match = ((r_ptr->d_char == 'L') ||
(r_ptr->d_char == 'W'));
break;
}
-
case SUMMON_HI_DRAGON:
{
is_match = (r_ptr->d_char == 'D');
break;
}
-
case SUMMON_HI_DEMON:
{
is_match = (((r_ptr->d_char == 'U') ||
(r_ptr->flags3 & RF3_DEMON)) ? TRUE : FALSE;
break;
}
-
case SUMMON_AMBERITES:
{
is_match = (r_ptr->flags3 & (RF3_AMBERITE)) ? TRUE : FALSE;
break;
}
-
case SUMMON_UNIQUE:
{
is_match = (r_ptr->flags1 & (RF1_UNIQUE)) ? TRUE : FALSE;
break;
}
-
case SUMMON_MOLD:
{
is_match = (r_ptr->d_char == 'm');
is_match = (r_ptr->d_char == 'Q');
break;
}
-
case SUMMON_COIN_MIMIC:
{
is_match = (r_ptr->d_char == '$');
break;
}
-
case SUMMON_MIMIC:
{
is_match = ((r_ptr->d_char == '!') ||
(r_ptr->d_char == '|'));
break;
}
-
case SUMMON_GOLEM:
{
is_match = (r_ptr->d_char == 'g');
break;
}
-
case SUMMON_CYBER:
{
is_match = ((r_ptr->d_char == 'U') &&
(r_ptr->flags4 & RF4_ROCKET));
break;
}
-
case SUMMON_KIN:
{
SYMBOL_CODE summon_kin_type;
is_match = ((r_ptr->d_char == summon_kin_type) && (r_idx != MON_HAGURE));
break;
}
-
case SUMMON_DAWN:
{
is_match = (r_idx == MON_DAWN);
break;
}
-
case SUMMON_ANIMAL:
{
is_match = (r_ptr->flags3 & (RF3_ANIMAL));
break;
}
-
case SUMMON_ANIMAL_RANGER:
{
is_match = ((r_ptr->flags3 & (RF3_ANIMAL)) &&
!(r_ptr->flags4 || r_ptr->a_ability_flags1 || r_ptr->a_ability_flags2));
break;
}
-
case SUMMON_HI_DRAGON_LIVING:
{
is_match = ((r_ptr->d_char == 'D') && monster_living(r_idx));
break;
}
-
case SUMMON_LIVING:
{
is_match = monster_living(r_idx);
break;
}
-
case SUMMON_PHANTOM:
{
is_match = (r_idx == MON_PHANTOM_B || r_idx == MON_PHANTOM_W);
break;
}
-
case SUMMON_BLUE_HORROR:
{
is_match = (r_idx == MON_BLUE_HORROR);
break;
}
-
case SUMMON_ELEMENTAL:
{
is_match = (r_ptr->d_char == 'E');
break;
}
-
case SUMMON_VORTEX:
{
is_match = (r_ptr->d_char == 'v');
break;
}
-
case SUMMON_HYBRID:
{
is_match = (r_ptr->d_char == 'H');
break;
}
-
case SUMMON_BIRD:
{
is_match = (r_ptr->d_char == 'B');
break;
}
-
case SUMMON_KAMIKAZE:
{
int i;
if (r_ptr->blow[i].method == RBM_EXPLODE) is_match = TRUE;
break;
}
-
case SUMMON_KAMIKAZE_LIVING:
{
int i;
is_match = (is_match && monster_living(r_idx));
break;
}
-
case SUMMON_MANES:
{
is_match = (r_idx == MON_MANES);
break;
}
-
case SUMMON_LOUSE:
{
is_match = (r_idx == MON_LOUSE);
break;
}
-
case SUMMON_GUARDIANS:
{
is_match = (r_ptr->flags7 & RF7_GUARDIAN);
break;
}
-
case SUMMON_KNIGHTS:
{
is_match = ((r_idx == MON_NOV_PALADIN) ||
(r_idx == MON_KNI_TEMPLAR));
break;
}
-
case SUMMON_EAGLES:
{
is_match = (r_ptr->d_char == 'B' &&
(r_ptr->flags8 & RF8_WILD_ONLY));
break;
}
-
case SUMMON_PIRANHAS:
{
is_match = (r_idx == MON_PIRANHA);
break;
}
-
case SUMMON_ARMAGE_GOOD:
{
is_match = (r_ptr->d_char == 'A' && (r_ptr->flags3 & RF3_GOOD));
break;
}
-
case SUMMON_ARMAGE_EVIL:
{
is_match = ((r_ptr->flags3 & RF3_DEMON) ||
return is_match;
}
+
/*!
* @var chameleon_change_m_idx
* @brief カメレオンの変身先モンスターIDを受け渡すためのグローバル変数
return TRUE;
}
-
case DUNGEON_MODE_NAND:
{
if (d_ptr->mflags1)
return FALSE;
}
-
case DUNGEON_MODE_OR:
{
if (r_ptr->flags1 & d_ptr->mflags1) return TRUE;
return FALSE;
}
-
case DUNGEON_MODE_NOR:
{
if (r_ptr->flags1 & d_ptr->mflags1) return FALSE;
errr get_mon_num_prep(player_type *player_ptr, monsterrace_hook_type monster_hook, monsterrace_hook_type monster_hook2)
{
/* Todo: Check the hooks for non-changes */
-
- /* Set the new hooks */
get_mon_num_hook = monster_hook;
get_mon_num2_hook = monster_hook2;
- /* Scan the allocation table */
floor_type *floor_ptr = player_ptr->current_floor_ptr;
for (int i = 0; i < alloc_race_size; i++)
{
monster_race *r_ptr;
-
- /* Get the entry */
alloc_entry *entry = &alloc_race_table[i];
-
entry->prob2 = 0;
r_ptr = &r_info[entry->index];
- /* Skip monsters which don't pass the restriction */
if ((get_mon_num_hook && !((*get_mon_num_hook)(entry->index))) ||
(get_mon_num2_hook && !((*get_mon_num2_hook)(entry->index))))
continue;
if (!player_ptr->phase_out && !chameleon_change_m_idx &&
summon_specific_type != SUMMON_GUARDIANS)
{
- /* Hack -- don't create questors */
if (r_ptr->flags1 & RF1_QUESTOR)
continue;
if (r_ptr->flags7 & RF7_GUARDIAN)
continue;
- /* Depth Monsters never appear out of depth */
if ((r_ptr->flags1 & (RF1_FORCE_DEPTH)) &&
(r_ptr->level > floor_ptr->dun_level))
continue;
}
- /* Accept this monster */
entry->prob2 = entry->prob1;
-
if (floor_ptr->dun_level && (!floor_ptr->inside_quest || is_fixed_quest_idx(floor_ptr->inside_quest)) &&
!restrict_monster_to_dungeon(player_ptr, entry->index) && !player_ptr->phase_out)
{
MONRACE_IDX get_mon_num(player_type *player_ptr, DEPTH level)
{
int delay = mysqrt(level * 10000L) + 400L;
-
int reinforcement_possibility = MAX(NASTY_MON_MAX, NASTY_MON_BASE - ((current_world_ptr->dungeon_turn / (TURNS_PER_TICK * 5000L) - delay / 10)));
int reinforcement_level = MIN(NASTY_MON_PLUS_MAX, 3 + current_world_ptr->dungeon_turn / (TURNS_PER_TICK * 40000L) - delay / 40 + MIN(5, level / 10));
level += 3;
}
- /* Boost the level */
if (!player_ptr->phase_out && !(d_info[player_ptr->dungeon_idx].flags1 & DF1_BEGINNER))
{
if (ironman_nightmare && !randint0(reinforcement_possibility))
alloc_entry *table = alloc_race_table;
for (int i = 0; i < alloc_race_size; i++)
{
- /* Monsters are sorted by depth */
if (table[i].level > level) break;
-
- /* Default */
table[i].prob3 = 0;
-
- /* Access the "r_idx" of the chosen monster */
MONRACE_IDX r_idx = table[i].index;
-
- /* Access the actual race */
monster_race *r_ptr;
r_ptr = &r_info[r_idx];
-
if (!player_ptr->phase_out && !chameleon_change_m_idx)
{
- /* Hack -- "unique" monsters must be "unique" */
if (((r_ptr->flags1 & (RF1_UNIQUE)) ||
(r_ptr->flags7 & (RF7_NAZGUL))) &&
(r_ptr->cur_num >= r_ptr->max_num))
}
}
- /* Accept */
table[i].prob3 = table[i].prob2;
-
- /* Total */
total += table[i].prob3;
}
- /* No legal monsters */
if (total <= 0) return 0;
- /* Pick a monster */
long value = randint0(total);
-
int found_count = 0;
for (int i = 0; i < alloc_race_size; i++)
{
found_count++;
}
- /* Power boost */
int p = randint0(100);
/* Try for a "harder" monster once (50%) or twice (10%) */
if (p < 60)
{
- /* Save old */
int j = found_count;
-
- /* Pick a monster */
value = randint0(total);
-
- /* Find the monster */
for (found_count = 0; found_count < alloc_race_size; found_count++)
{
- /* Found the entry */
if (value < table[found_count].prob3) break;
- /* Decrement */
value = value - table[found_count].prob3;
}
- /* Keep the "best" one */
if (table[found_count].level < table[j].level)
found_count = j;
}
/* Try for a "harder" monster twice (10%) */
if (p < 10)
{
- /* Save old */
int j = found_count;
-
- /* Pick a monster */
value = randint0(total);
-
- /* Find the monster */
for (found_count = 0; found_count < alloc_race_size; found_count++)
{
- /* Found the entry */
if (value < table[found_count].prob3) break;
- /* Decrement */
value = value - table[found_count].prob3;
}
- /* Keep the "best" one */
if (table[found_count].level < table[j].level)
found_count = j;
}
{
monster_race *r_ptr;
r_ptr = &r_info[m_ptr->ap_r_idx];
-
- /* Mode of MD_TRUE_NAME will reveal Chameleon's true name */
concptr name = (mode & MD_TRUE_NAME) ? (r_name + real_r_ptr(m_ptr)->name) : (r_name + r_ptr->name);
-
- /* Are we hallucinating? (Idea from Nethack...) */
GAME_TEXT silly_name[1024];
bool named = FALSE;
if (player_ptr->image && !(mode & MD_IGNORE_HALLU))
strcpy(silly_name, (r_name + hallu_race->name));
}
- /* Better not strcpy it, or we could corrupt r_info... */
name = silly_name;
}
- /* Can we "see" it (exists + forced, or visible + not unforced) */
bool seen = (m_ptr && ((mode & MD_ASSUME_VISIBLE) || (!(mode & MD_ASSUME_HIDDEN) && m_ptr->ml)));
-
- /* Sexed Pronouns (seen and allowed, or unseen and allowed) */
bool pron = (m_ptr && ((seen && (mode & MD_PRON_VISIBLE)) || (!seen && (mode & MD_PRON_HIDDEN))));
/* First, try using pronouns, or describing hidden monsters */
floor_type *floor_ptr = player_ptr->current_floor_ptr;
if (!seen || pron)
{
- /* an encoding of the monster "sex" */
int kind = 0x00;
-
- /* Extract the gender (if applicable) */
if (r_ptr->flags1 & (RF1_FEMALE)) kind = 0x20;
else if (r_ptr->flags1 & (RF1_MALE)) kind = 0x10;
- /* Ignore the gender (if desired) */
if (!m_ptr || !pron) kind = 0x00;
-
- /* Assume simple result */
concptr res = _("何か", "it");
-
- /* Brute force: split on the possibilities */
switch (kind + (mode & (MD_INDEF_HIDDEN | MD_POSSESSIVE | MD_OBJECTIVE)))
{
#ifdef JP
case 0x00 + (MD_INDEF_HIDDEN | MD_POSSESSIVE | MD_OBJECTIVE) : res = "itself"; break;
#endif
-
#ifdef JP
case 0x10: res = "彼"; break;
case 0x10 + (MD_OBJECTIVE) : res = "彼"; break;
case 0x10 + (MD_INDEF_HIDDEN | MD_POSSESSIVE | MD_OBJECTIVE) : res = "himself"; break;
#endif
-
#ifdef JP
case 0x20: res = "彼女"; break;
case 0x20 + (MD_OBJECTIVE) : res = "彼女"; break;
#endif
}
- /* Copy the result */
(void)strcpy(desc, res);
return;
}
}
else
{
- /* It could be a Unique */
if ((r_ptr->flags1 & RF1_UNIQUE) && !(player_ptr->image && !(mode & MD_IGNORE_HALLU)))
{
- /* Start with the name (thus nominative and objective) */
if ((m_ptr->mflag2 & MFLAG2_CHAMELEON) && !(mode & MD_TRUE_NAME))
{
#ifdef JP
(void)sprintf(desc, "%s?", name);
#endif
}
-
- /* Inside monster arena, and it is not your mount */
else if (player_ptr->phase_out &&
!(player_ptr->riding && (&floor_ptr->m_list[player_ptr->riding] == m_ptr)))
{
- /* It is a fake unique monster */
(void)sprintf(desc, _("%sもどき", "fake %s"), name);
}
-
else
{
(void)strcpy(desc, name);
}
}
-
- /* It could be an indefinite monster */
else if (mode & MD_INDEF_VISIBLE)
{
- /* XXX Check plurality for "some" */
-
- /* Indefinite monsters need an indefinite article */
#ifdef JP
(void)strcpy(desc, "");
#else
(void)strcpy(desc, is_a_vowel(name[0]) ? "an " : "a ");
#endif
-
(void)strcat(desc, name);
}
-
- /* It could be a normal, definite, monster */
else
{
- /* Definite monsters need a definite article */
if (is_pet(m_ptr))
(void)strcpy(desc, _("あなたの", "your "));
else
/* Handle the Possessive as a special afterthought */
if (mode & MD_POSSESSIVE)
{
- /* XXX Check for trailing "s" */
-
- /* Simply append "apostrophe" and "s" */
(void)strcat(desc, _("の", "'s"));
}
}
*/
int lore_do_probe(player_type *player_ptr, MONRACE_IDX r_idx)
{
- /* Maximal info about awareness */
int n = 0;
monster_race *r_ptr = &r_info[r_idx];
if (r_ptr->r_wake != MAX_UCHAR) n++;
if (r_ptr->r_ignore != MAX_UCHAR) n++;
r_ptr->r_wake = r_ptr->r_ignore = MAX_UCHAR;
- /* Observe "maximal" attacks */
for (int i = 0; i < 4; i++)
{
- /* Examine "actual" blows */
if (r_ptr->blow[i].effect || r_ptr->blow[i].method)
{
- /* Maximal observations */
if (r_ptr->r_blows[i] != MAX_UCHAR) n++;
r_ptr->r_blows[i] = MAX_UCHAR;
}
}
- /* Maximal drops */
byte tmp_byte =
(((r_ptr->flags1 & RF1_DROP_4D2) ? 8 : 0) +
((r_ptr->flags1 & RF1_DROP_3D2) ? 6 : 0) +
((r_ptr->flags1 & RF1_DROP_90) ? 1 : 0) +
((r_ptr->flags1 & RF1_DROP_60) ? 1 : 0));
- /* Only "valid" drops */
if (!(r_ptr->flags1 & RF1_ONLY_GOLD))
{
if (r_ptr->r_drop_item != tmp_byte) n++;
r_ptr->r_drop_gold = tmp_byte;
}
- /* Observe many spells */
if (r_ptr->r_cast_spell != MAX_UCHAR) n++;
r_ptr->r_cast_spell = MAX_UCHAR;
- /* Count unknown flags */
for (int i = 0; i < 32; i++)
{
if (!(r_ptr->r_flags1 & (1L << i)) &&
(r_ptr->flagsr & (1L << i))) n++;
}
- /* Know all the flags */
r_ptr->r_flags1 = r_ptr->flags1;
r_ptr->r_flags2 = r_ptr->flags2;
r_ptr->r_flags3 = r_ptr->flags3;
r_ptr->r_flags6 = r_ptr->a_ability_flags2;
r_ptr->r_flagsr = r_ptr->flagsr;
- /* Know about evolution */
if (!(r_ptr->r_xtra1 & MR1_SINKA)) n++;
r_ptr->r_xtra1 |= MR1_SINKA;
- /* Update monster recall window */
if (player_ptr->monster_race_idx == r_idx)
{
player_ptr->window |= (PW_MONSTER);
monster_type *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
monster_race *r_ptr = &r_info[m_ptr->r_idx];
- /* If the monster doesn't have original appearance, don't note */
if (!is_original_ap(m_ptr)) return;
- /* Note the number of things dropped */
if (num_item > r_ptr->r_drop_item) r_ptr->r_drop_item = num_item;
if (num_gold > r_ptr->r_drop_gold) r_ptr->r_drop_gold = num_gold;
- /* Hack -- memorize the good/great flags */
if (r_ptr->flags1 & (RF1_DROP_GOOD)) r_ptr->r_flags1 |= (RF1_DROP_GOOD);
if (r_ptr->flags1 & (RF1_DROP_GREAT)) r_ptr->r_flags1 |= (RF1_DROP_GREAT);
-
- /* Update monster recall window */
- if (player_ptr->monster_race_idx == m_ptr->r_idx)
- {
- player_ptr->window |= (PW_MONSTER);
- }
+ if (player_ptr->monster_race_idx == m_ptr->r_idx) player_ptr->window |= (PW_MONSTER);
}
POSITION fy = m_ptr->fy;
POSITION fx = m_ptr->fx;
- /* Seen at all */
bool flag = FALSE;
-
- /* Seen by vision */
bool easy = FALSE;
-
- /* Non-Ninja player in the darkness */
bool in_darkness = (d_info[subject_ptr->dungeon_idx].flags1 & DF1_DARKNESS) && !subject_ptr->see_nocto;
-
- /* Do disturb? */
if (disturb_high)
{
monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx];
-
if (ap_r_ptr->r_tkills && ap_r_ptr->level >= subject_ptr->lev)
do_disturb = TRUE;
}
POSITION distance;
if (full)
{
- /* Distance components */
int dy = (subject_ptr->y > fy) ? (subject_ptr->y - fy) : (fy - subject_ptr->y);
int dx = (subject_ptr->x > fx) ? (subject_ptr->x - fx) : (fx - subject_ptr->x);
- /* Approximate distance */
distance = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
-
- /* Restrict distance */
if (distance > 255) distance = 255;
-
if (!distance) distance = 1;
- /* Save the distance */
m_ptr->cdis = distance;
}
-
- /* Extract distance */
else
{
- /* Extract the distance */
distance = m_ptr->cdis;
}
- /* Detected */
if (m_ptr->mflag2 & (MFLAG2_MARK)) flag = TRUE;
- /* Nearby */
if (distance <= (in_darkness ? MAX_SIGHT / 2 : MAX_SIGHT))
{
if (!in_darkness || (distance <= MAX_SIGHT / 4))
{
if (subject_ptr->special_defense & KATA_MUSOU)
{
- /* Detectable */
flag = TRUE;
-
if (is_original_ap(m_ptr) && !subject_ptr->image)
{
- /* Hack -- Memorize mental flags */
if (r_ptr->flags2 & (RF2_SMART)) r_ptr->r_flags2 |= (RF2_SMART);
if (r_ptr->flags2 & (RF2_STUPID)) r_ptr->r_flags2 |= (RF2_STUPID);
}
}
-
- /* Basic telepathy */
- /* Snipers get telepathy when they concentrate deeper */
else if (subject_ptr->telepathy)
{
- /* Empty mind, no telepathy */
if (r_ptr->flags2 & (RF2_EMPTY_MIND))
{
- /* Memorize flags */
if (is_original_ap(m_ptr) && !subject_ptr->image) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
}
-
- /* Weird mind, occasional telepathy */
else if (r_ptr->flags2 & (RF2_WEIRD_MIND))
{
- /* One in ten individuals are detectable */
if ((m_idx % 10) == 5)
{
- /* Detectable */
flag = TRUE;
-
if (is_original_ap(m_ptr) && !subject_ptr->image)
{
- /* Memorize flags */
r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
-
- /* Hack -- Memorize mental flags */
if (r_ptr->flags2 & (RF2_SMART)) r_ptr->r_flags2 |= (RF2_SMART);
if (r_ptr->flags2 & (RF2_STUPID)) r_ptr->r_flags2 |= (RF2_STUPID);
}
}
}
-
- /* Normal mind, allow telepathy */
else
{
- /* Detectable */
flag = TRUE;
-
if (is_original_ap(m_ptr) && !subject_ptr->image)
{
- /* Hack -- Memorize mental flags */
if (r_ptr->flags2 & (RF2_SMART)) r_ptr->r_flags2 |= (RF2_SMART);
if (r_ptr->flags2 & (RF2_STUPID)) r_ptr->r_flags2 |= (RF2_STUPID);
}
}
}
- /* Normal line of sight, and not blind */
if (player_has_los_bold(subject_ptr, fy, fx) && !subject_ptr->blind)
{
bool do_invisible = FALSE;
bool do_cold_blood = FALSE;
- /* Snipers can see targets in darkness when they concentrate deeper */
if (subject_ptr->concent >= CONCENT_RADAR_THRESHOLD)
{
- /* Easy to see */
easy = flag = TRUE;
}
- /* Use "infravision" */
if (distance <= subject_ptr->see_infra)
{
- /* Handle "cold blooded" monsters */
if ((r_ptr->flags2 & (RF2_COLD_BLOOD | RF2_AURA_FIRE)) == RF2_COLD_BLOOD)
{
do_cold_blood = TRUE;
}
-
- /* Handle "warm blooded" monsters */
else
{
- /* Easy to see */
easy = flag = TRUE;
}
}
- /* Use "illumination" */
if (player_can_see_bold(subject_ptr, fy, fx))
{
- /* Handle "invisible" monsters */
if (r_ptr->flags2 & (RF2_INVISIBLE))
{
do_invisible = TRUE;
-
- /* See invisible */
if (subject_ptr->see_inv)
{
- /* Easy to see */
easy = flag = TRUE;
}
}
-
- /* Handle "normal" monsters */
else
{
- /* Easy to see */
easy = flag = TRUE;
}
}
- /* Visible */
if (flag)
{
if (is_original_ap(m_ptr) && !subject_ptr->image)
{
- /* Memorize flags */
if (do_invisible) r_ptr->r_flags2 |= (RF2_INVISIBLE);
if (do_cold_blood) r_ptr->r_flags2 |= (RF2_COLD_BLOOD);
}
/* The monster is now visible */
if (flag)
{
- /* It was previously unseen */
if (!m_ptr->ml)
{
- /* Mark as visible */
m_ptr->ml = TRUE;
-
- /* Draw the monster */
lite_spot(subject_ptr, fy, fx);
- /* Update health bar as needed */
if (subject_ptr->health_who == m_idx) subject_ptr->redraw |= (PR_HEALTH);
if (subject_ptr->riding == m_idx) subject_ptr->redraw |= (PR_UHEALTH);
- /* Hack -- Count "fresh" sightings */
if (!subject_ptr->image)
{
if ((m_ptr->ap_r_idx == MON_KAGE) && (r_info[MON_KAGE].r_sights < MAX_SHORT))
sanity_blast(subject_ptr, m_ptr, FALSE);
}
- /* Disturb on appearance */
if (disturb_near && (projectable(subject_ptr, m_ptr->fy, m_ptr->fx, subject_ptr->y, subject_ptr->x) && projectable(subject_ptr, subject_ptr->y, subject_ptr->x, m_ptr->fy, m_ptr->fx)))
{
if (disturb_pets || is_hostile(m_ptr))
/* The monster is not visible */
else
{
- /* It was previously seen */
if (m_ptr->ml)
{
- /* Mark as not visible */
m_ptr->ml = FALSE;
-
- /* Erase the monster */
lite_spot(subject_ptr, fy, fx);
- /* Update health bar as needed */
if (subject_ptr->health_who == m_idx) subject_ptr->redraw |= (PR_HEALTH);
if (subject_ptr->riding == m_idx) subject_ptr->redraw |= (PR_UHEALTH);
-
- /* Disturb on disappearance */
if (do_disturb)
{
if (disturb_pets || is_hostile(m_ptr))
}
}
-
/* The monster is now easily visible */
if (easy)
{
- /* Change */
if (!(m_ptr->mflag & (MFLAG_VIEW)))
{
- /* Mark as easily visible */
m_ptr->mflag |= (MFLAG_VIEW);
-
- /* Disturb on appearance */
if (do_disturb)
{
if (disturb_pets || is_hostile(m_ptr))
/* Mark as not easily visible */
m_ptr->mflag &= ~(MFLAG_VIEW);
- /* Disturb on disappearance */
if (do_disturb)
{
if (disturb_pets || is_hostile(m_ptr))
*/
void update_monsters(player_type *player_ptr, bool full)
{
- /* Update each (live) monster */
floor_type *floor_ptr = player_ptr->current_floor_ptr;
for (MONSTER_IDX i = 1; i < floor_ptr->m_max; i++)
{
if (!monster_can_cross_terrain(p_ptr, floor_ptr->grid_array[m_ptr->fy][m_ptr->fx].feat, r_ptr, 0)) return FALSE;
- /* Not born */
if (!(old_r_ptr->flags7 & RF7_CHAMELEON))
{
if (monster_has_hostile_align(p_ptr, m_ptr, 0, 0, r_ptr)) return FALSE;
}
-
- /* Born now */
else if (summon_specific_who > 0)
{
if (monster_has_hostile_align(p_ptr, &floor_ptr->m_list[summon_specific_who], 0, 0, r_ptr)) return FALSE;
if (!monster_can_cross_terrain(p_ptr, floor_ptr->grid_array[m_ptr->fy][m_ptr->fx].feat, r_ptr, 0)) return FALSE;
- /* Not born */
if (!(old_r_ptr->flags7 & RF7_CHAMELEON))
{
if ((old_r_ptr->flags3 & RF3_GOOD) && !(r_ptr->flags3 & RF3_GOOD)) return FALSE;
if ((old_r_ptr->flags3 & RF3_EVIL) && !(r_ptr->flags3 & RF3_EVIL)) return FALSE;
if (!(old_r_ptr->flags3 & (RF3_GOOD | RF3_EVIL)) && (r_ptr->flags3 & (RF3_GOOD | RF3_EVIL))) return FALSE;
}
-
- /* Born now */
else if (summon_specific_who > 0)
{
if (monster_has_hostile_align(p_ptr, &floor_ptr->m_list[summon_specific_who], 0, 0, r_ptr)) return FALSE;
if (born)
{
- /* Sub-alignment of a chameleon */
if (r_ptr->flags3 & (RF3_EVIL | RF3_GOOD))
{
m_ptr->sub_align = SUB_ALIGN_NEUTRAL;
if (r_ptr->flags3 & RF3_EVIL) m_ptr->sub_align |= SUB_ALIGN_EVIL;
if (r_ptr->flags3 & RF3_GOOD) m_ptr->sub_align |= SUB_ALIGN_GOOD;
}
+
return;
}
if (rakuba(player_ptr, 0, TRUE)) msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
}
- /* Extract the monster base speed */
m_ptr->mspeed = get_mspeed(player_ptr, r_ptr);
int oldmaxhp = m_ptr->max_maxhp;
- /* Assign maximal hitpoints */
if (r_ptr->flags1 & RF1_FORCE_MAXHP)
{
m_ptr->max_maxhp = maxroll(r_ptr->hdice, r_ptr->hside);
m_ptr->max_maxhp = damroll(r_ptr->hdice, r_ptr->hside);
}
- /* Monsters have double hitpoints in Nightmare mode */
if (ironman_nightmare)
{
u32b hp = m_ptr->max_maxhp * 2L;
*/
SPEED get_mspeed(player_type *player_ptr, monster_race *r_ptr)
{
- /* Extract the monster base speed */
SPEED mspeed = r_ptr->speed;
-
- /* Hack -- small racial variety */
if (!(r_ptr->flags1 & RF1_UNIQUE) && !player_ptr->current_floor_ptr->inside_arena)
{
/* Allow some small variation per monster */
monster_race *r_ptr = &r_info[r_idx];
concptr name = (r_name + r_ptr->name);
- /* DO NOT PLACE A MONSTER IN THE SMALL SCALE WILDERNESS !!! */
if (player_ptr->wild_mode) return FALSE;
-
if (!in_bounds(floor_ptr, y, x)) return FALSE;
if (!r_idx) return FALSE;
if (!r_ptr->name) return FALSE;
if (!(mode & PM_IGNORE_TERRAIN))
{
- /* Not on the Pattern */
if (pattern_tile(floor_ptr, y, x)) return FALSE;
-
- /* Require empty space (if not ghostly) */
if (!monster_can_enter(player_ptr, y, x, r_ptr, 0)) return FALSE;
}
if (!player_ptr->phase_out)
{
- /* Hack -- "unique" monsters must be "unique" */
if (((r_ptr->flags1 & (RF1_UNIQUE)) ||
(r_ptr->flags7 & (RF7_NAZGUL))) &&
(r_ptr->cur_num >= r_ptr->max_num))
{
- /* Cannot create */
return FALSE;
}
if (r_info[MON_LUPART].cur_num > 0) return FALSE;
}
- /* Depth monsters may NOT be created out of depth, unless in Nightmare mode */
if ((r_ptr->flags1 & (RF1_FORCE_DEPTH)) && (floor_ptr->dun_level < r_ptr->level) &&
(!ironman_nightmare || (r_ptr->flags1 & (RF1_QUESTOR))))
{
- /* Cannot create */
return FALSE;
}
}
int number_mon, i2, j2;
number_mon = 0;
- /* Count all quest monsters */
for (i2 = 0; i2 < floor_ptr->width; ++i2)
for (j2 = 0; j2 < floor_ptr->height; j2++)
if (floor_ptr->grid_array[j2][i2].m_idx > 0)
{
if (randint1(BREAK_GLYPH) < (r_ptr->level + 20))
{
- /* Describe observable breakage */
if (g_ptr->info & CAVE_MARK)
{
msg_print(_("守りのルーンが壊れた!", "The rune of protection is broken!"));
}
- /* Forget the rune */
g_ptr->info &= ~(CAVE_MARK);
-
- /* Break the rune */
g_ptr->info &= ~(CAVE_OBJECT);
g_ptr->mimic = 0;
}
msg_format_wizard(CHEAT_MONSTER, _("%s(Lv%d)を生成しました。", "%s(Lv%d) was generated."), name, r_ptr->level);
-
if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL) || (r_ptr->level < 10)) mode &= ~PM_KAGE;
- /* Make a new monster */
g_ptr->m_idx = m_pop(player_ptr);
hack_m_idx_ii = g_ptr->m_idx;
-
- /* Mega-Hack -- catch "failure" */
if (!g_ptr->m_idx) return FALSE;
-
- /* Get a new monster record */
m_ptr = &floor_ptr->m_list[g_ptr->m_idx];
-
- /* Save the race */
m_ptr->r_idx = r_idx;
m_ptr->ap_r_idx = initial_r_appearance(player_ptr, r_idx, mode);
- /* No flags */
m_ptr->mflag = 0;
m_ptr->mflag2 = 0;
-
- /* Hack -- Appearance transfer */
if ((mode & PM_MULTIPLY) && (who > 0) && !is_original_ap(&floor_ptr->m_list[who]))
{
m_ptr->ap_r_idx = floor_ptr->m_list[who].ap_r_idx;
-
- /* Hack -- Shadower spawns Shadower */
if (floor_ptr->m_list[who].mflag2 & MFLAG2_KAGE) m_ptr->mflag2 |= MFLAG2_KAGE;
}
- /* Sub-alignment of a monster */
if ((who > 0) && !(r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)))
m_ptr->sub_align = floor_ptr->m_list[who].sub_align;
else
if (r_ptr->flags3 & RF3_GOOD) m_ptr->sub_align |= SUB_ALIGN_GOOD;
}
- /* Place the monster at the location */
m_ptr->fy = y;
m_ptr->fx = x;
m_ptr->current_floor_ptr = floor_ptr;
- /* No "timed status" yet */
for (int cmi = 0; cmi < MAX_MTIMED; cmi++) m_ptr->mtimed[cmi] = 0;
- /* Unknown distance */
m_ptr->cdis = 0;
-
reset_target(m_ptr);
-
m_ptr->nickname = 0;
-
m_ptr->exp = 0;
-
- /* Your pet summons its pet. */
if (who > 0 && is_pet(&floor_ptr->m_list[who]))
{
mode |= PM_FORCE_PET;
choose_new_monster(player_ptr, g_ptr->m_idx, TRUE, 0);
r_ptr = &r_info[m_ptr->r_idx];
m_ptr->mflag2 |= MFLAG2_CHAMELEON;
-
- /* Hack - Set sub_align to neutral when the Chameleon Lord is generated as "GUARDIAN" */
if ((r_ptr->flags1 & RF1_UNIQUE) && (who <= 0))
m_ptr->sub_align = SUB_ALIGN_NEUTRAL;
}
if (mode & PM_NO_PET) m_ptr->mflag2 |= MFLAG2_NOPET;
- /* Not visible */
m_ptr->ml = FALSE;
-
- /* Pet? */
if (mode & PM_FORCE_PET)
{
set_pet(player_ptr, m_ptr);
}
- /* Friendly? */
else if ((r_ptr->flags7 & RF7_FRIENDLY) ||
(mode & PM_FORCE_FRIENDLY) || is_friendly_idx(player_ptr, who))
{
if (!monster_has_hostile_align(player_ptr, NULL, 0, -1, r_ptr)) set_friendly(m_ptr);
}
- /* Assume no sleeping */
m_ptr->mtimed[MTIMED_CSLEEP] = 0;
-
- /* Enforce sleeping if needed */
if ((mode & PM_ALLOW_SLEEP) && r_ptr->sleep && !ironman_nightmare)
{
int val = r_ptr->sleep;
(void)set_monster_csleep(player_ptr, g_ptr->m_idx, (val * 2) + randint1(val * 10));
}
- /* Assign maximal hitpoints */
if (r_ptr->flags1 & RF1_FORCE_MAXHP)
{
m_ptr->max_maxhp = maxroll(r_ptr->hdice, r_ptr->hside);
m_ptr->max_maxhp = damroll(r_ptr->hdice, r_ptr->hside);
}
- /* Monsters have double hitpoints in Nightmare mode */
if (ironman_nightmare)
{
u32b hp = m_ptr->max_maxhp * 2L;
}
m_ptr->maxhp = m_ptr->max_maxhp;
-
- /* And start out fully healthy */
if (m_ptr->r_idx == MON_WOUNDED_BEAR)
m_ptr->hp = m_ptr->maxhp / 2;
else m_ptr->hp = m_ptr->maxhp;
-
- /* dealt damage is 0 at initial*/
m_ptr->dealt_damage = 0;
-
- /* Extract the monster base speed */
m_ptr->mspeed = get_mspeed(player_ptr, r_ptr);
if (mode & PM_HASTE) (void)set_monster_fast(player_ptr, g_ptr->m_idx, 100);
- /* Give a random starting energy */
if (!ironman_nightmare)
{
m_ptr->energy_need = ENERGY_NEED() - (s16b)randint0(100);
}
else
{
- /* Nightmare monsters are more prepared */
m_ptr->energy_need = ENERGY_NEED() - (s16b)randint0(100) * 2;
}
- /* Force monster to wait for player, unless in Nightmare mode */
if ((r_ptr->flags1 & RF1_FORCE_SLEEP) && !ironman_nightmare)
{
- /* Monster is still being nice */
m_ptr->mflag |= (MFLAG_NICE);
-
- /* Must repair monsters */
repair_monsters = TRUE;
}
- /* Hack -- see "process_monsters()" */
if (g_ptr->m_idx < hack_m_idx)
{
- /* Monster is still being born */
m_ptr->mflag |= (MFLAG_BORN);
}
-
if (r_ptr->flags7 & RF7_SELF_LD_MASK)
player_ptr->update |= (PU_MON_LITE);
else if ((r_ptr->flags7 & RF7_HAS_LD_MASK) && !MON_CSLEEP(m_ptr))
player_ptr->update |= (PU_MON_LITE);
update_monster(player_ptr, g_ptr->m_idx, TRUE);
-
- /* Count the monsters on the level */
real_r_ptr(m_ptr)->cur_num++;
/*
((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)))
real_r_ptr(m_ptr)->floor_id = player_ptr->floor_id;
- /* Hack -- Count the number of "reproducers" */
if (r_ptr->flags2 & RF2_MULTIPLY) floor_ptr->num_repro++;
if (player_ptr->warning && current_world_ptr->character_dungeon)
if (!is_explosive_rune_grid(g_ptr)) return TRUE;
- /* Break the ward */
if (randint1(BREAK_MINOR_GLYPH) > r_ptr->level)
{
- /* Describe observable breakage */
if (g_ptr->info & CAVE_MARK)
{
msg_print(_("ルーンが爆発した!", "The rune explodes!"));
msg_print(_("爆発のルーンは解除された。", "An explosive rune was disarmed."));
}
- /* Forget the rune */
g_ptr->info &= ~(CAVE_MARK);
-
- /* Break the rune */
g_ptr->info &= ~(CAVE_OBJECT);
g_ptr->mimic = 0;
{
for (POSITION ny = y - max_dist; ny <= y + max_dist; ny++)
{
- /* Ignore annoying locations */
if (!in_bounds(floor_ptr, ny, nx)) continue;
-
- /* Require "line of projection" */
if (!projectable(player_ptr, y, x, ny, nx)) continue;
-
if (r_idx > 0)
{
monster_race *r_ptr = &r_info[r_idx];
-
- /* Require empty space (if not ghostly) */
if (!monster_can_enter(player_ptr, ny, nx, r_ptr, 0))
continue;
}
else
{
- /* Walls and Monsters block flow */
if (!is_cave_empty_bold2(player_ptr, ny, nx)) continue;
-
- /* ... nor on the Pattern */
if (pattern_tile(floor_ptr, ny, nx)) continue;
}
i = distance(y, x, ny, nx);
-
if (i > max_dist)
continue;
num[i]++;
-
- /* random swap */
if (one_in_(num[i]))
{
place_x[i] = nx;
return TRUE;
}
+
/*!
* @brief モンスターを目標地点に集団生成する / Attempt to place a "group" of monsters around the given location
* @param who 召喚主のモンスター情報ID
monster_race *r_ptr = &r_info[r_idx];
int total = randint1(10);
- /* Hard monsters, small groups */
floor_type *floor_ptr = player_ptr->current_floor_ptr;
int extra = 0;
if (r_ptr->level > floor_ptr->dun_level)
extra = r_ptr->level - floor_ptr->dun_level;
extra = 0 - randint1(extra);
}
-
- /* Easy monsters, large groups */
else if (r_ptr->level < floor_ptr->dun_level)
{
extra = floor_ptr->dun_level - r_ptr->level;
extra = randint1(extra);
}
- /* Hack -- limit group reduction */
if (extra > 9) extra = 9;
- /* Modify the group size */
total += extra;
- /* Minimum size */
if (total < 1) total = 1;
-
- /* Maximum size */
if (total > GROUP_MAX) total = GROUP_MAX;
-
- /* Start on the monster */
int hack_n = 1;
POSITION hack_x[GROUP_MAX];
hack_x[0] = x;
POSITION hack_y[GROUP_MAX];
hack_y[0] = y;
- /* Puddle monsters, breadth first, up to total */
for (int n = 0; (n < hack_n) && (hack_n < total); n++)
{
- /* Grab the location */
POSITION hx = hack_x[n];
POSITION hy = hack_y[n];
-
- /* Check each direction, up to total */
for (int i = 0; (i < 8) && (hack_n < total); i++)
{
POSITION mx, my;
-
scatter(player_ptr, &my, &mx, hy, hx, 4, 0);
-
- /* Walls and Monsters block flow */
if (!is_cave_empty_bold2(player_ptr, my, mx)) continue;
- /* Attempt to place another monster */
if (place_monster_one(player_ptr, who, my, mx, r_idx, mode))
{
- /* Add it to the "hack" set */
hack_y[hack_n] = my;
hack_x[hack_n] = mx;
hack_n++;
monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[place_monster_m_idx];
monster_race *z_ptr = &r_info[r_idx];
- /* Hack - Escorts have to have the same dungeon flag */
if (mon_hook_dungeon(place_monster_idx) != mon_hook_dungeon(r_idx)) return FALSE;
-
- /* Require similar "race" */
if (z_ptr->d_char != r_ptr->d_char) return FALSE;
-
- /* Skip more advanced monsters */
if (z_ptr->level > r_ptr->level) return FALSE;
-
- /* Skip unique monsters */
if (z_ptr->flags1 & RF1_UNIQUE) return FALSE;
-
- /* Paranoia -- Skip identical monsters */
if (place_monster_idx == r_idx) return FALSE;
-
- /* Skip different alignment */
if (monster_has_hostile_align(p_ptr, m_ptr, 0, 0, z_ptr)) return FALSE;
if (r_ptr->flags7 & RF7_FRIENDLY)
if (!(mode & PM_NO_KAGE) && one_in_(333))
mode |= PM_KAGE;
- /* Place one monster, or fail */
if (!place_monster_one(player_ptr, who, y, x, r_idx, mode)) return FALSE;
-
- /* Require the "group" flag */
if (!(mode & PM_ALLOW_GROUP)) return TRUE;
place_monster_m_idx = hack_m_idx_ii;
}
}
- /* Friends for certain monsters */
if (r_ptr->flags1 & (RF1_FRIENDS))
{
- /* Attempt to place a group */
(void)place_monster_group(player_ptr, who, y, x, r_idx, mode);
}
- /* Escorts for certain monsters */
if (!(r_ptr->flags1 & (RF1_ESCORT))) return TRUE;
- /* Set the escort index */
place_monster_idx = r_idx;
-
- /* Try to place several "escorts" */
for (int i = 0; i < 32; i++)
{
POSITION nx, ny, d = 3;
MONRACE_IDX z;
-
- /* Pick a location */
scatter(player_ptr, &ny, &nx, y, x, d, 0);
-
- /* Require empty grids */
if (!is_cave_empty_bold2(player_ptr, ny, nx)) continue;
- get_mon_num_prep(player_ptr, place_monster_can_escort, get_monster_hook2(player_ptr, ny, nx));
- /* Pick a random race */
+ get_mon_num_prep(player_ptr, place_monster_can_escort, get_monster_hook2(player_ptr, ny, nx));
z = get_mon_num(player_ptr, r_ptr->level);
-
- /* Handle failure */
if (!z) break;
- /* Place a single escort */
(void)place_monster_one(player_ptr, place_monster_m_idx, ny, nx, z, mode);
-
- /* Place a "group" of escorts if needed */
if ((r_info[z].flags1 & RF1_FRIENDS) ||
(r_ptr->flags1 & RF1_ESCORTS))
{
- /* Place a group of monsters */
(void)place_monster_group(player_ptr, place_monster_m_idx, ny, nx, z, mode);
}
}
{
MONRACE_IDX r_idx;
get_mon_num_prep(player_ptr, get_monster_hook(player_ptr), get_monster_hook2(player_ptr, y, x));
-
- /* Pick a monster */
r_idx = get_mon_num(player_ptr, player_ptr->current_floor_ptr->monster_level);
-
- /* Handle failure */
if (!r_idx) return FALSE;
- /* Attempt to place the monster */
if (place_monster_aux(player_ptr, 0, y, x, r_idx, mode)) return TRUE;
return FALSE;
monster_race *r_ptr = NULL;
while (--attempts)
{
- /* Pick a monster */
r_idx = get_mon_num(player_ptr, floor_ptr->monster_level);
-
- /* Handle failure */
if (!r_idx) return FALSE;
r_ptr = &r_info[r_idx];
-
if (r_ptr->flags1 & RF1_UNIQUE) continue;
if (r_idx == MON_HAGURE) continue;
while (--attempts)
{
- /* Attempt to place the monster */
if (place_monster_aux(player_ptr, 0, y, x, r_idx, 0L)) break;
}
if (attempts < 1) return FALSE;
MONSTER_IDX m_idx = floor_ptr->grid_array[y][x].m_idx;
-
if (floor_ptr->m_list[m_idx].mflag2 & MFLAG2_CHAMELEON) r_ptr = &r_info[floor_ptr->m_list[m_idx].r_idx];
POSITION cy = y;
for (attempts = randint1(10) + 5; attempts; attempts--)
{
scatter(player_ptr, &cy, &cx, y, x, 5, 0);
-
(void)summon_specific(player_ptr, m_idx, cy, cx, floor_ptr->dun_level + 5, SUMMON_KIN, PM_ALLOW_GROUP);
-
y = cy;
x = cx;
}
return TRUE;
}
+
/*!
* @brief ダンジョンの主生成を試みる / Put the Guardian
* @param player_ptr プレーヤーへの参照ポインタ
bool alloc_guardian(player_type *player_ptr, bool def_val)
{
MONRACE_IDX guardian = d_info[player_ptr->dungeon_idx].final_guardian;
-
floor_type *floor_ptr = player_ptr->current_floor_ptr;
bool is_guardian_applicable = guardian > 0;
is_guardian_applicable &= d_info[player_ptr->dungeon_idx].maxdepth == floor_ptr->dun_level;
int try_count = 4000;
while (try_count)
{
- /* Get a random spot */
POSITION oy = randint1(floor_ptr->height - 4) + 2;
POSITION ox = randint1(floor_ptr->width - 4) + 2;
-
- /* Is it a good spot ? */
if (!is_cave_empty_bold2(player_ptr, oy, ox))
{
try_count++;
*/
bool alloc_monster(player_type *player_ptr, POSITION dis, BIT_FLAGS mode)
{
- /* Put the Guardian */
if (alloc_guardian(player_ptr, FALSE)) return TRUE;
- /* Find a legal, distant, unoccupied, space */
floor_type *floor_ptr = player_ptr->current_floor_ptr;
POSITION y = 0, x = 0;
int attempts_left = 10000;
while (attempts_left--)
{
- /* Pick a location */
y = randint0(floor_ptr->height);
x = randint0(floor_ptr->width);
- /* Require empty floor grid (was "naked") */
if (floor_ptr->dun_level)
{
if (!is_cave_empty_bold2(player_ptr, y, x)) continue;
if (!is_cave_empty_bold(player_ptr, y, x)) continue;
}
- /* Accept far away grids */
if (distance(y, x, player_ptr->y, player_ptr->x) > dis) break;
}
}
else
{
- /* Attempt to place the monster, allow groups */
if (place_monster(player_ptr, y, x, (mode | PM_ALLOW_GROUP))) return TRUE;
}
{
monster_race *r_ptr = &r_info[r_idx];
monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[summon_specific_who];
-
- /* Hack - Only summon dungeon monsters */
if (!mon_hook_dungeon(r_idx)) return FALSE;
- /* Hack -- identify the summoning monster */
if (summon_specific_who > 0)
{
-
- /* Do not summon enemies */
-
- /* Friendly vs. opposite aligned normal or pet */
if (monster_has_hostile_align(p_ptr, m_ptr, 0, 0, r_ptr)) return FALSE;
}
- /* Use the player's alignment */
else if (summon_specific_who < 0)
{
- /* Do not summon enemies of the pets */
if (monster_has_hostile_align(p_ptr, NULL, 10, -10, r_ptr))
{
if (!one_in_(ABS(p_ptr->align) / 2 + 1)) return FALSE;
if (!summon_unique_okay && ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))) return FALSE;
- /* Hack -- no specific type specified */
if (!summon_specific_type) return TRUE;
if ((summon_specific_who < 0) &&
POSITION x, y;
if (!mon_scatter(player_ptr, 0, &y, &x, y1, x1, 2)) return FALSE;
- /* Save the summoner */
summon_specific_who = who;
-
- /* Save the "summon" type */
summon_specific_type = type;
-
summon_unique_okay = (mode & PM_ALLOW_UNIQUE) ? TRUE : FALSE;
get_mon_num_prep(player_ptr, summon_specific_okay, get_monster_hook2(player_ptr, y, x));
- /* Pick a monster, using the level calculation */
MONRACE_IDX r_idx = get_mon_num(player_ptr, (floor_ptr->dun_level + lev) / 2 + 5);
-
- /* Handle failure */
if (!r_idx)
{
summon_specific_type = 0;
if ((type == SUMMON_BLUE_HORROR) || (type == SUMMON_DAWN)) mode |= PM_NO_KAGE;
- /* Attempt to place the monster (awake, allow groups) */
if (!place_monster_aux(player_ptr, who, y, x, r_idx, mode))
{
summon_specific_type = 0;
}
summon_specific_type = 0;
- /* Success */
sound(SOUND_SUMMON);
return TRUE;
}
*/
bool summon_named_creature(player_type *player_ptr, MONSTER_IDX who, POSITION oy, POSITION ox, MONRACE_IDX r_idx, BIT_FLAGS mode)
{
- /* Prevent illegal monsters */
if (r_idx >= max_r_idx) return FALSE;
POSITION x, y;
if (!mon_scatter(player_ptr, r_idx, &y, &x, oy, ox, 2)) return FALSE;
- /* Place it (allow groups) */
return place_monster_aux(player_ptr, who, y, x, r_idx, (mode | PM_NO_KAGE));
}
if (m_ptr->mflag2 & MFLAG2_NOPET) mode |= PM_NO_PET;
- /* Create a new monster (awake, no groups) */
if (!place_monster_aux(player_ptr, m_idx, y, x, m_ptr->r_idx, (mode | PM_NO_KAGE | PM_MULTIPLY)))
return FALSE;
- /* Hack -- Transfer "clone" flag */
if (clone || (m_ptr->smart & SM_CLONED))
{
floor_ptr->m_list[hack_m_idx_ii].smart |= SM_CLONED;
*/
void message_pain(player_type *player_ptr, MONSTER_IDX m_idx, HIT_POINT dam)
{
- HIT_POINT oldhp, newhp;
- HIT_POINT tmp;
- PERCENTAGE percentage;
-
monster_type *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
monster_race *r_ptr = &r_info[m_ptr->r_idx];
monster_desc(player_ptr, m_name, m_ptr, 0);
- if (dam == 0) // Notice non-damage
+ if (dam == 0)
{
msg_format(_("%^sはダメージを受けていない。", "%^s is unharmed."), m_name);
return;
}
- newhp = m_ptr->hp;
- oldhp = newhp + dam;
- tmp = (newhp * 100L) / oldhp;
- percentage = tmp;
+ HIT_POINT newhp = m_ptr->hp;
+ HIT_POINT oldhp = newhp + dam;
+ HIT_POINT tmp = (newhp * 100L) / oldhp;
+ PERCENTAGE percentage = tmp;
- if (my_strchr(",ejmvwQ", r_ptr->d_char)) // Mushrooms, Eyes, Jellies, Molds, Vortices, Worms, Quylthulgs
+ if (my_strchr(",ejmvwQ", r_ptr->d_char))
{
#ifdef JP
if (percentage > 95) msg_format("%^sはほとんど気にとめていない。", m_name);
#endif
}
- if (my_strchr("l", r_ptr->d_char)) // Fish
+ if (my_strchr("l", r_ptr->d_char))
{
#ifdef JP
if (percentage > 95) msg_format("%^sはほとんど気にとめていない。", m_name);
#endif
}
- if (my_strchr("g#+<>", r_ptr->d_char)) // Golems, Walls, Doors, Stairs
+ if (my_strchr("g#+<>", r_ptr->d_char))
{
#ifdef JP
if (percentage > 95) msg_format("%sは攻撃を気にとめていない。", m_name);
#endif
}
- if (my_strchr("JMR", r_ptr->d_char) || !isalpha(r_ptr->d_char)) // Snakes, Hydrae, Reptiles, Mimics
+ if (my_strchr("JMR", r_ptr->d_char) || !isalpha(r_ptr->d_char))
{
#ifdef JP
if (percentage > 95) msg_format("%^sはほとんど気にとめていない。", m_name);
#endif
}
- if (my_strchr("acFIKS", r_ptr->d_char)) // Ants, Centipedes, Flies, Insects, Beetles, Spiders
+ if (my_strchr("acFIKS", r_ptr->d_char))
{
#ifdef JP
if (percentage > 95) msg_format("%sは攻撃を気にとめていない。", m_name);
#endif
}
- if (my_strchr("B", r_ptr->d_char)) // Birds
+ if (my_strchr("B", r_ptr->d_char))
{
#ifdef JP
if (percentage > 95) msg_format("%^sはさえずった。", m_name);
#endif
}
- if (my_strchr("duDLUW", r_ptr->d_char)) // Dragons, Demons, High Undead
+ if (my_strchr("duDLUW", r_ptr->d_char))
{
#ifdef JP
if (percentage > 95) msg_format("%sは攻撃を気にとめていない。", m_name);
#endif
}
- if (my_strchr("s", r_ptr->d_char)) // Skeletons
+ if (my_strchr("s", r_ptr->d_char))
{
#ifdef JP
if (percentage > 95) msg_format("%sは攻撃を気にとめていない。", m_name);
#endif
}
- if (my_strchr("z", r_ptr->d_char)) // Zombies
+ if (my_strchr("z", r_ptr->d_char))
{
#ifdef JP
if (percentage > 95) msg_format("%sは攻撃を気にとめていない。", m_name);
#endif
}
- if (my_strchr("G", r_ptr->d_char)) // Ghosts
+ if (my_strchr("G", r_ptr->d_char))
{
#ifdef JP
if (percentage > 95) msg_format("%sは攻撃を気にとめていない。", m_name);
#endif
}
- if (my_strchr("CZ", r_ptr->d_char)) // Dogs and Hounds
+ if (my_strchr("CZ", r_ptr->d_char))
{
#ifdef JP
if (percentage > 95) msg_format("%^sは攻撃に肩をすくめた。", m_name);
#endif
}
- if (my_strchr("Xbilqrt", r_ptr->d_char)) // One type of creatures (ignore,squeal,shriek)
+ if (my_strchr("Xbilqrt", r_ptr->d_char))
{
#ifdef JP
if (percentage > 95) msg_format("%^sは攻撃を気にとめていない。", m_name);
monster_type *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
monster_race *r_ptr = &r_info[m_ptr->r_idx];
- /* Not allowed to learn */
if (!smart_learn) return;
-
- /* Too stupid to learn anything */
if (r_ptr->flags2 & (RF2_STUPID)) return;
-
- /* Not intelligent, only learn sometimes */
if (!(r_ptr->flags2 & (RF2_SMART)) && (randint0(100) < 50)) return;
- /* Analyze the knowledge */
switch (what)
{
case DRS_ACID:
*/
void monster_drop_carried_objects(player_type *player_ptr, monster_type *m_ptr)
{
- /* Drop objects being carried */
floor_type *floor_ptr = player_ptr->current_floor_ptr;
OBJECT_IDX next_o_idx = 0;
for (OBJECT_IDX this_o_idx = m_ptr->hold_o_idx; this_o_idx; this_o_idx = next_o_idx)
_("%^sが自分の体に念を送った。", format("%%^s concentrates on %s body.", m_poss)),
target_ptr->blind > 0, TARGET_TYPE);
- /* Allow quick speed increases to base+10 */
if (set_monster_fast(target_ptr, m_idx, MON_FAST(m_ptr) + 100))
{
if (TARGET_TYPE == MONSTER_TO_PLAYER ||
_("%^sは自分の傷に念を集中した。", format("%%^s concentrates on his wounds.", m_poss)),
target_ptr->blind > 0, TARGET_TYPE);
- /* Heal some */
m_ptr->hp += (rlev * 6);
-
- /* Fully healed */
if (m_ptr->hp >= m_ptr->maxhp)
{
/* Fully healed */
_("%^sは完全に治った!", "%^s looks completely healed!"),
!seen, TARGET_TYPE);
}
-
- /* Partially healed */
else
{
monspell_message_base(target_ptr, m_idx, t_idx,
!seen, TARGET_TYPE);
}
- /* Redraw (later) if needed */
if (target_ptr->health_who == m_idx) target_ptr->redraw |= (PR_HEALTH);
if (target_ptr->riding == m_idx) target_ptr->redraw |= (PR_UHEALTH);
- /* Cancel fear */
if (!MON_MONFEAR(m_ptr)) return;
- /* Cancel fear */
(void)set_monster_monfear(target_ptr, m_idx, 0);
if (see_monster(floor_ptr, m_idx))
if (monster_to_player ||
(monster_to_monster && target_ptr->riding == t_idx))
{
- /* Mega hack -- this special action deals damage to the player. Therefore the code of "eyeeye" is necessary.
- -- henkma
- */
get_damage = take_hit(target_ptr, DAMAGE_NOESCAPE, dam, m_name, -1);
if (target_ptr->tim_eyeeye && get_damage > 0 && !target_ptr->is_dead)
{
GAME_TEXT m_name_self[80];
- /* hisself */
monster_desc(target_ptr, m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
-
msg_format(_("攻撃が%s自身を傷つけた!", "The attack of %s has wounded %s!"), m_name, m_name_self);
-
project(target_ptr, 0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
set_tim_eyeeye(target_ptr, target_ptr->tim_eyeeye - 5, TRUE);
}
switch (m_ptr->r_idx)
{
case MON_OHMU:
- /* Moved to process_monster(), like multiplication */
return -1;
case MON_BANORLUPART:
break;
}
- /* Something is wrong */
else return -1;
}
}
switch (SPELL_NUM)
{
- case MS_SHRIEK: return -1; /* RF4_SHRIEK */
- case MS_XXX1: return -1; /* RF4_XXX1 */
- case MS_DISPEL: return -1; /* RF4_DISPEL */
-
- /* RF4_ROCKET */
+ case MS_SHRIEK: return -1;
+ case MS_XXX1: return -1;
+ case MS_DISPEL: return -1;
case MS_ROCKET:
dam = (hp / 4) > 800 ? 800 : (hp / 4);
break;
-
- /* RF4_SHOOT */
case MS_SHOOT:
dice_num = shoot_dd;
dice_side = shoot_ds;
dam = shoot_base;
break;
- case MS_XXX2: return -1; /* RF4_XXX2 */
- case MS_XXX3: return -1; /* RF4_XXX3 */
- case MS_XXX4: return -1; /* RF4_XXX4 */
-
- /* RF4_BR_ACID */
- /* RF4_BR_ELEC */
- /* RF4_BR_FIRE */
- /* RF4_BR_COLD */
+ case MS_XXX2: return -1;
+ case MS_XXX3: return -1;
+ case MS_XXX4: return -1;
+
case MS_BR_ACID:
case MS_BR_ELEC:
case MS_BR_FIRE:
case MS_BR_COLD:
dam = ((hp / 3) > 1600 ? 1600 : (hp / 3));
break;
-
- /* RF4_BR_POIS */
case MS_BR_POIS:
dam = ((hp / 3) > 800 ? 800 : (hp / 3));
break;
-
- /* RF4_BR_NETH */
case MS_BR_NETHER:
dam = ((hp / 6) > 550 ? 550 : (hp / 6));
break;
-
- /* RF4_BR_LITE */
- /* RF4_BR_DARK */
case MS_BR_LITE:
case MS_BR_DARK:
dam = ((hp / 6) > 400 ? 400 : (hp / 6));
break;
-
- /* RF4_BR_CONF */
- /* RF4_BR_SOUN */
case MS_BR_CONF:
case MS_BR_SOUND:
dam = ((hp / 6) > 450 ? 450 : (hp / 6));
break;
-
- /* RF4_BR_CHAO */
case MS_BR_CHAOS:
dam = ((hp / 6) > 600 ? 600 : (hp / 6));
break;
-
- /* RF4_BR_DISE */
case MS_BR_DISEN:
dam = ((hp / 6) > 500 ? 500 : (hp / 6));
break;
-
- /* RF4_BR_NEXU */
case MS_BR_NEXUS:
dam = ((hp / 3) > 250 ? 250 : (hp / 3));
break;
-
- /* RF4_BR_TIME */
case MS_BR_TIME:
dam = ((hp / 3) > 150 ? 150 : (hp / 3));
break;
-
- /* RF4_BR_INER */
- /* RF4_BR_GRAV */
case MS_BR_INERTIA:
case MS_BR_GRAVITY:
dam = ((hp / 6) > 200 ? 200 : (hp / 6));
break;
-
- /* RF4_BR_SHAR */
case MS_BR_SHARDS:
dam = ((hp / 6) > 500 ? 500 : (hp / 6));
break;
-
- /* RF4_BR_PLAS */
case MS_BR_PLASMA:
dam = ((hp / 6) > 150 ? 150 : (hp / 6));
break;
-
- /* RF4_BR_WALL */
case MS_BR_FORCE:
dam = ((hp / 6) > 200 ? 200 : (hp / 6));
break;
-
- /* RF4_BR_MANA */
case MS_BR_MANA:
dam = ((hp / 3) > 250 ? 250 : (hp / 3));
break;
-
- /* RF4_BA_NUKE */
case MS_BALL_NUKE:
mult = powerful ? 2 : 1;
dam = rlev * (mult / div);
dice_num = 10;
dice_side = 6;
break;
-
- /* RF4_BR_NUKE */
case MS_BR_NUKE:
dam = ((hp / 3) > 800 ? 800 : (hp / 3));
break;
-
- /* RF4_BA_CHAO */
case MS_BALL_CHAOS:
dam = (powerful ? (rlev * 3) : (rlev * 2));
dice_num = 10;
dice_side = 10;
break;
-
- /* RF4_BR_DISI */
case MS_BR_DISI:
dam = ((hp / 6) > 150 ? 150 : (hp / 6));
break;
-
- /* RF5_BA_ACID */
case MS_BALL_ACID:
if (powerful)
{
}
break;
-
- /* RF5_BA_ELEC */
case MS_BALL_ELEC:
if (powerful)
{
}
break;
-
- /* RF5_BA_FIRE */
case MS_BALL_FIRE:
if (powerful)
{
}
break;
-
- /* RF5_BA_COLD */
case MS_BALL_COLD:
if (powerful)
{
}
break;
-
- /* RF5_BA_POIS */
case MS_BALL_POIS:
mult = powerful ? 2 : 1;
dice_num = 12;
dice_side = 2;
break;
-
- /* RF5_BA_NETH */
case MS_BALL_NETHER:
dam = 50 + rlev * (powerful ? 2 : 1);
dice_num = 10;
dice_side = 10;
break;
-
- /* RF5_BA_WATE */
case MS_BALL_WATER:
dam = 50;
dice_num = 1;
dice_side = powerful ? (rlev * 3) : (rlev * 2);
break;
-
- /* RF5_BA_MANA */
- /* RF5_BA_DARK */
case MS_BALL_MANA:
case MS_BALL_DARK:
dam = (rlev * 4) + 50;
dice_num = 10;
dice_side = 10;
break;
-
- /* RF5_DRAIN_MANA */
case MS_DRAIN_MANA:
dam = rlev;
div = 1;
dice_num = 1;
dice_side = rlev;
break;
-
- /* RF5_MIND_BLAST */
case MS_MIND_BLAST:
dice_num = 7;
dice_side = 7;
break;
-
- /* RF5_BRAIN_SMASH */
case MS_BRAIN_SMASH:
dice_num = 12;
dice_side = 12;
break;
-
- /* RF5_CAUSE_1 */
case MS_CAUSE_1:
dice_num = 3;
dice_side = 8;
break;
-
- /* RF5_CAUSE_2 */
case MS_CAUSE_2:
dice_num = 8;
dice_side = 8;
break;
-
- /* RF5_CAUSE_3 */
case MS_CAUSE_3:
dice_num = 10;
dice_side = 15;
break;
-
- /* RF5_CAUSE_4 */
case MS_CAUSE_4:
dice_num = 15;
dice_side = 15;
break;
-
- /* RF5_BO_ACID */
case MS_BOLT_ACID:
mult = powerful ? 2 : 1;
dam = rlev / 3 * (mult / div);
dice_num = 7;
dice_side = 8;
break;
-
- /* RF5_BO_ELEC */
case MS_BOLT_ELEC:
mult = powerful ? 2 : 1;
dam = rlev / 3 * (mult / div);
dice_num = 4;
dice_side = 8;
break;
-
- /* RF5_BO_FIRE */
case MS_BOLT_FIRE:
mult = powerful ? 2 : 1;
dam = rlev / 3 * (mult / div);
dice_num = 9;
dice_side = 8;
break;
-
- /* RF5_BO_COLD */
case MS_BOLT_COLD:
mult = powerful ? 2 : 1;
dam = rlev / 3 * (mult / div);
dice_num = 6;
dice_side = 8;
break;
-
- /* RF5_BA_LITE */
case MS_STARBURST:
dam = (rlev * 4) + 50;
dice_num = 10;
dice_side = 10;
break;
-
- /* RF5_BO_NETH */
case MS_BOLT_NETHER:
dam = 30 + (rlev * 4) / (powerful ? 2 : 3);
dice_num = 5;
dice_side = 5;
break;
-
- /* RF5_BO_WATE */
case MS_BOLT_WATER:
dam = (rlev * 3 / (powerful ? 2 : 3));
dice_num = 10;
dice_side = 10;
break;
-
- /* RF5_BO_MANA */
case MS_BOLT_MANA:
dam = 50;
dice_num = 1;
dice_side = rlev * 7 / 2;
break;
-
- /* RF5_BO_PLAS */
case MS_BOLT_PLASMA:
dam = 10 + (rlev * 3 / (powerful ? 2 : 3));
dice_num = 8;
dice_side = 7;
break;
-
- /* RF5_BO_ICEE */
case MS_BOLT_ICE:
dam = (rlev * 3 / (powerful ? 2 : 3));
dice_num = 6;
dice_side = 6;
break;
-
- /* RF5_MISSILE */
case MS_MAGIC_MISSILE:
dam = (rlev / 3);
dice_num = 2;
dice_side = 6;
break;
+ case MS_SCARE: return -1;
+ case MS_BLIND: return -1;
+ case MS_CONF: return -1;
+ case MS_SLOW: return -1;
+ case MS_SLEEP: return -1;
+ case MS_SPEED: return -1;
- case MS_SCARE: return -1; /* RF5_SCARE */
- case MS_BLIND: return -1; /* RF5_BLIND */
- case MS_CONF: return -1; /* RF5_CONF */
- case MS_SLOW: return -1; /* RF5_SLOW */
- case MS_SLEEP: return -1; /* RF5_HOLD */
- case MS_SPEED: return -1; /* RF6_HASTE */
-
- /* RF6_HAND_DOOM */
case MS_HAND_DOOM:
mult = target_ptr->chp;
div = 100;
dice_side = 20;
break;
- case MS_HEAL: return -1; /* RF6_HEAL */
- case MS_INVULNER: return -1; /* RF6_INVULNER */
- case MS_BLINK: return -1; /* RF6_BLINK */
- case MS_TELEPORT: return -1; /* RF6_TPORT */
- case MS_WORLD: return -1; /* RF6_WORLD */
- case MS_SPECIAL: return -1; /* RF6_SPECIAL */
- case MS_TELE_TO: return -1; /* RF6_TELE_TO */
- case MS_TELE_AWAY: return -1; /* RF6_TELE_AWAY */
- case MS_TELE_LEVEL: return -1; /* RF6_TELE_LEVEL */
-
- /* RF6_PSY_SPEAR */
+ case MS_HEAL: return -1;
+ case MS_INVULNER: return -1;
+ case MS_BLINK: return -1;
+ case MS_TELEPORT: return -1;
+ case MS_WORLD: return -1;
+ case MS_SPECIAL: return -1;
+ case MS_TELE_TO: return -1;
+ case MS_TELE_AWAY: return -1;
+ case MS_TELE_LEVEL: return -1;
+
case MS_PSY_SPEAR:
dam = powerful ? 150 : 100;
dice_num = 1;
dice_side = powerful ? (rlev * 2) : (rlev * 3 / 2);
break;
- case MS_DARKNESS: return -1; /* RF6_DARKNESS */
- case MS_MAKE_TRAP: return -1; /* RF6_TRAPS */
- case MS_FORGET: return -1; /* RF6_FORGET */
- case MS_RAISE_DEAD: return -1; /* RF6_RAISE_DEAD */
- case MS_S_KIN: return -1; /* RF6_S_KIN */
- case MS_S_CYBER: return -1; /* RF6_S_CYBER */
- case MS_S_MONSTER: return -1; /* RF6_S_MONSTER */
- case MS_S_MONSTERS: return -1; /* RF6_S_MONSTER */
- case MS_S_ANT: return -1; /* RF6_S_ANT */
- case MS_S_SPIDER: return -1; /* RF6_S_SPIDER */
- case MS_S_HOUND: return -1; /* RF6_S_HOUND */
- case MS_S_HYDRA: return -1; /* RF6_S_HYDRA */
- case MS_S_ANGEL: return -1; /* RF6_S_ANGEL */
- case MS_S_DEMON: return -1; /* RF6_S_DEMON */
- case MS_S_UNDEAD: return -1; /* RF6_S_UNDEAD */
- case MS_S_DRAGON: return -1; /* RF6_S_DRAGON */
- case MS_S_HI_UNDEAD: return -1; /* RF6_S_HI_UNDEAD */
- case MS_S_HI_DRAGON: return -1; /* RF6_S_HI_DRAGON */
- case MS_S_AMBERITE: return -1; /* RF6_S_AMBERITES */
- case MS_S_UNIQUE: return -1; /* RF6_S_UNIQUE */
+ case MS_DARKNESS: return -1;
+ case MS_MAKE_TRAP: return -1;
+ case MS_FORGET: return -1;
+ case MS_RAISE_DEAD: return -1;
+ case MS_S_KIN: return -1;
+ case MS_S_CYBER: return -1;
+ case MS_S_MONSTER: return -1;
+ case MS_S_MONSTERS: return -1;
+ case MS_S_ANT: return -1;
+ case MS_S_SPIDER: return -1;
+ case MS_S_HOUND: return -1;
+ case MS_S_HYDRA: return -1;
+ case MS_S_ANGEL: return -1;
+ case MS_S_DEMON: return -1;
+ case MS_S_UNDEAD: return -1;
+ case MS_S_DRAGON: return -1;
+ case MS_S_HI_UNDEAD: return -1;
+ case MS_S_HI_DRAGON: return -1;
+ case MS_S_AMBERITE: return -1;
+ case MS_S_UNIQUE: return -1;
}
return monspell_damage_roll(dam, dice_num, dice_side, mult, div, TYPE);
{
OBJECT_IDX this_o_idx, next_o_idx = 0;
OBJECT_IDX prev_o_idx = 0;
-
- /* Object */
object_type *j_ptr;
j_ptr = &floor_ptr->o_list[o_idx];
{
monster_type *m_ptr;
m_ptr = &floor_ptr->m_list[j_ptr->held_m_idx];
-
- /* Scan all objects in the grid */
for (this_o_idx = m_ptr->hold_o_idx; this_o_idx; this_o_idx = next_o_idx)
{
object_type *o_ptr;
o_ptr = &floor_ptr->o_list[this_o_idx];
next_o_idx = o_ptr->next_o_idx;
-
if (this_o_idx != o_idx)
{
prev_o_idx = this_o_idx;
continue;
}
- /* No previous */
if (prev_o_idx == 0)
{
- /* Remove from list */
m_ptr->hold_o_idx = next_o_idx;
}
-
- /* Real previous */
else
{
object_type *k_ptr;
-
- /* Previous object */
k_ptr = &floor_ptr->o_list[prev_o_idx];
-
- /* Remove from list */
k_ptr->next_o_idx = next_o_idx;
}
- /* Forget next pointer */
o_ptr->next_o_idx = 0;
-
break;
}
return;
}
- /* Dungeon */
grid_type *g_ptr;
-
POSITION y = j_ptr->iy;
POSITION x = j_ptr->ix;
-
g_ptr = &floor_ptr->grid_array[y][x];
-
- /* Scan all objects in the grid */
for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
{
object_type *o_ptr;
o_ptr = &floor_ptr->o_list[this_o_idx];
next_o_idx = o_ptr->next_o_idx;
-
if (this_o_idx != o_idx)
{
prev_o_idx = this_o_idx;
continue;
}
- /* No previous */
if (prev_o_idx == 0)
{
- /* Remove from list */
g_ptr->o_idx = next_o_idx;
}
-
- /* Real previous */
else
{
object_type *k_ptr;
-
- /* Previous object */
k_ptr = &floor_ptr->o_list[prev_o_idx];
-
- /* Remove from list */
k_ptr->next_o_idx = next_o_idx;
}
- /* Forget next pointer */
o_ptr->next_o_idx = 0;
-
break;
}
}
void delete_object_idx(player_type *player_ptr, OBJECT_IDX o_idx)
{
object_type *j_ptr;
-
- /* Excise */
floor_type *floor_ptr = player_ptr->current_floor_ptr;
excise_object_idx(floor_ptr, o_idx);
-
- /* Object */
j_ptr = &floor_ptr->o_list[o_idx];
-
- /* Dungeon floor */
if (!OBJECT_IS_HELD_MONSTER(j_ptr))
{
POSITION y, x;
{
grid_type *g_ptr;
OBJECT_IDX this_o_idx, next_o_idx = 0;
-
- /* Refuse "illegal" locations */
floor_type *floor_ptr = player_ptr->current_floor_ptr;
if (!in_bounds(floor_ptr, y, x)) return;
g_ptr = &floor_ptr->grid_array[y][x];
-
- /* Scan all objects in the grid */
for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
{
object_type *o_ptr;
*/
OBJECT_IDX o_pop(floor_type *floor_ptr)
{
- OBJECT_IDX i;
-
- /* Initial allocation */
if (floor_ptr->o_max < current_world_ptr->max_o_idx)
{
- /* Get next space */
- i = floor_ptr->o_max;
-
- /* Expand object array */
+ OBJECT_IDX i = floor_ptr->o_max;
floor_ptr->o_max++;
floor_ptr->o_cnt++;
-
- /* Use this object */
return i;
}
-
- /* Recycle dead objects */
- for (i = 1; i < floor_ptr->o_max; i++)
+ for (OBJECT_IDX i = 1; i < floor_ptr->o_max; i++)
{
object_type *o_ptr;
o_ptr = &floor_ptr->o_list[i];
-
- /* Skip live objects */
if (o_ptr->k_idx) continue;
floor_ptr->o_cnt++;
- /* Use this object */
return i;
}
- /* Warn the player (except during dungeon creation) */
- if (current_world_ptr->character_dungeon) msg_print(_("アイテムが多すぎる!", "Too many objects!"));
+ if (current_world_ptr->character_dungeon)
+ msg_print(_("アイテムが多すぎる!", "Too many objects!"));
return 0;
}
*/
static errr get_obj_num_prep(void)
{
- int i;
-
- /* Get the entry */
alloc_entry *table = alloc_kind_table;
-
- /* Scan the allocation table */
- for (i = 0; i < alloc_kind_size; i++)
+ for (OBJECT_IDX i = 0; i < alloc_kind_size; i++)
{
- /* Accept objects which pass the restriction, if any */
if (!get_obj_num_hook || (*get_obj_num_hook)(table[i].index))
{
- /* Accept this object */
table[i].prob2 = table[i].prob1;
}
-
- /* Do not use this object */
else
{
- /* Decline this object */
table[i].prob2 = 0;
}
}
if (level > MAX_DEPTH - 1) level = MAX_DEPTH - 1;
- /* Boost level */
if ((level > 0) && !(d_info[owner_ptr->dungeon_idx].flags1 & DF1_BEGINNER))
{
- /* Occasional "boost" */
if (one_in_(GREAT_OBJ))
{
- /* What a bizarre calculation */
level = 1 + (level * MAX_DEPTH / randint1(MAX_DEPTH));
}
}
- /* Reset total */
total = 0L;
-
- /* Process probabilities */
for (i = 0; i < alloc_kind_size; i++)
{
- /* Objects are sorted by depth */
if (table[i].level > level) break;
- /* Default */
table[i].prob3 = 0;
-
k_idx = table[i].index;
-
- /* Access the actual kind */
k_ptr = &k_info[k_idx];
if ((mode & AM_FORBID_CHEST) && (k_ptr->tval == TV_CHEST)) continue;
- /* Accept */
table[i].prob3 = table[i].prob2;
-
- /* Total */
total += table[i].prob3;
}
- /* No legal objects */
if (total <= 0) return 0;
-
- /* Pick an object */
value = randint0(total);
-
- /* Find the object */
for (i = 0; i < alloc_kind_size; i++)
{
- /* Found the entry */
if (value < table[i].prob3) break;
- /* Decrement */
value = value - table[i].prob3;
}
- /* Power boost */
p = randint0(100);
-
- /* Try for a "better" object once (50%) or twice (10%) */
if (p < 60)
{
- /* Save old */
j = i;
-
- /* Pick a object */
value = randint0(total);
-
- /* Find the object */
for (i = 0; i < alloc_kind_size; i++)
{
- /* Found the entry */
if (value < table[i].prob3) break;
- /* Decrement */
value = value - table[i].prob3;
}
- /* Keep the "best" one */
if (table[i].level < table[j].level) i = j;
}
- /* Try for a "better" object twice (10%) */
if (p >= 10) return (table[i].index);
- /* Save old */
j = i;
-
- /* Pick a object */
value = randint0(total);
-
- /* Find the object */
for (i = 0; i < alloc_kind_size; i++)
{
- /* Found the entry */
if (value < table[i].prob3) break;
- /* Decrement */
value = value - table[i].prob3;
}
- /* Keep the "best" one */
if (table[i].level < table[j].level) i = j;
return (table[i].index);
}
*/
void object_known(object_type *o_ptr)
{
- /* Remove "default inscriptions" */
o_ptr->feeling = FEEL_NONE;
-
- /* Clear the "Felt" info */
o_ptr->ident &= ~(IDENT_SENSE);
-
- /* Clear the "Empty" info */
o_ptr->ident &= ~(IDENT_EMPTY);
-
- /* Now we know about the item */
o_ptr->ident |= (IDENT_KNOWN);
}
*/
void object_aware(player_type *owner_ptr, object_type *o_ptr)
{
- /* Fully aware of the effects */
k_info[o_ptr->k_idx].aware = TRUE;
bool mihanmei = !object_is_aware(o_ptr);
*/
void object_tried(object_type *o_ptr)
{
- /* Mark it as tried (even if "aware") */
k_info[o_ptr->k_idx].tried = TRUE;
}
*/
byte value_check_aux1(object_type *o_ptr)
{
- /* Artifacts */
if (object_is_artifact(o_ptr))
{
- /* Cursed/Broken */
if (object_is_cursed(o_ptr) || object_is_broken(o_ptr)) return FEEL_TERRIBLE;
- /* Normal */
return FEEL_SPECIAL;
}
- /* Ego-Items */
if (object_is_ego(o_ptr))
{
- /* Cursed/Broken */
if (object_is_cursed(o_ptr) || object_is_broken(o_ptr)) return FEEL_WORTHLESS;
- /* Normal */
return FEEL_EXCELLENT;
}
- /* Cursed items */
if (object_is_cursed(o_ptr)) return FEEL_CURSED;
-
- /* Broken items */
if (object_is_broken(o_ptr)) return FEEL_BROKEN;
-
if ((o_ptr->tval == TV_RING) || (o_ptr->tval == TV_AMULET)) return FEEL_AVERAGE;
-
- /* Good "armor" bonus */
if (o_ptr->to_a > 0) return FEEL_GOOD;
-
- /* Good "weapon" bonus */
if (o_ptr->to_h + o_ptr->to_d > 0) return FEEL_GOOD;
- /* Default to "average" */
return FEEL_AVERAGE;
}
*/
byte value_check_aux2(object_type *o_ptr)
{
- /* Cursed items (all of them) */
if (object_is_cursed(o_ptr)) return FEEL_CURSED;
-
- /* Broken items (all of them) */
if (object_is_broken(o_ptr)) return FEEL_BROKEN;
-
- /* Artifacts -- except cursed/broken ones */
if (object_is_artifact(o_ptr)) return FEEL_UNCURSED;
-
- /* Ego-Items -- except cursed/broken ones */
if (object_is_ego(o_ptr)) return FEEL_UNCURSED;
-
- /* Good armor bonus */
if (o_ptr->to_a > 0) return FEEL_UNCURSED;
-
- /* Good weapon bonuses */
if (o_ptr->to_h + o_ptr->to_d > 0) return FEEL_UNCURSED;
- /* No feeling */
return FEEL_NONE;
}
*/
static PRICE object_value_base(object_type *o_ptr)
{
- /* Aware item -- use template cost */
- if (object_is_aware(o_ptr)) return (k_info[o_ptr->k_idx].cost);
+ if (object_is_aware(o_ptr))
+ return (k_info[o_ptr->k_idx].cost);
- /* Analyze the type */
switch (o_ptr->tval)
{
-
- /* Un-aware Food */
case TV_FOOD: return (5L);
-
- /* Un-aware Potions */
case TV_POTION: return (20L);
-
- /* Un-aware Scrolls */
case TV_SCROLL: return (20L);
-
- /* Un-aware Staffs */
case TV_STAFF: return (70L);
-
- /* Un-aware Wands */
case TV_WAND: return (50L);
-
- /* Un-aware Rods */
case TV_ROD: return (90L);
-
- /* Un-aware Rings */
case TV_RING: return (45L);
-
- /* Un-aware Amulets */
case TV_AMULET: return (45L);
-
- /* Figurines, relative to monster level */
case TV_FIGURINE:
{
DEPTH level = r_info[o_ptr->pval].level;
else if (level < 50) return 6000 + (level - 40) * 800L;
else return 14000 + (level - 50) * 2000L;
}
-
case TV_CAPTURE:
if (!o_ptr->pval) return 1000L;
else return ((r_info[o_ptr->pval].level) * 50L + 1000);
}
- /* Paranoia -- Oops */
return (0L);
}
{
PRICE total = 0;
BIT_FLAGS flgs[TR_FLAG_SIZE];
- PRICE tmp_cost;
- int count;
- int i;
object_kind *k_ptr = &k_info[o_ptr->k_idx];
-
object_flags(o_ptr, flgs);
/*
* Exclude fixed flags of the base item.
* pval bonuses of base item will be treated later.
*/
- for (i = 0; i < TR_FLAG_SIZE; i++)
+ for (int i = 0; i < TR_FLAG_SIZE; i++)
flgs[i] &= ~(k_ptr->flags[i]);
- /* Exclude fixed flags of the fixed artifact. */
if (object_is_fixed_artifact(o_ptr))
{
artifact_type *a_ptr = &a_info[o_ptr->name1];
- for (i = 0; i < TR_FLAG_SIZE; i++)
+ for (int i = 0; i < TR_FLAG_SIZE; i++)
flgs[i] &= ~(a_ptr->flags[i]);
}
-
- /* Exclude fixed flags of the ego-item. */
else if (object_is_ego(o_ptr))
{
ego_item_type *e_ptr = &e_info[o_ptr->name2];
- for (i = 0; i < TR_FLAG_SIZE; i++)
+ for (int i = 0; i < TR_FLAG_SIZE; i++)
flgs[i] &= ~(e_ptr->flags[i]);
}
-
/*
* Calucurate values of remaining flags
*/
if ((have_flag(flgs, TR_BLOWS)) && (plusses > 0))
total += (10000 + (2500 * plusses));
- tmp_cost = 0;
- count = 0;
+ PRICE tmp_cost = 0;
+ int count = 0;
if (have_flag(flgs, TR_CHAOTIC)) { total += 5000; count++; }
if (have_flag(flgs, TR_VAMPIRIC)) { total += 6500; count++; }
if (have_flag(flgs, TR_FORCE_WEAPON)) { tmp_cost += 2500; count++; }
else
total += 250;
}
+
if (have_flag(flgs, TR_AGGRAVATE)) total -= 10000;
if (have_flag(flgs, TR_BLESSED)) total += 750;
if (o_ptr->curse_flags & TR_ADD_L_CURSE) total -= 5000;
*/
PRICE object_value_real(object_type *o_ptr)
{
- PRICE value;
BIT_FLAGS flgs[TR_FLAG_SIZE];
object_kind *k_ptr = &k_info[o_ptr->k_idx];
-
- /* Hack -- "worthless" items */
if (!k_info[o_ptr->k_idx].cost) return (0L);
- /* Base cost */
- value = k_info[o_ptr->k_idx].cost;
-
- /* Extract some flags */
+ PRICE value = k_info[o_ptr->k_idx].cost;
object_flags(o_ptr, flgs);
-
- /* Artifact */
if (object_is_fixed_artifact(o_ptr))
{
artifact_type *a_ptr = &a_info[o_ptr->name1];
-
- /* Hack -- "worthless" artifacts */
if (!a_ptr->cost) return (0L);
- /* Hack -- Use the artifact cost instead */
value = a_ptr->cost;
value += flag_cost(o_ptr, o_ptr->pval);
-
- /* Don't add pval bonuses etc. */
return (value);
}
-
- /* Ego-Item */
else if (object_is_ego(o_ptr))
{
ego_item_type *e_ptr = &e_info[o_ptr->name2];
-
- /* Hack -- "worthless" ego-items */
if (!e_ptr->cost) return (0L);
- /* Hack -- Reward the ego-item with a bonus */
value += e_ptr->cost;
value += flag_cost(o_ptr, o_ptr->pval);
}
-
else
{
- int i;
bool flag = FALSE;
-
- for (i = 0; i < TR_FLAG_SIZE; i++)
+ for (int i = 0; i < TR_FLAG_SIZE; i++)
if (o_ptr->art_flags[i]) flag = TRUE;
if (flag) value += flag_cost(o_ptr, o_ptr->pval);
case TV_LITE:
case TV_AMULET:
case TV_RING:
- /* No pval */
if (!o_ptr->pval) break;
-
- /* Hack -- Negative "pval" is always bad */
if (o_ptr->pval < 0) return (0L);
- /* Give credit for stat bonuses */
if (have_flag(flgs, TR_STR)) value += (o_ptr->pval * 200L);
if (have_flag(flgs, TR_INT)) value += (o_ptr->pval * 200L);
if (have_flag(flgs, TR_WIS)) value += (o_ptr->pval * 200L);
if (have_flag(flgs, TR_DEX)) value += (o_ptr->pval * 200L);
if (have_flag(flgs, TR_CON)) value += (o_ptr->pval * 200L);
if (have_flag(flgs, TR_CHR)) value += (o_ptr->pval * 200L);
-
- /* Give credit for stealth and searching */
if (have_flag(flgs, TR_MAGIC_MASTERY)) value += (o_ptr->pval * 100);
if (have_flag(flgs, TR_STEALTH)) value += (o_ptr->pval * 100L);
if (have_flag(flgs, TR_SEARCH)) value += (o_ptr->pval * 100L);
-
- /* Give credit for infra-vision and tunneling */
if (have_flag(flgs, TR_INFRA)) value += (o_ptr->pval * 50L);
if (have_flag(flgs, TR_TUNNEL)) value += (o_ptr->pval * 50L);
-
- /* Give credit for extra attacks */
if (have_flag(flgs, TR_BLOWS)) value += (o_ptr->pval * 5000L);
-
- /* Give credit for speed bonus */
if (have_flag(flgs, TR_SPEED)) value += (o_ptr->pval * 10000L);
-
break;
}
-
- /* Analyze the item */
switch (o_ptr->tval)
{
- /* Wands/Staffs */
case TV_WAND:
{
/* Pay extra for charges, depending on standard number of
* charges. Handle new-style wands correctly. -LM-
*/
value += (value * o_ptr->pval / o_ptr->number / (k_ptr->pval * 2));
-
break;
}
case TV_STAFF:
* charges. -LM-
*/
value += (value * o_ptr->pval / (k_ptr->pval * 2));
-
break;
}
-
- /* Rings/Amulets */
case TV_RING:
case TV_AMULET:
{
- /* Hack -- negative bonuses are bad */
if (o_ptr->to_h + o_ptr->to_d + o_ptr->to_a < 0) return (0L);
- /* Give credit for bonuses */
value += ((o_ptr->to_h + o_ptr->to_d + o_ptr->to_a) * 200L);
-
break;
}
-
- /* Armor */
case TV_BOOTS:
case TV_GLOVES:
case TV_CLOAK:
case TV_HARD_ARMOR:
case TV_DRAG_ARMOR:
{
- /* Hack -- negative armor bonus */
if (o_ptr->to_a < 0) return (0L);
- /* Give credit for bonuses */
value += (((o_ptr->to_h - k_ptr->to_h) + (o_ptr->to_d - k_ptr->to_d)) * 200L + (o_ptr->to_a) * 100L);
-
break;
}
-
- /* Bows/Weapons */
case TV_BOW:
case TV_DIGGING:
case TV_HAFTED:
case TV_SWORD:
case TV_POLEARM:
{
- /* Hack -- negative hit/damage bonuses */
if (o_ptr->to_h + o_ptr->to_d < 0) return (0L);
- /* Factor in the bonuses */
value += ((o_ptr->to_h + o_ptr->to_d + o_ptr->to_a) * 100L);
-
- /* Hack -- Factor in extra damage dice and sides */
value += (o_ptr->dd - k_ptr->dd) * o_ptr->ds * 250L;
value += (o_ptr->ds - k_ptr->ds) * o_ptr->dd * 250L;
-
break;
}
-
- /* Ammo */
case TV_SHOT:
case TV_ARROW:
case TV_BOLT:
{
- /* Hack -- negative hit/damage bonuses */
if (o_ptr->to_h + o_ptr->to_d < 0) return (0L);
- /* Factor in the bonuses */
value += ((o_ptr->to_h + o_ptr->to_d) * 5L);
-
- /* Hack -- Factor in extra damage dice and sides */
value += (o_ptr->dd - k_ptr->dd) * o_ptr->ds * 5L;
value += (o_ptr->ds - k_ptr->ds) * o_ptr->dd * 5L;
-
break;
}
-
- /* Figurines, relative to monster level */
case TV_FIGURINE:
{
DEPTH level = r_info[o_ptr->pval].level;
else value = 14000 + (level - 50) * 2000L;
break;
}
-
case TV_CAPTURE:
{
if (!o_ptr->pval) value = 1000L;
else value = ((r_info[o_ptr->pval].level) * 50L + 1000);
break;
}
-
case TV_CHEST:
{
if (!o_ptr->pval) value = 0L;
}
}
- /* Worthless object */
if (value < 0) return 0L;
- /* Return the value */
return (value);
}
{
PRICE value;
- /* Unknown items -- acquire a base value */
if (object_is_known(o_ptr))
{
- /* Broken items -- worthless */
if (object_is_broken(o_ptr)) return (0L);
-
- /* Cursed items -- worthless */
if (object_is_cursed(o_ptr)) return (0L);
- /* Real value (see above) */
value = object_value_real(o_ptr);
}
-
- /* Known items -- acquire the actual value */
else
{
- /* Hack -- Felt broken items */
if ((o_ptr->ident & (IDENT_SENSE)) && object_is_broken(o_ptr)) return (0L);
-
- /* Hack -- Felt cursed items */
if ((o_ptr->ident & (IDENT_SENSE)) && object_is_cursed(o_ptr)) return (0L);
- /* Base value (see above) */
value = object_value_base(o_ptr);
}
- /* Apply discount (if any) */
if (o_ptr->discount) value -= (value * o_ptr->discount / 100L);
- /* Return the final value */
return (value);
}
q_ptr->pval = o_ptr->pval * amt / o_ptr->number;
if (amt < o_ptr->number) o_ptr->pval -= q_ptr->pval;
- /* Hack -- Rods also need to have their timeouts distributed. The
- * dropped stack will accept all time remaining to charge up to its
- * maximum.
- */
if ((o_ptr->tval != TV_ROD) || !o_ptr->timeout) return;
if (q_ptr->pval > o_ptr->timeout)
*/
int object_similar_part(object_type *o_ptr, object_type *j_ptr)
{
- int i;
-
- /* Default maximum number of stack */
int max_num = MAX_STACK_SIZE;
-
- /* Require identical object types */
if (o_ptr->k_idx != j_ptr->k_idx) return 0;
-
- /* Analyze the items */
switch (o_ptr->tval)
{
- /* Chests and Statues*/
case TV_CHEST:
case TV_CARD:
case TV_CAPTURE:
{
- /* Never okay */
return 0;
}
-
case TV_STATUE:
{
if ((o_ptr->sval != SV_PHOTO) || (j_ptr->sval != SV_PHOTO)) return 0;
if (o_ptr->pval != j_ptr->pval) return 0;
break;
}
-
- /* Figurines and Corpses*/
case TV_FIGURINE:
case TV_CORPSE:
{
- /* Same monster */
if (o_ptr->pval != j_ptr->pval) return 0;
- /* Assume okay */
break;
}
-
- /* Food and Potions and Scrolls */
case TV_FOOD:
case TV_POTION:
case TV_SCROLL:
{
- /* Assume okay */
break;
}
-
- /* Staffs */
case TV_STAFF:
{
- /* Require either knowledge or known empty for both staffs. */
if ((!(o_ptr->ident & (IDENT_EMPTY)) &&
!object_is_known(o_ptr)) ||
(!(j_ptr->ident & (IDENT_EMPTY)) &&
!object_is_known(j_ptr))) return 0;
- /* Require identical charges, since staffs are bulky. */
if (o_ptr->pval != j_ptr->pval) return 0;
- /* Assume okay */
break;
}
-
- /* Wands */
case TV_WAND:
{
- /* Require either knowledge or known empty for both wands. */
if ((!(o_ptr->ident & (IDENT_EMPTY)) &&
!object_is_known(o_ptr)) ||
(!(j_ptr->ident & (IDENT_EMPTY)) &&
!object_is_known(j_ptr))) return 0;
- /* Wand charges combine in O&ZAngband. */
-
- /* Assume okay */
break;
}
-
- /* Staffs and Wands and Rods */
case TV_ROD:
{
- /* Prevent overflaw of timeout */
max_num = MIN(max_num, MAX_SHORT / k_info[o_ptr->k_idx].pval);
-
- /* Assume okay */
break;
}
-
- /* Weapons and Armor */
case TV_BOW:
case TV_DIGGING:
case TV_HAFTED:
case TV_SOFT_ARMOR:
case TV_HARD_ARMOR:
case TV_DRAG_ARMOR:
-
- /* Rings, Amulets, Lites */
case TV_RING:
case TV_AMULET:
case TV_LITE:
case TV_WHISTLE:
{
- /* Require full knowledge of both items */
if (!object_is_known(o_ptr) || !object_is_known(j_ptr)) return 0;
-
- /* Fall through */
}
-
- /* Missiles */
case TV_BOLT:
case TV_ARROW:
case TV_SHOT:
{
- /* Require identical knowledge of both items */
if (object_is_known(o_ptr) != object_is_known(j_ptr)) return 0;
if (o_ptr->feeling != j_ptr->feeling) return 0;
-
- /* Require identical "bonuses" */
if (o_ptr->to_h != j_ptr->to_h) return 0;
if (o_ptr->to_d != j_ptr->to_d) return 0;
if (o_ptr->to_a != j_ptr->to_a) return 0;
-
- /* Require identical "pval" code */
if (o_ptr->pval != j_ptr->pval) return 0;
-
- /* Artifacts never stack */
if (object_is_artifact(o_ptr) || object_is_artifact(j_ptr)) return 0;
-
- /* Require identical "ego-item" names */
if (o_ptr->name2 != j_ptr->name2) return 0;
-
- /* Require identical added essence */
if (o_ptr->xtra3 != j_ptr->xtra3) return 0;
if (o_ptr->xtra4 != j_ptr->xtra4) return 0;
-
- /* Hack -- Never stack "powerful" items */
if (o_ptr->xtra1 || j_ptr->xtra1) return 0;
-
- /* Hack -- Never stack recharging items */
if (o_ptr->timeout || j_ptr->timeout) return 0;
-
- /* Require identical "values" */
if (o_ptr->ac != j_ptr->ac) return 0;
if (o_ptr->dd != j_ptr->dd) return 0;
if (o_ptr->ds != j_ptr->ds) return 0;
-
- /* Probably okay */
break;
}
-
- /* Various */
default:
{
- /* Require knowledge */
if (!object_is_known(o_ptr) || !object_is_known(j_ptr)) return 0;
- /* Probably okay */
break;
}
}
-
- /* Hack -- Identical art_flags! */
- for (i = 0; i < TR_FLAG_SIZE; i++)
+ for (int i = 0; i < TR_FLAG_SIZE; i++)
if (o_ptr->art_flags[i] != j_ptr->art_flags[i]) return 0;
- /* Hack -- Require identical "cursed" status */
if (o_ptr->curse_flags != j_ptr->curse_flags) return 0;
-
- /* Hack -- Require identical "broken" status */
if ((o_ptr->ident & (IDENT_BROKEN)) != (j_ptr->ident & (IDENT_BROKEN))) return 0;
-
- /* Hack -- require semi-matching "inscriptions" */
if (o_ptr->inscription && j_ptr->inscription &&
(o_ptr->inscription != j_ptr->inscription))
return 0;
- /* Hack -- normally require matching "inscriptions" */
if (!stack_force_notes && (o_ptr->inscription != j_ptr->inscription)) return 0;
-
- /* Hack -- normally require matching "discounts" */
if (!stack_force_costs && (o_ptr->discount != j_ptr->discount)) return 0;
-
- /* They match, so they must be similar */
return max_num;
}
bool object_similar(object_type *o_ptr, object_type *j_ptr)
{
int total = o_ptr->number + j_ptr->number;
- int max_num;
-
- /* Are these objects similar? */
- max_num = object_similar_part(o_ptr, j_ptr);
-
- /* Return if not similar */
+ int max_num = object_similar_part(o_ptr, j_ptr);
if (!max_num) return FALSE;
-
- /* Maximal "stacking" limit */
if (total > max_num) return 0;
-
- /* They match, so they must be similar */
return TRUE;
}
int total = o_ptr->number + j_ptr->number;
int diff = (total > max_num) ? total - max_num : 0;
- /* Combine quantity, lose excess items */
o_ptr->number = (total > max_num) ? max_num : total;
-
- /* Hack -- blend "known" status */
if (object_is_known(j_ptr)) object_known(o_ptr);
- /* Hack -- clear "storebought" if only one has it */
if (((o_ptr->ident & IDENT_STORE) || (j_ptr->ident & IDENT_STORE)) &&
(!((o_ptr->ident & IDENT_STORE) && (j_ptr->ident & IDENT_STORE))))
{
if (o_ptr->ident & IDENT_STORE) o_ptr->ident &= 0xEF;
}
- /* Hack -- blend "mental" status */
if (j_ptr->ident & (IDENT_MENTAL)) o_ptr->ident |= (IDENT_MENTAL);
-
- /* Hack -- blend "inscriptions" */
if (j_ptr->inscription) o_ptr->inscription = j_ptr->inscription;
-
- /* Hack -- blend "feelings" */
if (j_ptr->feeling) o_ptr->feeling = j_ptr->feeling;
-
- /* Hack -- could average discounts */
- /* Hack -- save largest discount */
if (o_ptr->discount < j_ptr->discount) o_ptr->discount = j_ptr->discount;
-
- /* Hack -- if rods are stacking, add the pvals (maximum timeouts) and current timeouts together. -LM- */
if (o_ptr->tval == TV_ROD)
{
o_ptr->pval += j_ptr->pval * (j_ptr->number - diff) / j_ptr->number;
o_ptr->timeout += j_ptr->timeout * (j_ptr->number - diff) / j_ptr->number;
}
- /* Hack -- if wands are stacking, combine the charges. -LM- */
if (o_ptr->tval == TV_WAND)
{
o_ptr->pval += j_ptr->pval * (j_ptr->number - diff) / j_ptr->number;
*/
KIND_OBJECT_IDX lookup_kind(OBJECT_TYPE_VALUE tval, OBJECT_SUBTYPE_VALUE sval)
{
- KIND_OBJECT_IDX k;
int num = 0;
KIND_OBJECT_IDX bk = 0;
- /* Look for it */
- for (k = 1; k < max_k_idx; k++)
+ for (KIND_OBJECT_IDX k = 1; k < max_k_idx; k++)
{
object_kind *k_ptr = &k_info[k];
-
- /* Require correct tval */
if (k_ptr->tval != tval) continue;
-
- /* Found a match */
if (k_ptr->sval == sval) return (k);
-
- /* Ignore illegal items */
if (sval != SV_ANY) continue;
-
- /* Apply the randomizer */
if (!one_in_(++num)) continue;
- /* Use this value */
bk = k;
}
- /* Return this choice */
if (sval == SV_ANY)
{
return bk;
*/
void object_wipe(object_type *o_ptr)
{
- /* Wipe the structure */
(void)WIPE(o_ptr, object_type);
}
*/
void object_copy(object_type *o_ptr, object_type *j_ptr)
{
- /* Copy the structure */
(void)COPY(o_ptr, j_ptr, object_type);
}
void object_prep(object_type *o_ptr, KIND_OBJECT_IDX k_idx)
{
object_kind *k_ptr = &k_info[k_idx];
-
- /* Clear the record */
object_wipe(o_ptr);
-
- /* Save the kind index */
o_ptr->k_idx = k_idx;
-
- /* Efficiency -- tval/sval */
o_ptr->tval = k_ptr->tval;
o_ptr->sval = k_ptr->sval;
-
- /* Default "pval" */
o_ptr->pval = k_ptr->pval;
-
- /* Default number */
o_ptr->number = 1;
-
- /* Default weight */
o_ptr->weight = k_ptr->weight;
-
- /* Default magic */
o_ptr->to_h = k_ptr->to_h;
o_ptr->to_d = k_ptr->to_d;
o_ptr->to_a = k_ptr->to_a;
-
- /* Default power */
o_ptr->ac = k_ptr->ac;
o_ptr->dd = k_ptr->dd;
o_ptr->ds = k_ptr->ds;
- /* Default activation */
if (k_ptr->act_idx > 0) o_ptr->xtra2 = (XTRA8)k_ptr->act_idx;
-
- /* Hack -- worthless items are always "broken" */
if (k_info[o_ptr->k_idx].cost <= 0) o_ptr->ident |= (IDENT_BROKEN);
- /* Hack -- cursed items are always "cursed" */
if (k_ptr->gen_flags & (TRG_CURSED)) o_ptr->curse_flags |= (TRC_CURSED);
if (k_ptr->gen_flags & (TRG_HEAVY_CURSE)) o_ptr->curse_flags |= (TRC_HEAVY_CURSE);
if (k_ptr->gen_flags & (TRG_PERMA_CURSE)) o_ptr->curse_flags |= (TRC_PERMA_CURSE);
*/
static void object_mention(player_type *owner_ptr, object_type *o_ptr)
{
- GAME_TEXT o_name[MAX_NLEN];
-
object_aware(owner_ptr, o_ptr);
object_known(o_ptr);
- /* Mark the item as fully known */
o_ptr->ident |= (IDENT_MENTAL);
+ GAME_TEXT o_name[MAX_NLEN];
object_desc(owner_ptr, o_name, o_ptr, 0);
msg_format_wizard(CHEAT_OBJECT, _("%sを生成しました。", "%s was generated."), o_name);
}
/*!
+ *
* @brief アイテムのエゴをレア度の重みに合わせてランダムに選択する
* Choose random ego type
* @param slot 取得したいエゴの装備部位
*/
static byte get_random_ego(byte slot, bool good)
{
- ego_item_type *e_ptr;
-
long total = 0L;
-
for (int i = 1; i < max_e_idx; i++)
{
+ ego_item_type *e_ptr;
e_ptr = &e_info[i];
-
if (e_ptr->slot == slot
&& ((good && e_ptr->rating) || (!good && !e_ptr->rating)))
{
}
int value = randint1(total);
-
int j;
for (j = 1; j < max_e_idx; j++)
{
+ ego_item_type *e_ptr;
e_ptr = &e_info[j];
-
if (e_ptr->slot == slot
&& ((good && e_ptr->rating) || (!good && !e_ptr->rating)))
{
todam2 = (todam2 + 1) / 2;
}
- /* Good */
if (power > 0)
{
- /* Enchant */
o_ptr->to_h += tohit1;
o_ptr->to_d += todam1;
-
- /* Very good */
if (power > 1)
{
- /* Enchant again */
o_ptr->to_h += tohit2;
o_ptr->to_d += todam2;
}
}
-
- /* Cursed */
else if (power < 0)
{
- /* Penalize */
o_ptr->to_h -= tohit1;
o_ptr->to_d -= todam1;
-
- /* Very cursed */
if (power < -1)
{
- /* Penalize again */
o_ptr->to_h -= tohit2;
o_ptr->to_d -= todam2;
}
- /* Cursed (if "bad") */
- if (o_ptr->to_h + o_ptr->to_d < 0) o_ptr->curse_flags |= TRC_CURSED;
+ if (o_ptr->to_h + o_ptr->to_d < 0)
+ o_ptr->curse_flags |= TRC_CURSED;
}
if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DIAMOND_EDGE)) return;
{
case TV_DIGGING:
{
- /* Very good */
if (power > 1)
{
- if (one_in_(30) || (power > 2)) /* power > 2 is debug only */
+ /* power > 2 is debug only */
+ if (one_in_(30) || (power > 2))
become_random_artifact(owner_ptr, o_ptr, FALSE);
else
- /* Special Ego-item */
o_ptr->name2 = EGO_DIGGING;
}
-
- /* Very bad */
else if (power < -1)
{
- /* Hack -- Horrible digging bonus */
o_ptr->pval = 0 - (5 + randint1(5));
}
-
- /* Bad */
else if (power < 0)
{
- /* Hack -- Reverse digging bonus */
o_ptr->pval = 0 - (o_ptr->pval);
}
break;
}
-
case TV_HAFTED:
case TV_POLEARM:
case TV_SWORD:
{
- /* Very Good */
if (power > 1)
{
- if (one_in_(40) || (power > 2)) /* power > 2 is debug only */
+ /* power > 2 is debug only */
+ if (one_in_(40) || (power > 2))
{
become_random_artifact(owner_ptr, o_ptr, FALSE);
break;
}
while (TRUE)
{
- /* Roll for an ego-item */
o_ptr->name2 = get_random_ego(INVEN_RARM, TRUE);
if (o_ptr->name2 == EGO_SHARPNESS && o_ptr->tval != TV_SWORD)
continue;
add_flag(o_ptr->art_flags, TR_RES_FEAR);
break;
case EGO_SLAYING_WEAPON:
- if (one_in_(3)) /* double damage */
+ if (one_in_(3))
o_ptr->dd *= 2;
else
{
if (!o_ptr->art_name)
{
- /* Hack -- Super-charge the damage dice */
- while (one_in_(10L * o_ptr->dd * o_ptr->ds)) o_ptr->dd++;
+ while (one_in_(10L * o_ptr->dd * o_ptr->ds))
+ o_ptr->dd++;
- /* Hack -- Lower the damage dice */
if (o_ptr->dd > 9) o_ptr->dd = 9;
}
}
-
- /* Very cursed */
else if (power < -1)
{
- /* Roll for ego-item */
if (randint0(MAX_DEPTH) < level)
{
while (TRUE)
{
continue;
}
+
break;
}
+
switch (o_ptr->name2)
{
case EGO_MORGUL:
break;
}
-
-
case TV_BOW:
{
- /* Very good */
if (power > 1)
{
- if (one_in_(20) || (power > 2)) /* power > 2 is debug only */
+ /* power > 2 is debug only */
+ if (one_in_(20) || (power > 2))
{
become_random_artifact(owner_ptr, o_ptr, FALSE);
break;
}
+
o_ptr->name2 = get_random_ego(INVEN_BOW, TRUE);
}
break;
}
-
-
case TV_BOLT:
case TV_ARROW:
case TV_SHOT:
{
- /* Very good */
if (power > 1)
{
- if (power > 2) /* power > 2 is debug only */
+ /* power > 2 is debug only */
+ if (power > 2)
{
become_random_artifact(owner_ptr, o_ptr, FALSE);
break;
}
o_ptr->name2 = get_random_ego(INVEN_AMMO, TRUE);
-
switch (o_ptr->name2)
{
case EGO_SLAYING_BOLT:
break;
}
- /* Hack -- super-charge the damage dice */
- while (one_in_(10L * o_ptr->dd * o_ptr->ds)) o_ptr->dd++;
+ while (one_in_(10L * o_ptr->dd * o_ptr->ds))
+ o_ptr->dd++;
- /* Hack -- restrict the damage dice */
if (o_ptr->dd > 9) o_ptr->dd = 9;
}
-
- /* Very cursed */
else if (power < -1)
{
- /* Roll for ego-item */
if (randint0(MAX_DEPTH) < level)
{
o_ptr->name2 = get_random_ego(INVEN_AMMO, FALSE);
{
ARMOUR_CLASS toac1 = (ARMOUR_CLASS)randint1(5) + m_bonus(5, level);
ARMOUR_CLASS toac2 = (ARMOUR_CLASS)m_bonus(10, level);
-
- /* Good */
if (power > 0)
{
- /* Enchant */
o_ptr->to_a += toac1;
-
- /* Very good */
if (power > 1)
{
- /* Enchant again */
o_ptr->to_a += toac2;
}
}
-
- /* Cursed */
else if (power < 0)
{
- /* Penalize */
o_ptr->to_a -= toac1;
-
- /* Very cursed */
if (power < -1)
{
- /* Penalize again */
o_ptr->to_a -= toac2;
}
- /* Cursed (if "bad") */
if (o_ptr->to_a < 0) o_ptr->curse_flags |= TRC_CURSED;
}
{
case TV_DRAG_ARMOR:
{
- if (one_in_(50) || (power > 2)) /* power > 2 is debug only */
+ /* power > 2 is debug only */
+ if (one_in_(50) || (power > 2))
become_random_artifact(owner_ptr, o_ptr, FALSE);
break;
}
-
case TV_HARD_ARMOR:
case TV_SOFT_ARMOR:
{
- /* Very good */
if (power > 1)
{
- /* Hack -- Try for "Robes of the Magi" */
if ((o_ptr->tval == TV_SOFT_ARMOR) &&
(o_ptr->sval == SV_ROBE) &&
(randint0(100) < 15))
{
o_ptr->name2 = EGO_PERMANENCE;
}
+
break;
}
- if (one_in_(20) || (power > 2)) /* power > 2 is debug only */
+ /* power > 2 is debug only */
+ if (one_in_(20) || (power > 2))
{
become_random_artifact(owner_ptr, o_ptr, FALSE);
break;
while (TRUE)
{
bool okay_flag = TRUE;
-
o_ptr->name2 = get_random_ego(INVEN_BODY, TRUE);
-
switch (o_ptr->name2)
{
case EGO_DWARVEN:
{
okay_flag = FALSE;
}
+
break;
case EGO_DRUID:
if (o_ptr->tval != TV_SOFT_ARMOR)
{
okay_flag = FALSE;
}
+
break;
default:
break;
if (okay_flag) break;
}
+
switch (o_ptr->name2)
{
case EGO_RESISTANCE:
break;
}
-
case TV_SHIELD:
{
-
if (o_ptr->sval == SV_DRAGON_SHIELD)
{
dragon_resist(o_ptr);
if (!one_in_(3)) break;
}
- /* Very good */
if (power > 1)
{
- if (one_in_(20) || (power > 2)) /* power > 2 is debug only */
+ /* power > 2 is debug only */
+ if (one_in_(20) || (power > 2))
{
become_random_artifact(owner_ptr, o_ptr, FALSE);
break;
{
continue;
}
+
break;
}
break;
}
}
+
break;
}
-
case TV_GLOVES:
{
if (o_ptr->sval == SV_SET_OF_DRAGON_GLOVES)
dragon_resist(o_ptr);
if (!one_in_(3)) break;
}
+
if (power > 1)
{
- if (one_in_(20) || (power > 2)) /* power > 2 is debug only */
+ /* power > 2 is debug only */
+ if (one_in_(20) || (power > 2))
{
become_random_artifact(owner_ptr, o_ptr, FALSE);
break;
}
o_ptr->name2 = get_random_ego(INVEN_HANDS, TRUE);
}
-
- /* Very cursed */
else if (power < -1)
{
o_ptr->name2 = get_random_ego(INVEN_HANDS, FALSE);
dragon_resist(o_ptr);
if (!one_in_(3)) break;
}
- /* Very good */
+
if (power > 1)
{
- if (one_in_(20) || (power > 2)) /* power > 2 is debug only */
+ /* power > 2 is debug only */
+ if (one_in_(20) || (power > 2))
{
become_random_artifact(owner_ptr, o_ptr, FALSE);
break;
}
- o_ptr->name2 = get_random_ego(INVEN_FEET, TRUE);
+ o_ptr->name2 = get_random_ego(INVEN_FEET, TRUE);
switch (o_ptr->name2)
{
case EGO_SLOW_DESCENT:
{
one_high_resistance(o_ptr);
}
+
break;
}
}
- /* Very cursed */
else if (power < -1)
{
o_ptr->name2 = get_random_ego(INVEN_FEET, FALSE);
break;
}
-
case TV_CROWN:
{
- /* Very good */
if (power > 1)
{
- if (one_in_(20) || (power > 2)) /* power > 2 is debug only */
+ /* power > 2 is debug only */
+ if (one_in_(20) || (power > 2))
{
become_random_artifact(owner_ptr, o_ptr, FALSE);
break;
}
+
while (TRUE)
{
bool ok_flag = TRUE;
else add_esp_weak(o_ptr, FALSE);
}
break;
- default:/* not existing crown (wisdom,lite, etc...) */
+ default:
+ /* not existing crown (wisdom,lite, etc...) */
ok_flag = FALSE;
}
+
if (ok_flag)
- break; /* while (TRUE) */
+ break;
}
+
break;
}
-
- /* Very cursed */
else if (power < -1)
{
while (TRUE)
if (one_in_(3)) add_flag(o_ptr->art_flags, TR_DRAIN_MANA);
break;
}
+
if (ok_flag)
- break; /* while (TRUE) */
+ break;
}
}
break;
}
-
case TV_HELM:
{
if (o_ptr->sval == SV_DRAGON_HELM)
if (!one_in_(3)) break;
}
- /* Very good */
if (power > 1)
{
- if (one_in_(20) || (power > 2)) /* power > 2 is debug only */
+ /* power > 2 is debug only */
+ if (one_in_(20) || (power > 2))
{
become_random_artifact(owner_ptr, o_ptr, FALSE);
break;
}
+
while (TRUE)
{
bool ok_flag = TRUE;
o_ptr->name2 = get_random_ego(INVEN_HEAD, TRUE);
-
switch (o_ptr->name2)
{
case EGO_BRILLIANCE:
if (one_in_(2)) add_esp_strong(o_ptr);
else add_esp_weak(o_ptr, FALSE);
}
+
break;
case EGO_LITE:
if (one_in_(3)) add_flag(o_ptr->art_flags, TR_LITE_1);
if (one_in_(5)) add_flag(o_ptr->art_flags, TR_TY_CURSE);
if (one_in_(5)) add_flag(o_ptr->art_flags, TR_CALL_DEMON);
break;
- default:/* not existing helm (Magi, Might, etc...)*/
+ default:
+ /* not existing helm (Magi, Might, etc...)*/
ok_flag = FALSE;
}
if (ok_flag)
- break; /* while (TRUE) */
+ break;
}
+
break;
}
- /* Very cursed */
else if (power < -1)
{
while (TRUE)
case EGO_ANCIENT_CURSE:
ok_flag = FALSE;
}
+
if (ok_flag)
- break; /* while (TRUE) */
+ break;
}
}
+
break;
}
-
case TV_CLOAK:
{
- /* Very good */
if (power > 1)
{
- if (one_in_(20) || (power > 2)) /* power > 2 is debug only */
+ /* power > 2 is debug only */
+ if (one_in_(20) || (power > 2))
{
become_random_artifact(owner_ptr, o_ptr, FALSE);
break;
}
}
-
- /* Very cursed */
else if (power < -1)
{
o_ptr->name2 = get_random_ego(INVEN_OUTER, FALSE);
*/
static void a_m_aux_3(player_type *owner_ptr, object_type *o_ptr, DEPTH level, int power)
{
- /* Apply magic (good or bad) according to type */
switch (o_ptr->tval)
{
case TV_RING:
{
- /* Analyze */
switch (o_ptr->sval)
{
case SV_RING_ATTACKS:
{
- /* Stat bonus */
o_ptr->pval = (PARAMETER_VALUE)m_bonus(2, level);
if (one_in_(15)) o_ptr->pval++;
if (o_ptr->pval < 1) o_ptr->pval = 1;
- /* Cursed */
if (power < 0)
{
- /* Broken */
o_ptr->ident |= (IDENT_BROKEN);
-
- /* Cursed */
o_ptr->curse_flags |= TRC_CURSED;
-
- /* Reverse pval */
o_ptr->pval = 0 - (o_ptr->pval);
}
break;
}
-
case SV_RING_SHOTS:
{
break;
}
-
- /* Strength, Constitution, Dexterity, Intelligence */
case SV_RING_STR:
case SV_RING_CON:
case SV_RING_DEX:
{
- /* Stat bonus */
o_ptr->pval = 1 + (PARAMETER_VALUE)m_bonus(5, level);
-
- /* Cursed */
if (power < 0)
{
- /* Broken */
o_ptr->ident |= (IDENT_BROKEN);
-
- /* Cursed */
o_ptr->curse_flags |= TRC_CURSED;
-
- /* Reverse pval */
o_ptr->pval = 0 - (o_ptr->pval);
}
break;
}
-
- /* Ring of Speed! */
case SV_RING_SPEED:
{
- /* Base speed (1 to 10) */
o_ptr->pval = randint1(5) + (PARAMETER_VALUE)m_bonus(5, level);
-
- /* Super-charge the ring */
while (randint0(100) < 50) o_ptr->pval++;
- /* Cursed Ring */
if (power < 0)
{
- /* Broken */
o_ptr->ident |= (IDENT_BROKEN);
-
- /* Cursed */
o_ptr->curse_flags |= TRC_CURSED;
-
- /* Reverse pval */
o_ptr->pval = 0 - (o_ptr->pval);
-
break;
}
break;
}
-
case SV_RING_LORDLY:
{
do
one_lordly_high_resistance(o_ptr);
} while (one_in_(4));
- /* Bonus to armor class */
o_ptr->to_a = 10 + randint1(5) + (ARMOUR_CLASS)m_bonus(10, level);
+ break;
}
- break;
-
case SV_RING_WARNING:
{
if (one_in_(3)) one_low_esp(o_ptr);
break;
}
-
- /* Searching */
case SV_RING_SEARCHING:
{
- /* Bonus to searching */
o_ptr->pval = 1 + (PARAMETER_VALUE)m_bonus(5, level);
-
- /* Cursed */
if (power < 0)
{
- /* Broken */
o_ptr->ident |= (IDENT_BROKEN);
-
- /* Cursed */
o_ptr->curse_flags |= TRC_CURSED;
-
- /* Reverse pval */
o_ptr->pval = 0 - (o_ptr->pval);
}
break;
}
-
- /* Flames, Acid, Ice */
case SV_RING_FLAMES:
case SV_RING_ACID:
case SV_RING_ICE:
case SV_RING_ELEC:
{
- /* Bonus to armor class */
o_ptr->to_a = 5 + randint1(5) + (ARMOUR_CLASS)m_bonus(10, level);
break;
}
-
- /* Weakness, Stupidity */
case SV_RING_WEAKNESS:
case SV_RING_STUPIDITY:
{
- /* Broken */
o_ptr->ident |= (IDENT_BROKEN);
-
- /* Cursed */
o_ptr->curse_flags |= TRC_CURSED;
-
- /* Penalize */
o_ptr->pval = 0 - (1 + (PARAMETER_VALUE)m_bonus(5, level));
if (power > 0) power = 0 - power;
break;
}
-
- /* WOE, Stupidity */
case SV_RING_WOE:
{
- /* Broken */
o_ptr->ident |= (IDENT_BROKEN);
-
- /* Cursed */
o_ptr->curse_flags |= TRC_CURSED;
-
- /* Penalize */
o_ptr->to_a = 0 - (5 + (ARMOUR_CLASS)m_bonus(10, level));
o_ptr->pval = 0 - (1 + (PARAMETER_VALUE)m_bonus(5, level));
if (power > 0) power = 0 - power;
break;
}
-
- /* Ring of damage */
case SV_RING_DAMAGE:
{
- /* Bonus to damage */
o_ptr->to_d = 1 + randint1(5) + (HIT_POINT)m_bonus(16, level);
-
- /* Cursed */
if (power < 0)
{
- /* Broken */
o_ptr->ident |= (IDENT_BROKEN);
-
- /* Cursed */
o_ptr->curse_flags |= TRC_CURSED;
-
- /* Reverse bonus */
o_ptr->to_d = 0 - o_ptr->to_d;
}
break;
}
-
- /* Ring of Accuracy */
case SV_RING_ACCURACY:
{
- /* Bonus to hit */
o_ptr->to_h = 1 + randint1(5) + (HIT_PROB)m_bonus(16, level);
-
- /* Cursed */
if (power < 0)
{
- /* Broken */
o_ptr->ident |= (IDENT_BROKEN);
-
- /* Cursed */
o_ptr->curse_flags |= TRC_CURSED;
-
- /* Reverse tohit */
o_ptr->to_h = 0 - o_ptr->to_h;
}
break;
}
-
- /* Ring of Protection */
case SV_RING_PROTECTION:
{
- /* Bonus to armor class */
o_ptr->to_a = 5 + randint1(8) + (ARMOUR_CLASS)m_bonus(10, level);
-
- /* Cursed */
if (power < 0)
{
- /* Broken */
o_ptr->ident |= (IDENT_BROKEN);
-
- /* Cursed */
o_ptr->curse_flags |= TRC_CURSED;
-
- /* Reverse toac */
o_ptr->to_a = 0 - o_ptr->to_a;
}
break;
}
-
- /* Ring of Slaying */
case SV_RING_SLAYING:
{
- /* Bonus to damage and to hit */
o_ptr->to_d = randint1(5) + (HIT_POINT)m_bonus(12, level);
o_ptr->to_h = randint1(5) + (HIT_PROB)m_bonus(12, level);
- /* Cursed */
if (power < 0)
{
- /* Broken */
o_ptr->ident |= (IDENT_BROKEN);
-
- /* Cursed */
o_ptr->curse_flags |= TRC_CURSED;
-
- /* Reverse bonuses */
o_ptr->to_h = 0 - o_ptr->to_h;
o_ptr->to_d = 0 - o_ptr->to_d;
}
break;
}
-
case SV_RING_MUSCLE:
{
o_ptr->pval = 1 + (PARAMETER_VALUE)m_bonus(3, level);
if (one_in_(4)) o_ptr->pval++;
- /* Cursed */
if (power < 0)
{
- /* Broken */
o_ptr->ident |= (IDENT_BROKEN);
-
- /* Cursed */
o_ptr->curse_flags |= TRC_CURSED;
-
- /* Reverse bonuses */
o_ptr->pval = 0 - o_ptr->pval;
}
}
case SV_RING_AGGRAVATION:
{
- /* Broken */
o_ptr->ident |= (IDENT_BROKEN);
-
- /* Cursed */
o_ptr->curse_flags |= TRC_CURSED;
-
if (power > 0) power = 0 - power;
break;
}
}
- if ((one_in_(400) && (power > 0) && !object_is_cursed(o_ptr) && (level > 79))
- || (power > 2)) /* power > 2 is debug only */
+
+ /* power > 2 is debug only */
+ if ((one_in_(400) && (power > 0) && !object_is_cursed(o_ptr) && (level > 79)) || (power > 2))
{
o_ptr->pval = MIN(o_ptr->pval, 4);
- /* Randart amulet */
become_random_artifact(owner_ptr, o_ptr, FALSE);
}
else if ((power == 2) && one_in_(2))
o_ptr->to_h -= 2 + randint1(4);
o_ptr->to_d += 2 + randint1(4);
}
+
break;
case SV_RING_PROTECTION:
o_ptr->name2 = EGO_RING_SUPER_AC;
default:
break;
}
+
break;
}
}
+
o_ptr->curse_flags = 0L;
}
else if ((power == -2) && one_in_(2))
break;
}
}
- /* Broken */
- o_ptr->ident |= (IDENT_BROKEN);
- /* Cursed */
+ o_ptr->ident |= (IDENT_BROKEN);
o_ptr->curse_flags |= (TRC_CURSED | TRC_HEAVY_CURSE);
}
+
break;
}
-
case TV_AMULET:
{
- /* Analyze */
switch (o_ptr->sval)
{
- /* Amulet of wisdom/charisma */
case SV_AMULET_INTELLIGENCE:
case SV_AMULET_WISDOM:
case SV_AMULET_CHARISMA:
{
o_ptr->pval = 1 + (PARAMETER_VALUE)m_bonus(5, level);
-
- /* Cursed */
if (power < 0)
{
- /* Broken */
o_ptr->ident |= (IDENT_BROKEN);
-
- /* Cursed */
o_ptr->curse_flags |= (TRC_CURSED);
-
- /* Reverse bonuses */
o_ptr->pval = 0 - o_ptr->pval;
}
break;
}
-
- /* Amulet of brilliance */
case SV_AMULET_BRILLIANCE:
{
o_ptr->pval = 1 + m_bonus(3, level);
if (one_in_(4)) o_ptr->pval++;
- /* Cursed */
if (power < 0)
{
- /* Broken */
o_ptr->ident |= (IDENT_BROKEN);
-
- /* Cursed */
o_ptr->curse_flags |= (TRC_CURSED);
-
- /* Reverse bonuses */
o_ptr->pval = 0 - o_ptr->pval;
}
break;
}
-
case SV_AMULET_NO_MAGIC: case SV_AMULET_NO_TELE:
{
if (power < 0)
{
o_ptr->curse_flags |= (TRC_CURSED);
}
+
break;
}
-
case SV_AMULET_RESISTANCE:
{
if (one_in_(5)) one_high_resistance(o_ptr);
if (one_in_(5)) add_flag(o_ptr->art_flags, TR_RES_POIS);
+ break;
}
- break;
-
- /* Amulet of searching */
case SV_AMULET_SEARCHING:
{
o_ptr->pval = randint1(2) + (PARAMETER_VALUE)m_bonus(4, level);
-
- /* Cursed */
if (power < 0)
{
- /* Broken */
o_ptr->ident |= (IDENT_BROKEN);
-
- /* Cursed */
o_ptr->curse_flags |= (TRC_CURSED);
-
- /* Reverse bonuses */
o_ptr->pval = 0 - (o_ptr->pval);
}
break;
}
-
- /* Amulet of the Magi -- never cursed */
case SV_AMULET_THE_MAGI:
{
o_ptr->pval = randint1(5) + (PARAMETER_VALUE)m_bonus(5, level);
o_ptr->to_a = randint1(5) + (ARMOUR_CLASS)m_bonus(5, level);
-
- /* gain one low ESP */
add_esp_weak(o_ptr, FALSE);
-
break;
}
-
- /* Amulet of Doom -- always cursed */
case SV_AMULET_DOOM:
{
- /* Broken */
o_ptr->ident |= (IDENT_BROKEN);
-
- /* Cursed */
o_ptr->curse_flags |= (TRC_CURSED);
-
- /* Penalize */
o_ptr->pval = 0 - (randint1(5) + (PARAMETER_VALUE)m_bonus(5, level));
o_ptr->to_a = 0 - (randint1(5) + (ARMOUR_CLASS)m_bonus(5, level));
if (power > 0) power = 0 - power;
break;
}
-
case SV_AMULET_MAGIC_MASTERY:
{
o_ptr->pval = 1 + (PARAMETER_VALUE)m_bonus(4, level);
-
- /* Cursed */
if (power < 0)
{
- /* Broken */
o_ptr->ident |= (IDENT_BROKEN);
-
- /* Cursed */
o_ptr->curse_flags |= (TRC_CURSED);
-
- /* Reverse bonuses */
o_ptr->pval = 0 - o_ptr->pval;
}
}
}
- if ((one_in_(150) && (power > 0) && !object_is_cursed(o_ptr) && (level > 79))
- || (power > 2)) /* power > 2 is debug only */
+ /* power > 2 is debug only */
+ if ((one_in_(150) && (power > 0) && !object_is_cursed(o_ptr) && (level > 79)) || (power > 2))
{
o_ptr->pval = MIN(o_ptr->pval, 4);
- /* Randart amulet */
become_random_artifact(owner_ptr, o_ptr, FALSE);
}
else if ((power == 2) && one_in_(2))
break;
}
}
- /* Broken */
- o_ptr->ident |= (IDENT_BROKEN);
- /* Cursed */
+ o_ptr->ident |= (IDENT_BROKEN);
o_ptr->curse_flags |= (TRC_CURSED | TRC_HEAVY_CURSE);
}
+
break;
}
}
* Apply magic to an item known to be "boring"
* @param owner_ptr プレーヤーへの参照ポインタ
* @param o_ptr 強化を与えたいオブジェクトの構造体参照ポインタ
- * @param level 生成基準階
* @param power 生成ランク
* @return なし
* @details
* Hack -- note the special code for various items
*/
-static void a_m_aux_4(player_type *owner_ptr, object_type *o_ptr, DEPTH level, int power)
+static void a_m_aux_4(player_type *owner_ptr, object_type *o_ptr, int power)
{
object_kind *k_ptr = &k_info[o_ptr->k_idx];
- /* Unused */
- (void)level;
-
- /* Apply magic (good or bad) according to type */
floor_type *floor_ptr = owner_ptr->current_floor_ptr;
switch (o_ptr->tval)
{
}
case TV_LITE:
{
- /* Hack -- Torches -- random fuel */
if (o_ptr->sval == SV_LITE_TORCH)
{
if (o_ptr->pval > 0) o_ptr->xtra4 = randint1(o_ptr->pval);
o_ptr->pval = 0;
}
- /* Hack -- Lanterns -- random fuel */
if (o_ptr->sval == SV_LITE_LANTERN)
{
if (o_ptr->pval > 0) o_ptr->xtra4 = randint1(o_ptr->pval);
o_ptr->pval = 0;
}
- if (power > 2) /* power > 2 is debug only */
+ /* power > 2 is debug only */
+ if (power > 2)
{
become_random_artifact(owner_ptr, o_ptr, FALSE);
}
if (o_ptr->sval == SV_LITE_FEANOR)
okay_flag = FALSE;
}
+
if (okay_flag)
break;
}
else if (power == -2)
{
o_ptr->name2 = get_random_ego(INVEN_LITE, FALSE);
-
switch (o_ptr->name2)
{
case EGO_LITE_DARKNESS:
break;
}
-
case TV_WAND:
case TV_STAFF:
{
o_ptr->pval = k_ptr->pval / 2 + randint1((k_ptr->pval + 1) / 2);
break;
}
-
case TV_ROD:
{
- /* Transfer the pval. -LM- */
o_ptr->pval = k_ptr->pval;
break;
}
-
case TV_CAPTURE:
{
o_ptr->pval = 0;
object_known(o_ptr);
break;
}
-
case TV_FIGURINE:
{
PARAMETER_VALUE i = 1;
int check;
-
monster_race *r_ptr;
-
- /* Pick a random non-unique monster race */
while (TRUE)
{
i = randint1(max_r_idx - 1);
if (i == MON_TSUCHINOKO) continue;
r_ptr = &r_info[i];
-
check = (floor_ptr->dun_level < r_ptr->level) ? (r_ptr->level - floor_ptr->dun_level) : 0;
-
- /* Ignore dead monsters */
if (!r_ptr->rarity) continue;
-
- /* Ignore uncommon monsters */
if (r_ptr->rarity > 100) continue;
-
- /* Prefer less out-of-depth monsters */
if (randint0(check)) continue;
break;
}
o_ptr->pval = i;
-
- /* Some figurines are cursed */
if (one_in_(6)) o_ptr->curse_flags |= TRC_CURSED;
break;
}
-
case TV_CORPSE:
{
PARAMETER_VALUE i = 1;
int check;
-
u32b match = 0;
-
monster_race *r_ptr;
-
if (o_ptr->sval == SV_SKELETON)
{
match = RF9_DROP_SKELETON;
match = RF9_DROP_CORPSE;
}
- /* Hack -- Remove the monster restriction */
get_mon_num_prep(owner_ptr, item_monster_okay, NULL);
-
- /* Pick a random non-unique monster race */
while (TRUE)
{
i = get_mon_num(owner_ptr, floor_ptr->dun_level);
-
r_ptr = &r_info[i];
-
check = (floor_ptr->dun_level < r_ptr->level) ? (r_ptr->level - floor_ptr->dun_level) : 0;
-
- /* Ignore dead monsters */
if (!r_ptr->rarity) continue;
-
- /* Ignore corpseless monsters */
if (!(r_ptr->flags9 & match)) continue;
-
- /* Prefer less out-of-depth monsters */
if (randint0(check)) continue;
break;
}
o_ptr->pval = i;
-
object_aware(owner_ptr, o_ptr);
object_known(o_ptr);
break;
}
-
case TV_STATUE:
{
PARAMETER_VALUE i = 1;
-
monster_race *r_ptr;
-
- /* Pick a random monster race */
while (TRUE)
{
i = randint1(max_r_idx - 1);
-
r_ptr = &r_info[i];
-
- /* Ignore dead monsters */
if (!r_ptr->rarity) continue;
break;
}
o_ptr->pval = i;
-
if (cheat_peek)
{
msg_format(_("%sの像", "Statue of %s"), r_name + r_ptr->name);
object_aware(owner_ptr, o_ptr);
object_known(o_ptr);
-
break;
}
-
case TV_CHEST:
{
DEPTH obj_level = k_info[o_ptr->k_idx].level;
-
- /* Hack -- skip ruined chests */
if (obj_level <= 0) break;
- /* Hack -- pick a "difficulty" */
o_ptr->pval = randint1(obj_level);
if (o_ptr->sval == SV_CHEST_KANDUME) o_ptr->pval = 6;
o_ptr->xtra3 = floor_ptr->dun_level + 5;
-
- /* Never exceed "difficulty" of 55 to 59 */
if (o_ptr->pval > 55) o_ptr->pval = 55 + (byte)randint0(5);
break;
*/
void apply_magic(player_type *owner_ptr, object_type *o_ptr, DEPTH lev, BIT_FLAGS mode)
{
- int i, rolls, f1, f2, power;
-
if (owner_ptr->pseikaku == SEIKAKU_MUNCHKIN) lev += randint0(owner_ptr->lev / 2 + 10);
-
- /* Maximum "level" for various things */
if (lev > MAX_DEPTH - 1) lev = MAX_DEPTH - 1;
- /* Base chance of being "good" */
- f1 = lev + 10;
-
- /* Maximal chance of being "good" */
+ int f1 = lev + 10;
if (f1 > d_info[owner_ptr->dungeon_idx].obj_good) f1 = d_info[owner_ptr->dungeon_idx].obj_good;
- /* Base chance of being "great" */
- f2 = f1 * 2 / 3;
-
- /* Maximal chance of being "great" */
+ int f2 = f1 * 2 / 3;
if ((owner_ptr->pseikaku != SEIKAKU_MUNCHKIN) && (f2 > d_info[owner_ptr->dungeon_idx].obj_great))
f2 = d_info[owner_ptr->dungeon_idx].obj_great;
f2 -= 2;
}
- /* Assume normal */
- power = 0;
-
- /* Roll for "good" */
+ int power = 0;
if ((mode & AM_GOOD) || magik(f1))
{
- /* Assume "good" */
power = 1;
-
- /* Roll for "great" */
if ((mode & AM_GREAT) || magik(f2))
{
power = 2;
-
- /* Roll for "special" */
if (mode & AM_SPECIAL) power = 3;
}
}
-
- /* Roll for "cursed" */
else if (magik(f1))
{
- /* Assume "cursed" */
power = -1;
-
- /* Roll for "broken" */
if (magik(f2)) power = -2;
}
-
- /* Apply curse */
if (mode & AM_CURSED)
{
- /* Assume 'cursed' */
if (power > 0)
{
power = 0 - power;
}
- /* Everything else gets more badly cursed */
else
{
power--;
}
}
- /* Assume no rolls */
- rolls = 0;
-
- /* Get one roll if excellent */
+ int rolls = 0;
if (power >= 2) rolls = 1;
- /* Hack -- Get four rolls if forced great or special */
if (mode & (AM_GREAT | AM_SPECIAL)) rolls = 4;
-
- /* Hack -- Get no rolls if not allowed */
if ((mode & AM_NO_FIXED_ART) || o_ptr->name1) rolls = 0;
- /* Roll for artifacts if allowed */
- for (i = 0; i < rolls; i++)
+ for (int i = 0; i < rolls; i++)
{
- /* Roll for an artifact */
if (make_artifact(owner_ptr, o_ptr)) break;
if ((owner_ptr->muta3 & MUT3_GOOD_LUCK) && one_in_(77))
{
}
}
- /* Hack -- analyze artifacts */
if (object_is_fixed_artifact(o_ptr))
{
artifact_type *a_ptr = &a_info[o_ptr->name1];
-
- /* Hack -- Mark the artifact as "created" */
a_ptr->cur_num = 1;
-
- /* Hack -- Memorize location of artifact in saved floors */
if (current_world_ptr->character_dungeon)
a_ptr->floor_id = owner_ptr->floor_id;
- /* Extract the other fields */
o_ptr->pval = a_ptr->pval;
o_ptr->ac = a_ptr->ac;
o_ptr->dd = a_ptr->dd;
}
}
- /* Hack -- extract the "broken" flag */
if (!a_ptr->cost) o_ptr->ident |= (IDENT_BROKEN);
-
- /* Hack -- extract the "cursed" flag */
if (a_ptr->gen_flags & TRG_CURSED) o_ptr->curse_flags |= (TRC_CURSED);
if (a_ptr->gen_flags & TRG_HEAVY_CURSE) o_ptr->curse_flags |= (TRC_HEAVY_CURSE);
if (a_ptr->gen_flags & TRG_PERMA_CURSE) o_ptr->curse_flags |= (TRC_PERMA_CURSE);
if (power) apply_magic_weapon(owner_ptr, o_ptr, lev, power);
break;
}
-
case TV_POLEARM:
{
if (power && !(o_ptr->sval == SV_DEATH_SCYTHE)) apply_magic_weapon(owner_ptr, o_ptr, lev, power);
break;
}
-
case TV_SWORD:
{
if (power && !(o_ptr->sval == SV_POISON_NEEDLE)) apply_magic_weapon(owner_ptr, o_ptr, lev, power);
break;
}
-
case TV_DRAG_ARMOR:
case TV_HARD_ARMOR:
case TV_SOFT_ARMOR:
case TV_GLOVES:
case TV_BOOTS:
{
- /* Elven Cloak and Black Clothes ... */
if (((o_ptr->tval == TV_CLOAK) && (o_ptr->sval == SV_ELVEN_CLOAK)) ||
((o_ptr->tval == TV_SOFT_ARMOR) && (o_ptr->sval == SV_KUROSHOUZOKU)))
o_ptr->pval = randint1(4);
((o_ptr->tval == TV_GLOVES) && (o_ptr->sval == SV_SET_OF_DRAGON_GLOVES)) ||
((o_ptr->tval == TV_BOOTS) && (o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE)))
a_m_aux_2(owner_ptr, o_ptr, lev, power);
+
break;
}
-
case TV_RING:
case TV_AMULET:
{
a_m_aux_3(owner_ptr, o_ptr, lev, power);
break;
}
-
default:
{
- a_m_aux_4(owner_ptr, o_ptr, lev, power);
+ a_m_aux_4(owner_ptr, o_ptr, power);
break;
}
}
add_flag(o_ptr->art_flags, TR_CHR);
}
- /* Hack -- analyze ego-items */
if (object_is_ego(o_ptr))
{
ego_item_type *e_ptr = &e_info[o_ptr->name2];
-
- /* Hack -- acquire "broken" flag */
if (!e_ptr->cost) o_ptr->ident |= (IDENT_BROKEN);
- /* Hack -- acquire "cursed" flag */
if (e_ptr->gen_flags & TRG_CURSED) o_ptr->curse_flags |= (TRC_CURSED);
if (e_ptr->gen_flags & TRG_HEAVY_CURSE) o_ptr->curse_flags |= (TRC_HEAVY_CURSE);
if (e_ptr->gen_flags & TRG_PERMA_CURSE) o_ptr->curse_flags |= (TRC_PERMA_CURSE);
if (o_ptr->dd > 9) o_ptr->dd = 9;
}
- /* Hack -- apply activatin index if needed */
if (e_ptr->act_idx) o_ptr->xtra2 = (XTRA8)e_ptr->act_idx;
- /* Hack -- apply extra penalties if needed */
if ((object_is_cursed(o_ptr) || object_is_broken(o_ptr)) && !(e_ptr->gen_flags & (TRG_POWERFUL)))
{
- /* Hack -- obtain bonuses */
if (e_ptr->max_to_h) o_ptr->to_h -= randint1(e_ptr->max_to_h);
if (e_ptr->max_to_d) o_ptr->to_d -= randint1(e_ptr->max_to_d);
if (e_ptr->max_to_a) o_ptr->to_a -= randint1(e_ptr->max_to_a);
-
- /* Hack -- obtain pval */
if (e_ptr->max_pval) o_ptr->pval -= randint1(e_ptr->max_pval);
}
-
- /* Hack -- apply extra bonuses if needed */
else
{
- /* Hack -- obtain bonuses */
if (e_ptr->max_to_h)
{
if (e_ptr->max_to_h > 127)
o_ptr->to_h -= randint1(256 - e_ptr->max_to_h);
else o_ptr->to_h += randint1(e_ptr->max_to_h);
}
+
if (e_ptr->max_to_d)
{
if (e_ptr->max_to_d > 127)
o_ptr->to_d -= randint1(256 - e_ptr->max_to_d);
else o_ptr->to_d += randint1(e_ptr->max_to_d);
}
+
if (e_ptr->max_to_a)
{
if (e_ptr->max_to_a > 127)
else o_ptr->to_a += randint1(e_ptr->max_to_a);
}
- /* Accuracy ego must have high to_h */
if (o_ptr->name2 == EGO_ACCURACY)
{
while (o_ptr->to_h < o_ptr->to_d + 10)
o_ptr->to_h = MAX(o_ptr->to_h, 15);
}
- /* Accuracy ego must have high to_h */
if (o_ptr->name2 == EGO_VELOCITY)
{
while (o_ptr->to_d < o_ptr->to_h + 10)
o_ptr->to_d = MAX(o_ptr->to_d, 15);
}
- /* Protection ego must have high to_a */
if ((o_ptr->name2 == EGO_PROTECTION) || (o_ptr->name2 == EGO_S_PROTECTION) || (o_ptr->name2 == EGO_H_PROTECTION))
{
o_ptr->to_a = MAX(o_ptr->to_a, 15);
}
- /* Hack -- obtain pval */
if (e_ptr->max_pval)
{
if ((o_ptr->name2 == EGO_HA) && (have_flag(o_ptr->art_flags, TR_BLOWS)))
{
o_ptr->pval += randint1(e_ptr->max_pval);
}
-
-
}
+
if ((o_ptr->name2 == EGO_SPEED) && (lev < 50))
{
o_ptr->pval = randint1(o_ptr->pval);
}
+
if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_HAYABUSA) && (o_ptr->pval > 2) && (o_ptr->name2 != EGO_ATTACKS))
o_ptr->pval = 2;
}
return;
}
- /* Examine real objects */
if (o_ptr->k_idx)
{
object_kind *k_ptr = &k_info[o_ptr->k_idx];
-
- /* Hack -- acquire "broken" flag */
if (!k_info[o_ptr->k_idx].cost) o_ptr->ident |= (IDENT_BROKEN);
- /* Hack -- acquire "cursed" flag */
if (k_ptr->gen_flags & (TRG_CURSED)) o_ptr->curse_flags |= (TRC_CURSED);
if (k_ptr->gen_flags & (TRG_HEAVY_CURSE)) o_ptr->curse_flags |= TRC_HEAVY_CURSE;
if (k_ptr->gen_flags & (TRG_PERMA_CURSE)) o_ptr->curse_flags |= TRC_PERMA_CURSE;
bool make_object(player_type *owner_ptr, object_type *j_ptr, BIT_FLAGS mode)
{
floor_type *floor_ptr = owner_ptr->current_floor_ptr;
-
- /* Chance of "special object" */
PERCENTAGE prob = ((mode & AM_GOOD) ? 10 : 1000);
-
- /* Base level for the object */
DEPTH base = ((mode & AM_GOOD) ? (floor_ptr->object_level + 10) : floor_ptr->object_level);
-
-
- /* Generate a special object, or a normal object */
if (!one_in_(prob) || !make_artifact_special(owner_ptr, j_ptr))
{
KIND_OBJECT_IDX k_idx;
-
- /* Good objects */
if ((mode & AM_GOOD) && !get_obj_num_hook)
{
- /* Activate restriction (if already specified, use that) */
get_obj_num_hook = kind_is_good;
}
- /* Restricted objects - prepare allocation table */
if (get_obj_num_hook) get_obj_num_prep();
- /* Pick a random object */
k_idx = get_obj_num(owner_ptr, base, mode);
-
- /* Restricted objects */
if (get_obj_num_hook)
{
- /* Clear restriction */
get_obj_num_hook = NULL;
-
- /* Reset allocation table to default */
get_obj_num_prep();
}
- /* Handle failure */
if (!k_idx) return FALSE;
- /* Prepare the object */
object_prep(j_ptr, k_idx);
}
- /* Apply magic (allow artifacts) */
apply_magic(owner_ptr, j_ptr, floor_ptr->object_level, mode);
-
- /* Hack -- generate multiple spikes/missiles */
switch (j_ptr->tval)
{
case TV_SPIKE:
*/
bool make_gold(floor_type *floor_ptr, object_type *j_ptr)
{
- int i;
- s32b base;
-
- /* Hack -- Pick a Treasure variety */
- i = ((randint1(floor_ptr->object_level + 2) + 2) / 2) - 1;
-
- /* Apply "extra" magic */
+ int i = ((randint1(floor_ptr->object_level + 2) + 2) / 2) - 1;
if (one_in_(GREAT_OBJ))
{
i += randint1(floor_ptr->object_level + 1);
}
- /* Hack -- Creeping Coins only generate "themselves" */
if (coin_type) i = coin_type;
-
- /* Do not create "illegal" Treasure Types */
if (i >= MAX_GOLD) i = MAX_GOLD - 1;
-
- /* Prepare a gold object */
object_prep(j_ptr, OBJ_GOLD_LIST + i);
- /* Hack -- Base coin cost */
- base = k_info[OBJ_GOLD_LIST + i].cost;
-
- /* Determine how much the treasure is "worth" */
+ s32b base = k_info[OBJ_GOLD_LIST + i].cost;
j_ptr->pval = (base + (8L * randint1(base)) + randint1(8));
- /* Success */
return TRUE;
}
OBJECT_IDX drop_near(player_type *owner_ptr, object_type *j_ptr, PERCENTAGE chance, POSITION y, POSITION x)
{
int i, k, d, s;
-
- int bs, bn;
- POSITION by, bx;
POSITION dy, dx;
POSITION ty, tx = 0;
-
OBJECT_IDX o_idx = 0;
OBJECT_IDX this_o_idx, next_o_idx = 0;
-
grid_type *g_ptr;
-
GAME_TEXT o_name[MAX_NLEN];
-
bool flag = FALSE;
bool done = FALSE;
-
#ifdef JP
#else
-
- /* Extract plural */
bool plural = (j_ptr->number != 1);
#endif
-
- /* Describe object */
object_desc(owner_ptr, o_name, j_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
-
-
- /* Handle normal "breakage" */
if (!object_is_artifact(j_ptr) && (randint0(100) < chance))
{
#ifdef JP
#endif
if (current_world_ptr->wizard) msg_print(_("(破損)", "(breakage)"));
- /* Failure */
return 0;
}
+ int bs = -1;
+ int bn = 0;
- /* Score */
- bs = -1;
-
- /* Picker */
- bn = 0;
-
- /* Default */
- by = y;
- bx = x;
+ POSITION by = y;
+ POSITION bx = x;
floor_type *floor_ptr = owner_ptr->current_floor_ptr;
- /* Scan local grids */
for (dy = -3; dy <= 3; dy++)
{
- /* Scan local grids */
for (dx = -3; dx <= 3; dx++)
{
bool comb = FALSE;
-
- /* Calculate actual distance */
d = (dy * dy) + (dx * dx);
-
- /* Ignore distant grids */
if (d > 10) continue;
ty = y + dy;
tx = x + dx;
-
if (!in_bounds(floor_ptr, ty, tx)) continue;
-
- /* Require line of projection */
if (!projectable(owner_ptr, y, x, ty, tx)) continue;
- /* Obtain grid */
g_ptr = &floor_ptr->grid_array[ty][tx];
-
- /* Require floor space */
if (!cave_drop_bold(floor_ptr, ty, tx)) continue;
- /* No objects */
k = 0;
-
- /* Scan objects in that grid */
for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
{
object_type *o_ptr;
o_ptr = &floor_ptr->o_list[this_o_idx];
next_o_idx = o_ptr->next_o_idx;
-
- /* Check for possible combination */
if (object_similar(o_ptr, j_ptr)) comb = TRUE;
- /* Count objects */
k++;
}
- /* Add new object */
if (!comb) k++;
if (k > 99) continue;
- /* Calculate score */
s = 1000 - (d + k * 5);
-
- /* Skip bad values */
if (s < bs) continue;
- /* New best value */
if (s > bs) bn = 0;
- /* Apply the randomizer to equivalent values */
if ((++bn >= 2) && !one_in_(bn)) continue;
- /* Keep score */
bs = s;
-
- /* Track it */
by = ty;
bx = tx;
}
}
- /* Handle lack of space */
if (!flag && !object_is_artifact(j_ptr))
{
#ifdef JP
#else
msg_format("The %s disappear%s.", o_name, (plural ? "" : "s"));
#endif
-
if (current_world_ptr->wizard) msg_print(_("(床スペースがない)", "(no floor space)"));
- /* Failure */
return 0;
}
-
- /* Find a grid */
for (i = 0; !flag && (i < 1000); i++)
{
- /* Bounce around */
ty = rand_spread(by, 1);
tx = rand_spread(bx, 1);
if (!in_bounds(floor_ptr, ty, tx)) continue;
- /* Bounce to that location */
by = ty;
bx = tx;
- /* Require floor space */
if (!cave_drop_bold(floor_ptr, by, bx)) continue;
flag = TRUE;
}
-
if (!flag)
{
int candidates = 0, pick;
-
for (ty = 1; ty < floor_ptr->height - 1; ty++)
{
for (tx = 1; tx < floor_ptr->width - 1; tx++)
{
- /* A valid space found */
if (cave_drop_bold(floor_ptr, ty, tx)) candidates++;
}
}
- /* No valid place! */
if (!candidates)
{
#ifdef JP
if (current_world_ptr->wizard) msg_print(_("(床スペースがない)", "(no floor space)"));
- /* Mega-Hack -- preserve artifacts */
if (preserve_mode)
{
- /* Hack -- Preserve unknown artifacts */
if (object_is_fixed_artifact(j_ptr) && !object_is_known(j_ptr))
{
- /* Mega-Hack -- Preserve the artifact */
a_info[j_ptr->name1].cur_num = 0;
}
}
- /* Failure */
return 0;
}
- /* Choose a random one */
pick = randint1(candidates);
-
for (ty = 1; ty < floor_ptr->height - 1; ty++)
{
for (tx = 1; tx < floor_ptr->width - 1; tx++)
if (cave_drop_bold(floor_ptr, ty, tx))
{
pick--;
-
- /* Is this a picked one? */
if (!pick) break;
}
}
g_ptr = &floor_ptr->grid_array[by][bx];
-
- /* Scan objects in that grid for combination */
for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
{
object_type *o_ptr;
o_ptr = &floor_ptr->o_list[this_o_idx];
next_o_idx = o_ptr->next_o_idx;
-
- /* Check for combination */
if (object_similar(o_ptr, j_ptr))
{
object_absorb(o_ptr, j_ptr);
-
- /* Success */
done = TRUE;
-
break;
}
}
#else
msg_format("The %s disappear%s.", o_name, (plural ? "" : "s"));
#endif
-
if (current_world_ptr->wizard) msg_print(_("(アイテムが多過ぎる)", "(too many objects)"));
- /* Hack -- Preserve artifacts */
if (object_is_fixed_artifact(j_ptr))
{
a_info[j_ptr->name1].cur_num = 0;
return 0;
}
- /* Stack */
if (!done)
{
- /* Structure copy */
object_copy(&floor_ptr->o_list[o_idx], j_ptr);
-
- /* Access new object */
j_ptr = &floor_ptr->o_list[o_idx];
-
- /* Locate */
j_ptr->iy = by;
j_ptr->ix = bx;
-
- /* No monster */
j_ptr->held_m_idx = 0;
-
- /* Build a stack */
j_ptr->next_o_idx = g_ptr->o_idx;
g_ptr->o_idx = o_idx;
-
- /* Success */
done = TRUE;
}
lite_spot(owner_ptr, by, bx);
sound(SOUND_DROP);
- /* Mega-Hack -- no message if "dropped" by player */
- /* Message when an object falls under the player */
if (chance && player_bold(owner_ptr, by, bx))
{
msg_print(_("何かが足下に転がってきた。", "You feel something roll beneath your feet."));
void inven_item_charges(player_type *owner_ptr, INVENTORY_IDX item)
{
object_type *o_ptr = &owner_ptr->inventory_list[item];
-
- /* Require staff/wand */
if ((o_ptr->tval != TV_STAFF) && (o_ptr->tval != TV_WAND)) return;
-
- /* Require known item */
if (!object_is_known(o_ptr)) return;
#ifdef JP
msg_format("あと %d 回分の魔力が残っている。", o_ptr->pval);
}
#else
- /* Multiple charges */
if (o_ptr->pval != 1)
{
msg_format("You have %d charges remaining.", o_ptr->pval);
}
- /* Single charge */
else
{
msg_format("You have %d charge remaining.", o_ptr->pval);
}
#endif
-
}
+
/*!
* @brief アイテムの残り所持数メッセージを表示する /
* Describe an item in the inventory.
{
object_type *o_ptr = &owner_ptr->inventory_list[item];
GAME_TEXT o_name[MAX_NLEN];
-
object_desc(owner_ptr, o_name, o_ptr, 0);
-
#ifdef JP
- /* "no more" の場合はこちらで表示する */
if (o_ptr->number <= 0)
{
- /*FIRST*//*ここはもう通らないかも */
msg_format("もう%sを持っていない。", o_name);
}
else
{
- /* アイテム名を英日切り替え機能対応 */
msg_format("まだ %sを持っている。", o_name);
}
#else
void inven_item_increase(player_type *owner_ptr, INVENTORY_IDX item, ITEM_NUMBER num)
{
object_type *o_ptr = &owner_ptr->inventory_list[item];
-
- /* Apply */
num += o_ptr->number;
-
- /* Bounds check */
if (num > 255) num = 255;
else if (num < 0) num = 0;
- /* Un-apply */
num -= o_ptr->number;
-
- /* Change the number and weight */
if (num == 0) return;
- /* Add the number */
o_ptr->number += num;
-
- /* Add the weight */
owner_ptr->total_weight += (num * o_ptr->weight);
owner_ptr->update |= (PU_BONUS);
owner_ptr->update |= (PU_MANA);
owner_ptr->update |= (PU_COMBINE);
owner_ptr->window |= (PW_INVEN | PW_EQUIP);
- /* Hack -- Clear temporary elemental brands if player takes off weapons */
if (o_ptr->number || !owner_ptr->ele_attack) return;
if (!(item == INVEN_RARM) && !(item == INVEN_LARM)) return;
if (has_melee_weapon(owner_ptr, INVEN_RARM + INVEN_LARM - item)) return;
- /* Clear all temporary elemental brands */
set_ele_attack(owner_ptr, 0, 0);
}
void inven_item_optimize(player_type *owner_ptr, INVENTORY_IDX item)
{
object_type *o_ptr = &owner_ptr->inventory_list[item];
-
- /* Only optimize real items */
if (!o_ptr->k_idx) return;
-
- /* Only optimize empty items */
if (o_ptr->number) return;
if (item >= INVEN_RARM)
}
owner_ptr->inven_cnt--;
-
- /* Slide everything down */
int i;
for (i = item; i < INVEN_PACK; i++)
{
owner_ptr->inventory_list[i] = owner_ptr->inventory_list[i + 1];
}
- /* Erase the "final" slot */
object_wipe(&owner_ptr->inventory_list[i]);
-
owner_ptr->window |= PW_INVEN;
owner_ptr->window |= PW_SPELL;
}
void floor_item_charges(floor_type *floor_ptr, INVENTORY_IDX item)
{
object_type *o_ptr = &floor_ptr->o_list[item];
-
- /* Require staff/wand */
if ((o_ptr->tval != TV_STAFF) && (o_ptr->tval != TV_WAND)) return;
-
- /* Require known item */
if (!object_is_known(o_ptr)) return;
#ifdef JP
msg_format("この床上のアイテムは、あと %d 回分の魔力が残っている。", o_ptr->pval);
}
#else
- /* Multiple charges */
if (o_ptr->pval != 1)
{
msg_format("There are %d charges remaining.", o_ptr->pval);
}
-
- /* Single charge */
else
{
msg_format("There is %d charge remaining.", o_ptr->pval);
}
#endif
-
}
{
object_type *o_ptr = &owner_ptr->current_floor_ptr->o_list[item];
GAME_TEXT o_name[MAX_NLEN];
-
object_desc(owner_ptr, o_name, o_ptr, 0);
-
#ifdef JP
- /* "no more" の場合はこちらで表示を分ける */
if (o_ptr->number <= 0)
{
msg_format("床上には、もう%sはない。", o_name);
#else
msg_format("You see %s.", o_name);
#endif
-
}
void floor_item_increase(floor_type *floor_ptr, INVENTORY_IDX item, ITEM_NUMBER num)
{
object_type *o_ptr = &floor_ptr->o_list[item];
-
- /* Apply */
num += o_ptr->number;
-
- /* Bounds check */
if (num > 255) num = 255;
else if (num < 0) num = 0;
- /* Un-apply */
num -= o_ptr->number;
-
- /* Change the number */
o_ptr->number += num;
}
void floor_item_optimize(player_type *owner_ptr, INVENTORY_IDX item)
{
object_type *o_ptr = &owner_ptr->current_floor_ptr->o_list[item];
-
- /* Paranoia -- be sure it exists */
if (!o_ptr->k_idx) return;
-
- /* Only optimize empty items */
if (o_ptr->number) return;
delete_object_idx(owner_ptr, item);
*/
bool inven_carry_okay(object_type *o_ptr)
{
- /* Empty slot? */
if (p_ptr->inven_cnt < INVEN_PACK) return TRUE;
- /* Similar slot? */
for (int j = 0; j < INVEN_PACK; j++)
{
object_type *j_ptr = &p_ptr->inventory_list[j];
if (!j_ptr->k_idx) continue;
- /* Check if the two items can be combined */
if (object_similar(j_ptr, o_ptr)) return TRUE;
}
bool object_sort_comp(object_type *o_ptr, s32b o_value, object_type *j_ptr)
{
int o_type, j_type;
-
- /* Use empty slots */
if (!j_ptr->k_idx) return TRUE;
- /* Hack -- readable books always come first */
if ((o_ptr->tval == REALM1_BOOK) &&
(j_ptr->tval != REALM1_BOOK)) return TRUE;
if ((j_ptr->tval == REALM1_BOOK) &&
if ((j_ptr->tval == REALM2_BOOK) &&
(o_ptr->tval != REALM2_BOOK)) return FALSE;
- /* Objects sort by decreasing type */
if (o_ptr->tval > j_ptr->tval) return TRUE;
if (o_ptr->tval < j_ptr->tval) return FALSE;
- /* Non-aware (flavored) items always come last */
- /* Can happen in the home */
if (!object_is_aware(o_ptr)) return FALSE;
if (!object_is_aware(j_ptr)) return TRUE;
- /* Objects sort by increasing sval */
if (o_ptr->sval < j_ptr->sval) return TRUE;
if (o_ptr->sval > j_ptr->sval) return FALSE;
- /* Unidentified objects always come last */
- /* Objects in the home can be unknown */
if (!object_is_known(o_ptr)) return FALSE;
if (!object_is_known(j_ptr)) return TRUE;
- /* Fixed artifacts, random artifacts and ego items */
if (object_is_fixed_artifact(o_ptr)) o_type = 3;
else if (o_ptr->art_name) o_type = 2;
else if (object_is_ego(o_ptr)) o_type = 1;
case TV_SHOT:
case TV_ARROW:
case TV_BOLT:
- /* Objects sort by increasing hit/damage bonuses */
if (o_ptr->to_h + o_ptr->to_d < j_ptr->to_h + j_ptr->to_d) return TRUE;
if (o_ptr->to_h + o_ptr->to_d > j_ptr->to_h + j_ptr->to_d) return FALSE;
break;
- /* Hack: otherwise identical rods sort by
- increasing recharge time --dsb */
case TV_ROD:
if (o_ptr->pval < j_ptr->pval) return TRUE;
if (o_ptr->pval > j_ptr->pval) return FALSE;
break;
}
- /* Objects sort by decreasing value */
return o_value > object_value(j_ptr);
}
INVENTORY_IDX n = -1;
object_type *j_ptr;
-
-
- /* Check for combining */
for (j = 0; j < INVEN_PACK; j++)
{
j_ptr = &owner_ptr->inventory_list[j];
if (!j_ptr->k_idx) continue;
- /* Hack -- track last item */
n = j;
-
- /* Check if the two items can be combined */
if (object_similar(j_ptr, o_ptr))
{
object_absorb(j_ptr, o_ptr);
owner_ptr->total_weight += (o_ptr->number * o_ptr->weight);
owner_ptr->update |= (PU_BONUS);
owner_ptr->window |= (PW_INVEN);
-
- /* Success */
return (j);
}
}
if (owner_ptr->inven_cnt > INVEN_PACK) return -1;
- /* Find an empty slot */
for (j = 0; j <= INVEN_PACK; j++)
{
j_ptr = &owner_ptr->inventory_list[j];
-
- /* Use it if found */
if (!j_ptr->k_idx) break;
}
- /* Use that slot */
i = j;
-
-
- /* Reorder the pack */
if (i < INVEN_PACK)
{
- /* Get the "value" of the item */
s32b o_value = object_value(o_ptr);
-
- /* Scan every occupied slot */
for (j = 0; j < INVEN_PACK; j++)
{
if (object_sort_comp(o_ptr, o_value, &owner_ptr->inventory_list[j])) break;
}
- /* Use that slot */
i = j;
-
- /* Slide objects */
for (k = n; k >= i; k--)
{
- /* Hack -- Slide the item */
object_copy(&owner_ptr->inventory_list[k + 1], &owner_ptr->inventory_list[k]);
}
- /* Wipe the empty slot */
object_wipe(&owner_ptr->inventory_list[i]);
}
-
- /* Copy the item */
object_copy(&owner_ptr->inventory_list[i], o_ptr);
-
- /* Access new object */
j_ptr = &owner_ptr->inventory_list[i];
-
- /* Forget stack */
j_ptr->next_o_idx = 0;
-
- /* Forget monster */
j_ptr->held_m_idx = 0;
-
- /* Forget location */
j_ptr->iy = j_ptr->ix = 0;
-
- /* Player touches it, and no longer marked */
j_ptr->marked = OM_TOUCHED;
owner_ptr->total_weight += (j_ptr->number * j_ptr->weight);
-
- /* Count the items */
owner_ptr->inven_cnt++;
owner_ptr->update |= (PU_BONUS | PU_COMBINE | PU_REORDER);
owner_ptr->window |= (PW_INVEN);
- /* Return the slot */
return i;
}
INVENTORY_IDX inven_takeoff(player_type *owner_ptr, INVENTORY_IDX item, ITEM_NUMBER amt)
{
INVENTORY_IDX slot;
-
object_type forge;
object_type *q_ptr;
-
object_type *o_ptr;
-
concptr act;
-
GAME_TEXT o_name[MAX_NLEN];
-
-
- /* Get the item to take off */
o_ptr = &owner_ptr->inventory_list[item];
if (amt <= 0) return -1;
- /* Verify */
if (amt > o_ptr->number) amt = o_ptr->number;
q_ptr = &forge;
object_copy(q_ptr, o_ptr);
-
- /* Modify quantity */
q_ptr->number = amt;
-
object_desc(owner_ptr, o_name, q_ptr, 0);
-
- /* Took off weapon */
if (((item == INVEN_RARM) || (item == INVEN_LARM)) &&
object_is_melee_weapon(o_ptr))
{
act = _("を装備からはずした", "You were wielding");
}
-
- /* Took off bow */
else if (item == INVEN_BOW)
{
act = _("を装備からはずした", "You were holding");
}
-
- /* Took off light */
else if (item == INVEN_LITE)
{
act = _("を光源からはずした", "You were holding");
}
-
- /* Took off something */
else
{
act = _("を装備からはずした", "You were wearing");
}
- /* Modify, Optimize */
inven_item_increase(owner_ptr, item, -amt);
inven_item_optimize(owner_ptr, item);
- /* Carry the object */
slot = inven_carry(owner_ptr, q_ptr);
-
#ifdef JP
msg_format("%s(%c)%s。", o_name, index_to_label(slot), act);
#else
object_type forge;
object_type *q_ptr;
object_type *o_ptr;
-
GAME_TEXT o_name[MAX_NLEN];
-
- /* Access original object */
o_ptr = &owner_ptr->inventory_list[item];
-
- /* Error check */
if (amt <= 0) return;
- /* Not too many */
if (amt > o_ptr->number) amt = o_ptr->number;
- /* Take off equipment */
if (item >= INVEN_RARM)
{
- /* Take off first */
item = inven_takeoff(owner_ptr, item, amt);
-
- /* Access original object */
o_ptr = &owner_ptr->inventory_list[item];
}
q_ptr = &forge;
-
- /* Obtain local object */
object_copy(q_ptr, o_ptr);
-
- /* Distribute charges of wands or rods */
distribute_charges(o_ptr, q_ptr, amt);
- /* Modify quantity */
q_ptr->number = amt;
-
- /* Describe local object */
object_desc(owner_ptr, o_name, q_ptr, 0);
-
msg_format(_("%s(%c)を落とした。", "You drop %s (%c)."), o_name, index_to_label(item));
-
- /* Drop it near the player */
(void)drop_near(owner_ptr, q_ptr, 0, owner_ptr->y, owner_ptr->x);
-
vary_item(owner_ptr, item, -amt);
}
is_first_combination = FALSE;
combined = FALSE;
- /* Combine the pack (backwards) */
for (int i = INVEN_PACK; i > 0; i--)
{
object_type *o_ptr;
o_ptr = &owner_ptr->inventory_list[i];
-
- /* Skip empty items */
if (!o_ptr->k_idx) continue;
-
- /* Scan the items above that item */
for (int j = 0; j < i; j++)
{
object_type *j_ptr;
j_ptr = &owner_ptr->inventory_list[j];
-
- /* Skip empty items */
if (!j_ptr->k_idx) continue;
/*
*/
int max_num = object_similar_part(j_ptr, o_ptr);
- /* Can we (partialy) drop "o_ptr" onto "j_ptr"? */
bool is_max = (max_num != 0) && (j_ptr->number < max_num);
if (!is_max) continue;
if (o_ptr->number + j_ptr->number <= max_num)
{
- /* Take note */
flag = TRUE;
-
- /* Add together the item counts */
object_absorb(j_ptr, o_ptr);
-
- /* One object is gone */
owner_ptr->inven_cnt--;
-
- /* Slide everything down */
int k;
for (k = i; k < INVEN_PACK; k++)
{
- /* Structure copy */
owner_ptr->inventory_list[k] = owner_ptr->inventory_list[k + 1];
}
- /* Erase the "final" slot */
object_wipe(&owner_ptr->inventory_list[k]);
}
else
{
int old_num = o_ptr->number;
int remain = j_ptr->number + o_ptr->number - max_num;
-
- /* Add together the item counts */
object_absorb(j_ptr, o_ptr);
-
o_ptr->number = remain;
-
- /* Hack -- if rods are stacking, add the pvals (maximum timeouts) and current timeouts together. -LM- */
if (o_ptr->tval == TV_ROD)
{
o_ptr->pval = o_ptr->pval * remain / old_num;
o_ptr->timeout = o_ptr->timeout * remain / old_num;
}
- /* Hack -- if wands are stacking, combine the charges. -LM- */
if (o_ptr->tval == TV_WAND)
{
o_ptr->pval = o_ptr->pval * remain / old_num;
}
owner_ptr->window |= (PW_INVEN);
-
- /* Take note */
combined = TRUE;
-
break;
}
}
*/
void reorder_pack(player_type *owner_ptr)
{
- int i, j, k;
- s32b o_value;
- object_type forge;
- object_type *q_ptr;
+ int i, j, k;
+ s32b o_value;
+ object_type forge;
+ object_type *q_ptr;
object_type *o_ptr;
- bool flag = FALSE;
+ bool flag = FALSE;
- /* Re-order the pack (forwards) */
for (i = 0; i < INVEN_PACK; i++)
{
- /* Mega-Hack -- allow "proper" over-flow */
if ((i == INVEN_PACK) && (owner_ptr->inven_cnt == INVEN_PACK)) break;
o_ptr = &owner_ptr->inventory_list[i];
-
- /* Skip empty slots */
if (!o_ptr->k_idx) continue;
- /* Get the "value" of the item */
o_value = object_value(o_ptr);
-
- /* Scan every occupied slot */
for (j = 0; j < INVEN_PACK; j++)
{
if (object_sort_comp(o_ptr, o_value, &owner_ptr->inventory_list[j])) break;
}
- /* Never move down */
if (j >= i) continue;
- /* Take note */
flag = TRUE;
q_ptr = &forge;
-
- /* Save a copy of the moving item */
object_copy(q_ptr, &owner_ptr->inventory_list[i]);
-
- /* Slide the objects */
for (k = i; k > j; k--)
{
- /* Slide the item */
object_copy(&owner_ptr->inventory_list[k], &owner_ptr->inventory_list[k - 1]);
}
- /* Insert the moving item */
object_copy(&owner_ptr->inventory_list[j], q_ptr);
-
owner_ptr->window |= (PW_INVEN);
}
*/
void display_koff(player_type *owner_ptr, KIND_OBJECT_IDX k_idx)
{
- int y;
-
object_type forge;
object_type *q_ptr;
- int sval;
+ int sval;
REALM_IDX use_realm;
-
GAME_TEXT o_name[MAX_NLEN];
-
- /* Erase the window */
- for (y = 0; y < Term->hgt; y++)
+ for (int y = 0; y < Term->hgt; y++)
{
- /* Erase the line */
Term_erase(0, y, 255);
}
- /* No info */
if (!k_idx) return;
q_ptr = &forge;
- /* Prepare the object */
object_prep(q_ptr, k_idx);
object_desc(owner_ptr, o_name, q_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY | OD_STORE));
- /* Mention the object name */
Term_putstr(0, 0, -1, TERM_WHITE, o_name);
-
- /* Access the item's sval */
sval = q_ptr->sval;
use_realm = tval2realm(q_ptr->tval);
- /* Warriors are illiterate */
if (owner_ptr->realm1 || owner_ptr->realm2)
{
if ((use_realm != owner_ptr->realm1) && (use_realm != owner_ptr->realm2)) return;
if ((owner_ptr->pclass == CLASS_RED_MAGE) && (use_realm != REALM_ARCANE) && (sval > 1)) return;
}
- /* Display spells in readible books */
- int spell = -1;
- int num = 0;
- SPELL_IDX spells[64];
+ int num = 0;
+ SPELL_IDX spells[64];
- /* Extract spells */
- for (spell = 0; spell < 32; spell++)
+ for (int spell = 0; spell < 32; spell++)
{
- /* Check for this spell */
if (fake_spell_flags[sval] & (1L << spell))
{
- /* Collect this spell */
spells[num++] = spell;
}
}
- /* Print spells */
print_spells(owner_ptr, 0, spells, num, 2, 0, use_realm);
}
*/
int bow_tval_ammo(object_type *o_ptr)
{
- /* Analyze the launcher */
switch (o_ptr->sval)
{
case SV_SLING:
(void)set_kabenuke(creature_ptr, 0, TRUE);
(void)set_tim_res_nether(creature_ptr, 0, TRUE);
(void)set_tim_res_time(creature_ptr, 0, TRUE);
- /* by henkma */
(void)set_tim_reflect(creature_ptr, 0,TRUE);
(void)set_multishadow(creature_ptr, 0,TRUE);
(void)set_dustrobe(creature_ptr, 0,TRUE);
(void)set_ele_attack(creature_ptr, 0, 0);
(void)set_ele_immune(creature_ptr, 0, 0);
- /* Cancel glowing hands */
if (creature_ptr->special_attack & ATTACK_CONFUSE)
{
creature_ptr->special_attack &= ~(ATTACK_CONFUSE);
}
}
- /* Use the value */
creature_ptr->tim_mimic = v;
-
- /* Nothing to notice */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, TRUE);
}
}
- /* Use the value */
creature_ptr->blind = v;
creature_ptr->redraw |= (PR_STATUS);
-
- /* Nothing to notice */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
- /* Fully update the visuals */
creature_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
creature_ptr->redraw |= (PR_MAP);
creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
chg_virtue(creature_ptr, V_HARMONY, -1);
}
}
-
else
{
if (creature_ptr->confused)
}
}
- /* Use the value */
creature_ptr->confused = v;
creature_ptr->redraw |= (PR_STATUS);
- /* Nothing to notice */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
notice = TRUE;
}
}
-
else
{
if (creature_ptr->poisoned)
}
}
- /* Use the value */
creature_ptr->poisoned = v;
creature_ptr->redraw |= (PR_STATUS);
- /* Nothing to notice */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
chg_virtue(creature_ptr, V_VALOUR, -1);
}
}
-
else
{
if (creature_ptr->afraid)
}
}
- /* Use the value */
creature_ptr->afraid = v;
creature_ptr->redraw |= (PR_STATUS);
- /* Nothing to notice */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
return TRUE;
}
+
/*!
* @brief 麻痺の継続時間をセットする / Set "paralyzed", notice observable changes
* @param v 継続時間
notice = TRUE;
}
}
-
else
{
if (creature_ptr->paralyzed)
}
}
- /* Use the value */
creature_ptr->paralyzed = v;
creature_ptr->redraw |= (PR_STATUS);
- /* Nothing to notice */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
notice = TRUE;
}
}
-
else
{
if (creature_ptr->image)
}
}
- /* Use the value */
creature_ptr->image = v;
creature_ptr->redraw |= (PR_STATUS);
- /* Nothing to notice */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, TRUE);
return TRUE;
}
+
/*!
* @brief 加速の継続時間をセットする / Set "fast", notice observable changes
* @param v 継続時間
chg_virtue(creature_ptr, V_DILIGENCE, 1);
}
}
-
else
{
if (creature_ptr->fast && !creature_ptr->lightspeed && !music_singing(creature_ptr, MUSIC_SPEED) && !music_singing(creature_ptr, MUSIC_SHERO))
}
}
- /* Use the value */
creature_ptr->fast = v;
-
- /* Nothing to notice */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
return TRUE;
}
+
/*!
* @brief 光速移動の継続時間をセットする / Set "lightspeed", notice observable changes
* @param v 継続時間
chg_virtue(creature_ptr, V_DILIGENCE, 1);
}
}
-
else
{
if (creature_ptr->lightspeed)
}
}
- /* Use the value */
creature_ptr->lightspeed = v;
- /* Nothing to notice */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
return TRUE;
}
+
/*!
* @brief 減速の継続時間をセットする / Set "slow", notice observable changes
* @param v 継続時間
notice = TRUE;
}
}
-
else
{
if (creature_ptr->slow)
}
}
- /* Use the value */
creature_ptr->slow = v;
-
- /* Nothing to notice */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
notice = TRUE;
}
}
-
else
{
if (creature_ptr->shield)
}
}
- /* Use the value */
creature_ptr->shield = v;
creature_ptr->redraw |= (PR_STATUS);
- /* Nothing to notice */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
notice = TRUE;
}
}
-
else
{
if (creature_ptr->tsubureru)
}
}
- /* Use the value */
creature_ptr->tsubureru = v;
creature_ptr->redraw |= (PR_STATUS);
- /* Nothing to notice */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
notice = TRUE;
}
}
-
else
{
if (creature_ptr->magicdef)
}
}
- /* Use the value */
creature_ptr->magicdef = v;
creature_ptr->redraw |= (PR_STATUS);
- /* Nothing to notice */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
return TRUE;
}
+
/*!
* @brief 祝福の継続時間をセットする / Set "blessed", notice observable changes
* @param v 継続時間
}
}
- /* Use the value */
creature_ptr->blessed = v;
creature_ptr->redraw |= (PR_STATUS);
- /* Nothing to notice */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
notice = TRUE;
}
}
-
else
{
if (creature_ptr->hero && !music_singing(creature_ptr, MUSIC_HERO) && !music_singing(creature_ptr, MUSIC_SHERO))
}
}
- /* Use the value */
creature_ptr->hero = v;
creature_ptr->redraw |= (PR_STATUS);
- /* Nothing to notice */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
creature_ptr->update |= (PU_BONUS);
-
- /* Recalculate hitpoints */
creature_ptr->update |= (PU_HP);
handle_stuff(creature_ptr);
return TRUE;
notice = TRUE;
}
}
-
else
{
if (creature_ptr->shero)
}
}
- /* Use the value */
creature_ptr->shero = v;
creature_ptr->redraw |= (PR_STATUS);
- /* Nothing to notice */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
creature_ptr->update |= (PU_BONUS);
-
- /* Recalculate hitpoints */
creature_ptr->update |= (PU_HP);
handle_stuff(creature_ptr);
return TRUE;
}
+
/*!
* @brief 対邪悪結界の継続時間をセットする / Set "protevil", notice observable changes
* @param v 継続時間
notice = TRUE;
}
}
-
else
{
if (creature_ptr->protevil)
}
}
- /* Use the value */
creature_ptr->protevil = v;
creature_ptr->redraw |= (PR_STATUS);
- /* Nothing to notice */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
return TRUE;
}
+
/*!
* @brief 幽体化の継続時間をセットする / Set "wraith_form", notice observable changes
* @param v 継続時間
creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
}
}
-
else
{
if (creature_ptr->wraith_form)
}
}
- /* Use the value */
creature_ptr->wraith_form = v;
creature_ptr->redraw |= (PR_STATUS);
- /* Nothing to notice */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
creature_ptr->update |= (PU_BONUS);
handle_stuff(creature_ptr);
return TRUE;
-
}
+
/*!
* @brief 無傷球の継続時間をセットする / Set "invuln", notice observable changes
* @param v 継続時間
creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
}
}
-
else
{
if (creature_ptr->invuln && !music_singing(creature_ptr, MUSIC_INVULN))
}
}
- /* Use the value */
creature_ptr->invuln = v;
creature_ptr->redraw |= (PR_STATUS);
- /* Nothing to notice */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
return TRUE;
}
+
/*!
* @brief 時限ESPの継続時間をセットする / Set "tim_esp", notice observable changes
* @param v 継続時間
}
}
- /* Use the value */
creature_ptr->tim_esp = v;
creature_ptr->redraw |= (PR_STATUS);
- /* Nothing to notice */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
return TRUE;
}
+
/*!
* @brief 時限透明視の継続時間をセットする / Set "tim_invis", notice observable changes
* @param v 継続時間
notice = TRUE;
}
}
-
else
{
if (creature_ptr->tim_invis)
}
}
- /* Use the value */
creature_ptr->tim_invis = v;
creature_ptr->redraw |= (PR_STATUS);
- /* Nothing to notice */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
creature_ptr->update |= (PU_BONUS);
-
- /* Update the monsters */
creature_ptr->update |= (PU_MONSTERS);
handle_stuff(creature_ptr);
return TRUE;
}
+
/*!
* @brief 時限赤外線視力の継続時間をセットする / Set "tim_infra", notice observable changes
* @param v 継続時間
notice = TRUE;
}
}
-
else
{
if (creature_ptr->tim_infra)
}
}
- /* Use the value */
creature_ptr->tim_infra = v;
creature_ptr->redraw |= (PR_STATUS);
- /* Nothing to notice */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
creature_ptr->update |= (PU_BONUS);
-
- /* Update the monsters */
creature_ptr->update |= (PU_MONSTERS);
handle_stuff(creature_ptr);
return TRUE;
}
+
/*!
* @brief 時限急回復の継続時間をセットする / Set "tim_regen", notice observable changes
* @param v 継続時間
notice = TRUE;
}
}
-
else
{
if (creature_ptr->tim_regen)
}
}
- /* Use the value */
creature_ptr->tim_regen = v;
creature_ptr->redraw |= (PR_STATUS);
- /* Nothing to notice */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
return TRUE;
}
+
/*!
* @brief 隠密の歌の継続時間をセットする / Set "tim_stealth", notice observable changes
* @param v 継続時間
notice = TRUE;
}
}
-
else
{
if (creature_ptr->tim_stealth && !music_singing(creature_ptr, MUSIC_STEALTH))
}
}
- /* Use the value */
creature_ptr->tim_stealth = v;
creature_ptr->redraw |= (PR_STATUS);
- /* Nothing to notice */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
return TRUE;
}
+
/*!
* @brief 超隠密状態をセットする
* @param set TRUEならば超隠密状態になる。
}
notice = TRUE;
-
- /* Use the value */
creature_ptr->special_defense |= NINJA_S_STEALTH;
}
}
-
else
{
if (creature_ptr->special_defense & NINJA_S_STEALTH)
{
msg_print(_("再び敵の目にさらされるようになった。", "You are exposed to common sight once more."));
notice = TRUE;
-
- /* Use the value */
creature_ptr->special_defense &= ~(NINJA_S_STEALTH);
}
}
- /* Nothing to notice */
if (!notice) return FALSE;
creature_ptr->redraw |= (PR_STATUS);
return TRUE;
}
+
/*!
* @brief 一時的浮遊の継続時間をセットする / Set "tim_levitation", notice observable changes
* @param v 継続時間
notice = TRUE;
}
}
-
else
{
if (creature_ptr->tim_levitation)
}
}
- /* Use the value */
creature_ptr->tim_levitation = v;
creature_ptr->redraw |= (PR_STATUS);
- /* Nothing to notice */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
return TRUE;
}
+
/*!
* @brief 一時的闘気のオーラの継続時間をセットする / Set "tim_sh_touki", notice observable changes
* @param v 継続時間
notice = TRUE;
}
}
-
else
{
if (creature_ptr->tim_sh_touki)
}
}
- /* Use the value */
creature_ptr->tim_sh_touki = v;
creature_ptr->redraw |= (PR_STATUS);
- /* Nothing to notice */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
return TRUE;
}
+
/*!
* @brief 一時的火炎のオーラの継続時間をセットする / Set "tim_sh_fire", notice observable changes
* @param v 継続時間
notice = TRUE;
}
}
-
else
{
if (creature_ptr->tim_sh_fire)
}
}
- /* Use the value */
creature_ptr->tim_sh_fire = v;
creature_ptr->redraw |= (PR_STATUS);
- /* Nothing to notice */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
return TRUE;
}
+
/*!
* @brief 一時的聖なるのオーラの継続時間をセットする / Set "tim_sh_holy", notice observable changes
* @param v 継続時間
notice = TRUE;
}
}
-
else
{
if (creature_ptr->tim_sh_holy)
}
}
- /* Use the value */
creature_ptr->tim_sh_holy = v;
creature_ptr->redraw |= (PR_STATUS);
- /* Nothing to notice */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
return TRUE;
}
+
/*!
* @brief 目には目をの残り時間をセットする / Set "tim_eyeeye", notice observable changes
* @param v 継続時間
notice = TRUE;
}
}
-
else
{
if (creature_ptr->tim_eyeeye)
}
}
- /* Use the value */
creature_ptr->tim_eyeeye = v;
creature_ptr->redraw |= (PR_STATUS);
- /* Nothing to notice */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
notice = TRUE;
}
}
-
else
{
if (creature_ptr->resist_magic)
}
}
- /* Use the value */
creature_ptr->resist_magic = v;
creature_ptr->redraw |= (PR_STATUS);
- /* Nothing to notice */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
return TRUE;
}
+
/*!
* @brief 一時的反射の継続時間をセットする / Set "tim_reflect", notice observable changes
* @param v 継続時間
notice = TRUE;
}
}
-
else
{
if (creature_ptr->tim_reflect)
}
}
- /* Use the value */
creature_ptr->tim_reflect = v;
creature_ptr->redraw |= (PR_STATUS);
- /* Nothing to notice */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
notice = TRUE;
}
}
-
else
{
if (creature_ptr->multishadow)
}
}
- /* Use the value */
creature_ptr->multishadow = v;
creature_ptr->redraw |= (PR_STATUS);
- /* Nothing to notice */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
return TRUE;
}
+
/*!
* @brief 一時的破片のオーラの継続時間をセットする / Set "dustrobe", notice observable changes
* @param v 継続時間
notice = TRUE;
}
}
-
else
{
if (creature_ptr->dustrobe)
}
}
- /* Use the value */
creature_ptr->dustrobe = v;
creature_ptr->redraw |= (PR_STATUS);
- /* Nothing to notice */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
return TRUE;
}
+
/*!
* @brief 一時的壁抜けの継続時間をセットする / Set "kabenuke", notice observable changes
* @param v 継続時間
notice = TRUE;
}
}
-
else
{
if (creature_ptr->kabenuke)
}
}
- /* Use the value */
creature_ptr->kabenuke = v;
creature_ptr->redraw |= (PR_STATUS);
- /* Nothing to notice */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
return TRUE;
}
+
/*!
* @brief オクレ兄さんの継続時間をセットする / Set "tsuyoshi", notice observable changes
* @param v 継続時間
chg_virtue(creature_ptr, V_VITALITY, 2);
}
}
-
else
{
if (creature_ptr->tsuyoshi)
}
}
- /* Use the value */
creature_ptr->tsuyoshi = v;
creature_ptr->redraw |= (PR_STATUS);
- /* Nothing to notice */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
creature_ptr->update |= (PU_BONUS);
-
- /* Recalculate hitpoints */
creature_ptr->update |= (PU_HP);
handle_stuff(creature_ptr);
return TRUE;
}
+
/*!
* @brief 一時的元素スレイの継続時間をセットする / Set a temporary elemental brand. Clear all other brands. Print status messages. -LM-
* @param attack_type スレイのタイプID
{
v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
- /* Clear all elemental attacks (only one is allowed at a time). */
if ((creature_ptr->special_attack & (ATTACK_ACID)) && (attack_type != ATTACK_ACID))
{
creature_ptr->special_attack &= ~(ATTACK_ACID);
msg_print(_("酸で攻撃できなくなった。", "Your temporary acidic brand fades away."));
}
+
if ((creature_ptr->special_attack & (ATTACK_ELEC)) && (attack_type != ATTACK_ELEC))
{
creature_ptr->special_attack &= ~(ATTACK_ELEC);
msg_print(_("電撃で攻撃できなくなった。", "Your temporary electrical brand fades away."));
}
+
if ((creature_ptr->special_attack & (ATTACK_FIRE)) && (attack_type != ATTACK_FIRE))
{
creature_ptr->special_attack &= ~(ATTACK_FIRE);
msg_print(_("火炎で攻撃できなくなった。", "Your temporary fiery brand fades away."));
}
+
if ((creature_ptr->special_attack & (ATTACK_COLD)) && (attack_type != ATTACK_COLD))
{
creature_ptr->special_attack &= ~(ATTACK_COLD);
msg_print(_("冷気で攻撃できなくなった。", "Your temporary frost brand fades away."));
}
+
if ((creature_ptr->special_attack & (ATTACK_POIS)) && (attack_type != ATTACK_POIS))
{
creature_ptr->special_attack &= ~(ATTACK_POIS);
if ((v) && (attack_type))
{
- /* Set attack type. */
creature_ptr->special_attack |= (attack_type);
-
- /* Set duration. */
creature_ptr->ele_attack = v;
-
#ifdef JP
msg_format("%sで攻撃できるようになった!",
((attack_type == ATTACK_ACID) ? "酸" :
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
creature_ptr->redraw |= (PR_STATUS);
-
creature_ptr->update |= (PU_BONUS);
handle_stuff(creature_ptr);
return TRUE;
}
+
/*!
* @brief 一時的元素免疫の継続時間をセットする / Set a temporary elemental brand. Clear all other brands. Print status messages. -LM-
* @param immune_type 免疫のタイプID
{
v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
- /* Clear all elemental attacks (only one is allowed at a time). */
if ((creature_ptr->special_defense & (DEFENSE_ACID)) && (immune_type != DEFENSE_ACID))
{
creature_ptr->special_defense &= ~(DEFENSE_ACID);
msg_print(_("酸の攻撃で傷つけられるようになった。。", "You are no longer immune to acid."));
}
+
if ((creature_ptr->special_defense & (DEFENSE_ELEC)) && (immune_type != DEFENSE_ELEC))
{
creature_ptr->special_defense &= ~(DEFENSE_ELEC);
msg_print(_("電撃の攻撃で傷つけられるようになった。。", "You are no longer immune to electricity."));
}
+
if ((creature_ptr->special_defense & (DEFENSE_FIRE)) && (immune_type != DEFENSE_FIRE))
{
creature_ptr->special_defense &= ~(DEFENSE_FIRE);
msg_print(_("火炎の攻撃で傷つけられるようになった。。", "You are no longer immune to fire."));
}
+
if ((creature_ptr->special_defense & (DEFENSE_COLD)) && (immune_type != DEFENSE_COLD))
{
creature_ptr->special_defense &= ~(DEFENSE_COLD);
msg_print(_("冷気の攻撃で傷つけられるようになった。。", "You are no longer immune to cold."));
}
+
if ((creature_ptr->special_defense & (DEFENSE_POIS)) && (immune_type != DEFENSE_POIS))
{
creature_ptr->special_defense &= ~(DEFENSE_POIS);
if ((v) && (immune_type))
{
- /* Set attack type. */
creature_ptr->special_defense |= (immune_type);
-
- /* Set duration. */
creature_ptr->ele_immune = v;
-
msg_format(_("%sの攻撃を受けつけなくなった!", "For a while, You are immune to %s"),
((immune_type == DEFENSE_ACID) ? _("酸", "acid!") :
((immune_type == DEFENSE_ELEC) ? _("電撃", "electricity!") :
{
bool notice = FALSE;
v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
-
if (creature_ptr->is_dead) return FALSE;
if (v)
notice = TRUE;
}
}
-
else
{
if (creature_ptr->oppose_acid && !music_singing(creature_ptr, MUSIC_RESIST) && !(creature_ptr->special_defense & KATA_MUSOU))
}
}
- /* Use the value */
creature_ptr->oppose_acid = v;
- /* Nothing to notice */
if (!notice) return FALSE;
creature_ptr->redraw |= (PR_STATUS);
return TRUE;
}
+
/*!
* @brief 一時的電撃耐性の継続時間をセットする / Set "oppose_elec", notice observable changes
* @param v 継続時間
notice = TRUE;
}
}
-
else
{
if (creature_ptr->oppose_elec && !music_singing(creature_ptr, MUSIC_RESIST) && !(creature_ptr->special_defense & KATA_MUSOU))
}
}
- /* Use the value */
creature_ptr->oppose_elec = v;
- /* Nothing to notice */
if (!notice) return FALSE;
creature_ptr->redraw |= (PR_STATUS);
return TRUE;
}
+
/*!
* @brief 一時的火炎耐性の継続時間をセットする / Set "oppose_fire", notice observable changes
* @param v 継続時間
{
bool notice = FALSE;
v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
-
if (creature_ptr->is_dead) return FALSE;
if ((PRACE_IS_(creature_ptr, RACE_DEMON) && (creature_ptr->lev > 44)) || (creature_ptr->mimic_form == MIMIC_DEMON)) v = 1;
notice = TRUE;
}
}
-
else
{
if (creature_ptr->oppose_fire && !music_singing(creature_ptr, MUSIC_RESIST) && !(creature_ptr->special_defense & KATA_MUSOU))
}
}
- /* Use the value */
creature_ptr->oppose_fire = v;
- /* Nothing to notice */
if (!notice) return FALSE;
creature_ptr->redraw |= (PR_STATUS);
return TRUE;
}
+
/*!
* @brief 一時的冷気耐性の継続時間をセットする / Set "oppose_cold", notice observable changes
* @param v 継続時間
{
bool notice = FALSE;
v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
-
if (creature_ptr->is_dead) return FALSE;
if (v)
notice = TRUE;
}
}
-
else
{
if (creature_ptr->oppose_cold && !music_singing(creature_ptr, MUSIC_RESIST) && !(creature_ptr->special_defense & KATA_MUSOU))
}
}
- /* Use the value */
creature_ptr->oppose_cold = v;
- /* Nothing to notice */
if (!notice) return FALSE;
creature_ptr->redraw |= (PR_STATUS);
return TRUE;
}
+
/*!
* @brief 一時的毒耐性の継続時間をセットする / Set "oppose_pois", notice observable changes
* @param v 継続時間
{
bool notice = FALSE;
v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
-
if ((creature_ptr->pclass == CLASS_NINJA) && (creature_ptr->lev > 44)) v = 1;
if (creature_ptr->is_dead) return FALSE;
notice = TRUE;
}
}
-
else
{
if (creature_ptr->oppose_pois && !music_singing(creature_ptr, MUSIC_RESIST) && !(creature_ptr->special_defense & KATA_MUSOU))
}
}
- /* Use the value */
creature_ptr->oppose_pois = v;
-
- /* Nothing to notice */
if (!notice) return FALSE;
creature_ptr->redraw |= (PR_STATUS);
return TRUE;
}
+
/*!
* @brief 朦朧の継続時間をセットする / Set "stun", notice observable changes
* @param v 継続時間
int old_aux, new_aux;
bool notice = FALSE;
v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
-
if (creature_ptr->is_dead) return FALSE;
if (PRACE_IS_(creature_ptr, RACE_GOLEM) || ((creature_ptr->pclass == CLASS_BERSERKER) && (creature_ptr->lev > 34))) v = 0;
- /* Knocked out */
if (creature_ptr->stun > 100)
{
old_aux = 3;
}
-
- /* Heavy stun */
else if (creature_ptr->stun > 50)
{
old_aux = 2;
}
-
- /* Stun */
else if (creature_ptr->stun > 0)
{
old_aux = 1;
}
-
- /* None */
else
{
old_aux = 0;
}
- /* Knocked out */
if (v > 100)
{
new_aux = 3;
}
-
- /* Heavy stun */
else if (v > 50)
{
new_aux = 2;
}
-
- /* Stun */
else if (v > 0)
{
new_aux = 1;
}
-
- /* None */
else
{
new_aux = 0;
}
- /* Increase cut */
if (new_aux > old_aux)
{
- /* Describe the state */
switch (new_aux)
{
- /* Stun */
case 1: msg_print(_("意識がもうろうとしてきた。", "You have been stunned.")); break;
-
- /* Heavy stun */
case 2: msg_print(_("意識がひどくもうろうとしてきた。", "You have been heavily stunned.")); break;
-
- /* Knocked out */
case 3: msg_print(_("頭がクラクラして意識が遠のいてきた。", "You have been knocked out.")); break;
}
if (!creature_ptr->sustain_wis) (void)do_dec_stat(creature_ptr, A_WIS);
}
}
+
if (creature_ptr->special_defense & KATA_MASK)
{
msg_print(_("型が崩れた。", "You lose your stance."));
creature_ptr->action = ACTION_NONE;
}
- /* Sniper */
if (creature_ptr->concent) reset_concentration(creature_ptr, TRUE);
if (hex_spelling_any(creature_ptr)) stop_hex_spell_all(creature_ptr);
notice = TRUE;
}
-
- /* Decrease cut */
else if (new_aux < old_aux)
{
- /* Describe the state */
- switch (new_aux)
+ if (new_aux == 0)
{
- /* None */
- case 0:
msg_print(_("やっと朦朧状態から回復した。", "You are no longer stunned."));
-
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
- break;
}
notice = TRUE;
}
- /* Use the value */
creature_ptr->stun = v;
- /* No change */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
creature_ptr->update |= (PU_BONUS);
-
- /* Redraw the "stun" */
creature_ptr->redraw |= (PR_STUN);
handle_stuff(creature_ptr);
return TRUE;
int old_aux, new_aux;
bool notice = FALSE;
v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
-
if (creature_ptr->is_dead) return FALSE;
if ((creature_ptr->prace == RACE_GOLEM ||
!creature_ptr->mimic_form)
v = 0;
- /* Mortal wound */
if (creature_ptr->cut > 1000)
{
old_aux = 7;
}
-
- /* Deep gash */
else if (creature_ptr->cut > 200)
{
old_aux = 6;
}
-
- /* Severe cut */
else if (creature_ptr->cut > 100)
{
old_aux = 5;
}
-
- /* Nasty cut */
else if (creature_ptr->cut > 50)
{
old_aux = 4;
}
-
- /* Bad cut */
else if (creature_ptr->cut > 25)
{
old_aux = 3;
}
-
- /* Light cut */
else if (creature_ptr->cut > 10)
{
old_aux = 2;
}
-
- /* Graze */
else if (creature_ptr->cut > 0)
{
old_aux = 1;
}
-
- /* None */
else
{
old_aux = 0;
}
- /* Mortal wound */
if (v > 1000)
{
new_aux = 7;
}
-
- /* Deep gash */
else if (v > 200)
{
new_aux = 6;
}
-
- /* Severe cut */
else if (v > 100)
{
new_aux = 5;
}
-
- /* Nasty cut */
else if (v > 50)
{
new_aux = 4;
}
-
- /* Bad cut */
else if (v > 25)
{
new_aux = 3;
}
-
- /* Light cut */
else if (v > 10)
{
new_aux = 2;
}
-
- /* Graze */
else if (v > 0)
{
new_aux = 1;
}
-
- /* None */
else
{
new_aux = 0;
}
- /* Increase cut */
if (new_aux > old_aux)
{
- /* Describe the state */
switch (new_aux)
{
- /* Graze */
case 1: msg_print(_("かすり傷を負ってしまった。", "You have been given a graze.")); break;
-
- /* Light cut */
case 2: msg_print(_("軽い傷を負ってしまった。", "You have been given a light cut.")); break;
-
- /* Bad cut */
case 3: msg_print(_("ひどい傷を負ってしまった。", "You have been given a bad cut.")); break;
-
- /* Nasty cut */
case 4: msg_print(_("大変な傷を負ってしまった。", "You have been given a nasty cut.")); break;
-
- /* Severe cut */
case 5: msg_print(_("重大な傷を負ってしまった。", "You have been given a severe cut.")); break;
-
- /* Deep gash */
case 6: msg_print(_("ひどい深手を負ってしまった。", "You have been given a deep gash.")); break;
-
- /* Mortal wound */
case 7: msg_print(_("致命的な傷を負ってしまった。", "You have been given a mortal wound.")); break;
}
notice = TRUE;
-
if (randint1(1000) < v || one_in_(16))
{
if (!creature_ptr->sustain_chr)
}
}
}
-
- /* Decrease cut */
else if (new_aux < old_aux)
{
- /* Describe the state */
- switch (new_aux)
+ if (new_aux == 0)
{
- /* None */
- case 0:
msg_format(_("やっと%s。", "You are no longer bleeding."), creature_ptr->prace == RACE_ANDROID ? "怪我が直った" : "出血が止まった");
-
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
- break;
}
notice = TRUE;
}
- /* Use the value */
creature_ptr->cut = v;
-
- /* No change */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
creature_ptr->update |= (PU_BONUS);
-
- /* Redraw the "cut" */
creature_ptr->redraw |= (PR_CUT);
handle_stuff(creature_ptr);
return TRUE;
}
+
/*!
* @brief 空腹状態をセットする / Set "food", notice observable changes
* @param v 継続時間
bool notice = FALSE;
v = (v > 20000) ? 20000 : (v < 0) ? 0 : v;
-
- /* Fainting / Starving */
if (creature_ptr->food < PY_FOOD_FAINT)
{
old_aux = 0;
}
-
- /* Weak */
else if (creature_ptr->food < PY_FOOD_WEAK)
{
old_aux = 1;
}
-
- /* Hungry */
else if (creature_ptr->food < PY_FOOD_ALERT)
{
old_aux = 2;
}
-
- /* Normal */
else if (creature_ptr->food < PY_FOOD_FULL)
{
old_aux = 3;
}
-
- /* Full */
else if (creature_ptr->food < PY_FOOD_MAX)
{
old_aux = 4;
}
-
- /* Gorged */
else
{
old_aux = 5;
}
- /* Fainting / Starving */
if (v < PY_FOOD_FAINT)
{
new_aux = 0;
}
-
- /* Weak */
else if (v < PY_FOOD_WEAK)
{
new_aux = 1;
}
-
- /* Hungry */
else if (v < PY_FOOD_ALERT)
{
new_aux = 2;
}
-
- /* Normal */
else if (v < PY_FOOD_FULL)
{
new_aux = 3;
}
-
- /* Full */
else if (v < PY_FOOD_MAX)
{
new_aux = 4;
}
-
- /* Gorged */
else
{
new_aux = 5;
if (old_aux == 0)
chg_virtue(creature_ptr, V_TEMPERANCE, -1);
- /* Food increase */
if (new_aux > old_aux)
{
- /* Describe the state */
switch (new_aux)
{
- /* Weak */
case 1: msg_print(_("まだ空腹で倒れそうだ。", "You are still weak.")); break;
-
- /* Hungry */
case 2: msg_print(_("まだ空腹だ。", "You are still hungry.")); break;
-
- /* Normal */
case 3: msg_print(_("空腹感がおさまった。", "You are no longer hungry.")); break;
-
- /* Full */
case 4: msg_print(_("満腹だ!", "You are full!")); break;
- /* Bloated */
case 5:
msg_print(_("食べ過ぎだ!", "You have gorged yourself!"));
chg_virtue(creature_ptr, V_HARMONY, -1);
chg_virtue(creature_ptr, V_PATIENCE, -1);
chg_virtue(creature_ptr, V_TEMPERANCE, -2);
-
break;
}
- /* Change */
notice = TRUE;
}
-
- /* Food decrease */
else if (new_aux < old_aux)
{
- /* Describe the state */
switch (new_aux)
{
- /* Fainting / Starving */
case 0: msg_print(_("あまりにも空腹で気を失ってしまった!", "You are getting faint from hunger!")); break;
-
- /* Weak */
case 1: msg_print(_("お腹が空いて倒れそうだ。", "You are getting weak from hunger!")); break;
-
- /* Hungry */
case 2: msg_print(_("お腹が空いてきた。", "You are getting hungry.")); break;
-
- /* Normal */
case 3: msg_print(_("満腹感がなくなった。", "You are no longer full.")); break;
-
- /* Full */
case 4: msg_print(_("やっとお腹がきつくなくなった。", "You are no longer gorged.")); break;
}
change_wild_mode(creature_ptr, FALSE);
}
- /* Change */
notice = TRUE;
}
- /* Use the value */
creature_ptr->food = v;
-
- /* Nothing to notice */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
creature_ptr->update |= (PU_BONUS);
-
- /* Redraw hunger */
creature_ptr->redraw |= (PR_HUNGER);
handle_stuff(creature_ptr);
+
return TRUE;
}
+
/*!
* @brief プレイヤーの基本能力値を増加させる / Increases a stat by one randomized level -RAK-
* @param stat 上昇させるステータスID
*/
bool inc_stat(player_type *creature_ptr, int stat)
{
- BASE_STATUS value, gain;
-
- /* Then augment the current/max stat */
- value = creature_ptr->stat_cur[stat];
+ BASE_STATUS gain;
+ BASE_STATUS value = creature_ptr->stat_cur[stat];
- /* Cannot go above 18/100 */
if (value < creature_ptr->stat_max_max[stat])
{
- /* Gain one (sometimes two) points */
if (value < 18)
{
gain = ((randint0(100) < 75) ? 1 : 2);
value += gain;
}
-
- /* Gain 1/6 to 1/3 of distance to 18/100 */
else if (value < (creature_ptr->stat_max_max[stat]-2))
{
- /* Approximate gain value */
gain = (((creature_ptr->stat_max_max[stat]) - value) / 2 + 3) / 2;
if (gain < 1) gain = 1;
- /* Apply the bonus */
value += randint1(gain) + gain / 2;
-
- /* Maximal value */
if (value > (creature_ptr->stat_max_max[stat]-1)) value = creature_ptr->stat_max_max[stat]-1;
}
-
- /* Gain one point at a time */
else
{
value++;
}
- /* Save the new value */
creature_ptr->stat_cur[stat] = value;
-
- /* Bring up the maximum too */
if (value > creature_ptr->stat_max[stat])
{
creature_ptr->stat_max[stat] = value;
}
- creature_ptr->update |= (PU_BONUS);
- /* Success */
+ creature_ptr->update |= (PU_BONUS);
return TRUE;
}
- /* Nothing to gain */
return FALSE;
}
+
/*!
* @brief プレイヤーの基本能力値を減少させる / Decreases a stat by an amount indended to vary from 0 to 100 percent.
* @param stat 減少させるステータスID
*/
bool dec_stat(player_type *creature_ptr, int stat, int amount, int permanent)
{
- BASE_STATUS cur, max;
- int loss, same;
+ int loss;
bool res = FALSE;
- /* Acquire current value */
- cur = creature_ptr->stat_cur[stat];
- max = creature_ptr->stat_max[stat];
-
- /* Note when the values are identical */
- same = (cur == max);
-
- /* Damage "current" value */
+ BASE_STATUS cur = creature_ptr->stat_cur[stat];
+ BASE_STATUS max = creature_ptr->stat_max[stat];
+ int same = (cur == max);
if (cur > 3)
{
- /* Handle "low" values */
if (cur <= 18)
{
if (amount > 90) cur--;
if (amount > 20) cur--;
cur--;
}
-
- /* Handle "high" values */
else
{
- /* Hack -- Decrement by a random amount between one-quarter */
- /* and one-half of the stat bonus times the percentage, with a */
- /* minimum damage of half the percentage. -CWS */
loss = (((cur-18) / 2 + 1) / 2 + 1);
if (loss < 1) loss = 1;
- /* Randomize the loss */
loss = ((randint1(loss) + loss) * amount) / 100;
-
- /* Maximal loss */
if (loss < amount/2) loss = amount/2;
- /* Lose some points */
cur = cur - loss;
-
- /* Hack -- Only reduce stat to 17 sometimes */
if (cur < 18) cur = (amount <= 20) ? 18 : 17;
}
- /* Prevent illegal values */
if (cur < 3) cur = 3;
- /* Something happened */
if (cur != creature_ptr->stat_cur[stat]) res = TRUE;
}
- /* Damage "max" value */
if (permanent && (max > 3))
{
chg_virtue(creature_ptr, V_SACRIFICE, 1);
if (stat == A_WIS || stat == A_INT)
chg_virtue(creature_ptr, V_ENLIGHTEN, -2);
- /* Handle "low" values */
if (max <= 18)
{
if (amount > 90) max--;
if (amount > 20) max--;
max--;
}
-
- /* Handle "high" values */
else
{
- /* Hack -- Decrement by a random amount between one-quarter */
- /* and one-half of the stat bonus times the percentage, with a */
- /* minimum damage of half the percentage. -CWS */
loss = (((max-18) / 2 + 1) / 2 + 1);
loss = ((randint1(loss) + loss) * amount) / 100;
if (loss < amount/2) loss = amount/2;
- /* Lose some points */
max = max - loss;
-
- /* Hack -- Only reduce stat to 17 sometimes */
if (max < 18) max = (amount <= 20) ? 18 : 17;
}
- /* Hack -- keep it clean */
if (same || (max < cur)) max = cur;
- /* Something happened */
if (max != creature_ptr->stat_max[stat]) res = TRUE;
}
if (res)
{
- /* Actually set the stat to its new value. */
creature_ptr->stat_cur[stat] = cur;
creature_ptr->stat_max[stat] = max;
-
creature_ptr->redraw |= (PR_STATS);
creature_ptr->update |= (PU_BONUS);
}
*/
bool res_stat(player_type *creature_ptr, int stat)
{
- /* Restore if needed */
if (creature_ptr->stat_cur[stat] != creature_ptr->stat_max[stat])
{
creature_ptr->stat_cur[stat] = creature_ptr->stat_max[stat];
creature_ptr->update |= (PU_BONUS);
creature_ptr->redraw |= (PR_STATS);
-
- /* Success */
return TRUE;
}
- /* Nothing to restore */
return FALSE;
}
{
num = num * (creature_ptr->virtues[vir - 1] + 1250) / 1250;
}
- /* Healing needed */
+
if (creature_ptr->chp < creature_ptr->mhp)
{
if ((num > 0) && (creature_ptr->chp < (creature_ptr->mhp/3)))
chg_virtue(creature_ptr, V_TEMPERANCE, 1);
- /* Gain hitpoints */
- creature_ptr->chp += num;
- /* Enforce maximum */
+ creature_ptr->chp += num;
if (creature_ptr->chp >= creature_ptr->mhp)
{
creature_ptr->chp = creature_ptr->mhp;
}
creature_ptr->redraw |= (PR_HP);
-
creature_ptr->window |= (PW_PLAYER);
-
- /* Heal 0-4 */
if (num < 5)
{
msg_print(_("少し気分が良くなった。", "You feel a little better."));
}
-
- /* Heal 5-14 */
else if (num < 15)
{
msg_print(_("気分が良くなった。", "You feel better."));
}
-
- /* Heal 15-34 */
else if (num < 35)
{
msg_print(_("とても気分が良くなった。", "You feel much better."));
}
-
- /* Heal 35+ */
else
{
msg_print(_("ひじょうに気分が良くなった。", "You feel very good."));
return TRUE;
}
- /* Ignore */
return FALSE;
}
case A_CHR: if (creature_ptr->sustain_chr) sust = TRUE; break;
}
- /* Sustain */
if (sust && (!ironman_nightmare || randint0(13)))
{
msg_format(_("%sなった気がしたが、すぐに元に戻った。", "You feel %s for a moment, but the feeling passes."),
desc_stat_neg[stat]);
- /* Notice effect */
return TRUE;
}
- /* Attempt to reduce the stat */
if (dec_stat(creature_ptr, stat, 10, (ironman_nightmare && !randint0(13))))
{
msg_format(_("ひどく%sなった気がする。", "You feel %s."), desc_stat_neg[stat]);
- /* Notice effect */
return TRUE;
}
- /* Nothing obvious */
return FALSE;
}
*/
bool do_res_stat(player_type *creature_ptr, int stat)
{
- /* Attempt to increase */
if (res_stat(creature_ptr, stat))
{
msg_format(_("元通りに%sなった気がする。", "You feel %s."), desc_stat_pos[stat]);
return TRUE;
}
- /* Nothing obvious */
return FALSE;
}
*/
bool do_inc_stat(player_type *creature_ptr, int stat)
{
- bool res;
-
- /* Restore strength */
- res = res_stat(creature_ptr, stat);
-
- /* Attempt to increase */
+ bool res = res_stat(creature_ptr, stat);
if (inc_stat(creature_ptr, stat))
{
if (stat == A_WIS)
chg_virtue(creature_ptr, V_VITALITY, 1);
msg_format(_("ワーオ!とても%sなった!", "Wow! You feel %s!"), desc_stat_pos[stat]);
-
return TRUE;
}
- /* Restoration worked */
if (res)
{
msg_format(_("元通りに%sなった気がする。", "You feel %s."), desc_stat_pos[stat]);
-
return TRUE;
}
- /* Nothing obvious */
return FALSE;
}
*/
bool restore_level(player_type *creature_ptr)
{
- /* Restore experience */
if (creature_ptr->exp < creature_ptr->max_exp)
{
msg_print(_("経験値が戻ってきた気がする。", "You feel your experience returning."));
-
- /* Restore the experience */
creature_ptr->exp = creature_ptr->max_exp;
-
- /* Check the experience */
check_experience(creature_ptr);
-
- /* Did something */
return TRUE;
}
- /* No effect */
return FALSE;
}
+
/*
* Forget everything
*/
bool lose_all_info(player_type *creature_ptr)
{
- int i;
-
chg_virtue(creature_ptr, V_KNOWLEDGE, -5);
chg_virtue(creature_ptr, V_ENLIGHTEN, -5);
-
- /* Forget info about objects */
- for (i = 0; i < INVEN_TOTAL; i++)
+ for (int i = 0; i < INVEN_TOTAL; i++)
{
object_type *o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx) continue;
-
- /* Allow "protection" by the MENTAL flag */
if (o_ptr->ident & (IDENT_MENTAL)) continue;
- /* Remove "default inscriptions" */
o_ptr->feeling = FEEL_NONE;
-
- /* Hack -- Clear the "empty" flag */
o_ptr->ident &= ~(IDENT_EMPTY);
-
- /* Hack -- Clear the "known" flag */
o_ptr->ident &= ~(IDENT_KNOWN);
-
- /* Hack -- Clear the "felt" flag */
o_ptr->ident &= ~(IDENT_SENSE);
}
+
creature_ptr->update |= (PU_BONUS);
creature_ptr->update |= (PU_COMBINE | PU_REORDER);
-
creature_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
-
- /* Mega-Hack -- Forget the map */
wiz_dark(creature_ptr);
-
- /* It worked */
return TRUE;
}
void do_poly_wounds(player_type *creature_ptr)
{
- /* Changed to always provide at least _some_ healing */
s16b wounds = creature_ptr->cut;
s16b hit_p = (creature_ptr->mhp - creature_ptr->chp);
s16b change = damroll(creature_ptr->lev, 5);
bool Nasty_effect = one_in_(5);
-
if (!(wounds || hit_p || Nasty_effect)) return;
msg_print(_("傷がより軽いものに変化した。", "Your wounds are polymorphed into less serious ones."));
{
concptr title = race_info[new_race].title;
int old_race = creature_ptr->prace;
-
#ifdef JP
msg_format("あなたは%s%sに変化した!", effect_msg, title);
#else
#endif
chg_virtue(creature_ptr, V_CHANCE, 2);
-
if (creature_ptr->prace < 32)
{
creature_ptr->old_race1 |= 1L << creature_ptr->prace;
{
creature_ptr->old_race2 |= 1L << (creature_ptr->prace - 32);
}
+
creature_ptr->prace = new_race;
rp_ptr = &race_info[creature_ptr->prace];
-
- /* Experience factor */
creature_ptr->expfact = rp_ptr->r_exp + cp_ptr->c_exp;
- /*
- * The speed bonus of Klackons and Sprites are disabled
- * and the experience penalty is decreased.
- */
- if (((creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER) || (creature_ptr->pclass == CLASS_NINJA)) && ((creature_ptr->prace == RACE_KLACKON) || (creature_ptr->prace == RACE_SPRITE)))
+ bool is_special_class = creature_ptr->pclass == CLASS_MONK;
+ is_special_class |= creature_ptr->pclass == CLASS_FORCETRAINER;
+ is_special_class |= creature_ptr->pclass == CLASS_NINJA;
+ bool is_special_race = creature_ptr->prace == RACE_KLACKON;
+ is_special_race |= creature_ptr->prace == RACE_SPRITE;
+ if (is_special_class && is_special_race)
creature_ptr->expfact -= 15;
- /* Get character's height and weight */
get_height_weight(creature_ptr);
- /* Hitdice */
if (creature_ptr->pclass == CLASS_SORCERER)
creature_ptr->hitdie = rp_ptr->r_mhp/2 + cp_ptr->c_mhp + ap_ptr->a_mhp;
else
creature_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
roll_hitdice(creature_ptr, 0L);
-
- /* The experience level may be modified */
check_experience(creature_ptr);
-
creature_ptr->redraw |= (PR_BASIC);
-
creature_ptr->update |= (PU_BONUS);
-
handle_stuff(creature_ptr);
- /* Load an autopick preference file */
if (old_race != creature_ptr->prace) autopick_load_pref(creature_ptr, FALSE);
- /* Player's graphic tile may change */
lite_spot(creature_ptr, creature_ptr->y, creature_ptr->x);
}
char effect_msg[80] = "";
CHARACTER_IDX new_race;
- /* Some form of racial polymorph... */
power -= 10;
-
if ((power > randint0(5)) && one_in_(4))
{
- /* sex change */
power -= 2;
-
if (creature_ptr->psex == SEX_MALE)
{
creature_ptr->psex = SEX_FEMALE;
if ((power > randint0(30)) && one_in_(5))
{
int tmp = 0;
-
- /* Harmful deformity */
power -= 15;
-
while (tmp < A_MAX)
{
if (one_in_(2))
tmp++;
}
- /* Deformities are discriminated against! */
(void)dec_stat(creature_ptr, A_CHR, randint1(6), TRUE);
if (effect_msg[0])
while ((power > randint0(20)) && one_in_(10))
{
- /* Polymorph into a less mutated form */
power -= 10;
if (!lose_mutation(creature_ptr, 0))
if ((power > randint0(30)) && one_in_(6))
{
int tmp = 0;
-
- /* Abomination! */
power -= 20;
msg_format(_("%sの構成が変化した!", "Your internal organs are rearranged!"), creature_ptr->prace == RACE_ANDROID ? "機械" : "内臓");
do_poly_wounds(creature_ptr);
}
- /* Note: earlier deductions may have left power < 0 already. */
while (power > 0)
{
status_shuffle(creature_ptr);
}
}
+
/*
* Gain experience
*/
void gain_exp_64(player_type *creature_ptr, s32b amount, u32b amount_frac)
{
if (creature_ptr->is_dead) return;
-
if (creature_ptr->prace == RACE_ANDROID) return;
- /* Gain some experience */
s64b_add(&(creature_ptr->exp), &(creature_ptr->exp_frac), amount, amount_frac);
- /* Slowly recover from experience drainage */
if (creature_ptr->exp < creature_ptr->max_exp)
{
- /* Gain max experience (20%) (was 10%) */
creature_ptr->max_exp += amount / 5;
}
void calc_android_exp(player_type *creature_ptr)
{
- int i;
u32b total_exp = 0;
if (creature_ptr->is_dead) return;
-
if (creature_ptr->prace != RACE_ANDROID) return;
- for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
+ for (int i = INVEN_RARM; i < INVEN_TOTAL; i++)
{
object_type *o_ptr = &creature_ptr->inventory_list[i];
object_type forge;
if ((i == INVEN_RIGHT) || (i == INVEN_LEFT) || (i == INVEN_NECK) || (i == INVEN_LITE)) continue;
if (!o_ptr->k_idx) continue;
- object_wipe(q_ptr);
+ object_wipe(q_ptr);
object_copy(q_ptr, o_ptr);
q_ptr->discount = 0;
q_ptr->curse_flags = 0L;
if (!object_is_weapon_ammo(o_ptr))
{
- /* For armors */
if (total_flags < 15000) fake_level = 10;
else if (total_flags < 35000) fake_level = 25;
else fake_level = 40;
}
else
{
- /* For weapons */
if (total_flags < 20000) fake_level = 10;
else if (total_flags < 45000) fake_level = 25;
else fake_level = 40;
}
value = object_value_real(q_ptr);
-
if (value <= 0) continue;
if ((o_ptr->tval == TV_SOFT_ARMOR) && (o_ptr->sval == SV_ABUNAI_MIZUGI) && (creature_ptr->pseikaku != SEIKAKU_SEXY)) value /= 32;
if (value > 5000000L) value = 5000000L;
else total_exp += exp / 16;
if (i == INVEN_BODY) total_exp += exp / 32;
}
+
creature_ptr->exp = creature_ptr->max_exp = total_exp;
check_experience(creature_ptr);
}
*/
bool drain_exp(player_type *creature_ptr, s32b drain, s32b slip, int hold_exp_prob)
{
- /* Androids and their mimics are never drained */
if (creature_ptr->prace == RACE_ANDROID) return FALSE;
if (creature_ptr->hold_exp && (randint0(100) < hold_exp_prob))
{
- /* Hold experience */
msg_print(_("しかし自己の経験値を守りきった!", "You keep hold of your experience!"));
return FALSE;
}
- /* Hold experience failed */
if (creature_ptr->hold_exp)
{
msg_print(_("経験値を少し吸い取られた気がする!", "You feel your experience slipping away!"));
}
}
- /* Use the value */
creature_ptr->ult_res = v;
creature_ptr->redraw |= (PR_STATUS);
- /* Nothing to notice */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
creature_ptr->update |= (PU_BONUS);
handle_stuff(creature_ptr);
+
return TRUE;
}
+
bool set_tim_res_nether(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
{
bool notice = FALSE;
}
}
- /* Use the value */
creature_ptr->tim_res_nether = v;
creature_ptr->redraw |= (PR_STATUS);
- /* Nothing to notice */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
return TRUE;
}
+
bool set_tim_res_time(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
{
bool notice = FALSE;
v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
-
if (creature_ptr->is_dead) return FALSE;
if (v)
notice = TRUE;
}
}
-
else
{
if (creature_ptr->tim_res_time)
}
}
- /* Use the value */
creature_ptr->tim_res_time = v;
creature_ptr->redraw |= (PR_STATUS);
-
- /* Nothing to notice */
if (!notice) return FALSE;
if (disturb_state) disturb(creature_ptr, FALSE, FALSE);
*/
bool choose_ele_attack(player_type *creature_ptr)
{
- int num;
-
- char choice;
-
if (!has_melee_weapon(creature_ptr, INVEN_RARM) && !has_melee_weapon(creature_ptr, INVEN_LARM))
{
msg_format(_("武器を持たないと魔法剣は使えない。", "You cannot use temporary branding with no weapon."));
return FALSE;
}
- screen_save();
- num = (creature_ptr->lev - 20) / 5;
+ screen_save();
+ int num = (creature_ptr->lev - 20) / 5;
c_prt(TERM_RED, _(" a) 焼棄", " a) Fire Brand"), 2, 14);
if (num >= 2)
prt("", 1, 0);
prt(_(" どの元素攻撃をしますか?", " Choose a temporary elemental brand "), 1, 14);
- choice = inkey();
+ char choice = inkey();
if ((choice == 'a') || (choice == 'A'))
set_ele_attack(creature_ptr, ATTACK_FIRE, creature_ptr->lev/2 + randint1(creature_ptr->lev/2));
screen_load();
return FALSE;
}
+
screen_load();
return TRUE;
}
*/
bool choose_ele_immune(player_type *creature_ptr, TIME_EFFECT immune_turn)
{
- char choice;
screen_save();
c_prt(TERM_RED, _(" a) 火炎", " a) Immunity to fire"), 2, 14);
prt("", 1, 0);
prt(_(" どの元素の免疫をつけますか?", " Choose a temporary elemental immunity "), 1, 14);
- choice = inkey();
+ char choice = inkey();
if ((choice == 'a') || (choice == 'A'))
set_ele_immune(creature_ptr, DEFENSE_FIRE, immune_turn);
screen_load();
return FALSE;
}
+
screen_load();
return TRUE;
}
#include "autopick.h"
#include "targeting.h"
-#ifdef TRAVEL
- /* for travel */
travel_type travel;
-#endif
/*!
* @brief 地形やその上のアイテムの隠された要素を全て明かす /
}
-#ifdef TRAVEL
-
/*!
* @brief トラベル機能の判定処理 /
* Test for traveling
/* Travel Delay */
Term_xtra(TERM_XTRA_DELAY, delay_factor);
}
-#endif
-#ifdef TRAVEL
-/*
- * Hack: travel command
- */
#define TRAVEL_UNABLE 9999
static int flow_head = 0;
static POSITION temp2_x[MAX_SHORT];
static POSITION temp2_y[MAX_SHORT];
-
/*!
* @brief トラベル処理の記憶配列を初期化する Hack: forget the "flow" information
* @param creature_ptr プレーヤーへの参照ポインタ
if ((sx == ddx[i]) && (sy == ddy[i])) travel.dir = i;
}
}
-#endif
/*
*/
void disturb(player_type *creature_ptr, bool stop_search, bool stop_travel)
{
-#ifndef TRAVEL
- /* Unused */
- stop_travel = stop_travel;
-#endif
-
/* Cancel repeated commands */
if (command_rep)
{
creature_ptr->update |= (PU_FLOW);
}
-#ifdef TRAVEL
if (stop_travel)
{
/* Cancel */
/* Calculate torch radius */
creature_ptr->update |= (PU_TORCH);
}
-#endif
if (flush_disturb) flush();
}
#pragma once
#include "floor.h"
-/*
- * For travel command (auto run)
- */
-#define TRAVEL
-
extern void disturb(player_type *creature_ptr, bool stop_search, bool flush_output);
extern void move_player(player_type *creature_ptr, DIRECTION dir, bool do_pickup, bool break_trap);
extern void run_step(player_type *creature_ptr, DIRECTION dir);
extern bool trap_can_be_ignored(player_type *creature_ptr, FEAT_IDX feat);
extern void search(player_type *creature_ptr);
extern void carry(player_type *creature_ptr, bool pickup);
-#ifdef TRAVEL
extern void do_cmd_travel(player_type *creature_ptr);
extern void travel_step(player_type *creature_ptr);
-#endif
/* Types of pattern tiles */
#define NOT_PATTERN_TILE -1
#define PATTERN_TILE_TELEPORT 7
#define PATTERN_TILE_WRECKED 8
-#ifdef TRAVEL
/*
* A structure type for travel command
*/
DIRECTION dir; /* Running direction */
} travel_type;
-/* for travel */
extern travel_type travel;
-#endif
-
#include "realm-song.h"
#include "english.h"
-/*!
- * @brief プレイヤー周辺の地形を感知する
- * @param caster_ptr プレーヤーへの参照ポインタ
- * @param range 効果範囲
- * @param flag 特定地形ID
- * @param known 地形から危険フラグを外すならTRUE
- * @return 効力があった場合TRUEを返す
- */
+ /*!
+ * @brief プレイヤー周辺の地形を感知する
+ * @param caster_ptr プレーヤーへの参照ポインタ
+ * @param range 効果範囲
+ * @param flag 特定地形ID
+ * @param known 地形から危険フラグを外すならTRUE
+ * @return 効力があった場合TRUEを返す
+ */
static bool detect_feat_flag(player_type *caster_ptr, POSITION range, int flag, bool known)
{
if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
- /* Scan the current panel */
grid_type *g_ptr;
bool detect = FALSE;
for (POSITION y = 1; y < caster_ptr->current_floor_ptr->height - 1; y++)
int dist = distance(caster_ptr->y, caster_ptr->x, y, x);
if (dist > range) continue;
g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
-
- /* Hack -- Safe */
if (flag == FF_TRAP)
{
/* Mark as detected */
y = o_ptr->iy;
x = o_ptr->ix;
-
- /* Only detect nearby objects */
if (distance(caster_ptr->y, caster_ptr->x, y, x) > range2) continue;
- /* Detect "gold" objects */
if (o_ptr->tval == TV_GOLD)
{
o_ptr->marked |= OM_FOUND;
POSITION range2 = range;
if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
- /* Scan objects */
- POSITION y, x;
bool detect = FALSE;
for (OBJECT_IDX i = 1; i < caster_ptr->current_floor_ptr->o_max; i++)
{
if (!OBJECT_IS_VALID(o_ptr)) continue;
if (OBJECT_IS_HELD_MONSTER(o_ptr)) continue;
- y = o_ptr->iy;
- x = o_ptr->ix;
+ POSITION y = o_ptr->iy;
+ POSITION x = o_ptr->ix;
- /* Only detect nearby objects */
if (distance(caster_ptr->y, caster_ptr->x, y, x) > range2) continue;
- /* Detect "real" objects */
if (o_ptr->tval != TV_GOLD)
{
o_ptr->marked |= OM_FOUND;
{
if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
- /* Scan all objects */
OBJECT_TYPE_VALUE tv;
- POSITION y, x;
bool detect = FALSE;
for (OBJECT_IDX i = 1; i < caster_ptr->current_floor_ptr->o_max; i++)
{
if (!OBJECT_IS_VALID(o_ptr)) continue;
if (OBJECT_IS_HELD_MONSTER(o_ptr)) continue;
- y = o_ptr->iy;
- x = o_ptr->ix;
+ POSITION y = o_ptr->iy;
+ POSITION x = o_ptr->ix;
- /* Only detect nearby objects */
if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
- /* Examine the tval */
tv = o_ptr->tval;
-
- /* Artifacts, misc magic items, or enchanted wearables */
if (object_is_artifact(o_ptr) ||
object_is_ego(o_ptr) ||
- (tv == TV_WHISTLE) ||
- (tv == TV_AMULET) ||
+ (tv == TV_WHISTLE) ||
+ (tv == TV_AMULET) ||
(tv == TV_RING) ||
- (tv == TV_STAFF) ||
+ (tv == TV_STAFF) ||
(tv == TV_WAND) ||
(tv == TV_ROD) ||
- (tv == TV_SCROLL) ||
+ (tv == TV_SCROLL) ||
(tv == TV_POTION) ||
- (tv == TV_LIFE_BOOK) ||
+ (tv == TV_LIFE_BOOK) ||
(tv == TV_SORCERY_BOOK) ||
- (tv == TV_NATURE_BOOK) ||
+ (tv == TV_NATURE_BOOK) ||
(tv == TV_CHAOS_BOOK) ||
- (tv == TV_DEATH_BOOK) ||
- (tv == TV_TRUMP_BOOK) ||
+ (tv == TV_DEATH_BOOK) ||
+ (tv == TV_TRUMP_BOOK) ||
(tv == TV_ARCANE_BOOK) ||
(tv == TV_CRAFT_BOOK) ||
(tv == TV_DAEMON_BOOK) ||
(tv == TV_MUSIC_BOOK) ||
(tv == TV_HISSATSU_BOOK) ||
(tv == TV_HEX_BOOK) ||
- ((o_ptr->to_a > 0) || (o_ptr->to_h + o_ptr->to_d > 0)))
+ ((o_ptr->to_a > 0) || (o_ptr->to_h + o_ptr->to_d > 0)))
{
- /* Memorize the item */
o_ptr->marked |= OM_FOUND;
lite_spot(caster_ptr, y, x);
detect = TRUE;
{
if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
- POSITION y, x;
bool flag = FALSE;
for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
{
monster_race *r_ptr = &r_info[m_ptr->r_idx];
if (!monster_is_valid(m_ptr)) continue;
- y = m_ptr->fy;
- x = m_ptr->fx;
-
- /* Only detect nearby monsters */
+ POSITION y = m_ptr->fy;
+ POSITION x = m_ptr->fx;
if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
- /* Detect all non-invisible monsters */
if (!(r_ptr->flags2 & RF2_INVISIBLE) || caster_ptr->see_inv)
{
- /* Repair visibility later */
repair_monsters = TRUE;
-
m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
update_monster(caster_ptr, i, FALSE);
flag = TRUE;
{
if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
- POSITION y, x;
bool flag = FALSE;
for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
{
if (!monster_is_valid(m_ptr)) continue;
- y = m_ptr->fy;
- x = m_ptr->fx;
+ POSITION y = m_ptr->fy;
+ POSITION x = m_ptr->fx;
- /* Only detect nearby monsters */
if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
- /* Detect invisible monsters */
if (r_ptr->flags2 & RF2_INVISIBLE)
{
- /* Update monster recall window */
if (caster_ptr->monster_race_idx == m_ptr->r_idx)
{
caster_ptr->window |= (PW_MONSTER);
}
- /* Repair visibility later */
repair_monsters = TRUE;
-
m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
update_monster(caster_ptr, i, FALSE);
flag = TRUE;
return flag;
}
+
/*!
* @brief 邪悪なモンスターを感知する / Detect all "evil" monsters on current panel
* @param caster_ptr プレーヤーへの参照ポインタ
{
if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
- POSITION y, x;
bool flag = FALSE;
for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
{
monster_race *r_ptr = &r_info[m_ptr->r_idx];
if (!monster_is_valid(m_ptr)) continue;
- y = m_ptr->fy;
- x = m_ptr->fx;
+ POSITION y = m_ptr->fy;
+ POSITION x = m_ptr->fx;
- /* Only detect nearby monsters */
if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
- /* Detect evil monsters */
if (r_ptr->flags3 & RF3_EVIL)
{
if (is_original_ap(m_ptr))
{
- /* Take note that they are evil */
r_ptr->r_flags3 |= (RF3_EVIL);
-
- /* Update monster recall window */
if (caster_ptr->monster_race_idx == m_ptr->r_idx)
{
caster_ptr->window |= (PW_MONSTER);
}
}
- /* Repair visibility later */
repair_monsters = TRUE;
-
m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
update_monster(caster_ptr, i, FALSE);
flag = TRUE;
return flag;
}
+
/*!
* @brief 無生命のモンスターを感知する(アンデッド、悪魔系を含む) / Detect all "nonliving", "undead" or "demonic" monsters on current panel
* @param caster_ptr プレーヤーへの参照ポインタ
{
if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
- POSITION y, x;
bool flag = FALSE;
for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
{
monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
if (!monster_is_valid(m_ptr)) continue;
- y = m_ptr->fy;
- x = m_ptr->fx;
-
- /* Only detect nearby monsters */
+ POSITION y = m_ptr->fy;
+ POSITION x = m_ptr->fx;
if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
- /* Detect non-living monsters */
if (!monster_living(m_ptr->r_idx))
{
- /* Update monster recall window */
if (caster_ptr->monster_race_idx == m_ptr->r_idx)
{
caster_ptr->window |= (PW_MONSTER);
}
- /* Repair visibility later */
repair_monsters = TRUE;
-
m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
update_monster(caster_ptr, i, FALSE);
flag = TRUE;
return flag;
}
+
/*!
* @brief 精神のあるモンスターを感知する / Detect all monsters it has mind on current panel
* @param caster_ptr プレーヤーへの参照ポインタ
{
if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
- POSITION y, x;
bool flag = FALSE;
for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
{
monster_race *r_ptr = &r_info[m_ptr->r_idx];
if (!monster_is_valid(m_ptr)) continue;
- y = m_ptr->fy;
- x = m_ptr->fx;
+ POSITION y = m_ptr->fy;
+ POSITION x = m_ptr->fx;
- /* Only detect nearby monsters */
if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
- /* Detect non-living monsters */
if (!(r_ptr->flags2 & RF2_EMPTY_MIND))
{
- /* Update monster recall window */
if (caster_ptr->monster_race_idx == m_ptr->r_idx)
{
caster_ptr->window |= (PW_MONSTER);
}
- /* Repair visibility later */
repair_monsters = TRUE;
-
m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
update_monster(caster_ptr, i, FALSE);
flag = TRUE;
{
if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
- POSITION y, x;
bool flag = FALSE;
for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
{
monster_race *r_ptr = &r_info[m_ptr->r_idx];
if (!monster_is_valid(m_ptr)) continue;
- y = m_ptr->fy;
- x = m_ptr->fx;
+ POSITION y = m_ptr->fy;
+ POSITION x = m_ptr->fx;
- /* Only detect nearby monsters */
if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
- /* Detect monsters with the same symbol */
if (my_strchr(Match, r_ptr->d_char))
{
- /* Update monster recall window */
if (caster_ptr->monster_race_idx == m_ptr->r_idx)
{
caster_ptr->window |= (PW_MONSTER);
}
- /* Repair visibility later */
repair_monsters = TRUE;
-
m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
update_monster(caster_ptr, i, FALSE);
flag = TRUE;
return flag;
}
+
/*!
* @brief flags3に対応するモンスターを感知する / A "generic" detect monsters routine, tagged to flags3
* @param caster_ptr プレーヤーへの参照ポインタ
{
if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
- POSITION y, x;
bool flag = FALSE;
for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
{
monster_race *r_ptr = &r_info[m_ptr->r_idx];
if (!monster_is_valid(m_ptr)) continue;
- y = m_ptr->fy;
- x = m_ptr->fx;
+ POSITION y = m_ptr->fy;
+ POSITION x = m_ptr->fx;
- /* Only detect nearby monsters */
if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
- /* Detect evil monsters */
if (r_ptr->flags3 & (match_flag))
{
if (is_original_ap(m_ptr))
{
- /* Take note that they are something */
r_ptr->r_flags3 |= (match_flag);
-
- /* Update monster recall window */
if (caster_ptr->monster_race_idx == m_ptr->r_idx)
{
caster_ptr->window |= (PW_MONSTER);
}
}
- /* Repair visibility later */
repair_monsters = TRUE;
-
m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
update_monster(caster_ptr, i, FALSE);
flag = TRUE;
{
switch (match_flag)
{
- case RF3_DEMON:
+ case RF3_DEMON:
desc_monsters = _("デーモン", "demons");
- break;
- case RF3_UNDEAD:
+ break;
+ case RF3_UNDEAD:
desc_monsters = _("アンデッド", "the undead");
- break;
+ break;
}
msg_format(_("%sの存在を感じとった!", "You sense the presence of %s!"), desc_monsters);
bool detect_all(player_type *caster_ptr, POSITION range)
{
bool detect = FALSE;
-
- /* Detect everything */
if (detect_traps(caster_ptr, range, TRUE)) detect = TRUE;
if (detect_doors(caster_ptr, range)) detect = TRUE;
if (detect_stairs(caster_ptr, range)) detect = TRUE;
-
- /* There are too many hidden treasure. So... */
- /* if (detect_treasure(range)) detect = TRUE; */
-
if (detect_objects_gold(caster_ptr, range)) detect = TRUE;
if (detect_objects_normal(caster_ptr, range)) detect = TRUE;
if (detect_monsters_invis(caster_ptr, range)) detect = TRUE;
*/
bool project_all_los(player_type *caster_ptr, EFFECT_ID typ, HIT_POINT dam)
{
- /* Mark all (nearby) monsters */
- POSITION x, y;
for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
{
monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
if (!monster_is_valid(m_ptr)) continue;
- y = m_ptr->fy;
- x = m_ptr->fx;
-
- /* Require line of sight */
+ POSITION y = m_ptr->fy;
+ POSITION x = m_ptr->fx;
if (!player_has_los_bold(caster_ptr, y, x) || !projectable(caster_ptr, caster_ptr->y, caster_ptr->x, y, x)) continue;
- /* Mark the monster */
m_ptr->mflag |= (MFLAG_LOS);
}
- /* Affect all marked monsters */
BIT_FLAGS flg = PROJECT_JUMP | PROJECT_KILL | PROJECT_HIDE;
bool obvious = FALSE;
for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
{
monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
-
- /* Skip unmarked monsters */
if (!(m_ptr->mflag & (MFLAG_LOS))) continue;
- /* Remove mark */
m_ptr->mflag &= ~(MFLAG_LOS);
+ POSITION y = m_ptr->fy;
+ POSITION x = m_ptr->fx;
- y = m_ptr->fy;
- x = m_ptr->fx;
-
- /* Jump directly to the target monster */
if (project(caster_ptr, 0, 0, y, x, dam, typ, flg, -1)) obvious = TRUE;
}
}
+/*!
+ * todo ここにこれがあるのは少し違和感、spells-staffonlyとかに分離したい
+ * @brief 聖浄の杖の効果
+ * @param creature_ptr プレーヤーへの参照ポインタ
+ * @magic 魔法の効果である場合TRUE (杖と同じ効果の呪文はあったか? 要調査)
+ * @powerful 効果が増強される時TRUE (TRUEになるタイミングはあるか? 要調査)
+ */
bool cleansing_nova(player_type *creature_ptr, bool magic, bool powerful)
{
bool ident = FALSE;
if (set_afraid(creature_ptr, 0)) ident = TRUE;
if (hp_player(creature_ptr, 50)) ident = TRUE;
if (set_stun(creature_ptr, 0)) ident = TRUE;
- if (set_cut(creature_ptr,0)) ident = TRUE;
+ if (set_cut(creature_ptr, 0)) ident = TRUE;
return ident;
}
+/*!
+ * todo ここにこれがあるのは少し違和感、spells-staffonlyとかに分離したい
+ * @brief 魔力の嵐の杖の効果
+ * @param creature_ptr プレーヤーへの参照ポインタ
+ * @powerful 効果が増強される時TRUE (TRUEになるタイミングはあるか? 要調査)
+ */
bool unleash_mana_storm(player_type *creature_ptr, bool powerful)
{
msg_print(_("強力な魔力が敵を引き裂いた!", "Mighty magics rend your enemies!"));
project(creature_ptr, 0, (powerful ? 7 : 5), creature_ptr->y, creature_ptr->x,
- (randint1(200) + (powerful ? 500 : 300)) * 2, GF_MANA, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1);
+ (randint1(200) + (powerful ? 500 : 300)) * 2, GF_MANA, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1);
bool is_special_class = creature_ptr->pclass != CLASS_MAGE;
is_special_class &= creature_ptr->pclass != CLASS_HIGH_MAGE;
*/
bool crusade(player_type *caster_ptr)
{
- return (project_all_los(caster_ptr, GF_CRUSADE, caster_ptr->lev*4));
+ return (project_all_los(caster_ptr, GF_CRUSADE, caster_ptr->lev * 4));
}
*/
void aggravate_monsters(player_type *caster_ptr, MONSTER_IDX who)
{
- /* Aggravate everyone nearby */
bool sleep = FALSE;
bool speed = FALSE;
for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
{
monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
if (!monster_is_valid(m_ptr)) continue;
-
- /* Skip aggravating monster (or player) */
if (i == who) continue;
- /* Wake up nearby sleeping monsters */
if (m_ptr->cdis < MAX_SIGHT * 2)
{
- /* Wake up */
if (MON_CSLEEP(m_ptr))
{
(void)set_monster_csleep(caster_ptr, i, 0);
sleep = TRUE;
}
+
if (!is_pet(m_ptr)) m_ptr->mflag2 |= MFLAG2_NOPET;
}
- /* Speed up monsters in line of sight */
if (player_has_los_bold(caster_ptr, m_ptr->fy, m_ptr->fx))
{
if (!is_pet(m_ptr))
monster_race *r_ptr = &r_info[m_ptr->r_idx];
if (is_pet(m_ptr) && !player_cast) return FALSE;
- /* Hack -- Skip Unique Monsters or Quest Monsters */
bool resist = FALSE;
if (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) resist = TRUE;
else if (r_ptr->flags7 & RF7_UNIQUE2) resist = TRUE;
if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
{
GAME_TEXT m_name[MAX_NLEN];
-
monster_desc(caster_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
exe_write_diary(caster_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_GENOCIDE, m_name);
}
{
bool see_m = is_seen(m_ptr);
GAME_TEXT m_name[MAX_NLEN];
-
monster_desc(caster_ptr, m_name, m_ptr, 0);
if (see_m)
{
take_hit(caster_ptr, DAMAGE_GENO, randint1(dam_side), format(_("%^sの呪文を唱えた疲労", "the strain of casting %^s"), spell_name), -1);
}
- /* Visual feedback */
move_cursor_relative(caster_ptr->y, caster_ptr->x);
-
caster_ptr->redraw |= (PR_HP);
caster_ptr->window |= (PW_PLAYER);
-
handle_stuff(caster_ptr);
Term_fresh();
return FALSE;
}
- /* Mega-Hack -- Get a monster symbol */
char typ;
- while (!get_com(_("どの種類(文字)のモンスターを抹殺しますか: ", "Choose a monster race (by symbol) to genocide: "), &typ, FALSE)) ;
-
- /* Delete the monsters of that "type" */
+ while (!get_com(_("どの種類(文字)のモンスターを抹殺しますか: ", "Choose a monster race (by symbol) to genocide: "), &typ, FALSE));
bool result = FALSE;
for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
{
monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
monster_race *r_ptr = &r_info[m_ptr->r_idx];
if (!monster_is_valid(m_ptr)) continue;
-
- /* Skip "wrong" monsters */
if (r_ptr->d_char != typ) continue;
result |= genocide_aux(caster_ptr, i, power, player_cast, 4, _("抹殺", "Genocide"));
return FALSE;
}
- /* Delete the (nearby) monsters */
bool result = FALSE;
for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
{
monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
if (!monster_is_valid(m_ptr)) continue;
-
- /* Skip distant monsters */
if (m_ptr->cdis > MAX_SIGHT) continue;
- /* Note effect */
result |= genocide_aux(caster_ptr, i, power, player_cast, 3, _("周辺抹殺", "Mass Genocide"));
}
return FALSE;
}
- /* Delete the (nearby) monsters */
bool result = FALSE;
for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
{
monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
monster_race *r_ptr = &r_info[m_ptr->r_idx];
if (!monster_is_valid(m_ptr)) continue;
-
if (!(r_ptr->flags3 & RF3_UNDEAD)) continue;
-
- /* Skip distant monsters */
if (m_ptr->cdis > MAX_SIGHT) continue;
- /* Note effect */
result |= genocide_aux(caster_ptr, i, power, player_cast, 3, _("アンデッド消滅", "Annihilate Undead"));
}
monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
monster_race *r_ptr = &r_info[m_ptr->r_idx];
if (!monster_is_valid(m_ptr)) continue;
-
- /* Require line of sight */
if (!player_has_los_bold(caster_ptr, m_ptr->fy, m_ptr->fx)) continue;
-
if (!m_ptr->ml) continue;
-
- GAME_TEXT m_name[MAX_NLEN];
- /* Start the message */
+ GAME_TEXT m_name[MAX_NLEN];
if (!probe) msg_print(_("調査中...", "Probing..."));
msg_print(NULL);
lite_spot(caster_ptr, m_ptr->fy, m_ptr->fx);
}
- /* Get "the monster" or "something" */
monster_desc(caster_ptr, m_name, m_ptr, MD_IGNORE_HALLU | MD_INDEF_HIDDEN);
-
speed = m_ptr->mspeed - 110;
if (MON_FAST(m_ptr)) speed += 10;
if (MON_SLOW(m_ptr)) speed -= 10;
if (ironman_nightmare) speed += 5;
- /* Get the monster's alignment */
if ((r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) == (RF3_EVIL | RF3_GOOD)) align = _("善悪", "good&evil");
else if (r_ptr->flags3 & RF3_EVIL) align = _("邪悪", "evil");
else if (r_ptr->flags3 & RF3_GOOD) align = _("善良", "good");
buf[strlen(buf) - 1] = '\0';
prt(buf, 0, 0);
- /* HACK : Add the line to message buffer */
message_add(buf);
-
caster_ptr->window |= (PW_MESSAGE);
handle_stuff(caster_ptr);
move_cursor_relative(m_ptr->fy, m_ptr->fx);
-
inkey();
-
Term_erase(0, 0, 255);
-
if (lore_do_probe(caster_ptr, m_ptr->r_idx))
{
strcpy(buf, (r_name + r_ptr->name));
void discharge_minion(player_type *caster_ptr)
{
bool okay = TRUE;
-
for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
{
monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
monster_race *r_ptr;
r_ptr = &r_info[m_ptr->r_idx];
-
- /* Uniques resist discharging */
if (r_ptr->flags1 & RF1_UNIQUE)
{
GAME_TEXT m_name[MAX_NLEN];
if (dam > 100) dam = (dam - 100) / 2 + 100;
if (dam > 400) dam = (dam - 400) / 2 + 400;
if (dam > 800) dam = 800;
- project(caster_ptr, i, 2 + (r_ptr->level / 20), m_ptr->fy, m_ptr->fx, dam, GF_PLASMA,
+ project(caster_ptr, i, 2 + (r_ptr->level / 20), m_ptr->fy, m_ptr->fx, dam, GF_PLASMA,
PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
if (record_named_pet && m_ptr->nickname)
*/
static void cave_temp_room_lite(player_type *caster_ptr)
{
- /* Clear them all */
for (int i = 0; i < tmp_pos.n; i++)
{
POSITION y = tmp_pos.y[i];
POSITION x = tmp_pos.x[i];
-
grid_type *g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
-
- /* No longer in the array */
g_ptr->info &= ~(CAVE_TEMP);
-
- /* Perma-Lite */
g_ptr->info |= (CAVE_GLOW);
-
- /* Process affected monsters */
if (g_ptr->m_idx)
{
PERCENTAGE chance = 25;
monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
monster_race *r_ptr = &r_info[m_ptr->r_idx];
update_monster(caster_ptr, g_ptr->m_idx, FALSE);
-
- /* Stupid monsters rarely wake up */
if (r_ptr->flags2 & (RF2_STUPID)) chance = 10;
-
- /* Smart monsters always wake up */
if (r_ptr->flags2 & (RF2_SMART)) chance = 100;
- /* Sometimes monsters wake up */
if (MON_CSLEEP(m_ptr) && (randint0(100) < chance))
{
- /* Wake up! */
(void)set_monster_csleep(caster_ptr, g_ptr->m_idx, 0);
-
- /* Notice the "waking up" */
if (m_ptr->ml)
{
GAME_TEXT m_name[MAX_NLEN];
*/
static void cave_temp_room_unlite(player_type *caster_ptr)
{
- /* Clear them all */
for (int i = 0; i < tmp_pos.n; i++)
{
POSITION y = tmp_pos.y[i];
POSITION x = tmp_pos.x[i];
-
grid_type *g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
bool do_dark = !is_mirror_grid(g_ptr);
-
- /* No longer in the array */
g_ptr->info &= ~(CAVE_TEMP);
-
- /* Darken the grid */
if (!do_dark) continue;
if (caster_ptr->current_floor_ptr->dun_level || !is_daytime())
}
g_ptr->info &= ~(CAVE_GLOW);
-
- /* Hack -- Forget "boring" grids */
if (!have_flag(f_info[get_feat_mimic(g_ptr)].flags, FF_REMEMBER))
{
- /* Forget the grid */
if (!view_torch_grids) g_ptr->info &= ~(CAVE_MARK);
note_spot(caster_ptr, y, x);
}
- /* Process affected monsters */
if (g_ptr->m_idx)
{
update_monster(caster_ptr, g_ptr->m_idx, FALSE);
* @param pass_bold 地形条件を返す関数ポインタ
* @return 該当地形の数
*/
-static int next_to_open(floor_type *floor_ptr, POSITION cy, POSITION cx, bool (*pass_bold)(floor_type*, POSITION, POSITION))
+static int next_to_open(floor_type *floor_ptr, POSITION cy, POSITION cx, bool(*pass_bold)(floor_type*, POSITION, POSITION))
{
- POSITION y, x;
int len = 0;
int blen = 0;
for (int i = 0; i < 16; i++)
{
- y = cy + ddy_cdd[i % 8];
- x = cx + ddx_cdd[i % 8];
-
- /* Found a wall, break the length */
+ POSITION y = cy + ddy_cdd[i % 8];
+ POSITION x = cx + ddx_cdd[i % 8];
if (!pass_bold(floor_ptr, y, x))
{
- /* Track best length */
if (len > blen)
{
blen = len;
* @param pass_bold 地形条件を返す関数ポインタ
* @return 該当地形の数
*/
-static int next_to_walls_adj(floor_type *floor_ptr, POSITION cy, POSITION cx, bool (*pass_bold)(floor_type*, POSITION, POSITION))
+static int next_to_walls_adj(floor_type *floor_ptr, POSITION cy, POSITION cx, bool(*pass_bold)(floor_type*, POSITION, POSITION))
{
POSITION y, x;
int c = 0;
* @param pass_bold 地形条件を返す関数ポインタ
* @return 該当地形の数
*/
-static void cave_temp_room_aux(player_type *caster_ptr, POSITION y, POSITION x, bool only_room, bool (*pass_bold)(floor_type*, POSITION, POSITION))
+static void cave_temp_room_aux(player_type *caster_ptr, POSITION y, POSITION x, bool only_room, bool(*pass_bold)(floor_type*, POSITION, POSITION))
{
grid_type *g_ptr;
floor_type *floor_ptr = caster_ptr->current_floor_ptr;
g_ptr = &floor_ptr->grid_array[y][x];
-
- /* Avoid infinite recursion */
if (g_ptr->info & (CAVE_TEMP)) return;
- /* Do not "leave" the current room */
if (!(g_ptr->info & (CAVE_ROOM)))
{
if (only_room) return;
-
- /* Verify */
if (!in_bounds2(floor_ptr, y, x)) return;
-
- /* Do not exceed the maximum spell range */
if (distance(caster_ptr->y, caster_ptr->x, y, x) > MAX_RANGE) return;
/* Verify this grid */
* This leaves only a check for 6 bounding walls!
*/
if (in_bounds(floor_ptr, y, x) && pass_bold(floor_ptr, y, x) &&
- (next_to_walls_adj(floor_ptr, y, x, pass_bold) == 6) && (next_to_open(floor_ptr, y, x, pass_bold) <= 1)) return;
+ (next_to_walls_adj(floor_ptr, y, x, pass_bold) == 6) && (next_to_open(floor_ptr, y, x, pass_bold) <= 1)) return;
}
- /* Paranoia -- verify space */
if (tmp_pos.n == TEMP_MAX) return;
- /* Mark the grid as "seen" */
g_ptr->info |= (CAVE_TEMP);
-
- /* Add it to the "seen" set */
tmp_pos.y[tmp_pos.n] = y;
tmp_pos.x[tmp_pos.n] = x;
tmp_pos.n++;
/*!
- * todo このシンタックスシュガーは不要だが、関数ポインタなので安易には消せず……
- * @brief 指定のマスが光を通すか(LOSフラグを持つか)を返す。 / Aux function -- see below
- * @param floor_ptr 配置するフロアの参照ポインタ
- * @param y 指定Y座標
- * @param x 指定X座標
- * @return 光を通すならばtrueを返す。
- */
-static bool cave_pass_lite_bold(floor_type *floor_ptr, POSITION y, POSITION x)
-{
- return cave_los_bold(floor_ptr, y, x);
-}
-
-
-/*!
* @brief 部屋内にある一点の周囲がいくつ光を通すかをグローバル変数tmp_pos.nに返す / Aux function -- see below
* @param caster_ptr プレーヤーへの参照ポインタ
* @param y 指定Y座標
*/
static void cave_temp_lite_room_aux(player_type *caster_ptr, POSITION y, POSITION x)
{
- cave_temp_room_aux(caster_ptr, y, x, FALSE, cave_pass_lite_bold);
+ cave_temp_room_aux(caster_ptr, y, x, FALSE, cave_los_bold);
}
*/
void lite_room(player_type *caster_ptr, POSITION y1, POSITION x1)
{
- /* Add the initial grid */
cave_temp_lite_room_aux(caster_ptr, y1, x1);
-
- /* While grids are in the queue, add their neighbors */
floor_type *floor_ptr = caster_ptr->current_floor_ptr;
- POSITION x, y;
for (int i = 0; i < tmp_pos.n; i++)
{
- x = tmp_pos.x[i], y = tmp_pos.y[i];
+ POSITION x = tmp_pos.x[i];
+ POSITION y = tmp_pos.y[i];
- /* Walls get lit, but stop light */
- if (!cave_pass_lite_bold(floor_ptr, y, x)) continue;
+ if (!cave_los_bold(floor_ptr, y, x)) continue;
- /* Spread adjacent */
cave_temp_lite_room_aux(caster_ptr, y + 1, x);
cave_temp_lite_room_aux(caster_ptr, y - 1, x);
cave_temp_lite_room_aux(caster_ptr, y, x + 1);
cave_temp_lite_room_aux(caster_ptr, y, x - 1);
- /* Spread diagonal */
cave_temp_lite_room_aux(caster_ptr, y + 1, x + 1);
cave_temp_lite_room_aux(caster_ptr, y - 1, x - 1);
cave_temp_lite_room_aux(caster_ptr, y - 1, x + 1);
cave_temp_lite_room_aux(caster_ptr, y + 1, x - 1);
}
- /* Now, lite them all up at once */
cave_temp_room_lite(caster_ptr);
-
if (caster_ptr->special_defense & NINJA_S_STEALTH)
{
- if (floor_ptr->grid_array[caster_ptr->y][caster_ptr->x].info & CAVE_GLOW) set_superstealth(caster_ptr, FALSE);
+ if (floor_ptr->grid_array[caster_ptr->y][caster_ptr->x].info & CAVE_GLOW)
+ set_superstealth(caster_ptr, FALSE);
}
}
*/
void unlite_room(player_type *caster_ptr, POSITION y1, POSITION x1)
{
- /* Add the initial grid */
cave_temp_unlite_room_aux(caster_ptr, y1, x1);
-
- /* Spread, breadth first */
- POSITION x, y;
for (int i = 0; i < tmp_pos.n; i++)
{
- x = tmp_pos.x[i], y = tmp_pos.y[i];
-
- /* Walls get dark, but stop darkness */
+ POSITION x = tmp_pos.x[i];
+ POSITION y = tmp_pos.y[i];
if (!cave_pass_dark_bold(caster_ptr->current_floor_ptr, y, x)) continue;
- /* Spread adjacent */
cave_temp_unlite_room_aux(caster_ptr, y + 1, x);
cave_temp_unlite_room_aux(caster_ptr, y - 1, x);
cave_temp_unlite_room_aux(caster_ptr, y, x + 1);
cave_temp_unlite_room_aux(caster_ptr, y, x - 1);
- /* Spread diagonal */
cave_temp_unlite_room_aux(caster_ptr, y + 1, x + 1);
cave_temp_unlite_room_aux(caster_ptr, y - 1, x - 1);
cave_temp_unlite_room_aux(caster_ptr, y - 1, x + 1);
cave_temp_unlite_room_aux(caster_ptr, y + 1, x - 1);
}
- /* Now, darken them all at once */
cave_temp_room_unlite(caster_ptr);
}
bool fire_ball(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
{
BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
- if (typ == GF_CHARM_LIVING) flg|= PROJECT_HIDE;
+ if (typ == GF_CHARM_LIVING) flg |= PROJECT_HIDE;
POSITION tx = caster_ptr->x + 99 * ddx[dir];
POSITION ty = caster_ptr->y + 99 * ddy[dir];
- /* Hack -- Use an actual "target" */
if ((dir == 5) && target_okay(caster_ptr))
{
flg &= ~(PROJECT_STOP);
ty = target_row;
}
- /* Analyze the "dir" and the "target". Hurt items on floor. */
return project(caster_ptr, 0, rad, ty, tx, dam, typ, flg, -1);
}
{
POSITION tx = caster_ptr->x + 99 * ddx[dir];
POSITION ty = caster_ptr->y + 99 * ddy[dir];
-
- /* Hack -- Use an actual "target" */
if ((dir == 5) && target_okay(caster_ptr))
{
tx = target_col;
ty = target_row;
}
- /* Analyze the "dir" and the "target". Hurt items on floor. */
BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
return (project(caster_ptr, 0, rad, ty, tx, dam, typ, flg, -1));
}
{
POSITION tx = caster_ptr->x + 99 * ddx[dir];
POSITION ty = caster_ptr->y + 99 * ddy[dir];
-
BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_HIDE;
if ((dir == 5) && target_okay(caster_ptr))
{
ty = target_row;
}
- /* Analyze the "dir" and the "target". Hurt items on floor. */
return (project(caster_ptr, 0, rad, ty, tx, dam, typ, flg, -1));
}
* @return 作用が実際にあった場合TRUEを返す
* @details
* <pre>
- * Cast a meteor spell, defined as a ball spell cast by an arbitary monster,
- * player, or outside source, that starts out at an arbitrary location, and
- * leaving no trail from the "caster" to the target. This function is
+ * Cast a meteor spell, defined as a ball spell cast by an arbitary monster,
+ * player, or outside source, that starts out at an arbitrary location, and
+ * leaving no trail from the "caster" to the target. This function is
* especially useful for bombardments and similar. -LM-
* Option to hurt the player.
* </pre>
bool fire_meteor(player_type *caster_ptr, MONSTER_IDX who, EFFECT_ID typ, POSITION y, POSITION x, HIT_POINT dam, POSITION rad)
{
BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
-
- /* Analyze the "target" and the caster. */
return (project(caster_ptr, who, rad, y, x, dam, typ, flg, -1));
}
}
sound(SOUND_TELEPORT);
-
- /* Swap the player and monster */
(void)move_player_effect(caster_ptr, ty, tx, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
-
- /* Success */
return TRUE;
}
*/
bool project_hook(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, BIT_FLAGS flg)
{
- /* Pass through the target if needed */
flg |= (PROJECT_THRU);
-
POSITION tx = caster_ptr->x + ddx[dir];
POSITION ty = caster_ptr->y + ddy[dir];
if ((dir == 5) && target_okay(caster_ptr))
ty = target_row;
}
- /* Analyze the "dir" and the "target", do NOT explode */
return (project(caster_ptr, 0, 0, ty, tx, dam, typ, flg, -1));
}
{
return (fire_beam(caster_ptr, typ, dir, dam));
}
-
+
return (fire_bolt(caster_ptr, typ, dir, dam));
}
lose_exp(target_ptr, target_ptr->exp / 16);
if (!one_in_(6)) break;
case 13: case 14: case 15: case 19: case 20:
- if (stop_ty || (target_ptr->free_act && (randint1(125) < target_ptr->skill_sav)) || (target_ptr->pclass == CLASS_BERSERKER))
- {
- /* Do nothing */ ;
- }
- else
+ {
+ bool is_statue = stop_ty;
+ is_statue |= target_ptr->free_act && (randint1(125) < target_ptr->skill_sav);
+ is_statue |= target_ptr->pclass == CLASS_BERSERKER;
+ if (!is_statue)
{
msg_print(_("彫像になった気分だ!", "You feel like a statue!"));
if (target_ptr->free_act)
}
if (!one_in_(6)) break;
+ }
case 21: case 22: case 23:
(void)do_dec_stat(target_ptr, randint0(6));
if (!one_in_(6)) break;
DEPTH dungeon_level = caster_ptr->current_floor_ptr->dun_level;
DEPTH summon_lev = (pet ? caster_ptr->lev * 2 / 3 + randint1(caster_ptr->lev / 2) : dungeon_level);
-
int count = 0;
for (int i = 0; i < (randint1(7) + (dungeon_level / 40)); i++)
{
}
project(caster_ptr, 0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
- (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
+ (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
return;
}
caster_ptr->special_defense &= ~(NINJA_KAWARIMI);
caster_ptr->redraw |= (PR_STATUS);
-
- /* Teleported */
return TRUE;
}
DIRECTION dir;
if (!get_aim_dir(attacker_ptr, &dir)) return FALSE;
- /* Use the given direction */
int tx = attacker_ptr->x + project_length * ddx[dir];
int ty = attacker_ptr->y + project_length * ddy[dir];
u16b path_g[32];
int path_n = project_path(attacker_ptr, path_g, project_length, attacker_ptr->y, attacker_ptr->x, ty, tx, PROJECT_STOP | PROJECT_KILL);
project_length = 0;
-
- /* No need to move */
if (!path_n) return TRUE;
- /* Use ty and tx as to-move point */
ty = attacker_ptr->y;
tx = attacker_ptr->x;
-
- /* Project along the path */
bool tmp_mdeath = FALSE;
bool moved = FALSE;
for (int i = 0; i < path_n; i++)
{
ty = ny;
tx = nx;
-
- /* Go to next grid */
continue;
}
msg_print(_("ここには入身では入れない。", "You can't move to that place."));
}
- /* Exit loop */
break;
}
- /* Move player before updating the monster */
if (!player_bold(attacker_ptr, ty, tx)) teleport_player_to(attacker_ptr, ty, tx, TELEPORT_NONMAGICAL);
update_monster(attacker_ptr, floor_ptr->grid_array[ny][nx].m_idx, TRUE);
- /* Found a monster */
m_ptr = &floor_ptr->m_list[floor_ptr->grid_array[ny][nx].m_idx];
-
if (tm_idx != floor_ptr->grid_array[ny][nx].m_idx)
{
#ifdef JP
}
else if (!player_bold(attacker_ptr, ty, tx))
{
- /* Hold the monster name */
GAME_TEXT m_name[MAX_NLEN];
-
- /* Get the monster name (BEFORE polymorphing) */
monster_desc(attacker_ptr, m_name, m_ptr, 0);
msg_format(_("素早く%sの懐に入り込んだ!", "You quickly jump in and attack %s!"), m_name);
}
x = caster_ptr->x - 8 + randint0(17);
y = caster_ptr->y - 8 + randint0(17);
-
dx = (caster_ptr->x > x) ? (caster_ptr->x - x) : (x - caster_ptr->x);
dy = (caster_ptr->y > y) ? (caster_ptr->y - y) : (y - caster_ptr->y);
-
- /* Approximate distance */
d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
if (d >= 9) continue;
DIRECTION dir;
if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
- /* Use the given direction */
POSITION tx = caster_ptr->x + 99 * ddx[dir];
POSITION ty = caster_ptr->y + 99 * ddy[dir];
-
- /* Hack -- Use an actual "target" */
if ((dir == 5) && target_okay(caster_ptr))
{
tx = target_col;
POSITION nx, ny;
while (TRUE)
{
- /* Hack -- Stop at the target */
if ((y == ty) && (x == tx)) break;
ny = y;
nx = x;
mmove2(&ny, &nx, caster_ptr->y, caster_ptr->x, ty, tx);
-
- /* Stop at maximum range */
if (MAX_RANGE <= distance(caster_ptr->y, caster_ptr->x, ny, nx)) break;
-
- /* Stopped by walls/doors */
if (!cave_have_flag_bold(caster_ptr->current_floor_ptr, ny, nx, FF_PROJECT)) break;
-
- /* Stopped by monsters */
if ((dir != 5) && caster_ptr->current_floor_ptr->grid_array[ny][nx].m_idx != 0) break;
- /* Save the new location */
x = nx;
y = ny;
}
dx = (tx > x) ? (tx - x) : (x - tx);
dy = (ty > y) ? (ty - y) : (y - ty);
- /* Approximate distance */
d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
- /* Within the radius */
if (d < 5) break;
}
if (count < 0) continue;
- /* Cannot penetrate perm walls */
if (!in_bounds(caster_ptr->current_floor_ptr, y, x) ||
cave_stop_disintegration(caster_ptr->current_floor_ptr, y, x) ||
!in_disintegration_range(caster_ptr->current_floor_ptr, ty, tx, y, x))
return TRUE;
}
+
/*!
* @brief 「ワンダー」のランダムな効果を決定して処理する。
* @param caster_ptr プレーヤーへの参照ポインタ
clone_monster(caster_ptr, dir);
return;
}
-
+
if (die < 14)
{
speed_monster(caster_ptr, dir, plev);
confuse_monster(caster_ptr, dir, plev);
return;
}
-
+
if (die < 46)
{
fire_ball(caster_ptr, GF_POIS, dir, 20 + (plev / 2), 3);
(void)lite_line(caster_ptr, dir, damroll(6, 8));
return;
}
-
+
if (die < 56)
{
fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_ELEC, dir,
damroll(3 + ((plev - 5) / 4), 8));
return;
}
-
+
if (die < 61)
{
fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_COLD, dir,
damroll(5 + ((plev - 5) / 4), 8));
return;
}
-
+
if (die < 66)
{
fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr), GF_ACID, dir,
damroll(6 + ((plev - 5) / 4), 8));
return;
}
-
+
if (die < 71)
{
fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr), GF_FIRE, dir,
damroll(8 + ((plev - 5) / 4), 8));
return;
}
-
+
if (die < 76)
{
hypodynamic_bolt(caster_ptr, dir, 75);
return;
}
-
+
if (die < 81)
{
fire_ball(caster_ptr, GF_ELEC, dir, 30 + plev / 2, 2);
return;
}
-
+
if (die < 86)
{
fire_ball(caster_ptr, GF_ACID, dir, 40 + plev, 2);
return;
}
-
+
if (die < 91)
{
fire_ball(caster_ptr, GF_ICE, dir, 70 + plev, 3);
hypodynamic_bolt(caster_ptr, dir, 100 + plev);
return;
}
-
+
if (die < 104)
{
earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 12, 0);
(void)destroy_area(caster_ptr, caster_ptr->y, caster_ptr->x, 13 + randint0(5), FALSE);
return;
}
-
+
if (die < 108)
{
symbol_genocide(caster_ptr, plev + 50, TRUE);
dispel_monsters(caster_ptr, 120);
return;
}
-
+
dispel_monsters(caster_ptr, 150);
slow_monsters(caster_ptr, plev);
sleep_monsters(caster_ptr, plev);
int die = randint1(100) + plev / 5;
int vir = virtue_number(caster_ptr, V_CHANCE);
- if (vir)
+ if (vir != 0)
{
if (caster_ptr->virtues[vir - 1] > 0)
{
}
}
+
/*!
* @brief トランプ領域の「シャッフル」の効果をランダムに決めて処理する。
* @param caster_ptr プレーヤーへの参照ポインタ
int vir = virtue_number(caster_ptr, V_CHANCE);
int i;
- /* Card sharks and high mages get a level bonus */
if ((caster_ptr->pclass == CLASS_ROGUE) ||
(caster_ptr->pclass == CLASS_HIGH_MAGE) ||
(caster_ptr->pclass == CLASS_SORCERER))
die = (randint1(110)) + plev / 5;
else
die = randint1(120);
-
+
if (vir)
{
if (caster_ptr->virtues[vir - 1] > 0)
summon_specific(caster_ptr, 0, caster_ptr->y, caster_ptr->x, floor_ptr->dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
return;
}
-
+
if (die < 18)
{
int count = 0;
activate_ty_curse(caster_ptr, FALSE, &count);
return;
}
-
+
if (die < 22)
{
msg_print(_("《不調和の剣》だ。", "It's the swords of discord."));
aggravate_monsters(caster_ptr, 0);
return;
}
-
+
if (die < 26)
{
msg_print(_("《愚者》だ。", "It's the Fool."));
do_dec_stat(caster_ptr, A_WIS);
return;
}
-
+
if (die < 30)
{
msg_print(_("奇妙なモンスターの絵だ。", "It's the picture of a strange monster."));
trump_summoning(caster_ptr, 1, FALSE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), (32 + randint1(6)), PM_ALLOW_GROUP | PM_ALLOW_UNIQUE);
return;
}
-
+
if (die < 33)
{
msg_print(_("《月》だ。", "It's the Moon."));
unlite_area(caster_ptr, 10, 3);
return;
}
-
+
if (die < 38)
{
msg_print(_("《運命の輪》だ。", "It's the Wheel of Fortune."));
wild_magic(caster_ptr, randint0(32));
return;
}
-
+
if (die < 40)
{
msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
teleport_player(caster_ptr, 10, TELEPORT_PASSIVE);
return;
}
-
+
if (die < 42)
{
msg_print(_("《正義》だ。", "It's Justice."));
set_blessed(caster_ptr, caster_ptr->lev, FALSE);
return;
}
-
+
if (die < 47)
{
msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
teleport_player(caster_ptr, 200, TELEPORT_PASSIVE);
return;
}
-
+
if (die < 60)
{
msg_print(_("《塔》だ。", "It's the Tower."));
wall_breaker(caster_ptr);
return;
}
-
+
if (die < 72)
{
msg_print(_("《節制》だ。", "It's Temperance."));
sleep_monsters_touch(caster_ptr);
return;
}
-
+
if (die < 80)
{
msg_print(_("《塔》だ。", "It's the Tower."));
earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 5, 0);
return;
}
-
+
if (die < 82)
{
msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), SUMMON_MOLD, 0L);
return;
}
-
+
if (die < 84)
{
msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), SUMMON_BAT, 0L);
return;
}
-
+
if (die < 86)
{
msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), SUMMON_VORTEX, 0L);
return;
}
-
+
if (die < 88)
{
msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L);
return;
}
-
+
if (die < 96)
{
msg_print(_("《恋人》だ。", "It's the Lovers."));
return;
}
-
+
if (die < 101)
{
msg_print(_("《隠者》だ。", "It's the Hermit."));
wall_stone(caster_ptr);
return;
}
-
+
if (die < 111)
{
msg_print(_("《審判》だ。", "It's the Judgement."));
lose_all_mutations(caster_ptr);
return;
}
-
+
if (die < 120)
{
msg_print(_("《太陽》だ。", "It's the Sun."));
wiz_lite(caster_ptr, FALSE);
return;
}
-
+
msg_print(_("《世界》だ。", "It's the World."));
if (caster_ptr->exp >= PY_MAX_EXP)
{
gain_exp(caster_ptr, ee);
}
+
/*!
* @brief 口を使う継続的な処理を中断する
* @param caster_ptr プレーヤーへの参照ポインタ
return FALSE;
}
- /* Only works on adjacent monsters */
DIRECTION dir;
if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return FALSE;
POSITION x = caster_ptr->x + ddx[dir];
grid_type *g_ptr;
g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
-
stop_mouth(caster_ptr);
-
if (!(g_ptr->m_idx))
{
msg_print(_("何もない場所に噛みついた!", "You bite into thin air!"));
teleport_player(caster_ptr, 30, 0L);
return TRUE;
}
-
+
msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
msg_print(NULL);
return FALSE;
return TRUE;
}
- /* Check for a feeling */
byte feel = value_check_aux1(o_ptr);
-
- /* Get an object description */
GAME_TEXT o_name[MAX_NLEN];
object_desc(caster_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
- /* Skip non-feelings */
if (!feel)
{
msg_format(_("%sからは特に変わった事は感じとれなかった。", "You do not perceive anything unusual about the %s."), o_name);
break;
}
- /* Auto-inscription/destroy */
autopick_alter_item(caster_ptr, item, (bool)(okay && destroy_feeling));
-
return TRUE;
}
{
int Type = (one_in_(3) ? GF_COLD : GF_FIRE);
concptr Type_desc = ((Type == GF_COLD) ? _("冷気", "cold") : _("炎", "fire"));
-
DIRECTION dir;
if (!get_aim_dir(creature_ptr, &dir)) return FALSE;
creature_ptr->energy_use = 0;
return;
}
-
+
grid_type *g_ptr = &creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x];
feature_type *f_ptr = &f_info[g_ptr->feat];
msg_print(NULL);
return TRUE;
}
-
+
if (one_in_(3))
msg_print(_("あーたたたたたたたたたたたたたたたたたたたたたた!!!",
"Ahhhtatatatatatatatatatatatatatataatatatatattaaaaa!!!!"));
creature_ptr->redraw |= (PR_HP | PR_MANA);
return TRUE;
}
-
+
creature_ptr->csp += gain_sp;
if (creature_ptr->csp > creature_ptr->msp)
{
{
msg_format(_("%sに振り落とされた!", "You have been thrown off by %s."), m_name);
rakuba(creature_ptr, 1, TRUE);
+
/* 落馬処理に失敗してもとにかく乗馬解除 */
creature_ptr->riding = 0;
}
while (look)
{
tries++;
-
- /* Verify max distance */
if (dis > 200) dis = 200;
- /* Try several locations */
for (int i = 0; i < 500; i++)
{
- /* Pick a (possibly illegal) location */
while (TRUE)
{
ny = rand_spread(oy, dis);
if ((d >= min) && (d <= dis)) break;
}
- /* Ignore illegal locations */
if (!in_bounds(caster_ptr->current_floor_ptr, ny, nx)) continue;
-
if (!cave_monster_teleportable_bold(caster_ptr, m_idx, ny, nx, mode)) continue;
-
- /* No teleporting into vaults and such */
if (!(caster_ptr->current_floor_ptr->inside_quest || caster_ptr->current_floor_ptr->inside_arena))
if (caster_ptr->current_floor_ptr->grid_array[ny][nx].info & CAVE_ICKY) continue;
break;
}
- /* Increase the maximum distance */
dis = dis * 2;
-
min = min / 2;
if (tries > MAX_TRIES) return FALSE;
}
sound(SOUND_TPOTHER);
-
- /* Update the old location */
caster_ptr->current_floor_ptr->grid_array[oy][ox].m_idx = 0;
-
- /* Update the new location */
caster_ptr->current_floor_ptr->grid_array[ny][nx].m_idx = m_idx;
- /* Move the monster */
m_ptr->fy = ny;
m_ptr->fx = nx;
- /* Forget the counter target */
reset_target(m_ptr);
-
update_monster(caster_ptr, m_idx, TRUE);
lite_spot(caster_ptr, oy, ox);
lite_spot(caster_ptr, ny, nx);
{
monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[m_idx];
if(!m_ptr->r_idx) return;
-
- /* "Skill" test */
if(randint1(100) > power) return;
POSITION ny = m_ptr->fy;
bool look = TRUE;
while (look && --attempts)
{
- /* Verify max distance */
if (dis > 200) dis = 200;
- /* Try several locations */
for (int i = 0; i < 500; i++)
{
- /* Pick a (possibly illegal) location */
while (TRUE)
{
ny = rand_spread(ty, dis);
if ((d >= min) && (d <= dis)) break;
}
- /* Ignore illegal locations */
if (!in_bounds(caster_ptr->current_floor_ptr, ny, nx)) continue;
-
if (!cave_monster_teleportable_bold(caster_ptr, m_idx, ny, nx, mode)) continue;
look = FALSE;
break;
}
- /* Increase the maximum distance */
dis = dis * 2;
-
- /* Decrease the minimum distance */
min = min / 2;
}
if (attempts < 1) return;
sound(SOUND_TPOTHER);
-
- /* Update the old location */
caster_ptr->current_floor_ptr->grid_array[oy][ox].m_idx = 0;
-
- /* Update the new location */
caster_ptr->current_floor_ptr->grid_array[ny][nx].m_idx = m_idx;
- /* Move the monster */
m_ptr->fy = ny;
m_ptr->fx = nx;
for (int i = 0; i <= MAX_TELEPORT_DISTANCE; i++)
candidates_at[i] = 0;
- /* Limit the distance */
if (dis > MAX_TELEPORT_DISTANCE) dis = MAX_TELEPORT_DISTANCE;
- /* Search valid locations */
int left = MAX(1, creature_ptr->x - dis);
int right = MIN(creature_ptr->current_floor_ptr->width - 2, creature_ptr->x + dis);
int top = MAX(1, creature_ptr->y - dis);
{
for (POSITION x = left; x <= right; x++)
{
- /* Skip illegal locations */
if (!cave_player_teleportable_bold(creature_ptr, y, x, mode)) continue;
- /* Calculate distance */
int d = distance(creature_ptr->y, creature_ptr->x, y, x);
-
- /* Skip too far locations */
if (d > dis) continue;
- /* Count the total number of candidates */
total_candidates++;
-
- /* Count the number of candidates in this circumference */
candidates_at[d]++;
}
}
- /* No valid location! */
if (0 == total_candidates) return FALSE;
- /* Fix the minimum distance */
int cur_candidates;
int min = dis;
for (cur_candidates = 0; min >= 0; min--)
{
cur_candidates += candidates_at[min];
-
- /* 50% of all candidates will have an equal chance to be choosen. */
if (cur_candidates && (cur_candidates >= total_candidates / 2)) break;
}
- /* Pick up a single location randomly */
int pick = randint1(cur_candidates);
/* Search again the choosen location */
{
for (xx = left; xx <= right; xx++)
{
- /* Skip illegal locations */
if (!cave_player_teleportable_bold(creature_ptr, yy, xx, mode)) continue;
- /* Calculate distance */
int d = distance(creature_ptr->y, creature_ptr->x, yy, xx);
-
- /* Skip too far locations */
if (d > dis) continue;
-
- /* Skip too close locations */
if (d < min) continue;
- /* This grid was picked up? */
pick--;
if (!pick) break;
}
- /* Exit the loop */
if (!pick) break;
}
if (player_bold(creature_ptr, yy, xx)) return FALSE;
sound(SOUND_TELEPORT);
-
#ifdef JP
if ((creature_ptr->pseikaku == SEIKAKU_COMBAT) || (creature_ptr->inventory_list[INVEN_BOW].name1 == ART_CRIMSON))
msg_format("『こっちだぁ、%s』", creature_ptr->name);
#endif
-
(void)move_player_effect(creature_ptr, yy, xx, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
return TRUE;
}
+
/*!
* @brief プレイヤーのテレポート処理メインルーチン
* @param creature_ptr プレーヤーへの参照ポインタ
POSITION dis = 0, ctr = 0;
while (TRUE)
{
- /* Pick a nearby legal location */
while (TRUE)
{
y = (POSITION)rand_spread(ny, dis);
if (in_bounds(creature_ptr->current_floor_ptr, y, x)) break;
}
- /* Accept any grid when wizard mode */
- if (current_world_ptr->wizard && !(mode & TELEPORT_PASSIVE) && (!creature_ptr->current_floor_ptr->grid_array[y][x].m_idx || (creature_ptr->current_floor_ptr->grid_array[y][x].m_idx == creature_ptr->riding))) break;
+ bool is_anywhere = current_world_ptr->wizard;
+ is_anywhere &= !(mode & TELEPORT_PASSIVE);
+ is_anywhere &= (creature_ptr->current_floor_ptr->grid_array[y][x].m_idx > 0) ||
+ creature_ptr->current_floor_ptr->grid_array[y][x].m_idx == creature_ptr->riding;
+ if (is_anywhere) break;
- /* Accept teleportable floor grids */
if (cave_player_teleportable_bold(creature_ptr, y, x, mode)) break;
- /* Occasionally advance the distance */
if (++ctr > (4 * dis * dis + 4 * dis + 1))
{
ctr = 0;
{
GAME_TEXT m_name[160];
bool see_m = TRUE;
- if (m_idx <= 0) /* To player */
+ if (m_idx <= 0)
{
strcpy(m_name, _("あなた", "you"));
}
- else /* To monster */
+ else
{
monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[m_idx];
-
- /* Get the monster name (or "it") */
monster_desc(creature_ptr, m_name, m_ptr, 0);
-
see_m = is_seen(m_ptr);
}
- /* No effect in some case */
if (is_teleport_level_ineffective(creature_ptr, m_idx))
{
if (see_m) msg_print(_("効果がなかった。", "There is no effect."));
return;
}
- if ((m_idx <= 0) && creature_ptr->anti_tele) /* To player */
+ if ((m_idx <= 0) && creature_ptr->anti_tele)
{
msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
return;
}
- /* Choose up or down */
bool go_up;
if (randint0(100) < 50) go_up = TRUE;
else go_up = FALSE;
else if (get_check("Force to go down? ")) go_up = FALSE;
}
- /* Down only */
if ((ironman_downward && (m_idx <= 0)) || (creature_ptr->current_floor_ptr->dun_level <= d_info[creature_ptr->dungeon_idx].mindepth))
{
#ifdef JP
#else
if (see_m) msg_format("%^s sink%s through the floor.", m_name, (m_idx <= 0) ? "" : "s");
#endif
- if (m_idx <= 0) /* To player */
+ if (m_idx <= 0)
{
if (!creature_ptr->current_floor_ptr->dun_level)
{
creature_ptr->leaving = TRUE;
}
}
-
- /* Up only */
else if (quest_number(creature_ptr, creature_ptr->current_floor_ptr->dun_level) || (creature_ptr->current_floor_ptr->dun_level >= d_info[creature_ptr->dungeon_idx].maxdepth))
{
#ifdef JP
if (see_m) msg_format("%^s rise%s up through the ceiling.", m_name, (m_idx <= 0) ? "" : "s");
#endif
-
- if (m_idx <= 0) /* To player */
+ if (m_idx <= 0)
{
if (record_stair) exe_write_diary(creature_ptr, DIARY_TELEPORT_LEVEL, -1, NULL);
if (see_m) msg_format("%^s rise%s up through the ceiling.", m_name, (m_idx <= 0) ? "" : "s");
#endif
-
- if (m_idx <= 0) /* To player */
+ if (m_idx <= 0)
{
if (record_stair) exe_write_diary(creature_ptr, DIARY_TELEPORT_LEVEL, -1, NULL);
if (see_m) msg_format("%^s sink%s through the floor.", m_name, (m_idx <= 0) ? "" : "s");
#endif
- if (m_idx <= 0) /* To player */
+ if (m_idx <= 0)
{
- /* Never reach this code on the surface */
- /* if (!creature_ptr->current_floor_ptr->dun_level) creature_ptr->dungeon_idx = creature_ptr->recall_dungeon; */
if (record_stair) exe_write_diary(creature_ptr, DIARY_TELEPORT_LEVEL, 1, NULL);
if (autosave_l) do_cmd_save_game(creature_ptr, TRUE);
}
}
- /* Monster level teleportation is simple deleting now */
if (m_idx <= 0)
{
sound(SOUND_TPLEVEL);
* TODO: Recall the player to the last
* visited town when in the wilderness
*/
-
- /* Ironman option */
if (creature_ptr->current_floor_ptr->inside_arena || ironman_downward)
{
msg_print(_("何も起こらなかった。", "Nothing happens."));
bool free_level_recall(player_type *creature_ptr)
{
DUNGEON_IDX select_dungeon = choose_dungeon(_("にテレポート", "teleport"), 4, 0);
-
if (!select_dungeon) return FALSE;
DEPTH max_depth = d_info[select_dungeon].maxdepth;
-
- /* Limit depth in Angband */
if (select_dungeon == DUNGEON_ANGBAND)
{
if (quest[QUEST_OBERON].status != QUEST_STATUS_FINISHED) max_depth = 98;
QUANTITY amt = get_quantity(format(_("%sの何階にテレポートしますか?", "Teleport to which level of %s? "),
d_name + d_info[select_dungeon].name), (QUANTITY)max_depth);
-
if (amt <= 0)
{
return FALSE;
char tmp_val[160];
select_dungeon = choose_dungeon(_("をセット", "reset"), 2, 14);
-
- /* Ironman option */
if (ironman_downward)
{
msg_print(_("何も起こらなかった。", "Nothing happens."));
}
if (!select_dungeon) return FALSE;
- /* Prompt */
sprintf(ppp, _("何階にセットしますか (%d-%d):", "Reset to which level (%d-%d): "),
(int)d_info[select_dungeon].mindepth, (int)max_dlv[select_dungeon]);
-
- /* Default */
sprintf(tmp_val, "%d", (int)MAX(caster_ptr->current_floor_ptr->dun_level, 1));
- /* Ask for a level */
if (!get_string(ppp, tmp_val, 10))
{
return FALSE;
}
- /* Extract request */
dummy = atoi(tmp_val);
if (dummy < 1) dummy = 1;
if (dummy > max_dlv[select_dungeon]) dummy = max_dlv[select_dungeon];
if (record_maxdepth)
exe_write_diary(caster_ptr, DIARY_TRUMP, select_dungeon, _("フロア・リセットで", "using a scroll of reset recall"));
- /* Accept request */
#ifdef JP
msg_format("%sの帰還レベルを %d 階にセット。", d_name + d_info[select_dungeon].name, dummy, dummy * 50);
#else
object_type *o_ptr;
o_ptr = &target_ptr->inventory_list[t];
-
- /* No item, nothing happens */
if (!o_ptr->k_idx) return FALSE;
- /* Disenchant equipments only -- No disenchant on monster ball */
if (!object_is_weapon_armour_ammo(o_ptr))
return FALSE;
- /* Nothing to disenchant */
if ((o_ptr->to_h <= 0) && (o_ptr->to_d <= 0) && (o_ptr->to_a <= 0) && (o_ptr->pval <= 1))
{
return FALSE;
GAME_TEXT o_name[MAX_NLEN];
object_desc(target_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
-
- /* Artifacts have 71% chance to resist */
if (object_is_artifact(o_ptr) && (randint0(100) < 71))
{
#ifdef JP
return TRUE;
}
- /* Memorize old value */
int to_h = o_ptr->to_h;
int to_d = o_ptr->to_d;
int to_a = o_ptr->to_a;
int pval = o_ptr->pval;
- /* Disenchant tohit */
if (o_ptr->to_h > 0) o_ptr->to_h--;
if ((o_ptr->to_h > 5) && (randint0(100) < 20)) o_ptr->to_h--;
- /* Disenchant todam */
if (o_ptr->to_d > 0) o_ptr->to_d--;
if ((o_ptr->to_d > 5) && (randint0(100) < 20)) o_ptr->to_d--;
- /* Disenchant toac */
if (o_ptr->to_a > 0) o_ptr->to_a--;
if ((o_ptr->to_a > 5) && (randint0(100) < 20)) o_ptr->to_a--;
- /* Disenchant pval (occasionally) */
- /* Unless called from wild_magic() */
if ((o_ptr->pval > 1) && one_in_(13) && !(mode & 0x01)) o_ptr->pval--;
bool is_actually_disenchanted = to_h != o_ptr->to_h;
msg_format("Your %s (%c) %s disenchanted!", o_name, index_to_label(t),
((o_ptr->number != 1) ? "were" : "was"));
#endif
-
chg_virtue(target_ptr, V_HARMONY, 1);
chg_virtue(target_ptr, V_ENCHANT, -2);
target_ptr->update |= (PU_BONUS);
is_special_floor |= !caster_ptr->current_floor_ptr->dun_level;
if (is_special_floor) return FALSE;
- /* Scan all normal grids */
grid_type *g_ptr;
feature_type *f_ptr;
monster_type *m_ptr;
{
g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
- /* Seeing true feature code (ignore mimic) */
f_ptr = &f_info[g_ptr->feat];
-
- /* Lose room and vault */
g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
-
m_ptr = &caster_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
-
- /* Awake monster */
if (g_ptr->m_idx && MON_CSLEEP(m_ptr))
{
(void)set_monster_csleep(caster_ptr, g_ptr->m_idx, 0);
-
- /* Notice the "waking up" */
if (m_ptr->ml)
{
monster_desc(caster_ptr, m_name, m_ptr, 0);
}
}
- /* Process all walls, doors and patterns */
if (have_flag(f_ptr->flags, FF_HURT_DISI)) cave_alter_feat(caster_ptr, y, x, FF_HURT_DISI);
}
}
- /* Special boundary walls -- Top and bottom */
for (POSITION x = 0; x < caster_ptr->current_floor_ptr->width; x++)
{
g_ptr = &caster_ptr->current_floor_ptr->grid_array[0][x];
f_ptr = &f_info[g_ptr->mimic];
-
- /* Lose room and vault */
g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
- /* Set boundary mimic if needed */
if (g_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI))
{
g_ptr->mimic = feat_state(caster_ptr, g_ptr->mimic, FF_HURT_DISI);
-
- /* Check for change to boring grid */
if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER)) g_ptr->info &= ~(CAVE_MARK);
}
g_ptr = &caster_ptr->current_floor_ptr->grid_array[caster_ptr->current_floor_ptr->height - 1][x];
f_ptr = &f_info[g_ptr->mimic];
-
- /* Lose room and vault */
g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
- /* Set boundary mimic if needed */
if (g_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI))
{
g_ptr->mimic = feat_state(caster_ptr, g_ptr->mimic, FF_HURT_DISI);
-
- /* Check for change to boring grid */
if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER)) g_ptr->info &= ~(CAVE_MARK);
}
}
{
g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][0];
f_ptr = &f_info[g_ptr->mimic];
-
- /* Lose room and vault */
g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
- /* Set boundary mimic if needed */
if (g_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI))
{
g_ptr->mimic = feat_state(caster_ptr, g_ptr->mimic, FF_HURT_DISI);
-
- /* Check for change to boring grid */
if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER)) g_ptr->info &= ~(CAVE_MARK);
}
g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][caster_ptr->current_floor_ptr->width - 1];
f_ptr = &f_info[g_ptr->mimic];
-
- /* Lose room and vault */
g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
- /* Set boundary mimic if needed */
if (g_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI))
{
g_ptr->mimic = feat_state(caster_ptr, g_ptr->mimic, FF_HURT_DISI);
-
- /* Check for change to boring grid */
if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER)) g_ptr->info &= ~(CAVE_MARK);
}
}
- /* Mega-Hack -- Forget the view and lite */
caster_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
caster_ptr->redraw |= (PR_MAP);
caster_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
-
return TRUE;
}
+
/*!
* @brief 虚無招来処理 /
* @param caster_ptr プレーヤーへの参照ポインタ
return;
}
- /* Prevent destruction of quest levels and town */
bool is_special_fllor = caster_ptr->current_floor_ptr->inside_quest && is_fixed_quest_idx(caster_ptr->current_floor_ptr->inside_quest);
is_special_fllor |= !caster_ptr->current_floor_ptr->dun_level;
if (is_special_fllor)
object_type *o_ptr;
GAME_TEXT o_name[MAX_NLEN];
- /* Check to see if an object is already there */
if (caster_ptr->current_floor_ptr->grid_array[caster_ptr->y][caster_ptr->x].o_idx)
{
msg_print(_("自分の足の下にある物は取れません。", "You can't fetch when you're already standing on something."));
}
g_ptr = &caster_ptr->current_floor_ptr->grid_array[ty][tx];
-
- /* We need an item to fetch */
if (!g_ptr->o_idx)
{
msg_print(_("そこには何もありません。", "There is no object at this place."));
return;
}
- /* No fetching from vault */
if (g_ptr->info & CAVE_ICKY)
{
msg_print(_("アイテムがコントロールを外れて落ちた。", "The item slips from your control."));
return;
}
- /* We need to see the item */
if (require_los)
{
if (!player_has_los_bold(caster_ptr, ty, tx))
}
o_ptr = &caster_ptr->current_floor_ptr->o_list[g_ptr->o_idx];
-
if (o_ptr->weight > wgt)
{
- /* Too heavy to 'fetch' */
msg_print(_("そのアイテムは重過ぎます。", "The object is too heavy."));
return;
}
*/
void reserve_alter_reality(player_type *caster_ptr)
{
- /* Ironman option */
if (caster_ptr->current_floor_ptr->inside_arena || ironman_downward)
{
msg_print(_("何も起こらなかった。", "Nothing happens."));
*/
void identify_pack(player_type *target_ptr)
{
- INVENTORY_IDX i;
-
- /* Simply identify and know every item */
- for (i = 0; i < INVEN_TOTAL; i++)
+ for (INVENTORY_IDX i = 0; i < INVEN_TOTAL; i++)
{
object_type *o_ptr = &target_ptr->inventory_list[i];
if (!o_ptr->k_idx) continue;
identify_item(target_ptr, o_ptr);
-
- /* Auto-inscription */
autopick_alter_item(target_ptr, i, FALSE);
}
}
{
object_type *o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx) continue;
-
- /* Uncursed already */
if (!object_is_cursed(o_ptr)) continue;
-
- /* Heavily Cursed Items need a special spell */
if (!all && (o_ptr->curse_flags & TRC_HEAVY_CURSE)) continue;
-
- /* Perma-Cursed Items can NEVER be uncursed */
if (o_ptr->curse_flags & TRC_PERMA_CURSE)
{
o_ptr->curse_flags &= (TRC_CURSED | TRC_HEAVY_CURSE | TRC_PERMA_CURSE);
creature_ptr->update |= (PU_BONUS);
creature_ptr->window |= (PW_EQUIP);
-
- /* Count the uncursings */
cnt++;
}
if (cnt)
- {
msg_print(_("誰かに見守られているような気がする。", "You feel as if someone is watching over you."));
- }
return cnt;
}
o_ptr = choose_object(caster_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0);
if (!o_ptr) return FALSE;
- /* See how many items */
int amt = 1;
if (o_ptr->number > 1)
{
amt = get_quantity(NULL, o_ptr->number);
-
- /* Allow user abort */
if (amt <= 0) return FALSE;
}
object_desc(caster_ptr, o_name, o_ptr, 0);
o_ptr->number = old_number;
- /* Verify unless quantity given */
if (!force)
{
if (confirm_destroy || (object_value(o_ptr) > 0))
{
- /* Make a verification */
char out_val[MAX_NLEN + 40];
sprintf(out_val, _("本当に%sを金に変えますか?", "Really current_world_ptr->game_turn %s to gold? "), o_name);
if (!get_check(out_val)) return FALSE;
}
}
- /* Artifacts cannot be destroyed */
if (!can_player_destroy_object(o_ptr))
{
msg_format(_("%sを金に変えることに失敗した。", "You fail to current_world_ptr->game_turn %s to gold!"), o_name);
concptr q = _("どのアイテムを強化しますか? ", "Enchant which item? ");
concptr s = _("強化できるアイテムがない。", "You have nothing to enchant.");
-
object_type *o_ptr;
OBJECT_IDX item;
o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
#endif
okay = FALSE;
}
-
else if (object_is_ego(o_ptr))
{
#ifdef JP
#endif
okay = FALSE;
}
-
else if (o_ptr->xtra3)
{
#ifdef JP
((o_ptr->number > 1) ? "customized items" : "a customized item"));
#endif
}
-
else
{
if (o_ptr->number > 1)
}
concptr s = _("鑑定するべきアイテムがない。", "You have nothing to identify.");
-
OBJECT_IDX item;
object_type *o_ptr;
o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
return TRUE;
}
+
/*!
* @brief アイテム*鑑定*のメインルーチン処理 /
* Identify an object in the inventory (or on the floor)
bool old_known = identify_item(caster_ptr, o_ptr);
- /* Mark the item as fully known */
o_ptr->ident |= (IDENT_MENTAL);
handle_stuff(caster_ptr);
bool is_recharge_successful = TRUE;
if (o_ptr->tval == TV_ROD)
{
- /* Extract a recharge strength by comparing object level to power. */
recharge_strength = ((power > lev / 2) ? (power - lev / 2) : 0) / 5;
-
-
- /* Back-fire */
if (one_in_(recharge_strength))
{
- /* Activate the failure code. */
is_recharge_successful = FALSE;
}
-
- /* Recharge */
else
{
- /* Recharge amount */
recharge_amount = (power * damroll(3, 2));
-
- /* Recharge by that amount */
if (o_ptr->timeout > recharge_amount)
o_ptr->timeout -= recharge_amount;
else
o_ptr->timeout = 0;
}
}
-
- /* Recharge wand/staff */
else
{
- /* Extract a recharge strength by comparing object level to power.
- * Divide up a stack of wands' charges to calculate charge penalty.
- */
if ((o_ptr->tval == TV_WAND) && (o_ptr->number > 1))
recharge_strength = (100 + power - lev - (8 * o_ptr->pval / o_ptr->number)) / 15;
-
- /* All staffs, unstacked wands. */
else recharge_strength = (100 + power - lev - (8 * o_ptr->pval)) / 15;
+
if (recharge_strength < 0) recharge_strength = 0;
- /* Back-fire */
if (one_in_(recharge_strength))
{
- /* Activate the failure code. */
is_recharge_successful = FALSE;
}
-
- /* If the spell didn't backfire, recharge the wand or staff. */
else
{
- /* Recharge based on the standard number of charges. */
recharge_amount = randint1(1 + k_ptr->pval / 2);
-
- /* Multiple wands in a stack increase recharging somewhat. */
if ((o_ptr->tval == TV_WAND) && (o_ptr->number > 1))
{
recharge_amount +=
if (recharge_amount > 12) recharge_amount = 12;
}
- /* But each staff in a stack gets fewer additional charges,
- * although always at least one.
- */
if ((o_ptr->tval == TV_STAFF) && (o_ptr->number > 1))
{
recharge_amount /= (TIME_EFFECT)o_ptr->number;
if (recharge_amount < 1) recharge_amount = 1;
}
- /* Recharge the wand or staff. */
o_ptr->pval += recharge_amount;
-
-
- /* Hack -- we no longer "know" the item */
o_ptr->ident &= ~(IDENT_KNOWN);
-
- /* Hack -- we no longer think the item is empty */
o_ptr->ident &= ~(IDENT_EMPTY);
}
}
{
object_desc(caster_ptr, o_name, o_ptr, OD_NAME_ONLY);
msg_format(_("魔力が逆流した!%sは完全に魔力を失った。", "The recharging backfires - %s is completely drained!"), o_name);
-
- /* Artifact rods. */
if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout < 10000))
o_ptr->timeout = (o_ptr->timeout + 100) * 2;
-
- /* Artifact wands and staffs. */
else if ((o_ptr->tval == TV_WAND) || (o_ptr->tval == TV_STAFF))
o_ptr->pval = 0;
return update_player(caster_ptr);
clear_from(0);
- /* They have too many spells to list */
if (caster_ptr->pclass == CLASS_SORCERER) return;
if (caster_ptr->pclass == CLASS_RED_MAGE) return;
-
if (caster_ptr->pclass == CLASS_SNIPER)
{
display_snipe_list(caster_ptr);
return;
}
- /* mind.c type classes */
if ((caster_ptr->pclass == CLASS_MINDCRAFTER) ||
(caster_ptr->pclass == CLASS_BERSERKER) ||
(caster_ptr->pclass == CLASS_NINJA) ||
PERCENTAGE minfail = 0;
PLAYER_LEVEL plev = caster_ptr->lev;
PERCENTAGE chance = 0;
- mind_type spell;
- char comment[80];
- char psi_desc[80];
- int use_mind;
+ mind_type spell;
+ char comment[80];
+ char psi_desc[80];
+ int use_mind;
bool use_hp = FALSE;
y = 1;
x = 1;
- /* Display a list of spells */
prt("", y, x);
put_str(_("名前", "Name"), y, x + 5);
put_str(_("Lv MP 失率 効果", "Lv Mana Fail Info"), y, x + 35);
default: use_mind = 0;break;
}
- /* Dump the spells */
- int i;
- for (i = 0; i < MAX_MIND_POWERS; i++)
+ for (int i = 0; i < MAX_MIND_POWERS; i++)
{
byte a = TERM_WHITE;
-
- /* Access the available spell */
spell = mind_powers[use_mind].info[i];
if (spell.min_lev > plev) break;
- /* Get the failure rate */
chance = spell.fail;
-
- /* Reduce failure rate by "effective" level adjustment */
chance -= 3 * (caster_ptr->lev - spell.min_lev);
-
- /* Reduce failure rate by INT/WIS adjustment */
chance -= 3 * (adj_mag_stat[caster_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
-
if (!use_hp)
{
- /* Not enough mana to cast */
if (spell.mana_cost > caster_ptr->csp)
{
chance += 5 * (spell.mana_cost - caster_ptr->csp);
}
else
{
- /* Not enough hp to cast */
if (spell.mana_cost > caster_ptr->chp)
{
chance += 100;
}
}
- /* Extract the minimum failure rate */
minfail = adj_mag_fail[caster_ptr->stat_ind[mp_ptr->spell_stat]];
-
- /* Minimum failure rate */
if (chance < minfail) chance = minfail;
- /* Stunning makes spells harder */
if (caster_ptr->stun > 50) chance += 25;
else if (caster_ptr->stun) chance += 15;
- /* Always a 5 percent chance of working */
if (chance > 95) chance = 95;
- /* Get info */
mindcraft_info(caster_ptr, comment, use_mind, i);
-
- /* Dump the spell */
sprintf(psi_desc, " %c) %-30s%2d %4d %3d%%%s",
I2A(i), spell.name,
spell.min_lev, spell.mana_cost, chance, comment);
return;
}
- /* Cannot read spellbooks */
if (REALM_NONE == caster_ptr->realm1) return;
- /* Normal spellcaster with books */
-
- /* Scan books */
for (int j = 0; j < ((caster_ptr->realm2 > REALM_NONE) ? 2 : 1); j++)
{
- /* Reset vertical */
m[j] = 0;
-
- /* Vertical location */
y = (j < 3) ? 0 : (m[j - 3] + 2);
-
- /* Horizontal location */
x = 27 * (j % 3);
-
- /* Scan spells */
int n = 0;
for (int i = 0; i < 32; i++)
{
byte a = TERM_WHITE;
- /* Access the spell */
if (!is_magic((j < 1) ? caster_ptr->realm1 : caster_ptr->realm2))
{
s_ptr = &technic_info[((j < 1) ? caster_ptr->realm1 : caster_ptr->realm2) - MIN_TECHNIC][i % 32];
strcpy(name, exe_spell(caster_ptr, (j < 1) ? caster_ptr->realm1 : caster_ptr->realm2, i % 32, SPELL_NAME));
- /* Illegible */
if (s_ptr->slevel >= 99)
{
- /* Illegible */
strcpy(name, _("(判読不能)", "(illegible)"));
-
- /* Unusable */
a = TERM_L_DARK;
}
-
- /* Forgotten */
else if ((j < 1) ?
((caster_ptr->spell_forgotten1 & (1L << i))) :
((caster_ptr->spell_forgotten2 & (1L << (i % 32)))))
{
- /* Forgotten */
a = TERM_ORANGE;
}
-
- /* Unknown */
else if (!((j < 1) ?
(caster_ptr->spell_learned1 & (1L << i)) :
(caster_ptr->spell_learned2 & (1L << (i % 32)))))
{
- /* Unknown */
a = TERM_RED;
}
-
- /* Untried */
else if (!((j < 1) ?
(caster_ptr->spell_worked1 & (1L << i)) :
(caster_ptr->spell_worked2 & (1L << (i % 32)))))
{
- /* Untried */
a = TERM_YELLOW;
}
- /* Dump the spell --(-- */
sprintf(out_val, "%c/%c) %-20.20s",
I2A(n / 8), I2A(n % 8), name);
- /* Track maximum */
m[j] = y + n;
Term_putstr(x, m[j], -1, a, out_val);
n++;
#define MANA_CONST 2400
#define MANA_DIV 4
#define DEC_MANA_DIV 3
-
- /* Realm magic */
if ((realm > REALM_NONE) && (realm <= MAX_REALM))
{
- /*
- * need_mana defaults if spell exp equals SPELL_EXP_EXPERT and !caster_ptr->dec_mana.
- * MANA_CONST is used to calculate need_mana effected from spell proficiency.
- */
need_mana = need_mana * (MANA_CONST + SPELL_EXP_EXPERT - experience_of_spell(caster_ptr, spell, realm)) + (MANA_CONST - 1);
need_mana *= caster_ptr->dec_mana ? DEC_MANA_DIV : MANA_DIV;
need_mana /= MANA_CONST * MANA_DIV;
if (need_mana < 1) need_mana = 1;
}
-
- /* Non-realm magic */
else
{
if (caster_ptr->dec_mana) need_mana = (need_mana + 1) * DEC_MANA_DIV / MANA_DIV;
*/
PERCENTAGE spell_chance(player_type *caster_ptr, SPELL_IDX spell, REALM_IDX use_realm)
{
- /* Paranoia -- must be literate */
if (!mp_ptr->spell_book) return 100;
-
if (use_realm == REALM_HISSATSU) return 0;
- /* Access the spell */
const magic_type *s_ptr;
if (!is_magic(use_realm))
{
s_ptr = &mp_ptr->info[use_realm - 1][spell];
}
- /* Extract the base spell failure rate */
PERCENTAGE chance = s_ptr->sfail;
-
- /* Reduce failure rate by "effective" level adjustment */
chance -= 3 * (caster_ptr->lev - s_ptr->slevel);
-
- /* Reduce failure rate by INT/WIS adjustment */
chance -= 3 * (adj_mag_stat[caster_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
-
if (caster_ptr->riding)
chance += (MAX(r_info[caster_ptr->current_floor_ptr->m_list[caster_ptr->riding].r_idx].level - caster_ptr->skill_exp[GINOU_RIDING] / 100 - 10, 0));
- /* Extract mana consumption rate */
MANA_POINT need_mana = mod_need_mana(caster_ptr, s_ptr->smana, spell, use_realm);
-
- /* Not enough mana to cast */
if (need_mana > caster_ptr->csp)
{
chance += 5 * (need_mana - caster_ptr->csp);
if ((use_realm != caster_ptr->realm1) && ((caster_ptr->pclass == CLASS_MAGE) || (caster_ptr->pclass == CLASS_PRIEST))) chance += 5;
- /* Extract the minimum failure rate */
PERCENTAGE minfail = adj_mag_fail[caster_ptr->stat_ind[mp_ptr->spell_stat]];
-
- /*
- * Non mage/priest characters never get too good
- * (added high mage, mindcrafter)
- */
if (mp_ptr->spell_xtra & MAGIC_FAIL_5PERCENT)
{
if (minfail < 5) minfail = 5;
}
- /* Hack -- Priest prayer penalty for "edged" weapons -DGK */
if (((caster_ptr->pclass == CLASS_PRIEST) || (caster_ptr->pclass == CLASS_SORCERER)) && caster_ptr->icky_wield[0]) chance += 25;
if (((caster_ptr->pclass == CLASS_PRIEST) || (caster_ptr->pclass == CLASS_SORCERER)) && caster_ptr->icky_wield[1]) chance += 25;
chance = mod_spell_chance_1(caster_ptr, chance);
-
- /* Goodness or evilness gives a penalty to failure rate */
PERCENTAGE penalty = (mp_ptr->spell_stat == A_WIS) ? 10 : 4;
switch (use_realm)
{
if (caster_ptr->stun > 50) chance += 25;
else if (caster_ptr->stun) chance += 15;
- /* Always a 5 percent chance of working */
if (chance > 95) chance = 95;
if ((use_realm == caster_ptr->realm1) || (use_realm == caster_ptr->realm2)
if (((use_realm <= REALM_NONE) || (use_realm > MAX_REALM)) && current_world_ptr->wizard)
msg_print(_("警告! print_spell が領域なしに呼ばれた", "Warning! print_spells called with null realm"));
- /* Title the list */
prt("", y, x);
char buf[256];
if (use_realm == REALM_HISSATSU)
int i;
int exp_level;
- SPELL_IDX spell;
const magic_type *s_ptr;
char info[80];
char out_val[160];
bool max = FALSE;
for (i = 0; i < num; i++)
{
- spell = spells[i];
+ SPELL_IDX spell = spells[i];
if (!is_magic(use_realm))
{
else
{
EXP exp = experience_of_spell(caster_ptr, spell, use_realm);
-
- /* Extract mana consumption rate */
need_mana = mod_need_mana(caster_ptr, s_ptr->smana, spell, use_realm);
-
if ((increment == 64) || (s_ptr->slevel >= 99)) exp_level = EXP_LEVEL_UNSKILLED;
else exp_level = spell_exp_level(exp);
strcpy(out_val, " ");
}
else sprintf(out_val, " %c) ", I2A(i));
- /* Skip illegible spells */
+
if (s_ptr->slevel >= 99)
{
strcat(out_val, format("%-30s", _("(判読不能)", "(illegible)")));
continue;
}
- /* XXX XXX Could label spells above the players level */
-
- /* Get extra info */
strcpy(info, exe_spell(caster_ptr, use_realm, spell, SPELL_INFO));
-
- /* Use that info */
concptr comment = info;
-
- /* Assume spell is known and tried */
byte line_attr = TERM_WHITE;
-
- /* Analyze the spell */
if ((caster_ptr->pclass == CLASS_SORCERER) || (caster_ptr->pclass == CLASS_RED_MAGE))
{
if (s_ptr->slevel > caster_ptr->max_plv)
line_attr = TERM_L_GREEN;
}
- /* Dump the spell --(-- */
if (use_realm == REALM_HISSATSU)
{
strcat(out_val, format("%-25s %2d %4d",
- exe_spell(caster_ptr, use_realm, spell, SPELL_NAME), /* realm, spell */
- s_ptr->slevel, need_mana));
+ exe_spell(caster_ptr, use_realm, spell, SPELL_NAME), s_ptr->slevel, need_mana));
}
else
{
strcat(out_val, format("%-25s%c%-4s %2d %4d %3d%% %s",
- exe_spell(caster_ptr, use_realm, spell, SPELL_NAME), /* realm, spell */
- (max ? '!' : ' '), ryakuji,
+ exe_spell(caster_ptr, use_realm, spell, SPELL_NAME), (max ? '!' : ' '), ryakuji,
s_ptr->slevel, need_mana, spell_chance(caster_ptr, spell, use_realm), comment));
}
*/
static MONRACE_IDX poly_r_idx(player_type *caster_ptr, MONRACE_IDX r_idx)
{
- /* Hack -- Uniques/Questors never polymorph */
monster_race *r_ptr = &r_info[r_idx];
if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags1 & RF1_QUESTOR))
return (r_idx);
- /* Allowable range of "levels" for resulting monster */
DEPTH lev1 = r_ptr->level - ((randint1(20) / randint1(9)) + 1);
DEPTH lev2 = r_ptr->level + ((randint1(20) / randint1(9)) + 1);
-
- /* Pick a (possibly new) non-unique race */
MONRACE_IDX r;
for (int i = 0; i < 1000; i++)
{
- /* Pick a new race, using a level calculation */
r = get_mon_num(caster_ptr, (caster_ptr->current_floor_ptr->dun_level + r_ptr->level) / 2 + 5);
-
- /* Handle failure */
if (!r) break;
r_ptr = &r_info[r];
-
- /* Ignore unique monsters */
if (r_ptr->flags1 & RF1_UNIQUE) continue;
-
- /* Ignore monsters with incompatible levels */
if ((r_ptr->level < lev1) || (r_ptr->level > lev2)) continue;
- /* Use that index */
r_idx = r;
-
break;
}
if (floor_ptr->inside_arena || caster_ptr->phase_out) return FALSE;
if ((caster_ptr->riding == g_ptr->m_idx) || (m_ptr->mflag2 & MFLAG2_KAGE)) return FALSE;
- /* Memorize the monster before polymorphing */
monster_type back_m = *m_ptr;
-
- /* Pick a "new" monster race */
new_r_idx = poly_r_idx(caster_ptr, old_r_idx);
-
- /* Handle polymorph */
if (new_r_idx == old_r_idx) return FALSE;
bool preserve_hold_objects = back_m.hold_o_idx ? TRUE : FALSE;
OBJECT_IDX this_o_idx, next_o_idx = 0;
- /* Get the monsters attitude */
BIT_FLAGS mode = 0L;
if (is_friendly(m_ptr)) mode |= PM_FORCE_FRIENDLY;
if (is_pet(m_ptr)) mode |= PM_FORCE_PET;
if (m_ptr->mflag2 & MFLAG2_NOPET) mode |= PM_NO_PET;
- /* Mega-hack -- ignore held objects */
m_ptr->hold_o_idx = 0;
-
- /* "Kill" the "old" monster */
delete_monster_idx(caster_ptr, g_ptr->m_idx);
-
- /* Create a new monster (no groups) */
bool polymorphed = FALSE;
if (place_monster_aux(caster_ptr, 0, y, x, new_r_idx, mode))
{
floor_ptr->m_list[hack_m_idx_ii].nickname = back_m.nickname;
floor_ptr->m_list[hack_m_idx_ii].parent_m_idx = back_m.parent_m_idx;
floor_ptr->m_list[hack_m_idx_ii].hold_o_idx = back_m.hold_o_idx;
-
- /* Success */
polymorphed = TRUE;
}
else
{
- /* Placing the new monster failed */
if (place_monster_aux(caster_ptr, 0, y, x, old_r_idx, (mode | PM_NO_KAGE | PM_IGNORE_TERRAIN)))
{
floor_ptr->m_list[hack_m_idx_ii] = back_m;
-
- /* Re-initialize monster process */
mproc_init(floor_ptr);
}
else preserve_hold_objects = FALSE;
}
- /* Mega-hack -- preserve held objects */
if (preserve_hold_objects)
{
for (this_o_idx = back_m.hold_o_idx; this_o_idx; this_o_idx = next_o_idx)
{
object_type *o_ptr = &floor_ptr->o_list[this_o_idx];
next_o_idx = o_ptr->next_o_idx;
-
- /* Held by new monster */
o_ptr->held_m_idx = hack_m_idx_ii;
}
}
- else if (back_m.hold_o_idx) /* Failed (paranoia) */
+ else if (back_m.hold_o_idx)
{
for (this_o_idx = back_m.hold_o_idx; this_o_idx; this_o_idx = next_o_idx)
{
return polymorphed;
}
+
/*!
* @brief 次元の扉処理 /
* Dimension Door
bool dimension_door(player_type *caster_ptr)
{
DEPTH x = 0, y = 0;
-
if (!tgt_pt(caster_ptr, &x, &y)) return FALSE;
if (dimension_door_aux(caster_ptr, x, y)) return TRUE;
bool eat_magic(player_type *caster_ptr, int power)
{
byte fail_type = 1;
-
- concptr q, s;
GAME_TEXT o_name[MAX_NLEN];
item_tester_hook = item_tester_hook_recharge;
- q = _("どのアイテムから魔力を吸収しますか?", "Drain which item? ");
- s = _("魔力を吸収できるアイテムがありません。", "You have nothing to drain.");
+ concptr q = _("どのアイテムから魔力を吸収しますか?", "Drain which item? ");
+ concptr s = _("魔力を吸収できるアイテムがありません。", "You have nothing to drain.");
object_type *o_ptr;
OBJECT_IDX item;
if (o_ptr->tval == TV_ROD)
{
recharge_strength = ((power > lev/2) ? (power - lev/2) : 0) / 5;
-
- /* Back-fire */
if (one_in_(recharge_strength))
{
- /* Activate the failure code. */
is_eating_successful = FALSE;
}
else
}
else
{
- /* All staffs, wands. */
recharge_strength = (100 + power - lev) / 15;
if (recharge_strength < 0) recharge_strength = 0;
- /* Back-fire */
if (one_in_(recharge_strength))
{
is_eating_successful = FALSE;
caster_ptr->csp += lev / 2;
o_ptr->pval --;
- /* XXX Hack -- unstack if necessary */
if ((o_ptr->tval == TV_STAFF) && (item >= 0) && (o_ptr->number > 1))
{
object_type forge;
q_ptr = &forge;
object_copy(q_ptr, o_ptr);
- /* Modify quantity */
q_ptr->number = 1;
-
- /* Restore the charges */
o_ptr->pval++;
-
- /* Unstack the used item */
o_ptr->number--;
caster_ptr->total_weight -= q_ptr->weight;
item = inven_carry(caster_ptr, q_ptr);
return redraw_player(caster_ptr);
}
- /* Artifacts are never destroyed. */
if (object_is_fixed_artifact(o_ptr))
{
object_desc(caster_ptr, o_name, o_ptr, OD_NAME_ONLY);
msg_format(_("魔力が逆流した!%sは完全に魔力を失った。", "The recharging backfires - %s is completely drained!"), o_name);
-
- /* Artifact rods. */
if (o_ptr->tval == TV_ROD)
o_ptr->timeout = k_ptr->pval * o_ptr->number;
-
- /* Artifact wands and staffs. */
else if ((o_ptr->tval == TV_WAND) || (o_ptr->tval == TV_STAFF))
o_ptr->pval = 0;
+
return redraw_player(caster_ptr);
}
- /* Get the object description */
object_desc(caster_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
- /*** Determine Seriousness of Failure ***/
-
/* Mages recharge objects more safely. */
if (IS_WIZARD_CLASS(caster_ptr))
{
}
}
- /*** Apply draining and destruction. ***/
-
- /* Drain object or stack of objects. */
if (fail_type == 1)
{
if (o_ptr->tval == TV_ROD)
}
}
- /* Destroy an object or one in a stack of objects. */
if (fail_type == 2)
{
if (o_ptr->number > 1)
vary_item(caster_ptr, item, -1);
}
- /* Destroy all members of a stack of objects. */
if (fail_type == 3)
{
if (o_ptr->number > 1)
*/
void massacre(player_type *caster_ptr)
{
- POSITION x, y;
grid_type *g_ptr;
monster_type *m_ptr;
for (DIRECTION dir = 0; dir < 8; dir++)
{
- y = caster_ptr->y + ddy_ddd[dir];
- x = caster_ptr->x + ddx_ddd[dir];
+ POSITION y = caster_ptr->y + ddy_ddd[dir];
+ POSITION x = caster_ptr->x + ddx_ddd[dir];
g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
m_ptr = &caster_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
-
- /* Hack -- attack monsters */
if (g_ptr->m_idx && (m_ptr->ml || cave_have_flag_bold(caster_ptr->current_floor_ptr, y, x, FF_PROJECT)))
py_attack(caster_ptr, y, x, 0);
}
mimic_f_ptr = &f_info[get_feat_mimic(g_ptr)];
stop_mouth(caster_ptr);
-
if (!have_flag(mimic_f_ptr->flags, FF_HURT_ROCK))
{
msg_print(_("この地形は食べられない。", "You cannot eat this feature."));
ty = y;
tx = x;
}
- else break;
+ else
+ {
+ break;
+ }
}
bool is_shock_successful = ty != oy;
DIRECTION dir;
if (!get_aim_dir(shooter_ptr, &dir)) return FALSE;
- /* Use the given direction */
POSITION tx = shooter_ptr->x + 99 * ddx[dir];
POSITION ty = shooter_ptr->y + 99 * ddy[dir];
-
- /* Hack -- Use an actual "target" */
if ((dir == 5) && target_okay(shooter_ptr))
{
tx = target_col;
int num = 1;
if (shooter_ptr->pclass == CLASS_ARCHER)
{
- /* Extra shot at level 10 */
if (shooter_ptr->lev >= 10) num++;
-
- /* Extra shot at level 30 */
if (shooter_ptr->lev >= 30) num++;
-
- /* Extra shot at level 45 */
if (shooter_ptr->lev >= 45) num++;
}
num++;
}
- if (!num)
+ if (num == 0)
{
msg_print(_("まだ行けるところがない。", "You have not yet visited any town."));
msg_print(NULL);
TERM_LEN command_gap = 999; /* See "object1.c" */
s16b command_new; /* Command chaining from inven/equip view */
-
-
#ifdef SET_UID
# ifndef HAVE_USLEEP
*/
int usleep(huge usecs)
{
- struct timeval Timer;
+ struct timeval timer;
- int nfds = 0;
+ int nfds = 0;
#ifdef FD_SET
fd_set *no_fds = NULL;
#else
int *no_fds = NULL;
#endif
-
-
- /* Was: int readfds, writefds, exceptfds; */
- /* Was: readfds = writefds = exceptfds = 0; */
-
-
- /* Paranoia -- No excessive sleeping */
if (usecs > 4000000L) core(_("不当な usleep() 呼び出し", "Illegal usleep() call"));
- /* Wait for it */
- Timer.tv_sec = (usecs / 1000000L);
- Timer.tv_usec = (usecs % 1000000L);
-
- /* Wait for it */
- if (select(nfds, no_fds, no_fds, no_fds, &Timer) < 0)
+ timer.tv_sec = (usecs / 1000000L);
+ timer.tv_usec = (usecs % 1000000L);
+ if (select(nfds, no_fds, no_fds, no_fds, &timer) < 0)
{
- /* Hack -- ignore interrupts */
if (errno != EINTR) return -1;
}
- /* Success */
return 0;
}
-
# endif
-
/*
* Hack -- External functions
*/
extern struct passwd *getpwnam(concptr name);
#endif
-
/*
* Find a default user name from the system.
*/
void user_name(char *buf, int id)
{
struct passwd *pw;
-
- /* Look up the user name */
if ((pw = getpwuid(id)))
{
(void)strcpy(buf, pw->pw_name);
buf[16] = '\0';
- /* Hack -- capitalize the user name */
#ifdef JP
if (!iskanji(buf[0]))
#endif
return;
}
- /* Oops. Hack -- default to "PLAYER" */
strcpy(buf, "PLAYER");
}
#endif /* SET_UID */
-
-
/*
* The concept of the "file" routines below (and elsewhere) is that all
* file handling should be done using as few routines as possible, since
* We should probably parse a leading "~~/" as referring to "ANGBAND_DIR". (?)
*/
-
#ifdef SET_UID
-
/*
* Extract a "parsed" path from an initial filename
* Normally, we simply copy the filename into the buffer
*/
errr path_parse(char *buf, int max, concptr file)
{
- concptr u, s;
- struct passwd *pw;
- char user[128];
-
-
- /* Assume no result */
buf[0] = '\0';
-
- /* No file? */
if (!file) return -1;
- /* File needs no parsing */
if (file[0] != '~')
{
(void)strnfmt(buf, max, "%s", file);
return 0;
}
- /* Point at the user */
- u = file + 1;
-
- /* Look for non-user portion of the file */
- s = my_strstr(u, PATH_SEP);
-
- /* Hack -- no long user names */
+ concptr u = file + 1;
+ concptr s = my_strstr(u, PATH_SEP);
+ char user[128];
if (s && (s >= u + sizeof(user))) return 1;
- /* Extract a user name */
if (s)
{
int i;
u = user;
}
- /* Look up the "current" user */
if (u[0] == '\0') u = getlogin();
- /* Look up a user (or "current" user) */
+ struct passwd *pw;
if (u) pw = getpwnam(u);
else pw = getpwuid(getuid());
- /* Nothing found? */
if (!pw) return 1;
- /* Make use of the info */
if (s) strnfmt(buf, max, "%s%s", pw->pw_dir, s);
else strnfmt(buf, max, "%s", pw->pw_dir);
- /* Success */
return 0;
}
-
-
#else /* SET_UID */
-
-
/*
* Extract a "parsed" path from an initial filename
*
*/
errr path_parse(char *buf, int max, concptr file)
{
- /* Accept the filename */
(void)strnfmt(buf, max, "%s", file);
return 0;
}
-
-
#endif /* SET_UID */
*/
static errr path_temp(char *buf, int max)
{
- concptr s;
-
- /* Temp file */
- s = tmpnam(NULL);
-
+ concptr s = tmpnam(NULL);
if (!s) return -1;
- /* Format to length */
#if !defined(WIN32) || (defined(_MSC_VER) && (_MSC_VER >= 1900))
(void)strnfmt(buf, max, "%s", s);
#else
(void)strnfmt(buf, max, ".%s", s);
#endif
- /* Success */
return 0;
}
-
#endif
+
/*!
* @brief ファイル入出力のためのパス生成する。/ Create a new path by appending a file (or directory) to a path.
* @param buf ファイルのフルを返すバッファ
*/
errr path_build(char *buf, int max, concptr path, concptr file)
{
- /* Special file */
if (file[0] == '~')
{
- /* Use the file itself */
(void)strnfmt(buf, max, "%s", file);
}
-
- /* Absolute file, on "normal" systems */
else if (prefix(file, PATH_SEP) && !streq(PATH_SEP, ""))
{
- /* Use the file itself */
(void)strnfmt(buf, max, "%s", file);
}
-
- /* No path given */
else if (!path[0])
{
- /* Use the file itself */
(void)strnfmt(buf, max, "%s", file);
}
-
- /* Path and File */
else
{
- /* Build the new path */
(void)strnfmt(buf, max, "%s%s%s", path, PATH_SEP, file);
}
- /* Success */
return 0;
}
*/
FILE *my_fopen(concptr file, concptr mode)
{
- char buf[1024];
-
#if defined(MACH_O_CARBON)
FILE *tempfff;
#endif
-
- /* Hack -- Try to parse the path */
+ char buf[1024];
if (path_parse(buf, 1024, file)) return (NULL);
-
#if defined(MACH_O_CARBON)
if (my_strchr(mode, 'w'))
{
- /* setting file type/creator */
tempfff = fopen(buf, mode);
fsetfileinfo(buf, _fcreator, _ftype);
fclose(tempfff);
}
#endif
- /* Attempt to fopen the file anyway */
return (fopen(buf, mode));
}
*/
errr my_fclose(FILE *fff)
{
- /* Require a file */
if (!fff) return -1;
-
- /* Close, check for error */
if (fclose(fff) == EOF) return 1;
-
- /* Success */
return 0;
}
#ifdef HAVE_MKSTEMP
-
FILE *my_fopen_temp(char *buf, int max)
{
- int fd;
-
- /* Prepare the buffer for mkstemp */
strncpy(buf, "/tmp/anXXXXXX", max);
-
- /* Secure creation of a temporary file */
- fd = mkstemp(buf);
-
- /* Check the file-descriptor */
+ int fd = mkstemp(buf);
if (fd < 0) return (NULL);
- /* Return a file stream */
return (fdopen(fd, "w"));
}
-
#else /* HAVE_MKSTEMP */
-
FILE *my_fopen_temp(char *buf, int max)
{
- /* Generate a temporary filename */
if (path_temp(buf, max)) return (NULL);
return (my_fopen(buf, "w"));
}
-
#endif /* HAVE_MKSTEMP */
char *s;
char tmp[1024];
- /* Read a line */
if (fgets(tmp, 1024, fff))
{
#ifdef JP
guess_convert_to_system_encoding(tmp, sizeof(tmp));
#endif
-
- /* Convert weirdness */
for (s = tmp; *s; s++)
{
#if defined(MACH_O_CARBON)
if (*s == '\r') *s = '\n';
#endif /* MACH_O_CARBON */
-
- /* Handle newline */
if (*s == '\n')
{
- /* Terminate */
buf[i] = '\0';
-
- /* Success */
return 0;
}
-
- /* Handle tabs */
else if (*s == '\t')
{
- /* Hack -- require room */
if (i + 8 >= n) break;
- /* Append a space */
buf[i++] = ' ';
-
- /* Append some more spaces */
- while (0 != (i % 8)) buf[i++] = ' ';
+ while (0 != (i % 8))
+ buf[i++] = ' ';
}
-
#ifdef JP
else if (iskanji(*s))
{
buf[i++] = *s++;
buf[i++] = *s;
}
-
- /* 半角かなに対応 */
else if (iskana(*s))
{
+ /* 半角かなに対応 */
buf[i++] = *s;
if (i >= n) break;
}
#endif
- /* Handle printables */
else if (isprint((unsigned char)*s))
{
- /* Copy */
buf[i++] = *s;
-
- /* Check length */
if (i >= n) break;
}
}
- /* No newline character, but terminate */
- buf[i] = '\0';
- /* Success */
+ buf[i] = '\0';
return 0;
}
- /* Nothing */
buf[0] = '\0';
-
- /* Failure */
return 1;
}
*/
errr my_fputs(FILE *fff, concptr buf, huge n)
{
- /* XXX XXX */
n = n ? n : 0;
-
- /* Dump, ignore errors */
(void)fprintf(fff, "%s\n", buf);
-
- /* Success */
return 0;
}
#endif /* O_BINARY */
- /*
- * Hack -- attempt to delete a file
- */
+/*
+ * Hack -- attempt to delete a file
+ */
errr fd_kill(concptr file)
{
char buf[1024];
-
- /* Hack -- Try to parse the path */
if (path_parse(buf, 1024, file)) return -1;
- /* Remove */
(void)remove(buf);
-
return 0;
}
{
char buf[1024];
char aux[1024];
-
- /* Hack -- Try to parse the path */
if (path_parse(buf, 1024, file)) return -1;
-
- /* Hack -- Try to parse the path */
if (path_parse(aux, 1024, what)) return -1;
- /* Rename */
(void)rename(buf, aux);
-
return 0;
}
int read_num;
int src_fd, dst_fd;
- /* Hack -- Try to parse the path */
if (path_parse(buf, 1024, file)) return -1;
-
- /* Hack -- Try to parse the path */
if (path_parse(aux, 1024, what)) return -1;
- /* Open source file */
src_fd = fd_open(buf, O_RDONLY);
if (src_fd < 0) return -1;
- /* Open destination file */
dst_fd = fd_open(aux, O_WRONLY | O_TRUNC | O_CREAT);
if (dst_fd < 0) return -1;
- /* Copy */
while ((read_num = read(src_fd, buf, 1024)) > 0)
{
int write_num = 0;
while (write_num < read_num)
{
int ret = write(dst_fd, buf + write_num, read_num - write_num);
- if (ret < 0) {
- /* Close files */
+ if (ret < 0)
+ {
fd_close(src_fd);
fd_close(dst_fd);
return ret;
}
+
write_num += ret;
}
}
- /* Close files */
fd_close(src_fd);
fd_close(dst_fd);
-
return 0;
}
+
/*
* Hack -- attempt to open a file descriptor (create file)
* This function should fail if the file already exists
int fd_make(concptr file, BIT_FLAGS mode)
{
char buf[1024];
-
- /* Hack -- Try to parse the path */
if (path_parse(buf, 1024, file)) return -1;
#if defined(MACH_O_CARBON)
{
int fdes;
- /* Create the file, fail if exists, write-only, binary */
fdes = open(buf, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, mode);
- /* Set creator and type if the file is successfully opened */
if (fdes >= 0) fsetfileinfo(buf, _fcreator, _ftype);
- /* Return the descriptor */
return (fdes);
}
+
#else
- /* Create the file, fail if exists, write-only, binary */
return (open(buf, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, mode));
#endif
-
}
int fd_open(concptr file, int flags)
{
char buf[1024];
-
- /* Hack -- Try to parse the path */
if (path_parse(buf, 1024, file)) return -1;
- /* Attempt to open the file */
return (open(buf, flags | O_BINARY, 0));
}
*/
errr fd_lock(int fd, int what)
{
- /* XXX XXX */
what = what ? what : 0;
-
- /* Verify the fd */
if (fd < 0) return -1;
#if defined(SET_UID) && defined(LOCK_UN) && defined(LOCK_EX)
- /* Un-Lock */
if (what == F_UNLCK)
{
- /* Unlock it, Ignore errors */
(void)flock(fd, LOCK_UN);
}
-
- /* Lock */
else
{
- /* Lock the score file */
if (flock(fd, LOCK_EX) != 0) return 1;
}
#endif
- /* Success */
return 0;
}
*/
errr fd_seek(int fd, huge n)
{
- huge p;
-
- /* Verify fd */
if (fd < 0) return -1;
- /* Seek to the given position */
- p = lseek(fd, n, SEEK_SET);
-
- /* Failure */
+ huge p = lseek(fd, n, SEEK_SET);
if (p != n) return 1;
- /* Success */
return 0;
}
*/
errr fd_chop(int fd, huge n)
{
- /* XXX XXX */
n = n ? n : 0;
-
- /* Verify the fd */
if (fd < 0) return -1;
#if defined(NeXT)
- /* Truncate */
ftruncate(fd, n);
#endif
-
- /* Success */
return 0;
}
*/
errr fd_read(int fd, char *buf, huge n)
{
- /* Verify the fd */
if (fd < 0) return -1;
-
#ifndef SET_UID
-
- /* Read pieces */
while (n >= 16384)
{
- /* Read a piece */
if (read(fd, buf, 16384) != 16384) return 1;
- /* Shorten the task */
buf += 16384;
-
- /* Shorten the task */
n -= 16384;
}
-
#endif
- /* Read the final piece */
if (read(fd, buf, n) != (int)n) return 1;
- /* Success */
return 0;
}
*/
errr fd_write(int fd, concptr buf, huge n)
{
- /* Verify the fd */
if (fd < 0) return -1;
#ifndef SET_UID
-
- /* Write pieces */
while (n >= 16384)
{
- /* Write a piece */
if (write(fd, buf, 16384) != 16384) return 1;
- /* Shorten the task */
buf += 16384;
-
- /* Shorten the task */
n -= 16384;
}
-
#endif
- /* Write the final piece */
if (write(fd, buf, n) != (int)n) return 1;
- /* Success */
return 0;
}
*/
errr fd_close(int fd)
{
- /* Verify the fd */
if (fd < 0) return -1;
- /* Close */
(void)close(fd);
-
return 0;
}
}
-
/*
* Convert a decimal to a single digit octal number
*/
return (hexsym[i % 8]);
}
+
/*
* Convert a decimal to a single digit hex number
*/
return 0;
}
+
/*
* Convert a hexidecimal-digit into a decimal
*/
static int my_stricmp(concptr a, concptr b)
{
- concptr s1, s2;
- char z1, z2;
-
- /* Scan the strings */
- for (s1 = a, s2 = b; TRUE; s1++, s2++)
+ for (concptr s1 = a, s2 = b; TRUE; s1++, s2++)
{
- z1 = FORCEUPPER(*s1);
- z2 = FORCEUPPER(*s2);
+ char z1 = FORCEUPPER(*s1);
+ char z2 = FORCEUPPER(*s2);
if (z1 < z2) return -1;
if (z1 > z2) return 1;
if (!z1) return 0;
static int my_strnicmp(concptr a, concptr b, int n)
{
- concptr s1, s2;
- char z1, z2;
-
- /* Scan the strings */
- for (s1 = a, s2 = b; n > 0; s1++, s2++, n--)
+ for (concptr s1 = a, s2 = b; n > 0; s1++, s2++, n--)
{
- z1 = FORCEUPPER(*s1);
- z2 = FORCEUPPER(*s2);
+ char z1 = FORCEUPPER(*s1);
+ char z2 = FORCEUPPER(*s2);
if (z1 < z2) return -1;
if (z1 > z2) return 1;
if (!z1) return 0;
}
+
return 0;
}
if (!my_strnicmp(str, macro_modifier_name[i], len))
break;
}
+
if (!macro_modifier_chr[i]) break;
str += len;
mod_status[i] = TRUE;
if ('S' == macro_modifier_chr[i])
shiftstatus = 1;
}
+
for (i = 0; i < max_macrotrigger; i++)
{
len = strlen(macro_trigger_name[i]);
if (!my_strnicmp(str, macro_trigger_name[i], len) && ']' == str[len])
{
- /* a trigger name found */
break;
}
}
- /* Invalid trigger name? */
if (i == max_macrotrigger)
{
str = my_strchr(str, ']');
*bufptr = s;
*strptr = str; /* where **strptr == ']' */
}
+
return;
}
+
key_code = macro_trigger_keycode[shiftstatus][i];
str += len;
for (i = 0; macro_template[i]; i++)
{
char ch = macro_template[i];
- int j;
-
switch (ch)
{
case '&':
- for (j = 0; macro_modifier_chr[j]; j++) {
+ for (int j = 0; macro_modifier_chr[j]; j++)
+ {
if (mod_status[j])
*s++ = macro_modifier_chr[j];
}
+
break;
case '#':
strcpy(s, key_code);
break;
}
}
+
*s++ = '\r';
*bufptr = s;
void text_to_ascii(char *buf, concptr str)
{
char *s = buf;
-
- /* Analyze the "ascii" string */
while (*str)
{
- /* Backslash codes */
if (*str == '\\')
{
- /* Skip the backslash */
str++;
if (!(*str)) break;
- /* Macro Trigger */
if (*str == '[')
{
trigger_text_to_ascii(&s, &str);
}
else
-
- /* Hex-mode XXX */
+ {
if (*str == 'x')
{
*s = 16 * (char)dehex(*++str);
*s++ += (char)dehex(*++str);
}
-
- /* Hack -- simple way to specify "backslash" */
else if (*str == '\\')
{
*s++ = '\\';
}
-
- /* Hack -- simple way to specify "caret" */
else if (*str == '^')
{
*s++ = '^';
}
-
- /* Hack -- simple way to specify "space" */
else if (*str == 's')
{
*s++ = ' ';
}
-
- /* Hack -- simple way to specify Escape */
else if (*str == 'e')
{
*s++ = ESCAPE;
}
-
- /* Backspace */
else if (*str == 'b')
{
*s++ = '\b';
}
-
- /* Newline */
else if (*str == 'n')
{
*s++ = '\n';
}
-
- /* Return */
else if (*str == 'r')
{
*s++ = '\r';
}
-
- /* Tab */
else if (*str == 't')
{
*s++ = '\t';
}
-
- /* Octal-mode */
else if (*str == '0')
{
*s = 8 * (char)deoct(*++str);
*s++ += (char)deoct(*++str);
}
-
- /* Octal-mode */
else if (*str == '1')
{
*s = 64 + 8 * (char)deoct(*++str);
*s++ += (char)deoct(*++str);
}
-
- /* Octal-mode */
else if (*str == '2')
{
*s = 64 * 2 + 8 * (char)deoct(*++str);
*s++ += (char)deoct(*++str);
}
-
- /* Octal-mode */
else if (*str == '3')
{
*s = 64 * 3 + 8 * (char)deoct(*++str);
*s++ += (char)deoct(*++str);
}
+ }
- /* Skip the final char */
str++;
}
-
- /* Normal Control codes */
else if (*str == '^')
{
str++;
*s++ = (*str++ & 037);
}
-
- /* Normal chars */
else
{
*s++ = *str++;
}
}
- /* Terminate */
*s = '\0';
}
concptr str = *strptr;
char key_code[100];
int i;
- concptr tmp;
-
if (macro_template == NULL)
return FALSE;
*s++ = '\\';
*s++ = '[';
+ concptr tmp;
for (i = 0; macro_template[i]; i++)
{
- int j;
char ch = macro_template[i];
switch (ch)
case '&':
while ((tmp = my_strchr(macro_modifier_chr, *str)) != 0)
{
- j = (int)(tmp - macro_modifier_chr);
+ int j = (int)(tmp - macro_modifier_chr);
tmp = macro_modifier_name[j];
while (*tmp) *s++ = *tmp++;
str++;
}
+
break;
case '#':
+ {
+ int j;
for (j = 0; *str && *str != '\r'; j++)
key_code[j] = *str++;
key_code[j] = '\0';
break;
+ }
default:
if (ch != *str) return FALSE;
str++;
}
}
+
if (*str++ != '\r') return FALSE;
for (i = 0; i < max_macrotrigger; i++)
|| !my_stricmp(key_code, macro_trigger_keycode[1][i]))
break;
}
+
if (i == max_macrotrigger)
return FALSE;
void ascii_to_text(char *buf, concptr str)
{
char *s = buf;
-
- /* Analyze the "ascii" string */
while (*str)
{
byte i = (byte)(*str++);
-
- /* Macro Trigger */
if (i == 31)
{
if (!trigger_ascii_to_text(&s, &str))
}
}
else
-
+ {
if (i == ESCAPE)
{
*s++ = '\\';
*s++ = hexify(i / 16);
*s++ = hexify(i % 16);
}
+ }
}
- /* Terminate */
*s = '\0';
}
-
-/*
- * The "macro" package
- *
- * Functions are provided to manipulate a collection of macros, each
- * of which has a trigger pattern string and a resulting action string
- * and a small set of flags.
- */
-
-
-
/*
* Determine if any macros have ever started with a given character.
*/
*/
sint macro_find_exact(concptr pat)
{
- int i;
-
- /* Nothing possible */
if (!macro__use[(byte)(pat[0])])
{
return -1;
}
- /* Scan the macros */
- for (i = 0; i < macro__num; ++i)
+ for (int i = 0; i < macro__num; ++i)
{
- /* Skip macros which do not match the pattern */
if (!streq(macro__pat[i], pat)) continue;
- /* Found one */
return (i);
}
- /* No matches */
return -1;
}
*/
static sint macro_find_check(concptr pat)
{
- int i;
-
- /* Nothing possible */
if (!macro__use[(byte)(pat[0])])
{
return -1;
}
- /* Scan the macros */
- for (i = 0; i < macro__num; ++i)
+ for (int i = 0; i < macro__num; ++i)
{
- /* Skip macros which do not contain the pattern */
if (!prefix(macro__pat[i], pat)) continue;
- /* Found one */
return (i);
}
- /* Nothing */
return -1;
}
*/
static sint macro_find_maybe(concptr pat)
{
- int i;
-
- /* Nothing possible */
if (!macro__use[(byte)(pat[0])])
{
return -1;
}
- /* Scan the macros */
- for (i = 0; i < macro__num; ++i)
+ for (int i = 0; i < macro__num; ++i)
{
- /* Skip macros which do not contain the pattern */
if (!prefix(macro__pat[i], pat)) continue;
-
- /* Skip macros which exactly match the pattern XXX XXX */
if (streq(macro__pat[i], pat)) continue;
- /* Found one */
return (i);
}
- /* Nothing */
return -1;
}
*/
static sint macro_find_ready(concptr pat)
{
- int i, t, n = -1, s = -1;
+ int t, n = -1, s = -1;
- /* Nothing possible */
if (!macro__use[(byte)(pat[0])])
{
return -1;
}
- /* Scan the macros */
- for (i = 0; i < macro__num; ++i)
+ for (int i = 0; i < macro__num; ++i)
{
- /* Skip macros which are not contained by the pattern */
if (!prefix(pat, macro__pat[i])) continue;
- /* Obtain the length of this macro */
t = strlen(macro__pat[i]);
-
- /* Only track the "longest" pattern */
if ((n >= 0) && (s > t)) continue;
- /* Track the entry */
n = i;
s = t;
}
+
return (n);
}
*/
errr macro_add(concptr pat, concptr act)
{
- int n;
-
-
- /* Paranoia -- require data */
if (!pat || !act) return -1;
-
- /* Look for any existing macro */
- n = macro_find_exact(pat);
-
- /* Replace existing macro */
+ int n = macro_find_exact(pat);
if (n >= 0)
{
- /* Free the old macro action */
string_free(macro__act[n]);
}
-
- /* Create a new macro */
else
{
- /* Acquire a new index */
n = macro__num++;
-
- /* Save the pattern */
macro__pat[n] = string_make(pat);
}
- /* Save the action */
macro__act[n] = string_make(act);
-
- /* Efficiency */
macro__use[(byte)(pat[0])] = TRUE;
-
- /* Success */
return 0;
}
-
/*
* Local variable -- we are inside a "macro action"
*
*/
static bool parse_under = FALSE;
-
/*
* Flush all input chars. Actually, remember the flush,
* and do a "special flush" before the next "inkey()".
*/
void flush(void)
{
- /* Do it later */
inkey_xtra = TRUE;
}
*/
void bell(void)
{
- /* Mega-Hack -- Flush the output */
Term_fresh();
-
- /* Make a bell noise (if allowed) */
if (ring_bell) Term_xtra(TERM_XTRA_NOISE, 0);
- /* Flush the input (later!) */
flush();
}
*/
void sound(int val)
{
- /* No sound */
if (!use_sound) return;
- /* Make a sound (if allowed) */
Term_xtra(TERM_XTRA_SOUND, val);
}
+
/*
* Hack -- Play a music
*/
errr play_music(int type, int val)
{
- /* No sound */
if (!use_music) return 1;
- /* Make a sound (if allowed) */
return Term_xtra(type, val);
}
+
/*
* Hack -- Select floor music.
*/
static char inkey_aux(void)
{
int k = 0, n, p = 0, w = 0;
-
char ch;
-
- concptr pat, act;
-
char *buf = inkey_macro_trigger_string;
- /* Hack : キー入力待ちで止まっているので、流れた行の記憶は不要。 */
num_more = 0;
if (parse_macro)
{
- /* Scan next keypress from macro action */
if (Term_inkey(&ch, FALSE, TRUE))
{
- /* Over-flowed? Cancel macro action */
parse_macro = FALSE;
}
}
else
{
- /* Wait for a keypress */
(void)(Term_inkey(&ch, TRUE, TRUE));
}
-
- /* End "macro action" */
if (ch == 30) parse_macro = FALSE;
- /* Inside "macro action" */
if (ch == 30) return (ch);
-
- /* Inside "macro action" */
if (parse_macro) return (ch);
-
- /* Inside "macro trigger" */
if (parse_under) return (ch);
- /* Save the first key, advance */
buf[p++] = ch;
buf[p] = '\0';
-
-
- /* Check for possible macro */
k = macro_find_check(buf);
-
- /* No macro pending */
if (k < 0) return (ch);
-
- /* Wait for a macro, or a timeout */
while (TRUE)
{
- /* Check for pending macro */
k = macro_find_maybe(buf);
- /* No macro pending */
if (k < 0) break;
- /* Check for (and remove) a pending key */
if (0 == Term_inkey(&ch, FALSE, TRUE))
{
- /* Append the key */
buf[p++] = ch;
buf[p] = '\0';
-
- /* Restart wait */
w = 0;
}
-
- /* No key ready */
else
{
- /* Increase "wait" */
w += 1;
-
- /* Excessive delay */
if (w >= 10) break;
Term_xtra(TERM_XTRA_DELAY, w);
}
}
-
- /* Check for available macro */
k = macro_find_ready(buf);
-
- /* No macro available */
if (k < 0)
{
- /* Push all the keys back on the queue */
while (p > 0)
{
- /* Push the key, notice over-flow */
if (Term_key_push(buf[--p])) return 0;
}
- /* Wait for (and remove) a pending key */
(void)Term_inkey(&ch, TRUE, TRUE);
-
- /* Return the key */
return (ch);
}
-
- /* Get the pattern */
- pat = macro__pat[k];
-
- /* Get the length of the pattern */
+ concptr pat = macro__pat[k];
n = strlen(pat);
-
- /* Push the "extra" keys back on the queue */
while (p > n)
{
- /* Push the key, notice over-flow */
if (Term_key_push(buf[--p])) return 0;
}
-
- /* Begin "macro action" */
parse_macro = TRUE;
-
- /* Push the "end of macro action" key */
if (Term_key_push(30)) return 0;
+ concptr act = macro__act[k];
- /* Access the macro action */
- act = macro__act[k];
-
- /* Get the length of the action */
n = strlen(act);
-
- /* Push the macro "action" onto the key queue */
while (n > 0)
{
- /* Push the key, notice over-flow */
if (Term_key_push(act[--n])) return 0;
}
-
- /* Hack -- Force "inkey()" to call us again */
return 0;
}
{
if (!parse_macro) return;
- /* Drop following macro action string */
while (TRUE)
{
char ch;
-
- /* End loop if no key ready */
if (Term_inkey(&ch, FALSE, TRUE)) break;
-
- /* End loop if no key ready */
if (ch == 0) break;
-
- /* End of "macro action" */
if (ch == 30) break;
}
- /* No longer inside "macro action" */
parse_macro = FALSE;
}
*/
char inkey(void)
{
- int v;
- char kk;
char ch = 0;
bool done = FALSE;
term *old = Term;
- /* Hack -- Use the "inkey_next" pointer */
if (inkey_next && *inkey_next && !inkey_xtra)
{
- /* Get next character, and advance */
ch = *inkey_next++;
-
- /* Cancel the various "global parameters" */
inkey_base = inkey_xtra = inkey_flag = inkey_scan = FALSE;
-
- /* Accept result */
return (ch);
}
- /* Forget pointer */
inkey_next = NULL;
-
- /* Hack -- handle delayed "flush()" */
if (inkey_xtra)
{
- /* End "macro action" */
parse_macro = FALSE;
-
- /* End "macro trigger" */
parse_under = FALSE;
-
- /* Forget old keypresses */
Term_flush();
}
-
- /* Access cursor state */
+ int v;
(void)Term_get_cursor(&v);
/* Show the cursor if waiting, except sometimes in "command" mode */
if (!inkey_scan && (!inkey_flag || hilite_player || current_world_ptr->character_icky))
{
- /* Show the cursor */
(void)Term_set_cursor(1);
}
-
- /* Hack -- Activate main screen */
Term_activate(angband_term[0]);
-
-
- /* Get a key */
+ char kk;
while (!ch)
{
- /* Hack -- Handle "inkey_scan" */
if (!inkey_base && inkey_scan &&
(0 != Term_inkey(&kk, FALSE, FALSE)))
{
break;
}
-
- /* Hack -- Flush output once when no key ready */
if (!done && (0 != Term_inkey(&kk, FALSE, FALSE)))
{
- /* Hack -- activate proper term */
Term_activate(old);
-
- /* Flush output */
Term_fresh();
-
- /* Hack -- activate main screen */
Term_activate(angband_term[0]);
-
- /* Mega-Hack -- reset saved flag */
current_world_ptr->character_saved = FALSE;
- /* Mega-Hack -- reset signal counter */
signal_count = 0;
-
- /* Only once */
done = TRUE;
}
-
- /* Hack -- Handle "inkey_base" */
if (inkey_base)
{
int w = 0;
-
- /* Wait forever */
if (!inkey_scan)
{
- /* Wait for (and remove) a pending key */
if (0 == Term_inkey(&ch, TRUE, TRUE))
{
break;
break;
}
- /* Wait */
while (TRUE)
{
- /* Check for (and remove) a pending key */
if (0 == Term_inkey(&ch, FALSE, TRUE))
{
break;
}
-
- /* No key ready */
else
{
- /* Increase "wait" */
w += 10;
-
- /* Excessive delay */
if (w >= 100) break;
Term_xtra(TERM_XTRA_DELAY, w);
break;
}
-
- /* Get a key (see above) */
ch = inkey_aux();
-
-
- /* Handle "control-right-bracket" */
if (ch == 29)
{
- /* Strip this key */
ch = 0;
continue;
}
-
- /* Treat back-quote as escape */
-/* if (ch == '`') ch = ESCAPE; */
-
-
- /* End "macro trigger" */
if (parse_under && (ch <= 32))
{
- /* Strip this key */
ch = 0;
-
- /* End "macro trigger" */
parse_under = FALSE;
}
-
- /* Handle "control-caret" */
if (ch == 30)
{
- /* Strip this key */
ch = 0;
}
-
- /* Handle "control-underscore" */
else if (ch == 31)
{
- /* Strip this key */
ch = 0;
-
- /* Begin "macro trigger" */
parse_under = TRUE;
}
-
- /* Inside "macro trigger" */
else if (parse_under)
{
- /* Strip this key */
ch = 0;
}
}
-
- /* Hack -- restore the term */
Term_activate(old);
-
-
- /* Restore the cursor */
Term_set_cursor(v);
-
-
- /* Cancel the various "global parameters" */
inkey_base = inkey_xtra = inkey_flag = inkey_scan = FALSE;
-
- /* Return the keypress */
return (ch);
}
-
-
-/*
- * We use a global array for all inscriptions to reduce the memory
- * spent maintaining inscriptions. Of course, it is still possible
- * to run out of inscription memory, especially if too many different
- * inscriptions are used, but hopefully this will be rare.
- *
- * We use dynamic string allocation because otherwise it is necessary
- * to pre-guess the amount of quark activity. We limit the total
- * number of quarks, but this is much easier to "expand" as needed.
- *
- * Any two items with the same inscription will have the same "quark"
- * index, which should greatly reduce the need for inscription space.
- *
- * Note that "quark zero" is NULL and should not be "dereferenced".
- */
-
/*
* Initialize the quark array
*/
void quark_init(void)
{
- /* Quark variables */
C_MAKE(quark__str, QUARK_MAX, concptr);
-
- /* Prepare first quark, which is used when quark_add() is failed */
quark__str[1] = string_make("");
-
- /* There is one quark (+ NULL) */
quark__num = 2;
}
u16b quark_add(concptr str)
{
u16b i;
-
- /* Look for an existing quark */
for (i = 1; i < quark__num; i++)
{
- /* Check for equality */
if (streq(quark__str[i], str)) return (i);
}
- /* Return "" when no room is available */
if (quark__num == QUARK_MAX) return 1;
- /* New maximal quark */
quark__num = i + 1;
-
- /* Add a new quark */
quark__str[i] = string_make(str);
-
- /* Return the index */
return (i);
}
}
-
-
-/*
- * Second try for the "message" handling routines.
- *
- * Each call to "message_add(s)" will add a new "most recent" message
- * to the "message recall list", using the contents of the string "s".
- *
- * The messages will be stored in such a way as to maximize "efficiency",
- * that is, we attempt to maximize the number of sequential messages that
- * can be retrieved, given a limited amount of storage space.
- *
- * We keep a buffer of chars to hold the "text" of the messages, not
- * necessarily in "order", and an array of offsets into that buffer,
- * representing the actual messages. This is made more complicated
- * by the fact that both the array of indexes, and the buffer itself,
- * are both treated as "circular arrays" for efficiency purposes, but
- * the strings may not be "broken" across the ends of the array.
- *
- * The "message_add()" function is rather "complex", because it must be
- * extremely efficient, both in space and time, for use with the Borg.
- */
-
-
-
/*!
* @brief 保存中の過去ゲームメッセージの数を返す。 / How many messages are "available"?
* @return 残っているメッセージの数
*/
s32b message_num(void)
{
- int last, next, n;
-
- /* Extract the indexes */
- last = message__last;
- next = message__next;
+ int n;
+ int last = message__last;
+ int next = message__next;
- /* Handle "wrap" */
if (next < last) next += MESSAGE_MAX;
- /* Extract the space */
n = (next - last);
-
- /* Return the result */
return (n);
}
*/
concptr message_str(int age)
{
- s32b x;
- s32b o;
- concptr s;
-
- /* Forgotten messages have no text */
if ((age < 0) || (age >= message_num())) return ("");
- /* Acquire the "logical" index */
- x = (message__next + MESSAGE_MAX - (age + 1)) % MESSAGE_MAX;
-
- /* Get the "offset" for the message */
- o = message__ptr[x];
-
- /* Access the message text */
- s = &message__buf[o];
-
- /* Return the message text */
+ s32b x = (message__next + MESSAGE_MAX - (age + 1)) % MESSAGE_MAX;
+ s32b o = message__ptr[x];
+ concptr s = &message__buf[o];
return (s);
}
*/
void message_add(concptr str)
{
- u32b i, n;
- int k, x, m;
-
+ u32b i;
+ int x, m;
char u[4096];
char splitted1[81];
concptr splitted2;
- /*** Step 1 -- Analyze the message ***/
-
- /* Hack -- Ignore "non-messages" */
if (!str) return;
- /* Message length */
- n = strlen(str);
-
- /* Important Hack -- Ignore "long" messages */
+ u32b n = strlen(str);
if (n >= MESSAGE_BUF / 4) return;
- /* extra step -- split the message if n>80.(added by Mogami) */
- if (n > 80) {
+ if (n > 80)
+ {
#ifdef JP
concptr t = str;
-
for (n = 0; n < 80; n++, t++)
{
if (iskanji(*t)) {
n++;
}
}
- if (n == 81) n = 79; /* 最後の文字が漢字半分 */
+
+ /* 最後の文字が漢字半分 */
+ if (n == 81) n = 79;
#else
for (n = 80; n > 60; n--)
if (str[n] == ' ') break;
splitted1[n] = '\0';
str = splitted1;
}
- else {
+ else
+ {
splitted2 = NULL;
}
- /*** Step 2 -- 最適化の試行 / Attempt to optimize ***/
-
- /* Limit number of messages to check */
m = message_num();
- k = m / 4;
+ int k = m / 4;
if (k > MESSAGE_MAX / 32) k = MESSAGE_MAX / 32;
-
- /* Check previous message */
for (i = message__next; m; m--)
{
int j = 1;
-
char buf[1024];
char *t;
-
concptr old;
-
- /* Back up and wrap if needed */
if (i-- == 0) i = MESSAGE_MAX - 1;
- /* Access the old string */
old = &message__buf[message__ptr[i]];
-
- /* Skip small messages */
if (!old) continue;
strcpy(buf, old);
-
- /* Find multiple */
#ifdef JP
for (t = buf; *t && (*t != '<' || (*(t + 1) != 'x')); t++)
if (iskanji(*t))t++;
#else
for (t = buf; *t && (*t != '<'); t++);
#endif
-
if (*t)
{
- /* Message is too small */
if (strlen(buf) < A_MAX) break;
- /* Drop the space */
*(t - 1) = '\0';
-
- /* Get multiplier */
j = atoi(t + 2);
}
- /* Limit the multiplier to 1000 */
if (streq(buf, str) && (j < 1000))
{
j++;
-
- /* Overwrite */
message__next = i;
-
str = u;
-
- /* Write it out */
sprintf(u, "%s <x%d>", buf, j);
-
- /* Message length */
n = strlen(str);
-
if (!now_message) now_message++;
}
else
{
- num_more++;/*流れた行の数を数えておく */
+ /*流れた行の数を数えておく */
+ num_more++;
now_message++;
}
break;
}
- /* Check the last few messages (if any to count) */
for (i = message__next; k; k--)
{
int q;
concptr old;
- /* Back up and wrap if needed */
if (i-- == 0) i = MESSAGE_MAX - 1;
- /* Stop before oldest message */
if (i == message__last) break;
- /* Extract "distance" from "head" */
q = (message__head + MESSAGE_BUF - message__ptr[i]) % MESSAGE_BUF;
- /* Do not optimize over large distance */
if (q > MESSAGE_BUF / 2) continue;
- /* Access the old string */
old = &message__buf[message__ptr[i]];
-
- /* Compare */
if (!streq(old, str)) continue;
- /* Get the next message index, advance */
x = message__next++;
-
- /* Handle wrap */
if (message__next == MESSAGE_MAX) message__next = 0;
-
- /* Kill last message if needed */
if (message__next == message__last) message__last++;
-
- /* Handle wrap */
if (message__last == MESSAGE_MAX) message__last = 0;
- /* Assign the starting address */
message__ptr[x] = message__ptr[i];
- /* Success */
- /* return; */
goto end_of_message_add;
-
}
-
- /*** Step 3 -- Ensure space before end of buffer ***/
-
- /* Kill messages and Wrap if needed */
if (message__head + n + 1 >= MESSAGE_BUF)
{
- /* Kill all "dead" messages */
for (i = message__last; TRUE; i++)
{
- /* Wrap if needed */
if (i == MESSAGE_MAX) i = 0;
-
- /* Stop before the new message */
if (i == message__next) break;
-
- /* Kill "dead" messages */
if (message__ptr[i] >= message__head)
{
- /* Track oldest message */
message__last = i + 1;
}
}
- /* Wrap "tail" if needed */
if (message__tail >= message__head) message__tail = 0;
- /* Start over */
message__head = 0;
}
-
- /*** Step 4 -- Ensure space before next message ***/
-
- /* Kill messages if needed */
if (message__head + n + 1 > message__tail)
{
- /* Grab new "tail" */
message__tail = message__head + n + 1;
-
- /* Advance tail while possible past first "nul" */
while (message__buf[message__tail - 1]) message__tail++;
- /* Kill all "dead" messages */
for (i = message__last; TRUE; i++)
{
- /* Wrap if needed */
if (i == MESSAGE_MAX) i = 0;
-
- /* Stop before the new message */
if (i == message__next) break;
-
- /* Kill "dead" messages */
if ((message__ptr[i] >= message__head) &&
(message__ptr[i] < message__tail))
{
- /* Track oldest message */
message__last = i + 1;
}
}
}
- /*** Step 5 -- Grab a new message index ***/
-
- /* Get the next message index, advance */
x = message__next++;
-
- /* Handle wrap */
if (message__next == MESSAGE_MAX) message__next = 0;
-
- /* Kill last message if needed */
if (message__next == message__last) message__last++;
+ if (message__last == MESSAGE_MAX) message__last = 0;
- /* Handle wrap */
- if (message__last == MESSAGE_MAX) message__last = 0;
-
-
-
- /*** Step 6 -- Insert the message text ***/
-
- /* Assign the starting address */
message__ptr[x] = message__head;
-
- /* Append the new part of the message */
for (i = 0; i < n; i++)
{
- /* Copy the message */
message__buf[message__head + i] = str[i];
}
- /* Terminate */
message__buf[message__head + i] = '\0';
-
- /* Advance the "head" pointer */
message__head += n + 1;
- /* recursively add splitted message (added by Mogami) */
end_of_message_add:
if (splitted2 != NULL)
message_add(splitted2);
}
-
/*
* Hack -- flush
*/
{
byte a = TERM_L_BLUE;
bool nagasu = FALSE;
-
if ((auto_more && !player_ptr->now_damaged) || num_more < 0) {
int i;
for (i = 0; i < 8; i++)
}
player_ptr->now_damaged = FALSE;
-
if (!player_ptr->playing || !nagasu)
{
- /* Pause for response */
Term_putstr(x, 0, -1, a, _("-続く-", "-more-"));
-
- /* Get an acceptable keypress */
while (TRUE)
{
int cmd = inkey();
- if (cmd == ESCAPE) {
- num_more = -9999; /*auto_moreのとき、全て流す。 */
+ if (cmd == ESCAPE)
+ {
+ /* auto_moreのとき、全て流す */
+ num_more = -9999;
break;
}
- else if (cmd == ' ') {
- num_more = 0; /*1画面だけ流す。 */
+ else if (cmd == ' ')
+ {
+ /* 1画面だけ流す */
+ num_more = 0;
break;
}
- else if ((cmd == '\n') || (cmd == '\r')) {
- num_more--; /*1行だけ流す。 */
+ else if ((cmd == '\n') || (cmd == '\r'))
+ {
+ /* 1行だけ流す */
+ num_more--;
break;
}
+
if (quick_messages) break;
bell();
}
}
- /* Clear the line */
Term_erase(0, 0, 255);
}
/*
+ * todo ここのp_ptrを削除するのは破滅的に作業が増えるので保留
* Output a message to the top line of the screen.
*
* Break long messages into multiple pieces (40-72 chars).
void msg_print(concptr msg)
{
static int p = 0;
- int n;
char *t;
char buf[1024];
if (current_world_ptr->timewalk_m_idx) return;
- /* Hack -- Reset */
- if (!msg_flag) {
- /* Clear the line */
+ if (!msg_flag)
+ {
Term_erase(0, 0, 255);
p = 0;
}
- /* Original Message Length */
- n = (msg ? strlen(msg) : 0);
-
- /* Hack -- flush when requested or needed */
+ int n = (msg ? strlen(msg) : 0);
if (p && (!msg || ((p + n) > 72)))
{
msg_flush(p_ptr, p);
-
- /* Forget it */
msg_flag = FALSE;
-
- /* Reset */
p = 0;
}
- /* No message */
if (!msg) return;
if (n > 1000) return;
- /* Copy it */
if (!cheat_turn)
{
strcpy(buf, msg);
sprintf(buf, ("T:%d - %s"), (int)current_world_ptr->game_turn, msg);
}
- /* New Message Length */
n = strlen(buf);
-
- /* Memorize the message */
if (current_world_ptr->character_generated) message_add(buf);
- /* Analyze the buffer */
t = buf;
-
- /* Split message */
while (n > 72)
{
- char oops;
int check, split = 72;
-
#ifdef JP
bool k_flag = FALSE;
int wordlen = 0;
-
- /* Find the "best" split point */
for (check = 0; check < 72; check++)
{
if (k_flag)
continue;
}
- /* Found a valid split point */
if (iskanji(t[check]))
{
k_flag = TRUE;
split = check;
}
}
+
#else
- /* Find the "best" split point */
for (check = 40; check < 72; check++)
{
- /* Found a valid split point */
if (t[check] == ' ') split = check;
}
#endif
- /* Save the split character */
- oops = t[split];
-
- /* Split the message */
+ char oops = t[split];
t[split] = '\0';
-
- /* Display part of the message */
Term_putstr(0, 0, split, TERM_WHITE, t);
-
- /* Flush it */
msg_flush(p_ptr, split + 1);
-
- /* Memorize the piece */
- /* if (current_world_ptr->character_generated) message_add(t); */
-
- /* Restore the split character */
t[split] = oops;
-
- /* Insert a space */
t[--split] = ' ';
-
- /* Prepare to recurse on the rest of "buf" */
t += split; n -= split;
}
- /* Display the tail of the message */
Term_putstr(p, 0, n, TERM_WHITE, t);
-
- /* Memorize the tail */
- /* if (current_world_ptr->character_generated) message_add(t); */
-
p_ptr->window |= (PW_MESSAGE);
update_output(p_ptr);
- /* Remember the message */
msg_flag = TRUE;
-
- /* Remember the position */
#ifdef JP
p += n;
#else
p += n + 1;
#endif
- /* Optional refresh */
if (fresh_message) Term_fresh();
}
*/
void screen_save()
{
- /* Hack -- Flush messages */
msg_print(NULL);
-
- /* Save the screen (if legal) */
if (screen_depth++ == 0) Term_save();
- /* Increase "icky" depth */
current_world_ptr->character_icky++;
}
*/
void screen_load()
{
- /* Hack -- Flush messages */
msg_print(NULL);
-
- /* Load the screen (if legal) */
if (--screen_depth == 0) Term_load();
- /* Decrease "icky" depth */
current_world_ptr->character_icky--;
}
void msg_format(concptr fmt, ...)
{
va_list vp;
-
char buf[1024];
-
- /* Begin the Varargs Stuff */
va_start(vp, fmt);
-
- /* Format the args, save the length */
(void)vstrnfmt(buf, 1024, fmt, vp);
-
- /* End the Varargs Stuff */
va_end(vp);
-
- /* Display */
msg_print(buf);
}
+
/*
* Display a formatted message, using "vstrnfmt()" and "msg_print()".
*/
va_list vp;
char buf[1024];
-
- /* Begin the Varargs Stuff */
va_start(vp, fmt);
-
- /* Format the args, save the length */
(void)vstrnfmt(buf, 1024, fmt, vp);
-
- /* End the Varargs Stuff */
va_end(vp);
-
- /* Display */
msg_print_wizard(cheat_type, buf);
}
*/
void c_put_str(TERM_COLOR attr, concptr str, TERM_LEN row, TERM_LEN col)
{
- /* Position cursor, Dump the attr/text */
Term_putstr(col, row, -1, attr, str);
}
+
/*
* As above, but in "white"
*/
void put_str(concptr str, TERM_LEN row, TERM_LEN col)
{
- /* Spawn */
Term_putstr(col, row, -1, TERM_WHITE, str);
}
-
/*
* Display a string on the screen using an attribute, and clear
* to the end of the line.
*/
void c_prt(TERM_COLOR attr, concptr str, TERM_LEN row, TERM_LEN col)
{
- /* Clear line, position cursor */
Term_erase(col, row, 255);
-
- /* Dump the attr/text */
Term_addstr(-1, attr, str);
}
+
/*
* As above, but in "white"
*/
}
-
-
/*
* Print some (colored) text to the screen at the current cursor position,
* automatically "wrapping" existing text (at spaces) when necessary to
*/
void c_roff(TERM_COLOR a, concptr str)
{
- int x, y;
-
int w, h;
-
- concptr s;
-
- /* Obtain the size */
(void)Term_get_size(&w, &h);
- /* Obtain the cursor */
+ int x, y;
(void)Term_locate(&x, &y);
- /* Hack -- No more space */
if (y == h - 1 && x > w - 3) return;
- /* Process the string */
- for (s = str; *s; s++)
+ for (concptr s = str; *s; s++)
{
char ch;
-
#ifdef JP
int k_flag = iskanji(*s);
#endif
- /* Force wrap */
if (*s == '\n')
{
- /* Wrap */
x = 0;
y++;
-
- /* No more space */
if (y == h) break;
- /* Clear line, move cursor */
Term_erase(x, y, 255);
-
break;
}
- /* Clean up the char */
#ifdef JP
ch = ((k_flag || isprint(*s)) ? *s : ' ');
#else
ch = (isprint(*s) ? *s : ' ');
#endif
-
- /* Wrap words as needed */
#ifdef JP
if ((x >= ((k_flag) ? w - 2 : w - 1)) && (ch != ' '))
#else
if ((x >= w - 1) && (ch != ' '))
#endif
-
{
int i, n = 0;
TERM_COLOR av[256];
char cv[256];
-
- /* Wrap word */
if (x < w)
#ifdef JP
{
if (!k_flag)
#endif
{
- /* Scan existing text */
for (i = w - 2; i >= 0; i--)
{
- /* Grab existing attr/char */
Term_what(i, y, &av[i], &cv[i]);
-
- /* Break on space */
if (cv[i] == ' ') break;
- /* Track current word */
n = i;
#ifdef JP
if (cv[i] == '(') break;
#endif
}
}
-
#ifdef JP
else
{
}
}
#endif
- /* Special case */
if (n == 0) n = w;
- /* Clear line */
Term_erase(n, y, 255);
-
- /* Wrap */
x = 0;
y++;
-
- /* No more space */
if (y == h) break;
- /* Clear line, move cursor */
Term_erase(x, y, 255);
-
- /* Wrap the word (if any) */
for (i = n; i < w - 1; i++)
{
#ifdef JP
if (cv[i] == '\0') break;
#endif
- /* Dump */
Term_addch(av[i], cv[i]);
-
- /* Advance (no wrap) */
if (++x > w) x = w;
}
}
- /* Dump */
#ifdef JP
Term_addch((byte)(a | 0x10), ch);
#else
Term_addch(a, ch);
#endif
-
#ifdef JP
if (k_flag)
{
Term_addch((byte)(a | 0x20), ch);
}
#endif
- /* Advance */
+
if (++x > w) x = w;
}
}
+
/*
* As above, but in "white"
*/
}
-
-
/*
* Clear part of the screen
*/
void clear_from(int row)
{
- int y;
-
- /* Erase requested rows */
- for (y = row; y < Term->hgt; y++)
+ for (int y = row; y < Term->hgt; y++)
{
- /* Erase part of the screen */
Term_erase(0, y, 255);
}
}
-
-
/*
* Get some string input at the cursor location.
* Assume the buffer is initialized to a default string.
*/
bool askfor_aux(char *buf, int len, bool numpad_cursor)
{
- int y, x;
- int pos = 0;
-
/*
* Text color
* TERM_YELLOW : Overwrite mode
*/
byte color = TERM_YELLOW;
- /* Locate the cursor position */
+ int y, x;
Term_locate(&x, &y);
-
- /* Paranoia -- check len */
if (len < 1) len = 1;
-
- /* Paranoia -- check column */
if ((x < 0) || (x >= 80)) x = 0;
-
- /* Restrict the length */
if (x + len > 80) len = 80 - x;
- /* Paranoia -- Clip the default entry */
buf[len] = '\0';
-
- /* Process input */
+ int pos = 0;
while (TRUE)
{
- int skey;
-
- /* Display the string */
Term_erase(x, y, len);
Term_putstr(x, y, -1, color, buf);
- /* Place cursor */
Term_gotoxy(x + pos, y);
+ int skey = inkey_special(numpad_cursor);
- /* Get a special key code */
- skey = inkey_special(numpad_cursor);
-
- /* Analyze the key */
switch (skey)
{
case SKEY_LEFT:
case KTRL('b'):
{
int i = 0;
-
- /* Now on insert mode */
color = TERM_WHITE;
- /* No move at beginning of line */
if (0 == pos) break;
-
while (TRUE)
{
int next_pos = i + 1;
-
#ifdef JP
if (iskanji(buf[i])) next_pos++;
#endif
-
- /* Is there the cursor at next position? */
if (next_pos >= pos) break;
- /* Move to next */
i = next_pos;
}
- /* Get previous position */
pos = i;
-
break;
}
case SKEY_RIGHT:
case KTRL('f'):
- /* Now on insert mode */
color = TERM_WHITE;
-
- /* No move at end of line */
if ('\0' == buf[pos]) break;
#ifdef JP
- /* Move right */
if (iskanji(buf[pos])) pos += 2;
else pos++;
#else
pos++;
#endif
-
break;
case ESCAPE:
- /* Cancel input */
buf[0] = '\0';
return FALSE;
case '\n':
case '\r':
- /* Success */
return TRUE;
case '\010':
- /* Backspace */
{
int i = 0;
-
- /* Now on insert mode */
color = TERM_WHITE;
-
- /* No move at beginning of line */
if (0 == pos) break;
-
while (TRUE)
{
int next_pos = i + 1;
-
#ifdef JP
if (iskanji(buf[i])) next_pos++;
#endif
-
- /* Is there the cursor at next position? */
if (next_pos >= pos) break;
- /* Move to next */
i = next_pos;
}
- /* Get previous position */
pos = i;
-
- /* Fall through to 'Delete key' */
}
case 0x7F:
case KTRL('d'):
- /* Delete key */
{
- int dst, src;
-
- /* Now on insert mode */
color = TERM_WHITE;
-
- /* No move at end of line */
if ('\0' == buf[pos]) break;
-
- /* Position of next character */
- src = pos + 1;
-
+ int src = pos + 1;
#ifdef JP
- /* Next character is one more byte away */
if (iskanji(buf[pos])) src++;
#endif
- dst = pos;
-
- /* Move characters at src to dst */
- while ('\0' != (buf[dst++] = buf[src++]))
- /* loop */;
-
+ int dst = pos;
+ while ('\0' != (buf[dst++] = buf[src++]));
break;
}
default:
{
- /* Insert a character */
-
char tmp[100];
- char c;
-
- /* Ignore special keys */
if (skey & SKEY_MASK) break;
-
- /* Get a character code */
- c = (char)skey;
+ char c = (char)skey;
if (color == TERM_YELLOW)
{
- /* Overwrite default string */
buf[0] = '\0';
-
- /* Go to insert mode */
color = TERM_WHITE;
}
- /* Save right part of string */
strcpy(tmp, buf + pos);
#ifdef JP
if (iskanji(c))
{
- char next;
-
- /* Bypass macro processing */
inkey_base = TRUE;
- next = inkey();
-
+ char next = inkey();
if (pos + 1 < len)
{
buf[pos++] = c;
}
}
- /* Terminate */
buf[pos] = '\0';
-
- /* Write back the left part of string */
my_strcat(buf, tmp, len + 1);
break;
- } /* default: */
-
+ }
}
- } /* while (TRUE) */
+ }
}
{
bool res;
msg_print(NULL);
-
- /* Display prompt */
prt(prompt, 0, 0);
-
- /* Ask the user for a string */
res = askfor(buf, len);
-
- /* Clear prompt */
prt("", 0, 0);
return (res);
}
return get_check_strict(prompt, 0);
}
+
/*
* Verify something with the user strictly
*
*/
bool get_check_strict(concptr prompt, BIT_FLAGS mode)
{
- int i;
char buf[80];
- bool flag = FALSE;
-
if (auto_more)
{
p_ptr->window |= PW_MESSAGE;
}
msg_print(NULL);
-
if (!rogue_like_commands)
mode &= ~CHECK_OKAY_CANCEL;
- /* Hack -- Build a "useful" prompt */
if (mode & CHECK_OKAY_CANCEL)
{
my_strcpy(buf, prompt, sizeof(buf) - 15);
strcat(buf, "[y/n]");
}
- /* Prompt for it */
prt(buf, 0, 0);
-
if (!(mode & CHECK_NO_HISTORY) && p_ptr->playing)
{
- /* HACK : Add the line to message buffer */
message_add(buf);
p_ptr->window |= (PW_MESSAGE);
handle_stuff(p_ptr);
}
- /* Get an acceptable answer */
+ bool flag = FALSE;
while (TRUE)
{
- i = inkey();
+ int i = inkey();
if (!(mode & CHECK_NO_ESCAPE))
{
bell();
}
- /* Erase the prompt */
prt("", 0, 0);
-
- /* Return the flag */
return flag;
}
bool get_com(concptr prompt, char *command, bool z_escape)
{
msg_print(NULL);
-
- /* Display a prompt */
prt(prompt, 0, 0);
-
- /* Get a key */
if (get_com_no_macros)
*command = (char)inkey_special(FALSE);
else
*command = inkey();
- /* Clear the prompt */
prt("", 0, 0);
-
- /* Handle "cancel" */
if (*command == ESCAPE) return FALSE;
if (z_escape && ((*command == 'z') || (*command == 'Z'))) return FALSE;
- /* Success */
return TRUE;
}
*/
QUANTITY get_quantity(concptr prompt, QUANTITY max)
{
- bool res, result;
- QUANTITY amt;
+ bool res;
char tmp[80];
char buf[80];
- COMMAND_CODE code;
-
- /* Use "command_arg" */
+ QUANTITY amt;
if (command_arg)
{
- /* Extract a number */
amt = command_arg;
-
- /* Clear "command_arg" */
command_arg = 0;
-
- /* Enforce the maximum */
if (amt > max) amt = max;
- /* Use it */
return (amt);
}
- /* Get the item index */
- result = repeat_pull(&code);
+ COMMAND_CODE code;
+ bool result = repeat_pull(&code);
amt = (QUANTITY)code;
if ((max != 1) && result)
{
- /* Enforce the maximum */
if (amt > max) amt = max;
-
- /* Enforce the minimum */
if (amt < 0) amt = 0;
- /* Use it */
return (amt);
}
- /* Build a prompt if needed */
if (!prompt)
{
sprintf(tmp, _("いくつですか (1-%d): ", "Quantity (1-%d): "), max);
-
- /* Use that prompt */
prompt = tmp;
}
- msg_print(NULL);
- /* Display prompt */
+ msg_print(NULL);
prt(prompt, 0, 0);
-
- /* Default to one */
amt = 1;
-
- /* Build the default */
sprintf(buf, "%d", amt);
/*
*/
res = askfor_aux(buf, 6, FALSE);
- /* Clear prompt */
prt("", 0, 0);
-
- /* Cancelled */
if (!res) return 0;
- /* Extract a number */
amt = (COMMAND_CODE)atoi(buf);
-
- /* A letter means "all" */
if (isalpha(buf[0])) amt = max;
-
- /* Enforce the maximum */
if (amt > max) amt = max;
-
- /* Enforce the minimum */
if (amt < 0) amt = 0;
-
if (amt) repeat_push((COMMAND_CODE)amt);
- /* Return the result */
return (amt);
}
prt("", row, 0);
}
-
/*
* Hack -- special buffer to hold the action of the current keymap
*/
static char request_command_buffer[256];
-
-
typedef struct
{
concptr name;
else basey = 13;
basex = 15;
- /* Clear top line */
prt("", 0, 0);
-
screen_save();
floor_type* floor_ptr = player_ptr->current_floor_ptr;
break;
}
}
+
put_str(menu_name, basey + 1 + i / 2, basex + 4 + (i % 2) * 24);
}
+
max_num = i;
kisuu = max_num % 2;
put_str(_("》", "> "), basey + 1 + num / 2, basex + 2 + (num % 2) * 24);
- /* Place the cursor on the player */
move_cursor_relative(player_ptr->y, player_ptr->x);
-
sub_cmd = inkey();
if ((sub_cmd == ' ') || (sub_cmd == 'x') || (sub_cmd == 'X') || (sub_cmd == '\r') || (sub_cmd == '\n'))
{
return (cmd);
}
+
/*
* Request a command from the user.
*
*/
void request_command(player_type *player_ptr, int shopping)
{
- int i;
-
s16b cmd;
int mode;
#ifdef JP
int caretcmd = 0;
#endif
- /* Roguelike */
if (rogue_like_commands)
{
mode = KEYMAP_MODE_ROGUE;
}
-
- /* Original */
else
{
mode = KEYMAP_MODE_ORIG;
}
-
- /* No command yet */
command_cmd = 0;
-
- /* No "argument" yet */
command_arg = 0;
-
- /* No "direction" yet */
command_dir = 0;
-
use_menu = FALSE;
-
- /* Get command */
while (TRUE)
{
- /* Hack -- auto-commands */
if (command_new)
{
msg_erase();
-
- /* Use auto-command */
cmd = command_new;
-
- /* Forget it */
command_new = 0;
}
-
- /* Get a keypress in "command" mode */
else
{
- /* Hack -- no flush needed */
msg_flag = FALSE;
num_more = 0;
-
- /* Activate "command mode" */
inkey_flag = TRUE;
-
cmd = inkey();
-
if (!shopping && command_menu && ((cmd == '\r') || (cmd == '\n') || (cmd == 'x') || (cmd == 'X'))
&& !keymap_act[mode][(byte)(cmd)])
cmd = inkey_from_menu(player_ptr);
}
- /* Clear top line */
prt("", 0, 0);
-
-
- /* Command Count */
if (cmd == '0')
{
COMMAND_ARG old_arg = command_arg;
-
- /* Reset */
command_arg = 0;
-
- /* Begin the input */
prt(_("回数: ", "Count: "), 0, 0);
-
- /* Get a command count */
while (TRUE)
{
- /* Get a new keypress */
cmd = inkey();
-
- /* Simple editing (delete or backspace) */
if ((cmd == 0x7F) || (cmd == KTRL('H')))
{
- /* Delete a digit */
command_arg = command_arg / 10;
-
- /* Show current count */
prt(format(_("回数: %d", "Count: %d"), command_arg), 0, 0);
}
-
- /* Actual numeric data */
else if (cmd >= '0' && cmd <= '9')
{
- /* Stop count at 9999 */
if (command_arg >= 1000)
{
- /* Warn */
bell();
-
- /* Limit */
command_arg = 9999;
}
-
- /* Increase count */
else
{
- /* Incorporate that digit */
command_arg = command_arg * 10 + D2I(cmd);
}
- /* Show current count */
prt(format(_("回数: %d", "Count: %d"), command_arg), 0, 0);
}
-
- /* Exit on "unusable" input */
else
{
break;
}
}
- /* Hack -- Handle "zero" */
if (command_arg == 0)
{
- /* Default to 99 */
command_arg = 99;
-
- /* Show current count */
prt(format(_("回数: %d", "Count: %d"), command_arg), 0, 0);
}
- /* Hack -- Handle "old_arg" */
if (old_arg != 0)
{
- /* Restore old_arg */
command_arg = old_arg;
-
- /* Show current count */
prt(format(_("回数: %d", "Count: %d"), command_arg), 0, 0);
}
- /* Hack -- white-space means "enter command now" */
if ((cmd == ' ') || (cmd == '\n') || (cmd == '\r'))
{
- /* Get a real command */
if (!get_com(_("コマンド: ", "Command: "), (char *)&cmd, FALSE))
{
- /* Clear count */
command_arg = 0;
continue;
}
}
}
-
- /* Allow "keymaps" to be bypassed */
if (cmd == '\\')
{
- /* Get a real command */
(void)get_com(_("コマンド: ", "Command: "), (char *)&cmd, FALSE);
-
- /* Hack -- bypass keymaps */
if (!inkey_next) inkey_next = "";
}
-
- /* Allow "control chars" to be entered */
if (cmd == '^')
{
- /* Get a new command and controlify it */
if (get_com(_("CTRL: ", "Control: "), (char *)&cmd, FALSE)) cmd = KTRL(cmd);
}
-
- /* Look up applicable keymap */
act = keymap_act[mode][(byte)(cmd)];
-
- /* Apply keymap if not inside a keymap already */
if (act && !inkey_next)
{
- /* Install the keymap (limited buffer size) */
(void)strnfmt(request_command_buffer, 256, "%s", act);
-
- /* Start using the buffer */
inkey_next = request_command_buffer;
continue;
}
if (!cmd) continue;
-
- /* Use command */
command_cmd = (byte)cmd;
-
break;
}
- /* Hack -- Auto-repeat certain commands */
if (always_repeat && (command_arg <= 0))
{
- /* Hack -- auto repeat certain commands */
if (my_strchr("TBDoc+", (char)command_cmd))
{
- /* Repeat 99 times */
command_arg = 99;
}
}
- /* Shopping */
if (shopping == 1)
{
- /* Convert */
switch (command_cmd)
{
- /* Command "p" -> "purchase" (get) */
case 'p': command_cmd = 'g'; break;
- /* Command "m" -> "purchase" (get) */
case 'm': command_cmd = 'g'; break;
- /* Command "s" -> "sell" (drop) */
case 's': command_cmd = 'd'; break;
}
}
#ifdef JP
- for (i = 0; i < 256; i++)
+ for (int i = 0; i < 256; i++)
{
concptr s;
if ((s = keymap_act[mode][i]) != NULL)
}
}
}
+
if (!caretcmd)
caretcmd = command_cmd;
#endif
- /* Hack -- Scan equipment */
- for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
+ for (int i = INVEN_RARM; i < INVEN_TOTAL; i++)
{
- concptr s;
-
object_type *o_ptr = &player_ptr->inventory_list[i];
if (!o_ptr->k_idx) continue;
- /* No inscription */
if (!o_ptr->inscription) continue;
- /* Obtain the inscription */
- s = quark_str(o_ptr->inscription);
-
- /* Find a '^' */
+ concptr s = quark_str(o_ptr->inscription);
s = my_strchr(s, '^');
-
- /* Process preventions */
while (s)
{
- /* Check the "restriction" character */
#ifdef JP
if ((s[1] == caretcmd) || (s[1] == '*'))
#else
if ((s[1] == command_cmd) || (s[1] == '*'))
#endif
-
{
- /* Hack -- Verify command */
if (!get_check(_("本当ですか? ", "Are you sure? ")))
{
- /* Hack -- Use space */
command_cmd = ' ';
}
}
- /* Find another '^' */
s = my_strchr(s + 1, '^');
}
}
-
- /* Hack -- erase the message line. */
prt("", 0, 0);
}
-
/*
* Check a char for "vowel-hood"
*/
{
int d = 0;
- /* Already a direction? */
if (isdigit(ch))
{
d = D2I(ch);
else
{
BIT_FLAGS mode;
- concptr act, s;
-
- /* Roguelike */
if (rogue_like_commands)
{
mode = KEYMAP_MODE_ROGUE;
}
-
- /* Original */
else
{
mode = KEYMAP_MODE_ORIG;
}
- /* Extract the action (if any) */
- act = keymap_act[mode][(byte)(ch)];
-
- /* Analyze */
+ concptr act = keymap_act[mode][(byte)(ch)];
if (act)
{
- /* Convert to a direction */
- for (s = act; *s; ++s)
+ for (concptr s = act; *s; ++s)
{
- /* Use any digits in keymap */
if (isdigit(*s)) d = D2I(*s);
}
}
}
+
if (d == 5) d = 0;
- /* Return direction */
return (d);
}
/* Saved "stuff" */
static COMMAND_CODE repeat__key[REPEAT_MAX];
-
void repeat_push(COMMAND_CODE what)
{
- /* Too many keys */
if (repeat__cnt == REPEAT_MAX) return;
- /* Push the "stuff" */
repeat__key[repeat__cnt++] = what;
-
- /* Prevents us from pulling keys */
++repeat__idx;
}
bool repeat_pull(COMMAND_CODE *what)
{
- /* All out of keys */
if (repeat__idx == repeat__cnt) return FALSE;
- /* Grab the next key, advance */
*what = repeat__key[repeat__idx++];
-
- /* Success */
return TRUE;
}
void repeat_check(void)
{
- COMMAND_CODE what;
-
- /* Ignore some commands */
if (command_cmd == ESCAPE) return;
if (command_cmd == ' ') return;
if (command_cmd == '\r') return;
if (command_cmd == '\n') return;
- /* Repeat Last Command */
+ COMMAND_CODE what;
if (command_cmd == 'n')
{
- /* Reset */
repeat__idx = 0;
-
- /* Get the command */
if (repeat_pull(&what))
{
- /* Save the command */
command_cmd = what;
}
}
-
- /* Start saving new command */
else
{
- /* Reset */
repeat__cnt = 0;
repeat__idx = 0;
-
what = command_cmd;
-
- /* Save this command */
repeat_push(what);
}
}
*/
static void InsertionSort(tag_type elements[], int number)
{
- int j, P;
-
tag_type tmp;
-
- for (P = 1; P < number; P++)
+ for (int i = 1; i < number; i++)
{
- tmp = elements[P];
- for (j = P; (j > 0) && (elements[j - 1].tag > tmp.tag); j--)
+ tmp = elements[i];
+ int j;
+ for (j = i; (j > 0) && (elements[j - 1].tag > tmp.tag); j--)
elements[j] = elements[j - 1];
elements[j] = tmp;
}
*/
static void quicksort(tag_type elements[], int left, int right)
{
- int i, j;
tag_type pivot;
-
if (left + CUTOFF <= right)
{
pivot = median3(elements, left, right);
- i = left; j = right - 1;
+ int i = left;
+ int j = right - 1;
while (TRUE)
{
break;
}
- /* Restore pivot */
swap(&elements[i], &elements[right - 1]);
quicksort(elements, left, i - 1);
}
else
{
- /* Use InsertionSort on small arrays */
InsertionSort(elements + left, right - left + 1);
}
}
*/
void build_gamma_table(int gamma)
{
- int i, n;
-
- /*
- * value is the current sum.
- * diff is the new term to add to the series.
- */
- long value, diff;
-
- /* Hack - convergence is bad in these cases. */
gamma_table[0] = 0;
gamma_table[255] = 255;
-
- for (i = 1; i < 255; i++)
+ for (int i = 1; i < 255; i++)
{
/*
* Initialise the Taylor series
*
* value and diff have been scaled by 256
*/
-
- n = 1;
- value = 256 * 256;
- diff = ((long)gamma_helper[i]) * (gamma - 256);
+ int n = 1;
+ long value = 256 * 256;
+ long diff = ((long)gamma_helper[i]) * (gamma - 256);
while (diff)
{
errr type_string(concptr str, uint len)
{
errr err = 0;
- concptr s;
-
term *old = Term;
-
- /* Paranoia - no string. */
if (!str) return -1;
-
- /* Hack - calculate the string length here if none given. */
if (!len) len = strlen(str);
- /* Activate the main window, as all pastes go there. */
Term_activate(term_screen);
-
- for (s = str; s < str + len; s++)
+ for (concptr s = str; s < str + len; s++)
{
- /* Catch end of string */
if (*s == '\0') break;
err = Term_keypress(*s);
-
- /* Catch errors */
if (err) break;
}
- /* Activate the original window. */
Term_activate(old);
-
return err;
}
-
void roff_to_buf(concptr str, int maxlen, char *tbuf, size_t bufsize)
{
int read_pt = 0;
bool kanji;
#endif
int ch_len = 1;
-
- /* Prepare one character */
ch[0] = str[read_pt];
ch[1] = '\0';
#ifdef JP
if (line_len + ch_len > maxlen - 1 || str[read_pt] == '\n')
{
- int word_len;
-
- /* return to better wrapping point. */
- /* Space character at the end of the line need not to be printed. */
- word_len = read_pt - word_punct;
+ int word_len = read_pt - word_punct;
#ifdef JP
if (kanji && !kinsoku)
/* nothing */;
word_punct = read_pt;
continue;
}
+
if (ch[0] == ' ')
word_punct = read_pt;
+
#ifdef JP
if (!kinsoku) word_punct = read_pt;
#endif
- /* Not enough buffer size */
if ((size_t)(write_pt + 3) >= bufsize) break;
tbuf[write_pt++] = ch[0];
}
#endif
}
+
tbuf[write_pt] = '\0';
tbuf[write_pt + 1] = '\0';
-
return;
}
size_t my_strcpy(char *buf, concptr src, size_t bufsize)
{
#ifdef JP
-
char *d = buf;
concptr s = src;
size_t len = 0;
}
while (*s++) len++;
-
return len;
#else
-
size_t len = strlen(src);
size_t ret = len;
if (bufsize == 0) return ret;
- /* Truncate */
if (len >= bufsize) len = bufsize - 1;
- /* Copy the string and terminate it */
(void)memcpy(buf, src, len);
buf[len] = '\0';
-
- /* Return strlen(src) */
return ret;
-
#endif
}
size_t my_strcat(char *buf, concptr src, size_t bufsize)
{
size_t dlen = strlen(buf);
-
- /* Is there room left in the buffer? */
if (dlen < bufsize - 1)
{
- /* Append as much as possible */
return (dlen + my_strcpy(buf + dlen, src, bufsize - dlen));
}
else
{
- /* Return without appending */
return (dlen + strlen(src));
}
}
*/
char *my_strstr(concptr haystack, concptr needle)
{
- int i;
int l1 = strlen(haystack);
int l2 = strlen(needle);
if (l1 >= l2)
{
- for (i = 0; i <= l1 - l2; i++)
+ for (int i = 0; i <= l1 - l2; i++)
{
if (!strncmp(haystack + i, needle, l2))
return (char *)haystack + i;
*/
void str_tolower(char *str)
{
- /* Force to be lower case string */
for (; *str; str++)
{
#ifdef JP
*/
inkey_macro_trigger_string[0] = '\0';
- /* Get a keypress */
key = inkey();
-
- /* Examine trigger string */
trig_len = strlen(inkey_macro_trigger_string);
-
- /* Already known that no special key */
if (!trig_len) return (int)((unsigned char)key);
-
- /*
- * Hack -- Ignore macro defined on ASCII characters.
- */
if (trig_len == 1 && parse_macro)
{
char c = inkey_macro_trigger_string[0];
-
- /* Cancel macro action on the queue */
forget_macro_action();
-
- /* Return the originaly pressed key */
return (int)((unsigned char)c);
}
- /* Convert the trigger */
ascii_to_text(buf, inkey_macro_trigger_string);
-
- /* Check the prefix "\[" */
if (prefix(str, "\\["))
{
- /* Skip "\[" */
str += 2;
-
- /* Examine modifier keys */
while (TRUE)
{
for (i = 0; modifier_key_list[i].keyname; i++)
{
if (prefix(str, modifier_key_list[i].keyname))
{
- /* Get modifier key flag */
str += strlen(modifier_key_list[i].keyname);
modifier |= modifier_key_list[i].keyflag;
}
}
- /* No more modifier key found */
if (!modifier_key_list[i].keyname) break;
}
- /* numpad_as_cursorkey option force numpad keys to input numbers */
if (!numpad_as_cursorkey) numpad_cursor = FALSE;
- /* Get a special key code */
for (i = 0; special_key_list[i].keyname; i++)
{
if ((!special_key_list[i].numpad || numpad_cursor) &&
}
}
- /* A special key found */
if (skey)
{
- /* Cancel macro action on the queue */
forget_macro_action();
-
- /* Return special key code and modifier flags */
return (skey | modifier);
}
}
}
}
- /* No special key found? */
-
- /* Don't bother with this trigger no more */
inkey_macro_trigger_string[0] = '\0';
-
- /* Return normal keycode */
return (int)((unsigned char)key);
}
-