@wwawing/engine 4.0.17 → 4.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/wwa.js +12 -12
- package/package.json +11 -11
package/lib/wwa.js
CHANGED
|
@@ -6,7 +6,7 @@ var WWA=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`}
|
|
|
6
6
|
よろしいですか?`,mapdataParams:{messageArea:`message`,index:5}},GAME_SPEED_CHANGED:{code:501,defaultText:`移動速度を【%GAME_SPEED_NAME%】に切り替えました。
|
|
7
7
|
%HIGH_SPEED_MESSAGE%(%MAX_SPEED_INDEX%段階中%GAME_SPEED_INDEX%)
|
|
8
8
|
速度を落とすには%SPEED_DOWN_BUTTON%, 速度を上げるには%SPEED_UP_BUTTON%を押してください。`},GAME_SPEED_CHANGE_DISABLED:{code:502,defaultText:`ここでは移動速度を
|
|
9
|
-
変更できません。`}}),h=Object.keys(m),g=h.reduce((e,t)=>({...e,[t]:t}),{}),_=m;function v(e){return h.some(t=>t===e)}function y(e){for(let t of h)if(_[t].code===e)return t}var b=class e{add(e){return this.strength+=e.strength,this.defence+=e.defence,this}plus(t){return new e(this.strength+t.strength,this.defence+t.defence)}minus(t){return new e(this.strength-t.strength,this.defence-t.defence)}equals(e){return this.strength===e.strength&&this.defence===e.defence}constructor(e,t){this.strength=e,this.defence=t}},x=class e extends b{add(t){return t instanceof e&&(this.energy+=t.energy,this.gold+=t.gold),this.strength+=t.strength,this.defence+=t.defence,this}plus(t){return t instanceof e?new e(this.energy+t.energy,this.strength+t.strength,this.defence+t.defence,this.gold+t.gold):new e(this.energy,this.strength+t.strength,this.defence+t.defence,this.gold)}minus(t){return t instanceof e?new e(this.energy-t.energy,this.strength-t.strength,this.defence-t.defence,this.gold-t.gold):new e(this.energy,this.strength-t.strength,this.defence-t.defence,this.gold)}equals(e){return this.energy===e.energy&&this.strength===e.strength&&this.defence===e.defence&&this.gold===e.gold}calculateScore(e){return Object.keys(e.rates).reduce((t,n)=>t+e.rates[n]*this[n],0)}clone(){return new e(this.energy,this.strength,this.defence,this.gold)}constructor(e,t,n,r){super(t,n),this.energy=e,this.gold=r}},S=class e{equals(e){return this.x===e.x&&this.y===e.y}substract(t){return new e(this.x-t.x,this.y-t.y)}clone(){return new e(this.x,this.y)}convertIntoPosition(e){return new C(e,this.x,this.y,0,0)}getDirectionTo(e){return this.x<e.x?this.y>e.y?9:this.y===e.y?6:3:this.x===e.x?this.y>e.y?8:this.y===e.y?5:2:this.y>e.y?7:this.y===e.y?4:1}toString(){return`(`+this.x+`, `+this.y+`)`}constructor(e=0,t=0){this.x=e,this.y=t}},C=class e{getPartsCoord(){return this._partsCoord}getOffsetCoord(){return this._offsetCoord}getScreenTopPosition(){var t=Math.floor(this._partsCoord.x/(R.H_PARTS_NUM_IN_WINDOW-1))*(R.H_PARTS_NUM_IN_WINDOW-1),n=Math.floor(this._partsCoord.y/(R.V_PARTS_NUM_IN_WINDOW-1))*(R.V_PARTS_NUM_IN_WINDOW-1);return new e(this._wwa,t,n,0,0)}getDefaultCameraPosition(){var e=this.getScreenTopPosition(),t=e.getPartsCoord(),n=this._wwa.getMapWidth(),r=e.getPartsCoord().clone();return t.x===n-1&&r.x--,t.y===n-1&&r.y--,r.convertIntoPosition(this._wwa).getScreenTopPosition()}getNextJustPosition(t){if(t!==void 0){var n=this._partsCoord;return new e(this._wwa,n.x+D[t],n.y+O[t],0,0)}var r=this._partsCoord.x,i=this._partsCoord.y;return this._offsetCoord.x<0?r--:this._offsetCoord.x>0&&r++,this._offsetCoord.y<0?i--:this._offsetCoord.y>0&&i++,new e(this._wwa,r,i,0,0)}getNextFramePosition(t,n,r){var i=this._partsCoord.x,a=this._partsCoord.y,o=this._offsetCoord.x+D[t]*n,s=this._offsetCoord.y+O[t]*r;if(o<0){var c=Math.floor(Math.abs(o)/R.CHIP_SIZE);i-=c,o=(o+c*R.CHIP_SIZE)%R.CHIP_SIZE}if(s<0){var l=Math.floor(Math.abs(s)/R.CHIP_SIZE);a-=l,s=(s+l*R.CHIP_SIZE)%R.CHIP_SIZE}return o>=R.CHIP_SIZE&&(i+=Math.floor(o/R.CHIP_SIZE),o=(o+R.CHIP_SIZE)%R.CHIP_SIZE),s>=R.CHIP_SIZE&&(a+=Math.floor(s/R.CHIP_SIZE),s=(s+R.CHIP_SIZE)%R.CHIP_SIZE),new e(this._wwa,i,a,o,s)}isJustPosition(){return this._offsetCoord.x==0&&this._offsetCoord.y==0}isScreenTopPosition(){var e=this.getScreenTopPosition();return this.equals(e)}equals(e){return this._partsCoord.equals(e.getPartsCoord())&&this._offsetCoord.equals(e.getOffsetCoord())}isInCameraRange(e,t=!1){var n=e.getPosition()._partsCoord,r=this._partsCoord.x,i=this._partsCoord.y,a=+!!t;return n.x<=r&&r<n.x+R.H_PARTS_NUM_IN_WINDOW-a&&n.y<=i&&i<n.y+R.V_PARTS_NUM_IN_WINDOW-a}hasLocalGate(){return this._wwa.getMapTypeByPosition(this)===R.MAP_LOCALGATE||this._wwa.getObjectTypeByPosition(this)===R.OBJECT_LOCALGATE}clone(){return new e(this._wwa,this._partsCoord.x,this._partsCoord.y,this._offsetCoord.x,this._offsetCoord.y)}constructor(e,t,n,r=0,i=0){if(this._wwa=e,this._wwa===void 0)throw Error(`WWAのインスタンスが存在しません. `);var a=this._wwa.getMapWidth();if(t<0||t>=a||t>=a-1&&r>0||n<0||n>=a||n>=a-1&&i>0)throw Error(`範囲外の座標です!! parts:(`+t+`, `+n+`), offset:(`+r+`, `+i+`), mapWidth = `+a);this._partsCoord=new S(t,n),this._offsetCoord=new S(r,i)}},w=class{constructor(e,t,n){this.destPos=e.clone(),this.srcPos=t.clone(),this.srcSize=n.clone()}},ee=class{constructor(e,t,n,r,i){this.partsIDObj=e,this.x=t,this.y=n,this.isStatic=r,this.isFighting=i}},T=function(e){return e[e.GOTO_WWA=0]=`GOTO_WWA`,e[e.BATTLE_REPORT=1]=`BATTLE_REPORT`,e[e.GAME_END=2]=`GAME_END`,e}({}),E=function(e){return e[e.UNUSED=0]=`UNUSED`,e[e.LEFT=4]=`LEFT`,e[e.RIGHT=6]=`RIGHT`,e[e.DOWN=2]=`DOWN`,e[e.UP=8]=`UP`,e[e.LEFT_DOWN=1]=`LEFT_DOWN`,e[e.LEFT_UP=7]=`LEFT_UP`,e[e.RIGHT_DOWN=3]=`RIGHT_DOWN`,e[e.RIGHT_UP=9]=`RIGHT_UP`,e[e.NO_DIRECTION=5]=`NO_DIRECTION`,e}({}),D=[0,-1,0,1,-1,0,1,-1,0,1],O=[0,1,1,1,0,0,0,-1,-1,-1],k=function(e){return e[e.YES=0]=`YES`,e[e.NO=1]=`NO`,e[e.UNSELECTED=2]=`UNSELECTED`,e}({}),A=function(e){return e[e.MAP=0]=`MAP`,e[e.OBJECT=1]=`OBJECT`,e[e.CHOICE_YES=2]=`CHOICE_YES`,e[e.CHOICE_NO=3]=`CHOICE_NO`,e}({}),te=function(e){return e[e.NORMAL=0]=`NORMAL`,e[e.CAN_USE=1]=`CAN_USE`,e[e.NOT_DISAPPEAR=2]=`NOT_DISAPPEAR`,e}({}),j=function(e){return e[e.MAP=1]=`MAP`,e[e.OBJECT=0]=`OBJECT`,e}({}),M=class{constructor(){var e=window.navigator.userAgent;this.os=this._getOS(e),this.browser=this.getBrowser(e),this.device=this.getDevice()}_getOS(e){return e.match(/xbox/i)?9:e.match(/windows/i)?1:e.match(/macintosh/i)?`ontouchstart`in document?5:2:e.match(/iphone|ipad|ipod/i)?5:e.match(/oculus/i)?8:e.match(/android/i)?4:e.match(/nintendo/i)?6:e.match(/playstation/i)?7:e.match(/linux/i)?3:9999}getBrowser(e){return e.match(/chrome/i)?1:e.match(/firefox/i)?2:e.match(/safari/i)?3:9999}getDevice(){switch(this.os){case 1:case 2:case 3:return 1;case 5:case 4:return 2;case 8:return 3;case 6:case 7:case 9:return 4}return 9999}},ne=function(e){return e[e.WINDOWS=1]=`WINDOWS`,e[e.MACINTOSH=2]=`MACINTOSH`,e[e.LINUX=3]=`LINUX`,e[e.ANDROID=4]=`ANDROID`,e[e.IOS=5]=`IOS`,e[e.NINTENDO=6]=`NINTENDO`,e[e.PLAY_STATION=7]=`PLAY_STATION`,e[e.OCULUS=8]=`OCULUS`,e[e.XBOX=9]=`XBOX`,e[e.OTHERS=9999]=`OTHERS`,e}({}),re=function(e){return e[e.PC=1]=`PC`,e[e.SP=2]=`SP`,e[e.VR=3]=`VR`,e[e.GAME=4]=`GAME`,e[e.OTHERS=9999]=`OTHERS`,e}({}),ie=function(e){return e[e.CHROME=1]=`CHROME`,e[e.FIREFOX=2]=`FIREFOX`,e[e.SAFARI=3]=`SAFARI`,e[e.OTHERS=9999]=`OTHERS`,e}({}),N=function(e){return e[e.NONE=0]=`NONE`,e[e.CALL_BY_MAP_PARTS=1]=`CALL_BY_MAP_PARTS`,e[e.CALL_BY_OBJECT_PARTS=2]=`CALL_BY_OBJECT_PARTS`,e[e.CALL_BY_ITEM_USE=3]=`CALL_BY_ITEM_USE`,e[e.CALL_BY_QUICK_SAVE=4]=`CALL_BY_QUICK_SAVE`,e[e.CALL_BY_QUICK_LOAD=5]=`CALL_BY_QUICK_LOAD`,e[e.CALL_BY_RESTART_GAME=6]=`CALL_BY_RESTART_GAME`,e[e.CALL_BY_GOTO_WWA=7]=`CALL_BY_GOTO_WWA`,e[e.CALL_BY_PASSWORD_SAVE=8]=`CALL_BY_PASSWORD_SAVE`,e[e.CALL_BY_PASSWORD_LOAD=9]=`CALL_BY_PASSWORD_LOAD`,e[e.CALL_BY_END_GAME=10]=`CALL_BY_END_GAME`,e[e.CALL_BY_SUSPEND=11]=`CALL_BY_SUSPEND`,e[e.CALL_BY_LOG_QUICK_SAVE=12]=`CALL_BY_LOG_QUICK_SAVE`,e[e.CALL_BY_LOG_QUICK_LOAD=13]=`CALL_BY_LOG_QUICK_LOAD`,e}({}),P=function(e){return e[e.QUICK_LOAD=0]=`QUICK_LOAD`,e[e.QUICK_SAVE=1]=`QUICK_SAVE`,e[e.RESTART_GAME=2]=`RESTART_GAME`,e[e.GOTO_WWA=3]=`GOTO_WWA`,e}({}),ae=function(e){return e[e.UP=0]=`UP`,e[e.DOWN=1]=`DOWN`,e}({}),oe=function(e){return e[e.QUICK_LOAD=0]=`QUICK_LOAD`,e[e.RESTART_GAME=1]=`RESTART_GAME`,e[e.PASSWORD=2]=`PASSWORD`,e}({}),se=function(e){return e[e.STATIC=0]=`STATIC`,e[e.CHASE_PLAYER=1]=`CHASE_PLAYER`,e[e.RUN_OUT=2]=`RUN_OUT`,e[e.HANG_AROUND=3]=`HANG_AROUND`,e}({}),ce=function(e){return e[e.MODE_X=0]=`MODE_X`,e[e.MODE_Y=1]=`MODE_Y`,e[e.UNDECIDED=2]=`UNDECIDED`,e}({}),F=[`cell-load`,`cell-save`,`cell-restart`,`cell-gotowwa`],I=function(e){return e[e.UNDEFINED=0]=`UNDEFINED`,e[e.IMGPLAYER=1]=`IMGPLAYER`,e[e.IMGYESNO=2]=`IMGYESNO`,e[e.HPMAX=3]=`HPMAX`,e[e.SAVE=4]=`SAVE`,e[e.ITEM=5]=`ITEM`,e[e.DEFAULT=6]=`DEFAULT`,e[e.OLDMAP=7]=`OLDMAP`,e[e.PARTS=8]=`PARTS`,e[e.MOVE=9]=`MOVE`,e[e.MAP=10]=`MAP`,e[e.DIRMAP=11]=`DIRMAP`,e[e.IMGFRAME=12]=`IMGFRAME`,e[e.IMGBOM=13]=`IMGBOM`,e[e.DELPLAYER=14]=`DELPLAYER`,e[e.FACE=15]=`FACE`,e[e.EFFECT=16]=`EFFECT`,e[e.GAMEOVER=17]=`GAMEOVER`,e[e.IMGCLICK=18]=`IMGCLICK`,e[e.STATUS=19]=`STATUS`,e[e.EFFITEM=20]=`EFFITEM`,e[e.COLOR=21]=`COLOR`,e[e.WAIT=22]=`WAIT`,e[e.SOUND=23]=`SOUND`,e[e.JUMPGATE=24]=`JUMPGATE`,e[e.RECPOSITION=25]=`RECPOSITION`,e[e.JUMPRECPOSITION=26]=`JUMPRECPOSITION`,e[e.CONSOLE_LOG=27]=`CONSOLE_LOG`,e[e.COPY_HP_TO=28]=`COPY_HP_TO`,e[e.SET_HP=29]=`SET_HP`,e[e.COPY_HPMAX_TO=30]=`COPY_HPMAX_TO`,e[e.SET_HPMAX=31]=`SET_HPMAX`,e[e.COPY_AT_TO=32]=`COPY_AT_TO`,e[e.SET_AT=33]=`SET_AT`,e[e.COPY_DF_TO=34]=`COPY_DF_TO`,e[e.SET_DF=35]=`SET_DF`,e[e.COPY_MONEY_TO=36]=`COPY_MONEY_TO`,e[e.SET_MONEY=37]=`SET_MONEY`,e[e.COPY_STEP_COUNT_TO=38]=`COPY_STEP_COUNT_TO`,e[e.VAR_SET_VAL=39]=`VAR_SET_VAL`,e[e.VAR_SET=40]=`VAR_SET`,e[e.VAR_ADD=41]=`VAR_ADD`,e[e.VAR_SUB=42]=`VAR_SUB`,e[e.VAR_MUL=43]=`VAR_MUL`,e[e.VAR_DIV=44]=`VAR_DIV`,e[e.VAR_SET_RAND=45]=`VAR_SET_RAND`,e[e.SHOW_STR=46]=`SHOW_STR`,e[e.GAME_SPEED=47]=`GAME_SPEED`,e[e.IF=50]=`IF`,e[e.SET_SPEED=51]=`SET_SPEED`,e[e.COPY_TIME_TO=52]=`COPY_TIME_TO`,e[e.HIDE_STATUS=53]=`HIDE_STATUS`,e[e.VAR_MAP=54]=`VAR_MAP`,e[e.VAR_MOD=55]=`VAR_MOD`,e[e.NO_GAMEOVER=56]=`NO_GAMEOVER`,e[e.ELSE_IF=57]=`ELSE_IF`,e[e.ELSE=58]=`ELSE`,e[e.END_IF=59]=`END_IF`,e[e.SET=60]=`SET`,e[e.MAP2=61]=`MAP2`,e[e.SHOW_STR2=62]=`SHOW_STR2`,e[e.CONSOLE_LOG2=63]=`CONSOLE_LOG2`,e[e.DELAYBGM=64]=`DELAYBGM`,e[e.SYSMSG=65]=`SYSMSG`,e[e.PICTURE=66]=`PICTURE`,e[e.GAMEPAD_BUTTON=100]=`GAMEPAD_BUTTON`,e[e.OLDMOVE=101]=`OLDMOVE`,e[e.LEGACY_IF=10050]=`LEGACY_IF`,e}({}),le={"":0,$imgplayer:1,$imgyesno:2,$hpmax:3,$save:4,$item:5,$default:6,$oldmap:7,$parts:8,$move:9,$map:10,$dirmap:11,$imgframe:12,$imgbom:13,$delplayer:14,$face:15,$effect:16,$gameover:17,$imgclick:18,$status:19,$effitem:20,$color:21,$wait:22,$sound:23,$jumpgate:24,$rec_pos:25,$jump_rec_pos:26,$console_log:27,$copy_hp_to:28,$set_hp:29,$copy_hpmax_to:30,$set_hpmax:31,$copy_at_to:32,$set_at:33,$copy_df_to:34,$set_df:35,$copy_money_to:36,$set_money:37,$copy_step_count_to:38,$var_set_val:39,$var_set:40,$var_add:41,$var_sub:42,$var_mul:43,$var_div:44,$var_set_rand:45,$show_str:46,$game_speed:47,$if:50,$set_speed:51,$copy_time_to:52,$hide_status:53,$var_map:54,$var_mod:55,$no_gameover:56,$else_if:57,$else:58,$endif:59,$set:60,$map2:61,$show_str2:62,$console_log2:63,$delaybgm:64,$sysmsg:65,$picture:66,$gamepad_button:100,$oldmove:101},ue=function(e){return e[e.ENERGY=0]=`ENERGY`,e[e.STRENGTH=1]=`STRENGTH`,e[e.DEFENCE=2]=`DEFENCE`,e[e.GOLD=3]=`GOLD`,e[e.MOVES=4]=`MOVES`,e}({}),L=function(e){return e[e.ENERGY=0]=`ENERGY`,e[e.STRENGTH=1]=`STRENGTH`,e[e.DEFENCE=2]=`DEFENCE`,e[e.GOLD=3]=`GOLD`,e[e.WIDE_CELL_ROW=4]=`WIDE_CELL_ROW`,e[e.ITEM_BG=5]=`ITEM_BG`,e[e.MAIN_FRAME=6]=`MAIN_FRAME`,e}({}),de=[1,2,5,8,10,20],fe=[`超低速`,`低速`,`準低速`,`中速`,`高速`,`超高速`],pe=[`energy`,`strength`,`defence`,`gold`],R=class e{static{this.WWA_HOME=`http://wwajp.com`}static{this.TARGET_FPS=60}static{this.INTERVAL_MS=1e3/e.TARGET_FPS}static{this.ITEMBOX_SIZE=12}static{this.MAP_ATR_MAX=60}static{this.OBJ_ATR_MAX=60}static{this.OLD_MAP_ATR_MAX=40}static{this.OLD_OBJ_ATR_MAX=40}static{this.ATR_TYPE=3}static{this.ATR_MODE=4}static{this.ATR_STRING=5}static{this.ATR_X=6}static{this.ATR_Y=7}static{this.ATR_X2=8}static{this.ATR_Y2=9}static{this.ATR_ENERGY=10}static{this.ATR_STRENGTH=11}static{this.ATR_DEFENCE=12}static{this.ATR_GOLD=13}static{this.ATR_ITEM=14}static{this.ATR_NUMBER=15}static{this.ATR_JUMP_X=16}static{this.ATR_MOVE=16}static{this.ATR_JUMP_Y=17}static{this.ATR_SOUND=19}static{this.ATR_APPERANCE_BASE=20}static{this.REL_ATR_APPERANCE_ID=0}static{this.REL_ATR_APPERANCE_X=1}static{this.REL_ATR_APPERANCE_Y=2}static{this.REL_ATR_APPERANCE_TYPE=3}static{this.REL_ATR_APPERANCE_UNIT_LENGTH=4}static{this.ATR_RANDOM_BASE=10}static{this.RANDOM_ATR_NUM=10}static{this.RANDOM_ITERATION_MAX=10}static{this.MAP_STREET=0}static{this.MAP_WALL=1}static{this.MAP_LOCALGATE=2}static{this.MAP_URLGATE=4}static{this.OBJECT_NORMAL=0}static{this.OBJECT_MESSAGE=1}static{this.OBJECT_URLGATE=2}static{this.OBJECT_STATUS=3}static{this.OBJECT_ITEM=4}static{this.OBJECT_DOOR=5}static{this.OBJECT_MONSTER=6}static{this.OBJECT_SCORE=11}static{this.OBJECT_SELL=14}static{this.OBJECT_BUY=15}static{this.OBJECT_RANDOM=16}static{this.OBJECT_SELECT=17}static{this.OBJECT_LOCALGATE=18}static{this.SYSTEM_MESSAGE_NUM=20}static{this.IMGPOS_DEFAULT_YESNO_X=3}static{this.IMGPOS_DEFAULT_YESNO_Y=1}static{this.IMGRELPOS_YESNO_YES_X=0}static{this.IMGRELPOS_YESNO_NO_X=1}static{this.IMGRELPOS_YESNO_YESP_X=2}static{this.IMGRELPOS_YESNO_NOP_X=3}static{this.IMGPOS_DEFAULT_CLICKABLE_ITEM_SIGN_X=0}static{this.IMGPOS_DEFAULT_CLICKABLE_ITEM_SIGN_Y=0}static{this.IMGPOS_DEFAULT_FRAME_X=0}static{this.IMGPOS_DEFAULT_FRAME_Y=1}static{this.IMGPOS_DEFAULT_BATTLE_EFFECT_X=3}static{this.IMGPOS_DEFAULT_BATTLE_EFFECT_Y=3}static{this.DEFAULT_DISABLE_SAVE=!1}static{this.DEFAULT_OLDMAP=!1}static{this.DEFAULT_OBJECT_NO_COLLAPSE=!1}static{this.SPLASH_SCREEN_DISP_MILLS=100}static{this.DEFAULT_FRAME_INTERVAL=20}static{this.GAMEOVER_FRAME_INTERVAL=50}static{this.YESNO_PRESS_DISP_FRAME_NUM=20}static{this.WAIT_TIME_FRAME_NUM=6}static{this.CHIP_SIZE=40}static{this.MAP_WINDOW_WIDTH=440}static{this.MAP_WINDOW_HEIGHT=440}static{this.H_PARTS_NUM_IN_WINDOW=e.MAP_WINDOW_WIDTH/e.CHIP_SIZE}static{this.V_PARTS_NUM_IN_WINDOW=e.MAP_WINDOW_HEIGHT/e.CHIP_SIZE}static{this.MIN_SPEED_INDEX=0}static{this.MAX_SPEED_INDEX=de.length-1}static{this.QUICK_BATTLE_SPEED_INDECIES=[de.length-2,de.length-1]}static{this.ANIMATION_REP_HALF_FRAME=32}static{this.PLAYER_LOOKING_AROUND_START_FRAME=80}static{this.PLAYER_LOOKING_AROUND_LOOP_INTERVAL_FRAME=80}static{this.RELATIVE_COORD_BIAS=1e4}static{this.RELATIVE_COORD_LOWER=e.RELATIVE_COORD_BIAS-1e3}static{this.PLAYER_COORD=e.RELATIVE_COORD_BIAS-1e3}static{this.LOCALGATE_PLAYER_WAIT_FRAME=5}static{this.STATUS_CHANGED_EFFECT_FRAME_NUM=20}static{this.PASSABLE_OBJECT=1}static{this.APPERANCE_PARTS_MIN_INDEX=0}static{this.APPERANCE_PARTS_MAX_INDEX=9}static{this.APPERANCE_PARTS_MIN_INDEX_NO=5}static{this.APPERANCE_PARTS_MAX_INDEX_YES=4}static{this.FADEOUT_SPEED=8}static{this.STATUS_MINUS_BORDER=3e4}static{this.ITEMBOX_IS_FULL=-1}static{this.BATTLE_INTERVAL_FRAME_NUM=10}static{this.BATTLE_SPEED_CHANGE_TURN_NUM=40}static{this.RANDOM_MOVE_ITERATION_NUM=50}static{this.RANDOM_MOVE_ITERATION_NUM_BEFORE_V31=8}static{this.BATTLE_ESTIMATE_MONSTER_TYPE_MAX=8}static{this.SOUND_MAX=100}static{this.ITEM_BORDER_IMG_DATA_URL=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAArklEQVRYR+2Y0QqAIAxFt///aENJHwxxuJUSxzeh3S7HXaNpEkly4FIRzba0GEyHeVTN7jqDWvb7V4Y1NLibZIY0NbiL5G3MZLCe / 1fn3XJgJYjB7mgg6O1VCEKwXo79JeklY62nB62kRs9BEIKkeNIDhISQEBJC4k0BBCF4D7D4cV9shf99ixdB + MrM0y3fa3zV05D45GOqhwPMGPkYlccIOEY2VKUN0UNVXxC7ADj7mDi9aFZZAAAAAElFTkSuQmCC`}static{this.LOAD_STAGE_MAX_EXCEPT_AUDIO=7}static{this.WWA_STYLE_TAG_ID=`wwa-additional-style`}static{this.DEFAULT_FRAME_COLOR_R=255}static{this.DEFAULT_FRAME_COLOR_G=255}static{this.DEFAULT_FRAME_COLOR_B=255}static{this.DEFAULT_FRAMEOUT_COLOR_R=96}static{this.DEFAULT_FRAMEOUT_COLOR_G=96}static{this.DEFAULT_FRAMEOUT_COLOR_B=96}static{this.DEFAULT_STRBACK_COLOR_R=0}static{this.DEFAULT_STRBACK_COLOR_G=0}static{this.DEFAULT_STRBACK_COLOR_B=0}static{this.DEFAULT_STATUS_COLOR_R=0}static{this.DEFAULT_STATUS_COLOR_G=0}static{this.DEFAULT_STATUS_COLOR_B=0}static{this.KEYPRESS_MESSAGE_CHANGE_FRAME_NUM=20}static{this.WWAP_SERVER_OLD=`http://wwawing.com/wwap`}static{this.WWAP_SERVER=`https://wwaphoenix.github.io`}static{this.WWAP_SERVER_AUDIO_DIR=`audio`}static{this.WWAP_SERVER_TITLE_IMG=`cover_p.gif`}static{this.WWAP_SERVER_LOADER_NO_WORKER=`wwaload.noworker.js`}static{this.SCREEN_WIDTH=560}static{this.SCREEN_HEIGHT=440}static{this.LOADING_FONT=`Times New Roman`}static{this.MSG_STR_WIDTH=16}static{this.ITEM_EFFECT_SPEED_PIXEL_PER_FRAME=20}static{this.ITEMBOX_TOP_Y=140}static{this.USER_VAR_NUM=256}static{this.USER_VAR_NUM_MAX_VALUE=9007199254740991}static{this.USET_VAR_NUM_MIN_VALUE=-9007199254740991}static{this.CONTROLL_WAIT_FRAME=6}static{this.INLINE_USER_VAR_VIEWER_DISPLAY_NUM=10}static{this.FIGHT_DRAW_TURN=40}},me=class{static{this.QUICK_SAVE_MAX=4}static{this.QUICK_SAVE_THUMNAIL_WIDTH=99}static{this.QUICK_SAVE_THUMNAIL_HEIGHT=99}static{this.SAVE_INTERVAL_MOVE=200}static{this.INDEXEDDB_DB_NAME=`WWA_WING_DB`}static{this.INDEXEDDB_TABLE_NAME=`SAVE_TABLE`}static{this.DATE_LAST_SAVE_TEXT_COLOR=`rgba(255,255,0,1)`}},he=class{static{this.EMPTY_LOAD=``}static{this.EMPTY_SAVE=``}static{this.PASSWORD=`Password`}static{this.QUICK_SAVE=`Quick Save`}static{this.QUICK_LOAD=`Quick Load`}static{this.BATTLE_REPORT=`Battle Report`}static{this.GAME_END=`Game End`}static{this.GOTO_WWA=`Goto WWA`}static{this.RESTART_GAME=`Restart Game`}},ge=class{},_e=function(e){return e[e.INIT=0]=`INIT`,e[e.MAP_LOAD=1]=`MAP_LOAD`,e[e.OBJ_LOAD=2]=`OBJ_LOAD`,e[e.MAP_ATTR=3]=`MAP_ATTR`,e[e.OBJ_ATTR=4]=`OBJ_ATTR`,e[e.RAND_PARTS=5]=`RAND_PARTS`,e[e.MESSAGE=6]=`MESSAGE`,e[e.GAME_INIT=7]=`GAME_INIT`,e[e.AUDIO=8]=`AUDIO`,e[e.FINISH=9]=`FINISH`,e}({}),ve=[`ロードの準備をしています。`,`背景パーツを読み込んでいます。`,`物体パーツを読み込んでます。`,`背景パーツの属性を読み込んでます。`,`物体パーツの属性を読み込んでます。`,`ランダムパーツを置換しています。`,`メッセージを読み込んでます。`,`Welcome to WWA Wing!`],ye=[`Welcome to WWA Wing!`,`Now Map Data Loading .....`,`Now CG Data Loading .....`,`Now Making chara CG .....`],z=function(e){return e[e.LINE=30]=`LINE`,e[e.TITLE_X=100]=`TITLE_X`,e[e.TITLE_Y=70]=`TITLE_Y`,e[e.LOADING_X=50]=`LOADING_X`,e[e.LOADING_Y=140]=`LOADING_Y`,e[e.ERROR_X=10]=`ERROR_X`,e[e.ERROR_Y=180]=`ERROR_Y`,e[e.FOOTER_X=160]=`FOOTER_X`,e[e.FOOTER_Y=360]=`FOOTER_Y`,e[e.WORLD_Y=330]=`WORLD_Y`,e[e.COPYRIGHT_Y=390]=`COPYRIGHT_Y`,e}({}),be=function(e){return e[e.TITLE=32]=`TITLE`,e[e.LOADING=22]=`LOADING`,e[e.FOOTER=18]=`FOOTER`,e[e.ERRROR=16]=`ERRROR`,e}({}),xe=function(e){return e[e.COLOR_FRAME=0]=`COLOR_FRAME`,e[e.COLOR_FRAMEOUT=1]=`COLOR_FRAMEOUT`,e[e.COLOR_STR=2]=`COLOR_STR`,e[e.COLOR_STATUS_STR=4]=`COLOR_STATUS_STR`,e}({}),Se=function(e){return e[e.MESSAGE_WINDOW=0]=`MESSAGE_WINDOW`,e[e.SIDEBAR=1]=`SIDEBAR`,e}({}),Ce=function(e){return e[e.BITSHIFT=16]=`BITSHIFT`,e[e.BITMASK=65535]=`BITMASK`,e}({}),B=function(e){return e[e.NONE=0]=`NONE`,e[e.KEYDOWN=1]=`KEYDOWN`,e[e.KEYPRESS=2]=`KEYPRESS`,e[e.KEYUP=3]=`KEYUP`,e[e.KEYPRESS_MESSAGECHANGE=4]=`KEYPRESS_MESSAGECHANGE`,e}({}),V=function(e){return e[e.KEY_ENTER=13]=`KEY_ENTER`,e[e.KEY_SHIFT=16]=`KEY_SHIFT`,e[e.KEY_ESC=27]=`KEY_ESC`,e[e.KEY_SPACE=32]=`KEY_SPACE`,e[e.KEY_LEFT=37]=`KEY_LEFT`,e[e.KEY_UP=38]=`KEY_UP`,e[e.KEY_RIGHT=39]=`KEY_RIGHT`,e[e.KEY_DOWN=40]=`KEY_DOWN`,e[e.KEY_0=48]=`KEY_0`,e[e.KEY_1=49]=`KEY_1`,e[e.KEY_2=50]=`KEY_2`,e[e.KEY_3=51]=`KEY_3`,e[e.KEY_4=52]=`KEY_4`,e[e.KEY_5=53]=`KEY_5`,e[e.KEY_6=54]=`KEY_6`,e[e.KEY_7=55]=`KEY_7`,e[e.KEY_8=56]=`KEY_8`,e[e.KEY_9=57]=`KEY_9`,e[e.KEY_A=65]=`KEY_A`,e[e.KEY_B=66]=`KEY_B`,e[e.KEY_C=67]=`KEY_C`,e[e.KEY_D=68]=`KEY_D`,e[e.KEY_E=69]=`KEY_E`,e[e.KEY_F=70]=`KEY_F`,e[e.KEY_G=71]=`KEY_G`,e[e.KEY_H=72]=`KEY_H`,e[e.KEY_I=73]=`KEY_I`,e[e.KEY_J=74]=`KEY_J`,e[e.KEY_K=75]=`KEY_K`,e[e.KEY_L=76]=`KEY_L`,e[e.KEY_M=77]=`KEY_M`,e[e.KEY_N=78]=`KEY_N`,e[e.KEY_O=79]=`KEY_O`,e[e.KEY_P=80]=`KEY_P`,e[e.KEY_Q=81]=`KEY_Q`,e[e.KEY_R=82]=`KEY_R`,e[e.KEY_S=83]=`KEY_S`,e[e.KEY_T=84]=`KEY_T`,e[e.KEY_U=85]=`KEY_U`,e[e.KEY_V=86]=`KEY_V`,e[e.KEY_W=87]=`KEY_W`,e[e.KEY_X=88]=`KEY_X`,e[e.KEY_Y=89]=`KEY_Y`,e[e.KEY_Z=90]=`KEY_Z`,e[e.KEY_NUM0=96]=`KEY_NUM0`,e[e.KEY_NUM1=97]=`KEY_NUM1`,e[e.KEY_NUM2=98]=`KEY_NUM2`,e[e.KEY_NUM3=99]=`KEY_NUM3`,e[e.KEY_NUM4=100]=`KEY_NUM4`,e[e.KEY_NUM5=101]=`KEY_NUM5`,e[e.KEY_NUM6=102]=`KEY_NUM6`,e[e.KEY_NUM7=103]=`KEY_NUM7`,e[e.KEY_NUM8=104]=`KEY_NUM8`,e[e.KEY_NUM9=105]=`KEY_NUM9`,e[e.KEY_F1=112]=`KEY_F1`,e[e.KEY_F2=113]=`KEY_F2`,e[e.KEY_F3=114]=`KEY_F3`,e[e.KEY_F4=115]=`KEY_F4`,e[e.KEY_F5=116]=`KEY_F5`,e[e.KEY_F6=117]=`KEY_F6`,e[e.KEY_F7=118]=`KEY_F7`,e[e.KEY_F8=119]=`KEY_F8`,e[e.KEY_F9=120]=`KEY_F9`,e[e.KEY_F10=121]=`KEY_F10`,e[e.KEY_F12=123]=`KEY_F12`,e}({}),we=class e{static{this.KEY_BUFFER_MAX=256}checkHitKey(e){var t=this.getKeyState(e);return t===1||t===2}getKeyState(e){return this._prevKeyState[e]?this._keyState[e]?2:3:+!!this._keyState[e]}getKeyStateForControllPlayer(e){return this._prevKeyStateOnControllable[e]?this._keyState[e]?2:3:+!!this._keyState[e]}getKeyStateForMessageCheck(e){return this._prevKeyState[e]?this._keyState[e]?this._keyInputContinueFrameNum[e]>=R.KEYPRESS_MESSAGE_CHANGE_FRAME_NUM?4:2:3:+!!this._keyState[e]}setPressInfo(e){this._nextKeyState[e]=!0,this._keyInputContinueFrameNum[e]=-1}setReleaseInfo(e){this._nextKeyState[e]=!1,this._keyInputContinueFrameNum[e]=-1}update(){var t;for(this._prevKeyState=this._keyState.slice(),this._keyState=this._nextKeyState.slice(),t=0;t<e.KEY_BUFFER_MAX;t++)this._keyState[t]&&this._keyInputContinueFrameNum[t]++}memorizeKeyStateOnControllableFrame(){this._prevKeyStateOnControllable=this._keyState.slice()}allClear(){var t;for(this._nextKeyState=Array(e.KEY_BUFFER_MAX),t=0;t<e.KEY_BUFFER_MAX;t++)this._nextKeyState[t]=!1}constructor(){var t;for(this._nextKeyState=Array(e.KEY_BUFFER_MAX),this._keyState=Array(e.KEY_BUFFER_MAX),this._prevKeyState=Array(e.KEY_BUFFER_MAX),this._prevKeyStateOnControllable=Array(e.KEY_BUFFER_MAX),this._keyInputContinueFrameNum=Array(e.KEY_BUFFER_MAX),t=0;t<e.KEY_BUFFER_MAX;t++)this._nextKeyState[t]=!1,this._keyState[t]=!1,this._prevKeyState[t]=!1,this._prevKeyStateOnControllable[t]=!1,this._keyInputContinueFrameNum[t]=0}},Te=function(e){return e[e.NONE=0]=`NONE`,e[e.MOUSEDOWN=1]=`MOUSEDOWN`,e[e.MOUSEPRESS=2]=`MOUSEPRESS`,e[e.MOUSEUP=3]=`MOUSEUP`,e}({}),Ee=class{checkClickMouse(e){var t=e===void 0?this.getMouseState():this.getMouseState(e);return t===1||t===2}getMouseState(e){return e!==void 0&&this._inputDir!==e?0:this._prevMouseState?this._mouseState?2:3:+!!this._mouseState}getMouseStateForControllPlayer(e){return e!==void 0&&this._inputDir!==e?0:this._prevMouseStateOnControllable?this._mouseState?2:3:+!!this._mouseState}setPressInfo(e,t){this._nextMouseState=!0,this._inputDir=e,this._touchID=t}setReleaseInfo(){this._touchID=0,this._nextMouseState=!1}touchIDIsSetDir(){return this._touchID===1}memorizeMouseStateOnControllableFrame(){this._prevMouseStateOnControllable=this._mouseState}update(){this._prevMouseState=this._mouseState,this._mouseState=this._nextMouseState}clear(){this._nextMouseState=!1}getTouchID(){return this._touchID}constructor(){this._prevMouseState=!1,this._mouseState=!1,this._nextMouseState=!1}},H=function(e){return e[e.BUTTON_INDEX_B=0]=`BUTTON_INDEX_B`,e[e.BUTTON_INDEX_A=1]=`BUTTON_INDEX_A`,e[e.BUTTON_INDEX_Y=2]=`BUTTON_INDEX_Y`,e[e.BUTTON_INDEX_X=3]=`BUTTON_INDEX_X`,e[e.BUTTON_INDEX_L=4]=`BUTTON_INDEX_L`,e[e.BUTTON_INDEX_R=5]=`BUTTON_INDEX_R`,e[e.BUTTON_INDEX_ZL=6]=`BUTTON_INDEX_ZL`,e[e.BUTTON_INDEX_ZR=7]=`BUTTON_INDEX_ZR`,e[e.BUTTON_INDEX_MINUS=8]=`BUTTON_INDEX_MINUS`,e[e.BUTTON_INDEX_PLUS=9]=`BUTTON_INDEX_PLUS`,e[e.BUTTON_INDEX_LEFT_STICK=10]=`BUTTON_INDEX_LEFT_STICK`,e[e.BUTTON_INDEX_RIGHT_STICK=11]=`BUTTON_INDEX_RIGHT_STICK`,e[e.BUTTON_CROSS_KEY_UP=12]=`BUTTON_CROSS_KEY_UP`,e[e.BUTTON_CROSS_KEY_DOWN=13]=`BUTTON_CROSS_KEY_DOWN`,e[e.BUTTON_CROSS_KEY_LEFT=14]=`BUTTON_CROSS_KEY_LEFT`,e[e.BUTTON_CROSS_KEY_RIGHT=15]=`BUTTON_CROSS_KEY_RIGHT`,e}({}),De=class{constructor(){this.gamepad=null,this.triggers=[];var e;for(e=0;e<16;e++)this.triggers[e]=!1}update(){this.gamepad=null;var e=navigator.getGamepads?navigator.getGamepads():navigator.webkitGetGamepads?navigator.webkitGetGamepads:[];if(e&&e.length>0&&e[0]){var t=e[0];this.gamepad=t}}buttonTrigger(...e){if(!this.gamepad)return!1;var t,n=e.length,r,i,a;for(t=0;t<n;t++){r=e[t];var o=this.gamepad.buttons[r];if(!o)return!1;if(i=typeof o==`object`?o.pressed===!0:o===1,a=this.triggers[r],this.triggers[r]=i,i&&!a)return!0}return!1}buttonPressed(...e){if(!this.gamepad)return!1;var t,n=e.length,r,i;for(t=0;t<n;t++){r=e[t];var a=this.gamepad.buttons[r];if(!a)return!1;if(i=typeof a==`object`?a.pressed===!0:a===1,i)return!0}return!1}crossPressed(...e){if(!this.gamepad)return!1;var t,n=e.length,r;for(t=0;t<n;t++)switch(r=e[t],r){case 12:if(this.gamepad.axes[1]<=-.6||this.gamepad.axes[3]<=-.6||this.stickFloor(9)===-1||this.buttonPressed(12))return!0;break;case 13:if(this.gamepad.axes[1]>=.7||this.gamepad.axes[3]>=.7||this.stickFloor(9)===.1||this.buttonPressed(13))return!0;break;case 14:if(this.gamepad.axes[0]<=-.7||this.gamepad.axes[2]<=-.7||this.stickFloor(9)===.7||this.buttonPressed(14))return!0;break;case 15:if(this.gamepad.axes[0]>.6||this.gamepad.axes[2]>.6||this.stickFloor(9)===-.5||this.buttonPressed(15))return!0;break}return!1}vibration(e){if(!this.gamepad||!this.gamepad.vibrationActuator)return!1;e?this.gamepad.vibrationActuator.playEffect(`dual-rumble`,{startDelay:0,duration:100,weakMagnitude:1,strongMagnitude:.5}):this.gamepad.vibrationActuator.playEffect(`dual-rumble`,{startDelay:0,duration:100,weakMagnitude:.5,strongMagnitude:1})}stickFloor(...e){if(!this.gamepad)return 0;var t,n=e.length,r;for(t=0;t<n;t++){r=e[t];var i=this.gamepad.axes[r];return typeof i==`number`?Math.floor(i*10)/10:0}return 0}},Oe=class e{constructor(e=0){this.lastCalculatedTimeUnixMs=Date.now(),this.lastCalculatedPlayTimeMs=e}calculateTimeMs(){let e=Date.now(),t=e-this.lastCalculatedTimeUnixMs+this.lastCalculatedPlayTimeMs;return this.lastCalculatedTimeUnixMs=e,this.lastCalculatedPlayTimeMs=t,t}calculatePlayTimeFormat(){return e.formatPlayTimeText(this.calculateTimeMs()/1e3)}static formatPlayTimeText(e){let t=Math.floor(e);return t>=3600*1e4?`9999:99:99`:(`000`+(t/60/60|0)).slice(-4)+`:`+(`0`+(t/60|0)%60).slice(-2)+`:`+(`0`+t%60).slice(-2)}},ke=[`BUTTON_ENTER`,`BUTTON_ESC`,`BUTTON_SIDEBAR`,`BUTTON_FAST`,`BUTTON_SLOW`,`BUTTON_LEFT`,`BUTTON_UP`,`BUTTON_RIGHT`,`BUTTON_DOWN`],Ae=[`BUTTON_LEFT`,`BUTTON_UP`,`BUTTON_RIGHT`,`BUTTON_DOWN`],je=new Set(Ae),Me=class e{constructor(t,n=!1,r=null,i=null,a=null,o=null){if(this._enabled=t!==null,this._visible=n,this._onTouchStart=a||null,this._onTouchEnd=o||null,this._availableButtons=[],this._isTouchingButtons={},this._moveButtonsElement=i,this._buttonWrapperElement=r,this._setVisible(n),this._moveButtonsElement&&(this._moveButtonsElement.style.visibility=`visible`),this._buttonWrapperElement&&(this._buttonWrapperElement.style.visibility=`visible`),t!==null){for(let n in t){let r=t[n];if(!r)continue;let i=n;this._availableButtons.push(i),r.setAttribute(`type`,n),this._isTouchingButtons[i]={prev:!1,current:!1,next:!1};let a=e=>{e.cancelable&&e.preventDefault()};r.addEventListener(`touchstart`,e=>{a(e),this.setTouchInfo(i)}),r.addEventListener(`touchcancel`,e=>{a(e),this.allClear()}),e.isMoveButton(i)?(r.addEventListener(`touchmove`,this._detectMovingMoveButton.bind(this)),r.addEventListener(`touchend`,this.allMoveClear.bind(this))):r.addEventListener(`touchend`,e=>{a(e),this.clearTouchInfo(i)})}i!==null&&i.addEventListener(`touchmove`,this._detectMovingMoveButton.bind(this))}}_detectMovingMoveButton(e){e.preventDefault(),this.allMoveClear();let t=e.targetTouches.item(0);if(!this._moveButtonsElement||t===null)return;let n=this._moveButtonsElement.getBoundingClientRect(),r=document.body.getBoundingClientRect(),i=n.left-r.left+n.width/2,a=n.top-r.top+n.height/2,o=t.pageX-i,s=t.pageY-a;o>=s?o<=-s?this.setTouchInfo(`BUTTON_UP`):this.setTouchInfo(`BUTTON_RIGHT`):o>=-s?this.setTouchInfo(`BUTTON_DOWN`):this.setTouchInfo(`BUTTON_LEFT`)}_setVisible(e){this._moveButtonsElement!==null&&(this._moveButtonsElement.style.display=e?`grid`:`none`),this._buttonWrapperElement!==null&&(this._buttonWrapperElement.style.display=e?`grid`:`none`),this._visible=e}checkTouchButton(e){return this._enabled?this.getButtonState(e)===`TOUCH`:!1}checkTouchingButton(e){if(!this._enabled)return!1;let t=this.getButtonState(e);return t===`TOUCH`||t===`TOUCHING`}getButtonState(e){let t=this._isTouchingButtons[e];if(!this._enabled||t===void 0)return`NONE`;let n=t.prev,r=t.current;return n&&r?`TOUCHING`:r?`TOUCH`:n?`LEAVE`:`NONE`}setTouchInfo(e){let t=this._isTouchingButtons[e];!this._enabled||t===void 0||(t.next=!0)}clearTouchInfo(e){let t=this._isTouchingButtons[e];!this._enabled||t===void 0||(t.next=!1)}allMoveClear(){Ae.forEach(e=>{this._availableButtons.includes(e)&&this.clearTouchInfo(e)})}allClear(){this._availableButtons.forEach(e=>{if(e!==void 0){let t=this._isTouchingButtons[e];t!==void 0&&(t.next=!1)}})}static isMoveButton(e){return je.has(e)}update(){this._availableButtons.forEach(e=>{if(e===void 0)return;let t=this._isTouchingButtons[e];if(t!==void 0)switch(this._isTouchingButtons[e].prev=t.current,this._isTouchingButtons[e].current=t.next,this.getButtonState(e)){case`TOUCH`:this._onTouchStart?.(e);break;case`LEAVE`:this._onTouchEnd?.(e);break}})}toggleVisible(){this._setVisible(!this._visible)}};function Ne(){let e=document.getElementsByTagName(`head`)[0],t=document.createElement(`meta`);t.setAttribute(`name`,`viewport`),e.appendChild(t),Pe()}function Pe(){let e=document.querySelector(`meta[name='viewport']`),t=window.innerWidth,n=window.innerHeight,r=`user-scalable=no`;t>n?r=`width=${Math.floor(t/n*456)},${r}`:t<=n&&(r=`width=576,${r}`),e?.setAttribute(`content`,`${r}`)}function Fe(){return`
|
|
9
|
+
変更できません。`},BATTLE_REPORT_DISABLED:{code:601,defaultText:`ここでは戦闘予測を表示できません。`}}),h=Object.keys(m),g=h.reduce((e,t)=>({...e,[t]:t}),{}),_=m;function v(e){return h.some(t=>t===e)}function y(e){for(let t of h)if(_[t].code===e)return t}var b=class e{add(e){return this.strength+=e.strength,this.defence+=e.defence,this}plus(t){return new e(this.strength+t.strength,this.defence+t.defence)}minus(t){return new e(this.strength-t.strength,this.defence-t.defence)}equals(e){return this.strength===e.strength&&this.defence===e.defence}constructor(e,t){this.strength=e,this.defence=t}},x=class e extends b{add(t){return t instanceof e&&(this.energy+=t.energy,this.gold+=t.gold),this.strength+=t.strength,this.defence+=t.defence,this}plus(t){return t instanceof e?new e(this.energy+t.energy,this.strength+t.strength,this.defence+t.defence,this.gold+t.gold):new e(this.energy,this.strength+t.strength,this.defence+t.defence,this.gold)}minus(t){return t instanceof e?new e(this.energy-t.energy,this.strength-t.strength,this.defence-t.defence,this.gold-t.gold):new e(this.energy,this.strength-t.strength,this.defence-t.defence,this.gold)}equals(e){return this.energy===e.energy&&this.strength===e.strength&&this.defence===e.defence&&this.gold===e.gold}calculateScore(e){return Object.keys(e.rates).reduce((t,n)=>t+e.rates[n]*this[n],0)}clone(){return new e(this.energy,this.strength,this.defence,this.gold)}constructor(e,t,n,r){super(t,n),this.energy=e,this.gold=r}},S=class e{equals(e){return this.x===e.x&&this.y===e.y}substract(t){return new e(this.x-t.x,this.y-t.y)}clone(){return new e(this.x,this.y)}convertIntoPosition(e){return new C(e,this.x,this.y,0,0)}getDirectionTo(e){return this.x<e.x?this.y>e.y?9:this.y===e.y?6:3:this.x===e.x?this.y>e.y?8:this.y===e.y?5:2:this.y>e.y?7:this.y===e.y?4:1}toString(){return`(`+this.x+`, `+this.y+`)`}constructor(e=0,t=0){this.x=e,this.y=t}},C=class e{getPartsCoord(){return this._partsCoord}getOffsetCoord(){return this._offsetCoord}getScreenTopPosition(){var t=Math.floor(this._partsCoord.x/(R.H_PARTS_NUM_IN_WINDOW-1))*(R.H_PARTS_NUM_IN_WINDOW-1),n=Math.floor(this._partsCoord.y/(R.V_PARTS_NUM_IN_WINDOW-1))*(R.V_PARTS_NUM_IN_WINDOW-1);return new e(this._wwa,t,n,0,0)}getDefaultCameraPosition(){var e=this.getScreenTopPosition(),t=e.getPartsCoord(),n=this._wwa.getMapWidth(),r=e.getPartsCoord().clone();return t.x===n-1&&r.x--,t.y===n-1&&r.y--,r.convertIntoPosition(this._wwa).getScreenTopPosition()}getNextJustPosition(t){if(t!==void 0){var n=this._partsCoord;return new e(this._wwa,n.x+D[t],n.y+O[t],0,0)}var r=this._partsCoord.x,i=this._partsCoord.y;return this._offsetCoord.x<0?r--:this._offsetCoord.x>0&&r++,this._offsetCoord.y<0?i--:this._offsetCoord.y>0&&i++,new e(this._wwa,r,i,0,0)}getNextFramePosition(t,n,r){var i=this._partsCoord.x,a=this._partsCoord.y,o=this._offsetCoord.x+D[t]*n,s=this._offsetCoord.y+O[t]*r;if(o<0){var c=Math.floor(Math.abs(o)/R.CHIP_SIZE);i-=c,o=(o+c*R.CHIP_SIZE)%R.CHIP_SIZE}if(s<0){var l=Math.floor(Math.abs(s)/R.CHIP_SIZE);a-=l,s=(s+l*R.CHIP_SIZE)%R.CHIP_SIZE}return o>=R.CHIP_SIZE&&(i+=Math.floor(o/R.CHIP_SIZE),o=(o+R.CHIP_SIZE)%R.CHIP_SIZE),s>=R.CHIP_SIZE&&(a+=Math.floor(s/R.CHIP_SIZE),s=(s+R.CHIP_SIZE)%R.CHIP_SIZE),new e(this._wwa,i,a,o,s)}isJustPosition(){return this._offsetCoord.x==0&&this._offsetCoord.y==0}isScreenTopPosition(){var e=this.getScreenTopPosition();return this.equals(e)}equals(e){return this._partsCoord.equals(e.getPartsCoord())&&this._offsetCoord.equals(e.getOffsetCoord())}isInCameraRange(e,t=!1){var n=e.getPosition()._partsCoord,r=this._partsCoord.x,i=this._partsCoord.y,a=+!!t;return n.x<=r&&r<n.x+R.H_PARTS_NUM_IN_WINDOW-a&&n.y<=i&&i<n.y+R.V_PARTS_NUM_IN_WINDOW-a}hasLocalGate(){return this._wwa.getMapTypeByPosition(this)===R.MAP_LOCALGATE||this._wwa.getObjectTypeByPosition(this)===R.OBJECT_LOCALGATE}clone(){return new e(this._wwa,this._partsCoord.x,this._partsCoord.y,this._offsetCoord.x,this._offsetCoord.y)}constructor(e,t,n,r=0,i=0){if(this._wwa=e,this._wwa===void 0)throw Error(`WWAのインスタンスが存在しません. `);var a=this._wwa.getMapWidth();if(t<0||t>=a||t>=a-1&&r>0||n<0||n>=a||n>=a-1&&i>0)throw Error(`範囲外の座標です!! parts:(`+t+`, `+n+`), offset:(`+r+`, `+i+`), mapWidth = `+a);this._partsCoord=new S(t,n),this._offsetCoord=new S(r,i)}},w=class{constructor(e,t,n){this.destPos=e.clone(),this.srcPos=t.clone(),this.srcSize=n.clone()}},ee=class{constructor(e,t,n,r,i){this.partsIDObj=e,this.x=t,this.y=n,this.isStatic=r,this.isFighting=i}},T=function(e){return e[e.GOTO_WWA=0]=`GOTO_WWA`,e[e.BATTLE_REPORT=1]=`BATTLE_REPORT`,e[e.GAME_END=2]=`GAME_END`,e}({}),E=function(e){return e[e.UNUSED=0]=`UNUSED`,e[e.LEFT=4]=`LEFT`,e[e.RIGHT=6]=`RIGHT`,e[e.DOWN=2]=`DOWN`,e[e.UP=8]=`UP`,e[e.LEFT_DOWN=1]=`LEFT_DOWN`,e[e.LEFT_UP=7]=`LEFT_UP`,e[e.RIGHT_DOWN=3]=`RIGHT_DOWN`,e[e.RIGHT_UP=9]=`RIGHT_UP`,e[e.NO_DIRECTION=5]=`NO_DIRECTION`,e}({}),D=[0,-1,0,1,-1,0,1,-1,0,1],O=[0,1,1,1,0,0,0,-1,-1,-1],k=function(e){return e[e.YES=0]=`YES`,e[e.NO=1]=`NO`,e[e.UNSELECTED=2]=`UNSELECTED`,e}({}),A=function(e){return e[e.MAP=0]=`MAP`,e[e.OBJECT=1]=`OBJECT`,e[e.CHOICE_YES=2]=`CHOICE_YES`,e[e.CHOICE_NO=3]=`CHOICE_NO`,e}({}),te=function(e){return e[e.NORMAL=0]=`NORMAL`,e[e.CAN_USE=1]=`CAN_USE`,e[e.NOT_DISAPPEAR=2]=`NOT_DISAPPEAR`,e}({}),j=function(e){return e[e.MAP=1]=`MAP`,e[e.OBJECT=0]=`OBJECT`,e}({}),M=class{constructor(){var e=window.navigator.userAgent;this.os=this._getOS(e),this.browser=this.getBrowser(e),this.device=this.getDevice()}_getOS(e){return e.match(/xbox/i)?9:e.match(/windows/i)?1:e.match(/macintosh/i)?`ontouchstart`in document?5:2:e.match(/iphone|ipad|ipod/i)?5:e.match(/oculus/i)?8:e.match(/android/i)?4:e.match(/nintendo/i)?6:e.match(/playstation/i)?7:e.match(/linux/i)?3:9999}getBrowser(e){return e.match(/chrome/i)?1:e.match(/firefox/i)?2:e.match(/safari/i)?3:9999}getDevice(){switch(this.os){case 1:case 2:case 3:return 1;case 5:case 4:return 2;case 8:return 3;case 6:case 7:case 9:return 4}return 9999}},ne=function(e){return e[e.WINDOWS=1]=`WINDOWS`,e[e.MACINTOSH=2]=`MACINTOSH`,e[e.LINUX=3]=`LINUX`,e[e.ANDROID=4]=`ANDROID`,e[e.IOS=5]=`IOS`,e[e.NINTENDO=6]=`NINTENDO`,e[e.PLAY_STATION=7]=`PLAY_STATION`,e[e.OCULUS=8]=`OCULUS`,e[e.XBOX=9]=`XBOX`,e[e.OTHERS=9999]=`OTHERS`,e}({}),re=function(e){return e[e.PC=1]=`PC`,e[e.SP=2]=`SP`,e[e.VR=3]=`VR`,e[e.GAME=4]=`GAME`,e[e.OTHERS=9999]=`OTHERS`,e}({}),ie=function(e){return e[e.CHROME=1]=`CHROME`,e[e.FIREFOX=2]=`FIREFOX`,e[e.SAFARI=3]=`SAFARI`,e[e.OTHERS=9999]=`OTHERS`,e}({}),N=function(e){return e[e.NONE=0]=`NONE`,e[e.CALL_BY_MAP_PARTS=1]=`CALL_BY_MAP_PARTS`,e[e.CALL_BY_OBJECT_PARTS=2]=`CALL_BY_OBJECT_PARTS`,e[e.CALL_BY_ITEM_USE=3]=`CALL_BY_ITEM_USE`,e[e.CALL_BY_QUICK_SAVE=4]=`CALL_BY_QUICK_SAVE`,e[e.CALL_BY_QUICK_LOAD=5]=`CALL_BY_QUICK_LOAD`,e[e.CALL_BY_RESTART_GAME=6]=`CALL_BY_RESTART_GAME`,e[e.CALL_BY_GOTO_WWA=7]=`CALL_BY_GOTO_WWA`,e[e.CALL_BY_PASSWORD_SAVE=8]=`CALL_BY_PASSWORD_SAVE`,e[e.CALL_BY_PASSWORD_LOAD=9]=`CALL_BY_PASSWORD_LOAD`,e[e.CALL_BY_END_GAME=10]=`CALL_BY_END_GAME`,e[e.CALL_BY_SUSPEND=11]=`CALL_BY_SUSPEND`,e[e.CALL_BY_LOG_QUICK_SAVE=12]=`CALL_BY_LOG_QUICK_SAVE`,e[e.CALL_BY_LOG_QUICK_LOAD=13]=`CALL_BY_LOG_QUICK_LOAD`,e}({}),P=function(e){return e[e.QUICK_LOAD=0]=`QUICK_LOAD`,e[e.QUICK_SAVE=1]=`QUICK_SAVE`,e[e.RESTART_GAME=2]=`RESTART_GAME`,e[e.GOTO_WWA=3]=`GOTO_WWA`,e}({}),ae=function(e){return e[e.UP=0]=`UP`,e[e.DOWN=1]=`DOWN`,e}({}),oe=function(e){return e[e.QUICK_LOAD=0]=`QUICK_LOAD`,e[e.RESTART_GAME=1]=`RESTART_GAME`,e[e.PASSWORD=2]=`PASSWORD`,e}({}),se=function(e){return e[e.STATIC=0]=`STATIC`,e[e.CHASE_PLAYER=1]=`CHASE_PLAYER`,e[e.RUN_OUT=2]=`RUN_OUT`,e[e.HANG_AROUND=3]=`HANG_AROUND`,e}({}),ce=function(e){return e[e.MODE_X=0]=`MODE_X`,e[e.MODE_Y=1]=`MODE_Y`,e[e.UNDECIDED=2]=`UNDECIDED`,e}({}),F=[`cell-load`,`cell-save`,`cell-restart`,`cell-gotowwa`],I=function(e){return e[e.UNDEFINED=0]=`UNDEFINED`,e[e.IMGPLAYER=1]=`IMGPLAYER`,e[e.IMGYESNO=2]=`IMGYESNO`,e[e.HPMAX=3]=`HPMAX`,e[e.SAVE=4]=`SAVE`,e[e.ITEM=5]=`ITEM`,e[e.DEFAULT=6]=`DEFAULT`,e[e.OLDMAP=7]=`OLDMAP`,e[e.PARTS=8]=`PARTS`,e[e.MOVE=9]=`MOVE`,e[e.MAP=10]=`MAP`,e[e.DIRMAP=11]=`DIRMAP`,e[e.IMGFRAME=12]=`IMGFRAME`,e[e.IMGBOM=13]=`IMGBOM`,e[e.DELPLAYER=14]=`DELPLAYER`,e[e.FACE=15]=`FACE`,e[e.EFFECT=16]=`EFFECT`,e[e.GAMEOVER=17]=`GAMEOVER`,e[e.IMGCLICK=18]=`IMGCLICK`,e[e.STATUS=19]=`STATUS`,e[e.EFFITEM=20]=`EFFITEM`,e[e.COLOR=21]=`COLOR`,e[e.WAIT=22]=`WAIT`,e[e.SOUND=23]=`SOUND`,e[e.JUMPGATE=24]=`JUMPGATE`,e[e.RECPOSITION=25]=`RECPOSITION`,e[e.JUMPRECPOSITION=26]=`JUMPRECPOSITION`,e[e.CONSOLE_LOG=27]=`CONSOLE_LOG`,e[e.COPY_HP_TO=28]=`COPY_HP_TO`,e[e.SET_HP=29]=`SET_HP`,e[e.COPY_HPMAX_TO=30]=`COPY_HPMAX_TO`,e[e.SET_HPMAX=31]=`SET_HPMAX`,e[e.COPY_AT_TO=32]=`COPY_AT_TO`,e[e.SET_AT=33]=`SET_AT`,e[e.COPY_DF_TO=34]=`COPY_DF_TO`,e[e.SET_DF=35]=`SET_DF`,e[e.COPY_MONEY_TO=36]=`COPY_MONEY_TO`,e[e.SET_MONEY=37]=`SET_MONEY`,e[e.COPY_STEP_COUNT_TO=38]=`COPY_STEP_COUNT_TO`,e[e.VAR_SET_VAL=39]=`VAR_SET_VAL`,e[e.VAR_SET=40]=`VAR_SET`,e[e.VAR_ADD=41]=`VAR_ADD`,e[e.VAR_SUB=42]=`VAR_SUB`,e[e.VAR_MUL=43]=`VAR_MUL`,e[e.VAR_DIV=44]=`VAR_DIV`,e[e.VAR_SET_RAND=45]=`VAR_SET_RAND`,e[e.SHOW_STR=46]=`SHOW_STR`,e[e.GAME_SPEED=47]=`GAME_SPEED`,e[e.IF=50]=`IF`,e[e.SET_SPEED=51]=`SET_SPEED`,e[e.COPY_TIME_TO=52]=`COPY_TIME_TO`,e[e.HIDE_STATUS=53]=`HIDE_STATUS`,e[e.VAR_MAP=54]=`VAR_MAP`,e[e.VAR_MOD=55]=`VAR_MOD`,e[e.NO_GAMEOVER=56]=`NO_GAMEOVER`,e[e.ELSE_IF=57]=`ELSE_IF`,e[e.ELSE=58]=`ELSE`,e[e.END_IF=59]=`END_IF`,e[e.SET=60]=`SET`,e[e.MAP2=61]=`MAP2`,e[e.SHOW_STR2=62]=`SHOW_STR2`,e[e.CONSOLE_LOG2=63]=`CONSOLE_LOG2`,e[e.DELAYBGM=64]=`DELAYBGM`,e[e.SYSMSG=65]=`SYSMSG`,e[e.PICTURE=66]=`PICTURE`,e[e.DISABLE_BATTLE_REPORT=67]=`DISABLE_BATTLE_REPORT`,e[e.GAMEPAD_BUTTON=100]=`GAMEPAD_BUTTON`,e[e.OLDMOVE=101]=`OLDMOVE`,e[e.LEGACY_IF=10050]=`LEGACY_IF`,e}({}),le={"":0,$imgplayer:1,$imgyesno:2,$hpmax:3,$save:4,$item:5,$default:6,$oldmap:7,$parts:8,$move:9,$map:10,$dirmap:11,$imgframe:12,$imgbom:13,$delplayer:14,$face:15,$effect:16,$gameover:17,$imgclick:18,$status:19,$effitem:20,$color:21,$wait:22,$sound:23,$jumpgate:24,$rec_pos:25,$jump_rec_pos:26,$console_log:27,$copy_hp_to:28,$set_hp:29,$copy_hpmax_to:30,$set_hpmax:31,$copy_at_to:32,$set_at:33,$copy_df_to:34,$set_df:35,$copy_money_to:36,$set_money:37,$copy_step_count_to:38,$var_set_val:39,$var_set:40,$var_add:41,$var_sub:42,$var_mul:43,$var_div:44,$var_set_rand:45,$show_str:46,$game_speed:47,$if:50,$set_speed:51,$copy_time_to:52,$hide_status:53,$var_map:54,$var_mod:55,$no_gameover:56,$else_if:57,$else:58,$endif:59,$set:60,$map2:61,$show_str2:62,$console_log2:63,$delaybgm:64,$sysmsg:65,$picture:66,$disable_battle_report:67,$gamepad_button:100,$oldmove:101},ue=function(e){return e[e.ENERGY=0]=`ENERGY`,e[e.STRENGTH=1]=`STRENGTH`,e[e.DEFENCE=2]=`DEFENCE`,e[e.GOLD=3]=`GOLD`,e[e.MOVES=4]=`MOVES`,e}({}),L=function(e){return e[e.ENERGY=0]=`ENERGY`,e[e.STRENGTH=1]=`STRENGTH`,e[e.DEFENCE=2]=`DEFENCE`,e[e.GOLD=3]=`GOLD`,e[e.WIDE_CELL_ROW=4]=`WIDE_CELL_ROW`,e[e.ITEM_BG=5]=`ITEM_BG`,e[e.MAIN_FRAME=6]=`MAIN_FRAME`,e}({}),de=[1,2,5,8,10,20],fe=[`超低速`,`低速`,`準低速`,`中速`,`高速`,`超高速`],pe=[`energy`,`strength`,`defence`,`gold`],R=class e{static{this.WWA_HOME=`http://wwajp.com`}static{this.TARGET_FPS=60}static{this.INTERVAL_MS=1e3/e.TARGET_FPS}static{this.ITEMBOX_SIZE=12}static{this.MAP_ATR_MAX=60}static{this.OBJ_ATR_MAX=60}static{this.OLD_MAP_ATR_MAX=40}static{this.OLD_OBJ_ATR_MAX=40}static{this.ATR_TYPE=3}static{this.ATR_MODE=4}static{this.ATR_STRING=5}static{this.ATR_X=6}static{this.ATR_Y=7}static{this.ATR_X2=8}static{this.ATR_Y2=9}static{this.ATR_ENERGY=10}static{this.ATR_STRENGTH=11}static{this.ATR_DEFENCE=12}static{this.ATR_GOLD=13}static{this.ATR_ITEM=14}static{this.ATR_NUMBER=15}static{this.ATR_JUMP_X=16}static{this.ATR_MOVE=16}static{this.ATR_JUMP_Y=17}static{this.ATR_SOUND=19}static{this.ATR_APPERANCE_BASE=20}static{this.REL_ATR_APPERANCE_ID=0}static{this.REL_ATR_APPERANCE_X=1}static{this.REL_ATR_APPERANCE_Y=2}static{this.REL_ATR_APPERANCE_TYPE=3}static{this.REL_ATR_APPERANCE_UNIT_LENGTH=4}static{this.ATR_RANDOM_BASE=10}static{this.RANDOM_ATR_NUM=10}static{this.RANDOM_ITERATION_MAX=10}static{this.MAP_STREET=0}static{this.MAP_WALL=1}static{this.MAP_LOCALGATE=2}static{this.MAP_URLGATE=4}static{this.OBJECT_NORMAL=0}static{this.OBJECT_MESSAGE=1}static{this.OBJECT_URLGATE=2}static{this.OBJECT_STATUS=3}static{this.OBJECT_ITEM=4}static{this.OBJECT_DOOR=5}static{this.OBJECT_MONSTER=6}static{this.OBJECT_SCORE=11}static{this.OBJECT_SELL=14}static{this.OBJECT_BUY=15}static{this.OBJECT_RANDOM=16}static{this.OBJECT_SELECT=17}static{this.OBJECT_LOCALGATE=18}static{this.SYSTEM_MESSAGE_NUM=20}static{this.IMGPOS_DEFAULT_YESNO_X=3}static{this.IMGPOS_DEFAULT_YESNO_Y=1}static{this.IMGRELPOS_YESNO_YES_X=0}static{this.IMGRELPOS_YESNO_NO_X=1}static{this.IMGRELPOS_YESNO_YESP_X=2}static{this.IMGRELPOS_YESNO_NOP_X=3}static{this.IMGPOS_DEFAULT_CLICKABLE_ITEM_SIGN_X=0}static{this.IMGPOS_DEFAULT_CLICKABLE_ITEM_SIGN_Y=0}static{this.IMGPOS_DEFAULT_FRAME_X=0}static{this.IMGPOS_DEFAULT_FRAME_Y=1}static{this.IMGPOS_DEFAULT_BATTLE_EFFECT_X=3}static{this.IMGPOS_DEFAULT_BATTLE_EFFECT_Y=3}static{this.DEFAULT_DISABLE_SAVE=!1}static{this.DEFAULT_OLDMAP=!1}static{this.DEFAULT_OBJECT_NO_COLLAPSE=!1}static{this.SPLASH_SCREEN_DISP_MILLS=100}static{this.DEFAULT_FRAME_INTERVAL=20}static{this.GAMEOVER_FRAME_INTERVAL=50}static{this.YESNO_PRESS_DISP_FRAME_NUM=20}static{this.WAIT_TIME_FRAME_NUM=6}static{this.CHIP_SIZE=40}static{this.MAP_WINDOW_WIDTH=440}static{this.MAP_WINDOW_HEIGHT=440}static{this.H_PARTS_NUM_IN_WINDOW=e.MAP_WINDOW_WIDTH/e.CHIP_SIZE}static{this.V_PARTS_NUM_IN_WINDOW=e.MAP_WINDOW_HEIGHT/e.CHIP_SIZE}static{this.MIN_SPEED_INDEX=0}static{this.MAX_SPEED_INDEX=de.length-1}static{this.QUICK_BATTLE_SPEED_INDECIES=[de.length-2,de.length-1]}static{this.ANIMATION_REP_HALF_FRAME=32}static{this.PLAYER_LOOKING_AROUND_START_FRAME=80}static{this.PLAYER_LOOKING_AROUND_LOOP_INTERVAL_FRAME=80}static{this.RELATIVE_COORD_BIAS=1e4}static{this.RELATIVE_COORD_LOWER=e.RELATIVE_COORD_BIAS-1e3}static{this.PLAYER_COORD=e.RELATIVE_COORD_BIAS-1e3}static{this.LOCALGATE_PLAYER_WAIT_FRAME=5}static{this.STATUS_CHANGED_EFFECT_FRAME_NUM=20}static{this.PASSABLE_OBJECT=1}static{this.APPERANCE_PARTS_MIN_INDEX=0}static{this.APPERANCE_PARTS_MAX_INDEX=9}static{this.APPERANCE_PARTS_MIN_INDEX_NO=5}static{this.APPERANCE_PARTS_MAX_INDEX_YES=4}static{this.FADEOUT_SPEED=8}static{this.STATUS_MINUS_BORDER=3e4}static{this.ITEMBOX_IS_FULL=-1}static{this.BATTLE_INTERVAL_FRAME_NUM=10}static{this.BATTLE_SPEED_CHANGE_TURN_NUM=40}static{this.RANDOM_MOVE_ITERATION_NUM=50}static{this.RANDOM_MOVE_ITERATION_NUM_BEFORE_V31=8}static{this.BATTLE_ESTIMATE_MONSTER_TYPE_MAX=8}static{this.SOUND_MAX=100}static{this.ITEM_BORDER_IMG_DATA_URL=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAArklEQVRYR+2Y0QqAIAxFt///aENJHwxxuJUSxzeh3S7HXaNpEkly4FIRzba0GEyHeVTN7jqDWvb7V4Y1NLibZIY0NbiL5G3MZLCe / 1fn3XJgJYjB7mgg6O1VCEKwXo79JeklY62nB62kRs9BEIKkeNIDhISQEBJC4k0BBCF4D7D4cV9shf99ixdB + MrM0y3fa3zV05D45GOqhwPMGPkYlccIOEY2VKUN0UNVXxC7ADj7mDi9aFZZAAAAAElFTkSuQmCC`}static{this.LOAD_STAGE_MAX_EXCEPT_AUDIO=7}static{this.WWA_STYLE_TAG_ID=`wwa-additional-style`}static{this.DEFAULT_FRAME_COLOR_R=255}static{this.DEFAULT_FRAME_COLOR_G=255}static{this.DEFAULT_FRAME_COLOR_B=255}static{this.DEFAULT_FRAMEOUT_COLOR_R=96}static{this.DEFAULT_FRAMEOUT_COLOR_G=96}static{this.DEFAULT_FRAMEOUT_COLOR_B=96}static{this.DEFAULT_STRBACK_COLOR_R=0}static{this.DEFAULT_STRBACK_COLOR_G=0}static{this.DEFAULT_STRBACK_COLOR_B=0}static{this.DEFAULT_STATUS_COLOR_R=0}static{this.DEFAULT_STATUS_COLOR_G=0}static{this.DEFAULT_STATUS_COLOR_B=0}static{this.KEYPRESS_MESSAGE_CHANGE_FRAME_NUM=20}static{this.WWAP_SERVER_OLD=`http://wwawing.com/wwap`}static{this.WWAP_SERVER=`https://wwaphoenix.github.io`}static{this.WWAP_SERVER_AUDIO_DIR=`audio`}static{this.WWAP_SERVER_TITLE_IMG=`cover_p.gif`}static{this.WWAP_SERVER_LOADER_NO_WORKER=`wwaload.noworker.js`}static{this.SCREEN_WIDTH=560}static{this.SCREEN_HEIGHT=440}static{this.LOADING_FONT=`Times New Roman`}static{this.MSG_STR_WIDTH=16}static{this.ITEM_EFFECT_SPEED_PIXEL_PER_FRAME=20}static{this.ITEMBOX_TOP_Y=140}static{this.USER_VAR_NUM=256}static{this.USER_VAR_NUM_MAX_VALUE=9007199254740991}static{this.USET_VAR_NUM_MIN_VALUE=-9007199254740991}static{this.CONTROLL_WAIT_FRAME=6}static{this.INLINE_USER_VAR_VIEWER_DISPLAY_NUM=10}static{this.FIGHT_DRAW_TURN=40}},me=class{static{this.QUICK_SAVE_MAX=4}static{this.QUICK_SAVE_THUMNAIL_WIDTH=99}static{this.QUICK_SAVE_THUMNAIL_HEIGHT=99}static{this.SAVE_INTERVAL_MOVE=200}static{this.INDEXEDDB_DB_NAME=`WWA_WING_DB`}static{this.INDEXEDDB_TABLE_NAME=`SAVE_TABLE`}static{this.DATE_LAST_SAVE_TEXT_COLOR=`rgba(255,255,0,1)`}},he=class{static{this.EMPTY_LOAD=``}static{this.EMPTY_SAVE=``}static{this.PASSWORD=`Password`}static{this.QUICK_SAVE=`Quick Save`}static{this.QUICK_LOAD=`Quick Load`}static{this.BATTLE_REPORT=`Battle Report`}static{this.GAME_END=`Game End`}static{this.GOTO_WWA=`Goto WWA`}static{this.RESTART_GAME=`Restart Game`}},ge=class{},_e=function(e){return e[e.INIT=0]=`INIT`,e[e.MAP_LOAD=1]=`MAP_LOAD`,e[e.OBJ_LOAD=2]=`OBJ_LOAD`,e[e.MAP_ATTR=3]=`MAP_ATTR`,e[e.OBJ_ATTR=4]=`OBJ_ATTR`,e[e.RAND_PARTS=5]=`RAND_PARTS`,e[e.MESSAGE=6]=`MESSAGE`,e[e.GAME_INIT=7]=`GAME_INIT`,e[e.AUDIO=8]=`AUDIO`,e[e.FINISH=9]=`FINISH`,e}({}),ve=[`ロードの準備をしています。`,`背景パーツを読み込んでいます。`,`物体パーツを読み込んでます。`,`背景パーツの属性を読み込んでます。`,`物体パーツの属性を読み込んでます。`,`ランダムパーツを置換しています。`,`メッセージを読み込んでます。`,`Welcome to WWA Wing!`],ye=[`Welcome to WWA Wing!`,`Now Map Data Loading .....`,`Now CG Data Loading .....`,`Now Making chara CG .....`],z=function(e){return e[e.LINE=30]=`LINE`,e[e.TITLE_X=100]=`TITLE_X`,e[e.TITLE_Y=70]=`TITLE_Y`,e[e.LOADING_X=50]=`LOADING_X`,e[e.LOADING_Y=140]=`LOADING_Y`,e[e.ERROR_X=10]=`ERROR_X`,e[e.ERROR_Y=180]=`ERROR_Y`,e[e.FOOTER_X=160]=`FOOTER_X`,e[e.FOOTER_Y=360]=`FOOTER_Y`,e[e.WORLD_Y=330]=`WORLD_Y`,e[e.COPYRIGHT_Y=390]=`COPYRIGHT_Y`,e}({}),be=function(e){return e[e.TITLE=32]=`TITLE`,e[e.LOADING=22]=`LOADING`,e[e.FOOTER=18]=`FOOTER`,e[e.ERRROR=16]=`ERRROR`,e}({}),xe=function(e){return e[e.COLOR_FRAME=0]=`COLOR_FRAME`,e[e.COLOR_FRAMEOUT=1]=`COLOR_FRAMEOUT`,e[e.COLOR_STR=2]=`COLOR_STR`,e[e.COLOR_STATUS_STR=4]=`COLOR_STATUS_STR`,e}({}),Se=function(e){return e[e.MESSAGE_WINDOW=0]=`MESSAGE_WINDOW`,e[e.SIDEBAR=1]=`SIDEBAR`,e}({}),Ce=function(e){return e[e.BITSHIFT=16]=`BITSHIFT`,e[e.BITMASK=65535]=`BITMASK`,e}({}),B=function(e){return e[e.NONE=0]=`NONE`,e[e.KEYDOWN=1]=`KEYDOWN`,e[e.KEYPRESS=2]=`KEYPRESS`,e[e.KEYUP=3]=`KEYUP`,e[e.KEYPRESS_MESSAGECHANGE=4]=`KEYPRESS_MESSAGECHANGE`,e}({}),V=function(e){return e[e.KEY_ENTER=13]=`KEY_ENTER`,e[e.KEY_SHIFT=16]=`KEY_SHIFT`,e[e.KEY_ESC=27]=`KEY_ESC`,e[e.KEY_SPACE=32]=`KEY_SPACE`,e[e.KEY_LEFT=37]=`KEY_LEFT`,e[e.KEY_UP=38]=`KEY_UP`,e[e.KEY_RIGHT=39]=`KEY_RIGHT`,e[e.KEY_DOWN=40]=`KEY_DOWN`,e[e.KEY_0=48]=`KEY_0`,e[e.KEY_1=49]=`KEY_1`,e[e.KEY_2=50]=`KEY_2`,e[e.KEY_3=51]=`KEY_3`,e[e.KEY_4=52]=`KEY_4`,e[e.KEY_5=53]=`KEY_5`,e[e.KEY_6=54]=`KEY_6`,e[e.KEY_7=55]=`KEY_7`,e[e.KEY_8=56]=`KEY_8`,e[e.KEY_9=57]=`KEY_9`,e[e.KEY_A=65]=`KEY_A`,e[e.KEY_B=66]=`KEY_B`,e[e.KEY_C=67]=`KEY_C`,e[e.KEY_D=68]=`KEY_D`,e[e.KEY_E=69]=`KEY_E`,e[e.KEY_F=70]=`KEY_F`,e[e.KEY_G=71]=`KEY_G`,e[e.KEY_H=72]=`KEY_H`,e[e.KEY_I=73]=`KEY_I`,e[e.KEY_J=74]=`KEY_J`,e[e.KEY_K=75]=`KEY_K`,e[e.KEY_L=76]=`KEY_L`,e[e.KEY_M=77]=`KEY_M`,e[e.KEY_N=78]=`KEY_N`,e[e.KEY_O=79]=`KEY_O`,e[e.KEY_P=80]=`KEY_P`,e[e.KEY_Q=81]=`KEY_Q`,e[e.KEY_R=82]=`KEY_R`,e[e.KEY_S=83]=`KEY_S`,e[e.KEY_T=84]=`KEY_T`,e[e.KEY_U=85]=`KEY_U`,e[e.KEY_V=86]=`KEY_V`,e[e.KEY_W=87]=`KEY_W`,e[e.KEY_X=88]=`KEY_X`,e[e.KEY_Y=89]=`KEY_Y`,e[e.KEY_Z=90]=`KEY_Z`,e[e.KEY_NUM0=96]=`KEY_NUM0`,e[e.KEY_NUM1=97]=`KEY_NUM1`,e[e.KEY_NUM2=98]=`KEY_NUM2`,e[e.KEY_NUM3=99]=`KEY_NUM3`,e[e.KEY_NUM4=100]=`KEY_NUM4`,e[e.KEY_NUM5=101]=`KEY_NUM5`,e[e.KEY_NUM6=102]=`KEY_NUM6`,e[e.KEY_NUM7=103]=`KEY_NUM7`,e[e.KEY_NUM8=104]=`KEY_NUM8`,e[e.KEY_NUM9=105]=`KEY_NUM9`,e[e.KEY_F1=112]=`KEY_F1`,e[e.KEY_F2=113]=`KEY_F2`,e[e.KEY_F3=114]=`KEY_F3`,e[e.KEY_F4=115]=`KEY_F4`,e[e.KEY_F5=116]=`KEY_F5`,e[e.KEY_F6=117]=`KEY_F6`,e[e.KEY_F7=118]=`KEY_F7`,e[e.KEY_F8=119]=`KEY_F8`,e[e.KEY_F9=120]=`KEY_F9`,e[e.KEY_F10=121]=`KEY_F10`,e[e.KEY_F12=123]=`KEY_F12`,e}({}),we=class e{static{this.KEY_BUFFER_MAX=256}checkHitKey(e){var t=this.getKeyState(e);return t===1||t===2}getKeyState(e){return this._prevKeyState[e]?this._keyState[e]?2:3:+!!this._keyState[e]}getKeyStateForControllPlayer(e){return this._prevKeyStateOnControllable[e]?this._keyState[e]?2:3:+!!this._keyState[e]}getKeyStateForMessageCheck(e){return this._prevKeyState[e]?this._keyState[e]?this._keyInputContinueFrameNum[e]>=R.KEYPRESS_MESSAGE_CHANGE_FRAME_NUM?4:2:3:+!!this._keyState[e]}setPressInfo(e){this._nextKeyState[e]=!0,this._keyInputContinueFrameNum[e]=-1}setReleaseInfo(e){this._nextKeyState[e]=!1,this._keyInputContinueFrameNum[e]=-1}update(){var t;for(this._prevKeyState=this._keyState.slice(),this._keyState=this._nextKeyState.slice(),t=0;t<e.KEY_BUFFER_MAX;t++)this._keyState[t]&&this._keyInputContinueFrameNum[t]++}memorizeKeyStateOnControllableFrame(){this._prevKeyStateOnControllable=this._keyState.slice()}allClear(){var t;for(this._nextKeyState=Array(e.KEY_BUFFER_MAX),t=0;t<e.KEY_BUFFER_MAX;t++)this._nextKeyState[t]=!1}constructor(){var t;for(this._nextKeyState=Array(e.KEY_BUFFER_MAX),this._keyState=Array(e.KEY_BUFFER_MAX),this._prevKeyState=Array(e.KEY_BUFFER_MAX),this._prevKeyStateOnControllable=Array(e.KEY_BUFFER_MAX),this._keyInputContinueFrameNum=Array(e.KEY_BUFFER_MAX),t=0;t<e.KEY_BUFFER_MAX;t++)this._nextKeyState[t]=!1,this._keyState[t]=!1,this._prevKeyState[t]=!1,this._prevKeyStateOnControllable[t]=!1,this._keyInputContinueFrameNum[t]=0}},Te=function(e){return e[e.NONE=0]=`NONE`,e[e.MOUSEDOWN=1]=`MOUSEDOWN`,e[e.MOUSEPRESS=2]=`MOUSEPRESS`,e[e.MOUSEUP=3]=`MOUSEUP`,e}({}),Ee=class{checkClickMouse(e){var t=e===void 0?this.getMouseState():this.getMouseState(e);return t===1||t===2}getMouseState(e){return e!==void 0&&this._inputDir!==e?0:this._prevMouseState?this._mouseState?2:3:+!!this._mouseState}getMouseStateForControllPlayer(e){return e!==void 0&&this._inputDir!==e?0:this._prevMouseStateOnControllable?this._mouseState?2:3:+!!this._mouseState}setPressInfo(e,t){this._nextMouseState=!0,this._inputDir=e,this._touchID=t}setReleaseInfo(){this._touchID=0,this._nextMouseState=!1}touchIDIsSetDir(){return this._touchID===1}memorizeMouseStateOnControllableFrame(){this._prevMouseStateOnControllable=this._mouseState}update(){this._prevMouseState=this._mouseState,this._mouseState=this._nextMouseState}clear(){this._nextMouseState=!1}getTouchID(){return this._touchID}constructor(){this._prevMouseState=!1,this._mouseState=!1,this._nextMouseState=!1}},H=function(e){return e[e.BUTTON_INDEX_B=0]=`BUTTON_INDEX_B`,e[e.BUTTON_INDEX_A=1]=`BUTTON_INDEX_A`,e[e.BUTTON_INDEX_Y=2]=`BUTTON_INDEX_Y`,e[e.BUTTON_INDEX_X=3]=`BUTTON_INDEX_X`,e[e.BUTTON_INDEX_L=4]=`BUTTON_INDEX_L`,e[e.BUTTON_INDEX_R=5]=`BUTTON_INDEX_R`,e[e.BUTTON_INDEX_ZL=6]=`BUTTON_INDEX_ZL`,e[e.BUTTON_INDEX_ZR=7]=`BUTTON_INDEX_ZR`,e[e.BUTTON_INDEX_MINUS=8]=`BUTTON_INDEX_MINUS`,e[e.BUTTON_INDEX_PLUS=9]=`BUTTON_INDEX_PLUS`,e[e.BUTTON_INDEX_LEFT_STICK=10]=`BUTTON_INDEX_LEFT_STICK`,e[e.BUTTON_INDEX_RIGHT_STICK=11]=`BUTTON_INDEX_RIGHT_STICK`,e[e.BUTTON_CROSS_KEY_UP=12]=`BUTTON_CROSS_KEY_UP`,e[e.BUTTON_CROSS_KEY_DOWN=13]=`BUTTON_CROSS_KEY_DOWN`,e[e.BUTTON_CROSS_KEY_LEFT=14]=`BUTTON_CROSS_KEY_LEFT`,e[e.BUTTON_CROSS_KEY_RIGHT=15]=`BUTTON_CROSS_KEY_RIGHT`,e}({}),De=class{constructor(){this.gamepad=null,this.triggers=[];var e;for(e=0;e<16;e++)this.triggers[e]=!1}update(){this.gamepad=null;var e=navigator.getGamepads?navigator.getGamepads():navigator.webkitGetGamepads?navigator.webkitGetGamepads:[];if(e&&e.length>0&&e[0]){var t=e[0];this.gamepad=t}}buttonTrigger(...e){if(!this.gamepad)return!1;var t,n=e.length,r,i,a;for(t=0;t<n;t++){r=e[t];var o=this.gamepad.buttons[r];if(!o)return!1;if(i=typeof o==`object`?o.pressed===!0:o===1,a=this.triggers[r],this.triggers[r]=i,i&&!a)return!0}return!1}buttonPressed(...e){if(!this.gamepad)return!1;var t,n=e.length,r,i;for(t=0;t<n;t++){r=e[t];var a=this.gamepad.buttons[r];if(!a)return!1;if(i=typeof a==`object`?a.pressed===!0:a===1,i)return!0}return!1}crossPressed(...e){if(!this.gamepad)return!1;var t,n=e.length,r;for(t=0;t<n;t++)switch(r=e[t],r){case 12:if(this.gamepad.axes[1]<=-.6||this.gamepad.axes[3]<=-.6||this.stickFloor(9)===-1||this.buttonPressed(12))return!0;break;case 13:if(this.gamepad.axes[1]>=.7||this.gamepad.axes[3]>=.7||this.stickFloor(9)===.1||this.buttonPressed(13))return!0;break;case 14:if(this.gamepad.axes[0]<=-.7||this.gamepad.axes[2]<=-.7||this.stickFloor(9)===.7||this.buttonPressed(14))return!0;break;case 15:if(this.gamepad.axes[0]>.6||this.gamepad.axes[2]>.6||this.stickFloor(9)===-.5||this.buttonPressed(15))return!0;break}return!1}vibration(e){if(!this.gamepad||!this.gamepad.vibrationActuator)return!1;e?this.gamepad.vibrationActuator.playEffect(`dual-rumble`,{startDelay:0,duration:100,weakMagnitude:1,strongMagnitude:.5}):this.gamepad.vibrationActuator.playEffect(`dual-rumble`,{startDelay:0,duration:100,weakMagnitude:.5,strongMagnitude:1})}stickFloor(...e){if(!this.gamepad)return 0;var t,n=e.length,r;for(t=0;t<n;t++){r=e[t];var i=this.gamepad.axes[r];return typeof i==`number`?Math.floor(i*10)/10:0}return 0}},Oe=class e{constructor(e=0){this.lastCalculatedTimeUnixMs=Date.now(),this.lastCalculatedPlayTimeMs=e}calculateTimeMs(){let e=Date.now(),t=e-this.lastCalculatedTimeUnixMs+this.lastCalculatedPlayTimeMs;return this.lastCalculatedTimeUnixMs=e,this.lastCalculatedPlayTimeMs=t,t}calculatePlayTimeFormat(){return e.formatPlayTimeText(this.calculateTimeMs()/1e3)}static formatPlayTimeText(e){let t=Math.floor(e);return t>=3600*1e4?`9999:99:99`:(`000`+(t/60/60|0)).slice(-4)+`:`+(`0`+(t/60|0)%60).slice(-2)+`:`+(`0`+t%60).slice(-2)}},ke=[`BUTTON_ENTER`,`BUTTON_ESC`,`BUTTON_SIDEBAR`,`BUTTON_FAST`,`BUTTON_SLOW`,`BUTTON_LEFT`,`BUTTON_UP`,`BUTTON_RIGHT`,`BUTTON_DOWN`],Ae=[`BUTTON_LEFT`,`BUTTON_UP`,`BUTTON_RIGHT`,`BUTTON_DOWN`],je=new Set(Ae),Me=class e{constructor(t,n=!1,r=null,i=null,a=null,o=null){if(this._enabled=t!==null,this._visible=n,this._onTouchStart=a||null,this._onTouchEnd=o||null,this._availableButtons=[],this._isTouchingButtons={},this._moveButtonsElement=i,this._buttonWrapperElement=r,this._setVisible(n),this._moveButtonsElement&&(this._moveButtonsElement.style.visibility=`visible`),this._buttonWrapperElement&&(this._buttonWrapperElement.style.visibility=`visible`),t!==null){for(let n in t){let r=t[n];if(!r)continue;let i=n;this._availableButtons.push(i),r.setAttribute(`type`,n),this._isTouchingButtons[i]={prev:!1,current:!1,next:!1};let a=e=>{e.cancelable&&e.preventDefault()};r.addEventListener(`touchstart`,e=>{a(e),this.setTouchInfo(i)}),r.addEventListener(`touchcancel`,e=>{a(e),this.allClear()}),e.isMoveButton(i)?(r.addEventListener(`touchmove`,this._detectMovingMoveButton.bind(this)),r.addEventListener(`touchend`,this.allMoveClear.bind(this))):r.addEventListener(`touchend`,e=>{a(e),this.clearTouchInfo(i)})}i!==null&&i.addEventListener(`touchmove`,this._detectMovingMoveButton.bind(this))}}_detectMovingMoveButton(e){e.preventDefault(),this.allMoveClear();let t=e.targetTouches.item(0);if(!this._moveButtonsElement||t===null)return;let n=this._moveButtonsElement.getBoundingClientRect(),r=document.body.getBoundingClientRect(),i=n.left-r.left+n.width/2,a=n.top-r.top+n.height/2,o=t.pageX-i,s=t.pageY-a;o>=s?o<=-s?this.setTouchInfo(`BUTTON_UP`):this.setTouchInfo(`BUTTON_RIGHT`):o>=-s?this.setTouchInfo(`BUTTON_DOWN`):this.setTouchInfo(`BUTTON_LEFT`)}_setVisible(e){this._moveButtonsElement!==null&&(this._moveButtonsElement.style.display=e?`grid`:`none`),this._buttonWrapperElement!==null&&(this._buttonWrapperElement.style.display=e?`grid`:`none`),this._visible=e}checkTouchButton(e){return this._enabled?this.getButtonState(e)===`TOUCH`:!1}checkTouchingButton(e){if(!this._enabled)return!1;let t=this.getButtonState(e);return t===`TOUCH`||t===`TOUCHING`}getButtonState(e){let t=this._isTouchingButtons[e];if(!this._enabled||t===void 0)return`NONE`;let n=t.prev,r=t.current;return n&&r?`TOUCHING`:r?`TOUCH`:n?`LEAVE`:`NONE`}setTouchInfo(e){let t=this._isTouchingButtons[e];!this._enabled||t===void 0||(t.next=!0)}clearTouchInfo(e){let t=this._isTouchingButtons[e];!this._enabled||t===void 0||(t.next=!1)}allMoveClear(){Ae.forEach(e=>{this._availableButtons.includes(e)&&this.clearTouchInfo(e)})}allClear(){this._availableButtons.forEach(e=>{if(e!==void 0){let t=this._isTouchingButtons[e];t!==void 0&&(t.next=!1)}})}static isMoveButton(e){return je.has(e)}update(){this._availableButtons.forEach(e=>{if(e===void 0)return;let t=this._isTouchingButtons[e];if(t!==void 0)switch(this._isTouchingButtons[e].prev=t.current,this._isTouchingButtons[e].current=t.next,this.getButtonState(e)){case`TOUCH`:this._onTouchStart?.(e);break;case`LEAVE`:this._onTouchEnd?.(e);break}})}toggleVisible(){this._setVisible(!this._visible)}};function Ne(){let e=document.getElementsByTagName(`head`)[0],t=document.createElement(`meta`);t.setAttribute(`name`,`viewport`),e.appendChild(t),Pe()}function Pe(){let e=document.querySelector(`meta[name='viewport']`),t=window.innerWidth,n=window.innerHeight,r=`user-scalable=no`;t>n?r=`width=${Math.floor(t/n*456)},${r}`:t<=n&&(r=`width=576,${r}`),e?.setAttribute(`content`,`${r}`)}function Fe(){return`
|
|
10
10
|
<div id="wwa-virtualpad-left">
|
|
11
11
|
<button class="wwa-virtualpad__button" id="wwa-up-button"></button>
|
|
12
12
|
<button class="wwa-virtualpad__button" id="wwa-left-button"></button>
|
|
@@ -20,7 +20,7 @@ var WWA=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`}
|
|
|
20
20
|
<button class="wwa-virtualpad__button" id="wwa-enter-button">Y</button>
|
|
21
21
|
<button class="wwa-virtualpad__button" id="wwa-esc-button">N</button>
|
|
22
22
|
</div>`}var U=e=>document.getElementById(e),Ie=e=>document.getElementsByTagName(e),Le=e=>document.querySelector(e),Re=e=>document.querySelector(e),ze=e=>document.querySelectorAll(e),Be=(e,t)=>{var n,r,i=window.pageXOffset||document.body.scrollLeft||document.documentElement.scrollLeft,a=window.pageYOffset||document.body.scrollTop||document.documentElement.scrollTop;return n=e-U(`wwa-wrapper`).offsetLeft+i,r=t-U(`wwa-wrapper`).offsetTop+a,new S(n,r)},Ve=e=>e.match(/^https?:\/\//)||e.match(/^\.\.\//)?e:location.href=`./`+e,He=e=>{var t=``;if(e instanceof Array){for(var n=0;n<e.length;n++)t+=He(e[n])+`/`;return t}else return e+``},Ue=e=>e.split(``).reverse().join(``);function We(e,t){if(typeof e!=`number`)throw TypeError(`${t} が数値ではありません。`);return!0}function Ge(e,t,n=0){if(n>=3)return`...`;if(typeof e==`number`||typeof e==`boolean`||e==null)return String(e);if(typeof e==`string`){let n=[...e];return t&&n.length>10?`"${n.slice(0,10).join(``)}…`:`"${e}"`}else if(Array.isArray(e))return`[${e.map(e=>Ge(e,!0,n+1)).join(`,`)}]`;else if(e instanceof Map)return`{${[...e].map(([e,t])=>`${e}:${Ge(t,!0,n+1)}`).join(`,`)}}`;else throw TypeError(`この値はフォーマットできません`,e)}function Ke(e,t){if(Array.isArray(e)){if(typeof t!=`number`)throw TypeError(`配列に対して、数字以外をindexにできません`);if(t<0||t>=e.length){console.warn(`配列のインデックス ${t} は範囲外です`);return}return e[t]}else if(e instanceof Map){if(!f(t))throw TypeError(`オブジェクトのキーはプリミティブ値でなければなりません。: `+t);return e.get(String(t))}else if(typeof e==`string`){if(typeof t!=`number`)throw TypeError(`文字列 "${e}" に対して、数字以外をindexにできません`);if(t<0||t>=e.length){console.warn(`文字列 "${e}" のインデックス ${t} は範囲外です`);return}return e[t]}else if(f(e))throw TypeError(`プリミティブ値 ${String(e)} は添字参照できません`);else throw TypeError(String(e)+`は添字参照できません`)}function qe(e,t,n){if(Array.isArray(e)){if(typeof t!=`number`)throw TypeError(`数字以外をindexにできません`);e[t]=n}else if(e instanceof Map){if(!f(t))throw TypeError(`オブジェクトのキーはプリミティブ値でなければなりません。: `+t);e.set(String(t),n)}else if(typeof e==`string`)throw TypeError(`文字列 "${e}" の特定の文字を直接書き換えることはできません`);else if(f(e))throw TypeError(`プリミティブ値 ${String(e)} は添字参照できません`);else throw TypeError(String(e)+`は添字参照できません`)}function Je(e){return[E.NO_DIRECTION,E.LEFT,E.DOWN,E.UP,E.RIGHT].includes(e)}var Ye=[{name:`pos`,type:`numberArray`},{name:`time`,type:`numberOrArray`},{name:`timeFrame`,type:`numberOrArray`},{name:`size`,type:`numberArray`},{name:`animTime`,type:`numberArray`},{name:`animTimeFrame`,type:`numberArray`},{name:`move`,type:`numberArray`},{name:`accel`,type:`numberArray`},{name:`zoom`,type:`numberArray`},{name:`zoomAccel`,type:`numberArray`},{name:`anchor`,type:`number`},{name:`circle`,type:`numberArray`},{name:`repeat`,type:`numberArray`},{name:`img`,type:`numberArray`},{name:`imgFile`,type:`string`},{name:`imgMap`,type:`numberArray`},{name:`sound`,type:`number`},{name:`crop`,type:`numberArray`},{name:`text`,type:`string`},{name:`font`,type:`string`},{name:`fontSize`,type:`number`},{name:`fontFamily`,type:`string`},{name:`italic`,type:`number`},{name:`bold`,type:`number`},{name:`color`,type:`numberArray`},{name:`textAlign`,type:`string`},{name:`lineHeight`,type:`number`},{name:`opacity`,type:`number`},{name:`fade`,type:`number`},{name:`angle`,type:`number`},{name:`rotate`,type:`number`},{name:`wait`,type:`number`},{name:`waitFrame`,type:`number`},{name:`next`,type:`numberArray`},{name:`create`,type:`numberArray2D`},{name:`map`,type:`numberArray`},{name:`script`,type:`string`}],Xe={time_frame:`timeFrame`,anim_time:`animTime`,anim_time_frame:`animTimeFrame`,zoom_accel:`zoomAccel`,img_file:`imgFile`,img_map:`imgMap`,font_size:`fontSize`,font_family:`fontFamily`,text_align:`textAlign`,line_height:`lineHeight`,wait_frame:`waitFrame`},Ze=`-?\\d+`,Qe=`v\\[${Ze}\\]`,$e=`v\\[(${Ze})\\]`,et=`m\\[${Ze}\\]\\[${Ze}\\]`,tt=`m\\[(${Ze})\\]\\[(${Ze})\\]`,nt=`o\\[${Ze}\\]\\[${Ze}\\]`,rt=`o\\[(${Ze})\\]\\[(${Ze})\\]`,it=`ITEM\\[${Ze}\\]`,at=`ITEM\\[(${Ze})\\]`,ot=`${Qe}|${et}|${nt}|${it}`,st=`AT_TOTAL|AT_ITEMS|DF_TOTAL|DF_ITEMS|TIME|X|Y|PX|PY|ID|TYPE|ITEM_COUNT_ALL`,ct=`HP|HPMAX|AT|DF|GD|STEP|PDIR`,lt=`${ot}|${et}|${nt}|${it}|${ct}`,ut=`${Ze}|${ot}|${st}|${ct}`,dt=`RAND\\((?:${ut})\\)`,ft=`RAND\\((${ut})\\)`,pt=`ITEM_COUNT\\((?:${ut})\\)`,mt=`ITEM_COUNT\\((${ut})\\)`,ht=`${ut}|${`${dt}|${pt}`}`,gt=`\\+|\\-|\\*|\\/|%`,_t=`=`,vt=`${_t}|\\+=|\\-=|\\*=|\\/=|%=`,yt=`>|<|<=|>=|==|!=`,bt=`^\\(`,xt=`\\)$`,St=RegExp(`^${Ze}\$`),Ct=RegExp(`^${$e}\$`),wt=RegExp(`^${tt}\$`),Tt=RegExp(`^${rt}\$`),Et=RegExp(`^${at}\$`),Dt=RegExp(`^${ft}\$`),Ot=RegExp(`${mt}\$`),kt=RegExp(`${bt}(${lt})${_t}(${ht})(${gt})(${ht})${xt}`),At=RegExp(`${bt}(${lt})(${vt})(${ht})${xt}`),jt=RegExp(`^(${ht})(?:(${gt})(${ht}))?$`),Mt=RegExp(`${bt}(${ht})(${yt})(${ht})${xt}`),Nt=RegExp(`{{(${ht})}}`,`g`);function Pt(e){return e.type!==`RAND`&&e.type!==`ITEM_COUNT`}function Ft(e){switch(e){case`HP`:case`HPMAX`:case`AT`:case`AT_TOTAL`:case`AT_ITEMS`:case`DF`:case`DF_TOTAL`:case`DF_ITEMS`:case`GD`:case`STEP`:case`TIME`:case`X`:case`Y`:case`PX`:case`PY`:case`PDIR`:case`ID`:case`TYPE`:case`ITEM_COUNT_ALL`:return{type:e};default:let t=e.match(Ct);if(t){let e=It(t);return e===null?null:{type:`VARIABLE`,index:e}}let n=e.match(wt);if(n){let e=Lt(n);return e===null?null:{type:`MAP`,x:e[0],y:e[1]}}let r=e.match(Tt);if(r){let e=Lt(r);return e===null?null:{type:`OBJECT`,x:e[0],y:e[1]}}let i=e.match(Et);if(i){let e=It(i);return e===null?null:{type:`ITEM`,boxIndex1To12:e}}if(e.match(St)){let t=parseInt(e,10);return t!==null&&!isNaN(t)?{type:`NUMBER`,rawValue:t}:null}let a=e.match(Dt);if(a){let e=a.length>=2?Ft(a[1]):null;return e!==null&&Pt(e)?{type:`RAND`,argument:e}:null}let o=e.match(Ot);if(o){let e=o.length>=2?Ft(o[1]):null;return e!==null&&Pt(e)?{type:`ITEM_COUNT`,argument:e}:null}return null}}function It(e){let t=e.length>=2?Number(e[1]):null;return t!==null&&!isNaN(t)?t:null}function Lt(e){if(e.length<3)return null;let t=Number(e[1]),n=Number(e[2]);return isNaN(t)||isNaN(n)?null:[t,n]}function Rt(e,t,n=0){if(typeof e==`boolean`)return e;let r=zt(e.left,t,n),i=zt(e.right,t,n);return Vt(e.operator,r,i)}function zt(e,t,n=0){switch(e.type){case`HP`:return t.totalStatus.energy;case`HPMAX`:return t.energyMax;case`AT`:return t.bareStatus.strength;case`AT_TOTAL`:return t.totalStatus.strength;case`AT_ITEMS`:return t.itemStatus.strength;case`DF`:return t.bareStatus.defence;case`DF_TOTAL`:return t.totalStatus.defence;case`DF_ITEMS`:return t.itemStatus.defence;case`GD`:return t.totalStatus.gold;case`STEP`:return t.moveCount;case`VARIABLE`:{let n=t.userVars[e.index];return We(n,`v${e.index}`)?n:0}case`MAP`:return e.y<0||e.y>=t.map.length||e.x<0||e.x>=t.map[e.y].length?0:t.map[e.y][e.x];case`OBJECT`:return e.y<0||e.y>=t.mapObject.length||e.x<0||e.x>=t.mapObject[e.y].length?0:t.mapObject[e.y][e.x];case`ITEM`:return e.boxIndex1To12<1||e.boxIndex1To12>12?0:t.itemBox[e.boxIndex1To12-1];case`ITEM_COUNT_ALL`:return t.itemBox.filter(e=>e!==0).length;case`NUMBER`:return e.rawValue;case`TIME`:return t.playTime;case`X`:return t.partsPosition?.x??t.playerCoord.x;case`Y`:return t.partsPosition?.y??t.playerCoord.y;case`PX`:return t.playerCoord.x;case`PY`:return t.playerCoord.y;case`PDIR`:return t.playerDirection;case`ID`:return t.partsId??-1;case`TYPE`:return t.partsType??-1;case`RAND`:return Math.floor(Math.random()*zt(e.argument,t));case`ITEM_COUNT`:return t.itemBox.filter(n=>n===zt(e.argument,t)).length;default:return n}}function Bt(e,t,n){switch(e){case`=`:return n;case`+`:case`+=`:return t+n;case`-`:case`-=`:return t-n;case`*`:case`*=`:return t*n;case`/`:case`/=`:return n===0?0:t/n;case`%`:case`%=`:return n===0?0:t%n;default:throw Error(`未定義の演算子です`)}}function Vt(e,t,n){switch(e){case`>`:return t>n;case`<`:return t<n;case`>=`:return t>=n;case`<=`:return t<=n;case`==`:return t===n;case`!=`:return t!==n;default:return!1}}function Ht(e,t){switch(Ft(t)?.type){case`VARIABLE`:{let n=t.match(/^v\[(\d+)\]$/),r=Number(n[1]);if(r===null||isNaN(r))throw Error(`ユーザ変数の添字のパースに失敗しました`);return{assignee:`variable`,index:r,rawValue:e}}case`MAP`:{let n=t.match(/^m\[(\d+)\]\[(\d+)\]$/),r=Number(n[1]),i=Number(n[2]);if(r===null||i===null||isNaN(r)||isNaN(i))throw Error(`背景パーツの添字のパースに失敗しました`);return{assignee:`map`,x:r,y:i,rawValue:e}}case`OBJECT`:{let n=t.match(/^o\[(\d+)\]\[(\d+)\]$/),r=Number(n[1]),i=Number(n[2]);if(r===null||i===null||isNaN(r)||isNaN(i))throw Error(`物体パーツの添字のパースに失敗しました`);return{assignee:`mapObject`,x:r,y:i,rawValue:e}}case`ITEM`:{let n=t.match(/^ITEM\[(\d+)\]$/),r=Number(n[1]);if(r===null||isNaN(r))throw Error(`アイテムの添字のパースに失敗しました`);return{assignee:`item`,boxIndex1to12:r,rawValue:e}}case`ITEM_COUNT_ALL`:throw Error(`左辺値に所持アイテム数は入れられません`);case`NUMBER`:throw Error(`左辺値に定数は入れられません`);case`HP`:return{assignee:`energy`,rawValue:e};case`HPMAX`:return{assignee:`energyMax`,rawValue:e};case`AT`:return{assignee:`strength`,rawValue:e};case`AT_TOTAL`:throw Error(`左辺値に合計攻撃力は入れられません`);case`AT_ITEMS`:throw Error(`左辺値にアイテム攻撃力は入れられません`);case`DF`:return{assignee:`defence`,rawValue:e};case`DF_TOTAL`:throw Error(`左辺値に合計防御力は入れられません`);case`DF_ITEMS`:throw Error(`左辺値にアイテム防御力は入れられません`);case`GD`:return{assignee:`gold`,rawValue:e};case`STEP`:return{assignee:`moveCount`,rawValue:e};case`TIME`:throw Error(`左辺値にプレイ時間は入れられません`);case`PX`:throw Error(`左辺値にプレイヤーX座標は入れられません`);case`PY`:throw Error(`左辺値にプレイヤーY座標は入れられません`);case`X`:throw Error(`左辺値にパーツX座標は入れられません`);case`Y`:throw Error(`左辺値にパーツY座標は入れられません`);case`ID`:throw Error(`左辺値にパーツ番号座標は入れられません`);case`TYPE`:throw Error(`左辺値にパーツ種別は入れられません`);case`PDIR`:return{assignee:`playerDirection`,rawValue:e};case`RAND`:throw Error(`左辺値に乱数は入れられません`);case`ITEM_COUNT`:throw Error(`左辺値に所持アイテム数は入れられません`);default:throw Error(`この文字列から代入操作オブジェクトは生成できません`)}}function Ut(e){return e.replace(/\s/g,``)}function Wt(e,t,n=0){return zt(Ft(e),t,n)}function Gt(e,t){let n=Ut(e),r=n.match(kt);if(r!==null){let e=Wt(r[2],t),n=Wt(r[4],t),i=r[3];return Ht(Bt(i,e,n),r[1])}let i=n.match(At);if(i!==null){let e=Wt(i[1],t),n=Wt(i[3],t),r=i[2];return Ht(Bt(r,e,n),i[1])}throw Error(`setMacroのフォーマットを満たしていません: `+e)}function Kt(e,t,n=0){let r=Ut(e).match(jt);if(r!==null){let e=Wt(r[1],t,n),i=r[3]?Wt(r[3],t,n):void 0,a=r[2];return a&&i?Bt(a,e,i):e}throw Error(`マクロ引数のフォーマットを満たしていません: `+e)}function qt(e){return Ut(e).match(jt)!==null}function Jt(e){let t=Ut(e).match(Mt);if(t===null||t.length<=3){console.error(`判定式が異常です: ${e}`);return}let n=Ft(t[1]),r=Ft(t[3]);if(!n||!r){console.error(`判定式が異常です: ${e}`);return}return{left:n,right:r,operator:t[2]}}var Yt=e=>{try{let t=JSON.parse(e.propertiesText);if(Array.isArray(t))throw Error(`配列形式ではなくオブジェクト形式で記述してください。`);if(typeof t!=`object`)throw Error(`オブジェクト形式で記述してください。`);return{...e,properties:t}}catch(e){console.error(`JSON パースエラーが発生しました!: ${e.message}`)}},Xt=(e,t)=>{let n=Ye.find(({name:t})=>t===e);if(!n)return console.warn(`定義外のプロパティ ${e} を見つけました。`),!1;switch(n.type){case`numberArray2D`:{if(!Array.isArray(t))return console.warn(`プロパティ ${e} は配列形式である必要がありますが、配列形式になっていません。`),!1;let n=t.map((e,t)=>Array.isArray(e)?null:t+1).filter(e=>e!==null);if(n.length>0)return console.warn(`プロパティ ${e} は配列の配列である必要がありますが、 ${n.join(`, `)} の要素が配列形式になっていません。`),!1;break}case`string`:if(typeof t!=`string`)if(typeof t==`number`)console.warn(`プロパティ ${e} は文字列形式を推奨しています。実際に入った値は ${t} です。`);else return console.warn(`プロパティ ${e} では文字列形式である必要があります。実際に入った値は ${t} です。`),!1}return!0},Zt=e=>Xe[e]??e,Qt=e=>Number.isInteger(e)&&(e>0||$t(e)),$t=e=>e===-1,en=e=>{let t=Object.entries(e.properties).map(([e,t])=>{let n=Zt(e);if(!Xt(n,t))return[n,t];switch(Ye.find(({name:e})=>e===n).type){case`string`:if(typeof t!=`string`)return[n,t.toString()]}return[n,t]});return{...e,properties:Object.fromEntries(t)}},tn=(e,t)=>{let n=e=>typeof e==`number`?e:Kt(e,t),r=Object.entries(e.properties).map(([e,t])=>{let r=Zt(e);if(!Xt(r,t))return[r,t];switch(Ye.find(({name:e})=>e===r).type){case`number`:return[r,n(t)];case`numberArray`:return[r,t.map(n)];case`numberOrArray`:return Array.isArray(t)?[r,t.map(n)]:[r,[n(t)]];case`numberArray2D`:return!Array.isArray(t)||t.some(Array.isArray)?[r,t]:[r,t.map(e=>e.map(n))];case`string`:if(typeof t!=`string`)return[r,t.toString()];let e=String(t);return Array.from(t.matchAll(Nt)).forEach(r=>{r.length<2&&console.warn(`テンプレート文字列で合致した文字列の中の値を取り出すことができませんでした。文字列そのものの値は ${t} です。`);let i=r[0],a=r[1],o=n(a);e=e.replace(i,typeof o==`number`?o.toString():o)}),[r,e];default:return[r,t]}});return{...e,properties:Object.fromEntries(r)}},nn=(e,t,n)=>Array.isArray(e)?e[t]:n?e:void 0,rn=(e,t,n,r)=>e>0||t>0||n>0||r>0,an=e=>e<0?0:e,on=(e,t,n)=>{switch(n){case 1:case 4:case 7:return e;case 2:case 5:case 8:return e-t/2;case 3:case 6:case 9:return e-t;default:return e}},sn=(e,t,n)=>{if(t===0)return e;let r=n*Math.PI/180;return e+t*Math.cos(r)},cn=(e,t,n)=>{switch(n){case 1:case 2:case 3:return e-t;case 4:case 5:case 6:return e-t/2;default:return e}},ln=(e,t,n)=>{if(t===0)return e;let r=n*Math.PI/180;return e+t*Math.sin(r)},un=e=>Math.max(e,1),dn=e=>Math.max(e,1),fn=(e,t)=>{let n=Array(e);for(let e=0;e<n.length;e++)n[e]=Array(t);return n},pn=e=>(e%=256,e>=128?e-256:e),mn=function(e){return e[e.CHECK=0]=`CHECK`,e[e.VERSION=2]=`VERSION`,e[e.OLD_MAP_COUNT=3]=`OLD_MAP_COUNT`,e[e.OLD_OBJ_COUNT=4]=`OLD_OBJ_COUNT`,e[e.OLD_PLAYER_X=5]=`OLD_PLAYER_X`,e[e.OLD_PLAYER_Y=6]=`OLD_PLAYER_Y`,e[e.STATUS_ENERGY=10]=`STATUS_ENERGY`,e[e.STATUS_STRENGTH=12]=`STATUS_STRENGTH`,e[e.STATUS_DEFENCE=14]=`STATUS_DEFENCE`,e[e.STATUS_GOLD=16]=`STATUS_GOLD`,e[e.OLD_GAMEOVER_X=18]=`OLD_GAMEOVER_X`,e[e.OLD_GAMEOVER_Y=19]=`OLD_GAMEOVER_Y`,e[e.OLD_ITEMBOX_TOP=20]=`OLD_ITEMBOX_TOP`,e[e.STATUS_ENERGY_MAX=32]=`STATUS_ENERGY_MAX`,e[e.MAP_COUNT=34]=`MAP_COUNT`,e[e.OBJ_COUNT=36]=`OBJ_COUNT`,e[e.PLAYER_X=38]=`PLAYER_X`,e[e.PLAYER_Y=40]=`PLAYER_Y`,e[e.GAMEOVER_X=42]=`GAMEOVER_X`,e[e.GAMEOVER_Y=44]=`GAMEOVER_Y`,e[e.MAP_SIZE=46]=`MAP_SIZE`,e[e.MESSAGE_NUM=48]=`MESSAGE_NUM`,e[e.ITEMBOX_TOP=60]=`ITEMBOX_TOP`,e[e.MAPDATA_TOP=90]=`MAPDATA_TOP`,e[e.OLD_MAPDATA_TOP=100]=`OLD_MAPDATA_TOP`,e}({});function hn(e){return e[mn.CHECK]+e[mn.CHECK+1]*256}function gn(e,t){let n=0;if(e[mn.VERSION]>=29){for(let r=2;r<t;r++)n+=pn(e[r])*(r%8+1);n=n%65536&65535}return n}function _n(e,t){let n=hn(e),r=gn(e,t);if(n!==r)throw Error(`マップデータが壊れているようです。
|
|
23
|
-
チェックサムの値は`+n+`ですが、実際の和は`+r+`でした。`)}var W=class{static{this.ITEMBOX_SIZE=12}static{this.MAP_ATR_MAX=60}static{this.OBJ_ATR_MAX=60}static{this.OLD_MAP_ATR_MAX=40}static{this.OLD_OBJ_ATR_MAX=40}static{this.ATR_CROP1=1}static{this.ATR_CROP2=2}static{this.ATR_TYPE=3}static{this.ATR_JUMP_X=16}static{this.ATR_JUMP_Y=17}static{this.MAP_LOCALGATE=2}static{this.OBJECT_LOCALGATE=18}static{this.SYSTEM_MESSAGE_NUM=20}static{this.IMGPOS_DEFAULT_YESNO_X=3}static{this.IMGPOS_DEFAULT_YESNO_Y=1}static{this.IMGPOS_DEFAULT_PLAYER_X=2}static{this.IMGPOS_DEFAULT_PLAYER_Y=0}static{this.IMGPOS_DEFAULT_CLICKABLE_ITEM_SIGN_X=0}static{this.IMGPOS_DEFAULT_CLICKABLE_ITEM_SIGN_Y=0}static{this.IMGPOS_DEFAULT_STATUS_X=3}static{this.IMGPOS_DEFAULT_STATUS_Y=2}static{this.IMGRELPOS_ENERGY_ICON_X=0}static{this.IMGRELPOS_STRENGTH_ICON_X=1}static{this.IMGRELPOS_DEFENCE_ICON_X=2}static{this.IMGRELPOS_GOLD_ICON_X=3}static{this.IMGPOS_DEFAULT_WIDE_CELL_X=4}static{this.IMGPOS_DEFAULT_WIDE_CELL_Y=3}static{this.IMGPOS_DEFAULT_ITEMBOX_X=1}static{this.IMGPOS_DEFAULT_ITEMBOX_Y=2}static{this.IMGPOS_DEFAULT_FRAME_X=0}static{this.IMGPOS_DEFAULT_FRAME_Y=1}static{this.IMGPOS_DEFAULT_BATTLE_EFFECT_X=3}static{this.IMGPOS_DEFAULT_BATTLE_EFFECT_Y=3}static{this.DEFAULT_DISABLE_SAVE=!1}static{this.DEFAULT_OLDMAP=!1}static{this.DEFAULT_OBJECT_NO_COLLAPSE=!1}static{this.DEFAULT_FRAME_COLOR_R=255}static{this.DEFAULT_FRAME_COLOR_G=255}static{this.DEFAULT_FRAME_COLOR_B=255}static{this.DEFAULT_FRAMEOUT_COLOR_R=96}static{this.DEFAULT_FRAMEOUT_COLOR_G=96}static{this.DEFAULT_FRAMEOUT_COLOR_B=96}static{this.DEFAULT_STR_COLOR_R=0}static{this.DEFAULT_STR_COLOR_G=0}static{this.DEFAULT_STR_COLOR_B=0}static{this.DEFAULT_STATUS_COLOR_R=0}static{this.DEFAULT_STATUS_COLOR_G=0}static{this.DEFAULT_STATUS_COLOR_B=0}static{this.DEFAULT_MOVES=0}static{this.DEFAULT_SPEED_INDEX=3}static{this.USER_VAR_NUM=256}},vn=function(e){return e[e.MAP=1]=`MAP`,e[e.OBJECT=0]=`OBJECT`,e}({}),yn=function(e){return e[e.INIT=0]=`INIT`,e[e.MAP_LOAD=1]=`MAP_LOAD`,e[e.OBJ_LOAD=2]=`OBJ_LOAD`,e[e.MAP_ATTR=3]=`MAP_ATTR`,e[e.OBJ_ATTR=4]=`OBJ_ATTR`,e[e.RAND_PARTS=5]=`RAND_PARTS`,e[e.MESSAGE=6]=`MESSAGE`,e}({});function bn(){return{version:void 0,gameoverX:void 0,gameoverY:void 0,playerX:void 0,playerY:void 0,mapPartsMax:void 0,objPartsMax:void 0,isOldMap:void 0,isOldMove:void 0,statusEnergyMax:void 0,statusEnergy:void 0,statusStrength:void 0,statusDefence:void 0,statusGold:void 0,itemBox:void 0,mapWidth:void 0,messageNum:void 0,map:void 0,mapObject:void 0,mapCompressed:void 0,mapObjectCompressed:void 0,mapAttribute:void 0,objectAttribute:void 0,worldPassword:void 0,message:void 0,worldName:void 0,worldPassNumber:void 0,charCGName:void 0,mapCGName:void 0,systemMessage:void 0,moves:void 0,yesnoImgPosX:void 0,yesnoImgPosY:void 0,playerImgPosX:void 0,playerImgPosY:void 0,clickableItemSignImgPosX:void 0,clickableItemSignImgPosY:void 0,disableSaveFlag:void 0,compatibleForOldMapFlag:void 0,objectNoCollapseDefaultFlag:void 0,delPlayerFlag:void 0,bgm:void 0,effectCoords:void 0,effectWaits:void 0,imgStatusEnergyX:void 0,imgStatusEnergyY:void 0,imgStatusStrengthX:void 0,imgStatusStrengthY:void 0,imgStatusDefenceX:void 0,imgStatusDefenceY:void 0,imgStatusGoldX:void 0,imgStatusGoldY:void 0,imgWideCellX:void 0,imgWideCellY:void 0,imgItemboxX:void 0,imgItemboxY:void 0,imgFrameX:void 0,imgFrameY:void 0,imgBattleEffectX:void 0,imgBattleEffectY:void 0,imgClickX:void 0,imgClickY:void 0,frameColorR:void 0,frameColorG:void 0,frameColorB:void 0,frameOutColorR:void 0,frameOutColorG:void 0,frameOutColorB:void 0,fontColorR:void 0,fontColorG:void 0,fontColorB:void 0,statusColorR:void 0,statusColorG:void 0,statusColorB:void 0,checkOriginalMapString:void 0,checkString:void 0,isItemEffectEnabled:void 0,frameCount:void 0,gamePadButtonItemTable:void 0,userVar:void 0,userNamedVar:void 0,permitChangeGameSpeed:void 0,gameSpeedIndex:void 0,playTime:void 0,isVisibleStatusEnergy:void 0,isVisibleStatusStrength:void 0,isVisibleStatusDefence:void 0,isVisibleStatusGold:void 0,isGameOverDisabled:void 0,gameOverPolicy:`default`,bgmDelayDurationMs:void 0,customSystemMessages:{},pictureRegistry:[],decisionSound:void 0,attackSound:void 0}}var xn=class{constructor(e,t,n){this.byteMapData=e,this.eventEmitter=n,_n(e,t),this.wwaData=bn()}extractAllData(){var e,t;return this.wwaData.version=this.byteMapData[mn.VERSION],this._extractInitialParameters(),this.wwaData.version>=29?this.currentPosition=mn.MAPDATA_TOP:this.currentPosition=mn.OLD_MAPDATA_TOP,this.wwaData.map=this._getFieldDataFromBits(vn.MAP,this.wwaData.mapPartsMax).concat(),this.wwaData.mapObject=this._getFieldDataFromBits(vn.OBJECT,this.wwaData.objPartsMax).concat(),e=this.wwaData.version>29?W.MAP_ATR_MAX:W.OLD_MAP_ATR_MAX,t=this.wwaData.version>29?W.OBJ_ATR_MAX:W.OLD_OBJ_ATR_MAX,this.wwaData.mapAttribute=this._getPartsDataFromBits(vn.MAP,this.wwaData.mapPartsMax,e).concat(),this.wwaData.objectAttribute=this._getPartsDataFromBits(vn.OBJECT,this.wwaData.objPartsMax,t).concat(),this.wwaData.version<=29&&(this._convertAttributeV2toV3(vn.MAP),this._convertAttributeV2toV3(vn.OBJECT)),this._replaceAllRandomObjects(),this.wwaData}_convertAttributeV2toV3(e){var t,n,r;if(e==vn.MAP)t=this.wwaData.mapPartsMax,n=this.wwaData.mapAttribute,r=W.MAP_LOCALGATE;else if(e==vn.OBJECT)t=this.wwaData.objPartsMax,n=this.wwaData.objectAttribute,r=W.OBJECT_LOCALGATE;else throw Error(`謎のパーツ種別が指定されました`);for(var i=0;i<t;i++){for(var a=9;a>=0;a--){var o=n[i][20+a*2]&255,s=n[i][20+a*2]>>8,c=n[i][20+a*2+1]&255,l=n[i][20+a*2+1]>>8;c===250?c=9e3:c>100&&(c+=9840),l===250?l=9e3:l>100&&(l+=9840),n[i][20+a*4]=o,n[i][20+a*4+3]=s,n[i][20+a*4+1]=c,n[i][20+a*4+2]=l}n[i][W.ATR_TYPE]===r&&(n[i][W.ATR_JUMP_X]>100&&(n[i][W.ATR_JUMP_X]+=9840),n[i][W.ATR_JUMP_Y]>100&&(n[i][W.ATR_JUMP_Y]+=9840))}}_get1ByteNumber(e){return this.byteMapData[e]}_get2BytesNumber(e){return this.byteMapData[e]+this.byteMapData[e+1]*256}_extractInitialParameters(){this.wwaData.version>29?(this.wwaData.gameoverX=this._get2BytesNumber(mn.GAMEOVER_X),this.wwaData.gameoverY=this._get2BytesNumber(mn.GAMEOVER_Y),this.wwaData.playerX=this._get2BytesNumber(mn.PLAYER_X),this.wwaData.playerY=this._get2BytesNumber(mn.PLAYER_Y),this.wwaData.mapPartsMax=this._get2BytesNumber(mn.MAP_COUNT),this.wwaData.objPartsMax=this._get2BytesNumber(mn.OBJ_COUNT),this.wwaData.isOldMap=!1):(this.wwaData.gameoverX=this._get1ByteNumber(mn.OLD_GAMEOVER_X),this.wwaData.gameoverY=this._get1ByteNumber(mn.OLD_GAMEOVER_Y),this.wwaData.playerX=this._get1ByteNumber(mn.OLD_PLAYER_X),this.wwaData.playerY=this._get1ByteNumber(mn.OLD_PLAYER_Y),this.wwaData.mapPartsMax=this._get1ByteNumber(mn.OLD_MAP_COUNT),this.wwaData.objPartsMax=this._get1ByteNumber(mn.OLD_OBJ_COUNT),this.wwaData.isOldMap=!0),this.wwaData.statusEnergyMax=this._get2BytesNumber(mn.STATUS_ENERGY_MAX),this.wwaData.statusEnergy=this._get2BytesNumber(mn.STATUS_ENERGY),this.wwaData.statusStrength=this._get2BytesNumber(mn.STATUS_STRENGTH),this.wwaData.statusDefence=this._get2BytesNumber(mn.STATUS_DEFENCE),this.wwaData.statusGold=this._get2BytesNumber(mn.STATUS_GOLD),this._extractInitialItemData(),this.wwaData.mapWidth=this._get2BytesNumber(mn.MAP_SIZE),this.wwaData.messageNum=this._get2BytesNumber(mn.MESSAGE_NUM),this.wwaData.version<28?this.wwaData.mapWidth=71:this.wwaData.version<=29&&(this.wwaData.mapWidth=101)}_extractInitialItemData(){let e=this.wwaData.version>29?mn.ITEMBOX_TOP:mn.OLD_ITEMBOX_TOP;this.wwaData.itemBox=Array(W.ITEMBOX_SIZE);for(let t=0;t<W.ITEMBOX_SIZE;t++)this.wwaData.itemBox[t]=this._get1ByteNumber(e+t)}_getFieldDataFromBits(e,t){var n,r,i=fn(this.wwaData.mapWidth,this.wwaData.mapWidth);for(n=0;n<this.wwaData.mapWidth;n++)for(r=0;r<this.wwaData.mapWidth;r++)this.wwaData.version>29?(i[n][r]=this._get2BytesNumber(this.currentPosition),this.currentPosition+=2):(i[n][r]=this._get1ByteNumber(this.currentPosition),this.currentPosition+=1),(n*this.wwaData.mapWidth+r)%200==0&&this.emitProgress(n*this.wwaData.mapWidth+r,this.wwaData.mapWidth*this.wwaData.mapWidth,e===vn.MAP?yn.MAP_LOAD:yn.OBJ_LOAD),i[n][r]>=t&&(i[n][r]=0);return this.emitProgress(this.wwaData.mapWidth*this.wwaData.mapWidth,this.wwaData.mapWidth*this.wwaData.mapWidth,e===vn.MAP?yn.MAP_LOAD:yn.OBJ_LOAD),i}_getPartsDataFromBits(e,t,n){var r,i,a=fn(t,n);for(r=0;r<t;r++)for(i=0;i<n;i++){if((r*this.wwaData.mapWidth+i)%200==0&&this.emitProgress(r*n+i,t*n,e===vn.MAP?yn.MAP_ATTR:yn.OBJ_ATTR),i===W.ATR_CROP1||i===W.ATR_CROP2){a[r][i]=0,this.currentPosition+=2;continue}a[r][i]=this._get2BytesNumber(this.currentPosition),this.currentPosition+=2}return this.emitProgress(t*n,t*n,e===vn.MAP?yn.MAP_ATTR:yn.OBJ_ATTR),a}_replaceAllRandomObjects(){this.emitProgress(this.wwaData.mapWidth*this.wwaData.mapWidth,this.wwaData.mapWidth*this.wwaData.mapWidth,yn.RAND_PARTS)}emitProgress(e,t,n){this.eventEmitter.dispatch(`progress`,{current:e,total:t,stage:n})}},Sn=65e3,Cn=3;function wn(e){let t=new Uint8Array(e.length),n,r;for(n=0,r=0;n<e.length&&!(e[n]===0&&e[n+1]===0&&e[n+2]===0);n++){if(t[r++]=e[n],e[n]===e[n+1]){let i=e[n+2];for(let a=0;a<i;a++)t[r++]=e[n];n+=2}if(r+255>=t.length){var i=new Uint8Array(t.length+Sn);i.set(t),t=i}}return console.log(`EXTRACT DATA = `+r+` `+n),{byteMapData:t,byteMapLength:r,compressedEndPosition:n+Cn}}var Tn=class{constructor(e,t,n,r){this.wwaData=e,this.compressedMapData=t,this.startPosition=n,this.eventEmitter=r,this.OLDVER_MESSAGE_MAX=400}load(){let e=this.wwaData;this.currentPos=this.startPosition,e.version>=30&&(e.worldPassword=this.getMessageFromData()),e.version<=29&&(e.messageNum=this.OLDVER_MESSAGE_MAX),e.message=Array(e.messageNum);for(let t=0;t<e.message.length;t++)e.message[t]=this.getMessageFromData(),t%200==0&&this.eventEmitter.dispatch(`progress`,{current:t,total:e.message.length,stage:yn.MESSAGE});for(;e.messageNum<10;)e.message.push(``),e.messageNum++;this.eventEmitter.dispatch(`progress`,{current:e.message.length,total:e.message.length,stage:yn.MESSAGE}),e.worldName=this.getMessageFromData(),e.version<=29?e.worldPassword=this.getMessageFromData():this.getMessageFromData(),e.worldPassword===``?e.worldPassNumber=0:e.version>=29?e.worldPassNumber=(parseInt(e.worldPassword)/10-1197)/17-2357:e.worldPassNumber=parseInt(e.worldPassword),e.charCGName=this.getMessageFromData(),e.mapCGName=this.getMessageFromData(),e.systemMessage=Array(W.SYSTEM_MESSAGE_NUM);for(let t=0;t<W.SYSTEM_MESSAGE_NUM;t++)e.version>=30?e.systemMessage[t]=this.getMessageFromData():e.systemMessage[t]=``;return e.yesnoImgPosX=W.IMGPOS_DEFAULT_YESNO_X,e.yesnoImgPosY=W.IMGPOS_DEFAULT_YESNO_Y,e.playerImgPosX=W.IMGPOS_DEFAULT_PLAYER_X,e.playerImgPosY=W.IMGPOS_DEFAULT_PLAYER_Y,e.clickableItemSignImgPosX=W.IMGPOS_DEFAULT_CLICKABLE_ITEM_SIGN_X,e.clickableItemSignImgPosY=W.IMGPOS_DEFAULT_CLICKABLE_ITEM_SIGN_Y,e.disableSaveFlag=W.DEFAULT_DISABLE_SAVE,e.isOldMap=W.DEFAULT_OLDMAP,e.isOldMove=e.version<31,e.objectNoCollapseDefaultFlag=W.DEFAULT_OBJECT_NO_COLLAPSE,e.delPlayerFlag=!1,e.bgm=0,e.effectCoords=[],e.effectWaits=0,e.imgStatusEnergyX=W.IMGPOS_DEFAULT_STATUS_X+W.IMGRELPOS_ENERGY_ICON_X,e.imgStatusEnergyY=W.IMGPOS_DEFAULT_STATUS_Y,e.imgStatusStrengthX=W.IMGPOS_DEFAULT_STATUS_X+W.IMGRELPOS_STRENGTH_ICON_X,e.imgStatusStrengthY=W.IMGPOS_DEFAULT_STATUS_Y,e.imgStatusDefenceX=W.IMGPOS_DEFAULT_STATUS_X+W.IMGRELPOS_DEFENCE_ICON_X,e.imgStatusDefenceY=W.IMGPOS_DEFAULT_STATUS_Y,e.imgStatusGoldX=W.IMGPOS_DEFAULT_STATUS_X+W.IMGRELPOS_GOLD_ICON_X,e.imgStatusGoldY=W.IMGPOS_DEFAULT_STATUS_Y,e.imgWideCellX=W.IMGPOS_DEFAULT_WIDE_CELL_X,e.imgWideCellY=W.IMGPOS_DEFAULT_WIDE_CELL_Y,e.imgItemboxX=W.IMGPOS_DEFAULT_ITEMBOX_X,e.imgItemboxY=W.IMGPOS_DEFAULT_ITEMBOX_Y,e.imgFrameX=W.IMGPOS_DEFAULT_FRAME_X,e.imgFrameY=W.IMGPOS_DEFAULT_FRAME_Y,e.imgBattleEffectX=W.IMGPOS_DEFAULT_BATTLE_EFFECT_X,e.imgBattleEffectY=W.IMGPOS_DEFAULT_BATTLE_EFFECT_Y,e.imgClickX=0,e.imgClickY=0,e.frameColorR=W.DEFAULT_FRAME_COLOR_R,e.frameColorG=W.DEFAULT_FRAME_COLOR_G,e.frameColorB=W.DEFAULT_FRAME_COLOR_B,e.frameOutColorR=W.DEFAULT_FRAMEOUT_COLOR_R,e.frameOutColorG=W.DEFAULT_FRAMEOUT_COLOR_G,e.frameOutColorB=W.DEFAULT_FRAMEOUT_COLOR_B,e.fontColorR=W.DEFAULT_STR_COLOR_R,e.fontColorG=W.DEFAULT_STR_COLOR_G,e.fontColorB=W.DEFAULT_STR_COLOR_B,e.statusColorR=W.DEFAULT_STATUS_COLOR_R,e.statusColorG=W.DEFAULT_STATUS_COLOR_G,e.statusColorB=W.DEFAULT_STATUS_COLOR_B,e.moves=W.DEFAULT_MOVES,e.gameSpeedIndex=W.DEFAULT_SPEED_INDEX,e.permitChangeGameSpeed=!0,e.userVar=Array.from({length:W.USER_VAR_NUM}).map(()=>0),e.userNamedVar=new Map,e.playTime=0,e.isVisibleStatusEnergy=!0,e.isVisibleStatusStrength=!0,e.isVisibleStatusDefence=!0,e.isVisibleStatusGold=!0,e.gameOverPolicy=`default`,e.bgmDelayDurationMs=0,e.pictureRegistry=[],e.decisionSound=p.DECISION,e.attackSound=p.ATTACK,e}getMessageFromData(){let e=``,t=0;for(t=0;t<1500&&!(this.compressedMapData[this.currentPos+t*2]==0&&this.compressedMapData[this.currentPos+t*2+1]==0);t++)e+=String.fromCharCode((this.compressedMapData[this.currentPos+t*2+1]<<8)+this.compressedMapData[this.currentPos+t*2]);return this.currentPos+=t*2+2,e}},En=class{constructor(){}},Dn=class e extends En{constructor(e){super(),this.uri=e}static async fetch(e){try{return await fetch(e)}catch{throw Error(`マップデータ 「${e}」の読み込みに失敗しました。
|
|
23
|
+
チェックサムの値は`+n+`ですが、実際の和は`+r+`でした。`)}var W=class{static{this.ITEMBOX_SIZE=12}static{this.MAP_ATR_MAX=60}static{this.OBJ_ATR_MAX=60}static{this.OLD_MAP_ATR_MAX=40}static{this.OLD_OBJ_ATR_MAX=40}static{this.ATR_CROP1=1}static{this.ATR_CROP2=2}static{this.ATR_TYPE=3}static{this.ATR_JUMP_X=16}static{this.ATR_JUMP_Y=17}static{this.MAP_LOCALGATE=2}static{this.OBJECT_LOCALGATE=18}static{this.SYSTEM_MESSAGE_NUM=20}static{this.IMGPOS_DEFAULT_YESNO_X=3}static{this.IMGPOS_DEFAULT_YESNO_Y=1}static{this.IMGPOS_DEFAULT_PLAYER_X=2}static{this.IMGPOS_DEFAULT_PLAYER_Y=0}static{this.IMGPOS_DEFAULT_CLICKABLE_ITEM_SIGN_X=0}static{this.IMGPOS_DEFAULT_CLICKABLE_ITEM_SIGN_Y=0}static{this.IMGPOS_DEFAULT_STATUS_X=3}static{this.IMGPOS_DEFAULT_STATUS_Y=2}static{this.IMGRELPOS_ENERGY_ICON_X=0}static{this.IMGRELPOS_STRENGTH_ICON_X=1}static{this.IMGRELPOS_DEFENCE_ICON_X=2}static{this.IMGRELPOS_GOLD_ICON_X=3}static{this.IMGPOS_DEFAULT_WIDE_CELL_X=4}static{this.IMGPOS_DEFAULT_WIDE_CELL_Y=3}static{this.IMGPOS_DEFAULT_ITEMBOX_X=1}static{this.IMGPOS_DEFAULT_ITEMBOX_Y=2}static{this.IMGPOS_DEFAULT_FRAME_X=0}static{this.IMGPOS_DEFAULT_FRAME_Y=1}static{this.IMGPOS_DEFAULT_BATTLE_EFFECT_X=3}static{this.IMGPOS_DEFAULT_BATTLE_EFFECT_Y=3}static{this.DEFAULT_DISABLE_SAVE=!1}static{this.DEFAULT_OLDMAP=!1}static{this.DEFAULT_OBJECT_NO_COLLAPSE=!1}static{this.DEFAULT_FRAME_COLOR_R=255}static{this.DEFAULT_FRAME_COLOR_G=255}static{this.DEFAULT_FRAME_COLOR_B=255}static{this.DEFAULT_FRAMEOUT_COLOR_R=96}static{this.DEFAULT_FRAMEOUT_COLOR_G=96}static{this.DEFAULT_FRAMEOUT_COLOR_B=96}static{this.DEFAULT_STR_COLOR_R=0}static{this.DEFAULT_STR_COLOR_G=0}static{this.DEFAULT_STR_COLOR_B=0}static{this.DEFAULT_STATUS_COLOR_R=0}static{this.DEFAULT_STATUS_COLOR_G=0}static{this.DEFAULT_STATUS_COLOR_B=0}static{this.DEFAULT_MOVES=0}static{this.DEFAULT_SPEED_INDEX=3}static{this.USER_VAR_NUM=256}},vn=function(e){return e[e.MAP=1]=`MAP`,e[e.OBJECT=0]=`OBJECT`,e}({}),yn=function(e){return e[e.INIT=0]=`INIT`,e[e.MAP_LOAD=1]=`MAP_LOAD`,e[e.OBJ_LOAD=2]=`OBJ_LOAD`,e[e.MAP_ATTR=3]=`MAP_ATTR`,e[e.OBJ_ATTR=4]=`OBJ_ATTR`,e[e.RAND_PARTS=5]=`RAND_PARTS`,e[e.MESSAGE=6]=`MESSAGE`,e}({});function bn(){return{version:void 0,gameoverX:void 0,gameoverY:void 0,playerX:void 0,playerY:void 0,mapPartsMax:void 0,objPartsMax:void 0,isOldMap:void 0,isOldMove:void 0,statusEnergyMax:void 0,statusEnergy:void 0,statusStrength:void 0,statusDefence:void 0,statusGold:void 0,itemBox:void 0,mapWidth:void 0,messageNum:void 0,map:void 0,mapObject:void 0,mapCompressed:void 0,mapObjectCompressed:void 0,mapAttribute:void 0,objectAttribute:void 0,worldPassword:void 0,message:void 0,worldName:void 0,worldPassNumber:void 0,charCGName:void 0,mapCGName:void 0,systemMessage:void 0,moves:void 0,yesnoImgPosX:void 0,yesnoImgPosY:void 0,playerImgPosX:void 0,playerImgPosY:void 0,clickableItemSignImgPosX:void 0,clickableItemSignImgPosY:void 0,disableSaveFlag:void 0,compatibleForOldMapFlag:void 0,objectNoCollapseDefaultFlag:void 0,delPlayerFlag:void 0,bgm:void 0,effectCoords:void 0,effectWaits:void 0,imgStatusEnergyX:void 0,imgStatusEnergyY:void 0,imgStatusStrengthX:void 0,imgStatusStrengthY:void 0,imgStatusDefenceX:void 0,imgStatusDefenceY:void 0,imgStatusGoldX:void 0,imgStatusGoldY:void 0,imgWideCellX:void 0,imgWideCellY:void 0,imgItemboxX:void 0,imgItemboxY:void 0,imgFrameX:void 0,imgFrameY:void 0,imgBattleEffectX:void 0,imgBattleEffectY:void 0,imgClickX:void 0,imgClickY:void 0,frameColorR:void 0,frameColorG:void 0,frameColorB:void 0,frameOutColorR:void 0,frameOutColorG:void 0,frameOutColorB:void 0,fontColorR:void 0,fontColorG:void 0,fontColorB:void 0,statusColorR:void 0,statusColorG:void 0,statusColorB:void 0,checkOriginalMapString:void 0,checkString:void 0,isItemEffectEnabled:void 0,frameCount:void 0,gamePadButtonItemTable:void 0,userVar:void 0,userNamedVar:void 0,permitChangeGameSpeed:void 0,gameSpeedIndex:void 0,playTime:void 0,isVisibleStatusEnergy:void 0,isVisibleStatusStrength:void 0,isVisibleStatusDefence:void 0,isVisibleStatusGold:void 0,isGameOverDisabled:void 0,gameOverPolicy:`default`,bgmDelayDurationMs:void 0,customSystemMessages:{},pictureRegistry:[],decisionSound:void 0,attackSound:void 0,battleEstimateDisabled:void 0}}var xn=class{constructor(e,t,n){this.byteMapData=e,this.eventEmitter=n,_n(e,t),this.wwaData=bn()}extractAllData(){var e,t;return this.wwaData.version=this.byteMapData[mn.VERSION],this._extractInitialParameters(),this.wwaData.version>=29?this.currentPosition=mn.MAPDATA_TOP:this.currentPosition=mn.OLD_MAPDATA_TOP,this.wwaData.map=this._getFieldDataFromBits(vn.MAP,this.wwaData.mapPartsMax).concat(),this.wwaData.mapObject=this._getFieldDataFromBits(vn.OBJECT,this.wwaData.objPartsMax).concat(),e=this.wwaData.version>29?W.MAP_ATR_MAX:W.OLD_MAP_ATR_MAX,t=this.wwaData.version>29?W.OBJ_ATR_MAX:W.OLD_OBJ_ATR_MAX,this.wwaData.mapAttribute=this._getPartsDataFromBits(vn.MAP,this.wwaData.mapPartsMax,e).concat(),this.wwaData.objectAttribute=this._getPartsDataFromBits(vn.OBJECT,this.wwaData.objPartsMax,t).concat(),this.wwaData.version<=29&&(this._convertAttributeV2toV3(vn.MAP),this._convertAttributeV2toV3(vn.OBJECT)),this._replaceAllRandomObjects(),this.wwaData}_convertAttributeV2toV3(e){var t,n,r;if(e==vn.MAP)t=this.wwaData.mapPartsMax,n=this.wwaData.mapAttribute,r=W.MAP_LOCALGATE;else if(e==vn.OBJECT)t=this.wwaData.objPartsMax,n=this.wwaData.objectAttribute,r=W.OBJECT_LOCALGATE;else throw Error(`謎のパーツ種別が指定されました`);for(var i=0;i<t;i++){for(var a=9;a>=0;a--){var o=n[i][20+a*2]&255,s=n[i][20+a*2]>>8,c=n[i][20+a*2+1]&255,l=n[i][20+a*2+1]>>8;c===250?c=9e3:c>100&&(c+=9840),l===250?l=9e3:l>100&&(l+=9840),n[i][20+a*4]=o,n[i][20+a*4+3]=s,n[i][20+a*4+1]=c,n[i][20+a*4+2]=l}n[i][W.ATR_TYPE]===r&&(n[i][W.ATR_JUMP_X]>100&&(n[i][W.ATR_JUMP_X]+=9840),n[i][W.ATR_JUMP_Y]>100&&(n[i][W.ATR_JUMP_Y]+=9840))}}_get1ByteNumber(e){return this.byteMapData[e]}_get2BytesNumber(e){return this.byteMapData[e]+this.byteMapData[e+1]*256}_extractInitialParameters(){this.wwaData.version>29?(this.wwaData.gameoverX=this._get2BytesNumber(mn.GAMEOVER_X),this.wwaData.gameoverY=this._get2BytesNumber(mn.GAMEOVER_Y),this.wwaData.playerX=this._get2BytesNumber(mn.PLAYER_X),this.wwaData.playerY=this._get2BytesNumber(mn.PLAYER_Y),this.wwaData.mapPartsMax=this._get2BytesNumber(mn.MAP_COUNT),this.wwaData.objPartsMax=this._get2BytesNumber(mn.OBJ_COUNT),this.wwaData.isOldMap=!1):(this.wwaData.gameoverX=this._get1ByteNumber(mn.OLD_GAMEOVER_X),this.wwaData.gameoverY=this._get1ByteNumber(mn.OLD_GAMEOVER_Y),this.wwaData.playerX=this._get1ByteNumber(mn.OLD_PLAYER_X),this.wwaData.playerY=this._get1ByteNumber(mn.OLD_PLAYER_Y),this.wwaData.mapPartsMax=this._get1ByteNumber(mn.OLD_MAP_COUNT),this.wwaData.objPartsMax=this._get1ByteNumber(mn.OLD_OBJ_COUNT),this.wwaData.isOldMap=!0),this.wwaData.statusEnergyMax=this._get2BytesNumber(mn.STATUS_ENERGY_MAX),this.wwaData.statusEnergy=this._get2BytesNumber(mn.STATUS_ENERGY),this.wwaData.statusStrength=this._get2BytesNumber(mn.STATUS_STRENGTH),this.wwaData.statusDefence=this._get2BytesNumber(mn.STATUS_DEFENCE),this.wwaData.statusGold=this._get2BytesNumber(mn.STATUS_GOLD),this._extractInitialItemData(),this.wwaData.mapWidth=this._get2BytesNumber(mn.MAP_SIZE),this.wwaData.messageNum=this._get2BytesNumber(mn.MESSAGE_NUM),this.wwaData.version<28?this.wwaData.mapWidth=71:this.wwaData.version<=29&&(this.wwaData.mapWidth=101)}_extractInitialItemData(){let e=this.wwaData.version>29?mn.ITEMBOX_TOP:mn.OLD_ITEMBOX_TOP;this.wwaData.itemBox=Array(W.ITEMBOX_SIZE);for(let t=0;t<W.ITEMBOX_SIZE;t++)this.wwaData.itemBox[t]=this._get1ByteNumber(e+t)}_getFieldDataFromBits(e,t){var n,r,i=fn(this.wwaData.mapWidth,this.wwaData.mapWidth);for(n=0;n<this.wwaData.mapWidth;n++)for(r=0;r<this.wwaData.mapWidth;r++)this.wwaData.version>29?(i[n][r]=this._get2BytesNumber(this.currentPosition),this.currentPosition+=2):(i[n][r]=this._get1ByteNumber(this.currentPosition),this.currentPosition+=1),(n*this.wwaData.mapWidth+r)%200==0&&this.emitProgress(n*this.wwaData.mapWidth+r,this.wwaData.mapWidth*this.wwaData.mapWidth,e===vn.MAP?yn.MAP_LOAD:yn.OBJ_LOAD),i[n][r]>=t&&(i[n][r]=0);return this.emitProgress(this.wwaData.mapWidth*this.wwaData.mapWidth,this.wwaData.mapWidth*this.wwaData.mapWidth,e===vn.MAP?yn.MAP_LOAD:yn.OBJ_LOAD),i}_getPartsDataFromBits(e,t,n){var r,i,a=fn(t,n);for(r=0;r<t;r++)for(i=0;i<n;i++){if((r*this.wwaData.mapWidth+i)%200==0&&this.emitProgress(r*n+i,t*n,e===vn.MAP?yn.MAP_ATTR:yn.OBJ_ATTR),i===W.ATR_CROP1||i===W.ATR_CROP2){a[r][i]=0,this.currentPosition+=2;continue}a[r][i]=this._get2BytesNumber(this.currentPosition),this.currentPosition+=2}return this.emitProgress(t*n,t*n,e===vn.MAP?yn.MAP_ATTR:yn.OBJ_ATTR),a}_replaceAllRandomObjects(){this.emitProgress(this.wwaData.mapWidth*this.wwaData.mapWidth,this.wwaData.mapWidth*this.wwaData.mapWidth,yn.RAND_PARTS)}emitProgress(e,t,n){this.eventEmitter.dispatch(`progress`,{current:e,total:t,stage:n})}},Sn=65e3,Cn=3;function wn(e){let t=new Uint8Array(e.length),n,r;for(n=0,r=0;n<e.length&&!(e[n]===0&&e[n+1]===0&&e[n+2]===0);n++){if(t[r++]=e[n],e[n]===e[n+1]){let i=e[n+2];for(let a=0;a<i;a++)t[r++]=e[n];n+=2}if(r+255>=t.length){var i=new Uint8Array(t.length+Sn);i.set(t),t=i}}return console.log(`EXTRACT DATA = `+r+` `+n),{byteMapData:t,byteMapLength:r,compressedEndPosition:n+Cn}}var Tn=class{constructor(e,t,n,r){this.wwaData=e,this.compressedMapData=t,this.startPosition=n,this.eventEmitter=r,this.OLDVER_MESSAGE_MAX=400}load(){let e=this.wwaData;this.currentPos=this.startPosition,e.version>=30&&(e.worldPassword=this.getMessageFromData()),e.version<=29&&(e.messageNum=this.OLDVER_MESSAGE_MAX),e.message=Array(e.messageNum);for(let t=0;t<e.message.length;t++)e.message[t]=this.getMessageFromData(),t%200==0&&this.eventEmitter.dispatch(`progress`,{current:t,total:e.message.length,stage:yn.MESSAGE});for(;e.messageNum<10;)e.message.push(``),e.messageNum++;this.eventEmitter.dispatch(`progress`,{current:e.message.length,total:e.message.length,stage:yn.MESSAGE}),e.worldName=this.getMessageFromData(),e.version<=29?e.worldPassword=this.getMessageFromData():this.getMessageFromData(),e.worldPassword===``?e.worldPassNumber=0:e.version>=29?e.worldPassNumber=(parseInt(e.worldPassword)/10-1197)/17-2357:e.worldPassNumber=parseInt(e.worldPassword),e.charCGName=this.getMessageFromData(),e.mapCGName=this.getMessageFromData(),e.systemMessage=Array(W.SYSTEM_MESSAGE_NUM);for(let t=0;t<W.SYSTEM_MESSAGE_NUM;t++)e.version>=30?e.systemMessage[t]=this.getMessageFromData():e.systemMessage[t]=``;return e.yesnoImgPosX=W.IMGPOS_DEFAULT_YESNO_X,e.yesnoImgPosY=W.IMGPOS_DEFAULT_YESNO_Y,e.playerImgPosX=W.IMGPOS_DEFAULT_PLAYER_X,e.playerImgPosY=W.IMGPOS_DEFAULT_PLAYER_Y,e.clickableItemSignImgPosX=W.IMGPOS_DEFAULT_CLICKABLE_ITEM_SIGN_X,e.clickableItemSignImgPosY=W.IMGPOS_DEFAULT_CLICKABLE_ITEM_SIGN_Y,e.disableSaveFlag=W.DEFAULT_DISABLE_SAVE,e.isOldMap=W.DEFAULT_OLDMAP,e.isOldMove=e.version<31,e.objectNoCollapseDefaultFlag=W.DEFAULT_OBJECT_NO_COLLAPSE,e.delPlayerFlag=!1,e.bgm=0,e.effectCoords=[],e.effectWaits=0,e.imgStatusEnergyX=W.IMGPOS_DEFAULT_STATUS_X+W.IMGRELPOS_ENERGY_ICON_X,e.imgStatusEnergyY=W.IMGPOS_DEFAULT_STATUS_Y,e.imgStatusStrengthX=W.IMGPOS_DEFAULT_STATUS_X+W.IMGRELPOS_STRENGTH_ICON_X,e.imgStatusStrengthY=W.IMGPOS_DEFAULT_STATUS_Y,e.imgStatusDefenceX=W.IMGPOS_DEFAULT_STATUS_X+W.IMGRELPOS_DEFENCE_ICON_X,e.imgStatusDefenceY=W.IMGPOS_DEFAULT_STATUS_Y,e.imgStatusGoldX=W.IMGPOS_DEFAULT_STATUS_X+W.IMGRELPOS_GOLD_ICON_X,e.imgStatusGoldY=W.IMGPOS_DEFAULT_STATUS_Y,e.imgWideCellX=W.IMGPOS_DEFAULT_WIDE_CELL_X,e.imgWideCellY=W.IMGPOS_DEFAULT_WIDE_CELL_Y,e.imgItemboxX=W.IMGPOS_DEFAULT_ITEMBOX_X,e.imgItemboxY=W.IMGPOS_DEFAULT_ITEMBOX_Y,e.imgFrameX=W.IMGPOS_DEFAULT_FRAME_X,e.imgFrameY=W.IMGPOS_DEFAULT_FRAME_Y,e.imgBattleEffectX=W.IMGPOS_DEFAULT_BATTLE_EFFECT_X,e.imgBattleEffectY=W.IMGPOS_DEFAULT_BATTLE_EFFECT_Y,e.imgClickX=0,e.imgClickY=0,e.frameColorR=W.DEFAULT_FRAME_COLOR_R,e.frameColorG=W.DEFAULT_FRAME_COLOR_G,e.frameColorB=W.DEFAULT_FRAME_COLOR_B,e.frameOutColorR=W.DEFAULT_FRAMEOUT_COLOR_R,e.frameOutColorG=W.DEFAULT_FRAMEOUT_COLOR_G,e.frameOutColorB=W.DEFAULT_FRAMEOUT_COLOR_B,e.fontColorR=W.DEFAULT_STR_COLOR_R,e.fontColorG=W.DEFAULT_STR_COLOR_G,e.fontColorB=W.DEFAULT_STR_COLOR_B,e.statusColorR=W.DEFAULT_STATUS_COLOR_R,e.statusColorG=W.DEFAULT_STATUS_COLOR_G,e.statusColorB=W.DEFAULT_STATUS_COLOR_B,e.moves=W.DEFAULT_MOVES,e.gameSpeedIndex=W.DEFAULT_SPEED_INDEX,e.permitChangeGameSpeed=!0,e.userVar=Array.from({length:W.USER_VAR_NUM}).map(()=>0),e.userNamedVar=new Map,e.playTime=0,e.isVisibleStatusEnergy=!0,e.isVisibleStatusStrength=!0,e.isVisibleStatusDefence=!0,e.isVisibleStatusGold=!0,e.gameOverPolicy=`default`,e.bgmDelayDurationMs=0,e.pictureRegistry=[],e.decisionSound=p.DECISION,e.attackSound=p.ATTACK,e}getMessageFromData(){let e=``,t=0;for(t=0;t<1500&&!(this.compressedMapData[this.currentPos+t*2]==0&&this.compressedMapData[this.currentPos+t*2+1]==0);t++)e+=String.fromCharCode((this.compressedMapData[this.currentPos+t*2+1]<<8)+this.compressedMapData[this.currentPos+t*2]);return this.currentPos+=t*2+2,e}},En=class{constructor(){}},Dn=class e extends En{constructor(e){super(),this.uri=e}static async fetch(e){try{return await fetch(e)}catch{throw Error(`マップデータ 「${e}」の読み込みに失敗しました。
|
|
24
24
|
通信環境の良いところで再度お試しください。
|
|
25
25
|
ローカルテストの場合は、ブラウザが対応していない可能性があります。`)}}static handleError(e,t){let n=`HTTPステータスコードは ${t.status} です。`;switch(t.status){case 200:case 304:return;case 403:throw Error(`マップデータ「${e}」を読み取る権限がないようです。
|
|
26
26
|
管理者の方へ: マップデータのパーミッションを確認してください。
|
|
@@ -28,7 +28,7 @@ var WWA=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`}
|
|
|
28
28
|
${n}`);default:throw Error(`マップデータ「${e}」の読み込みに失敗しました。
|
|
29
29
|
${n}`)}}async request(){let t=await e.fetch(this.uri);return e.handleError(this.uri,t),await t.arrayBuffer()}},On=s(((e,t)=>{t.exports={}})),kn=l(On()),An=class extends En{constructor(e){super(),this.fileName=e}async request(){return new Promise((e,t)=>{kn.default.readFile(this.fileName,(n,r)=>{n&&t(n),e(r.buffer)})})}},jn=e=>typeof window<`u`?new Dn(e):new An(e),Mn=class{constructor(e,t){this.fileName=e,this.eventEmitter=t}async requestAndLoadMapData(){let e=jn(this.fileName);try{let t=await e.request();if(!t){this.eventEmitter.dispatch(`error`,{name:`マップデータ取得に失敗しました`,message:`mapdata is empty`});return}let n=this.loadMapData(t);this.eventEmitter.dispatch(`mapData`,n)}catch(e){let t=e.name||``,n=e.message||``;this.eventEmitter.dispatch(`error`,{name:t,message:n})}}loadMapData(e){try{let t=new Uint8Array(e),{byteMapData:n,byteMapLength:r,compressedEndPosition:i}=wn(t);return new Tn(new xn(n,r,this.eventEmitter).extractAllData(),t,i,this.eventEmitter).load()}catch(e){throw e}}},Nn=class{constructor(){this._milisecondTimer=0,this._frameTimer=0,this._points=new Map}addPoint(e,t,n){if(!t&&!n)return;let r=Pn(t,n);switch(this._points.set(e,r),r.type){case`milisecond`:{let e=[...this._points.values()].filter(({type:e})=>e===`milisecond`).map(({value:e})=>e);this._milisecondLimit=Math.max(...e);break}case`frame`:{let e=[...this._points.values()].filter(({type:e})=>e===`frame`).map(({value:e})=>e);this._frameLimit=Math.max(...e)}}}enabled(){return this._points.size>0&&(this._milisecondTimer<this._milisecondLimit||this._frameTimer<this._frameLimit)}tick(e){!this.enabled()||this.isTimeOver()||(this._milisecondTimer+=e,this._frameTimer++)}isOver(e,t){if(this._points.has(e)){let t=this._points.get(e);switch(t.type){case`milisecond`:return this._milisecondTimer>=t.value;case`frame`:return this._frameTimer>=t.value;default:return!1}}return t}isNotOver(e,t){if(this._points.has(e)){let t=this._points.get(e);switch(t.type){case`milisecond`:return this._milisecondTimer<t.value;case`frame`:return this._frameTimer<t.value;default:return!1}}return t}isTimeOver(){return!1}get timeLimit(){return{milisecond:this._milisecondLimit,frame:this._frameLimit}}},Pn=(e,t)=>{if(e)return{value:e,type:`milisecond`};if(t)return{value:t,type:`frame`}},Fn=class{constructor(e,t){this.canvas=new OffscreenCanvas(un(e),dn(t)),this.ctx=this.canvas.getContext(`2d`,{alpha:!0}),this.ctx.imageSmoothingEnabled=!1}getCanvasImage(){return this.canvas}drawCanvas(e,t,n,r,i,a=R.CHIP_SIZE,o=R.CHIP_SIZE){this.ctx.drawImage(e,R.CHIP_SIZE*t,R.CHIP_SIZE*n,R.CHIP_SIZE,R.CHIP_SIZE,r,i,a,o)}drawCanvasFree(e,t,n,r,i){this.ctx.drawImage(e,t,n,r,i)}drawFont(e,t,n,r){r===void 0?this.ctx.fillText(e,t,n):e.split(`
|
|
30
30
|
`).forEach((e,i)=>{this.ctx.fillText(e,t,n+i*r)})}updateSize(e,t){this.canvas.width=un(e),this.canvas.height=dn(t),this.ctx.imageSmoothingEnabled=!1}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)}},In=(e,t,n)=>e===`maximum`?{width:R.MAP_WINDOW_WIDTH,height:R.MAP_WINDOW_HEIGHT}:e===`minimumWithMargin`?{width:t+R.CHIP_SIZE*2,height:n+R.CHIP_SIZE*2}:{width:t,height:n},Ln=(e,t,n)=>e===`maximum`?{x:t,y:n}:e===`minimumWithMargin`?{x:R.CHIP_SIZE,y:R.CHIP_SIZE}:{x:0,y:0},Rn=(e,t,n,r,i)=>e===`maximum`?{x:0,y:0,width:R.MAP_WINDOW_WIDTH,height:R.MAP_WINDOW_HEIGHT}:e===`minimumWithMargin`?{x:t-R.CHIP_SIZE,y:n-R.CHIP_SIZE,width:r*(R.CHIP_SIZE*2),height:i*(R.CHIP_SIZE*2)}:{x:t,y:n,width:r,height:i},zn=(e,t,n,r,i)=>e===`maximum`?{x:r,y:i}:e===`minimumWithMargin`?{x:R.CHIP_SIZE+t/2,y:R.CHIP_SIZE+n/2}:{x:t/2,y:n/2},Bn=class e{constructor(t,n,r){this._registry=n;let{properties:i}=n;this._posBaseX=i.pos?.[0]??0,this._posBaseY=i.pos?.[1]??0,[this._imgMainX,this._imgMainY]=e._getImgPosByPicture(this._registry,!0),[this._imgSubX,this._imgSubY]=e._getImgPosByPicture(this._registry,!1),this._mapCropCache=e._getMapImgPosArray(this._registry,t),this._drawChip=rn(this._imgMainX,this._imgMainY,this._imgSubX,this._imgSubY)||this._mapCropCache!==null,this._repeatX=i.repeat?.[0]??1,this._repeatY=i.repeat?.[1]??1,this._imgFile=r,this._cropX=this._imgFile?1:i.crop?.[0]??1,this._cropY=this._imgFile?1:i.crop?.[1]??1,this._sizeX=i.size?.[0]??(this._imgFile?this._imgFile.width:R.CHIP_SIZE),this._sizeY=i.size?.[1]??(this._imgFile?this._imgFile.height:R.CHIP_SIZE),this._circleRadiusX=i.circle?.[0]??0,this._circleRadiusY=i.circle?.[1]??this._circleRadiusX,this._circleAngle=i.circle?.[2]??0,this._fontStyle=e._getFontValue(i),this._textAlign=e._convertTextAlign(i.textAlign);let a=i.color?.[0]??0,o=i.color?.[1]??0,s=i.color?.[2]??0;this._fillStyle=`rgb(${a}, ${o}, ${s})`,this._moveX=i.move?.[0]??0,this._moveY=i.move?.[1]??0,this._accelX=i.accel?.[0]??0,this._accelY=i.accel?.[1]??0,this._zoomX=i.zoom?.[0]??0,this._zoomY=i.zoom?.[1]??0,this._zoomAccelX=i.zoomAccel?.[0]??0,this._zoomAccelY=i.zoomAccel?.[1]??0,this._anchor=i.anchor??7,this._circleSpeed=i.circle?.[3]??0,this._opacity=i.opacity??100,this._fade=i.fade??0,this._angleRadian=i.angle?i.angle*Math.PI/180:0,this._rotateRadian=i.rotate?i.rotate*Math.PI/180:0,i.text?((i.angle||i.rotate)&&console.warn(`レイヤー${this.layerNumber}番: テキストの描画と回転の併用は、現時点では非推奨です。今後動作が変わる可能性があるので、自己責任でお願いします。`),this._drawCoordType=`maximum`):i.angle||i.rotate?this._drawCoordType=`minimumWithMargin`:this._drawCoordType=`minimum`,this._updatePictureCache();let{width:c,height:l}=In(this._drawCoordType,this._totalWidth,this._totalHeight);if(this._canvas=new Fn(c,l),this._timer=new Nn,this._timer.addPoint(`start`,nn(i.time,1,!1),nn(i.timeFrame,1,!1)),this._timer.addPoint(`end`,nn(i.time,0,!0),nn(i.timeFrame,0,!0)),this._timer.addPoint(`startAnim`,i.animTime?.[0],i.animTimeFrame?.[0]),this._timer.addPoint(`endAnim`,i.animTime?.[1],i.animTimeFrame?.[1]),this._timer.addPoint(`wait`,i.wait,i.waitFrame),this._angleRadian!==0){let{x:e,y:t}=zn(this._drawCoordType,this._totalWidth,this._totalHeight,this._posBaseX,this._posBaseY);this._canvas.ctx.translate(e,t),this._canvas.ctx.rotate(this._angleRadian),this._canvas.ctx.translate(-e,-t)}this.updateCanvasContext(),this._hasAnimation=this.getHasAnimation()}get layerNumber(){return this._registry.layerNumber}get hasAnimation(){return this._hasAnimation}get canvasImage(){return this._canvas.getCanvasImage()}get appearParts(){if(!(!this._registry.properties.map||this._registry.properties.map.length<3))return{partsNumber:this._registry.properties.map[0],x:this._registry.properties.map[1],y:this._registry.properties.map[2],partsType:this._registry.properties.map[3]??vn.OBJECT}}get executeScriptFunctionName(){return this._registry.properties.script}updateCanvasContext(){this._canvas.ctx.globalAlpha=e._roundPercentage(this._opacity)/100,this._canvas.ctx.font=this._fontStyle,this._canvas.ctx.textBaseline=`top`,this._textAlign&&(this._canvas.ctx.textAlign=this._textAlign),this._canvas.ctx.fillStyle=this._fillStyle}draw(e,t){this.clearCanvas();let n=t?this._imgMainX:this._imgSubX,r=t?this._imgMainY:this._imgSubY,{x:i,y:a}=Ln(this._drawCoordType,this._posDestX,this._posDestY);for(let o=0;o<this._repeatY;o++)for(let s=0;s<this._repeatX;s++){let c=i+this._charaWidth*s,l=a+this._charaHeight*o;if(this._imgFile)this._canvas.drawCanvasFree(this._imgFile,c,l,this._charaWidth,this._charaHeight);else if(this._drawChip)if(this._mapCropCache!==null)this._mapCropCache.forEach((n,r)=>{n.forEach(([n,i,a,o],s)=>{rn(n,i,a,o)&&this._canvas.drawCanvas(e,t?n:a,t?i:o,c+this._chipWidth*s,l+this._chipHeight*r,this._chipWidth,this._chipHeight)})});else for(let t=0;t<this._cropY;t++)for(let i=0;i<this._cropX;i++)this._canvas.drawCanvas(e,n+i,r+t,c+this._chipWidth*i,l+this._chipHeight*t,this._chipWidth,this._chipHeight);this.getHasText()&&this._canvas.drawFont(this._registry.properties.text,c,l,this._registry.properties.lineHeight)}}getDrawPictureCoords(){return Rn(this._drawCoordType,this._posDestX,this._posDestY,this._totalWidth,this._totalHeight)}updateAnimation(){if(this._timer.isNotOver(`startAnim`,!1)||this._timer.isOver(`endAnim`,!1))return;this._posBaseX+=this._moveX,this._posBaseY+=this._moveY,this._moveX+=this._accelX,this._moveY+=this._accelY,this._sizeX+=this._zoomX,this._sizeY+=this._zoomY,this._zoomX+=this._zoomAccelX,this._zoomY+=this._zoomAccelY,this._updatePictureCache();let{width:e,height:t}=In(this._drawCoordType,this._totalWidth,this._totalHeight);if(this._canvas.updateSize(e,t),this._circleAngle+=this._circleSpeed,this._fade!==0&&(this._opacity+=this._fade),this._angleRadian!==0||this._rotateRadian!==0){this._angleRadian+=this._rotateRadian;let{x:e,y:t}=zn(this._drawCoordType,this._totalWidth,this._totalHeight,this._posBaseX,this._posBaseY);this._canvas.ctx.translate(e,t),this._canvas.ctx.rotate(this._angleRadian),this._canvas.ctx.translate(-e,-t)}this.updateCanvasContext()}_updatePictureCache(){this._chipWidth=an(this._sizeX),this._chipHeight=an(this._sizeY),this._charaWidth=this._chipWidth*this._cropX,this._charaHeight=this._chipHeight*this._cropY,this._totalWidth=this._charaWidth*this._repeatX,this._totalHeight=this._charaHeight*this._repeatY,this._posDestX=Math.floor(on(sn(this._posBaseX,this._circleRadiusX,this._circleAngle),this._charaWidth,this._anchor)),this._posDestY=Math.floor(cn(ln(this._posBaseY,this._circleRadiusY,this._circleAngle),this._charaHeight,this._anchor))}isNotStarted(){return this._timer.isNotOver(`start`,!1)}tickTime(e){this._timer.tick(e)}isDeadlineOver(){return this._timer.isOver(`end`,!1)}isStartTimeOver(){return this._timer.isOver(`start`,!0)}isWaiting(){return this._timer.isNotOver(`wait`,!1)}clearCanvas(){this._canvas.clear()}getRegistryData(){return this._registry}getNextPicturePartsInfo(){let e=Array.isArray(this._registry.properties.next)&&this._registry.properties.next[0]?{layerNumber:this._registry.layerNumber,partsNumber:this._registry.properties.next[0],partsType:this._registry.properties.next[1]??vn.OBJECT,connectProperties:!!this._registry.properties.next[2]}:void 0,t=Array.isArray(this._registry.properties.create)?this._registry.properties.create.filter(Array.isArray).map(e=>({layerNumber:e[0],partsNumber:e[1],partsType:e[2]??vn.OBJECT,connectProperties:!!e[3]})):[];return e?t.concat(e):t}getNextPictureProperties(){let e={...this._registry.properties};return delete e.next,delete e.create,{...e,pos:[this._posBaseX,this._posBaseY],move:[this._moveX,this._moveY],size:[this._sizeX,this._sizeY],zoom:[this._zoomX,this._zoomY],circle:[this._circleRadiusX,this._circleRadiusY,this._circleAngle,this._circleSpeed],opacity:this._opacity}}getTriggerPartsCoord(){return new S(this._registry.triggerPartsX,this._registry.triggerPartsY)}getHasAnimation(){return this._moveX!==0||this._moveY!==0||this._accelX!==0||this._accelY!==0||this._zoomX!==0||this._zoomY!==0||this._zoomAccelX!==0||this._zoomAccelY!==0||this._circleSpeed!==0||this._fade!==0||this._rotateRadian!==0}getHasText(){return this._registry.properties.text}static _getImgPosByPicture(e,t){let{properties:n}=e;return n.imgMap?.[0]!==void 0&&n.imgMap?.[1]!==void 0?[0,0]:n.img?.[0]!==void 0&&n.img?.[1]!==void 0?t?[n.img[0],n.img[1]]:n.img[2]!==void 0&&n.img[3]!==void 0?[n.img[2],n.img[3]]:[n.img[0],n.img[1]]:t||e.imgPosX2===0&&e.imgPosY2===0?[e.imgPosX,e.imgPosY]:[e.imgPosX2,e.imgPosY2]}static _getMapImgPosArray(e,t){let{properties:n}=e,r=n.imgMap?.[0]??-1,i=n.imgMap?.[1]??-1;if(r<0||i<0)return null;let a=n.crop?.[0]??1,o=n.crop?.[1]??1,s=n.imgMap?.[2]!==void 0&&n.imgMap[2]>=1?vn.MAP:vn.OBJECT,c=[];for(let e=0;e<o;e++){let n=[];for(let o=0;o<a;o++){let a=t.getPartsID(new S(r+o,i+e),s);if(a===0)n.push([0,0,0,0]);else{let e=s===vn.MAP?t.getMapInfo(a):t.getObjectInfo(a);s===vn.MAP||e[R.ATR_X2]===0&&e[R.ATR_Y2]===0?n.push([e[R.ATR_X]/R.CHIP_SIZE,e[R.ATR_Y]/R.CHIP_SIZE,e[R.ATR_X]/R.CHIP_SIZE,e[R.ATR_Y]/R.CHIP_SIZE]):n.push([e[R.ATR_X]/R.CHIP_SIZE,e[R.ATR_Y]/R.CHIP_SIZE,e[R.ATR_X2]/R.CHIP_SIZE,e[R.ATR_Y2]/R.CHIP_SIZE])}}c.push(n)}return c}static _getFontValue(e){if(e.font)return e.font;let t=getComputedStyle(U(`wwa-wrapper`));return e.fontSize===void 0&&e.fontFamily===void 0&&e.italic===void 0&&e.bold===void 0?t.font:`${e.italic?`italic`:``} ${e.bold?`bold`:``} ${e.fontSize?`${e.fontSize}px`:t.fontSize} ${e.fontFamily&&e.fontFamily.length>0?e.fontFamily:t.fontFamily}`}static _convertTextAlign(e){return e?[`center`,`end`,`left`,`right`,`start`].includes(e)?e:(console.warn(`textAlign プロパティで不正な値が検出されました。: ${e}`),null):null}static _roundPercentage(e){return e<0?0:e>100?100:e}},Vn=async e=>fetch(e).then(t=>t.status===200||t.status===304?{kind:`data`,data:t}:{kind:`httpError`,errorMessage:`ファイル ${e} が読み込めませんでした。ステータスコード: ${t.status}`}).catch(t=>({kind:`connectionError`,errorMessage:`ファイル ${e} が読み込めませんでした。通信状態がいい場所で再度お試しください。`})).then(async e=>e.kind===`data`?{kind:`data`,data:await e.data.json()}:e).catch(t=>({kind:`brokenJson`,errorMessage:`ファイル ${e} が壊れています。`})),Hn=class e{constructor(t,n){this._wwa=t,this._pictures=new Map,this._anonymousPictures=[],this._externalImageFiles=new Map,this._frameTimerValue=e._getNowFrameValue(),this._setupExternalImageFiles(n)}async _setupExternalImageFiles(e){if(!e)return;let t=await Vn(e);if(t){if(t.kind!==`data`){console.warn(`ピクチャ画像の定義ファイル ${e} が見つかりませんでした。エラーメッセージ: ${t.errorMessage}`);return}if(!t.data||typeof t.data!=`object`){console.warn(`ピクチャ画像の定義ファイル ${e} が正しい形式で書かれていません。`);return}if(`files`in t.data){let{files:n}=t.data;typeof n==`object`?Object.entries(t.data.files).forEach(([e,t])=>{this._externalImageFiles.set(e,{status:`loading`});let n=new Image;n.src=t,n.onerror=n=>{console.warn(typeof n==`string`?`ピクチャ画像ファイル ${t} が見つかりませんでした。エラーメッセージ: ${n}`:`ピクチャ画像ファイル ${t} が見つかりませんでした。`),this._externalImageFiles.set(e,{status:`failed`})},n.onload=()=>{this._externalImageFiles.set(e,{status:`success`,element:n})}}):console.warn(`ピクチャ画像の定義ファイル ${e} の files が正しい形式で書かれていません。`)}}}static _getNowFrameValue(){return performance.now()}registerPicture(e){let t=Object.keys(e.properties).filter(e=>!Ye.some(({name:t})=>t===e));if(t.length>0)throw Error(`不明なプロパティ名 ${t.map(e=>`"${e}"`).join(`, `)} が検出されました。`);let n;if(e.properties.imgFile){let t=this._externalImageFiles.get(e.properties.imgFile);t?t.status===`loading`?console.warn(`ピクチャ画像ファイル ${e.properties.imgFile} はまだ読み込みを完了していません。`):t.status===`failed`?console.warn(`ピクチャ画像ファイル ${e.properties.imgFile} を表示することができません。画像ファイルの Path が間違っていないかご確認ください。`):n=t.element:console.warn(`ピクチャ画像ファイル ${e.properties.imgFile} が定義に含まれていません。定義ファイルがあるかご確認ください。`)}let r=e.properties.sound??e.soundNumber;if(r&&this._wwa.playSound(r),Qt(e.layerNumber))$t(e.layerNumber)?this._anonymousPictures.push(new Bn(this._wwa,e,n)):(this._pictures.set(e.layerNumber,new Bn(this._wwa,e,n)),this._pictures=new Map([...this._pictures.entries()].sort(([,e],[,t])=>e.layerNumber-t.layerNumber)));else throw Error(`指定したレイヤー番号 ${e.layerNumber}番はこのバージョンでは無効です!`)}registerPictureFromRawRegistry(e,t,n,r){return this.registerPicture(tn(r?{...e,properties:{...r,...e.properties}}:e,this._wwa.generateTokenValues({id:t,type:n,position:new S(e.triggerPartsX,e.triggerPartsY)}))),this.getPictureRegistryData()}registerPictureFromRawText(e,t){let n=Yt({imgPosX:0,imgPosY:0,imgPosX2:0,imgPosY2:0,layerNumber:e,triggerPartsX:0,triggerPartsY:0,soundNumber:0,propertiesText:t});return this.registerPicture(en(n)),this.getPictureRegistryData()}registerPictureFromObject(e,t){return this.registerPicture(en({imgPosX:0,imgPosY:0,imgPosX2:0,imgPosY2:0,layerNumber:e,triggerPartsX:0,triggerPartsY:0,soundNumber:0,properties:t})),this.getPictureRegistryData()}deletePicture(e){return $t(e)?(this._anonymousPictures.forEach(e=>{e.clearCanvas()}),this._anonymousPictures.splice(0),this.getPictureRegistryData()):(this._pictures.has(e)&&(this._pictures.get(e).clearCanvas(),this._pictures.delete(e)),this.getPictureRegistryData())}clearAllPictures(){this._pictures.forEach(e=>{e.clearCanvas()}),this._anonymousPictures.forEach(e=>{e.clearCanvas()}),this._pictures.clear(),this._anonymousPictures.splice(0)}forEachPictures(e){this._anonymousPictures.forEach(e),this._pictures.forEach(e)}updateAllPicturesCache(e,t){this.forEachPictures(n=>{n.isNotStarted()||n.draw(e,t)})}updateFrameTimerValue(){this._frameTimerValue=e._getNowFrameValue()}updatePicturesAnimation(t,n){let r=e._getNowFrameValue()-this._frameTimerValue;this.forEachPictures(e=>{if(e.tickTime(r),!e.isNotStarted()){if(e.isDeadlineOver()){let t=e.layerNumber,n=e.getNextPicturePartsInfo(),r=e.appearParts,i=e.executeScriptFunctionName,a=e.getNextPictureProperties(),o=e.getTriggerPartsCoord();this._wwa.deletePictureRegistry(t);for(let e of n)this._wwa.setPictureRegistry(e.layerNumber,e.partsNumber,e.partsType,o,e.connectProperties?a:void 0);r!==void 0&&this._wwa.setPartsOnPosition(r.partsType,r.partsNumber,new S(r.x,r.y)),i&&this._wwa.callUserScript(i);return}e.hasAnimation&&(e.updateAnimation(),e.draw(t,n))}})}isWaiting(){for(let e of this._pictures.values())if(e.isWaiting())return!0;for(let e of this._anonymousPictures)if(e.isWaiting())return!0;return!1}getPictureRegistryData(){return Array.from(this._pictures.values()).map(e=>e.getRegistryData())}},Un=class{constructor(e,t,n){this.cvs=document.createElement(`canvas`),this.cvs.width=e,this.cvs.height=t,this.ctx=this.cvs.getContext(`2d`,{alpha:n}),this._isTransparent=n}drawCanvas(e,t,n,r,i,a=R.CHIP_SIZE,o=R.CHIP_SIZE){this.ctx.drawImage(e,R.CHIP_SIZE*t,R.CHIP_SIZE*n,R.CHIP_SIZE,R.CHIP_SIZE,r,i,a,o)}clear(){this.clearRect(0,0,this.cvs.width,this.cvs.height)}clearRectWithLowerYLimit(e){this.clearRect(0,0,this.cvs.width,e)}clearRect(e,t,n,r){this._isTransparent?this.ctx.clearRect(e,t,n,r):(this.ctx.fillStyle=`#9E9E9E`,this.ctx.fillRect(e,t,n,r))}},Wn=class{_load(){this._frameCoord,!this._isLoaded&&(this.mapCache=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],this.mapObjectCache=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],this._image=new Image,this._image.addEventListener(`load`,()=>{this.createFrame(),this._loadCompleteCallBack()}),this._image.addEventListener(`error`,()=>{throw Error(`Image Load Failed!!
|
|
31
|
-
file name:`+this._fileName)}),this._image.src=this._fileName,this._isLoaded=!0)}createFrame(){this._frameCanvas.clear(),this._frameCanvas.drawCanvas(this._image,this._frameCoord.x,this._frameCoord.y,0,0),this._frameCanvas.drawCanvas(this._image,this._frameCoord.x+2,this._frameCoord.y,R.MAP_WINDOW_WIDTH-R.CHIP_SIZE,0),this._frameCanvas.drawCanvas(this._image,this._frameCoord.x,this._frameCoord.y+2,0,R.MAP_WINDOW_HEIGHT-R.CHIP_SIZE),this._frameCanvas.drawCanvas(this._image,this._frameCoord.x+2,this._frameCoord.y+2,R.MAP_WINDOW_WIDTH-R.CHIP_SIZE,R.MAP_WINDOW_HEIGHT-R.CHIP_SIZE);for(var e=1;e<R.H_PARTS_NUM_IN_WINDOW-1;e++)this._frameCanvas.drawCanvas(this._image,this._frameCoord.x+1,this._frameCoord.y,R.CHIP_SIZE*e,0),this._frameCanvas.drawCanvas(this._image,this._frameCoord.x+1,this._frameCoord.y+2,R.CHIP_SIZE*e,R.MAP_WINDOW_HEIGHT-R.CHIP_SIZE);for(var e=1;e<R.V_PARTS_NUM_IN_WINDOW-1;e++)this._frameCanvas.drawCanvas(this._image,this._frameCoord.x,this._frameCoord.y+1,0,R.CHIP_SIZE*e),this._frameCanvas.drawCanvas(this._image,this._frameCoord.x+2,this._frameCoord.y+1,R.MAP_WINDOW_WIDTH-R.CHIP_SIZE,R.CHIP_SIZE*e)}updateEffects(e){var t;if(e){var n=e.length,r;for(t=0;t<n;t++){var i=e[t];r=this._effectCanvases[t],r?r.clear():r=this._effectCanvases[t]=new Un(R.CHIP_SIZE*R.V_PARTS_NUM_IN_WINDOW,R.CHIP_SIZE*R.H_PARTS_NUM_IN_WINDOW,!0);for(var a=0;a<R.V_PARTS_NUM_IN_WINDOW;a++)for(var o=0;o<R.H_PARTS_NUM_IN_WINDOW;o++)r.drawCanvas(this._image,i.x,i.y,o*R.CHIP_SIZE,a*R.CHIP_SIZE)}}}restorePictures(e){this.picture.clearAllPictures(),e.forEach(e=>{this.picture.registerPicture(e)})}updateAllPicturesCache(e=!0){this.picture.updateAllPicturesCache(this._image,e)}updatePicturesAnimation(e=!0){this.picture.updatePicturesAnimation(this._image,e)}drawFrame(){this._ctx.drawImage(this._frameCanvas.cvs,0,0,R.CHIP_SIZE*R.V_PARTS_NUM_IN_WINDOW,R.CHIP_SIZE,0,0,R.CHIP_SIZE*R.V_PARTS_NUM_IN_WINDOW,R.CHIP_SIZE),this._ctx.drawImage(this._frameCanvas.cvs,0,R.CHIP_SIZE*(R.H_PARTS_NUM_IN_WINDOW-1),R.CHIP_SIZE*R.V_PARTS_NUM_IN_WINDOW,R.CHIP_SIZE,0,R.CHIP_SIZE*(R.H_PARTS_NUM_IN_WINDOW-1),R.CHIP_SIZE*R.V_PARTS_NUM_IN_WINDOW,R.CHIP_SIZE),this._ctx.drawImage(this._frameCanvas.cvs,0,R.CHIP_SIZE,R.CHIP_SIZE,R.CHIP_SIZE*(R.H_PARTS_NUM_IN_WINDOW-2),0,R.CHIP_SIZE,R.CHIP_SIZE,R.CHIP_SIZE*(R.H_PARTS_NUM_IN_WINDOW-2)),this._ctx.drawImage(this._frameCanvas.cvs,R.CHIP_SIZE*(R.H_PARTS_NUM_IN_WINDOW-1),R.CHIP_SIZE,R.CHIP_SIZE,R.CHIP_SIZE*(R.H_PARTS_NUM_IN_WINDOW-2),R.CHIP_SIZE*(R.H_PARTS_NUM_IN_WINDOW-1),R.CHIP_SIZE,R.CHIP_SIZE,R.CHIP_SIZE*(R.H_PARTS_NUM_IN_WINDOW-2))}drawEffect(e){var t=this._effectCanvases[e];t&&this._ctx.drawImage(t.cvs,0,0,R.CHIP_SIZE*R.V_PARTS_NUM_IN_WINDOW,R.CHIP_SIZE*R.H_PARTS_NUM_IN_WINDOW,0,0,R.CHIP_SIZE*R.V_PARTS_NUM_IN_WINDOW,R.CHIP_SIZE*R.H_PARTS_NUM_IN_WINDOW)}drawPictures(){this.picture.forEachPictures(e=>{let{x:t,y:n,width:r,height:i}=e.getDrawPictureCoords();this._ctx.drawImage(e.canvasImage,0,0,r,i,t,n,r,i)})}drawCanvas(e,t,n,r){if(!this._isLoaded)throw Error(`No image was loaded.`);this._ctx.drawImage(this._image,R.CHIP_SIZE*e,R.CHIP_SIZE*t,R.CHIP_SIZE,R.CHIP_SIZE,n,r,R.CHIP_SIZE,R.CHIP_SIZE)}drawCanvasWithSize(e,t,n,r,i,a){if(!this._isLoaded)throw Error(`No image was loaded.`);this._ctx.drawImage(this._image,R.CHIP_SIZE*e,R.CHIP_SIZE*t,R.CHIP_SIZE*n,R.CHIP_SIZE*r,i,a,R.CHIP_SIZE*n,R.CHIP_SIZE*r)}drawCanvasWithUpperYLimit(e,t,n,r,i){if(!this._isLoaded)throw Error(`No image was loaded.`);var a=Math.max(0,r+R.CHIP_SIZE-i);a>=R.CHIP_SIZE||this._ctx.drawImage(this._image,R.CHIP_SIZE*e,R.CHIP_SIZE*t,R.CHIP_SIZE,R.CHIP_SIZE-a,n,r,R.CHIP_SIZE,R.CHIP_SIZE)}copyCanvas(e,t){return(n,r,i,a,o)=>{if(!this._isLoaded)throw Error(`No image was loaded.`);let s=Math.max(0,t(a,o));s>=R.CHIP_SIZE||e.ctx.drawImage(this._image,R.CHIP_SIZE*n,R.CHIP_SIZE*r+s,R.CHIP_SIZE,R.CHIP_SIZE-s,i,a+s,R.CHIP_SIZE,R.CHIP_SIZE)}}copyBackCanvasWithUpperYLimit(e,t,n,r,i){this.copyCanvas(this._backCanvas,(e,t)=>e+R.CHIP_SIZE-t)(e,t,n,r,i)}copyBackCanvasWithLowerYLimit(e,t,n,r,i){this.copyCanvas(this._backCanvas,(e,t)=>t-e)(e,t,n,r,i)}copyObjectCanvasWithUpperYLimit(e,t,n,r,i,a){this.copyCanvas(this._objectCanvases[e],(e,t)=>e+R.CHIP_SIZE-t)(t,n,r,i,a)}copyObjectCanvasWithLowerYLimit(e,t,n,r,i,a){this.copyCanvas(this._objectCanvases[e],(e,t)=>t-e)(t,n,r,i,a)}drawBackCanvas(){if(!this._isLoaded)throw Error(`No image was loaded.`);this._ctx.drawImage(this._backCanvas.cvs,0,0,R.CHIP_SIZE*R.V_PARTS_NUM_IN_WINDOW,R.CHIP_SIZE*R.H_PARTS_NUM_IN_WINDOW,0,0,R.CHIP_SIZE*R.V_PARTS_NUM_IN_WINDOW,R.CHIP_SIZE*R.H_PARTS_NUM_IN_WINDOW)}drawObjectCanvas(e){if(!this._isLoaded)throw Error(`No image was loaded.`);this._ctx.drawImage(this._objectCanvases[e].cvs,0,0,R.CHIP_SIZE*R.V_PARTS_NUM_IN_WINDOW,R.CHIP_SIZE*R.H_PARTS_NUM_IN_WINDOW,0,0,R.CHIP_SIZE*R.V_PARTS_NUM_IN_WINDOW,R.CHIP_SIZE*R.H_PARTS_NUM_IN_WINDOW)}clearBackCanvas(){this._backCanvas.clear()}clearBackCanvasWithLowerYLimit(e){this._backCanvas.clearRectWithLowerYLimit(e)}clearObjectCanvases(){var e;for(e=0;e<2;e++)this._objectCanvases[e].clear()}clearObjectCanvasesWithLowerYLimit(e){var t;for(t=0;t<2;t++)this._objectCanvases[t].clearRectWithLowerYLimit(e)}drawCanvasWithLowerYLimit(e,t,n,r,i){if(!this._isLoaded)throw Error(`No image was loaded.`);var a=Math.max(0,i-r);a>=R.CHIP_SIZE||this._ctx.drawImage(this._image,R.CHIP_SIZE*e,R.CHIP_SIZE*t+a,R.CHIP_SIZE,R.CHIP_SIZE-a,n,r+a,R.CHIP_SIZE,R.CHIP_SIZE)}clearCanvas(e,t,n,r){this._ctx.clearRect(e,t,n,r)}drawBase(e,t,n,r){this._ctx.fillStyle=`#9E9E9E`,this._ctx.fillRect(e,t,n,r)}setFrameImage(e){this._frameCoord=e,this.createFrame()}constructor(e,t,n,r,i,a){this._isLoaded=!1,this.mapCache=void 0,this.mapObjectCache=void 0,this.mapCacheYLimit=0,this._frameCanvas=new Un(R.CHIP_SIZE*R.V_PARTS_NUM_IN_WINDOW,R.CHIP_SIZE*R.H_PARTS_NUM_IN_WINDOW,!0),this._backCanvas=new Un(R.CHIP_SIZE*R.V_PARTS_NUM_IN_WINDOW,R.CHIP_SIZE*R.H_PARTS_NUM_IN_WINDOW,!1),this._objectCanvases=[],this._effectCanvases=[],this.picture=new Hn(r,i);var o;for(o=0;o<2;o++)this._objectCanvases[o]=new Un(R.CHIP_SIZE*R.V_PARTS_NUM_IN_WINDOW,R.CHIP_SIZE*R.H_PARTS_NUM_IN_WINDOW,!0);this._ctx=e,this._fileName=t,this._loadCompleteCallBack=a,this._load(),this._frameCoord=n.clone(),this.cpPartsLog=new S(0,0)}},Gn=class{constructor(e){this._position=null,this.reset(e)}setPlayer(e){this._player=e}isResetting(){return this._isResetting}getPosition(){return this._position}getPreviousPosition(){return this._positionPrev}resetPreviousPosition(){this._positionPrev=null}move(e){var t=de[this._player.getSpeedIndex()];this._position=this._position.getNextFramePosition(e,t*(R.H_PARTS_NUM_IN_WINDOW-1),t*(R.V_PARTS_NUM_IN_WINDOW-1))}getTransitionStepNum(){return this._transitionStep}advanceTransitionStepNum(){return++this._transitionStep,this._transitionStep===R.V_PARTS_NUM_IN_WINDOW&&(this._isResetting=!1,this._transitionStep=0),this._transitionStep}isFinalStep(){if(this._isResetting===!1)throw Error(`リセット中ではありません。`);return this._transitionStep===R.V_PARTS_NUM_IN_WINDOW-1}reset(e){this._positionPrev=this._position,this._position=e.getDefaultCameraPosition(),this._transitionStep=0,this._isResetting=!0}},Kn=class{getPosition(){return this._position}constructor(e){this._position=e}},qn=class extends Kn{constructor(e){super(e)}},Jn=class extends qn{move(){if(this.isControllable()){this.controll(this._dir);return}if(this._state===2){try{this._camera.move(this._dir)}catch{}this._isOnCameraStopPosition()&&(this._state=0,this._wwa.callCameraMoveUserDefineFunction())}else if(this._state===1){try{var e=this._position.getNextFramePosition(this._dir,de[this._speedIndex],de[this._speedIndex])}catch{}if(e.isJustPosition()){this._state=0,this.toggleMovingImage(),this._moves++,this._isPartsEventExecuted=!1,this._samePosLastExecutedMapID=void 0,this._samePosLastExecutedObjID=void 0;let{isGameOver:e}=this._wwa.callMoveUserDefineFunction();if(e)return}this._position=e}}controll(e){var t,n;if(this.isControllable()){this._isPreparedForLookingAround=!1,this._dir=e;try{t=this._position.getNextFramePosition(this._dir,de[this._speedIndex],de[this._speedIndex]),n=this._position.getNextJustPosition(e)}catch{return}if(this._isOnCameraMovingPosition()){if(this._wwa.getMapIdByPosition(n)!==0||this._wwa.isOldMap()||this._wwa.debug)try{this._camera.move(this._dir),this._state=2}catch{this._state=0}return}if(!this.canMoveTo(n)){this._wwa.getMapTypeByPosition(n)===R.MAP_WALL&&this._wwa.checkMap(n.getPartsCoord()),this._wwa.checkObject(n.getPartsCoord());return}this._position=t,this._state=1,this._wwa.getMapAttributeByPosition(this._position.getNextJustPosition(e),R.ATR_TYPE)!==R.MAP_LOCALGATE&&this._wwa.moveObjects(!0)}}setDir(e){this._isPreparedForLookingAround=!1,this._dir=e}canMoveTo(e){return e===null?!1:this._wwa.debug?!0:(this._wwa.getMapWidth(),e.getPartsCoord(),e.getOffsetCoord(),this._wwa.getMapIdByPosition(e)===0&&!this._wwa.isOldMap()||this._wwa.getMapTypeByPosition(e)===R.MAP_WALL?!1:this._wwa.getObjectIdByPosition(e)===0||this._wwa.getObjectTypeByPosition(e)===R.OBJECT_NORMAL&&this._wwa.getObjectAttributeByPosition(e,R.ATR_MODE)===R.PASSABLE_OBJECT?!0:this._wwa.getObjectTypeByPosition(e)===R.OBJECT_DOOR&&this._wwa.getObjectAttributeByPosition(e,R.ATR_NUMBER)===R.PASSABLE_OBJECT?!this.hasItem(this._wwa.getObjectAttributeByPosition(e,R.ATR_ITEM)):!1)}isMoving(){return this._state==1||this._state==2}_isOnCameraMovingPosition(){var e=this._camera.getPosition().getPartsCoord(),t=this.getPosition().getPartsCoord();return t.x-e.x===R.H_PARTS_NUM_IN_WINDOW-1&&this._dir===E.RIGHT||t.x===e.x&&this._dir===E.LEFT||t.y-e.y===R.V_PARTS_NUM_IN_WINDOW-1&&this._dir===E.DOWN||t.y===e.y&&this._dir===E.UP}_isOnCameraStopPosition(){var e=this._camera.getPosition().getPartsCoord(),t=this.getPosition().getPartsCoord();return t.x-e.x===R.H_PARTS_NUM_IN_WINDOW-1&&this._dir===E.LEFT||t.x===e.x&&this._dir===E.RIGHT||t.y-e.y===R.V_PARTS_NUM_IN_WINDOW-1&&this._dir===E.UP||t.y===e.y&&this._dir===E.DOWN}isControllable(){var e=this._afterMoveMacroFlag;return this._afterMoveMacroFlag=!1,this._state===0&&!this._partsAppeared&&(this._wwa.getMapTypeByPosition(this._position)!==R.MAP_LOCALGATE&&this._wwa.getMapTypeByPosition(this._position)!==R.MAP_URLGATE||!this._wwa.isPrevFrameEventExecuted())&&this._moveMacroWaitingRemainMoves===0&&this._moveObjectAutoExecTimer===0&&!e&&this._wwa.canInput()}getCopyOfItemBox(){return this._itemBox.slice()}getDir(){return this._dir}isMovingImage(){return this._isMovingImage}toggleMovingImage(){this._isMovingImage?this._isMovingImage=!1:this._isMovingImage=!0}getEnergyMax(){return this._energyMax}isJumped(){return this._state===5||this._state===9}setMessageWaiting(){this._state===4&&console.warn(`メッセージが表示されるため、マニュアルポーズが無効になりました。`),this._state=3}setManualPause(e,t=!1){this.isControllable()&&(this._state=4,this._manualPauseInformation=e)}isWaitingMessageOrManualPause(){return[3,4].includes(this._state)}isWaitingMessage(){return this._state===3}isManualPause(){return this._state===4}getManualPauseInformation(){return this._manualPauseInformation}isDelayFrame(){return this._messageDelayFrameCount>0}updateDelayFrame(){this._messageDelayFrameCount--}setDelayFrame(){this._messageDelayFrameCount=1}clearWaitingMessageOrManualPause(){this._state===4&&(this._manualPauseInformation=void 0);let e=this.isWaitingMessageOrManualPause();!e&&this._state!==9||(e?this._state=0:this._state===9&&(this._state=5),this._isPartsEventExecuted=!0,this._isPreparedForLookingAround&&(this._lookingAroundTimer=R.PLAYER_LOOKING_AROUND_START_FRAME))}setEstimateWindowWating(){this._state=7}isWaitingEstimateWindow(){return this._state===7}clearEstimateWindowWaiting(){this._state===7&&(this._state=0)}setPasswordWindowWating(){this._state=8}isWaitingPasswordWindow(){return this._state===8}clearPasswordWindowWaiting(){this._state===8&&(this._state=0)}isPartsEventExecuted(){return this._isPartsEventExecuted}resetEventExecutionInfo(){this._isPartsEventExecuted=!1}getLastExecPartsIDOnSamePosition(e){return e===j.MAP?this._samePosLastExecutedMapID:this._samePosLastExecutedObjID}setLastExecInfoOnSamePosition(e,t){e===j.MAP?this._samePosLastExecutedMapID=t:this._samePosLastExecutedObjID=t}processAfterJump(){this._state!==5&&this._state!==9||--this._jumpWaitFramesRemain===0&&(this._state=this._state===5?0:3)}jumpTo(e,t=E.NO_DIRECTION){var n=this._camera.getPosition();return this.getPosition(),this._position.equals(e)?!1:(this._position=e,e.isInCameraRange(this._camera,!0)||this._camera.reset(e),this._state=this._state===3?9:5,this._jumpWaitFramesRemain=R.LOCALGATE_PLAYER_WAIT_FRAME,this._samePosLastExecutedMapID=void 0,this._samePosLastExecutedObjID=void 0,t===E.NO_DIRECTION?e.hasLocalGate()?this._dir=E.DOWN:e.getPartsCoord().y<=this._wwa.getMapWidth()-2&&e.getNextJustPosition(E.DOWN).hasLocalGate()?this._dir=E.UP:e.getPartsCoord().y>=1&&e.getNextJustPosition(E.UP).hasLocalGate()?this._dir=E.DOWN:e.getPartsCoord().x<=this._wwa.getMapWidth()-2&&e.getNextJustPosition(E.RIGHT).hasLocalGate()?this._dir=E.LEFT:e.getPartsCoord().x>=1&&e.getNextJustPosition(E.LEFT).hasLocalGate()?this._dir=E.RIGHT:this._dir=E.DOWN:this._dir=t,this._camera.getPosition().equals(n)||(this._isPreparedForLookingAround=!0,this._lookingAroundTimer=R.PLAYER_LOOKING_AROUND_START_FRAME),this._wwa.callJumpGateUserDefineFunction(),!0)}systemJumpTo(e){this._position=e,this._camera.reset(e),this._camera.resetPreviousPosition(),this._state=5,this._jumpWaitFramesRemain=R.LOCALGATE_PLAYER_WAIT_FRAME,this._samePosLastExecutedMapID=void 0,this._samePosLastExecutedObjID=void 0,this._dir=E.DOWN,this._isPreparedForLookingAround=!0,this._lookingAroundTimer=R.PLAYER_LOOKING_AROUND_START_FRAME}addStatusAll(e){return this._status.add(e),this.isDead()&&(this._status.energy=0),this._energyMax!==0&&(this._status.energy=Math.min(this._status.energy,this._energyMax)),this.updateStatusValueBox(),this._status}setEnergyMax(e){return this._energyMax=e,e!==0&&(this._status.energy=Math.min(this._status.energy,this._energyMax)),this.updateStatusValueBox(),e}setEnergy(e){return this._status.energy=e,this.isDead()&&(this._status.energy=0),this._energyMax!==0&&(this._status.energy=Math.min(this._status.energy,this._energyMax)),this.updateStatusValueBox(),e}damage(e){this._status.energy=Math.max(0,this._status.energy-e),this.isDead()&&(this._status.energy=0),this._energyMax!==0&&(this._status.energy=Math.min(this._status.energy,this._energyMax)),this.updateStatusValueBox()}setStrength(e){return this._status.strength=e,this.updateStatusValueBox(),e}setDefence(e){return this._status.defence=e,this.updateStatusValueBox(),e}setGold(e){return this._status.gold=e,this.updateStatusValueBox(),e}getStatus(){return this._status.plus(this._equipStatus)}getStatusWithoutEquipments(){return this._status.plus(new b(0,0))}getStatusOfEquipments(){return this._equipStatus.plus(new b(0,0))}updateStatusValueBox(){let e=this._status.plus(this._equipStatus);this._energyValueElement.textContent=this._wwa.isVisibleStatus(`energy`)?String(e.energy):``,this._strengthValueElement.textContent=this._wwa.isVisibleStatus(`strength`)?String(e.strength):``,this._defenceValueElement.textContent=this._wwa.isVisibleStatus(`defence`)?String(e.defence):``,this._goldValueElement.textContent=this._wwa.isVisibleStatus(`gold`)?String(e.gold):``,this._wwa._messageWindow?.update(),this._wwa.updateScore()}updateItemBox(e){for(let t=0;t<this._itemBoxElement.length;t++){let n=this._itemBoxElement[t],r=Le(`#item`+t);if(this._itemBox[t]===0){n.style.backgroundPosition=`-40px 0px`,this.disposeItemEffect(t,this._itemBoxElement[t],r);continue}let i=this._wwa.getObjectCropXById(this._itemBox[t]),a=this._wwa.getObjectCropYById(this._itemBox[t]);if(!e||t!==e.insertPos-1){n.style.backgroundPosition=`-`+i+`px -`+a+`px`,this.disposeItemEffect(t,this._itemBoxElement[t],r);continue}let o=e.itemScreenPixelCoord.x-e.itemBoxScreenPixelCoord.x,s=e.itemScreenPixelCoord.y-e.itemBoxScreenPixelCoord.y,c=-o*R.DEFAULT_FRAME_INTERVAL/R.ITEM_EFFECT_SPEED_PIXEL_PER_FRAME,l=e.overwrittenObjectId===0||e.overwrittenObjectId===void 0,u=l?e.itemBoxBackgroundImageCoord.x:this._wwa.getObjectCropXById(e.overwrittenObjectId),d=l?e.itemBoxBackgroundImageCoord.y:this._wwa.getObjectCropYById(e.overwrittenObjectId);n.style.left=o+`px`,n.style.top=s+`px`,typeof this.itemEffectStartTimers[t]==`number`&&clearInterval(this.itemEffectStartTimers[t]),this.itemEffectStartTimers[t]=window.setTimeout(()=>{this.itemEffectStartTimers[t]=void 0,this.startItemEffect(t,n,r,{target:{x:i,y:a},overwritten:{x:u,y:d}},c)},R.DEFAULT_FRAME_INTERVAL)}}startItemEffect(e,t,n,r,i){let a=n.querySelector(this.overwittenItemSelector);a&&n.removeChild(a);let o=document.createElement(`div`);o.classList.add(this.overwittenItemClassName),o.style.backgroundPosition=`-`+r.overwritten.x+`px -`+r.overwritten.y+`px`,o.style.backgroundImage=n.style.backgroundImage,n.appendChild(o),t.style.backgroundPosition=`-`+r.target.x+`px -`+r.target.y+`px`,t.style.transitionDuration=i+`ms`,t.style.transitionProperty=`left,top`,t.style.transitionTimingFunction=`linear`,t.style.left=`0`,t.style.top=`0`,n.classList.add(this.itemTransitioningClassName),t.addEventListener(`transitionend`,()=>{this.disposeItemEffect(e,t,n)},{once:!0})}disposeItemEffect(e,t,n){typeof this.itemEffectStartTimers[e]==`number`&&(clearInterval(this.itemEffectStartTimers[e]),this.itemEffectStartTimers[e]=void 0),t.style.transitionDuration=`0s`,t.style.transitionProperty=``,t.style.left=`0`,t.style.top=`0`,n.classList.contains(this.itemTransitioningClassName)&&n.classList.remove(this.itemTransitioningClassName);let r=n.querySelector(this.overwittenItemSelector);r&&n.removeChild(r)}isDead(){return this._status.energy<=0}addItem(e,t=0,n=!1,r){var i,a,o,s=this._wwa.getObjectAttributeById(e,R.ATR_NUMBER),c=0;if(t===0&&s!==0&&(t=s),t===0){if(e===0)return;if(i=this._getBlankItemPos(),i===R.ITEMBOX_IS_FULL)throw this._wwa.setEvalCalcWwaNodeEarnedItem(e,-1),this._wwa.callGetItemFullUserDefineFunction(),this._wwa.clearEvalCalcWwaNodeEarnedItem(),Error(`これ以上、アイテムを持てません。`);c=this._itemBox[i-1],this._forceSetItemBox(i,e)}else if(n===!1)if(i=t,o=this._itemBox[i-1],this._wwa.getObjectAttributeById(o,R.ATR_NUMBER)!==this._wwa.getObjectAttributeById(e,R.ATR_NUMBER))if(a=this._getBlankItemPos(),a!==R.ITEMBOX_IS_FULL)this._forceSetItemBox(a,o),this._forceSetItemBox(i,e);else throw this._wwa.setEvalCalcWwaNodeEarnedItem(e,-1),this._wwa.callGetItemFullUserDefineFunction(),this._wwa.clearEvalCalcWwaNodeEarnedItem(),Error(`これ以上、アイテムを持てません。`);else c=this._itemBox[i-1],this._forceSetItemBox(i,e);else i=t,c=this._itemBox[i-1],this._forceSetItemBox(i,e);this._updateEquipmentStatus(),this.updateItemBox(r?{insertPos:i,itemScreenPixelCoord:r.screenPixelCoord,itemBoxBackgroundImageCoord:r.itemBoxBackgroundImageCoord,itemBoxScreenPixelCoord:new S(R.MAP_WINDOW_WIDTH+(i-1)%3*R.CHIP_SIZE,R.ITEMBOX_TOP_Y+Math.floor((i-1)/3)*R.CHIP_SIZE),overwrittenObjectId:c}:void 0)}_forceSetItemBox(e,t){var n=this,r=Re(`#item`+(e-1)+`>.item-click-border`),i=this._wwa.getObjectAttributeById(t,R.ATR_MODE);if(this.removeItemByItemPosition(e),this._itemBox[e-1]=t,this._wwa.setEvalCalcWwaNodeEarnedItem(t,e),this._wwa.callGetItemUserDefineFunction(),this._wwa.clearEvalCalcWwaNodeEarnedItem(),t!==0&&i!==te.NORMAL){let t=this._wwa.resolveSystemMessage(g.ITEM_SELECT_TUTORIAL);this._isClickableItemGot||=(t!==`BLANK`&&this._wwa.registerSystemMessagePage(t),!0),r.style.display=`block`,(e=>{n._itemUsingEvent[e-1]=()=>{(n.isControllable()||n._wwa._messageWindow.isItemMenuChoice())&&(n._wwa._itemMenu.close(),n._wwa._setNextPage(),n._wwa.onselectitem(e))}})(e),r.addEventListener(`click`,this._itemUsingEvent[e-1])}}_getBlankItemPos(){var e;for(e=1;e<this._itemBox.length+1;e++)if(this._itemBox[e-1]===0)return e;return R.ITEMBOX_IS_FULL}_updateEquipmentStatus(){var e,t=new b(0,0);for(e=0;e<R.ITEMBOX_SIZE;e++)this._itemBox[e]!==0&&(t.strength+=this._wwa.getObjectAttributeById(this._itemBox[e],R.ATR_STRENGTH),t.defence+=this._wwa.getObjectAttributeById(this._itemBox[e],R.ATR_DEFENCE));var n=t.minus(this._equipStatus);this._wwa.setStatusChangedEffect(n),this._equipStatus=t,this.updateStatusValueBox()}hasItem(e){for(var t=0;t<R.ITEMBOX_SIZE;t++)if(this._itemBox[t]===e)return!0;return!1}canUseItem(e){var t=this._itemBox[e-1];return!(t===0||this._wwa.getObjectAttributeById(t,R.ATR_MODE)===te.NORMAL)}useItem(){var e=this._itemBox[this._readyToUseItemPos1To12-1];this._wwa.getObjectAttributeById(e,R.ATR_MODE)!==te.NOT_DISAPPEAR&&this.removeItemByItemPosition(this._readyToUseItemPos1To12);var t=U(`item`+(this._readyToUseItemPos1To12-1));return setTimeout(()=>{t.classList.contains(`onpress`)&&t.classList.remove(`onpress`)},R.DEFAULT_FRAME_INTERVAL),this._wwa.setEvalCalcWwaNodeEarnedItem(e,this._readyToUseItemPos1To12),this._wwa.callUseItemUserDefineFunction(),this._wwa.clearEvalCalcWwaNodeEarnedItem(),this._isReadyToUseItem=!1,this._readyToUseItemPos1To12=void 0,e}canHaveMoreItems(){return this._getBlankItemPos()!==R.ITEMBOX_IS_FULL}removeItemByItemPosition(e){var t;this._itemBox[e-1]!==0&&(this._wwa.getObjectAttributeById(this._itemBox[e-1],R.ATR_MODE)!==te.NORMAL&&(t=Re(`#item`+(e-1)+`>.item-click-border`),t.removeEventListener(`click`,this._itemUsingEvent[e-1]),t.style.display=`none`),this._itemBox[e-1]=0,this._updateEquipmentStatus(),this.updateItemBox())}removeItemByPartsID(e){var t;if(!this.hasItem(e))throw Error(`アイテムを持っていない`);for(var n=0;n<R.ITEMBOX_SIZE;n++)if(this._itemBox[n]===e){this._wwa.getObjectAttributeById(this._itemBox[n],R.ATR_MODE)!==te.NORMAL&&(t=Re(`#item`+n+`>.item-click-border`),t.removeEventListener(`click`,this._itemUsingEvent[n]),t.style.display=`none`),this._itemBox[n]=0,this._updateEquipmentStatus(),this.updateItemBox();return}}clearItemBox(){for(var e=1;e<=R.ITEMBOX_SIZE;e++)this.removeItemByItemPosition(e);this._updateEquipmentStatus(),this.updateItemBox()}hasGold(e){return this._status.gold>=e}payGold(e){if(!this.hasGold(e))throw Error(`お金が足りない`);this.setGold(this._status.gold-e)}earnGold(e){this.setGold(this._status.gold+e)}setPartsAppearedFlag(){this._partsAppeared=!0}clearPartsAppearedFlag(){this._partsAppeared=!1}isPartsAppearedTime(){return this._partsAppeared===!0}startBattleWith(e){this._isPlayerTurn=!0,this._battleFrameCounter=R.BATTLE_INTERVAL_FRAME_NUM,this._battleTurnLength=0,this._battleNoDamageTurnLength=0,this._enemy=e,this._state=6}isFighting(){return this._state===6}isTurn(){return this._isPlayerTurn}getTurnNum(){return this._battleTurnLength}isBattleStartFrame(){return this._battleFrameCounter===R.BATTLE_INTERVAL_FRAME_NUM&&this._battleTurnLength===0}calcBattleResultForPlayerTurn(e,t,n=!1){return this._wwa.callUserDefinedBattleDamageFunction(`playerToEnemy`,(n||void 0)&&{playerStatus:e,enemyStatus:t})||{damage:this._calcDamageDefault(e,t)}}calcBattleResultForEnemyTurn(e,t,n=!1){return this._wwa.callUserDefinedBattleDamageFunction(`enemyToPlayer`,(n||void 0)&&{playerStatus:t,enemyStatus:e})||{damage:this._calcDamageDefault(e,t)}}_calcDamageDefault(e,t){let n=e.strength-t.defence;return n>0?n:0}fight(){if(!this.isFighting())throw Error(`バトルが開始されていません。`);if(this._battleTurnLength===0&&this._battleFrameCounter===R.BATTLE_INTERVAL_FRAME_NUM&&this._wwa.showMonsterWindow(),--this._battleFrameCounter>0)return;this._battleTurnLength++,this._wwa.isBattleSpeedIndexForQuickBattle(this._speedIndex)||this._battleTurnLength>R.BATTLE_SPEED_CHANGE_TURN_NUM?(this._battleTurnLength===1&&(this._wwa.playAttackSound(),this._wwa.vibration(!1)),this._battleFrameCounter=1):(this._battleFrameCounter=R.BATTLE_INTERVAL_FRAME_NUM,this._wwa.playAttackSound(),this._wwa.vibration(!0));var e=this.getStatus(),t=this._enemy.status;let n=!1;if(this._isPlayerTurn){if(this._battleTurnLength===1&&this._wwa.isUsingDefaultDamageCalcFunction()&&e.strength<=t.defence&&e.defence>=t.strength){this._enemy.battleEndProcess(),this._wwa.registerSystemMessagePageByKey(g.CANNOT_DAMAGE_MONSTER),this._battleTurnLength=0,this._enemy=null,this._state=0;return}let{damage:r,aborted:i}=this.calcBattleResultForPlayerTurn(e,t);this._enemy.damage(r),n=!!i,this._enemy.status.energy<=0&&(this._wwa.playSound(this._wwa.getObjectAttributeById(this._enemy.partsID,R.ATR_SOUND)),this.earnGold(t.gold),this._wwa.setStatusChangedEffect(new x(0,0,0,t.gold)),this._enemy.item===0?this._wwa.setPartsOnPosition(j.OBJECT,0,this._enemy.position):this._wwa.setPartsOnPosition(j.OBJECT,this._enemy.item,this._enemy.position),this._wwa.reserveAppearPartsInNextFrame(this._enemy.position,A.OBJECT,this._enemy.partsID),this._state=0,this._wwa.registerPageByMessage(this._enemy.message,{triggerParts:{id:this._enemy.partsID,type:j.OBJECT,position:this._enemy.position}}),this._enemy.battleEndProcess(),this._battleTurnLength=0,this._battleNoDamageTurnLength=0,this._enemy=null),this._enemy!==null&&(r===0?this._battleNoDamageTurnLength++:this._battleNoDamageTurnLength=0),this._isPlayerTurn=!1}else{let{damage:r,aborted:i}=this.calcBattleResultForEnemyTurn(t,e);this.damage(r),n=!!i,this._status.energy<=0&&(this.setEnergy(0),this._enemy.battleEndProcess(),this._state=0,this._battleTurnLength=0,this._battleNoDamageTurnLength=0,this._enemy=null,this._wwa.shouldApplyGameOver({isAssignment:!1})&&this._wwa.gameover()),r===0?this._battleNoDamageTurnLength++:this._battleNoDamageTurnLength=0,this._isPlayerTurn=!0}(this._battleNoDamageTurnLength>R.FIGHT_DRAW_TURN||n)&&(this._enemy.battleEndProcess(),this._state=0,this._wwa.registerSystemMessagePageByKey(g.BATTLE_NOT_SETTLED),this._battleTurnLength=0,this._battleNoDamageTurnLength=0,this._enemy=null)}readyToUseItem(e){var t;if(!this.canUseItem(e))throw Error(`アイテムがないか、アイテムが使えません。`);t=this._itemBox[e-1],this._wwa.getObjectAttributeById(t,R.ATR_STRING),this._wwa.reserveAppearPartsInNextFrame(this._position.getPartsCoord(),A.OBJECT,t),this._readyToUseItemPos1To12=e,this._isReadyToUseItem=!0}isReadyToUseItem(){return this._isReadyToUseItem}getDrawingCenterPosition(){var e=this._position.getPartsCoord(),t=this._position.getOffsetCoord(),n=this._camera.getPosition(),r=n.getPartsCoord(),i=n.getOffsetCoord();return new S((e.x-r.x)*R.CHIP_SIZE+t.x-i.x+R.CHIP_SIZE/2,(e.y-r.y)*R.CHIP_SIZE+t.y-i.y+R.CHIP_SIZE/2)}mainFrameCount(){this._frameCount++}getFrameCount(){return this._frameCount}setFrameCount(e){return typeof e!=`number`&&(e=0),this._frameCount=e}getMoveCount(){return this._moves}setMoveCount(e){return this._moves=e}isMoveObjectAutoExecTime(){return this._moveObjectAutoExecTimer===0}setMoveMacroWaiting(e){e<0||(this._moveMacroWaitingRemainMoves=e,this._moveObjectAutoExecTimer=0)}resetMoveObjectAutoExecTimer(){this._moveObjectAutoExecTimer=R.CHIP_SIZE/de[this._speedIndex],this._moveMacroWaitingRemainMoves--}decrementMoveObjectAutoExecTimer(){return this._moveMacroWaitingRemainMoves>=0&&this._moveObjectAutoExecTimer>0&&(this._moveObjectAutoExecTimer--,this._moveMacroWaitingRemainMoves===0&&this._moveObjectAutoExecTimer===0&&(this._afterMoveMacroFlag=!0)),0}isWaitingMoveMacro(){return this._moveMacroWaitingRemainMoves!==0||this._moveObjectAutoExecTimer!==0}decrementLookingAroundTimer(){return this._isPreparedForLookingAround&&this._lookingAroundTimer>0?--this._lookingAroundTimer:0}isLookingAround(){return this._isPreparedForLookingAround&&this._lookingAroundTimer===0}getSpeedIndex(){return this._speedIndex}speedUp(){return this._speedIndex=Math.min(R.MAX_SPEED_INDEX,this._speedIndex+1)}speedDown(){return this._speedIndex=Math.max(R.MIN_SPEED_INDEX,this._speedIndex-1)}setSpeedIndex(e){if(e<R.MIN_SPEED_INDEX||R.MAX_SPEED_INDEX<e)throw Error(`#set_speed の引数が異常です:`+e);return this._speedIndex=e,this._speedIndex}isPausing(){return this.isJumped()||this.isWaitingMessageOrManualPause()||this.isWaitingPasswordWindow()||this.isWaitingEstimateWindow()||this.isWaitingMoveMacro()||this.isFighting()}constructor(e,t,n,r,i,a,o){super(t),this.itemTransitioningClassName=`item-transitioning`,this.overwittenItemClassName=`item-overwritten`,this.overwittenItemSelector=`.${this.overwittenItemClassName}`,this.itemEffectStartTimers=Array(R.ITEMBOX_SIZE),this._status=r,this._equipStatus=new b(0,0),this._itemBox=Array(R.ITEMBOX_SIZE),this._itemBoxElement=Array(R.ITEMBOX_SIZE),this._itemUsingEvent=Array(R.ITEMBOX_SIZE);for(var s=0;s<this._itemBox.length;s++)this._itemBox[s]=0,this._itemBoxElement[s]=Re(`#item`+s+`>.item-disp`);this.updateItemBox(),this._energyMax=i,this._dir=E.DOWN,this._isMovingImage=!1,this._wwa=e,this._state=0,this._camera=n,this._isPartsEventExecuted=!1,this._energyValueElement=Re(`#disp-energy>.status-value-box`),this._strengthValueElement=Re(`#disp-strength>.status-value-box`),this._defenceValueElement=Re(`#disp-defence>.status-value-box`),this._goldValueElement=Re(`#disp-gold>.status-value-box`),this._isReadyToUseItem=!1,this._isClickableItemGot=!1,this._moves=a,this._moveMacroWaitingRemainMoves=0,this._moveObjectAutoExecTimer=0,this.updateStatusValueBox(),this._partsAppeared=!1,this._afterMoveMacroFlag=!1,this._isPreparedForLookingAround=!0,this._lookingAroundTimer=R.PLAYER_LOOKING_AROUND_START_FRAME,this._speedIndex=o,this._messageDelayFrameCount=0,this._battleNoDamageTurnLength=0}},Yn=class e{constructor(e,t,n,r,i,a,o){this._partsID=e,this._position=t,this._imgCoord=n,this._status=r,this._message=i,this._item=a,this._battleEndCallback=o}get partsID(){return this._partsID}get position(){return this._position}get imgCoord(){return this._imgCoord}get status(){return this._status}get message(){return this._message}get item(){return this._item}damage(e){this._status.energy=Math.max(0,this._status.energy-e)}battleEndProcess(){this._battleEndCallback?.()}setStatus(e){e.energy!==null&&(this._status.energy=e.energy),e.strength!==null&&(this._status.strength=e.strength),e.defence!==null&&(this._status.defence=e.defence)}clone(){return new e(this._partsID,this._position.clone(),this._imgCoord.clone(),this._status.clone(),this._message,this._item,this._battleEndCallback)}},Xn=class{constructor(e,t,n,r,i){this._player=e,this._objectID=t,this._srcPos=n,this._destPos=r,this._dir=i,this._currentPos=this._srcPos.clone()}update(){var e=this._player.getSpeedIndex();return this._currentPos=this._currentPos.getNextFramePosition(this._dir,de[e],de[e]),this._currentPos}get isAchievedDestination(){return this._currentPos.equals(this._destPos)}get currentPosition(){return this._currentPos}get beforePosition(){return this._srcPos}get destination(){return this._destPos}get objID(){return this._objectID}},Zn=class{constructor(e,t){this._wwa=e,this._player=t,this.clear()}add(e,t,n,r){this._queue.push(new Xn(this._player,e,t,n,r))}update(){for(var e=[],t=[],n=0;n<this._queue.length;n++)this._queue[n].update(),this._queue[n].isAchievedDestination?(e.push(this._queue[n]),this._wwa.setPartsOnPosition(j.OBJECT,0,this._queue[n].beforePosition.getPartsCoord()),this._wwa.setPartsOnPosition(j.OBJECT,this._queue[n].objID,this._queue[n].destination.getPartsCoord())):t.push(this._queue[n]);return this._queue=t,e}clear(){this._queue=[]}get objectMovingData(){return this.objectMovingData}getOffsetByBeforePartsCoord(e){var t=this._queue.filter(t=>t.beforePosition.getPartsCoord().equals(e));return t.length===0?null:t[0].currentPosition.getOffsetCoord()}},Qn=(e,t)=>{if(e[0]===`+`){let n=parseInt(e.substring(1,10));if(Number.isNaN(n))throw Error(`+ 以降の文字列は数値形式で記載してください。`);return t+n}else if(e[0]===`-`){let n=parseInt(e.substring(1,10));if(Number.isNaN(n))throw Error(`- 以降の文字列は数値形式で記載してください。`);return t-n}let n=parseInt(e,10);if(Number.isNaN(n))throw Error(`数値形式ではないため、解析できません。`);return n},$n=class{constructor(e,t,n,r){this._wwa=e,this._triggerParts=t,this.macroType=n,this.macroArgs=r}isJunction(){return[I.IF,I.ELSE_IF,I.ELSE,I.END_IF].includes(this.macroType)}execute(){try{switch(this.macroType){case I.IMGPLAYER:return this._executeImgPlayerMacro(),{};case I.IMGYESNO:return this._executeImgYesNoMacro(),{};case I.HPMAX:return this._executeHPMaxMacro(),{};case I.SAVE:return this._executeSaveMacro(),{};case I.ITEM:return this._executeItemMacro(),{};case I.DEFAULT:return this._executeDefaultMacro(),{};case I.OLDMAP:return this._executeOldMapMacro(),{};case I.PARTS:return this._executePartsMacro(),{};case I.MOVE:return this._executeMoveMacro(),{};case I.MAP:return this._executeMapMacro(1),{};case I.DIRMAP:return this._executeDirMapMacro(),{};case I.IMGFRAME:return this._executeImgFrameMacro(),{};case I.IMGBOM:return this._executeImgBomMacro(),{};case I.DELPLAYER:return this._executeDelPlayerMacro(),{};case I.FACE:return this._executeFaceMacro(),{};case I.EFFECT:return this._executeEffectMacro(),{};case I.GAMEOVER:return this._executeGameOverMacro(),{};case I.IMGCLICK:return this._executeImgClickMacro(),{};case I.STATUS:{let{isGameOver:e}=this._executeStatusMacro();return{isGameOver:e}}case I.EFFITEM:return this._executeEffItemMacro(),{};case I.COLOR:return this._executeColorMacro(),{};case I.WAIT:return this._executeWaitMacro(),{};case I.SOUND:return this._executeSoundMacro(),{};case I.GAMEPAD_BUTTON:return this._executeGamePadButtonMacro(),{};case I.OLDMOVE:return this._executeOldMoveMacro(),{};case I.JUMPGATE:return this._executeJumpGateMacro(),{};case I.RECPOSITION:return this._executeRecPositionMacro(),{};case I.JUMPRECPOSITION:return this._executeJumpRecPositionMacro(),{};case I.CONSOLE_LOG:return this._executeConsoleLogMacro(1),{};case I.COPY_HP_TO:return this._executeCopyHpToMacro(),{};case I.SET_HP:{let{isGameOver:e}=this._executeSetHPMacro();return{isGameOver:e}}case I.COPY_HPMAX_TO:return this._executeCopyHpMaxToMacro(),{};case I.SET_HPMAX:return this._executeSetHpMaxMacro(),{};case I.COPY_AT_TO:return this._executeCopyAtToMacro(),{};case I.SET_AT:return this._executeSetAtMacro(),{};case I.COPY_DF_TO:return this._executeCopyDfToMacro(),{};case I.SET_DF:return this._executeSetDfMacro(),{};case I.COPY_MONEY_TO:return this._executeCopyMoneyToMacro(),{};case I.SET_MONEY:return this._executeSetMoneyMacro(),{};case I.COPY_STEP_COUNT_TO:return this._executeSetStepCountMacro(),{};case I.VAR_SET_VAL:return this._executeVarSetValMacro(),{};case I.VAR_SET:return this._executeVarSetMacro(),{};case I.VAR_ADD:return this._executeVarAddMacro(),{};case I.VAR_SUB:return this._executeVarSubMacro(),{};case I.VAR_MUL:return this._executeVarMulMacro(),{};case I.VAR_DIV:return this._executeVarDivMacro(),{};case I.VAR_MOD:return this._executeVarModMacro(),{};case I.VAR_SET_RAND:return this._executeVarSetRandMacro(),{};case I.GAME_SPEED:return this._executeGameSpeedMacro(),{};case I.SHOW_STR:return{};case I.SHOW_STR2:return{};case I.IF:return{};case I.LEGACY_IF:return this._executeLegacyIfMacro(),{};case I.ELSE_IF:return{};case I.ELSE:return{};case I.END_IF:return{};case I.SET_SPEED:return this._executeSetSpeedMacro(),{};case I.COPY_TIME_TO:return this._executeCopyTimeToMacro(),{};case I.HIDE_STATUS:return this._executeHideStatusMacro(),{};case I.VAR_MAP:return this._executeVarMapMacro(),{};case I.NO_GAMEOVER:return this._executeNoGameOverMacro(),{};case I.SET:{let{isGameOver:e}=this._executeSetMacro();return{isGameOver:e}}case I.MAP2:return this._executeMapMacro(2),{};case I.CONSOLE_LOG2:return this._executeConsoleLogMacro(2),{};case I.DELAYBGM:return this._executeDelayBgmMacro(),{};case I.SYSMSG:return this._executeSysMsgMacro(),{};case I.PICTURE:return this._executePictureMacro(),{};default:return console.log(`不明なマクロIDが実行されました:`+this.macroType),{}}}catch{}}_concatEmptyArgs(e){if(this.macroArgs.length<e){for(var t=Array(e-this.macroArgs.length),n=0;n<t.length;n++)t[n]=``;this.macroArgs=this.macroArgs.concat(t)}}_evaluateIntValue(e,t=0){let n=this.macroArgs[e];if(n===``)return t;let r=Number(n),i=r>=0?Math.floor(r):Math.ceil(r);return isNaN(i)?Kt(n,this._wwa.generateTokenValues(this._triggerParts),t):i}_executeJumpGateMacro(){this._concatEmptyArgs(3);let e=this._evaluateIntValue(0),t=this._evaluateIntValue(1),n=this._evaluateIntValue(2,E.NO_DIRECTION);if(!Je(n))throw TypeError(`この値の向きにプレイヤーを向けることはできません:`+n);this._wwa.forcedJumpGate(e,t,n)}_executeRecPositionMacro(){this._concatEmptyArgs(2);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1);this._wwa.recUserPosition(e,t)}_executeJumpRecPositionMacro(){this._concatEmptyArgs(2);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1);this._wwa.jumpRecUserPosition(e,t)}_executeConsoleLogMacro(e){this._concatEmptyArgs(1);let t=this._evaluateIntValue(0);switch(e){case 1:this._wwa.outputUserVar(t);return;case 2:console.log(`${this.macroArgs[0]} = ${t}`);return}}_executeCopyHpToMacro(){this._concatEmptyArgs(1);var e=this._evaluateIntValue(0);this._wwa.setUserVarHP(e)}_executeCopyHpMaxToMacro(){this._concatEmptyArgs(1);var e=this._evaluateIntValue(0);this._wwa.setUserVarHPMAX(e)}_executeCopyAtToMacro(){this._concatEmptyArgs(2);let e=this._evaluateIntValue(0),t=this._parseStatusKind(this._evaluateIntValue(1));this._wwa.setUserVarAT(e,t)}_executeCopyDfToMacro(){this._concatEmptyArgs(2);let e=this._evaluateIntValue(0),t=this._parseStatusKind(this._evaluateIntValue(1));this._wwa.setUserVarDF(e,t)}_parseStatusKind(e){switch(e){case 0:return`all`;case 1:return`bare`;case 2:return`equipment`;default:return`all`}}_executeCopyMoneyToMacro(){this._concatEmptyArgs(1);var e=this._evaluateIntValue(0);this._wwa.setUserVarMONEY(e)}_executeSetHPMacro(){this._concatEmptyArgs(1);var e=this._evaluateIntValue(0);return this._wwa.setHPUserVar(e,!0)}_executeSetHpMaxMacro(){this._concatEmptyArgs(1);var e=this._evaluateIntValue(0);this._wwa.setHPMAXUserVar(e)}_executeSetAtMacro(){this._concatEmptyArgs(1);var e=this._evaluateIntValue(0);this._wwa.setATUserVar(e)}_executeSetDfMacro(){this._concatEmptyArgs(1);var e=this._evaluateIntValue(0);this._wwa.setDFUserVar(e)}_executeSetMoneyMacro(){this._concatEmptyArgs(1);var e=this._evaluateIntValue(0);this._wwa.setMONEYUserVar(e)}_executeSetStepCountMacro(){this._concatEmptyArgs(1);var e=this._evaluateIntValue(0);this._wwa.setUserVarStep(e)}_executeVarSetValMacro(){this._concatEmptyArgs(2);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1);this._wwa.setUserVarVal(e,t)}_executeVarSetMacro(){this._concatEmptyArgs(2);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1);this._wwa.setUserValOtherUserVal(e,t)}_executeVarAddMacro(){this._concatEmptyArgs(2);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1);this._wwa.setUserValAdd(e,t)}_executeVarSubMacro(){this._concatEmptyArgs(2);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1);this._wwa.setUserValSub(e,t)}_executeVarMulMacro(){this._concatEmptyArgs(2);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1);this._wwa.setUserValMul(e,t)}_executeVarDivMacro(){this._concatEmptyArgs(2);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1);this._wwa.setUserValDiv(e,t)}_executeVarModMacro(){this._concatEmptyArgs(2);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1);this._wwa.setUserValMod(e,t)}_executeVarSetRandMacro(){this._concatEmptyArgs(3);let e=this._evaluateIntValue(0),t=this._evaluateIntValue(1),n=this._evaluateIntValue(2,0);this._wwa.setUserValRandNum(e,t,n)}_executeGameSpeedMacro(){this._concatEmptyArgs(1);var e=!!this._evaluateIntValue(0);this._wwa.speedChangeJudge(e)}_executeLegacyIfMacro(){for(var e=Array(11),t=0;t<10;t++)e[t]=this.macroArgs[t];this._wwa.userVarUserIf(this._triggerParts.position,e)}_executeSetSpeedMacro(){this._concatEmptyArgs(1);var e=this._evaluateIntValue(0);this._wwa.setPlayerSpeedIndex(e-1)}_executeCopyTimeToMacro(){this._concatEmptyArgs(1);var e=this._evaluateIntValue(0);this._wwa.setUserVarPlayTime(e)}_executeHideStatusMacro(){this._concatEmptyArgs(2);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1)!==0;this._wwa.hideStatus(e,t)}_executeVarMapMacro(){this._concatEmptyArgs(4);var e=this._evaluateIntValue(0),t=this.macroArgs[1],n=this.macroArgs[2],r=this._evaluateIntValue(3,j.OBJECT);if(e<0)throw Error(`入力変数が不正です`);this._wwa.varMap(this._triggerParts.position,t,n,e,r)}_executeImgPlayerMacro(){this._concatEmptyArgs(2);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1);this._wwa.setPlayerImgCoord(new S(e,t))}_executeImgYesNoMacro(){this._concatEmptyArgs(2);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1);this._wwa.setYesNoImgCoord(new S(e,t))}_executeHPMaxMacro(){this._concatEmptyArgs(1);var e=Math.max(0,this._evaluateIntValue(0));this._wwa.setPlayerEnergyMax(e)}_executeSaveMacro(){this._concatEmptyArgs(1);var e=!!this._evaluateIntValue(0);this._wwa.disableSave(e)}_executeItemMacro(){this._concatEmptyArgs(2);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1);this._wwa.setPlayerGetItem(e,t)}_executeDefaultMacro(){this._concatEmptyArgs(1);var e=!!this._evaluateIntValue(0);this._wwa.setObjectNotCollapseOnPartsOnPlayer(e)}_executeOldMapMacro(){this._concatEmptyArgs(1);var e=!!this._evaluateIntValue(0);this._wwa.setOldMap(e)}_executePartsMacro(){this._concatEmptyArgs(4);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1),n=this._evaluateIntValue(2,j.OBJECT),r=this._evaluateIntValue(3);if(n!==j.OBJECT&&n!==j.MAP)throw Error(`パーツ種別が不明です`);if(r!==0&&r!==1&&(r=1),e<0||t<0)throw Error(`パーツ番号が不正です`);if(n===j.OBJECT){if(e>=this._wwa.getObjectPartsNum()||t>=this._wwa.getObjectPartsNum())throw Error(`パーツ番号が不正です`)}else if(e>=this._wwa.getMapPartsNum()||t>=this._wwa.getMapPartsNum())throw Error(`パーツ番号が不正です`);this._wwa.replaceParts(e,t,n,!!r)}_executeMoveMacro(){this._concatEmptyArgs(1);var e=this._evaluateIntValue(0);this._wwa.setMoveMacroWaitingToPlayer(e)}_executeMapMacro(e){this._concatEmptyArgs(4);let t=this._evaluateIntValue(0);var n=this._evaluateIntValue(3,j.OBJECT);if(t<0)throw Error(`パーツ番号が不正です`);if(n===j.OBJECT){if(t>=this._wwa.getObjectPartsNum())throw Error(`パーツ番号が不正です`)}else if(t>=this._wwa.getMapPartsNum())throw Error(`パーツ番号が不正です`);if(e===1){let e=this.macroArgs[1],r=this.macroArgs[2];this._wwa.appearPartsEval(this._triggerParts.position,e,r,t,n)}else if(e===2){let e=this._evaluateIntValue(1),r=this._evaluateIntValue(2);if(isNaN(e)||isNaN(r))throw Error(`出現先座標が不正です`);this._wwa.appearPartsEval(this._triggerParts.position,`${e}`,`${r}`,t,n)}}_executeDirMapMacro(){this._concatEmptyArgs(3);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1),n=this._evaluateIntValue(2,j.OBJECT);if(isNaN(e)||isNaN(t)||isNaN(n))throw Error(`引数が整数ではありません`);if(e<0)throw Error(`パーツ番号が不正です`);if(n===j.OBJECT){if(e>=this._wwa.getObjectPartsNum())throw Error(`パーツ番号が不正です`)}else if(e>=this._wwa.getMapPartsNum())throw Error(`パーツ番号が不正です`);this._wwa.appearPartsByDirection(t,e,n)}_executeImgFrameMacro(){this._concatEmptyArgs(3);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1),n=this._evaluateIntValue(2);if(t<0||n<0)throw Error(`座標は正でなければなりません。`);if(e===L.ENERGY||e===L.STRENGTH||e===L.DEFENCE||e===L.GOLD)this._wwa.setStatusIconCoord(e,new S(t,n));else if(e===L.WIDE_CELL_ROW)this._wwa.setWideCellCoord(new S(t,n));else if(e===L.ITEM_BG)this._wwa.setItemboxBackgroundPosition({x:t,y:n});else if(e===L.MAIN_FRAME)this._wwa.setFrameCoord(new S(t,n));else throw Error(`種別が不正です。`)}_executeImgBomMacro(){this._concatEmptyArgs(2);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1);if(e<0||t<0)throw Error(`座標は正でなければなりません。`);this._wwa.setBattleEffectCoord(new S(e,t))}_executeDelPlayerMacro(){this._concatEmptyArgs(1);let e=this._evaluateIntValue(0);this._wwa.setDelPlayer(!!e)}_executeFaceMacro(){this._concatEmptyArgs(6);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1),n=this._evaluateIntValue(2),r=this._evaluateIntValue(3),i=this._evaluateIntValue(4),a=this._evaluateIntValue(5),o;if(e<0||t<0||n<0||r<0||i<0||a<0)throw Error(`各引数は0以上の整数でなければなりません。`);o=new w(new S(e,t),new S(n,r),new S(i,a)),this._wwa.addFace(o)}_executeEffectMacro(){this._concatEmptyArgs(1);var e=this._evaluateIntValue(0);if(e<0)throw Error(`待ち時間は0以上の整数でなければなりません。`);if(e===0){this._wwa.stopEffect();return}for(var t=[],n=1;n<this.macroArgs.length;n+=2){var r=this._evaluateIntValue(n),i=0;if(r<0)throw Error(`画像のパーツ座標指定は0以上の整数でなければなりません。`);if(n+1===this.macroArgs.length)throw Error(`画像のパーツ座標指定で、Y座標が指定されていません。`);if(i=this._evaluateIntValue(n+1),i<0)throw Error(`画像のパーツ座標指定は0以上の整数でなければなりません。`);t.push(new S(r,i))}this._wwa.setEffect(e,t)}_executeGameOverMacro(){this._concatEmptyArgs(2);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1);if(e<0||e>=this._wwa.getMapWidth()||t<0||t>=this._wwa.getMapWidth())throw Error(`マップの範囲外が指定されています!`);this._wwa.setGameOverPosition(new S(e,t))}_executeImgClickMacro(){if(this._concatEmptyArgs(2),this.macroArgs.length<1)throw Error(`引数が少なすぎます`);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1);if(e<0||t<0)throw Error(`引数が0以上の整数ではありません`);this._wwa.setImgClick(new S(e,t))}_executeEffItemMacro(){if(this.macroArgs.length<1)throw Error(`引数が少なすぎます`);var e=this._evaluateIntValue(0);this._wwa.updateItemEffectEnabled(!!e)}_executeStatusMacro(){this._concatEmptyArgs(2);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1);if(e<0||4<e)throw Error(`ステータス種別が範囲外です。`);return this._wwa.setPlayerStatus(e,t,!0)}_executeColorMacro(){this._concatEmptyArgs(4);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1),n=this._evaluateIntValue(2),r=this._evaluateIntValue(3);if(e<0||e>5)throw Error(`種別は0から5までです`);if(t<0||t>255||n<0||n>255||r<0||r>255)throw Error(`色が範囲外です`);this._wwa.changeStyleRule(e,t,n,r)}_executeWaitMacro(){throw Error(`Not implemented!`)}_executeSoundMacro(){this._concatEmptyArgs(2);let e=parseInt(this.macroArgs[0]),t=parseInt(this.macroArgs[1]);this._wwa.playSound(e,{bgmDelayDurationMs:t})}_executeGamePadButtonMacro(){this._concatEmptyArgs(2);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1);if(e<0||t<0)throw Error(`各引数は0以上の整数でなければなりません。`);if(t>R.ITEMBOX_SIZE)throw Error(`アイテムボックス上限を超えた数値が指定されました。`);this._wwa.setGamePadButtonItemTable(e,t)}_executeOldMoveMacro(){this._concatEmptyArgs(1);let e=!!this._evaluateIntValue(0);this._wwa.setOldMove(e)}_executeNoGameOverMacro(){this._concatEmptyArgs(1);let e=this._evaluateIntValue(0);this._wwa.setGameOverPolicy(e)}_executeSetMacro(){return this._wwa.execSetMacro(this.macroArgs[0],{triggerParts:this._triggerParts})}_executePictureMacro(){if(this._concatEmptyArgs(3),this.macroArgs.length<1)throw Error(`引数が少なすぎます`);let e=this._evaluateIntValue(0),t=this.macroArgs[1].length>0?this.macroArgs[1]:`+0`;if(t===`0`){this._wwa.deletePictureRegistry(e);return}let n=Qn(t,this._triggerParts.id);if(n===0)throw Error(`パーツ番号の相対値算出で0が検出されました。ピクチャを消去する場合は0のまま指定してください。`);if(n<0)throw Error(`パーツ番号は0以上の整数でなければなりません。`);let r=this._evaluateIntValue(2,j.OBJECT);this._wwa.setPictureRegistry(e,n,r,this._triggerParts.position)}_executeDelayBgmMacro(){this._concatEmptyArgs(1);let e=this._evaluateIntValue(0);this._wwa.setBgmDelay(e)}_executeSysMsgMacro(){this._concatEmptyArgs(2);let e=this.resolveSystemMessageKeyFromMacroArg(this.macroArgs[0]);if(!e)throw Error(`該当するシステムメッセージの定義がありません`);let t=this.macroArgs[1]===``?void 0:this.macroArgs[1].replaceAll(`\\n`,`
|
|
31
|
+
file name:`+this._fileName)}),this._image.src=this._fileName,this._isLoaded=!0)}createFrame(){this._frameCanvas.clear(),this._frameCanvas.drawCanvas(this._image,this._frameCoord.x,this._frameCoord.y,0,0),this._frameCanvas.drawCanvas(this._image,this._frameCoord.x+2,this._frameCoord.y,R.MAP_WINDOW_WIDTH-R.CHIP_SIZE,0),this._frameCanvas.drawCanvas(this._image,this._frameCoord.x,this._frameCoord.y+2,0,R.MAP_WINDOW_HEIGHT-R.CHIP_SIZE),this._frameCanvas.drawCanvas(this._image,this._frameCoord.x+2,this._frameCoord.y+2,R.MAP_WINDOW_WIDTH-R.CHIP_SIZE,R.MAP_WINDOW_HEIGHT-R.CHIP_SIZE);for(var e=1;e<R.H_PARTS_NUM_IN_WINDOW-1;e++)this._frameCanvas.drawCanvas(this._image,this._frameCoord.x+1,this._frameCoord.y,R.CHIP_SIZE*e,0),this._frameCanvas.drawCanvas(this._image,this._frameCoord.x+1,this._frameCoord.y+2,R.CHIP_SIZE*e,R.MAP_WINDOW_HEIGHT-R.CHIP_SIZE);for(var e=1;e<R.V_PARTS_NUM_IN_WINDOW-1;e++)this._frameCanvas.drawCanvas(this._image,this._frameCoord.x,this._frameCoord.y+1,0,R.CHIP_SIZE*e),this._frameCanvas.drawCanvas(this._image,this._frameCoord.x+2,this._frameCoord.y+1,R.MAP_WINDOW_WIDTH-R.CHIP_SIZE,R.CHIP_SIZE*e)}updateEffects(e){var t;if(e){var n=e.length,r;for(t=0;t<n;t++){var i=e[t];r=this._effectCanvases[t],r?r.clear():r=this._effectCanvases[t]=new Un(R.CHIP_SIZE*R.V_PARTS_NUM_IN_WINDOW,R.CHIP_SIZE*R.H_PARTS_NUM_IN_WINDOW,!0);for(var a=0;a<R.V_PARTS_NUM_IN_WINDOW;a++)for(var o=0;o<R.H_PARTS_NUM_IN_WINDOW;o++)r.drawCanvas(this._image,i.x,i.y,o*R.CHIP_SIZE,a*R.CHIP_SIZE)}}}restorePictures(e){this.picture.clearAllPictures(),e.forEach(e=>{this.picture.registerPicture(e)})}updateAllPicturesCache(e=!0){this.picture.updateAllPicturesCache(this._image,e)}updatePicturesAnimation(e=!0){this.picture.updatePicturesAnimation(this._image,e)}drawFrame(){this._ctx.drawImage(this._frameCanvas.cvs,0,0,R.CHIP_SIZE*R.V_PARTS_NUM_IN_WINDOW,R.CHIP_SIZE,0,0,R.CHIP_SIZE*R.V_PARTS_NUM_IN_WINDOW,R.CHIP_SIZE),this._ctx.drawImage(this._frameCanvas.cvs,0,R.CHIP_SIZE*(R.H_PARTS_NUM_IN_WINDOW-1),R.CHIP_SIZE*R.V_PARTS_NUM_IN_WINDOW,R.CHIP_SIZE,0,R.CHIP_SIZE*(R.H_PARTS_NUM_IN_WINDOW-1),R.CHIP_SIZE*R.V_PARTS_NUM_IN_WINDOW,R.CHIP_SIZE),this._ctx.drawImage(this._frameCanvas.cvs,0,R.CHIP_SIZE,R.CHIP_SIZE,R.CHIP_SIZE*(R.H_PARTS_NUM_IN_WINDOW-2),0,R.CHIP_SIZE,R.CHIP_SIZE,R.CHIP_SIZE*(R.H_PARTS_NUM_IN_WINDOW-2)),this._ctx.drawImage(this._frameCanvas.cvs,R.CHIP_SIZE*(R.H_PARTS_NUM_IN_WINDOW-1),R.CHIP_SIZE,R.CHIP_SIZE,R.CHIP_SIZE*(R.H_PARTS_NUM_IN_WINDOW-2),R.CHIP_SIZE*(R.H_PARTS_NUM_IN_WINDOW-1),R.CHIP_SIZE,R.CHIP_SIZE,R.CHIP_SIZE*(R.H_PARTS_NUM_IN_WINDOW-2))}drawEffect(e){var t=this._effectCanvases[e];t&&this._ctx.drawImage(t.cvs,0,0,R.CHIP_SIZE*R.V_PARTS_NUM_IN_WINDOW,R.CHIP_SIZE*R.H_PARTS_NUM_IN_WINDOW,0,0,R.CHIP_SIZE*R.V_PARTS_NUM_IN_WINDOW,R.CHIP_SIZE*R.H_PARTS_NUM_IN_WINDOW)}drawPictures(){this.picture.forEachPictures(e=>{let{x:t,y:n,width:r,height:i}=e.getDrawPictureCoords();this._ctx.drawImage(e.canvasImage,0,0,r,i,t,n,r,i)})}drawCanvas(e,t,n,r){if(!this._isLoaded)throw Error(`No image was loaded.`);this._ctx.drawImage(this._image,R.CHIP_SIZE*e,R.CHIP_SIZE*t,R.CHIP_SIZE,R.CHIP_SIZE,n,r,R.CHIP_SIZE,R.CHIP_SIZE)}drawCanvasWithSize(e,t,n,r,i,a){if(!this._isLoaded)throw Error(`No image was loaded.`);this._ctx.drawImage(this._image,R.CHIP_SIZE*e,R.CHIP_SIZE*t,R.CHIP_SIZE*n,R.CHIP_SIZE*r,i,a,R.CHIP_SIZE*n,R.CHIP_SIZE*r)}drawCanvasWithUpperYLimit(e,t,n,r,i){if(!this._isLoaded)throw Error(`No image was loaded.`);var a=Math.max(0,r+R.CHIP_SIZE-i);a>=R.CHIP_SIZE||this._ctx.drawImage(this._image,R.CHIP_SIZE*e,R.CHIP_SIZE*t,R.CHIP_SIZE,R.CHIP_SIZE-a,n,r,R.CHIP_SIZE,R.CHIP_SIZE)}copyCanvas(e,t){return(n,r,i,a,o)=>{if(!this._isLoaded)throw Error(`No image was loaded.`);let s=Math.max(0,t(a,o));s>=R.CHIP_SIZE||e.ctx.drawImage(this._image,R.CHIP_SIZE*n,R.CHIP_SIZE*r+s,R.CHIP_SIZE,R.CHIP_SIZE-s,i,a+s,R.CHIP_SIZE,R.CHIP_SIZE)}}copyBackCanvasWithUpperYLimit(e,t,n,r,i){this.copyCanvas(this._backCanvas,(e,t)=>e+R.CHIP_SIZE-t)(e,t,n,r,i)}copyBackCanvasWithLowerYLimit(e,t,n,r,i){this.copyCanvas(this._backCanvas,(e,t)=>t-e)(e,t,n,r,i)}copyObjectCanvasWithUpperYLimit(e,t,n,r,i,a){this.copyCanvas(this._objectCanvases[e],(e,t)=>e+R.CHIP_SIZE-t)(t,n,r,i,a)}copyObjectCanvasWithLowerYLimit(e,t,n,r,i,a){this.copyCanvas(this._objectCanvases[e],(e,t)=>t-e)(t,n,r,i,a)}drawBackCanvas(){if(!this._isLoaded)throw Error(`No image was loaded.`);this._ctx.drawImage(this._backCanvas.cvs,0,0,R.CHIP_SIZE*R.V_PARTS_NUM_IN_WINDOW,R.CHIP_SIZE*R.H_PARTS_NUM_IN_WINDOW,0,0,R.CHIP_SIZE*R.V_PARTS_NUM_IN_WINDOW,R.CHIP_SIZE*R.H_PARTS_NUM_IN_WINDOW)}drawObjectCanvas(e){if(!this._isLoaded)throw Error(`No image was loaded.`);this._ctx.drawImage(this._objectCanvases[e].cvs,0,0,R.CHIP_SIZE*R.V_PARTS_NUM_IN_WINDOW,R.CHIP_SIZE*R.H_PARTS_NUM_IN_WINDOW,0,0,R.CHIP_SIZE*R.V_PARTS_NUM_IN_WINDOW,R.CHIP_SIZE*R.H_PARTS_NUM_IN_WINDOW)}clearBackCanvas(){this._backCanvas.clear()}clearBackCanvasWithLowerYLimit(e){this._backCanvas.clearRectWithLowerYLimit(e)}clearObjectCanvases(){var e;for(e=0;e<2;e++)this._objectCanvases[e].clear()}clearObjectCanvasesWithLowerYLimit(e){var t;for(t=0;t<2;t++)this._objectCanvases[t].clearRectWithLowerYLimit(e)}drawCanvasWithLowerYLimit(e,t,n,r,i){if(!this._isLoaded)throw Error(`No image was loaded.`);var a=Math.max(0,i-r);a>=R.CHIP_SIZE||this._ctx.drawImage(this._image,R.CHIP_SIZE*e,R.CHIP_SIZE*t+a,R.CHIP_SIZE,R.CHIP_SIZE-a,n,r+a,R.CHIP_SIZE,R.CHIP_SIZE)}clearCanvas(e,t,n,r){this._ctx.clearRect(e,t,n,r)}drawBase(e,t,n,r){this._ctx.fillStyle=`#9E9E9E`,this._ctx.fillRect(e,t,n,r)}setFrameImage(e){this._frameCoord=e,this.createFrame()}constructor(e,t,n,r,i,a){this._isLoaded=!1,this.mapCache=void 0,this.mapObjectCache=void 0,this.mapCacheYLimit=0,this._frameCanvas=new Un(R.CHIP_SIZE*R.V_PARTS_NUM_IN_WINDOW,R.CHIP_SIZE*R.H_PARTS_NUM_IN_WINDOW,!0),this._backCanvas=new Un(R.CHIP_SIZE*R.V_PARTS_NUM_IN_WINDOW,R.CHIP_SIZE*R.H_PARTS_NUM_IN_WINDOW,!1),this._objectCanvases=[],this._effectCanvases=[],this.picture=new Hn(r,i);var o;for(o=0;o<2;o++)this._objectCanvases[o]=new Un(R.CHIP_SIZE*R.V_PARTS_NUM_IN_WINDOW,R.CHIP_SIZE*R.H_PARTS_NUM_IN_WINDOW,!0);this._ctx=e,this._fileName=t,this._loadCompleteCallBack=a,this._load(),this._frameCoord=n.clone(),this.cpPartsLog=new S(0,0)}},Gn=class{constructor(e){this._position=null,this.reset(e)}setPlayer(e){this._player=e}isResetting(){return this._isResetting}getPosition(){return this._position}getPreviousPosition(){return this._positionPrev}resetPreviousPosition(){this._positionPrev=null}move(e){var t=de[this._player.getSpeedIndex()];this._position=this._position.getNextFramePosition(e,t*(R.H_PARTS_NUM_IN_WINDOW-1),t*(R.V_PARTS_NUM_IN_WINDOW-1))}getTransitionStepNum(){return this._transitionStep}advanceTransitionStepNum(){return++this._transitionStep,this._transitionStep===R.V_PARTS_NUM_IN_WINDOW&&(this._isResetting=!1,this._transitionStep=0),this._transitionStep}isFinalStep(){if(this._isResetting===!1)throw Error(`リセット中ではありません。`);return this._transitionStep===R.V_PARTS_NUM_IN_WINDOW-1}reset(e){this._positionPrev=this._position,this._position=e.getDefaultCameraPosition(),this._transitionStep=0,this._isResetting=!0}},Kn=class{getPosition(){return this._position}constructor(e){this._position=e}},qn=class extends Kn{constructor(e){super(e)}},Jn=class extends qn{move(){if(this.isControllable()){this.controll(this._dir);return}if(this._state===2){try{this._camera.move(this._dir)}catch{}this._isOnCameraStopPosition()&&(this._state=0,this._wwa.callCameraMoveUserDefineFunction())}else if(this._state===1){try{var e=this._position.getNextFramePosition(this._dir,de[this._speedIndex],de[this._speedIndex])}catch{}if(e.isJustPosition()){this._state=0,this.toggleMovingImage(),this._moves++,this._isPartsEventExecuted=!1,this._samePosLastExecutedMapID=void 0,this._samePosLastExecutedObjID=void 0;let{isGameOver:e}=this._wwa.callMoveUserDefineFunction();if(e)return}this._position=e}}controll(e){var t,n;if(this.isControllable()){this._isPreparedForLookingAround=!1,this._dir=e;try{t=this._position.getNextFramePosition(this._dir,de[this._speedIndex],de[this._speedIndex]),n=this._position.getNextJustPosition(e)}catch{return}if(this._isOnCameraMovingPosition()){if(this._wwa.getMapIdByPosition(n)!==0||this._wwa.isOldMap()||this._wwa.debug)try{this._camera.move(this._dir),this._state=2}catch{this._state=0}return}if(!this.canMoveTo(n)){this._wwa.getMapTypeByPosition(n)===R.MAP_WALL&&this._wwa.checkMap(n.getPartsCoord()),this._wwa.checkObject(n.getPartsCoord());return}this._position=t,this._state=1,this._wwa.getMapAttributeByPosition(this._position.getNextJustPosition(e),R.ATR_TYPE)!==R.MAP_LOCALGATE&&this._wwa.moveObjects(!0)}}setDir(e){this._isPreparedForLookingAround=!1,this._dir=e}canMoveTo(e){return e===null?!1:this._wwa.debug?!0:(this._wwa.getMapWidth(),e.getPartsCoord(),e.getOffsetCoord(),this._wwa.getMapIdByPosition(e)===0&&!this._wwa.isOldMap()||this._wwa.getMapTypeByPosition(e)===R.MAP_WALL?!1:this._wwa.getObjectIdByPosition(e)===0||this._wwa.getObjectTypeByPosition(e)===R.OBJECT_NORMAL&&this._wwa.getObjectAttributeByPosition(e,R.ATR_MODE)===R.PASSABLE_OBJECT?!0:this._wwa.getObjectTypeByPosition(e)===R.OBJECT_DOOR&&this._wwa.getObjectAttributeByPosition(e,R.ATR_NUMBER)===R.PASSABLE_OBJECT?!this.hasItem(this._wwa.getObjectAttributeByPosition(e,R.ATR_ITEM)):!1)}isMoving(){return this._state==1||this._state==2}_isOnCameraMovingPosition(){var e=this._camera.getPosition().getPartsCoord(),t=this.getPosition().getPartsCoord();return t.x-e.x===R.H_PARTS_NUM_IN_WINDOW-1&&this._dir===E.RIGHT||t.x===e.x&&this._dir===E.LEFT||t.y-e.y===R.V_PARTS_NUM_IN_WINDOW-1&&this._dir===E.DOWN||t.y===e.y&&this._dir===E.UP}_isOnCameraStopPosition(){var e=this._camera.getPosition().getPartsCoord(),t=this.getPosition().getPartsCoord();return t.x-e.x===R.H_PARTS_NUM_IN_WINDOW-1&&this._dir===E.LEFT||t.x===e.x&&this._dir===E.RIGHT||t.y-e.y===R.V_PARTS_NUM_IN_WINDOW-1&&this._dir===E.UP||t.y===e.y&&this._dir===E.DOWN}isControllable(){var e=this._afterMoveMacroFlag;return this._afterMoveMacroFlag=!1,this._state===0&&!this._partsAppeared&&(this._wwa.getMapTypeByPosition(this._position)!==R.MAP_LOCALGATE&&this._wwa.getMapTypeByPosition(this._position)!==R.MAP_URLGATE||!this._wwa.isPrevFrameEventExecuted())&&this._moveMacroWaitingRemainMoves===0&&this._moveObjectAutoExecTimer===0&&!e&&this._wwa.canInput()}getCopyOfItemBox(){return this._itemBox.slice()}getDir(){return this._dir}isMovingImage(){return this._isMovingImage}toggleMovingImage(){this._isMovingImage?this._isMovingImage=!1:this._isMovingImage=!0}getEnergyMax(){return this._energyMax}isJumped(){return this._state===5||this._state===9}setMessageWaiting(){this._state===4&&console.warn(`メッセージが表示されるため、マニュアルポーズが無効になりました。`),this._state=3}setManualPause(e,t=!1){this.isControllable()&&(this._state=4,this._manualPauseInformation=e)}isWaitingMessageOrManualPause(){return[3,4].includes(this._state)}isWaitingMessage(){return this._state===3}isManualPause(){return this._state===4}getManualPauseInformation(){return this._manualPauseInformation}isDelayFrame(){return this._messageDelayFrameCount>0}updateDelayFrame(){this._messageDelayFrameCount--}setDelayFrame(){this._messageDelayFrameCount=1}clearWaitingMessageOrManualPause(){this._state===4&&(this._manualPauseInformation=void 0);let e=this.isWaitingMessageOrManualPause();!e&&this._state!==9||(e?this._state=0:this._state===9&&(this._state=5),this._isPartsEventExecuted=!0,this._isPreparedForLookingAround&&(this._lookingAroundTimer=R.PLAYER_LOOKING_AROUND_START_FRAME))}setEstimateWindowWating(){this._state=7}isWaitingEstimateWindow(){return this._state===7}clearEstimateWindowWaiting(){this._state===7&&(this._state=0)}setPasswordWindowWating(){this._state=8}isWaitingPasswordWindow(){return this._state===8}clearPasswordWindowWaiting(){this._state===8&&(this._state=0)}isPartsEventExecuted(){return this._isPartsEventExecuted}resetEventExecutionInfo(){this._isPartsEventExecuted=!1}getLastExecPartsIDOnSamePosition(e){return e===j.MAP?this._samePosLastExecutedMapID:this._samePosLastExecutedObjID}setLastExecInfoOnSamePosition(e,t){e===j.MAP?this._samePosLastExecutedMapID=t:this._samePosLastExecutedObjID=t}processAfterJump(){this._state!==5&&this._state!==9||--this._jumpWaitFramesRemain===0&&(this._state=this._state===5?0:3)}jumpTo(e,t=E.NO_DIRECTION){var n=this._camera.getPosition();return this.getPosition(),this._position.equals(e)?!1:(this._position=e,e.isInCameraRange(this._camera,!0)||this._camera.reset(e),this._state=this._state===3?9:5,this._jumpWaitFramesRemain=R.LOCALGATE_PLAYER_WAIT_FRAME,this._samePosLastExecutedMapID=void 0,this._samePosLastExecutedObjID=void 0,t===E.NO_DIRECTION?e.hasLocalGate()?this._dir=E.DOWN:e.getPartsCoord().y<=this._wwa.getMapWidth()-2&&e.getNextJustPosition(E.DOWN).hasLocalGate()?this._dir=E.UP:e.getPartsCoord().y>=1&&e.getNextJustPosition(E.UP).hasLocalGate()?this._dir=E.DOWN:e.getPartsCoord().x<=this._wwa.getMapWidth()-2&&e.getNextJustPosition(E.RIGHT).hasLocalGate()?this._dir=E.LEFT:e.getPartsCoord().x>=1&&e.getNextJustPosition(E.LEFT).hasLocalGate()?this._dir=E.RIGHT:this._dir=E.DOWN:this._dir=t,this._camera.getPosition().equals(n)||(this._isPreparedForLookingAround=!0,this._lookingAroundTimer=R.PLAYER_LOOKING_AROUND_START_FRAME),this._wwa.callJumpGateUserDefineFunction(),!0)}systemJumpTo(e){this._position=e,this._camera.reset(e),this._camera.resetPreviousPosition(),this._state=5,this._jumpWaitFramesRemain=R.LOCALGATE_PLAYER_WAIT_FRAME,this._samePosLastExecutedMapID=void 0,this._samePosLastExecutedObjID=void 0,this._dir=E.DOWN,this._isPreparedForLookingAround=!0,this._lookingAroundTimer=R.PLAYER_LOOKING_AROUND_START_FRAME}addStatusAll(e){return this._status.add(e),this.isDead()&&(this._status.energy=0),this._energyMax!==0&&(this._status.energy=Math.min(this._status.energy,this._energyMax)),this.updateStatusValueBox(),this._status}setEnergyMax(e){return this._energyMax=e,e!==0&&(this._status.energy=Math.min(this._status.energy,this._energyMax)),this.updateStatusValueBox(),e}setEnergy(e){return this._status.energy=e,this.isDead()&&(this._status.energy=0),this._energyMax!==0&&(this._status.energy=Math.min(this._status.energy,this._energyMax)),this.updateStatusValueBox(),e}damage(e){this._status.energy=Math.max(0,this._status.energy-e),this.isDead()&&(this._status.energy=0),this._energyMax!==0&&(this._status.energy=Math.min(this._status.energy,this._energyMax)),this.updateStatusValueBox()}setStrength(e){return this._status.strength=e,this.updateStatusValueBox(),e}setDefence(e){return this._status.defence=e,this.updateStatusValueBox(),e}setGold(e){return this._status.gold=e,this.updateStatusValueBox(),e}getStatus(){return this._status.plus(this._equipStatus)}getStatusWithoutEquipments(){return this._status.plus(new b(0,0))}getStatusOfEquipments(){return this._equipStatus.plus(new b(0,0))}updateStatusValueBox(){let e=this._status.plus(this._equipStatus);this._energyValueElement.textContent=this._wwa.isVisibleStatus(`energy`)?String(e.energy):``,this._strengthValueElement.textContent=this._wwa.isVisibleStatus(`strength`)?String(e.strength):``,this._defenceValueElement.textContent=this._wwa.isVisibleStatus(`defence`)?String(e.defence):``,this._goldValueElement.textContent=this._wwa.isVisibleStatus(`gold`)?String(e.gold):``,this._wwa._messageWindow?.update(),this._wwa.updateScore()}updateItemBox(e){for(let t=0;t<this._itemBoxElement.length;t++){let n=this._itemBoxElement[t],r=Le(`#item`+t);if(this._itemBox[t]===0){n.style.backgroundPosition=`-40px 0px`,this.disposeItemEffect(t,this._itemBoxElement[t],r);continue}let i=this._wwa.getObjectCropXById(this._itemBox[t]),a=this._wwa.getObjectCropYById(this._itemBox[t]);if(!e||t!==e.insertPos-1){n.style.backgroundPosition=`-`+i+`px -`+a+`px`,this.disposeItemEffect(t,this._itemBoxElement[t],r);continue}let o=e.itemScreenPixelCoord.x-e.itemBoxScreenPixelCoord.x,s=e.itemScreenPixelCoord.y-e.itemBoxScreenPixelCoord.y,c=-o*R.DEFAULT_FRAME_INTERVAL/R.ITEM_EFFECT_SPEED_PIXEL_PER_FRAME,l=e.overwrittenObjectId===0||e.overwrittenObjectId===void 0,u=l?e.itemBoxBackgroundImageCoord.x:this._wwa.getObjectCropXById(e.overwrittenObjectId),d=l?e.itemBoxBackgroundImageCoord.y:this._wwa.getObjectCropYById(e.overwrittenObjectId);n.style.left=o+`px`,n.style.top=s+`px`,typeof this.itemEffectStartTimers[t]==`number`&&clearInterval(this.itemEffectStartTimers[t]),this.itemEffectStartTimers[t]=window.setTimeout(()=>{this.itemEffectStartTimers[t]=void 0,this.startItemEffect(t,n,r,{target:{x:i,y:a},overwritten:{x:u,y:d}},c)},R.DEFAULT_FRAME_INTERVAL)}}startItemEffect(e,t,n,r,i){let a=n.querySelector(this.overwittenItemSelector);a&&n.removeChild(a);let o=document.createElement(`div`);o.classList.add(this.overwittenItemClassName),o.style.backgroundPosition=`-`+r.overwritten.x+`px -`+r.overwritten.y+`px`,o.style.backgroundImage=n.style.backgroundImage,n.appendChild(o),t.style.backgroundPosition=`-`+r.target.x+`px -`+r.target.y+`px`,t.style.transitionDuration=i+`ms`,t.style.transitionProperty=`left,top`,t.style.transitionTimingFunction=`linear`,t.style.left=`0`,t.style.top=`0`,n.classList.add(this.itemTransitioningClassName),t.addEventListener(`transitionend`,()=>{this.disposeItemEffect(e,t,n)},{once:!0})}disposeItemEffect(e,t,n){typeof this.itemEffectStartTimers[e]==`number`&&(clearInterval(this.itemEffectStartTimers[e]),this.itemEffectStartTimers[e]=void 0),t.style.transitionDuration=`0s`,t.style.transitionProperty=``,t.style.left=`0`,t.style.top=`0`,n.classList.contains(this.itemTransitioningClassName)&&n.classList.remove(this.itemTransitioningClassName);let r=n.querySelector(this.overwittenItemSelector);r&&n.removeChild(r)}isDead(){return this._status.energy<=0}addItem(e,t=0,n=!1,r){var i,a,o,s=this._wwa.getObjectAttributeById(e,R.ATR_NUMBER),c=0;if(t===0&&s!==0&&(t=s),t===0){if(e===0)return;if(i=this._getBlankItemPos(),i===R.ITEMBOX_IS_FULL)throw this._wwa.setEvalCalcWwaNodeEarnedItem(e,-1),this._wwa.callGetItemFullUserDefineFunction(),this._wwa.clearEvalCalcWwaNodeEarnedItem(),Error(`これ以上、アイテムを持てません。`);c=this._itemBox[i-1],this._forceSetItemBox(i,e)}else if(n===!1)if(i=t,o=this._itemBox[i-1],this._wwa.getObjectAttributeById(o,R.ATR_NUMBER)!==this._wwa.getObjectAttributeById(e,R.ATR_NUMBER))if(a=this._getBlankItemPos(),a!==R.ITEMBOX_IS_FULL)this._forceSetItemBox(a,o),this._forceSetItemBox(i,e);else throw this._wwa.setEvalCalcWwaNodeEarnedItem(e,-1),this._wwa.callGetItemFullUserDefineFunction(),this._wwa.clearEvalCalcWwaNodeEarnedItem(),Error(`これ以上、アイテムを持てません。`);else c=this._itemBox[i-1],this._forceSetItemBox(i,e);else i=t,c=this._itemBox[i-1],this._forceSetItemBox(i,e);this._updateEquipmentStatus(),this.updateItemBox(r?{insertPos:i,itemScreenPixelCoord:r.screenPixelCoord,itemBoxBackgroundImageCoord:r.itemBoxBackgroundImageCoord,itemBoxScreenPixelCoord:new S(R.MAP_WINDOW_WIDTH+(i-1)%3*R.CHIP_SIZE,R.ITEMBOX_TOP_Y+Math.floor((i-1)/3)*R.CHIP_SIZE),overwrittenObjectId:c}:void 0)}_forceSetItemBox(e,t){var n=this,r=Re(`#item`+(e-1)+`>.item-click-border`),i=this._wwa.getObjectAttributeById(t,R.ATR_MODE);if(this.removeItemByItemPosition(e),this._itemBox[e-1]=t,this._wwa.setEvalCalcWwaNodeEarnedItem(t,e),this._wwa.callGetItemUserDefineFunction(),this._wwa.clearEvalCalcWwaNodeEarnedItem(),t!==0&&i!==te.NORMAL){let t=this._wwa.resolveSystemMessage(g.ITEM_SELECT_TUTORIAL);this._isClickableItemGot||=(t!==`BLANK`&&this._wwa.registerSystemMessagePage(t),!0),r.style.display=`block`,(e=>{n._itemUsingEvent[e-1]=()=>{(n.isControllable()||n._wwa._messageWindow.isItemMenuChoice())&&(n._wwa._itemMenu.close(),n._wwa._setNextPage(),n._wwa.onselectitem(e))}})(e),r.addEventListener(`click`,this._itemUsingEvent[e-1])}}_getBlankItemPos(){var e;for(e=1;e<this._itemBox.length+1;e++)if(this._itemBox[e-1]===0)return e;return R.ITEMBOX_IS_FULL}_updateEquipmentStatus(){var e,t=new b(0,0);for(e=0;e<R.ITEMBOX_SIZE;e++)this._itemBox[e]!==0&&(t.strength+=this._wwa.getObjectAttributeById(this._itemBox[e],R.ATR_STRENGTH),t.defence+=this._wwa.getObjectAttributeById(this._itemBox[e],R.ATR_DEFENCE));var n=t.minus(this._equipStatus);this._wwa.setStatusChangedEffect(n),this._equipStatus=t,this.updateStatusValueBox()}hasItem(e){for(var t=0;t<R.ITEMBOX_SIZE;t++)if(this._itemBox[t]===e)return!0;return!1}canUseItem(e){var t=this._itemBox[e-1];return!(t===0||this._wwa.getObjectAttributeById(t,R.ATR_MODE)===te.NORMAL)}useItem(){var e=this._itemBox[this._readyToUseItemPos1To12-1];this._wwa.getObjectAttributeById(e,R.ATR_MODE)!==te.NOT_DISAPPEAR&&this.removeItemByItemPosition(this._readyToUseItemPos1To12);var t=U(`item`+(this._readyToUseItemPos1To12-1));return setTimeout(()=>{t.classList.contains(`onpress`)&&t.classList.remove(`onpress`)},R.DEFAULT_FRAME_INTERVAL),this._wwa.setEvalCalcWwaNodeEarnedItem(e,this._readyToUseItemPos1To12),this._wwa.callUseItemUserDefineFunction(),this._wwa.clearEvalCalcWwaNodeEarnedItem(),this._isReadyToUseItem=!1,this._readyToUseItemPos1To12=void 0,e}canHaveMoreItems(){return this._getBlankItemPos()!==R.ITEMBOX_IS_FULL}removeItemByItemPosition(e){var t;this._itemBox[e-1]!==0&&(this._wwa.getObjectAttributeById(this._itemBox[e-1],R.ATR_MODE)!==te.NORMAL&&(t=Re(`#item`+(e-1)+`>.item-click-border`),t.removeEventListener(`click`,this._itemUsingEvent[e-1]),t.style.display=`none`),this._itemBox[e-1]=0,this._updateEquipmentStatus(),this.updateItemBox())}removeItemByPartsID(e){var t;if(!this.hasItem(e))throw Error(`アイテムを持っていない`);for(var n=0;n<R.ITEMBOX_SIZE;n++)if(this._itemBox[n]===e){this._wwa.getObjectAttributeById(this._itemBox[n],R.ATR_MODE)!==te.NORMAL&&(t=Re(`#item`+n+`>.item-click-border`),t.removeEventListener(`click`,this._itemUsingEvent[n]),t.style.display=`none`),this._itemBox[n]=0,this._updateEquipmentStatus(),this.updateItemBox();return}}clearItemBox(){for(var e=1;e<=R.ITEMBOX_SIZE;e++)this.removeItemByItemPosition(e);this._updateEquipmentStatus(),this.updateItemBox()}hasGold(e){return this._status.gold>=e}payGold(e){if(!this.hasGold(e))throw Error(`お金が足りない`);this.setGold(this._status.gold-e)}earnGold(e){this.setGold(this._status.gold+e)}setPartsAppearedFlag(){this._partsAppeared=!0}clearPartsAppearedFlag(){this._partsAppeared=!1}isPartsAppearedTime(){return this._partsAppeared===!0}startBattleWith(e){this._isPlayerTurn=!0,this._battleFrameCounter=R.BATTLE_INTERVAL_FRAME_NUM,this._battleTurnLength=0,this._battleNoDamageTurnLength=0,this._enemy=e,this._state=6}isFighting(){return this._state===6}isTurn(){return this._isPlayerTurn}getTurnNum(){return this._battleTurnLength}isBattleStartFrame(){return this._battleFrameCounter===R.BATTLE_INTERVAL_FRAME_NUM&&this._battleTurnLength===0}calcBattleResultForPlayerTurn(e,t,n=!1){return this._wwa.callUserDefinedBattleDamageFunction(`playerToEnemy`,(n||void 0)&&{playerStatus:e,enemyStatus:t})||{damage:this._calcDamageDefault(e,t)}}calcBattleResultForEnemyTurn(e,t,n=!1){return this._wwa.callUserDefinedBattleDamageFunction(`enemyToPlayer`,(n||void 0)&&{playerStatus:t,enemyStatus:e})||{damage:this._calcDamageDefault(e,t)}}_calcDamageDefault(e,t){let n=e.strength-t.defence;return n>0?n:0}fight(){if(!this.isFighting())throw Error(`バトルが開始されていません。`);if(this._battleTurnLength===0&&this._battleFrameCounter===R.BATTLE_INTERVAL_FRAME_NUM&&this._wwa.showMonsterWindow(),--this._battleFrameCounter>0)return;this._battleTurnLength++,this._wwa.isBattleSpeedIndexForQuickBattle(this._speedIndex)||this._battleTurnLength>R.BATTLE_SPEED_CHANGE_TURN_NUM?(this._battleTurnLength===1&&(this._wwa.playAttackSound(),this._wwa.vibration(!1)),this._battleFrameCounter=1):(this._battleFrameCounter=R.BATTLE_INTERVAL_FRAME_NUM,this._wwa.playAttackSound(),this._wwa.vibration(!0));var e=this.getStatus(),t=this._enemy.status;let n=!1;if(this._isPlayerTurn){if(this._battleTurnLength===1&&this._wwa.isUsingDefaultDamageCalcFunction()&&e.strength<=t.defence&&e.defence>=t.strength){this._enemy.battleEndProcess(),this._wwa.registerSystemMessagePageByKey(g.CANNOT_DAMAGE_MONSTER),this._battleTurnLength=0,this._enemy=null,this._state=0;return}let{damage:r,aborted:i}=this.calcBattleResultForPlayerTurn(e,t);this._enemy.damage(r),n=!!i,this._enemy.status.energy<=0&&(this._wwa.playSound(this._wwa.getObjectAttributeById(this._enemy.partsID,R.ATR_SOUND)),this.earnGold(t.gold),this._wwa.setStatusChangedEffect(new x(0,0,0,t.gold)),this._enemy.item===0?this._wwa.setPartsOnPosition(j.OBJECT,0,this._enemy.position):this._wwa.setPartsOnPosition(j.OBJECT,this._enemy.item,this._enemy.position),this._wwa.reserveAppearPartsInNextFrame(this._enemy.position,A.OBJECT,this._enemy.partsID),this._state=0,this._wwa.registerPageByMessage(this._enemy.message,{triggerParts:{id:this._enemy.partsID,type:j.OBJECT,position:this._enemy.position}}),this._enemy.battleEndProcess(),this._battleTurnLength=0,this._battleNoDamageTurnLength=0,this._enemy=null),this._enemy!==null&&(r===0?this._battleNoDamageTurnLength++:this._battleNoDamageTurnLength=0),this._isPlayerTurn=!1}else{let{damage:r,aborted:i}=this.calcBattleResultForEnemyTurn(t,e);this.damage(r),n=!!i,this._status.energy<=0&&(this.setEnergy(0),this._enemy.battleEndProcess(),this._state=0,this._battleTurnLength=0,this._battleNoDamageTurnLength=0,this._enemy=null,this._wwa.shouldApplyGameOver({isAssignment:!1})&&this._wwa.gameover()),r===0?this._battleNoDamageTurnLength++:this._battleNoDamageTurnLength=0,this._isPlayerTurn=!0}(this._battleNoDamageTurnLength>R.FIGHT_DRAW_TURN||n)&&(this._enemy.battleEndProcess(),this._state=0,this._wwa.registerSystemMessagePageByKey(g.BATTLE_NOT_SETTLED),this._battleTurnLength=0,this._battleNoDamageTurnLength=0,this._enemy=null)}readyToUseItem(e){var t;if(!this.canUseItem(e))throw Error(`アイテムがないか、アイテムが使えません。`);t=this._itemBox[e-1],this._wwa.getObjectAttributeById(t,R.ATR_STRING),this._wwa.reserveAppearPartsInNextFrame(this._position.getPartsCoord(),A.OBJECT,t),this._readyToUseItemPos1To12=e,this._isReadyToUseItem=!0}isReadyToUseItem(){return this._isReadyToUseItem}getDrawingCenterPosition(){var e=this._position.getPartsCoord(),t=this._position.getOffsetCoord(),n=this._camera.getPosition(),r=n.getPartsCoord(),i=n.getOffsetCoord();return new S((e.x-r.x)*R.CHIP_SIZE+t.x-i.x+R.CHIP_SIZE/2,(e.y-r.y)*R.CHIP_SIZE+t.y-i.y+R.CHIP_SIZE/2)}mainFrameCount(){this._frameCount++}getFrameCount(){return this._frameCount}setFrameCount(e){return typeof e!=`number`&&(e=0),this._frameCount=e}getMoveCount(){return this._moves}setMoveCount(e){return this._moves=e}isMoveObjectAutoExecTime(){return this._moveObjectAutoExecTimer===0}setMoveMacroWaiting(e){e<0||(this._moveMacroWaitingRemainMoves=e,this._moveObjectAutoExecTimer=0)}resetMoveObjectAutoExecTimer(){this._moveObjectAutoExecTimer=R.CHIP_SIZE/de[this._speedIndex],this._moveMacroWaitingRemainMoves--}decrementMoveObjectAutoExecTimer(){return this._moveMacroWaitingRemainMoves>=0&&this._moveObjectAutoExecTimer>0&&(this._moveObjectAutoExecTimer--,this._moveMacroWaitingRemainMoves===0&&this._moveObjectAutoExecTimer===0&&(this._afterMoveMacroFlag=!0)),0}isWaitingMoveMacro(){return this._moveMacroWaitingRemainMoves!==0||this._moveObjectAutoExecTimer!==0}decrementLookingAroundTimer(){return this._isPreparedForLookingAround&&this._lookingAroundTimer>0?--this._lookingAroundTimer:0}isLookingAround(){return this._isPreparedForLookingAround&&this._lookingAroundTimer===0}getSpeedIndex(){return this._speedIndex}speedUp(){return this._speedIndex=Math.min(R.MAX_SPEED_INDEX,this._speedIndex+1)}speedDown(){return this._speedIndex=Math.max(R.MIN_SPEED_INDEX,this._speedIndex-1)}setSpeedIndex(e){if(e<R.MIN_SPEED_INDEX||R.MAX_SPEED_INDEX<e)throw Error(`#set_speed の引数が異常です:`+e);return this._speedIndex=e,this._speedIndex}isPausing(){return this.isJumped()||this.isWaitingMessageOrManualPause()||this.isWaitingPasswordWindow()||this.isWaitingEstimateWindow()||this.isWaitingMoveMacro()||this.isFighting()}constructor(e,t,n,r,i,a,o){super(t),this.itemTransitioningClassName=`item-transitioning`,this.overwittenItemClassName=`item-overwritten`,this.overwittenItemSelector=`.${this.overwittenItemClassName}`,this.itemEffectStartTimers=Array(R.ITEMBOX_SIZE),this._status=r,this._equipStatus=new b(0,0),this._itemBox=Array(R.ITEMBOX_SIZE),this._itemBoxElement=Array(R.ITEMBOX_SIZE),this._itemUsingEvent=Array(R.ITEMBOX_SIZE);for(var s=0;s<this._itemBox.length;s++)this._itemBox[s]=0,this._itemBoxElement[s]=Re(`#item`+s+`>.item-disp`);this.updateItemBox(),this._energyMax=i,this._dir=E.DOWN,this._isMovingImage=!1,this._wwa=e,this._state=0,this._camera=n,this._isPartsEventExecuted=!1,this._energyValueElement=Re(`#disp-energy>.status-value-box`),this._strengthValueElement=Re(`#disp-strength>.status-value-box`),this._defenceValueElement=Re(`#disp-defence>.status-value-box`),this._goldValueElement=Re(`#disp-gold>.status-value-box`),this._isReadyToUseItem=!1,this._isClickableItemGot=!1,this._moves=a,this._moveMacroWaitingRemainMoves=0,this._moveObjectAutoExecTimer=0,this.updateStatusValueBox(),this._partsAppeared=!1,this._afterMoveMacroFlag=!1,this._isPreparedForLookingAround=!0,this._lookingAroundTimer=R.PLAYER_LOOKING_AROUND_START_FRAME,this._speedIndex=o,this._messageDelayFrameCount=0,this._battleNoDamageTurnLength=0}},Yn=class e{constructor(e,t,n,r,i,a,o){this._partsID=e,this._position=t,this._imgCoord=n,this._status=r,this._message=i,this._item=a,this._battleEndCallback=o}get partsID(){return this._partsID}get position(){return this._position}get imgCoord(){return this._imgCoord}get status(){return this._status}get message(){return this._message}get item(){return this._item}damage(e){this._status.energy=Math.max(0,this._status.energy-e)}battleEndProcess(){this._battleEndCallback?.()}setStatus(e){e.energy!==null&&(this._status.energy=e.energy),e.strength!==null&&(this._status.strength=e.strength),e.defence!==null&&(this._status.defence=e.defence)}clone(){return new e(this._partsID,this._position.clone(),this._imgCoord.clone(),this._status.clone(),this._message,this._item,this._battleEndCallback)}},Xn=class{constructor(e,t,n,r,i){this._player=e,this._objectID=t,this._srcPos=n,this._destPos=r,this._dir=i,this._currentPos=this._srcPos.clone()}update(){var e=this._player.getSpeedIndex();return this._currentPos=this._currentPos.getNextFramePosition(this._dir,de[e],de[e]),this._currentPos}get isAchievedDestination(){return this._currentPos.equals(this._destPos)}get currentPosition(){return this._currentPos}get beforePosition(){return this._srcPos}get destination(){return this._destPos}get objID(){return this._objectID}},Zn=class{constructor(e,t){this._wwa=e,this._player=t,this.clear()}add(e,t,n,r){this._queue.push(new Xn(this._player,e,t,n,r))}update(){for(var e=[],t=[],n=0;n<this._queue.length;n++)this._queue[n].update(),this._queue[n].isAchievedDestination?(e.push(this._queue[n]),this._wwa.setPartsOnPosition(j.OBJECT,0,this._queue[n].beforePosition.getPartsCoord()),this._wwa.setPartsOnPosition(j.OBJECT,this._queue[n].objID,this._queue[n].destination.getPartsCoord())):t.push(this._queue[n]);return this._queue=t,e}clear(){this._queue=[]}get objectMovingData(){return this.objectMovingData}getOffsetByBeforePartsCoord(e){var t=this._queue.filter(t=>t.beforePosition.getPartsCoord().equals(e));return t.length===0?null:t[0].currentPosition.getOffsetCoord()}},Qn=(e,t)=>{if(e[0]===`+`){let n=parseInt(e.substring(1,10));if(Number.isNaN(n))throw Error(`+ 以降の文字列は数値形式で記載してください。`);return t+n}else if(e[0]===`-`){let n=parseInt(e.substring(1,10));if(Number.isNaN(n))throw Error(`- 以降の文字列は数値形式で記載してください。`);return t-n}let n=parseInt(e,10);if(Number.isNaN(n))throw Error(`数値形式ではないため、解析できません。`);return n},$n=class{constructor(e,t,n,r){this._wwa=e,this._triggerParts=t,this.macroType=n,this.macroArgs=r}isJunction(){return[I.IF,I.ELSE_IF,I.ELSE,I.END_IF].includes(this.macroType)}execute(){try{switch(this.macroType){case I.IMGPLAYER:return this._executeImgPlayerMacro(),{};case I.IMGYESNO:return this._executeImgYesNoMacro(),{};case I.HPMAX:return this._executeHPMaxMacro(),{};case I.SAVE:return this._executeSaveMacro(),{};case I.ITEM:return this._executeItemMacro(),{};case I.DEFAULT:return this._executeDefaultMacro(),{};case I.OLDMAP:return this._executeOldMapMacro(),{};case I.PARTS:return this._executePartsMacro(),{};case I.MOVE:return this._executeMoveMacro(),{};case I.MAP:return this._executeMapMacro(1),{};case I.DIRMAP:return this._executeDirMapMacro(),{};case I.IMGFRAME:return this._executeImgFrameMacro(),{};case I.IMGBOM:return this._executeImgBomMacro(),{};case I.DELPLAYER:return this._executeDelPlayerMacro(),{};case I.FACE:return this._executeFaceMacro(),{};case I.EFFECT:return this._executeEffectMacro(),{};case I.GAMEOVER:return this._executeGameOverMacro(),{};case I.IMGCLICK:return this._executeImgClickMacro(),{};case I.STATUS:{let{isGameOver:e}=this._executeStatusMacro();return{isGameOver:e}}case I.EFFITEM:return this._executeEffItemMacro(),{};case I.COLOR:return this._executeColorMacro(),{};case I.WAIT:return this._executeWaitMacro(),{};case I.SOUND:return this._executeSoundMacro(),{};case I.GAMEPAD_BUTTON:return this._executeGamePadButtonMacro(),{};case I.OLDMOVE:return this._executeOldMoveMacro(),{};case I.JUMPGATE:return this._executeJumpGateMacro(),{};case I.RECPOSITION:return this._executeRecPositionMacro(),{};case I.JUMPRECPOSITION:return this._executeJumpRecPositionMacro(),{};case I.CONSOLE_LOG:return this._executeConsoleLogMacro(1),{};case I.COPY_HP_TO:return this._executeCopyHpToMacro(),{};case I.SET_HP:{let{isGameOver:e}=this._executeSetHPMacro();return{isGameOver:e}}case I.COPY_HPMAX_TO:return this._executeCopyHpMaxToMacro(),{};case I.SET_HPMAX:return this._executeSetHpMaxMacro(),{};case I.COPY_AT_TO:return this._executeCopyAtToMacro(),{};case I.SET_AT:return this._executeSetAtMacro(),{};case I.COPY_DF_TO:return this._executeCopyDfToMacro(),{};case I.SET_DF:return this._executeSetDfMacro(),{};case I.COPY_MONEY_TO:return this._executeCopyMoneyToMacro(),{};case I.SET_MONEY:return this._executeSetMoneyMacro(),{};case I.COPY_STEP_COUNT_TO:return this._executeSetStepCountMacro(),{};case I.VAR_SET_VAL:return this._executeVarSetValMacro(),{};case I.VAR_SET:return this._executeVarSetMacro(),{};case I.VAR_ADD:return this._executeVarAddMacro(),{};case I.VAR_SUB:return this._executeVarSubMacro(),{};case I.VAR_MUL:return this._executeVarMulMacro(),{};case I.VAR_DIV:return this._executeVarDivMacro(),{};case I.VAR_MOD:return this._executeVarModMacro(),{};case I.VAR_SET_RAND:return this._executeVarSetRandMacro(),{};case I.GAME_SPEED:return this._executeGameSpeedMacro(),{};case I.SHOW_STR:return{};case I.SHOW_STR2:return{};case I.IF:return{};case I.LEGACY_IF:return this._executeLegacyIfMacro(),{};case I.ELSE_IF:return{};case I.ELSE:return{};case I.END_IF:return{};case I.SET_SPEED:return this._executeSetSpeedMacro(),{};case I.COPY_TIME_TO:return this._executeCopyTimeToMacro(),{};case I.HIDE_STATUS:return this._executeHideStatusMacro(),{};case I.VAR_MAP:return this._executeVarMapMacro(),{};case I.NO_GAMEOVER:return this._executeNoGameOverMacro(),{};case I.SET:{let{isGameOver:e}=this._executeSetMacro();return{isGameOver:e}}case I.MAP2:return this._executeMapMacro(2),{};case I.CONSOLE_LOG2:return this._executeConsoleLogMacro(2),{};case I.DELAYBGM:return this._executeDelayBgmMacro(),{};case I.SYSMSG:return this._executeSysMsgMacro(),{};case I.PICTURE:return this._executePictureMacro(),{};case I.DISABLE_BATTLE_REPORT:return this._executeDisableBattleReportMacro(),{};default:return console.log(`不明なマクロIDが実行されました:`+this.macroType),{}}}catch{}}_concatEmptyArgs(e){if(this.macroArgs.length<e){for(var t=Array(e-this.macroArgs.length),n=0;n<t.length;n++)t[n]=``;this.macroArgs=this.macroArgs.concat(t)}}_evaluateIntValue(e,t=0){let n=this.macroArgs[e];if(n===``)return t;let r=Number(n),i=r>=0?Math.floor(r):Math.ceil(r);return isNaN(i)?Kt(n,this._wwa.generateTokenValues(this._triggerParts),t):i}_executeJumpGateMacro(){this._concatEmptyArgs(3);let e=this._evaluateIntValue(0),t=this._evaluateIntValue(1),n=this._evaluateIntValue(2,E.NO_DIRECTION);if(!Je(n))throw TypeError(`この値の向きにプレイヤーを向けることはできません:`+n);this._wwa.forcedJumpGate(e,t,n)}_executeRecPositionMacro(){this._concatEmptyArgs(2);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1);this._wwa.recUserPosition(e,t)}_executeJumpRecPositionMacro(){this._concatEmptyArgs(2);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1);this._wwa.jumpRecUserPosition(e,t)}_executeConsoleLogMacro(e){this._concatEmptyArgs(1);let t=this._evaluateIntValue(0);switch(e){case 1:this._wwa.outputUserVar(t);return;case 2:console.log(`${this.macroArgs[0]} = ${t}`);return}}_executeCopyHpToMacro(){this._concatEmptyArgs(1);var e=this._evaluateIntValue(0);this._wwa.setUserVarHP(e)}_executeCopyHpMaxToMacro(){this._concatEmptyArgs(1);var e=this._evaluateIntValue(0);this._wwa.setUserVarHPMAX(e)}_executeCopyAtToMacro(){this._concatEmptyArgs(2);let e=this._evaluateIntValue(0),t=this._parseStatusKind(this._evaluateIntValue(1));this._wwa.setUserVarAT(e,t)}_executeCopyDfToMacro(){this._concatEmptyArgs(2);let e=this._evaluateIntValue(0),t=this._parseStatusKind(this._evaluateIntValue(1));this._wwa.setUserVarDF(e,t)}_parseStatusKind(e){switch(e){case 0:return`all`;case 1:return`bare`;case 2:return`equipment`;default:return`all`}}_executeCopyMoneyToMacro(){this._concatEmptyArgs(1);var e=this._evaluateIntValue(0);this._wwa.setUserVarMONEY(e)}_executeSetHPMacro(){this._concatEmptyArgs(1);var e=this._evaluateIntValue(0);return this._wwa.setHPUserVar(e,!0)}_executeSetHpMaxMacro(){this._concatEmptyArgs(1);var e=this._evaluateIntValue(0);this._wwa.setHPMAXUserVar(e)}_executeSetAtMacro(){this._concatEmptyArgs(1);var e=this._evaluateIntValue(0);this._wwa.setATUserVar(e)}_executeSetDfMacro(){this._concatEmptyArgs(1);var e=this._evaluateIntValue(0);this._wwa.setDFUserVar(e)}_executeSetMoneyMacro(){this._concatEmptyArgs(1);var e=this._evaluateIntValue(0);this._wwa.setMONEYUserVar(e)}_executeSetStepCountMacro(){this._concatEmptyArgs(1);var e=this._evaluateIntValue(0);this._wwa.setUserVarStep(e)}_executeVarSetValMacro(){this._concatEmptyArgs(2);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1);this._wwa.setUserVarVal(e,t)}_executeVarSetMacro(){this._concatEmptyArgs(2);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1);this._wwa.setUserValOtherUserVal(e,t)}_executeVarAddMacro(){this._concatEmptyArgs(2);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1);this._wwa.setUserValAdd(e,t)}_executeVarSubMacro(){this._concatEmptyArgs(2);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1);this._wwa.setUserValSub(e,t)}_executeVarMulMacro(){this._concatEmptyArgs(2);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1);this._wwa.setUserValMul(e,t)}_executeVarDivMacro(){this._concatEmptyArgs(2);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1);this._wwa.setUserValDiv(e,t)}_executeVarModMacro(){this._concatEmptyArgs(2);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1);this._wwa.setUserValMod(e,t)}_executeVarSetRandMacro(){this._concatEmptyArgs(3);let e=this._evaluateIntValue(0),t=this._evaluateIntValue(1),n=this._evaluateIntValue(2,0);this._wwa.setUserValRandNum(e,t,n)}_executeGameSpeedMacro(){this._concatEmptyArgs(1);var e=!!this._evaluateIntValue(0);this._wwa.speedChangeJudge(e)}_executeLegacyIfMacro(){for(var e=Array(11),t=0;t<10;t++)e[t]=this.macroArgs[t];this._wwa.userVarUserIf(this._triggerParts.position,e)}_executeSetSpeedMacro(){this._concatEmptyArgs(1);var e=this._evaluateIntValue(0);this._wwa.setPlayerSpeedIndex(e-1)}_executeCopyTimeToMacro(){this._concatEmptyArgs(1);var e=this._evaluateIntValue(0);this._wwa.setUserVarPlayTime(e)}_executeHideStatusMacro(){this._concatEmptyArgs(2);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1)!==0;this._wwa.hideStatus(e,t)}_executeVarMapMacro(){this._concatEmptyArgs(4);var e=this._evaluateIntValue(0),t=this.macroArgs[1],n=this.macroArgs[2],r=this._evaluateIntValue(3,j.OBJECT);if(e<0)throw Error(`入力変数が不正です`);this._wwa.varMap(this._triggerParts.position,t,n,e,r)}_executeImgPlayerMacro(){this._concatEmptyArgs(2);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1);this._wwa.setPlayerImgCoord(new S(e,t))}_executeImgYesNoMacro(){this._concatEmptyArgs(2);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1);this._wwa.setYesNoImgCoord(new S(e,t))}_executeHPMaxMacro(){this._concatEmptyArgs(1);var e=Math.max(0,this._evaluateIntValue(0));this._wwa.setPlayerEnergyMax(e)}_executeSaveMacro(){this._concatEmptyArgs(1);var e=!!this._evaluateIntValue(0);this._wwa.disableSave(e)}_executeItemMacro(){this._concatEmptyArgs(2);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1);this._wwa.setPlayerGetItem(e,t)}_executeDefaultMacro(){this._concatEmptyArgs(1);var e=!!this._evaluateIntValue(0);this._wwa.setObjectNotCollapseOnPartsOnPlayer(e)}_executeOldMapMacro(){this._concatEmptyArgs(1);var e=!!this._evaluateIntValue(0);this._wwa.setOldMap(e)}_executePartsMacro(){this._concatEmptyArgs(4);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1),n=this._evaluateIntValue(2,j.OBJECT),r=this._evaluateIntValue(3);if(n!==j.OBJECT&&n!==j.MAP)throw Error(`パーツ種別が不明です`);if(r!==0&&r!==1&&(r=1),e<0||t<0)throw Error(`パーツ番号が不正です`);if(n===j.OBJECT){if(e>=this._wwa.getObjectPartsNum()||t>=this._wwa.getObjectPartsNum())throw Error(`パーツ番号が不正です`)}else if(e>=this._wwa.getMapPartsNum()||t>=this._wwa.getMapPartsNum())throw Error(`パーツ番号が不正です`);this._wwa.replaceParts(e,t,n,!!r)}_executeMoveMacro(){this._concatEmptyArgs(1);var e=this._evaluateIntValue(0);this._wwa.setMoveMacroWaitingToPlayer(e)}_executeMapMacro(e){this._concatEmptyArgs(4);let t=this._evaluateIntValue(0);var n=this._evaluateIntValue(3,j.OBJECT);if(t<0)throw Error(`パーツ番号が不正です`);if(n===j.OBJECT){if(t>=this._wwa.getObjectPartsNum())throw Error(`パーツ番号が不正です`)}else if(t>=this._wwa.getMapPartsNum())throw Error(`パーツ番号が不正です`);if(e===1){let e=this.macroArgs[1],r=this.macroArgs[2];this._wwa.appearPartsEval(this._triggerParts.position,e,r,t,n)}else if(e===2){let e=this._evaluateIntValue(1),r=this._evaluateIntValue(2);if(isNaN(e)||isNaN(r))throw Error(`出現先座標が不正です`);this._wwa.appearPartsEval(this._triggerParts.position,`${e}`,`${r}`,t,n)}}_executeDirMapMacro(){this._concatEmptyArgs(3);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1),n=this._evaluateIntValue(2,j.OBJECT);if(isNaN(e)||isNaN(t)||isNaN(n))throw Error(`引数が整数ではありません`);if(e<0)throw Error(`パーツ番号が不正です`);if(n===j.OBJECT){if(e>=this._wwa.getObjectPartsNum())throw Error(`パーツ番号が不正です`)}else if(e>=this._wwa.getMapPartsNum())throw Error(`パーツ番号が不正です`);this._wwa.appearPartsByDirection(t,e,n)}_executeImgFrameMacro(){this._concatEmptyArgs(3);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1),n=this._evaluateIntValue(2);if(t<0||n<0)throw Error(`座標は正でなければなりません。`);if(e===L.ENERGY||e===L.STRENGTH||e===L.DEFENCE||e===L.GOLD)this._wwa.setStatusIconCoord(e,new S(t,n));else if(e===L.WIDE_CELL_ROW)this._wwa.setWideCellCoord(new S(t,n));else if(e===L.ITEM_BG)this._wwa.setItemboxBackgroundPosition({x:t,y:n});else if(e===L.MAIN_FRAME)this._wwa.setFrameCoord(new S(t,n));else throw Error(`種別が不正です。`)}_executeImgBomMacro(){this._concatEmptyArgs(2);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1);if(e<0||t<0)throw Error(`座標は正でなければなりません。`);this._wwa.setBattleEffectCoord(new S(e,t))}_executeDelPlayerMacro(){this._concatEmptyArgs(1);let e=this._evaluateIntValue(0);this._wwa.setDelPlayer(!!e)}_executeFaceMacro(){this._concatEmptyArgs(6);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1),n=this._evaluateIntValue(2),r=this._evaluateIntValue(3),i=this._evaluateIntValue(4),a=this._evaluateIntValue(5),o;if(e<0||t<0||n<0||r<0||i<0||a<0)throw Error(`各引数は0以上の整数でなければなりません。`);o=new w(new S(e,t),new S(n,r),new S(i,a)),this._wwa.addFace(o)}_executeEffectMacro(){this._concatEmptyArgs(1);var e=this._evaluateIntValue(0);if(e<0)throw Error(`待ち時間は0以上の整数でなければなりません。`);if(e===0){this._wwa.stopEffect();return}for(var t=[],n=1;n<this.macroArgs.length;n+=2){var r=this._evaluateIntValue(n),i=0;if(r<0)throw Error(`画像のパーツ座標指定は0以上の整数でなければなりません。`);if(n+1===this.macroArgs.length)throw Error(`画像のパーツ座標指定で、Y座標が指定されていません。`);if(i=this._evaluateIntValue(n+1),i<0)throw Error(`画像のパーツ座標指定は0以上の整数でなければなりません。`);t.push(new S(r,i))}this._wwa.setEffect(e,t)}_executeGameOverMacro(){this._concatEmptyArgs(2);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1);if(e<0||e>=this._wwa.getMapWidth()||t<0||t>=this._wwa.getMapWidth())throw Error(`マップの範囲外が指定されています!`);this._wwa.setGameOverPosition(new S(e,t))}_executeImgClickMacro(){if(this._concatEmptyArgs(2),this.macroArgs.length<1)throw Error(`引数が少なすぎます`);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1);if(e<0||t<0)throw Error(`引数が0以上の整数ではありません`);this._wwa.setImgClick(new S(e,t))}_executeEffItemMacro(){if(this.macroArgs.length<1)throw Error(`引数が少なすぎます`);var e=this._evaluateIntValue(0);this._wwa.updateItemEffectEnabled(!!e)}_executeStatusMacro(){this._concatEmptyArgs(2);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1);if(e<0||4<e)throw Error(`ステータス種別が範囲外です。`);return this._wwa.setPlayerStatus(e,t,!0)}_executeColorMacro(){this._concatEmptyArgs(4);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1),n=this._evaluateIntValue(2),r=this._evaluateIntValue(3);if(e<0||e>5)throw Error(`種別は0から5までです`);if(t<0||t>255||n<0||n>255||r<0||r>255)throw Error(`色が範囲外です`);this._wwa.changeStyleRule(e,t,n,r)}_executeWaitMacro(){throw Error(`Not implemented!`)}_executeSoundMacro(){this._concatEmptyArgs(2);let e=parseInt(this.macroArgs[0]),t=parseInt(this.macroArgs[1]);this._wwa.playSound(e,{bgmDelayDurationMs:t})}_executeGamePadButtonMacro(){this._concatEmptyArgs(2);var e=this._evaluateIntValue(0),t=this._evaluateIntValue(1);if(e<0||t<0)throw Error(`各引数は0以上の整数でなければなりません。`);if(t>R.ITEMBOX_SIZE)throw Error(`アイテムボックス上限を超えた数値が指定されました。`);this._wwa.setGamePadButtonItemTable(e,t)}_executeOldMoveMacro(){this._concatEmptyArgs(1);let e=!!this._evaluateIntValue(0);this._wwa.setOldMove(e)}_executeNoGameOverMacro(){this._concatEmptyArgs(1);let e=this._evaluateIntValue(0);this._wwa.setGameOverPolicy(e)}_executeSetMacro(){return this._wwa.execSetMacro(this.macroArgs[0],{triggerParts:this._triggerParts})}_executePictureMacro(){if(this._concatEmptyArgs(3),this.macroArgs.length<1)throw Error(`引数が少なすぎます`);let e=this._evaluateIntValue(0),t=this.macroArgs[1].length>0?this.macroArgs[1]:`+0`;if(t===`0`){this._wwa.deletePictureRegistry(e);return}let n=Qn(t,this._triggerParts.id);if(n===0)throw Error(`パーツ番号の相対値算出で0が検出されました。ピクチャを消去する場合は0のまま指定してください。`);if(n<0)throw Error(`パーツ番号は0以上の整数でなければなりません。`);let r=this._evaluateIntValue(2,j.OBJECT);this._wwa.setPictureRegistry(e,n,r,this._triggerParts.position)}_executeDisableBattleReportMacro(){this._concatEmptyArgs(1);let e=!!this._evaluateIntValue(0);this._wwa.disableBattleEstimate(e)}_executeDelayBgmMacro(){this._concatEmptyArgs(1);let e=this._evaluateIntValue(0);this._wwa.setBgmDelay(e)}_executeSysMsgMacro(){this._concatEmptyArgs(2);let e=this.resolveSystemMessageKeyFromMacroArg(this.macroArgs[0]);if(!e)throw Error(`該当するシステムメッセージの定義がありません`);let t=this.macroArgs[1]===``?void 0:this.macroArgs[1].replaceAll(`\\n`,`
|
|
32
32
|
`);this._wwa.overwriteSystemMessage(e,t)}resolveSystemMessageKeyFromMacroArg(e){return v(e)?e:y(this._evaluateIntValue(0))}};function er(e,t,n){let r=n.match(/^\$([a-zA-Z_][a-zA-Z0-9_]*)\=(.*)$/);if((r===null||r.length!==3)&&(r=n.match(/^\$([a-zA-Z_][a-zA-Z0-9_]*)/),r===null||r.length!==2))throw Error(`マクロではありません`);let i=`$${r[1].toLowerCase()}`,a=i===`$if`&&n.match(/,/)?I.LEGACY_IF:le[i],o=a!==I.SHOW_STR&&a!==I.SHOW_STR2,s=(r[2]??``).split(`,`).map(e=>o?e.trim():e);return new $n(e,t,a===void 0?I.UNDEFINED:a,s)}var tr=class{constructor(e){this.generateTokenValues=e}static executeNodes(e,t){try{return{isError:!1,messages:e?.execute(t)??[]}}catch(e){return console.error(e),{isError:!0}}}},nr=class extends tr{constructor(e=[],t){super(t),this.branches=e}appendBranch(e){this.branches.push(e)}getLastUnconnectedBranch(){for(let e of this.branches)if(!e.next)return e}evaluateAndGetNextNode(e){for(let t of this.branches)if(!t.descriminant||Rt(t.descriminant,this.generateTokenValues(e)))return t.next}hasElseBranch(){return this.branches.filter(e=>!!e.elseBranch).length>=1}execute(e){if(!e)throw Error(`パーツ起因ページによる実行ではないため、Junctionノードの利用を想定していません。`);let t=this.evaluateAndGetNextNode(e);return t?t.execute(e):[]}},rr=class e extends tr{constructor(e,t,n,r,i,a){super(t),this.evalScript=n,this.macro=r,this.next=i,this.script=a,this.messageSegments=this.parseMessage(e),this.macro===void 0&&(this.macro=[])}isEmpty(){return this.messageSegments.reduce((e,t)=>e&&t===``,!0)}generatePrintableMessage(){return this.messageSegments.reduce((e,t)=>`${e}${typeof t==`string`?t:t()}`,``)}appendMessage(e,t=!1){this.messageSegments=this.messageSegments.concat(t?[`
|
|
33
33
|
`]:[],this.parseMessage(e))}static createEmptyMessage(t,n,r){return new e([],t,n,void 0,void 0,r)}parseMessage(e){return typeof e==`string`?[e]:e}execute(e){return this.script&&this.evalScript(this.script,e),this.macro?.forEach(e=>{if(e.execute().isGameOver)throw Error(`ゲームオーバーのため、メッセージ・マクロの実行を打ち切ります。`)}),this.next?[this,...this.next.execute(e)]:[this]}};function ir(e){return e.split(/\n\<c\>/i)[0].split(/\<c\>/i)[0].replace(/\n\<p\>\n/gi,`<P>`).replace(/\n\<p\>/gi,`<P>`).replace(/\<p\>\n/gi,`<P>`).replace(/\<p\>/gi,`<P>`).split(`
|
|
34
34
|
`).map(e=>{if(!e.startsWith(`//`))return e.match(/\/\//)?Ue(Ue(e).replace(/^.*\/\/(?!:s?ptth)/gi,``)):e}).filter(e=>e!==void 0).join(`
|
|
@@ -90,8 +90,8 @@ ${t?Fe():``}
|
|
|
90
90
|
`,n-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(_a).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=J.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=e.sourceType===`module`,this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports={},this.pos===0&&e.allowHashBang&&this.input.slice(0,2)===`#!`&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(Pa),this.regexpState=null},Za={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0}};Xa.prototype.parse=function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)},Za.inFunction.get=function(){return(this.currentVarScope().flags&Fa)>0},Za.inGenerator.get=function(){return(this.currentVarScope().flags&Ra)>0},Za.inAsync.get=function(){return(this.currentVarScope().flags&La)>0},Za.allowSuper.get=function(){return(this.currentThisScope().flags&Va)>0},Za.allowDirectSuper.get=function(){return(this.currentThisScope().flags&Ha)>0},Za.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},Xa.prototype.inNonArrowFunction=function(){return(this.currentThisScope().flags&Fa)>0},Xa.extend=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var n=this,r=0;r<e.length;r++)n=e[r](n);return n},Xa.parse=function(e,t){return new this(t,e).parse()},Xa.parseExpressionAt=function(e,t,n){var r=new this(n,e,t);return r.nextToken(),r.parseExpression()},Xa.tokenizer=function(e,t){return new this(t,e)},Object.defineProperties(Xa.prototype,Za);var Qa=Xa.prototype,$a=/^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/;Qa.strictDirective=function(e){for(;;){xa.lastIndex=e,e+=xa.exec(this.input)[0].length;var t=$a.exec(this.input.slice(e));if(!t)return!1;if((t[1]||t[2])===`use strict`){xa.lastIndex=e+t[0].length;var n=xa.exec(this.input),r=n.index+n[0].length,i=this.input.charAt(r);return i===`;`||i===`}`||_a.test(n[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(i)||i===`!`&&this.input.charAt(r+1)===`=`)}e+=t[0].length,xa.lastIndex=e,e+=xa.exec(this.input)[0].length,this.input[e]===`;`&&e++}},Qa.eat=function(e){return this.type===e?(this.next(),!0):!1},Qa.isContextual=function(e){return this.type===J.name&&this.value===e&&!this.containsEsc},Qa.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1},Qa.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},Qa.canInsertSemicolon=function(){return this.type===J.eof||this.type===J.braceR||_a.test(this.input.slice(this.lastTokEnd,this.start))},Qa.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},Qa.semicolon=function(){!this.eat(J.semi)&&!this.insertSemicolon()&&this.unexpected()},Qa.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},Qa.expect=function(e){this.eat(e)||this.unexpected()},Qa.unexpected=function(e){this.raise(e??this.start,`Unexpected token`)};function eo(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1}Qa.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,`Comma is not permitted after the rest element`);var n=t?e.parenthesizedAssign:e.parenthesizedBind;n>-1&&this.raiseRecoverable(n,`Parenthesized pattern`)}},Qa.checkExpressionErrors=function(e,t){if(!e)return!1;var n=e.shorthandAssign,r=e.doubleProto;if(!t)return n>=0||r>=0;n>=0&&this.raise(n,`Shorthand property assignments are valid only in destructuring patterns`),r>=0&&this.raiseRecoverable(r,`Redefinition of __proto__ property`)},Qa.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,`Yield expression cannot be a default value`),this.awaitPos&&this.raise(this.awaitPos,`Await expression cannot be a default value`)},Qa.isSimpleAssignTarget=function(e){return e.type===`ParenthesizedExpression`?this.isSimpleAssignTarget(e.expression):e.type===`Identifier`||e.type===`MemberExpression`};var Y=Xa.prototype;Y.parseTopLevel=function(e){var t={};for(e.body||=[];this.type!==J.eof;){var n=this.parseStatement(null,!0,t);e.body.push(n)}if(this.inModule)for(var r=0,i=Object.keys(this.undefinedExports);r<i.length;r+=1){var a=i[r];this.raiseRecoverable(this.undefinedExports[a].start,`Export '`+a+`' is not defined`)}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType,this.finishNode(e,`Program`)};var to={kind:`loop`},no={kind:`switch`};Y.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual(`let`))return!1;xa.lastIndex=this.pos;var t=xa.exec(this.input),n=this.pos+t[0].length,r=this.input.charCodeAt(n);if(r===91)return!0;if(e)return!1;if(r===123)return!0;if(da(r,!0)){for(var i=n+1;fa(this.input.charCodeAt(i),!0);)++i;var a=this.input.slice(n,i);if(!ra.test(a))return!0}return!1},Y.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual(`async`))return!1;xa.lastIndex=this.pos;var e=xa.exec(this.input),t=this.pos+e[0].length;return!_a.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)===`function`&&(t+8===this.input.length||!fa(this.input.charAt(t+8)))},Y.parseStatement=function(e,t,n){var r=this.type,i=this.startNode(),a;switch(this.isLet(e)&&(r=J._var,a=`let`),r){case J._break:case J._continue:return this.parseBreakContinueStatement(i,r.keyword);case J._debugger:return this.parseDebuggerStatement(i);case J._do:return this.parseDoStatement(i);case J._for:return this.parseForStatement(i);case J._function:return e&&(this.strict||e!==`if`&&e!==`label`)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(i,!1,!e);case J._class:return e&&this.unexpected(),this.parseClass(i,!0);case J._if:return this.parseIfStatement(i);case J._return:return this.parseReturnStatement(i);case J._switch:return this.parseSwitchStatement(i);case J._throw:return this.parseThrowStatement(i);case J._try:return this.parseTryStatement(i);case J._const:case J._var:return a||=this.value,e&&a!==`var`&&this.unexpected(),this.parseVarStatement(i,a);case J._while:return this.parseWhileStatement(i);case J._with:return this.parseWithStatement(i);case J.braceL:return this.parseBlock(!0,i);case J.semi:return this.parseEmptyStatement(i);case J._export:case J._import:if(this.options.ecmaVersion>10&&r===J._import){xa.lastIndex=this.pos;var o=xa.exec(this.input),s=this.pos+o[0].length,c=this.input.charCodeAt(s);if(c===40||c===46)return this.parseExpressionStatement(i,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,`'import' and 'export' may only appear at the top level`),this.inModule||this.raise(this.start,`'import' and 'export' may appear only with 'sourceType: module'`)),r===J._import?this.parseImport(i):this.parseExport(i,n);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(i,!0,!e);var l=this.value,u=this.parseExpression();return r===J.name&&u.type===`Identifier`&&this.eat(J.colon)?this.parseLabeledStatement(i,l,u,e):this.parseExpressionStatement(i,u)}},Y.parseBreakContinueStatement=function(e,t){var n=t===`break`;this.next(),this.eat(J.semi)||this.insertSemicolon()?e.label=null:this.type===J.name?(e.label=this.parseIdent(),this.semicolon()):this.unexpected();for(var r=0;r<this.labels.length;++r){var i=this.labels[r];if((e.label==null||i.name===e.label.name)&&(i.kind!=null&&(n||i.kind===`loop`)||e.label&&n))break}return r===this.labels.length&&this.raise(e.start,`Unsyntactic `+t),this.finishNode(e,n?`BreakStatement`:`ContinueStatement`)},Y.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,`DebuggerStatement`)},Y.parseDoStatement=function(e){return this.next(),this.labels.push(to),e.body=this.parseStatement(`do`),this.labels.pop(),this.expect(J._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(J.semi):this.semicolon(),this.finishNode(e,`DoWhileStatement`)},Y.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&(this.inAsync||!this.inFunction&&this.options.allowAwaitOutsideFunction)&&this.eatContextual(`await`)?this.lastTokStart:-1;if(this.labels.push(to),this.enterScope(0),this.expect(J.parenL),this.type===J.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var n=this.isLet();if(this.type===J._var||this.type===J._const||n){var r=this.startNode(),i=n?`let`:this.value;return this.next(),this.parseVar(r,!0,i),this.finishNode(r,`VariableDeclaration`),(this.type===J._in||this.options.ecmaVersion>=6&&this.isContextual(`of`))&&r.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===J._in?t>-1&&this.unexpected(t):e.await=t>-1),this.parseForIn(e,r)):(t>-1&&this.unexpected(t),this.parseFor(e,r))}var a=new eo,o=this.parseExpression(!0,a);return this.type===J._in||this.options.ecmaVersion>=6&&this.isContextual(`of`)?(this.options.ecmaVersion>=9&&(this.type===J._in?t>-1&&this.unexpected(t):e.await=t>-1),this.toAssignable(o,!1,a),this.checkLVal(o),this.parseForIn(e,o)):(this.checkExpressionErrors(a,!0),t>-1&&this.unexpected(t),this.parseFor(e,o))},Y.parseFunctionStatement=function(e,t,n){return this.next(),this.parseFunction(e,io|(n?0:ao),!1,t)},Y.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement(`if`),e.alternate=this.eat(J._else)?this.parseStatement(`if`):null,this.finishNode(e,`IfStatement`)},Y.parseReturnStatement=function(e){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,`'return' outside of function`),this.next(),this.eat(J.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,`ReturnStatement`)},Y.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(J.braceL),this.labels.push(no),this.enterScope(0);for(var t,n=!1;this.type!==J.braceR;)if(this.type===J._case||this.type===J._default){var r=this.type===J._case;t&&this.finishNode(t,`SwitchCase`),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),r?t.test=this.parseExpression():(n&&this.raiseRecoverable(this.lastTokStart,`Multiple default clauses`),n=!0,t.test=null),this.expect(J.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,`SwitchCase`),this.next(),this.labels.pop(),this.finishNode(e,`SwitchStatement`)},Y.parseThrowStatement=function(e){return this.next(),_a.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,`Illegal newline after throw`),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,`ThrowStatement`)};var ro=[];Y.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===J._catch){var t=this.startNode();if(this.next(),this.eat(J.parenL)){t.param=this.parseBindingAtom();var n=t.param.type===`Identifier`;this.enterScope(n?Ba:0),this.checkLVal(t.param,n?Ja:Ka),this.expect(J.parenR)}else this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0);t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,`CatchClause`)}return e.finalizer=this.eat(J._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,`Missing catch or finally clause`),this.finishNode(e,`TryStatement`)},Y.parseVarStatement=function(e,t){return this.next(),this.parseVar(e,!1,t),this.semicolon(),this.finishNode(e,`VariableDeclaration`)},Y.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(to),e.body=this.parseStatement(`while`),this.labels.pop(),this.finishNode(e,`WhileStatement`)},Y.parseWithStatement=function(e){return this.strict&&this.raise(this.start,`'with' in strict mode`),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement(`with`),this.finishNode(e,`WithStatement`)},Y.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,`EmptyStatement`)},Y.parseLabeledStatement=function(e,t,n,r){for(var i=0,a=this.labels;i<a.length;i+=1)a[i].name===t&&this.raise(n.start,`Label '`+t+`' is already declared`);for(var o=this.type.isLoop?`loop`:this.type===J._switch?`switch`:null,s=this.labels.length-1;s>=0;s--){var c=this.labels[s];if(c.statementStart===e.start)c.statementStart=this.start,c.kind=o;else break}return this.labels.push({name:t,kind:o,statementStart:this.start}),e.body=this.parseStatement(r?r.indexOf(`label`)===-1?r+`label`:r:`label`),this.labels.pop(),e.label=n,this.finishNode(e,`LabeledStatement`)},Y.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,`ExpressionStatement`)},Y.parseBlock=function(e,t,n){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(J.braceL),e&&this.enterScope(0);this.type!==J.braceR;){var r=this.parseStatement(null);t.body.push(r)}return n&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,`BlockStatement`)},Y.parseFor=function(e,t){return e.init=t,this.expect(J.semi),e.test=this.type===J.semi?null:this.parseExpression(),this.expect(J.semi),e.update=this.type===J.parenR?null:this.parseExpression(),this.expect(J.parenR),e.body=this.parseStatement(`for`),this.exitScope(),this.labels.pop(),this.finishNode(e,`ForStatement`)},Y.parseForIn=function(e,t){var n=this.type===J._in;return this.next(),t.type===`VariableDeclaration`&&t.declarations[0].init!=null&&(!n||this.options.ecmaVersion<8||this.strict||t.kind!==`var`||t.declarations[0].id.type!==`Identifier`)?this.raise(t.start,(n?`for-in`:`for-of`)+` loop variable declaration may not have an initializer`):t.type===`AssignmentPattern`&&this.raise(t.start,`Invalid left-hand side in for-loop`),e.left=t,e.right=n?this.parseExpression():this.parseMaybeAssign(),this.expect(J.parenR),e.body=this.parseStatement(`for`),this.exitScope(),this.labels.pop(),this.finishNode(e,n?`ForInStatement`:`ForOfStatement`)},Y.parseVar=function(e,t,n){for(e.declarations=[],e.kind=n;;){var r=this.startNode();if(this.parseVarId(r,n),this.eat(J.eq)?r.init=this.parseMaybeAssign(t):n===`const`&&!(this.type===J._in||this.options.ecmaVersion>=6&&this.isContextual(`of`))?this.unexpected():r.id.type!==`Identifier`&&!(t&&(this.type===J._in||this.isContextual(`of`)))?this.raise(this.lastTokEnd,`Complex binding patterns require an initialization value`):r.init=null,e.declarations.push(this.finishNode(r,`VariableDeclarator`)),!this.eat(J.comma))break}return e},Y.parseVarId=function(e,t){e.id=this.parseBindingAtom(),this.checkLVal(e.id,t===`var`?Ga:Ka,!1)};var io=1,ao=2,oo=4;Y.parseFunction=function(e,t,n,r){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===J.star&&t&ao&&this.unexpected(),e.generator=this.eat(J.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&io&&(e.id=t&oo&&this.type!==J.name?null:this.parseIdent(),e.id&&!(t&ao)&&this.checkLVal(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?Ga:Ka:qa));var i=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Ua(e.async,e.generator)),t&io||(e.id=this.type===J.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,n,!1),this.yieldPos=i,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(e,t&io?`FunctionDeclaration`:`FunctionExpression`)},Y.parseFunctionParams=function(e){this.expect(J.parenL),e.params=this.parseBindingList(J.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},Y.parseClass=function(e,t){this.next();var n=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var r=this.startNode(),i=!1;for(r.body=[],this.expect(J.braceL);this.type!==J.braceR;){var a=this.parseClassElement(e.superClass!==null);a&&(r.body.push(a),a.type===`MethodDefinition`&&a.kind===`constructor`&&(i&&this.raise(a.start,`Duplicate constructor in the same class`),i=!0))}return this.strict=n,this.next(),e.body=this.finishNode(r,`ClassBody`),this.finishNode(e,t?`ClassDeclaration`:`ClassExpression`)},Y.parseClassElement=function(e){var t=this;if(this.eat(J.semi))return null;var n=this.startNode(),r=function(e,r){r===void 0&&(r=!1);var i=t.start,a=t.startLoc;return t.eatContextual(e)?t.type!==J.parenL&&(!r||!t.canInsertSemicolon())?!0:(n.key&&t.unexpected(),n.computed=!1,n.key=t.startNodeAt(i,a),n.key.name=e,t.finishNode(n.key,`Identifier`),!1):!1};n.kind=`method`,n.static=r(`static`);var i=this.eat(J.star),a=!1;i||(this.options.ecmaVersion>=8&&r(`async`,!0)?(a=!0,i=this.options.ecmaVersion>=9&&this.eat(J.star)):r(`get`)?n.kind=`get`:r(`set`)&&(n.kind=`set`)),n.key||this.parsePropertyName(n);var o=n.key,s=!1;return!n.computed&&!n.static&&(o.type===`Identifier`&&o.name===`constructor`||o.type===`Literal`&&o.value===`constructor`)?(n.kind!==`method`&&this.raise(o.start,`Constructor can't have get/set modifier`),i&&this.raise(o.start,`Constructor can't be a generator`),a&&this.raise(o.start,`Constructor can't be an async method`),n.kind=`constructor`,s=e):n.static&&o.type===`Identifier`&&o.name===`prototype`&&this.raise(o.start,`Classes may not have a static property named prototype`),this.parseClassMethod(n,i,a,s),n.kind===`get`&&n.value.params.length!==0&&this.raiseRecoverable(n.value.start,`getter should have no params`),n.kind===`set`&&n.value.params.length!==1&&this.raiseRecoverable(n.value.start,`setter should have exactly one param`),n.kind===`set`&&n.value.params[0].type===`RestElement`&&this.raiseRecoverable(n.value.params[0].start,`Setter cannot use rest params`),n},Y.parseClassMethod=function(e,t,n,r){return e.value=this.parseMethod(t,n,r),this.finishNode(e,`MethodDefinition`)},Y.parseClassId=function(e,t){this.type===J.name?(e.id=this.parseIdent(),t&&this.checkLVal(e.id,Ka,!1)):(t===!0&&this.unexpected(),e.id=null)},Y.parseClassSuper=function(e){e.superClass=this.eat(J._extends)?this.parseExprSubscripts():null},Y.parseExport=function(e,t){if(this.next(),this.eat(J.star))return this.options.ecmaVersion>=11&&(this.eatContextual(`as`)?(e.exported=this.parseIdent(!0),this.checkExport(t,e.exported.name,this.lastTokStart)):e.exported=null),this.expectContextual(`from`),this.type!==J.string&&this.unexpected(),e.source=this.parseExprAtom(),this.semicolon(),this.finishNode(e,`ExportAllDeclaration`);if(this.eat(J._default)){this.checkExport(t,`default`,this.lastTokStart);var n;if(this.type===J._function||(n=this.isAsyncFunction())){var r=this.startNode();this.next(),n&&this.next(),e.declaration=this.parseFunction(r,io|oo,!1,n)}else if(this.type===J._class){var i=this.startNode();e.declaration=this.parseClass(i,`nullableID`)}else e.declaration=this.parseMaybeAssign(),this.semicolon();return this.finishNode(e,`ExportDefaultDeclaration`)}if(this.shouldParseExportStatement())e.declaration=this.parseStatement(null),e.declaration.type===`VariableDeclaration`?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id.name,e.declaration.id.start),e.specifiers=[],e.source=null;else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual(`from`))this.type!==J.string&&this.unexpected(),e.source=this.parseExprAtom();else{for(var a=0,o=e.specifiers;a<o.length;a+=1){var s=o[a];this.checkUnreserved(s.local),this.checkLocalExport(s.local)}e.source=null}this.semicolon()}return this.finishNode(e,`ExportNamedDeclaration`)},Y.checkExport=function(e,t,n){e&&(Ta(e,t)&&this.raiseRecoverable(n,`Duplicate export '`+t+`'`),e[t]=!0)},Y.checkPatternExport=function(e,t){var n=t.type;if(n===`Identifier`)this.checkExport(e,t.name,t.start);else if(n===`ObjectPattern`)for(var r=0,i=t.properties;r<i.length;r+=1){var a=i[r];this.checkPatternExport(e,a)}else if(n===`ArrayPattern`)for(var o=0,s=t.elements;o<s.length;o+=1){var c=s[o];c&&this.checkPatternExport(e,c)}else n===`Property`?this.checkPatternExport(e,t.value):n===`AssignmentPattern`?this.checkPatternExport(e,t.left):n===`RestElement`?this.checkPatternExport(e,t.argument):n===`ParenthesizedExpression`&&this.checkPatternExport(e,t.expression)},Y.checkVariableExport=function(e,t){if(e)for(var n=0,r=t;n<r.length;n+=1){var i=r[n];this.checkPatternExport(e,i.id)}},Y.shouldParseExportStatement=function(){return this.type.keyword===`var`||this.type.keyword===`const`||this.type.keyword===`class`||this.type.keyword===`function`||this.isLet()||this.isAsyncFunction()},Y.parseExportSpecifiers=function(e){var t=[],n=!0;for(this.expect(J.braceL);!this.eat(J.braceR);){if(n)n=!1;else if(this.expect(J.comma),this.afterTrailingComma(J.braceR))break;var r=this.startNode();r.local=this.parseIdent(!0),r.exported=this.eatContextual(`as`)?this.parseIdent(!0):r.local,this.checkExport(e,r.exported.name,r.exported.start),t.push(this.finishNode(r,`ExportSpecifier`))}return t},Y.parseImport=function(e){return this.next(),this.type===J.string?(e.specifiers=ro,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual(`from`),e.source=this.type===J.string?this.parseExprAtom():this.unexpected()),this.semicolon(),this.finishNode(e,`ImportDeclaration`)},Y.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===J.name){var n=this.startNode();if(n.local=this.parseIdent(),this.checkLVal(n.local,Ka),e.push(this.finishNode(n,`ImportDefaultSpecifier`)),!this.eat(J.comma))return e}if(this.type===J.star){var r=this.startNode();return this.next(),this.expectContextual(`as`),r.local=this.parseIdent(),this.checkLVal(r.local,Ka),e.push(this.finishNode(r,`ImportNamespaceSpecifier`)),e}for(this.expect(J.braceL);!this.eat(J.braceR);){if(t)t=!1;else if(this.expect(J.comma),this.afterTrailingComma(J.braceR))break;var i=this.startNode();i.imported=this.parseIdent(!0),this.eatContextual(`as`)?i.local=this.parseIdent():(this.checkUnreserved(i.imported),i.local=i.imported),this.checkLVal(i.local,Ka),e.push(this.finishNode(i,`ImportSpecifier`))}return e},Y.adaptDirectivePrologue=function(e){for(var t=0;t<e.length&&this.isDirectiveCandidate(e[t]);++t)e[t].directive=e[t].expression.raw.slice(1,-1)},Y.isDirectiveCandidate=function(e){return e.type===`ExpressionStatement`&&e.expression.type===`Literal`&&typeof e.expression.value==`string`&&(this.input[e.start]===`"`||this.input[e.start]===`'`)};var so=Xa.prototype;so.toAssignable=function(e,t,n){if(this.options.ecmaVersion>=6&&e)switch(e.type){case`Identifier`:this.inAsync&&e.name===`await`&&this.raise(e.start,`Cannot use 'await' as identifier inside an async function`);break;case`ObjectPattern`:case`ArrayPattern`:case`RestElement`:break;case`ObjectExpression`:e.type=`ObjectPattern`,n&&this.checkPatternErrors(n,!0);for(var r=0,i=e.properties;r<i.length;r+=1){var a=i[r];this.toAssignable(a,t),a.type===`RestElement`&&(a.argument.type===`ArrayPattern`||a.argument.type===`ObjectPattern`)&&this.raise(a.argument.start,`Unexpected token`)}break;case`Property`:e.kind!==`init`&&this.raise(e.key.start,`Object pattern can't contain getter or setter`),this.toAssignable(e.value,t);break;case`ArrayExpression`:e.type=`ArrayPattern`,n&&this.checkPatternErrors(n,!0),this.toAssignableList(e.elements,t);break;case`SpreadElement`:e.type=`RestElement`,this.toAssignable(e.argument,t),e.argument.type===`AssignmentPattern`&&this.raise(e.argument.start,`Rest elements cannot have a default value`);break;case`AssignmentExpression`:e.operator!==`=`&&this.raise(e.left.end,`Only '=' operator can be used for specifying default value.`),e.type=`AssignmentPattern`,delete e.operator,this.toAssignable(e.left,t);case`AssignmentPattern`:break;case`ParenthesizedExpression`:this.toAssignable(e.expression,t,n);break;case`ChainExpression`:this.raiseRecoverable(e.start,`Optional chaining cannot appear in left-hand side`);break;case`MemberExpression`:if(!t)break;default:this.raise(e.start,`Assigning to rvalue`)}else n&&this.checkPatternErrors(n,!0);return e},so.toAssignableList=function(e,t){for(var n=e.length,r=0;r<n;r++){var i=e[r];i&&this.toAssignable(i,t)}if(n){var a=e[n-1];this.options.ecmaVersion===6&&t&&a&&a.type===`RestElement`&&a.argument.type!==`Identifier`&&this.unexpected(a.argument.start)}return e},so.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,`SpreadElement`)},so.parseRestBinding=function(){var e=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==J.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,`RestElement`)},so.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case J.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(J.bracketR,!0,!0),this.finishNode(e,`ArrayPattern`);case J.braceL:return this.parseObj(!0)}return this.parseIdent()},so.parseBindingList=function(e,t,n){for(var r=[],i=!0;!this.eat(e);)if(i?i=!1:this.expect(J.comma),t&&this.type===J.comma)r.push(null);else if(n&&this.afterTrailingComma(e))break;else if(this.type===J.ellipsis){var a=this.parseRestBinding();this.parseBindingListItem(a),r.push(a),this.type===J.comma&&this.raise(this.start,`Comma is not permitted after the rest element`),this.expect(e);break}else{var o=this.parseMaybeDefault(this.start,this.startLoc);this.parseBindingListItem(o),r.push(o)}return r},so.parseBindingListItem=function(e){return e},so.parseMaybeDefault=function(e,t,n){if(n||=this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(J.eq))return n;var r=this.startNodeAt(e,t);return r.left=n,r.right=this.parseMaybeAssign(),this.finishNode(r,`AssignmentPattern`)},so.checkLVal=function(e,t,n){switch(t===void 0&&(t=Wa),e.type){case`Identifier`:t===Ka&&e.name===`let`&&this.raiseRecoverable(e.start,`let is disallowed as a lexically bound name`),this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(t?`Binding `:`Assigning to `)+e.name+` in strict mode`),n&&(Ta(n,e.name)&&this.raiseRecoverable(e.start,`Argument name clash`),n[e.name]=!0),t!==Wa&&t!==Ya&&this.declareName(e.name,t,e.start);break;case`ChainExpression`:this.raiseRecoverable(e.start,`Optional chaining cannot appear in left-hand side`);break;case`MemberExpression`:t&&this.raiseRecoverable(e.start,`Binding member expression`);break;case`ObjectPattern`:for(var r=0,i=e.properties;r<i.length;r+=1){var a=i[r];this.checkLVal(a,t,n)}break;case`Property`:this.checkLVal(e.value,t,n);break;case`ArrayPattern`:for(var o=0,s=e.elements;o<s.length;o+=1){var c=s[o];c&&this.checkLVal(c,t,n)}break;case`AssignmentPattern`:this.checkLVal(e.left,t,n);break;case`RestElement`:this.checkLVal(e.argument,t,n);break;case`ParenthesizedExpression`:this.checkLVal(e.expression,t,n);break;default:this.raise(e.start,(t?`Binding`:`Assigning to`)+` rvalue`)}};var X=Xa.prototype;X.checkPropClash=function(e,t,n){if(!(this.options.ecmaVersion>=9&&e.type===`SpreadElement`)&&!(this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var r=e.key,i;switch(r.type){case`Identifier`:i=r.name;break;case`Literal`:i=String(r.value);break;default:return}var a=e.kind;if(this.options.ecmaVersion>=6){i===`__proto__`&&a===`init`&&(t.proto&&(n?n.doubleProto<0&&(n.doubleProto=r.start):this.raiseRecoverable(r.start,`Redefinition of __proto__ property`)),t.proto=!0);return}i=`$`+i;var o=t[i];o?(a===`init`?this.strict&&o.init||o.get||o.set:o.init||o[a])&&this.raiseRecoverable(r.start,`Redefinition of property`):o=t[i]={init:!1,get:!1,set:!1},o[a]=!0}},X.parseExpression=function(e,t){var n=this.start,r=this.startLoc,i=this.parseMaybeAssign(e,t);if(this.type===J.comma){var a=this.startNodeAt(n,r);for(a.expressions=[i];this.eat(J.comma);)a.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(a,`SequenceExpression`)}return i},X.parseMaybeAssign=function(e,t,n){if(this.isContextual(`yield`)){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var r=!1,i=-1,a=-1;t?(i=t.parenthesizedAssign,a=t.trailingComma,t.parenthesizedAssign=t.trailingComma=-1):(t=new eo,r=!0);var o=this.start,s=this.startLoc;(this.type===J.parenL||this.type===J.name)&&(this.potentialArrowAt=this.start);var c=this.parseMaybeConditional(e,t);if(n&&(c=n.call(this,c,o,s)),this.type.isAssign){var l=this.startNodeAt(o,s);return l.operator=this.value,l.left=this.type===J.eq?this.toAssignable(c,!1,t):c,r||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=l.left.start&&(t.shorthandAssign=-1),this.checkLVal(c),this.next(),l.right=this.parseMaybeAssign(e),this.finishNode(l,`AssignmentExpression`)}else r&&this.checkExpressionErrors(t,!0);return i>-1&&(t.parenthesizedAssign=i),a>-1&&(t.trailingComma=a),c},X.parseMaybeConditional=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return i;if(this.eat(J.question)){var a=this.startNodeAt(n,r);return a.test=i,a.consequent=this.parseMaybeAssign(),this.expect(J.colon),a.alternate=this.parseMaybeAssign(e),this.finishNode(a,`ConditionalExpression`)}return i},X.parseExprOps=function(e,t){var n=this.start,r=this.startLoc,i=this.parseMaybeUnary(t,!1);return this.checkExpressionErrors(t)||i.start===n&&i.type===`ArrowFunctionExpression`?i:this.parseExprOp(i,n,r,-1,e)},X.parseExprOp=function(e,t,n,r,i){var a=this.type.binop;if(a!=null&&(!i||this.type!==J._in)&&a>r){var o=this.type===J.logicalOR||this.type===J.logicalAND,s=this.type===J.coalesce;s&&(a=J.logicalAND.binop);var c=this.value;this.next();var l=this.start,u=this.startLoc,d=this.parseExprOp(this.parseMaybeUnary(null,!1),l,u,a,i),f=this.buildBinary(t,n,e,d,c,o||s);return(o&&this.type===J.coalesce||s&&(this.type===J.logicalOR||this.type===J.logicalAND))&&this.raiseRecoverable(this.start,`Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses`),this.parseExprOp(f,t,n,r,i)}return e},X.buildBinary=function(e,t,n,r,i,a){var o=this.startNodeAt(e,t);return o.left=n,o.operator=i,o.right=r,this.finishNode(o,a?`LogicalExpression`:`BinaryExpression`)},X.parseMaybeUnary=function(e,t){var n=this.start,r=this.startLoc,i;if(this.isContextual(`await`)&&(this.inAsync||!this.inFunction&&this.options.allowAwaitOutsideFunction))i=this.parseAwait(),t=!0;else if(this.type.prefix){var a=this.startNode(),o=this.type===J.incDec;a.operator=this.value,a.prefix=!0,this.next(),a.argument=this.parseMaybeUnary(null,!0),this.checkExpressionErrors(e,!0),o?this.checkLVal(a.argument):this.strict&&a.operator===`delete`&&a.argument.type===`Identifier`?this.raiseRecoverable(a.start,`Deleting local variable in strict mode`):t=!0,i=this.finishNode(a,o?`UpdateExpression`:`UnaryExpression`)}else{if(i=this.parseExprSubscripts(e),this.checkExpressionErrors(e))return i;for(;this.type.postfix&&!this.canInsertSemicolon();){var s=this.startNodeAt(n,r);s.operator=this.value,s.prefix=!1,s.argument=i,this.checkLVal(i),this.next(),i=this.finishNode(s,`UpdateExpression`)}}return!t&&this.eat(J.starstar)?this.buildBinary(n,r,i,this.parseMaybeUnary(null,!1),`**`,!1):i},X.parseExprSubscripts=function(e){var t=this.start,n=this.startLoc,r=this.parseExprAtom(e);if(r.type===`ArrowFunctionExpression`&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==`)`)return r;var i=this.parseSubscripts(r,t,n);return e&&i.type===`MemberExpression`&&(e.parenthesizedAssign>=i.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=i.start&&(e.parenthesizedBind=-1)),i},X.parseSubscripts=function(e,t,n,r){for(var i=this.options.ecmaVersion>=8&&e.type===`Identifier`&&e.name===`async`&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.potentialArrowAt===e.start,a=!1;;){var o=this.parseSubscript(e,t,n,r,i,a);if(o.optional&&(a=!0),o===e||o.type===`ArrowFunctionExpression`){if(a){var s=this.startNodeAt(t,n);s.expression=o,o=this.finishNode(s,`ChainExpression`)}return o}e=o}},X.parseSubscript=function(e,t,n,r,i,a){var o=this.options.ecmaVersion>=11,s=o&&this.eat(J.questionDot);r&&s&&this.raise(this.lastTokStart,`Optional chaining cannot appear in the callee of new expressions`);var c=this.eat(J.bracketL);if(c||s&&this.type!==J.parenL&&this.type!==J.backQuote||this.eat(J.dot)){var l=this.startNodeAt(t,n);l.object=e,l.property=c?this.parseExpression():this.parseIdent(this.options.allowReserved!==`never`),l.computed=!!c,c&&this.expect(J.bracketR),o&&(l.optional=s),e=this.finishNode(l,`MemberExpression`)}else if(!r&&this.eat(J.parenL)){var u=new eo,d=this.yieldPos,f=this.awaitPos,p=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var m=this.parseExprList(J.parenR,this.options.ecmaVersion>=8,!1,u);if(i&&!s&&!this.canInsertSemicolon()&&this.eat(J.arrow))return this.checkPatternErrors(u,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,`Cannot use 'await' as identifier inside an async function`),this.yieldPos=d,this.awaitPos=f,this.awaitIdentPos=p,this.parseArrowExpression(this.startNodeAt(t,n),m,!0);this.checkExpressionErrors(u,!0),this.yieldPos=d||this.yieldPos,this.awaitPos=f||this.awaitPos,this.awaitIdentPos=p||this.awaitIdentPos;var h=this.startNodeAt(t,n);h.callee=e,h.arguments=m,o&&(h.optional=s),e=this.finishNode(h,`CallExpression`)}else if(this.type===J.backQuote){(s||a)&&this.raise(this.start,`Optional chaining cannot appear in the tag of tagged template expressions`);var g=this.startNodeAt(t,n);g.tag=e,g.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(g,`TaggedTemplateExpression`)}return e},X.parseExprAtom=function(e){this.type===J.slash&&this.readRegexp();var t,n=this.potentialArrowAt===this.start;switch(this.type){case J._super:return this.allowSuper||this.raise(this.start,`'super' keyword outside a method`),t=this.startNode(),this.next(),this.type===J.parenL&&!this.allowDirectSuper&&this.raise(t.start,`super() call outside constructor of a subclass`),this.type!==J.dot&&this.type!==J.bracketL&&this.type!==J.parenL&&this.unexpected(),this.finishNode(t,`Super`);case J._this:return t=this.startNode(),this.next(),this.finishNode(t,`ThisExpression`);case J.name:var r=this.start,i=this.startLoc,a=this.containsEsc,o=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!a&&o.name===`async`&&!this.canInsertSemicolon()&&this.eat(J._function))return this.parseFunction(this.startNodeAt(r,i),0,!1,!0);if(n&&!this.canInsertSemicolon()){if(this.eat(J.arrow))return this.parseArrowExpression(this.startNodeAt(r,i),[o],!1);if(this.options.ecmaVersion>=8&&o.name===`async`&&this.type===J.name&&!a)return o=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(J.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(r,i),[o],!0)}return o;case J.regexp:var s=this.value;return t=this.parseLiteral(s.value),t.regex={pattern:s.pattern,flags:s.flags},t;case J.num:case J.string:return this.parseLiteral(this.value);case J._null:case J._true:case J._false:return t=this.startNode(),t.value=this.type===J._null?null:this.type===J._true,t.raw=this.type.keyword,this.next(),this.finishNode(t,`Literal`);case J.parenL:var c=this.start,l=this.parseParenAndDistinguishExpression(n);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(l)&&(e.parenthesizedAssign=c),e.parenthesizedBind<0&&(e.parenthesizedBind=c)),l;case J.bracketL:return t=this.startNode(),this.next(),t.elements=this.parseExprList(J.bracketR,!0,!0,e),this.finishNode(t,`ArrayExpression`);case J.braceL:return this.parseObj(!1,e);case J._function:return t=this.startNode(),this.next(),this.parseFunction(t,0);case J._class:return this.parseClass(this.startNode(),!1);case J._new:return this.parseNew();case J.backQuote:return this.parseTemplate();case J._import:return this.options.ecmaVersion>=11?this.parseExprImport():this.unexpected();default:this.unexpected()}},X.parseExprImport=function(){var e=this.startNode();this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword import`);var t=this.parseIdent(!0);switch(this.type){case J.parenL:return this.parseDynamicImport(e);case J.dot:return e.meta=t,this.parseImportMeta(e);default:this.unexpected()}},X.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),!this.eat(J.parenR)){var t=this.start;this.eat(J.comma)&&this.eat(J.parenR)?this.raiseRecoverable(t,`Trailing comma is not allowed in import()`):this.unexpected(t)}return this.finishNode(e,`ImportExpression`)},X.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!==`meta`&&this.raiseRecoverable(e.property.start,`The only valid meta property for import is 'import.meta'`),t&&this.raiseRecoverable(e.start,`'import.meta' must not contain escaped characters`),this.options.sourceType!==`module`&&this.raiseRecoverable(e.start,`Cannot use 'import.meta' outside a module`),this.finishNode(e,`MetaProperty`)},X.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),t.raw.charCodeAt(t.raw.length-1)===110&&(t.bigint=t.raw.slice(0,-1).replace(/_/g,``)),this.next(),this.finishNode(t,`Literal`)},X.parseParenExpression=function(){this.expect(J.parenL);var e=this.parseExpression();return this.expect(J.parenR),e},X.parseParenAndDistinguishExpression=function(e){var t=this.start,n=this.startLoc,r,i=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var a=this.start,o=this.startLoc,s=[],c=!0,l=!1,u=new eo,d=this.yieldPos,f=this.awaitPos,p;for(this.yieldPos=0,this.awaitPos=0;this.type!==J.parenR;)if(c?c=!1:this.expect(J.comma),i&&this.afterTrailingComma(J.parenR,!0)){l=!0;break}else if(this.type===J.ellipsis){p=this.start,s.push(this.parseParenItem(this.parseRestBinding())),this.type===J.comma&&this.raise(this.start,`Comma is not permitted after the rest element`);break}else s.push(this.parseMaybeAssign(!1,u,this.parseParenItem));var m=this.start,h=this.startLoc;if(this.expect(J.parenR),e&&!this.canInsertSemicolon()&&this.eat(J.arrow))return this.checkPatternErrors(u,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=d,this.awaitPos=f,this.parseParenArrowList(t,n,s);(!s.length||l)&&this.unexpected(this.lastTokStart),p&&this.unexpected(p),this.checkExpressionErrors(u,!0),this.yieldPos=d||this.yieldPos,this.awaitPos=f||this.awaitPos,s.length>1?(r=this.startNodeAt(a,o),r.expressions=s,this.finishNodeAt(r,`SequenceExpression`,m,h)):r=s[0]}else r=this.parseParenExpression();if(this.options.preserveParens){var g=this.startNodeAt(t,n);return g.expression=r,this.finishNode(g,`ParenthesizedExpression`)}else return r},X.parseParenItem=function(e){return e},X.parseParenArrowList=function(e,t,n){return this.parseArrowExpression(this.startNodeAt(e,t),n)};var co=[];X.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword new`);var e=this.startNode(),t=this.parseIdent(!0);if(this.options.ecmaVersion>=6&&this.eat(J.dot)){e.meta=t;var n=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!==`target`&&this.raiseRecoverable(e.property.start,`The only valid meta property for new is 'new.target'`),n&&this.raiseRecoverable(e.start,`'new.target' must not contain escaped characters`),this.inNonArrowFunction()||this.raiseRecoverable(e.start,`'new.target' can only be used in functions`),this.finishNode(e,`MetaProperty`)}var r=this.start,i=this.startLoc,a=this.type===J._import;return e.callee=this.parseSubscripts(this.parseExprAtom(),r,i,!0),a&&e.callee.type===`ImportExpression`&&this.raise(r,`Cannot use new with import()`),this.eat(J.parenL)?e.arguments=this.parseExprList(J.parenR,this.options.ecmaVersion>=8,!1):e.arguments=co,this.finishNode(e,`NewExpression`)},X.parseTemplateElement=function(e){var t=e.isTagged,n=this.startNode();return this.type===J.invalidTemplate?(t||this.raiseRecoverable(this.start,`Bad escape sequence in untagged template literal`),n.value={raw:this.value,cooked:null}):n.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
|
|
91
91
|
`),cooked:this.value},this.next(),n.tail=this.type===J.backQuote,this.finishNode(n,`TemplateElement`)},X.parseTemplate=function(e){e===void 0&&(e={});var t=e.isTagged;t===void 0&&(t=!1);var n=this.startNode();this.next(),n.expressions=[];var r=this.parseTemplateElement({isTagged:t});for(n.quasis=[r];!r.tail;)this.type===J.eof&&this.raise(this.pos,`Unterminated template literal`),this.expect(J.dollarBraceL),n.expressions.push(this.parseExpression()),this.expect(J.braceR),n.quasis.push(r=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(n,`TemplateLiteral`)},X.isAsyncProp=function(e){return!e.computed&&e.key.type===`Identifier`&&e.key.name===`async`&&(this.type===J.name||this.type===J.num||this.type===J.string||this.type===J.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===J.star)&&!_a.test(this.input.slice(this.lastTokEnd,this.start))},X.parseObj=function(e,t){var n=this.startNode(),r=!0,i={};for(n.properties=[],this.next();!this.eat(J.braceR);){if(r)r=!1;else if(this.expect(J.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(J.braceR))break;var a=this.parseProperty(e,t);e||this.checkPropClash(a,i,t),n.properties.push(a)}return this.finishNode(n,e?`ObjectPattern`:`ObjectExpression`)},X.parseProperty=function(e,t){var n=this.startNode(),r,i,a,o;if(this.options.ecmaVersion>=9&&this.eat(J.ellipsis))return e?(n.argument=this.parseIdent(!1),this.type===J.comma&&this.raise(this.start,`Comma is not permitted after the rest element`),this.finishNode(n,`RestElement`)):(this.type===J.parenL&&t&&(t.parenthesizedAssign<0&&(t.parenthesizedAssign=this.start),t.parenthesizedBind<0&&(t.parenthesizedBind=this.start)),n.argument=this.parseMaybeAssign(!1,t),this.type===J.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(n,`SpreadElement`));this.options.ecmaVersion>=6&&(n.method=!1,n.shorthand=!1,(e||t)&&(a=this.start,o=this.startLoc),e||(r=this.eat(J.star)));var s=this.containsEsc;return this.parsePropertyName(n),!e&&!s&&this.options.ecmaVersion>=8&&!r&&this.isAsyncProp(n)?(i=!0,r=this.options.ecmaVersion>=9&&this.eat(J.star),this.parsePropertyName(n,t)):i=!1,this.parsePropertyValue(n,e,r,i,a,o,t,s),this.finishNode(n,`Property`)},X.parsePropertyValue=function(e,t,n,r,i,a,o,s){if((n||r)&&this.type===J.colon&&this.unexpected(),this.eat(J.colon))e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,o),e.kind=`init`;else if(this.options.ecmaVersion>=6&&this.type===J.parenL)t&&this.unexpected(),e.kind=`init`,e.method=!0,e.value=this.parseMethod(n,r);else if(!t&&!s&&this.options.ecmaVersion>=5&&!e.computed&&e.key.type===`Identifier`&&(e.key.name===`get`||e.key.name===`set`)&&this.type!==J.comma&&this.type!==J.braceR&&this.type!==J.eq){(n||r)&&this.unexpected(),e.kind=e.key.name,this.parsePropertyName(e),e.value=this.parseMethod(!1);var c=e.kind===`get`?0:1;if(e.value.params.length!==c){var l=e.value.start;e.kind===`get`?this.raiseRecoverable(l,`getter should have no params`):this.raiseRecoverable(l,`setter should have exactly one param`)}else e.kind===`set`&&e.value.params[0].type===`RestElement`&&this.raiseRecoverable(e.value.params[0].start,`Setter cannot use rest params`)}else this.options.ecmaVersion>=6&&!e.computed&&e.key.type===`Identifier`?((n||r)&&this.unexpected(),this.checkUnreserved(e.key),e.key.name===`await`&&!this.awaitIdentPos&&(this.awaitIdentPos=i),e.kind=`init`,t?e.value=this.parseMaybeDefault(i,a,e.key):this.type===J.eq&&o?(o.shorthandAssign<0&&(o.shorthandAssign=this.start),e.value=this.parseMaybeDefault(i,a,e.key)):e.value=e.key,e.shorthand=!0):this.unexpected()},X.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(J.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(J.bracketR),e.key;e.computed=!1}return e.key=this.type===J.num||this.type===J.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!==`never`)},X.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},X.parseMethod=function(e,t,n){var r=this.startNode(),i=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.initFunction(r),this.options.ecmaVersion>=6&&(r.generator=e),this.options.ecmaVersion>=8&&(r.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Ua(t,r.generator)|Va|(n?Ha:0)),this.expect(J.parenL),r.params=this.parseBindingList(J.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(r,!1,!0),this.yieldPos=i,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(r,`FunctionExpression`)},X.parseArrowExpression=function(e,t,n){var r=this.yieldPos,i=this.awaitPos,a=this.awaitIdentPos;return this.enterScope(Ua(n,!1)|za),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!n),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1),this.yieldPos=r,this.awaitPos=i,this.awaitIdentPos=a,this.finishNode(e,`ArrowFunctionExpression`)},X.parseFunctionBody=function(e,t,n){var r=t&&this.type!==J.braceL,i=this.strict,a=!1;if(r)e.body=this.parseMaybeAssign(),e.expression=!0,this.checkParams(e,!1);else{var o=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!i||o)&&(a=this.strictDirective(this.end),a&&o&&this.raiseRecoverable(e.start,`Illegal 'use strict' directive in function with non-simple parameter list`));var s=this.labels;this.labels=[],a&&(this.strict=!0),this.checkParams(e,!i&&!a&&!t&&!n&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLVal(e.id,Ya),e.body=this.parseBlock(!1,void 0,a&&!i),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=s}this.exitScope()},X.isSimpleParamList=function(e){for(var t=0,n=e;t<n.length;t+=1)if(n[t].type!==`Identifier`)return!1;return!0},X.checkParams=function(e,t){for(var n={},r=0,i=e.params;r<i.length;r+=1){var a=i[r];this.checkLVal(a,Ga,t?null:n)}},X.parseExprList=function(e,t,n,r){for(var i=[],a=!0;!this.eat(e);){if(a)a=!1;else if(this.expect(J.comma),t&&this.afterTrailingComma(e))break;var o=void 0;n&&this.type===J.comma?o=null:this.type===J.ellipsis?(o=this.parseSpread(r),r&&this.type===J.comma&&r.trailingComma<0&&(r.trailingComma=this.start)):o=this.parseMaybeAssign(!1,r),i.push(o)}return i},X.checkUnreserved=function(e){var t=e.start,n=e.end,r=e.name;this.inGenerator&&r===`yield`&&this.raiseRecoverable(t,`Cannot use 'yield' as identifier inside a generator`),this.inAsync&&r===`await`&&this.raiseRecoverable(t,`Cannot use 'await' as identifier inside an async function`),this.keywords.test(r)&&this.raise(t,`Unexpected keyword '`+r+`'`),!(this.options.ecmaVersion<6&&this.input.slice(t,n).indexOf(`\\`)!==-1)&&(this.strict?this.reservedWordsStrict:this.reservedWords).test(r)&&(!this.inAsync&&r===`await`&&this.raiseRecoverable(t,`Cannot use keyword 'await' outside an async function`),this.raiseRecoverable(t,`The keyword '`+r+`' is reserved`))},X.parseIdent=function(e,t){var n=this.startNode();return this.type===J.name?n.name=this.value:this.type.keyword?(n.name=this.type.keyword,(n.name===`class`||n.name===`function`)&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46)&&this.context.pop()):this.unexpected(),this.next(!!e),this.finishNode(n,`Identifier`),e||(this.checkUnreserved(n),n.name===`await`&&!this.awaitIdentPos&&(this.awaitIdentPos=n.start)),n},X.parseYield=function(e){this.yieldPos||=this.start;var t=this.startNode();return this.next(),this.type===J.semi||this.canInsertSemicolon()||this.type!==J.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(J.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,`YieldExpression`)},X.parseAwait=function(){this.awaitPos||=this.start;var e=this.startNode();return this.next(),e.argument=this.parseMaybeUnary(null,!1),this.finishNode(e,`AwaitExpression`)};var lo=Xa.prototype;lo.raise=function(e,t){var n=Aa(this.input,e);t+=` (`+n.line+`:`+n.column+`)`;var r=SyntaxError(t);throw r.pos=e,r.loc=n,r.raisedAt=this.pos,r},lo.raiseRecoverable=lo.raise,lo.curPosition=function(){if(this.options.locations)return new Oa(this.curLine,this.pos-this.lineStart)};var uo=Xa.prototype,fo=function(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[]};uo.enterScope=function(e){this.scopeStack.push(new fo(e))},uo.exitScope=function(){this.scopeStack.pop()},uo.treatFunctionsAsVarInScope=function(e){return e.flags&Fa||!this.inModule&&e.flags&Pa},uo.declareName=function(e,t,n){var r=!1;if(t===Ka){var i=this.currentScope();r=i.lexical.indexOf(e)>-1||i.functions.indexOf(e)>-1||i.var.indexOf(e)>-1,i.lexical.push(e),this.inModule&&i.flags&Pa&&delete this.undefinedExports[e]}else if(t===Ja)this.currentScope().lexical.push(e);else if(t===qa){var a=this.currentScope();r=this.treatFunctionsAsVar?a.lexical.indexOf(e)>-1:a.lexical.indexOf(e)>-1||a.var.indexOf(e)>-1,a.functions.push(e)}else for(var o=this.scopeStack.length-1;o>=0;--o){var s=this.scopeStack[o];if(s.lexical.indexOf(e)>-1&&!(s.flags&Ba&&s.lexical[0]===e)||!this.treatFunctionsAsVarInScope(s)&&s.functions.indexOf(e)>-1){r=!0;break}if(s.var.push(e),this.inModule&&s.flags&Pa&&delete this.undefinedExports[e],s.flags&Ia)break}r&&this.raiseRecoverable(n,`Identifier '`+e+`' has already been declared`)},uo.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)},uo.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},uo.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&Ia)return t}},uo.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&Ia&&!(t.flags&za))return t}};var po=function(e,t,n){this.type=``,this.start=t,this.end=0,e.options.locations&&(this.loc=new ka(e,n)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[t,0])},mo=Xa.prototype;mo.startNode=function(){return new po(this,this.start,this.startLoc)},mo.startNodeAt=function(e,t){return new po(this,e,t)};function ho(e,t,n,r){return e.type=t,e.end=n,this.options.locations&&(e.loc.end=r),this.options.ranges&&(e.range[1]=n),e}mo.finishNode=function(e,t){return ho.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},mo.finishNodeAt=function(e,t,n,r){return ho.call(this,e,t,n,r)};var go=function(e,t,n,r,i){this.token=e,this.isExpr=!!t,this.preserveSpace=!!n,this.override=r,this.generator=!!i},_o={b_stat:new go(`{`,!1),b_expr:new go(`{`,!0),b_tmpl:new go("${",!1),p_stat:new go(`(`,!1),p_expr:new go(`(`,!0),q_tmpl:new go("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new go(`function`,!1),f_expr:new go(`function`,!0),f_expr_gen:new go(`function`,!0,!1,null,!0),f_gen:new go(`function`,!1,!1,null,!0)},vo=Xa.prototype;vo.initialContext=function(){return[_o.b_stat]},vo.braceIsBlock=function(e){var t=this.curContext();return t===_o.f_expr||t===_o.f_stat?!0:e===J.colon&&(t===_o.b_stat||t===_o.b_expr)?!t.isExpr:e===J._return||e===J.name&&this.exprAllowed?_a.test(this.input.slice(this.lastTokEnd,this.start)):e===J._else||e===J.semi||e===J.eof||e===J.parenR||e===J.arrow?!0:e===J.braceL?t===_o.b_stat:e===J._var||e===J._const||e===J.name?!1:!this.exprAllowed},vo.inGeneratorContext=function(){for(var e=this.context.length-1;e>=1;e--){var t=this.context[e];if(t.token===`function`)return t.generator}return!1},vo.updateContext=function(e){var t,n=this.type;n.keyword&&e===J.dot?this.exprAllowed=!1:(t=n.updateContext)?t.call(this,e):this.exprAllowed=n.beforeExpr},J.parenR.updateContext=J.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var e=this.context.pop();e===_o.b_stat&&this.curContext().token===`function`&&(e=this.context.pop()),this.exprAllowed=!e.isExpr},J.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?_o.b_stat:_o.b_expr),this.exprAllowed=!0},J.dollarBraceL.updateContext=function(){this.context.push(_o.b_tmpl),this.exprAllowed=!0},J.parenL.updateContext=function(e){var t=e===J._if||e===J._for||e===J._with||e===J._while;this.context.push(t?_o.p_stat:_o.p_expr),this.exprAllowed=!0},J.incDec.updateContext=function(){},J._function.updateContext=J._class.updateContext=function(e){e.beforeExpr&&e!==J.semi&&e!==J._else&&!(e===J._return&&_a.test(this.input.slice(this.lastTokEnd,this.start)))&&!((e===J.colon||e===J.braceL)&&this.curContext()===_o.b_stat)?this.context.push(_o.f_expr):this.context.push(_o.f_stat),this.exprAllowed=!1},J.backQuote.updateContext=function(){this.curContext()===_o.q_tmpl?this.context.pop():this.context.push(_o.q_tmpl),this.exprAllowed=!1},J.star.updateContext=function(e){if(e===J._function){var t=this.context.length-1;this.context[t]===_o.f_expr?this.context[t]=_o.f_expr_gen:this.context[t]=_o.f_gen}this.exprAllowed=!0},J.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==J.dot&&(this.value===`of`&&!this.exprAllowed||this.value===`yield`&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var yo=`ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS`,bo=yo+` Extended_Pictographic`,xo={9:yo,10:bo,11:bo},So=`Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu`,Co=`Adlam Adlm Ahom Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb`,wo=Co+` Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd`,To={9:Co,10:wo,11:wo+` Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho`},Eo={};function Do(e){var t=Eo[e]={binary:Da(xo[e]+` `+So),nonBinary:{General_Category:Da(So),Script:Da(To[e])}};t.nonBinary.Script_Extensions=t.nonBinary.Script,t.nonBinary.gc=t.nonBinary.General_Category,t.nonBinary.sc=t.nonBinary.Script,t.nonBinary.scx=t.nonBinary.Script_Extensions}Do(9),Do(10),Do(11);var Z=Xa.prototype,Oo=function(e){this.parser=e,this.validFlags=`gim`+(e.options.ecmaVersion>=6?`uy`:``)+(e.options.ecmaVersion>=9?`s`:``),this.unicodeProperties=Eo[e.options.ecmaVersion>=11?11:e.options.ecmaVersion],this.source=``,this.flags=``,this.start=0,this.switchU=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue=``,this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=[],this.backReferenceNames=[]};Oo.prototype.reset=function(e,t,n){var r=n.indexOf(`u`)!==-1;this.start=e|0,this.source=t+``,this.flags=n,this.switchU=r&&this.parser.options.ecmaVersion>=6,this.switchN=r&&this.parser.options.ecmaVersion>=9},Oo.prototype.raise=function(e){this.parser.raiseRecoverable(this.start,`Invalid regular expression: /`+this.source+`/: `+e)},Oo.prototype.at=function(e,t){t===void 0&&(t=!1);var n=this.source,r=n.length;if(e>=r)return-1;var i=n.charCodeAt(e);if(!(t||this.switchU)||i<=55295||i>=57344||e+1>=r)return i;var a=n.charCodeAt(e+1);return a>=56320&&a<=57343?(i<<10)+a-56613888:i},Oo.prototype.nextIndex=function(e,t){t===void 0&&(t=!1);var n=this.source,r=n.length;if(e>=r)return r;var i=n.charCodeAt(e),a;return!(t||this.switchU)||i<=55295||i>=57344||e+1>=r||(a=n.charCodeAt(e+1))<56320||a>57343?e+1:e+2},Oo.prototype.current=function(e){return e===void 0&&(e=!1),this.at(this.pos,e)},Oo.prototype.lookahead=function(e){return e===void 0&&(e=!1),this.at(this.nextIndex(this.pos,e),e)},Oo.prototype.advance=function(e){e===void 0&&(e=!1),this.pos=this.nextIndex(this.pos,e)},Oo.prototype.eat=function(e,t){return t===void 0&&(t=!1),this.current(t)===e?(this.advance(t),!0):!1};function ko(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}Z.validateRegExpFlags=function(e){for(var t=e.validFlags,n=e.flags,r=0;r<n.length;r++){var i=n.charAt(r);t.indexOf(i)===-1&&this.raise(e.start,`Invalid regular expression flag`),n.indexOf(i,r+1)>-1&&this.raise(e.start,`Duplicate regular expression flag`)}},Z.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&e.groupNames.length>0&&(e.switchN=!0,this.regexp_pattern(e))},Z.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue=``,e.lastAssertionIsQuantifiable=!1,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames.length=0,e.backReferenceNames.length=0,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise(`Unmatched ')'`),(e.eat(93)||e.eat(125))&&e.raise(`Lone quantifier brackets`)),e.maxBackReference>e.numCapturingParens&&e.raise(`Invalid escape`);for(var t=0,n=e.backReferenceNames;t<n.length;t+=1){var r=n[t];e.groupNames.indexOf(r)===-1&&e.raise(`Invalid named capture referenced`)}},Z.regexp_disjunction=function(e){for(this.regexp_alternative(e);e.eat(124);)this.regexp_alternative(e);this.regexp_eatQuantifier(e,!0)&&e.raise(`Nothing to repeat`),e.eat(123)&&e.raise(`Lone quantifier brackets`)},Z.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););},Z.regexp_eatTerm=function(e){return this.regexp_eatAssertion(e)?(e.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(e)&&e.switchU&&e.raise(`Invalid quantifier`),!0):(e.switchU?this.regexp_eatAtom(e):this.regexp_eatExtendedAtom(e))?(this.regexp_eatQuantifier(e),!0):!1},Z.regexp_eatAssertion=function(e){var t=e.pos;if(e.lastAssertionIsQuantifiable=!1,e.eat(94)||e.eat(36))return!0;if(e.eat(92)){if(e.eat(66)||e.eat(98))return!0;e.pos=t}if(e.eat(40)&&e.eat(63)){var n=!1;if(this.options.ecmaVersion>=9&&(n=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise(`Unterminated group`),e.lastAssertionIsQuantifiable=!n,!0}return e.pos=t,!1},Z.regexp_eatQuantifier=function(e,t){return t===void 0&&(t=!1),this.regexp_eatQuantifierPrefix(e,t)?(e.eat(63),!0):!1},Z.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)},Z.regexp_eatBracedQuantifier=function(e,t){var n=e.pos;if(e.eat(123)){var r=0,i=-1;if(this.regexp_eatDecimalDigits(e)&&(r=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(i=e.lastIntValue),e.eat(125)))return i!==-1&&i<r&&!t&&e.raise(`numbers out of order in {} quantifier`),!0;e.switchU&&!t&&e.raise(`Incomplete quantifier`),e.pos=n}return!1},Z.regexp_eatAtom=function(e){return this.regexp_eatPatternCharacters(e)||e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)},Z.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1},Z.regexp_eatUncapturingGroup=function(e){var t=e.pos;if(e.eat(40)){if(e.eat(63)&&e.eat(58)){if(this.regexp_disjunction(e),e.eat(41))return!0;e.raise(`Unterminated group`)}e.pos=t}return!1},Z.regexp_eatCapturingGroup=function(e){if(e.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(e):e.current()===63&&e.raise(`Invalid group`),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,!0;e.raise(`Unterminated group`)}return!1},Z.regexp_eatExtendedAtom=function(e){return e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)||this.regexp_eatInvalidBracedQuantifier(e)||this.regexp_eatExtendedPatternCharacter(e)},Z.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise(`Nothing to repeat`),!1},Z.regexp_eatSyntaxCharacter=function(e){var t=e.current();return Ao(t)?(e.lastIntValue=t,e.advance(),!0):!1};function Ao(e){return e===36||e>=40&&e<=43||e===46||e===63||e>=91&&e<=94||e>=123&&e<=125}Z.regexp_eatPatternCharacters=function(e){for(var t=e.pos,n=0;(n=e.current())!==-1&&!Ao(n);)e.advance();return e.pos!==t},Z.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return t!==-1&&t!==36&&!(t>=40&&t<=43)&&t!==46&&t!==63&&t!==91&&t!==94&&t!==124?(e.advance(),!0):!1},Z.regexp_groupSpecifier=function(e){if(e.eat(63)){if(this.regexp_eatGroupName(e)){e.groupNames.indexOf(e.lastStringValue)!==-1&&e.raise(`Duplicate capture group name`),e.groupNames.push(e.lastStringValue);return}e.raise(`Invalid group`)}},Z.regexp_eatGroupName=function(e){if(e.lastStringValue=``,e.eat(60)){if(this.regexp_eatRegExpIdentifierName(e)&&e.eat(62))return!0;e.raise(`Invalid capture group name`)}return!1},Z.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue=``,this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=ko(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=ko(e.lastIntValue);return!0}return!1},Z.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,n=this.options.ecmaVersion>=11,r=e.current(n);return e.advance(n),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,n)&&(r=e.lastIntValue),jo(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function jo(e){return da(e,!0)||e===36||e===95}Z.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,n=this.options.ecmaVersion>=11,r=e.current(n);return e.advance(n),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,n)&&(r=e.lastIntValue),Mo(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function Mo(e){return fa(e,!0)||e===36||e===95||e===8204||e===8205}Z.regexp_eatAtomEscape=function(e){return this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e)?!0:(e.switchU&&(e.current()===99&&e.raise(`Invalid unicode escape`),e.raise(`Invalid escape`)),!1)},Z.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var n=e.lastIntValue;if(e.switchU)return n>e.maxBackReference&&(e.maxBackReference=n),!0;if(n<=e.numCapturingParens)return!0;e.pos=t}return!1},Z.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise(`Invalid named reference`)}return!1},Z.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)},Z.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1},Z.regexp_eatZero=function(e){return e.current()===48&&!Ro(e.lookahead())?(e.lastIntValue=0,e.advance(),!0):!1},Z.regexp_eatControlEscape=function(e){var t=e.current();return t===116?(e.lastIntValue=9,e.advance(),!0):t===110?(e.lastIntValue=10,e.advance(),!0):t===118?(e.lastIntValue=11,e.advance(),!0):t===102?(e.lastIntValue=12,e.advance(),!0):t===114?(e.lastIntValue=13,e.advance(),!0):!1},Z.regexp_eatControlLetter=function(e){var t=e.current();return No(t)?(e.lastIntValue=t%32,e.advance(),!0):!1};function No(e){return e>=65&&e<=90||e>=97&&e<=122}Z.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){t===void 0&&(t=!1);var n=e.pos,r=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var i=e.lastIntValue;if(r&&i>=55296&&i<=56319){var a=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var o=e.lastIntValue;if(o>=56320&&o<=57343)return e.lastIntValue=(i-55296)*1024+(o-56320)+65536,!0}e.pos=a,e.lastIntValue=i}return!0}if(r&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&Po(e.lastIntValue))return!0;r&&e.raise(`Invalid unicode escape`),e.pos=n}return!1};function Po(e){return e>=0&&e<=1114111}Z.regexp_eatIdentityEscape=function(e){if(e.switchU)return this.regexp_eatSyntaxCharacter(e)?!0:e.eat(47)?(e.lastIntValue=47,!0):!1;var t=e.current();return t!==99&&(!e.switchN||t!==107)?(e.lastIntValue=t,e.advance(),!0):!1},Z.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(t>=49&&t<=57){do e.lastIntValue=10*e.lastIntValue+(t-48),e.advance();while((t=e.current())>=48&&t<=57);return!0}return!1},Z.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(Fo(t))return e.lastIntValue=-1,e.advance(),!0;if(e.switchU&&this.options.ecmaVersion>=9&&(t===80||t===112)){if(e.lastIntValue=-1,e.advance(),e.eat(123)&&this.regexp_eatUnicodePropertyValueExpression(e)&&e.eat(125))return!0;e.raise(`Invalid property name`)}return!1};function Fo(e){return e===100||e===68||e===115||e===83||e===119||e===87}Z.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var n=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var r=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,n,r),!0}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var i=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,i),!0}return!1},Z.regexp_validateUnicodePropertyNameAndValue=function(e,t,n){Ta(e.unicodeProperties.nonBinary,t)||e.raise(`Invalid property name`),e.unicodeProperties.nonBinary[t].test(n)||e.raise(`Invalid property value`)},Z.regexp_validateUnicodePropertyNameOrValue=function(e,t){e.unicodeProperties.binary.test(t)||e.raise(`Invalid property name`)},Z.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue=``;Io(t=e.current());)e.lastStringValue+=ko(t),e.advance();return e.lastStringValue!==``};function Io(e){return No(e)||e===95}Z.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue=``;Lo(t=e.current());)e.lastStringValue+=ko(t),e.advance();return e.lastStringValue!==``};function Lo(e){return Io(e)||Ro(e)}Z.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)},Z.regexp_eatCharacterClass=function(e){if(e.eat(91)){if(e.eat(94),this.regexp_classRanges(e),e.eat(93))return!0;e.raise(`Unterminated character class`)}return!1},Z.regexp_classRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var n=e.lastIntValue;e.switchU&&(t===-1||n===-1)&&e.raise(`Invalid character class`),t!==-1&&n!==-1&&t>n&&e.raise(`Range out of order in character class`)}}},Z.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var n=e.current();(n===99||Vo(n))&&e.raise(`Invalid class escape`),e.raise(`Invalid escape`)}e.pos=t}var r=e.current();return r===93?!1:(e.lastIntValue=r,e.advance(),!0)},Z.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,!0;if(e.switchU&&e.eat(45))return e.lastIntValue=45,!0;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return!0;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)},Z.regexp_eatClassControlLetter=function(e){var t=e.current();return Ro(t)||t===95?(e.lastIntValue=t%32,e.advance(),!0):!1},Z.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return!0;e.switchU&&e.raise(`Invalid escape`),e.pos=t}return!1},Z.regexp_eatDecimalDigits=function(e){var t=e.pos,n=0;for(e.lastIntValue=0;Ro(n=e.current());)e.lastIntValue=10*e.lastIntValue+(n-48),e.advance();return e.pos!==t};function Ro(e){return e>=48&&e<=57}Z.regexp_eatHexDigits=function(e){var t=e.pos,n=0;for(e.lastIntValue=0;zo(n=e.current());)e.lastIntValue=16*e.lastIntValue+Bo(n),e.advance();return e.pos!==t};function zo(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function Bo(e){return e>=65&&e<=70?10+(e-65):e>=97&&e<=102?10+(e-97):e-48}Z.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var n=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=t*64+n*8+e.lastIntValue:e.lastIntValue=t*8+n}else e.lastIntValue=t;return!0}return!1},Z.regexp_eatOctalDigit=function(e){var t=e.current();return Vo(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)};function Vo(e){return e>=48&&e<=55}Z.regexp_eatFixedHexDigits=function(e,t){var n=e.pos;e.lastIntValue=0;for(var r=0;r<t;++r){var i=e.current();if(!zo(i))return e.pos=n,!1;e.lastIntValue=16*e.lastIntValue+Bo(i),e.advance()}return!0};var Ho=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new ka(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},Q=Xa.prototype;Q.next=function(e){!e&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword `+this.type.keyword),this.options.onToken&&this.options.onToken(new Ho(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},Q.getToken=function(){return this.next(),new Ho(this)},typeof Symbol<`u`&&(Q[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===J.eof,value:t}}}}),Q.curContext=function(){return this.context[this.context.length-1]},Q.nextToken=function(){var e=this.curContext();if((!e||!e.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length)return this.finishToken(J.eof);if(e.override)return e.override(this);this.readToken(this.fullCharCodeAtPos())},Q.readToken=function(e){return da(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)},Q.fullCharCodeAtPos=function(){var e=this.input.charCodeAt(this.pos);if(e<=55295||e>=57344)return e;var t=this.input.charCodeAt(this.pos+1);return(e<<10)+t-56613888},Q.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,n=this.input.indexOf(`*/`,this.pos+=2);if(n===-1&&this.raise(this.pos-2,`Unterminated comment`),this.pos=n+2,this.options.locations){va.lastIndex=t;for(var r;(r=va.exec(this.input))&&r.index<this.pos;)++this.curLine,this.lineStart=r.index+r[0].length}this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,n),t,this.pos,e,this.curPosition())},Q.skipLineComment=function(e){for(var t=this.pos,n=this.options.onComment&&this.curPosition(),r=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!ya(r);)r=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(t+e,this.pos),t,this.pos,n,this.curPosition())},Q.skipSpace=function(){loop:for(;this.pos<this.input.length;){var e=this.input.charCodeAt(this.pos);switch(e){case 32:case 160:++this.pos;break;case 13:this.input.charCodeAt(this.pos+1)===10&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break loop}break;default:if(e>8&&e<14||e>=5760&&ba.test(String.fromCharCode(e)))++this.pos;else break loop}}},Q.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var n=this.type;this.type=e,this.value=t,this.updateContext(n)},Q.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&e===46&&t===46?(this.pos+=3,this.finishToken(J.ellipsis)):(++this.pos,this.finishToken(J.dot))},Q.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(J.assign,2):this.finishOp(J.slash,1)},Q.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),n=1,r=e===42?J.star:J.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++n,r=J.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(J.assign,n+1):this.finishOp(r,n)},Q.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?this.options.ecmaVersion>=12&&this.input.charCodeAt(this.pos+2)===61?this.finishOp(J.assign,3):this.finishOp(e===124?J.logicalOR:J.logicalAND,2):t===61?this.finishOp(J.assign,2):this.finishOp(e===124?J.bitwiseOR:J.bitwiseAND,1)},Q.readToken_caret=function(){return this.input.charCodeAt(this.pos+1)===61?this.finishOp(J.assign,2):this.finishOp(J.bitwiseXOR,1)},Q.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?t===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||_a.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(J.incDec,2):t===61?this.finishOp(J.assign,2):this.finishOp(J.plusMin,1)},Q.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),n=1;return t===e?(n=e===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+n)===61?this.finishOp(J.assign,n+1):this.finishOp(J.bitShift,n)):t===33&&e===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(t===61&&(n=2),this.finishOp(J.relational,n))},Q.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(J.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(J.arrow)):this.finishOp(e===61?J.eq:J.prefix,1)},Q.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(t===46){var n=this.input.charCodeAt(this.pos+2);if(n<48||n>57)return this.finishOp(J.questionDot,2)}if(t===63)return e>=12&&this.input.charCodeAt(this.pos+2)===61?this.finishOp(J.assign,3):this.finishOp(J.coalesce,2)}return this.finishOp(J.question,1)},Q.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(J.parenL);case 41:return++this.pos,this.finishToken(J.parenR);case 59:return++this.pos,this.finishToken(J.semi);case 44:return++this.pos,this.finishToken(J.comma);case 91:return++this.pos,this.finishToken(J.bracketL);case 93:return++this.pos,this.finishToken(J.bracketR);case 123:return++this.pos,this.finishToken(J.braceL);case 125:return++this.pos,this.finishToken(J.braceR);case 58:return++this.pos,this.finishToken(J.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(J.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(t===120||t===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(t===111||t===79)return this.readRadixNumber(8);if(t===98||t===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 63:return this.readToken_question();case 126:return this.finishOp(J.prefix,1)}this.raise(this.pos,`Unexpected character '`+Go(e)+`'`)},Q.finishOp=function(e,t){var n=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,n)},Q.readRegexp=function(){for(var e,t,n=this.pos;;){this.pos>=this.input.length&&this.raise(n,`Unterminated regular expression`);var r=this.input.charAt(this.pos);if(_a.test(r)&&this.raise(n,`Unterminated regular expression`),e)e=!1;else{if(r===`[`)t=!0;else if(r===`]`&&t)t=!1;else if(r===`/`&&!t)break;e=r===`\\`}++this.pos}var i=this.input.slice(n,this.pos);++this.pos;var a=this.pos,o=this.readWord1();this.containsEsc&&this.unexpected(a);var s=this.regexpState||=new Oo(this);s.reset(n,i,o),this.validateRegExpFlags(s),this.validateRegExpPattern(s);var c=null;try{c=new RegExp(i,o)}catch{}return this.finishToken(J.regexp,{pattern:i,flags:o,value:c})},Q.readInt=function(e,t,n){for(var r=this.options.ecmaVersion>=12&&t===void 0,i=n&&this.input.charCodeAt(this.pos)===48,a=this.pos,o=0,s=0,c=0,l=t??1/0;c<l;++c,++this.pos){var u=this.input.charCodeAt(this.pos),d=void 0;if(r&&u===95){i&&this.raiseRecoverable(this.pos,`Numeric separator is not allowed in legacy octal numeric literals`),s===95&&this.raiseRecoverable(this.pos,`Numeric separator must be exactly one underscore`),c===0&&this.raiseRecoverable(this.pos,`Numeric separator is not allowed at the first of digits`),s=u;continue}if(d=u>=97?u-97+10:u>=65?u-65+10:u>=48&&u<=57?u-48:1/0,d>=e)break;s=u,o=o*e+d}return r&&s===95&&this.raiseRecoverable(this.pos-1,`Numeric separator is not allowed at the last of digits`),this.pos===a||t!=null&&this.pos-a!==t?null:o};function Uo(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,``))}function Wo(e){return typeof BigInt==`function`?BigInt(e.replace(/_/g,``)):null}Q.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var n=this.readInt(e);return n??this.raise(this.start+2,`Expected number in radix `+e),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(n=Wo(this.input.slice(t,this.pos)),++this.pos):da(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`),this.finishToken(J.num,n)},Q.readNumber=function(e){var t=this.pos;!e&&this.readInt(10,void 0,!0)===null&&this.raise(t,`Invalid number`);var n=this.pos-t>=2&&this.input.charCodeAt(t)===48;n&&this.strict&&this.raise(t,`Invalid number`);var r=this.input.charCodeAt(this.pos);if(!n&&!e&&this.options.ecmaVersion>=11&&r===110){var i=Wo(this.input.slice(t,this.pos));return++this.pos,da(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`),this.finishToken(J.num,i)}n&&/[89]/.test(this.input.slice(t,this.pos))&&(n=!1),r===46&&!n&&(++this.pos,this.readInt(10),r=this.input.charCodeAt(this.pos)),(r===69||r===101)&&!n&&(r=this.input.charCodeAt(++this.pos),(r===43||r===45)&&++this.pos,this.readInt(10)===null&&this.raise(t,`Invalid number`)),da(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`);var a=Uo(this.input.slice(t,this.pos),n);return this.finishToken(J.num,a)},Q.readCodePoint=function(){var e=this.input.charCodeAt(this.pos),t;if(e===123){this.options.ecmaVersion<6&&this.unexpected();var n=++this.pos;t=this.readHexChar(this.input.indexOf(`}`,this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(n,`Code point out of bounds`)}else t=this.readHexChar(4);return t};function Go(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}Q.readString=function(e){for(var t=``,n=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,`Unterminated string constant`);var r=this.input.charCodeAt(this.pos);if(r===e)break;r===92?(t+=this.input.slice(n,this.pos),t+=this.readEscapedChar(!1),n=this.pos):(ya(r,this.options.ecmaVersion>=10)&&this.raise(this.start,`Unterminated string constant`),++this.pos)}return t+=this.input.slice(n,this.pos++),this.finishToken(J.string,t)};var Ko={};Q.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===Ko)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1},Q.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Ko;this.raise(e,t)},Q.readTmplToken=function(){for(var e=``,t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,`Unterminated template`);var n=this.input.charCodeAt(this.pos);if(n===96||n===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===J.template||this.type===J.invalidTemplate)?n===36?(this.pos+=2,this.finishToken(J.dollarBraceL)):(++this.pos,this.finishToken(J.backQuote)):(e+=this.input.slice(t,this.pos),this.finishToken(J.template,e));if(n===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(ya(n)){switch(e+=this.input.slice(t,this.pos),++this.pos,n){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:e+=`
|
|
92
92
|
`;break;default:e+=String.fromCharCode(n);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else ++this.pos}},Q.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case`\\`:++this.pos;break;case`$`:if(this.input[this.pos+1]!==`{`)break;case"`":return this.finishToken(J.invalidTemplate,this.input.slice(this.start,this.pos))}this.raise(this.start,`Unterminated template`)},Q.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.pos);switch(++this.pos,t){case 110:return`
|
|
93
|
-
`;case 114:return`\r`;case 120:return String.fromCharCode(this.readHexChar(2));case 117:return Go(this.readCodePoint());case 116:return` `;case 98:return`\b`;case 118:return`\v`;case 102:return`\f`;case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),``;case 56:case 57:if(e){var n=this.pos-1;return this.invalidStringToken(n,`Invalid escape sequence in template string`),null}default:if(t>=48&&t<=55){var r=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],i=parseInt(r,8);return i>255&&(r=r.slice(0,-1),i=parseInt(r,8)),this.pos+=r.length-1,t=this.input.charCodeAt(this.pos),(r!==`0`||t===56||t===57)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-r.length,e?`Octal literal in template string`:`Octal literal in strict mode`),String.fromCharCode(i)}return ya(t)?``:String.fromCharCode(t)}},Q.readHexChar=function(e){var t=this.pos,n=this.readInt(16,e);return n===null&&this.invalidStringToken(t,`Bad character escape sequence`),n},Q.readWord1=function(){this.containsEsc=!1;for(var e=``,t=!0,n=this.pos,r=this.options.ecmaVersion>=6;this.pos<this.input.length;){var i=this.fullCharCodeAtPos();if(fa(i,r))this.pos+=i<=65535?1:2;else if(i===92){this.containsEsc=!0,e+=this.input.slice(n,this.pos);var a=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,`Expecting Unicode escape sequence \\uXXXX`),++this.pos;var o=this.readCodePoint();(t?da:fa)(o,r)||this.invalidStringToken(a,`Invalid Unicode escape`),e+=Go(o),n=this.pos}else break;t=!1}return e+this.input.slice(n,this.pos)},Q.readWord=function(){var e=this.readWord1(),t=J.name;return this.keywords.test(e)&&(t=ga[e]),this.finishToken(t,e)},Xa.acorn={Parser:Xa,version:`7.4.1`,defaultOptions:ja,Position:Oa,SourceLocation:ka,getLineInfo:Aa,Node:po,TokenType:K,tokTypes:J,keywordTypes:ga,TokContext:go,tokContexts:_o,isIdentifierChar:fa,isIdentifierStart:da,Token:Ho,isNewLine:ya,lineBreak:_a,lineBreakG:va,nonASCIIwhitespace:ba};function qo(e,t){return Xa.parse(e,t)}function Jo(e){return[`ArrayOrObject1D`,`ArrayOrObject2D`,`ArrayOrObject3DPlus`,`Literal`,`Symbol`,`UnaryOperation`,`BinaryOperation`,`Random`,`UserDefinedFunctionCall`,`SystemDefinedFunctionCall`,`ConditionalExpression`,`ArrayExpression`,`ObjectExpression`].includes(e.type)}function Yo(e){return e.type===`Program`?e.body.map(e=>$(e)):[$(e)]}function $(e){switch(e.type){case`Program`:return ds(e);case`ExpressionStatement`:return fs(e);case`AssignmentExpression`:return ps(e);case`MemberExpression`:return gs(e);case`UnaryExpression`:return ms(e);case`BinaryExpression`:return hs(e);case`Identifier`:return _s(e);case`Literal`:return vs(e);case`CallExpression`:return ss(e);case`IfStatement`:return os(e);case`BlockStatement`:return as(e);case`FunctionDeclaration`:return Xo(e);case`ForStatement`:return is(e);case`BreakStatement`:return ns(e);case`ReturnStatement`:return rs(e);case`ContinueStatement`:return ts(e);case`UpdateExpression`:return Zo(e);case`LogicalExpression`:return Qo(e);case`TemplateLiteral`:return $o(e);case`TemplateElement`:return es(e);case`ConditionalExpression`:return ys(e);case`Property`:return bs(e);case`ObjectExpression`:return xs(e);case`ArrayExpression`:return Ss(e);default:throw console.log(e),Error(`未定義の AST ノードです :`+e.type)}}function Xo(e){return{type:`UserDefinedFunction`,functionName:e.id.name,body:$(e.body)}}function Zo(e){return{type:`UpdateExpression`,operator:e.operator,argument:$(e.argument)}}function Qo(e){return{type:`LogicalExpression`,operator:e.operator,left:$(e.left),right:$(e.right)}}function $o(e){return{type:`TemplateLiteral`,expressions:e.expressions.map(e=>$(e)),quasis:e.quasis.map(e=>$(e))}}function es(e){return{type:`TemplateElement`,value:e.value}}function ts(e){return{type:`Continue`,label:e.label}}function ns(e){return{type:`Break`,label:e.label}}function rs(e){return{type:`Return`,argument:$(e.argument)}}function is(e){return{type:`ForStatement`,body:e.body.body.map(e=>$(e)),init:$(e.init),test:$(e.test),update:$(e.update)}}function as(e){return{type:`BlockStatement`,value:e.body.map(e=>$(e))}}function os(e){return{type:`IfStatement`,consequent:$(e.consequent),test:$(e.test),alternate:e.alternate?$(e.alternate):void 0}}function ss(e){if(e.callee.type!==`Identifier`)throw Error(`WWAでは存在しない構文です`);let t=e.callee.name;switch(t){case`RAND`:return us(e.arguments);case`MSG`:case`MESSAGE`:return ls(e.arguments);case`JUMPGATE`:case`MUSIC`:case`SOUND`:case`BGM_STOP`:case`STOP_BGM`:case`SOUND_STOP`:case`STOP_SOUND`:case`ALL_SOUND_STOP`:case`STOP_ALL_SOUND`:case`SAVE`:case`LOG`:case`ABLE_CHANGE_SPEED`:case`SET_SPEED`:case`CHANGE_GAMEOVER_POS`:case`DEL_PLAYER`:case`RESTART_GAME`:case`URL_JUMPGATE`:case`HIDE_STATUS`:case`PARTS`:case`FACE`:case`EFFECT`:case`CHANGE_PLAYER_IMAGE`:case`CHANGE_PLAYER_IMG`:case`HAS_ITEM`:case`REMOVE_ITEM`:case`MOVE`:case`PARTS_MOVE`:case`IS_PLAYER_WAITING_MESSAGE`:case`IS_MANUAL_PAUSE`:case`IS_PLAYER_WAITING_ENTER`:case`GET_UNIXTIME`:case`GET_DATE_YEAR`:case`GET_DATE_MONTH`:case`GET_DATE_DAY`:case`GET_DATE_HOUR`:case`GET_DATE_MINUTES`:case`GET_DATE_SECONDS`:case`GET_DATE_MILLISECONDS`:case`GET_DATE_WEEKDAY`:case`CHANGE_SYSMSG`:case`PICTURE`:case`PICTURE_FROM_PARTS`:case`CLEAR_ALL_PICTURES`:case`HAS_PICTURE`:case`SHOW_USER_DEF_VAR`:case`ABS`:case`POW`:case`SQRT`:case`SIN`:case`COS`:case`TAN`:case`GET_GAMEOVER_POS_X`:case`GET_GAMEOVER_POS_Y`:case`ABORT_BATTLE`:case`EXIT`:case`GET_IMG_POS_X`:case`GET_IMG_POS_Y`:case`LENGTH`:case`IS_NUMBER`:case`CLONE`:case`MANUAL_PAUSE`:case`WAIT_ENTER`:case`CANCEL_MANUAL_PAUSE`:case`CANCEL_WAIT_ENTER`:case`COLOR`:case`EFFITEM`:case`CHANGE_BOM_IMG`:case`CHANGE_BOM_IMAGE`:case`CHANGE_CLICK_IMAGE`:case`CHANGE_CLICK_IMG`:case`CHANGE_FRAME_IMAGE`:case`CHANGE_FRAME_IMG`:case`CHANGE_YESNO_IMAGE`:case`CHANGE_YESNO_IMG`:case`NO_GAMEOVER`:case`DEFAULT`:case`DIR_MAP`:case`CHANGE_SOUND_ATTACK`:case`CHANGE_SOUND_DECISION`:case`SORT`:return cs(e.arguments,t);default:return{type:`UserDefinedFunctionCall`,functionName:t}}}function cs(e,t){return{type:`SystemDefinedFunctionCall`,functionName:t,value:e.map(e=>$(e))}}function ls(e){return{type:`Msg`,value:$(e[0])}}function us(e){if(e.length<1)throw Error(`RAND関数には引数が必要です。`);return{type:`Random`,value:$(e[0])}}function ds(e){if(e.body.length!==1)throw Error(`bodyが1以外の場合評価できません。`);return $(e.body[0])}function fs(e){return $(e.expression)}function ps(e){let t=$(e.left),n=$(e.right);if(!Jo(n))throw Error(`値以外を代入式の右辺に設定できません`);switch(e.operator){case`=`:case`+=`:case`-=`:case`*=`:case`/=`:if(t.type===`ArrayOrObject2D`){if(t.name===`m`||t.name===`o`)return{type:`PartsAssignment`,partsKind:t.name===`m`?`map`:`object`,destinationX:t.indecies[0],destinationY:t.indecies[1],value:n,operator:e.operator};if(t.name===`v`)return{type:`UserVariableAssignment`,index:[t.indecies[0],t.indecies[1]],value:n,operator:e.operator};throw Error(`想定していない記号が2次元配列ででてきました`)}else if(t.type===`ArrayOrObject1D`){if(t.name===`ITEM`)return{type:`ItemAssignment`,itemBoxPosition1to12:t.indecies[0],value:n,operator:e.operator};if(t.name===`v`)return{type:`UserVariableAssignment`,index:[t.indecies[0]],value:n,operator:e.operator};if(t.name===`LP`)return{type:`LoopPointerAssignment`,index:t.indecies[0],value:n,operator:e.operator};throw Error(`1次元配列にて想定していないシンボルが指定されました ${t.name}`)}else if(t.type===`Symbol`){if(t.name===`m`||t.name===`o`||t.name===`v`||t.name===`ITEM`||t.name===`X`||t.name===`Y`||t.name===`ID`||t.name===`TYPE`||t.name===`CX`||t.name===`CY`||t.name===`PICTURE`||t.name===`PLAYER_PX`||t.name===`PLAYER_PY`||t.name===`MOVE_SPEED`||t.name===`MOVE_FRAME_TIME`||t.name===`LP`||t.name===`SORT_A`||t.name===`SORT_B`||t.name===`undefined`)throw Error(`このシンボルには代入できません`);if(t.name===`AT_TOTAL`)throw Error(`"装備品込みの攻撃力(AT_TOTAL)への代入はできません。"`);if(t.name===`DF_TOTAL`)throw Error(`"装備品込みの防御力(DF_TOTAL)への代入はできません。"`);if(t.name===`ENEMY_HP`||t.name===`ENEMY_AT`||t.name===`ENEMY_DF`||t.name===`ENEMY_GD`)throw Error(`敵ステータス (ENEMY_HP, ENEMY_AT, ENEMY_DF, ENEMY_GD) への代入はできません。`);return{type:`SpecialParameterAssignment`,kind:t.name,value:n,operator:e.operator}}else if(t.type===`Literal`)throw Error(`数値には代入できません`);else if(t.type===`ArrayOrObject3DPlus`&&t.name===`v`)return{type:`UserVariableAssignment`,index:t.indecies,value:n,operator:e.operator};else throw Error(`代入できません`);default:throw Error(`想定していないオペレーターです`)}}function ms(e){let t=$(e.argument);if(![`+`,`-`,`!`].includes(e.operator))throw Error(`未定義の演算子です :`+e.operator);if(!Jo(t))throw Error(`単項演算子が適用できません`);return{type:`UnaryOperation`,operator:e.operator,argument:t}}function hs(e){let t=$(e.left),n=$(e.right);if(!Jo(t)||!Jo(n))throw Error(`左辺または右辺が評価不能です`);switch(e.operator){case`+`:case`-`:case`*`:case`/`:case`%`:case`>`:case`<`:case`>=`:case`<=`:case`==`:case`!=`:return{type:`BinaryOperation`,operator:e.operator,left:t,right:n};default:throw Error(`未定義の演算子です :`+e.operator)}}function gs(e){let t=$(e.object),n=$(e.property);if(t.type===`Symbol`){if(![`v`,`m`,`o`,`ITEM`,`LP`,`PICTURE`,`SORT_A`,`SORT_B`].includes(t.name))throw Error(`このシンボルは配列にできません`);if(Jo(n))return{type:`ArrayOrObject1D`,name:t.name,indecies:[n]};throw Error(`WWAでは存在しない構文です`)}else if(t.type===`ArrayOrObject1D`){if(t.name===`ITEM`||t.name===`PICTURE`)throw Error(`この配列は2次元以上にはできません。`);if(Jo(n))return{type:`ArrayOrObject2D`,name:t.name,indecies:[...t.indecies,n]};throw Error(`WWAでは存在しない構文です`)}else if(t.type===`ArrayOrObject2D`||t.type===`ArrayOrObject3DPlus`){if(t.name===`m`||t.name===`o`)throw Error(`この配列は3次元以上にはできません。`);if((t.name===`v`||t.name===`SORT_A`||t.name===`SORT_B`)&&Jo(n))return{type:`ArrayOrObject3DPlus`,name:t.name,indecies:[...t.indecies,n]}}else if(t.type===`SystemDefinedFunctionCall`){if(Jo(n))return{type:`SystemDefinedFunctionCall`,functionName:t.functionName,value:t.value,indecies:[...t.indecies??[],n]};throw Error(`WWAでは存在しない構文です`)}else if(t.type===`UserDefinedFunctionCall`){if(Jo(n))return{type:`UserDefinedFunctionCall`,functionName:t.functionName,indecies:[...t.indecies??[],n]};throw Error(`WWAでは存在しない構文です`)}}function _s(e){switch(e.name){case`m`:case`o`:case`ITEM`:case`X`:case`Y`:case`ID`:case`TYPE`:case`PX`:case`PY`:case`CX`:case`CY`:case`v`:case`HP`:case`HPMAX`:case`AT`:case`AT_TOTAL`:case`DF`:case`DF_TOTAL`:case`GD`:case`STEP`:case`TIME`:case`PDIR`:case`i`:case`j`:case`k`:case`LOOPLIMIT`:case`ITEM_ID`:case`ITEM_POS`:case`ENEMY_HP`:case`ENEMY_AT`:case`ENEMY_DF`:case`PICTURE`:case`PLAYER_PX`:case`PLAYER_PY`:case`MOVE_SPEED`:case`MOVE_FRAME_TIME`:case`LP`:case`SORT_A`:case`SORT_B`:case`undefined`:return{type:`Symbol`,name:e.name};default:return{type:`Literal`,value:e.name}}}function vs(e){if(!f(e.value))throw TypeError(`Literal の値が不正です`);return{type:`Literal`,value:e.value}}function ys(e){let t=$(e.consequent),n=$(e.alternate);return{type:`ConditionalExpression`,consequent:t,test:$(e.test),alternate:n}}function bs(e){let t=$(e.key);if(t.type===`Symbol`)throw Error(`Object のキー ${t.name} は予約されているため、使用できません。`);if(t.type!==`Literal`)throw Error(`Object のキーが不正です。 Literal を期待していましたが、実際は ${t.type} でした。`);return{type:`Property`,key:t,value:$(e.value)}}function xs(e){return{type:`ObjectExpression`,properties:e.properties.map(bs)}}function Ss(e){return{type:`ArrayExpression`,elements:e.elements.map($)}}var Cs=[j.OBJECT,j.MAP],ws=e=>Math.abs(e)<2**-52;function Ts(e){switch(typeof e){case`object`:if(e===null)break;return Array.isArray(e)?e.length:Object.keys(e).length;case`string`:return e.length}throw Error(`LENGTH: 対応できない値が指定されています。`)}var Es=(e,t)=>(e-t)*R.CHIP_SIZE,Ds=(e,t)=>(e-t)*R.CHIP_SIZE,Os=class{constructor(e){this.value=e}},ks=Object.freeze({"=":(e,t)=>t,"+=":(e,t)=>e+t,"-=":(e,t)=>e-t,"*=":(e,t)=>e*t,"/=":(e,t)=>e/t}),As=class{constructor(e){this.wwa=e,this.loop_limit=1e5,this.state={messagePageAdditionalQueue:[]}}setTriggerParts(e,t,n){this.state={...this.state,triggerParts:{id:e,type:t,position:n}}}clearTemporaryState(){this.state={...this.state,triggerParts:void 0,messagePageAdditionalQueue:[]}}setEarnedItem(e,t){this.state={...this.state,earnedItem:{partsId:e,itemPos1To12:t}}}clearEarnedItem(){this.state={...this.state,earnedItem:void 0}}setBattleDamageCalculationMode(e){this.state={...this.state,battleDamageCalculation:{estimatingParams:e}}}clearBattleDamageCalculationMode(){this.state={...this.state,battleDamageCalculation:void 0}}evalWwaNodes(e){try{return this.evalWwaNodeInternal({type:`BlockStatement`,value:e})}catch(e){if(e instanceof Os)return{isGameOver:!0,value:e.value};throw e}}evalWwaNode(e){try{return{isGameOver:!1,value:this.evalWwaNodeInternal(e)}}catch(e){if(e instanceof Os)return{isGameOver:!0,value:e.value};throw e}}evalWwaNodeInternal(e){if(!(e.type===`BlockStatement`&&Array.isArray(e.value)&&e.value.length===0))try{return new js(this).evalWwaNode(e)}catch(e){if(e instanceof Ms)return e.value;if(e instanceof Ns)switch(e.reason){case`ABORT_BATTLE`:case`EXIT`:return e.value;case`GAME_OVER`:throw new Os(e.value);default:throw TypeError(`ExitInformationのreasonが不正です: `+e.reason)}else throw e}}addPageAdditionalItem(e){this.state.messagePageAdditionalQueue.push(e)}pickPageAdditionalQueue(){let e=[...this.state.messagePageAdditionalQueue];return this.state.messagePageAdditionalQueue=[],e}updateLoopLimit(e){this.loop_limit=e}},js=class e{constructor(e){this.generator=e,this.for_id={i:null,j:null,k:null,LP:[],loopCount:0,break_flag:!1,continue_flag:!1,sort_a:null,sort_b:null}}evalWwaNodes(e){let t;return e.forEach(e=>{t=this.evalWwaNode(e)}),t}evalWwaNode(e){if(!(this.for_id.break_flag||this.for_id.continue_flag))switch(e.type){case`UnaryOperation`:return this.evalUnaryOperation(e);case`BinaryOperation`:return this.evalBinaryOperation(e);case`Symbol`:return this.evalSymbol(e);case`ArrayOrObject1D`:return this.evalArrayOrObject1D(e);case`ArrayOrObject2D`:return this.evalArrayOrObject2D(e);case`ArrayOrObject3DPlus`:return this.evalArrayOrObject3DPlus(e);case`Literal`:return this.evalLiteral(e);case`UserVariableAssignment`:return this.evalSetUserVariable(e);case`SpecialParameterAssignment`:return this.evalSetSpecialParameter(e);case`Random`:return this.evalRandom(e);case`Msg`:return this.evalMessage(e);case`ItemAssignment`:return this.itemAssignment(e);case`IfStatement`:return this.ifStatement(e);case`BlockStatement`:return this.blockStatement(e);case`PartsAssignment`:return this.partsAssignment(e);case`ForStatement`:return this.forStateMent(e);case`SystemDefinedFunctionCall`:return this.evalSystemDefinedFunctionCall(e);case`UserDefinedFunctionCall`:return this.evalUserDefinedFunctionCall(e);case`UserDefinedFunction`:return;case`Break`:return this.breakStatement(e);case`Return`:throw new Ms(this.returnStatement(e));case`Continue`:return this.contunueStatment(e);case`UpdateExpression`:return this.updateExpression(e);case`LogicalExpression`:return this.logicalExpression(e);case`TemplateLiteral`:return this.convertTemplateLiteral(e);case`ConditionalExpression`:return this.convertConditionalExpression(e);case`Property`:return this.property(e);case`ObjectExpression`:return this.objectExpression(e);case`ArrayExpression`:return this.arrayExpression(e);case`LoopPointerAssignment`:return this.convertLoopPointerExpression(e);default:throw console.log(e),Error(`未定義または未実装のノードです`)}}wrapCallFunction(e,t){try{return t(e)}catch(e){if(e instanceof Ms)return e.value;throw e}}evalUserDefinedFunctionCall(e){let t=this.generator.wwa.getUserScript(e.functionName);if(t===null)throw Error(`未定義の関数が呼び出されました: ${e.functionName}`);let n=this.wrapCallFunction(t,e=>this.evalWwaNode(e));return(e.indecies?.map(e=>this.evalWwaNode(e))??[]).reduce((e,t)=>Ke(e,t),n)}updateExpression(e){if(e.argument.type!==`ArrayOrObject1D`&&e.argument.type!==`ArrayOrObject2D`&&e.argument.type!==`Symbol`)throw Error(`node.argument.typeが インクリメント/デクリメントできる対象ではありません。: ${e.argument.type}`);let t=t=>{switch(e.operator){case`++`:return t+1;case`--`:return t-1;default:throw Error(`想定外のOperatorが渡されました :`+e.operator)}},n=this.evalWwaNode(e.argument),r={type:`Literal`,value:t(n)};switch(e.argument.type){case`ArrayOrObject1D`:if(e.argument.name===`v`)this.evalSetUserVariable({type:`UserVariableAssignment`,index:[e.argument.indecies[0]],value:r});else if(e.argument.name===`ITEM`)this.itemAssignment({type:`ItemAssignment`,itemBoxPosition1to12:e.argument.indecies[0],value:r});else if(e.argument.name===`LP`)this.convertLoopPointerExpression({type:`LoopPointerAssignment`,index:e.argument.indecies[0],value:r,operator:`=`});else throw Error(`このリテラルはインクリメント/デクリメントできません: ${e.argument.type}`);break;case`ArrayOrObject2D`:{let t={type:`PartsAssignment`,destinationX:e.argument.indecies[0],destinationY:e.argument.indecies[1],value:r,operator:`=`};if(e.argument.name===`m`)this.partsAssignment({...t,partsKind:`map`});else if(e.argument.name===`o`)this.partsAssignment({...t,partsKind:`object`});else throw Error(`このリテラルはインクリメント/デクリメントできません: ${e.argument.type}`);break}case`Symbol`:{let t={type:`SpecialParameterAssignment`,kind:e.argument.name,value:r};this.evalSetSpecialParameter(t);break}}return n}logicalExpression(e){let t=this.evalWwaNode(e.left),n=this.evalWwaNode(e.right);switch(e.operator){case`||`:return t||n;case`&&`:return t&&n;default:throw Error(`存在しない論理式です!: `+e.operator)}}convertTemplateLiteral(e){let t=e.expressions.map(e=>this.evalWwaNode(e)),n=e.quasis.map(e=>e.value.cooked),r=``;return n.forEach((e,n)=>{r+=e,t[n]!==void 0&&(r+=t[n])}),r}contunueStatment(e){this.for_id.continue_flag=!0}breakStatement(e){this.for_id.break_flag=!0}returnStatement(e){return this.evalWwaNode(e.argument)}forStateMent(e){let t=e.init;for((()=>{if(`kind`in t)switch(t.kind){case`i`:if(this.for_id.i!==null)throw Error(`iの値が既に外側のforループで使われています。`);break;case`j`:if(this.for_id.j!==null)throw Error(`jの値が既に外側のforループで使われています。`);break;case`k`:if(this.for_id.k!==null)throw Error(`kの値が既に外側のforループで使われています。`);break;default:throw console.log(e),Error(`予想外の変数がfor文内で使用されました :`+t.kind)}else switch(t.type){case`LoopPointerAssignment`:let n=Number(this.evalWwaNode(t.index));if(Number.isNaN(n))throw Error(`LPのIndex値はNumberでないといけません。: ${n}`);if(this.for_id.LP[n]!==null&&this.for_id.LP[n]!==void 0)throw Error(`LP[${n}]の値が既に外側のforループで使われています。`);break;default:throw console.log(e),Error(`予想外の1次元配列がfor文内で使用されました :`+t)}this.evalWwaNode(e.init)})();this.evalWwaNode(e.test);this.evalWwaNode(e.update)){if(this.for_id.loopCount++,this.for_id.loopCount>this.generator.loop_limit)throw Error(`処理回数が多すぎます!
|
|
94
|
-
上限値は LOOPLIMIT で変えられます。`);if(this.for_id.break_flag||!this.evalWwaNode(e.test))break;this.evalWwaNodes(e.body),this.for_id.continue_flag=!1}if(this.for_id.break_flag=!1,`kind`in t)switch(t.kind){case`i`:this.for_id.i=null;break;case`j`:this.for_id.j=null;break;case`k`:this.for_id.k=null;break}else switch(t.type){case`LoopPointerAssignment`:let e=Number(this.evalWwaNode(t.index));this.for_id.LP[e]=null;break}}_checkArgsLength(e,t){if(t.value.length<e)throw Error(`関数 ${t.functionName} の引数が不足しています!`)}evalSystemDefinedFunctionCall(e){let t=this.wrapCallFunction(e,e=>this.evalSystemDefinedFunctionCallInner(e));return(e.indecies?.map(e=>this.evalWwaNode(e))??[]).reduce((e,t)=>Ke(e,t),t)}evalSystemDefinedFunctionCallInner(t){let n=this.generator.wwa.getGameStatus();switch(t.functionName){case`JUMPGATE`:{let n=this.evalWwaNode(t.value[0]),r=this.evalWwaNode(t.value[1]),i=t.value[2]?this.evalWwaNode(t.value[2]):E.NO_DIRECTION;if(isNaN(n)||isNaN(r))throw Error(`飛び先の値が数値になっていません。 x=${n} / y=${r}`);let a=e.convertDirection(i);if(!Je(a))throw TypeError(`この値の向きにプレイヤーを向けることはできません`+i);this.generator.wwa.forcedJumpGate(n,r,a);return}case`MUSIC`:case`SOUND`:{this._checkArgsLength(1,t);let e=this.evalWwaNode(t.value[0]),n=t.value[1]?this.evalWwaNode(t.value[1]):void 0,r=t.value[2]?this.evalWwaNode(t.value[2]):!1;return this.generator.wwa.playSound(e,{loopPlaying:n,bgmDelayDurationMs:r>=0?r:void 0}),e}case`BGM_STOP`:case`STOP_BGM`:this.generator.wwa.stopBgm();return;case`SOUND_STOP`:case`STOP_SOUND`:{this._checkArgsLength(1,t);let e=this.evalWwaNode(t.value[0]);return this.generator.wwa.stopSound(e,{includeBgm:!0}),e}case`STOP_SOUNDS`:case`ALL_SOUND_STOP`:case`STOP_ALL_SOUND`:{let e=t.value.length>0?this.evalWwaNode(t.value[0]):new Map;if(!(e instanceof Map))throw Error(`STOP_ALL_SOUND の引数はオブジェクトで指定してください。`);let n=e?.get(`includeBgm`)??!0;this.generator.wwa.stopAllSound({includeBgm:!!n});return}case`SAVE`:{this._checkArgsLength(1,t);let e=!!this.evalWwaNode(t.value[0]);return this.generator.wwa.disableSave(e),e}case`LOG`:{this._checkArgsLength(1,t);let e=this.evalWwaNode(t.value[0]);console.log(e instanceof Map?d(e):e);return}case`ABLE_CHANGE_SPEED`:{this._checkArgsLength(1,t);let e=!!this.evalWwaNode(t.value[0]);return this.generator.wwa.speedChangeJudge(e),e}case`SET_SPEED`:{this._checkArgsLength(1,t);let e=Number(this.evalWwaNode(t.value[0]));this.generator.wwa.setPlayerSpeedIndex(e);return}case`CHANGE_GAMEOVER_POS`:{this._checkArgsLength(2,t);let e={x:Number(this.evalWwaNode(t.value[0])),y:Number(this.evalWwaNode(t.value[1]))};if(e.x<0||e.x>=this.generator.wwa.getMapWidth()||e.y<0||e.y>this.generator.wwa.getMapWidth())throw Error(`マップの範囲外が指定されています!`);this.generator.wwa.setGameOverPosition(new S(e.x,e.y));return}case`DEL_PLAYER`:{this._checkArgsLength(1,t);let e=!!this.evalWwaNode(t.value[0]);this.generator.wwa.setDelPlayer(e);return}case`RESTART_GAME`:this.generator.wwa.restartGame();return;case`URL_JUMPGATE`:throw Error(`URL_JUMPGATE 関数は調整中のためご利用になれません`);case`HIDE_STATUS`:{this._checkArgsLength(2,t);let e=Number(this.evalWwaNode(t.value[0])),n=!!this.evalWwaNode(t.value[1]);this.generator.wwa.hideStatus(e,n);return}case`PARTS`:{this._checkArgsLength(2,t);let e=Number(this.evalWwaNode(t.value[0])),n=Number(this.evalWwaNode(t.value[1])),r=t.value[2]?Number(this.evalWwaNode(t.value[2])):0,i=t.value[3]?!!this.evalWwaNode(t.value[3]):!1;if(e<0||n<0)throw Error(`パーツ番号が不正です`);if(!Cs.includes(r))throw Error(`パーツ種別が不明です`);this.generator.wwa.replaceParts(e,n,r,i);return}case`FACE`:{this._checkArgsLength(6,t);let e=Number(this.evalWwaNode(t.value[0])),n=Number(this.evalWwaNode(t.value[1])),r=Number(this.evalWwaNode(t.value[2])),i=Number(this.evalWwaNode(t.value[3])),a=Number(this.evalWwaNode(t.value[4])),o=Number(this.evalWwaNode(t.value[5]));if(e<0||n<0||r<0||i<0||a<0||o<0)throw Error(`各引数は0以上の整数でなければなりません。`);this.generator.addPageAdditionalItem({type:`face`,data:{face:new w(new S(e,n),new S(r,i),new S(a,o))}});return}case`EFFECT`:{this._checkArgsLength(1,t);let e=Number(this.evalWwaNode(t.value[0]));if(e<0)throw Error(`待ち時間は0以上の整数でなければなりません。`);if(e===0){this.generator.wwa.stopEffect();return}let n=[];for(let e=1;e<t.value.length;e+=2){let r=Number(this.evalWwaNode(t.value[e]));if(r<0)throw Error(`画像のパーツ座標指定は0以上の整数でなければなりません。`);if(e+1===t.value.length)throw Error(`画像のパーツ座標指定で、Y座標が指定されていません。`);let i=Number(this.evalWwaNode(t.value[e+1]));if(i<0)throw Error(`画像のパーツ座標指定は0以上の整数でなければなりません。`);n.push(new S(r,i))}this.generator.wwa.setEffect(e,n);return}case`CHANGE_PLAYER_IMAGE`:case`CHANGE_PLAYER_IMG`:{this._checkArgsLength(2,t);let e=new S(Number(this.evalWwaNode(t.value[0])),Number(this.evalWwaNode(t.value[1])));this.generator.wwa.setPlayerImgCoord(e);return}case`HAS_ITEM`:{this._checkArgsLength(1,t);let e=Number(this.evalWwaNode(t.value[0]));return n.itemBox.includes(e)}case`REMOVE_ITEM`:{this._checkArgsLength(1,t);let e=Number(this.evalWwaNode(t.value[0])),r=t.value[1]?this.evalWwaNode(t.value[1])===1:!1,i=0;for(let t=0;t<n.itemBox.length;t++)if(e===n.itemBox[t]&&(this.generator.wwa.setPlayerGetItem(t+1,0),i++,!r))return i;return i}case`MOVE`:{this._checkArgsLength(1,t);let e=Number(this.evalWwaNode(t.value[0]));if(e<=0||e>9)throw Error(`MOVEの移動先は2/4/6/8で指定してください!`);return this.generator.wwa.movePlayer(e),this.generator.wwa.movePlayer(e),0}case`PARTS_MOVE`:{this._checkArgsLength(1,t);let e=Number(this.evalWwaNode(t.value[0]));return this.generator.wwa.setMoveMacroWaitingToPlayer(e),0}case`IS_PLAYER_WAITING_MESSAGE`:return this.generator.wwa.isPlayerWaitingMessage();case`IS_MANUAL_PAUSE`:case`IS_PLAYER_WAITING_ENTER`:return this.generator.wwa.isManualPause();case`GET_UNIXTIME`:return Math.floor(new Date().getTime()/1e3);case`GET_DATE_YEAR`:return new Date().getFullYear();case`GET_DATE_MONTH`:return new Date().getMonth()+1;case`GET_DATE_DAY`:return new Date().getDate();case`GET_DATE_HOUR`:return new Date().getHours();case`GET_DATE_MINUTES`:return new Date().getMinutes();case`GET_DATE_SECONDS`:return new Date().getSeconds();case`GET_DATE_MILLISECONDS`:return new Date().getMilliseconds();case`GET_DATE_WEEKDAY`:return new Date().getDay();case`SHOW_USER_DEF_VAR`:console.log(this.generator.wwa.getAllUserNameVar());return;case`CHANGE_SYSMSG`:{this._checkArgsLength(1,t);let e=this.evalWwaNode(t.value[0]),n=t.value.length>=2?this.evalWwaNode(t.value[1]):void 0,r=this.resolveSystemMessageKeyFromMacroArg(e);if(!r)throw Error(`このIDのシステムメッセージは未定義です。`);if(typeof n==`number`||typeof n==`string`||typeof n==`boolean`)this.generator.wwa.overwriteSystemMessage(r,String(n));else if(n==null)this.generator.wwa.overwriteSystemMessage(r,void 0);else throw Error(`この値は文字列に変換できないため、システムメッセージを表示できません。`);break}case`PICTURE`:{this._checkArgsLength(1,t);let e=Number(this.evalWwaNode(t.value[0])),n=t.value.length>=2?this.evalWwaNode(t.value[1]):void 0;if(n===void 0){this.generator.wwa.deletePictureRegistry(e);return}if(n instanceof Map)this.generator.wwa.setPictureRegistryFromObject(e,d(n));else if(typeof n==`string`)this.generator.wwa.setPictureRegistryFromRawText(e,n);else throw Error(`ピクチャのプロパティ定義は文字列あるいはオブジェクトである必要があります。`);break}case`PICTURE_FROM_PARTS`:{this._checkArgsLength(2,t);let e=Number(this.evalWwaNode(t.value[0])),n=Number(this.evalWwaNode(t.value[1]));if(n===0){this.generator.wwa.deletePictureRegistry(e);return}let r=t.value.length>=3?Number(this.evalWwaNode(t.value[2])):j.OBJECT;if(!Cs.includes(r))throw Error(`パーツ種別が不明です`);let i=this.generator.wwa.getGameStatus();this.generator.wwa.setPictureRegistry(e,n,r,i.playerCoord);break}case`CLEAR_ALL_PICTURES`:this.generator.wwa.clearAllPictures();break;case`HAS_PICTURE`:{this._checkArgsLength(1,t);let e=Number(this.evalWwaNode(t.value[0]));return n.wwaData.pictureRegistry.some(t=>t.layerNumber===e)}case`ABS`:{this._checkArgsLength(1,t);let e=Number(this.evalWwaNode(t.value[0]));return Math.abs(e)}case`POW`:return this._checkArgsLength(2,t),Number(this.evalWwaNode(t.value[0]))**+Number(this.evalWwaNode(t.value[1]));case`SQRT`:{this._checkArgsLength(1,t);let e=Number(this.evalWwaNode(t.value[0]));return Math.sqrt(e)}case`SIN`:{this._checkArgsLength(1,t);let e=Number(this.evalWwaNode(t.value[0])),n=Math.sin(e*Math.PI/180);return ws(n)?0:n}case`COS`:{this._checkArgsLength(1,t);let e=Number(this.evalWwaNode(t.value[0])),n=Math.cos(e*Math.PI/180);return ws(n)?0:n}case`TAN`:{this._checkArgsLength(1,t);let e=Number(this.evalWwaNode(t.value[0])),n=Math.tan(e*Math.PI/180);return ws(n)?0:n}case`GET_GAMEOVER_POS_X`:return this.generator.wwa.getGemeOverPosition().x;case`GET_GAMEOVER_POS_Y`:return this.generator.wwa.getGemeOverPosition().y;case`ABORT_BATTLE`:throw this.generator.state.battleDamageCalculation&&(this.generator.state.battleDamageCalculation.aborted=!0),new Ns(`ABORT_BATTLE`);case`EXIT`:throw new Ns(`EXIT`,this.evalWwaNode(t.value[0]));case`GET_IMG_POS_X`:{this._checkArgsLength(1,t);let e=Number(this.evalWwaNode(t.value[0])),n=(t.value[1]===void 0?0:Number(this.evalWwaNode(t.value[1])))===0?j.OBJECT:j.MAP;if(n===j.OBJECT){let n=t.value[2]===void 0?!0:Number(this.evalWwaNode(t.value[2]))===0,r=this.generator.wwa.getObjectInfo(e),i=n?r[R.ATR_X]:r[R.ATR_X2];return Math.floor(i/R.CHIP_SIZE)}else if(n===j.MAP){let t=this.generator.wwa.getMapInfo(e)[R.ATR_X];return Math.floor(t/R.CHIP_SIZE)}throw Error(`GET_IMG_POS_X: 指定したIDのパーツのTypeが異常です。`)}case`GET_IMG_POS_Y`:{this._checkArgsLength(1,t);let e=Number(this.evalWwaNode(t.value[0])),n=(t.value[1]===void 0?0:Number(this.evalWwaNode(t.value[1])))===0?j.OBJECT:j.MAP;if(n===j.OBJECT){let n=t.value[2]===void 0?!0:Number(this.evalWwaNode(t.value[2]))===0,r=this.generator.wwa.getObjectInfo(e),i=n?r[R.ATR_Y]:r[R.ATR_Y2];return Math.floor(i/R.CHIP_SIZE)}else if(n===j.MAP){let t=this.generator.wwa.getMapInfo(e)[R.ATR_Y];return Math.floor(t/R.CHIP_SIZE)}throw Error(`GET_IMG_POS_Y: 指定したIDのパーツのTypeが異常です。`)}case`LENGTH`:return this._checkArgsLength(1,t),Ts(this.evalWwaNode(t.value[0]));case`IS_NUMBER`:return this._checkArgsLength(1,t),typeof this.evalWwaNode(t.value[0])==`number`;case`CLONE`:{this._checkArgsLength(1,t);let e=this.evalWwaNode(t.value[0]);if(typeof e==`symbol`||!f(e)&&!(e instanceof Map)&&!Array.isArray(e))throw TypeError(`この値はクローンできません。`);try{return structuredClone(e)}catch(e){throw console.error(e),Error(`クローン中にエラーが発生しました。`)}}case`MANUAL_PAUSE`:case`WAIT_ENTER`:{let e=this.evalWwaNode(t.value[0]),n=e===`__BLOCK`;this.generator.wwa.manualPause({functionNames:{cancelPause:e&&!n?e:``,up:t.value[1]?this.evalWwaNode(t.value[1]):``,down:t.value[2]?this.evalWwaNode(t.value[2]):``,right:t.value[3]?this.evalWwaNode(t.value[3]):``,left:t.value[4]?this.evalWwaNode(t.value[4]):``},blockingCancelPauseByPlayer:n});return}case`CANCEL_MANUAL_PAUSE`:case`CANCEL_WAIT_ENTER`:this.generator.wwa.cancelManualPause();return;case`COLOR`:{this._checkArgsLength(4,t);let e=Number(this.evalWwaNode(t.value[0])),n=Number(this.evalWwaNode(t.value[1])),r=Number(this.evalWwaNode(t.value[2])),i=Number(this.evalWwaNode(t.value[3]));if(e<0||e>5)throw Error(`種別は0から5までです`);if(n<0||n>255||r<0||r>255||i<0||i>255)throw Error(`色が範囲外です`);this.generator.wwa.changeStyleRule(e,n,r,i);return}case`EFFITEM`:{this._checkArgsLength(1,t);let e=!!this.evalWwaNode(t.value[0]);this.generator.wwa.updateItemEffectEnabled(e);return}case`CHANGE_BOM_IMAGE`:case`CHANGE_BOM_IMG`:{this._checkArgsLength(2,t);let e=Number(this.evalWwaNode(t.value[0])),n=Number(this.evalWwaNode(t.value[1]));if(e<0||n<0)throw Error(`座標は0以上の整数ではありません`);this.generator.wwa.setBattleEffectCoord(new S(e,n));return}case`CHANGE_CLICK_IMAGE`:case`CHANGE_CLICK_IMG`:{this._checkArgsLength(2,t);let e=Number(this.evalWwaNode(t.value[0])),n=Number(this.evalWwaNode(t.value[1]));if(e<0||n<0)throw Error(`引数が0以上の整数ではありません`);this.generator.wwa.setImgClick(new S(e,n));return}case`CHANGE_FRAME_IMAGE`:case`CHANGE_FRAME_IMG`:{this._checkArgsLength(3,t);let e=Number(this.evalWwaNode(t.value[0])),n=Number(this.evalWwaNode(t.value[1])),r=Number(this.evalWwaNode(t.value[2]));if(n<0||r<0)throw Error(`座標は正でなければなりません。`);switch(e){case L.ENERGY:case L.STRENGTH:case L.DEFENCE:case L.GOLD:this.generator.wwa.setStatusIconCoord(e,new S(n,r));break;case L.WIDE_CELL_ROW:this.generator.wwa.setWideCellCoord(new S(n,r));break;case L.ITEM_BG:this.generator.wwa.setItemboxBackgroundPosition({x:n,y:r});break;case L.MAIN_FRAME:this.generator.wwa.setFrameCoord(new S(n,r));break;default:throw Error(`種別が不正です。`)}return}case`CHANGE_YESNO_IMAGE`:case`CHANGE_YESNO_IMG`:{this._checkArgsLength(2,t);let e=Number(this.evalWwaNode(t.value[0])),n=Number(this.evalWwaNode(t.value[1]));this.generator.wwa.setYesNoImgCoord(new S(e,n));return}case`NO_GAMEOVER`:{this._checkArgsLength(1,t);let e=this.evalWwaNode(t.value[0]);this.generator.wwa.setGameOverPolicy(e);return}case`DEFAULT`:{this._checkArgsLength(1,t);let e=!!this.evalWwaNode(t.value[0]);this.generator.wwa.setObjectNotCollapseOnPartsOnPlayer(e);return}case`DIR_MAP`:{this._checkArgsLength(2,t);let e=Number(this.evalWwaNode(t.value[0])),n=Number(this.evalWwaNode(t.value[1])),r=t.value[2]===void 0?j.OBJECT:Number(this.evalWwaNode(t.value[2]));if(e<0)throw Error(`パーツ番号が不正です`);if(r===j.OBJECT){if(e>=this.generator.wwa.getObjectPartsNum())throw Error(`パーツ番号が不正です`)}else if(e>=this.generator.wwa.getMapPartsNum())throw Error(`パーツ番号が不正です`);this.generator.wwa.appearPartsByDirection(n,e,r);return}case`CHANGE_SOUND_DECISION`:{this._checkArgsLength(1,t);let e=this.evalWwaNode(t.value[0]);this.generator.wwa.setDecisionSound(e);return}case`CHANGE_SOUND_ATTACK`:{this._checkArgsLength(1,t);let e=this.evalWwaNode(t.value[0]);this.generator.wwa.setAttackSound(e);return}case`SORT`:{if(this.for_id.sort_a||this.for_id.sort_b)throw Error(`SORT関数に与えた関数内でSORT関数を呼び出すことはできません。`);this._checkArgsLength(1,t);let e=this.evalWwaNode(t.value[0]),n=t.value[1]?this.evalWwaNode(t.value[1]):void 0;if(!Array.isArray(e))throw Error(`SORT関数の引数は配列である必要があります。`);if(n!==void 0&&typeof n!=`string`)throw Error(`SORT関数の比較関数名は文字列である必要があります。`);let r=this.generator.wwa.getUserScript(n);e.sort(n?(e,t)=>{this.for_id.sort_a={value:e},this.for_id.sort_b={value:t};try{this.evalWwaNode(r)}catch(e){if(e instanceof Ms)return this.for_id.sort_a=void 0,this.for_id.sort_b=void 0,e.value;throw e}}:void 0);return}default:throw Error(`未定義の関数が指定されました: `+t.functionName)}}static convertDirection(e){switch(e){case 2:case`down`:return E.DOWN;case 4:case`left`:return E.LEFT;case 5:case void 0:case null:return E.NO_DIRECTION;case 6:case`right`:return E.RIGHT;case 8:case`up`:return E.UP;default:console.warn(`JUMPGATEの方向指定 ${String(e)} が不正です`);return}}resolveSystemMessageKeyFromMacroArg(e){if(typeof e==`string`)return v(e)?e:void 0;if(typeof e==`number`)return y(e)}partsAssignment(e){let t=this.generator.wwa.getGameStatus(),n=this.evalWwaNode(e.destinationX),r=this.evalWwaNode(e.destinationY);if(typeof n!=`number`||typeof r!=`number`)throw Error(`座標は数値で指定してください (${n}, ${r})`);new C(this.generator.wwa,n,r);let i=e.partsKind===`map`?j.MAP:j.OBJECT,a=this.resolveParts(i,n,r),o=this.evalWwaNode(e.value);switch(e.operator){case`=`:case`+=`:case`-=`:case`*=`:case`/=`:{let s=ks[e.operator](a,o)|0;if(s<0)throw Error(`負値のパーツ番号 ${s} は代入できません`);this.generator.wwa.appearPartsEval(t.playerCoord,`${n}`,`${r}`,s,i);break}default:throw Error(`演算子 ${e.operator} は partsAssignment では使えません`)}}resolveParts(e,t,n){let r=this.generator.wwa.getGameStatus();switch(e){case j.MAP:return r.wwaData.map[n][t];case j.OBJECT:return r.wwaData.mapObject[n][t];default:throw Error(`存在しないPartsTypeです`,e)}}blockStatement(e){return this.evalWwaNodes(e.value)}ifStatement(e){if(this.evalWwaNode(e.test))return this.evalWwaNode(e.consequent);if(e.alternate)return this.evalWwaNode(e.alternate)}convertConditionalExpression(e){let t=this.evalWwaNode(e.test)?e.consequent:e.alternate;return this.evalWwaNode(t)}property(e){let t=this.evalWwaNode(e.key);if(!f(t))throw Error(`オブジェクトのキーはプリミティブ値でなければなりません。: ${t}`);return[String(this.evalWwaNode(e.key)),this.evalWwaNode(e.value)]}objectExpression(e){let t=e.properties.map(e=>this.evalWwaNode(e));return new Map(t)}arrayExpression(e){return e.elements.map(e=>this.evalWwaNode(e))}convertLoopPointerExpression(e){let t=this.evalWwaNode(e.value),n=this.evalWwaNode(e.index);switch(e.operator){case`+=`:this.for_id.LP[n]=t;break;case`-=`:this.for_id.LP[n]=t;break;case`/=`:this.for_id.LP[n]=t;break;case`*=`:this.for_id.LP[n]=t;break;default:this.for_id.LP[n]=t;break}return 0}itemAssignment(e){let t=this.evalWwaNode(e.itemBoxPosition1to12);if(typeof t!=`number`||t<0||t>12)throw Error(`ITEMの添字に想定外の値が入っています。0以上12以下の添字を指定してください。: `+t);let n=this.evalWwaNode(e.value);switch(e.operator){case`=`:this.generator.wwa.setPlayerGetItem(t,n|0);break;case`+=`:case`-=`:case`*=`:case`/=`:{if(t===0)throw Error(`複合代入では ITEM[0] への操作はできません`);let r=this.generator.wwa.getGameStatus().itemBox[t-1],i=ks[e.operator](r,n)|0;if(i<0)throw Error(`負値のパーツ番号 ${i} は代入できません`);this.generator.wwa.setPlayerGetItem(t,i);break}default:throw Error(`演算子 ${e.operator} は itemAssignment では使えません`)}}evalMessage(e){let t=this.evalWwaNode(e.value),n=this.generator.pickPageAdditionalQueue();this.generator.wwa.handleMsgFunction({message:String(t),additionalItems:n})}evalRandom(e){let t=this.evalWwaNode(e.value);return Math.floor(Math.random()*t)}evalSetSpecialParameter(e){let t=this.evalWwaNode(e.value);if(!this.generator.wwa||isNaN(t))return t;let n=this.evalSymbol({type:`Symbol`,name:e.kind});if(Array.isArray(n))throw Error(`配列Objectに対して直接代入は出来ません: ${n}`);let r=(()=>{switch(e.operator){case`+=`:return n+t;case`-=`:return typeof n!=`number`||typeof t!=`number`?(console.warn(`${e.kind} に数値以外の減算をすることはできません、`),NaN):n-t;case`*=`:return typeof n!=`number`||typeof t!=`number`?(console.warn(`${e.kind} に数値以外の乗算をすることはできません、`),NaN):n*t;case`/=`:return typeof n!=`number`||typeof t!=`number`?(console.warn(`${e.kind} に数値以外の除算をすることはできません、`),NaN):n/t;default:return t}})();switch(e.kind){case`PX`:return this.generator.wwa.jumpSpecifiedXPos(r),r;case`PY`:return this.generator.wwa.jumpSpecifiedYPos(r),r;case`AT`:return this.generator.wwa.setPlayerStatus(ue.STRENGTH,r,!0),r;case`DF`:return this.generator.wwa.setPlayerStatus(ue.DEFENCE,r,!0),r;case`GD`:return this.generator.wwa.setPlayerStatus(ue.GOLD,r,!0),r;case`HP`:{let{isGameOver:e}=this.generator.wwa.setPlayerStatus(ue.ENERGY,r,!0);if(e)throw new Ns(`GAME_OVER`);return r}case`HPMAX`:return this.generator.wwa.setPlayerEnergyMax(r),r;case`i`:return this.for_id.i=this.evalWwaNode(e.value),this.for_id.i;case`j`:return this.for_id.j=this.evalWwaNode(e.value),this.for_id.j;case`k`:return this.for_id.k=this.evalWwaNode(e.value),this.for_id.k;case`LOOPLIMIT`:{let t=this.evalWwaNode(e.value);return this.generator.updateLoopLimit(t),t}default:console.error(`未実装の要素です: `+e.kind);return}}evalSetUserVariable(e){if(e.index.length>1){let t=this.evalWwaNode(e.value),n=e.index.map(e=>this.evalWwaNode(e));this.generator.wwa.setUserVarIndecies(n,t,e.operator);return}else{let t=this.evalWwaNode(e.value);if(!this.generator.wwa)return t;let n=this.evalWwaNode(e.index[0]);return this.generator.wwa.setUserVar(n,t,e.operator),t}}evalUnaryOperation(e){switch(e.operator){case`+`:return this.evalWwaNode(e.argument);case`-`:return-this.evalWwaNode(e.argument);case`!`:return!this.evalWwaNode(e.argument);default:throw Error(`存在しない単項演算子です`)}}evalBinaryOperation(e){let t=this.evalWwaNode(e.left),n=this.evalWwaNode(e.right);switch(e.operator){case`+`:return t+n;case`-`:return t-n;case`*`:return t*n;case`/`:return n===0?0:Math.floor(t/n);case`%`:return n===0?0:t%n;case`>`:return t>n;case`>=`:return t>=n;case`<`:return t<n;case`<=`:return t<=n;case`==`:return t==n;case`!=`:return t!=n;default:throw Error(`存在しない単項演算子です`)}}evalSymbol(e){let t=this.generator.wwa.getGameStatus(),n=this.generator.wwa.getEnemyStatus();switch(e.name){case`X`:return this.generator.state.triggerParts?.position.x??t.playerCoord.x;case`Y`:return this.generator.state.triggerParts?.position.y??t.playerCoord.y;case`ID`:return this.generator.state.triggerParts?.id??-1;case`TYPE`:return this.generator.state.triggerParts?.type??-1;case`PX`:return t.playerCoord.x;case`PY`:return t.playerCoord.y;case`CX`:return t.cameraCoord.x;case`CY`:return t.cameraCoord.y;case`AT`:return t.bareStatus.strength;case`AT_TOTAL`:return this.generator.state.battleDamageCalculation?.estimatingParams?.playerStatus.strength??t.totalStatus.strength;case`DF`:return t.bareStatus.defence;case`DF_TOTAL`:return this.generator.state.battleDamageCalculation?.estimatingParams?.playerStatus.defence??t.totalStatus.defence;case`GD`:return this.generator.state.battleDamageCalculation?.estimatingParams?.playerStatus.gold??t.totalStatus.gold;case`HP`:return this.generator.state.battleDamageCalculation?.estimatingParams?.playerStatus.energy??t.totalStatus.energy;case`HPMAX`:return t.energyMax;case`STEP`:return t.moveCount;case`TIME`:return t.playTime;case`PDIR`:return t.playerDirection;case`i`:return this.for_id.i;case`j`:return this.for_id.j;case`k`:return this.for_id.k;case`LOOPLIMIT`:return this.generator.loop_limit;case`ITEM_ID`:return this.generator.state.earnedItem?.partsId??-1;case`ITEM_POS`:return this.generator.state.earnedItem?.itemPos1To12??-1;case`ENEMY_HP`:return this.generator.state.battleDamageCalculation?.estimatingParams?.enemyStatus.energy??(typeof n==`number`?-1:n.energy);case`ENEMY_AT`:return this.generator.state.battleDamageCalculation?.estimatingParams?.enemyStatus.strength??(typeof n==`number`?-1:n.strength);case`ENEMY_DF`:return this.generator.state.battleDamageCalculation?.estimatingParams?.enemyStatus.defence??(typeof n==`number`?-1:n.defence);case`ENEMY_GD`:return this.generator.state.battleDamageCalculation?.estimatingParams?.enemyStatus.gold??(typeof n==`number`?-1:n.gold);case`PICTURE`:throw Error(`この機能はまだ実装されていません!`);case`PLAYER_PX`:return Es(t.playerCoord.x,t.cameraCoord.x);case`PLAYER_PY`:return Ds(t.playerCoord.y,t.cameraCoord.y);case`MOVE_SPEED`:return de[t.gameSpeedIndex];case`MOVE_FRAME_TIME`:return R.CHIP_SIZE/de[t.gameSpeedIndex];case`LP`:return this.for_id.LP;case`undefined`:return;case`SORT_A`:if(!this.for_id.sort_a)throw Error(`SORT_AはSORT関数の比較関数内でのみ使用可能です。`);return this.for_id.sort_a?.value;case`SORT_B`:if(!this.for_id.sort_b)throw Error(`SORT_BはSORT関数の比較関数内でのみ使用可能です。`);return this.for_id.sort_b?.value;default:throw Error(`このシンボルは取得できません`)}}evalArrayOrObject1D(e){let t=this.evalWwaNode(e.indecies[0]);if(typeof t!=`number`)switch(e.name){case`v`:return this.generator.wwa.getUserNameVar(t);case`SORT_A`:if(!this.for_id.sort_a)throw Error(`SORT_AはSORT関数の比較関数内でのみ使用可能です。`);return Ke(this.for_id.sort_a.value,t);case`SORT_B`:if(!this.for_id.sort_b)throw Error(`SORT_BはSORT関数の比較関数内でのみ使用可能です。`);return Ke(this.for_id.sort_b.value,t);default:throw Error(`このシンボルは取得できません`)}let n=this.generator.wwa.getGameStatus();switch(e.name){case`v`:return this.generator.wwa.getUserVar(t);case`ITEM`:if(t<1||t>12)throw Error(`ITEMの添字に想定外の値が入っています。1以上12以下の添字を指定してください。: `+t);return n.itemBox[t-1];case`PICTURE`:throw Error(`この機能はまだ実装されていません!`);case`LP`:return this.for_id.LP[t];case`SORT_A`:if(!this.for_id.sort_a)throw Error(`SORT_AはSORT関数の比較関数内でのみ使用可能です。`);return this.for_id.sort_a.value[t];case`SORT_B`:if(!this.for_id.sort_b)throw Error(`SORT_BはSORT関数の比較関数内でのみ使用可能です。`);return this.for_id.sort_b.value[t];default:throw console.log(e.name,e.indecies[0],t),Error(`このシンボルは取得できません`)}}evalArrayOrObject2D(e){switch(e.name){case`m`:case`o`:let t=this.evalWwaNode(e.indecies[0]),n=this.evalWwaNode(e.indecies[1]);if(typeof t!=`number`||typeof n!=`number`)throw Error(`座標は数値で指定してください (${t}, ${n})`);new C(this.generator.wwa,t,n);let r=e.name===`o`?j.OBJECT:j.MAP;return this.generator.wwa.getPartsID(new S(t,n),r);case`v`:{let t=this.evalWwaNode(e.indecies[0]),n=this.generator.wwa.getUserNameVar(t);if(n===null||!Array.isArray(n)&&typeof n!=`object`&&typeof n!=`string`)throw Error(`指定したユーザー定義変数: v["${t}"] は配列・オブジェクト・文字列ではありません`);return Ke(n,this.evalWwaNode(e.indecies[1]))}case`SORT_A`:{let t=e.indecies.map(e=>this.evalWwaNode(e));if(!this.for_id.sort_a)throw Error(`SORT_AはSORT関数の比較関数内でのみ使用可能です。`);return t.reduce((e,t)=>Ke(e,t),this.for_id.sort_a.value)}case`SORT_B`:{let t=e.indecies.map(e=>this.evalWwaNode(e));if(!this.for_id.sort_b)throw Error(`SORT_BはSORT関数の比較関数内でのみ使用可能です。`);return t.reduce((e,t)=>Ke(e,t),this.for_id.sort_b.value)}}}evalArrayOrObject3DPlus(e){let t=e.indecies.map(e=>this.evalWwaNode(e));switch(e.name){case`v`:{let e=this.generator.wwa.getUserNameVar(t[0]);return t.slice(1).reduce((e,t)=>Ke(e,t),e)}case`SORT_A`:if(!this.for_id.sort_a)throw Error(`SORT_AはSORT関数の比較関数内でのみ使用可能です。`);return t.reduce((e,t)=>Ke(e,t),this.for_id.sort_a.value);case`SORT_B`:if(!this.for_id.sort_b)throw Error(`SORT_BはSORT関数の比較関数内でのみ使用可能です。`);return t.reduce((e,t)=>Ke(e,t),this.for_id.sort_b.value)}}evalLiteral(e){return e.value}},Ms=class{constructor(e){this.value=e}},Ns=class{constructor(e,t){this.reason=e,this.value=t}};function Ps(e){return qo(e,{ecmaVersion:2020})}var Fs=async e=>{try{let t=await fetch(e);return t.status===200||t.status===304?{kind:`data`,data:await new Response(t.body).text(),fileName:e}:{kind:`httpError`,errorMessage:`ファイル ${e} が読み込めませんでした。ステータスコード: ${t.status}`,fileName:e}}catch(t){return{kind:`otherError`,errorMessage:t.message,fileName:e}}},Is=`user-variable-label`;function Ls(){let e=document.createElement(`div`);return e.textContent=`-`,e.setAttribute(`aria-hidden`,`true`),e.classList.add(Is),e}function Rs(e,t){e.textContent!==t&&(e.textContent=t)}var zs=`-`,Bs=`user-variable-card`,Vs=`user-variable-card--is-trimmed`;function Hs({index:e,value:t}){let n=document.createElement(`div`);n.classList.add(Bs),qs(t)&&n.classList.add(Vs),n.dataset.varIndex=String(e);let{cardIndexElement:r,cardIndexLabelElement:i}=Us(e),a=Ws(t);return n.appendChild(r),n.appendChild(a),{cardElement:n,cardIndexElement:r,cardIndexLabelElement:i,cardValueElement:a}}function Us(e){let t=document.createElement(`div`);t.classList.add(`index`),t.textContent=String(e),typeof e==`string`&&t.setAttribute(`title`,e);let n=Ls();return t.appendChild(n),{cardIndexElement:t,cardIndexLabelElement:n}}function Ws(e){let t=document.createElement(`div`);return t.classList.add(`value`),typeof e==`string`&&t.setAttribute(`title`,Ge(e)),Ks(t,e),t}function Gs(e,t){e.dataset.labelledVarIndex=`true`,e.addEventListener(`mouseover`,()=>t.removeAttribute(`aria-hidden`)),e.addEventListener(`mouseleave`,()=>t.setAttribute(`aria-hidden`,`true`))}function Ks(e,t){let n=Ge(t);e.textContent!==n&&(e.textContent=t===void 0?zs:Ge(t))}function qs(e){return typeof e!=`object`}var Js=`user-variable-list`;function Ys({kind:e,elementStore:t}){let n=document.createElement(`ul`);return n.classList.add(Js),e===`numbered`&&Array.from({length:R.USER_VAR_NUM}).map((e,n)=>Xs({elementStore:t,index:n})).forEach(e=>n.appendChild(e)),n}function Xs({elementStore:e,index:t,value:n}){let r=document.createElement(`li`),i=Hs({index:t,value:n});return e.updateUserVarElementInfo(t,i),r.appendChild(i.cardElement),r}function Zs(e,t,{index:n,value:r}){t.appendChild(Xs({elementStore:e,index:n,value:r}))}var Qs=`information`;function $s(){let e=document.createElement(`p`);return e.classList.add(Qs),ec(e,`強調されている番号にカーソルを乗せると説明が表示されます。`),e}function ec(e,t,n=!1){e.textContent=`${n?`【エラー】`:``}${t}`}function tc({elementStore:e,heading:t,contentVisibilityToggleButton:n,information:r}){let i=document.createElement(`header`);if(i.appendChild(rc({heading:t,contentVisibilityToggleButton:n})),r){let t=$s();i.appendChild(t),e.updateNamedUserVarInformationElement(t)}return i}function nc(e,t){e.textContent=t?`▲隠す`:`▼表示`}function rc({heading:e,contentVisibilityToggleButton:t}){let n=document.createElement(`div`);n.classList.add(`heading-area`);let r=document.createElement(`h2`);r.textContent=e.text,n.appendChild(r);let i=document.createElement(`button`);return i.classList.add(`content-visibility-toggle-button`),nc(i,!0),t.onClick&&i.addEventListener(`click`,t.onClick.bind(i)),n.appendChild(i),n}var ic=`user-variable-list-section`;function ac({kind:e,elementStore:t}){let n=document.createElement(`section`);n.classList.add(ic),n.dataset.kind=e;let r=Ys({kind:e,elementStore:t});t.updateUserVarListElement(e,r);let i=tc({elementStore:t,heading:{text:e===`named`?`名前つき変数一覧`:`変数一覧`},information:(e===`numbered`||void 0)&&{},contentVisibilityToggleButton:{onClick:e=>{let n=t.getNamedUserVarInformationElement();n&&(r.getAttribute(`aria-hidden`)===`true`?oc(r,n,e.target):sc(r,n,e.target))}}});return n.appendChild(i),n.appendChild(r),t.updateUserVarListElement(e,r),n}function oc(e,t,n){e.removeAttribute(`aria-hidden`),t instanceof HTMLElement&&t.removeAttribute(`aria-hidden`),n instanceof HTMLElement&&nc(n,!0)}function sc(e,t,n){e.setAttribute(`aria-hidden`,`true`),t instanceof HTMLElement&&t.setAttribute(`aria-hidden`,`true`),n instanceof HTMLElement&&nc(n,!1)}function cc(){let e=new Map,t=new Map,n=new Map,r=null;return{getAllNamedUserVarIndeciesSet:()=>new Set(t.keys()),updateUserVarElementInfo:(n,r)=>{if(typeof n==`number`)e.set(n,r);else if(typeof n==`string`)t.set(n,r);else throw TypeError(`Invalid index: ${n}`)},getUserVarElementInfo:n=>{if(typeof n==`number`)return e.get(n);if(typeof n==`string`)return t.get(n);throw TypeError(`Invalid index: ${n}`)},deleteUserVarElementInfo:n=>{if(typeof n==`number`)e.delete(n);else if(typeof n==`string`)t.delete(n);else throw TypeError(`Invalid index: ${n}`)},getUserVarListElement:e=>n.get(e),updateUserVarListElement:(e,t)=>{n.set(e,t)},deleteUserVarListElement:e=>{n.delete(e)},getNamedUserVarInformationElement:()=>r,updateNamedUserVarInformationElement:e=>{r=e},deleteNamedUserVarInformationElement:()=>{r=null},dispose:()=>{e.clear(),t.clear(),n.clear(),r=null}}}function lc(e,t){let n=e.getAllNamedUserVarIndeciesSet(),r=e.getUserVarListElement(`named`);for(let[i,a]of t){let t=e.getUserVarElementInfo(i)?.cardValueElement;n.delete(i),t?Ks(t,a):Zs(e,r,{index:i,value:a})}for(let t of n){let n=e.getUserVarElementInfo(t)?.cardElement.parentElement;n instanceof HTMLLIElement&&(e.getUserVarListElement(`named`)?.removeChild(n),e.deleteUserVarElementInfo(t))}}function uc(e,t){Array.from({length:R.USER_VAR_NUM}).map((n,r)=>{let i=e.getUserVarElementInfo(r)?.cardValueElement;i&&Ks(i,t[r])})}function dc(e,t){Array.from({length:R.USER_VAR_NUM}).map((n,r)=>{let i=t[r];if(!i)return;let a=e.getUserVarElementInfo(r);if(!a)return;let o=a.cardIndexElement,s=a.cardIndexLabelElement;Rs(s,i),Gs(o,s)})}function fc(e,t,n=!1){ec(e.getNamedUserVarInformationElement(),t,n)}var pc=`wwa-vardump-wrapper`;function mc(e){let t=Le(e),n=cc();return t instanceof HTMLElement?(t.classList.add(pc),t.appendChild(ac({kind:`named`,elementStore:n})),t.appendChild(ac({kind:`numbered`,elementStore:n})),{updateAllVariables:({namedUserVar:e,userVar:t})=>{e&&lc(n,e),t&&uc(n,t)},numberedUserVariable:{updateValues:e=>uc(n,e),updateLabels:e=>dc(n,e),updateInformation:(e,t=!1)=>fc(n,e,t)},namedUserVariable:{updateValues:e=>lc(n,e)}}):null}function hc(){return{mapdata:``,urlGateEnable:!1,titleImg:void 0,audioDir:`./audio/`,classicModeEnable:!1,itemEffectEnable:!0,useGoToWwa:!1,lookingAround:!1,autoSave:!0,disallowLoadOldSave:!1,resumeSaveData:void 0,varDump:null,userVarNamesFile:void 0,displayUserVars:!1,virtualPadEnable:!1,virtualPadViewportFitEnable:!1,virtualPadControllerElm:void 0,userDefinedScriptsFile:`./script/script_file_list.json`,frameRateDisplayingPattern:`default-off`}}var gc;function _c(e,t,n){var r=new ge;return r.current=e,r.total=t,r.stage=n,r}var vc=class{constructor(e=hc()){this._useSuspend=!1,this._useLookingAround=!0,this._isDisallowLoadOldSave=!1,this._playerAndObjectsStopWaitingGameSpeedChangeRequest=void 0,this._windowCloseWaitingMessageDisplayRequests=[],this._playerAndObjectsStopWaitingMessageDisplayRequests=[],this._windowCloseWaitingJumpGateRequest=void 0,this._debugConsoleElement=void 0,this._frameRateDisplayingPattern=`default-off`,this.audioExtension=``,this.soundLoadedCheckTimer=void 0,this._playTimeCalculator=void 0,this._varDump=null,this.userDefinedFunctions={},this.convertWwaNodes=e=>Yo(Ps(e)),this._prevTimeStamp=-1,this._accumlatedTimeMs=0,this._samplingTimeMs=0,this._frameCountForMeasureFps=0,this.mainCaller=e=>{if(this._prevTimeStamp<0){this._prevTimeStamp=e,requestAnimationFrame(this.mainCaller.bind(this));return}let t=e-this._prevTimeStamp;this._prevTimeStamp=e,this._accumlatedTimeMs+=t,this._accumlatedTimeMs>=R.INTERVAL_MS&&(this._accumlatedTimeMs-=R.INTERVAL_MS,this._accumlatedTimeMs>R.INTERVAL_MS*2&&(this._accumlatedTimeMs=0),this._main(),this._frameCountForMeasureFps++),this._samplingTimeMs+=t,this._samplingTimeMs>=1e3&&(this._gameFrameRateWindow?.updateCurrentFps(this._frameCountForMeasureFps/(this._samplingTimeMs/1e3)),this._frameCountForMeasureFps=0,this._samplingTimeMs=0),requestAnimationFrame(this.mainCaller.bind(this))},this.soundCheckCaller=()=>this.checkAllSoundLoaded(),this._checkTurnKeyPressed=()=>this._keyStore.checkHitKey(V.KEY_ESC)||this._keyStore.checkHitKey(V.KEY_SHIFT)||this._keyStore.checkHitKey(V.KEY_N),this._saveDataList=[],this.wwaCustomEventEmitter=new $i(U(`wwa-wrapper`));let t;window.addEventListener(`click`,e=>{this._isActive=!1}),U(`wwa-wrapper`).addEventListener(`click`,e=>{e.stopPropagation(),this._isActive=!0}),this._isActive=!0,e.titleImg===void 0?(this._hasTitleImg=!1,this._cvsCover=U(`progress-panel`),t=this._cvsCover.getContext(`2d`),t.fillStyle=`rgb(0, 0, 0)`):this._hasTitleImg=!0;try{this._hasTitleImg?(U(`unstable-version-warning`).textContent=`この WWA Wing は [不安定版] です。`,U(`version`).textContent=`WWA Wing Ver.4.0.17`):this._setLoadingMessage(t,0)}catch{}this._varDump=e.varDump;let n=window.AudioContext||window.webkitAudioContext;n&&(this.audioContext=new n,this.audioGain=this.audioContext.createGain(),this.audioGain.gain.setValueAtTime(1,this.audioContext.currentTime));let r=new Audio;if(r.canPlayType(`audio/mpeg`)!==`no`&&r.canPlayType(`audio/mpeg`)!==``?this.audioExtension=`mp3`:this.audioExtension=`m4a`,this._isURLGateEnable=e.urlGateEnable,this._isClassicModeEnable=e.classicModeEnable,this._mainCallCounter=0,this._animationCounter=0,this._statusPressCounter=new x(0,0,0,0),e.audioDir?e.audioDir[e.audioDir.length-1]!==`/`&&(e.audioDir+=`/`):e.audioDir=`./audio/`,this._audioDirectory=e.audioDir,this._bottomButtonType=e.useGoToWwa?T.GOTO_WWA:T.BATTLE_REPORT,this._userVarNameList=[],this.evalCalcWwaNodeGenerator=new As(this),this.userDevice=new M,location.href.match(/^file/))switch(this.userDevice.device){case re.GAME:switch(this.userDevice.os){case ne.NINTENDO:R.BATTLE_INTERVAL_FRAME_NUM=5;break}this._bottomButtonType=T.GAME_END;break;default:alert(`【警告】直接HTMLファイルを開いているようです。
|
|
93
|
+
`;case 114:return`\r`;case 120:return String.fromCharCode(this.readHexChar(2));case 117:return Go(this.readCodePoint());case 116:return` `;case 98:return`\b`;case 118:return`\v`;case 102:return`\f`;case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),``;case 56:case 57:if(e){var n=this.pos-1;return this.invalidStringToken(n,`Invalid escape sequence in template string`),null}default:if(t>=48&&t<=55){var r=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],i=parseInt(r,8);return i>255&&(r=r.slice(0,-1),i=parseInt(r,8)),this.pos+=r.length-1,t=this.input.charCodeAt(this.pos),(r!==`0`||t===56||t===57)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-r.length,e?`Octal literal in template string`:`Octal literal in strict mode`),String.fromCharCode(i)}return ya(t)?``:String.fromCharCode(t)}},Q.readHexChar=function(e){var t=this.pos,n=this.readInt(16,e);return n===null&&this.invalidStringToken(t,`Bad character escape sequence`),n},Q.readWord1=function(){this.containsEsc=!1;for(var e=``,t=!0,n=this.pos,r=this.options.ecmaVersion>=6;this.pos<this.input.length;){var i=this.fullCharCodeAtPos();if(fa(i,r))this.pos+=i<=65535?1:2;else if(i===92){this.containsEsc=!0,e+=this.input.slice(n,this.pos);var a=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,`Expecting Unicode escape sequence \\uXXXX`),++this.pos;var o=this.readCodePoint();(t?da:fa)(o,r)||this.invalidStringToken(a,`Invalid Unicode escape`),e+=Go(o),n=this.pos}else break;t=!1}return e+this.input.slice(n,this.pos)},Q.readWord=function(){var e=this.readWord1(),t=J.name;return this.keywords.test(e)&&(t=ga[e]),this.finishToken(t,e)},Xa.acorn={Parser:Xa,version:`7.4.1`,defaultOptions:ja,Position:Oa,SourceLocation:ka,getLineInfo:Aa,Node:po,TokenType:K,tokTypes:J,keywordTypes:ga,TokContext:go,tokContexts:_o,isIdentifierChar:fa,isIdentifierStart:da,Token:Ho,isNewLine:ya,lineBreak:_a,lineBreakG:va,nonASCIIwhitespace:ba};function qo(e,t){return Xa.parse(e,t)}function Jo(e){return[`ArrayOrObject1D`,`ArrayOrObject2D`,`ArrayOrObject3DPlus`,`Literal`,`Symbol`,`UnaryOperation`,`BinaryOperation`,`Random`,`UserDefinedFunctionCall`,`SystemDefinedFunctionCall`,`ConditionalExpression`,`ArrayExpression`,`ObjectExpression`].includes(e.type)}function Yo(e){return e.type===`Program`?e.body.map(e=>$(e)):[$(e)]}function $(e){switch(e.type){case`Program`:return ds(e);case`ExpressionStatement`:return fs(e);case`AssignmentExpression`:return ps(e);case`MemberExpression`:return gs(e);case`UnaryExpression`:return ms(e);case`BinaryExpression`:return hs(e);case`Identifier`:return _s(e);case`Literal`:return vs(e);case`CallExpression`:return ss(e);case`IfStatement`:return os(e);case`BlockStatement`:return as(e);case`FunctionDeclaration`:return Xo(e);case`ForStatement`:return is(e);case`BreakStatement`:return ns(e);case`ReturnStatement`:return rs(e);case`ContinueStatement`:return ts(e);case`UpdateExpression`:return Zo(e);case`LogicalExpression`:return Qo(e);case`TemplateLiteral`:return $o(e);case`TemplateElement`:return es(e);case`ConditionalExpression`:return ys(e);case`Property`:return bs(e);case`ObjectExpression`:return xs(e);case`ArrayExpression`:return Ss(e);default:throw console.log(e),Error(`未定義の AST ノードです :`+e.type)}}function Xo(e){return{type:`UserDefinedFunction`,functionName:e.id.name,body:$(e.body)}}function Zo(e){return{type:`UpdateExpression`,operator:e.operator,argument:$(e.argument)}}function Qo(e){return{type:`LogicalExpression`,operator:e.operator,left:$(e.left),right:$(e.right)}}function $o(e){return{type:`TemplateLiteral`,expressions:e.expressions.map(e=>$(e)),quasis:e.quasis.map(e=>$(e))}}function es(e){return{type:`TemplateElement`,value:e.value}}function ts(e){return{type:`Continue`,label:e.label}}function ns(e){return{type:`Break`,label:e.label}}function rs(e){return{type:`Return`,argument:$(e.argument)}}function is(e){return{type:`ForStatement`,body:e.body.body.map(e=>$(e)),init:$(e.init),test:$(e.test),update:$(e.update)}}function as(e){return{type:`BlockStatement`,value:e.body.map(e=>$(e))}}function os(e){return{type:`IfStatement`,consequent:$(e.consequent),test:$(e.test),alternate:e.alternate?$(e.alternate):void 0}}function ss(e){if(e.callee.type!==`Identifier`)throw Error(`WWAでは存在しない構文です`);let t=e.callee.name;switch(t){case`RAND`:return us(e.arguments);case`MSG`:case`MESSAGE`:return ls(e.arguments);case`JUMPGATE`:case`MUSIC`:case`SOUND`:case`BGM_STOP`:case`STOP_BGM`:case`SOUND_STOP`:case`STOP_SOUND`:case`ALL_SOUND_STOP`:case`STOP_ALL_SOUND`:case`SAVE`:case`LOG`:case`ABLE_CHANGE_SPEED`:case`SET_SPEED`:case`CHANGE_GAMEOVER_POS`:case`DEL_PLAYER`:case`RESTART_GAME`:case`URL_JUMPGATE`:case`HIDE_STATUS`:case`PARTS`:case`FACE`:case`EFFECT`:case`CHANGE_PLAYER_IMAGE`:case`CHANGE_PLAYER_IMG`:case`HAS_ITEM`:case`REMOVE_ITEM`:case`MOVE`:case`PARTS_MOVE`:case`IS_PLAYER_WAITING_MESSAGE`:case`IS_MANUAL_PAUSE`:case`IS_PLAYER_WAITING_ENTER`:case`GET_UNIXTIME`:case`GET_DATE_YEAR`:case`GET_DATE_MONTH`:case`GET_DATE_DAY`:case`GET_DATE_HOUR`:case`GET_DATE_MINUTES`:case`GET_DATE_SECONDS`:case`GET_DATE_MILLISECONDS`:case`GET_DATE_WEEKDAY`:case`CHANGE_SYSMSG`:case`PICTURE`:case`PICTURE_FROM_PARTS`:case`CLEAR_ALL_PICTURES`:case`HAS_PICTURE`:case`SHOW_USER_DEF_VAR`:case`DIV`:case`FLOOR`:case`CEIL`:case`ROUND`:case`ABS`:case`POW`:case`SQRT`:case`SIN`:case`COS`:case`TAN`:case`GET_GAMEOVER_POS_X`:case`GET_GAMEOVER_POS_Y`:case`ABORT_BATTLE`:case`EXIT`:case`GET_IMG_POS_X`:case`GET_IMG_POS_Y`:case`LENGTH`:case`IS_NUMBER`:case`IS_NAN`:case`CLONE`:case`MANUAL_PAUSE`:case`WAIT_ENTER`:case`CANCEL_MANUAL_PAUSE`:case`CANCEL_WAIT_ENTER`:case`COLOR`:case`EFFITEM`:case`CHANGE_BOM_IMG`:case`CHANGE_BOM_IMAGE`:case`CHANGE_CLICK_IMAGE`:case`CHANGE_CLICK_IMG`:case`CHANGE_FRAME_IMAGE`:case`CHANGE_FRAME_IMG`:case`CHANGE_YESNO_IMAGE`:case`CHANGE_YESNO_IMG`:case`NO_GAMEOVER`:case`DEFAULT`:case`DIR_MAP`:case`CHANGE_SOUND_ATTACK`:case`CHANGE_SOUND_DECISION`:case`SORT`:case`DISABLE_BATTLE_REPORT`:return cs(e.arguments,t);default:return{type:`UserDefinedFunctionCall`,functionName:t}}}function cs(e,t){return{type:`SystemDefinedFunctionCall`,functionName:t,value:e.map(e=>$(e))}}function ls(e){return{type:`Msg`,value:$(e[0])}}function us(e){if(e.length<1)throw Error(`RAND関数には引数が必要です。`);return{type:`Random`,value:$(e[0])}}function ds(e){if(e.body.length!==1)throw Error(`bodyが1以外の場合評価できません。`);return $(e.body[0])}function fs(e){return $(e.expression)}function ps(e){let t=$(e.left),n=$(e.right);if(!Jo(n))throw Error(`値以外を代入式の右辺に設定できません`);switch(e.operator){case`=`:case`+=`:case`-=`:case`*=`:case`/=`:if(t.type===`ArrayOrObject2D`){if(t.name===`m`||t.name===`o`)return{type:`PartsAssignment`,partsKind:t.name===`m`?`map`:`object`,destinationX:t.indecies[0],destinationY:t.indecies[1],value:n,operator:e.operator};if(t.name===`v`)return{type:`UserVariableAssignment`,index:[t.indecies[0],t.indecies[1]],value:n,operator:e.operator};throw Error(`想定していない記号が2次元配列ででてきました`)}else if(t.type===`ArrayOrObject1D`){if(t.name===`ITEM`)return{type:`ItemAssignment`,itemBoxPosition1to12:t.indecies[0],value:n,operator:e.operator};if(t.name===`v`)return{type:`UserVariableAssignment`,index:[t.indecies[0]],value:n,operator:e.operator};if(t.name===`LP`)return{type:`LoopPointerAssignment`,index:t.indecies[0],value:n,operator:e.operator};throw Error(`1次元配列にて想定していないシンボルが指定されました ${t.name}`)}else if(t.type===`Symbol`){if(t.name===`m`||t.name===`o`||t.name===`v`||t.name===`ITEM`||t.name===`X`||t.name===`Y`||t.name===`ID`||t.name===`TYPE`||t.name===`CX`||t.name===`CY`||t.name===`PICTURE`||t.name===`PLAYER_PX`||t.name===`PLAYER_PY`||t.name===`MOVE_SPEED`||t.name===`MOVE_FRAME_TIME`||t.name===`LP`||t.name===`SORT_A`||t.name===`SORT_B`||t.name===`undefined`)throw Error(`このシンボルには代入できません`);if(t.name===`AT_TOTAL`)throw Error(`"装備品込みの攻撃力(AT_TOTAL)への代入はできません。"`);if(t.name===`DF_TOTAL`)throw Error(`"装備品込みの防御力(DF_TOTAL)への代入はできません。"`);if(t.name===`ENEMY_HP`||t.name===`ENEMY_AT`||t.name===`ENEMY_DF`||t.name===`ENEMY_GD`)throw Error(`敵ステータス (ENEMY_HP, ENEMY_AT, ENEMY_DF, ENEMY_GD) への代入はできません。`);return{type:`SpecialParameterAssignment`,kind:t.name,value:n,operator:e.operator}}else if(t.type===`Literal`)throw Error(`数値には代入できません`);else if(t.type===`ArrayOrObject3DPlus`&&t.name===`v`)return{type:`UserVariableAssignment`,index:t.indecies,value:n,operator:e.operator};else throw Error(`代入できません`);default:throw Error(`想定していないオペレーターです`)}}function ms(e){let t=$(e.argument);if(![`+`,`-`,`!`].includes(e.operator))throw Error(`未定義の演算子です :`+e.operator);if(!Jo(t))throw Error(`単項演算子が適用できません`);return{type:`UnaryOperation`,operator:e.operator,argument:t}}function hs(e){let t=$(e.left),n=$(e.right);if(!Jo(t)||!Jo(n))throw Error(`左辺または右辺が評価不能です`);switch(e.operator){case`+`:case`-`:case`*`:case`/`:case`%`:case`>`:case`<`:case`>=`:case`<=`:case`==`:case`!=`:return{type:`BinaryOperation`,operator:e.operator,left:t,right:n};default:throw Error(`未定義の演算子です :`+e.operator)}}function gs(e){let t=$(e.object),n=$(e.property);if(t.type===`Symbol`){if(![`v`,`m`,`o`,`ITEM`,`LP`,`PICTURE`,`SORT_A`,`SORT_B`].includes(t.name))throw Error(`このシンボルは配列にできません`);if(Jo(n))return{type:`ArrayOrObject1D`,name:t.name,indecies:[n]};throw Error(`WWAでは存在しない構文です`)}else if(t.type===`ArrayOrObject1D`){if(t.name===`ITEM`||t.name===`PICTURE`)throw Error(`この配列は2次元以上にはできません。`);if(Jo(n))return{type:`ArrayOrObject2D`,name:t.name,indecies:[...t.indecies,n]};throw Error(`WWAでは存在しない構文です`)}else if(t.type===`ArrayOrObject2D`||t.type===`ArrayOrObject3DPlus`){if(t.name===`m`||t.name===`o`)throw Error(`この配列は3次元以上にはできません。`);if((t.name===`v`||t.name===`SORT_A`||t.name===`SORT_B`)&&Jo(n))return{type:`ArrayOrObject3DPlus`,name:t.name,indecies:[...t.indecies,n]}}else if(t.type===`SystemDefinedFunctionCall`){if(Jo(n))return{type:`SystemDefinedFunctionCall`,functionName:t.functionName,value:t.value,indecies:[...t.indecies??[],n]};throw Error(`WWAでは存在しない構文です`)}else if(t.type===`UserDefinedFunctionCall`){if(Jo(n))return{type:`UserDefinedFunctionCall`,functionName:t.functionName,indecies:[...t.indecies??[],n]};throw Error(`WWAでは存在しない構文です`)}}function _s(e){switch(e.name){case`m`:case`o`:case`ITEM`:case`X`:case`Y`:case`ID`:case`TYPE`:case`PX`:case`PY`:case`CX`:case`CY`:case`v`:case`HP`:case`HPMAX`:case`AT`:case`AT_TOTAL`:case`DF`:case`DF_TOTAL`:case`GD`:case`STEP`:case`TIME`:case`PDIR`:case`i`:case`j`:case`k`:case`LOOPLIMIT`:case`ITEM_ID`:case`ITEM_POS`:case`ENEMY_HP`:case`ENEMY_AT`:case`ENEMY_DF`:case`PICTURE`:case`PLAYER_PX`:case`PLAYER_PY`:case`MOVE_SPEED`:case`MOVE_FRAME_TIME`:case`LP`:case`SORT_A`:case`SORT_B`:case`undefined`:return{type:`Symbol`,name:e.name};default:return{type:`Literal`,value:e.name}}}function vs(e){if(!f(e.value))throw TypeError(`Literal の値が不正です`);return{type:`Literal`,value:e.value}}function ys(e){let t=$(e.consequent),n=$(e.alternate);return{type:`ConditionalExpression`,consequent:t,test:$(e.test),alternate:n}}function bs(e){let t=$(e.key);if(t.type===`Symbol`)throw Error(`Object のキー ${t.name} は予約されているため、使用できません。`);if(t.type!==`Literal`)throw Error(`Object のキーが不正です。 Literal を期待していましたが、実際は ${t.type} でした。`);return{type:`Property`,key:t,value:$(e.value)}}function xs(e){return{type:`ObjectExpression`,properties:e.properties.map(bs)}}function Ss(e){return{type:`ArrayExpression`,elements:e.elements.map($)}}var Cs=[j.OBJECT,j.MAP],ws=e=>Math.abs(e)<2**-52;function Ts(e){switch(typeof e){case`object`:if(e===null)break;return Array.isArray(e)?e.length:Object.keys(e).length;case`string`:return e.length}throw Error(`LENGTH: 対応できない値が指定されています。`)}var Es=(e,t)=>(e-t)*R.CHIP_SIZE,Ds=(e,t)=>(e-t)*R.CHIP_SIZE,Os=class{constructor(e){this.value=e}},ks=Object.freeze({"=":(e,t)=>t,"+=":(e,t)=>e+t,"-=":(e,t)=>e-t,"*=":(e,t)=>e*t,"/=":(e,t)=>e/t}),As=class{constructor(e){this.wwa=e,this.loop_limit=1e5,this.state={messagePageAdditionalQueue:[]}}setTriggerParts(e,t,n){this.state={...this.state,triggerParts:{id:e,type:t,position:n}}}clearTemporaryState(){this.state={...this.state,triggerParts:void 0,messagePageAdditionalQueue:[]}}setEarnedItem(e,t){this.state={...this.state,earnedItem:{partsId:e,itemPos1To12:t}}}clearEarnedItem(){this.state={...this.state,earnedItem:void 0}}setBattleDamageCalculationMode(e){this.state={...this.state,battleDamageCalculation:{estimatingParams:e}}}clearBattleDamageCalculationMode(){this.state={...this.state,battleDamageCalculation:void 0}}evalWwaNodes(e){try{return this.evalWwaNodeInternal({type:`BlockStatement`,value:e})}catch(e){if(e instanceof Os)return{isGameOver:!0,value:e.value};throw e}}evalWwaNode(e){try{return{isGameOver:!1,value:this.evalWwaNodeInternal(e)}}catch(e){if(e instanceof Os)return{isGameOver:!0,value:e.value};throw e}}evalWwaNodeInternal(e){if(!(e.type===`BlockStatement`&&Array.isArray(e.value)&&e.value.length===0))try{return new js(this).evalWwaNode(e)}catch(e){if(e instanceof Ms)return e.value;if(e instanceof Ns)switch(e.reason){case`ABORT_BATTLE`:case`EXIT`:return e.value;case`GAME_OVER`:throw new Os(e.value);default:throw TypeError(`ExitInformationのreasonが不正です: `+e.reason)}else throw e}}addPageAdditionalItem(e){this.state.messagePageAdditionalQueue.push(e)}pickPageAdditionalQueue(){let e=[...this.state.messagePageAdditionalQueue];return this.state.messagePageAdditionalQueue=[],e}updateLoopLimit(e){this.loop_limit=e}},js=class e{constructor(e){this.generator=e,this.for_id={i:null,j:null,k:null,LP:[],loopCount:0,break_flag:!1,continue_flag:!1,sort_a:null,sort_b:null}}evalWwaNodes(e){let t;return e.forEach(e=>{t=this.evalWwaNode(e)}),t}evalWwaNode(e){if(!(this.for_id.break_flag||this.for_id.continue_flag))switch(e.type){case`UnaryOperation`:return this.evalUnaryOperation(e);case`BinaryOperation`:return this.evalBinaryOperation(e);case`Symbol`:return this.evalSymbol(e);case`ArrayOrObject1D`:return this.evalArrayOrObject1D(e);case`ArrayOrObject2D`:return this.evalArrayOrObject2D(e);case`ArrayOrObject3DPlus`:return this.evalArrayOrObject3DPlus(e);case`Literal`:return this.evalLiteral(e);case`UserVariableAssignment`:return this.evalSetUserVariable(e);case`SpecialParameterAssignment`:return this.evalSetSpecialParameter(e);case`Random`:return this.evalRandom(e);case`Msg`:return this.evalMessage(e);case`ItemAssignment`:return this.itemAssignment(e);case`IfStatement`:return this.ifStatement(e);case`BlockStatement`:return this.blockStatement(e);case`PartsAssignment`:return this.partsAssignment(e);case`ForStatement`:return this.forStateMent(e);case`SystemDefinedFunctionCall`:return this.evalSystemDefinedFunctionCall(e);case`UserDefinedFunctionCall`:return this.evalUserDefinedFunctionCall(e);case`UserDefinedFunction`:return;case`Break`:return this.breakStatement(e);case`Return`:throw new Ms(this.returnStatement(e));case`Continue`:return this.contunueStatment(e);case`UpdateExpression`:return this.updateExpression(e);case`LogicalExpression`:return this.logicalExpression(e);case`TemplateLiteral`:return this.convertTemplateLiteral(e);case`ConditionalExpression`:return this.convertConditionalExpression(e);case`Property`:return this.property(e);case`ObjectExpression`:return this.objectExpression(e);case`ArrayExpression`:return this.arrayExpression(e);case`LoopPointerAssignment`:return this.convertLoopPointerExpression(e);default:throw console.log(e),Error(`未定義または未実装のノードです`)}}wrapCallFunction(e,t){try{return t(e)}catch(e){if(e instanceof Ms)return e.value;throw e}}evalUserDefinedFunctionCall(e){let t=this.generator.wwa.getUserScript(e.functionName);if(t===null)throw Error(`未定義の関数が呼び出されました: ${e.functionName}`);let n=this.wrapCallFunction(t,e=>this.evalWwaNode(e));return(e.indecies?.map(e=>this.evalWwaNode(e))??[]).reduce((e,t)=>Ke(e,t),n)}updateExpression(e){if(e.argument.type!==`ArrayOrObject1D`&&e.argument.type!==`ArrayOrObject2D`&&e.argument.type!==`Symbol`)throw Error(`node.argument.typeが インクリメント/デクリメントできる対象ではありません。: ${e.argument.type}`);let t=t=>{switch(e.operator){case`++`:return t+1;case`--`:return t-1;default:throw Error(`想定外のOperatorが渡されました :`+e.operator)}},n=this.evalWwaNode(e.argument),r={type:`Literal`,value:t(n)};switch(e.argument.type){case`ArrayOrObject1D`:if(e.argument.name===`v`)this.evalSetUserVariable({type:`UserVariableAssignment`,index:[e.argument.indecies[0]],value:r});else if(e.argument.name===`ITEM`)this.itemAssignment({type:`ItemAssignment`,itemBoxPosition1to12:e.argument.indecies[0],value:r});else if(e.argument.name===`LP`)this.convertLoopPointerExpression({type:`LoopPointerAssignment`,index:e.argument.indecies[0],value:r,operator:`=`});else throw Error(`このリテラルはインクリメント/デクリメントできません: ${e.argument.type}`);break;case`ArrayOrObject2D`:{let t={type:`PartsAssignment`,destinationX:e.argument.indecies[0],destinationY:e.argument.indecies[1],value:r,operator:`=`};if(e.argument.name===`m`)this.partsAssignment({...t,partsKind:`map`});else if(e.argument.name===`o`)this.partsAssignment({...t,partsKind:`object`});else throw Error(`このリテラルはインクリメント/デクリメントできません: ${e.argument.type}`);break}case`Symbol`:{let t={type:`SpecialParameterAssignment`,kind:e.argument.name,value:r};this.evalSetSpecialParameter(t);break}}return n}logicalExpression(e){let t=this.evalWwaNode(e.left),n=this.evalWwaNode(e.right);switch(e.operator){case`||`:return t||n;case`&&`:return t&&n;default:throw Error(`存在しない論理式です!: `+e.operator)}}convertTemplateLiteral(e){let t=e.expressions.map(e=>this.evalWwaNode(e)),n=e.quasis.map(e=>e.value.cooked),r=``;return n.forEach((e,n)=>{r+=e,t[n]!==void 0&&(r+=t[n])}),r}contunueStatment(e){this.for_id.continue_flag=!0}breakStatement(e){this.for_id.break_flag=!0}returnStatement(e){return this.evalWwaNode(e.argument)}forStateMent(e){let t=e.init;for((()=>{if(`kind`in t)switch(t.kind){case`i`:if(this.for_id.i!==null)throw Error(`iの値が既に外側のforループで使われています。`);break;case`j`:if(this.for_id.j!==null)throw Error(`jの値が既に外側のforループで使われています。`);break;case`k`:if(this.for_id.k!==null)throw Error(`kの値が既に外側のforループで使われています。`);break;default:throw console.log(e),Error(`予想外の変数がfor文内で使用されました :`+t.kind)}else switch(t.type){case`LoopPointerAssignment`:let n=Number(this.evalWwaNode(t.index));if(Number.isNaN(n))throw Error(`LPのIndex値はNumberでないといけません。: ${n}`);if(this.for_id.LP[n]!==null&&this.for_id.LP[n]!==void 0)throw Error(`LP[${n}]の値が既に外側のforループで使われています。`);break;default:throw console.log(e),Error(`予想外の1次元配列がfor文内で使用されました :`+t)}this.evalWwaNode(e.init)})();this.evalWwaNode(e.test);this.evalWwaNode(e.update)){if(this.for_id.loopCount++,this.for_id.loopCount>this.generator.loop_limit)throw Error(`処理回数が多すぎます!
|
|
94
|
+
上限値は LOOPLIMIT で変えられます。`);if(this.for_id.break_flag||!this.evalWwaNode(e.test))break;this.evalWwaNodes(e.body),this.for_id.continue_flag=!1}if(this.for_id.break_flag=!1,`kind`in t)switch(t.kind){case`i`:this.for_id.i=null;break;case`j`:this.for_id.j=null;break;case`k`:this.for_id.k=null;break}else switch(t.type){case`LoopPointerAssignment`:let e=Number(this.evalWwaNode(t.index));this.for_id.LP[e]=null;break}}_checkArgsLength(e,t){if(t.value.length<e)throw Error(`関数 ${t.functionName} の引数が不足しています!`)}evalSystemDefinedFunctionCall(e){let t=this.wrapCallFunction(e,e=>this.evalSystemDefinedFunctionCallInner(e));return(e.indecies?.map(e=>this.evalWwaNode(e))??[]).reduce((e,t)=>Ke(e,t),t)}evalSystemDefinedFunctionCallInner(t){let n=this.generator.wwa.getGameStatus();switch(t.functionName){case`JUMPGATE`:{let n=this.evalWwaNode(t.value[0]),r=this.evalWwaNode(t.value[1]),i=t.value[2]?this.evalWwaNode(t.value[2]):E.NO_DIRECTION;if(isNaN(n)||isNaN(r))throw Error(`飛び先の値が数値になっていません。 x=${n} / y=${r}`);let a=e.convertDirection(i);if(!Je(a))throw TypeError(`この値の向きにプレイヤーを向けることはできません`+i);this.generator.wwa.forcedJumpGate(n,r,a);return}case`MUSIC`:case`SOUND`:{this._checkArgsLength(1,t);let e=this.evalWwaNode(t.value[0]),n=t.value[1]?this.evalWwaNode(t.value[1]):void 0,r=t.value[2]?this.evalWwaNode(t.value[2]):!1;return this.generator.wwa.playSound(e,{loopPlaying:n,bgmDelayDurationMs:r>=0?r:void 0}),e}case`BGM_STOP`:case`STOP_BGM`:this.generator.wwa.stopBgm();return;case`SOUND_STOP`:case`STOP_SOUND`:{this._checkArgsLength(1,t);let e=this.evalWwaNode(t.value[0]);return this.generator.wwa.stopSound(e,{includeBgm:!0}),e}case`STOP_SOUNDS`:case`ALL_SOUND_STOP`:case`STOP_ALL_SOUND`:{let e=t.value.length>0?this.evalWwaNode(t.value[0]):new Map;if(!(e instanceof Map))throw Error(`STOP_ALL_SOUND の引数はオブジェクトで指定してください。`);let n=e?.get(`includeBgm`)??!0;this.generator.wwa.stopAllSound({includeBgm:!!n});return}case`SAVE`:{this._checkArgsLength(1,t);let e=!!this.evalWwaNode(t.value[0]);return this.generator.wwa.disableSave(e),e}case`LOG`:{this._checkArgsLength(1,t);let e=this.evalWwaNode(t.value[0]);console.log(e instanceof Map?d(e):e);return}case`ABLE_CHANGE_SPEED`:{this._checkArgsLength(1,t);let e=!!this.evalWwaNode(t.value[0]);return this.generator.wwa.speedChangeJudge(e),e}case`SET_SPEED`:{this._checkArgsLength(1,t);let e=Number(this.evalWwaNode(t.value[0]));this.generator.wwa.setPlayerSpeedIndex(e);return}case`CHANGE_GAMEOVER_POS`:{this._checkArgsLength(2,t);let e={x:Number(this.evalWwaNode(t.value[0])),y:Number(this.evalWwaNode(t.value[1]))};if(e.x<0||e.x>=this.generator.wwa.getMapWidth()||e.y<0||e.y>this.generator.wwa.getMapWidth())throw Error(`マップの範囲外が指定されています!`);this.generator.wwa.setGameOverPosition(new S(e.x,e.y));return}case`DEL_PLAYER`:{this._checkArgsLength(1,t);let e=!!this.evalWwaNode(t.value[0]);this.generator.wwa.setDelPlayer(e);return}case`RESTART_GAME`:this.generator.wwa.restartGame();return;case`URL_JUMPGATE`:throw Error(`URL_JUMPGATE 関数は調整中のためご利用になれません`);case`HIDE_STATUS`:{this._checkArgsLength(2,t);let e=Number(this.evalWwaNode(t.value[0])),n=!!this.evalWwaNode(t.value[1]);this.generator.wwa.hideStatus(e,n);return}case`PARTS`:{this._checkArgsLength(2,t);let e=Number(this.evalWwaNode(t.value[0])),n=Number(this.evalWwaNode(t.value[1])),r=t.value[2]?Number(this.evalWwaNode(t.value[2])):0,i=t.value[3]?!!this.evalWwaNode(t.value[3]):!1;if(e<0||n<0)throw Error(`パーツ番号が不正です`);if(!Cs.includes(r))throw Error(`パーツ種別が不明です`);this.generator.wwa.replaceParts(e,n,r,i);return}case`FACE`:{this._checkArgsLength(6,t);let e=Number(this.evalWwaNode(t.value[0])),n=Number(this.evalWwaNode(t.value[1])),r=Number(this.evalWwaNode(t.value[2])),i=Number(this.evalWwaNode(t.value[3])),a=Number(this.evalWwaNode(t.value[4])),o=Number(this.evalWwaNode(t.value[5]));if(e<0||n<0||r<0||i<0||a<0||o<0)throw Error(`各引数は0以上の整数でなければなりません。`);this.generator.addPageAdditionalItem({type:`face`,data:{face:new w(new S(e,n),new S(r,i),new S(a,o))}});return}case`EFFECT`:{this._checkArgsLength(1,t);let e=Number(this.evalWwaNode(t.value[0]));if(e<0)throw Error(`待ち時間は0以上の整数でなければなりません。`);if(e===0){this.generator.wwa.stopEffect();return}let n=[];for(let e=1;e<t.value.length;e+=2){let r=Number(this.evalWwaNode(t.value[e]));if(r<0)throw Error(`画像のパーツ座標指定は0以上の整数でなければなりません。`);if(e+1===t.value.length)throw Error(`画像のパーツ座標指定で、Y座標が指定されていません。`);let i=Number(this.evalWwaNode(t.value[e+1]));if(i<0)throw Error(`画像のパーツ座標指定は0以上の整数でなければなりません。`);n.push(new S(r,i))}this.generator.wwa.setEffect(e,n);return}case`CHANGE_PLAYER_IMAGE`:case`CHANGE_PLAYER_IMG`:{this._checkArgsLength(2,t);let e=new S(Number(this.evalWwaNode(t.value[0])),Number(this.evalWwaNode(t.value[1])));this.generator.wwa.setPlayerImgCoord(e);return}case`HAS_ITEM`:{this._checkArgsLength(1,t);let e=Number(this.evalWwaNode(t.value[0]));return n.itemBox.includes(e)}case`REMOVE_ITEM`:{this._checkArgsLength(1,t);let e=Number(this.evalWwaNode(t.value[0])),r=t.value[1]?this.evalWwaNode(t.value[1])===1:!1,i=0;for(let t=0;t<n.itemBox.length;t++)if(e===n.itemBox[t]&&(this.generator.wwa.setPlayerGetItem(t+1,0),i++,!r))return i;return i}case`MOVE`:{this._checkArgsLength(1,t);let e=Number(this.evalWwaNode(t.value[0]));if(e<=0||e>9)throw Error(`MOVEの移動先は2/4/6/8で指定してください!`);return this.generator.wwa.movePlayer(e),this.generator.wwa.movePlayer(e),0}case`PARTS_MOVE`:{this._checkArgsLength(1,t);let e=Number(this.evalWwaNode(t.value[0]));return this.generator.wwa.setMoveMacroWaitingToPlayer(e),0}case`IS_PLAYER_WAITING_MESSAGE`:return this.generator.wwa.isPlayerWaitingMessage();case`IS_MANUAL_PAUSE`:case`IS_PLAYER_WAITING_ENTER`:return this.generator.wwa.isManualPause();case`GET_UNIXTIME`:return Math.floor(new Date().getTime()/1e3);case`GET_DATE_YEAR`:return new Date().getFullYear();case`GET_DATE_MONTH`:return new Date().getMonth()+1;case`GET_DATE_DAY`:return new Date().getDate();case`GET_DATE_HOUR`:return new Date().getHours();case`GET_DATE_MINUTES`:return new Date().getMinutes();case`GET_DATE_SECONDS`:return new Date().getSeconds();case`GET_DATE_MILLISECONDS`:return new Date().getMilliseconds();case`GET_DATE_WEEKDAY`:return new Date().getDay();case`SHOW_USER_DEF_VAR`:console.log(this.generator.wwa.getAllUserNameVar());return;case`CHANGE_SYSMSG`:{this._checkArgsLength(1,t);let e=this.evalWwaNode(t.value[0]),n=t.value.length>=2?this.evalWwaNode(t.value[1]):void 0,r=this.resolveSystemMessageKeyFromMacroArg(e);if(!r)throw Error(`このIDのシステムメッセージは未定義です。`);if(typeof n==`number`||typeof n==`string`||typeof n==`boolean`)this.generator.wwa.overwriteSystemMessage(r,String(n));else if(n==null)this.generator.wwa.overwriteSystemMessage(r,void 0);else throw Error(`この値は文字列に変換できないため、システムメッセージを表示できません。`);break}case`PICTURE`:{this._checkArgsLength(1,t);let e=Number(this.evalWwaNode(t.value[0])),n=t.value.length>=2?this.evalWwaNode(t.value[1]):void 0;if(n===void 0){this.generator.wwa.deletePictureRegistry(e);return}if(n instanceof Map)this.generator.wwa.setPictureRegistryFromObject(e,d(n));else if(typeof n==`string`)this.generator.wwa.setPictureRegistryFromRawText(e,n);else throw Error(`ピクチャのプロパティ定義は文字列あるいはオブジェクトである必要があります。`);break}case`PICTURE_FROM_PARTS`:{this._checkArgsLength(2,t);let e=Number(this.evalWwaNode(t.value[0])),n=Number(this.evalWwaNode(t.value[1]));if(n===0){this.generator.wwa.deletePictureRegistry(e);return}let r=t.value.length>=3?Number(this.evalWwaNode(t.value[2])):j.OBJECT;if(!Cs.includes(r))throw Error(`パーツ種別が不明です`);let i=this.generator.wwa.getGameStatus();this.generator.wwa.setPictureRegistry(e,n,r,i.playerCoord);break}case`CLEAR_ALL_PICTURES`:this.generator.wwa.clearAllPictures();break;case`HAS_PICTURE`:{this._checkArgsLength(1,t);let e=Number(this.evalWwaNode(t.value[0]));return n.wwaData.pictureRegistry.some(t=>t.layerNumber===e)}case`DIV`:return this._checkArgsLength(2,t),Number(this.evalWwaNode(t.value[0]))/Number(this.evalWwaNode(t.value[1]));case`FLOOR`:{this._checkArgsLength(1,t);let e=Number(this.evalWwaNode(t.value[0]));return Math.floor(e)}case`CEIL`:{this._checkArgsLength(1,t);let e=Number(this.evalWwaNode(t.value[0]));return Math.ceil(e)}case`ROUND`:{this._checkArgsLength(1,t);let e=Number(this.evalWwaNode(t.value[0]));return Math.round(e)}case`ABS`:{this._checkArgsLength(1,t);let e=Number(this.evalWwaNode(t.value[0]));return Math.abs(e)}case`POW`:return this._checkArgsLength(2,t),Number(this.evalWwaNode(t.value[0]))**+Number(this.evalWwaNode(t.value[1]));case`SQRT`:{this._checkArgsLength(1,t);let e=Number(this.evalWwaNode(t.value[0]));return Math.sqrt(e)}case`SIN`:{this._checkArgsLength(1,t);let e=Number(this.evalWwaNode(t.value[0])),n=Math.sin(e*Math.PI/180);return ws(n)?0:n}case`COS`:{this._checkArgsLength(1,t);let e=Number(this.evalWwaNode(t.value[0])),n=Math.cos(e*Math.PI/180);return ws(n)?0:n}case`TAN`:{this._checkArgsLength(1,t);let e=Number(this.evalWwaNode(t.value[0])),n=Math.tan(e*Math.PI/180);return ws(n)?0:n}case`GET_GAMEOVER_POS_X`:return this.generator.wwa.getGemeOverPosition().x;case`GET_GAMEOVER_POS_Y`:return this.generator.wwa.getGemeOverPosition().y;case`ABORT_BATTLE`:throw this.generator.state.battleDamageCalculation&&(this.generator.state.battleDamageCalculation.aborted=!0),new Ns(`ABORT_BATTLE`);case`EXIT`:throw new Ns(`EXIT`,this.evalWwaNode(t.value[0]));case`GET_IMG_POS_X`:{this._checkArgsLength(1,t);let e=Number(this.evalWwaNode(t.value[0])),n=(t.value[1]===void 0?0:Number(this.evalWwaNode(t.value[1])))===0?j.OBJECT:j.MAP;if(n===j.OBJECT){let n=t.value[2]===void 0?!0:Number(this.evalWwaNode(t.value[2]))===0,r=this.generator.wwa.getObjectInfo(e),i=n?r[R.ATR_X]:r[R.ATR_X2];return Math.floor(i/R.CHIP_SIZE)}else if(n===j.MAP){let t=this.generator.wwa.getMapInfo(e)[R.ATR_X];return Math.floor(t/R.CHIP_SIZE)}throw Error(`GET_IMG_POS_X: 指定したIDのパーツのTypeが異常です。`)}case`GET_IMG_POS_Y`:{this._checkArgsLength(1,t);let e=Number(this.evalWwaNode(t.value[0])),n=(t.value[1]===void 0?0:Number(this.evalWwaNode(t.value[1])))===0?j.OBJECT:j.MAP;if(n===j.OBJECT){let n=t.value[2]===void 0?!0:Number(this.evalWwaNode(t.value[2]))===0,r=this.generator.wwa.getObjectInfo(e),i=n?r[R.ATR_Y]:r[R.ATR_Y2];return Math.floor(i/R.CHIP_SIZE)}else if(n===j.MAP){let t=this.generator.wwa.getMapInfo(e)[R.ATR_Y];return Math.floor(t/R.CHIP_SIZE)}throw Error(`GET_IMG_POS_Y: 指定したIDのパーツのTypeが異常です。`)}case`LENGTH`:return this._checkArgsLength(1,t),Ts(this.evalWwaNode(t.value[0]));case`IS_NUMBER`:return this._checkArgsLength(1,t),typeof this.evalWwaNode(t.value[0])==`number`;case`IS_NAN`:{this._checkArgsLength(1,t);let e=this.evalWwaNode(t.value[0]);return isNaN(e)}case`CLONE`:{this._checkArgsLength(1,t);let e=this.evalWwaNode(t.value[0]);if(typeof e==`symbol`||!f(e)&&!(e instanceof Map)&&!Array.isArray(e))throw TypeError(`この値はクローンできません。`);try{return structuredClone(e)}catch(e){throw console.error(e),Error(`クローン中にエラーが発生しました。`)}}case`MANUAL_PAUSE`:case`WAIT_ENTER`:{let e=this.evalWwaNode(t.value[0]),n=e===`__BLOCK`;this.generator.wwa.manualPause({functionNames:{cancelPause:e&&!n?e:``,up:t.value[1]?this.evalWwaNode(t.value[1]):``,down:t.value[2]?this.evalWwaNode(t.value[2]):``,right:t.value[3]?this.evalWwaNode(t.value[3]):``,left:t.value[4]?this.evalWwaNode(t.value[4]):``},blockingCancelPauseByPlayer:n});return}case`CANCEL_MANUAL_PAUSE`:case`CANCEL_WAIT_ENTER`:this.generator.wwa.cancelManualPause();return;case`COLOR`:{this._checkArgsLength(4,t);let e=Number(this.evalWwaNode(t.value[0])),n=Number(this.evalWwaNode(t.value[1])),r=Number(this.evalWwaNode(t.value[2])),i=Number(this.evalWwaNode(t.value[3]));if(e<0||e>5)throw Error(`種別は0から5までです`);if(n<0||n>255||r<0||r>255||i<0||i>255)throw Error(`色が範囲外です`);this.generator.wwa.changeStyleRule(e,n,r,i);return}case`EFFITEM`:{this._checkArgsLength(1,t);let e=!!this.evalWwaNode(t.value[0]);this.generator.wwa.updateItemEffectEnabled(e);return}case`CHANGE_BOM_IMAGE`:case`CHANGE_BOM_IMG`:{this._checkArgsLength(2,t);let e=Number(this.evalWwaNode(t.value[0])),n=Number(this.evalWwaNode(t.value[1]));if(e<0||n<0)throw Error(`座標は0以上の整数ではありません`);this.generator.wwa.setBattleEffectCoord(new S(e,n));return}case`CHANGE_CLICK_IMAGE`:case`CHANGE_CLICK_IMG`:{this._checkArgsLength(2,t);let e=Number(this.evalWwaNode(t.value[0])),n=Number(this.evalWwaNode(t.value[1]));if(e<0||n<0)throw Error(`引数が0以上の整数ではありません`);this.generator.wwa.setImgClick(new S(e,n));return}case`CHANGE_FRAME_IMAGE`:case`CHANGE_FRAME_IMG`:{this._checkArgsLength(3,t);let e=Number(this.evalWwaNode(t.value[0])),n=Number(this.evalWwaNode(t.value[1])),r=Number(this.evalWwaNode(t.value[2]));if(n<0||r<0)throw Error(`座標は正でなければなりません。`);switch(e){case L.ENERGY:case L.STRENGTH:case L.DEFENCE:case L.GOLD:this.generator.wwa.setStatusIconCoord(e,new S(n,r));break;case L.WIDE_CELL_ROW:this.generator.wwa.setWideCellCoord(new S(n,r));break;case L.ITEM_BG:this.generator.wwa.setItemboxBackgroundPosition({x:n,y:r});break;case L.MAIN_FRAME:this.generator.wwa.setFrameCoord(new S(n,r));break;default:throw Error(`種別が不正です。`)}return}case`CHANGE_YESNO_IMAGE`:case`CHANGE_YESNO_IMG`:{this._checkArgsLength(2,t);let e=Number(this.evalWwaNode(t.value[0])),n=Number(this.evalWwaNode(t.value[1]));this.generator.wwa.setYesNoImgCoord(new S(e,n));return}case`NO_GAMEOVER`:{this._checkArgsLength(1,t);let e=this.evalWwaNode(t.value[0]);this.generator.wwa.setGameOverPolicy(e);return}case`DEFAULT`:{this._checkArgsLength(1,t);let e=!!this.evalWwaNode(t.value[0]);this.generator.wwa.setObjectNotCollapseOnPartsOnPlayer(e);return}case`DIR_MAP`:{this._checkArgsLength(2,t);let e=Number(this.evalWwaNode(t.value[0])),n=Number(this.evalWwaNode(t.value[1])),r=t.value[2]===void 0?j.OBJECT:Number(this.evalWwaNode(t.value[2]));if(e<0)throw Error(`パーツ番号が不正です`);if(r===j.OBJECT){if(e>=this.generator.wwa.getObjectPartsNum())throw Error(`パーツ番号が不正です`)}else if(e>=this.generator.wwa.getMapPartsNum())throw Error(`パーツ番号が不正です`);this.generator.wwa.appearPartsByDirection(n,e,r);return}case`CHANGE_SOUND_DECISION`:{this._checkArgsLength(1,t);let e=this.evalWwaNode(t.value[0]);this.generator.wwa.setDecisionSound(e);return}case`CHANGE_SOUND_ATTACK`:{this._checkArgsLength(1,t);let e=this.evalWwaNode(t.value[0]);this.generator.wwa.setAttackSound(e);return}case`SORT`:{if(this.for_id.sort_a||this.for_id.sort_b)throw Error(`SORT関数に与えた関数内でSORT関数を呼び出すことはできません。`);this._checkArgsLength(1,t);let e=this.evalWwaNode(t.value[0]),n=t.value[1]?this.evalWwaNode(t.value[1]):void 0;if(!Array.isArray(e))throw Error(`SORT関数の引数は配列である必要があります。`);if(n!==void 0&&typeof n!=`string`)throw Error(`SORT関数の比較関数名は文字列である必要があります。`);let r=this.generator.wwa.getUserScript(n);e.sort(n?(e,t)=>{this.for_id.sort_a={value:e},this.for_id.sort_b={value:t};try{this.evalWwaNode(r)}catch(e){if(e instanceof Ms)return this.for_id.sort_a=void 0,this.for_id.sort_b=void 0,e.value;throw e}}:void 0);return}case`DISABLE_BATTLE_REPORT`:{this._checkArgsLength(1,t);let e=!!this.evalWwaNode(t.value[0]);this.generator.wwa.disableBattleEstimate(e);return}default:throw Error(`未定義の関数が指定されました: `+t.functionName)}}static convertDirection(e){switch(e){case 2:case`down`:return E.DOWN;case 4:case`left`:return E.LEFT;case 5:case void 0:case null:return E.NO_DIRECTION;case 6:case`right`:return E.RIGHT;case 8:case`up`:return E.UP;default:console.warn(`JUMPGATEの方向指定 ${String(e)} が不正です`);return}}resolveSystemMessageKeyFromMacroArg(e){if(typeof e==`string`)return v(e)?e:void 0;if(typeof e==`number`)return y(e)}partsAssignment(e){let t=this.generator.wwa.getGameStatus(),n=this.evalWwaNode(e.destinationX),r=this.evalWwaNode(e.destinationY);if(typeof n!=`number`||typeof r!=`number`)throw Error(`座標は数値で指定してください (${n}, ${r})`);new C(this.generator.wwa,n,r);let i=e.partsKind===`map`?j.MAP:j.OBJECT,a=this.resolveParts(i,n,r),o=this.evalWwaNode(e.value);switch(e.operator){case`=`:case`+=`:case`-=`:case`*=`:case`/=`:{let s=ks[e.operator](a,o)|0;if(s<0)throw Error(`負値のパーツ番号 ${s} は代入できません`);this.generator.wwa.appearPartsEval(t.playerCoord,`${n}`,`${r}`,s,i);break}default:throw Error(`演算子 ${e.operator} は partsAssignment では使えません`)}}resolveParts(e,t,n){let r=this.generator.wwa.getGameStatus();switch(e){case j.MAP:return r.wwaData.map[n][t];case j.OBJECT:return r.wwaData.mapObject[n][t];default:throw Error(`存在しないPartsTypeです`,e)}}blockStatement(e){return this.evalWwaNodes(e.value)}ifStatement(e){if(this.evalWwaNode(e.test))return this.evalWwaNode(e.consequent);if(e.alternate)return this.evalWwaNode(e.alternate)}convertConditionalExpression(e){let t=this.evalWwaNode(e.test)?e.consequent:e.alternate;return this.evalWwaNode(t)}property(e){let t=this.evalWwaNode(e.key);if(!f(t))throw Error(`オブジェクトのキーはプリミティブ値でなければなりません。: ${t}`);return[String(this.evalWwaNode(e.key)),this.evalWwaNode(e.value)]}objectExpression(e){let t=e.properties.map(e=>this.evalWwaNode(e));return new Map(t)}arrayExpression(e){return e.elements.map(e=>this.evalWwaNode(e))}convertLoopPointerExpression(e){let t=this.evalWwaNode(e.value),n=this.evalWwaNode(e.index);switch(e.operator){case`+=`:this.for_id.LP[n]=t;break;case`-=`:this.for_id.LP[n]=t;break;case`/=`:this.for_id.LP[n]=t;break;case`*=`:this.for_id.LP[n]=t;break;default:this.for_id.LP[n]=t;break}return 0}itemAssignment(e){let t=this.evalWwaNode(e.itemBoxPosition1to12);if(typeof t!=`number`||t<0||t>12)throw Error(`ITEMの添字に想定外の値が入っています。0以上12以下の添字を指定してください。: `+t);let n=this.evalWwaNode(e.value);switch(e.operator){case`=`:this.generator.wwa.setPlayerGetItem(t,n|0);break;case`+=`:case`-=`:case`*=`:case`/=`:{if(t===0)throw Error(`複合代入では ITEM[0] への操作はできません`);let r=this.generator.wwa.getGameStatus().itemBox[t-1],i=ks[e.operator](r,n)|0;if(i<0)throw Error(`負値のパーツ番号 ${i} は代入できません`);this.generator.wwa.setPlayerGetItem(t,i);break}default:throw Error(`演算子 ${e.operator} は itemAssignment では使えません`)}}evalMessage(e){let t=this.evalWwaNode(e.value),n=this.generator.pickPageAdditionalQueue();this.generator.wwa.handleMsgFunction({message:String(t),additionalItems:n})}evalRandom(e){let t=this.evalWwaNode(e.value);return Math.floor(Math.random()*t)}evalSetSpecialParameter(e){let t=this.evalWwaNode(e.value);if(!this.generator.wwa||isNaN(t))return t;let n=this.evalSymbol({type:`Symbol`,name:e.kind});if(Array.isArray(n))throw Error(`配列Objectに対して直接代入は出来ません: ${n}`);let r=(()=>{switch(e.operator){case`+=`:return n+t;case`-=`:return typeof n!=`number`||typeof t!=`number`?(console.warn(`${e.kind} に数値以外の減算をすることはできません、`),NaN):n-t;case`*=`:return typeof n!=`number`||typeof t!=`number`?(console.warn(`${e.kind} に数値以外の乗算をすることはできません、`),NaN):n*t;case`/=`:return typeof n!=`number`||typeof t!=`number`?(console.warn(`${e.kind} に数値以外の除算をすることはできません、`),NaN):n/t;default:return t}})();switch(e.kind){case`PX`:return this.generator.wwa.jumpSpecifiedXPos(r),r;case`PY`:return this.generator.wwa.jumpSpecifiedYPos(r),r;case`AT`:return this.generator.wwa.setPlayerStatus(ue.STRENGTH,r,!0),r;case`DF`:return this.generator.wwa.setPlayerStatus(ue.DEFENCE,r,!0),r;case`GD`:return this.generator.wwa.setPlayerStatus(ue.GOLD,r,!0),r;case`HP`:{let{isGameOver:e}=this.generator.wwa.setPlayerStatus(ue.ENERGY,r,!0);if(e)throw new Ns(`GAME_OVER`);return r}case`HPMAX`:return this.generator.wwa.setPlayerEnergyMax(r),r;case`i`:return this.for_id.i=this.evalWwaNode(e.value),this.for_id.i;case`j`:return this.for_id.j=this.evalWwaNode(e.value),this.for_id.j;case`k`:return this.for_id.k=this.evalWwaNode(e.value),this.for_id.k;case`LOOPLIMIT`:{let t=this.evalWwaNode(e.value);return this.generator.updateLoopLimit(t),t}default:console.error(`未実装の要素です: `+e.kind);return}}evalSetUserVariable(e){if(e.index.length>1){let t=this.evalWwaNode(e.value),n=e.index.map(e=>this.evalWwaNode(e));this.generator.wwa.setUserVarIndecies(n,t,e.operator);return}else{let t=this.evalWwaNode(e.value);if(!this.generator.wwa)return t;let n=this.evalWwaNode(e.index[0]);return this.generator.wwa.setUserVar(n,t,e.operator),t}}evalUnaryOperation(e){switch(e.operator){case`+`:return this.evalWwaNode(e.argument);case`-`:return-this.evalWwaNode(e.argument);case`!`:return!this.evalWwaNode(e.argument);default:throw Error(`存在しない単項演算子です`)}}evalBinaryOperation(e){let t=this.evalWwaNode(e.left),n=this.evalWwaNode(e.right);switch(e.operator){case`+`:return t+n;case`-`:return t-n;case`*`:return t*n;case`/`:return n===0?0:Math.floor(t/n);case`%`:return n===0?0:t%n;case`>`:return t>n;case`>=`:return t>=n;case`<`:return t<n;case`<=`:return t<=n;case`==`:return t==n;case`!=`:return t!=n;default:throw Error(`存在しない単項演算子です`)}}evalSymbol(e){let t=this.generator.wwa.getGameStatus(),n=this.generator.wwa.getEnemyStatus();switch(e.name){case`X`:return this.generator.state.triggerParts?.position.x??t.playerCoord.x;case`Y`:return this.generator.state.triggerParts?.position.y??t.playerCoord.y;case`ID`:return this.generator.state.triggerParts?.id??-1;case`TYPE`:return this.generator.state.triggerParts?.type??-1;case`PX`:return t.playerCoord.x;case`PY`:return t.playerCoord.y;case`CX`:return t.cameraCoord.x;case`CY`:return t.cameraCoord.y;case`AT`:return t.bareStatus.strength;case`AT_TOTAL`:return this.generator.state.battleDamageCalculation?.estimatingParams?.playerStatus.strength??t.totalStatus.strength;case`DF`:return t.bareStatus.defence;case`DF_TOTAL`:return this.generator.state.battleDamageCalculation?.estimatingParams?.playerStatus.defence??t.totalStatus.defence;case`GD`:return this.generator.state.battleDamageCalculation?.estimatingParams?.playerStatus.gold??t.totalStatus.gold;case`HP`:return this.generator.state.battleDamageCalculation?.estimatingParams?.playerStatus.energy??t.totalStatus.energy;case`HPMAX`:return t.energyMax;case`STEP`:return t.moveCount;case`TIME`:return t.playTime;case`PDIR`:return t.playerDirection;case`i`:return this.for_id.i;case`j`:return this.for_id.j;case`k`:return this.for_id.k;case`LOOPLIMIT`:return this.generator.loop_limit;case`ITEM_ID`:return this.generator.state.earnedItem?.partsId??-1;case`ITEM_POS`:return this.generator.state.earnedItem?.itemPos1To12??-1;case`ENEMY_HP`:return this.generator.state.battleDamageCalculation?.estimatingParams?.enemyStatus.energy??(typeof n==`number`?-1:n.energy);case`ENEMY_AT`:return this.generator.state.battleDamageCalculation?.estimatingParams?.enemyStatus.strength??(typeof n==`number`?-1:n.strength);case`ENEMY_DF`:return this.generator.state.battleDamageCalculation?.estimatingParams?.enemyStatus.defence??(typeof n==`number`?-1:n.defence);case`ENEMY_GD`:return this.generator.state.battleDamageCalculation?.estimatingParams?.enemyStatus.gold??(typeof n==`number`?-1:n.gold);case`PICTURE`:throw Error(`この機能はまだ実装されていません!`);case`PLAYER_PX`:return Es(t.playerCoord.x,t.cameraCoord.x);case`PLAYER_PY`:return Ds(t.playerCoord.y,t.cameraCoord.y);case`MOVE_SPEED`:return de[t.gameSpeedIndex];case`MOVE_FRAME_TIME`:return R.CHIP_SIZE/de[t.gameSpeedIndex];case`LP`:return this.for_id.LP;case`undefined`:return;case`SORT_A`:if(!this.for_id.sort_a)throw Error(`SORT_AはSORT関数の比較関数内でのみ使用可能です。`);return this.for_id.sort_a?.value;case`SORT_B`:if(!this.for_id.sort_b)throw Error(`SORT_BはSORT関数の比較関数内でのみ使用可能です。`);return this.for_id.sort_b?.value;default:throw Error(`このシンボルは取得できません`)}}evalArrayOrObject1D(e){let t=this.evalWwaNode(e.indecies[0]);if(typeof t!=`number`)switch(e.name){case`v`:return this.generator.wwa.getUserNameVar(t);case`SORT_A`:if(!this.for_id.sort_a)throw Error(`SORT_AはSORT関数の比較関数内でのみ使用可能です。`);return Ke(this.for_id.sort_a.value,t);case`SORT_B`:if(!this.for_id.sort_b)throw Error(`SORT_BはSORT関数の比較関数内でのみ使用可能です。`);return Ke(this.for_id.sort_b.value,t);default:throw Error(`このシンボルは取得できません`)}let n=this.generator.wwa.getGameStatus();switch(e.name){case`v`:return this.generator.wwa.getUserVar(t);case`ITEM`:if(t<1||t>12)throw Error(`ITEMの添字に想定外の値が入っています。1以上12以下の添字を指定してください。: `+t);return n.itemBox[t-1];case`PICTURE`:throw Error(`この機能はまだ実装されていません!`);case`LP`:return this.for_id.LP[t];case`SORT_A`:if(!this.for_id.sort_a)throw Error(`SORT_AはSORT関数の比較関数内でのみ使用可能です。`);return this.for_id.sort_a.value[t];case`SORT_B`:if(!this.for_id.sort_b)throw Error(`SORT_BはSORT関数の比較関数内でのみ使用可能です。`);return this.for_id.sort_b.value[t];default:throw console.log(e.name,e.indecies[0],t),Error(`このシンボルは取得できません`)}}evalArrayOrObject2D(e){switch(e.name){case`m`:case`o`:let t=this.evalWwaNode(e.indecies[0]),n=this.evalWwaNode(e.indecies[1]);if(typeof t!=`number`||typeof n!=`number`)throw Error(`座標は数値で指定してください (${t}, ${n})`);new C(this.generator.wwa,t,n);let r=e.name===`o`?j.OBJECT:j.MAP;return this.generator.wwa.getPartsID(new S(t,n),r);case`v`:{let t=this.evalWwaNode(e.indecies[0]),n=this.generator.wwa.getUserNameVar(t);if(n===null||!Array.isArray(n)&&typeof n!=`object`&&typeof n!=`string`)throw Error(`指定したユーザー定義変数: v["${t}"] は配列・オブジェクト・文字列ではありません`);return Ke(n,this.evalWwaNode(e.indecies[1]))}case`SORT_A`:{let t=e.indecies.map(e=>this.evalWwaNode(e));if(!this.for_id.sort_a)throw Error(`SORT_AはSORT関数の比較関数内でのみ使用可能です。`);return t.reduce((e,t)=>Ke(e,t),this.for_id.sort_a.value)}case`SORT_B`:{let t=e.indecies.map(e=>this.evalWwaNode(e));if(!this.for_id.sort_b)throw Error(`SORT_BはSORT関数の比較関数内でのみ使用可能です。`);return t.reduce((e,t)=>Ke(e,t),this.for_id.sort_b.value)}}}evalArrayOrObject3DPlus(e){let t=e.indecies.map(e=>this.evalWwaNode(e));switch(e.name){case`v`:{let e=this.generator.wwa.getUserNameVar(t[0]);return t.slice(1).reduce((e,t)=>Ke(e,t),e)}case`SORT_A`:if(!this.for_id.sort_a)throw Error(`SORT_AはSORT関数の比較関数内でのみ使用可能です。`);return t.reduce((e,t)=>Ke(e,t),this.for_id.sort_a.value);case`SORT_B`:if(!this.for_id.sort_b)throw Error(`SORT_BはSORT関数の比較関数内でのみ使用可能です。`);return t.reduce((e,t)=>Ke(e,t),this.for_id.sort_b.value)}}evalLiteral(e){return e.value}},Ms=class{constructor(e){this.value=e}},Ns=class{constructor(e,t){this.reason=e,this.value=t}};function Ps(e){return qo(e,{ecmaVersion:2020})}var Fs=async e=>{try{let t=await fetch(e);return t.status===200||t.status===304?{kind:`data`,data:await new Response(t.body).text(),fileName:e}:{kind:`httpError`,errorMessage:`ファイル ${e} が読み込めませんでした。ステータスコード: ${t.status}`,fileName:e}}catch(t){return{kind:`otherError`,errorMessage:t.message,fileName:e}}},Is=`user-variable-label`;function Ls(){let e=document.createElement(`div`);return e.textContent=`-`,e.setAttribute(`aria-hidden`,`true`),e.classList.add(Is),e}function Rs(e,t){e.textContent!==t&&(e.textContent=t)}var zs=`-`,Bs=`user-variable-card`,Vs=`user-variable-card--is-trimmed`;function Hs({index:e,value:t}){let n=document.createElement(`div`);n.classList.add(Bs),qs(t)&&n.classList.add(Vs),n.dataset.varIndex=String(e);let{cardIndexElement:r,cardIndexLabelElement:i}=Us(e),a=Ws(t);return n.appendChild(r),n.appendChild(a),{cardElement:n,cardIndexElement:r,cardIndexLabelElement:i,cardValueElement:a}}function Us(e){let t=document.createElement(`div`);t.classList.add(`index`),t.textContent=String(e),typeof e==`string`&&t.setAttribute(`title`,e);let n=Ls();return t.appendChild(n),{cardIndexElement:t,cardIndexLabelElement:n}}function Ws(e){let t=document.createElement(`div`);return t.classList.add(`value`),typeof e==`string`&&t.setAttribute(`title`,Ge(e)),Ks(t,e),t}function Gs(e,t){e.dataset.labelledVarIndex=`true`,e.addEventListener(`mouseover`,()=>t.removeAttribute(`aria-hidden`)),e.addEventListener(`mouseleave`,()=>t.setAttribute(`aria-hidden`,`true`))}function Ks(e,t){let n=Ge(t);e.textContent!==n&&(e.textContent=t===void 0?zs:Ge(t))}function qs(e){return typeof e!=`object`}var Js=`user-variable-list`;function Ys({kind:e,elementStore:t}){let n=document.createElement(`ul`);return n.classList.add(Js),e===`numbered`&&Array.from({length:R.USER_VAR_NUM}).map((e,n)=>Xs({elementStore:t,index:n})).forEach(e=>n.appendChild(e)),n}function Xs({elementStore:e,index:t,value:n}){let r=document.createElement(`li`),i=Hs({index:t,value:n});return e.updateUserVarElementInfo(t,i),r.appendChild(i.cardElement),r}function Zs(e,t,{index:n,value:r}){t.appendChild(Xs({elementStore:e,index:n,value:r}))}var Qs=`information`;function $s(){let e=document.createElement(`p`);return e.classList.add(Qs),ec(e,`強調されている番号にカーソルを乗せると説明が表示されます。`),e}function ec(e,t,n=!1){e.textContent=`${n?`【エラー】`:``}${t}`}function tc({elementStore:e,heading:t,contentVisibilityToggleButton:n,information:r}){let i=document.createElement(`header`);if(i.appendChild(rc({heading:t,contentVisibilityToggleButton:n})),r){let t=$s();i.appendChild(t),e.updateNamedUserVarInformationElement(t)}return i}function nc(e,t){e.textContent=t?`▲隠す`:`▼表示`}function rc({heading:e,contentVisibilityToggleButton:t}){let n=document.createElement(`div`);n.classList.add(`heading-area`);let r=document.createElement(`h2`);r.textContent=e.text,n.appendChild(r);let i=document.createElement(`button`);return i.classList.add(`content-visibility-toggle-button`),nc(i,!0),t.onClick&&i.addEventListener(`click`,t.onClick.bind(i)),n.appendChild(i),n}var ic=`user-variable-list-section`;function ac({kind:e,elementStore:t}){let n=document.createElement(`section`);n.classList.add(ic),n.dataset.kind=e;let r=Ys({kind:e,elementStore:t});t.updateUserVarListElement(e,r);let i=tc({elementStore:t,heading:{text:e===`named`?`名前つき変数一覧`:`変数一覧`},information:(e===`numbered`||void 0)&&{},contentVisibilityToggleButton:{onClick:e=>{let n=t.getNamedUserVarInformationElement();n&&(r.getAttribute(`aria-hidden`)===`true`?oc(r,n,e.target):sc(r,n,e.target))}}});return n.appendChild(i),n.appendChild(r),t.updateUserVarListElement(e,r),n}function oc(e,t,n){e.removeAttribute(`aria-hidden`),t instanceof HTMLElement&&t.removeAttribute(`aria-hidden`),n instanceof HTMLElement&&nc(n,!0)}function sc(e,t,n){e.setAttribute(`aria-hidden`,`true`),t instanceof HTMLElement&&t.setAttribute(`aria-hidden`,`true`),n instanceof HTMLElement&&nc(n,!1)}function cc(){let e=new Map,t=new Map,n=new Map,r=null;return{getAllNamedUserVarIndeciesSet:()=>new Set(t.keys()),updateUserVarElementInfo:(n,r)=>{if(typeof n==`number`)e.set(n,r);else if(typeof n==`string`)t.set(n,r);else throw TypeError(`Invalid index: ${n}`)},getUserVarElementInfo:n=>{if(typeof n==`number`)return e.get(n);if(typeof n==`string`)return t.get(n);throw TypeError(`Invalid index: ${n}`)},deleteUserVarElementInfo:n=>{if(typeof n==`number`)e.delete(n);else if(typeof n==`string`)t.delete(n);else throw TypeError(`Invalid index: ${n}`)},getUserVarListElement:e=>n.get(e),updateUserVarListElement:(e,t)=>{n.set(e,t)},deleteUserVarListElement:e=>{n.delete(e)},getNamedUserVarInformationElement:()=>r,updateNamedUserVarInformationElement:e=>{r=e},deleteNamedUserVarInformationElement:()=>{r=null},dispose:()=>{e.clear(),t.clear(),n.clear(),r=null}}}function lc(e,t){let n=e.getAllNamedUserVarIndeciesSet(),r=e.getUserVarListElement(`named`);for(let[i,a]of t){let t=e.getUserVarElementInfo(i)?.cardValueElement;n.delete(i),t?Ks(t,a):Zs(e,r,{index:i,value:a})}for(let t of n){let n=e.getUserVarElementInfo(t)?.cardElement.parentElement;n instanceof HTMLLIElement&&(e.getUserVarListElement(`named`)?.removeChild(n),e.deleteUserVarElementInfo(t))}}function uc(e,t){Array.from({length:R.USER_VAR_NUM}).map((n,r)=>{let i=e.getUserVarElementInfo(r)?.cardValueElement;i&&Ks(i,t[r])})}function dc(e,t){Array.from({length:R.USER_VAR_NUM}).map((n,r)=>{let i=t[r];if(!i)return;let a=e.getUserVarElementInfo(r);if(!a)return;let o=a.cardIndexElement,s=a.cardIndexLabelElement;Rs(s,i),Gs(o,s)})}function fc(e,t,n=!1){ec(e.getNamedUserVarInformationElement(),t,n)}var pc=`wwa-vardump-wrapper`;function mc(e){let t=Le(e),n=cc();return t instanceof HTMLElement?(t.classList.add(pc),t.appendChild(ac({kind:`named`,elementStore:n})),t.appendChild(ac({kind:`numbered`,elementStore:n})),{updateAllVariables:({namedUserVar:e,userVar:t})=>{e&&lc(n,e),t&&uc(n,t)},numberedUserVariable:{updateValues:e=>uc(n,e),updateLabels:e=>dc(n,e),updateInformation:(e,t=!1)=>fc(n,e,t)},namedUserVariable:{updateValues:e=>lc(n,e)}}):null}function hc(){return{mapdata:``,urlGateEnable:!1,titleImg:void 0,audioDir:`./audio/`,classicModeEnable:!1,itemEffectEnable:!0,useGoToWwa:!1,lookingAround:!1,autoSave:!0,disallowLoadOldSave:!1,resumeSaveData:void 0,varDump:null,userVarNamesFile:void 0,displayUserVars:!1,virtualPadEnable:!1,virtualPadViewportFitEnable:!1,virtualPadControllerElm:void 0,userDefinedScriptsFile:`./script/script_file_list.json`,frameRateDisplayingPattern:`default-off`}}var gc;function _c(e,t,n){var r=new ge;return r.current=e,r.total=t,r.stage=n,r}var vc=class{constructor(e=hc()){this._useSuspend=!1,this._useLookingAround=!0,this._isDisallowLoadOldSave=!1,this._playerAndObjectsStopWaitingGameSpeedChangeRequest=void 0,this._windowCloseWaitingMessageDisplayRequests=[],this._playerAndObjectsStopWaitingMessageDisplayRequests=[],this._windowCloseWaitingJumpGateRequest=void 0,this._debugConsoleElement=void 0,this._frameRateDisplayingPattern=`default-off`,this.audioExtension=``,this.soundLoadedCheckTimer=void 0,this._playTimeCalculator=void 0,this._varDump=null,this.userDefinedFunctions={},this.convertWwaNodes=e=>Yo(Ps(e)),this._prevTimeStamp=-1,this._accumlatedTimeMs=0,this._samplingTimeMs=0,this._frameCountForMeasureFps=0,this.mainCaller=e=>{if(this._prevTimeStamp<0){this._prevTimeStamp=e,requestAnimationFrame(this.mainCaller.bind(this));return}let t=e-this._prevTimeStamp;this._prevTimeStamp=e,this._accumlatedTimeMs+=t,this._accumlatedTimeMs>=R.INTERVAL_MS&&(this._accumlatedTimeMs-=R.INTERVAL_MS,this._accumlatedTimeMs>R.INTERVAL_MS*2&&(this._accumlatedTimeMs=0),this._main(),this._frameCountForMeasureFps++),this._samplingTimeMs+=t,this._samplingTimeMs>=1e3&&(this._gameFrameRateWindow?.updateCurrentFps(this._frameCountForMeasureFps/(this._samplingTimeMs/1e3)),this._frameCountForMeasureFps=0,this._samplingTimeMs=0),requestAnimationFrame(this.mainCaller.bind(this))},this.soundCheckCaller=()=>this.checkAllSoundLoaded(),this._checkTurnKeyPressed=()=>this._keyStore.checkHitKey(V.KEY_ESC)||this._keyStore.checkHitKey(V.KEY_SHIFT)||this._keyStore.checkHitKey(V.KEY_N),this._saveDataList=[],this.wwaCustomEventEmitter=new $i(U(`wwa-wrapper`));let t;window.addEventListener(`click`,e=>{this._isActive=!1}),U(`wwa-wrapper`).addEventListener(`click`,e=>{e.stopPropagation(),this._isActive=!0}),this._isActive=!0,e.titleImg===void 0?(this._hasTitleImg=!1,this._cvsCover=U(`progress-panel`),t=this._cvsCover.getContext(`2d`),t.fillStyle=`rgb(0, 0, 0)`):this._hasTitleImg=!0;try{this._hasTitleImg?(U(`unstable-version-warning`).textContent=`この WWA Wing は [不安定版] です。`,U(`version`).textContent=`WWA Wing Ver.4.0.22`):this._setLoadingMessage(t,0)}catch{}this._varDump=e.varDump;let n=window.AudioContext||window.webkitAudioContext;n&&(this.audioContext=new n,this.audioGain=this.audioContext.createGain(),this.audioGain.gain.setValueAtTime(1,this.audioContext.currentTime));let r=new Audio;if(r.canPlayType(`audio/mpeg`)!==`no`&&r.canPlayType(`audio/mpeg`)!==``?this.audioExtension=`mp3`:this.audioExtension=`m4a`,this._isURLGateEnable=e.urlGateEnable,this._isClassicModeEnable=e.classicModeEnable,this._mainCallCounter=0,this._animationCounter=0,this._statusPressCounter=new x(0,0,0,0),e.audioDir?e.audioDir[e.audioDir.length-1]!==`/`&&(e.audioDir+=`/`):e.audioDir=`./audio/`,this._audioDirectory=e.audioDir,this._bottomButtonType=e.useGoToWwa?T.GOTO_WWA:T.BATTLE_REPORT,this._userVarNameList=[],this.evalCalcWwaNodeGenerator=new As(this),this.userDevice=new M,location.href.match(/^file/))switch(this.userDevice.device){case re.GAME:switch(this.userDevice.os){case ne.NINTENDO:R.BATTLE_INTERVAL_FRAME_NUM=5;break}this._bottomButtonType=T.GAME_END;break;default:alert(`【警告】直接HTMLファイルを開いているようです。
|
|
95
95
|
このプログラムは正常に動作しない可能性があります。
|
|
96
96
|
マップデータの確認を行う場合には同梱の「wwa-server.exe」をご利用ください。
|
|
97
97
|
`+(this.userDevice.browser===ie.FIREFOX?`Firefoxの場合も、バージョン68以降はローカルのHTMLファイルを直接開いた場合、通常起動できないことを確認しております。`:``));break}switch(this.userDevice.device){case re.VR:case re.GAME:this._usePassword=!1;break;default:this._usePassword=!0;break}switch(U(`cell-save`).textContent=he.QUICK_SAVE,this._usePassword?U(`cell-load`).textContent=he.PASSWORD:U(`cell-load`).textContent=he.EMPTY_LOAD,this._bottomButtonType){case T.GOTO_WWA:U(`cell-gotowwa`).textContent=he.GOTO_WWA;break;case T.BATTLE_REPORT:U(`cell-gotowwa`).textContent=he.BATTLE_REPORT;break;case T.GAME_END:U(`cell-gotowwa`).textContent=he.GAME_END;break}let i=performance.now();console.log(`WWA のロード処理を開始します`),Promise.all([new Promise(async n=>{let r=performance.now();console.log(`(A-1) マップデータ ${e.mapdata} のロードを開始します`);let i=new $i,a=t=>{i.removeListener(`mapData`,a),i.removeListener(`progress`,o),i.removeListener(`error`,s),console.log(`(A-1) マップデータ ${e.mapdata} のロードが完了しました (${performance.now()-r}ms)`),n(t)},o=e=>this._setProgressBar(e),s=e=>{throw this._setErrorMessage(`下記のエラーが発生しました。:
|
|
@@ -107,7 +107,7 @@ ${t?Fe():``}
|
|
|
107
107
|
※変数表示が有効になっています。
|
|
108
108
|
公開前に必ずHTMLファイル内の
|
|
109
109
|
data-wwa-display-user-vars="true"
|
|
110
|
-
を消してください。`),this._messageWindow.setMessage(n),this._messageWindow.show(),this._setProgressBar(_c(4,4,_e.GAME_INIT));var i=setInterval(()=>{this._keyStore.update(),this._gamePadStore.update(),this._virtualPadStore.update(),this._yesNoJudgeInNextFrame===k.UNSELECTED&&(this._keyStore.getKeyState(V.KEY_ENTER)===B.KEYDOWN||this._keyStore.getKeyState(V.KEY_Y)===B.KEYDOWN||this._gamePadStore.buttonTrigger(H.BUTTON_INDEX_A)||this._virtualPadStore.checkTouchButton(`BUTTON_ENTER`)?this._yesNoJudgeInNextFrame=k.YES:(this._keyStore.getKeyState(V.KEY_N)===B.KEYDOWN||this._keyStore.getKeyState(V.KEY_ESC)===B.KEYDOWN||this._gamePadStore.buttonTrigger(H.BUTTON_INDEX_B)||this._virtualPadStore.checkTouchButton(`BUTTON_ESC`))&&(this._yesNoJudgeInNextFrame=k.NO)),this._yesNoJudgeInNextFrame===k.YES?(clearInterval(i),this._messageWindow.update(),this._yesNoJudge=this._yesNoJudgeInNextFrame,this._messageWindow.setInputDisable(),setTimeout(()=>{this._player.setDelayFrame(),this._messageWindow.hide(),this._yesNoJudge=k.UNSELECTED,this._yesNoJudgeInNextFrame=k.UNSELECTED,this._isLoadedSound=!0,this._setLoadingMessage(t,_e.AUDIO),this.loadSound().then(()=>window.requestAnimationFrame(this.soundCheckCaller))},R.YESNO_PRESS_DISP_FRAME_NUM*R.DEFAULT_FRAME_INTERVAL)):this._yesNoJudgeInNextFrame===k.NO&&(clearInterval(i),this._messageWindow.update(),this._yesNoJudge=this._yesNoJudgeInNextFrame,this._messageWindow.setInputDisable(),setTimeout(()=>{this._player.setDelayFrame(),this._messageWindow.hide(),this._yesNoJudge=k.UNSELECTED,this._yesNoJudgeInNextFrame=k.UNSELECTED,this._isLoadedSound=!1,this.openGameWindow()},R.YESNO_PRESS_DISP_FRAME_NUM*R.DEFAULT_FRAME_INTERVAL))},R.DEFAULT_FRAME_INTERVAL)}else clearInterval(i),this._player.setDelayFrame(),this._messageWindow.hide(),this._yesNoJudge=k.UNSELECTED,this._yesNoJudgeInNextFrame=k.UNSELECTED,this._isLoadedSound=!0,this.loadSound().then(()=>window.requestAnimationFrame(this.soundCheckCaller))}),console.log(`WWA_START`),this.wwaCustomEvent(`wwa_start`);let d=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_WWA_START;if(d)try{this.evalCalcWwaNodeGenerator.evalWwaNode(d)}catch(e){alert(`CALL_WWA_START でエラーが発生しました。\n\n詳細:\n${e.message}`),console.error(e.message)}})}setEvalCalcWwaNodeEarnedItem(e,t){this.evalCalcWwaNodeGenerator.setEarnedItem(e,t)}clearEvalCalcWwaNodeEarnedItem(){this.evalCalcWwaNodeGenerator.clearEarnedItem()}callGetItemUserDefineFunction(){let e=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_GET_ITEM;e&&this.evalCalcWwaNodeGenerator.evalWwaNode(e)}callGetItemFullUserDefineFunction(){let e=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_GET_ITEM_FULL;e&&this.evalCalcWwaNodeGenerator.evalWwaNode(e)}callUseItemUserDefineFunction(){let e=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_USE_ITEM;e&&this.evalCalcWwaNodeGenerator.evalWwaNode(e)}callJumpGateUserDefineFunction(){let e=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_JUMPGATE;e&&this.evalCalcWwaNodeGenerator.evalWwaNode(e)}callUserDefinedBattleDamageFunction(e,t){let n=this.getUserDefinedDamageFunctionNode(e);if(n){this.evalCalcWwaNodeGenerator.setBattleDamageCalculationMode(t);try{let{isGameOver:t,value:r}=this.evalCalcWwaNodeGenerator.evalWwaNode(n);if(t)throw Error(`戦闘予測関数でゲームオーバーが発生しました。戦闘予測関数でプレイヤー生命力を操作しないでください。`);let i=this.evalCalcWwaNodeGenerator.state.battleDamageCalculation.aborted;return this.evalCalcWwaNodeGenerator.clearBattleDamageCalculationMode(),i?{damage:0,aborted:i}:typeof r==`number`?{damage:this.toAssignableValue(r),aborted:i}:(console.warn(`${e} のダメージ計算結果が数値になりませんでした。(結果: ${r})。このターンのダメージは無効になります。`),{damage:0,aborted:i})}catch(t){return console.warn(`${e} のダメージ計算中にエラーが発生しました。このターンのダメージは無効になります。`),console.warn(t),{damage:0,hasError:!0}}}}getUserDefinedDamageFunctionNode(e){return this.userDefinedFunctions?.[{playerToEnemy:`CALC_PLAYER_TO_ENEMY_DAMAGE`,enemyToPlayer:`CALC_ENEMY_TO_PLAYER_DAMAGE`}[e]]}callMoveUserDefineFunction(){let e=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_MOVE;if(e){let{isGameOver:t}=this.evalCalcWwaNodeGenerator.evalWwaNode(e);return{isGameOver:t}}return{}}callCameraMoveUserDefineFunction(){let e=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_CAMERA_MOVE;e&&this.evalCalcWwaNodeGenerator.evalWwaNode(e)}getUserScript(e){return this.userDefinedFunctions&&this.userDefinedFunctions[e]||null}setUserScript(e){if(e.kind!==`data`){console.error(e);return}this.convertWwaNodes(e.data).forEach(e=>{if(e.type===`UserDefinedFunction`&&this.userDefinedFunctions){let t=e.functionName;this.userDefinedFunctions[t]=e.body}})}callUserScript(e){let t=this.getUserScript(e);t&&this.evalCalcWwaNodeGenerator.evalWwaNode(t)}setUserVarStatus(e,t){if(e){if(e.kind===`noFileSpecified`){this._varDump?.numberedUserVariable.updateInformation(e.errorMessage,!1);return}if(e.kind!==`data`){this._userVarNameListRequestError=e,this._varDump?.numberedUserVariable.updateInformation(this._userVarNameListRequestError.errorMessage,!0);return}if(!e.data||typeof e.data!=`object`){this._userVarNameListRequestError={kind:`notObject`,errorMessage:`ユーザ変数一覧 ${t} が正しい形式で書かれていません。`},this._varDump?.numberedUserVariable.updateInformation(this._userVarNameListRequestError.errorMessage,!0);return}this._userVarNameList=this.convertUserVariableNameListToArray(e.data),this._varDump?.numberedUserVariable.updateLabels(this._userVarNameList)}}convertUserVariableNameListToArray(e){let t=Array(R.USER_VAR_NUM);for(let e=0;e<R.USER_VAR_NUM;e++)t[e]=void 0;return Object.keys(e).forEach(n=>{let r=parseInt(n,10);typeof e[n]!=`string`||typeof n!=`string`||isNaN(r)||r<0||r>=R.USER_VAR_NUM||(t[r]=e[n])}),t}_setProgressBar(e){this._hasTitleImg&&(e.stage<=R.LOAD_STAGE_MAX_EXCEPT_AUDIO?(U(`progress-message-container`).textContent=e.stage===R.LOAD_STAGE_MAX_EXCEPT_AUDIO?`World Name: `+this._wwaData.worldName:ve[e.stage],U(`progress-bar`).style.width=(1*e.stage+e.current/e.total*1)/(R.LOAD_STAGE_MAX_EXCEPT_AUDIO+1)*R.MAP_WINDOW_WIDTH+`px`,U(`progress-disp`).textContent=((1*e.stage+e.current/e.total*1)/(R.LOAD_STAGE_MAX_EXCEPT_AUDIO+1)*100).toFixed(2)+`%`):(this._usePassword?U(`progress-message-container`).textContent=`効果音/BGMを読み込んでいます。(スペースキーでスキップ)`:U(`progress-message-container`).textContent=`ゲームデータを読み込んでいます。`,U(`progress-bar-audio`).style.width=e.current*R.MAP_WINDOW_WIDTH/e.total+`px`,U(`progress-disp`).textContent=(e.current/e.total*100).toFixed(2)+`%`))}_setLoadingMessage(e,t){if(!this._hasTitleImg)if(t<=0)e.font=be.TITLE+`px `+R.LOADING_FONT,e.fillText(ye[0],z.TITLE_X,z.TITLE_Y),e.font=be.FOOTER+`px `+R.LOADING_FONT,e.fillText(`WWA Wing Ver.4.0.
|
|
110
|
+
を消してください。`),this._messageWindow.setMessage(n),this._messageWindow.show(),this._setProgressBar(_c(4,4,_e.GAME_INIT));var i=setInterval(()=>{this._keyStore.update(),this._gamePadStore.update(),this._virtualPadStore.update(),this._yesNoJudgeInNextFrame===k.UNSELECTED&&(this._keyStore.getKeyState(V.KEY_ENTER)===B.KEYDOWN||this._keyStore.getKeyState(V.KEY_Y)===B.KEYDOWN||this._gamePadStore.buttonTrigger(H.BUTTON_INDEX_A)||this._virtualPadStore.checkTouchButton(`BUTTON_ENTER`)?this._yesNoJudgeInNextFrame=k.YES:(this._keyStore.getKeyState(V.KEY_N)===B.KEYDOWN||this._keyStore.getKeyState(V.KEY_ESC)===B.KEYDOWN||this._gamePadStore.buttonTrigger(H.BUTTON_INDEX_B)||this._virtualPadStore.checkTouchButton(`BUTTON_ESC`))&&(this._yesNoJudgeInNextFrame=k.NO)),this._yesNoJudgeInNextFrame===k.YES?(clearInterval(i),this._messageWindow.update(),this._yesNoJudge=this._yesNoJudgeInNextFrame,this._messageWindow.setInputDisable(),setTimeout(()=>{this._player.setDelayFrame(),this._messageWindow.hide(),this._yesNoJudge=k.UNSELECTED,this._yesNoJudgeInNextFrame=k.UNSELECTED,this._isLoadedSound=!0,this._setLoadingMessage(t,_e.AUDIO),this.loadSound().then(()=>window.requestAnimationFrame(this.soundCheckCaller))},R.YESNO_PRESS_DISP_FRAME_NUM*R.DEFAULT_FRAME_INTERVAL)):this._yesNoJudgeInNextFrame===k.NO&&(clearInterval(i),this._messageWindow.update(),this._yesNoJudge=this._yesNoJudgeInNextFrame,this._messageWindow.setInputDisable(),setTimeout(()=>{this._player.setDelayFrame(),this._messageWindow.hide(),this._yesNoJudge=k.UNSELECTED,this._yesNoJudgeInNextFrame=k.UNSELECTED,this._isLoadedSound=!1,this.openGameWindow()},R.YESNO_PRESS_DISP_FRAME_NUM*R.DEFAULT_FRAME_INTERVAL))},R.DEFAULT_FRAME_INTERVAL)}else clearInterval(i),this._player.setDelayFrame(),this._messageWindow.hide(),this._yesNoJudge=k.UNSELECTED,this._yesNoJudgeInNextFrame=k.UNSELECTED,this._isLoadedSound=!0,this.loadSound().then(()=>window.requestAnimationFrame(this.soundCheckCaller))}),console.log(`WWA_START`),this.wwaCustomEvent(`wwa_start`);let d=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_WWA_START;if(d)try{this.evalCalcWwaNodeGenerator.evalWwaNode(d)}catch(e){alert(`CALL_WWA_START でエラーが発生しました。\n\n詳細:\n${e.message}`),console.error(e.message)}})}setEvalCalcWwaNodeEarnedItem(e,t){this.evalCalcWwaNodeGenerator.setEarnedItem(e,t)}clearEvalCalcWwaNodeEarnedItem(){this.evalCalcWwaNodeGenerator.clearEarnedItem()}callGetItemUserDefineFunction(){let e=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_GET_ITEM;e&&this.evalCalcWwaNodeGenerator.evalWwaNode(e)}callGetItemFullUserDefineFunction(){let e=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_GET_ITEM_FULL;e&&this.evalCalcWwaNodeGenerator.evalWwaNode(e)}callUseItemUserDefineFunction(){let e=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_USE_ITEM;e&&this.evalCalcWwaNodeGenerator.evalWwaNode(e)}callJumpGateUserDefineFunction(){let e=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_JUMPGATE;e&&this.evalCalcWwaNodeGenerator.evalWwaNode(e)}callUserDefinedBattleDamageFunction(e,t){let n=this.getUserDefinedDamageFunctionNode(e);if(n){this.evalCalcWwaNodeGenerator.setBattleDamageCalculationMode(t);try{let{isGameOver:t,value:r}=this.evalCalcWwaNodeGenerator.evalWwaNode(n);if(t)throw Error(`戦闘予測関数でゲームオーバーが発生しました。戦闘予測関数でプレイヤー生命力を操作しないでください。`);let i=this.evalCalcWwaNodeGenerator.state.battleDamageCalculation.aborted;return this.evalCalcWwaNodeGenerator.clearBattleDamageCalculationMode(),i?{damage:0,aborted:i}:typeof r==`number`?{damage:this.toAssignableValue(r),aborted:i}:(console.warn(`${e} のダメージ計算結果が数値になりませんでした。(結果: ${r})。このターンのダメージは無効になります。`),{damage:0,aborted:i})}catch(t){return console.warn(`${e} のダメージ計算中にエラーが発生しました。このターンのダメージは無効になります。`),console.warn(t),{damage:0,hasError:!0}}}}getUserDefinedDamageFunctionNode(e){return this.userDefinedFunctions?.[{playerToEnemy:`CALC_PLAYER_TO_ENEMY_DAMAGE`,enemyToPlayer:`CALC_ENEMY_TO_PLAYER_DAMAGE`}[e]]}callMoveUserDefineFunction(){let e=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_MOVE;if(e){let{isGameOver:t}=this.evalCalcWwaNodeGenerator.evalWwaNode(e);return{isGameOver:t}}return{}}callCameraMoveUserDefineFunction(){let e=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_CAMERA_MOVE;e&&this.evalCalcWwaNodeGenerator.evalWwaNode(e)}getUserScript(e){return this.userDefinedFunctions&&this.userDefinedFunctions[e]||null}setUserScript(e){if(e.kind!==`data`){console.error(e);return}this.convertWwaNodes(e.data).forEach(e=>{if(e.type===`UserDefinedFunction`&&this.userDefinedFunctions){let t=e.functionName;this.userDefinedFunctions[t]=e.body}})}callUserScript(e){let t=this.getUserScript(e);t&&this.evalCalcWwaNodeGenerator.evalWwaNode(t)}setUserVarStatus(e,t){if(e){if(e.kind===`noFileSpecified`){this._varDump?.numberedUserVariable.updateInformation(e.errorMessage,!1);return}if(e.kind!==`data`){this._userVarNameListRequestError=e,this._varDump?.numberedUserVariable.updateInformation(this._userVarNameListRequestError.errorMessage,!0);return}if(!e.data||typeof e.data!=`object`){this._userVarNameListRequestError={kind:`notObject`,errorMessage:`ユーザ変数一覧 ${t} が正しい形式で書かれていません。`},this._varDump?.numberedUserVariable.updateInformation(this._userVarNameListRequestError.errorMessage,!0);return}this._userVarNameList=this.convertUserVariableNameListToArray(e.data),this._varDump?.numberedUserVariable.updateLabels(this._userVarNameList)}}convertUserVariableNameListToArray(e){let t=Array(R.USER_VAR_NUM);for(let e=0;e<R.USER_VAR_NUM;e++)t[e]=void 0;return Object.keys(e).forEach(n=>{let r=parseInt(n,10);typeof e[n]!=`string`||typeof n!=`string`||isNaN(r)||r<0||r>=R.USER_VAR_NUM||(t[r]=e[n])}),t}_setProgressBar(e){this._hasTitleImg&&(e.stage<=R.LOAD_STAGE_MAX_EXCEPT_AUDIO?(U(`progress-message-container`).textContent=e.stage===R.LOAD_STAGE_MAX_EXCEPT_AUDIO?`World Name: `+this._wwaData.worldName:ve[e.stage],U(`progress-bar`).style.width=(1*e.stage+e.current/e.total*1)/(R.LOAD_STAGE_MAX_EXCEPT_AUDIO+1)*R.MAP_WINDOW_WIDTH+`px`,U(`progress-disp`).textContent=((1*e.stage+e.current/e.total*1)/(R.LOAD_STAGE_MAX_EXCEPT_AUDIO+1)*100).toFixed(2)+`%`):(this._usePassword?U(`progress-message-container`).textContent=`効果音/BGMを読み込んでいます。(スペースキーでスキップ)`:U(`progress-message-container`).textContent=`ゲームデータを読み込んでいます。`,U(`progress-bar-audio`).style.width=e.current*R.MAP_WINDOW_WIDTH/e.total+`px`,U(`progress-disp`).textContent=(e.current/e.total*100).toFixed(2)+`%`))}_setLoadingMessage(e,t){if(!this._hasTitleImg)if(t<=0)e.font=be.TITLE+`px `+R.LOADING_FONT,e.fillText(ye[0],z.TITLE_X,z.TITLE_Y),e.font=be.FOOTER+`px `+R.LOADING_FONT,e.fillText(`WWA Wing Ver.4.0.22`,z.FOOTER_X,z.COPYRIGHT_Y);else if(t<=ye.length)e.font=be.LOADING+`px `+R.LOADING_FONT,t>=2&&(e.clearRect(z.LOADING_X,z.LOADING_Y+z.LINE*(t-3),R.SCREEN_WIDTH-z.LOADING_X,z.LINE),e.fillText(ye[t-1]+` Complete!`,z.LOADING_X,z.LOADING_Y+z.LINE*(t-2))),t<ye.length&&e.fillText(ye[t],z.LOADING_X,z.LOADING_Y+z.LINE*(t-1)),t==1&&(e.font=be.FOOTER+`px `+R.LOADING_FONT,e.fillText(`World Name `+this._wwaData.worldName,z.FOOTER_X,z.WORLD_Y),e.fillText(` (Map data Ver. `+Math.floor(this._wwaData.version/10)+`.`+this._wwaData.version%10+`)`,z.FOOTER_X,z.WORLD_Y+z.LINE));else{var n=this._isSkippedSoundMessage?z.LOADING_Y+z.LINE*(ye.length-1):z.FOOTER_Y;t<=_e.AUDIO?e.fillText(`Now Sound data Loading .....`,z.LOADING_X,n):(e.clearRect(z.LOADING_X,n-z.LINE,R.SCREEN_WIDTH-z.LOADING_X,z.LINE),e.fillText(`Now Sound data Loading ..... Complete!`,z.LOADING_X,n))}}_setErrorMessage(e,t){this._hasTitleImg?alert(e):(t.clearRect(0,0,R.SCREEN_WIDTH,R.SCREEN_HEIGHT),t.font=be.ERRROR+`px `+R.LOADING_FONT,e.split(`
|
|
111
111
|
`).forEach(function(e,n){t.fillText(e,z.ERROR_X,z.ERROR_Y+z.LINE*n)}))}createSoundInstance(e){if(e===0||e===p.NO_SOUND||this._soundMap?.has(e))return;let t=`${this._audioDirectory}${e}.${this.audioExtension}`;this._soundMap.set(e,new Qi(e,t,this.audioContext,this.audioGain))}async loadSound(){this._soundMap=new Map,console.log(`(D) サウンドのロードを開始します。`),console.log(`(D-1) システムサウンドのロードを開始します。`),this.createSoundInstance(p.DECISION),this.createSoundInstance(p.ATTACK),console.log(`(D-2) 背景パーツ記載のサウンドのロードを開始します。`);for(let e=1;e<this._wwaData.mapPartsMax;e++){let t=this._wwaData.mapAttribute[e][R.ATR_SOUND];this.createSoundInstance(t)}console.log(`(D-3) 物体パーツ記載のサウンドのロードを開始します。`);for(let e=1;e<this._wwaData.objPartsMax;e++){if(this._wwaData.objectAttribute[e][R.ATR_TYPE]===R.OBJECT_RANDOM)continue;let t=this._wwaData.objectAttribute[e][R.ATR_SOUND];this.createSoundInstance(t)}console.log(`(D-4) $sound マクロ記載のサウンドのロードを開始します。`),this._wwaData.message.forEach(e=>e.split(`
|
|
112
112
|
`).forEach(e=>{let t=e.match(/^\$sound=(\d+)/);if(!t||t.length<2)return;let n=parseInt(t[1],10);!isNaN(n)&&0<n&&n<p.NO_SOUND&&this.createSoundInstance(n)})),console.log(`(D-4) マップから抽出したサウンド番号一覧:`,Array.from(this._soundMap.keys())),await this.loadCustomSound(),console.log(`(D-6) 次のサウンドがロードされます:`,Array.from(this._soundMap.keys()).sort((e,t)=>typeof e==`number`?typeof t==`number`?e-t:-1:typeof t==`number`?1:e.localeCompare(t))),this._wwaData.bgm=0,this._soundLoadSkipFlag=!1}async loadCustomSound(){let e=this._audioDirectory+`sound-list.json`;console.log(`(D-5) サウンドリストファイル: ${e} の解析を開始します。`);let t=await Vn(e);if(t?.kind!==`data`||!Array.isArray(t.data)){console.warn(`(D-5) カスタムオーディオファイルのリストの取得に失敗しました。リストファイルが存在するか、正しい形式で書かれているかを確認してください。 (リストファイル: ${e})`);return}t.data.forEach(e=>{switch(typeof e){case`number`:this.createSoundInstance(e);return;case`string`:{if(e.startsWith(`#`))return;let t=Number(e);if(e.includes(`/`)||e.includes(`\\`)||t<=0||t>2**53-1||t==p.NO_SOUND){console.warn(`(D-5) 無効なサウンドIDが指定されました: ${e}`);return}if(!Number.isNaN(t)){console.warn(`(D-5) 文字列で数値のサウンドIDが与えられました。数値として解釈します。 (指定されたサウンドID: `+e+`)`),this.createSoundInstance(t);return}this.createSoundInstance(e);return}case`object`:if(!e)return;if(Array.isArray(e)){if(e.length!==2){console.warn(`(D-5) 配列形式でサウンドIDを与える場合は2要素で与えてください: ${JSON.stringify(e)}`);return}try{e.forEach(t=>{if(typeof t!=`number`||t<=0||t>2**53-1)throw Error(`(D-5) 無効なサウンドIDが指定されました: ${JSON.stringify(e)}`)})}catch(e){console.warn(e.message);return}let[t,n]=e;if(t>n){console.warn(`(D-5) サウンドIDが配列形式で与えられていますが、from (${t}) が to (${n}) より大きくなっています: ${JSON.stringify(e)}`);return}for(let e=t;e<=n;e++){if(e==p.NO_SOUND){console.warn(`(D-5) サウンドID ${e} が範囲に含まれていますが、これは停止用に使用している値で無効なのでスキップします。`);continue}this.createSoundInstance(e)}return}console.warn(`(D-5) サウンドIDがオブジェクトのようですが、現在この記法はサポートされていません: ${JSON.stringify(e)}`);return;default:console.warn(`(D-5) この形式のサウンドIDはサポートされていません: ${e}`);return}})}checkAllSoundLoaded(){if(!this._soundMap)return;let e=0,t=0;if(!this._hasTitleImg)var n=this._cvsCover.getContext(`2d`);if(this._keyStore.update(),this._keyStore.getKeyState(V.KEY_SPACE)===B.KEYDOWN&&(this._soundLoadSkipFlag=!0),this._soundMap.forEach(n=>{!n||n.isError()||(t++,n.hasData()&&e++)}),e<t&&!this._soundLoadSkipFlag){this._setProgressBar(_c(e,t,_e.AUDIO)),window.requestAnimationFrame(this.soundCheckCaller);return}if(this._setProgressBar(_c(R.SOUND_MAX,R.SOUND_MAX,_e.AUDIO)),this._setLoadingMessage(n,_e.FINISH),this._soundLoadSkipFlag){let e=Array.from(this._soundMap.entries());console.warn(`(D-7) サウンドのロードがスキップされました。現時点でエラーでない以下のサウンドはバックグラウンドで引き続きロードを試みます:`,e.filter(([e,t])=>!t.hasData()&&!t.isError()).map(([e,t])=>e))}else console.log(`(D-7) サウンドのロードが完了しました。`);this.openGameWindow()}_setSoundLoadedCheckTimer(e){let t=this._soundMap?.get(e);!t||t.isError()||(this.soundLoadedCheckTimer=window.setInterval(()=>{this._wwaData.bgm===e?t.hasData()?(t.play(this._wwaData.bgmDelayDurationMs),this._wwaData.bgm=e,this._clearSoundLoadedCheckTimer()):t.isError()&&this._clearSoundLoadedCheckTimer():this._clearSoundLoadedCheckTimer()},100))}_clearSoundLoadedCheckTimer(){this.soundLoadedCheckTimer&&=(clearInterval(this.soundLoadedCheckTimer),void 0)}getSoundEnabled(){return this._isLoadedSound}stopBgm(){let e=this._soundMap?.get(this._wwaData.bgm);e?.isPlaying()&&e.pause(),this._wwaData.bgm=0}stopSound(e,t){if(this.soundIsBgm(e)){t.includeBgm&&this._wwaData.bgm===e&&this.stopBgm();return}let n=this._soundMap?.get(e);n?.isPlaying()&&n.pause()}stopAllSound(e){this._soundMap?.keys().forEach(t=>this.stopSound(t,e))}playSound(e,t={}){let n=this.soundIsBgm(e),r=t.loopPlaying===void 0?n:t.loopPlaying;if(!this._isLoadedSound){e===p.NO_SOUND?this._wwaData.bgm=0:n&&(this._wwaData.bgm=r?e:0);return}if(typeof e==`number`&&(e<0||e>=R.SOUND_MAX)){console.warn(`サウンド番号が範囲外です。`);return}if(n&&this._wwaData.bgm===e||((e===p.NO_SOUND||n)&&this._wwaData.bgm!==0&&this.stopBgm(),e===0||e===p.NO_SOUND))return;let i=this._soundMap?.get(e);if(!i){console.warn(`サウンドID ${e} は、マップデータにも ${this._audioDirectory}sound-list.json にも出現しないため、再生できません。`);return}i.hasData()?n?(i?.play(t.bgmDelayDurationMs??this._wwaData.bgmDelayDurationMs,r,()=>{e===this._wwaData.bgm&&!r&&(this._wwaData.bgm=0)}),this._wwaData.bgm=e):i?.play(0,r):n&&(this._wwaData.bgm=r?e:0,this._setSoundLoadedCheckTimer(e))}playDecisionSound(){this.playSound(this._wwaData.decisionSound??p.DECISION)}playAttackSound(){this.playSound(this._wwaData.attackSound??p.ATTACK)}setDecisionSound(e){if(this.soundIsBgm(e)){console.warn(`決定音にBGMを設定することはできません。`);return}this._wwaData.decisionSound=e}setAttackSound(e){if(this.soundIsBgm(e)){console.warn(`攻撃音にBGMを設定することはできません。`);return}this._wwaData.attackSound=e}soundIsBgm(e){switch(typeof e){case`number`:return e>=p.BGM_LB;case`string`:return e.match(/^bgm_/i)!==null;default:throw TypeError(`Invalid soundId type: ${typeof e}`)}}openGameWindow(){var e=this._player.getPosition();U(`wwa-cover`).style.opacity=`0`,this.getObjectIdByPosition(e)!==0&&this._player.setPartsAppearedFlag();var t=U(`wwa-wrapper`).getAttribute(`data-wwa-resume-savedata`);if(typeof t==`string`&&(this._useSuspend=!0,t)){var n=zi.getStartWWAData(t);this._restartData!==n&&(this._applyQuickLoad(n),this._wwaSave.resumeStart())}setTimeout(()=>{U(`wwa-wrapper`).removeChild(U(`wwa-cover`)),requestAnimationFrame(this.mainCaller.bind(this))},R.SPLASH_SCREEN_DISP_MILLS)}onselectitem(e){if(this._player.canUseItem(e)){U(`item`+(e-1)).classList.add(`onpress`),this.playDecisionSound();let r=this.resolveSystemMessage(g.CONFIRM_USE_ITEM);if(r===`BLANK`){this._player.readyToUseItem(e);var t=this._player.useItem(),n=this.getObjectAttributeById(t,R.ATR_STRING);this.registerPageByMessage(this.getMessageById(n),{showChoice:!1,isSystemMessage:!1,triggerParts:{id:t,type:j.OBJECT,position:this._player.getPosition().getPartsCoord()}})}else this.registerPageByMessage(r,{showChoice:!0,isSystemMessage:!0}),this._yesNoChoiceCallInfo=N.CALL_BY_ITEM_USE,this._yesNoUseItemPos=e;return!0}return!1}onselectbutton(e,t=!1,n=!1){var r=U(F[e]);if(this.playDecisionSound(),this._itemMenu.close(),r.classList.add(`onpress`),e===P.QUICK_LOAD)switch(this._yesNoChoiceCallInfo=this._wwaSave.getFirstSaveChoiceCallInfo(t),this._yesNoChoiceCallInfo){case N.CALL_BY_QUICK_LOAD:case N.CALL_BY_LOG_QUICK_LOAD:var i,a=``;switch(this._yesNoChoiceCallInfo){case N.CALL_BY_QUICK_LOAD:a=`読み込むデータを選んでください。`,this._wwaSave.selectDBSaveDataList();break;case N.CALL_BY_LOG_QUICK_LOAD:a=`読み込むオートセーブを選んでください。`,this._wwaSave.selectLogSaveDataList();break}switch(i=this._wwaSave.getSecondSaveChoiceCallInfo(this._usePassword),this._messageWindow.createSaveDom(),i){case N.CALL_BY_LOG_QUICK_LOAD:this.registerSystemMessagePage(a+`
|
|
113
113
|
→Noでオートセーブ復帰画面に移ります。`,!0);break;case N.CALL_BY_PASSWORD_LOAD:this.registerSystemMessagePage(a+`
|
|
@@ -126,7 +126,7 @@ ${t?Fe():``}
|
|
|
126
126
|
JSON PARSE FAILED`)}if(r.isCompress){delete r.isCompress;let[e,t]=zi.decompress(r);return[Gi(e),t]}else return[r,{isWorldNameEmpty:!1}]}_quickLoad(e=!1,t=null,n=!0){if(!e&&this._wwaSave.hasSaveData()===void 0&&t===null)throw Error(`セーブデータがありません。`);let r,i=!1;if(t!==null){let e=this._decodePassword(t);r=e[0],i=e[1].isWorldNameEmpty}else r=structuredClone(e?this._restartData:this._messageWindow.load());if(r.message=structuredClone(this._restartData.message),r.mapAttribute=structuredClone(this._restartData.mapAttribute),r.objectAttribute=structuredClone(this._restartData.objectAttribute),r.map===void 0&&(r.map=this._decompressMap(r.mapCompressed)),r.mapObject===void 0&&(r.mapObject=this._decompressMap(r.mapObjectCompressed)),delete r.mapCompressed,delete r.mapObjectCompressed,t!==null){if(!i&&r.worldName!==this._wwaData.worldName)throw console.error(`Invalid title`,`(password)=${r.worldName} (current map)=${this._wwaData.worldName}`),Error(`前回パスワード取得時から、制作者によってワールド名が変更されたためロードできませんでした。
|
|
127
127
|
予めご了承ください。`);let e=this.checkOriginalMapString;if(this._isDisallowLoadOldSave&&r.checkOriginalMapString!==e)throw console.error(`Invalid hash`,`(password)=${r.checkOriginalMapString} (current map)=${e}`),Error(`前回パスワード取得時から、制作者によってマップが変更されたためロードできませんでした。
|
|
128
128
|
(マップデータ制作者の設定により、内容が変更されると以前のパスワードは利用できなくなります。)
|
|
129
|
-
予めご了承ください。`);console.log(`Valid Password!`)}return n&&this._applyQuickLoad(r),r}_applyQuickLoad(e){this._userVar.named=e.userNamedVar,this._userVar.numbered=e.userVar,this._player.setEnergyMax(e.statusEnergyMax),this._player.setEnergy(e.statusEnergy),this._player.setStrength(e.statusStrength),this._player.setDefence(e.statusDefence),this._player.setGold(e.statusGold),this._player.setMoveCount(e.moves),this._player.setFrameCount(e.frameCount),this._player.clearItemBox();for(var t=0;t<e.itemBox.length;t++)this._player.addItem(e.itemBox[t],t+1,!0);this._player.systemJumpTo(new C(this,e.playerX,e.playerY,0,0)),e.bgm===0?this.playSound(p.NO_SOUND):this.playSound(e.bgm,{bgmDelayDurationMs:e.bgmDelayDurationMs}),this.setImgClick(new S(e.imgClickX,e.imgClickY)),this.getObjectIdByPosition(this._player.getPosition())!==0&&this._player.setPartsAppearedFlag(),this._clearAllRequests(),this._playTimeCalculator=new Oe(e.playTime),this._wwaData=e,this._mapIDTableCreate(),this._replaceAllRandomObjects(),this.setStatusIconCoord(L.ENERGY,new S(e.imgStatusEnergyX,e.imgStatusEnergyY)),this.setStatusIconCoord(L.STRENGTH,new S(e.imgStatusStrengthX,e.imgStatusStrengthY)),this.setStatusIconCoord(L.DEFENCE,new S(e.imgStatusDefenceX,e.imgStatusDefenceY)),this.setStatusIconCoord(L.GOLD,new S(e.imgStatusGoldX,e.imgStatusGoldY)),this.setWideCellCoord(new S(e.imgWideCellX,e.imgWideCellY)),this.setItemboxBackgroundPosition({x:e.imgItemboxX,y:e.imgItemboxY}),this.setFrameCoord(new S(e.imgFrameX,e.imgFrameY)),this.setPlayerSpeedIndex(e.gameSpeedIndex),this.updateCSSRule(),this.updateEffect(),this._cgManager.restorePictures(this._wwaData.pictureRegistry),this.updateAllPicturesCache(),this._player.updateStatusValueBox(),this._wwaSave.quickSaveButtonUpdate(this._wwaData)}_mapIDTableCreate(){var e;for(this._mapIDTable=[],this._mapObjectIDTable=[],e=0;e<this._wwaData.mapPartsMax;e++)this._mapIDTable[e]=[];for(e=0;e<this._wwaData.objPartsMax;e++)this._mapObjectIDTable[e]=[];for(var t=0;t<this._wwaData.mapWidth;t++)for(var n=0;n<this._wwaData.mapWidth;n++){var r=n<<Ce.BITSHIFT|t;e=this._wwaData.map[n][t],this._mapIDTable[e]instanceof Array||(this._mapIDTable[e]=[]),this._mapIDTable[e].push(r),e=this._wwaData.mapObject[n][t],this._mapObjectIDTable[e]instanceof Array||(this._mapObjectIDTable[e]=[]),this._mapObjectIDTable[e].push(r)}}restartGame(){this._quickLoad(!0)}_fadeout(e){var t=0,n=R.MAP_WINDOW_WIDTH,r=R.FADEOUT_SPEED,i=U(`wwa-fader`);i.style.display=`block`;var a=setInterval(()=>{if(t+=r,n-=r*2,n<=0||t*2>R.MAP_WINDOW_WIDTH){i.removeAttribute(`style`),i.style.display=`block`,i.style.borderWidth=`0`,i.style.width=R.MAP_WINDOW_WIDTH+`px`,i.style.height=R.MAP_WINDOW_HEIGHT+`px`,i.style.backgroundColor=`#808080`,clearInterval(a),e();return}i.style.width=n+`px`,i.style.height=n+`px`,i.style.borderWidth=t+`px`},20)}moveObjects(e){var t=this._camera.getPosition();this._player.getPosition(),t.getPartsCoord();var n=t.getPartsCoord().x,r=t.getPartsCoord().y,i,a,o;if(!(this.getMapAttributeByPosition(this._player.getPosition(),R.ATR_TYPE)===R.MAP_LOCALGATE||this.getObjectAttributeByPosition(this._player.getPosition(),R.ATR_TYPE)===R.OBJECT_LOCALGATE)){for(i=Array(R.V_PARTS_NUM_IN_WINDOW+2),this.hoge=Array(R.V_PARTS_NUM_IN_WINDOW+2),o=-1;o<=R.V_PARTS_NUM_IN_WINDOW;o++)for(i[o+1]=Array(R.H_PARTS_NUM_IN_WINDOW+2),this.hoge[o+1]=Array(R.H_PARTS_NUM_IN_WINDOW+2),a=-1;a<=R.H_PARTS_NUM_IN_WINDOW;a++){if(r+o<0||r+o>=this._wwaData.mapWidth||n+a<0||n+a>=this._wwaData.mapWidth){i[o+1][a+1]=0,this.hoge[o+1][a+1]=0;continue}try{var s=new C(this,n+a,r+o,0,0),c=s.getPartsCoord()}catch{i[o+1][a+1]=0,this.hoge[o+1][a+1]=0;continue}this._wwaData.mapObject[c.y][c.x],i[o+1][a+1]=this._wwaData.mapObject[c.y][c.x],this.hoge[o+1][a+1]=-this._wwaData.mapObject[c.y][c.x]}for(a=-1;a<=R.H_PARTS_NUM_IN_WINDOW;a++)if(!(n+a<0||n+a>=this._wwaData.mapWidth)){for(o=-1;o<=R.V_PARTS_NUM_IN_WINDOW;o++)if(!(r+o<0||r+o>=this._wwaData.mapWidth)){try{var s=new C(this,n+a,r+o,0,0),c=s.getPartsCoord()}catch{continue}var l=this._wwaData.mapObject[c.y][c.x];if(!(l===0||this._wwaData.objectAttribute[l][R.ATR_MOVE]===se.STATIC||this._wwaData.objectAttribute[l][R.ATR_TYPE]===R.OBJECT_LOCALGATE||this._wwaData.objectAttribute[l][R.ATR_TYPE]===R.OBJECT_RANDOM)&&!(this._wwaData.objectAttribute[l][R.ATR_MOVE]!==se.CHASE_PLAYER&&this._wwaData.objectAttribute[l][R.ATR_MOVE]!==se.RUN_OUT&&this._wwaData.objectAttribute[l][R.ATR_MOVE]!==se.HANG_AROUND)){var u=this._wwaData.objectAttribute[l][R.ATR_MOVE];if(u!==se.HANG_AROUND){var d=this._getCandidateCoord(e,s,u),f=new S(d.x,c.y),p=new S(c.x,d.y),m=null,h;if(this._objectCanMoveTo(e,d,i))this._setObjectsInNextFrame(c,d,n,r,i,l);else{var g=this._getSecondCandidateMoveMode(e,c,d,f,p,this._wwaData.objectAttribute[l][R.ATR_TYPE]===R.OBJECT_MONSTER,i);g===ce.MODE_X?this._setObjectsInNextFrame(c,f,n,r,i,l):g===ce.MODE_Y?this._setObjectsInNextFrame(c,p,n,r,i,l):(m=this._getThirdCandidate(e,s,d,u,i),m!==null&&!this._wwaData.isOldMove?this._setObjectsInNextFrame(c,m,n,r,i,l):(h=this._getRandomMoveCoord(e,s,i),this._setObjectsInNextFrame(c,h,n,r,i,l)))}}else h=this._getRandomMoveCoord(e,s,i),this._setObjectsInNextFrame(c,h,n,r,i,l)}}}}}_getCandidateCoord(e,t,n){var r=t.getPartsCoord();this._player.getPosition().getOffsetCoord(),this._player.getPosition().getPartsCoord();try{var i=e?this._player.getPosition().getNextJustPosition().getPartsCoord():this._player.getPosition().getPartsCoord()}catch{throw Error(`予期せぬ方向への移動のようです。`)}var a=r.clone(),o=0,s=0;return n===se.CHASE_PLAYER?(o=r.x>i.x?-1:+(r.x<i.x),s=r.y>i.y?-1:+(r.y<i.y)):n===se.RUN_OUT&&(o=r.x>i.x?1:r.x<i.x?-1:0,s=r.y>i.y?1:r.y<i.y?-1:0),a.x+=o,a.y+=s,a.x=Math.min(this._wwaData.mapWidth-1,Math.max(0,a.x)),a.y=Math.min(this._wwaData.mapWidth-1,Math.max(0,a.y)),a}_getSecondCandidateMoveMode(e,t,n,r,i,a,o){return e&&((this._player.getDir()===E.UP||this._player.getDir()===E.DOWN)&&a||(this._player.getDir()===E.LEFT||this._player.getDir()===E.RIGHT)&&!a)?this._objectCanMoveTo(e,i,o)?ce.MODE_Y:this._objectCanMoveTo(e,r,o)?ce.MODE_X:ce.UNDECIDED:this._objectCanMoveTo(e,r,o)?ce.MODE_X:this._objectCanMoveTo(e,i,o)?ce.MODE_Y:ce.UNDECIDED}_getThirdCandidate(e,t,n,r,i){var a=r===se.CHASE_PLAYER?1:r===se.RUN_OUT?-1:0,o=e?this._player.getPosition().getNextJustPosition().getPartsCoord():this._player.getPosition().getPartsCoord(),s=t.getPartsCoord(),c;return o.x!==s.x&&(c=new S(n.x,s.y+1*a),this._objectCanMoveTo(e,c,i)||(c=new S(n.x,s.y-1*a),this._objectCanMoveTo(e,c,i))||(c=new S(s.x,s.y+1*a),this._objectCanMoveTo(e,c,i))||(c=new S(s.x,s.y-1*a),this._objectCanMoveTo(e,c,i)))||o.y!==s.y&&(c=new S(s.x+1*a,n.y),this._objectCanMoveTo(e,c,i)||(c=new S(s.x-1*a,n.y),this._objectCanMoveTo(e,c,i))||(c=new S(s.x+1*a,s.y),this._objectCanMoveTo(e,c,i))||(c=new S(s.x-1*a,s.y),this._objectCanMoveTo(e,c,i)))?c:null}_getRandomMoveCoord(e,t,n){let r=t.getPartsCoord(),i=r.clone(),a=this._wwaData.isOldMove?R.RANDOM_MOVE_ITERATION_NUM_BEFORE_V31:R.RANDOM_MOVE_ITERATION_NUM;for(let t=0;t<a;t++){let t=[-1,1,0,0,-1,-1,1,1],a=[0,0,1,-1,1,-1,1,-1],o=Math.floor(Math.random()*t.length);if(i.x=r.x+t[o],i.y=r.y+a[o],this._objectCanMoveTo(e,i,n))return i}return r}isPrevFrameEventExecuted(){return this._prevFrameEventExected}_objectCanMoveTo(e,t,n){if(t.x<0||t.y<0||this._wwaData.mapWidth<=t.x||this._wwaData.mapWidth<=t.y)return!1;var r=this._wwaData.map[t.y][t.x],i=this._wwaData.mapObject[t.y][t.x],a=this._wwaData.mapAttribute[r][R.ATR_TYPE],o=this._camera.getPosition(),s=o.getPartsCoord().x,c=o.getPartsCoord().y;if(r===0&&!this.isOldMap()||a===R.MAP_WALL)return!1;var l=t.x-s+1,u=t.y-c+1;if(0<=l&&0<=u&&l<n.length&&u<n.length){if(n[u][l]!==0)return!1}else if(i!==0)return!1;if(e){if(this._player.getPosition().getNextJustPosition().getPartsCoord().equals(t))return!1}else if(this._player.getPosition().getPartsCoord().equals(t))return!1;return!0}_setObjectsInNextFrame(e,t,n,r,i,a){var o=t.x-n+1,s=t.y-r+1;0<=t.x&&t.x<=this._wwaData.mapWidth&&0<=t.y&&t.y<=this._wwaData.mapWidth&&(0<=o&&o<i.length&&0<=s&&s<i.length&&(i[e.y-r+1][e.x-n+1]=0,i[t.y-r+1][t.x-n+1]=a,this.hoge[t.y-r+1][t.x-n+1]=a),this._objectMovingDataManager.add(a,e.convertIntoPosition(this),t.convertIntoPosition(this),e.getDirectionTo(t)))}launchBattleEstimateWindow(){let e=this._camera.getPosition().getPartsCoord(),t=Math.max(0,e.x),n=Math.min(this._wwaData.mapWidth-1,e.x+R.H_PARTS_NUM_IN_WINDOW-1),r=Math.max(0,e.y),i=Math.min(this._wwaData.mapWidth-1,e.y+R.V_PARTS_NUM_IN_WINDOW-1),a=[];this.playDecisionSound();for(let e=t;e<=n;e++)for(let t=r;t<=i;t++){let n=this._wwaData.mapObject[t][e];this._wwaData.objectAttribute[n][R.ATR_TYPE]!==R.OBJECT_MONSTER||a.find(e=>e.partsID===n)||a.push(this._createMonster(n,new S(e,t)))}if(this._bottomButtonType===T.BATTLE_REPORT&&U(F[P.GOTO_WWA]).classList.add(`onpress`),a.length===0)return U(F[P.GOTO_WWA]).classList.remove(`onpress`),this.hideBattleEstimateWindow(),!1;this._battleEstimateWindow.update(this._player.getStatus(),a,(e,t)=>this._player.calcBattleResultForPlayerTurn(e,t.status,!0),(e,t)=>this._player.calcBattleResultForEnemyTurn(e.status,t,!0),this.isUsingDefaultDamageCalcFunction()),this._battleEstimateWindow.show(),this._player.setEstimateWindowWating();let o=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_BATTLE_REPORT;return o&&this.evalCalcWwaNodeGenerator.evalWwaNode(o),!0}isUsingDefaultDamageCalcFunction(){return this.getUserDefinedDamageFunctionNode(`enemyToPlayer`)===void 0&&this.getUserDefinedDamageFunctionNode(`playerToEnemy`)===void 0}_createMonster(e,t,n){return new Yn(e,t,new S(this._wwaData.objectAttribute[e][R.ATR_X],this._wwaData.objectAttribute[e][R.ATR_Y]),new x(this._wwaData.objectAttribute[e][R.ATR_ENERGY],this._wwaData.objectAttribute[e][R.ATR_STRENGTH],this._wwaData.objectAttribute[e][R.ATR_DEFENCE],this._wwaData.objectAttribute[e][R.ATR_GOLD]),this._wwaData.message[this._wwaData.objectAttribute[e][R.ATR_STRING]],this._wwaData.objectAttribute[e][R.ATR_ITEM],n)}hideBattleEstimateWindow(){this._battleEstimateWindow.hide(),this._player.clearEstimateWindowWaiting(),U(F[P.GOTO_WWA]).classList.remove(`onpress`),this._dispatchWindowClosedTimeRequests()}hidePasswordWindow(e=!1){if(this._passwordWindow.hide(),e||this._passwordWindow.mode===Tr.SAVE){this._player.clearPasswordWindowWaiting(),this._dispatchWindowClosedTimeRequests();return}try{var t=this._quickLoad(!1,this._passwordWindow.password,!1)}catch(e){this._player.clearPasswordWindowWaiting(),this._dispatchWindowClosedTimeRequests(),alert(`セーブデータの復元に失敗しました。
|
|
129
|
+
予めご了承ください。`);console.log(`Valid Password!`)}return n&&this._applyQuickLoad(r),r}_applyQuickLoad(e){this._userVar.named=e.userNamedVar,this._userVar.numbered=e.userVar,this._player.setEnergyMax(e.statusEnergyMax),this._player.setEnergy(e.statusEnergy),this._player.setStrength(e.statusStrength),this._player.setDefence(e.statusDefence),this._player.setGold(e.statusGold),this._player.setMoveCount(e.moves),this._player.setFrameCount(e.frameCount),this._player.clearItemBox();for(var t=0;t<e.itemBox.length;t++)this._player.addItem(e.itemBox[t],t+1,!0);this._player.systemJumpTo(new C(this,e.playerX,e.playerY,0,0)),e.bgm===0?this.playSound(p.NO_SOUND):this.playSound(e.bgm,{bgmDelayDurationMs:e.bgmDelayDurationMs}),this.setImgClick(new S(e.imgClickX,e.imgClickY)),this.getObjectIdByPosition(this._player.getPosition())!==0&&this._player.setPartsAppearedFlag(),this._clearAllRequests(),this._playTimeCalculator=new Oe(e.playTime),this._wwaData=e,this._mapIDTableCreate(),this._replaceAllRandomObjects(),this.setStatusIconCoord(L.ENERGY,new S(e.imgStatusEnergyX,e.imgStatusEnergyY)),this.setStatusIconCoord(L.STRENGTH,new S(e.imgStatusStrengthX,e.imgStatusStrengthY)),this.setStatusIconCoord(L.DEFENCE,new S(e.imgStatusDefenceX,e.imgStatusDefenceY)),this.setStatusIconCoord(L.GOLD,new S(e.imgStatusGoldX,e.imgStatusGoldY)),this.setWideCellCoord(new S(e.imgWideCellX,e.imgWideCellY)),this.setItemboxBackgroundPosition({x:e.imgItemboxX,y:e.imgItemboxY}),this.setFrameCoord(new S(e.imgFrameX,e.imgFrameY)),this.setPlayerSpeedIndex(e.gameSpeedIndex),this.updateCSSRule(),this.updateEffect(),this._cgManager.restorePictures(this._wwaData.pictureRegistry),this.updateAllPicturesCache(),this._player.updateStatusValueBox(),this._wwaSave.quickSaveButtonUpdate(this._wwaData)}_mapIDTableCreate(){var e;for(this._mapIDTable=[],this._mapObjectIDTable=[],e=0;e<this._wwaData.mapPartsMax;e++)this._mapIDTable[e]=[];for(e=0;e<this._wwaData.objPartsMax;e++)this._mapObjectIDTable[e]=[];for(var t=0;t<this._wwaData.mapWidth;t++)for(var n=0;n<this._wwaData.mapWidth;n++){var r=n<<Ce.BITSHIFT|t;e=this._wwaData.map[n][t],this._mapIDTable[e]instanceof Array||(this._mapIDTable[e]=[]),this._mapIDTable[e].push(r),e=this._wwaData.mapObject[n][t],this._mapObjectIDTable[e]instanceof Array||(this._mapObjectIDTable[e]=[]),this._mapObjectIDTable[e].push(r)}}restartGame(){this._quickLoad(!0)}_fadeout(e){var t=0,n=R.MAP_WINDOW_WIDTH,r=R.FADEOUT_SPEED,i=U(`wwa-fader`);i.style.display=`block`;var a=setInterval(()=>{if(t+=r,n-=r*2,n<=0||t*2>R.MAP_WINDOW_WIDTH){i.removeAttribute(`style`),i.style.display=`block`,i.style.borderWidth=`0`,i.style.width=R.MAP_WINDOW_WIDTH+`px`,i.style.height=R.MAP_WINDOW_HEIGHT+`px`,i.style.backgroundColor=`#808080`,clearInterval(a),e();return}i.style.width=n+`px`,i.style.height=n+`px`,i.style.borderWidth=t+`px`},20)}moveObjects(e){var t=this._camera.getPosition();this._player.getPosition(),t.getPartsCoord();var n=t.getPartsCoord().x,r=t.getPartsCoord().y,i,a,o;if(!(this.getMapAttributeByPosition(this._player.getPosition(),R.ATR_TYPE)===R.MAP_LOCALGATE||this.getObjectAttributeByPosition(this._player.getPosition(),R.ATR_TYPE)===R.OBJECT_LOCALGATE)){for(i=Array(R.V_PARTS_NUM_IN_WINDOW+2),this.hoge=Array(R.V_PARTS_NUM_IN_WINDOW+2),o=-1;o<=R.V_PARTS_NUM_IN_WINDOW;o++)for(i[o+1]=Array(R.H_PARTS_NUM_IN_WINDOW+2),this.hoge[o+1]=Array(R.H_PARTS_NUM_IN_WINDOW+2),a=-1;a<=R.H_PARTS_NUM_IN_WINDOW;a++){if(r+o<0||r+o>=this._wwaData.mapWidth||n+a<0||n+a>=this._wwaData.mapWidth){i[o+1][a+1]=0,this.hoge[o+1][a+1]=0;continue}try{var s=new C(this,n+a,r+o,0,0),c=s.getPartsCoord()}catch{i[o+1][a+1]=0,this.hoge[o+1][a+1]=0;continue}this._wwaData.mapObject[c.y][c.x],i[o+1][a+1]=this._wwaData.mapObject[c.y][c.x],this.hoge[o+1][a+1]=-this._wwaData.mapObject[c.y][c.x]}for(a=-1;a<=R.H_PARTS_NUM_IN_WINDOW;a++)if(!(n+a<0||n+a>=this._wwaData.mapWidth)){for(o=-1;o<=R.V_PARTS_NUM_IN_WINDOW;o++)if(!(r+o<0||r+o>=this._wwaData.mapWidth)){try{var s=new C(this,n+a,r+o,0,0),c=s.getPartsCoord()}catch{continue}var l=this._wwaData.mapObject[c.y][c.x];if(!(l===0||this._wwaData.objectAttribute[l][R.ATR_MOVE]===se.STATIC||this._wwaData.objectAttribute[l][R.ATR_TYPE]===R.OBJECT_LOCALGATE||this._wwaData.objectAttribute[l][R.ATR_TYPE]===R.OBJECT_RANDOM)&&!(this._wwaData.objectAttribute[l][R.ATR_MOVE]!==se.CHASE_PLAYER&&this._wwaData.objectAttribute[l][R.ATR_MOVE]!==se.RUN_OUT&&this._wwaData.objectAttribute[l][R.ATR_MOVE]!==se.HANG_AROUND)){var u=this._wwaData.objectAttribute[l][R.ATR_MOVE];if(u!==se.HANG_AROUND){var d=this._getCandidateCoord(e,s,u),f=new S(d.x,c.y),p=new S(c.x,d.y),m=null,h;if(this._objectCanMoveTo(e,d,i))this._setObjectsInNextFrame(c,d,n,r,i,l);else{var g=this._getSecondCandidateMoveMode(e,c,d,f,p,this._wwaData.objectAttribute[l][R.ATR_TYPE]===R.OBJECT_MONSTER,i);g===ce.MODE_X?this._setObjectsInNextFrame(c,f,n,r,i,l):g===ce.MODE_Y?this._setObjectsInNextFrame(c,p,n,r,i,l):(m=this._getThirdCandidate(e,s,d,u,i),m!==null&&!this._wwaData.isOldMove?this._setObjectsInNextFrame(c,m,n,r,i,l):(h=this._getRandomMoveCoord(e,s,i),this._setObjectsInNextFrame(c,h,n,r,i,l)))}}else h=this._getRandomMoveCoord(e,s,i),this._setObjectsInNextFrame(c,h,n,r,i,l)}}}}}_getCandidateCoord(e,t,n){var r=t.getPartsCoord();this._player.getPosition().getOffsetCoord(),this._player.getPosition().getPartsCoord();try{var i=e?this._player.getPosition().getNextJustPosition().getPartsCoord():this._player.getPosition().getPartsCoord()}catch{throw Error(`予期せぬ方向への移動のようです。`)}var a=r.clone(),o=0,s=0;return n===se.CHASE_PLAYER?(o=r.x>i.x?-1:+(r.x<i.x),s=r.y>i.y?-1:+(r.y<i.y)):n===se.RUN_OUT&&(o=r.x>i.x?1:r.x<i.x?-1:0,s=r.y>i.y?1:r.y<i.y?-1:0),a.x+=o,a.y+=s,a.x=Math.min(this._wwaData.mapWidth-1,Math.max(0,a.x)),a.y=Math.min(this._wwaData.mapWidth-1,Math.max(0,a.y)),a}_getSecondCandidateMoveMode(e,t,n,r,i,a,o){return e&&((this._player.getDir()===E.UP||this._player.getDir()===E.DOWN)&&a||(this._player.getDir()===E.LEFT||this._player.getDir()===E.RIGHT)&&!a)?this._objectCanMoveTo(e,i,o)?ce.MODE_Y:this._objectCanMoveTo(e,r,o)?ce.MODE_X:ce.UNDECIDED:this._objectCanMoveTo(e,r,o)?ce.MODE_X:this._objectCanMoveTo(e,i,o)?ce.MODE_Y:ce.UNDECIDED}_getThirdCandidate(e,t,n,r,i){var a=r===se.CHASE_PLAYER?1:r===se.RUN_OUT?-1:0,o=e?this._player.getPosition().getNextJustPosition().getPartsCoord():this._player.getPosition().getPartsCoord(),s=t.getPartsCoord(),c;return o.x!==s.x&&(c=new S(n.x,s.y+1*a),this._objectCanMoveTo(e,c,i)||(c=new S(n.x,s.y-1*a),this._objectCanMoveTo(e,c,i))||(c=new S(s.x,s.y+1*a),this._objectCanMoveTo(e,c,i))||(c=new S(s.x,s.y-1*a),this._objectCanMoveTo(e,c,i)))||o.y!==s.y&&(c=new S(s.x+1*a,n.y),this._objectCanMoveTo(e,c,i)||(c=new S(s.x-1*a,n.y),this._objectCanMoveTo(e,c,i))||(c=new S(s.x+1*a,s.y),this._objectCanMoveTo(e,c,i))||(c=new S(s.x-1*a,s.y),this._objectCanMoveTo(e,c,i)))?c:null}_getRandomMoveCoord(e,t,n){let r=t.getPartsCoord(),i=r.clone(),a=this._wwaData.isOldMove?R.RANDOM_MOVE_ITERATION_NUM_BEFORE_V31:R.RANDOM_MOVE_ITERATION_NUM;for(let t=0;t<a;t++){let t=[-1,1,0,0,-1,-1,1,1],a=[0,0,1,-1,1,-1,1,-1],o=Math.floor(Math.random()*t.length);if(i.x=r.x+t[o],i.y=r.y+a[o],this._objectCanMoveTo(e,i,n))return i}return r}isPrevFrameEventExecuted(){return this._prevFrameEventExected}_objectCanMoveTo(e,t,n){if(t.x<0||t.y<0||this._wwaData.mapWidth<=t.x||this._wwaData.mapWidth<=t.y)return!1;var r=this._wwaData.map[t.y][t.x],i=this._wwaData.mapObject[t.y][t.x],a=this._wwaData.mapAttribute[r][R.ATR_TYPE],o=this._camera.getPosition(),s=o.getPartsCoord().x,c=o.getPartsCoord().y;if(r===0&&!this.isOldMap()||a===R.MAP_WALL)return!1;var l=t.x-s+1,u=t.y-c+1;if(0<=l&&0<=u&&l<n.length&&u<n.length){if(n[u][l]!==0)return!1}else if(i!==0)return!1;if(e){if(this._player.getPosition().getNextJustPosition().getPartsCoord().equals(t))return!1}else if(this._player.getPosition().getPartsCoord().equals(t))return!1;return!0}_setObjectsInNextFrame(e,t,n,r,i,a){var o=t.x-n+1,s=t.y-r+1;0<=t.x&&t.x<=this._wwaData.mapWidth&&0<=t.y&&t.y<=this._wwaData.mapWidth&&(0<=o&&o<i.length&&0<=s&&s<i.length&&(i[e.y-r+1][e.x-n+1]=0,i[t.y-r+1][t.x-n+1]=a,this.hoge[t.y-r+1][t.x-n+1]=a),this._objectMovingDataManager.add(a,e.convertIntoPosition(this),t.convertIntoPosition(this),e.getDirectionTo(t)))}launchBattleEstimateWindow(){let e=this._camera.getPosition().getPartsCoord(),t=Math.max(0,e.x),n=Math.min(this._wwaData.mapWidth-1,e.x+R.H_PARTS_NUM_IN_WINDOW-1),r=Math.max(0,e.y),i=Math.min(this._wwaData.mapWidth-1,e.y+R.V_PARTS_NUM_IN_WINDOW-1),a=[];if(this.playDecisionSound(),this._bottomButtonType===T.BATTLE_REPORT&&U(F[P.GOTO_WWA]).classList.add(`onpress`),this._wwaData.battleEstimateDisabled)return this.registerSystemMessagePageByKey(g.BATTLE_REPORT_DISABLED),this._wwaData.customSystemMessages[g.BATTLE_REPORT_DISABLED]===`BLANK`&&U(F[P.GOTO_WWA]).classList.remove(`onpress`),!1;for(let e=t;e<=n;e++)for(let t=r;t<=i;t++){let n=this._wwaData.mapObject[t][e];this._wwaData.objectAttribute[n][R.ATR_TYPE]!==R.OBJECT_MONSTER||a.find(e=>e.partsID===n)||a.push(this._createMonster(n,new S(e,t)))}if(a.length===0)return U(F[P.GOTO_WWA]).classList.remove(`onpress`),this.hideBattleEstimateWindow(),!1;this._battleEstimateWindow.update(this._player.getStatus(),a,(e,t)=>this._player.calcBattleResultForPlayerTurn(e,t.status,!0),(e,t)=>this._player.calcBattleResultForEnemyTurn(e.status,t,!0),this.isUsingDefaultDamageCalcFunction()),this._battleEstimateWindow.show(),this._player.setEstimateWindowWating();let o=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_BATTLE_REPORT;return o&&this.evalCalcWwaNodeGenerator.evalWwaNode(o),!0}isUsingDefaultDamageCalcFunction(){return this.getUserDefinedDamageFunctionNode(`enemyToPlayer`)===void 0&&this.getUserDefinedDamageFunctionNode(`playerToEnemy`)===void 0}_createMonster(e,t,n){return new Yn(e,t,new S(this._wwaData.objectAttribute[e][R.ATR_X],this._wwaData.objectAttribute[e][R.ATR_Y]),new x(this._wwaData.objectAttribute[e][R.ATR_ENERGY],this._wwaData.objectAttribute[e][R.ATR_STRENGTH],this._wwaData.objectAttribute[e][R.ATR_DEFENCE],this._wwaData.objectAttribute[e][R.ATR_GOLD]),this._wwaData.message[this._wwaData.objectAttribute[e][R.ATR_STRING]],this._wwaData.objectAttribute[e][R.ATR_ITEM],n)}hideBattleEstimateWindow(){this._battleEstimateWindow.hide(),this._player.clearEstimateWindowWaiting(),U(F[P.GOTO_WWA]).classList.remove(`onpress`),this._dispatchWindowClosedTimeRequests()}hidePasswordWindow(e=!1){if(this._passwordWindow.hide(),e||this._passwordWindow.mode===Tr.SAVE){this._player.clearPasswordWindowWaiting(),this._dispatchWindowClosedTimeRequests();return}try{var t=this._quickLoad(!1,this._passwordWindow.password,!1)}catch(e){this._player.clearPasswordWindowWaiting(),this._dispatchWindowClosedTimeRequests(),alert(`セーブデータの復元に失敗しました。
|
|
130
130
|
エラー詳細:
|
|
131
131
|
`+e.message);return}this._passwordLoadExecInNextFrame=!0,this._passwordSaveExtractData=t}_displayUserVars(){if(!this._canDisplayUserVars||!this._inlineUserVarViewer)return;let e=``;if(this._inlineUserVarViewer.isVisible=!0,this._player.isControllable()){let t=[...this._userVar.named];if(this._inlineUserVarViewer.kind===`named`)if(e=`名前つき変数一覧
|
|
132
132
|
`,t.length===0)e+=`名前つき変数はありません
|
|
@@ -150,7 +150,7 @@ JSON PARSE FAILED`)}if(r.isCompress){delete r.isCompress;let[e,t]=zi.decompress(
|
|
|
150
150
|
ZR:一時保存データの読み込み
|
|
151
151
|
+: 移動速度を上げる
|
|
152
152
|
-: 移動速度を落とす
|
|
153
|
-
WWA Wing バージョン:4.0.
|
|
153
|
+
WWA Wing バージョン:4.0.22
|
|
154
154
|
マップデータ バージョン: `+Math.floor(this._wwaData.version/10)+`.`+this._wwaData.version%10;break;case ne.PLAY_STATION:e=` 【操作方法】
|
|
155
155
|
〇:Yes,戦闘結果予測の表示
|
|
156
156
|
×:No
|
|
@@ -163,7 +163,7 @@ OPTIONS: 移動速度を上げる
|
|
|
163
163
|
SHARE: 移動速度を落とす
|
|
164
164
|
現在の移動回数:`+this._player.getMoveCount()+`
|
|
165
165
|
`+(t?` プレイ時間:`+t+`
|
|
166
|
-
`:``)+` WWA Wing バージョン:4.0.
|
|
166
|
+
`:``)+` WWA Wing バージョン:4.0.22
|
|
167
167
|
マップデータ バージョン: `+Math.floor(this._wwaData.version/10)+`.`+this._wwaData.version%10;break;case ne.XBOX:e=` 【操作方法】
|
|
168
168
|
B:Yes,戦闘結果予測の表示
|
|
169
169
|
A:No
|
|
@@ -176,7 +176,7 @@ MENU: 移動速度を上げる
|
|
|
176
176
|
WINDOW: 移動速度を落とす
|
|
177
177
|
現在の移動回数:`+this._player.getMoveCount()+`
|
|
178
178
|
`+(t?` プレイ時間:`+t+`
|
|
179
|
-
`:``)+` WWA Wing バージョン:4.0.
|
|
179
|
+
`:``)+` WWA Wing バージョン:4.0.22
|
|
180
180
|
マップデータ バージョン: `+Math.floor(this._wwaData.version/10)+`.`+this._wwaData.version%10;break;default:return}break;case re.SP:return;case re.VR:return;case re.PC:e=` 【操作方法】
|
|
181
181
|
F1、M:戦闘結果予測の表示
|
|
182
182
|
F3:復帰用パスワード入力
|
|
@@ -194,7 +194,7 @@ WINDOW: 移動速度を落とす
|
|
|
194
194
|
F2、P: 移動速度を上げる
|
|
195
195
|
現在の移動回数:`+this._player.getMoveCount()+`
|
|
196
196
|
`+(t?` プレイ時間:`+t+`
|
|
197
|
-
`:``)+` WWA Wing バージョン:4.0.
|
|
197
|
+
`:``)+` WWA Wing バージョン:4.0.22
|
|
198
198
|
マップデータ バージョン: `+Math.floor(this._wwaData.version/10)+`.`+this._wwaData.version%10;break;default:return}e&&this.registerSystemMessagePage(e)}}_setNextPage(){if(this._clearFacesInNextFrame=!0,this._scoreWindow.isVisible()&&this._scoreWindow.hide(),this._isLastPage&&this._reservedMoveMacroTurn!==void 0&&(this._player.setMoveMacroWaiting(this._reservedMoveMacroTurn),this._reservedMoveMacroTurn=void 0),this._pages.length===0){let{newPageGenerated:e}=this._hideMessageWindow();e||(this.clearFaces(),this._dispatchWindowClosedTimeRequests())}else this._shouldSetNextPage=!0;this._inlineUserVarViewer&&(this._inlineUserVarViewer.isVisible=!1)}_hideMessageWindow(){let e=this._player.isReadyToUseItem()?this._player.useItem():0,t=this.getObjectAttributeById(e,R.ATR_STRING);return t===0?(this._messageWindow.isVisible()&&(this._player.setDelayFrame(),this._messageWindow.hide(),this._keyStore.allClear(),this._mouseStore.clear()),this._player.isManualPause()||this._player.clearWaitingMessageOrManualPause(),{newPageGenerated:!1}):(this.registerPageByMessage(this.getMessageById(t),{triggerParts:{id:e,type:j.OBJECT,position:this._player.getPosition().getPartsCoord()}}),{newPageGenerated:this._pages.length!==0})}getPlayerPositon(){return this._player.getPosition()}loadMapPartsObjectID(e){return e|=0,e<0||e>=this._wwaData.objPartsMax?0:e}loadMapPartsID(e){return e|=0,e<0||e>=this._wwaData.mapPartsMax?0:e}replaceParts(e,t,n=j.OBJECT,r=!1){var i=this._camera.getPosition().getPartsCoord(),a=r?Math.max(0,i.x):0,o=r?Math.min(this._wwaData.mapWidth-1,i.x+R.H_PARTS_NUM_IN_WINDOW-1):this._wwaData.mapWidth-1,s=r?Math.max(0,i.y):0,c=r?Math.min(this._wwaData.mapWidth-1,i.y+R.V_PARTS_NUM_IN_WINDOW)-1:this._wwaData.mapWidth-1;r=a!==0||o!==this._wwaData.mapWidth-1||s!==0||c!==this._wwaData.mapWidth-1;var l,u,d,f,p,m,h,g;if(n===j.OBJECT)if(e=this.loadMapPartsObjectID(e),t=this.loadMapPartsObjectID(t),f=this._mapObjectIDTable[e].concat(),h=this._mapObjectIDTable[e],h.length=0,g=this._mapObjectIDTable[t],u=f.length,r)for(d=0;d<u;d++)l=f[d],p=l&Ce.BITMASK,m=l>>>Ce.BITSHIFT&Ce.BITMASK,a<=p&&p<=o&&s<=m&&m<=c?(this._wwaData.mapObject[m][p]=t,g.push(l)):h.push(l);else{for(d=0;d<u;d++)l=f[d],p=l&Ce.BITMASK,m=l>>>Ce.BITSHIFT&Ce.BITMASK,this._wwaData.mapObject[m][p]=t;Array.prototype.push.apply(g,f)}else if(e=this.loadMapPartsID(e),t=this.loadMapPartsID(t),f=this._mapIDTable[e].concat(),h=this._mapIDTable[e],h.length=0,g=this._mapIDTable[t],u=f.length,r)for(d=0;d<u;d++)l=f[d],p=l&Ce.BITMASK,m=l>>>Ce.BITSHIFT&Ce.BITMASK,a<=p&&p<=o&&s<=m&&m<=c?(this._wwaData.map[m][p]=t,g.push(l)):h.push(l);else{for(d=0;d<u;d++)l=f[d],p=l&Ce.BITMASK,m=l>>>Ce.BITSHIFT&Ce.BITMASK,this._wwaData.map[m][p]=t;Array.prototype.push.apply(g,f)}}getYesNoImgCoord(){return new S(this._wwaData.yesnoImgPosX,this._wwaData.yesnoImgPosY)}setYesNoImgCoord(e){return this._wwaData.yesnoImgPosX=e.x,this._wwaData.yesnoImgPosY=e.y,e}getPlayerImgCoord(){return new S(this._wwaData.playerImgPosX,this._wwaData.playerImgPosY)}setPlayerImgCoord(e){return this._wwaData.playerImgPosX=e.x,this._wwaData.playerImgPosY=e.y,e}setPlayerEnergyMax(e){return this._player.setEnergyMax(this.toValidStatusValue(e))}getMapPartsNum(){return this._wwaData.mapPartsMax}getObjectPartsNum(){return this._wwaData.objPartsMax}setMoveMacroWaitingToPlayer(e){this._reservedMoveMacroTurn=e}disableSave(e){return this._wwaData.disableSaveFlag=e,this._wwaSave.quickSaveButtonUpdate(this._wwaData),e}isOldMap(){return this._wwaData.isOldMap}setOldMap(e){return this._wwaData.isOldMap=e}setObjectNotCollapseOnPartsOnPlayer(e){return this._wwaData.objectNoCollapseDefaultFlag=e}setGameOverPosition(e){if(e.x<0||e.x>=this.getMapWidth()||e.y<0||e.y>=this.getMapWidth())throw Error(`マップの範囲外が指定されています!`);return this._wwaData.gameoverX=e.x,this._wwaData.gameoverY=e.y,e}getGemeOverPosition(){return new S(this._wwaData.gameoverX,this._wwaData.gameoverY)}toValidStatusValue(e){return this.isNotNumberTypeOrNaN(e)||e<0?0:Math.floor(e)}setPlayerStatus(e,t,n){if(e===ue.ENERGY){if(this._player.setEnergy(this.toValidStatusValue(t)),this._player.isDead()&&this.shouldApplyGameOver({isAssignment:n}))return this.gameover(),{isGameOver:!0}}else if(e===ue.STRENGTH)this._player.setStrength(this.toValidStatusValue(t));else if(e===ue.DEFENCE)this._player.setDefence(this.toValidStatusValue(t));else if(e===ue.GOLD)this._player.setGold(this.toValidStatusValue(t));else if(e===ue.MOVES)this._player.setMoveCount(this.toValidStatusValue(t));else throw Error(`未定義のステータスタイプです`);return{}}setDelPlayer(e){return this._wwaData.delPlayerFlag=e}setPlayerGetItem(e,t){try{this._player.addItem(t,e,!0)}catch{}}setStatusIconCoord(e,t){let n=t.x*R.CHIP_SIZE,r=t.y*R.CHIP_SIZE,i=e=>{let t=Re(`${e}>.status-icon`);t.style.backgroundPosition=`-${n}px -${r}px`};switch(e){case L.ENERGY:this._wwaData.imgStatusEnergyX=t.x,this._wwaData.imgStatusEnergyY=t.y,i(`#disp-energy`);break;case L.STRENGTH:this._wwaData.imgStatusStrengthX=t.x,this._wwaData.imgStatusStrengthY=t.y,i(`#disp-strength`);break;case L.DEFENCE:this._wwaData.imgStatusDefenceX=t.x,this._wwaData.imgStatusDefenceY=t.y,i(`#disp-defence`);break;case L.GOLD:this._wwaData.imgStatusGoldX=t.x,this._wwaData.imgStatusGoldY=t.y,i(`#disp-gold`);break;default:throw Error(`種別が不正です。`)}return t.clone()}setWideCellCoord(e){this._wwaData.imgWideCellX=e.x,this._wwaData.imgWideCellY=e.y;let t=e.x*R.CHIP_SIZE,n=e.y*R.CHIP_SIZE;return Array.prototype.forEach.call(ze(`div.wide-cell-row`),e=>{e.style.backgroundPosition=`-`+t+`px -`+n+`px`}),e.clone()}setFrameCoord(e){return this._wwaData.imgFrameX=e.x,this._wwaData.imgFrameY=e.y,this._cgManager.setFrameImage(e),e.clone()}setBattleEffectCoord(e){return this._battleEffectCoord=e.clone()}canInput(){return!this._temporaryInputDisable&&!this._cgManager.picture.isWaiting()}setEffect(e,t){this._wwaData.effectWaits=e,this._wwaData.effectCoords=t,this.updateEffect()}stopEffect(){this._wwaData.effectCoords=[],this.updateEffect()}updateEffect(){this._cgManager.updateEffects(this._wwaData.effectCoords)}updateAllPicturesCache(){this._cgManager.updateAllPicturesCache(this._isMainAnimation())}updatePicturesAnimation(){this._player.isPausing()||this._cgManager.updatePicturesAnimation(this._isMainAnimation())}setImgClick(e){if(this._wwaData.imgClickX=e.x,this._wwaData.imgClickY=e.y,e.equals(new S(0,0)))Array.prototype.forEach.call(ze(`.item-cell>.item-click-border`),e=>{e.style.backgroundImage=`url('`+R.ITEM_BORDER_IMG_DATA_URL+`')`,e.style.backgroundPosition=`0 0`});else{var t=this._wwaData.mapCGName.replace(`(`,`\\(`).replace(`)`,`\\)`);Array.prototype.forEach.call(ze(`.item-cell>.item-click-border`),n=>{n.style.backgroundImage=`url('`+t+`')`,n.style.backgroundPosition=`-`+e.x*R.CHIP_SIZE+`px -`+e.y*R.CHIP_SIZE+`px`})}}addFace(e){this._faces.push(e),this._messageWindow.setPositionByPlayerPosition(this._faces.length!==0,this._scoreWindow.isVisible(),!1,this._player.getPosition(),this._camera.getPosition())}clearFaces(){this._faces=[]}updateItemEffectEnabled(e){this._wwaData.isItemEffectEnabled=e}setOldMove(e){this._wwaData.isOldMove=e}setGameOverPolicy(e){switch(e){case 0:this._wwaData.gameOverPolicy=`default`;return;case 1:this._wwaData.gameOverPolicy=`never`;return;case 2:this._wwaData.gameOverPolicy=`except-assignment`;return;default:return}}setBgmDelay(e){this._wwaData.bgmDelayDurationMs=e}setPictureRegistry(e,t,n,r,i){let a=n===j.OBJECT?this._wwaData.objectAttribute[t]:n===j.MAP?this._wwaData.mapAttribute[t]:null;if(a===null)throw Error(`対応していないパーツ番号です。`);let o=this.getMessageById(a[R.ATR_STRING]);if(!o)throw n===j.OBJECT?Error(`物体パーツ ${t} 番に対応したテキストが見つかりませんでした。`):Error(`背景パーツ ${t} 番に対応したテキストが見つかりませんでした。`);let s=this._returnEvalString(`(`+o+`)`),c=this._cgManager.picture.registerPictureFromRawRegistry({layerNumber:e,imgPosX:(a[R.ATR_X]??0)/R.CHIP_SIZE,imgPosX2:(a[R.ATR_X2]??0)/R.CHIP_SIZE,imgPosY:(a[R.ATR_Y]??0)/R.CHIP_SIZE,imgPosY2:(a[R.ATR_Y2]??0)/R.CHIP_SIZE,triggerPartsX:r.x,triggerPartsY:r.y,soundNumber:a[R.ATR_SOUND]??0,properties:d(s)},t,n,i);this._wwaData.pictureRegistry=c,this.updateAllPicturesCache()}setPictureRegistryFromRawText(e,t){let n=this._cgManager.picture.registerPictureFromRawText(e,t);this._wwaData.pictureRegistry=n,this.updateAllPicturesCache()}setPictureRegistryFromObject(e,t){let n=this._cgManager.picture.registerPictureFromObject(e,t);this._wwaData.pictureRegistry=n,this.updateAllPicturesCache()}deletePictureRegistry(e){let t=this._cgManager.picture.deletePicture(e);this._wwaData.pictureRegistry=t}clearAllPictures(){this._cgManager.picture.clearAllPictures(),this._wwaData.pictureRegistry=[]}initCSSRule(){this._styleElm=U(R.WWA_STYLE_TAG_ID),this._sheet=this._styleElm.sheet,this.updateCSSRule()}updateCSSRule(){if(this._stylePos===void 0)this._stylePos=[,,];else if(this._sheet.addRule!==void 0)for(var e=0;e<this._stylePos.length;e++)this._sheet.removeRule(this._stylePos[this._styleElm[e]]);else for(var e=0;e<this._stylePos.length;e++)this._sheet.deleteRule(this._stylePos[this._styleElm[e]]);let t=`div.wwa-message-window, div#wwa-text-message-window, div#wwa-battle-estimate, div#wwa-password-window`,n=this._isClassicModeEnable?1:.9,r=`
|
|
199
199
|
background-color: rgba(${this._wwaData.frameColorR}, ${this._wwaData.frameColorG}, ${this._wwaData.frameColorB}, ${n});
|
|
200
200
|
border-color: rgba(${this._wwaData.frameOutColorR}, ${this._wwaData.frameOutColorG}, ${this._wwaData.frameOutColorB}, 1);
|
|
@@ -207,7 +207,7 @@ font-weight: bold;
|
|
|
207
207
|
`+e.message)}}_execEvalString(e,t){try{let n=this.convertWwaNodes(e);t&&this.evalCalcWwaNodeGenerator.setTriggerParts(t.id,t.type,t.position),this.evalCalcWwaNodeGenerator.evalWwaNodes(n),this.evalCalcWwaNodeGenerator.clearTemporaryState()}catch(e){console.error(e),this.registerSystemMessagePage(`解析中にエラーが発生しました :
|
|
208
208
|
`+e.message)}}_returnEvalString(e){try{let t=$(Ps(`(`+e+`)`));return this.evalCalcWwaNodeGenerator.evalWwaNode(t).value}catch(e){console.error(e),this.registerSystemMessagePage(`解析中にエラーが発生しました :
|
|
209
209
|
`+e.message,!1)}}movePlayer(e){this._player.controll(e)}isPlayerWaitingMessage(){return this._player.isWaitingMessageOrManualPause()}isManualPause(){return this._player.isManualPause()}_loadSystemMessage(e){if(this._wwaData.customSystemMessages[e])return this._wwaData.customSystemMessages[e];let t=_[e];if(t.mapdataParams)switch(t.mapdataParams.messageArea){case`message`:{let e=this._wwaData.message[t.mapdataParams.index];return e===``?t.defaultText:e}case`systemMessage`:{let e=this._wwaData.systemMessage[t.mapdataParams.index];return e===``?t.defaultText:e}default:throw Error(`システムエラー: システムメッセージの設定がおかしいようです`)}return t.defaultText}resolveSystemMessage(e){let t=this._loadSystemMessage(e);switch(e){case g.ITEM_SELECT_TUTORIAL:return t.replaceAll(`%HOW_TO_USE_ITEM%`,(()=>{switch(this.userDevice.device){case re.PC:return`右のボックスを選択する`;case re.VR:return`右のボックスをクリックする`;case re.SP:return`右のボックスをタップする`;case re.GAME:switch(this.userDevice.os){case ne.NINTENDO:return`Xボタンを押すか、右のボックスをタップする`;case ne.PLAY_STATION:return`△ボタンを押す`;case ne.XBOX:return`Yボタンを押す`;default:return`右のボックスを選択する`}default:return`右のボックスを選択する`}})());case g.GAME_SPEED_CHANGED:{let e=this._player.getSpeedIndex();return t.replaceAll(`%GAME_SPEED_NAME%`,fe[e]).replaceAll(`%HIGH_SPEED_MESSAGE%`,this.isBattleSpeedIndexForQuickBattle(e)?`戦闘も速くなります。
|
|
210
|
-
`:``).replaceAll(`%MAX_SPEED_INDEX%`,String(R.MAX_SPEED_INDEX+1)).replaceAll(`%GAME_SPEED_INDEX%`,String(e+1)).replaceAll(`%SPEED_UP_BUTTON%`,this.userDevice.os===ne.NINTENDO?`+ボタン`:`Pキー`).replaceAll(`%SPEED_DOWN_BUTTON%`,this.userDevice.os===ne.NINTENDO?`-ボタン`:`Iキー`)}default:return t}}overwriteSystemMessage(e,t){this._wwaData.customSystemMessages[e]=t}manualPause(e,t=!1){this._player.setManualPause(e,t)}cancelManualPause(){this._player.clearWaitingMessageOrManualPause()}},yc=!1;function bc(e,t){if(e===null)return;let n=document.createElement(`button`);n.classList.add(`wwa-virtualpad-toggle-button`),n.textContent=`仮想パッド表示切り替え`,n.addEventListener(`click`,t),e.appendChild(n)}function xc(e){if(e===null)return;let t=document.createElement(`section`);t.setAttribute(`id`,`wwa-debug-console`);let n=document.createElement(`textarea`);n.setAttribute(`rows`,`10`),n.setAttribute(`cols`,`60`),n.textContent=`v["money"] = 100;
|
|
210
|
+
`:``).replaceAll(`%MAX_SPEED_INDEX%`,String(R.MAX_SPEED_INDEX+1)).replaceAll(`%GAME_SPEED_INDEX%`,String(e+1)).replaceAll(`%SPEED_UP_BUTTON%`,this.userDevice.os===ne.NINTENDO?`+ボタン`:`Pキー`).replaceAll(`%SPEED_DOWN_BUTTON%`,this.userDevice.os===ne.NINTENDO?`-ボタン`:`Iキー`)}default:return t}}overwriteSystemMessage(e,t){this._wwaData.customSystemMessages[e]=t}manualPause(e,t=!1){this._player.setManualPause(e,t)}cancelManualPause(){this._player.clearWaitingMessageOrManualPause()}disableBattleEstimate(e){this._wwaData.battleEstimateDisabled=e}},yc=!1;function bc(e,t){if(e===null)return;let n=document.createElement(`button`);n.classList.add(`wwa-virtualpad-toggle-button`),n.textContent=`仮想パッド表示切り替え`,n.addEventListener(`click`,t),e.appendChild(n)}function xc(e){if(e===null)return;let t=document.createElement(`section`);t.setAttribute(`id`,`wwa-debug-console`);let n=document.createElement(`textarea`);n.setAttribute(`rows`,`10`),n.setAttribute(`cols`,`60`),n.textContent=`v["money"] = 100;
|
|
211
211
|
v["name"] = "ヤツロウ";
|
|
212
212
|
MSG(v["name"]+"「俺の所持金は"+v["money"]+"ゴールドだ」");
|
|
213
213
|
for(LP[0]=0; LP[0]<2; LP[0]++) {
|