「JavaScriptでセクション移動」の編集履歴(バックアップ)一覧はこちら

JavaScriptでセクション移動」(2012/04/03 (火) 15:11:38) の最新版変更点

追加された行は緑色になります。

削除された行は赤色になります。

<p> さて、本来ならゲームブックで一番先に説明をするはずの、セクション移動の関数について説明します。switch分岐が基本ですが、サイコロにsetTimeout()関数を使っているので、話は少しややこしくなります。</p> <p> セクション<br />  &lt;input id="input_Section" type="text" size="8" value="0"&gt;<br />  &lt;input type="button" value="GoTo" onClick="click_goto()"&gt;</p> <p>ユーザーが、input_Section のテキストボックスに何か入力して、「GoTo」ボタンをクリックします。するとclick_goto()関数が実行されます。click_goto()関数は、戦闘中でなければセクション制御関数Section.ctrl()を呼び出します。テキストボックスの中身は文字列として扱われる仕様なので、プログラム内部ではセクション番号 Section.num は数値ではなく文字列です。そのほうが夢時間セクションや、マーリンの隠れ家、『逃亡』など単なる数字では表現しにくいセクションも表現できるので好都合だったりします。また、セクションを移動するたびに毒で生命点を失ったり、セクションに移動する前に使う必要のある魔法(具体的には友好の仮面)の処理はこのclick_goto() 関数でやっています。</p> <p> function click_goto() {<br />      var input_Section = document.getElementById("input_Section");<br />      if (combat.onCombat === true) {<br />          add_msg("戦闘中にセクションは選べない");<br />      } else {<br />          Section.num = input_Section.value;<br />          add_msg("現在のセクションは" + Section.num);<br />          Section.subnum = 0;<br />          Section.ctrl();<br />      }<br />  <br />      if (Pip.scorpion_poison === true) {<br />          add_msg("サソリの毒で生命点を2点失った。");<br />          Pip.LIFE_POINT -= 2;<br />      }<br />  <br />      Pip.Mask_of_Friendship_currentSection = Pip.Mask_of_Friendship_nextSection;<br />      Pip.Mask_of_Friendship_nextSection = false;<br />      if (Pip.Mask_of_Friendship_currentSection === true) {<br />          data_magic[11].label = "今発動";<br />      } else {<br />          data_magic[11].label = "つける";<br />      }<br />      update_status();<br />  }</p> <p>セクション毎に違う出来事が起きる所作は、このSection.ctrl()関数が戦闘以外全てやっています。サブセクションという数値 Subsection.subnumでセクション内の出来事を細かく区切っています。区切る目安は、サイコロを振るタイミングです。サイコロの動作には、setTimeout()関数が使われているので、区切らないで書くと、setTimeout関数は素通りして以降の行にどんどん進んでしまい、最後まで処理が終わってから思い出したようにsetTimeout関数の中身が実行されるからです。他にも、1セクション内で複雑な条件分岐がある場合には、そのセクションをSection.subnumで細かく分けています。</p> <p> Section.ctrl = function () {<br />     var i, res, decode, found_gold, found_copper, found_pewter;<br />     switch (Section.num) {<br />         case "0":<br />         switch (Section.subnum) {<br />             case 0:<br />                 add_msg("生命点を決める。サイコロ2個を3回振れ。(1回目)");<br />                 add_msg("回るサイコロをクリックすれば、サイコロの目が決まる。");<br />                 Section.subnum++;<br />                 dice.start(2, "Section.ctrl()");<br />                 break;<br />             case 1:<br />                 Pip.starting_LIFE_POINT = dice.dice12pip*4;<br />                 //    add_msg("サイコロ1の目は" + dice.dice1pip);<br />                 //    add_msg("サイコロ2の目は" + dice.dice2pip);<br />                 //    add_msg("dice.dice12pipの値は" + dice.dice12pip);<br />                 add_msg("ピップの仮生命点は " + Pip.starting_LIFE_POINT/4 + " x 4 = " + Pip.starting_LIFE_POINT + "点。");<br />                 add_msg("生命点を決める。サイコロ2個を3回振れ。(2回目)");<br />                 Section.subnum++;<br />                 dice.start(2, "Section.ctrl()");<br />                 break;<br />             case 2:<br />                 Pip.starting_LIFE_POINT = Math.max(dice.dice12pip*4, Pip.starting_LIFE_POINT);<br />                 add_msg("ピップの仮生命点は " + Pip.starting_LIFE_POINT/4 + " x 4 = " + Pip.starting_LIFE_POINT + "点。");<br />                 add_msg("生命点を決める。サイコロ2個を3回振れ。(3回目)");<br />                 Section.subnum++;<br />                 dice.start(2, "Section.ctrl()");<br />                 break;<br />             case 3:<br />                 Pip.starting_LIFE_POINT = Math.max(dice.dice12pip*4, Pip.starting_LIFE_POINT);<br />                 add_msg("ピップの生命点原点は" + Pip.starting_LIFE_POINT/4 + " x 4 = " + Pip.starting_LIFE_POINT + "点に決まった。");<br />                 Pip.max_LIFE_POINT = Math.floor(Pip.starting_LIFE_POINT + Pip.EXPERIENCE_POINT/20 );<br />                 Pip.LIFE_POINT = Pip.max_LIFE_POINT;<br />                 update_status();<br />                 break;<br />         }<br />         break;</p> <p>        case "1":<br />             if (Pip.starting_LIFE_POINT === 0) { // まだ生命点を決めていない<br />                 Section.num = "0";<br />                 click_goto();<br />             }<br />             break;</p> <p>        case "2":<br />             if (Pip.starting_LIFE_POINT === 0) { // まだ生命点を決めていない<br />                 Section.num = "0";<br />                 click_goto();<br />             }<br />             break;</p> <p>        case "3":<br />             if (Pip.starting_LIFE_POINT === 0) { // まだ生命点を決めていない<br />                 Section.num = "0";<br />                 click_goto();<br />             }<br />             break;</p> <p>        case "6":<br />             decode = prompt("恋文から解読した暗号を入力せよ。","");<br />             if (decode === "ギネビア、ナイン") {<br />                 add_msg("正解! 経験値1獲得。女性はギネビア、セクションは9。");<br />                 Pip.EXPERIENCE_POINT++;<br />                 update_status();<br />             }<br />             break;</p> <p>        case "7":<br />         switch (Section.subnum) {<br />             case 0:<br />                 add_msg("戸を修理するのを手伝う。サイコロを2個振れ。");<br />                 Section.subnum++;<br />                 dice.start(2,"Section.ctrl()");<br />                 break;<br />             case 1:<br />                 if (dice.dice12pip &gt;= 10) {<br />                     add_msg("なんとか戸を直した。28へ行け。");<br />                 } else {<br />                     add_msg("戸は直らない。サイコロを2個振れ。");<br />                     dice.start(2, 'Section.ctrl()');<br />                 }<br />                 break;<br />             }<br />             break;</p> <p>        case "8":<br />             get_event("治療薬", 18);<br />             break;</p> <p>        case "9":<br />             decode = prompt("荷札から解読した暗号を入力せよ。","");<br />             if (decode === "FORTYTHREE" || decode === "43") {<br />                 add_msg("正解! 経験値1獲得。43へ行け。");<br />                 Pip.EXPERIENCE_POINT++;<br />                 update_status();<br />             }<br />             break;</p> <p>        case "10":<br />             get_event("羊皮紙",1);<br />             break;</p> <p>        case "11":<br />             add_msg("食料はあるか? なければマーリンの隠れ家へ戻って探せ。");<br />             break;</p> <p>        case "13":<br />             decode = prompt("山脈のなかの矢印を指でなぞって、次の飛び先のセクションを探り出せ。","");<br />             if (decode === "89") {<br />                 add_msg("正解! 経験値1獲得。89へ行け。");<br />                 Pip.EXPERIENCE_POINT++;<br />                 update_status();<br />             }<br />             break;</p> <p>        case "14":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     add_msg("新しい生命点を決める。サイコロ2個を振れ。(1回のみ)");<br />                     dice.die1pip = 0;<br />                     dice.die2pip = 0;<br />                     dice.die3pip = 0;<br />                     Section.subnum++;<br />                     dice.start(2, "Section.ctrl()");<br />                     break;<br />                 case 1:<br />                     Pip.starting_LIFE_POINT = dice.dice12pip*4;<br />                     clear_event();<br />                     clear_equip();<br />                     clear_magic();<br />                     update_status();<br />                     add_msg("さあ元気に3から出発ッ-!");<br />                     break;</p> <p>            }<br />             break;</p> <p>        case "16":<br />             add_msg("黒衣の祭司が巨石の前に立っている。");<br />             combat.encounter(); // 黒衣の祭司<br />             break;</p> <p>        case "17":<br />             add_msg("砂のドラゴンが猛烈な勢いでこっちに向かって突進してくる。");<br />             combat.encounter(); // 砂のドラゴン<br />             break;</p> <p>        case "18":<br />             get_event("ノコギリ草", 1);<br />             break;</p> <p>        case "19":<br />             res = confirm("野蛮人に降伏するか?");<br />             if (res===true) {<br />                 add_msg("魔法とE・J以外のすべての装備品を失った。");<br />                 clear_event();<br />                 clear_equip();<br />                 update_status();<br />             } else {<br />                 add_msg("それでは野蛮人を闘うぞ。");<br />                 combat.encounter(); // 野蛮人<br />             }<br />             break;</p> <p>        case "20":<br />             add_msg("狼は手強いぞ、心してかかれ。");<br />             combat.encounter(); // 狼<br />             break;</p> <p>        case "22":<br />             get_event("警告球", 1);<br />             break;</p> <p>        case "23":<br />             if (Pip.starting_LIFE_POINT === 0) {<br />                 Section.num = "0";<br />                 click_goto();<br />             }<br />             break;</p> <p>        case "30":<br />             get_event("ルビー", 1);<br />             break;</p> <p>        case "33":<br />             add_msg("く、首に、ボルトが刺さってる!");<br />             Pip.LIFE_POINT -= 3;<br />             update_status();<br />             get_event("首に刺さったボルト", 1);<br />             get_event("眠り玉", 1);<br />             break;</p> <p>        case "34":<br />             get_event("治療薬", 18);<br />             get_event("眠り玉", 1);<br />             break;</p> <p>        case "35":<br />             add_msg("澄んだ美しい水をすくって口にふくむと、元気が出てきた。");<br />             Pip.LIFE_POINT = Math.min(Pip.LIFE_POINT + 2, Pip.max_LIFE_POINT);<br />             update_status();<br />             break;</p> <p>        case "36":<br />             switch (Section.subnum) {<br />                 case 0:<br />                 res = confirm("水晶の結晶板を持っているか?");<br />                     if (res===true) {<br />                         add_msg("三つ目獣は立ちどまって釘付けになった。42に行け。");<br />                     } else {<br />                         add_msg("やっかいだが三つ目獣と闘わなければならぬ。");<br />                         combat.encounter(); // 三つ目獣<br />                     }<br />                     break;<br />                 case 1:<br />                     add_msg("うっかり三つ目獣を殺してしまった。小人の兵士ベンが襲いかかってきた。");<br />                     combat.encounter(); // 小人の兵士ベン<br />                     break;<br />             }<br />             break;</p> <p>        case "39":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     res = confirm("川の南岸に上陸を試みるか?");<br />                     if (res===true) {<br />                         add_msg("サイコロを2個振れ。");<br />                         Section.subnum++;<br />                         dice.start(2, "Section.ctrl()");<br />                     } else {<br />                         // do_nothing<br />                     }<br />                     break;<br />                 case 1:<br />                     if (dice.dice12pip &gt;= 4) {<br />                         add_msg("大成功、81へ行ける。");<br />                     } else {<br />                         add_msg("筏がひっくりかえって激流にのまれ……溺死、14へ。");<br />                     }<br />                     break;<br />             }<br />             break;</p> <p>        case "41":<br />             res = confirm("3人の盗賊と闘うか?");<br />             if (res===true) {<br />                 combat.encounter(); // 盗賊<br />             } else {<br />             }<br />             break;</p> <p>        case "42":<br />             get_event("ブロンの歯", 1);<br />             break;</p> <p>        case "46":<br />             add_msg("きみはすばやく男の喉もとを殴り、先制攻撃権を得た。");<br />             combat.encounter(); // 間抜けな百姓with棍棒<br />             break;</p> <p>        case "48":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     add_msg("砂塵のなかをさまよっている。サイコロを2個振れ。");<br />                     Section.subnum++;<br />                     dice.start(2,"Section.ctrl()");<br />                     break;<br />                 case 1:<br />                     if (dice.dice12pip === 2) {<br />                         add_msg("砂嵐から抜けだした。103へ行け。");<br />                     } else if(dice.dice12pip === 4) {<br />                         add_msg("砂嵐から抜けだした。77へ行け。");<br />                     } else if (dice.dice12pip === 7) {<br />                         add_msg("砂嵐から抜けだした。11へ行け。");<br />                     } else if (dice.dice12pip === 12) {<br />                         add_msg("砂嵐から抜けだした。92へ行け。");<br />                     } else {<br />                         add_msg("まだ砂嵐から抜けだせない。サイコロを2個振れ。");<br />                         Pip.LIFE_POINT--;<br />                         update_status();<br />                         dice.start(2,"Section.ctrl()");<br />                     }<br />                     break;<br />             }<br />             break;</p> <p>        case "49":<br />             get_event("ハチミツ", 36);<br />             break;</p> <p>        case "53":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     res = confirm("バネつき靴をはいて、南岸にジャンプするか?");<br />                     if (res===true) {<br />                         add_msg("サイコロを2個振れ。");<br />                         Section.subnum++;<br />                         dice.start(2, "Section.ctrl()");<br />                     } else {<br />                         // do_nothing<br />                     }<br />                     break;<br />                 case 1:<br />                     if (dice.dice12pip &gt;= 7) {<br />                         add_msg("ジャンプ成功、南岸の81へ。");<br />                     } else {<br />                         add_msg("失敗! 川に落ちて激流にのみこまれ、溺死(14)だ。");<br />                     }<br />                     break;<br />             }<br />             break;</p> <p>        case "54":<br />             res = confirm("通行料の金貨300枚を払うか?");<br />             if (res===true) {<br />                 found_gold = -1;<br />                 for (i = 0; i &lt; Pip_event.length; i++) {<br />                     if (data_event[ Pip_event[i].id_num ].name === "金貨") {<br />                         found_gold = i;<br />                     }<br />                 }<br />                 if (found_gold &gt;= 0 &amp;&amp; Pip_event[found_gold].num &gt;= 300) {<br />                     add_msg("虹の橋の通行料を支払った。");<br />                     lose_event("金貨", 300);<br />                 } else {<br />                     add_msg("金貨が足りない!");<br />                 }<br />             } else {<br />                 res = confirm("カメレオン怪人と闘うか?");<br />                 if (res===true){<br />                     combat.encounter(); // カメレオン怪人<br />                 }<br />             }<br />             break;</p> <p>        case "55":<br />             get_event("E・J", 1);<br />             break;</p> <p>        case "56":<br />             res = confirm("巨人と闘うか?");<br />             if (res===true) {<br />                 combat.encounter(); // 巨人<br />             }<br />             break;</p> <p>        case "59":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     if (Section.pip6count === 2) {<br />                         add_msg("6が2回出た。南西の、76へ。");<br />                         Section.pip6count = 0;<br />                         Section.pip4count = 0;<br />                         Section.pip1count = 0;<br />                     } else if (Section.pip4count === 2) {<br />                         add_msg("4が2回出た。西の、47へ。");<br />                         Section.pip6count = 0;<br />                         Section.pip4count = 0;<br />                         Section.pip1count = 0;<br />                     } else if (Section.pip1count === 2) {<br />                         add_msg("1が2回出た。北西の、71へ。");<br />                         Section.pip6count = 0;<br />                         Section.pip4count = 0;<br />                         Section.pip1count = 0;<br />                     } else {<br />                         add_msg("6,4,1が2回出るまでサイコロを1個振れ。");<br />                         Section.subnum++;<br />                         dice.start(2, "Section.ctrl()");<br />                     }<br />                     break;<br />                 case 1:<br />                     if (dice.die1pip === 6) {<br />                         Section.pip6count++;<br />                     } else if (dice.die1pip === 4) {<br />                         Section.pip4count++;<br />                     } else if (dice.die1pip === 1) {<br />                         Section.pip1count++;<br />                     }<br />                     Section.subnum = 0;<br />                     window.setTimeout(Section.ctrl, Section.wait_time);<br />                     break;<br />             }<br />             break;</p> <p>        case "60":<br />             get_event("E・J", 1);<br />             break;</p> <p>        case "65":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     add_msg("野蛮人1の持っている金貨を決める。サイコロを2個振れ。");<br />                     Section.subnum++;<br />                     dice.start(2,"Section.ctrl()");<br />                     break;<br />                 case 1:<br />                     get_event("金貨", dice.dice12pip * 10);<br />                     add_msg("野蛮人2の持っている金貨を決める。サイコロを2個振れ。");<br />                     Section.subnum++;<br />                     dice.start(2,"Section.ctrl()");<br />                     break;<br />                 case 2:<br />                     get_event("金貨", dice.dice12pip * 10);<br />                     add_msg("野蛮人3の持っている金貨を決める。サイコロを2個振れ。");<br />                     Section.subnum++;<br />                     dice.start(2,"Section.ctrl()");<br />                     break;<br />                 case 3:<br />                     get_event("金貨", dice.dice12pip * 10);<br />                     break;<br />             }<br />             break;</p> <p>        case "66":<br />             add_msg("ずんぐりした百姓が、大きな木の棍棒を振りおろしてきた!");<br />             combat.encounter(); // ずんぐりした百姓<br />             break;</p> <p>        case "68":<br />             lose_event("首に刺さったボルト", 1);<br />             break;</p> <p>        case "69":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     res = confirm("通行料の金貨200枚を払うか?");<br />                     if (res===true) {<br />                         found_gold = -1;<br />                         for (i = 0; i &lt; Pip_event.length; i++) {<br />                             if (data_event[ Pip_event[i].id_num ].name === "金貨") {<br />                                 found_gold = i;<br />                             }<br />                         }<br />                         if (found_gold &gt;= 0 &amp;&amp; Pip_event[found_gold].num &gt;= 300) {<br />                             add_msg("虹の橋の通行料を支払った。");<br />                             lose_event("金貨", 300);<br />                         } else {<br />                             add_msg("金貨が足りない!");<br />                         }<br />                     } else {<br />                         res = confirm("'ドロシー'と大声で叫ぶか?");<br />                         if (res===true) {<br />                             add_msg("'ドロシー'と叫ぶ回数を決める。サイコロを1個振れ。");<br />                             Section.subnum++;<br />                             dice.start(1, "Section.ctrl()");<br />                         }<br />                     }<br />                     break;<br />                 case 1:<br />                     Pip.LIFE_POINT -= dice.die1pip;<br />                     update_status();<br />                     break;<br />             }<br />             break;</p> <p>        case "70":<br />             res = confirm("醜い百姓の一団をやっつけるか?");<br />             if (res===true) {<br />                 combat.encounter(); // 醜い百姓<br />             }<br />             break;</p> <p>        case "73":<br />             add_msg("足もとに小さなサソリがいるのに気がつかなかった。");<br />             combat.encounter(); // サソリ<br />             break;</p> <p>        case "75":<br />             add_msg("まぬけな百姓はもはや棍棒を持っていないので、遠慮することはない。");<br />             combat.encounter(); // 間抜けな百姓with素手<br />             break;</p> <p>        case "78":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     add_msg("見て? そこに、デザートに食べるのにちょうどよさそうなのがいるよ!");<br />                     combat.encounter(); // 魔女ミニー<br />                     break;<br />                 case 1:<br />                     combat.encounter(); // 魔女アギー<br />                     break;<br />                 case 2:<br />                     combat.encounter(); // 魔女スクロッグ<br />                     break;<br />             }<br />             break;</p> <p>        case "79":<br />             get_event("金貨", 500*3);<br />             break;</p> <p>        case "80":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     add_msg("サイコロを2個振って川に飛びこめ。");<br />                     Section.subnum++;<br />                     dice.start(2,"Section.ctrl()");<br />                     break;<br />                 case 1:<br />                     if (dice.dice12pip &gt;= 4) {<br />                         add_msg("縄梯子まで、泳ぎついた。");<br />                     } else {<br />                         add_msg("激流にのみこまれて、あえなく溺死だ。……14へ。");<br />                     }<br />                     break;<br />             }<br />             break;</p> <p>        case "81":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     res = confirm("北岸にジャンプするつもりか?");<br />                     if (res===true) {<br />                         add_msg("バネつき靴をはいて、サイコロを2個振れ。");<br />                         Section.subnum++;<br />                         dice.start(2, "Section.ctrl()");<br />                     } else {<br />                         // do_nothing<br />                     }<br />                     break;<br />                 case 1:<br />                     if (dice.dice12pip &gt;= 10) {<br />                         add_msg("大成功、53へ。");<br />                     } else {<br />                         add_msg("川に落ちて溺死、14まで流されろ。");<br />                     }<br />                     break;<br />             }<br />             break;</p> <p>        case "82":<br />             add_msg("襲われたのはたしかだが、姿がまるっきり見えない。");<br />             combat.encounter(); // 見えない敵<br />             break;</p> <p>        case "83":<br />             add_msg("三人の男はみるみる岩棚をよじのぼった。さあ、闘いが始まるぞ!")<br />             combat.encounter(); // 乱暴な百姓<br />             break;</p> <p>        case "84":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     res = confirm("舌が青いか?");<br />                     if (res===true) {<br />                     } else {<br />                         add_msg("嘘をついた罰でパンチの制裁を受ける。サイコロを1個振れ。");<br />                         Section.subnum++;<br />                         dice.start(1, "Section.ctrl()");<br />                     }<br />                     break;<br />                 case 1:<br />                     Pip.LIFE_POINT -= dice.die1pip;<br />                     update_status();<br />                     break;<br />             }<br />             break;</p> <p>        case "85":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     res = confirm("つけ髭をつけているか?");<br />                     if (res===true) {<br />                     } else {<br />                         add_msg("小人のパトロール警官に見つかるかどうか、サイコロを1個振れ。");<br />                         Section.subnum++;<br />                         dice.start(1, "Section.ctrl()");<br />                     }<br />                     break;<br />                 case 1:<br />                     if (dice.die1pip &gt;= 4) {<br />                         add_msg("見つからなかった。無事に奇岩城のセクションに進める。");<br />                     } else {<br />                         add_msg("小人のパトロール警官にでくわした。警官が何人か、サイコロを1個振れ。");<br />                         Section.subnum++;<br />                         dice.start(1, "Section.ctrl()");<br />                     }<br />                     break;<br />                 case 2:<br />                     add_msg("小人のパトロール警官の数は" + dice.die1pip + "人。");<br />                     res = confirm("小人の警官と闘って殺すか?");<br />                     if (res===true) {<br />                         combat.encounter(); // パトロール警官<br />                         break;<br />                     } else {<br />                         res = confirm("この場で、罰金として金貨200枚を支払うか?");<br />                         if (res===true) {<br />                             lose_event("金貨", 200);<br />                         } else {<br />                             add_msg("罰金も払わないし、裁判所に行くのもいやだというのなら、サイコロを2個振れ。");<br />                             Section.subnum++;<br />                             dice.start(2, "Section.ctrl()");<br />                         }<br />                     }<br />                     break;<br />                 case 3:<br />                     if (dice.dice12pip &gt;= 10) {<br />                         add_msg("忠告だけで解放された。");<br />                     } else if (dice.dice12pip &gt;= 7) {<br />                         add_msg("監獄行き、86へ。");<br />                     } else {<br />                         add_msg("不運にも絞首刑だ。");<br />                     }<br />                     break;<br />             }<br />             break;</p> <p>        case "86":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     Pip.LIFE_POINT--;<br />                     res = confirm("脱獄法その1を試みるか?");<br />                     if (res===true) {<br />                         add_msg("天井の穴登りに挑戦だ。サイコロ2個を5回振れ。");<br />                         Section.subnum = 1;<br />                         dice.start(2, "Section.ctrl()");<br />                     } else {<br />                         res = confirm("脱獄法その2を試みるか?");<br />                         if (res===true) {<br />                             Pip.LIFE_POINT -= 5;<br />                             update_status();<br />                             Section.pip_even_count = 0;<br />                             add_msg("錠外しに挑戦だ。サイコロ2個を5回振れ。");<br />                             Section.subnum = 6;<br />                             dice.start(2, "Section.ctrl()");<br />                         } else {<br />                             res = confirm("脱獄法その3を試みるか?");<br />                             if (res===true) {<br />                                 Section.pip20count = 0;<br />                                 Section.warder20count = 0;<br />                                 add_msg("ギャンブルに挑戦だ。きみのサイコロを1個振れ。");<br />                                 Section.subnum = 11;<br />                                 dice.start(1, "Section.ctrl()");<br />                             } else {<br />                                 add_msg("三日間、飲まず食わずで閉じ込められた。サイコロ1個を3回振れ。");<br />                                 Section.subnum = 13;<br />                                 dice.start(1, "Section.ctrl()");<br />                             }<br />                         }<br />                     }<br />                     break;<br />                 case 1:<br />                     if (dice.dice12pip &lt;= 4) {<br />                         Pip.LIFE_POINT -= 10;<br />                         add_msg("転落して生命点を10点失った。");<br />                         update_status();<br />                         Section.subnum = 0;<br />                         window.setTimeout(Section.ctrl, Section.wait_time);<br />                     } else {<br />                         add_msg("1回目成功。2回目のサイコロを振れ。");<br />                         Section.subnum++;<br />                         dice.start(2, 'Section.ctrl()');<br />                     }<br />                     break;<br />                 case 2:<br />                     if (dice.dice12pip &lt;= 4) {<br />                         Pip.LIFE_POINT -= 10;<br />                         add_msg("転落して生命点を10点失った。");<br />                         update_status();<br />                         Section.subnum = 0;<br />                         window.setTimeout(Section.ctrl, Section.wait_time);<br />                     } else {<br />                         add_msg("2回目成功。3回目のサイコロを振れ。");<br />                         Section.subnum++;<br />                         dice.start(2, 'Section.ctrl()');<br />                     }<br />                     break;<br />                 case 3:<br />                     if (dice.dice12pip &lt;= 4) {<br />                         Pip.LIFE_POINT -= 10;<br />                         add_msg("転落して生命点を10点失った。");<br />                         update_status();<br />                         Section.subnum = 0;<br />                         window.setTimeout(Section.ctrl, Section.wait_time);<br />                     } else {<br />                         add_msg("3回目成功。4回目のサイコロを振れ。");<br />                         Section.subnum++;<br />                         dice.start(2, 'Section.ctrl()');<br />                     }<br />                     break;<br />                 case 4:<br />                     if (dice.dice12pip &lt;= 4) {<br />                         Pip.LIFE_POINT -= 10;<br />                         add_msg("転落して生命点を10点失った。");<br />                         update_status();<br />                         Section.subnum = 0;<br />                         window.setTimeout(Section.ctrl, Section.wait_time);<br />                     } else {<br />                         add_msg("4回目成功。5回目のサイコロを振れ。");<br />                         Section.subnum++;<br />                         dice.start(2, 'Section.ctrl()');<br />                     }<br />                     break;<br />                 case 5:<br />                     if (dice.dice12pip &lt;= 4) {<br />                         Pip.LIFE_POINT -= 10;<br />                         add_msg("転落して生命点を10点失った。");<br />                         update_status();<br />                         Section.subnum = 0;<br />                         window.setTimeout(Section.ctrl, Section.wait_time);<br />                     } else {<br />                         add_msg("5回目成功。よじ登って、80へ。");<br />                     }<br />                     break;<br />                 case 6:<br />                     if (dice.dice12pip === Math.round(dice.dice12pip/2) * 2) {<br />                         Section.pip_even_count++;<br />                     }<br />                     add_msg("これまでの偶数の出た回数は" + Section.pip_even_count + "回。");<br />                     if (Section.pip_even_count === 3) {<br />                         add_msg("成功、脱獄して、74へ。");<br />                     } else {<br />                     add_msg("2回目のサイコロを振れ。");<br />                     Section.subnum++;<br />                         dice.start(2, 'Section.ctrl()');<br />                     }<br />                     break;<br />                 case 7:<br />                     if (dice.dice12pip === Math.round(dice.dice12pip/2) * 2) {<br />                         Section.pip_even_count++;<br />                     }<br />                     add_msg("これまでの偶数の出た回数は" + Section.pip_even_count + "回。");<br />                     if (Section.pip_even_count === 3) {<br />                         add_msg("成功、脱獄して、74へ。");<br />                     } else {<br />                         add_msg("3回目のサイコロを振れ。");<br />                         Section.subnum++;<br />                         dice.start(2, 'Section.ctrl()');<br />                     }<br />                     break;<br />                 case 8:<br />                     if (dice.dice12pip === Math.round(dice.dice12pip/2) * 2) {<br />                         Section.pip_even_count++;<br />                     }<br />                     add_msg("これまでの偶数の出た回数は" + Section.pip_even_count + "回。");<br />                     if (Section.pip_even_count === 3) {<br />                         add_msg("成功、脱獄して、74へ。");<br />                     } else {<br />                         add_msg("4回目のサイコロを振れ。");<br />                         Section.subnum++;<br />                         dice.start(2, 'Section.ctrl()');<br />                     }<br />                     break;<br />                 case 9:<br />                     if (dice.dice12pip === Math.round(dice.dice12pip/2) * 2) {<br />                     Section.pip_even_count++;<br />                     }<br />                     add_msg("これまでの偶数の出た回数は" + Section.pip_even_count + "回。");<br />                     if (Section.pip_even_count === 3) {<br />                         add_msg("成功、脱獄して、74へ。");<br />                     } else {<br />                         add_msg("5回目のサイコロを振れ。");<br />                         Section.subnum++;<br />                         dice.start(2, 'Section.ctrl()');<br />                     }<br />                     break;<br />                 case 10:<br />                     if (dice.dice12pip === Math.round(dice.dice12pip/2) * 2) {<br />                         Section.pip_even_count++;<br />                     }<br />                     add_msg("これまでの偶数の出た回数は" + Section.pip_even_count + "回。");<br />                     if (Section.pip_even_count === 3) {<br />                         add_msg("成功、脱獄して、74へ。");<br />                     } else if (Section.pip_even_count === 0) {<br />                         add_msg("1回も偶数が出なかった。脱獄がばれて死刑!");<br />                     } else {<br />                         Pip.LIFE_POINT -= 5;<br />                         update_status();<br />                         add_msg("ダイヤル錠は開かなかった。生命点を5点消耗した。");<br />                         Section.subnum = 0;<br />                         window.setTimeout(Section.ctrl, Section.wait_time);<br />                     }<br />                     Section.pip_even_count = 0;<br />                     break;<br />                 case 11:<br />                     Section.pip20count += dice.die1pip;<br />                     if (Section.pip20count === 20) {<br />                         add_msg("ギャンブルに勝った。監獄を開けて逃がしてもらい、74へ。");<br />                     } else if (Section.pip20count &gt; 20) {<br />                         add_msg("きみのサイコロの合計が20を越えてしまった。0からやりなおしだ。");<br />                         Section.pip20count = 0;<br />                     } else {<br />                         add_msg("きみのサイコロの合計は" + Section.pip20count + "。看守のサイコロを1個振れ。");<br />                         Section.subnum = 12;<br />                         dice.start(1, 'Section.ctrl()');<br />                     }<br />                     break;<br />                 case 12:<br />                     Section.warder20count += dice.die1pip;<br />                     if (Section.warder20count === 20) {<br />                         add_msg("ギャンブルに負けた。");<br />                         found_gold = -1;<br />                         for (i = 0; i &lt; Pip_event.length; i++) {<br />                             if (data_event[ Pip_event[i].id_num ].name === "金貨") {<br />                                 found_gold = i;<br />                             }<br />                         }<br />                         if (found_gold &gt;= 0 &amp;&amp; Pip_event[found_gold].num &gt;= 100) {<br />                             add_msg("看守に金貨を100枚渡した。");<br />                             lose_event("金貨", 100);<br />                             Section.subnum = 0;<br />                             window.setTimeout(Section.ctrl, Section.wait_time);<br />                         } else {<br />                             add_msg("金貨が足りない! 脱獄を叫ばれて死刑に。");<br />                         }<br />                     } else if (Section.warder20count &gt; 20) {<br />                         add_msg("看守のサイコロの合計が20を越えた。0からやりなおしだ。");<br />                         Section.warder20count = 0;<br />                     } else {<br />                         add_msg("看守のサイコロの合計は" + Section.warder20count + "。きみのサイコロを1個振れ。");<br />                         Section.subnum = 11;<br />                         dice.start(1, 'Section.ctrl()');<br />                     }<br />                     break;<br />                 case 13:<br />                     Pip.LIFE_POINT -= dice.die1pip;<br />                     add_msg("2回目のサイコロを1個振れ。");<br />                     update_status();<br />                     Section.subnum++;<br />                     dice.start(1, 'Section.ctrl()');<br />                     break;<br />                 case 14:<br />                     Pip.LIFE_POINT -= dice.die1pip;<br />                     add_msg("3回目のサイコロを1個振れ。");<br />                     update_status();<br />                     Section.subnum++;<br />                     dice.start(1, 'Section.ctrl()');<br />                     break;<br />                 case 15:<br />                     Pip.LIFE_POINT -= dice.die1pip;<br />                     update_status();<br />                     break;<br />             }<br />             break;</p> <p>        case "88":<br />             add_msg("値札の金額を計算した。経験値1獲得。");<br />             Pip.EXPERIENCE_POINT++;<br />             get_event("金貨", 20);<br />             break;</p> <p>        case "90":<br />             get_event("サクラの花", 1);<br />             break;</p> <p>        case "91":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     res = confirm("縄梯子をつかんでみるか?");<br />                     if (res===true) {<br />                         add_msg("サイコロを2個振れ。");<br />                         Section.subnum++;<br />                         dice.start(2, "Section.ctrl()");<br />                     } else {<br />                         // do_nothing<br />                     }<br />                     break;<br />                 case 1:<br />                     if (dice.dice12pip &gt;= 5) {<br />                         add_msg("縄梯子にしがみついて、85へよじのぼっていけ。");<br />                     } else {<br />                         add_msg("川に転落して溺れ死んだ。");<br />                     }<br />                     break;<br />             }<br />             break;</p> <p>        case "93":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     res = confirm("問答無用で見張りに斬りかかるか?");<br />                     if (res===true) {<br />                         Section.subnum++;<br />                         add_msg("見張りが何人いるか、サイコロを2個振れ。");<br />                         dice.start(2, "Section.ctrl()");<br />                     }<br />                     break;<br />                 case 1:<br />                     combat.encounter(); // 見張り<br />                     break;<br />             }<br />             break;</p> <p>        case "97":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     get_event("稲妻の矢", 1);<br />                     get_event("魔法のラッパ", 1);<br />                     get_event("ドラゴン・ファイア錠", 2);<br />                     res = confirm("サイコロを1個振るか?");<br />                     if (res===true) {<br />                         Section.subnum = 1;<br />                         dice.start(1, "Section.ctrl()");<br />                     } else {<br />                         add_msg("ではサイコロを2個振れ。");<br />                         Section.subnum = 2;<br />                         dice.start(2, "Section.ctrl()");<br />                     }<br />                     break;<br />                 case 1:<br />                     add_msg("奇数だったら、59へ。偶数だったら、71へ。");<br />                     break;<br />             }<br />             break;</p> <p>        case "100":<br />             get_event("通行許可硬貨", 1);<br />             break;</p> <p>        case "101":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     add_msg("この世のエネルギーに身を任せ、サイコロを1個振れ。");<br />                     Section.subnum++;<br />                     dice.start(1, "Section.ctrl()");<br />                     break;<br />                 case 1:<br />                     if (dice.die1pip === 1) {<br />                         add_msg("1が出た。32へ。");<br />                     } else if (dice.die1pip === 2) {<br />                         add_msg("2が出た。59へ。");<br />                     } else if (dice.die1pip === 3) {<br />                         add_msg("3が出た。13へ。");<br />                     } else if (dice.die1pip === 4) {<br />                         add_msg("4が出た。99へ。");<br />                     } else if (dice.die1pip === 5) {<br />                         add_msg("5が出た。58へ。");<br />                     } else {<br />                         add_msg("乱気流に巻き込まれ、手、足、胴がバラバラになった。14へ。");<br />                     }<br />                     break;<br />             }<br />             break;</p> <p>        case "105":<br />             add_msg("「魔獣王国にようこそ!」");<br />             combat.encounter(); // 食屍鬼<br />             break;</p> <p>        case "106":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     get_event("象牙の杖", 1);<br />                     add_msg("泳いで戻る。サイコロを1個振れ。");<br />                     Section.subnum++;<br />                     dice.start(1, "Section.ctrl()");<br />                     break;<br />                 case 1:<br />                     if (dice.die1pip &gt;= 3) {<br />                         add_msg("成功、北の40へ向かえ。");<br />                     } else {<br />                         add_msg("溺死して、14へ直行だ。");<br />                     }<br />                     break;<br />             }<br />             break;</p> <p>        case "107":<br />             get_event("音楽堂のチケット", 1);<br />             break;</p> <p>        case "110":<br />             add_msg("「罪人だ」「間違いない」");<br />             combat.encounter(); // 僧<br />             break;</p> <p>        case "111":<br />             decode = prompt("巨石の謎の道しるべの意味は?","");<br />             if (decode === "GOTO 128") {<br />                 add_msg("正解! 経験値1獲得。128へ行け。");<br />                 Pip.EXPERIENCE_POINT++;<br />                 update_status();<br />             }<br />             break;</p> <p>        case "114":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     res = confirm("悪魔の落とし子と闘うか?");<br />                     if (res===true) {<br />                         combat.encounter(); // 悪魔の落とし子<br />                     } else {<br />                         add_msg("一か八か泳いで逃げる。サイコロを1個振れ。");<br />                         Section.subnum++;<br />                         dice.start(1, "Section.ctrl()");<br />                     }<br />                     break;<br />                 case 1:<br />                     if (dice.die1pip &gt;= 3) {<br />                         add_msg("成功、北の40へ向かえ。");<br />                     } else {<br />                         add_msg("溺れてしまった。14へ。");<br />                     }<br />                     break;<br />             }<br />             break;</p> <p>        case "116":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     res = confirm("ブロンの歯を持っているか?");<br />                     if (res===true) {<br />                         add_msg("ブロンは近づくが、襲ってこなかった。");<br />                     } else {<br />                         add_msg("ブロンが何匹いるか、サイコロを1個振れ。");<br />                         Section.subnum++;<br />                         dice.start(1, "Section.ctrl()");<br />                     }<br />                     break;<br />                 case 1:<br />                     combat.encounter(); // ブロン<br />                     break;<br />             }<br />             break;</p> <p>        case "117":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     add_msg("稼いだ金貨はいくらか、サイコロを2個振れ。");<br />                     Section.subnum++;<br />                     dice.start(2,"Section.ctrl()");<br />                     break;<br />                 case 1:<br />                     get_event("金貨", dice.dice12pip * 100);<br />                     break;<br />             }<br />             break;</p> <p>        case "120":<br />             res = confirm("金貨500枚を要求されたか?");<br />             if (res===true) {<br />                 found_gold = -1;<br />                 for (i = 0; i &lt; Pip_event.length; i++) {<br />                     if (data_event[ Pip_event[i].id_num ].name === "金貨") {<br />                          found_gold = i;<br />                     }<br />                 }<br />                 if (found_gold &gt;= 0 &amp;&amp; Pip_event[found_gold].num &gt;= 500) {<br />                     add_msg("詩的魔神にワイロを支払った。");<br />                     lose_event("金貨", 500);<br />                 } else {<br />                     add_msg("金貨が足りない!");<br />                 }<br />             }<br />             break;</p> <p>        case "123":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     add_msg("川に投げ込まれた! 急いでサイコロを1個振れ!");<br />                     Section.subnum++;<br />                     dice.start(1, "Section.ctrl()");<br />                     break;<br />                 case 1:<br />                     if (dice.die1pip === 1 || dice.die1pip === 6) {<br />                         add_msg("縄梯子につかまった。サイコロ2個だけ生命点を消耗する。サイコロを2個振れ。");<br />                         Section.subnum++;<br />                         dice.start(2, "Section.ctrl()");<br />                     } else {<br />                         add_msg("激流にのみこまれて、あえなく溺死……14へ。");<br />                     }<br />                     break;<br />                 case 2:<br />                     Pip_LIFE_POINT -= dice.dice12pip;<br />             }<br />             break;</p> <p>        case "125":<br />             get_event("八角形の合金の硬貨", 1);<br />             break;</p> <p>        case "129":<br />             add_msg("「とまれ!」きみは逃走中の小人に襲いかかった。");<br />             combat.encounter(); // こそ泥サム<br />             break;</p> <p>        case "131":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     combat.encounter(); // アドルフ<br />                     break;<br />                 case 1:<br />                         add_msg("造船所の賃金はいくらか、サイコロを1個振れ。");<br />                         Section.subnum++;<br />                         dice.start(1, "Section.ctrl()");<br />                     break;<br />                 case 2:<br />                     get_event("金貨", dice.die1pip * 2 * 100);<br />                     add_msg("最後の日に給料を受け取るために、170へ。");<br />                     break;<br />             }<br />             break;</p> <p>        case "132":<br />             get_event("楕円のメダル", 1);<br />             break;</p> <p>        case "134":<br />             get_event("博物館のチケット", 1);<br />             break;</p> <p>        case "136":<br />             get_event("八角形の合金の硬貨", 1);<br />             break;</p> <p>        case "138":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     add_msg("洗濯から解放された。くだびれきって生命点を失う。サイコロを1個振れ。");<br />                     Section.subnum++;<br />                     dice.start(1, "Section.ctrl()");<br />                     break;<br />                 case 1:<br />                     Pip.LIFE_POINT -= dice.die1pip;<br />                     update_status();<br />                     break;<br />             }<br />             break;</p> <p>        case "143":<br />             get_event("八角形の銅貨", 1);<br />             break;</p> <p>        case "144":<br />             get_event("楕円のメダル", 1);<br />             break;</p> <p>        case "145":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     res = confirm("問答無用で見張りに斬りかかるか?");<br />                     if (res===true) {<br />                         Section.subnum++;<br />                         add_msg("見張りが何人いるか、サイコロを2個振れ。");<br />                         dice.start(2, "Section.ctrl()");<br />                     }<br />                     break;<br />                 case 1:<br />                     combat.encounter(); // 見張り<br />                     break;<br />             }<br />             break;</p> <p>        case "146":<br />             add_msg("マオ同志との4回戦を始める。");<br />             combat.encounter(); // マオ<br />             break;</p> <p>        case "147":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     add_msg("この世のエネルギーに身を任せ、サイコロを1個振れ。");<br />                     Section.subnum++;<br />                     dice.start(1, "Section.ctrl()");<br />                     break;<br />                 case 1:<br />                     if (dice.die1pip === 1) {<br />                         add_msg("1が出た。54へ。");<br />                     } else if (dice.die1pip === 2) {<br />                         add_msg("2が出た。48へ。");<br />                     } else if (dice.die1pip === 3) {<br />                         add_msg("3が出た。13へ。");<br />                     } else if (dice.die1pip === 4) {<br />                         add_msg("4が出た。59へ。");<br />                     } else if (dice.die1pip === 5) {<br />                         add_msg("5が出た。58へ。");<br />                     } else {<br />                         add_msg("乱気流に巻き込まれ、手足がバラバラになった。14へ。");<br />                     }<br />                     break;<br />             }<br />             break;</p> <p>        case "149":<br />             add_msg("袋だたきにされ、生命点を3点失ったすえに、投獄されてしまった……86へ。");<br />             Pip.LIFE_POINT -= 3;<br />             update_status();<br />             break;</p> <p>        case "154":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     res = confirm("警官と闘うか?");<br />                     if (res===true) {<br />                         combat.encounter(); // 警官<br />                     } else {<br />                         res = confirm("罰金として金貨を全部渡すか?");<br />                         if (res===true) {<br />                             for (i = 0; i &lt; Pip_event.length; i++) {<br />                                 if (data_event[ Pip_event[i].id_num ].name === "金貨") {<br />                                     add_msg("警官に金貨を全部渡した。");<br />                                     Pip_event[i].num = 0;<br />                                 }<br />                             }<br />                         } else {<br />                             res = confirm("裁判所に行くか?");<br />                             if (res===true) {<br />                             } else {<br />                                 add_msg("罰金も裁判もごめんなら、サイコロを2個振れ。");<br />                                 Section.subnum++;<br />                                 dice.start(2, "Section.ctrl()");<br />                             }<br />                         }<br />                     }<br />                     break;<br />                 case 1:<br />                     if (dice.dice12pip &gt;= 10) {<br />                         add_msg("忠告だけで解放された。");<br />                     } else if (dice.dice12pip &gt;= 7) {<br />                         add_msg("E・Jを除く魔法の品をすべて没収された。");<br />                         clear_magic();<br />                         update_status();<br />                     } else {<br />                         add_msg("監獄に放り込まれる――86へ。");<br />                     }<br />                     break;<br />             }<br />             break;</p> <p>        case "156":<br />             decode = prompt("天井に押しつぶされる前に、暗号を入力せよ。","");<br />             if (decode === "GOTO 105") {<br />                 add_msg("正解! 経験値1獲得。105へ行け。");<br />                 Pip.EXPERIENCE_POINT++;<br />                 update_status();<br />             }<br />             break;</p> <p>        case "159":<br />             lose_event("八角形の合金の硬貨", 1);<br />             break;</p> <p>        case "160":<br />             get_event("八角形の銅貨", 1);<br />             break;</p> <p>        case "161":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     add_msg("急いでサイコロを2個振れ。");<br />                     Section.subnum++;<br />                     dice.start(2, "Section.ctrl()");<br />                     break;<br />                 case 1:<br />                     if (dice.dice12pip &gt;= 7) {<br />                         get_event("八角形の合金の硬貨", 1);<br />                     } else {<br />                         add_msg("177へ。");<br />                     }<br />                     break;<br />             }<br />             break;</p> <p>        case "162":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     add_msg("バーテンのサイコロを1個振れ。");<br />                     Section.subnum++;<br />                     dice.start(1, "Section.ctrl()");<br />                     break;<br />                 case 1:<br />                     enemy_party.quick = dice.die1pip;<br />                     add_msg("きみのサイコロを1個振れ。");<br />                     Section.subnum++;<br />                     window.setTimeout("dice.start(1, 'Section.ctrl()');", Section.wait_time);<br />                     break;<br />                 case 2:<br />                     Pip.quick = dice.die1pip;<br />                     if (Pip.quick &gt; enemy_party.quick) {<br />                         add_msg("サイコロ賭博に勝った。");<br />                         get_event("八角形の合金の硬貨", 1);<br />                     } else if (Pip.quick &lt; enemy_party.quick) {<br />                         add_msg("サイコロ賭博に負けた。酒をおごってやれ。");<br />                     } else {<br />                         add_msg("引き分けだ。もう一回やりなおし。");<br />                         Section.num = 0;<br />                         window.setTimeout(Section.ctrl, Section.wait_time);<br />                     }<br />             }<br />             break;</p> <p>        case "164":<br />             get_event("八角形の銅貨", 1);<br />             break;</p> <p>        case "166":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     add_msg("見張りに気づかれずに逃走できるかどうか、サイコロを2個振ってみろ。");<br />                     Section.subnum++;<br />                     dice.start(2, "Section.ctrl()");<br />                     break;<br />                 case 1:<br />                     if (dice.dice12pip &gt;= 5) {<br />                         add_msg("みごと脱走した。城のほかの場所をあたれ。");<br />                     } else {<br />                         add_msg("逮捕されてまた監獄に放り込まれる、86へ。");<br />                     }<br />                     break;<br />             }<br />             break;</p> <p>        case "167":<br />             add_msg("十字架扉の魔法を解いた。経験値1獲得。");<br />             Pip.EXPERIENCE_POINT++;<br />             update_status();<br />             get_event("八角形の合金の硬貨", 1);<br />             break;</p> <p>        case "168":<br />             lose_event("金貨", 1);<br />             break;</p> <p>        case "170":<br />             lose_event("金貨", 10);<br />             get_event("八角形の銅貨", 1);<br />             break;</p> <p>        case "171":<br />             get_event("エクスカリバー", 1);<br />             add_msg("ワニガエル獣は手強いぞ、ピップ。");<br />             res = confirm("象牙の杖とルビーを持っているか?");<br />             if (res===true) {<br />                 enemy_data[31].LIFE_POINT = enemy_data[31].max_LIFE_POINT - 40; // ワニガエル獣<br />             }<br />             combat.encounter(); // ワニガエル獣<br />             break;</p> <p>        case "172":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     add_msg("こしょうプリンを平らげるぞ、サイコロを2個振れ。");<br />                     Section.subnum++;<br />                     dice.start(2, "Section.ctrl()");<br />                     break;<br />                 case 1:<br />                     if (dice.dice12pip === 12) {<br />                         add_msg("悪夢の食事を終えた。135へ。");<br />                     } else if (dice.dice12pip === 8) {<br />                         add_msg("こしょうのために大くしゃみをして、つけ髭を落とし、ただちに警察に通報されて、監獄に放り込まれる。――86へ。");<br />                     } else {<br />                         add_msg("まだ食べ終えられない。もう一度サイコロを2個振れ。");<br />                         dice.start(2, 'Section.ctrl()');<br />                     }<br />                     break;<br />             }<br />             break;</p> <p>        case "175":<br />             get_event("八角形の合金の硬貨", 1);<br />             break;</p> <p>        case "177":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     add_msg("コソ泥がばれて、85の橋から川へ投げ落とされた! サイコロを2個振れ。");<br />                     Section.subnum++;<br />                     dice.start(2,"Section.ctrl()");<br />                     break;<br />                 case 1:<br />                     if (dice.dice12pip &gt;= 6) {<br />                         add_msg("無事に縄梯子にしがみついてよじのぼれた。");<br />                     } else {<br />                         add_msg("川にまっさかさまに転落し、岩のように沈んで、14へ。");<br />                     }<br />                     break;<br />             }<br />             break;</p> <p>        case "178":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     add_msg("見張りに気づかれずに逃走できるかどうか、サイコロを2個振ってみろ。");<br />                     Section.subnum++;<br />                     dice.start(2, "Section.ctrl()");<br />                     break;<br />                 case 1:<br />                     if (dice.dice12pip &lt;= 4) {<br />                         add_msg("逮捕されて監獄に逆戻りだ、86へ。");<br />                     } else {<br />                         add_msg("みごと脱走した。城のほかの場所に行ける。");<br />                     }<br />                     break;<br />             }<br />             break;</p> <p>        case "180":<br />             for (i = 0; i &lt; Pip_event.length; i++) {<br />                 if (data_event[ Pip_event[i].id_num ].name === "金貨") {<br />                     lose_event("金貨", Math.floor(Pip_event[i].num));<br />                 }<br />             }<br />             add_msg("金貨を半分盗まれた。");<br />             found_copper = -1;<br />             found_pewter = -1;<br />             for (i = 0; i &lt; Pip_event.length; i++) {<br />                 if (data_event[ Pip_event[i].id_num ].name === "八角形の銅貨") {<br />                     found_copper = i;<br />                 } else if (data_event[ Pip_event[i].id_num ].name === "八角形の合金の硬貨") {<br />                     found_pewter = i;<br />                 }<br />             }<br />             if (found_copper &gt; 0 &amp;&amp; found_pewter &gt; 0) {<br />                 res = confirm("八角形のコインを1枚盗まれた。銅貨を失ったことにするか?");<br />                 if (res===true) {<br />                     lose_event("八角形の銅貨", 1);<br />                 } else {<br />                     lose_event("八角形の合金の硬貨", 1);<br />                 }<br />             } else if (found_copper &gt; 0 &amp;&amp; found_pewter &lt; 0) {<br />                 lose_event("八角形の銅貨", 1);<br />             } else if (found_copper &lt; 0 &amp;&amp; found_pewter &gt; 0) {<br />                 lose_event("八角形の合金の硬貨", 1);<br />             }<br />             break;</p> <p>        case "190":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     add_msg("頭上からギロチンの刃が落ちてきた! 急いでサイコロを1個振れ。");<br />                     Section.subnum++;<br />                     dice.start(1, "Section.ctrl()");<br />                     break;<br />                 case 1:<br />                     if (dice.die1pip === 1 || dice.die1pip === 6) {<br />                         add_msg("運よくかわせた。");<br />                     } else if (dice.die1pip === 2 || dice.die1pip === 5) {<br />                         add_msg("傷を負って生命点を3点失った。");<br />                         Pip.LIFE_POINT -= 3;<br />                         update_status();<br />                     } else {<br />                         add_msg("首と胴がまっぷたつになって……14へ。");<br />                     }<br />                     break;<br />             }<br />             break;</p> <p>        case "194":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     add_msg("下からサッと槍が3本突き出てきた! 槍1本につきサイコロを2個振れ。");<br />                     Section.subnum++;<br />                     dice.start(2, "Section.ctrl()");<br />                     break;<br />                 case 1:<br />                     if (dice.dice12pip === 4) {<br />                         add_msg("あわれ串刺し!");<br />                     } else {<br />                         add_msg("2本目の槍につきサイコロを2個振れ。");<br />                         Section.subnum++;<br />                         dice.start(2, "Section.ctrl()");<br />                     }<br />                     break;<br />                 case 2:<br />                     if (dice.dice12pip === 4) {<br />                         add_msg("あわれ串刺し!");<br />                     } else {<br />                         add_msg("3本目の槍につきサイコロを2個振れ。");<br />                         Section.subnum++;<br />                         dice.start(2, "Section.ctrl()");<br />                     }<br />                     break;<br />                 case 3:<br />                     if (dice.dice12pip === 4) {<br />                         add_msg("あわれ串刺し!");<br />                     } else {<br />                         add_msg("3本ともよけきれた。185へ。");<br />                     }<br />                     break;<br />             }<br />             break;</p> <p>        case "200":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     add_msg("いきなり左右から鉄串が飛びだしてきた! サイコロ2個を急いで振れ。");<br />                     Section.subnum++;<br />                     dice.start(2, "Section.ctrl()");<br />                     break;<br />                 case 1:<br />                     if (dice.dice12pip === 7 || dice.dice12pip === 11) {<br />                         add_msg("鉄串はきみの脇腹を貫通する!――14へ。");<br />                     } else {<br />                         add_msg("鉄串をかわした。220へ。");<br />                     }<br />                     break;<br />             }<br />             break;</p> <p>        case "206":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     add_msg("左右の戸口から鉄串が飛びだしてきた! サイコロ2個を急いで振れ。");<br />                     Section.subnum++;<br />                     dice.start(2, "Section.ctrl()");<br />                     break;<br />                 case 1:<br />                     if (dice.dice12pip === 7) {<br />                         add_msg("鉄串はきみの脇腹を貫通!――14へ。");<br />                     } else {<br />                         add_msg("助かった。209へ。");<br />                     }<br />                     break;<br />             }<br />             break;</p> <p>        case "212":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     add_msg("足元にピンと張られていたワイヤーに足をとられた! サイコロを1個振れ。");<br />                     Section.subnum++;<br />                     dice.start(1, "Section.ctrl()");<br />                     break;<br />                 case 1:<br />                     if (dice.die1pip === 1 || dice.die1pip === 3 || dice.die1pip === 5) {<br />                         add_msg("ワイヤーにひっかかって転倒! サイコロを2個振れ。");<br />                         Section.subnum++;<br />                         dice.start(2, "Section.ctrl()");<br />                     } else {<br />                         add_msg("転ばずにすんだ。222へ。");<br />                     }<br />                     break;<br />                 case 2:<br />                     Pip.LIFE_POINT -= dice.dice12pip;<br />                     update_status();<br />                     add_msg("転んで生命点を" + dice.dice12pip + "点失った。");<br />                     break;<br />             }<br />             break;</p> <p>        case "216":<br />             add_msg("ドスン!! ゼリー・モンスターの上に落ちた。");<br />             combat.encounter(); // ゼリー・モンスター<br />             break;</p> <p>        case "221":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     add_msg("また闇の穴を飛び越えて戻らなくてはならないぞ。気を取り直して、サイコロを2個振れ。");<br />                     Section.subnum++;<br />                     dice.start(2, "Section.ctrl()");<br />                     break;<br />                 case 1:<br />                     if (dice.dice12pip &gt;= 6) {<br />                         add_msg("216へ。");<br />                     } else {<br />                         add_msg("224へ。");<br />                     }<br />                     break;<br />             }<br />             break;</p> <p>        case "226":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     res = confirm("エクスカリバーが本物かニセ物か確かめるか?");<br />                     if (res===true) {<br />                         Section.subnum++;<br />                         add_msg("闇の穴をジャンプして、奥の大理石へ飛べ。サイコロ2個を思いっきり振れ。");<br />                         dice.start(2, "Section.ctrl()");<br />                     }<br />                     break;<br />                 case 1:<br />                     if (dice.dice12pip &gt;= 6) {<br />                         add_msg("221へ。");<br />                     } else {<br />                         add_msg("216へ。");<br />                     }<br />                     break;<br />             }<br />             break;</p> <p>        case "RUNNING":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     add_msg("『逃亡』サイコロを1個振ってみろ!");<br />                     Section.subnum++;<br />                     dice.start(1, "Section.ctrl()");<br />                     break;<br />                 case 1:<br />                     if (dice.die1pip === 1) {<br />                         add_msg("敵に背後から襲われて殺されてしまう――14へ。");<br />                     } else if (dice.die1pip === 2) {<br />                         add_msg("2が出た。24へ。");<br />                     } else if (dice.die1pip === 3) {<br />                         add_msg("3が出た。71へ。");<br />                     } else if (dice.die1pip === 4) {<br />                         add_msg("4が出た。76へ。");<br />                     } else if (dice.die1pip === 5) {<br />                         add_msg("5が出た。19へ。");<br />                     } else {<br />                         add_msg("5が出た。38へ。");<br />                     }<br />                     break;<br />             }<br />             break;</p> <p>        case "M1":<br />             add_msg("固い玄武岩の中にいる。4分たったら14へ行け。");<br />             break;</p> <p>        case "M2":<br />             add_msg("装備品の倉庫だ。ここに来るたびに装備を2つ選べる。");<br />             show_Marlins_equip();<br />             break;</p> <p>        case "M3":<br />             add_msg("マーリンの魔法の品が蓄えられている一室だ。魔法の品を1つだけ選べ。");<br />             show_Marlins_magic();<br />             break;</p> <p>        case "M4":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     add_msg("眠って、サイコロ2個振った分の生命点を回復できる。");<br />                     Section.subnum++;<br />                     dice.start(2, "Section.ctrl()");<br />                     break;<br />                 case 1:<br />                     Pip.LIFE_POINT = Math.min(Pip.LIFE_POINT + dice.dice12pip, Pip.max_LIFE_POINT);<br />                     update_status();<br />                     break;<br />             }<br />             break;</p> <p>        case "M6":<br />             add_msg("いまの生命点の半分を失った。");<br />             Pip.LIFE_POINT = Math.floor(Pip.LIFE_POINT / 2);<br />             update_status();<br />             break;</p> <p>        case "D2":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     res = confirm("笑わせることに失敗したか?");<br />                     if (res===true) {<br />                         Section.subnum++;<br />                         add_msg("サイコロを2個振れ。");<br />                         dice.start(2, "Section.ctrl()");<br />                     }<br />                     break;<br />                 case 1:<br />                     if (dice.dice12pip === Math.round(dice.dice12pip /2) *2) {<br />                         add_msg("笑ってお目覚め。");<br />                     } else {<br />                         add_msg("生命点を10点失って、不快なお目覚め。");<br />                         Pip.LIFE_POINT -= 10;<br />                         update_status();<br />                     }<br />                     break;<br />             }<br />             break;</p> <p>        case "D3":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     add_msg("頭から蝋燭の芯が突き出て、その芯に火がついている。サイコロ1個を4回振れ。");<br />                     Section.subnum++;<br />                     dice.start(1, "Section.ctrl()");<br />                     break;<br />                 case 1:<br />                     if (dice.die1pip === 1) {<br />                         add_msg("火を消せた。");<br />                     } else {<br />                         add_msg("火が消えない。サイコロを1個振れ。(2回目)");<br />                         Section.subnum++;<br />                         dice.start(1, "Section.ctrl()");<br />                     }<br />                     break;<br />                 case 2:<br />                     if (dice.die1pip === 1) {<br />                         add_msg("火を消せた。");<br />                     } else {<br />                         add_msg("火が消えない。サイコロを1個振れ。(3回目)");<br />                         Section.subnum++;<br />                         dice.start(1, "Section.ctrl()");<br />                     }<br />                     break;<br />                 case 3:<br />                     if (dice.die1pip === 1) {<br />                         add_msg("火を消せた。");<br />                     } else {<br />                         add_msg("火が消えない。サイコロを1個振れ。(4回目)");<br />                         Section.subnum++;<br />                         dice.start(1, "Section.ctrl()");<br />                     }<br />                     break;<br />                 case 4:<br />                     if (dice.die1pip === 1) {<br />                         add_msg("火を消せた。");<br />                     } else {<br />                         add_msg("4回とも失敗した。全身がどろどろに溶けて、14へ。");<br />                     }<br />                     break;<br />             }<br />             break;</p> <p>        case "D4":<br />         switch (Section.subnum) {<br />             case 0:<br />                 add_msg("マーリンの寝ている毛布の山をよじ登っている。サイコロを2個振れ。");<br />                 Section.subnum++;<br />                 dice.start(2, "Section.ctrl()");<br />                 break;<br />             case 1:<br />                 if (dice.dice12pip === Math.round(dice.dice12pip/4)*4) {<br />                     add_msg("マーリンが寝返りをうった。毛布の雪崩にあって遭難死!");<br />                 } else {<br />                     add_msg("無事毛布の山を登りきった。");<br />                 }<br />                 break;<br />         }<br />         break;</p> <p>        case "D5":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     add_msg("巨大ドミノが倒れるか、サイコロ1個を3回振れ。(1回目)");<br />                     i = 0;<br />                     Section.subnum++;<br />                     dice.start(1, "Section.ctrl()");<br />                     break;<br />                 case 1:<br />                     if (dice.die1pip === Math.round(dice.die1pip/2)*2) {<br />                         add_msg("偶数が出た。これまでの奇数は" + i + "回。サイコロを1個振れ。(2回目)");<br />                     } else {<br />                         i++;<br />                         add_msg("奇数が出た。これまでの奇数は" + i + "回。サイコロを1個振れ。(2回目)");<br />                     }<br />                     Section.subnum++;<br />                     dice.start(1, "Section.ctrl()");<br />                     break;<br />                 case 2:<br />                     if (dice.die1pip === Math.round(dice.die1pip/2)*2) {<br />                         add_msg("偶数が出た。これまでの奇数は" + i + "回。サイコロを1個振れ。(3回目)");<br />                     } else {<br />                         i++;<br />                         add_msg("奇数が出た。これまでの奇数は" + i + "回。サイコロを1個振れ。(3回目)");<br />                     }<br />                     Section.subnum++;<br />                     dice.start(1, "Section.ctrl()");<br />                     break;<br />                 case 3:<br />                     if (dice.die1pip === Math.round(dice.die1pip/2)*2) {<br />                         add_msg("偶数が出た。これまでの奇数は" + i + "回。");<br />                     } else {<br />                         i++;<br />                         add_msg("奇数が出た。これまでの奇数は" + i + "回。");<br />                     }<br />                     if (i === 2) {<br />                         Pip.LIFE_POINT -= 5;<br />                         update_status();<br />                         add_msg("足を引っかけて巨大ドミノを倒した。下敷きになって、生命点を5点失った。");<br />                     }<br />                     break;<br />             }<br />             break;</p> <p>        case "D7":<br />             add_msg("きみの身体から、するりと骨が抜け出して戦いを挑んできた。");<br />             combat.encounter(); // 骸骨<br />             break;</p> <p>        case "D8":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     add_msg("今まで殺してきた敵の亡霊達がゾロゾロお礼参りにやってきたぞ! 亡霊の数を決めるために、サイコロを1個振れ。");<br />                     Section.subnum++;<br />                     dice.start(1, "Section.ctrl()");<br />                     break;<br />                 case 1:<br />                     combat.encounter(); // 亡霊<br />                     break;<br />             }<br />             break;</p> <p>        case "D9":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     add_msg("耳が異様に大きくなり、パタパタはばたきはじめた。サイコロを1個振れ。");<br />                     Section.subnum++;<br />                     dice.start(1, "Section.ctrl()");<br />                     break;<br />                 case 1:<br />                     if (dice.die1pip &gt;= 5) {<br />                         add_msg("耳はもとにもどった。");<br />                     } else {<br />                         add_msg("失敗した。14まで頭を持っていかれた。");<br />                     }<br />                     break;<br />             }<br />             break;</p> <p>        case "D10":<br />             add_msg("E・Jがプリンになってしまった!");<br />             add_msg("以後2回の戦いに限り、与える被害点は2点になってしまう。");<br />             EJ.pudding = 2;<br />             combat.encounter(); // 骸骨<br />             break;</p> <p>        case "D11":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     add_msg("アーサー王「黒い水を飲む悪魔め!」。サイコロを2個振れ。");<br />                     Section.subnum++;<br />                     dice.start(2, "Section.ctrl()");<br />                     break;<br />                 case 1:<br />                     if (dice.dice12pip === 7) {<br />                         add_msg("アーサー王の誤解が解けた。");<br />                     } else {<br />                         add_msg("もう一度サイコロを振って夢時間セクションを選びなおせ。");<br />                         dice.start(2, "Section.num = 'D' + dice.dice12pip; Section.ctrl()");<br />                     }<br />                     break;<br />             }<br />             break;</p> <p>        case "D12":<br />             switch (Section.subnum) {<br />                 case 0:<br />                     add_msg("ヨガで身体がほどけなくなった! 手のサイコロを1個振れ。");<br />                     i = 0;<br />                     Section.subnum++;<br />                     dice.start(1, "Section.ctrl()");<br />                     break;<br />                 case 1:<br />                     if (dice.die1pip !== Math.round(dice.die1pip/2)*2) {<br />                         i++;<br />                         add_msg("奇数が出た。これまでの奇数は" + i + "回。足のサイコロを1個振れ。");<br />                     } else {<br />                         i++;<br />                         add_msg("偶数が出た。これまでの奇数は" + i + "回。足のサイコロを1個振れ。");<br />                     }<br />                     Section.subnum++;<br />                     dice.start(1, "Section.ctrl()");<br />                     break;<br />                 case 2:<br />                     if (dice.die1pip !== Math.round(dice.die1pip/2)*2) {<br />                         i++;<br />                         add_msg("奇数が出た。これまでの奇数は" + i + "回。頭のサイコロを1個振れ。");<br />                     } else {<br />                         i++;<br />                         add_msg("偶数が出た。これまでの奇数は" + i + "回。頭のサイコロを1個振れ。");<br />                     }<br />                     Section.subnum++;<br />                     dice.start(1, "Section.ctrl()");<br />                     break;<br />                 case 3:<br />                     if (dice.die1pip !== Math.round(dice.die1pip/2)*2) {<br />                         i++;<br />                         add_msg("奇数が出た。これまでの奇数は" + i + "回。胴のサイコロを1個振れ。");<br />                     } else {<br />                         i++;<br />                         add_msg("偶数が出た。これまでの奇数は" + i + "回。胴のサイコロを1個振れ。");<br />                     }<br />                     Section.subnum++;<br />                     dice.start(1, "Section.ctrl()");<br />                     break;<br />                 case 4:<br />                     if (dice.die1pip !== Math.round(dice.die1pip/2)*2) {<br />                         i++;<br />                         add_msg("奇数が出た。以後" + i + "回の戦いだけ、敵に与える被害点が2点マイナスされる。");<br />                     } else {<br />                         i++;<br />                         add_msg("偶数が出た。これまでの奇数は" + i + "回の戦いだけ、敵に与える被害点が2点マイナスされる。");<br />                     }<br />                     Pip.yoga = i;<br />                     break;<br />             }<br />             break;</p> <p><br />     }</p> <p> }<br />  </p>

表示オプション

横に並べて表示:
変化行の前後のみ表示: