on opencard --通行可能文字のリセット global gMapChar put "abcdefghijklmnop" into gMapChar pass opencard end opencard on Showsub end showsub on closecard --gbnのリセット global gbn put empty into gbn end closecard on talk --ダミー end talk on initcard --共通初期化 global MDATA,gchd get bg fld "MapSettings" --状態判定 put empty into cdName put 1 into item 1 of line 23 of MDATA repeat with i=4 down to 2 if (line 4+i*2 of it) is not empty then if the value of (line 4+i*2 of it) then put line 3+i*2 of it into cdName put i into item 1 of line 23 of MDATA exit repeat end if end if end repeat put item 1 of line (12+(item 1 of line 23 of MDATA)) of it into item 2 of line 23 of MDATA if cdName is not empty then if number of items of cdName is 1 then go cd cdName send "initcard" to cd cdName else initCastLocate (item 1 of line 23 of MDATA) end if else initCastLocate (item 1 of line 23 of MDATA) end initcard on revertcard global MDATA initCastLocate (item 1 of line 23 of MDATA) end revertcard on startcard --状態に応じたイベントを実行 global MDATA DoEvent (item 1 of line 23 of MDATA) end startcard on initCastLocate pn --キャスト配置 get bg fld "BtnsDATA" multiply pn by 4 repeat with i=1 to number of lines of it put (item (pn+2) to (pn+5) of line i of it) into LN if item 2 of line i of it is not empty then if item 2 of line i of it is a integer then put BooleFlg((item 3 of line i of it),(item 2 of line i of it)) into SW add (the length of (not SW))-4 to item 4 of LN --put (item 4 of LN)+(the length of (not SW))-4 into item 4 of LN else if item 2 of line i of it is "c" then if condChr(item 3 of line i of it) then put empty into item 1 of LN end if end if castLocate i,(item 1 of LN),(item 2 of LN),(item 3 of LN),(item 4 of LN) end repeat end initCastLocate on DoEvent what --内蔵イベント global gchd if what is in "1,2,3,4" then if bg fld ("EventDATA"&what) is not empty then do bg fld ("EventDATA"&what) put empty into gchd exit to hypercard end if end if end DoEvent on gotin --エンカウント global MDATA,gchd if item 2 of line 23 of MDATA < 1 then exit gotin if item 3 of line 23 of MDATA >= 100 then put empty into gchd put 0 into item 3 of line 23 of MDATA get line 12+(item 1 of line 23 of MDATA) of bg fld "MapSettings" put the random of ((number of items of it) div 7) into EnParty do "FightTo "&(item (EnParty*7-4) to (EnParty*7+1) of it)&",,"&(item 2 of it) else add the random of (item 2 of line 23 of MDATA)*2 to item 3 of line 23 of MDATA end if end gotin function LocToCharLoc x,y --座標を文字位置に変換 if item 2 of x is not empty then put item 2 of x into y delete item 2 of x end if return ((x div 32)+1)&","&((y div 32)+1) end LocToCharLoc on castLocate cn,vis,x,y,m --キャラの位置設定用 get short id of cd btn ("Cast"&cn) set topleft of cd btn id it to (x-1)*32,(y-1)*32 if m is not empty then set icon of cd btn id it to m if vis is not empty then show cd btn id it else hide cd btn id it end castLocate on castShow cn --キャスト見せる show cd btn ("Cast"&cn) end castShow on castHide cn --キャスト隠す hide cd btn ("Cast"&cn) end castHide on castSetIcon cn,what --キャストアイコン変更 set icon of cd btn ("Cast"&cn) to what end castSetIcon on castFace cn,direc --キャラを指定された方向へ向ける set icon of cd btn ("Cast"&cn) to (((icon of cd btn ("Cast"&cn)) div 100)*100 +direc*10) end castFace on castFaceWho cn,cn2 --キャラを指定されたキャストへ向ける get (icon of cd btn ("Cast"&cn)) div 100 put loc of cd btn ("Cast"&cn) into myLoc put loc of cd btn ("Cast"&cn2) into herLoc if abs((item 1 of herLoc)-(item 1 of myLoc)) > abs((item 2 of herLoc)-(item 2 of myLoc)) then if (item 1 of herLoc)-(item 1 of myLoc) > 0 then put 30 into which else put 20 into which end if else if (item 2 of herLoc)-(item 2 of myLoc) > 0 then put 10 into which else put 40 into which end if end if set icon of cd btn ("Cast"&cn) to it*100+which end castFaceWho on castFaceHero bn --プレイヤーキャラに向ける if there is a cd btn bn then delete char 1 to 4 of bn castFaceWho bn,0 end if end castFaceHero on castJump cn,what charJump (short id of cd btn ("Cast"&cn)),what end castJump on castWalk direc,cn,WC --キャラの歩く処理 global wchar,gwait,gMapChar,gbn put short id of cd btn ("Cast"&cn) into btnID put ((icon of cd btn id btnID) div 100)*100+direc*10 into ic put (item direc of "0,-1,1,0") into x put (item direc of "1,0,0,-1") into y put loc of cd btn id btnID into bLoc set icon of cd btn id btnID to ic if WC is empty then put empty into wchar click at (item 1 of loc of cd btn id btnID)+x*32,(item 2 of loc of cd btn id btnID)+y*32 else put WC into wchar --WCはwcharを指定してしまう。当たり判定を無効にする時などに使う。 if wchar is in gMapChar then --通行可能な文字は、マップによって変わることも。 --実際に動かす。 repeat with i=1 to 4 get the ticks set loc of cd btn id btnID to ((item 1 of bLoc)+i*8*x),((item 2 of bLoc)+i*8*y) set icon of cd btn id btnID to (ic+2-(i mod 2)) wait it-(the ticks)+1 end repeat set icon of cd btn id btnID to ic if gbn is not empty then put gbn into DT put empty into gbn send "gotin" to DT end if else exit castWalk end castWalk on castTell what,cn,exp --セリフ if cn > -1 and cn is a integer then if exp is empty then if "(" is in what and ")" is in what then put "Think" into exp else if "?" is in what then put "Tell?" into exp else if "!" is in what then put "Tell!" into exp else if "…" is in what then put "Tell..." into exp else if "・・・" is in what then put "Tell..." into exp else if "♪" is in what then put "Tellp" into exp else if "・" is in what then put "TellLove" into exp else if last char of what is in "@,#,I,L,Z,;" then put "Tell"&(last char of what) into exp delete last char of what else put "Tell" into exp end if get loc of cd btn ("Cast"&cn) set icon of cd btn "Cast-1" to exp show cd btn "Cast-1" at (item 1 of it)+14,(item 2 of it)-26 end if put what into msg wait while the mouse is down wait while the mouse is up hide msg hide cd btn "Cast-1" end castTell on dragpl --キャラがドラッグされたとき put the mouseloc into gmloc put loc of cd btn "Cast0" into bnloc if item 1 of gmloc-item 1 of bnloc>16 then --右 castWalk 3,0 else if item 1 of gmloc-item 1 of bnloc<-16 then --左 castWalk 2,0 end if --左右と上下は独立して判定されるので、斜位置にマウスがある場合は連続して発動する。 if item 2 of gmloc-item 2 of bnloc>16 then --下 castWalk 1,0 else if item 2 of gmloc-item 2 of bnloc<-16 then --上 castWalk 4,0 end if idle end dragpl on mousedown --自動主人公動作と当たり判定 global gchd,gBn if gchd is empty and there is a cd btn "Cast0" then if the visible of cd btn "Cast0" then --こっちが主人公を動かす put empty into gBn put "walking" into gchd repeat while the mouse is down dragpl end repeat put empty into gchd send mouseup to cd btn "Cast0" end if else --こっちは当たり判定と入ったあとの準備を global gbn,wchar put the target into gbn if word 3 of gbn is empty then put "z" into wchar --カードだったらエリア外 end if end mousedown on mouseup --調べる/話すをシングルクリックで global gchd,gBn if gchd is empty and there is a cd btn "Cast0" then if gBn is the target and "Map" is not in gBn then send "talk" to gBn end mouseup on mousedoubleclick --情報ウインドウ if short name of the target is "Cast0" then get icon of cd btn "Cast0" set icon of cd btn "Cast0" to ((icon of cd btn "Cast0") div 100)*100 set cursor to Busy --charjump short id of cd btn "Cast0" set icon of cd btn "Cast0" to it push card lock screen go cd "Info" Send "MasterInit" to cd "Info" unlock screen with stretch from bottom fast end if end mousedoubleclick --戦闘用 on EventFight En1,En2,En3,Lv1,Lv2,Lv3,CdName global MDATA put "On" into item 3 of line 8 of MDATA FightTo En1,En2,En3,Lv1,Lv2,Lv3,"OnCard",CdName end EventFight on OnCard send "initcard" to this cd send "StartCard" to this cd end OnCard --マップ移動用ライブラリ-- on LeaveCard global MDATA get (number of this card)-(number of cd 1 of bg id 4056)+1 if it > 0 then SetBooleFlg it,3,true put empty into item 4 of line 8 of MDATA end LeaveCard on MapMove what,CdName,where --マップ移動:スライド if there is not a cd CdName then exit MapMove if where is empty then UxMovie "MovieIdle" else global BGMDATA if where is "inside" then SetBooleFlg 10,1,true send "GoTop" to window (line 1 of BGMDATA) send "Play" to window (line 2 of BGMDATA) else if where is "outside" then SetBooleFlg 10,1,false send "GoTop" to window (line 2 of BGMDATA) send "Play" to window (line 1 of BGMDATA) end if end if end if put icon of cd btn "Cast0" into PlIcon get LocToCharLoc(the value of loc of cd btn "Cast0") put item 1 of it into x put item 2 of it into y if what is 1 then put 2 into y else if what is 2 then put 12 into x else if what is 3 then put 2 into x else put 8 into y lock screen LeaveCard go cd CdName send "initcard" to cd CdName castLocate 0,s,x,y,PlIcon do "unlock screen with push"&&(item what of "up,right,left,down")&&"fast" send "startcard" to this card end MapMove on MapZoom ZM,CdName,x,y,where --マップ移動:入る/出る--open or close if there is not a cd CdName then exit MapZoom if where is empty then UxMovie "MovieIdle" else global BGMDATA if where is "inside" then SetBooleFlg 10,1,true send "GoTop" to window (line 1 of BGMDATA) send "Play" to window (line 2 of BGMDATA) else if where is "outside" then SetBooleFlg 10,1,false send "GoTop" to window (line 2 of BGMDATA) send "Play" to window (line 1 of BGMDATA) end if end if end if put icon of cd btn "Cast0" into PlIcon do ("visual effect iris"&&ZM) LeaveCard go cd "Black" lock screen go cd CdName send "initCard" to this card castLocate 0,s,x,y,PlIcon do "unlock screen with iris"&&(ZM) send "startcard" to this card end MapZoom on MapTran CdName,x,y,where --マップ移動:眠る、隔絶移動 if there is not a cd CdName then exit MapTran if where is empty then UxMovie "MovieIdle" else global BGMDATA if where is "inside" then SetBooleFlg 10,1,true send "GoTop" to window (line 1 of BGMDATA) send "Play" to window (line 2 of BGMDATA) else if where is "outside" then SetBooleFlg 10,1,false send "GoTop" to window (line 2 of BGMDATA) send "Play" to window (line 1 of BGMDATA) end if end if end if put icon of cd btn "Cast0" into PlIcon LeaveCard visual dissolve go cd "Black" wait 30 visual dissolve fast go cd "White" lock screen go cd CdName send "initCard" to this card castLocate 0,s,x,y,PlIcon unlock screen with dissolve fast send "startcard" to this card end MapTran --キャストタイプユーティリティ on openBox flgID,kind,what,btnID --宝箱制御 global GTconsItems,GTweapItems,GTprotItems,GTacceItems put item 1 of line what of the value of (item kind of "GTconsItems,GTweapItems,GTprotItems,GTacceItems") into ItmN play "ドア1" get BooleFlg(flgID,2) if not it then getItem kind,what SetBooleFlg flgID,2,true put icon of cd btn id btnID into BtnIcon set icon of cd btn id btnID to BtnIcon+1 castTell (item kind of "アイテム,武器,防具,アクセサリ")&"『"&ItmN&"』を手に入れた。" end if end openBox on RevSwitch flgID,btnID --スイッチ制御 play "ドア1" get BooleFlg(flgID,1) put icon of cd btn id btnID into BtnIcon if it then set icon of cd btn id btnID to BtnIcon-1 else set icon of cd btn id btnID to BtnIcon+1 --set icon of cd btn id btnID to (BtnIcon div 10)*10+(the length of (it))-3 SetBooleFlg flgID,1,(not it) end RevSwitch on ItemShop btnID --アイテムショップ制御 get script of cd btn id btnID put offset("--TimpaniShop",it) into CH if CH is 0 then exit ItemShop delete line 1 to (number of lines of char 1 to CH of it) of it put item 1 of line 1 of it into mply put item 2 of line 1 of it into mply2 put line 2 of it into mes put icon of cd btn id btnID into icn put ((icon of cd btn "Cast0") div 100)*100+10 into plicn delete line 1 to 2 of it lock screen push card go cd "ItemShop" InitShop it,mply,mply2,mes,icn,plicn unlock screen with stretch from bottom fast end ItemShop on StayInn howmuch,mes --宿屋制御 global MDATA answer "一泊:"&howmuch&RETURN&mes with "やめる" or "泊まる" if it is "やめる" then exit StayInn if (line 7 of MDATA) >= howmuch then subtract howmuch from line 7 of MDATA else answer "お金が足りないようですが…。" with "やめる" exit StayInn end if push cd visual dissolve go cd "Black" repeat with i=1 to 3 if item 1 of line i of MDATA is not empty then put item 4 of line i of MDATA into item 3 of line i of MDATA put item 6 of line i of MDATA into item 5 of line i of MDATA end if end repeat saveMDATA wait 50 visual dissolve fast go cd "White" visual dissolve fast pop cd end StayInn function FlgDoorOpened btnID global MDATA put short name of cd btn id btnID into cn delete char 1 to 4 of cn put (item 1 of line 23 of MDATA) into pn get bg fld "BtnsDATA" multiply pn by 4 put (item (pn+2) to (pn+5) of line cn of it) into LN put item 4 of LN into ic if ic is icon of cd btn id btnID then return false else return true end FlgDoorOpened on openDoor btnID if not FlgDoorOpened(btnID) then play "ドア1" set icon of cd btn id btnID to (icon of cd btn id btnID)+1 end if end openDoor --追加 on BlackMove CdName,x,y,where if where is empty then UxMovie "MovieIdle" else global BGMDATA if where is "inside" then SetBooleFlg 10,1,true send "GoTop" to window (line 1 of BGMDATA) send "Play" to window (line 2 of BGMDATA) else if where is "outside" then SetBooleFlg 10,1,false send "GoTop" to window (line 2 of BGMDATA) send "Play" to window (line 1 of BGMDATA) end if end if end if MapTran CdName,x,y exit to hypercard end BlackMove