--KOEI三国志1 情報表示便利なスクリプト --作成者:魂太郎@regamer --制作日:?2021?/0?2/0?7 --整備してファイルUP日:2025/04/13 --[[ KOEI三国志1用の情報表示系のスクリプトです。 仕様として… ・ゲーム中に登場して死んでしまった武将が全員もれなく次の年の年始に復活します。  死亡時から年齢が一律16歳になり、健康が100の状態で復活します。能力値は死亡直後のままです。  ※スクリプトが稼働している時に亡くなり、復活するまで稼働している間に限ります。 ・便利系や表示系のもの @アウトプットコンソール部分に実況が表示され、  在野からの引き抜き等でゲーム中には表示されなかったものも  アウトプットコンソール側で表示出来るようにしました。 A戦略中の国に在籍している武将一覧を、ゲームとは別のウィンドウでテキスト表示  (未発見武将含)在野武将も表記しております  ※起動の度にウィンドウが追加されますので、以前のウィンドウを逐次消去して下さい B戦略中に地図を開いた画面で、マウカーソルで自国の旗印に持っていくと  その国に武将が何人在籍しているかは表示され、クリックすると  その国を委任することが出来る(本国と現在戦略中の国以外) C戦争中、風向き・現在の経過日数・攻撃側守備側共に兵糧の所持数  を表示する小窓をつくり、Bボタンと十字キーで四隅に移動できる D稼働している間の出来事の実況や、全国・全武将の各月作成報告書が  スクリプトファイルを置いた場所に自動作成されます。  再起動の際に実況がアウトプットコンソールに履歴として載ります。  鬱陶しい方は「KOEI三国志1_報告書履歴.txt」をご削除下さい Eキーボードでゲームを操作出来るようにしました  十字キー:上下左右キー  Aボタン:zキー  Bボタン:xキー  A連射:aキー  B連射:sキー  SELボタン:qキー  STAボタン:wキー F兵の再編成時に、  残りの兵士数表示と誰がどれくらい兵を持っているのか…というのを  武将選択画面時に表示出来るようにしました。 ]] --以下、0でオフ。1でオン。 local click_ininkainin = 1 --地図画面で、クリックで委任・解任が出来るようになる(クリック委任) local kzmknss = 1 --戦闘中に風向きと日数(ターン数)・敵味方の兵糧表示。Bボタン押しっぱなしと十字キーで位置変更可能(戦闘中表示) local hukkatu = 1 --死んだ武将を次年頭に復活させるシステム(年頭復活) local kakuhoukokusyo = 1 --全国・全武将の各月作成報告書(報告書) local keyboad_controll = 0 --キーボードでゲームが動かせる require("auxlib"); --[[ ◆ファンクション説明 busyou(投げる武将番号) ・武将の名前 ・所属君主の名前(在野含む) ・在籍国(現在地) ・所属(君主の武将番号) ・武将在籍国アドレス(10進数)-- ・武将の兵士数 を「busyoudata[]123456]にそれぞれ入力して排出 kunijido(国番号) ・(空白地も含む)勢力名 ・国に所属してる勢力(君主の武将番号) ・太守の武将番号 ・該当国アドレス(10進数):治めている国の君主番号が入るアドレス、が入る(+1で太守・-1で委任などのフラグ) ・その国に居る在野以外の武将数 を「kunidata[12345]」にそれぞれ入力して排出 ]] --◆報告書履歴用 houkokuhis = 0 --◆速報表示用 local frame60 = 0 local stopcount_a, stopcount_b, stopcount_c = 0, 0, 0 local guiflg = 0 --武将移動関係 local hikinuki = 0 local hikinukare = 0 local moto = {0, 0, 0} local saki = {0, 0, 0} local umoto = {0, 0, 0} local battle_co = {0, 0, 0} local khei,shei = 0,0 --総兵士数計算・表示用。(攻撃側・防御側) local topbusyou = {0, 0, 0, 0} local atamakazu = 0 local seme = 0 local taisyu = 0 local nnmtflg = 0 local b_flag = 0 local kunsyu_death = 0--君主が無くなったらオンになる。所属勢力の名前を変えたらオフに。 local idou_bu = 0 local BMF = 0 --別窓を作るフラグ --クリック委任用 local cslnm = nil--マウスカーソルがある所の国番号 local clcof = 0--クリックしたらオンで、離さないとオフにならない -- 君主勢力関係のデータ local kunsyut = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}--武将番号 local player_k = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}--プレイヤー操作の君主に1が入る local pkpk = 0--プレイヤー操作の君主が入る。 -- 現在君主の武将のアドレス。武将番号が載っている。最大で14勢力。 local chr_kunsyu_ad = {0x7107, 0x7137, 0x7167, 0x7197, 0x71C7, 0x71F7, 0x7227, 0x7257, 0x7287, 0x72B7, 0x72E7, 0x7317, 0x7347, 0x7377} for k = 1, 14, 1 do kunsyut[k] = memory.readbyte(chr_kunsyu_ad[k]) player_k[k] = memory.readbyte(chr_kunsyu_ad[k] + 1) end local musyozoku = 0--領地別所属武将一覧テキスト書き出し用 --別窓用? local toujou = 0--* local suigun,mibun = 0,0--* --武将関係データベース chr_name = {" 曹操 ", " 孫堅 ", " 劉備 ", " 袁紹 ", " 袁術 ", " 劉表\ ", " 董卓 ", " 劉焉 ", " 馬騰 ", "公孫サン", "夏候惇", "夏候淵", " 曹仁 ", " 曹洪 ", " 曹昂 ", " 荀ケ ", " 程c ", " 干禁 ", " 典韋 ", " 陳宮 ", " 劉曄 ", " 荀攸 ", " 楽進 ", " 李典 ", " 曹丕 ", " 曹植 ", " 曹叡 ", " 曹休 ", " 曹真 ", " 曹純 ", " 黄蓋 ", " 孫策 ", " 周瑜 ", " 孫権 ", " 韓当 ", " 程普 ", " 朱治 ", " 蒋欽 ", " 周泰 ", " 孫翊 ", " 孫瑜 ", " 孫桓 ", " 関羽 ", " 張飛 ", " 曹豹 ", " 劉禅 ", " 孫乾 ", " 関平 ", " 関興 ", " 劉永 ", " 劉理 ", " 張苞 ", " 劉封 ", " 関索 ", " 陳琳 ", " 顔良 ", " 文醜 ", " 田豊 ", " 審配 ", " 沮授 ", " 郭図 ", " 許収 ", " 高覧 ", "張合β", " 袁譚 ", " 袁煕 ", " 袁尚 ", " 袁胤 ", " 呂範 ", " 張勲 ", " 紀霊 ", " 雷薄 ", " 陳紀 ", " 梁紀 ", " 李豊 ", " 梁剛 ", " 陳蘭 ", " 黄祖 ", " 韓遂 ", " カイ越 ", " 蔡瑁 ", " 呂公 ", " 劉g ", " 劉j ", " 甘寧 ", " 王粲 ", " 張允 ", " 蔡和 ", " 蔡仲 ", " 李儒 ", " 呂布 ", " 李粛 ", " 李カク ", " 蔡ヨウ ", " 郭 ", " 張済 ", " 賈ク ", " 華雄 ", " 樊稠 ", " 徐栄 ", " 胡軫 ", " 趙岑 ", " 董旻 ", " 張松 ", " 法正 ", " 孟達 ", " 黄権 ", " 王累 ", " ケ賢 ", " 張任 ", " 劉璋 ", " 楊懐 ", " 高沛 ", " 劉巴 ", "劉王貴", " 劉循 ", " 呉懿 ", " 呉蘭 ", " 雷同 ", " 厳顔 ", " 馬超 ", " 馬休 ", " 馬鉄 ", " 馬岱 ", " 候選 ", " 程銀 ", " 李湛 ", " 張横 ", " 梁興 ", " 成宜 ", " 馬玩 ", " 楊秋 ", " ホウ徳 ", " 許チョ ", " 劉瑶 ", " 陶謙 ", " 陳登 ", " 陳珪 ", " 糜竺 ", " 徐晃 ", " 孔融 ", " 劉岱 ", "張バク", " 鮑信 ", " 趙雲 ", " 韓暹 ", " 楊奉 ", "太史慈", " 張昭 ", " 張紘 ", " 陳武 ", " 虞翻 ", " 王朗 ", " 魯粛 ", "諸葛謹", " 呂蒙 ", " 陸遜 ", " 陳群 ", " 朱儁 ", " 楊彪 ", " 宋憲 ", " 魏続 ", " 候成 ", " 張遼 ", " 張繍 ", " 周倉 ", " 廖化 ", " 顧雍 ", " 呂曠 ", " 呂翔 ", " 郭嘉 ", " 伊籍 ", " 徐庶 ", "諸葛亮", "司馬懿", " 糜芳 ", " 魏延 ", " 簡雍 ", " 蒋幹 ", " 歩隲 ", " 薛綜 ", " 陸積 ", " 厳o ", " カン沢 ", " 傅幹 ", " 丁奉 ", " 藩璋 ", "毛王介", " ホウ統 ", " 呂虔 ", " 徐盛 ", " 凌統 ", " 馬延 ", "張ガイ", " 陳矯 ", " 牛金 ", " 陳嬉 ", " 馬良 ", " 馬謖 ", " 金旋 ", " 韓玄 ", " 趙範 ", " 劉度 ", " 劉延 ", "刑道栄", " 鮑龍 ", " 陳応 ", " 鞏志 ", " 黄忠 ", " 宋謙 ", " 朱霊 ", " 文聘 ", " 華キン ", " 張既 ", " 張魯 ", " 閻圃 ", " 張衛 ", " 鐘ヨウ ", " 鐘進 ", " 楊修 ", " 楊松 ", "夏候徳", "夏候尚", " 満寵 ", "傅士仁", " 賈逵 ", " 許靖 ", " 呉班 ", "沙摩可", " 孟獲 ", "雍ガイ", " 高定 ", " 朱褒 ", " 呂凱 ", " 孟優 ", "郭攸之", " 費イ ", " 董允 ", " 尚寵 ", "言焦周", " ケ芝 ", "夏候楙", " 姜維 ", " 郭淮 ", " 辛ピ ", "司馬昭", "司馬師", " 蒋エン ", " カク昭 ", " 朱桓 ", " 全j ", " 王双 ", " 王平 ", " 李厳 ", " 楊儀" } chr_place_ad = {0x601C, 0x602D, 0x603E, 0x604F, 0x6060, 0x6071, 0x6082, 0x6093, 0x60A4, 0x60B5, 0x60C6, 0x60D7, 0x60E8, 0x60F9, 0x610A, 0x611B, 0x612C, 0x613D, 0x614E, 0x615F, 0x6170, 0x6181, 0x6192, 0x61A3, 0x61B4, 0x61C5, 0x61D6, 0x61E7, 0x61F8, 0x6209, 0x621A, 0x622B, 0x623C, 0x624D, 0x625E, 0x626F, 0x6280, 0x6291, 0x62A2, 0x62B3, 0x62C4, 0x62D5, 0x62E6, 0x62F7, 0x6308, 0x6319, 0x632A, 0x633B, 0x634C, 0x635D, 0x636E, 0x637F, 0x6390, 0x63A1, 0x63B2, 0x63C3, 0x63D4, 0x63E5, 0x63F6, 0x6407, 0x6418, 0x6429, 0x643A, 0x644B, 0x645C, 0x646D, 0x647E, 0x648F, 0x64A0, 0x64B1, 0x64C2, 0x64D3, 0x64E4, 0x64F5, 0x6506, 0x6517, 0x6528, 0x6539, 0x654A, 0x655B, 0x656C, 0x657D, 0x658E, 0x659F, 0x65B0, 0x65C1, 0x65D2, 0x65E3, 0x65F4, 0x6605, 0x6616, 0x6627, 0x6638, 0x6649, 0x665A, 0x666B, 0x667C, 0x668D, 0x669E, 0x66AF, 0x66C0, 0x66D1, 0x66E2, 0x66F3, 0x6704, 0x6715, 0x6726, 0x6737, 0x6748, 0x6759, 0x676A, 0x677B, 0x678C, 0x679D, 0x67AE, 0x67BF, 0x67D0, 0x67E1, 0x67F2, 0x6803, 0x6814, 0x6825, 0x6836, 0x6847, 0x6858, 0x6869, 0x687A, 0x688B, 0x689C, 0x68AD, 0x68BE, 0x68CF, 0x68E0, 0x68F1, 0x6902, 0x6913, 0x6924, 0x6935, 0x6946, 0x6957, 0x6968, 0x6979, 0x698A, 0x699B, 0x69AC, 0x69BD, 0x69CE, 0x69DF, 0x69F0, 0x6A01, 0x6A12, 0x6A23, 0x6A34, 0x6A45, 0x6A56, 0x6A67, 0x6A78, 0x6A89, 0x6A9A, 0x6AAB, 0x6ABC, 0x6ACD, 0x6ADE, 0x6AEF, 0x6B00, 0x6B11, 0x6B22, 0x6B33, 0x6B44, 0x6B55, 0x6B66, 0x6B77, 0x6B88, 0x6B99, 0x6BAA, 0x6BBB, 0x6BCC, 0x6BDD, 0x6BEE, 0x6BFF, 0x6C10, 0x6C21, 0x6C32, 0x6C43, 0x6C54, 0x6C65, 0x6C76, 0x6C87, 0x6C98, 0x6CA9, 0x6CBA, 0x6CCB, 0x6CDC, 0x6CED, 0x6CFE, 0x6D0F, 0x6D20, 0x6D31, 0x6D42, 0x6D53, 0x6D64, 0x6D75, 0x6D86, 0x6D97, 0x6DA8, 0x6DB9, 0x6DCA, 0x6DDB, 0x6DEC, 0x6DFD, 0x6E0E, 0x6E1F, 0x6E30, 0x6E41, 0x6E52, 0x6E63, 0x6E74, 0x6E85, 0x6E96, 0x6EA7, 0x6EB8, 0x6EC9, 0x6EDA, 0x6EEB, 0x6EFC, 0x6F0D, 0x6F1E, 0x6F2F, 0x6F40, 0x6F51, 0x6F62, 0x6F73, 0x6F84, 0x6F95, 0x6FA6, 0x6FB7, 0x6FC8, 0x6FD9, 0x6FEA, 0x6FFB, 0x700C, 0x701D, 0x702E, 0x703F, 0x7050, 0x7061, 0x7072, 0x7083, 0x7094, 0x70A5, 0x70B6, 0x70C7, 0x70D8, 0x70E9, 0x70FA} -- この武将の現在地を示すアドレスの場所。一番最初が曹操が居る国番号、2番目が孫堅の居る国番号を示す、と言う感じ。 -- このアドレスに +1 すると、この武将が仕えている君主の武将番号が載っている chr_place = {} chr_place_w = {} chr_place_ww = {} chr_deathplace = {} chr_syozoku = {} chr_syozoku_w = {} chr_hei_w = {} --国関係データベース --国の所属勢力記載部分。載ってる番号は君主の武将番号。 coun_adpla = {0x73B4, 0x73CA, 0x73E0, 0x73F6, 0x740C, 0x7422, 0x7438, 0x744E, 0x7464, 0x747A, 0x7490, 0x74A6, 0x74BC, 0x74D2, 0x74E8, 0x74FE, 0x7514, 0x752A, 0x7540, 0x7556, 0x756C, 0x7582, 0x7598, 0x75AE, 0x75C4, 0x75DA, 0x75F0, 0x7606, 0x761C, 0x7632, 0x7648, 0x765E, 0x7674, 0x768A, 0x76A0, 0x76B6, 0x76CC, 0x76E2, 0x76F8, 0x770E, 0x7724, 0x773A, 0x7750, 0x7766, 0x777C, 0x7792, 0x77A8, 0x77BE, 0x77D4, 0x77EA, 0x7800, 0x7816, 0x782C, 0x7842, 0x7858, 0x786E, 0x7884, 0x789A} -- このアドレスに +1 すると太守の名前になる。 coun_att_w = {}--国の所属勢力の前の履歴 coun_tat_w = {}--国の太守…の前の履歴 idou_coun = {}--武将移動システムの移動先選定テーブル --二重テーブルの設定 local chr_tbl_sys = {} --国にいる武将の番号テーブル製作用 --local zaiseki_busyou_tbl = {} --国にいる武将の番号テーブル for bu = 1, 255, 1 do chr_tbl_sys[bu] = nil end local zaiseki_busyousuu = {}--その国の在籍武将数 local zaiseki_busyousuu_z = {}--その国の在野武将数 for co = 1, 58, 1 do coun_att_w[co] = co coun_tat_w[co] = co idou_coun[co] = 0 zaiseki_busyousuu[co] = 0 zaiseki_busyousuu_z[co] = 0 -- zaiseki_busyou_tbl[co] = nil end --クリック委任と、武将移動・引き抜き・戦争用のCG用データ guidata = {{164,40,"1"}, {147,47,"2"}, {116,56,"3"}, {124,72,"4"}, {116,88,"5"}, {132,88,"6"}, {132,104,"7"}, {164,80,"8"}, {148,80,"9"}, {167,104,"10"}, {173,120,"11"}, {149,104,"12"}, {109,120,"13"}, {99,56,"14"}, {70,56,"15"}, {109,72,"16"}, {93,72,"17"}, {101,88,"18"}, {85,88,"19"}, {101,104,"20"}, {69,88,"21"}, {53,88,"22"}, {45,112,"23"}, {45,72,"24"}, {29,88,"25"}, {21,72,"26"}, {21,56,"27"}, {149,136,"28"}, {125,129,"29"}, {109,136,"30"}, {149,152,"31"}, {125,144,"32"}, {109,160,"33"}, {125,160,"34"}, {133,176,"35"}, {117,176,"36"}, {93,128,"37"}, {77,112,"38"}, {93,152,"39"}, {77,136,"40"}, {93,168,"41"}, {77,152,"42"}, {101,184,"43"}, {85,184,"44"}, {61,120,"45"}, {61,144,"46"}, {45,128,"47"}, {29,136,"48"}, {45,152,"49"}, {21,152,"50"}, {53,168,"51"}, {30,168,"52"}, {45,184,"53"}, {21,184,"54"}, {68,184,"55"}, {117,192,"56"}, {86,200,"57"}, {45,200,"58"}} guides = 0 guiplace = {0, 0, 0} chr_mon, chr_mon_a = 0, 0 chr_sea, chr_sea_a = 0, 0 --◆戦闘用表示用データ local wind_ = {"└","↓","┘","┌","↑","┐"} local sx, sy = 0, 0 --◆再編成用武将番号データ群 local zbs = {500} local zbsh = {500} local zbsf = 60 --◇これまでの報告書を一度全部output consoleに表示する kkkkk = io.open("KOEI三国志1_報告書履歴.txt", "a+")--ファイルが無い場合は自動作成、ある場合は開いて閉じるだけ kkkkk:close() birtd = io.open("KOEI三国志1_報告書履歴.txt", "r") while true do houkokuhis = birtd:read("*l") if (houkokuhis == nil) then break end print(houkokuhis) end houkokuhis = 0 birtd:close() --◇以下ファンクションルーチン --***************************************************************************** --◆武将データ変換(1のみ〜6のみ・全部) busyoudata = {0, 0, 0, 0, 0, 0} --◇1 function busyou1(bu) --武将番号を投げ入れると、武将の名前を「 busyoudata[1] 」に入力して排出 busyoudata[1] = chr_name[bu] return end --◇2 function busyou2(bu) --武将番号を投げ入れると、所属君主の名前(在野含む)を「 busyoudata[2] 」に入力して排出 if (memory.readbyte(0x601D + (17 * (bu - 1))) == 0) then busyoudata[2] = " 在野 " else busyoudata[2] = chr_name[(memory.readbyte(0x7107 + (48 * ((memory.readbyte(0x601D + (17 * (bu - 1)))-1)))))] end return end --◇3 function busyou3(bu) --武将番号を投げ入れると、在籍国(現在地)を「 busyoudata[3] 」に入力して排出 busyoudata[3] = (memory.readbyte(0x601C + (17 * (bu - 1)))) return end --◇4 function busyou4(bu) --武将番号を投げ入れると、所属(君主の武将番号)を「 busyoudata[4] 」に入力して排出 if (memory.readbyte(0x601C + (17 * (bu - 1))) == 0) then busyoudata[4] = 0 else if (memory.readbyte(0x601D + (17 * (bu - 1))) == 0) then busyoudata[4] = 0 else busyoudata[4] = (memory.readbyte(0x7107 + (48 * ((memory.readbyte(0x601D + (17 * (bu - 1)))-1))))) end end return end --◇5 function busyou5(bu) --武将番号を投げ入れると、武将在籍国アドレス(10進数)を「 busyoudata[5] 」に入力して排出 busyoudata[5] = 24604 + (17 * (bu - 1)) return end --◇6 function busyou6(bu) --武将番号を投げ入れると、武将の兵士数を「 busyoudata[6] 」に入力して排出 busyoudata[6] = memory.readbyte(0x601B + (17 * (bu - 1)))*256 + memory.readbyte(0x601A + (17 * (bu - 1))) return end --◇全部 function busyou(bu) --[[ 武将番号を投げ入れると、 ・武将の名前 ・所属君主の名前(在野含む) ・在籍国(現在地) ・所属(君主の武将番号) ・武将在籍国アドレス(10進数) ・武将の兵士数を 「 busyoudata[123456] 」にそれぞれ入力して排出 ]] busyou1(bu) busyou2(bu) busyou3(bu) busyou4(bu) busyou5(bu) busyou6(bu) return end --武将データ変換 終わり --***************************************************************************** --▲国データ変換 kunidata = {0, 0, 0, 0, 0} --△1 --[[ 国番号を投げ入れると、 ・(空白地も含む)勢力名 を「kunidata[1]に入力して排出 ]] function kunijido1(co) if (memory.readbyte(0x73B4 + (22 * (co - 1))) == 0) then kunidata[1] = "空白地" else kunidata[1] = chr_name[memory.readbyte(0x7107 + (48 * (memory.readbyte(0x73B4 + (22 * (co - 1)))-1)))] end return end --△2 --[[ 国番号を投げ入れると、 ・国に所属してる勢力(君主の武将番号) を「kunidata[2]に入力して排出 ]] function kunijido2(co) if (memory.readbyte(0x73B4 + (22 * (co - 1))) == 0) then kunidata[2] = 0 else kunidata[2] = memory.readbyte(0x7107 + (48 * (memory.readbyte(0x73B4 + (22 * (co - 1)))-1))) end return end --△3 --[[ 国番号を投げ入れると、 ・太守の武将番号 を「kunidata[3]に入力して排出 ]] function kunijido3(co) kunidata[3] = memory.readbyte(0x73B5 + (22 * (co - 1))) return end --△4 --[[ 国番号を投げ入れると、 ・該当国アドレス(10進数):治めている国の君主番号が入るアドレス、が入る(+1で太守・-1で委任などのフラグ) を「kunidata[4]に入力して排出 ]] function kunijido4(co) kunidata[4] = 29620 + (22 * (co - 1)) return end --△5 --[[ 国番号を投げ入れると、 ・その国に居る在野以外の武将数 を「kunidata[5]に入力して排出 ]] function kunijido5(co) kunidata[5] = 0 for bu = 1, 255, 1 do busyou3(bu)--コルーチン busyou4(bu)--コルーチン if (busyoudata[3] == co and busyoudata[4] ~= 0) then kunidata[5] = kunidata[5] + 1 end end return end --△全部 --[[ 国番号を投げ入れると、 ・(空白地も含む)勢力名 ・国に所属してる勢力(君主の武将番号) ・太守の武将番号 ・該当国アドレス(10進数):治めている国の君主番号が入るアドレス、が入る(+1で太守・-1で委任などのフラグ) ・その国に居る在野以外の武将数 を「kunidata[12345]」にそれぞれ入力して排出 ]] function kunijido(co) kunijido1(co) kunijido2(co) kunijido3(co) kunijido4(co) kunijido5(co) return end --国データ変換 終わり --***************************************************************************** --◇報告書を全て記録する function Report_history()--報告書を全てメモ帳に残す kkkdw = io.open("KOEI三国志1_報告書履歴.txt", "a+") kkkdw:write(houkokuhis) kkkdw:close() return end --***************************************************************************** for bu = 1, 255, 1 do busyou3(bu) busyou4(bu) chr_syozoku[bu] = busyoudata[4] chr_syozoku_w[bu] = busyoudata[4] chr_place[bu] = busyoudata[3] chr_deathplace[bu] = 0 chr_place_w[bu] = busyoudata[3] chr_place_ww[bu] = busyoudata[3] chr_hei_w[bu] = 0 end frame1 = 0 second1 = 0 minute1 = 0 junban = memory.readbyte(0x78b3) --***************************************************************************** --◆戦闘用表示 function sentou_hyouji() if (memory.readbyte(0x006E) ~= 2) then--Bボタンが押されていなかったら gui.drawbox(4 + sx,10 + sy,100 + sx,21 + sy,"#b0b0b0","#0000ff") gui.text(45 + sx,12 + sy,string.format("%02d",memory.readbyte(0x78B0)).."/"..string.format("%02d",memory.readbyte(0x7b8f)) .." now") gui.text(6 + sx,12 + sy,"wind:") gui.drawbox(29 + sx, 6 + sy+6 ,28 + sx+8, 14 + sy +5,"#000040") if (memory.readbyte(0x7b8d)==0) then gui.drawline(29 + sx, 13 + sy+6,30 + sx+5, 13 + sy,"#ffffff") gui.drawline(29 + sx, 13 + sy+3,29 + sx, 13 + sy+6,"#ffffff") gui.drawline(29 + sx, 13 + sy+6,29 + sx+3, 13 + sy+6,"#ffffff") end if (memory.readbyte(0x7b8d)==1) then gui.drawline(33 + sx, 13 + sy,33 + sx, 19 + sy,"#ffffff") gui.drawline(35 + sx, 17 + sy,33 + sx, 19 + sy,"#ffffff") gui.drawline(31 + sx, 17 + sy,33 + sx, 19 + sy,"#ffffff") end if (memory.readbyte(0x7b8d)==2) then gui.drawline(30 + sx, 13 + sy,36 + sx, 19 + sy,"#ffffff") gui.drawline(36 + sx, 13 + sy+3,36 + sx, 13 + sy+6,"#ffffff") gui.drawline(35 + sx, 13 + sy+6,33 + sx, 13 + sy+6,"#ffffff") end if (memory.readbyte(0x7b8d)==3) then gui.drawline(29 + sx, 12 + sy,35 + sx, 18 + sy,"#ffffff") gui.drawline(29 + sx, 13 + sy,29 + sx, 15 + sy,"#ffffff") gui.drawline(30 + sx, 12 + sy,32 + sx, 12 + sy,"#ffffff") end if (memory.readbyte(0x7b8d)==4) then gui.drawline(32 + sx, 12 + sy,32 + sx, 18 + sy,"#ffffff") gui.drawline(34 + sx, 14 + sy,32 + sx, 12 + sy,"#ffffff") gui.drawline(30 + sx, 14 + sy,32 + sx, 12 + sy,"#ffffff") end if (memory.readbyte(0x7b8d)==5) then gui.drawline(30 + sx, 18 + sy,36 + sx, 12 + sy,"#ffffff") gui.drawline(36 + sx, 15 + sy,36 + sx, 12 + sy,"#ffffff") gui.drawline(33 + sx, 12 + sy,36 + sx, 12 + sy,"#ffffff") end if (sy == 0) then--表示が上にある場合は兵糧表示 gui.drawbox(4 + sx,21 + sy,100 + sx,43 + sy,"#b0b0b0","#0000ff") gui.text(8 + sx,23 + sy,"Offence fd.:"..string.format("%05d",memory.readbyte(0x73bb + (memory.readbyte(0x1db8) - 1) * 22) + memory.readbyte(0x73bc + (memory.readbyte(0x1db8) - 1) * 22) * 256 )) gui.text(8 + sx,33 + sy,"Defence fd.:"..string.format("%05d",memory.readbyte(0x73a9 + (memory.readbyte(0x1db8) - 1) * 22) + memory.readbyte(0x73aa + (memory.readbyte(0x1db8) - 1) * 22) * 256 )) end--表示が上にある場合は兵糧表示 else--Bボタンが押されていたら gui.drawbox(4 + sx,10 + sy,92 + sx,31 + sy,"#b0b0b0","#0000ff") gui.text(6 + sx,12 + sy,"move: B button\n and UDLR") end--Bボタンが押されていなかったら if (memory.readbyte(0x006E) == 0x12) then sy = 0 end if (memory.readbyte(0x006E) == 0x22) then sy = 208 end if (memory.readbyte(0x006E) == 0x42) then sx = 0 end if (memory.readbyte(0x006E) == 0x82) then sx = 157 end return end --***************************************************************************** --★報告書システム作成 function Reportwrite() --◆勢力別武将一覧(在野も記載) if (kakuhoukokusyo == 1) then --報告書フラグ for bu = 1, 255, 1 do busyou3(bu)--コルーチン busyou4(bu)--コルーチン if (busyoudata[4] == 0 and busyoudata[3] ~= 0) then zaiseki_busyousuu_z[busyoudata[3]] = zaiseki_busyousuu_z[busyoudata[3]] + 1 end end for kun = 1, 15, 1 do if (player_k[kun] == 1) then pkpk = kunsyut[kun] houkoku01 = io.open("KOEI三国志1_所属別武将一覧("..chr_name[pkpk].."軍).txt", "w+") houkoku01:write("--------------------------\n") houkoku01:write("\t"..chr_name[pkpk].."軍\n") houkoku01:write("--------------------------\n") for bu = 1, 255, 1 do busyou1(bu)--コルーチン if (memory.readbyte(chr_place_ad[bu] + 1) == pkpk) then houkoku01:write(busyoudata[1]..":\t忠誠:"..string.format("%03d", memory.readbyte(chr_place_ad[bu] - 4)).."\t武力:"..string.format("%03d", memory.readbyte(chr_place_ad[bu] - 7)).."\t知力:"..string.format("%03d", memory.readbyte(chr_place_ad[bu] - 8)).."\t魅力:"..string.format("%03d", memory.readbyte(chr_place_ad[bu] - 6)).."\t兵忠:"..string.format("%03d", memory.readbyte(chr_place_ad[bu] + 2)).."\t兵能\:"..string.format("%03d", memory.readbyte(chr_place_ad[bu] + 4)).."\t兵武装:"..string.format("%03d", memory.readbyte(chr_place_ad[bu] + 3)).."\t身体:"..string.format("%03d", memory.readbyte(chr_place_ad[bu] - 9)).."\n") end end houkoku01:write("\n") houkoku01:close() --***************************************************************************** --◆国別武将一覧(在野・空白地も記載) houkoku02 = io.open("KOEI三国志1_国別武将一覧("..chr_name[pkpk].."軍).txt", "w+") for co=1, 58, 1 do kunijido1(co)--コルーチン kunijido2(co)--コルーチン musyozoku = kunidata[1].."軍" if (kunidata[2] == pkpk) then houkoku02:write("--------------------------\n") houkoku02:write("\t"..co.."国 ("..musyozoku..")\n") houkoku02:write("--------------------------\n") for bu = 1, 255, 1 do busyou(bu) if (busyoudata[3] == co) then if (busyoudata[4] == 0) then if (memory.readbyte(chr_place_ad[bu] - 10) >= 16 or memory.readbyte(chr_place_ad[bu] - 10) <= 128) then if (AND (memory.readbyte(chr_place_ad[bu] - 3),4) == 4) then houkoku02:write(busyoudata[1].."\t在野".."\t武力:"..memory.readbyte(chr_place_ad[bu] - 7).."\t知力:"..memory.readbyte(chr_place_ad[bu] - 8).."\t魅力:"..memory.readbyte(chr_place_ad[bu] - 6).."\t身体:"..memory.readbyte(chr_place_ad[bu] - 9).."\n") else houkoku02:write(busyoudata[1].."\t未発見".."\t武力:"..memory.readbyte(chr_place_ad[bu] - 7).."\t知力:"..memory.readbyte(chr_place_ad[bu] - 8).."\t魅力:"..memory.readbyte(chr_place_ad[bu] - 6).."\t身体:"..memory.readbyte(chr_place_ad[bu] - 9).."\n") end else houkoku02:write(busyoudata[1].."\t未登場".."\t武力:"..memory.readbyte(chr_place_ad[bu] - 7).."\t知力:"..memory.readbyte(chr_place_ad[bu] - 8).."\t魅力:"..memory.readbyte(chr_place_ad[bu] - 6).."\t身体:"..memory.readbyte(chr_place_ad[bu] - 9).."\n") end else houkoku02:write(busyoudata[1].."\t忠誠:"..string.format("%03d", memory.readbyte(chr_place_ad[bu] - 4)).."\t武力:"..string.format("%03d", memory.readbyte(chr_place_ad[bu] - 7)).."\t知力:"..string.format("%03d", memory.readbyte(chr_place_ad[bu] - 8)).."\t魅力:"..string.format("%03d", memory.readbyte(chr_place_ad[bu] - 6)).."\t兵士数:"..string.format("%05d", memory.readbyte(chr_place_ad[bu] - 2) + (memory.readbyte(chr_place_ad[bu] - 1) * 256)).."\t兵忠:"..string.format("%03d", memory.readbyte(chr_place_ad[bu] + 2)).."\t兵能\:"..string.format("%03d", memory.readbyte(chr_place_ad[bu] + 4)).."\t兵武装:"..string.format("%03d", memory.readbyte(chr_place_ad[bu] + 3)).."\t身体:"..string.format("%03d", memory.readbyte(chr_place_ad[bu] - 9)).."\n") end end end houkoku02:write("\n") end end houkoku02:close() --***************************************************************************** --◆国別データ一覧 houkoku03 = io.open("KOEI三国志1_国力データ一覧("..chr_name[pkpk].."軍).txt", "w+") for co = 1, 58, 1 do kunijido(co)--コルーチン if (kunidata[2] == pkpk) then musyozoku = kunidata[1].."軍" co_dat_mes = 0 co_dat = {0, 0, 0, 0} if (AND(memory.readbyte(coun_adpla[co]-2),1) == 1) then co_dat[1] = "北国・" else co_dat[1] = "" end if (AND(memory.readbyte(coun_adpla[co]-2),16) == 16) then co_dat[2] = "鉄生産あり" else co_dat[2] = "鉄生産なし" end if (AND(memory.readbyte(coun_adpla[co]-2),8) ~= 8) then co_dat[3] = "" else co_dat[3] = "・洪水被害" end if (AND(memory.readbyte(coun_adpla[co]-2),4) == 4) then co_dat[4] = "・商人常在" else co_dat[4] = "" end co_dat_mes = table.concat(co_dat, "", 1, 4) houkoku03:write("--------------------------\n") houkoku03:write("\t"..co.."国 ("..musyozoku..")\n") houkoku03:write("--------------------------\n") houkoku03:write("軍 資 金:\t"..(memory.readbyte(coun_adpla[co]-12)*256 + memory.readbyte(coun_adpla[co]-13)).."\n") houkoku03:write(" 兵 糧 :\t"..(memory.readbyte(coun_adpla[co]-10)*256 + memory.readbyte(coun_adpla[co]-11)).."\n") houkoku03:write("土地価値:\t"..(memory.readbyte(coun_adpla[co]-9)).."\n") houkoku03:write("洪水確率:\t"..(100 - (memory.readbyte(coun_adpla[co]-8))).."%\n") houkoku03:write(" 人 口 :\t"..((memory.readbyte(coun_adpla[co]-6)*256 + memory.readbyte(coun_adpla[co]-7))*100).."\n") houkoku03:write("民忠誠度:\t"..(memory.readbyte(coun_adpla[co]-5)).."\n") houkoku03:write("馬 の 数:\t"..(memory.readbyte(coun_adpla[co]-4)).."\n") houkoku03:write("太 守 名:\t"..(memory.readbyte(coun_adpla[co]-10)).."\n") houkoku03:write("武 将 数:\t"..kunidata[5].." (在野武将数:"..zaiseki_busyousuu_z[co]..")\n") houkoku03:write("そ の 他:\t"..co_dat_mes.."\n") houkoku03:write("\n") end end houkoku03:close() end--プレイヤーの君主だったら end end return end --***************************************************************************** --別窓を作る為の下地 local running = true; local restrainingorder = false; local myoutput; function createGUI(n) local mybutton = iup.button{title=""}; mybutton.action = function(self, x) running = false; end; myoutput = iup.multiline{size="750x93",expand="YES",value="起動の度に登場しますので逐次バッテンクリックで消して下さい…御手数お掛け致します…。",fontsize=11} nottooclose = iup.toggle{title="Kill enemies that come too close", value="OFF"}; nottooclose.action = function(self, v) restrainingorder = (v == 1); end; -- v is 0 or 1 handles[n] = iup.dialog{ iup.frame { iup.vbox { myoutput, title="Lua tools are izi!" } } }; handles[n]:showxy(iup.CENTER, iup.CENTER) end createGUI(dialogs); local outstr; local function knifeEnemyIfTooClose(enemynumber) return d; end; --***************************************************************************** local a,b,c,d,e,f,g,h,i,j,k,l,m,kidouryoku,tetsu,syounint,kita; function betsumado() --別窓の内容を書くファンクション --****************************** outstr = ''; for kk = 1, 14, 1 do kunsyut[kk] = memory.readbyte(chr_kunsyu_ad[kk]) end for co = 1, 255, 1 do kidouryoku = 5 if ( memory.readbyte(0x78EF) == memory.readbyte(chr_place_ad[co]) and chr_name[kunsyut[memory.readbyte(chr_place_ad[co] + 1)]] ~= nil) then a,b,c,d,e,f,g,h,i,j,k,l,m,o,p = memory.readbyte(chr_place_ad[co]-10), memory.readbyte(chr_place_ad[co] -9), memory.readbyte(chr_place_ad[co] -8), memory.readbyte(chr_place_ad[co] -7), memory.readbyte(chr_place_ad[co] -6), memory.readbyte(chr_place_ad[co] -5), memory.readbyte(chr_place_ad[co] -4), memory.readbyte(chr_place_ad[co] -3), memory.readbyte(chr_place_ad[co] -2) + memory.readbyte(chr_place_ad[co] -1) * 256, memory.readbyte(chr_place_ad[co]), chr_name[kunsyut[memory.readbyte(chr_place_ad[co] + 1)]], memory.readbyte(chr_place_ad[co] + 2), memory.readbyte(chr_place_ad[co] + 4), memory.readbyte(chr_place_ad[co] + 3), memory.readbyte(chr_place_ad[co] + 5); if (h % 2 >= 1) then suigun = "○" else suigun = "×" end if (k == nil) then k = " - " end if (l > 0) then kidouryoku = kidouryoku + 1 end if (l > 25) then kidouryoku = kidouryoku + 1 end if (l > 74) then kidouryoku = kidouryoku + 1 end if (l > 99) then kidouryoku = kidouryoku + 1 end if (m > 0) then kidouryoku = kidouryoku + 1 end if (m > 25) then kidouryoku = kidouryoku + 1 end if (m > 74) then kidouryoku = kidouryoku + 1 end if (m > 99) then kidouryoku = kidouryoku + 1 end if (o > 0) then kidouryoku = kidouryoku - 1 end if (o > 25) then kidouryoku = kidouryoku - 1 end if (o > 74) then kidouryoku = kidouryoku - 1 end if (o > 99) then kidouryoku = kidouryoku - 1 end if (mibun == " 君主 ") then g = 999 end outstr = outstr ..chr_name[co].."\t: 知力"..string.format("%03d", c).." 武力"..string.format("%03d", d).." 魅力"..string.format("%03d", e).." †忠誠"..string.format("%03d", g).."† 運"..string.format("%03d", f).." 兵数"..string.format("%05d", i).." 機動力:"..string.format("%02d", kidouryoku).." 兵忠:"..string.format("%03d", l).." 兵能\:"..string.format("%03d", m).." 兵武装:"..string.format("%03d", o).." 年齢"..string.format("%02d", a).." 身体"..string.format("%03d", b).. " 水軍:"..suigun.." 経験:"..string.format("%03d", p).. " \n"; end; end; outstr = outstr .."\n   以下は在野\n"; for co = 1, 255, 1 do kidouryoku = 5 if (memory.readbyte(0x78EF) == memory.readbyte(chr_place_ad[co]) and memory.readbyte(chr_place_ad[co] + 1) == 0 ) then a,b,c,d,e,f,g,h,i,j,k,l,m,o = memory.readbyte(chr_place_ad[co] -10), memory.readbyte(chr_place_ad[co] -9), memory.readbyte(chr_place_ad[co] -8), memory.readbyte(chr_place_ad[co] -7), memory.readbyte(chr_place_ad[co] -6), memory.readbyte(chr_place_ad[co] -5), memory.readbyte(chr_place_ad[co] -4), memory.readbyte(chr_place_ad[co] -3), memory.readbyte(chr_place_ad[co] -2) + memory.readbyte(chr_place_ad[co] -1) * 256, memory.readbyte(chr_place_ad[co] ), chr_name[kunsyut[memory.readbyte(chr_place_ad[co] + 1)]], memory.readbyte(chr_place_ad[co] + 2), memory.readbyte(chr_place_ad[co] + 4), memory.readbyte(chr_place_ad[co] + 3); if (AND(h, 4) == 0) then mibun = "(未発見" end if (AND(h, 4) == 4) then mibun = "(発見済" end if (h % 2 >= 1) then suigun = "○" else suigun = "×" end if (k == nil) then k = " - " end if (l > 0) then kidouryoku = kidouryoku + 1 end if (l > 25) then kidouryoku = kidouryoku + 1 end if (l > 74) then kidouryoku = kidouryoku + 1 end if (l > 99) then kidouryoku = kidouryoku + 1 end if (m > 0) then kidouryoku = kidouryoku + 1 end if (m > 25) then kidouryoku = kidouryoku + 1 end if (m > 74) then kidouryoku = kidouryoku + 1 end if (m > 99) then kidouryoku = kidouryoku + 1 end if (o > 0) then kidouryoku = kidouryoku - 1 end if (o > 25) then kidouryoku = kidouryoku - 1 end if (o > 74) then kidouryoku = kidouryoku - 1 end if (o > 99) then kidouryoku = kidouryoku - 1 end if (mibun == " 君主 ") then g = 999 end outstr = outstr ..chr_name[co]..mibun.."\t: 知力"..string.format("%03d", c).." 武力"..string.format("%03d", d).." 魅力"..string.format("%03d", e).." 運"..string.format("%03d", f).." 兵数"..string.format("%05d", i).." 機動力:"..string.format("%02d", kidouryoku).." 兵忠:"..string.format("%03d", l).." 兵能\:"..string.format("%03d", m).." 兵武装:"..string.format("%03d", o).." 年齢"..string.format("%02d", a).." 身体"..string.format("%03d", b).." 水軍:"..suigun.." \n"; end; end; if (myoutput) then myoutput.value = outstr; end; if (memory.readbyte(0x78b3) ==255 and memory.readbyte(0x78b0) == 1 and toujou == 0) then toujou = 1 for co = 1, 255, 1 do a,b,c,d,e,f,g,h,i,j,k,l,m = memory.readbyte(chr_place_ad[co]),memory.readbyte(chr_place_ad[co] + 1),memory.readbyte(chr_place_ad[co] + 2),memory.readbyte(chr_place_ad[co] + 3),memory.readbyte(chr_place_ad[co] + 4),memory.readbyte(chr_place_ad[co] + 5),memory.readbyte(chr_place_ad[co] + 6),memory.readbyte(chr_place_ad[co] + 7),memory.readbyte(chr_place_ad[co] + 8) + memory.readbyte(chr_place_ad[co] + 9) * 256,memory.readbyte(chr_place_ad[co] + 10),chr_name[kunsyut[memory.readbyte(chr_place_ad[co] + 11)]],memory.readbyte(chr_place_ad[co] + 12),memory.readbyte(chr_place_ad[co] + 14); end end for co = 1, 255, 1 do FCEU.frameadvance() end return end --***************************************************************************** while true do --繰り返しによる毎回描写 --***************************************************************************** --◆兵編成時に、各武将の所有兵数が確認出来る --(1つの国に28人以上入れない) --zbs = 在籍武将番号を入れるデータ群 if (memory.readbyte(0x186A) == 160 and memory.readbyte(0x1D2E) + memory.readbyte(0x1D2F)*256 + memory.readbyte(0x1D30)*65536 <= 560001) then --武将選択画面で、総兵数が国最大の28武将×20000以下の時 if (zbsf ~= memory.readbyte(0x78EF) and zbs[1] ~= 0) then for fgbhre = 1, 28, 1 do zbs[fgbhre] = 0 end end if (memory.readbyte(0x1520) == 8 and memory.readbyte(0x05cb) == 01 and memory.readbyte(0x7CE9) == 0) then for fgbhre = 1, 28, 1 do zbs[fgbhre] = 0 end if (zbsf ~= 0) then zbsf = 0 hurguk = 1 kunijido2(memory.readbyte(0x1db8)) for bu = 1, 255, 1 do busyou3(bu) busyou4(bu) if (busyoudata[3] == memory.readbyte(0x1db8) and busyoudata[4] ~= 0 and busyoudata[4] == kunidata[2]) then zbs[hurguk] = bu busyou6(bu) zbsh[hurguk] = busyoudata[6] hurguk = hurguk + 1 end end end if (memory.readbyte(0x1491) + 1 < 29) then gui.text(25,88+(memory.readbyte(0x1491) * 8),string.format("%5d", zbsh[memory.readbyte(0x1491) + 1])) end end if (memory.readbyte(0x186A) == 160 and zbs[1] == 0) then --武将選択画面を開いた時にzbsに武将番号を入れる hurguk = 1 for bu = 1, 255, 1 do busyou3(bu) busyou4(bu) if (busyoudata[3] == memory.readbyte(0x78EF) and busyoudata[4] ~= 0) then zbs[hurguk] = bu busyou6(bu) zbsh[hurguk] = busyoudata[6] hurguk = hurguk + 1 end end zbsf = memory.readbyte(0x78EF) end if (memory.readbyte(0x186A) == 160 and memory.readbyte(0x1583) == 5 and memory.readbyte(0x14FC) > 253 and memory.readbyte(0x14FD) ~= 255) then memory.writebyte(0x14FC, 0) end if (memory.readbyte(0x186A) == 160 and memory.readbyte(0x1583) == 5 and zbs[1] ~= 0 and memory.readbyte(0x14FC) < 14) then gui.text(67,74,":heishi no nokori") gui.text(30,74,string.format("%6d", memory.readbyte(0x1D2E) + memory.readbyte(0x1D2F)*256 + memory.readbyte(0x1D30)*65536)) if (zbsh[memory.readbyte(0x14FC) + 1] ~= nil) then if (memory.readbyte(0x14FC) + memory.readbyte(0x1517) < 14 and memory.readbyte(0x14FC) + memory.readbyte(0x1517) >= 0) then busyou6(zbs[memory.readbyte(0x14FC) + 1]) gui.text(25,88+(memory.readbyte(0x14FC) * 8),string.format("%5d", busyoudata[6])) end if (memory.readbyte(0x14FC) + memory.readbyte(0x1517) < 28 and memory.readbyte(0x14FC) + memory.readbyte(0x1517) > 13) then busyou6(zbs[memory.readbyte(0x14FC) + memory.readbyte(0x1517) + 1]) gui.text(129,88+(memory.readbyte(0x14FC) * 8),string.format("%5d", busyoudata[6])) end end end end --◆自分の手番で、地図画面で委任のオンオフが出来る if (memory.readbyte(0x0620) == 55 and memory.readbyte(0x0630) == 103 and memory.readbyte(0x78F3) == 01 and click_ininkainin == 1) then muse = input.get() gui.drawline(muse['xmouse'],muse['ymouse'],muse['xmouse'],muse['ymouse']+5,"#ffff00") gui.drawline(muse['xmouse'],muse['ymouse']+5,muse['xmouse']+5,muse['ymouse'],"#ffff00") gui.drawline(muse['xmouse']+5,muse['ymouse'],muse['xmouse'],muse['ymouse'],"#ffff00") for ftr = 1, 58, 1 do if (guidata[ftr][1] + 4 <= muse['xmouse'] and guidata[ftr][1] + 12 >= muse['xmouse'] and guidata[ftr][2] <= muse['ymouse'] and guidata[ftr][2] + 8 >= muse['ymouse']) then cslnm = guidata[ftr][3] --委任のオンオフ部分 if ( memory.readbyte(0x73b4 + (memory.readbyte(0x78EF) - 1) * 22) == memory.readbyte(0x73b4 + (cslnm - 1) * 22)--現在戦略中の国と同じ君主の国 ) then if ( memory.readbyte(0x78EF) == cslnm + 0 or--現在戦略中の国以外 memory.readbyte(0x73b4 + (cslnm - 1) * 22) == memory.readbyte(0x73b5 + (cslnm - 1) * 22)--本国以外 ) then else if (muse['click'] == 1 and AND (memory.readbyte(0x73b3 + (cslnm - 1) * 22),4) == 4 and clcof == 0) then memory.writebyte(0x73b3 + (cslnm - 1) * 22, memory.readbyte(0x73b3 + (cslnm - 1) * 22) - 4) cslnm = nil clcof = 1 break end if (muse['click'] == 1 and AND (memory.readbyte(0x73b3 + (cslnm - 1) * 22),4) == 0 and clcof == 0) then memory.writebyte(0x73b3 + (cslnm - 1) * 22, memory.readbyte(0x73b3 + (cslnm - 1) * 22) + 4) cslnm = nil clcof = 1 break end if (muse['click'] == 0 and clcof == 1) then clcof = 0 end end end --委任のオンオフ部分 終 end end --委任中の国にピンクの下線を敷く for gfe = 1, 58, 1 do if (AND (memory.readbyte(0x73b3 + (gfe - 1) * 22),4) == 4 ) then--委任中 gui.drawline(guidata[gfe][1]+2,guidata[gfe][2]+8,guidata[gfe][1]+10,guidata[gfe][2]+8,"#ff00ff") end end --右下のコメント欄 if (cslnm ~= nil) then gui.drawbox(179,159,237,189,"#000000") kunijido5(cslnm + 0) gui.text(180,160,string.format("%02d",cslnm)) gui.text(193, 160, "koku:") if ( memory.readbyte(0x73b4 + (memory.readbyte(0x78EF) - 1) * 22) == memory.readbyte(0x73b4 + (cslnm - 1) * 22)--現在戦略中の国と同じ君主の国 ) then gui.text(180,170,"busyou"..string.format("%02d", kunidata[5]).."nin") if (AND (memory.readbyte(0x73b3 + (cslnm - 1) * 22),4) == 4 ) then gui.text(183,180,"i nin tyuu") end if (memory.readbyte(0x73b4 + (cslnm - 1) * 22) == memory.readbyte(0x73b5 + (cslnm - 1) * 22) and memory.readbyte(0x73b4 + (cslnm - 1) * 22) ~= 0) then gui.text(183,180,"Hongoku") end if (memory.readbyte(0x78EF) == cslnm + 0) then gui.text(183, 180, "now") end end end end --◆自分の手番で、地図画面で委任のオンオフが出来る 終 --◆自分の手番が何番目かを表示 if (memory.readbyte(0x78F3) ~= 0 and memory.readbyte(0x05cb) == 2 and memory.readbyte(0x78B3) ~= 255) then gui.text(210,32,"/ "..memory.readbyte(0x78B3) + 1) end--順番を出す --◆戦闘中に風向きと日数(ターン数)・敵味方の兵糧表示。Bボタン押しっぱなしと十字キーで位置変更可能 if (kzmknss == 1) then if (memory.readbyte(0x05cb) == 1) then sentou_hyouji()--ファンクション end end frame60 = frame60 + 1 if (frame60 == 60) then frame60 = 00 end --***************************************************************************** if (memory.readbyte(0x78F3) == 0) then--CPUの版の時に --***************************************************************************** --現在月・季節表示 chr_sea_a = memory.readbyte(0x78b0) if (chr_sea_a ~= chr_sea) then if (chr_sea_a == 1) then print("----"..memory.readbyte(0x78ae) * 256 + memory.readbyte(0x78ad).."年 春 ----") houkokuhis = "----"..memory.readbyte(0x78ae) * 256 + memory.readbyte(0x78ad).."年 春 ----\n" Report_history() else if (chr_sea_a == 4) then print("----"..memory.readbyte(0x78ae) * 256 + memory.readbyte(0x78ad).."年 夏 ----") houkokuhis = "----"..memory.readbyte(0x78ae) * 256 + memory.readbyte(0x78ad).."年 夏 ----\n" Report_history() else if (chr_sea_a == 7) then print("----"..memory.readbyte(0x78ae) * 256 + memory.readbyte(0x78ad).."年 秋 ----") houkokuhis = "----"..memory.readbyte(0x78ae) * 256 + memory.readbyte(0x78ad).."年 秋 ----\n" Report_history() else if (chr_sea_a == 10) then print("----"..memory.readbyte(0x78ae) * 256 + memory.readbyte(0x78ad).."年 冬 ----") houkokuhis = "----"..memory.readbyte(0x78ae) * 256 + memory.readbyte(0x78ad).."年 冬 ----\n" Report_history() end end end end chr_sea = chr_sea_a end chr_mon_a = memory.readbyte(0x78b0) if (chr_mon ~= chr_mon_a and memory.readbyte(0x78b3) ~= 255) then print("---- "..chr_mon_a.."月".."----") Reportwrite()--報告書作成ファンクション houkokuhis = "---- "..chr_mon_a.."月".."----\n" Report_history() chr_mon = chr_mon_a end --***************************************************************************** if (memory.readbyte(0x0620)==37 and memory.readbyte(0x0630)==67) then--地図画面の時に end--地図画面の時に for bu = 255, 1, -1 do --武将の移動及び引き抜き busyou(bu)--コルーチン chr_place[bu] = busyoudata[3] chr_syozoku[bu] = busyoudata[4] --君主の武将番号 if (chr_place_w[bu] ~= busyoudata[3]) then idou_bu = bu stopcount_a = 0 hikinukare = chr_place_w[bu] hikinuki = busyoudata[3] junban = memory.readbyte(0x78b3) b_flag = 0 if (memory.readbyte(0x78b3) ~= 255) then atamakazu = atamakazu + 1 end --戦闘状態 kunijido2(busyoudata[3])--コルーチン if (atamakazu >= 2 and seme == 0 and chr_place_w[bu] ~= 0 and memory.readbyte(0x78b3) ~= 255 and busyoudata[4] ~= kunidata[2]--武将の君主番号~=移動先の国の君主番号、の比較 ) then print(" ") houkokuhis = "\n" Report_history() print(" 【戦争】:"..busyoudata[2].."軍 が、"..chr_place_w[bu].."国 から "..busyoudata[3].."国へ攻撃!") houkokuhis = " 【戦争】:"..busyoudata[2].."軍 が、"..chr_place_w[bu].."国 から "..busyoudata[3].."国へ攻撃!\n" Report_history() battle_co[1], battle_co[2] = guidata[(chr_place[bu])][1]+4, guidata[(chr_place[bu])][2] seme = 1 shei = (shei* 0) --topbusyou は、最初に移動処理を行っていて、同じタイミングで同じ場所に武将が移動した時に --前の移動させた武将の武将番号が入力される。 print("・攻撃側:"..busyoudata[2].."軍") houkokuhis = "・攻撃側:"..busyoudata[2].."軍\n" Report_history() print(" "..chr_name[topbusyou[1]]..":\t兵士 "..topbusyou[4].."人") houkokuhis = " "..chr_name[topbusyou[1]]..":\t兵士 "..topbusyou[4].."人\n" Report_history() chr_hei_w[topbusyou[1]] = topbusyou[4] khei = (khei* 0) + topbusyou[4] end if (seme == 1 and topbusyou[2] == busyoudata[3] and topbusyou[3] == busyoudata[4]) then print(" "..busyoudata[1]..":\t兵士 "..busyoudata[6].."人") houkokuhis = " "..busyoudata[1]..":\t兵士 "..busyoudata[6].."人\n" Report_history() chr_hei_w[bu] = busyoudata[6] khei = khei + busyoudata[6] end if (seme == 2 and chr_place_ww[bu] == busyoudata[3] and chr_syozoku_w[bu] ~= busyoudata[4] and busyoudata[3] ~= 0 and memory.readbyte(0x05cb) == 02) then print(" "..busyoudata[1].."が捕えられた!") houkokuhis = " "..busyoudata[1].."が捕えられた!\n" Report_history() else if (busyoudata[3] == 0) then --死亡の場合 if (seme == 2) then print("【※】君主の"..busyoudata[1].."が死亡しました。 ("..memory.readbyte(chr_place_ad[bu] - 10).."歳)") houkokuhis = "【※】君主の"..busyoudata[1].."が死亡しました。 ("..memory.readbyte(chr_place_ad[bu] - 10).."歳)\n" Report_history() if (chr_place_w[bu] < 30) then chr_deathplace[bu] = chr_place_w[bu] - 29 + 58 else chr_deathplace[bu] = chr_place_w[bu] - 29 end else print(busyoudata[1].."が死亡しました。 ("..memory.readbyte(chr_place_ad[bu] - 10).."歳)") houkokuhis = busyoudata[1].."が死亡しました。 ("..memory.readbyte(chr_place_ad[bu] - 10).."歳)\n" Report_history() if (chr_place_w[bu] < 30) then chr_deathplace[bu] = chr_place_w[bu] - 29 + 58 else chr_deathplace[bu] = chr_place_w[bu] - 29 end end else --死亡以外の場合 if (chr_place_w[bu] == 0) then if (chr_deathplace[bu] == 0) then print(busyoudata[1].." が "..busyoudata[3].."国 に登場しました。(現在"..memory.readbyte(chr_place_ad[bu] - 10).."歳)") houkokuhis = busyoudata[1].." が "..busyoudata[3].."国 に登場しました。(現在"..memory.readbyte(chr_place_ad[bu] - 10).."歳)\n" Report_history() else print(" "..busyoudata[1]..":\t"..busyoudata[3].."国に配置されました") houkokuhis = " "..busyoudata[1]..":\t"..busyoudata[3].."国に配置されました\n" Report_history() end else if (seme == 0) then if (AND(memory.readbyte(chr_place_ad[bu] - 3),4)==4) then print(" "..busyoudata[1].."が"..busyoudata[3].."国にて見い出されました") houkokuhis = " "..busyoudata[1].."が"..busyoudata[3].."国にて見い出されました\n" Report_history() else if (chr_syozoku_w[bu] == 0) then chr_name[(chr_syozoku_w[bu])] = " 在野 " end if (memory.readbyte(0x78b3) == 255) then print(" "..busyoudata[1]..":\t"..string.format("%02d", chr_place_w[bu]).."国 ⇒ "..string.format("%02d", busyoudata[3]).."国") houkokuhis = " "..busyoudata[1]..":\t"..string.format("%02d", chr_place_w[bu]).."国 ⇒ "..string.format("%02d", busyoudata[3]).."国\n" Report_history() else print(" "..busyoudata[1].."("..chr_name[(chr_syozoku_w[bu])].."):\t"..string.format("%02d", chr_place_w[bu]).."国 ⇒ "..string.format("%02d", busyoudata[3]).."国("..busyoudata[2]..")") houkokuhis = " "..busyoudata[1].."("..chr_name[(chr_syozoku_w[bu])].."):\t"..string.format("%02d", chr_place_w[bu]).."国 ⇒ "..string.format("%02d", busyoudata[3]).."国("..busyoudata[2]..")\n" Report_history() end topbusyou[1] = bu topbusyou[2] = busyoudata[3] topbusyou[3] = busyoudata[4] topbusyou[4] = busyoudata[6] end end if (seme == 2) then if (shei == 0 )then else print(" "..busyoudata[1].."が"..busyoudata[3].."国に退却\t兵:"..busyoudata[6].."人("..chr_hei_w[bu] - busyoudata[6].."人死亡)") houkokuhis = " "..busyoudata[1].."が"..busyoudata[3].."国に退却\t兵:"..busyoudata[6].."人("..chr_hei_w[bu] - busyoudata[6].."人死亡)\n" Report_history() end topbusyou[1] = bu topbusyou[2] = busyoudata[3] topbusyou[3] = busyoudata[4] topbusyou[4] = busyoudata[6] end end end end chr_place_ww[bu] = chr_place_w[bu] chr_place_w[bu] = busyoudata[3] chr_syozoku_w[bu] = busyoudata[4] end if (seme == 1 and bu == 1) then --攻撃を受けた国の守備側武将描写 if (seme == 1 and memory.readbyte(coun_adpla[topbusyou[2]]) ~= 0) then if (memory.readbyte(chr_kunsyu_ad[(memory.readbyte(coun_adpla[(topbusyou[2])]))]) == 0) then print("・守備側:空白地") houkokuhis = "・守備側:空白地\n" Report_history() end print("・守備側:"..chr_name[memory.readbyte(chr_kunsyu_ad[(memory.readbyte(coun_adpla[(topbusyou[2])]))])].."軍") houkokuhis = "・守備側:"..chr_name[memory.readbyte(chr_kunsyu_ad[(memory.readbyte(coun_adpla[(topbusyou[2])]))])].."軍\n" Report_history() for q = 255, 1, -1 do busyou1(q)--コルーチン busyou3(q)--コルーチン busyou4(q)--コルーチン busyou6(q)--コルーチン --topbusyou[1]は攻撃した人の最後の武将番号。 if (seme == 1 and topbusyou[2] == busyoudata[3] and topbusyou[3] ~= busyoudata[4]) then if (busyoudata[4] == 0) then else print(" "..busyoudata[1]..":\t兵士 "..busyoudata[6].."人") houkokuhis = " "..busyoudata[1]..":\t兵士 "..busyoudata[6].."人\n" Report_history() chr_hei_w[q] = busyoudata[6] shei = shei + busyoudata[6] end end end end print() houkokuhis = "\n" Report_history() print(" 【総兵士数】 ") houkokuhis = " 【総兵士数】 \n" Report_history() print("攻撃側総兵士数:"..khei.."人") houkokuhis = "攻撃側総兵士数:"..khei.."人\n" Report_history() print("守備側総兵士数:"..shei.."人") houkokuhis = "守備側総兵士数:"..shei.."人\n" Report_history() print() houkokuhis = "\n" Report_history() print(" - 戦闘中 - ") houkokuhis = " - 戦闘中 - \n" Report_history() print() houkokuhis = "\n" Report_history() seme = 2 end end --***************************************************************************** for k = 1, 14, 1 do --君主死亡して後継者を選んだ際に描写 if ( kunsyut[k] ~= memory.readbyte(chr_kunsyu_ad[k]) and memory.readbyte(0x78b3) ~= 255 and memory.readbyte(chr_kunsyu_ad[k]) ~= 0) then print(" 【"..chr_name[kunsyut[k]].."】 の跡目を 【"..chr_name[memory.readbyte(chr_kunsyu_ad[k])].."】 が継ぎます。("..memory.readbyte(chr_place_ad[(memory.readbyte(chr_kunsyu_ad[k]))]).."国") houkokuhis = " 【"..chr_name[kunsyut[k]].."】 の跡目を 【"..chr_name[memory.readbyte(chr_kunsyu_ad[k])].."】 が継ぎます。("..memory.readbyte(chr_place_ad[(memory.readbyte(chr_kunsyu_ad[k]))]).."国\n" Report_history() kunsyut[k] = memory.readbyte(chr_kunsyu_ad[k]) kunsyu_h = 1 end end --***************************************************************************** if (junban ~= memory.readbyte(0x78b3) and b_flag == 0) then --国の戦略順が次の国へ変わった際の様々なフラグのリセット cslnm = nil seme = 0 atamakazu = 0 b_flag = 1 for bu = 1, 255, 1 do busyou4(bu)--コルーチン chr_syozoku[bu] = busyoudata[4] end for co = 1, 58, 1 do zaiseki_busyousuu_z[co] = 0 end end --***************************************************************************** if (hikinuki == 0 or hikinukare == 0) then --移動した際の移動元と移動先のgui表示 else guiflg = 1 for k = 1, 3, 1 do moto[k] = guidata[hikinukare][k] saki[k] = guidata[hikinuki][k] end if (memory.readbyte(0x78b3) ~= 255 and memory.readbyte(0x0630) == 103) then gui.drawline(moto[1]+8, moto[2]+8, saki[1]+4, saki[2]+4, "#FF0000") gui.drawline(moto[1]+8, moto[2]+8, (saki[1]+2 +(frame60 % 4)), (saki[2] + 1 +(frame60 % 6)), "#FF8C00") end if (memory.readbyte(0x78b3) ~= 255 and memory.readbyte(0x0620) == 55 and memory.readbyte(0x0630) == 103) then if (seme == 2) then if (stopcount_c % 5 == 0) then gui.text(battle_co[1], battle_co[2], "||","#DA70D6") end if (stopcount_c % 5 == 1) then gui.text(battle_co[1], battle_co[2], "X","#DA70D6") end if (stopcount_c % 5 == 2) then gui.text(battle_co[1], battle_co[2], "?","#DA70D6") end else if (stopcount_a % 2 == 1) then gui.text(moto[1]+4, moto[2], "-","#DA70D6") end if (stopcount_a % 2 == 0) then gui.text(saki[1]+4, saki[2], "+","#DA70D6") end end end if ( frame60 == 14 or frame60 == 44) then stopcount_c = stopcount_c + 1 end if ( frame60 == 29 or frame60 == 59) then stopcount_a = stopcount_a + 1 stopcount_c = stopcount_c + 1 if (stopcount_a >= 15) then hikinuki = 0 hikinukare = 0 stopcount_a = 0 stopcount_c = 0 end end end --***************************************************************************** --国の支配変更など for co = 1, 58, 1 do kunijido2(co)--コルーチン if (coun_att_w[co] ~= kunidata[2] and kunidata[2] ~= 0) then kunijido1(co)--コルーチン kunijido3(co)--コルーチン print(" 【"..co.."国】:"..kunidata[1].."軍領地になりました") houkokuhis = " 【"..co.."国】:"..kunidata[1].."軍領地になりました\n" Report_history() if (kunidata[3] == coun_tat_w[co] and guiflg == 0) then if ( kunidata[3] == 0 ) then else if (kunidata[3] ~= kunidata[2] and kunsyu_h == 0 or kunidata[3] ~= kunidata[2]) then if (memory.readbyte(0x78b3) ~= 255) then print(" 【寝返】太守の"..chr_name[(kunidata[3])].."が寝返りました") houkokuhis = " 【寝返】太守の"..chr_name[(kunidata[3])].."が寝返りました\n" Report_history() end end guides = co end end end if (coun_att_w[co] ~= kunidata[2] and kunidata[2] == 0) then print(" 【"..co.."国】が空白地になりました") houkokuhis = " 【"..co.."国】が空白地になりました\n" Report_history() guides = co end coun_att_w[co] = kunidata[2] coun_tat_w[co] = kunidata[3] end for bu = 1, 255, 1 do busyou4(bu)--コルーチン chr_syozoku_w[bu] = busyoudata[4] end kunsyu_h = 0 --***************************************************************************** if (guides ~= 0 and guiflg == 0 and memory.readbyte(0x78b3) ~=255) then for g = 1, 3, 1 do guiplace[g] = guidata[guides][g] end if (stopcount_b % 2 == 0 and memory.readbyte(0x78b3) ~= 255 and memory.readbyte(0x0620) == 55 and memory.readbyte(0x0630) == 103) then gui.text(guiplace[1], guiplace[2], guiplace[3],"#DA70D6") end if ( frame60 == 29 or frame60 == 59) then stopcount_b = stopcount_b + 1 if (stopcount_b >= 13) then guides = 0 stopcount_b = 0 for i = 1, 3, 1 do guiplace[i] = 0 end end end end gui.text(0, 0, stopcount_a) gui.text(0, 0, stopcount_b) gui.text(0, 0, stopcount_c) --***************************************************************************** -- 1月の寿命シーズンだけスピードを戻す if (nnmtflg == 0 and memory.readbyte(0x78b0) == 1 and memory.readbyte(0x78b3) == 255) then nnmtflg = 1 junban = memory.readbyte(0x78b3) --***************************************************************************** -- 復活オンシステム if (hukkatu == 1) then print("★復活オン:") houkokuhis = "★復活オン:\n" Report_history() for bu = 1, 255, 1 do busyou1(bu)--コルーチン busyou3(bu)--コルーチン if (busyoudata[3] == 0 and memory.readbyte(chr_place_ad[bu] - 10) >= 18 and memory.readbyte(chr_place_ad[bu] - 10) < 128) then FCEU.frameadvance() memory.writebyte(chr_place_ad[bu] + 1, 0) memory.writebyte(chr_place_ad[bu], ((os.time() + emu.framecount()) * bu % 58) + 1) memory.writebyte(chr_place_ad[bu] - 9, 100) memory.writebyte(chr_place_ad[bu] - 3, memory.readbyte(chr_place_ad[bu] - 3) + 4) memory.writebyte(chr_place_ad[bu] - 10, 15) if (chr_deathplace[bu] ~= 0) then memory.writebyte(chr_place_ad[bu], chr_deathplace[bu]) print("復活オン: "..busyoudata[1].." が蘇りました。") houkokuhis = "復活オン: "..busyoudata[1].." が蘇りました。\n" Report_history() else print("復活オン: "..busyoudata[1].." が蘇りました。") houkokuhis = "復活オン: "..busyoudata[1].." が蘇りました。\n" Report_history() end end end end -- 復活オンシステム終わり --***************************************************************************** --***************************************************************************** end--(終) 1月の寿命シーズンだけスピードを戻す終了 --***************************************************************************** if (memory.readbyte(0x78b3) ~= 255) then nnmtflg = 0 end --***************************************************************************** --gui化 if (seme == 2 and memory.readbyte(0x78b3) ~=255 and memory.readbyte(0x0620) == 55 and memory.readbyte(0x0630) == 103) then gui.text(190, 82, "Attack") gui.text(192, 90, string.format("%06d", khei)) gui.text(210, 100, "vs") gui.text(190, 110, "Defence:") gui.text(192, 118, string.format("%06d", shei)) end --***************************************************************************** end--CPUの版の時に --***************************************************************************** if (memory.readbyte(0x0620) == 55 and memory.readbyte(0x0630) == 103) then if (memory.readbyte(0x78F3) == 1) then else guiflg = 0 end end --***************************************************************************** --ツール出力 if ( memory.readbyte(0x0620) ~= 55 and memory.readbyte(0x0630) ~= 103 and memory.readbyte(0x78F3) ~= 0) then if (BMF == 0) then betsumado() BMF = 1 end else BMF = 0 end FCEU.frameadvance() --キーボードで動かせるようにしてみた if (keyboad_controll == 1) then tir = input.get() if (tir['up'] == true) then joypad.set(1, {up = true}) end if (tir['down'] == true) then joypad.set(1, {down = true}) end if (tir['left'] == true) then joypad.set(1, {left = true}) end if (tir['right'] == true) then joypad.set(1, {right = true}) end if (tir['Z'] == true) then joypad.set(1, {A = true}) end if (tir['X'] == true) then joypad.set(1, {B = true}) end if (tir['Q'] == true) then joypad.set(1, {select = true}) end if (tir['W'] == true) then joypad.set(1, {start = true}) end if (tir['A'] == true and emu.framecount() % 2 == 1) then joypad.set(1, {A = true}) end if (tir['S'] == true and emu.framecount() % 2 == 1) then joypad.set(1, {B = true}) end end --キーボードで動かせるようにしてみた --***************************************************************************** end --while true do --*****************************************************************************