diff -ruN hengband/lib/edit/t0000002.txt hengband-weapon/lib/edit/t0000002.txt --- hengband/lib/edit/t0000002.txt 2007-02-10 23:50:12.000000000 +0900 +++ hengband-weapon/lib/edit/t0000002.txt 2007-03-23 21:14:22.253393600 +0900 @@ -323,11 +323,15 @@ B:6:A:0:武器を比較する:1000:1000:c:21:0 B:$6:A:1:Evaluate AC:1000:1000:a:46:0 B:6:A:1:防御について調べる:1000:1000:a:46:0 +B:$6:A:2:Display weapons:1000:1000:w:48:0 +B:6:A:2:武器について調べる:1000:1000:w:48:0 ?:[EQU $QUEST5 3 4] B:$6:A:0:Compare weapons:150:150:c:21:0 B:6:A:0:武器を比較する:150:150:c:21:0 B:$6:A:1:Evaluate AC:150:150:a:46:0 B:6:A:1:防御について調べる:150:150:a:46:0 +B:$6:A:2:Display weapons:150:150:w:48:0 +B:6:A:2:武器について調べる:150:150:w:48:0 ?:1 B:$7:N:Fighters Hall:Barak:Human diff -ruN hengband/lib/edit/t0000003.txt hengband-weapon/lib/edit/t0000003.txt --- hengband/lib/edit/t0000003.txt 2007-02-10 23:50:12.000000000 +0900 +++ hengband-weapon/lib/edit/t0000003.txt 2007-03-23 21:15:30.421414400 +0900 @@ -278,6 +278,8 @@ B:6:A:0:武器を比較する:200:200:c:21:0 B:$6:A:1:Evaluate AC:200:200:a:46:0 B:6:A:1:防御について調べる:200:200:a:46:0 +B:$6:A:2:Display weapons:150:150:w:48:0 +B:6:A:2:武器について調べる:150:150:w:48:0 B:$7:N:Fighters Hall:Hjolgar:Barbarian B:7:N:戦士の集会所:ヒョルガー:野蛮人 @@ -301,6 +303,8 @@ #B:8:A:3:Request quest:0:0:q:6:2 B:$8:M:0:3:0:0:0:0:0:0:0:0 B:8:M:0:3:0:0:0:0:0:0:0:0 +B:$8:A:4:List magic-devices:200:500:m:47:0 +B:8:A:4:魔法道具について調べる:200:500:m:47:0 B:$9:N:Inner Temple:Eldore:Human B:9:N:寺院:エルドール:人間 diff -ruN hengband/lib/edit/t0000004.txt hengband-weapon/lib/edit/t0000004.txt --- hengband/lib/edit/t0000004.txt 2007-02-10 23:50:12.000000000 +0900 +++ hengband-weapon/lib/edit/t0000004.txt 2007-03-23 21:16:20.253068800 +0900 @@ -185,6 +185,8 @@ B:6:A:0:武器を比較する:400:400:c:21:0 B:$6:A:1:Evaluate AC:400:400:a:46:0 B:6:A:1:防御について調べる:400:400:a:46:0 +B:$6:A:2:Display weapons:400:400:w:48:0 +B:6:A:2:武器について調べる:400:400:w:48:0 B:$7:N:Fighters Hall:Gharz:Golem B:7:N:戦士の集会所:ガーツ:ゴーレム @@ -207,6 +209,8 @@ B:8:A:2:持ち物全てを鑑定:200:1000:i:26:0 B:$8:C:0:2:0:0:1:0:1:0:0:0:2:0:0:0:2:0:0:0:0:0:0:0:0:0:0:0:0 B:8:C:0:2:0:0:1:0:1:0:0:0:2:0:0:0:2:0:0:0:0:0:0:0:0:0:0:0:0 +B:$8:A:3:List magic-devices:200:500:m:47:0 +B:8:A:3:魔法道具について調べる:200:500:m:47:0 B:$9:N:Inner Temple:Kabir:Dwarf B:9:N:寺院:カビー:ドワーフ diff -ruN hengband/lib/edit/t0000005.txt hengband-weapon/lib/edit/t0000005.txt --- hengband/lib/edit/t0000005.txt 2007-02-10 23:50:14.000000000 +0900 +++ hengband-weapon/lib/edit/t0000005.txt 2007-03-23 21:29:01.417569600 +0900 @@ -145,6 +145,8 @@ B:8:A:3:クエスト:0:0:q:6:1 B:$8:M:0:2:0:0:0:0:0:0:0:0 B:8:M:0:2:0:0:0:0:0:0:0:0 +B:$8:A:4:List magic-devices:200:500:m:47:0 +B:8:A:4:魔法道具について調べる:200:500:m:47:0 B:$14:N:Chaos Tower:Xeno:Beastman B:14:N:カオスの塔:ゼノ:獣人 diff -ruN hengband/lib/edit/t_lite.txt hengband-weapon/lib/edit/t_lite.txt --- hengband/lib/edit/t_lite.txt 2007-03-22 23:54:21.387596800 +0900 +++ hengband-weapon/lib/edit/t_lite.txt 2007-03-23 21:19:37.046043200 +0900 @@ -549,13 +549,17 @@ B:5:N:武器匠:水庵:人間 B:$5:A:0:Compare weapons:1000:1000:c:21:0 B:5:A:0:武器を比較する:1000:1000:c:21:0 -B:$6:A:1:Evaluate AC:1000:1000:a:46:0 -B:6:A:1:防御について調べる:1000:1000:a:46:0 +B:$5:A:1:Evaluate AC:1000:1000:a:46:0 +B:5:A:1:防御について調べる:1000:1000:a:46:0 +B:$5:A:2:Display weapons:1000:1000:w:48:0 +B:5:A:2:武器について調べる:1000:1000:w:48:0 ?:[EQU $QUEST5 3 4] B:$5:A:0:Compare weapons:150:150:c:21:0 B:5:A:0:武器を比較する:150:150:c:21:0 -B:$6:A:1:Evaluate AC:150:150:a:46:0 -B:6:A:1:防御について調べる:150:150:a:46:0 +B:$5:A:1:Evaluate AC:150:150:a:46:0 +B:5:A:1:防御について調べる:150:150:a:46:0 +B:$5:A:2:Display weapons:150:150:w:48:0 +B:5:A:2:武器について調べる:150:150:w:48:0 ?:1 B:$6:N:Fighters Hall:Barak:Human @@ -613,6 +617,8 @@ B:11:A:2:クエスト:0:0:q:6:2 B:$11:M:0:2:0:0:0:0:0:0:0:0 B:11:M:0:2:0:0:0:0:0:0:0:0 +B:$11:A:4:List magic-devices:200:500:m:47:0 +B:11:A:4:魔法道具について調べる:200:500:m:47:0 B:$12:N:Trump Tower:Pelloi:Amberite B:12:N:トランプ魔術の塔:ペロイ:アンバライト diff -ruN hengband/src/bldg.c hengband-weapon/src/bldg.c --- hengband/src/bldg.c 2007-02-10 23:51:40.000000000 +0900 +++ hengband-weapon/src/bldg.c 2007-03-23 21:06:32.197486400 +0900 @@ -3135,13 +3135,13 @@ */ static void compare_weapon_aux2(object_type *o_ptr, int numblows, int r, int c, int mult, cptr attr, - byte color) + byte color, int hand) { char tmp_str[80]; /* Effective dices */ - int eff_dd = o_ptr->dd + p_ptr->to_dd[0]; - int eff_ds = o_ptr->ds + p_ptr->to_ds[0]; + int eff_dd = o_ptr->dd + p_ptr->to_dd[hand]; + int eff_ds = o_ptr->ds + p_ptr->to_ds[hand]; /* Print the intro text */ c_put_str(color, attr, r, c); @@ -3153,8 +3153,8 @@ sprintf(tmp_str, "Attack: %d-%d damage", #endif - (numblows * (mult * eff_dd / 60 + o_ptr->to_d + p_ptr->to_d[0])), - (numblows * (mult * eff_ds * eff_dd / 60 + o_ptr->to_d + p_ptr->to_d[0]))); + (numblows * (mult * eff_dd / 60 + o_ptr->to_d + p_ptr->to_d[hand])), + (numblows * (mult * eff_ds * eff_dd / 60 + o_ptr->to_d + p_ptr->to_d[hand]))); /* Print the damage */ put_str(tmp_str, r, c + 8); @@ -3167,11 +3167,11 @@ * Only accurate for the current weapon, because it includes * the current number of blows for the player. */ -static void compare_weapon_aux1(object_type *o_ptr, int col, int r) +static void compare_weapon_aux1(object_type *o_ptr, int col, int r, int hand) { int mult = 60; u32b flgs[TR_FLAG_SIZE]; - int blow = p_ptr->num_blow[0]; + int blow = p_ptr->num_blow[hand]; bool print_force_weapon = FALSE; /* Get the flags of the weapon */ @@ -3185,66 +3185,74 @@ /* Print the relevant lines */ #ifdef JP - if (print_force_weapon) compare_weapon_aux2(o_ptr, blow, r++, col, 1*mult, "理力:", TERM_L_BLUE); - if (have_flag(flgs, TR_KILL_ANIMAL)) compare_weapon_aux2(o_ptr, blow, r++, col, 4*mult, "動物:", TERM_YELLOW); - else if (have_flag(flgs, TR_SLAY_ANIMAL)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "動物:", TERM_YELLOW); - if (have_flag(flgs, TR_KILL_EVIL)) compare_weapon_aux2(o_ptr, blow, r++, col, 7*mult/2, "邪悪:", TERM_YELLOW); - else if (have_flag(flgs, TR_SLAY_EVIL)) compare_weapon_aux2(o_ptr, blow, r++, col, 2*mult, "邪悪:", TERM_YELLOW); - if (have_flag(flgs, TR_KILL_HUMAN)) compare_weapon_aux2(o_ptr, blow, r++, col, 4*mult, "人間:", TERM_YELLOW); - else if (have_flag(flgs, TR_SLAY_HUMAN)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "人間:", TERM_YELLOW); - if (have_flag(flgs, TR_KILL_UNDEAD)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "不死:", TERM_YELLOW); - else if (have_flag(flgs, TR_SLAY_UNDEAD)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "不死:", TERM_YELLOW); - if (have_flag(flgs, TR_KILL_DEMON)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "悪魔:", TERM_YELLOW); - else if (have_flag(flgs, TR_SLAY_DEMON)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "悪魔:", TERM_YELLOW); - if (have_flag(flgs, TR_KILL_ORC)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "オーク:", TERM_YELLOW); - else if (have_flag(flgs, TR_SLAY_ORC)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "オーク:", TERM_YELLOW); - if (have_flag(flgs, TR_KILL_TROLL)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "トロル:", TERM_YELLOW); - else if (have_flag(flgs, TR_SLAY_TROLL)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "トロル:", TERM_YELLOW); - if (have_flag(flgs, TR_KILL_GIANT)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "巨人:", TERM_YELLOW); - else if (have_flag(flgs, TR_SLAY_GIANT)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "巨人:", TERM_YELLOW); - if (have_flag(flgs, TR_KILL_DRAGON)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "竜:", TERM_YELLOW); - else if (have_flag(flgs, TR_SLAY_DRAGON)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "竜:", TERM_YELLOW); - if (have_flag(flgs, TR_BRAND_ACID)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "酸属性:", TERM_RED); - if (have_flag(flgs, TR_BRAND_ELEC)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "電属性:", TERM_RED); - if (have_flag(flgs, TR_BRAND_FIRE)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "炎属性:", TERM_RED); - if (have_flag(flgs, TR_BRAND_COLD)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "冷属性:", TERM_RED); - if (have_flag(flgs, TR_BRAND_POIS)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "毒属性:", TERM_RED); -#else - if (print_force_weapon) compare_weapon_aux2(o_ptr, blow, r++, col, 1*mult, "Force :", TERM_L_BLUE); - if (have_flag(flgs, TR_KILL_ANIMAL)) compare_weapon_aux2(o_ptr, blow, r++, col, 4*mult, "Animals:", TERM_YELLOW); - else if (have_flag(flgs, TR_SLAY_ANIMAL)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "Animals:", TERM_YELLOW); - if (have_flag(flgs, TR_KILL_EVIL)) compare_weapon_aux2(o_ptr, blow, r++, col, 7*mult/2, "Evil:", TERM_YELLOW); - else if (have_flag(flgs, TR_SLAY_EVIL)) compare_weapon_aux2(o_ptr, blow, r++, col, 2*mult, "Evil:", TERM_YELLOW); - if (have_flag(flgs, TR_KILL_HUMAN)) compare_weapon_aux2(o_ptr, blow, r++, col, 4*mult, "Human:", TERM_YELLOW); - else if (have_flag(flgs, TR_SLAY_HUMAN)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "Human:", TERM_YELLOW); - if (have_flag(flgs, TR_KILL_UNDEAD)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "Undead:", TERM_YELLOW); - else if (have_flag(flgs, TR_SLAY_UNDEAD)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "Undead:", TERM_YELLOW); - if (have_flag(flgs, TR_KILL_DEMON)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "Demons:", TERM_YELLOW); - else if (have_flag(flgs, TR_SLAY_DEMON)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "Demons:", TERM_YELLOW); - if (have_flag(flgs, TR_KILL_ORC)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "Orcs:", TERM_YELLOW); - else if (have_flag(flgs, TR_SLAY_ORC)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "Orcs:", TERM_YELLOW); - if (have_flag(flgs, TR_KILL_TROLL)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "Trolls:", TERM_YELLOW); - else if (have_flag(flgs, TR_SLAY_TROLL)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "Trolls:", TERM_YELLOW); - if (have_flag(flgs, TR_KILL_GIANT)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "Giants:", TERM_YELLOW); - else if (have_flag(flgs, TR_SLAY_GIANT)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "Giants:", TERM_YELLOW); - if (have_flag(flgs, TR_KILL_DRAGON)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "Dragons:", TERM_YELLOW); - else if (have_flag(flgs, TR_SLAY_DRAGON)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "Dragons:", TERM_YELLOW); - if (have_flag(flgs, TR_BRAND_ACID)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "Acid:", TERM_RED); - if (have_flag(flgs, TR_BRAND_ELEC)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "Elec:", TERM_RED); - if (have_flag(flgs, TR_BRAND_FIRE)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "Fire:", TERM_RED); - if (have_flag(flgs, TR_BRAND_COLD)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "Cold:", TERM_RED); - if (have_flag(flgs, TR_BRAND_POIS)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "Poison:", TERM_RED); + if (print_force_weapon) compare_weapon_aux2(o_ptr, blow, r++, col, 1*mult, "理力:", TERM_L_BLUE, hand); + if (have_flag(flgs, TR_KILL_ANIMAL)) compare_weapon_aux2(o_ptr, blow, r++, col, 4*mult, "動物:", TERM_YELLOW, hand); + else if (have_flag(flgs, TR_SLAY_ANIMAL)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "動物:", TERM_YELLOW, hand); + if (have_flag(flgs, TR_KILL_EVIL)) compare_weapon_aux2(o_ptr, blow, r++, col, 7*mult/2, "邪悪:", TERM_YELLOW, hand); + else if (have_flag(flgs, TR_SLAY_EVIL)) compare_weapon_aux2(o_ptr, blow, r++, col, 2*mult, "邪悪:", TERM_YELLOW, hand); + if (have_flag(flgs, TR_KILL_HUMAN)) compare_weapon_aux2(o_ptr, blow, r++, col, 4*mult, "人間:", TERM_YELLOW, hand); + else if (have_flag(flgs, TR_SLAY_HUMAN)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "人間:", TERM_YELLOW, hand); + if (have_flag(flgs, TR_KILL_UNDEAD)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "不死:", TERM_YELLOW, hand); + else if (have_flag(flgs, TR_SLAY_UNDEAD)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "不死:", TERM_YELLOW, hand); + if (have_flag(flgs, TR_KILL_DEMON)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "悪魔:", TERM_YELLOW, hand); + else if (have_flag(flgs, TR_SLAY_DEMON)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "悪魔:", TERM_YELLOW, hand); + if (have_flag(flgs, TR_KILL_ORC)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "オーク:", TERM_YELLOW, hand); + else if (have_flag(flgs, TR_SLAY_ORC)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "オーク:", TERM_YELLOW, hand); + if (have_flag(flgs, TR_KILL_TROLL)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "トロル:", TERM_YELLOW, hand); + else if (have_flag(flgs, TR_SLAY_TROLL)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "トロル:", TERM_YELLOW, hand); + if (have_flag(flgs, TR_KILL_GIANT)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "巨人:", TERM_YELLOW, hand); + else if (have_flag(flgs, TR_SLAY_GIANT)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "巨人:", TERM_YELLOW, hand); + if (have_flag(flgs, TR_KILL_DRAGON)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "竜:", TERM_YELLOW, hand); + else if (have_flag(flgs, TR_SLAY_DRAGON)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "竜:", TERM_YELLOW, hand); + if (have_flag(flgs, TR_BRAND_ACID)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "酸属性:", TERM_RED, hand); + if (have_flag(flgs, TR_BRAND_ELEC)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "電属性:", TERM_RED, hand); + if (have_flag(flgs, TR_BRAND_FIRE)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "炎属性:", TERM_RED, hand); + if (have_flag(flgs, TR_BRAND_COLD)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "冷属性:", TERM_RED, hand); + if (have_flag(flgs, TR_BRAND_POIS)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "毒属性:", TERM_RED, hand); +#else + if (print_force_weapon) compare_weapon_aux2(o_ptr, blow, r++, col, 1*mult, "Force :", TERM_L_BLUE, hand); + if (have_flag(flgs, TR_KILL_ANIMAL)) compare_weapon_aux2(o_ptr, blow, r++, col, 4*mult, "Animals:", TERM_YELLOW, hand); + else if (have_flag(flgs, TR_SLAY_ANIMAL)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "Animals:", TERM_YELLOW, hand); + if (have_flag(flgs, TR_KILL_EVIL)) compare_weapon_aux2(o_ptr, blow, r++, col, 7*mult/2, "Evil:", TERM_YELLOW, hand); + else if (have_flag(flgs, TR_SLAY_EVIL)) compare_weapon_aux2(o_ptr, blow, r++, col, 2*mult, "Evil:", TERM_YELLOW, hand); + if (have_flag(flgs, TR_KILL_HUMAN)) compare_weapon_aux2(o_ptr, blow, r++, col, 4*mult, "Human:", TERM_YELLOW, hand); + else if (have_flag(flgs, TR_SLAY_HUMAN)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "Human:", TERM_YELLOW, hand); + if (have_flag(flgs, TR_KILL_UNDEAD)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "Undead:", TERM_YELLOW, hand); + else if (have_flag(flgs, TR_SLAY_UNDEAD)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "Undead:", TERM_YELLOW, hand); + if (have_flag(flgs, TR_KILL_DEMON)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "Demons:", TERM_YELLOW, hand); + else if (have_flag(flgs, TR_SLAY_DEMON)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "Demons:", TERM_YELLOW, hand); + if (have_flag(flgs, TR_KILL_ORC)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "Orcs:", TERM_YELLOW, hand); + else if (have_flag(flgs, TR_SLAY_ORC)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "Orcs:", TERM_YELLOW, hand); + if (have_flag(flgs, TR_KILL_TROLL)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "Trolls:", TERM_YELLOW, hand); + else if (have_flag(flgs, TR_SLAY_TROLL)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "Trolls:", TERM_YELLOW, hand); + if (have_flag(flgs, TR_KILL_GIANT)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "Giants:", TERM_YELLOW, hand); + else if (have_flag(flgs, TR_SLAY_GIANT)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "Giants:", TERM_YELLOW, hand); + if (have_flag(flgs, TR_KILL_DRAGON)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "Dragons:", TERM_YELLOW, hand); + else if (have_flag(flgs, TR_SLAY_DRAGON)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "Dragons:", TERM_YELLOW, hand); + if (have_flag(flgs, TR_BRAND_ACID)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "Acid:", TERM_RED, hand); + if (have_flag(flgs, TR_BRAND_ELEC)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "Elec:", TERM_RED, hand); + if (have_flag(flgs, TR_BRAND_FIRE)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "Fire:", TERM_RED, hand); + if (have_flag(flgs, TR_BRAND_COLD)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "Cold:", TERM_RED, hand); + if (have_flag(flgs, TR_BRAND_POIS)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "Poison:", TERM_RED, hand); #endif } -static int hit_chance(int to_h, int ac) +static int hit_chance(int to_h, int ac, int hand) { int chance = 0; - int meichuu = p_ptr->skill_thn + (p_ptr->to_h[0] + to_h) * BTH_PLUS_ADJ; + int meichuu = p_ptr->skill_thn + (p_ptr->to_h[hand] + to_h) * BTH_PLUS_ADJ; if (meichuu <= 0) return 5; +#if 1 + // 確率計算間違ってるみたいなので修正してみる + chance = (100 - ((ac * 75) / meichuu)) * 9 / 10; + if (chance < 0) chance = 0; + if (p_ptr->pseikaku == SEIKAKU_NAMAKE) + chance = (chance*19+9)/20; + return chance + 5; +#else chance = 100 - ((ac * 75) / meichuu); if (chance > 95) chance = 95; @@ -3252,22 +3260,360 @@ if (p_ptr->pseikaku == SEIKAKU_NAMAKE) chance = (chance*19+9)/20; return chance; +#endif +} + +static int check_slay(object_type* o_ptr, int flag1) +{ + int flag2; + u32b flgs[TR_FLAG_SIZE]; + + if(o_ptr == NULL) + return TERM_WHITE; + + object_flags(o_ptr, flgs); + if(flag1 == TR_FLAG_MAX) return TERM_WHITE; + else if(flag1 == TR_SLAY_ANIMAL) flag2 = TR_KILL_ANIMAL; + else if(flag1 == TR_SLAY_EVIL) flag2 = TR_KILL_EVIL; + else if(flag1 == TR_SLAY_HUMAN) flag2 = TR_KILL_HUMAN; + else if(flag1 == TR_SLAY_UNDEAD) flag2 = TR_KILL_UNDEAD; + else if(flag1 == TR_SLAY_ORC) flag2 = TR_KILL_ORC; + else if(flag1 == TR_SLAY_TROLL) flag2 = TR_KILL_TROLL; + else if(flag1 == TR_SLAY_GIANT) flag2 = TR_KILL_GIANT; + else if(flag1 == TR_SLAY_DRAGON) flag2 = TR_KILL_DRAGON; + else flag2 = TR_FLAG_MAX; + + if(flag2 != TR_FLAG_MAX && have_flag(flgs, flag2)) { + return TERM_L_RED; + } + + if(have_flag(flgs, flag1)) { + if(flag1 == TR_FORCE_WEAPON) { + if ((p_ptr->pclass != CLASS_SAMURAI) && (p_ptr->csp > (o_ptr->dd * o_ptr->ds / 5))) { + return TERM_L_BLUE; + } else { + return TERM_WHITE; + } + } + return TERM_YELLOW; + } + + return TERM_WHITE; +} + +static int get_mult(object_type* o_ptr, int flag1) +{ + u32b flgs[TR_FLAG_SIZE]; + int mult = 60; + + object_flags(o_ptr, flgs); + + if(flag1 != TR_FLAG_MAX) { + /* 理 */ + if ((p_ptr->pclass != CLASS_SAMURAI) && have_flag(flgs, TR_FORCE_WEAPON) && (p_ptr->csp > (o_ptr->dd * o_ptr->ds / 5))) { + mult = mult * 7 / 2; + } + } + + if(flag1 == TR_SLAY_ANIMAL) { + if (have_flag(flgs, TR_KILL_ANIMAL)) mult = mult * 4; + else if(have_flag(flgs, TR_SLAY_ANIMAL)) mult = mult * 5 / 2; + } + + if(flag1 == TR_SLAY_EVIL) { + if (have_flag(flgs, TR_KILL_EVIL)) mult = mult * 7 / 2; + else if(have_flag(flgs, TR_SLAY_EVIL)) mult = mult * 2; + } + + if(flag1 == TR_SLAY_HUMAN) { + if (have_flag(flgs, TR_KILL_HUMAN)) mult = mult * 4; + else if(have_flag(flgs, TR_SLAY_HUMAN)) mult = mult * 5 / 2; + } + + if(flag1 == TR_SLAY_UNDEAD) { + if (have_flag(flgs, TR_KILL_UNDEAD)) mult = mult * 5; + else if(have_flag(flgs, TR_SLAY_UNDEAD)) mult = mult * 3; + } + + if(flag1 == TR_SLAY_DEMON) { + if (have_flag(flgs, TR_KILL_DEMON)) mult = mult * 5; + else if(have_flag(flgs, TR_SLAY_DEMON)) mult = mult * 3; + } + + if(flag1 == TR_SLAY_ORC) { + if (have_flag(flgs, TR_KILL_ORC)) mult = mult * 5; + else if(have_flag(flgs, TR_SLAY_ORC)) mult = mult * 3; + } + + if(flag1 == TR_SLAY_TROLL) { + if (have_flag(flgs, TR_KILL_TROLL)) mult = mult * 5; + else if(have_flag(flgs, TR_SLAY_TROLL)) mult = mult * 3; + } + + if(flag1 == TR_SLAY_GIANT) { + if (have_flag(flgs, TR_KILL_GIANT)) mult = mult * 5; + else if(have_flag(flgs, TR_SLAY_GIANT)) mult = mult * 3; + } + + if(flag1 == TR_SLAY_DRAGON) { + if (have_flag(flgs, TR_KILL_DRAGON)) mult = mult * 5; + else if(have_flag(flgs, TR_SLAY_DRAGON)) mult = mult * 3; + } + + if(flag1 == TR_BRAND_ACID) { + if (have_flag(flgs, TR_BRAND_ACID)) mult = mult * 5 / 2; + } + if(flag1 == TR_BRAND_ELEC) { + if (have_flag(flgs, TR_BRAND_ELEC)) mult = mult * 5 / 2; + } + if(flag1 == TR_BRAND_FIRE) { + if (have_flag(flgs, TR_BRAND_FIRE)) mult = mult * 5 / 2; + } + if(flag1 == TR_BRAND_COLD) { + if (have_flag(flgs, TR_BRAND_COLD)) mult = mult * 5 / 2; + } + if(flag1 == TR_BRAND_POIS) { + if (have_flag(flgs, TR_BRAND_POIS)) mult = mult * 5 / 2; + } + return mult; +} + +static int compute_vorpal(object_type* o_ptr, int basedam) +{ + int i; + int vorpaltbl[7]; + u32b flgs[TR_FLAG_SIZE]; + long dam1000 = 0; + + object_flags(o_ptr, flgs); + if(!have_flag(flgs, TR_VORPAL)) { + return basedam; + } + + /* *手抜き* */ + if((o_ptr->name1 == ART_VORPAL_BLADE) || (o_ptr->name1 == ART_CHAINSWORD)) { + vorpaltbl[0] = 167; + vorpaltbl[1] = 83; + vorpaltbl[2] = 42; + vorpaltbl[3] = 21; + vorpaltbl[4] = 10; + vorpaltbl[5] = 5; + vorpaltbl[6] = 5; + } else { + vorpaltbl[0] = 125; + vorpaltbl[1] = 31; + vorpaltbl[2] = 7; + vorpaltbl[3] = 2; + vorpaltbl[4] = 1; + vorpaltbl[5] = 0; + vorpaltbl[6] = 0; + } + + i = 1000; + dam1000 += basedam * 2 * vorpaltbl[0]; i -= vorpaltbl[0]; + dam1000 += basedam * 3 * vorpaltbl[1]; i -= vorpaltbl[1]; + dam1000 += basedam * 4 * vorpaltbl[2]; i -= vorpaltbl[2]; + dam1000 += basedam * 5 * vorpaltbl[3]; i -= vorpaltbl[3]; + dam1000 += basedam * 6 * vorpaltbl[4]; i -= vorpaltbl[4]; + dam1000 += basedam * 7 * vorpaltbl[5]; i -= vorpaltbl[5]; + dam1000 += basedam * 8 * vorpaltbl[6]; i -= vorpaltbl[6]; + dam1000 += basedam * i; + + return (int)dam1000 / 1000; +} + +static int compute_kaishin(object_type* o_ptr, int hand, int basedam) +{ + int power = (o_ptr->weight + + (p_ptr->to_h[hand] * 3 + o_ptr->to_h * 5) + + (p_ptr->lev * 3)); + int randRange = ((p_ptr->pclass == CLASS_NINJA) ? 4444 : 5000); + int chance1000 = ((power <= 0) ? 0 : (power * 1000 / randRange)); + int wa = o_ptr->weight + 1; + int wb = o_ptr->weight + 650 + 1; + int table[] = {1, 400, 700, 900, 1300, 999999}; + int chance[5]; + int idx; + long dam1000; + + for(idx = 0; idx < 5; ++idx){ + // (table[idx])以上(table[idx+1])未満の範囲と、 + // (weight+1)以上(weight+650+1)未満の範囲の、重複する量を計算 + int min = table[idx]; + int max = table[idx + 1]; + if(min < wa){ + min = wa; + } + if(wb < max){ + max = wb; + } + if(min < max){ + chance[idx] = chance1000 * (max - min) / 650; + }else{ + chance[idx] = 0; + } + } + + /* 千回試行したとしての平均ダメージ算出 */ + dam1000 = 0; + dam1000 += (basedam * 2 + 5 ) * chance[0]; + dam1000 += (basedam * 2 + 10) * chance[1]; + dam1000 += (basedam * 3 + 15) * chance[2]; + dam1000 += (basedam * 3 + 20) * chance[3]; + dam1000 += ((basedam * 7) / 2 + 25) * chance[4]; + dam1000 += (basedam * (1000 - chance[0] - chance[1] - chance[2] - chance[3] - chance[4])); + return (int)dam1000 / 1000; +} + +static int calc_kitaichi(object_type* o_ptr, int hand, int flag, int ac) +{ + int eff_dd; + int eff_ds; + int mult; + int mindam, maxdam, avldam; + + if(o_ptr == NULL) + return -1; + + /* 平均ダメージ */ + eff_dd = o_ptr->dd + p_ptr->to_dd[hand]; + eff_ds = o_ptr->ds + p_ptr->to_ds[hand]; + mult = get_mult(o_ptr, flag); + mindam = mult * eff_dd / 60; + maxdam = mult * eff_ds * eff_dd / 60; + avldam = (mindam + maxdam) / 2; + + /* 会心適用 */ + avldam = compute_kaishin(o_ptr, hand, avldam); + + /* 切れ味適用*/ + avldam = compute_vorpal(o_ptr, avldam); + + /* 殺戮修正 */ + avldam += o_ptr->to_d + p_ptr->to_d[hand]; + + /* 攻撃回数・命中率適用 */ + avldam = (p_ptr->num_blow[hand] * avldam * hit_chance(o_ptr->to_h, ac, hand)) / 100; + return avldam; } +static void list_kitaichi(void) +{ + typedef struct tagSlay { + int flag; + cptr name; + int color; + } SLAY; + + static SLAY tblSlay[] = { +#ifdef JP + {TR_FLAG_MAX , "通常:", TERM_WHITE}, + {TR_FORCE_WEAPON, "理力:", TERM_L_BLUE}, + {TR_SLAY_ANIMAL , "動物:", TERM_YELLOW}, + {TR_SLAY_EVIL , "邪悪:", TERM_YELLOW}, + {TR_SLAY_HUMAN , "人間:", TERM_YELLOW}, + {TR_SLAY_UNDEAD , "不死:", TERM_YELLOW}, + {TR_SLAY_DEMON , "悪魔:", TERM_YELLOW}, + {TR_SLAY_ORC , "オーク:", TERM_YELLOW}, + {TR_SLAY_TROLL , "トロル:", TERM_YELLOW}, + {TR_SLAY_GIANT , "巨人:", TERM_YELLOW}, + {TR_SLAY_DRAGON , "竜:", TERM_YELLOW}, + {TR_BRAND_ACID , "酸属性:", TERM_L_RED}, + {TR_BRAND_ELEC , "電属性:", TERM_L_RED}, + {TR_BRAND_FIRE , "炎属性:", TERM_L_RED}, + {TR_BRAND_COLD , "冷属性:", TERM_L_RED}, + {TR_BRAND_POIS , "毒属性:", TERM_L_RED} +#else + {TR_FLAG_MAX , "Normal:" , TERM_WHITE}, + {TR_FORCE_WEAPON, "Force:" , TERM_L_BLUE}, + {TR_SLAY_ANIMAL , "Animals:", TERM_YELLOW}, + {TR_SLAY_EVIL , "Evil:" , TERM_YELLOW}, + {TR_SLAY_HUMAN , "Human:" , TERM_YELLOW}, + {TR_SLAY_UNDEAD , "Undead:" , TERM_YELLOW}, + {TR_SLAY_DEMON , "Demons:" , TERM_YELLOW}, + {TR_SLAY_ORC , "Orcs:" , TERM_YELLOW}, + {TR_SLAY_TROLL , "Trolls:" , TERM_YELLOW}, + {TR_SLAY_GIANT , "Giants:" , TERM_YELLOW}, + {TR_SLAY_DRAGON , "Dragons:", TERM_YELLOW}, + {TR_BRAND_ACID , "Acid:" , TERM_L_RED}, + {TR_BRAND_ELEC , "Elec:" , TERM_L_RED}, + {TR_BRAND_FIRE , "Fire:" , TERM_L_RED}, + {TR_BRAND_COLD , "Cold:" , TERM_L_RED}, + {TR_BRAND_POIS , "Poison:" , TERM_L_RED} +#endif + }; + + int i, j; + object_type *o_rptr, *o_lptr; + int lslay, rslay; + int ldam, rdam; + int row = 8, col; + char tmp_str[80]; + +#ifdef JP +sprintf(tmp_str, " (敵のAC) 0 50 100 150 200"); +#else +sprintf(tmp_str, " (AC) 0 50 100 150 200"); +#endif + put_str(tmp_str, row++, 0); + + if(buki_motteruka(INVEN_RARM)) { + o_rptr = &inventory[INVEN_RARM]; + } else { + o_rptr = NULL; + } + if(buki_motteruka(INVEN_LARM)) { + o_lptr = &inventory[INVEN_LARM]; + } else { + o_lptr = NULL; + } + + for(i = 0 ; i < sizeof(tblSlay) / sizeof(SLAY) ; i++) { + rslay = check_slay(o_rptr, tblSlay[i].flag); + lslay = check_slay(o_lptr, tblSlay[i].flag); + if(tblSlay[i].flag != TR_FLAG_MAX && rslay == TERM_WHITE && lslay == TERM_WHITE) { + continue; + } + c_put_str(tblSlay[i].color, tblSlay[i].name, row, 1); + for(j = 0 ; j < 5 ; j++) { + col = j * 14 + 10; + rdam = calc_kitaichi(o_rptr, 0, tblSlay[i].flag, j * 50); + ldam = calc_kitaichi(o_lptr, 1, tblSlay[i].flag, j * 50); + + if(o_lptr) { + sprintf(tmp_str, "%4d( + )", rdam + ldam); + put_str(tmp_str, row, col); + + sprintf(tmp_str, "%3d", rdam); + c_put_str(rslay, tmp_str, row, col + 5); + + sprintf(tmp_str, "%3d", ldam); + c_put_str(lslay, tmp_str, row, col + 9); + + } else { + sprintf(tmp_str, "%4d dam/turn", rdam); + put_str(tmp_str, row, col); + } + + } + row++; + } +} + /* * Displays all info about a weapon * * Only accurate for the current weapon, because it includes * various info about the player's +to_dam and number of blows. */ -static void list_weapon(object_type *o_ptr, int row, int col) +static void list_weapon(object_type *o_ptr, int row, int col, int hand) { char o_name[MAX_NLEN]; char tmp_str[80]; /* Effective dices */ - int eff_dd = o_ptr->dd + p_ptr->to_dd[0]; - int eff_ds = o_ptr->ds + p_ptr->to_ds[0]; + int eff_dd = o_ptr->dd + p_ptr->to_dd[hand]; + int eff_ds = o_ptr->ds + p_ptr->to_ds[hand]; /* Print the weapon name */ object_desc(o_name, o_ptr, OD_NAME_ONLY); @@ -3275,9 +3621,9 @@ /* Print the player's number of blows */ #ifdef JP -sprintf(tmp_str, "攻撃回数: %d", p_ptr->num_blow[0]); +sprintf(tmp_str, "攻撃回数: %d", p_ptr->num_blow[hand]); #else - sprintf(tmp_str, "Number of Blows: %d", p_ptr->num_blow[0]); + sprintf(tmp_str, "Number of Blows: %d", p_ptr->num_blow[hand]); #endif put_str(tmp_str, row+1, col); @@ -3293,9 +3639,9 @@ /* Print the weapons base damage dice */ #ifdef JP -sprintf(tmp_str, " %2d %2d %2d %2d %2d (%%)", hit_chance(o_ptr->to_h, 0), hit_chance(o_ptr->to_h, 50), hit_chance(o_ptr->to_h, 100), hit_chance(o_ptr->to_h, 150), hit_chance(o_ptr->to_h, 200)); +sprintf(tmp_str, " %2d %2d %2d %2d %2d (%%)", hit_chance(o_ptr->to_h, 0, hand), hit_chance(o_ptr->to_h, 50, hand), hit_chance(o_ptr->to_h, 100, hand), hit_chance(o_ptr->to_h, 150, hand), hit_chance(o_ptr->to_h, 200, hand)); #else -sprintf(tmp_str, " %2d %2d %2d %2d %2d (%%)", hit_chance(o_ptr->to_h, 0), hit_chance(o_ptr->to_h, 50), hit_chance(o_ptr->to_h, 100), hit_chance(o_ptr->to_h, 150), hit_chance(o_ptr->to_h, 200)); +sprintf(tmp_str, " %2d %2d %2d %2d %2d (%%)", hit_chance(o_ptr->to_h, 0, hand), hit_chance(o_ptr->to_h, 50, hand), hit_chance(o_ptr->to_h, 100, hand), hit_chance(o_ptr->to_h, 150, hand), hit_chance(o_ptr->to_h, 200, hand)); #endif put_str(tmp_str, row+3, col); @@ -3314,8 +3660,8 @@ sprintf(tmp_str, "One Strike: %d-%d damage", #endif - eff_dd + o_ptr->to_d + p_ptr->to_d[0], - eff_ds * eff_dd + o_ptr->to_d + p_ptr->to_d[0]); + eff_dd + o_ptr->to_d + p_ptr->to_d[hand], + eff_ds * eff_dd + o_ptr->to_d + p_ptr->to_d[hand]); put_str(tmp_str, row+6, col+1); /* Damage for the complete attack (if all blows hit) */ @@ -3325,9 +3671,54 @@ sprintf(tmp_str, "One Attack: %d-%d damage", #endif - p_ptr->num_blow[0] * (eff_dd + o_ptr->to_d + p_ptr->to_d[0]), - p_ptr->num_blow[0] * (eff_ds * eff_dd + o_ptr->to_d + p_ptr->to_d[0])); + p_ptr->num_blow[0] * (eff_dd + o_ptr->to_d + p_ptr->to_d[hand]), + p_ptr->num_blow[0] * (eff_ds * eff_dd + o_ptr->to_d + p_ptr->to_d[hand])); put_str(tmp_str, row+7, col+1); + + + { + int power = (o_ptr->weight + + (p_ptr->to_h[hand] * 3 + o_ptr->to_h * 5) + + (p_ptr->lev * 3)); + int randRange = ((p_ptr->pclass == CLASS_NINJA) ? 4444 : 5000); + int chance1000 = ((power <= 0) ? 0 : (power * 1000 / randRange)); + int wa = o_ptr->weight + 1; + int wb = o_ptr->weight + 650 + 1; + int table[] = {1, 400, 700, 900, 1300, 999999}; + int chance[5]; + int idx; + + for(idx = 0; idx < 5; ++idx){ + // (table[idx])以上(table[idx+1])未満の範囲と、 + // (weight+1)以上(weight+650+1)未満の範囲の、重複する量を計算 + int min = table[idx]; + int max = table[idx + 1]; + if(min < wa){ + min = wa; + } + if(wb < max){ + max = wb; + } + if(min < max){ + chance[idx] = chance1000 * (max - min) / 650; + }else{ + chance[idx] = 0; + } + } + +#ifdef JP + c_put_str(TERM_YELLOW, "会心攻撃:", row+8, col); +#else + c_put_str(TERM_YELLOW, "critical:", row+8, col); +#endif + sprintf(tmp_str, "%2d.%d %2d.%d %2d.%d %2d.%d %2d.%d(%%)", + chance[0] / 10, chance[0] % 10, + chance[1] / 10, chance[1] % 10, + chance[2] / 10, chance[2] % 10, + chance[3] / 10, chance[3] % 10, + chance[4] / 10, chance[4] % 10); + put_str(tmp_str, row+8, col+9); + } } @@ -3460,8 +3851,8 @@ character_xtra = old_character_xtra; /* List the new values */ - list_weapon(o1_ptr, row, 2); - compare_weapon_aux1(o1_ptr, 2, row + 8); + list_weapon(o1_ptr, row, 2, 0); + compare_weapon_aux1(o1_ptr, 2, row + 9, 0); /* Copy second weapon into the weapon slot (if it's not already there) */ if (o2_ptr != i_ptr) @@ -3478,8 +3869,8 @@ character_xtra = old_character_xtra; /* List the new values */ - list_weapon(o2_ptr, row, 40); - compare_weapon_aux1(o2_ptr, 40, row + 8); + list_weapon(o2_ptr, row, 40, 0); + compare_weapon_aux1(o2_ptr, 40, row + 9, 0); /* Copy back the original weapon into the weapon slot */ object_copy(i_ptr, &orig_weapon); @@ -3508,6 +3899,141 @@ return (TRUE); } +/* + * + */ +static void list_weapon_short(object_type *o_ptr, int row, int col, int hand) +{ + char o_name[MAX_NLEN]; + char tmp_str[80]; + + /* Print the weapon name */ + object_desc(o_name, o_ptr, OD_NAME_ONLY); + c_put_str(TERM_YELLOW, o_name, row, col); + + /* Print the player's number of blows */ +#ifdef JP +sprintf(tmp_str, "攻撃回数: %d", p_ptr->num_blow[hand]); +#else + sprintf(tmp_str, "Number of Blows: %d", p_ptr->num_blow[hand]); +#endif + + put_str(tmp_str, row+1, col); + + /* Print to_hit and to_dam of the weapon */ +#ifdef JP +sprintf(tmp_str, "命中率: 0 50 100 150 200 (敵のAC)"); +#else +sprintf(tmp_str, "To Hit: 0 50 100 150 200 (AC)"); +#endif + + put_str(tmp_str, row+2, col); + + /* Print the weapons base damage dice */ +#ifdef JP +sprintf(tmp_str, " %2d %2d %2d %2d %2d (%%)", hit_chance(o_ptr->to_h, 0, hand), hit_chance(o_ptr->to_h, 50, hand), hit_chance(o_ptr->to_h, 100, hand), hit_chance(o_ptr->to_h, 150, hand), hit_chance(o_ptr->to_h, 200, hand)); +#else +sprintf(tmp_str, " %2d %2d %2d %2d %2d (%%)", hit_chance(o_ptr->to_h, 0, hand), hit_chance(o_ptr->to_h, 50, hand), hit_chance(o_ptr->to_h, 100, hand), hit_chance(o_ptr->to_h, 150, hand), hit_chance(o_ptr->to_h, 200, hand)); +#endif + + put_str(tmp_str, row+3, col); + + { + int power = (o_ptr->weight + + (p_ptr->to_h[hand] * 3 + o_ptr->to_h * 5) + + (p_ptr->lev * 3)); + int randRange = ((p_ptr->pclass == CLASS_NINJA) ? 4444 : 5000); + int chance1000 = ((power <= 0) ? 0 : (power * 1000 / randRange)); + int wa = o_ptr->weight + 1; + int wb = o_ptr->weight + 650 + 1; + int table[] = {1, 400, 700, 900, 1300, 999999}; + int chance[5]; + int idx; + + for(idx = 0; idx < 5; ++idx){ + // (table[idx])以上(table[idx+1])未満の範囲と、 + // (weight+1)以上(weight+650+1)未満の範囲の、重複する量を計算 + int min = table[idx]; + int max = table[idx + 1]; + if(min < wa){ + min = wa; + } + if(wb < max){ + max = wb; + } + if(min < max){ + chance[idx] = chance1000 * (max - min) / 650; + }else{ + chance[idx] = 0; + } + } + +#ifdef JP + c_put_str(TERM_YELLOW, "会心攻撃:", row+4, col); +#else + c_put_str(TERM_YELLOW, "critical:", row+4, col); +#endif + sprintf(tmp_str, "%2d.%d %2d.%d %2d.%d %2d.%d %2d.%d(%%)", + chance[0] / 10, chance[0] % 10, + chance[1] / 10, chance[1] % 10, + chance[2] / 10, chance[2] % 10, + chance[3] / 10, chance[3] % 10, + chance[4] / 10, chance[4] % 10); + put_str(tmp_str, row+4, col+9); + } +} + +/* + * Display holding weapons + */ +static bool display_weapons(void) +{ + int row = 2; + object_type *o_ptr; + + if(!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM)){ +#ifdef JP + prt("あなたは武器を装備していません!", 0, 0); +#else + prt("You are not armed.", 0, 0); +#endif + /* Done */ + return (FALSE); + } + + screen_save(); + /* Clear the screen */ + clear_bldg(0, 22); + + if(buki_motteruka(INVEN_RARM)){ + o_ptr = &inventory[INVEN_RARM]; + list_weapon_short(o_ptr, row, 2, 0); + } + + if(buki_motteruka(INVEN_LARM)){ + o_ptr = &inventory[INVEN_LARM]; + list_weapon_short(o_ptr, row, 40, 1); + } + + list_kitaichi(); + +#ifdef JP +msg_print("現在の技量から判断すると、あなたの武器は以下のような威力を発揮します:"); +#else + msg_print("Based on your current abilities, here is what your weapons will do"); +#endif + + + flush(); + (void)inkey(); + + screen_load(); + + /* Done */ + return (TRUE); +} + + /* * Evaluate AC @@ -4181,6 +4707,190 @@ return; } +/* + * Calculate a chance of using the rod.(per mill) + * See do_cmd_zap_rod() + */ +int calc_chance_rod(object_type *o_ptr) +{ + int chance, lev, fail, result; + + if(p_ptr->pclass == CLASS_BERSERKER) return 0; + + /* Extract the item level */ + lev = k_info[o_ptr->k_idx].level; + + /* Base chance of success */ + chance = p_ptr->skill_dev; + + /* Confusion hurts skill */ + if (p_ptr->confused) chance = chance / 2; + + fail = lev+5; + if (chance > fail) fail -= (chance - fail)*2; + else chance -= (fail - chance)*2; + if (fail < USE_DEVICE) fail = USE_DEVICE; + if (chance < USE_DEVICE) chance = USE_DEVICE; + + if (chance > fail) + { + result = (chance * 2 - fail) * 1000 / (chance * 2); + } + else + { + result = chance * 1000 / (fail * 2); + } + if (result < 0) result = 0; + return result; +} + + +/* + * Calculate a chance of using the wand.(per mill) + * See do_cmd_aim_wand() + */ +int calc_chance_wand(object_type *o_ptr) +{ + int chance, lev, result; + + if(p_ptr->pclass == CLASS_BERSERKER) return 0; + + /* Get the level */ + lev = k_info[o_ptr->k_idx].level; + if (lev > 50) lev = 50 + (lev - 50)/2; + + /* Base chance of success */ + chance = p_ptr->skill_dev; + + /* Confusion hurts skill */ + if (p_ptr->confused) chance = chance / 2; + + /* Hight level objects are harder */ + chance = chance - lev; + + if (chance < USE_DEVICE) + { + result = 1000 / + ((USE_DEVICE - chance + 1) * USE_DEVICE); + }else{ + result = (chance - USE_DEVICE + 1) * 1000 / chance; + } + return result; +} + +/* + * Calculate a chance of using the staff.(per mill) + * See do_cmd_use_staff() + */ +int calc_chance_staff(object_type *o_ptr) +{ + return calc_chance_wand(o_ptr); +} + +/* + * 杖、魔法棒、ロッドの成功確率をリスト表示する + */ +static bool list_magic_devices(void) +{ + object_type *o_ptr; + char o_name[MAX_NLEN]; + int chance; + int i; + int row = 1; + bool result = FALSE; + + for (i = 0; i < INVEN_PACK; i++) + { + o_ptr = &inventory[i]; + + /* stop on non-objects */ + if (!o_ptr->k_idx) break; + + /* Is this item acceptable? */ + if (!item_tester_okay(o_ptr)) continue; + + if (/* object_known_p(o_ptr) && */ + (o_ptr->tval == TV_ROD || + o_ptr->tval == TV_WAND || + o_ptr->tval == TV_STAFF)) result = TRUE; + } + + if(!result){ +#ifdef JP + prt("調べられる魔法道具が無い。", 0, 0); +#else + prt("You don''t have magic_devices.", 0, 0); +#endif + /* Done */ + return (FALSE); + } + + screen_save(); + clear_bldg(0, 22); + + for (i = 0; i < INVEN_PACK; i++) + { + o_ptr = &inventory[i]; + + /* stop on non-objects */ + if (!o_ptr->k_idx) break; + + /* Is this item acceptable? */ + if (!item_tester_okay(o_ptr)) continue; + + switch (o_ptr->tval) + { + case TV_ROD: + chance = calc_chance_rod(o_ptr); + break; + + case TV_WAND: + chance = calc_chance_wand(o_ptr); + break; + + case TV_STAFF: + chance = calc_chance_staff(o_ptr); + break; + + default: + chance = -1; + break; + } + + if(chance >= 0) + { + /* Describe the object */ + /* object_desc(o_name, o_ptr, TRUE, 3); */ + object_desc(o_name, o_ptr, 0); + c_put_str(tval_to_attr[o_ptr->tval % 128], o_name, row, 11); + put_str(format(" %4d.%01d %%", + chance / 10, chance % 10), row, 0); + if(object_is_aware(o_ptr)) + { + put_str(format(" %4d.%01d %%", + chance / 10, chance % 10), row, 0); + } + else + { + put_str(" ??.? %", row, 0); + } + ++row; + } + } + +#ifdef JP + prt("魔法道具の成功率:", 0, 0); +#else + prt("chance of magic_devices:", 0, 0); +#endif + + flush(); + (void)inkey(); + screen_load(); + + /* Done */ + return (TRUE); +} bool tele_town(void) { @@ -4778,7 +5488,11 @@ case BACT_LOSE_MUTATION: if (p_ptr->muta1 || p_ptr->muta2 || (p_ptr->muta3 & ~MUT3_GOOD_LUCK) || - (p_ptr->pseikaku != SEIKAKU_LUCKY && + ((p_ptr->pseikaku != SEIKAKU_LUCKY +#ifdef ADD_TENNEN + || p_ptr->pseikaku != SEIKAKU_TENNEN +#endif + ) && (p_ptr->muta3 & MUT3_GOOD_LUCK))) { while(!lose_mutation(0)); @@ -4842,6 +5556,12 @@ case BACT_EVAL_AC: paid = eval_ac(p_ptr->dis_ac + p_ptr->dis_to_a); break; + case BACT_LIST_MAGIC_DEVICES: + paid = list_magic_devices(); + break; + case BACT_DISPLAY_WEAPONS: + paid = display_weapons(); + break; } if (paid) diff -ruN hengband/src/defines.h hengband-weapon/src/defines.h --- hengband/src/defines.h 2005-05-12 21:01:00.000000000 +0900 +++ hengband-weapon/src/defines.h 2007-03-23 21:11:29.785396800 +0900 @@ -82,6 +82,8 @@ #define ANGBAND_2_8_1 #define ZANGBAND +#define EXTEND_WEAPON + /* * Number of grids in each block (vertically) * Probably hard-coded to 11, see "generate.c" @@ -4538,54 +4540,60 @@ /* * Buildings actions */ -#define BACT_NOTHING 0 -#define BACT_RESEARCH_ITEM 1 -#define BACT_TOWN_HISTORY 2 -#define BACT_RACE_LEGENDS 3 -#define BACT_GREET_KING 4 -#define BACT_KING_LEGENDS 5 -#define BACT_QUEST 6 -#define BACT_XXX_UNUSED 7 -#define BACT_POSTER 8 -#define BACT_ARENA_RULES 9 -#define BACT_ARENA 10 -#define BACT_ARENA_LEGENDS 11 -#define BACT_IN_BETWEEN 12 -#define BACT_GAMBLE_RULES 13 -#define BACT_CRAPS 14 -#define BACT_SPIN_WHEEL 15 -#define BACT_DICE_SLOTS 16 -#define BACT_REST 17 -#define BACT_FOOD 18 -#define BACT_RUMORS 19 -#define BACT_RESEARCH_MONSTER 20 -#define BACT_COMPARE_WEAPONS 21 -#define BACT_LEGENDS 22 -#define BACT_ENCHANT_WEAPON 23 -#define BACT_ENCHANT_ARMOR 24 -#define BACT_RECHARGE 25 -#define BACT_IDENTS 26 -#define BACT_LEARN 27 -#define BACT_HEALING 28 -#define BACT_RESTORE 29 -#define BACT_ENCHANT_ARROWS 30 -#define BACT_ENCHANT_BOW 31 -#define BACT_GREET 32 -#define BACT_RECALL 33 -#define BACT_TELEPORT_LEVEL 34 -#define BACT_LOSE_MUTATION 35 -#define BACT_BATTLE 36 -#define BACT_TSUCHINOKO 37 -#define BACT_TARGET 38 -#define BACT_KUBI 39 -#define BACT_KANKIN 40 -#define BACT_HEIKOUKA 41 -#define BACT_TELE_TOWN 42 -#define BACT_POKER 43 -#define BACT_IDENT_ONE 44 -#define BACT_RECHARGE_ALL 45 -#define BACT_EVAL_AC 46 -#define MAX_BACT 47 +enum { + BACT_NOTHING, + BACT_RESEARCH_ITEM, + BACT_TOWN_HISTORY, + BACT_RACE_LEGENDS, + BACT_GREET_KING, + BACT_KING_LEGENDS, + BACT_QUEST, + BACT_XXX_UNUSED, + BACT_POSTER, + BACT_ARENA_RULES, + BACT_ARENA, + BACT_ARENA_LEGENDS, + BACT_IN_BETWEEN, + BACT_GAMBLE_RULES, + BACT_CRAPS, + BACT_SPIN_WHEEL, + BACT_DICE_SLOTS, + BACT_REST, + BACT_FOOD, + BACT_RUMORS, + BACT_RESEARCH_MONSTER, + BACT_COMPARE_WEAPONS, + BACT_LEGENDS, + BACT_ENCHANT_WEAPON, + BACT_ENCHANT_ARMOR, + BACT_RECHARGE, + BACT_IDENTS, + BACT_LEARN, + BACT_HEALING, + BACT_RESTORE, + BACT_ENCHANT_ARROWS, + BACT_ENCHANT_BOW, + BACT_GREET, + BACT_RECALL, + BACT_TELEPORT_LEVEL, + BACT_LOSE_MUTATION, + BACT_BATTLE, + BACT_TSUCHINOKO, + BACT_TARGET, + BACT_KUBI, + BACT_KANKIN, + BACT_HEIKOUKA, + BACT_TELE_TOWN, + BACT_POKER, + BACT_IDENT_ONE, + BACT_RECHARGE_ALL, + BACT_EVAL_AC, +#ifdef EXTEND_WEAPON + BACT_LIST_MAGIC_DEVICES, + BACT_DISPLAY_WEAPONS, +#endif + MAX_BACT, +}; /* * Quest status