diff --git a/_server/table/comment.js b/_server/table/comment.js index 3cf5699..d35742e 100644 --- a/_server/table/comment.js +++ b/_server/table/comment.js @@ -368,7 +368,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "_docs": "退化扣防", "_data": "退化时勇士下降的防御力点数" }, - "damage": { + "damage2": { "_leaf": true, "_type": "textarea", "_range": "thiseval==~~thiseval||thiseval==null", diff --git a/project/data.js b/project/data.js index d049221..77d7812 100644 --- a/project/data.js +++ b/project/data.js @@ -37,6 +37,9 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = ], "floorPartitions": [], "images": [ + "005-Attack03.webp", + "012-Heal01.webp", + "015-Fire01.webp", "HPGaugeEnemy_A.webp", "HPGaugeEnemy_B.webp", "LOGO.webp", @@ -784,6 +787,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = "tati_120128.webp", "tati_120131.webp", "tati_120132.webp", + "tati_310101.webp", "tati_340101.webp", "tati_340101a.webp", "tati_340101y.webp", diff --git a/project/enemys.js b/project/enemys.js index 8c80082..d1ff382 100644 --- a/project/enemys.js +++ b/project/enemys.js @@ -1,7 +1,7 @@ var enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80 = { - "greenSlime": {"name":"绿头怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0,"magic":false,"mdef":0}, - "redSlime": {"name":"红头怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[],"value":10,"magic":false}, + "greenSlime": {"name":"绿头怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0,"mdef":0}, + "redSlime": {"name":"红头怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[],"value":10}, "blackSlime": {"name":"青头怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0}, "slimelord": {"name":"怪王","hp":100,"atk":120,"def":0,"money":10,"exp":0,"point":0,"special":[1,9]}, "bat": {"name":"小蝙蝠","hp":100,"atk":120,"def":0,"money":2,"exp":0,"point":0,"special":[1],"mdef":0,"speed":15}, @@ -10,9 +10,9 @@ var enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80 = "vampire": {"name":"冥灵魔王","hp":888,"atk":888,"def":888,"money":888,"exp":888,"point":0,"special":[6],"n":8}, "skeleton": {"name":"骷髅人","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0}, "skeletonCaptain": {"name":"骷髅队长","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0}, - "zombie": {"name":"兽人","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0,"magic":false}, - "zombieKnight": {"name":"兽人武士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0}, - "rock": {"name":"石头人","hp":50,"atk":50,"def":0,"money":3,"exp":0,"point":0,"special":3}, + "zombie": {"name":"兽人","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[22]}, + "zombieKnight": {"name":"兽人武士","hp":10000,"atk":100,"def":100,"money":0,"exp":0,"point":0,"special":[22],"speed":10,"mdef":0,"damage2":20}, + "rock": {"name":"石头人","hp":50,"atk":50,"def":0,"money":3,"exp":0,"point":0,"special":3,"damage2":15}, "bluePriest": {"name":"初级法师","hp":100,"atk":120,"def":0,"money":3,"exp":0,"point":1,"special":[9]}, "redPriest": {"name":"高级法师","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0}, "brownWizard": {"name":"初级巫师","hp":100,"atk":120,"def":0,"money":16,"exp":0,"point":0,"special":15,"value":100,"range":2}, diff --git a/project/events.js b/project/events.js index 71a864c..5b639ae 100644 --- a/project/events.js +++ b/project/events.js @@ -10763,6 +10763,518 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = "stopbefore": false } ] + }, + { + "type": "setanimate", + "name": "Fire01", + "px": 48, + "py": 48, + "width": 192, + "height": 192, + "allFarme": 15, + "imageList": [ + { + "image": "015-Fire01.webp", + "beforefarme": 0, + "globalAlpha": 100, + "cx": 192, + "cy": 0, + "cw": 192, + "ch": 192, + "x": 0, + "y": 0, + "w": 96, + "h": 96, + "afterfarme": 3, + "acx": 192, + "acy": 0, + "acw": 192, + "ach": 192, + "ax": 0, + "ay": 0, + "aw": 96, + "ah": 96 + }, + { + "image": "015-Fire01.webp", + "beforefarme": 4, + "globalAlpha": 100, + "cx": 384, + "cy": 0, + "cw": 192, + "ch": 192, + "x": 0, + "y": 0, + "w": 96, + "h": 96, + "afterfarme": 6, + "acx": 384, + "acy": 0, + "acw": 192, + "ach": 192, + "ax": 0, + "ay": 0, + "aw": 96, + "ah": 96 + }, + { + "image": "015-Fire01.webp", + "beforefarme": 7, + "globalAlpha": 100, + "cx": 576, + "cy": 0, + "cw": 192, + "ch": 192, + "x": 0, + "y": 0, + "w": 96, + "h": 96, + "afterfarme": 9, + "acx": 576, + "acy": 0, + "acw": 192, + "ach": 192, + "ax": 0, + "ay": 0, + "aw": 96, + "ah": 96 + }, + { + "image": "015-Fire01.webp", + "beforefarme": 10, + "globalAlpha": 100, + "cx": 768, + "cy": 0, + "cw": 192, + "ch": 192, + "x": 0, + "y": 0, + "w": 96, + "h": 96, + "afterfarme": 12, + "acx": 768, + "acy": 0, + "acw": 192, + "ach": 192, + "ax": 0, + "ay": 0, + "aw": 96, + "ah": 96 + }, + { + "image": "015-Fire01.webp", + "beforefarme": 13, + "globalAlpha": 100, + "cx": 960, + "cy": 0, + "cw": 192, + "ch": 192, + "x": 0, + "y": 0, + "w": 96, + "h": 96, + "afterfarme": 15, + "acx": 960, + "acy": 0, + "acw": 192, + "ach": 192, + "ax": 0, + "ay": 0, + "aw": 96, + "ah": 96 + } + ], + "soundList": [ + { + "sound": "", + "startfarme": 0, + "stopbefore": false + } + ] + }, + { + "type": "setanimate", + "name": "Fire02", + "px": 48, + "py": 48, + "width": 192, + "height": 192, + "allFarme": 15, + "imageList": [ + { + "image": "015-Fire01.webp", + "beforefarme": 0, + "globalAlpha": 100, + "cx": 192, + "cy": 192, + "cw": 192, + "ch": 192, + "x": 0, + "y": 0, + "w": 96, + "h": 96, + "afterfarme": 3, + "acx": 192, + "acy": 192, + "acw": 192, + "ach": 192, + "ax": 0, + "ay": 0, + "aw": 96, + "ah": 96 + }, + { + "image": "015-Fire01.webp", + "beforefarme": 4, + "globalAlpha": 100, + "cx": 384, + "cy": 192, + "cw": 192, + "ch": 192, + "x": 0, + "y": 0, + "w": 96, + "h": 96, + "afterfarme": 6, + "acx": 384, + "acy": 192, + "acw": 192, + "ach": 192, + "ax": 0, + "ay": 0, + "aw": 96, + "ah": 96 + }, + { + "image": "015-Fire01.webp", + "beforefarme": 7, + "globalAlpha": 100, + "cx": 576, + "cy": 192, + "cw": 192, + "ch": 192, + "x": 0, + "y": 0, + "w": 96, + "h": 96, + "afterfarme": 9, + "acx": 576, + "acy": 192, + "acw": 192, + "ach": 192, + "ax": 0, + "ay": 0, + "aw": 96, + "ah": 96 + }, + { + "image": "015-Fire01.webp", + "beforefarme": 10, + "globalAlpha": 100, + "cx": 768, + "cy": 192, + "cw": 192, + "ch": 192, + "x": 0, + "y": 0, + "w": 96, + "h": 96, + "afterfarme": 12, + "acx": 768, + "acy": 192, + "acw": 192, + "ach": 192, + "ax": 0, + "ay": 0, + "aw": 96, + "ah": 96 + }, + { + "image": "015-Fire01.webp", + "beforefarme": 13, + "globalAlpha": 100, + "cx": 960, + "cy": 192, + "cw": 192, + "ch": 192, + "x": 0, + "y": 0, + "w": 96, + "h": 96, + "afterfarme": 15, + "acx": 960, + "acy": 192, + "acw": 192, + "ach": 192, + "ax": 0, + "ay": 0, + "aw": 96, + "ah": 96 + } + ], + "soundList": [ + { + "sound": "", + "startfarme": 0, + "stopbefore": false + } + ] + }, + { + "type": "setanimate", + "name": "005-Attack03", + "px": 48, + "py": 48, + "width": 192, + "height": 192, + "allFarme": 15, + "imageList": [ + { + "image": "005-Attack03.webp", + "beforefarme": 0, + "globalAlpha": 100, + "cx": 0, + "cy": 0, + "cw": 192, + "ch": 192, + "x": 0, + "y": 0, + "w": 96, + "h": 96, + "afterfarme": 3, + "acx": 0, + "acy": 0, + "acw": 192, + "ach": 192, + "ax": 0, + "ay": 0, + "aw": 96, + "ah": 96 + }, + { + "image": "005-Attack03.webp", + "beforefarme": 4, + "globalAlpha": 100, + "cx": 192, + "cy": 0, + "cw": 192, + "ch": 192, + "x": 0, + "y": 0, + "w": 96, + "h": 96, + "afterfarme": 6, + "acx": 192, + "acy": 0, + "acw": 192, + "ach": 192, + "ax": 0, + "ay": 0, + "aw": 96, + "ah": 96 + }, + { + "image": "005-Attack03.webp", + "beforefarme": 7, + "globalAlpha": 100, + "cx": 384, + "cy": 0, + "cw": 192, + "ch": 192, + "x": 0, + "y": 0, + "w": 96, + "h": 96, + "afterfarme": 9, + "acx": 384, + "acy": 0, + "acw": 192, + "ach": 192, + "ax": 0, + "ay": 0, + "aw": 96, + "ah": 96 + }, + { + "image": "005-Attack03.webp", + "beforefarme": 10, + "globalAlpha": 100, + "cx": 576, + "cy": 0, + "cw": 192, + "ch": 192, + "x": 0, + "y": 0, + "w": 96, + "h": 96, + "afterfarme": 12, + "acx": 576, + "acy": 0, + "acw": 192, + "ach": 192, + "ax": 0, + "ay": 0, + "aw": 96, + "ah": 96 + }, + { + "image": "005-Attack03.webp", + "beforefarme": 13, + "globalAlpha": 100, + "cx": 768, + "cy": 0, + "cw": 192, + "ch": 192, + "x": 0, + "y": 0, + "w": 96, + "h": 96, + "afterfarme": 15, + "acx": 768, + "acy": 0, + "acw": 192, + "ach": 192, + "ax": 0, + "ay": 0, + "aw": 96, + "ah": 96 + } + ], + "soundList": [ + { + "sound": "", + "startfarme": 0, + "stopbefore": false + } + ] + }, + { + "type": "setanimate", + "name": "012-Heal01", + "px": 48, + "py": 48, + "width": 192, + "height": 192, + "allFarme": 15, + "imageList": [ + { + "image": "012-Heal01.webp", + "beforefarme": 0, + "globalAlpha": 100, + "cx": 0, + "cy": 0, + "cw": 192, + "ch": 192, + "x": 0, + "y": 0, + "w": 96, + "h": 96, + "afterfarme": 3, + "acx": 0, + "acy": 0, + "acw": 192, + "ach": 192, + "ax": 0, + "ay": 0, + "aw": 96, + "ah": 96 + }, + { + "image": "012-Heal01.webp", + "beforefarme": 4, + "globalAlpha": 100, + "cx": 192, + "cy": 0, + "cw": 192, + "ch": 192, + "x": 0, + "y": 0, + "w": 96, + "h": 96, + "afterfarme": 6, + "acx": 192, + "acy": 0, + "acw": 192, + "ach": 192, + "ax": 0, + "ay": 0, + "aw": 96, + "ah": 96 + }, + { + "image": "012-Heal01.webp", + "beforefarme": 7, + "globalAlpha": 100, + "cx": 384, + "cy": 0, + "cw": 192, + "ch": 192, + "x": 0, + "y": 0, + "w": 96, + "h": 96, + "afterfarme": 9, + "acx": 384, + "acy": 0, + "acw": 192, + "ach": 192, + "ax": 0, + "ay": 0, + "aw": 96, + "ah": 96 + }, + { + "image": "012-Heal01.webp", + "beforefarme": 10, + "globalAlpha": 100, + "cx": 576, + "cy": 0, + "cw": 192, + "ch": 192, + "x": 0, + "y": 0, + "w": 96, + "h": 96, + "afterfarme": 12, + "acx": 576, + "acy": 0, + "acw": 192, + "ach": 192, + "ax": 0, + "ay": 0, + "aw": 96, + "ah": 96 + }, + { + "image": "012-Heal01.webp", + "beforefarme": 13, + "globalAlpha": 100, + "cx": 768, + "cy": 0, + "cw": 192, + "ch": 192, + "x": 0, + "y": 0, + "w": 96, + "h": 96, + "afterfarme": 15, + "acx": 768, + "acy": 0, + "acw": 192, + "ach": 192, + "ax": 0, + "ay": 0, + "aw": 96, + "ah": 96 + } + ], + "soundList": [ + { + "sound": "", + "startfarme": 0, + "stopbefore": false + } + ] } ] }, diff --git a/project/images/tati_310101.webp b/project/images/tati_310101.webp new file mode 100644 index 0000000..e5a5dce Binary files /dev/null and b/project/images/tati_310101.webp differ diff --git a/project/plugins.js b/project/plugins.js index 8aad116..b93a7b2 100644 --- a/project/plugins.js +++ b/project/plugins.js @@ -2523,1218 +2523,1240 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = })(); }, "statusBar": function () { - main.dom.floorMsgGroup.style.display = "none"; - main.dom.statusBar.style.display = "none"; - main.dom.toolBar.style.display = "none"; - //所有数据*3是为了实现高清画布 - const GAMEVIEW_WIDTH = 676 * 3; //横屏画面宽度 - const GAMEVIEW_HEIGHT = 416 * 3; //横屏画面高度 + main.dom.floorMsgGroup.style.display = "none"; + main.dom.statusBar.style.display = "none"; + main.dom.toolBar.style.display = "none"; + //所有数据*3是为了实现高清画布 + const GAMEVIEW_WIDTH = 676 * 3; //横屏画面宽度 + const GAMEVIEW_HEIGHT = 416 * 3; //横屏画面高度 - const GAMEVIEW_WIDTH_VERTICAL = 416 * 3; //竖屏画面宽度 - const GAMEVIEW_HEIGHT_VERTICAL = 676 * 3; //竖屏画面高度 + const GAMEVIEW_WIDTH_VERTICAL = 416 * 3; //竖屏画面宽度 + const GAMEVIEW_HEIGHT_VERTICAL = 676 * 3; //竖屏画面高度 - const BAR_WIDTH = 130 * 3; //横屏左侧额外距离(即边栏宽度) - const BAR_HEIGHT_VERTICAL = 130 * 3; //竖屏上侧额外距离(即边栏高度) - const BORDER_WIDTH = 0; //游戏画面左侧偏移距离 - const BORDER_HEIGHT = 0; //游戏画面上侧偏移距离 + const BAR_WIDTH = 130 * 3; //横屏左侧额外距离(即边栏宽度) + const BAR_HEIGHT_VERTICAL = 130 * 3; //竖屏上侧额外距离(即边栏高度) + const BORDER_WIDTH = 0; //游戏画面左侧偏移距离 + const BORDER_HEIGHT = 0; //游戏画面上侧偏移距离 - const ITEM_BOX_LEFT = 549 * 3; //横屏道具栏左侧距离(右侧边栏需增加BAR_WIDTH+GAMEVIEW_HEIGHT) - const ITEM_BOX_TOP = 155 * 3; //横屏道具栏上侧距离 - const ITEM_BOX_LEFT_VERTICAL = 160 * 3; //竖屏道具栏左侧距离 - const ITEM_BOX_TOP_VERTICAL = 549 * 3; //竖屏道具栏上侧距离(下侧边栏需增加BAR_HEIGHT_VERTICAL+GAMEVIEW_WIDTH_VERTICAL) + const ITEM_BOX_LEFT = 549 * 3; //横屏道具栏左侧距离(右侧边栏需增加BAR_WIDTH+GAMEVIEW_HEIGHT) + const ITEM_BOX_TOP = 155 * 3; //横屏道具栏上侧距离 + const ITEM_BOX_LEFT_VERTICAL = 160 * 3; //竖屏道具栏左侧距离 + const ITEM_BOX_TOP_VERTICAL = 549 * 3; //竖屏道具栏上侧距离(下侧边栏需增加BAR_HEIGHT_VERTICAL+GAMEVIEW_WIDTH_VERTICAL) - const EQUIP_BLOCK_LEFT = 549 * 3; //横屏装备栏左侧距离(右侧边栏需增加BAR_WIDTH+GAMEVIEW_HEIGHT) - const EQUIP_BLOCK_TOP = 10 * 3; //横屏装备栏上侧距离 - const EQUIP_BLOCK_LEFT_VERTICAL = 10 * 3; //竖屏装备栏左侧距离 - const EQUIP_BLOCK_TOP_VERTICAL = 549 * 3; //竖屏装备栏上侧距离(下侧边栏需增加BAR_HEIGHT_VERTICAL+GAMEVIEW_WIDTH_VERTICAL) + const EQUIP_BLOCK_LEFT = 549 * 3; //横屏装备栏左侧距离(右侧边栏需增加BAR_WIDTH+GAMEVIEW_HEIGHT) + const EQUIP_BLOCK_TOP = 10 * 3; //横屏装备栏上侧距离 + const EQUIP_BLOCK_LEFT_VERTICAL = 10 * 3; //竖屏装备栏左侧距离 + const EQUIP_BLOCK_TOP_VERTICAL = 549 * 3; //竖屏装备栏上侧距离(下侧边栏需增加BAR_HEIGHT_VERTICAL+GAMEVIEW_WIDTH_VERTICAL) - const MAP_BLOCK_LEFT = 551 * 3; //横屏小地图左侧距离(右侧边栏需增加BAR_WIDTH+GAMEVIEW_HEIGHT) - const MAP_BLOCK_TOP = 0; //横屏小地图上侧距离 - const MAP_BLOCK_LEFT_VERTICAL = 0; //竖屏小地图左侧距离 - const MAP_BLOCK_TOP_VERTICAL = 551 * 3; //竖屏小地图上侧距离(下侧边栏需增加BAR_HEIGHT_VERTICAL+GAMEVIEW_WIDTH_VERTICAL) + const MAP_BLOCK_LEFT = 551 * 3; //横屏小地图左侧距离(右侧边栏需增加BAR_WIDTH+GAMEVIEW_HEIGHT) + const MAP_BLOCK_TOP = 0; //横屏小地图上侧距离 + const MAP_BLOCK_LEFT_VERTICAL = 0; //竖屏小地图左侧距离 + const MAP_BLOCK_TOP_VERTICAL = 551 * 3; //竖屏小地图上侧距离(下侧边栏需增加BAR_HEIGHT_VERTICAL+GAMEVIEW_WIDTH_VERTICAL) - const KEY_BLOCK_LEFT = EQUIP_BLOCK_LEFT; //横屏钥匙栏左侧距离(右侧边栏需增加BAR_WIDTH+GAMEVIEW_HEIGHT) - const KEY_BLOCK_TOP = 110 * 3; //横屏钥匙栏上侧距离 - const KEY_BLOCK_LEFT_VERTICAL = 110 * 3; //竖屏钥匙栏左侧距离 - const KEY_BLOCK_TOP_VERTICAL = EQUIP_BLOCK_TOP_VERTICAL; //竖屏钥匙栏上侧距离(下侧边栏需增加BAR_HEIGHT_VERTICAL+GAMEVIEW_WIDTH_VERTICAL) + const KEY_BLOCK_LEFT = EQUIP_BLOCK_LEFT; //横屏钥匙栏左侧距离(右侧边栏需增加BAR_WIDTH+GAMEVIEW_HEIGHT) + const KEY_BLOCK_TOP = 110 * 3; //横屏钥匙栏上侧距离 + const KEY_BLOCK_LEFT_VERTICAL = 110 * 3; //竖屏钥匙栏左侧距离 + const KEY_BLOCK_TOP_VERTICAL = EQUIP_BLOCK_TOP_VERTICAL; //竖屏钥匙栏上侧距离(下侧边栏需增加BAR_HEIGHT_VERTICAL+GAMEVIEW_WIDTH_VERTICAL) - const INFO_BLOCK_LEFT = 10 * 3; //横屏道具说明左侧距离(右侧边栏需增加BAR_WIDTH+GAMEVIEW_HEIGHT) - const INFO_BLOCK_TOP = 180 * 3; //横屏道具说明上侧距离 - const INFO_BLOCK_LEFT_VERTICAL = 113 * 3; //竖屏道具说明左侧距离 - const INFO_BLOCK_TOP_VERTICAL = 8 * 3; //竖屏道具说明上侧距离(下侧边栏需增加BAR_HEIGHT_VERTICAL+GAMEVIEW_WIDTH_VERTICAL) + const INFO_BLOCK_LEFT = 10 * 3; //横屏道具说明左侧距离(右侧边栏需增加BAR_WIDTH+GAMEVIEW_HEIGHT) + const INFO_BLOCK_TOP = 180 * 3; //横屏道具说明上侧距离 + const INFO_BLOCK_LEFT_VERTICAL = 113 * 3; //竖屏道具说明左侧距离 + const INFO_BLOCK_TOP_VERTICAL = 8 * 3; //竖屏道具说明上侧距离(下侧边栏需增加BAR_HEIGHT_VERTICAL+GAMEVIEW_WIDTH_VERTICAL) - const TOOL_BOX_LEFT = EQUIP_BLOCK_LEFT; //横屏工具栏左侧距离(右侧边栏需增加BAR_WIDTH+GAMEVIEW_HEIGHT) - const TOOL_BOX_TOP = 348 * 3; //横屏工具栏上侧距离 - const TOOL_BOX_LEFT_VERTICAL = 348 * 3; //竖屏工具栏左侧距离 - const TOOL_BOX_TOP_VERTICAL = 549 * 3; //竖屏工具栏上侧距离(下侧边栏需增加BAR_HEIGHT_VERTICAL+GAMEVIEW_WIDTH_VERTICAL) + const TOOL_BOX_LEFT = EQUIP_BLOCK_LEFT; //横屏工具栏左侧距离(右侧边栏需增加BAR_WIDTH+GAMEVIEW_HEIGHT) + const TOOL_BOX_TOP = 348 * 3; //横屏工具栏上侧距离 + const TOOL_BOX_LEFT_VERTICAL = 348 * 3; //竖屏工具栏左侧距离 + const TOOL_BOX_TOP_VERTICAL = 549 * 3; //竖屏工具栏上侧距离(下侧边栏需增加BAR_HEIGHT_VERTICAL+GAMEVIEW_WIDTH_VERTICAL) - const TOOL_ICON_OUTER_SIZE = 34 * 3; + const TOOL_ICON_OUTER_SIZE = 34 * 3; - const TEXT_COLOR = "#FFFFFF"; //默认文字颜色 - const globalAlpha = 0.7; //默认底框透明度 - const FORCE_COUNTABLE_ITEMS = ["centerFly"]; //常态显示数量的非永久道具,如果道具不在此数组中,则只有道具多余1时显示数量 + const TEXT_COLOR = "#FFFFFF"; //默认文字颜色 + const globalAlpha = 0.7; //默认底框透明度 + const FORCE_COUNTABLE_ITEMS = ["centerFly"]; //常态显示数量的非永久道具,如果道具不在此数组中,则只有道具多余1时显示数量 - const outerBackground = document.createElement("canvas"); //背景画布设置 - let globalAlphafloor = 0, - globalAlphafloorStatus = 4; - outerBackground.style.position = "absolute"; - outerBackground.style.zIndex = 5; - outerBackground.id = "outerBackground"; - main.dom.outerBackground = outerBackground; - main.dom.startPanel.insertAdjacentElement("afterend", outerBackground); + const outerBackground = document.createElement("canvas"); //背景画布设置 + let globalAlphafloor = 0, + globalAlphafloorStatus = 4; + outerBackground.style.position = "absolute"; + outerBackground.style.zIndex = 5; + outerBackground.id = "outerBackground"; + main.dom.outerBackground = outerBackground; + main.dom.startPanel.insertAdjacentElement("afterend", outerBackground); - const outerUI = document.createElement("canvas"); //额外ui画布设置(状态栏所有绘制、点击都在额外ui上) - outerUI.style.position = "absolute"; - outerUI.style.zIndex = 165; - outerUI.id = "outerUI"; + const outerUI = document.createElement("canvas"); //额外ui画布设置(状态栏所有绘制、点击都在额外ui上) + outerUI.style.position = "absolute"; + outerUI.style.zIndex = 165; + outerUI.id = "outerUI"; - main.dom.outerUI = outerUI; - outerBackground.insertAdjacentElement("afterend", outerUI); - setTimeout(function () { - // Should be executed immediately after init() - main.canvas.outerUI = outerUI.getContext("2d"); - }); - outerUI.onclick = function (e) { - try { - e.preventDefault(); - if (!core.isPlaying()) return false; - const left = core.dom.gameGroup.offsetLeft; - const top = core.dom.gameGroup.offsetTop; - const px = Math.floor((e.clientX - left) / core.domStyle.scale), - py = Math.floor((e.clientY - top) / core.domStyle.scale); - core.ui.statusBar.onclick(px * 3, py * 3); - } catch (ee) { - main.log(ee); - } - }; + main.dom.outerUI = outerUI; + outerBackground.insertAdjacentElement("afterend", outerUI); + setTimeout(function () { + // Should be executed immediately after init() + main.canvas.outerUI = outerUI.getContext("2d"); + }); + outerUI.onclick = function (e) { + try { + e.preventDefault(); + if (!core.isPlaying()) return false; + const left = core.dom.gameGroup.offsetLeft; + const top = core.dom.gameGroup.offsetTop; + const px = Math.floor((e.clientX - left) / core.domStyle.scale), + py = Math.floor((e.clientY - top) / core.domStyle.scale); + core.ui.statusBar.onclick(px * 3, py * 3); + } catch (ee) { + main.log(ee); + } + }; - const _resize_gameGroup = function (obj) { - //游戏画面自适应调节 - const gameGroup = core.dom.gameGroup; - gameGroup.style.width = obj.totalWidth + "px"; - gameGroup.style.height = obj.totalHeight + "px"; - gameGroup.style.left = (obj.clientWidth - obj.totalWidth) / 2 + "px"; - gameGroup.style.top = (obj.clientHeight - obj.totalHeight) / 2 + "px"; - //floorMsgGroup为切换楼层中生效,显示时间可通过‘全塔属性’——‘切换楼层时间’或游戏内设置调整 - //显示内容为游戏名/版本号/楼层名 - // floorMsgGroup - var floorMsgGroup = core.dom.floorMsgGroup; - var globalAttribute = - core.status.globalAttribute || core.initStatus.globalAttribute; - floorMsgGroup.style = globalAttribute.floorChangingStyle; - floorMsgGroup.style.height = floorMsgGroup.style.width = - (GAMEVIEW_HEIGHT / 3) * core.domStyle.scale + "px"; - floorMsgGroup.style.fontSize = 16 * core.domStyle.scale + "px"; + const _resize_gameGroup = function (obj) { + //游戏画面自适应调节 + const gameGroup = core.dom.gameGroup; + gameGroup.style.width = obj.totalWidth + "px"; + gameGroup.style.height = obj.totalHeight + "px"; + gameGroup.style.left = (obj.clientWidth - obj.totalWidth) / 2 + "px"; + gameGroup.style.top = (obj.clientHeight - obj.totalHeight) / 2 + "px"; + //floorMsgGroup为切换楼层中生效,显示时间可通过‘全塔属性’——‘切换楼层时间’或游戏内设置调整 + //显示内容为游戏名/版本号/楼层名 + // floorMsgGroup + var floorMsgGroup = core.dom.floorMsgGroup; + var globalAttribute = + core.status.globalAttribute || core.initStatus.globalAttribute; + floorMsgGroup.style = globalAttribute.floorChangingStyle; + floorMsgGroup.style.height = floorMsgGroup.style.width = + (GAMEVIEW_HEIGHT / 3) * core.domStyle.scale + "px"; + floorMsgGroup.style.fontSize = 16 * core.domStyle.scale + "px"; - if (core.domStyle.isVertical) { - floorMsgGroup.style.left = "0px"; - floorMsgGroup.style.top = - ((GAMEVIEW_HEIGHT_VERTICAL / 3 - GAMEVIEW_WIDTH_VERTICAL / 3) * - core.domStyle.scale) / - 2 + - "px"; - } else { - floorMsgGroup.style.left = - ((GAMEVIEW_WIDTH / 3 - GAMEVIEW_HEIGHT / 3) * core.domStyle.scale) / - 2 + - "px"; - floorMsgGroup.style.top = "0px"; - } - core.dom.musicBtn.style.right = - (obj.clientWidth - obj.totalWidth) / 2 + "px"; - core.dom.musicBtn.style.bottom = - (obj.clientHeight - obj.totalHeight) / 2 - 27 + "px"; - let startBackground = core.domStyle.isVertical - ? main.styles.startVerticalBackground || main.styles.startBackground - : main.styles.startBackground; - if (main.dom.startBackground.getAttribute("__src__") != startBackground) { - main.dom.startBackground.setAttribute("__src__", startBackground); - main.dom.startBackground.src = startBackground; - } - const span = document - .getElementById("startButtons") - .getElementsByTagName("span"); - let font = (GAMEVIEW_WIDTH / 100) * core.domStyle.scale; - if (core.domStyle.isVertical) - font = ((GAMEVIEW_WIDTH_VERTICAL * 2) / 100) * core.domStyle.scale; + if (core.domStyle.isVertical) { + floorMsgGroup.style.left = "0px"; + floorMsgGroup.style.top = + ((GAMEVIEW_HEIGHT_VERTICAL / 3 - GAMEVIEW_WIDTH_VERTICAL / 3) * + core.domStyle.scale) / + 2 + + "px"; + } else { + floorMsgGroup.style.left = + ((GAMEVIEW_WIDTH / 3 - GAMEVIEW_HEIGHT / 3) * core.domStyle.scale) / + 2 + + "px"; + floorMsgGroup.style.top = "0px"; + } + core.dom.musicBtn.style.right = + (obj.clientWidth - obj.totalWidth) / 2 + "px"; + core.dom.musicBtn.style.bottom = + (obj.clientHeight - obj.totalHeight) / 2 - 27 + "px"; + let startBackground = core.domStyle.isVertical ? + main.styles.startVerticalBackground || main.styles.startBackground : + main.styles.startBackground; + if (main.dom.startBackground.getAttribute("__src__") != startBackground) { + main.dom.startBackground.setAttribute("__src__", startBackground); + main.dom.startBackground.src = startBackground; + } + const span = document + .getElementById("startButtons") + .getElementsByTagName("span"); + let font = (GAMEVIEW_WIDTH / 100) * core.domStyle.scale; + if (core.domStyle.isVertical) + font = ((GAMEVIEW_WIDTH_VERTICAL * 2) / 100) * core.domStyle.scale; - core.dom.playGame.style.fontSize = font + "px"; - core.dom.loadGame.style.fontSize = font + "px"; - core.dom.CGMode.style.fontSize = font + "px"; - core.dom.musicMode.style.fontSize = font + "px"; - core.dom.replayGame.style.fontSize = font + "px"; - core.dom.startButtonGroup.style.padding = font * 0.3 + "px 25px"; - }; - const _resize_canvas = function (obj) { - //自适应画布 - main.dom.outerBackground.style.width = obj.totalWidth + "px"; - main.dom.outerBackground.style.height = obj.totalHeight + "px"; - main.dom.outerUI.style.width = obj.totalWidth + "px"; - main.dom.outerUI.style.height = obj.totalHeight + "px"; - if (main.dom.CGUI) { - main.dom.CGUI.style.width = obj.totalWidth + 3 + "px"; - main.dom.CGUI.style.height = obj.totalHeight + 3 + "px"; - } - if (main.dom.music) { - main.dom.music.style.width = obj.totalWidth + 3 + "px"; - main.dom.music.style.height = obj.totalHeight + 3 + "px"; - } - if (main.dom.cgText) { - main.dom.cgText.style.width = obj.totalWidth + 3 + "px"; - main.dom.cgText.style.height = obj.totalHeight + 3 + "px"; - } - if (main.dom.logcanvas) { - main.dom.logcanvas.style.width = obj.totalWidth + 3 + "px"; - main.dom.logcanvas.style.height = obj.totalHeight + 3 + "px"; - } - if (main.dom.over) { - main.dom.over.style.width = obj.totalWidth + 3 + "px"; - main.dom.over.style.height = obj.totalHeight + 3 + "px"; - } - if (main.dom.video) { - main.dom.video.style.width = obj.totalWidth + 3 + "px"; - main.dom.video.style.height = obj.totalHeight + 3 + "px"; - if (core.domStyle.isVertical) - main.dom.video.style.width = obj.totalHeight + 3 + "px"; - if (core.domStyle.isVertical) - main.dom.video.style.height = obj.totalWidth + 3 + "px"; - main.dom.video.style.top = "50%"; - main.dom.video.style.left = "50%"; + core.dom.playGame.style.fontSize = font + "px"; + core.dom.loadGame.style.fontSize = font + "px"; + core.dom.CGMode.style.fontSize = font + "px"; + core.dom.musicMode.style.fontSize = font + "px"; + core.dom.replayGame.style.fontSize = font + "px"; + core.dom.startButtonGroup.style.padding = font * 0.3 + "px 25px"; + }; + const _resize_canvas = function (obj) { + //自适应画布 + main.dom.outerBackground.style.width = obj.totalWidth + "px"; + main.dom.outerBackground.style.height = obj.totalHeight + "px"; + main.dom.outerUI.style.width = obj.totalWidth + "px"; + main.dom.outerUI.style.height = obj.totalHeight + "px"; + if (main.dom.CGUI) { + main.dom.CGUI.style.width = obj.totalWidth + 3 + "px"; + main.dom.CGUI.style.height = obj.totalHeight + 3 + "px"; + } + if (main.dom.music) { + main.dom.music.style.width = obj.totalWidth + 3 + "px"; + main.dom.music.style.height = obj.totalHeight + 3 + "px"; + } + if (main.dom.cgText) { + main.dom.cgText.style.width = obj.totalWidth + 3 + "px"; + main.dom.cgText.style.height = obj.totalHeight + 3 + "px"; + } + if (main.dom.logcanvas) { + main.dom.logcanvas.style.width = obj.totalWidth + 3 + "px"; + main.dom.logcanvas.style.height = obj.totalHeight + 3 + "px"; + } + if (main.dom.over) { + main.dom.over.style.width = obj.totalWidth + 3 + "px"; + main.dom.over.style.height = obj.totalHeight + 3 + "px"; + } + if (main.dom.video) { + main.dom.video.style.width = obj.totalWidth + 3 + "px"; + main.dom.video.style.height = obj.totalHeight + 3 + "px"; + if (core.domStyle.isVertical) + main.dom.video.style.width = obj.totalHeight + 3 + "px"; + if (core.domStyle.isVertical) + main.dom.video.style.height = obj.totalWidth + 3 + "px"; + main.dom.video.style.top = "50%"; + main.dom.video.style.left = "50%"; - main.dom.video.style.transform = "translate(-50%,-50%)"; + main.dom.video.style.transform = "translate(-50%,-50%)"; - if (core.domStyle.isVertical) - main.dom.video.style.transform = "translate(-50%,-50%) rotate(90deg)"; - } - if (main.dom.video1) { - main.dom.video1.style.width = obj.totalWidth + 3 + "px"; - main.dom.video1.style.height = obj.totalHeight + 3 + "px"; - } + if (core.domStyle.isVertical) + main.dom.video.style.transform = "translate(-50%,-50%) rotate(90deg)"; + } + if (main.dom.video1) { + main.dom.video1.style.width = obj.totalWidth + 3 + "px"; + main.dom.video1.style.height = obj.totalHeight + 3 + "px"; + } - const innerSize = obj.canvasWidth * core.domStyle.scale + "px"; - for (let i = 0; i < core.dom.gameCanvas.length; ++i) - core.dom.gameCanvas[i].style.width = core.dom.gameCanvas[ - i - ].style.height = innerSize; - core.dom.gif.style.width = core.dom.gif.style.height = innerSize; - core.dom.gif2.style.width = core.dom.gif2.style.height = innerSize; + main.dom.boss1.style.width = obj.totalWidth + 3 + "px"; + main.dom.boss1.style.height = obj.totalHeight + 3 + "px"; - core.dom.gameDraw.style.width = core.dom.gameDraw.style.height = - innerSize; - core.dom.gameDraw.style.top = - obj.gameDrawBox.top * core.domStyle.scale + "px"; - core.dom.gameDraw.style.left = - obj.gameDrawBox.left * core.domStyle.scale + "px"; - // resize bigmap - core.bigmap.canvas.forEach(function (cn) { - const ratio = core.canvas[cn].canvas.hasAttribute("isHD") - ? core.domStyle.ratio - : 1; - core.canvas[cn].canvas.style.width = - (innerSize / ratio) * core.domStyle.scale + "px"; - core.canvas[cn].canvas.style.height = - (innerSize / ratio) * core.domStyle.scale + "px"; - }); - // resize dynamic canvas - for (const name in core.dymCanvas) { - const ctx = core.dymCanvas[name], - canvas = ctx.canvas; - const ratio = canvas.hasAttribute("isHD") ? core.domStyle.ratio : 1; - canvas.style.width = (innerSize / ratio) * core.domStyle.scale + "px"; - canvas.style.height = (innerSize / ratio) * core.domStyle.scale + "px"; - canvas.style.left = - parseFloat(canvas.getAttribute("_left")) * core.domStyle.scale + "px"; - canvas.style.top = - parseFloat(canvas.getAttribute("_top")) * core.domStyle.scale + "px"; - } - // resize next - main.dom.next.style.width = main.dom.next.style.height = - 5 * core.domStyle.scale + "px"; - main.dom.next.style.borderBottomWidth = - main.dom.next.style.borderRightWidth = 4 * core.domStyle.scale + "px"; - }; - const bgctx = main.dom.outerBackground.getContext("2d"); - const uictx = main.dom.outerUI.getContext("2d"); - let now = 0; - core.registerAnimationFrame("lightFloor", true, function (timestamp) { - if (timestamp - now > 1000 / 60) { - now = timestamp; - globalAlphafloor += globalAlphafloorStatus; - if (globalAlphafloor === 100) globalAlphafloorStatus = -2; - if (globalAlphafloor === 0) globalAlphafloorStatus = 2; - if (core.domStyle.isVertical) { - core.clearMap( - uictx, - MAP_BLOCK_LEFT_VERTICAL, - MAP_BLOCK_TOP_VERTICAL, - 340, - 360 - ); - if (core.status.event.id === "viewMaps") { - core.ui.statusBar._update_map(core.status.event.data.floorId); - } else { - core.ui.statusBar._update_map(); - } + main.dom.boss2.style.width = obj.totalWidth + 3 + "px"; + main.dom.boss2.style.height = obj.totalHeight + 3 + "px"; - uictx.globalAlpha = globalAlphafloor / 100; - core.drawImage( - uictx, - "green.webp", - MAP_BLOCK_LEFT_VERTICAL + 135, - MAP_BLOCK_TOP_VERTICAL + 170 - ); - uictx.globalAlpha = 1; - } else { - core.clearMap(uictx, MAP_BLOCK_LEFT, MAP_BLOCK_TOP, 340, 360); - if (core.status.event.id === "viewMaps") { - core.ui.statusBar._update_map(core.status.event.data.floorId); - } else { - core.ui.statusBar._update_map(); - } - uictx.globalAlpha = globalAlphafloor / 100; - core.drawImage( - uictx, - "green.webp", - MAP_BLOCK_LEFT + 150, - MAP_BLOCK_TOP + 180 - ); - uictx.globalAlpha = 1; - } - } - }); - core.control.resize = function () { - //自适应,可实现横竖屏切换 - if (main.mode == "editor") return; + main.dom.boss3.style.width = obj.totalWidth + 3 + "px"; + main.dom.boss3.style.height = obj.totalHeight + 3 + "px"; - const clientWidth = main.dom.body.clientWidth, - clientHeight = main.dom.body.clientHeight; - const canvasWidth = core.__PIXELS__; - const isVertical = clientHeight > clientWidth; - core.domStyle.isVertical = isVertical; + main.dom.boss4.style.width = obj.totalWidth + 3 + "px"; + main.dom.boss4.style.height = obj.totalHeight + 3 + "px"; - const totalWidth = isVertical - ? GAMEVIEW_WIDTH_VERTICAL / 3 - : GAMEVIEW_WIDTH / 3, - totalHeight = isVertical - ? GAMEVIEW_HEIGHT_VERTICAL / 3 - : GAMEVIEW_HEIGHT / 3; + main.dom.boss5.style.width = obj.totalWidth + 3 + "px"; + main.dom.boss5.style.height = obj.totalHeight + 3 + "px"; - const maxRatio = Math.min( - clientWidth / totalWidth, - clientHeight / totalHeight - ); + main.dom.boss.style.width = obj.totalWidth + 3 + "px"; + main.dom.boss.style.height = obj.totalHeight + 3 + "px"; - core.domStyle.availableScale = []; - [1, 1.25, 1.5, 1.75, 2].forEach(function (v) { - if (maxRatio >= v) { - core.domStyle.availableScale.push(v); - } - }); + const innerSize = obj.canvasWidth * core.domStyle.scale + "px"; + for (let i = 0; i < core.dom.gameCanvas.length; ++i) + core.dom.gameCanvas[i].style.width = core.dom.gameCanvas[ + i + ].style.height = innerSize; + core.dom.gif.style.width = core.dom.gif.style.height = innerSize; + core.dom.gif2.style.width = core.dom.gif2.style.height = innerSize; - if (core.domStyle.availableScale.indexOf(core.domStyle.scale) < 0) { - core.domStyle.scale = Math.min(1, maxRatio); - } else if ( - core.getLocalStorage("scale") == null && - core.domStyle.availableScale.length >= 2 - ) { - core.domStyle.scale = - core.domStyle.availableScale[core.domStyle.availableScale.length - 2]; - core.setLocalStorage("scale", core.domStyle.scale); - } + core.dom.gameDraw.style.width = core.dom.gameDraw.style.height = + innerSize; + core.dom.gameDraw.style.top = + obj.gameDrawBox.top * core.domStyle.scale + "px"; + core.dom.gameDraw.style.left = + obj.gameDrawBox.left * core.domStyle.scale + "px"; + // resize bigmap + core.bigmap.canvas.forEach(function (cn) { + const ratio = core.canvas[cn].canvas.hasAttribute("isHD") ? + core.domStyle.ratio : + 1; + core.canvas[cn].canvas.style.width = + (innerSize / ratio) * core.domStyle.scale + "px"; + core.canvas[cn].canvas.style.height = + (innerSize / ratio) * core.domStyle.scale + "px"; + }); + // resize dynamic canvas + for (const name in core.dymCanvas) { + const ctx = core.dymCanvas[name], + canvas = ctx.canvas; + const ratio = canvas.hasAttribute("isHD") ? core.domStyle.ratio : 1; + canvas.style.width = (innerSize / ratio) * core.domStyle.scale + "px"; + canvas.style.height = (innerSize / ratio) * core.domStyle.scale + "px"; + canvas.style.left = + parseFloat(canvas.getAttribute("_left")) * core.domStyle.scale + "px"; + canvas.style.top = + parseFloat(canvas.getAttribute("_top")) * core.domStyle.scale + "px"; + } + // resize next + main.dom.next.style.width = main.dom.next.style.height = + 5 * core.domStyle.scale + "px"; + main.dom.next.style.borderBottomWidth = + main.dom.next.style.borderRightWidth = 4 * core.domStyle.scale + "px"; + }; + const bgctx = main.dom.outerBackground.getContext("2d"); + const uictx = main.dom.outerUI.getContext("2d"); + let now = 0; + core.registerAnimationFrame("lightFloor", true, function (timestamp) { + if (timestamp - now > 1000 / 60) { + now = timestamp; + globalAlphafloor += globalAlphafloorStatus; + if (globalAlphafloor === 100) globalAlphafloorStatus = -2; + if (globalAlphafloor === 0) globalAlphafloorStatus = 2; - const totalWidthScaled = totalWidth * core.domStyle.scale, - totalHeightScaled = totalHeight * core.domStyle.scale; + if (core.domStyle.isVertical) { + core.clearMap( + uictx, + MAP_BLOCK_LEFT_VERTICAL, + MAP_BLOCK_TOP_VERTICAL, + 340, + 360 + ); + if (core.status.event.id === "viewMaps") { + core.ui.statusBar._update_map(core.status.event.data.floorId); + } else { + core.ui.statusBar._update_map(); + } - const gameDrawBox = isVertical - ? { - left: BORDER_WIDTH / 3, - top: BAR_HEIGHT_VERTICAL / 3 + BORDER_HEIGHT / 3, - } - : { left: BAR_WIDTH / 3 + BORDER_WIDTH / 3, top: BORDER_HEIGHT / 3 }; + uictx.globalAlpha = globalAlphafloor / 100; + core.drawImage( + uictx, + "green.webp", + MAP_BLOCK_LEFT_VERTICAL + 135, + MAP_BLOCK_TOP_VERTICAL + 170 + ); + uictx.globalAlpha = 1; + } else { + core.clearMap(uictx, MAP_BLOCK_LEFT, MAP_BLOCK_TOP, 340, 360); + if (core.status.event.id === "viewMaps") { + core.ui.statusBar._update_map(core.status.event.data.floorId); + } else { + core.ui.statusBar._update_map(); + } + uictx.globalAlpha = globalAlphafloor / 100; + core.drawImage( + uictx, + "green.webp", + MAP_BLOCK_LEFT + 150, + MAP_BLOCK_TOP + 180 + ); + uictx.globalAlpha = 1; + } + } + }); - const obj = { - clientWidth: clientWidth, - clientHeight: clientHeight, - canvasWidth: canvasWidth, - totalWidth: totalWidthScaled, - totalHeight: totalHeightScaled, - gameDrawBox: gameDrawBox, - globalAttribute: - core.status.globalAttribute || core.initStatus.globalAttribute, - }; + core.control.resize = function () { + //自适应,可实现横竖屏切换 + if (main.mode == "editor") return; - _resize_gameGroup(obj); - _resize_canvas(obj); + const clientWidth = main.dom.body.clientWidth, + clientHeight = main.dom.body.clientHeight; + const canvasWidth = core.__PIXELS__; - if (core.status.automaticRoute == null) core.status.automaticRoute = {}; - core.updateStatusBar(); - if (main.dom.CGUI && main.dom.CGUI.style.display === "block") - core.ui.CG.update(); - if (main.dom.music && main.dom.music.style.display === "block") - core.ui.music.update(); - if (main.dom.cgText && main.dom.cgText.style.display === "block") - core.ui.cgText.update(); - if (main.dom.logcanvas && main.dom.logcanvas.style.display === "block") - core.ui.cgText.update(); - }; + const isVertical = clientHeight > clientWidth; + core.domStyle.isVertical = isVertical; - class StatusBar { - constructor() { - //道具栏列表 - this.itemMx = [ - //空位用‘none’填充,当前ui至多4列6行 - ["book", "wand", "none", "fly"], - ["cross", "superPotion", "pickaxe"], - ["bomb", "centerFly", "upFly"], - ["none", "none", "none"], - ["downFly", "knife", "snow"], - ["bigKey", "earthquake", "coin"], - ]; - } - //初始化内容(工具栏/录像操作执行函数) - init() { - this.toolbarAction = [ - [ - main.core.openKeyBoard, - main.core.openQuickShop, - core.openToolbox, - core.doSL, - ], - [main.core.openSettings, main.core.save, main.core.load, core.doSL], - ]; - this.replayAction = [ - [core.triggerReplay, core.stopReplay, core.rewindReplay], - [core.speedDownReplay, core.speedUpReplay, core.saveReplay], - ]; - } - //更新 - update() { - this._update_background(); //更新背景 - this._update_props(); //更新属性 - //this._update_items(); //更新道具 - //this._update_equips(); //更新装备 - //this._update_keys(); //更新钥匙 - //this._update_infoWindow(); //更新道具说明 - this._update_toolBox(); //更新工具栏 - this._redrawMap(); - } - _redrawMap() { - if (core.domStyle.isVertical) { - core.clearMap( - uictx, - MAP_BLOCK_LEFT_VERTICAL, - MAP_BLOCK_TOP_VERTICAL, - 340, - 360 - ); - this._update_map(); - uictx.globalAlpha = globalAlphafloor / 100; - core.drawImage( - uictx, - "green.webp", - MAP_BLOCK_LEFT_VERTICAL + 125, - MAP_BLOCK_TOP_VERTICAL + 170 - ); - uictx.globalAlpha = 1; - } else { - core.clearMap(uictx, MAP_BLOCK_LEFT, MAP_BLOCK_TOP, 340, 360); - this._update_map(); - uictx.globalAlpha = globalAlphafloor / 100; - core.drawImage( - uictx, - "green.webp", - MAP_BLOCK_LEFT + 150, - MAP_BLOCK_TOP + 170 - ); - uictx.globalAlpha = 1; - } - } - //更新背景 - _update_background() { - if (core.domStyle.isVertical) { - bgctx.canvas.width = GAMEVIEW_WIDTH_VERTICAL; - bgctx.canvas.height = GAMEVIEW_HEIGHT_VERTICAL; - uictx.canvas.width = GAMEVIEW_WIDTH_VERTICAL; - uictx.canvas.height = GAMEVIEW_HEIGHT_VERTICAL; + const totalWidth = isVertical ? + GAMEVIEW_WIDTH_VERTICAL / 3 : + GAMEVIEW_WIDTH / 3, + totalHeight = isVertical ? + GAMEVIEW_HEIGHT_VERTICAL / 3 : + GAMEVIEW_HEIGHT / 3; - const bg = core.material.images.images["status.webp"]; //竖屏背景(上) - bgctx.drawImage( - bg, - 0, - 0, - GAMEVIEW_WIDTH_VERTICAL, - BAR_HEIGHT_VERTICAL - ); - const bg2 = core.material.images.images["status.webp"]; //竖屏背景(下) - bgctx.drawImage( - bg2, - 0, - BAR_HEIGHT_VERTICAL + GAMEVIEW_WIDTH_VERTICAL, - GAMEVIEW_WIDTH_VERTICAL, - BAR_HEIGHT_VERTICAL - ); - bgctx.globalAlpha = globalAlpha; - bgctx.globalAlpha = 1; - core.setTextAlign("outerUI", "center"); - } else { - bgctx.canvas.width = GAMEVIEW_WIDTH; - bgctx.canvas.height = GAMEVIEW_HEIGHT; - uictx.canvas.width = GAMEVIEW_WIDTH; - uictx.canvas.height = GAMEVIEW_HEIGHT; + const maxRatio = Math.min( + clientWidth / totalWidth, + clientHeight / totalHeight + ); - const bg = core.material.images.images["status.webp"]; //横屏背景(左) - bgctx.drawImage(bg, 0, 0, BAR_WIDTH, GAMEVIEW_HEIGHT); - const bg2 = core.material.images.images["status.webp"]; //横屏背景(右) - bgctx.drawImage( - bg2, - BAR_WIDTH + GAMEVIEW_HEIGHT, - 0, - BAR_WIDTH, - GAMEVIEW_HEIGHT - ); - bgctx.globalAlpha = globalAlpha; + core.domStyle.availableScale = []; + [1, 1.25, 1.5, 1.75, 2].forEach(function (v) { + if (maxRatio >= v) { + core.domStyle.availableScale.push(v); + } + }); - bgctx.globalAlpha = 1; - core.setTextAlign("outerUI", "center"); - } - } - // 更新属性 - _update_props(updatedFloorTitle) { - if (!updatedFloorTitle && core.status.floorId) { - updatedFloorTitle = core.status.maps[core.status.floorId].title; - } - const statusList = ["hp", "atk", "def", "money"]; //属性列表,图标在函数复写core.statusBar.icons中声明,数字为project\materials\icons.png中的图标序号(可使用便捷ps追加,第一个序号为0) - const drawStatusList = (baseX, baseY) => { - let curh = baseY; - core.setTextAlign("outerUI", "right"); - statusList.forEach((item) => { - // 绘制图标 - core.drawIcon( - "outerUI", - item, - baseX - 95 * 3, - curh - 18 * 3, - 22 * 3, - 22 * 3 - ); + if (core.domStyle.availableScale.indexOf(core.domStyle.scale) < 0) { + core.domStyle.scale = Math.min(1, maxRatio); + } else if ( + core.getLocalStorage("scale") == null && + core.domStyle.availableScale.length >= 2 + ) { + core.domStyle.scale = + core.domStyle.availableScale[core.domStyle.availableScale.length - 2]; + core.setLocalStorage("scale", core.domStyle.scale); + } - // 四舍五入 - core.status.hero[item] = Math.round(core.status.hero[item]); - // 大数据格式化 - core.fillBoldText1( - "outerUI", - core.getRealStatus(item), - baseX, - curh, - TEXT_COLOR, - "#000000", - 6 - ); - curh += 24 * 3; - if (curh > 130 * 3 && core.domStyle.isVertical) { - curh = 24 * 3; - baseX += 105 * 3; - } - }); - core.setTextAlign("outerUI", "center"); - }; - if (core.domStyle.isVertical) { - core.clearMap("outerUI", 10 * 3, 0, 210 * 3, 120 * 3); - core.setFont("outerUI", "bold 42px Verdana"); - if (updatedFloorTitle) { - core.fillBoldText1( - "outerUI", - updatedFloorTitle, - 60 * 3, - 22 * 3, - TEXT_COLOR, - "#000000", - 6 - ); - } - //drawStatusList(96 * 3, 46 * 3); - //core.drawImage("outerUI", "lane1.png", 0, 0) - core.drawImage("outerUI", "cao.webp", 0, 0); - } else { - core.clearMap("outerUI", 10 * 3, 40 * 3, 105 * 3, 250 * 3); - core.setFont("outerUI", "bold 48px Verdana"); - if (updatedFloorTitle) { - core.fillBoldText1( - "outerUI", - updatedFloorTitle, - 62 * 3, - 41 * 3, - TEXT_COLOR, - "#000000", - 6 - ); - } - //drawStatusList(110 * 3, 93 * 3); - //core.drawImage("outerUI", "lane1.png", 0, 30) - core.drawImage( - "outerUI", - "cao.webp", - 0, - 0, - 400, - 350, - 0, - 30, - 360, - 315 - ); - } - } - _update_items() { - //更新道具栏 - const drawItemMx = (drawFn) => { - for (let i = 0; i < this.itemMx.length; i++) { - for (let j = 0; j < this.itemMx[i].length; j++) { - var item = this.itemMx[i][j]; - drawFn(i, j, item); - } - } - }; - const drawItem = (item, posx, posy) => { - const icon = core.material.icons.items[item], - image = core.material.images.items; - core.drawImage( - "outerUI", - image, - 0, - 32 * icon, - 32, - 32, - posx, - posy, - 30 * 3, - 30 * 3 - ); - const cnt = core.itemCount(item); - if ( - (core.items.items[item].cls === "tools" && cnt > 1) || - FORCE_COUNTABLE_ITEMS.includes(item) - ) { - core.fillText( - "outerUI", - cnt, - posx + 25 * 3, - posy + 28 * 3, - "#FFFFFF", - "bold 36px Verdana" - ); - } - }; - if (core.domStyle.isVertical) { - core.clearMap( - "outerUI", - ITEM_BOX_LEFT_VERTICAL, - ITEM_BOX_TOP_VERTICAL, - 185 * 3, - 125 * 3 - ); + const totalWidthScaled = totalWidth * core.domStyle.scale, + totalHeightScaled = totalHeight * core.domStyle.scale; - drawItemMx((i, j, item) => { - if (core.hasItem(item)) { - const posx = ITEM_BOX_LEFT_VERTICAL + i * 30 * 3, - posy = ITEM_BOX_TOP_VERTICAL + j * 31 * 3; - drawItem(item, posx, posy); - } - }); - } else { - core.clearMap( - "outerUI", - ITEM_BOX_LEFT, - ITEM_BOX_TOP, - 125 * 3, - 185 * 3 - ); + const gameDrawBox = isVertical ? { + left: BORDER_WIDTH / 3, + top: BAR_HEIGHT_VERTICAL / 3 + BORDER_HEIGHT / 3, + } : { left: BAR_WIDTH / 3 + BORDER_WIDTH / 3, top: BORDER_HEIGHT / 3 }; - drawItemMx((i, j, item) => { - if (core.hasItem(item)) { - const posx = ITEM_BOX_LEFT + j * 30 * 3, - posy = ITEM_BOX_TOP + i * 31 * 3; - drawItem(item, posx, posy); - } - }); - } - } + const obj = { + clientWidth: clientWidth, + clientHeight: clientHeight, + canvasWidth: canvasWidth, + totalWidth: totalWidthScaled, + totalHeight: totalHeightScaled, + gameDrawBox: gameDrawBox, + globalAttribute: core.status.globalAttribute || core.initStatus.globalAttribute, + }; - _update_map(floorId = core.status.floorId) { - const x = core.domStyle.isVertical - ? MAP_BLOCK_LEFT_VERTICAL - : MAP_BLOCK_LEFT; - const y = core.domStyle.isVertical - ? MAP_BLOCK_TOP_VERTICAL - : MAP_BLOCK_TOP; + _resize_gameGroup(obj); + _resize_canvas(obj); - if (!floorId) return; - const info = core.plugin.getMapDrawInfo(floorId, Infinity, true); - core.setTextAlign("outerUI", "center"); + if (core.status.automaticRoute == null) core.status.automaticRoute = {}; + core.updateStatusBar(); + if (main.dom.CGUI && main.dom.CGUI.style.display === "block") + core.ui.CG.update(); + if (main.dom.music && main.dom.music.style.display === "block") + core.ui.music.update(); + if (main.dom.cgText && main.dom.cgText.style.display === "block") + core.ui.cgText.update(); + if (main.dom.logcanvas && main.dom.logcanvas.style.display === "block") + core.ui.cgText.update(); + if (main.dom.boss1 && main.dom.boss1.style.display === "block") + core.ui.boss.update(); + }; - core.plugin.drawSmallMap(uictx, info, floorId, x, y, 300, 300); - } - _update_equips() { - return; - core.setFont("outerUI", "bold 48px Verdana"); - const drawEquip = (baseX, baseY, id, color, back) => { - if (!id) - core.fillText( - "outerUI", - back, - baseX + 20 * 3, - baseY + 22 * 3, - color - ); - else { - var icon = core.material.icons.items[id]; - core.drawImage( - "outerUI", - core.material.images.items, - 0, - 32 * icon, - 32, - 32, - baseX + 5 * 3, - baseY, - 32 * 3, - 32 * 3 - ); - } - }; - if (core.domStyle.isVertical) { - core.clearMap( - "outerUI", - EQUIP_BLOCK_LEFT_VERTICAL, - EQUIP_BLOCK_TOP_VERTICAL, - 90 * 3, - 130 * 3 - ); - drawEquip( - EQUIP_BLOCK_LEFT_VERTICAL, - EQUIP_BLOCK_TOP_VERTICAL, - core.getEquip(0), - "#D1CEFF", - "无" - ); - drawEquip( - EQUIP_BLOCK_LEFT_VERTICAL + 45 * 3, - EQUIP_BLOCK_TOP_VERTICAL, - core.getEquip(1), - "#D1CEFF", - "无" - ); - drawEquip( - EQUIP_BLOCK_LEFT_VERTICAL, - EQUIP_BLOCK_TOP_VERTICAL + 45 * 3, - core.getEquip(2), - "#D1CEFF", - "无" - ); - drawEquip( - EQUIP_BLOCK_LEFT_VERTICAL + 45 * 3, - EQUIP_BLOCK_TOP_VERTICAL + 45 * 3, - core.getEquip(3), - "#D1CEFF", - "无" - ); - drawEquip( - EQUIP_BLOCK_LEFT_VERTICAL, - EQUIP_BLOCK_TOP_VERTICAL + 90 * 3, - core.getEquip(4), - "#D1CEFF", - "无" - ); - drawEquip( - EQUIP_BLOCK_LEFT_VERTICAL + 45 * 3, - EQUIP_BLOCK_TOP_VERTICAL + 90 * 3, - core.getEquip(5), - "#D1CEFF", - "无" - ); - } else { - core.clearMap( - "outerUI", - EQUIP_BLOCK_LEFT, - EQUIP_BLOCK_TOP, - 130 * 3, - 95 * 3 - ); - drawEquip( - EQUIP_BLOCK_LEFT, - EQUIP_BLOCK_TOP, - core.getEquip(0), - "#D1CEFF", - "无" - ); - drawEquip( - EQUIP_BLOCK_LEFT + 42 * 3, - EQUIP_BLOCK_TOP, - core.getEquip(1), - "#D1CEFF", - "无" - ); - drawEquip( - EQUIP_BLOCK_LEFT + 85 * 3, - EQUIP_BLOCK_TOP, - core.getEquip(2), - "#D1CEFF", - "无" - ); - drawEquip( - EQUIP_BLOCK_LEFT, - EQUIP_BLOCK_TOP + 45 * 3, - core.getEquip(3), - "#D1CEFF", - "无" - ); - drawEquip( - EQUIP_BLOCK_LEFT + 42 * 3, - EQUIP_BLOCK_TOP + 45 * 3, - core.getEquip(4), - "#D1CEFF", - "无" - ); - drawEquip( - EQUIP_BLOCK_LEFT + 85 * 3, - EQUIP_BLOCK_TOP + 45 * 3, - core.getEquip(5), - "#D1CEFF", - "无" - ); - } - } - _update_keys() { - const drawKeyList = (baseX, baseY) => { - const todraw = [], - keyList = ["yellowKey", "blueKey", "redKey", "greenKey"]; - let total = 0; - keyList.forEach(function (key, i) { - todraw[i] = core.itemCount(key); - total += todraw[i]; - }); + class StatusBar { + constructor() { + //道具栏列表 + this.itemMx = [ + //空位用‘none’填充,当前ui至多4列6行 + ["book", "wand", "none", "fly"], + ["cross", "superPotion", "pickaxe"], + ["bomb", "centerFly", "upFly"], + ["none", "none", "none"], + ["downFly", "knife", "snow"], + ["bigKey", "earthquake", "coin"], + ]; + } + //初始化内容(工具栏/录像操作执行函数) + init() { + this.toolbarAction = [ + [ + main.core.openKeyBoard, + main.core.openQuickShop, + core.openToolbox, + core.doSL, + ], + [main.core.openSettings, main.core.save, main.core.load, core.doSL], + ]; + this.replayAction = [ + [core.triggerReplay, core.stopReplay, core.rewindReplay], + [core.speedDownReplay, core.speedUpReplay, core.saveReplay], + ]; + } + //更新 + update() { + this._update_background(); //更新背景 + this._update_props(); //更新属性 + //this._update_items(); //更新道具 + //this._update_equips(); //更新装备 + //this._update_keys(); //更新钥匙 + //this._update_infoWindow(); //更新道具说明 + this._update_toolBox(); //更新工具栏 + this._redrawMap(); + } + _redrawMap() { + if (core.domStyle.isVertical) { + core.clearMap( + uictx, + MAP_BLOCK_LEFT_VERTICAL, + MAP_BLOCK_TOP_VERTICAL, + 340, + 360 + ); + this._update_map(); + uictx.globalAlpha = globalAlphafloor / 100; + core.drawImage( + uictx, + "green.webp", + MAP_BLOCK_LEFT_VERTICAL + 125, + MAP_BLOCK_TOP_VERTICAL + 170 + ); + uictx.globalAlpha = 1; + } else { + core.clearMap(uictx, MAP_BLOCK_LEFT, MAP_BLOCK_TOP, 340, 360); + this._update_map(); + uictx.globalAlpha = globalAlphafloor / 100; + core.drawImage( + uictx, + "green.webp", + MAP_BLOCK_LEFT + 150, + MAP_BLOCK_TOP + 170 + ); + uictx.globalAlpha = 1; + } + } + //更新背景 + _update_background() { + if (core.domStyle.isVertical) { + bgctx.canvas.width = GAMEVIEW_WIDTH_VERTICAL; + bgctx.canvas.height = GAMEVIEW_HEIGHT_VERTICAL; + uictx.canvas.width = GAMEVIEW_WIDTH_VERTICAL; + uictx.canvas.height = GAMEVIEW_HEIGHT_VERTICAL; - let dn = 3; - for (let i = 0; i <= dn; i++) { - let delta = i * 32 * 3; + const bg = core.material.images.images["status.webp"]; //竖屏背景(上) + bgctx.drawImage( + bg, + 0, + 0, + GAMEVIEW_WIDTH_VERTICAL, + BAR_HEIGHT_VERTICAL + ); + const bg2 = core.material.images.images["status.webp"]; //竖屏背景(下) + bgctx.drawImage( + bg2, + 0, + BAR_HEIGHT_VERTICAL + GAMEVIEW_WIDTH_VERTICAL, + GAMEVIEW_WIDTH_VERTICAL, + BAR_HEIGHT_VERTICAL + ); + bgctx.globalAlpha = globalAlpha; + bgctx.globalAlpha = 1; + core.setTextAlign("outerUI", "center"); + } else { + bgctx.canvas.width = GAMEVIEW_WIDTH; + bgctx.canvas.height = GAMEVIEW_HEIGHT; + uictx.canvas.width = GAMEVIEW_WIDTH; + uictx.canvas.height = GAMEVIEW_HEIGHT; - if (core.domStyle.isVertical) { - this.drawKey(keyList[i], baseX, baseY + delta); - } else { - this.drawKey(keyList[i], baseX + delta, baseY); - } + const bg = core.material.images.images["status.webp"]; //横屏背景(左) + bgctx.drawImage(bg, 0, 0, BAR_WIDTH, GAMEVIEW_HEIGHT); + const bg2 = core.material.images.images["status.webp"]; //横屏背景(右) + bgctx.drawImage( + bg2, + BAR_WIDTH + GAMEVIEW_HEIGHT, + 0, + BAR_WIDTH, + GAMEVIEW_HEIGHT + ); + bgctx.globalAlpha = globalAlpha; - core.setFont("outerUI", "bold 48px Verdana"); - core.setTextAlign("outerUI", "left"); - if (core.domStyle.isVertical) { - core.fillText( - "outerUI", - todraw[i], - baseX + 20 * 3, - baseY + 14 * 3 + delta, - TEXT_COLOR - ); - } else { - core.fillText( - "outerUI", - todraw[i], - baseX + delta, - baseY + 32 * 3, - TEXT_COLOR - ); - } - } - }; - if (core.domStyle.isVertical) { - core.clearMap( - "outerUI", - KEY_BLOCK_LEFT_VERTICAL, - KEY_BLOCK_TOP_VERTICAL, - 45 * 3, - 130 * 3 - ); - drawKeyList( - KEY_BLOCK_LEFT_VERTICAL + 3 * 3, - KEY_BLOCK_TOP_VERTICAL + 5 * 3 - ); - } else { - core.clearMap( - "outerUI", - KEY_BLOCK_LEFT, - KEY_BLOCK_TOP, - 130 * 3, - 45 * 3 - ); - drawKeyList(KEY_BLOCK_LEFT + 10 * 3, KEY_BLOCK_TOP); - } - } - drawKey(key, x, y) { - let sx = 0, - sy = 0; + bgctx.globalAlpha = 1; + core.setTextAlign("outerUI", "center"); + } + } + // 更新属性 + _update_props(updatedFloorTitle) { + if (!updatedFloorTitle && core.status.floorId) { + updatedFloorTitle = core.status.maps[core.status.floorId].title; + } + const statusList = ["hp", "atk", "def", "money"]; //属性列表,图标在函数复写core.statusBar.icons中声明,数字为project\materials\icons.png中的图标序号(可使用便捷ps追加,第一个序号为0) + const drawStatusList = (baseX, baseY) => { + let curh = baseY; + core.setTextAlign("outerUI", "right"); + statusList.forEach((item) => { + // 绘制图标 + core.drawIcon( + "outerUI", + item, + baseX - 95 * 3, + curh - 18 * 3, + 22 * 3, + 22 * 3 + ); - if (key == "yellowKey") sx += 13; - else if (key == "blueKey") sx += 26; - else if (key == "greenKey") sx += 39; + // 四舍五入 + core.status.hero[item] = Math.round(core.status.hero[item]); + // 大数据格式化 + core.fillBoldText1( + "outerUI", + core.getRealStatus(item), + baseX, + curh, + TEXT_COLOR, + "#000000", + 6 + ); + curh += 24 * 3; + if (curh > 130 * 3 && core.domStyle.isVertical) { + curh = 24 * 3; + baseX += 105 * 3; + } + }); + core.setTextAlign("outerUI", "center"); + }; + if (core.domStyle.isVertical) { + core.clearMap("outerUI", 10 * 3, 0, 210 * 3, 120 * 3); + core.setFont("outerUI", "bold 42px Verdana"); + if (updatedFloorTitle) { + core.fillBoldText1( + "outerUI", + updatedFloorTitle, + 60 * 3, + 22 * 3, + TEXT_COLOR, + "#000000", + 6 + ); + } + //drawStatusList(96 * 3, 46 * 3); + //core.drawImage("outerUI", "lane1.png", 0, 0) + core.drawImage("outerUI", "cao.webp", 0, 0); + } else { + core.clearMap("outerUI", 10 * 3, 40 * 3, 105 * 3, 250 * 3); + core.setFont("outerUI", "bold 48px Verdana"); + if (updatedFloorTitle) { + core.fillBoldText1( + "outerUI", + updatedFloorTitle, + 62 * 3, + 41 * 3, + TEXT_COLOR, + "#000000", + 6 + ); + } + //drawStatusList(110 * 3, 93 * 3); + //core.drawImage("outerUI", "lane1.png", 0, 30) + core.drawImage( + "outerUI", + "cao.webp", + 0, + 0, + 400, + 350, + 0, + 30, + 360, + 315 + ); + } + } + _update_items() { + //更新道具栏 + const drawItemMx = (drawFn) => { + for (let i = 0; i < this.itemMx.length; i++) { + for (let j = 0; j < this.itemMx[i].length; j++) { + var item = this.itemMx[i][j]; + drawFn(i, j, item); + } + } + }; + const drawItem = (item, posx, posy) => { + const icon = core.material.icons.items[item], + image = core.material.images.items; + core.drawImage( + "outerUI", + image, + 0, + 32 * icon, + 32, + 32, + posx, + posy, + 30 * 3, + 30 * 3 + ); + const cnt = core.itemCount(item); + if ( + (core.items.items[item].cls === "tools" && cnt > 1) || + FORCE_COUNTABLE_ITEMS.includes(item) + ) { + core.fillText( + "outerUI", + cnt, + posx + 25 * 3, + posy + 28 * 3, + "#FFFFFF", + "bold 36px Verdana" + ); + } + }; + if (core.domStyle.isVertical) { + core.clearMap( + "outerUI", + ITEM_BOX_LEFT_VERTICAL, + ITEM_BOX_TOP_VERTICAL, + 185 * 3, + 125 * 3 + ); - core.drawImage( - "outerUI", - "maba.webp", - sx, - sy, - 13, - 26, - x, - y, - 13 * 3, - 26 * 3 - ); - } - _update_infoWindow() { - const itemId = this.selectedItem; - let text = ""; - if (this.selectedItem) { - text = core.replaceText(core.material.items[itemId]?.text); - if (text[0] == "," || text[0] == ",") text = text.substring(1); - } - if (core.domStyle.isVertical) { - core.clearMap( - "outerUI", - INFO_BLOCK_LEFT_VERTICAL, - INFO_BLOCK_TOP_VERTICAL, - 300 * 3, - 120 * 3 - ); + drawItemMx((i, j, item) => { + if (core.hasItem(item)) { + const posx = ITEM_BOX_LEFT_VERTICAL + i * 30 * 3, + posy = ITEM_BOX_TOP_VERTICAL + j * 31 * 3; + drawItem(item, posx, posy); + } + }); + } else { + core.clearMap( + "outerUI", + ITEM_BOX_LEFT, + ITEM_BOX_TOP, + 125 * 3, + 185 * 3 + ); - if (this.selectedItem) { - const icon = core.material.icons.items[itemId]; - core.setTextAlign("outerUI", "left"); - core.fillText( - "outerUI", - core.material.items[itemId].name, - INFO_BLOCK_LEFT_VERTICAL + 50 * 3, - INFO_BLOCK_TOP_VERTICAL + 27 * 3, - "#D1CEFF" - ); - core.drawImage( - "outerUI", - core.material.images.items, - 0, - 32 * icon, - 32, - 32, - INFO_BLOCK_LEFT_VERTICAL + 10 * 3, - INFO_BLOCK_TOP_VERTICAL + 8 * 3, - 32 * 3, - 32 * 3 - ); - core.ui.drawTextContent("outerUI", text, { - left: INFO_BLOCK_LEFT_VERTICAL + 10 * 3, - top: INFO_BLOCK_TOP_VERTICAL + 40 * 3, - maxWidth: 275 * 3, - color: "#D1CEFF", - fontSize: 36, - }); - } - } else { - core.clearMap( - "outerUI", - INFO_BLOCK_LEFT, - INFO_BLOCK_TOP, - 115 * 3, - 230 * 3 - ); + drawItemMx((i, j, item) => { + if (core.hasItem(item)) { + const posx = ITEM_BOX_LEFT + j * 30 * 3, + posy = ITEM_BOX_TOP + i * 31 * 3; + drawItem(item, posx, posy); + } + }); + } + } - if (this.selectedItem) { - const icon = core.material.icons.items[itemId]; - core.setTextAlign("outerUI", "center"); - core.fillText( - "outerUI", - core.material.items[itemId].name, - INFO_BLOCK_LEFT + 60 * 3, - INFO_BLOCK_TOP + 25 * 3, - "#D1CEFF" - ); - core.drawImage( - "outerUI", - core.material.images.items, - 0, - 32 * icon, - 32, - 32, - INFO_BLOCK_LEFT + 45 * 3, - INFO_BLOCK_TOP + 30 * 3, - 32 * 3, - 32 * 3 - ); - core.ui.drawTextContent("outerUI", text, { - left: INFO_BLOCK_LEFT + 10 * 3, - top: INFO_BLOCK_TOP + 60 * 3, - maxWidth: 105 * 3, - color: "#D1CEFF", - fontSize: 36, - }); - } - } - } - showItemInfo(itemId) { - //展示道具说明 - this.selectedItem = itemId; - this._update_infoWindow(); - } - clearItemInfo() { - //清除道具说明 - this.selectedItem = null; - this._update_infoWindow(); - } - _update_toolBox() { - const tools = core.isReplaying() - ? [ - [core.status.replay.pausing ? "play" : "pause", "stop", "rewind"], - ["speedDown", "speedUp", "save"], - ] - : [ - ["keyboard", "shop", "pack", "T332"], - ["settings", "save", "load", "T331"], - ]; - if (core.domStyle.isVertical) { - core.clearMap( - "outerUI", - TOOL_BOX_LEFT_VERTICAL, - TOOL_BOX_TOP_VERTICAL, - 115, - 130 - ); + _update_map(floorId = core.status.floorId) { + const x = core.domStyle.isVertical ? + MAP_BLOCK_LEFT_VERTICAL : + MAP_BLOCK_LEFT; + const y = core.domStyle.isVertical ? + MAP_BLOCK_TOP_VERTICAL : + MAP_BLOCK_TOP; - for (let i = 0; i < tools.length; i++) { - for (let j = 0; j < tools[i].length; j++) { - core.drawIcon( - "outerUI", - tools[i][j], - TOOL_BOX_LEFT_VERTICAL + i * 31 * 3, - TOOL_BOX_TOP_VERTICAL + j * 31 * 3, - 30 * 3, - 30 * 3 - ); - } - } - } else { - core.clearMap( - "outerUI", - TOOL_BOX_LEFT, - TOOL_BOX_TOP, - 130 * 3, - 80 * 3 - ); + if (!floorId) return; + const info = core.plugin.getMapDrawInfo(floorId, Infinity, true); + core.setTextAlign("outerUI", "center"); - for (let i = 0; i < tools.length; i++) { - for (let j = 0; j < tools[i].length; j++) { - core.drawIcon( - "outerUI", - tools[i][j], - TOOL_BOX_LEFT + j * 31 * 3, - TOOL_BOX_TOP + i * 31 * 3, - 30 * 3, - 30 * 3 - ); - } - } - } - } - onclick(x, y) { - const makeBox = ([x, y], [w, h]) => { - return [ - [x, y], - [x + w, y + h], - ]; - }; - const gridify = ([x, y], [gw, gh]) => { - return [Math.floor(x / gw), Math.floor(y / gh)]; - }; - const useItem = (itemId) => { - if (!core.hasItem(itemId)) return; + core.plugin.drawSmallMap(uictx, info, floorId, x, y, 300, 300); + } - if (itemId != this.selectedItem) { - this.showItemInfo(itemId); - } else { - switch (itemId) { - case "centerFly": - core.ui._drawCenterFly(); - break; - case "book": - core.openBook(true); - break; - case "wand": - core.insertAction({ - type: "useItem", - id: itemId, - }); - break; - case "fly": - core.useItem(itemId); - break; - default: - core.useItem(itemId); - } - } - }; - const inRect = ([x, y], [[sx, sy], [dx, dy]]) => { - return sx <= x && x <= dx && sy <= y && y <= dy; - }; - const relativeTo = ([x, y], [ax, ay]) => { - return [x - ax, y - ay]; - }; - const pos = [x, y]; - if (core.domStyle.isVertical) { - const itemBox = makeBox( - [ITEM_BOX_LEFT_VERTICAL, ITEM_BOX_TOP_VERTICAL], - [30 * 6 * 3, 31 * 4 * 3] - ); - if (inRect(pos, itemBox)) { - const [gx, gy] = gridify(relativeTo(pos, itemBox[0]), [ - 30 * 3, - 31 * 3, - ]); - const itemId = this.itemMx[gx][gy]; - if ( - (core.status.event.id == "viewMaps" || - core.status.event.id == "fly") && - itemId === "book" - ) - core.openBook(true); - if ( - core.isReplaying() || - core.status.lockControl || - core.isMoving() - ) - return; - useItem(itemId); - return; - } - const toolBox = makeBox( - [TOOL_BOX_LEFT_VERTICAL, TOOL_BOX_TOP_VERTICAL], - [31 * 2 * 3, 31 * 4 * 3] - ); - if (inRect(pos, toolBox)) { - const [col, row] = gridify(relativeTo(pos, toolBox[0]), [ - 31 * 3, - 31 * 3, - ]); - if (core.status.lockControl || core.isMoving()) return; - if (core.isReplaying()) { - this.replayAction[col][row].call(core); - } else if (core.isPlaying()) { - if (col === 0 && row === 3) { - core.doSL("autoSave", "load"); - } else if (col === 1 && row === 3) { - core.doSL("autoSave", "reload"); - } else { - this.toolbarAction[col][row].call(core, true); - } - } - return; - } - const mapBox = makeBox( - [MAP_BLOCK_LEFT_VERTICAL, MAP_BLOCK_TOP_VERTICAL], - [350, 350] - ); - if (inRect(pos, mapBox)) { - if ( - core.isReplaying() || - core.status.lockControl || - core.isMoving() - ) - return; - core.useItem("fly"); - return; - } - /*const equipBox = makeBox([EQUIP_BLOCK_LEFT_VERTICAL, EQUIP_BLOCK_TOP_VERTICAL], [90 * 3, 130 * 3]) + _update_equips() { + return; + core.setFont("outerUI", "bold 48px Verdana"); + const drawEquip = (baseX, baseY, id, color, back) => { + if (!id) + core.fillText( + "outerUI", + back, + baseX + 20 * 3, + baseY + 22 * 3, + color + ); + else { + var icon = core.material.icons.items[id]; + core.drawImage( + "outerUI", + core.material.images.items, + 0, + 32 * icon, + 32, + 32, + baseX + 5 * 3, + baseY, + 32 * 3, + 32 * 3 + ); + } + }; + if (core.domStyle.isVertical) { + core.clearMap( + "outerUI", + EQUIP_BLOCK_LEFT_VERTICAL, + EQUIP_BLOCK_TOP_VERTICAL, + 90 * 3, + 130 * 3 + ); + drawEquip( + EQUIP_BLOCK_LEFT_VERTICAL, + EQUIP_BLOCK_TOP_VERTICAL, + core.getEquip(0), + "#D1CEFF", + "无" + ); + drawEquip( + EQUIP_BLOCK_LEFT_VERTICAL + 45 * 3, + EQUIP_BLOCK_TOP_VERTICAL, + core.getEquip(1), + "#D1CEFF", + "无" + ); + drawEquip( + EQUIP_BLOCK_LEFT_VERTICAL, + EQUIP_BLOCK_TOP_VERTICAL + 45 * 3, + core.getEquip(2), + "#D1CEFF", + "无" + ); + drawEquip( + EQUIP_BLOCK_LEFT_VERTICAL + 45 * 3, + EQUIP_BLOCK_TOP_VERTICAL + 45 * 3, + core.getEquip(3), + "#D1CEFF", + "无" + ); + drawEquip( + EQUIP_BLOCK_LEFT_VERTICAL, + EQUIP_BLOCK_TOP_VERTICAL + 90 * 3, + core.getEquip(4), + "#D1CEFF", + "无" + ); + drawEquip( + EQUIP_BLOCK_LEFT_VERTICAL + 45 * 3, + EQUIP_BLOCK_TOP_VERTICAL + 90 * 3, + core.getEquip(5), + "#D1CEFF", + "无" + ); + } else { + core.clearMap( + "outerUI", + EQUIP_BLOCK_LEFT, + EQUIP_BLOCK_TOP, + 130 * 3, + 95 * 3 + ); + drawEquip( + EQUIP_BLOCK_LEFT, + EQUIP_BLOCK_TOP, + core.getEquip(0), + "#D1CEFF", + "无" + ); + drawEquip( + EQUIP_BLOCK_LEFT + 42 * 3, + EQUIP_BLOCK_TOP, + core.getEquip(1), + "#D1CEFF", + "无" + ); + drawEquip( + EQUIP_BLOCK_LEFT + 85 * 3, + EQUIP_BLOCK_TOP, + core.getEquip(2), + "#D1CEFF", + "无" + ); + drawEquip( + EQUIP_BLOCK_LEFT, + EQUIP_BLOCK_TOP + 45 * 3, + core.getEquip(3), + "#D1CEFF", + "无" + ); + drawEquip( + EQUIP_BLOCK_LEFT + 42 * 3, + EQUIP_BLOCK_TOP + 45 * 3, + core.getEquip(4), + "#D1CEFF", + "无" + ); + drawEquip( + EQUIP_BLOCK_LEFT + 85 * 3, + EQUIP_BLOCK_TOP + 45 * 3, + core.getEquip(5), + "#D1CEFF", + "无" + ); + } + } + _update_keys() { + const drawKeyList = (baseX, baseY) => { + const todraw = [], + keyList = ["yellowKey", "blueKey", "redKey", "greenKey"]; + let total = 0; + keyList.forEach(function (key, i) { + todraw[i] = core.itemCount(key); + total += todraw[i]; + }); + + let dn = 3; + for (let i = 0; i <= dn; i++) { + let delta = i * 32 * 3; + + if (core.domStyle.isVertical) { + this.drawKey(keyList[i], baseX, baseY + delta); + } else { + this.drawKey(keyList[i], baseX + delta, baseY); + } + + core.setFont("outerUI", "bold 48px Verdana"); + core.setTextAlign("outerUI", "left"); + if (core.domStyle.isVertical) { + core.fillText( + "outerUI", + todraw[i], + baseX + 20 * 3, + baseY + 14 * 3 + delta, + TEXT_COLOR + ); + } else { + core.fillText( + "outerUI", + todraw[i], + baseX + delta, + baseY + 32 * 3, + TEXT_COLOR + ); + } + } + }; + if (core.domStyle.isVertical) { + core.clearMap( + "outerUI", + KEY_BLOCK_LEFT_VERTICAL, + KEY_BLOCK_TOP_VERTICAL, + 45 * 3, + 130 * 3 + ); + drawKeyList( + KEY_BLOCK_LEFT_VERTICAL + 3 * 3, + KEY_BLOCK_TOP_VERTICAL + 5 * 3 + ); + } else { + core.clearMap( + "outerUI", + KEY_BLOCK_LEFT, + KEY_BLOCK_TOP, + 130 * 3, + 45 * 3 + ); + drawKeyList(KEY_BLOCK_LEFT + 10 * 3, KEY_BLOCK_TOP); + } + } + drawKey(key, x, y) { + let sx = 0, + sy = 0; + + if (key == "yellowKey") sx += 13; + else if (key == "blueKey") sx += 26; + else if (key == "greenKey") sx += 39; + + core.drawImage( + "outerUI", + "maba.webp", + sx, + sy, + 13, + 26, + x, + y, + 13 * 3, + 26 * 3 + ); + } + _update_infoWindow() { + const itemId = this.selectedItem; + let text = ""; + if (this.selectedItem) { + text = core.replaceText(core.material.items[itemId]?.text); + if (text[0] == "," || text[0] == ",") text = text.substring(1); + } + if (core.domStyle.isVertical) { + core.clearMap( + "outerUI", + INFO_BLOCK_LEFT_VERTICAL, + INFO_BLOCK_TOP_VERTICAL, + 300 * 3, + 120 * 3 + ); + + if (this.selectedItem) { + const icon = core.material.icons.items[itemId]; + core.setTextAlign("outerUI", "left"); + core.fillText( + "outerUI", + core.material.items[itemId].name, + INFO_BLOCK_LEFT_VERTICAL + 50 * 3, + INFO_BLOCK_TOP_VERTICAL + 27 * 3, + "#D1CEFF" + ); + core.drawImage( + "outerUI", + core.material.images.items, + 0, + 32 * icon, + 32, + 32, + INFO_BLOCK_LEFT_VERTICAL + 10 * 3, + INFO_BLOCK_TOP_VERTICAL + 8 * 3, + 32 * 3, + 32 * 3 + ); + core.ui.drawTextContent("outerUI", text, { + left: INFO_BLOCK_LEFT_VERTICAL + 10 * 3, + top: INFO_BLOCK_TOP_VERTICAL + 40 * 3, + maxWidth: 275 * 3, + color: "#D1CEFF", + fontSize: 36, + }); + } + } else { + core.clearMap( + "outerUI", + INFO_BLOCK_LEFT, + INFO_BLOCK_TOP, + 115 * 3, + 230 * 3 + ); + + if (this.selectedItem) { + const icon = core.material.icons.items[itemId]; + core.setTextAlign("outerUI", "center"); + core.fillText( + "outerUI", + core.material.items[itemId].name, + INFO_BLOCK_LEFT + 60 * 3, + INFO_BLOCK_TOP + 25 * 3, + "#D1CEFF" + ); + core.drawImage( + "outerUI", + core.material.images.items, + 0, + 32 * icon, + 32, + 32, + INFO_BLOCK_LEFT + 45 * 3, + INFO_BLOCK_TOP + 30 * 3, + 32 * 3, + 32 * 3 + ); + core.ui.drawTextContent("outerUI", text, { + left: INFO_BLOCK_LEFT + 10 * 3, + top: INFO_BLOCK_TOP + 60 * 3, + maxWidth: 105 * 3, + color: "#D1CEFF", + fontSize: 36, + }); + } + } + } + showItemInfo(itemId) { + //展示道具说明 + this.selectedItem = itemId; + this._update_infoWindow(); + } + clearItemInfo() { + //清除道具说明 + this.selectedItem = null; + this._update_infoWindow(); + } + _update_toolBox() { + const tools = core.isReplaying() ? [ + [core.status.replay.pausing ? "play" : "pause", "stop", "rewind"], + ["speedDown", "speedUp", "save"], + ] : [ + ["keyboard", "shop", "pack", "T332"], + ["settings", "save", "load", "T331"], + ]; + if (core.domStyle.isVertical) { + core.clearMap( + "outerUI", + TOOL_BOX_LEFT_VERTICAL, + TOOL_BOX_TOP_VERTICAL, + 115, + 130 + ); + + for (let i = 0; i < tools.length; i++) { + for (let j = 0; j < tools[i].length; j++) { + core.drawIcon( + "outerUI", + tools[i][j], + TOOL_BOX_LEFT_VERTICAL + i * 31 * 3, + TOOL_BOX_TOP_VERTICAL + j * 31 * 3, + 30 * 3, + 30 * 3 + ); + } + } + } else { + core.clearMap( + "outerUI", + TOOL_BOX_LEFT, + TOOL_BOX_TOP, + 130 * 3, + 80 * 3 + ); + + for (let i = 0; i < tools.length; i++) { + for (let j = 0; j < tools[i].length; j++) { + core.drawIcon( + "outerUI", + tools[i][j], + TOOL_BOX_LEFT + j * 31 * 3, + TOOL_BOX_TOP + i * 31 * 3, + 30 * 3, + 30 * 3 + ); + } + } + } + } + onclick(x, y) { + const makeBox = ([x, y], [w, h]) => { + return [ + [x, y], + [x + w, y + h], + ]; + }; + const gridify = ([x, y], [gw, gh]) => { + return [Math.floor(x / gw), Math.floor(y / gh)]; + }; + const useItem = (itemId) => { + if (!core.hasItem(itemId)) return; + + if (itemId != this.selectedItem) { + this.showItemInfo(itemId); + } else { + switch (itemId) { + case "centerFly": + core.ui._drawCenterFly(); + break; + case "book": + core.openBook(true); + break; + case "wand": + core.insertAction({ + type: "useItem", + id: itemId, + }); + break; + case "fly": + core.useItem(itemId); + break; + default: + core.useItem(itemId); + } + } + }; + const inRect = ([x, y], [ + [sx, sy], + [dx, dy] + ]) => { + return sx <= x && x <= dx && sy <= y && y <= dy; + }; + const relativeTo = ([x, y], [ax, ay]) => { + return [x - ax, y - ay]; + }; + const pos = [x, y]; + if (core.domStyle.isVertical) { + const itemBox = makeBox( + [ITEM_BOX_LEFT_VERTICAL, ITEM_BOX_TOP_VERTICAL], + [30 * 6 * 3, 31 * 4 * 3] + ); + if (inRect(pos, itemBox)) { + const [gx, gy] = gridify(relativeTo(pos, itemBox[0]), [ + 30 * 3, + 31 * 3, + ]); + const itemId = this.itemMx[gx][gy]; + if ( + (core.status.event.id == "viewMaps" || + core.status.event.id == "fly") && + itemId === "book" + ) + core.openBook(true); + if ( + core.isReplaying() || + core.status.lockControl || + core.isMoving() + ) + return; + useItem(itemId); + return; + } + const toolBox = makeBox( + [TOOL_BOX_LEFT_VERTICAL, TOOL_BOX_TOP_VERTICAL], + [31 * 2 * 3, 31 * 4 * 3] + ); + if (inRect(pos, toolBox)) { + const [col, row] = gridify(relativeTo(pos, toolBox[0]), [ + 31 * 3, + 31 * 3, + ]); + if (core.status.lockControl || core.isMoving()) return; + if (core.isReplaying()) { + this.replayAction[col][row].call(core); + } else if (core.isPlaying()) { + if (col === 0 && row === 3) { + core.doSL("autoSave", "load"); + } else if (col === 1 && row === 3) { + core.doSL("autoSave", "reload"); + } else { + this.toolbarAction[col][row].call(core, true); + } + } + return; + } + const mapBox = makeBox( + [MAP_BLOCK_LEFT_VERTICAL, MAP_BLOCK_TOP_VERTICAL], + [350, 350] + ); + if (inRect(pos, mapBox)) { + if ( + core.isReplaying() || + core.status.lockControl || + core.isMoving() + ) + return; + core.useItem("fly"); + return; + } + /*const equipBox = makeBox([EQUIP_BLOCK_LEFT_VERTICAL, EQUIP_BLOCK_TOP_VERTICAL], [90 * 3, 130 * 3]) if (inRect(pos, equipBox)) { if (core.isReplaying() || core.status.lockControl || core.isMoving()) return; core.openEquipbox(true) return; }*/ - } else { - const mapBox = makeBox([MAP_BLOCK_LEFT, MAP_BLOCK_TOP], [350, 350]); - if (inRect(pos, mapBox)) { - if ( - core.isReplaying() || - core.status.lockControl || - core.isMoving() - ) - return; - core.useItem("fly"); - return; - } - /* + } else { + const mapBox = makeBox([MAP_BLOCK_LEFT, MAP_BLOCK_TOP], [350, 350]); + if (inRect(pos, mapBox)) { + if ( + core.isReplaying() || + core.status.lockControl || + core.isMoving() + ) + return; + core.useItem("fly"); + return; + } + /* const equipBox = makeBox([EQUIP_BLOCK_LEFT, EQUIP_BLOCK_TOP], [130, 95]) if (inRect(pos, equipBox)) { if (core.isReplaying() || core.status.lockControl || core.isMoving()) return; core.openEquipbox(true) return; }*/ - const itemBox = makeBox( - [ITEM_BOX_LEFT, ITEM_BOX_TOP], - [31 * 4 * 3, 30 * 6 * 3] - ); - if (inRect(pos, itemBox)) { - const [gx, gy] = gridify(relativeTo(pos, itemBox[0]), [ - 31 * 3, - 30 * 3, - ]); - const itemId = this.itemMx[gy][gx]; - if ( - (core.status.event.id == "viewMaps" || - core.status.event.id == "fly") && - itemId === "book" - ) - core.openBook(true); - if ( - core.isReplaying() || - core.status.lockControl || - core.isMoving() - ) - return; - useItem(itemId); - return; - } - const toolBox = makeBox( - [TOOL_BOX_LEFT, TOOL_BOX_TOP], - [31 * 4 * 3, 31 * 2 * 3] - ); - if (inRect(pos, toolBox)) { - const [row, col] = gridify(relativeTo(pos, toolBox[0]), [ - 31 * 3, - 31 * 3, - ]); - if (core.status.lockControl || core.isMoving()) return; - if (core.isReplaying()) { - this.replayAction[col][row].call(core); - } else if (core.isPlaying()) { - if (col === 0 && row === 3) { - core.doSL("autoSave", "load"); - } else if (col === 1 && row === 3) { - core.doSL("autoSave", "reload"); - } else { - this.toolbarAction[col][row].call(core, true); - } - } - return; - } - } - } - } + const itemBox = makeBox( + [ITEM_BOX_LEFT, ITEM_BOX_TOP], + [31 * 4 * 3, 30 * 6 * 3] + ); + if (inRect(pos, itemBox)) { + const [gx, gy] = gridify(relativeTo(pos, itemBox[0]), [ + 31 * 3, + 30 * 3, + ]); + const itemId = this.itemMx[gy][gx]; + if ( + (core.status.event.id == "viewMaps" || + core.status.event.id == "fly") && + itemId === "book" + ) + core.openBook(true); + if ( + core.isReplaying() || + core.status.lockControl || + core.isMoving() + ) + return; + useItem(itemId); + return; + } + const toolBox = makeBox( + [TOOL_BOX_LEFT, TOOL_BOX_TOP], + [31 * 4 * 3, 31 * 2 * 3] + ); + if (inRect(pos, toolBox)) { + const [row, col] = gridify(relativeTo(pos, toolBox[0]), [ + 31 * 3, + 31 * 3, + ]); + if (core.status.lockControl || core.isMoving()) return; + if (core.isReplaying()) { + this.replayAction[col][row].call(core); + } else if (core.isPlaying()) { + if (col === 0 && row === 3) { + core.doSL("autoSave", "load"); + } else if (col === 1 && row === 3) { + core.doSL("autoSave", "reload"); + } else { + this.toolbarAction[col][row].call(core, true); + } + } + return; + } + } + } + } - core.ui.statusBar = new StatusBar(); + core.ui.statusBar = new StatusBar(); - core.control.clearStatusBar = function () { - core.clearMap("outerUI"); - }; - // init() called in `afterLoadResources`. - }, + core.control.clearStatusBar = function () { + core.clearMap("outerUI"); + }; + // init() called in `afterLoadResources`. +}, "override": function () { core.statusBar.icons = { floor: 0, @@ -4750,357 +4772,359 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = }; }, "手册区分特殊属性": function () { - // 在此增加新插件 - this.arrsame = function (Arraya, Arrayb) { - let a = Arraya || []; - let b = Arrayb || []; - if (typeof a === "number") a = [a]; - if (typeof b === "number") b = [b]; - let c = [...a, ...b]; - for (const i of c) - if (!a.includes(i) || !b.includes(i)) { - return false; - } - return true; - }; - enemys.prototype.getCurrentEnemys = function (floorId) { - floorId = floorId || core.status.floorId; - var enemys = [], - used = {}; - core.extractBlocks(floorId); - core.status.maps[floorId].blocks.forEach(function (block) { - if (!block.disable && block.event.cls.indexOf("enemy") == 0) { - this._getCurrentEnemys_addEnemy( - block.event.id, - enemys, - used, - block.x, - block.y, - floorId - ); - } - }, this); - return this._getCurrentEnemys_sort(enemys); - }; + // 在此增加新插件 + this.arrsame = function (Arraya, Arrayb) { + let a = Arraya || []; + let b = Arrayb || []; + if (typeof a === "number") a = [a]; + if (typeof b === "number") b = [b]; + let c = [...a, ...b]; + for (const i of c) + if (!a.includes(i) || !b.includes(i)) { + return false; + } + return true; + }; + enemys.prototype.getCurrentEnemys = function (floorId) { + floorId = floorId || core.status.floorId; + var enemys = [], + used = {}; + core.extractBlocks(floorId); + core.status.maps[floorId].blocks.forEach(function (block) { + if (!block.disable && block.event.cls.indexOf("enemy") == 0) { + this._getCurrentEnemys_addEnemy( + block.event.id, + enemys, + used, + block.x, + block.y, + floorId + ); + } + }, this); + return this._getCurrentEnemys_sort(enemys); + }; - enemys.prototype._getCurrentEnemys_getEnemy = function (enemyId) { - var enemy = core.material.enemys[enemyId]; - if (!enemy) return null; + enemys.prototype._getCurrentEnemys_getEnemy = function (enemyId) { + var enemy = core.material.enemys[enemyId]; + if (!enemy) return null; - // 检查朝向;displayIdInBook - return ( - core.material.enemys[enemy.displayIdInBook] || - core.material.enemys[(enemy.faceIds || {}).down] || - enemy - ); - }; + // 检查朝向;displayIdInBook + return ( + core.material.enemys[enemy.displayIdInBook] || + core.material.enemys[(enemy.faceIds || {}).down] || + enemy + ); + }; - enemys.prototype._getCurrentEnemys_addEnemy = function ( - enemyId, - enemys, - used, - x, - y, - floorId - ) { - var enemy = this._getCurrentEnemys_getEnemy(enemyId); - if (enemy == null) return; + enemys.prototype._getCurrentEnemys_addEnemy = function ( + enemyId, + enemys, + used, + x, + y, + floorId + ) { + var enemy = this._getCurrentEnemys_getEnemy(enemyId); + if (enemy == null) return; - var id = enemy.id; + var id = enemy.id; - var enemyInfo = this.getEnemyInfo(enemy, null, null, null, floorId); - var locEnemyInfo = this.getEnemyInfo(enemy, null, x, y, floorId); - if ( - !core.flags.enableEnemyPoint || - (locEnemyInfo.atk == enemyInfo.atk && - locEnemyInfo.def == enemyInfo.def && - locEnemyInfo.hp == enemyInfo.hp && - core.plugin.arrsame(locEnemyInfo.special, enemyInfo.special)) - ) { - x = null; - y = null; - } else { - // 检查enemys里面是否使用了存在的内容 - for (var i = 0; i < enemys.length; ++i) { - var one = enemys[i]; - if ( - id == one.id && - one.locs != null && - locEnemyInfo.atk == one.atk && - locEnemyInfo.def == one.def && - locEnemyInfo.hp == one.hp && - core.plugin.arrsame(locEnemyInfo.special, one.special) - ) { - one.locs.push([x, y]); - return; - } - } - enemyInfo = locEnemyInfo; - } + var enemyInfo = this.getEnemyInfo(enemy, null, null, null, floorId); + var locEnemyInfo = this.getEnemyInfo(enemy, null, x, y, floorId); + if ( + !core.flags.enableEnemyPoint || + (locEnemyInfo.atk == enemyInfo.atk && + locEnemyInfo.def == enemyInfo.def && + locEnemyInfo.hp == enemyInfo.hp && + core.plugin.arrsame(locEnemyInfo.special, enemyInfo.special)) + ) { + x = null; + y = null; + } else { + // 检查enemys里面是否使用了存在的内容 + for (var i = 0; i < enemys.length; ++i) { + var one = enemys[i]; + if ( + id == one.id && + one.locs != null && + locEnemyInfo.atk == one.atk && + locEnemyInfo.def == one.def && + locEnemyInfo.hp == one.hp && + core.plugin.arrsame(locEnemyInfo.special, one.special) + ) { + one.locs.push([x, y]); + return; + } + } + enemyInfo = locEnemyInfo; + } - var id = enemy.id + ":" + x + ":" + y; - if (used[id]) return; - used[id] = true; + var id = enemy.id + ":" + x + ":" + y; + if (used[id]) return; + used[id] = true; - var specialText = core.enemys.getSpecialText(enemy, x, y, floorId); - var specialColor = core.enemys.getSpecialColor(enemy, x, y, floorId); + var specialText = core.enemys.getSpecialText(enemy, x, y, floorId); + var specialColor = core.enemys.getSpecialColor(enemy, x, y, floorId); - var critical = this.nextCriticals(enemy, 1, x, y, floorId); - if (critical.length > 0) critical = critical[0]; + var critical = this.nextCriticals(enemy, 1, x, y, floorId); + if (critical.length > 0) critical = critical[0]; - var e = core.clone(enemy); - for (var v in enemyInfo) { - e[v] = enemyInfo[v]; - } - if (x != null && y != null) { - e.locs = [[x, y]]; - } - e.name = core.getEnemyValue(enemy, "name", x, y, floorId); - e.specialText = specialText; - e.specialColor = specialColor; - e.damage = this.getDamage(enemy, x, y, floorId); - e.critical = critical[0]; - e.criticalDamage = critical[1]; - e.defDamage = this._getCurrentEnemys_addEnemy_defDamage( - enemy, - x, - y, - floorId - ); - enemys.push(e); - }; + var e = core.clone(enemy); + for (var v in enemyInfo) { + e[v] = enemyInfo[v]; + } + if (x != null && y != null) { + e.locs = [ + [x, y] + ]; + } + e.name = core.getEnemyValue(enemy, "name", x, y, floorId); + e.specialText = specialText; + e.specialColor = specialColor; + e.damage = this.getDamage(enemy, x, y, floorId); + e.critical = critical[0]; + e.criticalDamage = critical[1]; + e.defDamage = this._getCurrentEnemys_addEnemy_defDamage( + enemy, + x, + y, + floorId + ); + enemys.push(e); + }; - enemys.prototype._getCurrentEnemys_addEnemy_defDamage = function ( - enemy, - x, - y, - floorId - ) { - var ratio = core.status.maps[floorId || core.status.floorId].ratio || 1; - return this.getDefDamage(enemy, ratio, x, y, floorId); - }; + enemys.prototype._getCurrentEnemys_addEnemy_defDamage = function ( + enemy, + x, + y, + floorId + ) { + var ratio = core.status.maps[floorId || core.status.floorId].ratio || 1; + return this.getDefDamage(enemy, ratio, x, y, floorId); + }; - enemys.prototype._getCurrentEnemys_sort = function (enemys) { - return enemys.sort(function (a, b) { - if (a.damage == b.damage) { - return a.money - b.money; - } - if (a.damage == null) { - return 1; - } - if (b.damage == null) { - return -1; - } - return a.damage - b.damage; - }); - }; + enemys.prototype._getCurrentEnemys_sort = function (enemys) { + return enemys.sort(function (a, b) { + if (a.damage == b.damage) { + return a.money - b.money; + } + if (a.damage == null) { + return 1; + } + if (b.damage == null) { + return -1; + } + return a.damage - b.damage; + }); + }; - ////// 获得所有特殊属性的名称 ////// - enemys.prototype.getSpecialText = function (enemy, x, y, floorId) { - if (typeof enemy == "string") - enemy = this.getEnemyInfo(enemy, null, x, y, floorId); - if (!enemy) return []; - var special = enemy.special; - var text = []; + ////// 获得所有特殊属性的名称 ////// + enemys.prototype.getSpecialText = function (enemy, x, y, floorId) { + if (typeof enemy == "string") + enemy = this.getEnemyInfo(enemy, null, x, y, floorId); + if (!enemy) return []; + var special = enemy.special; + var text = []; - var specials = this.getSpecials(); - if (specials) { - for (var i = 0; i < specials.length; i++) { - if (this.hasSpecial(special, specials[i][0])) - text.push(this._calSpecialContent(enemy, specials[i][1])); - } - } - return text; - }; + var specials = this.getSpecials(); + if (specials) { + for (var i = 0; i < specials.length; i++) { + if (this.hasSpecial(special, specials[i][0])) + text.push(this._calSpecialContent(enemy, specials[i][1])); + } + } + return text; + }; - ////// 获得所有特殊属性的颜色 ////// - enemys.prototype.getSpecialColor = function (enemy, x, y, floorId) { - if (typeof enemy == "string") - enemy = this.getEnemyInfo(enemy, null, x, y, floorId); - if (!enemy) return []; - var special = enemy.special; - var colors = []; + ////// 获得所有特殊属性的颜色 ////// + enemys.prototype.getSpecialColor = function (enemy, x, y, floorId) { + if (typeof enemy == "string") + enemy = this.getEnemyInfo(enemy, null, x, y, floorId); + if (!enemy) return []; + var special = enemy.special; + var colors = []; - var specials = this.getSpecials(); - if (specials) { - for (var i = 0; i < specials.length; i++) { - if (this.hasSpecial(special, specials[i][0])) - colors.push(specials[i][3] || null); - } - } - return colors; - }; + var specials = this.getSpecials(); + if (specials) { + for (var i = 0; i < specials.length; i++) { + if (this.hasSpecial(special, specials[i][0])) + colors.push(specials[i][3] || null); + } + } + return colors; + }; - ////// 获得所有特殊属性的额外标记 ////// - enemys.prototype.getSpecialFlag = function (enemy, x, y, floorId) { - if (typeof enemy == "string") - enemy = getEnemyInfo(enemy, null, x, y, floorId); - if (!enemy) return []; - var special = enemy.special; - var flag = 0; + ////// 获得所有特殊属性的额外标记 ////// + enemys.prototype.getSpecialFlag = function (enemy, x, y, floorId) { + if (typeof enemy == "string") + enemy = getEnemyInfo(enemy, null, x, y, floorId); + if (!enemy) return []; + var special = enemy.special; + var flag = 0; - var specials = this.getSpecials(); - if (specials) { - for (var i = 0; i < specials.length; i++) { - if (this.hasSpecial(special, specials[i][0])) - flag |= specials[i][4] || 0; - } - } - return flag; - }; + var specials = this.getSpecials(); + if (specials) { + for (var i = 0; i < specials.length; i++) { + if (this.hasSpecial(special, specials[i][0])) + flag |= specials[i][4] || 0; + } + } + return flag; + }; - ////// 获得每个特殊属性的说明 ////// - enemys.prototype.getSpecialHint = function (enemy, special) { - var specials = this.getSpecials(); - if (special == null) { - if (specials == null) return []; - var hints = []; - for (var i = 0; i < specials.length; i++) { - if (this.hasSpecial(enemy, specials[i][0])) - hints.push( - "\r[" + - core.arrayToRGBA(specials[i][3] || "#FF6A6A") + - "]\\d" + - this._calSpecialContent(enemy, specials[i][1]) + - ":\\d\r[]" + - this._calSpecialContent(enemy, specials[i][2]) - ); - } - return hints; - } + ////// 获得每个特殊属性的说明 ////// + enemys.prototype.getSpecialHint = function (enemy, special) { + var specials = this.getSpecials(); + if (special == null) { + if (specials == null) return []; + var hints = []; + for (var i = 0; i < specials.length; i++) { + if (this.hasSpecial(enemy, specials[i][0])) + hints.push( + "\r[" + + core.arrayToRGBA(specials[i][3] || "#FF6A6A") + + "]\\d" + + this._calSpecialContent(enemy, specials[i][1]) + + ":\\d\r[]" + + this._calSpecialContent(enemy, specials[i][2]) + ); + } + return hints; + } - if (specials == null) return ""; - for (var i = 0; i < specials.length; i++) { - if (special == specials[i][0]) - return ( - "\r[#FF6A6A]\\d" + - this._calSpecialContent(enemy, specials[i][1]) + - ":\\d\r[]" + - this._calSpecialContent(enemy, specials[i][2]) - ); - } - return ""; - }; - ui.prototype._drawBook_drawName = function ( - index, - enemy, - top, - left, - width - ) { - // 绘制第零列(名称和特殊属性) - // 如果需要添加自己的比如怪物的称号等,也可以在这里绘制 - core.setTextAlign("ui", "center"); - if (core.enemys.getSpecialText(enemy).length == 0) { - core.fillText( - "ui", - enemy.name, - left + width / 2, - top + 35, - "#DDDDDD", - this._buildFont(17, true), - width - ); - } else { - core.fillText( - "ui", - enemy.name, - left + width / 2, - top + 28, - "#DDDDDD", - this._buildFont(17, true), - width - ); - switch (core.enemys.getSpecialText(enemy).length) { - case 1: - core.fillText( - "ui", - core.enemys.getSpecialText(enemy)[0], - left + width / 2, - top + 50, - core.arrayToRGBA( - (core.enemys.getSpecialColor(enemy) || [])[0] || "#FF6A6A" - ), - this._buildFont(15, true), - width - ); - break; - case 2: - // Step 1: 计算字体 - var text = - core.enemys.getSpecialText(enemy)[0] + - " " + - core.enemys.getSpecialText(enemy)[1]; - core.setFontForMaxWidth( - "ui", - text, - width, - this._buildFont(15, true) - ); - // Step 2: 计算总宽度 - var totalWidth = core.calWidth("ui", text); - var leftWidth = core.calWidth( - "ui", - core.enemys.getSpecialText(enemy)[0] - ); - var rightWidth = core.calWidth( - "ui", - core.enemys.getSpecialText(enemy)[1] - ); - // Step 3: 绘制 - core.fillText( - "ui", - core.enemys.getSpecialText(enemy)[0], - left + (width + leftWidth - totalWidth) / 2, - top + 50, - core.arrayToRGBA( - (core.enemys.getSpecialColor(enemy) || [])[0] || "#FF6A6A" - ) - ); - core.fillText( - "ui", - core.enemys.getSpecialText(enemy)[1], - left + (width + totalWidth - rightWidth) / 2, - top + 50, - core.arrayToRGBA( - (core.enemys.getSpecialColor(enemy) || [])[1] || "#FF6A6A" - ) - ); - break; - default: - core.fillText( - "ui", - "多属性...", - left + width / 2, - top + 50, - "#FF6A6A", - this._buildFont(15, true), - width - ); - } - } - }; - ui.prototype._drawBookDetail_getInfo = function (index) { - var floorId = - core.floorIds[(core.status.event.ui || {}).index] || - core.status.floorId; - // 清除浏览地图时的光环缓存 - if (floorId != core.status.floorId && core.status.checkBlock) { - core.status.checkBlock.cache = {}; - } - var enemys = core.enemys.getCurrentEnemys(floorId); - console.log(123); - if (enemys.length == 0) return []; - index = core.clamp(index, 0, enemys.length - 1); - var enemy = enemys[index]; - var texts = core.enemys.getSpecialHint(enemy); - if (texts.length == 0) texts.push("该怪物无特殊属性。"); - if (enemy.description) texts.push(enemy.description + "\r"); - this._drawBookDetail_getTexts(enemy, floorId, texts); - texts.push(""); - return [enemy, texts]; - }; - }, + if (specials == null) return ""; + for (var i = 0; i < specials.length; i++) { + if (special == specials[i][0]) + return ( + "\r[#FF6A6A]\\d" + + this._calSpecialContent(enemy, specials[i][1]) + + ":\\d\r[]" + + this._calSpecialContent(enemy, specials[i][2]) + ); + } + return ""; + }; + ui.prototype._drawBook_drawName = function ( + index, + enemy, + top, + left, + width + ) { + // 绘制第零列(名称和特殊属性) + // 如果需要添加自己的比如怪物的称号等,也可以在这里绘制 + core.setTextAlign("ui", "center"); + if (core.enemys.getSpecialText(enemy).length == 0) { + core.fillText( + "ui", + enemy.name, + left + width / 2, + top + 35, + "#DDDDDD", + this._buildFont(17, true), + width + ); + } else { + core.fillText( + "ui", + enemy.name, + left + width / 2, + top + 28, + "#DDDDDD", + this._buildFont(17, true), + width + ); + switch (core.enemys.getSpecialText(enemy).length) { + case 1: + core.fillText( + "ui", + core.enemys.getSpecialText(enemy)[0], + left + width / 2, + top + 50, + core.arrayToRGBA( + (core.enemys.getSpecialColor(enemy) || [])[0] || "#FF6A6A" + ), + this._buildFont(15, true), + width + ); + break; + case 2: + // Step 1: 计算字体 + var text = + core.enemys.getSpecialText(enemy)[0] + + " " + + core.enemys.getSpecialText(enemy)[1]; + core.setFontForMaxWidth( + "ui", + text, + width, + this._buildFont(15, true) + ); + // Step 2: 计算总宽度 + var totalWidth = core.calWidth("ui", text); + var leftWidth = core.calWidth( + "ui", + core.enemys.getSpecialText(enemy)[0] + ); + var rightWidth = core.calWidth( + "ui", + core.enemys.getSpecialText(enemy)[1] + ); + // Step 3: 绘制 + core.fillText( + "ui", + core.enemys.getSpecialText(enemy)[0], + left + (width + leftWidth - totalWidth) / 2, + top + 50, + core.arrayToRGBA( + (core.enemys.getSpecialColor(enemy) || [])[0] || "#FF6A6A" + ) + ); + core.fillText( + "ui", + core.enemys.getSpecialText(enemy)[1], + left + (width + totalWidth - rightWidth) / 2, + top + 50, + core.arrayToRGBA( + (core.enemys.getSpecialColor(enemy) || [])[1] || "#FF6A6A" + ) + ); + break; + default: + core.fillText( + "ui", + "多属性...", + left + width / 2, + top + 50, + "#FF6A6A", + this._buildFont(15, true), + width + ); + } + } + }; + ui.prototype._drawBookDetail_getInfo = function (index) { + var floorId = + core.floorIds[(core.status.event.ui || {}).index] || + core.status.floorId; + // 清除浏览地图时的光环缓存 + if (floorId != core.status.floorId && core.status.checkBlock) { + core.status.checkBlock.cache = {}; + } + var enemys = core.enemys.getCurrentEnemys(floorId); + console.log(123); + if (enemys.length == 0) return []; + index = core.clamp(index, 0, enemys.length - 1); + var enemy = enemys[index]; + var texts = core.enemys.getSpecialHint(enemy); + if (texts.length == 0) texts.push("该怪物无特殊属性。"); + if (enemy.description) texts.push(enemy.description + "\r"); + this._drawBookDetail_getTexts(enemy, floorId, texts); + texts.push(""); + return [enemy, texts]; + }; +}, "一防减伤": function () { // 在此增加新插件 ui.prototype._drawBook_drawRow3 = function ( @@ -14797,195 +14821,196 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = }; }, "滑动转场": function () { - // 在此增加新插件 - const defaultChange = { - left: "leftPortal", // 左箭头 - up: "upPortal", // 上箭头 - right: "rightPortal", // 右箭头 - down: "downPortal", // 下箭头 - upFloor: "upFloor", // 上楼 - downFloor: "downFloor", // 下楼 - }; - const dirData = { - //方向坐标 - up: [-1, 0], - down: [1, 0], - left: [0, -1], - right: [0, 1], - upFloor: [0, 0], - downFloor: [0, 0], - }; - let allChangeEntries = Object.entries(defaultChange); - const move = document.createElement("canvas"); - const speed = 12; - let modedata = 0; + // 在此增加新插件 + const defaultChange = { + left: "leftPortal", // 左箭头 + up: "upPortal", // 上箭头 + right: "rightPortal", // 右箭头 + down: "downPortal", // 下箭头 + upFloor: "upFloor", // 上楼 + downFloor: "downFloor", // 下楼 + }; + const dirData = { + //方向坐标 + up: [-1, 0], + down: [1, 0], + left: [0, -1], + right: [0, 1], + upFloor: [0, 0], + downFloor: [0, 0], + }; + let allChangeEntries = Object.entries(defaultChange); + const move = document.createElement("canvas"); + const speed = 12; + let modedata = 0; - move.width = 1248; - move.height = 1248; + move.width = 1248; + move.height = 1248; - const ctx = move.getContext("2d"); + const ctx = move.getContext("2d"); - events.prototype.changeFloor = function ( - floorId, - stair, - heroLoc, - time, - callback - ) { - let block = core.getBlock(hero.loc.x, hero.loc.y); - var info = this._changeFloor_getInfo(floorId, stair, heroLoc, time); + events.prototype.changeFloor = function ( + floorId, + stair, + heroLoc, + time, + callback + ) { + let block = core.getBlock(hero.loc.x, hero.loc.y); + var info = this._changeFloor_getInfo(floorId, stair, heroLoc, time); - if (info == null) { - if (callback) callback(); - return; - } - floorId = info.floorId; - info.locked = core.status.lockControl; + if (info == null) { + if (callback) callback(); + return; + } + floorId = info.floorId; + info.locked = core.status.lockControl; - core.dom.floorNameLabel.innerText = core.status.maps[floorId].title; - core.lockControl(); - core.stopAutomaticRoute(); - core.clearContinueAutomaticRoute(); - core.status.replay.animate = true; - clearInterval(core.interval.onDownInterval); - core.interval.onDownInterval = "tmp"; + core.dom.floorNameLabel.innerText = core.status.maps[floorId].title; + core.lockControl(); + core.stopAutomaticRoute(); + core.clearContinueAutomaticRoute(); + core.status.replay.animate = true; + clearInterval(core.interval.onDownInterval); + delete core.animateFrame.tip + core.interval.onDownInterval = "tmp"; - this._changeFloor_beforeChange(info, block, callback); - }; - events.prototype._changeFloor_beforeChange = function ( - info, - block, - callback - ) { - this._changeFloor_playSound(); - if ( - block && - block?.event && - !main.replayChecking && - !core.isReplaying() - ) { - const dirEntries = allChangeEntries.find( - (v) => v[1] === block.event.id - ); - if (block?.event?.trigger === "changeFloor" && dirEntries) { - const toFloorId = block.event.data.floorId; - const dir = dirEntries[0]; + this._changeFloor_beforeChange(info, block, callback); + }; + events.prototype._changeFloor_beforeChange = function ( + info, + block, + callback + ) { + this._changeFloor_playSound(); + if ( + block && + block?.event && + !main.replayChecking && + !core.isReplaying() + ) { + const dirEntries = allChangeEntries.find( + (v) => v[1] === block.event.id + ); + if (block?.event?.trigger === "changeFloor" && dirEntries) { + const toFloorId = block.event.data.floorId; + const dir = dirEntries[0]; - const data = core.ui._drawViewMaps_buildData( - core.floorIds.indexOf(core.status.floorId) - ); - const dataTo = core.ui._drawViewMaps_buildData( - core.floorIds.indexOf(toFloorId) - ); - const v = dirData[dir][1], // 水平数值 - h = dirData[dir][0]; //竖直数值 - ctx.clearRect(0, 0, 1248, 1248); - core.drawThumbnail(core.status.floorId, null, { - damage: data.damage, - ctx: ctx, - x: 416, - y: 416, - size: 1, - all: data.all, - }); - if (dir !== "upFloor" && dir !== "downFloor") { - core.drawThumbnail(toFloorId, null, { - damage: dataTo.damage, - ctx: ctx, - x: 416 + 416 * v, - y: 416 + 416 * h, - size: 1, - all: dataTo.all, - }); + const data = core.ui._drawViewMaps_buildData( + core.floorIds.indexOf(core.status.floorId) + ); + const dataTo = core.ui._drawViewMaps_buildData( + core.floorIds.indexOf(toFloorId) + ); + const v = dirData[dir][1], // 水平数值 + h = dirData[dir][0]; //竖直数值 + ctx.clearRect(0, 0, 1248, 1248); + core.drawThumbnail(core.status.floorId, null, { + damage: data.damage, + ctx: ctx, + x: 416, + y: 416, + size: 1, + all: data.all, + }); + if (dir !== "upFloor" && dir !== "downFloor") { + core.drawThumbnail(toFloorId, null, { + damage: dataTo.damage, + ctx: ctx, + x: 416 + 416 * v, + y: 416 + 416 * h, + size: 1, + all: dataTo.all, + }); - var _run = function () { - var cb = function () { - modedata = 0; - core.clearUI(); - core.clearMap("data"); - core.events._changeFloor_changing(info, callback); - }; + var _run = function () { + var cb = function () { + modedata = 0; + core.clearUI(); + core.clearMap("data"); + core.events._changeFloor_changing(info, callback); + }; - var animate = window.setInterval( - function () { - if (modedata >= 416) { - delete core.animateFrame.asyncId[animate]; - clearInterval(animate); - cb(); - } else { - core.clearUI(); - core.clearMap("data"); + var animate = window.setInterval( + function () { + if (modedata >= 416) { + delete core.animateFrame.asyncId[animate]; + clearInterval(animate); + cb(); + } else { + core.clearUI(); + core.clearMap("data"); - core.canvas.data.drawImage( - move, - 416 + modedata * v, - 416 + modedata * h, - 416, - 416, - 0, - 0, - 416, - 416 - ); - let status = "leftFoot"; + core.canvas.data.drawImage( + move, + 416 + modedata * v, + 416 + modedata * h, + 416, + 416, + 0, + 0, + 416, + 416 + ); + let status = "leftFoot"; - if (modedata > 208) { - status = "rightFoot"; - } - const img = core.material.images.hero; - const heroIconArr = core.material.icons.hero; - const width = core.material.icons.hero.width || 32; - const height = core.material.icons.hero.height; - const heroIcon = heroIconArr[dir]; + if (modedata > 208) { + status = "rightFoot"; + } + const img = core.material.images.hero; + const heroIconArr = core.material.icons.hero; + const width = core.material.icons.hero.width || 32; + const height = core.material.icons.hero.height; + const heroIcon = heroIconArr[dir]; - core.canvas.data.drawImage( - img, - (heroIcon[status] % 4) * width, - heroIcon.loc * height, - width, - height, - core.status.hero.loc.x * 32 - - core.bigmap.offsetX - - (modedata - (modedata * 32) / 416) * v, - core.status.hero.loc.y * 32 - - 16 - - (modedata - (modedata * 32) / 416) * h, - width, - height - ); - modedata += speed; - clearInterval(animate); - delete core.animateFrame.asyncId[animate]; - _run(); - } - }, - core.status.replay.speed == 24 - ? 1 - : 10 / core.status.replay.speed - ); + core.canvas.data.drawImage( + img, + (heroIcon[status] % 4) * width, + heroIcon.loc * height, + width, + height, + core.status.hero.loc.x * 32 - + core.bigmap.offsetX - + (modedata - (modedata * 32) / 416) * v, + core.status.hero.loc.y * 32 - + 16 - + (modedata - (modedata * 32) / 416) * h, + width, + height + ); + modedata += speed; + clearInterval(animate); + delete core.animateFrame.asyncId[animate]; + _run(); + } + }, + core.status.replay.speed == 24 ? + 1 : + 10 / core.status.replay.speed + ); - core.animateFrame.lastAsyncId = animate; - core.animateFrame.asyncId[animate] = cb; - }; - _run(); - return; - } - } - } - // 需要 setTimeout 执行,不然会出错 - window.setTimeout(function () { - if (info.time == 0) core.events._changeFloor_changing(info, callback); - else - core.showWithAnimate( - core.dom.floorMsgGroup, - info.time / 2, - function () { - core.events._changeFloor_changing(info, callback); - } - ); - }, 25); - }; - }, + core.animateFrame.lastAsyncId = animate; + core.animateFrame.asyncId[animate] = cb; + }; + _run(); + return; + } + } + } + // 需要 setTimeout 执行,不然会出错 + window.setTimeout(function () { + if (info.time == 0) core.events._changeFloor_changing(info, callback); + else + core.showWithAnimate( + core.dom.floorMsgGroup, + info.time / 2, + function () { + core.events._changeFloor_changing(info, callback); + } + ); + }, 25); + }; +}, "剧情cg": function () { // 在此增加新插件 // 在此增加新插件 @@ -16386,53 +16411,1121 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = }; }, "回合制boss战": function () { - // 在此增加新插件 - const boss = document.createElement("canvas"); //boss战画布设置 - boss.style.position = "absolute"; - boss.style.zIndex = 300; - boss.style.display = "none"; - boss.id = "boss"; - main.dom.gameGroup.insertAdjacentElement("afterend", boss); - boss.style.top = "50%"; - boss.style.left = "50%"; - boss.style.transform = "translate(-50%,-50%)"; - const ctx = boss.getContext("2d"); - main.dom.boss = boss; - boss.onclick = function (e) { - try { - e.preventDefault(); - if (core.isPlaying()) return false; - const left = core.dom.gameGroup.offsetLeft; - const top = core.dom.gameGroup.offsetTop; - const px = Math.floor((e.clientX - left) / core.domStyle.scale), - py = Math.floor((e.clientY - top) / core.domStyle.scale); - core.ui.boss.onclick(px * 3, py * 3); - } catch (ee) { - main.log(ee); - } - }; - class boss1 { - constructor() { - this.bg = ""; - } - cavans() { - if (core.domStyle.isVertical) { - ctx.canvas.width = 1248; - ctx.canvas.height = 2028; + // 在此增加新插件 + const boss = document.createElement("canvas"); //boss战画布设置 + boss.style.position = "absolute"; + boss.style.zIndex = 310; + boss.style.display = "none"; + boss.id = "boss"; + main.dom.gameGroup.insertAdjacentElement("afterend", boss); + boss.style.top = "50%"; + boss.style.left = "50%"; + boss.style.transform = "translate(-50%,-50%)"; + const ctx = boss.getContext("2d"); + main.dom.boss = boss; + const boss1 = document.createElement("canvas"); //boss战画布设置 + boss1.style.position = "absolute"; + boss1.style.zIndex = 300; + boss1.style.display = "none"; + boss1.id = "boss1"; + main.dom.gameGroup.insertAdjacentElement("afterend", boss1); + boss1.style.top = "50%"; + boss1.style.left = "50%"; + boss1.style.transform = "translate(-50%,-50%)"; + const ctx1 = boss1.getContext("2d"); + main.dom.boss1 = boss1; + const boss2 = document.createElement("canvas"); //boss战画布设置 + boss2.style.position = "absolute"; + boss2.style.zIndex = 301; + boss2.style.display = "none"; + boss2.id = "boss2"; + main.dom.gameGroup.insertAdjacentElement("afterend", boss2); + boss2.style.top = "50%"; + boss2.style.left = "50%"; + boss2.style.transform = "translate(-50%,-50%)"; + main.dom.boss2 = boss2; + const ctx2 = boss2.getContext("2d"); + const boss3 = document.createElement("canvas"); //boss战画布设置 + boss3.style.position = "absolute"; + boss3.style.zIndex = 302; + boss3.style.display = "none"; + boss3.id = "boss3"; + main.dom.gameGroup.insertAdjacentElement("afterend", boss3); + boss3.style.top = "50%"; + boss3.style.left = "50%"; + boss3.style.transform = "translate(-50%,-50%)"; + main.dom.boss3 = boss3; + const ctx3 = boss3.getContext("2d"); + const boss4 = document.createElement("canvas"); //boss战画布设置 + boss4.style.position = "absolute"; + boss4.style.zIndex = 303; + boss4.style.display = "none"; + boss4.id = "boss4"; + main.dom.gameGroup.insertAdjacentElement("afterend", boss4); + boss4.style.top = "50%"; + boss4.style.left = "50%"; + boss4.style.transform = "translate(-50%,-50%)"; + const ctx4 = boss4.getContext("2d"); + main.dom.boss4 = boss4; + const boss5 = document.createElement("canvas"); //boss战画布设置 + boss5.style.position = "absolute"; + boss5.style.zIndex = 304; + boss5.style.display = "none"; + boss5.id = "boss5"; + main.dom.gameGroup.insertAdjacentElement("afterend", boss5); + boss5.style.top = "50%"; + boss5.style.left = "50%"; + boss5.style.transform = "translate(-50%,-50%)"; + const ctx5 = boss5.getContext("2d"); + main.dom.boss5 = boss5; + boss.onclick = function (e) { + try { + e.preventDefault(); + if (core.isPlaying()) return false; + const left = core.dom.gameGroup.offsetLeft; + const top = core.dom.gameGroup.offsetTop; + const px = Math.floor((e.clientX - left) / core.domStyle.scale), + py = Math.floor((e.clientY - top) / core.domStyle.scale); + if (core.domStyle.isVertical) { + core.ui.boss.click(1248 - py * 3, px * 3) + } else { + core.ui.boss.click(px * 3, py * 3); + } - core.setTextAlign(ctx, "center"); - } else { - ctx.canvas.width = 2028; - ctx.canvas.height = 1248; + } catch (ee) { + main.log(ee); + } + }; - core.setTextAlign(ctx, "center"); - } - } - start() {} - onclick(px, py) {} - } - core.ui.boss = new boss1(); - }, + + class Boss { + constructor() { + //绘制需要的变量 + this.bg = "bg_3512.webp"; + this.heroImage = "tati_310101.webp" + this.hero = { hp: 1000, atk: 100, def: 100, spell: 100, speed: 10, mdef: 10 } + this.boss = { name: "菲奥奈", id: "angel", image: "tati_050143.webp", hp: 1000, atk: 100, def: 100, speed: 10, mdef: 10 } + this.enemy = [ + { name: "小蝙蝠", id: "bat", hp: 1000, atk: 100, def: 100, speed: 10, mdef: 10 }, + { name: "红蝙蝠", id: "redBat", hp: 1000, atk: 100, def: 100, speed: 10, mdef: 10 }, + { name: "大蝙蝠", id: "bigBat", hp: 1000, atk: 100, def: 100, speed: 10, mdef: 10 }, + { name: "绿色史莱姆", id: "greenSlime", hp: 1000, atk: 100, def: 100, speed: 10, mdef: 10 }, + { name: "红色史莱姆", id: "redSlime", hp: 1000, atk: 100, def: 100, speed: 10, mdef: 10 }, + { name: "黑色史莱姆", id: "blackSlime", hp: 1000, atk: 100, def: 100, speed: 10, mdef: 10 }, + ] + this.bossImage = "tati_050143.webp" + this.selection = "boss" + this.herobuff = ["sword1:1", "fly:30"] + this.bossbuff = ["fly:2", "book:12"] + this.enemybuff = [ + [], + [], + [], + [], + [], + [] + ] + } + click(px, py) { + //点击效果 + const makeBox = ([x, y], [w, h]) => { + return [ + [x, y], + [x + w, y + h], + ]; + }; + const inRect = ([x, y], [ + [sx, sy], + [dx, dy] + ]) => { + return sx <= x && x <= dx && sy <= y && y <= dy; + }; + const pos = [px, py]; + } + async bossStart() { + core.lockControl() + await this.blackBg() + this.moveboss() + await this.movehero() + await this.moveStatus() + this.drawenemy() + + } + async bossEnd() { + await this.close() + core.unlockControl() + + } + drawenemy() { + let block, + time = 0, + farme = 0; + boss5.style.display = 'block' + core.registerAnimationFrame('enemyanimate', true, (temptime) => { + if (temptime - time > 1000 / 60) { + time = temptime + farme += 1 + let animate = Math.floor(farme / 30), + posx = 700, + posy = 350; + core.clearMap(ctx5) + if (core.domStyle.isVertical) { + ctx5.canvas.width = 1248; + ctx5.canvas.height = 2028; + ctx5.save(); //保存设置 + ctx5.translate(1248, 0); //重新定位右上角为基准 + ctx5.rotate(Math.PI / 2); //旋转90度 + } else { + ctx5.canvas.width = 2028; + ctx5.canvas.height = 1248; + } + let enemy = false + this.enemy.forEach(v => { if (v.hp > 0) enemy = true }) + if (enemy) { + + core.drawWindowSkin("winskin.webp", ctx5, 650, 250, 400, 660, null, null, null, 3) + if (this.selection === "boss") core.strokeRect(ctx5, 800, 600, 100, 150, "yellow", 6) + const bossBlock = core.getBlockInfo(this.boss.id) + core.drawImage( + ctx5, + bossBlock.image, + 32 * (animate % 4), + bossBlock.posY * 48, + 32, + 48, + 800, + 600, + 96, + 144 + ); + core.drawImage( + ctx5, + "hero.webp", + 32 * (animate % 4), + 144, + 32, + 48, + 800, + 750, + 96, + 144 + ); + for (let i = 0; i < this.enemy.length; i++) { + if (this.enemy[i].id) { + block = core.getBlockInfo(this.enemy[i].id) + } else { + posx += 100 + if (i === 2) { + posx = 600 + posy += 150 + } + continue + } + + if (block.cls === "enemys") { + core.drawImage( + ctx5, + block.image, + 32 * (animate % 2), + block.posY * 32, + 32, + 32, + posx, + posy, + 96, + 96 + ); + if (this.selection == i) core.strokeRect(ctx5, posx, posy, 100, 100, "yellow", 6) + } else { + core.drawImage( + ctx5, + block.image, + 32 * (animate % 4), + block.posY * 48, + 32, + 48, + posx, + posy, + 96, + 144 + ); + if (this.selection == i) core.strokeRect(ctx5, posx, posy, 100, 150, "yellow", 6) + } + + posx += 100 + if (i === 2) { + posx = 700 + posy += 150 + } + } + } + + ctx5.restore(); + } + }) + } + drawhero() { + core.clearMap(ctx2) + if (core.domStyle.isVertical) { + ctx2.canvas.width = 1248; + ctx2.canvas.height = 2028; + ctx2.save(); //保存设置 + ctx2.translate(1248, 0); //重新定位右上角为基准 + ctx2.rotate(Math.PI / 2); //旋转90度 + } else { + ctx2.canvas.width = 2028; + ctx2.canvas.height = 1248; + } + core.drawImage(ctx2, this.heroImage, 0, 168, 750, 1080) + ctx2.restore(); + } + movehero() { + boss2.style.display = "block" + core.clearMap(ctx2) + let time = 0, + px = -200; + return new Promise((resolve) => { + core.registerAnimationFrame("moveheroImage", true, (temptime) => { + if (temptime - time > 1000 / 60) { + time = temptime + core.clearMap(ctx2) + if (core.domStyle.isVertical) { + ctx2.canvas.width = 1248; + ctx2.canvas.height = 2028; + ctx2.save(); //保存设置 + ctx2.translate(1248, 0); //重新定位右上角为基准 + ctx2.rotate(Math.PI / 2); //旋转90度 + } else { + ctx2.canvas.width = 2028; + ctx2.canvas.height = 1248; + } + core.drawImage(ctx2, this.heroImage, px, 168, 750, 1080) + px += 10 + ctx2.restore(); + if (px >= 0) { + core.unregisterAnimationFrame("moveheroImage") + this.drawhero() + resolve() + + } + } + }) + }) + } + update() { + core.drawImage(ctx1, this.bg, 0, 0, 2028, 1248) + this.drawboss() + this.drawhero() + this.drawStatus() + } + drawboss() { + core.clearMap(ctx3) + if (core.domStyle.isVertical) { + ctx3.canvas.width = 1248; + ctx3.canvas.height = 2028; + ctx3.save(); //保存设置 + ctx3.translate(1248, 0); //重新定位右上角为基准 + ctx3.rotate(Math.PI / 2); //旋转90度 + } else { + ctx3.canvas.width = 2028; + ctx3.canvas.height = 1248; + } + core.drawImage(ctx3, this.bossImage, 1400, 168, 750, 1080) + + ctx3.restore(); + } + moveboss() { + boss3.style.display = "block" + core.clearMap(ctx3) + let time = 0, + px = 1600; + return new Promise((resolve) => { + core.registerAnimationFrame("movebossImage", true, (temptime) => { + if (temptime - time > 1000 / 60) { + time = temptime + core.clearMap(ctx3) + if (core.domStyle.isVertical) { + ctx3.canvas.width = 1248; + ctx3.canvas.height = 2028; + ctx3.save(); //保存设置 + ctx3.translate(1248, 0); //重新定位右上角为基准 + ctx3.rotate(Math.PI / 2); //旋转90度 + } else { + ctx3.canvas.width = 2028; + ctx3.canvas.height = 1248; + } + core.drawImage(ctx3, this.bossImage, px, 168, 750, 1080) + px -= 10 + ctx3.restore(); + if (px <= 1400) { + core.unregisterAnimationFrame("movebossImage") + this.drawboss() + resolve() + + } + } + }) + }) + } + drawStatus() { + + core.clearMap(ctx4) + if (core.domStyle.isVertical) { + ctx4.canvas.width = 1248; + ctx4.canvas.height = 2028; + ctx4.save(); //保存设置 + ctx4.translate(1248, 0); //重新定位右上角为基准 + ctx4.rotate(Math.PI / 2); //旋转90度 + } else { + ctx4.canvas.width = 2028; + ctx4.canvas.height = 1248; + } + core.drawWindowSkin("winskin.webp", ctx4, 600, 920, 900, 300, null, null, null, 3) + core.fillBoldText1( + ctx4, + hero.name, + 630, + 1000, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + core.fillBoldText1( + ctx4, + "状态", + 880, + 1000, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + core.fillBoldText1( + ctx4, + '生命 ' + this.hero.hp, + 630, + 1070, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + core.fillBoldText1( + ctx4, + '攻击 ' + this.hero.atk, + 630, + 1120, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + core.fillBoldText1( + ctx4, + '防御 ' + this.hero.def, + 630, + 1170, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + core.fillBoldText1( + ctx4, + '法强 ' + this.hero.spell, + 1080, + 1070, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + core.fillBoldText1( + ctx4, + '法抗 ' + this.hero.mdef + "%", + 1080, + 1120, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + core.fillBoldText1( + ctx4, + '速度 ' + this.hero.speed, + 1080, + 1170, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + let posx = 980 + this.herobuff.forEach(v => { + if (v) { + const a = v.split(":") + core.drawIcon(ctx4, a[0], posx, 950, 64, 64) + core.setTextAlign(ctx4, "right") + core.fillBoldText1( + ctx4, + a[1], + posx + 50, + 1000, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(24, true) + ); + core.setTextAlign(ctx4, "left") + posx += 80 + } + }) + if (this.selection === "boss") { + core.drawWindowSkin("winskin.webp", ctx4, 50, 50, 1900, 200, null, null, null, 3) + core.fillBoldText1( + ctx4, + this.boss.name, + 100, + 120, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + core.fillBoldText1( + ctx4, + "状态", + 500, + 120, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + core.fillBoldText1( + ctx4, + "生命 " + this.boss.hp, + 100, + 220, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + core.fillBoldText1( + ctx4, + "攻击 " + this.boss.atk, + 500, + 220, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + core.fillBoldText1( + ctx4, + "防御 " + this.boss.def, + 900, + 220, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + core.fillBoldText1( + ctx4, + "法抗 " + this.boss.mdef + "%", + 1300, + 220, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + core.fillBoldText1( + ctx4, + "速度 " + this.boss.speed, + 1700, + 220, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + + ); + let posx = 600 + this.bossbuff.forEach(v => { + if (v) { + const a = v.split(":") + core.drawIcon(ctx4, a[0], posx, 80, 64, 64) + core.setTextAlign(ctx4, "right") + core.fillBoldText1( + ctx4, + a[1], + posx + 50, + 130, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(24, true) + ); + core.setTextAlign(ctx4, "left") + posx += 80 + } + }) + } else if (this.selection === "") {} else { + core.drawWindowSkin("winskin.webp", ctx4, 50, 50, 1900, 200, null, null, null, 3) + core.fillBoldText1( + ctx4, + this.enemy[this.selection].name, + 100, + 120, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + core.fillBoldText1( + ctx4, + "状态", + 500, + 120, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + core.fillBoldText1( + ctx4, + "生命 " + this.enemy[this.selection].hp, + 100, + 220, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + core.fillBoldText1( + ctx4, + "攻击 " + this.enemy[this.selection].atk, + 500, + 220, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + core.fillBoldText1( + ctx4, + "防御 " + this.enemy[this.selection].def, + 900, + 220, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + core.fillBoldText1( + ctx4, + "法抗 " + this.enemy[this.selection].mdef + "%", + 1300, + 220, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + core.fillBoldText1( + ctx4, + "速度 " + this.enemy[this.selection].speed, + 1700, + 220, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + + ); + let posx = 600 + this.enemybuff[this.selection].forEach(v => { + if (v) { + const a = v.split(":") + core.drawIcon(ctx4, a[0], posx, 80, 64, 64) + core.setTextAlign(ctx4, "right") + core.fillBoldText1( + ctx4, + a[1], + posx + 50, + 130, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(24, true) + ); + core.setTextAlign(ctx4, "left") + posx += 80 + } + }) + } + ctx4.restore(); + } + moveStatus() { + boss4.style.display = "block" + let time = 0, + posy = 400; + return new Promise((resolve) => { + core.registerAnimationFrame("moveStatus", true, (temptime) => { + if (temptime - time > 1000 / 60) { + time = temptime + core.clearMap(ctx4) + if (core.domStyle.isVertical) { + ctx4.canvas.width = 1248; + ctx4.canvas.height = 2028; + ctx4.save(); //保存设置 + ctx4.translate(1248, 0); //重新定位右上角为基准 + ctx4.rotate(Math.PI / 2); //旋转90度 + } else { + ctx4.canvas.width = 2028; + ctx4.canvas.height = 1248; + } + core.drawWindowSkin("winskin.webp", ctx4, 600, 920 + posy, 900, 300, null, null, null, 3) + core.fillBoldText1( + ctx4, + hero.name, + 630, + 1000 + posy, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + core.fillBoldText1( + ctx4, + "状态", + 880, + 1000 + posy, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + core.fillBoldText1( + ctx4, + '生命 ' + this.hero.hp, + 630, + 1070 + posy, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + core.fillBoldText1( + ctx4, + '攻击 ' + this.hero.atk, + 630, + 1120 + posy, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + core.fillBoldText1( + ctx4, + '防御 ' + this.hero.def, + 630, + 1170 + posy, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + core.fillBoldText1( + ctx4, + '法强 ' + this.hero.spell, + 1080, + 1070 + posy, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + core.fillBoldText1( + ctx4, + '法抗 ' + this.hero.mdef + "%", + 1080, + 1120 + posy, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + core.fillBoldText1( + ctx4, + '速度 ' + this.hero.speed, + 1080, + 1170 + posy, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + let posx = 980 + this.herobuff.forEach(v => { + if (v) { + const a = v.split(":") + core.drawIcon(ctx4, a[0], posx, 950 + posy, 64, 64) + core.setTextAlign(ctx4, "right") + core.fillBoldText1( + ctx4, + a[1], + posx + 50, + 1000 + posy, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(24, true) + ); + core.setTextAlign(ctx4, "left") + posx += 80 + } + }) + if (this.selection === "boss") { + core.drawWindowSkin("winskin.webp", ctx4, 50, 50 - posy / 2, 1900, 200, null, null, null, 3) + core.fillBoldText1( + ctx4, + this.boss.name, + 100, + 120 - posy / 2, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + core.fillBoldText1( + ctx4, + "状态", + 500, + 120 - posy / 2, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + core.fillBoldText1( + ctx4, + "生命 " + this.boss.hp, + 100, + 220 - posy / 2, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + core.fillBoldText1( + ctx4, + "攻击 " + this.boss.atk, + 500, + 220 - posy / 2, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + core.fillBoldText1( + ctx4, + "防御 " + this.boss.def, + 900, + 220 - posy / 2, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + core.fillBoldText1( + ctx4, + "法抗 " + this.boss.mdef + "%", + 1300, + 220 - posy / 2, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + core.fillBoldText1( + ctx4, + "速度 " + this.boss.speed, + 1700, + 220 - posy / 2, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + + ); + let posx = 600 + this.bossbuff.forEach(v => { + if (v) { + const a = v.split(":") + core.drawIcon(ctx4, a[0], posx, 80 - posy / 2, 64, 64) + core.setTextAlign(ctx4, "right") + core.fillBoldText1( + ctx4, + a[1], + posx + 50, + 130 - posy / 2, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(24, true) + ); + core.setTextAlign(ctx4, "left") + posx += 80 + } + }) + } else if (this.selection === "") {} else { + core.drawWindowSkin("winskin.webp", ctx4, 50, 50 - posy / 2, 1900, 200, null, null, null, 3) + core.fillBoldText1( + ctx4, + this.enemy[this.selection].name, + 100, + 120 - posy / 2, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + core.fillBoldText1( + ctx4, + "状态", + 500, + 120 - posy / 2, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + core.fillBoldText1( + ctx4, + "生命 " + this.enemy[this.selection].hp, + 100, + 220 - posy / 2, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + core.fillBoldText1( + ctx4, + "攻击 " + this.enemy[this.selection].atk, + 500, + 220 - posy / 2, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + core.fillBoldText1( + ctx4, + "防御 " + this.enemy[this.selection].def, + 900, + 220 - posy / 2, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + core.fillBoldText1( + ctx4, + "法抗 " + this.enemy[this.selection].mdef + "%", + 1300, + 220 - posy / 2, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + ); + core.fillBoldText1( + ctx4, + "速度 " + this.enemy[this.selection].speed, + 1700, + 220 - posy / 2, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(44, true) + + ); + let posx = 600 + this.enemybuff[this.selection].forEach(v => { + if (v) { + const a = v.split(":") + core.drawIcon(ctx4, a[0], posx, 80 - posy / 2, 64, 64) + core.setTextAlign(ctx4, "right") + core.fillBoldText1( + ctx4, + a[1], + posx + 50, + 130 - posy / 2, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(24, true) + ); + core.setTextAlign(ctx4, "left") + posx += 80 + } + }) + } + ctx4.restore(); + posy -= 10 + if (posy <= 0) { + core.unregisterAnimationFrame("moveStatus") + this.drawStatus() + resolve() + } + } + }) + }) + } + close() { + let globalAlpha = 0, + time = 0 + boss.style.display = 'block' + return new Promise((resolve) => { + core.registerAnimationFrame("closeblack", true, (temptime) => { + if (temptime - time > 1000 / 60) { + time = temptime + core.clearMap(ctx) + if (core.domStyle.isVertical) { + ctx.canvas.width = 1248; + ctx.canvas.height = 2028; + ctx.save(); //保存设置 + ctx.translate(1248, 0); //重新定位右上角为基准 + ctx.rotate(Math.PI / 2); //旋转90度 + } else { + ctx.canvas.width = 2028; + ctx.canvas.height = 1248; + } + + + ctx.globalAlpha = globalAlpha; + + core.fillRect(ctx, 0, 0, 2028, 1248); + globalAlpha += 1 / 30 + ctx.restore(); + if (globalAlpha > 1) { + time = 0 + globalAlpha = 1 + core.unregisterAnimationFrame("closeblack") + core.unregisterAnimationFrame('enemyanimate') + boss1.style.display = 'none' + boss2.style.display = 'none' + boss3.style.display = 'none' + boss4.style.display = 'none' + boss5.style.display = 'none' + core.registerAnimationFrame("closeblack2", true, (temptime) => { + if (temptime - time > 1000 / 60) { + time = temptime + core.clearMap(ctx) + if (core.domStyle.isVertical) { + ctx.canvas.width = 1248; + ctx.canvas.height = 2028; + ctx.save(); //保存设置 + ctx.translate(1248, 0); //重新定位右上角为基准 + ctx.rotate(Math.PI / 2); //旋转90度 + } else { + ctx.canvas.width = 2028; + ctx.canvas.height = 1248; + } + ctx.globalAlpha = globalAlpha + core.fillRect(ctx1, 0, 0, 2028, 1248, "#000000"); + ctx.restore(); + globalAlpha -= 1 / 30 + if (globalAlpha < 0) { + core.unregisterAnimationFrame("closeblack2") + + boss.style.display = 'none' + + resolve() + } + } + }) + } + } + }) + }) + } + + blackBg() { + let globalAlpha = 0, + time = 0, + img = core.material.images.images[this.bg]; + boss1.style.display = 'block' + return new Promise((resolve) => { + core.registerAnimationFrame("bossblack", true, (temptime) => { + if (temptime - time > 1000 / 60) { + time = temptime + core.clearMap(ctx1) + if (core.domStyle.isVertical) { + ctx1.canvas.width = 1248; + ctx1.canvas.height = 2028; + ctx1.save(); //保存设置 + ctx1.translate(1248, 0); //重新定位右上角为基准 + ctx1.rotate(Math.PI / 2); //旋转90度 + } else { + ctx1.canvas.width = 2028; + ctx1.canvas.height = 1248; + } + + + ctx1.globalAlpha = globalAlpha; + + core.fillRect(ctx1, 0, 0, 2028, 1248); + globalAlpha += 1 / 30 + ctx1.restore(); + if (globalAlpha > 1) { + time = 0 + globalAlpha = 0 + core.unregisterAnimationFrame("bossblack") + core.registerAnimationFrame("bossBg", true, (temptime) => { + if (temptime - time > 1000 / 60) { + time = temptime + core.clearMap(ctx1) + if (core.domStyle.isVertical) { + ctx1.canvas.width = 1248; + ctx1.canvas.height = 2028; + ctx1.save(); //保存设置 + ctx1.translate(1248, 0); //重新定位右上角为基准 + ctx1.rotate(Math.PI / 2); //旋转90度 + } else { + ctx1.canvas.width = 2028; + ctx1.canvas.height = 1248; + } + + ctx1.globalAlpha = 1 + core.fillRect(ctx1, 0, 0, 2028, 1248); + ctx1.globalAlpha = globalAlpha + if (img) ctx1.drawImage(img, 0, 0, 2028, 1248); + ctx1.restore(); + globalAlpha += 1 / 30 + if (globalAlpha > 1) { + core.unregisterAnimationFrame("bossBg") + resolve() + } + } + }) + } + } + }) + }) + } + } + core.ui.boss = new Boss() + + + +}, "剧情视频引用": function () { // 在此增加新插件 let a; @@ -16617,127 +17710,127 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = }; }, "帧动画/图片叠拼": function () { - // 在此增加新插件 - this.animationDrawable = function ( - allFarme, - color, - globalAlpha, - imageList, - soundList - ) { - if (!core.isPlaying()) { - return core.doAction(); - } - const over = main.dom.over; - const ctx = over.getContext("2d"); - over.style.display = "block"; + // 在此增加新插件 + this.animationDrawable = function ( + allFarme, + color, + globalAlpha, + imageList, + soundList + ) { + if (!core.isPlaying()) { + return core.doAction(); + } + const over = main.dom.over; + const ctx = over.getContext("2d"); + over.style.display = "block"; - let farme = 0; - let now = 0; - core.registerAnimationFrame( - "animationDrawable", - true, - function (timestamp) { - if (timestamp - now > 1000 / 60) { - now = timestamp; - if (core.domStyle.isVertical) { - over.width = 1248; - over.height = 2028; - ctx.save(); //保存设置 - ctx.translate(1248, 0); //重新定位右上角为基准 - ctx.rotate(Math.PI / 2); //旋转90度 - } else { - over.width = 2028; - over.height = 1248; - } + let farme = 0; + let now = 0; + core.registerAnimationFrame( + "animationDrawable", + true, + function (timestamp) { + if (timestamp - now > 1000 / 60) { + now = timestamp; + if (core.domStyle.isVertical) { + over.width = 1248; + over.height = 2028; + ctx.save(); //保存设置 + ctx.translate(1248, 0); //重新定位右上角为基准 + ctx.rotate(Math.PI / 2); //旋转90度 + } else { + over.width = 2028; + over.height = 1248; + } - ctx.globalAlpha = (globalAlpha ?? 100) / 100; - core.fillRect(ctx, 0, 0, 2028, 1248, color); + ctx.globalAlpha = (globalAlpha ?? 100) / 100; + core.fillRect(ctx, 0, 0, 2028, 1248, color); - imageList.forEach(function (one) { - if ( - farme >= (one.beforefarme ?? 0) && - farme <= (one.afterfarme ?? allFarme) - ) { - const img = core.material.images.images?.[one.image]; - if (img) { - const gla = one.globalAlpha ?? 100; - const agla = one.aglobalAlpha ?? gla, - beforefarme = one.beforefarme ?? 0; - const afterfarme = one.afterfarme ?? allFarme; + imageList.forEach(function (one) { + if ( + farme >= (one.beforefarme ?? 0) && + farme <= (one.afterfarme ?? allFarme) + ) { + const img = core.material.images.images?.[one.image]; + if (img) { + const gla = one.globalAlpha ?? 100; + const agla = one.aglobalAlpha ?? gla, + beforefarme = one.beforefarme ?? 0; + const afterfarme = one.afterfarme ?? allFarme; - ctx.globalAlpha = - (gla + - ((agla - gla) * (farme - beforefarme)) / - (afterfarme - beforefarme || 1)) / - 100; + ctx.globalAlpha = + (gla + + ((agla - gla) * (farme - beforefarme)) / + (afterfarme - beforefarme || 1)) / + 100; - const cx = - (one.cx ?? 0) + - (((one.acx ?? 0) - (one.cx ?? 0)) * - (farme - beforefarme)) / - (afterfarme - beforefarme || 1), - cy = - (one.cy ?? 0) + - (((one.acy ?? 0) - (one.cy ?? 0)) * - (farme - beforefarme)) / - (afterfarme - beforefarme || 1), - cw = - (one.cw ?? img.width) + - (((one.acw ?? img.width) - (one.cw ?? img.width)) * - (farme - beforefarme)) / - (afterfarme - beforefarme || 1), - ch = - (one.ch ?? img.height) + - (((one.acw ?? img.height) - (one.cw ?? img.height)) * - (farme - beforefarme)) / - (afterfarme - beforefarme || 1), - x = - (one.x ?? 0) + - (((one.ax ?? 0) - (one.x ?? 0)) * (farme - beforefarme)) / - (afterfarme - beforefarme || 1), - y = - (one.y ?? 0) + - (((one.ay ?? 0) - (one.y ?? 0)) * (farme - beforefarme)) / - (afterfarme - beforefarme || 1), - w = - (one.w ?? 2028) + - (((one.aw ?? 2028) - (one.w ?? 2028)) * - (farme - beforefarme)) / - (afterfarme - beforefarme || 1), - h = - (one.h ?? 1248) + - (((one.aw ?? 1248) - (one.w ?? 1248)) * - (farme - beforefarme)) / - (afterfarme - beforefarme || 1); - ctx.drawImage(img, cx, cy, cw, ch, x, y, w, h); - } - } - }); - soundList.forEach(function (one) { - const lisen = - one.sound && - core.sounds[one.sound] && - core.musicStatus.soundStatus; - if (farme == one.startfarme && lisen) { - if (one.stopbefore) core.stopSound(); - core.playSound(one.sound); - } - }); - farme++; - ctx.globalAlpha = 1; - ctx.restore(); + const cx = + (one.cx ?? 0) + + (((one.acx ?? 0) - (one.cx ?? 0)) * + (farme - beforefarme)) / + (afterfarme - beforefarme || 1), + cy = + (one.cy ?? 0) + + (((one.acy ?? 0) - (one.cy ?? 0)) * + (farme - beforefarme)) / + (afterfarme - beforefarme || 1), + cw = + (one.cw ?? img.width) + + (((one.acw ?? img.width) - (one.cw ?? img.width)) * + (farme - beforefarme)) / + (afterfarme - beforefarme || 1), + ch = + (one.ch ?? img.height) + + (((one.acw ?? img.height) - (one.cw ?? img.height)) * + (farme - beforefarme)) / + (afterfarme - beforefarme || 1), + x = + (one.x ?? 0) + + (((one.ax ?? 0) - (one.x ?? 0)) * (farme - beforefarme)) / + (afterfarme - beforefarme || 1), + y = + (one.y ?? 0) + + (((one.ay ?? 0) - (one.y ?? 0)) * (farme - beforefarme)) / + (afterfarme - beforefarme || 1), + w = + (one.w ?? 2028) + + (((one.aw ?? 2028) - (one.w ?? 2028)) * + (farme - beforefarme)) / + (afterfarme - beforefarme || 1), + h = + (one.h ?? 1248) + + (((one.aw ?? 1248) - (one.w ?? 1248)) * + (farme - beforefarme)) / + (afterfarme - beforefarme || 1); + ctx.drawImage(img, cx, cy, cw, ch, x, y, w, h); + } + } + }); + soundList.forEach(function (one) { + const lisen = + one.sound && + core.sounds[one.sound] && + core.musicStatus.soundStatus; + if (farme == one.startfarme && lisen) { + if (one.stopbefore) core.stopSound(); + core.playSound(one.sound); + } + }); + farme++; + ctx.globalAlpha = 1; + ctx.restore(); - if (farme > allFarme) { - core.unregisterAnimationFrame("animationDrawable"); - over.style.display = "none"; - core.doAction(); - } - } - } - ); - }; - }, + if (farme > allFarme) { + core.unregisterAnimationFrame("animationDrawable"); + over.style.display = "none"; + core.doAction(); + } + } + } + ); + }; +}, "musicMode": function () { // 在此增加新插件 const music = document.createElement("canvas");