//============================================================================== // LN_MysteryRogueSystem.js // ----------------------------------------------------------------------------- // Copyright (c) 2022 lriki // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php // ----------------------------------------------------------------------------- // [GitHub] : https://github.com/lriki/LN_MysteryRogueSystem // [Twitter] : https://twitter.com/lriki8 //============================================================================== /*:ja * @target MZ * @plugindesc LN_MysteryRogueSystem v0.8.0 * @author lriki * * @help test. * * MIT License * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * @param Group_Inventory * @text 持ち物 * @default ------------------------------------------------------------ * * @param InventoryCapacity * @parent Group_Inventory * @text 持ち物の最大数 * @type number * @default 24 * * @param InventoryItemsPerPage * @parent Group_Inventory * @text ウィンドウの1ページ分のアイテム数 * @type number * @default 12 * * @param Group_Map * @text マップ * @default ------------------------------------------------------------ * * @param RandomMapPaddingX * @parent Group_Map * @text ランダムマップの外周幅 (上下) * @desc ランダムマップ作成時の、マップ外周の侵入不可領域の大きさです。ゲーム画面のサイズに応じて、プレイヤーキャラを画面中央に表示するために変更できます。 * @type number * @default 8 * * @param RandomPaddingY * @parent Group_Map * @text ランダムマップの外周幅 (左右) * @desc ランダムマップ作成時の、マップ外周の侵入不可領域の大きさです。ゲーム画面のサイズに応じて、プレイヤーキャラを画面中央に表示するために変更できます。 * @type number * @default 6 * * @param SuspendMenuEnabled * @text [中断] メニューの表示有無 * @desc MRタクティクスマップ上でのメニュー画面で、[中断] を表示するかどうかを指定します。 * @type boolean * @default false * * @param Group_System * @text システム * @default ------------------------------------------------------------ * * @param SyncActorParams * @text ステータスの同期 * @desc エンティティからアクターへステータスを同期します。 * @parent Group_System * @type boolean * @default true * * @param Group_UI * @text インターフェイス * @default ------------------------------------------------------------ * * @param DisableWindowStencil * @text 背面ウィンドウクリッピングの無効化 * @desc ウィンドウが重なるとき、背面ウィンドウが透過表示されるようになります。 * @parent Group_UI * @type boolean * @default false * * @param Group_Experimental * @text 試験的な機能 * @default ------------------------------------------------------------ * * @param UIMode * @text UIモード * @parent Group_Experimental * @type select * @option Default * @value Default * @option Traditional * @value Traditional * @default Traditional * * @param SandboxWorldSystem * @text 箱庭世界システム * @parent Group_Experimental * @type boolean * @default false * * * * * * @command MR-FinishChallenge * @text MR-FinishChallenge * @desc チャレンジを終了し、直前の Land の結果に応じた処理を実行します。 https://lriki.github.io/LN_MysteryRogueSystemSite/reference/plugin-commands/ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * @command RE.ShowChallengeResult * @text ShowChallengeResult * @desc test * * @command MR-ShowWarehouseStoreDialog * @text ShowWarehouseStoreDialog * @desc 預ける * @arg serviceProviderKey * @type string * @arg serviceUserKey * @type string * @command MR-ShowWarehouseWithdrawDialog * @text ShowWarehouseWithdrawDialog * @desc 引き出す * @arg serviceProviderKey * @type string * @arg serviceUserKey * @type string * @command MR-ShowItemSellDialog * @desc 売る * @arg serviceProviderKey * @type string * @arg serviceUserKey * @type string * @arg inventoryOwnerKey * @type string * @command MR-ProceedFloorForward * @text ProceedFloorForward * @desc 次のフロアへ * * @command MR-ProceedFloorBackword * @text ProceedFloorBackword * @desc 前のフロアへ * * @command MR-SetProperty * @text MR-SetProperty * @desc entityKey で指定された Entity へ様々な情報を設定します。 * @arg entityKey * @type string * @arg property * @type string * @arg value * @command MR-GetProperty * @text MR-GetProperty * @desc entityKey で指定された Entity から様々な情報を取得し、変数に代入します。 * @arg entityKey * @type string * @arg property * @type string * @arg variable * * @command MR-ResetStatus * @text MR-ResetStatus * @desc entityKey で指定された Entity のパラメータ及びステートを初期状態に戻します。 * @arg entityKey * @type string * * @command MR-ResetInventory * @text MR-ResetInventory * @desc entityKey で指定された Entity のインベントリを初期状態に戻します。 * @arg entityKey * @type string * * * * @command MR-LivingResult-GetIncludesState * @text MR-LivingResult-GetIncludesState * @desc actorKey で指定された Entity の戦闘不能原因に、stateKey で指定されたステートが含まれているかを確認します。 * MR-CommndResult1: 1=含まれている, 0=含まれていない, -1=Entityが見つからなかった * @arg actorKey * @type string * @arg stateKey * @type string * * * @command MR-SetContext * @text MR-SetContext * @desc イベントコマンドの操作対象となる Entity を変更します。詳細は http://... を参照してください。 * @arg key * @type string * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * @command MR-AddPostTalkCommand * @text [experimental] MR-AddPostTalkCommand * @desc 次の MR-ShowPostTalkDialog で表示するコマンドを追加します。 * @arg name * @type string * @arg label * @type string * * @command MR-ShowPostTalkDialog * @text [experimental] MR-ShowPostTalkDialog * * * @command MR-OpenQuest * @text [experimental] MR-OpenQuest * @desc クエストを開始(受領)できる状態にします。 * @arg questKey * @type string * @command MR-AdvanceQuestTask * @text [experimental] MR-AdvanceQuestTask * @desc クエストを受領または進行させます * @arg questKey * @type string * @arg questTaskKey * @type string * */ /* * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). * This devtool is neither made for production nor for readable output files. * It uses "eval()" calls to create a separate source file in the browser devtools. * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) * or disable the default devtool with "devtool: false". * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). */ /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ "./node_modules/@pixi/accessibility/lib/accessibility.es.js": /*!******************************************************************!*\ !*** ./node_modules/@pixi/accessibility/lib/accessibility.es.js ***! \******************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"AccessibilityManager\": () => (/* binding */ AccessibilityManager),\n/* harmony export */ \"accessibleTarget\": () => (/* binding */ accessibleTarget)\n/* harmony export */ });\n/* harmony import */ var _pixi_display__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @pixi/display */ \"./node_modules/@pixi/display/lib/display.es.js\");\n/* harmony import */ var _pixi_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @pixi/utils */ \"./node_modules/@pixi/utils/lib/utils.es.js\");\n/*!\n * @pixi/accessibility - v5.3.11\n * Compiled Mon, 01 Nov 2021 16:10:12 UTC\n *\n * @pixi/accessibility is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n\n\n\n/**\n * Default property values of accessible objects\n * used by {@link PIXI.AccessibilityManager}.\n *\n * @private\n * @function accessibleTarget\n * @memberof PIXI\n * @type {Object}\n * @example\n * function MyObject() {}\n *\n * Object.assign(\n * MyObject.prototype,\n * PIXI.accessibleTarget\n * );\n */\nvar accessibleTarget = {\n /**\n * Flag for if the object is accessible. If true AccessibilityManager will overlay a\n * shadow div with attributes set\n *\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n */\n accessible: false,\n /**\n * Sets the title attribute of the shadow div\n * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]'\n *\n * @member {?string}\n * @memberof PIXI.DisplayObject#\n */\n accessibleTitle: null,\n /**\n * Sets the aria-label attribute of the shadow div\n *\n * @member {string}\n * @memberof PIXI.DisplayObject#\n */\n accessibleHint: null,\n /**\n * @member {number}\n * @memberof PIXI.DisplayObject#\n * @private\n * @todo Needs docs.\n */\n tabIndex: 0,\n /**\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n * @todo Needs docs.\n */\n _accessibleActive: false,\n /**\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n * @todo Needs docs.\n */\n _accessibleDiv: null,\n /**\n * Specify the type of div the accessible layer is. Screen readers treat the element differently\n * depending on this type. Defaults to button.\n *\n * @member {string}\n * @memberof PIXI.DisplayObject#\n * @default 'button'\n */\n accessibleType: 'button',\n /**\n * Specify the pointer-events the accessible div will use\n * Defaults to auto.\n *\n * @member {string}\n * @memberof PIXI.DisplayObject#\n * @default 'auto'\n */\n accessiblePointerEvents: 'auto',\n /**\n * Setting to false will prevent any children inside this container to\n * be accessible. Defaults to true.\n *\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n * @default true\n */\n accessibleChildren: true,\n renderId: -1,\n};\n\n// add some extra variables to the container..\n_pixi_display__WEBPACK_IMPORTED_MODULE_0__.DisplayObject.mixin(accessibleTarget);\nvar KEY_CODE_TAB = 9;\nvar DIV_TOUCH_SIZE = 100;\nvar DIV_TOUCH_POS_X = 0;\nvar DIV_TOUCH_POS_Y = 0;\nvar DIV_TOUCH_ZINDEX = 2;\nvar DIV_HOOK_SIZE = 1;\nvar DIV_HOOK_POS_X = -1000;\nvar DIV_HOOK_POS_Y = -1000;\nvar DIV_HOOK_ZINDEX = 2;\n/**\n * The Accessibility manager recreates the ability to tab and have content read by screen readers.\n * This is very important as it can possibly help people with disabilities access PixiJS content.\n *\n * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the\n * events as if the mouse was being used, minimizing the effort required to implement.\n *\n * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility`\n *\n * @class\n * @memberof PIXI\n */\nvar AccessibilityManager = /** @class */ (function () {\n /**\n * @param {PIXI.CanvasRenderer|PIXI.Renderer} renderer - A reference to the current renderer\n */\n function AccessibilityManager(renderer) {\n /**\n * @type {?HTMLElement}\n * @private\n */\n this._hookDiv = null;\n if (_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.isMobile.tablet || _pixi_utils__WEBPACK_IMPORTED_MODULE_1__.isMobile.phone) {\n this.createTouchHook();\n }\n // first we create a div that will sit over the PixiJS element. This is where the div overlays will go.\n var div = document.createElement('div');\n div.style.width = DIV_TOUCH_SIZE + \"px\";\n div.style.height = DIV_TOUCH_SIZE + \"px\";\n div.style.position = 'absolute';\n div.style.top = DIV_TOUCH_POS_X + \"px\";\n div.style.left = DIV_TOUCH_POS_Y + \"px\";\n div.style.zIndex = DIV_TOUCH_ZINDEX.toString();\n /**\n * This is the dom element that will sit over the PixiJS element. This is where the div overlays will go.\n *\n * @type {HTMLElement}\n * @private\n */\n this.div = div;\n /**\n * A simple pool for storing divs.\n *\n * @type {*}\n * @private\n */\n this.pool = [];\n /**\n * This is a tick used to check if an object is no longer being rendered.\n *\n * @type {Number}\n * @private\n */\n this.renderId = 0;\n /**\n * Setting this to true will visually show the divs.\n *\n * @type {boolean}\n */\n this.debug = false;\n /**\n * The renderer this accessibility manager works for.\n *\n * @member {PIXI.AbstractRenderer}\n */\n this.renderer = renderer;\n /**\n * The array of currently active accessible items.\n *\n * @member {Array<*>}\n * @private\n */\n this.children = [];\n /**\n * pre-bind the functions\n *\n * @type {Function}\n * @private\n */\n this._onKeyDown = this._onKeyDown.bind(this);\n /**\n * pre-bind the functions\n *\n * @type {Function}\n * @private\n */\n this._onMouseMove = this._onMouseMove.bind(this);\n this._isActive = false;\n this._isMobileAccessibility = false;\n /**\n * count to throttle div updates on android devices\n * @type number\n * @private\n */\n this.androidUpdateCount = 0;\n /**\n * the frequency to update the div elements ()\n * @private\n */\n this.androidUpdateFrequency = 500; // 2fps\n // let listen for tab.. once pressed we can fire up and show the accessibility layer\n window.addEventListener('keydown', this._onKeyDown, false);\n }\n Object.defineProperty(AccessibilityManager.prototype, \"isActive\", {\n /**\n * A flag\n * @member {boolean}\n * @readonly\n */\n get: function () {\n return this._isActive;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(AccessibilityManager.prototype, \"isMobileAccessibility\", {\n /**\n * A flag\n * @member {boolean}\n * @readonly\n */\n get: function () {\n return this._isMobileAccessibility;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Creates the touch hooks.\n *\n * @private\n */\n AccessibilityManager.prototype.createTouchHook = function () {\n var _this = this;\n var hookDiv = document.createElement('button');\n hookDiv.style.width = DIV_HOOK_SIZE + \"px\";\n hookDiv.style.height = DIV_HOOK_SIZE + \"px\";\n hookDiv.style.position = 'absolute';\n hookDiv.style.top = DIV_HOOK_POS_X + \"px\";\n hookDiv.style.left = DIV_HOOK_POS_Y + \"px\";\n hookDiv.style.zIndex = DIV_HOOK_ZINDEX.toString();\n hookDiv.style.backgroundColor = '#FF0000';\n hookDiv.title = 'select to enable accessability for this content';\n hookDiv.addEventListener('focus', function () {\n _this._isMobileAccessibility = true;\n _this.activate();\n _this.destroyTouchHook();\n });\n document.body.appendChild(hookDiv);\n this._hookDiv = hookDiv;\n };\n /**\n * Destroys the touch hooks.\n *\n * @private\n */\n AccessibilityManager.prototype.destroyTouchHook = function () {\n if (!this._hookDiv) {\n return;\n }\n document.body.removeChild(this._hookDiv);\n this._hookDiv = null;\n };\n /**\n * Activating will cause the Accessibility layer to be shown.\n * This is called when a user presses the tab key.\n *\n * @private\n */\n AccessibilityManager.prototype.activate = function () {\n if (this._isActive) {\n return;\n }\n this._isActive = true;\n window.document.addEventListener('mousemove', this._onMouseMove, true);\n window.removeEventListener('keydown', this._onKeyDown, false);\n // TODO: Remove casting when CanvasRenderer is converted\n this.renderer.on('postrender', this.update, this);\n if (this.renderer.view.parentNode) {\n this.renderer.view.parentNode.appendChild(this.div);\n }\n };\n /**\n * Deactivating will cause the Accessibility layer to be hidden.\n * This is called when a user moves the mouse.\n *\n * @private\n */\n AccessibilityManager.prototype.deactivate = function () {\n if (!this._isActive || this._isMobileAccessibility) {\n return;\n }\n this._isActive = false;\n window.document.removeEventListener('mousemove', this._onMouseMove, true);\n window.addEventListener('keydown', this._onKeyDown, false);\n // TODO: Remove casting when CanvasRenderer is converted\n this.renderer.off('postrender', this.update);\n if (this.div.parentNode) {\n this.div.parentNode.removeChild(this.div);\n }\n };\n /**\n * This recursive function will run through the scene graph and add any new accessible objects to the DOM layer.\n *\n * @private\n * @param {PIXI.Container} displayObject - The DisplayObject to check.\n */\n AccessibilityManager.prototype.updateAccessibleObjects = function (displayObject) {\n if (!displayObject.visible || !displayObject.accessibleChildren) {\n return;\n }\n if (displayObject.accessible && displayObject.interactive) {\n if (!displayObject._accessibleActive) {\n this.addChild(displayObject);\n }\n displayObject.renderId = this.renderId;\n }\n var children = displayObject.children;\n for (var i = 0; i < children.length; i++) {\n this.updateAccessibleObjects(children[i]);\n }\n };\n /**\n * Before each render this function will ensure that all divs are mapped correctly to their DisplayObjects.\n *\n * @private\n */\n AccessibilityManager.prototype.update = function () {\n /* On Android default web browser, tab order seems to be calculated by position rather than tabIndex,\n * moving buttons can cause focus to flicker between two buttons making it hard/impossible to navigate,\n * so I am just running update every half a second, seems to fix it.\n */\n var now = performance.now();\n if (_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.isMobile.android.device && now < this.androidUpdateCount) {\n return;\n }\n this.androidUpdateCount = now + this.androidUpdateFrequency;\n if (!this.renderer.renderingToScreen) {\n return;\n }\n // update children...\n if (this.renderer._lastObjectRendered) {\n this.updateAccessibleObjects(this.renderer._lastObjectRendered);\n }\n // TODO: Remove casting when CanvasRenderer is converted\n var rect = this.renderer.view.getBoundingClientRect();\n var resolution = this.renderer.resolution;\n var sx = (rect.width / this.renderer.width) * resolution;\n var sy = (rect.height / this.renderer.height) * resolution;\n var div = this.div;\n div.style.left = rect.left + \"px\";\n div.style.top = rect.top + \"px\";\n div.style.width = this.renderer.width + \"px\";\n div.style.height = this.renderer.height + \"px\";\n for (var i = 0; i < this.children.length; i++) {\n var child = this.children[i];\n if (child.renderId !== this.renderId) {\n child._accessibleActive = false;\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.removeItems)(this.children, i, 1);\n this.div.removeChild(child._accessibleDiv);\n this.pool.push(child._accessibleDiv);\n child._accessibleDiv = null;\n i--;\n }\n else {\n // map div to display..\n div = child._accessibleDiv;\n var hitArea = child.hitArea;\n var wt = child.worldTransform;\n if (child.hitArea) {\n div.style.left = (wt.tx + (hitArea.x * wt.a)) * sx + \"px\";\n div.style.top = (wt.ty + (hitArea.y * wt.d)) * sy + \"px\";\n div.style.width = hitArea.width * wt.a * sx + \"px\";\n div.style.height = hitArea.height * wt.d * sy + \"px\";\n }\n else {\n hitArea = child.getBounds();\n this.capHitArea(hitArea);\n div.style.left = hitArea.x * sx + \"px\";\n div.style.top = hitArea.y * sy + \"px\";\n div.style.width = hitArea.width * sx + \"px\";\n div.style.height = hitArea.height * sy + \"px\";\n // update button titles and hints if they exist and they've changed\n if (div.title !== child.accessibleTitle && child.accessibleTitle !== null) {\n div.title = child.accessibleTitle;\n }\n if (div.getAttribute('aria-label') !== child.accessibleHint\n && child.accessibleHint !== null) {\n div.setAttribute('aria-label', child.accessibleHint);\n }\n }\n // the title or index may have changed, if so lets update it!\n if (child.accessibleTitle !== div.title || child.tabIndex !== div.tabIndex) {\n div.title = child.accessibleTitle;\n div.tabIndex = child.tabIndex;\n if (this.debug)\n { this.updateDebugHTML(div); }\n }\n }\n }\n // increment the render id..\n this.renderId++;\n };\n /**\n * private function that will visually add the information to the\n * accessability div\n *\n * @param {HTMLElement} div\n */\n AccessibilityManager.prototype.updateDebugHTML = function (div) {\n div.innerHTML = \"type: \" + div.type + \"
title : \" + div.title + \"
tabIndex: \" + div.tabIndex;\n };\n /**\n * Adjust the hit area based on the bounds of a display object\n *\n * @param {PIXI.Rectangle} hitArea - Bounds of the child\n */\n AccessibilityManager.prototype.capHitArea = function (hitArea) {\n if (hitArea.x < 0) {\n hitArea.width += hitArea.x;\n hitArea.x = 0;\n }\n if (hitArea.y < 0) {\n hitArea.height += hitArea.y;\n hitArea.y = 0;\n }\n // TODO: Remove casting when CanvasRenderer is converted\n if (hitArea.x + hitArea.width > this.renderer.width) {\n hitArea.width = this.renderer.width - hitArea.x;\n }\n if (hitArea.y + hitArea.height > this.renderer.height) {\n hitArea.height = this.renderer.height - hitArea.y;\n }\n };\n /**\n * Adds a DisplayObject to the accessibility manager\n *\n * @private\n * @param {PIXI.DisplayObject} displayObject - The child to make accessible.\n */\n AccessibilityManager.prototype.addChild = function (displayObject) {\n // this.activate();\n var div = this.pool.pop();\n if (!div) {\n div = document.createElement('button');\n div.style.width = DIV_TOUCH_SIZE + \"px\";\n div.style.height = DIV_TOUCH_SIZE + \"px\";\n div.style.backgroundColor = this.debug ? 'rgba(255,255,255,0.5)' : 'transparent';\n div.style.position = 'absolute';\n div.style.zIndex = DIV_TOUCH_ZINDEX.toString();\n div.style.borderStyle = 'none';\n // ARIA attributes ensure that button title and hint updates are announced properly\n if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) {\n // Chrome doesn't need aria-live to work as intended; in fact it just gets more confused.\n div.setAttribute('aria-live', 'off');\n }\n else {\n div.setAttribute('aria-live', 'polite');\n }\n if (navigator.userAgent.match(/rv:.*Gecko\\//)) {\n // FireFox needs this to announce only the new button name\n div.setAttribute('aria-relevant', 'additions');\n }\n else {\n // required by IE, other browsers don't much care\n div.setAttribute('aria-relevant', 'text');\n }\n div.addEventListener('click', this._onClick.bind(this));\n div.addEventListener('focus', this._onFocus.bind(this));\n div.addEventListener('focusout', this._onFocusOut.bind(this));\n }\n // set pointer events\n div.style.pointerEvents = displayObject.accessiblePointerEvents;\n // set the type, this defaults to button!\n div.type = displayObject.accessibleType;\n if (displayObject.accessibleTitle && displayObject.accessibleTitle !== null) {\n div.title = displayObject.accessibleTitle;\n }\n else if (!displayObject.accessibleHint\n || displayObject.accessibleHint === null) {\n div.title = \"displayObject \" + displayObject.tabIndex;\n }\n if (displayObject.accessibleHint\n && displayObject.accessibleHint !== null) {\n div.setAttribute('aria-label', displayObject.accessibleHint);\n }\n if (this.debug)\n { this.updateDebugHTML(div); }\n displayObject._accessibleActive = true;\n displayObject._accessibleDiv = div;\n div.displayObject = displayObject;\n this.children.push(displayObject);\n this.div.appendChild(displayObject._accessibleDiv);\n displayObject._accessibleDiv.tabIndex = displayObject.tabIndex;\n };\n /**\n * Maps the div button press to pixi's InteractionManager (click)\n *\n * @private\n * @param {MouseEvent} e - The click event.\n */\n AccessibilityManager.prototype._onClick = function (e) {\n // TODO: Remove casting when CanvasRenderer is converted\n var interactionManager = this.renderer.plugins.interaction;\n interactionManager.dispatchEvent(e.target.displayObject, 'click', interactionManager.eventData);\n interactionManager.dispatchEvent(e.target.displayObject, 'pointertap', interactionManager.eventData);\n interactionManager.dispatchEvent(e.target.displayObject, 'tap', interactionManager.eventData);\n };\n /**\n * Maps the div focus events to pixi's InteractionManager (mouseover)\n *\n * @private\n * @param {FocusEvent} e - The focus event.\n */\n AccessibilityManager.prototype._onFocus = function (e) {\n if (!e.target.getAttribute('aria-live')) {\n e.target.setAttribute('aria-live', 'assertive');\n }\n // TODO: Remove casting when CanvasRenderer is converted\n var interactionManager = this.renderer.plugins.interaction;\n interactionManager.dispatchEvent(e.target.displayObject, 'mouseover', interactionManager.eventData);\n };\n /**\n * Maps the div focus events to pixi's InteractionManager (mouseout)\n *\n * @private\n * @param {FocusEvent} e - The focusout event.\n */\n AccessibilityManager.prototype._onFocusOut = function (e) {\n if (!e.target.getAttribute('aria-live')) {\n e.target.setAttribute('aria-live', 'polite');\n }\n // TODO: Remove casting when CanvasRenderer is converted\n var interactionManager = this.renderer.plugins.interaction;\n interactionManager.dispatchEvent(e.target.displayObject, 'mouseout', interactionManager.eventData);\n };\n /**\n * Is called when a key is pressed\n *\n * @private\n * @param {KeyboardEvent} e - The keydown event.\n */\n AccessibilityManager.prototype._onKeyDown = function (e) {\n if (e.keyCode !== KEY_CODE_TAB) {\n return;\n }\n this.activate();\n };\n /**\n * Is called when the mouse moves across the renderer element\n *\n * @private\n * @param {MouseEvent} e - The mouse event.\n */\n AccessibilityManager.prototype._onMouseMove = function (e) {\n if (e.movementX === 0 && e.movementY === 0) {\n return;\n }\n this.deactivate();\n };\n /**\n * Destroys the accessibility manager\n *\n */\n AccessibilityManager.prototype.destroy = function () {\n this.destroyTouchHook();\n this.div = null;\n window.document.removeEventListener('mousemove', this._onMouseMove, true);\n window.removeEventListener('keydown', this._onKeyDown);\n this.pool = null;\n this.children = null;\n this.renderer = null;\n };\n return AccessibilityManager;\n}());\n\n\n//# sourceMappingURL=accessibility.es.js.map\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/@pixi/accessibility/lib/accessibility.es.js?"); /***/ }), /***/ "./node_modules/@pixi/app/lib/app.es.js": /*!**********************************************!*\ !*** ./node_modules/@pixi/app/lib/app.es.js ***! \**********************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Application\": () => (/* binding */ Application)\n/* harmony export */ });\n/* harmony import */ var _pixi_display__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @pixi/display */ \"./node_modules/@pixi/display/lib/display.es.js\");\n/* harmony import */ var _pixi_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @pixi/core */ \"./node_modules/@pixi/core/lib/core.es.js\");\n/*!\n * @pixi/app - v5.3.11\n * Compiled Mon, 01 Nov 2021 16:10:12 UTC\n *\n * @pixi/app is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n\n\n\n/**\n * Convenience class to create a new PIXI application.\n *\n * This class automatically creates the renderer, ticker and root container.\n *\n * @example\n * // Create the application\n * const app = new PIXI.Application();\n *\n * // Add the view to the DOM\n * document.body.appendChild(app.view);\n *\n * // ex, add display objects\n * app.stage.addChild(PIXI.Sprite.from('something.png'));\n *\n * @class\n * @memberof PIXI\n */\nvar Application = /** @class */ (function () {\n /**\n * @param {object} [options] - The optional renderer parameters.\n * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction.\n * **Note**: Setting this parameter to false does NOT stop the shared ticker even if you set\n * options.sharedTicker to true in case that it is already started. Stop it by your own.\n * @param {number} [options.width=800] - The width of the renderers view.\n * @param {number} [options.height=600] - The height of the renderers view.\n * @param {HTMLCanvasElement} [options.view] - The canvas to use as a view, optional.\n * @param {boolean} [options.transparent=false] - If the render view is transparent.\n * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for\n * resolutions other than 1.\n * @param {boolean} [options.antialias=false] - Sets antialias\n * @param {boolean} [options.preserveDrawingBuffer=false] - Enables drawing buffer preservation, enable this if you\n * need to call toDataUrl on the WebGL context.\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer, retina would be 2.\n * @param {boolean} [options.forceCanvas=false] - prevents selection of WebGL renderer, even if such is present, this\n * option only is available when using **pixi.js-legacy** or **@pixi/canvas-renderer** modules, otherwise\n * it is ignored.\n * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area\n * (shown if not transparent).\n * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or\n * not before the new render pass.\n * @param {string} [options.powerPreference] - Parameter passed to webgl context, set to \"high-performance\"\n * for devices with dual graphics card. **(WebGL only)**.\n * @param {boolean} [options.sharedTicker=false] - `true` to use PIXI.Ticker.shared, `false` to create new ticker.\n * If set to false, you cannot register a handler to occur before anything that runs on the shared ticker.\n * The system ticker will always run before both the shared ticker and the app ticker.\n * @param {boolean} [options.sharedLoader=false] - `true` to use PIXI.Loader.shared, `false` to create new Loader.\n * @param {Window|HTMLElement} [options.resizeTo] - Element to automatically resize stage to.\n */\n function Application(options) {\n var _this = this;\n // The default options\n options = Object.assign({\n forceCanvas: false,\n }, options);\n /**\n * WebGL renderer if available, otherwise CanvasRenderer.\n * @member {PIXI.Renderer|PIXI.CanvasRenderer}\n */\n this.renderer = (0,_pixi_core__WEBPACK_IMPORTED_MODULE_1__.autoDetectRenderer)(options);\n /**\n * The root display container that's rendered.\n * @member {PIXI.Container}\n */\n this.stage = new _pixi_display__WEBPACK_IMPORTED_MODULE_0__.Container();\n // install plugins here\n Application._plugins.forEach(function (plugin) {\n plugin.init.call(_this, options);\n });\n }\n /**\n * Register a middleware plugin for the application\n * @static\n * @param {PIXI.Application.Plugin} plugin - Plugin being installed\n */\n Application.registerPlugin = function (plugin) {\n Application._plugins.push(plugin);\n };\n /**\n * Render the current stage.\n */\n Application.prototype.render = function () {\n // TODO: Since CanvasRenderer has not been converted this function thinks it takes DisplayObject & PIXI.DisplayObject\n // This can be fixed when CanvasRenderer is converted.\n this.renderer.render(this.stage);\n };\n Object.defineProperty(Application.prototype, \"view\", {\n /**\n * Reference to the renderer's canvas element.\n * @member {HTMLCanvasElement}\n * @readonly\n */\n get: function () {\n return this.renderer.view;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Application.prototype, \"screen\", {\n /**\n * Reference to the renderer's screen rectangle. Its safe to use as `filterArea` or `hitArea` for the whole screen.\n * @member {PIXI.Rectangle}\n * @readonly\n */\n get: function () {\n return this.renderer.screen;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Destroy and don't use after this.\n * @param {Boolean} [removeView=false] - Automatically remove canvas from DOM.\n * @param {object|boolean} [stageOptions] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [stageOptions.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'stageOptions' will be passed on to those calls.\n * @param {boolean} [stageOptions.texture=false] - Only used for child Sprites if stageOptions.children is set\n * to true. Should it destroy the texture of the child sprite\n * @param {boolean} [stageOptions.baseTexture=false] - Only used for child Sprites if stageOptions.children is set\n * to true. Should it destroy the base texture of the child sprite\n */\n Application.prototype.destroy = function (removeView, stageOptions) {\n var _this = this;\n // Destroy plugins in the opposite order\n // which they were constructed\n var plugins = Application._plugins.slice(0);\n plugins.reverse();\n plugins.forEach(function (plugin) {\n plugin.destroy.call(_this);\n });\n this.stage.destroy(stageOptions);\n this.stage = null;\n this.renderer.destroy(removeView);\n this.renderer = null;\n };\n return Application;\n}());\n/**\n * @memberof PIXI.Application\n * @typedef {object} Plugin\n * @property {function} init - Called when Application is constructed, scoped to Application instance.\n * Passes in `options` as the only argument, which are Application constructor options.\n * @property {function} destroy - Called when destroying Application, scoped to Application instance\n */\n/**\n * Collection of installed plugins.\n * @static\n * @private\n * @type {PIXI.Application.Plugin[]}\n */\nApplication._plugins = [];\n\n/**\n * Middleware for for Application's resize functionality\n * @private\n * @class\n */\nvar ResizePlugin = /** @class */ (function () {\n function ResizePlugin() {\n }\n /**\n * Initialize the plugin with scope of application instance\n * @static\n * @private\n * @param {object} [options] - See application options\n */\n ResizePlugin.init = function (options) {\n var _this = this;\n /**\n * The HTML element or window to automatically resize the\n * renderer's view element to match width and height.\n * @type {Window|HTMLElement}\n * @name resizeTo\n * @memberof PIXI.Application#\n */\n Object.defineProperty(this, 'resizeTo', {\n set: function (dom) {\n window.removeEventListener('resize', this.queueResize);\n this._resizeTo = dom;\n if (dom) {\n window.addEventListener('resize', this.queueResize);\n this.resize();\n }\n },\n get: function () {\n return this._resizeTo;\n },\n });\n /**\n * Resize is throttled, so it's\n * safe to call this multiple times per frame and it'll\n * only be called once.\n * @method PIXI.Application#queueResize\n */\n this.queueResize = function () {\n if (!_this._resizeTo) {\n return;\n }\n _this.cancelResize();\n // // Throttle resize events per raf\n _this._resizeId = requestAnimationFrame(function () { return _this.resize(); });\n };\n /**\n * Cancel the resize queue.\n * @method PIXI.Application#cancelResize\n * @private\n */\n this.cancelResize = function () {\n if (_this._resizeId) {\n cancelAnimationFrame(_this._resizeId);\n _this._resizeId = null;\n }\n };\n /**\n * Execute an immediate resize on the renderer, this is not\n * throttled and can be expensive to call many times in a row.\n * Will resize only if `resizeTo` property is set.\n * @method PIXI.Application#resize\n */\n this.resize = function () {\n if (!_this._resizeTo) {\n return;\n }\n // clear queue resize\n _this.cancelResize();\n var width;\n var height;\n // Resize to the window\n if (_this._resizeTo === window) {\n width = window.innerWidth;\n height = window.innerHeight;\n }\n // Resize to other HTML entities\n else {\n var _a = _this._resizeTo, clientWidth = _a.clientWidth, clientHeight = _a.clientHeight;\n width = clientWidth;\n height = clientHeight;\n }\n _this.renderer.resize(width, height);\n };\n // On resize\n this._resizeId = null;\n this._resizeTo = null;\n this.resizeTo = options.resizeTo || null;\n };\n /**\n * Clean up the ticker, scoped to application\n * @static\n * @private\n */\n ResizePlugin.destroy = function () {\n window.removeEventListener('resize', this.queueResize);\n this.cancelResize();\n this.cancelResize = null;\n this.queueResize = null;\n this.resizeTo = null;\n this.resize = null;\n };\n return ResizePlugin;\n}());\n\nApplication.registerPlugin(ResizePlugin);\n\n\n//# sourceMappingURL=app.es.js.map\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/@pixi/app/lib/app.es.js?"); /***/ }), /***/ "./node_modules/@pixi/constants/lib/constants.es.js": /*!**********************************************************!*\ !*** ./node_modules/@pixi/constants/lib/constants.es.js ***! \**********************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ALPHA_MODES\": () => (/* binding */ ALPHA_MODES),\n/* harmony export */ \"BLEND_MODES\": () => (/* binding */ BLEND_MODES),\n/* harmony export */ \"BUFFER_BITS\": () => (/* binding */ BUFFER_BITS),\n/* harmony export */ \"CLEAR_MODES\": () => (/* binding */ CLEAR_MODES),\n/* harmony export */ \"DRAW_MODES\": () => (/* binding */ DRAW_MODES),\n/* harmony export */ \"ENV\": () => (/* binding */ ENV),\n/* harmony export */ \"FORMATS\": () => (/* binding */ FORMATS),\n/* harmony export */ \"GC_MODES\": () => (/* binding */ GC_MODES),\n/* harmony export */ \"MASK_TYPES\": () => (/* binding */ MASK_TYPES),\n/* harmony export */ \"MIPMAP_MODES\": () => (/* binding */ MIPMAP_MODES),\n/* harmony export */ \"MSAA_QUALITY\": () => (/* binding */ MSAA_QUALITY),\n/* harmony export */ \"PRECISION\": () => (/* binding */ PRECISION),\n/* harmony export */ \"RENDERER_TYPE\": () => (/* binding */ RENDERER_TYPE),\n/* harmony export */ \"SCALE_MODES\": () => (/* binding */ SCALE_MODES),\n/* harmony export */ \"TARGETS\": () => (/* binding */ TARGETS),\n/* harmony export */ \"TYPES\": () => (/* binding */ TYPES),\n/* harmony export */ \"WRAP_MODES\": () => (/* binding */ WRAP_MODES)\n/* harmony export */ });\n/*!\n * @pixi/constants - v5.3.11\n * Compiled Mon, 01 Nov 2021 16:10:12 UTC\n *\n * @pixi/constants is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n/**\n * Different types of environments for WebGL.\n *\n * @static\n * @memberof PIXI\n * @name ENV\n * @enum {number}\n * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility\n * with older / less advanced devices. If you experience unexplained flickering prefer this environment.\n * @property {number} WEBGL - Version 1 of WebGL\n * @property {number} WEBGL2 - Version 2 of WebGL\n */\nvar ENV;\n(function (ENV) {\n ENV[ENV[\"WEBGL_LEGACY\"] = 0] = \"WEBGL_LEGACY\";\n ENV[ENV[\"WEBGL\"] = 1] = \"WEBGL\";\n ENV[ENV[\"WEBGL2\"] = 2] = \"WEBGL2\";\n})(ENV || (ENV = {}));\n/**\n * Constant to identify the Renderer Type.\n *\n * @static\n * @memberof PIXI\n * @name RENDERER_TYPE\n * @enum {number}\n * @property {number} UNKNOWN - Unknown render type.\n * @property {number} WEBGL - WebGL render type.\n * @property {number} CANVAS - Canvas render type.\n */\nvar RENDERER_TYPE;\n(function (RENDERER_TYPE) {\n RENDERER_TYPE[RENDERER_TYPE[\"UNKNOWN\"] = 0] = \"UNKNOWN\";\n RENDERER_TYPE[RENDERER_TYPE[\"WEBGL\"] = 1] = \"WEBGL\";\n RENDERER_TYPE[RENDERER_TYPE[\"CANVAS\"] = 2] = \"CANVAS\";\n})(RENDERER_TYPE || (RENDERER_TYPE = {}));\n/**\n * Bitwise OR of masks that indicate the buffers to be cleared.\n *\n * @static\n * @memberof PIXI\n * @name BUFFER_BITS\n * @enum {number}\n * @property {number} COLOR - Indicates the buffers currently enabled for color writing.\n * @property {number} DEPTH - Indicates the depth buffer.\n * @property {number} STENCIL - Indicates the stencil buffer.\n */\nvar BUFFER_BITS;\n(function (BUFFER_BITS) {\n BUFFER_BITS[BUFFER_BITS[\"COLOR\"] = 16384] = \"COLOR\";\n BUFFER_BITS[BUFFER_BITS[\"DEPTH\"] = 256] = \"DEPTH\";\n BUFFER_BITS[BUFFER_BITS[\"STENCIL\"] = 1024] = \"STENCIL\";\n})(BUFFER_BITS || (BUFFER_BITS = {}));\n/**\n * Various blend modes supported by PIXI.\n *\n * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes.\n * Anything else will silently act like NORMAL.\n *\n * @memberof PIXI\n * @name BLEND_MODES\n * @enum {number}\n * @property {number} NORMAL\n * @property {number} ADD\n * @property {number} MULTIPLY\n * @property {number} SCREEN\n * @property {number} OVERLAY\n * @property {number} DARKEN\n * @property {number} LIGHTEN\n * @property {number} COLOR_DODGE\n * @property {number} COLOR_BURN\n * @property {number} HARD_LIGHT\n * @property {number} SOFT_LIGHT\n * @property {number} DIFFERENCE\n * @property {number} EXCLUSION\n * @property {number} HUE\n * @property {number} SATURATION\n * @property {number} COLOR\n * @property {number} LUMINOSITY\n * @property {number} NORMAL_NPM\n * @property {number} ADD_NPM\n * @property {number} SCREEN_NPM\n * @property {number} NONE\n * @property {number} SRC_IN\n * @property {number} SRC_OUT\n * @property {number} SRC_ATOP\n * @property {number} DST_OVER\n * @property {number} DST_IN\n * @property {number} DST_OUT\n * @property {number} DST_ATOP\n * @property {number} SUBTRACT\n * @property {number} SRC_OVER\n * @property {number} ERASE\n * @property {number} XOR\n */\nvar BLEND_MODES;\n(function (BLEND_MODES) {\n BLEND_MODES[BLEND_MODES[\"NORMAL\"] = 0] = \"NORMAL\";\n BLEND_MODES[BLEND_MODES[\"ADD\"] = 1] = \"ADD\";\n BLEND_MODES[BLEND_MODES[\"MULTIPLY\"] = 2] = \"MULTIPLY\";\n BLEND_MODES[BLEND_MODES[\"SCREEN\"] = 3] = \"SCREEN\";\n BLEND_MODES[BLEND_MODES[\"OVERLAY\"] = 4] = \"OVERLAY\";\n BLEND_MODES[BLEND_MODES[\"DARKEN\"] = 5] = \"DARKEN\";\n BLEND_MODES[BLEND_MODES[\"LIGHTEN\"] = 6] = \"LIGHTEN\";\n BLEND_MODES[BLEND_MODES[\"COLOR_DODGE\"] = 7] = \"COLOR_DODGE\";\n BLEND_MODES[BLEND_MODES[\"COLOR_BURN\"] = 8] = \"COLOR_BURN\";\n BLEND_MODES[BLEND_MODES[\"HARD_LIGHT\"] = 9] = \"HARD_LIGHT\";\n BLEND_MODES[BLEND_MODES[\"SOFT_LIGHT\"] = 10] = \"SOFT_LIGHT\";\n BLEND_MODES[BLEND_MODES[\"DIFFERENCE\"] = 11] = \"DIFFERENCE\";\n BLEND_MODES[BLEND_MODES[\"EXCLUSION\"] = 12] = \"EXCLUSION\";\n BLEND_MODES[BLEND_MODES[\"HUE\"] = 13] = \"HUE\";\n BLEND_MODES[BLEND_MODES[\"SATURATION\"] = 14] = \"SATURATION\";\n BLEND_MODES[BLEND_MODES[\"COLOR\"] = 15] = \"COLOR\";\n BLEND_MODES[BLEND_MODES[\"LUMINOSITY\"] = 16] = \"LUMINOSITY\";\n BLEND_MODES[BLEND_MODES[\"NORMAL_NPM\"] = 17] = \"NORMAL_NPM\";\n BLEND_MODES[BLEND_MODES[\"ADD_NPM\"] = 18] = \"ADD_NPM\";\n BLEND_MODES[BLEND_MODES[\"SCREEN_NPM\"] = 19] = \"SCREEN_NPM\";\n BLEND_MODES[BLEND_MODES[\"NONE\"] = 20] = \"NONE\";\n BLEND_MODES[BLEND_MODES[\"SRC_OVER\"] = 0] = \"SRC_OVER\";\n BLEND_MODES[BLEND_MODES[\"SRC_IN\"] = 21] = \"SRC_IN\";\n BLEND_MODES[BLEND_MODES[\"SRC_OUT\"] = 22] = \"SRC_OUT\";\n BLEND_MODES[BLEND_MODES[\"SRC_ATOP\"] = 23] = \"SRC_ATOP\";\n BLEND_MODES[BLEND_MODES[\"DST_OVER\"] = 24] = \"DST_OVER\";\n BLEND_MODES[BLEND_MODES[\"DST_IN\"] = 25] = \"DST_IN\";\n BLEND_MODES[BLEND_MODES[\"DST_OUT\"] = 26] = \"DST_OUT\";\n BLEND_MODES[BLEND_MODES[\"DST_ATOP\"] = 27] = \"DST_ATOP\";\n BLEND_MODES[BLEND_MODES[\"ERASE\"] = 26] = \"ERASE\";\n BLEND_MODES[BLEND_MODES[\"SUBTRACT\"] = 28] = \"SUBTRACT\";\n BLEND_MODES[BLEND_MODES[\"XOR\"] = 29] = \"XOR\";\n})(BLEND_MODES || (BLEND_MODES = {}));\n/**\n * Various webgl draw modes. These can be used to specify which GL drawMode to use\n * under certain situations and renderers.\n *\n * @memberof PIXI\n * @static\n * @name DRAW_MODES\n * @enum {number}\n * @property {number} POINTS\n * @property {number} LINES\n * @property {number} LINE_LOOP\n * @property {number} LINE_STRIP\n * @property {number} TRIANGLES\n * @property {number} TRIANGLE_STRIP\n * @property {number} TRIANGLE_FAN\n */\nvar DRAW_MODES;\n(function (DRAW_MODES) {\n DRAW_MODES[DRAW_MODES[\"POINTS\"] = 0] = \"POINTS\";\n DRAW_MODES[DRAW_MODES[\"LINES\"] = 1] = \"LINES\";\n DRAW_MODES[DRAW_MODES[\"LINE_LOOP\"] = 2] = \"LINE_LOOP\";\n DRAW_MODES[DRAW_MODES[\"LINE_STRIP\"] = 3] = \"LINE_STRIP\";\n DRAW_MODES[DRAW_MODES[\"TRIANGLES\"] = 4] = \"TRIANGLES\";\n DRAW_MODES[DRAW_MODES[\"TRIANGLE_STRIP\"] = 5] = \"TRIANGLE_STRIP\";\n DRAW_MODES[DRAW_MODES[\"TRIANGLE_FAN\"] = 6] = \"TRIANGLE_FAN\";\n})(DRAW_MODES || (DRAW_MODES = {}));\n/**\n * Various GL texture/resources formats.\n *\n * @memberof PIXI\n * @static\n * @name FORMATS\n * @enum {number}\n * @property {number} RGBA=6408\n * @property {number} RGB=6407\n * @property {number} ALPHA=6406\n * @property {number} LUMINANCE=6409\n * @property {number} LUMINANCE_ALPHA=6410\n * @property {number} DEPTH_COMPONENT=6402\n * @property {number} DEPTH_STENCIL=34041\n */\nvar FORMATS;\n(function (FORMATS) {\n FORMATS[FORMATS[\"RGBA\"] = 6408] = \"RGBA\";\n FORMATS[FORMATS[\"RGB\"] = 6407] = \"RGB\";\n FORMATS[FORMATS[\"ALPHA\"] = 6406] = \"ALPHA\";\n FORMATS[FORMATS[\"LUMINANCE\"] = 6409] = \"LUMINANCE\";\n FORMATS[FORMATS[\"LUMINANCE_ALPHA\"] = 6410] = \"LUMINANCE_ALPHA\";\n FORMATS[FORMATS[\"DEPTH_COMPONENT\"] = 6402] = \"DEPTH_COMPONENT\";\n FORMATS[FORMATS[\"DEPTH_STENCIL\"] = 34041] = \"DEPTH_STENCIL\";\n})(FORMATS || (FORMATS = {}));\n/**\n * Various GL target types.\n *\n * @memberof PIXI\n * @static\n * @name TARGETS\n * @enum {number}\n * @property {number} TEXTURE_2D=3553\n * @property {number} TEXTURE_CUBE_MAP=34067\n * @property {number} TEXTURE_2D_ARRAY=35866\n * @property {number} TEXTURE_CUBE_MAP_POSITIVE_X=34069\n * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_X=34070\n * @property {number} TEXTURE_CUBE_MAP_POSITIVE_Y=34071\n * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_Y=34072\n * @property {number} TEXTURE_CUBE_MAP_POSITIVE_Z=34073\n * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_Z=34074\n */\nvar TARGETS;\n(function (TARGETS) {\n TARGETS[TARGETS[\"TEXTURE_2D\"] = 3553] = \"TEXTURE_2D\";\n TARGETS[TARGETS[\"TEXTURE_CUBE_MAP\"] = 34067] = \"TEXTURE_CUBE_MAP\";\n TARGETS[TARGETS[\"TEXTURE_2D_ARRAY\"] = 35866] = \"TEXTURE_2D_ARRAY\";\n TARGETS[TARGETS[\"TEXTURE_CUBE_MAP_POSITIVE_X\"] = 34069] = \"TEXTURE_CUBE_MAP_POSITIVE_X\";\n TARGETS[TARGETS[\"TEXTURE_CUBE_MAP_NEGATIVE_X\"] = 34070] = \"TEXTURE_CUBE_MAP_NEGATIVE_X\";\n TARGETS[TARGETS[\"TEXTURE_CUBE_MAP_POSITIVE_Y\"] = 34071] = \"TEXTURE_CUBE_MAP_POSITIVE_Y\";\n TARGETS[TARGETS[\"TEXTURE_CUBE_MAP_NEGATIVE_Y\"] = 34072] = \"TEXTURE_CUBE_MAP_NEGATIVE_Y\";\n TARGETS[TARGETS[\"TEXTURE_CUBE_MAP_POSITIVE_Z\"] = 34073] = \"TEXTURE_CUBE_MAP_POSITIVE_Z\";\n TARGETS[TARGETS[\"TEXTURE_CUBE_MAP_NEGATIVE_Z\"] = 34074] = \"TEXTURE_CUBE_MAP_NEGATIVE_Z\";\n})(TARGETS || (TARGETS = {}));\n/**\n * Various GL data format types.\n *\n * @memberof PIXI\n * @static\n * @name TYPES\n * @enum {number}\n * @property {number} UNSIGNED_BYTE=5121\n * @property {number} UNSIGNED_SHORT=5123\n * @property {number} UNSIGNED_SHORT_5_6_5=33635\n * @property {number} UNSIGNED_SHORT_4_4_4_4=32819\n * @property {number} UNSIGNED_SHORT_5_5_5_1=32820\n * @property {number} FLOAT=5126\n * @property {number} HALF_FLOAT=36193\n */\nvar TYPES;\n(function (TYPES) {\n TYPES[TYPES[\"UNSIGNED_BYTE\"] = 5121] = \"UNSIGNED_BYTE\";\n TYPES[TYPES[\"UNSIGNED_SHORT\"] = 5123] = \"UNSIGNED_SHORT\";\n TYPES[TYPES[\"UNSIGNED_SHORT_5_6_5\"] = 33635] = \"UNSIGNED_SHORT_5_6_5\";\n TYPES[TYPES[\"UNSIGNED_SHORT_4_4_4_4\"] = 32819] = \"UNSIGNED_SHORT_4_4_4_4\";\n TYPES[TYPES[\"UNSIGNED_SHORT_5_5_5_1\"] = 32820] = \"UNSIGNED_SHORT_5_5_5_1\";\n TYPES[TYPES[\"FLOAT\"] = 5126] = \"FLOAT\";\n TYPES[TYPES[\"HALF_FLOAT\"] = 36193] = \"HALF_FLOAT\";\n})(TYPES || (TYPES = {}));\n/**\n * The scale modes that are supported by pixi.\n *\n * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations.\n * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability.\n *\n * @memberof PIXI\n * @static\n * @name SCALE_MODES\n * @enum {number}\n * @property {number} LINEAR Smooth scaling\n * @property {number} NEAREST Pixelating scaling\n */\nvar SCALE_MODES;\n(function (SCALE_MODES) {\n SCALE_MODES[SCALE_MODES[\"NEAREST\"] = 0] = \"NEAREST\";\n SCALE_MODES[SCALE_MODES[\"LINEAR\"] = 1] = \"LINEAR\";\n})(SCALE_MODES || (SCALE_MODES = {}));\n/**\n * The wrap modes that are supported by pixi.\n *\n * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations.\n * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability.\n * If the texture is non power of two then clamp will be used regardless as WebGL can\n * only use REPEAT if the texture is po2.\n *\n * This property only affects WebGL.\n *\n * @name WRAP_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} CLAMP - The textures uvs are clamped\n * @property {number} REPEAT - The texture uvs tile and repeat\n * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring\n */\nvar WRAP_MODES;\n(function (WRAP_MODES) {\n WRAP_MODES[WRAP_MODES[\"CLAMP\"] = 33071] = \"CLAMP\";\n WRAP_MODES[WRAP_MODES[\"REPEAT\"] = 10497] = \"REPEAT\";\n WRAP_MODES[WRAP_MODES[\"MIRRORED_REPEAT\"] = 33648] = \"MIRRORED_REPEAT\";\n})(WRAP_MODES || (WRAP_MODES = {}));\n/**\n * Mipmap filtering modes that are supported by pixi.\n *\n * The {@link PIXI.settings.MIPMAP_TEXTURES} affects default texture filtering.\n * Mipmaps are generated for a baseTexture if its `mipmap` field is `ON`,\n * or its `POW2` and texture dimensions are powers of 2.\n * Due to platform restriction, `ON` option will work like `POW2` for webgl-1.\n *\n * This property only affects WebGL.\n *\n * @name MIPMAP_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} OFF - No mipmaps\n * @property {number} POW2 - Generate mipmaps if texture dimensions are pow2\n * @property {number} ON - Always generate mipmaps\n */\nvar MIPMAP_MODES;\n(function (MIPMAP_MODES) {\n MIPMAP_MODES[MIPMAP_MODES[\"OFF\"] = 0] = \"OFF\";\n MIPMAP_MODES[MIPMAP_MODES[\"POW2\"] = 1] = \"POW2\";\n MIPMAP_MODES[MIPMAP_MODES[\"ON\"] = 2] = \"ON\";\n})(MIPMAP_MODES || (MIPMAP_MODES = {}));\n/**\n * How to treat textures with premultiplied alpha\n *\n * @name ALPHA_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NO_PREMULTIPLIED_ALPHA - Source is not premultiplied, leave it like that.\n * Option for compressed and data textures that are created from typed arrays.\n * @property {number} PREMULTIPLY_ON_UPLOAD - Source is not premultiplied, premultiply on upload.\n * Default option, used for all loaded images.\n * @property {number} PREMULTIPLIED_ALPHA - Source is already premultiplied\n * Example: spine atlases with `_pma` suffix.\n * @property {number} NPM - Alias for NO_PREMULTIPLIED_ALPHA.\n * @property {number} UNPACK - Default option, alias for PREMULTIPLY_ON_UPLOAD.\n * @property {number} PMA - Alias for PREMULTIPLIED_ALPHA.\n */\nvar ALPHA_MODES;\n(function (ALPHA_MODES) {\n ALPHA_MODES[ALPHA_MODES[\"NPM\"] = 0] = \"NPM\";\n ALPHA_MODES[ALPHA_MODES[\"UNPACK\"] = 1] = \"UNPACK\";\n ALPHA_MODES[ALPHA_MODES[\"PMA\"] = 2] = \"PMA\";\n ALPHA_MODES[ALPHA_MODES[\"NO_PREMULTIPLIED_ALPHA\"] = 0] = \"NO_PREMULTIPLIED_ALPHA\";\n ALPHA_MODES[ALPHA_MODES[\"PREMULTIPLY_ON_UPLOAD\"] = 1] = \"PREMULTIPLY_ON_UPLOAD\";\n ALPHA_MODES[ALPHA_MODES[\"PREMULTIPLY_ALPHA\"] = 2] = \"PREMULTIPLY_ALPHA\";\n})(ALPHA_MODES || (ALPHA_MODES = {}));\n/**\n * How to clear renderTextures in filter\n *\n * @name CLEAR_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} BLEND - Preserve the information in the texture, blend above\n * @property {number} CLEAR - Must use `gl.clear` operation\n * @property {number} BLIT - Clear or blit it, depends on device and level of paranoia\n * @property {number} NO - Alias for BLEND, same as `false` in earlier versions\n * @property {number} YES - Alias for CLEAR, same as `true` in earlier versions\n * @property {number} AUTO - Alias for BLIT\n */\nvar CLEAR_MODES;\n(function (CLEAR_MODES) {\n CLEAR_MODES[CLEAR_MODES[\"NO\"] = 0] = \"NO\";\n CLEAR_MODES[CLEAR_MODES[\"YES\"] = 1] = \"YES\";\n CLEAR_MODES[CLEAR_MODES[\"AUTO\"] = 2] = \"AUTO\";\n CLEAR_MODES[CLEAR_MODES[\"BLEND\"] = 0] = \"BLEND\";\n CLEAR_MODES[CLEAR_MODES[\"CLEAR\"] = 1] = \"CLEAR\";\n CLEAR_MODES[CLEAR_MODES[\"BLIT\"] = 2] = \"BLIT\";\n})(CLEAR_MODES || (CLEAR_MODES = {}));\n/**\n * The gc modes that are supported by pixi.\n *\n * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for PixiJS textures is AUTO\n * If set to GC_MODE, the renderer will occasionally check textures usage. If they are not\n * used for a specified period of time they will be removed from the GPU. They will of course\n * be uploaded again when they are required. This is a silent behind the scenes process that\n * should ensure that the GPU does not get filled up.\n *\n * Handy for mobile devices!\n * This property only affects WebGL.\n *\n * @name GC_MODES\n * @enum {number}\n * @static\n * @memberof PIXI\n * @property {number} AUTO - Garbage collection will happen periodically automatically\n * @property {number} MANUAL - Garbage collection will need to be called manually\n */\nvar GC_MODES;\n(function (GC_MODES) {\n GC_MODES[GC_MODES[\"AUTO\"] = 0] = \"AUTO\";\n GC_MODES[GC_MODES[\"MANUAL\"] = 1] = \"MANUAL\";\n})(GC_MODES || (GC_MODES = {}));\n/**\n * Constants that specify float precision in shaders.\n *\n * @name PRECISION\n * @memberof PIXI\n * @constant\n * @static\n * @enum {string}\n * @property {string} LOW='lowp'\n * @property {string} MEDIUM='mediump'\n * @property {string} HIGH='highp'\n */\nvar PRECISION;\n(function (PRECISION) {\n PRECISION[\"LOW\"] = \"lowp\";\n PRECISION[\"MEDIUM\"] = \"mediump\";\n PRECISION[\"HIGH\"] = \"highp\";\n})(PRECISION || (PRECISION = {}));\n/**\n * Constants for mask implementations.\n * We use `type` suffix because it leads to very different behaviours\n *\n * @name MASK_TYPES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NONE - Mask is ignored\n * @property {number} SCISSOR - Scissor mask, rectangle on screen, cheap\n * @property {number} STENCIL - Stencil mask, 1-bit, medium, works only if renderer supports stencil\n * @property {number} SPRITE - Mask that uses SpriteMaskFilter, uses temporary RenderTexture\n */\nvar MASK_TYPES;\n(function (MASK_TYPES) {\n MASK_TYPES[MASK_TYPES[\"NONE\"] = 0] = \"NONE\";\n MASK_TYPES[MASK_TYPES[\"SCISSOR\"] = 1] = \"SCISSOR\";\n MASK_TYPES[MASK_TYPES[\"STENCIL\"] = 2] = \"STENCIL\";\n MASK_TYPES[MASK_TYPES[\"SPRITE\"] = 3] = \"SPRITE\";\n})(MASK_TYPES || (MASK_TYPES = {}));\n/**\n * Constants for multi-sampling antialiasing.\n *\n * @see PIXI.Framebuffer#multisample\n *\n * @name MSAA_QUALITY\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NONE - No multisampling for this renderTexture\n * @property {number} LOW - Try 2 samples\n * @property {number} MEDIUM - Try 4 samples\n * @property {number} HIGH - Try 8 samples\n */\nvar MSAA_QUALITY;\n(function (MSAA_QUALITY) {\n MSAA_QUALITY[MSAA_QUALITY[\"NONE\"] = 0] = \"NONE\";\n MSAA_QUALITY[MSAA_QUALITY[\"LOW\"] = 2] = \"LOW\";\n MSAA_QUALITY[MSAA_QUALITY[\"MEDIUM\"] = 4] = \"MEDIUM\";\n MSAA_QUALITY[MSAA_QUALITY[\"HIGH\"] = 8] = \"HIGH\";\n})(MSAA_QUALITY || (MSAA_QUALITY = {}));\n\n\n//# sourceMappingURL=constants.es.js.map\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/@pixi/constants/lib/constants.es.js?"); /***/ }), /***/ "./node_modules/@pixi/core/lib/core.es.js": /*!************************************************!*\ !*** ./node_modules/@pixi/core/lib/core.es.js ***! \************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"AbstractBatchRenderer\": () => (/* binding */ AbstractBatchRenderer),\n/* harmony export */ \"AbstractRenderer\": () => (/* binding */ AbstractRenderer),\n/* harmony export */ \"Attribute\": () => (/* binding */ Attribute),\n/* harmony export */ \"BaseRenderTexture\": () => (/* binding */ BaseRenderTexture),\n/* harmony export */ \"BaseTexture\": () => (/* binding */ BaseTexture),\n/* harmony export */ \"BatchDrawCall\": () => (/* binding */ BatchDrawCall),\n/* harmony export */ \"BatchGeometry\": () => (/* binding */ BatchGeometry),\n/* harmony export */ \"BatchPluginFactory\": () => (/* binding */ BatchPluginFactory),\n/* harmony export */ \"BatchRenderer\": () => (/* binding */ BatchRenderer),\n/* harmony export */ \"BatchShaderGenerator\": () => (/* binding */ BatchShaderGenerator),\n/* harmony export */ \"BatchTextureArray\": () => (/* binding */ BatchTextureArray),\n/* harmony export */ \"Buffer\": () => (/* binding */ Buffer),\n/* harmony export */ \"Filter\": () => (/* binding */ Filter),\n/* harmony export */ \"FilterState\": () => (/* binding */ FilterState),\n/* harmony export */ \"Framebuffer\": () => (/* binding */ Framebuffer),\n/* harmony export */ \"GLFramebuffer\": () => (/* binding */ GLFramebuffer),\n/* harmony export */ \"GLProgram\": () => (/* binding */ GLProgram),\n/* harmony export */ \"GLTexture\": () => (/* binding */ GLTexture),\n/* harmony export */ \"Geometry\": () => (/* binding */ Geometry),\n/* harmony export */ \"IGLUniformData\": () => (/* binding */ IGLUniformData),\n/* harmony export */ \"MaskData\": () => (/* binding */ MaskData),\n/* harmony export */ \"ObjectRenderer\": () => (/* binding */ ObjectRenderer),\n/* harmony export */ \"Program\": () => (/* binding */ Program),\n/* harmony export */ \"Quad\": () => (/* binding */ Quad),\n/* harmony export */ \"QuadUv\": () => (/* binding */ QuadUv),\n/* harmony export */ \"RenderTexture\": () => (/* binding */ RenderTexture),\n/* harmony export */ \"RenderTexturePool\": () => (/* binding */ RenderTexturePool),\n/* harmony export */ \"Renderer\": () => (/* binding */ Renderer),\n/* harmony export */ \"Shader\": () => (/* binding */ Shader),\n/* harmony export */ \"SpriteMaskFilter\": () => (/* binding */ SpriteMaskFilter),\n/* harmony export */ \"State\": () => (/* binding */ State),\n/* harmony export */ \"System\": () => (/* binding */ System),\n/* harmony export */ \"Texture\": () => (/* binding */ Texture),\n/* harmony export */ \"TextureMatrix\": () => (/* binding */ TextureMatrix),\n/* harmony export */ \"TextureUvs\": () => (/* binding */ TextureUvs),\n/* harmony export */ \"UniformGroup\": () => (/* binding */ UniformGroup),\n/* harmony export */ \"ViewableBuffer\": () => (/* binding */ ViewableBuffer),\n/* harmony export */ \"autoDetectRenderer\": () => (/* binding */ autoDetectRenderer),\n/* harmony export */ \"checkMaxIfStatementsInShader\": () => (/* binding */ checkMaxIfStatementsInShader),\n/* harmony export */ \"defaultFilterVertex\": () => (/* binding */ defaultFilter),\n/* harmony export */ \"defaultVertex\": () => (/* binding */ _default),\n/* harmony export */ \"resources\": () => (/* binding */ index),\n/* harmony export */ \"systems\": () => (/* binding */ systems),\n/* harmony export */ \"uniformParsers\": () => (/* binding */ uniformParsers)\n/* harmony export */ });\n/* harmony import */ var _pixi_settings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @pixi/settings */ \"./node_modules/@pixi/settings/lib/settings.es.js\");\n/* harmony import */ var _pixi_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @pixi/constants */ \"./node_modules/@pixi/constants/lib/constants.es.js\");\n/* harmony import */ var _pixi_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @pixi/utils */ \"./node_modules/@pixi/utils/lib/utils.es.js\");\n/* harmony import */ var _pixi_runner__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @pixi/runner */ \"./node_modules/@pixi/runner/lib/runner.es.js\");\n/* harmony import */ var _pixi_ticker__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @pixi/ticker */ \"./node_modules/@pixi/ticker/lib/ticker.es.js\");\n/* harmony import */ var _pixi_math__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @pixi/math */ \"./node_modules/@pixi/math/lib/math.es.js\");\n/*!\n * @pixi/core - v5.3.11\n * Compiled Mon, 01 Nov 2021 16:10:12 UTC\n *\n * @pixi/core is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n\n\n\n\n\n\n\n/**\n * The maximum support for using WebGL. If a device does not\n * support WebGL version, for instance WebGL 2, it will still\n * attempt to fallback support to WebGL 1. If you want to\n * explicitly remove feature support to target a more stable\n * baseline, prefer a lower environment.\n *\n * Due to {@link https://bugs.chromium.org/p/chromium/issues/detail?id=934823|bug in chromium}\n * we disable webgl2 by default for all non-apple mobile devices.\n *\n * @static\n * @name PREFER_ENV\n * @memberof PIXI.settings\n * @type {number}\n * @default PIXI.ENV.WEBGL2\n */\n_pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.PREFER_ENV = _pixi_utils__WEBPACK_IMPORTED_MODULE_2__.isMobile.any ? _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.ENV.WEBGL : _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.ENV.WEBGL2;\n/**\n * If set to `true`, *only* Textures and BaseTexture objects stored\n * in the caches ({@link PIXI.utils.TextureCache TextureCache} and\n * {@link PIXI.utils.BaseTextureCache BaseTextureCache}) can be\n * used when calling {@link PIXI.Texture.from Texture.from} or\n * {@link PIXI.BaseTexture.from BaseTexture.from}.\n * Otherwise, these `from` calls throw an exception. Using this property\n * can be useful if you want to enforce preloading all assets with\n * {@link PIXI.Loader Loader}.\n *\n * @static\n * @name STRICT_TEXTURE_CACHE\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\n_pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.STRICT_TEXTURE_CACHE = false;\n\n/**\n * Collection of installed resource types, class must extend {@link PIXI.resources.Resource}.\n * @example\n * class CustomResource extends PIXI.resources.Resource {\n * // MUST have source, options constructor signature\n * // for auto-detected resources to be created.\n * constructor(source, options) {\n * super();\n * }\n * upload(renderer, baseTexture, glTexture) {\n * // upload with GL\n * return true;\n * }\n * // used to auto-detect resource\n * static test(source, extension) {\n * return extension === 'xyz'|| source instanceof SomeClass;\n * }\n * }\n * // Install the new resource type\n * PIXI.resources.INSTALLED.push(CustomResource);\n *\n * @name PIXI.resources.INSTALLED\n * @type {Array<*>}\n * @static\n * @readonly\n */\nvar INSTALLED = [];\n/**\n * Create a resource element from a single source element. This\n * auto-detects which type of resource to create. All resources that\n * are auto-detectable must have a static `test` method and a constructor\n * with the arguments `(source, options?)`. Currently, the supported\n * resources for auto-detection include:\n * - {@link PIXI.resources.ImageResource}\n * - {@link PIXI.resources.CanvasResource}\n * - {@link PIXI.resources.VideoResource}\n * - {@link PIXI.resources.SVGResource}\n * - {@link PIXI.resources.BufferResource}\n * @static\n * @function PIXI.resources.autoDetectResource\n * @param {string|*} source - Resource source, this can be the URL to the resource,\n * a typed-array (for BufferResource), HTMLVideoElement, SVG data-uri\n * or any other resource that can be auto-detected. If not resource is\n * detected, it's assumed to be an ImageResource.\n * @param {object} [options] - Pass-through options to use for Resource\n * @param {number} [options.width] - Width of BufferResource or SVG rasterization\n * @param {number} [options.height] - Height of BufferResource or SVG rasterization\n * @param {boolean} [options.autoLoad=true] - Image, SVG and Video flag to start loading\n * @param {number} [options.scale=1] - SVG source scale. Overridden by width, height\n * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - Image option to create Bitmap object\n * @param {boolean} [options.crossorigin=true] - Image and Video option to set crossOrigin\n * @param {boolean} [options.autoPlay=true] - Video option to start playing video immediately\n * @param {number} [options.updateFPS=0] - Video option to update how many times a second the\n * texture should be updated from the video. Leave at 0 to update at every render\n * @return {PIXI.resources.Resource} The created resource.\n */\nfunction autoDetectResource(source, options) {\n if (!source) {\n return null;\n }\n var extension = '';\n if (typeof source === 'string') {\n // search for file extension: period, 3-4 chars, then ?, # or EOL\n var result = (/\\.(\\w{3,4})(?:$|\\?|#)/i).exec(source);\n if (result) {\n extension = result[1].toLowerCase();\n }\n }\n for (var i = INSTALLED.length - 1; i >= 0; --i) {\n var ResourcePlugin = INSTALLED[i];\n if (ResourcePlugin.test && ResourcePlugin.test(source, extension)) {\n return new ResourcePlugin(source, options);\n }\n }\n throw new Error('Unrecognized source type to auto-detect Resource');\n}\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } };\r\n return extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\n\n/**\n * Base resource class for textures that manages validation and uploading, depending on its type.\n *\n * Uploading of a base texture to the GPU is required.\n *\n * @class\n * @memberof PIXI.resources\n */\nvar Resource = /** @class */ (function () {\n /**\n * @param {number} [width=0] - Width of the resource\n * @param {number} [height=0] - Height of the resource\n */\n function Resource(width, height) {\n if (width === void 0) { width = 0; }\n if (height === void 0) { height = 0; }\n /**\n * Internal width of the resource\n * @member {number}\n * @protected\n */\n this._width = width;\n /**\n * Internal height of the resource\n * @member {number}\n * @protected\n */\n this._height = height;\n /**\n * If resource has been destroyed\n * @member {boolean}\n * @readonly\n * @default false\n */\n this.destroyed = false;\n /**\n * `true` if resource is created by BaseTexture\n * useful for doing cleanup with BaseTexture destroy\n * and not cleaning up resources that were created\n * externally.\n * @member {boolean}\n * @protected\n */\n this.internal = false;\n /**\n * Mini-runner for handling resize events\n * accepts 2 parameters: width, height\n *\n * @member {Runner}\n * @private\n */\n this.onResize = new _pixi_runner__WEBPACK_IMPORTED_MODULE_3__.Runner('setRealSize');\n /**\n * Mini-runner for handling update events\n *\n * @member {Runner}\n * @private\n */\n this.onUpdate = new _pixi_runner__WEBPACK_IMPORTED_MODULE_3__.Runner('update');\n /**\n * Handle internal errors, such as loading errors\n * accepts 1 param: error\n *\n * @member {Runner}\n * @private\n */\n this.onError = new _pixi_runner__WEBPACK_IMPORTED_MODULE_3__.Runner('onError');\n }\n /**\n * Bind to a parent BaseTexture\n *\n * @param {PIXI.BaseTexture} baseTexture - Parent texture\n */\n Resource.prototype.bind = function (baseTexture) {\n this.onResize.add(baseTexture);\n this.onUpdate.add(baseTexture);\n this.onError.add(baseTexture);\n // Call a resize immediate if we already\n // have the width and height of the resource\n if (this._width || this._height) {\n this.onResize.emit(this._width, this._height);\n }\n };\n /**\n * Unbind to a parent BaseTexture\n *\n * @param {PIXI.BaseTexture} baseTexture - Parent texture\n */\n Resource.prototype.unbind = function (baseTexture) {\n this.onResize.remove(baseTexture);\n this.onUpdate.remove(baseTexture);\n this.onError.remove(baseTexture);\n };\n /**\n * Trigger a resize event\n * @param {number} width - X dimension\n * @param {number} height - Y dimension\n */\n Resource.prototype.resize = function (width, height) {\n if (width !== this._width || height !== this._height) {\n this._width = width;\n this._height = height;\n this.onResize.emit(width, height);\n }\n };\n Object.defineProperty(Resource.prototype, \"valid\", {\n /**\n * Has been validated\n * @readonly\n * @member {boolean}\n */\n get: function () {\n return !!this._width && !!this._height;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Has been updated trigger event\n */\n Resource.prototype.update = function () {\n if (!this.destroyed) {\n this.onUpdate.emit();\n }\n };\n /**\n * This can be overridden to start preloading a resource\n * or do any other prepare step.\n * @protected\n * @return {Promise} Handle the validate event\n */\n Resource.prototype.load = function () {\n return Promise.resolve(this);\n };\n Object.defineProperty(Resource.prototype, \"width\", {\n /**\n * The width of the resource.\n *\n * @member {number}\n * @readonly\n */\n get: function () {\n return this._width;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Resource.prototype, \"height\", {\n /**\n * The height of the resource.\n *\n * @member {number}\n * @readonly\n */\n get: function () {\n return this._height;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Set the style, optional to override\n *\n * @param {PIXI.Renderer} renderer - yeah, renderer!\n * @param {PIXI.BaseTexture} baseTexture - the texture\n * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context\n * @returns {boolean} `true` is success\n */\n Resource.prototype.style = function (_renderer, _baseTexture, _glTexture) {\n return false;\n };\n /**\n * Clean up anything, this happens when destroying is ready.\n *\n * @protected\n */\n Resource.prototype.dispose = function () {\n // override\n };\n /**\n * Call when destroying resource, unbind any BaseTexture object\n * before calling this method, as reference counts are maintained\n * internally.\n */\n Resource.prototype.destroy = function () {\n if (!this.destroyed) {\n this.destroyed = true;\n this.dispose();\n this.onError.removeAll();\n this.onError = null;\n this.onResize.removeAll();\n this.onResize = null;\n this.onUpdate.removeAll();\n this.onUpdate = null;\n }\n };\n /**\n * Abstract, used to auto-detect resource type\n *\n * @static\n * @param {*} source - The source object\n * @param {string} extension - The extension of source, if set\n */\n Resource.test = function (_source, _extension) {\n return false;\n };\n return Resource;\n}());\n\n/**\n * @interface SharedArrayBuffer\n */\n/**\n * Buffer resource with data of typed array.\n * @class\n * @extends PIXI.resources.Resource\n * @memberof PIXI.resources\n */\nvar BufferResource = /** @class */ (function (_super) {\n __extends(BufferResource, _super);\n /**\n * @param {Float32Array|Uint8Array|Uint32Array} source - Source buffer\n * @param {object} options - Options\n * @param {number} options.width - Width of the texture\n * @param {number} options.height - Height of the texture\n */\n function BufferResource(source, options) {\n var _this = this;\n var _a = options || {}, width = _a.width, height = _a.height;\n if (!width || !height) {\n throw new Error('BufferResource width or height invalid');\n }\n _this = _super.call(this, width, height) || this;\n /**\n * Source array\n * Cannot be ClampedUint8Array because it cant be uploaded to WebGL\n *\n * @member {Float32Array|Uint8Array|Uint32Array}\n */\n _this.data = source;\n return _this;\n }\n /**\n * Upload the texture to the GPU.\n * @param {PIXI.Renderer} renderer - Upload to the renderer\n * @param {PIXI.BaseTexture} baseTexture - Reference to parent texture\n * @param {PIXI.GLTexture} glTexture - glTexture\n * @returns {boolean} true is success\n */\n BufferResource.prototype.upload = function (renderer, baseTexture, glTexture) {\n var gl = renderer.gl;\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.ALPHA_MODES.UNPACK);\n if (glTexture.width === baseTexture.width && glTexture.height === baseTexture.height) {\n gl.texSubImage2D(baseTexture.target, 0, 0, 0, baseTexture.width, baseTexture.height, baseTexture.format, baseTexture.type, this.data);\n }\n else {\n glTexture.width = baseTexture.width;\n glTexture.height = baseTexture.height;\n gl.texImage2D(baseTexture.target, 0, glTexture.internalFormat, baseTexture.width, baseTexture.height, 0, baseTexture.format, glTexture.type, this.data);\n }\n return true;\n };\n /**\n * Destroy and don't use after this\n * @override\n */\n BufferResource.prototype.dispose = function () {\n this.data = null;\n };\n /**\n * Used to auto-detect the type of resource.\n *\n * @static\n * @param {*} source - The source object\n * @return {boolean} `true` if \n */\n BufferResource.test = function (source) {\n return source instanceof Float32Array\n || source instanceof Uint8Array\n || source instanceof Uint32Array;\n };\n return BufferResource;\n}(Resource));\n\nvar defaultBufferOptions = {\n scaleMode: _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.SCALE_MODES.NEAREST,\n format: _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.FORMATS.RGBA,\n alphaMode: _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.ALPHA_MODES.NPM,\n};\n/**\n * A Texture stores the information that represents an image.\n * All textures have a base texture, which contains information about the source.\n * Therefore you can have many textures all using a single BaseTexture\n *\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n * @param {PIXI.resources.Resource|string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} [resource=null]\n * The current resource to use, for things that aren't Resource objects, will be converted\n * into a Resource.\n * @param {Object} [options] - Collection of options\n * @param {PIXI.MIPMAP_MODES} [options.mipmap=PIXI.settings.MIPMAP_TEXTURES] - If mipmapping is enabled for texture\n * @param {number} [options.anisotropicLevel=PIXI.settings.ANISOTROPIC_LEVEL] - Anisotropic filtering level of texture\n * @param {PIXI.WRAP_MODES} [options.wrapMode=PIXI.settings.WRAP_MODE] - Wrap mode for textures\n * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - Default scale mode, linear, nearest\n * @param {PIXI.FORMATS} [options.format=PIXI.FORMATS.RGBA] - GL format type\n * @param {PIXI.TYPES} [options.type=PIXI.TYPES.UNSIGNED_BYTE] - GL data type\n * @param {PIXI.TARGETS} [options.target=PIXI.TARGETS.TEXTURE_2D] - GL texture target\n * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Pre multiply the image alpha\n * @param {number} [options.width=0] - Width of the texture\n * @param {number} [options.height=0] - Height of the texture\n * @param {number} [options.resolution] - Resolution of the base texture\n * @param {object} [options.resourceOptions] - Optional resource options,\n * see {@link PIXI.resources.autoDetectResource autoDetectResource}\n */\nvar BaseTexture = /** @class */ (function (_super) {\n __extends(BaseTexture, _super);\n function BaseTexture(resource, options) {\n if (resource === void 0) { resource = null; }\n if (options === void 0) { options = null; }\n var _this = _super.call(this) || this;\n options = options || {};\n var alphaMode = options.alphaMode, mipmap = options.mipmap, anisotropicLevel = options.anisotropicLevel, scaleMode = options.scaleMode, width = options.width, height = options.height, wrapMode = options.wrapMode, format = options.format, type = options.type, target = options.target, resolution = options.resolution, resourceOptions = options.resourceOptions;\n // Convert the resource to a Resource object\n if (resource && !(resource instanceof Resource)) {\n resource = autoDetectResource(resource, resourceOptions);\n resource.internal = true;\n }\n /**\n * The width of the base texture set when the image has loaded\n *\n * @readonly\n * @member {number}\n */\n _this.width = width || 0;\n /**\n * The height of the base texture set when the image has loaded\n *\n * @readonly\n * @member {number}\n */\n _this.height = height || 0;\n /**\n * The resolution / device pixel ratio of the texture\n *\n * @member {number}\n * @default PIXI.settings.RESOLUTION\n */\n _this.resolution = resolution || _pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.RESOLUTION;\n /**\n * Mipmap mode of the texture, affects downscaled images\n *\n * @member {PIXI.MIPMAP_MODES}\n * @default PIXI.settings.MIPMAP_TEXTURES\n */\n _this.mipmap = mipmap !== undefined ? mipmap : _pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.MIPMAP_TEXTURES;\n /**\n * Anisotropic filtering level of texture\n *\n * @member {number}\n * @default PIXI.settings.ANISOTROPIC_LEVEL\n */\n _this.anisotropicLevel = anisotropicLevel !== undefined ? anisotropicLevel : _pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.ANISOTROPIC_LEVEL;\n /**\n * How the texture wraps\n * @member {number}\n */\n _this.wrapMode = wrapMode || _pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.WRAP_MODE;\n /**\n * The scale mode to apply when scaling this texture\n *\n * @member {PIXI.SCALE_MODES}\n * @default PIXI.settings.SCALE_MODE\n */\n _this.scaleMode = scaleMode !== undefined ? scaleMode : _pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.SCALE_MODE;\n /**\n * The pixel format of the texture\n *\n * @member {PIXI.FORMATS}\n * @default PIXI.FORMATS.RGBA\n */\n _this.format = format || _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.FORMATS.RGBA;\n /**\n * The type of resource data\n *\n * @member {PIXI.TYPES}\n * @default PIXI.TYPES.UNSIGNED_BYTE\n */\n _this.type = type || _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.TYPES.UNSIGNED_BYTE;\n /**\n * The target type\n *\n * @member {PIXI.TARGETS}\n * @default PIXI.TARGETS.TEXTURE_2D\n */\n _this.target = target || _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.TARGETS.TEXTURE_2D;\n /**\n * How to treat premultiplied alpha, see {@link PIXI.ALPHA_MODES}.\n *\n * @member {PIXI.ALPHA_MODES}\n * @default PIXI.ALPHA_MODES.UNPACK\n */\n _this.alphaMode = alphaMode !== undefined ? alphaMode : _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.ALPHA_MODES.UNPACK;\n if (options.premultiplyAlpha !== undefined) {\n // triggers deprecation\n _this.premultiplyAlpha = options.premultiplyAlpha;\n }\n /**\n * Global unique identifier for this BaseTexture\n *\n * @member {number}\n * @protected\n */\n _this.uid = (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.uid)();\n /**\n * Used by automatic texture Garbage Collection, stores last GC tick when it was bound\n *\n * @member {number}\n * @protected\n */\n _this.touched = 0;\n /**\n * Whether or not the texture is a power of two, try to use power of two textures as much\n * as you can\n *\n * @readonly\n * @member {boolean}\n * @default false\n */\n _this.isPowerOfTwo = false;\n _this._refreshPOT();\n /**\n * The map of render context textures where this is bound\n *\n * @member {Object}\n * @private\n */\n _this._glTextures = {};\n /**\n * Used by TextureSystem to only update texture to the GPU when needed.\n * Please call `update()` to increment it.\n *\n * @readonly\n * @member {number}\n */\n _this.dirtyId = 0;\n /**\n * Used by TextureSystem to only update texture style when needed.\n *\n * @protected\n * @member {number}\n */\n _this.dirtyStyleId = 0;\n /**\n * Currently default cache ID.\n *\n * @member {string}\n */\n _this.cacheId = null;\n /**\n * Generally speaking means when resource is loaded.\n * @readonly\n * @member {boolean}\n */\n _this.valid = width > 0 && height > 0;\n /**\n * The collection of alternative cache ids, since some BaseTextures\n * can have more than one ID, short name and longer full URL\n *\n * @member {Array}\n * @readonly\n */\n _this.textureCacheIds = [];\n /**\n * Flag if BaseTexture has been destroyed.\n *\n * @member {boolean}\n * @readonly\n */\n _this.destroyed = false;\n /**\n * The resource used by this BaseTexture, there can only\n * be one resource per BaseTexture, but textures can share\n * resources.\n *\n * @member {PIXI.resources.Resource}\n * @readonly\n */\n _this.resource = null;\n /**\n * Number of the texture batch, used by multi-texture renderers\n *\n * @member {number}\n */\n _this._batchEnabled = 0;\n /**\n * Location inside texture batch, used by multi-texture renderers\n *\n * @member {number}\n */\n _this._batchLocation = 0;\n /**\n * Whether its a part of another texture, handled by ArrayResource or CubeResource\n *\n * @member {PIXI.BaseTexture}\n */\n _this.parentTextureArray = null;\n /**\n * Fired when a not-immediately-available source finishes loading.\n *\n * @protected\n * @event PIXI.BaseTexture#loaded\n * @param {PIXI.BaseTexture} baseTexture - Resource loaded.\n */\n /**\n * Fired when a not-immediately-available source fails to load.\n *\n * @protected\n * @event PIXI.BaseTexture#error\n * @param {PIXI.BaseTexture} baseTexture - Resource errored.\n * @param {ErrorEvent} event - Load error event.\n */\n /**\n * Fired when BaseTexture is updated.\n *\n * @protected\n * @event PIXI.BaseTexture#loaded\n * @param {PIXI.BaseTexture} baseTexture - Resource loaded.\n */\n /**\n * Fired when BaseTexture is updated.\n *\n * @protected\n * @event PIXI.BaseTexture#update\n * @param {PIXI.BaseTexture} baseTexture - Instance of texture being updated.\n */\n /**\n * Fired when BaseTexture is destroyed.\n *\n * @protected\n * @event PIXI.BaseTexture#dispose\n * @param {PIXI.BaseTexture} baseTexture - Instance of texture being destroyed.\n */\n // Set the resource\n _this.setResource(resource);\n return _this;\n }\n Object.defineProperty(BaseTexture.prototype, \"realWidth\", {\n /**\n * Pixel width of the source of this texture\n *\n * @readonly\n * @member {number}\n */\n get: function () {\n return Math.ceil((this.width * this.resolution) - 1e-4);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BaseTexture.prototype, \"realHeight\", {\n /**\n * Pixel height of the source of this texture\n *\n * @readonly\n * @member {number}\n */\n get: function () {\n return Math.ceil((this.height * this.resolution) - 1e-4);\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Changes style options of BaseTexture\n *\n * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode\n * @param {PIXI.MIPMAP_MODES} [mipmap] - enable mipmaps\n * @returns {PIXI.BaseTexture} this\n */\n BaseTexture.prototype.setStyle = function (scaleMode, mipmap) {\n var dirty;\n if (scaleMode !== undefined && scaleMode !== this.scaleMode) {\n this.scaleMode = scaleMode;\n dirty = true;\n }\n if (mipmap !== undefined && mipmap !== this.mipmap) {\n this.mipmap = mipmap;\n dirty = true;\n }\n if (dirty) {\n this.dirtyStyleId++;\n }\n return this;\n };\n /**\n * Changes w/h/resolution. Texture becomes valid if width and height are greater than zero.\n *\n * @param {number} width - Visual width\n * @param {number} height - Visual height\n * @param {number} [resolution] - Optionally set resolution\n * @returns {PIXI.BaseTexture} this\n */\n BaseTexture.prototype.setSize = function (width, height, resolution) {\n this.resolution = resolution || this.resolution;\n this.width = width;\n this.height = height;\n this._refreshPOT();\n this.update();\n return this;\n };\n /**\n * Sets real size of baseTexture, preserves current resolution.\n *\n * @param {number} realWidth - Full rendered width\n * @param {number} realHeight - Full rendered height\n * @param {number} [resolution] - Optionally set resolution\n * @returns {PIXI.BaseTexture} this\n */\n BaseTexture.prototype.setRealSize = function (realWidth, realHeight, resolution) {\n this.resolution = resolution || this.resolution;\n this.width = realWidth / this.resolution;\n this.height = realHeight / this.resolution;\n this._refreshPOT();\n this.update();\n return this;\n };\n /**\n * Refresh check for isPowerOfTwo texture based on size\n *\n * @private\n */\n BaseTexture.prototype._refreshPOT = function () {\n this.isPowerOfTwo = (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.isPow2)(this.realWidth) && (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.isPow2)(this.realHeight);\n };\n /**\n * Changes resolution\n *\n * @param {number} resolution - res\n * @returns {PIXI.BaseTexture} this\n */\n BaseTexture.prototype.setResolution = function (resolution) {\n var oldResolution = this.resolution;\n if (oldResolution === resolution) {\n return this;\n }\n this.resolution = resolution;\n if (this.valid) {\n this.width = this.width * oldResolution / resolution;\n this.height = this.height * oldResolution / resolution;\n this.emit('update', this);\n }\n this._refreshPOT();\n return this;\n };\n /**\n * Sets the resource if it wasn't set. Throws error if resource already present\n *\n * @param {PIXI.resources.Resource} resource - that is managing this BaseTexture\n * @returns {PIXI.BaseTexture} this\n */\n BaseTexture.prototype.setResource = function (resource) {\n if (this.resource === resource) {\n return this;\n }\n if (this.resource) {\n throw new Error('Resource can be set only once');\n }\n resource.bind(this);\n this.resource = resource;\n return this;\n };\n /**\n * Invalidates the object. Texture becomes valid if width and height are greater than zero.\n */\n BaseTexture.prototype.update = function () {\n if (!this.valid) {\n if (this.width > 0 && this.height > 0) {\n this.valid = true;\n this.emit('loaded', this);\n this.emit('update', this);\n }\n }\n else {\n this.dirtyId++;\n this.dirtyStyleId++;\n this.emit('update', this);\n }\n };\n /**\n * Handle errors with resources.\n * @private\n * @param {ErrorEvent} event - Error event emitted.\n */\n BaseTexture.prototype.onError = function (event) {\n this.emit('error', this, event);\n };\n /**\n * Destroys this base texture.\n * The method stops if resource doesn't want this texture to be destroyed.\n * Removes texture from all caches.\n */\n BaseTexture.prototype.destroy = function () {\n // remove and destroy the resource\n if (this.resource) {\n this.resource.unbind(this);\n // only destroy resourced created internally\n if (this.resource.internal) {\n this.resource.destroy();\n }\n this.resource = null;\n }\n if (this.cacheId) {\n delete _pixi_utils__WEBPACK_IMPORTED_MODULE_2__.BaseTextureCache[this.cacheId];\n delete _pixi_utils__WEBPACK_IMPORTED_MODULE_2__.TextureCache[this.cacheId];\n this.cacheId = null;\n }\n // finally let the WebGL renderer know..\n this.dispose();\n BaseTexture.removeFromCache(this);\n this.textureCacheIds = null;\n this.destroyed = true;\n };\n /**\n * Frees the texture from WebGL memory without destroying this texture object.\n * This means you can still use the texture later which will upload it to GPU\n * memory again.\n *\n * @fires PIXI.BaseTexture#dispose\n */\n BaseTexture.prototype.dispose = function () {\n this.emit('dispose', this);\n };\n /**\n * Utility function for BaseTexture|Texture cast\n */\n BaseTexture.prototype.castToBaseTexture = function () {\n return this;\n };\n /**\n * Helper function that creates a base texture based on the source you provide.\n * The source can be - image url, image element, canvas element. If the\n * source is an image url or an image element and not in the base texture\n * cache, it will be created and loaded.\n *\n * @static\n * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The\n * source to create base texture from.\n * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options.\n * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}.\n * @returns {PIXI.BaseTexture} The new base texture.\n */\n BaseTexture.from = function (source, options, strict) {\n if (strict === void 0) { strict = _pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.STRICT_TEXTURE_CACHE; }\n var isFrame = typeof source === 'string';\n var cacheId = null;\n if (isFrame) {\n cacheId = source;\n }\n else {\n if (!source._pixiId) {\n source._pixiId = \"pixiid_\" + (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.uid)();\n }\n cacheId = source._pixiId;\n }\n var baseTexture = _pixi_utils__WEBPACK_IMPORTED_MODULE_2__.BaseTextureCache[cacheId];\n // Strict-mode rejects invalid cacheIds\n if (isFrame && strict && !baseTexture) {\n throw new Error(\"The cacheId \\\"\" + cacheId + \"\\\" does not exist in BaseTextureCache.\");\n }\n if (!baseTexture) {\n baseTexture = new BaseTexture(source, options);\n baseTexture.cacheId = cacheId;\n BaseTexture.addToCache(baseTexture, cacheId);\n }\n return baseTexture;\n };\n /**\n * Create a new BaseTexture with a BufferResource from a Float32Array.\n * RGBA values are floats from 0 to 1.\n * @static\n * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data\n * is provided, a new Float32Array is created.\n * @param {number} width - Width of the resource\n * @param {number} height - Height of the resource\n * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options.\n * @return {PIXI.BaseTexture} The resulting new BaseTexture\n */\n BaseTexture.fromBuffer = function (buffer, width, height, options) {\n buffer = buffer || new Float32Array(width * height * 4);\n var resource = new BufferResource(buffer, { width: width, height: height });\n var type = buffer instanceof Float32Array ? _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.TYPES.FLOAT : _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.TYPES.UNSIGNED_BYTE;\n return new BaseTexture(resource, Object.assign(defaultBufferOptions, options || { width: width, height: height, type: type }));\n };\n /**\n * Adds a BaseTexture to the global BaseTextureCache. This cache is shared across the whole PIXI object.\n *\n * @static\n * @param {PIXI.BaseTexture} baseTexture - The BaseTexture to add to the cache.\n * @param {string} id - The id that the BaseTexture will be stored against.\n */\n BaseTexture.addToCache = function (baseTexture, id) {\n if (id) {\n if (baseTexture.textureCacheIds.indexOf(id) === -1) {\n baseTexture.textureCacheIds.push(id);\n }\n if (_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.BaseTextureCache[id]) {\n // eslint-disable-next-line no-console\n console.warn(\"BaseTexture added to the cache with an id [\" + id + \"] that already had an entry\");\n }\n _pixi_utils__WEBPACK_IMPORTED_MODULE_2__.BaseTextureCache[id] = baseTexture;\n }\n };\n /**\n * Remove a BaseTexture from the global BaseTextureCache.\n *\n * @static\n * @param {string|PIXI.BaseTexture} baseTexture - id of a BaseTexture to be removed, or a BaseTexture instance itself.\n * @return {PIXI.BaseTexture|null} The BaseTexture that was removed.\n */\n BaseTexture.removeFromCache = function (baseTexture) {\n if (typeof baseTexture === 'string') {\n var baseTextureFromCache = _pixi_utils__WEBPACK_IMPORTED_MODULE_2__.BaseTextureCache[baseTexture];\n if (baseTextureFromCache) {\n var index = baseTextureFromCache.textureCacheIds.indexOf(baseTexture);\n if (index > -1) {\n baseTextureFromCache.textureCacheIds.splice(index, 1);\n }\n delete _pixi_utils__WEBPACK_IMPORTED_MODULE_2__.BaseTextureCache[baseTexture];\n return baseTextureFromCache;\n }\n }\n else if (baseTexture && baseTexture.textureCacheIds) {\n for (var i = 0; i < baseTexture.textureCacheIds.length; ++i) {\n delete _pixi_utils__WEBPACK_IMPORTED_MODULE_2__.BaseTextureCache[baseTexture.textureCacheIds[i]];\n }\n baseTexture.textureCacheIds.length = 0;\n return baseTexture;\n }\n return null;\n };\n /**\n * Global number of the texture batch, used by multi-texture renderers\n *\n * @static\n * @member {number}\n */\n BaseTexture._globalBatch = 0;\n return BaseTexture;\n}(_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.EventEmitter));\n\n/**\n * Resource that can manage several resource (items) inside.\n * All resources need to have the same pixel size.\n * Parent class for CubeResource and ArrayResource\n *\n * @class\n * @extends PIXI.resources.Resource\n * @memberof PIXI.resources\n * @param {object} [options] Options to for Resource constructor\n * @param {number} [options.width] - Width of the resource\n * @param {number} [options.height] - Height of the resource\n */\nvar AbstractMultiResource = /** @class */ (function (_super) {\n __extends(AbstractMultiResource, _super);\n function AbstractMultiResource(length, options) {\n var _this = this;\n var _a = options || {}, width = _a.width, height = _a.height;\n _this = _super.call(this, width, height) || this;\n /**\n * Collection of partial baseTextures that correspond to resources\n * @member {Array}\n * @readonly\n */\n _this.items = [];\n /**\n * Dirty IDs for each part\n * @member {Array}\n * @readonly\n */\n _this.itemDirtyIds = [];\n for (var i = 0; i < length; i++) {\n var partTexture = new BaseTexture();\n _this.items.push(partTexture);\n // -2 - first run of texture array upload\n // -1 - texture item was allocated\n // >=0 - texture item uploaded , in sync with items[i].dirtyId\n _this.itemDirtyIds.push(-2);\n }\n /**\n * Number of elements in array\n *\n * @member {number}\n * @readonly\n */\n _this.length = length;\n /**\n * Promise when loading\n * @member {Promise}\n * @private\n * @default null\n */\n _this._load = null;\n /**\n * Bound baseTexture, there can only be one\n * @member {PIXI.BaseTexture}\n */\n _this.baseTexture = null;\n return _this;\n }\n /**\n * used from ArrayResource and CubeResource constructors\n * @param {Array<*>} resources - Can be resources, image elements, canvas, etc. ,\n * length should be same as constructor length\n * @param {object} [options] - detect options for resources\n * @protected\n */\n AbstractMultiResource.prototype.initFromArray = function (resources, options) {\n for (var i = 0; i < this.length; i++) {\n if (!resources[i]) {\n continue;\n }\n if (resources[i].castToBaseTexture) {\n this.addBaseTextureAt(resources[i].castToBaseTexture(), i);\n }\n else if (resources[i] instanceof Resource) {\n this.addResourceAt(resources[i], i);\n }\n else {\n this.addResourceAt(autoDetectResource(resources[i], options), i);\n }\n }\n };\n /**\n * Destroy this BaseImageResource\n * @override\n */\n AbstractMultiResource.prototype.dispose = function () {\n for (var i = 0, len = this.length; i < len; i++) {\n this.items[i].destroy();\n }\n this.items = null;\n this.itemDirtyIds = null;\n this._load = null;\n };\n /**\n * Set a resource by ID\n *\n * @param {PIXI.resources.Resource} resource\n * @param {number} index - Zero-based index of resource to set\n * @return {PIXI.resources.ArrayResource} Instance for chaining\n */\n AbstractMultiResource.prototype.addResourceAt = function (resource, index) {\n if (!this.items[index]) {\n throw new Error(\"Index \" + index + \" is out of bounds\");\n }\n // Inherit the first resource dimensions\n if (resource.valid && !this.valid) {\n this.resize(resource.width, resource.height);\n }\n this.items[index].setResource(resource);\n return this;\n };\n /**\n * Set the parent base texture\n * @member {PIXI.BaseTexture}\n * @override\n */\n AbstractMultiResource.prototype.bind = function (baseTexture) {\n if (this.baseTexture !== null) {\n throw new Error('Only one base texture per TextureArray is allowed');\n }\n _super.prototype.bind.call(this, baseTexture);\n for (var i = 0; i < this.length; i++) {\n this.items[i].parentTextureArray = baseTexture;\n this.items[i].on('update', baseTexture.update, baseTexture);\n }\n };\n /**\n * Unset the parent base texture\n * @member {PIXI.BaseTexture}\n * @override\n */\n AbstractMultiResource.prototype.unbind = function (baseTexture) {\n _super.prototype.unbind.call(this, baseTexture);\n for (var i = 0; i < this.length; i++) {\n this.items[i].parentTextureArray = null;\n this.items[i].off('update', baseTexture.update, baseTexture);\n }\n };\n /**\n * Load all the resources simultaneously\n * @override\n * @return {Promise} When load is resolved\n */\n AbstractMultiResource.prototype.load = function () {\n var _this = this;\n if (this._load) {\n return this._load;\n }\n var resources = this.items.map(function (item) { return item.resource; }).filter(function (item) { return item; });\n // TODO: also implement load part-by-part strategy\n var promises = resources.map(function (item) { return item.load(); });\n this._load = Promise.all(promises)\n .then(function () {\n var _a = _this.items[0], realWidth = _a.realWidth, realHeight = _a.realHeight;\n _this.resize(realWidth, realHeight);\n return Promise.resolve(_this);\n });\n return this._load;\n };\n return AbstractMultiResource;\n}(Resource));\n\n/**\n * A resource that contains a number of sources.\n *\n * @class\n * @extends PIXI.resources.Resource\n * @memberof PIXI.resources\n * @param {number|Array<*>} source - Number of items in array or the collection\n * of image URLs to use. Can also be resources, image elements, canvas, etc.\n * @param {object} [options] - Options to apply to {@link PIXI.resources.autoDetectResource}\n * @param {number} [options.width] - Width of the resource\n * @param {number} [options.height] - Height of the resource\n */\nvar ArrayResource = /** @class */ (function (_super) {\n __extends(ArrayResource, _super);\n function ArrayResource(source, options) {\n var _this = this;\n var _a = options || {}, width = _a.width, height = _a.height;\n var urls;\n var length;\n if (Array.isArray(source)) {\n urls = source;\n length = source.length;\n }\n else {\n length = source;\n }\n _this = _super.call(this, length, { width: width, height: height }) || this;\n if (urls) {\n _this.initFromArray(urls, options);\n }\n return _this;\n }\n /**\n * Set a baseTexture by ID,\n * ArrayResource just takes resource from it, nothing more\n *\n * @param {PIXI.BaseTexture} baseTexture\n * @param {number} index - Zero-based index of resource to set\n * @return {PIXI.resources.ArrayResource} Instance for chaining\n */\n ArrayResource.prototype.addBaseTextureAt = function (baseTexture, index) {\n if (baseTexture.resource) {\n this.addResourceAt(baseTexture.resource, index);\n }\n else {\n throw new Error('ArrayResource does not support RenderTexture');\n }\n return this;\n };\n /**\n * Add binding\n * @member {PIXI.BaseTexture}\n * @override\n */\n ArrayResource.prototype.bind = function (baseTexture) {\n _super.prototype.bind.call(this, baseTexture);\n baseTexture.target = _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.TARGETS.TEXTURE_2D_ARRAY;\n };\n /**\n * Upload the resources to the GPU.\n * @param {PIXI.Renderer} renderer\n * @param {PIXI.BaseTexture} texture\n * @param {PIXI.GLTexture} glTexture\n * @returns {boolean} whether texture was uploaded\n */\n ArrayResource.prototype.upload = function (renderer, texture, glTexture) {\n var _a = this, length = _a.length, itemDirtyIds = _a.itemDirtyIds, items = _a.items;\n var gl = renderer.gl;\n if (glTexture.dirtyId < 0) {\n gl.texImage3D(gl.TEXTURE_2D_ARRAY, 0, texture.format, this._width, this._height, length, 0, texture.format, texture.type, null);\n }\n for (var i = 0; i < length; i++) {\n var item = items[i];\n if (itemDirtyIds[i] < item.dirtyId) {\n itemDirtyIds[i] = item.dirtyId;\n if (item.valid) {\n gl.texSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, // xoffset\n 0, // yoffset\n i, // zoffset\n item.resource.width, item.resource.height, 1, texture.format, texture.type, item.resource.source);\n }\n }\n }\n return true;\n };\n return ArrayResource;\n}(AbstractMultiResource));\n\n/**\n * Base for all the image/canvas resources\n * @class\n * @extends PIXI.resources.Resource\n * @memberof PIXI.resources\n */\nvar BaseImageResource = /** @class */ (function (_super) {\n __extends(BaseImageResource, _super);\n /**\n * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source\n */\n function BaseImageResource(source) {\n var _this = this;\n var sourceAny = source;\n var width = sourceAny.naturalWidth || sourceAny.videoWidth || sourceAny.width;\n var height = sourceAny.naturalHeight || sourceAny.videoHeight || sourceAny.height;\n _this = _super.call(this, width, height) || this;\n /**\n * The source element\n * @member {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement}\n * @readonly\n */\n _this.source = source;\n /**\n * If set to `true`, will force `texImage2D` over `texSubImage2D` for uploading.\n * Certain types of media (e.g. video) using `texImage2D` is more performant.\n * @member {boolean}\n * @default false\n * @private\n */\n _this.noSubImage = false;\n return _this;\n }\n /**\n * Set cross origin based detecting the url and the crossorigin\n * @protected\n * @param {HTMLElement} element - Element to apply crossOrigin\n * @param {string} url - URL to check\n * @param {boolean|string} [crossorigin=true] - Cross origin value to use\n */\n BaseImageResource.crossOrigin = function (element, url, crossorigin) {\n if (crossorigin === undefined && url.indexOf('data:') !== 0) {\n element.crossOrigin = (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.determineCrossOrigin)(url);\n }\n else if (crossorigin !== false) {\n element.crossOrigin = typeof crossorigin === 'string' ? crossorigin : 'anonymous';\n }\n };\n /**\n * Upload the texture to the GPU.\n * @param {PIXI.Renderer} renderer - Upload to the renderer\n * @param {PIXI.BaseTexture} baseTexture - Reference to parent texture\n * @param {PIXI.GLTexture} glTexture\n * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional)\n * @returns {boolean} true is success\n */\n BaseImageResource.prototype.upload = function (renderer, baseTexture, glTexture, source) {\n var gl = renderer.gl;\n var width = baseTexture.realWidth;\n var height = baseTexture.realHeight;\n source = source || this.source;\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.ALPHA_MODES.UNPACK);\n if (!this.noSubImage\n && baseTexture.target === gl.TEXTURE_2D\n && glTexture.width === width\n && glTexture.height === height) {\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, baseTexture.format, baseTexture.type, source);\n }\n else {\n glTexture.width = width;\n glTexture.height = height;\n gl.texImage2D(baseTexture.target, 0, baseTexture.format, baseTexture.format, baseTexture.type, source);\n }\n return true;\n };\n /**\n * Checks if source width/height was changed, resize can cause extra baseTexture update.\n * Triggers one update in any case.\n */\n BaseImageResource.prototype.update = function () {\n if (this.destroyed) {\n return;\n }\n var source = this.source;\n var width = source.naturalWidth || source.videoWidth || source.width;\n var height = source.naturalHeight || source.videoHeight || source.height;\n this.resize(width, height);\n _super.prototype.update.call(this);\n };\n /**\n * Destroy this BaseImageResource\n * @override\n */\n BaseImageResource.prototype.dispose = function () {\n this.source = null;\n };\n return BaseImageResource;\n}(Resource));\n\n/**\n * @interface OffscreenCanvas\n */\n/**\n * Resource type for HTMLCanvasElement.\n * @class\n * @extends PIXI.resources.BaseImageResource\n * @memberof PIXI.resources\n * @param {HTMLCanvasElement} source - Canvas element to use\n */\nvar CanvasResource = /** @class */ (function (_super) {\n __extends(CanvasResource, _super);\n function CanvasResource() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n /**\n * Used to auto-detect the type of resource.\n *\n * @static\n * @param {HTMLCanvasElement|OffscreenCanvas} source - The source object\n * @return {boolean} `true` if source is HTMLCanvasElement or OffscreenCanvas\n */\n CanvasResource.test = function (source) {\n var OffscreenCanvas = window.OffscreenCanvas;\n // Check for browsers that don't yet support OffscreenCanvas\n if (OffscreenCanvas && source instanceof OffscreenCanvas) {\n return true;\n }\n return source instanceof HTMLCanvasElement;\n };\n return CanvasResource;\n}(BaseImageResource));\n\n/**\n * Resource for a CubeTexture which contains six resources.\n *\n * @class\n * @extends PIXI.resources.ArrayResource\n * @memberof PIXI.resources\n * @param {Array} [source] - Collection of URLs or resources\n * to use as the sides of the cube.\n * @param {object} [options] - ImageResource options\n * @param {number} [options.width] - Width of resource\n * @param {number} [options.height] - Height of resource\n * @param {number} [options.autoLoad=true] - Whether to auto-load resources\n * @param {number} [options.linkBaseTexture=true] - In case BaseTextures are supplied,\n * whether to copy them or use\n */\nvar CubeResource = /** @class */ (function (_super) {\n __extends(CubeResource, _super);\n function CubeResource(source, options) {\n var _this = this;\n var _a = options || {}, width = _a.width, height = _a.height, autoLoad = _a.autoLoad, linkBaseTexture = _a.linkBaseTexture;\n if (source && source.length !== CubeResource.SIDES) {\n throw new Error(\"Invalid length. Got \" + source.length + \", expected 6\");\n }\n _this = _super.call(this, 6, { width: width, height: height }) || this;\n for (var i = 0; i < CubeResource.SIDES; i++) {\n _this.items[i].target = _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + i;\n }\n /**\n * In case BaseTextures are supplied, whether to use same resource or bind baseTexture itself\n * @member {boolean}\n * @protected\n */\n _this.linkBaseTexture = linkBaseTexture !== false;\n if (source) {\n _this.initFromArray(source, options);\n }\n if (autoLoad !== false) {\n _this.load();\n }\n return _this;\n }\n /**\n * Add binding\n *\n * @override\n * @param {PIXI.BaseTexture} baseTexture - parent base texture\n */\n CubeResource.prototype.bind = function (baseTexture) {\n _super.prototype.bind.call(this, baseTexture);\n baseTexture.target = _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.TARGETS.TEXTURE_CUBE_MAP;\n };\n CubeResource.prototype.addBaseTextureAt = function (baseTexture, index, linkBaseTexture) {\n if (linkBaseTexture === undefined) {\n linkBaseTexture = this.linkBaseTexture;\n }\n if (!this.items[index]) {\n throw new Error(\"Index \" + index + \" is out of bounds\");\n }\n if (!this.linkBaseTexture\n || baseTexture.parentTextureArray\n || Object.keys(baseTexture._glTextures).length > 0) {\n // copy mode\n if (baseTexture.resource) {\n this.addResourceAt(baseTexture.resource, index);\n }\n else {\n throw new Error(\"CubeResource does not support copying of renderTexture.\");\n }\n }\n else {\n // link mode, the difficult one!\n baseTexture.target = _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + index;\n baseTexture.parentTextureArray = this.baseTexture;\n this.items[index] = baseTexture;\n }\n if (baseTexture.valid && !this.valid) {\n this.resize(baseTexture.realWidth, baseTexture.realHeight);\n }\n this.items[index] = baseTexture;\n return this;\n };\n /**\n * Upload the resource\n *\n * @returns {boolean} true is success\n */\n CubeResource.prototype.upload = function (renderer, _baseTexture, glTexture) {\n var dirty = this.itemDirtyIds;\n for (var i = 0; i < CubeResource.SIDES; i++) {\n var side = this.items[i];\n if (dirty[i] < side.dirtyId) {\n if (side.valid && side.resource) {\n side.resource.upload(renderer, side, glTexture);\n dirty[i] = side.dirtyId;\n }\n else if (dirty[i] < -1) {\n // either item is not valid yet, either its a renderTexture\n // allocate the memory\n renderer.gl.texImage2D(side.target, 0, glTexture.internalFormat, _baseTexture.realWidth, _baseTexture.realHeight, 0, _baseTexture.format, glTexture.type, null);\n dirty[i] = -1;\n }\n }\n }\n return true;\n };\n /**\n * Used to auto-detect the type of resource.\n *\n * @static\n * @param {object} source - The source object\n * @return {boolean} `true` if source is an array of 6 elements\n */\n CubeResource.test = function (source) {\n return Array.isArray(source) && source.length === CubeResource.SIDES;\n };\n /**\n * Number of texture sides to store for CubeResources\n *\n * @name PIXI.resources.CubeResource.SIDES\n * @static\n * @member {number}\n * @default 6\n */\n CubeResource.SIDES = 6;\n return CubeResource;\n}(AbstractMultiResource));\n\n/**\n * Resource type for HTMLImageElement.\n * @class\n * @extends PIXI.resources.BaseImageResource\n * @memberof PIXI.resources\n */\nvar ImageResource = /** @class */ (function (_super) {\n __extends(ImageResource, _super);\n /**\n * @param {HTMLImageElement|string} source - image source or URL\n * @param {object} [options]\n * @param {boolean} [options.autoLoad=true] - start loading process\n * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - whether its required to create\n * a bitmap before upload\n * @param {boolean} [options.crossorigin=true] - Load image using cross origin\n * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Premultiply image alpha in bitmap\n */\n function ImageResource(source, options) {\n var _this = this;\n options = options || {};\n if (!(source instanceof HTMLImageElement)) {\n var imageElement = new Image();\n BaseImageResource.crossOrigin(imageElement, source, options.crossorigin);\n imageElement.src = source;\n source = imageElement;\n }\n _this = _super.call(this, source) || this;\n // FireFox 68, and possibly other versions, seems like setting the HTMLImageElement#width and #height\n // to non-zero values before its loading completes if images are in a cache.\n // Because of this, need to set the `_width` and the `_height` to zero to avoid uploading incomplete images.\n // Please refer to the issue #5968 (https://github.com/pixijs/pixi.js/issues/5968).\n if (!source.complete && !!_this._width && !!_this._height) {\n _this._width = 0;\n _this._height = 0;\n }\n /**\n * URL of the image source\n * @member {string}\n */\n _this.url = source.src;\n /**\n * When process is completed\n * @member {Promise}\n * @private\n */\n _this._process = null;\n /**\n * If the image should be disposed after upload\n * @member {boolean}\n * @default false\n */\n _this.preserveBitmap = false;\n /**\n * If capable, convert the image using createImageBitmap API\n * @member {boolean}\n * @default PIXI.settings.CREATE_IMAGE_BITMAP\n */\n _this.createBitmap = (options.createBitmap !== undefined\n ? options.createBitmap : _pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.CREATE_IMAGE_BITMAP) && !!window.createImageBitmap;\n /**\n * Controls texture alphaMode field\n * Copies from options\n * Default is `null`, copies option from baseTexture\n *\n * @member {PIXI.ALPHA_MODES|null}\n * @readonly\n */\n _this.alphaMode = typeof options.alphaMode === 'number' ? options.alphaMode : null;\n if (options.premultiplyAlpha !== undefined) {\n // triggers deprecation\n _this.premultiplyAlpha = options.premultiplyAlpha;\n }\n /**\n * The ImageBitmap element created for HTMLImageElement\n * @member {ImageBitmap}\n * @default null\n */\n _this.bitmap = null;\n /**\n * Promise when loading\n * @member {Promise}\n * @private\n * @default null\n */\n _this._load = null;\n if (options.autoLoad !== false) {\n _this.load();\n }\n return _this;\n }\n /**\n * returns a promise when image will be loaded and processed\n *\n * @param {boolean} [createBitmap] - whether process image into bitmap\n * @returns {Promise}\n */\n ImageResource.prototype.load = function (createBitmap) {\n var _this = this;\n if (this._load) {\n return this._load;\n }\n if (createBitmap !== undefined) {\n this.createBitmap = createBitmap;\n }\n this._load = new Promise(function (resolve, reject) {\n var source = _this.source;\n _this.url = source.src;\n var completed = function () {\n if (_this.destroyed) {\n return;\n }\n source.onload = null;\n source.onerror = null;\n _this.resize(source.width, source.height);\n _this._load = null;\n if (_this.createBitmap) {\n resolve(_this.process());\n }\n else {\n resolve(_this);\n }\n };\n if (source.complete && source.src) {\n completed();\n }\n else {\n source.onload = completed;\n source.onerror = function (event) {\n // Avoids Promise freezing when resource broken\n reject(event);\n _this.onError.emit(event);\n };\n }\n });\n return this._load;\n };\n /**\n * Called when we need to convert image into BitmapImage.\n * Can be called multiple times, real promise is cached inside.\n *\n * @returns {Promise} cached promise to fill that bitmap\n */\n ImageResource.prototype.process = function () {\n var _this = this;\n var source = this.source;\n if (this._process !== null) {\n return this._process;\n }\n if (this.bitmap !== null || !window.createImageBitmap) {\n return Promise.resolve(this);\n }\n this._process = window.createImageBitmap(source, 0, 0, source.width, source.height, {\n premultiplyAlpha: this.alphaMode === _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.ALPHA_MODES.UNPACK ? 'premultiply' : 'none',\n })\n .then(function (bitmap) {\n if (_this.destroyed) {\n return Promise.reject();\n }\n _this.bitmap = bitmap;\n _this.update();\n _this._process = null;\n return Promise.resolve(_this);\n });\n return this._process;\n };\n /**\n * Upload the image resource to GPU.\n *\n * @param {PIXI.Renderer} renderer - Renderer to upload to\n * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource\n * @param {PIXI.GLTexture} glTexture - GLTexture to use\n * @returns {boolean} true is success\n */\n ImageResource.prototype.upload = function (renderer, baseTexture, glTexture) {\n if (typeof this.alphaMode === 'number') {\n // bitmap stores unpack premultiply flag, we dont have to notify texImage2D about it\n baseTexture.alphaMode = this.alphaMode;\n }\n if (!this.createBitmap) {\n return _super.prototype.upload.call(this, renderer, baseTexture, glTexture);\n }\n if (!this.bitmap) {\n // yeah, ignore the output\n this.process();\n if (!this.bitmap) {\n return false;\n }\n }\n _super.prototype.upload.call(this, renderer, baseTexture, glTexture, this.bitmap);\n if (!this.preserveBitmap) {\n // checks if there are other renderers that possibly need this bitmap\n var flag = true;\n var glTextures = baseTexture._glTextures;\n for (var key in glTextures) {\n var otherTex = glTextures[key];\n if (otherTex !== glTexture && otherTex.dirtyId !== baseTexture.dirtyId) {\n flag = false;\n break;\n }\n }\n if (flag) {\n if (this.bitmap.close) {\n this.bitmap.close();\n }\n this.bitmap = null;\n }\n }\n return true;\n };\n /**\n * Destroys this texture\n * @override\n */\n ImageResource.prototype.dispose = function () {\n this.source.onload = null;\n this.source.onerror = null;\n _super.prototype.dispose.call(this);\n if (this.bitmap) {\n this.bitmap.close();\n this.bitmap = null;\n }\n this._process = null;\n this._load = null;\n };\n /**\n * Used to auto-detect the type of resource.\n *\n * @static\n * @param {string|HTMLImageElement} source - The source object\n * @return {boolean} `true` if source is string or HTMLImageElement\n */\n ImageResource.test = function (source) {\n return typeof source === 'string' || source instanceof HTMLImageElement;\n };\n return ImageResource;\n}(BaseImageResource));\n\n/**\n * Resource type for SVG elements and graphics.\n * @class\n * @extends PIXI.resources.BaseImageResource\n * @memberof PIXI.resources\n * @param {string} source - Base64 encoded SVG element or URL for SVG file.\n * @param {object} [options] - Options to use\n * @param {number} [options.scale=1] - Scale to apply to SVG. Overridden by...\n * @param {number} [options.width] - Rasterize SVG this wide. Aspect ratio preserved if height not specified.\n * @param {number} [options.height] - Rasterize SVG this high. Aspect ratio preserved if width not specified.\n * @param {boolean} [options.autoLoad=true] - Start loading right away.\n */\nvar SVGResource = /** @class */ (function (_super) {\n __extends(SVGResource, _super);\n function SVGResource(sourceBase64, options) {\n var _this = this;\n options = options || {};\n _this = _super.call(this, document.createElement('canvas')) || this;\n _this._width = 0;\n _this._height = 0;\n /**\n * Base64 encoded SVG element or URL for SVG file\n * @readonly\n * @member {string}\n */\n _this.svg = sourceBase64;\n /**\n * The source scale to apply when rasterizing on load\n * @readonly\n * @member {number}\n */\n _this.scale = options.scale || 1;\n /**\n * A width override for rasterization on load\n * @readonly\n * @member {number}\n */\n _this._overrideWidth = options.width;\n /**\n * A height override for rasterization on load\n * @readonly\n * @member {number}\n */\n _this._overrideHeight = options.height;\n /**\n * Call when completely loaded\n * @private\n * @member {function}\n */\n _this._resolve = null;\n /**\n * Cross origin value to use\n * @private\n * @member {boolean|string}\n */\n _this._crossorigin = options.crossorigin;\n /**\n * Promise when loading\n * @member {Promise}\n * @private\n * @default null\n */\n _this._load = null;\n if (options.autoLoad !== false) {\n _this.load();\n }\n return _this;\n }\n SVGResource.prototype.load = function () {\n var _this = this;\n if (this._load) {\n return this._load;\n }\n this._load = new Promise(function (resolve) {\n // Save this until after load is finished\n _this._resolve = function () {\n _this.resize(_this.source.width, _this.source.height);\n resolve(_this);\n };\n // Convert SVG inline string to data-uri\n if ((/^\\]*(?:\\s(width|height)=('|\")(\\d*(?:\\.\\d+)?)(?:px)?('|\"))[^>]*(?:\\s(width|height)=('|\")(\\d*(?:\\.\\d+)?)(?:px)?('|\"))[^>]*>/i; // eslint-disable-line max-len\n return SVGResource;\n}(BaseImageResource));\n\n/**\n * Resource type for HTMLVideoElement.\n * @class\n * @extends PIXI.resources.BaseImageResource\n * @memberof PIXI.resources\n * @param {HTMLVideoElement|object|string|Array} source - Video element to use.\n * @param {object} [options] - Options to use\n * @param {boolean} [options.autoLoad=true] - Start loading the video immediately\n * @param {boolean} [options.autoPlay=true] - Start playing video immediately\n * @param {number} [options.updateFPS=0] - How many times a second to update the texture from the video.\n * Leave at 0 to update at every render.\n * @param {boolean} [options.crossorigin=true] - Load image using cross origin\n */\nvar VideoResource = /** @class */ (function (_super) {\n __extends(VideoResource, _super);\n function VideoResource(source, options) {\n var _this = this;\n options = options || {};\n if (!(source instanceof HTMLVideoElement)) {\n var videoElement = document.createElement('video');\n // workaround for https://github.com/pixijs/pixi.js/issues/5996\n videoElement.setAttribute('preload', 'auto');\n videoElement.setAttribute('webkit-playsinline', '');\n videoElement.setAttribute('playsinline', '');\n if (typeof source === 'string') {\n source = [source];\n }\n var firstSrc = source[0].src || source[0];\n BaseImageResource.crossOrigin(videoElement, firstSrc, options.crossorigin);\n // array of objects or strings\n for (var i = 0; i < source.length; ++i) {\n var sourceElement = document.createElement('source');\n var _a = source[i], src = _a.src, mime = _a.mime;\n src = src || source[i];\n var baseSrc = src.split('?').shift().toLowerCase();\n var ext = baseSrc.substr(baseSrc.lastIndexOf('.') + 1);\n mime = mime || VideoResource.MIME_TYPES[ext] || \"video/\" + ext;\n sourceElement.src = src;\n sourceElement.type = mime;\n videoElement.appendChild(sourceElement);\n }\n // Override the source\n source = videoElement;\n }\n _this = _super.call(this, source) || this;\n _this.noSubImage = true;\n /**\n * `true` to use PIXI.Ticker.shared to auto update the base texture.\n *\n * @type {boolean}\n * @default true\n * @private\n */\n _this._autoUpdate = true;\n /**\n * `true` if the instance is currently connected to PIXI.Ticker.shared to auto update the base texture.\n *\n * @type {boolean}\n * @default false\n * @private\n */\n _this._isConnectedToTicker = false;\n _this._updateFPS = options.updateFPS || 0;\n _this._msToNextUpdate = 0;\n /**\n * When set to true will automatically play videos used by this texture once\n * they are loaded. If false, it will not modify the playing state.\n *\n * @member {boolean}\n * @default true\n */\n _this.autoPlay = options.autoPlay !== false;\n /**\n * Promise when loading\n * @member {Promise}\n * @private\n * @default null\n */\n _this._load = null;\n /**\n * Callback when completed with load.\n * @member {function}\n * @private\n */\n _this._resolve = null;\n // Bind for listeners\n _this._onCanPlay = _this._onCanPlay.bind(_this);\n _this._onError = _this._onError.bind(_this);\n if (options.autoLoad !== false) {\n _this.load();\n }\n return _this;\n }\n /**\n * Trigger updating of the texture\n *\n * @param {number} [deltaTime=0] - time delta since last tick\n */\n VideoResource.prototype.update = function (_deltaTime) {\n if (_deltaTime === void 0) { _deltaTime = 0; }\n if (!this.destroyed) {\n // account for if video has had its playbackRate changed\n var elapsedMS = _pixi_ticker__WEBPACK_IMPORTED_MODULE_4__.Ticker.shared.elapsedMS * this.source.playbackRate;\n this._msToNextUpdate = Math.floor(this._msToNextUpdate - elapsedMS);\n if (!this._updateFPS || this._msToNextUpdate <= 0) {\n _super.prototype.update.call(this);\n this._msToNextUpdate = this._updateFPS ? Math.floor(1000 / this._updateFPS) : 0;\n }\n }\n };\n /**\n * Start preloading the video resource.\n *\n * @protected\n * @return {Promise} Handle the validate event\n */\n VideoResource.prototype.load = function () {\n var _this = this;\n if (this._load) {\n return this._load;\n }\n var source = this.source;\n if ((source.readyState === source.HAVE_ENOUGH_DATA || source.readyState === source.HAVE_FUTURE_DATA)\n && source.width && source.height) {\n source.complete = true;\n }\n source.addEventListener('play', this._onPlayStart.bind(this));\n source.addEventListener('pause', this._onPlayStop.bind(this));\n if (!this._isSourceReady()) {\n source.addEventListener('canplay', this._onCanPlay);\n source.addEventListener('canplaythrough', this._onCanPlay);\n source.addEventListener('error', this._onError, true);\n }\n else {\n this._onCanPlay();\n }\n this._load = new Promise(function (resolve) {\n if (_this.valid) {\n resolve(_this);\n }\n else {\n _this._resolve = resolve;\n source.load();\n }\n });\n return this._load;\n };\n /**\n * Handle video error events.\n *\n * @private\n */\n VideoResource.prototype._onError = function (event) {\n this.source.removeEventListener('error', this._onError, true);\n this.onError.emit(event);\n };\n /**\n * Returns true if the underlying source is playing.\n *\n * @private\n * @return {boolean} True if playing.\n */\n VideoResource.prototype._isSourcePlaying = function () {\n var source = this.source;\n return (source.currentTime > 0 && source.paused === false && source.ended === false && source.readyState > 2);\n };\n /**\n * Returns true if the underlying source is ready for playing.\n *\n * @private\n * @return {boolean} True if ready.\n */\n VideoResource.prototype._isSourceReady = function () {\n var source = this.source;\n return source.readyState === 3 || source.readyState === 4;\n };\n /**\n * Runs the update loop when the video is ready to play\n *\n * @private\n */\n VideoResource.prototype._onPlayStart = function () {\n // Just in case the video has not received its can play even yet..\n if (!this.valid) {\n this._onCanPlay();\n }\n if (this.autoUpdate && !this._isConnectedToTicker) {\n _pixi_ticker__WEBPACK_IMPORTED_MODULE_4__.Ticker.shared.add(this.update, this);\n this._isConnectedToTicker = true;\n }\n };\n /**\n * Fired when a pause event is triggered, stops the update loop\n *\n * @private\n */\n VideoResource.prototype._onPlayStop = function () {\n if (this._isConnectedToTicker) {\n _pixi_ticker__WEBPACK_IMPORTED_MODULE_4__.Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n };\n /**\n * Fired when the video is loaded and ready to play\n *\n * @private\n */\n VideoResource.prototype._onCanPlay = function () {\n var source = this.source;\n source.removeEventListener('canplay', this._onCanPlay);\n source.removeEventListener('canplaythrough', this._onCanPlay);\n var valid = this.valid;\n this.resize(source.videoWidth, source.videoHeight);\n // prevent multiple loaded dispatches..\n if (!valid && this._resolve) {\n this._resolve(this);\n this._resolve = null;\n }\n if (this._isSourcePlaying()) {\n this._onPlayStart();\n }\n else if (this.autoPlay) {\n source.play();\n }\n };\n /**\n * Destroys this texture\n * @override\n */\n VideoResource.prototype.dispose = function () {\n if (this._isConnectedToTicker) {\n _pixi_ticker__WEBPACK_IMPORTED_MODULE_4__.Ticker.shared.remove(this.update, this);\n }\n var source = this.source;\n if (source) {\n source.removeEventListener('error', this._onError, true);\n source.pause();\n source.src = '';\n source.load();\n }\n _super.prototype.dispose.call(this);\n };\n Object.defineProperty(VideoResource.prototype, \"autoUpdate\", {\n /**\n * Should the base texture automatically update itself, set to true by default\n *\n * @member {boolean}\n */\n get: function () {\n return this._autoUpdate;\n },\n set: function (value) {\n if (value !== this._autoUpdate) {\n this._autoUpdate = value;\n if (!this._autoUpdate && this._isConnectedToTicker) {\n _pixi_ticker__WEBPACK_IMPORTED_MODULE_4__.Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n else if (this._autoUpdate && !this._isConnectedToTicker && this._isSourcePlaying()) {\n _pixi_ticker__WEBPACK_IMPORTED_MODULE_4__.Ticker.shared.add(this.update, this);\n this._isConnectedToTicker = true;\n }\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(VideoResource.prototype, \"updateFPS\", {\n /**\n * How many times a second to update the texture from the video. Leave at 0 to update at every render.\n * A lower fps can help performance, as updating the texture at 60fps on a 30ps video may not be efficient.\n *\n * @member {number}\n */\n get: function () {\n return this._updateFPS;\n },\n set: function (value) {\n if (value !== this._updateFPS) {\n this._updateFPS = value;\n }\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Used to auto-detect the type of resource.\n *\n * @static\n * @param {*} source - The source object\n * @param {string} extension - The extension of source, if set\n * @return {boolean} `true` if video source\n */\n VideoResource.test = function (source, extension) {\n return (source instanceof HTMLVideoElement)\n || VideoResource.TYPES.indexOf(extension) > -1;\n };\n /**\n * List of common video file extensions supported by VideoResource.\n * @constant\n * @member {Array}\n * @static\n * @readonly\n */\n VideoResource.TYPES = ['mp4', 'm4v', 'webm', 'ogg', 'ogv', 'h264', 'avi', 'mov'];\n /**\n * Map of video MIME types that can't be directly derived from file extensions.\n * @constant\n * @member {object}\n * @static\n * @readonly\n */\n VideoResource.MIME_TYPES = {\n ogv: 'video/ogg',\n mov: 'video/quicktime',\n m4v: 'video/mp4',\n };\n return VideoResource;\n}(BaseImageResource));\n\n/**\n * Resource type for ImageBitmap.\n * @class\n * @extends PIXI.resources.BaseImageResource\n * @memberof PIXI.resources\n * @param {ImageBitmap} source - Image element to use\n */\nvar ImageBitmapResource = /** @class */ (function (_super) {\n __extends(ImageBitmapResource, _super);\n function ImageBitmapResource() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n /**\n * Used to auto-detect the type of resource.\n *\n * @static\n * @param {ImageBitmap} source - The source object\n * @return {boolean} `true` if source is an ImageBitmap\n */\n ImageBitmapResource.test = function (source) {\n return !!window.createImageBitmap && source instanceof ImageBitmap;\n };\n return ImageBitmapResource;\n}(BaseImageResource));\n\nINSTALLED.push(ImageResource, ImageBitmapResource, CanvasResource, VideoResource, SVGResource, BufferResource, CubeResource, ArrayResource);\n\nvar index = ({\n Resource: Resource,\n BaseImageResource: BaseImageResource,\n INSTALLED: INSTALLED,\n autoDetectResource: autoDetectResource,\n AbstractMultiResource: AbstractMultiResource,\n ArrayResource: ArrayResource,\n BufferResource: BufferResource,\n CanvasResource: CanvasResource,\n CubeResource: CubeResource,\n ImageResource: ImageResource,\n SVGResource: SVGResource,\n VideoResource: VideoResource,\n ImageBitmapResource: ImageBitmapResource\n});\n\n/**\n * System is a base class used for extending systems used by the {@link PIXI.Renderer}\n *\n * @see PIXI.Renderer#addSystem\n * @class\n * @memberof PIXI\n */\nvar System = /** @class */ (function () {\n /**\n * @param {PIXI.Renderer} renderer - The renderer this manager works for.\n */\n function System(renderer) {\n /**\n * The renderer this manager works for.\n *\n * @member {PIXI.Renderer}\n */\n this.renderer = renderer;\n }\n /**\n * Generic destroy methods to be overridden by the subclass\n */\n System.prototype.destroy = function () {\n this.renderer = null;\n };\n return System;\n}());\n\n/**\n * Resource type for DepthTexture.\n * @class\n * @extends PIXI.resources.BufferResource\n * @memberof PIXI.resources\n */\nvar DepthResource = /** @class */ (function (_super) {\n __extends(DepthResource, _super);\n function DepthResource() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n /**\n * Upload the texture to the GPU.\n * @param {PIXI.Renderer} renderer - Upload to the renderer\n * @param {PIXI.BaseTexture} baseTexture - Reference to parent texture\n * @param {PIXI.GLTexture} glTexture - glTexture\n * @returns {boolean} true is success\n */\n DepthResource.prototype.upload = function (renderer, baseTexture, glTexture) {\n var gl = renderer.gl;\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.ALPHA_MODES.UNPACK);\n if (glTexture.width === baseTexture.width && glTexture.height === baseTexture.height) {\n gl.texSubImage2D(baseTexture.target, 0, 0, 0, baseTexture.width, baseTexture.height, baseTexture.format, baseTexture.type, this.data);\n }\n else {\n glTexture.width = baseTexture.width;\n glTexture.height = baseTexture.height;\n gl.texImage2D(baseTexture.target, 0, \n // gl.DEPTH_COMPONENT16 Needed for depth to render properly in webgl2.0\n renderer.context.webGLVersion === 1 ? gl.DEPTH_COMPONENT : gl.DEPTH_COMPONENT16, baseTexture.width, baseTexture.height, 0, baseTexture.format, baseTexture.type, this.data);\n }\n return true;\n };\n return DepthResource;\n}(BufferResource));\n\n/**\n * Frame buffer used by the BaseRenderTexture\n *\n * @class\n * @memberof PIXI\n */\nvar Framebuffer = /** @class */ (function () {\n /**\n * @param {number} width - Width of the frame buffer\n * @param {number} height - Height of the frame buffer\n */\n function Framebuffer(width, height) {\n /**\n * Width of framebuffer in pixels\n * @member {number}\n */\n this.width = Math.ceil(width || 100);\n /**\n * Height of framebuffer in pixels\n * @member {number}\n */\n this.height = Math.ceil(height || 100);\n this.stencil = false;\n this.depth = false;\n this.dirtyId = 0;\n this.dirtyFormat = 0;\n this.dirtySize = 0;\n this.depthTexture = null;\n this.colorTextures = [];\n this.glFramebuffers = {};\n this.disposeRunner = new _pixi_runner__WEBPACK_IMPORTED_MODULE_3__.Runner('disposeFramebuffer');\n /**\n * Desired number of samples for antialiasing. 0 means AA should not be used.\n *\n * Experimental WebGL2 feature, allows to use antialiasing in individual renderTextures.\n * Antialiasing is the same as for main buffer with renderer `antialias:true` options.\n * Seriously affects GPU memory consumption and GPU performance.\n *\n *```js\n * renderTexture.framebuffer.multisample = PIXI.MSAA_QUALITY.HIGH;\n * //...\n * renderer.render(renderTexture, myContainer);\n * renderer.framebuffer.blit(); // copies data from MSAA framebuffer to texture\n * ```\n *\n * @member {PIXI.MSAA_QUALITY}\n * @default PIXI.MSAA_QUALITY.NONE\n */\n this.multisample = _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.MSAA_QUALITY.NONE;\n }\n Object.defineProperty(Framebuffer.prototype, \"colorTexture\", {\n /**\n * Reference to the colorTexture.\n *\n * @member {PIXI.BaseTexture[]}\n * @readonly\n */\n get: function () {\n return this.colorTextures[0];\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Add texture to the colorTexture array\n *\n * @param {number} [index=0] - Index of the array to add the texture to\n * @param {PIXI.BaseTexture} [texture] - Texture to add to the array\n */\n Framebuffer.prototype.addColorTexture = function (index, texture) {\n if (index === void 0) { index = 0; }\n // TODO add some validation to the texture - same width / height etc?\n this.colorTextures[index] = texture || new BaseTexture(null, {\n scaleMode: _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.SCALE_MODES.NEAREST,\n resolution: 1,\n mipmap: _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.MIPMAP_MODES.OFF,\n width: this.width,\n height: this.height,\n });\n this.dirtyId++;\n this.dirtyFormat++;\n return this;\n };\n /**\n * Add a depth texture to the frame buffer\n *\n * @param {PIXI.BaseTexture} [texture] - Texture to add\n */\n Framebuffer.prototype.addDepthTexture = function (texture) {\n /* eslint-disable max-len */\n this.depthTexture = texture || new BaseTexture(new DepthResource(null, { width: this.width, height: this.height }), {\n scaleMode: _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.SCALE_MODES.NEAREST,\n resolution: 1,\n width: this.width,\n height: this.height,\n mipmap: _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.MIPMAP_MODES.OFF,\n format: _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.FORMATS.DEPTH_COMPONENT,\n type: _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.TYPES.UNSIGNED_SHORT,\n });\n this.dirtyId++;\n this.dirtyFormat++;\n return this;\n };\n /**\n * Enable depth on the frame buffer\n */\n Framebuffer.prototype.enableDepth = function () {\n this.depth = true;\n this.dirtyId++;\n this.dirtyFormat++;\n return this;\n };\n /**\n * Enable stencil on the frame buffer\n */\n Framebuffer.prototype.enableStencil = function () {\n this.stencil = true;\n this.dirtyId++;\n this.dirtyFormat++;\n return this;\n };\n /**\n * Resize the frame buffer\n *\n * @param {number} width - Width of the frame buffer to resize to\n * @param {number} height - Height of the frame buffer to resize to\n */\n Framebuffer.prototype.resize = function (width, height) {\n width = Math.ceil(width);\n height = Math.ceil(height);\n if (width === this.width && height === this.height)\n { return; }\n this.width = width;\n this.height = height;\n this.dirtyId++;\n this.dirtySize++;\n for (var i = 0; i < this.colorTextures.length; i++) {\n var texture = this.colorTextures[i];\n var resolution = texture.resolution;\n // take into acount the fact the texture may have a different resolution..\n texture.setSize(width / resolution, height / resolution);\n }\n if (this.depthTexture) {\n var resolution = this.depthTexture.resolution;\n this.depthTexture.setSize(width / resolution, height / resolution);\n }\n };\n /**\n * Disposes WebGL resources that are connected to this geometry\n */\n Framebuffer.prototype.dispose = function () {\n this.disposeRunner.emit(this, false);\n };\n /**\n * Destroys and removes the depth texture added to this framebuffer.\n */\n Framebuffer.prototype.destroyDepthTexture = function () {\n if (this.depthTexture) {\n this.depthTexture.destroy();\n this.depthTexture = null;\n ++this.dirtyId;\n ++this.dirtyFormat;\n }\n };\n return Framebuffer;\n}());\n\n/**\n * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it.\n *\n * __Hint__: All DisplayObjects (i.e. Sprites) that render to a BaseRenderTexture should be preloaded\n * otherwise black rectangles will be drawn instead.\n *\n * A BaseRenderTexture takes a snapshot of any Display Object given to its render method. The position\n * and rotation of the given Display Objects is ignored. For example:\n *\n * ```js\n * let renderer = PIXI.autoDetectRenderer();\n * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 800, height: 600 });\n * let renderTexture = new PIXI.RenderTexture(baseRenderTexture);\n * let sprite = PIXI.Sprite.from(\"spinObj_01.png\");\n *\n * sprite.position.x = 800/2;\n * sprite.position.y = 600/2;\n * sprite.anchor.x = 0.5;\n * sprite.anchor.y = 0.5;\n *\n * renderer.render(sprite, renderTexture);\n * ```\n *\n * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0\n * you can clear the transform\n *\n * ```js\n *\n * sprite.setTransform()\n *\n * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 100, height: 100 });\n * let renderTexture = new PIXI.RenderTexture(baseRenderTexture);\n *\n * renderer.render(sprite, renderTexture); // Renders to center of RenderTexture\n * ```\n *\n * @class\n * @extends PIXI.BaseTexture\n * @memberof PIXI\n */\nvar BaseRenderTexture = /** @class */ (function (_super) {\n __extends(BaseRenderTexture, _super);\n /**\n * @param {object} [options]\n * @param {number} [options.width=100] - The width of the base render texture.\n * @param {number} [options.height=100] - The height of the base render texture.\n * @param {PIXI.SCALE_MODES} [options.scaleMode] - See {@link PIXI.SCALE_MODES} for possible values.\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the texture being generated.\n */\n function BaseRenderTexture(options) {\n var _this = this;\n if (typeof options === 'number') {\n /* eslint-disable prefer-rest-params */\n // Backward compatibility of signature\n var width_1 = arguments[0];\n var height_1 = arguments[1];\n var scaleMode = arguments[2];\n var resolution = arguments[3];\n options = { width: width_1, height: height_1, scaleMode: scaleMode, resolution: resolution };\n /* eslint-enable prefer-rest-params */\n }\n _this = _super.call(this, null, options) || this;\n var _a = options || {}, width = _a.width, height = _a.height;\n // Set defaults\n _this.mipmap = 0;\n _this.width = Math.ceil(width) || 100;\n _this.height = Math.ceil(height) || 100;\n _this.valid = true;\n _this.clearColor = [0, 0, 0, 0];\n _this.framebuffer = new Framebuffer(_this.width * _this.resolution, _this.height * _this.resolution)\n .addColorTexture(0, _this);\n // TODO - could this be added the systems?\n /**\n * The data structure for the stencil masks.\n *\n * @member {PIXI.MaskData[]}\n */\n _this.maskStack = [];\n /**\n * The data structure for the filters.\n *\n * @member {Object[]}\n */\n _this.filterStack = [{}];\n return _this;\n }\n /**\n * Resizes the BaseRenderTexture.\n *\n * @param {number} width - The width to resize to.\n * @param {number} height - The height to resize to.\n */\n BaseRenderTexture.prototype.resize = function (width, height) {\n width = Math.ceil(width);\n height = Math.ceil(height);\n this.framebuffer.resize(width * this.resolution, height * this.resolution);\n };\n /**\n * Frees the texture and framebuffer from WebGL memory without destroying this texture object.\n * This means you can still use the texture later which will upload it to GPU\n * memory again.\n *\n * @fires PIXI.BaseTexture#dispose\n */\n BaseRenderTexture.prototype.dispose = function () {\n this.framebuffer.dispose();\n _super.prototype.dispose.call(this);\n };\n /**\n * Destroys this texture.\n */\n BaseRenderTexture.prototype.destroy = function () {\n _super.prototype.destroy.call(this);\n this.framebuffer.destroyDepthTexture();\n this.framebuffer = null;\n };\n return BaseRenderTexture;\n}(BaseTexture));\n\n/**\n * Stores a texture's frame in UV coordinates, in\n * which everything lies in the rectangle `[(0,0), (1,0),\n * (1,1), (0,1)]`.\n *\n * | Corner | Coordinates |\n * |--------------|-------------|\n * | Top-Left | `(x0,y0)` |\n * | Top-Right | `(x1,y1)` |\n * | Bottom-Right | `(x2,y2)` |\n * | Bottom-Left | `(x3,y3)` |\n *\n * @class\n * @protected\n * @memberof PIXI\n */\nvar TextureUvs = /** @class */ (function () {\n function TextureUvs() {\n /**\n * X-component of top-left corner `(x0,y0)`.\n *\n * @member {number}\n */\n this.x0 = 0;\n /**\n * Y-component of top-left corner `(x0,y0)`.\n *\n * @member {number}\n */\n this.y0 = 0;\n /**\n * X-component of top-right corner `(x1,y1)`.\n *\n * @member {number}\n */\n this.x1 = 1;\n /**\n * Y-component of top-right corner `(x1,y1)`.\n *\n * @member {number}\n */\n this.y1 = 0;\n /**\n * X-component of bottom-right corner `(x2,y2)`.\n *\n * @member {number}\n */\n this.x2 = 1;\n /**\n * Y-component of bottom-right corner `(x2,y2)`.\n *\n * @member {number}\n */\n this.y2 = 1;\n /**\n * X-component of bottom-left corner `(x3,y3)`.\n *\n * @member {number}\n */\n this.x3 = 0;\n /**\n * Y-component of bottom-right corner `(x3,y3)`.\n *\n * @member {number}\n */\n this.y3 = 1;\n this.uvsFloat32 = new Float32Array(8);\n }\n /**\n * Sets the texture Uvs based on the given frame information.\n *\n * @protected\n * @param {PIXI.Rectangle} frame - The frame of the texture\n * @param {PIXI.Rectangle} baseFrame - The base frame of the texture\n * @param {number} rotate - Rotation of frame, see {@link PIXI.groupD8}\n */\n TextureUvs.prototype.set = function (frame, baseFrame, rotate) {\n var tw = baseFrame.width;\n var th = baseFrame.height;\n if (rotate) {\n // width and height div 2 div baseFrame size\n var w2 = frame.width / 2 / tw;\n var h2 = frame.height / 2 / th;\n // coordinates of center\n var cX = (frame.x / tw) + w2;\n var cY = (frame.y / th) + h2;\n rotate = _pixi_math__WEBPACK_IMPORTED_MODULE_5__.groupD8.add(rotate, _pixi_math__WEBPACK_IMPORTED_MODULE_5__.groupD8.NW); // NW is top-left corner\n this.x0 = cX + (w2 * _pixi_math__WEBPACK_IMPORTED_MODULE_5__.groupD8.uX(rotate));\n this.y0 = cY + (h2 * _pixi_math__WEBPACK_IMPORTED_MODULE_5__.groupD8.uY(rotate));\n rotate = _pixi_math__WEBPACK_IMPORTED_MODULE_5__.groupD8.add(rotate, 2); // rotate 90 degrees clockwise\n this.x1 = cX + (w2 * _pixi_math__WEBPACK_IMPORTED_MODULE_5__.groupD8.uX(rotate));\n this.y1 = cY + (h2 * _pixi_math__WEBPACK_IMPORTED_MODULE_5__.groupD8.uY(rotate));\n rotate = _pixi_math__WEBPACK_IMPORTED_MODULE_5__.groupD8.add(rotate, 2);\n this.x2 = cX + (w2 * _pixi_math__WEBPACK_IMPORTED_MODULE_5__.groupD8.uX(rotate));\n this.y2 = cY + (h2 * _pixi_math__WEBPACK_IMPORTED_MODULE_5__.groupD8.uY(rotate));\n rotate = _pixi_math__WEBPACK_IMPORTED_MODULE_5__.groupD8.add(rotate, 2);\n this.x3 = cX + (w2 * _pixi_math__WEBPACK_IMPORTED_MODULE_5__.groupD8.uX(rotate));\n this.y3 = cY + (h2 * _pixi_math__WEBPACK_IMPORTED_MODULE_5__.groupD8.uY(rotate));\n }\n else {\n this.x0 = frame.x / tw;\n this.y0 = frame.y / th;\n this.x1 = (frame.x + frame.width) / tw;\n this.y1 = frame.y / th;\n this.x2 = (frame.x + frame.width) / tw;\n this.y2 = (frame.y + frame.height) / th;\n this.x3 = frame.x / tw;\n this.y3 = (frame.y + frame.height) / th;\n }\n this.uvsFloat32[0] = this.x0;\n this.uvsFloat32[1] = this.y0;\n this.uvsFloat32[2] = this.x1;\n this.uvsFloat32[3] = this.y1;\n this.uvsFloat32[4] = this.x2;\n this.uvsFloat32[5] = this.y2;\n this.uvsFloat32[6] = this.x3;\n this.uvsFloat32[7] = this.y3;\n };\n return TextureUvs;\n}());\n\nvar DEFAULT_UVS = new TextureUvs();\n/**\n * A texture stores the information that represents an image or part of an image.\n *\n * It cannot be added to the display list directly; instead use it as the texture for a Sprite.\n * If no frame is provided for a texture, then the whole image is used.\n *\n * You can directly create a texture from an image and then reuse it multiple times like this :\n *\n * ```js\n * let texture = PIXI.Texture.from('assets/image.png');\n * let sprite1 = new PIXI.Sprite(texture);\n * let sprite2 = new PIXI.Sprite(texture);\n * ```\n *\n * If you didnt pass the texture frame to constructor, it enables `noFrame` mode:\n * it subscribes on baseTexture events, it automatically resizes at the same time as baseTexture.\n *\n * Textures made from SVGs, loaded or not, cannot be used before the file finishes processing.\n * You can check for this by checking the sprite's _textureID property.\n * ```js\n * var texture = PIXI.Texture.from('assets/image.svg');\n * var sprite1 = new PIXI.Sprite(texture);\n * //sprite1._textureID should not be undefined if the texture has finished processing the SVG file\n * ```\n * You can use a ticker or rAF to ensure your sprites load the finished textures after processing. See issue #3068.\n *\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n */\nvar Texture = /** @class */ (function (_super) {\n __extends(Texture, _super);\n /**\n * @param {PIXI.BaseTexture} baseTexture - The base texture source to create the texture from\n * @param {PIXI.Rectangle} [frame] - The rectangle frame of the texture to show\n * @param {PIXI.Rectangle} [orig] - The area of original texture\n * @param {PIXI.Rectangle} [trim] - Trimmed rectangle of original texture\n * @param {number} [rotate] - indicates how the texture was rotated by texture packer. See {@link PIXI.groupD8}\n * @param {PIXI.IPointData} [anchor] - Default anchor point used for sprite placement / rotation\n */\n function Texture(baseTexture, frame, orig, trim, rotate, anchor) {\n var _this = _super.call(this) || this;\n /**\n * Does this Texture have any frame data assigned to it?\n *\n * This mode is enabled automatically if no frame was passed inside constructor.\n *\n * In this mode texture is subscribed to baseTexture events, and fires `update` on any change.\n *\n * Beware, after loading or resize of baseTexture event can fired two times!\n * If you want more control, subscribe on baseTexture itself.\n *\n * ```js\n * texture.on('update', () => {});\n * ```\n *\n * Any assignment of `frame` switches off `noFrame` mode.\n *\n * @member {boolean}\n */\n _this.noFrame = false;\n if (!frame) {\n _this.noFrame = true;\n frame = new _pixi_math__WEBPACK_IMPORTED_MODULE_5__.Rectangle(0, 0, 1, 1);\n }\n if (baseTexture instanceof Texture) {\n baseTexture = baseTexture.baseTexture;\n }\n /**\n * The base texture that this texture uses.\n *\n * @member {PIXI.BaseTexture}\n */\n _this.baseTexture = baseTexture;\n /**\n * This is the area of the BaseTexture image to actually copy to the Canvas / WebGL when rendering,\n * irrespective of the actual frame size or placement (which can be influenced by trimmed texture atlases)\n *\n * @member {PIXI.Rectangle}\n */\n _this._frame = frame;\n /**\n * This is the trimmed area of original texture, before it was put in atlas\n * Please call `updateUvs()` after you change coordinates of `trim` manually.\n *\n * @member {PIXI.Rectangle}\n */\n _this.trim = trim;\n /**\n * This will let the renderer know if the texture is valid. If it's not then it cannot be rendered.\n *\n * @member {boolean}\n */\n _this.valid = false;\n /**\n * The WebGL UV data cache. Can be used as quad UV\n *\n * @member {PIXI.TextureUvs}\n * @protected\n */\n _this._uvs = DEFAULT_UVS;\n /**\n * Default TextureMatrix instance for this texture\n * By default that object is not created because its heavy\n *\n * @member {PIXI.TextureMatrix}\n */\n _this.uvMatrix = null;\n /**\n * This is the area of original texture, before it was put in atlas\n *\n * @member {PIXI.Rectangle}\n */\n _this.orig = orig || frame; // new Rectangle(0, 0, 1, 1);\n _this._rotate = Number(rotate || 0);\n if (rotate === true) {\n // this is old texturepacker legacy, some games/libraries are passing \"true\" for rotated textures\n _this._rotate = 2;\n }\n else if (_this._rotate % 2 !== 0) {\n throw new Error('attempt to use diamond-shaped UVs. If you are sure, set rotation manually');\n }\n /**\n * Anchor point that is used as default if sprite is created with this texture.\n * Changing the `defaultAnchor` at a later point of time will not update Sprite's anchor point.\n * @member {PIXI.Point}\n * @default {0,0}\n */\n _this.defaultAnchor = anchor ? new _pixi_math__WEBPACK_IMPORTED_MODULE_5__.Point(anchor.x, anchor.y) : new _pixi_math__WEBPACK_IMPORTED_MODULE_5__.Point(0, 0);\n /**\n * Update ID is observed by sprites and TextureMatrix instances.\n * Call updateUvs() to increment it.\n *\n * @member {number}\n * @protected\n */\n _this._updateID = 0;\n /**\n * The ids under which this Texture has been added to the texture cache. This is\n * automatically set as long as Texture.addToCache is used, but may not be set if a\n * Texture is added directly to the TextureCache array.\n *\n * @member {string[]}\n */\n _this.textureCacheIds = [];\n if (!baseTexture.valid) {\n baseTexture.once('loaded', _this.onBaseTextureUpdated, _this);\n }\n else if (_this.noFrame) {\n // if there is no frame we should monitor for any base texture changes..\n if (baseTexture.valid) {\n _this.onBaseTextureUpdated(baseTexture);\n }\n }\n else {\n _this.frame = frame;\n }\n if (_this.noFrame) {\n baseTexture.on('update', _this.onBaseTextureUpdated, _this);\n }\n return _this;\n }\n /**\n * Updates this texture on the gpu.\n *\n * Calls the TextureResource update.\n *\n * If you adjusted `frame` manually, please call `updateUvs()` instead.\n *\n */\n Texture.prototype.update = function () {\n if (this.baseTexture.resource) {\n this.baseTexture.resource.update();\n }\n };\n /**\n * Called when the base texture is updated\n *\n * @protected\n * @param {PIXI.BaseTexture} baseTexture - The base texture.\n */\n Texture.prototype.onBaseTextureUpdated = function (baseTexture) {\n if (this.noFrame) {\n if (!this.baseTexture.valid) {\n return;\n }\n this._frame.width = baseTexture.width;\n this._frame.height = baseTexture.height;\n this.valid = true;\n this.updateUvs();\n }\n else {\n // TODO this code looks confusing.. boo to abusing getters and setters!\n // if user gave us frame that has bigger size than resized texture it can be a problem\n this.frame = this._frame;\n }\n this.emit('update', this);\n };\n /**\n * Destroys this texture\n *\n * @param {boolean} [destroyBase=false] - Whether to destroy the base texture as well\n */\n Texture.prototype.destroy = function (destroyBase) {\n if (this.baseTexture) {\n if (destroyBase) {\n var resource = this.baseTexture;\n // delete the texture if it exists in the texture cache..\n // this only needs to be removed if the base texture is actually destroyed too..\n if (resource && resource.url && _pixi_utils__WEBPACK_IMPORTED_MODULE_2__.TextureCache[resource.url]) {\n Texture.removeFromCache(resource.url);\n }\n this.baseTexture.destroy();\n }\n this.baseTexture.off('loaded', this.onBaseTextureUpdated, this);\n this.baseTexture.off('update', this.onBaseTextureUpdated, this);\n this.baseTexture = null;\n }\n this._frame = null;\n this._uvs = null;\n this.trim = null;\n this.orig = null;\n this.valid = false;\n Texture.removeFromCache(this);\n this.textureCacheIds = null;\n };\n /**\n * Creates a new texture object that acts the same as this one.\n *\n * @return {PIXI.Texture} The new texture\n */\n Texture.prototype.clone = function () {\n return new Texture(this.baseTexture, this.frame.clone(), this.orig.clone(), this.trim && this.trim.clone(), this.rotate, this.defaultAnchor);\n };\n /**\n * Updates the internal WebGL UV cache. Use it after you change `frame` or `trim` of the texture.\n * Call it after changing the frame\n */\n Texture.prototype.updateUvs = function () {\n if (this._uvs === DEFAULT_UVS) {\n this._uvs = new TextureUvs();\n }\n this._uvs.set(this._frame, this.baseTexture, this.rotate);\n this._updateID++;\n };\n /**\n * Helper function that creates a new Texture based on the source you provide.\n * The source can be - frame id, image url, video url, canvas element, video element, base texture\n *\n * @static\n * @param {string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|PIXI.BaseTexture} source\n * Source to create texture from\n * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options.\n * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}.\n * @return {PIXI.Texture} The newly created texture\n */\n Texture.from = function (source, options, strict) {\n if (options === void 0) { options = {}; }\n if (strict === void 0) { strict = _pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.STRICT_TEXTURE_CACHE; }\n var isFrame = typeof source === 'string';\n var cacheId = null;\n if (isFrame) {\n cacheId = source;\n }\n else {\n if (!source._pixiId) {\n source._pixiId = \"pixiid_\" + (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.uid)();\n }\n cacheId = source._pixiId;\n }\n var texture = _pixi_utils__WEBPACK_IMPORTED_MODULE_2__.TextureCache[cacheId];\n // Strict-mode rejects invalid cacheIds\n if (isFrame && strict && !texture) {\n throw new Error(\"The cacheId \\\"\" + cacheId + \"\\\" does not exist in TextureCache.\");\n }\n if (!texture) {\n if (!options.resolution) {\n options.resolution = (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.getResolutionOfUrl)(source);\n }\n texture = new Texture(new BaseTexture(source, options));\n texture.baseTexture.cacheId = cacheId;\n BaseTexture.addToCache(texture.baseTexture, cacheId);\n Texture.addToCache(texture, cacheId);\n }\n // lets assume its a base texture!\n return texture;\n };\n /**\n * Useful for loading textures via URLs. Use instead of `Texture.from` because\n * it does a better job of handling failed URLs more effectively. This also ignores\n * `PIXI.settings.STRICT_TEXTURE_CACHE`. Works for Videos, SVGs, Images.\n * @param {string} url The remote URL to load.\n * @param {object} [options] Optional options to include\n * @return {Promise} A Promise that resolves to a Texture.\n */\n Texture.fromURL = function (url, options) {\n var resourceOptions = Object.assign({ autoLoad: false }, options === null || options === void 0 ? void 0 : options.resourceOptions);\n var texture = Texture.from(url, Object.assign({ resourceOptions: resourceOptions }, options), false);\n var resource = texture.baseTexture.resource;\n // The texture was already loaded\n if (texture.baseTexture.valid) {\n return Promise.resolve(texture);\n }\n // Manually load the texture, this should allow users to handle load errors\n return resource.load().then(function () { return Promise.resolve(texture); });\n };\n /**\n * Create a new Texture with a BufferResource from a Float32Array.\n * RGBA values are floats from 0 to 1.\n * @static\n * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data\n * is provided, a new Float32Array is created.\n * @param {number} width - Width of the resource\n * @param {number} height - Height of the resource\n * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options.\n * @return {PIXI.Texture} The resulting new BaseTexture\n */\n Texture.fromBuffer = function (buffer, width, height, options) {\n return new Texture(BaseTexture.fromBuffer(buffer, width, height, options));\n };\n /**\n * Create a texture from a source and add to the cache.\n *\n * @static\n * @param {HTMLImageElement|HTMLCanvasElement} source - The input source.\n * @param {String} imageUrl - File name of texture, for cache and resolving resolution.\n * @param {String} [name] - Human readable name for the texture cache. If no name is\n * specified, only `imageUrl` will be used as the cache ID.\n * @return {PIXI.Texture} Output texture\n */\n Texture.fromLoader = function (source, imageUrl, name) {\n var resource = new ImageResource(source);\n resource.url = imageUrl;\n var baseTexture = new BaseTexture(resource, {\n scaleMode: _pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.SCALE_MODE,\n resolution: (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.getResolutionOfUrl)(imageUrl),\n });\n var texture = new Texture(baseTexture);\n // No name, use imageUrl instead\n if (!name) {\n name = imageUrl;\n }\n // lets also add the frame to pixi's global cache for 'fromLoader' function\n BaseTexture.addToCache(texture.baseTexture, name);\n Texture.addToCache(texture, name);\n // also add references by url if they are different.\n if (name !== imageUrl) {\n BaseTexture.addToCache(texture.baseTexture, imageUrl);\n Texture.addToCache(texture, imageUrl);\n }\n return texture;\n };\n /**\n * Adds a Texture to the global TextureCache. This cache is shared across the whole PIXI object.\n *\n * @static\n * @param {PIXI.Texture} texture - The Texture to add to the cache.\n * @param {string} id - The id that the Texture will be stored against.\n */\n Texture.addToCache = function (texture, id) {\n if (id) {\n if (texture.textureCacheIds.indexOf(id) === -1) {\n texture.textureCacheIds.push(id);\n }\n if (_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.TextureCache[id]) {\n // eslint-disable-next-line no-console\n console.warn(\"Texture added to the cache with an id [\" + id + \"] that already had an entry\");\n }\n _pixi_utils__WEBPACK_IMPORTED_MODULE_2__.TextureCache[id] = texture;\n }\n };\n /**\n * Remove a Texture from the global TextureCache.\n *\n * @static\n * @param {string|PIXI.Texture} texture - id of a Texture to be removed, or a Texture instance itself\n * @return {PIXI.Texture|null} The Texture that was removed\n */\n Texture.removeFromCache = function (texture) {\n if (typeof texture === 'string') {\n var textureFromCache = _pixi_utils__WEBPACK_IMPORTED_MODULE_2__.TextureCache[texture];\n if (textureFromCache) {\n var index = textureFromCache.textureCacheIds.indexOf(texture);\n if (index > -1) {\n textureFromCache.textureCacheIds.splice(index, 1);\n }\n delete _pixi_utils__WEBPACK_IMPORTED_MODULE_2__.TextureCache[texture];\n return textureFromCache;\n }\n }\n else if (texture && texture.textureCacheIds) {\n for (var i = 0; i < texture.textureCacheIds.length; ++i) {\n // Check that texture matches the one being passed in before deleting it from the cache.\n if (_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.TextureCache[texture.textureCacheIds[i]] === texture) {\n delete _pixi_utils__WEBPACK_IMPORTED_MODULE_2__.TextureCache[texture.textureCacheIds[i]];\n }\n }\n texture.textureCacheIds.length = 0;\n return texture;\n }\n return null;\n };\n Object.defineProperty(Texture.prototype, \"resolution\", {\n /**\n * Returns resolution of baseTexture\n *\n * @member {number}\n * @readonly\n */\n get: function () {\n return this.baseTexture.resolution;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Texture.prototype, \"frame\", {\n /**\n * The frame specifies the region of the base texture that this texture uses.\n * Please call `updateUvs()` after you change coordinates of `frame` manually.\n *\n * @member {PIXI.Rectangle}\n */\n get: function () {\n return this._frame;\n },\n set: function (frame) {\n this._frame = frame;\n this.noFrame = false;\n var x = frame.x, y = frame.y, width = frame.width, height = frame.height;\n var xNotFit = x + width > this.baseTexture.width;\n var yNotFit = y + height > this.baseTexture.height;\n if (xNotFit || yNotFit) {\n var relationship = xNotFit && yNotFit ? 'and' : 'or';\n var errorX = \"X: \" + x + \" + \" + width + \" = \" + (x + width) + \" > \" + this.baseTexture.width;\n var errorY = \"Y: \" + y + \" + \" + height + \" = \" + (y + height) + \" > \" + this.baseTexture.height;\n throw new Error('Texture Error: frame does not fit inside the base Texture dimensions: '\n + (errorX + \" \" + relationship + \" \" + errorY));\n }\n this.valid = width && height && this.baseTexture.valid;\n if (!this.trim && !this.rotate) {\n this.orig = frame;\n }\n if (this.valid) {\n this.updateUvs();\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Texture.prototype, \"rotate\", {\n /**\n * Indicates whether the texture is rotated inside the atlas\n * set to 2 to compensate for texture packer rotation\n * set to 6 to compensate for spine packer rotation\n * can be used to rotate or mirror sprites\n * See {@link PIXI.groupD8} for explanation\n *\n * @member {number}\n */\n get: function () {\n return this._rotate;\n },\n set: function (rotate) {\n this._rotate = rotate;\n if (this.valid) {\n this.updateUvs();\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Texture.prototype, \"width\", {\n /**\n * The width of the Texture in pixels.\n *\n * @member {number}\n */\n get: function () {\n return this.orig.width;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Texture.prototype, \"height\", {\n /**\n * The height of the Texture in pixels.\n *\n * @member {number}\n */\n get: function () {\n return this.orig.height;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Utility function for BaseTexture|Texture cast\n */\n Texture.prototype.castToBaseTexture = function () {\n return this.baseTexture;\n };\n return Texture;\n}(_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.EventEmitter));\nfunction createWhiteTexture() {\n var canvas = document.createElement('canvas');\n canvas.width = 16;\n canvas.height = 16;\n var context = canvas.getContext('2d');\n context.fillStyle = 'white';\n context.fillRect(0, 0, 16, 16);\n return new Texture(new BaseTexture(new CanvasResource(canvas)));\n}\nfunction removeAllHandlers(tex) {\n tex.destroy = function _emptyDestroy() { };\n tex.on = function _emptyOn() { };\n tex.once = function _emptyOnce() { };\n tex.emit = function _emptyEmit() { };\n}\n/**\n * An empty texture, used often to not have to create multiple empty textures.\n * Can not be destroyed.\n *\n * @static\n * @constant\n * @member {PIXI.Texture}\n */\nTexture.EMPTY = new Texture(new BaseTexture());\nremoveAllHandlers(Texture.EMPTY);\nremoveAllHandlers(Texture.EMPTY.baseTexture);\n/**\n * A white texture of 16x16 size, used for graphics and other things\n * Can not be destroyed.\n *\n * @static\n * @constant\n * @member {PIXI.Texture}\n */\nTexture.WHITE = createWhiteTexture();\nremoveAllHandlers(Texture.WHITE);\nremoveAllHandlers(Texture.WHITE.baseTexture);\n\n/**\n * A RenderTexture is a special texture that allows any PixiJS display object to be rendered to it.\n *\n * __Hint__: All DisplayObjects (i.e. Sprites) that render to a RenderTexture should be preloaded\n * otherwise black rectangles will be drawn instead.\n *\n * __Hint-2__: The actual memory allocation will happen on first render.\n * You shouldn't create renderTextures each frame just to delete them after, try to reuse them.\n *\n * A RenderTexture takes a snapshot of any Display Object given to its render method. For example:\n *\n * ```js\n * let renderer = PIXI.autoDetectRenderer();\n * let renderTexture = PIXI.RenderTexture.create({ width: 800, height: 600 });\n * let sprite = PIXI.Sprite.from(\"spinObj_01.png\");\n *\n * sprite.position.x = 800/2;\n * sprite.position.y = 600/2;\n * sprite.anchor.x = 0.5;\n * sprite.anchor.y = 0.5;\n *\n * renderer.render(sprite, renderTexture);\n * ```\n *\n * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0\n * you can clear the transform\n *\n * ```js\n *\n * sprite.setTransform()\n *\n * let renderTexture = new PIXI.RenderTexture.create(100, 100);\n *\n * renderer.render(sprite, renderTexture); // Renders to center of RenderTexture\n * ```\n *\n * @class\n * @extends PIXI.Texture\n * @memberof PIXI\n */\nvar RenderTexture = /** @class */ (function (_super) {\n __extends(RenderTexture, _super);\n /**\n * @param {PIXI.BaseRenderTexture} baseRenderTexture - The base texture object that this texture uses\n * @param {PIXI.Rectangle} [frame] - The rectangle frame of the texture to show\n */\n function RenderTexture(baseRenderTexture, frame) {\n var _this = this;\n // support for legacy..\n var _legacyRenderer = null;\n if (!(baseRenderTexture instanceof BaseRenderTexture)) {\n /* eslint-disable prefer-rest-params, no-console */\n var width = arguments[1];\n var height = arguments[2];\n var scaleMode = arguments[3];\n var resolution = arguments[4];\n // we have an old render texture..\n console.warn(\"Please use RenderTexture.create(\" + width + \", \" + height + \") instead of the ctor directly.\");\n _legacyRenderer = arguments[0];\n /* eslint-enable prefer-rest-params, no-console */\n frame = null;\n baseRenderTexture = new BaseRenderTexture({\n width: width,\n height: height,\n scaleMode: scaleMode,\n resolution: resolution,\n });\n }\n /**\n * The base texture object that this texture uses\n *\n * @member {PIXI.BaseTexture}\n */\n _this = _super.call(this, baseRenderTexture, frame) || this;\n _this.legacyRenderer = _legacyRenderer;\n /**\n * This will let the renderer know if the texture is valid. If it's not then it cannot be rendered.\n *\n * @member {boolean}\n */\n _this.valid = true;\n /**\n * Stores `sourceFrame` when this texture is inside current filter stack.\n * You can read it inside filters.\n *\n * @readonly\n * @member {PIXI.Rectangle}\n */\n _this.filterFrame = null;\n /**\n * The key for pooled texture of FilterSystem\n * @protected\n * @member {string}\n */\n _this.filterPoolKey = null;\n _this.updateUvs();\n return _this;\n }\n Object.defineProperty(RenderTexture.prototype, \"framebuffer\", {\n /**\n * Shortcut to `this.baseTexture.framebuffer`, saves baseTexture cast.\n * @member {PIXI.Framebuffer}\n * @readonly\n */\n get: function () {\n return this.baseTexture.framebuffer;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Resizes the RenderTexture.\n *\n * @param {number} width - The width to resize to.\n * @param {number} height - The height to resize to.\n * @param {boolean} [resizeBaseTexture=true] - Should the baseTexture.width and height values be resized as well?\n */\n RenderTexture.prototype.resize = function (width, height, resizeBaseTexture) {\n if (resizeBaseTexture === void 0) { resizeBaseTexture = true; }\n width = Math.ceil(width);\n height = Math.ceil(height);\n // TODO - could be not required..\n this.valid = (width > 0 && height > 0);\n this._frame.width = this.orig.width = width;\n this._frame.height = this.orig.height = height;\n if (resizeBaseTexture) {\n this.baseTexture.resize(width, height);\n }\n this.updateUvs();\n };\n /**\n * Changes the resolution of baseTexture, but does not change framebuffer size.\n *\n * @param {number} resolution - The new resolution to apply to RenderTexture\n */\n RenderTexture.prototype.setResolution = function (resolution) {\n var baseTexture = this.baseTexture;\n if (baseTexture.resolution === resolution) {\n return;\n }\n baseTexture.setResolution(resolution);\n this.resize(baseTexture.width, baseTexture.height, false);\n };\n /**\n * A short hand way of creating a render texture.\n *\n * @param {object} [options] - Options\n * @param {number} [options.width=100] - The width of the render texture\n * @param {number} [options.height=100] - The height of the render texture\n * @param {number} [options.scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} for possible values\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the texture being generated\n * @return {PIXI.RenderTexture} The new render texture\n */\n RenderTexture.create = function (options) {\n // fallback, old-style: create(width, height, scaleMode, resolution)\n if (typeof options === 'number') {\n /* eslint-disable prefer-rest-params */\n options = {\n width: options,\n height: arguments[1],\n scaleMode: arguments[2],\n resolution: arguments[3],\n };\n /* eslint-enable prefer-rest-params */\n }\n return new RenderTexture(new BaseRenderTexture(options));\n };\n return RenderTexture;\n}(Texture));\n\n/**\n * Experimental!\n *\n * Texture pool, used by FilterSystem and plugins\n * Stores collection of temporary pow2 or screen-sized renderTextures\n *\n * If you use custom RenderTexturePool for your filters, you can use methods\n * `getFilterTexture` and `returnFilterTexture` same as in\n *\n * @class\n * @memberof PIXI\n */\nvar RenderTexturePool = /** @class */ (function () {\n /**\n * @param {object} [textureOptions] - options that will be passed to BaseRenderTexture constructor\n * @param {PIXI.SCALE_MODES} [textureOptions.scaleMode] - See {@link PIXI.SCALE_MODES} for possible values.\n */\n function RenderTexturePool(textureOptions) {\n this.texturePool = {};\n this.textureOptions = textureOptions || {};\n /**\n * Allow renderTextures of the same size as screen, not just pow2\n *\n * Automatically sets to true after `setScreenSize`\n *\n * @member {boolean}\n * @default false\n */\n this.enableFullScreen = false;\n this._pixelsWidth = 0;\n this._pixelsHeight = 0;\n }\n /**\n * creates of texture with params that were specified in pool constructor\n *\n * @param {number} realWidth - width of texture in pixels\n * @param {number} realHeight - height of texture in pixels\n * @returns {RenderTexture}\n */\n RenderTexturePool.prototype.createTexture = function (realWidth, realHeight) {\n var baseRenderTexture = new BaseRenderTexture(Object.assign({\n width: realWidth,\n height: realHeight,\n resolution: 1,\n }, this.textureOptions));\n return new RenderTexture(baseRenderTexture);\n };\n /**\n * Gets a Power-of-Two render texture or fullScreen texture\n *\n * @protected\n * @param {number} minWidth - The minimum width of the render texture in real pixels.\n * @param {number} minHeight - The minimum height of the render texture in real pixels.\n * @param {number} [resolution=1] - The resolution of the render texture.\n * @return {PIXI.RenderTexture} The new render texture.\n */\n RenderTexturePool.prototype.getOptimalTexture = function (minWidth, minHeight, resolution) {\n if (resolution === void 0) { resolution = 1; }\n var key = RenderTexturePool.SCREEN_KEY;\n minWidth *= resolution;\n minHeight *= resolution;\n if (!this.enableFullScreen || minWidth !== this._pixelsWidth || minHeight !== this._pixelsHeight) {\n minWidth = (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.nextPow2)(minWidth);\n minHeight = (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.nextPow2)(minHeight);\n key = ((minWidth & 0xFFFF) << 16) | (minHeight & 0xFFFF);\n }\n if (!this.texturePool[key]) {\n this.texturePool[key] = [];\n }\n var renderTexture = this.texturePool[key].pop();\n if (!renderTexture) {\n renderTexture = this.createTexture(minWidth, minHeight);\n }\n renderTexture.filterPoolKey = key;\n renderTexture.setResolution(resolution);\n return renderTexture;\n };\n /**\n * Gets extra texture of the same size as input renderTexture\n *\n * `getFilterTexture(input, 0.5)` or `getFilterTexture(0.5, input)`\n *\n * @param {PIXI.RenderTexture} input - renderTexture from which size and resolution will be copied\n * @param {number} [resolution] - override resolution of the renderTexture\n * It overrides, it does not multiply\n * @returns {PIXI.RenderTexture}\n */\n RenderTexturePool.prototype.getFilterTexture = function (input, resolution) {\n var filterTexture = this.getOptimalTexture(input.width, input.height, resolution || input.resolution);\n filterTexture.filterFrame = input.filterFrame;\n return filterTexture;\n };\n /**\n * Place a render texture back into the pool.\n * @param {PIXI.RenderTexture} renderTexture - The renderTexture to free\n */\n RenderTexturePool.prototype.returnTexture = function (renderTexture) {\n var key = renderTexture.filterPoolKey;\n renderTexture.filterFrame = null;\n this.texturePool[key].push(renderTexture);\n };\n /**\n * Alias for returnTexture, to be compliant with FilterSystem interface\n * @param {PIXI.RenderTexture} renderTexture - The renderTexture to free\n */\n RenderTexturePool.prototype.returnFilterTexture = function (renderTexture) {\n this.returnTexture(renderTexture);\n };\n /**\n * Clears the pool\n *\n * @param {boolean} [destroyTextures=true] - destroy all stored textures\n */\n RenderTexturePool.prototype.clear = function (destroyTextures) {\n destroyTextures = destroyTextures !== false;\n if (destroyTextures) {\n for (var i in this.texturePool) {\n var textures = this.texturePool[i];\n if (textures) {\n for (var j = 0; j < textures.length; j++) {\n textures[j].destroy(true);\n }\n }\n }\n }\n this.texturePool = {};\n };\n /**\n * If screen size was changed, drops all screen-sized textures,\n * sets new screen size, sets `enableFullScreen` to true\n *\n * Size is measured in pixels, `renderer.view` can be passed here, not `renderer.screen`\n *\n * @param {PIXI.ISize} size - Initial size of screen\n */\n RenderTexturePool.prototype.setScreenSize = function (size) {\n if (size.width === this._pixelsWidth\n && size.height === this._pixelsHeight) {\n return;\n }\n var screenKey = RenderTexturePool.SCREEN_KEY;\n var textures = this.texturePool[screenKey];\n this.enableFullScreen = size.width > 0 && size.height > 0;\n if (textures) {\n for (var j = 0; j < textures.length; j++) {\n textures[j].destroy(true);\n }\n }\n this.texturePool[screenKey] = [];\n this._pixelsWidth = size.width;\n this._pixelsHeight = size.height;\n };\n /**\n * Key that is used to store fullscreen renderTextures in a pool\n *\n * @static\n * @const {string}\n */\n RenderTexturePool.SCREEN_KEY = 'screen';\n return RenderTexturePool;\n}());\n\n/* eslint-disable max-len */\n/**\n * Holds the information for a single attribute structure required to render geometry.\n *\n * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer}\n * This can include anything from positions, uvs, normals, colors etc.\n *\n * @class\n * @memberof PIXI\n */\nvar Attribute = /** @class */ (function () {\n /**\n * @param {string} buffer - the id of the buffer that this attribute will look for\n * @param {Number} [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2.\n * @param {Boolean} [normalized=false] - should the data be normalized.\n * @param {Number} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available\n * @param {Number} [stride=0] - How far apart (in floats) the start of each value is. (used for interleaving data)\n * @param {Number} [start=0] - How far into the array to start reading values (used for interleaving data)\n */\n function Attribute(buffer, size, normalized, type, stride, start, instance) {\n if (size === void 0) { size = 0; }\n if (normalized === void 0) { normalized = false; }\n if (type === void 0) { type = 5126; }\n this.buffer = buffer;\n this.size = size;\n this.normalized = normalized;\n this.type = type;\n this.stride = stride;\n this.start = start;\n this.instance = instance;\n }\n /**\n * Destroys the Attribute.\n */\n Attribute.prototype.destroy = function () {\n this.buffer = null;\n };\n /**\n * Helper function that creates an Attribute based on the information provided\n *\n * @static\n * @param {string} buffer - the id of the buffer that this attribute will look for\n * @param {Number} [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2\n * @param {Boolean} [normalized=false] - should the data be normalized.\n * @param {Number} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available\n * @param {Number} [stride=0] - How far apart (in floats) the start of each value is. (used for interleaving data)\n *\n * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided\n */\n Attribute.from = function (buffer, size, normalized, type, stride) {\n return new Attribute(buffer, size, normalized, type, stride);\n };\n return Attribute;\n}());\n\nvar UID = 0;\n/**\n * A wrapper for data so that it can be used and uploaded by WebGL\n *\n * @class\n * @memberof PIXI\n */\nvar Buffer = /** @class */ (function () {\n /**\n * @param {ArrayBuffer| SharedArrayBuffer|ArrayBufferView} data - the data to store in the buffer.\n * @param {boolean} [_static=true] - `true` for static buffer\n * @param {boolean} [index=false] - `true` for index buffer\n */\n function Buffer(data, _static, index) {\n if (_static === void 0) { _static = true; }\n if (index === void 0) { index = false; }\n /**\n * The data in the buffer, as a typed array\n *\n * @member {ArrayBuffer| SharedArrayBuffer | ArrayBufferView}\n */\n this.data = (data || new Float32Array(1));\n /**\n * A map of renderer IDs to webgl buffer\n *\n * @private\n * @member {object}\n */\n this._glBuffers = {};\n this._updateID = 0;\n this.index = index;\n this.static = _static;\n this.id = UID++;\n this.disposeRunner = new _pixi_runner__WEBPACK_IMPORTED_MODULE_3__.Runner('disposeBuffer');\n }\n // TODO could explore flagging only a partial upload?\n /**\n * flags this buffer as requiring an upload to the GPU\n * @param {ArrayBuffer|SharedArrayBuffer|ArrayBufferView} [data] - the data to update in the buffer.\n */\n Buffer.prototype.update = function (data) {\n this.data = data || this.data;\n this._updateID++;\n };\n /**\n * disposes WebGL resources that are connected to this geometry\n */\n Buffer.prototype.dispose = function () {\n this.disposeRunner.emit(this, false);\n };\n /**\n * Destroys the buffer\n */\n Buffer.prototype.destroy = function () {\n this.dispose();\n this.data = null;\n };\n /**\n * Helper function that creates a buffer based on an array or TypedArray\n *\n * @static\n * @param {ArrayBufferView | number[]} data - the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array.\n * @return {PIXI.Buffer} A new Buffer based on the data provided.\n */\n Buffer.from = function (data) {\n if (data instanceof Array) {\n data = new Float32Array(data);\n }\n return new Buffer(data);\n };\n return Buffer;\n}());\n\nfunction getBufferType(array) {\n if (array.BYTES_PER_ELEMENT === 4) {\n if (array instanceof Float32Array) {\n return 'Float32Array';\n }\n else if (array instanceof Uint32Array) {\n return 'Uint32Array';\n }\n return 'Int32Array';\n }\n else if (array.BYTES_PER_ELEMENT === 2) {\n if (array instanceof Uint16Array) {\n return 'Uint16Array';\n }\n }\n else if (array.BYTES_PER_ELEMENT === 1) {\n if (array instanceof Uint8Array) {\n return 'Uint8Array';\n }\n }\n // TODO map out the rest of the array elements!\n return null;\n}\n\n/* eslint-disable object-shorthand */\nvar map = {\n Float32Array: Float32Array,\n Uint32Array: Uint32Array,\n Int32Array: Int32Array,\n Uint8Array: Uint8Array,\n};\nfunction interleaveTypedArrays(arrays, sizes) {\n var outSize = 0;\n var stride = 0;\n var views = {};\n for (var i = 0; i < arrays.length; i++) {\n stride += sizes[i];\n outSize += arrays[i].length;\n }\n var buffer = new ArrayBuffer(outSize * 4);\n var out = null;\n var littleOffset = 0;\n for (var i = 0; i < arrays.length; i++) {\n var size = sizes[i];\n var array = arrays[i];\n var type = getBufferType(array);\n if (!views[type]) {\n views[type] = new map[type](buffer);\n }\n out = views[type];\n for (var j = 0; j < array.length; j++) {\n var indexStart = ((j / size | 0) * stride) + littleOffset;\n var index = j % size;\n out[indexStart + index] = array[j];\n }\n littleOffset += size;\n }\n return new Float32Array(buffer);\n}\n\nvar byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 };\nvar UID$1 = 0;\n/* eslint-disable object-shorthand */\nvar map$1 = {\n Float32Array: Float32Array,\n Uint32Array: Uint32Array,\n Int32Array: Int32Array,\n Uint8Array: Uint8Array,\n Uint16Array: Uint16Array,\n};\n/* eslint-disable max-len */\n/**\n * The Geometry represents a model. It consists of two components:\n * - GeometryStyle - The structure of the model such as the attributes layout\n * - GeometryData - the data of the model - this consists of buffers.\n * This can include anything from positions, uvs, normals, colors etc.\n *\n * Geometry can be defined without passing in a style or data if required (thats how I prefer!)\n *\n * ```js\n * let geometry = new PIXI.Geometry();\n *\n * geometry.addAttribute('positions', [0, 0, 100, 0, 100, 100, 0, 100], 2);\n * geometry.addAttribute('uvs', [0,0,1,0,1,1,0,1],2)\n * geometry.addIndex([0,1,2,1,3,2])\n *\n * ```\n * @class\n * @memberof PIXI\n */\nvar Geometry = /** @class */ (function () {\n /**\n * @param {PIXI.Buffer[]} [buffers] - an array of buffers. optional.\n * @param {object} [attributes] - of the geometry, optional structure of the attributes layout\n */\n function Geometry(buffers, attributes) {\n if (buffers === void 0) { buffers = []; }\n if (attributes === void 0) { attributes = {}; }\n this.buffers = buffers;\n this.indexBuffer = null;\n this.attributes = attributes;\n /**\n * A map of renderer IDs to webgl VAOs\n *\n * @protected\n * @type {object}\n */\n this.glVertexArrayObjects = {};\n this.id = UID$1++;\n this.instanced = false;\n /**\n * Number of instances in this geometry, pass it to `GeometrySystem.draw()`\n * @member {number}\n * @default 1\n */\n this.instanceCount = 1;\n this.disposeRunner = new _pixi_runner__WEBPACK_IMPORTED_MODULE_3__.Runner('disposeGeometry');\n /**\n * Count of existing (not destroyed) meshes that reference this geometry\n * @member {number}\n */\n this.refCount = 0;\n }\n /**\n *\n * Adds an attribute to the geometry\n * Note: `stride` and `start` should be `undefined` if you dont know them, not 0!\n *\n * @param {String} id - the name of the attribute (matching up to a shader)\n * @param {PIXI.Buffer|number[]} [buffer] - the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it.\n * @param {Number} [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2\n * @param {Boolean} [normalized=false] - should the data be normalized.\n * @param {Number} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {PIXI.TYPES} to see the ones available\n * @param {Number} [stride] - How far apart (in floats) the start of each value is. (used for interleaving data)\n * @param {Number} [start] - How far into the array to start reading values (used for interleaving data)\n * @param {boolean} [instance=false] - Instancing flag\n *\n * @return {PIXI.Geometry} returns self, useful for chaining.\n */\n Geometry.prototype.addAttribute = function (id, buffer, size, normalized, type, stride, start, instance) {\n if (size === void 0) { size = 0; }\n if (normalized === void 0) { normalized = false; }\n if (instance === void 0) { instance = false; }\n if (!buffer) {\n throw new Error('You must pass a buffer when creating an attribute');\n }\n // check if this is a buffer!\n if (!(buffer instanceof Buffer)) {\n // its an array!\n if (buffer instanceof Array) {\n buffer = new Float32Array(buffer);\n }\n buffer = new Buffer(buffer);\n }\n var ids = id.split('|');\n if (ids.length > 1) {\n for (var i = 0; i < ids.length; i++) {\n this.addAttribute(ids[i], buffer, size, normalized, type);\n }\n return this;\n }\n var bufferIndex = this.buffers.indexOf(buffer);\n if (bufferIndex === -1) {\n this.buffers.push(buffer);\n bufferIndex = this.buffers.length - 1;\n }\n this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance);\n // assuming that if there is instanced data then this will be drawn with instancing!\n this.instanced = this.instanced || instance;\n return this;\n };\n /**\n * returns the requested attribute\n *\n * @param {String} id - the name of the attribute required\n * @return {PIXI.Attribute} the attribute requested.\n */\n Geometry.prototype.getAttribute = function (id) {\n return this.attributes[id];\n };\n /**\n * returns the requested buffer\n *\n * @param {String} id - the name of the buffer required\n * @return {PIXI.Buffer} the buffer requested.\n */\n Geometry.prototype.getBuffer = function (id) {\n return this.buffers[this.getAttribute(id).buffer];\n };\n /**\n *\n * Adds an index buffer to the geometry\n * The index buffer contains integers, three for each triangle in the geometry, which reference the various attribute buffers (position, colour, UV coordinates, other UV coordinates, normal, …). There is only ONE index buffer.\n *\n * @param {PIXI.Buffer|number[]} [buffer] - the buffer that holds the data of the index buffer. You can also provide an Array and a buffer will be created from it.\n * @return {PIXI.Geometry} returns self, useful for chaining.\n */\n Geometry.prototype.addIndex = function (buffer) {\n if (!(buffer instanceof Buffer)) {\n // its an array!\n if (buffer instanceof Array) {\n buffer = new Uint16Array(buffer);\n }\n buffer = new Buffer(buffer);\n }\n buffer.index = true;\n this.indexBuffer = buffer;\n if (this.buffers.indexOf(buffer) === -1) {\n this.buffers.push(buffer);\n }\n return this;\n };\n /**\n * returns the index buffer\n *\n * @return {PIXI.Buffer} the index buffer.\n */\n Geometry.prototype.getIndex = function () {\n return this.indexBuffer;\n };\n /**\n * this function modifies the structure so that all current attributes become interleaved into a single buffer\n * This can be useful if your model remains static as it offers a little performance boost\n *\n * @return {PIXI.Geometry} returns self, useful for chaining.\n */\n Geometry.prototype.interleave = function () {\n // a simple check to see if buffers are already interleaved..\n if (this.buffers.length === 1 || (this.buffers.length === 2 && this.indexBuffer))\n { return this; }\n // assume already that no buffers are interleaved\n var arrays = [];\n var sizes = [];\n var interleavedBuffer = new Buffer();\n var i;\n for (i in this.attributes) {\n var attribute = this.attributes[i];\n var buffer = this.buffers[attribute.buffer];\n arrays.push(buffer.data);\n sizes.push((attribute.size * byteSizeMap[attribute.type]) / 4);\n attribute.buffer = 0;\n }\n interleavedBuffer.data = interleaveTypedArrays(arrays, sizes);\n for (i = 0; i < this.buffers.length; i++) {\n if (this.buffers[i] !== this.indexBuffer) {\n this.buffers[i].destroy();\n }\n }\n this.buffers = [interleavedBuffer];\n if (this.indexBuffer) {\n this.buffers.push(this.indexBuffer);\n }\n return this;\n };\n Geometry.prototype.getSize = function () {\n for (var i in this.attributes) {\n var attribute = this.attributes[i];\n var buffer = this.buffers[attribute.buffer];\n return buffer.data.length / ((attribute.stride / 4) || attribute.size);\n }\n return 0;\n };\n /**\n * disposes WebGL resources that are connected to this geometry\n */\n Geometry.prototype.dispose = function () {\n this.disposeRunner.emit(this, false);\n };\n /**\n * Destroys the geometry.\n */\n Geometry.prototype.destroy = function () {\n this.dispose();\n this.buffers = null;\n this.indexBuffer = null;\n this.attributes = null;\n };\n /**\n * returns a clone of the geometry\n *\n * @returns {PIXI.Geometry} a new clone of this geometry\n */\n Geometry.prototype.clone = function () {\n var geometry = new Geometry();\n for (var i = 0; i < this.buffers.length; i++) {\n geometry.buffers[i] = new Buffer(this.buffers[i].data.slice(0));\n }\n for (var i in this.attributes) {\n var attrib = this.attributes[i];\n geometry.attributes[i] = new Attribute(attrib.buffer, attrib.size, attrib.normalized, attrib.type, attrib.stride, attrib.start, attrib.instance);\n }\n if (this.indexBuffer) {\n geometry.indexBuffer = geometry.buffers[this.buffers.indexOf(this.indexBuffer)];\n geometry.indexBuffer.index = true;\n }\n return geometry;\n };\n /**\n * merges an array of geometries into a new single one\n * geometry attribute styles must match for this operation to work\n *\n * @param {PIXI.Geometry[]} geometries - array of geometries to merge\n * @returns {PIXI.Geometry} shiny new geometry!\n */\n Geometry.merge = function (geometries) {\n // todo add a geometry check!\n // also a size check.. cant be too big!]\n var geometryOut = new Geometry();\n var arrays = [];\n var sizes = [];\n var offsets = [];\n var geometry;\n // pass one.. get sizes..\n for (var i = 0; i < geometries.length; i++) {\n geometry = geometries[i];\n for (var j = 0; j < geometry.buffers.length; j++) {\n sizes[j] = sizes[j] || 0;\n sizes[j] += geometry.buffers[j].data.length;\n offsets[j] = 0;\n }\n }\n // build the correct size arrays..\n for (var i = 0; i < geometry.buffers.length; i++) {\n // TODO types!\n arrays[i] = new map$1[getBufferType(geometry.buffers[i].data)](sizes[i]);\n geometryOut.buffers[i] = new Buffer(arrays[i]);\n }\n // pass to set data..\n for (var i = 0; i < geometries.length; i++) {\n geometry = geometries[i];\n for (var j = 0; j < geometry.buffers.length; j++) {\n arrays[j].set(geometry.buffers[j].data, offsets[j]);\n offsets[j] += geometry.buffers[j].data.length;\n }\n }\n geometryOut.attributes = geometry.attributes;\n if (geometry.indexBuffer) {\n geometryOut.indexBuffer = geometryOut.buffers[geometry.buffers.indexOf(geometry.indexBuffer)];\n geometryOut.indexBuffer.index = true;\n var offset = 0;\n var stride = 0;\n var offset2 = 0;\n var bufferIndexToCount = 0;\n // get a buffer\n for (var i = 0; i < geometry.buffers.length; i++) {\n if (geometry.buffers[i] !== geometry.indexBuffer) {\n bufferIndexToCount = i;\n break;\n }\n }\n // figure out the stride of one buffer..\n for (var i in geometry.attributes) {\n var attribute = geometry.attributes[i];\n if ((attribute.buffer | 0) === bufferIndexToCount) {\n stride += ((attribute.size * byteSizeMap[attribute.type]) / 4);\n }\n }\n // time to off set all indexes..\n for (var i = 0; i < geometries.length; i++) {\n var indexBufferData = geometries[i].indexBuffer.data;\n for (var j = 0; j < indexBufferData.length; j++) {\n geometryOut.indexBuffer.data[j + offset2] += offset;\n }\n offset += geometry.buffers[bufferIndexToCount].data.length / (stride);\n offset2 += indexBufferData.length;\n }\n }\n return geometryOut;\n };\n return Geometry;\n}());\n\n/**\n * Helper class to create a quad\n *\n * @class\n * @memberof PIXI\n */\nvar Quad = /** @class */ (function (_super) {\n __extends(Quad, _super);\n function Quad() {\n var _this = _super.call(this) || this;\n _this.addAttribute('aVertexPosition', new Float32Array([\n 0, 0,\n 1, 0,\n 1, 1,\n 0, 1 ]))\n .addIndex([0, 1, 3, 2]);\n return _this;\n }\n return Quad;\n}(Geometry));\n\n/**\n * Helper class to create a quad with uvs like in v4\n *\n * @class\n * @memberof PIXI\n * @extends PIXI.Geometry\n */\nvar QuadUv = /** @class */ (function (_super) {\n __extends(QuadUv, _super);\n function QuadUv() {\n var _this = _super.call(this) || this;\n /**\n * An array of vertices\n *\n * @member {Float32Array}\n */\n _this.vertices = new Float32Array([\n -1, -1,\n 1, -1,\n 1, 1,\n -1, 1 ]);\n /**\n * The Uvs of the quad\n *\n * @member {Float32Array}\n */\n _this.uvs = new Float32Array([\n 0, 0,\n 1, 0,\n 1, 1,\n 0, 1 ]);\n _this.vertexBuffer = new Buffer(_this.vertices);\n _this.uvBuffer = new Buffer(_this.uvs);\n _this.addAttribute('aVertexPosition', _this.vertexBuffer)\n .addAttribute('aTextureCoord', _this.uvBuffer)\n .addIndex([0, 1, 2, 0, 2, 3]);\n return _this;\n }\n /**\n * Maps two Rectangle to the quad.\n *\n * @param {PIXI.Rectangle} targetTextureFrame - the first rectangle\n * @param {PIXI.Rectangle} destinationFrame - the second rectangle\n * @return {PIXI.Quad} Returns itself.\n */\n QuadUv.prototype.map = function (targetTextureFrame, destinationFrame) {\n var x = 0; // destinationFrame.x / targetTextureFrame.width;\n var y = 0; // destinationFrame.y / targetTextureFrame.height;\n this.uvs[0] = x;\n this.uvs[1] = y;\n this.uvs[2] = x + (destinationFrame.width / targetTextureFrame.width);\n this.uvs[3] = y;\n this.uvs[4] = x + (destinationFrame.width / targetTextureFrame.width);\n this.uvs[5] = y + (destinationFrame.height / targetTextureFrame.height);\n this.uvs[6] = x;\n this.uvs[7] = y + (destinationFrame.height / targetTextureFrame.height);\n x = destinationFrame.x;\n y = destinationFrame.y;\n this.vertices[0] = x;\n this.vertices[1] = y;\n this.vertices[2] = x + destinationFrame.width;\n this.vertices[3] = y;\n this.vertices[4] = x + destinationFrame.width;\n this.vertices[5] = y + destinationFrame.height;\n this.vertices[6] = x;\n this.vertices[7] = y + destinationFrame.height;\n this.invalidate();\n return this;\n };\n /**\n * legacy upload method, just marks buffers dirty\n * @returns {PIXI.QuadUv} Returns itself.\n */\n QuadUv.prototype.invalidate = function () {\n this.vertexBuffer._updateID++;\n this.uvBuffer._updateID++;\n return this;\n };\n return QuadUv;\n}(Geometry));\n\nvar UID$2 = 0;\n/**\n * Uniform group holds uniform map and some ID's for work\n *\n * @class\n * @memberof PIXI\n */\nvar UniformGroup = /** @class */ (function () {\n /**\n * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones.\n * @param {boolean} [_static] - Uniforms wont be changed after creation\n */\n function UniformGroup(uniforms, _static) {\n /**\n * uniform values\n * @member {object}\n * @readonly\n */\n this.uniforms = uniforms;\n /**\n * Its a group and not a single uniforms\n * @member {boolean}\n * @readonly\n * @default true\n */\n this.group = true;\n // lets generate this when the shader ?\n this.syncUniforms = {};\n /**\n * dirty version\n * @protected\n * @member {number}\n */\n this.dirtyId = 0;\n /**\n * unique id\n * @protected\n * @member {number}\n */\n this.id = UID$2++;\n /**\n * Uniforms wont be changed after creation\n * @member {boolean}\n */\n this.static = !!_static;\n }\n UniformGroup.prototype.update = function () {\n this.dirtyId++;\n };\n UniformGroup.prototype.add = function (name, uniforms, _static) {\n this.uniforms[name] = new UniformGroup(uniforms, _static);\n };\n UniformGroup.from = function (uniforms, _static) {\n return new UniformGroup(uniforms, _static);\n };\n return UniformGroup;\n}());\n\n/**\n * System plugin to the renderer to manage filter states.\n *\n * @class\n * @private\n */\nvar FilterState = /** @class */ (function () {\n function FilterState() {\n this.renderTexture = null;\n /**\n * Target of the filters\n * We store for case when custom filter wants to know the element it was applied on\n * @member {PIXI.DisplayObject}\n * @private\n */\n this.target = null;\n /**\n * Compatibility with PixiJS v4 filters\n * @member {boolean}\n * @default false\n * @private\n */\n this.legacy = false;\n /**\n * Resolution of filters\n * @member {number}\n * @default 1\n * @private\n */\n this.resolution = 1;\n // next three fields are created only for root\n // re-assigned for everything else\n /**\n * Source frame\n * @member {PIXI.Rectangle}\n * @private\n */\n this.sourceFrame = new _pixi_math__WEBPACK_IMPORTED_MODULE_5__.Rectangle();\n /**\n * Destination frame\n * @member {PIXI.Rectangle}\n * @private\n */\n this.destinationFrame = new _pixi_math__WEBPACK_IMPORTED_MODULE_5__.Rectangle();\n /**\n * Collection of filters\n * @member {PIXI.Filter[]}\n * @private\n */\n this.filters = [];\n }\n /**\n * clears the state\n * @private\n */\n FilterState.prototype.clear = function () {\n this.target = null;\n this.filters = null;\n this.renderTexture = null;\n };\n return FilterState;\n}());\n\n/**\n * System plugin to the renderer to manage the filters.\n *\n * @class\n * @memberof PIXI.systems\n * @extends PIXI.System\n */\nvar FilterSystem = /** @class */ (function (_super) {\n __extends(FilterSystem, _super);\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n function FilterSystem(renderer) {\n var _this = _super.call(this, renderer) || this;\n /**\n * List of filters for the FilterSystem\n * @member {Object[]}\n * @readonly\n */\n _this.defaultFilterStack = [{}];\n /**\n * stores a bunch of PO2 textures used for filtering\n * @member {Object}\n */\n _this.texturePool = new RenderTexturePool();\n _this.texturePool.setScreenSize(renderer.view);\n /**\n * a pool for storing filter states, save us creating new ones each tick\n * @member {Object[]}\n */\n _this.statePool = [];\n /**\n * A very simple geometry used when drawing a filter effect to the screen\n * @member {PIXI.Quad}\n */\n _this.quad = new Quad();\n /**\n * Quad UVs\n * @member {PIXI.QuadUv}\n */\n _this.quadUv = new QuadUv();\n /**\n * Temporary rect for maths\n * @type {PIXI.Rectangle}\n */\n _this.tempRect = new _pixi_math__WEBPACK_IMPORTED_MODULE_5__.Rectangle();\n /**\n * Active state\n * @member {object}\n */\n _this.activeState = {};\n /**\n * This uniform group is attached to filter uniforms when used\n * @member {PIXI.UniformGroup}\n * @property {PIXI.Rectangle} outputFrame\n * @property {Float32Array} inputSize\n * @property {Float32Array} inputPixel\n * @property {Float32Array} inputClamp\n * @property {Number} resolution\n * @property {Float32Array} filterArea\n * @property {Fload32Array} filterClamp\n */\n _this.globalUniforms = new UniformGroup({\n outputFrame: _this.tempRect,\n inputSize: new Float32Array(4),\n inputPixel: new Float32Array(4),\n inputClamp: new Float32Array(4),\n resolution: 1,\n // legacy variables\n filterArea: new Float32Array(4),\n filterClamp: new Float32Array(4),\n }, true);\n /**\n * Whether to clear output renderTexture in AUTO/BLIT mode. See {@link PIXI.CLEAR_MODES}\n * @member {boolean}\n */\n _this.forceClear = false;\n /**\n * Old padding behavior is to use the max amount instead of sum padding.\n * Use this flag if you need the old behavior.\n * @member {boolean}\n * @default false\n */\n _this.useMaxPadding = false;\n return _this;\n }\n /**\n * Adds a new filter to the System.\n *\n * @param {PIXI.DisplayObject} target - The target of the filter to render.\n * @param {PIXI.Filter[]} filters - The filters to apply.\n */\n FilterSystem.prototype.push = function (target, filters) {\n var renderer = this.renderer;\n var filterStack = this.defaultFilterStack;\n var state = this.statePool.pop() || new FilterState();\n var resolution = filters[0].resolution;\n var padding = filters[0].padding;\n var autoFit = filters[0].autoFit;\n var legacy = filters[0].legacy;\n for (var i = 1; i < filters.length; i++) {\n var filter = filters[i];\n // lets use the lowest resolution..\n resolution = Math.min(resolution, filter.resolution);\n // figure out the padding required for filters\n padding = this.useMaxPadding\n // old behavior: use largest amount of padding!\n ? Math.max(padding, filter.padding)\n // new behavior: sum the padding\n : padding + filter.padding;\n // only auto fit if all filters are autofit\n autoFit = autoFit && filter.autoFit;\n legacy = legacy || filter.legacy;\n }\n if (filterStack.length === 1) {\n this.defaultFilterStack[0].renderTexture = renderer.renderTexture.current;\n }\n filterStack.push(state);\n state.resolution = resolution;\n state.legacy = legacy;\n state.target = target;\n state.sourceFrame.copyFrom(target.filterArea || target.getBounds(true));\n state.sourceFrame.pad(padding);\n if (autoFit) {\n state.sourceFrame.fit(this.renderer.renderTexture.sourceFrame);\n }\n // round to whole number based on resolution\n state.sourceFrame.ceil(resolution);\n state.renderTexture = this.getOptimalFilterTexture(state.sourceFrame.width, state.sourceFrame.height, resolution);\n state.filters = filters;\n state.destinationFrame.width = state.renderTexture.width;\n state.destinationFrame.height = state.renderTexture.height;\n var destinationFrame = this.tempRect;\n destinationFrame.width = state.sourceFrame.width;\n destinationFrame.height = state.sourceFrame.height;\n state.renderTexture.filterFrame = state.sourceFrame;\n renderer.renderTexture.bind(state.renderTexture, state.sourceFrame, destinationFrame);\n renderer.renderTexture.clear();\n };\n /**\n * Pops off the filter and applies it.\n *\n */\n FilterSystem.prototype.pop = function () {\n var filterStack = this.defaultFilterStack;\n var state = filterStack.pop();\n var filters = state.filters;\n this.activeState = state;\n var globalUniforms = this.globalUniforms.uniforms;\n globalUniforms.outputFrame = state.sourceFrame;\n globalUniforms.resolution = state.resolution;\n var inputSize = globalUniforms.inputSize;\n var inputPixel = globalUniforms.inputPixel;\n var inputClamp = globalUniforms.inputClamp;\n inputSize[0] = state.destinationFrame.width;\n inputSize[1] = state.destinationFrame.height;\n inputSize[2] = 1.0 / inputSize[0];\n inputSize[3] = 1.0 / inputSize[1];\n inputPixel[0] = inputSize[0] * state.resolution;\n inputPixel[1] = inputSize[1] * state.resolution;\n inputPixel[2] = 1.0 / inputPixel[0];\n inputPixel[3] = 1.0 / inputPixel[1];\n inputClamp[0] = 0.5 * inputPixel[2];\n inputClamp[1] = 0.5 * inputPixel[3];\n inputClamp[2] = (state.sourceFrame.width * inputSize[2]) - (0.5 * inputPixel[2]);\n inputClamp[3] = (state.sourceFrame.height * inputSize[3]) - (0.5 * inputPixel[3]);\n // only update the rect if its legacy..\n if (state.legacy) {\n var filterArea = globalUniforms.filterArea;\n filterArea[0] = state.destinationFrame.width;\n filterArea[1] = state.destinationFrame.height;\n filterArea[2] = state.sourceFrame.x;\n filterArea[3] = state.sourceFrame.y;\n globalUniforms.filterClamp = globalUniforms.inputClamp;\n }\n this.globalUniforms.update();\n var lastState = filterStack[filterStack.length - 1];\n if (state.renderTexture.framebuffer.multisample > 1) {\n this.renderer.framebuffer.blit();\n }\n if (filters.length === 1) {\n filters[0].apply(this, state.renderTexture, lastState.renderTexture, _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.CLEAR_MODES.BLEND, state);\n this.returnFilterTexture(state.renderTexture);\n }\n else {\n var flip = state.renderTexture;\n var flop = this.getOptimalFilterTexture(flip.width, flip.height, state.resolution);\n flop.filterFrame = flip.filterFrame;\n var i = 0;\n for (i = 0; i < filters.length - 1; ++i) {\n filters[i].apply(this, flip, flop, _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.CLEAR_MODES.CLEAR, state);\n var t = flip;\n flip = flop;\n flop = t;\n }\n filters[i].apply(this, flip, lastState.renderTexture, _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.CLEAR_MODES.BLEND, state);\n this.returnFilterTexture(flip);\n this.returnFilterTexture(flop);\n }\n state.clear();\n this.statePool.push(state);\n };\n /**\n * Binds a renderTexture with corresponding `filterFrame`, clears it if mode corresponds.\n * @param {PIXI.RenderTexture} filterTexture - renderTexture to bind, should belong to filter pool or filter stack\n * @param {PIXI.CLEAR_MODES} [clearMode] - clearMode, by default its CLEAR/YES. See {@link PIXI.CLEAR_MODES}\n */\n FilterSystem.prototype.bindAndClear = function (filterTexture, clearMode) {\n if (clearMode === void 0) { clearMode = _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.CLEAR_MODES.CLEAR; }\n if (filterTexture && filterTexture.filterFrame) {\n var destinationFrame = this.tempRect;\n destinationFrame.width = filterTexture.filterFrame.width;\n destinationFrame.height = filterTexture.filterFrame.height;\n this.renderer.renderTexture.bind(filterTexture, filterTexture.filterFrame, destinationFrame);\n }\n else {\n this.renderer.renderTexture.bind(filterTexture);\n }\n // TODO: remove in next major version\n if (typeof clearMode === 'boolean') {\n clearMode = clearMode ? _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.CLEAR_MODES.CLEAR : _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.CLEAR_MODES.BLEND;\n // get deprecation function from utils\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.deprecation)('5.2.1', 'Use CLEAR_MODES when using clear applyFilter option');\n }\n if (clearMode === _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.CLEAR_MODES.CLEAR\n || (clearMode === _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.CLEAR_MODES.BLIT && this.forceClear)) {\n this.renderer.renderTexture.clear();\n }\n };\n /**\n * Draws a filter.\n *\n * @param {PIXI.Filter} filter - The filter to draw.\n * @param {PIXI.RenderTexture} input - The input render target.\n * @param {PIXI.RenderTexture} output - The target to output to.\n * @param {PIXI.CLEAR_MODES} [clearMode] - Should the output be cleared before rendering to it\n */\n FilterSystem.prototype.applyFilter = function (filter, input, output, clearMode) {\n var renderer = this.renderer;\n this.bindAndClear(output, clearMode);\n // set the uniforms..\n filter.uniforms.uSampler = input;\n filter.uniforms.filterGlobals = this.globalUniforms;\n // TODO make it so that the order of this does not matter..\n // because it does at the moment cos of global uniforms.\n // they need to get resynced\n renderer.state.set(filter.state);\n renderer.shader.bind(filter);\n if (filter.legacy) {\n this.quadUv.map(input._frame, input.filterFrame);\n renderer.geometry.bind(this.quadUv);\n renderer.geometry.draw(_pixi_constants__WEBPACK_IMPORTED_MODULE_1__.DRAW_MODES.TRIANGLES);\n }\n else {\n renderer.geometry.bind(this.quad);\n renderer.geometry.draw(_pixi_constants__WEBPACK_IMPORTED_MODULE_1__.DRAW_MODES.TRIANGLE_STRIP);\n }\n };\n /**\n * Multiply _input normalized coordinates_ to this matrix to get _sprite texture normalized coordinates_.\n *\n * Use `outputMatrix * vTextureCoord` in the shader.\n *\n * @param {PIXI.Matrix} outputMatrix - The matrix to output to.\n * @param {PIXI.Sprite} sprite - The sprite to map to.\n * @return {PIXI.Matrix} The mapped matrix.\n */\n FilterSystem.prototype.calculateSpriteMatrix = function (outputMatrix, sprite) {\n var _a = this.activeState, sourceFrame = _a.sourceFrame, destinationFrame = _a.destinationFrame;\n var orig = sprite._texture.orig;\n var mappedMatrix = outputMatrix.set(destinationFrame.width, 0, 0, destinationFrame.height, sourceFrame.x, sourceFrame.y);\n var worldTransform = sprite.worldTransform.copyTo(_pixi_math__WEBPACK_IMPORTED_MODULE_5__.Matrix.TEMP_MATRIX);\n worldTransform.invert();\n mappedMatrix.prepend(worldTransform);\n mappedMatrix.scale(1.0 / orig.width, 1.0 / orig.height);\n mappedMatrix.translate(sprite.anchor.x, sprite.anchor.y);\n return mappedMatrix;\n };\n /**\n * Destroys this Filter System.\n */\n FilterSystem.prototype.destroy = function () {\n // Those textures has to be destroyed by RenderTextureSystem or FramebufferSystem\n this.texturePool.clear(false);\n };\n /**\n * Gets a Power-of-Two render texture or fullScreen texture\n *\n * @protected\n * @param {number} minWidth - The minimum width of the render texture in real pixels.\n * @param {number} minHeight - The minimum height of the render texture in real pixels.\n * @param {number} [resolution=1] - The resolution of the render texture.\n * @return {PIXI.RenderTexture} The new render texture.\n */\n FilterSystem.prototype.getOptimalFilterTexture = function (minWidth, minHeight, resolution) {\n if (resolution === void 0) { resolution = 1; }\n return this.texturePool.getOptimalTexture(minWidth, minHeight, resolution);\n };\n /**\n * Gets extra render texture to use inside current filter\n * To be compliant with older filters, you can use params in any order\n *\n * @param {PIXI.RenderTexture} [input] - renderTexture from which size and resolution will be copied\n * @param {number} [resolution] - override resolution of the renderTexture\n * @returns {PIXI.RenderTexture}\n */\n FilterSystem.prototype.getFilterTexture = function (input, resolution) {\n if (typeof input === 'number') {\n var swap = input;\n input = resolution;\n resolution = swap;\n }\n input = input || this.activeState.renderTexture;\n var filterTexture = this.texturePool.getOptimalTexture(input.width, input.height, resolution || input.resolution);\n filterTexture.filterFrame = input.filterFrame;\n return filterTexture;\n };\n /**\n * Frees a render texture back into the pool.\n *\n * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free\n */\n FilterSystem.prototype.returnFilterTexture = function (renderTexture) {\n this.texturePool.returnTexture(renderTexture);\n };\n /**\n * Empties the texture pool.\n */\n FilterSystem.prototype.emptyPool = function () {\n this.texturePool.clear(true);\n };\n /**\n * calls `texturePool.resize()`, affects fullScreen renderTextures\n */\n FilterSystem.prototype.resize = function () {\n this.texturePool.setScreenSize(this.renderer.view);\n };\n return FilterSystem;\n}(System));\n\n/**\n * Base for a common object renderer that can be used as a\n * system renderer plugin.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI\n */\nvar ObjectRenderer = /** @class */ (function () {\n /**\n * @param {PIXI.Renderer} renderer - The renderer this manager works for.\n */\n function ObjectRenderer(renderer) {\n /**\n * The renderer this manager works for.\n *\n * @member {PIXI.Renderer}\n */\n this.renderer = renderer;\n }\n /**\n * Stub method that should be used to empty the current\n * batch by rendering objects now.\n */\n ObjectRenderer.prototype.flush = function () {\n // flush!\n };\n /**\n * Generic destruction method that frees all resources. This\n * should be called by subclasses.\n */\n ObjectRenderer.prototype.destroy = function () {\n this.renderer = null;\n };\n /**\n * Stub method that initializes any state required before\n * rendering starts. It is different from the `prerender`\n * signal, which occurs every frame, in that it is called\n * whenever an object requests _this_ renderer specifically.\n */\n ObjectRenderer.prototype.start = function () {\n // set the shader..\n };\n /**\n * Stops the renderer. It should free up any state and\n * become dormant.\n */\n ObjectRenderer.prototype.stop = function () {\n this.flush();\n };\n /**\n * Keeps the object to render. It doesn't have to be\n * rendered immediately.\n *\n * @param {PIXI.DisplayObject} object - The object to render.\n */\n ObjectRenderer.prototype.render = function (_object) {\n // render the object\n };\n return ObjectRenderer;\n}());\n\n/**\n * System plugin to the renderer to manage batching.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nvar BatchSystem = /** @class */ (function (_super) {\n __extends(BatchSystem, _super);\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n function BatchSystem(renderer) {\n var _this = _super.call(this, renderer) || this;\n /**\n * An empty renderer.\n *\n * @member {PIXI.ObjectRenderer}\n */\n _this.emptyRenderer = new ObjectRenderer(renderer);\n /**\n * The currently active ObjectRenderer.\n *\n * @member {PIXI.ObjectRenderer}\n */\n _this.currentRenderer = _this.emptyRenderer;\n return _this;\n }\n /**\n * Changes the current renderer to the one given in parameter\n *\n * @param {PIXI.ObjectRenderer} objectRenderer - The object renderer to use.\n */\n BatchSystem.prototype.setObjectRenderer = function (objectRenderer) {\n if (this.currentRenderer === objectRenderer) {\n return;\n }\n this.currentRenderer.stop();\n this.currentRenderer = objectRenderer;\n this.currentRenderer.start();\n };\n /**\n * This should be called if you wish to do some custom rendering\n * It will basically render anything that may be batched up such as sprites\n */\n BatchSystem.prototype.flush = function () {\n this.setObjectRenderer(this.emptyRenderer);\n };\n /**\n * Reset the system to an empty renderer\n */\n BatchSystem.prototype.reset = function () {\n this.setObjectRenderer(this.emptyRenderer);\n };\n /**\n * Handy function for batch renderers: copies bound textures in first maxTextures locations to array\n * sets actual _batchLocation for them\n *\n * @param {PIXI.BaseTexture[]} - arr copy destination\n * @param {number} maxTextures - number of copied elements\n */\n BatchSystem.prototype.copyBoundTextures = function (arr, maxTextures) {\n var boundTextures = this.renderer.texture.boundTextures;\n for (var i = maxTextures - 1; i >= 0; --i) {\n arr[i] = boundTextures[i] || null;\n if (arr[i]) {\n arr[i]._batchLocation = i;\n }\n }\n };\n /**\n * Assigns batch locations to textures in array based on boundTextures state.\n * All textures in texArray should have `_batchEnabled = _batchId`,\n * and their count should be less than `maxTextures`.\n *\n * @param {PIXI.BatchTextureArray} texArray - textures to bound\n * @param {PIXI.BaseTexture[]} boundTextures - current state of bound textures\n * @param {number} batchId - marker for _batchEnabled param of textures in texArray\n * @param {number} maxTextures - number of texture locations to manipulate\n */\n BatchSystem.prototype.boundArray = function (texArray, boundTextures, batchId, maxTextures) {\n var elements = texArray.elements, ids = texArray.ids, count = texArray.count;\n var j = 0;\n for (var i = 0; i < count; i++) {\n var tex = elements[i];\n var loc = tex._batchLocation;\n if (loc >= 0 && loc < maxTextures\n && boundTextures[loc] === tex) {\n ids[i] = loc;\n continue;\n }\n while (j < maxTextures) {\n var bound = boundTextures[j];\n if (bound && bound._batchEnabled === batchId\n && bound._batchLocation === j) {\n j++;\n continue;\n }\n ids[i] = j;\n tex._batchLocation = j;\n boundTextures[j] = tex;\n break;\n }\n }\n };\n return BatchSystem;\n}(System));\n\nvar CONTEXT_UID_COUNTER = 0;\n/**\n * System plugin to the renderer to manage the context.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nvar ContextSystem = /** @class */ (function (_super) {\n __extends(ContextSystem, _super);\n /* eslint-enable camelcase */\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n function ContextSystem(renderer) {\n var _this = _super.call(this, renderer) || this;\n /**\n * Either 1 or 2 to reflect the WebGL version being used\n * @member {number}\n * @readonly\n */\n _this.webGLVersion = 1;\n /**\n * Extensions being used\n * @member {object}\n * @readonly\n * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension\n * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension\n * @property {OES_texture_float} floatTexture - WebGL v1 extension\n * @property {WEBGL_lose_context} loseContext - WebGL v1 extension\n * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension\n * @property {EXT_texture_filter_anisotropic} anisotropicFiltering - WebGL v1 and v2 extension\n */\n _this.extensions = {};\n /**\n * Features supported by current context\n * @member {object}\n * @private\n * @readonly\n * @property {boolean} uint32Indices - Supports of 32-bit indices buffer\n */\n _this.supports = {\n uint32Indices: false,\n };\n // Bind functions\n _this.handleContextLost = _this.handleContextLost.bind(_this);\n _this.handleContextRestored = _this.handleContextRestored.bind(_this);\n renderer.view.addEventListener('webglcontextlost', _this.handleContextLost, false);\n renderer.view.addEventListener('webglcontextrestored', _this.handleContextRestored, false);\n return _this;\n }\n Object.defineProperty(ContextSystem.prototype, \"isLost\", {\n /**\n * `true` if the context is lost\n * @member {boolean}\n * @readonly\n */\n get: function () {\n return (!this.gl || this.gl.isContextLost());\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Handle the context change event\n * @param {WebGLRenderingContext} gl - new webgl context\n */\n ContextSystem.prototype.contextChange = function (gl) {\n this.gl = gl;\n this.renderer.gl = gl;\n this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++;\n // restore a context if it was previously lost\n if (gl.isContextLost() && gl.getExtension('WEBGL_lose_context')) {\n gl.getExtension('WEBGL_lose_context').restoreContext();\n }\n };\n /**\n * Initialize the context\n *\n * @protected\n * @param {WebGLRenderingContext} gl - WebGL context\n */\n ContextSystem.prototype.initFromContext = function (gl) {\n this.gl = gl;\n this.validateContext(gl);\n this.renderer.gl = gl;\n this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++;\n this.renderer.runners.contextChange.emit(gl);\n };\n /**\n * Initialize from context options\n *\n * @protected\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext\n * @param {object} options - context attributes\n */\n ContextSystem.prototype.initFromOptions = function (options) {\n var gl = this.createContext(this.renderer.view, options);\n this.initFromContext(gl);\n };\n /**\n * Helper class to create a WebGL Context\n *\n * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from\n * @param options {object} An options object that gets passed in to the canvas element containing the context attributes\n * @see https://developer.mozilla.org/en/docs/Web/API/HTMLCanvasElement/getContext\n * @return {WebGLRenderingContext} the WebGL context\n */\n ContextSystem.prototype.createContext = function (canvas, options) {\n var gl;\n if (_pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.PREFER_ENV >= _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.ENV.WEBGL2) {\n gl = canvas.getContext('webgl2', options);\n }\n if (gl) {\n this.webGLVersion = 2;\n }\n else {\n this.webGLVersion = 1;\n gl = canvas.getContext('webgl', options)\n || canvas.getContext('experimental-webgl', options);\n if (!gl) {\n // fail, not able to get a context\n throw new Error('This browser does not support WebGL. Try using the canvas renderer');\n }\n }\n this.gl = gl;\n this.getExtensions();\n return this.gl;\n };\n /**\n * Auto-populate the extensions\n *\n * @protected\n */\n ContextSystem.prototype.getExtensions = function () {\n // time to set up default extensions that Pixi uses.\n var gl = this.gl;\n if (this.webGLVersion === 1) {\n Object.assign(this.extensions, {\n drawBuffers: gl.getExtension('WEBGL_draw_buffers'),\n depthTexture: gl.getExtension('WEBGL_depth_texture'),\n loseContext: gl.getExtension('WEBGL_lose_context'),\n vertexArrayObject: gl.getExtension('OES_vertex_array_object')\n || gl.getExtension('MOZ_OES_vertex_array_object')\n || gl.getExtension('WEBKIT_OES_vertex_array_object'),\n anisotropicFiltering: gl.getExtension('EXT_texture_filter_anisotropic'),\n uint32ElementIndex: gl.getExtension('OES_element_index_uint'),\n // Floats and half-floats\n floatTexture: gl.getExtension('OES_texture_float'),\n floatTextureLinear: gl.getExtension('OES_texture_float_linear'),\n textureHalfFloat: gl.getExtension('OES_texture_half_float'),\n textureHalfFloatLinear: gl.getExtension('OES_texture_half_float_linear'),\n });\n }\n else if (this.webGLVersion === 2) {\n Object.assign(this.extensions, {\n anisotropicFiltering: gl.getExtension('EXT_texture_filter_anisotropic'),\n // Floats and half-floats\n colorBufferFloat: gl.getExtension('EXT_color_buffer_float'),\n floatTextureLinear: gl.getExtension('OES_texture_float_linear'),\n });\n }\n };\n /**\n * Handles a lost webgl context\n *\n * @protected\n * @param {WebGLContextEvent} event - The context lost event.\n */\n ContextSystem.prototype.handleContextLost = function (event) {\n event.preventDefault();\n };\n /**\n * Handles a restored webgl context\n *\n * @protected\n */\n ContextSystem.prototype.handleContextRestored = function () {\n this.renderer.runners.contextChange.emit(this.gl);\n };\n ContextSystem.prototype.destroy = function () {\n var view = this.renderer.view;\n // remove listeners\n view.removeEventListener('webglcontextlost', this.handleContextLost);\n view.removeEventListener('webglcontextrestored', this.handleContextRestored);\n this.gl.useProgram(null);\n if (this.extensions.loseContext) {\n this.extensions.loseContext.loseContext();\n }\n };\n /**\n * Handle the post-render runner event\n *\n * @protected\n */\n ContextSystem.prototype.postrender = function () {\n if (this.renderer.renderingToScreen) {\n this.gl.flush();\n }\n };\n /**\n * Validate context\n *\n * @protected\n * @param {WebGLRenderingContext} gl - Render context\n */\n ContextSystem.prototype.validateContext = function (gl) {\n var attributes = gl.getContextAttributes();\n var isWebGl2 = 'WebGL2RenderingContext' in window && gl instanceof window.WebGL2RenderingContext;\n if (isWebGl2) {\n this.webGLVersion = 2;\n }\n // this is going to be fairly simple for now.. but at least we have room to grow!\n if (!attributes.stencil) {\n /* eslint-disable max-len, no-console */\n console.warn('Provided WebGL context does not have a stencil buffer, masks may not render correctly');\n /* eslint-enable max-len, no-console */\n }\n var hasuint32 = isWebGl2 || !!gl.getExtension('OES_element_index_uint');\n this.supports.uint32Indices = hasuint32;\n if (!hasuint32) {\n /* eslint-disable max-len, no-console */\n console.warn('Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly');\n /* eslint-enable max-len, no-console */\n }\n };\n return ContextSystem;\n}(System));\n\n/**\n * Internal framebuffer for WebGL context\n * @class\n * @memberof PIXI\n */\nvar GLFramebuffer = /** @class */ (function () {\n function GLFramebuffer(framebuffer) {\n /**\n * The WebGL framebuffer\n * @member {WebGLFramebuffer}\n */\n this.framebuffer = framebuffer;\n /**\n * stencil+depth , usually costs 32bits per pixel\n * @member {WebGLRenderbuffer}\n */\n this.stencil = null;\n /**\n * latest known version of framebuffer\n * @member {number}\n * @protected\n */\n this.dirtyId = 0;\n /**\n * latest known version of framebuffer format\n * @member {number}\n * @protected\n */\n this.dirtyFormat = 0;\n /**\n * latest known version of framebuffer size\n * @member {number}\n * @protected\n */\n this.dirtySize = 0;\n /**\n * Detected AA samples number\n * @member {PIXI.MSAA_QUALITY}\n */\n this.multisample = _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.MSAA_QUALITY.NONE;\n /**\n * In case MSAA, we use this Renderbuffer instead of colorTextures[0] when we write info\n * @member {WebGLRenderbuffer}\n */\n this.msaaBuffer = null;\n /**\n * In case we use MSAA, this is actual framebuffer that has colorTextures[0]\n * The contents of that framebuffer are read when we use that renderTexture in sprites\n * @member {PIXI.Framebuffer}\n */\n this.blitFramebuffer = null;\n }\n return GLFramebuffer;\n}());\n\nvar tempRectangle = new _pixi_math__WEBPACK_IMPORTED_MODULE_5__.Rectangle();\n/**\n * System plugin to the renderer to manage framebuffers.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nvar FramebufferSystem = /** @class */ (function (_super) {\n __extends(FramebufferSystem, _super);\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n function FramebufferSystem(renderer) {\n var _this = _super.call(this, renderer) || this;\n /**\n * A list of managed framebuffers\n * @member {PIXI.Framebuffer[]}\n * @readonly\n */\n _this.managedFramebuffers = [];\n /**\n * Framebuffer value that shows that we don't know what is bound\n * @member {Framebuffer}\n * @readonly\n */\n _this.unknownFramebuffer = new Framebuffer(10, 10);\n _this.msaaSamples = null;\n return _this;\n }\n /**\n * Sets up the renderer context and necessary buffers.\n */\n FramebufferSystem.prototype.contextChange = function () {\n var gl = this.gl = this.renderer.gl;\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n this.current = this.unknownFramebuffer;\n this.viewport = new _pixi_math__WEBPACK_IMPORTED_MODULE_5__.Rectangle();\n this.hasMRT = true;\n this.writeDepthTexture = true;\n this.disposeAll(true);\n // webgl2\n if (this.renderer.context.webGLVersion === 1) {\n // webgl 1!\n var nativeDrawBuffersExtension_1 = this.renderer.context.extensions.drawBuffers;\n var nativeDepthTextureExtension = this.renderer.context.extensions.depthTexture;\n if (_pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.PREFER_ENV === _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.ENV.WEBGL_LEGACY) {\n nativeDrawBuffersExtension_1 = null;\n nativeDepthTextureExtension = null;\n }\n if (nativeDrawBuffersExtension_1) {\n gl.drawBuffers = function (activeTextures) {\n return nativeDrawBuffersExtension_1.drawBuffersWEBGL(activeTextures);\n };\n }\n else {\n this.hasMRT = false;\n gl.drawBuffers = function () {\n // empty\n };\n }\n if (!nativeDepthTextureExtension) {\n this.writeDepthTexture = false;\n }\n }\n else {\n // WebGL2\n // cache possible MSAA samples\n this.msaaSamples = gl.getInternalformatParameter(gl.RENDERBUFFER, gl.RGBA8, gl.SAMPLES);\n }\n };\n /**\n * Bind a framebuffer\n *\n * @param {PIXI.Framebuffer} framebuffer\n * @param {PIXI.Rectangle} [frame] frame, default is framebuffer size\n */\n FramebufferSystem.prototype.bind = function (framebuffer, frame) {\n var gl = this.gl;\n if (framebuffer) {\n // TODO caching layer!\n var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer);\n if (this.current !== framebuffer) {\n this.current = framebuffer;\n gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer);\n }\n // make sure all textures are unbound..\n // now check for updates...\n if (fbo.dirtyId !== framebuffer.dirtyId) {\n fbo.dirtyId = framebuffer.dirtyId;\n if (fbo.dirtyFormat !== framebuffer.dirtyFormat) {\n fbo.dirtyFormat = framebuffer.dirtyFormat;\n this.updateFramebuffer(framebuffer);\n }\n else if (fbo.dirtySize !== framebuffer.dirtySize) {\n fbo.dirtySize = framebuffer.dirtySize;\n this.resizeFramebuffer(framebuffer);\n }\n }\n for (var i = 0; i < framebuffer.colorTextures.length; i++) {\n var tex = framebuffer.colorTextures[i];\n this.renderer.texture.unbind(tex.parentTextureArray || tex);\n }\n if (framebuffer.depthTexture) {\n this.renderer.texture.unbind(framebuffer.depthTexture);\n }\n if (frame) {\n this.setViewport(frame.x, frame.y, frame.width, frame.height);\n }\n else {\n this.setViewport(0, 0, framebuffer.width, framebuffer.height);\n }\n }\n else {\n if (this.current) {\n this.current = null;\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n }\n if (frame) {\n this.setViewport(frame.x, frame.y, frame.width, frame.height);\n }\n else {\n this.setViewport(0, 0, this.renderer.width, this.renderer.height);\n }\n }\n };\n /**\n * Set the WebGLRenderingContext's viewport.\n *\n * @param {Number} x - X position of viewport\n * @param {Number} y - Y position of viewport\n * @param {Number} width - Width of viewport\n * @param {Number} height - Height of viewport\n */\n FramebufferSystem.prototype.setViewport = function (x, y, width, height) {\n var v = this.viewport;\n if (v.width !== width || v.height !== height || v.x !== x || v.y !== y) {\n v.x = x;\n v.y = y;\n v.width = width;\n v.height = height;\n this.gl.viewport(x, y, width, height);\n }\n };\n Object.defineProperty(FramebufferSystem.prototype, \"size\", {\n /**\n * Get the size of the current width and height. Returns object with `width` and `height` values.\n *\n * @member {object}\n * @readonly\n */\n get: function () {\n if (this.current) {\n // TODO store temp\n return { x: 0, y: 0, width: this.current.width, height: this.current.height };\n }\n return { x: 0, y: 0, width: this.renderer.width, height: this.renderer.height };\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Clear the color of the context\n *\n * @param {Number} r - Red value from 0 to 1\n * @param {Number} g - Green value from 0 to 1\n * @param {Number} b - Blue value from 0 to 1\n * @param {Number} a - Alpha value from 0 to 1\n * @param {PIXI.BUFFER_BITS} [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks\n * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers.\n */\n FramebufferSystem.prototype.clear = function (r, g, b, a, mask) {\n if (mask === void 0) { mask = _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.BUFFER_BITS.COLOR | _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.BUFFER_BITS.DEPTH; }\n var gl = this.gl;\n // TODO clear color can be set only one right?\n gl.clearColor(r, g, b, a);\n gl.clear(mask);\n };\n /**\n * Initialize framebuffer for this context\n *\n * @protected\n * @param {PIXI.Framebuffer} framebuffer\n * @returns {PIXI.GLFramebuffer} created GLFramebuffer\n */\n FramebufferSystem.prototype.initFramebuffer = function (framebuffer) {\n var gl = this.gl;\n var fbo = new GLFramebuffer(gl.createFramebuffer());\n fbo.multisample = this.detectSamples(framebuffer.multisample);\n framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo;\n this.managedFramebuffers.push(framebuffer);\n framebuffer.disposeRunner.add(this);\n return fbo;\n };\n /**\n * Resize the framebuffer\n *\n * @protected\n * @param {PIXI.Framebuffer} framebuffer\n */\n FramebufferSystem.prototype.resizeFramebuffer = function (framebuffer) {\n var gl = this.gl;\n var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n if (fbo.stencil) {\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil);\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height);\n }\n var colorTextures = framebuffer.colorTextures;\n for (var i = 0; i < colorTextures.length; i++) {\n this.renderer.texture.bind(colorTextures[i], 0);\n }\n if (framebuffer.depthTexture) {\n this.renderer.texture.bind(framebuffer.depthTexture, 0);\n }\n };\n /**\n * Update the framebuffer\n *\n * @protected\n * @param {PIXI.Framebuffer} framebuffer\n */\n FramebufferSystem.prototype.updateFramebuffer = function (framebuffer) {\n var gl = this.gl;\n var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n // bind the color texture\n var colorTextures = framebuffer.colorTextures;\n var count = colorTextures.length;\n if (!gl.drawBuffers) {\n count = Math.min(count, 1);\n }\n if (fbo.multisample > 1) {\n fbo.msaaBuffer = gl.createRenderbuffer();\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.msaaBuffer);\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample, gl.RGBA8, framebuffer.width, framebuffer.height);\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, fbo.msaaBuffer);\n }\n var activeTextures = [];\n for (var i = 0; i < count; i++) {\n if (i === 0 && fbo.multisample > 1) {\n continue;\n }\n var texture = framebuffer.colorTextures[i];\n var parentTexture = texture.parentTextureArray || texture;\n this.renderer.texture.bind(parentTexture, 0);\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + i, texture.target, parentTexture._glTextures[this.CONTEXT_UID].texture, 0);\n activeTextures.push(gl.COLOR_ATTACHMENT0 + i);\n }\n if (activeTextures.length > 1) {\n gl.drawBuffers(activeTextures);\n }\n if (framebuffer.depthTexture) {\n var writeDepthTexture = this.writeDepthTexture;\n if (writeDepthTexture) {\n var depthTexture = framebuffer.depthTexture;\n this.renderer.texture.bind(depthTexture, 0);\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.TEXTURE_2D, depthTexture._glTextures[this.CONTEXT_UID].texture, 0);\n }\n }\n if (!fbo.stencil && (framebuffer.stencil || framebuffer.depth)) {\n fbo.stencil = gl.createRenderbuffer();\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil);\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height);\n // TODO.. this is depth AND stencil?\n if (!framebuffer.depthTexture) { // you can't have both, so one should take priority if enabled\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, fbo.stencil);\n }\n }\n };\n /**\n * Detects number of samples that is not more than a param but as close to it as possible\n *\n * @param {PIXI.MSAA_QUALITY} samples - number of samples\n * @returns {PIXI.MSAA_QUALITY} - recommended number of samples\n */\n FramebufferSystem.prototype.detectSamples = function (samples) {\n var msaaSamples = this.msaaSamples;\n var res = _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.MSAA_QUALITY.NONE;\n if (samples <= 1 || msaaSamples === null) {\n return res;\n }\n for (var i = 0; i < msaaSamples.length; i++) {\n if (msaaSamples[i] <= samples) {\n res = msaaSamples[i];\n break;\n }\n }\n if (res === 1) {\n res = _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.MSAA_QUALITY.NONE;\n }\n return res;\n };\n /**\n * Only works with WebGL2\n *\n * blits framebuffer to another of the same or bigger size\n * after that target framebuffer is bound\n *\n * Fails with WebGL warning if blits multisample framebuffer to different size\n *\n * @param {PIXI.Framebuffer} [framebuffer] - by default it blits \"into itself\", from renderBuffer to texture.\n * @param {PIXI.Rectangle} [sourcePixels] - source rectangle in pixels\n * @param {PIXI.Rectangle} [destPixels] - dest rectangle in pixels, assumed to be the same as sourcePixels\n */\n FramebufferSystem.prototype.blit = function (framebuffer, sourcePixels, destPixels) {\n var _a = this, current = _a.current, renderer = _a.renderer, gl = _a.gl, CONTEXT_UID = _a.CONTEXT_UID;\n if (renderer.context.webGLVersion !== 2) {\n return;\n }\n if (!current) {\n return;\n }\n var fbo = current.glFramebuffers[CONTEXT_UID];\n if (!fbo) {\n return;\n }\n if (!framebuffer) {\n if (fbo.multisample <= 1) {\n return;\n }\n if (!fbo.blitFramebuffer) {\n fbo.blitFramebuffer = new Framebuffer(current.width, current.height);\n fbo.blitFramebuffer.addColorTexture(0, current.colorTextures[0]);\n }\n framebuffer = fbo.blitFramebuffer;\n framebuffer.width = current.width;\n framebuffer.height = current.height;\n }\n if (!sourcePixels) {\n sourcePixels = tempRectangle;\n sourcePixels.width = current.width;\n sourcePixels.height = current.height;\n }\n if (!destPixels) {\n destPixels = sourcePixels;\n }\n var sameSize = sourcePixels.width === destPixels.width && sourcePixels.height === destPixels.height;\n this.bind(framebuffer);\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, fbo.framebuffer);\n gl.blitFramebuffer(sourcePixels.x, sourcePixels.y, sourcePixels.width, sourcePixels.height, destPixels.x, destPixels.y, destPixels.width, destPixels.height, gl.COLOR_BUFFER_BIT, sameSize ? gl.NEAREST : gl.LINEAR);\n };\n /**\n * Disposes framebuffer\n * @param {PIXI.Framebuffer} framebuffer - framebuffer that has to be disposed of\n * @param {boolean} [contextLost=false] - If context was lost, we suppress all delete function calls\n */\n FramebufferSystem.prototype.disposeFramebuffer = function (framebuffer, contextLost) {\n var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n var gl = this.gl;\n if (!fbo) {\n return;\n }\n delete framebuffer.glFramebuffers[this.CONTEXT_UID];\n var index = this.managedFramebuffers.indexOf(framebuffer);\n if (index >= 0) {\n this.managedFramebuffers.splice(index, 1);\n }\n framebuffer.disposeRunner.remove(this);\n if (!contextLost) {\n gl.deleteFramebuffer(fbo.framebuffer);\n if (fbo.stencil) {\n gl.deleteRenderbuffer(fbo.stencil);\n }\n }\n };\n /**\n * Disposes all framebuffers, but not textures bound to them\n * @param {boolean} [contextLost=false] - If context was lost, we suppress all delete function calls\n */\n FramebufferSystem.prototype.disposeAll = function (contextLost) {\n var list = this.managedFramebuffers;\n this.managedFramebuffers = [];\n for (var i = 0; i < list.length; i++) {\n this.disposeFramebuffer(list[i], contextLost);\n }\n };\n /**\n * Forcing creation of stencil buffer for current framebuffer, if it wasn't done before.\n * Used by MaskSystem, when its time to use stencil mask for Graphics element.\n *\n * Its an alternative for public lazy `framebuffer.enableStencil`, in case we need stencil without rebind.\n *\n * @private\n */\n FramebufferSystem.prototype.forceStencil = function () {\n var framebuffer = this.current;\n if (!framebuffer) {\n return;\n }\n var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n if (!fbo || fbo.stencil) {\n return;\n }\n framebuffer.enableStencil();\n var w = framebuffer.width;\n var h = framebuffer.height;\n var gl = this.gl;\n var stencil = gl.createRenderbuffer();\n gl.bindRenderbuffer(gl.RENDERBUFFER, stencil);\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, w, h);\n fbo.stencil = stencil;\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, stencil);\n };\n /**\n * resets framebuffer stored state, binds screen framebuffer\n *\n * should be called before renderTexture reset()\n */\n FramebufferSystem.prototype.reset = function () {\n this.current = this.unknownFramebuffer;\n this.viewport = new _pixi_math__WEBPACK_IMPORTED_MODULE_5__.Rectangle();\n };\n return FramebufferSystem;\n}(System));\n\nvar GLBuffer = /** @class */ (function () {\n function GLBuffer(buffer) {\n this.buffer = buffer || null;\n this.updateID = -1;\n this.byteLength = -1;\n this.refCount = 0;\n }\n return GLBuffer;\n}());\n\nvar byteSizeMap$1 = { 5126: 4, 5123: 2, 5121: 1 };\n/**\n * System plugin to the renderer to manage geometry.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nvar GeometrySystem = /** @class */ (function (_super) {\n __extends(GeometrySystem, _super);\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n function GeometrySystem(renderer) {\n var _this = _super.call(this, renderer) || this;\n _this._activeGeometry = null;\n _this._activeVao = null;\n /**\n * `true` if we has `*_vertex_array_object` extension\n * @member {boolean}\n * @readonly\n */\n _this.hasVao = true;\n /**\n * `true` if has `ANGLE_instanced_arrays` extension\n * @member {boolean}\n * @readonly\n */\n _this.hasInstance = true;\n /**\n * `true` if support `gl.UNSIGNED_INT` in `gl.drawElements` or `gl.drawElementsInstanced`\n * @member {boolean}\n * @readonly\n */\n _this.canUseUInt32ElementIndex = false;\n /**\n * Cache for all geometries by id, used in case renderer gets destroyed or for profiling\n * @member {object}\n * @readonly\n */\n _this.managedGeometries = {};\n /**\n * Cache for all buffers by id, used in case renderer gets destroyed or for profiling\n * @member {object}\n * @readonly\n */\n _this.managedBuffers = {};\n return _this;\n }\n /**\n * Sets up the renderer context and necessary buffers.\n */\n GeometrySystem.prototype.contextChange = function () {\n this.disposeAll(true);\n var gl = this.gl = this.renderer.gl;\n var context = this.renderer.context;\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n // webgl2\n if (context.webGLVersion !== 2) {\n // webgl 1!\n var nativeVaoExtension_1 = this.renderer.context.extensions.vertexArrayObject;\n if (_pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.PREFER_ENV === _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.ENV.WEBGL_LEGACY) {\n nativeVaoExtension_1 = null;\n }\n if (nativeVaoExtension_1) {\n gl.createVertexArray = function () {\n return nativeVaoExtension_1.createVertexArrayOES();\n };\n gl.bindVertexArray = function (vao) {\n return nativeVaoExtension_1.bindVertexArrayOES(vao);\n };\n gl.deleteVertexArray = function (vao) {\n return nativeVaoExtension_1.deleteVertexArrayOES(vao);\n };\n }\n else {\n this.hasVao = false;\n gl.createVertexArray = function () {\n return null;\n };\n gl.bindVertexArray = function () {\n return null;\n };\n gl.deleteVertexArray = function () {\n return null;\n };\n }\n }\n if (context.webGLVersion !== 2) {\n var instanceExt_1 = gl.getExtension('ANGLE_instanced_arrays');\n if (instanceExt_1) {\n gl.vertexAttribDivisor = function (a, b) {\n return instanceExt_1.vertexAttribDivisorANGLE(a, b);\n };\n gl.drawElementsInstanced = function (a, b, c, d, e) {\n return instanceExt_1.drawElementsInstancedANGLE(a, b, c, d, e);\n };\n gl.drawArraysInstanced = function (a, b, c, d) {\n return instanceExt_1.drawArraysInstancedANGLE(a, b, c, d);\n };\n }\n else {\n this.hasInstance = false;\n }\n }\n this.canUseUInt32ElementIndex = context.webGLVersion === 2 || !!context.extensions.uint32ElementIndex;\n };\n /**\n * Binds geometry so that is can be drawn. Creating a Vao if required\n *\n * @param {PIXI.Geometry} geometry - instance of geometry to bind\n * @param {PIXI.Shader} [shader] - instance of shader to use vao for\n */\n GeometrySystem.prototype.bind = function (geometry, shader) {\n shader = shader || this.renderer.shader.shader;\n var gl = this.gl;\n // not sure the best way to address this..\n // currently different shaders require different VAOs for the same geometry\n // Still mulling over the best way to solve this one..\n // will likely need to modify the shader attribute locations at run time!\n var vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n var incRefCount = false;\n if (!vaos) {\n this.managedGeometries[geometry.id] = geometry;\n geometry.disposeRunner.add(this);\n geometry.glVertexArrayObjects[this.CONTEXT_UID] = vaos = {};\n incRefCount = true;\n }\n var vao = vaos[shader.program.id] || this.initGeometryVao(geometry, shader.program, incRefCount);\n this._activeGeometry = geometry;\n if (this._activeVao !== vao) {\n this._activeVao = vao;\n if (this.hasVao) {\n gl.bindVertexArray(vao);\n }\n else {\n this.activateVao(geometry, shader.program);\n }\n }\n // TODO - optimise later!\n // don't need to loop through if nothing changed!\n // maybe look to add an 'autoupdate' to geometry?\n this.updateBuffers();\n };\n /**\n * Reset and unbind any active VAO and geometry\n */\n GeometrySystem.prototype.reset = function () {\n this.unbind();\n };\n /**\n * Update buffers\n * @protected\n */\n GeometrySystem.prototype.updateBuffers = function () {\n var geometry = this._activeGeometry;\n var gl = this.gl;\n for (var i = 0; i < geometry.buffers.length; i++) {\n var buffer = geometry.buffers[i];\n var glBuffer = buffer._glBuffers[this.CONTEXT_UID];\n if (buffer._updateID !== glBuffer.updateID) {\n glBuffer.updateID = buffer._updateID;\n // TODO can cache this on buffer! maybe added a getter / setter?\n var type = buffer.index ? gl.ELEMENT_ARRAY_BUFFER : gl.ARRAY_BUFFER;\n // TODO this could change if the VAO changes...\n // need to come up with a better way to cache..\n // if (this.boundBuffers[type] !== glBuffer)\n // {\n // this.boundBuffers[type] = glBuffer;\n gl.bindBuffer(type, glBuffer.buffer);\n // }\n this._boundBuffer = glBuffer;\n if (glBuffer.byteLength >= buffer.data.byteLength) {\n // offset is always zero for now!\n gl.bufferSubData(type, 0, buffer.data);\n }\n else {\n var drawType = buffer.static ? gl.STATIC_DRAW : gl.DYNAMIC_DRAW;\n glBuffer.byteLength = buffer.data.byteLength;\n gl.bufferData(type, buffer.data, drawType);\n }\n }\n }\n };\n /**\n * Check compability between a geometry and a program\n * @protected\n * @param {PIXI.Geometry} geometry - Geometry instance\n * @param {PIXI.Program} program - Program instance\n */\n GeometrySystem.prototype.checkCompatibility = function (geometry, program) {\n // geometry must have at least all the attributes that the shader requires.\n var geometryAttributes = geometry.attributes;\n var shaderAttributes = program.attributeData;\n for (var j in shaderAttributes) {\n if (!geometryAttributes[j]) {\n throw new Error(\"shader and geometry incompatible, geometry missing the \\\"\" + j + \"\\\" attribute\");\n }\n }\n };\n /**\n * Takes a geometry and program and generates a unique signature for them.\n *\n * @param {PIXI.Geometry} geometry - to get signature from\n * @param {PIXI.Program} program - to test geometry against\n * @returns {String} Unique signature of the geometry and program\n * @protected\n */\n GeometrySystem.prototype.getSignature = function (geometry, program) {\n var attribs = geometry.attributes;\n var shaderAttributes = program.attributeData;\n var strings = ['g', geometry.id];\n for (var i in attribs) {\n if (shaderAttributes[i]) {\n strings.push(i);\n }\n }\n return strings.join('-');\n };\n /**\n * Creates or gets Vao with the same structure as the geometry and stores it on the geometry.\n * If vao is created, it is bound automatically.\n *\n * @protected\n * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for\n * @param {PIXI.Program} program - Instance of program\n * @param {boolean} [incRefCount=false] - Increment refCount of all geometry buffers\n */\n GeometrySystem.prototype.initGeometryVao = function (geometry, program, incRefCount) {\n if (incRefCount === void 0) { incRefCount = true; }\n this.checkCompatibility(geometry, program);\n var gl = this.gl;\n var CONTEXT_UID = this.CONTEXT_UID;\n var signature = this.getSignature(geometry, program);\n var vaoObjectHash = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n var vao = vaoObjectHash[signature];\n if (vao) {\n // this will give us easy access to the vao\n vaoObjectHash[program.id] = vao;\n return vao;\n }\n var buffers = geometry.buffers;\n var attributes = geometry.attributes;\n var tempStride = {};\n var tempStart = {};\n for (var j in buffers) {\n tempStride[j] = 0;\n tempStart[j] = 0;\n }\n for (var j in attributes) {\n if (!attributes[j].size && program.attributeData[j]) {\n attributes[j].size = program.attributeData[j].size;\n }\n else if (!attributes[j].size) {\n console.warn(\"PIXI Geometry attribute '\" + j + \"' size cannot be determined (likely the bound shader does not have the attribute)\"); // eslint-disable-line\n }\n tempStride[attributes[j].buffer] += attributes[j].size * byteSizeMap$1[attributes[j].type];\n }\n for (var j in attributes) {\n var attribute = attributes[j];\n var attribSize = attribute.size;\n if (attribute.stride === undefined) {\n if (tempStride[attribute.buffer] === attribSize * byteSizeMap$1[attribute.type]) {\n attribute.stride = 0;\n }\n else {\n attribute.stride = tempStride[attribute.buffer];\n }\n }\n if (attribute.start === undefined) {\n attribute.start = tempStart[attribute.buffer];\n tempStart[attribute.buffer] += attribSize * byteSizeMap$1[attribute.type];\n }\n }\n vao = gl.createVertexArray();\n gl.bindVertexArray(vao);\n // first update - and create the buffers!\n // only create a gl buffer if it actually gets\n for (var i = 0; i < buffers.length; i++) {\n var buffer = buffers[i];\n if (!buffer._glBuffers[CONTEXT_UID]) {\n buffer._glBuffers[CONTEXT_UID] = new GLBuffer(gl.createBuffer());\n this.managedBuffers[buffer.id] = buffer;\n buffer.disposeRunner.add(this);\n }\n if (incRefCount) {\n buffer._glBuffers[CONTEXT_UID].refCount++;\n }\n }\n // TODO - maybe make this a data object?\n // lets wait to see if we need to first!\n this.activateVao(geometry, program);\n this._activeVao = vao;\n // add it to the cache!\n vaoObjectHash[program.id] = vao;\n vaoObjectHash[signature] = vao;\n return vao;\n };\n /**\n * Disposes buffer\n * @param {PIXI.Buffer} buffer - buffer with data\n * @param {boolean} [contextLost=false] - If context was lost, we suppress deleteVertexArray\n */\n GeometrySystem.prototype.disposeBuffer = function (buffer, contextLost) {\n if (!this.managedBuffers[buffer.id]) {\n return;\n }\n delete this.managedBuffers[buffer.id];\n var glBuffer = buffer._glBuffers[this.CONTEXT_UID];\n var gl = this.gl;\n buffer.disposeRunner.remove(this);\n if (!glBuffer) {\n return;\n }\n if (!contextLost) {\n gl.deleteBuffer(glBuffer.buffer);\n }\n delete buffer._glBuffers[this.CONTEXT_UID];\n };\n /**\n * Disposes geometry\n * @param {PIXI.Geometry} geometry - Geometry with buffers. Only VAO will be disposed\n * @param {boolean} [contextLost=false] - If context was lost, we suppress deleteVertexArray\n */\n GeometrySystem.prototype.disposeGeometry = function (geometry, contextLost) {\n if (!this.managedGeometries[geometry.id]) {\n return;\n }\n delete this.managedGeometries[geometry.id];\n var vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n var gl = this.gl;\n var buffers = geometry.buffers;\n geometry.disposeRunner.remove(this);\n if (!vaos) {\n return;\n }\n for (var i = 0; i < buffers.length; i++) {\n var buf = buffers[i]._glBuffers[this.CONTEXT_UID];\n buf.refCount--;\n if (buf.refCount === 0 && !contextLost) {\n this.disposeBuffer(buffers[i], contextLost);\n }\n }\n if (!contextLost) {\n for (var vaoId in vaos) {\n // delete only signatures, everything else are copies\n if (vaoId[0] === 'g') {\n var vao = vaos[vaoId];\n if (this._activeVao === vao) {\n this.unbind();\n }\n gl.deleteVertexArray(vao);\n }\n }\n }\n delete geometry.glVertexArrayObjects[this.CONTEXT_UID];\n };\n /**\n * dispose all WebGL resources of all managed geometries and buffers\n * @param {boolean} [contextLost=false] - If context was lost, we suppress `gl.delete` calls\n */\n GeometrySystem.prototype.disposeAll = function (contextLost) {\n var all = Object.keys(this.managedGeometries);\n for (var i = 0; i < all.length; i++) {\n this.disposeGeometry(this.managedGeometries[all[i]], contextLost);\n }\n all = Object.keys(this.managedBuffers);\n for (var i = 0; i < all.length; i++) {\n this.disposeBuffer(this.managedBuffers[all[i]], contextLost);\n }\n };\n /**\n * Activate vertex array object\n *\n * @protected\n * @param {PIXI.Geometry} geometry - Geometry instance\n * @param {PIXI.Program} program - Shader program instance\n */\n GeometrySystem.prototype.activateVao = function (geometry, program) {\n var gl = this.gl;\n var CONTEXT_UID = this.CONTEXT_UID;\n var buffers = geometry.buffers;\n var attributes = geometry.attributes;\n if (geometry.indexBuffer) {\n // first update the index buffer if we have one..\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, geometry.indexBuffer._glBuffers[CONTEXT_UID].buffer);\n }\n var lastBuffer = null;\n // add a new one!\n for (var j in attributes) {\n var attribute = attributes[j];\n var buffer = buffers[attribute.buffer];\n var glBuffer = buffer._glBuffers[CONTEXT_UID];\n if (program.attributeData[j]) {\n if (lastBuffer !== glBuffer) {\n gl.bindBuffer(gl.ARRAY_BUFFER, glBuffer.buffer);\n lastBuffer = glBuffer;\n }\n var location = program.attributeData[j].location;\n // TODO introduce state again\n // we can optimise this for older devices that have no VAOs\n gl.enableVertexAttribArray(location);\n gl.vertexAttribPointer(location, attribute.size, attribute.type || gl.FLOAT, attribute.normalized, attribute.stride, attribute.start);\n if (attribute.instance) {\n // TODO calculate instance count based of this...\n if (this.hasInstance) {\n gl.vertexAttribDivisor(location, 1);\n }\n else {\n throw new Error('geometry error, GPU Instancing is not supported on this device');\n }\n }\n }\n }\n };\n /**\n * Draw the geometry\n *\n * @param {Number} type - the type primitive to render\n * @param {Number} [size] - the number of elements to be rendered\n * @param {Number} [start] - Starting index\n * @param {Number} [instanceCount] - the number of instances of the set of elements to execute\n */\n GeometrySystem.prototype.draw = function (type, size, start, instanceCount) {\n var gl = this.gl;\n var geometry = this._activeGeometry;\n // TODO.. this should not change so maybe cache the function?\n if (geometry.indexBuffer) {\n var byteSize = geometry.indexBuffer.data.BYTES_PER_ELEMENT;\n var glType = byteSize === 2 ? gl.UNSIGNED_SHORT : gl.UNSIGNED_INT;\n if (byteSize === 2 || (byteSize === 4 && this.canUseUInt32ElementIndex)) {\n if (geometry.instanced) {\n /* eslint-disable max-len */\n gl.drawElementsInstanced(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize, instanceCount || 1);\n /* eslint-enable max-len */\n }\n else {\n /* eslint-disable max-len */\n gl.drawElements(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize);\n /* eslint-enable max-len */\n }\n }\n else {\n console.warn('unsupported index buffer type: uint32');\n }\n }\n else if (geometry.instanced) {\n // TODO need a better way to calculate size..\n gl.drawArraysInstanced(type, start, size || geometry.getSize(), instanceCount || 1);\n }\n else {\n gl.drawArrays(type, start, size || geometry.getSize());\n }\n return this;\n };\n /**\n * Unbind/reset everything\n * @protected\n */\n GeometrySystem.prototype.unbind = function () {\n this.gl.bindVertexArray(null);\n this._activeVao = null;\n this._activeGeometry = null;\n };\n return GeometrySystem;\n}(System));\n\n/**\n * Component for masked elements\n *\n * Holds mask mode and temporary data about current mask\n *\n * @class\n * @memberof PIXI\n */\nvar MaskData = /** @class */ (function () {\n /**\n * Create MaskData\n *\n * @param {PIXI.DisplayObject} [maskObject=null] - object that describes the mask\n */\n function MaskData(maskObject) {\n if (maskObject === void 0) { maskObject = null; }\n /**\n * Mask type\n * @member {PIXI.MASK_TYPES}\n */\n this.type = _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.MASK_TYPES.NONE;\n /**\n * Whether we know the mask type beforehand\n * @member {boolean}\n * @default true\n */\n this.autoDetect = true;\n /**\n * Which element we use to mask\n * @member {PIXI.DisplayObject}\n */\n this.maskObject = maskObject || null;\n /**\n * Whether it belongs to MaskSystem pool\n * @member {boolean}\n */\n this.pooled = false;\n /**\n * Indicator of the type\n * @member {boolean}\n */\n this.isMaskData = true;\n /**\n * Stencil counter above the mask in stack\n * @member {number}\n * @private\n */\n this._stencilCounter = 0;\n /**\n * Scissor counter above the mask in stack\n * @member {number}\n * @private\n */\n this._scissorCounter = 0;\n /**\n * Scissor operation above the mask in stack.\n * Null if _scissorCounter is zero, rectangle instance if positive.\n * @member {PIXI.Rectangle}\n */\n this._scissorRect = null;\n /**\n * Targeted element. Temporary variable set by MaskSystem\n * @member {PIXI.DisplayObject}\n * @private\n */\n this._target = null;\n }\n /**\n * resets the mask data after popMask()\n */\n MaskData.prototype.reset = function () {\n if (this.pooled) {\n this.maskObject = null;\n this.type = _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.MASK_TYPES.NONE;\n this.autoDetect = true;\n }\n this._target = null;\n };\n /**\n * copies counters from maskData above, called from pushMask()\n * @param {PIXI.MaskData|null} maskAbove\n */\n MaskData.prototype.copyCountersOrReset = function (maskAbove) {\n if (maskAbove) {\n this._stencilCounter = maskAbove._stencilCounter;\n this._scissorCounter = maskAbove._scissorCounter;\n this._scissorRect = maskAbove._scissorRect;\n }\n else {\n this._stencilCounter = 0;\n this._scissorCounter = 0;\n this._scissorRect = null;\n }\n };\n return MaskData;\n}());\n\n/**\n * @private\n * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram}\n * @param type {Number} the type, can be either VERTEX_SHADER or FRAGMENT_SHADER\n * @param src {string} The vertex shader source as an array of strings.\n * @return {WebGLShader} the shader\n */\nfunction compileShader(gl, type, src) {\n var shader = gl.createShader(type);\n gl.shaderSource(shader, src);\n gl.compileShader(shader);\n return shader;\n}\n/**\n * @method compileProgram\n * @private\n * @memberof PIXI.glCore.shader\n * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram}\n * @param vertexSrc {string|string[]} The vertex shader source as an array of strings.\n * @param fragmentSrc {string|string[]} The fragment shader source as an array of strings.\n * @param attributeLocations {Object} An attribute location map that lets you manually set the attribute locations\n * @return {WebGLProgram} the shader program\n */\nfunction compileProgram(gl, vertexSrc, fragmentSrc, attributeLocations) {\n var glVertShader = compileShader(gl, gl.VERTEX_SHADER, vertexSrc);\n var glFragShader = compileShader(gl, gl.FRAGMENT_SHADER, fragmentSrc);\n var program = gl.createProgram();\n gl.attachShader(program, glVertShader);\n gl.attachShader(program, glFragShader);\n // optionally, set the attributes manually for the program rather than letting WebGL decide..\n if (attributeLocations) {\n for (var i in attributeLocations) {\n gl.bindAttribLocation(program, attributeLocations[i], i);\n }\n }\n gl.linkProgram(program);\n // if linking fails, then log and cleanup\n if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {\n if (!gl.getShaderParameter(glVertShader, gl.COMPILE_STATUS)) {\n console.warn(vertexSrc);\n console.error(gl.getShaderInfoLog(glVertShader));\n }\n if (!gl.getShaderParameter(glFragShader, gl.COMPILE_STATUS)) {\n console.warn(fragmentSrc);\n console.error(gl.getShaderInfoLog(glFragShader));\n }\n console.error('Pixi.js Error: Could not initialize shader.');\n console.error('gl.VALIDATE_STATUS', gl.getProgramParameter(program, gl.VALIDATE_STATUS));\n console.error('gl.getError()', gl.getError());\n // if there is a program info log, log it\n if (gl.getProgramInfoLog(program) !== '') {\n console.warn('Pixi.js Warning: gl.getProgramInfoLog()', gl.getProgramInfoLog(program));\n }\n gl.deleteProgram(program);\n program = null;\n }\n // clean up some shaders\n gl.deleteShader(glVertShader);\n gl.deleteShader(glFragShader);\n return program;\n}\n\nfunction booleanArray(size) {\n var array = new Array(size);\n for (var i = 0; i < array.length; i++) {\n array[i] = false;\n }\n return array;\n}\n/**\n * @method defaultValue\n * @memberof PIXI.glCore.shader\n * @param type {String} Type of value\n * @param size {Number}\n * @private\n */\nfunction defaultValue(type, size) {\n switch (type) {\n case 'float':\n return 0;\n case 'vec2':\n return new Float32Array(2 * size);\n case 'vec3':\n return new Float32Array(3 * size);\n case 'vec4':\n return new Float32Array(4 * size);\n case 'int':\n case 'sampler2D':\n case 'sampler2DArray':\n return 0;\n case 'ivec2':\n return new Int32Array(2 * size);\n case 'ivec3':\n return new Int32Array(3 * size);\n case 'ivec4':\n return new Int32Array(4 * size);\n case 'bool':\n return false;\n case 'bvec2':\n return booleanArray(2 * size);\n case 'bvec3':\n return booleanArray(3 * size);\n case 'bvec4':\n return booleanArray(4 * size);\n case 'mat2':\n return new Float32Array([1, 0,\n 0, 1]);\n case 'mat3':\n return new Float32Array([1, 0, 0,\n 0, 1, 0,\n 0, 0, 1]);\n case 'mat4':\n return new Float32Array([1, 0, 0, 0,\n 0, 1, 0, 0,\n 0, 0, 1, 0,\n 0, 0, 0, 1]);\n }\n return null;\n}\n\nvar unknownContext = {};\nvar context = unknownContext;\n/**\n * returns a little WebGL context to use for program inspection.\n *\n * @static\n * @private\n * @returns {WebGLRenderingContext} a gl context to test with\n */\nfunction getTestContext() {\n if (context === unknownContext || (context && context.isContextLost())) {\n var canvas = document.createElement('canvas');\n var gl = void 0;\n if (_pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.PREFER_ENV >= _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.ENV.WEBGL2) {\n gl = canvas.getContext('webgl2', {});\n }\n if (!gl) {\n gl = canvas.getContext('webgl', {})\n || canvas.getContext('experimental-webgl', {});\n if (!gl) {\n // fail, not able to get a context\n gl = null;\n }\n else {\n // for shader testing..\n gl.getExtension('WEBGL_draw_buffers');\n }\n }\n context = gl;\n }\n return context;\n}\n\nvar maxFragmentPrecision;\nfunction getMaxFragmentPrecision() {\n if (!maxFragmentPrecision) {\n maxFragmentPrecision = _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.PRECISION.MEDIUM;\n var gl = getTestContext();\n if (gl) {\n if (gl.getShaderPrecisionFormat) {\n var shaderFragment = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT);\n maxFragmentPrecision = shaderFragment.precision ? _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.PRECISION.HIGH : _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.PRECISION.MEDIUM;\n }\n }\n }\n return maxFragmentPrecision;\n}\n\n/**\n * Sets the float precision on the shader, ensuring the device supports the request precision.\n * If the precision is already present, it just ensures that the device is able to handle it.\n *\n * @private\n * @param {string} src - The shader source\n * @param {string} requestedPrecision - The request float precision of the shader. Options are 'lowp', 'mediump' or 'highp'.\n * @param {string} maxSupportedPrecision - The maximum precision the shader supports.\n *\n * @return {string} modified shader source\n */\nfunction setPrecision(src, requestedPrecision, maxSupportedPrecision) {\n if (src.substring(0, 9) !== 'precision') {\n // no precision supplied, so PixiJS will add the requested level.\n var precision = requestedPrecision;\n // If highp is requested but not supported, downgrade precision to a level all devices support.\n if (requestedPrecision === _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.PRECISION.HIGH && maxSupportedPrecision !== _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.PRECISION.HIGH) {\n precision = _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.PRECISION.MEDIUM;\n }\n return \"precision \" + precision + \" float;\\n\" + src;\n }\n else if (maxSupportedPrecision !== _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.PRECISION.HIGH && src.substring(0, 15) === 'precision highp') {\n // precision was supplied, but at a level this device does not support, so downgrading to mediump.\n return src.replace('precision highp', 'precision mediump');\n }\n return src;\n}\n\nvar GLSL_TO_SIZE = {\n float: 1,\n vec2: 2,\n vec3: 3,\n vec4: 4,\n int: 1,\n ivec2: 2,\n ivec3: 3,\n ivec4: 4,\n bool: 1,\n bvec2: 2,\n bvec3: 3,\n bvec4: 4,\n mat2: 4,\n mat3: 9,\n mat4: 16,\n sampler2D: 1,\n};\n/**\n * @private\n * @method mapSize\n * @memberof PIXI.glCore.shader\n * @param type {String}\n * @return {Number}\n */\nfunction mapSize(type) {\n return GLSL_TO_SIZE[type];\n}\n\nvar GL_TABLE = null;\nvar GL_TO_GLSL_TYPES = {\n FLOAT: 'float',\n FLOAT_VEC2: 'vec2',\n FLOAT_VEC3: 'vec3',\n FLOAT_VEC4: 'vec4',\n INT: 'int',\n INT_VEC2: 'ivec2',\n INT_VEC3: 'ivec3',\n INT_VEC4: 'ivec4',\n BOOL: 'bool',\n BOOL_VEC2: 'bvec2',\n BOOL_VEC3: 'bvec3',\n BOOL_VEC4: 'bvec4',\n FLOAT_MAT2: 'mat2',\n FLOAT_MAT3: 'mat3',\n FLOAT_MAT4: 'mat4',\n SAMPLER_2D: 'sampler2D',\n INT_SAMPLER_2D: 'sampler2D',\n UNSIGNED_INT_SAMPLER_2D: 'sampler2D',\n SAMPLER_CUBE: 'samplerCube',\n INT_SAMPLER_CUBE: 'samplerCube',\n UNSIGNED_INT_SAMPLER_CUBE: 'samplerCube',\n SAMPLER_2D_ARRAY: 'sampler2DArray',\n INT_SAMPLER_2D_ARRAY: 'sampler2DArray',\n UNSIGNED_INT_SAMPLER_2D_ARRAY: 'sampler2DArray',\n};\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nfunction mapType(gl, type) {\n if (!GL_TABLE) {\n var typeNames = Object.keys(GL_TO_GLSL_TYPES);\n GL_TABLE = {};\n for (var i = 0; i < typeNames.length; ++i) {\n var tn = typeNames[i];\n GL_TABLE[gl[tn]] = GL_TO_GLSL_TYPES[tn];\n }\n }\n return GL_TABLE[type];\n}\n\n/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n// Parsers, each one of these will take a look at the type of shader property and uniform.\n// if they pass the test function then the code function is called that returns a the shader upload code for that uniform.\n// Shader upload code is automagically generated with these parsers.\n// If no parser is valid then the default upload functions are used.\n// exposing Parsers means that custom upload logic can be added to pixi's shaders.\n// A good example would be a pixi rectangle can be directly set on a uniform.\n// If the shader sees it it knows how to upload the rectangle structure as a vec4\n// format is as follows:\n//\n// {\n// test: (data, uniform) => {} <--- test is this code should be used for this uniform\n// code: (name, uniform) => {} <--- returns the string of the piece of code that uploads the uniform\n// }\nvar uniformParsers = [\n // a float cache layer\n {\n test: function (data) {\n return data.type === 'float' && data.size === 1;\n },\n code: function (name) {\n return \"\\n if(uv[\\\"\" + name + \"\\\"] !== ud[\\\"\" + name + \"\\\"].value)\\n {\\n ud[\\\"\" + name + \"\\\"].value = uv[\\\"\" + name + \"\\\"]\\n gl.uniform1f(ud[\\\"\" + name + \"\\\"].location, uv[\\\"\" + name + \"\\\"])\\n }\\n \";\n },\n },\n // handling samplers\n {\n test: function (data) {\n // eslint-disable-next-line max-len\n return (data.type === 'sampler2D' || data.type === 'samplerCube' || data.type === 'sampler2DArray') && data.size === 1 && !data.isArray;\n },\n code: function (name) { return \"t = syncData.textureCount++;\\n\\n renderer.texture.bind(uv[\\\"\" + name + \"\\\"], t);\\n\\n if(ud[\\\"\" + name + \"\\\"].value !== t)\\n {\\n ud[\\\"\" + name + \"\\\"].value = t;\\n gl.uniform1i(ud[\\\"\" + name + \"\\\"].location, t);\\n; // eslint-disable-line max-len\\n }\"; },\n },\n // uploading pixi matrix object to mat3\n {\n test: function (data, uniform) {\n return data.type === 'mat3' && data.size === 1 && uniform.a !== undefined;\n },\n code: function (name) {\n // TODO and some smart caching dirty ids here!\n return \"\\n gl.uniformMatrix3fv(ud[\\\"\" + name + \"\\\"].location, false, uv[\\\"\" + name + \"\\\"].toArray(true));\\n \";\n },\n },\n // uploading a pixi point as a vec2 with caching layer\n {\n test: function (data, uniform) {\n return data.type === 'vec2' && data.size === 1 && uniform.x !== undefined;\n },\n code: function (name) {\n return \"\\n cv = ud[\\\"\" + name + \"\\\"].value;\\n v = uv[\\\"\" + name + \"\\\"];\\n\\n if(cv[0] !== v.x || cv[1] !== v.y)\\n {\\n cv[0] = v.x;\\n cv[1] = v.y;\\n gl.uniform2f(ud[\\\"\" + name + \"\\\"].location, v.x, v.y);\\n }\";\n },\n },\n // caching layer for a vec2\n {\n test: function (data) {\n return data.type === 'vec2' && data.size === 1;\n },\n code: function (name) {\n return \"\\n cv = ud[\\\"\" + name + \"\\\"].value;\\n v = uv[\\\"\" + name + \"\\\"];\\n\\n if(cv[0] !== v[0] || cv[1] !== v[1])\\n {\\n cv[0] = v[0];\\n cv[1] = v[1];\\n gl.uniform2f(ud[\\\"\" + name + \"\\\"].location, v[0], v[1]);\\n }\\n \";\n },\n },\n // upload a pixi rectangle as a vec4 with caching layer\n {\n test: function (data, uniform) {\n return data.type === 'vec4' && data.size === 1 && uniform.width !== undefined;\n },\n code: function (name) {\n return \"\\n cv = ud[\\\"\" + name + \"\\\"].value;\\n v = uv[\\\"\" + name + \"\\\"];\\n\\n if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)\\n {\\n cv[0] = v.x;\\n cv[1] = v.y;\\n cv[2] = v.width;\\n cv[3] = v.height;\\n gl.uniform4f(ud[\\\"\" + name + \"\\\"].location, v.x, v.y, v.width, v.height)\\n }\";\n },\n },\n // a caching layer for vec4 uploading\n {\n test: function (data) {\n return data.type === 'vec4' && data.size === 1;\n },\n code: function (name) {\n return \"\\n cv = ud[\\\"\" + name + \"\\\"].value;\\n v = uv[\\\"\" + name + \"\\\"];\\n\\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\\n {\\n cv[0] = v[0];\\n cv[1] = v[1];\\n cv[2] = v[2];\\n cv[3] = v[3];\\n\\n gl.uniform4f(ud[\\\"\" + name + \"\\\"].location, v[0], v[1], v[2], v[3])\\n }\";\n },\n } ];\n\n// cv = CachedValue\n// v = value\n// ud = uniformData\n// uv = uniformValue\n// l = location\nvar GLSL_TO_SINGLE_SETTERS_CACHED = {\n float: \"\\n if(cv !== v)\\n {\\n cv.v = v;\\n gl.uniform1f(location, v)\\n }\",\n vec2: \"\\n if(cv[0] !== v[0] || cv[1] !== v[1])\\n {\\n cv[0] = v[0];\\n cv[1] = v[1];\\n gl.uniform2f(location, v[0], v[1])\\n }\",\n vec3: \"\\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\\n {\\n cv[0] = v[0];\\n cv[1] = v[1];\\n cv[2] = v[2];\\n\\n gl.uniform3f(location, v[0], v[1], v[2])\\n }\",\n vec4: 'gl.uniform4f(location, v[0], v[1], v[2], v[3])',\n int: 'gl.uniform1i(location, v)',\n ivec2: 'gl.uniform2i(location, v[0], v[1])',\n ivec3: 'gl.uniform3i(location, v[0], v[1], v[2])',\n ivec4: 'gl.uniform4i(location, v[0], v[1], v[2], v[3])',\n bool: 'gl.uniform1i(location, v)',\n bvec2: 'gl.uniform2i(location, v[0], v[1])',\n bvec3: 'gl.uniform3i(location, v[0], v[1], v[2])',\n bvec4: 'gl.uniform4i(location, v[0], v[1], v[2], v[3])',\n mat2: 'gl.uniformMatrix2fv(location, false, v)',\n mat3: 'gl.uniformMatrix3fv(location, false, v)',\n mat4: 'gl.uniformMatrix4fv(location, false, v)',\n sampler2D: 'gl.uniform1i(location, v)',\n samplerCube: 'gl.uniform1i(location, v)',\n sampler2DArray: 'gl.uniform1i(location, v)',\n};\nvar GLSL_TO_ARRAY_SETTERS = {\n float: \"gl.uniform1fv(location, v)\",\n vec2: \"gl.uniform2fv(location, v)\",\n vec3: \"gl.uniform3fv(location, v)\",\n vec4: 'gl.uniform4fv(location, v)',\n mat4: 'gl.uniformMatrix4fv(location, false, v)',\n mat3: 'gl.uniformMatrix3fv(location, false, v)',\n mat2: 'gl.uniformMatrix2fv(location, false, v)',\n int: 'gl.uniform1iv(location, v)',\n ivec2: 'gl.uniform2iv(location, v)',\n ivec3: 'gl.uniform3iv(location, v)',\n ivec4: 'gl.uniform4iv(location, v)',\n bool: 'gl.uniform1iv(location, v)',\n bvec2: 'gl.uniform2iv(location, v)',\n bvec3: 'gl.uniform3iv(location, v)',\n bvec4: 'gl.uniform4iv(location, v)',\n sampler2D: 'gl.uniform1iv(location, v)',\n samplerCube: 'gl.uniform1iv(location, v)',\n sampler2DArray: 'gl.uniform1iv(location, v)',\n};\nfunction generateUniformsSync(group, uniformData) {\n var funcFragments = [\"\\n var v = null;\\n var cv = null\\n var t = 0;\\n var gl = renderer.gl\\n \"];\n for (var i in group.uniforms) {\n var data = uniformData[i];\n if (!data) {\n if (group.uniforms[i].group) {\n funcFragments.push(\"\\n renderer.shader.syncUniformGroup(uv[\\\"\" + i + \"\\\"], syncData);\\n \");\n }\n continue;\n }\n var uniform = group.uniforms[i];\n var parsed = false;\n for (var j = 0; j < uniformParsers.length; j++) {\n if (uniformParsers[j].test(data, uniform)) {\n funcFragments.push(uniformParsers[j].code(i, uniform));\n parsed = true;\n break;\n }\n }\n if (!parsed) {\n var templateType = (data.size === 1) ? GLSL_TO_SINGLE_SETTERS_CACHED : GLSL_TO_ARRAY_SETTERS;\n var template = templateType[data.type].replace('location', \"ud[\\\"\" + i + \"\\\"].location\");\n funcFragments.push(\"\\n cv = ud[\\\"\" + i + \"\\\"].value;\\n v = uv[\\\"\" + i + \"\\\"];\\n \" + template + \";\");\n }\n }\n /**\n * the introduction of syncData is to solve an issue where textures in uniform groups are not set correctly\n * the texture count was always starting from 0 in each group. This needs to increment each time a texture is used\n * no matter which group is being used\n *\n */\n // eslint-disable-next-line no-new-func\n return new Function('ud', 'uv', 'renderer', 'syncData', funcFragments.join('\\n'));\n}\n\nvar fragTemplate = [\n 'precision mediump float;',\n 'void main(void){',\n 'float test = 0.1;',\n '%forloop%',\n 'gl_FragColor = vec4(0.0);',\n '}' ].join('\\n');\nfunction generateIfTestSrc(maxIfs) {\n var src = '';\n for (var i = 0; i < maxIfs; ++i) {\n if (i > 0) {\n src += '\\nelse ';\n }\n if (i < maxIfs - 1) {\n src += \"if(test == \" + i + \".0){}\";\n }\n }\n return src;\n}\nfunction checkMaxIfStatementsInShader(maxIfs, gl) {\n if (maxIfs === 0) {\n throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`');\n }\n var shader = gl.createShader(gl.FRAGMENT_SHADER);\n while (true) // eslint-disable-line no-constant-condition\n {\n var fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs));\n gl.shaderSource(shader, fragmentSrc);\n gl.compileShader(shader);\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {\n maxIfs = (maxIfs / 2) | 0;\n }\n else {\n // valid!\n break;\n }\n }\n return maxIfs;\n}\n\n// Cache the result to prevent running this over and over\nvar unsafeEval;\n/**\n * Not all platforms allow to generate function code (e.g., `new Function`).\n * this provides the platform-level detection.\n *\n * @private\n * @returns {boolean}\n */\nfunction unsafeEvalSupported() {\n if (typeof unsafeEval === 'boolean') {\n return unsafeEval;\n }\n try {\n /* eslint-disable no-new-func */\n var func = new Function('param1', 'param2', 'param3', 'return param1[param2] === param3;');\n /* eslint-enable no-new-func */\n unsafeEval = func({ a: 'b' }, 'a', 'b') === true;\n }\n catch (e) {\n unsafeEval = false;\n }\n return unsafeEval;\n}\n\nvar defaultFragment = \"varying vec2 vTextureCoord;\\n\\nuniform sampler2D uSampler;\\n\\nvoid main(void){\\n gl_FragColor *= texture2D(uSampler, vTextureCoord);\\n}\";\n\nvar defaultVertex = \"attribute vec2 aVertexPosition;\\nattribute vec2 aTextureCoord;\\n\\nuniform mat3 projectionMatrix;\\n\\nvarying vec2 vTextureCoord;\\n\\nvoid main(void){\\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\\n vTextureCoord = aTextureCoord;\\n}\\n\";\n\nvar UID$3 = 0;\nvar nameCache = {};\n/**\n * Helper class to create a shader program.\n *\n * @class\n * @memberof PIXI\n */\nvar Program = /** @class */ (function () {\n /**\n * @param {string} [vertexSrc] - The source of the vertex shader.\n * @param {string} [fragmentSrc] - The source of the fragment shader.\n * @param {string} [name] - Name for shader\n */\n function Program(vertexSrc, fragmentSrc, name) {\n if (name === void 0) { name = 'pixi-shader'; }\n this.id = UID$3++;\n /**\n * The vertex shader.\n *\n * @member {string}\n */\n this.vertexSrc = vertexSrc || Program.defaultVertexSrc;\n /**\n * The fragment shader.\n *\n * @member {string}\n */\n this.fragmentSrc = fragmentSrc || Program.defaultFragmentSrc;\n this.vertexSrc = this.vertexSrc.trim();\n this.fragmentSrc = this.fragmentSrc.trim();\n if (this.vertexSrc.substring(0, 8) !== '#version') {\n name = name.replace(/\\s+/g, '-');\n if (nameCache[name]) {\n nameCache[name]++;\n name += \"-\" + nameCache[name];\n }\n else {\n nameCache[name] = 1;\n }\n this.vertexSrc = \"#define SHADER_NAME \" + name + \"\\n\" + this.vertexSrc;\n this.fragmentSrc = \"#define SHADER_NAME \" + name + \"\\n\" + this.fragmentSrc;\n this.vertexSrc = setPrecision(this.vertexSrc, _pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.PRECISION_VERTEX, _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.PRECISION.HIGH);\n this.fragmentSrc = setPrecision(this.fragmentSrc, _pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.PRECISION_FRAGMENT, getMaxFragmentPrecision());\n }\n // currently this does not extract structs only default types\n this.extractData(this.vertexSrc, this.fragmentSrc);\n // this is where we store shader references..\n this.glPrograms = {};\n this.syncUniforms = null;\n }\n /**\n * Extracts the data for a buy creating a small test program\n * or reading the src directly.\n * @protected\n *\n * @param {string} [vertexSrc] - The source of the vertex shader.\n * @param {string} [fragmentSrc] - The source of the fragment shader.\n */\n Program.prototype.extractData = function (vertexSrc, fragmentSrc) {\n var gl = getTestContext();\n if (gl) {\n var program = compileProgram(gl, vertexSrc, fragmentSrc);\n this.attributeData = this.getAttributeData(program, gl);\n this.uniformData = this.getUniformData(program, gl);\n gl.deleteProgram(program);\n }\n else {\n this.uniformData = {};\n this.attributeData = {};\n }\n };\n /**\n * returns the attribute data from the program\n * @private\n *\n * @param {WebGLProgram} [program] - the WebGL program\n * @param {WebGLRenderingContext} [gl] - the WebGL context\n *\n * @returns {object} the attribute data for this program\n */\n Program.prototype.getAttributeData = function (program, gl) {\n var attributes = {};\n var attributesArray = [];\n var totalAttributes = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES);\n for (var i = 0; i < totalAttributes; i++) {\n var attribData = gl.getActiveAttrib(program, i);\n var type = mapType(gl, attribData.type);\n /*eslint-disable */\n var data = {\n type: type,\n name: attribData.name,\n size: mapSize(type),\n location: 0,\n };\n /* eslint-enable */\n attributes[attribData.name] = data;\n attributesArray.push(data);\n }\n attributesArray.sort(function (a, b) { return (a.name > b.name) ? 1 : -1; }); // eslint-disable-line no-confusing-arrow\n for (var i = 0; i < attributesArray.length; i++) {\n attributesArray[i].location = i;\n }\n return attributes;\n };\n /**\n * returns the uniform data from the program\n * @private\n *\n * @param {webGL-program} [program] - the webgl program\n * @param {context} [gl] - the WebGL context\n *\n * @returns {object} the uniform data for this program\n */\n Program.prototype.getUniformData = function (program, gl) {\n var uniforms = {};\n var totalUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);\n // TODO expose this as a prop?\n // const maskRegex = new RegExp('^(projectionMatrix|uSampler|translationMatrix)$');\n // const maskRegex = new RegExp('^(projectionMatrix|uSampler|translationMatrix)$');\n for (var i = 0; i < totalUniforms; i++) {\n var uniformData = gl.getActiveUniform(program, i);\n var name = uniformData.name.replace(/\\[.*?\\]$/, '');\n var isArray = uniformData.name.match(/\\[.*?\\]$/);\n var type = mapType(gl, uniformData.type);\n /*eslint-disable */\n uniforms[name] = {\n type: type,\n size: uniformData.size,\n isArray: isArray,\n value: defaultValue(type, uniformData.size),\n };\n /* eslint-enable */\n }\n return uniforms;\n };\n Object.defineProperty(Program, \"defaultVertexSrc\", {\n /**\n * The default vertex shader source\n *\n * @static\n * @constant\n * @member {string}\n */\n get: function () {\n return defaultVertex;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Program, \"defaultFragmentSrc\", {\n /**\n * The default fragment shader source\n *\n * @static\n * @constant\n * @member {string}\n */\n get: function () {\n return defaultFragment;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * A short hand function to create a program based of a vertex and fragment shader\n * this method will also check to see if there is a cached program.\n *\n * @param {string} [vertexSrc] - The source of the vertex shader.\n * @param {string} [fragmentSrc] - The source of the fragment shader.\n * @param {string} [name=pixi-shader] - Name for shader\n *\n * @returns {PIXI.Program} an shiny new Pixi shader!\n */\n Program.from = function (vertexSrc, fragmentSrc, name) {\n var key = vertexSrc + fragmentSrc;\n var program = _pixi_utils__WEBPACK_IMPORTED_MODULE_2__.ProgramCache[key];\n if (!program) {\n _pixi_utils__WEBPACK_IMPORTED_MODULE_2__.ProgramCache[key] = program = new Program(vertexSrc, fragmentSrc, name);\n }\n return program;\n };\n return Program;\n}());\n\n/**\n * A helper class for shaders\n *\n * @class\n * @memberof PIXI\n */\nvar Shader = /** @class */ (function () {\n /**\n * @param {PIXI.Program} [program] - The program the shader will use.\n * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones.\n */\n function Shader(program, uniforms) {\n /**\n * Program that the shader uses\n *\n * @member {PIXI.Program}\n */\n this.program = program;\n // lets see whats been passed in\n // uniforms should be converted to a uniform group\n if (uniforms) {\n if (uniforms instanceof UniformGroup) {\n this.uniformGroup = uniforms;\n }\n else {\n this.uniformGroup = new UniformGroup(uniforms);\n }\n }\n else {\n this.uniformGroup = new UniformGroup({});\n }\n // time to build some getters and setters!\n // I guess down the line this could sort of generate an instruction list rather than use dirty ids?\n // does the trick for now though!\n for (var i in program.uniformData) {\n if (this.uniformGroup.uniforms[i] instanceof Array) {\n this.uniformGroup.uniforms[i] = new Float32Array(this.uniformGroup.uniforms[i]);\n }\n }\n }\n // TODO move to shader system..\n Shader.prototype.checkUniformExists = function (name, group) {\n if (group.uniforms[name]) {\n return true;\n }\n for (var i in group.uniforms) {\n var uniform = group.uniforms[i];\n if (uniform.group) {\n if (this.checkUniformExists(name, uniform)) {\n return true;\n }\n }\n }\n return false;\n };\n Shader.prototype.destroy = function () {\n // usage count on programs?\n // remove if not used!\n this.uniformGroup = null;\n };\n Object.defineProperty(Shader.prototype, \"uniforms\", {\n /**\n * Shader uniform values, shortcut for `uniformGroup.uniforms`\n * @readonly\n * @member {object}\n */\n get: function () {\n return this.uniformGroup.uniforms;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * A short hand function to create a shader based of a vertex and fragment shader\n *\n * @param {string} [vertexSrc] - The source of the vertex shader.\n * @param {string} [fragmentSrc] - The source of the fragment shader.\n * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones.\n *\n * @returns {PIXI.Shader} an shiny new Pixi shader!\n */\n Shader.from = function (vertexSrc, fragmentSrc, uniforms) {\n var program = Program.from(vertexSrc, fragmentSrc);\n return new Shader(program, uniforms);\n };\n return Shader;\n}());\n\n/* eslint-disable max-len */\nvar BLEND = 0;\nvar OFFSET = 1;\nvar CULLING = 2;\nvar DEPTH_TEST = 3;\nvar WINDING = 4;\n/**\n * This is a WebGL state, and is is passed The WebGL StateManager.\n *\n * Each mesh rendered may require WebGL to be in a different state.\n * For example you may want different blend mode or to enable polygon offsets\n *\n * @class\n * @memberof PIXI\n */\nvar State = /** @class */ (function () {\n function State() {\n this.data = 0;\n this.blendMode = _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.BLEND_MODES.NORMAL;\n this.polygonOffset = 0;\n this.blend = true;\n // this.depthTest = true;\n }\n Object.defineProperty(State.prototype, \"blend\", {\n /**\n * Activates blending of the computed fragment color values\n *\n * @member {boolean}\n */\n get: function () {\n return !!(this.data & (1 << BLEND));\n },\n set: function (value) {\n if (!!(this.data & (1 << BLEND)) !== value) {\n this.data ^= (1 << BLEND);\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(State.prototype, \"offsets\", {\n /**\n * Activates adding an offset to depth values of polygon's fragments\n *\n * @member {boolean}\n * @default false\n */\n get: function () {\n return !!(this.data & (1 << OFFSET));\n },\n set: function (value) {\n if (!!(this.data & (1 << OFFSET)) !== value) {\n this.data ^= (1 << OFFSET);\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(State.prototype, \"culling\", {\n /**\n * Activates culling of polygons.\n *\n * @member {boolean}\n * @default false\n */\n get: function () {\n return !!(this.data & (1 << CULLING));\n },\n set: function (value) {\n if (!!(this.data & (1 << CULLING)) !== value) {\n this.data ^= (1 << CULLING);\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(State.prototype, \"depthTest\", {\n /**\n * Activates depth comparisons and updates to the depth buffer.\n *\n * @member {boolean}\n * @default false\n */\n get: function () {\n return !!(this.data & (1 << DEPTH_TEST));\n },\n set: function (value) {\n if (!!(this.data & (1 << DEPTH_TEST)) !== value) {\n this.data ^= (1 << DEPTH_TEST);\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(State.prototype, \"clockwiseFrontFace\", {\n /**\n * Specifies whether or not front or back-facing polygons can be culled.\n * @member {boolean}\n * @default false\n */\n get: function () {\n return !!(this.data & (1 << WINDING));\n },\n set: function (value) {\n if (!!(this.data & (1 << WINDING)) !== value) {\n this.data ^= (1 << WINDING);\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(State.prototype, \"blendMode\", {\n /**\n * The blend mode to be applied when this state is set. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n * Setting this mode to anything other than NO_BLEND will automatically switch blending on.\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL\n * @see PIXI.BLEND_MODES\n */\n get: function () {\n return this._blendMode;\n },\n set: function (value) {\n this.blend = (value !== _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.BLEND_MODES.NONE);\n this._blendMode = value;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(State.prototype, \"polygonOffset\", {\n /**\n * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill.\n *\n * @member {number}\n * @default 0\n */\n get: function () {\n return this._polygonOffset;\n },\n set: function (value) {\n this.offsets = !!value;\n this._polygonOffset = value;\n },\n enumerable: false,\n configurable: true\n });\n State.for2d = function () {\n var state = new State();\n state.depthTest = false;\n state.blend = true;\n return state;\n };\n return State;\n}());\n\nvar defaultVertex$1 = \"attribute vec2 aVertexPosition;\\n\\nuniform mat3 projectionMatrix;\\n\\nvarying vec2 vTextureCoord;\\n\\nuniform vec4 inputSize;\\nuniform vec4 outputFrame;\\n\\nvec4 filterVertexPosition( void )\\n{\\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\\n\\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\\n}\\n\\nvec2 filterTextureCoord( void )\\n{\\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\\n}\\n\\nvoid main(void)\\n{\\n gl_Position = filterVertexPosition();\\n vTextureCoord = filterTextureCoord();\\n}\\n\";\n\nvar defaultFragment$1 = \"varying vec2 vTextureCoord;\\n\\nuniform sampler2D uSampler;\\n\\nvoid main(void){\\n gl_FragColor = texture2D(uSampler, vTextureCoord);\\n}\\n\";\n\n/**\n * Filter is a special type of WebGL shader that is applied to the screen.\n *\n * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the\n * {@link PIXI.filters.BlurFilter BlurFilter}.\n *\n * ### Usage\n * Filters can be applied to any DisplayObject or Container.\n * PixiJS' `FilterSystem` renders the container into temporary Framebuffer,\n * then filter renders it to the screen.\n * Multiple filters can be added to the `filters` array property and stacked on each other.\n *\n * ```\n * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 });\n * const container = new PIXI.Container();\n * container.filters = [filter];\n * ```\n *\n * ### Previous Version Differences\n *\n * In PixiJS **v3**, a filter was always applied to _whole screen_.\n *\n * In PixiJS **v4**, a filter can be applied _only part of the screen_.\n * Developers had to create a set of uniforms to deal with coordinates.\n *\n * In PixiJS **v5** combines _both approaches_.\n * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers,\n * bringing those extra uniforms into account.\n *\n * Also be aware that we have changed default vertex shader, please consult\n * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}.\n *\n * ### Built-in Uniforms\n *\n * PixiJS viewport uses screen (CSS) coordinates, `(0, 0, renderer.screen.width, renderer.screen.height)`,\n * and `projectionMatrix` uniform maps it to the gl viewport.\n *\n * **uSampler**\n *\n * The most important uniform is the input texture that container was rendered into.\n * _Important note: as with all Framebuffers in PixiJS, both input and output are\n * premultiplied by alpha._\n *\n * By default, input normalized coordinates are passed to fragment shader with `vTextureCoord`.\n * Use it to sample the input.\n *\n * ```\n * const fragment = `\n * varying vec2 vTextureCoord;\n * uniform sampler2D uSampler;\n * void main(void)\n * {\n * gl_FragColor = texture2D(uSampler, vTextureCoord);\n * }\n * `;\n *\n * const myFilter = new PIXI.Filter(null, fragment);\n * ```\n *\n * This filter is just one uniform less than {@link PIXI.filters.AlphaFilter AlphaFilter}.\n *\n * **outputFrame**\n *\n * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates.\n * It's the same as `renderer.screen` for a fullscreen filter.\n * Only a part of `outputFrame.zw` size of temporary Framebuffer is used,\n * `(0, 0, outputFrame.width, outputFrame.height)`,\n *\n * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute.\n * To calculate vertex position in screen space using normalized (0-1) space:\n *\n * ```\n * vec4 filterVertexPosition( void )\n * {\n * vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n * return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n * }\n * ```\n *\n * **inputSize**\n *\n * Temporary framebuffer is different, it can be either the size of screen, either power-of-two.\n * The `inputSize.xy` are size of temporary framebuffer that holds input.\n * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader.\n *\n * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter.\n *\n * To calculate input normalized coordinate, you have to map it to filter normalized space.\n * Multiply by `outputFrame.zw` to get input coordinate.\n * Divide by `inputSize.xy` to get input normalized coordinate.\n *\n * ```\n * vec2 filterTextureCoord( void )\n * {\n * return aVertexPosition * (outputFrame.zw * inputSize.zw); // same as /inputSize.xy\n * }\n * ```\n * **resolution**\n *\n * The `resolution` is the ratio of screen (CSS) pixels to real pixels.\n *\n * **inputPixel**\n *\n * `inputPixel.xy` is the size of framebuffer in real pixels, same as `inputSize.xy * resolution`\n * `inputPixel.zw` is inverted `inputPixel.xy`.\n *\n * It's handy for filters that use neighbour pixels, like {@link PIXI.filters.FXAAFilter FXAAFilter}.\n *\n * **inputClamp**\n *\n * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour.\n * For displacements, coordinates has to be clamped.\n *\n * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer\n * `inputClamp.zw` is bottom-right pixel center.\n *\n * ```\n * vec4 color = texture2D(uSampler, clamp(modifigedTextureCoord, inputClamp.xy, inputClamp.zw))\n * ```\n * OR\n * ```\n * vec4 color = texture2D(uSampler, min(modifigedTextureCoord, inputClamp.zw))\n * ```\n *\n * ### Additional Information\n *\n * Complete documentation on Filter usage is located in the\n * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}.\n *\n * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded\n * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository.\n *\n * @class\n * @memberof PIXI\n * @extends PIXI.Shader\n */\nvar Filter = /** @class */ (function (_super) {\n __extends(Filter, _super);\n /**\n * @param {string} [vertexSrc] - The source of the vertex shader.\n * @param {string} [fragmentSrc] - The source of the fragment shader.\n * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones.\n */\n function Filter(vertexSrc, fragmentSrc, uniforms) {\n var _this = this;\n var program = Program.from(vertexSrc || Filter.defaultVertexSrc, fragmentSrc || Filter.defaultFragmentSrc);\n _this = _super.call(this, program, uniforms) || this;\n /**\n * The padding of the filter. Some filters require extra space to breath such as a blur.\n * Increasing this will add extra width and height to the bounds of the object that the\n * filter is applied to.\n *\n * @member {number}\n */\n _this.padding = 0;\n /**\n * The resolution of the filter. Setting this to be lower will lower the quality but\n * increase the performance of the filter.\n *\n * @member {number}\n */\n _this.resolution = _pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.FILTER_RESOLUTION;\n /**\n * If enabled is true the filter is applied, if false it will not.\n *\n * @member {boolean}\n */\n _this.enabled = true;\n /**\n * If enabled, PixiJS will fit the filter area into boundaries for better performance.\n * Switch it off if it does not work for specific shader.\n *\n * @member {boolean}\n */\n _this.autoFit = true;\n /**\n * Legacy filters use position and uvs from attributes\n * @member {boolean}\n * @readonly\n */\n _this.legacy = !!_this.program.attributeData.aTextureCoord;\n /**\n * The WebGL state the filter requires to render\n * @member {PIXI.State}\n */\n _this.state = new State();\n return _this;\n }\n /**\n * Applies the filter\n *\n * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from\n * @param {PIXI.RenderTexture} input - The input render target.\n * @param {PIXI.RenderTexture} output - The target to output to.\n * @param {PIXI.CLEAR_MODES} clearMode - Should the output be cleared before rendering to it.\n * @param {object} [currentState] - It's current state of filter.\n * There are some useful properties in the currentState :\n * target, filters, sourceFrame, destinationFrame, renderTarget, resolution\n */\n Filter.prototype.apply = function (filterManager, input, output, clearMode, _currentState) {\n // do as you please!\n filterManager.applyFilter(this, input, output, clearMode);\n // or just do a regular render..\n };\n Object.defineProperty(Filter.prototype, \"blendMode\", {\n /**\n * Sets the blendmode of the filter\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL\n */\n get: function () {\n return this.state.blendMode;\n },\n set: function (value) {\n this.state.blendMode = value;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Filter, \"defaultVertexSrc\", {\n /**\n * The default vertex shader source\n *\n * @static\n * @type {string}\n * @constant\n */\n get: function () {\n return defaultVertex$1;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Filter, \"defaultFragmentSrc\", {\n /**\n * The default fragment shader source\n *\n * @static\n * @type {string}\n * @constant\n */\n get: function () {\n return defaultFragment$1;\n },\n enumerable: false,\n configurable: true\n });\n return Filter;\n}(Shader));\n\nvar vertex = \"attribute vec2 aVertexPosition;\\nattribute vec2 aTextureCoord;\\n\\nuniform mat3 projectionMatrix;\\nuniform mat3 otherMatrix;\\n\\nvarying vec2 vMaskCoord;\\nvarying vec2 vTextureCoord;\\n\\nvoid main(void)\\n{\\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\\n\\n vTextureCoord = aTextureCoord;\\n vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;\\n}\\n\";\n\nvar fragment = \"varying vec2 vMaskCoord;\\nvarying vec2 vTextureCoord;\\n\\nuniform sampler2D uSampler;\\nuniform sampler2D mask;\\nuniform float alpha;\\nuniform float npmAlpha;\\nuniform vec4 maskClamp;\\n\\nvoid main(void)\\n{\\n float clip = step(3.5,\\n step(maskClamp.x, vMaskCoord.x) +\\n step(maskClamp.y, vMaskCoord.y) +\\n step(vMaskCoord.x, maskClamp.z) +\\n step(vMaskCoord.y, maskClamp.w));\\n\\n vec4 original = texture2D(uSampler, vTextureCoord);\\n vec4 masky = texture2D(mask, vMaskCoord);\\n float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);\\n\\n original *= (alphaMul * masky.r * alpha * clip);\\n\\n gl_FragColor = original;\\n}\\n\";\n\nvar tempMat = new _pixi_math__WEBPACK_IMPORTED_MODULE_5__.Matrix();\n/**\n * Class controls uv mapping from Texture normal space to BaseTexture normal space.\n *\n * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite.\n *\n * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture.\n * If you want to add support for texture region of certain feature or filter, that's what you're looking for.\n *\n * Takes track of Texture changes through `_lastTextureID` private field.\n * Use `update()` method call to track it from outside.\n *\n * @see PIXI.Texture\n * @see PIXI.Mesh\n * @see PIXI.TilingSprite\n * @class\n * @memberof PIXI\n */\nvar TextureMatrix = /** @class */ (function () {\n /**\n *\n * @param {PIXI.Texture} texture - observed texture\n * @param {number} [clampMargin] - Changes frame clamping, 0.5 by default. Use -0.5 for extra border.\n * @constructor\n */\n function TextureMatrix(texture, clampMargin) {\n this._texture = texture;\n /**\n * Matrix operation that converts texture region coords to texture coords\n * @member {PIXI.Matrix}\n * @readonly\n */\n this.mapCoord = new _pixi_math__WEBPACK_IMPORTED_MODULE_5__.Matrix();\n /**\n * Clamp region for normalized coords, left-top pixel center in xy , bottom-right in zw.\n * Calculated based on clampOffset.\n * @member {Float32Array}\n * @readonly\n */\n this.uClampFrame = new Float32Array(4);\n /**\n * Normalized clamp offset.\n * Calculated based on clampOffset.\n * @member {Float32Array}\n * @readonly\n */\n this.uClampOffset = new Float32Array(2);\n /**\n * Tracks Texture frame changes\n * @member {number}\n * @protected\n */\n this._textureID = -1;\n /**\n * Tracks Texture frame changes\n * @member {number}\n * @protected\n */\n this._updateID = 0;\n /**\n * Changes frame clamping\n * Works with TilingSprite and Mesh\n * Change to 1.5 if you texture has repeated right and bottom lines, that leads to smoother borders\n *\n * @default 0\n * @member {number}\n */\n this.clampOffset = 0;\n /**\n * Changes frame clamping\n * Works with TilingSprite and Mesh\n * Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas\n *\n * @default 0.5\n * @member {number}\n */\n this.clampMargin = (typeof clampMargin === 'undefined') ? 0.5 : clampMargin;\n /**\n * If texture size is the same as baseTexture\n * @member {boolean}\n * @default false\n * @readonly\n */\n this.isSimple = false;\n }\n Object.defineProperty(TextureMatrix.prototype, \"texture\", {\n /**\n * texture property\n * @member {PIXI.Texture}\n */\n get: function () {\n return this._texture;\n },\n set: function (value) {\n this._texture = value;\n this._textureID = -1;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Multiplies uvs array to transform\n * @param {Float32Array} uvs - mesh uvs\n * @param {Float32Array} [out=uvs] output\n * @returns {Float32Array} output\n */\n TextureMatrix.prototype.multiplyUvs = function (uvs, out) {\n if (out === undefined) {\n out = uvs;\n }\n var mat = this.mapCoord;\n for (var i = 0; i < uvs.length; i += 2) {\n var x = uvs[i];\n var y = uvs[i + 1];\n out[i] = (x * mat.a) + (y * mat.c) + mat.tx;\n out[i + 1] = (x * mat.b) + (y * mat.d) + mat.ty;\n }\n return out;\n };\n /**\n * updates matrices if texture was changed\n * @param {boolean} [forceUpdate=false] - if true, matrices will be updated any case\n * @returns {boolean} whether or not it was updated\n */\n TextureMatrix.prototype.update = function (forceUpdate) {\n var tex = this._texture;\n if (!tex || !tex.valid) {\n return false;\n }\n if (!forceUpdate\n && this._textureID === tex._updateID) {\n return false;\n }\n this._textureID = tex._updateID;\n this._updateID++;\n var uvs = tex._uvs;\n this.mapCoord.set(uvs.x1 - uvs.x0, uvs.y1 - uvs.y0, uvs.x3 - uvs.x0, uvs.y3 - uvs.y0, uvs.x0, uvs.y0);\n var orig = tex.orig;\n var trim = tex.trim;\n if (trim) {\n tempMat.set(orig.width / trim.width, 0, 0, orig.height / trim.height, -trim.x / trim.width, -trim.y / trim.height);\n this.mapCoord.append(tempMat);\n }\n var texBase = tex.baseTexture;\n var frame = this.uClampFrame;\n var margin = this.clampMargin / texBase.resolution;\n var offset = this.clampOffset;\n frame[0] = (tex._frame.x + margin + offset) / texBase.width;\n frame[1] = (tex._frame.y + margin + offset) / texBase.height;\n frame[2] = (tex._frame.x + tex._frame.width - margin + offset) / texBase.width;\n frame[3] = (tex._frame.y + tex._frame.height - margin + offset) / texBase.height;\n this.uClampOffset[0] = offset / texBase.realWidth;\n this.uClampOffset[1] = offset / texBase.realHeight;\n this.isSimple = tex._frame.width === texBase.width\n && tex._frame.height === texBase.height\n && tex.rotate === 0;\n return true;\n };\n return TextureMatrix;\n}());\n\n/**\n * This handles a Sprite acting as a mask, as opposed to a Graphic.\n *\n * WebGL only.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI\n */\nvar SpriteMaskFilter = /** @class */ (function (_super) {\n __extends(SpriteMaskFilter, _super);\n /**\n * @param {PIXI.Sprite} sprite - the target sprite\n */\n function SpriteMaskFilter(sprite) {\n var _this = this;\n var maskMatrix = new _pixi_math__WEBPACK_IMPORTED_MODULE_5__.Matrix();\n _this = _super.call(this, vertex, fragment) || this;\n sprite.renderable = false;\n /**\n * Sprite mask\n * @member {PIXI.Sprite}\n */\n _this.maskSprite = sprite;\n /**\n * Mask matrix\n * @member {PIXI.Matrix}\n */\n _this.maskMatrix = maskMatrix;\n return _this;\n }\n /**\n * Applies the filter\n *\n * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from\n * @param {PIXI.RenderTexture} input - The input render target.\n * @param {PIXI.RenderTexture} output - The target to output to.\n * @param {PIXI.CLEAR_MODES} clearMode - Should the output be cleared before rendering to it.\n */\n SpriteMaskFilter.prototype.apply = function (filterManager, input, output, clearMode) {\n var maskSprite = this.maskSprite;\n var tex = maskSprite._texture;\n if (!tex.valid) {\n return;\n }\n if (!tex.uvMatrix) {\n // margin = 0.0, let it bleed a bit, shader code becomes easier\n // assuming that atlas textures were made with 1-pixel padding\n tex.uvMatrix = new TextureMatrix(tex, 0.0);\n }\n tex.uvMatrix.update();\n this.uniforms.npmAlpha = tex.baseTexture.alphaMode ? 0.0 : 1.0;\n this.uniforms.mask = tex;\n // get _normalized sprite texture coords_ and convert them to _normalized atlas texture coords_ with `prepend`\n this.uniforms.otherMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, maskSprite)\n .prepend(tex.uvMatrix.mapCoord);\n this.uniforms.alpha = maskSprite.worldAlpha;\n this.uniforms.maskClamp = tex.uvMatrix.uClampFrame;\n filterManager.applyFilter(this, input, output, clearMode);\n };\n return SpriteMaskFilter;\n}(Filter));\n\n/**\n * System plugin to the renderer to manage masks.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nvar MaskSystem = /** @class */ (function (_super) {\n __extends(MaskSystem, _super);\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n function MaskSystem(renderer) {\n var _this = _super.call(this, renderer) || this;\n /**\n * Enable scissor\n * @member {boolean}\n * @readonly\n */\n _this.enableScissor = false;\n /**\n * Pool of used sprite mask filters\n * @member {PIXI.SpriteMaskFilter[]}\n * @readonly\n */\n _this.alphaMaskPool = [];\n /**\n * Pool of mask data\n * @member {PIXI.MaskData[]}\n * @readonly\n */\n _this.maskDataPool = [];\n _this.maskStack = [];\n /**\n * Current index of alpha mask pool\n * @member {number}\n * @default 0\n * @readonly\n */\n _this.alphaMaskIndex = 0;\n return _this;\n }\n /**\n * Changes the mask stack that is used by this System.\n *\n * @param {PIXI.MaskData[]} maskStack - The mask stack\n */\n MaskSystem.prototype.setMaskStack = function (maskStack) {\n this.maskStack = maskStack;\n this.renderer.scissor.setMaskStack(maskStack);\n this.renderer.stencil.setMaskStack(maskStack);\n };\n /**\n * Applies the Mask and adds it to the current filter stack.\n * Renderer batch must be flushed beforehand.\n *\n * @param {PIXI.DisplayObject} target - Display Object to push the mask to\n * @param {PIXI.MaskData|PIXI.Sprite|PIXI.Graphics|PIXI.DisplayObject} maskData - The masking data.\n */\n MaskSystem.prototype.push = function (target, maskDataOrTarget) {\n var maskData = maskDataOrTarget;\n if (!maskData.isMaskData) {\n var d = this.maskDataPool.pop() || new MaskData();\n d.pooled = true;\n d.maskObject = maskDataOrTarget;\n maskData = d;\n }\n if (maskData.autoDetect) {\n this.detect(maskData);\n }\n maskData.copyCountersOrReset(this.maskStack[this.maskStack.length - 1]);\n maskData._target = target;\n switch (maskData.type) {\n case _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.MASK_TYPES.SCISSOR:\n this.maskStack.push(maskData);\n this.renderer.scissor.push(maskData);\n break;\n case _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.MASK_TYPES.STENCIL:\n this.maskStack.push(maskData);\n this.renderer.stencil.push(maskData);\n break;\n case _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.MASK_TYPES.SPRITE:\n maskData.copyCountersOrReset(null);\n this.pushSpriteMask(maskData);\n this.maskStack.push(maskData);\n break;\n default:\n break;\n }\n };\n /**\n * Removes the last mask from the mask stack and doesn't return it.\n * Renderer batch must be flushed beforehand.\n *\n * @param {PIXI.DisplayObject} target - Display Object to pop the mask from\n */\n MaskSystem.prototype.pop = function (target) {\n var maskData = this.maskStack.pop();\n if (!maskData || maskData._target !== target) {\n // TODO: add an assert when we have it\n return;\n }\n switch (maskData.type) {\n case _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.MASK_TYPES.SCISSOR:\n this.renderer.scissor.pop();\n break;\n case _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.MASK_TYPES.STENCIL:\n this.renderer.stencil.pop(maskData.maskObject);\n break;\n case _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.MASK_TYPES.SPRITE:\n this.popSpriteMask();\n break;\n default:\n break;\n }\n maskData.reset();\n if (maskData.pooled) {\n this.maskDataPool.push(maskData);\n }\n };\n /**\n * Sets type of MaskData based on its maskObject\n * @param {PIXI.MaskData} maskData\n */\n MaskSystem.prototype.detect = function (maskData) {\n var maskObject = maskData.maskObject;\n if (maskObject.isSprite) {\n maskData.type = _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.MASK_TYPES.SPRITE;\n return;\n }\n maskData.type = _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.MASK_TYPES.STENCIL;\n // detect scissor in graphics\n if (this.enableScissor\n && maskObject.isFastRect\n && maskObject.isFastRect()) {\n var matrix = maskObject.worldTransform;\n // TODO: move the check to the matrix itself\n // we are checking that its orthogonal and x rotation is 0 90 180 or 270\n var rotX = Math.atan2(matrix.b, matrix.a);\n var rotXY = Math.atan2(matrix.d, matrix.c);\n // use the nearest degree to 0.01\n rotX = Math.round(rotX * (180 / Math.PI) * 100);\n rotXY = Math.round(rotXY * (180 / Math.PI) * 100) - rotX;\n rotX = ((rotX % 9000) + 9000) % 9000;\n rotXY = ((rotXY % 18000) + 18000) % 18000;\n if (rotX === 0 && rotXY === 9000) {\n maskData.type = _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.MASK_TYPES.SCISSOR;\n }\n }\n };\n /**\n * Applies the Mask and adds it to the current filter stack.\n *\n * @param {PIXI.MaskData} maskData - Sprite to be used as the mask\n */\n MaskSystem.prototype.pushSpriteMask = function (maskData) {\n var maskObject = maskData.maskObject;\n var target = maskData._target;\n var alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex];\n if (!alphaMaskFilter) {\n alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex] = [new SpriteMaskFilter(maskObject)];\n }\n alphaMaskFilter[0].resolution = this.renderer.resolution;\n alphaMaskFilter[0].maskSprite = maskObject;\n var stashFilterArea = target.filterArea;\n target.filterArea = maskObject.getBounds(true);\n this.renderer.filter.push(target, alphaMaskFilter);\n target.filterArea = stashFilterArea;\n this.alphaMaskIndex++;\n };\n /**\n * Removes the last filter from the filter stack and doesn't return it.\n */\n MaskSystem.prototype.popSpriteMask = function () {\n this.renderer.filter.pop();\n this.alphaMaskIndex--;\n };\n return MaskSystem;\n}(System));\n\n/**\n * System plugin to the renderer to manage masks of certain type\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nvar AbstractMaskSystem = /** @class */ (function (_super) {\n __extends(AbstractMaskSystem, _super);\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n function AbstractMaskSystem(renderer) {\n var _this = _super.call(this, renderer) || this;\n /**\n * The mask stack\n * @member {PIXI.MaskData[]}\n */\n _this.maskStack = [];\n /**\n * Constant for gl.enable\n * @member {number}\n * @private\n */\n _this.glConst = 0;\n return _this;\n }\n /**\n * gets count of masks of certain type\n * @returns {number}\n */\n AbstractMaskSystem.prototype.getStackLength = function () {\n return this.maskStack.length;\n };\n /**\n * Changes the mask stack that is used by this System.\n *\n * @param {PIXI.MaskData[]} maskStack - The mask stack\n */\n AbstractMaskSystem.prototype.setMaskStack = function (maskStack) {\n var gl = this.renderer.gl;\n var curStackLen = this.getStackLength();\n this.maskStack = maskStack;\n var newStackLen = this.getStackLength();\n if (newStackLen !== curStackLen) {\n if (newStackLen === 0) {\n gl.disable(this.glConst);\n }\n else {\n gl.enable(this.glConst);\n this._useCurrent();\n }\n }\n };\n /**\n * Setup renderer to use the current mask data.\n * @private\n */\n AbstractMaskSystem.prototype._useCurrent = function () {\n // OVERWRITE;\n };\n /**\n * Destroys the mask stack.\n *\n */\n AbstractMaskSystem.prototype.destroy = function () {\n _super.prototype.destroy.call(this);\n this.maskStack = null;\n };\n return AbstractMaskSystem;\n}(System));\n\n/**\n * System plugin to the renderer to manage scissor rects (used for masks).\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nvar ScissorSystem = /** @class */ (function (_super) {\n __extends(ScissorSystem, _super);\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n function ScissorSystem(renderer) {\n var _this = _super.call(this, renderer) || this;\n _this.glConst = WebGLRenderingContext.SCISSOR_TEST;\n return _this;\n }\n ScissorSystem.prototype.getStackLength = function () {\n var maskData = this.maskStack[this.maskStack.length - 1];\n if (maskData) {\n return maskData._scissorCounter;\n }\n return 0;\n };\n /**\n * Applies the Mask and adds it to the current stencil stack. @alvin\n *\n * @param {PIXI.MaskData} maskData - The mask data\n */\n ScissorSystem.prototype.push = function (maskData) {\n var maskObject = maskData.maskObject;\n maskObject.renderable = true;\n var prevData = maskData._scissorRect;\n var bounds = maskObject.getBounds(true);\n var gl = this.renderer.gl;\n maskObject.renderable = false;\n if (prevData) {\n bounds.fit(prevData);\n }\n else {\n gl.enable(gl.SCISSOR_TEST);\n }\n maskData._scissorCounter++;\n maskData._scissorRect = bounds;\n this._useCurrent();\n };\n /**\n * Pops scissor mask. MaskData is already removed from stack\n */\n ScissorSystem.prototype.pop = function () {\n var gl = this.renderer.gl;\n if (this.getStackLength() > 0) {\n this._useCurrent();\n }\n else {\n gl.disable(gl.SCISSOR_TEST);\n }\n };\n /**\n * Setup renderer to use the current scissor data.\n * @private\n */\n ScissorSystem.prototype._useCurrent = function () {\n var rect = this.maskStack[this.maskStack.length - 1]._scissorRect;\n var rt = this.renderer.renderTexture.current;\n var _a = this.renderer.projection, transform = _a.transform, sourceFrame = _a.sourceFrame, destinationFrame = _a.destinationFrame;\n var resolution = rt ? rt.resolution : this.renderer.resolution;\n var x = ((rect.x - sourceFrame.x) * resolution) + destinationFrame.x;\n var y = ((rect.y - sourceFrame.y) * resolution) + destinationFrame.y;\n var width = rect.width * resolution;\n var height = rect.height * resolution;\n if (transform) {\n x += transform.tx * resolution;\n y += transform.ty * resolution;\n }\n if (!rt) {\n // flipY. In future we'll have it over renderTextures as an option\n y = this.renderer.height - height - y;\n }\n this.renderer.gl.scissor(x, y, width, height);\n };\n return ScissorSystem;\n}(AbstractMaskSystem));\n\n/**\n * System plugin to the renderer to manage stencils (used for masks).\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nvar StencilSystem = /** @class */ (function (_super) {\n __extends(StencilSystem, _super);\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n function StencilSystem(renderer) {\n var _this = _super.call(this, renderer) || this;\n _this.glConst = WebGLRenderingContext.STENCIL_TEST;\n return _this;\n }\n StencilSystem.prototype.getStackLength = function () {\n var maskData = this.maskStack[this.maskStack.length - 1];\n if (maskData) {\n return maskData._stencilCounter;\n }\n return 0;\n };\n /**\n * Applies the Mask and adds it to the current stencil stack.\n *\n * @param {PIXI.MaskData} maskData - The mask data\n */\n StencilSystem.prototype.push = function (maskData) {\n var maskObject = maskData.maskObject;\n var gl = this.renderer.gl;\n var prevMaskCount = maskData._stencilCounter;\n if (prevMaskCount === 0) {\n // force use stencil texture in current framebuffer\n this.renderer.framebuffer.forceStencil();\n gl.enable(gl.STENCIL_TEST);\n }\n maskData._stencilCounter++;\n // Increment the reference stencil value where the new mask overlaps with the old ones.\n gl.colorMask(false, false, false, false);\n gl.stencilFunc(gl.EQUAL, prevMaskCount, this._getBitwiseMask());\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.INCR);\n maskObject.renderable = true;\n maskObject.render(this.renderer);\n this.renderer.batch.flush();\n maskObject.renderable = false;\n this._useCurrent();\n };\n /**\n * Pops stencil mask. MaskData is already removed from stack\n *\n * @param {PIXI.DisplayObject} maskObject - object of popped mask data\n */\n StencilSystem.prototype.pop = function (maskObject) {\n var gl = this.renderer.gl;\n if (this.getStackLength() === 0) {\n // the stack is empty!\n gl.disable(gl.STENCIL_TEST);\n gl.clear(gl.STENCIL_BUFFER_BIT);\n gl.clearStencil(0);\n }\n else {\n // Decrement the reference stencil value where the popped mask overlaps with the other ones\n gl.colorMask(false, false, false, false);\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.DECR);\n maskObject.renderable = true;\n maskObject.render(this.renderer);\n this.renderer.batch.flush();\n maskObject.renderable = false;\n this._useCurrent();\n }\n };\n /**\n * Setup renderer to use the current stencil data.\n * @private\n */\n StencilSystem.prototype._useCurrent = function () {\n var gl = this.renderer.gl;\n gl.colorMask(true, true, true, true);\n gl.stencilFunc(gl.EQUAL, this.getStackLength(), this._getBitwiseMask());\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP);\n };\n /**\n * Fill 1s equal to the number of acitve stencil masks.\n * @private\n * @return {number} The bitwise mask.\n */\n StencilSystem.prototype._getBitwiseMask = function () {\n return (1 << this.getStackLength()) - 1;\n };\n return StencilSystem;\n}(AbstractMaskSystem));\n\n/**\n * System plugin to the renderer to manage the projection matrix.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nvar ProjectionSystem = /** @class */ (function (_super) {\n __extends(ProjectionSystem, _super);\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n function ProjectionSystem(renderer) {\n var _this = _super.call(this, renderer) || this;\n /**\n * Destination frame\n * @member {PIXI.Rectangle}\n * @readonly\n */\n _this.destinationFrame = null;\n /**\n * Source frame\n * @member {PIXI.Rectangle}\n * @readonly\n */\n _this.sourceFrame = null;\n /**\n * Default destination frame\n * @member {PIXI.Rectangle}\n * @readonly\n */\n _this.defaultFrame = null;\n /**\n * Project matrix\n * @member {PIXI.Matrix}\n * @readonly\n */\n _this.projectionMatrix = new _pixi_math__WEBPACK_IMPORTED_MODULE_5__.Matrix();\n /**\n * A transform that will be appended to the projection matrix\n * if null, nothing will be applied\n * @member {PIXI.Matrix}\n */\n _this.transform = null;\n return _this;\n }\n /**\n * Updates the projection matrix based on a projection frame (which is a rectangle).\n *\n * Make sure to run `renderer.framebuffer.setViewport(destinationFrame)` after calling this.\n *\n * @param {PIXI.Rectangle} destinationFrame - The destination frame.\n * @param {PIXI.Rectangle} sourceFrame - The source frame.\n * @param {Number} resolution - Resolution\n * @param {boolean} root - If is root\n */\n ProjectionSystem.prototype.update = function (destinationFrame, sourceFrame, resolution, root) {\n this.destinationFrame = destinationFrame || this.destinationFrame || this.defaultFrame;\n this.sourceFrame = sourceFrame || this.sourceFrame || destinationFrame;\n // Calculate object-space to clip-space projection\n this.calculateProjection(this.destinationFrame, this.sourceFrame, resolution, root);\n if (this.transform) {\n this.projectionMatrix.append(this.transform);\n }\n var renderer = this.renderer;\n renderer.globalUniforms.uniforms.projectionMatrix = this.projectionMatrix;\n renderer.globalUniforms.update();\n // this will work for now\n // but would be sweet to stick and even on the global uniforms..\n if (renderer.shader.shader) {\n renderer.shader.syncUniformGroup(renderer.shader.shader.uniforms.globals);\n }\n };\n /**\n * Updates the projection matrix based on a projection frame (which is a rectangle)\n *\n * @param {PIXI.Rectangle} destinationFrame - The destination frame.\n * @param {PIXI.Rectangle} sourceFrame - The source frame.\n * @param {Number} resolution - Resolution\n * @param {boolean} root - If is root\n */\n ProjectionSystem.prototype.calculateProjection = function (_destinationFrame, sourceFrame, _resolution, root) {\n var pm = this.projectionMatrix;\n var sign = !root ? 1 : -1;\n pm.identity();\n pm.a = (1 / sourceFrame.width * 2);\n pm.d = sign * (1 / sourceFrame.height * 2);\n pm.tx = -1 - (sourceFrame.x * pm.a);\n pm.ty = -sign - (sourceFrame.y * pm.d);\n };\n /**\n * Sets the transform of the active render target to the given matrix\n *\n * @param {PIXI.Matrix} matrix - The transformation matrix\n */\n ProjectionSystem.prototype.setTransform = function (_matrix) {\n // this._activeRenderTarget.transform = matrix;\n };\n return ProjectionSystem;\n}(System));\n\n// Temporary rectangle for assigned sourceFrame or destinationFrame\nvar tempRect = new _pixi_math__WEBPACK_IMPORTED_MODULE_5__.Rectangle();\n// Temporary rectangle for renderTexture destinationFrame\nvar tempRect2 = new _pixi_math__WEBPACK_IMPORTED_MODULE_5__.Rectangle();\n// Temporary rectangle for passing the framebuffer viewport\nvar viewportFrame = new _pixi_math__WEBPACK_IMPORTED_MODULE_5__.Rectangle();\n/**\n * System plugin to the renderer to manage render textures.\n *\n * Should be added after FramebufferSystem\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nvar RenderTextureSystem = /** @class */ (function (_super) {\n __extends(RenderTextureSystem, _super);\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n function RenderTextureSystem(renderer) {\n var _this = _super.call(this, renderer) || this;\n /**\n * The clear background color as rgba\n * @member {number[]}\n */\n _this.clearColor = renderer._backgroundColorRgba;\n // TODO move this property somewhere else!\n /**\n * List of masks for the StencilSystem\n * @member {PIXI.Graphics[]}\n * @readonly\n */\n _this.defaultMaskStack = [];\n // empty render texture?\n /**\n * Render texture\n * @member {PIXI.RenderTexture}\n * @readonly\n */\n _this.current = null;\n /**\n * Source frame\n * @member {PIXI.Rectangle}\n * @readonly\n */\n _this.sourceFrame = new _pixi_math__WEBPACK_IMPORTED_MODULE_5__.Rectangle();\n /**\n * Destination frame\n * @member {PIXI.Rectangle}\n * @readonly\n */\n _this.destinationFrame = new _pixi_math__WEBPACK_IMPORTED_MODULE_5__.Rectangle();\n return _this;\n }\n /**\n * Bind the current render texture\n *\n * @param {PIXI.RenderTexture} [renderTexture] - RenderTexture to bind, by default its `null`, the screen\n * @param {PIXI.Rectangle} [sourceFrame] - part of screen that is mapped to the renderTexture\n * @param {PIXI.Rectangle} [destinationFrame] - part of renderTexture, by default it has the same size as sourceFrame\n */\n RenderTextureSystem.prototype.bind = function (renderTexture, sourceFrame, destinationFrame) {\n if (renderTexture === void 0) { renderTexture = null; }\n var renderer = this.renderer;\n this.current = renderTexture;\n var baseTexture;\n var framebuffer;\n var resolution;\n if (renderTexture) {\n baseTexture = renderTexture.baseTexture;\n resolution = baseTexture.resolution;\n if (!sourceFrame) {\n tempRect.width = renderTexture.frame.width;\n tempRect.height = renderTexture.frame.height;\n sourceFrame = tempRect;\n }\n if (!destinationFrame) {\n tempRect2.x = renderTexture.frame.x;\n tempRect2.y = renderTexture.frame.y;\n tempRect2.width = sourceFrame.width;\n tempRect2.height = sourceFrame.height;\n destinationFrame = tempRect2;\n }\n framebuffer = baseTexture.framebuffer;\n }\n else {\n resolution = renderer.resolution;\n if (!sourceFrame) {\n tempRect.width = renderer.screen.width;\n tempRect.height = renderer.screen.height;\n sourceFrame = tempRect;\n }\n if (!destinationFrame) {\n destinationFrame = tempRect;\n destinationFrame.width = sourceFrame.width;\n destinationFrame.height = sourceFrame.height;\n }\n }\n viewportFrame.x = destinationFrame.x * resolution;\n viewportFrame.y = destinationFrame.y * resolution;\n viewportFrame.width = destinationFrame.width * resolution;\n viewportFrame.height = destinationFrame.height * resolution;\n this.renderer.framebuffer.bind(framebuffer, viewportFrame);\n this.renderer.projection.update(destinationFrame, sourceFrame, resolution, !framebuffer);\n if (renderTexture) {\n this.renderer.mask.setMaskStack(baseTexture.maskStack);\n }\n else {\n this.renderer.mask.setMaskStack(this.defaultMaskStack);\n }\n this.sourceFrame.copyFrom(sourceFrame);\n this.destinationFrame.copyFrom(destinationFrame);\n };\n /**\n * Erases the render texture and fills the drawing area with a colour\n *\n * @param {number[]} [clearColor] - The color as rgba, default to use the renderer backgroundColor\n * @param {PIXI.BUFFER_BITS} [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks\n * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers.\n * @return {PIXI.Renderer} Returns itself.\n */\n RenderTextureSystem.prototype.clear = function (clearColor, mask) {\n if (this.current) {\n clearColor = clearColor || this.current.baseTexture.clearColor;\n }\n else {\n clearColor = clearColor || this.clearColor;\n }\n this.renderer.framebuffer.clear(clearColor[0], clearColor[1], clearColor[2], clearColor[3], mask);\n };\n RenderTextureSystem.prototype.resize = function () {\n // resize the root only!\n this.bind(null);\n };\n /**\n * Resets renderTexture state\n */\n RenderTextureSystem.prototype.reset = function () {\n this.bind(null);\n };\n return RenderTextureSystem;\n}(System));\n\nvar IGLUniformData = /** @class */ (function () {\n function IGLUniformData() {\n }\n return IGLUniformData;\n}());\n/**\n * Helper class to create a WebGL Program\n *\n * @class\n * @memberof PIXI\n */\nvar GLProgram = /** @class */ (function () {\n /**\n * Makes a new Pixi program\n *\n * @param program {WebGLProgram} webgl program\n * @param uniformData {Object} uniforms\n */\n function GLProgram(program, uniformData) {\n /**\n * The shader program\n *\n * @member {WebGLProgram}\n */\n this.program = program;\n /**\n * holds the uniform data which contains uniform locations\n * and current uniform values used for caching and preventing unneeded GPU commands\n * @member {Object}\n */\n this.uniformData = uniformData;\n /**\n * uniformGroups holds the various upload functions for the shader. Each uniform group\n * and program have a unique upload function generated.\n * @member {Object}\n */\n this.uniformGroups = {};\n }\n /**\n * Destroys this program\n */\n GLProgram.prototype.destroy = function () {\n this.uniformData = null;\n this.uniformGroups = null;\n this.program = null;\n };\n return GLProgram;\n}());\n\nvar UID$4 = 0;\n// defualt sync data so we don't create a new one each time!\nvar defaultSyncData = { textureCount: 0 };\n/**\n * System plugin to the renderer to manage shaders.\n *\n * @class\n * @memberof PIXI.systems\n * @extends PIXI.System\n */\nvar ShaderSystem = /** @class */ (function (_super) {\n __extends(ShaderSystem, _super);\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n function ShaderSystem(renderer) {\n var _this = _super.call(this, renderer) || this;\n _this.destroyed = false;\n // Validation check that this environment support `new Function`\n _this.systemCheck();\n /**\n * The current WebGL rendering context\n *\n * @member {WebGLRenderingContext}\n */\n _this.gl = null;\n _this.shader = null;\n _this.program = null;\n /**\n * Cache to holds the generated functions. Stored against UniformObjects unique signature\n * @type {Object}\n * @private\n */\n _this.cache = {};\n _this.id = UID$4++;\n return _this;\n }\n /**\n * Overrideable function by `@pixi/unsafe-eval` to silence\n * throwing an error if platform doesn't support unsafe-evals.\n *\n * @private\n */\n ShaderSystem.prototype.systemCheck = function () {\n if (!unsafeEvalSupported()) {\n throw new Error('Current environment does not allow unsafe-eval, '\n + 'please use @pixi/unsafe-eval module to enable support.');\n }\n };\n ShaderSystem.prototype.contextChange = function (gl) {\n this.gl = gl;\n this.reset();\n };\n /**\n * Changes the current shader to the one given in parameter\n *\n * @param {PIXI.Shader} shader - the new shader\n * @param {boolean} [dontSync] - false if the shader should automatically sync its uniforms.\n * @returns {PIXI.GLProgram} the glProgram that belongs to the shader.\n */\n ShaderSystem.prototype.bind = function (shader, dontSync) {\n shader.uniforms.globals = this.renderer.globalUniforms;\n var program = shader.program;\n var glProgram = program.glPrograms[this.renderer.CONTEXT_UID] || this.generateShader(shader);\n this.shader = shader;\n // TODO - some current Pixi plugins bypass this.. so it not safe to use yet..\n if (this.program !== program) {\n this.program = program;\n this.gl.useProgram(glProgram.program);\n }\n if (!dontSync) {\n defaultSyncData.textureCount = 0;\n this.syncUniformGroup(shader.uniformGroup, defaultSyncData);\n }\n return glProgram;\n };\n /**\n * Uploads the uniforms values to the currently bound shader.\n *\n * @param {object} uniforms - the uniforms values that be applied to the current shader\n */\n ShaderSystem.prototype.setUniforms = function (uniforms) {\n var shader = this.shader.program;\n var glProgram = shader.glPrograms[this.renderer.CONTEXT_UID];\n shader.syncUniforms(glProgram.uniformData, uniforms, this.renderer);\n };\n /* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n /**\n *\n * syncs uniforms on the group\n * @param {*} group - the uniform group to sync\n * @param {*} [syncData] - this is data that is passed to the sync function and any nested sync functions\n */\n ShaderSystem.prototype.syncUniformGroup = function (group, syncData) {\n var glProgram = this.getglProgram();\n if (!group.static || group.dirtyId !== glProgram.uniformGroups[group.id]) {\n glProgram.uniformGroups[group.id] = group.dirtyId;\n this.syncUniforms(group, glProgram, syncData);\n }\n };\n /**\n * Overrideable by the @pixi/unsafe-eval package to use static\n * syncUnforms instead.\n *\n * @private\n */\n ShaderSystem.prototype.syncUniforms = function (group, glProgram, syncData) {\n var syncFunc = group.syncUniforms[this.shader.program.id] || this.createSyncGroups(group);\n syncFunc(glProgram.uniformData, group.uniforms, this.renderer, syncData);\n };\n /* eslint-enable @typescript-eslint/explicit-module-boundary-types */\n ShaderSystem.prototype.createSyncGroups = function (group) {\n var id = this.getSignature(group, this.shader.program.uniformData);\n if (!this.cache[id]) {\n this.cache[id] = generateUniformsSync(group, this.shader.program.uniformData);\n }\n group.syncUniforms[this.shader.program.id] = this.cache[id];\n return group.syncUniforms[this.shader.program.id];\n };\n /**\n * Takes a uniform group and data and generates a unique signature for them.\n *\n * @param {PIXI.UniformGroup} group - the uniform group to get signature of\n * @param {Object} uniformData - uniform information generated by the shader\n * @returns {String} Unique signature of the uniform group\n * @private\n */\n ShaderSystem.prototype.getSignature = function (group, uniformData) {\n var uniforms = group.uniforms;\n var strings = [];\n for (var i in uniforms) {\n strings.push(i);\n if (uniformData[i]) {\n strings.push(uniformData[i].type);\n }\n }\n return strings.join('-');\n };\n /**\n * Returns the underlying GLShade rof the currently bound shader.\n * This can be handy for when you to have a little more control over the setting of your uniforms.\n *\n * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context\n */\n ShaderSystem.prototype.getglProgram = function () {\n if (this.shader) {\n return this.shader.program.glPrograms[this.renderer.CONTEXT_UID];\n }\n return null;\n };\n /**\n * Generates a glProgram version of the Shader provided.\n *\n * @private\n * @param {PIXI.Shader} shader - the shader that the glProgram will be based on.\n * @return {PIXI.GLProgram} A shiny new glProgram!\n */\n ShaderSystem.prototype.generateShader = function (shader) {\n var gl = this.gl;\n var program = shader.program;\n var attribMap = {};\n for (var i in program.attributeData) {\n attribMap[i] = program.attributeData[i].location;\n }\n var shaderProgram = compileProgram(gl, program.vertexSrc, program.fragmentSrc, attribMap);\n var uniformData = {};\n for (var i in program.uniformData) {\n var data = program.uniformData[i];\n uniformData[i] = {\n location: gl.getUniformLocation(shaderProgram, i),\n value: defaultValue(data.type, data.size),\n };\n }\n var glProgram = new GLProgram(shaderProgram, uniformData);\n program.glPrograms[this.renderer.CONTEXT_UID] = glProgram;\n return glProgram;\n };\n /**\n * Resets ShaderSystem state, does not affect WebGL state\n */\n ShaderSystem.prototype.reset = function () {\n this.program = null;\n this.shader = null;\n };\n /**\n * Destroys this System and removes all its textures\n */\n ShaderSystem.prototype.destroy = function () {\n // TODO implement destroy method for ShaderSystem\n this.destroyed = true;\n };\n return ShaderSystem;\n}(System));\n\n/**\n * Maps gl blend combinations to WebGL.\n *\n * @memberof PIXI\n * @function mapWebGLBlendModesToPixi\n * @private\n * @param {WebGLRenderingContext} gl - The rendering context.\n * @param {number[][]} [array=[]] - The array to output into.\n * @return {number[][]} Mapped modes.\n */\nfunction mapWebGLBlendModesToPixi(gl, array) {\n if (array === void 0) { array = []; }\n // TODO - premultiply alpha would be different.\n // add a boolean for that!\n array[_pixi_constants__WEBPACK_IMPORTED_MODULE_1__.BLEND_MODES.NORMAL] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[_pixi_constants__WEBPACK_IMPORTED_MODULE_1__.BLEND_MODES.ADD] = [gl.ONE, gl.ONE];\n array[_pixi_constants__WEBPACK_IMPORTED_MODULE_1__.BLEND_MODES.MULTIPLY] = [gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[_pixi_constants__WEBPACK_IMPORTED_MODULE_1__.BLEND_MODES.SCREEN] = [gl.ONE, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[_pixi_constants__WEBPACK_IMPORTED_MODULE_1__.BLEND_MODES.OVERLAY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[_pixi_constants__WEBPACK_IMPORTED_MODULE_1__.BLEND_MODES.DARKEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[_pixi_constants__WEBPACK_IMPORTED_MODULE_1__.BLEND_MODES.LIGHTEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[_pixi_constants__WEBPACK_IMPORTED_MODULE_1__.BLEND_MODES.COLOR_DODGE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[_pixi_constants__WEBPACK_IMPORTED_MODULE_1__.BLEND_MODES.COLOR_BURN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[_pixi_constants__WEBPACK_IMPORTED_MODULE_1__.BLEND_MODES.HARD_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[_pixi_constants__WEBPACK_IMPORTED_MODULE_1__.BLEND_MODES.SOFT_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[_pixi_constants__WEBPACK_IMPORTED_MODULE_1__.BLEND_MODES.DIFFERENCE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[_pixi_constants__WEBPACK_IMPORTED_MODULE_1__.BLEND_MODES.EXCLUSION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[_pixi_constants__WEBPACK_IMPORTED_MODULE_1__.BLEND_MODES.HUE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[_pixi_constants__WEBPACK_IMPORTED_MODULE_1__.BLEND_MODES.SATURATION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[_pixi_constants__WEBPACK_IMPORTED_MODULE_1__.BLEND_MODES.COLOR] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[_pixi_constants__WEBPACK_IMPORTED_MODULE_1__.BLEND_MODES.LUMINOSITY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[_pixi_constants__WEBPACK_IMPORTED_MODULE_1__.BLEND_MODES.NONE] = [0, 0];\n // not-premultiplied blend modes\n array[_pixi_constants__WEBPACK_IMPORTED_MODULE_1__.BLEND_MODES.NORMAL_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[_pixi_constants__WEBPACK_IMPORTED_MODULE_1__.BLEND_MODES.ADD_NPM] = [gl.SRC_ALPHA, gl.ONE, gl.ONE, gl.ONE];\n array[_pixi_constants__WEBPACK_IMPORTED_MODULE_1__.BLEND_MODES.SCREEN_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n // composite operations\n array[_pixi_constants__WEBPACK_IMPORTED_MODULE_1__.BLEND_MODES.SRC_IN] = [gl.DST_ALPHA, gl.ZERO];\n array[_pixi_constants__WEBPACK_IMPORTED_MODULE_1__.BLEND_MODES.SRC_OUT] = [gl.ONE_MINUS_DST_ALPHA, gl.ZERO];\n array[_pixi_constants__WEBPACK_IMPORTED_MODULE_1__.BLEND_MODES.SRC_ATOP] = [gl.DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA];\n array[_pixi_constants__WEBPACK_IMPORTED_MODULE_1__.BLEND_MODES.DST_OVER] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE];\n array[_pixi_constants__WEBPACK_IMPORTED_MODULE_1__.BLEND_MODES.DST_IN] = [gl.ZERO, gl.SRC_ALPHA];\n array[_pixi_constants__WEBPACK_IMPORTED_MODULE_1__.BLEND_MODES.DST_OUT] = [gl.ZERO, gl.ONE_MINUS_SRC_ALPHA];\n array[_pixi_constants__WEBPACK_IMPORTED_MODULE_1__.BLEND_MODES.DST_ATOP] = [gl.ONE_MINUS_DST_ALPHA, gl.SRC_ALPHA];\n array[_pixi_constants__WEBPACK_IMPORTED_MODULE_1__.BLEND_MODES.XOR] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA];\n // SUBTRACT from flash\n array[_pixi_constants__WEBPACK_IMPORTED_MODULE_1__.BLEND_MODES.SUBTRACT] = [gl.ONE, gl.ONE, gl.ONE, gl.ONE, gl.FUNC_REVERSE_SUBTRACT, gl.FUNC_ADD];\n return array;\n}\n\nvar BLEND$1 = 0;\nvar OFFSET$1 = 1;\nvar CULLING$1 = 2;\nvar DEPTH_TEST$1 = 3;\nvar WINDING$1 = 4;\n/**\n * System plugin to the renderer to manage WebGL state machines.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nvar StateSystem = /** @class */ (function (_super) {\n __extends(StateSystem, _super);\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n function StateSystem(renderer) {\n var _this = _super.call(this, renderer) || this;\n /**\n * GL context\n * @member {WebGLRenderingContext}\n * @readonly\n */\n _this.gl = null;\n /**\n * State ID\n * @member {number}\n * @readonly\n */\n _this.stateId = 0;\n /**\n * Polygon offset\n * @member {number}\n * @readonly\n */\n _this.polygonOffset = 0;\n /**\n * Blend mode\n * @member {number}\n * @default PIXI.BLEND_MODES.NONE\n * @readonly\n */\n _this.blendMode = _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.BLEND_MODES.NONE;\n /**\n * Whether current blend equation is different\n * @member {boolean}\n * @protected\n */\n _this._blendEq = false;\n /**\n * Collection of calls\n * @member {function[]}\n * @readonly\n */\n _this.map = [];\n // map functions for when we set state..\n _this.map[BLEND$1] = _this.setBlend;\n _this.map[OFFSET$1] = _this.setOffset;\n _this.map[CULLING$1] = _this.setCullFace;\n _this.map[DEPTH_TEST$1] = _this.setDepthTest;\n _this.map[WINDING$1] = _this.setFrontFace;\n /**\n * Collection of check calls\n * @member {function[]}\n * @readonly\n */\n _this.checks = [];\n /**\n * Default WebGL State\n * @member {PIXI.State}\n * @readonly\n */\n _this.defaultState = new State();\n _this.defaultState.blend = true;\n return _this;\n }\n StateSystem.prototype.contextChange = function (gl) {\n this.gl = gl;\n this.blendModes = mapWebGLBlendModesToPixi(gl);\n this.set(this.defaultState);\n this.reset();\n };\n /**\n * Sets the current state\n *\n * @param {*} state - The state to set.\n */\n StateSystem.prototype.set = function (state) {\n state = state || this.defaultState;\n // TODO maybe to an object check? ( this.state === state )?\n if (this.stateId !== state.data) {\n var diff = this.stateId ^ state.data;\n var i = 0;\n // order from least to most common\n while (diff) {\n if (diff & 1) {\n // state change!\n this.map[i].call(this, !!(state.data & (1 << i)));\n }\n diff = diff >> 1;\n i++;\n }\n this.stateId = state.data;\n }\n // based on the above settings we check for specific modes..\n // for example if blend is active we check and set the blend modes\n // or of polygon offset is active we check the poly depth.\n for (var i = 0; i < this.checks.length; i++) {\n this.checks[i](this, state);\n }\n };\n /**\n * Sets the state, when previous state is unknown\n *\n * @param {*} state - The state to set\n */\n StateSystem.prototype.forceState = function (state) {\n state = state || this.defaultState;\n for (var i = 0; i < this.map.length; i++) {\n this.map[i].call(this, !!(state.data & (1 << i)));\n }\n for (var i = 0; i < this.checks.length; i++) {\n this.checks[i](this, state);\n }\n this.stateId = state.data;\n };\n /**\n * Enables or disabled blending.\n *\n * @param {boolean} value - Turn on or off webgl blending.\n */\n StateSystem.prototype.setBlend = function (value) {\n this.updateCheck(StateSystem.checkBlendMode, value);\n this.gl[value ? 'enable' : 'disable'](this.gl.BLEND);\n };\n /**\n * Enables or disable polygon offset fill\n *\n * @param {boolean} value - Turn on or off webgl polygon offset testing.\n */\n StateSystem.prototype.setOffset = function (value) {\n this.updateCheck(StateSystem.checkPolygonOffset, value);\n this.gl[value ? 'enable' : 'disable'](this.gl.POLYGON_OFFSET_FILL);\n };\n /**\n * Sets whether to enable or disable depth test.\n *\n * @param {boolean} value - Turn on or off webgl depth testing.\n */\n StateSystem.prototype.setDepthTest = function (value) {\n this.gl[value ? 'enable' : 'disable'](this.gl.DEPTH_TEST);\n };\n /**\n * Sets whether to enable or disable cull face.\n *\n * @param {boolean} value - Turn on or off webgl cull face.\n */\n StateSystem.prototype.setCullFace = function (value) {\n this.gl[value ? 'enable' : 'disable'](this.gl.CULL_FACE);\n };\n /**\n * Sets the gl front face.\n *\n * @param {boolean} value - true is clockwise and false is counter-clockwise\n */\n StateSystem.prototype.setFrontFace = function (value) {\n this.gl.frontFace(this.gl[value ? 'CW' : 'CCW']);\n };\n /**\n * Sets the blend mode.\n *\n * @param {number} value - The blend mode to set to.\n */\n StateSystem.prototype.setBlendMode = function (value) {\n if (value === this.blendMode) {\n return;\n }\n this.blendMode = value;\n var mode = this.blendModes[value];\n var gl = this.gl;\n if (mode.length === 2) {\n gl.blendFunc(mode[0], mode[1]);\n }\n else {\n gl.blendFuncSeparate(mode[0], mode[1], mode[2], mode[3]);\n }\n if (mode.length === 6) {\n this._blendEq = true;\n gl.blendEquationSeparate(mode[4], mode[5]);\n }\n else if (this._blendEq) {\n this._blendEq = false;\n gl.blendEquationSeparate(gl.FUNC_ADD, gl.FUNC_ADD);\n }\n };\n /**\n * Sets the polygon offset.\n *\n * @param {number} value - the polygon offset\n * @param {number} scale - the polygon offset scale\n */\n StateSystem.prototype.setPolygonOffset = function (value, scale) {\n this.gl.polygonOffset(value, scale);\n };\n // used\n /**\n * Resets all the logic and disables the vaos\n */\n StateSystem.prototype.reset = function () {\n this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL, false);\n this.forceState(this.defaultState);\n this._blendEq = true;\n this.blendMode = -1;\n this.setBlendMode(0);\n };\n /**\n * checks to see which updates should be checked based on which settings have been activated.\n * For example, if blend is enabled then we should check the blend modes each time the state is changed\n * or if polygon fill is activated then we need to check if the polygon offset changes.\n * The idea is that we only check what we have too.\n *\n * @param {Function} func - the checking function to add or remove\n * @param {boolean} value - should the check function be added or removed.\n */\n StateSystem.prototype.updateCheck = function (func, value) {\n var index = this.checks.indexOf(func);\n if (value && index === -1) {\n this.checks.push(func);\n }\n else if (!value && index !== -1) {\n this.checks.splice(index, 1);\n }\n };\n /**\n * A private little wrapper function that we call to check the blend mode.\n *\n * @static\n * @private\n * @param {PIXI.StateSystem} System - the System to perform the state check on\n * @param {PIXI.State} state - the state that the blendMode will pulled from\n */\n StateSystem.checkBlendMode = function (system, state) {\n system.setBlendMode(state.blendMode);\n };\n /**\n * A private little wrapper function that we call to check the polygon offset.\n *\n * @static\n * @private\n * @param {PIXI.StateSystem} System - the System to perform the state check on\n * @param {PIXI.State} state - the state that the blendMode will pulled from\n */\n StateSystem.checkPolygonOffset = function (system, state) {\n system.setPolygonOffset(1, state.polygonOffset);\n };\n return StateSystem;\n}(System));\n\n/**\n * System plugin to the renderer to manage texture garbage collection on the GPU,\n * ensuring that it does not get clogged up with textures that are no longer being used.\n *\n * @class\n * @memberof PIXI.systems\n * @extends PIXI.System\n */\nvar TextureGCSystem = /** @class */ (function (_super) {\n __extends(TextureGCSystem, _super);\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n function TextureGCSystem(renderer) {\n var _this = _super.call(this, renderer) || this;\n /**\n * Count\n * @member {number}\n * @readonly\n */\n _this.count = 0;\n /**\n * Check count\n * @member {number}\n * @readonly\n */\n _this.checkCount = 0;\n /**\n * Maximum idle time, in seconds\n * @member {number}\n * @see PIXI.settings.GC_MAX_IDLE\n */\n _this.maxIdle = _pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.GC_MAX_IDLE;\n /**\n * Maximum number of item to check\n * @member {number}\n * @see PIXI.settings.GC_MAX_CHECK_COUNT\n */\n _this.checkCountMax = _pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.GC_MAX_CHECK_COUNT;\n /**\n * Current garabage collection mode\n * @member {PIXI.GC_MODES}\n * @see PIXI.settings.GC_MODE\n */\n _this.mode = _pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.GC_MODE;\n return _this;\n }\n /**\n * Checks to see when the last time a texture was used\n * if the texture has not been used for a specified amount of time it will be removed from the GPU\n */\n TextureGCSystem.prototype.postrender = function () {\n if (!this.renderer.renderingToScreen) {\n return;\n }\n this.count++;\n if (this.mode === _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.GC_MODES.MANUAL) {\n return;\n }\n this.checkCount++;\n if (this.checkCount > this.checkCountMax) {\n this.checkCount = 0;\n this.run();\n }\n };\n /**\n * Checks to see when the last time a texture was used\n * if the texture has not been used for a specified amount of time it will be removed from the GPU\n */\n TextureGCSystem.prototype.run = function () {\n var tm = this.renderer.texture;\n var managedTextures = tm.managedTextures;\n var wasRemoved = false;\n for (var i = 0; i < managedTextures.length; i++) {\n var texture = managedTextures[i];\n // only supports non generated textures at the moment!\n if (!texture.framebuffer && this.count - texture.touched > this.maxIdle) {\n tm.destroyTexture(texture, true);\n managedTextures[i] = null;\n wasRemoved = true;\n }\n }\n if (wasRemoved) {\n var j = 0;\n for (var i = 0; i < managedTextures.length; i++) {\n if (managedTextures[i] !== null) {\n managedTextures[j++] = managedTextures[i];\n }\n }\n managedTextures.length = j;\n }\n };\n /**\n * Removes all the textures within the specified displayObject and its children from the GPU\n *\n * @param {PIXI.DisplayObject} displayObject - the displayObject to remove the textures from.\n */\n TextureGCSystem.prototype.unload = function (displayObject) {\n var tm = this.renderer.texture;\n var texture = displayObject._texture;\n // only destroy non generated textures\n if (texture && !texture.framebuffer) {\n tm.destroyTexture(texture);\n }\n for (var i = displayObject.children.length - 1; i >= 0; i--) {\n this.unload(displayObject.children[i]);\n }\n };\n return TextureGCSystem;\n}(System));\n\n/**\n * Internal texture for WebGL context\n * @class\n * @memberof PIXI\n */\nvar GLTexture = /** @class */ (function () {\n function GLTexture(texture) {\n /**\n * The WebGL texture\n * @member {WebGLTexture}\n */\n this.texture = texture;\n /**\n * Width of texture that was used in texImage2D\n * @member {number}\n */\n this.width = -1;\n /**\n * Height of texture that was used in texImage2D\n * @member {number}\n */\n this.height = -1;\n /**\n * Texture contents dirty flag\n * @member {number}\n */\n this.dirtyId = -1;\n /**\n * Texture style dirty flag\n * @member {number}\n */\n this.dirtyStyleId = -1;\n /**\n * Whether mip levels has to be generated\n * @member {boolean}\n */\n this.mipmap = false;\n /**\n * WrapMode copied from baseTexture\n * @member {number}\n */\n this.wrapMode = 33071;\n /**\n * Type copied from baseTexture\n * @member {number}\n */\n this.type = 6408;\n /**\n * Type copied from baseTexture\n * @member {number}\n */\n this.internalFormat = 5121;\n }\n return GLTexture;\n}());\n\n/**\n * System plugin to the renderer to manage textures.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nvar TextureSystem = /** @class */ (function (_super) {\n __extends(TextureSystem, _super);\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n function TextureSystem(renderer) {\n var _this = _super.call(this, renderer) || this;\n // TODO set to max textures...\n /**\n * Bound textures\n * @member {PIXI.BaseTexture[]}\n * @readonly\n */\n _this.boundTextures = [];\n /**\n * Current location\n * @member {number}\n * @readonly\n */\n _this.currentLocation = -1;\n /**\n * List of managed textures\n * @member {PIXI.BaseTexture[]}\n * @readonly\n */\n _this.managedTextures = [];\n /**\n * Did someone temper with textures state? We'll overwrite them when we need to unbind something.\n * @member {boolean}\n * @private\n */\n _this._unknownBoundTextures = false;\n /**\n * BaseTexture value that shows that we don't know what is bound\n * @member {PIXI.BaseTexture}\n * @readonly\n */\n _this.unknownTexture = new BaseTexture();\n return _this;\n }\n /**\n * Sets up the renderer context and necessary buffers.\n */\n TextureSystem.prototype.contextChange = function () {\n var gl = this.gl = this.renderer.gl;\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n this.webGLVersion = this.renderer.context.webGLVersion;\n var maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);\n this.boundTextures.length = maxTextures;\n for (var i = 0; i < maxTextures; i++) {\n this.boundTextures[i] = null;\n }\n // TODO move this.. to a nice make empty textures class..\n this.emptyTextures = {};\n var emptyTexture2D = new GLTexture(gl.createTexture());\n gl.bindTexture(gl.TEXTURE_2D, emptyTexture2D.texture);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(4));\n this.emptyTextures[gl.TEXTURE_2D] = emptyTexture2D;\n this.emptyTextures[gl.TEXTURE_CUBE_MAP] = new GLTexture(gl.createTexture());\n gl.bindTexture(gl.TEXTURE_CUBE_MAP, this.emptyTextures[gl.TEXTURE_CUBE_MAP].texture);\n for (var i = 0; i < 6; i++) {\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n }\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n for (var i = 0; i < this.boundTextures.length; i++) {\n this.bind(null, i);\n }\n };\n /**\n * Bind a texture to a specific location\n *\n * If you want to unbind something, please use `unbind(texture)` instead of `bind(null, textureLocation)`\n *\n * @param {PIXI.Texture|PIXI.BaseTexture} texture_ - Texture to bind\n * @param {number} [location=0] - Location to bind at\n */\n TextureSystem.prototype.bind = function (texture, location) {\n if (location === void 0) { location = 0; }\n var gl = this.gl;\n if (texture) {\n texture = texture.castToBaseTexture();\n if (texture.parentTextureArray) {\n // cannot bind partial texture\n // TODO: report a warning\n return;\n }\n if (texture.valid) {\n texture.touched = this.renderer.textureGC.count;\n var glTexture = texture._glTextures[this.CONTEXT_UID] || this.initTexture(texture);\n if (this.boundTextures[location] !== texture) {\n if (this.currentLocation !== location) {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n gl.bindTexture(texture.target, glTexture.texture);\n }\n if (glTexture.dirtyId !== texture.dirtyId) {\n if (this.currentLocation !== location) {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n this.updateTexture(texture);\n }\n this.boundTextures[location] = texture;\n }\n }\n else {\n if (this.currentLocation !== location) {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n gl.bindTexture(gl.TEXTURE_2D, this.emptyTextures[gl.TEXTURE_2D].texture);\n this.boundTextures[location] = null;\n }\n };\n /**\n * Resets texture location and bound textures\n *\n * Actual `bind(null, i)` calls will be performed at next `unbind()` call\n */\n TextureSystem.prototype.reset = function () {\n this._unknownBoundTextures = true;\n this.currentLocation = -1;\n for (var i = 0; i < this.boundTextures.length; i++) {\n this.boundTextures[i] = this.unknownTexture;\n }\n };\n /**\n * Unbind a texture\n * @param {PIXI.BaseTexture} texture - Texture to bind\n */\n TextureSystem.prototype.unbind = function (texture) {\n var _a = this, gl = _a.gl, boundTextures = _a.boundTextures;\n if (this._unknownBoundTextures) {\n this._unknownBoundTextures = false;\n // someone changed webGL state,\n // we have to be sure that our texture does not appear in multi-texture renderer samplers\n for (var i = 0; i < boundTextures.length; i++) {\n if (boundTextures[i] === this.unknownTexture) {\n this.bind(null, i);\n }\n }\n }\n for (var i = 0; i < boundTextures.length; i++) {\n if (boundTextures[i] === texture) {\n if (this.currentLocation !== i) {\n gl.activeTexture(gl.TEXTURE0 + i);\n this.currentLocation = i;\n }\n gl.bindTexture(texture.target, this.emptyTextures[texture.target].texture);\n boundTextures[i] = null;\n }\n }\n };\n /**\n * Initialize a texture\n *\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to initialize\n */\n TextureSystem.prototype.initTexture = function (texture) {\n var glTexture = new GLTexture(this.gl.createTexture());\n // guarantee an update..\n glTexture.dirtyId = -1;\n texture._glTextures[this.CONTEXT_UID] = glTexture;\n this.managedTextures.push(texture);\n texture.on('dispose', this.destroyTexture, this);\n return glTexture;\n };\n TextureSystem.prototype.initTextureType = function (texture, glTexture) {\n glTexture.internalFormat = texture.format;\n glTexture.type = texture.type;\n if (this.webGLVersion !== 2) {\n return;\n }\n var gl = this.renderer.gl;\n if (texture.type === gl.FLOAT\n && texture.format === gl.RGBA) {\n glTexture.internalFormat = gl.RGBA32F;\n }\n // that's WebGL1 HALF_FLOAT_OES\n // we have to convert it to WebGL HALF_FLOAT\n if (texture.type === _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.TYPES.HALF_FLOAT) {\n glTexture.type = gl.HALF_FLOAT;\n }\n if (glTexture.type === gl.HALF_FLOAT\n && texture.format === gl.RGBA) {\n glTexture.internalFormat = gl.RGBA16F;\n }\n };\n /**\n * Update a texture\n *\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to initialize\n */\n TextureSystem.prototype.updateTexture = function (texture) {\n var glTexture = texture._glTextures[this.CONTEXT_UID];\n if (!glTexture) {\n return;\n }\n var renderer = this.renderer;\n this.initTextureType(texture, glTexture);\n if (texture.resource && texture.resource.upload(renderer, texture, glTexture)) ;\n else {\n // default, renderTexture-like logic\n var width = texture.realWidth;\n var height = texture.realHeight;\n var gl = renderer.gl;\n if (glTexture.width !== width\n || glTexture.height !== height\n || glTexture.dirtyId < 0) {\n glTexture.width = width;\n glTexture.height = height;\n gl.texImage2D(texture.target, 0, glTexture.internalFormat, width, height, 0, texture.format, glTexture.type, null);\n }\n }\n // lets only update what changes..\n if (texture.dirtyStyleId !== glTexture.dirtyStyleId) {\n this.updateTextureStyle(texture);\n }\n glTexture.dirtyId = texture.dirtyId;\n };\n /**\n * Deletes the texture from WebGL\n *\n * @private\n * @param {PIXI.BaseTexture|PIXI.Texture} texture_ - the texture to destroy\n * @param {boolean} [skipRemove=false] - Whether to skip removing the texture from the TextureManager.\n */\n TextureSystem.prototype.destroyTexture = function (texture, skipRemove) {\n var gl = this.gl;\n texture = texture.castToBaseTexture();\n if (texture._glTextures[this.CONTEXT_UID]) {\n this.unbind(texture);\n gl.deleteTexture(texture._glTextures[this.CONTEXT_UID].texture);\n texture.off('dispose', this.destroyTexture, this);\n delete texture._glTextures[this.CONTEXT_UID];\n if (!skipRemove) {\n var i = this.managedTextures.indexOf(texture);\n if (i !== -1) {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.removeItems)(this.managedTextures, i, 1);\n }\n }\n }\n };\n /**\n * Update texture style such as mipmap flag\n *\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to update\n */\n TextureSystem.prototype.updateTextureStyle = function (texture) {\n var glTexture = texture._glTextures[this.CONTEXT_UID];\n if (!glTexture) {\n return;\n }\n if ((texture.mipmap === _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.MIPMAP_MODES.POW2 || this.webGLVersion !== 2) && !texture.isPowerOfTwo) {\n glTexture.mipmap = false;\n }\n else {\n glTexture.mipmap = texture.mipmap >= 1;\n }\n if (this.webGLVersion !== 2 && !texture.isPowerOfTwo) {\n glTexture.wrapMode = _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.WRAP_MODES.CLAMP;\n }\n else {\n glTexture.wrapMode = texture.wrapMode;\n }\n if (texture.resource && texture.resource.style(this.renderer, texture, glTexture)) ;\n else {\n this.setStyle(texture, glTexture);\n }\n glTexture.dirtyStyleId = texture.dirtyStyleId;\n };\n /**\n * Set style for texture\n *\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to update\n * @param {PIXI.GLTexture} glTexture\n */\n TextureSystem.prototype.setStyle = function (texture, glTexture) {\n var gl = this.gl;\n if (glTexture.mipmap) {\n gl.generateMipmap(texture.target);\n }\n gl.texParameteri(texture.target, gl.TEXTURE_WRAP_S, glTexture.wrapMode);\n gl.texParameteri(texture.target, gl.TEXTURE_WRAP_T, glTexture.wrapMode);\n if (glTexture.mipmap) {\n /* eslint-disable max-len */\n gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.SCALE_MODES.LINEAR ? gl.LINEAR_MIPMAP_LINEAR : gl.NEAREST_MIPMAP_NEAREST);\n /* eslint-disable max-len */\n var anisotropicExt = this.renderer.context.extensions.anisotropicFiltering;\n if (anisotropicExt && texture.anisotropicLevel > 0 && texture.scaleMode === _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.SCALE_MODES.LINEAR) {\n var level = Math.min(texture.anisotropicLevel, gl.getParameter(anisotropicExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT));\n gl.texParameterf(texture.target, anisotropicExt.TEXTURE_MAX_ANISOTROPY_EXT, level);\n }\n }\n else {\n gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST);\n }\n gl.texParameteri(texture.target, gl.TEXTURE_MAG_FILTER, texture.scaleMode === _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST);\n };\n return TextureSystem;\n}(System));\n\n/**\n * Systems are individual components to the Renderer pipeline.\n * @namespace PIXI.systems\n */\n\nvar systems = ({\n FilterSystem: FilterSystem,\n BatchSystem: BatchSystem,\n ContextSystem: ContextSystem,\n FramebufferSystem: FramebufferSystem,\n GeometrySystem: GeometrySystem,\n MaskSystem: MaskSystem,\n ScissorSystem: ScissorSystem,\n StencilSystem: StencilSystem,\n ProjectionSystem: ProjectionSystem,\n RenderTextureSystem: RenderTextureSystem,\n ShaderSystem: ShaderSystem,\n StateSystem: StateSystem,\n TextureGCSystem: TextureGCSystem,\n TextureSystem: TextureSystem\n});\n\nvar tempMatrix = new _pixi_math__WEBPACK_IMPORTED_MODULE_5__.Matrix();\n/**\n * The AbstractRenderer is the base for a PixiJS Renderer. It is extended by the {@link PIXI.CanvasRenderer}\n * and {@link PIXI.Renderer} which can be used for rendering a PixiJS scene.\n *\n * @abstract\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n */\nvar AbstractRenderer = /** @class */ (function (_super) {\n __extends(AbstractRenderer, _super);\n /**\n * @param {string} system - The name of the system this renderer is for.\n * @param {object} [options] - The optional renderer parameters.\n * @param {number} [options.width=800] - The width of the screen.\n * @param {number} [options.height=600] - The height of the screen.\n * @param {HTMLCanvasElement} [options.view] - The canvas to use as a view, optional.\n * @param {boolean} [options.transparent=false] - If the render view is transparent.\n * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for\n * resolutions other than 1.\n * @param {boolean} [options.antialias=false] - Sets antialias\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer. The\n * resolution of the renderer retina would be 2.\n * @param {boolean} [options.preserveDrawingBuffer=false] - Enables drawing buffer preservation,\n * enable this if you need to call toDataUrl on the WebGL context.\n * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or\n * not before the new render pass.\n * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area\n * (shown if not transparent).\n */\n function AbstractRenderer(type, options) {\n if (type === void 0) { type = _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.RENDERER_TYPE.UNKNOWN; }\n var _this = _super.call(this) || this;\n // Add the default render options\n options = Object.assign({}, _pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.RENDER_OPTIONS, options);\n // Deprecation notice for renderer roundPixels option\n if (options.roundPixels) {\n _pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.ROUND_PIXELS = options.roundPixels;\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.deprecation)('5.0.0', 'Renderer roundPixels option is deprecated, please use PIXI.settings.ROUND_PIXELS', 2);\n }\n /**\n * The supplied constructor options.\n *\n * @member {Object}\n * @readOnly\n */\n _this.options = options;\n /**\n * The type of the renderer.\n *\n * @member {number}\n * @default PIXI.RENDERER_TYPE.UNKNOWN\n * @see PIXI.RENDERER_TYPE\n */\n _this.type = type;\n /**\n * Measurements of the screen. (0, 0, screenWidth, screenHeight).\n *\n * Its safe to use as filterArea or hitArea for the whole stage.\n *\n * @member {PIXI.Rectangle}\n */\n _this.screen = new _pixi_math__WEBPACK_IMPORTED_MODULE_5__.Rectangle(0, 0, options.width, options.height);\n /**\n * The canvas element that everything is drawn to.\n *\n * @member {HTMLCanvasElement}\n */\n _this.view = options.view || document.createElement('canvas');\n /**\n * The resolution / device pixel ratio of the renderer.\n *\n * @member {number}\n * @default 1\n */\n _this.resolution = options.resolution || _pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.RESOLUTION;\n /**\n * Whether the render view is transparent.\n *\n * @member {boolean}\n */\n _this.transparent = options.transparent;\n /**\n * Whether CSS dimensions of canvas view should be resized to screen dimensions automatically.\n *\n * @member {boolean}\n */\n _this.autoDensity = options.autoDensity || options.autoResize || false;\n // autoResize is deprecated, provides fallback support\n /**\n * The value of the preserveDrawingBuffer flag affects whether or not the contents of\n * the stencil buffer is retained after rendering.\n *\n * @member {boolean}\n */\n _this.preserveDrawingBuffer = options.preserveDrawingBuffer;\n /**\n * This sets if the CanvasRenderer will clear the canvas or not before the new render pass.\n * If the scene is NOT transparent PixiJS will use a canvas sized fillRect operation every\n * frame to set the canvas background color. If the scene is transparent PixiJS will use clearRect\n * to clear the canvas every frame. Disable this by setting this to false. For example, if\n * your game has a canvas filling background image you often don't need this set.\n *\n * @member {boolean}\n * @default\n */\n _this.clearBeforeRender = options.clearBeforeRender;\n /**\n * The background color as a number.\n *\n * @member {number}\n * @protected\n */\n _this._backgroundColor = 0x000000;\n /**\n * The background color as an [R, G, B] array.\n *\n * @member {number[]}\n * @protected\n */\n _this._backgroundColorRgba = [0, 0, 0, 0];\n /**\n * The background color as a string.\n *\n * @member {string}\n * @protected\n */\n _this._backgroundColorString = '#000000';\n _this.backgroundColor = options.backgroundColor || _this._backgroundColor; // run bg color setter\n /**\n * The last root object that the renderer tried to render.\n *\n * @member {PIXI.DisplayObject}\n * @protected\n */\n _this._lastObjectRendered = null;\n /**\n * Collection of plugins.\n * @readonly\n * @member {object}\n */\n _this.plugins = {};\n return _this;\n }\n /**\n * Initialize the plugins.\n *\n * @protected\n * @param {object} staticMap - The dictionary of statically saved plugins.\n */\n AbstractRenderer.prototype.initPlugins = function (staticMap) {\n for (var o in staticMap) {\n this.plugins[o] = new (staticMap[o])(this);\n }\n };\n Object.defineProperty(AbstractRenderer.prototype, \"width\", {\n /**\n * Same as view.width, actual number of pixels in the canvas by horizontal.\n *\n * @member {number}\n * @readonly\n * @default 800\n */\n get: function () {\n return this.view.width;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(AbstractRenderer.prototype, \"height\", {\n /**\n * Same as view.height, actual number of pixels in the canvas by vertical.\n *\n * @member {number}\n * @readonly\n * @default 600\n */\n get: function () {\n return this.view.height;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Resizes the screen and canvas to the specified width and height.\n * Canvas dimensions are multiplied by resolution.\n *\n * @param {number} screenWidth - The new width of the screen.\n * @param {number} screenHeight - The new height of the screen.\n */\n AbstractRenderer.prototype.resize = function (screenWidth, screenHeight) {\n this.screen.width = screenWidth;\n this.screen.height = screenHeight;\n this.view.width = screenWidth * this.resolution;\n this.view.height = screenHeight * this.resolution;\n if (this.autoDensity) {\n this.view.style.width = screenWidth + \"px\";\n this.view.style.height = screenHeight + \"px\";\n }\n /**\n * Fired after view has been resized.\n *\n * @event PIXI.Renderer#resize\n * @param {number} screenWidth - The new width of the screen.\n * @param {number} screenHeight - The new height of the screen.\n */\n this.emit('resize', screenWidth, screenHeight);\n };\n /**\n * Useful function that returns a texture of the display object that can then be used to create sprites\n * This can be quite useful if your displayObject is complicated and needs to be reused multiple times.\n *\n * @param {PIXI.DisplayObject} displayObject - The displayObject the object will be generated from.\n * @param {PIXI.SCALE_MODES} scaleMode - The scale mode of the texture.\n * @param {number} resolution - The resolution / device pixel ratio of the texture being generated.\n * @param {PIXI.Rectangle} [region] - The region of the displayObject, that shall be rendered,\n * if no region is specified, defaults to the local bounds of the displayObject.\n * @return {PIXI.RenderTexture} A texture of the graphics object.\n */\n AbstractRenderer.prototype.generateTexture = function (displayObject, scaleMode, resolution, region) {\n region = region || displayObject.getLocalBounds(null, true);\n // minimum texture size is 1x1, 0x0 will throw an error\n if (region.width === 0)\n { region.width = 1; }\n if (region.height === 0)\n { region.height = 1; }\n var renderTexture = RenderTexture.create({\n width: region.width | 0,\n height: region.height | 0,\n scaleMode: scaleMode,\n resolution: resolution,\n });\n tempMatrix.tx = -region.x;\n tempMatrix.ty = -region.y;\n this.render(displayObject, renderTexture, false, tempMatrix, !!displayObject.parent);\n return renderTexture;\n };\n /**\n * Removes everything from the renderer and optionally removes the Canvas DOM element.\n *\n * @param {boolean} [removeView=false] - Removes the Canvas element from the DOM.\n */\n AbstractRenderer.prototype.destroy = function (removeView) {\n for (var o in this.plugins) {\n this.plugins[o].destroy();\n this.plugins[o] = null;\n }\n if (removeView && this.view.parentNode) {\n this.view.parentNode.removeChild(this.view);\n }\n var thisAny = this;\n // null-ing all objects, that's a tradition!\n thisAny.plugins = null;\n thisAny.type = _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.RENDERER_TYPE.UNKNOWN;\n thisAny.view = null;\n thisAny.screen = null;\n thisAny._tempDisplayObjectParent = null;\n thisAny.options = null;\n this._backgroundColorRgba = null;\n this._backgroundColorString = null;\n this._lastObjectRendered = null;\n };\n Object.defineProperty(AbstractRenderer.prototype, \"backgroundColor\", {\n /**\n * The background color to fill if not transparent\n *\n * @member {number}\n */\n get: function () {\n return this._backgroundColor;\n },\n set: function (value) {\n this._backgroundColor = value;\n this._backgroundColorString = (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.hex2string)(value);\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.hex2rgb)(value, this._backgroundColorRgba);\n },\n enumerable: false,\n configurable: true\n });\n return AbstractRenderer;\n}(_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.EventEmitter));\n\n/**\n * The Renderer draws the scene and all its content onto a WebGL enabled canvas.\n *\n * This renderer should be used for browsers that support WebGL.\n *\n * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds.\n * Don't forget to add the view to your DOM or you will not see anything!\n *\n * @class\n * @memberof PIXI\n * @extends PIXI.AbstractRenderer\n */\nvar Renderer = /** @class */ (function (_super) {\n __extends(Renderer, _super);\n /**\n * @param {object} [options] - The optional renderer parameters.\n * @param {number} [options.width=800] - The width of the screen.\n * @param {number} [options.height=600] - The height of the screen.\n * @param {HTMLCanvasElement} [options.view] - The canvas to use as a view, optional.\n * @param {boolean} [options.transparent=false] - If the render view is transparent.\n * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for\n * resolutions other than 1.\n * @param {boolean} [options.antialias=false] - Sets antialias. If not available natively then FXAA\n * antialiasing is used.\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer.\n * The resolution of the renderer retina would be 2.\n * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear\n * the canvas or not before the new render pass. If you wish to set this to false, you *must* set\n * preserveDrawingBuffer to `true`.\n * @param {boolean} [options.preserveDrawingBuffer=false] - Enables drawing buffer preservation,\n * enable this if you need to call toDataUrl on the WebGL context.\n * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area\n * (shown if not transparent).\n * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to \"high-performance\"\n * for devices with dual graphics card.\n * @param {object} [options.context] - If WebGL context already exists, all parameters must be taken from it.\n * @public\n */\n function Renderer(options) {\n var _this = _super.call(this, _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.RENDERER_TYPE.WEBGL, options) || this;\n // the options will have been modified here in the super constructor with pixi's default settings..\n options = _this.options;\n /**\n * WebGL context, set by the contextSystem (this.context)\n *\n * @readonly\n * @member {WebGLRenderingContext}\n */\n _this.gl = null;\n _this.CONTEXT_UID = 0;\n // TODO legacy!\n /**\n * Internal signal instances of **runner**, these\n * are assigned to each system created.\n * @see PIXI.Runner\n * @name PIXI.Renderer#runners\n * @private\n * @type {object}\n * @readonly\n * @property {PIXI.Runner} destroy - Destroy runner\n * @property {PIXI.Runner} contextChange - Context change runner\n * @property {PIXI.Runner} reset - Reset runner\n * @property {PIXI.Runner} update - Update runner\n * @property {PIXI.Runner} postrender - Post-render runner\n * @property {PIXI.Runner} prerender - Pre-render runner\n * @property {PIXI.Runner} resize - Resize runner\n */\n _this.runners = {\n destroy: new _pixi_runner__WEBPACK_IMPORTED_MODULE_3__.Runner('destroy'),\n contextChange: new _pixi_runner__WEBPACK_IMPORTED_MODULE_3__.Runner('contextChange'),\n reset: new _pixi_runner__WEBPACK_IMPORTED_MODULE_3__.Runner('reset'),\n update: new _pixi_runner__WEBPACK_IMPORTED_MODULE_3__.Runner('update'),\n postrender: new _pixi_runner__WEBPACK_IMPORTED_MODULE_3__.Runner('postrender'),\n prerender: new _pixi_runner__WEBPACK_IMPORTED_MODULE_3__.Runner('prerender'),\n resize: new _pixi_runner__WEBPACK_IMPORTED_MODULE_3__.Runner('resize'),\n };\n /**\n * Global uniforms\n * @member {PIXI.UniformGroup}\n */\n _this.globalUniforms = new UniformGroup({\n projectionMatrix: new _pixi_math__WEBPACK_IMPORTED_MODULE_5__.Matrix(),\n }, true);\n /**\n * Mask system instance\n * @member {PIXI.systems.MaskSystem} mask\n * @memberof PIXI.Renderer#\n * @readonly\n */\n _this.addSystem(MaskSystem, 'mask')\n /**\n * Context system instance\n * @member {PIXI.systems.ContextSystem} context\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(ContextSystem, 'context')\n /**\n * State system instance\n * @member {PIXI.systems.StateSystem} state\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(StateSystem, 'state')\n /**\n * Shader system instance\n * @member {PIXI.systems.ShaderSystem} shader\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(ShaderSystem, 'shader')\n /**\n * Texture system instance\n * @member {PIXI.systems.TextureSystem} texture\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(TextureSystem, 'texture')\n /**\n * Geometry system instance\n * @member {PIXI.systems.GeometrySystem} geometry\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(GeometrySystem, 'geometry')\n /**\n * Framebuffer system instance\n * @member {PIXI.systems.FramebufferSystem} framebuffer\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(FramebufferSystem, 'framebuffer')\n /**\n * Scissor system instance\n * @member {PIXI.systems.ScissorSystem} scissor\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(ScissorSystem, 'scissor')\n /**\n * Stencil system instance\n * @member {PIXI.systems.StencilSystem} stencil\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(StencilSystem, 'stencil')\n /**\n * Projection system instance\n * @member {PIXI.systems.ProjectionSystem} projection\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(ProjectionSystem, 'projection')\n /**\n * Texture garbage collector system instance\n * @member {PIXI.systems.TextureGCSystem} textureGC\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(TextureGCSystem, 'textureGC')\n /**\n * Filter system instance\n * @member {PIXI.systems.FilterSystem} filter\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(FilterSystem, 'filter')\n /**\n * RenderTexture system instance\n * @member {PIXI.systems.RenderTextureSystem} renderTexture\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(RenderTextureSystem, 'renderTexture')\n /**\n * Batch system instance\n * @member {PIXI.systems.BatchSystem} batch\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(BatchSystem, 'batch');\n _this.initPlugins(Renderer.__plugins);\n /**\n * The options passed in to create a new WebGL context.\n */\n if (options.context) {\n _this.context.initFromContext(options.context);\n }\n else {\n _this.context.initFromOptions({\n alpha: !!_this.transparent,\n antialias: options.antialias,\n premultipliedAlpha: _this.transparent && _this.transparent !== 'notMultiplied',\n stencil: true,\n preserveDrawingBuffer: options.preserveDrawingBuffer,\n powerPreference: _this.options.powerPreference,\n });\n }\n /**\n * Flag if we are rendering to the screen vs renderTexture\n * @member {boolean}\n * @readonly\n * @default true\n */\n _this.renderingToScreen = true;\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.sayHello)(_this.context.webGLVersion === 2 ? 'WebGL 2' : 'WebGL 1');\n _this.resize(_this.options.width, _this.options.height);\n return _this;\n }\n /**\n * Create renderer if WebGL is available. Overrideable\n * by the **@pixi/canvas-renderer** package to allow fallback.\n * throws error if WebGL is not available.\n * @static\n * @private\n */\n Renderer.create = function (options) {\n if ((0,_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.isWebGLSupported)()) {\n return new Renderer(options);\n }\n throw new Error('WebGL unsupported in this browser, use \"pixi.js-legacy\" for fallback canvas2d support.');\n };\n /**\n * Add a new system to the renderer.\n * @param {Function} ClassRef - Class reference\n * @param {string} [name] - Property name for system, if not specified\n * will use a static `name` property on the class itself. This\n * name will be assigned as s property on the Renderer so make\n * sure it doesn't collide with properties on Renderer.\n * @return {PIXI.Renderer} Return instance of renderer\n */\n Renderer.prototype.addSystem = function (ClassRef, name) {\n if (!name) {\n name = ClassRef.name;\n }\n var system = new ClassRef(this);\n if (this[name]) {\n throw new Error(\"Whoops! The name \\\"\" + name + \"\\\" is already in use\");\n }\n this[name] = system;\n for (var i in this.runners) {\n this.runners[i].add(system);\n }\n /**\n * Fired after rendering finishes.\n *\n * @event PIXI.Renderer#postrender\n */\n /**\n * Fired before rendering starts.\n *\n * @event PIXI.Renderer#prerender\n */\n /**\n * Fired when the WebGL context is set.\n *\n * @event PIXI.Renderer#context\n * @param {WebGLRenderingContext} gl - WebGL context.\n */\n return this;\n };\n /**\n * Renders the object to its WebGL view\n *\n * @param {PIXI.DisplayObject} displayObject - The object to be rendered.\n * @param {PIXI.RenderTexture} [renderTexture] - The render texture to render to.\n * @param {boolean} [clear=true] - Should the canvas be cleared before the new render.\n * @param {PIXI.Matrix} [transform] - A transform to apply to the render texture before rendering.\n * @param {boolean} [skipUpdateTransform=false] - Should we skip the update transform pass?\n */\n Renderer.prototype.render = function (displayObject, renderTexture, clear, transform, skipUpdateTransform) {\n // can be handy to know!\n this.renderingToScreen = !renderTexture;\n this.runners.prerender.emit();\n this.emit('prerender');\n // apply a transform at a GPU level\n this.projection.transform = transform;\n // no point rendering if our context has been blown up!\n if (this.context.isLost) {\n return;\n }\n if (!renderTexture) {\n this._lastObjectRendered = displayObject;\n }\n if (!skipUpdateTransform) {\n // update the scene graph\n var cacheParent = displayObject.enableTempParent();\n displayObject.updateTransform();\n displayObject.disableTempParent(cacheParent);\n // displayObject.hitArea = //TODO add a temp hit area\n }\n this.renderTexture.bind(renderTexture);\n this.batch.currentRenderer.start();\n if (clear !== undefined ? clear : this.clearBeforeRender) {\n this.renderTexture.clear();\n }\n displayObject.render(this);\n // apply transform..\n this.batch.currentRenderer.flush();\n if (renderTexture) {\n renderTexture.baseTexture.update();\n }\n this.runners.postrender.emit();\n // reset transform after render\n this.projection.transform = null;\n this.emit('postrender');\n };\n /**\n * Resizes the WebGL view to the specified width and height.\n *\n * @param {number} screenWidth - The new width of the screen.\n * @param {number} screenHeight - The new height of the screen.\n */\n Renderer.prototype.resize = function (screenWidth, screenHeight) {\n _super.prototype.resize.call(this, screenWidth, screenHeight);\n this.runners.resize.emit(screenWidth, screenHeight);\n };\n /**\n * Resets the WebGL state so you can render things however you fancy!\n *\n * @return {PIXI.Renderer} Returns itself.\n */\n Renderer.prototype.reset = function () {\n this.runners.reset.emit();\n return this;\n };\n /**\n * Clear the frame buffer\n */\n Renderer.prototype.clear = function () {\n this.renderTexture.bind();\n this.renderTexture.clear();\n };\n /**\n * Removes everything from the renderer (event listeners, spritebatch, etc...)\n *\n * @param {boolean} [removeView=false] - Removes the Canvas element from the DOM.\n * See: https://github.com/pixijs/pixi.js/issues/2233\n */\n Renderer.prototype.destroy = function (removeView) {\n this.runners.destroy.emit();\n for (var r in this.runners) {\n this.runners[r].destroy();\n }\n // call base destroy\n _super.prototype.destroy.call(this, removeView);\n // TODO nullify all the managers..\n this.gl = null;\n };\n /**\n * Adds a plugin to the renderer.\n *\n * @method\n * @param {string} pluginName - The name of the plugin.\n * @param {Function} ctor - The constructor function or class for the plugin.\n */\n Renderer.registerPlugin = function (pluginName, ctor) {\n Renderer.__plugins = Renderer.__plugins || {};\n Renderer.__plugins[pluginName] = ctor;\n };\n return Renderer;\n}(AbstractRenderer));\n\n/**\n * This helper function will automatically detect which renderer you should be using.\n * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by\n * the browser then this function will return a canvas renderer\n *\n * @memberof PIXI\n * @function autoDetectRenderer\n * @param {object} [options] - The optional renderer parameters\n * @param {number} [options.width=800] - the width of the renderers view\n * @param {number} [options.height=600] - the height of the renderers view\n * @param {HTMLCanvasElement} [options.view] - the canvas to use as a view, optional\n * @param {boolean} [options.transparent=false] - If the render view is transparent, default false\n * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for\n * resolutions other than 1\n * @param {boolean} [options.antialias=false] - sets antialias\n * @param {boolean} [options.preserveDrawingBuffer=false] - enables drawing buffer preservation, enable this if you\n * need to call toDataUrl on the webgl context\n * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area\n * (shown if not transparent).\n * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or\n * not before the new render pass.\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer, retina would be 2\n * @param {boolean} [options.forceCanvas=false] - prevents selection of WebGL renderer, even if such is present, this\n * option only is available when using **pixi.js-legacy** or **@pixi/canvas-renderer** modules, otherwise\n * it is ignored.\n * @param {string} [options.powerPreference] - Parameter passed to webgl context, set to \"high-performance\"\n * for devices with dual graphics card **webgl only**\n * @return {PIXI.Renderer|PIXI.CanvasRenderer} Returns WebGL renderer if available, otherwise CanvasRenderer\n */\nfunction autoDetectRenderer(options) {\n return Renderer.create(options);\n}\n\nvar _default = \"attribute vec2 aVertexPosition;\\nattribute vec2 aTextureCoord;\\n\\nuniform mat3 projectionMatrix;\\n\\nvarying vec2 vTextureCoord;\\n\\nvoid main(void)\\n{\\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\\n vTextureCoord = aTextureCoord;\\n}\";\n\nvar defaultFilter = \"attribute vec2 aVertexPosition;\\n\\nuniform mat3 projectionMatrix;\\n\\nvarying vec2 vTextureCoord;\\n\\nuniform vec4 inputSize;\\nuniform vec4 outputFrame;\\n\\nvec4 filterVertexPosition( void )\\n{\\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\\n\\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\\n}\\n\\nvec2 filterTextureCoord( void )\\n{\\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\\n}\\n\\nvoid main(void)\\n{\\n gl_Position = filterVertexPosition();\\n vTextureCoord = filterTextureCoord();\\n}\\n\";\n\n/**\n * Used by the batcher to draw batches.\n * Each one of these contains all information required to draw a bound geometry.\n *\n * @class\n * @memberof PIXI\n */\nvar BatchDrawCall = /** @class */ (function () {\n function BatchDrawCall() {\n this.texArray = null;\n this.blend = 0;\n this.type = _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.DRAW_MODES.TRIANGLES;\n this.start = 0;\n this.size = 0;\n /**\n * data for uniforms or custom webgl state\n * @member {object}\n */\n this.data = null;\n }\n return BatchDrawCall;\n}());\n\n/**\n * Used by the batcher to build texture batches.\n * Holds list of textures and their respective locations.\n *\n * @class\n * @memberof PIXI\n */\nvar BatchTextureArray = /** @class */ (function () {\n function BatchTextureArray() {\n /**\n * inside textures array\n * @member {PIXI.BaseTexture[]}\n */\n this.elements = [];\n /**\n * Respective locations for textures\n * @member {number[]}\n */\n this.ids = [];\n /**\n * number of filled elements\n * @member {number}\n */\n this.count = 0;\n }\n BatchTextureArray.prototype.clear = function () {\n for (var i = 0; i < this.count; i++) {\n this.elements[i] = null;\n }\n this.count = 0;\n };\n return BatchTextureArray;\n}());\n\n/**\n * Flexible wrapper around `ArrayBuffer` that also provides\n * typed array views on demand.\n *\n * @class\n * @memberof PIXI\n */\nvar ViewableBuffer = /** @class */ (function () {\n /**\n * @param {number} size - The size of the buffer in bytes.\n */\n function ViewableBuffer(size) {\n /**\n * Underlying `ArrayBuffer` that holds all the data\n * and is of capacity `size`.\n *\n * @member {ArrayBuffer}\n */\n this.rawBinaryData = new ArrayBuffer(size);\n /**\n * View on the raw binary data as a `Uint32Array`.\n *\n * @member {Uint32Array}\n */\n this.uint32View = new Uint32Array(this.rawBinaryData);\n /**\n * View on the raw binary data as a `Float32Array`.\n *\n * @member {Float32Array}\n */\n this.float32View = new Float32Array(this.rawBinaryData);\n }\n Object.defineProperty(ViewableBuffer.prototype, \"int8View\", {\n /**\n * View on the raw binary data as a `Int8Array`.\n *\n * @member {Int8Array}\n */\n get: function () {\n if (!this._int8View) {\n this._int8View = new Int8Array(this.rawBinaryData);\n }\n return this._int8View;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(ViewableBuffer.prototype, \"uint8View\", {\n /**\n * View on the raw binary data as a `Uint8Array`.\n *\n * @member {Uint8Array}\n */\n get: function () {\n if (!this._uint8View) {\n this._uint8View = new Uint8Array(this.rawBinaryData);\n }\n return this._uint8View;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(ViewableBuffer.prototype, \"int16View\", {\n /**\n * View on the raw binary data as a `Int16Array`.\n *\n * @member {Int16Array}\n */\n get: function () {\n if (!this._int16View) {\n this._int16View = new Int16Array(this.rawBinaryData);\n }\n return this._int16View;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(ViewableBuffer.prototype, \"uint16View\", {\n /**\n * View on the raw binary data as a `Uint16Array`.\n *\n * @member {Uint16Array}\n */\n get: function () {\n if (!this._uint16View) {\n this._uint16View = new Uint16Array(this.rawBinaryData);\n }\n return this._uint16View;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(ViewableBuffer.prototype, \"int32View\", {\n /**\n * View on the raw binary data as a `Int32Array`.\n *\n * @member {Int32Array}\n */\n get: function () {\n if (!this._int32View) {\n this._int32View = new Int32Array(this.rawBinaryData);\n }\n return this._int32View;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Returns the view of the given type.\n *\n * @param {string} type - One of `int8`, `uint8`, `int16`,\n * `uint16`, `int32`, `uint32`, and `float32`.\n * @return {object} typed array of given type\n */\n ViewableBuffer.prototype.view = function (type) {\n return this[type + \"View\"];\n };\n /**\n * Destroys all buffer references. Do not use after calling\n * this.\n */\n ViewableBuffer.prototype.destroy = function () {\n this.rawBinaryData = null;\n this._int8View = null;\n this._uint8View = null;\n this._int16View = null;\n this._uint16View = null;\n this._int32View = null;\n this.uint32View = null;\n this.float32View = null;\n };\n ViewableBuffer.sizeOf = function (type) {\n switch (type) {\n case 'int8':\n case 'uint8':\n return 1;\n case 'int16':\n case 'uint16':\n return 2;\n case 'int32':\n case 'uint32':\n case 'float32':\n return 4;\n default:\n throw new Error(type + \" isn't a valid view type\");\n }\n };\n return ViewableBuffer;\n}());\n\n/**\n * Renderer dedicated to drawing and batching sprites.\n *\n * This is the default batch renderer. It buffers objects\n * with texture-based geometries and renders them in\n * batches. It uploads multiple textures to the GPU to\n * reduce to the number of draw calls.\n *\n * @class\n * @protected\n * @memberof PIXI\n * @extends PIXI.ObjectRenderer\n */\nvar AbstractBatchRenderer = /** @class */ (function (_super) {\n __extends(AbstractBatchRenderer, _super);\n /**\n * This will hook onto the renderer's `contextChange`\n * and `prerender` signals.\n *\n * @param {PIXI.Renderer} renderer - The renderer this works for.\n */\n function AbstractBatchRenderer(renderer) {\n var _this = _super.call(this, renderer) || this;\n /**\n * This is used to generate a shader that can\n * color each vertex based on a `aTextureId`\n * attribute that points to an texture in `uSampler`.\n *\n * This enables the objects with different textures\n * to be drawn in the same draw call.\n *\n * You can customize your shader by creating your\n * custom shader generator.\n *\n * @member {PIXI.BatchShaderGenerator}\n * @protected\n */\n _this.shaderGenerator = null;\n /**\n * The class that represents the geometry of objects\n * that are going to be batched with this.\n *\n * @member {object}\n * @default PIXI.BatchGeometry\n * @protected\n */\n _this.geometryClass = null;\n /**\n * Size of data being buffered per vertex in the\n * attribute buffers (in floats). By default, the\n * batch-renderer plugin uses 6:\n *\n * | aVertexPosition | 2 |\n * |-----------------|---|\n * | aTextureCoords | 2 |\n * | aColor | 1 |\n * | aTextureId | 1 |\n *\n * @member {number}\n * @readonly\n */\n _this.vertexSize = null;\n /**\n * The WebGL state in which this renderer will work.\n *\n * @member {PIXI.State}\n * @readonly\n */\n _this.state = State.for2d();\n /**\n * The number of bufferable objects before a flush\n * occurs automatically.\n *\n * @member {number}\n * @default settings.SPRITE_BATCH_SIZE * 4\n */\n _this.size = _pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.SPRITE_BATCH_SIZE * 4;\n /**\n * Total count of all vertices used by the currently\n * buffered objects.\n *\n * @member {number}\n * @private\n */\n _this._vertexCount = 0;\n /**\n * Total count of all indices used by the currently\n * buffered objects.\n *\n * @member {number}\n * @private\n */\n _this._indexCount = 0;\n /**\n * Buffer of objects that are yet to be rendered.\n *\n * @member {PIXI.DisplayObject[]}\n * @private\n */\n _this._bufferedElements = [];\n /**\n * Data for texture batch builder, helps to save a bit of CPU on a pass.\n * @type {PIXI.BaseTexture[]}\n * @private\n */\n _this._bufferedTextures = [];\n /**\n * Number of elements that are buffered and are\n * waiting to be flushed.\n *\n * @member {number}\n * @private\n */\n _this._bufferSize = 0;\n /**\n * This shader is generated by `this.shaderGenerator`.\n *\n * It is generated specifically to handle the required\n * number of textures being batched together.\n *\n * @member {PIXI.Shader}\n * @protected\n */\n _this._shader = null;\n /**\n * Pool of `this.geometryClass` geometry objects\n * that store buffers. They are used to pass data\n * to the shader on each draw call.\n *\n * These are never re-allocated again, unless a\n * context change occurs; however, the pool may\n * be expanded if required.\n *\n * @member {PIXI.Geometry[]}\n * @private\n * @see PIXI.AbstractBatchRenderer.contextChange\n */\n _this._packedGeometries = [];\n /**\n * Size of `this._packedGeometries`. It can be expanded\n * if more than `this._packedGeometryPoolSize` flushes\n * occur in a single frame.\n *\n * @member {number}\n * @private\n */\n _this._packedGeometryPoolSize = 2;\n /**\n * A flush may occur multiple times in a single\n * frame. On iOS devices or when\n * `settings.CAN_UPLOAD_SAME_BUFFER` is false, the\n * batch renderer does not upload data to the same\n * `WebGLBuffer` for performance reasons.\n *\n * This is the index into `packedGeometries` that points to\n * geometry holding the most recent buffers.\n *\n * @member {number}\n * @private\n */\n _this._flushId = 0;\n /**\n * Pool of `ViewableBuffer` objects that are sorted in\n * order of increasing size. The flush method uses\n * the buffer with the least size above the amount\n * it requires. These are used for passing attributes.\n *\n * The first buffer has a size of 8; each subsequent\n * buffer has double capacity of its previous.\n *\n * @member {PIXI.ViewableBuffer[]}\n * @private\n * @see PIXI.AbstractBatchRenderer#getAttributeBuffer\n */\n _this._aBuffers = {};\n /**\n * Pool of `Uint16Array` objects that are sorted in\n * order of increasing size. The flush method uses\n * the buffer with the least size above the amount\n * it requires. These are used for passing indices.\n *\n * The first buffer has a size of 12; each subsequent\n * buffer has double capacity of its previous.\n *\n * @member {Uint16Array[]}\n * @private\n * @see PIXI.AbstractBatchRenderer#getIndexBuffer\n */\n _this._iBuffers = {};\n /**\n * Maximum number of textures that can be uploaded to\n * the GPU under the current context. It is initialized\n * properly in `this.contextChange`.\n *\n * @member {number}\n * @see PIXI.AbstractBatchRenderer#contextChange\n * @readonly\n */\n _this.MAX_TEXTURES = 1;\n _this.renderer.on('prerender', _this.onPrerender, _this);\n renderer.runners.contextChange.add(_this);\n _this._dcIndex = 0;\n _this._aIndex = 0;\n _this._iIndex = 0;\n _this._attributeBuffer = null;\n _this._indexBuffer = null;\n _this._tempBoundTextures = [];\n return _this;\n }\n /**\n * Handles the `contextChange` signal.\n *\n * It calculates `this.MAX_TEXTURES` and allocating the\n * packed-geometry object pool.\n */\n AbstractBatchRenderer.prototype.contextChange = function () {\n var gl = this.renderer.gl;\n if (_pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.PREFER_ENV === _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.ENV.WEBGL_LEGACY) {\n this.MAX_TEXTURES = 1;\n }\n else {\n // step 1: first check max textures the GPU can handle.\n this.MAX_TEXTURES = Math.min(gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS), _pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.SPRITE_MAX_TEXTURES);\n // step 2: check the maximum number of if statements the shader can have too..\n this.MAX_TEXTURES = checkMaxIfStatementsInShader(this.MAX_TEXTURES, gl);\n }\n this._shader = this.shaderGenerator.generateShader(this.MAX_TEXTURES);\n // we use the second shader as the first one depending on your browser\n // may omit aTextureId as it is not used by the shader so is optimized out.\n for (var i = 0; i < this._packedGeometryPoolSize; i++) {\n /* eslint-disable max-len */\n this._packedGeometries[i] = new (this.geometryClass)();\n }\n this.initFlushBuffers();\n };\n /**\n * Makes sure that static and dynamic flush pooled objects have correct dimensions\n */\n AbstractBatchRenderer.prototype.initFlushBuffers = function () {\n var _drawCallPool = AbstractBatchRenderer._drawCallPool, _textureArrayPool = AbstractBatchRenderer._textureArrayPool;\n // max draw calls\n var MAX_SPRITES = this.size / 4;\n // max texture arrays\n var MAX_TA = Math.floor(MAX_SPRITES / this.MAX_TEXTURES) + 1;\n while (_drawCallPool.length < MAX_SPRITES) {\n _drawCallPool.push(new BatchDrawCall());\n }\n while (_textureArrayPool.length < MAX_TA) {\n _textureArrayPool.push(new BatchTextureArray());\n }\n for (var i = 0; i < this.MAX_TEXTURES; i++) {\n this._tempBoundTextures[i] = null;\n }\n };\n /**\n * Handles the `prerender` signal.\n *\n * It ensures that flushes start from the first geometry\n * object again.\n */\n AbstractBatchRenderer.prototype.onPrerender = function () {\n this._flushId = 0;\n };\n /**\n * Buffers the \"batchable\" object. It need not be rendered\n * immediately.\n *\n * @param {PIXI.DisplayObject} element - the element to render when\n * using this renderer\n */\n AbstractBatchRenderer.prototype.render = function (element) {\n if (!element._texture.valid) {\n return;\n }\n if (this._vertexCount + (element.vertexData.length / 2) > this.size) {\n this.flush();\n }\n this._vertexCount += element.vertexData.length / 2;\n this._indexCount += element.indices.length;\n this._bufferedTextures[this._bufferSize] = element._texture.baseTexture;\n this._bufferedElements[this._bufferSize++] = element;\n };\n AbstractBatchRenderer.prototype.buildTexturesAndDrawCalls = function () {\n var _a = this, textures = _a._bufferedTextures, MAX_TEXTURES = _a.MAX_TEXTURES;\n var textureArrays = AbstractBatchRenderer._textureArrayPool;\n var batch = this.renderer.batch;\n var boundTextures = this._tempBoundTextures;\n var touch = this.renderer.textureGC.count;\n var TICK = ++BaseTexture._globalBatch;\n var countTexArrays = 0;\n var texArray = textureArrays[0];\n var start = 0;\n batch.copyBoundTextures(boundTextures, MAX_TEXTURES);\n for (var i = 0; i < this._bufferSize; ++i) {\n var tex = textures[i];\n textures[i] = null;\n if (tex._batchEnabled === TICK) {\n continue;\n }\n if (texArray.count >= MAX_TEXTURES) {\n batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES);\n this.buildDrawCalls(texArray, start, i);\n start = i;\n texArray = textureArrays[++countTexArrays];\n ++TICK;\n }\n tex._batchEnabled = TICK;\n tex.touched = touch;\n texArray.elements[texArray.count++] = tex;\n }\n if (texArray.count > 0) {\n batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES);\n this.buildDrawCalls(texArray, start, this._bufferSize);\n ++countTexArrays;\n ++TICK;\n }\n // Clean-up\n for (var i = 0; i < boundTextures.length; i++) {\n boundTextures[i] = null;\n }\n BaseTexture._globalBatch = TICK;\n };\n /**\n * Populating drawcalls for rendering\n *\n * @param {PIXI.BatchTextureArray} texArray\n * @param {number} start\n * @param {number} finish\n */\n AbstractBatchRenderer.prototype.buildDrawCalls = function (texArray, start, finish) {\n var _a = this, elements = _a._bufferedElements, _attributeBuffer = _a._attributeBuffer, _indexBuffer = _a._indexBuffer, vertexSize = _a.vertexSize;\n var drawCalls = AbstractBatchRenderer._drawCallPool;\n var dcIndex = this._dcIndex;\n var aIndex = this._aIndex;\n var iIndex = this._iIndex;\n var drawCall = drawCalls[dcIndex];\n drawCall.start = this._iIndex;\n drawCall.texArray = texArray;\n for (var i = start; i < finish; ++i) {\n var sprite = elements[i];\n var tex = sprite._texture.baseTexture;\n var spriteBlendMode = _pixi_utils__WEBPACK_IMPORTED_MODULE_2__.premultiplyBlendMode[tex.alphaMode ? 1 : 0][sprite.blendMode];\n elements[i] = null;\n if (start < i && drawCall.blend !== spriteBlendMode) {\n drawCall.size = iIndex - drawCall.start;\n start = i;\n drawCall = drawCalls[++dcIndex];\n drawCall.texArray = texArray;\n drawCall.start = iIndex;\n }\n this.packInterleavedGeometry(sprite, _attributeBuffer, _indexBuffer, aIndex, iIndex);\n aIndex += sprite.vertexData.length / 2 * vertexSize;\n iIndex += sprite.indices.length;\n drawCall.blend = spriteBlendMode;\n }\n if (start < finish) {\n drawCall.size = iIndex - drawCall.start;\n ++dcIndex;\n }\n this._dcIndex = dcIndex;\n this._aIndex = aIndex;\n this._iIndex = iIndex;\n };\n /**\n * Bind textures for current rendering\n *\n * @param {PIXI.BatchTextureArray} texArray\n */\n AbstractBatchRenderer.prototype.bindAndClearTexArray = function (texArray) {\n var textureSystem = this.renderer.texture;\n for (var j = 0; j < texArray.count; j++) {\n textureSystem.bind(texArray.elements[j], texArray.ids[j]);\n texArray.elements[j] = null;\n }\n texArray.count = 0;\n };\n AbstractBatchRenderer.prototype.updateGeometry = function () {\n var _a = this, packedGeometries = _a._packedGeometries, attributeBuffer = _a._attributeBuffer, indexBuffer = _a._indexBuffer;\n if (!_pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.CAN_UPLOAD_SAME_BUFFER) { /* Usually on iOS devices, where the browser doesn't\n like uploads to the same buffer in a single frame. */\n if (this._packedGeometryPoolSize <= this._flushId) {\n this._packedGeometryPoolSize++;\n packedGeometries[this._flushId] = new (this.geometryClass)();\n }\n packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData);\n packedGeometries[this._flushId]._indexBuffer.update(indexBuffer);\n this.renderer.geometry.bind(packedGeometries[this._flushId]);\n this.renderer.geometry.updateBuffers();\n this._flushId++;\n }\n else {\n // lets use the faster option, always use buffer number 0\n packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData);\n packedGeometries[this._flushId]._indexBuffer.update(indexBuffer);\n this.renderer.geometry.updateBuffers();\n }\n };\n AbstractBatchRenderer.prototype.drawBatches = function () {\n var dcCount = this._dcIndex;\n var _a = this.renderer, gl = _a.gl, stateSystem = _a.state;\n var drawCalls = AbstractBatchRenderer._drawCallPool;\n var curTexArray = null;\n // Upload textures and do the draw calls\n for (var i = 0; i < dcCount; i++) {\n var _b = drawCalls[i], texArray = _b.texArray, type = _b.type, size = _b.size, start = _b.start, blend = _b.blend;\n if (curTexArray !== texArray) {\n curTexArray = texArray;\n this.bindAndClearTexArray(texArray);\n }\n this.state.blendMode = blend;\n stateSystem.set(this.state);\n gl.drawElements(type, size, gl.UNSIGNED_SHORT, start * 2);\n }\n };\n /**\n * Renders the content _now_ and empties the current batch.\n */\n AbstractBatchRenderer.prototype.flush = function () {\n if (this._vertexCount === 0) {\n return;\n }\n this._attributeBuffer = this.getAttributeBuffer(this._vertexCount);\n this._indexBuffer = this.getIndexBuffer(this._indexCount);\n this._aIndex = 0;\n this._iIndex = 0;\n this._dcIndex = 0;\n this.buildTexturesAndDrawCalls();\n this.updateGeometry();\n this.drawBatches();\n // reset elements buffer for the next flush\n this._bufferSize = 0;\n this._vertexCount = 0;\n this._indexCount = 0;\n };\n /**\n * Starts a new sprite batch.\n */\n AbstractBatchRenderer.prototype.start = function () {\n this.renderer.state.set(this.state);\n this.renderer.shader.bind(this._shader);\n if (_pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.CAN_UPLOAD_SAME_BUFFER) {\n // bind buffer #0, we don't need others\n this.renderer.geometry.bind(this._packedGeometries[this._flushId]);\n }\n };\n /**\n * Stops and flushes the current batch.\n */\n AbstractBatchRenderer.prototype.stop = function () {\n this.flush();\n };\n /**\n * Destroys this `AbstractBatchRenderer`. It cannot be used again.\n */\n AbstractBatchRenderer.prototype.destroy = function () {\n for (var i = 0; i < this._packedGeometryPoolSize; i++) {\n if (this._packedGeometries[i]) {\n this._packedGeometries[i].destroy();\n }\n }\n this.renderer.off('prerender', this.onPrerender, this);\n this._aBuffers = null;\n this._iBuffers = null;\n this._packedGeometries = null;\n this._attributeBuffer = null;\n this._indexBuffer = null;\n if (this._shader) {\n this._shader.destroy();\n this._shader = null;\n }\n _super.prototype.destroy.call(this);\n };\n /**\n * Fetches an attribute buffer from `this._aBuffers` that\n * can hold atleast `size` floats.\n *\n * @param {number} size - minimum capacity required\n * @return {ViewableBuffer} - buffer than can hold atleast `size` floats\n * @private\n */\n AbstractBatchRenderer.prototype.getAttributeBuffer = function (size) {\n // 8 vertices is enough for 2 quads\n var roundedP2 = (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.nextPow2)(Math.ceil(size / 8));\n var roundedSizeIndex = (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.log2)(roundedP2);\n var roundedSize = roundedP2 * 8;\n if (this._aBuffers.length <= roundedSizeIndex) {\n this._iBuffers.length = roundedSizeIndex + 1;\n }\n var buffer = this._aBuffers[roundedSize];\n if (!buffer) {\n this._aBuffers[roundedSize] = buffer = new ViewableBuffer(roundedSize * this.vertexSize * 4);\n }\n return buffer;\n };\n /**\n * Fetches an index buffer from `this._iBuffers` that can\n * have at least `size` capacity.\n *\n * @param {number} size - minimum required capacity\n * @return {Uint16Array} - buffer that can fit `size`\n * indices.\n * @private\n */\n AbstractBatchRenderer.prototype.getIndexBuffer = function (size) {\n // 12 indices is enough for 2 quads\n var roundedP2 = (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.nextPow2)(Math.ceil(size / 12));\n var roundedSizeIndex = (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.log2)(roundedP2);\n var roundedSize = roundedP2 * 12;\n if (this._iBuffers.length <= roundedSizeIndex) {\n this._iBuffers.length = roundedSizeIndex + 1;\n }\n var buffer = this._iBuffers[roundedSizeIndex];\n if (!buffer) {\n this._iBuffers[roundedSizeIndex] = buffer = new Uint16Array(roundedSize);\n }\n return buffer;\n };\n /**\n * Takes the four batching parameters of `element`, interleaves\n * and pushes them into the batching attribute/index buffers given.\n *\n * It uses these properties: `vertexData` `uvs`, `textureId` and\n * `indicies`. It also uses the \"tint\" of the base-texture, if\n * present.\n *\n * @param {PIXI.Sprite} element - element being rendered\n * @param {PIXI.ViewableBuffer} attributeBuffer - attribute buffer.\n * @param {Uint16Array} indexBuffer - index buffer\n * @param {number} aIndex - number of floats already in the attribute buffer\n * @param {number} iIndex - number of indices already in `indexBuffer`\n */\n AbstractBatchRenderer.prototype.packInterleavedGeometry = function (element, attributeBuffer, indexBuffer, aIndex, iIndex) {\n var uint32View = attributeBuffer.uint32View, float32View = attributeBuffer.float32View;\n var packedVertices = aIndex / this.vertexSize;\n var uvs = element.uvs;\n var indicies = element.indices;\n var vertexData = element.vertexData;\n var textureId = element._texture.baseTexture._batchLocation;\n var alpha = Math.min(element.worldAlpha, 1.0);\n var argb = (alpha < 1.0\n && element._texture.baseTexture.alphaMode)\n ? (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.premultiplyTint)(element._tintRGB, alpha)\n : element._tintRGB + (alpha * 255 << 24);\n // lets not worry about tint! for now..\n for (var i = 0; i < vertexData.length; i += 2) {\n float32View[aIndex++] = vertexData[i];\n float32View[aIndex++] = vertexData[i + 1];\n float32View[aIndex++] = uvs[i];\n float32View[aIndex++] = uvs[i + 1];\n uint32View[aIndex++] = argb;\n float32View[aIndex++] = textureId;\n }\n for (var i = 0; i < indicies.length; i++) {\n indexBuffer[iIndex++] = packedVertices + indicies[i];\n }\n };\n /**\n * Pool of `BatchDrawCall` objects that `flush` used\n * to create \"batches\" of the objects being rendered.\n *\n * These are never re-allocated again.\n * Shared between all batch renderers because it can be only one \"flush\" working at the moment.\n *\n * @static\n * @member {PIXI.BatchDrawCall[]}\n */\n AbstractBatchRenderer._drawCallPool = [];\n /**\n * Pool of `BatchDrawCall` objects that `flush` used\n * to create \"batches\" of the objects being rendered.\n *\n * These are never re-allocated again.\n * Shared between all batch renderers because it can be only one \"flush\" working at the moment.\n *\n * @static\n * @member {PIXI.BatchTextureArray[]}\n */\n AbstractBatchRenderer._textureArrayPool = [];\n return AbstractBatchRenderer;\n}(ObjectRenderer));\n\n/**\n * Helper that generates batching multi-texture shader. Use it with your new BatchRenderer\n *\n * @class\n * @memberof PIXI\n */\nvar BatchShaderGenerator = /** @class */ (function () {\n /**\n * @param {string} vertexSrc - Vertex shader\n * @param {string} fragTemplate - Fragment shader template\n */\n function BatchShaderGenerator(vertexSrc, fragTemplate) {\n /**\n * Reference to the vertex shader source.\n *\n * @member {string}\n */\n this.vertexSrc = vertexSrc;\n /**\n * Reference to the fragement shader template. Must contain \"%count%\" and \"%forloop%\".\n *\n * @member {string}\n */\n this.fragTemplate = fragTemplate;\n this.programCache = {};\n this.defaultGroupCache = {};\n if (fragTemplate.indexOf('%count%') < 0) {\n throw new Error('Fragment template must contain \"%count%\".');\n }\n if (fragTemplate.indexOf('%forloop%') < 0) {\n throw new Error('Fragment template must contain \"%forloop%\".');\n }\n }\n BatchShaderGenerator.prototype.generateShader = function (maxTextures) {\n if (!this.programCache[maxTextures]) {\n var sampleValues = new Int32Array(maxTextures);\n for (var i = 0; i < maxTextures; i++) {\n sampleValues[i] = i;\n }\n this.defaultGroupCache[maxTextures] = UniformGroup.from({ uSamplers: sampleValues }, true);\n var fragmentSrc = this.fragTemplate;\n fragmentSrc = fragmentSrc.replace(/%count%/gi, \"\" + maxTextures);\n fragmentSrc = fragmentSrc.replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));\n this.programCache[maxTextures] = new Program(this.vertexSrc, fragmentSrc);\n }\n var uniforms = {\n tint: new Float32Array([1, 1, 1, 1]),\n translationMatrix: new _pixi_math__WEBPACK_IMPORTED_MODULE_5__.Matrix(),\n default: this.defaultGroupCache[maxTextures],\n };\n return new Shader(this.programCache[maxTextures], uniforms);\n };\n BatchShaderGenerator.prototype.generateSampleSrc = function (maxTextures) {\n var src = '';\n src += '\\n';\n src += '\\n';\n for (var i = 0; i < maxTextures; i++) {\n if (i > 0) {\n src += '\\nelse ';\n }\n if (i < maxTextures - 1) {\n src += \"if(vTextureId < \" + i + \".5)\";\n }\n src += '\\n{';\n src += \"\\n\\tcolor = texture2D(uSamplers[\" + i + \"], vTextureCoord);\";\n src += '\\n}';\n }\n src += '\\n';\n src += '\\n';\n return src;\n };\n return BatchShaderGenerator;\n}());\n\n/**\n * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects).\n *\n * @class\n * @memberof PIXI\n */\nvar BatchGeometry = /** @class */ (function (_super) {\n __extends(BatchGeometry, _super);\n /**\n * @param {boolean} [_static=false] - Optimization flag, where `false`\n * is updated every frame, `true` doesn't change frame-to-frame.\n */\n function BatchGeometry(_static) {\n if (_static === void 0) { _static = false; }\n var _this = _super.call(this) || this;\n /**\n * Buffer used for position, color, texture IDs\n *\n * @member {PIXI.Buffer}\n * @protected\n */\n _this._buffer = new Buffer(null, _static, false);\n /**\n * Index buffer data\n *\n * @member {PIXI.Buffer}\n * @protected\n */\n _this._indexBuffer = new Buffer(null, _static, true);\n _this.addAttribute('aVertexPosition', _this._buffer, 2, false, _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.TYPES.FLOAT)\n .addAttribute('aTextureCoord', _this._buffer, 2, false, _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.TYPES.FLOAT)\n .addAttribute('aColor', _this._buffer, 4, true, _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.TYPES.UNSIGNED_BYTE)\n .addAttribute('aTextureId', _this._buffer, 1, true, _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.TYPES.FLOAT)\n .addIndex(_this._indexBuffer);\n return _this;\n }\n return BatchGeometry;\n}(Geometry));\n\nvar defaultVertex$2 = \"precision highp float;\\nattribute vec2 aVertexPosition;\\nattribute vec2 aTextureCoord;\\nattribute vec4 aColor;\\nattribute float aTextureId;\\n\\nuniform mat3 projectionMatrix;\\nuniform mat3 translationMatrix;\\nuniform vec4 tint;\\n\\nvarying vec2 vTextureCoord;\\nvarying vec4 vColor;\\nvarying float vTextureId;\\n\\nvoid main(void){\\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\\n\\n vTextureCoord = aTextureCoord;\\n vTextureId = aTextureId;\\n vColor = aColor * tint;\\n}\\n\";\n\nvar defaultFragment$2 = \"varying vec2 vTextureCoord;\\nvarying vec4 vColor;\\nvarying float vTextureId;\\nuniform sampler2D uSamplers[%count%];\\n\\nvoid main(void){\\n vec4 color;\\n %forloop%\\n gl_FragColor = color * vColor;\\n}\\n\";\n\n/**\n * @class\n * @memberof PIXI\n * @hideconstructor\n */\nvar BatchPluginFactory = /** @class */ (function () {\n function BatchPluginFactory() {\n }\n /**\n * Create a new BatchRenderer plugin for Renderer. this convenience can provide an easy way\n * to extend BatchRenderer with all the necessary pieces.\n * @example\n * const fragment = `\n * varying vec2 vTextureCoord;\n * varying vec4 vColor;\n * varying float vTextureId;\n * uniform sampler2D uSamplers[%count%];\n *\n * void main(void){\n * vec4 color;\n * %forloop%\n * gl_FragColor = vColor * vec4(color.a - color.rgb, color.a);\n * }\n * `;\n * const InvertBatchRenderer = PIXI.BatchPluginFactory.create({ fragment });\n * PIXI.Renderer.registerPlugin('invert', InvertBatchRenderer);\n * const sprite = new PIXI.Sprite();\n * sprite.pluginName = 'invert';\n *\n * @static\n * @param {object} [options]\n * @param {string} [options.vertex=PIXI.BatchPluginFactory.defaultVertexSrc] - Vertex shader source\n * @param {string} [options.fragment=PIXI.BatchPluginFactory.defaultFragmentTemplate] - Fragment shader template\n * @param {number} [options.vertexSize=6] - Vertex size\n * @param {object} [options.geometryClass=PIXI.BatchGeometry]\n * @return {*} New batch renderer plugin\n */\n BatchPluginFactory.create = function (options) {\n var _a = Object.assign({\n vertex: defaultVertex$2,\n fragment: defaultFragment$2,\n geometryClass: BatchGeometry,\n vertexSize: 6,\n }, options), vertex = _a.vertex, fragment = _a.fragment, vertexSize = _a.vertexSize, geometryClass = _a.geometryClass;\n return /** @class */ (function (_super) {\n __extends(BatchPlugin, _super);\n function BatchPlugin(renderer) {\n var _this = _super.call(this, renderer) || this;\n _this.shaderGenerator = new BatchShaderGenerator(vertex, fragment);\n _this.geometryClass = geometryClass;\n _this.vertexSize = vertexSize;\n return _this;\n }\n return BatchPlugin;\n }(AbstractBatchRenderer));\n };\n Object.defineProperty(BatchPluginFactory, \"defaultVertexSrc\", {\n /**\n * The default vertex shader source\n *\n * @static\n * @type {string}\n * @constant\n */\n get: function () {\n return defaultVertex$2;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BatchPluginFactory, \"defaultFragmentTemplate\", {\n /**\n * The default fragment shader source\n *\n * @static\n * @type {string}\n * @constant\n */\n get: function () {\n return defaultFragment$2;\n },\n enumerable: false,\n configurable: true\n });\n return BatchPluginFactory;\n}());\n// Setup the default BatchRenderer plugin, this is what\n// we'll actually export at the root level\nvar BatchRenderer = BatchPluginFactory.create();\n\n\n//# sourceMappingURL=core.es.js.map\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/@pixi/core/lib/core.es.js?"); /***/ }), /***/ "./node_modules/@pixi/display/lib/display.es.js": /*!******************************************************!*\ !*** ./node_modules/@pixi/display/lib/display.es.js ***! \******************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Bounds\": () => (/* binding */ Bounds),\n/* harmony export */ \"Container\": () => (/* binding */ Container),\n/* harmony export */ \"DisplayObject\": () => (/* binding */ DisplayObject),\n/* harmony export */ \"TemporaryDisplayObject\": () => (/* binding */ TemporaryDisplayObject)\n/* harmony export */ });\n/* harmony import */ var _pixi_settings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @pixi/settings */ \"./node_modules/@pixi/settings/lib/settings.es.js\");\n/* harmony import */ var _pixi_math__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @pixi/math */ \"./node_modules/@pixi/math/lib/math.es.js\");\n/* harmony import */ var _pixi_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @pixi/utils */ \"./node_modules/@pixi/utils/lib/utils.es.js\");\n/*!\n * @pixi/display - v5.3.11\n * Compiled Mon, 01 Nov 2021 16:10:12 UTC\n *\n * @pixi/display is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n\n\n\n\n/**\n * Sets the default value for the container property 'sortableChildren'.\n * If set to true, the container will sort its children by zIndex value\n * when updateTransform() is called, or manually if sortChildren() is called.\n *\n * This actually changes the order of elements in the array, so should be treated\n * as a basic solution that is not performant compared to other solutions,\n * such as @link https://github.com/pixijs/pixi-display\n *\n * Also be aware of that this may not work nicely with the addChildAt() function,\n * as the zIndex sorting may cause the child to automatically sorted to another position.\n *\n * @static\n * @constant\n * @name SORTABLE_CHILDREN\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\n_pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.SORTABLE_CHILDREN = false;\n\n/**\n * 'Builder' pattern for bounds rectangles.\n *\n * This could be called an Axis-Aligned Bounding Box.\n * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems.\n *\n * @class\n * @memberof PIXI\n */\nvar Bounds = /** @class */ (function () {\n function Bounds() {\n /**\n * @member {number}\n * @default 0\n */\n this.minX = Infinity;\n /**\n * @member {number}\n * @default 0\n */\n this.minY = Infinity;\n /**\n * @member {number}\n * @default 0\n */\n this.maxX = -Infinity;\n /**\n * @member {number}\n * @default 0\n */\n this.maxY = -Infinity;\n this.rect = null;\n /**\n * It is updated to _boundsID of corresponding object to keep bounds in sync with content.\n * Updated from outside, thus public modifier.\n *\n * @member {number}\n * @public\n */\n this.updateID = -1;\n }\n /**\n * Checks if bounds are empty.\n *\n * @return {boolean} True if empty.\n */\n Bounds.prototype.isEmpty = function () {\n return this.minX > this.maxX || this.minY > this.maxY;\n };\n /**\n * Clears the bounds and resets.\n *\n */\n Bounds.prototype.clear = function () {\n this.minX = Infinity;\n this.minY = Infinity;\n this.maxX = -Infinity;\n this.maxY = -Infinity;\n };\n /**\n * Can return Rectangle.EMPTY constant, either construct new rectangle, either use your rectangle\n * It is not guaranteed that it will return tempRect\n *\n * @param {PIXI.Rectangle} rect - temporary object will be used if AABB is not empty\n * @returns {PIXI.Rectangle} A rectangle of the bounds\n */\n Bounds.prototype.getRectangle = function (rect) {\n if (this.minX > this.maxX || this.minY > this.maxY) {\n return _pixi_math__WEBPACK_IMPORTED_MODULE_1__.Rectangle.EMPTY;\n }\n rect = rect || new _pixi_math__WEBPACK_IMPORTED_MODULE_1__.Rectangle(0, 0, 1, 1);\n rect.x = this.minX;\n rect.y = this.minY;\n rect.width = this.maxX - this.minX;\n rect.height = this.maxY - this.minY;\n return rect;\n };\n /**\n * This function should be inlined when its possible.\n *\n * @param {PIXI.IPointData} point - The point to add.\n */\n Bounds.prototype.addPoint = function (point) {\n this.minX = Math.min(this.minX, point.x);\n this.maxX = Math.max(this.maxX, point.x);\n this.minY = Math.min(this.minY, point.y);\n this.maxY = Math.max(this.maxY, point.y);\n };\n /**\n * Adds a quad, not transformed\n *\n * @param {Float32Array} vertices - The verts to add.\n */\n Bounds.prototype.addQuad = function (vertices) {\n var minX = this.minX;\n var minY = this.minY;\n var maxX = this.maxX;\n var maxY = this.maxY;\n var x = vertices[0];\n var y = vertices[1];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n x = vertices[2];\n y = vertices[3];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n x = vertices[4];\n y = vertices[5];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n x = vertices[6];\n y = vertices[7];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n };\n /**\n * Adds sprite frame, transformed.\n *\n * @param {PIXI.Transform} transform - transform to apply\n * @param {number} x0 - left X of frame\n * @param {number} y0 - top Y of frame\n * @param {number} x1 - right X of frame\n * @param {number} y1 - bottom Y of frame\n */\n Bounds.prototype.addFrame = function (transform, x0, y0, x1, y1) {\n this.addFrameMatrix(transform.worldTransform, x0, y0, x1, y1);\n };\n /**\n * Adds sprite frame, multiplied by matrix\n *\n * @param {PIXI.Matrix} matrix - matrix to apply\n * @param {number} x0 - left X of frame\n * @param {number} y0 - top Y of frame\n * @param {number} x1 - right X of frame\n * @param {number} y1 - bottom Y of frame\n */\n Bounds.prototype.addFrameMatrix = function (matrix, x0, y0, x1, y1) {\n var a = matrix.a;\n var b = matrix.b;\n var c = matrix.c;\n var d = matrix.d;\n var tx = matrix.tx;\n var ty = matrix.ty;\n var minX = this.minX;\n var minY = this.minY;\n var maxX = this.maxX;\n var maxY = this.maxY;\n var x = (a * x0) + (c * y0) + tx;\n var y = (b * x0) + (d * y0) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n x = (a * x1) + (c * y0) + tx;\n y = (b * x1) + (d * y0) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n x = (a * x0) + (c * y1) + tx;\n y = (b * x0) + (d * y1) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n x = (a * x1) + (c * y1) + tx;\n y = (b * x1) + (d * y1) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n };\n /**\n * Adds screen vertices from array\n *\n * @param {Float32Array} vertexData - calculated vertices\n * @param {number} beginOffset - begin offset\n * @param {number} endOffset - end offset, excluded\n */\n Bounds.prototype.addVertexData = function (vertexData, beginOffset, endOffset) {\n var minX = this.minX;\n var minY = this.minY;\n var maxX = this.maxX;\n var maxY = this.maxY;\n for (var i = beginOffset; i < endOffset; i += 2) {\n var x = vertexData[i];\n var y = vertexData[i + 1];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n }\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n };\n /**\n * Add an array of mesh vertices\n *\n * @param {PIXI.Transform} transform - mesh transform\n * @param {Float32Array} vertices - mesh coordinates in array\n * @param {number} beginOffset - begin offset\n * @param {number} endOffset - end offset, excluded\n */\n Bounds.prototype.addVertices = function (transform, vertices, beginOffset, endOffset) {\n this.addVerticesMatrix(transform.worldTransform, vertices, beginOffset, endOffset);\n };\n /**\n * Add an array of mesh vertices.\n *\n * @param {PIXI.Matrix} matrix - mesh matrix\n * @param {Float32Array} vertices - mesh coordinates in array\n * @param {number} beginOffset - begin offset\n * @param {number} endOffset - end offset, excluded\n * @param {number} [padX=0] - x padding\n * @param {number} [padY=0] - y padding\n */\n Bounds.prototype.addVerticesMatrix = function (matrix, vertices, beginOffset, endOffset, padX, padY) {\n if (padX === void 0) { padX = 0; }\n if (padY === void 0) { padY = padX; }\n var a = matrix.a;\n var b = matrix.b;\n var c = matrix.c;\n var d = matrix.d;\n var tx = matrix.tx;\n var ty = matrix.ty;\n var minX = this.minX;\n var minY = this.minY;\n var maxX = this.maxX;\n var maxY = this.maxY;\n for (var i = beginOffset; i < endOffset; i += 2) {\n var rawX = vertices[i];\n var rawY = vertices[i + 1];\n var x = (a * rawX) + (c * rawY) + tx;\n var y = (d * rawY) + (b * rawX) + ty;\n minX = Math.min(minX, x - padX);\n maxX = Math.max(maxX, x + padX);\n minY = Math.min(minY, y - padY);\n maxY = Math.max(maxY, y + padY);\n }\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n };\n /**\n * Adds other Bounds.\n *\n * @param {PIXI.Bounds} bounds - The Bounds to be added\n */\n Bounds.prototype.addBounds = function (bounds) {\n var minX = this.minX;\n var minY = this.minY;\n var maxX = this.maxX;\n var maxY = this.maxY;\n this.minX = bounds.minX < minX ? bounds.minX : minX;\n this.minY = bounds.minY < minY ? bounds.minY : minY;\n this.maxX = bounds.maxX > maxX ? bounds.maxX : maxX;\n this.maxY = bounds.maxY > maxY ? bounds.maxY : maxY;\n };\n /**\n * Adds other Bounds, masked with Bounds.\n *\n * @param {PIXI.Bounds} bounds - The Bounds to be added.\n * @param {PIXI.Bounds} mask - TODO\n */\n Bounds.prototype.addBoundsMask = function (bounds, mask) {\n var _minX = bounds.minX > mask.minX ? bounds.minX : mask.minX;\n var _minY = bounds.minY > mask.minY ? bounds.minY : mask.minY;\n var _maxX = bounds.maxX < mask.maxX ? bounds.maxX : mask.maxX;\n var _maxY = bounds.maxY < mask.maxY ? bounds.maxY : mask.maxY;\n if (_minX <= _maxX && _minY <= _maxY) {\n var minX = this.minX;\n var minY = this.minY;\n var maxX = this.maxX;\n var maxY = this.maxY;\n this.minX = _minX < minX ? _minX : minX;\n this.minY = _minY < minY ? _minY : minY;\n this.maxX = _maxX > maxX ? _maxX : maxX;\n this.maxY = _maxY > maxY ? _maxY : maxY;\n }\n };\n /**\n * Adds other Bounds, multiplied by matrix. Bounds shouldn't be empty.\n *\n * @param {PIXI.Bounds} bounds - other bounds\n * @param {PIXI.Matrix} matrix - multiplicator\n */\n Bounds.prototype.addBoundsMatrix = function (bounds, matrix) {\n this.addFrameMatrix(matrix, bounds.minX, bounds.minY, bounds.maxX, bounds.maxY);\n };\n /**\n * Adds other Bounds, masked with Rectangle.\n *\n * @param {PIXI.Bounds} bounds - TODO\n * @param {PIXI.Rectangle} area - TODO\n */\n Bounds.prototype.addBoundsArea = function (bounds, area) {\n var _minX = bounds.minX > area.x ? bounds.minX : area.x;\n var _minY = bounds.minY > area.y ? bounds.minY : area.y;\n var _maxX = bounds.maxX < area.x + area.width ? bounds.maxX : (area.x + area.width);\n var _maxY = bounds.maxY < area.y + area.height ? bounds.maxY : (area.y + area.height);\n if (_minX <= _maxX && _minY <= _maxY) {\n var minX = this.minX;\n var minY = this.minY;\n var maxX = this.maxX;\n var maxY = this.maxY;\n this.minX = _minX < minX ? _minX : minX;\n this.minY = _minY < minY ? _minY : minY;\n this.maxX = _maxX > maxX ? _maxX : maxX;\n this.maxY = _maxY > maxY ? _maxY : maxY;\n }\n };\n /**\n * Pads bounds object, making it grow in all directions.\n * If paddingY is omitted, both paddingX and paddingY will be set to paddingX.\n *\n * @param {number} [paddingX=0] - The horizontal padding amount.\n * @param {number} [paddingY=0] - The vertical padding amount.\n */\n Bounds.prototype.pad = function (paddingX, paddingY) {\n if (paddingX === void 0) { paddingX = 0; }\n if (paddingY === void 0) { paddingY = paddingX; }\n if (!this.isEmpty()) {\n this.minX -= paddingX;\n this.maxX += paddingX;\n this.minY -= paddingY;\n this.maxY += paddingY;\n }\n };\n /**\n * Adds padded frame. (x0, y0) should be strictly less than (x1, y1)\n *\n * @param {number} x0 - left X of frame\n * @param {number} y0 - top Y of frame\n * @param {number} x1 - right X of frame\n * @param {number} y1 - bottom Y of frame\n * @param {number} padX - padding X\n * @param {number} padY - padding Y\n */\n Bounds.prototype.addFramePad = function (x0, y0, x1, y1, padX, padY) {\n x0 -= padX;\n y0 -= padY;\n x1 += padX;\n y1 += padY;\n this.minX = this.minX < x0 ? this.minX : x0;\n this.maxX = this.maxX > x1 ? this.maxX : x1;\n this.minY = this.minY < y0 ? this.minY : y0;\n this.maxY = this.maxY > y1 ? this.maxY : y1;\n };\n return Bounds;\n}());\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } };\r\n return extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\n\n/**\n * The base class for all objects that are rendered on the screen.\n *\n * This is an abstract class and should not be used on its own; rather it should b e extended.\n *\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n */\nvar DisplayObject = /** @class */ (function (_super) {\n __extends(DisplayObject, _super);\n function DisplayObject() {\n var _this = _super.call(this) || this;\n _this.tempDisplayObjectParent = null;\n // TODO: need to create Transform from factory\n /**\n * World transform and local transform of this object.\n * This will become read-only later, please do not assign anything there unless you know what are you doing.\n *\n * @member {PIXI.Transform}\n */\n _this.transform = new _pixi_math__WEBPACK_IMPORTED_MODULE_1__.Transform();\n /**\n * The opacity of the object.\n *\n * @member {number}\n */\n _this.alpha = 1;\n /**\n * The visibility of the object. If false the object will not be drawn, and\n * the updateTransform function will not be called.\n *\n * Only affects recursive calls from parent. You can ask for bounds or call updateTransform manually.\n *\n * @member {boolean}\n */\n _this.visible = true;\n /**\n * Can this object be rendered, if false the object will not be drawn but the updateTransform\n * methods will still be called.\n *\n * Only affects recursive calls from parent. You can ask for bounds manually.\n *\n * @member {boolean}\n */\n _this.renderable = true;\n /**\n * The display object container that contains this display object.\n *\n * @member {PIXI.Container}\n */\n _this.parent = null;\n /**\n * The multiplied alpha of the displayObject.\n *\n * @member {number}\n * @readonly\n */\n _this.worldAlpha = 1;\n /**\n * Which index in the children array the display component was before the previous zIndex sort.\n * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider.\n *\n * @member {number}\n * @protected\n */\n _this._lastSortedIndex = 0;\n /**\n * The zIndex of the displayObject.\n * A higher value will mean it will be rendered on top of other displayObjects within the same container.\n *\n * @member {number}\n * @protected\n */\n _this._zIndex = 0;\n /**\n * The area the filter is applied to. This is used as more of an optimization\n * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle.\n *\n * Also works as an interaction mask.\n *\n * @member {?PIXI.Rectangle}\n */\n _this.filterArea = null;\n /**\n * Sets the filters for the displayObject.\n * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer.\n * To remove filters simply set this property to `'null'`.\n *\n * @member {?PIXI.Filter[]}\n */\n _this.filters = null;\n /**\n * Currently enabled filters\n * @member {PIXI.Filter[]}\n * @protected\n */\n _this._enabledFilters = null;\n /**\n * The bounds object, this is used to calculate and store the bounds of the displayObject.\n *\n * @member {PIXI.Bounds}\n */\n _this._bounds = new Bounds();\n /**\n * Local bounds object, swapped with `_bounds` when using `getLocalBounds()`.\n *\n * @member {PIXI.Bounds}\n */\n _this._localBounds = null;\n /**\n * Flags the cached bounds as dirty.\n *\n * @member {number}\n * @protected\n */\n _this._boundsID = 0;\n /**\n * Cache of this display-object's bounds-rectangle.\n *\n * @member {PIXI.Bounds}\n * @protected\n */\n _this._boundsRect = null;\n /**\n * Cache of this display-object's local-bounds rectangle.\n *\n * @member {PIXI.Bounds}\n * @protected\n */\n _this._localBoundsRect = null;\n /**\n * The original, cached mask of the object.\n *\n * @member {PIXI.Container|PIXI.MaskData|null}\n * @protected\n */\n _this._mask = null;\n /**\n * Fired when this DisplayObject is added to a Container.\n *\n * @event PIXI.DisplayObject#added\n * @param {PIXI.Container} container - The container added to.\n */\n /**\n * Fired when this DisplayObject is removed from a Container.\n *\n * @event PIXI.DisplayObject#removed\n * @param {PIXI.Container} container - The container removed from.\n */\n /**\n * If the object has been destroyed via destroy(). If true, it should not be used.\n *\n * @member {boolean}\n * @protected\n */\n _this._destroyed = false;\n /**\n * used to fast check if a sprite is.. a sprite!\n * @member {boolean}\n */\n _this.isSprite = false;\n /**\n * Does any other displayObject use this object as a mask?\n * @member {boolean}\n */\n _this.isMask = false;\n return _this;\n }\n /**\n * Mixes all enumerable properties and methods from a source object to DisplayObject.\n *\n * @param {object} source - The source of properties and methods to mix in.\n */\n DisplayObject.mixin = function (source) {\n // in ES8/ES2017, this would be really easy:\n // Object.defineProperties(DisplayObject.prototype, Object.getOwnPropertyDescriptors(source));\n // get all the enumerable property keys\n var keys = Object.keys(source);\n // loop through properties\n for (var i = 0; i < keys.length; ++i) {\n var propertyName = keys[i];\n // Set the property using the property descriptor - this works for accessors and normal value properties\n Object.defineProperty(DisplayObject.prototype, propertyName, Object.getOwnPropertyDescriptor(source, propertyName));\n }\n };\n /**\n * Recursively updates transform of all objects from the root to this one\n * internal function for toLocal()\n */\n DisplayObject.prototype._recursivePostUpdateTransform = function () {\n if (this.parent) {\n this.parent._recursivePostUpdateTransform();\n this.transform.updateTransform(this.parent.transform);\n }\n else {\n this.transform.updateTransform(this._tempDisplayObjectParent.transform);\n }\n };\n /**\n * Updates the object transform for rendering.\n *\n * TODO - Optimization pass!\n */\n DisplayObject.prototype.updateTransform = function () {\n this._boundsID++;\n this.transform.updateTransform(this.parent.transform);\n // multiply the alphas..\n this.worldAlpha = this.alpha * this.parent.worldAlpha;\n };\n /**\n * Retrieves the bounds of the displayObject as a rectangle object.\n *\n * @param {boolean} [skipUpdate] - Setting to `true` will stop the transforms of the scene graph from\n * being updated. This means the calculation returned MAY be out of date BUT will give you a\n * nice performance boost.\n * @param {PIXI.Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation.\n * @return {PIXI.Rectangle} The rectangular bounding area.\n */\n DisplayObject.prototype.getBounds = function (skipUpdate, rect) {\n if (!skipUpdate) {\n if (!this.parent) {\n this.parent = this._tempDisplayObjectParent;\n this.updateTransform();\n this.parent = null;\n }\n else {\n this._recursivePostUpdateTransform();\n this.updateTransform();\n }\n }\n if (this._bounds.updateID !== this._boundsID) {\n this.calculateBounds();\n this._bounds.updateID = this._boundsID;\n }\n if (!rect) {\n if (!this._boundsRect) {\n this._boundsRect = new _pixi_math__WEBPACK_IMPORTED_MODULE_1__.Rectangle();\n }\n rect = this._boundsRect;\n }\n return this._bounds.getRectangle(rect);\n };\n /**\n * Retrieves the local bounds of the displayObject as a rectangle object.\n *\n * @param {PIXI.Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation.\n * @return {PIXI.Rectangle} The rectangular bounding area.\n */\n DisplayObject.prototype.getLocalBounds = function (rect) {\n if (!rect) {\n if (!this._localBoundsRect) {\n this._localBoundsRect = new _pixi_math__WEBPACK_IMPORTED_MODULE_1__.Rectangle();\n }\n rect = this._localBoundsRect;\n }\n if (!this._localBounds) {\n this._localBounds = new Bounds();\n }\n var transformRef = this.transform;\n var parentRef = this.parent;\n this.parent = null;\n this.transform = this._tempDisplayObjectParent.transform;\n var worldBounds = this._bounds;\n var worldBoundsID = this._boundsID;\n this._bounds = this._localBounds;\n var bounds = this.getBounds(false, rect);\n this.parent = parentRef;\n this.transform = transformRef;\n this._bounds = worldBounds;\n this._bounds.updateID += this._boundsID - worldBoundsID; // reflect side-effects\n return bounds;\n };\n /**\n * Calculates the global position of the display object.\n *\n * @param {PIXI.IPointData} position - The world origin to calculate from.\n * @param {PIXI.Point} [point] - A Point object in which to store the value, optional\n * (otherwise will create a new Point).\n * @param {boolean} [skipUpdate=false] - Should we skip the update transform.\n * @return {PIXI.Point} A point object representing the position of this object.\n */\n DisplayObject.prototype.toGlobal = function (position, point, skipUpdate) {\n if (skipUpdate === void 0) { skipUpdate = false; }\n if (!skipUpdate) {\n this._recursivePostUpdateTransform();\n // this parent check is for just in case the item is a root object.\n // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly\n // this is mainly to avoid a parent check in the main loop. Every little helps for performance :)\n if (!this.parent) {\n this.parent = this._tempDisplayObjectParent;\n this.displayObjectUpdateTransform();\n this.parent = null;\n }\n else {\n this.displayObjectUpdateTransform();\n }\n }\n // don't need to update the lot\n return this.worldTransform.apply(position, point);\n };\n /**\n * Calculates the local position of the display object relative to another point.\n *\n * @param {PIXI.IPointData} position - The world origin to calculate from.\n * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from.\n * @param {PIXI.Point} [point] - A Point object in which to store the value, optional\n * (otherwise will create a new Point).\n * @param {boolean} [skipUpdate=false] - Should we skip the update transform\n * @return {PIXI.Point} A point object representing the position of this object\n */\n DisplayObject.prototype.toLocal = function (position, from, point, skipUpdate) {\n if (from) {\n position = from.toGlobal(position, point, skipUpdate);\n }\n if (!skipUpdate) {\n this._recursivePostUpdateTransform();\n // this parent check is for just in case the item is a root object.\n // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly\n // this is mainly to avoid a parent check in the main loop. Every little helps for performance :)\n if (!this.parent) {\n this.parent = this._tempDisplayObjectParent;\n this.displayObjectUpdateTransform();\n this.parent = null;\n }\n else {\n this.displayObjectUpdateTransform();\n }\n }\n // simply apply the matrix..\n return this.worldTransform.applyInverse(position, point);\n };\n /**\n * Set the parent Container of this DisplayObject.\n *\n * @param {PIXI.Container} container - The Container to add this DisplayObject to.\n * @return {PIXI.Container} The Container that this DisplayObject was added to.\n */\n DisplayObject.prototype.setParent = function (container) {\n if (!container || !container.addChild) {\n throw new Error('setParent: Argument must be a Container');\n }\n container.addChild(this);\n return container;\n };\n /**\n * Convenience function to set the position, scale, skew and pivot at once.\n *\n * @param {number} [x=0] - The X position\n * @param {number} [y=0] - The Y position\n * @param {number} [scaleX=1] - The X scale value\n * @param {number} [scaleY=1] - The Y scale value\n * @param {number} [rotation=0] - The rotation\n * @param {number} [skewX=0] - The X skew value\n * @param {number} [skewY=0] - The Y skew value\n * @param {number} [pivotX=0] - The X pivot value\n * @param {number} [pivotY=0] - The Y pivot value\n * @return {PIXI.DisplayObject} The DisplayObject instance\n */\n DisplayObject.prototype.setTransform = function (x, y, scaleX, scaleY, rotation, skewX, skewY, pivotX, pivotY) {\n if (x === void 0) { x = 0; }\n if (y === void 0) { y = 0; }\n if (scaleX === void 0) { scaleX = 1; }\n if (scaleY === void 0) { scaleY = 1; }\n if (rotation === void 0) { rotation = 0; }\n if (skewX === void 0) { skewX = 0; }\n if (skewY === void 0) { skewY = 0; }\n if (pivotX === void 0) { pivotX = 0; }\n if (pivotY === void 0) { pivotY = 0; }\n this.position.x = x;\n this.position.y = y;\n this.scale.x = !scaleX ? 1 : scaleX;\n this.scale.y = !scaleY ? 1 : scaleY;\n this.rotation = rotation;\n this.skew.x = skewX;\n this.skew.y = skewY;\n this.pivot.x = pivotX;\n this.pivot.y = pivotY;\n return this;\n };\n /**\n * Base destroy method for generic display objects. This will automatically\n * remove the display object from its parent Container as well as remove\n * all current event listeners and internal references. Do not use a DisplayObject\n * after calling `destroy()`.\n *\n */\n DisplayObject.prototype.destroy = function (_options) {\n if (this.parent) {\n this.parent.removeChild(this);\n }\n this.removeAllListeners();\n this.transform = null;\n this.parent = null;\n this._bounds = null;\n this._mask = null;\n this.filters = null;\n this.filterArea = null;\n this.hitArea = null;\n this.interactive = false;\n this.interactiveChildren = false;\n this._destroyed = true;\n };\n Object.defineProperty(DisplayObject.prototype, \"_tempDisplayObjectParent\", {\n /**\n * @protected\n * @member {PIXI.Container}\n */\n get: function () {\n if (this.tempDisplayObjectParent === null) {\n // eslint-disable-next-line no-use-before-define\n this.tempDisplayObjectParent = new TemporaryDisplayObject();\n }\n return this.tempDisplayObjectParent;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Used in Renderer, cacheAsBitmap and other places where you call an `updateTransform` on root\n *\n * ```\n * const cacheParent = elem.enableTempParent();\n * elem.updateTransform();\n * elem.disableTempParent(cacheParent);\n * ```\n *\n * @returns {PIXI.DisplayObject} current parent\n */\n DisplayObject.prototype.enableTempParent = function () {\n var myParent = this.parent;\n this.parent = this._tempDisplayObjectParent;\n return myParent;\n };\n /**\n * Pair method for `enableTempParent`\n * @param {PIXI.DisplayObject} cacheParent actual parent of element\n */\n DisplayObject.prototype.disableTempParent = function (cacheParent) {\n this.parent = cacheParent;\n };\n Object.defineProperty(DisplayObject.prototype, \"x\", {\n /**\n * The position of the displayObject on the x axis relative to the local coordinates of the parent.\n * An alias to position.x\n *\n * @member {number}\n */\n get: function () {\n return this.position.x;\n },\n set: function (value) {\n this.transform.position.x = value;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(DisplayObject.prototype, \"y\", {\n /**\n * The position of the displayObject on the y axis relative to the local coordinates of the parent.\n * An alias to position.y\n *\n * @member {number}\n */\n get: function () {\n return this.position.y;\n },\n set: function (value) {\n this.transform.position.y = value;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(DisplayObject.prototype, \"worldTransform\", {\n /**\n * Current transform of the object based on world (parent) factors.\n *\n * @member {PIXI.Matrix}\n * @readonly\n */\n get: function () {\n return this.transform.worldTransform;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(DisplayObject.prototype, \"localTransform\", {\n /**\n * Current transform of the object based on local factors: position, scale, other stuff.\n *\n * @member {PIXI.Matrix}\n * @readonly\n */\n get: function () {\n return this.transform.localTransform;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(DisplayObject.prototype, \"position\", {\n /**\n * The coordinate of the object relative to the local coordinates of the parent.\n * Assignment by value since pixi-v4.\n *\n * @member {PIXI.ObservablePoint}\n */\n get: function () {\n return this.transform.position;\n },\n set: function (value) {\n this.transform.position.copyFrom(value);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(DisplayObject.prototype, \"scale\", {\n /**\n * The scale factor of the object.\n * Assignment by value since pixi-v4.\n *\n * @member {PIXI.ObservablePoint}\n */\n get: function () {\n return this.transform.scale;\n },\n set: function (value) {\n this.transform.scale.copyFrom(value);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(DisplayObject.prototype, \"pivot\", {\n /**\n * The pivot point of the displayObject that it rotates around.\n * Assignment by value since pixi-v4.\n *\n * @member {PIXI.ObservablePoint}\n */\n get: function () {\n return this.transform.pivot;\n },\n set: function (value) {\n this.transform.pivot.copyFrom(value);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(DisplayObject.prototype, \"skew\", {\n /**\n * The skew factor for the object in radians.\n * Assignment by value since pixi-v4.\n *\n * @member {PIXI.ObservablePoint}\n */\n get: function () {\n return this.transform.skew;\n },\n set: function (value) {\n this.transform.skew.copyFrom(value);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(DisplayObject.prototype, \"rotation\", {\n /**\n * The rotation of the object in radians.\n * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.\n *\n * @member {number}\n */\n get: function () {\n return this.transform.rotation;\n },\n set: function (value) {\n this.transform.rotation = value;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(DisplayObject.prototype, \"angle\", {\n /**\n * The angle of the object in degrees.\n * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.\n *\n * @member {number}\n */\n get: function () {\n return this.transform.rotation * _pixi_math__WEBPACK_IMPORTED_MODULE_1__.RAD_TO_DEG;\n },\n set: function (value) {\n this.transform.rotation = value * _pixi_math__WEBPACK_IMPORTED_MODULE_1__.DEG_TO_RAD;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(DisplayObject.prototype, \"zIndex\", {\n /**\n * The zIndex of the displayObject.\n * If a container has the sortableChildren property set to true, children will be automatically\n * sorted by zIndex value; a higher value will mean it will be moved towards the end of the array,\n * and thus rendered on top of other displayObjects within the same container.\n *\n * @member {number}\n */\n get: function () {\n return this._zIndex;\n },\n set: function (value) {\n this._zIndex = value;\n if (this.parent) {\n this.parent.sortDirty = true;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(DisplayObject.prototype, \"worldVisible\", {\n /**\n * Indicates if the object is globally visible.\n *\n * @member {boolean}\n * @readonly\n */\n get: function () {\n var item = this;\n do {\n if (!item.visible) {\n return false;\n }\n item = item.parent;\n } while (item);\n return true;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(DisplayObject.prototype, \"mask\", {\n /**\n * Sets a mask for the displayObject. A mask is an object that limits the visibility of an\n * object to the shape of the mask applied to it. In PixiJS a regular mask must be a\n * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it\n * utilities shape clipping. To remove a mask, set this property to `null`.\n *\n * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask.\n * @example\n * const graphics = new PIXI.Graphics();\n * graphics.beginFill(0xFF3300);\n * graphics.drawRect(50, 250, 100, 100);\n * graphics.endFill();\n *\n * const sprite = new PIXI.Sprite(texture);\n * sprite.mask = graphics;\n * @todo At the moment, PIXI.CanvasRenderer doesn't support PIXI.Sprite as mask.\n *\n * @member {PIXI.Container|PIXI.MaskData|null}\n */\n get: function () {\n return this._mask;\n },\n set: function (value) {\n if (this._mask) {\n var maskObject = (this._mask.maskObject || this._mask);\n maskObject.renderable = true;\n maskObject.isMask = false;\n }\n this._mask = value;\n if (this._mask) {\n var maskObject = (this._mask.maskObject || this._mask);\n maskObject.renderable = false;\n maskObject.isMask = true;\n }\n },\n enumerable: false,\n configurable: true\n });\n return DisplayObject;\n}(_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.EventEmitter));\nvar TemporaryDisplayObject = /** @class */ (function (_super) {\n __extends(TemporaryDisplayObject, _super);\n function TemporaryDisplayObject() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.sortDirty = null;\n return _this;\n }\n return TemporaryDisplayObject;\n}(DisplayObject));\n/**\n * DisplayObject default updateTransform, does not update children of container.\n * Will crash if there's no parent element.\n *\n * @memberof PIXI.DisplayObject#\n * @function displayObjectUpdateTransform\n */\nDisplayObject.prototype.displayObjectUpdateTransform = DisplayObject.prototype.updateTransform;\n\nfunction sortChildren(a, b) {\n if (a.zIndex === b.zIndex) {\n return a._lastSortedIndex - b._lastSortedIndex;\n }\n return a.zIndex - b.zIndex;\n}\n/**\n * A Container represents a collection of display objects.\n *\n * It is the base class of all display objects that act as a container for other objects (like Sprites).\n *\n *```js\n * let container = new PIXI.Container();\n * container.addChild(sprite);\n * ```\n *\n * @class\n * @extends PIXI.DisplayObject\n * @memberof PIXI\n */\nvar Container = /** @class */ (function (_super) {\n __extends(Container, _super);\n function Container() {\n var _this = _super.call(this) || this;\n /**\n * The array of children of this container.\n *\n * @member {PIXI.DisplayObject[]}\n * @readonly\n */\n _this.children = [];\n /**\n * If set to true, the container will sort its children by zIndex value\n * when updateTransform() is called, or manually if sortChildren() is called.\n *\n * This actually changes the order of elements in the array, so should be treated\n * as a basic solution that is not performant compared to other solutions,\n * such as @link https://github.com/pixijs/pixi-display\n *\n * Also be aware of that this may not work nicely with the addChildAt() function,\n * as the zIndex sorting may cause the child to automatically sorted to another position.\n *\n * @see PIXI.settings.SORTABLE_CHILDREN\n *\n * @member {boolean}\n */\n _this.sortableChildren = _pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.SORTABLE_CHILDREN;\n /**\n * Should children be sorted by zIndex at the next updateTransform call.\n * Will get automatically set to true if a new child is added, or if a child's zIndex changes.\n *\n * @member {boolean}\n */\n _this.sortDirty = false;\n return _this;\n /**\n * Fired when a DisplayObject is added to this Container.\n *\n * @event PIXI.Container#childAdded\n * @param {PIXI.DisplayObject} child - The child added to the Container.\n * @param {PIXI.Container} container - The container that added the child.\n * @param {number} index - The children's index of the added child.\n */\n /**\n * Fired when a DisplayObject is removed from this Container.\n *\n * @event PIXI.DisplayObject#removedFrom\n * @param {PIXI.DisplayObject} child - The child removed from the Container.\n * @param {PIXI.Container} container - The container that removed removed the child.\n * @param {number} index - The former children's index of the removed child\n */\n }\n /**\n * Overridable method that can be used by Container subclasses whenever the children array is modified\n *\n * @protected\n */\n Container.prototype.onChildrenChange = function (_length) {\n /* empty */\n };\n /**\n * Adds one or more children to the container.\n *\n * Multiple items can be added like so: `myContainer.addChild(thingOne, thingTwo, thingThree)`\n *\n * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to add to the container\n * @return {PIXI.DisplayObject} The first child that was added.\n */\n Container.prototype.addChild = function () {\n var arguments$1 = arguments;\n\n var children = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n children[_i] = arguments$1[_i];\n }\n // if there is only one argument we can bypass looping through the them\n if (children.length > 1) {\n // loop through the array and add all children\n for (var i = 0; i < children.length; i++) {\n // eslint-disable-next-line prefer-rest-params\n this.addChild(children[i]);\n }\n }\n else {\n var child = children[0];\n // if the child has a parent then lets remove it as PixiJS objects can only exist in one place\n if (child.parent) {\n child.parent.removeChild(child);\n }\n child.parent = this;\n this.sortDirty = true;\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n this.children.push(child);\n // ensure bounds will be recalculated\n this._boundsID++;\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(this.children.length - 1);\n this.emit('childAdded', child, this, this.children.length - 1);\n child.emit('added', this);\n }\n return children[0];\n };\n /**\n * Adds a child to the container at a specified index. If the index is out of bounds an error will be thrown\n *\n * @param {PIXI.DisplayObject} child - The child to add\n * @param {number} index - The index to place the child in\n * @return {PIXI.DisplayObject} The child that was added.\n */\n Container.prototype.addChildAt = function (child, index) {\n if (index < 0 || index > this.children.length) {\n throw new Error(child + \"addChildAt: The index \" + index + \" supplied is out of bounds \" + this.children.length);\n }\n if (child.parent) {\n child.parent.removeChild(child);\n }\n child.parent = this;\n this.sortDirty = true;\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n this.children.splice(index, 0, child);\n // ensure bounds will be recalculated\n this._boundsID++;\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('added', this);\n this.emit('childAdded', child, this, index);\n return child;\n };\n /**\n * Swaps the position of 2 Display Objects within this container.\n *\n * @param {PIXI.DisplayObject} child - First display object to swap\n * @param {PIXI.DisplayObject} child2 - Second display object to swap\n */\n Container.prototype.swapChildren = function (child, child2) {\n if (child === child2) {\n return;\n }\n var index1 = this.getChildIndex(child);\n var index2 = this.getChildIndex(child2);\n this.children[index1] = child2;\n this.children[index2] = child;\n this.onChildrenChange(index1 < index2 ? index1 : index2);\n };\n /**\n * Returns the index position of a child DisplayObject instance\n *\n * @param {PIXI.DisplayObject} child - The DisplayObject instance to identify\n * @return {number} The index position of the child display object to identify\n */\n Container.prototype.getChildIndex = function (child) {\n var index = this.children.indexOf(child);\n if (index === -1) {\n throw new Error('The supplied DisplayObject must be a child of the caller');\n }\n return index;\n };\n /**\n * Changes the position of an existing child in the display object container\n *\n * @param {PIXI.DisplayObject} child - The child DisplayObject instance for which you want to change the index number\n * @param {number} index - The resulting index number for the child display object\n */\n Container.prototype.setChildIndex = function (child, index) {\n if (index < 0 || index >= this.children.length) {\n throw new Error(\"The index \" + index + \" supplied is out of bounds \" + this.children.length);\n }\n var currentIndex = this.getChildIndex(child);\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.removeItems)(this.children, currentIndex, 1); // remove from old position\n this.children.splice(index, 0, child); // add at new position\n this.onChildrenChange(index);\n };\n /**\n * Returns the child at the specified index\n *\n * @param {number} index - The index to get the child at\n * @return {PIXI.DisplayObject} The child at the given index, if any.\n */\n Container.prototype.getChildAt = function (index) {\n if (index < 0 || index >= this.children.length) {\n throw new Error(\"getChildAt: Index (\" + index + \") does not exist.\");\n }\n return this.children[index];\n };\n /**\n * Removes one or more children from the container.\n *\n * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to remove\n * @return {PIXI.DisplayObject} The first child that was removed.\n */\n Container.prototype.removeChild = function () {\n var arguments$1 = arguments;\n\n var children = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n children[_i] = arguments$1[_i];\n }\n // if there is only one argument we can bypass looping through the them\n if (children.length > 1) {\n // loop through the arguments property and remove all children\n for (var i = 0; i < children.length; i++) {\n this.removeChild(children[i]);\n }\n }\n else {\n var child = children[0];\n var index = this.children.indexOf(child);\n if (index === -1)\n { return null; }\n child.parent = null;\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.removeItems)(this.children, index, 1);\n // ensure bounds will be recalculated\n this._boundsID++;\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('removed', this);\n this.emit('childRemoved', child, this, index);\n }\n return children[0];\n };\n /**\n * Removes a child from the specified index position.\n *\n * @param {number} index - The index to get the child from\n * @return {PIXI.DisplayObject} The child that was removed.\n */\n Container.prototype.removeChildAt = function (index) {\n var child = this.getChildAt(index);\n // ensure child transform will be recalculated..\n child.parent = null;\n child.transform._parentID = -1;\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.removeItems)(this.children, index, 1);\n // ensure bounds will be recalculated\n this._boundsID++;\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('removed', this);\n this.emit('childRemoved', child, this, index);\n return child;\n };\n /**\n * Removes all children from this container that are within the begin and end indexes.\n *\n * @param {number} [beginIndex=0] - The beginning position.\n * @param {number} [endIndex=this.children.length] - The ending position. Default value is size of the container.\n * @returns {PIXI.DisplayObject[]} List of removed children\n */\n Container.prototype.removeChildren = function (beginIndex, endIndex) {\n if (beginIndex === void 0) { beginIndex = 0; }\n if (endIndex === void 0) { endIndex = this.children.length; }\n var begin = beginIndex;\n var end = endIndex;\n var range = end - begin;\n var removed;\n if (range > 0 && range <= end) {\n removed = this.children.splice(begin, range);\n for (var i = 0; i < removed.length; ++i) {\n removed[i].parent = null;\n if (removed[i].transform) {\n removed[i].transform._parentID = -1;\n }\n }\n this._boundsID++;\n this.onChildrenChange(beginIndex);\n for (var i = 0; i < removed.length; ++i) {\n removed[i].emit('removed', this);\n this.emit('childRemoved', removed[i], this, i);\n }\n return removed;\n }\n else if (range === 0 && this.children.length === 0) {\n return [];\n }\n throw new RangeError('removeChildren: numeric values are outside the acceptable range.');\n };\n /**\n * Sorts children by zIndex. Previous order is mantained for 2 children with the same zIndex.\n */\n Container.prototype.sortChildren = function () {\n var sortRequired = false;\n for (var i = 0, j = this.children.length; i < j; ++i) {\n var child = this.children[i];\n child._lastSortedIndex = i;\n if (!sortRequired && child.zIndex !== 0) {\n sortRequired = true;\n }\n }\n if (sortRequired && this.children.length > 1) {\n this.children.sort(sortChildren);\n }\n this.sortDirty = false;\n };\n /**\n * Updates the transform on all children of this container for rendering\n */\n Container.prototype.updateTransform = function () {\n if (this.sortableChildren && this.sortDirty) {\n this.sortChildren();\n }\n this._boundsID++;\n this.transform.updateTransform(this.parent.transform);\n // TODO: check render flags, how to process stuff here\n this.worldAlpha = this.alpha * this.parent.worldAlpha;\n for (var i = 0, j = this.children.length; i < j; ++i) {\n var child = this.children[i];\n if (child.visible) {\n child.updateTransform();\n }\n }\n };\n /**\n * Recalculates the bounds of the container.\n *\n */\n Container.prototype.calculateBounds = function () {\n this._bounds.clear();\n this._calculateBounds();\n for (var i = 0; i < this.children.length; i++) {\n var child = this.children[i];\n if (!child.visible || !child.renderable) {\n continue;\n }\n child.calculateBounds();\n // TODO: filter+mask, need to mask both somehow\n if (child._mask) {\n var maskObject = (child._mask.maskObject || child._mask);\n maskObject.calculateBounds();\n this._bounds.addBoundsMask(child._bounds, maskObject._bounds);\n }\n else if (child.filterArea) {\n this._bounds.addBoundsArea(child._bounds, child.filterArea);\n }\n else {\n this._bounds.addBounds(child._bounds);\n }\n }\n this._bounds.updateID = this._boundsID;\n };\n /**\n * Retrieves the local bounds of the displayObject as a rectangle object.\n *\n * @param {PIXI.Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation.\n * @param {boolean} [skipChildrenUpdate=false] - Setting to `true` will stop re-calculation of children transforms,\n * it was default behaviour of pixi 4.0-5.2 and caused many problems to users.\n * @return {PIXI.Rectangle} The rectangular bounding area.\n */\n Container.prototype.getLocalBounds = function (rect, skipChildrenUpdate) {\n if (skipChildrenUpdate === void 0) { skipChildrenUpdate = false; }\n var result = _super.prototype.getLocalBounds.call(this, rect);\n if (!skipChildrenUpdate) {\n for (var i = 0, j = this.children.length; i < j; ++i) {\n var child = this.children[i];\n if (child.visible) {\n child.updateTransform();\n }\n }\n }\n return result;\n };\n /**\n * Recalculates the bounds of the object. Override this to\n * calculate the bounds of the specific object (not including children).\n *\n * @protected\n */\n Container.prototype._calculateBounds = function () {\n // FILL IN//\n };\n /**\n * Renders the object using the WebGL renderer\n *\n * @param {PIXI.Renderer} renderer - The renderer\n */\n Container.prototype.render = function (renderer) {\n // if the object is not visible or the alpha is 0 then no need to render this element\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n // do a quick check to see if this element has a mask or a filter.\n if (this._mask || (this.filters && this.filters.length)) {\n this.renderAdvanced(renderer);\n }\n else {\n this._render(renderer);\n // simple render children!\n for (var i = 0, j = this.children.length; i < j; ++i) {\n this.children[i].render(renderer);\n }\n }\n };\n /**\n * Render the object using the WebGL renderer and advanced features.\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n Container.prototype.renderAdvanced = function (renderer) {\n renderer.batch.flush();\n var filters = this.filters;\n var mask = this._mask;\n // push filter first as we need to ensure the stencil buffer is correct for any masking\n if (filters) {\n if (!this._enabledFilters) {\n this._enabledFilters = [];\n }\n this._enabledFilters.length = 0;\n for (var i = 0; i < filters.length; i++) {\n if (filters[i].enabled) {\n this._enabledFilters.push(filters[i]);\n }\n }\n if (this._enabledFilters.length) {\n renderer.filter.push(this, this._enabledFilters);\n }\n }\n if (mask) {\n renderer.mask.push(this, this._mask);\n }\n // add this object to the batch, only rendered if it has a texture.\n this._render(renderer);\n // now loop through the children and make sure they get rendered\n for (var i = 0, j = this.children.length; i < j; i++) {\n this.children[i].render(renderer);\n }\n renderer.batch.flush();\n if (mask) {\n renderer.mask.pop(this);\n }\n if (filters && this._enabledFilters && this._enabledFilters.length) {\n renderer.filter.pop();\n }\n };\n /**\n * To be overridden by the subclasses.\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n Container.prototype._render = function (_renderer) {\n // this is where content itself gets rendered...\n };\n /**\n * Removes all internal references and listeners as well as removes children from the display list.\n * Do not use a Container after calling `destroy`.\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the texture of the child sprite\n * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the base texture of the child sprite\n */\n Container.prototype.destroy = function (options) {\n _super.prototype.destroy.call(this);\n this.sortDirty = false;\n var destroyChildren = typeof options === 'boolean' ? options : options && options.children;\n var oldChildren = this.removeChildren(0, this.children.length);\n if (destroyChildren) {\n for (var i = 0; i < oldChildren.length; ++i) {\n oldChildren[i].destroy(options);\n }\n }\n };\n Object.defineProperty(Container.prototype, \"width\", {\n /**\n * The width of the Container, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get: function () {\n return this.scale.x * this.getLocalBounds().width;\n },\n set: function (value) {\n var width = this.getLocalBounds().width;\n if (width !== 0) {\n this.scale.x = value / width;\n }\n else {\n this.scale.x = 1;\n }\n this._width = value;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Container.prototype, \"height\", {\n /**\n * The height of the Container, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get: function () {\n return this.scale.y * this.getLocalBounds().height;\n },\n set: function (value) {\n var height = this.getLocalBounds().height;\n if (height !== 0) {\n this.scale.y = value / height;\n }\n else {\n this.scale.y = 1;\n }\n this._height = value;\n },\n enumerable: false,\n configurable: true\n });\n return Container;\n}(DisplayObject));\n/**\n * Container default updateTransform, does update children of container.\n * Will crash if there's no parent element.\n *\n * @memberof PIXI.Container#\n * @function containerUpdateTransform\n */\nContainer.prototype.containerUpdateTransform = Container.prototype.updateTransform;\n\n\n//# sourceMappingURL=display.es.js.map\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/@pixi/display/lib/display.es.js?"); /***/ }), /***/ "./node_modules/@pixi/extract/lib/extract.es.js": /*!******************************************************!*\ !*** ./node_modules/@pixi/extract/lib/extract.es.js ***! \******************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Extract\": () => (/* binding */ Extract)\n/* harmony export */ });\n/* harmony import */ var _pixi_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @pixi/utils */ \"./node_modules/@pixi/utils/lib/utils.es.js\");\n/* harmony import */ var _pixi_math__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @pixi/math */ \"./node_modules/@pixi/math/lib/math.es.js\");\n/* harmony import */ var _pixi_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @pixi/core */ \"./node_modules/@pixi/core/lib/core.es.js\");\n/*!\n * @pixi/extract - v5.3.11\n * Compiled Mon, 01 Nov 2021 16:10:12 UTC\n *\n * @pixi/extract is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n\n\n\n\nvar TEMP_RECT = new _pixi_math__WEBPACK_IMPORTED_MODULE_1__.Rectangle();\nvar BYTES_PER_PIXEL = 4;\n/**\n * This class provides renderer-specific plugins for exporting content from a renderer.\n * For instance, these plugins can be used for saving an Image, Canvas element or for exporting the raw image data (pixels).\n *\n * Do not instantiate these plugins directly. It is available from the `renderer.plugins` property.\n * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}.\n * @example\n * // Create a new app (will auto-add extract plugin to renderer)\n * const app = new PIXI.Application();\n *\n * // Draw a red circle\n * const graphics = new PIXI.Graphics()\n * .beginFill(0xFF0000)\n * .drawCircle(0, 0, 50);\n *\n * // Render the graphics as an HTMLImageElement\n * const image = app.renderer.plugins.extract.image(graphics);\n * document.body.appendChild(image);\n * @class\n * @memberof PIXI\n */\nvar Extract = /** @class */ (function () {\n /**\n * @param {PIXI.Renderer} renderer - A reference to the current renderer\n */\n function Extract(renderer) {\n this.renderer = renderer;\n /**\n * Collection of methods for extracting data (image, pixels, etc.) from a display object or render texture\n *\n * @member {PIXI.Extract} extract\n * @memberof PIXI.Renderer#\n * @see PIXI.Extract\n */\n renderer.extract = this;\n }\n /**\n * Will return a HTML Image of the target\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @param {string} [format] - Image format, e.g. \"image/jpeg\" or \"image/webp\".\n * @param {number} [quality] - JPEG or Webp compression from 0 to 1. Default is 0.92.\n * @return {HTMLImageElement} HTML Image of the target\n */\n Extract.prototype.image = function (target, format, quality) {\n var image = new Image();\n image.src = this.base64(target, format, quality);\n return image;\n };\n /**\n * Will return a a base64 encoded string of this target. It works by calling\n * `Extract.getCanvas` and then running toDataURL on that.\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @param {string} [format] - Image format, e.g. \"image/jpeg\" or \"image/webp\".\n * @param {number} [quality] - JPEG or Webp compression from 0 to 1. Default is 0.92.\n * @return {string} A base64 encoded string of the texture.\n */\n Extract.prototype.base64 = function (target, format, quality) {\n return this.canvas(target).toDataURL(format, quality);\n };\n /**\n * Creates a Canvas element, renders this target to it and then returns it.\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @return {HTMLCanvasElement} A Canvas element with the texture rendered on.\n */\n Extract.prototype.canvas = function (target) {\n var renderer = this.renderer;\n var resolution;\n var frame;\n var flipY = false;\n var renderTexture;\n var generated = false;\n if (target) {\n if (target instanceof _pixi_core__WEBPACK_IMPORTED_MODULE_2__.RenderTexture) {\n renderTexture = target;\n }\n else {\n renderTexture = this.renderer.generateTexture(target);\n generated = true;\n }\n }\n if (renderTexture) {\n resolution = renderTexture.baseTexture.resolution;\n frame = renderTexture.frame;\n flipY = false;\n renderer.renderTexture.bind(renderTexture);\n }\n else {\n resolution = this.renderer.resolution;\n flipY = true;\n frame = TEMP_RECT;\n frame.width = this.renderer.width;\n frame.height = this.renderer.height;\n renderer.renderTexture.bind(null);\n }\n var width = Math.floor((frame.width * resolution) + 1e-4);\n var height = Math.floor((frame.height * resolution) + 1e-4);\n var canvasBuffer = new _pixi_utils__WEBPACK_IMPORTED_MODULE_0__.CanvasRenderTarget(width, height, 1);\n var webglPixels = new Uint8Array(BYTES_PER_PIXEL * width * height);\n // read pixels to the array\n var gl = renderer.gl;\n gl.readPixels(frame.x * resolution, frame.y * resolution, width, height, gl.RGBA, gl.UNSIGNED_BYTE, webglPixels);\n // add the pixels to the canvas\n var canvasData = canvasBuffer.context.getImageData(0, 0, width, height);\n Extract.arrayPostDivide(webglPixels, canvasData.data);\n canvasBuffer.context.putImageData(canvasData, 0, 0);\n // pulling pixels\n if (flipY) {\n var target_1 = new _pixi_utils__WEBPACK_IMPORTED_MODULE_0__.CanvasRenderTarget(canvasBuffer.width, canvasBuffer.height, 1);\n target_1.context.scale(1, -1);\n // we can't render to itself because we should be empty before render.\n target_1.context.drawImage(canvasBuffer.canvas, 0, -height);\n canvasBuffer.destroy();\n canvasBuffer = target_1;\n }\n if (generated) {\n renderTexture.destroy(true);\n }\n // send the canvas back..\n return canvasBuffer.canvas;\n };\n /**\n * Will return a one-dimensional array containing the pixel data of the entire texture in RGBA\n * order, with integer values between 0 and 255 (included).\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @return {Uint8Array} One-dimensional array containing the pixel data of the entire texture\n */\n Extract.prototype.pixels = function (target) {\n var renderer = this.renderer;\n var resolution;\n var frame;\n var renderTexture;\n var generated = false;\n if (target) {\n if (target instanceof _pixi_core__WEBPACK_IMPORTED_MODULE_2__.RenderTexture) {\n renderTexture = target;\n }\n else {\n renderTexture = this.renderer.generateTexture(target);\n generated = true;\n }\n }\n if (renderTexture) {\n resolution = renderTexture.baseTexture.resolution;\n frame = renderTexture.frame;\n // bind the buffer\n renderer.renderTexture.bind(renderTexture);\n }\n else {\n resolution = renderer.resolution;\n frame = TEMP_RECT;\n frame.width = renderer.width;\n frame.height = renderer.height;\n renderer.renderTexture.bind(null);\n }\n var width = frame.width * resolution;\n var height = frame.height * resolution;\n var webglPixels = new Uint8Array(BYTES_PER_PIXEL * width * height);\n // read pixels to the array\n var gl = renderer.gl;\n gl.readPixels(frame.x * resolution, frame.y * resolution, width, height, gl.RGBA, gl.UNSIGNED_BYTE, webglPixels);\n if (generated) {\n renderTexture.destroy(true);\n }\n Extract.arrayPostDivide(webglPixels, webglPixels);\n return webglPixels;\n };\n /**\n * Destroys the extract\n *\n */\n Extract.prototype.destroy = function () {\n this.renderer.extract = null;\n this.renderer = null;\n };\n /**\n * Takes premultiplied pixel data and produces regular pixel data\n *\n * @private\n * @param pixels {number[] | Uint8Array | Uint8ClampedArray} array of pixel data\n * @param out {number[] | Uint8Array | Uint8ClampedArray} output array\n */\n Extract.arrayPostDivide = function (pixels, out) {\n for (var i = 0; i < pixels.length; i += 4) {\n var alpha = out[i + 3] = pixels[i + 3];\n if (alpha !== 0) {\n out[i] = Math.round(Math.min(pixels[i] * 255.0 / alpha, 255.0));\n out[i + 1] = Math.round(Math.min(pixels[i + 1] * 255.0 / alpha, 255.0));\n out[i + 2] = Math.round(Math.min(pixels[i + 2] * 255.0 / alpha, 255.0));\n }\n else {\n out[i] = pixels[i];\n out[i + 1] = pixels[i + 1];\n out[i + 2] = pixels[i + 2];\n }\n }\n };\n return Extract;\n}());\n\n\n//# sourceMappingURL=extract.es.js.map\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/@pixi/extract/lib/extract.es.js?"); /***/ }), /***/ "./node_modules/@pixi/filter-alpha/lib/filter-alpha.es.js": /*!****************************************************************!*\ !*** ./node_modules/@pixi/filter-alpha/lib/filter-alpha.es.js ***! \****************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"AlphaFilter\": () => (/* binding */ AlphaFilter)\n/* harmony export */ });\n/* harmony import */ var _pixi_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @pixi/core */ \"./node_modules/@pixi/core/lib/core.es.js\");\n/*!\n * @pixi/filter-alpha - v5.3.11\n * Compiled Mon, 01 Nov 2021 16:10:12 UTC\n *\n * @pixi/filter-alpha is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } };\r\n return extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\n\nvar fragment = \"varying vec2 vTextureCoord;\\n\\nuniform sampler2D uSampler;\\nuniform float uAlpha;\\n\\nvoid main(void)\\n{\\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;\\n}\\n\";\n\n/**\n * Simplest filter - applies alpha.\n *\n * Use this instead of Container's alpha property to avoid visual layering of individual elements.\n * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains.\n * If elements are not opaque, they will blend with each other anyway.\n *\n * Very handy if you want to use common features of all filters:\n *\n * 1. Assign a blendMode to this filter, blend all elements inside display object with background.\n *\n * 2. To use clipping in display coordinates, assign a filterArea to the same container that has this filter.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nvar AlphaFilter = /** @class */ (function (_super) {\n __extends(AlphaFilter, _super);\n /**\n * @param {number} [alpha=1] - Amount of alpha from 0 to 1, where 0 is transparent\n */\n function AlphaFilter(alpha) {\n if (alpha === void 0) { alpha = 1.0; }\n var _this = _super.call(this, _pixi_core__WEBPACK_IMPORTED_MODULE_0__.defaultVertex, fragment, { uAlpha: 1 }) || this;\n _this.alpha = alpha;\n return _this;\n }\n Object.defineProperty(AlphaFilter.prototype, \"alpha\", {\n /**\n * Coefficient for alpha multiplication\n *\n * @member {number}\n * @default 1\n */\n get: function () {\n return this.uniforms.uAlpha;\n },\n set: function (value) {\n this.uniforms.uAlpha = value;\n },\n enumerable: false,\n configurable: true\n });\n return AlphaFilter;\n}(_pixi_core__WEBPACK_IMPORTED_MODULE_0__.Filter));\n\n\n//# sourceMappingURL=filter-alpha.es.js.map\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/@pixi/filter-alpha/lib/filter-alpha.es.js?"); /***/ }), /***/ "./node_modules/@pixi/filter-blur/lib/filter-blur.es.js": /*!**************************************************************!*\ !*** ./node_modules/@pixi/filter-blur/lib/filter-blur.es.js ***! \**************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"BlurFilter\": () => (/* binding */ BlurFilter),\n/* harmony export */ \"BlurFilterPass\": () => (/* binding */ BlurFilterPass)\n/* harmony export */ });\n/* harmony import */ var _pixi_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @pixi/core */ \"./node_modules/@pixi/core/lib/core.es.js\");\n/* harmony import */ var _pixi_settings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @pixi/settings */ \"./node_modules/@pixi/settings/lib/settings.es.js\");\n/*!\n * @pixi/filter-blur - v5.3.11\n * Compiled Mon, 01 Nov 2021 16:10:12 UTC\n *\n * @pixi/filter-blur is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n\n\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } };\r\n return extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\n\nvar vertTemplate = \"\\n attribute vec2 aVertexPosition;\\n\\n uniform mat3 projectionMatrix;\\n\\n uniform float strength;\\n\\n varying vec2 vBlurTexCoords[%size%];\\n\\n uniform vec4 inputSize;\\n uniform vec4 outputFrame;\\n\\n vec4 filterVertexPosition( void )\\n {\\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\\n\\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\\n }\\n\\n vec2 filterTextureCoord( void )\\n {\\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\\n }\\n\\n void main(void)\\n {\\n gl_Position = filterVertexPosition();\\n\\n vec2 textureCoord = filterTextureCoord();\\n %blur%\\n }\";\nfunction generateBlurVertSource(kernelSize, x) {\n var halfLength = Math.ceil(kernelSize / 2);\n var vertSource = vertTemplate;\n var blurLoop = '';\n var template;\n if (x) {\n template = 'vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);';\n }\n else {\n template = 'vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);';\n }\n for (var i = 0; i < kernelSize; i++) {\n var blur = template.replace('%index%', i.toString());\n blur = blur.replace('%sampleIndex%', i - (halfLength - 1) + \".0\");\n blurLoop += blur;\n blurLoop += '\\n';\n }\n vertSource = vertSource.replace('%blur%', blurLoop);\n vertSource = vertSource.replace('%size%', kernelSize.toString());\n return vertSource;\n}\n\nvar GAUSSIAN_VALUES = {\n 5: [0.153388, 0.221461, 0.250301],\n 7: [0.071303, 0.131514, 0.189879, 0.214607],\n 9: [0.028532, 0.067234, 0.124009, 0.179044, 0.20236],\n 11: [0.0093, 0.028002, 0.065984, 0.121703, 0.175713, 0.198596],\n 13: [0.002406, 0.009255, 0.027867, 0.065666, 0.121117, 0.174868, 0.197641],\n 15: [0.000489, 0.002403, 0.009246, 0.02784, 0.065602, 0.120999, 0.174697, 0.197448],\n};\nvar fragTemplate = [\n 'varying vec2 vBlurTexCoords[%size%];',\n 'uniform sampler2D uSampler;',\n 'void main(void)',\n '{',\n ' gl_FragColor = vec4(0.0);',\n ' %blur%',\n '}' ].join('\\n');\nfunction generateBlurFragSource(kernelSize) {\n var kernel = GAUSSIAN_VALUES[kernelSize];\n var halfLength = kernel.length;\n var fragSource = fragTemplate;\n var blurLoop = '';\n var template = 'gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;';\n var value;\n for (var i = 0; i < kernelSize; i++) {\n var blur = template.replace('%index%', i.toString());\n value = i;\n if (i >= halfLength) {\n value = kernelSize - i - 1;\n }\n blur = blur.replace('%value%', kernel[value].toString());\n blurLoop += blur;\n blurLoop += '\\n';\n }\n fragSource = fragSource.replace('%blur%', blurLoop);\n fragSource = fragSource.replace('%size%', kernelSize.toString());\n return fragSource;\n}\n\n/**\n * Different types of environments for WebGL.\n *\n * @static\n * @memberof PIXI\n * @name ENV\n * @enum {number}\n * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility\n * with older / less advanced devices. If you experience unexplained flickering prefer this environment.\n * @property {number} WEBGL - Version 1 of WebGL\n * @property {number} WEBGL2 - Version 2 of WebGL\n */\nvar ENV;\n(function (ENV) {\n ENV[ENV[\"WEBGL_LEGACY\"] = 0] = \"WEBGL_LEGACY\";\n ENV[ENV[\"WEBGL\"] = 1] = \"WEBGL\";\n ENV[ENV[\"WEBGL2\"] = 2] = \"WEBGL2\";\n})(ENV || (ENV = {}));\n/**\n * Constant to identify the Renderer Type.\n *\n * @static\n * @memberof PIXI\n * @name RENDERER_TYPE\n * @enum {number}\n * @property {number} UNKNOWN - Unknown render type.\n * @property {number} WEBGL - WebGL render type.\n * @property {number} CANVAS - Canvas render type.\n */\nvar RENDERER_TYPE;\n(function (RENDERER_TYPE) {\n RENDERER_TYPE[RENDERER_TYPE[\"UNKNOWN\"] = 0] = \"UNKNOWN\";\n RENDERER_TYPE[RENDERER_TYPE[\"WEBGL\"] = 1] = \"WEBGL\";\n RENDERER_TYPE[RENDERER_TYPE[\"CANVAS\"] = 2] = \"CANVAS\";\n})(RENDERER_TYPE || (RENDERER_TYPE = {}));\n/**\n * Bitwise OR of masks that indicate the buffers to be cleared.\n *\n * @static\n * @memberof PIXI\n * @name BUFFER_BITS\n * @enum {number}\n * @property {number} COLOR - Indicates the buffers currently enabled for color writing.\n * @property {number} DEPTH - Indicates the depth buffer.\n * @property {number} STENCIL - Indicates the stencil buffer.\n */\nvar BUFFER_BITS;\n(function (BUFFER_BITS) {\n BUFFER_BITS[BUFFER_BITS[\"COLOR\"] = 16384] = \"COLOR\";\n BUFFER_BITS[BUFFER_BITS[\"DEPTH\"] = 256] = \"DEPTH\";\n BUFFER_BITS[BUFFER_BITS[\"STENCIL\"] = 1024] = \"STENCIL\";\n})(BUFFER_BITS || (BUFFER_BITS = {}));\n/**\n * Various blend modes supported by PIXI.\n *\n * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes.\n * Anything else will silently act like NORMAL.\n *\n * @memberof PIXI\n * @name BLEND_MODES\n * @enum {number}\n * @property {number} NORMAL\n * @property {number} ADD\n * @property {number} MULTIPLY\n * @property {number} SCREEN\n * @property {number} OVERLAY\n * @property {number} DARKEN\n * @property {number} LIGHTEN\n * @property {number} COLOR_DODGE\n * @property {number} COLOR_BURN\n * @property {number} HARD_LIGHT\n * @property {number} SOFT_LIGHT\n * @property {number} DIFFERENCE\n * @property {number} EXCLUSION\n * @property {number} HUE\n * @property {number} SATURATION\n * @property {number} COLOR\n * @property {number} LUMINOSITY\n * @property {number} NORMAL_NPM\n * @property {number} ADD_NPM\n * @property {number} SCREEN_NPM\n * @property {number} NONE\n * @property {number} SRC_IN\n * @property {number} SRC_OUT\n * @property {number} SRC_ATOP\n * @property {number} DST_OVER\n * @property {number} DST_IN\n * @property {number} DST_OUT\n * @property {number} DST_ATOP\n * @property {number} SUBTRACT\n * @property {number} SRC_OVER\n * @property {number} ERASE\n * @property {number} XOR\n */\nvar BLEND_MODES;\n(function (BLEND_MODES) {\n BLEND_MODES[BLEND_MODES[\"NORMAL\"] = 0] = \"NORMAL\";\n BLEND_MODES[BLEND_MODES[\"ADD\"] = 1] = \"ADD\";\n BLEND_MODES[BLEND_MODES[\"MULTIPLY\"] = 2] = \"MULTIPLY\";\n BLEND_MODES[BLEND_MODES[\"SCREEN\"] = 3] = \"SCREEN\";\n BLEND_MODES[BLEND_MODES[\"OVERLAY\"] = 4] = \"OVERLAY\";\n BLEND_MODES[BLEND_MODES[\"DARKEN\"] = 5] = \"DARKEN\";\n BLEND_MODES[BLEND_MODES[\"LIGHTEN\"] = 6] = \"LIGHTEN\";\n BLEND_MODES[BLEND_MODES[\"COLOR_DODGE\"] = 7] = \"COLOR_DODGE\";\n BLEND_MODES[BLEND_MODES[\"COLOR_BURN\"] = 8] = \"COLOR_BURN\";\n BLEND_MODES[BLEND_MODES[\"HARD_LIGHT\"] = 9] = \"HARD_LIGHT\";\n BLEND_MODES[BLEND_MODES[\"SOFT_LIGHT\"] = 10] = \"SOFT_LIGHT\";\n BLEND_MODES[BLEND_MODES[\"DIFFERENCE\"] = 11] = \"DIFFERENCE\";\n BLEND_MODES[BLEND_MODES[\"EXCLUSION\"] = 12] = \"EXCLUSION\";\n BLEND_MODES[BLEND_MODES[\"HUE\"] = 13] = \"HUE\";\n BLEND_MODES[BLEND_MODES[\"SATURATION\"] = 14] = \"SATURATION\";\n BLEND_MODES[BLEND_MODES[\"COLOR\"] = 15] = \"COLOR\";\n BLEND_MODES[BLEND_MODES[\"LUMINOSITY\"] = 16] = \"LUMINOSITY\";\n BLEND_MODES[BLEND_MODES[\"NORMAL_NPM\"] = 17] = \"NORMAL_NPM\";\n BLEND_MODES[BLEND_MODES[\"ADD_NPM\"] = 18] = \"ADD_NPM\";\n BLEND_MODES[BLEND_MODES[\"SCREEN_NPM\"] = 19] = \"SCREEN_NPM\";\n BLEND_MODES[BLEND_MODES[\"NONE\"] = 20] = \"NONE\";\n BLEND_MODES[BLEND_MODES[\"SRC_OVER\"] = 0] = \"SRC_OVER\";\n BLEND_MODES[BLEND_MODES[\"SRC_IN\"] = 21] = \"SRC_IN\";\n BLEND_MODES[BLEND_MODES[\"SRC_OUT\"] = 22] = \"SRC_OUT\";\n BLEND_MODES[BLEND_MODES[\"SRC_ATOP\"] = 23] = \"SRC_ATOP\";\n BLEND_MODES[BLEND_MODES[\"DST_OVER\"] = 24] = \"DST_OVER\";\n BLEND_MODES[BLEND_MODES[\"DST_IN\"] = 25] = \"DST_IN\";\n BLEND_MODES[BLEND_MODES[\"DST_OUT\"] = 26] = \"DST_OUT\";\n BLEND_MODES[BLEND_MODES[\"DST_ATOP\"] = 27] = \"DST_ATOP\";\n BLEND_MODES[BLEND_MODES[\"ERASE\"] = 26] = \"ERASE\";\n BLEND_MODES[BLEND_MODES[\"SUBTRACT\"] = 28] = \"SUBTRACT\";\n BLEND_MODES[BLEND_MODES[\"XOR\"] = 29] = \"XOR\";\n})(BLEND_MODES || (BLEND_MODES = {}));\n/**\n * Various webgl draw modes. These can be used to specify which GL drawMode to use\n * under certain situations and renderers.\n *\n * @memberof PIXI\n * @static\n * @name DRAW_MODES\n * @enum {number}\n * @property {number} POINTS\n * @property {number} LINES\n * @property {number} LINE_LOOP\n * @property {number} LINE_STRIP\n * @property {number} TRIANGLES\n * @property {number} TRIANGLE_STRIP\n * @property {number} TRIANGLE_FAN\n */\nvar DRAW_MODES;\n(function (DRAW_MODES) {\n DRAW_MODES[DRAW_MODES[\"POINTS\"] = 0] = \"POINTS\";\n DRAW_MODES[DRAW_MODES[\"LINES\"] = 1] = \"LINES\";\n DRAW_MODES[DRAW_MODES[\"LINE_LOOP\"] = 2] = \"LINE_LOOP\";\n DRAW_MODES[DRAW_MODES[\"LINE_STRIP\"] = 3] = \"LINE_STRIP\";\n DRAW_MODES[DRAW_MODES[\"TRIANGLES\"] = 4] = \"TRIANGLES\";\n DRAW_MODES[DRAW_MODES[\"TRIANGLE_STRIP\"] = 5] = \"TRIANGLE_STRIP\";\n DRAW_MODES[DRAW_MODES[\"TRIANGLE_FAN\"] = 6] = \"TRIANGLE_FAN\";\n})(DRAW_MODES || (DRAW_MODES = {}));\n/**\n * Various GL texture/resources formats.\n *\n * @memberof PIXI\n * @static\n * @name FORMATS\n * @enum {number}\n * @property {number} RGBA=6408\n * @property {number} RGB=6407\n * @property {number} ALPHA=6406\n * @property {number} LUMINANCE=6409\n * @property {number} LUMINANCE_ALPHA=6410\n * @property {number} DEPTH_COMPONENT=6402\n * @property {number} DEPTH_STENCIL=34041\n */\nvar FORMATS;\n(function (FORMATS) {\n FORMATS[FORMATS[\"RGBA\"] = 6408] = \"RGBA\";\n FORMATS[FORMATS[\"RGB\"] = 6407] = \"RGB\";\n FORMATS[FORMATS[\"ALPHA\"] = 6406] = \"ALPHA\";\n FORMATS[FORMATS[\"LUMINANCE\"] = 6409] = \"LUMINANCE\";\n FORMATS[FORMATS[\"LUMINANCE_ALPHA\"] = 6410] = \"LUMINANCE_ALPHA\";\n FORMATS[FORMATS[\"DEPTH_COMPONENT\"] = 6402] = \"DEPTH_COMPONENT\";\n FORMATS[FORMATS[\"DEPTH_STENCIL\"] = 34041] = \"DEPTH_STENCIL\";\n})(FORMATS || (FORMATS = {}));\n/**\n * Various GL target types.\n *\n * @memberof PIXI\n * @static\n * @name TARGETS\n * @enum {number}\n * @property {number} TEXTURE_2D=3553\n * @property {number} TEXTURE_CUBE_MAP=34067\n * @property {number} TEXTURE_2D_ARRAY=35866\n * @property {number} TEXTURE_CUBE_MAP_POSITIVE_X=34069\n * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_X=34070\n * @property {number} TEXTURE_CUBE_MAP_POSITIVE_Y=34071\n * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_Y=34072\n * @property {number} TEXTURE_CUBE_MAP_POSITIVE_Z=34073\n * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_Z=34074\n */\nvar TARGETS;\n(function (TARGETS) {\n TARGETS[TARGETS[\"TEXTURE_2D\"] = 3553] = \"TEXTURE_2D\";\n TARGETS[TARGETS[\"TEXTURE_CUBE_MAP\"] = 34067] = \"TEXTURE_CUBE_MAP\";\n TARGETS[TARGETS[\"TEXTURE_2D_ARRAY\"] = 35866] = \"TEXTURE_2D_ARRAY\";\n TARGETS[TARGETS[\"TEXTURE_CUBE_MAP_POSITIVE_X\"] = 34069] = \"TEXTURE_CUBE_MAP_POSITIVE_X\";\n TARGETS[TARGETS[\"TEXTURE_CUBE_MAP_NEGATIVE_X\"] = 34070] = \"TEXTURE_CUBE_MAP_NEGATIVE_X\";\n TARGETS[TARGETS[\"TEXTURE_CUBE_MAP_POSITIVE_Y\"] = 34071] = \"TEXTURE_CUBE_MAP_POSITIVE_Y\";\n TARGETS[TARGETS[\"TEXTURE_CUBE_MAP_NEGATIVE_Y\"] = 34072] = \"TEXTURE_CUBE_MAP_NEGATIVE_Y\";\n TARGETS[TARGETS[\"TEXTURE_CUBE_MAP_POSITIVE_Z\"] = 34073] = \"TEXTURE_CUBE_MAP_POSITIVE_Z\";\n TARGETS[TARGETS[\"TEXTURE_CUBE_MAP_NEGATIVE_Z\"] = 34074] = \"TEXTURE_CUBE_MAP_NEGATIVE_Z\";\n})(TARGETS || (TARGETS = {}));\n/**\n * Various GL data format types.\n *\n * @memberof PIXI\n * @static\n * @name TYPES\n * @enum {number}\n * @property {number} UNSIGNED_BYTE=5121\n * @property {number} UNSIGNED_SHORT=5123\n * @property {number} UNSIGNED_SHORT_5_6_5=33635\n * @property {number} UNSIGNED_SHORT_4_4_4_4=32819\n * @property {number} UNSIGNED_SHORT_5_5_5_1=32820\n * @property {number} FLOAT=5126\n * @property {number} HALF_FLOAT=36193\n */\nvar TYPES;\n(function (TYPES) {\n TYPES[TYPES[\"UNSIGNED_BYTE\"] = 5121] = \"UNSIGNED_BYTE\";\n TYPES[TYPES[\"UNSIGNED_SHORT\"] = 5123] = \"UNSIGNED_SHORT\";\n TYPES[TYPES[\"UNSIGNED_SHORT_5_6_5\"] = 33635] = \"UNSIGNED_SHORT_5_6_5\";\n TYPES[TYPES[\"UNSIGNED_SHORT_4_4_4_4\"] = 32819] = \"UNSIGNED_SHORT_4_4_4_4\";\n TYPES[TYPES[\"UNSIGNED_SHORT_5_5_5_1\"] = 32820] = \"UNSIGNED_SHORT_5_5_5_1\";\n TYPES[TYPES[\"FLOAT\"] = 5126] = \"FLOAT\";\n TYPES[TYPES[\"HALF_FLOAT\"] = 36193] = \"HALF_FLOAT\";\n})(TYPES || (TYPES = {}));\n/**\n * The scale modes that are supported by pixi.\n *\n * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations.\n * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability.\n *\n * @memberof PIXI\n * @static\n * @name SCALE_MODES\n * @enum {number}\n * @property {number} LINEAR Smooth scaling\n * @property {number} NEAREST Pixelating scaling\n */\nvar SCALE_MODES;\n(function (SCALE_MODES) {\n SCALE_MODES[SCALE_MODES[\"NEAREST\"] = 0] = \"NEAREST\";\n SCALE_MODES[SCALE_MODES[\"LINEAR\"] = 1] = \"LINEAR\";\n})(SCALE_MODES || (SCALE_MODES = {}));\n/**\n * The wrap modes that are supported by pixi.\n *\n * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations.\n * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability.\n * If the texture is non power of two then clamp will be used regardless as WebGL can\n * only use REPEAT if the texture is po2.\n *\n * This property only affects WebGL.\n *\n * @name WRAP_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} CLAMP - The textures uvs are clamped\n * @property {number} REPEAT - The texture uvs tile and repeat\n * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring\n */\nvar WRAP_MODES;\n(function (WRAP_MODES) {\n WRAP_MODES[WRAP_MODES[\"CLAMP\"] = 33071] = \"CLAMP\";\n WRAP_MODES[WRAP_MODES[\"REPEAT\"] = 10497] = \"REPEAT\";\n WRAP_MODES[WRAP_MODES[\"MIRRORED_REPEAT\"] = 33648] = \"MIRRORED_REPEAT\";\n})(WRAP_MODES || (WRAP_MODES = {}));\n/**\n * Mipmap filtering modes that are supported by pixi.\n *\n * The {@link PIXI.settings.MIPMAP_TEXTURES} affects default texture filtering.\n * Mipmaps are generated for a baseTexture if its `mipmap` field is `ON`,\n * or its `POW2` and texture dimensions are powers of 2.\n * Due to platform restriction, `ON` option will work like `POW2` for webgl-1.\n *\n * This property only affects WebGL.\n *\n * @name MIPMAP_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} OFF - No mipmaps\n * @property {number} POW2 - Generate mipmaps if texture dimensions are pow2\n * @property {number} ON - Always generate mipmaps\n */\nvar MIPMAP_MODES;\n(function (MIPMAP_MODES) {\n MIPMAP_MODES[MIPMAP_MODES[\"OFF\"] = 0] = \"OFF\";\n MIPMAP_MODES[MIPMAP_MODES[\"POW2\"] = 1] = \"POW2\";\n MIPMAP_MODES[MIPMAP_MODES[\"ON\"] = 2] = \"ON\";\n})(MIPMAP_MODES || (MIPMAP_MODES = {}));\n/**\n * How to treat textures with premultiplied alpha\n *\n * @name ALPHA_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NO_PREMULTIPLIED_ALPHA - Source is not premultiplied, leave it like that.\n * Option for compressed and data textures that are created from typed arrays.\n * @property {number} PREMULTIPLY_ON_UPLOAD - Source is not premultiplied, premultiply on upload.\n * Default option, used for all loaded images.\n * @property {number} PREMULTIPLIED_ALPHA - Source is already premultiplied\n * Example: spine atlases with `_pma` suffix.\n * @property {number} NPM - Alias for NO_PREMULTIPLIED_ALPHA.\n * @property {number} UNPACK - Default option, alias for PREMULTIPLY_ON_UPLOAD.\n * @property {number} PMA - Alias for PREMULTIPLIED_ALPHA.\n */\nvar ALPHA_MODES;\n(function (ALPHA_MODES) {\n ALPHA_MODES[ALPHA_MODES[\"NPM\"] = 0] = \"NPM\";\n ALPHA_MODES[ALPHA_MODES[\"UNPACK\"] = 1] = \"UNPACK\";\n ALPHA_MODES[ALPHA_MODES[\"PMA\"] = 2] = \"PMA\";\n ALPHA_MODES[ALPHA_MODES[\"NO_PREMULTIPLIED_ALPHA\"] = 0] = \"NO_PREMULTIPLIED_ALPHA\";\n ALPHA_MODES[ALPHA_MODES[\"PREMULTIPLY_ON_UPLOAD\"] = 1] = \"PREMULTIPLY_ON_UPLOAD\";\n ALPHA_MODES[ALPHA_MODES[\"PREMULTIPLY_ALPHA\"] = 2] = \"PREMULTIPLY_ALPHA\";\n})(ALPHA_MODES || (ALPHA_MODES = {}));\n/**\n * How to clear renderTextures in filter\n *\n * @name CLEAR_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} BLEND - Preserve the information in the texture, blend above\n * @property {number} CLEAR - Must use `gl.clear` operation\n * @property {number} BLIT - Clear or blit it, depends on device and level of paranoia\n * @property {number} NO - Alias for BLEND, same as `false` in earlier versions\n * @property {number} YES - Alias for CLEAR, same as `true` in earlier versions\n * @property {number} AUTO - Alias for BLIT\n */\nvar CLEAR_MODES;\n(function (CLEAR_MODES) {\n CLEAR_MODES[CLEAR_MODES[\"NO\"] = 0] = \"NO\";\n CLEAR_MODES[CLEAR_MODES[\"YES\"] = 1] = \"YES\";\n CLEAR_MODES[CLEAR_MODES[\"AUTO\"] = 2] = \"AUTO\";\n CLEAR_MODES[CLEAR_MODES[\"BLEND\"] = 0] = \"BLEND\";\n CLEAR_MODES[CLEAR_MODES[\"CLEAR\"] = 1] = \"CLEAR\";\n CLEAR_MODES[CLEAR_MODES[\"BLIT\"] = 2] = \"BLIT\";\n})(CLEAR_MODES || (CLEAR_MODES = {}));\n/**\n * The gc modes that are supported by pixi.\n *\n * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for PixiJS textures is AUTO\n * If set to GC_MODE, the renderer will occasionally check textures usage. If they are not\n * used for a specified period of time they will be removed from the GPU. They will of course\n * be uploaded again when they are required. This is a silent behind the scenes process that\n * should ensure that the GPU does not get filled up.\n *\n * Handy for mobile devices!\n * This property only affects WebGL.\n *\n * @name GC_MODES\n * @enum {number}\n * @static\n * @memberof PIXI\n * @property {number} AUTO - Garbage collection will happen periodically automatically\n * @property {number} MANUAL - Garbage collection will need to be called manually\n */\nvar GC_MODES;\n(function (GC_MODES) {\n GC_MODES[GC_MODES[\"AUTO\"] = 0] = \"AUTO\";\n GC_MODES[GC_MODES[\"MANUAL\"] = 1] = \"MANUAL\";\n})(GC_MODES || (GC_MODES = {}));\n/**\n * Constants that specify float precision in shaders.\n *\n * @name PRECISION\n * @memberof PIXI\n * @constant\n * @static\n * @enum {string}\n * @property {string} LOW='lowp'\n * @property {string} MEDIUM='mediump'\n * @property {string} HIGH='highp'\n */\nvar PRECISION;\n(function (PRECISION) {\n PRECISION[\"LOW\"] = \"lowp\";\n PRECISION[\"MEDIUM\"] = \"mediump\";\n PRECISION[\"HIGH\"] = \"highp\";\n})(PRECISION || (PRECISION = {}));\n/**\n * Constants for mask implementations.\n * We use `type` suffix because it leads to very different behaviours\n *\n * @name MASK_TYPES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NONE - Mask is ignored\n * @property {number} SCISSOR - Scissor mask, rectangle on screen, cheap\n * @property {number} STENCIL - Stencil mask, 1-bit, medium, works only if renderer supports stencil\n * @property {number} SPRITE - Mask that uses SpriteMaskFilter, uses temporary RenderTexture\n */\nvar MASK_TYPES;\n(function (MASK_TYPES) {\n MASK_TYPES[MASK_TYPES[\"NONE\"] = 0] = \"NONE\";\n MASK_TYPES[MASK_TYPES[\"SCISSOR\"] = 1] = \"SCISSOR\";\n MASK_TYPES[MASK_TYPES[\"STENCIL\"] = 2] = \"STENCIL\";\n MASK_TYPES[MASK_TYPES[\"SPRITE\"] = 3] = \"SPRITE\";\n})(MASK_TYPES || (MASK_TYPES = {}));\n/**\n * Constants for multi-sampling antialiasing.\n *\n * @see PIXI.Framebuffer#multisample\n *\n * @name MSAA_QUALITY\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NONE - No multisampling for this renderTexture\n * @property {number} LOW - Try 2 samples\n * @property {number} MEDIUM - Try 4 samples\n * @property {number} HIGH - Try 8 samples\n */\nvar MSAA_QUALITY;\n(function (MSAA_QUALITY) {\n MSAA_QUALITY[MSAA_QUALITY[\"NONE\"] = 0] = \"NONE\";\n MSAA_QUALITY[MSAA_QUALITY[\"LOW\"] = 2] = \"LOW\";\n MSAA_QUALITY[MSAA_QUALITY[\"MEDIUM\"] = 4] = \"MEDIUM\";\n MSAA_QUALITY[MSAA_QUALITY[\"HIGH\"] = 8] = \"HIGH\";\n})(MSAA_QUALITY || (MSAA_QUALITY = {}));\n\n/**\n * The BlurFilterPass applies a horizontal or vertical Gaussian blur to an object.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nvar BlurFilterPass = /** @class */ (function (_super) {\n __extends(BlurFilterPass, _super);\n /**\n * @param {boolean} horizontal - Do pass along the x-axis (`true`) or y-axis (`false`).\n * @param {number} [strength=8] - The strength of the blur filter.\n * @param {number} [quality=4] - The quality of the blur filter.\n * @param {number} [resolution=PIXI.settings.FILTER_RESOLUTION] - The resolution of the blur filter.\n * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15.\n */\n function BlurFilterPass(horizontal, strength, quality, resolution, kernelSize) {\n if (strength === void 0) { strength = 8; }\n if (quality === void 0) { quality = 4; }\n if (resolution === void 0) { resolution = _pixi_settings__WEBPACK_IMPORTED_MODULE_1__.settings.FILTER_RESOLUTION; }\n if (kernelSize === void 0) { kernelSize = 5; }\n var _this = this;\n var vertSrc = generateBlurVertSource(kernelSize, horizontal);\n var fragSrc = generateBlurFragSource(kernelSize);\n _this = _super.call(this, \n // vertex shader\n vertSrc, \n // fragment shader\n fragSrc) || this;\n _this.horizontal = horizontal;\n _this.resolution = resolution;\n _this._quality = 0;\n _this.quality = quality;\n _this.blur = strength;\n return _this;\n }\n /**\n * Applies the filter.\n *\n * @param {PIXI.systems.FilterSystem} filterManager - The manager.\n * @param {PIXI.RenderTexture} input - The input target.\n * @param {PIXI.RenderTexture} output - The output target.\n * @param {PIXI.CLEAR_MODES} clearMode - How to clear\n */\n BlurFilterPass.prototype.apply = function (filterManager, input, output, clearMode) {\n if (output) {\n if (this.horizontal) {\n this.uniforms.strength = (1 / output.width) * (output.width / input.width);\n }\n else {\n this.uniforms.strength = (1 / output.height) * (output.height / input.height);\n }\n }\n else {\n if (this.horizontal) // eslint-disable-line\n {\n this.uniforms.strength = (1 / filterManager.renderer.width) * (filterManager.renderer.width / input.width);\n }\n else {\n this.uniforms.strength = (1 / filterManager.renderer.height) * (filterManager.renderer.height / input.height); // eslint-disable-line\n }\n }\n // screen space!\n this.uniforms.strength *= this.strength;\n this.uniforms.strength /= this.passes;\n if (this.passes === 1) {\n filterManager.applyFilter(this, input, output, clearMode);\n }\n else {\n var renderTarget = filterManager.getFilterTexture();\n var renderer = filterManager.renderer;\n var flip = input;\n var flop = renderTarget;\n this.state.blend = false;\n filterManager.applyFilter(this, flip, flop, CLEAR_MODES.CLEAR);\n for (var i = 1; i < this.passes - 1; i++) {\n filterManager.bindAndClear(flip, CLEAR_MODES.BLIT);\n this.uniforms.uSampler = flop;\n var temp = flop;\n flop = flip;\n flip = temp;\n renderer.shader.bind(this);\n renderer.geometry.draw(5);\n }\n this.state.blend = true;\n filterManager.applyFilter(this, flop, output, clearMode);\n filterManager.returnFilterTexture(renderTarget);\n }\n };\n Object.defineProperty(BlurFilterPass.prototype, \"blur\", {\n /**\n * Sets the strength of both the blur.\n *\n * @member {number}\n * @default 16\n */\n get: function () {\n return this.strength;\n },\n set: function (value) {\n this.padding = 1 + (Math.abs(value) * 2);\n this.strength = value;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BlurFilterPass.prototype, \"quality\", {\n /**\n * Sets the quality of the blur by modifying the number of passes. More passes means higher\n * quaility bluring but the lower the performance.\n *\n * @member {number}\n * @default 4\n */\n get: function () {\n return this._quality;\n },\n set: function (value) {\n this._quality = value;\n this.passes = value;\n },\n enumerable: false,\n configurable: true\n });\n return BlurFilterPass;\n}(_pixi_core__WEBPACK_IMPORTED_MODULE_0__.Filter));\n\n/**\n * The BlurFilter applies a Gaussian blur to an object.\n *\n * The strength of the blur can be set for the x-axis and y-axis separately.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nvar BlurFilter = /** @class */ (function (_super) {\n __extends(BlurFilter, _super);\n /**\n * @param {number} [strength=8] - The strength of the blur filter.\n * @param {number} [quality=4] - The quality of the blur filter.\n * @param {number} [resolution=PIXI.settings.FILTER_RESOLUTION] - The resolution of the blur filter.\n * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15.\n */\n function BlurFilter(strength, quality, resolution, kernelSize) {\n if (strength === void 0) { strength = 8; }\n if (quality === void 0) { quality = 4; }\n if (resolution === void 0) { resolution = _pixi_settings__WEBPACK_IMPORTED_MODULE_1__.settings.FILTER_RESOLUTION; }\n if (kernelSize === void 0) { kernelSize = 5; }\n var _this = _super.call(this) || this;\n _this.blurXFilter = new BlurFilterPass(true, strength, quality, resolution, kernelSize);\n _this.blurYFilter = new BlurFilterPass(false, strength, quality, resolution, kernelSize);\n _this.resolution = resolution;\n _this.quality = quality;\n _this.blur = strength;\n _this.repeatEdgePixels = false;\n return _this;\n }\n /**\n * Applies the filter.\n *\n * @param {PIXI.systems.FilterSystem} filterManager - The manager.\n * @param {PIXI.RenderTexture} input - The input target.\n * @param {PIXI.RenderTexture} output - The output target.\n * @param {PIXI.CLEAR_MODES} clearMode - How to clear\n */\n BlurFilter.prototype.apply = function (filterManager, input, output, clearMode) {\n var xStrength = Math.abs(this.blurXFilter.strength);\n var yStrength = Math.abs(this.blurYFilter.strength);\n if (xStrength && yStrength) {\n var renderTarget = filterManager.getFilterTexture();\n this.blurXFilter.apply(filterManager, input, renderTarget, CLEAR_MODES.CLEAR);\n this.blurYFilter.apply(filterManager, renderTarget, output, clearMode);\n filterManager.returnFilterTexture(renderTarget);\n }\n else if (yStrength) {\n this.blurYFilter.apply(filterManager, input, output, clearMode);\n }\n else {\n this.blurXFilter.apply(filterManager, input, output, clearMode);\n }\n };\n BlurFilter.prototype.updatePadding = function () {\n if (this._repeatEdgePixels) {\n this.padding = 0;\n }\n else {\n this.padding = Math.max(Math.abs(this.blurXFilter.strength), Math.abs(this.blurYFilter.strength)) * 2;\n }\n };\n Object.defineProperty(BlurFilter.prototype, \"blur\", {\n /**\n * Sets the strength of both the blurX and blurY properties simultaneously\n *\n * @member {number}\n * @default 2\n */\n get: function () {\n return this.blurXFilter.blur;\n },\n set: function (value) {\n this.blurXFilter.blur = this.blurYFilter.blur = value;\n this.updatePadding();\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BlurFilter.prototype, \"quality\", {\n /**\n * Sets the number of passes for blur. More passes means higher quaility bluring.\n *\n * @member {number}\n * @default 1\n */\n get: function () {\n return this.blurXFilter.quality;\n },\n set: function (value) {\n this.blurXFilter.quality = this.blurYFilter.quality = value;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BlurFilter.prototype, \"blurX\", {\n /**\n * Sets the strength of the blurX property\n *\n * @member {number}\n * @default 2\n */\n get: function () {\n return this.blurXFilter.blur;\n },\n set: function (value) {\n this.blurXFilter.blur = value;\n this.updatePadding();\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BlurFilter.prototype, \"blurY\", {\n /**\n * Sets the strength of the blurY property\n *\n * @member {number}\n * @default 2\n */\n get: function () {\n return this.blurYFilter.blur;\n },\n set: function (value) {\n this.blurYFilter.blur = value;\n this.updatePadding();\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BlurFilter.prototype, \"blendMode\", {\n /**\n * Sets the blendmode of the filter\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL\n */\n get: function () {\n return this.blurYFilter.blendMode;\n },\n set: function (value) {\n this.blurYFilter.blendMode = value;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BlurFilter.prototype, \"repeatEdgePixels\", {\n /**\n * If set to true the edge of the target will be clamped\n *\n * @member {boolean}\n * @default false\n */\n get: function () {\n return this._repeatEdgePixels;\n },\n set: function (value) {\n this._repeatEdgePixels = value;\n this.updatePadding();\n },\n enumerable: false,\n configurable: true\n });\n return BlurFilter;\n}(_pixi_core__WEBPACK_IMPORTED_MODULE_0__.Filter));\n\n\n//# sourceMappingURL=filter-blur.es.js.map\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/@pixi/filter-blur/lib/filter-blur.es.js?"); /***/ }), /***/ "./node_modules/@pixi/filter-color-matrix/lib/filter-color-matrix.es.js": /*!******************************************************************************!*\ !*** ./node_modules/@pixi/filter-color-matrix/lib/filter-color-matrix.es.js ***! \******************************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ColorMatrixFilter\": () => (/* binding */ ColorMatrixFilter)\n/* harmony export */ });\n/* harmony import */ var _pixi_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @pixi/core */ \"./node_modules/@pixi/core/lib/core.es.js\");\n/*!\n * @pixi/filter-color-matrix - v5.3.11\n * Compiled Mon, 01 Nov 2021 16:10:12 UTC\n *\n * @pixi/filter-color-matrix is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } };\r\n return extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\n\nvar fragment = \"varying vec2 vTextureCoord;\\nuniform sampler2D uSampler;\\nuniform float m[20];\\nuniform float uAlpha;\\n\\nvoid main(void)\\n{\\n vec4 c = texture2D(uSampler, vTextureCoord);\\n\\n if (uAlpha == 0.0) {\\n gl_FragColor = c;\\n return;\\n }\\n\\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\\n if (c.a > 0.0) {\\n c.rgb /= c.a;\\n }\\n\\n vec4 result;\\n\\n result.r = (m[0] * c.r);\\n result.r += (m[1] * c.g);\\n result.r += (m[2] * c.b);\\n result.r += (m[3] * c.a);\\n result.r += m[4];\\n\\n result.g = (m[5] * c.r);\\n result.g += (m[6] * c.g);\\n result.g += (m[7] * c.b);\\n result.g += (m[8] * c.a);\\n result.g += m[9];\\n\\n result.b = (m[10] * c.r);\\n result.b += (m[11] * c.g);\\n result.b += (m[12] * c.b);\\n result.b += (m[13] * c.a);\\n result.b += m[14];\\n\\n result.a = (m[15] * c.r);\\n result.a += (m[16] * c.g);\\n result.a += (m[17] * c.b);\\n result.a += (m[18] * c.a);\\n result.a += m[19];\\n\\n vec3 rgb = mix(c.rgb, result.rgb, uAlpha);\\n\\n // Premultiply alpha again.\\n rgb *= result.a;\\n\\n gl_FragColor = vec4(rgb, result.a);\\n}\\n\";\n\n/**\n * The ColorMatrixFilter class lets you apply a 5x4 matrix transformation on the RGBA\n * color and alpha values of every pixel on your displayObject to produce a result\n * with a new set of RGBA color and alpha values. It's pretty powerful!\n *\n * ```js\n * let colorMatrix = new PIXI.filters.ColorMatrixFilter();\n * container.filters = [colorMatrix];\n * colorMatrix.contrast(2);\n * ```\n * @author Clément Chenebault \n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nvar ColorMatrixFilter = /** @class */ (function (_super) {\n __extends(ColorMatrixFilter, _super);\n function ColorMatrixFilter() {\n var _this = this;\n var uniforms = {\n m: new Float32Array([1, 0, 0, 0, 0,\n 0, 1, 0, 0, 0,\n 0, 0, 1, 0, 0,\n 0, 0, 0, 1, 0]),\n uAlpha: 1,\n };\n _this = _super.call(this, _pixi_core__WEBPACK_IMPORTED_MODULE_0__.defaultFilterVertex, fragment, uniforms) || this;\n _this.alpha = 1;\n return _this;\n }\n /**\n * Transforms current matrix and set the new one\n *\n * @param {number[]} matrix - 5x4 matrix\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n ColorMatrixFilter.prototype._loadMatrix = function (matrix, multiply) {\n if (multiply === void 0) { multiply = false; }\n var newMatrix = matrix;\n if (multiply) {\n this._multiply(newMatrix, this.uniforms.m, matrix);\n newMatrix = this._colorMatrix(newMatrix);\n }\n // set the new matrix\n this.uniforms.m = newMatrix;\n };\n /**\n * Multiplies two mat5's\n *\n * @private\n * @param {number[]} out - 5x4 matrix the receiving matrix\n * @param {number[]} a - 5x4 matrix the first operand\n * @param {number[]} b - 5x4 matrix the second operand\n * @returns {number[]} 5x4 matrix\n */\n ColorMatrixFilter.prototype._multiply = function (out, a, b) {\n // Red Channel\n out[0] = (a[0] * b[0]) + (a[1] * b[5]) + (a[2] * b[10]) + (a[3] * b[15]);\n out[1] = (a[0] * b[1]) + (a[1] * b[6]) + (a[2] * b[11]) + (a[3] * b[16]);\n out[2] = (a[0] * b[2]) + (a[1] * b[7]) + (a[2] * b[12]) + (a[3] * b[17]);\n out[3] = (a[0] * b[3]) + (a[1] * b[8]) + (a[2] * b[13]) + (a[3] * b[18]);\n out[4] = (a[0] * b[4]) + (a[1] * b[9]) + (a[2] * b[14]) + (a[3] * b[19]) + a[4];\n // Green Channel\n out[5] = (a[5] * b[0]) + (a[6] * b[5]) + (a[7] * b[10]) + (a[8] * b[15]);\n out[6] = (a[5] * b[1]) + (a[6] * b[6]) + (a[7] * b[11]) + (a[8] * b[16]);\n out[7] = (a[5] * b[2]) + (a[6] * b[7]) + (a[7] * b[12]) + (a[8] * b[17]);\n out[8] = (a[5] * b[3]) + (a[6] * b[8]) + (a[7] * b[13]) + (a[8] * b[18]);\n out[9] = (a[5] * b[4]) + (a[6] * b[9]) + (a[7] * b[14]) + (a[8] * b[19]) + a[9];\n // Blue Channel\n out[10] = (a[10] * b[0]) + (a[11] * b[5]) + (a[12] * b[10]) + (a[13] * b[15]);\n out[11] = (a[10] * b[1]) + (a[11] * b[6]) + (a[12] * b[11]) + (a[13] * b[16]);\n out[12] = (a[10] * b[2]) + (a[11] * b[7]) + (a[12] * b[12]) + (a[13] * b[17]);\n out[13] = (a[10] * b[3]) + (a[11] * b[8]) + (a[12] * b[13]) + (a[13] * b[18]);\n out[14] = (a[10] * b[4]) + (a[11] * b[9]) + (a[12] * b[14]) + (a[13] * b[19]) + a[14];\n // Alpha Channel\n out[15] = (a[15] * b[0]) + (a[16] * b[5]) + (a[17] * b[10]) + (a[18] * b[15]);\n out[16] = (a[15] * b[1]) + (a[16] * b[6]) + (a[17] * b[11]) + (a[18] * b[16]);\n out[17] = (a[15] * b[2]) + (a[16] * b[7]) + (a[17] * b[12]) + (a[18] * b[17]);\n out[18] = (a[15] * b[3]) + (a[16] * b[8]) + (a[17] * b[13]) + (a[18] * b[18]);\n out[19] = (a[15] * b[4]) + (a[16] * b[9]) + (a[17] * b[14]) + (a[18] * b[19]) + a[19];\n return out;\n };\n /**\n * Create a Float32 Array and normalize the offset component to 0-1\n *\n * @private\n * @param {number[]} matrix - 5x4 matrix\n * @return {number[]} 5x4 matrix with all values between 0-1\n */\n ColorMatrixFilter.prototype._colorMatrix = function (matrix) {\n // Create a Float32 Array and normalize the offset component to 0-1\n var m = new Float32Array(matrix);\n m[4] /= 255;\n m[9] /= 255;\n m[14] /= 255;\n m[19] /= 255;\n return m;\n };\n /**\n * Adjusts brightness\n *\n * @param {number} b - value of the brigthness (0-1, where 0 is black)\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n ColorMatrixFilter.prototype.brightness = function (b, multiply) {\n var matrix = [\n b, 0, 0, 0, 0,\n 0, b, 0, 0, 0,\n 0, 0, b, 0, 0,\n 0, 0, 0, 1, 0 ];\n this._loadMatrix(matrix, multiply);\n };\n /**\n * Set the matrices in grey scales\n *\n * @param {number} scale - value of the grey (0-1, where 0 is black)\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n ColorMatrixFilter.prototype.greyscale = function (scale, multiply) {\n var matrix = [\n scale, scale, scale, 0, 0,\n scale, scale, scale, 0, 0,\n scale, scale, scale, 0, 0,\n 0, 0, 0, 1, 0 ];\n this._loadMatrix(matrix, multiply);\n };\n /**\n * Set the black and white matrice.\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n ColorMatrixFilter.prototype.blackAndWhite = function (multiply) {\n var matrix = [\n 0.3, 0.6, 0.1, 0, 0,\n 0.3, 0.6, 0.1, 0, 0,\n 0.3, 0.6, 0.1, 0, 0,\n 0, 0, 0, 1, 0 ];\n this._loadMatrix(matrix, multiply);\n };\n /**\n * Set the hue property of the color\n *\n * @param {number} rotation - in degrees\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n ColorMatrixFilter.prototype.hue = function (rotation, multiply) {\n rotation = (rotation || 0) / 180 * Math.PI;\n var cosR = Math.cos(rotation);\n var sinR = Math.sin(rotation);\n var sqrt = Math.sqrt;\n /* a good approximation for hue rotation\n This matrix is far better than the versions with magic luminance constants\n formerly used here, but also used in the starling framework (flash) and known from this\n old part of the internet: quasimondo.com/archives/000565.php\n\n This new matrix is based on rgb cube rotation in space. Look here for a more descriptive\n implementation as a shader not a general matrix:\n https://github.com/evanw/glfx.js/blob/58841c23919bd59787effc0333a4897b43835412/src/filters/adjust/huesaturation.js\n\n This is the source for the code:\n see http://stackoverflow.com/questions/8507885/shift-hue-of-an-rgb-color/8510751#8510751\n */\n var w = 1 / 3;\n var sqrW = sqrt(w); // weight is\n var a00 = cosR + ((1.0 - cosR) * w);\n var a01 = (w * (1.0 - cosR)) - (sqrW * sinR);\n var a02 = (w * (1.0 - cosR)) + (sqrW * sinR);\n var a10 = (w * (1.0 - cosR)) + (sqrW * sinR);\n var a11 = cosR + (w * (1.0 - cosR));\n var a12 = (w * (1.0 - cosR)) - (sqrW * sinR);\n var a20 = (w * (1.0 - cosR)) - (sqrW * sinR);\n var a21 = (w * (1.0 - cosR)) + (sqrW * sinR);\n var a22 = cosR + (w * (1.0 - cosR));\n var matrix = [\n a00, a01, a02, 0, 0,\n a10, a11, a12, 0, 0,\n a20, a21, a22, 0, 0,\n 0, 0, 0, 1, 0 ];\n this._loadMatrix(matrix, multiply);\n };\n /**\n * Set the contrast matrix, increase the separation between dark and bright\n * Increase contrast : shadows darker and highlights brighter\n * Decrease contrast : bring the shadows up and the highlights down\n *\n * @param {number} amount - value of the contrast (0-1)\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n ColorMatrixFilter.prototype.contrast = function (amount, multiply) {\n var v = (amount || 0) + 1;\n var o = -0.5 * (v - 1);\n var matrix = [\n v, 0, 0, 0, o,\n 0, v, 0, 0, o,\n 0, 0, v, 0, o,\n 0, 0, 0, 1, 0 ];\n this._loadMatrix(matrix, multiply);\n };\n /**\n * Set the saturation matrix, increase the separation between colors\n * Increase saturation : increase contrast, brightness, and sharpness\n *\n * @param {number} amount - The saturation amount (0-1)\n * @param {boolean} [multiply] - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n ColorMatrixFilter.prototype.saturate = function (amount, multiply) {\n if (amount === void 0) { amount = 0; }\n var x = (amount * 2 / 3) + 1;\n var y = ((x - 1) * -0.5);\n var matrix = [\n x, y, y, 0, 0,\n y, x, y, 0, 0,\n y, y, x, 0, 0,\n 0, 0, 0, 1, 0 ];\n this._loadMatrix(matrix, multiply);\n };\n /**\n * Desaturate image (remove color)\n *\n * Call the saturate function\n *\n */\n ColorMatrixFilter.prototype.desaturate = function () {\n this.saturate(-1);\n };\n /**\n * Negative image (inverse of classic rgb matrix)\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n ColorMatrixFilter.prototype.negative = function (multiply) {\n var matrix = [\n -1, 0, 0, 1, 0,\n 0, -1, 0, 1, 0,\n 0, 0, -1, 1, 0,\n 0, 0, 0, 1, 0 ];\n this._loadMatrix(matrix, multiply);\n };\n /**\n * Sepia image\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n ColorMatrixFilter.prototype.sepia = function (multiply) {\n var matrix = [\n 0.393, 0.7689999, 0.18899999, 0, 0,\n 0.349, 0.6859999, 0.16799999, 0, 0,\n 0.272, 0.5339999, 0.13099999, 0, 0,\n 0, 0, 0, 1, 0 ];\n this._loadMatrix(matrix, multiply);\n };\n /**\n * Color motion picture process invented in 1916 (thanks Dominic Szablewski)\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n ColorMatrixFilter.prototype.technicolor = function (multiply) {\n var matrix = [\n 1.9125277891456083, -0.8545344976951645, -0.09155508482755585, 0, 11.793603434377337,\n -0.3087833385928097, 1.7658908555458428, -0.10601743074722245, 0, -70.35205161461398,\n -0.231103377548616, -0.7501899197440212, 1.847597816108189, 0, 30.950940869491138,\n 0, 0, 0, 1, 0 ];\n this._loadMatrix(matrix, multiply);\n };\n /**\n * Polaroid filter\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n ColorMatrixFilter.prototype.polaroid = function (multiply) {\n var matrix = [\n 1.438, -0.062, -0.062, 0, 0,\n -0.122, 1.378, -0.122, 0, 0,\n -0.016, -0.016, 1.483, 0, 0,\n 0, 0, 0, 1, 0 ];\n this._loadMatrix(matrix, multiply);\n };\n /**\n * Filter who transforms : Red -> Blue and Blue -> Red\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n ColorMatrixFilter.prototype.toBGR = function (multiply) {\n var matrix = [\n 0, 0, 1, 0, 0,\n 0, 1, 0, 0, 0,\n 1, 0, 0, 0, 0,\n 0, 0, 0, 1, 0 ];\n this._loadMatrix(matrix, multiply);\n };\n /**\n * Color reversal film introduced by Eastman Kodak in 1935. (thanks Dominic Szablewski)\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n ColorMatrixFilter.prototype.kodachrome = function (multiply) {\n var matrix = [\n 1.1285582396593525, -0.3967382283601348, -0.03992559172921793, 0, 63.72958762196502,\n -0.16404339962244616, 1.0835251566291304, -0.05498805115633132, 0, 24.732407896706203,\n -0.16786010706155763, -0.5603416277695248, 1.6014850761964943, 0, 35.62982807460946,\n 0, 0, 0, 1, 0 ];\n this._loadMatrix(matrix, multiply);\n };\n /**\n * Brown delicious browni filter (thanks Dominic Szablewski)\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n ColorMatrixFilter.prototype.browni = function (multiply) {\n var matrix = [\n 0.5997023498159715, 0.34553243048391263, -0.2708298674538042, 0, 47.43192855600873,\n -0.037703249837783157, 0.8609577587992641, 0.15059552388459913, 0, -36.96841498319127,\n 0.24113635128153335, -0.07441037908422492, 0.44972182064877153, 0, -7.562075277591283,\n 0, 0, 0, 1, 0 ];\n this._loadMatrix(matrix, multiply);\n };\n /**\n * Vintage filter (thanks Dominic Szablewski)\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n ColorMatrixFilter.prototype.vintage = function (multiply) {\n var matrix = [\n 0.6279345635605994, 0.3202183420819367, -0.03965408211312453, 0, 9.651285835294123,\n 0.02578397704808868, 0.6441188644374771, 0.03259127616149294, 0, 7.462829176470591,\n 0.0466055556782719, -0.0851232987247891, 0.5241648018700465, 0, 5.159190588235296,\n 0, 0, 0, 1, 0 ];\n this._loadMatrix(matrix, multiply);\n };\n /**\n * We don't know exactly what it does, kind of gradient map, but funny to play with!\n *\n * @param {number} desaturation - Tone values.\n * @param {number} toned - Tone values.\n * @param {number} lightColor - Tone values, example: `0xFFE580`\n * @param {number} darkColor - Tone values, example: `0xFFE580`\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n ColorMatrixFilter.prototype.colorTone = function (desaturation, toned, lightColor, darkColor, multiply) {\n desaturation = desaturation || 0.2;\n toned = toned || 0.15;\n lightColor = lightColor || 0xFFE580;\n darkColor = darkColor || 0x338000;\n var lR = ((lightColor >> 16) & 0xFF) / 255;\n var lG = ((lightColor >> 8) & 0xFF) / 255;\n var lB = (lightColor & 0xFF) / 255;\n var dR = ((darkColor >> 16) & 0xFF) / 255;\n var dG = ((darkColor >> 8) & 0xFF) / 255;\n var dB = (darkColor & 0xFF) / 255;\n var matrix = [\n 0.3, 0.59, 0.11, 0, 0,\n lR, lG, lB, desaturation, 0,\n dR, dG, dB, toned, 0,\n lR - dR, lG - dG, lB - dB, 0, 0 ];\n this._loadMatrix(matrix, multiply);\n };\n /**\n * Night effect\n *\n * @param {number} intensity - The intensity of the night effect.\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n ColorMatrixFilter.prototype.night = function (intensity, multiply) {\n intensity = intensity || 0.1;\n var matrix = [\n intensity * (-2.0), -intensity, 0, 0, 0,\n -intensity, 0, intensity, 0, 0,\n 0, intensity, intensity * 2.0, 0, 0,\n 0, 0, 0, 1, 0 ];\n this._loadMatrix(matrix, multiply);\n };\n /**\n * Predator effect\n *\n * Erase the current matrix by setting a new indepent one\n *\n * @param {number} amount - how much the predator feels his future victim\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n ColorMatrixFilter.prototype.predator = function (amount, multiply) {\n var matrix = [\n // row 1\n 11.224130630493164 * amount,\n -4.794486999511719 * amount,\n -2.8746118545532227 * amount,\n 0 * amount,\n 0.40342438220977783 * amount,\n // row 2\n -3.6330697536468506 * amount,\n 9.193157196044922 * amount,\n -2.951810836791992 * amount,\n 0 * amount,\n -1.316135048866272 * amount,\n // row 3\n -3.2184197902679443 * amount,\n -4.2375030517578125 * amount,\n 7.476448059082031 * amount,\n 0 * amount,\n 0.8044459223747253 * amount,\n // row 4\n 0, 0, 0, 1, 0 ];\n this._loadMatrix(matrix, multiply);\n };\n /**\n * LSD effect\n *\n * Multiply the current matrix\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n ColorMatrixFilter.prototype.lsd = function (multiply) {\n var matrix = [\n 2, -0.4, 0.5, 0, 0,\n -0.5, 2, -0.4, 0, 0,\n -0.4, -0.5, 3, 0, 0,\n 0, 0, 0, 1, 0 ];\n this._loadMatrix(matrix, multiply);\n };\n /**\n * Erase the current matrix by setting the default one\n *\n */\n ColorMatrixFilter.prototype.reset = function () {\n var matrix = [\n 1, 0, 0, 0, 0,\n 0, 1, 0, 0, 0,\n 0, 0, 1, 0, 0,\n 0, 0, 0, 1, 0 ];\n this._loadMatrix(matrix, false);\n };\n Object.defineProperty(ColorMatrixFilter.prototype, \"matrix\", {\n /**\n * The matrix of the color matrix filter\n *\n * @member {number[]}\n * @default [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]\n */\n get: function () {\n return this.uniforms.m;\n },\n set: function (value) {\n this.uniforms.m = value;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(ColorMatrixFilter.prototype, \"alpha\", {\n /**\n * The opacity value to use when mixing the original and resultant colors.\n *\n * When the value is 0, the original color is used without modification.\n * When the value is 1, the result color is used.\n * When in the range (0, 1) the color is interpolated between the original and result by this amount.\n *\n * @member {number}\n * @default 1\n */\n get: function () {\n return this.uniforms.uAlpha;\n },\n set: function (value) {\n this.uniforms.uAlpha = value;\n },\n enumerable: false,\n configurable: true\n });\n return ColorMatrixFilter;\n}(_pixi_core__WEBPACK_IMPORTED_MODULE_0__.Filter));\n// Americanized alias\nColorMatrixFilter.prototype.grayscale = ColorMatrixFilter.prototype.greyscale;\n\n\n//# sourceMappingURL=filter-color-matrix.es.js.map\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/@pixi/filter-color-matrix/lib/filter-color-matrix.es.js?"); /***/ }), /***/ "./node_modules/@pixi/filter-displacement/lib/filter-displacement.es.js": /*!******************************************************************************!*\ !*** ./node_modules/@pixi/filter-displacement/lib/filter-displacement.es.js ***! \******************************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"DisplacementFilter\": () => (/* binding */ DisplacementFilter)\n/* harmony export */ });\n/* harmony import */ var _pixi_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @pixi/core */ \"./node_modules/@pixi/core/lib/core.es.js\");\n/* harmony import */ var _pixi_math__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @pixi/math */ \"./node_modules/@pixi/math/lib/math.es.js\");\n/*!\n * @pixi/filter-displacement - v5.3.11\n * Compiled Mon, 01 Nov 2021 16:10:12 UTC\n *\n * @pixi/filter-displacement is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n\n\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } };\r\n return extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\n\nvar fragment = \"varying vec2 vFilterCoord;\\nvarying vec2 vTextureCoord;\\n\\nuniform vec2 scale;\\nuniform mat2 rotation;\\nuniform sampler2D uSampler;\\nuniform sampler2D mapSampler;\\n\\nuniform highp vec4 inputSize;\\nuniform vec4 inputClamp;\\n\\nvoid main(void)\\n{\\n vec4 map = texture2D(mapSampler, vFilterCoord);\\n\\n map -= 0.5;\\n map.xy = scale * inputSize.zw * (rotation * map.xy);\\n\\n gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));\\n}\\n\";\n\nvar vertex = \"attribute vec2 aVertexPosition;\\n\\nuniform mat3 projectionMatrix;\\nuniform mat3 filterMatrix;\\n\\nvarying vec2 vTextureCoord;\\nvarying vec2 vFilterCoord;\\n\\nuniform vec4 inputSize;\\nuniform vec4 outputFrame;\\n\\nvec4 filterVertexPosition( void )\\n{\\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\\n\\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\\n}\\n\\nvec2 filterTextureCoord( void )\\n{\\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\\n}\\n\\nvoid main(void)\\n{\\n\\tgl_Position = filterVertexPosition();\\n\\tvTextureCoord = filterTextureCoord();\\n\\tvFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy;\\n}\\n\";\n\n/**\n * The DisplacementFilter class uses the pixel values from the specified texture\n * (called the displacement map) to perform a displacement of an object.\n *\n * You can use this filter to apply all manor of crazy warping effects.\n * Currently the `r` property of the texture is used to offset the `x`\n * and the `g` property of the texture is used to offset the `y`.\n *\n * The way it works is it uses the values of the displacement map to look up the\n * correct pixels to output. This means it's not technically moving the original.\n * Instead, it's starting at the output and asking \"which pixel from the original goes here\".\n * For example, if a displacement map pixel has `red = 1` and the filter scale is `20`,\n * this filter will output the pixel approximately 20 pixels to the right of the original.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nvar DisplacementFilter = /** @class */ (function (_super) {\n __extends(DisplacementFilter, _super);\n /**\n * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!)\n * @param {number} [scale] - The scale of the displacement\n */\n function DisplacementFilter(sprite, scale) {\n var _this = this;\n var maskMatrix = new _pixi_math__WEBPACK_IMPORTED_MODULE_1__.Matrix();\n sprite.renderable = false;\n _this = _super.call(this, vertex, fragment, {\n mapSampler: sprite._texture,\n filterMatrix: maskMatrix,\n scale: { x: 1, y: 1 },\n rotation: new Float32Array([1, 0, 0, 1]),\n }) || this;\n _this.maskSprite = sprite;\n _this.maskMatrix = maskMatrix;\n if (scale === null || scale === undefined) {\n scale = 20;\n }\n /**\n * scaleX, scaleY for displacements\n * @member {PIXI.Point}\n */\n _this.scale = new _pixi_math__WEBPACK_IMPORTED_MODULE_1__.Point(scale, scale);\n return _this;\n }\n /**\n * Applies the filter.\n *\n * @param {PIXI.systems.FilterSystem} filterManager - The manager.\n * @param {PIXI.RenderTexture} input - The input target.\n * @param {PIXI.RenderTexture} output - The output target.\n * @param {PIXI.CLEAR_MODES} clearMode - clearMode.\n */\n DisplacementFilter.prototype.apply = function (filterManager, input, output, clearMode) {\n // fill maskMatrix with _normalized sprite texture coords_\n this.uniforms.filterMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, this.maskSprite);\n this.uniforms.scale.x = this.scale.x;\n this.uniforms.scale.y = this.scale.y;\n // Extract rotation from world transform\n var wt = this.maskSprite.worldTransform;\n var lenX = Math.sqrt((wt.a * wt.a) + (wt.b * wt.b));\n var lenY = Math.sqrt((wt.c * wt.c) + (wt.d * wt.d));\n if (lenX !== 0 && lenY !== 0) {\n this.uniforms.rotation[0] = wt.a / lenX;\n this.uniforms.rotation[1] = wt.b / lenX;\n this.uniforms.rotation[2] = wt.c / lenY;\n this.uniforms.rotation[3] = wt.d / lenY;\n }\n // draw the filter...\n filterManager.applyFilter(this, input, output, clearMode);\n };\n Object.defineProperty(DisplacementFilter.prototype, \"map\", {\n /**\n * The texture used for the displacement map. Must be power of 2 sized texture.\n *\n * @member {PIXI.Texture}\n */\n get: function () {\n return this.uniforms.mapSampler;\n },\n set: function (value) {\n this.uniforms.mapSampler = value;\n },\n enumerable: false,\n configurable: true\n });\n return DisplacementFilter;\n}(_pixi_core__WEBPACK_IMPORTED_MODULE_0__.Filter));\n\n\n//# sourceMappingURL=filter-displacement.es.js.map\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/@pixi/filter-displacement/lib/filter-displacement.es.js?"); /***/ }), /***/ "./node_modules/@pixi/filter-fxaa/lib/filter-fxaa.es.js": /*!**************************************************************!*\ !*** ./node_modules/@pixi/filter-fxaa/lib/filter-fxaa.es.js ***! \**************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"FXAAFilter\": () => (/* binding */ FXAAFilter)\n/* harmony export */ });\n/* harmony import */ var _pixi_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @pixi/core */ \"./node_modules/@pixi/core/lib/core.es.js\");\n/*!\n * @pixi/filter-fxaa - v5.3.11\n * Compiled Mon, 01 Nov 2021 16:10:12 UTC\n *\n * @pixi/filter-fxaa is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } };\r\n return extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\n\nvar vertex = \"\\nattribute vec2 aVertexPosition;\\n\\nuniform mat3 projectionMatrix;\\n\\nvarying vec2 v_rgbNW;\\nvarying vec2 v_rgbNE;\\nvarying vec2 v_rgbSW;\\nvarying vec2 v_rgbSE;\\nvarying vec2 v_rgbM;\\n\\nvarying vec2 vFragCoord;\\n\\nuniform vec4 inputPixel;\\nuniform vec4 outputFrame;\\n\\nvec4 filterVertexPosition( void )\\n{\\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\\n\\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\\n}\\n\\nvoid texcoords(vec2 fragCoord, vec2 inverseVP,\\n out vec2 v_rgbNW, out vec2 v_rgbNE,\\n out vec2 v_rgbSW, out vec2 v_rgbSE,\\n out vec2 v_rgbM) {\\n v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;\\n v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;\\n v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;\\n v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;\\n v_rgbM = vec2(fragCoord * inverseVP);\\n}\\n\\nvoid main(void) {\\n\\n gl_Position = filterVertexPosition();\\n\\n vFragCoord = aVertexPosition * outputFrame.zw;\\n\\n texcoords(vFragCoord, inputPixel.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\\n}\\n\";\n\nvar fragment = \"varying vec2 v_rgbNW;\\nvarying vec2 v_rgbNE;\\nvarying vec2 v_rgbSW;\\nvarying vec2 v_rgbSE;\\nvarying vec2 v_rgbM;\\n\\nvarying vec2 vFragCoord;\\nuniform sampler2D uSampler;\\nuniform highp vec4 inputPixel;\\n\\n\\n/**\\n Basic FXAA implementation based on the code on geeks3d.com with the\\n modification that the texture2DLod stuff was removed since it's\\n unsupported by WebGL.\\n\\n --\\n\\n From:\\n https://github.com/mitsuhiko/webgl-meincraft\\n\\n Copyright (c) 2011 by Armin Ronacher.\\n\\n Some rights reserved.\\n\\n Redistribution and use in source and binary forms, with or without\\n modification, are permitted provided that the following conditions are\\n met:\\n\\n * Redistributions of source code must retain the above copyright\\n notice, this list of conditions and the following disclaimer.\\n\\n * Redistributions in binary form must reproduce the above\\n copyright notice, this list of conditions and the following\\n disclaimer in the documentation and/or other materials provided\\n with the distribution.\\n\\n * The names of the contributors may not be used to endorse or\\n promote products derived from this software without specific\\n prior written permission.\\n\\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\\n \\\"AS IS\\\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\\n OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\\n SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\\n DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\\n THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\\n */\\n\\n#ifndef FXAA_REDUCE_MIN\\n#define FXAA_REDUCE_MIN (1.0/ 128.0)\\n#endif\\n#ifndef FXAA_REDUCE_MUL\\n#define FXAA_REDUCE_MUL (1.0 / 8.0)\\n#endif\\n#ifndef FXAA_SPAN_MAX\\n#define FXAA_SPAN_MAX 8.0\\n#endif\\n\\n//optimized version for mobile, where dependent\\n//texture reads can be a bottleneck\\nvec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP,\\n vec2 v_rgbNW, vec2 v_rgbNE,\\n vec2 v_rgbSW, vec2 v_rgbSE,\\n vec2 v_rgbM) {\\n vec4 color;\\n vec3 rgbNW = texture2D(tex, v_rgbNW).xyz;\\n vec3 rgbNE = texture2D(tex, v_rgbNE).xyz;\\n vec3 rgbSW = texture2D(tex, v_rgbSW).xyz;\\n vec3 rgbSE = texture2D(tex, v_rgbSE).xyz;\\n vec4 texColor = texture2D(tex, v_rgbM);\\n vec3 rgbM = texColor.xyz;\\n vec3 luma = vec3(0.299, 0.587, 0.114);\\n float lumaNW = dot(rgbNW, luma);\\n float lumaNE = dot(rgbNE, luma);\\n float lumaSW = dot(rgbSW, luma);\\n float lumaSE = dot(rgbSE, luma);\\n float lumaM = dot(rgbM, luma);\\n float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));\\n float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));\\n\\n mediump vec2 dir;\\n dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\\n dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\\n\\n float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *\\n (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\\n\\n float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\\n dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),\\n max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\\n dir * rcpDirMin)) * inverseVP;\\n\\n vec3 rgbA = 0.5 * (\\n texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +\\n texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);\\n vec3 rgbB = rgbA * 0.5 + 0.25 * (\\n texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz +\\n texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz);\\n\\n float lumaB = dot(rgbB, luma);\\n if ((lumaB < lumaMin) || (lumaB > lumaMax))\\n color = vec4(rgbA, texColor.a);\\n else\\n color = vec4(rgbB, texColor.a);\\n return color;\\n}\\n\\nvoid main() {\\n\\n vec4 color;\\n\\n color = fxaa(uSampler, vFragCoord, inputPixel.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\\n\\n gl_FragColor = color;\\n}\\n\";\n\n/**\n * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com\n * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL.\n *\n * @see https://github.com/mitsuhiko/webgl-meincraft\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n *\n */\nvar FXAAFilter = /** @class */ (function (_super) {\n __extends(FXAAFilter, _super);\n function FXAAFilter() {\n // TODO - needs work\n return _super.call(this, vertex, fragment) || this;\n }\n return FXAAFilter;\n}(_pixi_core__WEBPACK_IMPORTED_MODULE_0__.Filter));\n\n\n//# sourceMappingURL=filter-fxaa.es.js.map\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/@pixi/filter-fxaa/lib/filter-fxaa.es.js?"); /***/ }), /***/ "./node_modules/@pixi/filter-noise/lib/filter-noise.es.js": /*!****************************************************************!*\ !*** ./node_modules/@pixi/filter-noise/lib/filter-noise.es.js ***! \****************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"NoiseFilter\": () => (/* binding */ NoiseFilter)\n/* harmony export */ });\n/* harmony import */ var _pixi_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @pixi/core */ \"./node_modules/@pixi/core/lib/core.es.js\");\n/*!\n * @pixi/filter-noise - v5.3.11\n * Compiled Mon, 01 Nov 2021 16:10:12 UTC\n *\n * @pixi/filter-noise is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } };\r\n return extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\n\nvar fragment = \"precision highp float;\\n\\nvarying vec2 vTextureCoord;\\nvarying vec4 vColor;\\n\\nuniform float uNoise;\\nuniform float uSeed;\\nuniform sampler2D uSampler;\\n\\nfloat rand(vec2 co)\\n{\\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\\n}\\n\\nvoid main()\\n{\\n vec4 color = texture2D(uSampler, vTextureCoord);\\n float randomValue = rand(gl_FragCoord.xy * uSeed);\\n float diff = (randomValue - 0.5) * uNoise;\\n\\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\\n if (color.a > 0.0) {\\n color.rgb /= color.a;\\n }\\n\\n color.r += diff;\\n color.g += diff;\\n color.b += diff;\\n\\n // Premultiply alpha again.\\n color.rgb *= color.a;\\n\\n gl_FragColor = color;\\n}\\n\";\n\n/**\n * @author Vico @vicocotea\n * original filter: https://github.com/evanw/glfx.js/blob/master/src/filters/adjust/noise.js\n */\n/**\n * A Noise effect filter.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nvar NoiseFilter = /** @class */ (function (_super) {\n __extends(NoiseFilter, _super);\n /**\n * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1].\n * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`.\n */\n function NoiseFilter(noise, seed) {\n if (noise === void 0) { noise = 0.5; }\n if (seed === void 0) { seed = Math.random(); }\n var _this = _super.call(this, _pixi_core__WEBPACK_IMPORTED_MODULE_0__.defaultFilterVertex, fragment, {\n uNoise: 0,\n uSeed: 0,\n }) || this;\n _this.noise = noise;\n _this.seed = seed;\n return _this;\n }\n Object.defineProperty(NoiseFilter.prototype, \"noise\", {\n /**\n * The amount of noise to apply, this value should be in the range (0, 1].\n *\n * @member {number}\n * @default 0.5\n */\n get: function () {\n return this.uniforms.uNoise;\n },\n set: function (value) {\n this.uniforms.uNoise = value;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(NoiseFilter.prototype, \"seed\", {\n /**\n * A seed value to apply to the random noise generation. `Math.random()` is a good value to use.\n *\n * @member {number}\n */\n get: function () {\n return this.uniforms.uSeed;\n },\n set: function (value) {\n this.uniforms.uSeed = value;\n },\n enumerable: false,\n configurable: true\n });\n return NoiseFilter;\n}(_pixi_core__WEBPACK_IMPORTED_MODULE_0__.Filter));\n\n\n//# sourceMappingURL=filter-noise.es.js.map\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/@pixi/filter-noise/lib/filter-noise.es.js?"); /***/ }), /***/ "./node_modules/@pixi/graphics/lib/graphics.es.js": /*!********************************************************!*\ !*** ./node_modules/@pixi/graphics/lib/graphics.es.js ***! \********************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"FillStyle\": () => (/* binding */ FillStyle),\n/* harmony export */ \"GRAPHICS_CURVES\": () => (/* binding */ GRAPHICS_CURVES),\n/* harmony export */ \"Graphics\": () => (/* binding */ Graphics),\n/* harmony export */ \"GraphicsData\": () => (/* binding */ GraphicsData),\n/* harmony export */ \"GraphicsGeometry\": () => (/* binding */ GraphicsGeometry),\n/* harmony export */ \"LINE_CAP\": () => (/* binding */ LINE_CAP),\n/* harmony export */ \"LINE_JOIN\": () => (/* binding */ LINE_JOIN),\n/* harmony export */ \"LineStyle\": () => (/* binding */ LineStyle),\n/* harmony export */ \"graphicsUtils\": () => (/* binding */ index)\n/* harmony export */ });\n/* harmony import */ var _pixi_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @pixi/core */ \"./node_modules/@pixi/core/lib/core.es.js\");\n/* harmony import */ var _pixi_math__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @pixi/math */ \"./node_modules/@pixi/math/lib/math.es.js\");\n/* harmony import */ var _pixi_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @pixi/utils */ \"./node_modules/@pixi/utils/lib/utils.es.js\");\n/* harmony import */ var _pixi_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @pixi/constants */ \"./node_modules/@pixi/constants/lib/constants.es.js\");\n/* harmony import */ var _pixi_display__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @pixi/display */ \"./node_modules/@pixi/display/lib/display.es.js\");\n/*!\n * @pixi/graphics - v5.3.11\n * Compiled Mon, 01 Nov 2021 16:10:12 UTC\n *\n * @pixi/graphics is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n\n\n\n\n\n\n/**\n * Supported line joints in `PIXI.LineStyle` for graphics.\n *\n * @see PIXI.Graphics#lineStyle\n * @see https://graphicdesign.stackexchange.com/questions/59018/what-is-a-bevel-join-of-two-lines-exactly-illustrator\n *\n * @name LINE_JOIN\n * @memberof PIXI\n * @static\n * @enum {string}\n * @property {string} MITER - 'miter': make a sharp corner where outer part of lines meet\n * @property {string} BEVEL - 'bevel': add a square butt at each end of line segment and fill the triangle at turn\n * @property {string} ROUND - 'round': add an arc at the joint\n */\nvar LINE_JOIN;\n(function (LINE_JOIN) {\n LINE_JOIN[\"MITER\"] = \"miter\";\n LINE_JOIN[\"BEVEL\"] = \"bevel\";\n LINE_JOIN[\"ROUND\"] = \"round\";\n})(LINE_JOIN || (LINE_JOIN = {}));\n/**\n * Support line caps in `PIXI.LineStyle` for graphics.\n *\n * @see PIXI.Graphics#lineStyle\n *\n * @name LINE_CAP\n * @memberof PIXI\n * @static\n * @enum {string}\n * @property {string} BUTT - 'butt': don't add any cap at line ends (leaves orthogonal edges)\n * @property {string} ROUND - 'round': add semicircle at ends\n * @property {string} SQUARE - 'square': add square at end (like `BUTT` except more length at end)\n */\nvar LINE_CAP;\n(function (LINE_CAP) {\n LINE_CAP[\"BUTT\"] = \"butt\";\n LINE_CAP[\"ROUND\"] = \"round\";\n LINE_CAP[\"SQUARE\"] = \"square\";\n})(LINE_CAP || (LINE_CAP = {}));\n/**\n * Graphics curves resolution settings. If `adaptive` flag is set to `true`,\n * the resolution is calculated based on the curve's length to ensure better visual quality.\n * Adaptive draw works with `bezierCurveTo` and `quadraticCurveTo`.\n *\n * @static\n * @constant\n * @memberof PIXI\n * @name GRAPHICS_CURVES\n * @type {object}\n * @property {boolean} adaptive=false - flag indicating if the resolution should be adaptive\n * @property {number} maxLength=10 - maximal length of a single segment of the curve (if adaptive = false, ignored)\n * @property {number} minSegments=8 - minimal number of segments in the curve (if adaptive = false, ignored)\n * @property {number} maxSegments=2048 - maximal number of segments in the curve (if adaptive = false, ignored)\n */\nvar GRAPHICS_CURVES = {\n adaptive: true,\n maxLength: 10,\n minSegments: 8,\n maxSegments: 2048,\n epsilon: 0.0001,\n _segmentsCount: function (length, defaultSegments) {\n if (defaultSegments === void 0) { defaultSegments = 20; }\n if (!this.adaptive || !length || isNaN(length)) {\n return defaultSegments;\n }\n var result = Math.ceil(length / this.maxLength);\n if (result < this.minSegments) {\n result = this.minSegments;\n }\n else if (result > this.maxSegments) {\n result = this.maxSegments;\n }\n return result;\n },\n};\n\n/**\n * Fill style object for Graphics.\n *\n * @class\n * @memberof PIXI\n */\nvar FillStyle = /** @class */ (function () {\n function FillStyle() {\n /**\n * The hex color value used when coloring the Graphics object.\n *\n * @member {number}\n * @default 0xFFFFFF\n */\n this.color = 0xFFFFFF;\n /**\n * The alpha value used when filling the Graphics object.\n *\n * @member {number}\n * @default 1\n */\n this.alpha = 1.0;\n /**\n * The texture to be used for the fill.\n *\n * @member {PIXI.Texture}\n * @default 0\n */\n this.texture = _pixi_core__WEBPACK_IMPORTED_MODULE_0__.Texture.WHITE;\n /**\n * The transform aplpied to the texture.\n *\n * @member {PIXI.Matrix}\n * @default null\n */\n this.matrix = null;\n /**\n * If the current fill is visible.\n *\n * @member {boolean}\n * @default false\n */\n this.visible = false;\n this.reset();\n }\n /**\n * Clones the object\n *\n * @return {PIXI.FillStyle}\n */\n FillStyle.prototype.clone = function () {\n var obj = new FillStyle();\n obj.color = this.color;\n obj.alpha = this.alpha;\n obj.texture = this.texture;\n obj.matrix = this.matrix;\n obj.visible = this.visible;\n return obj;\n };\n /**\n * Reset\n */\n FillStyle.prototype.reset = function () {\n this.color = 0xFFFFFF;\n this.alpha = 1;\n this.texture = _pixi_core__WEBPACK_IMPORTED_MODULE_0__.Texture.WHITE;\n this.matrix = null;\n this.visible = false;\n };\n /**\n * Destroy and don't use after this\n */\n FillStyle.prototype.destroy = function () {\n this.texture = null;\n this.matrix = null;\n };\n return FillStyle;\n}());\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } };\r\n return extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\n\n/**\n * Builds a polygon to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines\n */\nvar buildPoly = {\n build: function (graphicsData) {\n graphicsData.points = graphicsData.shape.points.slice();\n },\n triangulate: function (graphicsData, graphicsGeometry) {\n var points = graphicsData.points;\n var holes = graphicsData.holes;\n var verts = graphicsGeometry.points;\n var indices = graphicsGeometry.indices;\n if (points.length >= 6) {\n var holeArray = [];\n // Process holes..\n for (var i = 0; i < holes.length; i++) {\n var hole = holes[i];\n holeArray.push(points.length / 2);\n points = points.concat(hole.points);\n }\n // sort color\n var triangles = (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.earcut)(points, holeArray, 2);\n if (!triangles) {\n return;\n }\n var vertPos = verts.length / 2;\n for (var i = 0; i < triangles.length; i += 3) {\n indices.push(triangles[i] + vertPos);\n indices.push(triangles[i + 1] + vertPos);\n indices.push(triangles[i + 2] + vertPos);\n }\n for (var i = 0; i < points.length; i++) {\n verts.push(points[i]);\n }\n }\n },\n};\n\n// for type only\n/**\n * Builds a circle to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw\n * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines\n */\nvar buildCircle = {\n build: function (graphicsData) {\n // need to convert points to a nice regular data\n var circleData = graphicsData.shape;\n var points = graphicsData.points;\n var x = circleData.x;\n var y = circleData.y;\n var width;\n var height;\n points.length = 0;\n // TODO - bit hacky??\n if (graphicsData.type === _pixi_math__WEBPACK_IMPORTED_MODULE_1__.SHAPES.CIRC) {\n width = circleData.radius;\n height = circleData.radius;\n }\n else {\n var ellipseData = graphicsData.shape;\n width = ellipseData.width;\n height = ellipseData.height;\n }\n if (width === 0 || height === 0) {\n return;\n }\n var totalSegs = Math.floor(30 * Math.sqrt(circleData.radius))\n || Math.floor(15 * Math.sqrt(width + height));\n totalSegs /= 2.3;\n var seg = (Math.PI * 2) / totalSegs;\n for (var i = 0; i < totalSegs - 0.5; i++) {\n points.push(x + (Math.sin(-seg * i) * width), y + (Math.cos(-seg * i) * height));\n }\n points.push(points[0], points[1]);\n },\n triangulate: function (graphicsData, graphicsGeometry) {\n var points = graphicsData.points;\n var verts = graphicsGeometry.points;\n var indices = graphicsGeometry.indices;\n var vertPos = verts.length / 2;\n var center = vertPos;\n var circle = (graphicsData.shape);\n var matrix = graphicsData.matrix;\n var x = circle.x;\n var y = circle.y;\n // Push center (special point)\n verts.push(graphicsData.matrix ? (matrix.a * x) + (matrix.c * y) + matrix.tx : x, graphicsData.matrix ? (matrix.b * x) + (matrix.d * y) + matrix.ty : y);\n for (var i = 0; i < points.length; i += 2) {\n verts.push(points[i], points[i + 1]);\n // add some uvs\n indices.push(vertPos++, center, vertPos);\n }\n },\n};\n\n/**\n * Builds a rectangle to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines\n */\nvar buildRectangle = {\n build: function (graphicsData) {\n // --- //\n // need to convert points to a nice regular data\n //\n var rectData = graphicsData.shape;\n var x = rectData.x;\n var y = rectData.y;\n var width = rectData.width;\n var height = rectData.height;\n var points = graphicsData.points;\n points.length = 0;\n points.push(x, y, x + width, y, x + width, y + height, x, y + height);\n },\n triangulate: function (graphicsData, graphicsGeometry) {\n var points = graphicsData.points;\n var verts = graphicsGeometry.points;\n var vertPos = verts.length / 2;\n verts.push(points[0], points[1], points[2], points[3], points[6], points[7], points[4], points[5]);\n graphicsGeometry.indices.push(vertPos, vertPos + 1, vertPos + 2, vertPos + 1, vertPos + 2, vertPos + 3);\n },\n};\n\n/**\n * Calculate a single point for a quadratic bezier curve.\n * Utility function used by quadraticBezierCurve.\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {number} n1 - first number\n * @param {number} n2 - second number\n * @param {number} perc - percentage\n * @return {number} the result\n *\n */\nfunction getPt(n1, n2, perc) {\n var diff = n2 - n1;\n return n1 + (diff * perc);\n}\n/**\n * Calculate the points for a quadratic bezier curve. (helper function..)\n * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {number} fromX - Origin point x\n * @param {number} fromY - Origin point x\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @param {number[]} [out=[]] - The output array to add points into. If not passed, a new array is created.\n * @return {number[]} an array of points\n */\nfunction quadraticBezierCurve(fromX, fromY, cpX, cpY, toX, toY, out) {\n if (out === void 0) { out = []; }\n var n = 20;\n var points = out;\n var xa = 0;\n var ya = 0;\n var xb = 0;\n var yb = 0;\n var x = 0;\n var y = 0;\n for (var i = 0, j = 0; i <= n; ++i) {\n j = i / n;\n // The Green Line\n xa = getPt(fromX, cpX, j);\n ya = getPt(fromY, cpY, j);\n xb = getPt(cpX, toX, j);\n yb = getPt(cpY, toY, j);\n // The Black Dot\n x = getPt(xa, xb, j);\n y = getPt(ya, yb, j);\n points.push(x, y);\n }\n return points;\n}\n/**\n * Builds a rounded rectangle to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines\n */\nvar buildRoundedRectangle = {\n build: function (graphicsData) {\n var rrectData = graphicsData.shape;\n var points = graphicsData.points;\n var x = rrectData.x;\n var y = rrectData.y;\n var width = rrectData.width;\n var height = rrectData.height;\n // Don't allow negative radius or greater than half the smallest width\n var radius = Math.max(0, Math.min(rrectData.radius, Math.min(width, height) / 2));\n points.length = 0;\n // No radius, do a simple rectangle\n if (!radius) {\n points.push(x, y, x + width, y, x + width, y + height, x, y + height);\n }\n else {\n quadraticBezierCurve(x, y + radius, x, y, x + radius, y, points);\n quadraticBezierCurve(x + width - radius, y, x + width, y, x + width, y + radius, points);\n quadraticBezierCurve(x + width, y + height - radius, x + width, y + height, x + width - radius, y + height, points);\n quadraticBezierCurve(x + radius, y + height, x, y + height, x, y + height - radius, points);\n }\n // this tiny number deals with the issue that occurs when points overlap and earcut fails to triangulate the item.\n // TODO - fix this properly, this is not very elegant.. but it works for now.\n },\n triangulate: function (graphicsData, graphicsGeometry) {\n var points = graphicsData.points;\n var verts = graphicsGeometry.points;\n var indices = graphicsGeometry.indices;\n var vecPos = verts.length / 2;\n var triangles = (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.earcut)(points, null, 2);\n for (var i = 0, j = triangles.length; i < j; i += 3) {\n indices.push(triangles[i] + vecPos);\n // indices.push(triangles[i] + vecPos);\n indices.push(triangles[i + 1] + vecPos);\n // indices.push(triangles[i + 2] + vecPos);\n indices.push(triangles[i + 2] + vecPos);\n }\n for (var i = 0, j = points.length; i < j; i++) {\n verts.push(points[i], points[++i]);\n }\n },\n};\n\n/**\n * Buffers vertices to draw a square cap.\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {number} x - X-coord of end point\n * @param {number} y - Y-coord of end point\n * @param {number} nx - X-coord of line normal pointing inside\n * @param {number} ny - Y-coord of line normal pointing inside\n * @param {Array} verts - vertex buffer\n * @returns {}\n */\nfunction square(x, y, nx, ny, innerWeight, outerWeight, clockwise, /* rotation for square (true at left end, false at right end) */ verts) {\n var ix = x - (nx * innerWeight);\n var iy = y - (ny * innerWeight);\n var ox = x + (nx * outerWeight);\n var oy = y + (ny * outerWeight);\n /* Rotate nx,ny for extension vector */\n var exx;\n var eyy;\n if (clockwise) {\n exx = ny;\n eyy = -nx;\n }\n else {\n exx = -ny;\n eyy = nx;\n }\n /* [i|0]x,y extended at cap */\n var eix = ix + exx;\n var eiy = iy + eyy;\n var eox = ox + exx;\n var eoy = oy + eyy;\n /* Square itself must be inserted clockwise*/\n verts.push(eix, eiy);\n verts.push(eox, eoy);\n return 2;\n}\n/**\n * Buffers vertices to draw an arc at the line joint or cap.\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {number} cx - X-coord of center\n * @param {number} cy - Y-coord of center\n * @param {number} sx - X-coord of arc start\n * @param {number} sy - Y-coord of arc start\n * @param {number} ex - X-coord of arc end\n * @param {number} ey - Y-coord of arc end\n * @param {Array} verts - buffer of vertices\n * @param {boolean} clockwise - orientation of vertices\n * @returns {number} - no. of vertices pushed\n */\nfunction round(cx, cy, sx, sy, ex, ey, verts, clockwise) {\n var cx2p0x = sx - cx;\n var cy2p0y = sy - cy;\n var angle0 = Math.atan2(cx2p0x, cy2p0y);\n var angle1 = Math.atan2(ex - cx, ey - cy);\n if (clockwise && angle0 < angle1) {\n angle0 += Math.PI * 2;\n }\n else if (!clockwise && angle0 > angle1) {\n angle1 += Math.PI * 2;\n }\n var startAngle = angle0;\n var angleDiff = angle1 - angle0;\n var absAngleDiff = Math.abs(angleDiff);\n /* if (absAngleDiff >= PI_LBOUND && absAngleDiff <= PI_UBOUND)\n {\n const r1x = cx - nxtPx;\n const r1y = cy - nxtPy;\n\n if (r1x === 0)\n {\n if (r1y > 0)\n {\n angleDiff = -angleDiff;\n }\n }\n else if (r1x >= -GRAPHICS_CURVES.epsilon)\n {\n angleDiff = -angleDiff;\n }\n }*/\n var radius = Math.sqrt((cx2p0x * cx2p0x) + (cy2p0y * cy2p0y));\n var segCount = ((15 * absAngleDiff * Math.sqrt(radius) / Math.PI) >> 0) + 1;\n var angleInc = angleDiff / segCount;\n startAngle += angleInc;\n if (clockwise) {\n verts.push(cx, cy);\n verts.push(sx, sy);\n for (var i = 1, angle = startAngle; i < segCount; i++, angle += angleInc) {\n verts.push(cx, cy);\n verts.push(cx + ((Math.sin(angle) * radius)), cy + ((Math.cos(angle) * radius)));\n }\n verts.push(cx, cy);\n verts.push(ex, ey);\n }\n else {\n verts.push(sx, sy);\n verts.push(cx, cy);\n for (var i = 1, angle = startAngle; i < segCount; i++, angle += angleInc) {\n verts.push(cx + ((Math.sin(angle) * radius)), cy + ((Math.cos(angle) * radius)));\n verts.push(cx, cy);\n }\n verts.push(ex, ey);\n verts.push(cx, cy);\n }\n return segCount * 2;\n}\n/**\n * Builds a line to draw using the polygon method.\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.GraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {PIXI.GraphicsGeometry} graphicsGeometry - Geometry where to append output\n */\nfunction buildNonNativeLine(graphicsData, graphicsGeometry) {\n var shape = graphicsData.shape;\n var points = graphicsData.points || shape.points.slice();\n var eps = graphicsGeometry.closePointEps;\n if (points.length === 0) {\n return;\n }\n // if the line width is an odd number add 0.5 to align to a whole pixel\n // commenting this out fixes #711 and #1620\n // if (graphicsData.lineWidth%2)\n // {\n // for (i = 0; i < points.length; i++)\n // {\n // points[i] += 0.5;\n // }\n // }\n var style = graphicsData.lineStyle;\n // get first and last point.. figure out the middle!\n var firstPoint = new _pixi_math__WEBPACK_IMPORTED_MODULE_1__.Point(points[0], points[1]);\n var lastPoint = new _pixi_math__WEBPACK_IMPORTED_MODULE_1__.Point(points[points.length - 2], points[points.length - 1]);\n var closedShape = shape.type !== _pixi_math__WEBPACK_IMPORTED_MODULE_1__.SHAPES.POLY || shape.closeStroke;\n var closedPath = Math.abs(firstPoint.x - lastPoint.x) < eps\n && Math.abs(firstPoint.y - lastPoint.y) < eps;\n // if the first point is the last point - gonna have issues :)\n if (closedShape) {\n // need to clone as we are going to slightly modify the shape..\n points = points.slice();\n if (closedPath) {\n points.pop();\n points.pop();\n lastPoint.set(points[points.length - 2], points[points.length - 1]);\n }\n var midPointX = (firstPoint.x + lastPoint.x) * 0.5;\n var midPointY = (lastPoint.y + firstPoint.y) * 0.5;\n points.unshift(midPointX, midPointY);\n points.push(midPointX, midPointY);\n }\n var verts = graphicsGeometry.points;\n var length = points.length / 2;\n var indexCount = points.length;\n var indexStart = verts.length / 2;\n // Max. inner and outer width\n var width = style.width / 2;\n var widthSquared = width * width;\n var miterLimitSquared = style.miterLimit * style.miterLimit;\n /* Line segments of interest where (x1,y1) forms the corner. */\n var x0 = points[0];\n var y0 = points[1];\n var x1 = points[2];\n var y1 = points[3];\n var x2 = 0;\n var y2 = 0;\n /* perp[?](x|y) = the line normal with magnitude lineWidth. */\n var perpx = -(y0 - y1);\n var perpy = x0 - x1;\n var perp1x = 0;\n var perp1y = 0;\n var dist = Math.sqrt((perpx * perpx) + (perpy * perpy));\n perpx /= dist;\n perpy /= dist;\n perpx *= width;\n perpy *= width;\n var ratio = style.alignment; // 0.5;\n var innerWeight = (1 - ratio) * 2;\n var outerWeight = ratio * 2;\n if (!closedShape) {\n if (style.cap === LINE_CAP.ROUND) {\n indexCount += round(x0 - (perpx * (innerWeight - outerWeight) * 0.5), y0 - (perpy * (innerWeight - outerWeight) * 0.5), x0 - (perpx * innerWeight), y0 - (perpy * innerWeight), x0 + (perpx * outerWeight), y0 + (perpy * outerWeight), verts, true) + 2;\n }\n else if (style.cap === LINE_CAP.SQUARE) {\n indexCount += square(x0, y0, perpx, perpy, innerWeight, outerWeight, true, verts);\n }\n }\n // Push first point (below & above vertices)\n verts.push(x0 - (perpx * innerWeight), y0 - (perpy * innerWeight));\n verts.push(x0 + (perpx * outerWeight), y0 + (perpy * outerWeight));\n for (var i = 1; i < length - 1; ++i) {\n x0 = points[(i - 1) * 2];\n y0 = points[((i - 1) * 2) + 1];\n x1 = points[i * 2];\n y1 = points[(i * 2) + 1];\n x2 = points[(i + 1) * 2];\n y2 = points[((i + 1) * 2) + 1];\n perpx = -(y0 - y1);\n perpy = x0 - x1;\n dist = Math.sqrt((perpx * perpx) + (perpy * perpy));\n perpx /= dist;\n perpy /= dist;\n perpx *= width;\n perpy *= width;\n perp1x = -(y1 - y2);\n perp1y = x1 - x2;\n dist = Math.sqrt((perp1x * perp1x) + (perp1y * perp1y));\n perp1x /= dist;\n perp1y /= dist;\n perp1x *= width;\n perp1y *= width;\n /* d[x|y](0|1) = the component displacment between points p(0,1|1,2) */\n var dx0 = x1 - x0;\n var dy0 = y0 - y1;\n var dx1 = x1 - x2;\n var dy1 = y2 - y1;\n /* +ve if internal angle counterclockwise, -ve if internal angle clockwise. */\n var cross = (dy0 * dx1) - (dy1 * dx0);\n var clockwise = (cross < 0);\n /* Going nearly straight? */\n if (Math.abs(cross) < 0.1) {\n verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight));\n verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight));\n continue;\n }\n /* p[x|y] is the miter point. pdist is the distance between miter point and p1. */\n var c1 = ((-perpx + x0) * (-perpy + y1)) - ((-perpx + x1) * (-perpy + y0));\n var c2 = ((-perp1x + x2) * (-perp1y + y1)) - ((-perp1x + x1) * (-perp1y + y2));\n var px = ((dx0 * c2) - (dx1 * c1)) / cross;\n var py = ((dy1 * c1) - (dy0 * c2)) / cross;\n var pdist = ((px - x1) * (px - x1)) + ((py - y1) * (py - y1));\n /* Inner miter point */\n var imx = x1 + ((px - x1) * innerWeight);\n var imy = y1 + ((py - y1) * innerWeight);\n /* Outer miter point */\n var omx = x1 - ((px - x1) * outerWeight);\n var omy = y1 - ((py - y1) * outerWeight);\n /* Is the inside miter point too far away, creating a spike? */\n var smallerInsideSegmentSq = Math.min((dx0 * dx0) + (dy0 * dy0), (dx1 * dx1) + (dy1 * dy1));\n var insideWeight = clockwise ? innerWeight : outerWeight;\n var smallerInsideDiagonalSq = smallerInsideSegmentSq + (insideWeight * insideWeight * widthSquared);\n var insideMiterOk = pdist <= smallerInsideDiagonalSq;\n if (insideMiterOk) {\n if (style.join === LINE_JOIN.BEVEL || pdist / widthSquared > miterLimitSquared) {\n if (clockwise) /* rotating at inner angle */ {\n verts.push(imx, imy); // inner miter point\n verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight)); // first segment's outer vertex\n verts.push(imx, imy); // inner miter point\n verts.push(x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight)); // second segment's outer vertex\n }\n else /* rotating at outer angle */ {\n verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight)); // first segment's inner vertex\n verts.push(omx, omy); // outer miter point\n verts.push(x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight)); // second segment's outer vertex\n verts.push(omx, omy); // outer miter point\n }\n indexCount += 2;\n }\n else if (style.join === LINE_JOIN.ROUND) {\n if (clockwise) /* arc is outside */ {\n verts.push(imx, imy);\n verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight));\n indexCount += round(x1, y1, x1 + (perpx * outerWeight), y1 + (perpy * outerWeight), x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight), verts, true) + 4;\n verts.push(imx, imy);\n verts.push(x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight));\n }\n else /* arc is inside */ {\n verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight));\n verts.push(omx, omy);\n indexCount += round(x1, y1, x1 - (perpx * innerWeight), y1 - (perpy * innerWeight), x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight), verts, false) + 4;\n verts.push(x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight));\n verts.push(omx, omy);\n }\n }\n else {\n verts.push(imx, imy);\n verts.push(omx, omy);\n }\n }\n else // inside miter is NOT ok\n {\n verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight)); // first segment's inner vertex\n verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight)); // first segment's outer vertex\n if (style.join === LINE_JOIN.BEVEL || pdist / widthSquared > miterLimitSquared) ;\n else if (style.join === LINE_JOIN.ROUND) {\n if (clockwise) /* arc is outside */ {\n indexCount += round(x1, y1, x1 + (perpx * outerWeight), y1 + (perpy * outerWeight), x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight), verts, true) + 2;\n }\n else /* arc is inside */ {\n indexCount += round(x1, y1, x1 - (perpx * innerWeight), y1 - (perpy * innerWeight), x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight), verts, false) + 2;\n }\n }\n else {\n if (clockwise) {\n verts.push(omx, omy); // inner miter point\n verts.push(omx, omy); // inner miter point\n }\n else {\n verts.push(imx, imy); // outer miter point\n verts.push(imx, imy); // outer miter point\n }\n indexCount += 2;\n }\n verts.push(x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight)); // second segment's inner vertex\n verts.push(x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight)); // second segment's outer vertex\n indexCount += 2;\n }\n }\n x0 = points[(length - 2) * 2];\n y0 = points[((length - 2) * 2) + 1];\n x1 = points[(length - 1) * 2];\n y1 = points[((length - 1) * 2) + 1];\n perpx = -(y0 - y1);\n perpy = x0 - x1;\n dist = Math.sqrt((perpx * perpx) + (perpy * perpy));\n perpx /= dist;\n perpy /= dist;\n perpx *= width;\n perpy *= width;\n verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight));\n verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight));\n if (!closedShape) {\n if (style.cap === LINE_CAP.ROUND) {\n indexCount += round(x1 - (perpx * (innerWeight - outerWeight) * 0.5), y1 - (perpy * (innerWeight - outerWeight) * 0.5), x1 - (perpx * innerWeight), y1 - (perpy * innerWeight), x1 + (perpx * outerWeight), y1 + (perpy * outerWeight), verts, false) + 2;\n }\n else if (style.cap === LINE_CAP.SQUARE) {\n indexCount += square(x1, y1, perpx, perpy, innerWeight, outerWeight, false, verts);\n }\n }\n var indices = graphicsGeometry.indices;\n var eps2 = GRAPHICS_CURVES.epsilon * GRAPHICS_CURVES.epsilon;\n // indices.push(indexStart);\n for (var i = indexStart; i < indexCount + indexStart - 2; ++i) {\n x0 = verts[(i * 2)];\n y0 = verts[(i * 2) + 1];\n x1 = verts[(i + 1) * 2];\n y1 = verts[((i + 1) * 2) + 1];\n x2 = verts[(i + 2) * 2];\n y2 = verts[((i + 2) * 2) + 1];\n /* Skip zero area triangles */\n if (Math.abs((x0 * (y1 - y2)) + (x1 * (y2 - y0)) + (x2 * (y0 - y1))) < eps2) {\n continue;\n }\n indices.push(i, i + 1, i + 2);\n }\n}\n/**\n * Builds a line to draw using the gl.drawArrays(gl.LINES) method\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.GraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {PIXI.GraphicsGeometry} graphicsGeometry - Geometry where to append output\n */\nfunction buildNativeLine(graphicsData, graphicsGeometry) {\n var i = 0;\n var shape = graphicsData.shape;\n var points = graphicsData.points || shape.points;\n var closedShape = shape.type !== _pixi_math__WEBPACK_IMPORTED_MODULE_1__.SHAPES.POLY || shape.closeStroke;\n if (points.length === 0)\n { return; }\n var verts = graphicsGeometry.points;\n var indices = graphicsGeometry.indices;\n var length = points.length / 2;\n var startIndex = verts.length / 2;\n var currentIndex = startIndex;\n verts.push(points[0], points[1]);\n for (i = 1; i < length; i++) {\n verts.push(points[i * 2], points[(i * 2) + 1]);\n indices.push(currentIndex, currentIndex + 1);\n currentIndex++;\n }\n if (closedShape) {\n indices.push(currentIndex, startIndex);\n }\n}\n/**\n * Builds a line to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.GraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {PIXI.GraphicsGeometry} graphicsGeometry - Geometry where to append output\n */\nfunction buildLine(graphicsData, graphicsGeometry) {\n if (graphicsData.lineStyle.native) {\n buildNativeLine(graphicsData, graphicsGeometry);\n }\n else {\n buildNonNativeLine(graphicsData, graphicsGeometry);\n }\n}\n\n/**\n * Draw a star shape with an arbitrary number of points.\n *\n * @class\n * @extends PIXI.Polygon\n * @memberof PIXI.graphicsUtils\n * @param {number} x - Center X position of the star\n * @param {number} y - Center Y position of the star\n * @param {number} points - The number of points of the star, must be > 1\n * @param {number} radius - The outer radius of the star\n * @param {number} [innerRadius] - The inner radius between points, default half `radius`\n * @param {number} [rotation=0] - The rotation of the star in radians, where 0 is vertical\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\nvar Star = /** @class */ (function (_super) {\n __extends(Star, _super);\n function Star(x, y, points, radius, innerRadius, rotation) {\n if (rotation === void 0) { rotation = 0; }\n var _this = this;\n innerRadius = innerRadius || radius / 2;\n var startAngle = (-1 * Math.PI / 2) + rotation;\n var len = points * 2;\n var delta = _pixi_math__WEBPACK_IMPORTED_MODULE_1__.PI_2 / len;\n var polygon = [];\n for (var i = 0; i < len; i++) {\n var r = i % 2 ? innerRadius : radius;\n var angle = (i * delta) + startAngle;\n polygon.push(x + (r * Math.cos(angle)), y + (r * Math.sin(angle)));\n }\n _this = _super.call(this, polygon) || this;\n return _this;\n }\n return Star;\n}(_pixi_math__WEBPACK_IMPORTED_MODULE_1__.Polygon));\n\n/**\n * Utilities for arc curves\n * @class\n * @private\n */\nvar ArcUtils = /** @class */ (function () {\n function ArcUtils() {\n }\n /**\n * The arcTo() method creates an arc/curve between two tangents on the canvas.\n *\n * \"borrowed\" from https://code.google.com/p/fxcanvas/ - thanks google!\n *\n * @private\n * @param {number} x1 - The x-coordinate of the beginning of the arc\n * @param {number} y1 - The y-coordinate of the beginning of the arc\n * @param {number} x2 - The x-coordinate of the end of the arc\n * @param {number} y2 - The y-coordinate of the end of the arc\n * @param {number} radius - The radius of the arc\n * @return {object} If the arc length is valid, return center of circle, radius and other info otherwise `null`.\n */\n ArcUtils.curveTo = function (x1, y1, x2, y2, radius, points) {\n var fromX = points[points.length - 2];\n var fromY = points[points.length - 1];\n var a1 = fromY - y1;\n var b1 = fromX - x1;\n var a2 = y2 - y1;\n var b2 = x2 - x1;\n var mm = Math.abs((a1 * b2) - (b1 * a2));\n if (mm < 1.0e-8 || radius === 0) {\n if (points[points.length - 2] !== x1 || points[points.length - 1] !== y1) {\n points.push(x1, y1);\n }\n return null;\n }\n var dd = (a1 * a1) + (b1 * b1);\n var cc = (a2 * a2) + (b2 * b2);\n var tt = (a1 * a2) + (b1 * b2);\n var k1 = radius * Math.sqrt(dd) / mm;\n var k2 = radius * Math.sqrt(cc) / mm;\n var j1 = k1 * tt / dd;\n var j2 = k2 * tt / cc;\n var cx = (k1 * b2) + (k2 * b1);\n var cy = (k1 * a2) + (k2 * a1);\n var px = b1 * (k2 + j1);\n var py = a1 * (k2 + j1);\n var qx = b2 * (k1 + j2);\n var qy = a2 * (k1 + j2);\n var startAngle = Math.atan2(py - cy, px - cx);\n var endAngle = Math.atan2(qy - cy, qx - cx);\n return {\n cx: (cx + x1),\n cy: (cy + y1),\n radius: radius,\n startAngle: startAngle,\n endAngle: endAngle,\n anticlockwise: (b1 * a2 > b2 * a1),\n };\n };\n /* eslint-disable max-len */\n /**\n * The arc method creates an arc/curve (used to create circles, or parts of circles).\n *\n * @private\n * @param {number} startX - Start x location of arc\n * @param {number} startY - Start y location of arc\n * @param {number} cx - The x-coordinate of the center of the circle\n * @param {number} cy - The y-coordinate of the center of the circle\n * @param {number} radius - The radius of the circle\n * @param {number} startAngle - The starting angle, in radians (0 is at the 3 o'clock position\n * of the arc's circle)\n * @param {number} endAngle - The ending angle, in radians\n * @param {boolean} anticlockwise - Specifies whether the drawing should be\n * counter-clockwise or clockwise. False is default, and indicates clockwise, while true\n * indicates counter-clockwise.\n * @param {number[]} points - Collection of points to add to\n */\n ArcUtils.arc = function (_startX, _startY, cx, cy, radius, startAngle, endAngle, _anticlockwise, points) {\n var sweep = endAngle - startAngle;\n var n = GRAPHICS_CURVES._segmentsCount(Math.abs(sweep) * radius, Math.ceil(Math.abs(sweep) / _pixi_math__WEBPACK_IMPORTED_MODULE_1__.PI_2) * 40);\n var theta = (sweep) / (n * 2);\n var theta2 = theta * 2;\n var cTheta = Math.cos(theta);\n var sTheta = Math.sin(theta);\n var segMinus = n - 1;\n var remainder = (segMinus % 1) / segMinus;\n for (var i = 0; i <= segMinus; ++i) {\n var real = i + (remainder * i);\n var angle = ((theta) + startAngle + (theta2 * real));\n var c = Math.cos(angle);\n var s = -Math.sin(angle);\n points.push((((cTheta * c) + (sTheta * s)) * radius) + cx, (((cTheta * -s) + (sTheta * c)) * radius) + cy);\n }\n };\n return ArcUtils;\n}());\n\n/**\n * Utilities for bezier curves\n * @class\n * @private\n */\nvar BezierUtils = /** @class */ (function () {\n function BezierUtils() {\n }\n /**\n * Calculate length of bezier curve.\n * Analytical solution is impossible, since it involves an integral that does not integrate in general.\n * Therefore numerical solution is used.\n *\n * @private\n * @param {number} fromX - Starting point x\n * @param {number} fromY - Starting point y\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} cpX2 - Second Control point x\n * @param {number} cpY2 - Second Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @return {number} Length of bezier curve\n */\n BezierUtils.curveLength = function (fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY) {\n var n = 10;\n var result = 0.0;\n var t = 0.0;\n var t2 = 0.0;\n var t3 = 0.0;\n var nt = 0.0;\n var nt2 = 0.0;\n var nt3 = 0.0;\n var x = 0.0;\n var y = 0.0;\n var dx = 0.0;\n var dy = 0.0;\n var prevX = fromX;\n var prevY = fromY;\n for (var i = 1; i <= n; ++i) {\n t = i / n;\n t2 = t * t;\n t3 = t2 * t;\n nt = (1.0 - t);\n nt2 = nt * nt;\n nt3 = nt2 * nt;\n x = (nt3 * fromX) + (3.0 * nt2 * t * cpX) + (3.0 * nt * t2 * cpX2) + (t3 * toX);\n y = (nt3 * fromY) + (3.0 * nt2 * t * cpY) + (3 * nt * t2 * cpY2) + (t3 * toY);\n dx = prevX - x;\n dy = prevY - y;\n prevX = x;\n prevY = y;\n result += Math.sqrt((dx * dx) + (dy * dy));\n }\n return result;\n };\n /**\n * Calculate the points for a bezier curve and then draws it.\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} cpX2 - Second Control point x\n * @param {number} cpY2 - Second Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @param {number[]} points - Path array to push points into\n */\n BezierUtils.curveTo = function (cpX, cpY, cpX2, cpY2, toX, toY, points) {\n var fromX = points[points.length - 2];\n var fromY = points[points.length - 1];\n points.length -= 2;\n var n = GRAPHICS_CURVES._segmentsCount(BezierUtils.curveLength(fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY));\n var dt = 0;\n var dt2 = 0;\n var dt3 = 0;\n var t2 = 0;\n var t3 = 0;\n points.push(fromX, fromY);\n for (var i = 1, j = 0; i <= n; ++i) {\n j = i / n;\n dt = (1 - j);\n dt2 = dt * dt;\n dt3 = dt2 * dt;\n t2 = j * j;\n t3 = t2 * j;\n points.push((dt3 * fromX) + (3 * dt2 * j * cpX) + (3 * dt * t2 * cpX2) + (t3 * toX), (dt3 * fromY) + (3 * dt2 * j * cpY) + (3 * dt * t2 * cpY2) + (t3 * toY));\n }\n };\n return BezierUtils;\n}());\n\n/**\n * Utilities for quadratic curves\n * @class\n * @private\n */\nvar QuadraticUtils = /** @class */ (function () {\n function QuadraticUtils() {\n }\n /**\n * Calculate length of quadratic curve\n * @see {@link http://www.malczak.linuxpl.com/blog/quadratic-bezier-curve-length/}\n * for the detailed explanation of math behind this.\n *\n * @private\n * @param {number} fromX - x-coordinate of curve start point\n * @param {number} fromY - y-coordinate of curve start point\n * @param {number} cpX - x-coordinate of curve control point\n * @param {number} cpY - y-coordinate of curve control point\n * @param {number} toX - x-coordinate of curve end point\n * @param {number} toY - y-coordinate of curve end point\n * @return {number} Length of quadratic curve\n */\n QuadraticUtils.curveLength = function (fromX, fromY, cpX, cpY, toX, toY) {\n var ax = fromX - (2.0 * cpX) + toX;\n var ay = fromY - (2.0 * cpY) + toY;\n var bx = (2.0 * cpX) - (2.0 * fromX);\n var by = (2.0 * cpY) - (2.0 * fromY);\n var a = 4.0 * ((ax * ax) + (ay * ay));\n var b = 4.0 * ((ax * bx) + (ay * by));\n var c = (bx * bx) + (by * by);\n var s = 2.0 * Math.sqrt(a + b + c);\n var a2 = Math.sqrt(a);\n var a32 = 2.0 * a * a2;\n var c2 = 2.0 * Math.sqrt(c);\n var ba = b / a2;\n return ((a32 * s)\n + (a2 * b * (s - c2))\n + (((4.0 * c * a) - (b * b))\n * Math.log(((2.0 * a2) + ba + s) / (ba + c2)))) / (4.0 * a32);\n };\n /**\n * Calculate the points for a quadratic bezier curve and then draws it.\n * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c\n *\n * @private\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @param {number[]} points - Points to add segments to.\n */\n QuadraticUtils.curveTo = function (cpX, cpY, toX, toY, points) {\n var fromX = points[points.length - 2];\n var fromY = points[points.length - 1];\n var n = GRAPHICS_CURVES._segmentsCount(QuadraticUtils.curveLength(fromX, fromY, cpX, cpY, toX, toY));\n var xa = 0;\n var ya = 0;\n for (var i = 1; i <= n; ++i) {\n var j = i / n;\n xa = fromX + ((cpX - fromX) * j);\n ya = fromY + ((cpY - fromY) * j);\n points.push(xa + (((cpX + ((toX - cpX) * j)) - xa) * j), ya + (((cpY + ((toY - cpY) * j)) - ya) * j));\n }\n };\n return QuadraticUtils;\n}());\n\n/**\n * A structure to hold interim batch objects for Graphics.\n * @class\n * @memberof PIXI.graphicsUtils\n */\nvar BatchPart = /** @class */ (function () {\n function BatchPart() {\n this.reset();\n }\n /**\n * Begin batch part\n *\n * @param {PIXI.FillStyle | PIXI.LineStyle} style\n * @param {number} startIndex\n * @param {number} attribStart\n */\n BatchPart.prototype.begin = function (style, startIndex, attribStart) {\n this.reset();\n this.style = style;\n this.start = startIndex;\n this.attribStart = attribStart;\n };\n /**\n * End batch part\n *\n * @param {number} endIndex\n * @param {number} endAttrib\n */\n BatchPart.prototype.end = function (endIndex, endAttrib) {\n this.attribSize = endAttrib - this.attribStart;\n this.size = endIndex - this.start;\n };\n BatchPart.prototype.reset = function () {\n this.style = null;\n this.size = 0;\n this.start = 0;\n this.attribStart = 0;\n this.attribSize = 0;\n };\n return BatchPart;\n}());\n\n/**\n * Generalized convenience utilities for Graphics.\n *\n * @namespace graphicsUtils\n * @memberof PIXI\n */\nvar _a;\n/**\n * Map of fill commands for each shape type.\n *\n * @memberof PIXI.graphicsUtils\n * @member {Object} FILL_COMMANDS\n */\nvar FILL_COMMANDS = (_a = {},\n _a[_pixi_math__WEBPACK_IMPORTED_MODULE_1__.SHAPES.POLY] = buildPoly,\n _a[_pixi_math__WEBPACK_IMPORTED_MODULE_1__.SHAPES.CIRC] = buildCircle,\n _a[_pixi_math__WEBPACK_IMPORTED_MODULE_1__.SHAPES.ELIP] = buildCircle,\n _a[_pixi_math__WEBPACK_IMPORTED_MODULE_1__.SHAPES.RECT] = buildRectangle,\n _a[_pixi_math__WEBPACK_IMPORTED_MODULE_1__.SHAPES.RREC] = buildRoundedRectangle,\n _a);\n/**\n * Batch pool, stores unused batches for preventing allocations.\n *\n * @memberof PIXI.graphicsUtils\n * @member {Array} BATCH_POOL\n */\nvar BATCH_POOL = [];\n/**\n * Draw call pool, stores unused draw calls for preventing allocations.\n *\n * @memberof PIXI.graphicsUtils\n * @member {Array} DRAW_CALL_POOL\n */\nvar DRAW_CALL_POOL = [];\n\nvar index = ({\n buildPoly: buildPoly,\n buildCircle: buildCircle,\n buildRectangle: buildRectangle,\n buildRoundedRectangle: buildRoundedRectangle,\n FILL_COMMANDS: FILL_COMMANDS,\n BATCH_POOL: BATCH_POOL,\n DRAW_CALL_POOL: DRAW_CALL_POOL,\n buildLine: buildLine,\n Star: Star,\n ArcUtils: ArcUtils,\n BezierUtils: BezierUtils,\n QuadraticUtils: QuadraticUtils,\n BatchPart: BatchPart\n});\n\n/**\n * A class to contain data useful for Graphics objects\n *\n * @class\n * @memberof PIXI\n */\nvar GraphicsData = /** @class */ (function () {\n /**\n *\n * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw.\n * @param {PIXI.FillStyle} [fillStyle] - the width of the line to draw\n * @param {PIXI.LineStyle} [lineStyle] - the color of the line to draw\n * @param {PIXI.Matrix} [matrix] - Transform matrix\n */\n function GraphicsData(shape, fillStyle, lineStyle, matrix) {\n if (fillStyle === void 0) { fillStyle = null; }\n if (lineStyle === void 0) { lineStyle = null; }\n if (matrix === void 0) { matrix = null; }\n /**\n * The shape object to draw.\n * @member {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle}\n */\n this.shape = shape;\n /**\n * The style of the line.\n * @member {PIXI.LineStyle}\n */\n this.lineStyle = lineStyle;\n /**\n * The style of the fill.\n * @member {PIXI.FillStyle}\n */\n this.fillStyle = fillStyle;\n /**\n * The transform matrix.\n * @member {PIXI.Matrix}\n */\n this.matrix = matrix;\n /**\n * The type of the shape, see the Const.Shapes file for all the existing types,\n * @member {number}\n */\n this.type = shape.type;\n /**\n * The collection of points.\n * @member {number[]}\n */\n this.points = [];\n /**\n * The collection of holes.\n * @member {PIXI.GraphicsData[]}\n */\n this.holes = [];\n }\n /**\n * Creates a new GraphicsData object with the same values as this one.\n *\n * @return {PIXI.GraphicsData} Cloned GraphicsData object\n */\n GraphicsData.prototype.clone = function () {\n return new GraphicsData(this.shape, this.fillStyle, this.lineStyle, this.matrix);\n };\n /**\n * Destroys the Graphics data.\n *\n */\n GraphicsData.prototype.destroy = function () {\n this.shape = null;\n this.holes.length = 0;\n this.holes = null;\n this.points.length = 0;\n this.points = null;\n this.lineStyle = null;\n this.fillStyle = null;\n };\n return GraphicsData;\n}());\n\nvar tmpPoint = new _pixi_math__WEBPACK_IMPORTED_MODULE_1__.Point();\nvar tmpBounds = new _pixi_display__WEBPACK_IMPORTED_MODULE_4__.Bounds();\n/**\n * The Graphics class contains methods used to draw primitive shapes such as lines, circles and\n * rectangles to the display, and to color and fill them.\n *\n * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive\n * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster.\n *\n * @class\n * @extends PIXI.BatchGeometry\n * @memberof PIXI\n */\nvar GraphicsGeometry = /** @class */ (function (_super) {\n __extends(GraphicsGeometry, _super);\n function GraphicsGeometry() {\n var _this = _super.call(this) || this;\n _this.uvsFloat32 = null;\n _this.indicesUint16 = null;\n /**\n * An array of points to draw, 2 numbers per point\n *\n * @member {number[]}\n * @protected\n */\n _this.points = [];\n /**\n * The collection of colors\n *\n * @member {number[]}\n * @protected\n */\n _this.colors = [];\n /**\n * The UVs collection\n *\n * @member {number[]}\n * @protected\n */\n _this.uvs = [];\n /**\n * The indices of the vertices\n *\n * @member {number[]}\n * @protected\n */\n _this.indices = [];\n /**\n * Reference to the texture IDs.\n *\n * @member {number[]}\n * @protected\n */\n _this.textureIds = [];\n /**\n * The collection of drawn shapes.\n *\n * @member {PIXI.GraphicsData[]}\n * @protected\n */\n _this.graphicsData = [];\n /**\n * Used to detect if the graphics object has changed.\n *\n * @member {number}\n * @protected\n */\n _this.dirty = 0;\n /**\n * Batches need to regenerated if the geometry is updated.\n *\n * @member {number}\n * @protected\n */\n _this.batchDirty = -1;\n /**\n * Used to check if the cache is dirty.\n *\n * @member {number}\n * @protected\n */\n _this.cacheDirty = -1;\n /**\n * Used to detect if we cleared the graphicsData.\n *\n * @member {number}\n * @default 0\n * @protected\n */\n _this.clearDirty = 0;\n /**\n * List of current draw calls drived from the batches.\n *\n * @member {object[]}\n * @protected\n */\n _this.drawCalls = [];\n /**\n * Intermediate abstract format sent to batch system.\n * Can be converted to drawCalls or to batchable objects.\n *\n * @member {PIXI.graphicsUtils.BatchPart[]}\n * @protected\n */\n _this.batches = [];\n /**\n * Index of the last batched shape in the stack of calls.\n *\n * @member {number}\n * @protected\n */\n _this.shapeIndex = 0;\n /**\n * Cached bounds.\n *\n * @member {PIXI.Bounds}\n * @protected\n */\n _this._bounds = new _pixi_display__WEBPACK_IMPORTED_MODULE_4__.Bounds();\n /**\n * The bounds dirty flag.\n *\n * @member {number}\n * @protected\n */\n _this.boundsDirty = -1;\n /**\n * Padding to add to the bounds.\n *\n * @member {number}\n * @default 0\n */\n _this.boundsPadding = 0;\n _this.batchable = false;\n _this.indicesUint16 = null;\n _this.uvsFloat32 = null;\n /**\n * Minimal distance between points that are considered different.\n * Affects line tesselation.\n *\n * @member {number}\n */\n _this.closePointEps = 1e-4;\n return _this;\n }\n Object.defineProperty(GraphicsGeometry.prototype, \"bounds\", {\n /**\n * Get the current bounds of the graphic geometry.\n *\n * @member {PIXI.Bounds}\n * @readonly\n */\n get: function () {\n if (this.boundsDirty !== this.dirty) {\n this.boundsDirty = this.dirty;\n this.calculateBounds();\n }\n return this._bounds;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Call if you changed graphicsData manually.\n * Empties all batch buffers.\n */\n GraphicsGeometry.prototype.invalidate = function () {\n this.boundsDirty = -1;\n this.dirty++;\n this.batchDirty++;\n this.shapeIndex = 0;\n this.points.length = 0;\n this.colors.length = 0;\n this.uvs.length = 0;\n this.indices.length = 0;\n this.textureIds.length = 0;\n for (var i = 0; i < this.drawCalls.length; i++) {\n this.drawCalls[i].texArray.clear();\n DRAW_CALL_POOL.push(this.drawCalls[i]);\n }\n this.drawCalls.length = 0;\n for (var i = 0; i < this.batches.length; i++) {\n var batchPart = this.batches[i];\n batchPart.reset();\n BATCH_POOL.push(batchPart);\n }\n this.batches.length = 0;\n };\n /**\n * Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings.\n *\n * @return {PIXI.GraphicsGeometry} This GraphicsGeometry object. Good for chaining method calls\n */\n GraphicsGeometry.prototype.clear = function () {\n if (this.graphicsData.length > 0) {\n this.invalidate();\n this.clearDirty++;\n this.graphicsData.length = 0;\n }\n return this;\n };\n /**\n * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon.\n *\n * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw.\n * @param {PIXI.FillStyle} fillStyle - Defines style of the fill.\n * @param {PIXI.LineStyle} lineStyle - Defines style of the lines.\n * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape.\n * @return {PIXI.GraphicsGeometry} Returns geometry for chaining.\n */\n GraphicsGeometry.prototype.drawShape = function (shape, fillStyle, lineStyle, matrix) {\n if (fillStyle === void 0) { fillStyle = null; }\n if (lineStyle === void 0) { lineStyle = null; }\n if (matrix === void 0) { matrix = null; }\n var data = new GraphicsData(shape, fillStyle, lineStyle, matrix);\n this.graphicsData.push(data);\n this.dirty++;\n return this;\n };\n /**\n * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon.\n *\n * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw.\n * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape.\n * @return {PIXI.GraphicsGeometry} Returns geometry for chaining.\n */\n GraphicsGeometry.prototype.drawHole = function (shape, matrix) {\n if (matrix === void 0) { matrix = null; }\n if (!this.graphicsData.length) {\n return null;\n }\n var data = new GraphicsData(shape, null, null, matrix);\n var lastShape = this.graphicsData[this.graphicsData.length - 1];\n data.lineStyle = lastShape.lineStyle;\n lastShape.holes.push(data);\n this.dirty++;\n return this;\n };\n /**\n * Destroys the GraphicsGeometry object.\n *\n */\n GraphicsGeometry.prototype.destroy = function () {\n _super.prototype.destroy.call(this);\n // destroy each of the GraphicsData objects\n for (var i = 0; i < this.graphicsData.length; ++i) {\n this.graphicsData[i].destroy();\n }\n this.points.length = 0;\n this.points = null;\n this.colors.length = 0;\n this.colors = null;\n this.uvs.length = 0;\n this.uvs = null;\n this.indices.length = 0;\n this.indices = null;\n this.indexBuffer.destroy();\n this.indexBuffer = null;\n this.graphicsData.length = 0;\n this.graphicsData = null;\n this.drawCalls.length = 0;\n this.drawCalls = null;\n this.batches.length = 0;\n this.batches = null;\n this._bounds = null;\n };\n /**\n * Check to see if a point is contained within this geometry.\n *\n * @param {PIXI.IPointData} point - Point to check if it's contained.\n * @return {Boolean} `true` if the point is contained within geometry.\n */\n GraphicsGeometry.prototype.containsPoint = function (point) {\n var graphicsData = this.graphicsData;\n for (var i = 0; i < graphicsData.length; ++i) {\n var data = graphicsData[i];\n if (!data.fillStyle.visible) {\n continue;\n }\n // only deal with fills..\n if (data.shape) {\n if (data.matrix) {\n data.matrix.applyInverse(point, tmpPoint);\n }\n else {\n tmpPoint.copyFrom(point);\n }\n if (data.shape.contains(tmpPoint.x, tmpPoint.y)) {\n var hitHole = false;\n if (data.holes) {\n for (var i_1 = 0; i_1 < data.holes.length; i_1++) {\n var hole = data.holes[i_1];\n if (hole.shape.contains(tmpPoint.x, tmpPoint.y)) {\n hitHole = true;\n break;\n }\n }\n }\n if (!hitHole) {\n return true;\n }\n }\n }\n }\n return false;\n };\n /**\n * Generates intermediate batch data. Either gets converted to drawCalls\n * or used to convert to batch objects directly by the Graphics object.\n *\n * @param {boolean} [aloow32Indices] - Allow using 32-bit indices for preventings artefacts when more that 65535 vertices\n */\n GraphicsGeometry.prototype.updateBatches = function (allow32Indices) {\n if (!this.graphicsData.length) {\n this.batchable = true;\n return;\n }\n if (!this.validateBatching()) {\n return;\n }\n this.cacheDirty = this.dirty;\n var uvs = this.uvs;\n var graphicsData = this.graphicsData;\n var batchPart = null;\n var currentStyle = null;\n if (this.batches.length > 0) {\n batchPart = this.batches[this.batches.length - 1];\n currentStyle = batchPart.style;\n }\n for (var i = this.shapeIndex; i < graphicsData.length; i++) {\n this.shapeIndex++;\n var data = graphicsData[i];\n var fillStyle = data.fillStyle;\n var lineStyle = data.lineStyle;\n var command = FILL_COMMANDS[data.type];\n // build out the shapes points..\n command.build(data);\n if (data.matrix) {\n this.transformPoints(data.points, data.matrix);\n }\n for (var j = 0; j < 2; j++) {\n var style = (j === 0) ? fillStyle : lineStyle;\n if (!style.visible)\n { continue; }\n var nextTexture = style.texture.baseTexture;\n var index_1 = this.indices.length;\n var attribIndex = this.points.length / 2;\n nextTexture.wrapMode = _pixi_constants__WEBPACK_IMPORTED_MODULE_3__.WRAP_MODES.REPEAT;\n if (j === 0) {\n this.processFill(data);\n }\n else {\n this.processLine(data);\n }\n var size = (this.points.length / 2) - attribIndex;\n if (size === 0)\n { continue; }\n // close batch if style is different\n if (batchPart && !this._compareStyles(currentStyle, style)) {\n batchPart.end(index_1, attribIndex);\n batchPart = null;\n }\n // spawn new batch if its first batch or previous was closed\n if (!batchPart) {\n batchPart = BATCH_POOL.pop() || new BatchPart();\n batchPart.begin(style, index_1, attribIndex);\n this.batches.push(batchPart);\n currentStyle = style;\n }\n this.addUvs(this.points, uvs, style.texture, attribIndex, size, style.matrix);\n }\n }\n var index = this.indices.length;\n var attrib = this.points.length / 2;\n if (batchPart) {\n batchPart.end(index, attrib);\n }\n if (this.batches.length === 0) {\n // there are no visible styles in GraphicsData\n // its possible that someone wants Graphics just for the bounds\n this.batchable = true;\n return;\n }\n // prevent allocation when length is same as buffer\n if (this.indicesUint16 && this.indices.length === this.indicesUint16.length) {\n this.indicesUint16.set(this.indices);\n }\n else {\n var need32 = attrib > 0xffff && allow32Indices;\n this.indicesUint16 = need32 ? new Uint32Array(this.indices) : new Uint16Array(this.indices);\n }\n // TODO make this a const..\n this.batchable = this.isBatchable();\n if (this.batchable) {\n this.packBatches();\n }\n else {\n this.buildDrawCalls();\n }\n };\n /**\n * Affinity check\n *\n * @param {PIXI.FillStyle | PIXI.LineStyle} styleA\n * @param {PIXI.FillStyle | PIXI.LineStyle} styleB\n */\n GraphicsGeometry.prototype._compareStyles = function (styleA, styleB) {\n if (!styleA || !styleB) {\n return false;\n }\n if (styleA.texture.baseTexture !== styleB.texture.baseTexture) {\n return false;\n }\n if (styleA.color + styleA.alpha !== styleB.color + styleB.alpha) {\n return false;\n }\n if (!!styleA.native !== !!styleB.native) {\n return false;\n }\n return true;\n };\n /**\n * Test geometry for batching process.\n *\n * @protected\n */\n GraphicsGeometry.prototype.validateBatching = function () {\n if (this.dirty === this.cacheDirty || !this.graphicsData.length) {\n return false;\n }\n for (var i = 0, l = this.graphicsData.length; i < l; i++) {\n var data = this.graphicsData[i];\n var fill = data.fillStyle;\n var line = data.lineStyle;\n if (fill && !fill.texture.baseTexture.valid)\n { return false; }\n if (line && !line.texture.baseTexture.valid)\n { return false; }\n }\n return true;\n };\n /**\n * Offset the indices so that it works with the batcher.\n *\n * @protected\n */\n GraphicsGeometry.prototype.packBatches = function () {\n this.batchDirty++;\n this.uvsFloat32 = new Float32Array(this.uvs);\n var batches = this.batches;\n for (var i = 0, l = batches.length; i < l; i++) {\n var batch = batches[i];\n for (var j = 0; j < batch.size; j++) {\n var index = batch.start + j;\n this.indicesUint16[index] = this.indicesUint16[index] - batch.attribStart;\n }\n }\n };\n /**\n * Checks to see if this graphics geometry can be batched.\n * Currently it needs to be small enough and not contain any native lines.\n *\n * @protected\n */\n GraphicsGeometry.prototype.isBatchable = function () {\n // prevent heavy mesh batching\n if (this.points.length > 0xffff * 2) {\n return false;\n }\n var batches = this.batches;\n for (var i = 0; i < batches.length; i++) {\n if (batches[i].style.native) {\n return false;\n }\n }\n return (this.points.length < GraphicsGeometry.BATCHABLE_SIZE * 2);\n };\n /**\n * Converts intermediate batches data to drawCalls.\n *\n * @protected\n */\n GraphicsGeometry.prototype.buildDrawCalls = function () {\n var TICK = ++_pixi_core__WEBPACK_IMPORTED_MODULE_0__.BaseTexture._globalBatch;\n for (var i = 0; i < this.drawCalls.length; i++) {\n this.drawCalls[i].texArray.clear();\n DRAW_CALL_POOL.push(this.drawCalls[i]);\n }\n this.drawCalls.length = 0;\n var colors = this.colors;\n var textureIds = this.textureIds;\n var currentGroup = DRAW_CALL_POOL.pop();\n if (!currentGroup) {\n currentGroup = new _pixi_core__WEBPACK_IMPORTED_MODULE_0__.BatchDrawCall();\n currentGroup.texArray = new _pixi_core__WEBPACK_IMPORTED_MODULE_0__.BatchTextureArray();\n }\n currentGroup.texArray.count = 0;\n currentGroup.start = 0;\n currentGroup.size = 0;\n currentGroup.type = _pixi_constants__WEBPACK_IMPORTED_MODULE_3__.DRAW_MODES.TRIANGLES;\n var textureCount = 0;\n var currentTexture = null;\n var textureId = 0;\n var native = false;\n var drawMode = _pixi_constants__WEBPACK_IMPORTED_MODULE_3__.DRAW_MODES.TRIANGLES;\n var index = 0;\n this.drawCalls.push(currentGroup);\n // TODO - this can be simplified\n for (var i = 0; i < this.batches.length; i++) {\n var data = this.batches[i];\n // TODO add some full on MAX_TEXTURE CODE..\n var MAX_TEXTURES = 8;\n // Forced cast for checking `native` without errors\n var style = data.style;\n var nextTexture = style.texture.baseTexture;\n if (native !== !!style.native) {\n native = !!style.native;\n drawMode = native ? _pixi_constants__WEBPACK_IMPORTED_MODULE_3__.DRAW_MODES.LINES : _pixi_constants__WEBPACK_IMPORTED_MODULE_3__.DRAW_MODES.TRIANGLES;\n // force the batch to break!\n currentTexture = null;\n textureCount = MAX_TEXTURES;\n TICK++;\n }\n if (currentTexture !== nextTexture) {\n currentTexture = nextTexture;\n if (nextTexture._batchEnabled !== TICK) {\n if (textureCount === MAX_TEXTURES) {\n TICK++;\n textureCount = 0;\n if (currentGroup.size > 0) {\n currentGroup = DRAW_CALL_POOL.pop();\n if (!currentGroup) {\n currentGroup = new _pixi_core__WEBPACK_IMPORTED_MODULE_0__.BatchDrawCall();\n currentGroup.texArray = new _pixi_core__WEBPACK_IMPORTED_MODULE_0__.BatchTextureArray();\n }\n this.drawCalls.push(currentGroup);\n }\n currentGroup.start = index;\n currentGroup.size = 0;\n currentGroup.texArray.count = 0;\n currentGroup.type = drawMode;\n }\n // TODO add this to the render part..\n // Hack! Because texture has protected `touched`\n nextTexture.touched = 1; // touch;\n nextTexture._batchEnabled = TICK;\n nextTexture._batchLocation = textureCount;\n nextTexture.wrapMode = 10497;\n currentGroup.texArray.elements[currentGroup.texArray.count++] = nextTexture;\n textureCount++;\n }\n }\n currentGroup.size += data.size;\n index += data.size;\n textureId = nextTexture._batchLocation;\n this.addColors(colors, style.color, style.alpha, data.attribSize, data.attribStart);\n this.addTextureIds(textureIds, textureId, data.attribSize, data.attribStart);\n }\n _pixi_core__WEBPACK_IMPORTED_MODULE_0__.BaseTexture._globalBatch = TICK;\n // upload..\n // merge for now!\n this.packAttributes();\n };\n /**\n * Packs attributes to single buffer.\n *\n * @protected\n */\n GraphicsGeometry.prototype.packAttributes = function () {\n var verts = this.points;\n var uvs = this.uvs;\n var colors = this.colors;\n var textureIds = this.textureIds;\n // verts are 2 positions.. so we * by 3 as there are 6 properties.. then 4 cos its bytes\n var glPoints = new ArrayBuffer(verts.length * 3 * 4);\n var f32 = new Float32Array(glPoints);\n var u32 = new Uint32Array(glPoints);\n var p = 0;\n for (var i = 0; i < verts.length / 2; i++) {\n f32[p++] = verts[i * 2];\n f32[p++] = verts[(i * 2) + 1];\n f32[p++] = uvs[i * 2];\n f32[p++] = uvs[(i * 2) + 1];\n u32[p++] = colors[i];\n f32[p++] = textureIds[i];\n }\n this._buffer.update(glPoints);\n this._indexBuffer.update(this.indicesUint16);\n };\n /**\n * Process fill part of Graphics.\n *\n * @param {PIXI.GraphicsData} data\n * @protected\n */\n GraphicsGeometry.prototype.processFill = function (data) {\n if (data.holes.length) {\n this.processHoles(data.holes);\n buildPoly.triangulate(data, this);\n }\n else {\n var command = FILL_COMMANDS[data.type];\n command.triangulate(data, this);\n }\n };\n /**\n * Process line part of Graphics.\n *\n * @param {PIXI.GraphicsData} data\n * @protected\n */\n GraphicsGeometry.prototype.processLine = function (data) {\n buildLine(data, this);\n for (var i = 0; i < data.holes.length; i++) {\n buildLine(data.holes[i], this);\n }\n };\n /**\n * Process the holes data.\n *\n * @param {PIXI.GraphicsData[]} holes - Holes to render\n * @protected\n */\n GraphicsGeometry.prototype.processHoles = function (holes) {\n for (var i = 0; i < holes.length; i++) {\n var hole = holes[i];\n var command = FILL_COMMANDS[hole.type];\n command.build(hole);\n if (hole.matrix) {\n this.transformPoints(hole.points, hole.matrix);\n }\n }\n };\n /**\n * Update the local bounds of the object. Expensive to use performance-wise.\n *\n * @protected\n */\n GraphicsGeometry.prototype.calculateBounds = function () {\n var bounds = this._bounds;\n var sequenceBounds = tmpBounds;\n var curMatrix = _pixi_math__WEBPACK_IMPORTED_MODULE_1__.Matrix.IDENTITY;\n this._bounds.clear();\n sequenceBounds.clear();\n for (var i = 0; i < this.graphicsData.length; i++) {\n var data = this.graphicsData[i];\n var shape = data.shape;\n var type = data.type;\n var lineStyle = data.lineStyle;\n var nextMatrix = data.matrix || _pixi_math__WEBPACK_IMPORTED_MODULE_1__.Matrix.IDENTITY;\n var lineWidth = 0.0;\n if (lineStyle && lineStyle.visible) {\n var alignment = lineStyle.alignment;\n lineWidth = lineStyle.width;\n if (type === _pixi_math__WEBPACK_IMPORTED_MODULE_1__.SHAPES.POLY) {\n lineWidth = lineWidth * (0.5 + Math.abs(0.5 - alignment));\n }\n else {\n lineWidth = lineWidth * Math.max(0, alignment);\n }\n }\n if (curMatrix !== nextMatrix) {\n if (!sequenceBounds.isEmpty()) {\n bounds.addBoundsMatrix(sequenceBounds, curMatrix);\n sequenceBounds.clear();\n }\n curMatrix = nextMatrix;\n }\n if (type === _pixi_math__WEBPACK_IMPORTED_MODULE_1__.SHAPES.RECT || type === _pixi_math__WEBPACK_IMPORTED_MODULE_1__.SHAPES.RREC) {\n var rect = shape;\n sequenceBounds.addFramePad(rect.x, rect.y, rect.x + rect.width, rect.y + rect.height, lineWidth, lineWidth);\n }\n else if (type === _pixi_math__WEBPACK_IMPORTED_MODULE_1__.SHAPES.CIRC) {\n var circle = shape;\n sequenceBounds.addFramePad(circle.x, circle.y, circle.x, circle.y, circle.radius + lineWidth, circle.radius + lineWidth);\n }\n else if (type === _pixi_math__WEBPACK_IMPORTED_MODULE_1__.SHAPES.ELIP) {\n var ellipse = shape;\n sequenceBounds.addFramePad(ellipse.x, ellipse.y, ellipse.x, ellipse.y, ellipse.width + lineWidth, ellipse.height + lineWidth);\n }\n else {\n var poly = shape;\n // adding directly to the bounds\n bounds.addVerticesMatrix(curMatrix, poly.points, 0, poly.points.length, lineWidth, lineWidth);\n }\n }\n if (!sequenceBounds.isEmpty()) {\n bounds.addBoundsMatrix(sequenceBounds, curMatrix);\n }\n bounds.pad(this.boundsPadding, this.boundsPadding);\n };\n /**\n * Transform points using matrix.\n *\n * @protected\n * @param {number[]} points - Points to transform\n * @param {PIXI.Matrix} matrix - Transform matrix\n */\n GraphicsGeometry.prototype.transformPoints = function (points, matrix) {\n for (var i = 0; i < points.length / 2; i++) {\n var x = points[(i * 2)];\n var y = points[(i * 2) + 1];\n points[(i * 2)] = (matrix.a * x) + (matrix.c * y) + matrix.tx;\n points[(i * 2) + 1] = (matrix.b * x) + (matrix.d * y) + matrix.ty;\n }\n };\n /**\n * Add colors.\n *\n * @protected\n * @param {number[]} colors - List of colors to add to\n * @param {number} color - Color to add\n * @param {number} alpha - Alpha to use\n * @param {number} size - Number of colors to add\n * @param {number} offset\n */\n GraphicsGeometry.prototype.addColors = function (colors, color, alpha, size, offset) {\n if (offset === void 0) { offset = 0; }\n // TODO use the premultiply bits Ivan added\n var rgb = (color >> 16) + (color & 0xff00) + ((color & 0xff) << 16);\n var rgba = (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.premultiplyTint)(rgb, alpha);\n colors.length = Math.max(colors.length, offset + size);\n for (var i = 0; i < size; i++) {\n colors[offset + i] = rgba;\n }\n };\n /**\n * Add texture id that the shader/fragment wants to use.\n *\n * @protected\n * @param {number[]} textureIds\n * @param {number} id\n * @param {number} size\n * @param {number} offset\n */\n GraphicsGeometry.prototype.addTextureIds = function (textureIds, id, size, offset) {\n if (offset === void 0) { offset = 0; }\n textureIds.length = Math.max(textureIds.length, offset + size);\n for (var i = 0; i < size; i++) {\n textureIds[offset + i] = id;\n }\n };\n /**\n * Generates the UVs for a shape.\n *\n * @protected\n * @param {number[]} verts - Vertices\n * @param {number[]} uvs - UVs\n * @param {PIXI.Texture} texture - Reference to Texture\n * @param {number} start - Index buffer start index.\n * @param {number} size - The size/length for index buffer.\n * @param {PIXI.Matrix} [matrix] - Optional transform for all points.\n */\n GraphicsGeometry.prototype.addUvs = function (verts, uvs, texture, start, size, matrix) {\n if (matrix === void 0) { matrix = null; }\n var index = 0;\n var uvsStart = uvs.length;\n var frame = texture.frame;\n while (index < size) {\n var x = verts[(start + index) * 2];\n var y = verts[((start + index) * 2) + 1];\n if (matrix) {\n var nx = (matrix.a * x) + (matrix.c * y) + matrix.tx;\n y = (matrix.b * x) + (matrix.d * y) + matrix.ty;\n x = nx;\n }\n index++;\n uvs.push(x / frame.width, y / frame.height);\n }\n var baseTexture = texture.baseTexture;\n if (frame.width < baseTexture.width\n || frame.height < baseTexture.height) {\n this.adjustUvs(uvs, texture, uvsStart, size);\n }\n };\n /**\n * Modify uvs array according to position of texture region\n * Does not work with rotated or trimmed textures\n *\n * @param {number[]} uvs - array\n * @param {PIXI.Texture} texture - region\n * @param {number} start - starting index for uvs\n * @param {number} size - how many points to adjust\n */\n GraphicsGeometry.prototype.adjustUvs = function (uvs, texture, start, size) {\n var baseTexture = texture.baseTexture;\n var eps = 1e-6;\n var finish = start + (size * 2);\n var frame = texture.frame;\n var scaleX = frame.width / baseTexture.width;\n var scaleY = frame.height / baseTexture.height;\n var offsetX = frame.x / frame.width;\n var offsetY = frame.y / frame.height;\n var minX = Math.floor(uvs[start] + eps);\n var minY = Math.floor(uvs[start + 1] + eps);\n for (var i = start + 2; i < finish; i += 2) {\n minX = Math.min(minX, Math.floor(uvs[i] + eps));\n minY = Math.min(minY, Math.floor(uvs[i + 1] + eps));\n }\n offsetX -= minX;\n offsetY -= minY;\n for (var i = start; i < finish; i += 2) {\n uvs[i] = (uvs[i] + offsetX) * scaleX;\n uvs[i + 1] = (uvs[i + 1] + offsetY) * scaleY;\n }\n };\n /**\n * The maximum number of points to consider an object \"batchable\",\n * able to be batched by the renderer's batch system.\n *\n * @memberof PIXI.GraphicsGeometry\n * @static\n * @member {number} BATCHABLE_SIZE\n * @default 100\n */\n GraphicsGeometry.BATCHABLE_SIZE = 100;\n return GraphicsGeometry;\n}(_pixi_core__WEBPACK_IMPORTED_MODULE_0__.BatchGeometry));\n\n/**\n * Represents the line style for Graphics.\n * @memberof PIXI\n * @class\n * @extends PIXI.FillStyle\n */\nvar LineStyle = /** @class */ (function (_super) {\n __extends(LineStyle, _super);\n function LineStyle() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n /**\n * The width (thickness) of any lines drawn.\n *\n * @member {number}\n * @default 0\n */\n _this.width = 0;\n /**\n * The alignment of any lines drawn (0.5 = middle, 1 = outer, 0 = inner).\n *\n * @member {number}\n * @default 0.5\n */\n _this.alignment = 0.5;\n /**\n * If true the lines will be draw using LINES instead of TRIANGLE_STRIP\n *\n * @member {boolean}\n * @default false\n */\n _this.native = false;\n /**\n * Line cap style.\n *\n * @member {PIXI.LINE_CAP}\n * @default PIXI.LINE_CAP.BUTT\n */\n _this.cap = LINE_CAP.BUTT;\n /**\n * Line join style.\n *\n * @member {PIXI.LINE_JOIN}\n * @default PIXI.LINE_JOIN.MITER\n */\n _this.join = LINE_JOIN.MITER;\n /**\n * Miter limit.\n *\n * @member {number}\n * @default 10\n */\n _this.miterLimit = 10;\n return _this;\n }\n /**\n * Clones the object\n *\n * @return {PIXI.LineStyle}\n */\n LineStyle.prototype.clone = function () {\n var obj = new LineStyle();\n obj.color = this.color;\n obj.alpha = this.alpha;\n obj.texture = this.texture;\n obj.matrix = this.matrix;\n obj.visible = this.visible;\n obj.width = this.width;\n obj.alignment = this.alignment;\n obj.native = this.native;\n obj.cap = this.cap;\n obj.join = this.join;\n obj.miterLimit = this.miterLimit;\n return obj;\n };\n /**\n * Reset the line style to default.\n */\n LineStyle.prototype.reset = function () {\n _super.prototype.reset.call(this);\n // Override default line style color\n this.color = 0x0;\n this.alignment = 0.5;\n this.width = 0;\n this.native = false;\n };\n return LineStyle;\n}(FillStyle));\n\nvar temp = new Float32Array(3);\n// a default shaders map used by graphics..\nvar DEFAULT_SHADERS = {};\n/**\n * The Graphics class contains methods used to draw primitive shapes such as lines, circles and\n * rectangles to the display, and to color and fill them.\n *\n * Note that because Graphics can share a GraphicsGeometry with other instances,\n * it is necessary to call `destroy()` to properly dereference the underlying\n * GraphicsGeometry and avoid a memory leak. Alternatively, keep using the same\n * Graphics instance and call `clear()` between redraws.\n *\n * @class\n * @extends PIXI.Container\n * @memberof PIXI\n */\nvar Graphics = /** @class */ (function (_super) {\n __extends(Graphics, _super);\n /**\n * @param {PIXI.GraphicsGeometry} [geometry=null] - Geometry to use, if omitted\n * will create a new GraphicsGeometry instance.\n */\n function Graphics(geometry) {\n if (geometry === void 0) { geometry = null; }\n var _this = _super.call(this) || this;\n _this._geometry = geometry || new GraphicsGeometry();\n _this._geometry.refCount++;\n /**\n * Represents the vertex and fragment shaders that processes the geometry and runs on the GPU.\n * Can be shared between multiple Graphics objects.\n *\n * @member {PIXI.Shader}\n */\n _this.shader = null;\n /**\n * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g.,\n * blend mode, culling, depth testing, direction of rendering triangles, backface, etc.\n *\n * @member {PIXI.State}\n */\n _this.state = _pixi_core__WEBPACK_IMPORTED_MODULE_0__.State.for2d();\n /**\n * Current fill style\n *\n * @member {PIXI.FillStyle}\n * @protected\n */\n _this._fillStyle = new FillStyle();\n /**\n * Current line style\n *\n * @member {PIXI.LineStyle}\n * @protected\n */\n _this._lineStyle = new LineStyle();\n /**\n * Current shape transform matrix.\n *\n * @member {PIXI.Matrix}\n * @protected\n */\n _this._matrix = null;\n /**\n * Current hole mode is enabled.\n *\n * @member {boolean}\n * @default false\n * @protected\n */\n _this._holeMode = false;\n /**\n * Current path\n *\n * @member {PIXI.Polygon}\n * @protected\n */\n _this.currentPath = null;\n /**\n * When cacheAsBitmap is set to true the graphics object will be rendered as if it was a sprite.\n * This is useful if your graphics element does not change often, as it will speed up the rendering\n * of the object in exchange for taking up texture memory. It is also useful if you need the graphics\n * object to be anti-aliased, because it will be rendered using canvas. This is not recommended if\n * you are constantly redrawing the graphics element.\n *\n * @name cacheAsBitmap\n * @member {boolean}\n * @memberof PIXI.Graphics#\n * @default false\n */\n /**\n * A collections of batches! These can be drawn by the renderer batch system.\n *\n * @protected\n * @member {object[]}\n */\n _this.batches = [];\n /**\n * Update dirty for limiting calculating tints for batches.\n *\n * @protected\n * @member {number}\n * @default -1\n */\n _this.batchTint = -1;\n /**\n * Update dirty for limiting calculating batches.\n *\n * @protected\n * @member {number}\n * @default -1\n */\n _this.batchDirty = -1;\n /**\n * Copy of the object vertex data.\n *\n * @protected\n * @member {Float32Array}\n */\n _this.vertexData = null;\n /**\n * Renderer plugin for batching\n *\n * @member {string}\n * @default 'batch'\n */\n _this.pluginName = 'batch';\n _this._transformID = -1;\n // Set default\n _this.tint = 0xFFFFFF;\n _this.blendMode = _pixi_constants__WEBPACK_IMPORTED_MODULE_3__.BLEND_MODES.NORMAL;\n return _this;\n }\n Object.defineProperty(Graphics.prototype, \"geometry\", {\n /**\n * Includes vertex positions, face indices, normals, colors, UVs, and\n * custom attributes within buffers, reducing the cost of passing all\n * this data to the GPU. Can be shared between multiple Mesh or Graphics objects.\n *\n * @member {PIXI.GraphicsGeometry}\n * @readonly\n */\n get: function () {\n return this._geometry;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Creates a new Graphics object with the same values as this one.\n * Note that only the geometry of the object is cloned, not its transform (position,scale,etc)\n *\n * @return {PIXI.Graphics} A clone of the graphics object\n */\n Graphics.prototype.clone = function () {\n this.finishPoly();\n return new Graphics(this._geometry);\n };\n Object.defineProperty(Graphics.prototype, \"blendMode\", {\n get: function () {\n return this.state.blendMode;\n },\n /**\n * The blend mode to be applied to the graphic shape. Apply a value of\n * `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL;\n * @see PIXI.BLEND_MODES\n */\n set: function (value) {\n this.state.blendMode = value;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Graphics.prototype, \"tint\", {\n /**\n * The tint applied to the graphic shape. This is a hex value. A value of\n * 0xFFFFFF will remove any tint effect.\n *\n * @member {number}\n * @default 0xFFFFFF\n */\n get: function () {\n return this._tint;\n },\n set: function (value) {\n this._tint = value;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Graphics.prototype, \"fill\", {\n /**\n * The current fill style.\n *\n * @member {PIXI.FillStyle}\n * @readonly\n */\n get: function () {\n return this._fillStyle;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Graphics.prototype, \"line\", {\n /**\n * The current line style.\n *\n * @member {PIXI.LineStyle}\n * @readonly\n */\n get: function () {\n return this._lineStyle;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Specifies the line style used for subsequent calls to Graphics methods such as the lineTo()\n * method or the drawCircle() method.\n *\n * @method PIXI.Graphics#lineStyle\n * @param {number} [width=0] - width of the line to draw, will update the objects stored style\n * @param {number} [color=0x0] - color of the line to draw, will update the objects stored style\n * @param {number} [alpha=1] - alpha of the line to draw, will update the objects stored style\n * @param {number} [alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n * @param {boolean} [native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n /**\n * Specifies the line style used for subsequent calls to Graphics methods such as the lineTo()\n * method or the drawCircle() method.\n *\n * @param {object} [options] - Line style options\n * @param {number} [options.width=0] - width of the line to draw, will update the objects stored style\n * @param {number} [options.color=0x0] - color of the line to draw, will update the objects stored style\n * @param {number} [options.alpha=1] - alpha of the line to draw, will update the objects stored style\n * @param {number} [options.alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n * @param {boolean} [options.native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP\n * @param {PIXI.LINE_CAP}[options.cap=PIXI.LINE_CAP.BUTT] - line cap style\n * @param {PIXI.LINE_JOIN}[options.join=PIXI.LINE_JOIN.MITER] - line join style\n * @param {number}[options.miterLimit=10] - miter limit ratio\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n Graphics.prototype.lineStyle = function (options) {\n if (options === void 0) { options = null; }\n // Support non-object params: (width, color, alpha, alignment, native)\n if (typeof options === 'number') {\n // eslint-disable-next-line\n var args = arguments;\n options = {\n width: args[0] || 0,\n color: args[1] || 0x0,\n alpha: args[2] !== undefined ? args[2] : 1,\n alignment: args[3] !== undefined ? args[3] : 0.5,\n native: !!args[4],\n };\n }\n return this.lineTextureStyle(options);\n };\n /**\n * Like line style but support texture for line fill.\n *\n * @param {object} [options] - Collection of options for setting line style.\n * @param {number} [options.width=0] - width of the line to draw, will update the objects stored style\n * @param {PIXI.Texture} [options.texture=PIXI.Texture.WHITE] - Texture to use\n * @param {number} [options.color=0x0] - color of the line to draw, will update the objects stored style.\n * Default 0xFFFFFF if texture present.\n * @param {number} [options.alpha=1] - alpha of the line to draw, will update the objects stored style\n * @param {PIXI.Matrix} [options.matrix=null] - Texture matrix to transform texture\n * @param {number} [options.alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n * @param {boolean} [options.native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP\n * @param {PIXI.LINE_CAP}[options.cap=PIXI.LINE_CAP.BUTT] - line cap style\n * @param {PIXI.LINE_JOIN}[options.join=PIXI.LINE_JOIN.MITER] - line join style\n * @param {number}[options.miterLimit=10] - miter limit ratio\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n Graphics.prototype.lineTextureStyle = function (options) {\n // backward compatibility with params: (width, texture,\n // color, alpha, matrix, alignment, native)\n if (typeof options === 'number') {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.deprecation)('v5.2.0', 'Please use object-based options for Graphics#lineTextureStyle');\n // eslint-disable-next-line\n var _a = arguments, width = _a[0], texture = _a[1], color = _a[2], alpha = _a[3], matrix = _a[4], alignment = _a[5], native = _a[6];\n options = { width: width, texture: texture, color: color, alpha: alpha, matrix: matrix, alignment: alignment, native: native };\n // Remove undefined keys\n Object.keys(options).forEach(function (key) { return options[key] === undefined && delete options[key]; });\n }\n // Apply defaults\n options = Object.assign({\n width: 0,\n texture: _pixi_core__WEBPACK_IMPORTED_MODULE_0__.Texture.WHITE,\n color: (options && options.texture) ? 0xFFFFFF : 0x0,\n alpha: 1,\n matrix: null,\n alignment: 0.5,\n native: false,\n cap: LINE_CAP.BUTT,\n join: LINE_JOIN.MITER,\n miterLimit: 10,\n }, options);\n if (this.currentPath) {\n this.startPoly();\n }\n var visible = options.width > 0 && options.alpha > 0;\n if (!visible) {\n this._lineStyle.reset();\n }\n else {\n if (options.matrix) {\n options.matrix = options.matrix.clone();\n options.matrix.invert();\n }\n Object.assign(this._lineStyle, { visible: visible }, options);\n }\n return this;\n };\n /**\n * Start a polygon object internally\n * @protected\n */\n Graphics.prototype.startPoly = function () {\n if (this.currentPath) {\n var points = this.currentPath.points;\n var len = this.currentPath.points.length;\n if (len > 2) {\n this.drawShape(this.currentPath);\n this.currentPath = new _pixi_math__WEBPACK_IMPORTED_MODULE_1__.Polygon();\n this.currentPath.closeStroke = false;\n this.currentPath.points.push(points[len - 2], points[len - 1]);\n }\n }\n else {\n this.currentPath = new _pixi_math__WEBPACK_IMPORTED_MODULE_1__.Polygon();\n this.currentPath.closeStroke = false;\n }\n };\n /**\n * Finish the polygon object.\n * @protected\n */\n Graphics.prototype.finishPoly = function () {\n if (this.currentPath) {\n if (this.currentPath.points.length > 2) {\n this.drawShape(this.currentPath);\n this.currentPath = null;\n }\n else {\n this.currentPath.points.length = 0;\n }\n }\n };\n /**\n * Moves the current drawing position to x, y.\n *\n * @param {number} x - the X coordinate to move to\n * @param {number} y - the Y coordinate to move to\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n Graphics.prototype.moveTo = function (x, y) {\n this.startPoly();\n this.currentPath.points[0] = x;\n this.currentPath.points[1] = y;\n return this;\n };\n /**\n * Draws a line using the current line style from the current drawing position to (x, y);\n * The current drawing position is then set to (x, y).\n *\n * @param {number} x - the X coordinate to draw to\n * @param {number} y - the Y coordinate to draw to\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n Graphics.prototype.lineTo = function (x, y) {\n if (!this.currentPath) {\n this.moveTo(0, 0);\n }\n // remove duplicates..\n var points = this.currentPath.points;\n var fromX = points[points.length - 2];\n var fromY = points[points.length - 1];\n if (fromX !== x || fromY !== y) {\n points.push(x, y);\n }\n return this;\n };\n /**\n * Initialize the curve\n *\n * @protected\n * @param {number} [x=0]\n * @param {number} [y=0]\n */\n Graphics.prototype._initCurve = function (x, y) {\n if (x === void 0) { x = 0; }\n if (y === void 0) { y = 0; }\n if (this.currentPath) {\n if (this.currentPath.points.length === 0) {\n this.currentPath.points = [x, y];\n }\n }\n else {\n this.moveTo(x, y);\n }\n };\n /**\n * Calculate the points for a quadratic bezier curve and then draws it.\n * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c\n *\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n Graphics.prototype.quadraticCurveTo = function (cpX, cpY, toX, toY) {\n this._initCurve();\n var points = this.currentPath.points;\n if (points.length === 0) {\n this.moveTo(0, 0);\n }\n QuadraticUtils.curveTo(cpX, cpY, toX, toY, points);\n return this;\n };\n /**\n * Calculate the points for a bezier curve and then draws it.\n *\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} cpX2 - Second Control point x\n * @param {number} cpY2 - Second Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n Graphics.prototype.bezierCurveTo = function (cpX, cpY, cpX2, cpY2, toX, toY) {\n this._initCurve();\n BezierUtils.curveTo(cpX, cpY, cpX2, cpY2, toX, toY, this.currentPath.points);\n return this;\n };\n /**\n * The arcTo() method creates an arc/curve between two tangents on the canvas.\n *\n * \"borrowed\" from https://code.google.com/p/fxcanvas/ - thanks google!\n *\n * @param {number} x1 - The x-coordinate of the first tangent point of the arc\n * @param {number} y1 - The y-coordinate of the first tangent point of the arc\n * @param {number} x2 - The x-coordinate of the end of the arc\n * @param {number} y2 - The y-coordinate of the end of the arc\n * @param {number} radius - The radius of the arc\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n Graphics.prototype.arcTo = function (x1, y1, x2, y2, radius) {\n this._initCurve(x1, y1);\n var points = this.currentPath.points;\n var result = ArcUtils.curveTo(x1, y1, x2, y2, radius, points);\n if (result) {\n var cx = result.cx, cy = result.cy, radius_1 = result.radius, startAngle = result.startAngle, endAngle = result.endAngle, anticlockwise = result.anticlockwise;\n this.arc(cx, cy, radius_1, startAngle, endAngle, anticlockwise);\n }\n return this;\n };\n /**\n * The arc method creates an arc/curve (used to create circles, or parts of circles).\n *\n * @param {number} cx - The x-coordinate of the center of the circle\n * @param {number} cy - The y-coordinate of the center of the circle\n * @param {number} radius - The radius of the circle\n * @param {number} startAngle - The starting angle, in radians (0 is at the 3 o'clock position\n * of the arc's circle)\n * @param {number} endAngle - The ending angle, in radians\n * @param {boolean} [anticlockwise=false] - Specifies whether the drawing should be\n * counter-clockwise or clockwise. False is default, and indicates clockwise, while true\n * indicates counter-clockwise.\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n Graphics.prototype.arc = function (cx, cy, radius, startAngle, endAngle, anticlockwise) {\n if (anticlockwise === void 0) { anticlockwise = false; }\n if (startAngle === endAngle) {\n return this;\n }\n if (!anticlockwise && endAngle <= startAngle) {\n endAngle += _pixi_math__WEBPACK_IMPORTED_MODULE_1__.PI_2;\n }\n else if (anticlockwise && startAngle <= endAngle) {\n startAngle += _pixi_math__WEBPACK_IMPORTED_MODULE_1__.PI_2;\n }\n var sweep = endAngle - startAngle;\n if (sweep === 0) {\n return this;\n }\n var startX = cx + (Math.cos(startAngle) * radius);\n var startY = cy + (Math.sin(startAngle) * radius);\n var eps = this._geometry.closePointEps;\n // If the currentPath exists, take its points. Otherwise call `moveTo` to start a path.\n var points = this.currentPath ? this.currentPath.points : null;\n if (points) {\n // TODO: make a better fix.\n // We check how far our start is from the last existing point\n var xDiff = Math.abs(points[points.length - 2] - startX);\n var yDiff = Math.abs(points[points.length - 1] - startY);\n if (xDiff < eps && yDiff < eps) ;\n else {\n points.push(startX, startY);\n }\n }\n else {\n this.moveTo(startX, startY);\n points = this.currentPath.points;\n }\n ArcUtils.arc(startX, startY, cx, cy, radius, startAngle, endAngle, anticlockwise, points);\n return this;\n };\n /**\n * Specifies a simple one-color fill that subsequent calls to other Graphics methods\n * (such as lineTo() or drawCircle()) use when drawing.\n *\n * @param {number} [color=0] - the color of the fill\n * @param {number} [alpha=1] - the alpha of the fill\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n Graphics.prototype.beginFill = function (color, alpha) {\n if (color === void 0) { color = 0; }\n if (alpha === void 0) { alpha = 1; }\n return this.beginTextureFill({ texture: _pixi_core__WEBPACK_IMPORTED_MODULE_0__.Texture.WHITE, color: color, alpha: alpha });\n };\n /**\n * Begin the texture fill\n *\n * @param {object} [options] - Object object.\n * @param {PIXI.Texture} [options.texture=PIXI.Texture.WHITE] - Texture to fill\n * @param {number} [options.color=0xffffff] - Background to fill behind texture\n * @param {number} [options.alpha=1] - Alpha of fill\n * @param {PIXI.Matrix} [options.matrix=null] - Transform matrix\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n Graphics.prototype.beginTextureFill = function (options) {\n // backward compatibility with params: (texture, color, alpha, matrix)\n if (options instanceof _pixi_core__WEBPACK_IMPORTED_MODULE_0__.Texture) {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.deprecation)('v5.2.0', 'Please use object-based options for Graphics#beginTextureFill');\n // eslint-disable-next-line\n var _a = arguments, texture = _a[0], color = _a[1], alpha = _a[2], matrix = _a[3];\n options = { texture: texture, color: color, alpha: alpha, matrix: matrix };\n // Remove undefined keys\n Object.keys(options).forEach(function (key) { return options[key] === undefined && delete options[key]; });\n }\n // Apply defaults\n options = Object.assign({\n texture: _pixi_core__WEBPACK_IMPORTED_MODULE_0__.Texture.WHITE,\n color: 0xFFFFFF,\n alpha: 1,\n matrix: null,\n }, options);\n if (this.currentPath) {\n this.startPoly();\n }\n var visible = options.alpha > 0;\n if (!visible) {\n this._fillStyle.reset();\n }\n else {\n if (options.matrix) {\n options.matrix = options.matrix.clone();\n options.matrix.invert();\n }\n Object.assign(this._fillStyle, { visible: visible }, options);\n }\n return this;\n };\n /**\n * Applies a fill to the lines and shapes that were added since the last call to the beginFill() method.\n *\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n Graphics.prototype.endFill = function () {\n this.finishPoly();\n this._fillStyle.reset();\n return this;\n };\n /**\n * Draws a rectangle shape.\n *\n * @param {number} x - The X coord of the top-left of the rectangle\n * @param {number} y - The Y coord of the top-left of the rectangle\n * @param {number} width - The width of the rectangle\n * @param {number} height - The height of the rectangle\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n Graphics.prototype.drawRect = function (x, y, width, height) {\n return this.drawShape(new _pixi_math__WEBPACK_IMPORTED_MODULE_1__.Rectangle(x, y, width, height));\n };\n /**\n * Draw a rectangle shape with rounded/beveled corners.\n *\n * @param {number} x - The X coord of the top-left of the rectangle\n * @param {number} y - The Y coord of the top-left of the rectangle\n * @param {number} width - The width of the rectangle\n * @param {number} height - The height of the rectangle\n * @param {number} radius - Radius of the rectangle corners\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n Graphics.prototype.drawRoundedRect = function (x, y, width, height, radius) {\n return this.drawShape(new _pixi_math__WEBPACK_IMPORTED_MODULE_1__.RoundedRectangle(x, y, width, height, radius));\n };\n /**\n * Draws a circle.\n *\n * @param {number} x - The X coordinate of the center of the circle\n * @param {number} y - The Y coordinate of the center of the circle\n * @param {number} radius - The radius of the circle\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n Graphics.prototype.drawCircle = function (x, y, radius) {\n return this.drawShape(new _pixi_math__WEBPACK_IMPORTED_MODULE_1__.Circle(x, y, radius));\n };\n /**\n * Draws an ellipse.\n *\n * @param {number} x - The X coordinate of the center of the ellipse\n * @param {number} y - The Y coordinate of the center of the ellipse\n * @param {number} width - The half width of the ellipse\n * @param {number} height - The half height of the ellipse\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n Graphics.prototype.drawEllipse = function (x, y, width, height) {\n return this.drawShape(new _pixi_math__WEBPACK_IMPORTED_MODULE_1__.Ellipse(x, y, width, height));\n };\n /**\n * Draws a polygon using the given path.\n *\n * @param {number[]|PIXI.Point[]|PIXI.Polygon} path - The path data used to construct the polygon.\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n Graphics.prototype.drawPolygon = function () {\n var arguments$1 = arguments;\n\n var path = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n path[_i] = arguments$1[_i];\n }\n var points;\n var closeStroke = true; // !!this._fillStyle;\n var poly = path[0];\n // check if data has points..\n if (poly.points) {\n closeStroke = poly.closeStroke;\n points = poly.points;\n }\n else if (Array.isArray(path[0])) {\n points = path[0];\n }\n else {\n points = path;\n }\n var shape = new _pixi_math__WEBPACK_IMPORTED_MODULE_1__.Polygon(points);\n shape.closeStroke = closeStroke;\n this.drawShape(shape);\n return this;\n };\n /**\n * Draw any shape.\n *\n * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - Shape to draw\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n Graphics.prototype.drawShape = function (shape) {\n if (!this._holeMode) {\n this._geometry.drawShape(shape, this._fillStyle.clone(), this._lineStyle.clone(), this._matrix);\n }\n else {\n this._geometry.drawHole(shape, this._matrix);\n }\n return this;\n };\n /**\n * Draw a star shape with an arbitrary number of points.\n *\n * @param {number} x - Center X position of the star\n * @param {number} y - Center Y position of the star\n * @param {number} points - The number of points of the star, must be > 1\n * @param {number} radius - The outer radius of the star\n * @param {number} [innerRadius] - The inner radius between points, default half `radius`\n * @param {number} [rotation=0] - The rotation of the star in radians, where 0 is vertical\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n Graphics.prototype.drawStar = function (x, y, points, radius, innerRadius, rotation) {\n if (rotation === void 0) { rotation = 0; }\n return this.drawPolygon(new Star(x, y, points, radius, innerRadius, rotation));\n };\n /**\n * Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings.\n *\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n Graphics.prototype.clear = function () {\n this._geometry.clear();\n this._lineStyle.reset();\n this._fillStyle.reset();\n this._boundsID++;\n this._matrix = null;\n this._holeMode = false;\n this.currentPath = null;\n return this;\n };\n /**\n * True if graphics consists of one rectangle, and thus, can be drawn like a Sprite and\n * masked with gl.scissor.\n *\n * @returns {boolean} True if only 1 rect.\n */\n Graphics.prototype.isFastRect = function () {\n var data = this._geometry.graphicsData;\n return data.length === 1\n && data[0].shape.type === _pixi_math__WEBPACK_IMPORTED_MODULE_1__.SHAPES.RECT\n && !(data[0].lineStyle.visible && data[0].lineStyle.width);\n };\n /**\n * Renders the object using the WebGL renderer\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n Graphics.prototype._render = function (renderer) {\n this.finishPoly();\n var geometry = this._geometry;\n var hasuint32 = renderer.context.supports.uint32Indices;\n // batch part..\n // batch it!\n geometry.updateBatches(hasuint32);\n if (geometry.batchable) {\n if (this.batchDirty !== geometry.batchDirty) {\n this._populateBatches();\n }\n this._renderBatched(renderer);\n }\n else {\n // no batching...\n renderer.batch.flush();\n this._renderDirect(renderer);\n }\n };\n /**\n * Populating batches for rendering\n *\n * @protected\n */\n Graphics.prototype._populateBatches = function () {\n var geometry = this._geometry;\n var blendMode = this.blendMode;\n var len = geometry.batches.length;\n this.batchTint = -1;\n this._transformID = -1;\n this.batchDirty = geometry.batchDirty;\n this.batches.length = len;\n this.vertexData = new Float32Array(geometry.points);\n for (var i = 0; i < len; i++) {\n var gI = geometry.batches[i];\n var color = gI.style.color;\n var vertexData = new Float32Array(this.vertexData.buffer, gI.attribStart * 4 * 2, gI.attribSize * 2);\n var uvs = new Float32Array(geometry.uvsFloat32.buffer, gI.attribStart * 4 * 2, gI.attribSize * 2);\n var indices = new Uint16Array(geometry.indicesUint16.buffer, gI.start * 2, gI.size);\n var batch = {\n vertexData: vertexData,\n blendMode: blendMode,\n indices: indices,\n uvs: uvs,\n _batchRGB: (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.hex2rgb)(color),\n _tintRGB: color,\n _texture: gI.style.texture,\n alpha: gI.style.alpha,\n worldAlpha: 1\n };\n this.batches[i] = batch;\n }\n };\n /**\n * Renders the batches using the BathedRenderer plugin\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n Graphics.prototype._renderBatched = function (renderer) {\n if (!this.batches.length) {\n return;\n }\n renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]);\n this.calculateVertices();\n this.calculateTints();\n for (var i = 0, l = this.batches.length; i < l; i++) {\n var batch = this.batches[i];\n batch.worldAlpha = this.worldAlpha * batch.alpha;\n renderer.plugins[this.pluginName].render(batch);\n }\n };\n /**\n * Renders the graphics direct\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n Graphics.prototype._renderDirect = function (renderer) {\n var shader = this._resolveDirectShader(renderer);\n var geometry = this._geometry;\n var tint = this.tint;\n var worldAlpha = this.worldAlpha;\n var uniforms = shader.uniforms;\n var drawCalls = geometry.drawCalls;\n // lets set the transfomr\n uniforms.translationMatrix = this.transform.worldTransform;\n // and then lets set the tint..\n uniforms.tint[0] = (((tint >> 16) & 0xFF) / 255) * worldAlpha;\n uniforms.tint[1] = (((tint >> 8) & 0xFF) / 255) * worldAlpha;\n uniforms.tint[2] = ((tint & 0xFF) / 255) * worldAlpha;\n uniforms.tint[3] = worldAlpha;\n // the first draw call, we can set the uniforms of the shader directly here.\n // this means that we can tack advantage of the sync function of pixi!\n // bind and sync uniforms..\n // there is a way to optimise this..\n renderer.shader.bind(shader);\n renderer.geometry.bind(geometry, shader);\n // set state..\n renderer.state.set(this.state);\n // then render the rest of them...\n for (var i = 0, l = drawCalls.length; i < l; i++) {\n this._renderDrawCallDirect(renderer, geometry.drawCalls[i]);\n }\n };\n /**\n * Renders specific DrawCall\n *\n * @param {PIXI.Renderer} renderer\n * @param {PIXI.BatchDrawCall} drawCall\n */\n Graphics.prototype._renderDrawCallDirect = function (renderer, drawCall) {\n var texArray = drawCall.texArray, type = drawCall.type, size = drawCall.size, start = drawCall.start;\n var groupTextureCount = texArray.count;\n for (var j = 0; j < groupTextureCount; j++) {\n renderer.texture.bind(texArray.elements[j], j);\n }\n renderer.geometry.draw(type, size, start);\n };\n /**\n * Resolves shader for direct rendering\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n Graphics.prototype._resolveDirectShader = function (renderer) {\n var shader = this.shader;\n var pluginName = this.pluginName;\n if (!shader) {\n // if there is no shader here, we can use the default shader.\n // and that only gets created if we actually need it..\n // but may be more than one plugins for graphics\n if (!DEFAULT_SHADERS[pluginName]) {\n var MAX_TEXTURES = renderer.plugins.batch.MAX_TEXTURES;\n var sampleValues = new Int32Array(MAX_TEXTURES);\n for (var i = 0; i < MAX_TEXTURES; i++) {\n sampleValues[i] = i;\n }\n var uniforms = {\n tint: new Float32Array([1, 1, 1, 1]),\n translationMatrix: new _pixi_math__WEBPACK_IMPORTED_MODULE_1__.Matrix(),\n default: _pixi_core__WEBPACK_IMPORTED_MODULE_0__.UniformGroup.from({ uSamplers: sampleValues }, true),\n };\n var program = renderer.plugins[pluginName]._shader.program;\n DEFAULT_SHADERS[pluginName] = new _pixi_core__WEBPACK_IMPORTED_MODULE_0__.Shader(program, uniforms);\n }\n shader = DEFAULT_SHADERS[pluginName];\n }\n return shader;\n };\n /**\n * Retrieves the bounds of the graphic shape as a rectangle object\n *\n * @protected\n */\n Graphics.prototype._calculateBounds = function () {\n this.finishPoly();\n var geometry = this._geometry;\n // skipping when graphics is empty, like a container\n if (!geometry.graphicsData.length) {\n return;\n }\n var _a = geometry.bounds, minX = _a.minX, minY = _a.minY, maxX = _a.maxX, maxY = _a.maxY;\n this._bounds.addFrame(this.transform, minX, minY, maxX, maxY);\n };\n /**\n * Tests if a point is inside this graphics object\n *\n * @param {PIXI.IPointData} point - the point to test\n * @return {boolean} the result of the test\n */\n Graphics.prototype.containsPoint = function (point) {\n this.worldTransform.applyInverse(point, Graphics._TEMP_POINT);\n return this._geometry.containsPoint(Graphics._TEMP_POINT);\n };\n /**\n * Recalcuate the tint by applying tin to batches using Graphics tint.\n * @protected\n */\n Graphics.prototype.calculateTints = function () {\n if (this.batchTint !== this.tint) {\n this.batchTint = this.tint;\n var tintRGB = (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.hex2rgb)(this.tint, temp);\n for (var i = 0; i < this.batches.length; i++) {\n var batch = this.batches[i];\n var batchTint = batch._batchRGB;\n var r = (tintRGB[0] * batchTint[0]) * 255;\n var g = (tintRGB[1] * batchTint[1]) * 255;\n var b = (tintRGB[2] * batchTint[2]) * 255;\n // TODO Ivan, can this be done in one go?\n var color = (r << 16) + (g << 8) + (b | 0);\n batch._tintRGB = (color >> 16)\n + (color & 0xff00)\n + ((color & 0xff) << 16);\n }\n }\n };\n /**\n * If there's a transform update or a change to the shape of the\n * geometry, recaculate the vertices.\n * @protected\n */\n Graphics.prototype.calculateVertices = function () {\n var wtID = this.transform._worldID;\n if (this._transformID === wtID) {\n return;\n }\n this._transformID = wtID;\n var wt = this.transform.worldTransform;\n var a = wt.a;\n var b = wt.b;\n var c = wt.c;\n var d = wt.d;\n var tx = wt.tx;\n var ty = wt.ty;\n var data = this._geometry.points; // batch.vertexDataOriginal;\n var vertexData = this.vertexData;\n var count = 0;\n for (var i = 0; i < data.length; i += 2) {\n var x = data[i];\n var y = data[i + 1];\n vertexData[count++] = (a * x) + (c * y) + tx;\n vertexData[count++] = (d * y) + (b * x) + ty;\n }\n };\n /**\n * Closes the current path.\n *\n * @return {PIXI.Graphics} Returns itself.\n */\n Graphics.prototype.closePath = function () {\n var currentPath = this.currentPath;\n if (currentPath) {\n // we don't need to add extra point in the end because buildLine will take care of that\n currentPath.closeStroke = true;\n }\n return this;\n };\n /**\n * Apply a matrix to the positional data.\n *\n * @param {PIXI.Matrix} matrix - Matrix to use for transform current shape.\n * @return {PIXI.Graphics} Returns itself.\n */\n Graphics.prototype.setMatrix = function (matrix) {\n this._matrix = matrix;\n return this;\n };\n /**\n * Begin adding holes to the last draw shape\n * IMPORTANT: holes must be fully inside a shape to work\n * Also weirdness ensues if holes overlap!\n * Ellipses, Circles, Rectangles and Rounded Rectangles cannot be holes or host for holes in CanvasRenderer,\n * please use `moveTo` `lineTo`, `quadraticCurveTo` if you rely on pixi-legacy bundle.\n * @return {PIXI.Graphics} Returns itself.\n */\n Graphics.prototype.beginHole = function () {\n this.finishPoly();\n this._holeMode = true;\n return this;\n };\n /**\n * End adding holes to the last draw shape\n * @return {PIXI.Graphics} Returns itself.\n */\n Graphics.prototype.endHole = function () {\n this.finishPoly();\n this._holeMode = false;\n return this;\n };\n /**\n * Destroys the Graphics object.\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all\n * options have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have\n * their destroy method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the texture of the child sprite\n * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the base texture of the child sprite\n */\n Graphics.prototype.destroy = function (options) {\n this._geometry.refCount--;\n if (this._geometry.refCount === 0) {\n this._geometry.dispose();\n }\n this._matrix = null;\n this.currentPath = null;\n this._lineStyle.destroy();\n this._lineStyle = null;\n this._fillStyle.destroy();\n this._fillStyle = null;\n this._geometry = null;\n this.shader = null;\n this.vertexData = null;\n this.batches.length = 0;\n this.batches = null;\n _super.prototype.destroy.call(this, options);\n };\n /**\n * Temporary point to use for containsPoint\n *\n * @static\n * @private\n * @member {PIXI.Point}\n */\n Graphics._TEMP_POINT = new _pixi_math__WEBPACK_IMPORTED_MODULE_1__.Point();\n return Graphics;\n}(_pixi_display__WEBPACK_IMPORTED_MODULE_4__.Container));\n\n\n//# sourceMappingURL=graphics.es.js.map\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/@pixi/graphics/lib/graphics.es.js?"); /***/ }), /***/ "./node_modules/@pixi/interaction/lib/interaction.es.js": /*!**************************************************************!*\ !*** ./node_modules/@pixi/interaction/lib/interaction.es.js ***! \**************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"InteractionData\": () => (/* binding */ InteractionData),\n/* harmony export */ \"InteractionEvent\": () => (/* binding */ InteractionEvent),\n/* harmony export */ \"InteractionManager\": () => (/* binding */ InteractionManager),\n/* harmony export */ \"InteractionTrackingData\": () => (/* binding */ InteractionTrackingData),\n/* harmony export */ \"interactiveTarget\": () => (/* binding */ interactiveTarget)\n/* harmony export */ });\n/* harmony import */ var _pixi_math__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @pixi/math */ \"./node_modules/@pixi/math/lib/math.es.js\");\n/* harmony import */ var _pixi_ticker__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @pixi/ticker */ \"./node_modules/@pixi/ticker/lib/ticker.es.js\");\n/* harmony import */ var _pixi_display__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @pixi/display */ \"./node_modules/@pixi/display/lib/display.es.js\");\n/* harmony import */ var _pixi_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @pixi/utils */ \"./node_modules/@pixi/utils/lib/utils.es.js\");\n/*!\n * @pixi/interaction - v5.3.11\n * Compiled Mon, 01 Nov 2021 16:10:12 UTC\n *\n * @pixi/interaction is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n\n\n\n\n\n/**\n * Holds all information related to an Interaction event\n *\n * @class\n * @memberof PIXI\n */\nvar InteractionData = /** @class */ (function () {\n function InteractionData() {\n this.pressure = 0;\n this.rotationAngle = 0;\n this.twist = 0;\n this.tangentialPressure = 0;\n /**\n * This point stores the global coords of where the touch/mouse event happened\n *\n * @member {PIXI.Point}\n */\n this.global = new _pixi_math__WEBPACK_IMPORTED_MODULE_0__.Point();\n /**\n * The target Sprite that was interacted with\n *\n * @member {PIXI.Sprite}\n */\n this.target = null;\n /**\n * When passed to an event handler, this will be the original DOM Event that was captured\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent\n * @see https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent\n * @member {MouseEvent|TouchEvent|PointerEvent}\n */\n this.originalEvent = null;\n /**\n * Unique identifier for this interaction\n *\n * @member {number}\n */\n this.identifier = null;\n /**\n * Indicates whether or not the pointer device that created the event is the primary pointer.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/isPrimary\n * @type {Boolean}\n */\n this.isPrimary = false;\n /**\n * Indicates which button was pressed on the mouse or pointer device to trigger the event.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button\n * @type {number}\n */\n this.button = 0;\n /**\n * Indicates which buttons are pressed on the mouse or pointer device when the event is triggered.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons\n * @type {number}\n */\n this.buttons = 0;\n /**\n * The width of the pointer's contact along the x-axis, measured in CSS pixels.\n * radiusX of TouchEvents will be represented by this value.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/width\n * @type {number}\n */\n this.width = 0;\n /**\n * The height of the pointer's contact along the y-axis, measured in CSS pixels.\n * radiusY of TouchEvents will be represented by this value.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/height\n * @type {number}\n */\n this.height = 0;\n /**\n * The angle, in degrees, between the pointer device and the screen.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltX\n * @type {number}\n */\n this.tiltX = 0;\n /**\n * The angle, in degrees, between the pointer device and the screen.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltY\n * @type {number}\n */\n this.tiltY = 0;\n /**\n * The type of pointer that triggered the event.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerType\n * @type {string}\n */\n this.pointerType = null;\n /**\n * Pressure applied by the pointing device during the event. A Touch's force property\n * will be represented by this value.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pressure\n * @type {number}\n */\n this.pressure = 0;\n /**\n * From TouchEvents (not PointerEvents triggered by touches), the rotationAngle of the Touch.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Touch/rotationAngle\n * @type {number}\n */\n this.rotationAngle = 0;\n /**\n * Twist of a stylus pointer.\n * @see https://w3c.github.io/pointerevents/#pointerevent-interface\n * @type {number}\n */\n this.twist = 0;\n /**\n * Barrel pressure on a stylus pointer.\n * @see https://w3c.github.io/pointerevents/#pointerevent-interface\n * @type {number}\n */\n this.tangentialPressure = 0;\n }\n Object.defineProperty(InteractionData.prototype, \"pointerId\", {\n /**\n * The unique identifier of the pointer. It will be the same as `identifier`.\n * @readonly\n * @member {number}\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerId\n */\n get: function () {\n return this.identifier;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * This will return the local coordinates of the specified displayObject for this InteractionData\n *\n * @param {PIXI.DisplayObject} displayObject - The DisplayObject that you would like the local\n * coords off\n * @param {PIXI.Point} [point] - A Point object in which to store the value, optional (otherwise\n * will create a new point)\n * @param {PIXI.Point} [globalPos] - A Point object containing your custom global coords, optional\n * (otherwise will use the current global coords)\n * @return {PIXI.Point} A point containing the coordinates of the InteractionData position relative\n * to the DisplayObject\n */\n InteractionData.prototype.getLocalPosition = function (displayObject, point, globalPos) {\n return displayObject.worldTransform.applyInverse(globalPos || this.global, point);\n };\n /**\n * Copies properties from normalized event data.\n *\n * @param {Touch|MouseEvent|PointerEvent} event - The normalized event data\n */\n InteractionData.prototype.copyEvent = function (event) {\n // isPrimary should only change on touchstart/pointerdown, so we don't want to overwrite\n // it with \"false\" on later events when our shim for it on touch events might not be\n // accurate\n if ('isPrimary' in event && event.isPrimary) {\n this.isPrimary = true;\n }\n this.button = 'button' in event && event.button;\n // event.buttons is not available in all browsers (ie. Safari), but it does have a non-standard\n // event.which property instead, which conveys the same information.\n var buttons = 'buttons' in event && event.buttons;\n this.buttons = Number.isInteger(buttons) ? buttons : 'which' in event && event.which;\n this.width = 'width' in event && event.width;\n this.height = 'height' in event && event.height;\n this.tiltX = 'tiltX' in event && event.tiltX;\n this.tiltY = 'tiltY' in event && event.tiltY;\n this.pointerType = 'pointerType' in event && event.pointerType;\n this.pressure = 'pressure' in event && event.pressure;\n this.rotationAngle = 'rotationAngle' in event && event.rotationAngle;\n this.twist = ('twist' in event && event.twist) || 0;\n this.tangentialPressure = ('tangentialPressure' in event && event.tangentialPressure) || 0;\n };\n /**\n * Resets the data for pooling.\n */\n InteractionData.prototype.reset = function () {\n // isPrimary is the only property that we really need to reset - everything else is\n // guaranteed to be overwritten\n this.isPrimary = false;\n };\n return InteractionData;\n}());\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } };\r\n return extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\n\n/**\n * Event class that mimics native DOM events.\n *\n * @class\n * @memberof PIXI\n */\nvar InteractionEvent = /** @class */ (function () {\n function InteractionEvent() {\n /**\n * Whether this event will continue propagating in the tree.\n *\n * Remaining events for the {@link stopsPropagatingAt} object\n * will still be dispatched.\n *\n * @member {boolean}\n */\n this.stopped = false;\n /**\n * At which object this event stops propagating.\n *\n * @private\n * @member {PIXI.DisplayObject}\n */\n this.stopsPropagatingAt = null;\n /**\n * Whether we already reached the element we want to\n * stop propagating at. This is important for delayed events,\n * where we start over deeper in the tree again.\n *\n * @private\n * @member {boolean}\n */\n this.stopPropagationHint = false;\n /**\n * The object which caused this event to be dispatched.\n * For listener callback see {@link PIXI.InteractionEvent.currentTarget}.\n *\n * @member {PIXI.DisplayObject}\n */\n this.target = null;\n /**\n * The object whose event listener’s callback is currently being invoked.\n *\n * @member {PIXI.DisplayObject}\n */\n this.currentTarget = null;\n /**\n * Type of the event\n *\n * @member {string}\n */\n this.type = null;\n /**\n * InteractionData related to this event\n *\n * @member {PIXI.InteractionData}\n */\n this.data = null;\n }\n /**\n * Prevents event from reaching any objects other than the current object.\n *\n */\n InteractionEvent.prototype.stopPropagation = function () {\n this.stopped = true;\n this.stopPropagationHint = true;\n this.stopsPropagatingAt = this.currentTarget;\n };\n /**\n * Resets the event.\n */\n InteractionEvent.prototype.reset = function () {\n this.stopped = false;\n this.stopsPropagatingAt = null;\n this.stopPropagationHint = false;\n this.currentTarget = null;\n this.target = null;\n };\n return InteractionEvent;\n}());\n\n/**\n * DisplayObjects with the {@link PIXI.interactiveTarget} mixin use this class to track interactions\n *\n * @class\n * @private\n * @memberof PIXI\n */\nvar InteractionTrackingData = /** @class */ (function () {\n /**\n * @param {number} pointerId - Unique pointer id of the event\n * @private\n */\n function InteractionTrackingData(pointerId) {\n this._pointerId = pointerId;\n this._flags = InteractionTrackingData.FLAGS.NONE;\n }\n /**\n *\n * @private\n * @param {number} flag - The interaction flag to set\n * @param {boolean} yn - Should the flag be set or unset\n */\n InteractionTrackingData.prototype._doSet = function (flag, yn) {\n if (yn) {\n this._flags = this._flags | flag;\n }\n else {\n this._flags = this._flags & (~flag);\n }\n };\n Object.defineProperty(InteractionTrackingData.prototype, \"pointerId\", {\n /**\n * Unique pointer id of the event\n *\n * @readonly\n * @private\n * @member {number}\n */\n get: function () {\n return this._pointerId;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(InteractionTrackingData.prototype, \"flags\", {\n /**\n * State of the tracking data, expressed as bit flags\n *\n * @private\n * @member {number}\n */\n get: function () {\n return this._flags;\n },\n set: function (flags) {\n this._flags = flags;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(InteractionTrackingData.prototype, \"none\", {\n /**\n * Is the tracked event inactive (not over or down)?\n *\n * @private\n * @member {number}\n */\n get: function () {\n return this._flags === InteractionTrackingData.FLAGS.NONE;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(InteractionTrackingData.prototype, \"over\", {\n /**\n * Is the tracked event over the DisplayObject?\n *\n * @private\n * @member {boolean}\n */\n get: function () {\n return (this._flags & InteractionTrackingData.FLAGS.OVER) !== 0;\n },\n set: function (yn) {\n this._doSet(InteractionTrackingData.FLAGS.OVER, yn);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(InteractionTrackingData.prototype, \"rightDown\", {\n /**\n * Did the right mouse button come down in the DisplayObject?\n *\n * @private\n * @member {boolean}\n */\n get: function () {\n return (this._flags & InteractionTrackingData.FLAGS.RIGHT_DOWN) !== 0;\n },\n set: function (yn) {\n this._doSet(InteractionTrackingData.FLAGS.RIGHT_DOWN, yn);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(InteractionTrackingData.prototype, \"leftDown\", {\n /**\n * Did the left mouse button come down in the DisplayObject?\n *\n * @private\n * @member {boolean}\n */\n get: function () {\n return (this._flags & InteractionTrackingData.FLAGS.LEFT_DOWN) !== 0;\n },\n set: function (yn) {\n this._doSet(InteractionTrackingData.FLAGS.LEFT_DOWN, yn);\n },\n enumerable: false,\n configurable: true\n });\n InteractionTrackingData.FLAGS = Object.freeze({\n NONE: 0,\n OVER: 1 << 0,\n LEFT_DOWN: 1 << 1,\n RIGHT_DOWN: 1 << 2,\n });\n return InteractionTrackingData;\n}());\n\n/**\n * Strategy how to search through stage tree for interactive objects\n *\n * @private\n * @class\n * @memberof PIXI\n */\nvar TreeSearch = /** @class */ (function () {\n function TreeSearch() {\n this._tempPoint = new _pixi_math__WEBPACK_IMPORTED_MODULE_0__.Point();\n }\n /**\n * Recursive implementation for findHit\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - event containing the point that\n * is tested for collision\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject\n * that will be hit test (recursively crawls its children)\n * @param {Function} [func] - the function that will be called on each interactive object. The\n * interactionEvent, displayObject and hit will be passed to the function\n * @param {boolean} [hitTest] - this indicates if the objects inside should be hit test against the point\n * @param {boolean} [interactive] - Whether the displayObject is interactive\n * @return {boolean} returns true if the displayObject hit the point\n */\n TreeSearch.prototype.recursiveFindHit = function (interactionEvent, displayObject, func, hitTest, interactive) {\n if (!displayObject || !displayObject.visible) {\n return false;\n }\n var point = interactionEvent.data.global;\n // Took a little while to rework this function correctly! But now it is done and nice and optimized! ^_^\n //\n // This function will now loop through all objects and then only hit test the objects it HAS\n // to, not all of them. MUCH faster..\n // An object will be hit test if the following is true:\n //\n // 1: It is interactive.\n // 2: It belongs to a parent that is interactive AND one of the parents children have not already been hit.\n //\n // As another little optimization once an interactive object has been hit we can carry on\n // through the scenegraph, but we know that there will be no more hits! So we can avoid extra hit tests\n // A final optimization is that an object is not hit test directly if a child has already been hit.\n interactive = displayObject.interactive || interactive;\n var hit = false;\n var interactiveParent = interactive;\n // Flag here can set to false if the event is outside the parents hitArea or mask\n var hitTestChildren = true;\n // If there is a hitArea, no need to test against anything else if the pointer is not within the hitArea\n // There is also no longer a need to hitTest children.\n if (displayObject.hitArea) {\n if (hitTest) {\n displayObject.worldTransform.applyInverse(point, this._tempPoint);\n if (!displayObject.hitArea.contains(this._tempPoint.x, this._tempPoint.y)) {\n hitTest = false;\n hitTestChildren = false;\n }\n else {\n hit = true;\n }\n }\n interactiveParent = false;\n }\n // If there is a mask, no need to hitTest against anything else if the pointer is not within the mask.\n // We still want to hitTestChildren, however, to ensure a mouseout can still be generated.\n // https://github.com/pixijs/pixi.js/issues/5135\n else if (displayObject._mask) {\n if (hitTest) {\n if (!(displayObject._mask.containsPoint && displayObject._mask.containsPoint(point))) {\n hitTest = false;\n }\n }\n }\n // ** FREE TIP **! If an object is not interactive or has no buttons in it\n // (such as a game scene!) set interactiveChildren to false for that displayObject.\n // This will allow PixiJS to completely ignore and bypass checking the displayObjects children.\n if (hitTestChildren && displayObject.interactiveChildren && displayObject.children) {\n var children = displayObject.children;\n for (var i = children.length - 1; i >= 0; i--) {\n var child = children[i];\n // time to get recursive.. if this function will return if something is hit..\n var childHit = this.recursiveFindHit(interactionEvent, child, func, hitTest, interactiveParent);\n if (childHit) {\n // its a good idea to check if a child has lost its parent.\n // this means it has been removed whilst looping so its best\n if (!child.parent) {\n continue;\n }\n // we no longer need to hit test any more objects in this container as we we\n // now know the parent has been hit\n interactiveParent = false;\n // If the child is interactive , that means that the object hit was actually\n // interactive and not just the child of an interactive object.\n // This means we no longer need to hit test anything else. We still need to run\n // through all objects, but we don't need to perform any hit tests.\n if (childHit) {\n if (interactionEvent.target) {\n hitTest = false;\n }\n hit = true;\n }\n }\n }\n }\n // no point running this if the item is not interactive or does not have an interactive parent.\n if (interactive) {\n // if we are hit testing (as in we have no hit any objects yet)\n // We also don't need to worry about hit testing if once of the displayObjects children\n // has already been hit - but only if it was interactive, otherwise we need to keep\n // looking for an interactive child, just in case we hit one\n if (hitTest && !interactionEvent.target) {\n // already tested against hitArea if it is defined\n if (!displayObject.hitArea && displayObject.containsPoint) {\n if (displayObject.containsPoint(point)) {\n hit = true;\n }\n }\n }\n if (displayObject.interactive) {\n if (hit && !interactionEvent.target) {\n interactionEvent.target = displayObject;\n }\n if (func) {\n func(interactionEvent, displayObject, !!hit);\n }\n }\n }\n return hit;\n };\n /**\n * This function is provides a neat way of crawling through the scene graph and running a\n * specified function on all interactive objects it finds. It will also take care of hit\n * testing the interactive objects and passes the hit across in the function.\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - event containing the point that\n * is tested for collision\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject\n * that will be hit test (recursively crawls its children)\n * @param {Function} [func] - the function that will be called on each interactive object. The\n * interactionEvent, displayObject and hit will be passed to the function\n * @param {boolean} [hitTest] - this indicates if the objects inside should be hit test against the point\n * @return {boolean} returns true if the displayObject hit the point\n */\n TreeSearch.prototype.findHit = function (interactionEvent, displayObject, func, hitTest) {\n this.recursiveFindHit(interactionEvent, displayObject, func, hitTest, false);\n };\n return TreeSearch;\n}());\n\n/**\n * Interface for classes that represent a hit area.\n *\n * It is implemented by the following classes:\n * - {@link PIXI.Circle}\n * - {@link PIXI.Ellipse}\n * - {@link PIXI.Polygon}\n * - {@link PIXI.RoundedRectangle}\n *\n * @interface IHitArea\n * @memberof PIXI\n */\n/**\n * Checks whether the x and y coordinates given are contained within this area\n *\n * @method\n * @name contains\n * @memberof PIXI.IHitArea#\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coordinates are within this area\n */\n/**\n * Default property values of interactive objects\n * Used by {@link PIXI.InteractionManager} to automatically give all DisplayObjects these properties\n *\n * @private\n * @name interactiveTarget\n * @type {Object}\n * @memberof PIXI\n * @example\n * function MyObject() {}\n *\n * Object.assign(\n * DisplayObject.prototype,\n * PIXI.interactiveTarget\n * );\n */\nvar interactiveTarget = {\n /**\n * Enable interaction events for the DisplayObject. Touch, pointer and mouse\n * events will not be emitted unless `interactive` is set to `true`.\n *\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.interactive = true;\n * sprite.on('tap', (event) => {\n * //handle event\n * });\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n */\n interactive: false,\n /**\n * Determines if the children to the displayObject can be clicked/touched\n * Setting this to false allows PixiJS to bypass a recursive `hitTest` function\n *\n * @member {boolean}\n * @memberof PIXI.Container#\n */\n interactiveChildren: true,\n /**\n * Interaction shape. Children will be hit first, then this shape will be checked.\n * Setting this will cause this shape to be checked in hit tests rather than the displayObject's bounds.\n *\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.interactive = true;\n * sprite.hitArea = new PIXI.Rectangle(0, 0, 100, 100);\n * @member {PIXI.IHitArea}\n * @memberof PIXI.DisplayObject#\n */\n hitArea: null,\n /**\n * If enabled, the mouse cursor use the pointer behavior when hovered over the displayObject if it is interactive\n * Setting this changes the 'cursor' property to `'pointer'`.\n *\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.interactive = true;\n * sprite.buttonMode = true;\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n */\n get buttonMode() {\n return this.cursor === 'pointer';\n },\n set buttonMode(value) {\n if (value) {\n this.cursor = 'pointer';\n }\n else if (this.cursor === 'pointer') {\n this.cursor = null;\n }\n },\n /**\n * This defines what cursor mode is used when the mouse cursor\n * is hovered over the displayObject.\n *\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.interactive = true;\n * sprite.cursor = 'wait';\n * @see https://developer.mozilla.org/en/docs/Web/CSS/cursor\n *\n * @member {string}\n * @memberof PIXI.DisplayObject#\n */\n cursor: null,\n /**\n * Internal set of all active pointers, by identifier\n *\n * @member {Map}\n * @memberof PIXI.DisplayObject#\n * @private\n */\n get trackedPointers() {\n if (this._trackedPointers === undefined)\n { this._trackedPointers = {}; }\n return this._trackedPointers;\n },\n /**\n * Map of all tracked pointers, by identifier. Use trackedPointers to access.\n *\n * @private\n * @type {Map}\n */\n _trackedPointers: undefined,\n};\n\n// Mix interactiveTarget into DisplayObject.prototype,\n// after deprecation has been handled\n_pixi_display__WEBPACK_IMPORTED_MODULE_2__.DisplayObject.mixin(interactiveTarget);\nvar MOUSE_POINTER_ID = 1;\n// helpers for hitTest() - only used inside hitTest()\nvar hitTestEvent = {\n target: null,\n data: {\n global: null,\n },\n};\n/**\n * The interaction manager deals with mouse, touch and pointer events.\n *\n * Any DisplayObject can be interactive if its `interactive` property is set to true.\n *\n * This manager also supports multitouch.\n *\n * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction`\n *\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n */\nvar InteractionManager = /** @class */ (function (_super) {\n __extends(InteractionManager, _super);\n /**\n * @param {PIXI.CanvasRenderer|PIXI.Renderer} renderer - A reference to the current renderer\n * @param {object} [options] - The options for the manager.\n * @param {boolean} [options.autoPreventDefault=true] - Should the manager automatically prevent default browser actions.\n * @param {number} [options.interactionFrequency=10] - Maximum requency (ms) at pointer over/out states will be checked.\n * @param {number} [options.useSystemTicker=true] - Whether to add {@link tickerUpdate} to {@link PIXI.Ticker.system}.\n */\n function InteractionManager(renderer, options) {\n var _this = _super.call(this) || this;\n options = options || {};\n /**\n * The renderer this interaction manager works for.\n *\n * @member {PIXI.AbstractRenderer}\n */\n _this.renderer = renderer;\n /**\n * Should default browser actions automatically be prevented.\n * Does not apply to pointer events for backwards compatibility\n * preventDefault on pointer events stops mouse events from firing\n * Thus, for every pointer event, there will always be either a mouse of touch event alongside it.\n *\n * @member {boolean}\n * @default true\n */\n _this.autoPreventDefault = options.autoPreventDefault !== undefined ? options.autoPreventDefault : true;\n /**\n * Maximum requency in milliseconds at which pointer over/out states will be checked by {@link tickerUpdate}.\n *\n * @member {number}\n * @default 10\n */\n _this.interactionFrequency = options.interactionFrequency || 10;\n /**\n * The mouse data\n *\n * @member {PIXI.InteractionData}\n */\n _this.mouse = new InteractionData();\n _this.mouse.identifier = MOUSE_POINTER_ID;\n // setting the mouse to start off far off screen will mean that mouse over does\n // not get called before we even move the mouse.\n _this.mouse.global.set(-999999);\n /**\n * Actively tracked InteractionData\n *\n * @private\n * @member {Object.}\n */\n _this.activeInteractionData = {};\n _this.activeInteractionData[MOUSE_POINTER_ID] = _this.mouse;\n /**\n * Pool of unused InteractionData\n *\n * @private\n * @member {PIXI.InteractionData[]}\n */\n _this.interactionDataPool = [];\n /**\n * An event data object to handle all the event tracking/dispatching\n *\n * @member {object}\n */\n _this.eventData = new InteractionEvent();\n /**\n * The DOM element to bind to.\n *\n * @protected\n * @member {HTMLElement}\n */\n _this.interactionDOMElement = null;\n /**\n * This property determines if mousemove and touchmove events are fired only when the cursor\n * is over the object.\n * Setting to true will make things work more in line with how the DOM version works.\n * Setting to false can make things easier for things like dragging\n * It is currently set to false as this is how PixiJS used to work. This will be set to true in\n * future versions of pixi.\n *\n * @member {boolean}\n * @default false\n */\n _this.moveWhenInside = false;\n /**\n * Have events been attached to the dom element?\n *\n * @protected\n * @member {boolean}\n */\n _this.eventsAdded = false;\n /**\n * Has the system ticker been added?\n *\n * @protected\n * @member {boolean}\n */\n _this.tickerAdded = false;\n /**\n * Is the mouse hovering over the renderer?\n *\n * @protected\n * @member {boolean}\n */\n _this.mouseOverRenderer = false;\n /**\n * Does the device support touch events\n * https://www.w3.org/TR/touch-events/\n *\n * @readonly\n * @member {boolean}\n */\n _this.supportsTouchEvents = 'ontouchstart' in window;\n /**\n * Does the device support pointer events\n * https://www.w3.org/Submission/pointer-events/\n *\n * @readonly\n * @member {boolean}\n */\n _this.supportsPointerEvents = !!window.PointerEvent;\n // this will make it so that you don't have to call bind all the time\n /**\n * @private\n * @member {Function}\n */\n _this.onPointerUp = _this.onPointerUp.bind(_this);\n _this.processPointerUp = _this.processPointerUp.bind(_this);\n /**\n * @private\n * @member {Function}\n */\n _this.onPointerCancel = _this.onPointerCancel.bind(_this);\n _this.processPointerCancel = _this.processPointerCancel.bind(_this);\n /**\n * @private\n * @member {Function}\n */\n _this.onPointerDown = _this.onPointerDown.bind(_this);\n _this.processPointerDown = _this.processPointerDown.bind(_this);\n /**\n * @private\n * @member {Function}\n */\n _this.onPointerMove = _this.onPointerMove.bind(_this);\n _this.processPointerMove = _this.processPointerMove.bind(_this);\n /**\n * @private\n * @member {Function}\n */\n _this.onPointerOut = _this.onPointerOut.bind(_this);\n _this.processPointerOverOut = _this.processPointerOverOut.bind(_this);\n /**\n * @private\n * @member {Function}\n */\n _this.onPointerOver = _this.onPointerOver.bind(_this);\n /**\n * Dictionary of how different cursor modes are handled. Strings are handled as CSS cursor\n * values, objects are handled as dictionaries of CSS values for interactionDOMElement,\n * and functions are called instead of changing the CSS.\n * Default CSS cursor values are provided for 'default' and 'pointer' modes.\n * @member {Object.}\n */\n _this.cursorStyles = {\n default: 'inherit',\n pointer: 'pointer',\n };\n /**\n * The mode of the cursor that is being used.\n * The value of this is a key from the cursorStyles dictionary.\n *\n * @member {string}\n */\n _this.currentCursorMode = null;\n /**\n * Internal cached let.\n *\n * @private\n * @member {string}\n */\n _this.cursor = null;\n /**\n * The current resolution / device pixel ratio.\n *\n * @member {number}\n * @default 1\n */\n _this.resolution = 1;\n /**\n * Delayed pointer events. Used to guarantee correct ordering of over/out events.\n *\n * @private\n * @member {Array}\n */\n _this.delayedEvents = [];\n /**\n * TreeSearch component that is used to hitTest stage tree\n *\n * @private\n * @member {PIXI.TreeSearch}\n */\n _this.search = new TreeSearch();\n /**\n * Used as a last rendered object in case renderer doesnt have _lastObjectRendered\n * @member {DisplayObject}\n * @private\n */\n _this._tempDisplayObject = new _pixi_display__WEBPACK_IMPORTED_MODULE_2__.TemporaryDisplayObject();\n /**\n * Fired when a pointer device button (usually a mouse left-button) is pressed on the display\n * object.\n *\n * @event PIXI.InteractionManager#mousedown\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is pressed\n * on the display object.\n *\n * @event PIXI.InteractionManager#rightdown\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a pointer device button (usually a mouse left-button) is released over the display\n * object.\n *\n * @event PIXI.InteractionManager#mouseup\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is released\n * over the display object.\n *\n * @event PIXI.InteractionManager#rightup\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a pointer device button (usually a mouse left-button) is pressed and released on\n * the display object.\n *\n * @event PIXI.InteractionManager#click\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is pressed\n * and released on the display object.\n *\n * @event PIXI.InteractionManager#rightclick\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a pointer device button (usually a mouse left-button) is released outside the\n * display object that initially registered a\n * [mousedown]{@link PIXI.InteractionManager#event:mousedown}.\n *\n * @event PIXI.InteractionManager#mouseupoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is released\n * outside the display object that initially registered a\n * [rightdown]{@link PIXI.InteractionManager#event:rightdown}.\n *\n * @event PIXI.InteractionManager#rightupoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a pointer device (usually a mouse) is moved while over the display object\n *\n * @event PIXI.InteractionManager#mousemove\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a pointer device (usually a mouse) is moved onto the display object\n *\n * @event PIXI.InteractionManager#mouseover\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a pointer device (usually a mouse) is moved off the display object\n *\n * @event PIXI.InteractionManager#mouseout\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a pointer device button is pressed on the display object.\n *\n * @event PIXI.InteractionManager#pointerdown\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a pointer device button is released over the display object.\n * Not always fired when some buttons are held down while others are released. In those cases,\n * use [mousedown]{@link PIXI.InteractionManager#event:mousedown} and\n * [mouseup]{@link PIXI.InteractionManager#event:mouseup} instead.\n *\n * @event PIXI.InteractionManager#pointerup\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when the operating system cancels a pointer event\n *\n * @event PIXI.InteractionManager#pointercancel\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a pointer device button is pressed and released on the display object.\n *\n * @event PIXI.InteractionManager#pointertap\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a pointer device button is released outside the display object that initially\n * registered a [pointerdown]{@link PIXI.InteractionManager#event:pointerdown}.\n *\n * @event PIXI.InteractionManager#pointerupoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a pointer device is moved while over the display object\n *\n * @event PIXI.InteractionManager#pointermove\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a pointer device is moved onto the display object\n *\n * @event PIXI.InteractionManager#pointerover\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a pointer device is moved off the display object\n *\n * @event PIXI.InteractionManager#pointerout\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a touch point is placed on the display object.\n *\n * @event PIXI.InteractionManager#touchstart\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a touch point is removed from the display object.\n *\n * @event PIXI.InteractionManager#touchend\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when the operating system cancels a touch\n *\n * @event PIXI.InteractionManager#touchcancel\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a touch point is placed and removed from the display object.\n *\n * @event PIXI.InteractionManager#tap\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a touch point is removed outside of the display object that initially\n * registered a [touchstart]{@link PIXI.InteractionManager#event:touchstart}.\n *\n * @event PIXI.InteractionManager#touchendoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a touch point is moved along the display object.\n *\n * @event PIXI.InteractionManager#touchmove\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a pointer device button (usually a mouse left-button) is pressed on the display.\n * object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mousedown\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is pressed\n * on the display object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#rightdown\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a pointer device button (usually a mouse left-button) is released over the display\n * object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mouseup\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is released\n * over the display object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#rightup\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a pointer device button (usually a mouse left-button) is pressed and released on\n * the display object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#click\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is pressed\n * and released on the display object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#rightclick\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a pointer device button (usually a mouse left-button) is released outside the\n * display object that initially registered a\n * [mousedown]{@link PIXI.DisplayObject#event:mousedown}.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mouseupoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is released\n * outside the display object that initially registered a\n * [rightdown]{@link PIXI.DisplayObject#event:rightdown}.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#rightupoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a pointer device (usually a mouse) is moved while over the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mousemove\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a pointer device (usually a mouse) is moved onto the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mouseover\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a pointer device (usually a mouse) is moved off the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mouseout\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a pointer device button is pressed on the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointerdown\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a pointer device button is released over the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointerup\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when the operating system cancels a pointer event.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointercancel\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a pointer device button is pressed and released on the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointertap\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a pointer device button is released outside the display object that initially\n * registered a [pointerdown]{@link PIXI.DisplayObject#event:pointerdown}.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointerupoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a pointer device is moved while over the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointermove\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a pointer device is moved onto the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointerover\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a pointer device is moved off the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointerout\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a touch point is placed on the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#touchstart\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a touch point is removed from the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#touchend\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when the operating system cancels a touch.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#touchcancel\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a touch point is placed and removed from the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#tap\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a touch point is removed outside of the display object that initially\n * registered a [touchstart]{@link PIXI.DisplayObject#event:touchstart}.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#touchendoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n /**\n * Fired when a touch point is moved along the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#touchmove\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n _this._useSystemTicker = options.useSystemTicker !== undefined ? options.useSystemTicker : true;\n _this.setTargetElement(_this.renderer.view, _this.renderer.resolution);\n return _this;\n }\n Object.defineProperty(InteractionManager.prototype, \"useSystemTicker\", {\n /**\n * Should the InteractionManager automatically add {@link tickerUpdate} to {@link PIXI.Ticker.system}.\n *\n * @member {boolean}\n * @default true\n */\n get: function () {\n return this._useSystemTicker;\n },\n set: function (useSystemTicker) {\n this._useSystemTicker = useSystemTicker;\n if (useSystemTicker) {\n this.addTickerListener();\n }\n else {\n this.removeTickerListener();\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(InteractionManager.prototype, \"lastObjectRendered\", {\n /**\n * Last rendered object or temp object\n * @readonly\n * @protected\n * @member {PIXI.DisplayObject}\n */\n get: function () {\n return this.renderer._lastObjectRendered || this._tempDisplayObject;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Hit tests a point against the display tree, returning the first interactive object that is hit.\n *\n * @param {PIXI.Point} globalPoint - A point to hit test with, in global space.\n * @param {PIXI.Container} [root] - The root display object to start from. If omitted, defaults\n * to the last rendered root of the associated renderer.\n * @return {PIXI.DisplayObject} The hit display object, if any.\n */\n InteractionManager.prototype.hitTest = function (globalPoint, root) {\n // clear the target for our hit test\n hitTestEvent.target = null;\n // assign the global point\n hitTestEvent.data.global = globalPoint;\n // ensure safety of the root\n if (!root) {\n root = this.lastObjectRendered;\n }\n // run the hit test\n this.processInteractive(hitTestEvent, root, null, true);\n // return our found object - it'll be null if we didn't hit anything\n return hitTestEvent.target;\n };\n /**\n * Sets the DOM element which will receive mouse/touch events. This is useful for when you have\n * other DOM elements on top of the renderers Canvas element. With this you'll be bale to delegate\n * another DOM element to receive those events.\n *\n * @param {HTMLElement} element - the DOM element which will receive mouse and touch events.\n * @param {number} [resolution=1] - The resolution / device pixel ratio of the new element (relative to the canvas).\n */\n InteractionManager.prototype.setTargetElement = function (element, resolution) {\n if (resolution === void 0) { resolution = 1; }\n this.removeTickerListener();\n this.removeEvents();\n this.interactionDOMElement = element;\n this.resolution = resolution;\n this.addEvents();\n this.addTickerListener();\n };\n /**\n * Add the ticker listener\n *\n * @private\n */\n InteractionManager.prototype.addTickerListener = function () {\n if (this.tickerAdded || !this.interactionDOMElement || !this._useSystemTicker) {\n return;\n }\n _pixi_ticker__WEBPACK_IMPORTED_MODULE_1__.Ticker.system.add(this.tickerUpdate, this, _pixi_ticker__WEBPACK_IMPORTED_MODULE_1__.UPDATE_PRIORITY.INTERACTION);\n this.tickerAdded = true;\n };\n /**\n * Remove the ticker listener\n *\n * @private\n */\n InteractionManager.prototype.removeTickerListener = function () {\n if (!this.tickerAdded) {\n return;\n }\n _pixi_ticker__WEBPACK_IMPORTED_MODULE_1__.Ticker.system.remove(this.tickerUpdate, this);\n this.tickerAdded = false;\n };\n /**\n * Registers all the DOM events\n *\n * @private\n */\n InteractionManager.prototype.addEvents = function () {\n if (this.eventsAdded || !this.interactionDOMElement) {\n return;\n }\n var style = this.interactionDOMElement.style;\n if (window.navigator.msPointerEnabled) {\n style.msContentZooming = 'none';\n style.msTouchAction = 'none';\n }\n else if (this.supportsPointerEvents) {\n style.touchAction = 'none';\n }\n /**\n * These events are added first, so that if pointer events are normalized, they are fired\n * in the same order as non-normalized events. ie. pointer event 1st, mouse / touch 2nd\n */\n if (this.supportsPointerEvents) {\n window.document.addEventListener('pointermove', this.onPointerMove, true);\n this.interactionDOMElement.addEventListener('pointerdown', this.onPointerDown, true);\n // pointerout is fired in addition to pointerup (for touch events) and pointercancel\n // we already handle those, so for the purposes of what we do in onPointerOut, we only\n // care about the pointerleave event\n this.interactionDOMElement.addEventListener('pointerleave', this.onPointerOut, true);\n this.interactionDOMElement.addEventListener('pointerover', this.onPointerOver, true);\n window.addEventListener('pointercancel', this.onPointerCancel, true);\n window.addEventListener('pointerup', this.onPointerUp, true);\n }\n else {\n window.document.addEventListener('mousemove', this.onPointerMove, true);\n this.interactionDOMElement.addEventListener('mousedown', this.onPointerDown, true);\n this.interactionDOMElement.addEventListener('mouseout', this.onPointerOut, true);\n this.interactionDOMElement.addEventListener('mouseover', this.onPointerOver, true);\n window.addEventListener('mouseup', this.onPointerUp, true);\n }\n // always look directly for touch events so that we can provide original data\n // In a future version we should change this to being just a fallback and rely solely on\n // PointerEvents whenever available\n if (this.supportsTouchEvents) {\n this.interactionDOMElement.addEventListener('touchstart', this.onPointerDown, true);\n this.interactionDOMElement.addEventListener('touchcancel', this.onPointerCancel, true);\n this.interactionDOMElement.addEventListener('touchend', this.onPointerUp, true);\n this.interactionDOMElement.addEventListener('touchmove', this.onPointerMove, true);\n }\n this.eventsAdded = true;\n };\n /**\n * Removes all the DOM events that were previously registered\n *\n * @private\n */\n InteractionManager.prototype.removeEvents = function () {\n if (!this.eventsAdded || !this.interactionDOMElement) {\n return;\n }\n var style = this.interactionDOMElement.style;\n if (window.navigator.msPointerEnabled) {\n style.msContentZooming = '';\n style.msTouchAction = '';\n }\n else if (this.supportsPointerEvents) {\n style.touchAction = '';\n }\n if (this.supportsPointerEvents) {\n window.document.removeEventListener('pointermove', this.onPointerMove, true);\n this.interactionDOMElement.removeEventListener('pointerdown', this.onPointerDown, true);\n this.interactionDOMElement.removeEventListener('pointerleave', this.onPointerOut, true);\n this.interactionDOMElement.removeEventListener('pointerover', this.onPointerOver, true);\n window.removeEventListener('pointercancel', this.onPointerCancel, true);\n window.removeEventListener('pointerup', this.onPointerUp, true);\n }\n else {\n window.document.removeEventListener('mousemove', this.onPointerMove, true);\n this.interactionDOMElement.removeEventListener('mousedown', this.onPointerDown, true);\n this.interactionDOMElement.removeEventListener('mouseout', this.onPointerOut, true);\n this.interactionDOMElement.removeEventListener('mouseover', this.onPointerOver, true);\n window.removeEventListener('mouseup', this.onPointerUp, true);\n }\n if (this.supportsTouchEvents) {\n this.interactionDOMElement.removeEventListener('touchstart', this.onPointerDown, true);\n this.interactionDOMElement.removeEventListener('touchcancel', this.onPointerCancel, true);\n this.interactionDOMElement.removeEventListener('touchend', this.onPointerUp, true);\n this.interactionDOMElement.removeEventListener('touchmove', this.onPointerMove, true);\n }\n this.interactionDOMElement = null;\n this.eventsAdded = false;\n };\n /**\n * Updates the state of interactive objects if at least {@link interactionFrequency}\n * milliseconds have passed since the last invocation.\n *\n * Invoked by a throttled ticker update from {@link PIXI.Ticker.system}.\n *\n * @param {number} deltaTime - time delta since the last call\n */\n InteractionManager.prototype.tickerUpdate = function (deltaTime) {\n this._deltaTime += deltaTime;\n if (this._deltaTime < this.interactionFrequency) {\n return;\n }\n this._deltaTime = 0;\n this.update();\n };\n /**\n * Updates the state of interactive objects.\n */\n InteractionManager.prototype.update = function () {\n if (!this.interactionDOMElement) {\n return;\n }\n // if the user move the mouse this check has already been done using the mouse move!\n if (this._didMove) {\n this._didMove = false;\n return;\n }\n this.cursor = null;\n // Resets the flag as set by a stopPropagation call. This flag is usually reset by a user interaction of any kind,\n // but there was a scenario of a display object moving under a static mouse cursor.\n // In this case, mouseover and mouseevents would not pass the flag test in dispatchEvent function\n for (var k in this.activeInteractionData) {\n // eslint-disable-next-line no-prototype-builtins\n if (this.activeInteractionData.hasOwnProperty(k)) {\n var interactionData = this.activeInteractionData[k];\n if (interactionData.originalEvent && interactionData.pointerType !== 'touch') {\n var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, interactionData.originalEvent, interactionData);\n this.processInteractive(interactionEvent, this.lastObjectRendered, this.processPointerOverOut, true);\n }\n }\n }\n this.setCursorMode(this.cursor);\n };\n /**\n * Sets the current cursor mode, handling any callbacks or CSS style changes.\n *\n * @param {string} mode - cursor mode, a key from the cursorStyles dictionary\n */\n InteractionManager.prototype.setCursorMode = function (mode) {\n mode = mode || 'default';\n // if the mode didn't actually change, bail early\n if (this.currentCursorMode === mode) {\n return;\n }\n this.currentCursorMode = mode;\n var style = this.cursorStyles[mode];\n // only do things if there is a cursor style for it\n if (style) {\n switch (typeof style) {\n case 'string':\n // string styles are handled as cursor CSS\n this.interactionDOMElement.style.cursor = style;\n break;\n case 'function':\n // functions are just called, and passed the cursor mode\n style(mode);\n break;\n case 'object':\n // if it is an object, assume that it is a dictionary of CSS styles,\n // apply it to the interactionDOMElement\n Object.assign(this.interactionDOMElement.style, style);\n break;\n }\n }\n else if (typeof mode === 'string' && !Object.prototype.hasOwnProperty.call(this.cursorStyles, mode)) {\n // if it mode is a string (not a Symbol) and cursorStyles doesn't have any entry\n // for the mode, then assume that the dev wants it to be CSS for the cursor.\n this.interactionDOMElement.style.cursor = mode;\n }\n };\n /**\n * Dispatches an event on the display object that was interacted with\n *\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the display object in question\n * @param {string} eventString - the name of the event (e.g, mousedown)\n * @param {PIXI.InteractionEvent} eventData - the event data object\n * @private\n */\n InteractionManager.prototype.dispatchEvent = function (displayObject, eventString, eventData) {\n // Even if the event was stopped, at least dispatch any remaining events\n // for the same display object.\n if (!eventData.stopPropagationHint || displayObject === eventData.stopsPropagatingAt) {\n eventData.currentTarget = displayObject;\n eventData.type = eventString;\n displayObject.emit(eventString, eventData);\n if (displayObject[eventString]) {\n displayObject[eventString](eventData);\n }\n }\n };\n /**\n * Puts a event on a queue to be dispatched later. This is used to guarantee correct\n * ordering of over/out events.\n *\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the display object in question\n * @param {string} eventString - the name of the event (e.g, mousedown)\n * @param {object} eventData - the event data object\n * @private\n */\n InteractionManager.prototype.delayDispatchEvent = function (displayObject, eventString, eventData) {\n this.delayedEvents.push({ displayObject: displayObject, eventString: eventString, eventData: eventData });\n };\n /**\n * Maps x and y coords from a DOM object and maps them correctly to the PixiJS view. The\n * resulting value is stored in the point. This takes into account the fact that the DOM\n * element could be scaled and positioned anywhere on the screen.\n *\n * @param {PIXI.IPointData} point - the point that the result will be stored in\n * @param {number} x - the x coord of the position to map\n * @param {number} y - the y coord of the position to map\n */\n InteractionManager.prototype.mapPositionToPoint = function (point, x, y) {\n var rect;\n // IE 11 fix\n if (!this.interactionDOMElement.parentElement) {\n rect = { x: 0, y: 0, width: 0, height: 0 };\n }\n else {\n rect = this.interactionDOMElement.getBoundingClientRect();\n }\n var resolutionMultiplier = 1.0 / this.resolution;\n point.x = ((x - rect.left) * (this.interactionDOMElement.width / rect.width)) * resolutionMultiplier;\n point.y = ((y - rect.top) * (this.interactionDOMElement.height / rect.height)) * resolutionMultiplier;\n };\n /**\n * This function is provides a neat way of crawling through the scene graph and running a\n * specified function on all interactive objects it finds. It will also take care of hit\n * testing the interactive objects and passes the hit across in the function.\n *\n * @protected\n * @param {PIXI.InteractionEvent} interactionEvent - event containing the point that\n * is tested for collision\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject\n * that will be hit test (recursively crawls its children)\n * @param {Function} [func] - the function that will be called on each interactive object. The\n * interactionEvent, displayObject and hit will be passed to the function\n * @param {boolean} [hitTest] - indicates whether we want to calculate hits\n * or just iterate through all interactive objects\n */\n InteractionManager.prototype.processInteractive = function (interactionEvent, displayObject, func, hitTest) {\n var hit = this.search.findHit(interactionEvent, displayObject, func, hitTest);\n var delayedEvents = this.delayedEvents;\n if (!delayedEvents.length) {\n return hit;\n }\n // Reset the propagation hint, because we start deeper in the tree again.\n interactionEvent.stopPropagationHint = false;\n var delayedLen = delayedEvents.length;\n this.delayedEvents = [];\n for (var i = 0; i < delayedLen; i++) {\n var _a = delayedEvents[i], displayObject_1 = _a.displayObject, eventString = _a.eventString, eventData = _a.eventData;\n // When we reach the object we wanted to stop propagating at,\n // set the propagation hint.\n if (eventData.stopsPropagatingAt === displayObject_1) {\n eventData.stopPropagationHint = true;\n }\n this.dispatchEvent(displayObject_1, eventString, eventData);\n }\n return hit;\n };\n /**\n * Is called when the pointer button is pressed down on the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer button being pressed down\n */\n InteractionManager.prototype.onPointerDown = function (originalEvent) {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && originalEvent.pointerType === 'touch')\n { return; }\n var events = this.normalizeToPointerData(originalEvent);\n /**\n * No need to prevent default on natural pointer events, as there are no side effects\n * Normalized events, however, may have the double mousedown/touchstart issue on the native android browser,\n * so still need to be prevented.\n */\n // Guaranteed that there will be at least one event in events, and all events must have the same pointer type\n if (this.autoPreventDefault && events[0].isNormalized) {\n var cancelable = originalEvent.cancelable || !('cancelable' in originalEvent);\n if (cancelable) {\n originalEvent.preventDefault();\n }\n }\n var eventLen = events.length;\n for (var i = 0; i < eventLen; i++) {\n var event = events[i];\n var interactionData = this.getInteractionDataForPointerId(event);\n var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n interactionEvent.data.originalEvent = originalEvent;\n this.processInteractive(interactionEvent, this.lastObjectRendered, this.processPointerDown, true);\n this.emit('pointerdown', interactionEvent);\n if (event.pointerType === 'touch') {\n this.emit('touchstart', interactionEvent);\n }\n // emit a mouse event for \"pen\" pointers, the way a browser would emit a fallback event\n else if (event.pointerType === 'mouse' || event.pointerType === 'pen') {\n var isRightButton = event.button === 2;\n this.emit(isRightButton ? 'rightdown' : 'mousedown', this.eventData);\n }\n }\n };\n /**\n * Processes the result of the pointer down check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested\n * @param {boolean} hit - the result of the hit test on the display object\n */\n InteractionManager.prototype.processPointerDown = function (interactionEvent, displayObject, hit) {\n var data = interactionEvent.data;\n var id = interactionEvent.data.identifier;\n if (hit) {\n if (!displayObject.trackedPointers[id]) {\n displayObject.trackedPointers[id] = new InteractionTrackingData(id);\n }\n this.dispatchEvent(displayObject, 'pointerdown', interactionEvent);\n if (data.pointerType === 'touch') {\n this.dispatchEvent(displayObject, 'touchstart', interactionEvent);\n }\n else if (data.pointerType === 'mouse' || data.pointerType === 'pen') {\n var isRightButton = data.button === 2;\n if (isRightButton) {\n displayObject.trackedPointers[id].rightDown = true;\n }\n else {\n displayObject.trackedPointers[id].leftDown = true;\n }\n this.dispatchEvent(displayObject, isRightButton ? 'rightdown' : 'mousedown', interactionEvent);\n }\n }\n };\n /**\n * Is called when the pointer button is released on the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer button being released\n * @param {boolean} cancelled - true if the pointer is cancelled\n * @param {Function} func - Function passed to {@link processInteractive}\n */\n InteractionManager.prototype.onPointerComplete = function (originalEvent, cancelled, func) {\n var events = this.normalizeToPointerData(originalEvent);\n var eventLen = events.length;\n // if the event wasn't targeting our canvas, then consider it to be pointerupoutside\n // in all cases (unless it was a pointercancel)\n var eventAppend = originalEvent.target !== this.interactionDOMElement ? 'outside' : '';\n for (var i = 0; i < eventLen; i++) {\n var event = events[i];\n var interactionData = this.getInteractionDataForPointerId(event);\n var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n interactionEvent.data.originalEvent = originalEvent;\n // perform hit testing for events targeting our canvas or cancel events\n this.processInteractive(interactionEvent, this.lastObjectRendered, func, cancelled || !eventAppend);\n this.emit(cancelled ? 'pointercancel' : \"pointerup\" + eventAppend, interactionEvent);\n if (event.pointerType === 'mouse' || event.pointerType === 'pen') {\n var isRightButton = event.button === 2;\n this.emit(isRightButton ? \"rightup\" + eventAppend : \"mouseup\" + eventAppend, interactionEvent);\n }\n else if (event.pointerType === 'touch') {\n this.emit(cancelled ? 'touchcancel' : \"touchend\" + eventAppend, interactionEvent);\n this.releaseInteractionDataForPointerId(event.pointerId);\n }\n }\n };\n /**\n * Is called when the pointer button is cancelled\n *\n * @private\n * @param {PointerEvent} event - The DOM event of a pointer button being released\n */\n InteractionManager.prototype.onPointerCancel = function (event) {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && event.pointerType === 'touch')\n { return; }\n this.onPointerComplete(event, true, this.processPointerCancel);\n };\n /**\n * Processes the result of the pointer cancel check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested\n */\n InteractionManager.prototype.processPointerCancel = function (interactionEvent, displayObject) {\n var data = interactionEvent.data;\n var id = interactionEvent.data.identifier;\n if (displayObject.trackedPointers[id] !== undefined) {\n delete displayObject.trackedPointers[id];\n this.dispatchEvent(displayObject, 'pointercancel', interactionEvent);\n if (data.pointerType === 'touch') {\n this.dispatchEvent(displayObject, 'touchcancel', interactionEvent);\n }\n }\n };\n /**\n * Is called when the pointer button is released on the renderer element\n *\n * @private\n * @param {PointerEvent} event - The DOM event of a pointer button being released\n */\n InteractionManager.prototype.onPointerUp = function (event) {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && event.pointerType === 'touch')\n { return; }\n this.onPointerComplete(event, false, this.processPointerUp);\n };\n /**\n * Processes the result of the pointer up check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested\n * @param {boolean} hit - the result of the hit test on the display object\n */\n InteractionManager.prototype.processPointerUp = function (interactionEvent, displayObject, hit) {\n var data = interactionEvent.data;\n var id = interactionEvent.data.identifier;\n var trackingData = displayObject.trackedPointers[id];\n var isTouch = data.pointerType === 'touch';\n var isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen');\n // need to track mouse down status in the mouse block so that we can emit\n // event in a later block\n var isMouseTap = false;\n // Mouse only\n if (isMouse) {\n var isRightButton = data.button === 2;\n var flags = InteractionTrackingData.FLAGS;\n var test = isRightButton ? flags.RIGHT_DOWN : flags.LEFT_DOWN;\n var isDown = trackingData !== undefined && (trackingData.flags & test);\n if (hit) {\n this.dispatchEvent(displayObject, isRightButton ? 'rightup' : 'mouseup', interactionEvent);\n if (isDown) {\n this.dispatchEvent(displayObject, isRightButton ? 'rightclick' : 'click', interactionEvent);\n // because we can confirm that the mousedown happened on this object, flag for later emit of pointertap\n isMouseTap = true;\n }\n }\n else if (isDown) {\n this.dispatchEvent(displayObject, isRightButton ? 'rightupoutside' : 'mouseupoutside', interactionEvent);\n }\n // update the down state of the tracking data\n if (trackingData) {\n if (isRightButton) {\n trackingData.rightDown = false;\n }\n else {\n trackingData.leftDown = false;\n }\n }\n }\n // Pointers and Touches, and Mouse\n if (hit) {\n this.dispatchEvent(displayObject, 'pointerup', interactionEvent);\n if (isTouch)\n { this.dispatchEvent(displayObject, 'touchend', interactionEvent); }\n if (trackingData) {\n // emit pointertap if not a mouse, or if the mouse block decided it was a tap\n if (!isMouse || isMouseTap) {\n this.dispatchEvent(displayObject, 'pointertap', interactionEvent);\n }\n if (isTouch) {\n this.dispatchEvent(displayObject, 'tap', interactionEvent);\n // touches are no longer over (if they ever were) when we get the touchend\n // so we should ensure that we don't keep pretending that they are\n trackingData.over = false;\n }\n }\n }\n else if (trackingData) {\n this.dispatchEvent(displayObject, 'pointerupoutside', interactionEvent);\n if (isTouch)\n { this.dispatchEvent(displayObject, 'touchendoutside', interactionEvent); }\n }\n // Only remove the tracking data if there is no over/down state still associated with it\n if (trackingData && trackingData.none) {\n delete displayObject.trackedPointers[id];\n }\n };\n /**\n * Is called when the pointer moves across the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer moving\n */\n InteractionManager.prototype.onPointerMove = function (originalEvent) {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && originalEvent.pointerType === 'touch')\n { return; }\n var events = this.normalizeToPointerData(originalEvent);\n if (events[0].pointerType === 'mouse' || events[0].pointerType === 'pen') {\n this._didMove = true;\n this.cursor = null;\n }\n var eventLen = events.length;\n for (var i = 0; i < eventLen; i++) {\n var event = events[i];\n var interactionData = this.getInteractionDataForPointerId(event);\n var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n interactionEvent.data.originalEvent = originalEvent;\n this.processInteractive(interactionEvent, this.lastObjectRendered, this.processPointerMove, true);\n this.emit('pointermove', interactionEvent);\n if (event.pointerType === 'touch')\n { this.emit('touchmove', interactionEvent); }\n if (event.pointerType === 'mouse' || event.pointerType === 'pen')\n { this.emit('mousemove', interactionEvent); }\n }\n if (events[0].pointerType === 'mouse') {\n this.setCursorMode(this.cursor);\n // TODO BUG for parents interactive object (border order issue)\n }\n };\n /**\n * Processes the result of the pointer move check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested\n * @param {boolean} hit - the result of the hit test on the display object\n */\n InteractionManager.prototype.processPointerMove = function (interactionEvent, displayObject, hit) {\n var data = interactionEvent.data;\n var isTouch = data.pointerType === 'touch';\n var isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen');\n if (isMouse) {\n this.processPointerOverOut(interactionEvent, displayObject, hit);\n }\n if (!this.moveWhenInside || hit) {\n this.dispatchEvent(displayObject, 'pointermove', interactionEvent);\n if (isTouch)\n { this.dispatchEvent(displayObject, 'touchmove', interactionEvent); }\n if (isMouse)\n { this.dispatchEvent(displayObject, 'mousemove', interactionEvent); }\n }\n };\n /**\n * Is called when the pointer is moved out of the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer being moved out\n */\n InteractionManager.prototype.onPointerOut = function (originalEvent) {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && originalEvent.pointerType === 'touch')\n { return; }\n var events = this.normalizeToPointerData(originalEvent);\n // Only mouse and pointer can call onPointerOut, so events will always be length 1\n var event = events[0];\n if (event.pointerType === 'mouse') {\n this.mouseOverRenderer = false;\n this.setCursorMode(null);\n }\n var interactionData = this.getInteractionDataForPointerId(event);\n var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n interactionEvent.data.originalEvent = event;\n this.processInteractive(interactionEvent, this.lastObjectRendered, this.processPointerOverOut, false);\n this.emit('pointerout', interactionEvent);\n if (event.pointerType === 'mouse' || event.pointerType === 'pen') {\n this.emit('mouseout', interactionEvent);\n }\n else {\n // we can get touchleave events after touchend, so we want to make sure we don't\n // introduce memory leaks\n this.releaseInteractionDataForPointerId(interactionData.identifier);\n }\n };\n /**\n * Processes the result of the pointer over/out check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested\n * @param {boolean} hit - the result of the hit test on the display object\n */\n InteractionManager.prototype.processPointerOverOut = function (interactionEvent, displayObject, hit) {\n var data = interactionEvent.data;\n var id = interactionEvent.data.identifier;\n var isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen');\n var trackingData = displayObject.trackedPointers[id];\n // if we just moused over the display object, then we need to track that state\n if (hit && !trackingData) {\n trackingData = displayObject.trackedPointers[id] = new InteractionTrackingData(id);\n }\n if (trackingData === undefined)\n { return; }\n if (hit && this.mouseOverRenderer) {\n if (!trackingData.over) {\n trackingData.over = true;\n this.delayDispatchEvent(displayObject, 'pointerover', interactionEvent);\n if (isMouse) {\n this.delayDispatchEvent(displayObject, 'mouseover', interactionEvent);\n }\n }\n // only change the cursor if it has not already been changed (by something deeper in the\n // display tree)\n if (isMouse && this.cursor === null) {\n this.cursor = displayObject.cursor;\n }\n }\n else if (trackingData.over) {\n trackingData.over = false;\n this.dispatchEvent(displayObject, 'pointerout', this.eventData);\n if (isMouse) {\n this.dispatchEvent(displayObject, 'mouseout', interactionEvent);\n }\n // if there is no mouse down information for the pointer, then it is safe to delete\n if (trackingData.none) {\n delete displayObject.trackedPointers[id];\n }\n }\n };\n /**\n * Is called when the pointer is moved into the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer button being moved into the renderer view\n */\n InteractionManager.prototype.onPointerOver = function (originalEvent) {\n var events = this.normalizeToPointerData(originalEvent);\n // Only mouse and pointer can call onPointerOver, so events will always be length 1\n var event = events[0];\n var interactionData = this.getInteractionDataForPointerId(event);\n var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n interactionEvent.data.originalEvent = event;\n if (event.pointerType === 'mouse') {\n this.mouseOverRenderer = true;\n }\n this.emit('pointerover', interactionEvent);\n if (event.pointerType === 'mouse' || event.pointerType === 'pen') {\n this.emit('mouseover', interactionEvent);\n }\n };\n /**\n * Get InteractionData for a given pointerId. Store that data as well\n *\n * @private\n * @param {PointerEvent} event - Normalized pointer event, output from normalizeToPointerData\n * @return {PIXI.InteractionData} - Interaction data for the given pointer identifier\n */\n InteractionManager.prototype.getInteractionDataForPointerId = function (event) {\n var pointerId = event.pointerId;\n var interactionData;\n if (pointerId === MOUSE_POINTER_ID || event.pointerType === 'mouse') {\n interactionData = this.mouse;\n }\n else if (this.activeInteractionData[pointerId]) {\n interactionData = this.activeInteractionData[pointerId];\n }\n else {\n interactionData = this.interactionDataPool.pop() || new InteractionData();\n interactionData.identifier = pointerId;\n this.activeInteractionData[pointerId] = interactionData;\n }\n // copy properties from the event, so that we can make sure that touch/pointer specific\n // data is available\n interactionData.copyEvent(event);\n return interactionData;\n };\n /**\n * Return unused InteractionData to the pool, for a given pointerId\n *\n * @private\n * @param {number} pointerId - Identifier from a pointer event\n */\n InteractionManager.prototype.releaseInteractionDataForPointerId = function (pointerId) {\n var interactionData = this.activeInteractionData[pointerId];\n if (interactionData) {\n delete this.activeInteractionData[pointerId];\n interactionData.reset();\n this.interactionDataPool.push(interactionData);\n }\n };\n /**\n * Configure an InteractionEvent to wrap a DOM PointerEvent and InteractionData\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - The event to be configured\n * @param {PointerEvent} pointerEvent - The DOM event that will be paired with the InteractionEvent\n * @param {PIXI.InteractionData} interactionData - The InteractionData that will be paired\n * with the InteractionEvent\n * @return {PIXI.InteractionEvent} the interaction event that was passed in\n */\n InteractionManager.prototype.configureInteractionEventForDOMEvent = function (interactionEvent, pointerEvent, interactionData) {\n interactionEvent.data = interactionData;\n this.mapPositionToPoint(interactionData.global, pointerEvent.clientX, pointerEvent.clientY);\n // Not really sure why this is happening, but it's how a previous version handled things\n if (pointerEvent.pointerType === 'touch') {\n pointerEvent.globalX = interactionData.global.x;\n pointerEvent.globalY = interactionData.global.y;\n }\n interactionData.originalEvent = pointerEvent;\n interactionEvent.reset();\n return interactionEvent;\n };\n /**\n * Ensures that the original event object contains all data that a regular pointer event would have\n *\n * @private\n * @param {TouchEvent|MouseEvent|PointerEvent} event - The original event data from a touch or mouse event\n * @return {PointerEvent[]} An array containing a single normalized pointer event, in the case of a pointer\n * or mouse event, or a multiple normalized pointer events if there are multiple changed touches\n */\n InteractionManager.prototype.normalizeToPointerData = function (event) {\n var normalizedEvents = [];\n if (this.supportsTouchEvents && event instanceof TouchEvent) {\n for (var i = 0, li = event.changedTouches.length; i < li; i++) {\n var touch = event.changedTouches[i];\n if (typeof touch.button === 'undefined')\n { touch.button = event.touches.length ? 1 : 0; }\n if (typeof touch.buttons === 'undefined')\n { touch.buttons = event.touches.length ? 1 : 0; }\n if (typeof touch.isPrimary === 'undefined') {\n touch.isPrimary = event.touches.length === 1 && event.type === 'touchstart';\n }\n if (typeof touch.width === 'undefined')\n { touch.width = touch.radiusX || 1; }\n if (typeof touch.height === 'undefined')\n { touch.height = touch.radiusY || 1; }\n if (typeof touch.tiltX === 'undefined')\n { touch.tiltX = 0; }\n if (typeof touch.tiltY === 'undefined')\n { touch.tiltY = 0; }\n if (typeof touch.pointerType === 'undefined')\n { touch.pointerType = 'touch'; }\n if (typeof touch.pointerId === 'undefined')\n { touch.pointerId = touch.identifier || 0; }\n if (typeof touch.pressure === 'undefined')\n { touch.pressure = touch.force || 0.5; }\n if (typeof touch.twist === 'undefined')\n { touch.twist = 0; }\n if (typeof touch.tangentialPressure === 'undefined')\n { touch.tangentialPressure = 0; }\n // TODO: Remove these, as layerX/Y is not a standard, is deprecated, has uneven\n // support, and the fill ins are not quite the same\n // offsetX/Y might be okay, but is not the same as clientX/Y when the canvas's top\n // left is not 0,0 on the page\n if (typeof touch.layerX === 'undefined')\n { touch.layerX = touch.offsetX = touch.clientX; }\n if (typeof touch.layerY === 'undefined')\n { touch.layerY = touch.offsetY = touch.clientY; }\n // mark the touch as normalized, just so that we know we did it\n touch.isNormalized = true;\n normalizedEvents.push(touch);\n }\n }\n // apparently PointerEvent subclasses MouseEvent, so yay\n else if (event instanceof MouseEvent && (!this.supportsPointerEvents || !(event instanceof window.PointerEvent))) {\n var tempEvent = event;\n if (typeof tempEvent.isPrimary === 'undefined')\n { tempEvent.isPrimary = true; }\n if (typeof tempEvent.width === 'undefined')\n { tempEvent.width = 1; }\n if (typeof tempEvent.height === 'undefined')\n { tempEvent.height = 1; }\n if (typeof tempEvent.tiltX === 'undefined')\n { tempEvent.tiltX = 0; }\n if (typeof tempEvent.tiltY === 'undefined')\n { tempEvent.tiltY = 0; }\n if (typeof tempEvent.pointerType === 'undefined')\n { tempEvent.pointerType = 'mouse'; }\n if (typeof tempEvent.pointerId === 'undefined')\n { tempEvent.pointerId = MOUSE_POINTER_ID; }\n if (typeof tempEvent.pressure === 'undefined')\n { tempEvent.pressure = 0.5; }\n if (typeof tempEvent.twist === 'undefined')\n { tempEvent.twist = 0; }\n if (typeof tempEvent.tangentialPressure === 'undefined')\n { tempEvent.tangentialPressure = 0; }\n // mark the mouse event as normalized, just so that we know we did it\n tempEvent.isNormalized = true;\n normalizedEvents.push(tempEvent);\n }\n else {\n normalizedEvents.push(event);\n }\n return normalizedEvents;\n };\n /**\n * Destroys the interaction manager\n *\n */\n InteractionManager.prototype.destroy = function () {\n this.removeEvents();\n this.removeTickerListener();\n this.removeAllListeners();\n this.renderer = null;\n this.mouse = null;\n this.eventData = null;\n this.interactionDOMElement = null;\n this.onPointerDown = null;\n this.processPointerDown = null;\n this.onPointerUp = null;\n this.processPointerUp = null;\n this.onPointerCancel = null;\n this.processPointerCancel = null;\n this.onPointerMove = null;\n this.processPointerMove = null;\n this.onPointerOut = null;\n this.processPointerOverOut = null;\n this.onPointerOver = null;\n this.search = null;\n };\n return InteractionManager;\n}(_pixi_utils__WEBPACK_IMPORTED_MODULE_3__.EventEmitter));\n\n\n//# sourceMappingURL=interaction.es.js.map\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/@pixi/interaction/lib/interaction.es.js?"); /***/ }), /***/ "./node_modules/@pixi/loaders/lib/loaders.es.js": /*!******************************************************!*\ !*** ./node_modules/@pixi/loaders/lib/loaders.es.js ***! \******************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"AppLoaderPlugin\": () => (/* binding */ AppLoaderPlugin),\n/* harmony export */ \"Loader\": () => (/* binding */ Loader),\n/* harmony export */ \"LoaderResource\": () => (/* binding */ LoaderResource),\n/* harmony export */ \"TextureLoader\": () => (/* binding */ TextureLoader)\n/* harmony export */ });\n/* harmony import */ var resource_loader__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! resource-loader */ \"./node_modules/resource-loader/dist/resource-loader.esm.js\");\n/* harmony import */ var _pixi_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @pixi/core */ \"./node_modules/@pixi/core/lib/core.es.js\");\n/*!\n * @pixi/loaders - v5.3.11\n * Compiled Mon, 01 Nov 2021 16:10:12 UTC\n *\n * @pixi/loaders is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n\n\n\n/**\n* Reference to **{@link https://github.com/englercj/resource-loader\n* resource-loader}**'s Resource class.\n* @see http://englercj.github.io/resource-loader/Resource.html\n* @class LoaderResource\n* @memberof PIXI\n*/\nvar LoaderResource = resource_loader__WEBPACK_IMPORTED_MODULE_0__.Resource;\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } };\r\n return extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\n\n/**\n * Loader plugin for handling Texture resources.\n * @class\n * @memberof PIXI\n * @implements PIXI.ILoaderPlugin\n */\nvar TextureLoader = /** @class */ (function () {\n function TextureLoader() {\n }\n /**\n * Called after a resource is loaded.\n * @see PIXI.Loader.loaderMiddleware\n * @param {PIXI.LoaderResource} resource\n * @param {function} next\n */\n TextureLoader.use = function (resource, next) {\n // create a new texture if the data is an Image object\n if (resource.data && resource.type === resource_loader__WEBPACK_IMPORTED_MODULE_0__.Resource.TYPE.IMAGE) {\n resource.texture = _pixi_core__WEBPACK_IMPORTED_MODULE_1__.Texture.fromLoader(resource.data, resource.url, resource.name);\n }\n next();\n };\n return TextureLoader;\n}());\n\n/**\n * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader\n *\n * ```js\n * const loader = PIXI.Loader.shared; // PixiJS exposes a premade instance for you to use.\n * //or\n * const loader = new PIXI.Loader(); // you can also create your own if you want\n *\n * const sprites = {};\n *\n * // Chainable `add` to enqueue a resource\n * loader.add('bunny', 'data/bunny.png')\n * .add('spaceship', 'assets/spritesheet.json');\n * loader.add('scoreFont', 'assets/score.fnt');\n *\n * // Chainable `pre` to add a middleware that runs for each resource, *before* loading that resource.\n * // This is useful to implement custom caching modules (using filesystem, indexeddb, memory, etc).\n * loader.pre(cachingMiddleware);\n *\n * // Chainable `use` to add a middleware that runs for each resource, *after* loading that resource.\n * // This is useful to implement custom parsing modules (like spritesheet parsers, spine parser, etc).\n * loader.use(parsingMiddleware);\n *\n * // The `load` method loads the queue of resources, and calls the passed in callback called once all\n * // resources have loaded.\n * loader.load((loader, resources) => {\n * // resources is an object where the key is the name of the resource loaded and the value is the resource object.\n * // They have a couple default properties:\n * // - `url`: The URL that the resource was loaded from\n * // - `error`: The error that happened when trying to load (if any)\n * // - `data`: The raw data that was loaded\n * // also may contain other properties based on the middleware that runs.\n * sprites.bunny = new PIXI.TilingSprite(resources.bunny.texture);\n * sprites.spaceship = new PIXI.TilingSprite(resources.spaceship.texture);\n * sprites.scoreFont = new PIXI.TilingSprite(resources.scoreFont.texture);\n * });\n *\n * // throughout the process multiple signals can be dispatched.\n * loader.onProgress.add(() => {}); // called once per loaded/errored file\n * loader.onError.add(() => {}); // called once per errored file\n * loader.onLoad.add(() => {}); // called once per loaded file\n * loader.onComplete.add(() => {}); // called once when the queued resources all load.\n * ```\n *\n * @see https://github.com/englercj/resource-loader\n *\n * @class Loader\n * @memberof PIXI\n * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader.\n * @param {number} [concurrency=10] - The number of resources to load concurrently.\n */\nvar Loader = /** @class */ (function (_super) {\n __extends(Loader, _super);\n function Loader(baseUrl, concurrency) {\n var _this = _super.call(this, baseUrl, concurrency) || this;\n for (var i = 0; i < Loader._plugins.length; ++i) {\n var plugin = Loader._plugins[i];\n var pre = plugin.pre, use = plugin.use;\n if (pre) {\n _this.pre(pre);\n }\n if (use) {\n _this.use(use);\n }\n }\n /**\n * If this loader cannot be destroyed.\n * @member {boolean}\n * @default false\n * @private\n */\n _this._protected = false;\n return _this;\n }\n /**\n * Destroy the loader, removes references.\n * @memberof PIXI.Loader#\n * @method destroy\n * @public\n */\n Loader.prototype.destroy = function () {\n if (!this._protected) {\n this.reset();\n }\n };\n Object.defineProperty(Loader, \"shared\", {\n /**\n * A premade instance of the loader that can be used to load resources.\n * @name shared\n * @type {PIXI.Loader}\n * @static\n * @memberof PIXI.Loader\n */\n get: function () {\n var shared = Loader._shared;\n if (!shared) {\n shared = new Loader();\n shared._protected = true;\n Loader._shared = shared;\n }\n return shared;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Adds a Loader plugin for the global shared loader and all\n * new Loader instances created.\n *\n * @static\n * @method registerPlugin\n * @memberof PIXI.Loader\n * @param {PIXI.ILoaderPlugin} plugin - The plugin to add\n * @return {PIXI.Loader} Reference to PIXI.Loader for chaining\n */\n Loader.registerPlugin = function (plugin) {\n Loader._plugins.push(plugin);\n if (plugin.add) {\n plugin.add();\n }\n return Loader;\n };\n /**\n * Collection of all installed `use` middleware for Loader.\n *\n * @static\n * @member {Array} _plugins\n * @memberof PIXI.Loader\n * @private\n */\n Loader._plugins = [];\n return Loader;\n}(resource_loader__WEBPACK_IMPORTED_MODULE_0__.Loader));\n// parse any blob into more usable objects (e.g. Image)\nLoader.registerPlugin({ use: resource_loader__WEBPACK_IMPORTED_MODULE_0__.middleware.parsing });\n// parse any Image objects into textures\nLoader.registerPlugin(TextureLoader);\n/**\n * Plugin to be installed for handling specific Loader resources.\n *\n * @memberof PIXI\n * @typedef {object} ILoaderPlugin\n * @property {function} [add] - Function to call immediate after registering plugin.\n * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the\n * arguments for this are `(resource, next)`\n * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the\n * arguments for this are `(resource, next)`\n */\n/**\n * @memberof PIXI.Loader\n * @typedef {object} ICallbackID\n */\n/**\n * @memberof PIXI.Loader\n * @typedef {function} ISignalCallback\n * @param {function} callback - Callback function\n * @param {object} [context] - Context\n * @returns {ICallbackID} - CallbackID\n */\n/**\n * @memberof PIXI.Loader\n * @typedef {function} ISignalDetach\n * @param {ICallbackID} id - CallbackID returned by `add`/`once` methods\n */\n/**\n * @memberof PIXI.Loader\n * @typedef ILoaderSignal\n * @property {ISignalCallback} add - Register callback\n * @property {ISignalCallback} once - Register oneshot callback\n * @property {ISignalDetach} detach - Detach specific callback by ID\n */\n/**\n * @memberof PIXI.Loader\n * @callback loaderMiddleware\n * @param {PIXI.LoaderResource} resource\n * @param {function} next\n */\n/**\n * @memberof PIXI.Loader#\n * @description Dispatched when the loader begins to loading process.\n * @member {PIXI.Loader.ILoaderSignal} onStart\n */\n/**\n * @memberof PIXI.Loader#\n * @description Dispatched once per loaded or errored resource.\n * @member {PIXI.Loader.ILoaderSignal} onProgress\n */\n/**\n * @memberof PIXI.Loader#\n * @description Dispatched once per errored resource.\n * @member {PIXI.Loader.ILoaderSignal} onError\n */\n/**\n * @memberof PIXI.Loader#\n * @description Dispatched once per loaded resource.\n * @member {PIXI.Loader.ILoaderSignal} onLoad\n */\n/**\n * @memberof PIXI.Loader#\n * @description Dispatched when completely loaded all resources.\n * @member {PIXI.Loader.ILoaderSignal} onComplete\n */\n\n/**\n * Application plugin for supporting loader option. Installing the LoaderPlugin\n * is not necessary if using **pixi.js** or **pixi.js-legacy**.\n * @example\n * import {AppLoaderPlugin} from '@pixi/loaders';\n * import {Application} from '@pixi/app';\n * Application.registerPlugin(AppLoaderPlugin);\n * @class\n * @memberof PIXI\n */\nvar AppLoaderPlugin = /** @class */ (function () {\n function AppLoaderPlugin() {\n }\n /**\n * Called on application constructor\n * @param {object} options\n * @private\n */\n AppLoaderPlugin.init = function (options) {\n options = Object.assign({\n sharedLoader: false,\n }, options);\n /**\n * Loader instance to help with asset loading.\n * @name PIXI.Application#loader\n * @type {PIXI.Loader}\n * @readonly\n */\n this.loader = options.sharedLoader ? Loader.shared : new Loader();\n };\n /**\n * Called when application destroyed\n * @private\n */\n AppLoaderPlugin.destroy = function () {\n if (this.loader) {\n this.loader.destroy();\n this.loader = null;\n }\n };\n return AppLoaderPlugin;\n}());\n\n\n//# sourceMappingURL=loaders.es.js.map\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/@pixi/loaders/lib/loaders.es.js?"); /***/ }), /***/ "./node_modules/@pixi/math/lib/math.es.js": /*!************************************************!*\ !*** ./node_modules/@pixi/math/lib/math.es.js ***! \************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Circle\": () => (/* binding */ Circle),\n/* harmony export */ \"DEG_TO_RAD\": () => (/* binding */ DEG_TO_RAD),\n/* harmony export */ \"Ellipse\": () => (/* binding */ Ellipse),\n/* harmony export */ \"Matrix\": () => (/* binding */ Matrix),\n/* harmony export */ \"ObservablePoint\": () => (/* binding */ ObservablePoint),\n/* harmony export */ \"PI_2\": () => (/* binding */ PI_2),\n/* harmony export */ \"Point\": () => (/* binding */ Point),\n/* harmony export */ \"Polygon\": () => (/* binding */ Polygon),\n/* harmony export */ \"RAD_TO_DEG\": () => (/* binding */ RAD_TO_DEG),\n/* harmony export */ \"Rectangle\": () => (/* binding */ Rectangle),\n/* harmony export */ \"RoundedRectangle\": () => (/* binding */ RoundedRectangle),\n/* harmony export */ \"SHAPES\": () => (/* binding */ SHAPES),\n/* harmony export */ \"Transform\": () => (/* binding */ Transform),\n/* harmony export */ \"groupD8\": () => (/* binding */ groupD8)\n/* harmony export */ });\n/*!\n * @pixi/math - v5.3.11\n * Compiled Mon, 01 Nov 2021 16:10:12 UTC\n *\n * @pixi/math is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n/**\n * Two Pi.\n *\n * @static\n * @constant {number} PI_2\n * @memberof PIXI\n */\nvar PI_2 = Math.PI * 2;\n/**\n * Conversion factor for converting radians to degrees.\n *\n * @static\n * @constant {number} RAD_TO_DEG\n * @memberof PIXI\n */\nvar RAD_TO_DEG = 180 / Math.PI;\n/**\n * Conversion factor for converting degrees to radians.\n *\n * @static\n * @constant {number} DEG_TO_RAD\n * @memberof PIXI\n */\nvar DEG_TO_RAD = Math.PI / 180;\nvar SHAPES;\n(function (SHAPES) {\n SHAPES[SHAPES[\"POLY\"] = 0] = \"POLY\";\n SHAPES[SHAPES[\"RECT\"] = 1] = \"RECT\";\n SHAPES[SHAPES[\"CIRC\"] = 2] = \"CIRC\";\n SHAPES[SHAPES[\"ELIP\"] = 3] = \"ELIP\";\n SHAPES[SHAPES[\"RREC\"] = 4] = \"RREC\";\n})(SHAPES || (SHAPES = {}));\n/**\n * Constants that identify shapes, mainly to prevent `instanceof` calls.\n *\n * @static\n * @constant\n * @name SHAPES\n * @memberof PIXI\n * @type {enum}\n * @property {number} POLY Polygon\n * @property {number} RECT Rectangle\n * @property {number} CIRC Circle\n * @property {number} ELIP Ellipse\n * @property {number} RREC Rounded Rectangle\n * @enum {number}\n */\n\n/**\n * Size object, contains width and height\n *\n * @memberof PIXI\n * @typedef {object} ISize\n * @property {number} width - Width component\n * @property {number} height - Height component\n */\n/**\n * Rectangle object is an area defined by its position, as indicated by its top-left corner\n * point (x, y) and by its width and its height.\n *\n * @class\n * @memberof PIXI\n */\nvar Rectangle = /** @class */ (function () {\n /**\n * @param {number} [x=0] - The X coordinate of the upper-left corner of the rectangle\n * @param {number} [y=0] - The Y coordinate of the upper-left corner of the rectangle\n * @param {number} [width=0] - The overall width of this rectangle\n * @param {number} [height=0] - The overall height of this rectangle\n */\n function Rectangle(x, y, width, height) {\n if (x === void 0) { x = 0; }\n if (y === void 0) { y = 0; }\n if (width === void 0) { width = 0; }\n if (height === void 0) { height = 0; }\n /**\n * @member {number}\n * @default 0\n */\n this.x = Number(x);\n /**\n * @member {number}\n * @default 0\n */\n this.y = Number(y);\n /**\n * @member {number}\n * @default 0\n */\n this.width = Number(width);\n /**\n * @member {number}\n * @default 0\n */\n this.height = Number(height);\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n * @readOnly\n * @default PIXI.SHAPES.RECT\n * @see PIXI.SHAPES\n */\n this.type = SHAPES.RECT;\n }\n Object.defineProperty(Rectangle.prototype, \"left\", {\n /**\n * returns the left edge of the rectangle\n *\n * @member {number}\n */\n get: function () {\n return this.x;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Rectangle.prototype, \"right\", {\n /**\n * returns the right edge of the rectangle\n *\n * @member {number}\n */\n get: function () {\n return this.x + this.width;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Rectangle.prototype, \"top\", {\n /**\n * returns the top edge of the rectangle\n *\n * @member {number}\n */\n get: function () {\n return this.y;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Rectangle.prototype, \"bottom\", {\n /**\n * returns the bottom edge of the rectangle\n *\n * @member {number}\n */\n get: function () {\n return this.y + this.height;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Rectangle, \"EMPTY\", {\n /**\n * A constant empty rectangle.\n *\n * @static\n * @constant\n * @member {PIXI.Rectangle}\n * @return {PIXI.Rectangle} An empty rectangle\n */\n get: function () {\n return new Rectangle(0, 0, 0, 0);\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Creates a clone of this Rectangle\n *\n * @return {PIXI.Rectangle} a copy of the rectangle\n */\n Rectangle.prototype.clone = function () {\n return new Rectangle(this.x, this.y, this.width, this.height);\n };\n /**\n * Copies another rectangle to this one.\n *\n * @param {PIXI.Rectangle} rectangle - The rectangle to copy from.\n * @return {PIXI.Rectangle} Returns itself.\n */\n Rectangle.prototype.copyFrom = function (rectangle) {\n this.x = rectangle.x;\n this.y = rectangle.y;\n this.width = rectangle.width;\n this.height = rectangle.height;\n return this;\n };\n /**\n * Copies this rectangle to another one.\n *\n * @param {PIXI.Rectangle} rectangle - The rectangle to copy to.\n * @return {PIXI.Rectangle} Returns given parameter.\n */\n Rectangle.prototype.copyTo = function (rectangle) {\n rectangle.x = this.x;\n rectangle.y = this.y;\n rectangle.width = this.width;\n rectangle.height = this.height;\n return rectangle;\n };\n /**\n * Checks whether the x and y coordinates given are contained within this Rectangle\n *\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coordinates are within this Rectangle\n */\n Rectangle.prototype.contains = function (x, y) {\n if (this.width <= 0 || this.height <= 0) {\n return false;\n }\n if (x >= this.x && x < this.x + this.width) {\n if (y >= this.y && y < this.y + this.height) {\n return true;\n }\n }\n return false;\n };\n /**\n * Pads the rectangle making it grow in all directions.\n * If paddingY is omitted, both paddingX and paddingY will be set to paddingX.\n *\n * @param {number} [paddingX=0] - The horizontal padding amount.\n * @param {number} [paddingY=0] - The vertical padding amount.\n * @return {PIXI.Rectangle} Returns itself.\n */\n Rectangle.prototype.pad = function (paddingX, paddingY) {\n if (paddingX === void 0) { paddingX = 0; }\n if (paddingY === void 0) { paddingY = paddingX; }\n this.x -= paddingX;\n this.y -= paddingY;\n this.width += paddingX * 2;\n this.height += paddingY * 2;\n return this;\n };\n /**\n * Fits this rectangle around the passed one.\n *\n * @param {PIXI.Rectangle} rectangle - The rectangle to fit.\n * @return {PIXI.Rectangle} Returns itself.\n */\n Rectangle.prototype.fit = function (rectangle) {\n var x1 = Math.max(this.x, rectangle.x);\n var x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width);\n var y1 = Math.max(this.y, rectangle.y);\n var y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height);\n this.x = x1;\n this.width = Math.max(x2 - x1, 0);\n this.y = y1;\n this.height = Math.max(y2 - y1, 0);\n return this;\n };\n /**\n * Enlarges rectangle that way its corners lie on grid\n *\n * @param {number} [resolution=1] resolution\n * @param {number} [eps=0.001] precision\n * @return {PIXI.Rectangle} Returns itself.\n */\n Rectangle.prototype.ceil = function (resolution, eps) {\n if (resolution === void 0) { resolution = 1; }\n if (eps === void 0) { eps = 0.001; }\n var x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution;\n var y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution;\n this.x = Math.floor((this.x + eps) * resolution) / resolution;\n this.y = Math.floor((this.y + eps) * resolution) / resolution;\n this.width = x2 - this.x;\n this.height = y2 - this.y;\n return this;\n };\n /**\n * Enlarges this rectangle to include the passed rectangle.\n *\n * @param {PIXI.Rectangle} rectangle - The rectangle to include.\n * @return {PIXI.Rectangle} Returns itself.\n */\n Rectangle.prototype.enlarge = function (rectangle) {\n var x1 = Math.min(this.x, rectangle.x);\n var x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width);\n var y1 = Math.min(this.y, rectangle.y);\n var y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height);\n this.x = x1;\n this.width = x2 - x1;\n this.y = y1;\n this.height = y2 - y1;\n return this;\n };\n return Rectangle;\n}());\n\n/**\n * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects.\n *\n * @class\n * @memberof PIXI\n */\nvar Circle = /** @class */ (function () {\n /**\n * @param {number} [x=0] - The X coordinate of the center of this circle\n * @param {number} [y=0] - The Y coordinate of the center of this circle\n * @param {number} [radius=0] - The radius of the circle\n */\n function Circle(x, y, radius) {\n if (x === void 0) { x = 0; }\n if (y === void 0) { y = 0; }\n if (radius === void 0) { radius = 0; }\n /**\n * @member {number}\n * @default 0\n */\n this.x = x;\n /**\n * @member {number}\n * @default 0\n */\n this.y = y;\n /**\n * @member {number}\n * @default 0\n */\n this.radius = radius;\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n * @readOnly\n * @default PIXI.SHAPES.CIRC\n * @see PIXI.SHAPES\n */\n this.type = SHAPES.CIRC;\n }\n /**\n * Creates a clone of this Circle instance\n *\n * @return {PIXI.Circle} a copy of the Circle\n */\n Circle.prototype.clone = function () {\n return new Circle(this.x, this.y, this.radius);\n };\n /**\n * Checks whether the x and y coordinates given are contained within this circle\n *\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coordinates are within this Circle\n */\n Circle.prototype.contains = function (x, y) {\n if (this.radius <= 0) {\n return false;\n }\n var r2 = this.radius * this.radius;\n var dx = (this.x - x);\n var dy = (this.y - y);\n dx *= dx;\n dy *= dy;\n return (dx + dy <= r2);\n };\n /**\n * Returns the framing rectangle of the circle as a Rectangle object\n *\n * @return {PIXI.Rectangle} the framing rectangle\n */\n Circle.prototype.getBounds = function () {\n return new Rectangle(this.x - this.radius, this.y - this.radius, this.radius * 2, this.radius * 2);\n };\n return Circle;\n}());\n\n/**\n * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects.\n *\n * @class\n * @memberof PIXI\n */\nvar Ellipse = /** @class */ (function () {\n /**\n * @param {number} [x=0] - The X coordinate of the center of this ellipse\n * @param {number} [y=0] - The Y coordinate of the center of this ellipse\n * @param {number} [halfWidth=0] - The half width of this ellipse\n * @param {number} [halfHeight=0] - The half height of this ellipse\n */\n function Ellipse(x, y, halfWidth, halfHeight) {\n if (x === void 0) { x = 0; }\n if (y === void 0) { y = 0; }\n if (halfWidth === void 0) { halfWidth = 0; }\n if (halfHeight === void 0) { halfHeight = 0; }\n /**\n * @member {number}\n * @default 0\n */\n this.x = x;\n /**\n * @member {number}\n * @default 0\n */\n this.y = y;\n /**\n * @member {number}\n * @default 0\n */\n this.width = halfWidth;\n /**\n * @member {number}\n * @default 0\n */\n this.height = halfHeight;\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n * @readOnly\n * @default PIXI.SHAPES.ELIP\n * @see PIXI.SHAPES\n */\n this.type = SHAPES.ELIP;\n }\n /**\n * Creates a clone of this Ellipse instance\n *\n * @return {PIXI.Ellipse} a copy of the ellipse\n */\n Ellipse.prototype.clone = function () {\n return new Ellipse(this.x, this.y, this.width, this.height);\n };\n /**\n * Checks whether the x and y coordinates given are contained within this ellipse\n *\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coords are within this ellipse\n */\n Ellipse.prototype.contains = function (x, y) {\n if (this.width <= 0 || this.height <= 0) {\n return false;\n }\n // normalize the coords to an ellipse with center 0,0\n var normx = ((x - this.x) / this.width);\n var normy = ((y - this.y) / this.height);\n normx *= normx;\n normy *= normy;\n return (normx + normy <= 1);\n };\n /**\n * Returns the framing rectangle of the ellipse as a Rectangle object\n *\n * @return {PIXI.Rectangle} the framing rectangle\n */\n Ellipse.prototype.getBounds = function () {\n return new Rectangle(this.x - this.width, this.y - this.height, this.width, this.height);\n };\n return Ellipse;\n}());\n\n/**\n * A class to define a shape via user defined co-orinates.\n *\n * @class\n * @memberof PIXI\n */\nvar Polygon = /** @class */ (function () {\n /**\n * @param {PIXI.IPoint[]|number[]} points - This can be an array of Points\n * that form the polygon, a flat array of numbers that will be interpreted as [x,y, x,y, ...], or\n * the arguments passed can be all the points of the polygon e.g.\n * `new PIXI.Polygon(new PIXI.Point(), new PIXI.Point(), ...)`, or the arguments passed can be flat\n * x,y values e.g. `new Polygon(x,y, x,y, x,y, ...)` where `x` and `y` are Numbers.\n */\n function Polygon() {\n var arguments$1 = arguments;\n\n var points = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n points[_i] = arguments$1[_i];\n }\n var flat = Array.isArray(points[0]) ? points[0] : points;\n // if this is an array of points, convert it to a flat array of numbers\n if (typeof flat[0] !== 'number') {\n var p = [];\n for (var i = 0, il = flat.length; i < il; i++) {\n p.push(flat[i].x, flat[i].y);\n }\n flat = p;\n }\n /**\n * An array of the points of this polygon\n *\n * @member {number[]}\n */\n this.points = flat;\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n * @readOnly\n * @default PIXI.SHAPES.POLY\n * @see PIXI.SHAPES\n */\n this.type = SHAPES.POLY;\n /**\n * `false` after moveTo, `true` after `closePath`. In all other cases it is `true`.\n * @member {boolean}\n * @default true\n */\n this.closeStroke = true;\n }\n /**\n * Creates a clone of this polygon\n *\n * @return {PIXI.Polygon} a copy of the polygon\n */\n Polygon.prototype.clone = function () {\n var points = this.points.slice();\n var polygon = new Polygon(points);\n polygon.closeStroke = this.closeStroke;\n return polygon;\n };\n /**\n * Checks whether the x and y coordinates passed to this function are contained within this polygon\n *\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coordinates are within this polygon\n */\n Polygon.prototype.contains = function (x, y) {\n var inside = false;\n // use some raycasting to test hits\n // https://github.com/substack/point-in-polygon/blob/master/index.js\n var length = this.points.length / 2;\n for (var i = 0, j = length - 1; i < length; j = i++) {\n var xi = this.points[i * 2];\n var yi = this.points[(i * 2) + 1];\n var xj = this.points[j * 2];\n var yj = this.points[(j * 2) + 1];\n var intersect = ((yi > y) !== (yj > y)) && (x < ((xj - xi) * ((y - yi) / (yj - yi))) + xi);\n if (intersect) {\n inside = !inside;\n }\n }\n return inside;\n };\n return Polygon;\n}());\n\n/**\n * The Rounded Rectangle object is an area that has nice rounded corners, as indicated by its\n * top-left corner point (x, y) and by its width and its height and its radius.\n *\n * @class\n * @memberof PIXI\n */\nvar RoundedRectangle = /** @class */ (function () {\n /**\n * @param {number} [x=0] - The X coordinate of the upper-left corner of the rounded rectangle\n * @param {number} [y=0] - The Y coordinate of the upper-left corner of the rounded rectangle\n * @param {number} [width=0] - The overall width of this rounded rectangle\n * @param {number} [height=0] - The overall height of this rounded rectangle\n * @param {number} [radius=20] - Controls the radius of the rounded corners\n */\n function RoundedRectangle(x, y, width, height, radius) {\n if (x === void 0) { x = 0; }\n if (y === void 0) { y = 0; }\n if (width === void 0) { width = 0; }\n if (height === void 0) { height = 0; }\n if (radius === void 0) { radius = 20; }\n /**\n * @member {number}\n * @default 0\n */\n this.x = x;\n /**\n * @member {number}\n * @default 0\n */\n this.y = y;\n /**\n * @member {number}\n * @default 0\n */\n this.width = width;\n /**\n * @member {number}\n * @default 0\n */\n this.height = height;\n /**\n * @member {number}\n * @default 20\n */\n this.radius = radius;\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n * @readonly\n * @default PIXI.SHAPES.RREC\n * @see PIXI.SHAPES\n */\n this.type = SHAPES.RREC;\n }\n /**\n * Creates a clone of this Rounded Rectangle\n *\n * @return {PIXI.RoundedRectangle} a copy of the rounded rectangle\n */\n RoundedRectangle.prototype.clone = function () {\n return new RoundedRectangle(this.x, this.y, this.width, this.height, this.radius);\n };\n /**\n * Checks whether the x and y coordinates given are contained within this Rounded Rectangle\n *\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coordinates are within this Rounded Rectangle\n */\n RoundedRectangle.prototype.contains = function (x, y) {\n if (this.width <= 0 || this.height <= 0) {\n return false;\n }\n if (x >= this.x && x <= this.x + this.width) {\n if (y >= this.y && y <= this.y + this.height) {\n if ((y >= this.y + this.radius && y <= this.y + this.height - this.radius)\n || (x >= this.x + this.radius && x <= this.x + this.width - this.radius)) {\n return true;\n }\n var dx = x - (this.x + this.radius);\n var dy = y - (this.y + this.radius);\n var radius2 = this.radius * this.radius;\n if ((dx * dx) + (dy * dy) <= radius2) {\n return true;\n }\n dx = x - (this.x + this.width - this.radius);\n if ((dx * dx) + (dy * dy) <= radius2) {\n return true;\n }\n dy = y - (this.y + this.height - this.radius);\n if ((dx * dx) + (dy * dy) <= radius2) {\n return true;\n }\n dx = x - (this.x + this.radius);\n if ((dx * dx) + (dy * dy) <= radius2) {\n return true;\n }\n }\n }\n return false;\n };\n return RoundedRectangle;\n}());\n\n/**\n * Common interface for points. Both Point and ObservablePoint implement it\n * @memberof PIXI\n * @interface IPointData\n */\n/**\n * X coord\n * @memberof PIXI.IPointData#\n * @member {number} x\n */\n/**\n * Y coord\n * @memberof PIXI.IPointData#\n * @member {number} y\n */\n\n/**\n * Common interface for points. Both Point and ObservablePoint implement it\n * @memberof PIXI\n * @interface IPoint\n * @extends PIXI.IPointData\n */\n/**\n * Sets the point to a new x and y position.\n * If y is omitted, both x and y will be set to x.\n *\n * @method set\n * @memberof PIXI.IPoint#\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=x] - position of the point on the y axis\n */\n/**\n * Copies x and y from the given point\n * @method copyFrom\n * @memberof PIXI.IPoint#\n * @param {PIXI.IPointData} p - The point to copy from\n * @returns {this} Returns itself.\n */\n/**\n * Copies x and y into the given point\n * @method copyTo\n * @memberof PIXI.IPoint#\n * @param {PIXI.IPoint} p - The point to copy.\n * @returns {PIXI.IPoint} Given point with values updated\n */\n/**\n * Returns true if the given point is equal to this point\n *\n * @method equals\n * @memberof PIXI.IPoint#\n * @param {PIXI.IPointData} p - The point to check\n * @returns {boolean} Whether the given point equal to this point\n */\n\n/**\n * The Point object represents a location in a two-dimensional coordinate system, where x represents\n * the horizontal axis and y represents the vertical axis.\n *\n * @class\n * @memberof PIXI\n * @implements IPoint\n */\nvar Point = /** @class */ (function () {\n /**\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=0] - position of the point on the y axis\n */\n function Point(x, y) {\n if (x === void 0) { x = 0; }\n if (y === void 0) { y = 0; }\n /**\n * @member {number}\n * @default 0\n */\n this.x = x;\n /**\n * @member {number}\n * @default 0\n */\n this.y = y;\n }\n /**\n * Creates a clone of this point\n *\n * @return {PIXI.Point} a copy of the point\n */\n Point.prototype.clone = function () {\n return new Point(this.x, this.y);\n };\n /**\n * Copies x and y from the given point\n *\n * @param {PIXI.IPointData} p - The point to copy from\n * @returns {this} Returns itself.\n */\n Point.prototype.copyFrom = function (p) {\n this.set(p.x, p.y);\n return this;\n };\n /**\n * Copies x and y into the given point\n *\n * @param {PIXI.IPoint} p - The point to copy.\n * @returns {PIXI.IPoint} Given point with values updated\n */\n Point.prototype.copyTo = function (p) {\n p.set(this.x, this.y);\n return p;\n };\n /**\n * Returns true if the given point is equal to this point\n *\n * @param {PIXI.IPointData} p - The point to check\n * @returns {boolean} Whether the given point equal to this point\n */\n Point.prototype.equals = function (p) {\n return (p.x === this.x) && (p.y === this.y);\n };\n /**\n * Sets the point to a new x and y position.\n * If y is omitted, both x and y will be set to x.\n *\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=x] - position of the point on the y axis\n * @returns {this} Returns itself.\n */\n Point.prototype.set = function (x, y) {\n if (x === void 0) { x = 0; }\n if (y === void 0) { y = x; }\n this.x = x;\n this.y = y;\n return this;\n };\n return Point;\n}());\n\n/**\n * The Point object represents a location in a two-dimensional coordinate system, where x represents\n * the horizontal axis and y represents the vertical axis.\n *\n * An ObservablePoint is a point that triggers a callback when the point's position is changed.\n *\n * @class\n * @memberof PIXI\n * @implements IPoint\n */\nvar ObservablePoint = /** @class */ (function () {\n /**\n * @param {Function} cb - callback when changed\n * @param {object} scope - owner of callback\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=0] - position of the point on the y axis\n */\n function ObservablePoint(cb, scope, x, y) {\n if (x === void 0) { x = 0; }\n if (y === void 0) { y = 0; }\n this._x = x;\n this._y = y;\n this.cb = cb;\n this.scope = scope;\n }\n /**\n * Creates a clone of this point.\n * The callback and scope params can be overidden otherwise they will default\n * to the clone object's values.\n *\n * @override\n * @param {Function} [cb=null] - callback when changed\n * @param {object} [scope=null] - owner of callback\n * @return {PIXI.ObservablePoint} a copy of the point\n */\n ObservablePoint.prototype.clone = function (cb, scope) {\n if (cb === void 0) { cb = this.cb; }\n if (scope === void 0) { scope = this.scope; }\n return new ObservablePoint(cb, scope, this._x, this._y);\n };\n /**\n * Sets the point to a new x and y position.\n * If y is omitted, both x and y will be set to x.\n *\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=x] - position of the point on the y axis\n * @returns {this} Returns itself.\n */\n ObservablePoint.prototype.set = function (x, y) {\n if (x === void 0) { x = 0; }\n if (y === void 0) { y = x; }\n if (this._x !== x || this._y !== y) {\n this._x = x;\n this._y = y;\n this.cb.call(this.scope);\n }\n return this;\n };\n /**\n * Copies x and y from the given point\n *\n * @param {PIXI.IPointData} p - The point to copy from.\n * @returns {this} Returns itself.\n */\n ObservablePoint.prototype.copyFrom = function (p) {\n if (this._x !== p.x || this._y !== p.y) {\n this._x = p.x;\n this._y = p.y;\n this.cb.call(this.scope);\n }\n return this;\n };\n /**\n * Copies x and y into the given point\n *\n * @param {PIXI.IPoint} p - The point to copy.\n * @returns {PIXI.IPoint} Given point with values updated\n */\n ObservablePoint.prototype.copyTo = function (p) {\n p.set(this._x, this._y);\n return p;\n };\n /**\n * Returns true if the given point is equal to this point\n *\n * @param {PIXI.IPointData} p - The point to check\n * @returns {boolean} Whether the given point equal to this point\n */\n ObservablePoint.prototype.equals = function (p) {\n return (p.x === this._x) && (p.y === this._y);\n };\n Object.defineProperty(ObservablePoint.prototype, \"x\", {\n /**\n * The position of the displayObject on the x axis relative to the local coordinates of the parent.\n *\n * @member {number}\n */\n get: function () {\n return this._x;\n },\n set: function (value) {\n if (this._x !== value) {\n this._x = value;\n this.cb.call(this.scope);\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(ObservablePoint.prototype, \"y\", {\n /**\n * The position of the displayObject on the x axis relative to the local coordinates of the parent.\n *\n * @member {number}\n */\n get: function () {\n return this._y;\n },\n set: function (value) {\n if (this._y !== value) {\n this._y = value;\n this.cb.call(this.scope);\n }\n },\n enumerable: false,\n configurable: true\n });\n return ObservablePoint;\n}());\n\n/**\n * The PixiJS Matrix as a class makes it a lot faster.\n *\n * Here is a representation of it:\n * ```js\n * | a | c | tx|\n * | b | d | ty|\n * | 0 | 0 | 1 |\n * ```\n * @class\n * @memberof PIXI\n */\nvar Matrix = /** @class */ (function () {\n /**\n * @param {number} [a=1] - x scale\n * @param {number} [b=0] - x skew\n * @param {number} [c=0] - y skew\n * @param {number} [d=1] - y scale\n * @param {number} [tx=0] - x translation\n * @param {number} [ty=0] - y translation\n */\n function Matrix(a, b, c, d, tx, ty) {\n if (a === void 0) { a = 1; }\n if (b === void 0) { b = 0; }\n if (c === void 0) { c = 0; }\n if (d === void 0) { d = 1; }\n if (tx === void 0) { tx = 0; }\n if (ty === void 0) { ty = 0; }\n this.array = null;\n /**\n * @member {number}\n * @default 1\n */\n this.a = a;\n /**\n * @member {number}\n * @default 0\n */\n this.b = b;\n /**\n * @member {number}\n * @default 0\n */\n this.c = c;\n /**\n * @member {number}\n * @default 1\n */\n this.d = d;\n /**\n * @member {number}\n * @default 0\n */\n this.tx = tx;\n /**\n * @member {number}\n * @default 0\n */\n this.ty = ty;\n }\n /**\n * Creates a Matrix object based on the given array. The Element to Matrix mapping order is as follows:\n *\n * a = array[0]\n * b = array[1]\n * c = array[3]\n * d = array[4]\n * tx = array[2]\n * ty = array[5]\n *\n * @param {number[]} array - The array that the matrix will be populated from.\n */\n Matrix.prototype.fromArray = function (array) {\n this.a = array[0];\n this.b = array[1];\n this.c = array[3];\n this.d = array[4];\n this.tx = array[2];\n this.ty = array[5];\n };\n /**\n * sets the matrix properties\n *\n * @param {number} a - Matrix component\n * @param {number} b - Matrix component\n * @param {number} c - Matrix component\n * @param {number} d - Matrix component\n * @param {number} tx - Matrix component\n * @param {number} ty - Matrix component\n *\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n Matrix.prototype.set = function (a, b, c, d, tx, ty) {\n this.a = a;\n this.b = b;\n this.c = c;\n this.d = d;\n this.tx = tx;\n this.ty = ty;\n return this;\n };\n /**\n * Creates an array from the current Matrix object.\n *\n * @param {boolean} transpose - Whether we need to transpose the matrix or not\n * @param {Float32Array} [out=new Float32Array(9)] - If provided the array will be assigned to out\n * @return {number[]} the newly created array which contains the matrix\n */\n Matrix.prototype.toArray = function (transpose, out) {\n if (!this.array) {\n this.array = new Float32Array(9);\n }\n var array = out || this.array;\n if (transpose) {\n array[0] = this.a;\n array[1] = this.b;\n array[2] = 0;\n array[3] = this.c;\n array[4] = this.d;\n array[5] = 0;\n array[6] = this.tx;\n array[7] = this.ty;\n array[8] = 1;\n }\n else {\n array[0] = this.a;\n array[1] = this.c;\n array[2] = this.tx;\n array[3] = this.b;\n array[4] = this.d;\n array[5] = this.ty;\n array[6] = 0;\n array[7] = 0;\n array[8] = 1;\n }\n return array;\n };\n /**\n * Get a new position with the current transformation applied.\n * Can be used to go from a child's coordinate space to the world coordinate space. (e.g. rendering)\n *\n * @param {PIXI.IPointData} pos - The origin\n * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)\n * @return {PIXI.Point} The new point, transformed through this matrix\n */\n Matrix.prototype.apply = function (pos, newPos) {\n newPos = (newPos || new Point());\n var x = pos.x;\n var y = pos.y;\n newPos.x = (this.a * x) + (this.c * y) + this.tx;\n newPos.y = (this.b * x) + (this.d * y) + this.ty;\n return newPos;\n };\n /**\n * Get a new position with the inverse of the current transformation applied.\n * Can be used to go from the world coordinate space to a child's coordinate space. (e.g. input)\n *\n * @param {PIXI.IPointData} pos - The origin\n * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)\n * @return {PIXI.Point} The new point, inverse-transformed through this matrix\n */\n Matrix.prototype.applyInverse = function (pos, newPos) {\n newPos = (newPos || new Point());\n var id = 1 / ((this.a * this.d) + (this.c * -this.b));\n var x = pos.x;\n var y = pos.y;\n newPos.x = (this.d * id * x) + (-this.c * id * y) + (((this.ty * this.c) - (this.tx * this.d)) * id);\n newPos.y = (this.a * id * y) + (-this.b * id * x) + (((-this.ty * this.a) + (this.tx * this.b)) * id);\n return newPos;\n };\n /**\n * Translates the matrix on the x and y.\n *\n * @param {number} x - How much to translate x by\n * @param {number} y - How much to translate y by\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n Matrix.prototype.translate = function (x, y) {\n this.tx += x;\n this.ty += y;\n return this;\n };\n /**\n * Applies a scale transformation to the matrix.\n *\n * @param {number} x - The amount to scale horizontally\n * @param {number} y - The amount to scale vertically\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n Matrix.prototype.scale = function (x, y) {\n this.a *= x;\n this.d *= y;\n this.c *= x;\n this.b *= y;\n this.tx *= x;\n this.ty *= y;\n return this;\n };\n /**\n * Applies a rotation transformation to the matrix.\n *\n * @param {number} angle - The angle in radians.\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n Matrix.prototype.rotate = function (angle) {\n var cos = Math.cos(angle);\n var sin = Math.sin(angle);\n var a1 = this.a;\n var c1 = this.c;\n var tx1 = this.tx;\n this.a = (a1 * cos) - (this.b * sin);\n this.b = (a1 * sin) + (this.b * cos);\n this.c = (c1 * cos) - (this.d * sin);\n this.d = (c1 * sin) + (this.d * cos);\n this.tx = (tx1 * cos) - (this.ty * sin);\n this.ty = (tx1 * sin) + (this.ty * cos);\n return this;\n };\n /**\n * Appends the given Matrix to this Matrix.\n *\n * @param {PIXI.Matrix} matrix - The matrix to append.\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n Matrix.prototype.append = function (matrix) {\n var a1 = this.a;\n var b1 = this.b;\n var c1 = this.c;\n var d1 = this.d;\n this.a = (matrix.a * a1) + (matrix.b * c1);\n this.b = (matrix.a * b1) + (matrix.b * d1);\n this.c = (matrix.c * a1) + (matrix.d * c1);\n this.d = (matrix.c * b1) + (matrix.d * d1);\n this.tx = (matrix.tx * a1) + (matrix.ty * c1) + this.tx;\n this.ty = (matrix.tx * b1) + (matrix.ty * d1) + this.ty;\n return this;\n };\n /**\n * Sets the matrix based on all the available properties\n *\n * @param {number} x - Position on the x axis\n * @param {number} y - Position on the y axis\n * @param {number} pivotX - Pivot on the x axis\n * @param {number} pivotY - Pivot on the y axis\n * @param {number} scaleX - Scale on the x axis\n * @param {number} scaleY - Scale on the y axis\n * @param {number} rotation - Rotation in radians\n * @param {number} skewX - Skew on the x axis\n * @param {number} skewY - Skew on the y axis\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n Matrix.prototype.setTransform = function (x, y, pivotX, pivotY, scaleX, scaleY, rotation, skewX, skewY) {\n this.a = Math.cos(rotation + skewY) * scaleX;\n this.b = Math.sin(rotation + skewY) * scaleX;\n this.c = -Math.sin(rotation - skewX) * scaleY;\n this.d = Math.cos(rotation - skewX) * scaleY;\n this.tx = x - ((pivotX * this.a) + (pivotY * this.c));\n this.ty = y - ((pivotX * this.b) + (pivotY * this.d));\n return this;\n };\n /**\n * Prepends the given Matrix to this Matrix.\n *\n * @param {PIXI.Matrix} matrix - The matrix to prepend\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n Matrix.prototype.prepend = function (matrix) {\n var tx1 = this.tx;\n if (matrix.a !== 1 || matrix.b !== 0 || matrix.c !== 0 || matrix.d !== 1) {\n var a1 = this.a;\n var c1 = this.c;\n this.a = (a1 * matrix.a) + (this.b * matrix.c);\n this.b = (a1 * matrix.b) + (this.b * matrix.d);\n this.c = (c1 * matrix.a) + (this.d * matrix.c);\n this.d = (c1 * matrix.b) + (this.d * matrix.d);\n }\n this.tx = (tx1 * matrix.a) + (this.ty * matrix.c) + matrix.tx;\n this.ty = (tx1 * matrix.b) + (this.ty * matrix.d) + matrix.ty;\n return this;\n };\n /**\n * Decomposes the matrix (x, y, scaleX, scaleY, and rotation) and sets the properties on to a transform.\n *\n * @param {PIXI.Transform} transform - The transform to apply the properties to.\n * @return {PIXI.Transform} The transform with the newly applied properties\n */\n Matrix.prototype.decompose = function (transform) {\n // sort out rotation / skew..\n var a = this.a;\n var b = this.b;\n var c = this.c;\n var d = this.d;\n var skewX = -Math.atan2(-c, d);\n var skewY = Math.atan2(b, a);\n var delta = Math.abs(skewX + skewY);\n if (delta < 0.00001 || Math.abs(PI_2 - delta) < 0.00001) {\n transform.rotation = skewY;\n transform.skew.x = transform.skew.y = 0;\n }\n else {\n transform.rotation = 0;\n transform.skew.x = skewX;\n transform.skew.y = skewY;\n }\n // next set scale\n transform.scale.x = Math.sqrt((a * a) + (b * b));\n transform.scale.y = Math.sqrt((c * c) + (d * d));\n // next set position\n transform.position.x = this.tx;\n transform.position.y = this.ty;\n return transform;\n };\n /**\n * Inverts this matrix\n *\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n Matrix.prototype.invert = function () {\n var a1 = this.a;\n var b1 = this.b;\n var c1 = this.c;\n var d1 = this.d;\n var tx1 = this.tx;\n var n = (a1 * d1) - (b1 * c1);\n this.a = d1 / n;\n this.b = -b1 / n;\n this.c = -c1 / n;\n this.d = a1 / n;\n this.tx = ((c1 * this.ty) - (d1 * tx1)) / n;\n this.ty = -((a1 * this.ty) - (b1 * tx1)) / n;\n return this;\n };\n /**\n * Resets this Matrix to an identity (default) matrix.\n *\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n Matrix.prototype.identity = function () {\n this.a = 1;\n this.b = 0;\n this.c = 0;\n this.d = 1;\n this.tx = 0;\n this.ty = 0;\n return this;\n };\n /**\n * Creates a new Matrix object with the same values as this one.\n *\n * @return {PIXI.Matrix} A copy of this matrix. Good for chaining method calls.\n */\n Matrix.prototype.clone = function () {\n var matrix = new Matrix();\n matrix.a = this.a;\n matrix.b = this.b;\n matrix.c = this.c;\n matrix.d = this.d;\n matrix.tx = this.tx;\n matrix.ty = this.ty;\n return matrix;\n };\n /**\n * Changes the values of the given matrix to be the same as the ones in this matrix\n *\n * @param {PIXI.Matrix} matrix - The matrix to copy to.\n * @return {PIXI.Matrix} The matrix given in parameter with its values updated.\n */\n Matrix.prototype.copyTo = function (matrix) {\n matrix.a = this.a;\n matrix.b = this.b;\n matrix.c = this.c;\n matrix.d = this.d;\n matrix.tx = this.tx;\n matrix.ty = this.ty;\n return matrix;\n };\n /**\n * Changes the values of the matrix to be the same as the ones in given matrix\n *\n * @param {PIXI.Matrix} matrix - The matrix to copy from.\n * @return {PIXI.Matrix} this\n */\n Matrix.prototype.copyFrom = function (matrix) {\n this.a = matrix.a;\n this.b = matrix.b;\n this.c = matrix.c;\n this.d = matrix.d;\n this.tx = matrix.tx;\n this.ty = matrix.ty;\n return this;\n };\n Object.defineProperty(Matrix, \"IDENTITY\", {\n /**\n * A default (identity) matrix\n *\n * @static\n * @const\n * @member {PIXI.Matrix}\n */\n get: function () {\n return new Matrix();\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Matrix, \"TEMP_MATRIX\", {\n /**\n * A temp matrix\n *\n * @static\n * @const\n * @member {PIXI.Matrix}\n */\n get: function () {\n return new Matrix();\n },\n enumerable: false,\n configurable: true\n });\n return Matrix;\n}());\n\n// Your friendly neighbour https://en.wikipedia.org/wiki/Dihedral_group\n/*\n * Transform matrix for operation n is:\n * | ux | vx |\n * | uy | vy |\n */\nvar ux = [1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1, 0, 1];\nvar uy = [0, 1, 1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1];\nvar vx = [0, -1, -1, -1, 0, 1, 1, 1, 0, 1, 1, 1, 0, -1, -1, -1];\nvar vy = [1, 1, 0, -1, -1, -1, 0, 1, -1, -1, 0, 1, 1, 1, 0, -1];\n/**\n * [Cayley Table]{@link https://en.wikipedia.org/wiki/Cayley_table}\n * for the composition of each rotation in the dihederal group D8.\n *\n * @type number[][]\n * @private\n */\nvar rotationCayley = [];\n/**\n * Matrices for each `GD8Symmetry` rotation.\n *\n * @type Matrix[]\n * @private\n */\nvar rotationMatrices = [];\n/*\n * Alias for {@code Math.sign}.\n */\nvar signum = Math.sign;\n/*\n * Initializes `rotationCayley` and `rotationMatrices`. It is called\n * only once below.\n */\nfunction init() {\n for (var i = 0; i < 16; i++) {\n var row = [];\n rotationCayley.push(row);\n for (var j = 0; j < 16; j++) {\n /* Multiplies rotation matrices i and j. */\n var _ux = signum((ux[i] * ux[j]) + (vx[i] * uy[j]));\n var _uy = signum((uy[i] * ux[j]) + (vy[i] * uy[j]));\n var _vx = signum((ux[i] * vx[j]) + (vx[i] * vy[j]));\n var _vy = signum((uy[i] * vx[j]) + (vy[i] * vy[j]));\n /* Finds rotation matrix matching the product and pushes it. */\n for (var k = 0; k < 16; k++) {\n if (ux[k] === _ux && uy[k] === _uy\n && vx[k] === _vx && vy[k] === _vy) {\n row.push(k);\n break;\n }\n }\n }\n }\n for (var i = 0; i < 16; i++) {\n var mat = new Matrix();\n mat.set(ux[i], uy[i], vx[i], vy[i], 0, 0);\n rotationMatrices.push(mat);\n }\n}\ninit();\n/**\n * @memberof PIXI\n * @typedef {number} GD8Symmetry\n * @see PIXI.groupD8\n */\n/**\n * Implements the dihedral group D8, which is similar to\n * [group D4]{@link http://mathworld.wolfram.com/DihedralGroupD4.html};\n * D8 is the same but with diagonals, and it is used for texture\n * rotations.\n *\n * The directions the U- and V- axes after rotation\n * of an angle of `a: GD8Constant` are the vectors `(uX(a), uY(a))`\n * and `(vX(a), vY(a))`. These aren't necessarily unit vectors.\n *\n * **Origin:**
\n * This is the small part of gameofbombs.com portal system. It works.\n *\n * @see PIXI.groupD8.E\n * @see PIXI.groupD8.SE\n * @see PIXI.groupD8.S\n * @see PIXI.groupD8.SW\n * @see PIXI.groupD8.W\n * @see PIXI.groupD8.NW\n * @see PIXI.groupD8.N\n * @see PIXI.groupD8.NE\n * @author Ivan @ivanpopelyshev\n * @namespace PIXI.groupD8\n * @memberof PIXI\n */\nvar groupD8 = {\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 0° | East |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n E: 0,\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 45°↻ | Southeast |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n SE: 1,\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 90°↻ | South |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n S: 2,\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 135°↻ | Southwest |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n SW: 3,\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 180° | West |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n W: 4,\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -135°/225°↻ | Northwest |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n NW: 5,\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -90°/270°↻ | North |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n N: 6,\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -45°/315°↻ | Northeast |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n NE: 7,\n /**\n * Reflection about Y-axis.\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MIRROR_VERTICAL: 8,\n /**\n * Reflection about the main diagonal.\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MAIN_DIAGONAL: 10,\n /**\n * Reflection about X-axis.\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MIRROR_HORIZONTAL: 12,\n /**\n * Reflection about reverse diagonal.\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n REVERSE_DIAGONAL: 14,\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @return {PIXI.GD8Symmetry} The X-component of the U-axis\n * after rotating the axes.\n */\n uX: function (ind) { return ux[ind]; },\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @return {PIXI.GD8Symmetry} The Y-component of the U-axis\n * after rotating the axes.\n */\n uY: function (ind) { return uy[ind]; },\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @return {PIXI.GD8Symmetry} The X-component of the V-axis\n * after rotating the axes.\n */\n vX: function (ind) { return vx[ind]; },\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @return {PIXI.GD8Symmetry} The Y-component of the V-axis\n * after rotating the axes.\n */\n vY: function (ind) { return vy[ind]; },\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotation - symmetry whose opposite\n * is needed. Only rotations have opposite symmetries while\n * reflections don't.\n * @return {PIXI.GD8Symmetry} The opposite symmetry of `rotation`\n */\n inv: function (rotation) {\n if (rotation & 8) // true only if between 8 & 15 (reflections)\n {\n return rotation & 15; // or rotation % 16\n }\n return (-rotation) & 7; // or (8 - rotation) % 8\n },\n /**\n * Composes the two D8 operations.\n *\n * Taking `^` as reflection:\n *\n * | | E=0 | S=2 | W=4 | N=6 | E^=8 | S^=10 | W^=12 | N^=14 |\n * |-------|-----|-----|-----|-----|------|-------|-------|-------|\n * | E=0 | E | S | W | N | E^ | S^ | W^ | N^ |\n * | S=2 | S | W | N | E | S^ | W^ | N^ | E^ |\n * | W=4 | W | N | E | S | W^ | N^ | E^ | S^ |\n * | N=6 | N | E | S | W | N^ | E^ | S^ | W^ |\n * | E^=8 | E^ | N^ | W^ | S^ | E | N | W | S |\n * | S^=10 | S^ | E^ | N^ | W^ | S | E | N | W |\n * | W^=12 | W^ | S^ | E^ | N^ | W | S | E | N |\n * | N^=14 | N^ | W^ | S^ | E^ | N | W | S | E |\n *\n * [This is a Cayley table]{@link https://en.wikipedia.org/wiki/Cayley_table}\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotationSecond - Second operation, which\n * is the row in the above cayley table.\n * @param {PIXI.GD8Symmetry} rotationFirst - First operation, which\n * is the column in the above cayley table.\n * @return {PIXI.GD8Symmetry} Composed operation\n */\n add: function (rotationSecond, rotationFirst) { return (rotationCayley[rotationSecond][rotationFirst]); },\n /**\n * Reverse of `add`.\n *\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotationSecond - Second operation\n * @param {PIXI.GD8Symmetry} rotationFirst - First operation\n * @return {PIXI.GD8Symmetry} Result\n */\n sub: function (rotationSecond, rotationFirst) { return (rotationCayley[rotationSecond][groupD8.inv(rotationFirst)]); },\n /**\n * Adds 180 degrees to rotation, which is a commutative\n * operation.\n *\n * @memberof PIXI.groupD8\n * @param {number} rotation - The number to rotate.\n * @returns {number} Rotated number\n */\n rotate180: function (rotation) { return rotation ^ 4; },\n /**\n * Checks if the rotation angle is vertical, i.e. south\n * or north. It doesn't work for reflections.\n *\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotation - The number to check.\n * @returns {boolean} Whether or not the direction is vertical\n */\n isVertical: function (rotation) { return (rotation & 3) === 2; },\n /**\n * Approximates the vector `V(dx,dy)` into one of the\n * eight directions provided by `groupD8`.\n *\n * @memberof PIXI.groupD8\n * @param {number} dx - X-component of the vector\n * @param {number} dy - Y-component of the vector\n * @return {PIXI.GD8Symmetry} Approximation of the vector into\n * one of the eight symmetries.\n */\n byDirection: function (dx, dy) {\n if (Math.abs(dx) * 2 <= Math.abs(dy)) {\n if (dy >= 0) {\n return groupD8.S;\n }\n return groupD8.N;\n }\n else if (Math.abs(dy) * 2 <= Math.abs(dx)) {\n if (dx > 0) {\n return groupD8.E;\n }\n return groupD8.W;\n }\n else if (dy > 0) {\n if (dx > 0) {\n return groupD8.SE;\n }\n return groupD8.SW;\n }\n else if (dx > 0) {\n return groupD8.NE;\n }\n return groupD8.NW;\n },\n /**\n * Helps sprite to compensate texture packer rotation.\n *\n * @memberof PIXI.groupD8\n * @param {PIXI.Matrix} matrix - sprite world matrix\n * @param {PIXI.GD8Symmetry} rotation - The rotation factor to use.\n * @param {number} tx - sprite anchoring\n * @param {number} ty - sprite anchoring\n */\n matrixAppendRotationInv: function (matrix, rotation, tx, ty) {\n if (tx === void 0) { tx = 0; }\n if (ty === void 0) { ty = 0; }\n // Packer used \"rotation\", we use \"inv(rotation)\"\n var mat = rotationMatrices[groupD8.inv(rotation)];\n mat.tx = tx;\n mat.ty = ty;\n matrix.append(mat);\n },\n};\n\n/**\n * Transform that takes care about its versions\n *\n * @class\n * @memberof PIXI\n */\nvar Transform = /** @class */ (function () {\n function Transform() {\n /**\n * The world transformation matrix.\n *\n * @member {PIXI.Matrix}\n */\n this.worldTransform = new Matrix();\n /**\n * The local transformation matrix.\n *\n * @member {PIXI.Matrix}\n */\n this.localTransform = new Matrix();\n /**\n * The coordinate of the object relative to the local coordinates of the parent.\n *\n * @member {PIXI.ObservablePoint}\n */\n this.position = new ObservablePoint(this.onChange, this, 0, 0);\n /**\n * The scale factor of the object.\n *\n * @member {PIXI.ObservablePoint}\n */\n this.scale = new ObservablePoint(this.onChange, this, 1, 1);\n /**\n * The pivot point of the displayObject that it rotates around.\n *\n * @member {PIXI.ObservablePoint}\n */\n this.pivot = new ObservablePoint(this.onChange, this, 0, 0);\n /**\n * The skew amount, on the x and y axis.\n *\n * @member {PIXI.ObservablePoint}\n */\n this.skew = new ObservablePoint(this.updateSkew, this, 0, 0);\n /**\n * The rotation amount.\n *\n * @protected\n * @member {number}\n */\n this._rotation = 0;\n /**\n * The X-coordinate value of the normalized local X axis,\n * the first column of the local transformation matrix without a scale.\n *\n * @protected\n * @member {number}\n */\n this._cx = 1;\n /**\n * The Y-coordinate value of the normalized local X axis,\n * the first column of the local transformation matrix without a scale.\n *\n * @protected\n * @member {number}\n */\n this._sx = 0;\n /**\n * The X-coordinate value of the normalized local Y axis,\n * the second column of the local transformation matrix without a scale.\n *\n * @protected\n * @member {number}\n */\n this._cy = 0;\n /**\n * The Y-coordinate value of the normalized local Y axis,\n * the second column of the local transformation matrix without a scale.\n *\n * @protected\n * @member {number}\n */\n this._sy = 1;\n /**\n * The locally unique ID of the local transform.\n *\n * @protected\n * @member {number}\n */\n this._localID = 0;\n /**\n * The locally unique ID of the local transform\n * used to calculate the current local transformation matrix.\n *\n * @protected\n * @member {number}\n */\n this._currentLocalID = 0;\n /**\n * The locally unique ID of the world transform.\n *\n * @protected\n * @member {number}\n */\n this._worldID = 0;\n /**\n * The locally unique ID of the parent's world transform\n * used to calculate the current world transformation matrix.\n *\n * @protected\n * @member {number}\n */\n this._parentID = 0;\n }\n /**\n * Called when a value changes.\n *\n * @protected\n */\n Transform.prototype.onChange = function () {\n this._localID++;\n };\n /**\n * Called when the skew or the rotation changes.\n *\n * @protected\n */\n Transform.prototype.updateSkew = function () {\n this._cx = Math.cos(this._rotation + this.skew.y);\n this._sx = Math.sin(this._rotation + this.skew.y);\n this._cy = -Math.sin(this._rotation - this.skew.x); // cos, added PI/2\n this._sy = Math.cos(this._rotation - this.skew.x); // sin, added PI/2\n this._localID++;\n };\n /**\n * Updates the local transformation matrix.\n */\n Transform.prototype.updateLocalTransform = function () {\n var lt = this.localTransform;\n if (this._localID !== this._currentLocalID) {\n // get the matrix values of the displayobject based on its transform properties..\n lt.a = this._cx * this.scale.x;\n lt.b = this._sx * this.scale.x;\n lt.c = this._cy * this.scale.y;\n lt.d = this._sy * this.scale.y;\n lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c));\n lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d));\n this._currentLocalID = this._localID;\n // force an update..\n this._parentID = -1;\n }\n };\n /**\n * Updates the local and the world transformation matrices.\n *\n * @param {PIXI.Transform} parentTransform - The parent transform\n */\n Transform.prototype.updateTransform = function (parentTransform) {\n var lt = this.localTransform;\n if (this._localID !== this._currentLocalID) {\n // get the matrix values of the displayobject based on its transform properties..\n lt.a = this._cx * this.scale.x;\n lt.b = this._sx * this.scale.x;\n lt.c = this._cy * this.scale.y;\n lt.d = this._sy * this.scale.y;\n lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c));\n lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d));\n this._currentLocalID = this._localID;\n // force an update..\n this._parentID = -1;\n }\n if (this._parentID !== parentTransform._worldID) {\n // concat the parent matrix with the objects transform.\n var pt = parentTransform.worldTransform;\n var wt = this.worldTransform;\n wt.a = (lt.a * pt.a) + (lt.b * pt.c);\n wt.b = (lt.a * pt.b) + (lt.b * pt.d);\n wt.c = (lt.c * pt.a) + (lt.d * pt.c);\n wt.d = (lt.c * pt.b) + (lt.d * pt.d);\n wt.tx = (lt.tx * pt.a) + (lt.ty * pt.c) + pt.tx;\n wt.ty = (lt.tx * pt.b) + (lt.ty * pt.d) + pt.ty;\n this._parentID = parentTransform._worldID;\n // update the id of the transform..\n this._worldID++;\n }\n };\n /**\n * Decomposes a matrix and sets the transforms properties based on it.\n *\n * @param {PIXI.Matrix} matrix - The matrix to decompose\n */\n Transform.prototype.setFromMatrix = function (matrix) {\n matrix.decompose(this);\n this._localID++;\n };\n Object.defineProperty(Transform.prototype, \"rotation\", {\n /**\n * The rotation of the object in radians.\n *\n * @member {number}\n */\n get: function () {\n return this._rotation;\n },\n set: function (value) {\n if (this._rotation !== value) {\n this._rotation = value;\n this.updateSkew();\n }\n },\n enumerable: false,\n configurable: true\n });\n /**\n * A default (identity) transform\n *\n * @static\n * @constant\n * @member {PIXI.Transform}\n */\n Transform.IDENTITY = new Transform();\n return Transform;\n}());\n\n/**\n * Math classes and utilities mixed into PIXI namespace.\n *\n * @lends PIXI\n */\n\n\n//# sourceMappingURL=math.es.js.map\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/@pixi/math/lib/math.es.js?"); /***/ }), /***/ "./node_modules/@pixi/mesh-extras/lib/mesh-extras.es.js": /*!**************************************************************!*\ !*** ./node_modules/@pixi/mesh-extras/lib/mesh-extras.es.js ***! \**************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"NineSlicePlane\": () => (/* binding */ NineSlicePlane),\n/* harmony export */ \"PlaneGeometry\": () => (/* binding */ PlaneGeometry),\n/* harmony export */ \"RopeGeometry\": () => (/* binding */ RopeGeometry),\n/* harmony export */ \"SimpleMesh\": () => (/* binding */ SimpleMesh),\n/* harmony export */ \"SimplePlane\": () => (/* binding */ SimplePlane),\n/* harmony export */ \"SimpleRope\": () => (/* binding */ SimpleRope)\n/* harmony export */ });\n/* harmony import */ var _pixi_mesh__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @pixi/mesh */ \"./node_modules/@pixi/mesh/lib/mesh.es.js\");\n/* harmony import */ var _pixi_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @pixi/constants */ \"./node_modules/@pixi/constants/lib/constants.es.js\");\n/* harmony import */ var _pixi_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @pixi/core */ \"./node_modules/@pixi/core/lib/core.es.js\");\n/*!\n * @pixi/mesh-extras - v5.3.11\n * Compiled Mon, 01 Nov 2021 16:10:12 UTC\n *\n * @pixi/mesh-extras is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n\n\n\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } };\r\n return extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\n\nvar PlaneGeometry = /** @class */ (function (_super) {\n __extends(PlaneGeometry, _super);\n function PlaneGeometry(width, height, segWidth, segHeight) {\n if (width === void 0) { width = 100; }\n if (height === void 0) { height = 100; }\n if (segWidth === void 0) { segWidth = 10; }\n if (segHeight === void 0) { segHeight = 10; }\n var _this = _super.call(this) || this;\n _this.segWidth = segWidth;\n _this.segHeight = segHeight;\n _this.width = width;\n _this.height = height;\n _this.build();\n return _this;\n }\n /**\n * Refreshes plane coordinates\n * @private\n */\n PlaneGeometry.prototype.build = function () {\n var total = this.segWidth * this.segHeight;\n var verts = [];\n var uvs = [];\n var indices = [];\n var segmentsX = this.segWidth - 1;\n var segmentsY = this.segHeight - 1;\n var sizeX = (this.width) / segmentsX;\n var sizeY = (this.height) / segmentsY;\n for (var i = 0; i < total; i++) {\n var x = (i % this.segWidth);\n var y = ((i / this.segWidth) | 0);\n verts.push(x * sizeX, y * sizeY);\n uvs.push(x / segmentsX, y / segmentsY);\n }\n var totalSub = segmentsX * segmentsY;\n for (var i = 0; i < totalSub; i++) {\n var xpos = i % segmentsX;\n var ypos = (i / segmentsX) | 0;\n var value = (ypos * this.segWidth) + xpos;\n var value2 = (ypos * this.segWidth) + xpos + 1;\n var value3 = ((ypos + 1) * this.segWidth) + xpos;\n var value4 = ((ypos + 1) * this.segWidth) + xpos + 1;\n indices.push(value, value2, value3, value2, value4, value3);\n }\n this.buffers[0].data = new Float32Array(verts);\n this.buffers[1].data = new Float32Array(uvs);\n this.indexBuffer.data = new Uint16Array(indices);\n // ensure that the changes are uploaded\n this.buffers[0].update();\n this.buffers[1].update();\n this.indexBuffer.update();\n };\n return PlaneGeometry;\n}(_pixi_mesh__WEBPACK_IMPORTED_MODULE_0__.MeshGeometry));\n\n/**\n * RopeGeometry allows you to draw a geometry across several points and then manipulate these points.\n *\n * ```js\n * for (let i = 0; i < 20; i++) {\n * points.push(new PIXI.Point(i * 50, 0));\n * };\n * const rope = new PIXI.RopeGeometry(100, points);\n * ```\n *\n * @class\n * @extends PIXI.MeshGeometry\n * @memberof PIXI\n *\n */\nvar RopeGeometry = /** @class */ (function (_super) {\n __extends(RopeGeometry, _super);\n /**\n * @param {number} [width=200] - The width (i.e., thickness) of the rope.\n * @param {PIXI.Point[]} [points] - An array of {@link PIXI.Point} objects to construct this rope.\n * @param {number} [textureScale=0] - By default the rope texture will be stretched to match\n * rope length. If textureScale is positive this value will be treated as a scaling\n * factor and the texture will preserve its aspect ratio instead. To create a tiling rope\n * set baseTexture.wrapMode to {@link PIXI.WRAP_MODES.REPEAT} and use a power of two texture,\n * then set textureScale=1 to keep the original texture pixel size.\n * In order to reduce alpha channel artifacts provide a larger texture and downsample -\n * i.e. set textureScale=0.5 to scale it down twice.\n */\n function RopeGeometry(width, points, textureScale) {\n if (width === void 0) { width = 200; }\n if (textureScale === void 0) { textureScale = 0; }\n var _this = _super.call(this, new Float32Array(points.length * 4), new Float32Array(points.length * 4), new Uint16Array((points.length - 1) * 6)) || this;\n /**\n * An array of points that determine the rope\n * @member {PIXI.Point[]}\n */\n _this.points = points;\n /**\n * The width (i.e., thickness) of the rope.\n * @member {number}\n * @readOnly\n */\n _this._width = width;\n /**\n * Rope texture scale, if zero then the rope texture is stretched.\n * @member {number}\n * @readOnly\n */\n _this.textureScale = textureScale;\n _this.build();\n return _this;\n }\n Object.defineProperty(RopeGeometry.prototype, \"width\", {\n /**\n * The width (i.e., thickness) of the rope.\n * @member {number}\n * @readOnly\n */\n get: function () {\n return this._width;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Refreshes Rope indices and uvs\n * @private\n */\n RopeGeometry.prototype.build = function () {\n var points = this.points;\n if (!points)\n { return; }\n var vertexBuffer = this.getBuffer('aVertexPosition');\n var uvBuffer = this.getBuffer('aTextureCoord');\n var indexBuffer = this.getIndex();\n // if too little points, or texture hasn't got UVs set yet just move on.\n if (points.length < 1) {\n return;\n }\n // if the number of points has changed we will need to recreate the arraybuffers\n if (vertexBuffer.data.length / 4 !== points.length) {\n vertexBuffer.data = new Float32Array(points.length * 4);\n uvBuffer.data = new Float32Array(points.length * 4);\n indexBuffer.data = new Uint16Array((points.length - 1) * 6);\n }\n var uvs = uvBuffer.data;\n var indices = indexBuffer.data;\n uvs[0] = 0;\n uvs[1] = 0;\n uvs[2] = 0;\n uvs[3] = 1;\n var amount = 0;\n var prev = points[0];\n var textureWidth = this._width * this.textureScale;\n var total = points.length; // - 1;\n for (var i = 0; i < total; i++) {\n // time to do some smart drawing!\n var index = i * 4;\n if (this.textureScale > 0) {\n // calculate pixel distance from previous point\n var dx = prev.x - points[i].x;\n var dy = prev.y - points[i].y;\n var distance = Math.sqrt((dx * dx) + (dy * dy));\n prev = points[i];\n amount += distance / textureWidth;\n }\n else {\n // stretch texture\n amount = i / (total - 1);\n }\n uvs[index] = amount;\n uvs[index + 1] = 0;\n uvs[index + 2] = amount;\n uvs[index + 3] = 1;\n }\n var indexCount = 0;\n for (var i = 0; i < total - 1; i++) {\n var index = i * 2;\n indices[indexCount++] = index;\n indices[indexCount++] = index + 1;\n indices[indexCount++] = index + 2;\n indices[indexCount++] = index + 2;\n indices[indexCount++] = index + 1;\n indices[indexCount++] = index + 3;\n }\n // ensure that the changes are uploaded\n uvBuffer.update();\n indexBuffer.update();\n this.updateVertices();\n };\n /**\n * refreshes vertices of Rope mesh\n */\n RopeGeometry.prototype.updateVertices = function () {\n var points = this.points;\n if (points.length < 1) {\n return;\n }\n var lastPoint = points[0];\n var nextPoint;\n var perpX = 0;\n var perpY = 0;\n var vertices = this.buffers[0].data;\n var total = points.length;\n for (var i = 0; i < total; i++) {\n var point = points[i];\n var index = i * 4;\n if (i < points.length - 1) {\n nextPoint = points[i + 1];\n }\n else {\n nextPoint = point;\n }\n perpY = -(nextPoint.x - lastPoint.x);\n perpX = nextPoint.y - lastPoint.y;\n var perpLength = Math.sqrt((perpX * perpX) + (perpY * perpY));\n var num = this.textureScale > 0 ? this.textureScale * this._width / 2 : this._width / 2;\n perpX /= perpLength;\n perpY /= perpLength;\n perpX *= num;\n perpY *= num;\n vertices[index] = point.x + perpX;\n vertices[index + 1] = point.y + perpY;\n vertices[index + 2] = point.x - perpX;\n vertices[index + 3] = point.y - perpY;\n lastPoint = point;\n }\n this.buffers[0].update();\n };\n RopeGeometry.prototype.update = function () {\n if (this.textureScale > 0) {\n this.build(); // we need to update UVs\n }\n else {\n this.updateVertices();\n }\n };\n return RopeGeometry;\n}(_pixi_mesh__WEBPACK_IMPORTED_MODULE_0__.MeshGeometry));\n\n/**\n * The rope allows you to draw a texture across several points and then manipulate these points\n *\n *```js\n * for (let i = 0; i < 20; i++) {\n * points.push(new PIXI.Point(i * 50, 0));\n * };\n * let rope = new PIXI.SimpleRope(PIXI.Texture.from(\"snake.png\"), points);\n * ```\n *\n * @class\n * @extends PIXI.Mesh\n * @memberof PIXI\n *\n */\nvar SimpleRope = /** @class */ (function (_super) {\n __extends(SimpleRope, _super);\n /**\n * @param {PIXI.Texture} texture - The texture to use on the rope.\n * @param {PIXI.Point[]} points - An array of {@link PIXI.Point} objects to construct this rope.\n * @param {number} [textureScale=0] - Optional. Positive values scale rope texture\n * keeping its aspect ratio. You can reduce alpha channel artifacts by providing a larger texture\n * and downsampling here. If set to zero, texture will be streched instead.\n */\n function SimpleRope(texture, points, textureScale) {\n if (textureScale === void 0) { textureScale = 0; }\n var _this = this;\n var ropeGeometry = new RopeGeometry(texture.height, points, textureScale);\n var meshMaterial = new _pixi_mesh__WEBPACK_IMPORTED_MODULE_0__.MeshMaterial(texture);\n if (textureScale > 0) {\n // attempt to set UV wrapping, will fail on non-power of two textures\n texture.baseTexture.wrapMode = _pixi_constants__WEBPACK_IMPORTED_MODULE_1__.WRAP_MODES.REPEAT;\n }\n _this = _super.call(this, ropeGeometry, meshMaterial) || this;\n /**\n * re-calculate vertices by rope points each frame\n *\n * @member {boolean}\n */\n _this.autoUpdate = true;\n return _this;\n }\n SimpleRope.prototype._render = function (renderer) {\n var geometry = this.geometry;\n if (this.autoUpdate || geometry._width !== this.shader.texture.height) {\n geometry._width = this.shader.texture.height;\n geometry.update();\n }\n _super.prototype._render.call(this, renderer);\n };\n return SimpleRope;\n}(_pixi_mesh__WEBPACK_IMPORTED_MODULE_0__.Mesh));\n\n/**\n * The SimplePlane allows you to draw a texture across several points and then manipulate these points\n *\n *```js\n * for (let i = 0; i < 20; i++) {\n * points.push(new PIXI.Point(i * 50, 0));\n * };\n * let SimplePlane = new PIXI.SimplePlane(PIXI.Texture.from(\"snake.png\"), points);\n * ```\n *\n * @class\n * @extends PIXI.Mesh\n * @memberof PIXI\n *\n */\nvar SimplePlane = /** @class */ (function (_super) {\n __extends(SimplePlane, _super);\n /**\n * @param {PIXI.Texture} texture - The texture to use on the SimplePlane.\n * @param {number} verticesX - The number of vertices in the x-axis\n * @param {number} verticesY - The number of vertices in the y-axis\n */\n function SimplePlane(texture, verticesX, verticesY) {\n var _this = this;\n var planeGeometry = new PlaneGeometry(texture.width, texture.height, verticesX, verticesY);\n var meshMaterial = new _pixi_mesh__WEBPACK_IMPORTED_MODULE_0__.MeshMaterial(_pixi_core__WEBPACK_IMPORTED_MODULE_2__.Texture.WHITE);\n _this = _super.call(this, planeGeometry, meshMaterial) || this;\n // lets call the setter to ensure all necessary updates are performed\n _this.texture = texture;\n return _this;\n }\n /**\n * Method used for overrides, to do something in case texture frame was changed.\n * Meshes based on plane can override it and change more details based on texture.\n */\n SimplePlane.prototype.textureUpdated = function () {\n this._textureID = this.shader.texture._updateID;\n var geometry = this.geometry;\n geometry.width = this.shader.texture.width;\n geometry.height = this.shader.texture.height;\n geometry.build();\n };\n Object.defineProperty(SimplePlane.prototype, \"texture\", {\n get: function () {\n return this.shader.texture;\n },\n set: function (value) {\n // Track texture same way sprite does.\n // For generated meshes like NineSlicePlane it can change the geometry.\n // Unfortunately, this method might not work if you directly change texture in material.\n if (this.shader.texture === value) {\n return;\n }\n this.shader.texture = value;\n this._textureID = -1;\n if (value.baseTexture.valid) {\n this.textureUpdated();\n }\n else {\n value.once('update', this.textureUpdated, this);\n }\n },\n enumerable: false,\n configurable: true\n });\n SimplePlane.prototype._render = function (renderer) {\n if (this._textureID !== this.shader.texture._updateID) {\n this.textureUpdated();\n }\n _super.prototype._render.call(this, renderer);\n };\n SimplePlane.prototype.destroy = function (options) {\n this.shader.texture.off('update', this.textureUpdated, this);\n _super.prototype.destroy.call(this, options);\n };\n return SimplePlane;\n}(_pixi_mesh__WEBPACK_IMPORTED_MODULE_0__.Mesh));\n\n/**\n * The Simple Mesh class mimics Mesh in PixiJS v4, providing easy-to-use constructor arguments.\n * For more robust customization, use {@link PIXI.Mesh}.\n *\n * @class\n * @extends PIXI.Mesh\n * @memberof PIXI\n */\nvar SimpleMesh = /** @class */ (function (_super) {\n __extends(SimpleMesh, _super);\n /**\n * @param {PIXI.Texture} [texture=Texture.EMPTY] - The texture to use\n * @param {Float32Array} [vertices] - if you want to specify the vertices\n * @param {Float32Array} [uvs] - if you want to specify the uvs\n * @param {Uint16Array} [indices] - if you want to specify the indices\n * @param {number} [drawMode] - the drawMode, can be any of the Mesh.DRAW_MODES consts\n */\n function SimpleMesh(texture, vertices, uvs, indices, drawMode) {\n if (texture === void 0) { texture = _pixi_core__WEBPACK_IMPORTED_MODULE_2__.Texture.EMPTY; }\n var _this = this;\n var geometry = new _pixi_mesh__WEBPACK_IMPORTED_MODULE_0__.MeshGeometry(vertices, uvs, indices);\n geometry.getBuffer('aVertexPosition').static = false;\n var meshMaterial = new _pixi_mesh__WEBPACK_IMPORTED_MODULE_0__.MeshMaterial(texture);\n _this = _super.call(this, geometry, meshMaterial, null, drawMode) || this;\n /**\n * upload vertices buffer each frame\n * @member {boolean}\n */\n _this.autoUpdate = true;\n return _this;\n }\n Object.defineProperty(SimpleMesh.prototype, \"vertices\", {\n /**\n * Collection of vertices data.\n * @member {Float32Array}\n */\n get: function () {\n return this.geometry.getBuffer('aVertexPosition').data;\n },\n set: function (value) {\n this.geometry.getBuffer('aVertexPosition').data = value;\n },\n enumerable: false,\n configurable: true\n });\n SimpleMesh.prototype._render = function (renderer) {\n if (this.autoUpdate) {\n this.geometry.getBuffer('aVertexPosition').update();\n }\n _super.prototype._render.call(this, renderer);\n };\n return SimpleMesh;\n}(_pixi_mesh__WEBPACK_IMPORTED_MODULE_0__.Mesh));\n\nvar DEFAULT_BORDER_SIZE = 10;\n/**\n * The NineSlicePlane allows you to stretch a texture using 9-slice scaling. The corners will remain unscaled (useful\n * for buttons with rounded corners for example) and the other areas will be scaled horizontally and or vertically\n *\n *```js\n * let Plane9 = new PIXI.NineSlicePlane(PIXI.Texture.from('BoxWithRoundedCorners.png'), 15, 15, 15, 15);\n * ```\n *
\n *      A                          B\n *    +---+----------------------+---+\n *  C | 1 |          2           | 3 |\n *    +---+----------------------+---+\n *    |   |                      |   |\n *    | 4 |          5           | 6 |\n *    |   |                      |   |\n *    +---+----------------------+---+\n *  D | 7 |          8           | 9 |\n *    +---+----------------------+---+\n\n *  When changing this objects width and/or height:\n *     areas 1 3 7 and 9 will remain unscaled.\n *     areas 2 and 8 will be stretched horizontally\n *     areas 4 and 6 will be stretched vertically\n *     area 5 will be stretched both horizontally and vertically\n * 
\n *\n * @class\n * @extends PIXI.SimplePlane\n * @memberof PIXI\n *\n */\nvar NineSlicePlane = /** @class */ (function (_super) {\n __extends(NineSlicePlane, _super);\n /**\n * @param {PIXI.Texture} texture - The texture to use on the NineSlicePlane.\n * @param {number} [leftWidth=10] - size of the left vertical bar (A)\n * @param {number} [topHeight=10] - size of the top horizontal bar (C)\n * @param {number} [rightWidth=10] - size of the right vertical bar (B)\n * @param {number} [bottomHeight=10] - size of the bottom horizontal bar (D)\n */\n function NineSlicePlane(texture, leftWidth, topHeight, rightWidth, bottomHeight) {\n if (leftWidth === void 0) { leftWidth = DEFAULT_BORDER_SIZE; }\n if (topHeight === void 0) { topHeight = DEFAULT_BORDER_SIZE; }\n if (rightWidth === void 0) { rightWidth = DEFAULT_BORDER_SIZE; }\n if (bottomHeight === void 0) { bottomHeight = DEFAULT_BORDER_SIZE; }\n var _this = _super.call(this, _pixi_core__WEBPACK_IMPORTED_MODULE_2__.Texture.WHITE, 4, 4) || this;\n _this._origWidth = texture.orig.width;\n _this._origHeight = texture.orig.height;\n /**\n * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane\n *\n * @member {number}\n * @override\n */\n _this._width = _this._origWidth;\n /**\n * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane\n *\n * @member {number}\n * @override\n */\n _this._height = _this._origHeight;\n /**\n * The width of the left column (a)\n *\n * @member {number}\n * @private\n */\n _this._leftWidth = leftWidth;\n /**\n * The width of the right column (b)\n *\n * @member {number}\n * @private\n */\n _this._rightWidth = rightWidth;\n /**\n * The height of the top row (c)\n *\n * @member {number}\n * @private\n */\n _this._topHeight = topHeight;\n /**\n * The height of the bottom row (d)\n *\n * @member {number}\n * @private\n */\n _this._bottomHeight = bottomHeight;\n // lets call the setter to ensure all necessary updates are performed\n _this.texture = texture;\n return _this;\n }\n NineSlicePlane.prototype.textureUpdated = function () {\n this._textureID = this.shader.texture._updateID;\n this._refresh();\n };\n Object.defineProperty(NineSlicePlane.prototype, \"vertices\", {\n get: function () {\n return this.geometry.getBuffer('aVertexPosition').data;\n },\n set: function (value) {\n this.geometry.getBuffer('aVertexPosition').data = value;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Updates the horizontal vertices.\n *\n */\n NineSlicePlane.prototype.updateHorizontalVertices = function () {\n var vertices = this.vertices;\n var scale = this._getMinScale();\n vertices[9] = vertices[11] = vertices[13] = vertices[15] = this._topHeight * scale;\n vertices[17] = vertices[19] = vertices[21] = vertices[23] = this._height - (this._bottomHeight * scale);\n vertices[25] = vertices[27] = vertices[29] = vertices[31] = this._height;\n };\n /**\n * Updates the vertical vertices.\n *\n */\n NineSlicePlane.prototype.updateVerticalVertices = function () {\n var vertices = this.vertices;\n var scale = this._getMinScale();\n vertices[2] = vertices[10] = vertices[18] = vertices[26] = this._leftWidth * scale;\n vertices[4] = vertices[12] = vertices[20] = vertices[28] = this._width - (this._rightWidth * scale);\n vertices[6] = vertices[14] = vertices[22] = vertices[30] = this._width;\n };\n /**\n * Returns the smaller of a set of vertical and horizontal scale of nine slice corners.\n *\n * @return {number} Smaller number of vertical and horizontal scale.\n * @private\n */\n NineSlicePlane.prototype._getMinScale = function () {\n var w = this._leftWidth + this._rightWidth;\n var scaleW = this._width > w ? 1.0 : this._width / w;\n var h = this._topHeight + this._bottomHeight;\n var scaleH = this._height > h ? 1.0 : this._height / h;\n var scale = Math.min(scaleW, scaleH);\n return scale;\n };\n Object.defineProperty(NineSlicePlane.prototype, \"width\", {\n /**\n * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane\n *\n * @member {number}\n */\n get: function () {\n return this._width;\n },\n set: function (value) {\n this._width = value;\n this._refresh();\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(NineSlicePlane.prototype, \"height\", {\n /**\n * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane\n *\n * @member {number}\n */\n get: function () {\n return this._height;\n },\n set: function (value) {\n this._height = value;\n this._refresh();\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(NineSlicePlane.prototype, \"leftWidth\", {\n /**\n * The width of the left column\n *\n * @member {number}\n */\n get: function () {\n return this._leftWidth;\n },\n set: function (value) {\n this._leftWidth = value;\n this._refresh();\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(NineSlicePlane.prototype, \"rightWidth\", {\n /**\n * The width of the right column\n *\n * @member {number}\n */\n get: function () {\n return this._rightWidth;\n },\n set: function (value) {\n this._rightWidth = value;\n this._refresh();\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(NineSlicePlane.prototype, \"topHeight\", {\n /**\n * The height of the top row\n *\n * @member {number}\n */\n get: function () {\n return this._topHeight;\n },\n set: function (value) {\n this._topHeight = value;\n this._refresh();\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(NineSlicePlane.prototype, \"bottomHeight\", {\n /**\n * The height of the bottom row\n *\n * @member {number}\n */\n get: function () {\n return this._bottomHeight;\n },\n set: function (value) {\n this._bottomHeight = value;\n this._refresh();\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Refreshes NineSlicePlane coords. All of them.\n */\n NineSlicePlane.prototype._refresh = function () {\n var texture = this.texture;\n var uvs = this.geometry.buffers[1].data;\n this._origWidth = texture.orig.width;\n this._origHeight = texture.orig.height;\n var _uvw = 1.0 / this._origWidth;\n var _uvh = 1.0 / this._origHeight;\n uvs[0] = uvs[8] = uvs[16] = uvs[24] = 0;\n uvs[1] = uvs[3] = uvs[5] = uvs[7] = 0;\n uvs[6] = uvs[14] = uvs[22] = uvs[30] = 1;\n uvs[25] = uvs[27] = uvs[29] = uvs[31] = 1;\n uvs[2] = uvs[10] = uvs[18] = uvs[26] = _uvw * this._leftWidth;\n uvs[4] = uvs[12] = uvs[20] = uvs[28] = 1 - (_uvw * this._rightWidth);\n uvs[9] = uvs[11] = uvs[13] = uvs[15] = _uvh * this._topHeight;\n uvs[17] = uvs[19] = uvs[21] = uvs[23] = 1 - (_uvh * this._bottomHeight);\n this.updateHorizontalVertices();\n this.updateVerticalVertices();\n this.geometry.buffers[0].update();\n this.geometry.buffers[1].update();\n };\n return NineSlicePlane;\n}(SimplePlane));\n\n\n//# sourceMappingURL=mesh-extras.es.js.map\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/@pixi/mesh-extras/lib/mesh-extras.es.js?"); /***/ }), /***/ "./node_modules/@pixi/mesh/lib/mesh.es.js": /*!************************************************!*\ !*** ./node_modules/@pixi/mesh/lib/mesh.es.js ***! \************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Mesh\": () => (/* binding */ Mesh),\n/* harmony export */ \"MeshBatchUvs\": () => (/* binding */ MeshBatchUvs),\n/* harmony export */ \"MeshGeometry\": () => (/* binding */ MeshGeometry),\n/* harmony export */ \"MeshMaterial\": () => (/* binding */ MeshMaterial)\n/* harmony export */ });\n/* harmony import */ var _pixi_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @pixi/core */ \"./node_modules/@pixi/core/lib/core.es.js\");\n/* harmony import */ var _pixi_math__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @pixi/math */ \"./node_modules/@pixi/math/lib/math.es.js\");\n/* harmony import */ var _pixi_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @pixi/constants */ \"./node_modules/@pixi/constants/lib/constants.es.js\");\n/* harmony import */ var _pixi_display__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @pixi/display */ \"./node_modules/@pixi/display/lib/display.es.js\");\n/* harmony import */ var _pixi_settings__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @pixi/settings */ \"./node_modules/@pixi/settings/lib/settings.es.js\");\n/* harmony import */ var _pixi_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @pixi/utils */ \"./node_modules/@pixi/utils/lib/utils.es.js\");\n/*!\n * @pixi/mesh - v5.3.11\n * Compiled Mon, 01 Nov 2021 16:10:12 UTC\n *\n * @pixi/mesh is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n\n\n\n\n\n\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } };\r\n return extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\n\n/**\n * Class controls cache for UV mapping from Texture normal space to BaseTexture normal space.\n *\n * @class\n * @memberof PIXI\n */\nvar MeshBatchUvs = /** @class */ (function () {\n /**\n * @param {PIXI.Buffer} uvBuffer - Buffer with normalized uv's\n * @param {PIXI.TextureMatrix} uvMatrix - Material UV matrix\n */\n function MeshBatchUvs(uvBuffer, uvMatrix) {\n /**\n * Buffer with normalized UV's\n * @member {PIXI.Buffer}\n */\n this.uvBuffer = uvBuffer;\n /**\n * Material UV matrix\n * @member {PIXI.TextureMatrix}\n */\n this.uvMatrix = uvMatrix;\n /**\n * UV Buffer data\n * @member {Float32Array}\n * @readonly\n */\n this.data = null;\n this._bufferUpdateId = -1;\n this._textureUpdateId = -1;\n this._updateID = 0;\n }\n /**\n * updates\n *\n * @param {boolean} [forceUpdate] - force the update\n */\n MeshBatchUvs.prototype.update = function (forceUpdate) {\n if (!forceUpdate\n && this._bufferUpdateId === this.uvBuffer._updateID\n && this._textureUpdateId === this.uvMatrix._updateID) {\n return;\n }\n this._bufferUpdateId = this.uvBuffer._updateID;\n this._textureUpdateId = this.uvMatrix._updateID;\n var data = this.uvBuffer.data;\n if (!this.data || this.data.length !== data.length) {\n this.data = new Float32Array(data.length);\n }\n this.uvMatrix.multiplyUvs(data, this.data);\n this._updateID++;\n };\n return MeshBatchUvs;\n}());\n\nvar tempPoint = new _pixi_math__WEBPACK_IMPORTED_MODULE_1__.Point();\nvar tempPolygon = new _pixi_math__WEBPACK_IMPORTED_MODULE_1__.Polygon();\n/**\n * Base mesh class.\n *\n * This class empowers you to have maximum flexibility to render any kind of WebGL visuals you can think of.\n * This class assumes a certain level of WebGL knowledge.\n * If you know a bit this should abstract enough away to make you life easier!\n *\n * Pretty much ALL WebGL can be broken down into the following:\n * - Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc..\n * - Shader - This is the shader that PixiJS will render the geometry with (attributes in the shader must match the geometry)\n * - State - This is the state of WebGL required to render the mesh.\n *\n * Through a combination of the above elements you can render anything you want, 2D or 3D!\n *\n * @class\n * @extends PIXI.Container\n * @memberof PIXI\n */\nvar Mesh = /** @class */ (function (_super) {\n __extends(Mesh, _super);\n /**\n * @param {PIXI.Geometry} geometry - the geometry the mesh will use\n * @param {PIXI.MeshMaterial} shader - the shader the mesh will use\n * @param {PIXI.State} [state] - the state that the WebGL context is required to be in to render the mesh\n * if no state is provided, uses {@link PIXI.State.for2d} to create a 2D state for PixiJS.\n * @param {number} [drawMode=PIXI.DRAW_MODES.TRIANGLES] - the drawMode, can be any of the PIXI.DRAW_MODES consts\n */\n function Mesh(geometry, shader, state, drawMode) {\n if (drawMode === void 0) { drawMode = _pixi_constants__WEBPACK_IMPORTED_MODULE_2__.DRAW_MODES.TRIANGLES; }\n var _this = _super.call(this) || this;\n /**\n * Includes vertex positions, face indices, normals, colors, UVs, and\n * custom attributes within buffers, reducing the cost of passing all\n * this data to the GPU. Can be shared between multiple Mesh objects.\n * @member {PIXI.Geometry}\n * @readonly\n */\n _this.geometry = geometry;\n geometry.refCount++;\n /**\n * Represents the vertex and fragment shaders that processes the geometry and runs on the GPU.\n * Can be shared between multiple Mesh objects.\n * @member {PIXI.Shader|PIXI.MeshMaterial}\n */\n _this.shader = shader;\n /**\n * Represents the WebGL state the Mesh required to render, excludes shader and geometry. E.g.,\n * blend mode, culling, depth testing, direction of rendering triangles, backface, etc.\n * @member {PIXI.State}\n */\n _this.state = state || _pixi_core__WEBPACK_IMPORTED_MODULE_0__.State.for2d();\n /**\n * The way the Mesh should be drawn, can be any of the {@link PIXI.DRAW_MODES} constants.\n *\n * @member {number}\n * @see PIXI.DRAW_MODES\n */\n _this.drawMode = drawMode;\n /**\n * Typically the index of the IndexBuffer where to start drawing.\n * @member {number}\n * @default 0\n */\n _this.start = 0;\n /**\n * How much of the geometry to draw, by default `0` renders everything.\n * @member {number}\n * @default 0\n */\n _this.size = 0;\n /**\n * thease are used as easy access for batching\n * @member {Float32Array}\n * @private\n */\n _this.uvs = null;\n /**\n * thease are used as easy access for batching\n * @member {Uint16Array}\n * @private\n */\n _this.indices = null;\n /**\n * this is the caching layer used by the batcher\n * @member {Float32Array}\n * @private\n */\n _this.vertexData = new Float32Array(1);\n /**\n * If geometry is changed used to decide to re-transform\n * the vertexData.\n * @member {number}\n * @private\n */\n _this.vertexDirty = 0;\n _this._transformID = -1;\n /**\n * Internal roundPixels field\n *\n * @member {boolean}\n * @private\n */\n _this._roundPixels = _pixi_settings__WEBPACK_IMPORTED_MODULE_4__.settings.ROUND_PIXELS;\n /**\n * Batched UV's are cached for atlas textures\n * @member {PIXI.MeshBatchUvs}\n * @private\n */\n _this.batchUvs = null;\n return _this;\n }\n Object.defineProperty(Mesh.prototype, \"uvBuffer\", {\n /**\n * To change mesh uv's, change its uvBuffer data and increment its _updateID.\n * @member {PIXI.Buffer}\n * @readonly\n */\n get: function () {\n return this.geometry.buffers[1];\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Mesh.prototype, \"verticesBuffer\", {\n /**\n * To change mesh vertices, change its uvBuffer data and increment its _updateID.\n * Incrementing _updateID is optional because most of Mesh objects do it anyway.\n * @member {PIXI.Buffer}\n * @readonly\n */\n get: function () {\n return this.geometry.buffers[0];\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Mesh.prototype, \"material\", {\n get: function () {\n return this.shader;\n },\n /**\n * Alias for {@link PIXI.Mesh#shader}.\n * @member {PIXI.MeshMaterial}\n */\n set: function (value) {\n this.shader = value;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Mesh.prototype, \"blendMode\", {\n get: function () {\n return this.state.blendMode;\n },\n /**\n * The blend mode to be applied to the Mesh. Apply a value of\n * `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL;\n * @see PIXI.BLEND_MODES\n */\n set: function (value) {\n this.state.blendMode = value;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Mesh.prototype, \"roundPixels\", {\n get: function () {\n return this._roundPixels;\n },\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n * To set the global default, change {@link PIXI.settings.ROUND_PIXELS}\n *\n * @member {boolean}\n * @default false\n */\n set: function (value) {\n if (this._roundPixels !== value) {\n this._transformID = -1;\n }\n this._roundPixels = value;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Mesh.prototype, \"tint\", {\n /**\n * The multiply tint applied to the Mesh. This is a hex value. A value of\n * `0xFFFFFF` will remove any tint effect.\n *\n * @member {number}\n * @default 0xFFFFFF\n */\n get: function () {\n return this.shader.tint;\n },\n set: function (value) {\n this.shader.tint = value;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Mesh.prototype, \"texture\", {\n /**\n * The texture that the Mesh uses.\n *\n * @member {PIXI.Texture}\n */\n get: function () {\n return this.shader.texture;\n },\n set: function (value) {\n this.shader.texture = value;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Standard renderer draw.\n * @protected\n * @param {PIXI.Renderer} renderer - Instance to renderer.\n */\n Mesh.prototype._render = function (renderer) {\n // set properties for batching..\n // TODO could use a different way to grab verts?\n var vertices = this.geometry.buffers[0].data;\n // TODO benchmark check for attribute size..\n if (this.shader.batchable\n && this.drawMode === _pixi_constants__WEBPACK_IMPORTED_MODULE_2__.DRAW_MODES.TRIANGLES\n && vertices.length < Mesh.BATCHABLE_SIZE * 2) {\n this._renderToBatch(renderer);\n }\n else {\n this._renderDefault(renderer);\n }\n };\n /**\n * Standard non-batching way of rendering.\n * @protected\n * @param {PIXI.Renderer} renderer - Instance to renderer.\n */\n Mesh.prototype._renderDefault = function (renderer) {\n var shader = this.shader;\n shader.alpha = this.worldAlpha;\n if (shader.update) {\n shader.update();\n }\n renderer.batch.flush();\n if (shader.program.uniformData.translationMatrix) {\n shader.uniforms.translationMatrix = this.transform.worldTransform.toArray(true);\n }\n // bind and sync uniforms..\n renderer.shader.bind(shader);\n // set state..\n renderer.state.set(this.state);\n // bind the geometry...\n renderer.geometry.bind(this.geometry, shader);\n // then render it\n renderer.geometry.draw(this.drawMode, this.size, this.start, this.geometry.instanceCount);\n };\n /**\n * Rendering by using the Batch system.\n * @protected\n * @param {PIXI.Renderer} renderer - Instance to renderer.\n */\n Mesh.prototype._renderToBatch = function (renderer) {\n var geometry = this.geometry;\n if (this.shader.uvMatrix) {\n this.shader.uvMatrix.update();\n this.calculateUvs();\n }\n // set properties for batching..\n this.calculateVertices();\n this.indices = geometry.indexBuffer.data;\n this._tintRGB = this.shader._tintRGB;\n this._texture = this.shader.texture;\n var pluginName = this.material.pluginName;\n renderer.batch.setObjectRenderer(renderer.plugins[pluginName]);\n renderer.plugins[pluginName].render(this);\n };\n /**\n * Updates vertexData field based on transform and vertices\n */\n Mesh.prototype.calculateVertices = function () {\n var geometry = this.geometry;\n var vertices = geometry.buffers[0].data;\n if (geometry.vertexDirtyId === this.vertexDirty && this._transformID === this.transform._worldID) {\n return;\n }\n this._transformID = this.transform._worldID;\n if (this.vertexData.length !== vertices.length) {\n this.vertexData = new Float32Array(vertices.length);\n }\n var wt = this.transform.worldTransform;\n var a = wt.a;\n var b = wt.b;\n var c = wt.c;\n var d = wt.d;\n var tx = wt.tx;\n var ty = wt.ty;\n var vertexData = this.vertexData;\n for (var i = 0; i < vertexData.length / 2; i++) {\n var x = vertices[(i * 2)];\n var y = vertices[(i * 2) + 1];\n vertexData[(i * 2)] = (a * x) + (c * y) + tx;\n vertexData[(i * 2) + 1] = (b * x) + (d * y) + ty;\n }\n if (this._roundPixels) {\n var resolution = _pixi_settings__WEBPACK_IMPORTED_MODULE_4__.settings.RESOLUTION;\n for (var i = 0; i < vertexData.length; ++i) {\n vertexData[i] = Math.round((vertexData[i] * resolution | 0) / resolution);\n }\n }\n this.vertexDirty = geometry.vertexDirtyId;\n };\n /**\n * Updates uv field based on from geometry uv's or batchUvs\n */\n Mesh.prototype.calculateUvs = function () {\n var geomUvs = this.geometry.buffers[1];\n if (!this.shader.uvMatrix.isSimple) {\n if (!this.batchUvs) {\n this.batchUvs = new MeshBatchUvs(geomUvs, this.shader.uvMatrix);\n }\n this.batchUvs.update();\n this.uvs = this.batchUvs.data;\n }\n else {\n this.uvs = geomUvs.data;\n }\n };\n /**\n * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account.\n * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly.\n *\n * @protected\n */\n Mesh.prototype._calculateBounds = function () {\n this.calculateVertices();\n this._bounds.addVertexData(this.vertexData, 0, this.vertexData.length);\n };\n /**\n * Tests if a point is inside this mesh. Works only for PIXI.DRAW_MODES.TRIANGLES.\n *\n * @param {PIXI.IPointData} point - the point to test\n * @return {boolean} the result of the test\n */\n Mesh.prototype.containsPoint = function (point) {\n if (!this.getBounds().contains(point.x, point.y)) {\n return false;\n }\n this.worldTransform.applyInverse(point, tempPoint);\n var vertices = this.geometry.getBuffer('aVertexPosition').data;\n var points = tempPolygon.points;\n var indices = this.geometry.getIndex().data;\n var len = indices.length;\n var step = this.drawMode === 4 ? 3 : 1;\n for (var i = 0; i + 2 < len; i += step) {\n var ind0 = indices[i] * 2;\n var ind1 = indices[i + 1] * 2;\n var ind2 = indices[i + 2] * 2;\n points[0] = vertices[ind0];\n points[1] = vertices[ind0 + 1];\n points[2] = vertices[ind1];\n points[3] = vertices[ind1 + 1];\n points[4] = vertices[ind2];\n points[5] = vertices[ind2 + 1];\n if (tempPolygon.contains(tempPoint.x, tempPoint.y)) {\n return true;\n }\n }\n return false;\n };\n /**\n * Destroys the Mesh object.\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all\n * options have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have\n * their destroy method called as well. 'options' will be passed on to those calls.\n */\n Mesh.prototype.destroy = function (options) {\n _super.prototype.destroy.call(this, options);\n this.geometry.refCount--;\n if (this.geometry.refCount === 0) {\n this.geometry.dispose();\n }\n this.geometry = null;\n this.shader = null;\n this.state = null;\n this.uvs = null;\n this.indices = null;\n this.vertexData = null;\n };\n /**\n * The maximum number of vertices to consider batchable. Generally, the complexity\n * of the geometry.\n * @memberof PIXI.Mesh\n * @static\n * @member {number} BATCHABLE_SIZE\n */\n Mesh.BATCHABLE_SIZE = 100;\n return Mesh;\n}(_pixi_display__WEBPACK_IMPORTED_MODULE_3__.Container));\n\nvar fragment = \"varying vec2 vTextureCoord;\\nuniform vec4 uColor;\\n\\nuniform sampler2D uSampler;\\n\\nvoid main(void)\\n{\\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;\\n}\\n\";\n\nvar vertex = \"attribute vec2 aVertexPosition;\\nattribute vec2 aTextureCoord;\\n\\nuniform mat3 projectionMatrix;\\nuniform mat3 translationMatrix;\\nuniform mat3 uTextureMatrix;\\n\\nvarying vec2 vTextureCoord;\\n\\nvoid main(void)\\n{\\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\\n\\n vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\\n}\\n\";\n\n/**\n * Slightly opinionated default shader for PixiJS 2D objects.\n * @class\n * @memberof PIXI\n * @extends PIXI.Shader\n */\nvar MeshMaterial = /** @class */ (function (_super) {\n __extends(MeshMaterial, _super);\n /**\n * @param {PIXI.Texture} uSampler - Texture that material uses to render.\n * @param {object} [options] - Additional options\n * @param {number} [options.alpha=1] - Default alpha.\n * @param {number} [options.tint=0xFFFFFF] - Default tint.\n * @param {string} [options.pluginName='batch'] - Renderer plugin for batching.\n * @param {PIXI.Program} [options.program=0xFFFFFF] - Custom program.\n * @param {object} [options.uniforms] - Custom uniforms.\n */\n function MeshMaterial(uSampler, options) {\n var _this = this;\n var uniforms = {\n uSampler: uSampler,\n alpha: 1,\n uTextureMatrix: _pixi_math__WEBPACK_IMPORTED_MODULE_1__.Matrix.IDENTITY,\n uColor: new Float32Array([1, 1, 1, 1]),\n };\n // Set defaults\n options = Object.assign({\n tint: 0xFFFFFF,\n alpha: 1,\n pluginName: 'batch',\n }, options);\n if (options.uniforms) {\n Object.assign(uniforms, options.uniforms);\n }\n _this = _super.call(this, options.program || _pixi_core__WEBPACK_IMPORTED_MODULE_0__.Program.from(vertex, fragment), uniforms) || this;\n /**\n * Only do update if tint or alpha changes.\n * @member {boolean}\n * @private\n * @default false\n */\n _this._colorDirty = false;\n /**\n * TextureMatrix instance for this Mesh, used to track Texture changes\n *\n * @member {PIXI.TextureMatrix}\n * @readonly\n */\n _this.uvMatrix = new _pixi_core__WEBPACK_IMPORTED_MODULE_0__.TextureMatrix(uSampler);\n /**\n * `true` if shader can be batch with the renderer's batch system.\n * @member {boolean}\n * @default true\n */\n _this.batchable = options.program === undefined;\n /**\n * Renderer plugin for batching\n *\n * @member {string}\n * @default 'batch'\n */\n _this.pluginName = options.pluginName;\n _this.tint = options.tint;\n _this.alpha = options.alpha;\n return _this;\n }\n Object.defineProperty(MeshMaterial.prototype, \"texture\", {\n /**\n * Reference to the texture being rendered.\n * @member {PIXI.Texture}\n */\n get: function () {\n return this.uniforms.uSampler;\n },\n set: function (value) {\n if (this.uniforms.uSampler !== value) {\n this.uniforms.uSampler = value;\n this.uvMatrix.texture = value;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MeshMaterial.prototype, \"alpha\", {\n get: function () {\n return this._alpha;\n },\n /**\n * This gets automatically set by the object using this.\n *\n * @default 1\n * @member {number}\n */\n set: function (value) {\n if (value === this._alpha)\n { return; }\n this._alpha = value;\n this._colorDirty = true;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MeshMaterial.prototype, \"tint\", {\n get: function () {\n return this._tint;\n },\n /**\n * Multiply tint for the material.\n * @member {number}\n * @default 0xFFFFFF\n */\n set: function (value) {\n if (value === this._tint)\n { return; }\n this._tint = value;\n this._tintRGB = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16);\n this._colorDirty = true;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Gets called automatically by the Mesh. Intended to be overridden for custom\n * MeshMaterial objects.\n */\n MeshMaterial.prototype.update = function () {\n if (this._colorDirty) {\n this._colorDirty = false;\n var baseTexture = this.texture.baseTexture;\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_5__.premultiplyTintToRgba)(this._tint, this._alpha, this.uniforms.uColor, baseTexture.alphaMode);\n }\n if (this.uvMatrix.update()) {\n this.uniforms.uTextureMatrix = this.uvMatrix.mapCoord;\n }\n };\n return MeshMaterial;\n}(_pixi_core__WEBPACK_IMPORTED_MODULE_0__.Shader));\n\n/**\n * Standard 2D geometry used in PixiJS.\n *\n * Geometry can be defined without passing in a style or data if required.\n *\n * ```js\n * const geometry = new PIXI.Geometry();\n *\n * geometry.addAttribute('positions', [0, 0, 100, 0, 100, 100, 0, 100], 2);\n * geometry.addAttribute('uvs', [0,0,1,0,1,1,0,1], 2);\n * geometry.addIndex([0,1,2,1,3,2]);\n *\n * ```\n * @class\n * @memberof PIXI\n * @extends PIXI.Geometry\n */\nvar MeshGeometry = /** @class */ (function (_super) {\n __extends(MeshGeometry, _super);\n /**\n * @param {Float32Array|number[]} [vertices] - Positional data on geometry.\n * @param {Float32Array|number[]} [uvs] - Texture UVs.\n * @param {Uint16Array|number[]} [index] - IndexBuffer\n */\n function MeshGeometry(vertices, uvs, index) {\n var _this = _super.call(this) || this;\n var verticesBuffer = new _pixi_core__WEBPACK_IMPORTED_MODULE_0__.Buffer(vertices);\n var uvsBuffer = new _pixi_core__WEBPACK_IMPORTED_MODULE_0__.Buffer(uvs, true);\n var indexBuffer = new _pixi_core__WEBPACK_IMPORTED_MODULE_0__.Buffer(index, true, true);\n _this.addAttribute('aVertexPosition', verticesBuffer, 2, false, _pixi_constants__WEBPACK_IMPORTED_MODULE_2__.TYPES.FLOAT)\n .addAttribute('aTextureCoord', uvsBuffer, 2, false, _pixi_constants__WEBPACK_IMPORTED_MODULE_2__.TYPES.FLOAT)\n .addIndex(indexBuffer);\n /**\n * Dirty flag to limit update calls on Mesh. For example,\n * limiting updates on a single Mesh instance with a shared Geometry\n * within the render loop.\n * @private\n * @member {number}\n * @default -1\n */\n _this._updateId = -1;\n return _this;\n }\n Object.defineProperty(MeshGeometry.prototype, \"vertexDirtyId\", {\n /**\n * If the vertex position is updated.\n * @member {number}\n * @readonly\n * @private\n */\n get: function () {\n return this.buffers[0]._updateID;\n },\n enumerable: false,\n configurable: true\n });\n return MeshGeometry;\n}(_pixi_core__WEBPACK_IMPORTED_MODULE_0__.Geometry));\n\n\n//# sourceMappingURL=mesh.es.js.map\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/@pixi/mesh/lib/mesh.es.js?"); /***/ }), /***/ "./node_modules/@pixi/mixin-cache-as-bitmap/lib/mixin-cache-as-bitmap.es.js": /*!**********************************************************************************!*\ !*** ./node_modules/@pixi/mixin-cache-as-bitmap/lib/mixin-cache-as-bitmap.es.js ***! \**********************************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"CacheData\": () => (/* binding */ CacheData)\n/* harmony export */ });\n/* harmony import */ var _pixi_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @pixi/core */ \"./node_modules/@pixi/core/lib/core.es.js\");\n/* harmony import */ var _pixi_sprite__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @pixi/sprite */ \"./node_modules/@pixi/sprite/lib/sprite.es.js\");\n/* harmony import */ var _pixi_display__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @pixi/display */ \"./node_modules/@pixi/display/lib/display.es.js\");\n/* harmony import */ var _pixi_math__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @pixi/math */ \"./node_modules/@pixi/math/lib/math.es.js\");\n/* harmony import */ var _pixi_utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @pixi/utils */ \"./node_modules/@pixi/utils/lib/utils.es.js\");\n/* harmony import */ var _pixi_settings__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @pixi/settings */ \"./node_modules/@pixi/settings/lib/settings.es.js\");\n/*!\n * @pixi/mixin-cache-as-bitmap - v5.3.11\n * Compiled Mon, 01 Nov 2021 16:10:12 UTC\n *\n * @pixi/mixin-cache-as-bitmap is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n\n\n\n\n\n\n\nvar _tempMatrix = new _pixi_math__WEBPACK_IMPORTED_MODULE_3__.Matrix();\n_pixi_display__WEBPACK_IMPORTED_MODULE_2__.DisplayObject.prototype._cacheAsBitmap = false;\n_pixi_display__WEBPACK_IMPORTED_MODULE_2__.DisplayObject.prototype._cacheData = null;\n// figured there's no point adding ALL the extra variables to prototype.\n// this model can hold the information needed. This can also be generated on demand as\n// most objects are not cached as bitmaps.\n/**\n * @class\n * @ignore\n */\nvar CacheData = /** @class */ (function () {\n function CacheData() {\n this.textureCacheId = null;\n this.originalRender = null;\n this.originalRenderCanvas = null;\n this.originalCalculateBounds = null;\n this.originalGetLocalBounds = null;\n this.originalUpdateTransform = null;\n this.originalDestroy = null;\n this.originalMask = null;\n this.originalFilterArea = null;\n this.originalContainsPoint = null;\n this.sprite = null;\n }\n return CacheData;\n}());\nObject.defineProperties(_pixi_display__WEBPACK_IMPORTED_MODULE_2__.DisplayObject.prototype, {\n /**\n * Set this to true if you want this display object to be cached as a bitmap.\n * This basically takes a snap shot of the display object as it is at that moment. It can\n * provide a performance benefit for complex static displayObjects.\n * To remove simply set this property to `false`\n *\n * IMPORTANT GOTCHA - Make sure that all your textures are preloaded BEFORE setting this property to true\n * as it will take a snapshot of what is currently there. If the textures have not loaded then they will not appear.\n *\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n */\n cacheAsBitmap: {\n get: function () {\n return this._cacheAsBitmap;\n },\n set: function (value) {\n if (this._cacheAsBitmap === value) {\n return;\n }\n this._cacheAsBitmap = value;\n var data;\n if (value) {\n if (!this._cacheData) {\n this._cacheData = new CacheData();\n }\n data = this._cacheData;\n data.originalRender = this.render;\n data.originalRenderCanvas = this.renderCanvas;\n data.originalUpdateTransform = this.updateTransform;\n data.originalCalculateBounds = this.calculateBounds;\n data.originalGetLocalBounds = this.getLocalBounds;\n data.originalDestroy = this.destroy;\n data.originalContainsPoint = this.containsPoint;\n data.originalMask = this._mask;\n data.originalFilterArea = this.filterArea;\n this.render = this._renderCached;\n this.renderCanvas = this._renderCachedCanvas;\n this.destroy = this._cacheAsBitmapDestroy;\n }\n else {\n data = this._cacheData;\n if (data.sprite) {\n this._destroyCachedDisplayObject();\n }\n this.render = data.originalRender;\n this.renderCanvas = data.originalRenderCanvas;\n this.calculateBounds = data.originalCalculateBounds;\n this.getLocalBounds = data.originalGetLocalBounds;\n this.destroy = data.originalDestroy;\n this.updateTransform = data.originalUpdateTransform;\n this.containsPoint = data.originalContainsPoint;\n this._mask = data.originalMask;\n this.filterArea = data.originalFilterArea;\n }\n },\n },\n});\n/**\n * Renders a cached version of the sprite with WebGL\n *\n * @private\n * @function _renderCached\n * @memberof PIXI.DisplayObject#\n * @param {PIXI.Renderer} renderer - the WebGL renderer\n */\n_pixi_display__WEBPACK_IMPORTED_MODULE_2__.DisplayObject.prototype._renderCached = function _renderCached(renderer) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n this._initCachedDisplayObject(renderer);\n this._cacheData.sprite.transform._worldID = this.transform._worldID;\n this._cacheData.sprite.worldAlpha = this.worldAlpha;\n this._cacheData.sprite._render(renderer);\n};\n/**\n * Prepares the WebGL renderer to cache the sprite\n *\n * @private\n * @function _initCachedDisplayObject\n * @memberof PIXI.DisplayObject#\n * @param {PIXI.Renderer} renderer - the WebGL renderer\n */\n_pixi_display__WEBPACK_IMPORTED_MODULE_2__.DisplayObject.prototype._initCachedDisplayObject = function _initCachedDisplayObject(renderer) {\n if (this._cacheData && this._cacheData.sprite) {\n return;\n }\n // make sure alpha is set to 1 otherwise it will get rendered as invisible!\n var cacheAlpha = this.alpha;\n this.alpha = 1;\n // first we flush anything left in the renderer (otherwise it would get rendered to the cached texture)\n renderer.batch.flush();\n // this.filters= [];\n // next we find the dimensions of the untransformed object\n // this function also calls updatetransform on all its children as part of the measuring.\n // This means we don't need to update the transform again in this function\n // TODO pass an object to clone too? saves having to create a new one each time!\n var bounds = this.getLocalBounds(null, true).clone();\n // add some padding!\n if (this.filters) {\n var padding = this.filters[0].padding;\n bounds.pad(padding);\n }\n bounds.ceil(_pixi_settings__WEBPACK_IMPORTED_MODULE_5__.settings.RESOLUTION);\n // for now we cache the current renderTarget that the WebGL renderer is currently using.\n // this could be more elegant..\n var cachedRenderTexture = renderer.renderTexture.current;\n var cachedSourceFrame = renderer.renderTexture.sourceFrame.clone();\n var cachedDestinationFrame = renderer.renderTexture.destinationFrame.clone();\n var cachedProjectionTransform = renderer.projection.transform;\n // We also store the filter stack - I will definitely look to change how this works a little later down the line.\n // const stack = renderer.filterManager.filterStack;\n // this renderTexture will be used to store the cached DisplayObject\n var renderTexture = _pixi_core__WEBPACK_IMPORTED_MODULE_0__.RenderTexture.create({ width: bounds.width, height: bounds.height });\n var textureCacheId = \"cacheAsBitmap_\" + (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_4__.uid)();\n this._cacheData.textureCacheId = textureCacheId;\n _pixi_core__WEBPACK_IMPORTED_MODULE_0__.BaseTexture.addToCache(renderTexture.baseTexture, textureCacheId);\n _pixi_core__WEBPACK_IMPORTED_MODULE_0__.Texture.addToCache(renderTexture, textureCacheId);\n // need to set //\n var m = this.transform.localTransform.copyTo(_tempMatrix).invert().translate(-bounds.x, -bounds.y);\n // set all properties to there original so we can render to a texture\n this.render = this._cacheData.originalRender;\n renderer.render(this, renderTexture, true, m, false);\n // now restore the state be setting the new properties\n renderer.projection.transform = cachedProjectionTransform;\n renderer.renderTexture.bind(cachedRenderTexture, cachedSourceFrame, cachedDestinationFrame);\n // renderer.filterManager.filterStack = stack;\n this.render = this._renderCached;\n // the rest is the same as for Canvas\n this.updateTransform = this.displayObjectUpdateTransform;\n this.calculateBounds = this._calculateCachedBounds;\n this.getLocalBounds = this._getCachedLocalBounds;\n this._mask = null;\n this.filterArea = null;\n // create our cached sprite\n var cachedSprite = new _pixi_sprite__WEBPACK_IMPORTED_MODULE_1__.Sprite(renderTexture);\n cachedSprite.transform.worldTransform = this.transform.worldTransform;\n cachedSprite.anchor.x = -(bounds.x / bounds.width);\n cachedSprite.anchor.y = -(bounds.y / bounds.height);\n cachedSprite.alpha = cacheAlpha;\n cachedSprite._bounds = this._bounds;\n this._cacheData.sprite = cachedSprite;\n this.transform._parentID = -1;\n // restore the transform of the cached sprite to avoid the nasty flicker..\n if (!this.parent) {\n this.enableTempParent();\n this.updateTransform();\n this.disableTempParent(null);\n }\n else {\n this.updateTransform();\n }\n // map the hit test..\n this.containsPoint = cachedSprite.containsPoint.bind(cachedSprite);\n};\n/**\n * Renders a cached version of the sprite with canvas\n *\n * @private\n * @function _renderCachedCanvas\n * @memberof PIXI.DisplayObject#\n * @param {PIXI.CanvasRenderer} renderer - The canvas renderer\n */\n_pixi_display__WEBPACK_IMPORTED_MODULE_2__.DisplayObject.prototype._renderCachedCanvas = function _renderCachedCanvas(renderer) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n this._initCachedDisplayObjectCanvas(renderer);\n this._cacheData.sprite.worldAlpha = this.worldAlpha;\n this._cacheData.sprite._renderCanvas(renderer);\n};\n// TODO this can be the same as the WebGL version.. will need to do a little tweaking first though..\n/**\n * Prepares the Canvas renderer to cache the sprite\n *\n * @private\n * @function _initCachedDisplayObjectCanvas\n * @memberof PIXI.DisplayObject#\n * @param {PIXI.CanvasRenderer} renderer - The canvas renderer\n */\n_pixi_display__WEBPACK_IMPORTED_MODULE_2__.DisplayObject.prototype._initCachedDisplayObjectCanvas = function _initCachedDisplayObjectCanvas(renderer) {\n if (this._cacheData && this._cacheData.sprite) {\n return;\n }\n // get bounds actually transforms the object for us already!\n var bounds = this.getLocalBounds(null, true);\n var cacheAlpha = this.alpha;\n this.alpha = 1;\n var cachedRenderTarget = renderer.context;\n var cachedProjectionTransform = renderer._projTransform;\n bounds.ceil(_pixi_settings__WEBPACK_IMPORTED_MODULE_5__.settings.RESOLUTION);\n var renderTexture = _pixi_core__WEBPACK_IMPORTED_MODULE_0__.RenderTexture.create({ width: bounds.width, height: bounds.height });\n var textureCacheId = \"cacheAsBitmap_\" + (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_4__.uid)();\n this._cacheData.textureCacheId = textureCacheId;\n _pixi_core__WEBPACK_IMPORTED_MODULE_0__.BaseTexture.addToCache(renderTexture.baseTexture, textureCacheId);\n _pixi_core__WEBPACK_IMPORTED_MODULE_0__.Texture.addToCache(renderTexture, textureCacheId);\n // need to set //\n var m = _tempMatrix;\n this.transform.localTransform.copyTo(m);\n m.invert();\n m.tx -= bounds.x;\n m.ty -= bounds.y;\n // m.append(this.transform.worldTransform.)\n // set all properties to there original so we can render to a texture\n this.renderCanvas = this._cacheData.originalRenderCanvas;\n renderer.render(this, renderTexture, true, m, false);\n // now restore the state be setting the new properties\n renderer.context = cachedRenderTarget;\n renderer._projTransform = cachedProjectionTransform;\n this.renderCanvas = this._renderCachedCanvas;\n // the rest is the same as for WebGL\n this.updateTransform = this.displayObjectUpdateTransform;\n this.calculateBounds = this._calculateCachedBounds;\n this.getLocalBounds = this._getCachedLocalBounds;\n this._mask = null;\n this.filterArea = null;\n // create our cached sprite\n var cachedSprite = new _pixi_sprite__WEBPACK_IMPORTED_MODULE_1__.Sprite(renderTexture);\n cachedSprite.transform.worldTransform = this.transform.worldTransform;\n cachedSprite.anchor.x = -(bounds.x / bounds.width);\n cachedSprite.anchor.y = -(bounds.y / bounds.height);\n cachedSprite.alpha = cacheAlpha;\n cachedSprite._bounds = this._bounds;\n this._cacheData.sprite = cachedSprite;\n this.transform._parentID = -1;\n // restore the transform of the cached sprite to avoid the nasty flicker..\n if (!this.parent) {\n this.parent = renderer._tempDisplayObjectParent;\n this.updateTransform();\n this.parent = null;\n }\n else {\n this.updateTransform();\n }\n // map the hit test..\n this.containsPoint = cachedSprite.containsPoint.bind(cachedSprite);\n};\n/**\n * Calculates the bounds of the cached sprite\n *\n * @private\n */\n_pixi_display__WEBPACK_IMPORTED_MODULE_2__.DisplayObject.prototype._calculateCachedBounds = function _calculateCachedBounds() {\n this._bounds.clear();\n this._cacheData.sprite.transform._worldID = this.transform._worldID;\n this._cacheData.sprite._calculateBounds();\n this._bounds.updateID = this._boundsID;\n};\n/**\n * Gets the bounds of the cached sprite.\n *\n * @private\n * @return {Rectangle} The local bounds.\n */\n_pixi_display__WEBPACK_IMPORTED_MODULE_2__.DisplayObject.prototype._getCachedLocalBounds = function _getCachedLocalBounds() {\n return this._cacheData.sprite.getLocalBounds(null);\n};\n/**\n * Destroys the cached sprite.\n *\n * @private\n */\n_pixi_display__WEBPACK_IMPORTED_MODULE_2__.DisplayObject.prototype._destroyCachedDisplayObject = function _destroyCachedDisplayObject() {\n this._cacheData.sprite._texture.destroy(true);\n this._cacheData.sprite = null;\n _pixi_core__WEBPACK_IMPORTED_MODULE_0__.BaseTexture.removeFromCache(this._cacheData.textureCacheId);\n _pixi_core__WEBPACK_IMPORTED_MODULE_0__.Texture.removeFromCache(this._cacheData.textureCacheId);\n this._cacheData.textureCacheId = null;\n};\n/**\n * Destroys the cached object.\n *\n * @private\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value.\n * Used when destroying containers, see the Container.destroy method.\n */\n_pixi_display__WEBPACK_IMPORTED_MODULE_2__.DisplayObject.prototype._cacheAsBitmapDestroy = function _cacheAsBitmapDestroy(options) {\n this.cacheAsBitmap = false;\n this.destroy(options);\n};\n\n\n//# sourceMappingURL=mixin-cache-as-bitmap.es.js.map\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/@pixi/mixin-cache-as-bitmap/lib/mixin-cache-as-bitmap.es.js?"); /***/ }), /***/ "./node_modules/@pixi/mixin-get-child-by-name/lib/mixin-get-child-by-name.es.js": /*!**************************************************************************************!*\ !*** ./node_modules/@pixi/mixin-get-child-by-name/lib/mixin-get-child-by-name.es.js ***! \**************************************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _pixi_display__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @pixi/display */ \"./node_modules/@pixi/display/lib/display.es.js\");\n/*!\n * @pixi/mixin-get-child-by-name - v5.3.11\n * Compiled Mon, 01 Nov 2021 16:10:12 UTC\n *\n * @pixi/mixin-get-child-by-name is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n\n\n/**\n * The instance name of the object.\n *\n * @memberof PIXI.DisplayObject#\n * @member {string} name\n */\n_pixi_display__WEBPACK_IMPORTED_MODULE_0__.DisplayObject.prototype.name = null;\n/**\n * Returns the display object in the container.\n *\n * Recursive searches are done in a preorder traversal.\n *\n * @method getChildByName\n * @memberof PIXI.Container#\n * @param {string} name - Instance name.\n * @param {boolean}[deep=false] - Whether to search recursively\n * @return {PIXI.DisplayObject} The child with the specified name.\n */\n_pixi_display__WEBPACK_IMPORTED_MODULE_0__.Container.prototype.getChildByName = function getChildByName(name, deep) {\n for (var i = 0, j = this.children.length; i < j; i++) {\n if (this.children[i].name === name) {\n return this.children[i];\n }\n }\n if (deep) {\n for (var i = 0, j = this.children.length; i < j; i++) {\n var child = this.children[i];\n if (!child.getChildByName) {\n continue;\n }\n var target = this.children[i].getChildByName(name, true);\n if (target) {\n return target;\n }\n }\n }\n return null;\n};\n//# sourceMappingURL=mixin-get-child-by-name.es.js.map\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/@pixi/mixin-get-child-by-name/lib/mixin-get-child-by-name.es.js?"); /***/ }), /***/ "./node_modules/@pixi/mixin-get-global-position/lib/mixin-get-global-position.es.js": /*!******************************************************************************************!*\ !*** ./node_modules/@pixi/mixin-get-global-position/lib/mixin-get-global-position.es.js ***! \******************************************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _pixi_display__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @pixi/display */ \"./node_modules/@pixi/display/lib/display.es.js\");\n/* harmony import */ var _pixi_math__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @pixi/math */ \"./node_modules/@pixi/math/lib/math.es.js\");\n/*!\n * @pixi/mixin-get-global-position - v5.3.11\n * Compiled Mon, 01 Nov 2021 16:10:12 UTC\n *\n * @pixi/mixin-get-global-position is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n\n\n\n/**\n * Returns the global position of the displayObject. Does not depend on object scale, rotation and pivot.\n *\n * @method getGlobalPosition\n * @memberof PIXI.DisplayObject#\n * @param {PIXI.Point} [point=new PIXI.Point()] - The point to write the global value to.\n * @param {boolean} [skipUpdate=false] - Setting to true will stop the transforms of the scene graph from\n * being updated. This means the calculation returned MAY be out of date BUT will give you a\n * nice performance boost.\n * @return {PIXI.Point} The updated point.\n */\n_pixi_display__WEBPACK_IMPORTED_MODULE_0__.DisplayObject.prototype.getGlobalPosition = function getGlobalPosition(point, skipUpdate) {\n if (point === void 0) { point = new _pixi_math__WEBPACK_IMPORTED_MODULE_1__.Point(); }\n if (skipUpdate === void 0) { skipUpdate = false; }\n if (this.parent) {\n this.parent.toGlobal(this.position, point, skipUpdate);\n }\n else {\n point.x = this.position.x;\n point.y = this.position.y;\n }\n return point;\n};\n//# sourceMappingURL=mixin-get-global-position.es.js.map\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/@pixi/mixin-get-global-position/lib/mixin-get-global-position.es.js?"); /***/ }), /***/ "./node_modules/@pixi/particles/lib/particles.es.js": /*!**********************************************************!*\ !*** ./node_modules/@pixi/particles/lib/particles.es.js ***! \**********************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ParticleContainer\": () => (/* binding */ ParticleContainer),\n/* harmony export */ \"ParticleRenderer\": () => (/* binding */ ParticleRenderer)\n/* harmony export */ });\n/* harmony import */ var _pixi_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @pixi/constants */ \"./node_modules/@pixi/constants/lib/constants.es.js\");\n/* harmony import */ var _pixi_display__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @pixi/display */ \"./node_modules/@pixi/display/lib/display.es.js\");\n/* harmony import */ var _pixi_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @pixi/utils */ \"./node_modules/@pixi/utils/lib/utils.es.js\");\n/* harmony import */ var _pixi_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @pixi/core */ \"./node_modules/@pixi/core/lib/core.es.js\");\n/* harmony import */ var _pixi_math__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @pixi/math */ \"./node_modules/@pixi/math/lib/math.es.js\");\n/*!\n * @pixi/particles - v5.3.11\n * Compiled Mon, 01 Nov 2021 16:10:12 UTC\n *\n * @pixi/particles is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n\n\n\n\n\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } };\r\n return extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\n\n/**\n * The ParticleContainer class is a really fast version of the Container built solely for speed,\n * so use when you need a lot of sprites or particles.\n *\n * The tradeoff of the ParticleContainer is that most advanced functionality will not work.\n * ParticleContainer implements the basic object transform (position, scale, rotation)\n * and some advanced functionality like tint (as of v4.5.6).\n *\n * Other more advanced functionality like masking, children, filters, etc will not work on sprites in this batch.\n *\n * It's extremely easy to use:\n * ```js\n * let container = new ParticleContainer();\n *\n * for (let i = 0; i < 100; ++i)\n * {\n * let sprite = PIXI.Sprite.from(\"myImage.png\");\n * container.addChild(sprite);\n * }\n * ```\n *\n * And here you have a hundred sprites that will be rendered at the speed of light.\n *\n * @class\n * @extends PIXI.Container\n * @memberof PIXI\n */\nvar ParticleContainer = /** @class */ (function (_super) {\n __extends(ParticleContainer, _super);\n /**\n * @param {number} [maxSize=1500] - The maximum number of particles that can be rendered by the container.\n * Affects size of allocated buffers.\n * @param {object} [properties] - The properties of children that should be uploaded to the gpu and applied.\n * @param {boolean} [properties.vertices=false] - When true, vertices be uploaded and applied.\n * if sprite's ` scale/anchor/trim/frame/orig` is dynamic, please set `true`.\n * @param {boolean} [properties.position=true] - When true, position be uploaded and applied.\n * @param {boolean} [properties.rotation=false] - When true, rotation be uploaded and applied.\n * @param {boolean} [properties.uvs=false] - When true, uvs be uploaded and applied.\n * @param {boolean} [properties.tint=false] - When true, alpha and tint be uploaded and applied.\n * @param {number} [batchSize=16384] - Number of particles per batch. If less than maxSize, it uses maxSize instead.\n * @param {boolean} [autoResize=false] - If true, container allocates more batches in case\n * there are more than `maxSize` particles.\n */\n function ParticleContainer(maxSize, properties, batchSize, autoResize) {\n if (maxSize === void 0) { maxSize = 1500; }\n if (batchSize === void 0) { batchSize = 16384; }\n if (autoResize === void 0) { autoResize = false; }\n var _this = _super.call(this) || this;\n // Making sure the batch size is valid\n // 65535 is max vertex index in the index buffer (see ParticleRenderer)\n // so max number of particles is 65536 / 4 = 16384\n var maxBatchSize = 16384;\n if (batchSize > maxBatchSize) {\n batchSize = maxBatchSize;\n }\n /**\n * Set properties to be dynamic (true) / static (false)\n *\n * @member {boolean[]}\n * @private\n */\n _this._properties = [false, true, false, false, false];\n /**\n * @member {number}\n * @private\n */\n _this._maxSize = maxSize;\n /**\n * @member {number}\n * @private\n */\n _this._batchSize = batchSize;\n /**\n * @member {Array}\n * @private\n */\n _this._buffers = null;\n /**\n * for every batch stores _updateID corresponding to the last change in that batch\n * @member {number[]}\n * @private\n */\n _this._bufferUpdateIDs = [];\n /**\n * when child inserted, removed or changes position this number goes up\n * @member {number[]}\n * @private\n */\n _this._updateID = 0;\n /**\n * @member {boolean}\n *\n */\n _this.interactiveChildren = false;\n /**\n * The blend mode to be applied to the sprite. Apply a value of `PIXI.BLEND_MODES.NORMAL`\n * to reset the blend mode.\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL\n * @see PIXI.BLEND_MODES\n */\n _this.blendMode = _pixi_constants__WEBPACK_IMPORTED_MODULE_0__.BLEND_MODES.NORMAL;\n /**\n * If true, container allocates more batches in case there are more than `maxSize` particles.\n * @member {boolean}\n * @default false\n */\n _this.autoResize = autoResize;\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n * Default to true here as performance is usually the priority for particles.\n *\n * @member {boolean}\n * @default true\n */\n _this.roundPixels = true;\n /**\n * The texture used to render the children.\n *\n * @readonly\n * @member {PIXI.BaseTexture}\n */\n _this.baseTexture = null;\n _this.setProperties(properties);\n /**\n * The tint applied to the container.\n * This is a hex value. A value of 0xFFFFFF will remove any tint effect.\n *\n * @private\n * @member {number}\n * @default 0xFFFFFF\n */\n _this._tint = 0;\n _this.tintRgb = new Float32Array(4);\n _this.tint = 0xFFFFFF;\n return _this;\n }\n /**\n * Sets the private properties array to dynamic / static based on the passed properties object\n *\n * @param {object} properties - The properties to be uploaded\n */\n ParticleContainer.prototype.setProperties = function (properties) {\n if (properties) {\n this._properties[0] = 'vertices' in properties || 'scale' in properties\n ? !!properties.vertices || !!properties.scale : this._properties[0];\n this._properties[1] = 'position' in properties ? !!properties.position : this._properties[1];\n this._properties[2] = 'rotation' in properties ? !!properties.rotation : this._properties[2];\n this._properties[3] = 'uvs' in properties ? !!properties.uvs : this._properties[3];\n this._properties[4] = 'tint' in properties || 'alpha' in properties\n ? !!properties.tint || !!properties.alpha : this._properties[4];\n }\n };\n /**\n * Updates the object transform for rendering\n *\n * @private\n */\n ParticleContainer.prototype.updateTransform = function () {\n // TODO don't need to!\n this.displayObjectUpdateTransform();\n };\n Object.defineProperty(ParticleContainer.prototype, \"tint\", {\n /**\n * The tint applied to the container. This is a hex value.\n * A value of 0xFFFFFF will remove any tint effect.\n ** IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer.\n * @member {number}\n * @default 0xFFFFFF\n */\n get: function () {\n return this._tint;\n },\n set: function (value) {\n this._tint = value;\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.hex2rgb)(value, this.tintRgb);\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Renders the container using the WebGL renderer\n *\n * @private\n * @param {PIXI.Renderer} renderer - The webgl renderer\n */\n ParticleContainer.prototype.render = function (renderer) {\n var _this = this;\n if (!this.visible || this.worldAlpha <= 0 || !this.children.length || !this.renderable) {\n return;\n }\n if (!this.baseTexture) {\n this.baseTexture = this.children[0]._texture.baseTexture;\n if (!this.baseTexture.valid) {\n this.baseTexture.once('update', function () { return _this.onChildrenChange(0); });\n }\n }\n renderer.batch.setObjectRenderer(renderer.plugins.particle);\n renderer.plugins.particle.render(this);\n };\n /**\n * Set the flag that static data should be updated to true\n *\n * @private\n * @param {number} smallestChildIndex - The smallest child index\n */\n ParticleContainer.prototype.onChildrenChange = function (smallestChildIndex) {\n var bufferIndex = Math.floor(smallestChildIndex / this._batchSize);\n while (this._bufferUpdateIDs.length < bufferIndex) {\n this._bufferUpdateIDs.push(0);\n }\n this._bufferUpdateIDs[bufferIndex] = ++this._updateID;\n };\n ParticleContainer.prototype.dispose = function () {\n if (this._buffers) {\n for (var i = 0; i < this._buffers.length; ++i) {\n this._buffers[i].destroy();\n }\n this._buffers = null;\n }\n };\n /**\n * Destroys the container\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their\n * destroy method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the texture of the child sprite\n * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the base texture of the child sprite\n */\n ParticleContainer.prototype.destroy = function (options) {\n _super.prototype.destroy.call(this, options);\n this.dispose();\n this._properties = null;\n this._buffers = null;\n this._bufferUpdateIDs = null;\n };\n return ParticleContainer;\n}(_pixi_display__WEBPACK_IMPORTED_MODULE_1__.Container));\n\n/**\n * @author Mat Groves\n *\n * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/\n * for creating the original PixiJS version!\n * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that\n * they now share 4 bytes on the vertex buffer\n *\n * Heavily inspired by LibGDX's ParticleBuffer:\n * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/ParticleBuffer.java\n */\n/**\n * The particle buffer manages the static and dynamic buffers for a particle container.\n *\n * @class\n * @private\n * @memberof PIXI\n */\nvar ParticleBuffer = /** @class */ (function () {\n /**\n * @private\n * @param {object} properties - The properties to upload.\n * @param {boolean[]} dynamicPropertyFlags - Flags for which properties are dynamic.\n * @param {number} size - The size of the batch.\n */\n function ParticleBuffer(properties, dynamicPropertyFlags, size) {\n this.geometry = new _pixi_core__WEBPACK_IMPORTED_MODULE_3__.Geometry();\n this.indexBuffer = null;\n /**\n * The number of particles the buffer can hold\n *\n * @private\n * @member {number}\n */\n this.size = size;\n /**\n * A list of the properties that are dynamic.\n *\n * @private\n * @member {object[]}\n */\n this.dynamicProperties = [];\n /**\n * A list of the properties that are static.\n *\n * @private\n * @member {object[]}\n */\n this.staticProperties = [];\n for (var i = 0; i < properties.length; ++i) {\n var property = properties[i];\n // Make copy of properties object so that when we edit the offset it doesn't\n // change all other instances of the object literal\n property = {\n attributeName: property.attributeName,\n size: property.size,\n uploadFunction: property.uploadFunction,\n type: property.type || _pixi_constants__WEBPACK_IMPORTED_MODULE_0__.TYPES.FLOAT,\n offset: property.offset,\n };\n if (dynamicPropertyFlags[i]) {\n this.dynamicProperties.push(property);\n }\n else {\n this.staticProperties.push(property);\n }\n }\n this.staticStride = 0;\n this.staticBuffer = null;\n this.staticData = null;\n this.staticDataUint32 = null;\n this.dynamicStride = 0;\n this.dynamicBuffer = null;\n this.dynamicData = null;\n this.dynamicDataUint32 = null;\n this._updateID = 0;\n this.initBuffers();\n }\n /**\n * Sets up the renderer context and necessary buffers.\n *\n * @private\n */\n ParticleBuffer.prototype.initBuffers = function () {\n var geometry = this.geometry;\n var dynamicOffset = 0;\n /**\n * Holds the indices of the geometry (quads) to draw\n *\n * @member {Uint16Array}\n * @private\n */\n this.indexBuffer = new _pixi_core__WEBPACK_IMPORTED_MODULE_3__.Buffer((0,_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.createIndicesForQuads)(this.size), true, true);\n geometry.addIndex(this.indexBuffer);\n this.dynamicStride = 0;\n for (var i = 0; i < this.dynamicProperties.length; ++i) {\n var property = this.dynamicProperties[i];\n property.offset = dynamicOffset;\n dynamicOffset += property.size;\n this.dynamicStride += property.size;\n }\n var dynBuffer = new ArrayBuffer(this.size * this.dynamicStride * 4 * 4);\n this.dynamicData = new Float32Array(dynBuffer);\n this.dynamicDataUint32 = new Uint32Array(dynBuffer);\n this.dynamicBuffer = new _pixi_core__WEBPACK_IMPORTED_MODULE_3__.Buffer(this.dynamicData, false, false);\n // static //\n var staticOffset = 0;\n this.staticStride = 0;\n for (var i = 0; i < this.staticProperties.length; ++i) {\n var property = this.staticProperties[i];\n property.offset = staticOffset;\n staticOffset += property.size;\n this.staticStride += property.size;\n }\n var statBuffer = new ArrayBuffer(this.size * this.staticStride * 4 * 4);\n this.staticData = new Float32Array(statBuffer);\n this.staticDataUint32 = new Uint32Array(statBuffer);\n this.staticBuffer = new _pixi_core__WEBPACK_IMPORTED_MODULE_3__.Buffer(this.staticData, true, false);\n for (var i = 0; i < this.dynamicProperties.length; ++i) {\n var property = this.dynamicProperties[i];\n geometry.addAttribute(property.attributeName, this.dynamicBuffer, 0, property.type === _pixi_constants__WEBPACK_IMPORTED_MODULE_0__.TYPES.UNSIGNED_BYTE, property.type, this.dynamicStride * 4, property.offset * 4);\n }\n for (var i = 0; i < this.staticProperties.length; ++i) {\n var property = this.staticProperties[i];\n geometry.addAttribute(property.attributeName, this.staticBuffer, 0, property.type === _pixi_constants__WEBPACK_IMPORTED_MODULE_0__.TYPES.UNSIGNED_BYTE, property.type, this.staticStride * 4, property.offset * 4);\n }\n };\n /**\n * Uploads the dynamic properties.\n *\n * @private\n * @param {PIXI.DisplayObject[]} children - The children to upload.\n * @param {number} startIndex - The index to start at.\n * @param {number} amount - The number to upload.\n */\n ParticleBuffer.prototype.uploadDynamic = function (children, startIndex, amount) {\n for (var i = 0; i < this.dynamicProperties.length; i++) {\n var property = this.dynamicProperties[i];\n property.uploadFunction(children, startIndex, amount, property.type === _pixi_constants__WEBPACK_IMPORTED_MODULE_0__.TYPES.UNSIGNED_BYTE ? this.dynamicDataUint32 : this.dynamicData, this.dynamicStride, property.offset);\n }\n this.dynamicBuffer._updateID++;\n };\n /**\n * Uploads the static properties.\n *\n * @private\n * @param {PIXI.DisplayObject[]} children - The children to upload.\n * @param {number} startIndex - The index to start at.\n * @param {number} amount - The number to upload.\n */\n ParticleBuffer.prototype.uploadStatic = function (children, startIndex, amount) {\n for (var i = 0; i < this.staticProperties.length; i++) {\n var property = this.staticProperties[i];\n property.uploadFunction(children, startIndex, amount, property.type === _pixi_constants__WEBPACK_IMPORTED_MODULE_0__.TYPES.UNSIGNED_BYTE ? this.staticDataUint32 : this.staticData, this.staticStride, property.offset);\n }\n this.staticBuffer._updateID++;\n };\n /**\n * Destroys the ParticleBuffer.\n *\n * @private\n */\n ParticleBuffer.prototype.destroy = function () {\n this.indexBuffer = null;\n this.dynamicProperties = null;\n this.dynamicBuffer = null;\n this.dynamicData = null;\n this.dynamicDataUint32 = null;\n this.staticProperties = null;\n this.staticBuffer = null;\n this.staticData = null;\n this.staticDataUint32 = null;\n // all buffers are destroyed inside geometry\n this.geometry.destroy();\n };\n return ParticleBuffer;\n}());\n\nvar fragment = \"varying vec2 vTextureCoord;\\nvarying vec4 vColor;\\n\\nuniform sampler2D uSampler;\\n\\nvoid main(void){\\n vec4 color = texture2D(uSampler, vTextureCoord) * vColor;\\n gl_FragColor = color;\\n}\";\n\nvar vertex = \"attribute vec2 aVertexPosition;\\nattribute vec2 aTextureCoord;\\nattribute vec4 aColor;\\n\\nattribute vec2 aPositionCoord;\\nattribute float aRotation;\\n\\nuniform mat3 translationMatrix;\\nuniform vec4 uColor;\\n\\nvarying vec2 vTextureCoord;\\nvarying vec4 vColor;\\n\\nvoid main(void){\\n float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);\\n float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);\\n\\n vec2 v = vec2(x, y);\\n v = v + aPositionCoord;\\n\\n gl_Position = vec4((translationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);\\n\\n vTextureCoord = aTextureCoord;\\n vColor = aColor * uColor;\\n}\\n\";\n\n/**\n * @author Mat Groves\n *\n * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/\n * for creating the original PixiJS version!\n * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that they now\n * share 4 bytes on the vertex buffer\n *\n * Heavily inspired by LibGDX's ParticleRenderer:\n * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/ParticleRenderer.java\n */\n/**\n * Renderer for Particles that is designer for speed over feature set.\n *\n * @class\n * @memberof PIXI\n */\nvar ParticleRenderer = /** @class */ (function (_super) {\n __extends(ParticleRenderer, _super);\n /**\n * @param {PIXI.Renderer} renderer - The renderer this sprite batch works for.\n */\n function ParticleRenderer(renderer) {\n var _this = _super.call(this, renderer) || this;\n // 65535 is max vertex index in the index buffer (see ParticleRenderer)\n // so max number of particles is 65536 / 4 = 16384\n // and max number of element in the index buffer is 16384 * 6 = 98304\n // Creating a full index buffer, overhead is 98304 * 2 = 196Ko\n // let numIndices = 98304;\n /**\n * The default shader that is used if a sprite doesn't have a more specific one.\n *\n * @member {PIXI.Shader}\n */\n _this.shader = null;\n _this.properties = null;\n _this.tempMatrix = new _pixi_math__WEBPACK_IMPORTED_MODULE_4__.Matrix();\n _this.properties = [\n // verticesData\n {\n attributeName: 'aVertexPosition',\n size: 2,\n uploadFunction: _this.uploadVertices,\n offset: 0,\n },\n // positionData\n {\n attributeName: 'aPositionCoord',\n size: 2,\n uploadFunction: _this.uploadPosition,\n offset: 0,\n },\n // rotationData\n {\n attributeName: 'aRotation',\n size: 1,\n uploadFunction: _this.uploadRotation,\n offset: 0,\n },\n // uvsData\n {\n attributeName: 'aTextureCoord',\n size: 2,\n uploadFunction: _this.uploadUvs,\n offset: 0,\n },\n // tintData\n {\n attributeName: 'aColor',\n size: 1,\n type: _pixi_constants__WEBPACK_IMPORTED_MODULE_0__.TYPES.UNSIGNED_BYTE,\n uploadFunction: _this.uploadTint,\n offset: 0,\n } ];\n _this.shader = _pixi_core__WEBPACK_IMPORTED_MODULE_3__.Shader.from(vertex, fragment, {});\n /**\n * The WebGL state in which this renderer will work.\n *\n * @member {PIXI.State}\n * @readonly\n */\n _this.state = _pixi_core__WEBPACK_IMPORTED_MODULE_3__.State.for2d();\n return _this;\n }\n /**\n * Renders the particle container object.\n *\n * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer\n */\n ParticleRenderer.prototype.render = function (container) {\n var children = container.children;\n var maxSize = container._maxSize;\n var batchSize = container._batchSize;\n var renderer = this.renderer;\n var totalChildren = children.length;\n if (totalChildren === 0) {\n return;\n }\n else if (totalChildren > maxSize && !container.autoResize) {\n totalChildren = maxSize;\n }\n var buffers = container._buffers;\n if (!buffers) {\n buffers = container._buffers = this.generateBuffers(container);\n }\n var baseTexture = children[0]._texture.baseTexture;\n // if the uvs have not updated then no point rendering just yet!\n this.state.blendMode = (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.correctBlendMode)(container.blendMode, baseTexture.alphaMode);\n renderer.state.set(this.state);\n var gl = renderer.gl;\n var m = container.worldTransform.copyTo(this.tempMatrix);\n m.prepend(renderer.globalUniforms.uniforms.projectionMatrix);\n this.shader.uniforms.translationMatrix = m.toArray(true);\n this.shader.uniforms.uColor = (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.premultiplyRgba)(container.tintRgb, container.worldAlpha, this.shader.uniforms.uColor, baseTexture.alphaMode);\n this.shader.uniforms.uSampler = baseTexture;\n this.renderer.shader.bind(this.shader);\n var updateStatic = false;\n // now lets upload and render the buffers..\n for (var i = 0, j = 0; i < totalChildren; i += batchSize, j += 1) {\n var amount = (totalChildren - i);\n if (amount > batchSize) {\n amount = batchSize;\n }\n if (j >= buffers.length) {\n buffers.push(this._generateOneMoreBuffer(container));\n }\n var buffer = buffers[j];\n // we always upload the dynamic\n buffer.uploadDynamic(children, i, amount);\n var bid = container._bufferUpdateIDs[j] || 0;\n updateStatic = updateStatic || (buffer._updateID < bid);\n // we only upload the static content when we have to!\n if (updateStatic) {\n buffer._updateID = container._updateID;\n buffer.uploadStatic(children, i, amount);\n }\n // bind the buffer\n renderer.geometry.bind(buffer.geometry);\n gl.drawElements(gl.TRIANGLES, amount * 6, gl.UNSIGNED_SHORT, 0);\n }\n };\n /**\n * Creates one particle buffer for each child in the container we want to render and updates internal properties\n *\n * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer\n * @return {PIXI.ParticleBuffer[]} The buffers\n * @private\n */\n ParticleRenderer.prototype.generateBuffers = function (container) {\n var buffers = [];\n var size = container._maxSize;\n var batchSize = container._batchSize;\n var dynamicPropertyFlags = container._properties;\n for (var i = 0; i < size; i += batchSize) {\n buffers.push(new ParticleBuffer(this.properties, dynamicPropertyFlags, batchSize));\n }\n return buffers;\n };\n /**\n * Creates one more particle buffer, because container has autoResize feature\n *\n * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer\n * @return {PIXI.ParticleBuffer} generated buffer\n * @private\n */\n ParticleRenderer.prototype._generateOneMoreBuffer = function (container) {\n var batchSize = container._batchSize;\n var dynamicPropertyFlags = container._properties;\n return new ParticleBuffer(this.properties, dynamicPropertyFlags, batchSize);\n };\n /**\n * Uploads the vertices.\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their vertices uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n ParticleRenderer.prototype.uploadVertices = function (children, startIndex, amount, array, stride, offset) {\n var w0 = 0;\n var w1 = 0;\n var h0 = 0;\n var h1 = 0;\n for (var i = 0; i < amount; ++i) {\n var sprite = children[startIndex + i];\n var texture = sprite._texture;\n var sx = sprite.scale.x;\n var sy = sprite.scale.y;\n var trim = texture.trim;\n var orig = texture.orig;\n if (trim) {\n // if the sprite is trimmed and is not a tilingsprite then we need to add the\n // extra space before transforming the sprite coords..\n w1 = trim.x - (sprite.anchor.x * orig.width);\n w0 = w1 + trim.width;\n h1 = trim.y - (sprite.anchor.y * orig.height);\n h0 = h1 + trim.height;\n }\n else {\n w0 = (orig.width) * (1 - sprite.anchor.x);\n w1 = (orig.width) * -sprite.anchor.x;\n h0 = orig.height * (1 - sprite.anchor.y);\n h1 = orig.height * -sprite.anchor.y;\n }\n array[offset] = w1 * sx;\n array[offset + 1] = h1 * sy;\n array[offset + stride] = w0 * sx;\n array[offset + stride + 1] = h1 * sy;\n array[offset + (stride * 2)] = w0 * sx;\n array[offset + (stride * 2) + 1] = h0 * sy;\n array[offset + (stride * 3)] = w1 * sx;\n array[offset + (stride * 3) + 1] = h0 * sy;\n offset += stride * 4;\n }\n };\n /**\n * Uploads the position.\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their positions uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n ParticleRenderer.prototype.uploadPosition = function (children, startIndex, amount, array, stride, offset) {\n for (var i = 0; i < amount; i++) {\n var spritePosition = children[startIndex + i].position;\n array[offset] = spritePosition.x;\n array[offset + 1] = spritePosition.y;\n array[offset + stride] = spritePosition.x;\n array[offset + stride + 1] = spritePosition.y;\n array[offset + (stride * 2)] = spritePosition.x;\n array[offset + (stride * 2) + 1] = spritePosition.y;\n array[offset + (stride * 3)] = spritePosition.x;\n array[offset + (stride * 3) + 1] = spritePosition.y;\n offset += stride * 4;\n }\n };\n /**\n * Uploads the rotation.\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their rotation uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n ParticleRenderer.prototype.uploadRotation = function (children, startIndex, amount, array, stride, offset) {\n for (var i = 0; i < amount; i++) {\n var spriteRotation = children[startIndex + i].rotation;\n array[offset] = spriteRotation;\n array[offset + stride] = spriteRotation;\n array[offset + (stride * 2)] = spriteRotation;\n array[offset + (stride * 3)] = spriteRotation;\n offset += stride * 4;\n }\n };\n /**\n * Uploads the Uvs\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their rotation uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n ParticleRenderer.prototype.uploadUvs = function (children, startIndex, amount, array, stride, offset) {\n for (var i = 0; i < amount; ++i) {\n var textureUvs = children[startIndex + i]._texture._uvs;\n if (textureUvs) {\n array[offset] = textureUvs.x0;\n array[offset + 1] = textureUvs.y0;\n array[offset + stride] = textureUvs.x1;\n array[offset + stride + 1] = textureUvs.y1;\n array[offset + (stride * 2)] = textureUvs.x2;\n array[offset + (stride * 2) + 1] = textureUvs.y2;\n array[offset + (stride * 3)] = textureUvs.x3;\n array[offset + (stride * 3) + 1] = textureUvs.y3;\n offset += stride * 4;\n }\n else {\n // TODO you know this can be easier!\n array[offset] = 0;\n array[offset + 1] = 0;\n array[offset + stride] = 0;\n array[offset + stride + 1] = 0;\n array[offset + (stride * 2)] = 0;\n array[offset + (stride * 2) + 1] = 0;\n array[offset + (stride * 3)] = 0;\n array[offset + (stride * 3) + 1] = 0;\n offset += stride * 4;\n }\n }\n };\n /**\n * Uploads the tint.\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their rotation uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n ParticleRenderer.prototype.uploadTint = function (children, startIndex, amount, array, stride, offset) {\n for (var i = 0; i < amount; ++i) {\n var sprite = children[startIndex + i];\n var premultiplied = sprite._texture.baseTexture.alphaMode > 0;\n var alpha = sprite.alpha;\n // we dont call extra function if alpha is 1.0, that's faster\n var argb = alpha < 1.0 && premultiplied\n ? (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.premultiplyTint)(sprite._tintRGB, alpha) : sprite._tintRGB + (alpha * 255 << 24);\n array[offset] = argb;\n array[offset + stride] = argb;\n array[offset + (stride * 2)] = argb;\n array[offset + (stride * 3)] = argb;\n offset += stride * 4;\n }\n };\n /**\n * Destroys the ParticleRenderer.\n */\n ParticleRenderer.prototype.destroy = function () {\n _super.prototype.destroy.call(this);\n if (this.shader) {\n this.shader.destroy();\n this.shader = null;\n }\n this.tempMatrix = null;\n };\n return ParticleRenderer;\n}(_pixi_core__WEBPACK_IMPORTED_MODULE_3__.ObjectRenderer));\n\n\n//# sourceMappingURL=particles.es.js.map\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/@pixi/particles/lib/particles.es.js?"); /***/ }), /***/ "./node_modules/@pixi/polyfill/lib/polyfill.es.js": /*!********************************************************!*\ !*** ./node_modules/@pixi/polyfill/lib/polyfill.es.js ***! \********************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var es6_promise_polyfill__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! es6-promise-polyfill */ \"./node_modules/es6-promise-polyfill/promise.js\");\n/* harmony import */ var es6_promise_polyfill__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(es6_promise_polyfill__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var object_assign__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! object-assign */ \"./node_modules/object-assign/index.js\");\n/* harmony import */ var object_assign__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(object_assign__WEBPACK_IMPORTED_MODULE_1__);\n/*!\n * @pixi/polyfill - v5.3.11\n * Compiled Mon, 01 Nov 2021 16:10:12 UTC\n *\n * @pixi/polyfill is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n\n\n\n// Support for IE 9 - 11 which does not include Promises\nif (!window.Promise) {\n window.Promise = es6_promise_polyfill__WEBPACK_IMPORTED_MODULE_0__.Polyfill;\n}\n\n// References:\nif (!Object.assign) {\n Object.assign = (object_assign__WEBPACK_IMPORTED_MODULE_1___default());\n}\n\n// References:\n// http://paulirish.com/2011/requestanimationframe-for-smart-animating/\n// https://gist.github.com/1579671\n// http://updates.html5rocks.com/2012/05/requestAnimationFrame-API-now-with-sub-millisecond-precision\n// https://gist.github.com/timhall/4078614\n// https://github.com/Financial-Times/polyfill-service/tree/master/polyfills/requestAnimationFrame\n// Expected to be used with Browserfiy\n// Browserify automatically detects the use of `global` and passes the\n// correct reference of `global`, `self`, and finally `window`\nvar ONE_FRAME_TIME = 16;\n// Date.now\nif (!(Date.now && Date.prototype.getTime)) {\n Date.now = function now() {\n return new Date().getTime();\n };\n}\n// performance.now\nif (!(window.performance && window.performance.now)) {\n var startTime_1 = Date.now();\n if (!window.performance) {\n window.performance = {};\n }\n window.performance.now = function () { return Date.now() - startTime_1; };\n}\n// requestAnimationFrame\nvar lastTime = Date.now();\nvar vendors = ['ms', 'moz', 'webkit', 'o'];\nfor (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {\n var p = vendors[x];\n window.requestAnimationFrame = window[p + \"RequestAnimationFrame\"];\n window.cancelAnimationFrame = window[p + \"CancelAnimationFrame\"]\n || window[p + \"CancelRequestAnimationFrame\"];\n}\nif (!window.requestAnimationFrame) {\n window.requestAnimationFrame = function (callback) {\n if (typeof callback !== 'function') {\n throw new TypeError(callback + \"is not a function\");\n }\n var currentTime = Date.now();\n var delay = ONE_FRAME_TIME + lastTime - currentTime;\n if (delay < 0) {\n delay = 0;\n }\n lastTime = currentTime;\n return window.setTimeout(function () {\n lastTime = Date.now();\n callback(performance.now());\n }, delay);\n };\n}\nif (!window.cancelAnimationFrame) {\n window.cancelAnimationFrame = function (id) { return clearTimeout(id); };\n}\n\n// References:\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign\nif (!Math.sign) {\n Math.sign = function mathSign(x) {\n x = Number(x);\n if (x === 0 || isNaN(x)) {\n return x;\n }\n return x > 0 ? 1 : -1;\n };\n}\n\n// References:\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger\nif (!Number.isInteger) {\n Number.isInteger = function numberIsInteger(value) {\n return typeof value === 'number' && isFinite(value) && Math.floor(value) === value;\n };\n}\n\nif (!window.ArrayBuffer) {\n window.ArrayBuffer = Array;\n}\nif (!window.Float32Array) {\n window.Float32Array = Array;\n}\nif (!window.Uint32Array) {\n window.Uint32Array = Array;\n}\nif (!window.Uint16Array) {\n window.Uint16Array = Array;\n}\nif (!window.Uint8Array) {\n window.Uint8Array = Array;\n}\nif (!window.Int32Array) {\n window.Int32Array = Array;\n}\n//# sourceMappingURL=polyfill.es.js.map\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/@pixi/polyfill/lib/polyfill.es.js?"); /***/ }), /***/ "./node_modules/@pixi/prepare/lib/prepare.es.js": /*!******************************************************!*\ !*** ./node_modules/@pixi/prepare/lib/prepare.es.js ***! \******************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"BasePrepare\": () => (/* binding */ BasePrepare),\n/* harmony export */ \"CountLimiter\": () => (/* binding */ CountLimiter),\n/* harmony export */ \"Prepare\": () => (/* binding */ Prepare),\n/* harmony export */ \"TimeLimiter\": () => (/* binding */ TimeLimiter)\n/* harmony export */ });\n/* harmony import */ var _pixi_settings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @pixi/settings */ \"./node_modules/@pixi/settings/lib/settings.es.js\");\n/* harmony import */ var _pixi_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @pixi/core */ \"./node_modules/@pixi/core/lib/core.es.js\");\n/* harmony import */ var _pixi_graphics__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @pixi/graphics */ \"./node_modules/@pixi/graphics/lib/graphics.es.js\");\n/* harmony import */ var _pixi_ticker__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @pixi/ticker */ \"./node_modules/@pixi/ticker/lib/ticker.es.js\");\n/* harmony import */ var _pixi_display__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @pixi/display */ \"./node_modules/@pixi/display/lib/display.es.js\");\n/* harmony import */ var _pixi_text__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @pixi/text */ \"./node_modules/@pixi/text/lib/text.es.js\");\n/*!\n * @pixi/prepare - v5.3.11\n * Compiled Mon, 01 Nov 2021 16:10:12 UTC\n *\n * @pixi/prepare is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n\n\n\n\n\n\n\n/**\n * Default number of uploads per frame using prepare plugin.\n *\n * @static\n * @memberof PIXI.settings\n * @name UPLOADS_PER_FRAME\n * @type {number}\n * @default 4\n */\n_pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.UPLOADS_PER_FRAME = 4;\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } };\r\n return extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\n\n/**\n * CountLimiter limits the number of items handled by a {@link PIXI.BasePrepare} to a specified\n * number of items per frame.\n *\n * @class\n * @memberof PIXI\n */\nvar CountLimiter = /** @class */ (function () {\n /**\n * @param {number} maxItemsPerFrame - The maximum number of items that can be prepared each frame.\n */\n function CountLimiter(maxItemsPerFrame) {\n /**\n * The maximum number of items that can be prepared each frame.\n * @type {number}\n * @private\n */\n this.maxItemsPerFrame = maxItemsPerFrame;\n /**\n * The number of items that can be prepared in the current frame.\n * @type {number}\n * @private\n */\n this.itemsLeft = 0;\n }\n /**\n * Resets any counting properties to start fresh on a new frame.\n */\n CountLimiter.prototype.beginFrame = function () {\n this.itemsLeft = this.maxItemsPerFrame;\n };\n /**\n * Checks to see if another item can be uploaded. This should only be called once per item.\n * @return {boolean} If the item is allowed to be uploaded.\n */\n CountLimiter.prototype.allowedToUpload = function () {\n return this.itemsLeft-- > 0;\n };\n return CountLimiter;\n}());\n\n/**\n * Built-in hook to find multiple textures from objects like AnimatedSprites.\n *\n * @private\n * @param {PIXI.DisplayObject} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.Texture object was found.\n */\nfunction findMultipleBaseTextures(item, queue) {\n var result = false;\n // Objects with multiple textures\n if (item && item._textures && item._textures.length) {\n for (var i = 0; i < item._textures.length; i++) {\n if (item._textures[i] instanceof _pixi_core__WEBPACK_IMPORTED_MODULE_1__.Texture) {\n var baseTexture = item._textures[i].baseTexture;\n if (queue.indexOf(baseTexture) === -1) {\n queue.push(baseTexture);\n result = true;\n }\n }\n }\n }\n return result;\n}\n/**\n * Built-in hook to find BaseTextures from Texture.\n *\n * @private\n * @param {PIXI.Texture} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.Texture object was found.\n */\nfunction findBaseTexture(item, queue) {\n if (item.baseTexture instanceof _pixi_core__WEBPACK_IMPORTED_MODULE_1__.BaseTexture) {\n var texture = item.baseTexture;\n if (queue.indexOf(texture) === -1) {\n queue.push(texture);\n }\n return true;\n }\n return false;\n}\n/**\n * Built-in hook to find textures from objects.\n *\n * @private\n * @param {PIXI.DisplayObject} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.Texture object was found.\n */\nfunction findTexture(item, queue) {\n if (item._texture && item._texture instanceof _pixi_core__WEBPACK_IMPORTED_MODULE_1__.Texture) {\n var texture = item._texture.baseTexture;\n if (queue.indexOf(texture) === -1) {\n queue.push(texture);\n }\n return true;\n }\n return false;\n}\n/**\n * Built-in hook to draw PIXI.Text to its texture.\n *\n * @private\n * @param {PIXI.AbstractRenderer|PIXI.BasePrepare} helper - Not used by this upload handler\n * @param {PIXI.DisplayObject} item - Item to check\n * @return {boolean} If item was uploaded.\n */\nfunction drawText(_helper, item) {\n if (item instanceof _pixi_text__WEBPACK_IMPORTED_MODULE_5__.Text) {\n // updating text will return early if it is not dirty\n item.updateText(true);\n return true;\n }\n return false;\n}\n/**\n * Built-in hook to calculate a text style for a PIXI.Text object.\n *\n * @private\n * @param {PIXI.AbstractRenderer|PIXI.BasePrepare} helper - Not used by this upload handler\n * @param {PIXI.DisplayObject} item - Item to check\n * @return {boolean} If item was uploaded.\n */\nfunction calculateTextStyle(_helper, item) {\n if (item instanceof _pixi_text__WEBPACK_IMPORTED_MODULE_5__.TextStyle) {\n var font = item.toFontString();\n _pixi_text__WEBPACK_IMPORTED_MODULE_5__.TextMetrics.measureFont(font);\n return true;\n }\n return false;\n}\n/**\n * Built-in hook to find Text objects.\n *\n * @private\n * @param {PIXI.DisplayObject} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.Text object was found.\n */\nfunction findText(item, queue) {\n if (item instanceof _pixi_text__WEBPACK_IMPORTED_MODULE_5__.Text) {\n // push the text style to prepare it - this can be really expensive\n if (queue.indexOf(item.style) === -1) {\n queue.push(item.style);\n }\n // also push the text object so that we can render it (to canvas/texture) if needed\n if (queue.indexOf(item) === -1) {\n queue.push(item);\n }\n // also push the Text's texture for upload to GPU\n var texture = item._texture.baseTexture;\n if (queue.indexOf(texture) === -1) {\n queue.push(texture);\n }\n return true;\n }\n return false;\n}\n/**\n * Built-in hook to find TextStyle objects.\n *\n * @private\n * @param {PIXI.TextStyle} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.TextStyle object was found.\n */\nfunction findTextStyle(item, queue) {\n if (item instanceof _pixi_text__WEBPACK_IMPORTED_MODULE_5__.TextStyle) {\n if (queue.indexOf(item) === -1) {\n queue.push(item);\n }\n return true;\n }\n return false;\n}\n/**\n * The prepare manager provides functionality to upload content to the GPU.\n *\n * BasePrepare handles basic queuing functionality and is extended by\n * {@link PIXI.Prepare} and {@link PIXI.CanvasPrepare}\n * to provide preparation capabilities specific to their respective renderers.\n *\n * @example\n * // Create a sprite\n * const sprite = PIXI.Sprite.from('something.png');\n *\n * // Load object into GPU\n * app.renderer.plugins.prepare.upload(sprite, () => {\n *\n * //Texture(s) has been uploaded to GPU\n * app.stage.addChild(sprite);\n *\n * })\n *\n * @abstract\n * @class\n * @memberof PIXI\n */\nvar BasePrepare = /** @class */ (function () {\n /**\n * @param {PIXI.AbstractRenderer} renderer - A reference to the current renderer\n */\n function BasePrepare(renderer) {\n var _this = this;\n /**\n * The limiter to be used to control how quickly items are prepared.\n * @type {PIXI.CountLimiter|PIXI.TimeLimiter}\n */\n this.limiter = new CountLimiter(_pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.UPLOADS_PER_FRAME);\n /**\n * Reference to the renderer.\n * @type {PIXI.AbstractRenderer}\n * @protected\n */\n this.renderer = renderer;\n /**\n * The only real difference between CanvasPrepare and Prepare is what they pass\n * to upload hooks. That different parameter is stored here.\n * @type {object}\n * @protected\n */\n this.uploadHookHelper = null;\n /**\n * Collection of items to uploads at once.\n * @type {Array<*>}\n * @private\n */\n this.queue = [];\n /**\n * Collection of additional hooks for finding assets.\n * @type {Array}\n * @private\n */\n this.addHooks = [];\n /**\n * Collection of additional hooks for processing assets.\n * @type {Array}\n * @private\n */\n this.uploadHooks = [];\n /**\n * Callback to call after completed.\n * @type {Array}\n * @private\n */\n this.completes = [];\n /**\n * If prepare is ticking (running).\n * @type {boolean}\n * @private\n */\n this.ticking = false;\n /**\n * 'bound' call for prepareItems().\n * @type {Function}\n * @private\n */\n this.delayedTick = function () {\n // unlikely, but in case we were destroyed between tick() and delayedTick()\n if (!_this.queue) {\n return;\n }\n _this.prepareItems();\n };\n // hooks to find the correct texture\n this.registerFindHook(findText);\n this.registerFindHook(findTextStyle);\n this.registerFindHook(findMultipleBaseTextures);\n this.registerFindHook(findBaseTexture);\n this.registerFindHook(findTexture);\n // upload hooks\n this.registerUploadHook(drawText);\n this.registerUploadHook(calculateTextStyle);\n }\n /**\n * Upload all the textures and graphics to the GPU.\n *\n * @param {Function|PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text} item -\n * Either the container or display object to search for items to upload, the items to upload themselves,\n * or the callback function, if items have been added using `prepare.add`.\n * @param {Function} [done] - Optional callback when all queued uploads have completed\n */\n BasePrepare.prototype.upload = function (item, done) {\n if (typeof item === 'function') {\n done = item;\n item = null;\n }\n // If a display object, search for items\n // that we could upload\n if (item) {\n this.add(item);\n }\n // Get the items for upload from the display\n if (this.queue.length) {\n if (done) {\n this.completes.push(done);\n }\n if (!this.ticking) {\n this.ticking = true;\n _pixi_ticker__WEBPACK_IMPORTED_MODULE_3__.Ticker.system.addOnce(this.tick, this, _pixi_ticker__WEBPACK_IMPORTED_MODULE_3__.UPDATE_PRIORITY.UTILITY);\n }\n }\n else if (done) {\n done();\n }\n };\n /**\n * Handle tick update\n *\n * @private\n */\n BasePrepare.prototype.tick = function () {\n setTimeout(this.delayedTick, 0);\n };\n /**\n * Actually prepare items. This is handled outside of the tick because it will take a while\n * and we do NOT want to block the current animation frame from rendering.\n *\n * @private\n */\n BasePrepare.prototype.prepareItems = function () {\n this.limiter.beginFrame();\n // Upload the graphics\n while (this.queue.length && this.limiter.allowedToUpload()) {\n var item = this.queue[0];\n var uploaded = false;\n if (item && !item._destroyed) {\n for (var i = 0, len = this.uploadHooks.length; i < len; i++) {\n if (this.uploadHooks[i](this.uploadHookHelper, item)) {\n this.queue.shift();\n uploaded = true;\n break;\n }\n }\n }\n if (!uploaded) {\n this.queue.shift();\n }\n }\n // We're finished\n if (!this.queue.length) {\n this.ticking = false;\n var completes = this.completes.slice(0);\n this.completes.length = 0;\n for (var i = 0, len = completes.length; i < len; i++) {\n completes[i]();\n }\n }\n else {\n // if we are not finished, on the next rAF do this again\n _pixi_ticker__WEBPACK_IMPORTED_MODULE_3__.Ticker.system.addOnce(this.tick, this, _pixi_ticker__WEBPACK_IMPORTED_MODULE_3__.UPDATE_PRIORITY.UTILITY);\n }\n };\n /**\n * Adds hooks for finding items.\n *\n * @param {Function} addHook - Function call that takes two parameters: `item:*, queue:Array`\n * function must return `true` if it was able to add item to the queue.\n * @return {this} Instance of plugin for chaining.\n */\n BasePrepare.prototype.registerFindHook = function (addHook) {\n if (addHook) {\n this.addHooks.push(addHook);\n }\n return this;\n };\n /**\n * Adds hooks for uploading items.\n *\n * @param {Function} uploadHook - Function call that takes two parameters: `prepare:CanvasPrepare, item:*` and\n * function must return `true` if it was able to handle upload of item.\n * @return {this} Instance of plugin for chaining.\n */\n BasePrepare.prototype.registerUploadHook = function (uploadHook) {\n if (uploadHook) {\n this.uploadHooks.push(uploadHook);\n }\n return this;\n };\n /**\n * Manually add an item to the uploading queue.\n *\n * @param {PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text|*} item - Object to\n * add to the queue\n * @return {this} Instance of plugin for chaining.\n */\n BasePrepare.prototype.add = function (item) {\n // Add additional hooks for finding elements on special\n // types of objects that\n for (var i = 0, len = this.addHooks.length; i < len; i++) {\n if (this.addHooks[i](item, this.queue)) {\n break;\n }\n }\n // Get children recursively\n if (item instanceof _pixi_display__WEBPACK_IMPORTED_MODULE_4__.Container) {\n for (var i = item.children.length - 1; i >= 0; i--) {\n this.add(item.children[i]);\n }\n }\n return this;\n };\n /**\n * Destroys the plugin, don't use after this.\n *\n */\n BasePrepare.prototype.destroy = function () {\n if (this.ticking) {\n _pixi_ticker__WEBPACK_IMPORTED_MODULE_3__.Ticker.system.remove(this.tick, this);\n }\n this.ticking = false;\n this.addHooks = null;\n this.uploadHooks = null;\n this.renderer = null;\n this.completes = null;\n this.queue = null;\n this.limiter = null;\n this.uploadHookHelper = null;\n };\n return BasePrepare;\n}());\n\n/**\n * Built-in hook to upload PIXI.Texture objects to the GPU.\n *\n * @private\n * @param {PIXI.Renderer} renderer - instance of the webgl renderer\n * @param {PIXI.BaseTexture} item - Item to check\n * @return {boolean} If item was uploaded.\n */\nfunction uploadBaseTextures(renderer, item) {\n if (item instanceof _pixi_core__WEBPACK_IMPORTED_MODULE_1__.BaseTexture) {\n // if the texture already has a GL texture, then the texture has been prepared or rendered\n // before now. If the texture changed, then the changer should be calling texture.update() which\n // reuploads the texture without need for preparing it again\n if (!item._glTextures[renderer.CONTEXT_UID]) {\n renderer.texture.bind(item);\n }\n return true;\n }\n return false;\n}\n/**\n * Built-in hook to upload PIXI.Graphics to the GPU.\n *\n * @private\n * @param {PIXI.Renderer} renderer - instance of the webgl renderer\n * @param {PIXI.DisplayObject} item - Item to check\n * @return {boolean} If item was uploaded.\n */\nfunction uploadGraphics(renderer, item) {\n if (!(item instanceof _pixi_graphics__WEBPACK_IMPORTED_MODULE_2__.Graphics)) {\n return false;\n }\n var geometry = item.geometry;\n // update dirty graphics to get batches\n item.finishPoly();\n geometry.updateBatches();\n var batches = geometry.batches;\n // upload all textures found in styles\n for (var i = 0; i < batches.length; i++) {\n var texture = batches[i].style.texture;\n if (texture) {\n uploadBaseTextures(renderer, texture.baseTexture);\n }\n }\n // if its not batchable - update vao for particular shader\n if (!geometry.batchable) {\n renderer.geometry.bind(geometry, item._resolveDirectShader(renderer));\n }\n return true;\n}\n/**\n * Built-in hook to find graphics.\n *\n * @private\n * @param {PIXI.DisplayObject} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.Graphics object was found.\n */\nfunction findGraphics(item, queue) {\n if (item instanceof _pixi_graphics__WEBPACK_IMPORTED_MODULE_2__.Graphics) {\n queue.push(item);\n return true;\n }\n return false;\n}\n/**\n * The prepare plugin provides renderer-specific plugins for pre-rendering DisplayObjects. These plugins are useful for\n * asynchronously preparing and uploading to the GPU assets, textures, graphics waiting to be displayed.\n *\n * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property.\n * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}.\n * @example\n * // Create a new application\n * const app = new PIXI.Application();\n * document.body.appendChild(app.view);\n *\n * // Don't start rendering right away\n * app.stop();\n *\n * // create a display object\n * const rect = new PIXI.Graphics()\n * .beginFill(0x00ff00)\n * .drawRect(40, 40, 200, 200);\n *\n * // Add to the stage\n * app.stage.addChild(rect);\n *\n * // Don't start rendering until the graphic is uploaded to the GPU\n * app.renderer.plugins.prepare.upload(app.stage, () => {\n * app.start();\n * });\n *\n * @class\n * @extends PIXI.BasePrepare\n * @memberof PIXI\n */\nvar Prepare = /** @class */ (function (_super) {\n __extends(Prepare, _super);\n /**\n * @param {PIXI.Renderer} renderer - A reference to the current renderer\n */\n function Prepare(renderer) {\n var _this = _super.call(this, renderer) || this;\n _this.uploadHookHelper = _this.renderer;\n // Add textures and graphics to upload\n _this.registerFindHook(findGraphics);\n _this.registerUploadHook(uploadBaseTextures);\n _this.registerUploadHook(uploadGraphics);\n return _this;\n }\n return Prepare;\n}(BasePrepare));\n\n/**\n * TimeLimiter limits the number of items handled by a {@link PIXI.BasePrepare} to a specified\n * number of milliseconds per frame.\n *\n * @class\n * @memberof PIXI\n */\nvar TimeLimiter = /** @class */ (function () {\n /**\n * @param {number} maxMilliseconds - The maximum milliseconds that can be spent preparing items each frame.\n */\n function TimeLimiter(maxMilliseconds) {\n /**\n * The maximum milliseconds that can be spent preparing items each frame.\n * @type {number}\n * @private\n */\n this.maxMilliseconds = maxMilliseconds;\n /**\n * The start time of the current frame.\n * @type {number}\n * @private\n */\n this.frameStart = 0;\n }\n /**\n * Resets any counting properties to start fresh on a new frame.\n */\n TimeLimiter.prototype.beginFrame = function () {\n this.frameStart = Date.now();\n };\n /**\n * Checks to see if another item can be uploaded. This should only be called once per item.\n * @return {boolean} If the item is allowed to be uploaded.\n */\n TimeLimiter.prototype.allowedToUpload = function () {\n return Date.now() - this.frameStart < this.maxMilliseconds;\n };\n return TimeLimiter;\n}());\n\n\n//# sourceMappingURL=prepare.es.js.map\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/@pixi/prepare/lib/prepare.es.js?"); /***/ }), /***/ "./node_modules/@pixi/runner/lib/runner.es.js": /*!****************************************************!*\ !*** ./node_modules/@pixi/runner/lib/runner.es.js ***! \****************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Runner\": () => (/* binding */ Runner)\n/* harmony export */ });\n/*!\n * @pixi/runner - v5.3.11\n * Compiled Mon, 01 Nov 2021 16:10:12 UTC\n *\n * @pixi/runner is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n/**\n * A Runner is a highly performant and simple alternative to signals. Best used in situations\n * where events are dispatched to many objects at high frequency (say every frame!)\n *\n *\n * like a signal..\n * ```\n * import { Runner } from '@pixi/runner';\n *\n * const myObject = {\n * loaded: new Runner('loaded')\n * }\n *\n * const listener = {\n * loaded: function(){\n * // thin\n * }\n * }\n *\n * myObject.update.add(listener);\n *\n * myObject.loaded.emit();\n * ```\n *\n * Or for handling calling the same function on many items\n * ```\n * import { Runner } from '@pixi/runner';\n *\n * const myGame = {\n * update: new Runner('update')\n * }\n *\n * const gameObject = {\n * update: function(time){\n * // update my gamey state\n * }\n * }\n *\n * myGame.update.add(gameObject1);\n *\n * myGame.update.emit(time);\n * ```\n * @class\n * @memberof PIXI\n */\nvar Runner = /** @class */ (function () {\n /**\n * @param {string} name - the function name that will be executed on the listeners added to this Runner.\n */\n function Runner(name) {\n this.items = [];\n this._name = name;\n this._aliasCount = 0;\n }\n /**\n * Dispatch/Broadcast Runner to all listeners added to the queue.\n * @param {...any} params - optional parameters to pass to each listener\n * @return {PIXI.Runner}\n */\n Runner.prototype.emit = function (a0, a1, a2, a3, a4, a5, a6, a7) {\n if (arguments.length > 8) {\n throw new Error('max arguments reached');\n }\n var _a = this, name = _a.name, items = _a.items;\n this._aliasCount++;\n for (var i = 0, len = items.length; i < len; i++) {\n items[i][name](a0, a1, a2, a3, a4, a5, a6, a7);\n }\n if (items === this.items) {\n this._aliasCount--;\n }\n return this;\n };\n Runner.prototype.ensureNonAliasedItems = function () {\n if (this._aliasCount > 0 && this.items.length > 1) {\n this._aliasCount = 0;\n this.items = this.items.slice(0);\n }\n };\n /**\n * Add a listener to the Runner\n *\n * Runners do not need to have scope or functions passed to them.\n * All that is required is to pass the listening object and ensure that it has contains a function that has the same name\n * as the name provided to the Runner when it was created.\n *\n * Eg A listener passed to this Runner will require a 'complete' function.\n *\n * ```\n * import { Runner } from '@pixi/runner';\n *\n * const complete = new Runner('complete');\n * ```\n *\n * The scope used will be the object itself.\n *\n * @param {any} item - The object that will be listening.\n * @return {PIXI.Runner}\n */\n Runner.prototype.add = function (item) {\n if (item[this._name]) {\n this.ensureNonAliasedItems();\n this.remove(item);\n this.items.push(item);\n }\n return this;\n };\n /**\n * Remove a single listener from the dispatch queue.\n * @param {any} item - The listenr that you would like to remove.\n * @return {PIXI.Runner}\n */\n Runner.prototype.remove = function (item) {\n var index = this.items.indexOf(item);\n if (index !== -1) {\n this.ensureNonAliasedItems();\n this.items.splice(index, 1);\n }\n return this;\n };\n /**\n * Check to see if the listener is already in the Runner\n * @param {any} item - The listener that you would like to check.\n */\n Runner.prototype.contains = function (item) {\n return this.items.indexOf(item) !== -1;\n };\n /**\n * Remove all listeners from the Runner\n * @return {PIXI.Runner}\n */\n Runner.prototype.removeAll = function () {\n this.ensureNonAliasedItems();\n this.items.length = 0;\n return this;\n };\n /**\n * Remove all references, don't use after this.\n */\n Runner.prototype.destroy = function () {\n this.removeAll();\n this.items = null;\n this._name = null;\n };\n Object.defineProperty(Runner.prototype, \"empty\", {\n /**\n * `true` if there are no this Runner contains no listeners\n *\n * @member {boolean}\n * @readonly\n */\n get: function () {\n return this.items.length === 0;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Runner.prototype, \"name\", {\n /**\n * The name of the runner.\n *\n * @member {string}\n * @readonly\n */\n get: function () {\n return this._name;\n },\n enumerable: false,\n configurable: true\n });\n return Runner;\n}());\nObject.defineProperties(Runner.prototype, {\n /**\n * Alias for `emit`\n * @memberof PIXI.Runner#\n * @method dispatch\n * @see PIXI.Runner#emit\n */\n dispatch: { value: Runner.prototype.emit },\n /**\n * Alias for `emit`\n * @memberof PIXI.Runner#\n * @method run\n * @see PIXI.Runner#emit\n */\n run: { value: Runner.prototype.emit },\n});\n\n\n//# sourceMappingURL=runner.es.js.map\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/@pixi/runner/lib/runner.es.js?"); /***/ }), /***/ "./node_modules/@pixi/settings/lib/settings.es.js": /*!********************************************************!*\ !*** ./node_modules/@pixi/settings/lib/settings.es.js ***! \********************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"isMobile\": () => (/* binding */ isMobile),\n/* harmony export */ \"settings\": () => (/* binding */ settings)\n/* harmony export */ });\n/* harmony import */ var ismobilejs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ismobilejs */ \"./node_modules/ismobilejs/esm/index.js\");\n/*!\n * @pixi/settings - v5.3.11\n * Compiled Mon, 01 Nov 2021 16:10:12 UTC\n *\n * @pixi/settings is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n\n\n// The ESM/CJS versions of ismobilejs only\nvar isMobile = (0,ismobilejs__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(window.navigator);\n\n/**\n * The maximum recommended texture units to use.\n * In theory the bigger the better, and for desktop we'll use as many as we can.\n * But some mobile devices slow down if there is to many branches in the shader.\n * So in practice there seems to be a sweet spot size that varies depending on the device.\n *\n * In v4, all mobile devices were limited to 4 texture units because for this.\n * In v5, we allow all texture units to be used on modern Apple or Android devices.\n *\n * @private\n * @param {number} max\n * @returns {number}\n */\nfunction maxRecommendedTextures(max) {\n var allowMax = true;\n if (isMobile.tablet || isMobile.phone) {\n if (isMobile.apple.device) {\n var match = (navigator.userAgent).match(/OS (\\d+)_(\\d+)?/);\n if (match) {\n var majorVersion = parseInt(match[1], 10);\n // Limit texture units on devices below iOS 11, which will be older hardware\n if (majorVersion < 11) {\n allowMax = false;\n }\n }\n }\n if (isMobile.android.device) {\n var match = (navigator.userAgent).match(/Android\\s([0-9.]*)/);\n if (match) {\n var majorVersion = parseInt(match[1], 10);\n // Limit texture units on devices below Android 7 (Nougat), which will be older hardware\n if (majorVersion < 7) {\n allowMax = false;\n }\n }\n }\n }\n return allowMax ? max : 4;\n}\n\n/**\n * Uploading the same buffer multiple times in a single frame can cause performance issues.\n * Apparent on iOS so only check for that at the moment\n * This check may become more complex if this issue pops up elsewhere.\n *\n * @private\n * @returns {boolean}\n */\nfunction canUploadSameBuffer() {\n return !isMobile.apple.device;\n}\n\n/**\n * User's customizable globals for overriding the default PIXI settings, such\n * as a renderer's default resolution, framerate, float precision, etc.\n * @example\n * // Use the native window resolution as the default resolution\n * // will support high-density displays when rendering\n * PIXI.settings.RESOLUTION = window.devicePixelRatio;\n *\n * // Disable interpolation when scaling, will make texture be pixelated\n * PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST;\n * @namespace PIXI.settings\n */\nvar settings = {\n /**\n * If set to true WebGL will attempt make textures mimpaped by default.\n * Mipmapping will only succeed if the base texture uploaded has power of two dimensions.\n *\n * @static\n * @name MIPMAP_TEXTURES\n * @memberof PIXI.settings\n * @type {PIXI.MIPMAP_MODES}\n * @default PIXI.MIPMAP_MODES.POW2\n */\n MIPMAP_TEXTURES: 1,\n /**\n * Default anisotropic filtering level of textures.\n * Usually from 0 to 16\n *\n * @static\n * @name ANISOTROPIC_LEVEL\n * @memberof PIXI.settings\n * @type {number}\n * @default 0\n */\n ANISOTROPIC_LEVEL: 0,\n /**\n * Default resolution / device pixel ratio of the renderer.\n *\n * @static\n * @name RESOLUTION\n * @memberof PIXI.settings\n * @type {number}\n * @default 1\n */\n RESOLUTION: 1,\n /**\n * Default filter resolution.\n *\n * @static\n * @name FILTER_RESOLUTION\n * @memberof PIXI.settings\n * @type {number}\n * @default 1\n */\n FILTER_RESOLUTION: 1,\n /**\n * The maximum textures that this device supports.\n *\n * @static\n * @name SPRITE_MAX_TEXTURES\n * @memberof PIXI.settings\n * @type {number}\n * @default 32\n */\n SPRITE_MAX_TEXTURES: maxRecommendedTextures(32),\n // TODO: maybe change to SPRITE.BATCH_SIZE: 2000\n // TODO: maybe add PARTICLE.BATCH_SIZE: 15000\n /**\n * The default sprite batch size.\n *\n * The default aims to balance desktop and mobile devices.\n *\n * @static\n * @name SPRITE_BATCH_SIZE\n * @memberof PIXI.settings\n * @type {number}\n * @default 4096\n */\n SPRITE_BATCH_SIZE: 4096,\n /**\n * The default render options if none are supplied to {@link PIXI.Renderer}\n * or {@link PIXI.CanvasRenderer}.\n *\n * @static\n * @name RENDER_OPTIONS\n * @memberof PIXI.settings\n * @type {object}\n * @property {HTMLCanvasElement} view=null\n * @property {number} resolution=1\n * @property {boolean} antialias=false\n * @property {boolean} autoDensity=false\n * @property {boolean} transparent=false\n * @property {number} backgroundColor=0x000000\n * @property {boolean} clearBeforeRender=true\n * @property {boolean} preserveDrawingBuffer=false\n * @property {number} width=800\n * @property {number} height=600\n * @property {boolean} legacy=false\n */\n RENDER_OPTIONS: {\n view: null,\n antialias: false,\n autoDensity: false,\n transparent: false,\n backgroundColor: 0x000000,\n clearBeforeRender: true,\n preserveDrawingBuffer: false,\n width: 800,\n height: 600,\n legacy: false,\n },\n /**\n * Default Garbage Collection mode.\n *\n * @static\n * @name GC_MODE\n * @memberof PIXI.settings\n * @type {PIXI.GC_MODES}\n * @default PIXI.GC_MODES.AUTO\n */\n GC_MODE: 0,\n /**\n * Default Garbage Collection max idle.\n *\n * @static\n * @name GC_MAX_IDLE\n * @memberof PIXI.settings\n * @type {number}\n * @default 3600\n */\n GC_MAX_IDLE: 60 * 60,\n /**\n * Default Garbage Collection maximum check count.\n *\n * @static\n * @name GC_MAX_CHECK_COUNT\n * @memberof PIXI.settings\n * @type {number}\n * @default 600\n */\n GC_MAX_CHECK_COUNT: 60 * 10,\n /**\n * Default wrap modes that are supported by pixi.\n *\n * @static\n * @name WRAP_MODE\n * @memberof PIXI.settings\n * @type {PIXI.WRAP_MODES}\n * @default PIXI.WRAP_MODES.CLAMP\n */\n WRAP_MODE: 33071,\n /**\n * Default scale mode for textures.\n *\n * @static\n * @name SCALE_MODE\n * @memberof PIXI.settings\n * @type {PIXI.SCALE_MODES}\n * @default PIXI.SCALE_MODES.LINEAR\n */\n SCALE_MODE: 1,\n /**\n * Default specify float precision in vertex shader.\n *\n * @static\n * @name PRECISION_VERTEX\n * @memberof PIXI.settings\n * @type {PIXI.PRECISION}\n * @default PIXI.PRECISION.HIGH\n */\n PRECISION_VERTEX: 'highp',\n /**\n * Default specify float precision in fragment shader.\n * iOS is best set at highp due to https://github.com/pixijs/pixi.js/issues/3742\n *\n * @static\n * @name PRECISION_FRAGMENT\n * @memberof PIXI.settings\n * @type {PIXI.PRECISION}\n * @default PIXI.PRECISION.MEDIUM\n */\n PRECISION_FRAGMENT: isMobile.apple.device ? 'highp' : 'mediump',\n /**\n * Can we upload the same buffer in a single frame?\n *\n * @static\n * @name CAN_UPLOAD_SAME_BUFFER\n * @memberof PIXI.settings\n * @type {boolean}\n */\n CAN_UPLOAD_SAME_BUFFER: canUploadSameBuffer(),\n /**\n * Enables bitmap creation before image load. This feature is experimental.\n *\n * @static\n * @name CREATE_IMAGE_BITMAP\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\n CREATE_IMAGE_BITMAP: false,\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n *\n * @static\n * @constant\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\n ROUND_PIXELS: false,\n};\n\n\n//# sourceMappingURL=settings.es.js.map\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/@pixi/settings/lib/settings.es.js?"); /***/ }), /***/ "./node_modules/@pixi/sprite-animated/lib/sprite-animated.es.js": /*!**********************************************************************!*\ !*** ./node_modules/@pixi/sprite-animated/lib/sprite-animated.es.js ***! \**********************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"AnimatedSprite\": () => (/* binding */ AnimatedSprite)\n/* harmony export */ });\n/* harmony import */ var _pixi_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @pixi/core */ \"./node_modules/@pixi/core/lib/core.es.js\");\n/* harmony import */ var _pixi_sprite__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @pixi/sprite */ \"./node_modules/@pixi/sprite/lib/sprite.es.js\");\n/* harmony import */ var _pixi_ticker__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @pixi/ticker */ \"./node_modules/@pixi/ticker/lib/ticker.es.js\");\n/*!\n * @pixi/sprite-animated - v5.3.11\n * Compiled Mon, 01 Nov 2021 16:10:12 UTC\n *\n * @pixi/sprite-animated is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n\n\n\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } };\r\n return extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\n\n/**\n * An AnimatedSprite is a simple way to display an animation depicted by a list of textures.\n *\n * ```js\n * let alienImages = [\"image_sequence_01.png\",\"image_sequence_02.png\",\"image_sequence_03.png\",\"image_sequence_04.png\"];\n * let textureArray = [];\n *\n * for (let i=0; i < 4; i++)\n * {\n * let texture = PIXI.Texture.from(alienImages[i]);\n * textureArray.push(texture);\n * };\n *\n * let animatedSprite = new PIXI.AnimatedSprite(textureArray);\n * ```\n *\n * The more efficient and simpler way to create an animated sprite is using a {@link PIXI.Spritesheet}\n * containing the animation definitions:\n *\n * ```js\n * PIXI.Loader.shared.add(\"assets/spritesheet.json\").load(setup);\n *\n * function setup() {\n * let sheet = PIXI.Loader.shared.resources[\"assets/spritesheet.json\"].spritesheet;\n * animatedSprite = new PIXI.AnimatedSprite(sheet.animations[\"image_sequence\"]);\n * ...\n * }\n * ```\n *\n * @class\n * @extends PIXI.Sprite\n * @memberof PIXI\n */\nvar AnimatedSprite = /** @class */ (function (_super) {\n __extends(AnimatedSprite, _super);\n /**\n * @param {PIXI.Texture[]|PIXI.AnimatedSprite.FrameObject[]} textures - An array of {@link PIXI.Texture} or frame\n * objects that make up the animation.\n * @param {boolean} [autoUpdate=true] - Whether to use PIXI.Ticker.shared to auto update animation time.\n */\n function AnimatedSprite(textures, autoUpdate) {\n if (autoUpdate === void 0) { autoUpdate = true; }\n var _this = _super.call(this, textures[0] instanceof _pixi_core__WEBPACK_IMPORTED_MODULE_0__.Texture ? textures[0] : textures[0].texture) || this;\n /**\n * @type {PIXI.Texture[]}\n * @private\n */\n _this._textures = null;\n /**\n * @type {number[]}\n * @private\n */\n _this._durations = null;\n /**\n * `true` uses PIXI.Ticker.shared to auto update animation time.\n *\n * @type {boolean}\n * @default true\n * @private\n */\n _this._autoUpdate = autoUpdate;\n /**\n * `true` if the instance is currently connected to PIXI.Ticker.shared to auto update animation time.\n *\n * @type {boolean}\n * @default false\n * @private\n */\n _this._isConnectedToTicker = false;\n /**\n * The speed that the AnimatedSprite will play at. Higher is faster, lower is slower.\n *\n * @member {number}\n * @default 1\n */\n _this.animationSpeed = 1;\n /**\n * Whether or not the animate sprite repeats after playing.\n *\n * @member {boolean}\n * @default true\n */\n _this.loop = true;\n /**\n * Update anchor to [Texture's defaultAnchor]{@link PIXI.Texture#defaultAnchor} when frame changes.\n *\n * Useful with [sprite sheet animations]{@link PIXI.Spritesheet#animations} created with tools.\n * Changing anchor for each frame allows to pin sprite origin to certain moving feature\n * of the frame (e.g. left foot).\n *\n * Note: Enabling this will override any previously set `anchor` on each frame change.\n *\n * @member {boolean}\n * @default false\n */\n _this.updateAnchor = false;\n /**\n * User-assigned function to call when an AnimatedSprite finishes playing.\n *\n * @example\n * animation.onComplete = function () {\n * // finished!\n * };\n * @member {Function}\n */\n _this.onComplete = null;\n /**\n * User-assigned function to call when an AnimatedSprite changes which texture is being rendered.\n *\n * @example\n * animation.onFrameChange = function () {\n * // updated!\n * };\n * @member {Function}\n */\n _this.onFrameChange = null;\n /**\n * User-assigned function to call when `loop` is true, and an AnimatedSprite is played and\n * loops around to start again.\n *\n * @example\n * animation.onLoop = function () {\n * // looped!\n * };\n * @member {Function}\n */\n _this.onLoop = null;\n /**\n * Elapsed time since animation has been started, used internally to display current texture.\n *\n * @member {number}\n * @private\n */\n _this._currentTime = 0;\n _this._playing = false;\n /**\n * The texture index that was displayed last time\n *\n * @member {number}\n * @private\n */\n _this._previousFrame = null;\n _this.textures = textures;\n return _this;\n }\n /**\n * Stops the AnimatedSprite.\n *\n */\n AnimatedSprite.prototype.stop = function () {\n if (!this._playing) {\n return;\n }\n this._playing = false;\n if (this._autoUpdate && this._isConnectedToTicker) {\n _pixi_ticker__WEBPACK_IMPORTED_MODULE_2__.Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n };\n /**\n * Plays the AnimatedSprite.\n *\n */\n AnimatedSprite.prototype.play = function () {\n if (this._playing) {\n return;\n }\n this._playing = true;\n if (this._autoUpdate && !this._isConnectedToTicker) {\n _pixi_ticker__WEBPACK_IMPORTED_MODULE_2__.Ticker.shared.add(this.update, this, _pixi_ticker__WEBPACK_IMPORTED_MODULE_2__.UPDATE_PRIORITY.HIGH);\n this._isConnectedToTicker = true;\n }\n };\n /**\n * Stops the AnimatedSprite and goes to a specific frame.\n *\n * @param {number} frameNumber - Frame index to stop at.\n */\n AnimatedSprite.prototype.gotoAndStop = function (frameNumber) {\n this.stop();\n var previousFrame = this.currentFrame;\n this._currentTime = frameNumber;\n if (previousFrame !== this.currentFrame) {\n this.updateTexture();\n }\n };\n /**\n * Goes to a specific frame and begins playing the AnimatedSprite.\n *\n * @param {number} frameNumber - Frame index to start at.\n */\n AnimatedSprite.prototype.gotoAndPlay = function (frameNumber) {\n var previousFrame = this.currentFrame;\n this._currentTime = frameNumber;\n if (previousFrame !== this.currentFrame) {\n this.updateTexture();\n }\n this.play();\n };\n /**\n * Updates the object transform for rendering.\n *\n * @param {number} deltaTime - Time since last tick.\n */\n AnimatedSprite.prototype.update = function (deltaTime) {\n if (!this._playing) {\n return;\n }\n var elapsed = this.animationSpeed * deltaTime;\n var previousFrame = this.currentFrame;\n if (this._durations !== null) {\n var lag = this._currentTime % 1 * this._durations[this.currentFrame];\n lag += elapsed / 60 * 1000;\n while (lag < 0) {\n this._currentTime--;\n lag += this._durations[this.currentFrame];\n }\n var sign = Math.sign(this.animationSpeed * deltaTime);\n this._currentTime = Math.floor(this._currentTime);\n while (lag >= this._durations[this.currentFrame]) {\n lag -= this._durations[this.currentFrame] * sign;\n this._currentTime += sign;\n }\n this._currentTime += lag / this._durations[this.currentFrame];\n }\n else {\n this._currentTime += elapsed;\n }\n if (this._currentTime < 0 && !this.loop) {\n this.gotoAndStop(0);\n if (this.onComplete) {\n this.onComplete();\n }\n }\n else if (this._currentTime >= this._textures.length && !this.loop) {\n this.gotoAndStop(this._textures.length - 1);\n if (this.onComplete) {\n this.onComplete();\n }\n }\n else if (previousFrame !== this.currentFrame) {\n if (this.loop && this.onLoop) {\n if (this.animationSpeed > 0 && this.currentFrame < previousFrame) {\n this.onLoop();\n }\n else if (this.animationSpeed < 0 && this.currentFrame > previousFrame) {\n this.onLoop();\n }\n }\n this.updateTexture();\n }\n };\n /**\n * Updates the displayed texture to match the current frame index.\n *\n * @private\n */\n AnimatedSprite.prototype.updateTexture = function () {\n var currentFrame = this.currentFrame;\n if (this._previousFrame === currentFrame) {\n return;\n }\n this._previousFrame = currentFrame;\n this._texture = this._textures[currentFrame];\n this._textureID = -1;\n this._textureTrimmedID = -1;\n this._cachedTint = 0xFFFFFF;\n this.uvs = this._texture._uvs.uvsFloat32;\n if (this.updateAnchor) {\n this._anchor.copyFrom(this._texture.defaultAnchor);\n }\n if (this.onFrameChange) {\n this.onFrameChange(this.currentFrame);\n }\n };\n /**\n * Stops the AnimatedSprite and destroys it.\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value.\n * @param {boolean} [options.children=false] - If set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well.\n * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well.\n */\n AnimatedSprite.prototype.destroy = function (options) {\n this.stop();\n _super.prototype.destroy.call(this, options);\n this.onComplete = null;\n this.onFrameChange = null;\n this.onLoop = null;\n };\n /**\n * A short hand way of creating an AnimatedSprite from an array of frame ids.\n *\n * @static\n * @param {string[]} frames - The array of frames ids the AnimatedSprite will use as its texture frames.\n * @return {PIXI.AnimatedSprite} The new animated sprite with the specified frames.\n */\n AnimatedSprite.fromFrames = function (frames) {\n var textures = [];\n for (var i = 0; i < frames.length; ++i) {\n textures.push(_pixi_core__WEBPACK_IMPORTED_MODULE_0__.Texture.from(frames[i]));\n }\n return new AnimatedSprite(textures);\n };\n /**\n * A short hand way of creating an AnimatedSprite from an array of image ids.\n *\n * @static\n * @param {string[]} images - The array of image urls the AnimatedSprite will use as its texture frames.\n * @return {PIXI.AnimatedSprite} The new animate sprite with the specified images as frames.\n */\n AnimatedSprite.fromImages = function (images) {\n var textures = [];\n for (var i = 0; i < images.length; ++i) {\n textures.push(_pixi_core__WEBPACK_IMPORTED_MODULE_0__.Texture.from(images[i]));\n }\n return new AnimatedSprite(textures);\n };\n Object.defineProperty(AnimatedSprite.prototype, \"totalFrames\", {\n /**\n * The total number of frames in the AnimatedSprite. This is the same as number of textures\n * assigned to the AnimatedSprite.\n *\n * @readonly\n * @member {number}\n * @default 0\n */\n get: function () {\n return this._textures.length;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(AnimatedSprite.prototype, \"textures\", {\n /**\n * The array of textures used for this AnimatedSprite.\n *\n * @member {PIXI.Texture[]|PIXI.AnimatedSprite.FrameObject[]}\n */\n get: function () {\n return this._textures;\n },\n set: function (value) {\n if (value[0] instanceof _pixi_core__WEBPACK_IMPORTED_MODULE_0__.Texture) {\n this._textures = value;\n this._durations = null;\n }\n else {\n this._textures = [];\n this._durations = [];\n for (var i = 0; i < value.length; i++) {\n this._textures.push(value[i].texture);\n this._durations.push(value[i].time);\n }\n }\n this._previousFrame = null;\n this.gotoAndStop(0);\n this.updateTexture();\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(AnimatedSprite.prototype, \"currentFrame\", {\n /**\n * The AnimatedSprites current frame index.\n *\n * @member {number}\n * @readonly\n */\n get: function () {\n var currentFrame = Math.floor(this._currentTime) % this._textures.length;\n if (currentFrame < 0) {\n currentFrame += this._textures.length;\n }\n return currentFrame;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(AnimatedSprite.prototype, \"playing\", {\n /**\n * Indicates if the AnimatedSprite is currently playing.\n *\n * @member {boolean}\n * @readonly\n */\n get: function () {\n return this._playing;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(AnimatedSprite.prototype, \"autoUpdate\", {\n /**\n * Whether to use PIXI.Ticker.shared to auto update animation time\n *\n * @member {boolean}\n */\n get: function () {\n return this._autoUpdate;\n },\n set: function (value) {\n if (value !== this._autoUpdate) {\n this._autoUpdate = value;\n if (!this._autoUpdate && this._isConnectedToTicker) {\n _pixi_ticker__WEBPACK_IMPORTED_MODULE_2__.Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n else if (this._autoUpdate && !this._isConnectedToTicker && this._playing) {\n _pixi_ticker__WEBPACK_IMPORTED_MODULE_2__.Ticker.shared.add(this.update, this);\n this._isConnectedToTicker = true;\n }\n }\n },\n enumerable: false,\n configurable: true\n });\n return AnimatedSprite;\n}(_pixi_sprite__WEBPACK_IMPORTED_MODULE_1__.Sprite));\n/**\n * @memberof PIXI.AnimatedSprite\n * @typedef {object} FrameObject\n * @type {object}\n * @property {PIXI.Texture} texture - The {@link PIXI.Texture} of the frame\n * @property {number} time - the duration of the frame in ms\n */\n\n\n//# sourceMappingURL=sprite-animated.es.js.map\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/@pixi/sprite-animated/lib/sprite-animated.es.js?"); /***/ }), /***/ "./node_modules/@pixi/sprite-tiling/lib/sprite-tiling.es.js": /*!******************************************************************!*\ !*** ./node_modules/@pixi/sprite-tiling/lib/sprite-tiling.es.js ***! \******************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"TilingSprite\": () => (/* binding */ TilingSprite),\n/* harmony export */ \"TilingSpriteRenderer\": () => (/* binding */ TilingSpriteRenderer)\n/* harmony export */ });\n/* harmony import */ var _pixi_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @pixi/core */ \"./node_modules/@pixi/core/lib/core.es.js\");\n/* harmony import */ var _pixi_math__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @pixi/math */ \"./node_modules/@pixi/math/lib/math.es.js\");\n/* harmony import */ var _pixi_sprite__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @pixi/sprite */ \"./node_modules/@pixi/sprite/lib/sprite.es.js\");\n/* harmony import */ var _pixi_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @pixi/utils */ \"./node_modules/@pixi/utils/lib/utils.es.js\");\n/* harmony import */ var _pixi_constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @pixi/constants */ \"./node_modules/@pixi/constants/lib/constants.es.js\");\n/*!\n * @pixi/sprite-tiling - v5.3.11\n * Compiled Mon, 01 Nov 2021 16:10:12 UTC\n *\n * @pixi/sprite-tiling is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n\n\n\n\n\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } };\r\n return extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\n\nvar tempPoint = new _pixi_math__WEBPACK_IMPORTED_MODULE_1__.Point();\n/**\n * A tiling sprite is a fast way of rendering a tiling image\n *\n * @class\n * @extends PIXI.Sprite\n * @memberof PIXI\n */\nvar TilingSprite = /** @class */ (function (_super) {\n __extends(TilingSprite, _super);\n /**\n * @param {PIXI.Texture} texture - the texture of the tiling sprite\n * @param {number} [width=100] - the width of the tiling sprite\n * @param {number} [height=100] - the height of the tiling sprite\n */\n function TilingSprite(texture, width, height) {\n if (width === void 0) { width = 100; }\n if (height === void 0) { height = 100; }\n var _this = _super.call(this, texture) || this;\n /**\n * Tile transform\n *\n * @member {PIXI.Transform}\n */\n _this.tileTransform = new _pixi_math__WEBPACK_IMPORTED_MODULE_1__.Transform();\n /**\n * The with of the tiling sprite\n *\n * @member {number}\n * @private\n */\n _this._width = width;\n /**\n * The height of the tiling sprite\n *\n * @member {number}\n * @private\n */\n _this._height = height;\n /**\n * matrix that is applied to UV to get the coords in Texture normalized space to coords in BaseTexture space\n *\n * @member {PIXI.TextureMatrix}\n */\n _this.uvMatrix = _this.texture.uvMatrix || new _pixi_core__WEBPACK_IMPORTED_MODULE_0__.TextureMatrix(texture);\n /**\n * Plugin that is responsible for rendering this element.\n * Allows to customize the rendering process without overriding '_render' method.\n *\n * @member {string}\n * @default 'tilingSprite'\n */\n _this.pluginName = 'tilingSprite';\n /**\n * Whether or not anchor affects uvs\n *\n * @member {boolean}\n * @default false\n */\n _this.uvRespectAnchor = false;\n return _this;\n }\n Object.defineProperty(TilingSprite.prototype, \"clampMargin\", {\n /**\n * Changes frame clamping in corresponding textureTransform, shortcut\n * Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas\n *\n * @default 0.5\n * @member {number}\n */\n get: function () {\n return this.uvMatrix.clampMargin;\n },\n set: function (value) {\n this.uvMatrix.clampMargin = value;\n this.uvMatrix.update(true);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TilingSprite.prototype, \"tileScale\", {\n /**\n * The scaling of the image that is being tiled\n *\n * @member {PIXI.ObservablePoint}\n */\n get: function () {\n return this.tileTransform.scale;\n },\n set: function (value) {\n this.tileTransform.scale.copyFrom(value);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TilingSprite.prototype, \"tilePosition\", {\n /**\n * The offset of the image that is being tiled\n *\n * @member {PIXI.ObservablePoint}\n */\n get: function () {\n return this.tileTransform.position;\n },\n set: function (value) {\n this.tileTransform.position.copyFrom(value);\n },\n enumerable: false,\n configurable: true\n });\n /**\n * @protected\n */\n TilingSprite.prototype._onTextureUpdate = function () {\n if (this.uvMatrix) {\n this.uvMatrix.texture = this._texture;\n }\n this._cachedTint = 0xFFFFFF;\n };\n /**\n * Renders the object using the WebGL renderer\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n TilingSprite.prototype._render = function (renderer) {\n // tweak our texture temporarily..\n var texture = this._texture;\n if (!texture || !texture.valid) {\n return;\n }\n this.tileTransform.updateLocalTransform();\n this.uvMatrix.update();\n renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]);\n renderer.plugins[this.pluginName].render(this);\n };\n /**\n * Updates the bounds of the tiling sprite.\n *\n * @protected\n */\n TilingSprite.prototype._calculateBounds = function () {\n var minX = this._width * -this._anchor._x;\n var minY = this._height * -this._anchor._y;\n var maxX = this._width * (1 - this._anchor._x);\n var maxY = this._height * (1 - this._anchor._y);\n this._bounds.addFrame(this.transform, minX, minY, maxX, maxY);\n };\n /**\n * Gets the local bounds of the sprite object.\n *\n * @param {PIXI.Rectangle} rect - The output rectangle.\n * @return {PIXI.Rectangle} The bounds.\n */\n TilingSprite.prototype.getLocalBounds = function (rect) {\n // we can do a fast local bounds if the sprite has no children!\n if (this.children.length === 0) {\n this._bounds.minX = this._width * -this._anchor._x;\n this._bounds.minY = this._height * -this._anchor._y;\n this._bounds.maxX = this._width * (1 - this._anchor._x);\n this._bounds.maxY = this._height * (1 - this._anchor._y);\n if (!rect) {\n if (!this._localBoundsRect) {\n this._localBoundsRect = new _pixi_math__WEBPACK_IMPORTED_MODULE_1__.Rectangle();\n }\n rect = this._localBoundsRect;\n }\n return this._bounds.getRectangle(rect);\n }\n return _super.prototype.getLocalBounds.call(this, rect);\n };\n /**\n * Checks if a point is inside this tiling sprite.\n *\n * @param {PIXI.IPointData} point - the point to check\n * @return {boolean} Whether or not the sprite contains the point.\n */\n TilingSprite.prototype.containsPoint = function (point) {\n this.worldTransform.applyInverse(point, tempPoint);\n var width = this._width;\n var height = this._height;\n var x1 = -width * this.anchor._x;\n if (tempPoint.x >= x1 && tempPoint.x < x1 + width) {\n var y1 = -height * this.anchor._y;\n if (tempPoint.y >= y1 && tempPoint.y < y1 + height) {\n return true;\n }\n }\n return false;\n };\n /**\n * Destroys this sprite and optionally its texture and children\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well\n * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well\n */\n TilingSprite.prototype.destroy = function (options) {\n _super.prototype.destroy.call(this, options);\n this.tileTransform = null;\n this.uvMatrix = null;\n };\n /**\n * Helper function that creates a new tiling sprite based on the source you provide.\n * The source can be - frame id, image url, video url, canvas element, video element, base texture\n *\n * @static\n * @param {string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from\n * @param {Object} options - See {@link PIXI.BaseTexture}'s constructor for options.\n * @param {number} options.width - required width of the tiling sprite\n * @param {number} options.height - required height of the tiling sprite\n * @return {PIXI.TilingSprite} The newly created texture\n */\n TilingSprite.from = function (source, options) {\n // Deprecated\n if (typeof options === 'number') {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_3__.deprecation)('5.3.0', 'TilingSprite.from use options instead of width and height args');\n // eslint-disable-next-line prefer-rest-params\n options = { width: options, height: arguments[2] };\n }\n return new TilingSprite(_pixi_core__WEBPACK_IMPORTED_MODULE_0__.Texture.from(source, options), options.width, options.height);\n };\n Object.defineProperty(TilingSprite.prototype, \"width\", {\n /**\n * The width of the sprite, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get: function () {\n return this._width;\n },\n set: function (value) {\n this._width = value;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TilingSprite.prototype, \"height\", {\n /**\n * The height of the TilingSprite, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get: function () {\n return this._height;\n },\n set: function (value) {\n this._height = value;\n },\n enumerable: false,\n configurable: true\n });\n return TilingSprite;\n}(_pixi_sprite__WEBPACK_IMPORTED_MODULE_2__.Sprite));\n\nvar vertex = \"attribute vec2 aVertexPosition;\\nattribute vec2 aTextureCoord;\\n\\nuniform mat3 projectionMatrix;\\nuniform mat3 translationMatrix;\\nuniform mat3 uTransform;\\n\\nvarying vec2 vTextureCoord;\\n\\nvoid main(void)\\n{\\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\\n\\n vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\\n}\\n\";\n\nvar fragment = \"varying vec2 vTextureCoord;\\n\\nuniform sampler2D uSampler;\\nuniform vec4 uColor;\\nuniform mat3 uMapCoord;\\nuniform vec4 uClampFrame;\\nuniform vec2 uClampOffset;\\n\\nvoid main(void)\\n{\\n vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\\n\\n vec4 texSample = texture2D(uSampler, coord);\\n gl_FragColor = texSample * uColor;\\n}\\n\";\n\nvar fragmentSimple = \"varying vec2 vTextureCoord;\\n\\nuniform sampler2D uSampler;\\nuniform vec4 uColor;\\n\\nvoid main(void)\\n{\\n vec4 texSample = texture2D(uSampler, vTextureCoord);\\n gl_FragColor = texSample * uColor;\\n}\\n\";\n\nvar tempMat = new _pixi_math__WEBPACK_IMPORTED_MODULE_1__.Matrix();\n/**\n * WebGL renderer plugin for tiling sprites\n *\n * @class\n * @memberof PIXI\n * @extends PIXI.ObjectRenderer\n */\nvar TilingSpriteRenderer = /** @class */ (function (_super) {\n __extends(TilingSpriteRenderer, _super);\n /**\n * constructor for renderer\n *\n * @param {PIXI.Renderer} renderer - The renderer this tiling awesomeness works for.\n */\n function TilingSpriteRenderer(renderer) {\n var _this = _super.call(this, renderer) || this;\n var uniforms = { globals: _this.renderer.globalUniforms };\n _this.shader = _pixi_core__WEBPACK_IMPORTED_MODULE_0__.Shader.from(vertex, fragment, uniforms);\n _this.simpleShader = _pixi_core__WEBPACK_IMPORTED_MODULE_0__.Shader.from(vertex, fragmentSimple, uniforms);\n _this.quad = new _pixi_core__WEBPACK_IMPORTED_MODULE_0__.QuadUv();\n /**\n * The WebGL state in which this renderer will work.\n *\n * @member {PIXI.State}\n * @readonly\n */\n _this.state = _pixi_core__WEBPACK_IMPORTED_MODULE_0__.State.for2d();\n return _this;\n }\n /**\n *\n * @param {PIXI.TilingSprite} ts - tilingSprite to be rendered\n */\n TilingSpriteRenderer.prototype.render = function (ts) {\n var renderer = this.renderer;\n var quad = this.quad;\n var vertices = quad.vertices;\n vertices[0] = vertices[6] = (ts._width) * -ts.anchor.x;\n vertices[1] = vertices[3] = ts._height * -ts.anchor.y;\n vertices[2] = vertices[4] = (ts._width) * (1.0 - ts.anchor.x);\n vertices[5] = vertices[7] = ts._height * (1.0 - ts.anchor.y);\n if (ts.uvRespectAnchor) {\n vertices = quad.uvs;\n vertices[0] = vertices[6] = -ts.anchor.x;\n vertices[1] = vertices[3] = -ts.anchor.y;\n vertices[2] = vertices[4] = 1.0 - ts.anchor.x;\n vertices[5] = vertices[7] = 1.0 - ts.anchor.y;\n }\n quad.invalidate();\n var tex = ts._texture;\n var baseTex = tex.baseTexture;\n var lt = ts.tileTransform.localTransform;\n var uv = ts.uvMatrix;\n var isSimple = baseTex.isPowerOfTwo\n && tex.frame.width === baseTex.width && tex.frame.height === baseTex.height;\n // auto, force repeat wrapMode for big tiling textures\n if (isSimple) {\n if (!baseTex._glTextures[renderer.CONTEXT_UID]) {\n if (baseTex.wrapMode === _pixi_constants__WEBPACK_IMPORTED_MODULE_4__.WRAP_MODES.CLAMP) {\n baseTex.wrapMode = _pixi_constants__WEBPACK_IMPORTED_MODULE_4__.WRAP_MODES.REPEAT;\n }\n }\n else {\n isSimple = baseTex.wrapMode !== _pixi_constants__WEBPACK_IMPORTED_MODULE_4__.WRAP_MODES.CLAMP;\n }\n }\n var shader = isSimple ? this.simpleShader : this.shader;\n var w = tex.width;\n var h = tex.height;\n var W = ts._width;\n var H = ts._height;\n tempMat.set(lt.a * w / W, lt.b * w / H, lt.c * h / W, lt.d * h / H, lt.tx / W, lt.ty / H);\n // that part is the same as above:\n // tempMat.identity();\n // tempMat.scale(tex.width, tex.height);\n // tempMat.prepend(lt);\n // tempMat.scale(1.0 / ts._width, 1.0 / ts._height);\n tempMat.invert();\n if (isSimple) {\n tempMat.prepend(uv.mapCoord);\n }\n else {\n shader.uniforms.uMapCoord = uv.mapCoord.toArray(true);\n shader.uniforms.uClampFrame = uv.uClampFrame;\n shader.uniforms.uClampOffset = uv.uClampOffset;\n }\n shader.uniforms.uTransform = tempMat.toArray(true);\n shader.uniforms.uColor = (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_3__.premultiplyTintToRgba)(ts.tint, ts.worldAlpha, shader.uniforms.uColor, baseTex.alphaMode);\n shader.uniforms.translationMatrix = ts.transform.worldTransform.toArray(true);\n shader.uniforms.uSampler = tex;\n renderer.shader.bind(shader);\n renderer.geometry.bind(quad);\n this.state.blendMode = (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_3__.correctBlendMode)(ts.blendMode, baseTex.alphaMode);\n renderer.state.set(this.state);\n renderer.geometry.draw(this.renderer.gl.TRIANGLES, 6, 0);\n };\n return TilingSpriteRenderer;\n}(_pixi_core__WEBPACK_IMPORTED_MODULE_0__.ObjectRenderer));\n\n\n//# sourceMappingURL=sprite-tiling.es.js.map\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/@pixi/sprite-tiling/lib/sprite-tiling.es.js?"); /***/ }), /***/ "./node_modules/@pixi/sprite/lib/sprite.es.js": /*!****************************************************!*\ !*** ./node_modules/@pixi/sprite/lib/sprite.es.js ***! \****************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Sprite\": () => (/* binding */ Sprite)\n/* harmony export */ });\n/* harmony import */ var _pixi_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @pixi/constants */ \"./node_modules/@pixi/constants/lib/constants.es.js\");\n/* harmony import */ var _pixi_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @pixi/core */ \"./node_modules/@pixi/core/lib/core.es.js\");\n/* harmony import */ var _pixi_display__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @pixi/display */ \"./node_modules/@pixi/display/lib/display.es.js\");\n/* harmony import */ var _pixi_math__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @pixi/math */ \"./node_modules/@pixi/math/lib/math.es.js\");\n/* harmony import */ var _pixi_settings__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @pixi/settings */ \"./node_modules/@pixi/settings/lib/settings.es.js\");\n/* harmony import */ var _pixi_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @pixi/utils */ \"./node_modules/@pixi/utils/lib/utils.es.js\");\n/*!\n * @pixi/sprite - v5.3.11\n * Compiled Mon, 01 Nov 2021 16:10:12 UTC\n *\n * @pixi/sprite is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n\n\n\n\n\n\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } };\r\n return extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\n\nvar tempPoint = new _pixi_math__WEBPACK_IMPORTED_MODULE_3__.Point();\nvar indices = new Uint16Array([0, 1, 2, 0, 2, 3]);\n/**\n * The Sprite object is the base for all textured objects that are rendered to the screen\n*\n * A sprite can be created directly from an image like this:\n *\n * ```js\n * let sprite = PIXI.Sprite.from('assets/image.png');\n * ```\n *\n * The more efficient way to create sprites is using a {@link PIXI.Spritesheet},\n * as swapping base textures when rendering to the screen is inefficient.\n *\n * ```js\n * PIXI.Loader.shared.add(\"assets/spritesheet.json\").load(setup);\n *\n * function setup() {\n * let sheet = PIXI.Loader.shared.resources[\"assets/spritesheet.json\"].spritesheet;\n * let sprite = new PIXI.Sprite(sheet.textures[\"image.png\"]);\n * ...\n * }\n * ```\n *\n * @class\n * @extends PIXI.Container\n * @memberof PIXI\n */\nvar Sprite = /** @class */ (function (_super) {\n __extends(Sprite, _super);\n /**\n * @param {PIXI.Texture} [texture] - The texture for this sprite.\n */\n function Sprite(texture) {\n var _this = _super.call(this) || this;\n /**\n * The anchor point defines the normalized coordinates\n * in the texture that map to the position of this\n * sprite.\n *\n * By default, this is `(0,0)` (or `texture.defaultAnchor`\n * if you have modified that), which means the position\n * `(x,y)` of this `Sprite` will be the top-left corner.\n *\n * Note: Updating `texture.defaultAnchor` after\n * constructing a `Sprite` does _not_ update its anchor.\n *\n * {@link https://docs.cocos2d-x.org/cocos2d-x/en/sprites/manipulation.html}\n *\n * @default `texture.defaultAnchor`\n * @member {PIXI.ObservablePoint}\n * @private\n */\n _this._anchor = new _pixi_math__WEBPACK_IMPORTED_MODULE_3__.ObservablePoint(_this._onAnchorUpdate, _this, (texture ? texture.defaultAnchor.x : 0), (texture ? texture.defaultAnchor.y : 0));\n /**\n * The texture that the sprite is using\n *\n * @private\n * @member {PIXI.Texture}\n */\n _this._texture = null;\n /**\n * The width of the sprite (this is initially set by the texture)\n *\n * @protected\n * @member {number}\n */\n _this._width = 0;\n /**\n * The height of the sprite (this is initially set by the texture)\n *\n * @protected\n * @member {number}\n */\n _this._height = 0;\n /**\n * The tint applied to the sprite. This is a hex value. A value of 0xFFFFFF will remove any tint effect.\n *\n * @private\n * @member {number}\n * @default 0xFFFFFF\n */\n _this._tint = null;\n /**\n * The tint applied to the sprite. This is a RGB value. A value of 0xFFFFFF will remove any tint effect.\n *\n * @private\n * @member {number}\n * @default 16777215\n */\n _this._tintRGB = null;\n _this.tint = 0xFFFFFF;\n /**\n * The blend mode to be applied to the sprite. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL\n * @see PIXI.BLEND_MODES\n */\n _this.blendMode = _pixi_constants__WEBPACK_IMPORTED_MODULE_0__.BLEND_MODES.NORMAL;\n /**\n * Cached tint value so we can tell when the tint is changed.\n * Value is used for 2d CanvasRenderer.\n *\n * @protected\n * @member {number}\n * @default 0xFFFFFF\n */\n _this._cachedTint = 0xFFFFFF;\n /**\n * this is used to store the uvs data of the sprite, assigned at the same time\n * as the vertexData in calculateVertices()\n *\n * @private\n * @member {Float32Array}\n */\n _this.uvs = null;\n // call texture setter\n _this.texture = texture || _pixi_core__WEBPACK_IMPORTED_MODULE_1__.Texture.EMPTY;\n /**\n * this is used to store the vertex data of the sprite (basically a quad)\n *\n * @private\n * @member {Float32Array}\n */\n _this.vertexData = new Float32Array(8);\n /**\n * This is used to calculate the bounds of the object IF it is a trimmed sprite\n *\n * @private\n * @member {Float32Array}\n */\n _this.vertexTrimmedData = null;\n _this._transformID = -1;\n _this._textureID = -1;\n _this._transformTrimmedID = -1;\n _this._textureTrimmedID = -1;\n // Batchable stuff..\n // TODO could make this a mixin?\n _this.indices = indices;\n /**\n * Plugin that is responsible for rendering this element.\n * Allows to customize the rendering process without overriding '_render' & '_renderCanvas' methods.\n *\n * @member {string}\n * @default 'batch'\n */\n _this.pluginName = 'batch';\n /**\n * used to fast check if a sprite is.. a sprite!\n * @member {boolean}\n */\n _this.isSprite = true;\n /**\n * Internal roundPixels field\n *\n * @member {boolean}\n * @private\n */\n _this._roundPixels = _pixi_settings__WEBPACK_IMPORTED_MODULE_4__.settings.ROUND_PIXELS;\n return _this;\n }\n /**\n * When the texture is updated, this event will fire to update the scale and frame\n *\n * @protected\n */\n Sprite.prototype._onTextureUpdate = function () {\n this._textureID = -1;\n this._textureTrimmedID = -1;\n this._cachedTint = 0xFFFFFF;\n // so if _width is 0 then width was not set..\n if (this._width) {\n this.scale.x = (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_5__.sign)(this.scale.x) * this._width / this._texture.orig.width;\n }\n if (this._height) {\n this.scale.y = (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_5__.sign)(this.scale.y) * this._height / this._texture.orig.height;\n }\n };\n /**\n * Called when the anchor position updates.\n *\n * @private\n */\n Sprite.prototype._onAnchorUpdate = function () {\n this._transformID = -1;\n this._transformTrimmedID = -1;\n };\n /**\n * calculates worldTransform * vertices, store it in vertexData\n */\n Sprite.prototype.calculateVertices = function () {\n var texture = this._texture;\n if (this._transformID === this.transform._worldID && this._textureID === texture._updateID) {\n return;\n }\n // update texture UV here, because base texture can be changed without calling `_onTextureUpdate`\n if (this._textureID !== texture._updateID) {\n this.uvs = this._texture._uvs.uvsFloat32;\n }\n this._transformID = this.transform._worldID;\n this._textureID = texture._updateID;\n // set the vertex data\n var wt = this.transform.worldTransform;\n var a = wt.a;\n var b = wt.b;\n var c = wt.c;\n var d = wt.d;\n var tx = wt.tx;\n var ty = wt.ty;\n var vertexData = this.vertexData;\n var trim = texture.trim;\n var orig = texture.orig;\n var anchor = this._anchor;\n var w0 = 0;\n var w1 = 0;\n var h0 = 0;\n var h1 = 0;\n if (trim) {\n // if the sprite is trimmed and is not a tilingsprite then we need to add the extra\n // space before transforming the sprite coords.\n w1 = trim.x - (anchor._x * orig.width);\n w0 = w1 + trim.width;\n h1 = trim.y - (anchor._y * orig.height);\n h0 = h1 + trim.height;\n }\n else {\n w1 = -anchor._x * orig.width;\n w0 = w1 + orig.width;\n h1 = -anchor._y * orig.height;\n h0 = h1 + orig.height;\n }\n // xy\n vertexData[0] = (a * w1) + (c * h1) + tx;\n vertexData[1] = (d * h1) + (b * w1) + ty;\n // xy\n vertexData[2] = (a * w0) + (c * h1) + tx;\n vertexData[3] = (d * h1) + (b * w0) + ty;\n // xy\n vertexData[4] = (a * w0) + (c * h0) + tx;\n vertexData[5] = (d * h0) + (b * w0) + ty;\n // xy\n vertexData[6] = (a * w1) + (c * h0) + tx;\n vertexData[7] = (d * h0) + (b * w1) + ty;\n if (this._roundPixels) {\n var resolution = _pixi_settings__WEBPACK_IMPORTED_MODULE_4__.settings.RESOLUTION;\n for (var i = 0; i < vertexData.length; ++i) {\n vertexData[i] = Math.round((vertexData[i] * resolution | 0) / resolution);\n }\n }\n };\n /**\n * calculates worldTransform * vertices for a non texture with a trim. store it in vertexTrimmedData\n * This is used to ensure that the true width and height of a trimmed texture is respected\n */\n Sprite.prototype.calculateTrimmedVertices = function () {\n if (!this.vertexTrimmedData) {\n this.vertexTrimmedData = new Float32Array(8);\n }\n else if (this._transformTrimmedID === this.transform._worldID && this._textureTrimmedID === this._texture._updateID) {\n return;\n }\n this._transformTrimmedID = this.transform._worldID;\n this._textureTrimmedID = this._texture._updateID;\n // lets do some special trim code!\n var texture = this._texture;\n var vertexData = this.vertexTrimmedData;\n var orig = texture.orig;\n var anchor = this._anchor;\n // lets calculate the new untrimmed bounds..\n var wt = this.transform.worldTransform;\n var a = wt.a;\n var b = wt.b;\n var c = wt.c;\n var d = wt.d;\n var tx = wt.tx;\n var ty = wt.ty;\n var w1 = -anchor._x * orig.width;\n var w0 = w1 + orig.width;\n var h1 = -anchor._y * orig.height;\n var h0 = h1 + orig.height;\n // xy\n vertexData[0] = (a * w1) + (c * h1) + tx;\n vertexData[1] = (d * h1) + (b * w1) + ty;\n // xy\n vertexData[2] = (a * w0) + (c * h1) + tx;\n vertexData[3] = (d * h1) + (b * w0) + ty;\n // xy\n vertexData[4] = (a * w0) + (c * h0) + tx;\n vertexData[5] = (d * h0) + (b * w0) + ty;\n // xy\n vertexData[6] = (a * w1) + (c * h0) + tx;\n vertexData[7] = (d * h0) + (b * w1) + ty;\n };\n /**\n *\n * Renders the object using the WebGL renderer\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The webgl renderer to use.\n */\n Sprite.prototype._render = function (renderer) {\n this.calculateVertices();\n renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]);\n renderer.plugins[this.pluginName].render(this);\n };\n /**\n * Updates the bounds of the sprite.\n *\n * @protected\n */\n Sprite.prototype._calculateBounds = function () {\n var trim = this._texture.trim;\n var orig = this._texture.orig;\n // First lets check to see if the current texture has a trim..\n if (!trim || (trim.width === orig.width && trim.height === orig.height)) {\n // no trim! lets use the usual calculations..\n this.calculateVertices();\n this._bounds.addQuad(this.vertexData);\n }\n else {\n // lets calculate a special trimmed bounds...\n this.calculateTrimmedVertices();\n this._bounds.addQuad(this.vertexTrimmedData);\n }\n };\n /**\n * Gets the local bounds of the sprite object.\n *\n * @param {PIXI.Rectangle} [rect] - The output rectangle.\n * @return {PIXI.Rectangle} The bounds.\n */\n Sprite.prototype.getLocalBounds = function (rect) {\n // we can do a fast local bounds if the sprite has no children!\n if (this.children.length === 0) {\n this._bounds.minX = this._texture.orig.width * -this._anchor._x;\n this._bounds.minY = this._texture.orig.height * -this._anchor._y;\n this._bounds.maxX = this._texture.orig.width * (1 - this._anchor._x);\n this._bounds.maxY = this._texture.orig.height * (1 - this._anchor._y);\n if (!rect) {\n if (!this._localBoundsRect) {\n this._localBoundsRect = new _pixi_math__WEBPACK_IMPORTED_MODULE_3__.Rectangle();\n }\n rect = this._localBoundsRect;\n }\n return this._bounds.getRectangle(rect);\n }\n return _super.prototype.getLocalBounds.call(this, rect);\n };\n /**\n * Tests if a point is inside this sprite\n *\n * @param {PIXI.IPointData} point - the point to test\n * @return {boolean} the result of the test\n */\n Sprite.prototype.containsPoint = function (point) {\n this.worldTransform.applyInverse(point, tempPoint);\n var width = this._texture.orig.width;\n var height = this._texture.orig.height;\n var x1 = -width * this.anchor.x;\n var y1 = 0;\n if (tempPoint.x >= x1 && tempPoint.x < x1 + width) {\n y1 = -height * this.anchor.y;\n if (tempPoint.y >= y1 && tempPoint.y < y1 + height) {\n return true;\n }\n }\n return false;\n };\n /**\n * Destroys this sprite and optionally its texture and children\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well\n * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well\n */\n Sprite.prototype.destroy = function (options) {\n _super.prototype.destroy.call(this, options);\n this._texture.off('update', this._onTextureUpdate, this);\n this._anchor = null;\n var destroyTexture = typeof options === 'boolean' ? options : options && options.texture;\n if (destroyTexture) {\n var destroyBaseTexture = typeof options === 'boolean' ? options : options && options.baseTexture;\n this._texture.destroy(!!destroyBaseTexture);\n }\n this._texture = null;\n };\n // some helper functions..\n /**\n * Helper function that creates a new sprite based on the source you provide.\n * The source can be - frame id, image url, video url, canvas element, video element, base texture\n *\n * @static\n * @param {string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from\n * @param {object} [options] - See {@link PIXI.BaseTexture}'s constructor for options.\n * @return {PIXI.Sprite} The newly created sprite\n */\n Sprite.from = function (source, options) {\n var texture = (source instanceof _pixi_core__WEBPACK_IMPORTED_MODULE_1__.Texture)\n ? source\n : _pixi_core__WEBPACK_IMPORTED_MODULE_1__.Texture.from(source, options);\n return new Sprite(texture);\n };\n Object.defineProperty(Sprite.prototype, \"roundPixels\", {\n get: function () {\n return this._roundPixels;\n },\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n * To set the global default, change {@link PIXI.settings.ROUND_PIXELS}\n *\n * @member {boolean}\n * @default false\n */\n set: function (value) {\n if (this._roundPixels !== value) {\n this._transformID = -1;\n }\n this._roundPixels = value;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Sprite.prototype, \"width\", {\n /**\n * The width of the sprite, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get: function () {\n return Math.abs(this.scale.x) * this._texture.orig.width;\n },\n set: function (value) {\n var s = (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_5__.sign)(this.scale.x) || 1;\n this.scale.x = s * value / this._texture.orig.width;\n this._width = value;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Sprite.prototype, \"height\", {\n /**\n * The height of the sprite, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get: function () {\n return Math.abs(this.scale.y) * this._texture.orig.height;\n },\n set: function (value) {\n var s = (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_5__.sign)(this.scale.y) || 1;\n this.scale.y = s * value / this._texture.orig.height;\n this._height = value;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Sprite.prototype, \"anchor\", {\n /**\n * The anchor sets the origin point of the sprite. The default value is taken from the {@link PIXI.Texture|Texture}\n * and passed to the constructor.\n *\n * The default is `(0,0)`, this means the sprite's origin is the top left.\n *\n * Setting the anchor to `(0.5,0.5)` means the sprite's origin is centered.\n *\n * Setting the anchor to `(1,1)` would mean the sprite's origin point will be the bottom right corner.\n *\n * If you pass only single parameter, it will set both x and y to the same value as shown in the example below.\n *\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.anchor.set(0.5); // This will set the origin to center. (0.5) is same as (0.5, 0.5).\n *\n * @member {PIXI.ObservablePoint}\n */\n get: function () {\n return this._anchor;\n },\n set: function (value) {\n this._anchor.copyFrom(value);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Sprite.prototype, \"tint\", {\n /**\n * The tint applied to the sprite. This is a hex value.\n * A value of 0xFFFFFF will remove any tint effect.\n *\n * @member {number}\n * @default 0xFFFFFF\n */\n get: function () {\n return this._tint;\n },\n set: function (value) {\n this._tint = value;\n this._tintRGB = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Sprite.prototype, \"texture\", {\n /**\n * The texture that the sprite is using\n *\n * @member {PIXI.Texture}\n */\n get: function () {\n return this._texture;\n },\n set: function (value) {\n if (this._texture === value) {\n return;\n }\n if (this._texture) {\n this._texture.off('update', this._onTextureUpdate, this);\n }\n this._texture = value || _pixi_core__WEBPACK_IMPORTED_MODULE_1__.Texture.EMPTY;\n this._cachedTint = 0xFFFFFF;\n this._textureID = -1;\n this._textureTrimmedID = -1;\n if (value) {\n // wait for the texture to load\n if (value.baseTexture.valid) {\n this._onTextureUpdate();\n }\n else {\n value.once('update', this._onTextureUpdate, this);\n }\n }\n },\n enumerable: false,\n configurable: true\n });\n return Sprite;\n}(_pixi_display__WEBPACK_IMPORTED_MODULE_2__.Container));\n\n\n//# sourceMappingURL=sprite.es.js.map\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/@pixi/sprite/lib/sprite.es.js?"); /***/ }), /***/ "./node_modules/@pixi/spritesheet/lib/spritesheet.es.js": /*!**************************************************************!*\ !*** ./node_modules/@pixi/spritesheet/lib/spritesheet.es.js ***! \**************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Spritesheet\": () => (/* binding */ Spritesheet),\n/* harmony export */ \"SpritesheetLoader\": () => (/* binding */ SpritesheetLoader)\n/* harmony export */ });\n/* harmony import */ var _pixi_math__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @pixi/math */ \"./node_modules/@pixi/math/lib/math.es.js\");\n/* harmony import */ var _pixi_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @pixi/core */ \"./node_modules/@pixi/core/lib/core.es.js\");\n/* harmony import */ var _pixi_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @pixi/utils */ \"./node_modules/@pixi/utils/lib/utils.es.js\");\n/* harmony import */ var _pixi_loaders__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @pixi/loaders */ \"./node_modules/@pixi/loaders/lib/loaders.es.js\");\n/*!\n * @pixi/spritesheet - v5.3.11\n * Compiled Mon, 01 Nov 2021 16:10:12 UTC\n *\n * @pixi/spritesheet is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n\n\n\n\n\n/**\n * Utility class for maintaining reference to a collection\n * of Textures on a single Spritesheet.\n *\n * To access a sprite sheet from your code pass its JSON data file to Pixi's loader:\n *\n * ```js\n * PIXI.Loader.shared.add(\"images/spritesheet.json\").load(setup);\n *\n * function setup() {\n * let sheet = PIXI.Loader.shared.resources[\"images/spritesheet.json\"].spritesheet;\n * ...\n * }\n * ```\n * With the `sheet.textures` you can create Sprite objects,`sheet.animations` can be used to create an AnimatedSprite.\n *\n * Sprite sheets can be packed using tools like {@link https://codeandweb.com/texturepacker|TexturePacker},\n * {@link https://renderhjs.net/shoebox/|Shoebox} or {@link https://github.com/krzysztof-o/spritesheet.js|Spritesheet.js}.\n * Default anchor points (see {@link PIXI.Texture#defaultAnchor}) and grouping of animation sprites are currently only\n * supported by TexturePacker.\n *\n * @class\n * @memberof PIXI\n */\nvar Spritesheet = /** @class */ (function () {\n /**\n * @param {PIXI.BaseTexture|PIXI.Texture} baseTexture - Reference to the source BaseTexture object.\n * @param {Object} data - Spritesheet image data.\n * @param {string} [resolutionFilename] - The filename to consider when determining\n * the resolution of the spritesheet. If not provided, the imageUrl will\n * be used on the BaseTexture.\n */\n function Spritesheet(texture, data, resolutionFilename) {\n if (resolutionFilename === void 0) { resolutionFilename = null; }\n /**\n * Reference to original source image from the Loader. This reference is retained so we\n * can destroy the Texture later on. It is never used internally.\n * @type {PIXI.Texture}\n * @private\n */\n this._texture = texture instanceof _pixi_core__WEBPACK_IMPORTED_MODULE_1__.Texture ? texture : null;\n /**\n * Reference to ths source texture.\n * @type {PIXI.BaseTexture}\n */\n this.baseTexture = texture instanceof _pixi_core__WEBPACK_IMPORTED_MODULE_1__.BaseTexture ? texture : this._texture.baseTexture;\n /**\n * A map containing all textures of the sprite sheet.\n * Can be used to create a {@link PIXI.Sprite|Sprite}:\n * ```js\n * new PIXI.Sprite(sheet.textures[\"image.png\"]);\n * ```\n * @member {Object}\n */\n this.textures = {};\n /**\n * A map containing the textures for each animation.\n * Can be used to create an {@link PIXI.AnimatedSprite|AnimatedSprite}:\n * ```js\n * new PIXI.AnimatedSprite(sheet.animations[\"anim_name\"])\n * ```\n * @member {Object}\n */\n this.animations = {};\n /**\n * Reference to the original JSON data.\n * @type {Object}\n */\n this.data = data;\n var resource = this.baseTexture.resource;\n /**\n * The resolution of the spritesheet.\n * @type {number}\n */\n this.resolution = this._updateResolution(resolutionFilename || (resource ? resource.url : null));\n /**\n * Map of spritesheet frames.\n * @type {Object}\n * @private\n */\n this._frames = this.data.frames;\n /**\n * Collection of frame names.\n * @type {string[]}\n * @private\n */\n this._frameKeys = Object.keys(this._frames);\n /**\n * Current batch index being processed.\n * @type {number}\n * @private\n */\n this._batchIndex = 0;\n /**\n * Callback when parse is completed.\n * @type {Function}\n * @private\n */\n this._callback = null;\n }\n /**\n * Generate the resolution from the filename or fallback\n * to the meta.scale field of the JSON data.\n *\n * @private\n * @param {string} resolutionFilename - The filename to use for resolving\n * the default resolution.\n * @return {number} Resolution to use for spritesheet.\n */\n Spritesheet.prototype._updateResolution = function (resolutionFilename) {\n if (resolutionFilename === void 0) { resolutionFilename = null; }\n var scale = this.data.meta.scale;\n // Use a defaultValue of `null` to check if a url-based resolution is set\n var resolution = (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_2__.getResolutionOfUrl)(resolutionFilename, null);\n // No resolution found via URL\n if (resolution === null) {\n // Use the scale value or default to 1\n resolution = scale !== undefined ? parseFloat(scale) : 1;\n }\n // For non-1 resolutions, update baseTexture\n if (resolution !== 1) {\n this.baseTexture.setResolution(resolution);\n }\n return resolution;\n };\n /**\n * Parser spritesheet from loaded data. This is done asynchronously\n * to prevent creating too many Texture within a single process.\n *\n * @param {Function} callback - Callback when complete returns\n * a map of the Textures for this spritesheet.\n */\n Spritesheet.prototype.parse = function (callback) {\n this._batchIndex = 0;\n this._callback = callback;\n if (this._frameKeys.length <= Spritesheet.BATCH_SIZE) {\n this._processFrames(0);\n this._processAnimations();\n this._parseComplete();\n }\n else {\n this._nextBatch();\n }\n };\n /**\n * Process a batch of frames\n *\n * @private\n * @param {number} initialFrameIndex - The index of frame to start.\n */\n Spritesheet.prototype._processFrames = function (initialFrameIndex) {\n var frameIndex = initialFrameIndex;\n var maxFrames = Spritesheet.BATCH_SIZE;\n while (frameIndex - initialFrameIndex < maxFrames && frameIndex < this._frameKeys.length) {\n var i = this._frameKeys[frameIndex];\n var data = this._frames[i];\n var rect = data.frame;\n if (rect) {\n var frame = null;\n var trim = null;\n var sourceSize = data.trimmed !== false && data.sourceSize\n ? data.sourceSize : data.frame;\n var orig = new _pixi_math__WEBPACK_IMPORTED_MODULE_0__.Rectangle(0, 0, Math.floor(sourceSize.w) / this.resolution, Math.floor(sourceSize.h) / this.resolution);\n if (data.rotated) {\n frame = new _pixi_math__WEBPACK_IMPORTED_MODULE_0__.Rectangle(Math.floor(rect.x) / this.resolution, Math.floor(rect.y) / this.resolution, Math.floor(rect.h) / this.resolution, Math.floor(rect.w) / this.resolution);\n }\n else {\n frame = new _pixi_math__WEBPACK_IMPORTED_MODULE_0__.Rectangle(Math.floor(rect.x) / this.resolution, Math.floor(rect.y) / this.resolution, Math.floor(rect.w) / this.resolution, Math.floor(rect.h) / this.resolution);\n }\n // Check to see if the sprite is trimmed\n if (data.trimmed !== false && data.spriteSourceSize) {\n trim = new _pixi_math__WEBPACK_IMPORTED_MODULE_0__.Rectangle(Math.floor(data.spriteSourceSize.x) / this.resolution, Math.floor(data.spriteSourceSize.y) / this.resolution, Math.floor(rect.w) / this.resolution, Math.floor(rect.h) / this.resolution);\n }\n this.textures[i] = new _pixi_core__WEBPACK_IMPORTED_MODULE_1__.Texture(this.baseTexture, frame, orig, trim, data.rotated ? 2 : 0, data.anchor);\n // lets also add the frame to pixi's global cache for 'from' and 'fromLoader' functions\n _pixi_core__WEBPACK_IMPORTED_MODULE_1__.Texture.addToCache(this.textures[i], i);\n }\n frameIndex++;\n }\n };\n /**\n * Parse animations config\n *\n * @private\n */\n Spritesheet.prototype._processAnimations = function () {\n var animations = this.data.animations || {};\n for (var animName in animations) {\n this.animations[animName] = [];\n for (var i = 0; i < animations[animName].length; i++) {\n var frameName = animations[animName][i];\n this.animations[animName].push(this.textures[frameName]);\n }\n }\n };\n /**\n * The parse has completed.\n *\n * @private\n */\n Spritesheet.prototype._parseComplete = function () {\n var callback = this._callback;\n this._callback = null;\n this._batchIndex = 0;\n callback.call(this, this.textures);\n };\n /**\n * Begin the next batch of textures.\n *\n * @private\n */\n Spritesheet.prototype._nextBatch = function () {\n var _this = this;\n this._processFrames(this._batchIndex * Spritesheet.BATCH_SIZE);\n this._batchIndex++;\n setTimeout(function () {\n if (_this._batchIndex * Spritesheet.BATCH_SIZE < _this._frameKeys.length) {\n _this._nextBatch();\n }\n else {\n _this._processAnimations();\n _this._parseComplete();\n }\n }, 0);\n };\n /**\n * Destroy Spritesheet and don't use after this.\n *\n * @param {boolean} [destroyBase=false] - Whether to destroy the base texture as well\n */\n Spritesheet.prototype.destroy = function (destroyBase) {\n var _a;\n if (destroyBase === void 0) { destroyBase = false; }\n for (var i in this.textures) {\n this.textures[i].destroy();\n }\n this._frames = null;\n this._frameKeys = null;\n this.data = null;\n this.textures = null;\n if (destroyBase) {\n (_a = this._texture) === null || _a === void 0 ? void 0 : _a.destroy();\n this.baseTexture.destroy();\n }\n this._texture = null;\n this.baseTexture = null;\n };\n /**\n * The maximum number of Textures to build per process.\n *\n * @type {number}\n * @default 1000\n */\n Spritesheet.BATCH_SIZE = 1000;\n return Spritesheet;\n}());\n\n/**\n * {@link PIXI.Loader Loader} middleware for loading texture atlases that have been created with\n * TexturePacker or similar JSON-based spritesheet.\n *\n * This middleware automatically generates Texture resources.\n *\n * @class\n * @memberof PIXI\n * @implements PIXI.ILoaderPlugin\n */\nvar SpritesheetLoader = /** @class */ (function () {\n function SpritesheetLoader() {\n }\n /**\n * Called after a resource is loaded.\n * @see PIXI.Loader.loaderMiddleware\n * @param {PIXI.LoaderResource} resource\n * @param {function} next\n */\n SpritesheetLoader.use = function (resource, next) {\n // because this is middleware, it execute in loader context. `this` = loader\n var loader = this;\n var imageResourceName = resource.name + \"_image\";\n // skip if no data, its not json, it isn't spritesheet data, or the image resource already exists\n if (!resource.data\n || resource.type !== _pixi_loaders__WEBPACK_IMPORTED_MODULE_3__.LoaderResource.TYPE.JSON\n || !resource.data.frames\n || loader.resources[imageResourceName]) {\n next();\n return;\n }\n var loadOptions = {\n crossOrigin: resource.crossOrigin,\n metadata: resource.metadata.imageMetadata,\n parentResource: resource,\n };\n var resourcePath = SpritesheetLoader.getResourcePath(resource, loader.baseUrl);\n // load the image for this sheet\n loader.add(imageResourceName, resourcePath, loadOptions, function onImageLoad(res) {\n if (res.error) {\n next(res.error);\n return;\n }\n var spritesheet = new Spritesheet(res.texture, resource.data, resource.url);\n spritesheet.parse(function () {\n resource.spritesheet = spritesheet;\n resource.textures = spritesheet.textures;\n next();\n });\n });\n };\n /**\n * Get the spritesheets root path\n * @param {PIXI.LoaderResource} resource - Resource to check path\n * @param {string} baseUrl - Base root url\n */\n SpritesheetLoader.getResourcePath = function (resource, baseUrl) {\n // Prepend url path unless the resource image is a data url\n if (resource.isDataUrl) {\n return resource.data.meta.image;\n }\n return _pixi_utils__WEBPACK_IMPORTED_MODULE_2__.url.resolve(resource.url.replace(baseUrl, ''), resource.data.meta.image);\n };\n return SpritesheetLoader;\n}());\n\n\n//# sourceMappingURL=spritesheet.es.js.map\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/@pixi/spritesheet/lib/spritesheet.es.js?"); /***/ }), /***/ "./node_modules/@pixi/text-bitmap/lib/text-bitmap.es.js": /*!**************************************************************!*\ !*** ./node_modules/@pixi/text-bitmap/lib/text-bitmap.es.js ***! \**************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"BitmapFont\": () => (/* binding */ BitmapFont),\n/* harmony export */ \"BitmapFontData\": () => (/* binding */ BitmapFontData),\n/* harmony export */ \"BitmapFontLoader\": () => (/* binding */ BitmapFontLoader),\n/* harmony export */ \"BitmapText\": () => (/* binding */ BitmapText)\n/* harmony export */ });\n/* harmony import */ var _pixi_math__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @pixi/math */ \"./node_modules/@pixi/math/lib/math.es.js\");\n/* harmony import */ var _pixi_settings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @pixi/settings */ \"./node_modules/@pixi/settings/lib/settings.es.js\");\n/* harmony import */ var _pixi_mesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @pixi/mesh */ \"./node_modules/@pixi/mesh/lib/mesh.es.js\");\n/* harmony import */ var _pixi_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @pixi/utils */ \"./node_modules/@pixi/utils/lib/utils.es.js\");\n/* harmony import */ var _pixi_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @pixi/core */ \"./node_modules/@pixi/core/lib/core.es.js\");\n/* harmony import */ var _pixi_text__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @pixi/text */ \"./node_modules/@pixi/text/lib/text.es.js\");\n/* harmony import */ var _pixi_display__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @pixi/display */ \"./node_modules/@pixi/display/lib/display.es.js\");\n/* harmony import */ var _pixi_loaders__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @pixi/loaders */ \"./node_modules/@pixi/loaders/lib/loaders.es.js\");\n/*!\n * @pixi/text-bitmap - v5.3.11\n * Compiled Mon, 01 Nov 2021 16:10:12 UTC\n *\n * @pixi/text-bitmap is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n\n\n\n\n\n\n\n\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } };\r\n return extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\n\n/* eslint-disable max-len */\n/**\n * Normalized parsed data from .fnt files.\n *\n * @class\n * @memberof PIXI\n */\nvar BitmapFontData = /** @class */ (function () {\n function BitmapFontData() {\n /**\n * @member {PIXI.IBitmapFontDataInfo[]}\n * @readOnly\n */\n this.info = [];\n /**\n * @member {PIXI.IBitmapFontDataCommon[]}\n * @readOnly\n */\n this.common = [];\n /**\n * @member {PIXI.IBitmapFontDataPage[]}\n * @readOnly\n */\n this.page = [];\n /**\n * @member {PIXI.IBitmapFontDataChar[]}\n * @readOnly\n */\n this.char = [];\n /**\n * @member {PIXI.IBitmapFontDataKerning[]}\n * @readOnly\n */\n this.kerning = [];\n }\n return BitmapFontData;\n}());\n/**\n * @memberof PIXI\n * @typedef {object} IBitmapFontDataInfo\n * @property {string} face\n * @property {number} size\n */\n/**\n * @memberof PIXI\n * @typedef {object} IBitmapFontDataCommon\n * @property {number} lineHeight\n */\n/**\n * @memberof PIXI\n * @typedef {object} IBitmapFontDataPage\n * @property {number} id\n * @property {string} file\n */\n/**\n * @memberof PIXI\n * @typedef {object} IBitmapFontDataChar\n * @property {string} id\n * @property {number} page\n * @property {number} x\n * @property {number} y\n * @property {number} width\n * @property {number} height\n * @property {number} xoffset\n * @property {number} yoffset\n * @property {number} xadvance\n */\n/**\n * @memberof PIXI\n * @typedef {object} IBitmapFontDataKerning\n * @property {number} first\n * @property {number} second\n * @property {number} amount\n */\n\n/**\n * BitmapFont format that's Text-based.\n *\n * @class\n * @private\n */\nvar TextFormat = /** @class */ (function () {\n function TextFormat() {\n }\n /**\n * Check if resource refers to txt font data.\n *\n * @static\n * @private\n * @param {any} data\n * @return {boolean} True if resource could be treated as font data, false otherwise.\n */\n TextFormat.test = function (data) {\n return typeof data === 'string' && data.indexOf('info face=') === 0;\n };\n /**\n * Convert text font data to a javascript object.\n *\n * @static\n * @private\n * @param {string} txt - Raw string data to be converted\n * @return {PIXI.BitmapFontData} Parsed font data\n */\n TextFormat.parse = function (txt) {\n // Retrieve data item\n var items = txt.match(/^[a-z]+\\s+.+$/gm);\n var rawData = {\n info: [],\n common: [],\n page: [],\n char: [],\n chars: [],\n kerning: [],\n kernings: [],\n };\n for (var i in items) {\n // Extract item name\n var name = items[i].match(/^[a-z]+/gm)[0];\n // Extract item attribute list as string ex.: \"width=10\"\n var attributeList = items[i].match(/[a-zA-Z]+=([^\\s\"']+|\"([^\"]*)\")/gm);\n // Convert attribute list into an object\n var itemData = {};\n for (var i_1 in attributeList) {\n // Split key-value pairs\n var split = attributeList[i_1].split('=');\n var key = split[0];\n // Remove eventual quotes from value\n var strValue = split[1].replace(/\"/gm, '');\n // Try to convert value into float\n var floatValue = parseFloat(strValue);\n // Use string value case float value is NaN\n var value = isNaN(floatValue) ? strValue : floatValue;\n itemData[key] = value;\n }\n // Push current item to the resulting data\n rawData[name].push(itemData);\n }\n var font = new BitmapFontData();\n rawData.info.forEach(function (info) { return font.info.push({\n face: info.face,\n size: parseInt(info.size, 10),\n }); });\n rawData.common.forEach(function (common) { return font.common.push({\n lineHeight: parseInt(common.lineHeight, 10),\n }); });\n rawData.page.forEach(function (page) { return font.page.push({\n id: parseInt(page.id, 10),\n file: page.file,\n }); });\n rawData.char.forEach(function (char) { return font.char.push({\n id: parseInt(char.id, 10),\n page: parseInt(char.page, 10),\n x: parseInt(char.x, 10),\n y: parseInt(char.y, 10),\n width: parseInt(char.width, 10),\n height: parseInt(char.height, 10),\n xoffset: parseInt(char.xoffset, 10),\n yoffset: parseInt(char.yoffset, 10),\n xadvance: parseInt(char.xadvance, 10),\n }); });\n rawData.kerning.forEach(function (kerning) { return font.kerning.push({\n first: parseInt(kerning.first, 10),\n second: parseInt(kerning.second, 10),\n amount: parseInt(kerning.amount, 10),\n }); });\n return font;\n };\n return TextFormat;\n}());\n\n/**\n * BitmapFont format that's XML-based.\n *\n * @class\n * @private\n */\nvar XMLFormat = /** @class */ (function () {\n function XMLFormat() {\n }\n /**\n * Check if resource refers to xml font data.\n *\n * @static\n * @private\n * @param {any} data\n * @return {boolean} True if resource could be treated as font data, false otherwise.\n */\n XMLFormat.test = function (data) {\n return data instanceof XMLDocument\n && data.getElementsByTagName('page').length\n && data.getElementsByTagName('info')[0].getAttribute('face') !== null;\n };\n /**\n * Convert the XML into BitmapFontData that we can use.\n *\n * @static\n * @private\n * @param {XMLDocument} xml\n * @return {BitmapFontData} Data to use for BitmapFont\n */\n XMLFormat.parse = function (xml) {\n var data = new BitmapFontData();\n var info = xml.getElementsByTagName('info');\n var common = xml.getElementsByTagName('common');\n var page = xml.getElementsByTagName('page');\n var char = xml.getElementsByTagName('char');\n var kerning = xml.getElementsByTagName('kerning');\n for (var i = 0; i < info.length; i++) {\n data.info.push({\n face: info[i].getAttribute('face'),\n size: parseInt(info[i].getAttribute('size'), 10),\n });\n }\n for (var i = 0; i < common.length; i++) {\n data.common.push({\n lineHeight: parseInt(common[i].getAttribute('lineHeight'), 10),\n });\n }\n for (var i = 0; i < page.length; i++) {\n data.page.push({\n id: parseInt(page[i].getAttribute('id'), 10) || 0,\n file: page[i].getAttribute('file'),\n });\n }\n for (var i = 0; i < char.length; i++) {\n var letter = char[i];\n data.char.push({\n id: parseInt(letter.getAttribute('id'), 10),\n page: parseInt(letter.getAttribute('page'), 10) || 0,\n x: parseInt(letter.getAttribute('x'), 10),\n y: parseInt(letter.getAttribute('y'), 10),\n width: parseInt(letter.getAttribute('width'), 10),\n height: parseInt(letter.getAttribute('height'), 10),\n xoffset: parseInt(letter.getAttribute('xoffset'), 10),\n yoffset: parseInt(letter.getAttribute('yoffset'), 10),\n xadvance: parseInt(letter.getAttribute('xadvance'), 10),\n });\n }\n for (var i = 0; i < kerning.length; i++) {\n data.kerning.push({\n first: parseInt(kerning[i].getAttribute('first'), 10),\n second: parseInt(kerning[i].getAttribute('second'), 10),\n amount: parseInt(kerning[i].getAttribute('amount'), 10),\n });\n }\n return data;\n };\n return XMLFormat;\n}());\n\n/**\n * BitmapFont format that's XML-based.\n *\n * @class\n * @private\n */\nvar XMLStringFormat = /** @class */ (function () {\n function XMLStringFormat() {\n }\n /**\n * Check if resource refers to text xml font data.\n *\n * @static\n * @private\n * @param {any} data\n * @return {boolean} True if resource could be treated as font data, false otherwise.\n */\n XMLStringFormat.test = function (data) {\n if (typeof data === 'string' && data.indexOf('') > -1) {\n var xml = new self.DOMParser().parseFromString(data, 'text/xml');\n return XMLFormat.test(xml);\n }\n return false;\n };\n /**\n * Convert the text XML into BitmapFontData that we can use.\n *\n * @static\n * @private\n * @param {string} xmlTxt\n * @return {BitmapFontData} Data to use for BitmapFont\n */\n XMLStringFormat.parse = function (xmlTxt) {\n var xml = new window.DOMParser().parseFromString(xmlTxt, 'text/xml');\n return XMLFormat.parse(xml);\n };\n return XMLStringFormat;\n}());\n\n// Registered formats, maybe make this extensible in the future?\nvar formats = [\n TextFormat,\n XMLFormat,\n XMLStringFormat ];\n/**\n * Auto-detect BitmapFont parsing format based on data.\n * @private\n * @param {any} data - Data to detect format\n * @return {any} Format or null\n */\nfunction autoDetectFormat(data) {\n for (var i = 0; i < formats.length; i++) {\n if (formats[i].test(data)) {\n return formats[i];\n }\n }\n return null;\n}\n\n// TODO: Prevent code duplication b/w generateFillStyle & Text#generateFillStyle\n/**\n * Generates the fill style. Can automatically generate a gradient based on the fill style being an array\n *\n * @private\n * @param {object} style - The style.\n * @param {string[]} lines - The lines of text.\n * @return {string|number|CanvasGradient} The fill style\n */\nfunction generateFillStyle(canvas, context, style, resolution, lines, metrics) {\n // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as\n // the setter converts to string. See this thread for more details:\n // https://github.com/microsoft/TypeScript/issues/2521\n var fillStyle = style.fill;\n if (!Array.isArray(fillStyle)) {\n return fillStyle;\n }\n else if (fillStyle.length === 1) {\n return fillStyle[0];\n }\n // the gradient will be evenly spaced out according to how large the array is.\n // ['#FF0000', '#00FF00', '#0000FF'] would created stops at 0.25, 0.5 and 0.75\n var gradient;\n // a dropshadow will enlarge the canvas and result in the gradient being\n // generated with the incorrect dimensions\n var dropShadowCorrection = (style.dropShadow) ? style.dropShadowDistance : 0;\n // should also take padding into account, padding can offset the gradient\n var padding = style.padding || 0;\n var width = Math.ceil(canvas.width / resolution) - dropShadowCorrection - (padding * 2);\n var height = Math.ceil(canvas.height / resolution) - dropShadowCorrection - (padding * 2);\n // make a copy of the style settings, so we can manipulate them later\n var fill = fillStyle.slice();\n var fillGradientStops = style.fillGradientStops.slice();\n // wanting to evenly distribute the fills. So an array of 4 colours should give fills of 0.25, 0.5 and 0.75\n if (!fillGradientStops.length) {\n var lengthPlus1 = fill.length + 1;\n for (var i = 1; i < lengthPlus1; ++i) {\n fillGradientStops.push(i / lengthPlus1);\n }\n }\n // stop the bleeding of the last gradient on the line above to the top gradient of the this line\n // by hard defining the first gradient colour at point 0, and last gradient colour at point 1\n fill.unshift(fillStyle[0]);\n fillGradientStops.unshift(0);\n fill.push(fillStyle[fillStyle.length - 1]);\n fillGradientStops.push(1);\n if (style.fillGradientType === _pixi_text__WEBPACK_IMPORTED_MODULE_5__.TEXT_GRADIENT.LINEAR_VERTICAL) {\n // start the gradient at the top center of the canvas, and end at the bottom middle of the canvas\n gradient = context.createLinearGradient(width / 2, padding, width / 2, height + padding);\n // we need to repeat the gradient so that each individual line of text has the same vertical gradient effect\n // ['#FF0000', '#00FF00', '#0000FF'] over 2 lines would create stops at 0.125, 0.25, 0.375, 0.625, 0.75, 0.875\n // There's potential for floating point precision issues at the seams between gradient repeats.\n // The loop below generates the stops in order, so track the last generated one to prevent\n // floating point precision from making us go the teeniest bit backwards, resulting in\n // the first and last colors getting swapped.\n var lastIterationStop = 0;\n // Actual height of the text itself, not counting spacing for lineHeight/leading/dropShadow etc\n var textHeight = metrics.fontProperties.fontSize + style.strokeThickness;\n // textHeight, but as a 0-1 size in global gradient stop space\n var gradStopLineHeight = textHeight / height;\n for (var i = 0; i < lines.length; i++) {\n var thisLineTop = metrics.lineHeight * i;\n for (var j = 0; j < fill.length; j++) {\n // 0-1 stop point for the current line, multiplied to global space afterwards\n var lineStop = 0;\n if (typeof fillGradientStops[j] === 'number') {\n lineStop = fillGradientStops[j];\n }\n else {\n lineStop = j / fill.length;\n }\n var globalStop = (thisLineTop / height) + (lineStop * gradStopLineHeight);\n // Prevent color stop generation going backwards from floating point imprecision\n var clampedStop = Math.max(lastIterationStop, globalStop);\n clampedStop = Math.min(clampedStop, 1); // Cap at 1 as well for safety's sake to avoid a possible throw.\n gradient.addColorStop(clampedStop, fill[j]);\n lastIterationStop = clampedStop;\n }\n }\n }\n else {\n // start the gradient at the center left of the canvas, and end at the center right of the canvas\n gradient = context.createLinearGradient(padding, height / 2, width + padding, height / 2);\n // can just evenly space out the gradients in this case, as multiple lines makes no difference\n // to an even left to right gradient\n var totalIterations = fill.length + 1;\n var currentIteration = 1;\n for (var i = 0; i < fill.length; i++) {\n var stop = void 0;\n if (typeof fillGradientStops[i] === 'number') {\n stop = fillGradientStops[i];\n }\n else {\n stop = currentIteration / totalIterations;\n }\n gradient.addColorStop(stop, fill[i]);\n currentIteration++;\n }\n }\n return gradient;\n}\n\n// TODO: Prevent code duplication b/w drawGlyph & Text#updateText\n/**\n * Draws the glyph `metrics.text` on the given canvas.\n *\n * Ignored because not directly exposed.\n *\n * @ignore\n * @param {HTMLCanvasElement} canvas\n * @param {CanvasRenderingContext2D} context\n * @param {TextMetrics} metrics\n * @param {number} x\n * @param {number} y\n * @param {number} resolution\n * @param {TextStyle} style\n */\nfunction drawGlyph(canvas, context, metrics, x, y, resolution, style) {\n var char = metrics.text;\n var fontProperties = metrics.fontProperties;\n context.translate(x, y);\n context.scale(resolution, resolution);\n var tx = style.strokeThickness / 2;\n var ty = -(style.strokeThickness / 2);\n context.font = style.toFontString();\n context.lineWidth = style.strokeThickness;\n context.textBaseline = style.textBaseline;\n context.lineJoin = style.lineJoin;\n context.miterLimit = style.miterLimit;\n // set canvas text styles\n context.fillStyle = generateFillStyle(canvas, context, style, resolution, [char], metrics);\n context.strokeStyle = style.stroke;\n context.font = style.toFontString();\n context.lineWidth = style.strokeThickness;\n context.textBaseline = style.textBaseline;\n context.lineJoin = style.lineJoin;\n context.miterLimit = style.miterLimit;\n // set canvas text styles\n context.fillStyle = generateFillStyle(canvas, context, style, resolution, [char], metrics);\n context.strokeStyle = style.stroke;\n var dropShadowColor = style.dropShadowColor;\n var rgb = (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_3__.hex2rgb)(typeof dropShadowColor === 'number' ? dropShadowColor : (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_3__.string2hex)(dropShadowColor));\n if (style.dropShadow) {\n context.shadowColor = \"rgba(\" + rgb[0] * 255 + \",\" + rgb[1] * 255 + \",\" + rgb[2] * 255 + \",\" + style.dropShadowAlpha + \")\";\n context.shadowBlur = style.dropShadowBlur;\n context.shadowOffsetX = Math.cos(style.dropShadowAngle) * style.dropShadowDistance;\n context.shadowOffsetY = Math.sin(style.dropShadowAngle) * style.dropShadowDistance;\n }\n else {\n context.shadowColor = 'black';\n context.shadowBlur = 0;\n context.shadowOffsetX = 0;\n context.shadowOffsetY = 0;\n }\n if (style.stroke && style.strokeThickness) {\n context.strokeText(char, tx, ty + metrics.lineHeight - fontProperties.descent);\n }\n if (style.fill) {\n context.fillText(char, tx, ty + metrics.lineHeight - fontProperties.descent);\n }\n context.setTransform(1, 0, 0, 1, 0, 0); // defaults needed for older browsers (e.g. Opera 29)\n context.fillStyle = 'rgba(0, 0, 0, 0)';\n}\n\n/**\n * Processes the passed character set data and returns a flattened array of all the characters.\n *\n * Ignored because not directly exposed.\n *\n * @ignore\n * @param {string | string[] | string[][] } chars\n * @returns {string[]}\n */\nfunction resolveCharacters(chars) {\n // Split the chars string into individual characters\n if (typeof chars === 'string') {\n chars = [chars];\n }\n // Handle an array of characters+ranges\n var result = [];\n for (var i = 0, j = chars.length; i < j; i++) {\n var item = chars[i];\n // Handle range delimited by start/end chars\n if (Array.isArray(item)) {\n if (item.length !== 2) {\n throw new Error(\"[BitmapFont]: Invalid character range length, expecting 2 got \" + item.length + \".\");\n }\n var startCode = item[0].charCodeAt(0);\n var endCode = item[1].charCodeAt(0);\n if (endCode < startCode) {\n throw new Error('[BitmapFont]: Invalid character range.');\n }\n for (var i_1 = startCode, j_1 = endCode; i_1 <= j_1; i_1++) {\n result.push(String.fromCharCode(i_1));\n }\n }\n // Handle a character set string\n else {\n result.push.apply(result, item.split(''));\n }\n }\n if (result.length === 0) {\n throw new Error('[BitmapFont]: Empty set when resolving characters.');\n }\n return result;\n}\n\n/**\n * BitmapFont represents a typeface available for use with the BitmapText class. Use the `install`\n * method for adding a font to be used.\n *\n * @class\n * @memberof PIXI\n */\nvar BitmapFont = /** @class */ (function () {\n /**\n * @param {PIXI.BitmapFontData} data\n * @param {PIXI.Texture[]|Object.} textures\n * @param {boolean} [ownsTextures] - Setting to `true` will destroy page textures\n * when the font is uninstalled.\n */\n function BitmapFont(data, textures, ownsTextures) {\n var info = data.info[0];\n var common = data.common[0];\n var page = data.page[0];\n var res = (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_3__.getResolutionOfUrl)(page.file);\n var pageTextures = {};\n this._ownsTextures = ownsTextures;\n /**\n * The name of the font face.\n *\n * @member {string}\n * @readonly\n */\n this.font = info.face;\n /**\n * The size of the font face in pixels.\n *\n * @member {number}\n * @readonly\n */\n this.size = info.size;\n /**\n * The line-height of the font face in pixels.\n *\n * @member {number}\n * @readonly\n */\n this.lineHeight = common.lineHeight / res;\n /**\n * The map of characters by character code.\n *\n * @member {object}\n * @readonly\n */\n this.chars = {};\n /**\n * The map of base page textures (i.e., sheets of glyphs).\n *\n * @member {object}\n * @readonly\n * @private\n */\n this.pageTextures = pageTextures;\n // Convert the input Texture, Textures or object\n // into a page Texture lookup by \"id\"\n for (var i = 0; i < data.page.length; i++) {\n var _a = data.page[i], id = _a.id, file = _a.file;\n pageTextures[id] = textures instanceof Array\n ? textures[i] : textures[file];\n }\n // parse letters\n for (var i = 0; i < data.char.length; i++) {\n var _b = data.char[i], id = _b.id, page_1 = _b.page;\n var _c = data.char[i], x = _c.x, y = _c.y, width = _c.width, height = _c.height, xoffset = _c.xoffset, yoffset = _c.yoffset, xadvance = _c.xadvance;\n x /= res;\n y /= res;\n width /= res;\n height /= res;\n xoffset /= res;\n yoffset /= res;\n xadvance /= res;\n var rect = new _pixi_math__WEBPACK_IMPORTED_MODULE_0__.Rectangle(x + (pageTextures[page_1].frame.x / res), y + (pageTextures[page_1].frame.y / res), width, height);\n this.chars[id] = {\n xOffset: xoffset,\n yOffset: yoffset,\n xAdvance: xadvance,\n kerning: {},\n texture: new _pixi_core__WEBPACK_IMPORTED_MODULE_4__.Texture(pageTextures[page_1].baseTexture, rect),\n page: page_1,\n };\n }\n // parse kernings\n for (var i = 0; i < data.kerning.length; i++) {\n var _d = data.kerning[i], first = _d.first, second = _d.second, amount = _d.amount;\n first /= res;\n second /= res;\n amount /= res;\n if (this.chars[second]) {\n this.chars[second].kerning[first] = amount;\n }\n }\n }\n /**\n * Remove references to created glyph textures.\n */\n BitmapFont.prototype.destroy = function () {\n for (var id in this.chars) {\n this.chars[id].texture.destroy();\n this.chars[id].texture = null;\n }\n for (var id in this.pageTextures) {\n if (this._ownsTextures) {\n this.pageTextures[id].destroy(true);\n }\n this.pageTextures[id] = null;\n }\n // Set readonly null.\n this.chars = null;\n this.pageTextures = null;\n };\n /**\n * Register a new bitmap font.\n *\n * @static\n * @param {XMLDocument|string|PIXI.BitmapFontData} data - The\n * characters map that could be provided as xml or raw string.\n * @param {Object.|PIXI.Texture|PIXI.Texture[]}\n * textures - List of textures for each page.\n * @param {boolean} managedTexture - Set to `true` to destroy page textures\n * when the font is uninstalled. By default fonts created with\n * `BitmapFont.from` or from the `BitmapFontLoader` are `true`.\n * @return {PIXI.BitmapFont} Result font object with font, size, lineHeight\n * and char fields.\n */\n BitmapFont.install = function (data, textures, ownsTextures) {\n var fontData;\n if (data instanceof BitmapFontData) {\n fontData = data;\n }\n else {\n var format = autoDetectFormat(data);\n if (!format) {\n throw new Error('Unrecognized data format for font.');\n }\n fontData = format.parse(data);\n }\n // Single texture, convert to list\n if (textures instanceof _pixi_core__WEBPACK_IMPORTED_MODULE_4__.Texture) {\n textures = [textures];\n }\n var font = new BitmapFont(fontData, textures, ownsTextures);\n BitmapFont.available[font.font] = font;\n return font;\n };\n /**\n * Remove bitmap font by name.\n *\n * @static\n * @param {string} name - Name of the font to uninstall.\n */\n BitmapFont.uninstall = function (name) {\n var font = BitmapFont.available[name];\n if (!font) {\n throw new Error(\"No font found named '\" + name + \"'\");\n }\n font.destroy();\n delete BitmapFont.available[name];\n };\n /**\n * Generates a bitmap-font for the given style and character set. This does not support\n * kernings yet. With `style` properties, only the following non-layout properties are used:\n *\n * - {@link PIXI.TextStyle#dropShadow|dropShadow}\n * - {@link PIXI.TextStyle#dropShadowDistance|dropShadowDistance}\n * - {@link PIXI.TextStyle#dropShadowColor|dropShadowColor}\n * - {@link PIXI.TextStyle#dropShadowBlur|dropShadowBlur}\n * - {@link PIXI.TextStyle#dropShadowAngle|dropShadowAngle}\n * - {@link PIXI.TextStyle#fill|fill}\n * - {@link PIXI.TextStyle#fillGradientStops|fillGradientStops}\n * - {@link PIXI.TextStyle#fillGradientType|fillGradientType}\n * - {@link PIXI.TextStyle#fontFamily|fontFamily}\n * - {@link PIXI.TextStyle#fontSize|fontSize}\n * - {@link PIXI.TextStyle#fontVariant|fontVariant}\n * - {@link PIXI.TextStyle#fontWeight|fontWeight}\n * - {@link PIXI.TextStyle#lineJoin|lineJoin}\n * - {@link PIXI.TextStyle#miterLimit|miterLimit}\n * - {@link PIXI.TextStyle#stroke|stroke}\n * - {@link PIXI.TextStyle#strokeThickness|strokeThickness}\n * - {@link PIXI.TextStyle#textBaseline|textBaseline}\n *\n * @param {string} name - The name of the custom font to use with BitmapText.\n * @param {object|PIXI.TextStyle} [style] - Style options to render with BitmapFont.\n * @param {PIXI.IBitmapFontOptions} [options] - Setup options for font or name of the font.\n * @param {string|string[]|string[][]} [options.chars=PIXI.BitmapFont.ALPHANUMERIC] - characters included\n * in the font set. You can also use ranges. For example, `[['a', 'z'], ['A', 'Z'], \"!@#$%^&*()~{}[] \"]`.\n * Don't forget to include spaces ' ' in your character set!\n * @param {number} [options.resolution=1] - Render resolution for glyphs.\n * @param {number} [options.textureWidth=512] - Optional width of atlas, smaller values to reduce memory.\n * @param {number} [options.textureHeight=512] - Optional height of atlas, smaller values to reduce memory.\n * @param {number} [options.padding=4] - Padding between glyphs on texture atlas.\n * @return {PIXI.BitmapFont} Font generated by style options.\n * @static\n * @example\n * PIXI.BitmapFont.from(\"TitleFont\", {\n * fontFamily: \"Arial\",\n * fontSize: 12,\n * strokeThickness: 2,\n * fill: \"purple\"\n * });\n *\n * const title = new PIXI.BitmapText(\"This is the title\", { fontName: \"TitleFont\" });\n */\n BitmapFont.from = function (name, textStyle, options) {\n if (!name) {\n throw new Error('[BitmapFont] Property `name` is required.');\n }\n var _a = Object.assign({}, BitmapFont.defaultOptions, options), chars = _a.chars, padding = _a.padding, resolution = _a.resolution, textureWidth = _a.textureWidth, textureHeight = _a.textureHeight;\n var charsList = resolveCharacters(chars);\n var style = textStyle instanceof _pixi_text__WEBPACK_IMPORTED_MODULE_5__.TextStyle ? textStyle : new _pixi_text__WEBPACK_IMPORTED_MODULE_5__.TextStyle(textStyle);\n var lineWidth = textureWidth;\n var fontData = new BitmapFontData();\n fontData.info[0] = {\n face: style.fontFamily,\n size: style.fontSize,\n };\n fontData.common[0] = {\n lineHeight: style.fontSize,\n };\n var positionX = 0;\n var positionY = 0;\n var canvas;\n var context;\n var baseTexture;\n var maxCharHeight = 0;\n var textures = [];\n for (var i = 0; i < charsList.length; i++) {\n if (!canvas) {\n canvas = document.createElement('canvas');\n canvas.width = textureWidth;\n canvas.height = textureHeight;\n context = canvas.getContext('2d');\n baseTexture = new _pixi_core__WEBPACK_IMPORTED_MODULE_4__.BaseTexture(canvas, { resolution: resolution });\n textures.push(new _pixi_core__WEBPACK_IMPORTED_MODULE_4__.Texture(baseTexture));\n fontData.page.push({\n id: textures.length - 1,\n file: '',\n });\n }\n // Measure glyph dimensions\n var metrics = _pixi_text__WEBPACK_IMPORTED_MODULE_5__.TextMetrics.measureText(charsList[i], style, false, canvas);\n var width = metrics.width;\n var height = Math.ceil(metrics.height);\n // This is ugly - but italics are given more space so they don't overlap\n var textureGlyphWidth = Math.ceil((style.fontStyle === 'italic' ? 2 : 1) * width);\n // Can't fit char anymore: next canvas please!\n if (positionY >= textureHeight - (height * resolution)) {\n if (positionY === 0) {\n // We don't want user debugging an infinite loop (or do we? :)\n throw new Error(\"[BitmapFont] textureHeight \" + textureHeight + \"px is \"\n + (\"too small for \" + style.fontSize + \"px fonts\"));\n }\n --i;\n // Create new atlas once current has filled up\n canvas = null;\n context = null;\n baseTexture = null;\n positionY = 0;\n positionX = 0;\n maxCharHeight = 0;\n continue;\n }\n maxCharHeight = Math.max(height + metrics.fontProperties.descent, maxCharHeight);\n // Wrap line once full row has been rendered\n if ((textureGlyphWidth * resolution) + positionX >= lineWidth) {\n --i;\n positionY += maxCharHeight * resolution;\n positionY = Math.ceil(positionY);\n positionX = 0;\n maxCharHeight = 0;\n continue;\n }\n drawGlyph(canvas, context, metrics, positionX, positionY, resolution, style);\n // Unique (numeric) ID mapping to this glyph\n var id = metrics.text.charCodeAt(0);\n // Create a texture holding just the glyph\n fontData.char.push({\n id: id,\n page: textures.length - 1,\n x: positionX / resolution,\n y: positionY / resolution,\n width: textureGlyphWidth,\n height: height,\n xoffset: 0,\n yoffset: 0,\n xadvance: Math.ceil(width\n - (style.dropShadow ? style.dropShadowDistance : 0)\n - (style.stroke ? style.strokeThickness : 0)),\n });\n positionX += (textureGlyphWidth + (2 * padding)) * resolution;\n positionX = Math.ceil(positionX);\n }\n var font = new BitmapFont(fontData, textures, true);\n // Make it easier to replace a font\n if (BitmapFont.available[name] !== undefined) {\n BitmapFont.uninstall(name);\n }\n BitmapFont.available[name] = font;\n return font;\n };\n /**\n * This character set includes all the letters in the alphabet (both lower- and upper- case).\n * @readonly\n * @static\n * @member {string[][]}\n * @example\n * BitmapFont.from(\"ExampleFont\", style, { chars: BitmapFont.ALPHA })\n */\n BitmapFont.ALPHA = [['a', 'z'], ['A', 'Z'], ' '];\n /**\n * This character set includes all decimal digits (from 0 to 9).\n * @readonly\n * @static\n * @member {string[][]}\n * @example\n * BitmapFont.from(\"ExampleFont\", style, { chars: BitmapFont.NUMERIC })\n */\n BitmapFont.NUMERIC = [['0', '9']];\n /**\n * This character set is the union of `BitmapFont.ALPHA` and `BitmapFont.NUMERIC`.\n * @readonly\n * @static\n * @member {string[][]}\n */\n BitmapFont.ALPHANUMERIC = [['a', 'z'], ['A', 'Z'], ['0', '9'], ' '];\n /**\n * This character set consists of all the ASCII table.\n * @readonly\n * @static\n * @member {string[][]}\n * @see http://www.asciitable.com/\n */\n BitmapFont.ASCII = [[' ', '~']];\n /**\n * Collection of default options when using `BitmapFont.from`.\n *\n * @readonly\n * @static\n * @member {PIXI.IBitmapFontOptions}\n * @property {number} resolution=1\n * @property {number} textureWidth=512\n * @property {number} textureHeight=512\n * @property {number} padding=4\n * @property {string|string[]|string[][]} chars=PIXI.BitmapFont.ALPHANUMERIC\n */\n BitmapFont.defaultOptions = {\n resolution: 1,\n textureWidth: 512,\n textureHeight: 512,\n padding: 4,\n chars: BitmapFont.ALPHANUMERIC,\n };\n /**\n * Collection of available/installed fonts.\n *\n * @readonly\n * @static\n * @member {Object.}\n */\n BitmapFont.available = {};\n return BitmapFont;\n}());\n/**\n * @memberof PIXI\n * @interface IBitmapFontOptions\n * @property {string | string[] | string[][]} [chars=PIXI.BitmapFont.ALPHANUMERIC] - the character set to generate\n * @property {number} [resolution=1] - the resolution for rendering\n * @property {number} [padding=4] - the padding between glyphs in the atlas\n * @property {number} [textureWidth=512] - the width of the texture atlas\n * @property {number} [textureHeight=512] - the height of the texture atlas\n */\n\nvar pageMeshDataPool = [];\nvar charRenderDataPool = [];\n/**\n * A BitmapText object will create a line or multiple lines of text using bitmap font.\n *\n * The primary advantage of this class over Text is that all of your textures are pre-generated and loading,\n * meaning that rendering is fast, and changing text has no performance implications.\n *\n * Supporting character sets other than latin, such as CJK languages, may be impractical due to the number of characters.\n *\n * To split a line you can use '\\n', '\\r' or '\\r\\n' in your string.\n *\n * PixiJS can auto-generate fonts on-the-fly using BitmapFont or use fnt files provided by:\n * http://www.angelcode.com/products/bmfont/ for Windows or\n * http://www.bmglyph.com/ for Mac.\n *\n * A BitmapText can only be created when the font is loaded.\n *\n * ```js\n * // in this case the font is in a file called 'desyrel.fnt'\n * let bitmapText = new PIXI.BitmapText(\"text using a fancy font!\", {font: \"35px Desyrel\", align: \"right\"});\n * ```\n *\n * @class\n * @extends PIXI.Container\n * @memberof PIXI\n */\nvar BitmapText = /** @class */ (function (_super) {\n __extends(BitmapText, _super);\n /**\n * @param {string} text - A string that you would like the text to display.\n * @param {object} style - The style parameters.\n * @param {string} style.fontName - The installed BitmapFont name.\n * @param {number} [style.fontSize] - The size of the font in pixels, e.g. 24. If undefined,\n *. this will default to the BitmapFont size.\n * @param {string} [style.align='left'] - Alignment for multiline text ('left', 'center' or 'right'),\n * does not affect single line text.\n * @param {number} [style.tint=0xFFFFFF] - The tint color.\n * @param {number} [style.letterSpacing=0] - The amount of spacing between letters.\n * @param {number} [style.maxWidth=0] - The max width of the text before line wrapping.\n */\n function BitmapText(text, style) {\n if (style === void 0) { style = {}; }\n var _this = _super.call(this) || this;\n _this._tint = 0xFFFFFF;\n if (style.font) {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_3__.deprecation)('5.3.0', 'PIXI.BitmapText constructor style.font property is deprecated.');\n _this._upgradeStyle(style);\n }\n // Apply the defaults\n var _a = Object.assign({}, BitmapText.styleDefaults, style), align = _a.align, tint = _a.tint, maxWidth = _a.maxWidth, letterSpacing = _a.letterSpacing, fontName = _a.fontName, fontSize = _a.fontSize;\n if (!BitmapFont.available[fontName]) {\n throw new Error(\"Missing BitmapFont \\\"\" + fontName + \"\\\"\");\n }\n /**\n * Collection of page mesh data.\n *\n * @member {object}\n * @private\n */\n _this._activePagesMeshData = [];\n /**\n * Private tracker for the width of the overall text\n *\n * @member {number}\n * @private\n */\n _this._textWidth = 0;\n /**\n * Private tracker for the height of the overall text\n *\n * @member {number}\n * @private\n */\n _this._textHeight = 0;\n /**\n * Private tracker for the current text align.\n *\n * @member {string}\n * @private\n */\n _this._align = align;\n /**\n * Private tracker for the current tint.\n *\n * @member {number}\n * @private\n */\n _this._tint = tint;\n /**\n * Private tracker for the current font name.\n *\n * @member {string}\n * @private\n */\n _this._fontName = fontName;\n /**\n * Private tracker for the current font size.\n *\n * @member {number}\n * @private\n */\n _this._fontSize = fontSize || BitmapFont.available[fontName].size;\n /**\n * Private tracker for the current text.\n *\n * @member {string}\n * @private\n */\n _this._text = text;\n /**\n * The max width of this bitmap text in pixels. If the text provided is longer than the\n * value provided, line breaks will be automatically inserted in the last whitespace.\n * Disable by setting value to 0\n *\n * @member {number}\n * @private\n */\n _this._maxWidth = maxWidth;\n /**\n * The max line height. This is useful when trying to use the total height of the Text,\n * ie: when trying to vertically align. (Internally used)\n *\n * @member {number}\n * @private\n */\n _this._maxLineHeight = 0;\n /**\n * Letter spacing. This is useful for setting the space between characters.\n * @member {number}\n * @private\n */\n _this._letterSpacing = letterSpacing;\n /**\n * Text anchor. read-only\n *\n * @member {PIXI.ObservablePoint}\n * @private\n */\n _this._anchor = new _pixi_math__WEBPACK_IMPORTED_MODULE_0__.ObservablePoint(function () { _this.dirty = true; }, _this, 0, 0);\n /**\n * If true PixiJS will Math.floor() x/y values when rendering\n *\n * @member {boolean}\n * @default PIXI.settings.ROUND_PIXELS\n */\n _this._roundPixels = _pixi_settings__WEBPACK_IMPORTED_MODULE_1__.settings.ROUND_PIXELS;\n /**\n * Set to `true` if the BitmapText needs to be redrawn.\n *\n * @member {boolean}\n */\n _this.dirty = true;\n /**\n * Cached char texture is destroyed when BitmapText is destroyed\n * @member {Record}\n * @private\n */\n _this._textureCache = {};\n return _this;\n }\n /**\n * Renders text and updates it when needed. This should only be called\n * if the BitmapFont is regenerated.\n */\n BitmapText.prototype.updateText = function () {\n var _a;\n var data = BitmapFont.available[this._fontName];\n var scale = this._fontSize / data.size;\n var pos = new _pixi_math__WEBPACK_IMPORTED_MODULE_0__.Point();\n var chars = [];\n var lineWidths = [];\n var text = this._text.replace(/(?:\\r\\n|\\r)/g, '\\n') || ' ';\n var textLength = text.length;\n var maxWidth = this._maxWidth * data.size / this._fontSize;\n var prevCharCode = null;\n var lastLineWidth = 0;\n var maxLineWidth = 0;\n var line = 0;\n var lastBreakPos = -1;\n var lastBreakWidth = 0;\n var spacesRemoved = 0;\n var maxLineHeight = 0;\n for (var i = 0; i < textLength; i++) {\n var charCode = text.charCodeAt(i);\n var char = text.charAt(i);\n if ((/(?:\\s)/).test(char)) {\n lastBreakPos = i;\n lastBreakWidth = lastLineWidth;\n }\n if (char === '\\r' || char === '\\n') {\n lineWidths.push(lastLineWidth);\n maxLineWidth = Math.max(maxLineWidth, lastLineWidth);\n ++line;\n ++spacesRemoved;\n pos.x = 0;\n pos.y += data.lineHeight;\n prevCharCode = null;\n continue;\n }\n var charData = data.chars[charCode];\n if (!charData) {\n continue;\n }\n if (prevCharCode && charData.kerning[prevCharCode]) {\n pos.x += charData.kerning[prevCharCode];\n }\n var charRenderData = charRenderDataPool.pop() || {\n texture: _pixi_core__WEBPACK_IMPORTED_MODULE_4__.Texture.EMPTY,\n line: 0,\n charCode: 0,\n position: new _pixi_math__WEBPACK_IMPORTED_MODULE_0__.Point(),\n };\n charRenderData.texture = charData.texture;\n charRenderData.line = line;\n charRenderData.charCode = charCode;\n charRenderData.position.x = pos.x + charData.xOffset + (this._letterSpacing / 2);\n charRenderData.position.y = pos.y + charData.yOffset;\n chars.push(charRenderData);\n pos.x += charData.xAdvance + this._letterSpacing;\n lastLineWidth = pos.x;\n maxLineHeight = Math.max(maxLineHeight, (charData.yOffset + charData.texture.height));\n prevCharCode = charCode;\n if (lastBreakPos !== -1 && maxWidth > 0 && pos.x > maxWidth) {\n ++spacesRemoved;\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_3__.removeItems)(chars, 1 + lastBreakPos - spacesRemoved, 1 + i - lastBreakPos);\n i = lastBreakPos;\n lastBreakPos = -1;\n lineWidths.push(lastBreakWidth);\n maxLineWidth = Math.max(maxLineWidth, lastBreakWidth);\n line++;\n pos.x = 0;\n pos.y += data.lineHeight;\n prevCharCode = null;\n }\n }\n var lastChar = text.charAt(text.length - 1);\n if (lastChar !== '\\r' && lastChar !== '\\n') {\n if ((/(?:\\s)/).test(lastChar)) {\n lastLineWidth = lastBreakWidth;\n }\n lineWidths.push(lastLineWidth);\n maxLineWidth = Math.max(maxLineWidth, lastLineWidth);\n }\n var lineAlignOffsets = [];\n for (var i = 0; i <= line; i++) {\n var alignOffset = 0;\n if (this._align === 'right') {\n alignOffset = maxLineWidth - lineWidths[i];\n }\n else if (this._align === 'center') {\n alignOffset = (maxLineWidth - lineWidths[i]) / 2;\n }\n lineAlignOffsets.push(alignOffset);\n }\n var lenChars = chars.length;\n var pagesMeshData = {};\n var newPagesMeshData = [];\n var activePagesMeshData = this._activePagesMeshData;\n for (var i = 0; i < activePagesMeshData.length; i++) {\n pageMeshDataPool.push(activePagesMeshData[i]);\n }\n for (var i = 0; i < lenChars; i++) {\n var texture = chars[i].texture;\n var baseTextureUid = texture.baseTexture.uid;\n if (!pagesMeshData[baseTextureUid]) {\n var pageMeshData = pageMeshDataPool.pop();\n if (!pageMeshData) {\n var geometry = new _pixi_mesh__WEBPACK_IMPORTED_MODULE_2__.MeshGeometry();\n var material = new _pixi_mesh__WEBPACK_IMPORTED_MODULE_2__.MeshMaterial(_pixi_core__WEBPACK_IMPORTED_MODULE_4__.Texture.EMPTY);\n var mesh = new _pixi_mesh__WEBPACK_IMPORTED_MODULE_2__.Mesh(geometry, material);\n pageMeshData = {\n index: 0,\n indexCount: 0,\n vertexCount: 0,\n uvsCount: 0,\n total: 0,\n mesh: mesh,\n vertices: null,\n uvs: null,\n indices: null,\n };\n }\n // reset data..\n pageMeshData.index = 0;\n pageMeshData.indexCount = 0;\n pageMeshData.vertexCount = 0;\n pageMeshData.uvsCount = 0;\n pageMeshData.total = 0;\n // TODO need to get page texture here somehow..\n var _textureCache = this._textureCache;\n _textureCache[baseTextureUid] = _textureCache[baseTextureUid] || new _pixi_core__WEBPACK_IMPORTED_MODULE_4__.Texture(texture.baseTexture);\n pageMeshData.mesh.texture = _textureCache[baseTextureUid];\n pageMeshData.mesh.tint = this._tint;\n newPagesMeshData.push(pageMeshData);\n pagesMeshData[baseTextureUid] = pageMeshData;\n }\n pagesMeshData[baseTextureUid].total++;\n }\n // lets find any previously active pageMeshDatas that are no longer required for\n // the updated text (if any), removed and return them to the pool.\n for (var i = 0; i < activePagesMeshData.length; i++) {\n if (newPagesMeshData.indexOf(activePagesMeshData[i]) === -1) {\n this.removeChild(activePagesMeshData[i].mesh);\n }\n }\n // next lets add any new meshes, that have not yet been added to this BitmapText\n // we only add if its not already a child of this BitmapObject\n for (var i = 0; i < newPagesMeshData.length; i++) {\n if (newPagesMeshData[i].mesh.parent !== this) {\n this.addChild(newPagesMeshData[i].mesh);\n }\n }\n // active page mesh datas are set to be the new pages added.\n this._activePagesMeshData = newPagesMeshData;\n for (var i in pagesMeshData) {\n var pageMeshData = pagesMeshData[i];\n var total = pageMeshData.total;\n // lets only allocate new buffers if we can fit the new text in the current ones..\n // unless that is, we will be batching. Currently batching dose not respect the size property of mesh\n if (!(((_a = pageMeshData.indices) === null || _a === void 0 ? void 0 : _a.length) > 6 * total) || pageMeshData.vertices.length < _pixi_mesh__WEBPACK_IMPORTED_MODULE_2__.Mesh.BATCHABLE_SIZE * 2) {\n pageMeshData.vertices = new Float32Array(4 * 2 * total);\n pageMeshData.uvs = new Float32Array(4 * 2 * total);\n pageMeshData.indices = new Uint16Array(6 * total);\n }\n else {\n var total_1 = pageMeshData.total;\n var vertices = pageMeshData.vertices;\n // Clear the garbage at the end of the vertices buffer. This will prevent the bounds miscalculation.\n for (var i_1 = total_1 * 4 * 2; i_1 < vertices.length; i_1++) {\n vertices[i_1] = 0;\n }\n }\n // as a buffer maybe bigger than the current word, we set the size of the meshMaterial\n // to match the number of letters needed\n pageMeshData.mesh.size = 6 * total;\n }\n for (var i = 0; i < lenChars; i++) {\n var char = chars[i];\n var offset = char.position.x + lineAlignOffsets[char.line];\n if (this._roundPixels) {\n offset = Math.round(offset);\n }\n var xPos = offset * scale;\n var yPos = char.position.y * scale;\n var texture = char.texture;\n var pageMesh = pagesMeshData[texture.baseTexture.uid];\n var textureFrame = texture.frame;\n var textureUvs = texture._uvs;\n var index = pageMesh.index++;\n pageMesh.indices[(index * 6) + 0] = 0 + (index * 4);\n pageMesh.indices[(index * 6) + 1] = 1 + (index * 4);\n pageMesh.indices[(index * 6) + 2] = 2 + (index * 4);\n pageMesh.indices[(index * 6) + 3] = 0 + (index * 4);\n pageMesh.indices[(index * 6) + 4] = 2 + (index * 4);\n pageMesh.indices[(index * 6) + 5] = 3 + (index * 4);\n pageMesh.vertices[(index * 8) + 0] = xPos;\n pageMesh.vertices[(index * 8) + 1] = yPos;\n pageMesh.vertices[(index * 8) + 2] = xPos + (textureFrame.width * scale);\n pageMesh.vertices[(index * 8) + 3] = yPos;\n pageMesh.vertices[(index * 8) + 4] = xPos + (textureFrame.width * scale);\n pageMesh.vertices[(index * 8) + 5] = yPos + (textureFrame.height * scale);\n pageMesh.vertices[(index * 8) + 6] = xPos;\n pageMesh.vertices[(index * 8) + 7] = yPos + (textureFrame.height * scale);\n pageMesh.uvs[(index * 8) + 0] = textureUvs.x0;\n pageMesh.uvs[(index * 8) + 1] = textureUvs.y0;\n pageMesh.uvs[(index * 8) + 2] = textureUvs.x1;\n pageMesh.uvs[(index * 8) + 3] = textureUvs.y1;\n pageMesh.uvs[(index * 8) + 4] = textureUvs.x2;\n pageMesh.uvs[(index * 8) + 5] = textureUvs.y2;\n pageMesh.uvs[(index * 8) + 6] = textureUvs.x3;\n pageMesh.uvs[(index * 8) + 7] = textureUvs.y3;\n }\n this._textWidth = maxLineWidth * scale;\n this._textHeight = (pos.y + data.lineHeight) * scale;\n for (var i in pagesMeshData) {\n var pageMeshData = pagesMeshData[i];\n // apply anchor\n if (this.anchor.x !== 0 || this.anchor.y !== 0) {\n var vertexCount = 0;\n var anchorOffsetX = this._textWidth * this.anchor.x;\n var anchorOffsetY = this._textHeight * this.anchor.y;\n for (var i_2 = 0; i_2 < pageMeshData.total; i_2++) {\n pageMeshData.vertices[vertexCount++] -= anchorOffsetX;\n pageMeshData.vertices[vertexCount++] -= anchorOffsetY;\n pageMeshData.vertices[vertexCount++] -= anchorOffsetX;\n pageMeshData.vertices[vertexCount++] -= anchorOffsetY;\n pageMeshData.vertices[vertexCount++] -= anchorOffsetX;\n pageMeshData.vertices[vertexCount++] -= anchorOffsetY;\n pageMeshData.vertices[vertexCount++] -= anchorOffsetX;\n pageMeshData.vertices[vertexCount++] -= anchorOffsetY;\n }\n }\n this._maxLineHeight = maxLineHeight * scale;\n var vertexBuffer = pageMeshData.mesh.geometry.getBuffer('aVertexPosition');\n var textureBuffer = pageMeshData.mesh.geometry.getBuffer('aTextureCoord');\n var indexBuffer = pageMeshData.mesh.geometry.getIndex();\n vertexBuffer.data = pageMeshData.vertices;\n textureBuffer.data = pageMeshData.uvs;\n indexBuffer.data = pageMeshData.indices;\n vertexBuffer.update();\n textureBuffer.update();\n indexBuffer.update();\n }\n for (var i = 0; i < chars.length; i++) {\n charRenderDataPool.push(chars[i]);\n }\n };\n /**\n * Updates the transform of this object\n *\n * @private\n */\n BitmapText.prototype.updateTransform = function () {\n this.validate();\n this.containerUpdateTransform();\n };\n /**\n * Validates text before calling parent's getLocalBounds\n *\n * @return {PIXI.Rectangle} The rectangular bounding area\n */\n BitmapText.prototype.getLocalBounds = function () {\n this.validate();\n return _super.prototype.getLocalBounds.call(this);\n };\n /**\n * Updates text when needed\n *\n * @private\n */\n BitmapText.prototype.validate = function () {\n if (this.dirty) {\n this.updateText();\n this.dirty = false;\n }\n };\n Object.defineProperty(BitmapText.prototype, \"tint\", {\n /**\n * The tint of the BitmapText object.\n *\n * @member {number}\n * @default 0xffffff\n */\n get: function () {\n return this._tint;\n },\n set: function (value) {\n if (this._tint === value)\n { return; }\n this._tint = value;\n for (var i = 0; i < this._activePagesMeshData.length; i++) {\n this._activePagesMeshData[i].mesh.tint = value;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BitmapText.prototype, \"align\", {\n /**\n * The alignment of the BitmapText object.\n *\n * @member {string}\n * @default 'left'\n */\n get: function () {\n return this._align;\n },\n set: function (value) {\n if (this._align !== value) {\n this._align = value;\n this.dirty = true;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BitmapText.prototype, \"fontName\", {\n /**\n * The name of the BitmapFont.\n *\n * @member {string}\n */\n get: function () {\n return this._fontName;\n },\n set: function (value) {\n if (!BitmapFont.available[value]) {\n throw new Error(\"Missing BitmapFont \\\"\" + value + \"\\\"\");\n }\n if (this._fontName !== value) {\n this._fontName = value;\n this.dirty = true;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BitmapText.prototype, \"fontSize\", {\n /**\n * The size of the font to display.\n *\n * @member {number}\n */\n get: function () {\n return this._fontSize;\n },\n set: function (value) {\n if (this._fontSize !== value) {\n this._fontSize = value;\n this.dirty = true;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BitmapText.prototype, \"anchor\", {\n /**\n * The anchor sets the origin point of the text.\n *\n * The default is `(0,0)`, this means the text's origin is the top left.\n *\n * Setting the anchor to `(0.5,0.5)` means the text's origin is centered.\n *\n * Setting the anchor to `(1,1)` would mean the text's origin point will be the bottom right corner.\n *\n * @member {PIXI.Point | number}\n */\n get: function () {\n return this._anchor;\n },\n set: function (value) {\n if (typeof value === 'number') {\n this._anchor.set(value);\n }\n else {\n this._anchor.copyFrom(value);\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BitmapText.prototype, \"text\", {\n /**\n * The text of the BitmapText object.\n *\n * @member {string}\n */\n get: function () {\n return this._text;\n },\n set: function (text) {\n text = String(text === null || text === undefined ? '' : text);\n if (this._text === text) {\n return;\n }\n this._text = text;\n this.dirty = true;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BitmapText.prototype, \"maxWidth\", {\n /**\n * The max width of this bitmap text in pixels. If the text provided is longer than the\n * value provided, line breaks will be automatically inserted in the last whitespace.\n * Disable by setting the value to 0.\n *\n * @member {number}\n */\n get: function () {\n return this._maxWidth;\n },\n set: function (value) {\n if (this._maxWidth === value) {\n return;\n }\n this._maxWidth = value;\n this.dirty = true;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BitmapText.prototype, \"maxLineHeight\", {\n /**\n * The max line height. This is useful when trying to use the total height of the Text,\n * i.e. when trying to vertically align.\n *\n * @member {number}\n * @readonly\n */\n get: function () {\n this.validate();\n return this._maxLineHeight;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BitmapText.prototype, \"textWidth\", {\n /**\n * The width of the overall text, different from fontSize,\n * which is defined in the style object.\n *\n * @member {number}\n * @readonly\n */\n get: function () {\n this.validate();\n return this._textWidth;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BitmapText.prototype, \"letterSpacing\", {\n /**\n * Additional space between characters.\n *\n * @member {number}\n */\n get: function () {\n return this._letterSpacing;\n },\n set: function (value) {\n if (this._letterSpacing !== value) {\n this._letterSpacing = value;\n this.dirty = true;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BitmapText.prototype, \"roundPixels\", {\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n * To set the global default, change {@link PIXI.settings.ROUND_PIXELS}\n *\n * @member {boolean}\n * @default PIXI.settings.ROUND_PIXELS\n */\n get: function () {\n return this._roundPixels;\n },\n set: function (value) {\n if (value !== this._roundPixels) {\n this._roundPixels = value;\n this.dirty = true;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BitmapText.prototype, \"textHeight\", {\n /**\n * The height of the overall text, different from fontSize,\n * which is defined in the style object.\n *\n * @member {number}\n * @readonly\n */\n get: function () {\n this.validate();\n return this._textHeight;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * For backward compatibility, convert old style.font constructor param to fontName & fontSize properties.\n *\n * @private\n * @deprecated since 5.3.0\n */\n BitmapText.prototype._upgradeStyle = function (style) {\n if (typeof style.font === 'string') {\n var valueSplit = style.font.split(' ');\n style.fontName = valueSplit.length === 1\n ? valueSplit[0]\n : valueSplit.slice(1).join(' ');\n if (valueSplit.length >= 2) {\n style.fontSize = parseInt(valueSplit[0], 10);\n }\n }\n else {\n style.fontName = style.font.name;\n style.fontSize = typeof style.font.size === 'number'\n ? style.font.size\n : parseInt(style.font.size, 10);\n }\n };\n BitmapText.prototype.destroy = function (options) {\n var _textureCache = this._textureCache;\n for (var id in _textureCache) {\n var texture = _textureCache[id];\n texture.destroy();\n delete _textureCache[id];\n }\n this._textureCache = null;\n _super.prototype.destroy.call(this, options);\n };\n /**\n * Register a bitmap font with data and a texture.\n *\n * @deprecated since 5.3.0\n * @see PIXI.BitmapFont.install\n * @static\n */\n BitmapText.registerFont = function (data, textures) {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_3__.deprecation)('5.3.0', 'PIXI.BitmapText.registerFont is deprecated, use PIXI.BitmapFont.install');\n return BitmapFont.install(data, textures);\n };\n Object.defineProperty(BitmapText, \"fonts\", {\n /**\n * Get the list of installed fonts.\n *\n * @see PIXI.BitmapFont.available\n * @deprecated since 5.3.0\n * @static\n * @readonly\n * @member {Object.}\n */\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_3__.deprecation)('5.3.0', 'PIXI.BitmapText.fonts is deprecated, use PIXI.BitmapFont.available');\n return BitmapFont.available;\n },\n enumerable: false,\n configurable: true\n });\n BitmapText.styleDefaults = {\n align: 'left',\n tint: 0xFFFFFF,\n maxWidth: 0,\n letterSpacing: 0,\n };\n return BitmapText;\n}(_pixi_display__WEBPACK_IMPORTED_MODULE_6__.Container));\n\n/**\n * {@link PIXI.Loader Loader} middleware for loading\n * bitmap-based fonts suitable for using with {@link PIXI.BitmapText}.\n * @class\n * @memberof PIXI\n * @implements PIXI.ILoaderPlugin\n */\nvar BitmapFontLoader = /** @class */ (function () {\n function BitmapFontLoader() {\n }\n /**\n * Called when the plugin is installed.\n *\n * @see PIXI.Loader.registerPlugin\n */\n BitmapFontLoader.add = function () {\n _pixi_loaders__WEBPACK_IMPORTED_MODULE_7__.LoaderResource.setExtensionXhrType('fnt', _pixi_loaders__WEBPACK_IMPORTED_MODULE_7__.LoaderResource.XHR_RESPONSE_TYPE.TEXT);\n };\n /**\n * Called after a resource is loaded.\n * @see PIXI.Loader.loaderMiddleware\n * @param {PIXI.LoaderResource} resource\n * @param {function} next\n */\n BitmapFontLoader.use = function (resource, next) {\n var format = autoDetectFormat(resource.data);\n // Resource was not recognised as any of the expected font data format\n if (!format) {\n next();\n return;\n }\n var baseUrl = BitmapFontLoader.getBaseUrl(this, resource);\n var data = format.parse(resource.data);\n var textures = {};\n // Handle completed, when the number of textures\n // load is the same number as references in the fnt file\n var completed = function (page) {\n textures[page.metadata.pageFile] = page.texture;\n if (Object.keys(textures).length === data.page.length) {\n resource.bitmapFont = BitmapFont.install(data, textures, true);\n next();\n }\n };\n for (var i = 0; i < data.page.length; ++i) {\n var pageFile = data.page[i].file;\n var url = baseUrl + pageFile;\n var exists = false;\n // incase the image is loaded outside\n // using the same loader, resource will be available\n for (var name in this.resources) {\n var bitmapResource = this.resources[name];\n if (bitmapResource.url === url) {\n bitmapResource.metadata.pageFile = pageFile;\n if (bitmapResource.texture) {\n completed(bitmapResource);\n }\n else {\n bitmapResource.onAfterMiddleware.add(completed);\n }\n exists = true;\n break;\n }\n }\n // texture is not loaded, we'll attempt to add\n // it to the load and add the texture to the list\n if (!exists) {\n // Standard loading options for images\n var options = {\n crossOrigin: resource.crossOrigin,\n loadType: _pixi_loaders__WEBPACK_IMPORTED_MODULE_7__.LoaderResource.LOAD_TYPE.IMAGE,\n metadata: Object.assign({ pageFile: pageFile }, resource.metadata.imageMetadata),\n parentResource: resource,\n };\n this.add(url, options, completed);\n }\n }\n };\n /**\n * Get folder path from a resource\n * @private\n * @param {PIXI.Loader} loader\n * @param {PIXI.LoaderResource} resource\n * @return {string}\n */\n BitmapFontLoader.getBaseUrl = function (loader, resource) {\n var resUrl = !resource.isDataUrl ? BitmapFontLoader.dirname(resource.url) : '';\n if (resource.isDataUrl) {\n if (resUrl === '.') {\n resUrl = '';\n }\n if (loader.baseUrl && resUrl) {\n // if baseurl has a trailing slash then add one to resUrl so the replace works below\n if (loader.baseUrl.charAt(loader.baseUrl.length - 1) === '/') {\n resUrl += '/';\n }\n }\n }\n // remove baseUrl from resUrl\n resUrl = resUrl.replace(loader.baseUrl, '');\n // if there is an resUrl now, it needs a trailing slash. Ensure that it does if the string isn't empty.\n if (resUrl && resUrl.charAt(resUrl.length - 1) !== '/') {\n resUrl += '/';\n }\n return resUrl;\n };\n /**\n * Replacement for NodeJS's path.dirname\n * @private\n * @param {string} url - Path to get directory for\n */\n BitmapFontLoader.dirname = function (url) {\n var dir = url\n .replace(/\\\\/g, '/') // convert windows notation to UNIX notation, URL-safe because it's a forbidden character\n .replace(/\\/$/, '') // replace trailing slash\n .replace(/\\/[^\\/]*$/, ''); // remove everything after the last\n // File request is relative, use current directory\n if (dir === url) {\n return '.';\n }\n // Started with a slash\n else if (dir === '') {\n return '/';\n }\n return dir;\n };\n return BitmapFontLoader;\n}());\n\n\n//# sourceMappingURL=text-bitmap.es.js.map\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/@pixi/text-bitmap/lib/text-bitmap.es.js?"); /***/ }), /***/ "./node_modules/@pixi/text/lib/text.es.js": /*!************************************************!*\ !*** ./node_modules/@pixi/text/lib/text.es.js ***! \************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"TEXT_GRADIENT\": () => (/* binding */ TEXT_GRADIENT),\n/* harmony export */ \"Text\": () => (/* binding */ Text),\n/* harmony export */ \"TextMetrics\": () => (/* binding */ TextMetrics),\n/* harmony export */ \"TextStyle\": () => (/* binding */ TextStyle)\n/* harmony export */ });\n/* harmony import */ var _pixi_sprite__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @pixi/sprite */ \"./node_modules/@pixi/sprite/lib/sprite.es.js\");\n/* harmony import */ var _pixi_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @pixi/core */ \"./node_modules/@pixi/core/lib/core.es.js\");\n/* harmony import */ var _pixi_settings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @pixi/settings */ \"./node_modules/@pixi/settings/lib/settings.es.js\");\n/* harmony import */ var _pixi_math__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @pixi/math */ \"./node_modules/@pixi/math/lib/math.es.js\");\n/* harmony import */ var _pixi_utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @pixi/utils */ \"./node_modules/@pixi/utils/lib/utils.es.js\");\n/*!\n * @pixi/text - v5.3.11\n * Compiled Mon, 01 Nov 2021 16:10:12 UTC\n *\n * @pixi/text is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n\n\n\n\n\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } };\r\n return extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\n\n/**\n * Constants that define the type of gradient on text.\n *\n * @static\n * @constant\n * @name TEXT_GRADIENT\n * @memberof PIXI\n * @type {object}\n * @property {number} LINEAR_VERTICAL Vertical gradient\n * @property {number} LINEAR_HORIZONTAL Linear gradient\n */\nvar TEXT_GRADIENT;\n(function (TEXT_GRADIENT) {\n TEXT_GRADIENT[TEXT_GRADIENT[\"LINEAR_VERTICAL\"] = 0] = \"LINEAR_VERTICAL\";\n TEXT_GRADIENT[TEXT_GRADIENT[\"LINEAR_HORIZONTAL\"] = 1] = \"LINEAR_HORIZONTAL\";\n})(TEXT_GRADIENT || (TEXT_GRADIENT = {}));\n\n// disabling eslint for now, going to rewrite this in v5\nvar defaultStyle = {\n align: 'left',\n breakWords: false,\n dropShadow: false,\n dropShadowAlpha: 1,\n dropShadowAngle: Math.PI / 6,\n dropShadowBlur: 0,\n dropShadowColor: 'black',\n dropShadowDistance: 5,\n fill: 'black',\n fillGradientType: TEXT_GRADIENT.LINEAR_VERTICAL,\n fillGradientStops: [],\n fontFamily: 'Arial',\n fontSize: 26,\n fontStyle: 'normal',\n fontVariant: 'normal',\n fontWeight: 'normal',\n letterSpacing: 0,\n lineHeight: 0,\n lineJoin: 'miter',\n miterLimit: 10,\n padding: 0,\n stroke: 'black',\n strokeThickness: 0,\n textBaseline: 'alphabetic',\n trim: false,\n whiteSpace: 'pre',\n wordWrap: false,\n wordWrapWidth: 100,\n leading: 0,\n};\nvar genericFontFamilies = [\n 'serif',\n 'sans-serif',\n 'monospace',\n 'cursive',\n 'fantasy',\n 'system-ui' ];\n/**\n * A TextStyle Object contains information to decorate a Text objects.\n *\n * An instance can be shared between multiple Text objects; then changing the style will update all text objects using it.\n *\n * A tool can be used to generate a text style [here](https://pixijs.io/pixi-text-style).\n *\n * @class\n * @memberof PIXI\n */\nvar TextStyle = /** @class */ (function () {\n /**\n * @param {object} [style] - The style parameters\n * @param {string} [style.align='left'] - Alignment for multiline text ('left', 'center' or 'right'),\n * does not affect single line text\n * @param {boolean} [style.breakWords=false] - Indicates if lines can be wrapped within words, it\n * needs wordWrap to be set to true\n * @param {boolean} [style.dropShadow=false] - Set a drop shadow for the text\n * @param {number} [style.dropShadowAlpha=1] - Set alpha for the drop shadow\n * @param {number} [style.dropShadowAngle=Math.PI/6] - Set a angle of the drop shadow\n * @param {number} [style.dropShadowBlur=0] - Set a shadow blur radius\n * @param {string|number} [style.dropShadowColor='black'] - A fill style to be used on the dropshadow e.g 'red', '#00FF00'\n * @param {number} [style.dropShadowDistance=5] - Set a distance of the drop shadow\n * @param {string|string[]|number|number[]|CanvasGradient|CanvasPattern} [style.fill='black'] - A canvas\n * fillstyle that will be used on the text e.g 'red', '#00FF00'. Can be an array to create a gradient\n * eg ['#000000','#FFFFFF']\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle|MDN}\n * @param {number} [style.fillGradientType=PIXI.TEXT_GRADIENT.LINEAR_VERTICAL] - If fill is an array of colours\n * to create a gradient, this can change the type/direction of the gradient. See {@link PIXI.TEXT_GRADIENT}\n * @param {number[]} [style.fillGradientStops] - If fill is an array of colours to create a gradient, this array can set\n * the stop points (numbers between 0 and 1) for the color, overriding the default behaviour of evenly spacing them.\n * @param {string|string[]} [style.fontFamily='Arial'] - The font family\n * @param {number|string} [style.fontSize=26] - The font size (as a number it converts to px, but as a string,\n * equivalents are '26px','20pt','160%' or '1.6em')\n * @param {string} [style.fontStyle='normal'] - The font style ('normal', 'italic' or 'oblique')\n * @param {string} [style.fontVariant='normal'] - The font variant ('normal' or 'small-caps')\n * @param {string} [style.fontWeight='normal'] - The font weight ('normal', 'bold', 'bolder', 'lighter' and '100',\n * '200', '300', '400', '500', '600', '700', '800' or '900')\n * @param {number} [style.leading=0] - The space between lines\n * @param {number} [style.letterSpacing=0] - The amount of spacing between letters, default is 0\n * @param {number} [style.lineHeight] - The line height, a number that represents the vertical space that a letter uses\n * @param {string} [style.lineJoin='miter'] - The lineJoin property sets the type of corner created, it can resolve\n * spiked text issues. Possible values \"miter\" (creates a sharp corner), \"round\" (creates a round corner) or \"bevel\"\n * (creates a squared corner).\n * @param {number} [style.miterLimit=10] - The miter limit to use when using the 'miter' lineJoin mode. This can reduce\n * or increase the spikiness of rendered text.\n * @param {number} [style.padding=0] - Occasionally some fonts are cropped. Adding some padding will prevent this from\n * happening by adding padding to all sides of the text.\n * @param {string|number} [style.stroke='black'] - A canvas fillstyle that will be used on the text stroke\n * e.g 'blue', '#FCFF00'\n * @param {number} [style.strokeThickness=0] - A number that represents the thickness of the stroke.\n * Default is 0 (no stroke)\n * @param {boolean} [style.trim=false] - Trim transparent borders\n * @param {string} [style.textBaseline='alphabetic'] - The baseline of the text that is rendered.\n * @param {string} [style.whiteSpace='pre'] - Determines whether newlines & spaces are collapsed or preserved \"normal\"\n * (collapse, collapse), \"pre\" (preserve, preserve) | \"pre-line\" (preserve, collapse). It needs wordWrap to be set to true\n * @param {boolean} [style.wordWrap=false] - Indicates if word wrap should be used\n * @param {number} [style.wordWrapWidth=100] - The width at which text will wrap, it needs wordWrap to be set to true\n */\n function TextStyle(style) {\n this.styleID = 0;\n this.reset();\n deepCopyProperties(this, style, style);\n }\n /**\n * Creates a new TextStyle object with the same values as this one.\n * Note that the only the properties of the object are cloned.\n *\n * @return {PIXI.TextStyle} New cloned TextStyle object\n */\n TextStyle.prototype.clone = function () {\n var clonedProperties = {};\n deepCopyProperties(clonedProperties, this, defaultStyle);\n return new TextStyle(clonedProperties);\n };\n /**\n * Resets all properties to the defaults specified in TextStyle.prototype._default\n */\n TextStyle.prototype.reset = function () {\n deepCopyProperties(this, defaultStyle, defaultStyle);\n };\n Object.defineProperty(TextStyle.prototype, \"align\", {\n /**\n * Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text\n *\n * @member {string}\n */\n get: function () {\n return this._align;\n },\n set: function (align) {\n if (this._align !== align) {\n this._align = align;\n this.styleID++;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TextStyle.prototype, \"breakWords\", {\n /**\n * Indicates if lines can be wrapped within words, it needs wordWrap to be set to true\n *\n * @member {boolean}\n */\n get: function () {\n return this._breakWords;\n },\n set: function (breakWords) {\n if (this._breakWords !== breakWords) {\n this._breakWords = breakWords;\n this.styleID++;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TextStyle.prototype, \"dropShadow\", {\n /**\n * Set a drop shadow for the text\n *\n * @member {boolean}\n */\n get: function () {\n return this._dropShadow;\n },\n set: function (dropShadow) {\n if (this._dropShadow !== dropShadow) {\n this._dropShadow = dropShadow;\n this.styleID++;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TextStyle.prototype, \"dropShadowAlpha\", {\n /**\n * Set alpha for the drop shadow\n *\n * @member {number}\n */\n get: function () {\n return this._dropShadowAlpha;\n },\n set: function (dropShadowAlpha) {\n if (this._dropShadowAlpha !== dropShadowAlpha) {\n this._dropShadowAlpha = dropShadowAlpha;\n this.styleID++;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TextStyle.prototype, \"dropShadowAngle\", {\n /**\n * Set a angle of the drop shadow\n *\n * @member {number}\n */\n get: function () {\n return this._dropShadowAngle;\n },\n set: function (dropShadowAngle) {\n if (this._dropShadowAngle !== dropShadowAngle) {\n this._dropShadowAngle = dropShadowAngle;\n this.styleID++;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TextStyle.prototype, \"dropShadowBlur\", {\n /**\n * Set a shadow blur radius\n *\n * @member {number}\n */\n get: function () {\n return this._dropShadowBlur;\n },\n set: function (dropShadowBlur) {\n if (this._dropShadowBlur !== dropShadowBlur) {\n this._dropShadowBlur = dropShadowBlur;\n this.styleID++;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TextStyle.prototype, \"dropShadowColor\", {\n /**\n * A fill style to be used on the dropshadow e.g 'red', '#00FF00'\n *\n * @member {string|number}\n */\n get: function () {\n return this._dropShadowColor;\n },\n set: function (dropShadowColor) {\n var outputColor = getColor(dropShadowColor);\n if (this._dropShadowColor !== outputColor) {\n this._dropShadowColor = outputColor;\n this.styleID++;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TextStyle.prototype, \"dropShadowDistance\", {\n /**\n * Set a distance of the drop shadow\n *\n * @member {number}\n */\n get: function () {\n return this._dropShadowDistance;\n },\n set: function (dropShadowDistance) {\n if (this._dropShadowDistance !== dropShadowDistance) {\n this._dropShadowDistance = dropShadowDistance;\n this.styleID++;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TextStyle.prototype, \"fill\", {\n /**\n * A canvas fillstyle that will be used on the text e.g 'red', '#00FF00'.\n * Can be an array to create a gradient eg ['#000000','#FFFFFF']\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle|MDN}\n *\n * @member {string|string[]|number|number[]|CanvasGradient|CanvasPattern}\n */\n get: function () {\n return this._fill;\n },\n set: function (fill) {\n // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as\n // the setter converts to string. See this thread for more details:\n // https://github.com/microsoft/TypeScript/issues/2521\n // TODO: Not sure if getColor works properly with CanvasGradient and/or CanvasPattern, can't pass in\n // without casting here.\n var outputColor = getColor(fill);\n if (this._fill !== outputColor) {\n this._fill = outputColor;\n this.styleID++;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TextStyle.prototype, \"fillGradientType\", {\n /**\n * If fill is an array of colours to create a gradient, this can change the type/direction of the gradient.\n * See {@link PIXI.TEXT_GRADIENT}\n *\n * @member {number}\n */\n get: function () {\n return this._fillGradientType;\n },\n set: function (fillGradientType) {\n if (this._fillGradientType !== fillGradientType) {\n this._fillGradientType = fillGradientType;\n this.styleID++;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TextStyle.prototype, \"fillGradientStops\", {\n /**\n * If fill is an array of colours to create a gradient, this array can set the stop points\n * (numbers between 0 and 1) for the color, overriding the default behaviour of evenly spacing them.\n *\n * @member {number[]}\n */\n get: function () {\n return this._fillGradientStops;\n },\n set: function (fillGradientStops) {\n if (!areArraysEqual(this._fillGradientStops, fillGradientStops)) {\n this._fillGradientStops = fillGradientStops;\n this.styleID++;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TextStyle.prototype, \"fontFamily\", {\n /**\n * The font family\n *\n * @member {string|string[]}\n */\n get: function () {\n return this._fontFamily;\n },\n set: function (fontFamily) {\n if (this.fontFamily !== fontFamily) {\n this._fontFamily = fontFamily;\n this.styleID++;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TextStyle.prototype, \"fontSize\", {\n /**\n * The font size\n * (as a number it converts to px, but as a string, equivalents are '26px','20pt','160%' or '1.6em')\n *\n * @member {number|string}\n */\n get: function () {\n return this._fontSize;\n },\n set: function (fontSize) {\n if (this._fontSize !== fontSize) {\n this._fontSize = fontSize;\n this.styleID++;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TextStyle.prototype, \"fontStyle\", {\n /**\n * The font style\n * ('normal', 'italic' or 'oblique')\n *\n * @member {string}\n */\n get: function () {\n return this._fontStyle;\n },\n set: function (fontStyle) {\n if (this._fontStyle !== fontStyle) {\n this._fontStyle = fontStyle;\n this.styleID++;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TextStyle.prototype, \"fontVariant\", {\n /**\n * The font variant\n * ('normal' or 'small-caps')\n *\n * @member {string}\n */\n get: function () {\n return this._fontVariant;\n },\n set: function (fontVariant) {\n if (this._fontVariant !== fontVariant) {\n this._fontVariant = fontVariant;\n this.styleID++;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TextStyle.prototype, \"fontWeight\", {\n /**\n * The font weight\n * ('normal', 'bold', 'bolder', 'lighter' and '100', '200', '300', '400', '500', '600', '700', 800' or '900')\n *\n * @member {string}\n */\n get: function () {\n return this._fontWeight;\n },\n set: function (fontWeight) {\n if (this._fontWeight !== fontWeight) {\n this._fontWeight = fontWeight;\n this.styleID++;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TextStyle.prototype, \"letterSpacing\", {\n /**\n * The amount of spacing between letters, default is 0\n *\n * @member {number}\n */\n get: function () {\n return this._letterSpacing;\n },\n set: function (letterSpacing) {\n if (this._letterSpacing !== letterSpacing) {\n this._letterSpacing = letterSpacing;\n this.styleID++;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TextStyle.prototype, \"lineHeight\", {\n /**\n * The line height, a number that represents the vertical space that a letter uses\n *\n * @member {number}\n */\n get: function () {\n return this._lineHeight;\n },\n set: function (lineHeight) {\n if (this._lineHeight !== lineHeight) {\n this._lineHeight = lineHeight;\n this.styleID++;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TextStyle.prototype, \"leading\", {\n /**\n * The space between lines\n *\n * @member {number}\n */\n get: function () {\n return this._leading;\n },\n set: function (leading) {\n if (this._leading !== leading) {\n this._leading = leading;\n this.styleID++;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TextStyle.prototype, \"lineJoin\", {\n /**\n * The lineJoin property sets the type of corner created, it can resolve spiked text issues.\n * Default is 'miter' (creates a sharp corner).\n *\n * @member {string}\n */\n get: function () {\n return this._lineJoin;\n },\n set: function (lineJoin) {\n if (this._lineJoin !== lineJoin) {\n this._lineJoin = lineJoin;\n this.styleID++;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TextStyle.prototype, \"miterLimit\", {\n /**\n * The miter limit to use when using the 'miter' lineJoin mode\n * This can reduce or increase the spikiness of rendered text.\n *\n * @member {number}\n */\n get: function () {\n return this._miterLimit;\n },\n set: function (miterLimit) {\n if (this._miterLimit !== miterLimit) {\n this._miterLimit = miterLimit;\n this.styleID++;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TextStyle.prototype, \"padding\", {\n /**\n * Occasionally some fonts are cropped. Adding some padding will prevent this from happening\n * by adding padding to all sides of the text.\n *\n * @member {number}\n */\n get: function () {\n return this._padding;\n },\n set: function (padding) {\n if (this._padding !== padding) {\n this._padding = padding;\n this.styleID++;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TextStyle.prototype, \"stroke\", {\n /**\n * A canvas fillstyle that will be used on the text stroke\n * e.g 'blue', '#FCFF00'\n *\n * @member {string|number}\n */\n get: function () {\n return this._stroke;\n },\n set: function (stroke) {\n // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as\n // the setter converts to string. See this thread for more details:\n // https://github.com/microsoft/TypeScript/issues/2521\n var outputColor = getColor(stroke);\n if (this._stroke !== outputColor) {\n this._stroke = outputColor;\n this.styleID++;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TextStyle.prototype, \"strokeThickness\", {\n /**\n * A number that represents the thickness of the stroke.\n * Default is 0 (no stroke)\n *\n * @member {number}\n */\n get: function () {\n return this._strokeThickness;\n },\n set: function (strokeThickness) {\n if (this._strokeThickness !== strokeThickness) {\n this._strokeThickness = strokeThickness;\n this.styleID++;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TextStyle.prototype, \"textBaseline\", {\n /**\n * The baseline of the text that is rendered.\n *\n * @member {string}\n */\n get: function () {\n return this._textBaseline;\n },\n set: function (textBaseline) {\n if (this._textBaseline !== textBaseline) {\n this._textBaseline = textBaseline;\n this.styleID++;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TextStyle.prototype, \"trim\", {\n /**\n * Trim transparent borders\n *\n * @member {boolean}\n */\n get: function () {\n return this._trim;\n },\n set: function (trim) {\n if (this._trim !== trim) {\n this._trim = trim;\n this.styleID++;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TextStyle.prototype, \"whiteSpace\", {\n /**\n * How newlines and spaces should be handled.\n * Default is 'pre' (preserve, preserve).\n *\n * value | New lines | Spaces\n * --- | --- | ---\n * 'normal' | Collapse | Collapse\n * 'pre' | Preserve | Preserve\n * 'pre-line' | Preserve | Collapse\n *\n * @member {string}\n */\n get: function () {\n return this._whiteSpace;\n },\n set: function (whiteSpace) {\n if (this._whiteSpace !== whiteSpace) {\n this._whiteSpace = whiteSpace;\n this.styleID++;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TextStyle.prototype, \"wordWrap\", {\n /**\n * Indicates if word wrap should be used\n *\n * @member {boolean}\n */\n get: function () {\n return this._wordWrap;\n },\n set: function (wordWrap) {\n if (this._wordWrap !== wordWrap) {\n this._wordWrap = wordWrap;\n this.styleID++;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TextStyle.prototype, \"wordWrapWidth\", {\n /**\n * The width at which text will wrap, it needs wordWrap to be set to true\n *\n * @member {number}\n */\n get: function () {\n return this._wordWrapWidth;\n },\n set: function (wordWrapWidth) {\n if (this._wordWrapWidth !== wordWrapWidth) {\n this._wordWrapWidth = wordWrapWidth;\n this.styleID++;\n }\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Generates a font style string to use for `TextMetrics.measureFont()`.\n *\n * @return {string} Font style string, for passing to `TextMetrics.measureFont()`\n */\n TextStyle.prototype.toFontString = function () {\n // build canvas api font setting from individual components. Convert a numeric this.fontSize to px\n var fontSizeString = (typeof this.fontSize === 'number') ? this.fontSize + \"px\" : this.fontSize;\n // Clean-up fontFamily property by quoting each font name\n // this will support font names with spaces\n var fontFamilies = this.fontFamily;\n if (!Array.isArray(this.fontFamily)) {\n fontFamilies = this.fontFamily.split(',');\n }\n for (var i = fontFamilies.length - 1; i >= 0; i--) {\n // Trim any extra white-space\n var fontFamily = fontFamilies[i].trim();\n // Check if font already contains strings\n if (!(/([\\\"\\'])[^\\'\\\"]+\\1/).test(fontFamily) && genericFontFamilies.indexOf(fontFamily) < 0) {\n fontFamily = \"\\\"\" + fontFamily + \"\\\"\";\n }\n fontFamilies[i] = fontFamily;\n }\n return this.fontStyle + \" \" + this.fontVariant + \" \" + this.fontWeight + \" \" + fontSizeString + \" \" + fontFamilies.join(',');\n };\n return TextStyle;\n}());\n/**\n * Utility function to convert hexadecimal colors to strings, and simply return the color if it's a string.\n * @private\n * @param {string|number} color\n * @return {string} The color as a string.\n */\nfunction getSingleColor(color) {\n if (typeof color === 'number') {\n return (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_4__.hex2string)(color);\n }\n else if (typeof color === 'string') {\n if (color.indexOf('0x') === 0) {\n color = color.replace('0x', '#');\n }\n }\n return color;\n}\nfunction getColor(color) {\n if (!Array.isArray(color)) {\n return getSingleColor(color);\n }\n else {\n for (var i = 0; i < color.length; ++i) {\n color[i] = getSingleColor(color[i]);\n }\n return color;\n }\n}\n/**\n * Utility function to convert hexadecimal colors to strings, and simply return the color if it's a string.\n * This version can also convert array of colors\n * @private\n * @param {Array} array1 - First array to compare\n * @param {Array} array2 - Second array to compare\n * @return {boolean} Do the arrays contain the same values in the same order\n */\nfunction areArraysEqual(array1, array2) {\n if (!Array.isArray(array1) || !Array.isArray(array2)) {\n return false;\n }\n if (array1.length !== array2.length) {\n return false;\n }\n for (var i = 0; i < array1.length; ++i) {\n if (array1[i] !== array2[i]) {\n return false;\n }\n }\n return true;\n}\n/**\n * Utility function to ensure that object properties are copied by value, and not by reference\n * @private\n * @param {Object} target - Target object to copy properties into\n * @param {Object} source - Source object for the properties to copy\n * @param {string} propertyObj - Object containing properties names we want to loop over\n */\nfunction deepCopyProperties(target, source, propertyObj) {\n for (var prop in propertyObj) {\n if (Array.isArray(source[prop])) {\n target[prop] = source[prop].slice();\n }\n else {\n target[prop] = source[prop];\n }\n }\n}\n\n/**\n * The TextMetrics object represents the measurement of a block of text with a specified style.\n *\n * ```js\n * let style = new PIXI.TextStyle({fontFamily : 'Arial', fontSize: 24, fill : 0xff1010, align : 'center'})\n * let textMetrics = PIXI.TextMetrics.measureText('Your text', style)\n * ```\n *\n * @class\n * @memberof PIXI\n */\nvar TextMetrics = /** @class */ (function () {\n /**\n * @param {string} text - the text that was measured\n * @param {PIXI.TextStyle} style - the style that was measured\n * @param {number} width - the measured width of the text\n * @param {number} height - the measured height of the text\n * @param {string[]} lines - an array of the lines of text broken by new lines and wrapping if specified in style\n * @param {number[]} lineWidths - an array of the line widths for each line matched to `lines`\n * @param {number} lineHeight - the measured line height for this style\n * @param {number} maxLineWidth - the maximum line width for all measured lines\n * @param {Object} fontProperties - the font properties object from TextMetrics.measureFont\n */\n function TextMetrics(text, style, width, height, lines, lineWidths, lineHeight, maxLineWidth, fontProperties) {\n /**\n * The text that was measured\n *\n * @member {string}\n */\n this.text = text;\n /**\n * The style that was measured\n *\n * @member {PIXI.TextStyle}\n */\n this.style = style;\n /**\n * The measured width of the text\n *\n * @member {number}\n */\n this.width = width;\n /**\n * The measured height of the text\n *\n * @member {number}\n */\n this.height = height;\n /**\n * An array of lines of the text broken by new lines and wrapping is specified in style\n *\n * @member {string[]}\n */\n this.lines = lines;\n /**\n * An array of the line widths for each line matched to `lines`\n *\n * @member {number[]}\n */\n this.lineWidths = lineWidths;\n /**\n * The measured line height for this style\n *\n * @member {number}\n */\n this.lineHeight = lineHeight;\n /**\n * The maximum line width for all measured lines\n *\n * @member {number}\n */\n this.maxLineWidth = maxLineWidth;\n /**\n * The font properties object from TextMetrics.measureFont\n *\n * @member {PIXI.IFontMetrics}\n */\n this.fontProperties = fontProperties;\n }\n /**\n * Measures the supplied string of text and returns a Rectangle.\n *\n * @param {string} text - the text to measure.\n * @param {PIXI.TextStyle} style - the text style to use for measuring\n * @param {boolean} [wordWrap] - optional override for if word-wrap should be applied to the text.\n * @param {HTMLCanvasElement} [canvas] - optional specification of the canvas to use for measuring.\n * @return {PIXI.TextMetrics} measured width and height of the text.\n */\n TextMetrics.measureText = function (text, style, wordWrap, canvas) {\n if (canvas === void 0) { canvas = TextMetrics._canvas; }\n wordWrap = (wordWrap === undefined || wordWrap === null) ? style.wordWrap : wordWrap;\n var font = style.toFontString();\n var fontProperties = TextMetrics.measureFont(font);\n // fallback in case UA disallow canvas data extraction\n // (toDataURI, getImageData functions)\n if (fontProperties.fontSize === 0) {\n fontProperties.fontSize = style.fontSize;\n fontProperties.ascent = style.fontSize;\n }\n var context = canvas.getContext('2d');\n context.font = font;\n var outputText = wordWrap ? TextMetrics.wordWrap(text, style, canvas) : text;\n var lines = outputText.split(/(?:\\r\\n|\\r|\\n)/);\n var lineWidths = new Array(lines.length);\n var maxLineWidth = 0;\n for (var i = 0; i < lines.length; i++) {\n var lineWidth = context.measureText(lines[i]).width + ((lines[i].length - 1) * style.letterSpacing);\n lineWidths[i] = lineWidth;\n maxLineWidth = Math.max(maxLineWidth, lineWidth);\n }\n var width = maxLineWidth + style.strokeThickness;\n if (style.dropShadow) {\n width += style.dropShadowDistance;\n }\n var lineHeight = style.lineHeight || fontProperties.fontSize + style.strokeThickness;\n var height = Math.max(lineHeight, fontProperties.fontSize + style.strokeThickness)\n + ((lines.length - 1) * (lineHeight + style.leading));\n if (style.dropShadow) {\n height += style.dropShadowDistance;\n }\n return new TextMetrics(text, style, width, height, lines, lineWidths, lineHeight + style.leading, maxLineWidth, fontProperties);\n };\n /**\n * Applies newlines to a string to have it optimally fit into the horizontal\n * bounds set by the Text object's wordWrapWidth property.\n *\n * @private\n * @param {string} text - String to apply word wrapping to\n * @param {PIXI.TextStyle} style - the style to use when wrapping\n * @param {HTMLCanvasElement} [canvas] - optional specification of the canvas to use for measuring.\n * @return {string} New string with new lines applied where required\n */\n TextMetrics.wordWrap = function (text, style, canvas) {\n if (canvas === void 0) { canvas = TextMetrics._canvas; }\n var context = canvas.getContext('2d');\n var width = 0;\n var line = '';\n var lines = '';\n var cache = Object.create(null);\n var letterSpacing = style.letterSpacing, whiteSpace = style.whiteSpace;\n // How to handle whitespaces\n var collapseSpaces = TextMetrics.collapseSpaces(whiteSpace);\n var collapseNewlines = TextMetrics.collapseNewlines(whiteSpace);\n // whether or not spaces may be added to the beginning of lines\n var canPrependSpaces = !collapseSpaces;\n // There is letterSpacing after every char except the last one\n // t_h_i_s_' '_i_s_' '_a_n_' '_e_x_a_m_p_l_e_' '_!\n // so for convenience the above needs to be compared to width + 1 extra letterSpace\n // t_h_i_s_' '_i_s_' '_a_n_' '_e_x_a_m_p_l_e_' '_!_\n // ________________________________________________\n // And then the final space is simply no appended to each line\n var wordWrapWidth = style.wordWrapWidth + letterSpacing;\n // break text into words, spaces and newline chars\n var tokens = TextMetrics.tokenize(text);\n for (var i = 0; i < tokens.length; i++) {\n // get the word, space or newlineChar\n var token = tokens[i];\n // if word is a new line\n if (TextMetrics.isNewline(token)) {\n // keep the new line\n if (!collapseNewlines) {\n lines += TextMetrics.addLine(line);\n canPrependSpaces = !collapseSpaces;\n line = '';\n width = 0;\n continue;\n }\n // if we should collapse new lines\n // we simply convert it into a space\n token = ' ';\n }\n // if we should collapse repeated whitespaces\n if (collapseSpaces) {\n // check both this and the last tokens for spaces\n var currIsBreakingSpace = TextMetrics.isBreakingSpace(token);\n var lastIsBreakingSpace = TextMetrics.isBreakingSpace(line[line.length - 1]);\n if (currIsBreakingSpace && lastIsBreakingSpace) {\n continue;\n }\n }\n // get word width from cache if possible\n var tokenWidth = TextMetrics.getFromCache(token, letterSpacing, cache, context);\n // word is longer than desired bounds\n if (tokenWidth > wordWrapWidth) {\n // if we are not already at the beginning of a line\n if (line !== '') {\n // start newlines for overflow words\n lines += TextMetrics.addLine(line);\n line = '';\n width = 0;\n }\n // break large word over multiple lines\n if (TextMetrics.canBreakWords(token, style.breakWords)) {\n // break word into characters\n var characters = TextMetrics.wordWrapSplit(token);\n // loop the characters\n for (var j = 0; j < characters.length; j++) {\n var char = characters[j];\n var k = 1;\n // we are not at the end of the token\n while (characters[j + k]) {\n var nextChar = characters[j + k];\n var lastChar = char[char.length - 1];\n // should not split chars\n if (!TextMetrics.canBreakChars(lastChar, nextChar, token, j, style.breakWords)) {\n // combine chars & move forward one\n char += nextChar;\n }\n else {\n break;\n }\n k++;\n }\n j += char.length - 1;\n var characterWidth = TextMetrics.getFromCache(char, letterSpacing, cache, context);\n if (characterWidth + width > wordWrapWidth) {\n lines += TextMetrics.addLine(line);\n canPrependSpaces = false;\n line = '';\n width = 0;\n }\n line += char;\n width += characterWidth;\n }\n }\n // run word out of the bounds\n else {\n // if there are words in this line already\n // finish that line and start a new one\n if (line.length > 0) {\n lines += TextMetrics.addLine(line);\n line = '';\n width = 0;\n }\n var isLastToken = i === tokens.length - 1;\n // give it its own line if it's not the end\n lines += TextMetrics.addLine(token, !isLastToken);\n canPrependSpaces = false;\n line = '';\n width = 0;\n }\n }\n // word could fit\n else {\n // word won't fit because of existing words\n // start a new line\n if (tokenWidth + width > wordWrapWidth) {\n // if its a space we don't want it\n canPrependSpaces = false;\n // add a new line\n lines += TextMetrics.addLine(line);\n // start a new line\n line = '';\n width = 0;\n }\n // don't add spaces to the beginning of lines\n if (line.length > 0 || !TextMetrics.isBreakingSpace(token) || canPrependSpaces) {\n // add the word to the current line\n line += token;\n // update width counter\n width += tokenWidth;\n }\n }\n }\n lines += TextMetrics.addLine(line, false);\n return lines;\n };\n /**\n * Convienience function for logging each line added during the wordWrap\n * method\n *\n * @private\n * @param {string} line - The line of text to add\n * @param {boolean} newLine - Add new line character to end\n * @return {string} A formatted line\n */\n TextMetrics.addLine = function (line, newLine) {\n if (newLine === void 0) { newLine = true; }\n line = TextMetrics.trimRight(line);\n line = (newLine) ? line + \"\\n\" : line;\n return line;\n };\n /**\n * Gets & sets the widths of calculated characters in a cache object\n *\n * @private\n * @param {string} key - The key\n * @param {number} letterSpacing - The letter spacing\n * @param {object} cache - The cache\n * @param {CanvasRenderingContext2D} context - The canvas context\n * @return {number} The from cache.\n */\n TextMetrics.getFromCache = function (key, letterSpacing, cache, context) {\n var width = cache[key];\n if (typeof width !== 'number') {\n var spacing = ((key.length) * letterSpacing);\n width = context.measureText(key).width + spacing;\n cache[key] = width;\n }\n return width;\n };\n /**\n * Determines whether we should collapse breaking spaces\n *\n * @private\n * @param {string} whiteSpace - The TextStyle property whiteSpace\n * @return {boolean} should collapse\n */\n TextMetrics.collapseSpaces = function (whiteSpace) {\n return (whiteSpace === 'normal' || whiteSpace === 'pre-line');\n };\n /**\n * Determines whether we should collapse newLine chars\n *\n * @private\n * @param {string} whiteSpace - The white space\n * @return {boolean} should collapse\n */\n TextMetrics.collapseNewlines = function (whiteSpace) {\n return (whiteSpace === 'normal');\n };\n /**\n * trims breaking whitespaces from string\n *\n * @private\n * @param {string} text - The text\n * @return {string} trimmed string\n */\n TextMetrics.trimRight = function (text) {\n if (typeof text !== 'string') {\n return '';\n }\n for (var i = text.length - 1; i >= 0; i--) {\n var char = text[i];\n if (!TextMetrics.isBreakingSpace(char)) {\n break;\n }\n text = text.slice(0, -1);\n }\n return text;\n };\n /**\n * Determines if char is a newline.\n *\n * @private\n * @param {string} char - The character\n * @return {boolean} True if newline, False otherwise.\n */\n TextMetrics.isNewline = function (char) {\n if (typeof char !== 'string') {\n return false;\n }\n return (TextMetrics._newlines.indexOf(char.charCodeAt(0)) >= 0);\n };\n /**\n * Determines if char is a breaking whitespace.\n *\n * @private\n * @param {string} char - The character\n * @return {boolean} True if whitespace, False otherwise.\n */\n TextMetrics.isBreakingSpace = function (char) {\n if (typeof char !== 'string') {\n return false;\n }\n return (TextMetrics._breakingSpaces.indexOf(char.charCodeAt(0)) >= 0);\n };\n /**\n * Splits a string into words, breaking-spaces and newLine characters\n *\n * @private\n * @param {string} text - The text\n * @return {string[]} A tokenized array\n */\n TextMetrics.tokenize = function (text) {\n var tokens = [];\n var token = '';\n if (typeof text !== 'string') {\n return tokens;\n }\n for (var i = 0; i < text.length; i++) {\n var char = text[i];\n if (TextMetrics.isBreakingSpace(char) || TextMetrics.isNewline(char)) {\n if (token !== '') {\n tokens.push(token);\n token = '';\n }\n tokens.push(char);\n continue;\n }\n token += char;\n }\n if (token !== '') {\n tokens.push(token);\n }\n return tokens;\n };\n /**\n * Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior.\n *\n * It allows one to customise which words should break\n * Examples are if the token is CJK or numbers.\n * It must return a boolean.\n *\n * @param {string} token - The token\n * @param {boolean} breakWords - The style attr break words\n * @return {boolean} whether to break word or not\n */\n TextMetrics.canBreakWords = function (_token, breakWords) {\n return breakWords;\n };\n /**\n * Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior.\n *\n * It allows one to determine whether a pair of characters\n * should be broken by newlines\n * For example certain characters in CJK langs or numbers.\n * It must return a boolean.\n *\n * @param {string} char - The character\n * @param {string} nextChar - The next character\n * @param {string} token - The token/word the characters are from\n * @param {number} index - The index in the token of the char\n * @param {boolean} breakWords - The style attr break words\n * @return {boolean} whether to break word or not\n */\n TextMetrics.canBreakChars = function (_char, _nextChar, _token, _index, _breakWords) {\n return true;\n };\n /**\n * Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior.\n *\n * It is called when a token (usually a word) has to be split into separate pieces\n * in order to determine the point to break a word.\n * It must return an array of characters.\n *\n * @example\n * // Correctly splits emojis, eg \"🤪🤪\" will result in two element array, each with one emoji.\n * TextMetrics.wordWrapSplit = (token) => [...token];\n *\n * @param {string} token - The token to split\n * @return {string[]} The characters of the token\n */\n TextMetrics.wordWrapSplit = function (token) {\n return token.split('');\n };\n /**\n * Calculates the ascent, descent and fontSize of a given font-style\n *\n * @static\n * @param {string} font - String representing the style of the font\n * @return {PIXI.IFontMetrics} Font properties object\n */\n TextMetrics.measureFont = function (font) {\n // as this method is used for preparing assets, don't recalculate things if we don't need to\n if (TextMetrics._fonts[font]) {\n return TextMetrics._fonts[font];\n }\n var properties = {\n ascent: 0,\n descent: 0,\n fontSize: 0,\n };\n var canvas = TextMetrics._canvas;\n var context = TextMetrics._context;\n context.font = font;\n var metricsString = TextMetrics.METRICS_STRING + TextMetrics.BASELINE_SYMBOL;\n var width = Math.ceil(context.measureText(metricsString).width);\n var baseline = Math.ceil(context.measureText(TextMetrics.BASELINE_SYMBOL).width);\n var height = 2 * baseline;\n baseline = baseline * TextMetrics.BASELINE_MULTIPLIER | 0;\n canvas.width = width;\n canvas.height = height;\n context.fillStyle = '#f00';\n context.fillRect(0, 0, width, height);\n context.font = font;\n context.textBaseline = 'alphabetic';\n context.fillStyle = '#000';\n context.fillText(metricsString, 0, baseline);\n var imagedata = context.getImageData(0, 0, width, height).data;\n var pixels = imagedata.length;\n var line = width * 4;\n var i = 0;\n var idx = 0;\n var stop = false;\n // ascent. scan from top to bottom until we find a non red pixel\n for (i = 0; i < baseline; ++i) {\n for (var j = 0; j < line; j += 4) {\n if (imagedata[idx + j] !== 255) {\n stop = true;\n break;\n }\n }\n if (!stop) {\n idx += line;\n }\n else {\n break;\n }\n }\n properties.ascent = baseline - i;\n idx = pixels - line;\n stop = false;\n // descent. scan from bottom to top until we find a non red pixel\n for (i = height; i > baseline; --i) {\n for (var j = 0; j < line; j += 4) {\n if (imagedata[idx + j] !== 255) {\n stop = true;\n break;\n }\n }\n if (!stop) {\n idx -= line;\n }\n else {\n break;\n }\n }\n properties.descent = i - baseline;\n properties.fontSize = properties.ascent + properties.descent;\n TextMetrics._fonts[font] = properties;\n return properties;\n };\n /**\n * Clear font metrics in metrics cache.\n *\n * @static\n * @param {string} [font] - font name. If font name not set then clear cache for all fonts.\n */\n TextMetrics.clearMetrics = function (font) {\n if (font === void 0) { font = ''; }\n if (font) {\n delete TextMetrics._fonts[font];\n }\n else {\n TextMetrics._fonts = {};\n }\n };\n return TextMetrics;\n}());\n/**\n * Internal return object for {@link PIXI.TextMetrics.measureFont `TextMetrics.measureFont`}.\n *\n * @typedef {object} FontMetrics\n * @property {number} ascent - The ascent distance\n * @property {number} descent - The descent distance\n * @property {number} fontSize - Font size from ascent to descent\n * @memberof PIXI.TextMetrics\n * @private\n */\nvar canvas = (function () {\n try {\n // OffscreenCanvas2D measureText can be up to 40% faster.\n var c = new OffscreenCanvas(0, 0);\n var context = c.getContext('2d');\n if (context && context.measureText) {\n return c;\n }\n return document.createElement('canvas');\n }\n catch (ex) {\n return document.createElement('canvas');\n }\n})();\ncanvas.width = canvas.height = 10;\n/**\n * Cached canvas element for measuring text\n *\n * @memberof PIXI.TextMetrics\n * @type {HTMLCanvasElement}\n * @private\n */\nTextMetrics._canvas = canvas;\n/**\n * Cache for context to use.\n *\n * @memberof PIXI.TextMetrics\n * @type {CanvasRenderingContext2D}\n * @private\n */\nTextMetrics._context = canvas.getContext('2d');\n/**\n * Cache of {@see PIXI.TextMetrics.FontMetrics} objects.\n *\n * @memberof PIXI.TextMetrics\n * @type {Object}\n * @private\n */\nTextMetrics._fonts = {};\n/**\n * String used for calculate font metrics.\n * These characters are all tall to help calculate the height required for text.\n *\n * @static\n * @memberof PIXI.TextMetrics\n * @name METRICS_STRING\n * @type {string}\n * @default |ÉqÅ\n */\nTextMetrics.METRICS_STRING = '|ÉqÅ';\n/**\n * Baseline symbol for calculate font metrics.\n *\n * @static\n * @memberof PIXI.TextMetrics\n * @name BASELINE_SYMBOL\n * @type {string}\n * @default M\n */\nTextMetrics.BASELINE_SYMBOL = 'M';\n/**\n * Baseline multiplier for calculate font metrics.\n *\n * @static\n * @memberof PIXI.TextMetrics\n * @name BASELINE_MULTIPLIER\n * @type {number}\n * @default 1.4\n */\nTextMetrics.BASELINE_MULTIPLIER = 1.4;\n/**\n * Cache of new line chars.\n *\n * @memberof PIXI.TextMetrics\n * @type {number[]}\n * @private\n */\nTextMetrics._newlines = [\n 0x000A,\n 0x000D ];\n/**\n * Cache of breaking spaces.\n *\n * @memberof PIXI.TextMetrics\n * @type {number[]}\n * @private\n */\nTextMetrics._breakingSpaces = [\n 0x0009,\n 0x0020,\n 0x2000,\n 0x2001,\n 0x2002,\n 0x2003,\n 0x2004,\n 0x2005,\n 0x2006,\n 0x2008,\n 0x2009,\n 0x200A,\n 0x205F,\n 0x3000 ];\n/**\n * A number, or a string containing a number.\n *\n * @memberof PIXI\n * @typedef IFontMetrics\n * @property {number} ascent - Font ascent\n * @property {number} descent - Font descent\n * @property {number} fontSize - Font size\n */\n\nvar defaultDestroyOptions = {\n texture: true,\n children: false,\n baseTexture: true,\n};\n/**\n * A Text Object will create a line or multiple lines of text.\n *\n * The text is created using the [Canvas API](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API).\n *\n * The primary advantage of this class over BitmapText is that you have great control over the style of the next,\n * which you can change at runtime.\n *\n * The primary disadvantages is that each piece of text has it's own texture, which can use more memory.\n * When text changes, this texture has to be re-generated and re-uploaded to the GPU, taking up time.\n *\n * To split a line you can use '\\n' in your text string, or, on the `style` object,\n * change its `wordWrap` property to true and and give the `wordWrapWidth` property a value.\n *\n * A Text can be created directly from a string and a style object,\n * which can be generated [here](https://pixijs.io/pixi-text-style).\n *\n * ```js\n * let text = new PIXI.Text('This is a PixiJS text',{fontFamily : 'Arial', fontSize: 24, fill : 0xff1010, align : 'center'});\n * ```\n *\n * @class\n * @extends PIXI.Sprite\n * @memberof PIXI\n */\nvar Text = /** @class */ (function (_super) {\n __extends(Text, _super);\n /**\n * @param {string} text - The string that you would like the text to display\n * @param {object|PIXI.TextStyle} [style] - The style parameters\n * @param {HTMLCanvasElement} [canvas] - The canvas element for drawing text\n */\n function Text(text, style, canvas) {\n var _this = this;\n var ownCanvas = false;\n if (!canvas) {\n canvas = document.createElement('canvas');\n ownCanvas = true;\n }\n canvas.width = 3;\n canvas.height = 3;\n var texture = _pixi_core__WEBPACK_IMPORTED_MODULE_1__.Texture.from(canvas);\n texture.orig = new _pixi_math__WEBPACK_IMPORTED_MODULE_3__.Rectangle();\n texture.trim = new _pixi_math__WEBPACK_IMPORTED_MODULE_3__.Rectangle();\n _this = _super.call(this, texture) || this;\n /**\n * Keep track if this Text object created it's own canvas\n * element (`true`) or uses the constructor argument (`false`).\n * Used to workaround a GC issues with Safari < 13 when\n * destroying Text. See `destroy` for more info.\n *\n * @member {boolean}\n * @private\n */\n _this._ownCanvas = ownCanvas;\n /**\n * The canvas element that everything is drawn to\n *\n * @member {HTMLCanvasElement}\n */\n _this.canvas = canvas;\n /**\n * The canvas 2d context that everything is drawn with\n * @member {CanvasRenderingContext2D}\n */\n _this.context = _this.canvas.getContext('2d');\n /**\n * The resolution / device pixel ratio of the canvas.\n * This is set to automatically match the renderer resolution by default, but can be overridden by setting manually.\n * @member {number}\n * @default 1\n */\n _this._resolution = _pixi_settings__WEBPACK_IMPORTED_MODULE_2__.settings.RESOLUTION;\n _this._autoResolution = true;\n /**\n * Private tracker for the current text.\n *\n * @member {string}\n * @private\n */\n _this._text = null;\n /**\n * Private tracker for the current style.\n *\n * @member {object}\n * @private\n */\n _this._style = null;\n /**\n * Private listener to track style changes.\n *\n * @member {Function}\n * @private\n */\n _this._styleListener = null;\n /**\n * Private tracker for the current font.\n *\n * @member {string}\n * @private\n */\n _this._font = '';\n _this.text = text;\n _this.style = style;\n _this.localStyleID = -1;\n return _this;\n }\n /**\n * Renders text to its canvas, and updates its texture.\n * By default this is used internally to ensure the texture is correct before rendering,\n * but it can be used called externally, for example from this class to 'pre-generate' the texture from a piece of text,\n * and then shared across multiple Sprites.\n *\n * @param {boolean} respectDirty - Whether to abort updating the text if the Text isn't dirty and the function is called.\n */\n Text.prototype.updateText = function (respectDirty) {\n var style = this._style;\n // check if style has changed..\n if (this.localStyleID !== style.styleID) {\n this.dirty = true;\n this.localStyleID = style.styleID;\n }\n if (!this.dirty && respectDirty) {\n return;\n }\n this._font = this._style.toFontString();\n var context = this.context;\n var measured = TextMetrics.measureText(this._text || ' ', this._style, this._style.wordWrap, this.canvas);\n var width = measured.width;\n var height = measured.height;\n var lines = measured.lines;\n var lineHeight = measured.lineHeight;\n var lineWidths = measured.lineWidths;\n var maxLineWidth = measured.maxLineWidth;\n var fontProperties = measured.fontProperties;\n this.canvas.width = Math.ceil((Math.max(1, width) + (style.padding * 2)) * this._resolution);\n this.canvas.height = Math.ceil((Math.max(1, height) + (style.padding * 2)) * this._resolution);\n context.scale(this._resolution, this._resolution);\n context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n context.font = this._font;\n context.lineWidth = style.strokeThickness;\n context.textBaseline = style.textBaseline;\n context.lineJoin = style.lineJoin;\n context.miterLimit = style.miterLimit;\n var linePositionX;\n var linePositionY;\n // require 2 passes if a shadow; the first to draw the drop shadow, the second to draw the text\n var passesCount = style.dropShadow ? 2 : 1;\n // For v4, we drew text at the colours of the drop shadow underneath the normal text. This gave the correct zIndex,\n // but features such as alpha and shadowblur did not look right at all, since we were using actual text as a shadow.\n //\n // For v5.0.0, we moved over to just use the canvas API for drop shadows, which made them look much nicer and more\n // visually please, but now because the stroke is drawn and then the fill, drop shadows would appear on both the fill\n // and the stroke; and fill drop shadows would appear over the top of the stroke.\n //\n // For v5.1.1, the new route is to revert to v4 style of drawing text first to get the drop shadows underneath normal\n // text, but instead drawing text in the correct location, we'll draw it off screen (-paddingY), and then adjust the\n // drop shadow so only that appears on screen (+paddingY). Now we'll have the correct draw order of the shadow\n // beneath the text, whilst also having the proper text shadow styling.\n for (var i = 0; i < passesCount; ++i) {\n var isShadowPass = style.dropShadow && i === 0;\n // we only want the drop shadow, so put text way off-screen\n var dsOffsetText = isShadowPass ? Math.ceil(Math.max(1, height) + (style.padding * 2)) : 0;\n var dsOffsetShadow = dsOffsetText * this._resolution;\n if (isShadowPass) {\n // On Safari, text with gradient and drop shadows together do not position correctly\n // if the scale of the canvas is not 1: https://bugs.webkit.org/show_bug.cgi?id=197689\n // Therefore we'll set the styles to be a plain black whilst generating this drop shadow\n context.fillStyle = 'black';\n context.strokeStyle = 'black';\n var dropShadowColor = style.dropShadowColor;\n var rgb = (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_4__.hex2rgb)(typeof dropShadowColor === 'number' ? dropShadowColor : (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_4__.string2hex)(dropShadowColor));\n context.shadowColor = \"rgba(\" + rgb[0] * 255 + \",\" + rgb[1] * 255 + \",\" + rgb[2] * 255 + \",\" + style.dropShadowAlpha + \")\";\n context.shadowBlur = style.dropShadowBlur;\n context.shadowOffsetX = Math.cos(style.dropShadowAngle) * style.dropShadowDistance;\n context.shadowOffsetY = (Math.sin(style.dropShadowAngle) * style.dropShadowDistance) + dsOffsetShadow;\n }\n else {\n // set canvas text styles\n context.fillStyle = this._generateFillStyle(style, lines, measured);\n // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as\n // the setter converts to string. See this thread for more details:\n // https://github.com/microsoft/TypeScript/issues/2521\n context.strokeStyle = style.stroke;\n context.shadowColor = 'black';\n context.shadowBlur = 0;\n context.shadowOffsetX = 0;\n context.shadowOffsetY = 0;\n }\n // draw lines line by line\n for (var i_1 = 0; i_1 < lines.length; i_1++) {\n linePositionX = style.strokeThickness / 2;\n linePositionY = ((style.strokeThickness / 2) + (i_1 * lineHeight)) + fontProperties.ascent;\n if (style.align === 'right') {\n linePositionX += maxLineWidth - lineWidths[i_1];\n }\n else if (style.align === 'center') {\n linePositionX += (maxLineWidth - lineWidths[i_1]) / 2;\n }\n if (style.stroke && style.strokeThickness) {\n this.drawLetterSpacing(lines[i_1], linePositionX + style.padding, linePositionY + style.padding - dsOffsetText, true);\n }\n if (style.fill) {\n this.drawLetterSpacing(lines[i_1], linePositionX + style.padding, linePositionY + style.padding - dsOffsetText);\n }\n }\n }\n this.updateTexture();\n };\n /**\n * Render the text with letter-spacing.\n * @param {string} text - The text to draw\n * @param {number} x - Horizontal position to draw the text\n * @param {number} y - Vertical position to draw the text\n * @param {boolean} [isStroke=false] - Is this drawing for the outside stroke of the\n * text? If not, it's for the inside fill\n * @private\n */\n Text.prototype.drawLetterSpacing = function (text, x, y, isStroke) {\n if (isStroke === void 0) { isStroke = false; }\n var style = this._style;\n // letterSpacing of 0 means normal\n var letterSpacing = style.letterSpacing;\n if (letterSpacing === 0) {\n if (isStroke) {\n this.context.strokeText(text, x, y);\n }\n else {\n this.context.fillText(text, x, y);\n }\n return;\n }\n var currentPosition = x;\n // Using Array.from correctly splits characters whilst keeping emoji together.\n // This is not supported on IE as it requires ES6, so regular text splitting occurs.\n // This also doesn't account for emoji that are multiple emoji put together to make something else.\n // Handling all of this would require a big library itself.\n // https://medium.com/@giltayar/iterating-over-emoji-characters-the-es6-way-f06e4589516\n // https://github.com/orling/grapheme-splitter\n var stringArray = Array.from ? Array.from(text) : text.split('');\n var previousWidth = this.context.measureText(text).width;\n var currentWidth = 0;\n for (var i = 0; i < stringArray.length; ++i) {\n var currentChar = stringArray[i];\n if (isStroke) {\n this.context.strokeText(currentChar, currentPosition, y);\n }\n else {\n this.context.fillText(currentChar, currentPosition, y);\n }\n currentWidth = this.context.measureText(text.substring(i + 1)).width;\n currentPosition += previousWidth - currentWidth + letterSpacing;\n previousWidth = currentWidth;\n }\n };\n /**\n * Updates texture size based on canvas size\n *\n * @private\n */\n Text.prototype.updateTexture = function () {\n var canvas = this.canvas;\n if (this._style.trim) {\n var trimmed = (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_4__.trimCanvas)(canvas);\n if (trimmed.data) {\n canvas.width = trimmed.width;\n canvas.height = trimmed.height;\n this.context.putImageData(trimmed.data, 0, 0);\n }\n }\n var texture = this._texture;\n var style = this._style;\n var padding = style.trim ? 0 : style.padding;\n var baseTexture = texture.baseTexture;\n texture.trim.width = texture._frame.width = Math.ceil(canvas.width / this._resolution);\n texture.trim.height = texture._frame.height = Math.ceil(canvas.height / this._resolution);\n texture.trim.x = -padding;\n texture.trim.y = -padding;\n texture.orig.width = texture._frame.width - (padding * 2);\n texture.orig.height = texture._frame.height - (padding * 2);\n // call sprite onTextureUpdate to update scale if _width or _height were set\n this._onTextureUpdate();\n baseTexture.setRealSize(canvas.width, canvas.height, this._resolution);\n // Recursively updates transform of all objects from the root to this one\n this._recursivePostUpdateTransform();\n this.dirty = false;\n };\n /**\n * Renders the object using the WebGL renderer\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n Text.prototype._render = function (renderer) {\n if (this._autoResolution && this._resolution !== renderer.resolution) {\n this._resolution = renderer.resolution;\n this.dirty = true;\n }\n this.updateText(true);\n _super.prototype._render.call(this, renderer);\n };\n /**\n * Gets the local bounds of the text object.\n *\n * @param {PIXI.Rectangle} rect - The output rectangle.\n * @return {PIXI.Rectangle} The bounds.\n */\n Text.prototype.getLocalBounds = function (rect) {\n this.updateText(true);\n return _super.prototype.getLocalBounds.call(this, rect);\n };\n /**\n * calculates the bounds of the Text as a rectangle. The bounds calculation takes the worldTransform into account.\n * @protected\n */\n Text.prototype._calculateBounds = function () {\n this.updateText(true);\n this.calculateVertices();\n // if we have already done this on THIS frame.\n this._bounds.addQuad(this.vertexData);\n };\n /**\n * Generates the fill style. Can automatically generate a gradient based on the fill style being an array\n *\n * @private\n * @param {object} style - The style.\n * @param {string[]} lines - The lines of text.\n * @return {string|number|CanvasGradient} The fill style\n */\n Text.prototype._generateFillStyle = function (style, lines, metrics) {\n // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as\n // the setter converts to string. See this thread for more details:\n // https://github.com/microsoft/TypeScript/issues/2521\n var fillStyle = style.fill;\n if (!Array.isArray(fillStyle)) {\n return fillStyle;\n }\n else if (fillStyle.length === 1) {\n return fillStyle[0];\n }\n // the gradient will be evenly spaced out according to how large the array is.\n // ['#FF0000', '#00FF00', '#0000FF'] would created stops at 0.25, 0.5 and 0.75\n var gradient;\n // a dropshadow will enlarge the canvas and result in the gradient being\n // generated with the incorrect dimensions\n var dropShadowCorrection = (style.dropShadow) ? style.dropShadowDistance : 0;\n // should also take padding into account, padding can offset the gradient\n var padding = style.padding || 0;\n var width = Math.ceil(this.canvas.width / this._resolution) - dropShadowCorrection - (padding * 2);\n var height = Math.ceil(this.canvas.height / this._resolution) - dropShadowCorrection - (padding * 2);\n // make a copy of the style settings, so we can manipulate them later\n var fill = fillStyle.slice();\n var fillGradientStops = style.fillGradientStops.slice();\n // wanting to evenly distribute the fills. So an array of 4 colours should give fills of 0.25, 0.5 and 0.75\n if (!fillGradientStops.length) {\n var lengthPlus1 = fill.length + 1;\n for (var i = 1; i < lengthPlus1; ++i) {\n fillGradientStops.push(i / lengthPlus1);\n }\n }\n // stop the bleeding of the last gradient on the line above to the top gradient of the this line\n // by hard defining the first gradient colour at point 0, and last gradient colour at point 1\n fill.unshift(fillStyle[0]);\n fillGradientStops.unshift(0);\n fill.push(fillStyle[fillStyle.length - 1]);\n fillGradientStops.push(1);\n if (style.fillGradientType === TEXT_GRADIENT.LINEAR_VERTICAL) {\n // start the gradient at the top center of the canvas, and end at the bottom middle of the canvas\n gradient = this.context.createLinearGradient(width / 2, padding, width / 2, height + padding);\n // we need to repeat the gradient so that each individual line of text has the same vertical gradient effect\n // ['#FF0000', '#00FF00', '#0000FF'] over 2 lines would create stops at 0.125, 0.25, 0.375, 0.625, 0.75, 0.875\n // There's potential for floating point precision issues at the seams between gradient repeats.\n // The loop below generates the stops in order, so track the last generated one to prevent\n // floating point precision from making us go the teeniest bit backwards, resulting in\n // the first and last colors getting swapped.\n var lastIterationStop = 0;\n // Actual height of the text itself, not counting spacing for lineHeight/leading/dropShadow etc\n var textHeight = metrics.fontProperties.fontSize + style.strokeThickness;\n // textHeight, but as a 0-1 size in global gradient stop space\n var gradStopLineHeight = textHeight / height;\n for (var i = 0; i < lines.length; i++) {\n var thisLineTop = metrics.lineHeight * i;\n for (var j = 0; j < fill.length; j++) {\n // 0-1 stop point for the current line, multiplied to global space afterwards\n var lineStop = 0;\n if (typeof fillGradientStops[j] === 'number') {\n lineStop = fillGradientStops[j];\n }\n else {\n lineStop = j / fill.length;\n }\n var globalStop = (thisLineTop / height) + (lineStop * gradStopLineHeight);\n // Prevent color stop generation going backwards from floating point imprecision\n var clampedStop = Math.max(lastIterationStop, globalStop);\n clampedStop = Math.min(clampedStop, 1); // Cap at 1 as well for safety's sake to avoid a possible throw.\n gradient.addColorStop(clampedStop, fill[j]);\n lastIterationStop = clampedStop;\n }\n }\n }\n else {\n // start the gradient at the center left of the canvas, and end at the center right of the canvas\n gradient = this.context.createLinearGradient(padding, height / 2, width + padding, height / 2);\n // can just evenly space out the gradients in this case, as multiple lines makes no difference\n // to an even left to right gradient\n var totalIterations = fill.length + 1;\n var currentIteration = 1;\n for (var i = 0; i < fill.length; i++) {\n var stop = void 0;\n if (typeof fillGradientStops[i] === 'number') {\n stop = fillGradientStops[i];\n }\n else {\n stop = currentIteration / totalIterations;\n }\n gradient.addColorStop(stop, fill[i]);\n currentIteration++;\n }\n }\n return gradient;\n };\n /**\n * Destroys this text object.\n * Note* Unlike a Sprite, a Text object will automatically destroy its baseTexture and texture as\n * the majority of the time the texture will not be shared with any other Sprites.\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their\n * destroy method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=true] - Should it destroy the current texture of the sprite as well\n * @param {boolean} [options.baseTexture=true] - Should it destroy the base texture of the sprite as well\n */\n Text.prototype.destroy = function (options) {\n if (typeof options === 'boolean') {\n options = { children: options };\n }\n options = Object.assign({}, defaultDestroyOptions, options);\n _super.prototype.destroy.call(this, options);\n // set canvas width and height to 0 to workaround memory leak in Safari < 13\n // https://stackoverflow.com/questions/52532614/total-canvas-memory-use-exceeds-the-maximum-limit-safari-12\n if (this._ownCanvas) {\n this.canvas.height = this.canvas.width = 0;\n }\n // make sure to reset the the context and canvas.. dont want this hanging around in memory!\n this.context = null;\n this.canvas = null;\n this._style = null;\n };\n Object.defineProperty(Text.prototype, \"width\", {\n /**\n * The width of the Text, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get: function () {\n this.updateText(true);\n return Math.abs(this.scale.x) * this._texture.orig.width;\n },\n set: function (value) {\n this.updateText(true);\n var s = (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_4__.sign)(this.scale.x) || 1;\n this.scale.x = s * value / this._texture.orig.width;\n this._width = value;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Text.prototype, \"height\", {\n /**\n * The height of the Text, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get: function () {\n this.updateText(true);\n return Math.abs(this.scale.y) * this._texture.orig.height;\n },\n set: function (value) {\n this.updateText(true);\n var s = (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_4__.sign)(this.scale.y) || 1;\n this.scale.y = s * value / this._texture.orig.height;\n this._height = value;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Text.prototype, \"style\", {\n /**\n * Set the style of the text. Set up an event listener to listen for changes on the style\n * object and mark the text as dirty.\n *\n * @member {object|PIXI.TextStyle}\n */\n get: function () {\n // TODO: Can't have different types for getter and setter. The getter shouldn't have the ITextStyle\n // since the setter creates the TextStyle. See this thread for more details:\n // https://github.com/microsoft/TypeScript/issues/2521\n return this._style;\n },\n set: function (style) {\n style = style || {};\n if (style instanceof TextStyle) {\n this._style = style;\n }\n else {\n this._style = new TextStyle(style);\n }\n this.localStyleID = -1;\n this.dirty = true;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Text.prototype, \"text\", {\n /**\n * Set the copy for the text object. To split a line you can use '\\n'.\n *\n * @member {string}\n */\n get: function () {\n return this._text;\n },\n set: function (text) {\n text = String(text === null || text === undefined ? '' : text);\n if (this._text === text) {\n return;\n }\n this._text = text;\n this.dirty = true;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Text.prototype, \"resolution\", {\n /**\n * The resolution / device pixel ratio of the canvas.\n * This is set to automatically match the renderer resolution by default, but can be overridden by setting manually.\n * @member {number}\n * @default 1\n */\n get: function () {\n return this._resolution;\n },\n set: function (value) {\n this._autoResolution = false;\n if (this._resolution === value) {\n return;\n }\n this._resolution = value;\n this.dirty = true;\n },\n enumerable: false,\n configurable: true\n });\n return Text;\n}(_pixi_sprite__WEBPACK_IMPORTED_MODULE_0__.Sprite));\n\n\n//# sourceMappingURL=text.es.js.map\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/@pixi/text/lib/text.es.js?"); /***/ }), /***/ "./node_modules/@pixi/ticker/lib/ticker.es.js": /*!****************************************************!*\ !*** ./node_modules/@pixi/ticker/lib/ticker.es.js ***! \****************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Ticker\": () => (/* binding */ Ticker),\n/* harmony export */ \"TickerPlugin\": () => (/* binding */ TickerPlugin),\n/* harmony export */ \"UPDATE_PRIORITY\": () => (/* binding */ UPDATE_PRIORITY)\n/* harmony export */ });\n/* harmony import */ var _pixi_settings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @pixi/settings */ \"./node_modules/@pixi/settings/lib/settings.es.js\");\n/*!\n * @pixi/ticker - v5.3.11\n * Compiled Mon, 01 Nov 2021 16:10:12 UTC\n *\n * @pixi/ticker is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n\n\n/**\n * Target frames per millisecond.\n *\n * @static\n * @name TARGET_FPMS\n * @memberof PIXI.settings\n * @type {number}\n * @default 0.06\n */\n_pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.TARGET_FPMS = 0.06;\n\n/**\n * Represents the update priorities used by internal PIXI classes when registered with\n * the {@link PIXI.Ticker} object. Higher priority items are updated first and lower\n * priority items, such as render, should go later.\n *\n * @static\n * @constant\n * @name UPDATE_PRIORITY\n * @memberof PIXI\n * @enum {number}\n * @property {number} INTERACTION=50 Highest priority, used for {@link PIXI.InteractionManager}\n * @property {number} HIGH=25 High priority updating, {@link PIXI.VideoBaseTexture} and {@link PIXI.AnimatedSprite}\n * @property {number} NORMAL=0 Default priority for ticker events, see {@link PIXI.Ticker#add}.\n * @property {number} LOW=-25 Low priority used for {@link PIXI.Application} rendering.\n * @property {number} UTILITY=-50 Lowest priority used for {@link PIXI.BasePrepare} utility.\n */\nvar UPDATE_PRIORITY;\n(function (UPDATE_PRIORITY) {\n UPDATE_PRIORITY[UPDATE_PRIORITY[\"INTERACTION\"] = 50] = \"INTERACTION\";\n UPDATE_PRIORITY[UPDATE_PRIORITY[\"HIGH\"] = 25] = \"HIGH\";\n UPDATE_PRIORITY[UPDATE_PRIORITY[\"NORMAL\"] = 0] = \"NORMAL\";\n UPDATE_PRIORITY[UPDATE_PRIORITY[\"LOW\"] = -25] = \"LOW\";\n UPDATE_PRIORITY[UPDATE_PRIORITY[\"UTILITY\"] = -50] = \"UTILITY\";\n})(UPDATE_PRIORITY || (UPDATE_PRIORITY = {}));\n\n/**\n * Internal class for handling the priority sorting of ticker handlers.\n *\n * @private\n * @class\n * @memberof PIXI\n */\nvar TickerListener = /** @class */ (function () {\n /**\n * Constructor\n * @private\n * @param {Function} fn - The listener function to be added for one update\n * @param {*} [context=null] - The listener context\n * @param {number} [priority=0] - The priority for emitting\n * @param {boolean} [once=false] - If the handler should fire once\n */\n function TickerListener(fn, context, priority, once) {\n if (context === void 0) { context = null; }\n if (priority === void 0) { priority = 0; }\n if (once === void 0) { once = false; }\n /**\n * The handler function to execute.\n * @private\n * @member {Function}\n */\n this.fn = fn;\n /**\n * The calling to execute.\n * @private\n * @member {*}\n */\n this.context = context;\n /**\n * The current priority.\n * @private\n * @member {number}\n */\n this.priority = priority;\n /**\n * If this should only execute once.\n * @private\n * @member {boolean}\n */\n this.once = once;\n /**\n * The next item in chain.\n * @private\n * @member {TickerListener}\n */\n this.next = null;\n /**\n * The previous item in chain.\n * @private\n * @member {TickerListener}\n */\n this.previous = null;\n /**\n * `true` if this listener has been destroyed already.\n * @member {boolean}\n * @private\n */\n this._destroyed = false;\n }\n /**\n * Simple compare function to figure out if a function and context match.\n * @private\n * @param {Function} fn - The listener function to be added for one update\n * @param {any} [context] - The listener context\n * @return {boolean} `true` if the listener match the arguments\n */\n TickerListener.prototype.match = function (fn, context) {\n if (context === void 0) { context = null; }\n return this.fn === fn && this.context === context;\n };\n /**\n * Emit by calling the current function.\n * @private\n * @param {number} deltaTime - time since the last emit.\n * @return {TickerListener} Next ticker\n */\n TickerListener.prototype.emit = function (deltaTime) {\n if (this.fn) {\n if (this.context) {\n this.fn.call(this.context, deltaTime);\n }\n else {\n this.fn(deltaTime);\n }\n }\n var redirect = this.next;\n if (this.once) {\n this.destroy(true);\n }\n // Soft-destroying should remove\n // the next reference\n if (this._destroyed) {\n this.next = null;\n }\n return redirect;\n };\n /**\n * Connect to the list.\n * @private\n * @param {TickerListener} previous - Input node, previous listener\n */\n TickerListener.prototype.connect = function (previous) {\n this.previous = previous;\n if (previous.next) {\n previous.next.previous = this;\n }\n this.next = previous.next;\n previous.next = this;\n };\n /**\n * Destroy and don't use after this.\n * @private\n * @param {boolean} [hard = false] `true` to remove the `next` reference, this\n * is considered a hard destroy. Soft destroy maintains the next reference.\n * @return {TickerListener} The listener to redirect while emitting or removing.\n */\n TickerListener.prototype.destroy = function (hard) {\n if (hard === void 0) { hard = false; }\n this._destroyed = true;\n this.fn = null;\n this.context = null;\n // Disconnect, hook up next and previous\n if (this.previous) {\n this.previous.next = this.next;\n }\n if (this.next) {\n this.next.previous = this.previous;\n }\n // Redirect to the next item\n var redirect = this.next;\n // Remove references\n this.next = hard ? null : redirect;\n this.previous = null;\n return redirect;\n };\n return TickerListener;\n}());\n\n/**\n * A Ticker class that runs an update loop that other objects listen to.\n *\n * This class is composed around listeners meant for execution on the next requested animation frame.\n * Animation frames are requested only when necessary, e.g. When the ticker is started and the emitter has listeners.\n *\n * @class\n * @memberof PIXI\n */\nvar Ticker = /** @class */ (function () {\n function Ticker() {\n var _this = this;\n /**\n * The first listener. All new listeners added are chained on this.\n * @private\n * @type {TickerListener}\n */\n this._head = new TickerListener(null, null, Infinity);\n /**\n * Internal current frame request ID\n * @type {?number}\n * @private\n */\n this._requestId = null;\n /**\n * Internal value managed by minFPS property setter and getter.\n * This is the maximum allowed milliseconds between updates.\n * @type {number}\n * @private\n */\n this._maxElapsedMS = 100;\n /**\n * Internal value managed by maxFPS property setter and getter.\n * This is the minimum allowed milliseconds between updates.\n * @type {number}\n * @private\n */\n this._minElapsedMS = 0;\n /**\n * Whether or not this ticker should invoke the method\n * {@link PIXI.Ticker#start} automatically\n * when a listener is added.\n *\n * @member {boolean}\n * @default false\n */\n this.autoStart = false;\n /**\n * Scalar time value from last frame to this frame.\n * This value is capped by setting {@link PIXI.Ticker#minFPS}\n * and is scaled with {@link PIXI.Ticker#speed}.\n * **Note:** The cap may be exceeded by scaling.\n *\n * @member {number}\n * @default 1\n */\n this.deltaTime = 1;\n /**\n * Scaler time elapsed in milliseconds from last frame to this frame.\n * This value is capped by setting {@link PIXI.Ticker#minFPS}\n * and is scaled with {@link PIXI.Ticker#speed}.\n * **Note:** The cap may be exceeded by scaling.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n * Defaults to target frame time\n *\n * @member {number}\n * @default 16.66\n */\n this.deltaMS = 1 / _pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.TARGET_FPMS;\n /**\n * Time elapsed in milliseconds from last frame to this frame.\n * Opposed to what the scalar {@link PIXI.Ticker#deltaTime}\n * is based, this value is neither capped nor scaled.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n * Defaults to target frame time\n *\n * @member {number}\n * @default 16.66\n */\n this.elapsedMS = 1 / _pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.TARGET_FPMS;\n /**\n * The last time {@link PIXI.Ticker#update} was invoked.\n * This value is also reset internally outside of invoking\n * update, but only when a new animation frame is requested.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n *\n * @member {number}\n * @default -1\n */\n this.lastTime = -1;\n /**\n * Factor of current {@link PIXI.Ticker#deltaTime}.\n * @example\n * // Scales ticker.deltaTime to what would be\n * // the equivalent of approximately 120 FPS\n * ticker.speed = 2;\n *\n * @member {number}\n * @default 1\n */\n this.speed = 1;\n /**\n * Whether or not this ticker has been started.\n * `true` if {@link PIXI.Ticker#start} has been called.\n * `false` if {@link PIXI.Ticker#stop} has been called.\n * While `false`, this value may change to `true` in the\n * event of {@link PIXI.Ticker#autoStart} being `true`\n * and a listener is added.\n *\n * @member {boolean}\n * @default false\n */\n this.started = false;\n /**\n * If enabled, deleting is disabled.\n * @member {boolean}\n * @default false\n * @private\n */\n this._protected = false;\n /**\n * The last time keyframe was executed.\n * Maintains a relatively fixed interval with the previous value.\n * @member {number}\n * @default -1\n * @private\n */\n this._lastFrame = -1;\n /**\n * Internal tick method bound to ticker instance.\n * This is because in early 2015, Function.bind\n * is still 60% slower in high performance scenarios.\n * Also separating frame requests from update method\n * so listeners may be called at any time and with\n * any animation API, just invoke ticker.update(time).\n *\n * @private\n * @param {number} time - Time since last tick.\n */\n this._tick = function (time) {\n _this._requestId = null;\n if (_this.started) {\n // Invoke listeners now\n _this.update(time);\n // Listener side effects may have modified ticker state.\n if (_this.started && _this._requestId === null && _this._head.next) {\n _this._requestId = requestAnimationFrame(_this._tick);\n }\n }\n };\n }\n /**\n * Conditionally requests a new animation frame.\n * If a frame has not already been requested, and if the internal\n * emitter has listeners, a new frame is requested.\n *\n * @private\n */\n Ticker.prototype._requestIfNeeded = function () {\n if (this._requestId === null && this._head.next) {\n // ensure callbacks get correct delta\n this.lastTime = performance.now();\n this._lastFrame = this.lastTime;\n this._requestId = requestAnimationFrame(this._tick);\n }\n };\n /**\n * Conditionally cancels a pending animation frame.\n *\n * @private\n */\n Ticker.prototype._cancelIfNeeded = function () {\n if (this._requestId !== null) {\n cancelAnimationFrame(this._requestId);\n this._requestId = null;\n }\n };\n /**\n * Conditionally requests a new animation frame.\n * If the ticker has been started it checks if a frame has not already\n * been requested, and if the internal emitter has listeners. If these\n * conditions are met, a new frame is requested. If the ticker has not\n * been started, but autoStart is `true`, then the ticker starts now,\n * and continues with the previous conditions to request a new frame.\n *\n * @private\n */\n Ticker.prototype._startIfPossible = function () {\n if (this.started) {\n this._requestIfNeeded();\n }\n else if (this.autoStart) {\n this.start();\n }\n };\n /**\n * Register a handler for tick events. Calls continuously unless\n * it is removed or the ticker is stopped.\n *\n * @param {Function} fn - The listener function to be added for updates\n * @param {*} [context] - The listener context\n * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting\n * @returns {PIXI.Ticker} This instance of a ticker\n */\n Ticker.prototype.add = function (fn, context, priority) {\n if (priority === void 0) { priority = UPDATE_PRIORITY.NORMAL; }\n return this._addListener(new TickerListener(fn, context, priority));\n };\n /**\n * Add a handler for the tick event which is only execute once.\n *\n * @param {Function} fn - The listener function to be added for one update\n * @param {*} [context] - The listener context\n * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting\n * @returns {PIXI.Ticker} This instance of a ticker\n */\n Ticker.prototype.addOnce = function (fn, context, priority) {\n if (priority === void 0) { priority = UPDATE_PRIORITY.NORMAL; }\n return this._addListener(new TickerListener(fn, context, priority, true));\n };\n /**\n * Internally adds the event handler so that it can be sorted by priority.\n * Priority allows certain handler (user, AnimatedSprite, Interaction) to be run\n * before the rendering.\n *\n * @private\n * @param {TickerListener} listener - Current listener being added.\n * @returns {PIXI.Ticker} This instance of a ticker\n */\n Ticker.prototype._addListener = function (listener) {\n // For attaching to head\n var current = this._head.next;\n var previous = this._head;\n // Add the first item\n if (!current) {\n listener.connect(previous);\n }\n else {\n // Go from highest to lowest priority\n while (current) {\n if (listener.priority > current.priority) {\n listener.connect(previous);\n break;\n }\n previous = current;\n current = current.next;\n }\n // Not yet connected\n if (!listener.previous) {\n listener.connect(previous);\n }\n }\n this._startIfPossible();\n return this;\n };\n /**\n * Removes any handlers matching the function and context parameters.\n * If no handlers are left after removing, then it cancels the animation frame.\n *\n * @param {Function} fn - The listener function to be removed\n * @param {*} [context] - The listener context to be removed\n * @returns {PIXI.Ticker} This instance of a ticker\n */\n Ticker.prototype.remove = function (fn, context) {\n var listener = this._head.next;\n while (listener) {\n // We found a match, lets remove it\n // no break to delete all possible matches\n // incase a listener was added 2+ times\n if (listener.match(fn, context)) {\n listener = listener.destroy();\n }\n else {\n listener = listener.next;\n }\n }\n if (!this._head.next) {\n this._cancelIfNeeded();\n }\n return this;\n };\n Object.defineProperty(Ticker.prototype, \"count\", {\n /**\n * The number of listeners on this ticker, calculated by walking through linked list\n *\n * @readonly\n * @member {number}\n */\n get: function () {\n if (!this._head) {\n return 0;\n }\n var count = 0;\n var current = this._head;\n while ((current = current.next)) {\n count++;\n }\n return count;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Starts the ticker. If the ticker has listeners\n * a new animation frame is requested at this point.\n */\n Ticker.prototype.start = function () {\n if (!this.started) {\n this.started = true;\n this._requestIfNeeded();\n }\n };\n /**\n * Stops the ticker. If the ticker has requested\n * an animation frame it is canceled at this point.\n */\n Ticker.prototype.stop = function () {\n if (this.started) {\n this.started = false;\n this._cancelIfNeeded();\n }\n };\n /**\n * Destroy the ticker and don't use after this. Calling\n * this method removes all references to internal events.\n */\n Ticker.prototype.destroy = function () {\n if (!this._protected) {\n this.stop();\n var listener = this._head.next;\n while (listener) {\n listener = listener.destroy(true);\n }\n this._head.destroy();\n this._head = null;\n }\n };\n /**\n * Triggers an update. An update entails setting the\n * current {@link PIXI.Ticker#elapsedMS},\n * the current {@link PIXI.Ticker#deltaTime},\n * invoking all listeners with current deltaTime,\n * and then finally setting {@link PIXI.Ticker#lastTime}\n * with the value of currentTime that was provided.\n * This method will be called automatically by animation\n * frame callbacks if the ticker instance has been started\n * and listeners are added.\n *\n * @param {number} [currentTime=performance.now()] - the current time of execution\n */\n Ticker.prototype.update = function (currentTime) {\n if (currentTime === void 0) { currentTime = performance.now(); }\n var elapsedMS;\n // If the difference in time is zero or negative, we ignore most of the work done here.\n // If there is no valid difference, then should be no reason to let anyone know about it.\n // A zero delta, is exactly that, nothing should update.\n //\n // The difference in time can be negative, and no this does not mean time traveling.\n // This can be the result of a race condition between when an animation frame is requested\n // on the current JavaScript engine event loop, and when the ticker's start method is invoked\n // (which invokes the internal _requestIfNeeded method). If a frame is requested before\n // _requestIfNeeded is invoked, then the callback for the animation frame the ticker requests,\n // can receive a time argument that can be less than the lastTime value that was set within\n // _requestIfNeeded. This difference is in microseconds, but this is enough to cause problems.\n //\n // This check covers this browser engine timing issue, as well as if consumers pass an invalid\n // currentTime value. This may happen if consumers opt-out of the autoStart, and update themselves.\n if (currentTime > this.lastTime) {\n // Save uncapped elapsedMS for measurement\n elapsedMS = this.elapsedMS = currentTime - this.lastTime;\n // cap the milliseconds elapsed used for deltaTime\n if (elapsedMS > this._maxElapsedMS) {\n elapsedMS = this._maxElapsedMS;\n }\n elapsedMS *= this.speed;\n // If not enough time has passed, exit the function.\n // Get ready for next frame by setting _lastFrame, but based on _minElapsedMS\n // adjustment to ensure a relatively stable interval.\n if (this._minElapsedMS) {\n var delta = currentTime - this._lastFrame | 0;\n if (delta < this._minElapsedMS) {\n return;\n }\n this._lastFrame = currentTime - (delta % this._minElapsedMS);\n }\n this.deltaMS = elapsedMS;\n this.deltaTime = this.deltaMS * _pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.TARGET_FPMS;\n // Cache a local reference, in-case ticker is destroyed\n // during the emit, we can still check for head.next\n var head = this._head;\n // Invoke listeners added to internal emitter\n var listener = head.next;\n while (listener) {\n listener = listener.emit(this.deltaTime);\n }\n if (!head.next) {\n this._cancelIfNeeded();\n }\n }\n else {\n this.deltaTime = this.deltaMS = this.elapsedMS = 0;\n }\n this.lastTime = currentTime;\n };\n Object.defineProperty(Ticker.prototype, \"FPS\", {\n /**\n * The frames per second at which this ticker is running.\n * The default is approximately 60 in most modern browsers.\n * **Note:** This does not factor in the value of\n * {@link PIXI.Ticker#speed}, which is specific\n * to scaling {@link PIXI.Ticker#deltaTime}.\n *\n * @member {number}\n * @readonly\n */\n get: function () {\n return 1000 / this.elapsedMS;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Ticker.prototype, \"minFPS\", {\n /**\n * Manages the maximum amount of milliseconds allowed to\n * elapse between invoking {@link PIXI.Ticker#update}.\n * This value is used to cap {@link PIXI.Ticker#deltaTime},\n * but does not effect the measured value of {@link PIXI.Ticker#FPS}.\n * When setting this property it is clamped to a value between\n * `0` and `PIXI.settings.TARGET_FPMS * 1000`.\n *\n * @member {number}\n * @default 10\n */\n get: function () {\n return 1000 / this._maxElapsedMS;\n },\n set: function (fps) {\n // Minimum must be below the maxFPS\n var minFPS = Math.min(this.maxFPS, fps);\n // Must be at least 0, but below 1 / settings.TARGET_FPMS\n var minFPMS = Math.min(Math.max(0, minFPS) / 1000, _pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.TARGET_FPMS);\n this._maxElapsedMS = 1 / minFPMS;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Ticker.prototype, \"maxFPS\", {\n /**\n * Manages the minimum amount of milliseconds required to\n * elapse between invoking {@link PIXI.Ticker#update}.\n * This will effect the measured value of {@link PIXI.Ticker#FPS}.\n * If it is set to `0`, then there is no limit; PixiJS will render as many frames as it can.\n * Otherwise it will be at least `minFPS`\n *\n * @member {number}\n * @default 0\n */\n get: function () {\n if (this._minElapsedMS) {\n return Math.round(1000 / this._minElapsedMS);\n }\n return 0;\n },\n set: function (fps) {\n if (fps === 0) {\n this._minElapsedMS = 0;\n }\n else {\n // Max must be at least the minFPS\n var maxFPS = Math.max(this.minFPS, fps);\n this._minElapsedMS = 1 / (maxFPS / 1000);\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Ticker, \"shared\", {\n /**\n * The shared ticker instance used by {@link PIXI.AnimatedSprite} and by\n * {@link PIXI.VideoResource} to update animation frames / video textures.\n *\n * It may also be used by {@link PIXI.Application} if created with the `sharedTicker` option property set to true.\n *\n * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance.\n * Please follow the examples for usage, including how to opt-out of auto-starting the shared ticker.\n *\n * @example\n * let ticker = PIXI.Ticker.shared;\n * // Set this to prevent starting this ticker when listeners are added.\n * // By default this is true only for the PIXI.Ticker.shared instance.\n * ticker.autoStart = false;\n * // FYI, call this to ensure the ticker is stopped. It should be stopped\n * // if you have not attempted to render anything yet.\n * ticker.stop();\n * // Call this when you are ready for a running shared ticker.\n * ticker.start();\n *\n * @example\n * // You may use the shared ticker to render...\n * let renderer = PIXI.autoDetectRenderer();\n * let stage = new PIXI.Container();\n * document.body.appendChild(renderer.view);\n * ticker.add(function (time) {\n * renderer.render(stage);\n * });\n *\n * @example\n * // Or you can just update it manually.\n * ticker.autoStart = false;\n * ticker.stop();\n * function animate(time) {\n * ticker.update(time);\n * renderer.render(stage);\n * requestAnimationFrame(animate);\n * }\n * animate(performance.now());\n *\n * @member {PIXI.Ticker}\n * @static\n */\n get: function () {\n if (!Ticker._shared) {\n var shared = Ticker._shared = new Ticker();\n shared.autoStart = true;\n shared._protected = true;\n }\n return Ticker._shared;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Ticker, \"system\", {\n /**\n * The system ticker instance used by {@link PIXI.InteractionManager} and by\n * {@link PIXI.BasePrepare} for core timing functionality that shouldn't usually need to be paused,\n * unlike the `shared` ticker which drives visual animations and rendering which may want to be paused.\n *\n * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance.\n *\n * @member {PIXI.Ticker}\n * @static\n */\n get: function () {\n if (!Ticker._system) {\n var system = Ticker._system = new Ticker();\n system.autoStart = true;\n system._protected = true;\n }\n return Ticker._system;\n },\n enumerable: false,\n configurable: true\n });\n return Ticker;\n}());\n\n/**\n * Middleware for for Application Ticker.\n *\n * @example\n * import {TickerPlugin} from '@pixi/ticker';\n * import {Application} from '@pixi/app';\n * Application.registerPlugin(TickerPlugin);\n *\n * @class\n * @memberof PIXI\n */\nvar TickerPlugin = /** @class */ (function () {\n function TickerPlugin() {\n }\n /**\n * Initialize the plugin with scope of application instance\n *\n * @static\n * @private\n * @param {object} [options] - See application options\n */\n TickerPlugin.init = function (options) {\n var _this = this;\n // Set default\n options = Object.assign({\n autoStart: true,\n sharedTicker: false,\n }, options);\n // Create ticker setter\n Object.defineProperty(this, 'ticker', {\n set: function (ticker) {\n if (this._ticker) {\n this._ticker.remove(this.render, this);\n }\n this._ticker = ticker;\n if (ticker) {\n ticker.add(this.render, this, UPDATE_PRIORITY.LOW);\n }\n },\n get: function () {\n return this._ticker;\n },\n });\n /**\n * Convenience method for stopping the render.\n *\n * @method PIXI.Application#stop\n */\n this.stop = function () {\n _this._ticker.stop();\n };\n /**\n * Convenience method for starting the render.\n *\n * @method PIXI.Application#start\n */\n this.start = function () {\n _this._ticker.start();\n };\n /**\n * Internal reference to the ticker.\n *\n * @type {PIXI.Ticker}\n * @name _ticker\n * @memberof PIXI.Application#\n * @private\n */\n this._ticker = null;\n /**\n * Ticker for doing render updates.\n *\n * @type {PIXI.Ticker}\n * @name ticker\n * @memberof PIXI.Application#\n * @default PIXI.Ticker.shared\n */\n this.ticker = options.sharedTicker ? Ticker.shared : new Ticker();\n // Start the rendering\n if (options.autoStart) {\n this.start();\n }\n };\n /**\n * Clean up the ticker, scoped to application.\n *\n * @static\n * @private\n */\n TickerPlugin.destroy = function () {\n if (this._ticker) {\n var oldTicker = this._ticker;\n this.ticker = null;\n oldTicker.destroy();\n }\n };\n return TickerPlugin;\n}());\n\n\n//# sourceMappingURL=ticker.es.js.map\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/@pixi/ticker/lib/ticker.es.js?"); /***/ }), /***/ "./node_modules/@pixi/utils/lib/utils.es.js": /*!**************************************************!*\ !*** ./node_modules/@pixi/utils/lib/utils.es.js ***! \**************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"BaseTextureCache\": () => (/* binding */ BaseTextureCache),\n/* harmony export */ \"CanvasRenderTarget\": () => (/* binding */ CanvasRenderTarget),\n/* harmony export */ \"DATA_URI\": () => (/* binding */ DATA_URI),\n/* harmony export */ \"EventEmitter\": () => (/* reexport default from dynamic */ eventemitter3__WEBPACK_IMPORTED_MODULE_1___default.a),\n/* harmony export */ \"ProgramCache\": () => (/* binding */ ProgramCache),\n/* harmony export */ \"TextureCache\": () => (/* binding */ TextureCache),\n/* harmony export */ \"clearTextureCache\": () => (/* binding */ clearTextureCache),\n/* harmony export */ \"correctBlendMode\": () => (/* binding */ correctBlendMode),\n/* harmony export */ \"createIndicesForQuads\": () => (/* binding */ createIndicesForQuads),\n/* harmony export */ \"decomposeDataUri\": () => (/* binding */ decomposeDataUri),\n/* harmony export */ \"deprecation\": () => (/* binding */ deprecation),\n/* harmony export */ \"destroyTextureCache\": () => (/* binding */ destroyTextureCache),\n/* harmony export */ \"determineCrossOrigin\": () => (/* binding */ determineCrossOrigin),\n/* harmony export */ \"earcut\": () => (/* reexport default from dynamic */ earcut__WEBPACK_IMPORTED_MODULE_2___default.a),\n/* harmony export */ \"getBufferType\": () => (/* binding */ getBufferType),\n/* harmony export */ \"getResolutionOfUrl\": () => (/* binding */ getResolutionOfUrl),\n/* harmony export */ \"hex2rgb\": () => (/* binding */ hex2rgb),\n/* harmony export */ \"hex2string\": () => (/* binding */ hex2string),\n/* harmony export */ \"interleaveTypedArrays\": () => (/* binding */ interleaveTypedArrays),\n/* harmony export */ \"isMobile\": () => (/* reexport safe */ _pixi_settings__WEBPACK_IMPORTED_MODULE_0__.isMobile),\n/* harmony export */ \"isPow2\": () => (/* binding */ isPow2),\n/* harmony export */ \"isWebGLSupported\": () => (/* binding */ isWebGLSupported),\n/* harmony export */ \"log2\": () => (/* binding */ log2),\n/* harmony export */ \"nextPow2\": () => (/* binding */ nextPow2),\n/* harmony export */ \"premultiplyBlendMode\": () => (/* binding */ premultiplyBlendMode),\n/* harmony export */ \"premultiplyRgba\": () => (/* binding */ premultiplyRgba),\n/* harmony export */ \"premultiplyTint\": () => (/* binding */ premultiplyTint),\n/* harmony export */ \"premultiplyTintToRgba\": () => (/* binding */ premultiplyTintToRgba),\n/* harmony export */ \"removeItems\": () => (/* binding */ removeItems),\n/* harmony export */ \"rgb2hex\": () => (/* binding */ rgb2hex),\n/* harmony export */ \"sayHello\": () => (/* binding */ sayHello),\n/* harmony export */ \"sign\": () => (/* binding */ sign),\n/* harmony export */ \"skipHello\": () => (/* binding */ skipHello),\n/* harmony export */ \"string2hex\": () => (/* binding */ string2hex),\n/* harmony export */ \"trimCanvas\": () => (/* binding */ trimCanvas),\n/* harmony export */ \"uid\": () => (/* binding */ uid),\n/* harmony export */ \"url\": () => (/* reexport default from dynamic */ url__WEBPACK_IMPORTED_MODULE_3___default.a)\n/* harmony export */ });\n/* harmony import */ var _pixi_settings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @pixi/settings */ \"./node_modules/@pixi/settings/lib/settings.es.js\");\n/* harmony import */ var eventemitter3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! eventemitter3 */ \"./node_modules/eventemitter3/index.js\");\n/* harmony import */ var eventemitter3__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(eventemitter3__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var earcut__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! earcut */ \"./node_modules/earcut/src/earcut.js\");\n/* harmony import */ var earcut__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(earcut__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var url__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! url */ \"url\");\n/* harmony import */ var url__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(url__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _pixi_constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @pixi/constants */ \"./node_modules/@pixi/constants/lib/constants.es.js\");\n/*!\n * @pixi/utils - v5.3.11\n * Compiled Mon, 01 Nov 2021 16:10:12 UTC\n *\n * @pixi/utils is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n\n\n\n\n\n\n\n\n/**\n * The prefix that denotes a URL is for a retina asset.\n *\n * @static\n * @name RETINA_PREFIX\n * @memberof PIXI.settings\n * @type {RegExp}\n * @default /@([0-9\\.]+)x/\n * @example `@2x`\n */\n_pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.RETINA_PREFIX = /@([0-9\\.]+)x/;\n/**\n * Should the `failIfMajorPerformanceCaveat` flag be enabled as a context option used in the `isWebGLSupported` function.\n * For most scenarios this should be left as true, as otherwise the user may have a poor experience.\n * However, it can be useful to disable under certain scenarios, such as headless unit tests.\n *\n * @static\n * @name FAIL_IF_MAJOR_PERFORMANCE_CAVEAT\n * @memberof PIXI.settings\n * @type {boolean}\n * @default true\n */\n_pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT = true;\n\nvar saidHello = false;\nvar VERSION = '5.3.11';\n/**\n * Skips the hello message of renderers that are created after this is run.\n *\n * @function skipHello\n * @memberof PIXI.utils\n */\nfunction skipHello() {\n saidHello = true;\n}\n/**\n * Logs out the version and renderer information for this running instance of PIXI.\n * If you don't want to see this message you can run `PIXI.utils.skipHello()` before\n * creating your renderer. Keep in mind that doing that will forever make you a jerk face.\n *\n * @static\n * @function sayHello\n * @memberof PIXI.utils\n * @param {string} type - The string renderer type to log.\n */\nfunction sayHello(type) {\n var _a;\n if (saidHello) {\n return;\n }\n if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) {\n var args = [\n \"\\n %c %c %c PixiJS \" + VERSION + \" - \\u2730 \" + type + \" \\u2730 %c %c http://www.pixijs.com/ %c %c \\u2665%c\\u2665%c\\u2665 \\n\\n\",\n 'background: #ff66a5; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'color: #ff66a5; background: #030307; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'background: #ffc3dc; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;' ];\n (_a = window.console).log.apply(_a, args);\n }\n else if (window.console) {\n window.console.log(\"PixiJS \" + VERSION + \" - \" + type + \" - http://www.pixijs.com/\");\n }\n saidHello = true;\n}\n\nvar supported;\n/**\n * Helper for checking for WebGL support.\n *\n * @memberof PIXI.utils\n * @function isWebGLSupported\n * @return {boolean} Is WebGL supported.\n */\nfunction isWebGLSupported() {\n if (typeof supported === 'undefined') {\n supported = (function supported() {\n var contextOptions = {\n stencil: true,\n failIfMajorPerformanceCaveat: _pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT,\n };\n try {\n if (!window.WebGLRenderingContext) {\n return false;\n }\n var canvas = document.createElement('canvas');\n var gl = (canvas.getContext('webgl', contextOptions)\n || canvas.getContext('experimental-webgl', contextOptions));\n var success = !!(gl && gl.getContextAttributes().stencil);\n if (gl) {\n var loseContext = gl.getExtension('WEBGL_lose_context');\n if (loseContext) {\n loseContext.loseContext();\n }\n }\n gl = null;\n return success;\n }\n catch (e) {\n return false;\n }\n })();\n }\n return supported;\n}\n\n/**\n * Converts a hexadecimal color number to an [R, G, B] array of normalized floats (numbers from 0.0 to 1.0).\n *\n * @example\n * PIXI.utils.hex2rgb(0xffffff); // returns [1, 1, 1]\n * @memberof PIXI.utils\n * @function hex2rgb\n * @param {number} hex - The hexadecimal number to convert\n * @param {number[]} [out=[]] - If supplied, this array will be used rather than returning a new one\n * @return {number[]} An array representing the [R, G, B] of the color where all values are floats.\n */\nfunction hex2rgb(hex, out) {\n if (out === void 0) { out = []; }\n out[0] = ((hex >> 16) & 0xFF) / 255;\n out[1] = ((hex >> 8) & 0xFF) / 255;\n out[2] = (hex & 0xFF) / 255;\n return out;\n}\n/**\n * Converts a hexadecimal color number to a string.\n *\n * @example\n * PIXI.utils.hex2string(0xffffff); // returns \"#ffffff\"\n * @memberof PIXI.utils\n * @function hex2string\n * @param {number} hex - Number in hex (e.g., `0xffffff`)\n * @return {string} The string color (e.g., `\"#ffffff\"`).\n */\nfunction hex2string(hex) {\n var hexString = hex.toString(16);\n hexString = '000000'.substr(0, 6 - hexString.length) + hexString;\n return \"#\" + hexString;\n}\n/**\n * Converts a hexadecimal string to a hexadecimal color number.\n *\n * @example\n * PIXI.utils.string2hex(\"#ffffff\"); // returns 0xffffff\n * @memberof PIXI.utils\n * @function string2hex\n * @param {string} string - The string color (e.g., `\"#ffffff\"`)\n * @return {number} Number in hexadecimal.\n */\nfunction string2hex(string) {\n if (typeof string === 'string' && string[0] === '#') {\n string = string.substr(1);\n }\n return parseInt(string, 16);\n}\n/**\n * Converts a color as an [R, G, B] array of normalized floats to a hexadecimal number.\n *\n * @example\n * PIXI.utils.rgb2hex([1, 1, 1]); // returns 0xffffff\n * @memberof PIXI.utils\n * @function rgb2hex\n * @param {number[]} rgb - Array of numbers where all values are normalized floats from 0.0 to 1.0.\n * @return {number} Number in hexadecimal.\n */\nfunction rgb2hex(rgb) {\n return (((rgb[0] * 255) << 16) + ((rgb[1] * 255) << 8) + (rgb[2] * 255 | 0));\n}\n\n/**\n * Corrects PixiJS blend, takes premultiplied alpha into account\n *\n * @memberof PIXI.utils\n * @function mapPremultipliedBlendModes\n * @private\n * @return {Array} Mapped modes.\n */\nfunction mapPremultipliedBlendModes() {\n var pm = [];\n var npm = [];\n for (var i = 0; i < 32; i++) {\n pm[i] = i;\n npm[i] = i;\n }\n pm[_pixi_constants__WEBPACK_IMPORTED_MODULE_4__.BLEND_MODES.NORMAL_NPM] = _pixi_constants__WEBPACK_IMPORTED_MODULE_4__.BLEND_MODES.NORMAL;\n pm[_pixi_constants__WEBPACK_IMPORTED_MODULE_4__.BLEND_MODES.ADD_NPM] = _pixi_constants__WEBPACK_IMPORTED_MODULE_4__.BLEND_MODES.ADD;\n pm[_pixi_constants__WEBPACK_IMPORTED_MODULE_4__.BLEND_MODES.SCREEN_NPM] = _pixi_constants__WEBPACK_IMPORTED_MODULE_4__.BLEND_MODES.SCREEN;\n npm[_pixi_constants__WEBPACK_IMPORTED_MODULE_4__.BLEND_MODES.NORMAL] = _pixi_constants__WEBPACK_IMPORTED_MODULE_4__.BLEND_MODES.NORMAL_NPM;\n npm[_pixi_constants__WEBPACK_IMPORTED_MODULE_4__.BLEND_MODES.ADD] = _pixi_constants__WEBPACK_IMPORTED_MODULE_4__.BLEND_MODES.ADD_NPM;\n npm[_pixi_constants__WEBPACK_IMPORTED_MODULE_4__.BLEND_MODES.SCREEN] = _pixi_constants__WEBPACK_IMPORTED_MODULE_4__.BLEND_MODES.SCREEN_NPM;\n var array = [];\n array.push(npm);\n array.push(pm);\n return array;\n}\n/**\n * maps premultiply flag and blendMode to adjusted blendMode\n * @memberof PIXI.utils\n * @const premultiplyBlendMode\n * @type {Array}\n */\nvar premultiplyBlendMode = mapPremultipliedBlendModes();\n/**\n * changes blendMode according to texture format\n *\n * @memberof PIXI.utils\n * @function correctBlendMode\n * @param {number} blendMode - supposed blend mode\n * @param {boolean} premultiplied - whether source is premultiplied\n * @returns {number} true blend mode for this texture\n */\nfunction correctBlendMode(blendMode, premultiplied) {\n return premultiplyBlendMode[premultiplied ? 1 : 0][blendMode];\n}\n/**\n * combines rgb and alpha to out array\n *\n * @memberof PIXI.utils\n * @function premultiplyRgba\n * @param {Float32Array|number[]} rgb - input rgb\n * @param {number} alpha - alpha param\n * @param {Float32Array} [out] - output\n * @param {boolean} [premultiply=true] - do premultiply it\n * @returns {Float32Array} vec4 rgba\n */\nfunction premultiplyRgba(rgb, alpha, out, premultiply) {\n out = out || new Float32Array(4);\n if (premultiply || premultiply === undefined) {\n out[0] = rgb[0] * alpha;\n out[1] = rgb[1] * alpha;\n out[2] = rgb[2] * alpha;\n }\n else {\n out[0] = rgb[0];\n out[1] = rgb[1];\n out[2] = rgb[2];\n }\n out[3] = alpha;\n return out;\n}\n/**\n * premultiplies tint\n *\n * @memberof PIXI.utils\n * @function premultiplyTint\n * @param {number} tint - integer RGB\n * @param {number} alpha - floating point alpha (0.0-1.0)\n * @returns {number} tint multiplied by alpha\n */\nfunction premultiplyTint(tint, alpha) {\n if (alpha === 1.0) {\n return (alpha * 255 << 24) + tint;\n }\n if (alpha === 0.0) {\n return 0;\n }\n var R = ((tint >> 16) & 0xFF);\n var G = ((tint >> 8) & 0xFF);\n var B = (tint & 0xFF);\n R = ((R * alpha) + 0.5) | 0;\n G = ((G * alpha) + 0.5) | 0;\n B = ((B * alpha) + 0.5) | 0;\n return (alpha * 255 << 24) + (R << 16) + (G << 8) + B;\n}\n/**\n * converts integer tint and float alpha to vec4 form, premultiplies by default\n *\n * @memberof PIXI.utils\n * @function premultiplyTintToRgba\n * @param {number} tint - input tint\n * @param {number} alpha - alpha param\n * @param {Float32Array} [out] output\n * @param {boolean} [premultiply=true] - do premultiply it\n * @returns {Float32Array} vec4 rgba\n */\nfunction premultiplyTintToRgba(tint, alpha, out, premultiply) {\n out = out || new Float32Array(4);\n out[0] = ((tint >> 16) & 0xFF) / 255.0;\n out[1] = ((tint >> 8) & 0xFF) / 255.0;\n out[2] = (tint & 0xFF) / 255.0;\n if (premultiply || premultiply === undefined) {\n out[0] *= alpha;\n out[1] *= alpha;\n out[2] *= alpha;\n }\n out[3] = alpha;\n return out;\n}\n\n/**\n * Generic Mask Stack data structure\n *\n * @memberof PIXI.utils\n * @function createIndicesForQuads\n * @param {number} size - Number of quads\n * @param {Uint16Array|Uint32Array} [outBuffer] - Buffer for output, length has to be `6 * size`\n * @return {Uint16Array|Uint32Array} - Resulting index buffer\n */\nfunction createIndicesForQuads(size, outBuffer) {\n if (outBuffer === void 0) { outBuffer = null; }\n // the total number of indices in our array, there are 6 points per quad.\n var totalIndices = size * 6;\n outBuffer = outBuffer || new Uint16Array(totalIndices);\n if (outBuffer.length !== totalIndices) {\n throw new Error(\"Out buffer length is incorrect, got \" + outBuffer.length + \" and expected \" + totalIndices);\n }\n // fill the indices with the quads to draw\n for (var i = 0, j = 0; i < totalIndices; i += 6, j += 4) {\n outBuffer[i + 0] = j + 0;\n outBuffer[i + 1] = j + 1;\n outBuffer[i + 2] = j + 2;\n outBuffer[i + 3] = j + 0;\n outBuffer[i + 4] = j + 2;\n outBuffer[i + 5] = j + 3;\n }\n return outBuffer;\n}\n\nfunction getBufferType(array) {\n if (array.BYTES_PER_ELEMENT === 4) {\n if (array instanceof Float32Array) {\n return 'Float32Array';\n }\n else if (array instanceof Uint32Array) {\n return 'Uint32Array';\n }\n return 'Int32Array';\n }\n else if (array.BYTES_PER_ELEMENT === 2) {\n if (array instanceof Uint16Array) {\n return 'Uint16Array';\n }\n }\n else if (array.BYTES_PER_ELEMENT === 1) {\n if (array instanceof Uint8Array) {\n return 'Uint8Array';\n }\n }\n // TODO map out the rest of the array elements!\n return null;\n}\n\n/* eslint-disable object-shorthand */\nvar map = { Float32Array: Float32Array, Uint32Array: Uint32Array, Int32Array: Int32Array, Uint8Array: Uint8Array };\nfunction interleaveTypedArrays(arrays, sizes) {\n var outSize = 0;\n var stride = 0;\n var views = {};\n for (var i = 0; i < arrays.length; i++) {\n stride += sizes[i];\n outSize += arrays[i].length;\n }\n var buffer = new ArrayBuffer(outSize * 4);\n var out = null;\n var littleOffset = 0;\n for (var i = 0; i < arrays.length; i++) {\n var size = sizes[i];\n var array = arrays[i];\n /*\n @todo This is unsafe casting but consistent with how the code worked previously. Should it stay this way\n or should and `getBufferTypeUnsafe` function be exposed that throws an Error if unsupported type is passed?\n */\n var type = getBufferType(array);\n if (!views[type]) {\n views[type] = new map[type](buffer);\n }\n out = views[type];\n for (var j = 0; j < array.length; j++) {\n var indexStart = ((j / size | 0) * stride) + littleOffset;\n var index = j % size;\n out[indexStart + index] = array[j];\n }\n littleOffset += size;\n }\n return new Float32Array(buffer);\n}\n\n// Taken from the bit-twiddle package\n/**\n * Rounds to next power of two.\n *\n * @function nextPow2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @return {number}\n */\nfunction nextPow2(v) {\n v += v === 0 ? 1 : 0;\n --v;\n v |= v >>> 1;\n v |= v >>> 2;\n v |= v >>> 4;\n v |= v >>> 8;\n v |= v >>> 16;\n return v + 1;\n}\n/**\n * Checks if a number is a power of two.\n *\n * @function isPow2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @return {boolean} `true` if value is power of two\n */\nfunction isPow2(v) {\n return !(v & (v - 1)) && (!!v);\n}\n/**\n * Computes ceil of log base 2\n *\n * @function log2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @return {number} logarithm base 2\n */\nfunction log2(v) {\n var r = (v > 0xFFFF ? 1 : 0) << 4;\n v >>>= r;\n var shift = (v > 0xFF ? 1 : 0) << 3;\n v >>>= shift;\n r |= shift;\n shift = (v > 0xF ? 1 : 0) << 2;\n v >>>= shift;\n r |= shift;\n shift = (v > 0x3 ? 1 : 0) << 1;\n v >>>= shift;\n r |= shift;\n return r | (v >> 1);\n}\n\n/**\n * Remove items from a javascript array without generating garbage\n *\n * @function removeItems\n * @memberof PIXI.utils\n * @param {Array} arr - Array to remove elements from\n * @param {number} startIdx - starting index\n * @param {number} removeCount - how many to remove\n */\nfunction removeItems(arr, startIdx, removeCount) {\n var length = arr.length;\n var i;\n if (startIdx >= length || removeCount === 0) {\n return;\n }\n removeCount = (startIdx + removeCount > length ? length - startIdx : removeCount);\n var len = length - removeCount;\n for (i = startIdx; i < len; ++i) {\n arr[i] = arr[i + removeCount];\n }\n arr.length = len;\n}\n\n/**\n * Returns sign of number\n *\n * @memberof PIXI.utils\n * @function sign\n * @param {number} n - the number to check the sign of\n * @returns {number} 0 if `n` is 0, -1 if `n` is negative, 1 if `n` is positive\n */\nfunction sign(n) {\n if (n === 0)\n { return 0; }\n return n < 0 ? -1 : 1;\n}\n\nvar nextUid = 0;\n/**\n * Gets the next unique identifier\n *\n * @memberof PIXI.utils\n * @function uid\n * @return {number} The next unique identifier to use.\n */\nfunction uid() {\n return ++nextUid;\n}\n\n// A map of warning messages already fired\nvar warnings = {};\n/**\n * Helper for warning developers about deprecated features & settings.\n * A stack track for warnings is given; useful for tracking-down where\n * deprecated methods/properties/classes are being used within the code.\n *\n * @memberof PIXI.utils\n * @function deprecation\n * @param {string} version - The version where the feature became deprecated\n * @param {string} message - Message should include what is deprecated, where, and the new solution\n * @param {number} [ignoreDepth=3] - The number of steps to ignore at the top of the error stack\n * this is mostly to ignore internal deprecation calls.\n */\nfunction deprecation(version, message, ignoreDepth) {\n if (ignoreDepth === void 0) { ignoreDepth = 3; }\n // Ignore duplicat\n if (warnings[message]) {\n return;\n }\n /* eslint-disable no-console */\n var stack = new Error().stack;\n // Handle IE < 10 and Safari < 6\n if (typeof stack === 'undefined') {\n console.warn('PixiJS Deprecation Warning: ', message + \"\\nDeprecated since v\" + version);\n }\n else {\n // chop off the stack trace which includes PixiJS internal calls\n stack = stack.split('\\n').splice(ignoreDepth).join('\\n');\n if (console.groupCollapsed) {\n console.groupCollapsed('%cPixiJS Deprecation Warning: %c%s', 'color:#614108;background:#fffbe6', 'font-weight:normal;color:#614108;background:#fffbe6', message + \"\\nDeprecated since v\" + version);\n console.warn(stack);\n console.groupEnd();\n }\n else {\n console.warn('PixiJS Deprecation Warning: ', message + \"\\nDeprecated since v\" + version);\n console.warn(stack);\n }\n }\n /* eslint-enable no-console */\n warnings[message] = true;\n}\n\n/**\n * @todo Describe property usage\n *\n * @static\n * @name ProgramCache\n * @memberof PIXI.utils\n * @type {Object}\n */\nvar ProgramCache = {};\n/**\n * @todo Describe property usage\n *\n * @static\n * @name TextureCache\n * @memberof PIXI.utils\n * @type {Object}\n */\nvar TextureCache = Object.create(null);\n/**\n * @todo Describe property usage\n *\n * @static\n * @name BaseTextureCache\n * @memberof PIXI.utils\n * @type {Object}\n */\nvar BaseTextureCache = Object.create(null);\n/**\n * Destroys all texture in the cache\n *\n * @memberof PIXI.utils\n * @function destroyTextureCache\n */\nfunction destroyTextureCache() {\n var key;\n for (key in TextureCache) {\n TextureCache[key].destroy();\n }\n for (key in BaseTextureCache) {\n BaseTextureCache[key].destroy();\n }\n}\n/**\n * Removes all textures from cache, but does not destroy them\n *\n * @memberof PIXI.utils\n * @function clearTextureCache\n */\nfunction clearTextureCache() {\n var key;\n for (key in TextureCache) {\n delete TextureCache[key];\n }\n for (key in BaseTextureCache) {\n delete BaseTextureCache[key];\n }\n}\n\n/**\n * Creates a Canvas element of the given size to be used as a target for rendering to.\n *\n * @class\n * @memberof PIXI.utils\n */\nvar CanvasRenderTarget = /** @class */ (function () {\n /**\n * @param {number} width - the width for the newly created canvas\n * @param {number} height - the height for the newly created canvas\n * @param {number} [resolution=1] - The resolution / device pixel ratio of the canvas\n */\n function CanvasRenderTarget(width, height, resolution) {\n /**\n * The Canvas object that belongs to this CanvasRenderTarget.\n *\n * @member {HTMLCanvasElement}\n */\n this.canvas = document.createElement('canvas');\n /**\n * A CanvasRenderingContext2D object representing a two-dimensional rendering context.\n *\n * @member {CanvasRenderingContext2D}\n */\n this.context = this.canvas.getContext('2d');\n this.resolution = resolution || _pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.RESOLUTION;\n this.resize(width, height);\n }\n /**\n * Clears the canvas that was created by the CanvasRenderTarget class.\n *\n * @private\n */\n CanvasRenderTarget.prototype.clear = function () {\n this.context.setTransform(1, 0, 0, 1, 0, 0);\n this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n };\n /**\n * Resizes the canvas to the specified width and height.\n *\n * @param {number} width - the new width of the canvas\n * @param {number} height - the new height of the canvas\n */\n CanvasRenderTarget.prototype.resize = function (width, height) {\n this.canvas.width = width * this.resolution;\n this.canvas.height = height * this.resolution;\n };\n /**\n * Destroys this canvas.\n *\n */\n CanvasRenderTarget.prototype.destroy = function () {\n this.context = null;\n this.canvas = null;\n };\n Object.defineProperty(CanvasRenderTarget.prototype, \"width\", {\n /**\n * The width of the canvas buffer in pixels.\n *\n * @member {number}\n */\n get: function () {\n return this.canvas.width;\n },\n set: function (val) {\n this.canvas.width = val;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(CanvasRenderTarget.prototype, \"height\", {\n /**\n * The height of the canvas buffer in pixels.\n *\n * @member {number}\n */\n get: function () {\n return this.canvas.height;\n },\n set: function (val) {\n this.canvas.height = val;\n },\n enumerable: false,\n configurable: true\n });\n return CanvasRenderTarget;\n}());\n\n/**\n * Trim transparent borders from a canvas\n *\n * @memberof PIXI.utils\n * @function trimCanvas\n * @param {HTMLCanvasElement} canvas - the canvas to trim\n * @returns {object} Trim data\n */\nfunction trimCanvas(canvas) {\n // https://gist.github.com/remy/784508\n var width = canvas.width;\n var height = canvas.height;\n var context = canvas.getContext('2d');\n var imageData = context.getImageData(0, 0, width, height);\n var pixels = imageData.data;\n var len = pixels.length;\n var bound = {\n top: null,\n left: null,\n right: null,\n bottom: null,\n };\n var data = null;\n var i;\n var x;\n var y;\n for (i = 0; i < len; i += 4) {\n if (pixels[i + 3] !== 0) {\n x = (i / 4) % width;\n y = ~~((i / 4) / width);\n if (bound.top === null) {\n bound.top = y;\n }\n if (bound.left === null) {\n bound.left = x;\n }\n else if (x < bound.left) {\n bound.left = x;\n }\n if (bound.right === null) {\n bound.right = x + 1;\n }\n else if (bound.right < x) {\n bound.right = x + 1;\n }\n if (bound.bottom === null) {\n bound.bottom = y;\n }\n else if (bound.bottom < y) {\n bound.bottom = y;\n }\n }\n }\n if (bound.top !== null) {\n width = bound.right - bound.left;\n height = bound.bottom - bound.top + 1;\n data = context.getImageData(bound.left, bound.top, width, height);\n }\n return {\n height: height,\n width: width,\n data: data,\n };\n}\n\n/**\n * Regexp for data URI.\n * Based on: {@link https://github.com/ragingwind/data-uri-regex}\n *\n * @static\n * @constant {RegExp|string} DATA_URI\n * @memberof PIXI\n * @example data:image/png;base64\n */\nvar DATA_URI = /^\\s*data:(?:([\\w-]+)\\/([\\w+.-]+))?(?:;charset=([\\w-]+))?(?:;(base64))?,(.*)/i;\n\n/**\n * @memberof PIXI.utils\n * @interface DecomposedDataUri\n */\n/**\n * type, eg. `image`\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} mediaType\n */\n/**\n * Sub type, eg. `png`\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} subType\n */\n/**\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} charset\n */\n/**\n * Data encoding, eg. `base64`\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} encoding\n */\n/**\n * The actual data\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} data\n */\n/**\n * Split a data URI into components. Returns undefined if\n * parameter `dataUri` is not a valid data URI.\n *\n * @memberof PIXI.utils\n * @function decomposeDataUri\n * @param {string} dataUri - the data URI to check\n * @return {PIXI.utils.DecomposedDataUri|undefined} The decomposed data uri or undefined\n */\nfunction decomposeDataUri(dataUri) {\n var dataUriMatch = DATA_URI.exec(dataUri);\n if (dataUriMatch) {\n return {\n mediaType: dataUriMatch[1] ? dataUriMatch[1].toLowerCase() : undefined,\n subType: dataUriMatch[2] ? dataUriMatch[2].toLowerCase() : undefined,\n charset: dataUriMatch[3] ? dataUriMatch[3].toLowerCase() : undefined,\n encoding: dataUriMatch[4] ? dataUriMatch[4].toLowerCase() : undefined,\n data: dataUriMatch[5],\n };\n }\n return undefined;\n}\n\nvar tempAnchor;\n/**\n * Sets the `crossOrigin` property for this resource based on if the url\n * for this resource is cross-origin. If crossOrigin was manually set, this\n * function does nothing.\n * Nipped from the resource loader!\n *\n * @ignore\n * @param {string} url - The url to test.\n * @param {object} [loc=window.location] - The location object to test against.\n * @return {string} The crossOrigin value to use (or empty string for none).\n */\nfunction determineCrossOrigin(url, loc) {\n if (loc === void 0) { loc = window.location; }\n // data: and javascript: urls are considered same-origin\n if (url.indexOf('data:') === 0) {\n return '';\n }\n // default is window.location\n loc = loc || window.location;\n if (!tempAnchor) {\n tempAnchor = document.createElement('a');\n }\n // let the browser determine the full href for the url of this resource and then\n // parse with the node url lib, we can't use the properties of the anchor element\n // because they don't work in IE9 :(\n tempAnchor.href = url;\n var parsedUrl = (0,url__WEBPACK_IMPORTED_MODULE_3__.parse)(tempAnchor.href);\n var samePort = (!parsedUrl.port && loc.port === '') || (parsedUrl.port === loc.port);\n // if cross origin\n if (parsedUrl.hostname !== loc.hostname || !samePort || parsedUrl.protocol !== loc.protocol) {\n return 'anonymous';\n }\n return '';\n}\n\n/**\n * get the resolution / device pixel ratio of an asset by looking for the prefix\n * used by spritesheets and image urls\n *\n * @memberof PIXI.utils\n * @function getResolutionOfUrl\n * @param {string} url - the image path\n * @param {number} [defaultValue=1] - the defaultValue if no filename prefix is set.\n * @return {number} resolution / device pixel ratio of an asset\n */\nfunction getResolutionOfUrl(url, defaultValue) {\n var resolution = _pixi_settings__WEBPACK_IMPORTED_MODULE_0__.settings.RETINA_PREFIX.exec(url);\n if (resolution) {\n return parseFloat(resolution[1]);\n }\n return defaultValue !== undefined ? defaultValue : 1;\n}\n\n/**\n * Generalized convenience utilities for PIXI.\n * @example\n * // Extend PIXI's internal Event Emitter.\n * class MyEmitter extends PIXI.utils.EventEmitter {\n * constructor() {\n * super();\n * console.log(\"Emitter created!\");\n * }\n * }\n *\n * // Get info on current device\n * console.log(PIXI.utils.isMobile);\n *\n * // Convert hex color to string\n * console.log(PIXI.utils.hex2string(0xff00ff)); // returns: \"#ff00ff\"\n * @namespace PIXI.utils\n */\n\n\n//# sourceMappingURL=utils.es.js.map\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/@pixi/utils/lib/utils.es.js?"); /***/ }), /***/ "./node_modules/earcut/src/earcut.js": /*!*******************************************!*\ !*** ./node_modules/earcut/src/earcut.js ***! \*******************************************/ /***/ ((module) => { "use strict"; eval("\n\nmodule.exports = earcut;\nmodule.exports[\"default\"] = earcut;\n\nfunction earcut(data, holeIndices, dim) {\n\n dim = dim || 2;\n\n var hasHoles = holeIndices && holeIndices.length,\n outerLen = hasHoles ? holeIndices[0] * dim : data.length,\n outerNode = linkedList(data, 0, outerLen, dim, true),\n triangles = [];\n\n if (!outerNode || outerNode.next === outerNode.prev) return triangles;\n\n var minX, minY, maxX, maxY, x, y, invSize;\n\n if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);\n\n // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n if (data.length > 80 * dim) {\n minX = maxX = data[0];\n minY = maxY = data[1];\n\n for (var i = dim; i < outerLen; i += dim) {\n x = data[i];\n y = data[i + 1];\n if (x < minX) minX = x;\n if (y < minY) minY = y;\n if (x > maxX) maxX = x;\n if (y > maxY) maxY = y;\n }\n\n // minX, minY and invSize are later used to transform coords into integers for z-order calculation\n invSize = Math.max(maxX - minX, maxY - minY);\n invSize = invSize !== 0 ? 1 / invSize : 0;\n }\n\n earcutLinked(outerNode, triangles, dim, minX, minY, invSize);\n\n return triangles;\n}\n\n// create a circular doubly linked list from polygon points in the specified winding order\nfunction linkedList(data, start, end, dim, clockwise) {\n var i, last;\n\n if (clockwise === (signedArea(data, start, end, dim) > 0)) {\n for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last);\n } else {\n for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last);\n }\n\n if (last && equals(last, last.next)) {\n removeNode(last);\n last = last.next;\n }\n\n return last;\n}\n\n// eliminate colinear or duplicate points\nfunction filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) break;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}\n\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {\n if (!ear) return;\n\n // interlink polygon nodes in z-order\n if (!pass && invSize) indexCurve(ear, minX, minY, invSize);\n\n var stop = ear,\n prev, next;\n\n // iterate through ears, slicing them one by one\n while (ear.prev !== ear.next) {\n prev = ear.prev;\n next = ear.next;\n\n if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {\n // cut off the triangle\n triangles.push(prev.i / dim);\n triangles.push(ear.i / dim);\n triangles.push(next.i / dim);\n\n removeNode(ear);\n\n // skipping the next vertex leads to less sliver triangles\n ear = next.next;\n stop = next.next;\n\n continue;\n }\n\n ear = next;\n\n // if we looped through the whole remaining polygon and can't find any more ears\n if (ear === stop) {\n // try filtering points and slicing again\n if (!pass) {\n earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);\n\n // if this didn't work, try curing all small self-intersections locally\n } else if (pass === 1) {\n ear = cureLocalIntersections(filterPoints(ear), triangles, dim);\n earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);\n\n // as a last resort, try splitting the remaining polygon into two\n } else if (pass === 2) {\n splitEarcut(ear, triangles, dim, minX, minY, invSize);\n }\n\n break;\n }\n }\n}\n\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction isEar(ear) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // now make sure we don't have other points inside the potential ear\n var p = ear.next.next;\n\n while (p !== ear.prev) {\n if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.next;\n }\n\n return true;\n}\n\nfunction isEarHashed(ear, minX, minY, invSize) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // triangle bbox; min & max are calculated like this for speed\n var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x),\n minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y),\n maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x),\n maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y);\n\n // z-order range for the current triangle bbox;\n var minZ = zOrder(minTX, minTY, minX, minY, invSize),\n maxZ = zOrder(maxTX, maxTY, minX, minY, invSize);\n\n var p = ear.prevZ,\n n = ear.nextZ;\n\n // look for points inside the triangle in both directions\n while (p && p.z >= minZ && n && n.z <= maxZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n\n if (n !== ear.prev && n !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) &&\n area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n // look for remaining points in decreasing z-order\n while (p && p.z >= minZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n }\n\n // look for remaining points in increasing z-order\n while (n && n.z <= maxZ) {\n if (n !== ear.prev && n !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) &&\n area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n return true;\n}\n\n// go through all polygon nodes and cure small local self-intersections\nfunction cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n\n if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i / dim);\n triangles.push(p.i / dim);\n triangles.push(b.i / dim);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return filterPoints(p);\n}\n\n// try splitting polygon into two and triangulate them independently\nfunction splitEarcut(start, triangles, dim, minX, minY, invSize) {\n // look for a valid diagonal that divides the polygon into two\n var a = start;\n do {\n var b = a.next.next;\n while (b !== a.prev) {\n if (a.i !== b.i && isValidDiagonal(a, b)) {\n // split the polygon in two by the diagonal\n var c = splitPolygon(a, b);\n\n // filter colinear points around the cuts\n a = filterPoints(a, a.next);\n c = filterPoints(c, c.next);\n\n // run earcut on each half\n earcutLinked(a, triangles, dim, minX, minY, invSize);\n earcutLinked(c, triangles, dim, minX, minY, invSize);\n return;\n }\n b = b.next;\n }\n a = a.next;\n } while (a !== start);\n}\n\n// link every hole into the outer loop, producing a single-ring polygon without holes\nfunction eliminateHoles(data, holeIndices, outerNode, dim) {\n var queue = [],\n i, len, start, end, list;\n\n for (i = 0, len = holeIndices.length; i < len; i++) {\n start = holeIndices[i] * dim;\n end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n list = linkedList(data, start, end, dim, false);\n if (list === list.next) list.steiner = true;\n queue.push(getLeftmost(list));\n }\n\n queue.sort(compareX);\n\n // process holes from left to right\n for (i = 0; i < queue.length; i++) {\n outerNode = eliminateHole(queue[i], outerNode);\n outerNode = filterPoints(outerNode, outerNode.next);\n }\n\n return outerNode;\n}\n\nfunction compareX(a, b) {\n return a.x - b.x;\n}\n\n// find a bridge between vertices that connects hole with an outer ring and and link it\nfunction eliminateHole(hole, outerNode) {\n var bridge = findHoleBridge(hole, outerNode);\n if (!bridge) {\n return outerNode;\n }\n\n var bridgeReverse = splitPolygon(bridge, hole);\n\n // filter collinear points around the cuts\n var filteredBridge = filterPoints(bridge, bridge.next);\n filterPoints(bridgeReverse, bridgeReverse.next);\n\n // Check if input node was removed by the filtering\n return outerNode === bridge ? filteredBridge : outerNode;\n}\n\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction findHoleBridge(hole, outerNode) {\n var p = outerNode,\n hx = hole.x,\n hy = hole.y,\n qx = -Infinity,\n m;\n\n // find a segment intersected by a ray from the hole's leftmost point to the left;\n // segment's endpoint with lesser x will be potential connection point\n do {\n if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {\n var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);\n if (x <= hx && x > qx) {\n qx = x;\n if (x === hx) {\n if (hy === p.y) return p;\n if (hy === p.next.y) return p.next;\n }\n m = p.x < p.next.x ? p : p.next;\n }\n }\n p = p.next;\n } while (p !== outerNode);\n\n if (!m) return null;\n\n if (hx === qx) return m; // hole touches outer segment; pick leftmost endpoint\n\n // look for points inside the triangle of hole point, segment intersection and endpoint;\n // if there are no points found, we have a valid connection;\n // otherwise choose the point of the minimum angle with the ray as connection point\n\n var stop = m,\n mx = m.x,\n my = m.y,\n tanMin = Infinity,\n tan;\n\n p = m;\n\n do {\n if (hx >= p.x && p.x >= mx && hx !== p.x &&\n pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {\n\n tan = Math.abs(hy - p.y) / (hx - p.x); // tangential\n\n if (locallyInside(p, hole) &&\n (tan < tanMin || (tan === tanMin && (p.x > m.x || (p.x === m.x && sectorContainsSector(m, p)))))) {\n m = p;\n tanMin = tan;\n }\n }\n\n p = p.next;\n } while (p !== stop);\n\n return m;\n}\n\n// whether sector in vertex m contains sector in vertex p in the same coordinates\nfunction sectorContainsSector(m, p) {\n return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;\n}\n\n// interlink polygon nodes in z-order\nfunction indexCurve(start, minX, minY, invSize) {\n var p = start;\n do {\n if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, invSize);\n p.prevZ = p.prev;\n p.nextZ = p.next;\n p = p.next;\n } while (p !== start);\n\n p.prevZ.nextZ = null;\n p.prevZ = null;\n\n sortLinked(p);\n}\n\n// Simon Tatham's linked list merge sort algorithm\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\nfunction sortLinked(list) {\n var i, p, q, e, tail, numMerges, pSize, qSize,\n inSize = 1;\n\n do {\n p = list;\n list = null;\n tail = null;\n numMerges = 0;\n\n while (p) {\n numMerges++;\n q = p;\n pSize = 0;\n for (i = 0; i < inSize; i++) {\n pSize++;\n q = q.nextZ;\n if (!q) break;\n }\n qSize = inSize;\n\n while (pSize > 0 || (qSize > 0 && q)) {\n\n if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {\n e = p;\n p = p.nextZ;\n pSize--;\n } else {\n e = q;\n q = q.nextZ;\n qSize--;\n }\n\n if (tail) tail.nextZ = e;\n else list = e;\n\n e.prevZ = tail;\n tail = e;\n }\n\n p = q;\n }\n\n tail.nextZ = null;\n inSize *= 2;\n\n } while (numMerges > 1);\n\n return list;\n}\n\n// z-order of a point given coords and inverse of the longer side of data bbox\nfunction zOrder(x, y, minX, minY, invSize) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) * invSize;\n y = 32767 * (y - minY) * invSize;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}\n\n// find the leftmost node of a polygon ring\nfunction getLeftmost(start) {\n var p = start,\n leftmost = start;\n do {\n if (p.x < leftmost.x || (p.x === leftmost.x && p.y < leftmost.y)) leftmost = p;\n p = p.next;\n } while (p !== start);\n\n return leftmost;\n}\n\n// check if a point lies within a convex triangle\nfunction pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}\n\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction isValidDiagonal(a, b) {\n return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges\n (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible\n (area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors\n equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case\n}\n\n// signed area of a triangle\nfunction area(p, q, r) {\n return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);\n}\n\n// check if two points are equal\nfunction equals(p1, p2) {\n return p1.x === p2.x && p1.y === p2.y;\n}\n\n// check if two segments intersect\nfunction intersects(p1, q1, p2, q2) {\n var o1 = sign(area(p1, q1, p2));\n var o2 = sign(area(p1, q1, q2));\n var o3 = sign(area(p2, q2, p1));\n var o4 = sign(area(p2, q2, q1));\n\n if (o1 !== o2 && o3 !== o4) return true; // general case\n\n if (o1 === 0 && onSegment(p1, p2, q1)) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1\n if (o2 === 0 && onSegment(p1, q2, q1)) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1\n if (o3 === 0 && onSegment(p2, p1, q2)) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2\n if (o4 === 0 && onSegment(p2, q1, q2)) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2\n\n return false;\n}\n\n// for collinear points p, q, r, check if point q lies on segment pr\nfunction onSegment(p, q, r) {\n return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);\n}\n\nfunction sign(num) {\n return num > 0 ? 1 : num < 0 ? -1 : 0;\n}\n\n// check if a polygon diagonal intersects any polygon segments\nfunction intersectsPolygon(a, b) {\n var p = a;\n do {\n if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n intersects(p, p.next, a, b)) return true;\n p = p.next;\n } while (p !== a);\n\n return false;\n}\n\n// check if a polygon diagonal is locally inside the polygon\nfunction locallyInside(a, b) {\n return area(a.prev, a, a.next) < 0 ?\n area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 :\n area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;\n}\n\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y &&\n (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}\n\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\nfunction splitPolygon(a, b) {\n var a2 = new Node(a.i, a.x, a.y),\n b2 = new Node(b.i, b.x, b.y),\n an = a.next,\n bp = b.prev;\n\n a.next = b;\n b.prev = a;\n\n a2.next = an;\n an.prev = a2;\n\n b2.next = a2;\n a2.prev = b2;\n\n bp.next = b2;\n b2.prev = bp;\n\n return b2;\n}\n\n// create a node and optionally link it with previous one (in a circular doubly linked list)\nfunction insertNode(i, x, y, last) {\n var p = new Node(i, x, y);\n\n if (!last) {\n p.prev = p;\n p.next = p;\n\n } else {\n p.next = last.next;\n p.prev = last;\n last.next.prev = p;\n last.next = p;\n }\n return p;\n}\n\nfunction removeNode(p) {\n p.next.prev = p.prev;\n p.prev.next = p.next;\n\n if (p.prevZ) p.prevZ.nextZ = p.nextZ;\n if (p.nextZ) p.nextZ.prevZ = p.prevZ;\n}\n\nfunction Node(i, x, y) {\n // vertex index in coordinates array\n this.i = i;\n\n // vertex coordinates\n this.x = x;\n this.y = y;\n\n // previous and next vertex nodes in a polygon ring\n this.prev = null;\n this.next = null;\n\n // z-order curve value\n this.z = null;\n\n // previous and next nodes in z-order\n this.prevZ = null;\n this.nextZ = null;\n\n // indicates whether this is a steiner point\n this.steiner = false;\n}\n\n// return a percentage difference between the polygon area and its triangulation area;\n// used to verify correctness of triangulation\nearcut.deviation = function (data, holeIndices, dim, triangles) {\n var hasHoles = holeIndices && holeIndices.length;\n var outerLen = hasHoles ? holeIndices[0] * dim : data.length;\n\n var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim));\n if (hasHoles) {\n for (var i = 0, len = holeIndices.length; i < len; i++) {\n var start = holeIndices[i] * dim;\n var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n polygonArea -= Math.abs(signedArea(data, start, end, dim));\n }\n }\n\n var trianglesArea = 0;\n for (i = 0; i < triangles.length; i += 3) {\n var a = triangles[i] * dim;\n var b = triangles[i + 1] * dim;\n var c = triangles[i + 2] * dim;\n trianglesArea += Math.abs(\n (data[a] - data[c]) * (data[b + 1] - data[a + 1]) -\n (data[a] - data[b]) * (data[c + 1] - data[a + 1]));\n }\n\n return polygonArea === 0 && trianglesArea === 0 ? 0 :\n Math.abs((trianglesArea - polygonArea) / polygonArea);\n};\n\nfunction signedArea(data, start, end, dim) {\n var sum = 0;\n for (var i = start, j = end - dim; i < end; i += dim) {\n sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);\n j = i;\n }\n return sum;\n}\n\n// turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts\nearcut.flatten = function (data) {\n var dim = data[0][0].length,\n result = {vertices: [], holes: [], dimensions: dim},\n holeIndex = 0;\n\n for (var i = 0; i < data.length; i++) {\n for (var j = 0; j < data[i].length; j++) {\n for (var d = 0; d < dim; d++) result.vertices.push(data[i][j][d]);\n }\n if (i > 0) {\n holeIndex += data[i - 1].length;\n result.holes.push(holeIndex);\n }\n }\n return result;\n};\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/earcut/src/earcut.js?"); /***/ }), /***/ "./node_modules/es6-promise-polyfill/promise.js": /*!******************************************************!*\ !*** ./node_modules/es6-promise-polyfill/promise.js ***! \******************************************************/ /***/ (function(module, exports, __webpack_require__) { eval("var __WEBPACK_AMD_DEFINE_RESULT__;(function(global){\n\n//\n// Check for native Promise and it has correct interface\n//\n\nvar NativePromise = global['Promise'];\nvar nativePromiseSupported =\n NativePromise &&\n // Some of these methods are missing from\n // Firefox/Chrome experimental implementations\n 'resolve' in NativePromise &&\n 'reject' in NativePromise &&\n 'all' in NativePromise &&\n 'race' in NativePromise &&\n // Older version of the spec had a resolver object\n // as the arg rather than a function\n (function(){\n var resolve;\n new NativePromise(function(r){ resolve = r; });\n return typeof resolve === 'function';\n })();\n\n\n//\n// export if necessary\n//\n\nif ( true && exports)\n{\n // node.js\n exports.Promise = nativePromiseSupported ? NativePromise : Promise;\n exports.Polyfill = Promise;\n}\nelse\n{\n // AMD\n if (true)\n {\n !(__WEBPACK_AMD_DEFINE_RESULT__ = (function(){\n return nativePromiseSupported ? NativePromise : Promise;\n }).call(exports, __webpack_require__, exports, module),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n }\n else\n {}\n}\n\n\n//\n// Polyfill\n//\n\nvar PENDING = 'pending';\nvar SEALED = 'sealed';\nvar FULFILLED = 'fulfilled';\nvar REJECTED = 'rejected';\nvar NOOP = function(){};\n\nfunction isArray(value) {\n return Object.prototype.toString.call(value) === '[object Array]';\n}\n\n// async calls\nvar asyncSetTimer = typeof setImmediate !== 'undefined' ? setImmediate : setTimeout;\nvar asyncQueue = [];\nvar asyncTimer;\n\nfunction asyncFlush(){\n // run promise callbacks\n for (var i = 0; i < asyncQueue.length; i++)\n asyncQueue[i][0](asyncQueue[i][1]);\n\n // reset async asyncQueue\n asyncQueue = [];\n asyncTimer = false;\n}\n\nfunction asyncCall(callback, arg){\n asyncQueue.push([callback, arg]);\n\n if (!asyncTimer)\n {\n asyncTimer = true;\n asyncSetTimer(asyncFlush, 0);\n }\n}\n\n\nfunction invokeResolver(resolver, promise) {\n function resolvePromise(value) {\n resolve(promise, value);\n }\n\n function rejectPromise(reason) {\n reject(promise, reason);\n }\n\n try {\n resolver(resolvePromise, rejectPromise);\n } catch(e) {\n rejectPromise(e);\n }\n}\n\nfunction invokeCallback(subscriber){\n var owner = subscriber.owner;\n var settled = owner.state_;\n var value = owner.data_; \n var callback = subscriber[settled];\n var promise = subscriber.then;\n\n if (typeof callback === 'function')\n {\n settled = FULFILLED;\n try {\n value = callback(value);\n } catch(e) {\n reject(promise, e);\n }\n }\n\n if (!handleThenable(promise, value))\n {\n if (settled === FULFILLED)\n resolve(promise, value);\n\n if (settled === REJECTED)\n reject(promise, value);\n }\n}\n\nfunction handleThenable(promise, value) {\n var resolved;\n\n try {\n if (promise === value)\n throw new TypeError('A promises callback cannot return that same promise.');\n\n if (value && (typeof value === 'function' || typeof value === 'object'))\n {\n var then = value.then; // then should be retrived only once\n\n if (typeof then === 'function')\n {\n then.call(value, function(val){\n if (!resolved)\n {\n resolved = true;\n\n if (value !== val)\n resolve(promise, val);\n else\n fulfill(promise, val);\n }\n }, function(reason){\n if (!resolved)\n {\n resolved = true;\n\n reject(promise, reason);\n }\n });\n\n return true;\n }\n }\n } catch (e) {\n if (!resolved)\n reject(promise, e);\n\n return true;\n }\n\n return false;\n}\n\nfunction resolve(promise, value){\n if (promise === value || !handleThenable(promise, value))\n fulfill(promise, value);\n}\n\nfunction fulfill(promise, value){\n if (promise.state_ === PENDING)\n {\n promise.state_ = SEALED;\n promise.data_ = value;\n\n asyncCall(publishFulfillment, promise);\n }\n}\n\nfunction reject(promise, reason){\n if (promise.state_ === PENDING)\n {\n promise.state_ = SEALED;\n promise.data_ = reason;\n\n asyncCall(publishRejection, promise);\n }\n}\n\nfunction publish(promise) {\n var callbacks = promise.then_;\n promise.then_ = undefined;\n\n for (var i = 0; i < callbacks.length; i++) {\n invokeCallback(callbacks[i]);\n }\n}\n\nfunction publishFulfillment(promise){\n promise.state_ = FULFILLED;\n publish(promise);\n}\n\nfunction publishRejection(promise){\n promise.state_ = REJECTED;\n publish(promise);\n}\n\n/**\n* @class\n*/\nfunction Promise(resolver){\n if (typeof resolver !== 'function')\n throw new TypeError('Promise constructor takes a function argument');\n\n if (this instanceof Promise === false)\n throw new TypeError('Failed to construct \\'Promise\\': Please use the \\'new\\' operator, this object constructor cannot be called as a function.');\n\n this.then_ = [];\n\n invokeResolver(resolver, this);\n}\n\nPromise.prototype = {\n constructor: Promise,\n\n state_: PENDING,\n then_: null,\n data_: undefined,\n\n then: function(onFulfillment, onRejection){\n var subscriber = {\n owner: this,\n then: new this.constructor(NOOP),\n fulfilled: onFulfillment,\n rejected: onRejection\n };\n\n if (this.state_ === FULFILLED || this.state_ === REJECTED)\n {\n // already resolved, call callback async\n asyncCall(invokeCallback, subscriber);\n }\n else\n {\n // subscribe\n this.then_.push(subscriber);\n }\n\n return subscriber.then;\n },\n\n 'catch': function(onRejection) {\n return this.then(null, onRejection);\n }\n};\n\nPromise.all = function(promises){\n var Class = this;\n\n if (!isArray(promises))\n throw new TypeError('You must pass an array to Promise.all().');\n\n return new Class(function(resolve, reject){\n var results = [];\n var remaining = 0;\n\n function resolver(index){\n remaining++;\n return function(value){\n results[index] = value;\n if (!--remaining)\n resolve(results);\n };\n }\n\n for (var i = 0, promise; i < promises.length; i++)\n {\n promise = promises[i];\n\n if (promise && typeof promise.then === 'function')\n promise.then(resolver(i), reject);\n else\n results[i] = promise;\n }\n\n if (!remaining)\n resolve(results);\n });\n};\n\nPromise.race = function(promises){\n var Class = this;\n\n if (!isArray(promises))\n throw new TypeError('You must pass an array to Promise.race().');\n\n return new Class(function(resolve, reject) {\n for (var i = 0, promise; i < promises.length; i++)\n {\n promise = promises[i];\n\n if (promise && typeof promise.then === 'function')\n promise.then(resolve, reject);\n else\n resolve(promise);\n }\n });\n};\n\nPromise.resolve = function(value){\n var Class = this;\n\n if (value && typeof value === 'object' && value.constructor === Class)\n return value;\n\n return new Class(function(resolve){\n resolve(value);\n });\n};\n\nPromise.reject = function(reason){\n var Class = this;\n\n return new Class(function(resolve, reject){\n reject(reason);\n });\n};\n\n})(typeof window != 'undefined' ? window : typeof global != 'undefined' ? global : typeof self != 'undefined' ? self : this);\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/es6-promise-polyfill/promise.js?"); /***/ }), /***/ "./node_modules/eventemitter3/index.js": /*!*********************************************!*\ !*** ./node_modules/eventemitter3/index.js ***! \*********************************************/ /***/ ((module) => { "use strict"; eval("\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Add a listener for a given event.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} once Specify if the listener is a one-time listener.\n * @returns {EventEmitter}\n * @private\n */\nfunction addListener(emitter, event, fn, context, once) {\n if (typeof fn !== 'function') {\n throw new TypeError('The listener must be a function');\n }\n\n var listener = new EE(fn, context || emitter, once)\n , evt = prefix ? prefix + event : event;\n\n if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;\n else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);\n else emitter._events[evt] = [emitter._events[evt], listener];\n\n return emitter;\n}\n\n/**\n * Clear event by name.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} evt The Event name.\n * @private\n */\nfunction clearEvent(emitter, evt) {\n if (--emitter._eventsCount === 0) emitter._events = new Events();\n else delete emitter._events[evt];\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) return names;\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Array} The registered listeners.\n * @public\n */\nEventEmitter.prototype.listeners = function listeners(event) {\n var evt = prefix ? prefix + event : event\n , handlers = this._events[evt];\n\n if (!handlers) return [];\n if (handlers.fn) return [handlers.fn];\n\n for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {\n ee[i] = handlers[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Return the number of listeners listening to a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Number} The number of listeners.\n * @public\n */\nEventEmitter.prototype.listenerCount = function listenerCount(event) {\n var evt = prefix ? prefix + event : event\n , listeners = this._events[evt];\n\n if (!listeners) return 0;\n if (listeners.fn) return 1;\n return listeners.length;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n return addListener(this, event, fn, context, false);\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n return addListener(this, event, fn, context, true);\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {*} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return this;\n if (!fn) {\n clearEvent(this, evt);\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn &&\n (!once || listeners.once) &&\n (!context || listeners.context === context)\n ) {\n clearEvent(this, evt);\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn ||\n (once && !listeners[i].once) ||\n (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else clearEvent(this, evt);\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {(String|Symbol)} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) clearEvent(this, evt);\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif (true) {\n module.exports = EventEmitter;\n}\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/eventemitter3/index.js?"); /***/ }), /***/ "./node_modules/ismobilejs/esm/index.js": /*!**********************************************!*\ !*** ./node_modules/ismobilejs/esm/index.js ***! \**********************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* reexport safe */ _isMobile__WEBPACK_IMPORTED_MODULE_0__[\"default\"])\n/* harmony export */ });\n/* harmony import */ var _isMobile__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./isMobile */ \"./node_modules/ismobilejs/esm/isMobile.js\");\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/ismobilejs/esm/index.js?"); /***/ }), /***/ "./node_modules/ismobilejs/esm/isMobile.js": /*!*************************************************!*\ !*** ./node_modules/ismobilejs/esm/isMobile.js ***! \*************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ isMobile)\n/* harmony export */ });\nvar appleIphone = /iPhone/i;\nvar appleIpod = /iPod/i;\nvar appleTablet = /iPad/i;\nvar appleUniversal = /\\biOS-universal(?:.+)Mac\\b/i;\nvar androidPhone = /\\bAndroid(?:.+)Mobile\\b/i;\nvar androidTablet = /Android/i;\nvar amazonPhone = /(?:SD4930UR|\\bSilk(?:.+)Mobile\\b)/i;\nvar amazonTablet = /Silk/i;\nvar windowsPhone = /Windows Phone/i;\nvar windowsTablet = /\\bWindows(?:.+)ARM\\b/i;\nvar otherBlackBerry = /BlackBerry/i;\nvar otherBlackBerry10 = /BB10/i;\nvar otherOpera = /Opera Mini/i;\nvar otherChrome = /\\b(CriOS|Chrome)(?:.+)Mobile/i;\nvar otherFirefox = /Mobile(?:.+)Firefox\\b/i;\nvar isAppleTabletOnIos13 = function (navigator) {\n return (typeof navigator !== 'undefined' &&\n navigator.platform === 'MacIntel' &&\n typeof navigator.maxTouchPoints === 'number' &&\n navigator.maxTouchPoints > 1 &&\n typeof MSStream === 'undefined');\n};\nfunction createMatch(userAgent) {\n return function (regex) { return regex.test(userAgent); };\n}\nfunction isMobile(param) {\n var nav = {\n userAgent: '',\n platform: '',\n maxTouchPoints: 0\n };\n if (!param && typeof navigator !== 'undefined') {\n nav = {\n userAgent: navigator.userAgent,\n platform: navigator.platform,\n maxTouchPoints: navigator.maxTouchPoints || 0\n };\n }\n else if (typeof param === 'string') {\n nav.userAgent = param;\n }\n else if (param && param.userAgent) {\n nav = {\n userAgent: param.userAgent,\n platform: param.platform,\n maxTouchPoints: param.maxTouchPoints || 0\n };\n }\n var userAgent = nav.userAgent;\n var tmp = userAgent.split('[FBAN');\n if (typeof tmp[1] !== 'undefined') {\n userAgent = tmp[0];\n }\n tmp = userAgent.split('Twitter');\n if (typeof tmp[1] !== 'undefined') {\n userAgent = tmp[0];\n }\n var match = createMatch(userAgent);\n var result = {\n apple: {\n phone: match(appleIphone) && !match(windowsPhone),\n ipod: match(appleIpod),\n tablet: !match(appleIphone) &&\n (match(appleTablet) || isAppleTabletOnIos13(nav)) &&\n !match(windowsPhone),\n universal: match(appleUniversal),\n device: (match(appleIphone) ||\n match(appleIpod) ||\n match(appleTablet) ||\n match(appleUniversal) ||\n isAppleTabletOnIos13(nav)) &&\n !match(windowsPhone)\n },\n amazon: {\n phone: match(amazonPhone),\n tablet: !match(amazonPhone) && match(amazonTablet),\n device: match(amazonPhone) || match(amazonTablet)\n },\n android: {\n phone: (!match(windowsPhone) && match(amazonPhone)) ||\n (!match(windowsPhone) && match(androidPhone)),\n tablet: !match(windowsPhone) &&\n !match(amazonPhone) &&\n !match(androidPhone) &&\n (match(amazonTablet) || match(androidTablet)),\n device: (!match(windowsPhone) &&\n (match(amazonPhone) ||\n match(amazonTablet) ||\n match(androidPhone) ||\n match(androidTablet))) ||\n match(/\\bokhttp\\b/i)\n },\n windows: {\n phone: match(windowsPhone),\n tablet: match(windowsTablet),\n device: match(windowsPhone) || match(windowsTablet)\n },\n other: {\n blackberry: match(otherBlackBerry),\n blackberry10: match(otherBlackBerry10),\n opera: match(otherOpera),\n firefox: match(otherFirefox),\n chrome: match(otherChrome),\n device: match(otherBlackBerry) ||\n match(otherBlackBerry10) ||\n match(otherOpera) ||\n match(otherFirefox) ||\n match(otherChrome)\n },\n any: false,\n phone: false,\n tablet: false\n };\n result.any =\n result.apple.device ||\n result.android.device ||\n result.windows.device ||\n result.other.device;\n result.phone =\n result.apple.phone || result.android.phone || result.windows.phone;\n result.tablet =\n result.apple.tablet || result.android.tablet || result.windows.tablet;\n return result;\n}\n//# sourceMappingURL=isMobile.js.map\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/ismobilejs/esm/isMobile.js?"); /***/ }), /***/ "./node_modules/mini-signals/lib/mini-signals.js": /*!*******************************************************!*\ !*** ./node_modules/mini-signals/lib/mini-signals.js ***! \*******************************************************/ /***/ ((module, exports) => { "use strict"; eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\n\nvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\nvar MiniSignalBinding = (function () {\n function MiniSignalBinding(fn, once, thisArg) {\n if (once === undefined) once = false;\n\n _classCallCheck(this, MiniSignalBinding);\n\n this._fn = fn;\n this._once = once;\n this._thisArg = thisArg;\n this._next = this._prev = this._owner = null;\n }\n\n _createClass(MiniSignalBinding, [{\n key: 'detach',\n value: function detach() {\n if (this._owner === null) return false;\n this._owner.detach(this);\n return true;\n }\n }]);\n\n return MiniSignalBinding;\n})();\n\nfunction _addMiniSignalBinding(self, node) {\n if (!self._head) {\n self._head = node;\n self._tail = node;\n } else {\n self._tail._next = node;\n node._prev = self._tail;\n self._tail = node;\n }\n\n node._owner = self;\n\n return node;\n}\n\nvar MiniSignal = (function () {\n function MiniSignal() {\n _classCallCheck(this, MiniSignal);\n\n this._head = this._tail = undefined;\n }\n\n _createClass(MiniSignal, [{\n key: 'handlers',\n value: function handlers() {\n var exists = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0];\n\n var node = this._head;\n\n if (exists) return !!node;\n\n var ee = [];\n\n while (node) {\n ee.push(node);\n node = node._next;\n }\n\n return ee;\n }\n }, {\n key: 'has',\n value: function has(node) {\n if (!(node instanceof MiniSignalBinding)) {\n throw new Error('MiniSignal#has(): First arg must be a MiniSignalBinding object.');\n }\n\n return node._owner === this;\n }\n }, {\n key: 'dispatch',\n value: function dispatch() {\n var node = this._head;\n\n if (!node) return false;\n\n while (node) {\n if (node._once) this.detach(node);\n node._fn.apply(node._thisArg, arguments);\n node = node._next;\n }\n\n return true;\n }\n }, {\n key: 'add',\n value: function add(fn) {\n var thisArg = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];\n\n if (typeof fn !== 'function') {\n throw new Error('MiniSignal#add(): First arg must be a Function.');\n }\n return _addMiniSignalBinding(this, new MiniSignalBinding(fn, false, thisArg));\n }\n }, {\n key: 'once',\n value: function once(fn) {\n var thisArg = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];\n\n if (typeof fn !== 'function') {\n throw new Error('MiniSignal#once(): First arg must be a Function.');\n }\n return _addMiniSignalBinding(this, new MiniSignalBinding(fn, true, thisArg));\n }\n }, {\n key: 'detach',\n value: function detach(node) {\n if (!(node instanceof MiniSignalBinding)) {\n throw new Error('MiniSignal#detach(): First arg must be a MiniSignalBinding object.');\n }\n if (node._owner !== this) return this;\n\n if (node._prev) node._prev._next = node._next;\n if (node._next) node._next._prev = node._prev;\n\n if (node === this._head) {\n this._head = node._next;\n if (node._next === null) {\n this._tail = null;\n }\n } else if (node === this._tail) {\n this._tail = node._prev;\n this._tail._next = null;\n }\n\n node._owner = null;\n return this;\n }\n }, {\n key: 'detachAll',\n value: function detachAll() {\n var node = this._head;\n if (!node) return this;\n\n this._head = this._tail = null;\n\n while (node) {\n node._owner = null;\n node = node._next;\n }\n return this;\n }\n }]);\n\n return MiniSignal;\n})();\n\nMiniSignal.MiniSignalBinding = MiniSignalBinding;\n\nexports[\"default\"] = MiniSignal;\nmodule.exports = exports['default'];\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/mini-signals/lib/mini-signals.js?"); /***/ }), /***/ "./node_modules/object-assign/index.js": /*!*********************************************!*\ !*** ./node_modules/object-assign/index.js ***! \*********************************************/ /***/ ((module) => { "use strict"; eval("/*\nobject-assign\n(c) Sindre Sorhus\n@license MIT\n*/\n\n\n/* eslint-disable no-unused-vars */\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar propIsEnumerable = Object.prototype.propertyIsEnumerable;\n\nfunction toObject(val) {\n\tif (val === null || val === undefined) {\n\t\tthrow new TypeError('Object.assign cannot be called with null or undefined');\n\t}\n\n\treturn Object(val);\n}\n\nfunction shouldUseNative() {\n\ttry {\n\t\tif (!Object.assign) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Detect buggy property enumeration order in older V8 versions.\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=4118\n\t\tvar test1 = new String('abc'); // eslint-disable-line no-new-wrappers\n\t\ttest1[5] = 'de';\n\t\tif (Object.getOwnPropertyNames(test1)[0] === '5') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test2 = {};\n\t\tfor (var i = 0; i < 10; i++) {\n\t\t\ttest2['_' + String.fromCharCode(i)] = i;\n\t\t}\n\t\tvar order2 = Object.getOwnPropertyNames(test2).map(function (n) {\n\t\t\treturn test2[n];\n\t\t});\n\t\tif (order2.join('') !== '0123456789') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test3 = {};\n\t\t'abcdefghijklmnopqrst'.split('').forEach(function (letter) {\n\t\t\ttest3[letter] = letter;\n\t\t});\n\t\tif (Object.keys(Object.assign({}, test3)).join('') !==\n\t\t\t\t'abcdefghijklmnopqrst') {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (err) {\n\t\t// We don't expect any of the above to throw, but better to be safe.\n\t\treturn false;\n\t}\n}\n\nmodule.exports = shouldUseNative() ? Object.assign : function (target, source) {\n\tvar from;\n\tvar to = toObject(target);\n\tvar symbols;\n\n\tfor (var s = 1; s < arguments.length; s++) {\n\t\tfrom = Object(arguments[s]);\n\n\t\tfor (var key in from) {\n\t\t\tif (hasOwnProperty.call(from, key)) {\n\t\t\t\tto[key] = from[key];\n\t\t\t}\n\t\t}\n\n\t\tif (getOwnPropertySymbols) {\n\t\t\tsymbols = getOwnPropertySymbols(from);\n\t\t\tfor (var i = 0; i < symbols.length; i++) {\n\t\t\t\tif (propIsEnumerable.call(from, symbols[i])) {\n\t\t\t\t\tto[symbols[i]] = from[symbols[i]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn to;\n};\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/object-assign/index.js?"); /***/ }), /***/ "./node_modules/parse-uri/index.js": /*!*****************************************!*\ !*** ./node_modules/parse-uri/index.js ***! \*****************************************/ /***/ ((module) => { "use strict"; eval("\n\nfunction parseURI (str, opts) {\n if (!str) return undefined\n\n opts = opts || {}\n\n var o = {\n key: [\n 'source',\n 'protocol',\n 'authority',\n 'userInfo',\n 'user',\n 'password',\n 'host',\n 'port',\n 'relative',\n 'path',\n 'directory',\n 'file',\n 'query',\n 'anchor'\n ],\n q: {\n name: 'queryKey',\n parser: /(?:^|&)([^&=]*)=?([^&]*)/g\n },\n parser: {\n strict: /^(?:([^:\\/?#]+):)?(?:\\/\\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?))?((((?:[^?#\\/]*\\/)*)([^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/,\n loose: /^(?:(?![^:@]+:[^:@\\/]*@)([^:\\/?#.]+):)?(?:\\/\\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?)(((\\/(?:[^?#](?![^?#\\/]*\\.[^?#\\/.]+(?:[?#]|$)))*\\/?)?([^?#\\/]*))(?:\\?([^#]*))?(?:#(.*))?)/\n }\n }\n\n var m = o.parser[opts.strictMode ? 'strict' : 'loose'].exec(str)\n var uri = {}\n var i = 14\n\n while (i--) uri[o.key[i]] = m[i] || ''\n\n uri[o.q.name] = {}\n uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) {\n if ($1) uri[o.q.name][$1] = $2\n })\n\n return uri\n}\n\nmodule.exports = parseURI\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/parse-uri/index.js?"); /***/ }), /***/ "./node_modules/pixi.js/lib/pixi.es.js": /*!*********************************************!*\ !*** ./node_modules/pixi.js/lib/pixi.es.js ***! \*********************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ALPHA_MODES\": () => (/* reexport safe */ _pixi_constants__WEBPACK_IMPORTED_MODULE_23__.ALPHA_MODES),\n/* harmony export */ \"AbstractBatchRenderer\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.AbstractBatchRenderer),\n/* harmony export */ \"AbstractRenderer\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.AbstractRenderer),\n/* harmony export */ \"AccessibilityManager\": () => (/* reexport safe */ _pixi_accessibility__WEBPACK_IMPORTED_MODULE_2__.AccessibilityManager),\n/* harmony export */ \"AnimatedSprite\": () => (/* reexport safe */ _pixi_sprite_animated__WEBPACK_IMPORTED_MODULE_31__.AnimatedSprite),\n/* harmony export */ \"AppLoaderPlugin\": () => (/* reexport safe */ _pixi_loaders__WEBPACK_IMPORTED_MODULE_7__.AppLoaderPlugin),\n/* harmony export */ \"Application\": () => (/* reexport safe */ _pixi_app__WEBPACK_IMPORTED_MODULE_4__.Application),\n/* harmony export */ \"Attribute\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.Attribute),\n/* harmony export */ \"BLEND_MODES\": () => (/* reexport safe */ _pixi_constants__WEBPACK_IMPORTED_MODULE_23__.BLEND_MODES),\n/* harmony export */ \"BUFFER_BITS\": () => (/* reexport safe */ _pixi_constants__WEBPACK_IMPORTED_MODULE_23__.BUFFER_BITS),\n/* harmony export */ \"BasePrepare\": () => (/* reexport safe */ _pixi_prepare__WEBPACK_IMPORTED_MODULE_9__.BasePrepare),\n/* harmony export */ \"BaseRenderTexture\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.BaseRenderTexture),\n/* harmony export */ \"BaseTexture\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.BaseTexture),\n/* harmony export */ \"BatchDrawCall\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.BatchDrawCall),\n/* harmony export */ \"BatchGeometry\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.BatchGeometry),\n/* harmony export */ \"BatchPluginFactory\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.BatchPluginFactory),\n/* harmony export */ \"BatchRenderer\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.BatchRenderer),\n/* harmony export */ \"BatchShaderGenerator\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.BatchShaderGenerator),\n/* harmony export */ \"BatchTextureArray\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.BatchTextureArray),\n/* harmony export */ \"BitmapFont\": () => (/* reexport safe */ _pixi_text_bitmap__WEBPACK_IMPORTED_MODULE_12__.BitmapFont),\n/* harmony export */ \"BitmapFontData\": () => (/* reexport safe */ _pixi_text_bitmap__WEBPACK_IMPORTED_MODULE_12__.BitmapFontData),\n/* harmony export */ \"BitmapFontLoader\": () => (/* reexport safe */ _pixi_text_bitmap__WEBPACK_IMPORTED_MODULE_12__.BitmapFontLoader),\n/* harmony export */ \"BitmapText\": () => (/* reexport safe */ _pixi_text_bitmap__WEBPACK_IMPORTED_MODULE_12__.BitmapText),\n/* harmony export */ \"Bounds\": () => (/* reexport safe */ _pixi_display__WEBPACK_IMPORTED_MODULE_24__.Bounds),\n/* harmony export */ \"Buffer\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.Buffer),\n/* harmony export */ \"CLEAR_MODES\": () => (/* reexport safe */ _pixi_constants__WEBPACK_IMPORTED_MODULE_23__.CLEAR_MODES),\n/* harmony export */ \"Circle\": () => (/* reexport safe */ _pixi_math__WEBPACK_IMPORTED_MODULE_26__.Circle),\n/* harmony export */ \"Container\": () => (/* reexport safe */ _pixi_display__WEBPACK_IMPORTED_MODULE_24__.Container),\n/* harmony export */ \"CountLimiter\": () => (/* reexport safe */ _pixi_prepare__WEBPACK_IMPORTED_MODULE_9__.CountLimiter),\n/* harmony export */ \"DEG_TO_RAD\": () => (/* reexport safe */ _pixi_math__WEBPACK_IMPORTED_MODULE_26__.DEG_TO_RAD),\n/* harmony export */ \"DRAW_MODES\": () => (/* reexport safe */ _pixi_constants__WEBPACK_IMPORTED_MODULE_23__.DRAW_MODES),\n/* harmony export */ \"DisplayObject\": () => (/* reexport safe */ _pixi_display__WEBPACK_IMPORTED_MODULE_24__.DisplayObject),\n/* harmony export */ \"ENV\": () => (/* reexport safe */ _pixi_constants__WEBPACK_IMPORTED_MODULE_23__.ENV),\n/* harmony export */ \"Ellipse\": () => (/* reexport safe */ _pixi_math__WEBPACK_IMPORTED_MODULE_26__.Ellipse),\n/* harmony export */ \"Extract\": () => (/* reexport safe */ _pixi_extract__WEBPACK_IMPORTED_MODULE_6__.Extract),\n/* harmony export */ \"FORMATS\": () => (/* reexport safe */ _pixi_constants__WEBPACK_IMPORTED_MODULE_23__.FORMATS),\n/* harmony export */ \"FillStyle\": () => (/* reexport safe */ _pixi_graphics__WEBPACK_IMPORTED_MODULE_25__.FillStyle),\n/* harmony export */ \"Filter\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.Filter),\n/* harmony export */ \"FilterState\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.FilterState),\n/* harmony export */ \"Framebuffer\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.Framebuffer),\n/* harmony export */ \"GC_MODES\": () => (/* reexport safe */ _pixi_constants__WEBPACK_IMPORTED_MODULE_23__.GC_MODES),\n/* harmony export */ \"GLFramebuffer\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.GLFramebuffer),\n/* harmony export */ \"GLProgram\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.GLProgram),\n/* harmony export */ \"GLTexture\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.GLTexture),\n/* harmony export */ \"GRAPHICS_CURVES\": () => (/* reexport safe */ _pixi_graphics__WEBPACK_IMPORTED_MODULE_25__.GRAPHICS_CURVES),\n/* harmony export */ \"Geometry\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.Geometry),\n/* harmony export */ \"Graphics\": () => (/* reexport safe */ _pixi_graphics__WEBPACK_IMPORTED_MODULE_25__.Graphics),\n/* harmony export */ \"GraphicsData\": () => (/* reexport safe */ _pixi_graphics__WEBPACK_IMPORTED_MODULE_25__.GraphicsData),\n/* harmony export */ \"GraphicsGeometry\": () => (/* reexport safe */ _pixi_graphics__WEBPACK_IMPORTED_MODULE_25__.GraphicsGeometry),\n/* harmony export */ \"IGLUniformData\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.IGLUniformData),\n/* harmony export */ \"InteractionData\": () => (/* reexport safe */ _pixi_interaction__WEBPACK_IMPORTED_MODULE_3__.InteractionData),\n/* harmony export */ \"InteractionEvent\": () => (/* reexport safe */ _pixi_interaction__WEBPACK_IMPORTED_MODULE_3__.InteractionEvent),\n/* harmony export */ \"InteractionManager\": () => (/* reexport safe */ _pixi_interaction__WEBPACK_IMPORTED_MODULE_3__.InteractionManager),\n/* harmony export */ \"InteractionTrackingData\": () => (/* reexport safe */ _pixi_interaction__WEBPACK_IMPORTED_MODULE_3__.InteractionTrackingData),\n/* harmony export */ \"LINE_CAP\": () => (/* reexport safe */ _pixi_graphics__WEBPACK_IMPORTED_MODULE_25__.LINE_CAP),\n/* harmony export */ \"LINE_JOIN\": () => (/* reexport safe */ _pixi_graphics__WEBPACK_IMPORTED_MODULE_25__.LINE_JOIN),\n/* harmony export */ \"LineStyle\": () => (/* reexport safe */ _pixi_graphics__WEBPACK_IMPORTED_MODULE_25__.LineStyle),\n/* harmony export */ \"Loader\": () => (/* reexport safe */ _pixi_loaders__WEBPACK_IMPORTED_MODULE_7__.Loader),\n/* harmony export */ \"LoaderResource\": () => (/* reexport safe */ _pixi_loaders__WEBPACK_IMPORTED_MODULE_7__.LoaderResource),\n/* harmony export */ \"MASK_TYPES\": () => (/* reexport safe */ _pixi_constants__WEBPACK_IMPORTED_MODULE_23__.MASK_TYPES),\n/* harmony export */ \"MIPMAP_MODES\": () => (/* reexport safe */ _pixi_constants__WEBPACK_IMPORTED_MODULE_23__.MIPMAP_MODES),\n/* harmony export */ \"MSAA_QUALITY\": () => (/* reexport safe */ _pixi_constants__WEBPACK_IMPORTED_MODULE_23__.MSAA_QUALITY),\n/* harmony export */ \"MaskData\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.MaskData),\n/* harmony export */ \"Matrix\": () => (/* reexport safe */ _pixi_math__WEBPACK_IMPORTED_MODULE_26__.Matrix),\n/* harmony export */ \"Mesh\": () => (/* reexport safe */ _pixi_mesh__WEBPACK_IMPORTED_MODULE_27__.Mesh),\n/* harmony export */ \"MeshBatchUvs\": () => (/* reexport safe */ _pixi_mesh__WEBPACK_IMPORTED_MODULE_27__.MeshBatchUvs),\n/* harmony export */ \"MeshGeometry\": () => (/* reexport safe */ _pixi_mesh__WEBPACK_IMPORTED_MODULE_27__.MeshGeometry),\n/* harmony export */ \"MeshMaterial\": () => (/* reexport safe */ _pixi_mesh__WEBPACK_IMPORTED_MODULE_27__.MeshMaterial),\n/* harmony export */ \"NineSlicePlane\": () => (/* reexport safe */ _pixi_mesh_extras__WEBPACK_IMPORTED_MODULE_28__.NineSlicePlane),\n/* harmony export */ \"ObjectRenderer\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.ObjectRenderer),\n/* harmony export */ \"ObservablePoint\": () => (/* reexport safe */ _pixi_math__WEBPACK_IMPORTED_MODULE_26__.ObservablePoint),\n/* harmony export */ \"PI_2\": () => (/* reexport safe */ _pixi_math__WEBPACK_IMPORTED_MODULE_26__.PI_2),\n/* harmony export */ \"PRECISION\": () => (/* reexport safe */ _pixi_constants__WEBPACK_IMPORTED_MODULE_23__.PRECISION),\n/* harmony export */ \"ParticleContainer\": () => (/* reexport safe */ _pixi_particles__WEBPACK_IMPORTED_MODULE_8__.ParticleContainer),\n/* harmony export */ \"ParticleRenderer\": () => (/* reexport safe */ _pixi_particles__WEBPACK_IMPORTED_MODULE_8__.ParticleRenderer),\n/* harmony export */ \"PlaneGeometry\": () => (/* reexport safe */ _pixi_mesh_extras__WEBPACK_IMPORTED_MODULE_28__.PlaneGeometry),\n/* harmony export */ \"Point\": () => (/* reexport safe */ _pixi_math__WEBPACK_IMPORTED_MODULE_26__.Point),\n/* harmony export */ \"Polygon\": () => (/* reexport safe */ _pixi_math__WEBPACK_IMPORTED_MODULE_26__.Polygon),\n/* harmony export */ \"Prepare\": () => (/* reexport safe */ _pixi_prepare__WEBPACK_IMPORTED_MODULE_9__.Prepare),\n/* harmony export */ \"Program\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.Program),\n/* harmony export */ \"Quad\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.Quad),\n/* harmony export */ \"QuadUv\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.QuadUv),\n/* harmony export */ \"RAD_TO_DEG\": () => (/* reexport safe */ _pixi_math__WEBPACK_IMPORTED_MODULE_26__.RAD_TO_DEG),\n/* harmony export */ \"RENDERER_TYPE\": () => (/* reexport safe */ _pixi_constants__WEBPACK_IMPORTED_MODULE_23__.RENDERER_TYPE),\n/* harmony export */ \"Rectangle\": () => (/* reexport safe */ _pixi_math__WEBPACK_IMPORTED_MODULE_26__.Rectangle),\n/* harmony export */ \"RenderTexture\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.RenderTexture),\n/* harmony export */ \"RenderTexturePool\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.RenderTexturePool),\n/* harmony export */ \"Renderer\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.Renderer),\n/* harmony export */ \"RopeGeometry\": () => (/* reexport safe */ _pixi_mesh_extras__WEBPACK_IMPORTED_MODULE_28__.RopeGeometry),\n/* harmony export */ \"RoundedRectangle\": () => (/* reexport safe */ _pixi_math__WEBPACK_IMPORTED_MODULE_26__.RoundedRectangle),\n/* harmony export */ \"Runner\": () => (/* reexport safe */ _pixi_runner__WEBPACK_IMPORTED_MODULE_29__.Runner),\n/* harmony export */ \"SCALE_MODES\": () => (/* reexport safe */ _pixi_constants__WEBPACK_IMPORTED_MODULE_23__.SCALE_MODES),\n/* harmony export */ \"SHAPES\": () => (/* reexport safe */ _pixi_math__WEBPACK_IMPORTED_MODULE_26__.SHAPES),\n/* harmony export */ \"Shader\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.Shader),\n/* harmony export */ \"SimpleMesh\": () => (/* reexport safe */ _pixi_mesh_extras__WEBPACK_IMPORTED_MODULE_28__.SimpleMesh),\n/* harmony export */ \"SimplePlane\": () => (/* reexport safe */ _pixi_mesh_extras__WEBPACK_IMPORTED_MODULE_28__.SimplePlane),\n/* harmony export */ \"SimpleRope\": () => (/* reexport safe */ _pixi_mesh_extras__WEBPACK_IMPORTED_MODULE_28__.SimpleRope),\n/* harmony export */ \"Sprite\": () => (/* reexport safe */ _pixi_sprite__WEBPACK_IMPORTED_MODULE_30__.Sprite),\n/* harmony export */ \"SpriteMaskFilter\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.SpriteMaskFilter),\n/* harmony export */ \"Spritesheet\": () => (/* reexport safe */ _pixi_spritesheet__WEBPACK_IMPORTED_MODULE_10__.Spritesheet),\n/* harmony export */ \"SpritesheetLoader\": () => (/* reexport safe */ _pixi_spritesheet__WEBPACK_IMPORTED_MODULE_10__.SpritesheetLoader),\n/* harmony export */ \"State\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.State),\n/* harmony export */ \"System\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.System),\n/* harmony export */ \"TARGETS\": () => (/* reexport safe */ _pixi_constants__WEBPACK_IMPORTED_MODULE_23__.TARGETS),\n/* harmony export */ \"TEXT_GRADIENT\": () => (/* reexport safe */ _pixi_text__WEBPACK_IMPORTED_MODULE_32__.TEXT_GRADIENT),\n/* harmony export */ \"TYPES\": () => (/* reexport safe */ _pixi_constants__WEBPACK_IMPORTED_MODULE_23__.TYPES),\n/* harmony export */ \"TemporaryDisplayObject\": () => (/* reexport safe */ _pixi_display__WEBPACK_IMPORTED_MODULE_24__.TemporaryDisplayObject),\n/* harmony export */ \"Text\": () => (/* reexport safe */ _pixi_text__WEBPACK_IMPORTED_MODULE_32__.Text),\n/* harmony export */ \"TextMetrics\": () => (/* reexport safe */ _pixi_text__WEBPACK_IMPORTED_MODULE_32__.TextMetrics),\n/* harmony export */ \"TextStyle\": () => (/* reexport safe */ _pixi_text__WEBPACK_IMPORTED_MODULE_32__.TextStyle),\n/* harmony export */ \"Texture\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.Texture),\n/* harmony export */ \"TextureLoader\": () => (/* reexport safe */ _pixi_loaders__WEBPACK_IMPORTED_MODULE_7__.TextureLoader),\n/* harmony export */ \"TextureMatrix\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.TextureMatrix),\n/* harmony export */ \"TextureUvs\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.TextureUvs),\n/* harmony export */ \"Ticker\": () => (/* reexport safe */ _pixi_ticker__WEBPACK_IMPORTED_MODULE_13__.Ticker),\n/* harmony export */ \"TickerPlugin\": () => (/* reexport safe */ _pixi_ticker__WEBPACK_IMPORTED_MODULE_13__.TickerPlugin),\n/* harmony export */ \"TilingSprite\": () => (/* reexport safe */ _pixi_sprite_tiling__WEBPACK_IMPORTED_MODULE_11__.TilingSprite),\n/* harmony export */ \"TilingSpriteRenderer\": () => (/* reexport safe */ _pixi_sprite_tiling__WEBPACK_IMPORTED_MODULE_11__.TilingSpriteRenderer),\n/* harmony export */ \"TimeLimiter\": () => (/* reexport safe */ _pixi_prepare__WEBPACK_IMPORTED_MODULE_9__.TimeLimiter),\n/* harmony export */ \"Transform\": () => (/* reexport safe */ _pixi_math__WEBPACK_IMPORTED_MODULE_26__.Transform),\n/* harmony export */ \"UPDATE_PRIORITY\": () => (/* reexport safe */ _pixi_ticker__WEBPACK_IMPORTED_MODULE_13__.UPDATE_PRIORITY),\n/* harmony export */ \"UniformGroup\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.UniformGroup),\n/* harmony export */ \"VERSION\": () => (/* binding */ VERSION),\n/* harmony export */ \"ViewableBuffer\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.ViewableBuffer),\n/* harmony export */ \"WRAP_MODES\": () => (/* reexport safe */ _pixi_constants__WEBPACK_IMPORTED_MODULE_23__.WRAP_MODES),\n/* harmony export */ \"accessibleTarget\": () => (/* reexport safe */ _pixi_accessibility__WEBPACK_IMPORTED_MODULE_2__.accessibleTarget),\n/* harmony export */ \"autoDetectRenderer\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.autoDetectRenderer),\n/* harmony export */ \"checkMaxIfStatementsInShader\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.checkMaxIfStatementsInShader),\n/* harmony export */ \"defaultFilterVertex\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.defaultFilterVertex),\n/* harmony export */ \"defaultVertex\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.defaultVertex),\n/* harmony export */ \"filters\": () => (/* binding */ filters),\n/* harmony export */ \"graphicsUtils\": () => (/* reexport safe */ _pixi_graphics__WEBPACK_IMPORTED_MODULE_25__.graphicsUtils),\n/* harmony export */ \"groupD8\": () => (/* reexport safe */ _pixi_math__WEBPACK_IMPORTED_MODULE_26__.groupD8),\n/* harmony export */ \"interactiveTarget\": () => (/* reexport safe */ _pixi_interaction__WEBPACK_IMPORTED_MODULE_3__.interactiveTarget),\n/* harmony export */ \"isMobile\": () => (/* reexport safe */ _pixi_settings__WEBPACK_IMPORTED_MODULE_33__.isMobile),\n/* harmony export */ \"resources\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.resources),\n/* harmony export */ \"settings\": () => (/* reexport safe */ _pixi_settings__WEBPACK_IMPORTED_MODULE_33__.settings),\n/* harmony export */ \"systems\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.systems),\n/* harmony export */ \"uniformParsers\": () => (/* reexport safe */ _pixi_core__WEBPACK_IMPORTED_MODULE_5__.uniformParsers),\n/* harmony export */ \"useDeprecated\": () => (/* binding */ useDeprecated),\n/* harmony export */ \"utils\": () => (/* reexport module object */ _pixi_utils__WEBPACK_IMPORTED_MODULE_1__)\n/* harmony export */ });\n/* harmony import */ var _pixi_polyfill__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @pixi/polyfill */ \"./node_modules/@pixi/polyfill/lib/polyfill.es.js\");\n/* harmony import */ var _pixi_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @pixi/utils */ \"./node_modules/@pixi/utils/lib/utils.es.js\");\n/* harmony import */ var _pixi_accessibility__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @pixi/accessibility */ \"./node_modules/@pixi/accessibility/lib/accessibility.es.js\");\n/* harmony import */ var _pixi_interaction__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @pixi/interaction */ \"./node_modules/@pixi/interaction/lib/interaction.es.js\");\n/* harmony import */ var _pixi_app__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @pixi/app */ \"./node_modules/@pixi/app/lib/app.es.js\");\n/* harmony import */ var _pixi_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @pixi/core */ \"./node_modules/@pixi/core/lib/core.es.js\");\n/* harmony import */ var _pixi_extract__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @pixi/extract */ \"./node_modules/@pixi/extract/lib/extract.es.js\");\n/* harmony import */ var _pixi_loaders__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @pixi/loaders */ \"./node_modules/@pixi/loaders/lib/loaders.es.js\");\n/* harmony import */ var _pixi_particles__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @pixi/particles */ \"./node_modules/@pixi/particles/lib/particles.es.js\");\n/* harmony import */ var _pixi_prepare__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @pixi/prepare */ \"./node_modules/@pixi/prepare/lib/prepare.es.js\");\n/* harmony import */ var _pixi_spritesheet__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @pixi/spritesheet */ \"./node_modules/@pixi/spritesheet/lib/spritesheet.es.js\");\n/* harmony import */ var _pixi_sprite_tiling__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @pixi/sprite-tiling */ \"./node_modules/@pixi/sprite-tiling/lib/sprite-tiling.es.js\");\n/* harmony import */ var _pixi_text_bitmap__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @pixi/text-bitmap */ \"./node_modules/@pixi/text-bitmap/lib/text-bitmap.es.js\");\n/* harmony import */ var _pixi_ticker__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @pixi/ticker */ \"./node_modules/@pixi/ticker/lib/ticker.es.js\");\n/* harmony import */ var _pixi_filter_alpha__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! @pixi/filter-alpha */ \"./node_modules/@pixi/filter-alpha/lib/filter-alpha.es.js\");\n/* harmony import */ var _pixi_filter_blur__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! @pixi/filter-blur */ \"./node_modules/@pixi/filter-blur/lib/filter-blur.es.js\");\n/* harmony import */ var _pixi_filter_color_matrix__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! @pixi/filter-color-matrix */ \"./node_modules/@pixi/filter-color-matrix/lib/filter-color-matrix.es.js\");\n/* harmony import */ var _pixi_filter_displacement__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! @pixi/filter-displacement */ \"./node_modules/@pixi/filter-displacement/lib/filter-displacement.es.js\");\n/* harmony import */ var _pixi_filter_fxaa__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! @pixi/filter-fxaa */ \"./node_modules/@pixi/filter-fxaa/lib/filter-fxaa.es.js\");\n/* harmony import */ var _pixi_filter_noise__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! @pixi/filter-noise */ \"./node_modules/@pixi/filter-noise/lib/filter-noise.es.js\");\n/* harmony import */ var _pixi_mixin_cache_as_bitmap__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! @pixi/mixin-cache-as-bitmap */ \"./node_modules/@pixi/mixin-cache-as-bitmap/lib/mixin-cache-as-bitmap.es.js\");\n/* harmony import */ var _pixi_mixin_get_child_by_name__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! @pixi/mixin-get-child-by-name */ \"./node_modules/@pixi/mixin-get-child-by-name/lib/mixin-get-child-by-name.es.js\");\n/* harmony import */ var _pixi_mixin_get_global_position__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! @pixi/mixin-get-global-position */ \"./node_modules/@pixi/mixin-get-global-position/lib/mixin-get-global-position.es.js\");\n/* harmony import */ var _pixi_constants__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! @pixi/constants */ \"./node_modules/@pixi/constants/lib/constants.es.js\");\n/* harmony import */ var _pixi_display__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! @pixi/display */ \"./node_modules/@pixi/display/lib/display.es.js\");\n/* harmony import */ var _pixi_graphics__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! @pixi/graphics */ \"./node_modules/@pixi/graphics/lib/graphics.es.js\");\n/* harmony import */ var _pixi_math__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! @pixi/math */ \"./node_modules/@pixi/math/lib/math.es.js\");\n/* harmony import */ var _pixi_mesh__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! @pixi/mesh */ \"./node_modules/@pixi/mesh/lib/mesh.es.js\");\n/* harmony import */ var _pixi_mesh_extras__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! @pixi/mesh-extras */ \"./node_modules/@pixi/mesh-extras/lib/mesh-extras.es.js\");\n/* harmony import */ var _pixi_runner__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! @pixi/runner */ \"./node_modules/@pixi/runner/lib/runner.es.js\");\n/* harmony import */ var _pixi_sprite__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! @pixi/sprite */ \"./node_modules/@pixi/sprite/lib/sprite.es.js\");\n/* harmony import */ var _pixi_sprite_animated__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! @pixi/sprite-animated */ \"./node_modules/@pixi/sprite-animated/lib/sprite-animated.es.js\");\n/* harmony import */ var _pixi_text__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! @pixi/text */ \"./node_modules/@pixi/text/lib/text.es.js\");\n/* harmony import */ var _pixi_settings__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! @pixi/settings */ \"./node_modules/@pixi/settings/lib/settings.es.js\");\n/*!\n * pixi.js - v5.3.11\n * Compiled Mon, 01 Nov 2021 16:10:12 UTC\n *\n * pixi.js is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } };\r\n return extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\n\nvar v5 = '5.0.0';\n/**\n * Deprecations (backward compatibilities) are automatically applied for browser bundles\n * in the UMD module format. If using Webpack or Rollup, you'll need to apply these\n * deprecations manually by doing something like this:\n * @example\n * import * as PIXI from 'pixi.js';\n * PIXI.useDeprecated(); // MUST be bound to namespace\n * @memberof PIXI\n * @function useDeprecated\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nfunction useDeprecated() {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n var PIXI = this;\n Object.defineProperties(PIXI, {\n /**\n * @constant {RegExp|string} SVG_SIZE\n * @memberof PIXI\n * @see PIXI.resources.SVGResource.SVG_SIZE\n * @deprecated since 5.0.0\n */\n SVG_SIZE: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.utils.SVG_SIZE property has moved to PIXI.resources.SVGResource.SVG_SIZE');\n return PIXI.SVGResource.SVG_SIZE;\n },\n },\n /**\n * @class PIXI.TransformStatic\n * @deprecated since 5.0.0\n * @see PIXI.Transform\n */\n TransformStatic: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.TransformStatic class has been removed, use PIXI.Transform');\n return PIXI.Transform;\n },\n },\n /**\n * @class PIXI.TransformBase\n * @deprecated since 5.0.0\n * @see PIXI.Transform\n */\n TransformBase: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.TransformBase class has been removed, use PIXI.Transform');\n return PIXI.Transform;\n },\n },\n /**\n * Constants that specify the transform type.\n *\n * @static\n * @constant\n * @name TRANSFORM_MODE\n * @memberof PIXI\n * @enum {number}\n * @deprecated since 5.0.0\n * @property {number} STATIC\n * @property {number} DYNAMIC\n */\n TRANSFORM_MODE: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.TRANSFORM_MODE property has been removed');\n return { STATIC: 0, DYNAMIC: 1 };\n },\n },\n /**\n * @class PIXI.WebGLRenderer\n * @see PIXI.Renderer\n * @deprecated since 5.0.0\n */\n WebGLRenderer: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.WebGLRenderer class has moved to PIXI.Renderer');\n return PIXI.Renderer;\n },\n },\n /**\n * @class PIXI.CanvasRenderTarget\n * @see PIXI.utils.CanvasRenderTarget\n * @deprecated since 5.0.0\n */\n CanvasRenderTarget: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.CanvasRenderTarget class has moved to PIXI.utils.CanvasRenderTarget');\n return PIXI.utils.CanvasRenderTarget;\n },\n },\n /**\n * @memberof PIXI\n * @name loader\n * @type {PIXI.Loader}\n * @see PIXI.Loader.shared\n * @deprecated since 5.0.0\n */\n loader: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.loader instance has moved to PIXI.Loader.shared');\n return PIXI.Loader.shared;\n },\n },\n /**\n * @class PIXI.FilterManager\n * @see PIXI.systems.FilterSystem\n * @deprecated since 5.0.0\n */\n FilterManager: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.FilterManager class has moved to PIXI.systems.FilterSystem');\n return PIXI.systems.FilterSystem;\n },\n },\n /**\n * @namespace PIXI.CanvasTinter\n * @see PIXI.canvasUtils\n * @deprecated since 5.2.0\n */\n CanvasTinter: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)('5.2.0', 'PIXI.CanvasTinter namespace has moved to PIXI.canvasUtils');\n return PIXI.canvasUtils;\n },\n },\n /**\n * @namespace PIXI.GroupD8\n * @see PIXI.groupD8\n * @deprecated since 5.2.0\n */\n GroupD8: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)('5.2.0', 'PIXI.GroupD8 namespace has moved to PIXI.groupD8');\n return PIXI.groupD8;\n },\n },\n });\n /**\n * @namespace PIXI.accessibility\n * @see PIXI\n * @deprecated since 5.3.0\n */\n PIXI.accessibility = {};\n Object.defineProperties(PIXI.accessibility, {\n /**\n * @class PIXI.accessibility.AccessibilityManager\n * @deprecated since 5.3.0\n * @see PIXI.AccessibilityManager\n */\n AccessibilityManager: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)('5.3.0', 'PIXI.accessibility.AccessibilityManager moved to PIXI.AccessibilityManager');\n return PIXI.AccessibilityManager;\n },\n },\n });\n /**\n * @namespace PIXI.interaction\n * @see PIXI\n * @deprecated since 5.3.0\n */\n PIXI.interaction = {};\n Object.defineProperties(PIXI.interaction, {\n /**\n * @class PIXI.interaction.InteractionManager\n * @deprecated since 5.3.0\n * @see PIXI.InteractionManager\n */\n InteractionManager: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)('5.3.0', 'PIXI.interaction.InteractionManager moved to PIXI.InteractionManager');\n return PIXI.InteractionManager;\n },\n },\n /**\n * @class PIXI.interaction.InteractionData\n * @deprecated since 5.3.0\n * @see PIXI.InteractionData\n */\n InteractionData: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)('5.3.0', 'PIXI.interaction.InteractionData moved to PIXI.InteractionData');\n return PIXI.InteractionData;\n },\n },\n /**\n * @class PIXI.interaction.InteractionEvent\n * @deprecated since 5.3.0\n * @see PIXI.InteractionEvent\n */\n InteractionEvent: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)('5.3.0', 'PIXI.interaction.InteractionEvent moved to PIXI.InteractionEvent');\n return PIXI.InteractionEvent;\n },\n },\n });\n /**\n * @namespace PIXI.prepare\n * @see PIXI\n * @deprecated since 5.2.1\n */\n PIXI.prepare = {};\n Object.defineProperties(PIXI.prepare, {\n /**\n * @class PIXI.prepare.BasePrepare\n * @deprecated since 5.2.1\n * @see PIXI.BasePrepare\n */\n BasePrepare: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)('5.2.1', 'PIXI.prepare.BasePrepare moved to PIXI.BasePrepare');\n return PIXI.BasePrepare;\n },\n },\n /**\n * @class PIXI.prepare.Prepare\n * @deprecated since 5.2.1\n * @see PIXI.Prepare\n */\n Prepare: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)('5.2.1', 'PIXI.prepare.Prepare moved to PIXI.Prepare');\n return PIXI.Prepare;\n },\n },\n /**\n * @class PIXI.prepare.CanvasPrepare\n * @deprecated since 5.2.1\n * @see PIXI.CanvasPrepare\n */\n CanvasPrepare: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)('5.2.1', 'PIXI.prepare.CanvasPrepare moved to PIXI.CanvasPrepare');\n return PIXI.CanvasPrepare;\n },\n },\n });\n /**\n * @namespace PIXI.extract\n * @see PIXI\n * @deprecated since 5.2.1\n */\n PIXI.extract = {};\n Object.defineProperties(PIXI.extract, {\n /**\n * @class PIXI.extract.Extract\n * @deprecated since 5.2.1\n * @see PIXI.Extract\n */\n Extract: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)('5.2.1', 'PIXI.extract.Extract moved to PIXI.Extract');\n return PIXI.Extract;\n },\n },\n /**\n * @class PIXI.extract.CanvasExtract\n * @deprecated since 5.2.1\n * @see PIXI.CanvasExtract\n */\n CanvasExtract: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)('5.2.1', 'PIXI.extract.CanvasExtract moved to PIXI.CanvasExtract');\n return PIXI.CanvasExtract;\n },\n },\n });\n /**\n * This namespace has been removed. All classes previous nested\n * under this namespace have been moved to the top-level `PIXI` object.\n * @namespace PIXI.extras\n * @deprecated since 5.0.0\n */\n PIXI.extras = {};\n Object.defineProperties(PIXI.extras, {\n /**\n * @class PIXI.extras.TilingSprite\n * @see PIXI.TilingSprite\n * @deprecated since 5.0.0\n */\n TilingSprite: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.extras.TilingSprite class has moved to PIXI.TilingSprite');\n return PIXI.TilingSprite;\n },\n },\n /**\n * @class PIXI.extras.TilingSpriteRenderer\n * @see PIXI.TilingSpriteRenderer\n * @deprecated since 5.0.0\n */\n TilingSpriteRenderer: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.extras.TilingSpriteRenderer class has moved to PIXI.TilingSpriteRenderer');\n return PIXI.TilingSpriteRenderer;\n },\n },\n /**\n * @class PIXI.extras.AnimatedSprite\n * @see PIXI.AnimatedSprite\n * @deprecated since 5.0.0\n */\n AnimatedSprite: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.extras.AnimatedSprite class has moved to PIXI.AnimatedSprite');\n return PIXI.AnimatedSprite;\n },\n },\n /**\n * @class PIXI.extras.BitmapText\n * @see PIXI.BitmapText\n * @deprecated since 5.0.0\n */\n BitmapText: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.extras.BitmapText class has moved to PIXI.BitmapText');\n return PIXI.BitmapText;\n },\n },\n });\n /**\n * @static\n * @method PIXI.TilingSprite.fromFrame\n * @deprecated since 5.3.0\n * @see PIXI.TilingSprite.from\n */\n PIXI.TilingSprite.fromFrame = function fromFrame(frameId, width, height) {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)('5.3.0', 'TilingSprite.fromFrame is deprecated, use TilingSprite.from');\n return PIXI.TilingSprite.from(frameId, { width: width, height: height });\n };\n /**\n * @static\n * @method PIXI.TilingSprite.fromImage\n * @deprecated since 5.3.0\n * @see PIXI.TilingSprite.from\n */\n PIXI.TilingSprite.fromImage = function fromImage(imageId, width, height, options) {\n if (options === void 0) { options = {}; }\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)('5.3.0', 'TilingSprite.fromImage is deprecated, use TilingSprite.from');\n // Fallback support for crossorigin, scaleMode parameters\n if (options && typeof options !== 'object') {\n options = {\n // eslint-disable-next-line prefer-rest-params\n scaleMode: arguments[4],\n resourceOptions: {\n // eslint-disable-next-line prefer-rest-params\n crossorigin: arguments[3],\n },\n };\n }\n options.width = width;\n options.height = height;\n return PIXI.TilingSprite.from(imageId, options);\n };\n Object.defineProperties(PIXI.utils, {\n /**\n * @function PIXI.utils.getSvgSize\n * @see PIXI.resources.SVGResource.getSize\n * @deprecated since 5.0.0\n */\n getSvgSize: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.utils.getSvgSize function has moved to PIXI.resources.SVGResource.getSize');\n return PIXI.resources.SVGResource.getSize;\n },\n },\n });\n /**\n * All classes on this namespace have moved to the high-level `PIXI` object.\n * @namespace PIXI.mesh\n * @deprecated since 5.0.0\n */\n PIXI.mesh = {};\n Object.defineProperties(PIXI.mesh, {\n /**\n * @class PIXI.mesh.Mesh\n * @see PIXI.SimpleMesh\n * @deprecated since 5.0.0\n */\n Mesh: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.mesh.Mesh class has moved to PIXI.SimpleMesh');\n return PIXI.SimpleMesh;\n },\n },\n /**\n * @class PIXI.mesh.NineSlicePlane\n * @see PIXI.NineSlicePlane\n * @deprecated since 5.0.0\n */\n NineSlicePlane: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.mesh.NineSlicePlane class has moved to PIXI.NineSlicePlane');\n return PIXI.NineSlicePlane;\n },\n },\n /**\n * @class PIXI.mesh.Plane\n * @see PIXI.SimplePlane\n * @deprecated since 5.0.0\n */\n Plane: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.mesh.Plane class has moved to PIXI.SimplePlane');\n return PIXI.SimplePlane;\n },\n },\n /**\n * @class PIXI.mesh.Rope\n * @see PIXI.SimpleRope\n * @deprecated since 5.0.0\n */\n Rope: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.mesh.Rope class has moved to PIXI.SimpleRope');\n return PIXI.SimpleRope;\n },\n },\n /**\n * @class PIXI.mesh.RawMesh\n * @see PIXI.Mesh\n * @deprecated since 5.0.0\n */\n RawMesh: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.mesh.RawMesh class has moved to PIXI.Mesh');\n return PIXI.Mesh;\n },\n },\n /**\n * @class PIXI.mesh.CanvasMeshRenderer\n * @see PIXI.CanvasMeshRenderer\n * @deprecated since 5.0.0\n */\n CanvasMeshRenderer: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.mesh.CanvasMeshRenderer class has moved to PIXI.CanvasMeshRenderer');\n return PIXI.CanvasMeshRenderer;\n },\n },\n /**\n * @class PIXI.mesh.MeshRenderer\n * @see PIXI.MeshRenderer\n * @deprecated since 5.0.0\n */\n MeshRenderer: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.mesh.MeshRenderer class has moved to PIXI.MeshRenderer');\n return PIXI.MeshRenderer;\n },\n },\n });\n /**\n * This namespace has been removed and items have been moved to\n * the top-level `PIXI` object.\n * @namespace PIXI.particles\n * @deprecated since 5.0.0\n */\n PIXI.particles = {};\n Object.defineProperties(PIXI.particles, {\n /**\n * @class PIXI.particles.ParticleContainer\n * @deprecated since 5.0.0\n * @see PIXI.ParticleContainer\n */\n ParticleContainer: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.particles.ParticleContainer class has moved to PIXI.ParticleContainer');\n return PIXI.ParticleContainer;\n },\n },\n /**\n * @class PIXI.particles.ParticleRenderer\n * @deprecated since 5.0.0\n * @see PIXI.ParticleRenderer\n */\n ParticleRenderer: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.particles.ParticleRenderer class has moved to PIXI.ParticleRenderer');\n return PIXI.ParticleRenderer;\n },\n },\n });\n /**\n * This namespace has been removed and items have been moved to\n * the top-level `PIXI` object.\n * @namespace PIXI.ticker\n * @deprecated since 5.0.0\n */\n PIXI.ticker = {};\n Object.defineProperties(PIXI.ticker, {\n /**\n * @class PIXI.ticker.Ticker\n * @deprecated since 5.0.0\n * @see PIXI.Ticker\n */\n Ticker: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.ticker.Ticker class has moved to PIXI.Ticker');\n return PIXI.Ticker;\n },\n },\n /**\n * @name PIXI.ticker.shared\n * @type {PIXI.Ticker}\n * @deprecated since 5.0.0\n * @see PIXI.Ticker.shared\n */\n shared: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.ticker.shared instance has moved to PIXI.Ticker.shared');\n return PIXI.Ticker.shared;\n },\n },\n });\n /**\n * All classes on this namespace have moved to the high-level `PIXI` object.\n * @namespace PIXI.loaders\n * @deprecated since 5.0.0\n */\n PIXI.loaders = {};\n Object.defineProperties(PIXI.loaders, {\n /**\n * @class PIXI.loaders.Loader\n * @see PIXI.Loader\n * @deprecated since 5.0.0\n */\n Loader: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.loaders.Loader class has moved to PIXI.Loader');\n return PIXI.Loader;\n },\n },\n /**\n * @class PIXI.loaders.Resource\n * @see PIXI.LoaderResource\n * @deprecated since 5.0.0\n */\n Resource: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.loaders.Resource class has moved to PIXI.LoaderResource');\n return PIXI.LoaderResource;\n },\n },\n /**\n * @function PIXI.loaders.bitmapFontParser\n * @see PIXI.BitmapFontLoader.use\n * @deprecated since 5.0.0\n */\n bitmapFontParser: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.loaders.bitmapFontParser function has moved to PIXI.BitmapFontLoader.use');\n return PIXI.BitmapFontLoader.use;\n },\n },\n /**\n * @function PIXI.loaders.parseBitmapFontData\n * @deprecated since 5.0.0\n */\n parseBitmapFontData: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.loaders.parseBitmapFontData function has removed');\n },\n },\n /**\n * @function PIXI.loaders.spritesheetParser\n * @see PIXI.SpritesheetLoader.use\n * @deprecated since 5.0.0\n */\n spritesheetParser: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.loaders.spritesheetParser function has moved to PIXI.SpritesheetLoader.use');\n return PIXI.SpritesheetLoader.use;\n },\n },\n /**\n * @function PIXI.loaders.getResourcePath\n * @see PIXI.SpritesheetLoader.getResourcePath\n * @deprecated since 5.0.0\n */\n getResourcePath: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.loaders.getResourcePath property has moved to PIXI.SpritesheetLoader.getResourcePath');\n return PIXI.SpritesheetLoader.getResourcePath;\n },\n },\n });\n /**\n * @function PIXI.loaders.Loader.addPixiMiddleware\n * @see PIXI.Loader.registerPlugin\n * @deprecated since 5.0.0\n * @param {function} middleware\n */\n PIXI.Loader.addPixiMiddleware = function addPixiMiddleware(middleware) {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.loaders.Loader.addPixiMiddleware function is deprecated, use PIXI.loaders.Loader.registerPlugin');\n return PIXI.loaders.Loader.registerPlugin({ use: middleware() });\n };\n // convenience for converting event name to signal name\n var eventToSignal = function (event) {\n return \"on\" + event.charAt(0).toUpperCase() + event.slice(1);\n };\n Object.assign(PIXI.Loader.prototype, {\n /**\n * Use the corresponding signal, e.g., event `start`` is signal `onStart`.\n * @method PIXI.Loader#on\n * @deprecated since 5.0.0\n */\n on: function (event) {\n var signal = eventToSignal(event);\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, \"PIXI.Loader#on is completely deprecated, use PIXI.Loader#\" + signal + \".add\");\n },\n /**\n * Use the corresponding signal, e.g., event `start`` is signal `onStart`.\n * @method PIXI.Loader#once\n * @deprecated since 5.0.0\n */\n once: function (event) {\n var signal = eventToSignal(event);\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, \"PIXI.Loader#once is completely deprecated, use PIXI.Loader#\" + signal + \".once\");\n },\n /**\n * Use the corresponding signal, e.g., event `start`` is signal `onStart`.\n * @method PIXI.Loader#off\n * @deprecated since 5.0.0\n */\n off: function (event) {\n var signal = eventToSignal(event);\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, \"PIXI.Loader#off is completely deprecated, use PIXI.Loader#\" + signal + \".detach\");\n },\n });\n /**\n * @class PIXI.extract.WebGLExtract\n * @deprecated since 5.0.0\n * @see PIXI.Extract\n */\n Object.defineProperty(PIXI.extract, 'WebGLExtract', {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.extract.WebGLExtract method has moved to PIXI.Extract');\n return PIXI.Extract;\n },\n });\n /**\n * @class PIXI.prepare.WebGLPrepare\n * @deprecated since 5.0.0\n * @see PIXI.Prepare\n */\n Object.defineProperty(PIXI.prepare, 'WebGLPrepare', {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.prepare.WebGLPrepare class has moved to PIXI.Prepare');\n return PIXI.Prepare;\n },\n });\n /**\n * @method PIXI.Container#_renderWebGL\n * @private\n * @deprecated since 5.0.0\n * @see PIXI.Container#render\n * @param {PIXI.Renderer} renderer Instance of renderer\n */\n PIXI.Container.prototype._renderWebGL = function _renderWebGL(renderer) {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.Container._renderWebGL method has moved to PIXI.Container._render');\n this._render(renderer);\n };\n /**\n * @method PIXI.Container#renderWebGL\n * @deprecated since 5.0.0\n * @see PIXI.Container#render\n * @param {PIXI.Renderer} renderer Instance of renderer\n */\n PIXI.Container.prototype.renderWebGL = function renderWebGL(renderer) {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.Container.renderWebGL method has moved to PIXI.Container.render');\n this.render(renderer);\n };\n /**\n * @method PIXI.DisplayObject#renderWebGL\n * @deprecated since 5.0.0\n * @see PIXI.DisplayObject#render\n * @param {PIXI.Renderer} renderer Instance of renderer\n */\n PIXI.DisplayObject.prototype.renderWebGL = function renderWebGL(renderer) {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.DisplayObject.renderWebGL method has moved to PIXI.DisplayObject.render');\n this.render(renderer);\n };\n /**\n * @method PIXI.Container#renderAdvancedWebGL\n * @deprecated since 5.0.0\n * @see PIXI.Container#renderAdvanced\n * @param {PIXI.Renderer} renderer Instance of renderer\n */\n PIXI.Container.prototype.renderAdvancedWebGL = function renderAdvancedWebGL(renderer) {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.Container.renderAdvancedWebGL method has moved to PIXI.Container.renderAdvanced');\n this.renderAdvanced(renderer);\n };\n Object.defineProperties(PIXI.settings, {\n /**\n * Default transform type.\n *\n * @static\n * @deprecated since 5.0.0\n * @memberof PIXI.settings\n * @type {PIXI.TRANSFORM_MODE}\n * @default PIXI.TRANSFORM_MODE.STATIC\n */\n TRANSFORM_MODE: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.settings.TRANSFORM_MODE property has been removed');\n return 0;\n },\n set: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.settings.TRANSFORM_MODE property has been removed');\n },\n },\n });\n var BaseTextureAny = PIXI.BaseTexture;\n /**\n * @method loadSource\n * @memberof PIXI.BaseTexture#\n * @deprecated since 5.0.0\n */\n BaseTextureAny.prototype.loadSource = function loadSource(image) {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.BaseTexture.loadSource method has been deprecated');\n var resource = PIXI.resources.autoDetectResource(image);\n resource.internal = true;\n this.setResource(resource);\n this.update();\n };\n var baseTextureIdDeprecation = false;\n Object.defineProperties(BaseTextureAny.prototype, {\n /**\n * @name PIXI.BaseTexture#hasLoaded\n * @type {boolean}\n * @deprecated since 5.0.0\n * @readonly\n * @see PIXI.BaseTexture#valid\n */\n hasLoaded: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.BaseTexture.hasLoaded property has been removed, use PIXI.BaseTexture.valid');\n return this.valid;\n },\n },\n /**\n * @name PIXI.BaseTexture#imageUrl\n * @type {string}\n * @deprecated since 5.0.0\n * @see PIXI.resources.ImageResource#url\n */\n imageUrl: {\n get: function () {\n var _a;\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.BaseTexture.imageUrl property has been removed, use PIXI.BaseTexture.resource.url');\n return (_a = this.resource) === null || _a === void 0 ? void 0 : _a.url;\n },\n set: function (imageUrl) {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.BaseTexture.imageUrl property has been removed, use PIXI.BaseTexture.resource.url');\n if (this.resource) {\n this.resource.url = imageUrl;\n }\n },\n },\n /**\n * @name PIXI.BaseTexture#source\n * @type {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement}\n * @deprecated since 5.0.0\n * @readonly\n * @see PIXI.resources.BaseImageResource#source\n */\n source: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.BaseTexture.source property has been moved, use `PIXI.BaseTexture.resource.source`');\n return this.resource.source;\n },\n set: function (source) {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.BaseTexture.source property has been moved, use `PIXI.BaseTexture.resource.source` '\n + 'if you want to set HTMLCanvasElement. Otherwise, create new BaseTexture.');\n if (this.resource) {\n this.resource.source = source;\n }\n },\n },\n /**\n * @name PIXI.BaseTexture#premultiplyAlpha\n * @type {boolean}\n * @deprecated since 5.2.0\n * @readonly\n * @see PIXI.BaseTexture#alphaMode\n */\n premultiplyAlpha: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)('5.2.0', 'PIXI.BaseTexture.premultiplyAlpha property has been changed to `alphaMode`'\n + ', see `PIXI.ALPHA_MODES`');\n return this.alphaMode !== 0;\n },\n set: function (value) {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)('5.2.0', 'PIXI.BaseTexture.premultiplyAlpha property has been changed to `alphaMode`'\n + ', see `PIXI.ALPHA_MODES`');\n this.alphaMode = Number(value);\n },\n },\n /**\n * Batch local field, stores current texture location\n *\n * @name PIXI.BaseTexture#_id\n * @deprecated since 5.2.0\n * @type {number}\n * @see PIXI.BaseTexture#_batchLocation\n */\n _id: {\n get: function () {\n if (!baseTextureIdDeprecation) {\n // #popelyshev: That property was a hot place, I don't want to call deprecation method on it if possible\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)('5.2.0', 'PIXI.BaseTexture._id batch local field has been changed to `_batchLocation`');\n baseTextureIdDeprecation = true;\n }\n return this._batchLocation;\n },\n set: function (value) {\n this._batchLocation = value;\n },\n },\n });\n /**\n * @method fromImage\n * @static\n * @memberof PIXI.BaseTexture\n * @deprecated since 5.0.0\n * @see PIXI.BaseTexture.from\n */\n BaseTextureAny.fromImage = function fromImage(canvas, crossorigin, scaleMode, scale) {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.BaseTexture.fromImage method has been replaced with PIXI.BaseTexture.from');\n var resourceOptions = { scale: scale, crossorigin: crossorigin };\n return BaseTextureAny.from(canvas, { scaleMode: scaleMode, resourceOptions: resourceOptions });\n };\n /**\n * @method fromCanvas\n * @static\n * @memberof PIXI.BaseTexture\n * @deprecated since 5.0.0\n * @see PIXI.BaseTexture.from\n */\n BaseTextureAny.fromCanvas = function fromCanvas(canvas, scaleMode) {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.BaseTexture.fromCanvas method has been replaced with PIXI.BaseTexture.from');\n return BaseTextureAny.from(canvas, { scaleMode: scaleMode });\n };\n /**\n * @method fromSVG\n * @static\n * @memberof PIXI.BaseTexture\n * @deprecated since 5.0.0\n * @see PIXI.BaseTexture.from\n */\n BaseTextureAny.fromSVG = function fromSVG(canvas, crossorigin, scaleMode, scale) {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.BaseTexture.fromSVG method has been replaced with PIXI.BaseTexture.from');\n var resourceOptions = { scale: scale, crossorigin: crossorigin };\n return BaseTextureAny.from(canvas, { scaleMode: scaleMode, resourceOptions: resourceOptions });\n };\n Object.defineProperties(PIXI.resources.ImageResource.prototype, {\n /**\n * @name PIXI.resources.ImageResource#premultiplyAlpha\n * @type {boolean}\n * @deprecated since 5.2.0\n * @readonly\n * @see PIXI.resources.ImageResource#alphaMode\n */\n premultiplyAlpha: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)('5.2.0', 'PIXI.resources.ImageResource.premultiplyAlpha property '\n + 'has been changed to `alphaMode`, see `PIXI.ALPHA_MODES`');\n return this.alphaMode !== 0;\n },\n set: function (value) {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)('5.2.0', 'PIXI.resources.ImageResource.premultiplyAlpha property '\n + 'has been changed to `alphaMode`, see `PIXI.ALPHA_MODES`');\n this.alphaMode = Number(value);\n },\n },\n });\n /**\n * @method PIXI.Point#copy\n * @deprecated since 5.0.0\n * @see PIXI.Point#copyFrom\n */\n PIXI.Point.prototype.copy = function copy(p) {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.Point.copy method has been replaced with PIXI.Point.copyFrom');\n return this.copyFrom(p);\n };\n /**\n * @method PIXI.ObservablePoint#copy\n * @deprecated since 5.0.0\n * @see PIXI.ObservablePoint#copyFrom\n */\n PIXI.ObservablePoint.prototype.copy = function copy(p) {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.ObservablePoint.copy method has been replaced with PIXI.ObservablePoint.copyFrom');\n return this.copyFrom(p);\n };\n /**\n * @method PIXI.Rectangle#copy\n * @deprecated since 5.0.0\n * @see PIXI.Rectangle#copyFrom\n */\n PIXI.Rectangle.prototype.copy = function copy(p) {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.Rectangle.copy method has been replaced with PIXI.Rectangle.copyFrom');\n return this.copyFrom(p);\n };\n /**\n * @method PIXI.Matrix#copy\n * @deprecated since 5.0.0\n * @see PIXI.Matrix#copyTo\n */\n PIXI.Matrix.prototype.copy = function copy(p) {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.Matrix.copy method has been replaced with PIXI.Matrix.copyTo');\n return this.copyTo(p);\n };\n /**\n * @method PIXI.systems.StateSystem#setState\n * @deprecated since 5.1.0\n * @see PIXI.systems.StateSystem#set\n */\n PIXI.systems.StateSystem.prototype.setState = function setState(s) {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)('v5.1.0', 'StateSystem.setState has been renamed to StateSystem.set');\n return this.set(s);\n };\n Object.assign(PIXI.systems.FilterSystem.prototype, {\n /**\n * @method PIXI.FilterManager#getRenderTarget\n * @deprecated since 5.0.0\n * @see PIXI.systems.FilterSystem#getFilterTexture\n */\n getRenderTarget: function (_clear, resolution) {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.FilterManager.getRenderTarget method has been replaced with PIXI.systems.FilterSystem#getFilterTexture');\n return this.getFilterTexture(null, resolution);\n },\n /**\n * @method PIXI.FilterManager#returnRenderTarget\n * @deprecated since 5.0.0\n * @see PIXI.systems.FilterSystem#returnFilterTexture\n */\n returnRenderTarget: function (renderTexture) {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.FilterManager.returnRenderTarget method has been replaced with '\n + 'PIXI.systems.FilterSystem.returnFilterTexture');\n this.returnFilterTexture(renderTexture);\n },\n /**\n * @method PIXI.systems.FilterSystem#calculateScreenSpaceMatrix\n * @deprecated since 5.0.0\n * @param {PIXI.Matrix} outputMatrix - the matrix to output to.\n * @return {PIXI.Matrix} The mapped matrix.\n */\n calculateScreenSpaceMatrix: function (outputMatrix) {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.systems.FilterSystem.calculateScreenSpaceMatrix method is removed, '\n + 'use `(vTextureCoord * inputSize.xy) + outputFrame.xy` instead');\n var mappedMatrix = outputMatrix.identity();\n var _a = this.activeState, sourceFrame = _a.sourceFrame, destinationFrame = _a.destinationFrame;\n mappedMatrix.translate(sourceFrame.x / destinationFrame.width, sourceFrame.y / destinationFrame.height);\n mappedMatrix.scale(destinationFrame.width, destinationFrame.height);\n return mappedMatrix;\n },\n /**\n * @method PIXI.systems.FilterSystem#calculateNormalizedScreenSpaceMatrix\n * @deprecated since 5.0.0\n * @param {PIXI.Matrix} outputMatrix - The matrix to output to.\n * @return {PIXI.Matrix} The mapped matrix.\n */\n calculateNormalizedScreenSpaceMatrix: function (outputMatrix) {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.systems.FilterManager.calculateNormalizedScreenSpaceMatrix method is removed, '\n + 'use `((vTextureCoord * inputSize.xy) + outputFrame.xy) / outputFrame.zw` instead.');\n var _a = this.activeState, sourceFrame = _a.sourceFrame, destinationFrame = _a.destinationFrame;\n var mappedMatrix = outputMatrix.identity();\n mappedMatrix.translate(sourceFrame.x / destinationFrame.width, sourceFrame.y / destinationFrame.height);\n var translateScaleX = (destinationFrame.width / sourceFrame.width);\n var translateScaleY = (destinationFrame.height / sourceFrame.height);\n mappedMatrix.scale(translateScaleX, translateScaleY);\n return mappedMatrix;\n },\n });\n Object.defineProperties(PIXI.RenderTexture.prototype, {\n /**\n * @name PIXI.RenderTexture#sourceFrame\n * @type {PIXI.Rectangle}\n * @deprecated since 5.0.0\n * @readonly\n */\n sourceFrame: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.RenderTexture.sourceFrame property has been removed');\n return this.filterFrame;\n },\n },\n /**\n * @name PIXI.RenderTexture#size\n * @type {PIXI.Rectangle}\n * @deprecated since 5.0.0\n * @readonly\n */\n size: {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.RenderTexture.size property has been removed');\n return this._frame;\n },\n },\n });\n /**\n * @class BlurXFilter\n * @memberof PIXI.filters\n * @deprecated since 5.0.0\n * @see PIXI.filters.BlurFilterPass\n */\n var BlurXFilter = /** @class */ (function (_super) {\n __extends(BlurXFilter, _super);\n function BlurXFilter(strength, quality, resolution, kernelSize) {\n var _this = this;\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.filters.BlurXFilter class is deprecated, use PIXI.filters.BlurFilterPass');\n _this = _super.call(this, true, strength, quality, resolution, kernelSize) || this;\n return _this;\n }\n return BlurXFilter;\n }(PIXI.filters.BlurFilterPass));\n /**\n * @class BlurYFilter\n * @memberof PIXI.filters\n * @deprecated since 5.0.0\n * @see PIXI.filters.BlurFilterPass\n */\n var BlurYFilter = /** @class */ (function (_super) {\n __extends(BlurYFilter, _super);\n function BlurYFilter(strength, quality, resolution, kernelSize) {\n var _this = this;\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.filters.BlurYFilter class is deprecated, use PIXI.filters.BlurFilterPass');\n _this = _super.call(this, false, strength, quality, resolution, kernelSize) || this;\n return _this;\n }\n return BlurYFilter;\n }(PIXI.filters.BlurFilterPass));\n Object.assign(PIXI.filters, {\n BlurXFilter: BlurXFilter,\n BlurYFilter: BlurYFilter,\n });\n var SpriteAny = PIXI.Sprite, TextureAny = PIXI.Texture, GraphicsAny = PIXI.Graphics;\n // Support for pixi.js-legacy bifurcation\n // give users a friendly assist to use legacy\n if (!GraphicsAny.prototype.generateCanvasTexture) {\n GraphicsAny.prototype.generateCanvasTexture = function generateCanvasTexture() {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.Graphics.generateCanvasTexture method is only available in \"pixi.js-legacy\"');\n };\n }\n /**\n * @deprecated since 5.0.0\n * @member {PIXI.Graphics} PIXI.Graphics#graphicsData\n * @see PIXI.Graphics#geometry\n * @readonly\n */\n Object.defineProperty(GraphicsAny.prototype, 'graphicsData', {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.Graphics.graphicsData property is deprecated, use PIXI.Graphics.geometry.graphicsData');\n return this.geometry.graphicsData;\n },\n });\n // Use these to deprecate all the Sprite from* methods\n function spriteFrom(name, source, crossorigin, scaleMode) {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, \"PIXI.Sprite.\" + name + \" method is deprecated, use PIXI.Sprite.from\");\n return SpriteAny.from(source, {\n resourceOptions: {\n scale: scaleMode,\n crossorigin: crossorigin,\n },\n });\n }\n /**\n * @deprecated since 5.0.0\n * @see PIXI.Sprite.from\n * @method PIXI.Sprite.fromImage\n * @return {PIXI.Sprite}\n */\n SpriteAny.fromImage = spriteFrom.bind(null, 'fromImage');\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Sprite.fromSVG\n * @see PIXI.Sprite.from\n * @return {PIXI.Sprite}\n */\n SpriteAny.fromSVG = spriteFrom.bind(null, 'fromSVG');\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Sprite.fromCanvas\n * @see PIXI.Sprite.from\n * @return {PIXI.Sprite}\n */\n SpriteAny.fromCanvas = spriteFrom.bind(null, 'fromCanvas');\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Sprite.fromVideo\n * @see PIXI.Sprite.from\n * @return {PIXI.Sprite}\n */\n SpriteAny.fromVideo = spriteFrom.bind(null, 'fromVideo');\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Sprite.fromFrame\n * @see PIXI.Sprite.from\n * @return {PIXI.Sprite}\n */\n SpriteAny.fromFrame = spriteFrom.bind(null, 'fromFrame');\n // Use these to deprecate all the Texture from* methods\n function textureFrom(name, source, crossorigin, scaleMode) {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, \"PIXI.Texture.\" + name + \" method is deprecated, use PIXI.Texture.from\");\n return TextureAny.from(source, {\n resourceOptions: {\n scale: scaleMode,\n crossorigin: crossorigin,\n },\n });\n }\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Texture.fromImage\n * @see PIXI.Texture.from\n * @return {PIXI.Texture}\n */\n TextureAny.fromImage = textureFrom.bind(null, 'fromImage');\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Texture.fromSVG\n * @see PIXI.Texture.from\n * @return {PIXI.Texture}\n */\n TextureAny.fromSVG = textureFrom.bind(null, 'fromSVG');\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Texture.fromCanvas\n * @see PIXI.Texture.from\n * @return {PIXI.Texture}\n */\n TextureAny.fromCanvas = textureFrom.bind(null, 'fromCanvas');\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Texture.fromVideo\n * @see PIXI.Texture.from\n * @return {PIXI.Texture}\n */\n TextureAny.fromVideo = textureFrom.bind(null, 'fromVideo');\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Texture.fromFrame\n * @see PIXI.Texture.from\n * @return {PIXI.Texture}\n */\n TextureAny.fromFrame = textureFrom.bind(null, 'fromFrame');\n /**\n * @deprecated since 5.0.0\n * @member {boolean} PIXI.AbstractRenderer#autoResize\n * @see PIXI.AbstractRenderer#autoDensity\n */\n Object.defineProperty(PIXI.AbstractRenderer.prototype, 'autoResize', {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.AbstractRenderer.autoResize property is deprecated, '\n + 'use PIXI.AbstractRenderer.autoDensity');\n return this.autoDensity;\n },\n set: function (value) {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.AbstractRenderer.autoResize property is deprecated, '\n + 'use PIXI.AbstractRenderer.autoDensity');\n this.autoDensity = value;\n },\n });\n /**\n * @deprecated since 5.0.0\n * @member {PIXI.systems.TextureSystem} PIXI.Renderer#textureManager\n * @see PIXI.Renderer#texture\n */\n Object.defineProperty(PIXI.Renderer.prototype, 'textureManager', {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.Renderer.textureManager property is deprecated, use PIXI.Renderer.texture');\n return this.texture;\n },\n });\n /**\n * @namespace PIXI.utils.mixins\n * @deprecated since 5.0.0\n */\n PIXI.utils.mixins = {\n /**\n * @memberof PIXI.utils.mixins\n * @function mixin\n * @deprecated since 5.0.0\n */\n mixin: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.utils.mixins.mixin function is no longer available');\n },\n /**\n * @memberof PIXI.utils.mixins\n * @function delayMixin\n * @deprecated since 5.0.0\n */\n delayMixin: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.utils.mixins.delayMixin function is no longer available');\n },\n /**\n * @memberof PIXI.utils.mixins\n * @function performMixins\n * @deprecated since 5.0.0\n */\n performMixins: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)(v5, 'PIXI.utils.mixins.performMixins function is no longer available');\n },\n };\n /**\n * @memberof PIXI.BitmapText\n * @member {object} font\n * @deprecated since 5.3.0\n */\n Object.defineProperty(PIXI.BitmapText.prototype, 'font', {\n get: function () {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)('5.3.0', 'PIXI.BitmapText.font property is deprecated, '\n + 'use fontName, fontSize, tint or align properties');\n return {\n name: this._fontName,\n size: this._fontSize,\n tint: this._tint,\n align: this._align,\n };\n },\n set: function (value) {\n (0,_pixi_utils__WEBPACK_IMPORTED_MODULE_1__.deprecation)('5.3.0', 'PIXI.BitmapText.font property is deprecated, '\n + 'use fontName, fontSize, tint or align properties');\n if (!value) {\n return;\n }\n var style = { font: value };\n this._upgradeStyle(style);\n style.fontSize = style.fontSize || PIXI.BitmapFont.available[style.fontName].size;\n this._fontName = style.fontName;\n this._fontSize = style.fontSize;\n this.dirty = true;\n },\n });\n}\n\n// Install renderer plugins\n_pixi_core__WEBPACK_IMPORTED_MODULE_5__.Renderer.registerPlugin('accessibility', _pixi_accessibility__WEBPACK_IMPORTED_MODULE_2__.AccessibilityManager);\n_pixi_core__WEBPACK_IMPORTED_MODULE_5__.Renderer.registerPlugin('extract', _pixi_extract__WEBPACK_IMPORTED_MODULE_6__.Extract);\n_pixi_core__WEBPACK_IMPORTED_MODULE_5__.Renderer.registerPlugin('interaction', _pixi_interaction__WEBPACK_IMPORTED_MODULE_3__.InteractionManager);\n_pixi_core__WEBPACK_IMPORTED_MODULE_5__.Renderer.registerPlugin('particle', _pixi_particles__WEBPACK_IMPORTED_MODULE_8__.ParticleRenderer);\n_pixi_core__WEBPACK_IMPORTED_MODULE_5__.Renderer.registerPlugin('prepare', _pixi_prepare__WEBPACK_IMPORTED_MODULE_9__.Prepare);\n_pixi_core__WEBPACK_IMPORTED_MODULE_5__.Renderer.registerPlugin('batch', _pixi_core__WEBPACK_IMPORTED_MODULE_5__.BatchRenderer);\n_pixi_core__WEBPACK_IMPORTED_MODULE_5__.Renderer.registerPlugin('tilingSprite', _pixi_sprite_tiling__WEBPACK_IMPORTED_MODULE_11__.TilingSpriteRenderer);\n_pixi_loaders__WEBPACK_IMPORTED_MODULE_7__.Loader.registerPlugin(_pixi_text_bitmap__WEBPACK_IMPORTED_MODULE_12__.BitmapFontLoader);\n_pixi_loaders__WEBPACK_IMPORTED_MODULE_7__.Loader.registerPlugin(_pixi_spritesheet__WEBPACK_IMPORTED_MODULE_10__.SpritesheetLoader);\n_pixi_app__WEBPACK_IMPORTED_MODULE_4__.Application.registerPlugin(_pixi_ticker__WEBPACK_IMPORTED_MODULE_13__.TickerPlugin);\n_pixi_app__WEBPACK_IMPORTED_MODULE_4__.Application.registerPlugin(_pixi_loaders__WEBPACK_IMPORTED_MODULE_7__.AppLoaderPlugin);\n/**\n * String of the current PIXI version.\n *\n * @static\n * @constant\n * @memberof PIXI\n * @name VERSION\n * @type {string}\n */\nvar VERSION = '5.3.11';\n/**\n * @namespace PIXI\n */\n/**\n * This namespace contains WebGL-only display filters that can be applied\n * to DisplayObjects using the {@link PIXI.DisplayObject#filters filters} property.\n *\n * Since PixiJS only had a handful of built-in filters, additional filters\n * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the\n * PixiJS Filters repository.\n *\n * All filters must extend {@link PIXI.Filter}.\n *\n * @example\n * // Create a new application\n * const app = new PIXI.Application();\n *\n * // Draw a green rectangle\n * const rect = new PIXI.Graphics()\n * .beginFill(0x00ff00)\n * .drawRect(40, 40, 200, 200);\n *\n * // Add a blur filter\n * rect.filters = [new PIXI.filters.BlurFilter()];\n *\n * // Display rectangle\n * app.stage.addChild(rect);\n * document.body.appendChild(app.view);\n * @namespace PIXI.filters\n */\nvar filters = {\n AlphaFilter: _pixi_filter_alpha__WEBPACK_IMPORTED_MODULE_14__.AlphaFilter,\n BlurFilter: _pixi_filter_blur__WEBPACK_IMPORTED_MODULE_15__.BlurFilter,\n BlurFilterPass: _pixi_filter_blur__WEBPACK_IMPORTED_MODULE_15__.BlurFilterPass,\n ColorMatrixFilter: _pixi_filter_color_matrix__WEBPACK_IMPORTED_MODULE_16__.ColorMatrixFilter,\n DisplacementFilter: _pixi_filter_displacement__WEBPACK_IMPORTED_MODULE_17__.DisplacementFilter,\n FXAAFilter: _pixi_filter_fxaa__WEBPACK_IMPORTED_MODULE_18__.FXAAFilter,\n NoiseFilter: _pixi_filter_noise__WEBPACK_IMPORTED_MODULE_19__.NoiseFilter,\n};\n\n\n//# sourceMappingURL=pixi.es.js.map\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/pixi.js/lib/pixi.es.js?"); /***/ }), /***/ "./node_modules/resource-loader/dist/resource-loader.esm.js": /*!******************************************************************!*\ !*** ./node_modules/resource-loader/dist/resource-loader.esm.js ***! \******************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Loader\": () => (/* binding */ Loader),\n/* harmony export */ \"Resource\": () => (/* binding */ Resource),\n/* harmony export */ \"async\": () => (/* binding */ async),\n/* harmony export */ \"encodeBinary\": () => (/* binding */ encodeBinary),\n/* harmony export */ \"middleware\": () => (/* binding */ index)\n/* harmony export */ });\n/* harmony import */ var parse_uri__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! parse-uri */ \"./node_modules/parse-uri/index.js\");\n/* harmony import */ var parse_uri__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(parse_uri__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var mini_signals__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! mini-signals */ \"./node_modules/mini-signals/lib/mini-signals.js\");\n/* harmony import */ var mini_signals__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(mini_signals__WEBPACK_IMPORTED_MODULE_1__);\n/*!\n * resource-loader - v3.0.1\n * https://github.com/pixijs/pixi-sound\n * Compiled Tue, 02 Jul 2019 14:06:18 UTC\n *\n * resource-loader is licensed under the MIT license.\n * http://www.opensource.org/licenses/mit-license\n */\n\n\n\n/**\n * Smaller version of the async library constructs.\n *\n * @namespace async\n */\n\n/**\n * Noop function\n *\n * @ignore\n * @function\n * @memberof async\n */\nfunction _noop() {}\n/* empty */\n\n/**\n * Iterates an array in series.\n *\n * @memberof async\n * @function eachSeries\n * @param {Array.<*>} array - Array to iterate.\n * @param {function} iterator - Function to call for each element.\n * @param {function} callback - Function to call when done, or on error.\n * @param {boolean} [deferNext=false] - Break synchronous each loop by calling next with a setTimeout of 1.\n */\n\n\nfunction eachSeries(array, iterator, callback, deferNext) {\n var i = 0;\n var len = array.length;\n\n (function next(err) {\n if (err || i === len) {\n if (callback) {\n callback(err);\n }\n\n return;\n }\n\n if (deferNext) {\n setTimeout(function () {\n iterator(array[i++], next);\n }, 1);\n } else {\n iterator(array[i++], next);\n }\n })();\n}\n/**\n * Ensures a function is only called once.\n *\n * @ignore\n * @memberof async\n * @param {function} fn - The function to wrap.\n * @return {function} The wrapping function.\n */\n\nfunction onlyOnce(fn) {\n return function onceWrapper() {\n if (fn === null) {\n throw new Error('Callback was already called.');\n }\n\n var callFn = fn;\n fn = null;\n callFn.apply(this, arguments);\n };\n}\n/**\n * Async queue implementation,\n *\n * @memberof async\n * @function queue\n * @param {function} worker - The worker function to call for each task.\n * @param {number} concurrency - How many workers to run in parrallel.\n * @return {*} The async queue object.\n */\n\n\nfunction queue(worker, concurrency) {\n if (concurrency == null) {\n // eslint-disable-line no-eq-null,eqeqeq\n concurrency = 1;\n } else if (concurrency === 0) {\n throw new Error('Concurrency must not be zero');\n }\n\n var workers = 0;\n var q = {\n _tasks: [],\n concurrency: concurrency,\n saturated: _noop,\n unsaturated: _noop,\n buffer: concurrency / 4,\n empty: _noop,\n drain: _noop,\n error: _noop,\n started: false,\n paused: false,\n push: function push(data, callback) {\n _insert(data, false, callback);\n },\n kill: function kill() {\n workers = 0;\n q.drain = _noop;\n q.started = false;\n q._tasks = [];\n },\n unshift: function unshift(data, callback) {\n _insert(data, true, callback);\n },\n process: function process() {\n while (!q.paused && workers < q.concurrency && q._tasks.length) {\n var task = q._tasks.shift();\n\n if (q._tasks.length === 0) {\n q.empty();\n }\n\n workers += 1;\n\n if (workers === q.concurrency) {\n q.saturated();\n }\n\n worker(task.data, onlyOnce(_next(task)));\n }\n },\n length: function length() {\n return q._tasks.length;\n },\n running: function running() {\n return workers;\n },\n idle: function idle() {\n return q._tasks.length + workers === 0;\n },\n pause: function pause() {\n if (q.paused === true) {\n return;\n }\n\n q.paused = true;\n },\n resume: function resume() {\n if (q.paused === false) {\n return;\n }\n\n q.paused = false; // Need to call q.process once per concurrent\n // worker to preserve full concurrency after pause\n\n for (var w = 1; w <= q.concurrency; w++) {\n q.process();\n }\n }\n };\n\n function _insert(data, insertAtFront, callback) {\n if (callback != null && typeof callback !== 'function') {\n // eslint-disable-line no-eq-null,eqeqeq\n throw new Error('task callback must be a function');\n }\n\n q.started = true;\n\n if (data == null && q.idle()) {\n // eslint-disable-line no-eq-null,eqeqeq\n // call drain immediately if there are no tasks\n setTimeout(function () {\n return q.drain();\n }, 1);\n return;\n }\n\n var item = {\n data: data,\n callback: typeof callback === 'function' ? callback : _noop\n };\n\n if (insertAtFront) {\n q._tasks.unshift(item);\n } else {\n q._tasks.push(item);\n }\n\n setTimeout(function () {\n return q.process();\n }, 1);\n }\n\n function _next(task) {\n return function next() {\n workers -= 1;\n task.callback.apply(task, arguments);\n\n if (arguments[0] != null) {\n // eslint-disable-line no-eq-null,eqeqeq\n q.error(arguments[0], task.data);\n }\n\n if (workers <= q.concurrency - q.buffer) {\n q.unsaturated();\n }\n\n if (q.idle()) {\n q.drain();\n }\n\n q.process();\n };\n }\n\n return q;\n}\n\nvar async = ({\n eachSeries: eachSeries,\n queue: queue\n});\n\n// a simple in-memory cache for resources\nvar cache = {};\n/**\n * A simple in-memory cache for resource.\n *\n * @memberof middleware\n * @function caching\n * @example\n * import { Loader, middleware } from 'resource-loader';\n * const loader = new Loader();\n * loader.use(middleware.caching);\n * @param {Resource} resource - Current Resource\n * @param {function} next - Callback when complete\n */\n\nfunction caching(resource, next) {\n var _this = this;\n\n // if cached, then set data and complete the resource\n if (cache[resource.url]) {\n resource.data = cache[resource.url];\n resource.complete(); // marks resource load complete and stops processing before middlewares\n } // if not cached, wait for complete and store it in the cache.\n else {\n resource.onComplete.once(function () {\n return cache[_this.url] = _this.data;\n });\n }\n\n next();\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nvar useXdr = !!(window.XDomainRequest && !('withCredentials' in new XMLHttpRequest()));\nvar tempAnchor = null; // some status constants\n\nvar STATUS_NONE = 0;\nvar STATUS_OK = 200;\nvar STATUS_EMPTY = 204;\nvar STATUS_IE_BUG_EMPTY = 1223;\nvar STATUS_TYPE_OK = 2; // noop\n\nfunction _noop$1() {}\n/* empty */\n\n/**\n * Manages the state and loading of a resource and all child resources.\n *\n * @class\n */\n\n\nvar Resource =\n/*#__PURE__*/\nfunction () {\n /**\n * Sets the load type to be used for a specific extension.\n *\n * @static\n * @param {string} extname - The extension to set the type for, e.g. \"png\" or \"fnt\"\n * @param {Resource.LOAD_TYPE} loadType - The load type to set it to.\n */\n Resource.setExtensionLoadType = function setExtensionLoadType(extname, loadType) {\n setExtMap(Resource._loadTypeMap, extname, loadType);\n }\n /**\n * Sets the load type to be used for a specific extension.\n *\n * @static\n * @param {string} extname - The extension to set the type for, e.g. \"png\" or \"fnt\"\n * @param {Resource.XHR_RESPONSE_TYPE} xhrType - The xhr type to set it to.\n */\n ;\n\n Resource.setExtensionXhrType = function setExtensionXhrType(extname, xhrType) {\n setExtMap(Resource._xhrTypeMap, extname, xhrType);\n }\n /**\n * @param {string} name - The name of the resource to load.\n * @param {string|string[]} url - The url for this resource, for audio/video loads you can pass\n * an array of sources.\n * @param {object} [options] - The options for the load.\n * @param {string|boolean} [options.crossOrigin] - Is this request cross-origin? Default is to\n * determine automatically.\n * @param {number} [options.timeout=0] - A timeout in milliseconds for the load. If the load takes\n * longer than this time it is cancelled and the load is considered a failure. If this value is\n * set to `0` then there is no explicit timeout.\n * @param {Resource.LOAD_TYPE} [options.loadType=Resource.LOAD_TYPE.XHR] - How should this resource\n * be loaded?\n * @param {Resource.XHR_RESPONSE_TYPE} [options.xhrType=Resource.XHR_RESPONSE_TYPE.DEFAULT] - How\n * should the data being loaded be interpreted when using XHR?\n * @param {Resource.IMetadata} [options.metadata] - Extra configuration for middleware and the Resource object.\n */\n ;\n\n function Resource(name, url, options) {\n if (typeof name !== 'string' || typeof url !== 'string') {\n throw new Error('Both name and url are required for constructing a resource.');\n }\n\n options = options || {};\n /**\n * The state flags of this resource.\n *\n * @private\n * @member {number}\n */\n\n this._flags = 0; // set data url flag, needs to be set early for some _determineX checks to work.\n\n this._setFlag(Resource.STATUS_FLAGS.DATA_URL, url.indexOf('data:') === 0);\n /**\n * The name of this resource.\n *\n * @readonly\n * @member {string}\n */\n\n\n this.name = name;\n /**\n * The url used to load this resource.\n *\n * @readonly\n * @member {string}\n */\n\n this.url = url;\n /**\n * The extension used to load this resource.\n *\n * @readonly\n * @member {string}\n */\n\n this.extension = this._getExtension();\n /**\n * The data that was loaded by the resource.\n *\n * @member {any}\n */\n\n this.data = null;\n /**\n * Is this request cross-origin? If unset, determined automatically.\n *\n * @member {string}\n */\n\n this.crossOrigin = options.crossOrigin === true ? 'anonymous' : options.crossOrigin;\n /**\n * A timeout in milliseconds for the load. If the load takes longer than this time\n * it is cancelled and the load is considered a failure. If this value is set to `0`\n * then there is no explicit timeout.\n *\n * @member {number}\n */\n\n this.timeout = options.timeout || 0;\n /**\n * The method of loading to use for this resource.\n *\n * @member {Resource.LOAD_TYPE}\n */\n\n this.loadType = options.loadType || this._determineLoadType();\n /**\n * The type used to load the resource via XHR. If unset, determined automatically.\n *\n * @member {string}\n */\n\n this.xhrType = options.xhrType;\n /**\n * Extra info for middleware, and controlling specifics about how the resource loads.\n *\n * Note that if you pass in a `loadElement`, the Resource class takes ownership of it.\n * Meaning it will modify it as it sees fit.\n *\n * @member {Resource.IMetadata}\n */\n\n this.metadata = options.metadata || {};\n /**\n * The error that occurred while loading (if any).\n *\n * @readonly\n * @member {Error}\n */\n\n this.error = null;\n /**\n * The XHR object that was used to load this resource. This is only set\n * when `loadType` is `Resource.LOAD_TYPE.XHR`.\n *\n * @readonly\n * @member {XMLHttpRequest}\n */\n\n this.xhr = null;\n /**\n * The child resources this resource owns.\n *\n * @readonly\n * @member {Resource[]}\n */\n\n this.children = [];\n /**\n * The resource type.\n *\n * @readonly\n * @member {Resource.TYPE}\n */\n\n this.type = Resource.TYPE.UNKNOWN;\n /**\n * The progress chunk owned by this resource.\n *\n * @readonly\n * @member {number}\n */\n\n this.progressChunk = 0;\n /**\n * The `dequeue` method that will be used a storage place for the async queue dequeue method\n * used privately by the loader.\n *\n * @private\n * @member {function}\n */\n\n this._dequeue = _noop$1;\n /**\n * Used a storage place for the on load binding used privately by the loader.\n *\n * @private\n * @member {function}\n */\n\n this._onLoadBinding = null;\n /**\n * The timer for element loads to check if they timeout.\n *\n * @private\n * @member {number}\n */\n\n this._elementTimer = 0;\n /**\n * The `complete` function bound to this resource's context.\n *\n * @private\n * @member {function}\n */\n\n this._boundComplete = this.complete.bind(this);\n /**\n * The `_onError` function bound to this resource's context.\n *\n * @private\n * @member {function}\n */\n\n this._boundOnError = this._onError.bind(this);\n /**\n * The `_onProgress` function bound to this resource's context.\n *\n * @private\n * @member {function}\n */\n\n this._boundOnProgress = this._onProgress.bind(this);\n /**\n * The `_onTimeout` function bound to this resource's context.\n *\n * @private\n * @member {function}\n */\n\n this._boundOnTimeout = this._onTimeout.bind(this); // xhr callbacks\n\n this._boundXhrOnError = this._xhrOnError.bind(this);\n this._boundXhrOnTimeout = this._xhrOnTimeout.bind(this);\n this._boundXhrOnAbort = this._xhrOnAbort.bind(this);\n this._boundXhrOnLoad = this._xhrOnLoad.bind(this);\n /**\n * Dispatched when the resource beings to load.\n *\n * The callback looks like {@link Resource.OnStartSignal}.\n *\n * @member {Signal}\n */\n\n this.onStart = new (mini_signals__WEBPACK_IMPORTED_MODULE_1___default())();\n /**\n * Dispatched each time progress of this resource load updates.\n * Not all resources types and loader systems can support this event\n * so sometimes it may not be available. If the resource\n * is being loaded on a modern browser, using XHR, and the remote server\n * properly sets Content-Length headers, then this will be available.\n *\n * The callback looks like {@link Resource.OnProgressSignal}.\n *\n * @member {Signal}\n */\n\n this.onProgress = new (mini_signals__WEBPACK_IMPORTED_MODULE_1___default())();\n /**\n * Dispatched once this resource has loaded, if there was an error it will\n * be in the `error` property.\n *\n * The callback looks like {@link Resource.OnCompleteSignal}.\n *\n * @member {Signal}\n */\n\n this.onComplete = new (mini_signals__WEBPACK_IMPORTED_MODULE_1___default())();\n /**\n * Dispatched after this resource has had all the *after* middleware run on it.\n *\n * The callback looks like {@link Resource.OnCompleteSignal}.\n *\n * @member {Signal}\n */\n\n this.onAfterMiddleware = new (mini_signals__WEBPACK_IMPORTED_MODULE_1___default())();\n }\n /**\n * When the resource starts to load.\n *\n * @memberof Resource\n * @callback OnStartSignal\n * @param {Resource} resource - The resource that the event happened on.\n */\n\n /**\n * When the resource reports loading progress.\n *\n * @memberof Resource\n * @callback OnProgressSignal\n * @param {Resource} resource - The resource that the event happened on.\n * @param {number} percentage - The progress of the load in the range [0, 1].\n */\n\n /**\n * When the resource finishes loading.\n *\n * @memberof Resource\n * @callback OnCompleteSignal\n * @param {Resource} resource - The resource that the event happened on.\n */\n\n /**\n * @memberof Resource\n * @typedef {object} IMetadata\n * @property {HTMLImageElement|HTMLAudioElement|HTMLVideoElement} [loadElement=null] - The\n * element to use for loading, instead of creating one.\n * @property {boolean} [skipSource=false] - Skips adding source(s) to the load element. This\n * is useful if you want to pass in a `loadElement` that you already added load sources to.\n * @property {string|string[]} [mimeType] - The mime type to use for the source element\n * of a video/audio elment. If the urls are an array, you can pass this as an array as well\n * where each index is the mime type to use for the corresponding url index.\n */\n\n /**\n * Stores whether or not this url is a data url.\n *\n * @readonly\n * @member {boolean}\n */\n\n\n var _proto = Resource.prototype;\n\n /**\n * Marks the resource as complete.\n *\n */\n _proto.complete = function complete() {\n this._clearEvents();\n\n this._finish();\n }\n /**\n * Aborts the loading of this resource, with an optional message.\n *\n * @param {string} message - The message to use for the error\n */\n ;\n\n _proto.abort = function abort(message) {\n // abort can be called multiple times, ignore subsequent calls.\n if (this.error) {\n return;\n } // store error\n\n\n this.error = new Error(message); // clear events before calling aborts\n\n this._clearEvents(); // abort the actual loading\n\n\n if (this.xhr) {\n this.xhr.abort();\n } else if (this.xdr) {\n this.xdr.abort();\n } else if (this.data) {\n // single source\n if (this.data.src) {\n this.data.src = Resource.EMPTY_GIF;\n } // multi-source\n else {\n while (this.data.firstChild) {\n this.data.removeChild(this.data.firstChild);\n }\n }\n } // done now.\n\n\n this._finish();\n }\n /**\n * Kicks off loading of this resource. This method is asynchronous.\n *\n * @param {Resource.OnCompleteSignal} [cb] - Optional callback to call once the resource is loaded.\n */\n ;\n\n _proto.load = function load(cb) {\n var _this = this;\n\n if (this.isLoading) {\n return;\n }\n\n if (this.isComplete) {\n if (cb) {\n setTimeout(function () {\n return cb(_this);\n }, 1);\n }\n\n return;\n } else if (cb) {\n this.onComplete.once(cb);\n }\n\n this._setFlag(Resource.STATUS_FLAGS.LOADING, true);\n\n this.onStart.dispatch(this); // if unset, determine the value\n\n if (this.crossOrigin === false || typeof this.crossOrigin !== 'string') {\n this.crossOrigin = this._determineCrossOrigin(this.url);\n }\n\n switch (this.loadType) {\n case Resource.LOAD_TYPE.IMAGE:\n this.type = Resource.TYPE.IMAGE;\n\n this._loadElement('image');\n\n break;\n\n case Resource.LOAD_TYPE.AUDIO:\n this.type = Resource.TYPE.AUDIO;\n\n this._loadSourceElement('audio');\n\n break;\n\n case Resource.LOAD_TYPE.VIDEO:\n this.type = Resource.TYPE.VIDEO;\n\n this._loadSourceElement('video');\n\n break;\n\n case Resource.LOAD_TYPE.XHR:\n /* falls through */\n\n default:\n if (useXdr && this.crossOrigin) {\n this._loadXdr();\n } else {\n this._loadXhr();\n }\n\n break;\n }\n }\n /**\n * Checks if the flag is set.\n *\n * @private\n * @param {number} flag - The flag to check.\n * @return {boolean} True if the flag is set.\n */\n ;\n\n _proto._hasFlag = function _hasFlag(flag) {\n return (this._flags & flag) !== 0;\n }\n /**\n * (Un)Sets the flag.\n *\n * @private\n * @param {number} flag - The flag to (un)set.\n * @param {boolean} value - Whether to set or (un)set the flag.\n */\n ;\n\n _proto._setFlag = function _setFlag(flag, value) {\n this._flags = value ? this._flags | flag : this._flags & ~flag;\n }\n /**\n * Clears all the events from the underlying loading source.\n *\n * @private\n */\n ;\n\n _proto._clearEvents = function _clearEvents() {\n clearTimeout(this._elementTimer);\n\n if (this.data && this.data.removeEventListener) {\n this.data.removeEventListener('error', this._boundOnError, false);\n this.data.removeEventListener('load', this._boundComplete, false);\n this.data.removeEventListener('progress', this._boundOnProgress, false);\n this.data.removeEventListener('canplaythrough', this._boundComplete, false);\n }\n\n if (this.xhr) {\n if (this.xhr.removeEventListener) {\n this.xhr.removeEventListener('error', this._boundXhrOnError, false);\n this.xhr.removeEventListener('timeout', this._boundXhrOnTimeout, false);\n this.xhr.removeEventListener('abort', this._boundXhrOnAbort, false);\n this.xhr.removeEventListener('progress', this._boundOnProgress, false);\n this.xhr.removeEventListener('load', this._boundXhrOnLoad, false);\n } else {\n this.xhr.onerror = null;\n this.xhr.ontimeout = null;\n this.xhr.onprogress = null;\n this.xhr.onload = null;\n }\n }\n }\n /**\n * Finalizes the load.\n *\n * @private\n */\n ;\n\n _proto._finish = function _finish() {\n if (this.isComplete) {\n throw new Error('Complete called again for an already completed resource.');\n }\n\n this._setFlag(Resource.STATUS_FLAGS.COMPLETE, true);\n\n this._setFlag(Resource.STATUS_FLAGS.LOADING, false);\n\n this.onComplete.dispatch(this);\n }\n /**\n * Loads this resources using an element that has a single source,\n * like an HTMLImageElement.\n *\n * @private\n * @param {string} type - The type of element to use.\n */\n ;\n\n _proto._loadElement = function _loadElement(type) {\n if (this.metadata.loadElement) {\n this.data = this.metadata.loadElement;\n } else if (type === 'image' && typeof window.Image !== 'undefined') {\n this.data = new Image();\n } else {\n this.data = document.createElement(type);\n }\n\n if (this.crossOrigin) {\n this.data.crossOrigin = this.crossOrigin;\n }\n\n if (!this.metadata.skipSource) {\n this.data.src = this.url;\n }\n\n this.data.addEventListener('error', this._boundOnError, false);\n this.data.addEventListener('load', this._boundComplete, false);\n this.data.addEventListener('progress', this._boundOnProgress, false);\n\n if (this.timeout) {\n this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout);\n }\n }\n /**\n * Loads this resources using an element that has multiple sources,\n * like an HTMLAudioElement or HTMLVideoElement.\n *\n * @private\n * @param {string} type - The type of element to use.\n */\n ;\n\n _proto._loadSourceElement = function _loadSourceElement(type) {\n if (this.metadata.loadElement) {\n this.data = this.metadata.loadElement;\n } else if (type === 'audio' && typeof window.Audio !== 'undefined') {\n this.data = new Audio();\n } else {\n this.data = document.createElement(type);\n }\n\n if (this.data === null) {\n this.abort(\"Unsupported element: \" + type);\n return;\n }\n\n if (this.crossOrigin) {\n this.data.crossOrigin = this.crossOrigin;\n }\n\n if (!this.metadata.skipSource) {\n // support for CocoonJS Canvas+ runtime, lacks document.createElement('source')\n if (navigator.isCocoonJS) {\n this.data.src = Array.isArray(this.url) ? this.url[0] : this.url;\n } else if (Array.isArray(this.url)) {\n var mimeTypes = this.metadata.mimeType;\n\n for (var i = 0; i < this.url.length; ++i) {\n this.data.appendChild(this._createSource(type, this.url[i], Array.isArray(mimeTypes) ? mimeTypes[i] : mimeTypes));\n }\n } else {\n var _mimeTypes = this.metadata.mimeType;\n this.data.appendChild(this._createSource(type, this.url, Array.isArray(_mimeTypes) ? _mimeTypes[0] : _mimeTypes));\n }\n }\n\n this.data.addEventListener('error', this._boundOnError, false);\n this.data.addEventListener('load', this._boundComplete, false);\n this.data.addEventListener('progress', this._boundOnProgress, false);\n this.data.addEventListener('canplaythrough', this._boundComplete, false);\n this.data.load();\n\n if (this.timeout) {\n this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout);\n }\n }\n /**\n * Loads this resources using an XMLHttpRequest.\n *\n * @private\n */\n ;\n\n _proto._loadXhr = function _loadXhr() {\n // if unset, determine the value\n if (typeof this.xhrType !== 'string') {\n this.xhrType = this._determineXhrType();\n }\n\n var xhr = this.xhr = new XMLHttpRequest(); // set the request type and url\n\n xhr.open('GET', this.url, true);\n xhr.timeout = this.timeout; // load json as text and parse it ourselves. We do this because some browsers\n // *cough* safari *cough* can't deal with it.\n\n if (this.xhrType === Resource.XHR_RESPONSE_TYPE.JSON || this.xhrType === Resource.XHR_RESPONSE_TYPE.DOCUMENT) {\n xhr.responseType = Resource.XHR_RESPONSE_TYPE.TEXT;\n } else {\n xhr.responseType = this.xhrType;\n }\n\n xhr.addEventListener('error', this._boundXhrOnError, false);\n xhr.addEventListener('timeout', this._boundXhrOnTimeout, false);\n xhr.addEventListener('abort', this._boundXhrOnAbort, false);\n xhr.addEventListener('progress', this._boundOnProgress, false);\n xhr.addEventListener('load', this._boundXhrOnLoad, false);\n xhr.send();\n }\n /**\n * Loads this resources using an XDomainRequest. This is here because we need to support IE9 (gross).\n *\n * @private\n */\n ;\n\n _proto._loadXdr = function _loadXdr() {\n // if unset, determine the value\n if (typeof this.xhrType !== 'string') {\n this.xhrType = this._determineXhrType();\n }\n\n var xdr = this.xhr = new XDomainRequest(); // eslint-disable-line no-undef\n // XDomainRequest has a few quirks. Occasionally it will abort requests\n // A way to avoid this is to make sure ALL callbacks are set even if not used\n // More info here: http://stackoverflow.com/questions/15786966/xdomainrequest-aborts-post-on-ie-9\n\n xdr.timeout = this.timeout || 5000; // XDR needs a timeout value or it breaks in IE9\n\n xdr.onerror = this._boundXhrOnError;\n xdr.ontimeout = this._boundXhrOnTimeout;\n xdr.onprogress = this._boundOnProgress;\n xdr.onload = this._boundXhrOnLoad;\n xdr.open('GET', this.url, true); // Note: The xdr.send() call is wrapped in a timeout to prevent an\n // issue with the interface where some requests are lost if multiple\n // XDomainRequests are being sent at the same time.\n // Some info here: https://github.com/photonstorm/phaser/issues/1248\n\n setTimeout(function () {\n return xdr.send();\n }, 1);\n }\n /**\n * Creates a source used in loading via an element.\n *\n * @private\n * @param {string} type - The element type (video or audio).\n * @param {string} url - The source URL to load from.\n * @param {string} [mime] - The mime type of the video\n * @return {HTMLSourceElement} The source element.\n */\n ;\n\n _proto._createSource = function _createSource(type, url, mime) {\n if (!mime) {\n mime = type + \"/\" + this._getExtension(url);\n }\n\n var source = document.createElement('source');\n source.src = url;\n source.type = mime;\n return source;\n }\n /**\n * Called if a load errors out.\n *\n * @param {Event} event - The error event from the element that emits it.\n * @private\n */\n ;\n\n _proto._onError = function _onError(event) {\n this.abort(\"Failed to load element using: \" + event.target.nodeName);\n }\n /**\n * Called if a load progress event fires for an element or xhr/xdr.\n *\n * @private\n * @param {XMLHttpRequestProgressEvent|Event} event - Progress event.\n */\n ;\n\n _proto._onProgress = function _onProgress(event) {\n if (event && event.lengthComputable) {\n this.onProgress.dispatch(this, event.loaded / event.total);\n }\n }\n /**\n * Called if a timeout event fires for an element.\n *\n * @private\n */\n ;\n\n _proto._onTimeout = function _onTimeout() {\n this.abort(\"Load timed out.\");\n }\n /**\n * Called if an error event fires for xhr/xdr.\n *\n * @private\n */\n ;\n\n _proto._xhrOnError = function _xhrOnError() {\n var xhr = this.xhr;\n this.abort(reqType(xhr) + \" Request failed. Status: \" + xhr.status + \", text: \\\"\" + xhr.statusText + \"\\\"\");\n }\n /**\n * Called if an error event fires for xhr/xdr.\n *\n * @private\n */\n ;\n\n _proto._xhrOnTimeout = function _xhrOnTimeout() {\n var xhr = this.xhr;\n this.abort(reqType(xhr) + \" Request timed out.\");\n }\n /**\n * Called if an abort event fires for xhr/xdr.\n *\n * @private\n */\n ;\n\n _proto._xhrOnAbort = function _xhrOnAbort() {\n var xhr = this.xhr;\n this.abort(reqType(xhr) + \" Request was aborted by the user.\");\n }\n /**\n * Called when data successfully loads from an xhr/xdr request.\n *\n * @private\n * @param {XMLHttpRequestLoadEvent|Event} event - Load event\n */\n ;\n\n _proto._xhrOnLoad = function _xhrOnLoad() {\n var xhr = this.xhr;\n var text = '';\n var status = typeof xhr.status === 'undefined' ? STATUS_OK : xhr.status; // XDR has no `.status`, assume 200.\n // responseText is accessible only if responseType is '' or 'text' and on older browsers\n\n if (xhr.responseType === '' || xhr.responseType === 'text' || typeof xhr.responseType === 'undefined') {\n text = xhr.responseText;\n } // status can be 0 when using the `file://` protocol so we also check if a response is set.\n // If it has a response, we assume 200; otherwise a 0 status code with no contents is an aborted request.\n\n\n if (status === STATUS_NONE && (text.length > 0 || xhr.responseType === Resource.XHR_RESPONSE_TYPE.BUFFER)) {\n status = STATUS_OK;\n } // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request\n else if (status === STATUS_IE_BUG_EMPTY) {\n status = STATUS_EMPTY;\n }\n\n var statusType = status / 100 | 0;\n\n if (statusType === STATUS_TYPE_OK) {\n // if text, just return it\n if (this.xhrType === Resource.XHR_RESPONSE_TYPE.TEXT) {\n this.data = text;\n this.type = Resource.TYPE.TEXT;\n } // if json, parse into json object\n else if (this.xhrType === Resource.XHR_RESPONSE_TYPE.JSON) {\n try {\n this.data = JSON.parse(text);\n this.type = Resource.TYPE.JSON;\n } catch (e) {\n this.abort(\"Error trying to parse loaded json: \" + e);\n return;\n }\n } // if xml, parse into an xml document or div element\n else if (this.xhrType === Resource.XHR_RESPONSE_TYPE.DOCUMENT) {\n try {\n if (window.DOMParser) {\n var domparser = new DOMParser();\n this.data = domparser.parseFromString(text, 'text/xml');\n } else {\n var div = document.createElement('div');\n div.innerHTML = text;\n this.data = div;\n }\n\n this.type = Resource.TYPE.XML;\n } catch (e) {\n this.abort(\"Error trying to parse loaded xml: \" + e);\n return;\n }\n } // other types just return the response\n else {\n this.data = xhr.response || text;\n }\n } else {\n this.abort(\"[\" + xhr.status + \"] \" + xhr.statusText + \": \" + xhr.responseURL);\n return;\n }\n\n this.complete();\n }\n /**\n * Sets the `crossOrigin` property for this resource based on if the url\n * for this resource is cross-origin. If crossOrigin was manually set, this\n * function does nothing.\n *\n * @private\n * @param {string} url - The url to test.\n * @param {object} [loc=window.location] - The location object to test against.\n * @return {string} The crossOrigin value to use (or empty string for none).\n */\n ;\n\n _proto._determineCrossOrigin = function _determineCrossOrigin(url, loc) {\n // data: and javascript: urls are considered same-origin\n if (url.indexOf('data:') === 0) {\n return '';\n } // A sandboxed iframe without the 'allow-same-origin' attribute will have a special\n // origin designed not to match window.location.origin, and will always require\n // crossOrigin requests regardless of whether the location matches.\n\n\n if (window.origin !== window.location.origin) {\n return 'anonymous';\n } // default is window.location\n\n\n loc = loc || window.location;\n\n if (!tempAnchor) {\n tempAnchor = document.createElement('a');\n } // let the browser determine the full href for the url of this resource and then\n // parse with the node url lib, we can't use the properties of the anchor element\n // because they don't work in IE9 :(\n\n\n tempAnchor.href = url;\n url = parse_uri__WEBPACK_IMPORTED_MODULE_0___default()(tempAnchor.href, {\n strictMode: true\n });\n var samePort = !url.port && loc.port === '' || url.port === loc.port;\n var protocol = url.protocol ? url.protocol + \":\" : ''; // if cross origin\n\n if (url.host !== loc.hostname || !samePort || protocol !== loc.protocol) {\n return 'anonymous';\n }\n\n return '';\n }\n /**\n * Determines the responseType of an XHR request based on the extension of the\n * resource being loaded.\n *\n * @private\n * @return {Resource.XHR_RESPONSE_TYPE} The responseType to use.\n */\n ;\n\n _proto._determineXhrType = function _determineXhrType() {\n return Resource._xhrTypeMap[this.extension] || Resource.XHR_RESPONSE_TYPE.TEXT;\n }\n /**\n * Determines the loadType of a resource based on the extension of the\n * resource being loaded.\n *\n * @private\n * @return {Resource.LOAD_TYPE} The loadType to use.\n */\n ;\n\n _proto._determineLoadType = function _determineLoadType() {\n return Resource._loadTypeMap[this.extension] || Resource.LOAD_TYPE.XHR;\n }\n /**\n * Extracts the extension (sans '.') of the file being loaded by the resource.\n *\n * @private\n * @return {string} The extension.\n */\n ;\n\n _proto._getExtension = function _getExtension() {\n var url = this.url;\n var ext = '';\n\n if (this.isDataUrl) {\n var slashIndex = url.indexOf('/');\n ext = url.substring(slashIndex + 1, url.indexOf(';', slashIndex));\n } else {\n var queryStart = url.indexOf('?');\n var hashStart = url.indexOf('#');\n var index = Math.min(queryStart > -1 ? queryStart : url.length, hashStart > -1 ? hashStart : url.length);\n url = url.substring(0, index);\n ext = url.substring(url.lastIndexOf('.') + 1);\n }\n\n return ext.toLowerCase();\n }\n /**\n * Determines the mime type of an XHR request based on the responseType of\n * resource being loaded.\n *\n * @private\n * @param {Resource.XHR_RESPONSE_TYPE} type - The type to get a mime type for.\n * @return {string} The mime type to use.\n */\n ;\n\n _proto._getMimeFromXhrType = function _getMimeFromXhrType(type) {\n switch (type) {\n case Resource.XHR_RESPONSE_TYPE.BUFFER:\n return 'application/octet-binary';\n\n case Resource.XHR_RESPONSE_TYPE.BLOB:\n return 'application/blob';\n\n case Resource.XHR_RESPONSE_TYPE.DOCUMENT:\n return 'application/xml';\n\n case Resource.XHR_RESPONSE_TYPE.JSON:\n return 'application/json';\n\n case Resource.XHR_RESPONSE_TYPE.DEFAULT:\n case Resource.XHR_RESPONSE_TYPE.TEXT:\n /* falls through */\n\n default:\n return 'text/plain';\n }\n };\n\n _createClass(Resource, [{\n key: \"isDataUrl\",\n get: function get() {\n return this._hasFlag(Resource.STATUS_FLAGS.DATA_URL);\n }\n /**\n * Describes if this resource has finished loading. Is true when the resource has completely\n * loaded.\n *\n * @readonly\n * @member {boolean}\n */\n\n }, {\n key: \"isComplete\",\n get: function get() {\n return this._hasFlag(Resource.STATUS_FLAGS.COMPLETE);\n }\n /**\n * Describes if this resource is currently loading. Is true when the resource starts loading,\n * and is false again when complete.\n *\n * @readonly\n * @member {boolean}\n */\n\n }, {\n key: \"isLoading\",\n get: function get() {\n return this._hasFlag(Resource.STATUS_FLAGS.LOADING);\n }\n }]);\n\n return Resource;\n}();\n/**\n * The types of resources a resource could represent.\n *\n * @static\n * @readonly\n * @enum {number}\n */\n\n\nResource.STATUS_FLAGS = {\n NONE: 0,\n DATA_URL: 1 << 0,\n COMPLETE: 1 << 1,\n LOADING: 1 << 2\n};\n/**\n * The types of resources a resource could represent.\n *\n * @static\n * @readonly\n * @enum {number}\n */\n\nResource.TYPE = {\n UNKNOWN: 0,\n JSON: 1,\n XML: 2,\n IMAGE: 3,\n AUDIO: 4,\n VIDEO: 5,\n TEXT: 6\n};\n/**\n * The types of loading a resource can use.\n *\n * @static\n * @readonly\n * @enum {number}\n */\n\nResource.LOAD_TYPE = {\n /** Uses XMLHttpRequest to load the resource. */\n XHR: 1,\n\n /** Uses an `Image` object to load the resource. */\n IMAGE: 2,\n\n /** Uses an `Audio` object to load the resource. */\n AUDIO: 3,\n\n /** Uses a `Video` object to load the resource. */\n VIDEO: 4\n};\n/**\n * The XHR ready states, used internally.\n *\n * @static\n * @readonly\n * @enum {string}\n */\n\nResource.XHR_RESPONSE_TYPE = {\n /** string */\n DEFAULT: 'text',\n\n /** ArrayBuffer */\n BUFFER: 'arraybuffer',\n\n /** Blob */\n BLOB: 'blob',\n\n /** Document */\n DOCUMENT: 'document',\n\n /** Object */\n JSON: 'json',\n\n /** String */\n TEXT: 'text'\n};\nResource._loadTypeMap = {\n // images\n gif: Resource.LOAD_TYPE.IMAGE,\n png: Resource.LOAD_TYPE.IMAGE,\n bmp: Resource.LOAD_TYPE.IMAGE,\n jpg: Resource.LOAD_TYPE.IMAGE,\n jpeg: Resource.LOAD_TYPE.IMAGE,\n tif: Resource.LOAD_TYPE.IMAGE,\n tiff: Resource.LOAD_TYPE.IMAGE,\n webp: Resource.LOAD_TYPE.IMAGE,\n tga: Resource.LOAD_TYPE.IMAGE,\n svg: Resource.LOAD_TYPE.IMAGE,\n 'svg+xml': Resource.LOAD_TYPE.IMAGE,\n // for SVG data urls\n // audio\n mp3: Resource.LOAD_TYPE.AUDIO,\n ogg: Resource.LOAD_TYPE.AUDIO,\n wav: Resource.LOAD_TYPE.AUDIO,\n // videos\n mp4: Resource.LOAD_TYPE.VIDEO,\n webm: Resource.LOAD_TYPE.VIDEO\n};\nResource._xhrTypeMap = {\n // xml\n xhtml: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n html: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n htm: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n xml: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n tmx: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n svg: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n // This was added to handle Tiled Tileset XML, but .tsx is also a TypeScript React Component.\n // Since it is way less likely for people to be loading TypeScript files instead of Tiled files,\n // this should probably be fine.\n tsx: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n // images\n gif: Resource.XHR_RESPONSE_TYPE.BLOB,\n png: Resource.XHR_RESPONSE_TYPE.BLOB,\n bmp: Resource.XHR_RESPONSE_TYPE.BLOB,\n jpg: Resource.XHR_RESPONSE_TYPE.BLOB,\n jpeg: Resource.XHR_RESPONSE_TYPE.BLOB,\n tif: Resource.XHR_RESPONSE_TYPE.BLOB,\n tiff: Resource.XHR_RESPONSE_TYPE.BLOB,\n webp: Resource.XHR_RESPONSE_TYPE.BLOB,\n tga: Resource.XHR_RESPONSE_TYPE.BLOB,\n // json\n json: Resource.XHR_RESPONSE_TYPE.JSON,\n // text\n text: Resource.XHR_RESPONSE_TYPE.TEXT,\n txt: Resource.XHR_RESPONSE_TYPE.TEXT,\n // fonts\n ttf: Resource.XHR_RESPONSE_TYPE.BUFFER,\n otf: Resource.XHR_RESPONSE_TYPE.BUFFER\n}; // We can't set the `src` attribute to empty string, so on abort we set it to this 1px transparent gif\n\nResource.EMPTY_GIF = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';\n/**\n * Quick helper to set a value on one of the extension maps. Ensures there is no\n * dot at the start of the extension.\n *\n * @ignore\n * @param {object} map - The map to set on.\n * @param {string} extname - The extension (or key) to set.\n * @param {number} val - The value to set.\n */\n\nfunction setExtMap(map, extname, val) {\n if (extname && extname.indexOf('.') === 0) {\n extname = extname.substring(1);\n }\n\n if (!extname) {\n return;\n }\n\n map[extname] = val;\n}\n/**\n * Quick helper to get string xhr type.\n *\n * @ignore\n * @param {XMLHttpRequest|XDomainRequest} xhr - The request to check.\n * @return {string} The type.\n */\n\n\nfunction reqType(xhr) {\n return xhr.toString().replace('object ', '');\n}\n\nvar _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n/**\n * Encodes binary into base64.\n *\n * @function encodeBinary\n * @param {string} input The input data to encode.\n * @returns {string} The encoded base64 string\n */\n\nfunction encodeBinary(input) {\n var output = '';\n var inx = 0;\n\n while (inx < input.length) {\n // Fill byte buffer array\n var bytebuffer = [0, 0, 0];\n var encodedCharIndexes = [0, 0, 0, 0];\n\n for (var jnx = 0; jnx < bytebuffer.length; ++jnx) {\n if (inx < input.length) {\n // throw away high-order byte, as documented at:\n // https://developer.mozilla.org/En/Using_XMLHttpRequest#Handling_binary_data\n bytebuffer[jnx] = input.charCodeAt(inx++) & 0xff;\n } else {\n bytebuffer[jnx] = 0;\n }\n } // Get each encoded character, 6 bits at a time\n // index 1: first 6 bits\n\n\n encodedCharIndexes[0] = bytebuffer[0] >> 2; // index 2: second 6 bits (2 least significant bits from input byte 1 + 4 most significant bits from byte 2)\n\n encodedCharIndexes[1] = (bytebuffer[0] & 0x3) << 4 | bytebuffer[1] >> 4; // index 3: third 6 bits (4 least significant bits from input byte 2 + 2 most significant bits from byte 3)\n\n encodedCharIndexes[2] = (bytebuffer[1] & 0x0f) << 2 | bytebuffer[2] >> 6; // index 3: forth 6 bits (6 least significant bits from input byte 3)\n\n encodedCharIndexes[3] = bytebuffer[2] & 0x3f; // Determine whether padding happened, and adjust accordingly\n\n var paddingBytes = inx - (input.length - 1);\n\n switch (paddingBytes) {\n case 2:\n // Set last 2 characters to padding char\n encodedCharIndexes[3] = 64;\n encodedCharIndexes[2] = 64;\n break;\n\n case 1:\n // Set last character to padding char\n encodedCharIndexes[3] = 64;\n break;\n\n default:\n break;\n // No padding - proceed\n } // Now we will grab each appropriate character out of our keystring\n // based on our index array and append it to the output string\n\n\n for (var _jnx = 0; _jnx < encodedCharIndexes.length; ++_jnx) {\n output += _keyStr.charAt(encodedCharIndexes[_jnx]);\n }\n }\n\n return output;\n}\n\nvar Url = window.URL || window.webkitURL;\n/**\n * A middleware for transforming XHR loaded Blobs into more useful objects\n *\n * @memberof middleware\n * @function parsing\n * @example\n * import { Loader, middleware } from 'resource-loader';\n * const loader = new Loader();\n * loader.use(middleware.parsing);\n * @param {Resource} resource - Current Resource\n * @param {function} next - Callback when complete\n */\n\nfunction parsing(resource, next) {\n if (!resource.data) {\n next();\n return;\n } // if this was an XHR load of a blob\n\n\n if (resource.xhr && resource.xhrType === Resource.XHR_RESPONSE_TYPE.BLOB) {\n // if there is no blob support we probably got a binary string back\n if (!window.Blob || typeof resource.data === 'string') {\n var type = resource.xhr.getResponseHeader('content-type'); // this is an image, convert the binary string into a data url\n\n if (type && type.indexOf('image') === 0) {\n resource.data = new Image();\n resource.data.src = \"data:\" + type + \";base64,\" + encodeBinary(resource.xhr.responseText);\n resource.type = Resource.TYPE.IMAGE; // wait until the image loads and then callback\n\n resource.data.onload = function () {\n resource.data.onload = null;\n next();\n }; // next will be called on load\n\n\n return;\n }\n } // if content type says this is an image, then we should transform the blob into an Image object\n else if (resource.data.type.indexOf('image') === 0) {\n var src = Url.createObjectURL(resource.data);\n resource.blob = resource.data;\n resource.data = new Image();\n resource.data.src = src;\n resource.type = Resource.TYPE.IMAGE; // cleanup the no longer used blob after the image loads\n // TODO: Is this correct? Will the image be invalid after revoking?\n\n resource.data.onload = function () {\n Url.revokeObjectURL(src);\n resource.data.onload = null;\n next();\n }; // next will be called on load.\n\n\n return;\n }\n }\n\n next();\n}\n\n/**\n * @namespace middleware\n */\n\nvar index = ({\n caching: caching,\n parsing: parsing\n});\n\nvar MAX_PROGRESS = 100;\nvar rgxExtractUrlHash = /(#[\\w-]+)?$/;\n/**\n * Manages the state and loading of multiple resources to load.\n *\n * @class\n */\n\nvar Loader =\n/*#__PURE__*/\nfunction () {\n /**\n * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader.\n * @param {number} [concurrency=10] - The number of resources to load concurrently.\n */\n function Loader(baseUrl, concurrency) {\n var _this = this;\n\n if (baseUrl === void 0) {\n baseUrl = '';\n }\n\n if (concurrency === void 0) {\n concurrency = 10;\n }\n\n /**\n * The base url for all resources loaded by this loader.\n *\n * @member {string}\n */\n this.baseUrl = baseUrl;\n /**\n * The progress percent of the loader going through the queue.\n *\n * @member {number}\n * @default 0\n */\n\n this.progress = 0;\n /**\n * Loading state of the loader, true if it is currently loading resources.\n *\n * @member {boolean}\n * @default false\n */\n\n this.loading = false;\n /**\n * A querystring to append to every URL added to the loader.\n *\n * This should be a valid query string *without* the question-mark (`?`). The loader will\n * also *not* escape values for you. Make sure to escape your parameters with\n * [`encodeURIComponent`](https://mdn.io/encodeURIComponent) before assigning this property.\n *\n * @example\n * const loader = new Loader();\n *\n * loader.defaultQueryString = 'user=me&password=secret';\n *\n * // This will request 'image.png?user=me&password=secret'\n * loader.add('image.png').load();\n *\n * loader.reset();\n *\n * // This will request 'image.png?v=1&user=me&password=secret'\n * loader.add('iamge.png?v=1').load();\n *\n * @member {string}\n * @default ''\n */\n\n this.defaultQueryString = '';\n /**\n * The middleware to run before loading each resource.\n *\n * @private\n * @member {function[]}\n */\n\n this._beforeMiddleware = [];\n /**\n * The middleware to run after loading each resource.\n *\n * @private\n * @member {function[]}\n */\n\n this._afterMiddleware = [];\n /**\n * The tracks the resources we are currently completing parsing for.\n *\n * @private\n * @member {Resource[]}\n */\n\n this._resourcesParsing = [];\n /**\n * The `_loadResource` function bound with this object context.\n *\n * @private\n * @member {function}\n * @param {Resource} r - The resource to load\n * @param {Function} d - The dequeue function\n * @return {undefined}\n */\n\n this._boundLoadResource = function (r, d) {\n return _this._loadResource(r, d);\n };\n /**\n * The resources waiting to be loaded.\n *\n * @private\n * @member {Resource[]}\n */\n\n\n this._queue = queue(this._boundLoadResource, concurrency);\n\n this._queue.pause();\n /**\n * All the resources for this loader keyed by name.\n *\n * @member {object}\n */\n\n\n this.resources = {};\n /**\n * Dispatched once per loaded or errored resource.\n *\n * The callback looks like {@link Loader.OnProgressSignal}.\n *\n * @member {Signal}\n */\n\n this.onProgress = new (mini_signals__WEBPACK_IMPORTED_MODULE_1___default())();\n /**\n * Dispatched once per errored resource.\n *\n * The callback looks like {@link Loader.OnErrorSignal}.\n *\n * @member {Signal}\n */\n\n this.onError = new (mini_signals__WEBPACK_IMPORTED_MODULE_1___default())();\n /**\n * Dispatched once per loaded resource.\n *\n * The callback looks like {@link Loader.OnLoadSignal}.\n *\n * @member {Signal}\n */\n\n this.onLoad = new (mini_signals__WEBPACK_IMPORTED_MODULE_1___default())();\n /**\n * Dispatched when the loader begins to process the queue.\n *\n * The callback looks like {@link Loader.OnStartSignal}.\n *\n * @member {Signal}\n */\n\n this.onStart = new (mini_signals__WEBPACK_IMPORTED_MODULE_1___default())();\n /**\n * Dispatched when the queued resources all load.\n *\n * The callback looks like {@link Loader.OnCompleteSignal}.\n *\n * @member {Signal}\n */\n\n this.onComplete = new (mini_signals__WEBPACK_IMPORTED_MODULE_1___default())(); // Add default before middleware\n\n for (var i = 0; i < Loader._defaultBeforeMiddleware.length; ++i) {\n this.pre(Loader._defaultBeforeMiddleware[i]);\n } // Add default after middleware\n\n\n for (var _i = 0; _i < Loader._defaultAfterMiddleware.length; ++_i) {\n this.use(Loader._defaultAfterMiddleware[_i]);\n }\n }\n /**\n * When the progress changes the loader and resource are disaptched.\n *\n * @memberof Loader\n * @callback OnProgressSignal\n * @param {Loader} loader - The loader the progress is advancing on.\n * @param {Resource} resource - The resource that has completed or failed to cause the progress to advance.\n */\n\n /**\n * When an error occurrs the loader and resource are disaptched.\n *\n * @memberof Loader\n * @callback OnErrorSignal\n * @param {Loader} loader - The loader the error happened in.\n * @param {Resource} resource - The resource that caused the error.\n */\n\n /**\n * When a load completes the loader and resource are disaptched.\n *\n * @memberof Loader\n * @callback OnLoadSignal\n * @param {Loader} loader - The loader that laoded the resource.\n * @param {Resource} resource - The resource that has completed loading.\n */\n\n /**\n * When the loader starts loading resources it dispatches this callback.\n *\n * @memberof Loader\n * @callback OnStartSignal\n * @param {Loader} loader - The loader that has started loading resources.\n */\n\n /**\n * When the loader completes loading resources it dispatches this callback.\n *\n * @memberof Loader\n * @callback OnCompleteSignal\n * @param {Loader} loader - The loader that has finished loading resources.\n */\n\n /**\n * Options for a call to `.add()`.\n *\n * @see Loader#add\n *\n * @typedef {object} IAddOptions\n * @property {string} [name] - The name of the resource to load, if not passed the url is used.\n * @property {string} [key] - Alias for `name`.\n * @property {string} [url] - The url for this resource, relative to the baseUrl of this loader.\n * @property {string|boolean} [crossOrigin] - Is this request cross-origin? Default is to\n * determine automatically.\n * @property {number} [timeout=0] - A timeout in milliseconds for the load. If the load takes\n * longer than this time it is cancelled and the load is considered a failure. If this value is\n * set to `0` then there is no explicit timeout.\n * @property {Resource.LOAD_TYPE} [loadType=Resource.LOAD_TYPE.XHR] - How should this resource\n * be loaded?\n * @property {Resource.XHR_RESPONSE_TYPE} [xhrType=Resource.XHR_RESPONSE_TYPE.DEFAULT] - How\n * should the data being loaded be interpreted when using XHR?\n * @property {Resource.OnCompleteSignal} [onComplete] - Callback to add an an onComplete signal istener.\n * @property {Resource.OnCompleteSignal} [callback] - Alias for `onComplete`.\n * @property {Resource.IMetadata} [metadata] - Extra configuration for middleware and the Resource object.\n */\n\n /* eslint-disable require-jsdoc,valid-jsdoc */\n\n /**\n * Adds a resource (or multiple resources) to the loader queue.\n *\n * This function can take a wide variety of different parameters. The only thing that is always\n * required the url to load. All the following will work:\n *\n * ```js\n * loader\n * // normal param syntax\n * .add('key', 'http://...', function () {})\n * .add('http://...', function () {})\n * .add('http://...')\n *\n * // object syntax\n * .add({\n * name: 'key2',\n * url: 'http://...'\n * }, function () {})\n * .add({\n * url: 'http://...'\n * }, function () {})\n * .add({\n * name: 'key3',\n * url: 'http://...'\n * onComplete: function () {}\n * })\n * .add({\n * url: 'https://...',\n * onComplete: function () {},\n * crossOrigin: true\n * })\n *\n * // you can also pass an array of objects or urls or both\n * .add([\n * { name: 'key4', url: 'http://...', onComplete: function () {} },\n * { url: 'http://...', onComplete: function () {} },\n * 'http://...'\n * ])\n *\n * // and you can use both params and options\n * .add('key', 'http://...', { crossOrigin: true }, function () {})\n * .add('http://...', { crossOrigin: true }, function () {});\n * ```\n *\n * @function\n * @variation 1\n * @param {string} name - The name of the resource to load.\n * @param {string} url - The url for this resource, relative to the baseUrl of this loader.\n * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.\n * @return {this} Returns itself.\n */\n\n /**\n * @function\n * @variation 2\n * @param {string} name - The name of the resource to load.\n * @param {string} url - The url for this resource, relative to the baseUrl of this loader.\n * @param {IAddOptions} [options] - The options for the load.\n * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.\n * @return {this} Returns itself.\n */\n\n /**\n * @function\n * @variation 3\n * @param {string} url - The url for this resource, relative to the baseUrl of this loader.\n * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.\n * @return {this} Returns itself.\n */\n\n /**\n * @function\n * @variation 4\n * @param {string} url - The url for this resource, relative to the baseUrl of this loader.\n * @param {IAddOptions} [options] - The options for the load.\n * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.\n * @return {this} Returns itself.\n */\n\n /**\n * @function\n * @variation 5\n * @param {IAddOptions} options - The options for the load. This object must contain a `url` property.\n * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.\n * @return {this} Returns itself.\n */\n\n /**\n * @function\n * @variation 6\n * @param {Array} resources - An array of resources to load, where each is\n * either an object with the options or a string url. If you pass an object, it must contain a `url` property.\n * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.\n * @return {this} Returns itself.\n */\n\n\n var _proto = Loader.prototype;\n\n _proto.add = function add(name, url, options, cb) {\n // special case of an array of objects or urls\n if (Array.isArray(name)) {\n for (var i = 0; i < name.length; ++i) {\n this.add(name[i]);\n }\n\n return this;\n } // if an object is passed instead of params\n\n\n if (typeof name === 'object') {\n cb = url || name.callback || name.onComplete;\n options = name;\n url = name.url;\n name = name.name || name.key || name.url;\n } // case where no name is passed shift all args over by one.\n\n\n if (typeof url !== 'string') {\n cb = options;\n options = url;\n url = name;\n } // now that we shifted make sure we have a proper url.\n\n\n if (typeof url !== 'string') {\n throw new Error('No url passed to add resource to loader.');\n } // options are optional so people might pass a function and no options\n\n\n if (typeof options === 'function') {\n cb = options;\n options = null;\n } // if loading already you can only add resources that have a parent.\n\n\n if (this.loading && (!options || !options.parentResource)) {\n throw new Error('Cannot add resources while the loader is running.');\n } // check if resource already exists.\n\n\n if (this.resources[name]) {\n throw new Error(\"Resource named \\\"\" + name + \"\\\" already exists.\");\n } // add base url if this isn't an absolute url\n\n\n url = this._prepareUrl(url); // create the store the resource\n\n this.resources[name] = new Resource(name, url, options);\n\n if (typeof cb === 'function') {\n this.resources[name].onAfterMiddleware.once(cb);\n } // if actively loading, make sure to adjust progress chunks for that parent and its children\n\n\n if (this.loading) {\n var parent = options.parentResource;\n var incompleteChildren = [];\n\n for (var _i2 = 0; _i2 < parent.children.length; ++_i2) {\n if (!parent.children[_i2].isComplete) {\n incompleteChildren.push(parent.children[_i2]);\n }\n }\n\n var fullChunk = parent.progressChunk * (incompleteChildren.length + 1); // +1 for parent\n\n var eachChunk = fullChunk / (incompleteChildren.length + 2); // +2 for parent & new child\n\n parent.children.push(this.resources[name]);\n parent.progressChunk = eachChunk;\n\n for (var _i3 = 0; _i3 < incompleteChildren.length; ++_i3) {\n incompleteChildren[_i3].progressChunk = eachChunk;\n }\n\n this.resources[name].progressChunk = eachChunk;\n } // add the resource to the queue\n\n\n this._queue.push(this.resources[name]);\n\n return this;\n }\n /* eslint-enable require-jsdoc,valid-jsdoc */\n\n /**\n * Sets up a middleware function that will run *before* the\n * resource is loaded.\n *\n * @param {function} fn - The middleware function to register.\n * @return {this} Returns itself.\n */\n ;\n\n _proto.pre = function pre(fn) {\n this._beforeMiddleware.push(fn);\n\n return this;\n }\n /**\n * Sets up a middleware function that will run *after* the\n * resource is loaded.\n *\n * @param {function} fn - The middleware function to register.\n * @return {this} Returns itself.\n */\n ;\n\n _proto.use = function use(fn) {\n this._afterMiddleware.push(fn);\n\n return this;\n }\n /**\n * Resets the queue of the loader to prepare for a new load.\n *\n * @return {this} Returns itself.\n */\n ;\n\n _proto.reset = function reset() {\n this.progress = 0;\n this.loading = false;\n\n this._queue.kill();\n\n this._queue.pause(); // abort all resource loads\n\n\n for (var k in this.resources) {\n var res = this.resources[k];\n\n if (res._onLoadBinding) {\n res._onLoadBinding.detach();\n }\n\n if (res.isLoading) {\n res.abort();\n }\n }\n\n this.resources = {};\n return this;\n }\n /**\n * Starts loading the queued resources.\n *\n * @param {function} [cb] - Optional callback that will be bound to the `complete` event.\n * @return {this} Returns itself.\n */\n ;\n\n _proto.load = function load(cb) {\n // register complete callback if they pass one\n if (typeof cb === 'function') {\n this.onComplete.once(cb);\n } // if the queue has already started we are done here\n\n\n if (this.loading) {\n return this;\n }\n\n if (this._queue.idle()) {\n this._onStart();\n\n this._onComplete();\n } else {\n // distribute progress chunks\n var numTasks = this._queue._tasks.length;\n var chunk = MAX_PROGRESS / numTasks;\n\n for (var i = 0; i < this._queue._tasks.length; ++i) {\n this._queue._tasks[i].data.progressChunk = chunk;\n } // notify we are starting\n\n\n this._onStart(); // start loading\n\n\n this._queue.resume();\n }\n\n return this;\n }\n /**\n * The number of resources to load concurrently.\n *\n * @member {number}\n * @default 10\n */\n ;\n\n /**\n * Prepares a url for usage based on the configuration of this object\n *\n * @private\n * @param {string} url - The url to prepare.\n * @return {string} The prepared url.\n */\n _proto._prepareUrl = function _prepareUrl(url) {\n var parsedUrl = parse_uri__WEBPACK_IMPORTED_MODULE_0___default()(url, {\n strictMode: true\n });\n var result; // absolute url, just use it as is.\n\n if (parsedUrl.protocol || !parsedUrl.path || url.indexOf('//') === 0) {\n result = url;\n } // if baseUrl doesn't end in slash and url doesn't start with slash, then add a slash inbetween\n else if (this.baseUrl.length && this.baseUrl.lastIndexOf('/') !== this.baseUrl.length - 1 && url.charAt(0) !== '/') {\n result = this.baseUrl + \"/\" + url;\n } else {\n result = this.baseUrl + url;\n } // if we need to add a default querystring, there is a bit more work\n\n\n if (this.defaultQueryString) {\n var hash = rgxExtractUrlHash.exec(result)[0];\n result = result.substr(0, result.length - hash.length);\n\n if (result.indexOf('?') !== -1) {\n result += \"&\" + this.defaultQueryString;\n } else {\n result += \"?\" + this.defaultQueryString;\n }\n\n result += hash;\n }\n\n return result;\n }\n /**\n * Loads a single resource.\n *\n * @private\n * @param {Resource} resource - The resource to load.\n * @param {function} dequeue - The function to call when we need to dequeue this item.\n */\n ;\n\n _proto._loadResource = function _loadResource(resource, dequeue) {\n var _this2 = this;\n\n resource._dequeue = dequeue; // run before middleware\n\n eachSeries(this._beforeMiddleware, function (fn, next) {\n fn.call(_this2, resource, function () {\n // if the before middleware marks the resource as complete,\n // break and don't process any more before middleware\n next(resource.isComplete ? {} : null);\n });\n }, function () {\n if (resource.isComplete) {\n _this2._onLoad(resource);\n } else {\n resource._onLoadBinding = resource.onComplete.once(_this2._onLoad, _this2);\n resource.load();\n }\n }, true);\n }\n /**\n * Called once loading has started.\n *\n * @private\n */\n ;\n\n _proto._onStart = function _onStart() {\n this.progress = 0;\n this.loading = true;\n this.onStart.dispatch(this);\n }\n /**\n * Called once each resource has loaded.\n *\n * @private\n */\n ;\n\n _proto._onComplete = function _onComplete() {\n this.progress = MAX_PROGRESS;\n this.loading = false;\n this.onComplete.dispatch(this, this.resources);\n }\n /**\n * Called each time a resources is loaded.\n *\n * @private\n * @param {Resource} resource - The resource that was loaded\n */\n ;\n\n _proto._onLoad = function _onLoad(resource) {\n var _this3 = this;\n\n resource._onLoadBinding = null; // remove this resource from the async queue, and add it to our list of resources that are being parsed\n\n this._resourcesParsing.push(resource);\n\n resource._dequeue(); // run all the after middleware for this resource\n\n\n eachSeries(this._afterMiddleware, function (fn, next) {\n fn.call(_this3, resource, next);\n }, function () {\n resource.onAfterMiddleware.dispatch(resource);\n _this3.progress = Math.min(MAX_PROGRESS, _this3.progress + resource.progressChunk);\n\n _this3.onProgress.dispatch(_this3, resource);\n\n if (resource.error) {\n _this3.onError.dispatch(resource.error, _this3, resource);\n } else {\n _this3.onLoad.dispatch(_this3, resource);\n }\n\n _this3._resourcesParsing.splice(_this3._resourcesParsing.indexOf(resource), 1); // do completion check\n\n\n if (_this3._queue.idle() && _this3._resourcesParsing.length === 0) {\n _this3._onComplete();\n }\n }, true);\n };\n\n _createClass(Loader, [{\n key: \"concurrency\",\n get: function get() {\n return this._queue.concurrency;\n } // eslint-disable-next-line require-jsdoc\n ,\n set: function set(concurrency) {\n this._queue.concurrency = concurrency;\n }\n }]);\n\n return Loader;\n}();\n/**\n * A default array of middleware to run before loading each resource.\n * Each of these middlewares are added to any new Loader instances when they are created.\n *\n * @private\n * @member {function[]}\n */\n\n\nLoader._defaultBeforeMiddleware = [];\n/**\n * A default array of middleware to run after loading each resource.\n * Each of these middlewares are added to any new Loader instances when they are created.\n *\n * @private\n * @member {function[]}\n */\n\nLoader._defaultAfterMiddleware = [];\n/**\n * Sets up a middleware function that will run *before* the\n * resource is loaded.\n *\n * @static\n * @param {function} fn - The middleware function to register.\n * @return {Loader} Returns itself.\n */\n\nLoader.pre = function LoaderPreStatic(fn) {\n Loader._defaultBeforeMiddleware.push(fn);\n\n return Loader;\n};\n/**\n * Sets up a middleware function that will run *after* the\n * resource is loaded.\n *\n * @static\n * @param {function} fn - The middleware function to register.\n * @return {Loader} Returns itself.\n */\n\n\nLoader.use = function LoaderUseStatic(fn) {\n Loader._defaultAfterMiddleware.push(fn);\n\n return Loader;\n};\n\n\n//# sourceMappingURL=resource-loader.esm.js.map\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./node_modules/resource-loader/dist/resource-loader.esm.js?"); /***/ }), /***/ "./ts/main.ts": /*!********************!*\ !*** ./ts/main.ts ***! \********************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}));\r\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n__webpack_require__(/*! ./mr/lively/Extensions */ \"./ts/mr/lively/Extensions.ts\");\r\n__webpack_require__(/*! ./mr/rmmz/DataManager */ \"./ts/mr/rmmz/DataManager.ts\");\r\n__webpack_require__(/*! ./mr/rmmz/Game_BattlerBase */ \"./ts/mr/rmmz/Game_BattlerBase.ts\");\r\n__webpack_require__(/*! ./mr/rmmz/Game_CharacterBase */ \"./ts/mr/rmmz/Game_CharacterBase.ts\");\r\n__webpack_require__(/*! ./mr/rmmz/Game_Player */ \"./ts/mr/rmmz/Game_Player.ts\");\r\n__webpack_require__(/*! ./mr/rmmz/Game_Event */ \"./ts/mr/rmmz/Game_Event.ts\");\r\n__webpack_require__(/*! ./mr/rmmz/Game_Map */ \"./ts/mr/rmmz/Game_Map.ts\");\r\n__webpack_require__(/*! ./mr/rmmz/Game_Interpreter */ \"./ts/mr/rmmz/Game_Interpreter.ts\");\r\n__webpack_require__(/*! ./mr/rmmz/Game_Message */ \"./ts/mr/rmmz/Game_Message.ts\");\r\n__webpack_require__(/*! ./mr/rmmz/Game_System */ \"./ts/mr/rmmz/Game_System.ts\");\r\n__webpack_require__(/*! ./mr/rmmz/PrefabEvent */ \"./ts/mr/rmmz/PrefabEvent.ts\");\r\n__webpack_require__(/*! ./mr/view/ui/Window_Base */ \"./ts/mr/view/ui/Window_Base.ts\");\r\n__webpack_require__(/*! ./mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\n__webpack_require__(/*! ./mr/data/MRDataManager */ \"./ts/mr/data/MRDataManager.ts\");\r\n__webpack_require__(/*! ./mr/data/DTextManager */ \"./ts/mr/data/DTextManager.ts\");\r\n__webpack_require__(/*! ./mr/lively/internal */ \"./ts/mr/lively/internal.ts\");\r\n__webpack_require__(/*! ./mr/lively/entity/LEntity */ \"./ts/mr/lively/entity/LEntity.ts\");\r\n__webpack_require__(/*! ./mr/lively/LMap */ \"./ts/mr/lively/LMap.ts\");\r\n__webpack_require__(/*! ./mr/lively/LSystem */ \"./ts/mr/lively/LSystem.ts\");\r\n__webpack_require__(/*! ./mr/system/internal */ \"./ts/mr/system/internal.ts\");\r\n__webpack_require__(/*! ./mr/system/SEntityFactory */ \"./ts/mr/system/SEntityFactory.ts\");\r\n__webpack_require__(/*! ./mr/rmmz/Scene_Boot */ \"./ts/mr/rmmz/Scene_Boot.ts\");\r\n__webpack_require__(/*! ./mr/rmmz/Scene_Title */ \"./ts/mr/rmmz/Scene_Title.ts\");\r\n__webpack_require__(/*! ./mr/rmmz/Scene_Map */ \"./ts/mr/rmmz/Scene_Map.ts\");\r\n__webpack_require__(/*! ./mr/rmmz/Scene_Save */ \"./ts/mr/rmmz/Scene_Save.ts\");\r\n__webpack_require__(/*! ./mr/rmmz/Scene_Load */ \"./ts/mr/rmmz/Scene_Load.ts\");\r\n__webpack_require__(/*! ./mr/rmmz/Tilemap */ \"./ts/mr/rmmz/Tilemap.ts\");\r\n__webpack_require__(/*! ./mr/rmmz/Sprite_Character */ \"./ts/mr/rmmz/Sprite_Character.ts\");\r\n__webpack_require__(/*! ./mr/rmmz/Spriteset_Base */ \"./ts/mr/rmmz/Spriteset_Base.ts\");\r\n__webpack_require__(/*! ./mr/rmmz/Spriteset_Map */ \"./ts/mr/rmmz/Spriteset_Map.ts\");\r\n__webpack_require__(/*! ./mr/rmmz/Window_MapName */ \"./ts/mr/rmmz/Window_MapName.ts\");\r\n__webpack_require__(/*! ./mr/rmmz/WindowLayer */ \"./ts/mr/rmmz/WindowLayer.ts\");\r\n__webpack_require__(/*! ./mr/rmmz/PluginCommands */ \"./ts/mr/rmmz/PluginCommands.ts\");\r\n__webpack_require__(/*! ./mr/rmmz/JsonEx */ \"./ts/mr/rmmz/JsonEx.ts\");\r\n__webpack_require__(/*! ./mr/ConsoleCommands */ \"./ts/mr/ConsoleCommands.ts\");\r\n__exportStar(__webpack_require__(/*! ./mr/data/index */ \"./ts/mr/data/index.ts\"), exports);\r\n__exportStar(__webpack_require__(/*! ./mr/view/MRView */ \"./ts/mr/view/MRView.ts\"), exports);\r\n__exportStar(__webpack_require__(/*! ./mr/view/VChronus */ \"./ts/mr/view/VChronus.ts\"), exports);\r\n// 後段のプラグインが、 MRModule という名前で MRシステムにアクセスできるようにする。\r\nwindow.MRModule = this;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/main.ts?"); /***/ }), /***/ "./ts/mr/Common.ts": /*!*************************!*\ !*** ./ts/mr/Common.ts ***! \*************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.MRSerializable = exports.TypeStore = exports.Log = exports.tr2 = exports.tr = exports.assert = void 0;\r\n__webpack_require__(/*! ./lively/Extensions */ \"./ts/mr/lively/Extensions.ts\");\r\nfunction assert(condition, msg) {\r\n if (!condition) {\r\n console.error(\"assert: \" + msg);\r\n throw new Error(msg);\r\n }\r\n}\r\nexports.assert = assert;\r\nfunction tr(text, ...keys) {\r\n var result = text;\r\n for (var i = 0; i < keys.length; i++) {\r\n var pattern = \"\\\\{\" + i + \"\\\\}\";\r\n var re = new RegExp(pattern, \"g\");\r\n result = result.replace(re, keys[i]);\r\n }\r\n return result;\r\n}\r\nexports.tr = tr;\r\nfunction tr2(text) {\r\n return text;\r\n}\r\nexports.tr2 = tr2;\r\nclass Log {\r\n static d(text) {\r\n if (this._enabled) {\r\n console.log(\"%c\" + text, \"color: blue; font-weight: bold\");\r\n }\r\n }\r\n static postCommand(text) {\r\n if (this._enabled) {\r\n console.log(`%c[Post: ${text}]`, \"color: maroon\");\r\n }\r\n }\r\n static doCommand(text) {\r\n if (this._enabled) {\r\n console.log(`%c[Do: ${text}]`, \"color: fuchsia\");\r\n }\r\n }\r\n}\r\nexports.Log = Log;\r\nLog._enabled = false;\r\nclass TypeStore {\r\n static register(constructor) {\r\n let friendlyName = constructor.name;\r\n this.typeInfos.push({\r\n fullName: constructor.name,\r\n friendlyName: friendlyName,\r\n function: constructor,\r\n });\r\n }\r\n static createInstance(name) {\r\n const t = this.typeInfos.find(x => x.fullName == name || x.friendlyName == name);\r\n if (!t) {\r\n const message = tr2(\"%1が登録されていません。@MRSerializable でクラスを装飾してください。\").format(name);\r\n console.error(message);\r\n throw new Error(message);\r\n }\r\n return Object.create(t.function.prototype);\r\n }\r\n}\r\nexports.TypeStore = TypeStore;\r\nTypeStore.typeInfos = [];\r\nfunction MRSerializable(constructor) {\r\n TypeStore.register(constructor);\r\n}\r\nexports.MRSerializable = MRSerializable;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/Common.ts?"); /***/ }), /***/ "./ts/mr/ConsoleCommands.ts": /*!**********************************!*\ !*** ./ts/mr/ConsoleCommands.ts ***! \**********************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nconst Common_1 = __webpack_require__(/*! ./Common */ \"./ts/mr/Common.ts\");\r\nconst DSpawner_1 = __webpack_require__(/*! ./data/DSpawner */ \"./ts/mr/data/DSpawner.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ./data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ./data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst LInventoryBehavior_1 = __webpack_require__(/*! ./lively/entity/LInventoryBehavior */ \"./ts/mr/lively/entity/LInventoryBehavior.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ./lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst internal_1 = __webpack_require__(/*! ./system/internal */ \"./ts/mr/system/internal.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ./system/MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst SDebugHelpers_1 = __webpack_require__(/*! ./system/SDebugHelpers */ \"./ts/mr/system/SDebugHelpers.ts\");\r\nfunction entities(domain) {\r\n if (domain == \"world\") {\r\n //return REGame.world.entities();\r\n throw new Error(\"Not implemented.\");\r\n }\r\n else {\r\n return MRLively_1.MRLively.mapView.currentMap.entities();\r\n }\r\n}\r\nfunction listMapEntities() {\r\n const map = MRLively_1.MRLively.mapView.currentMap;\r\n const entities = map.entities();\r\n console.log(`Map entities (${entities.length}):`);\r\n entities.forEach(e => {\r\n console.log(` ${e.entityId().index2()} (${e.data.entity.key})`, e);\r\n });\r\n}\r\nfunction mapInfo() {\r\n return MRLively_1.MRLively.mapView.currentMap;\r\n}\r\nfunction setHP(entityId, value) {\r\n const e = MRLively_1.MRLively.world.entityByIndex(entityId);\r\n SDebugHelpers_1.SDebugHelpers.setHP(e, value);\r\n}\r\nfunction setFP(entityId, value) {\r\n const e = MRLively_1.MRLively.world.entityByIndex(entityId);\r\n SDebugHelpers_1.SDebugHelpers.setFP(e, value);\r\n}\r\nfunction setPlayerParameter(key, value) {\r\n const player = MRLively_1.MRLively.mapView.focusedEntity();\r\n if (!player)\r\n return;\r\n player.setParamCurrentValue(MRData_1.MRData.getParameter(key).id, value);\r\n}\r\nfunction setVariable(id, value) {\r\n $gameVariables.setValue(id, value);\r\n}\r\n/**\r\n *\r\n * @param entityId\r\n * @param pattern id, name, key\r\n */\r\nfunction addState(entityKey, stateKey) {\r\n const e = MRLively_1.MRLively.world.getFirstEntityByKey(entityKey);\r\n e.addState(MRData_1.MRData.getState(stateKey).id);\r\n}\r\nfunction visitAll() {\r\n const player = MRLively_1.MRLively.world.entity(MRLively_1.MRLively.system.mainPlayerEntityId);\r\n player.addState(MRData_1.MRData.getState(\"UT気配察知\").id);\r\n player.addState(MRData_1.MRData.getState(\"UT道具感知\").id);\r\n MRLively_1.MRLively.mapView.currentMap.unitClarity = true;\r\n MRLively_1.MRLively.mapView.currentMap.blocks().forEach(b => b._passed = true);\r\n MRSystem_1.MRSystem.minimapData.setRefreshNeeded();\r\n}\r\nfunction levelMax() {\r\n const player = MRLively_1.MRLively.mapView.focusedEntity();\r\n if (player) {\r\n player.setParamCurrentValue(MRBasics_1.MRBasics.params.level, 99);\r\n }\r\n}\r\nfunction moveToExit() {\r\n const exitPoint = MRLively_1.MRLively.mapView.currentMap.entities().find(x => x.kindDataId() == MRBasics_1.MRBasics.entityCategories.exitPoint);\r\n if (!exitPoint)\r\n return;\r\n const player = MRLively_1.MRLively.mapView.focusedEntity();\r\n if (!player)\r\n return;\r\n MRLively_1.MRLively.world.transferEntity(player, player.floorId, exitPoint.mx, exitPoint.my);\r\n}\r\nfunction addItem(itemKey) {\r\n const item = internal_1.SEntityFactory.newEntity(DSpawner_1.DEntityCreateInfo.makeSingle(MRData_1.MRData.getEntity(itemKey).id));\r\n const player = MRLively_1.MRLively.mapView.focusedEntity();\r\n if (!player)\r\n return;\r\n player.getEntityBehavior(LInventoryBehavior_1.LInventoryBehavior).addEntity(item);\r\n}\r\nwindow.MR = {\r\n entities: entities,\r\n listMapEntities: listMapEntities,\r\n mapInfo: mapInfo,\r\n setHP: setHP,\r\n setFP: setFP,\r\n setPlayerParameter: setPlayerParameter,\r\n addState: addState,\r\n visitAll: visitAll,\r\n setVariable: setVariable,\r\n levelMax: levelMax,\r\n moveToExit: moveToExit,\r\n addItem: addItem,\r\n};\r\nObject.defineProperty(window.MR, \"player\", {\r\n get: function () {\r\n const player = MRLively_1.MRLively.mapView.focusedEntity();\r\n (0, Common_1.assert)(player);\r\n return player;\r\n }\r\n});\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/ConsoleCommands.ts?"); /***/ }), /***/ "./ts/mr/Diag.ts": /*!***********************!*\ !*** ./ts/mr/Diag.ts ***! \***********************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Diag = void 0;\r\nclass Diag {\r\n static error(message) {\r\n throw new Error(message);\r\n }\r\n}\r\nexports.Diag = Diag;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/Diag.ts?"); /***/ }), /***/ "./ts/mr/PluginParameters.ts": /*!***********************************!*\ !*** ./ts/mr/PluginParameters.ts ***! \***********************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.paramDisableWindowStencil = exports.paramSandboxWorldSystem = exports.paramQuestSystem = exports.paramDestroyOverflowingItems = exports.paramDefaultStorageLimit = exports.paramUseThinkingAgent = exports.paramTouchMoveEnabled = exports.paramForceSync = exports.paramUIMode = exports.paramInventoryItemsPerPage = exports.paramInventoryCapacity = exports.paramSuspendMenuEnabled = exports.paramThrowingDistance = exports.paramRandomMapPaddingY = exports.paramRandomMapPaddingX = exports.paramDefaultVisibiltyLength = exports.paramMonsterHouseItemsMin = exports.paramMonsterHouseItemsMax = exports.paramMonsterHouseEnemiesMin = exports.paramMonsterHouseEnemiesMax = exports.paramMaxTrapsInMap = exports.paramMaxItemsInMap = exports.paramMaxUnitsInMap = exports.paramFPLoss = exports.paramMaxEntityStackCount = exports.paraIndirectPhysicalHitRate = exports.paramExposedTrapTriggerRate = exports.paramHiddenTrapTriggerRate = exports.paramPowerToAtk = exports.paramEnemySpawnInvalidArea = exports.paramRandomMapDefaultHeight = exports.paramRandomMapDefaultWidth = exports.paramFixedMapPassagewayRegionId = exports.paramFixedMapItemShopRoomRegionId = exports.paramFixedMapMonsterHouseRoomRegionId = exports.paramFixedMapRoomRegionId = void 0;\r\nvar pluginName = 'LN_MysteryRogueSystem';\r\nfunction getNumber(key, defaultValue) {\r\n if (typeof PluginManager == \"undefined\")\r\n return defaultValue;\r\n const v = PluginManager.parameters(pluginName)[key];\r\n if (v === undefined)\r\n return defaultValue;\r\n return Number(v);\r\n}\r\nfunction getBoolean(key, defaultValue) {\r\n if (typeof PluginManager == \"undefined\")\r\n return defaultValue;\r\n const v = PluginManager.parameters(pluginName)[key];\r\n if (v === undefined)\r\n return defaultValue;\r\n return v.toLowerCase() === 'true';\r\n}\r\nfunction getString(key, defaultValue) {\r\n if (typeof PluginManager == \"undefined\")\r\n return defaultValue;\r\n const v = PluginManager.parameters(pluginName)[key];\r\n if (v === undefined)\r\n return defaultValue;\r\n return v;\r\n}\r\n// 固定マップで部屋をマークするためのリージョンID\r\nexports.paramFixedMapRoomRegionId = 1;\r\n// 固定マップで部屋及びモンスターハウスをマークするためのリージョンID\r\nexports.paramFixedMapMonsterHouseRoomRegionId = 2;\r\n// 固定マップで部屋及び店をマークするためのリージョンID\r\nexports.paramFixedMapItemShopRoomRegionId = 3;\r\n// 固定マップで通路をマークするためのリージョンID\r\nexports.paramFixedMapPassagewayRegionId = 8;\r\n// ランダムマップの最大幅 (12の倍数)\r\nexports.paramRandomMapDefaultWidth = 60;\r\n// ランダムマップの最大高さ (12の倍数)\r\nexports.paramRandomMapDefaultHeight = 48;\r\n// エネミーのランダム出現時、自分の周囲に生成しないようにする範囲\r\nexports.paramEnemySpawnInvalidArea = 12;\r\nexports.paramPowerToAtk = true;\r\n// 見えない罠を踏んだ時の発動率 (%)\r\nexports.paramHiddenTrapTriggerRate = 80;\r\n// 見えている罠を踏んだ時の発動率 (%)\r\nexports.paramExposedTrapTriggerRate = 50;\r\n// 物理間接攻撃の基本命中率 (%)\r\nexports.paraIndirectPhysicalHitRate = 85;\r\nexports.paramMaxEntityStackCount = 99;\r\n// 1ターンの満腹度減少量\r\nexports.paramFPLoss = getNumber(\"BasicFPLoss\", 10);\r\nexports.paramMaxUnitsInMap = 50;\r\nexports.paramMaxItemsInMap = 100;\r\nexports.paramMaxTrapsInMap = 100;\r\nexports.paramMonsterHouseEnemiesMax = 20;\r\nexports.paramMonsterHouseEnemiesMin = 5;\r\nexports.paramMonsterHouseItemsMax = 20; // アイテムまたはトラップ。同じマスに置けないし、ワナ師ダンジョンでは両方アイテムと考えるのが妥当だろう。\r\nexports.paramMonsterHouseItemsMin = 5;\r\n// 視界不明瞭部屋での視界 (半径)\r\nexports.paramDefaultVisibiltyLength = 6;\r\nexports.paramRandomMapPaddingX = getNumber(\"RandomMapPaddingX\", 8);\r\nexports.paramRandomMapPaddingY = getNumber(\"RandomMapPaddingY\", 6);\r\n// 投げた時の飛距離\r\nexports.paramThrowingDistance = 10;\r\nexports.paramSuspendMenuEnabled = getBoolean(\"SuspendMenuEnabled\", false);\r\n// 持ち物の最大数\r\nexports.paramInventoryCapacity = getNumber(\"InventoryCapacity\", 24);\r\n// ウィンドウの1ページ分のアイテム数\r\nexports.paramInventoryItemsPerPage = getNumber(\"InventoryItemsPerPage\", 12);\r\nexports.paramUIMode = getString(\"UIMode\", \"Traditional\"); //\"Default\");//\r\nexports.paramForceSync = getBoolean(\"SyncActorParams\", true);\r\nexports.paramTouchMoveEnabled = false;\r\nexports.paramUseThinkingAgent = true;\r\nexports.paramDefaultStorageLimit = 8;\r\nexports.paramDestroyOverflowingItems = false;\r\nexports.paramQuestSystem = false;\r\nexports.paramSandboxWorldSystem = getBoolean(\"SandboxWorldSystem\", false);\r\nexports.paramDisableWindowStencil = getBoolean(\"DisableWindowStencil\", false);\r\n//Maximum number of items in the map\r\n/*\r\n//\r\nexport var paramMapSkillEffectsMapId = Number(PluginManager.parameters(pluginName)['MapSkillEffectsMapId']);\r\n\r\n// ガイドラインの地形タグ\r\nexport var paramGuideLineTerrainTag = Number(PluginManager.parameters(pluginName)['GuideLineTerrainTag']);\r\n\r\n// オブジェクトの落下速度\r\nexport var paramFallingSpeed = 5;\r\n\r\nexport var paramAllowAllMapPuzzles: boolean = true;\r\n\r\nvar localAllowAllMapPuzzles = PluginManager.parameters(pluginName)['AllowAllMapPuzzles'];\r\nif (localAllowAllMapPuzzles != undefined) {\r\n paramAllowAllMapPuzzles = (localAllowAllMapPuzzles.toLowerCase() === 'true');\r\n}\r\n\r\n// 滑る床リージョン ID\r\nexport var paramSlipperyTileRegionId = Number(PluginManager.parameters(pluginName)['SlipperyTileRegionId']);\r\n// = 1;\r\n\r\n// 滑り中のアニメーションパターン\r\nexport var paramSlippingAnimationPattern = Number(PluginManager.parameters(pluginName)['SlippingAnimationPattern']);\r\n// = 2;\r\n*/\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/PluginParameters.ts?"); /***/ }), /***/ "./ts/mr/data/DAbility.ts": /*!********************************!*\ !*** ./ts/mr/data/DAbility.ts ***! \********************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DAbility_Default = void 0;\r\nfunction DAbility_Default() {\r\n return {\r\n id: 0,\r\n key: \"null\",\r\n reactions: [],\r\n };\r\n}\r\nexports.DAbility_Default = DAbility_Default;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DAbility.ts?"); /***/ }), /***/ "./ts/mr/data/DActor.ts": /*!******************************!*\ !*** ./ts/mr/data/DActor.ts ***! \******************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DActor = void 0;\r\n/**\r\n * Actor はゲームシナリオ全体を通して存在する一意の登場人物を表すデータ構造。\r\n *\r\n * ツクールの Actor とほぼ同義で、そこからインポートして使う。\r\n * ただし、必ずしも味方であるとは限らない。\r\n */\r\nclass DActor {\r\n constructor(id) {\r\n this.id = id;\r\n this.rmmzActorId = 0;\r\n this.initialX = 0;\r\n this.initialY = 0;\r\n this.maxLevel = 0;\r\n this.initialLevel = 0;\r\n this.actionCommands = [];\r\n }\r\n setup(data) {\r\n this.rmmzActorId = data.id;\r\n this.initialLevel = data.initialLevel;\r\n this.maxLevel = data.maxLevel;\r\n }\r\n}\r\nexports.DActor = DActor;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DActor.ts?"); /***/ }), /***/ "./ts/mr/data/DBehavior.ts": /*!*********************************!*\ !*** ./ts/mr/data/DBehavior.ts ***! \*********************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DBehaviorInstantiation = exports.DBehavior = void 0;\r\nconst MRData_1 = __webpack_require__(/*! ./MRData */ \"./ts/mr/data/MRData.ts\");\r\n/**\r\n * Behavior のデータクラス。DTrait と同じようなもの。\r\n *\r\n * @note\r\n * ずっと不要かと考えていたが、\r\n * - エディタなどから追加の Behavior を指定するときに FrientlyName を使いたい\r\n * - コード内で識別するときは FullName の方が安定しやすい\r\n * ということで両方をサポートしていたが、検索や名前の分解などのためにコードが複雑になってきた。\r\n *\r\n */\r\nclass DBehavior {\r\n //public readonly descriptions: string[];\r\n constructor(id, key, fullName, friendlyName) {\r\n this.id = id;\r\n this.key = key;\r\n this.fullName = fullName;\r\n this.friendlyName = friendlyName;\r\n //this.descriptions = [];\r\n }\r\n}\r\nexports.DBehavior = DBehavior;\r\n// IDataTrait や IDataEffect のようなもの。Data に対する Instance 引数。\r\nclass DBehaviorInstantiation {\r\n constructor(behaviorId, props) {\r\n this.behaviorId = behaviorId;\r\n this.props = props;\r\n }\r\n get data() {\r\n return MRData_1.MRData.behavior[this.behaviorId];\r\n }\r\n}\r\nexports.DBehaviorInstantiation = DBehaviorInstantiation;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DBehavior.ts?"); /***/ }), /***/ "./ts/mr/data/DChronus.ts": /*!********************************!*\ !*** ./ts/mr/data/DChronus.ts ***! \********************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DChronus = exports.DChronusTimeFrameKind = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst PluginParameters_1 = __webpack_require__(/*! ../PluginParameters */ \"./ts/mr/PluginParameters.ts\");\r\nvar DChronusTimeFrameKind;\r\n(function (DChronusTimeFrameKind) {\r\n DChronusTimeFrameKind[DChronusTimeFrameKind[\"Daytime\"] = 0] = \"Daytime\";\r\n DChronusTimeFrameKind[DChronusTimeFrameKind[\"Nighttime\"] = 1] = \"Nighttime\";\r\n})(DChronusTimeFrameKind = exports.DChronusTimeFrameKind || (exports.DChronusTimeFrameKind = {}));\r\nclass DChronus {\r\n constructor() {\r\n /** 1分の秒数 */\r\n this.secondsInMinute = 60;\r\n /** 1時間の分数 */\r\n this.minutesInHour = 60;\r\n /** 1日の分数 */\r\n this.hoursInDay = 24;\r\n this.timeFrames = [\r\n { name: (0, Common_1.tr2)(\"深夜\"), kind: DChronusTimeFrameKind.Nighttime, startHour: 0, lastHouer: 4, timeFrameId: 0 },\r\n { name: (0, Common_1.tr2)(\"早朝\"), kind: DChronusTimeFrameKind.Nighttime, startHour: 5, lastHouer: 6, timeFrameId: 1 },\r\n { name: (0, Common_1.tr2)(\"朝\"), kind: DChronusTimeFrameKind.Daytime, startHour: 7, lastHouer: 11, timeFrameId: 2 },\r\n { name: (0, Common_1.tr2)(\"昼\"), kind: DChronusTimeFrameKind.Daytime, startHour: 12, lastHouer: 16, timeFrameId: 3 },\r\n { name: (0, Common_1.tr2)(\"夕方\"), kind: DChronusTimeFrameKind.Daytime, startHour: 17, lastHouer: 18, timeFrameId: 4 },\r\n { name: (0, Common_1.tr2)(\"夜\"), kind: DChronusTimeFrameKind.Nighttime, startHour: 19, lastHouer: 21, timeFrameId: 5 },\r\n { name: (0, Common_1.tr2)(\"深夜\"), kind: DChronusTimeFrameKind.Nighttime, startHour: 22, lastHouer: 24, timeFrameId: 0 },\r\n ];\r\n this.timeTones = [\r\n // timeId:時間帯ID value:色調[赤(-255...255),緑(-255...255),青(-255...255),グレー(0...255)]\r\n { timeFrameId: 0, value: [-102, -102, -68, 102] },\r\n { timeFrameId: 1, value: [-68, -68, 0, 0] },\r\n { timeFrameId: 2, value: [0, 0, 0, 0] },\r\n { timeFrameId: 3, value: [34, 34, 34, 0] },\r\n { timeFrameId: 4, value: [68, -34, -34, 0] },\r\n { timeFrameId: 5, value: [-68, -68, 0, 68] },\r\n ];\r\n this.daysOfMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\r\n this.monthNames = [\"Jan.\", \"Feb.\", \"Mar.\", \"Apr.\", \"May.\", \"Jun.\", \"Jul.\", \"Aug.\", \"Sep.\", \"Oct.\", \"Nov.\", \"Dec.\"];\r\n this.weekNames = [\"(日)\", \"(月)\", \"(火)\", \"(水)\", \"(木)\", \"(金)\", \"(土)\"];\r\n this.secondsInRound = this.secondsInHour / 6; // 10 minutes\r\n }\r\n get enabled() { return PluginParameters_1.paramSandboxWorldSystem; }\r\n /** 1日の秒数 */\r\n get secondsInDay() {\r\n return this.secondsInMinute * this.minutesInHour * this.hoursInDay;\r\n }\r\n /** 1時間の秒数 */\r\n get secondsInHour() {\r\n return this.secondsInMinute * this.minutesInHour;\r\n }\r\n getDaysOfWeek() {\r\n return this.weekNames.length;\r\n }\r\n getDaysOfMonth(month) {\r\n return this.daysOfMonth[month - 1];\r\n }\r\n getMonthOfYear() {\r\n return this.monthNames.length;\r\n }\r\n /** 1年の日数 */\r\n getDaysOfYear() {\r\n let result = 0;\r\n for (const d of this.daysOfMonth) {\r\n result += d;\r\n }\r\n return result;\r\n }\r\n ;\r\n}\r\nexports.DChronus = DChronus;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DChronus.ts?"); /***/ }), /***/ "./ts/mr/data/DClass.ts": /*!******************************!*\ !*** ./ts/mr/data/DClass.ts ***! \******************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DClass = void 0;\r\nclass DClass {\r\n constructor(id) {\r\n this.id = 0;\r\n this.name = \"null\";\r\n this.expParams = [];\r\n this.params = [];\r\n this.traits = [];\r\n this.learnings = [];\r\n }\r\n}\r\nexports.DClass = DClass;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DClass.ts?"); /***/ }), /***/ "./ts/mr/data/DCommand.ts": /*!********************************!*\ !*** ./ts/mr/data/DCommand.ts ***! \********************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DCommand = void 0;\r\n/**\r\n */\r\nclass DCommand {\r\n constructor(id, name) {\r\n this.id = id;\r\n this.name = name;\r\n }\r\n}\r\nexports.DCommand = DCommand;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DCommand.ts?"); /***/ }), /***/ "./ts/mr/data/DCommon.ts": /*!*******************************!*\ !*** ./ts/mr/data/DCommon.ts ***! \*******************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DBlockLayerScope = exports.DBlockLayerKind = exports.DColorIndex = exports.DSubComponentEffectTargetKey = void 0;\r\n// Sub-Component を検索するためのキー\r\nclass DSubComponentEffectTargetKey {\r\n constructor() {\r\n this.path = \"\";\r\n this.kindId = 0;\r\n this.tags = [];\r\n }\r\n static make(path, kindId, tags) {\r\n const i = new DSubComponentEffectTargetKey();\r\n i.path = path;\r\n if (kindId)\r\n i.kindId = kindId;\r\n if (tags)\r\n i.tags = tags;\r\n return i;\r\n }\r\n clone() {\r\n const i = new DSubComponentEffectTargetKey();\r\n i.path = this.path;\r\n i.kindId = this.kindId;\r\n i.tags = this.tags.slice();\r\n return i;\r\n }\r\n}\r\nexports.DSubComponentEffectTargetKey = DSubComponentEffectTargetKey;\r\nvar DColorIndex;\r\n(function (DColorIndex) {\r\n DColorIndex[DColorIndex[\"Default\"] = 0] = \"Default\";\r\n})(DColorIndex = exports.DColorIndex || (exports.DColorIndex = {}));\r\nvar DBlockLayerKind;\r\n(function (DBlockLayerKind) {\r\n /** 地形情報。壁・水路など。 */\r\n DBlockLayerKind[DBlockLayerKind[\"Terrain\"] = 0] = \"Terrain\";\r\n /** 地表に落ちているもの。アイテム・ワナ・階段など。 */\r\n DBlockLayerKind[DBlockLayerKind[\"Ground\"] = 1] = \"Ground\";\r\n /** ユニット。PC・仲間・モンスター・土偶など。 */\r\n DBlockLayerKind[DBlockLayerKind[\"Unit\"] = 2] = \"Unit\";\r\n /** 発射物。矢、魔法弾、吹き飛ばされたUnitなど。 */\r\n DBlockLayerKind[DBlockLayerKind[\"Projectile\"] = 3] = \"Projectile\";\r\n /** お店のセキュリティシステムなど、非表示だが Entity として存在するもの。 */\r\n DBlockLayerKind[DBlockLayerKind[\"System\"] = 4] = \"System\";\r\n // Iteration\r\n DBlockLayerKind[DBlockLayerKind[\"Top\"] = 4] = \"Top\";\r\n})(DBlockLayerKind = exports.DBlockLayerKind || (exports.DBlockLayerKind = {}));\r\nvar DBlockLayerScope;\r\n(function (DBlockLayerScope) {\r\n DBlockLayerScope[DBlockLayerScope[\"TopOnly\"] = 0] = \"TopOnly\";\r\n DBlockLayerScope[DBlockLayerScope[\"All\"] = 1] = \"All\";\r\n})(DBlockLayerScope = exports.DBlockLayerScope || (exports.DBlockLayerScope = {}));\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DCommon.ts?"); /***/ }), /***/ "./ts/mr/data/DDataImporter.ts": /*!*************************************!*\ !*** ./ts/mr/data/DDataImporter.ts ***! \*************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DDataImporter = exports.DMapDataNodeLeafType = exports.DLandMapDataDirectory = exports.DMapDataNodeRootType = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ./MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst MRDataManager_1 = __webpack_require__(/*! ./MRDataManager */ \"./ts/mr/data/MRDataManager.ts\");\r\nvar DMapDataNodeRootType;\r\n(function (DMapDataNodeRootType) {\r\n DMapDataNodeRootType[DMapDataNodeRootType[\"LandLike\"] = 0] = \"LandLike\";\r\n DMapDataNodeRootType[DMapDataNodeRootType[\"MapTemplates\"] = 1] = \"MapTemplates\";\r\n})(DMapDataNodeRootType = exports.DMapDataNodeRootType || (exports.DMapDataNodeRootType = {}));\r\nvar DLandMapDataDirectory;\r\n(function (DLandMapDataDirectory) {\r\n DLandMapDataDirectory[DLandMapDataDirectory[\"Table\"] = 0] = \"Table\";\r\n DLandMapDataDirectory[DLandMapDataDirectory[\"System\"] = 1] = \"System\";\r\n DLandMapDataDirectory[DLandMapDataDirectory[\"Event\"] = 2] = \"Event\";\r\n DLandMapDataDirectory[DLandMapDataDirectory[\"Shuffle\"] = 3] = \"Shuffle\";\r\n DLandMapDataDirectory[DLandMapDataDirectory[\"Fixed\"] = 4] = \"Fixed\";\r\n})(DLandMapDataDirectory = exports.DLandMapDataDirectory || (exports.DLandMapDataDirectory = {}));\r\nvar DMapDataNodeLeafType;\r\n(function (DMapDataNodeLeafType) {\r\n //Root, // 検索を開始した Map がいずれかの Root だった\r\n DMapDataNodeLeafType[DMapDataNodeLeafType[\"RootOrDirctory\"] = 0] = \"RootOrDirctory\";\r\n DMapDataNodeLeafType[DMapDataNodeLeafType[\"Generic\"] = 1] = \"Generic\";\r\n DMapDataNodeLeafType[DMapDataNodeLeafType[\"Table_Event\"] = 2] = \"Table_Event\";\r\n DMapDataNodeLeafType[DMapDataNodeLeafType[\"Table_Enemy\"] = 3] = \"Table_Enemy\";\r\n DMapDataNodeLeafType[DMapDataNodeLeafType[\"Table_Item\"] = 4] = \"Table_Item\";\r\n DMapDataNodeLeafType[DMapDataNodeLeafType[\"Table_Trap\"] = 5] = \"Table_Trap\";\r\n DMapDataNodeLeafType[DMapDataNodeLeafType[\"Table_Shop\"] = 6] = \"Table_Shop\";\r\n DMapDataNodeLeafType[DMapDataNodeLeafType[\"Table_Shop_Peddler\"] = 7] = \"Table_Shop_Peddler\";\r\n DMapDataNodeLeafType[DMapDataNodeLeafType[\"Table_Shop_Weapon\"] = 8] = \"Table_Shop_Weapon\";\r\n DMapDataNodeLeafType[DMapDataNodeLeafType[\"Table_Shop_Luxury\"] = 9] = \"Table_Shop_Luxury\";\r\n DMapDataNodeLeafType[DMapDataNodeLeafType[\"Table_RandomPot\"] = 10] = \"Table_RandomPot\";\r\n DMapDataNodeLeafType[DMapDataNodeLeafType[\"System_ExitMap\"] = 11] = \"System_ExitMap\";\r\n})(DMapDataNodeLeafType = exports.DMapDataNodeLeafType || (exports.DMapDataNodeLeafType = {}));\r\nvar DMapDataNodeType;\r\n(function (DMapDataNodeType) {\r\n})(DMapDataNodeType || (DMapDataNodeType = {}));\r\nclass DDataImporter {\r\n static getMapDataNodeInfo(rmmzMapId) {\r\n // assert(mapInfo);\r\n // let parentMapId = mapInfo.parentId;\r\n const info = {\r\n rootType: undefined,\r\n directory: undefined,\r\n leafType: DMapDataNodeLeafType.Generic,\r\n landRmmzMapId: undefined,\r\n };\r\n let count = 0;\r\n while (rmmzMapId > 0) {\r\n let mapInfo = $dataMapInfos[rmmzMapId];\r\n (0, Common_1.assert)(mapInfo);\r\n // rootType\r\n if (MRDataManager_1.MRDataManager.isLandMap(rmmzMapId)) {\r\n info.rootType = DMapDataNodeRootType.LandLike;\r\n info.landRmmzMapId = mapInfo.id;\r\n }\r\n else if (mapInfo.name.includes(\"MR-MapTemplates\")) {\r\n info.rootType = DMapDataNodeRootType.MapTemplates;\r\n }\r\n if (count == 0 && info.rootType !== undefined) {\r\n info.leafType = DMapDataNodeLeafType.RootOrDirctory;\r\n }\r\n // directory\r\n if (mapInfo.name.includes(\"[Table]\")) {\r\n info.directory = DLandMapDataDirectory.Table;\r\n }\r\n else if (mapInfo.name.includes(\"[System]\")) {\r\n info.directory = DLandMapDataDirectory.System;\r\n }\r\n else if (mapInfo.name.includes(\"[Event]\")) {\r\n info.directory = DLandMapDataDirectory.Event;\r\n }\r\n else if (mapInfo.name.includes(\"[Shuffle]\")) {\r\n info.directory = DLandMapDataDirectory.Shuffle;\r\n }\r\n else if (mapInfo.name.includes(\"[Fixed]\")) {\r\n info.directory = DLandMapDataDirectory.Fixed;\r\n }\r\n if (count == 0 && info.directory !== undefined) {\r\n info.leafType = DMapDataNodeLeafType.RootOrDirctory;\r\n }\r\n // leafType\r\n if (count == 0) {\r\n if (mapInfo.name == \"Event\") {\r\n info.leafType = DMapDataNodeLeafType.Table_Event;\r\n }\r\n else if (mapInfo.name == \"Enemy\") {\r\n info.leafType = DMapDataNodeLeafType.Table_Enemy;\r\n }\r\n else if (mapInfo.name == \"Item\") {\r\n info.leafType = DMapDataNodeLeafType.Table_Item;\r\n }\r\n else if (mapInfo.name == \"Trap\") {\r\n info.leafType = DMapDataNodeLeafType.Table_Trap;\r\n }\r\n else if (mapInfo.name == \"Shop\") { // 店売りアイテム\r\n info.leafType = DMapDataNodeLeafType.Table_Shop;\r\n }\r\n else if (mapInfo.name.includes(\"Shop(Peddler)\")) {\r\n throw new Error(\"Not implemented.\");\r\n }\r\n else if (mapInfo.name.includes(\"Shop(Weapon)\")) {\r\n throw new Error(\"Not implemented.\");\r\n }\r\n else if (mapInfo.name.includes(\"Shop(Luxury)\")) {\r\n throw new Error(\"Not implemented.\");\r\n }\r\n else if (mapInfo.name.includes(\"RandomPot\")) {\r\n throw new Error(\"Not implemented.\");\r\n }\r\n else if (mapInfo.name == \"ExitMap\") {\r\n info.leafType = DMapDataNodeLeafType.System_ExitMap;\r\n }\r\n }\r\n rmmzMapId = mapInfo.parentId;\r\n count++;\r\n }\r\n return info;\r\n }\r\n // ここではまずマップ ID の関連付けのみ行う。\r\n static linkMapData(mapData, data, nodeInfo, land) {\r\n if (nodeInfo.leafType !== DMapDataNodeLeafType.RootOrDirctory) {\r\n // 出現テーブルは当初単一のマップであったが、次のような理由で分けることにした。\r\n // - Shop 対応を始めたことでテーブルが非常に大きくなり始め、編集が大変になってきた。\r\n // - 単一の出現テーブルで、ある Entity の出現領域を細かく制御するのが難しい。\r\n if (nodeInfo.leafType == DMapDataNodeLeafType.Table_Event) {\r\n land.eventTableMapId = data.id;\r\n }\r\n else if (nodeInfo.leafType == DMapDataNodeLeafType.Table_Enemy) {\r\n land.enemyTableMapId = data.id;\r\n }\r\n else if (nodeInfo.leafType == DMapDataNodeLeafType.Table_Item) {\r\n land.itemTableMapId = data.id;\r\n }\r\n else if (nodeInfo.leafType == DMapDataNodeLeafType.Table_Trap) {\r\n land.trapTableMapId = data.id;\r\n }\r\n else if (nodeInfo.leafType == DMapDataNodeLeafType.Table_Shop) {\r\n land.shopTableMapId = data.id;\r\n }\r\n else if (nodeInfo.leafType == DMapDataNodeLeafType.Table_Shop_Peddler) {\r\n throw new Error(\"Not implemented.\");\r\n }\r\n else if (nodeInfo.leafType == DMapDataNodeLeafType.Table_Shop_Weapon) {\r\n throw new Error(\"Not implemented.\");\r\n }\r\n else if (nodeInfo.leafType == DMapDataNodeLeafType.Table_Shop_Luxury) {\r\n throw new Error(\"Not implemented.\");\r\n }\r\n else if (nodeInfo.leafType == DMapDataNodeLeafType.Table_RandomPot) {\r\n throw new Error(\"Not implemented.\");\r\n }\r\n else if (nodeInfo.leafType == DMapDataNodeLeafType.System_ExitMap) {\r\n mapData.exitMap = true;\r\n land.addEventMap(mapData);\r\n }\r\n else if (nodeInfo.directory == DLandMapDataDirectory.Event) {\r\n mapData.eventMap = true;\r\n mapData.landId = land.id;\r\n }\r\n }\r\n }\r\n static findLand(data) {\r\n if (!data)\r\n return undefined;\r\n return MRData_1.MRData.lands.find(x => data && x.rmmzMapId == data.id);\r\n }\r\n}\r\nexports.DDataImporter = DDataImporter;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DDataImporter.ts?"); /***/ }), /***/ "./ts/mr/data/DEffect.ts": /*!*******************************!*\ !*** ./ts/mr/data/DEffect.ts ***! \*******************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DEmittorCost = exports.DParamCostType = exports.DSkillCostSource = exports.DEffect = exports.DBuffLevelOp = exports.DBuffType = exports.DBuffMode = exports.DEffectFieldScope = exports.DEffectScopeTargetFactionFlags = exports.DEffectFieldScopeArea = exports.DEffectFieldScopeType = exports.DEffectHitType = exports.DRmmzEffectScope = exports.LStateLevelType = exports.DParameterQualifying = exports.DValuePoint = exports.DParameterEffectApplyType = void 0;\r\nconst DCommon_1 = __webpack_require__(/*! ./DCommon */ \"./ts/mr/data/DCommon.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ./MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst DHelper_1 = __webpack_require__(/*! ./DHelper */ \"./ts/mr/data/DHelper.ts\");\r\nconst DFlavorEffect_1 = __webpack_require__(/*! ./DFlavorEffect */ \"./ts/mr/data/DFlavorEffect.ts\");\r\nconst DSpecialEffect_1 = __webpack_require__(/*! ./DSpecialEffect */ \"./ts/mr/data/DSpecialEffect.ts\");\r\nconst DParameter_1 = __webpack_require__(/*! ./DParameter */ \"./ts/mr/data/DParameter.ts\");\r\nvar DParameterEffectApplyType;\r\n(function (DParameterEffectApplyType) {\r\n /** なし */\r\n DParameterEffectApplyType[DParameterEffectApplyType[\"None\"] = 0] = \"None\";\r\n /** ダメージ */\r\n DParameterEffectApplyType[DParameterEffectApplyType[\"Damage\"] = 1] = \"Damage\";\r\n /** 回復 */\r\n DParameterEffectApplyType[DParameterEffectApplyType[\"Recover\"] = 2] = \"Recover\";\r\n /** 吸収 */\r\n DParameterEffectApplyType[DParameterEffectApplyType[\"Drain\"] = 3] = \"Drain\";\r\n})(DParameterEffectApplyType = exports.DParameterEffectApplyType || (exports.DParameterEffectApplyType = {}));\r\nvar DValuePoint;\r\n(function (DValuePoint) {\r\n DValuePoint[DValuePoint[\"Actual\"] = 0] = \"Actual\";\r\n DValuePoint[DValuePoint[\"Minimum\"] = 1] = \"Minimum\";\r\n DValuePoint[DValuePoint[\"Growth\"] = 2] = \"Growth\";\r\n})(DValuePoint = exports.DValuePoint || (exports.DValuePoint = {}));\r\nclass DParameterQualifying {\r\n constructor(paramId, formula, applyType) {\r\n // Emittor の conditions とどちらを使うべきか?\r\n // ----------\r\n // Emittor の conditions は、対象への効果適用自体にかかわるものである。\r\n // 対してこちらの conditions は、個々の効果の発生条件である。\r\n // 例えば、パラメータダメージは条件を付けるが、バフや特殊効果は一律適用する、といった場合に使用できる。\r\n // Effect の FlavorEffect の表示有無がわかりやすいか。\r\n this.conditionTargetCategoryId = 0;\r\n this.fallback = false;\r\n // DParameter.parameterFlavorEffects をオーバーライドするもの\r\n this.flavorEffects = [];\r\n this._parameterId = paramId;\r\n this.applyType = applyType;\r\n this.applyTarget = DValuePoint.Actual;\r\n this.elementIds = [0];\r\n this.formula = formula;\r\n this.variance = 0;\r\n this.silent = false;\r\n }\r\n withApplyTarget(value) {\r\n this.applyTarget = value;\r\n return this;\r\n }\r\n withElementId(value) {\r\n this.elementIds[0] = value;\r\n return this;\r\n }\r\n withVariance(value) {\r\n this.variance = value;\r\n return this;\r\n }\r\n withSilent(value = true) {\r\n this.silent = value;\r\n return this;\r\n }\r\n withConditionFormula(value) {\r\n this.conditionFormula = value;\r\n return this;\r\n }\r\n withFallback(value = true) {\r\n this.fallback = value;\r\n return this;\r\n }\r\n getParameterFlavorEffectByLooksFaction(value) {\r\n const effects = this.flavorEffects.filter(e => e.looksFaction === value);\r\n return effects;\r\n }\r\n clone() {\r\n const i = new DParameterQualifying(0, \"\", DParameterEffectApplyType.None);\r\n i.copyFrom(this);\r\n return i;\r\n }\r\n copyFrom(src) {\r\n this._parameterId = src._parameterId;\r\n this.applyType = src.applyType;\r\n this.applyTarget = src.applyTarget;\r\n this.elementIds = [...src.elementIds];\r\n this.formula = src.formula;\r\n this.variance = src.variance;\r\n this.silent = src.silent;\r\n this.conditionFormula = src.conditionFormula;\r\n this.conditionTargetCategoryId = src.conditionTargetCategoryId;\r\n this.flavorEffects = [...src.flavorEffects];\r\n this.alliesSideGainMessage = src.alliesSideGainMessage;\r\n this.alliesSideLossMessage = src.alliesSideLossMessage;\r\n this.opponentGainMessage = src.opponentGainMessage;\r\n this.opponentLossMessage = src.opponentLossMessage;\r\n }\r\n}\r\nexports.DParameterQualifying = DParameterQualifying;\r\nvar LStateLevelType;\r\n(function (LStateLevelType) {\r\n LStateLevelType[LStateLevelType[\"AbsoluteValue\"] = 0] = \"AbsoluteValue\";\r\n LStateLevelType[LStateLevelType[\"RelativeValue\"] = 1] = \"RelativeValue\";\r\n})(LStateLevelType = exports.LStateLevelType || (exports.LStateLevelType = {}));\r\n/*\r\nexport interface DStateAdditionQualifying {\r\n stateId: string;\r\n level: number;\r\n levelType: LStateLevelType,\r\n}\r\n*/\r\nvar DRmmzEffectScope;\r\n(function (DRmmzEffectScope) {\r\n /** なし */\r\n DRmmzEffectScope[DRmmzEffectScope[\"None\"] = 0] = \"None\";\r\n /** 敵,単体 */\r\n DRmmzEffectScope[DRmmzEffectScope[\"Opponent_Single\"] = 1] = \"Opponent_Single\";\r\n /** 敵,全体 */\r\n DRmmzEffectScope[DRmmzEffectScope[\"Opponent_All\"] = 2] = \"Opponent_All\";\r\n /** 敵,ランダム,1 */\r\n DRmmzEffectScope[DRmmzEffectScope[\"Opponent_Random_1\"] = 3] = \"Opponent_Random_1\";\r\n /** 敵,ランダム,2 */\r\n DRmmzEffectScope[DRmmzEffectScope[\"Opponent_Random_2\"] = 4] = \"Opponent_Random_2\";\r\n /** 敵,ランダム,3 */\r\n DRmmzEffectScope[DRmmzEffectScope[\"Opponent_Random_3\"] = 5] = \"Opponent_Random_3\";\r\n /** 敵,ランダム,4 */\r\n DRmmzEffectScope[DRmmzEffectScope[\"Opponent_Random_4\"] = 6] = \"Opponent_Random_4\";\r\n /** 味方,単体,生存 */\r\n DRmmzEffectScope[DRmmzEffectScope[\"Friend_Single_Alive\"] = 7] = \"Friend_Single_Alive\";\r\n /** 味方,全体,生存 */\r\n DRmmzEffectScope[DRmmzEffectScope[\"Friend_All_Alive\"] = 8] = \"Friend_All_Alive\";\r\n /** 味方,単体,戦闘不能 */\r\n DRmmzEffectScope[DRmmzEffectScope[\"Friend_Single_Dead\"] = 9] = \"Friend_Single_Dead\";\r\n /** 味方,全体,戦闘不能 */\r\n DRmmzEffectScope[DRmmzEffectScope[\"Friend_All_Dead\"] = 10] = \"Friend_All_Dead\";\r\n /** 使用者 */\r\n DRmmzEffectScope[DRmmzEffectScope[\"User\"] = 11] = \"User\";\r\n /** 味方,単体,無条件 */\r\n DRmmzEffectScope[DRmmzEffectScope[\"Friend_Single_Unconditional\"] = 12] = \"Friend_Single_Unconditional\";\r\n /** 味方,全体,無条件 */\r\n DRmmzEffectScope[DRmmzEffectScope[\"Friend_All_Unconditional\"] = 13] = \"Friend_All_Unconditional\";\r\n /** 敵と味方,全体 */\r\n DRmmzEffectScope[DRmmzEffectScope[\"Everyone\"] = 14] = \"Everyone\";\r\n})(DRmmzEffectScope = exports.DRmmzEffectScope || (exports.DRmmzEffectScope = {}));\r\nvar DEffectHitType;\r\n(function (DEffectHitType) {\r\n DEffectHitType[DEffectHitType[\"Certain\"] = 0] = \"Certain\";\r\n DEffectHitType[DEffectHitType[\"Physical\"] = 1] = \"Physical\";\r\n DEffectHitType[DEffectHitType[\"Magical\"] = 2] = \"Magical\";\r\n})(DEffectHitType = exports.DEffectHitType || (exports.DEffectHitType = {}));\r\nvar DEffectFieldScopeType;\r\n(function (DEffectFieldScopeType) {\r\n DEffectFieldScopeType[DEffectFieldScopeType[\"Performer\"] = 0] = \"Performer\";\r\n DEffectFieldScopeType[DEffectFieldScopeType[\"Front1\"] = 1] = \"Front1\";\r\n DEffectFieldScopeType[DEffectFieldScopeType[\"StraightProjectile\"] = 2] = \"StraightProjectile\";\r\n DEffectFieldScopeType[DEffectFieldScopeType[\"ReceiveProjectile\"] = 3] = \"ReceiveProjectile\";\r\n DEffectFieldScopeType[DEffectFieldScopeType[\"PointProjectile\"] = 4] = \"PointProjectile\";\r\n DEffectFieldScopeType[DEffectFieldScopeType[\"Selection\"] = 5] = \"Selection\";\r\n DEffectFieldScopeType[DEffectFieldScopeType[\"Around\"] = 6] = \"Around\";\r\n DEffectFieldScopeType[DEffectFieldScopeType[\"AroundAndCenter\"] = 7] = \"AroundAndCenter\";\r\n DEffectFieldScopeType[DEffectFieldScopeType[\"Center\"] = 8] = \"Center\";\r\n DEffectFieldScopeType[DEffectFieldScopeType[\"Room\"] = 9] = \"Room\";\r\n DEffectFieldScopeType[DEffectFieldScopeType[\"Map\"] = 10] = \"Map\";\r\n})(DEffectFieldScopeType = exports.DEffectFieldScopeType || (exports.DEffectFieldScopeType = {}));\r\nvar DEffectFieldScopeArea;\r\n(function (DEffectFieldScopeArea) {\r\n DEffectFieldScopeArea[DEffectFieldScopeArea[\"Room\"] = 0] = \"Room\";\r\n DEffectFieldScopeArea[DEffectFieldScopeArea[\"Floor\"] = 1] = \"Floor\";\r\n})(DEffectFieldScopeArea = exports.DEffectFieldScopeArea || (exports.DEffectFieldScopeArea = {}));\r\nvar DEffectScopeTargetFactionFlags;\r\n(function (DEffectScopeTargetFactionFlags) {\r\n DEffectScopeTargetFactionFlags[DEffectScopeTargetFactionFlags[\"Friend\"] = 1] = \"Friend\";\r\n DEffectScopeTargetFactionFlags[DEffectScopeTargetFactionFlags[\"Nature\"] = 2] = \"Nature\";\r\n DEffectScopeTargetFactionFlags[DEffectScopeTargetFactionFlags[\"Hostile\"] = 4] = \"Hostile\";\r\n DEffectScopeTargetFactionFlags[DEffectScopeTargetFactionFlags[\"All\"] = 7] = \"All\";\r\n})(DEffectScopeTargetFactionFlags = exports.DEffectScopeTargetFactionFlags || (exports.DEffectScopeTargetFactionFlags = {}));\r\nclass DEffectFieldScope {\r\n //factions: DEffectScopeTargetFactionFlags;\r\n constructor() {\r\n this.area = DEffectFieldScopeArea.Room,\r\n this.range = DEffectFieldScopeType.Performer,\r\n this.length = -1,\r\n this.projectilePrefabKey = \"\";\r\n this.layers = [DCommon_1.DBlockLayerKind.Unit];\r\n this.layerScope = DCommon_1.DBlockLayerScope.TopOnly;\r\n //this.factions = DEffectScopeTargetFactionFlags.All;\r\n }\r\n}\r\nexports.DEffectFieldScope = DEffectFieldScope;\r\nvar DBuffMode;\r\n(function (DBuffMode) {\r\n DBuffMode[\"Strength\"] = \"strength\";\r\n DBuffMode[\"Weakness\"] = \"weakness\";\r\n})(DBuffMode = exports.DBuffMode || (exports.DBuffMode = {}));\r\nvar DBuffType;\r\n(function (DBuffType) {\r\n DBuffType[DBuffType[\"Add\"] = 0] = \"Add\";\r\n DBuffType[DBuffType[\"Mul\"] = 1] = \"Mul\";\r\n})(DBuffType = exports.DBuffType || (exports.DBuffType = {}));\r\nvar DBuffLevelOp;\r\n(function (DBuffLevelOp) {\r\n DBuffLevelOp[DBuffLevelOp[\"Set\"] = 0] = \"Set\";\r\n DBuffLevelOp[DBuffLevelOp[\"Add\"] = 1] = \"Add\";\r\n})(DBuffLevelOp = exports.DBuffLevelOp || (exports.DBuffLevelOp = {}));\r\nclass DEffect {\r\n //rejectionLevel: DEffectRejectionLevel;\r\n constructor(id, key) {\r\n this.id = id;\r\n this.key = key;\r\n //this.id = id;\r\n //this.scope = {\r\n // area: DEffectFieldScopeArea.Room,\r\n // range: DEffectFieldScopeRange.Front1,\r\n // length: -1,\r\n // projectilePrefabKey: \"\" };\r\n this.subEntityFindKey = { kindId: 0, key: undefined };\r\n this.critical = false;\r\n this.successRate = 100;\r\n this.hitType = DEffectHitType.Certain;\r\n // デフォルトは表示無し。この Effect を Skill から使う場合はそちらで undefined が設定されれば、デフォルトのアニメーションが使われる。\r\n this.flavorEffect = null;\r\n this.parameterQualifyings = [];\r\n this.otherEffectQualifyings = [];\r\n this.effectBehaviors = [];\r\n this.rmmzSpecialEffectQualifyings = [];\r\n this.buffQualifying = [];\r\n }\r\n applyProps(props) {\r\n // if (props.conditions) {\r\n // if (props.conditions.targetCategoryKey) {\r\n // this.conditions.targetCategoryId = MRData.getEntityCategory(props.conditions.targetCategoryKey).id;\r\n // }\r\n // if (props.conditions.targetRaceKey) {\r\n // this.conditions.raceId = MRData.getRace(props.conditions.targetRaceKey).id;\r\n // }\r\n // if (props.conditions.rating) {\r\n // this.conditions.applyRating = props.conditions.rating;\r\n // }\r\n // if (props.conditions.fallback) {\r\n // this.conditions.fallback = props.conditions.fallback;\r\n // }\r\n // }\r\n var _a;\r\n this.critical = (_a = props.critical) !== null && _a !== void 0 ? _a : this.critical;\r\n this.flavorEffect = props.flavorEffect ? new DFlavorEffect_1.DFlavorEffect(props.flavorEffect) : this.flavorEffect;\r\n // damageEffects\r\n if (props.parameterValues) {\r\n for (const p of props.parameterValues) {\r\n const d = new DParameterQualifying(MRData_1.MRData.getParameter(p.parameterKey).id, p.formula, DHelper_1.DHelpers.stringToEnum(p.type, {\r\n \"damage\": DParameterEffectApplyType.Damage,\r\n \"recovery\": DParameterEffectApplyType.Recover,\r\n \"drain\": DParameterEffectApplyType.Drain,\r\n \"_\": DParameterEffectApplyType.Damage,\r\n }));\r\n d.applyTarget = DHelper_1.DHelpers.stringToEnum(p.point, {\r\n \"actual\": DValuePoint.Actual,\r\n \"growth\": DValuePoint.Growth,\r\n \"_\": DValuePoint.Actual,\r\n });\r\n if (p.conditionTargetCategoryKey) {\r\n d.conditionTargetCategoryId = MRData_1.MRData.getEntityCategory(p.conditionTargetCategoryKey).id;\r\n }\r\n if (p.conditionFormula) {\r\n d.conditionFormula = p.conditionFormula;\r\n }\r\n if (p.conditionFallback) {\r\n d.fallback = p.conditionFallback;\r\n }\r\n if (p.silent) {\r\n d.silent = p.silent;\r\n }\r\n if (p.parameterFlavorEffects) {\r\n for (const f of p.parameterFlavorEffects) {\r\n d.flavorEffects.push(new DParameter_1.DParameterFlavorEffect(f));\r\n }\r\n }\r\n this.parameterQualifyings.push(d);\r\n }\r\n }\r\n // buffEffects\r\n if (props.parameterBuffs) {\r\n for (const p of props.parameterBuffs) {\r\n const d = {\r\n paramId: MRData_1.MRData.getParameter(p.parameterKey).id,\r\n type: DHelper_1.DHelpers.stringToEnum(p.type, {\r\n \"constant\": DBuffType.Add,\r\n \"ratio\": DBuffType.Mul,\r\n }),\r\n levelType: DHelper_1.DHelpers.stringToEnum(p.levelOp, {\r\n \"add\": DBuffLevelOp.Add,\r\n \"set\": DBuffLevelOp.Set,\r\n \"_\": DBuffLevelOp.Add,\r\n }),\r\n level: p.level,\r\n turn: p.turn,\r\n };\r\n this.buffQualifying.push(d);\r\n }\r\n }\r\n // specialEffects\r\n if (props.specialEffects) {\r\n for (const p of props.specialEffects) {\r\n this.effectBehaviors.push(DSpecialEffect_1.DSpecialEffect.makeSpecialEffectRef(p));\r\n }\r\n }\r\n }\r\n copyFrom(src) {\r\n //this.scope = { ...src.scope };\r\n this.subEntityFindKey = Object.assign({}, src.subEntityFindKey);\r\n this.critical = src.critical;\r\n this.successRate = src.successRate;\r\n this.hitType = src.hitType;\r\n this.flavorEffect = src.flavorEffect;\r\n this.parameterQualifyings = src.parameterQualifyings.map(x => x.clone());\r\n this.otherEffectQualifyings = src.otherEffectQualifyings.slice();\r\n this.effectBehaviors = src.effectBehaviors.slice();\r\n this.rmmzSpecialEffectQualifyings = src.rmmzSpecialEffectQualifyings.slice();\r\n this.buffQualifying = src.buffQualifying.slice();\r\n // this.qualifyings = {\r\n // parameterQualifyings: src.qualifyings.parameterQualifyings.slice(),\r\n // otherEffectQualifyings: src.qualifyings.otherEffectQualifyings.slice(),\r\n // effectBehaviors: src.qualifyings.effectBehaviors.slice(),\r\n // rmmzSpecialEffectQualifyings :src.qualifyings.rmmzSpecialEffectQualifyings.slice(),\r\n // buffQualifying: src.qualifyings.buffQualifying.slice(),\r\n // };\r\n //this.rejectionLevel = src.rejectionLevel;\r\n }\r\n hasAnyValidEffect() {\r\n return this.parameterQualifyings.length > 0 ||\r\n this.otherEffectQualifyings.length > 0 ||\r\n this.effectBehaviors.length > 0 ||\r\n this.rmmzSpecialEffectQualifyings.length > 0 ||\r\n this.buffQualifying.length > 0;\r\n }\r\n}\r\nexports.DEffect = DEffect;\r\nvar DSkillCostSource;\r\n(function (DSkillCostSource) {\r\n /** スキルの使用者 */\r\n DSkillCostSource[DSkillCostSource[\"Actor\"] = 0] = \"Actor\";\r\n /** スキルの発生元となった Entity。杖を振ったときは、振った人が Actor, 杖アイテムが Item. */\r\n DSkillCostSource[DSkillCostSource[\"Item\"] = 1] = \"Item\";\r\n})(DSkillCostSource = exports.DSkillCostSource || (exports.DSkillCostSource = {}));\r\nvar DParamCostType;\r\n(function (DParamCostType) {\r\n DParamCostType[DParamCostType[\"Decrease\"] = 0] = \"Decrease\";\r\n DParamCostType[DParamCostType[\"Increase\"] = 1] = \"Increase\";\r\n})(DParamCostType = exports.DParamCostType || (exports.DParamCostType = {}));\r\nclass DEmittorCost {\r\n constructor() {\r\n this.paramCosts = [];\r\n }\r\n setParamCost(source, paramId, paramCost) {\r\n let costs = this.paramCosts[source];\r\n if (!costs) {\r\n costs = [];\r\n this.paramCosts[source] = costs;\r\n }\r\n costs[paramId] = paramCost;\r\n }\r\n}\r\nexports.DEmittorCost = DEmittorCost;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DEffect.ts?"); /***/ }), /***/ "./ts/mr/data/DEffectSuite.ts": /*!************************************!*\ !*** ./ts/mr/data/DEffectSuite.ts ***! \************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DEffectSuite = exports.DEffectRef = void 0;\r\nconst MRData_1 = __webpack_require__(/*! ./MRData */ \"./ts/mr/data/MRData.ts\");\r\n/**\r\n * Script での設定のしやすさを考慮して、 condition を Emittor 寄りの情報とした、 Effect 参照情報。\r\n *\r\n * 条件は Effect 単体以外にも、複数の Effect と関連してどれか一つを選びだしたりするものがあるため、\r\n * Effect に付く情報ではなく、そのひとつ上の、Effect たちを取りまとめる側に付ける方がイメージしやすい。\r\n */\r\nclass DEffectRef {\r\n constructor(effectId) {\r\n this._effectId = effectId;\r\n this.conditions = { targetCategoryId: 0, targetRaceId: 0, applyRating: 0, fallback: false };\r\n }\r\n get effectId() {\r\n return this._effectId;\r\n }\r\n get effect() {\r\n return MRData_1.MRData.effects[this._effectId];\r\n }\r\n hasCondition() {\r\n if (this.conditions.targetCategoryId != 0)\r\n return true;\r\n if (this.conditions.targetRaceId != 0)\r\n return true;\r\n if (this.conditions.applyRating != 0)\r\n return true;\r\n if (this.conditions.fallback)\r\n return true;\r\n return false;\r\n }\r\n copyFrom(src) {\r\n this._effectId = src._effectId;\r\n this.conditions = Object.assign({}, src.conditions);\r\n }\r\n clone() {\r\n const effect = MRData_1.MRData.cloneEffect(this.effect);\r\n const ref = new DEffectRef(effect.id);\r\n ref.conditions = Object.assign({}, this.conditions);\r\n return ref;\r\n }\r\n}\r\nexports.DEffectRef = DEffectRef;\r\n/**\r\n * SEffectContext のエントリポイントに入力する情報。\r\n *\r\n * Emittor の発動条件をクリアした後の、ひとつの「効果適用」に関係する様々な Effect をまとめるクラス。\r\n * このクラスの情報は Emittor に統合することも検討したが、 Effect 適用周りのコードは複雑なので、\r\n * あえて分離し、EffectContext 内の処理では Emittor の情報を参照しないようにした。\r\n *\r\n * 新種道具を作るときは、これが効果の1単位となる。\r\n */\r\nclass DEffectSuite {\r\n constructor(sourceKey) {\r\n this.selfEffectId = new DEffectRef(MRData_1.MRData.newEffect(sourceKey).id);\r\n this._targetEffectRefs = [];\r\n }\r\n get selfEffect() {\r\n return this.selfEffectId;\r\n }\r\n targetEffects() {\r\n return this._targetEffectRefs;\r\n }\r\n targetEffect(index) {\r\n return this._targetEffectRefs[index];\r\n }\r\n clearTargetEffects() {\r\n this._targetEffectRefs = [];\r\n }\r\n setTargetEffect(index, value) {\r\n this._targetEffectRefs[index] = value;\r\n }\r\n addTargetEffect(value) {\r\n this._targetEffectRefs.push(value);\r\n }\r\n copyFrom(src) {\r\n this.selfEffect.copyFrom(src.selfEffect);\r\n this._targetEffectRefs = [];\r\n for (const ref of src._targetEffectRefs) {\r\n this._targetEffectRefs.push(ref.clone());\r\n }\r\n }\r\n hitType() {\r\n return this.targetEffect(0).effect.hitType;\r\n }\r\n}\r\nexports.DEffectSuite = DEffectSuite;\r\n// export interface IEffectConditionsProps {\r\n// targetCategoryKey?: string;\r\n// /** 判定する RaceId。 0 の場合は対象外。 */\r\n// targetRaceKey?: string;\r\n// /** EnemyAction と同じ整数。0 はレート無し。 */\r\n// rating?: number;\r\n// fallback?: boolean;\r\n// }\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DEffectSuite.ts?"); /***/ }), /***/ "./ts/mr/data/DElement.ts": /*!********************************!*\ !*** ./ts/mr/data/DElement.ts ***! \********************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DElement = void 0;\r\nclass DElement {\r\n constructor(id, key) {\r\n this.id = id;\r\n this.key = key;\r\n this.name = \"\";\r\n }\r\n}\r\nexports.DElement = DElement;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DElement.ts?"); /***/ }), /***/ "./ts/mr/data/DEmittor.ts": /*!********************************!*\ !*** ./ts/mr/data/DEmittor.ts ***! \********************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DEmittor = void 0;\r\nconst DEffect_1 = __webpack_require__(/*! ./DEffect */ \"./ts/mr/data/DEffect.ts\");\r\nconst DEffectSuite_1 = __webpack_require__(/*! ./DEffectSuite */ \"./ts/mr/data/DEffectSuite.ts\");\r\nconst DHelper_1 = __webpack_require__(/*! ./DHelper */ \"./ts/mr/data/DHelper.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ./MRData */ \"./ts/mr/data/MRData.ts\");\r\n/**\r\n * RMMZ の Skill と Item の共通パラメータ\r\n */\r\nclass DEmittor {\r\n constructor(id, key) {\r\n this.id = id;\r\n this.key = key;\r\n this.effectSuite = new DEffectSuite_1.DEffectSuite(key);\r\n this.costs = new DEffect_1.DEmittorCost();\r\n this.scope = new DEffect_1.DEffectFieldScope();\r\n this.selfAnimationId = 0;\r\n this.targetAreaAnimationId = 0;\r\n this.selfSequelId = 0;\r\n }\r\n applyProps(props) {\r\n if (props.scopeType) {\r\n this.scope.range = DHelper_1.DHelpers.stringToEnum(props.scopeType, {\r\n \"front\": DEffect_1.DEffectFieldScopeType.Front1,\r\n \"_\": DEffect_1.DEffectFieldScopeType.Performer,\r\n });\r\n }\r\n if (props.targetEffectKeys) {\r\n this.effectSuite.clearTargetEffects();\r\n for (const key of props.targetEffectKeys) {\r\n const effect = MRData_1.MRData.getEffect(key);\r\n const ref = new DEffectSuite_1.DEffectRef(effect.id);\r\n this.effectSuite.addTargetEffect(ref);\r\n }\r\n }\r\n // NOTE: 追加にするべきか?リセットか?\r\n // Trait や SpecialEffect はエディタ上でどのような設定がされているのかがわかる。\r\n // 対して、 Emittor や Effect は MRシステム独自のもので、エディタからは見えない。\r\n // 見えないのでイメージしづらく、省略されていると見落としの懸念がある。\r\n // そのためリセットにしておく。\r\n if (props.targetEffects) {\r\n this.effectSuite.clearTargetEffects();\r\n for (const p of props.targetEffects) {\r\n const effect = MRData_1.MRData.getEffect(p.effectKey);\r\n const ref = new DEffectSuite_1.DEffectRef(effect.id);\r\n // if (p.conditions) {\r\n // if (p.conditions.targetCategoryKey) {\r\n // ref.conditions.targetCategoryId = MRData.getEntityCategory(p.conditions.targetCategoryKey).id;\r\n // }\r\n // if (p.conditions.targetRaceKey) {\r\n // ref.conditions.raceId = MRData.getRace(p.conditions.targetRaceKey).id;\r\n // }\r\n // if (p.conditions.rating) {\r\n // ref.conditions.applyRating = p.conditions.rating;\r\n // }\r\n // if (p.conditions.fallback) {\r\n // ref.conditions.fallback = p.conditions.fallback;\r\n // }\r\n // }\r\n if (p.conditionTargetCategoryKey) {\r\n ref.conditions.targetCategoryId = MRData_1.MRData.getEntityCategory(p.conditionTargetCategoryKey).id;\r\n }\r\n if (p.conditionTargetRaceKey) {\r\n ref.conditions.targetRaceId = MRData_1.MRData.getRace(p.conditionTargetRaceKey).id;\r\n }\r\n if (p.conditionRating) {\r\n ref.conditions.applyRating = p.conditionRating;\r\n }\r\n if (p.conditionFallback) {\r\n ref.conditions.fallback = p.conditionFallback;\r\n }\r\n this.effectSuite.addTargetEffect(ref);\r\n }\r\n }\r\n }\r\n copyFrom(src) {\r\n this.scope = Object.assign({}, src.scope);\r\n this.effectSuite.copyFrom(src.effectSuite);\r\n }\r\n setupFromRmmzScope(rmmzScope) {\r\n switch (rmmzScope) {\r\n case DEffect_1.DRmmzEffectScope.Opponent_Single:\r\n this.scope.range = DEffect_1.DEffectFieldScopeType.Front1;\r\n break;\r\n case DEffect_1.DRmmzEffectScope.Opponent_All:\r\n this.scope.range = DEffect_1.DEffectFieldScopeType.Room;\r\n break;\r\n default:\r\n this.scope.range = DEffect_1.DEffectFieldScopeType.Performer;\r\n break;\r\n }\r\n }\r\n}\r\nexports.DEmittor = DEmittor;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DEmittor.ts?"); /***/ }), /***/ "./ts/mr/data/DEnemy.ts": /*!******************************!*\ !*** ./ts/mr/data/DEnemy.ts ***! \******************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DEnemy = exports.DDropItem = void 0;\r\nconst MRData_1 = __webpack_require__(/*! ./MRData */ \"./ts/mr/data/MRData.ts\");\r\nclass DDropItem {\r\n constructor() {\r\n this.entityId = 0;\r\n this.denominator = 0;\r\n this.gold = 0;\r\n }\r\n static makeFromRmmzDropItemList(data, gold) {\r\n const items = data.filter(x => x.kind > 0).map(x => this.makeFromRmmzDropItem(x));\r\n if (gold > 0) {\r\n items.push(this.makeFromRmmzDropGold(gold));\r\n }\r\n return items;\r\n }\r\n static makeFromRmmzDropItem(data) {\r\n const d = new DDropItem();\r\n if (data.kind === 1) {\r\n d.entityId = MRData_1.MRData.items[MRData_1.MRData.itemDataIdOffset + data.dataId];\r\n }\r\n else if (data.kind === 2) {\r\n d.entityId = MRData_1.MRData.items[MRData_1.MRData.weaponDataIdOffset + data.dataId];\r\n }\r\n else if (data.kind === 3) {\r\n d.entityId = MRData_1.MRData.items[MRData_1.MRData.armorDataIdOffset + data.dataId];\r\n }\r\n else {\r\n throw new Error(\"Unreachable.\");\r\n }\r\n d.denominator = data.dataId;\r\n return d;\r\n }\r\n static makeFromRmmzDropGold(gold) {\r\n const d = new DDropItem();\r\n d.entityId = 0; //REData.system.fallbackGoldEntityId;\r\n d.gold = gold;\r\n return d;\r\n }\r\n}\r\nexports.DDropItem = DDropItem;\r\n/**\r\n * モンスターデータ。\r\n *\r\n * RMMZ の Enemy と同じ意味のデータだが、味方勢力に属することもあるので \"Enemy\" という言葉の意味とちょっと違くなる。\r\n * ひとまず \"Monster\" という言葉を採用。\r\n * ↑\r\n * やっぱりナシ。\r\n * ツクールと連携するので、Enemy という名前の方がデータの対応がわかりやすい。\r\n */\r\nclass DEnemy {\r\n constructor(id, entityId) {\r\n this.id = id;\r\n this.entityId = entityId;\r\n this.exp = 0;\r\n this.traits = [];\r\n this.actions = [];\r\n this.dropItems = [];\r\n }\r\n entity() {\r\n return MRData_1.MRData.entities[this.entityId];\r\n }\r\n}\r\nexports.DEnemy = DEnemy;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DEnemy.ts?"); /***/ }), /***/ "./ts/mr/data/DEntity.ts": /*!*******************************!*\ !*** ./ts/mr/data/DEntity.ts ***! \*******************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DEntity = exports.DReaction = exports.DIdentificationDifficulty = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst DEntityProperties_1 = __webpack_require__(/*! ./DEntityProperties */ \"./ts/mr/data/DEntityProperties.ts\");\r\nconst DHelper_1 = __webpack_require__(/*! ./DHelper */ \"./ts/mr/data/DHelper.ts\");\r\nconst DTrait_1 = __webpack_require__(/*! ./DTrait */ \"./ts/mr/data/DTrait.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ./MRData */ \"./ts/mr/data/MRData.ts\");\r\nvar DIdentificationDifficulty;\r\n(function (DIdentificationDifficulty) {\r\n DIdentificationDifficulty[DIdentificationDifficulty[\"Clearly\"] = 0] = \"Clearly\";\r\n DIdentificationDifficulty[DIdentificationDifficulty[\"NameGuessed\"] = 1] = \"NameGuessed\";\r\n DIdentificationDifficulty[DIdentificationDifficulty[\"Obscure\"] = 2] = \"Obscure\";\r\n //Individual,\r\n})(DIdentificationDifficulty = exports.DIdentificationDifficulty || (exports.DIdentificationDifficulty = {}));\r\nclass DReaction {\r\n constructor(actionId) {\r\n this._actionId = actionId;\r\n this._emittorIds = [];\r\n this.primariyUse = false;\r\n }\r\n get actionId() {\r\n return this._actionId;\r\n }\r\n addEmittor(emittor) {\r\n this._emittorIds.push(emittor.id);\r\n }\r\n hasEmittor() {\r\n return this._emittorIds.length > 0;\r\n }\r\n emittorIds() {\r\n return this._emittorIds;\r\n }\r\n emittors() {\r\n return this._emittorIds.map(x => MRData_1.MRData.getEmittorById(x));\r\n }\r\n}\r\nexports.DReaction = DReaction;\r\n/**\r\n * [2021/6/22] Database 修正について\r\n * ----------\r\n * これまでは Prefab の方が偉かった (インスタンス化するときは PrefabID を使った) が、EntityData の方を偉くしてみる。\r\n *\r\n * - 固定のお店を作るときはツクールの [お店の処理] を使いたいが、ここで指定するのは ItemData(EntityData) である。Prefab との関連付けが少し手間。\r\n * - お店に限らず、イベントからアイテムIDとして情報をもらうときに、REシステムのほとんどの個所で Prefab を要求していることがツクールとマッチしていない。\r\n * - 変化の壺や合成の壺などは ItemData として生成物のリストをユーザーが作れるようにしたい。\r\n * でもそうすると、処理の中で何らかの新しい Entity をインスタンス化する必要があるときに、Prefab を探しに行くのが手間。\r\n * - アイテム擬態ステートを作るときに CharacterImage を得るときも、結局 EntityData(Item) から Prefab まで辿る必要があり、ItemData -> Prefab の参照が必要になった。\r\n *\r\n * 基本的に、EntityData と Prefab は 1:1 である。この2つが双方向の参照を持たざるを得なくなったことで、\r\n * インスタンス化時にはどちらを指定しても問題はなくなった。\r\n * どちらでもよいなら、エディタから指定しやすい方を使うのがよいだろう。\r\n *\r\n * NOTE: このような仕組みにすると、EntityData と Prefab は 1:n でも良くなる。\r\n * Prefab は見た目をコントロールするものとみなせるので、例えば同種のアイテムなどは共通の Prefab を使っても構わない。\r\n * 当初は Prefab の方が偉かったが、Prefab は View の機能なので、Data に対して View が優先されるのはやっぱりちょっと不自然だろう。\r\n */\r\nclass DEntity {\r\n constructor(id) {\r\n /**\r\n * 強化下限・上限。これらは DParam の情報ではなく Entity データごとに固有のもの。\r\n * 原作では +値がそのまま攻撃力等に反映されるが、タイトルによっては +値*10 とか、マイナス方向にも有効とかいろいろ考えられる。\r\n */\r\n this.upgradeMin = 0;\r\n this.upgradeMax = 0;\r\n this.shortcut = false;\r\n this.id = id;\r\n this.prefabId = 0;\r\n this.entity = (0, DEntityProperties_1.DEntityProperties_Default)();\r\n this.display = { name: \"null\", stackedName: \"null(%1)\", iconIndex: 0 };\r\n this.description = \"\";\r\n this.identificationDifficulty = DIdentificationDifficulty.Clearly;\r\n this.identificationReaction = 0;\r\n this.sellingPrice2 = 0;\r\n this.purchasePrice = 0;\r\n this.allowModifierState = true;\r\n this.itemData = undefined;\r\n this.enemy = undefined;\r\n this.classId = 0;\r\n this.raceIds = [];\r\n this.selfTraits = [];\r\n this.equipmentTraits = [];\r\n this.isTraitCharmItem = false;\r\n this.factionId = 0; //REData.system.factions.neutral;\r\n this.idealParams = [];\r\n this.reactions = [];\r\n //this.emittorSet = new DEmittorSet();\r\n this._mainEmittorId = 0;\r\n this.autoAdditionStates = [];\r\n this.majorActionDeclines = 0;\r\n this.volatilityProjectile = false;\r\n this.counterActions = [];\r\n }\r\n get isValidKey() {\r\n return this.entity.key != \"\";\r\n }\r\n prefab() {\r\n return MRData_1.MRData.prefabs[this.prefabId];\r\n }\r\n actorData() {\r\n (0, Common_1.assert)(this.actor);\r\n return this.actor;\r\n }\r\n item() {\r\n (0, Common_1.assert)(this.itemData);\r\n return this.itemData;\r\n }\r\n enemyData() {\r\n (0, Common_1.assert)(this.enemy);\r\n return this.enemy;\r\n }\r\n equippedTraits() {\r\n return (!this.isTraitCharmItem) ? this.equipmentTraits : [];\r\n }\r\n charmedTraits() {\r\n return (this.isTraitCharmItem) ? this.equipmentTraits : [];\r\n }\r\n addReaction(actionId, emittor, primaryUse) {\r\n let reaction = this.reactions.find(x => x.actionId == actionId);\r\n if (!reaction) {\r\n reaction = new DReaction(actionId);\r\n this.reactions.push(reaction);\r\n }\r\n if (emittor) {\r\n reaction.addEmittor(emittor);\r\n }\r\n if (primaryUse) {\r\n reaction.primariyUse = primaryUse;\r\n }\r\n return reaction;\r\n }\r\n findReaction(actionId) {\r\n const reaction = this.reactions.find(x => x.actionId == actionId);\r\n return reaction;\r\n }\r\n getReaction(actionId) {\r\n const reaction = this.reactions.find(x => x.actionId == actionId);\r\n (0, Common_1.assert)(reaction);\r\n return reaction;\r\n }\r\n setMainEmittor(emittor) {\r\n this._mainEmittorId = emittor.id;\r\n }\r\n mainEmittor() {\r\n (0, Common_1.assert)(this._mainEmittorId > 0);\r\n return MRData_1.MRData.emittors[this._mainEmittorId];\r\n }\r\n makeDisplayName(stackCont) {\r\n if (stackCont >= 2)\r\n return this.display.stackedName.format(stackCont);\r\n else\r\n return this.display.name;\r\n }\r\n verify() {\r\n }\r\n // public getMergedBehaviorParams(fullName: string, friendlyName: string): unknown {\r\n // const params = {};\r\n // for (const behavior of this.entity.behaviors) {\r\n // if (!behavior.args) continue;\r\n // if (behavior.name == fullName || behavior.name == friendlyName) {\r\n // Object.assign(params, behavior.args);\r\n // }\r\n // }\r\n // return params;\r\n // }\r\n applyProps(props) {\r\n if (props.reactions) {\r\n this.reactions = [];\r\n for (const reactionProps of props.reactions) {\r\n const action = MRData_1.MRData.getSkill(reactionProps.actionKey);\r\n if (reactionProps.emittorKeys) {\r\n for (const emittorKey of reactionProps.emittorKeys) {\r\n const emittor = MRData_1.MRData.getEmittor(emittorKey);\r\n const reaction = this.addReaction(action.id, emittor, false);\r\n if (reactionProps.commandName) {\r\n reaction.overrideDisplayCommandName = reactionProps.commandName;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n if (props.allowModifierState) {\r\n this.allowModifierState = props.allowModifierState;\r\n }\r\n if (props.identificationActionKey) {\r\n this.identificationDifficulty = DHelper_1.DHelpers.stringToEnum(props.identificationActionKey, {\r\n \"clearly\": DIdentificationDifficulty.Clearly,\r\n \"named\": DIdentificationDifficulty.NameGuessed,\r\n \"obscure\": DIdentificationDifficulty.Obscure,\r\n });\r\n }\r\n if (props.identificationActionKey) {\r\n this.identificationReaction = MRData_1.MRData.getSkill(props.identificationActionKey).id;\r\n }\r\n if (props.selfTraits) {\r\n for (const t of props.selfTraits) {\r\n this.selfTraits.push(DTrait_1.DTrait.makeTraitData(t));\r\n }\r\n }\r\n if (props.equipmentTraits) {\r\n for (const t of props.equipmentTraits) {\r\n this.equipmentTraits.push(DTrait_1.DTrait.makeTraitData(t));\r\n }\r\n }\r\n }\r\n}\r\nexports.DEntity = DEntity;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DEntity.ts?"); /***/ }), /***/ "./ts/mr/data/DEntityCategory.ts": /*!***************************************!*\ !*** ./ts/mr/data/DEntityCategory.ts ***! \***************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DEntityCategory = void 0;\r\nconst MRBasics_1 = __webpack_require__(/*! ./MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\n/**\r\n * Entity の種別\r\n *\r\n * ソートキーなどで使われる。\r\n * 持ち物一覧のアイコンと考えるとわかりやすい。\r\n *\r\n * アイテム化け能力をもつモンスターなどにより、適宜オーバーライドされることはあるが、\r\n * Entity 1つに対して一意の表現となる。\r\n * 「武器かつ盾」といった表現はできない。そういった場合は、どちらかに分類しなければならない。\r\n *\r\n * 勢力を表すものではない点に注意。例えば種別 \"Monster\" は、敵にも味方にもなれる。\r\n *\r\n *\r\n *\r\n */\r\nclass DEntityCategory {\r\n constructor(id, key) {\r\n this.id = id;\r\n this.key = key;\r\n this.displayName = \"\";\r\n }\r\n // Enemy とは区別する。\r\n // Enemy は敵対という意味も含むため。\r\n // Monster は仲間になることもある。\r\n static isMonster(entity) {\r\n return entity.entity.kindId == MRBasics_1.MRBasics.entityCategories.MonsterKindId;\r\n }\r\n static isTrap(entity) {\r\n return entity.entity.kindId == MRBasics_1.MRBasics.entityCategories.TrapKindId;\r\n }\r\n static isEntryPoint(entity) {\r\n return entity.entity.kindId == MRBasics_1.MRBasics.entityCategories.entryPoint;\r\n }\r\n static isExitPoint(entity) {\r\n return entity.entity.kindId == MRBasics_1.MRBasics.entityCategories.exitPoint;\r\n }\r\n static isOrnament(entity) {\r\n return entity.entity.kindId == MRBasics_1.MRBasics.entityCategories.Ornament;\r\n }\r\n static isItem(entity) {\r\n return !this.isMonster(entity) &&\r\n !this.isEntryPoint(entity) &&\r\n !this.isExitPoint(entity) &&\r\n !this.isOrnament(entity);\r\n }\r\n applyProps(props) {\r\n }\r\n}\r\nexports.DEntityCategory = DEntityCategory;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DEntityCategory.ts?"); /***/ }), /***/ "./ts/mr/data/DEntityProperties.ts": /*!*****************************************!*\ !*** ./ts/mr/data/DEntityProperties.ts ***! \*****************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.parseMetaToEntityProperties = exports.DEntityProperties_Default = exports.DItemEquipmentSide = void 0;\r\nconst MRData_1 = __webpack_require__(/*! ./MRData */ \"./ts/mr/data/MRData.ts\");\r\nvar DItemEquipmentSide;\r\n(function (DItemEquipmentSide) {\r\n DItemEquipmentSide[DItemEquipmentSide[\"Right\"] = 0] = \"Right\";\r\n DItemEquipmentSide[DItemEquipmentSide[\"Left\"] = 1] = \"Left\";\r\n})(DItemEquipmentSide = exports.DItemEquipmentSide || (exports.DItemEquipmentSide = {}));\r\nfunction DEntityProperties_Default() {\r\n return {\r\n key: \"\",\r\n kindId: 0,\r\n behaviors: [],\r\n commandNames: [],\r\n reactionNames: [],\r\n //abilityNames: [],\r\n capacity: undefined,\r\n equipmentImage: {\r\n name: \"\",\r\n side: DItemEquipmentSide.Right,\r\n },\r\n meta_prefabName: \"\",\r\n };\r\n}\r\nexports.DEntityProperties_Default = DEntityProperties_Default;\r\n/** @deprecated DMetadataParser */\r\nfunction parseMetaToEntityProperties(meta) {\r\n var _a, _b;\r\n if (meta) {\r\n const kindName = meta[\"MR-Category\"];\r\n const kind = kindName ? MRData_1.MRData.findEntityCategory(kindName.trim()) : undefined;\r\n const data = {\r\n key: ((_a = meta[\"MR-Key\"]) !== null && _a !== void 0 ? _a : \"\").trim(),\r\n kindId: kind ? kind.id : 0,\r\n behaviors: [],\r\n commandNames: [],\r\n reactionNames: [],\r\n //abilityNames: [],\r\n capacity: meta[\"RE-Capacity\"],\r\n equipmentImage: {\r\n name: \"\",\r\n side: DItemEquipmentSide.Right,\r\n },\r\n meta_prefabName: ((_b = meta[\"MR-Prefab\"]) !== null && _b !== void 0 ? _b : \"\").trim(),\r\n };\r\n const behaviors = meta[\"MR-Behavior\"];\r\n if (behaviors) {\r\n throw new Error(\"MR-Behavior is obsoleted. Pleaes edit /data/mr/EntityBehaviors.json instead.\");\r\n // if (typeof(behaviors) == \"string\")\r\n // data.behaviors = parseMetadata_Behavior([behaviors]);\r\n // else\r\n // data.behaviors = parseMetadata_Behavior(behaviors);\r\n }\r\n const commands = meta[\"RE-Command\"];\r\n if (commands) {\r\n data.commandNames = commands.split(\";\");\r\n }\r\n const reactions = meta[\"RE-Reaction\"];\r\n if (reactions) {\r\n data.reactionNames = reactions.split(\";\");\r\n }\r\n // const abilities = meta[\"RE-Ability\"];\r\n // if (abilities) {\r\n // data.abilityNames = (abilities as string).split(\";\");\r\n // }\r\n const equipmentImage = meta[\"RE-EquipmentImage\"];\r\n if (equipmentImage) {\r\n const tokens = equipmentImage.split(\",\");\r\n data.equipmentImage.name = tokens[0];\r\n switch (tokens[1].toLocaleLowerCase()) {\r\n case \"right\":\r\n data.equipmentImage.side = DItemEquipmentSide.Right;\r\n break;\r\n case \"left\":\r\n data.equipmentImage.side = DItemEquipmentSide.Left;\r\n break;\r\n default:\r\n throw new Error(`Invalid token. (${tokens[1]})`);\r\n }\r\n }\r\n return data;\r\n }\r\n else {\r\n return DEntityProperties_Default();\r\n }\r\n}\r\nexports.parseMetaToEntityProperties = parseMetaToEntityProperties;\r\n// export function parseMetadata_Behavior(meta: string[]): DBehaviorInstantiation[] {\r\n// const result: DBehaviorInstantiation[] = [];\r\n// for (const data of meta) {\r\n// const expr = DHelpers.parseConstructionExpr(data);\r\n// result.push(new DBehaviorInstantiation( MRData.getBehavior(expr.name).id, expr.args));\r\n// }\r\n// return result;\r\n// }\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DEntityProperties.ts?"); /***/ }), /***/ "./ts/mr/data/DEntityTemplate.ts": /*!***************************************!*\ !*** ./ts/mr/data/DEntityTemplate.ts ***! \***************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DEntityTemplate = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst MRSetup_1 = __webpack_require__(/*! ./MRSetup */ \"./ts/mr/data/MRSetup.ts\");\r\nclass DEntityTemplate {\r\n constructor(id, key, props) {\r\n this.id = id;\r\n this.key = key;\r\n this._props = props;\r\n }\r\n get props() {\r\n return this._props;\r\n }\r\n resetProps(props) {\r\n (0, Common_1.assert)(this.props.type == props.type);\r\n this._props = props;\r\n }\r\n applyTo(entity) {\r\n switch (this.props.type) {\r\n case \"null\":\r\n break;\r\n case \"Weapon\":\r\n this.applyTo_Weapon(entity);\r\n break;\r\n case \"Shield\":\r\n this.applyTo_Shield(entity);\r\n break;\r\n case \"Armor\":\r\n this.applyTo_Armor(entity);\r\n break;\r\n case \"Accessory\":\r\n this.applyTo_Accessory(entity);\r\n break;\r\n case \"Grass\":\r\n this.applyTo_Grass(entity);\r\n break;\r\n case \"Food\":\r\n this.applyTo_Food(entity);\r\n break;\r\n case \"Storage\":\r\n this.applyTo_Storage(entity);\r\n break;\r\n default:\r\n (0, Common_1.assert)(false);\r\n }\r\n }\r\n applyTo_Weapon(entity) {\r\n (0, Common_1.assert)(this.props.type == \"Weapon\");\r\n MRSetup_1.MRSetup.setupWeaponCommon(entity);\r\n }\r\n applyTo_Shield(entity) {\r\n (0, Common_1.assert)(this.props.type == \"Shield\");\r\n MRSetup_1.MRSetup.setupShieldCommon(entity);\r\n }\r\n applyTo_Armor(entity) {\r\n (0, Common_1.assert)(this.props.type == \"Armor\");\r\n }\r\n applyTo_Accessory(entity) {\r\n (0, Common_1.assert)(this.props.type == \"Accessory\");\r\n }\r\n applyTo_Grass(entity) {\r\n (0, Common_1.assert)(this.props.type == \"Grass\");\r\n MRSetup_1.MRSetup.setupGrassCommon(entity, this.props.recoverFP);\r\n }\r\n applyTo_Food(entity) {\r\n (0, Common_1.assert)(this.props.type == \"Food\");\r\n MRSetup_1.MRSetup.setupFoodCommon(entity);\r\n }\r\n applyTo_Storage(entity) {\r\n (0, Common_1.assert)(this.props.type == \"Storage\");\r\n MRSetup_1.MRSetup.setupStorageCommon(entity);\r\n }\r\n}\r\nexports.DEntityTemplate = DEntityTemplate;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DEntityTemplate.ts?"); /***/ }), /***/ "./ts/mr/data/DEquipmentType.ts": /*!**************************************!*\ !*** ./ts/mr/data/DEquipmentType.ts ***! \**************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DEquipmentType_Default = void 0;\r\nexports.DEquipmentType_Default = {\r\n id: 0,\r\n name: \"null\",\r\n};\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DEquipmentType.ts?"); /***/ }), /***/ "./ts/mr/data/DFaction.ts": /*!********************************!*\ !*** ./ts/mr/data/DFaction.ts ***! \********************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DFactionType = void 0;\r\nvar DFactionType;\r\n(function (DFactionType) {\r\n /** 中立的. */\r\n DFactionType[\"Neutral\"] = \"Neutral\";\r\n /** 友好的. または操作中の Unit. */\r\n DFactionType[\"Friendly\"] = \"Friendly\";\r\n /** 敵対的. */\r\n DFactionType[\"Hostile\"] = \"Hostile\";\r\n})(DFactionType = exports.DFactionType || (exports.DFactionType = {}));\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DFaction.ts?"); /***/ }), /***/ "./ts/mr/data/DFlavorEffect.ts": /*!*************************************!*\ !*** ./ts/mr/data/DFlavorEffect.ts ***! \*************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DFlavorEffect = exports.DSound = void 0;\r\nclass DSound {\r\n constructor(options) {\r\n var _a, _b, _c;\r\n this.name = options.name;\r\n this.pan = (_a = options.pan) !== null && _a !== void 0 ? _a : 0;\r\n this.pitch = (_b = options.pitch) !== null && _b !== void 0 ? _b : 100;\r\n this.volume = (_c = options.volume) !== null && _c !== void 0 ? _c : 90;\r\n }\r\n}\r\nexports.DSound = DSound;\r\nclass DFlavorEffect {\r\n constructor(options) {\r\n var _a, _b;\r\n options = options || {};\r\n if (options.text === undefined) {\r\n this.text = [];\r\n }\r\n else if (options.text instanceof Array) {\r\n this.text = options.text;\r\n }\r\n else {\r\n this.text = [options.text];\r\n }\r\n this.sound = options.sound ? new DSound(options.sound) : undefined;\r\n this.rmmzAnimationId = (_a = options.animationId) !== null && _a !== void 0 ? _a : 0;\r\n this.motionId = (_b = options.motionId) !== null && _b !== void 0 ? _b : 0;\r\n }\r\n // utility\r\n static fromRmmzAnimationId(rmmzAnimationId) {\r\n const result = new DFlavorEffect();\r\n result.rmmzAnimationId = rmmzAnimationId;\r\n return result;\r\n }\r\n}\r\nexports.DFlavorEffect = DFlavorEffect;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DFlavorEffect.ts?"); /***/ }), /***/ "./ts/mr/data/DHelper.ts": /*!*******************************!*\ !*** ./ts/mr/data/DHelper.ts ***! \*******************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DHelpers = void 0;\r\nconst DEffect_1 = __webpack_require__(/*! ./DEffect */ \"./ts/mr/data/DEffect.ts\");\r\nclass DHelpers {\r\n //public static WorldLandId = 2;\r\n // NOTE: なぜ Vanilla と World を分けるの?\r\n // → お試し中。 World という単位を入れると色々と都合がよいことが分かったが、\r\n // Vanilla は従来から「MRシステム管理外」のマップの置き場としていた。\r\n // Vanilla と World を一緒にしてしまうと、その置き場がなくなってしまう。\r\n // public static getMapName(mapId: DMapId): string {\r\n // const info = $dataMapInfos[mapId];\r\n // return info ? info.name : \"\";\r\n // }\r\n static isVanillaLand(landId) {\r\n return landId == this.VanillaLandId;\r\n }\r\n // public static isWorldLand(landId: DLandId): boolean {\r\n // return landId == this.WorldLandId;\r\n // }\r\n // public static isDungeonLand(landId: DLandId): boolean {\r\n // return landId > 0 && landId != this.VanillaLandId && landId != this.WorldLandId;\r\n // }\r\n static getMapTopTile(mapData, x, y) {\r\n for (let z = 3; z >= 0; z--) {\r\n const tile = mapData.data[(z * mapData.height + y) * mapData.width + x] || 0;\r\n if (tile > 0)\r\n return tile;\r\n }\r\n return 0;\r\n }\r\n static isTileA3(tileId) {\r\n return tileId >= this.TILE_ID_A3 && tileId < this.TILE_ID_A4;\r\n }\r\n ;\r\n static isTileA4(tileId) {\r\n return tileId >= this.TILE_ID_A4 && tileId < this.TILE_ID_MAX;\r\n }\r\n ;\r\n static isAutotile(tileId) {\r\n return tileId >= this.TILE_ID_A1;\r\n }\r\n static getAutotileKind(tileId) {\r\n //if (!this.isAutotile(tileId)) return 0;\r\n return Math.floor((tileId - this.TILE_ID_A1) / 48);\r\n }\r\n static autotileKindToTileId(autotileKind) {\r\n return autotileKind * 48 + this.TILE_ID_A1;\r\n }\r\n static isWallSideAutoTile(autotileKind) {\r\n const tileId = this.autotileKindToTileId(autotileKind);\r\n return ((this.isTileA3(tileId) || this.isTileA4(tileId)) &&\r\n this.getAutotileKind(tileId) % 16 >= 8);\r\n }\r\n static stringToEnum(value, pattern) {\r\n if (value) {\r\n const e = pattern[value];\r\n if (e !== undefined) {\r\n return e;\r\n }\r\n }\r\n const d = pattern[\"_\"];\r\n if (d !== undefined) {\r\n return d;\r\n }\r\n throw new Error(`Unknown value: ${value}`);\r\n }\r\n // Game_Action.prototype.checkItemScope\r\n static checkItemScope(itemScope, list) {\r\n return list.includes(itemScope);\r\n }\r\n // Game_Action.prototype.isForOpponent\r\n static isForOpponent(itemScope) {\r\n return this.checkItemScope(itemScope, [\r\n DEffect_1.DRmmzEffectScope.Opponent_Single,\r\n DEffect_1.DRmmzEffectScope.Opponent_All,\r\n DEffect_1.DRmmzEffectScope.Opponent_Random_1,\r\n DEffect_1.DRmmzEffectScope.Opponent_Random_2,\r\n DEffect_1.DRmmzEffectScope.Opponent_Random_3,\r\n DEffect_1.DRmmzEffectScope.Opponent_Random_4,\r\n DEffect_1.DRmmzEffectScope.Everyone\r\n ]);\r\n }\r\n // Game_Action.prototype.isForAliveFriend\r\n static isForAliveFriend(itemScope) {\r\n return this.checkItemScope(itemScope, [\r\n DEffect_1.DRmmzEffectScope.Friend_Single_Alive,\r\n DEffect_1.DRmmzEffectScope.Friend_All_Alive,\r\n DEffect_1.DRmmzEffectScope.User,\r\n DEffect_1.DRmmzEffectScope.Everyone\r\n ]);\r\n }\r\n // Game_Action.prototype.isForDeadFriend\r\n static isForDeadFriend(itemScope) {\r\n return this.checkItemScope(itemScope, [\r\n DEffect_1.DRmmzEffectScope.Friend_Single_Dead,\r\n DEffect_1.DRmmzEffectScope.Friend_All_Dead\r\n ]);\r\n }\r\n static isForFriend(itemScope) {\r\n return this.isForAliveFriend(itemScope) || this.isForDeadFriend(itemScope);\r\n }\r\n static isSingle(itemScope) {\r\n return this.checkItemScope(itemScope, [\r\n DEffect_1.DRmmzEffectScope.Friend_Single_Dead,\r\n DEffect_1.DRmmzEffectScope.Friend_Single_Alive,\r\n DEffect_1.DRmmzEffectScope.Opponent_Single\r\n ]);\r\n }\r\n static countSomeTilesRight_E(mapData, x, y) {\r\n const findEvent = function (x, y) {\r\n for (const event of mapData.events) {\r\n if (event && event.x == x && event.y == y) {\r\n return event;\r\n }\r\n }\r\n return undefined;\r\n };\r\n const baseTile = DHelpers.getMapTopTile(mapData, x, y);\r\n let x2 = x + 1;\r\n // 右へ伸びるタイルをカウントするときは E タイルのみを対象とする\r\n if (DHelpers.TILE_ID_E <= baseTile && baseTile < DHelpers.TILE_ID_A5) {\r\n for (; x2 < mapData.width; x2++) {\r\n if (baseTile != DHelpers.getMapTopTile(mapData, x2, y) || findEvent(x2, y)) {\r\n break;\r\n }\r\n }\r\n }\r\n return (x2 - 1) - x;\r\n }\r\n static extractMetadata(data) {\r\n data.meta = {};\r\n for (;;) {\r\n var match = this.extractMetadataRegex.exec(data.note);\r\n if (match) {\r\n var value = (match[2] === ':') ? match[3] : true;\r\n if (data.meta[match[1]]) {\r\n if (data.meta[match[1]].constructor === Array) {\r\n data.meta[match[1]].push(value);\r\n }\r\n else {\r\n var _value = data.meta[match[1]];\r\n data.meta[match[1]] = [_value, value];\r\n }\r\n }\r\n else {\r\n data.meta[match[1]] = value;\r\n }\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n }\r\n static makeRmmzMapDebugName(mapId) {\r\n var _a;\r\n return `${mapId}:${(_a = $dataMapInfos[mapId]) === null || _a === void 0 ? void 0 : _a.name}`;\r\n }\r\n static isNode() {\r\n return (process.title !== 'browser');\r\n }\r\n static parseConstructionExpr(expr) {\r\n // \"Item(1, 2)\" を、 { name: \"Item\", args: [1, 2] } にする。\r\n const lp = expr.indexOf(\"(\");\r\n const rp = expr.lastIndexOf(\")\");\r\n if (lp >= 0 && rp >= 0) {\r\n const expr2 = \"[\" + expr.substr(lp + 1, rp - lp - 1) + \"]\";\r\n const args = eval(expr2);\r\n return { name: expr.substr(0, lp).trim(), args: args };\r\n }\r\n else {\r\n // 引数省略されている\r\n return { name: expr.trim(), args: [] };\r\n }\r\n }\r\n static parseDisplayName(name) {\r\n const index = name.lastIndexOf(\".\");\r\n if (index >= 0)\r\n return name.substring(0, index);\r\n else\r\n return name;\r\n }\r\n}\r\nexports.DHelpers = DHelpers;\r\nDHelpers.TILE_ID_E = 768;\r\nDHelpers.TILE_ID_A5 = 1536;\r\nDHelpers.TILE_ID_A1 = 2048;\r\nDHelpers.TILE_ID_A2 = 2816;\r\nDHelpers.TILE_ID_A3 = 4352;\r\nDHelpers.TILE_ID_A4 = 5888;\r\nDHelpers.TILE_ID_MAX = 8192;\r\nDHelpers.VanillaLandId = 1;\r\nDHelpers.extractMetadataRegex = /<([^<>:]+)(:?)([^>]*)>/g;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DHelper.ts?"); /***/ }), /***/ "./ts/mr/data/DItem.ts": /*!*****************************!*\ !*** ./ts/mr/data/DItem.ts ***! \*****************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DEquipment = exports.DItem = void 0;\r\nconst MRData_1 = __webpack_require__(/*! ./MRData */ \"./ts/mr/data/MRData.ts\");\r\n/**\r\n * ひとまず Item, Weapon Armor をまとめて表現してみる。\r\n *Item を装備するようなケースは無いが、装備品をアイテムとして扱うことはよくある。\r\n *(矢や杖を \"セット\" してショートカットキーで使えるようにすることはある)\r\n *食べられる武器、投げると特殊な効果を発揮する武器、アイテムを入れることができる盾、武器として使える両手盾など。\r\n *また合成印の素材は、装備品だけではなくあらゆるアイテムが対象となる。\r\n *\r\n *\r\n * [2021/5/19] Effect に対してタグのように Activity を振る案\r\n * ----------\r\n * - 火炎草のように飲んだ時と投げ当てた時で効果が変わるもの。飲んだ時は FP も回復する。\r\n * - さらに、これを新種道具の効果として継承できるようにしたい。\r\n *\r\n * \"火炎草\" というひとつの Ability より、\r\n * \"飲むとブレススキルを発動する\", \"投げ当てると炎ダメージを与える\" 2つの Ability に分けた方がいいかも。\r\n *\r\n * 草を飲むことによる FP 回復は Ability ではなく、草アイテム固有の Effect.\r\n * なので、\"火炎草\" アイテムの設定は\r\n * - ダメージ: なし\r\n * - \r\n * - \r\n * - \r\n *\r\n * [2021/6/3] Effect と Action は分類するべきかも\r\n * ----------\r\n * - Effect は何かしらの動作や状況変化をうけて発動する効果。\r\n * - 単にスキル効果を発動するもの\r\n * - 吹き飛ばしのようにスクリプト側で制御する動作を開始するもの\r\n *\r\n * Effect は RMMZ エディタ上ではスキルとして作成するのがいいかも。\r\n * - パラメータダメージはツクール標準で設定。\r\n * - 拡張パラメータは Note で設定。\r\n * - 吹き飛ばし効果やブレスは Note で、「ActionEffect」 みたいな名前で設定。\r\n *\r\n * これを考慮すると「飲むとブレススキルを発動するAbility」は、\r\n * - \r\n *\r\n * 「kSkill_炎ブレス」は、\r\n * - \r\n * だけでいいかな。射程目の前だけだし。\r\n *\r\n * [2021/6/3] Projectile\r\n * ----------\r\n * 魔法弾、ドラゴン草、矢、大砲の弾、石、\"技\"による弾\r\n *\r\n * これら、もしかしたら「射程」の一部と考えたほうがよいのかも?\r\n *\r\n * 通常攻撃や火炎草は目の前に効果を発動する。\r\n * 矢弾は Projectile を出現させる。\r\n * Projectile は何らかの Item である。\r\n * 炎や魔法弾も Item である。\r\n * 極端な話、キャッチしてインベントリに入れることもできる。\r\n *\r\n * Scope { range: \"straight\", length: \"inf\", projectile: \"pブレス\" } # スキル\r\n * Scope { range: \"straight\", length: 10, projectile: \"self\" } # 矢弾アイテム\r\n *\r\n * 矢弾アイテムの場合は、自身を Projectile として打ち出す。\r\n * スタックされているアイテムの場合、1つだけマップ上に出現させるような処理になる。\r\n *\r\n */\r\nclass DItem {\r\n constructor(id, entityId) {\r\n this.id = id;\r\n this.entityId = entityId;\r\n this.rmmzItemId = 0;\r\n this.rmmzWeaponId = 0;\r\n this.rmmzArmorId = 0;\r\n }\r\n entityData() {\r\n return MRData_1.MRData.entities[this.entityId];\r\n }\r\n}\r\nexports.DItem = DItem;\r\nclass DEquipment {\r\n constructor() {\r\n this.equipmentPart = 0;\r\n this.equipmentOccupancyParts = [];\r\n this.parameters = [];\r\n this.targetRmmzAnimationId = 0;\r\n }\r\n}\r\nexports.DEquipment = DEquipment;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DItem.ts?"); /***/ }), /***/ "./ts/mr/data/DItemEffect.ts": /*!***********************************!*\ !*** ./ts/mr/data/DItemEffect.ts ***! \***********************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DItemEffect = void 0;\r\nclass DItemEffect {\r\n}\r\nexports.DItemEffect = DItemEffect;\r\nDItemEffect.EFFECT_RECOVER_HP = 11;\r\nDItemEffect.EFFECT_RECOVER_MP = 12;\r\nDItemEffect.EFFECT_GAIN_TP = 13;\r\nDItemEffect.EFFECT_ADD_STATE = 21;\r\nDItemEffect.EFFECT_REMOVE_STATE = 22;\r\nDItemEffect.EFFECT_ADD_BUFF = 31;\r\nDItemEffect.EFFECT_ADD_DEBUFF = 32;\r\nDItemEffect.EFFECT_REMOVE_BUFF = 33;\r\nDItemEffect.EFFECT_REMOVE_DEBUFF = 34;\r\nDItemEffect.EFFECT_SPECIAL = 41;\r\nDItemEffect.EFFECT_GROW = 42;\r\nDItemEffect.EFFECT_LEARN_SKILL = 43;\r\nDItemEffect.EFFECT_COMMON_EVENT = 44;\r\nDItemEffect.SPECIAL_EFFECT_ESCAPE = 0;\r\nDItemEffect.HITTYPE_CERTAIN = 0;\r\nDItemEffect.HITTYPE_PHYSICAL = 1;\r\nDItemEffect.HITTYPE_MAGICAL = 2;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DItemEffect.ts?"); /***/ }), /***/ "./ts/mr/data/DLand.ts": /*!*****************************!*\ !*** ./ts/mr/data/DLand.ts ***! \*****************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DLand = exports.DLandRule = exports.DLandExitInventoryRule = exports.DLandExitStatusRule = exports.DLandForwardDirection = exports.DLandIdentificationLevel = exports.DTerrainSettingRef = exports.DFloorStructures = exports.DFloorMode = exports.DFloorClass = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst DAnnotationReader_1 = __webpack_require__(/*! ./importers/DAnnotationReader */ \"./ts/mr/data/importers/DAnnotationReader.ts\");\r\nconst DSpawner_1 = __webpack_require__(/*! ./DSpawner */ \"./ts/mr/data/DSpawner.ts\");\r\nconst DEntityCategory_1 = __webpack_require__(/*! ./DEntityCategory */ \"./ts/mr/data/DEntityCategory.ts\");\r\nconst DHelper_1 = __webpack_require__(/*! ./DHelper */ \"./ts/mr/data/DHelper.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ./MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst Diag_1 = __webpack_require__(/*! ../Diag */ \"./ts/mr/Diag.ts\");\r\nconst DValidationHelper_1 = __webpack_require__(/*! ./DValidationHelper */ \"./ts/mr/data/DValidationHelper.ts\");\r\nconst DSystem_1 = __webpack_require__(/*! ./DSystem */ \"./ts/mr/data/DSystem.ts\");\r\nvar DFloorClass;\r\n(function (DFloorClass) {\r\n DFloorClass[DFloorClass[\"FloorMap\"] = 0] = \"FloorMap\";\r\n DFloorClass[DFloorClass[\"EventMap\"] = 1] = \"EventMap\";\r\n})(DFloorClass = exports.DFloorClass || (exports.DFloorClass = {}));\r\nvar DFloorMode;\r\n(function (DFloorMode) {\r\n DFloorMode[\"Field\"] = \"Field\";\r\n DFloorMode[\"Area\"] = \"Area\";\r\n})(DFloorMode = exports.DFloorMode || (exports.DFloorMode = {}));\r\nclass DFloorStructures {\r\n}\r\nexports.DFloorStructures = DFloorStructures;\r\nclass DTerrainSettingRef {\r\n constructor(terrainSettingsId, rating) {\r\n this.terrainSettingsId = terrainSettingsId;\r\n this.rating = rating;\r\n }\r\n}\r\nexports.DTerrainSettingRef = DTerrainSettingRef;\r\nvar DLandIdentificationLevel;\r\n(function (DLandIdentificationLevel) {\r\n /** 未識別 */\r\n DLandIdentificationLevel[DLandIdentificationLevel[\"Unknown\"] = 0] = \"Unknown\";\r\n /** 種別識別済み */\r\n DLandIdentificationLevel[DLandIdentificationLevel[\"Kind\"] = 1] = \"Kind\";\r\n /** 個体識別済み */\r\n DLandIdentificationLevel[DLandIdentificationLevel[\"Entity\"] = 2] = \"Entity\";\r\n})(DLandIdentificationLevel = exports.DLandIdentificationLevel || (exports.DLandIdentificationLevel = {}));\r\nvar DLandForwardDirection;\r\n(function (DLandForwardDirection) {\r\n /** フロア数が増えるごとに、上の階へ向かう */\r\n DLandForwardDirection[DLandForwardDirection[\"Uphill\"] = 0] = \"Uphill\";\r\n /** フロア数が増えるごとに、下の階へ向かう */\r\n DLandForwardDirection[DLandForwardDirection[\"Downhill\"] = 1] = \"Downhill\";\r\n /** 概念的な上下移動を伴わない */\r\n DLandForwardDirection[DLandForwardDirection[\"Flat\"] = 2] = \"Flat\";\r\n})(DLandForwardDirection = exports.DLandForwardDirection || (exports.DLandForwardDirection = {}));\r\n/** Land を抜けた時のステータスに対するルール */\r\nvar DLandExitStatusRule;\r\n(function (DLandExitStatusRule) {\r\n /** グローバル設定を継承する */\r\n DLandExitStatusRule[DLandExitStatusRule[\"Default\"] = 0] = \"Default\";\r\n /** 無し */\r\n DLandExitStatusRule[DLandExitStatusRule[\"None\"] = 1] = \"None\";\r\n /** 永続パラメータを含めて、全てのパラメータをリセットする */\r\n DLandExitStatusRule[DLandExitStatusRule[\"Initialize\"] = 2] = \"Initialize\";\r\n})(DLandExitStatusRule = exports.DLandExitStatusRule || (exports.DLandExitStatusRule = {}));\r\n/** Land を抜けた時のインベントリに対するルール */\r\nvar DLandExitInventoryRule;\r\n(function (DLandExitInventoryRule) {\r\n /** グローバル設定を継承する */\r\n DLandExitInventoryRule[DLandExitInventoryRule[\"Default\"] = 0] = \"Default\";\r\n /** 無し */\r\n DLandExitInventoryRule[DLandExitInventoryRule[\"None\"] = 1] = \"None\";\r\n /** 持ち物を全て削除する */\r\n DLandExitInventoryRule[DLandExitInventoryRule[\"Initialize\"] = 2] = \"Initialize\";\r\n})(DLandExitInventoryRule = exports.DLandExitInventoryRule || (exports.DLandExitInventoryRule = {}));\r\nclass DLandRule {\r\n /*\r\n [2022/9/29] ゲームオーバー時にステータスをリセットするのはどのタイミングがよい?\r\n ----------\r\n ### Dungeon から Land へ遷移開始したとき\r\n - 画面暗転時に Window に表示されている HP が全快して見えてしまう。\r\n - これは多分、ExitMap が Vanilla に属していたのが原因。\r\n - 攻撃>戦闘不能処理>マップ遷移>ステータスリセット が同一のコマンドチェーンで実行されるため、ユニットテストが難しくなる。\r\n - 特定条件で、ゲームオーバーではなくイベントに遷移し、そこでの結果に応じて冒険に復帰、といったことができなくなる。\r\n おそらく、マップの移動に引っ掛けるよりはなんらか「冒険の終了宣言」に引っ掛けるのがよいのかもしれない。\r\n\r\n ### Dungeon から World への遷移が完了したとき\r\n ゲームオーバーでホームへ戻ったときや、クリアしてダンジョンの入口へ戻るときなど。\r\n\r\n\r\n\r\n */\r\n constructor() {\r\n this.enteredStatus = DLandExitStatusRule.Default;\r\n this.enteredInventory = DLandExitInventoryRule.Default;\r\n this.conqueredStatus = DLandExitStatusRule.Default;\r\n this.conqueredInventory = DLandExitInventoryRule.Default;\r\n this.abandonedStatus = DLandExitStatusRule.Default;\r\n this.abandonedInventory = DLandExitInventoryRule.Default;\r\n // this.conqueredStatus = DLandExitStatusRule.Initialize;\r\n // this.conqueredInventory = DLandExitInventoryRule.None;\r\n // this.abandonedStatus = DLandExitStatusRule.Initialize;\r\n // this.abandonedInventory = DLandExitInventoryRule.Initialize;\r\n }\r\n}\r\nexports.DLandRule = DLandRule;\r\n/**\r\n * ダンジョンや町ひとつ分。\r\n *\r\n * Id=1 の Land は VanillaLand と呼ばれる。VanillaLand は、\r\n * - ゲーム開始時に自動的に生成される。\r\n * - いずれの Land にも属さない RmmzMap に対応する DMap は全てここに属する。\r\n * - RmmzMapId と等しい FloorNumber の Floor が存在する。Floor は歯抜けになっていることもある。\r\n */\r\nclass DLand {\r\n constructor(id, isWorld) {\r\n this.id = id;\r\n this.name = \"null\";\r\n this.rmmzMapId = 0;\r\n this.eventTableMapId = 0;\r\n this.itemTableMapId = 0;\r\n this.enemyTableMapId = 0;\r\n this.trapTableMapId = 0;\r\n this.shopTableMapId = 0;\r\n this.appearanceTable = {\r\n entities: [],\r\n maxFloors: 0,\r\n system: [],\r\n enemies: [],\r\n traps: [],\r\n items: [],\r\n events: [],\r\n shop: [],\r\n },\r\n //eventTable = { entities = [] },\r\n //itemTable = { entities = [] },\r\n //enemyTable = { entities = [] },\r\n //trapTable = { entities = [] },\r\n //exitFloorId = { landId = 0, floorNumber = 0 },\r\n this.floorInfos = [];\r\n this.lastFloorNumber = -1;\r\n //this.floorIds = [];\r\n this.fixedMapIds = [];\r\n this.eventMapIds = [];\r\n this._exitEventMapFlooNumber = -1;\r\n this.identifiedKinds = [];\r\n this.forwardDirection = DLandForwardDirection.Uphill;\r\n this._isWorld = isWorld;\r\n }\r\n //--------------------------------------------------------------------------\r\n // Validation\r\n toDebugName() {\r\n return DValidationHelper_1.DValidationHelper.makeDataName(\"Land\", this.id, this.name);\r\n }\r\n validate() {\r\n if (this.id > 0 && !this.isVanillaLand) {\r\n if (this._exitEventMapFlooNumber <= 0) {\r\n Diag_1.Diag.error(this.toDebugName() + (0, Common_1.tr)(\"の ExitMap が設定されていません。\"));\r\n }\r\n }\r\n }\r\n //--------------------------------------------------------------------------\r\n get isVanillaLand() {\r\n return DHelper_1.DHelpers.isVanillaLand(this.id);\r\n }\r\n get isWorldLand() {\r\n return this._isWorld;\r\n }\r\n // public get isDungeonLand(): boolean {\r\n // return DHelpers.isDungeonLand(this.id);\r\n // }\r\n get exitMapFloorNumber() {\r\n (0, Common_1.assert)(this._exitEventMapFlooNumber >= 0);\r\n return this._exitEventMapFlooNumber;\r\n }\r\n // public get eventMapIds(): readonly DMapId[] {\r\n // return this._eventMapIds;\r\n // }\r\n // public get exitMapId(): DMapId {\r\n // assert(this._exitEventMapFlooNumber >= 0);\r\n // return this._eventMapIds[this._exitEventMapIndex];\r\n // }\r\n // public get exitMapData(): DMap {\r\n // return MRData.maps[this.exitMapId];\r\n // }\r\n getFloorClass(mapData) {\r\n (0, Common_1.assert)(mapData.landId === this.id);\r\n //if (this._exitMapId == mapData.id) return DFloorClass.ExitMap;\r\n if (!!this.eventMapIds.find(id => mapData.id))\r\n return DFloorClass.EventMap;\r\n return DFloorClass.FloorMap;\r\n }\r\n // public getMapDataIndex(floorNumber: number): number {\r\n // }\r\n getFixedMap(floorNumber) {\r\n const floorInfo = this.floorInfos[floorNumber];\r\n if (!floorInfo)\r\n return undefined;\r\n if (floorInfo.fixedMapIndex < 0)\r\n return undefined;\r\n return MRData_1.MRData.maps[this.fixedMapIds[floorInfo.fixedMapIndex]];\r\n }\r\n findFixedMapByName(name) {\r\n if (!name)\r\n return undefined;\r\n const mapId = this.fixedMapIds.find(x => MRData_1.MRData.maps[x].name == name);\r\n if (!mapId)\r\n return undefined;\r\n return MRData_1.MRData.maps[mapId];\r\n }\r\n // 見つからない場合は -1.\r\n findFloorNumberByMapId(mapId) {\r\n return this.floorInfos.findIndex(x => x && x.fixedMapIndex >= 0 && this.fixedMapIds[x.fixedMapIndex] === mapId);\r\n }\r\n addEventMap(map) {\r\n // assert(map.landId === 0);\r\n // map.landId = this.id;\r\n this.eventMapIds.push(map.id);\r\n // const info: DFloorInfo = {\r\n // key: map.name,\r\n // template: undefined,\r\n // displayName: map.name,\r\n // fixedMapIndex: -1,\r\n // floorClass: DFloorClass.EventMap,\r\n // safetyActions: true,\r\n // bgmName: \"\",\r\n // bgmVolume: 90,\r\n // bgmPitch: 100,\r\n // presetId: 1,\r\n // unique: false,\r\n // fovSystem: DFovSystem.RoomBounds,\r\n // };\r\n // this.floorInfos.push(info);\r\n }\r\n // public addEventMapAsExitMap(map: DMap): void {\r\n // if (this._exitEventMapFlooNumber >= 0) Diag.error(this.toDebugName() + tr2(\"既に ExitMap が設定されています。\"));\r\n // //assert(map.landId === 0);\r\n // assert(map.landId === this.id); // TODO: 一時的に許容\r\n // map.landId = this.id;\r\n // map.exitMap = true;\r\n // this._eventMapIds.push(map.id);\r\n // this._exitEventMapFlooNumber = this.floorInfos.length;\r\n // const info: DFloorInfo = {\r\n // key: map.name,\r\n // template: undefined,\r\n // displayName: map.name,\r\n // fixedMapIndex: -1,\r\n // floorClass: DFloorClass.EventMap,\r\n // safetyActions: true,\r\n // bgmName: \"\",\r\n // bgmVolume: 90,\r\n // bgmPitch: 100,\r\n // presetId: 1,\r\n // unique: false,\r\n // fovSystem: DFovSystem.RoomBounds,\r\n // };\r\n // this.floorInfos.push(info);\r\n // }\r\n // public getFixedMapByName(name: string): DMap {\r\n // const mapId = this.fixedMapIds.find(x => REData.maps[x].name == name);\r\n // assert(mapId);\r\n // return REData.maps[mapId];\r\n // }\r\n import(mapData) {\r\n this.floorInfos = this.buildFloorTable(mapData);\r\n this.lastFloorNumber = this.floorInfos.length - 1;\r\n this.appearanceTable = DLand.buildAppearanceTableSet(mapData, this.rmmzMapId, this.floorInfos.length);\r\n for (const event of mapData.events) {\r\n if (!event)\r\n continue;\r\n const data = DAnnotationReader_1.DAnnotationReader.readLandAnnotation(event);\r\n if (data) {\r\n if (data.identifications) {\r\n for (const pair of data.identifications) {\r\n const tokens = pair.split(\":\");\r\n const key = tokens[0];\r\n if (key.toLowerCase() == \"all\") {\r\n const level = this.parseLandIdentificationLevel(tokens[1].toLowerCase());\r\n for (const kind of MRData_1.MRData.categories) {\r\n this.identifiedKinds[kind.id] = level;\r\n }\r\n }\r\n else {\r\n const kind = MRData_1.MRData.getEntityCategory(key.toLowerCase());\r\n this.identifiedKinds[kind.id] = this.parseLandIdentificationLevel(tokens[1].toLowerCase());\r\n }\r\n }\r\n }\r\n break;\r\n }\r\n }\r\n // EventMap の Floor は通常 Floor の後に追加したい\r\n for (let i = 0; i < this.eventMapIds.length; i++) {\r\n const mapId = this.eventMapIds[i];\r\n const mapData = MRData_1.MRData.maps[mapId];\r\n const info = {\r\n key: mapData.name,\r\n template: undefined,\r\n displayName: mapData.name,\r\n mode: DFloorMode.Area,\r\n floorClass: DFloorClass.EventMap,\r\n fixedMapIndex: -1,\r\n eventMapIndex: i,\r\n safetyActions: true,\r\n bgmName: \"\",\r\n bgmVolume: 90,\r\n bgmPitch: 100,\r\n presetId: 1,\r\n unique: false,\r\n fovSystem: DSystem_1.DFovSystem.RoomBounds,\r\n };\r\n this.floorInfos.push(info);\r\n if (mapData.exitMap) {\r\n this._exitEventMapFlooNumber = this.floorInfos.length - 1;\r\n }\r\n }\r\n }\r\n parseLandIdentificationLevel(str) {\r\n switch (str) {\r\n case \"entity\":\r\n return DLandIdentificationLevel.Entity;\r\n case \"kind\":\r\n return DLandIdentificationLevel.Kind;\r\n default:\r\n throw new Error(`IdentificationLevel \"${str}\" is invalid.`);\r\n }\r\n }\r\n checkIdentifiedKind(kind) {\r\n const e = this.identifiedKinds[kind.id];\r\n if (!e)\r\n return false; // 省略されているなら未識別\r\n return e >= DLandIdentificationLevel.Kind;\r\n }\r\n checkIdentifiedEntity(kind) {\r\n const e = this.identifiedKinds[kind.id];\r\n if (!e)\r\n return false; // 省略されているなら未識別\r\n return e >= DLandIdentificationLevel.Entity;\r\n }\r\n buildFloorTable(mapData) {\r\n var _a, _b, _c, _d, _e;\r\n const floors = [];\r\n for (const event of mapData.events) {\r\n if (!event)\r\n continue;\r\n // @MR-Floor 設定を取り出す\r\n const floorData = DAnnotationReader_1.DAnnotationReader.readFloorAnnotationFromPage(event.pages[0]);\r\n if (floorData) {\r\n const fixedMapName = (_a = floorData.fixedMap) !== null && _a !== void 0 ? _a : \"\";\r\n const info = {\r\n key: event.name,\r\n template: (_b = floorData.template) !== null && _b !== void 0 ? _b : undefined,\r\n displayName: (_c = floorData.displayName) !== null && _c !== void 0 ? _c : undefined,\r\n mode: DHelper_1.DHelpers.stringToEnum(floorData.mode, {\r\n \"Field\": DFloorMode.Field,\r\n \"_\": DFloorMode.Area,\r\n }),\r\n floorClass: DFloorClass.FloorMap,\r\n fixedMapIndex: this.fixedMapIds.findIndex(x => MRData_1.MRData.maps[x].name == fixedMapName),\r\n eventMapIndex: -1,\r\n safetyActions: (_d = floorData.safety) !== null && _d !== void 0 ? _d : false,\r\n bgmName: floorData.bgm ? floorData.bgm[0] : \"\",\r\n bgmVolume: floorData.bgm ? floorData.bgm[1] : 90,\r\n bgmPitch: floorData.bgm ? floorData.bgm[2] : 100,\r\n presetId: floorData.preset ? MRData_1.MRData.getFloorPreset(floorData.preset).id : 1,\r\n unique: (_e = floorData.unique) !== null && _e !== void 0 ? _e : false,\r\n fovSystem: DHelper_1.DHelpers.stringToEnum(floorData.fovSystem, {\r\n \"SymmetricShadowcast\": DSystem_1.DFovSystem.SymmetricShadowcast,\r\n \"_\": DSystem_1.DFovSystem.RoomBounds,\r\n }),\r\n };\r\n const x2 = event.x + DHelper_1.DHelpers.countSomeTilesRight_E(mapData, event.x, event.y);\r\n for (let x = event.x; x <= x2; x++) {\r\n floors[x] = info;\r\n }\r\n }\r\n }\r\n return floors;\r\n }\r\n static buildAppearanceTableSet(mapData, rmmzMapId, maxFloors) {\r\n const table = {\r\n entities: [],\r\n maxFloors: 0,\r\n system: [],\r\n enemies: [],\r\n traps: [],\r\n items: [],\r\n events: [],\r\n shop: [],\r\n };\r\n const eventList = [];\r\n table.maxFloors = mapData.width;\r\n // まずは Entity, Event を集計\r\n for (const event of mapData.events) {\r\n if (!event)\r\n continue;\r\n const x = event.x;\r\n const y = event.y;\r\n // @MR-Spawner\r\n const entityMetadata = DAnnotationReader_1.DAnnotationReader.readSpawnerAnnotationFromPage(event.pages[0]);\r\n if (entityMetadata) {\r\n const spawnInfo = DSpawner_1.DEntitySpawner.makeFromEventData(event, rmmzMapId);\r\n if (!spawnInfo) {\r\n throw new Error(`Entity \"${entityMetadata.entity}\" not found. (Map:${DHelper_1.DHelpers.makeRmmzMapDebugName(rmmzMapId)}, Event:${event.id}.${event.name})`);\r\n }\r\n if (spawnInfo.entityId <= 0 && spawnInfo.troopId <= 0) {\r\n throw new Error(`Entity \"${spawnInfo.xName}\" not found. (Map:${DHelper_1.DHelpers.makeRmmzMapDebugName(rmmzMapId)}, Event:${event.id}.${event.name})`);\r\n }\r\n const tableItem = {\r\n spawiInfo: spawnInfo,\r\n startFloorNumber: x,\r\n lastFloorNumber: x + DHelper_1.DHelpers.countSomeTilesRight_E(mapData, x, y),\r\n };\r\n table.entities.push(tableItem);\r\n //table.maxFloors = Math.max(table.maxFloors, tableItem.lastFloorNumber + 1);\r\n }\r\n // @MR-Event\r\n const eventMetadata = DAnnotationReader_1.DAnnotationReader.readREEventAnnotationFromPage(event.pages[0]);\r\n if (eventMetadata) {\r\n const tableItem = {\r\n rmmzEventId: event.id,\r\n startFloorNumber: x,\r\n lastFloorNumber: x + DHelper_1.DHelpers.countSomeTilesRight_E(mapData, x, y),\r\n };\r\n eventList.push(tableItem);\r\n //table.maxFloors = Math.max(table.maxFloors, tableItem.lastFloorNumber + 1);\r\n }\r\n }\r\n const floorCount = Math.max(table.maxFloors, maxFloors);\r\n table.system = new Array(floorCount);\r\n table.enemies = new Array(floorCount);\r\n table.traps = new Array(floorCount);\r\n table.items = new Array(floorCount);\r\n table.events = new Array(floorCount);\r\n table.shop = new Array(floorCount);\r\n for (let i = 0; i < floorCount; i++) {\r\n table.system[i] = [];\r\n table.enemies[i] = [];\r\n table.traps[i] = [];\r\n table.items[i] = [];\r\n table.events[i] = [];\r\n table.shop[i] = [];\r\n }\r\n for (const entity of table.entities) {\r\n const spawnInfo = entity.spawiInfo;\r\n for (let i = entity.startFloorNumber; i <= entity.lastFloorNumber; i++) {\r\n if (spawnInfo.troopId > 0) {\r\n table.enemies[i].push(entity); // troop は enemy と一緒にしてみる\r\n }\r\n else if (DEntityCategory_1.DEntityCategory.isMonster(spawnInfo.entityData())) {\r\n table.enemies[i].push(entity);\r\n }\r\n else if (DEntityCategory_1.DEntityCategory.isTrap(spawnInfo.entityData())) {\r\n table.traps[i].push(entity);\r\n }\r\n else if (DEntityCategory_1.DEntityCategory.isItem(spawnInfo.entityData())) {\r\n table.items[i].push(entity);\r\n }\r\n else {\r\n table.system[i].push(entity);\r\n }\r\n }\r\n }\r\n for (const event of eventList) {\r\n for (let i = event.startFloorNumber; i <= event.lastFloorNumber; i++) {\r\n table.events[i].push(event);\r\n }\r\n }\r\n return table;\r\n }\r\n static buildSubAppearanceTable(land, mapData, rmmzMapId, tableSet, table) {\r\n var _a;\r\n if (mapData.width != table.length) {\r\n throw new Error((0, Common_1.tr2)(\"%1に含まれる%2テーブルのマップサイズが一致していません。\").format(land.name, (_a = $dataMapInfos[rmmzMapId]) === null || _a === void 0 ? void 0 : _a.name));\r\n }\r\n (0, Common_1.assert)(tableSet.maxFloors == table.length);\r\n // まずは Entity を集計\r\n const entities = [];\r\n for (const event of mapData.events) {\r\n if (!event)\r\n continue;\r\n const x = event.x;\r\n const y = event.y;\r\n // @MR-Spawner\r\n const entityMetadata = DAnnotationReader_1.DAnnotationReader.readSpawnerAnnotationFromPage(event.pages[0]);\r\n if (entityMetadata) {\r\n const spawnInfo = DSpawner_1.DEntitySpawner.makeFromEventData(event, rmmzMapId);\r\n if (!spawnInfo) {\r\n throw new Error(`Entity \"${entityMetadata.entity}\" not found. (Map:${DHelper_1.DHelpers.makeRmmzMapDebugName(rmmzMapId)}, Event:${event.id}.${event.name})`);\r\n }\r\n const tableItem = {\r\n spawiInfo: spawnInfo,\r\n startFloorNumber: x,\r\n lastFloorNumber: x + DHelper_1.DHelpers.countSomeTilesRight_E(mapData, x, y),\r\n };\r\n entities.push(tableItem);\r\n }\r\n }\r\n for (let i = 0; i < tableSet.maxFloors; i++) {\r\n if (!table[i])\r\n table[i] = [];\r\n }\r\n for (const entity of entities) {\r\n tableSet.entities.push(entity);\r\n for (let i = entity.startFloorNumber; i <= entity.lastFloorNumber; i++) {\r\n table[i].push(entity);\r\n }\r\n }\r\n }\r\n}\r\nexports.DLand = DLand;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DLand.ts?"); /***/ }), /***/ "./ts/mr/data/DMap.ts": /*!****************************!*\ !*** ./ts/mr/data/DMap.ts ***! \****************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DMap = exports.REFloorMapKind = void 0;\r\nvar REFloorMapKind;\r\n(function (REFloorMapKind) {\r\n // データ定義用のマップ。ここへの遷移は禁止\r\n REFloorMapKind[REFloorMapKind[\"Land\"] = 0] = \"Land\";\r\n REFloorMapKind[REFloorMapKind[\"TemplateMap\"] = 1] = \"TemplateMap\";\r\n REFloorMapKind[REFloorMapKind[\"FixedMap\"] = 2] = \"FixedMap\";\r\n REFloorMapKind[REFloorMapKind[\"ShuffleMap\"] = 3] = \"ShuffleMap\";\r\n //RandomMap,\r\n})(REFloorMapKind = exports.REFloorMapKind || (exports.REFloorMapKind = {}));\r\n/**\r\n * マップデータ。RMMZ の MapInfo 相当で、その ID と一致する。\r\n * FloorInfo と似ているが、こちらは RMMZ Map に対する直接の追加情報を意味する。\r\n */\r\nclass DMap {\r\n constructor(id) {\r\n this.id = id;\r\n this.landId = 0;\r\n this.mapId = 0;\r\n this.mapKind = REFloorMapKind.FixedMap;\r\n this.exitMap = false;\r\n this.safetyMap = false;\r\n this.defaultSystem = false;\r\n this.eventMap = false;\r\n }\r\n get name() {\r\n const info = $dataMapInfos[this.mapId];\r\n if (!info)\r\n return \"\";\r\n return info.name;\r\n }\r\n}\r\nexports.DMap = DMap;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DMap.ts?"); /***/ }), /***/ "./ts/mr/data/DParameter.ts": /*!**********************************!*\ !*** ./ts/mr/data/DParameter.ts ***! \**********************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DParameter = exports.DParameterFlavorEffect = exports.DValueAddition = exports.DParamMessageValueSource = exports.DParameterType = void 0;\r\nconst DEffect_1 = __webpack_require__(/*! ./DEffect */ \"./ts/mr/data/DEffect.ts\");\r\nconst DFaction_1 = __webpack_require__(/*! ./DFaction */ \"./ts/mr/data/DFaction.ts\");\r\nconst DFlavorEffect_1 = __webpack_require__(/*! ./DFlavorEffect */ \"./ts/mr/data/DFlavorEffect.ts\");\r\nconst DHelper_1 = __webpack_require__(/*! ./DHelper */ \"./ts/mr/data/DHelper.ts\");\r\nvar DParameterType;\r\n(function (DParameterType) {\r\n DParameterType[DParameterType[\"Normal\"] = 0] = \"Normal\";\r\n DParameterType[DParameterType[\"Dependent\"] = 1] = \"Dependent\";\r\n})(DParameterType = exports.DParameterType || (exports.DParameterType = {}));\r\nvar DParamMessageValueSource;\r\n(function (DParamMessageValueSource) {\r\n DParamMessageValueSource[DParamMessageValueSource[\"Relative\"] = 0] = \"Relative\";\r\n DParamMessageValueSource[DParamMessageValueSource[\"Absolute\"] = 1] = \"Absolute\";\r\n})(DParamMessageValueSource = exports.DParamMessageValueSource || (exports.DParamMessageValueSource = {}));\r\nvar DValueAddition;\r\n(function (DValueAddition) {\r\n /** 増減なし・効果なし */\r\n DValueAddition[DValueAddition[\"None\"] = 0] = \"None\";\r\n /** 増加・回復 */\r\n DValueAddition[DValueAddition[\"Gain\"] = 1] = \"Gain\";\r\n /** 減少・ダメージ */\r\n DValueAddition[DValueAddition[\"Loss\"] = 2] = \"Loss\";\r\n})(DValueAddition = exports.DValueAddition || (exports.DValueAddition = {}));\r\n/**\r\n * 発動する FlavorEffect と、その発動条件のセット\r\n */\r\nclass DParameterFlavorEffect {\r\n constructor(options) {\r\n this.looksFaction = DFaction_1.DFactionType.Neutral;\r\n this.point = DEffect_1.DValuePoint.Actual;\r\n this.addition = DValueAddition.Loss;\r\n options = options || { flavorEffect: {} };\r\n if (options.point) {\r\n this.point = DHelper_1.DHelpers.stringToEnum(options.point, {\r\n \"actual\": DEffect_1.DValuePoint.Actual,\r\n \"growth\": DEffect_1.DValuePoint.Growth,\r\n \"_\": DEffect_1.DValuePoint.Actual,\r\n });\r\n }\r\n if (options.addition) {\r\n this.addition = DHelper_1.DHelpers.stringToEnum(options.addition, {\r\n \"none\": DValueAddition.None,\r\n \"loss\": DValueAddition.Loss,\r\n \"gain\": DValueAddition.Gain,\r\n \"_\": DValueAddition.Loss,\r\n });\r\n }\r\n if (options.looksFaction) {\r\n this.looksFaction = DHelper_1.DHelpers.stringToEnum(options.looksFaction, {\r\n \"neutral\": DFaction_1.DFactionType.Neutral,\r\n \"friendly\": DFaction_1.DFactionType.Friendly,\r\n \"hostile\": DFaction_1.DFactionType.Hostile,\r\n \"_\": DFaction_1.DFactionType.Neutral,\r\n });\r\n }\r\n this.conditionFormula = options.conditionFormula;\r\n this.flavorEffect = new DFlavorEffect_1.DFlavorEffect(options.flavorEffect);\r\n }\r\n}\r\nexports.DParameterFlavorEffect = DParameterFlavorEffect;\r\n/**\r\n * Unit(Battler) が持つパラメータ\r\n *\r\n * Property との違いは、戦闘ダメージなどに関係するものを集めたものである、という点。すべて number で表される。\r\n *\r\n * 拡張パラメータ\r\n * ----------\r\n * 拡張パラメータはレベルアップに伴い成長することは '無い'。\r\n * 最低限必要なのは \"満腹度\"。\r\n *\r\n * サバイバル的な拡張を想定すると、\r\n * - 水分\r\n * - 疲労度\r\n *\r\n * あとこれらのターン経過による増減量を決めるためのパラメータ。\r\n *\r\n * - ハラヘリ速度 (SParam) ※SParam は非ダメ側のパラメータと考えるのが良い。ターン経過で World から受ける満腹度へのダメージを抑える、と考える。\r\n * - HP 回復速度 (SParam)\r\n *\r\n *\r\n * [2022/9/2] SecondaryParameter\r\n * ----------\r\n * DependentParameter 検討中に見つかった問題解決。\r\n * DependentParameter は当初、DParameter とは別のデータ構造として作った。\r\n * しかし運用を始めた時に、2つの異なるデータとして分けなければならないのが面倒だと感じた。というより、間違えやすい。\r\n *\r\n * 例えば\r\n * - 特定のパラメータに対する攻撃をガードする\r\n * - 特定のパラメータに対する攻撃を固定ダメージ化する\r\n * - 特定のパラメータに対する攻撃によって、ステートの解除判定を行う\r\n * - 特定のパラメータに対するバフ\r\n * - メッセージその他…\r\n *\r\n * データとしては別物であるが、運用上は同じものとして扱いたい。\r\n * そうしないと、どのパラメータがどのパラメータに依存しているのか、というのを把握するのが難しくなる。\r\n *\r\n *\r\n *\r\n *\r\n * [2021/5/17] パラメータは誰が持つ?(特に拡張パラメータ)\r\n * ----------\r\n * HPと満腹度。\r\n * Entity に持たせるか、BattlerBehavior と SurvivorBehavior に分けて持たせるか。\r\n *\r\n * ひとまずは BattlerBehavior でいいかな… 明確に分ける理由が無い。メモリ使用量くらい。\r\n * 拡張パラメータも含め、すべてのパラメータは \"ダメージ計算処理\" が適用される仕組みになるので、\r\n * その辺が共通化できる BattlerBehavior に持たせるのが都合いいかも。\r\n *\r\n *\r\n *\r\n * [2021/5/16]\r\n * ----------\r\n * エディタからの任意パラメータ追加はいったん見送ろう。\r\n * まだシステムがばっちり固まってるわけじゃないので、仕様が決めきれない。\r\n *\r\n * 一応のアイデアとしては、パラメータが 0 になったら何かステートを付加して、ペナルティはそっちで付ける、とか。\r\n *\r\n *\r\n */\r\nclass DParameter {\r\n constructor(id, key, displayName) {\r\n this.magnification = 1;\r\n /** @deprecated */\r\n this.friendlySideMessages = [];\r\n /** @deprecated */\r\n this.opponentSideMessages = [];\r\n // Friendly, Hostile に登録されたものが無い場合、 Natual にフォールバックする。\r\n // Natual に登録済みのものを再生したくない場合、FlavorEffect が空である DParameterFlavorEffect を登録する。\r\n //private _parameterFlavorEffects: (DParameterFlavorEffect | undefined)[][] = [];\r\n this.parameterFlavorEffects = [];\r\n // ダメージ禁止。つまり、 setParamActual を禁止する。\r\n this.allowDamage = true;\r\n this.id = id;\r\n this.key = key;\r\n this.code = key;\r\n this.type = DParameterType.Normal;\r\n this.displayName = displayName;\r\n this.displayNameMaximum = displayName;\r\n this.battlerParamId = -1;\r\n this.initialIdealValue = 100;\r\n this.minEffortLimit = 0;\r\n this.maxEffortLimit = Infinity;\r\n this.minLimit = 0;\r\n this.maxLimit = Infinity;\r\n this.addBuffCoe = 100;\r\n this.mulBuffCore = 0.25;\r\n this.messageValueSource = DParamMessageValueSource.Relative;\r\n this.recoverTarget = true;\r\n // this.selfDamageMessage = DTextManager.actorDamage;\r\n // this.targetDamageMessage = DTextManager.enemyDamage;\r\n // this.selfDamageRecovery = DTextManager.actorRecovery;\r\n // this.targetDamageRecovery = DTextManager.enemyRecovery;\r\n this.parameterFlavorEffects = [];\r\n // this._parameterFlavorEffects[DFuctionType.Neutral] = [];\r\n // this._parameterFlavorEffects[DFuctionType.Friendly] = [];\r\n // this._parameterFlavorEffects[DFuctionType.Hostile] = [];\r\n }\r\n static makeBuiltin(id, code, displayName, displayNameMaximun, battlerParamId, initialIdealValue, minLimit, maxLimit, recoverTarget) {\r\n const p = new DParameter(id, code, displayName);\r\n p.displayNameMaximum = displayNameMaximun;\r\n p.battlerParamId = battlerParamId;\r\n p.initialIdealValue = initialIdealValue;\r\n p.minLimit = minLimit;\r\n p.maxLimit = maxLimit;\r\n p.recoverTarget = recoverTarget;\r\n return p;\r\n }\r\n makeDisplayValue(value) {\r\n return value * this.magnification;\r\n }\r\n getParameterFlavorEffectByLooksFaction(value) {\r\n const effects = this.parameterFlavorEffects.filter(e => e.looksFaction === value);\r\n return effects;\r\n }\r\n // public flavorEffects(factionType: DFuctionType): DParameterFlavorEffect[] {\r\n // return this._parameterFlavorEffects[factionType];\r\n // }\r\n // public addFlavorEffects(factionType: DFuctionType, value: DParameterFlavorEffect): void {\r\n // this._parameterFlavorEffects[factionType].push(value);\r\n // }\r\n // public clearFlavorEffects(factionType: DFuctionType): void {\r\n // this._parameterFlavorEffects[factionType] = [];\r\n // }\r\n addFlavorEffect(options) {\r\n const data = new DParameterFlavorEffect(options);\r\n this.parameterFlavorEffects.push(data);\r\n return data;\r\n }\r\n addTextFlavorEffect(looksFaction, applyTarget, addition, text) {\r\n const p = new DParameterFlavorEffect();\r\n p.flavorEffect = new DFlavorEffect_1.DFlavorEffect();\r\n p.flavorEffect.text = [text];\r\n p.looksFaction = looksFaction;\r\n p.point = applyTarget;\r\n p.addition = addition;\r\n this.parameterFlavorEffects.push(p);\r\n return p;\r\n }\r\n}\r\nexports.DParameter = DParameter;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DParameter.ts?"); /***/ }), /***/ "./ts/mr/data/DPrefab.ts": /*!*******************************!*\ !*** ./ts/mr/data/DPrefab.ts ***! \*******************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DPrefab = exports.DPrefabMoveType = exports.DSystemPrefabKind = void 0;\r\nvar DSystemPrefabKind;\r\n(function (DSystemPrefabKind) {\r\n DSystemPrefabKind[DSystemPrefabKind[\"Unknown\"] = 0] = \"Unknown\";\r\n DSystemPrefabKind[DSystemPrefabKind[\"EntryPoint\"] = 1] = \"EntryPoint\";\r\n DSystemPrefabKind[DSystemPrefabKind[\"ExitPoint\"] = 2] = \"ExitPoint\";\r\n})(DSystemPrefabKind = exports.DSystemPrefabKind || (exports.DSystemPrefabKind = {}));\r\n;\r\nvar DPrefabMoveType;\r\n(function (DPrefabMoveType) {\r\n DPrefabMoveType[DPrefabMoveType[\"Fix\"] = 0] = \"Fix\";\r\n DPrefabMoveType[DPrefabMoveType[\"Random\"] = 1] = \"Random\";\r\n})(DPrefabMoveType = exports.DPrefabMoveType || (exports.DPrefabMoveType = {}));\r\n/**\r\n * プレハブデータ\r\n */\r\nclass DPrefab {\r\n constructor(id, key) {\r\n this.id = id;\r\n this.key = key;\r\n this.image = {\r\n characterName: \"\",\r\n direction: 2,\r\n pattern: 0,\r\n characterIndex: 0,\r\n directionFix: false,\r\n stepAnime: false,\r\n walkAnime: false,\r\n };\r\n this.subPages = [];\r\n this.scripts = [];\r\n this.stateImages = [];\r\n this.downImage = {};\r\n this.moveType = DPrefabMoveType.Random;\r\n this.rmmzMapId = 0;\r\n this.rmmzEventData = {\r\n id: 0,\r\n name: \"null\",\r\n note: \"\",\r\n pages: [\r\n {\r\n conditions: {\r\n actorId: 1,\r\n actorValid: false,\r\n itemId: 1,\r\n itemValid: false,\r\n selfSwitchCh: \"A\",\r\n selfSwitchValid: false,\r\n switch1Id: 1,\r\n switch1Valid: false,\r\n switch2Id: 1,\r\n switch2Valid: false,\r\n variableId: 1,\r\n variableValid: false,\r\n variableValue: 1,\r\n },\r\n directionFix: false,\r\n image: {\r\n tileId: 0,\r\n characterName: \"\",\r\n direction: 2,\r\n pattern: 0,\r\n characterIndex: 1\r\n },\r\n list: [],\r\n moveFrequency: 3,\r\n moveRoute: {\r\n list: [],\r\n repeat: true,\r\n skippable: false,\r\n wait: false,\r\n },\r\n moveSpeed: 3,\r\n moveType: 0,\r\n priorityType: 1,\r\n stepAnime: false,\r\n through: false,\r\n trigger: 0,\r\n walkAnime: true,\r\n }\r\n ],\r\n x: 0,\r\n y: 0,\r\n };\r\n ;\r\n }\r\n}\r\nexports.DPrefab = DPrefab;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DPrefab.ts?"); /***/ }), /***/ "./ts/mr/data/DPseudonymous.ts": /*!*************************************!*\ !*** ./ts/mr/data/DPseudonymous.ts ***! \*************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DPseudonymous = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ./MRData */ \"./ts/mr/data/MRData.ts\");\r\nclass DPseudonymous {\r\n constructor() {\r\n this._names = [];\r\n }\r\n setup(data) {\r\n const list = data;\r\n for (const e of list) {\r\n const kind = MRData_1.MRData.getEntityCategory(e.kind);\r\n this._names[kind.id] = { names: e.names };\r\n }\r\n }\r\n kinds() {\r\n const result = [];\r\n for (let i = 0; i < this._names.length; i++) {\r\n if (this._names[i]) {\r\n result.push(MRData_1.MRData.categories[i]);\r\n }\r\n }\r\n return result;\r\n }\r\n nameList(kindId) {\r\n const e = this._names[kindId];\r\n if (e)\r\n return e.names;\r\n else\r\n return undefined;\r\n }\r\n getNameList(kindId) {\r\n const list = this.nameList(kindId);\r\n (0, Common_1.assert)(list);\r\n return list;\r\n }\r\n}\r\nexports.DPseudonymous = DPseudonymous;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DPseudonymous.ts?"); /***/ }), /***/ "./ts/mr/data/DQuest.ts": /*!******************************!*\ !*** ./ts/mr/data/DQuest.ts ***! \******************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DQuestClass = exports.DQuestTask = exports.DQuest = void 0;\r\nclass DQuest {\r\n constructor(id, key) {\r\n this.id = id;\r\n this.key = key;\r\n this.tasks = [];\r\n this.questClass = DQuestClass.Normal;\r\n this.title = \"null\";\r\n }\r\n}\r\nexports.DQuest = DQuest;\r\nclass DQuestTask {\r\n constructor(id, key) {\r\n this.id = id;\r\n this.key = key;\r\n }\r\n}\r\nexports.DQuestTask = DQuestTask;\r\nvar DQuestClass;\r\n(function (DQuestClass) {\r\n /** イベントによって開始を制御する。通常、ゲーム中、一度しか発生しない。 */\r\n DQuestClass[DQuestClass[\"Normal\"] = 0] = \"Normal\";\r\n /** タイミングによって抽選される。デイリークエストや街の掲示板など。 */\r\n DQuestClass[DQuestClass[\"Random\"] = 1] = \"Random\";\r\n})(DQuestClass = exports.DQuestClass || (exports.DQuestClass = {}));\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DQuest.ts?"); /***/ }), /***/ "./ts/mr/data/DRace.ts": /*!*****************************!*\ !*** ./ts/mr/data/DRace.ts ***! \*****************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DRace = void 0;\r\nclass DRace {\r\n constructor(id) {\r\n this.id = id;\r\n this.key = \"\";\r\n this.name = \"\";\r\n this.traits = [];\r\n }\r\n}\r\nexports.DRace = DRace;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DRace.ts?"); /***/ }), /***/ "./ts/mr/data/DScript.ts": /*!*******************************!*\ !*** ./ts/mr/data/DScript.ts ***! \*******************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DScript = void 0;\r\n// イベントページ1つ分に相当する\r\nclass DScript {\r\n constructor(list) {\r\n this.list = list;\r\n }\r\n}\r\nexports.DScript = DScript;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DScript.ts?"); /***/ }), /***/ "./ts/mr/data/DSkill.ts": /*!******************************!*\ !*** ./ts/mr/data/DSkill.ts ***! \******************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DSkill = exports.DSkillClass = void 0;\r\nconst DEffect_1 = __webpack_require__(/*! ./DEffect */ \"./ts/mr/data/DEffect.ts\");\r\nconst DFlavorEffect_1 = __webpack_require__(/*! ./DFlavorEffect */ \"./ts/mr/data/DFlavorEffect.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ./MRData */ \"./ts/mr/data/MRData.ts\");\r\nvar DSkillClass;\r\n(function (DSkillClass) {\r\n DSkillClass[DSkillClass[\"Major\"] = 0] = \"Major\";\r\n DSkillClass[DSkillClass[\"Minor\"] = 1] = \"Minor\";\r\n})(DSkillClass = exports.DSkillClass || (exports.DSkillClass = {}));\r\nclass DSkill {\r\n constructor(id, key) {\r\n this.priority = 0;\r\n // NOTE: こちらは主にスキル発動の message を持つためのものであるため、DEmittor が持つものとは区別している。\r\n this.skillClass = DSkillClass.Major;\r\n this.id = id,\r\n this.key = key;\r\n this.name = \"null\";\r\n this.isActivity = false;\r\n this.rmmzEffectScope = DEffect_1.DRmmzEffectScope.None;\r\n //effectSet: new DEffectSet(),\r\n this.emittorId = 0;\r\n this.flavorEffect = undefined;\r\n }\r\n emittor() {\r\n return MRData_1.MRData.getEmittorById(this.emittorId);\r\n }\r\n setFlavorEffect(options) {\r\n this.flavorEffect = new DFlavorEffect_1.DFlavorEffect(options);\r\n }\r\n applyProps(props) {\r\n if (props.flavorEffect) {\r\n this.setFlavorEffect(props.flavorEffect);\r\n }\r\n }\r\n}\r\nexports.DSkill = DSkill;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DSkill.ts?"); /***/ }), /***/ "./ts/mr/data/DSpawner.ts": /*!********************************!*\ !*** ./ts/mr/data/DSpawner.ts ***! \********************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DUniqueSpawnerMoveType = exports.DEntitySpawner = exports.DEntityCreateInfo = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst DHelper_1 = __webpack_require__(/*! ./DHelper */ \"./ts/mr/data/DHelper.ts\");\r\nconst DValidationHelper_1 = __webpack_require__(/*! ./DValidationHelper */ \"./ts/mr/data/DValidationHelper.ts\");\r\nconst DAnnotationReader_1 = __webpack_require__(/*! ./importers/DAnnotationReader */ \"./ts/mr/data/importers/DAnnotationReader.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ./MRData */ \"./ts/mr/data/MRData.ts\");\r\n// こっちは Entity 単体の生成引数\r\nclass DEntityCreateInfo {\r\n constructor() {\r\n //this.troopId = 0;\r\n this.entityId = 0;\r\n this.stateIds = [];\r\n this.debugName = \"\";\r\n this.stackCount = undefined;\r\n this.override = false;\r\n this.gold = 0;\r\n }\r\n static makeSingle(entityId, stateIds, debugName) {\r\n const data = new DEntityCreateInfo();\r\n data.entityId = entityId;\r\n if (stateIds)\r\n data.stateIds = stateIds;\r\n if (debugName)\r\n data.debugName = debugName;\r\n return data;\r\n }\r\n withStackCount(value) {\r\n this.stackCount = value;\r\n return this;\r\n }\r\n}\r\nexports.DEntityCreateInfo = DEntityCreateInfo;\r\n// こっちは Event の metadata としての情報\r\nclass DEntitySpawner extends DEntityCreateInfo {\r\n constructor(entityId, troopId) {\r\n super();\r\n this.entityId = entityId;\r\n this.troopId = troopId;\r\n this.overrideEvent = undefined;\r\n this.keeper = false;\r\n this.rate = 100;\r\n //this.entityId = 0;\r\n //this.stateIds = [];\r\n this.mx = 0;\r\n this.my = 0;\r\n this.moveType = DUniqueSpawnerMoveType.Default;\r\n this.overrideRmmzEventMapId = 0;\r\n this.overrideRmmzEventId = 0;\r\n }\r\n static makeFromAnnotation(data) {\r\n const spawner = new DEntitySpawner(MRData_1.MRData.getEntity(data.entityKey).id, 0);\r\n spawner.moveType = DHelper_1.DHelpers.stringToEnum(data.moveType, {\r\n \"_\": DUniqueSpawnerMoveType.Default,\r\n \"Homecoming\": DUniqueSpawnerMoveType.Homecoming,\r\n });\r\n return spawner;\r\n }\r\n static makeFromEventData(event, rmmzMapId) {\r\n return this.makeFromEventPageData(event, event.pages[0], rmmzMapId);\r\n }\r\n static makeFromEventPageData(event, page, rmmzMapId) {\r\n var _a, _b;\r\n const entityMetadata = DAnnotationReader_1.DAnnotationReader.readSpawnerAnnotationFromPage(page);\r\n if (!entityMetadata)\r\n return undefined;\r\n const entityId = MRData_1.MRData.entities.findIndex(x => x.entity.key == entityMetadata.entity);\r\n const troopId = entityMetadata.troopId;\r\n const spawner = new DEntitySpawner(entityId, troopId);\r\n spawner.stackCount = entityMetadata.stackCount;\r\n spawner.override = entityMetadata.override;\r\n spawner.gold = entityMetadata.gold;\r\n spawner.overrideEvent = entityMetadata.overrideEvent ? event : undefined;\r\n spawner.keeper = (_a = entityMetadata.keeper) !== null && _a !== void 0 ? _a : false;\r\n spawner.xName = entityMetadata.entity;\r\n spawner.rate = (_b = entityMetadata.rate) !== null && _b !== void 0 ? _b : 100;\r\n spawner.displayName = entityMetadata.name;\r\n spawner.reactions = entityMetadata.reactions;\r\n if (entityMetadata.entity != \"\" && spawner.entityId <= 0) {\r\n throw new Error((0, Common_1.tr2)(\"@MR-Spawner で指定された Entity Key '%1' が存在しません。 %2 %3\").format(entityMetadata.entity, DValidationHelper_1.DValidationHelper.makeRmmzMapName(rmmzMapId), DValidationHelper_1.DValidationHelper.makeRmmzEventName(event)));\r\n }\r\n for (const stateKey of entityMetadata.states) {\r\n const index = MRData_1.MRData.states.findIndex(s => s.key == stateKey);\r\n if (index > 0) {\r\n spawner.stateIds.push(index);\r\n }\r\n else {\r\n throw new Error(`State \"${stateKey}\" not found.`);\r\n }\r\n }\r\n return spawner;\r\n }\r\n entityData() {\r\n (0, Common_1.assert)(this.entityId > 0);\r\n return MRData_1.MRData.entities[this.entityId];\r\n }\r\n}\r\nexports.DEntitySpawner = DEntitySpawner;\r\nvar DUniqueSpawnerMoveType;\r\n(function (DUniqueSpawnerMoveType) {\r\n DUniqueSpawnerMoveType[DUniqueSpawnerMoveType[\"Default\"] = 0] = \"Default\";\r\n DUniqueSpawnerMoveType[DUniqueSpawnerMoveType[\"Homecoming\"] = 1] = \"Homecoming\";\r\n})(DUniqueSpawnerMoveType = exports.DUniqueSpawnerMoveType || (exports.DUniqueSpawnerMoveType = {}));\r\n/**\r\n * @MR-UniqueSpawner の情報。\r\n * マップに遷移したときにインスタンスを作成する。\r\n */\r\n// export class DUniqueSpawner {\r\n// public readonly entityId: DEntityId;\r\n// public mx: number;\r\n// public my: number;\r\n// public moveType: DUniqueSpawnerMoveType;\r\n// public overrideRmmzEventMapId: number; // Override している RMMZ のイベントがあるマップ ID。変なイベントを参照しないよう、ガードをかけるために使う。\r\n// public overrideRmmzEventId: number; \r\n// public static makeFromAnnotation(data: DRmmzUniqueSpawnerAnnotation): DUniqueSpawner {\r\n// const spawner = new DUniqueSpawner(MRData.getEntity(data.entityKey).id);\r\n// spawner.moveType = DHelpers.stringToEnum(data.moveType, {\r\n// \"_\": DUniqueSpawnerMoveType.Default,\r\n// \"Homecoming\": DUniqueSpawnerMoveType.Homecoming,\r\n// });\r\n// return spawner;\r\n// }\r\n// public constructor(entityId: DEntityId) {\r\n// this.entityId = entityId;\r\n// this.mx = 0;\r\n// this.my = 0;\r\n// this.moveType = DUniqueSpawnerMoveType.Default;\r\n// this.overrideRmmzEventMapId = 0;\r\n// this.overrideRmmzEventId = 0;\r\n// }\r\n// }\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DSpawner.ts?"); /***/ }), /***/ "./ts/mr/data/DSpecialEffect.ts": /*!**************************************!*\ !*** ./ts/mr/data/DSpecialEffect.ts ***! \**************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DSpecialEffect = void 0;\r\nconst MRData_1 = __webpack_require__(/*! ./MRData */ \"./ts/mr/data/MRData.ts\");\r\nclass DSpecialEffect {\r\n constructor(id, key) {\r\n this.id = id;\r\n this.key = key;\r\n }\r\n static makeSpecialEffectRef(props) {\r\n const id = MRData_1.MRData.getSpecialEffect(props.code).id;\r\n switch (props.code) {\r\n case \"RandomWarp\":\r\n return { specialEffectId: id, entityId: 0, dataId: 0, value: 0 };\r\n case \"AddState\":\r\n return { specialEffectId: id, entityId: 0, dataId: MRData_1.MRData.getState(props.stateKey).id, value: props.chance };\r\n case \"RemoveState\":\r\n return { specialEffectId: id, entityId: 0, dataId: MRData_1.MRData.getState(props.stateKey).id, value: props.chance };\r\n case \"Unknown\":\r\n return { specialEffectId: id, entityId: 0, dataId: props.dataKey, value: props.value };\r\n default:\r\n throw new Error(`SpecialEffect code \"${props.code}\" unsupported.`);\r\n }\r\n }\r\n}\r\nexports.DSpecialEffect = DSpecialEffect;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DSpecialEffect.ts?"); /***/ }), /***/ "./ts/mr/data/DState.ts": /*!******************************!*\ !*** ./ts/mr/data/DState.ts ***! \******************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.makeStateBehaviorsFromMeta = exports.DState = exports.DStateIntentions = exports.DStateEffect = exports.DStateRestriction = exports.DAutoRemovalTiming = void 0;\r\nvar DAutoRemovalTiming;\r\n(function (DAutoRemovalTiming) {\r\n /** [RMMZ] なし */\r\n DAutoRemovalTiming[DAutoRemovalTiming[\"None\"] = 0] = \"None\";\r\n /** [RMMZ] 行動終了時 */\r\n DAutoRemovalTiming[DAutoRemovalTiming[\"AfterAction\"] = 1] = \"AfterAction\";\r\n /** [RMMZ] ターン終了時 */\r\n DAutoRemovalTiming[DAutoRemovalTiming[\"TurnEnd\"] = 2] = \"TurnEnd\";\r\n DAutoRemovalTiming[DAutoRemovalTiming[\"ActualParam\"] = 3] = \"ActualParam\";\r\n /** ダメージを \"与えようとされたか\" */\r\n DAutoRemovalTiming[DAutoRemovalTiming[\"DamageTesting\"] = 4] = \"DamageTesting\";\r\n DAutoRemovalTiming[DAutoRemovalTiming[\"FloorTransfer\"] = 5] = \"FloorTransfer\";\r\n})(DAutoRemovalTiming = exports.DAutoRemovalTiming || (exports.DAutoRemovalTiming = {}));\r\nvar DStateRestriction;\r\n(function (DStateRestriction) {\r\n DStateRestriction[DStateRestriction[\"None\"] = 0] = \"None\";\r\n /** [RMMZ] 敵を攻撃 */\r\n DStateRestriction[DStateRestriction[\"AttcakToOpponent\"] = 1] = \"AttcakToOpponent\";\r\n /** [RMMZ] 誰かを攻撃 */\r\n DStateRestriction[DStateRestriction[\"AttackToOther\"] = 2] = \"AttackToOther\";\r\n /** [RMMZ] 味方を攻撃 */\r\n DStateRestriction[DStateRestriction[\"AttcakToFriend\"] = 3] = \"AttcakToFriend\";\r\n /** [RMMZ] 行動できない */\r\n DStateRestriction[DStateRestriction[\"NotAction\"] = 4] = \"NotAction\";\r\n /** 暗闇 */\r\n DStateRestriction[DStateRestriction[\"Blind\"] = 5] = \"Blind\";\r\n})(DStateRestriction = exports.DStateRestriction || (exports.DStateRestriction = {}));\r\n(function (DStateRestriction) {\r\n function fromRmmzRestriction(value) {\r\n switch (value) {\r\n case 0:\r\n return DStateRestriction.None;\r\n case 1:\r\n return DStateRestriction.AttcakToOpponent;\r\n case 2:\r\n return DStateRestriction.AttackToOther;\r\n case 3:\r\n return DStateRestriction.AttcakToFriend;\r\n case 4:\r\n return DStateRestriction.NotAction;\r\n default:\r\n throw new Error(\"Unreachable.\");\r\n }\r\n }\r\n DStateRestriction.fromRmmzRestriction = fromRmmzRestriction;\r\n})(DStateRestriction = exports.DStateRestriction || (exports.DStateRestriction = {}));\r\nclass DStateEffect {\r\n constructor() {\r\n this.matchConditions = { kindId: 0 };\r\n this.restriction = 0;\r\n this.traits = [];\r\n this.behaviors = [];\r\n this.autoRemovals = [];\r\n this.damageRemovels = [];\r\n }\r\n}\r\nexports.DStateEffect = DStateEffect;\r\nvar DStateIntentions;\r\n(function (DStateIntentions) {\r\n DStateIntentions[DStateIntentions[\"None\"] = 0] = \"None\";\r\n DStateIntentions[DStateIntentions[\"Positive\"] = 1] = \"Positive\";\r\n DStateIntentions[DStateIntentions[\"Negative\"] = 2] = \"Negative\";\r\n})(DStateIntentions = exports.DStateIntentions || (exports.DStateIntentions = {}));\r\nclass DState {\r\n constructor(id) {\r\n this.id = id;\r\n this.displayName = \"\";\r\n this.key = \"\";\r\n this.iconIndex = 0;\r\n this.displayNameIcon = false;\r\n //this.autoRemovalTiming = DAutoRemovalTiming.None;\r\n //this.minTurns = 0;\r\n //this.maxTurns = 0;\r\n this.intentions = DStateIntentions.None;\r\n this.priority = 0;\r\n this.message1 = \"\";\r\n this.message2 = \"\";\r\n this.message3 = \"\";\r\n this.message4 = \"\";\r\n this.stateGroupKeys = [];\r\n this.stateGroupIds = [];\r\n this.deadState = false; //(id == 1);\r\n //this.minBuffLevel = -2;\r\n //this.maxBuffLevel = 2;\r\n //this.parameterBuffFormulas = [];\r\n this.autoAdditionCondition = undefined;\r\n this.effect = new DStateEffect();\r\n this.submatchStates = [];\r\n this.idleSequel = 0;\r\n this.applyConditions = {\r\n kindIds: [],\r\n };\r\n }\r\n import(data) {\r\n if (data.meta) {\r\n {\r\n const raws = data.meta[\"MR-StateGroup\"];\r\n if (raws) {\r\n const keys = (raws instanceof Array) ? raws : [raws];\r\n this.stateGroupKeys = keys.map(x => x.trim());\r\n }\r\n }\r\n }\r\n switch (data.autoRemovalTiming) {\r\n case 0: // None\r\n break;\r\n case 1: // AfterAction\r\n this.effect.autoRemovals.push({ kind: DAutoRemovalTiming.AfterAction });\r\n break;\r\n case 2: // TurnEnd\r\n this.effect.autoRemovals.push({\r\n kind: DAutoRemovalTiming.TurnEnd,\r\n minTurns: data.minTurns,\r\n maxTurns: data.maxTurns,\r\n });\r\n break;\r\n default:\r\n throw new Error(\"Unreachable.\");\r\n }\r\n }\r\n}\r\nexports.DState = DState;\r\n// TODO: parseConstructionExpr 使った方がいいかも\r\n/** @deprecated */\r\nfunction makeStateBehaviorsFromMeta(meta) {\r\n const b = meta[\"MR-Behavior\"];\r\n if (b) {\r\n if (b instanceof Array) {\r\n return b.map(x => x.trim());\r\n }\r\n else {\r\n return [b.trim()];\r\n }\r\n }\r\n return [];\r\n}\r\nexports.makeStateBehaviorsFromMeta = makeStateBehaviorsFromMeta;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DState.ts?"); /***/ }), /***/ "./ts/mr/data/DStateGroup.ts": /*!***********************************!*\ !*** ./ts/mr/data/DStateGroup.ts ***! \***********************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DStateGroup = void 0;\r\nclass DStateGroup {\r\n constructor(id) {\r\n this.id = id;\r\n this.name = \"\";\r\n this.key = \"\";\r\n this.exclusive = false;\r\n }\r\n}\r\nexports.DStateGroup = DStateGroup;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DStateGroup.ts?"); /***/ }), /***/ "./ts/mr/data/DSystem.ts": /*!*******************************!*\ !*** ./ts/mr/data/DSystem.ts ***! \*******************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DSystem = exports.DFovSystem = void 0;\r\nconst DFlavorEffect_1 = __webpack_require__(/*! ./DFlavorEffect */ \"./ts/mr/data/DFlavorEffect.ts\");\r\nconst DSkill_1 = __webpack_require__(/*! ./DSkill */ \"./ts/mr/data/DSkill.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ./MRData */ \"./ts/mr/data/MRData.ts\");\r\nvar DFovSystem;\r\n(function (DFovSystem) {\r\n DFovSystem[\"RoomBounds\"] = \"RoomBounds\";\r\n // https://www.albertford.com/shadowcasting/\r\n DFovSystem[\"SymmetricShadowcast\"] = \"SymmetricShadowcast\";\r\n})(DFovSystem = exports.DFovSystem || (exports.DFovSystem = {}));\r\n/**\r\n * MR システムをの基本的な動作に必要な定義済みデータを管理します。\r\n */\r\nclass DSystem {\r\n constructor() {\r\n this.floorRoundLimit = 1000;\r\n this.fovSystem = DFovSystem.RoomBounds; //DFovSystem.SymmetricShadowcast;//\r\n //this.elements = $dataSystem.elements ?? [];\r\n this.factions = {\r\n player: 1,\r\n enemy: 2,\r\n neutral: 3,\r\n };\r\n this.trapTargetFactionId = this.factions.player;\r\n this.skills = {\r\n wait: 0,\r\n move: 0,\r\n escape: 0,\r\n normalAttack: 0,\r\n };\r\n this.states = {\r\n bless: 0,\r\n curse: 0,\r\n seal: 0,\r\n plating: 0,\r\n };\r\n this.fallbackEnemyEntityId = 0;\r\n this.fallbackItemEntityId = 0;\r\n this.fallbackGoldEntityId = 0;\r\n //this.fallbackTrapEntityId = 0;\r\n this.initialPartyMembers = [];\r\n this.bareHandsFlavorEffect = new DFlavorEffect_1.DFlavorEffect();\r\n this.bareHandsFlavorEffect.rmmzAnimationId = 1;\r\n }\r\n link(testMode) {\r\n const bless = MRData_1.MRData.getState(\"kState_System_Bless\");\r\n const curse = MRData_1.MRData.getState(\"kState_System_Curse\");\r\n const seal = MRData_1.MRData.getState(\"kState_System_Seal\");\r\n bless.displayNameIcon = true;\r\n curse.displayNameIcon = true;\r\n seal.displayNameIcon = true;\r\n this.skills.wait = MRData_1.MRData.getSkill(\"kSkill_System_Wait\").id;\r\n this.skills.move = MRData_1.MRData.getSkill(\"kSkill_System_Move\").id;\r\n this.skills.escape = MRData_1.MRData.getSkill(\"kSkill_System_Escape\").id;\r\n this.skills.normalAttack = MRData_1.MRData.getSkill(\"kSkill_System_NormalAttack\").id;\r\n MRData_1.MRData.skills[this.skills.wait].skillClass = DSkill_1.DSkillClass.Minor;\r\n MRData_1.MRData.skills[this.skills.move].skillClass = DSkill_1.DSkillClass.Minor;\r\n MRData_1.MRData.skills[this.skills.escape].skillClass = DSkill_1.DSkillClass.Minor;\r\n this.states.bless = bless.id;\r\n this.states.curse = curse.id;\r\n this.states.seal = seal.id;\r\n this.states.plating = MRData_1.MRData.getState(\"kState_System_Plating\").id;\r\n this.fallbackEnemyEntityId = MRData_1.MRData.getEnemy(\"kEntity_スライムA\").entityId;\r\n this.fallbackItemEntityId = MRData_1.MRData.getItem(\"kEntity_雑草A\").id;\r\n this.fallbackGoldEntityId = MRData_1.MRData.getItem(\"kEntity_GoldA\").id;\r\n //this.fallbackTrapEntityId = REData.getItem(\"kEntity_トラバサミA\").id;\r\n for (let i = 1; i < MRData_1.MRData.enemies.length; i++) {\r\n const data = MRData_1.MRData.enemyData(i);\r\n for (const item of data.dropItems) {\r\n if (item.gold > 0 && item.entityId == 0) {\r\n item.entityId = this.fallbackGoldEntityId;\r\n }\r\n }\r\n }\r\n }\r\n static getQuestMarkerIcon(key) {\r\n switch (key) {\r\n case \"kQuestMarkerIcon_Normal\":\r\n return 320;\r\n case \"kQuestMarkerIcon_Main\":\r\n return 321;\r\n case \"kQuestMarkerIcon_Combat\":\r\n return 322;\r\n case \"kQuestMarkerIcon_Collect\":\r\n return 323;\r\n case \"kQuestMarkerIcon_Explore\":\r\n return 322;\r\n default:\r\n return 0;\r\n }\r\n }\r\n}\r\nexports.DSystem = DSystem;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DSystem.ts?"); /***/ }), /***/ "./ts/mr/data/DTemplateMap.ts": /*!************************************!*\ !*** ./ts/mr/data/DTemplateMap.ts ***! \************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DTemplateMap = exports.DBlockVisualPart = exports.DBlockVisualPartPlacementType = exports.DBlockVisualPartTileType = exports.DBlockVisualPartType = void 0;\r\nconst DAnnotationReader_1 = __webpack_require__(/*! ./importers/DAnnotationReader */ \"./ts/mr/data/importers/DAnnotationReader.ts\");\r\nconst DHelper_1 = __webpack_require__(/*! ./DHelper */ \"./ts/mr/data/DHelper.ts\");\r\nvar DBlockVisualPartType;\r\n(function (DBlockVisualPartType) {\r\n /** 床 */\r\n DBlockVisualPartType[DBlockVisualPartType[\"Floor\"] = 0] = \"Floor\";\r\n /** 床の装飾 */\r\n DBlockVisualPartType[DBlockVisualPartType[\"FloorDecoration\"] = 1] = \"FloorDecoration\";\r\n /** あぜ道 */\r\n DBlockVisualPartType[DBlockVisualPartType[\"Footpath\"] = 2] = \"Footpath\";\r\n /** あぜ道の装飾 */\r\n DBlockVisualPartType[DBlockVisualPartType[\"FootpathDecoration\"] = 3] = \"FootpathDecoration\";\r\n /** 通路 */\r\n DBlockVisualPartType[DBlockVisualPartType[\"Passageway\"] = 4] = \"Passageway\";\r\n /** 通路の装飾 */\r\n DBlockVisualPartType[DBlockVisualPartType[\"PassagewayDecoration\"] = 5] = \"PassagewayDecoration\";\r\n /** 水路 */\r\n DBlockVisualPartType[DBlockVisualPartType[\"Water\"] = 6] = \"Water\";\r\n /** 水路の装飾 */\r\n DBlockVisualPartType[DBlockVisualPartType[\"WaterDecoration\"] = 7] = \"WaterDecoration\";\r\n /** 店の床 */\r\n DBlockVisualPartType[DBlockVisualPartType[\"ShopFloor\"] = 8] = \"ShopFloor\";\r\n /** 店の床の装飾 */\r\n DBlockVisualPartType[DBlockVisualPartType[\"ShopFloorDecoration\"] = 9] = \"ShopFloorDecoration\";\r\n /** 壁 */\r\n DBlockVisualPartType[DBlockVisualPartType[\"Wall\"] = 10] = \"Wall\";\r\n /** 壁の装飾 */\r\n DBlockVisualPartType[DBlockVisualPartType[\"WallDecoration\"] = 11] = \"WallDecoration\";\r\n /** 壊れない壁 */\r\n DBlockVisualPartType[DBlockVisualPartType[\"HardWall\"] = 12] = \"HardWall\";\r\n // /** 壁(上面) */\r\n // WallHead,\r\n // /** 壁(上面) の装飾 */\r\n // WallHeadDecoration,\r\n // /** 壁(側面) */\r\n // WallSide,\r\n // /** 壁(側面) の装飾 */\r\n // WallSideDecoration,\r\n // /** 壊れない壁(上面) */\r\n // HardWallHead,\r\n // /** 壊れない壁(側面) */\r\n // HardWallSide,\r\n})(DBlockVisualPartType = exports.DBlockVisualPartType || (exports.DBlockVisualPartType = {}));\r\nvar DBlockVisualPartTileType;\r\n(function (DBlockVisualPartTileType) {\r\n DBlockVisualPartTileType[DBlockVisualPartTileType[\"Normal\"] = 0] = \"Normal\";\r\n DBlockVisualPartTileType[DBlockVisualPartTileType[\"Autotile\"] = 1] = \"Autotile\";\r\n})(DBlockVisualPartTileType = exports.DBlockVisualPartTileType || (exports.DBlockVisualPartTileType = {}));\r\nvar DBlockVisualPartPlacementType;\r\n(function (DBlockVisualPartPlacementType) {\r\n DBlockVisualPartPlacementType[DBlockVisualPartPlacementType[\"Random\"] = 0] = \"Random\";\r\n})(DBlockVisualPartPlacementType = exports.DBlockVisualPartPlacementType || (exports.DBlockVisualPartPlacementType = {}));\r\nclass DBlockVisualPart {\r\n constructor(index) {\r\n this.index = index;\r\n this.type = DBlockVisualPartType.Floor;\r\n this.tileType = DBlockVisualPartTileType.Normal;\r\n this.tiles = [];\r\n this.height = 1;\r\n this.placementType = DBlockVisualPartPlacementType.Random;\r\n }\r\n}\r\nexports.DBlockVisualPart = DBlockVisualPart;\r\nclass DTemplateMap {\r\n constructor(id) {\r\n this.id = id;\r\n this.name = \"null\";\r\n this.mapId = 0;\r\n this.parts = [new DBlockVisualPart(0)]; // [0] is dummy\r\n this.partIndex = [];\r\n this.tilesetId = 0;\r\n this.wallHeadAutoTileKind = 0;\r\n this.wallEdgeAutoTileKind = 0;\r\n this.floorAutoTileKind = 0;\r\n this.itemShopFloorAutoTileKind = 0;\r\n }\r\n import(mapData) {\r\n var _a;\r\n this.tilesetId = mapData.tilesetId;\r\n this.wallHeadAutoTileKind = DHelper_1.DHelpers.getAutotileKind(DHelper_1.DHelpers.getMapTopTile(mapData, 1, 1));\r\n this.wallEdgeAutoTileKind = DHelper_1.DHelpers.getAutotileKind(DHelper_1.DHelpers.getMapTopTile(mapData, 1, 2));\r\n this.floorAutoTileKind = DHelper_1.DHelpers.getAutotileKind(DHelper_1.DHelpers.getMapTopTile(mapData, 1, 3));\r\n this.itemShopFloorAutoTileKind = DHelper_1.DHelpers.getAutotileKind(DHelper_1.DHelpers.getMapTopTile(mapData, 1, 7));\r\n for (const event of mapData.events) {\r\n if (!event)\r\n continue;\r\n const x = event.x;\r\n const y = event.y;\r\n // @MR-TemplatePart\r\n const attr = DAnnotationReader_1.DAnnotationReader.readTemplatePartAnnotationFromPage(event.pages[0]);\r\n if (!attr)\r\n continue;\r\n if (!attr.type) {\r\n throw new Error(\"Invalid @MR-TemplatePart type\");\r\n }\r\n const part = new DBlockVisualPart(this.parts.length);\r\n this.parts.push(part);\r\n part.type = this.toTemplateMapPartType(attr.type);\r\n part.height = (_a = attr.height) !== null && _a !== void 0 ? _a : 1;\r\n if (attr.placement) {\r\n part.placementType = this.toTemplateMapPartPlacementType(attr.placement);\r\n }\r\n // タイル情報読み取り\r\n let tileType = undefined;\r\n for (let i = 0; i < part.height; i++) {\r\n const tileId = DHelper_1.DHelpers.getMapTopTile(mapData, x, y - i);\r\n const type = DHelper_1.DHelpers.isAutotile(tileId) ? DBlockVisualPartTileType.Autotile : DBlockVisualPartTileType.Normal;\r\n if (tileType === undefined) {\r\n tileType = type;\r\n }\r\n else if (tileType !== type) {\r\n throw new Error(\"Invalid tile kinds.\");\r\n }\r\n if (type == DBlockVisualPartTileType.Autotile) {\r\n part.tiles.push(DHelper_1.DHelpers.getAutotileKind(tileId));\r\n }\r\n else {\r\n part.tiles.push(tileId);\r\n }\r\n }\r\n part.tileType = tileType !== null && tileType !== void 0 ? tileType : DBlockVisualPartTileType.Normal;\r\n // 格納\r\n if (this.partIndex[part.type] === undefined) {\r\n this.partIndex[part.type] = [part.index];\r\n }\r\n else {\r\n this.partIndex[part.type].push(part.index);\r\n }\r\n }\r\n }\r\n toTemplateMapPartType(type) {\r\n switch (type) {\r\n case \"Floor\":\r\n return DBlockVisualPartType.Floor;\r\n case \"FloorDecoration\":\r\n return DBlockVisualPartType.FloorDecoration;\r\n case \"Footpath\":\r\n return DBlockVisualPartType.Footpath;\r\n case \"FootpathDecoration\":\r\n return DBlockVisualPartType.FootpathDecoration;\r\n case \"Passageway\":\r\n return DBlockVisualPartType.Passageway;\r\n case \"PassagewayDecoration\":\r\n return DBlockVisualPartType.PassagewayDecoration;\r\n case \"Water\":\r\n return DBlockVisualPartType.Water;\r\n case \"WaterDecoration\":\r\n return DBlockVisualPartType.WaterDecoration;\r\n case \"ShopFloor\":\r\n return DBlockVisualPartType.ShopFloor;\r\n case \"ShopFloorDecoration\":\r\n return DBlockVisualPartType.ShopFloorDecoration;\r\n case \"Wall\":\r\n return DBlockVisualPartType.Wall;\r\n case \"WallDecoration\":\r\n return DBlockVisualPartType.WallDecoration;\r\n case \"HardWall\":\r\n return DBlockVisualPartType.HardWall;\r\n // case \"WallHead\":\r\n // return DTemplateMapPartType.WallHead;\r\n // case \"WallHeadDecoration\":\r\n // return DTemplateMapPartType.WallHeadDecoration;\r\n // case \"WallSide\":\r\n // return DTemplateMapPartType.WallSide;\r\n // case \"WallSideDecoration\":\r\n // return DTemplateMapPartType.WallSideDecoration;\r\n // case \"HardWallHead\":\r\n // return DTemplateMapPartType.HardWallHead;\r\n // case \"HardWallSide\":\r\n // return DTemplateMapPartType.HardWallSide;\r\n default:\r\n throw new Error(`Invalid type: ${type}.`);\r\n }\r\n }\r\n toTemplateMapPartPlacementType(type) {\r\n switch (type) {\r\n case \"Random\":\r\n return DBlockVisualPartPlacementType.Random;\r\n default:\r\n throw new Error(`Invalid type: ${type}.`);\r\n }\r\n }\r\n}\r\nexports.DTemplateMap = DTemplateMap;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DTemplateMap.ts?"); /***/ }), /***/ "./ts/mr/data/DTerrainPreset.ts": /*!**************************************!*\ !*** ./ts/mr/data/DTerrainPreset.ts ***! \**************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DFloorPreset = exports.DTerrainSetting = exports.DTerrainShape = exports.FGenericRandomMapWayConnectionMode = exports.DSectorConnectionPreset = void 0;\r\nconst PluginParameters_1 = __webpack_require__(/*! ../PluginParameters */ \"./ts/mr/PluginParameters.ts\");\r\nvar DSectorConnectionPreset;\r\n(function (DSectorConnectionPreset) {\r\n DSectorConnectionPreset[DSectorConnectionPreset[\"Default\"] = 0] = \"Default\";\r\n DSectorConnectionPreset[DSectorConnectionPreset[\"C\"] = 1] = \"C\";\r\n DSectorConnectionPreset[DSectorConnectionPreset[\"H\"] = 2] = \"H\";\r\n})(DSectorConnectionPreset = exports.DSectorConnectionPreset || (exports.DSectorConnectionPreset = {}));\r\nvar FGenericRandomMapWayConnectionMode;\r\n(function (FGenericRandomMapWayConnectionMode) {\r\n /** 区画の辺に通路を繋げる。通路が部屋を回り込んだり、全体的に長くなるためクロスが多くなったり、予測しづらく複雑なマップを生成する。 */\r\n FGenericRandomMapWayConnectionMode[FGenericRandomMapWayConnectionMode[\"SectionEdge\"] = 0] = \"SectionEdge\";\r\n /** 部屋の辺に通路を繋げる。通路の回り込みは無くなり、部屋の基準点間の最短距離を結ぶようになる。部屋から通路が伸びる方向にはほぼ必ず部屋があるため、予測しやすく難易度の低いマップとなる。 */\r\n FGenericRandomMapWayConnectionMode[FGenericRandomMapWayConnectionMode[\"RoomEdge\"] = 1] = \"RoomEdge\";\r\n})(FGenericRandomMapWayConnectionMode = exports.FGenericRandomMapWayConnectionMode || (exports.FGenericRandomMapWayConnectionMode = {}));\r\n;\r\nclass DTerrainShape {\r\n constructor(id) {\r\n this.id = id;\r\n this.key = \"\";\r\n this.width = PluginParameters_1.paramRandomMapDefaultWidth;\r\n this.height = PluginParameters_1.paramRandomMapDefaultHeight;\r\n this.divisionCountX = 3;\r\n this.divisionCountY = 3;\r\n this.roomCountMin = Infinity;\r\n this.roomCountMax = Infinity;\r\n this.wayConnectionMode = FGenericRandomMapWayConnectionMode.SectionEdge;\r\n this.connectionPreset = DSectorConnectionPreset.Default;\r\n this.forceRoomShapes = [];\r\n }\r\n}\r\nexports.DTerrainShape = DTerrainShape;\r\n/**\r\n *\r\n *\r\n *\r\n * [2022/2/21] Structure を Preset で指定する必要があるのか?FloorInfo 側で指定したほうが良いのではないか?\r\n * ----------\r\n * 必須ではない。これはどちらかというと、設定を楽にするため。\r\n *\r\n * - そのフロアは、通常マップか大部屋の2種類をとりえる。\r\n * - 大部屋となった場合は確定でモンスターハウス。\r\n *\r\n * このような条件の場合、次のように書くことができる。\r\n *\r\n * ```\r\n * @MR-Floor\r\n * presets: [\r\n * [\"kTerrainSetting_Default\", 5],\r\n * [\"kTerrainSetting_GreatHallMonsterHouse\", 5],\r\n * ]\r\n * ```\r\n *\r\n * もし Structure を Preset で持たない場合、次のように書く必要があるだろう。\r\n *\r\n * ```\r\n * @MR-Floor\r\n * presets: [\r\n * {\r\n * key: \"kTerrainSetting_Default\",\r\n * rate: 5,\r\n * },\r\n * {\r\n * key: \"kTerrainSetting_GreatHallMonsterHouse\",\r\n * rate: 5,\r\n * forceStructures: [\"MonsterHouse\"]\r\n * },\r\n * ]\r\n * ```\r\n *\r\n * 当然ながら、ツクールの注釈には入りきらない。\r\n *\r\n * またシレン2中腹の井戸のように、定期的に大部屋モンスターハウスが発生するような場合、上記全く同じ設定をたくさんのフロア情報に記述する必要がある。\r\n * 設定を変更したいときに全フロア見直すのはかなり大変。\r\n * 例えば次のような Preset を作るのが良いだろう。\r\n *\r\n * - kTerrainPreset_中腹の井戸_Default\r\n * - kTerrainPreset_中腹の井戸_大部屋モンスターハウス\r\n *\r\n * [2022/2/21] @MR-Floor での指定を、もう一段グループ化したい\r\n * ----------\r\n *\r\n * ```\r\n * @MR-Floor\r\n * terrain: \"kTerrainPresets_Default\"\r\n * ```\r\n *\r\n * 前項のままだと、アルファベットマップをランダム選択するときに、@MR-Floor にそれぞれの Preset を書かなければならなくなる。\r\n * 次のようなのを用意できるといいかも。\r\n *\r\n * - kTerrainPresets_ダンジョンA_低層\r\n * - kTerrainPresets_ダンジョンA_中層\r\n * - kTerrainPresets_ダンジョンA_深層\r\n */\r\nclass DTerrainSetting {\r\n constructor(id) {\r\n this.id = id;\r\n this.key = \"\";\r\n this.shapeRefs = [];\r\n this.structureDefs = [{ typeName: \"default\", rate: 5 }];\r\n this.forceStructures = [];\r\n this.shopDefs = [{ typeName: \"default\", rate: 5 }];\r\n this.monsterHouseDefs = [{ typeName: \"default\", rate: 5 }];\r\n }\r\n}\r\nexports.DTerrainSetting = DTerrainSetting;\r\nclass DFloorPreset {\r\n constructor(id) {\r\n this.id = id;\r\n this.key = \"\";\r\n this.terrains = [];\r\n this.monsterHouses = [];\r\n }\r\n}\r\nexports.DFloorPreset = DFloorPreset;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DTerrainPreset.ts?"); /***/ }), /***/ "./ts/mr/data/DTextManager.ts": /*!************************************!*\ !*** ./ts/mr/data/DTextManager.ts ***! \************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DTextManager = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ./MRData */ \"./ts/mr/data/MRData.ts\");\r\nclass DTextManager {\r\n static basic(basicId) {\r\n return $dataSystem.terms.basic[basicId] || \"\";\r\n }\r\n static param(paramId) {\r\n if ($dataSystem.terms.params[paramId]) {\r\n return $dataSystem.terms.params[paramId];\r\n }\r\n else {\r\n const param = MRData_1.MRData.parameters[paramId];\r\n return param ? param.displayName : \"\";\r\n }\r\n }\r\n static command(commandId) {\r\n return $dataSystem.terms.commands[commandId] || \"\";\r\n }\r\n static message(messageId) {\r\n return $dataSystem.terms.messages[messageId] || \"\";\r\n }\r\n static get level() { return this.basic(0); }\r\n static get exp() { return this.basic(8); }\r\n static get save() { return this.command(9); }\r\n static get obtainExp() { return this.message(\"obtainExp\"); }\r\n static get levelUp() { return this.message(\"levelUp\"); }\r\n static get actorDamage() { return this.message(\"actorDamage\"); }\r\n static get actorRecovery() { return this.message(\"actorRecovery\"); }\r\n static get actorDrain() { return this.message(\"actorDrain\"); }\r\n static get actorNoDamage() { return this.message(\"actorNoDamage\"); }\r\n static get actorGain() { return this.message(\"actorGain\"); }\r\n static get actorLoss() { return this.message(\"actorLoss\"); }\r\n static get actorNoHit() { return this.message(\"actorNoHit\"); }\r\n static get enemyDamage() { return this.message(\"enemyDamage\"); }\r\n static get enemyRecovery() { return this.message(\"enemyRecovery\"); }\r\n static get enemyDrain() { return this.message(\"enemyDrain\"); }\r\n static get enemyNoDamage() { return this.message(\"enemyNoDamage\"); }\r\n static get enemyGain() { return this.message(\"enemyGain\"); }\r\n static get enemyLoss() { return this.message(\"enemyLoss\"); }\r\n static get enemyNoHit() { return this.message(\"enemyNoHit\"); }\r\n static get buffAdd() { return this.message(\"buffAdd\"); }\r\n static get debuffAdd() { return this.message(\"debuffAdd\"); }\r\n static get buffRemove() { return this.message(\"buffRemove\"); }\r\n static get actionFailure() { return this.message(\"actionFailure\"); }\r\n static get currencyUnit() { return $dataSystem.currencyUnit; }\r\n //----------\r\n static weaponStrength() { return (0, Common_1.tr2)(\"武器の強さ\"); }\r\n static shieldStrength() { return (0, Common_1.tr2)(\"盾の強さ\"); }\r\n}\r\nexports.DTextManager = DTextManager;\r\nDTextManager.score = \"スコア\";\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DTextManager.ts?"); /***/ }), /***/ "./ts/mr/data/DTrait.ts": /*!******************************!*\ !*** ./ts/mr/data/DTrait.ts ***! \******************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DTrait = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst DHelper_1 = __webpack_require__(/*! ./DHelper */ \"./ts/mr/data/DHelper.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ./MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ./MRData */ \"./ts/mr/data/MRData.ts\");\r\n/**\r\n * コアスクリプトの Trait は number だけで識別されるものであるが、\r\n * RE としてはメモ欄を使った指定を行う際の名前検索などで Trait というデータ自体に若干属性が必要になる。\r\n *\r\n * NOTE: Behavior と Trait は違うもの?\r\n * ----------\r\n * ひとまず、違うものにしてみる。\r\n * Behavior に対して Trait は静的なデータ。特に単なるフラグを表したい時に使う。\r\n * よく見え状態、透視状態、ワナ回避状態、ハラヘラズ状態、ワナ師状態、など。\r\n * ちなみにこれらは、例えばワナ回避状態であれば、そういった状態を処理できるフローは Behavior に実装され、\r\n * 実際にその条件を通るかは Trait を持っているかどうか、に依る。\r\n * - Behavior は \"資質\"\r\n * - Trait はその資質を発動させる \"鍵\"\r\n * みたいに考えるとよさそう。\r\n * ただ、よく見え状態やワナ師状態などは必ずしも個々のEntityの Behavior だけで解決できるものではない。\r\n * そういったものモノある点に注意。\r\n * それでもまぁ、例えば \"勢力の資質\" とか \"パーティの資質\" とかで考えるといいかも。\r\n */\r\nclass DTrait {\r\n constructor(id, key) {\r\n this.id = id;\r\n this.key = key;\r\n }\r\n /** @deprecated DMetadataParser */\r\n static parseTraitMetadata(meta) {\r\n const raws = meta[\"MR-Trait\"];\r\n if (!raws)\r\n return [];\r\n const list = ((raws instanceof Array) ? raws : [raws]);\r\n const result = [];\r\n for (const data of list) {\r\n const c = DHelper_1.DHelpers.parseConstructionExpr(data);\r\n result.push({\r\n code: MRData_1.MRData.getTrait(c.name).id,\r\n dataId: this.parseDataId(c.args[0]),\r\n value: Number(c.args[1]),\r\n });\r\n }\r\n return result;\r\n }\r\n static parseDataId(value) {\r\n if (typeof value == 'string') {\r\n // 今のところ Param 名だけなのでそれを検索してみる\r\n const code = value.toLowerCase();\r\n const param = MRData_1.MRData.parameters.find(x => x.code == code);\r\n if (param) {\r\n return param.id;\r\n }\r\n else {\r\n throw new Error((0, Common_1.tr2)(\"Trait に指定されているパラメータ名 %1 は不正です。\").format(value));\r\n }\r\n }\r\n else {\r\n return Number(value);\r\n }\r\n }\r\n static makeTraitData(props) {\r\n switch (props.code) {\r\n case \"DeathVulnerableElement\":\r\n return { code: MRData_1.MRData.getTrait(\"DeathVulnerableElement\").id, dataId: MRData_1.MRData.getElement(props.elementKey).id, value: MRData_1.MRData.getState(props.stateKey).id };\r\n case \"RaceRate\":\r\n return { code: MRBasics_1.MRBasics.traits.RaceRate, dataId: MRData_1.MRData.getRace(props.raceKey).id, value: props.value };\r\n case \"SurvivalParameterLossRate\":\r\n return { code: MRBasics_1.MRBasics.traits.SurvivalParamLossRate, dataId: MRData_1.MRData.getParameter(props.parameterKey).id, value: props.value };\r\n case \"ParameterDamageRate\":\r\n return { code: MRBasics_1.MRBasics.traits.ParamDamageRate, dataId: MRData_1.MRData.getParameter(props.parameterKey).id, value: props.value };\r\n case \"SkillGuard\":\r\n return { code: MRBasics_1.MRBasics.traits.SkillGuard, dataId: MRData_1.MRData.getSkill(props.skillKey).id, value: 0 };\r\n case \"Unknown\":\r\n return { code: 0, dataId: props.dataKey, value: props.value };\r\n default:\r\n throw new Error(`Trait code \"${props.code}\" unsupported.`);\r\n }\r\n }\r\n}\r\nexports.DTrait = DTrait;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DTrait.ts?"); /***/ }), /***/ "./ts/mr/data/DTroop.ts": /*!******************************!*\ !*** ./ts/mr/data/DTroop.ts ***! \******************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DTroop = void 0;\r\nclass DTroop {\r\n constructor(id) {\r\n this.id = id;\r\n this.key = \"\";\r\n this.members = [];\r\n }\r\n}\r\nexports.DTroop = DTroop;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DTroop.ts?"); /***/ }), /***/ "./ts/mr/data/DValidationHelper.ts": /*!*****************************************!*\ !*** ./ts/mr/data/DValidationHelper.ts ***! \*****************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DValidationHelper = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nclass DValidationHelper {\r\n static makeDataName(typeName, id, dataName) {\r\n return `<${typeName} ${id}:${dataName}>: `;\r\n }\r\n static makeRmmzTroopName(rmmzTrppoId) {\r\n const data = $dataTroops[rmmzTrppoId];\r\n return (0, Common_1.tr2)(\"敵グループ(%1:%2)\").format(data.id, data.name);\r\n }\r\n static makeRmmzEnemyName(rmmzEnemyId) {\r\n const data = $dataEnemies[rmmzEnemyId];\r\n return (0, Common_1.tr2)(\"敵キャラ(%1:%2)\").format(data.id, data.name);\r\n }\r\n static makeRmmzMapName(mapId) {\r\n const data = $dataMapInfos[mapId];\r\n return this.makeDataName(\"マップ\", mapId, data ? data.name : \"???\");\r\n }\r\n static makeRmmzEventName(event) {\r\n return this.makeDataName(\"イベント\", event.id, event.name);\r\n }\r\n}\r\nexports.DValidationHelper = DValidationHelper;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/DValidationHelper.ts?"); /***/ }), /***/ "./ts/mr/data/MRBasics.ts": /*!********************************!*\ !*** ./ts/mr/data/MRBasics.ts ***! \********************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.MRBasics = exports.DClarificationType = void 0;\r\nvar DClarificationType;\r\n(function (DClarificationType) {\r\n DClarificationType[DClarificationType[\"Unit\"] = 0] = \"Unit\";\r\n DClarificationType[DClarificationType[\"Item\"] = 1] = \"Item\";\r\n DClarificationType[DClarificationType[\"Trap\"] = 2] = \"Trap\";\r\n DClarificationType[DClarificationType[\"Terrain\"] = 3] = \"Terrain\";\r\n DClarificationType[DClarificationType[\"Sight\"] = 4] = \"Sight\";\r\n})(DClarificationType = exports.DClarificationType || (exports.DClarificationType = {}));\r\n/**\r\n * ゲームシステムとして重要な定義済みデータを保持する\r\n */\r\nclass MRBasics {\r\n}\r\nexports.MRBasics = MRBasics;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/MRBasics.ts?"); /***/ }), /***/ "./ts/mr/data/MRData.ts": /*!******************************!*\ !*** ./ts/mr/data/MRData.ts ***! \******************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.MRData = exports.LandExitResult = void 0;\r\nconst DSkill_1 = __webpack_require__(/*! ./DSkill */ \"./ts/mr/data/DSkill.ts\");\r\nconst DClass_1 = __webpack_require__(/*! ./DClass */ \"./ts/mr/data/DClass.ts\");\r\nconst DItem_1 = __webpack_require__(/*! ./DItem */ \"./ts/mr/data/DItem.ts\");\r\nconst DEntityCategory_1 = __webpack_require__(/*! ./DEntityCategory */ \"./ts/mr/data/DEntityCategory.ts\");\r\nconst DEnemy_1 = __webpack_require__(/*! ./DEnemy */ \"./ts/mr/data/DEnemy.ts\");\r\nconst DActor_1 = __webpack_require__(/*! ./DActor */ \"./ts/mr/data/DActor.ts\");\r\nconst DTemplateMap_1 = __webpack_require__(/*! ./DTemplateMap */ \"./ts/mr/data/DTemplateMap.ts\");\r\nconst DPrefab_1 = __webpack_require__(/*! ./DPrefab */ \"./ts/mr/data/DPrefab.ts\");\r\nconst DTrait_1 = __webpack_require__(/*! ./DTrait */ \"./ts/mr/data/DTrait.ts\");\r\nconst DParameter_1 = __webpack_require__(/*! ./DParameter */ \"./ts/mr/data/DParameter.ts\");\r\nconst DEntity_1 = __webpack_require__(/*! ./DEntity */ \"./ts/mr/data/DEntity.ts\");\r\nconst DPseudonymous_1 = __webpack_require__(/*! ./DPseudonymous */ \"./ts/mr/data/DPseudonymous.ts\");\r\nconst MRDataExtension_1 = __webpack_require__(/*! ./MRDataExtension */ \"./ts/mr/data/MRDataExtension.ts\");\r\nconst DEmittor_1 = __webpack_require__(/*! ./DEmittor */ \"./ts/mr/data/DEmittor.ts\");\r\nconst DElement_1 = __webpack_require__(/*! ./DElement */ \"./ts/mr/data/DElement.ts\");\r\nconst DRace_1 = __webpack_require__(/*! ./DRace */ \"./ts/mr/data/DRace.ts\");\r\nconst DTerrainPreset_1 = __webpack_require__(/*! ./DTerrainPreset */ \"./ts/mr/data/DTerrainPreset.ts\");\r\nconst DCommand_1 = __webpack_require__(/*! ./DCommand */ \"./ts/mr/data/DCommand.ts\");\r\nconst DEffect_1 = __webpack_require__(/*! ./DEffect */ \"./ts/mr/data/DEffect.ts\");\r\nconst DMap_1 = __webpack_require__(/*! ./DMap */ \"./ts/mr/data/DMap.ts\");\r\nconst DEntityTemplate_1 = __webpack_require__(/*! ./DEntityTemplate */ \"./ts/mr/data/DEntityTemplate.ts\");\r\nconst DSpecialEffect_1 = __webpack_require__(/*! ./DSpecialEffect */ \"./ts/mr/data/DSpecialEffect.ts\");\r\nconst DChronus_1 = __webpack_require__(/*! ./DChronus */ \"./ts/mr/data/DChronus.ts\");\r\nconst DQuest_1 = __webpack_require__(/*! ./DQuest */ \"./ts/mr/data/DQuest.ts\");\r\nconst DBehavior_1 = __webpack_require__(/*! ./DBehavior */ \"./ts/mr/data/DBehavior.ts\");\r\n// 2xx: 踏破\r\n// 3xx: 中断。持ち物などは無くならない。\r\n// 4xx: ゲームオーバー。\r\nvar LandExitResult;\r\n(function (LandExitResult) {\r\n /** 冒険中 */\r\n LandExitResult[LandExitResult[\"Challenging\"] = 100] = \"Challenging\";\r\n /** ゴールに到達した。最後のフロアを抜けたか、戻り状態で最初のフロアを抜けたとき。 */\r\n LandExitResult[LandExitResult[\"Goal\"] = 200] = \"Goal\";\r\n /** 脱出の巻物などによって冒険を中断した。 */\r\n LandExitResult[LandExitResult[\"Escape\"] = 300] = \"Escape\";\r\n /** ゲームオーバーによって Land から出された。 */\r\n LandExitResult[LandExitResult[\"Gameover\"] = 400] = \"Gameover\";\r\n /** 冒険をあきらめた(メニューから) */\r\n LandExitResult[LandExitResult[\"Abandoned\"] = 401] = \"Abandoned\";\r\n /** 制約付きのハードコアモードなど、ダンジョン内でセーブせずにゲームを終えたらゲームオーバー扱いする。 */\r\n LandExitResult[LandExitResult[\"InvalidSuspend\"] = 402] = \"InvalidSuspend\";\r\n})(LandExitResult = exports.LandExitResult || (exports.LandExitResult = {}));\r\n/** Database */\r\nclass MRData {\r\n //static rmmzWeaponTypeIdOffset: number = 0;\r\n //static rmmzArmorTypeIdOffset: number = 0;\r\n //static _behaviorFactories: (() => LBehavior)[] = [];\r\n static reset() {\r\n this.chronus = new DChronus_1.DChronus();\r\n this.categories = [new DEntityCategory_1.DEntityCategory(0, \"null\")];\r\n this.classes = [];\r\n this.newClass(\"null\");\r\n this.races = [new DRace_1.DRace(0)];\r\n this.actors = [0];\r\n this.enemies = [];\r\n this.lands = [];\r\n this.maps = [new DMap_1.DMap(0)];\r\n this.templateMaps = [new DTemplateMap_1.DTemplateMap(0)];\r\n this.factions = [];\r\n //this.actions = [new DAction(0, \"null\")];\r\n this.commands = [new DCommand_1.DCommand(0, \"null\")];\r\n this.sequels = [{ id: 0, name: \"null\", parallel: false, fluidSequence: false }];\r\n this.parameters = [];\r\n this.effectBehaviors = [new DSpecialEffect_1.DSpecialEffect(0, \"null\")];\r\n this.skills = [];\r\n this.items = [];\r\n this.states = [];\r\n this.prefabs = [new DPrefab_1.DPrefab(0, \"null\")];\r\n this.entities = [new DEntity_1.DEntity(0)];\r\n this.entityTemplates = [new DEntityTemplate_1.DEntityTemplate(0, \"null\", { type: \"null\" })];\r\n this.emittors = [new DEmittor_1.DEmittor(0, \"null\")];\r\n this.effects = [new DEffect_1.DEffect(0, \"null\")];\r\n this.terrainSettings = [new DTerrainPreset_1.DTerrainSetting(0)];\r\n this.floorPresets = [new DTerrainPreset_1.DFloorPreset(0)];\r\n this.quests = [new DQuest_1.DQuest(0, \"null\")];\r\n this.questTasks = [new DQuest_1.DQuestTask(0, \"null\")];\r\n this.behavior = [new DBehavior_1.DBehavior(0, \"null\", \"null\", \"null\")];\r\n }\r\n //--------------------------------------------------------------------------\r\n static newElement(key) {\r\n const data = new DElement_1.DElement(this.races.length, key);\r\n this.elements.push(data);\r\n return data;\r\n }\r\n static getElement(pattern) {\r\n const d = this.elements.find(e => (e.key != \"\" && e.key == pattern));\r\n if (d)\r\n return d;\r\n throw new Error(`AttackElement \"${pattern}\" not found.`);\r\n }\r\n //--------------------------------------------------------------------------\r\n static newEntityCategory(key, displayName = \"\") {\r\n const data = new DEntityCategory_1.DEntityCategory(this.categories.length, key);\r\n data.displayName = displayName;\r\n this.categories.push(data);\r\n return data;\r\n }\r\n static findEntityCategory(pattern) {\r\n return this.findHelper(this.categories, pattern, x => x.key === pattern);\r\n }\r\n static getEntityCategory(pattern) {\r\n const d = this.findEntityCategory(pattern);\r\n if (!d)\r\n throw new Error(`EntityCategory \"${pattern}\" not found.`);\r\n return d;\r\n }\r\n //--------------------------------------------------------------------------\r\n static newClass(name) {\r\n const newId = this.classes.length;\r\n const data = new DClass_1.DClass(newId);\r\n data.name = name;\r\n this.classes.push(data);\r\n return newId;\r\n }\r\n //--------------------------------------------------------------------------\r\n static newRace() {\r\n const data = new DRace_1.DRace(this.races.length);\r\n this.races.push(data);\r\n return data;\r\n }\r\n static findRace(pattern) {\r\n const id = parseInt(pattern);\r\n if (!isNaN(id))\r\n return this.races[id];\r\n else {\r\n return this.races.find(x => (x.key != \"\" && x.key == pattern) || x.name == pattern);\r\n }\r\n }\r\n static getRace(pattern) {\r\n const d = this.findRace(pattern);\r\n if (d)\r\n return d;\r\n throw new Error(`Race \"${pattern}\" not found.`);\r\n }\r\n //--------------------------------------------------------------------------\r\n static newTemplateMap() {\r\n const newId = this.templateMaps.length;\r\n const data = new DTemplateMap_1.DTemplateMap(newId);\r\n this.templateMaps.push(data);\r\n return data;\r\n }\r\n //--------------------------------------------------------------------------\r\n // Actions\r\n // static newAction(key: string, displayName: string, priority?: number): DAction {\r\n // const newData = new DAction(this.actions.length, key);\r\n // newData.displayName = displayName;\r\n // newData.priority = priority ?? 0;\r\n // this.actions.push(newData);\r\n // return newData;\r\n // }\r\n // static action(key: DActionId | string): DAction {\r\n // let data;\r\n // if (typeof key === \"number\") {\r\n // data = this.actions[key];\r\n // }\r\n // else if (typeof key == 'string') {\r\n // data = this.actions.find(x => x.displayName == key);\r\n // }\r\n // if (data) return data;\r\n // throw new Error(`Action \"${key}\" not found.`);\r\n // }\r\n //--------------------------------------------------------------------------\r\n static newCommand(name) {\r\n const newId = this.commands.length;\r\n const newData = new DCommand_1.DCommand(newId, name);\r\n this.commands.push(newData);\r\n return newData;\r\n }\r\n //--------------------------------------------------------------------------\r\n static addSequel(name) {\r\n const newId = this.sequels.length;\r\n this.sequels.push({\r\n id: newId,\r\n name: name,\r\n parallel: false,\r\n fluidSequence: false,\r\n });\r\n return newId;\r\n }\r\n //--------------------------------------------------------------------------\r\n // Parameters\r\n static addParams(key, displayName) {\r\n const data = new DParameter_1.DParameter(this.parameters.length, key, displayName);\r\n this.parameters.push(data);\r\n return data;\r\n }\r\n static getParameter(key) {\r\n let data;\r\n if (typeof key === \"number\") {\r\n data = this.parameters[key];\r\n }\r\n else if (typeof key == 'string') {\r\n data = this.parameters.find(x => x.key == key);\r\n }\r\n if (data)\r\n return data;\r\n throw new Error(`Parameter \"${key}\" not found.`);\r\n }\r\n //--------------------------------------------------------------------------\r\n // \r\n static newEntity() {\r\n const data = new DEntity_1.DEntity(this.entities.length);\r\n this.entities.push(data);\r\n return data;\r\n }\r\n static findEntity(pattern) {\r\n const id = parseInt(pattern);\r\n if (!isNaN(id))\r\n return this.entities[id];\r\n else {\r\n return this.entities.find(e => (e.entity.key != \"\" && e.entity.key == pattern));\r\n }\r\n }\r\n static getEntity(pattern) {\r\n const d = this.findEntity(pattern);\r\n if (d)\r\n return d;\r\n throw new Error(`Entity \"${pattern}\" not found.`);\r\n }\r\n //--------------------------------------------------------------------------\r\n // \r\n static newEntityTemplate(key, props) {\r\n const data = new DEntityTemplate_1.DEntityTemplate(this.entityTemplates.length, key, props);\r\n this.entityTemplates.push(data);\r\n return data;\r\n }\r\n static findEntityTemplate(pattern) {\r\n return this.findHelper(this.entityTemplates, pattern, x => x.key === pattern);\r\n }\r\n static getEntityTemplate(pattern) {\r\n const d = this.findEntityTemplate(pattern);\r\n if (d)\r\n return d;\r\n throw new Error(`EntityTemplate \"${pattern}\" not found.`);\r\n }\r\n //--------------------------------------------------------------------------\r\n static newPrefab(key) {\r\n const data = new DPrefab_1.DPrefab(this.prefabs.length, key);\r\n this.prefabs.push(data);\r\n return data;\r\n }\r\n //--------------------------------------------------------------------------\r\n static newMap() {\r\n const newId = this.maps.length;\r\n const data = new DMap_1.DMap(newId);\r\n this.maps.push(data);\r\n return data;\r\n }\r\n static findMap(pattern) {\r\n const id = parseInt(pattern);\r\n if (!isNaN(id))\r\n return this.maps[id];\r\n else {\r\n return this.maps.find(x => (x.name != \"\" && x.name == pattern));\r\n }\r\n }\r\n static getMap(pattern) {\r\n const d = this.findMap(pattern);\r\n if (d)\r\n return d;\r\n throw new Error(`Map \"${pattern}\" not found.`);\r\n }\r\n //--------------------------------------------------------------------------\r\n static newEffect(key) {\r\n const newId = this.effects.length;\r\n const data = new DEffect_1.DEffect(newId, key);\r\n this.effects.push(data);\r\n return data;\r\n }\r\n static cloneEffect(src) {\r\n const data = this.newEffect(src.key);\r\n data.copyFrom(src);\r\n return data;\r\n }\r\n static findEffect(pattern) {\r\n return this.findHelper(this.effects, pattern, x => x.key == pattern);\r\n }\r\n static getEffect(pattern) {\r\n const d = this.findEffect(pattern);\r\n if (d)\r\n return d;\r\n throw new Error(`Effect \"${pattern}\" not found.`);\r\n }\r\n //--------------------------------------------------------------------------\r\n static newEmittor(key) {\r\n const newId = this.emittors.length;\r\n const data = new DEmittor_1.DEmittor(newId, key);\r\n this.emittors.push(data);\r\n return data;\r\n }\r\n static cloneEmittor(src) {\r\n const newId = this.emittors.length;\r\n const data = new DEmittor_1.DEmittor(newId, src.effectSuite.selfEffect.effect.key);\r\n data.copyFrom(src);\r\n this.emittors.push(data);\r\n return data;\r\n }\r\n static findEmittor(pattern) {\r\n return this.findHelper(this.emittors, pattern, x => x.key == pattern);\r\n }\r\n static getEmittor(pattern) {\r\n const d = this.findEmittor(pattern);\r\n if (d)\r\n return d;\r\n throw new Error(`Emittor \"${pattern}\" not found.`);\r\n }\r\n static getEmittorById(id) {\r\n const d = this.emittors[id];\r\n if (d)\r\n return d;\r\n throw new Error(`Effect \"${id}\" not found.`);\r\n }\r\n //--------------------------------------------------------------------------\r\n static newTerrainShape(key) {\r\n const newId = this.terrainShapes.length;\r\n const data = new DTerrainPreset_1.DTerrainShape(newId);\r\n data.key = key;\r\n this.terrainShapes.push(data);\r\n return data;\r\n }\r\n static findTerrainShape(pattern) {\r\n const id = parseInt(pattern);\r\n if (!isNaN(id))\r\n return this.terrainShapes[id];\r\n else {\r\n return this.terrainShapes.find(e => (e.key != \"\" && e.key == pattern));\r\n }\r\n }\r\n static getTerrainShape(pattern) {\r\n const d = this.findTerrainShape(pattern);\r\n if (d)\r\n return d;\r\n throw new Error(`TerrainShape \"${pattern}\" not found.`);\r\n }\r\n //--------------------------------------------------------------------------\r\n static newTerrainSetting(key) {\r\n const newId = this.terrainSettings.length;\r\n const data = new DTerrainPreset_1.DTerrainSetting(newId);\r\n data.key = key;\r\n this.terrainSettings.push(data);\r\n return data;\r\n }\r\n static findTerrainSetting(pattern) {\r\n const id = parseInt(pattern);\r\n if (!isNaN(id))\r\n return this.terrainSettings[id];\r\n else {\r\n return this.terrainSettings.find(e => (e.key != \"\" && e.key == pattern));\r\n }\r\n }\r\n static getTerrainSetting(pattern) {\r\n const d = this.findTerrainSetting(pattern);\r\n if (d)\r\n return d;\r\n throw new Error(`TerrainSetting \"${pattern}\" not found.`);\r\n }\r\n //--------------------------------------------------------------------------\r\n static newFloorPreset(key) {\r\n const newId = this.floorPresets.length;\r\n const data = new DTerrainPreset_1.DFloorPreset(newId);\r\n data.key = key;\r\n this.floorPresets.push(data);\r\n return data;\r\n }\r\n static findFloorPreset(pattern) {\r\n const id = parseInt(pattern);\r\n if (!isNaN(id))\r\n return this.floorPresets[id];\r\n else {\r\n return this.floorPresets.find(e => (e.key != \"\" && e.key == pattern));\r\n }\r\n }\r\n static getFloorPreset(pattern) {\r\n const d = this.findFloorPreset(pattern);\r\n if (d)\r\n return d;\r\n throw new Error(`TerrainPreset \"${pattern}\" not found.`);\r\n }\r\n //--------------------------------------------------------------------------\r\n static newActor() {\r\n const entity = MRData.newEntity();\r\n const data = new DActor_1.DActor(MRData.actors.length);\r\n MRData.actors.push(data.id);\r\n entity.actor = data;\r\n return [entity, data];\r\n }\r\n static actorEntity(id) {\r\n return this.entities[this.enemies[id]];\r\n }\r\n static actorData(id) {\r\n return this.actorEntity(id).actorData();\r\n }\r\n static findActor(pattern) {\r\n const id = parseInt(pattern);\r\n if (!isNaN(id))\r\n return this.entities[this.actors[id]].actorData();\r\n else {\r\n const entityId = this.enemies.find(id => {\r\n const e = this.entities[id];\r\n return e.display.name == pattern || (e.entity.key != \"\" && e.entity.key == pattern);\r\n });\r\n if (!entityId)\r\n return undefined;\r\n else\r\n return this.entities[entityId].actorData();\r\n }\r\n }\r\n static getActor(pattern) {\r\n const d = this.findActor(pattern);\r\n if (d)\r\n return d;\r\n throw new Error(`Actor \"${pattern}\" not found.`);\r\n }\r\n //--------------------------------------------------------------------------\r\n static newEffectBehavior(key) {\r\n const data = new DSpecialEffect_1.DSpecialEffect(this.effectBehaviors.length, key);\r\n this.effectBehaviors.push(data);\r\n return data;\r\n }\r\n static findSpecialEffect(pattern) {\r\n return this.findHelper(this.effectBehaviors, pattern, x => x.key == pattern);\r\n }\r\n static getSpecialEffect(pattern) {\r\n const d = this.findSpecialEffect(pattern);\r\n if (d)\r\n return d;\r\n throw new Error(`SpecialEffect \"${pattern}\" not found.`);\r\n }\r\n //--------------------------------------------------------------------------\r\n // static newPreset(key: string): DPreset {\r\n // const data = new DPreset(this.presets.length, key);\r\n // this.presets.push(data);\r\n // return data;\r\n // }\r\n //--------------------------------------------------------------------------\r\n static newItem() {\r\n const entity = MRData.newEntity();\r\n const data = new DItem_1.DItem(MRData.items.length, entity.id);\r\n MRData.items.push(entity.id);\r\n entity.itemData = data;\r\n return [entity, data];\r\n }\r\n static itemEntity(id) {\r\n return this.entities[this.items[id]];\r\n }\r\n static itemData(id) {\r\n return this.itemEntity(id).item();\r\n }\r\n static findItem(pattern) {\r\n const id = parseInt(pattern);\r\n if (!isNaN(id))\r\n return this.entities[this.items[id]].item();\r\n else {\r\n const entityId = this.items.find(id => {\r\n const e = this.entities[id];\r\n return e.display.name == pattern || (e.entity.key != \"\" && e.entity.key == pattern);\r\n });\r\n if (!entityId)\r\n return undefined;\r\n else\r\n return this.entities[entityId].item();\r\n }\r\n }\r\n static getItem(pattern) {\r\n const d = this.findItem(pattern);\r\n if (d)\r\n return this.entities[d.entityId];\r\n throw new Error(`Item \"${pattern}\" not found.`);\r\n }\r\n static getItemFromRmmzWeaponId(rmmzWeaponId) {\r\n const id = MRData.items[MRData.weaponDataIdOffset + rmmzWeaponId];\r\n return this.entities[id];\r\n }\r\n static getItemFromRmmzArmorId(rmmzArmorId) {\r\n const id = MRData.items[MRData.armorDataIdOffset + rmmzArmorId];\r\n return this.entities[id];\r\n }\r\n //--------------------------------------------------------------------------\r\n static newEnemy() {\r\n const entity = MRData.newEntity();\r\n const data = new DEnemy_1.DEnemy(MRData.enemies.length, entity.id);\r\n MRData.enemies.push(entity.id);\r\n entity.enemy = data;\r\n return [entity, data];\r\n }\r\n static enemyEntity(id) {\r\n return this.entities[this.enemies[id]];\r\n }\r\n static enemyData(id) {\r\n return this.enemyEntity(id).enemyData();\r\n }\r\n static findEnemy(pattern) {\r\n const id = parseInt(pattern);\r\n if (!isNaN(id))\r\n return this.entities[this.enemies[id]].enemyData();\r\n else {\r\n const entityId = this.enemies.find(id => {\r\n const e = this.entities[id];\r\n return e.display.name == pattern || (e.entity.key != \"\" && e.entity.key == pattern);\r\n });\r\n if (!entityId)\r\n return undefined;\r\n else\r\n return this.entities[entityId].enemyData();\r\n }\r\n }\r\n static getEnemy(pattern) {\r\n const d = this.findEnemy(pattern);\r\n if (d)\r\n return d;\r\n throw new Error(`Enemy \"${pattern}\" not found.`);\r\n }\r\n //--------------------------------------------------------------------------\r\n static newTrait(key) {\r\n const data = new DTrait_1.DTrait(this.traits.length, key);\r\n MRData.traits.push(data);\r\n return data;\r\n }\r\n static getTrait(pattern) {\r\n const data = MRData.traits.find(x => x && x.key == pattern);\r\n if (data)\r\n return data;\r\n throw new Error(`Trait \"${pattern}\" not found.`);\r\n }\r\n //--------------------------------------------------------------------------\r\n static findPrefab(pattern) {\r\n // TODO: id\r\n return this.prefabs.find(p => p.key == pattern);\r\n }\r\n static getPrefab(pattern) {\r\n const d = this.findPrefab(pattern);\r\n if (d)\r\n return d;\r\n throw new Error(`Prefab \"${pattern}\" not found.`);\r\n }\r\n //--------------------------------------------------------------------------\r\n static findState(pattern) {\r\n const id = parseInt(pattern);\r\n if (!isNaN(id))\r\n return this.states[id];\r\n else\r\n return this.states.find(x => x.displayName == pattern || (x.key != \"\" && x.key == pattern));\r\n }\r\n static getState(pattern) {\r\n const d = this.findState(pattern);\r\n if (d)\r\n return d;\r\n throw new Error(`State \"${pattern}\" not found.`);\r\n }\r\n //--------------------------------------------------------------------------\r\n static findMonsterHouse(pattern) {\r\n const id = parseInt(pattern);\r\n if (!isNaN(id))\r\n return this.monsterHouses[id];\r\n else\r\n return this.monsterHouses.find(x => x.name == pattern /* || (x.key != \"\" && x.key == pattern)*/);\r\n }\r\n static getMonsterHouse(pattern) {\r\n const d = this.findMonsterHouse(pattern);\r\n if (d)\r\n return d;\r\n throw new Error(`MonsterHouse \"${pattern}\" not found.`);\r\n }\r\n //-------------------\r\n static newSkillAsActivity(key, displayName, priority) {\r\n const data = new DSkill_1.DSkill(this.skills.length, key);\r\n data.name = displayName;\r\n data.priority = priority !== null && priority !== void 0 ? priority : 0;\r\n data.isActivity = true;\r\n MRData.skills.push(data);\r\n return data;\r\n }\r\n static findSkill(pattern) {\r\n const id = parseInt(pattern);\r\n if (!isNaN(id))\r\n return this.skills[id];\r\n else\r\n return this.skills.find(x => x.name == pattern || (x.key != \"\" && x.key == pattern));\r\n }\r\n static getSkill(pattern) {\r\n const d = this.findSkill(pattern);\r\n if (d)\r\n return d;\r\n throw new Error(`Skill \"${pattern}\" not found.`);\r\n }\r\n //--------------------------------------------------------------------------\r\n static newQuest(key) {\r\n const data = new DQuest_1.DQuest(this.quests.length, key);\r\n this.quests.push(data);\r\n return data;\r\n }\r\n static findQuest(pattern) {\r\n return this.findHelper(this.quests, pattern, x => x.key === pattern);\r\n }\r\n static getQuest(pattern) {\r\n const d = this.findQuest(pattern);\r\n if (!d)\r\n throw new Error(`Quest \"${pattern}\" not found.`);\r\n return d;\r\n }\r\n //--------------------------------------------------------------------------\r\n static newQuestTask(key) {\r\n const data = new DQuest_1.DQuestTask(this.questTasks.length, key);\r\n this.questTasks.push(data);\r\n return data;\r\n }\r\n static findQuestTask(pattern) {\r\n return this.findHelper(this.questTasks, pattern, x => x.key === pattern);\r\n }\r\n static getQuestTask(pattern) {\r\n const d = this.findQuestTask(pattern);\r\n if (!d)\r\n throw new Error(`QuestTask \"${pattern}\" not found.`);\r\n return d;\r\n }\r\n //--------------------------------------------------------------------------\r\n static newBehavior(key, fullName, friendlyName) {\r\n const data = new DBehavior_1.DBehavior(this.behavior.length, key, fullName, friendlyName);\r\n this.behavior.push(data);\r\n return data;\r\n }\r\n static getBehavior(pattern) {\r\n const d = this.findHelper(this.behavior, pattern, x => x.key === pattern || x.fullName === pattern || x.friendlyName === pattern);\r\n if (!d)\r\n throw new Error(`Behavior \"${pattern}\" not found.`);\r\n return d;\r\n }\r\n //--------------------------------------------------------------------------\r\n static verify() {\r\n this.entities.forEach(x => x.verify());\r\n }\r\n static findHelper(list, pattern, predicate) {\r\n const id = parseInt(pattern);\r\n if (!isNaN(id))\r\n return list[id];\r\n else {\r\n return list.find(predicate);\r\n }\r\n }\r\n}\r\nexports.MRData = MRData;\r\nMRData.MAX_DUNGEON_FLOORS = 100;\r\nMRData.testMode = false;\r\n// Common defineds.\r\nMRData.NormalAttackSkillId = 1;\r\nMRData.ext = new MRDataExtension_1.MRDataExtension();\r\nMRData.elements = [];\r\nMRData.equipmentParts = [];\r\nMRData.categories = [];\r\nMRData.classes = [];\r\nMRData.races = [];\r\nMRData.actors = [];\r\nMRData.enemies = [];\r\nMRData.lands = [];\r\nMRData.maps = []; // 1~マップ最大数までは、MapId と一致する。それより後は Land の Floor.\r\nMRData.templateMaps = [];\r\nMRData.factions = [];\r\n//static actions: DAction[] = [];\r\nMRData.commands = [];\r\nMRData.sequels = [{ id: 0, name: \"null\", parallel: false, fluidSequence: false }];\r\nMRData.parameters = [];\r\nMRData.effectBehaviors = [];\r\n// static presets: DPreset[] = [];\r\nMRData.skills = [];\r\nMRData.items = [];\r\nMRData.traits = [];\r\nMRData.states = [];\r\nMRData.stateGroups = [];\r\nMRData.abilities = [];\r\nMRData.monsterHouses = [];\r\nMRData.itemShops = [];\r\nMRData.prefabs = [];\r\nMRData.entities = [];\r\nMRData.entityTemplates = [];\r\nMRData.troops = [];\r\nMRData.emittors = [];\r\nMRData.effects = [];\r\nMRData.terrainShapes = [];\r\nMRData.terrainSettings = [];\r\nMRData.floorPresets = [];\r\nMRData.pseudonymous = new DPseudonymous_1.DPseudonymous();\r\nMRData.quests = [];\r\nMRData.questTasks = [];\r\nMRData.behavior = [];\r\nMRData.itemDataIdOffset = 0;\r\nMRData.weaponDataIdOffset = 0;\r\nMRData.armorDataIdOffset = 0;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/MRData.ts?"); /***/ }), /***/ "./ts/mr/data/MRDataExtension.ts": /*!***************************************!*\ !*** ./ts/mr/data/MRDataExtension.ts ***! \***************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.MRDataExtension = void 0;\r\nclass MRDataExtension {\r\n onDatabaseLoaded() {\r\n }\r\n}\r\nexports.MRDataExtension = MRDataExtension;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/MRDataExtension.ts?"); /***/ }), /***/ "./ts/mr/data/MRDataManager.ts": /*!*************************************!*\ !*** ./ts/mr/data/MRDataManager.ts ***! \*************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __importDefault = (this && this.__importDefault) || function (mod) {\r\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.MRDataManager = void 0;\r\nconst fs_1 = __importDefault(__webpack_require__(/*! fs */ \"fs\"));\r\nconst MRSystem_1 = __webpack_require__(/*! ts/mr/system/MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ./MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ./MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst DState_1 = __webpack_require__(/*! ./DState */ \"./ts/mr/data/DState.ts\");\r\nconst DEquipmentType_1 = __webpack_require__(/*! ./DEquipmentType */ \"./ts/mr/data/DEquipmentType.ts\");\r\nconst DAbility_1 = __webpack_require__(/*! ./DAbility */ \"./ts/mr/data/DAbility.ts\");\r\nconst DEntityProperties_1 = __webpack_require__(/*! ./DEntityProperties */ \"./ts/mr/data/DEntityProperties.ts\");\r\nconst DLand_1 = __webpack_require__(/*! ./DLand */ \"./ts/mr/data/DLand.ts\");\r\nconst DHelper_1 = __webpack_require__(/*! ./DHelper */ \"./ts/mr/data/DHelper.ts\");\r\nconst DPrefab_1 = __webpack_require__(/*! ./DPrefab */ \"./ts/mr/data/DPrefab.ts\");\r\nconst DItem_1 = __webpack_require__(/*! ./DItem */ \"./ts/mr/data/DItem.ts\");\r\nconst DTrait_1 = __webpack_require__(/*! ./DTrait */ \"./ts/mr/data/DTrait.ts\");\r\nconst DEffect_1 = __webpack_require__(/*! ./DEffect */ \"./ts/mr/data/DEffect.ts\");\r\nconst DSystem_1 = __webpack_require__(/*! ./DSystem */ \"./ts/mr/data/DSystem.ts\");\r\nconst DSkill_1 = __webpack_require__(/*! ./DSkill */ \"./ts/mr/data/DSkill.ts\");\r\nconst DTroop_1 = __webpack_require__(/*! ./DTroop */ \"./ts/mr/data/DTroop.ts\");\r\nconst DStateGroup_1 = __webpack_require__(/*! ./DStateGroup */ \"./ts/mr/data/DStateGroup.ts\");\r\nconst MRSetup_1 = __webpack_require__(/*! ./MRSetup */ \"./ts/mr/data/MRSetup.ts\");\r\nconst DParameter_1 = __webpack_require__(/*! ./DParameter */ \"./ts/mr/data/DParameter.ts\");\r\nconst DDataImporter_1 = __webpack_require__(/*! ./DDataImporter */ \"./ts/mr/data/DDataImporter.ts\");\r\nconst DEnemy_1 = __webpack_require__(/*! ./DEnemy */ \"./ts/mr/data/DEnemy.ts\");\r\nconst DTextManager_1 = __webpack_require__(/*! ./DTextManager */ \"./ts/mr/data/DTextManager.ts\");\r\nconst DAnnotationReader_1 = __webpack_require__(/*! ./importers/DAnnotationReader */ \"./ts/mr/data/importers/DAnnotationReader.ts\");\r\nconst DMetadataParser_1 = __webpack_require__(/*! ./importers/DMetadataParser */ \"./ts/mr/data/importers/DMetadataParser.ts\");\r\nconst DSetupScript_1 = __webpack_require__(/*! ./importers/DSetupScript */ \"./ts/mr/data/importers/DSetupScript.ts\");\r\nconst DTerrainPreset_1 = __webpack_require__(/*! ./DTerrainPreset */ \"./ts/mr/data/DTerrainPreset.ts\");\r\nconst PluginParameters_1 = __webpack_require__(/*! ../PluginParameters */ \"./ts/mr/PluginParameters.ts\");\r\nconst DTerrainSettingImporter_1 = __webpack_require__(/*! ./importers/DTerrainSettingImporter */ \"./ts/mr/data/importers/DTerrainSettingImporter.ts\");\r\nconst DFloorPresetImporter_1 = __webpack_require__(/*! ./importers/DFloorPresetImporter */ \"./ts/mr/data/importers/DFloorPresetImporter.ts\");\r\nconst DFlavorEffect_1 = __webpack_require__(/*! ./DFlavorEffect */ \"./ts/mr/data/DFlavorEffect.ts\");\r\nconst DValidationHelper_1 = __webpack_require__(/*! ./DValidationHelper */ \"./ts/mr/data/DValidationHelper.ts\");\r\nconst DMap_1 = __webpack_require__(/*! ./DMap */ \"./ts/mr/data/DMap.ts\");\r\nconst DEffectSuite_1 = __webpack_require__(/*! ./DEffectSuite */ \"./ts/mr/data/DEffectSuite.ts\");\r\nconst DScript_1 = __webpack_require__(/*! ./DScript */ \"./ts/mr/data/DScript.ts\");\r\nclass MRDataManager {\r\n static load() {\r\n // 各種データファイルの読み込みは非同期で行われることを想定しなければならないが、\r\n // RMMZ からインポートしたデータをさらに加工するにあたり、順序依存が必要になるものがある。\r\n // 愚直に実装するとコールバック地獄になるため、簡易的な Promise のような仕組みで、直列的に実行されるようにする。\r\n this._loadTasks = [];\r\n this._loadTasks.push((n) => this.setupCommonData(n));\r\n this._loadTasks.push((n) => this.loadData(n));\r\n this._loadTasks.push((n) => this.importTerrainSettings(n));\r\n this._loadTasks.push((n) => this.importFloorPreset(n));\r\n this._loadTasks.push((n) => this.importLandAndFloors(n));\r\n this._loadTasks.push((n) => this.importPseudonymous(n));\r\n this._loadTasks.push((n) => this.importPrefabs(n));\r\n this._loadTasks.push((n) => this.importLandDatabase(n));\r\n this._loadTasks.push((n) => this.importTemplateMaps(n));\r\n this._loadTasks.push((n) => this.importSetupScript(n));\r\n this._loadTasks.push((n) => this.notifyDatabaseReady(n));\r\n if (DHelper_1.DHelpers.isNode()) {\r\n this._currentTask = this._loadTasks.shift();\r\n while (this._currentTask) {\r\n const task = this._currentTask;\r\n this._currentTask = undefined;\r\n task(() => this.nextFunc());\r\n }\r\n }\r\n else {\r\n this._currentTask = this._loadTasks.shift();\r\n (0, Common_1.assert)(this._currentTask);\r\n this._currentTask(this.nextFunc);\r\n }\r\n }\r\n static isImportCompleted() {\r\n return this._currentTask == undefined && this._loadingDataFileCount == this._loadedDataFileCount;\r\n }\r\n static nextFunc() {\r\n if (this._loadTasks.length > 0) {\r\n this._currentTask = this._loadTasks.shift();\r\n }\r\n else {\r\n this._currentTask = undefined;\r\n }\r\n }\r\n static setupCommonData(next) {\r\n MRData_1.MRData.reset();\r\n // Events\r\n {\r\n MRBasics_1.MRBasics.events = {\r\n roomEnterd: 1,\r\n roomLeaved: 2,\r\n preWalk: 3,\r\n walked: 4,\r\n prePut: 5,\r\n effectReacted: 6,\r\n skillEmitted: 7,\r\n itemRemovedFromInventory: 8,\r\n };\r\n }\r\n // Parameters\r\n MRData_1.MRData.parameters = [\r\n DParameter_1.DParameter.makeBuiltin(0, \"null\", \"null\", \"null\", -1, 0, 0, Infinity, false),\r\n DParameter_1.DParameter.makeBuiltin(1, \"hp\", \"HP\", (0, Common_1.tr2)(\"最大HP\"), 0, 0, 0, Infinity, true),\r\n DParameter_1.DParameter.makeBuiltin(2, \"mp\", \"MP\", (0, Common_1.tr2)(\"最大MP\"), 1, 0, 0, Infinity, true),\r\n DParameter_1.DParameter.makeBuiltin(3, \"atk\", \"ATK\", (0, Common_1.tr2)(\"最大ATK\"), 2, 0, 0, Infinity, true),\r\n DParameter_1.DParameter.makeBuiltin(4, \"def\", \"DEF\", (0, Common_1.tr2)(\"最大DEF\"), 3, 0, 0, Infinity, true),\r\n DParameter_1.DParameter.makeBuiltin(5, \"mat\", \"MAT\", (0, Common_1.tr2)(\"最大MAT\"), 4, 0, 0, Infinity, true),\r\n DParameter_1.DParameter.makeBuiltin(6, \"mdf\", \"MDF\", (0, Common_1.tr2)(\"最大MDF\"), 5, 0, 0, Infinity, true),\r\n DParameter_1.DParameter.makeBuiltin(7, \"agi\", \"AGI\", (0, Common_1.tr2)(\"最大AGI\"), 6, 0, -100, 200, true),\r\n DParameter_1.DParameter.makeBuiltin(8, \"luk\", \"LUK\", (0, Common_1.tr2)(\"最大LUK\"), 7, 0, 0, Infinity, true),\r\n DParameter_1.DParameter.makeBuiltin(9, \"tp\", \"TP\", (0, Common_1.tr2)(\"最大TP\"), 8, 0, 0, Infinity, true),\r\n //----------\r\n DParameter_1.DParameter.makeBuiltin(10, \"fp\", (0, Common_1.tr2)(\"満腹度\"), (0, Common_1.tr2)(\"最大満腹度\"), -1, 10000, 0, Infinity, true),\r\n DParameter_1.DParameter.makeBuiltin(11, \"pow\", (0, Common_1.tr2)(\"ちから\"), (0, Common_1.tr2)(\"ちからの最大値\"), -1, 8, 0, Infinity, true),\r\n DParameter_1.DParameter.makeBuiltin(12, \"upg\", (0, Common_1.tr2)(\"つよさ\"), (0, Common_1.tr2)(\"つよさの最大値\"), -1, 99, -Infinity, Infinity, false),\r\n DParameter_1.DParameter.makeBuiltin(13, \"rem\", (0, Common_1.tr2)(\"回数\"), (0, Common_1.tr2)(\"最大回数\"), -1, 99, 0, Infinity, false),\r\n DParameter_1.DParameter.makeBuiltin(14, \"cap\", \"Capacity\", (0, Common_1.tr2)(\"最大容量\"), -1, 8, 0, Infinity, false),\r\n DParameter_1.DParameter.makeBuiltin(15, \"gold\", \"Gold\", (0, Common_1.tr2)(\"最大ゴールド\"), -1, 999999, 10, Infinity, false),\r\n DParameter_1.DParameter.makeBuiltin(16, \"level\", (0, Common_1.tr2)(\"レベル\"), (0, Common_1.tr2)(\"レベル\"), -1, 99, 1, Infinity, false),\r\n DParameter_1.DParameter.makeBuiltin(17, \"exp\", (0, Common_1.tr2)(\"経験値\"), (0, Common_1.tr2)(\"最大経験値\"), -1, 9999999, 0, Infinity, false),\r\n ];\r\n MRBasics_1.MRBasics.params = {\r\n hp: MRData_1.MRData.parameters.findIndex(x => x.code == \"hp\"),\r\n mp: MRData_1.MRData.parameters.findIndex(x => x.code == \"mp\"),\r\n atk: MRData_1.MRData.parameters.findIndex(x => x.code == \"atk\"),\r\n def: MRData_1.MRData.parameters.findIndex(x => x.code == \"def\"),\r\n mat: MRData_1.MRData.parameters.findIndex(x => x.code == \"mat\"),\r\n mdf: MRData_1.MRData.parameters.findIndex(x => x.code == \"mdf\"),\r\n agi: MRData_1.MRData.parameters.findIndex(x => x.code == \"agi\"),\r\n luk: MRData_1.MRData.parameters.findIndex(x => x.code == \"luk\"),\r\n tp: MRData_1.MRData.parameters.findIndex(x => x.code == \"tp\"),\r\n fp: MRData_1.MRData.parameters.findIndex(x => x.code == \"fp\"),\r\n pow: MRData_1.MRData.parameters.findIndex(x => x.code == \"pow\"),\r\n upgradeValue: MRData_1.MRData.parameters.findIndex(x => x.code == \"upg\"),\r\n remaining: MRData_1.MRData.parameters.findIndex(x => x.code == \"rem\"),\r\n //capacity: MRData.parameters.findIndex(x => x.code == \"cap\"),\r\n gold: MRData_1.MRData.parameters.findIndex(x => x.code == \"gold\"),\r\n level: MRData_1.MRData.parameters.findIndex(x => x.code == \"level\"),\r\n exp: MRData_1.MRData.parameters.findIndex(x => x.code == \"exp\"),\r\n };\r\n // RMMZ のパラメータID との一致を検証\r\n (0, Common_1.assert)(MRData_1.MRData.parameters[MRBasics_1.MRBasics.params.hp].battlerParamId === 0);\r\n (0, Common_1.assert)(MRData_1.MRData.parameters[MRBasics_1.MRBasics.params.mp].battlerParamId === 1);\r\n (0, Common_1.assert)(MRData_1.MRData.parameters[MRBasics_1.MRBasics.params.atk].battlerParamId === 2);\r\n (0, Common_1.assert)(MRData_1.MRData.parameters[MRBasics_1.MRBasics.params.def].battlerParamId === 3);\r\n (0, Common_1.assert)(MRData_1.MRData.parameters[MRBasics_1.MRBasics.params.mat].battlerParamId === 4);\r\n (0, Common_1.assert)(MRData_1.MRData.parameters[MRBasics_1.MRBasics.params.mdf].battlerParamId === 5);\r\n (0, Common_1.assert)(MRData_1.MRData.parameters[MRBasics_1.MRBasics.params.agi].battlerParamId === 6);\r\n (0, Common_1.assert)(MRData_1.MRData.parameters[MRBasics_1.MRBasics.params.luk].battlerParamId === 7);\r\n MRData_1.MRData.parameters[MRBasics_1.MRBasics.params.fp].magnification = 0.01;\r\n MRData_1.MRData.parameters[MRBasics_1.MRBasics.params.fp].friendlySideMessages = [\r\n { condition: \"value >= max\", message: (0, Common_1.tr)(\"%1はおなかがいっぱいになった。\") },\r\n { condition: \"value < max\", message: (0, Common_1.tr)(\"%1はおなかがふくれた。\") }\r\n ];\r\n MRData_1.MRData.parameters[MRBasics_1.MRBasics.params.pow].selfGainMessage = DTextManager_1.DTextManager.actorGain;\r\n MRData_1.MRData.parameters[MRBasics_1.MRBasics.params.pow].selfLossMessage = DTextManager_1.DTextManager.actorLoss;\r\n MRData_1.MRData.parameters[MRBasics_1.MRBasics.params.pow].targetGainMessage = DTextManager_1.DTextManager.actorGain;\r\n MRData_1.MRData.parameters[MRBasics_1.MRBasics.params.pow].targetLossMessage = DTextManager_1.DTextManager.enemyLoss;\r\n MRData_1.MRData.parameters[MRBasics_1.MRBasics.params.upgradeValue].selfGainMessage = DTextManager_1.DTextManager.actorGain;\r\n MRData_1.MRData.parameters[MRBasics_1.MRBasics.params.upgradeValue].selfLossMessage = DTextManager_1.DTextManager.actorLoss;\r\n MRData_1.MRData.parameters[MRBasics_1.MRBasics.params.upgradeValue].targetGainMessage = DTextManager_1.DTextManager.actorGain;\r\n MRData_1.MRData.parameters[MRBasics_1.MRBasics.params.upgradeValue].targetLossMessage = DTextManager_1.DTextManager.enemyLoss;\r\n MRData_1.MRData.parameters[MRBasics_1.MRBasics.params.level].initialValue = 1;\r\n //MRData.parameters[MRBasics.params.level].type = DParameterType.Dependent;\r\n MRData_1.MRData.parameters[MRBasics_1.MRBasics.params.level].allowDamage = false;\r\n MRData_1.MRData.parameters[MRBasics_1.MRBasics.params.level].initialIdealValue = 0;\r\n MRData_1.MRData.parameters[MRBasics_1.MRBasics.params.level].maxEffortLimit = 99;\r\n MRData_1.MRData.parameters[MRBasics_1.MRBasics.params.exp].initialValue = 0;\r\n MRData_1.MRData.parameters[MRBasics_1.MRBasics.params.level].selfGainMessage = DTextManager_1.DTextManager.levelUp;\r\n //REData.parameters[REBasics.params.level].selfLossMessage = DTextManager.actorLoss;\r\n MRData_1.MRData.parameters[MRBasics_1.MRBasics.params.level].targetGainMessage = DTextManager_1.DTextManager.levelUp;\r\n //REData.parameters[REBasics.params.level].targetLossMessage = DTextManager.enemyLoss;\r\n MRData_1.MRData.parameters[MRBasics_1.MRBasics.params.level].messageValueSource = DParameter_1.DParamMessageValueSource.Absolute;\r\n for (const param of MRData_1.MRData.parameters) {\r\n MRSetup_1.MRSetup.setupParameter(param);\r\n }\r\n MRBasics_1.MRBasics.entityCategories = {\r\n actor: MRData_1.MRData.newEntityCategory(\"kEntityCategory_Actor\", \"Actor\").id,\r\n WeaponKindId: MRData_1.MRData.newEntityCategory(\"kEntityCategory_Weapon\", \"武器\").id,\r\n ShieldKindId: MRData_1.MRData.newEntityCategory(\"kEntityCategory_Shield\", \"盾\").id,\r\n armor: MRData_1.MRData.newEntityCategory(\"kEntityCategory_Armor\", \"盾\").id,\r\n ArrowKindId: MRData_1.MRData.newEntityCategory(\"kEntityCategory_Arrow\", \"矢\").id,\r\n //RE_Data.addEntityKind(\"石\"),\r\n //RE_Data.addEntityKind(\"弾\"),\r\n BraceletKindId: MRData_1.MRData.newEntityCategory(\"kEntityCategory_Ring\", \"腕輪\").id,\r\n FoodKindId: MRData_1.MRData.newEntityCategory(\"kEntityCategory_Food\", \"食料\").id,\r\n grass: MRData_1.MRData.newEntityCategory(\"kEntityCategory_Grass\", \"草\").id,\r\n ScrollKindId: MRData_1.MRData.newEntityCategory(\"kEntityCategory_Scroll\", \"巻物\").id,\r\n WandKindId: MRData_1.MRData.newEntityCategory(\"kEntityCategory_Staff\", \"杖\").id,\r\n PotKindId: MRData_1.MRData.newEntityCategory(\"kEntityCategory_Pot\", \"壺\").id,\r\n DiscountTicketKindId: MRData_1.MRData.newEntityCategory(\"kEntityCategory_DiscountTicket\", \"割引券\").id,\r\n BuildingMaterialKindId: MRData_1.MRData.newEntityCategory(\"kEntityCategory_BuildingMaterial\", \"材料\").id,\r\n TrapKindId: MRData_1.MRData.newEntityCategory(\"kEntityCategory_Trap\", \"罠\").id,\r\n FigurineKindId: MRData_1.MRData.newEntityCategory(\"kEntityCategory_Figurine\", \"土偶\").id,\r\n MonsterKindId: MRData_1.MRData.newEntityCategory(\"kEntityCategory_Enemy\", \"モンスター\").id,\r\n entryPoint: MRData_1.MRData.newEntityCategory(\"kEntityCategory_EntryPoint\", \"入り口\").id,\r\n exitPoint: MRData_1.MRData.newEntityCategory(\"kEntityCategory_ExitPoint\", \"出口\").id,\r\n Ornament: MRData_1.MRData.newEntityCategory(\"kEntityCategory_Ornament\", \"Ornament\").id,\r\n };\r\n MRBasics_1.MRBasics.xparams = {\r\n hit: 0,\r\n eva: 1,\r\n cri: 2,\r\n cev: 3,\r\n mev: 4,\r\n mrf: 5,\r\n cnt: 6,\r\n hrg: 7,\r\n mrg: 8,\r\n trg: 9,\r\n };\r\n MRBasics_1.MRBasics.sparams = {\r\n tgr: 0,\r\n grd: 1,\r\n rec: 2,\r\n pha: 3,\r\n mcr: 4,\r\n tcr: 5,\r\n pdr: 6,\r\n mdr: 7,\r\n fdr: 8,\r\n exr: 9,\r\n };\r\n // StateTraits\r\n {\r\n MRData_1.MRData.traits = [];\r\n MRBasics_1.MRBasics.traits = {};\r\n MRData_1.MRData.traits[11] = new DTrait_1.DTrait(11, \"TRAIT_ELEMENT_RATE\");\r\n MRBasics_1.MRBasics.traits.TRAIT_ELEMENT_RATE = 11;\r\n MRData_1.MRData.traits[12] = new DTrait_1.DTrait(12, \"TRAIT_DEBUFF_RATE\");\r\n MRBasics_1.MRBasics.traits.TRAIT_DEBUFF_RATE = 12;\r\n MRData_1.MRData.traits[13] = new DTrait_1.DTrait(13, \"TRAIT_STATE_RATE\");\r\n MRBasics_1.MRBasics.traits.TRAIT_STATE_RATE = 13;\r\n MRData_1.MRData.traits[14] = new DTrait_1.DTrait(14, \"TRAIT_STATE_RESIST\");\r\n MRBasics_1.MRBasics.traits.TRAIT_STATE_RESIST = 14;\r\n MRData_1.MRData.traits[21] = new DTrait_1.DTrait(21, \"TRAIT_PARAM\");\r\n MRBasics_1.MRBasics.traits.TRAIT_PARAM = 21;\r\n MRData_1.MRData.traits[22] = new DTrait_1.DTrait(22, \"TRAIT_XPARAM\");\r\n MRBasics_1.MRBasics.traits.TRAIT_XPARAM = 22;\r\n MRData_1.MRData.traits[23] = new DTrait_1.DTrait(23, \"TRAIT_SPARAM\");\r\n MRBasics_1.MRBasics.traits.TRAIT_SPARAM = 23;\r\n MRData_1.MRData.traits[31] = new DTrait_1.DTrait(31, \"TRAIT_ATTACK_ELEMENT\");\r\n MRBasics_1.MRBasics.traits.TRAIT_ATTACK_ELEMENT = 31;\r\n MRData_1.MRData.traits[32] = new DTrait_1.DTrait(32, \"TRAIT_ATTACK_STATE\");\r\n MRBasics_1.MRBasics.traits.TRAIT_ATTACK_STATE = 32;\r\n MRData_1.MRData.traits[33] = new DTrait_1.DTrait(33, \"TRAIT_ATTACK_SPEED\");\r\n MRBasics_1.MRBasics.traits.TRAIT_ATTACK_SPEED = 33;\r\n MRData_1.MRData.traits[34] = new DTrait_1.DTrait(34, \"TRAIT_ATTACK_TIMES\");\r\n MRBasics_1.MRBasics.traits.TRAIT_ATTACK_TIMES = 34;\r\n MRData_1.MRData.traits[35] = new DTrait_1.DTrait(35, \"TRAIT_ATTACK_SKILL\");\r\n MRBasics_1.MRBasics.traits.TRAIT_ATTACK_SKILL = 35;\r\n MRData_1.MRData.traits[41] = new DTrait_1.DTrait(41, \"TRAIT_STYPE_ADD\");\r\n MRBasics_1.MRBasics.traits.TRAIT_STYPE_ADD = 41;\r\n MRData_1.MRData.traits[42] = new DTrait_1.DTrait(42, \"TRAIT_STYPE_SEAL\");\r\n MRBasics_1.MRBasics.traits.TRAIT_STYPE_SEAL = 42;\r\n MRData_1.MRData.traits[43] = new DTrait_1.DTrait(43, \"TRAIT_SKILL_ADD\");\r\n MRBasics_1.MRBasics.traits.TRAIT_SKILL_ADD = 43;\r\n MRData_1.MRData.traits[44] = new DTrait_1.DTrait(44, \"TRAIT_SKILL_SEAL\");\r\n MRBasics_1.MRBasics.traits.TRAIT_SKILL_SEAL = 44;\r\n MRData_1.MRData.traits[51] = new DTrait_1.DTrait(51, \"TRAIT_EQUIP_WTYPE\");\r\n MRBasics_1.MRBasics.traits.TRAIT_EQUIP_WTYPE = 51;\r\n MRData_1.MRData.traits[52] = new DTrait_1.DTrait(52, \"TRAIT_EQUIP_ATYPE\");\r\n MRBasics_1.MRBasics.traits.TRAIT_EQUIP_ATYPE = 52;\r\n MRData_1.MRData.traits[53] = new DTrait_1.DTrait(53, \"TRAIT_EQUIP_LOCK\");\r\n MRBasics_1.MRBasics.traits.TRAIT_EQUIP_LOCK = 53;\r\n MRData_1.MRData.traits[54] = new DTrait_1.DTrait(54, \"TRAIT_EQUIP_SEAL\");\r\n MRBasics_1.MRBasics.traits.TRAIT_EQUIP_SEAL = 54;\r\n MRData_1.MRData.traits[55] = new DTrait_1.DTrait(55, \"TRAIT_SLOT_TYPE\");\r\n MRBasics_1.MRBasics.traits.TRAIT_SLOT_TYPE = 55;\r\n MRData_1.MRData.traits[61] = new DTrait_1.DTrait(61, \"TRAIT_ACTION_PLUS\");\r\n MRBasics_1.MRBasics.traits.TRAIT_ACTION_PLUS = 61;\r\n MRData_1.MRData.traits[62] = new DTrait_1.DTrait(62, \"TRAIT_SPECIAL_FLAG\");\r\n MRBasics_1.MRBasics.traits.TRAIT_SPECIAL_FLAG = 62;\r\n MRData_1.MRData.traits[63] = new DTrait_1.DTrait(63, \"TRAIT_COLLAPSE_TYPE\");\r\n MRBasics_1.MRBasics.traits.TRAIT_COLLAPSE_TYPE = 63;\r\n MRData_1.MRData.traits[64] = new DTrait_1.DTrait(64, \"TRAIT_PARTY_ABILITY\");\r\n MRBasics_1.MRBasics.traits.TRAIT_PARTY_ABILITY = 64;\r\n MRBasics_1.MRBasics.traits._separator = MRData_1.MRData.newTrait(\"_separator\").id;\r\n MRBasics_1.MRBasics.traits.CertainDirectAttack = MRData_1.MRData.newTrait(\"CertainDirectAttack\").id;\r\n MRBasics_1.MRBasics.traits.DodgePhysicalIndirectAttack = MRData_1.MRData.newTrait(\"CartailDodgePhysicalAttack\").id;\r\n MRBasics_1.MRBasics.traits.AwfulPhysicalIndirectAttack = MRData_1.MRData.newTrait(\"AwfulPhysicalIndirectAttack\").id;\r\n MRBasics_1.MRBasics.traits.UnitVisitor = MRData_1.MRData.newTrait(\"UnitVisitor\").id;\r\n MRBasics_1.MRBasics.traits.StateRemoveByEffect = MRData_1.MRData.newTrait(\"StateRemoveByEffect\").id;\r\n MRBasics_1.MRBasics.traits.Stackable = MRData_1.MRData.newTrait(\"Stackable\").id;\r\n MRBasics_1.MRBasics.traits.EffectProficiency = MRData_1.MRData.newTrait(\"EffectProficiency\").id;\r\n MRBasics_1.MRBasics.traits.EquipmentProficiency = MRData_1.MRData.newTrait(\"EquipmentProficiency\").id;\r\n MRBasics_1.MRBasics.traits.SealActivity = MRData_1.MRData.newTrait(\"SealActivity\").id;\r\n MRBasics_1.MRBasics.traits.SealSpecialAbility = MRData_1.MRData.newTrait(\"SealSpecialAbility\").id;\r\n MRBasics_1.MRBasics.traits.Invisible = MRData_1.MRData.newTrait(\"Invisible\").id;\r\n MRBasics_1.MRBasics.traits.ForceVisible = MRData_1.MRData.newTrait(\"ForceVisible\").id;\r\n MRBasics_1.MRBasics.traits.ItemDropRate = MRData_1.MRData.newTrait(\"ItemDropRate\").id;\r\n MRBasics_1.MRBasics.traits.FixedDamage = MRData_1.MRData.newTrait(\"FixedDamage\").id;\r\n MRBasics_1.MRBasics.traits.DrawInTrap = MRData_1.MRData.newTrait(\"DrawInTrap\").id;\r\n MRBasics_1.MRBasics.traits.AwakeStep = MRData_1.MRData.newTrait(\"AwakeStep\").id;\r\n MRBasics_1.MRBasics.traits.SilentStep = MRData_1.MRData.newTrait(\"SilentStep\").id;\r\n MRBasics_1.MRBasics.traits.SuddenSkillEffect = MRData_1.MRData.newTrait(\"AutoSkillEffect\").id;\r\n MRBasics_1.MRBasics.traits.SurvivalParamLossRate = MRData_1.MRData.newTrait(\"SurvivalParamLossRate\").id;\r\n MRBasics_1.MRBasics.traits.ParamDamageRate = MRData_1.MRData.newTrait(\"ParamDamageRate\").id;\r\n MRBasics_1.MRBasics.traits.SkillGuard = MRData_1.MRData.newTrait(\"SkillGuard\").id;\r\n MRBasics_1.MRBasics.traits.DisableTrap = MRData_1.MRData.newTrait(\"DisableTrap\").id;\r\n //REBasics.traits.RecoverRate = REData.newTrait(\"RecoverRate\").id;\r\n //REBasics.traits.ElementedRecoverRate = REData.newTrait(\"ElementedRecoverRate\").id;\r\n MRBasics_1.MRBasics.traits.ElementedRecoveryRate = MRData_1.MRData.newTrait(\"ElementedRecoverRate\").id;\r\n MRBasics_1.MRBasics.traits.RaceRate = MRData_1.MRData.newTrait(\"RaceRate\").id;\r\n MRBasics_1.MRBasics.traits.PhysicalProjectileReflector = MRData_1.MRData.newTrait(\"PhysicalProjectileReflector\").id;\r\n MRBasics_1.MRBasics.traits.PenetrationItem = MRData_1.MRData.newTrait(\"PenetrationItem\").id;\r\n MRBasics_1.MRBasics.traits.PenetrationThrower = MRData_1.MRData.newTrait(\"PenetrationThrower\").id;\r\n MRBasics_1.MRBasics.traits.DeathVulnerableElement = MRData_1.MRData.newTrait(\"DeathVulnerableElement\").id;\r\n MRBasics_1.MRBasics.traits.ForceParameter = MRData_1.MRData.newTrait(\"ForceParameter\").id;\r\n MRBasics_1.MRBasics.traits.DisableMovement = MRData_1.MRData.newTrait(\"DisableMovement\").id;\r\n MRBasics_1.MRBasics.traits.DisallowIntoStorage = MRData_1.MRData.newTrait(\"DisallowIntoStorage\").id;\r\n MRBasics_1.MRBasics.traits.StorageProtection = MRData_1.MRData.newTrait(\"StorageProtection\").id;\r\n }\r\n // Factions\r\n {\r\n MRData_1.MRData.factions = [\r\n { id: 0, name: '', schedulingOrder: 9999, hostileBits: 0, friendBits: 0 },\r\n { id: 1, name: 'Friends', schedulingOrder: 1, hostileBits: 0b0100, friendBits: 0 },\r\n { id: 2, name: 'Enemy', schedulingOrder: 2, hostileBits: 0b0010, friendBits: 0 },\r\n { id: 3, name: 'Neutral', schedulingOrder: 3, hostileBits: 0, friendBits: 0 },\r\n ];\r\n }\r\n // // Actions\r\n // MRBasics.actions = {\r\n // DirectionChangeActionId: MRData.newAction(\"kAction_DirectionChange\", \"DirectionChange\").id,\r\n // MoveToAdjacentActionId: MRData.newAction(\"kAction_MoveToAdjacent\", \"MoveToAdjacent\").id,\r\n // PickActionId: MRData.newAction(\"kAction_Pick\", \"拾う\").id,\r\n // PutActionId: MRData.newAction(\"kAction_Put\", \"置く\").id,\r\n // ExchangeActionId: MRData.newAction(\"kAction_Exchange\", \"交換\").id,\r\n // ThrowActionId: MRData.newAction(\"kAction_Throw\", \"投げる\").id,\r\n // FlungActionId: MRData.newAction(\"kAction_Flung\", \"Flung\").id,\r\n // ShootActionId: MRData.newAction(\"kAction_Shoot\", \"撃つ\", 1000).id,\r\n // AffectActionId: MRData.newAction(\"kAction_Affect\", \"Affect\").id,\r\n // RollActionId: MRData.newAction(\"kAction_Roll\", \"Roll\").id,\r\n // FallActionId: MRData.newAction(\"kAction_Fall\", \"Fall\").id,\r\n // DropActionId: MRData.newAction(\"kAction_Drop\", \"Drop\").id,\r\n // trample: MRData.newAction(\"kAction_Trample\", \"踏む\").id,\r\n // TrashActionId: MRData.newAction(\"kAction_Trash\", \"Trash\").id,\r\n // ForwardFloorActionId: MRData.newAction(\"kAction_ForwardFloor\", \"すすむ\").id,\r\n // BackwardFloorActionId: MRData.newAction(\"kAction_BackwardFloor\", \"戻る\").id,\r\n // EquipActionId: MRData.newAction(\"kAction_Equip\", \"装備\", 1000).id,\r\n // EquipOffActionId: MRData.newAction(\"kAction_EquipOff\", \"はずす\").id,\r\n // EatActionId: MRData.newAction(\"kAction_Eat\", \"食べる\", 1000).id,\r\n // TakeActionId: MRData.newAction(\"kAction_Take\", \"Take\").id,\r\n // BiteActionId: MRData.newAction(\"kAction_Bite\", \"Bite\").id,\r\n // ReadActionId: MRData.newAction(\"kAction_Read\", \"読む\", 1000).id,\r\n // WaveActionId: MRData.newAction(\"kAction_Wave\", \"振る\", 1000).id,\r\n // PushActionId: MRData.newAction(\"kAction_Push\", \"Push\").id,\r\n // PutInActionId: MRData.newAction(\"kAction_PutIn\", \"PickIn\").id,\r\n // PickOutActionId: MRData.newAction(\"kAction_PickOut\", \"PickOut\").id,\r\n // IdentifyActionId: MRData.newAction(\"kAction_Identify\", \"Identify\").id,\r\n // talk: MRData.newAction(\"kAction_Talk\", \"talk\").id,\r\n // collide: MRData.newAction(\"kAction_Collide\", \"collide\").id,\r\n // dialogResult: MRData.newAction(\"kAction_DialogResult\", \"dialogResult\").id,\r\n // stumble: MRData.newAction(\"kAction_Stumble\", \"stumble\").id,\r\n // dead: MRData.newAction(\"kAction_Dead\", \"dead\").id,\r\n // performSkill: MRData.newAction(\"kAction_PerformSkill\", \"PerformSkill\").id,\r\n // AttackActionId: MRData.newAction(\"kAction_Attack\", \"Attack\").id,\r\n // };\r\n // MRData.actions[ MRBasics.actions.ShootActionId].flavorEffect.sound = new DSound({ name: \"Crossbow\", volume: 100, pitch: 100, pan: 0 });\r\n // MRBasics.commands = {\r\n // testPickOutItem: MRData.newCommand(\"testPickOutItem\").id,\r\n // testPutInItem: MRData.newCommand(\"testPutInItem\").id,\r\n // };\r\n // Sequels\r\n MRBasics_1.MRBasics.sequels = {\r\n idle: MRData_1.MRData.addSequel(\"idle\"),\r\n MoveSequel: MRData_1.MRData.addSequel(\"Move\"),\r\n blowMoveSequel: MRData_1.MRData.addSequel(\"BlowMove\"),\r\n dropSequel: MRData_1.MRData.addSequel(\"BlowMove\"),\r\n attack: MRData_1.MRData.addSequel(\"attack\"),\r\n CollapseSequel: MRData_1.MRData.addSequel(\"Collapse\"),\r\n commonStopped: MRData_1.MRData.addSequel(\"commonStopped\"),\r\n asleep: MRData_1.MRData.addSequel(\"asleep\"),\r\n escape: MRData_1.MRData.addSequel(\"escape\"),\r\n earthquake2: MRData_1.MRData.addSequel(\"earthquake2\"),\r\n useItem: MRData_1.MRData.addSequel(\"useItem\"),\r\n explosion: MRData_1.MRData.addSequel(\"explosion\"),\r\n down: MRData_1.MRData.addSequel(\"down\"),\r\n warp: MRData_1.MRData.addSequel(\"warp\"),\r\n stumble: MRData_1.MRData.addSequel(\"stumble\"),\r\n jump: MRData_1.MRData.addSequel(\"stumble\"),\r\n crack: MRData_1.MRData.addSequel(\"crack\"),\r\n };\r\n MRData_1.MRData.sequels[MRBasics_1.MRBasics.sequels.MoveSequel].parallel = true;\r\n MRData_1.MRData.sequels[MRBasics_1.MRBasics.sequels.MoveSequel].fluidSequence = true;\r\n MRData_1.MRData.sequels[MRBasics_1.MRBasics.sequels.CollapseSequel].parallel = true;\r\n MRData_1.MRData.sequels[MRBasics_1.MRBasics.sequels.stumble].parallel = true;\r\n MRData_1.MRData.sequels[MRBasics_1.MRBasics.sequels.dropSequel].parallel = true; // 転倒とアイテムドロップを並列実行したい\r\n MRData_1.MRData.sequels[MRBasics_1.MRBasics.sequels.jump].parallel = true;\r\n MRData_1.MRData.monsterHouses = [\r\n { id: 0, name: \"null\", bgm: { name: \"\", pan: 0, pitch: 100, volume: 90 } },\r\n { id: 1, name: \"Fixed\", bgm: { name: \"Battle4\", pan: 0, pitch: 100, volume: 90 } },\r\n { id: 2, name: \"Default\", bgm: { name: \"Battle4\", pan: 0, pitch: 100, volume: 90 } },\r\n ];\r\n MRBasics_1.MRBasics.monsterHouses = {\r\n fixed: 1,\r\n normal: 2,\r\n };\r\n MRData_1.MRData.itemShops = [\r\n { id: 0, name: \"null\", bgm: { name: \"\", pan: 0, pitch: 100, volume: 90 } },\r\n { id: 1, name: \"Fixed\", bgm: { name: \"Battle4\", pan: 0, pitch: 100, volume: 90 } },\r\n { id: 2, name: \"Default\", bgm: { name: \"Battle4\", pan: 0, pitch: 100, volume: 90 } },\r\n ];\r\n MRBasics_1.MRBasics.itemShops = {\r\n fixed: 1,\r\n normal: 2,\r\n };\r\n MRBasics_1.MRBasics.effectBehaviors = {\r\n itemSteal: MRData_1.MRData.newEffectBehavior(\"ItemSteal\").id,\r\n goldSteal: MRData_1.MRData.newEffectBehavior(\"GoldSteal\").id,\r\n levelDown: MRData_1.MRData.newEffectBehavior(\"LevelDown\").id,\r\n randomWarp: MRData_1.MRData.newEffectBehavior(\"RandomWarp\").id,\r\n stumble: MRData_1.MRData.newEffectBehavior(\"Stumble\").id,\r\n transferToNextFloor: MRData_1.MRData.newEffectBehavior(\"TransferToNextFloor\").id,\r\n transferToLowerFloor: MRData_1.MRData.newEffectBehavior(\"TransferToLowerFloor\").id,\r\n trapProliferation: MRData_1.MRData.newEffectBehavior(\"TrapProliferation\").id,\r\n dispelEquipments: MRData_1.MRData.newEffectBehavior(\"DispelEquipments\").id,\r\n changeInstance: MRData_1.MRData.newEffectBehavior(\"ChangeInstance\").id,\r\n restartFloor: MRData_1.MRData.newEffectBehavior(\"RestartFloor\").id,\r\n clarification: MRData_1.MRData.newEffectBehavior(\"Clarification\").id,\r\n division: MRData_1.MRData.newEffectBehavior(\"Division\").id,\r\n addState: MRData_1.MRData.newEffectBehavior(\"AddState\").id,\r\n removeState: MRData_1.MRData.newEffectBehavior(\"RemoveState\").id,\r\n removeStatesByIntentions: MRData_1.MRData.newEffectBehavior(\"RemoveStatesByIntentions\").id,\r\n performeSkill: MRData_1.MRData.newEffectBehavior(\"PerformeSkill\").id,\r\n gainCapacity: MRData_1.MRData.newEffectBehavior(\"GainCapacity\").id,\r\n suckOut: MRData_1.MRData.newEffectBehavior(\"SuckOut\").id,\r\n };\r\n MRData_1.MRData.newBehavior(\"kBehavior_Common\", \"LCommonBehavior\", \"Common\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_Decision\", \"LDecisionBehavior\", \"Decision\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_Unit\", \"LUnitBehavior\", \"Unit\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_Inventory\", \"LInventoryBehavior\", \"Inventory\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_ItemUser\", \"LItemUserBehavior\", \"_ItemUser\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_Equipment\", \"LEquipmentBehavior\", \"Equipment\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_EquipmentUser\", \"LEquipmentUserBehavior\", \"_EquipmentUser\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_Actor\", \"LActorBehavior\", \"_Actor\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_ExitPoint\", \"LExitPointBehavior\", \"_ExitPoint\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_EntryPoint\", \"LEntryPointBehavior\", \"_EntryPoint\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_Enemy\", \"LEnemyBehavior\", \"_Enemy\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_GenericRMMZState\", \"LGenericRMMZStateBehavior\", \"_GenericRMMZState\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_Item\", \"LItemBehavior\", \"_Item\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_NapState\", \"LNapStateBehavior\", \"NapState\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_ItemImitator\", \"LItemImitatorBehavior\", \"ItemImitator\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_IllusionState\", \"LIllusionStateBehavior\", \"IllusionState\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_GrabFoot\", \"LGrabFootBehavior\", \"FootBehavior\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_RevivalItem\", \"LRevivalItemBehavior\", \"RevivalItem\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_ItemStanding\", \"LItemStandingBehavior\", \"ItemStanding\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_Projectile\", \"LProjectileBehavior\", \"Projectile\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_Experience\", \"LExperienceBehavior\", \"Experience\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_Eater\", \"LEaterBehavior\", \"Eater\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_Survivor\", \"LSurvivorBehavior\", \"Survivor\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_Race\", \"LRaceBehavior\", \"Race\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_Trap\", \"LTrapBehavior\", \"Trap\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_Param\", \"LParamBehavior\", \"Param\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_RatedRandomAI\", \"LRatedRandomAIBehavior\", \"RatedRandomAI\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_EntityDivision\", \"LEntityDivisionBehavior\", \"EntityDivision\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_Sanctuary\", \"LSanctuaryBehavior\", \"Sanctuary\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_GlueToGround\", \"LGlueToGroundBehavior\", \"GlueToGround\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_StumblePrevention\", \"LStumblePreventionBehavior\", \"StumblePrevention\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_GoldThief\", \"LGoldThiefBehavior\", \"GoldThief\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_ActivityCharm\", \"LActivityCharmBehavior\", \"ActivityCharm\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_Gold\", \"LGoldBehavior\", \"Gold\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_Escape\", \"LEscapeBehavior\", \"Escape\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_Flock\", \"LFlockBehavior\", \"Flock\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_Storage\", \"LStorageBehavior\", \"Storage\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_ItemThief\", \"LItemThiefBehavior\", \"ItemThief\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_Shopkeeper\", \"LShopkeeperBehavior\", \"Shopkeeper\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_CrackedBehavior\", \"LCrackedBehavior\", \"CrackedBehavior\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_Knockback\", \"LKnockbackBehavior\", \"Knockback\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_SelfExplosion\", \"LSelfExplosionBehavior\", \"SelfExplosion\");\r\n MRData_1.MRData.newBehavior(\"kBehavior_DebugMoveRight\", \"LDebugMoveRightBehavior\", \"DebugMoveRight\");\r\n // EntityTemplate\r\n {\r\n MRData_1.MRData.newEntityTemplate(\"kEntityTemplate_Weapon\", {\r\n type: \"Weapon\",\r\n });\r\n MRData_1.MRData.newEntityTemplate(\"kEntityTemplate_Shield\", {\r\n type: \"Shield\",\r\n });\r\n MRData_1.MRData.newEntityTemplate(\"kEntityTemplate_Armor\", {\r\n type: \"Armor\",\r\n });\r\n MRData_1.MRData.newEntityTemplate(\"kEntityTemplate_Accessory\", {\r\n type: \"Accessory\",\r\n });\r\n MRData_1.MRData.newEntityTemplate(\"kEntityTemplate_Grass\", {\r\n type: \"Grass\",\r\n recoverFP: 500,\r\n });\r\n MRData_1.MRData.newEntityTemplate(\"kEntityTemplate_Food\", {\r\n type: \"Food\",\r\n });\r\n }\r\n {\r\n {\r\n const shape = MRData_1.MRData.newTerrainShape(\"kTerrainShape_Default\");\r\n shape.wayConnectionMode = DTerrainPreset_1.FGenericRandomMapWayConnectionMode.SectionEdge;\r\n }\r\n {\r\n const shape = MRData_1.MRData.newTerrainShape(\"kTerrainShape_SimpleDefault\");\r\n shape.wayConnectionMode = DTerrainPreset_1.FGenericRandomMapWayConnectionMode.RoomEdge;\r\n }\r\n {\r\n const shape = MRData_1.MRData.newTerrainShape(\"kTerrainShape_Small2x2\");\r\n shape.width = Math.floor(PluginParameters_1.paramRandomMapDefaultWidth * (2 / 3));\r\n shape.height = Math.floor(PluginParameters_1.paramRandomMapDefaultHeight * (2 / 3));\r\n shape.divisionCountX = 2;\r\n shape.divisionCountY = 2;\r\n shape.roomCountMin = 3;\r\n shape.roomCountMax = 4;\r\n }\r\n {\r\n const shape = MRData_1.MRData.newTerrainShape(\"kTerrainShape_GreatHall\");\r\n shape.divisionCountX = 1;\r\n shape.divisionCountY = 1;\r\n shape.forceRoomShapes = [{ typeName: \"FullPlane\" }];\r\n }\r\n {\r\n const shape = MRData_1.MRData.newTerrainShape(\"kTerrainShape_HalfHall\");\r\n shape.divisionCountX = 1;\r\n shape.divisionCountY = 1;\r\n shape.forceRoomShapes = [{ typeName: \"HalfPlane\" }];\r\n }\r\n {\r\n const shape = MRData_1.MRData.newTerrainShape(\"kTerrainShape_C\");\r\n shape.divisionCountX = 3;\r\n shape.divisionCountY = 3;\r\n shape.connectionPreset = DTerrainPreset_1.DSectorConnectionPreset.C;\r\n }\r\n {\r\n const shape = MRData_1.MRData.newTerrainShape(\"kTerrainShape_H\");\r\n shape.divisionCountX = 3;\r\n shape.divisionCountY = 3;\r\n shape.connectionPreset = DTerrainPreset_1.DSectorConnectionPreset.H;\r\n }\r\n //----------\r\n // {\r\n // const setting = REData.newTerrainSetting(\"kTerrainSetting_Default\");\r\n // setting.shapeRefs.push({dataId: REData.getTerrainShape(\"kTerrainShape_Default\").id, rate: 1});\r\n // }\r\n // {\r\n // const setting = REData.newTerrainSetting(\"kTerrainSetting_Test_DefaultMH\");\r\n // setting.shapeRefs.push({dataId: REData.getTerrainShape(\"kTerrainShape_Default\").id, rate: 1});\r\n // setting.forceStructures = [{typeName: \"MonsterHouse\", rate: 100}];\r\n // }\r\n // {\r\n // const setting = REData.newTerrainSetting(\"kTerrainSetting_SimpleDefault\");\r\n // setting.shapeRefs.push({dataId: REData.getTerrainShape(\"kTerrainShape_SimpleDefault\").id, rate: 1});\r\n // }\r\n // {\r\n // const setting = REData.newTerrainSetting(\"kTerrainSetting_Small2x2\");\r\n // setting.shapeRefs.push({dataId: REData.getTerrainShape(\"kTerrainShape_Small2x2\").id, rate: 1});\r\n // }\r\n // {\r\n // const setting = REData.newTerrainSetting(\"kTerrainSetting_GreatHall\");\r\n // setting.shapeRefs.push({dataId: REData.getTerrainShape(\"kTerrainShape_GreatHall\").id, rate: 1});\r\n // }\r\n // {\r\n // const setting = REData.newTerrainSetting(\"kTerrainSetting_HalfHall\");\r\n // setting.shapeRefs.push({dataId: REData.getTerrainShape(\"kTerrainShape_HalfHall\").id, rate: 1});\r\n // }\r\n // {\r\n // const setting = REData.newTerrainSetting(\"kTerrainSetting_Alphabet\");\r\n // setting.shapeRefs.push({dataId: REData.getTerrainShape(\"kTerrainShape_C\").id, rate: 1});\r\n // }\r\n // {\r\n // const setting = REData.newTerrainSetting(\"kTerrainSetting_GreatHallMH\");\r\n // setting.shapeRefs.push({dataId: REData.getTerrainShape(\"kTerrainShape_GreatHall\").id, rate: 1});\r\n // setting.forceStructures = [{typeName: \"MonsterHouse\", rate: 100}];\r\n // }\r\n MRBasics_1.MRBasics.defaultTerrainPresetId = 1;\r\n }\r\n // Test\r\n {\r\n {\r\n const data = MRData_1.MRData.newQuest(\"kQuest_メインクエスト\");\r\n data.tasks.push(MRData_1.MRData.newQuestTask(\"kQuestTask_メインクエスト_街へ向かう\"));\r\n data.tasks.push(MRData_1.MRData.newQuestTask(\"kQuestTask_メインクエスト_1\"));\r\n }\r\n {\r\n const data = MRData_1.MRData.newQuest(\"kQuest_ActorBからActorCへのお届け物\");\r\n data.tasks.push(MRData_1.MRData.newQuestTask(\"kQuestTask_ActorBからActorCへのお届け物_1\"));\r\n }\r\n {\r\n const data = MRData_1.MRData.newQuest(\"kQuest_アイテムの納品\");\r\n data.tasks.push(MRData_1.MRData.newQuestTask(\"kQuestTask_アイテムの納品_1\"));\r\n }\r\n {\r\n const data = MRData_1.MRData.newQuest(\"kQuest_特定フロアにいるモンスターの盗伐\");\r\n data.tasks.push(MRData_1.MRData.newQuestTask(\"kQuestTask_特定フロアにいるモンスターの盗伐_1\"));\r\n }\r\n {\r\n const data = MRData_1.MRData.newQuest(\"kQuest_特定マップへ移動して殲滅戦\");\r\n data.tasks.push(MRData_1.MRData.newQuestTask(\"kQuestTask_特定マップへ移動して殲滅戦_1\"));\r\n }\r\n }\r\n next();\r\n }\r\n static loadData(next) {\r\n var _a, _b, _c, _d, _e;\r\n MRData_1.MRData.system = new DSystem_1.DSystem();\r\n // Import Elements\r\n MRData_1.MRData.elements = [];\r\n for (const x of $dataSystem.elements) { // [0] is \"\" (empty string).\r\n const tokens = x.split(\"##\");\r\n let key = x;\r\n let name = x;\r\n if (tokens.length == 2) {\r\n name = tokens[0];\r\n key = tokens[1];\r\n }\r\n const data = MRData_1.MRData.newElement(key);\r\n data.name = name;\r\n }\r\n MRBasics_1.MRBasics.variables = {\r\n result: $dataSystem.variables.findIndex(x => x == \"MR-CommndResult1\"),\r\n landExitResult: $dataSystem.variables.findIndex(x => x == \"MR-ExitResult\"),\r\n landExitResultDetail: $dataSystem.variables.findIndex(x => x == \"MR-ExitResultDetail\"),\r\n };\r\n MRBasics_1.MRBasics.elements = {\r\n explosion: MRData_1.MRData.getElement(\"kElement_Explosion\").id,\r\n };\r\n if ($dataSystem.equipTypes) {\r\n MRData_1.MRData.equipmentParts = $dataSystem.equipTypes.map((x, i) => {\r\n if (x) {\r\n return {\r\n id: i,\r\n name: x,\r\n };\r\n }\r\n else {\r\n return DEquipmentType_1.DEquipmentType_Default;\r\n }\r\n });\r\n }\r\n // Import States\r\n {\r\n MRData_1.MRData.stateGroups = [new DStateGroup_1.DStateGroup(0)]; // dummy\r\n for (const x of $dataStates) {\r\n const state = new DState_1.DState(MRData_1.MRData.states.length);\r\n MRData_1.MRData.states.push(state);\r\n if (x) {\r\n const meta = DMetadataParser_1.DMetadataParser.parse(x.meta);\r\n if (meta.type == \"StateGroup\") {\r\n const stateGroup = new DStateGroup_1.DStateGroup(MRData_1.MRData.stateGroups.length);\r\n stateGroup.name = x.name;\r\n stateGroup.key = meta.key;\r\n MRData_1.MRData.stateGroups.push(stateGroup);\r\n MRSetup_1.MRSetup.setupDirectly_StateGroup(stateGroup);\r\n }\r\n else {\r\n state.key = meta.key;\r\n state.displayName = x.name;\r\n state.effect.restriction = DState_1.DStateRestriction.fromRmmzRestriction(x.restriction);\r\n state.iconIndex = (_a = x.iconIndex) !== null && _a !== void 0 ? _a : 0;\r\n state.priority = x.priority;\r\n state.message1 = (_b = x.message1) !== null && _b !== void 0 ? _b : \"\";\r\n state.message2 = (_c = x.message2) !== null && _c !== void 0 ? _c : \"\";\r\n state.message3 = (_d = x.message3) !== null && _d !== void 0 ? _d : \"\";\r\n state.message4 = (_e = x.message4) !== null && _e !== void 0 ? _e : \"\";\r\n state.effect.behaviors = meta.behaviors;\r\n state.effect.traits = x.traits.concat(meta.traits);\r\n if (x.removeByDamage) {\r\n state.effect.damageRemovels.push({ paramId: MRBasics_1.MRBasics.params.hp, chance: x.chanceByDamage });\r\n }\r\n state.import(x);\r\n }\r\n }\r\n }\r\n MRBasics_1.MRBasics.states = {\r\n dead: 1,\r\n nap: MRData_1.MRData.getState(\"kState_System_kNap\").id,\r\n trapPerformed: MRData_1.MRData.getState(\"kState_System_TrapPerformed\").id,\r\n monsterHouseSleepStateId: MRData_1.MRData.getState(\"kState_System_kNap\").id,\r\n };\r\n }\r\n // Import Abilities\r\n {\r\n MRData_1.MRData.abilities = $dataStates\r\n .filter(state => !state || (state.meta && state.meta[\"MR-Type\"] == \"Ability\"))\r\n .map((state, index) => {\r\n if (state) {\r\n const ability = {\r\n id: index,\r\n key: state.meta[\"MR-Key\"].trim(),\r\n reactions: [],\r\n };\r\n Object.keys(state.meta).forEach(key => {\r\n if (key.startsWith(\"RE-Reaction.\")) {\r\n // TODO: 複数指定の時は ; で分割したい\r\n ability.reactions.push({\r\n command: key.substr(12),\r\n script: state.meta[key]\r\n });\r\n }\r\n });\r\n return ability;\r\n }\r\n else {\r\n return (0, DAbility_1.DAbility_Default)();\r\n }\r\n });\r\n }\r\n // Import Classes\r\n $dataClasses.forEach(x => {\r\n var _a, _b, _c, _d, _e;\r\n if (x) {\r\n const meta = DMetadataParser_1.DMetadataParser.parse(x.meta);\r\n if (meta.type == \"Race\") {\r\n const race = MRData_1.MRData.newRace();\r\n race.key = meta.key;\r\n race.name = x.name;\r\n race.traits = (_a = x.traits) !== null && _a !== void 0 ? _a : [];\r\n }\r\n else {\r\n const id = MRData_1.MRData.newClass((_b = x.name) !== null && _b !== void 0 ? _b : \"null\");\r\n const c = MRData_1.MRData.classes[id];\r\n c.expParams = (_c = x.expParams) !== null && _c !== void 0 ? _c : [];\r\n c.params = (_d = x.params) !== null && _d !== void 0 ? _d : [];\r\n c.traits = (_e = x.traits) !== null && _e !== void 0 ? _e : [];\r\n c.learnings = x.learnings;\r\n }\r\n }\r\n });\r\n MRBasics_1.MRBasics.defaultEnemyClass = MRData_1.MRData.classes[9].id; // TODO:\r\n for (const race of MRData_1.MRData.races)\r\n MRSetup_1.MRSetup.setupRace(race);\r\n // Import Actors\r\n //REData.actors = [];\r\n $dataActors.forEach(x => {\r\n if (x) {\r\n const [entity, actor] = MRData_1.MRData.newActor();\r\n entity.display.name = x.name;\r\n entity.entity = (0, DEntityProperties_1.parseMetaToEntityProperties)(x.meta);\r\n entity.factionId = MRData_1.MRData.system.factions.neutral;\r\n entity.selfTraits = x.traits.slice();\r\n entity.classId = x.classId;\r\n actor.setup(x);\r\n }\r\n });\r\n MRData_1.MRData.entities[MRData_1.MRData.actors[1]].factionId = MRData_1.MRData.system.factions.player; // #1 はデフォルトで Player\r\n // Import Skills\r\n // Item から Skill を参照することがある。逆は無いため、Item より先に Skill を構築する。\r\n MRData_1.MRData.skills = [new DSkill_1.DSkill(0, \"null\")];\r\n $dataSkills.forEach(x => {\r\n var _a, _b;\r\n if (x) {\r\n const meta = DMetadataParser_1.DMetadataParser.parse(x.meta);\r\n const skill = new DSkill_1.DSkill(MRData_1.MRData.skills.length, meta.key);\r\n MRData_1.MRData.skills.push(skill);\r\n (0, Common_1.assert)(x.id == skill.id);\r\n if (meta.type == \"Activity\") {\r\n skill.isActivity = true;\r\n }\r\n const emittor = MRData_1.MRData.newEmittor(skill.key);\r\n const effect = MRData_1.MRData.newEffect(skill.key);\r\n effect.critical = false;\r\n effect.successRate = x.successRate;\r\n effect.hitType = x.hitType;\r\n //effect.rmmzAnimationId = x.animationId;\r\n effect.rmmzSpecialEffectQualifyings = x.effects;\r\n emittor.targetAreaAnimationId = x.animationId;\r\n emittor.costs.setParamCost(DEffect_1.DSkillCostSource.Actor, MRBasics_1.MRBasics.params.mp, { type: DEffect_1.DParamCostType.Decrease, value: x.mpCost });\r\n emittor.costs.setParamCost(DEffect_1.DSkillCostSource.Actor, MRBasics_1.MRBasics.params.tp, { type: DEffect_1.DParamCostType.Decrease, value: x.tpCost });\r\n if (x.damage.type > 0) {\r\n effect.parameterQualifyings.push(this.makeParameterQualifying(x.damage));\r\n }\r\n //emittor.effectSet.targetEffectIds.push(effect.id);\r\n emittor.effectSuite.addTargetEffect(new DEffectSuite_1.DEffectRef(effect.id));\r\n skill.name = x.name;\r\n skill.emittorId = emittor.id;\r\n skill.rmmzEffectScope = (_a = x.scope) !== null && _a !== void 0 ? _a : DEffect_1.DRmmzEffectScope.None;\r\n const messages = [];\r\n if (x.message1)\r\n messages.push(x.message1);\r\n if (x.message2)\r\n messages.push(x.message2);\r\n const flavorEffect = new DFlavorEffect_1.DFlavorEffect();\r\n flavorEffect.text = messages;\r\n emittor.setupFromRmmzScope((_b = x.scope) !== null && _b !== void 0 ? _b : DEffect_1.DRmmzEffectScope.None);\r\n }\r\n });\r\n // Actions\r\n MRBasics_1.MRBasics.actions = {\r\n DirectionChangeActionId: MRData_1.MRData.newSkillAsActivity(\"kAction_DirectionChange\", \"DirectionChange\").id,\r\n MoveToAdjacentActionId: MRData_1.MRData.getSkill(\"kSkill_System_Move\").id,\r\n PickActionId: MRData_1.MRData.newSkillAsActivity(\"kAction_Pick\", \"拾う\").id,\r\n PutActionId: MRData_1.MRData.newSkillAsActivity(\"kAction_Put\", \"置く\").id,\r\n ExchangeActionId: MRData_1.MRData.newSkillAsActivity(\"kAction_Exchange\", \"交換\").id,\r\n ThrowActionId: MRData_1.MRData.newSkillAsActivity(\"kAction_Throw\", \"投げる\").id,\r\n FlungActionId: MRData_1.MRData.newSkillAsActivity(\"kAction_Flung\", \"Flung\").id,\r\n ShootActionId: MRData_1.MRData.newSkillAsActivity(\"kAction_Shoot\", \"撃つ\", 1000).id,\r\n AffectActionId: MRData_1.MRData.newSkillAsActivity(\"kAction_Affect\", \"Affect\").id,\r\n RollActionId: MRData_1.MRData.newSkillAsActivity(\"kAction_Roll\", \"Roll\").id,\r\n FallActionId: MRData_1.MRData.newSkillAsActivity(\"kAction_Fall\", \"Fall\").id,\r\n DropActionId: MRData_1.MRData.newSkillAsActivity(\"kAction_Drop\", \"Drop\").id,\r\n trample: MRData_1.MRData.newSkillAsActivity(\"kAction_Trample\", \"踏む\").id,\r\n TrashActionId: MRData_1.MRData.newSkillAsActivity(\"kAction_Trash\", \"Trash\").id,\r\n ForwardFloorActionId: MRData_1.MRData.newSkillAsActivity(\"kAction_ForwardFloor\", \"すすむ\").id,\r\n BackwardFloorActionId: MRData_1.MRData.newSkillAsActivity(\"kAction_BackwardFloor\", \"戻る\").id,\r\n EquipActionId: MRData_1.MRData.newSkillAsActivity(\"kAction_Equip\", \"装備\", 1000).id,\r\n EquipOffActionId: MRData_1.MRData.newSkillAsActivity(\"kAction_EquipOff\", \"はずす\").id,\r\n EatActionId: MRData_1.MRData.newSkillAsActivity(\"kAction_Eat\", \"食べる\", 1000).id,\r\n TakeActionId: MRData_1.MRData.newSkillAsActivity(\"kAction_Take\", \"Take\").id,\r\n BiteActionId: MRData_1.MRData.newSkillAsActivity(\"kAction_Bite\", \"Bite\").id,\r\n ReadActionId: MRData_1.MRData.newSkillAsActivity(\"kAction_Read\", \"読む\", 1000).id,\r\n WaveActionId: MRData_1.MRData.newSkillAsActivity(\"kAction_Wave\", \"振る\", 1000).id,\r\n PushActionId: MRData_1.MRData.newSkillAsActivity(\"kAction_Push\", \"Push\").id,\r\n PutInActionId: MRData_1.MRData.newSkillAsActivity(\"kAction_PutIn\", \"PickIn\").id,\r\n PickOutActionId: MRData_1.MRData.newSkillAsActivity(\"kAction_PickOut\", \"PickOut\").id,\r\n IdentifyActionId: MRData_1.MRData.newSkillAsActivity(\"kAction_Identify\", \"Identify\").id,\r\n talk: MRData_1.MRData.newSkillAsActivity(\"kAction_Talk\", \"talk\").id,\r\n collide: MRData_1.MRData.newSkillAsActivity(\"kAction_Collide\", \"collide\").id,\r\n dialogResult: MRData_1.MRData.newSkillAsActivity(\"kAction_DialogResult\", \"dialogResult\").id,\r\n stumble: MRData_1.MRData.newSkillAsActivity(\"kAction_Stumble\", \"stumble\").id,\r\n dead: MRData_1.MRData.newSkillAsActivity(\"kAction_Dead\", \"dead\").id,\r\n performSkill: MRData_1.MRData.newSkillAsActivity(\"kAction_PerformSkill\", \"PerformSkill\").id,\r\n AttackActionId: MRData_1.MRData.getSkill(\"kSkill_System_NormalAttack\").id,\r\n };\r\n // Import Item\r\n MRData_1.MRData.items = [];\r\n MRData_1.MRData.itemDataIdOffset = MRData_1.MRData.items.length;\r\n $dataItems.forEach(x => {\r\n var _a, _b, _c, _d;\r\n const [entity, item] = MRData_1.MRData.newItem();\r\n if (x) {\r\n item.rmmzItemId = x.id;\r\n const meta = DMetadataParser_1.DMetadataParser.parse(x.meta);\r\n entity.entity = (0, DEntityProperties_1.parseMetaToEntityProperties)(x.meta);\r\n entity.entityTemplateKey = meta.entityTemplateKey;\r\n entity.display.name = x.name;\r\n entity.display.iconIndex = (_a = x.iconIndex) !== null && _a !== void 0 ? _a : 0;\r\n entity.description = x.description;\r\n entity.sellingPrice2 = x.price;\r\n entity.purchasePrice = Math.max(entity.sellingPrice2 / 2, 1);\r\n const emittor = MRData_1.MRData.newEmittor((_b = meta.emittorKey) !== null && _b !== void 0 ? _b : entity.entity.key);\r\n const effect = MRData_1.MRData.newEffect((_c = meta.effectKey) !== null && _c !== void 0 ? _c : entity.entity.key);\r\n effect.critical = false;\r\n effect.successRate = x.successRate;\r\n effect.hitType = x.hitType;\r\n if (x.animationId < 0) {\r\n effect.flavorEffect = undefined;\r\n }\r\n else if (x.animationId === 0) {\r\n effect.flavorEffect = null;\r\n }\r\n else {\r\n effect.flavorEffect = DFlavorEffect_1.DFlavorEffect.fromRmmzAnimationId(x.animationId);\r\n }\r\n effect.rmmzSpecialEffectQualifyings = x.effects;\r\n if (x.damage.type > 0) {\r\n effect.parameterQualifyings.push(this.makeParameterQualifying(x.damage));\r\n }\r\n //effect.rmmzItemEffectQualifying = x.effects.\r\n // emittor.effectSet.targetEffectIds.push( effect.id);\r\n emittor.effectSuite.addTargetEffect(new DEffectSuite_1.DEffectRef(effect.id));\r\n entity.setMainEmittor(emittor);\r\n emittor.setupFromRmmzScope((_d = x.scope) !== null && _d !== void 0 ? _d : DEffect_1.DRmmzEffectScope.None);\r\n }\r\n });\r\n MRData_1.MRData.weaponDataIdOffset = MRData_1.MRData.items.length;\r\n $dataWeapons.forEach(x => {\r\n var _a, _b;\r\n const [entity, item] = MRData_1.MRData.newItem();\r\n if (x) {\r\n item.rmmzWeaponId = x.id;\r\n const meta = DMetadataParser_1.DMetadataParser.parse(x.meta);\r\n entity.display.name = DHelper_1.DHelpers.parseDisplayName(x.name);\r\n entity.display.iconIndex = (_a = x.iconIndex) !== null && _a !== void 0 ? _a : 0;\r\n entity.description = x.description;\r\n entity.sellingPrice2 = x.price;\r\n entity.purchasePrice = Math.max(entity.sellingPrice2 / 2, 1);\r\n entity.equipment = new DItem_1.DEquipment();\r\n entity.equipment.equipmentPart = x.etypeId;\r\n entity.equipment.parameters[MRBasics_1.MRBasics.params.hp] = { value: x.params[0], upgradeRate: 0 };\r\n entity.equipment.parameters[MRBasics_1.MRBasics.params.mp] = { value: x.params[1], upgradeRate: 0 };\r\n entity.equipment.parameters[MRBasics_1.MRBasics.params.atk] = { value: x.params[2], upgradeRate: 1.0 };\r\n entity.equipment.parameters[MRBasics_1.MRBasics.params.def] = { value: x.params[3], upgradeRate: 0 };\r\n entity.equipment.parameters[MRBasics_1.MRBasics.params.mat] = { value: x.params[4], upgradeRate: 0 };\r\n entity.equipment.parameters[MRBasics_1.MRBasics.params.mdf] = { value: x.params[5], upgradeRate: 0 };\r\n entity.equipment.parameters[MRBasics_1.MRBasics.params.agi] = { value: x.params[6], upgradeRate: 0 };\r\n entity.equipment.parameters[MRBasics_1.MRBasics.params.luk] = { value: x.params[7], upgradeRate: 0 };\r\n entity.equipment.targetRmmzAnimationId = (_b = x.animationId) !== null && _b !== void 0 ? _b : 0;\r\n entity.equipmentTraits = x.traits.slice();\r\n entity.equipmentTraits = entity.equipmentTraits.concat(DTrait_1.DTrait.parseTraitMetadata(x.meta));\r\n entity.entity = (0, DEntityProperties_1.parseMetaToEntityProperties)(x.meta);\r\n entity.entityTemplateKey = meta.entityTemplateKey;\r\n }\r\n });\r\n MRData_1.MRData.armorDataIdOffset = MRData_1.MRData.items.length;\r\n $dataArmors.forEach(x => {\r\n var _a;\r\n const [entity, item] = MRData_1.MRData.newItem();\r\n if (x) {\r\n item.rmmzArmorId = x.id;\r\n const meta = DMetadataParser_1.DMetadataParser.parse(x.meta);\r\n entity.display.name = x.name;\r\n entity.display.iconIndex = (_a = x.iconIndex) !== null && _a !== void 0 ? _a : 0;\r\n entity.description = x.description;\r\n entity.sellingPrice2 = x.price;\r\n entity.purchasePrice = Math.max(entity.sellingPrice2 / 2, 1);\r\n entity.equipment = new DItem_1.DEquipment();\r\n entity.equipment.equipmentPart = x.etypeId;\r\n entity.equipment.parameters[MRBasics_1.MRBasics.params.hp] = { value: x.params[0], upgradeRate: 0 };\r\n entity.equipment.parameters[MRBasics_1.MRBasics.params.mp] = { value: x.params[1], upgradeRate: 0 };\r\n entity.equipment.parameters[MRBasics_1.MRBasics.params.atk] = { value: x.params[2], upgradeRate: 0 };\r\n entity.equipment.parameters[MRBasics_1.MRBasics.params.def] = { value: x.params[3], upgradeRate: 1.0 };\r\n entity.equipment.parameters[MRBasics_1.MRBasics.params.mat] = { value: x.params[4], upgradeRate: 0 };\r\n entity.equipment.parameters[MRBasics_1.MRBasics.params.mdf] = { value: x.params[5], upgradeRate: 0 };\r\n entity.equipment.parameters[MRBasics_1.MRBasics.params.agi] = { value: x.params[6], upgradeRate: 0 };\r\n entity.equipment.parameters[MRBasics_1.MRBasics.params.luk] = { value: x.params[7], upgradeRate: 0 };\r\n entity.equipmentTraits = x.traits.slice();\r\n entity.equipmentTraits = entity.equipmentTraits.concat(DTrait_1.DTrait.parseTraitMetadata(x.meta));\r\n entity.entity = (0, DEntityProperties_1.parseMetaToEntityProperties)(x.meta);\r\n entity.entityTemplateKey = meta.entityTemplateKey;\r\n }\r\n });\r\n MRSystem_1.MRSystem.items = {\r\n autoSupplyFood: 2,\r\n };\r\n MRData_1.MRData.system.initialPartyMembers = [];\r\n for (const actorId of $dataSystem.partyMembers) {\r\n const entity = MRData_1.MRData.entities.find(x => x.actor && x.actor.rmmzActorId == actorId);\r\n (0, Common_1.assert)(entity);\r\n MRData_1.MRData.system.initialPartyMembers.push(entity.id);\r\n }\r\n // Import Enemies\r\n $dataEnemies.forEach(x => {\r\n const [entity, enemy] = MRData_1.MRData.newEnemy();\r\n if (x) {\r\n entity.display.name = x.name;\r\n entity.display.iconIndex = 71;\r\n enemy.exp = x.exp;\r\n if (x.params) {\r\n //enemy.idealParams = x.params;\r\n entity.idealParams[MRBasics_1.MRBasics.params.hp] = x.params[0];\r\n entity.idealParams[MRBasics_1.MRBasics.params.mp] = x.params[1];\r\n entity.idealParams[MRBasics_1.MRBasics.params.atk] = x.params[2];\r\n entity.idealParams[MRBasics_1.MRBasics.params.def] = x.params[3];\r\n entity.idealParams[MRBasics_1.MRBasics.params.mat] = x.params[4];\r\n entity.idealParams[MRBasics_1.MRBasics.params.mdf] = x.params[5];\r\n entity.idealParams[MRBasics_1.MRBasics.params.agi] = x.params[6];\r\n entity.idealParams[MRBasics_1.MRBasics.params.luk] = x.params[7];\r\n }\r\n enemy.traits = x.traits;\r\n enemy.actions = x.actions;\r\n enemy.dropItems = DEnemy_1.DDropItem.makeFromRmmzDropItemList(x.dropItems, x.gold);\r\n entity.entity = (0, DEntityProperties_1.parseMetaToEntityProperties)(x.meta); // TODO: ↓DMetadataParserを使う\r\n entity.entity.kindId = MRBasics_1.MRBasics.entityCategories.MonsterKindId;\r\n entity.factionId = MRData_1.MRData.system.factions.enemy;\r\n entity.classId = MRBasics_1.MRBasics.defaultEnemyClass;\r\n enemy.traits = enemy.traits.concat(DTrait_1.DTrait.parseTraitMetadata(x.meta));\r\n const meta = DMetadataParser_1.DMetadataParser.parse(x.meta);\r\n entity.raceIds = meta.races.map(x => MRData_1.MRData.getRace(x).id);\r\n MRSetup_1.MRSetup.setupEnemy(entity);\r\n }\r\n });\r\n // Import Troop\r\n MRData_1.MRData.troops = [];\r\n for (const x of $dataTroops) {\r\n const troop = new DTroop_1.DTroop(MRData_1.MRData.troops.length);\r\n MRData_1.MRData.troops.push(troop);\r\n if (x) {\r\n const metadata = DAnnotationReader_1.DAnnotationReader.readTroopAnnotationFromPage(x.pages[0]);\r\n if (metadata) {\r\n troop.key = metadata.key;\r\n troop.members = [];\r\n for (const m of x.members) {\r\n const entityId = MRData_1.MRData.enemies[m.enemyId];\r\n const entity = MRData_1.MRData.entities[entityId];\r\n if (!entity.isValidKey) {\r\n throw new Error((0, Common_1.tr2)(\"%1 には、 MR-Key が設定されていない %2 が含まれています。\").format(DValidationHelper_1.DValidationHelper.makeRmmzTroopName(troop.id), DValidationHelper_1.DValidationHelper.makeRmmzEnemyName(m.enemyId)));\r\n }\r\n troop.members.push(entityId);\r\n }\r\n }\r\n }\r\n }\r\n // Link\r\n {\r\n MRData_1.MRData.system.link(this.testMode);\r\n for (const state of MRData_1.MRData.states) {\r\n for (const key of state.stateGroupKeys) {\r\n const id = MRData_1.MRData.stateGroups.findIndex(x => x.key == key);\r\n if (id > 0) {\r\n state.stateGroupIds.push(id);\r\n }\r\n else {\r\n throw new Error(`StateGroup not found. ${key}`);\r\n }\r\n }\r\n }\r\n }\r\n next();\r\n }\r\n static importTerrainSettings(next) {\r\n // 依存関係があるので、\r\n this.loadTextFile(\"mr/TerrainSettings.js\", (obj) => {\r\n new DTerrainSettingImporter_1.DTerrainSettingImporter(obj);\r\n next();\r\n });\r\n }\r\n static importFloorPreset(next) {\r\n this.loadTextFile(\"mr/FloorPresets.js\", (obj) => {\r\n new DFloorPresetImporter_1.DFloorPresetImporter(obj);\r\n next();\r\n });\r\n }\r\n static importLandAndFloors(next) {\r\n var _a, _b, _c;\r\n // 最初に Land のインスタンスを作っておく\r\n {\r\n MRData_1.MRData.lands = [];\r\n MRData_1.MRData.lands.push(new DLand_1.DLand(0, false)); // [0] dummy\r\n const defaltLand = new DLand_1.DLand(1, false);\r\n MRData_1.MRData.lands.push(defaltLand); // [1] REシステム管理外の RMMZ マップを表す Land\r\n // const worldLand = new DLand(2);\r\n // MRData.lands.push(worldLand); // [2] World\r\n {\r\n const level = DLand_1.DLandIdentificationLevel.Entity;\r\n for (const kind of MRData_1.MRData.categories) {\r\n defaltLand.identifiedKinds[kind.id] = level;\r\n }\r\n }\r\n for (var i = 0; i < $dataMapInfos.length; i++) {\r\n const info = $dataMapInfos[i];\r\n if (info && this.isLandMap(i)) {\r\n const land = new DLand_1.DLand(MRData_1.MRData.lands.length, info.name.startsWith(\"MR-World:\"));\r\n land.name = info.name;\r\n land.rmmzMapId = i;\r\n MRData_1.MRData.lands.push(land);\r\n }\r\n }\r\n }\r\n // Floor 情報を作る\r\n // ※フロア数を Land マップの width としているが、これは MapInfo から読み取ることはできず、\r\n // 全マップを一度ロードする必要がある。しかしそうすると処理時間が大きくなってしまう。\r\n // ひとまず欠番は多くなるが、最大フロア数でデータを作ってみる。\r\n {\r\n // 固定マップ\r\n for (let i = 1; i < $dataMapInfos.length; i++) {\r\n const info = $dataMapInfos[i];\r\n const mapData = MRData_1.MRData.newMap();\r\n if (!info)\r\n continue; // RMMZ のマップは歯抜けになることがある。その場合は採番のため DMap は作っておくが、関連付けは行わない。\r\n const nodeInfo = DDataImporter_1.DDataImporter.getMapDataNodeInfo(i);\r\n // Map が属する Land を求めておく\r\n let land = MRData_1.MRData.lands[DHelper_1.DHelpers.VanillaLandId];\r\n if (nodeInfo.landRmmzMapId !== undefined && nodeInfo.landRmmzMapId > 0) {\r\n const r = MRData_1.MRData.lands.find(x => x.rmmzMapId == nodeInfo.landRmmzMapId);\r\n if (r) {\r\n land = r;\r\n }\r\n }\r\n mapData.landId = land.id;\r\n mapData.mapId = i;\r\n (0, Common_1.assert)(mapData.id == i);\r\n if ((_a = info.name) === null || _a === void 0 ? void 0 : _a.startsWith(\"MR-Safety:\")) {\r\n mapData.safetyMap = true;\r\n }\r\n if (this.isDatabaseMap(i)) {\r\n this.databaseMapId = i;\r\n }\r\n else if (nodeInfo.rootType == DDataImporter_1.DMapDataNodeRootType.MapTemplates && nodeInfo.leafType != DDataImporter_1.DMapDataNodeLeafType.RootOrDirctory) {\r\n mapData.mapKind = DMap_1.REFloorMapKind.TemplateMap;\r\n const templateMap = MRData_1.MRData.newTemplateMap();\r\n templateMap.name = info.name;\r\n templateMap.mapId = mapData.id;\r\n }\r\n else if (((_b = info.name) === null || _b === void 0 ? void 0 : _b.startsWith(\"MR-Land:\")) || ((_c = info.name) === null || _c === void 0 ? void 0 : _c.startsWith(\"MR-World:\"))) {\r\n const land = MRData_1.MRData.lands.find(x => x.rmmzMapId == i);\r\n (0, Common_1.assert)(land);\r\n mapData.mapKind = DMap_1.REFloorMapKind.Land;\r\n }\r\n else if (nodeInfo.rootType == DDataImporter_1.DMapDataNodeRootType.LandLike) {\r\n if (nodeInfo.directory === DDataImporter_1.DLandMapDataDirectory.Shuffle && nodeInfo.leafType != DDataImporter_1.DMapDataNodeLeafType.RootOrDirctory) {\r\n mapData.mapKind = DMap_1.REFloorMapKind.ShuffleMap;\r\n }\r\n else if (nodeInfo.directory === DDataImporter_1.DLandMapDataDirectory.Fixed && nodeInfo.leafType != DDataImporter_1.DMapDataNodeLeafType.RootOrDirctory) {\r\n mapData.mapKind = DMap_1.REFloorMapKind.FixedMap;\r\n land.fixedMapIds.push(mapData.id);\r\n }\r\n }\r\n DDataImporter_1.DDataImporter.linkMapData(mapData, info, nodeInfo, land);\r\n // VanillaLand は特別扱い。FloorNumber と RmmzMapId が一致するようにする。\r\n if (land.id == DHelper_1.DHelpers.VanillaLandId) {\r\n land.fixedMapIds.push(mapData.id);\r\n land.eventMapIds.push(mapData.id);\r\n land.floorInfos[mapData.mapId] = {\r\n key: \"\",\r\n template: undefined,\r\n displayName: undefined,\r\n mode: DLand_1.DFloorMode.Area,\r\n floorClass: DLand_1.DFloorClass.EventMap,\r\n fixedMapIndex: land.fixedMapIds.length - 1,\r\n eventMapIndex: land.eventMapIds.length - 1,\r\n safetyActions: true,\r\n bgmName: \"\",\r\n bgmVolume: 90,\r\n bgmPitch: 100,\r\n presetId: 0,\r\n unique: false,\r\n fovSystem: DSystem_1.DFovSystem.RoomBounds,\r\n };\r\n }\r\n }\r\n }\r\n // 検証\r\n for (const land of MRData_1.MRData.lands) {\r\n }\r\n next();\r\n }\r\n static importPseudonymous(next) {\r\n this.loadDataFile(\"mr/Pseudonymous.json\", (obj) => {\r\n MRData_1.MRData.pseudonymous.setup(obj);\r\n next();\r\n });\r\n }\r\n static importPrefabs(next) {\r\n (0, Common_1.assert)(this.databaseMapId > 0);\r\n this.beginLoadMapData(this.databaseMapId, (obj) => {\r\n const mapData = obj;\r\n for (const event of mapData.events) {\r\n if (!event)\r\n continue;\r\n const data = DAnnotationReader_1.DAnnotationReader.readPrefabAnnotation(event, this.databaseMapId);\r\n if (!data)\r\n continue;\r\n const prefab = MRData_1.MRData.newPrefab(event.name);\r\n prefab.rmmzMapId = this.databaseMapId;\r\n prefab.rmmzEventData = event;\r\n prefab.image.characterName = event.pages[0].image.characterName;\r\n prefab.image.direction = event.pages[0].image.direction;\r\n prefab.image.pattern = event.pages[0].image.pattern;\r\n prefab.image.characterIndex = event.pages[0].image.characterIndex;\r\n prefab.image.directionFix = event.pages[0].directionFix;\r\n prefab.image.stepAnime = event.pages[0].stepAnime;\r\n prefab.image.walkAnime = event.pages[0].walkAnime;\r\n if (data.stateImages) {\r\n prefab.stateImages = data.stateImages.map(x => { return { stateId: MRData_1.MRData.getState(x[0]).id, characterName: x[1], characterIndex: x[2] }; });\r\n }\r\n if (event.pages[0].moveType == 3) { // TODO: 仮\r\n prefab.moveType = DPrefab_1.DPrefabMoveType.Fix;\r\n }\r\n MRData_1.MRData.prefabs.push(prefab);\r\n // SubPages\r\n for (let i = 1; i < event.pages.length; i++) {\r\n const page = event.pages[i];\r\n const pageData = DAnnotationReader_1.DAnnotationReader.readPrefabSubPageAnnotation(page);\r\n if (pageData) {\r\n if (pageData.state === undefined)\r\n throw new Error(`@MR-PrefabSubPage requires state field.`);\r\n prefab.subPages.push({ stateId: MRData_1.MRData.getState(pageData.state).id, rmmzEventPageIndex: i });\r\n }\r\n }\r\n // Scripts\r\n for (let i = 0; i < event.pages.length; i++) {\r\n const page = event.pages[i];\r\n const script = new DScript_1.DScript(page.list);\r\n prefab.scripts.push(script);\r\n }\r\n }\r\n // Link Prefab and Entity\r\n {\r\n for (const entity of MRData_1.MRData.entities) {\r\n if (entity.entity.key != \"\") {\r\n if (entity.entity.meta_prefabName) {\r\n const prefab = MRData_1.MRData.prefabs.find(x => x.key == entity.entity.meta_prefabName);\r\n if (prefab && prefab.id > 0) {\r\n entity.prefabId = prefab.id;\r\n MRSetup_1.MRSetup.setupPrefab(prefab);\r\n }\r\n else {\r\n throw new Error(`Unknown Prefab \"${entity.entity.meta_prefabName}\".`);\r\n }\r\n }\r\n else {\r\n //throw new Error(`No prefab specified. \"${entity.entity.key}\"`);\r\n }\r\n }\r\n }\r\n }\r\n MRBasics_1.MRBasics.prefabs = {\r\n illusionActor: MRData_1.MRData.getPrefab(\"pまどわしUnit\").id,\r\n illusionItem: MRData_1.MRData.getPrefab(\"pまどわしItem\").id,\r\n };\r\n next();\r\n });\r\n }\r\n static importLandDatabase(next) {\r\n const validLands = MRData_1.MRData.lands.filter(x => x.rmmzMapId > 0);\r\n for (let iLand = 0; iLand < validLands.length; iLand++) {\r\n const land = validLands[iLand];\r\n MRDataManager.beginLoadMapData(land.rmmzMapId, (data) => {\r\n land.import(data);\r\n if (land.enemyTableMapId > 0)\r\n MRDataManager.beginLoadMapData(land.enemyTableMapId, (data) => {\r\n DLand_1.DLand.buildSubAppearanceTable(land, data, land.enemyTableMapId, land.appearanceTable, land.appearanceTable.enemies);\r\n });\r\n if (land.itemTableMapId > 0)\r\n MRDataManager.beginLoadMapData(land.itemTableMapId, (data) => {\r\n DLand_1.DLand.buildSubAppearanceTable(land, data, land.itemTableMapId, land.appearanceTable, land.appearanceTable.items);\r\n });\r\n if (land.trapTableMapId > 0)\r\n MRDataManager.beginLoadMapData(land.trapTableMapId, (data) => {\r\n DLand_1.DLand.buildSubAppearanceTable(land, data, land.trapTableMapId, land.appearanceTable, land.appearanceTable.traps);\r\n });\r\n if (land.shopTableMapId > 0)\r\n MRDataManager.beginLoadMapData(land.shopTableMapId, (data) => {\r\n DLand_1.DLand.buildSubAppearanceTable(land, data, land.shopTableMapId, land.appearanceTable, land.appearanceTable.shop);\r\n });\r\n if (iLand == validLands.length - 1) {\r\n next();\r\n }\r\n });\r\n }\r\n }\r\n static importTemplateMaps(next) {\r\n const validMaps = MRData_1.MRData.templateMaps.filter(x => x.mapId > 0);\r\n for (let iMap = 0; iMap < validMaps.length; iMap++) {\r\n const templateMap = validMaps[iMap];\r\n this.beginLoadMapData(templateMap.mapId, (obj) => {\r\n templateMap.import(obj);\r\n if (iMap == validMaps.length - 1) {\r\n next();\r\n }\r\n });\r\n }\r\n }\r\n static importSetupScript(next) {\r\n const scripts = [\r\n \"mr/EntityCategories.js\",\r\n \"mr/EntityTemplates.js\",\r\n \"mr/Setup.js\",\r\n \"mr/Actions.js\",\r\n \"mr/Parameters.js\",\r\n \"mr/Effects.js\",\r\n \"mr/Emittors.js\",\r\n \"mr/Entities.js\",\r\n ];\r\n const scriptDB = new DSetupScript_1.DSetupScript();\r\n for (let i = 0; i < scripts.length; i++) {\r\n const script = scripts[i];\r\n this.loadTextFile(script, (obj) => {\r\n scriptDB.addScript(obj);\r\n if (i == scripts.length - 1) {\r\n scriptDB.registerData();\r\n scriptDB.setupData();\r\n for (const state of MRData_1.MRData.states) {\r\n MRSetup_1.MRSetup.setupDirectly_State(state);\r\n }\r\n // SystemState 等を参照したいので、System の Link の後で。\r\n for (const skill of MRData_1.MRData.skills) {\r\n MRSetup_1.MRSetup.setupDirectly_Skill(skill);\r\n }\r\n MRData_1.MRData.skills.forEach(x => MRSetup_1.MRSetup.linkSkill(x));\r\n for (const item of MRData_1.MRData.items) {\r\n MRSetup_1.MRSetup.setupDirectly_DItem(MRData_1.MRData.entities[item]);\r\n }\r\n for (const id of MRData_1.MRData.actors) {\r\n if (id > 0)\r\n MRSetup_1.MRSetup.setupActor(MRData_1.MRData.entities[id]);\r\n }\r\n // Skill を参照するので、Skill の Link の後で。\r\n for (const id of MRData_1.MRData.items) {\r\n MRSetup_1.MRSetup.linkItem(MRData_1.MRData.entities[id]);\r\n }\r\n for (const item of MRData_1.MRData.items) {\r\n scriptDB.setupItem(MRData_1.MRData.entities[item]);\r\n }\r\n next();\r\n }\r\n });\r\n }\r\n }\r\n static notifyDatabaseReady(next) {\r\n var _a;\r\n (_a = MRData_1.MRData.ext) === null || _a === void 0 ? void 0 : _a.onDatabaseLoaded();\r\n next();\r\n }\r\n static beginLoadMapData(rmmzMapId, onLoad) {\r\n const filename = `Map${this.padZero(rmmzMapId, 3)}.json`;\r\n this.loadDataFile(filename, onLoad);\r\n }\r\n static padZero(v, length) {\r\n return String(v).padStart(length, \"0\");\r\n }\r\n static makeParameterQualifying(damage) {\r\n var _a, _b, _c;\r\n let parameterId = 0;\r\n let applyType = DEffect_1.DParameterEffectApplyType.None;\r\n switch (damage.type) {\r\n case 1: // HPダメージ\r\n parameterId = MRBasics_1.MRBasics.params.hp;\r\n applyType = DEffect_1.DParameterEffectApplyType.Damage;\r\n break;\r\n case 2: // MPダメージ\r\n parameterId = MRBasics_1.MRBasics.params.mp;\r\n applyType = DEffect_1.DParameterEffectApplyType.Damage;\r\n break;\r\n case 3: // HP回復\r\n parameterId = MRBasics_1.MRBasics.params.hp;\r\n applyType = DEffect_1.DParameterEffectApplyType.Recover;\r\n break;\r\n case 4: // MP回復\r\n parameterId = MRBasics_1.MRBasics.params.mp;\r\n applyType = DEffect_1.DParameterEffectApplyType.Recover;\r\n break;\r\n case 5: // HP吸収\r\n parameterId = MRBasics_1.MRBasics.params.hp;\r\n applyType = DEffect_1.DParameterEffectApplyType.Drain;\r\n break;\r\n case 6: // MP吸収\r\n parameterId = MRBasics_1.MRBasics.params.mp;\r\n applyType = DEffect_1.DParameterEffectApplyType.Drain;\r\n break;\r\n default:\r\n throw new Error();\r\n }\r\n const param = new DEffect_1.DParameterQualifying(parameterId, (_a = damage.formula) !== null && _a !== void 0 ? _a : \"0\", applyType);\r\n param.elementIds[0] = (_b = damage.elementId) !== null && _b !== void 0 ? _b : 0;\r\n param.variance = (_c = damage.variance) !== null && _c !== void 0 ? _c : 0;\r\n return param;\r\n // return {\r\n // parameterId: parameterId,\r\n // applyTarget: DParameterApplyTarget.Current,\r\n // elementId: damage.elementId ?? 0,\r\n // formula: damage.formula ?? \"0\",\r\n // applyType: applyType,\r\n // variance: damage.variance ?? 0,\r\n // silent: false,\r\n // };\r\n }\r\n static isDatabaseMap(mapId) {\r\n const info = $dataMapInfos[mapId];\r\n if (info && info.name && info.name.startsWith(\"MR-Prefabs\"))\r\n return true;\r\n else\r\n return false;\r\n }\r\n static isLandMap(mapId) {\r\n const info = $dataMapInfos[mapId];\r\n if (info && info.name && (info.name.startsWith(\"MR-Land:\") || info.name.startsWith(\"MR-World:\")))\r\n return true;\r\n else\r\n return false;\r\n }\r\n static isRESystemMap(mapId) {\r\n const map = MRData_1.MRData.maps[mapId];\r\n if (map.eventMap)\r\n return false;\r\n return map.landId > DHelper_1.DHelpers.VanillaLandId;\r\n }\r\n static loadDataFile(src, onLoad) {\r\n if (DHelper_1.DHelpers.isNode()) {\r\n const dataDir = \"data/\";\r\n const data = JSON.parse(fs_1.default.readFileSync(dataDir + src).toString());\r\n onLoad(data);\r\n }\r\n else {\r\n this._loadingDataFileCount++;\r\n const xhr = new XMLHttpRequest();\r\n const url = \"data/\" + src;\r\n xhr.open(\"GET\", url);\r\n xhr.overrideMimeType(\"application/json\");\r\n xhr.onload = () => this.onXhrLoad(xhr, src, url, (obj) => { onLoad(obj); this._loadedDataFileCount++; });\r\n xhr.onerror = () => DataManager.onXhrError(src, src, url);\r\n xhr.send();\r\n }\r\n }\r\n static loadTextFile(src, onLoad) {\r\n if (DHelper_1.DHelpers.isNode()) {\r\n const dataDir = \"data/\";\r\n onLoad(fs_1.default.readFileSync(dataDir + src).toString());\r\n }\r\n else {\r\n throw new Error(\"Not implemented.\");\r\n }\r\n }\r\n static onXhrLoad(xhr, src, url, onLoad) {\r\n if (xhr.status < 400) {\r\n onLoad(JSON.parse(xhr.responseText));\r\n }\r\n else {\r\n DataManager.onXhrError(src, src, url);\r\n }\r\n }\r\n}\r\nexports.MRDataManager = MRDataManager;\r\nMRDataManager.databaseMapId = 0;\r\n//--------------------------------------------------\r\n// DataManager の実装\r\n// コアスクリプトの DataManager は結果をグローバル変数へ格納するが、\r\n// 代わりにコールバックで受け取るようにしたもの。\r\n// また UnitTest 環境では同期的にロードしたいので、必要に応じて FS を使うようにしている。\r\nMRDataManager._loadingDataFileCount = 0;\r\nMRDataManager._loadedDataFileCount = 0;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/MRDataManager.ts?"); /***/ }), /***/ "./ts/mr/data/MRSetup.ts": /*!*******************************!*\ !*** ./ts/mr/data/MRSetup.ts ***! \*******************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.MRSetup = void 0;\r\nconst MRBasics_1 = __webpack_require__(/*! ./MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst DCommon_1 = __webpack_require__(/*! ./DCommon */ \"./ts/mr/data/DCommon.ts\");\r\nconst DEffect_1 = __webpack_require__(/*! ./DEffect */ \"./ts/mr/data/DEffect.ts\");\r\nconst DEntity_1 = __webpack_require__(/*! ./DEntity */ \"./ts/mr/data/DEntity.ts\");\r\nconst DItemEffect_1 = __webpack_require__(/*! ./DItemEffect */ \"./ts/mr/data/DItemEffect.ts\");\r\nconst DState_1 = __webpack_require__(/*! ./DState */ \"./ts/mr/data/DState.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ./MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst DParameter_1 = __webpack_require__(/*! ./DParameter */ \"./ts/mr/data/DParameter.ts\");\r\nconst DFlavorEffect_1 = __webpack_require__(/*! ./DFlavorEffect */ \"./ts/mr/data/DFlavorEffect.ts\");\r\nconst DTextManager_1 = __webpack_require__(/*! ./DTextManager */ \"./ts/mr/data/DTextManager.ts\");\r\nconst DFaction_1 = __webpack_require__(/*! ./DFaction */ \"./ts/mr/data/DFaction.ts\");\r\nconst DEffectSuite_1 = __webpack_require__(/*! ./DEffectSuite */ \"./ts/mr/data/DEffectSuite.ts\");\r\nconst DBehavior_1 = __webpack_require__(/*! ./DBehavior */ \"./ts/mr/data/DBehavior.ts\");\r\nclass MRSetup {\r\n static setupParameter(data) {\r\n const setupComon = (data) => {\r\n { // 味方の被ダメージ\r\n const p = new DParameter_1.DParameterFlavorEffect();\r\n p.flavorEffect = new DFlavorEffect_1.DFlavorEffect();\r\n p.flavorEffect.text = [DTextManager_1.DTextManager.actorDamage.replace(\"%2\", \"%3\")];\r\n p.looksFaction = DFaction_1.DFactionType.Neutral; // Neutral & Friendly\r\n p.point = DEffect_1.DValuePoint.Actual;\r\n p.addition = DParameter_1.DValueAddition.Loss;\r\n data.parameterFlavorEffects.push(p);\r\n }\r\n { // 敵対者の被ダメージ\r\n const p = new DParameter_1.DParameterFlavorEffect();\r\n p.flavorEffect = new DFlavorEffect_1.DFlavorEffect();\r\n p.flavorEffect.text = [DTextManager_1.DTextManager.enemyDamage.replace(\"%2\", \"%3\")];\r\n p.looksFaction = DFaction_1.DFactionType.Hostile;\r\n p.point = DEffect_1.DValuePoint.Actual;\r\n p.addition = DParameter_1.DValueAddition.Loss;\r\n data.parameterFlavorEffects.push(p);\r\n }\r\n { // 味方の増加・回復\r\n const p = new DParameter_1.DParameterFlavorEffect();\r\n p.flavorEffect = new DFlavorEffect_1.DFlavorEffect();\r\n p.flavorEffect.text = [DTextManager_1.DTextManager.actorRecovery];\r\n p.looksFaction = DFaction_1.DFactionType.Neutral; // Neutral & Friendly\r\n p.point = DEffect_1.DValuePoint.Actual;\r\n p.addition = DParameter_1.DValueAddition.Gain;\r\n data.parameterFlavorEffects.push(p);\r\n }\r\n { // 敵対者の増加・回復\r\n const p = new DParameter_1.DParameterFlavorEffect();\r\n p.flavorEffect = new DFlavorEffect_1.DFlavorEffect();\r\n p.flavorEffect.text = [DTextManager_1.DTextManager.enemyRecovery];\r\n p.looksFaction = DFaction_1.DFactionType.Hostile;\r\n p.point = DEffect_1.DValuePoint.Actual;\r\n p.addition = DParameter_1.DValueAddition.Gain;\r\n data.parameterFlavorEffects.push(p);\r\n }\r\n { // 最大値の変化は \"回復した\" ではなく \"増えた\" にしたい。\r\n const p = new DParameter_1.DParameterFlavorEffect();\r\n p.flavorEffect = new DFlavorEffect_1.DFlavorEffect();\r\n p.flavorEffect.text = [DTextManager_1.DTextManager.actorGain];\r\n p.looksFaction = DFaction_1.DFactionType.Neutral; // Neutral & Friendly & Hostile\r\n p.point = DEffect_1.DValuePoint.Growth;\r\n p.addition = DParameter_1.DValueAddition.Gain;\r\n data.parameterFlavorEffects.push(p);\r\n }\r\n if (data.id == MRBasics_1.MRBasics.params.hp) {\r\n // HP の場合、無効ダメージだった場合は NoDamage を表示したい (ツクールがそうなっているので)\r\n { // 味方\r\n const p = new DParameter_1.DParameterFlavorEffect();\r\n p.flavorEffect = new DFlavorEffect_1.DFlavorEffect();\r\n p.flavorEffect.text = [DTextManager_1.DTextManager.actorNoDamage];\r\n p.looksFaction = DFaction_1.DFactionType.Neutral;\r\n p.point = DEffect_1.DValuePoint.Actual;\r\n p.addition = DParameter_1.DValueAddition.None;\r\n data.parameterFlavorEffects.push(p);\r\n }\r\n { // 敵対\r\n const p = new DParameter_1.DParameterFlavorEffect();\r\n p.flavorEffect = new DFlavorEffect_1.DFlavorEffect();\r\n p.flavorEffect.text = [DTextManager_1.DTextManager.enemyNoDamage];\r\n p.looksFaction = DFaction_1.DFactionType.Hostile;\r\n p.point = DEffect_1.DValuePoint.Actual;\r\n p.addition = DParameter_1.DValueAddition.None;\r\n data.parameterFlavorEffects.push(p);\r\n }\r\n }\r\n else {\r\n const p = new DParameter_1.DParameterFlavorEffect();\r\n p.flavorEffect = new DFlavorEffect_1.DFlavorEffect();\r\n p.flavorEffect.text = [(0, Common_1.tr2)(\"%1の%2は変化しなかった。\")];\r\n p.looksFaction = DFaction_1.DFactionType.Neutral;\r\n p.point = DEffect_1.DValuePoint.Actual;\r\n p.addition = DParameter_1.DValueAddition.None;\r\n data.parameterFlavorEffects.push(p);\r\n }\r\n };\r\n switch (data.id) {\r\n case MRBasics_1.MRBasics.params.hp:\r\n case MRBasics_1.MRBasics.params.mp:\r\n case MRBasics_1.MRBasics.params.atk:\r\n case MRBasics_1.MRBasics.params.def:\r\n case MRBasics_1.MRBasics.params.mat:\r\n case MRBasics_1.MRBasics.params.mdf:\r\n case MRBasics_1.MRBasics.params.agi:\r\n case MRBasics_1.MRBasics.params.luk:\r\n case MRBasics_1.MRBasics.params.tp:\r\n //case MRBasics.params.fp:\r\n //case MRBasics.params.pow:\r\n //case MRBasics.params.upgradeValue:\r\n case MRBasics_1.MRBasics.params.remaining:\r\n //case MRBasics.params.capacity:\r\n case MRBasics_1.MRBasics.params.gold:\r\n //case MRBasics.params.level:\r\n case MRBasics_1.MRBasics.params.exp:\r\n setupComon(data);\r\n break;\r\n case MRBasics_1.MRBasics.params.fp: {\r\n break;\r\n }\r\n case MRBasics_1.MRBasics.params.pow: {\r\n setupComon(data);\r\n // 一律「増えた・減った」にしたいので、上書き\r\n data.parameterFlavorEffects = data.parameterFlavorEffects.filter(x => x.looksFaction == DFaction_1.DFactionType.Neutral);\r\n {\r\n const p = new DParameter_1.DParameterFlavorEffect();\r\n p.flavorEffect = new DFlavorEffect_1.DFlavorEffect();\r\n p.flavorEffect.text = [DTextManager_1.DTextManager.actorLoss];\r\n p.looksFaction = DFaction_1.DFactionType.Neutral; // Neutral & Friendly & Hostile\r\n p.point = DEffect_1.DValuePoint.Actual;\r\n p.addition = DParameter_1.DValueAddition.Loss;\r\n data.parameterFlavorEffects.push(p);\r\n }\r\n break;\r\n }\r\n case MRBasics_1.MRBasics.params.upgradeValue: {\r\n setupComon(data);\r\n // 一律「増えた・減った」にしたいので、上書き\r\n data.parameterFlavorEffects = data.parameterFlavorEffects.filter(x => x.looksFaction == DFaction_1.DFactionType.Neutral);\r\n {\r\n const p = new DParameter_1.DParameterFlavorEffect();\r\n p.flavorEffect = new DFlavorEffect_1.DFlavorEffect();\r\n p.flavorEffect.text = [DTextManager_1.DTextManager.actorGain];\r\n p.looksFaction = DFaction_1.DFactionType.Neutral; // Neutral & Friendly & Hostile\r\n p.point = DEffect_1.DValuePoint.Actual;\r\n p.addition = DParameter_1.DValueAddition.Gain;\r\n data.parameterFlavorEffects.push(p);\r\n }\r\n {\r\n const p = new DParameter_1.DParameterFlavorEffect();\r\n p.flavorEffect = new DFlavorEffect_1.DFlavorEffect();\r\n p.flavorEffect.text = [DTextManager_1.DTextManager.actorLoss];\r\n p.looksFaction = DFaction_1.DFactionType.Neutral; // Neutral & Friendly & Hostile\r\n p.point = DEffect_1.DValuePoint.Actual;\r\n p.addition = DParameter_1.DValueAddition.Loss;\r\n data.parameterFlavorEffects.push(p);\r\n }\r\n break;\r\n }\r\n }\r\n // TODO: drain\r\n }\r\n static setupPrefab(data) {\r\n switch (data.key) {\r\n case \"kPrefab_ActorA\":\r\n data.downImage.characterName = \"Damage1\";\r\n data.downImage.characterIndex = 0;\r\n data.downImage.direction = 4;\r\n data.downImage.pattern = 0;\r\n data.downImage.directionFix = true;\r\n data.downImage.stepAnime = false;\r\n data.downImage.walkAnime = false;\r\n break;\r\n }\r\n }\r\n static setupRace(data) {\r\n switch (data.key) {\r\n case \"kRace_アンデッド系\":\r\n data.traits.push({ code: MRBasics_1.MRBasics.traits.ElementedRecoveryRate, dataId: 0, value: -1.0 });\r\n break;\r\n }\r\n }\r\n static setupActor(entity) {\r\n const actor = entity.actorData();\r\n switch (actor.id) {\r\n case 1:\r\n //entity.selfTraits.push({ code: REBasics.traits.TRAIT_STATE_RATE, dataId: REData.getState(\"kState_UT爆発四散\").id, value: 0 });\r\n //entity.selfTraits.push({ code: REBasics.traits.TRAIT_STATE_RESIST, dataId: REData.getState(\"kState_UT爆発四散\").id, value: 0 });\r\n break;\r\n }\r\n }\r\n // NOTE: エディタ側である程度カスタマイズできるように Note の設計を進めていたのだが、\r\n // どのぐらいの粒度で Behabior を分けるべきなのか現時点では決められなかった。(Activity単位がいいのか、Ability単位か、機能単位か)\r\n // そのためここで直定義して一通り作ってみた後、再検討する。\r\n static setupDirectly_DItem(entity) {\r\n const data = entity.item();\r\n // switch (entity.entity.kindId) {\r\n // case MRBasics.entityCategories.WeaponKindId:\r\n // this.setupWeaponCommon(entity);\r\n // break;\r\n // case MRBasics.entityCategories.ShieldKindId:\r\n // this.setupShieldCommon(entity);\r\n // break;\r\n // }\r\n switch (entity.entity.key) {\r\n // case \"kEntity_皮の盾A\":\r\n // entity.equipmentTraits.push({ code: MRBasics.traits.SurvivalParamLossRate, dataId: MRBasics.params.fp, value: 0.5 });\r\n // entity.selfTraits.push({ code: MRBasics.traits.ParamDamageRate, dataId: MRBasics.params.upgradeValue, value: 0.0 });\r\n // break;\r\n // case \"kEntity_青銅の盾A\":\r\n // break;\r\n // case \"kEntity_うろこの盾A\":\r\n // entity.equipmentTraits.push({ code: MRBasics.traits.SkillGuard, dataId: MRData.getSkill(\"kSkill_毒攻撃\").id, value: 0 });\r\n // entity.equipmentTraits.push({ code: MRBasics.traits.SkillGuard, dataId: MRData.getSkill(\"kSkill_毒攻撃_強\").id, value: 0 });\r\n // break;\r\n // case \"kEntity_金の盾A\":\r\n // entity.selfTraits.push({ code: MRBasics.traits.ParamDamageRate, dataId: MRBasics.params.upgradeValue, value: 0.0 });\r\n // break;\r\n case \"kEntity_目覚めの指輪A\":\r\n this.setupRingCommon(entity);\r\n break;\r\n case \"kEntity_ちからの指輪A\":\r\n this.setupRingCommon(entity);\r\n (0, Common_1.assert)(entity.equipment);\r\n entity.equipment.parameters[MRBasics_1.MRBasics.params.pow] = { value: 3, upgradeRate: 0 };\r\n break;\r\n case \"kEntity_高跳びの指輪A\":\r\n this.setupRingCommon(entity);\r\n entity.equipmentTraits.push({ code: MRBasics_1.MRBasics.traits.SuddenSkillEffect, dataId: MRData_1.MRData.getSkill(\"kSkill_Warp\").id, value: 1.0 / 16.0 });\r\n break;\r\n case \"kEntity_睡眠よけの指輪A\":\r\n this.setupRingCommon(entity);\r\n break;\r\n case \"kEntity_ハラヘリの指輪A\":\r\n this.setupRingCommon(entity);\r\n entity.equipmentTraits.push({ code: MRBasics_1.MRBasics.traits.SurvivalParamLossRate, dataId: MRBasics_1.MRBasics.params.fp, value: 2.0 });\r\n break;\r\n case \"kEntity_毒消しの指輪A\":\r\n this.setupRingCommon(entity);\r\n entity.equipmentTraits.push({ code: MRBasics_1.MRBasics.traits.ParamDamageRate, dataId: MRBasics_1.MRBasics.params.pow, value: 0.0 });\r\n break;\r\n case \"kEntity_影読みの指輪A\":\r\n this.setupRingCommon(entity);\r\n entity.equipmentTraits.push({ code: MRBasics_1.MRBasics.traits.ForceVisible, dataId: 0, value: 0 });\r\n break;\r\n case \"kEntity_インプよけの指輪A\":\r\n this.setupRingCommon(entity);\r\n entity.equipmentTraits.push({ code: MRBasics_1.MRBasics.traits.SkillGuard, dataId: MRData_1.MRData.getSkill(\"kSkill_レベルダウン\").id, value: 0 });\r\n entity.equipmentTraits.push({ code: MRBasics_1.MRBasics.traits.SkillGuard, dataId: MRData_1.MRData.getSkill(\"kSkill_毒攻撃_強\").id, value: 0 });\r\n break;\r\n case \"kEntity_忍び足の指輪A\":\r\n this.setupRingCommon(entity);\r\n break;\r\n case \"kEntity_罠よけの指輪A\":\r\n this.setupRingCommon(entity);\r\n entity.equipmentTraits.push({ code: MRBasics_1.MRBasics.traits.DisableTrap, dataId: 0, value: 0 });\r\n break;\r\n case \"kEntity_ハラヘラズの指輪A\":\r\n this.setupRingCommon(entity);\r\n entity.equipmentTraits.push({ code: MRBasics_1.MRBasics.traits.SurvivalParamLossRate, dataId: MRBasics_1.MRBasics.params.fp, value: 0.0 });\r\n break;\r\n case \"kEntity_きれいな指輪A\":\r\n this.setupRingCommon(entity);\r\n break;\r\n case \"kEntity_木の矢A\":\r\n this.setupArrowCommon(entity);\r\n entity.shortcut = true;\r\n entity.display.stackedName = \"%1本の\" + entity.display.name;\r\n entity.selfTraits.push({ code: MRBasics_1.MRBasics.traits.Stackable, dataId: 0, value: 0 });\r\n entity.addReaction(MRBasics_1.MRBasics.actions.ShootActionId, undefined, true);\r\n entity.initialStackCount = { minValue: 2, maxValue: 7 };\r\n break;\r\n case \"kEntity_鉄の矢A\":\r\n this.setupArrowCommon(entity);\r\n entity.shortcut = true;\r\n entity.display.stackedName = \"%1本の\" + entity.display.name;\r\n entity.selfTraits.push({ code: MRBasics_1.MRBasics.traits.Stackable, dataId: 0, value: 0 });\r\n entity.addReaction(MRBasics_1.MRBasics.actions.ShootActionId, undefined, true);\r\n entity.initialStackCount = { minValue: 2, maxValue: 7 };\r\n break;\r\n case \"kEntity_銀の矢A\":\r\n this.setupArrowCommon(entity);\r\n entity.shortcut = true;\r\n entity.display.stackedName = \"%1本の\" + entity.display.name;\r\n entity.selfTraits.push({ code: MRBasics_1.MRBasics.traits.Stackable, dataId: 0, value: 0 });\r\n entity.selfTraits.push({ code: MRBasics_1.MRBasics.traits.PenetrationItem, dataId: 0, value: 0 });\r\n entity.addReaction(MRBasics_1.MRBasics.actions.ShootActionId, undefined, true);\r\n entity.initialStackCount = { minValue: 2, maxValue: 7 };\r\n break;\r\n case \"kEntity_毒矢A\":\r\n this.setupArrowCommon(entity);\r\n entity.shortcut = true;\r\n entity.display.stackedName = \"%1本の\" + entity.display.name;\r\n entity.selfTraits.push({ code: MRBasics_1.MRBasics.traits.Stackable, dataId: 0, value: 0 });\r\n entity.addReaction(MRBasics_1.MRBasics.actions.ShootActionId, undefined, true);\r\n entity.initialStackCount = { minValue: 2, maxValue: 7 };\r\n break;\r\n case \"kEntity_GoldA\":\r\n this.setupItemCommon(entity);\r\n entity.addReaction(MRBasics_1.MRBasics.actions.collide, entity.mainEmittor());\r\n //entity.addEmittor(DEffectCause.Hit, REData.cloneEmittor(entity.mainEmittor()));\r\n break;\r\n case \"kEntity_弟切草A\": {\r\n // const mainEmittor = entity.mainEmittor();\r\n // const effect1 = mainEmittor.effectSuite.targetEffect(0);\r\n // const effect2 = MRData.cloneEffect(effect1.effect);\r\n // // effect1: 一般用 (HP 回復のみ)\r\n // effect1.conditions.fallback = true;\r\n // // effect2: Actor 専用 (最大HP の上昇効果もある)\r\n // const effect2Ref = new DEffectRef(effect2.id);\r\n // effect2Ref.conditions.targetCategoryId = MRBasics.entityCategories.actor;\r\n // effect2Ref.effect.parameterQualifyings[0].conditionFormula = \"a.hp < a.max_hp\";\r\n // effect2Ref.effect.parameterQualifyings.push(\r\n // new DParameterQualifying(MRBasics.params.hp, \"2\", DParameterEffectApplyType.Recover)\r\n // .withApplyTarget(DValuePoint.Growth)\r\n // .withConditionFormula(\"a.hp >= a.max_hp\"));\r\n // mainEmittor.effectSuite.addTargetEffect(effect2Ref);\r\n // const [eatEmittor, collideEmittor] = this.setupGrassCommon(entity);\r\n // break;\r\n // const [eatEmittor, collideEmittor] = this.setupGrassCommon(entity);\r\n // // entity.addReaction(REBasics.actions.EatActionId, 0);\r\n // // entity.addEmittor(DEffectCause.Eat, entity.mainEmittor());\r\n // // entity.addEmittor(DEffectCause.Hit, entity.mainEmittor());\r\n // //const emittor = entity.getReaction(REBasics.actions.EatActionId).emittor();\r\n // eatEmittor.effectSet.effect(0).effect.parameterQualifyings.push(new DParameterQualifying(REBasics.params.hp, \"999\", DParameterEffectApplyType.Recover));\r\n // eatEmittor.effectSet.effect(0).effectBehaviors.push({ specialEffectId: REBasics.effectBehaviors.removeStatesByIntentions, value: DStateIntentions.Negative });\r\n break;\r\n }\r\n case \"kEntity_ドラゴン草A\":\r\n this.setupGrassCommon(entity);\r\n //entity.addReaction(REBasics.actions.EatActionId, 0);\r\n entity.addReaction(MRBasics_1.MRBasics.actions.EatActionId, MRData_1.MRData.getSkill(\"kSkill_炎のブレス_直線\").emittor());\r\n //entity.addEmittor(DEffectCause.Eat, entity.mainEmittor());\r\n //entity.addEmittor(DEffectCause.Eat, REData.getSkill(\"kSkill_炎のブレス_直線\").emittor());\r\n break;\r\n case \"kEntity_しびれ草A\":\r\n this.setupGrassCommon(entity);\r\n // entity.addReaction(REBasics.actions.EatActionId, 0);\r\n // entity.addEmittor(DEffectCause.Eat, entity.mainEmittor());\r\n break;\r\n case \"kEntity_きえさり草A\":\r\n this.setupGrassCommon(entity);\r\n // entity.addReaction(REBasics.actions.EatActionId, 0);\r\n // entity.addEmittor(DEffectCause.Eat, entity.mainEmittor());\r\n break;\r\n case \"kEntity_RevivalGrassA\":\r\n this.setupGrassCommon(entity);\r\n entity.entity.behaviors.push(new DBehavior_1.DBehaviorInstantiation(MRData_1.MRData.getBehavior(\"RevivalItem\").id, undefined));\r\n entity.addReaction(MRBasics_1.MRBasics.actions.dead, entity.mainEmittor());\r\n break;\r\n case \"kEntity_System_炎のブレスA\":\r\n entity.volatilityProjectile = true;\r\n break;\r\n case \"kEntity_System_MagicBulletA\":\r\n entity.volatilityProjectile = true;\r\n break;\r\n case \"kEntity_ふきとばしの杖A\":\r\n //this.setupStaffCommon(entity);\r\n //data.effectSet.setEffect(DEffectCause.Hit, REData.getSkill(\"kSkill_変化\").effect);\r\n entity.addReaction(MRBasics_1.MRBasics.actions.collide, MRData_1.MRData.getSkill(\"kSkill_ふきとばし\").emittor());\r\n //entity.addEmittor(DEffectCause.Hit, REData.getSkill(\"kSkill_ふきとばし\").emittor());\r\n entity.addReaction(MRBasics_1.MRBasics.actions.WaveActionId, MRData_1.MRData.getSkill(\"kSkill_魔法弾発射_一般\").emittor());\r\n entity.idealParams[MRBasics_1.MRBasics.params.remaining] = 5;\r\n entity.identificationDifficulty = DEntity_1.DIdentificationDifficulty.Obscure;\r\n break;\r\n case \"kEntity_大損の杖A\": {\r\n this.setupStaffCommon(entity);\r\n //entity.addEmittor(DEffectCause.Hit, entity.mainEmittor());\r\n entity.addReaction(MRBasics_1.MRBasics.actions.WaveActionId, MRData_1.MRData.getSkill(\"kSkill_魔法弾発射_一般\").emittor());\r\n entity.idealParams[MRBasics_1.MRBasics.params.remaining] = 5;\r\n const effect = entity.mainEmittor().effectSuite.targetEffect(0);\r\n effect.effect.parameterQualifyings.push(new DEffect_1.DParameterQualifying(MRBasics_1.MRBasics.params.hp, \"b.hp / 2\", DEffect_1.DParameterEffectApplyType.Damage));\r\n effect.effect.flavorEffect = DFlavorEffect_1.DFlavorEffect.fromRmmzAnimationId(55);\r\n break;\r\n }\r\n case \"kEntity_透明の杖A\": {\r\n this.setupStaffCommon(entity);\r\n //entity.addEmittor(DEffectCause.Hit, entity.mainEmittor());\r\n entity.addReaction(MRBasics_1.MRBasics.actions.WaveActionId, MRData_1.MRData.getSkill(\"kSkill_魔法弾発射_一般\").emittor());\r\n entity.idealParams[MRBasics_1.MRBasics.params.remaining] = 5;\r\n const effect = entity.mainEmittor().effectSuite.targetEffect(0);\r\n effect.effect.rmmzSpecialEffectQualifyings.push({ code: DItemEffect_1.DItemEffect.EFFECT_ADD_STATE, dataId: MRData_1.MRData.getState(\"kState_UT透明\").id, value1: 1.0, value2: 0 });\r\n effect.effect.flavorEffect = DFlavorEffect_1.DFlavorEffect.fromRmmzAnimationId(101);\r\n break;\r\n }\r\n case \"kEntity_倍速の杖A\": {\r\n this.setupStaffCommon(entity);\r\n //entity.addEmittor(DEffectCause.Hit, entity.mainEmittor());\r\n entity.addReaction(MRBasics_1.MRBasics.actions.WaveActionId, MRData_1.MRData.getSkill(\"kSkill_魔法弾発射_一般\").emittor());\r\n entity.idealParams[MRBasics_1.MRBasics.params.remaining] = 5;\r\n const effect = entity.mainEmittor().effectSuite.targetEffect(0);\r\n effect.effect.buffQualifying.push({\r\n paramId: MRBasics_1.MRBasics.params.agi,\r\n level: 1,\r\n levelType: DEffect_1.DBuffLevelOp.Add,\r\n type: DEffect_1.DBuffType.Add,\r\n turn: 10,\r\n });\r\n effect.effect.flavorEffect = DFlavorEffect_1.DFlavorEffect.fromRmmzAnimationId(12);\r\n break;\r\n }\r\n case \"kEntity_いかずちの杖A\": {\r\n this.setupStaffCommon(entity);\r\n //entity.addEmittor(DEffectCause.Hit, entity.mainEmittor());\r\n entity.addReaction(MRBasics_1.MRBasics.actions.WaveActionId, MRData_1.MRData.getSkill(\"kSkill_魔法弾発射_一般\").emittor());\r\n entity.idealParams[MRBasics_1.MRBasics.params.remaining] = 5;\r\n const effect = entity.mainEmittor().effectSuite.targetEffect(0);\r\n effect.effect.parameterQualifyings.push(new DEffect_1.DParameterQualifying(MRBasics_1.MRBasics.params.hp, \"35\", DEffect_1.DParameterEffectApplyType.Damage)\r\n .withVariance(20));\r\n effect.effect.flavorEffect = DFlavorEffect_1.DFlavorEffect.fromRmmzAnimationId(77);\r\n break;\r\n }\r\n case \"kEntity_混乱の杖A\": {\r\n this.setupStaffCommon(entity);\r\n //entity.addEmittor(DEffectCause.Hit, entity.mainEmittor());\r\n entity.addReaction(MRBasics_1.MRBasics.actions.WaveActionId, MRData_1.MRData.getSkill(\"kSkill_魔法弾発射_一般\").emittor());\r\n entity.idealParams[MRBasics_1.MRBasics.params.remaining] = 5;\r\n const effect = entity.mainEmittor().effectSuite.targetEffect(0);\r\n effect.effect.rmmzSpecialEffectQualifyings.push({ code: DItemEffect_1.DItemEffect.EFFECT_ADD_STATE, dataId: MRData_1.MRData.getState(\"kState_UT混乱\").id, value1: 1.0, value2: 0 });\r\n effect.effect.flavorEffect = DFlavorEffect_1.DFlavorEffect.fromRmmzAnimationId(63);\r\n break;\r\n }\r\n case \"kEntity_分裂の杖A\": {\r\n this.setupStaffCommon(entity);\r\n //entity.addEmittor(DEffectCause.Hit, entity.mainEmittor());\r\n entity.addReaction(MRBasics_1.MRBasics.actions.WaveActionId, MRData_1.MRData.getSkill(\"kSkill_魔法弾発射_一般\").emittor());\r\n entity.idealParams[MRBasics_1.MRBasics.params.remaining] = 5;\r\n const effect = entity.mainEmittor().effectSuite.targetEffect(0);\r\n effect.effect.effectBehaviors.push({ specialEffectId: MRBasics_1.MRBasics.effectBehaviors.division, entityId: 0, dataId: 0, value: 0 });\r\n effect.effect.flavorEffect = DFlavorEffect_1.DFlavorEffect.fromRmmzAnimationId(106);\r\n break;\r\n }\r\n case \"kEntity_睡眠の杖A\": {\r\n this.setupStaffCommon(entity);\r\n //entity.addEmittor(DEffectCause.Hit, entity.mainEmittor());\r\n entity.addReaction(MRBasics_1.MRBasics.actions.WaveActionId, MRData_1.MRData.getSkill(\"kSkill_魔法弾発射_一般\").emittor());\r\n entity.idealParams[MRBasics_1.MRBasics.params.remaining] = 5;\r\n const effect = entity.mainEmittor().effectSuite.targetEffect(0);\r\n effect.effect.rmmzSpecialEffectQualifyings.push({ code: DItemEffect_1.DItemEffect.EFFECT_ADD_STATE, dataId: MRData_1.MRData.getState(\"kState_睡眠\").id, value1: 1.0, value2: 0 });\r\n effect.effect.flavorEffect = DFlavorEffect_1.DFlavorEffect.fromRmmzAnimationId(62);\r\n break;\r\n }\r\n case \"kEntity_封印の杖A\":\r\n this.setupStaffCommon(entity);\r\n //entity.addEmittor(DEffectCause.Hit, entity.mainEmittor());\r\n entity.addReaction(MRBasics_1.MRBasics.actions.WaveActionId, MRData_1.MRData.getSkill(\"kSkill_魔法弾発射_一般\").emittor());\r\n entity.idealParams[MRBasics_1.MRBasics.params.remaining] = 5;\r\n break;\r\n case \"kEntity_変化の杖A\":\r\n //this.setupStaffCommon(entity);\r\n entity.addReaction(MRBasics_1.MRBasics.actions.collide, MRData_1.MRData.getSkill(\"kSkill_変化\").emittor());\r\n entity.addReaction(MRBasics_1.MRBasics.actions.WaveActionId, MRData_1.MRData.getSkill(\"kSkill_魔法弾発射_一般\").emittor());\r\n entity.idealParams[MRBasics_1.MRBasics.params.remaining] = 3;\r\n entity.identificationDifficulty = DEntity_1.DIdentificationDifficulty.Obscure;\r\n /*\r\n 杖のメモ (2021/7/5時点のこうしたい)\r\n ----------\r\n [振る] はスキルの発動。火炎草が \"Eat\" でブレススキルを発動するのと同じ。\r\n 魔法弾はスキル側が生成する。\r\n もし炎ブレススキルと合わせるなら、魔法弾スキルを効果の数だけ用意することになる。\r\n でも実際はそのほうがいいかもしれない。投げ当てと魔法弾で効果が変わるものもあるため。(トンネルの杖)\r\n でもやっぱりほとんどの魔法弾は、投げ当てと同じ効果を発動する。そういった設定も欲しいかも。\r\n\r\n ある種の、elona の「銃器」みたいな考えの方がいいだろうか?\r\n 杖と魔法弾、銃と弾丸。\r\n 弾丸の威力に銃の性能が反映されるように、魔法弾の効果に杖の効果が反映される感じ。\r\n 投げと魔法弾で異なる効果は、魔法弾に独自の Effect を持たせる。\r\n そうでなければ、魔法弾は「自分を射出したEntity(杖) の Cause.Hit の効果を発動する」とか。\r\n */\r\n break;\r\n case \"kEntity_高跳びの杖A\": {\r\n this.setupStaffCommon(entity);\r\n //entity.addEmittor(DEffectCause.Hit, entity.mainEmittor());\r\n entity.addReaction(MRBasics_1.MRBasics.actions.WaveActionId, MRData_1.MRData.getSkill(\"kSkill_魔法弾発射_一般\").emittor());\r\n entity.idealParams[MRBasics_1.MRBasics.params.remaining] = 5;\r\n const effect = entity.mainEmittor().effectSuite.targetEffect(0);\r\n effect.effect.effectBehaviors.push({ specialEffectId: MRBasics_1.MRBasics.effectBehaviors.randomWarp, entityId: 0, dataId: 0, value: 0 });\r\n break;\r\n }\r\n case \"kEntity_鈍足の杖A\": {\r\n this.setupStaffCommon(entity);\r\n // entity.addEmittor(DEffectCause.Hit, entity.mainEmittor());\r\n entity.addReaction(MRBasics_1.MRBasics.actions.WaveActionId, MRData_1.MRData.getSkill(\"kSkill_魔法弾発射_一般\").emittor());\r\n entity.idealParams[MRBasics_1.MRBasics.params.remaining] = 5;\r\n const effect = entity.mainEmittor().effectSuite.targetEffect(0);\r\n effect.effect.buffQualifying.push({\r\n paramId: MRBasics_1.MRBasics.params.agi,\r\n level: -1,\r\n levelType: DEffect_1.DBuffLevelOp.Add,\r\n type: DEffect_1.DBuffType.Add,\r\n turn: 10,\r\n });\r\n effect.effect.flavorEffect = DFlavorEffect_1.DFlavorEffect.fromRmmzAnimationId(54);\r\n break;\r\n }\r\n case \"kEntity_もろはの杖A\": {\r\n this.setupStaffCommon(entity);\r\n //entity.addEmittor(DEffectCause.Hit, entity.mainEmittor());\r\n entity.addReaction(MRBasics_1.MRBasics.actions.WaveActionId, MRData_1.MRData.getSkill(\"kSkill_魔法弾発射_一般\").emittor());\r\n entity.idealParams[MRBasics_1.MRBasics.params.remaining] = 5;\r\n const emittor = entity.mainEmittor();\r\n //emittor.selfAnimationId = 60;\r\n //emittor.scope.range = DEffectFieldScopeRange.Performer;\r\n const effect1 = emittor.effectSuite.targetEffect(0);\r\n effect1.effect.flavorEffect = DFlavorEffect_1.DFlavorEffect.fromRmmzAnimationId(60);\r\n const effect2 = MRData_1.MRData.getItem(\"kEntity_もろはの杖A_使用者側効果\").mainEmittor().effectSuite.targetEffect(0);\r\n effect2.effect.flavorEffect = DFlavorEffect_1.DFlavorEffect.fromRmmzAnimationId(60);\r\n emittor.effectSuite.succeededSelfEffect = effect2;\r\n break;\r\n }\r\n case \"kEntity_転ばぬ先の杖A\":\r\n this.setupStaffCommon(entity);\r\n entity.mainEmittor().effectSuite.targetEffect(0).effect.effectBehaviors.push({ specialEffectId: MRBasics_1.MRBasics.effectBehaviors.stumble, entityId: 0, dataId: 0, value: 0 });\r\n //entity.addEmittor(DEffectCause.Hit, entity.mainEmittor());\r\n entity.addReaction(MRBasics_1.MRBasics.actions.WaveActionId, MRData_1.MRData.getSkill(\"kSkill_魔法弾発射_一般\").emittor());\r\n entity.idealParams[MRBasics_1.MRBasics.params.remaining] = 5;\r\n entity.isTraitCharmItem = true;\r\n //entity.affestTraits.push({ code: REBasics.traits.SealActivity, dataId: REBasics.actions.stumble, value: 0 });\r\n /*\r\n [2021/10/27]\r\n ----------\r\n Seal を利用するのはちょっと違う気がする。封印というより、リソースを消費して防御したい。\r\n ある意味カウンターに該当するが、これは防御目的になり、ダメージや効果の減少を扱う。\r\n RMMZはこのような仕組みは「反撃」「魔法反射」などがあるが、それぞれ通常攻撃や元スキルに限るなど制約は非常に大きい。\r\n 実質今回の要求のように、防御目的で何か効果を発動する仕組みは存在しない。\r\n\r\n とりあえずRMMZエディタで強引に定義するなら、スキルの一つとして作る方がいいだろう。少なくともターン数などは持たないのでステートではない。\r\n\r\n 一瞬だけステートを付加する案は?\r\n アリそうだけど、その効果終了のタイミングが難しい。例えば連撃を受けた場合はその分だけコスト減が発生してほしい。\r\n RMMZでは「防御」がステート扱いなのでイメージはしやすいのかもしれないが…。\r\n\r\n スキルとステートのハイブリッドがよいかも?\r\n これなら、カウンター攻撃と同じように発動できる。\r\n - onActivityで反応\r\n - EmittorPerformer で、itemEntity に対してコストを要求する\r\n - 転倒防止ステートを付加する\r\n\r\n こんな複雑なことする必要ある?\r\n 機能の組み合わせで行けそうではある一方、抽象的すぎるのが心配。\r\n\r\n バリアみたいな考えにしてみる?\r\n 持っている間、ステートを付与するような感じ。\r\n\r\n コスト減算は使い捨ての盾と似ているようだがちょっと違う。そっちは後処理。こっちは前処理。\r\n\r\n 余りにも汎用性を考えすぎて、例えばステートにしても、ステートのほかのフィールドがほとんど意味をなさない、となればステートにする必要もない。\r\n\r\n どんなときにカウンターしたい?\r\n - 特定の属性の攻撃を受けた時 (誘爆など。または、RMMZにある物理攻撃・魔法攻撃)\r\n - 特定の Activity を実行するとき (Action, Reaction)\r\n \r\n そもそもどんなものを予防したい?\r\n - サビよけ\r\n - 盗み守り\r\n - 所持金守り\r\n - ついばみ守り\r\n - 転び防止\r\n - 催眠無効\r\n - 混乱無効\r\n - にぎり避け\r\n - 受け流し\r\n - 呪い無効\r\n - パラメータダウン無効\r\n - はじきよけ\r\n - 罠除け\r\n ステートはともかく、具体的な処理が伴う盗み、はじきなどは、あらかじめ Trait として設定された「盗みよけ」が存在するかどうかで、\r\n 処理自体を行うかどうかを内部的に判断することにした。これは全部 Activity にしきれない背景もある。\r\n\r\n ざっと分類すると\r\n - パラメータ変化の可否\r\n - ステート変化の可否\r\n - 動作の可否\r\n\r\n 当初は全部 Action-Reaction の仕組みで何とかしようとしてたけど… どうなんだろう?\r\n\r\n SkillともStateとも違うデータ構造があったほうが良いとは思うが、\r\n それを設けたとしても汎用化しづらい。\r\n そうすると、例えば Protect みたいな予防用データ構造を設けたとしても Behavior と大して変わらない運用になる。\r\n それなら Behavior でいいだろう。\r\n 具象的な実装が増えることを懸念して Behavior にするのを躊躇っていたが、今はこのほうがよさそう。\r\n 実装を続ける中で共通化できる部分も見えてくるだろう。\r\n …ということで、ひとまずは Behavior で行ってみる。当初の計画通りと言えばその通りだけど。\r\n\r\n あとはどうやって通知するか。\r\n ポイントとしては、発動側のアクション自体を取りやめるのではなく、効果および後処理(盗んだ後にワープなど)をリジェクトすること。\r\n 行動の可否については Action-Reaction の仕組みでも可能だが、パラメータとステートについては新たな専用のメソッドが必要になりそう。\r\n\r\n onEffectBehaviorReaction とか?\r\n IDはなんか、EffectBehaviorId でいい気がする。\r\n パラメータは ParamId, ステートは StateId で、それぞれ onEffectParam, onEffectState とかを用意することで、\r\n 「Effect」として一貫性は持たせられそう。\r\n\r\n [2021/10/28]\r\n ----------\r\n 転び石はダメージと転びは別の仕組みで適用される。そのためEffectBehaviorだけ防止しても、ダメージは防止できない。\r\n 対策としては…\r\n A. Effect自体の発動を無効にする\r\n B. Effectを複数に分けて、最初の転倒が防止されたら後続のダメージを与えるEffectは発動しない\r\n C. どのタイミングでリジェクトするか、preview 側で決める\r\n 考えなくてはならないこととして、\r\n - 例えば毒攻撃は、毒を防止されても攻撃は通したい\r\n\r\n C はやめたほうがいいかも。リジェクト側が扱いたいのはあくまで「転倒を防止したい」「毒を防止したい」「そうび弾きを防止したい」\r\n といったことであって、それに付属するダメージ等他Effectまで関心を持つべきではないだろう。\r\n - 転びであれば、付属する微ダメージは転びの表現の一部\r\n - 毒攻撃であれば、HPダメージにあくまでオプションとして付く効果\r\n …というように考えることもできる。\r\n \r\n [2021/10/31] Effect 側が RejectionLevel を持つのはやめたほうがいいかも\r\n ----------\r\n 途中まで実装したけどやめてみる。\r\n 攻撃と一言にいっても、装備につく印やステートによって、ある Effect に追加の EffectBehavior や SpecialEffect が付くことがある。\r\n Level.All(ひとつでも効果が無効なら、Effect全体を無効化)していると、そういった追加によって攻撃全体がキャンセルされる可能性がある。\r\n 例えば、転びの追加効果のある攻撃、など。\r\n かなりコーナーケースではあるとおもうけど、拡張に対して回避の難しい問題が潜在することになるので、やめたいところ。\r\n\r\n スキル、Effect, EffectBehavior, SpecialEffect などそれぞれでリジェクトするかを Behavior 側で判断できる仕組みにしてみる。\r\n */\r\n break;\r\n case \"kEntity_死の杖A\": {\r\n this.setupStaffCommon(entity);\r\n //entity.addEmittor(DEffectCause.Hit, entity.mainEmittor());\r\n entity.addReaction(MRBasics_1.MRBasics.actions.WaveActionId, MRData_1.MRData.getSkill(\"kSkill_魔法弾発射_一般\").emittor());\r\n entity.idealParams[MRBasics_1.MRBasics.params.remaining] = 5;\r\n const effect = entity.mainEmittor().effectSuite.targetEffect(0);\r\n effect.effect.flavorEffect = DFlavorEffect_1.DFlavorEffect.fromRmmzAnimationId(65);\r\n break;\r\n }\r\n case \"kEntity_眠りガスA\": {\r\n const emittor = entity.mainEmittor();\r\n emittor.selfAnimationId = 35;\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.Center;\r\n break;\r\n }\r\n case \"kEntity_地雷A\": {\r\n const emittor = entity.mainEmittor();\r\n const effect = emittor.effectSuite.targetEffect(0);\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.AroundAndCenter;\r\n emittor.scope.length = 1;\r\n emittor.selfAnimationId = 109;\r\n //emittor.selfSequelId = REBasics.sequels.explosion;\r\n //effect.qualifyings.specialEffectQualifyings.push({code: DSpecialEffectCodes.DeadlyExplosion, dataId: 0, value1: 0, value2: 0});\r\n const pp = new DEffect_1.DParameterQualifying(MRBasics_1.MRBasics.params.hp, \"b.hp / 2\", DEffect_1.DParameterEffectApplyType.Damage)\r\n .withElementId(MRBasics_1.MRBasics.elements.explosion);\r\n pp.elementIds.push(MRData_1.MRData.getElement(\"kElement_DeathExplosion\").id);\r\n effect.effect.parameterQualifyings.push(pp);\r\n // effect.effect.parameterQualifyings.push(\r\n // new DParameterQualifying(0, \"0\", DParameterEffectApplyType.Damage)\r\n // .withElementId(REData.getAttackElement(\"kElement_DeathExplosion\").id));\r\n // effect.effect.parameterQualifyings.push({\r\n // parameterId: REBasics.params.hp,\r\n // applyTarget: DParameterApplyTarget.Current,\r\n // elementId: REBasics.elements.explosion,\r\n // formula: \"b.hp / 2\",\r\n // applyType: DParameterEffectApplyType.Damage,\r\n // variance: 0,\r\n // silent: false,\r\n // });\r\n //effect.rmmzSpecialEffectQualifyings.push({code: DItemEffect.EFFECT_ADD_STATE, dataId: REData.getState(\"kState_UT爆発四散\").id, value1: 1.0, value2: 0});\r\n // 必中だと耐性を持っているはずの Player も即死してしまうので。\r\n effect.effect.hitType = DEffect_1.DEffectHitType.Magical;\r\n entity.counterActions.push({ conditionAttackType: MRBasics_1.MRBasics.elements.explosion, emitSelf: true });\r\n //entity.selfTraits.push({ code: REBasics.traits.TRAIT_STATE_RESIST, dataId: REData.getState(\"kState_UT爆発四散\").id, value: 0 });\r\n /*\r\n 地雷でEnemy側に「ダメージを受けた」メッセージが出る問題\r\n ----------\r\n\r\n 地雷側に、対象別の効果を設ける?\r\n →やめたほうがいいかも。地雷効果をどのように受けるかは相手側による。普通の敵は消滅するが、パワーアップする者もいるし、誘爆することもある。\r\n\r\n SubEffectという仕組みはあり今は装備のサビ効果で使用しているが、これは本当にスキル側の都合を定義するだけ。\r\n 相手側がメッキされているとか、そういった事情は考慮しない。\r\n\r\n しかし「致死性の爆発」という特徴は Effect 側の設定にするべき。\r\n 致死性の爆発にも、ダメージ 1/2 や 1/4、HP1にするなど様々なので、この式は設定できるようにするべき。\r\n そうすると方針は、\r\n A. 「致死性の爆発」をTraitにして、これを受け付けた場合はダメージ計算を無しにする。\r\n B. 「致死性の爆発」をState付加にして、これを受け付けた場合はダメージ計算を無しにする。\r\n …どちらにしてもダメージ計算を何とかする仕組みは必要になる。\r\n 前者は Behavior の実装が必要であり汎用化できないのでできれば避けたいが…。\r\n ダメージ計算を考えても、State の方が有利かも。\r\n ツクールデフォルトとは多分異なるが、戦闘不能系ステートが付加されたらParamResultを全部クリアしてしまう、で行けそう。\r\n */\r\n /*\r\n [2022/5/29] 即死爆発\r\n ----------\r\n これまでは戦闘不能ステート (kState_UT爆発四散) を用いることで対策してきた。\r\n しかしこれだとデフォが消滅になるため、重要なオブジェクトには間違いなく爆死ステート耐性を持たせなければならない。\r\n 階段などに指定し忘れると、ゲームが進行不能になる。(実際に遇った)\r\n なので、デフォは耐性持ちにしたい。\r\n \r\n それか、「ある属性に対する脆弱性」のような Trait で実現したほうがいいだろうか?\r\n\r\n ### デフォでステート耐性を持たせる場合\r\n - 「持たせない」という指定をどうするのか、逆にちょっと仕様がすっきりしないかも。\r\n - RMMZ で同じ「アイテム」画面で設定するが、カテゴリによってデフォが異なるので、何に対しでデフォで耐性つけるのか仕様を考える必要がある。\r\n - 通常のアイテムは耐性無し\r\n - トラップは耐性あり、など\r\n - どのステートをデフォの耐性アリとするのか?の指定をどうするか(kState_UT爆発四散 だけでよいのか?)\r\n\r\n ### 脆弱性システムを作る場合\r\n - 必要なものに Trait などを指定すればよいので、「脆弱性が \"ある\"」というイメージで設定しやすい。\r\n - デフォが脆弱性無しなので、少なくとも想定外のオブジェクトが消えてしまう問題を回避できる。\r\n\r\n ### 属性脆弱 vs ステート脆弱\r\n どちらでもよさそう。\r\n - 爆発属性は自然。爆発戦闘不能というステートを作るとすると、爆発耐性の無い Entity にとっては不要なステートが付かないような工夫が要る。\r\n - 毒状態が付いたら即死するようなモンスターのデザインは在りかも。\r\n\r\n */\r\n break;\r\n }\r\n case \"kEntity_トラバサミA\": {\r\n const emittor = entity.mainEmittor();\r\n const effect = emittor.effectSuite.targetEffect(0);\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.Center;\r\n effect.effect.rmmzSpecialEffectQualifyings.push({ code: DItemEffect_1.DItemEffect.EFFECT_ADD_STATE, dataId: MRData_1.MRData.getState(\"kState_UTトラバサミ\").id, value1: 1.0, value2: 0 });\r\n break;\r\n }\r\n case \"kEntity_バネA\": {\r\n const emittor = entity.mainEmittor();\r\n const effect = emittor.effectSuite.targetEffect(0);\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.Center;\r\n effect.effect.effectBehaviors.push({ specialEffectId: MRBasics_1.MRBasics.effectBehaviors.randomWarp, entityId: 0, dataId: 0, value: 0 });\r\n break;\r\n }\r\n case \"kEntity_転び石A\":\r\n entity.mainEmittor().scope.range = DEffect_1.DEffectFieldScopeType.Center;\r\n entity.mainEmittor().effectSuite.targetEffect(0).effect.effectBehaviors.push({ specialEffectId: MRBasics_1.MRBasics.effectBehaviors.stumble, entityId: 0, dataId: 0, value: 0 });\r\n break;\r\n case \"kEntity_木の矢の罠A\": {\r\n const emittor = entity.mainEmittor();\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.ReceiveProjectile;\r\n emittor.scope.length = Infinity;\r\n emittor.scope.projectilePrefabKey = \"kEntity_木の矢A\";\r\n break;\r\n }\r\n case \"kEntity_毒矢の罠A\": {\r\n const emittor = entity.mainEmittor();\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.ReceiveProjectile;\r\n emittor.scope.length = Infinity;\r\n emittor.scope.projectilePrefabKey = \"kEntity_毒矢A\";\r\n emittor.effectSuite.targetEffect(0).effect.parameterQualifyings.push(new DEffect_1.DParameterQualifying(MRBasics_1.MRBasics.params.pow, \"1\", DEffect_1.DParameterEffectApplyType.Damage));\r\n // emittor.effectSet.effect(0).effect.parameterQualifyings.push({\r\n // parameterId: REBasics.params.pow,\r\n // applyTarget: DParameterApplyTarget.Current,\r\n // elementId: 0,\r\n // formula: \"1\",\r\n // applyType: DParameterEffectApplyType.Damage,\r\n // variance: 0,\r\n // silent: false,\r\n // });\r\n break;\r\n }\r\n case \"kEntity_錆ワナA\":\r\n break;\r\n case \"kEntity_落とし穴A\": {\r\n const emittor = entity.mainEmittor();\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.Center;\r\n emittor.effectSuite.targetEffect(0).effect.effectBehaviors.push({ specialEffectId: MRBasics_1.MRBasics.effectBehaviors.transferToLowerFloor, entityId: 0, dataId: 0, value: 0 });\r\n break;\r\n }\r\n case \"kEntity_突風の罠A\": {\r\n const emittor = entity.mainEmittor();\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.Center;\r\n emittor.effectSuite.targetEffect(0).effect.effectBehaviors.push({ specialEffectId: MRBasics_1.MRBasics.effectBehaviors.transferToNextFloor, entityId: 0, dataId: 0, value: 0 });\r\n emittor.selfAnimationId = 94;\r\n break;\r\n }\r\n case \"kEntity_保存の壺A\":\r\n entity.addReaction(MRBasics_1.MRBasics.actions.PutInActionId);\r\n entity.addReaction(MRBasics_1.MRBasics.actions.PickOutActionId);\r\n entity.addReaction(MRBasics_1.MRBasics.actions.collide, MRData_1.MRData.getSkill(\"kSkill_投げ当て_1ダメ\").emittor());\r\n entity.entity.behaviors.push(new DBehavior_1.DBehaviorInstantiation(MRData_1.MRData.getBehavior(\"Inventory\").id, { code: \"Inventory\", minCapacity: 4, maxCapacity: 6, storage: true }));\r\n break;\r\n case \"kEntity_くちなしの巻物A\":\r\n this.setupScrollCommon(entity);\r\n //entity.effectSet.mainEmittor().effect.otherEffectQualifyings.push({key: \"kSystemEffect_脱出\"});\r\n entity.addReaction(MRBasics_1.MRBasics.actions.ReadActionId, entity.mainEmittor());\r\n //entity.addEmittor(DEffectCause.Hit, REData.getSkill(\"kSkill_投げ当て_1ダメ\").emittor());\r\n break;\r\n case \"kEntity_ワナの巻物A\": {\r\n this.setupScrollCommon(entity);\r\n const emittor = entity.mainEmittor();\r\n emittor.effectSuite.targetEffect(0).effect.effectBehaviors.push({ specialEffectId: MRBasics_1.MRBasics.effectBehaviors.trapProliferation, entityId: 0, dataId: 0, value: 0 });\r\n emittor.selfAnimationId = 54;\r\n entity.addReaction(MRBasics_1.MRBasics.actions.ReadActionId, emittor);\r\n break;\r\n }\r\n case \"kEntity_メッキの巻物A\": {\r\n this.setupScrollCommon(entity);\r\n const emittor = entity.mainEmittor();\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.Selection;\r\n emittor.effectSuite.targetEffect(0).effect.rmmzSpecialEffectQualifyings.push({ code: DItemEffect_1.DItemEffect.EFFECT_ADD_STATE, dataId: MRData_1.MRData.getState(\"kState_System_Plating\").id, value1: 1.0, value2: 0 });\r\n emittor.effectSuite.targetEffect(0).effect.flavorEffect = DFlavorEffect_1.DFlavorEffect.fromRmmzAnimationId(12);\r\n entity.addReaction(MRBasics_1.MRBasics.actions.ReadActionId, emittor);\r\n break;\r\n }\r\n case \"kEntity_地獄耳の巻物A\": {\r\n this.setupScrollCommon(entity);\r\n const emittor = entity.mainEmittor();\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.Performer;\r\n emittor.effectSuite.targetEffect(0).effect.effectBehaviors.push({ specialEffectId: MRBasics_1.MRBasics.effectBehaviors.clarification, entityId: 0, dataId: 0, value: MRBasics_1.DClarificationType.Unit });\r\n emittor.effectSuite.targetEffect(0).effect.effectBehaviors.push({ specialEffectId: MRBasics_1.MRBasics.effectBehaviors.performeSkill, entityId: 0, dataId: MRData_1.MRData.getSkill(\"kSkill_アイテム擬態解除_全体\").id, value: 0 });\r\n emittor.effectSuite.targetEffect(0).effect.flavorEffect = DFlavorEffect_1.DFlavorEffect.fromRmmzAnimationId(44);\r\n entity.addReaction(MRBasics_1.MRBasics.actions.ReadActionId, emittor);\r\n break;\r\n }\r\n case \"kEntity_千里眼の巻物A\": {\r\n this.setupScrollCommon(entity);\r\n const emittor = entity.mainEmittor();\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.Performer;\r\n emittor.effectSuite.targetEffect(0).effect.effectBehaviors.push({ specialEffectId: MRBasics_1.MRBasics.effectBehaviors.clarification, entityId: 0, dataId: 0, value: MRBasics_1.DClarificationType.Item });\r\n emittor.effectSuite.targetEffect(0).effect.flavorEffect = DFlavorEffect_1.DFlavorEffect.fromRmmzAnimationId(44);\r\n entity.addReaction(MRBasics_1.MRBasics.actions.ReadActionId, emittor);\r\n break;\r\n }\r\n case \"kEntity_あかりの巻物A\": {\r\n this.setupScrollCommon(entity);\r\n const emittor = entity.mainEmittor();\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.Performer;\r\n emittor.effectSuite.targetEffect(0).effect.effectBehaviors.push({ specialEffectId: MRBasics_1.MRBasics.effectBehaviors.clarification, entityId: 0, dataId: 0, value: MRBasics_1.DClarificationType.Unit });\r\n emittor.effectSuite.targetEffect(0).effect.effectBehaviors.push({ specialEffectId: MRBasics_1.MRBasics.effectBehaviors.clarification, entityId: 0, dataId: 0, value: MRBasics_1.DClarificationType.Trap });\r\n emittor.effectSuite.targetEffect(0).effect.effectBehaviors.push({ specialEffectId: MRBasics_1.MRBasics.effectBehaviors.clarification, entityId: 0, dataId: 0, value: MRBasics_1.DClarificationType.Terrain });\r\n emittor.effectSuite.targetEffect(0).effect.effectBehaviors.push({ specialEffectId: MRBasics_1.MRBasics.effectBehaviors.clarification, entityId: 0, dataId: 0, value: MRBasics_1.DClarificationType.Sight });\r\n emittor.effectSuite.targetEffect(0).effect.flavorEffect = DFlavorEffect_1.DFlavorEffect.fromRmmzAnimationId(44);\r\n entity.addReaction(MRBasics_1.MRBasics.actions.ReadActionId, emittor);\r\n break;\r\n }\r\n case \"kEntity_天の恵みの巻物A\": {\r\n this.setupScrollCommon(entity);\r\n const emittor = MRData_1.MRData.cloneEmittor(MRData_1.MRData.getSkill(\"kSkill_武器強化\").emittor());\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.Performer;\r\n entity.addReaction(MRBasics_1.MRBasics.actions.ReadActionId, emittor);\r\n break;\r\n }\r\n case \"kEntity_地の恵みの巻物A\": {\r\n this.setupScrollCommon(entity);\r\n const emittor = MRData_1.MRData.cloneEmittor(MRData_1.MRData.getSkill(\"kSkill_防具強化\").emittor());\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.Performer;\r\n entity.addReaction(MRBasics_1.MRBasics.actions.ReadActionId, emittor);\r\n break;\r\n }\r\n case \"kEntity_おはらいの巻物A\": {\r\n this.setupScrollCommon(entity);\r\n const emittor = entity.mainEmittor();\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.Performer;\r\n //emittor.effectSet.effect(0).effectBehaviors.push({ specialEffectId: REBasics.effectBehaviors.dispelEquipments });\r\n emittor.effectSuite.targetEffect(0).effect.flavorEffect = DFlavorEffect_1.DFlavorEffect.fromRmmzAnimationId(46);\r\n const effect1 = MRData_1.MRData.cloneEffect(MRData_1.MRData.getSkill(\"kSkill_解呪\").emittor().effectSuite.targetEffect(0).effect);\r\n const effect2 = MRData_1.MRData.cloneEffect(MRData_1.MRData.getSkill(\"kSkill_解呪\").emittor().effectSuite.targetEffect(0).effect);\r\n effect1.subEntityFindKey.key = DCommon_1.DSubComponentEffectTargetKey.make(\"Equipped\", MRBasics_1.MRBasics.entityCategories.WeaponKindId);\r\n effect2.subEntityFindKey.key = DCommon_1.DSubComponentEffectTargetKey.make(\"Equipped\", MRBasics_1.MRBasics.entityCategories.ShieldKindId);\r\n emittor.effectSuite.addTargetEffect(new DEffectSuite_1.DEffectRef(effect1.id));\r\n emittor.effectSuite.addTargetEffect(new DEffectSuite_1.DEffectRef(effect2.id));\r\n entity.addReaction(MRBasics_1.MRBasics.actions.ReadActionId, emittor);\r\n break;\r\n }\r\n case \"kEntity_食料の巻物A\": {\r\n this.setupScrollCommon(entity);\r\n const emittor = entity.mainEmittor();\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.Selection;\r\n emittor.effectSuite.targetEffect(0).effect.effectBehaviors.push({ specialEffectId: MRBasics_1.MRBasics.effectBehaviors.changeInstance, entityId: MRData_1.MRData.getItem(\"kEntity_大きなおにぎりA\").id, dataId: 0, value: 0 });\r\n emittor.effectSuite.targetEffect(0).effect.flavorEffect = DFlavorEffect_1.DFlavorEffect.fromRmmzAnimationId(2);\r\n entity.addReaction(MRBasics_1.MRBasics.actions.ReadActionId, emittor);\r\n break;\r\n }\r\n case \"kEntity_祈りの巻物A\": {\r\n this.setupScrollCommon(entity);\r\n const emittor = entity.mainEmittor();\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.Selection;\r\n emittor.effectSuite.targetEffect(0).effect.parameterQualifyings.push(new DEffect_1.DParameterQualifying(MRBasics_1.MRBasics.params.remaining, \"5\", DEffect_1.DParameterEffectApplyType.Recover));\r\n emittor.effectSuite.targetEffect(0).effect.flavorEffect = DFlavorEffect_1.DFlavorEffect.fromRmmzAnimationId(46);\r\n entity.addReaction(MRBasics_1.MRBasics.actions.ReadActionId, emittor);\r\n break;\r\n }\r\n case \"kEntity_かなしばりの巻物A\": {\r\n this.setupScrollCommon(entity);\r\n const emittor = entity.mainEmittor();\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.Around;\r\n emittor.scope.length = 1;\r\n emittor.effectSuite.targetEffect(0).effect.rmmzSpecialEffectQualifyings.push({ code: DItemEffect_1.DItemEffect.EFFECT_ADD_STATE, dataId: MRData_1.MRData.getState(\"kState_UTかなしばり\").id, value1: 1.0, value2: 0 });\r\n emittor.effectSuite.targetEffect(0).effect.flavorEffect = DFlavorEffect_1.DFlavorEffect.fromRmmzAnimationId(15);\r\n entity.addReaction(MRBasics_1.MRBasics.actions.ReadActionId, emittor);\r\n break;\r\n }\r\n case \"kEntity_真空切りの巻物A\": {\r\n this.setupScrollCommon(entity);\r\n const emittor = entity.mainEmittor();\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.Room;\r\n emittor.effectSuite.targetEffect(0).effect.parameterQualifyings.push(new DEffect_1.DParameterQualifying(MRBasics_1.MRBasics.params.hp, \"35\", DEffect_1.DParameterEffectApplyType.Damage)\r\n .withVariance(20));\r\n emittor.selfAnimationId = 94;\r\n entity.addReaction(MRBasics_1.MRBasics.actions.ReadActionId, emittor);\r\n break;\r\n }\r\n case \"kEntity_時の砂の巻物A\": {\r\n this.setupScrollCommon(entity);\r\n const emittor = entity.mainEmittor();\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.Performer;\r\n emittor.effectSuite.targetEffect(0).effect.effectBehaviors.push({ specialEffectId: MRBasics_1.MRBasics.effectBehaviors.restartFloor, entityId: 0, dataId: 0, value: 0 });\r\n entity.addReaction(MRBasics_1.MRBasics.actions.ReadActionId, emittor);\r\n emittor.selfAnimationId = 118;\r\n break;\r\n }\r\n case \"kEntity_脱出の巻物A\":\r\n this.setupScrollCommon(entity);\r\n entity.mainEmittor().effectSuite.targetEffect(0).effect.otherEffectQualifyings.push({ key: \"kSystemEffect_脱出\" });\r\n entity.addReaction(MRBasics_1.MRBasics.actions.ReadActionId, entity.mainEmittor());\r\n entity.addReaction(MRBasics_1.MRBasics.actions.collide, MRData_1.MRData.getSkill(\"kSkill_投げ当て_1ダメ\").emittor());\r\n entity.identificationDifficulty = DEntity_1.DIdentificationDifficulty.NameGuessed;\r\n //entity.addEmittor(DEffectCause.Hit, REData.getSkill(\"kSkill_投げ当て_1ダメ\").emittor());\r\n break;\r\n case \"kEntity_聖域の巻物A\":\r\n this.setupScrollCommon(entity);\r\n entity.addReaction(MRBasics_1.MRBasics.actions.ReadActionId);\r\n entity.addReaction(MRBasics_1.MRBasics.actions.collide, MRData_1.MRData.getSkill(\"kSkill_投げ当て_1ダメ\").emittor());\r\n break;\r\n case \"kEntity_識別の巻物A\":\r\n this.setupScrollCommon(entity);\r\n entity.mainEmittor().scope.range = DEffect_1.DEffectFieldScopeType.Selection;\r\n entity.mainEmittor().effectSuite.targetEffect(0).effect.otherEffectQualifyings.push({ key: \"kSystemEffect_識別\" });\r\n entity.addReaction(MRBasics_1.MRBasics.actions.ReadActionId, entity.mainEmittor());\r\n //entity.addEmittor(DEffectCause.Hit, REData.getSkill(\"kSkill_投げ当て_1ダメ\").emittor());\r\n break;\r\n case \"kEntity_壺増大の巻物A\": {\r\n this.setupScrollCommon(entity);\r\n const emittor = entity.mainEmittor();\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.Selection;\r\n entity.addReaction(MRBasics_1.MRBasics.actions.ReadActionId, entity.mainEmittor());\r\n emittor.effectSuite.targetEffect(0).effect.effectBehaviors.push({ specialEffectId: MRBasics_1.MRBasics.effectBehaviors.gainCapacity, entityId: 0, dataId: 0, value: 1 });\r\n break;\r\n }\r\n case \"kEntity_壺縮小の巻物A\": {\r\n this.setupScrollCommon(entity);\r\n const emittor = entity.mainEmittor();\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.Selection;\r\n entity.addReaction(MRBasics_1.MRBasics.actions.ReadActionId, entity.mainEmittor());\r\n emittor.effectSuite.targetEffect(0).effect.effectBehaviors.push({ specialEffectId: MRBasics_1.MRBasics.effectBehaviors.gainCapacity, entityId: 0, dataId: 0, value: -1 });\r\n break;\r\n }\r\n case \"kEntity_壺割れずの巻物A\": {\r\n this.setupScrollCommon(entity);\r\n const emittor = entity.mainEmittor();\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.Selection;\r\n emittor.effectSuite.targetEffect(0).effect.rmmzSpecialEffectQualifyings.push({ code: DItemEffect_1.DItemEffect.EFFECT_ADD_STATE, dataId: MRData_1.MRData.getState(\"kState_System_StorageProtection\").id, value1: 1.0, value2: 0 });\r\n emittor.effectSuite.targetEffect(0).effect.flavorEffect = DFlavorEffect_1.DFlavorEffect.fromRmmzAnimationId(12);\r\n entity.addReaction(MRBasics_1.MRBasics.actions.ReadActionId, emittor);\r\n break;\r\n }\r\n case \"kEntity_すいだしの巻物A\": {\r\n this.setupScrollCommon(entity);\r\n const emittor = entity.mainEmittor();\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.Selection;\r\n entity.addReaction(MRBasics_1.MRBasics.actions.ReadActionId, entity.mainEmittor());\r\n emittor.effectSuite.targetEffect(0).effect.effectBehaviors.push({ specialEffectId: MRBasics_1.MRBasics.effectBehaviors.suckOut, entityId: 0, dataId: 0, value: -1 });\r\n break;\r\n }\r\n case \"kEntity_投擲反射石A\":\r\n entity.selfTraits.push({ code: MRBasics_1.MRBasics.traits.PhysicalProjectileReflector, dataId: 0, value: 0 });\r\n break;\r\n }\r\n }\r\n static setupDirectly_Skill(data) {\r\n const emittor = data.emittor();\r\n switch (data.key) {\r\n case \"kSkill_炎のブレス_直線\":\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.StraightProjectile;\r\n emittor.scope.length = Infinity;\r\n emittor.scope.projectilePrefabKey = \"kEntity_System_炎のブレスA\";\r\n break;\r\n case \"kSkill_魔法弾発射_一般\":\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.StraightProjectile;\r\n emittor.scope.length = Infinity;\r\n emittor.scope.projectilePrefabKey = \"kEntity_System_MagicBulletA\";\r\n data.emittor().costs.setParamCost(DEffect_1.DSkillCostSource.Item, MRBasics_1.MRBasics.params.remaining, { type: DEffect_1.DParamCostType.Decrease, value: 1 });\r\n break;\r\n case \"kSkill_ふきとばし\": {\r\n const effect = emittor.effectSuite.targetEffect(0);\r\n effect.effect.otherEffectQualifyings.push({ key: \"kSystemEffect_ふきとばし\" });\r\n effect.effect.parameterQualifyings.push(new DEffect_1.DParameterQualifying(MRBasics_1.MRBasics.params.hp, \"5\", DEffect_1.DParameterEffectApplyType.Damage));\r\n break;\r\n }\r\n case \"kSkill_変化\":\r\n emittor.effectSuite.targetEffect(0).effect.effectBehaviors.push({ specialEffectId: MRBasics_1.MRBasics.effectBehaviors.changeInstance, entityId: 0, dataId: 0, value: 0 });\r\n emittor.effectSuite.targetEffect(0).effect.flavorEffect = DFlavorEffect_1.DFlavorEffect.fromRmmzAnimationId(40);\r\n break;\r\n case \"kSkill_投げ当て_1ダメ\":\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.Performer;\r\n break;\r\n case \"kSkill_火炎草ブレス\":\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.Front1;\r\n //emittor.scope.length = Infinity;\r\n //emittor.scope.projectilePrefabKey = \"kEntity_System_炎のブレスA\";\r\n break;\r\n case \"kSkill_射撃_矢\":\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.StraightProjectile;\r\n emittor.scope.length = Infinity;\r\n emittor.scope.projectilePrefabKey = \"kEntity_木の矢A\";\r\n break;\r\n case \"kSkill_足つかみ\":\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.Front1;\r\n emittor.effectSuite.selfEffect.effect.rmmzSpecialEffectQualifyings.push({ code: DItemEffect_1.DItemEffect.EFFECT_ADD_STATE, dataId: MRData_1.MRData.getState(\"kState_UT足つかみ\").id, value1: 100, value2: 0 });\r\n break;\r\n case \"kSkill_大爆発\":\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.Around;\r\n emittor.scope.length = 1;\r\n //emittor.effectSet.effect(0).qualifyings.specialEffectQualifyings.push({code: DSpecialEffectCodes.DeadlyExplosion, dataId: 0, value1: 0, value2: 0});\r\n //emittor.effectSet.effect(0).qualifyings.effect.parameterQualifyings;\r\n //emittor.effectSet.effect(0).rmmzSpecialEffectQualifyings.push({code: DItemEffect.EFFECT_ADD_STATE, dataId: REData.getState(\"kState_UT爆発四散\").id, value1: 100, value2: 0});\r\n //emittor.selfAnimationId = 109;\r\n emittor.effectSuite.targetEffect(0).effect.parameterQualifyings[0].elementIds.push(MRData_1.MRData.getElement(\"kElement_DeathExplosion\").id);\r\n emittor.selfSequelId = MRBasics_1.MRBasics.sequels.explosion;\r\n emittor.effectSuite.targetEffect(0).effect.hitType = DEffect_1.DEffectHitType.Magical;\r\n break;\r\n case \"kSkill_アイテム盗み\":\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.Front1;\r\n emittor.scope.layers.push(DCommon_1.DBlockLayerKind.Ground);\r\n emittor.effectSuite.targetEffect(0).effect.effectBehaviors.push({ specialEffectId: MRBasics_1.MRBasics.effectBehaviors.itemSteal, entityId: 0, dataId: 0, value: 0 });\r\n break;\r\n case \"kSkill_ゴールド盗み\":\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.Front1;\r\n //emittor.scope.layers.push(DBlockLayerKind.Ground);\r\n emittor.effectSuite.targetEffect(0).effect.effectBehaviors.push({ specialEffectId: MRBasics_1.MRBasics.effectBehaviors.goldSteal, entityId: 0, dataId: 0, value: 0 });\r\n break;\r\n case \"kSkill_装備サビ\":\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.Front1;\r\n break;\r\n case \"kSkill_装備サビ_武器\":\r\n case \"kSkill_装備サビ_盾\":\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.Front1;\r\n const p = new DEffect_1.DParameterQualifying(MRBasics_1.MRBasics.params.upgradeValue, \"1\", DEffect_1.DParameterEffectApplyType.Damage);\r\n p.alliesSideGainMessage = (0, Common_1.tr2)(\"%1はサビてしまった。\"),\r\n p.alliesSideLossMessage = (0, Common_1.tr2)(\"%1はサビてしまった。\"),\r\n p.opponentGainMessage = (0, Common_1.tr2)(\"%1はサビてしまった。\"),\r\n p.opponentLossMessage = (0, Common_1.tr2)(\"%1はサビてしまった。\"),\r\n emittor.effectSuite.targetEffect(0).effect.parameterQualifyings.push(p);\r\n // emittor.effectSet.effect(0).effect.parameterQualifyings.push({\r\n // parameterId: REBasics.params.upgradeValue,\r\n // applyTarget: DParameterApplyTarget.Current,\r\n // elementId: 0,\r\n // formula: \"1\",\r\n // applyType: DParameterEffectApplyType.Damage,\r\n // variance: 0,\r\n // silent: false,\r\n // alliesSideGainMessage: tr2(\"%1はサビてしまった。\"),\r\n // alliesSideLossMessage: tr2(\"%1はサビてしまった。\"),\r\n // opponentGainMessage: tr2(\"%1はサビてしまった。\"),\r\n // opponentLossMessage: tr2(\"%1はサビてしまった。\"),\r\n // });\r\n if (data.key == \"kSkill_装備サビ_武器\") {\r\n emittor.effectSuite.targetEffect(0).effect.subEntityFindKey.key = DCommon_1.DSubComponentEffectTargetKey.make(\"Equipped\", MRBasics_1.MRBasics.entityCategories.WeaponKindId);\r\n }\r\n else {\r\n emittor.effectSuite.targetEffect(0).effect.subEntityFindKey.key = DCommon_1.DSubComponentEffectTargetKey.make(\"Equipped\", MRBasics_1.MRBasics.entityCategories.ShieldKindId);\r\n }\r\n break;\r\n case \"kSkill_混乱魔法_部屋内\":\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.Room;\r\n emittor.selfAnimationId = 97;\r\n break;\r\n case \"kSkill_毒攻撃\":\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.Front1;\r\n emittor.effectSuite.targetEffect(0).effect.parameterQualifyings.push(new DEffect_1.DParameterQualifying(MRBasics_1.MRBasics.params.pow, \"1\", DEffect_1.DParameterEffectApplyType.Damage));\r\n // emittor.effectSet.effect(0).effect.parameterQualifyings.push({\r\n // parameterId: REBasics.params.pow,\r\n // applyTarget: DParameterApplyTarget.Current,\r\n // elementId: 0,\r\n // formula: \"1\",\r\n // applyType: DParameterEffectApplyType.Damage,\r\n // variance: 0,\r\n // silent: false,\r\n // });\r\n break;\r\n case \"kSkill_毒攻撃_強\":\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.Front1;\r\n emittor.effectSuite.targetEffect(0).effect.parameterQualifyings.push(new DEffect_1.DParameterQualifying(MRBasics_1.MRBasics.params.pow, \"3\", DEffect_1.DParameterEffectApplyType.Damage));\r\n // emittor.effectSet.effect(0).effect.parameterQualifyings.push({\r\n // parameterId: REBasics.params.pow,\r\n // applyTarget: DParameterApplyTarget.Current,\r\n // elementId: 0,\r\n // formula: \"3\",\r\n // applyType: DParameterEffectApplyType.Damage,\r\n // variance: 0,\r\n // silent: false,\r\n // });\r\n break;\r\n case \"kSkill_レベルダウン\":\r\n emittor.effectSuite.targetEffect(0).effect.effectBehaviors.push({ specialEffectId: MRBasics_1.MRBasics.effectBehaviors.levelDown, entityId: 0, dataId: 0, value: 0 });\r\n break;\r\n case \"kSkill_ワープ魔法\":\r\n emittor.effectSuite.targetEffect(0).effect.effectBehaviors.push({ specialEffectId: MRBasics_1.MRBasics.effectBehaviors.randomWarp, entityId: 0, dataId: 0, value: 0 });\r\n break;\r\n case \"kSkill_Warp\":\r\n emittor.effectSuite.targetEffect(0).effect.effectBehaviors.push({ specialEffectId: MRBasics_1.MRBasics.effectBehaviors.randomWarp, entityId: 0, dataId: 0, value: 0 });\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.Performer;\r\n break;\r\n case \"kSkill_KnockbackAttack\":\r\n emittor.effectSuite.targetEffect(0).effect.otherEffectQualifyings.push({ key: \"kSystemEffect_ふきとばし\" });\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.Front1;\r\n break;\r\n case \"kSkill_武器強化\": {\r\n const effect1 = emittor.effectSuite.targetEffect(0);\r\n effect1.effect.parameterQualifyings.push(new DEffect_1.DParameterQualifying(MRBasics_1.MRBasics.params.upgradeValue, \"1\", DEffect_1.DParameterEffectApplyType.Recover));\r\n effect1.effect.rmmzSpecialEffectQualifyings.push({ code: DItemEffect_1.DItemEffect.EFFECT_REMOVE_STATE, dataId: MRData_1.MRData.system.states.curse, value1: 1.0, value2: 0 });\r\n effect1.effect.subEntityFindKey.key = DCommon_1.DSubComponentEffectTargetKey.make(\"Equipped\", MRBasics_1.MRBasics.entityCategories.WeaponKindId);\r\n effect1.conditions.applyRating = 7;\r\n effect1.effect.flavorEffect = DFlavorEffect_1.DFlavorEffect.fromRmmzAnimationId(51);\r\n break;\r\n }\r\n case \"kSkill_武器強化_強\": {\r\n const effect1 = emittor.effectSuite.targetEffect(0);\r\n effect1.effect.parameterQualifyings.push(new DEffect_1.DParameterQualifying(MRBasics_1.MRBasics.params.upgradeValue, \"3\", DEffect_1.DParameterEffectApplyType.Recover));\r\n effect1.effect.rmmzSpecialEffectQualifyings.push({ code: DItemEffect_1.DItemEffect.EFFECT_REMOVE_STATE, dataId: MRData_1.MRData.system.states.curse, value1: 1.0, value2: 0 });\r\n effect1.effect.subEntityFindKey.key = DCommon_1.DSubComponentEffectTargetKey.make(\"Equipped\", MRBasics_1.MRBasics.entityCategories.WeaponKindId);\r\n effect1.conditions.applyRating = 3;\r\n effect1.effect.flavorEffect = DFlavorEffect_1.DFlavorEffect.fromRmmzAnimationId(52);\r\n break;\r\n }\r\n case \"kSkill_防具強化\": {\r\n const effect1 = emittor.effectSuite.targetEffect(0);\r\n effect1.effect.parameterQualifyings.push(new DEffect_1.DParameterQualifying(MRBasics_1.MRBasics.params.upgradeValue, \"1\", DEffect_1.DParameterEffectApplyType.Recover));\r\n effect1.effect.rmmzSpecialEffectQualifyings.push({ code: DItemEffect_1.DItemEffect.EFFECT_REMOVE_STATE, dataId: MRData_1.MRData.system.states.curse, value1: 1.0, value2: 0 });\r\n effect1.effect.subEntityFindKey.key = DCommon_1.DSubComponentEffectTargetKey.make(\"Equipped\", MRBasics_1.MRBasics.entityCategories.ShieldKindId);\r\n effect1.conditions.applyRating = 7;\r\n effect1.effect.flavorEffect = DFlavorEffect_1.DFlavorEffect.fromRmmzAnimationId(51);\r\n break;\r\n }\r\n case \"kSkill_防具強化_強\": {\r\n const effect1 = emittor.effectSuite.targetEffect(0);\r\n effect1.effect.parameterQualifyings.push(new DEffect_1.DParameterQualifying(MRBasics_1.MRBasics.params.upgradeValue, \"3\", DEffect_1.DParameterEffectApplyType.Recover));\r\n effect1.effect.rmmzSpecialEffectQualifyings.push({ code: DItemEffect_1.DItemEffect.EFFECT_REMOVE_STATE, dataId: MRData_1.MRData.system.states.curse, value1: 1.0, value2: 0 });\r\n effect1.effect.subEntityFindKey.key = DCommon_1.DSubComponentEffectTargetKey.make(\"Equipped\", MRBasics_1.MRBasics.entityCategories.ShieldKindId);\r\n effect1.conditions.applyRating = 3;\r\n effect1.effect.flavorEffect = DFlavorEffect_1.DFlavorEffect.fromRmmzAnimationId(52);\r\n break;\r\n }\r\n case \"kSkill_アイテム擬態解除_全体\": {\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.Map;\r\n break;\r\n }\r\n }\r\n }\r\n static linkSkill(data) {\r\n const emittor = data.emittor();\r\n switch (data.key) {\r\n case \"kSkill_装備サビ\": {\r\n const effect1 = MRData_1.MRData.cloneEffect(MRData_1.MRData.getSkill(\"kSkill_装備サビ_武器\").emittor().effectSuite.targetEffect(0).effect);\r\n const effect2 = MRData_1.MRData.cloneEffect(MRData_1.MRData.getSkill(\"kSkill_装備サビ_盾\").emittor().effectSuite.targetEffect(0).effect);\r\n effect1.subEntityFindKey.key = DCommon_1.DSubComponentEffectTargetKey.make(\"Equipped\", MRBasics_1.MRBasics.entityCategories.WeaponKindId);\r\n effect2.subEntityFindKey.key = DCommon_1.DSubComponentEffectTargetKey.make(\"Equipped\", MRBasics_1.MRBasics.entityCategories.ShieldKindId);\r\n emittor.effectSuite.addTargetEffect(new DEffectSuite_1.DEffectRef(effect1.id));\r\n emittor.effectSuite.addTargetEffect(new DEffectSuite_1.DEffectRef(effect2.id));\r\n break;\r\n }\r\n case \"kSkill_武器強化\": {\r\n // const effect2 = MRData.cloneEffect(MRData.getSkill(\"kSkill_武器強化_強\").emittor().effectSet.targetEffect(0).effect);\r\n // emittor.effectSet.addTargetEffect(new DEffectRef(effect2.id));\r\n const ref = MRData_1.MRData.getSkill(\"kSkill_武器強化_強\").emittor().effectSuite.targetEffect(0);\r\n emittor.effectSuite.addTargetEffect(ref);\r\n break;\r\n }\r\n case \"kSkill_防具強化\": {\r\n // const effect2 = MRData.cloneEffect(MRData.getSkill(\"kSkill_防具強化_強\").emittor().effectSet.targetEffect(0).effect);\r\n // emittor.effectSet.addTargetEffect(new DEffectRef(effect2.id));\r\n const ref = MRData_1.MRData.getSkill(\"kSkill_防具強化_強\").emittor().effectSuite.targetEffect(0);\r\n emittor.effectSuite.addTargetEffect(ref);\r\n break;\r\n }\r\n }\r\n }\r\n static linkItem(entity) {\r\n const data = entity.item();\r\n switch (entity.entity.key) {\r\n case \"kEntity_錆ワナA\": {\r\n const emittor = entity.mainEmittor();\r\n const effect1 = MRData_1.MRData.cloneEffect(MRData_1.MRData.getSkill(\"kSkill_装備サビ_武器\").emittor().effectSuite.targetEffect(0).effect);\r\n const effect2 = MRData_1.MRData.cloneEffect(MRData_1.MRData.getSkill(\"kSkill_装備サビ_盾\").emittor().effectSuite.targetEffect(0).effect);\r\n effect1.subEntityFindKey.key = DCommon_1.DSubComponentEffectTargetKey.make(\"Equipped\", MRBasics_1.MRBasics.entityCategories.WeaponKindId);\r\n effect2.subEntityFindKey.key = DCommon_1.DSubComponentEffectTargetKey.make(\"Equipped\", MRBasics_1.MRBasics.entityCategories.ShieldKindId);\r\n emittor.effectSuite.addTargetEffect(new DEffectSuite_1.DEffectRef(effect1.id));\r\n emittor.effectSuite.addTargetEffect(new DEffectSuite_1.DEffectRef(effect2.id));\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.Center;\r\n emittor.selfAnimationId = 82;\r\n break;\r\n }\r\n }\r\n }\r\n static setupEnemy(entity) {\r\n const data = entity.enemyData();\r\n data.traits.push({ code: MRBasics_1.MRBasics.traits.DeathVulnerableElement, dataId: MRData_1.MRData.getElement(\"kElement_DeathExplosion\").id, value: MRData_1.MRData.getState(\"kState_System_ExplosionDeath\").id });\r\n switch (entity.entity.key) {\r\n case \"kEnemy_ボムA\":\r\n entity.entity.behaviors.push(new DBehavior_1.DBehaviorInstantiation(MRData_1.MRData.getBehavior(\"SelfExplosion\").id, undefined));\r\n //entity.autoAdditionStates.push({ stateId: REData.getStateFuzzy(\"kState_UTかなしばり\").id, condition: \"a.hp<50\" });\r\n break;\r\n case \"kEnemy_ウルフA\":\r\n entity.majorActionDeclines = 1;\r\n break;\r\n case \"kEnemy_ゾンビA\":\r\n //data.traits.push({ code: REBasics.traits.RecoverRate, dataId: 0, value: -1.0 });\r\n // entity.raceIds.push(REData.getRace(\"kRace_ドレイン系\").id);\r\n // entity.raceIds.push(REData.getRace(\"kRace_アンデッド系\").id);\r\n break;\r\n case \"kEnemy_瑠璃猫A\":\r\n //data.traits.push({ code: DBasics.traits.ItemDropRate, dataId: 0, value: 1.0 });\r\n break;\r\n case \"kEnemy_金剛猫A\":\r\n entity.majorActionDeclines = 1;\r\n break;\r\n case \"kEnemy_黒幕バットA\":\r\n data.traits.push({ code: MRBasics_1.MRBasics.traits.Invisible, dataId: 0, value: 0 });\r\n break;\r\n case \"kEnemy_店主A\":\r\n entity.factionId = MRData_1.MRData.system.factions.neutral;\r\n break;\r\n case \"kEnemy_ボスドラゴンA\":\r\n entity.selfTraits.push({ code: MRBasics_1.MRBasics.traits.DisableMovement, dataId: 0, value: 0 });\r\n break;\r\n }\r\n }\r\n static setupDirectly_State(data) {\r\n switch (data.key) {\r\n case \"kState_System_ItemStanding\":\r\n data.effect.behaviors.push(new DBehavior_1.DBehaviorInstantiation(MRData_1.MRData.getBehavior(\"LItemStandingBehavior\").id, undefined));\r\n break;\r\n case \"kState_System_ExplosionDeath\":\r\n data.deadState = true;\r\n break;\r\n case \"kState_睡眠\":\r\n data.idleSequel = MRBasics_1.MRBasics.sequels.asleep;\r\n break;\r\n case \"kState_UT気配察知\":\r\n data.effect.traits.push({ code: MRBasics_1.MRBasics.traits.UnitVisitor, dataId: 0, value: 0 });\r\n break;\r\n case \"kState_UTよくみえ\":\r\n data.effect.traits.push({ code: MRBasics_1.MRBasics.traits.ForceVisible, dataId: 0, value: 0 });\r\n data.effect.autoRemovals.push({ kind: DState_1.DAutoRemovalTiming.FloorTransfer });\r\n break;\r\n case \"kState_UnitTest_攻撃必中\":\r\n data.effect.traits.push({ code: MRBasics_1.MRBasics.traits.CertainDirectAttack, dataId: 0, value: 0 });\r\n break;\r\n case \"kState_UnitTest_投擲必中\":\r\n data.effect.traits.push({ code: MRBasics_1.MRBasics.traits.CertainIndirectAttack, dataId: 0, value: 0 });\r\n break;\r\n case \"kState_System_kNap\":\r\n data.effect.behaviors.push(new DBehavior_1.DBehaviorInstantiation(MRData_1.MRData.getBehavior(\"LNapStateBehavior\").id, undefined));\r\n data.effect.autoRemovals.push({ kind: DState_1.DAutoRemovalTiming.DamageTesting, paramId: MRBasics_1.MRBasics.params.hp });\r\n break;\r\n case \"kState_Test_MoveRight\":\r\n data.effect.behaviors.push(new DBehavior_1.DBehaviorInstantiation(MRData_1.MRData.getBehavior(\"LDebugMoveRightBehavior\").id, undefined));\r\n break;\r\n case \"kState_仮眠2\":\r\n data.effect.traits.push({ code: MRBasics_1.MRBasics.traits.StateRemoveByEffect, dataId: 0, value: 0 });\r\n data.idleSequel = MRBasics_1.MRBasics.sequels.asleep;\r\n break;\r\n case \"kState_UTアイテム擬態\":\r\n data.effect.behaviors.push(new DBehavior_1.DBehaviorInstantiation(MRData_1.MRData.getBehavior(\"LItemImitatorBehavior\").id, undefined));\r\n break;\r\n case \"kState_UT魔法使い\":\r\n data.effect.traits.push({ code: MRBasics_1.MRBasics.traits.EquipmentProficiency, dataId: MRBasics_1.MRBasics.entityCategories.WeaponKindId, value: 0.5 });\r\n data.effect.traits.push({ code: MRBasics_1.MRBasics.traits.EquipmentProficiency, dataId: MRBasics_1.MRBasics.entityCategories.ShieldKindId, value: 0.5 });\r\n data.effect.traits.push({ code: MRBasics_1.MRBasics.traits.EffectProficiency, dataId: MRBasics_1.MRBasics.entityCategories.grass, value: 2.0 });\r\n break;\r\n /*\r\n case \"kState_UT速度バフ\":\r\n data.minBuffLevel = -1;\r\n data.maxBuffLevel = 2;\r\n data.parameterBuffFormulas[DBasics.params.agi] = \"100*slv\";\r\n break;\r\n */\r\n case \"kState_UT鈍足\":\r\n data.autoAdditionCondition = \"a.agi<0\";\r\n break;\r\n case \"kState_UT倍速\":\r\n data.autoAdditionCondition = \"a.agi>=100\";\r\n break;\r\n case \"kState_UT3倍速\":\r\n data.autoAdditionCondition = \"a.agi>=200\";\r\n break;\r\n case \"kState_UT混乱\":\r\n data.intentions = DState_1.DStateIntentions.Negative;\r\n break;\r\n case \"kState_UT目つぶし\":\r\n data.intentions = DState_1.DStateIntentions.Negative;\r\n data.effect.restriction = DState_1.DStateRestriction.Blind;\r\n break;\r\n case \"kState_UTまどわし\":\r\n data.effect.behaviors.push(new DBehavior_1.DBehaviorInstantiation(MRData_1.MRData.getBehavior(\"LIllusionStateBehavior\").id, undefined));\r\n break;\r\n case \"kState_UTからぶり\":\r\n break;\r\n case \"kState_UTくちなし\":\r\n data.effect.traits.push({ code: MRBasics_1.MRBasics.traits.SealActivity, dataId: MRBasics_1.MRBasics.actions.EatActionId, value: 0 });\r\n data.effect.traits.push({ code: MRBasics_1.MRBasics.traits.SealActivity, dataId: MRBasics_1.MRBasics.actions.ReadActionId, value: 0 });\r\n data.effect.autoRemovals.push({ kind: DState_1.DAutoRemovalTiming.FloorTransfer });\r\n break;\r\n case \"kState_UTかなしばり\":\r\n data.effect.autoRemovals.push({ kind: DState_1.DAutoRemovalTiming.DamageTesting, paramId: MRBasics_1.MRBasics.params.hp });\r\n data.effect.autoRemovals.push({ kind: DState_1.DAutoRemovalTiming.ActualParam, formula: \"a.fp <= 0\" });\r\n break;\r\n case \"kState_System_Seal\":\r\n data.effect.traits.push({ code: MRBasics_1.MRBasics.traits.SealSpecialAbility, dataId: MRBasics_1.MRBasics.actions.EatActionId, value: 0 });\r\n break;\r\n case \"kState_UT透明\":\r\n data.effect.traits.push({ code: MRBasics_1.MRBasics.traits.Invisible, dataId: 0, value: 0 });\r\n data.submatchStates.push(MRData_1.MRData.getState(\"kState_UT透明_モンスター\").id);\r\n break;\r\n case \"kState_UT透明_モンスター\":\r\n data.effect.traits.push({ code: MRBasics_1.MRBasics.traits.Invisible, dataId: 0, value: 0 });\r\n data.effect.matchConditions.kindId = MRBasics_1.MRBasics.entityCategories.MonsterKindId;\r\n break;\r\n case \"kState_UT足つかみ\":\r\n data.effect.behaviors.push(new DBehavior_1.DBehaviorInstantiation(MRData_1.MRData.getBehavior(\"LGrabFootBehavior\").id, undefined));\r\n break;\r\n case \"kState_物理投擲回避\":\r\n data.effect.traits.push({ code: MRBasics_1.MRBasics.traits.DodgePhysicalIndirectAttack, dataId: 0, value: 0 });\r\n break;\r\n case \"kState_UT下手投げ\":\r\n data.effect.traits.push({ code: MRBasics_1.MRBasics.traits.AwfulPhysicalIndirectAttack, dataId: 0, value: 0 });\r\n break;\r\n case \"kState_Anger\":\r\n data.effect.traits.push({ code: MRBasics_1.MRBasics.traits.UseSkillForced, dataId: 0, value: 0 });\r\n break;\r\n case \"kState_ATK0\":\r\n data.effect.traits.push({ code: MRBasics_1.MRBasics.traits.ForceParameter, dataId: MRBasics_1.MRBasics.params.atk, value: 0 });\r\n break;\r\n // case \"kState_UT爆発四散\":\r\n // data.deadState = true;\r\n // break;\r\n case \"kState_UTトラバサミ\":\r\n data.effect.traits.push({ code: MRBasics_1.MRBasics.traits.SealActivity, dataId: MRBasics_1.MRBasics.actions.MoveToAdjacentActionId, value: 0 });\r\n break;\r\n case \"kState_System_Plating\":\r\n data.effect.traits.push({ code: MRBasics_1.MRBasics.traits.ParamDamageRate, dataId: MRBasics_1.MRBasics.params.upgradeValue, value: 0.0 });\r\n data.applyConditions.kindIds = [MRBasics_1.MRBasics.entityCategories.WeaponKindId, MRBasics_1.MRBasics.entityCategories.ShieldKindId];\r\n break;\r\n case \"kState_System_StorageProtection\":\r\n data.effect.traits.push({ code: MRBasics_1.MRBasics.traits.StorageProtection, dataId: 0, value: 0 });\r\n data.applyConditions.kindIds = [MRBasics_1.MRBasics.entityCategories.PotKindId];\r\n break;\r\n }\r\n }\r\n static setupDirectly_StateGroup(data) {\r\n switch (data.key) {\r\n case \"kStateGroup_睡眠系\":\r\n data.exclusive = true;\r\n break;\r\n case \"kStateGroup_SG速度変化\":\r\n data.exclusive = true;\r\n break;\r\n }\r\n }\r\n static setupItemCommon(entity) {\r\n this.addVulnerableDeathExplosion(entity);\r\n }\r\n static setupWeaponCommon(entity) {\r\n this.setupItemCommon(entity);\r\n entity.upgradeMin = -99; // TODO: 攻撃力下限までにしたい\r\n entity.upgradeMax = 99;\r\n entity.idealParams[MRBasics_1.MRBasics.params.upgradeValue] = 0;\r\n entity.identificationDifficulty = DEntity_1.DIdentificationDifficulty.NameGuessed;\r\n entity.identificationReaction = MRData_1.MRData.getSkill(\"kAction_Equip\").id;\r\n // Collide\r\n // TODO: 暫定対応。とりあえずダメージを出したい\r\n this.setupArrowCommon(entity);\r\n entity.entity.kindId = MRBasics_1.MRBasics.entityCategories.WeaponKindId;\r\n }\r\n static setupShieldCommon(entity) {\r\n var _a;\r\n this.setupItemCommon(entity);\r\n entity.entity.kindId = MRBasics_1.MRBasics.entityCategories.ShieldKindId;\r\n entity.upgradeMin = -99; // TODO: 攻撃力下限までにしたい\r\n entity.upgradeMax = 99;\r\n entity.idealParams[MRBasics_1.MRBasics.params.upgradeValue] = 0;\r\n entity.identificationDifficulty = DEntity_1.DIdentificationDifficulty.NameGuessed;\r\n entity.identificationReaction = MRData_1.MRData.getSkill(\"kAction_Equip\").id;\r\n const damage = (_a = entity.equipment) === null || _a === void 0 ? void 0 : _a.parameters[MRBasics_1.MRBasics.params.def];\r\n (0, Common_1.assert)(damage);\r\n const emittor = MRData_1.MRData.newEmittor(entity.entity.key);\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.Performer;\r\n const effect = MRData_1.MRData.newEffect(entity.entity.key);\r\n effect.critical = false;\r\n effect.successRate = 100;\r\n effect.hitType = DEffect_1.DEffectHitType.Physical;\r\n const q = new DEffect_1.DParameterQualifying(MRBasics_1.MRBasics.params.hp, damage.value.toString(), DEffect_1.DParameterEffectApplyType.Damage);\r\n effect.parameterQualifyings.push(q);\r\n emittor.effectSuite.addTargetEffect(new DEffectSuite_1.DEffectRef(effect.id));\r\n entity.addReaction(MRBasics_1.MRBasics.actions.collide, emittor);\r\n }\r\n // TOOD: 矢は 武器ではなくアイテムで設定する方がふさわしいかもしれない。\r\n // ツクールの「武器」「防具」は身に着けることで様々な能力を身に着けるものであるが、\r\n // 矢は「セット」という動作が装備アイテムっぽいというだけで、実体は「投げる」のショートカットである。\r\n // それよりも矢を「投げ当てた」ときの効果の方が実際は重要なので、矢はアイテムとして設定する方が良いかもしれない。\r\n static setupArrowCommon(entity) {\r\n this.setupItemCommon(entity);\r\n entity.entity.kindId = MRBasics_1.MRBasics.entityCategories.ArrowKindId;\r\n const emittor = MRData_1.MRData.newEmittor(entity.entity.key);\r\n emittor.scope.range = DEffect_1.DEffectFieldScopeType.Performer;\r\n const effect = MRData_1.MRData.newEffect(entity.entity.key);\r\n effect.critical = false;\r\n effect.successRate = 100;\r\n effect.hitType = DEffect_1.DEffectHitType.Physical;\r\n // TODO: DB で定義したい\r\n const q = new DEffect_1.DParameterQualifying(MRBasics_1.MRBasics.params.hp, \"a.atk * 4 - b.def * 2\", DEffect_1.DParameterEffectApplyType.Damage)\r\n .withVariance(20);\r\n effect.parameterQualifyings.push(q);\r\n if (entity.equipment) {\r\n effect.flavorEffect = DFlavorEffect_1.DFlavorEffect.fromRmmzAnimationId(entity.equipment.targetRmmzAnimationId);\r\n }\r\n emittor.effectSuite.addTargetEffect(new DEffectSuite_1.DEffectRef(effect.id));\r\n entity.addReaction(MRBasics_1.MRBasics.actions.collide, emittor);\r\n }\r\n static setupRingCommon(entity) {\r\n this.setupItemCommon(entity);\r\n entity.entity.behaviors.push(new DBehavior_1.DBehaviorInstantiation(MRData_1.MRData.getBehavior(\"Equipment\").id, undefined));\r\n }\r\n static setupFoodCommon(entity, fp) {\r\n this.setupItemCommon(entity);\r\n entity.entity.kindId = MRBasics_1.MRBasics.entityCategories.FoodKindId;\r\n const mainEmittor = entity.mainEmittor();\r\n entity.addReaction(MRBasics_1.MRBasics.actions.EatActionId, mainEmittor);\r\n }\r\n static setupGrassCommon(entity, fp) {\r\n this.setupItemCommon(entity);\r\n entity.entity.kindId = MRBasics_1.MRBasics.entityCategories.grass;\r\n fp = fp !== null && fp !== void 0 ? fp : 500;\r\n // MainEmittor が Eat, Collide 両方の効果になるようにする。\r\n // ただし Eat には FP 回復効果も付くため、先に Collide 用の Emittor を clone で作っておき、\r\n // そのあと MainEmittor に FP 回復効果を追加する。\r\n const mainEmittor = entity.mainEmittor();\r\n mainEmittor.scope.range = DEffect_1.DEffectFieldScopeType.Performer;\r\n // Collide\r\n const collideEmittor = MRData_1.MRData.cloneEmittor(mainEmittor);\r\n entity.addReaction(MRBasics_1.MRBasics.actions.collide, collideEmittor);\r\n //entity.addEmittor(DEffectCause.Hit, collideEmittor);\r\n // FP 回復\r\n const eatEmittor = mainEmittor; //REData.newEmittor(entity.entity.key);\r\n const fpEffect = MRData_1.MRData.newEffect(entity.entity.key);\r\n fpEffect.parameterQualifyings.push(new DEffect_1.DParameterQualifying(MRBasics_1.MRBasics.params.fp, fp.toString(), DEffect_1.DParameterEffectApplyType.Recover).withSilent());\r\n eatEmittor.effectSuite.addTargetEffect(new DEffectSuite_1.DEffectRef(fpEffect.id));\r\n const reaction = entity.addReaction(MRBasics_1.MRBasics.actions.EatActionId, eatEmittor);\r\n reaction.overrideDisplayCommandName = (0, Common_1.tr2)(\"飲む\");\r\n //entity.addEmittor(DEffectCause.Eat, eatEmittor);\r\n // 投げ当てで MainEmittor 発動\r\n //entity.addEmittor(DEffectCause.Hit, REData.cloneEmittor(entity.mainEmittor()));\r\n entity.identificationDifficulty = DEntity_1.DIdentificationDifficulty.Obscure;\r\n entity.identificationReaction = MRData_1.MRData.getSkill(\"kAction_Eat\").id;\r\n entity.allowModifierState = false;\r\n return [eatEmittor, collideEmittor];\r\n }\r\n /*\r\n 杖の処理見直し\r\n ----------\r\n v0.7.0 時点の杖の処理の流れ\r\n 1. Wave の Reaction として、 「kSkill_魔法弾発射_一般のEmittor」 を発動する\r\n 2. 「kSkill_魔法弾発射_一般のEmittor」 の Range は StraightProjectile である。\r\n 3. performeEffect() にて、Performer は杖ItemEntity を使って、 StraightProjectile を発動する。\r\n 4. StraightProjectile は、使われた ItemEntity を投げ当てた時の効果を発動する。\r\n\r\n 今は StraightProjectile は Collide 固定だが、土塊の杖やトンネルの杖など、振ったときと投げた時で効果が変わるものはある。\r\n\r\n 多分イメージが簡単なのは、「吹き飛ばしの魔法弾」「トンネルの魔法弾」など個別に作ることだろう。\r\n 現状の StraightProjectile は ItemEntity の Collide を参照しているが、これをやめ、個別に設定できるようにする。\r\n v0.7.0 ではコード上で手動設定していたため、簡略化を狙ってちょっとややこしくなっていた。\r\n\r\n トドの壺など押したらコストを消費して何かが飛んでいくものにも応用できるかもしれない。\r\n\r\n 修正後の流れ\r\n 1. Wave の Reaction として、 kEmittor_吹き飛ばしの魔法弾 を発動する\r\n 2. kEmittor_吹き飛ばしの魔法弾 の Range は StraightProjectile で、効果は Emittor に紐づいている。\r\n 3. performeEffect() にて、Performer は StraightProjectile を発動する。\r\n 4. StraightProjectile は、kEmittor_吹き飛ばしの魔法弾 に紐づいた効果を発動する。\r\n\r\n なお、ドラゴンの炎ブレスはSkill側でダメージ設定している。\r\n performeEffect_StraightProjectile() で、 次のようになっている。\r\n - ItemEntity が指定されている場合はその collide を使う。\r\n - そうでなければ、 emittor に紐づいている Effect を使う。\r\n */\r\n static setupStaffCommon(entity) {\r\n this.setupItemCommon(entity);\r\n const mainEmittor = entity.mainEmittor();\r\n entity.addReaction(MRBasics_1.MRBasics.actions.collide, mainEmittor);\r\n //entity.addEmittor(DEffectCause.Hit, entity.mainEmittor());\r\n }\r\n static setupScrollCommon(entity) {\r\n this.setupItemCommon(entity);\r\n entity.identificationDifficulty = DEntity_1.DIdentificationDifficulty.Obscure;\r\n entity.identificationReaction = MRData_1.MRData.getSkill(\"kAction_Read\").id;\r\n }\r\n static setupStorageCommon(entity) {\r\n this.setupItemCommon(entity);\r\n entity.entity.kindId = MRBasics_1.MRBasics.entityCategories.PotKindId;\r\n entity.identificationDifficulty = DEntity_1.DIdentificationDifficulty.Obscure;\r\n entity.selfTraits.push({ code: MRBasics_1.MRBasics.traits.DisallowIntoStorage, dataId: 0, value: 0 });\r\n }\r\n static addVulnerableDeathExplosion(entity) {\r\n entity.selfTraits.push({ code: MRBasics_1.MRBasics.traits.DeathVulnerableElement, dataId: MRData_1.MRData.getElement(\"kElement_DeathExplosion\").id, value: MRData_1.MRData.getState(\"kState_System_ExplosionDeath\").id });\r\n }\r\n}\r\nexports.MRSetup = MRSetup;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/MRSetup.ts?"); /***/ }), /***/ "./ts/mr/data/importers/DAnnotationReader.ts": /*!***************************************************!*\ !*** ./ts/mr/data/importers/DAnnotationReader.ts ***! \***************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DAnnotationReader = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../../Common */ \"./ts/mr/Common.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ../MRData */ \"./ts/mr/data/MRData.ts\");\r\nclass DAnnotationReader {\r\n static findFirstAnnotationFromEvent(annotation, event) {\r\n return this.findFirstAnnotationFromPage(annotation, event.pages[0].list);\r\n }\r\n static findFirstAnnotationFromPage(annotation, list) {\r\n if (list) {\r\n // Collect comments.\r\n let comments = \"\";\r\n let inAnno = false;\r\n let found = false;\r\n for (let i = 0; i < list.length; i++) {\r\n if (!inAnno) {\r\n if (list[i].code == 108) {\r\n const comment = list[i].parameters[0];\r\n if (comment.includes(annotation)) {\r\n inAnno = true;\r\n found = true;\r\n }\r\n }\r\n }\r\n else {\r\n if (list[i].code == 108) {\r\n inAnno = false;\r\n }\r\n else if (list[i].code == 408) {\r\n comments += list[i].parameters;\r\n }\r\n }\r\n }\r\n if (found) {\r\n return `{${comments}}`;\r\n }\r\n // // Find annotation block.\r\n // let index = comments.indexOf(annotation);\r\n // if (index >= 0) {\r\n // let block = comments.substring(index + annotation.length);\r\n // //block = block.substring(\r\n // //block.indexOf(\"{\"),\r\n // // block.indexOf(\"}\") + 1);\r\n // return `{${block}}`;\r\n // }\r\n }\r\n return undefined;\r\n }\r\n static tryGetAnnotationFromEvent(annotation, event, rmmzMapId) {\r\n const block = this.findFirstAnnotationFromPage(annotation, event.pages[0].list);\r\n if (!block)\r\n return undefined;\r\n let rawData;\r\n try {\r\n eval(`rawData = ${block}`);\r\n (0, Common_1.assert)(rawData);\r\n }\r\n catch (e) {\r\n throw new Error((0, Common_1.tr2)(\"%1の構文エラーです。\").format(annotation) + `\\nMap:${rmmzMapId},Event:${event.id},${event.name}` + \"\\n\" + e.toString());\r\n }\r\n return rawData;\r\n }\r\n static readLandAnnotation(event) {\r\n const block = this.findFirstAnnotationFromEvent(\"@MR-Land\", event);\r\n if (!block)\r\n return undefined;\r\n let rawData;\r\n eval(`rawData = ${block}`);\r\n (0, Common_1.assert)(rawData);\r\n return rawData;\r\n }\r\n static readFloorAnnotationFromPage(page) {\r\n const block = this.findFirstAnnotationFromPage(\"@MR-Floor\", page.list);\r\n if (!block)\r\n return undefined;\r\n let rawData;\r\n eval(`rawData = ${block}`);\r\n (0, Common_1.assert)(rawData);\r\n return rawData;\r\n }\r\n static readFloorEventAnnotationFromPage(page) {\r\n const block = this.findFirstAnnotationFromPage(\"@MR-FloorEvent\", page.list);\r\n if (!block)\r\n return undefined;\r\n let rawData;\r\n eval(`rawData = ${block}`);\r\n (0, Common_1.assert)(rawData);\r\n return rawData;\r\n }\r\n /** @deprecated */\r\n static readStructuresMetadata(event) {\r\n const block = this.findFirstAnnotationFromEvent(\"@MR-Structures\", event);\r\n if (!block)\r\n return undefined;\r\n let rawData;\r\n eval(`rawData = ${block}`);\r\n (0, Common_1.assert)(rawData);\r\n return rawData;\r\n }\r\n static readPrefabAnnotation(event, rmmzMapId) {\r\n const rawData = this.tryGetAnnotationFromEvent(\"@MR-Prefab\", event, rmmzMapId);\r\n if (!rawData)\r\n return undefined;\r\n (0, Common_1.assert)(rawData);\r\n return rawData;\r\n }\r\n static readPrefabSubPageAnnotation(page) {\r\n const block = this.findFirstAnnotationFromPage(\"@MR-PrefabSubPage\", page.list);\r\n if (!block)\r\n return undefined;\r\n let rawData;\r\n eval(`rawData = ${block}`);\r\n (0, Common_1.assert)(rawData);\r\n return rawData;\r\n }\r\n static readEventPageAnnotation(page) {\r\n const block = this.findFirstAnnotationFromPage(\"@MR-EventPage\", page.list);\r\n if (!block)\r\n return undefined;\r\n let rawData;\r\n eval(`rawData = ${block}`);\r\n (0, Common_1.assert)(rawData);\r\n return rawData;\r\n }\r\n static readSpawnerAnnotationFromPage(page) {\r\n var _a, _b, _c, _d, _e, _f, _g, _h;\r\n const block = this.findFirstAnnotationFromPage(\"@MR-Spawner\", page.list);\r\n if (!block)\r\n return undefined;\r\n let rawData;\r\n eval(`rawData = ${block}`);\r\n (0, Common_1.assert)(rawData);\r\n const rawData_ = rawData;\r\n return {\r\n entity: rawData.entity ? ((_a = rawData.entity) !== null && _a !== void 0 ? _a : \"\") : ((_b = rawData.data) !== null && _b !== void 0 ? _b : \"\"),\r\n states: (_c = rawData.states) !== null && _c !== void 0 ? _c : [],\r\n troopId: rawData.troop ? MRData_1.MRData.troops.findIndex(x => x.key == rawData_.troop) : 0,\r\n stackCount: rawData.stack,\r\n override: (_d = rawData.override) !== null && _d !== void 0 ? _d : false,\r\n overrideEvent: (_e = rawData.overrideEvent) !== null && _e !== void 0 ? _e : false,\r\n keeper: (_f = rawData.keeper) !== null && _f !== void 0 ? _f : false,\r\n gold: (_g = rawData.gold) !== null && _g !== void 0 ? _g : 0,\r\n rate: (_h = rawData.rate) !== null && _h !== void 0 ? _h : 100,\r\n name: rawData.name,\r\n reactions: rawData.reactions,\r\n };\r\n }\r\n static readUniqueSpawnerAnnotationFromPage(page) {\r\n var _a, _b, _c;\r\n const block = this.findFirstAnnotationFromPage(\"@MR-UniqueSpawner\", page.list);\r\n if (!block)\r\n return undefined;\r\n let rawData;\r\n eval(`rawData = ${block}`);\r\n (0, Common_1.assert)(rawData);\r\n return {\r\n entityKey: (_a = rawData.entityKey) !== null && _a !== void 0 ? _a : \"\",\r\n moveType: (_b = rawData.moveType) !== null && _b !== void 0 ? _b : \"\",\r\n override: (_c = rawData.override) !== null && _c !== void 0 ? _c : false,\r\n };\r\n }\r\n static readREEventAnnotationFromPage(page) {\r\n const block = this.findFirstAnnotationFromPage(\"@MR-Event\", page.list);\r\n if (!block)\r\n return undefined;\r\n let rawData;\r\n eval(`rawData = ${block}`);\r\n (0, Common_1.assert)(rawData);\r\n return rawData;\r\n }\r\n static readTemplatePartAnnotationFromPage(page) {\r\n const block = this.findFirstAnnotationFromPage(\"@MR-TemplatePart\", page.list);\r\n if (!block)\r\n return undefined;\r\n let rawData;\r\n eval(`rawData = ${block}`);\r\n (0, Common_1.assert)(rawData);\r\n return rawData;\r\n }\r\n static readTroopAnnotationFromPage(page) {\r\n const block = this.findFirstAnnotationFromPage(\"@MR-Troop\", page.list);\r\n if (!block)\r\n return undefined;\r\n let rawData;\r\n eval(`rawData = ${block}`);\r\n (0, Common_1.assert)(rawData);\r\n return rawData;\r\n }\r\n}\r\nexports.DAnnotationReader = DAnnotationReader;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/importers/DAnnotationReader.ts?"); /***/ }), /***/ "./ts/mr/data/importers/DFloorPresetImporter.ts": /*!******************************************************!*\ !*** ./ts/mr/data/importers/DFloorPresetImporter.ts ***! \******************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DFloorPresetImporter = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst DLand_1 = __webpack_require__(/*! ../DLand */ \"./ts/mr/data/DLand.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ../MRData */ \"./ts/mr/data/MRData.ts\");\r\nclass DFloorPresetImporter {\r\n constructor(script) {\r\n let db = {};\r\n eval(script);\r\n (0, Common_1.assert)(db);\r\n this._db = db;\r\n this.import();\r\n }\r\n import() {\r\n for (const pair1 of Object.entries(this._db.floorPresets)) {\r\n const key = pair1[0];\r\n const preset = pair1[1];\r\n const data = MRData_1.MRData.newFloorPreset(key);\r\n // terrains\r\n for (const [terrainSettingKey, rate] of Object.entries(preset.terrains)) {\r\n const terraintSettingId = MRData_1.MRData.getTerrainSetting(terrainSettingKey).id;\r\n data.terrains.push(new DLand_1.DTerrainSettingRef(terraintSettingId, rate));\r\n }\r\n // monsterHouses\r\n if (preset.monsterHouses) {\r\n for (const [name, rate] of Object.entries(preset.monsterHouses)) {\r\n data.monsterHouses.push({ name: name, rating: rate });\r\n }\r\n }\r\n }\r\n }\r\n}\r\nexports.DFloorPresetImporter = DFloorPresetImporter;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/importers/DFloorPresetImporter.ts?"); /***/ }), /***/ "./ts/mr/data/importers/DMetadataParser.ts": /*!*************************************************!*\ !*** ./ts/mr/data/importers/DMetadataParser.ts ***! \*************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DMetadataParser = exports.DMetadata = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../../Common */ \"./ts/mr/Common.ts\");\r\nconst DHelper_1 = __webpack_require__(/*! ../DHelper */ \"./ts/mr/data/DHelper.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ../MRData */ \"./ts/mr/data/MRData.ts\");\r\nclass DMetadata {\r\n constructor() {\r\n this.key = \"\";\r\n this.effectKey = undefined;\r\n this.emittorKey = undefined;\r\n this.type = \"\";\r\n this.category = \"\";\r\n this.behaviors = [];\r\n this.traits = [];\r\n this.races = [];\r\n }\r\n}\r\nexports.DMetadata = DMetadata;\r\nclass DMetadataParser {\r\n static parse(meta) {\r\n const result = new DMetadata();\r\n if (!meta)\r\n return result;\r\n const type = meta[\"MR-Type\"];\r\n if (type) {\r\n result.type = type.trim();\r\n }\r\n const category = meta[\"MR-Category\"];\r\n if (category) {\r\n result.category = category.trim();\r\n }\r\n const key = meta[\"MR-Key\"];\r\n if (key) {\r\n result.key = key.trim();\r\n }\r\n const entityTemplateKey = meta[\"MR-EntityTemplate\"];\r\n if (entityTemplateKey) {\r\n result.entityTemplateKey = entityTemplateKey.trim();\r\n }\r\n const effectKey = meta[\"MR-EffectKey\"];\r\n if (effectKey) {\r\n result.effectKey = effectKey.trim();\r\n }\r\n const emittorKey = meta[\"MR-EmittorKey\"];\r\n if (emittorKey) {\r\n result.emittorKey = emittorKey.trim();\r\n }\r\n const capacity = meta[\"RE-Capacity\"];\r\n if (capacity) {\r\n result.capacity = capacity.trim();\r\n }\r\n const behaviors = meta[\"MR-Behavior\"];\r\n if (behaviors) {\r\n throw new Error(\"MR-Behavior is obsoleted. Pleaes edit /data/mr/EntityBehaviors.json instead.\");\r\n // if (typeof(behaviors) == \"string\") {\r\n // result.behaviors = this.parseMetadata_Behavior([behaviors]);\r\n // }\r\n // else {\r\n // result.behaviors = this.parseMetadata_Behavior(behaviors);\r\n // }\r\n }\r\n const traits = meta[\"MR-Trait\"];\r\n if (traits) {\r\n const list = ((traits instanceof Array) ? traits : [traits]);\r\n for (const data of list) {\r\n const c = DHelper_1.DHelpers.parseConstructionExpr(data);\r\n result.traits.push({\r\n code: MRData_1.MRData.getTrait(c.name).id,\r\n dataId: this.parseTraitDataId(c.args[0]),\r\n value: Number(c.args[1]),\r\n });\r\n }\r\n }\r\n const races = meta[\"MR-Race\"];\r\n if (races) {\r\n const list = ((races instanceof Array) ? races : [races]);\r\n for (const data of list) {\r\n result.races.push(data.trim());\r\n }\r\n }\r\n return result;\r\n }\r\n // private static parseMetadata_Behavior(meta: string[]): DBehaviorInstantiation[] {\r\n // const result: DBehaviorInstantiation[] = [];\r\n // for (const data of meta) {\r\n // const expr = DHelpers.parseConstructionExpr(data);\r\n // result.push(new DBehaviorInstantiation(MRData.getBehavior(expr.name).id, expr.args));\r\n // }\r\n // return result;\r\n // }\r\n static parseTraitDataId(value) {\r\n if (typeof value == 'string') {\r\n // 今のところ Param 名だけなのでそれを検索してみる\r\n const code = value.toLowerCase();\r\n const param = MRData_1.MRData.parameters.find(x => x.code == code);\r\n if (param) {\r\n return param.id;\r\n }\r\n else {\r\n throw new Error((0, Common_1.tr2)(\"Trait に指定されているパラメータ名 %1 は不正です。\").format(value));\r\n }\r\n }\r\n else {\r\n return Number(value);\r\n }\r\n }\r\n}\r\nexports.DMetadataParser = DMetadataParser;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/importers/DMetadataParser.ts?"); /***/ }), /***/ "./ts/mr/data/importers/DSetupScripEvaluator.ts": /*!******************************************************!*\ !*** ./ts/mr/data/importers/DSetupScripEvaluator.ts ***! \******************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}));\r\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n});\r\nvar __importStar = (this && this.__importStar) || function (mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.evalScript = void 0;\r\nconst DSetupScript_1 = __webpack_require__(/*! ./DSetupScript */ \"./ts/mr/data/importers/DSetupScript.ts\");\r\nconst index = __importStar(__webpack_require__(/*! ../index */ \"./ts/mr/data/index.ts\"));\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\n// function Parameter(props: IParameterProps): IParameterProps {\r\n// return props;\r\n// }\r\nfunction EntityCategory(props) {\r\n return props;\r\n}\r\nfunction Effect(props) {\r\n return props;\r\n}\r\nfunction ParameterFlavorEffect(props) {\r\n return props;\r\n}\r\nfunction ParameterValue(props) {\r\n return props;\r\n}\r\nfunction ParameterBuff(props) {\r\n return props;\r\n}\r\nfunction SpecialEffect(props) {\r\n return props;\r\n}\r\nfunction Trait(props) {\r\n return props;\r\n}\r\nfunction FlavorEffect(props) {\r\n return props;\r\n}\r\nfunction Emittor(props) {\r\n return props;\r\n}\r\nfunction EffectRef(props) {\r\n return props;\r\n}\r\nfunction Entity(props) {\r\n return props;\r\n}\r\nfunction Reaction(props) {\r\n return props;\r\n}\r\nfunction EntityTemplate(props) {\r\n return props;\r\n}\r\nfunction evalScript(obj, script) {\r\n const require = function (f) {\r\n return index;\r\n };\r\n const tr = Common_1.tr2;\r\n (0, DSetupScript_1.setDB)(obj);\r\n eval(script);\r\n (0, DSetupScript_1.setDB)(undefined);\r\n}\r\nexports.evalScript = evalScript;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/importers/DSetupScripEvaluator.ts?"); /***/ }), /***/ "./ts/mr/data/importers/DSetupScript.ts": /*!**********************************************!*\ !*** ./ts/mr/data/importers/DSetupScript.ts ***! \**********************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DSetupScript = exports.setDB = exports.db = exports.DSetupScriptDatabase = void 0;\r\nconst MRData_1 = __webpack_require__(/*! ../MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst DSetupScripEvaluator_1 = __webpack_require__(/*! ./DSetupScripEvaluator */ \"./ts/mr/data/importers/DSetupScripEvaluator.ts\");\r\nclass DSetupScriptDatabase {\r\n constructor() {\r\n this.parameters = {};\r\n this.entityCategories = {};\r\n this.entityTemplates = {};\r\n this.entities3 = {};\r\n this.actions = {};\r\n this.effects = {};\r\n this.emittors = {};\r\n this.entities = {};\r\n }\r\n mergeFrom(other) {\r\n Object.assign(this.parameters, other.parameters);\r\n Object.assign(this.entityCategories, other.entityCategories);\r\n Object.assign(this.entityTemplates, other.entityTemplates);\r\n Object.assign(this.entities3, other.entities3);\r\n Object.assign(this.actions, other.actions);\r\n Object.assign(this.effects, other.effects);\r\n Object.assign(this.emittors, other.emittors);\r\n Object.assign(this.entities, other.entities);\r\n }\r\n}\r\nexports.DSetupScriptDatabase = DSetupScriptDatabase;\r\nfunction setDB(v) {\r\n exports.db = v;\r\n}\r\nexports.setDB = setDB;\r\n;\r\nclass DSetupScript {\r\n constructor() {\r\n this._mainDB = new DSetupScriptDatabase();\r\n }\r\n addScript(script) {\r\n const db = new DSetupScriptDatabase();\r\n (0, DSetupScripEvaluator_1.evalScript)(db, script);\r\n this._mainDB.mergeFrom(db);\r\n }\r\n registerData() {\r\n for (const key in this._mainDB.parameters) {\r\n if (!MRData_1.MRData.parameters.find(x => x.key == key)) {\r\n MRData_1.MRData.addParams(key, \"\");\r\n }\r\n }\r\n }\r\n setupData() {\r\n this.createEntityCategories();\r\n this.createActions();\r\n this.createEffects();\r\n this.createEmittors();\r\n this.createEntityTemplates();\r\n this.createEntities();\r\n for (const data of MRData_1.MRData.parameters) {\r\n const entry = this._mainDB.parameters[data.key];\r\n if (entry) {\r\n entry.setup(data);\r\n }\r\n }\r\n // for (const data of MRData.skills.filter(x => x.isActivity)) {\r\n // const props = db.actions[data.key];\r\n // if (props) {\r\n // props.setup(data);\r\n // }\r\n // }\r\n this.setupEntityCategories();\r\n this.setupActions();\r\n this.setupEffects();\r\n this.setupEmittors();\r\n this.setupEntityTemplates();\r\n this.setupEntities();\r\n }\r\n createEntityCategories() {\r\n for (const [key, props] of Object.entries(this._mainDB.entityCategories)) {\r\n if (!MRData_1.MRData.categories.find(x => x.key == key)) {\r\n MRData_1.MRData.newEntityCategory(key);\r\n }\r\n }\r\n }\r\n setupEntityCategories() {\r\n for (const data of MRData_1.MRData.categories) {\r\n const props = this._mainDB.entityCategories[data.key];\r\n if (props) {\r\n data.applyProps(props);\r\n }\r\n }\r\n }\r\n createEffects() {\r\n for (const [key, props] of Object.entries(this._mainDB.effects)) {\r\n if (!MRData_1.MRData.effects.find(x => x.key == key)) {\r\n MRData_1.MRData.newEffect(key);\r\n }\r\n }\r\n }\r\n setupEffects() {\r\n for (const data of MRData_1.MRData.effects) {\r\n const props = this._mainDB.effects[data.key];\r\n if (props) {\r\n data.applyProps(props);\r\n }\r\n }\r\n }\r\n createEmittors() {\r\n if (!this._mainDB.emittors)\r\n return;\r\n for (const [key, props] of Object.entries(this._mainDB.emittors)) {\r\n if (!MRData_1.MRData.emittors.find(x => x.key == key)) {\r\n MRData_1.MRData.newEmittor(key);\r\n }\r\n }\r\n }\r\n setupEmittors() {\r\n if (!this._mainDB.emittors)\r\n return;\r\n for (const data of MRData_1.MRData.emittors) {\r\n const props = this._mainDB.emittors[data.key];\r\n if (props) {\r\n data.applyProps(props);\r\n }\r\n }\r\n }\r\n createActions() {\r\n if (!this._mainDB.actions)\r\n return;\r\n for (const [key, props] of Object.entries(this._mainDB.actions)) {\r\n if (!MRData_1.MRData.skills.find(x => x.key == key)) {\r\n MRData_1.MRData.newEmittor(key);\r\n }\r\n }\r\n }\r\n setupActions() {\r\n if (!this._mainDB.actions)\r\n return;\r\n for (const data of MRData_1.MRData.skills) {\r\n const props = this._mainDB.actions[data.key];\r\n if (props) {\r\n data.applyProps(props);\r\n }\r\n }\r\n }\r\n createEntityTemplates() {\r\n if (!this._mainDB.entityTemplates)\r\n return;\r\n for (const [key, props] of Object.entries(this._mainDB.entityTemplates)) {\r\n if (!MRData_1.MRData.entityTemplates.find(x => x.key == key)) {\r\n MRData_1.MRData.newEntityTemplate(key, props);\r\n }\r\n }\r\n }\r\n setupEntityTemplates() {\r\n if (!this._mainDB.entityTemplates)\r\n return;\r\n for (const data of MRData_1.MRData.entityTemplates) {\r\n const props = this._mainDB.entityTemplates[data.key];\r\n if (props) {\r\n data.resetProps(props);\r\n }\r\n }\r\n }\r\n createEntities() {\r\n if (!this._mainDB.entities)\r\n return;\r\n for (const [key, props] of Object.entries(this._mainDB.entities)) {\r\n if (!MRData_1.MRData.entities.find(x => x.entity.key == key)) {\r\n const e = MRData_1.MRData.newEntity();\r\n e.entity.key = key;\r\n }\r\n }\r\n }\r\n setupEntities() {\r\n if (!this._mainDB.entities)\r\n return;\r\n for (const data of MRData_1.MRData.entities) {\r\n if (data.entityTemplateKey) {\r\n const entityTemplates = MRData_1.MRData.getEntityTemplate(data.entityTemplateKey);\r\n entityTemplates.applyTo(data);\r\n }\r\n const props = this._mainDB.entities[data.entity.key];\r\n if (props) {\r\n data.applyProps(props);\r\n }\r\n }\r\n }\r\n setupItem(entity) {\r\n // {\r\n // const data: DSetupScriptDB_Entity = this._db.entities[entity.entity.key];\r\n // if (data) {\r\n // if (data.descriptions) {\r\n // const text = data.descriptions.join(\"\\n\");\r\n // entity.description = text;\r\n // }\r\n // if (data.equipmentTraits) {\r\n // for (const t of data.equipmentTraits) {\r\n // const traitData = MRData.getTrait(t.code);\r\n // const trait: IDataTrait = {\r\n // code: traitData.id,\r\n // dataId: 0,\r\n // value: t.value ?? 0,\r\n // };\r\n // // Convert data\r\n // if (t.data) {\r\n // switch (traitData.id) {\r\n // case MRBasics.traits.RaceRate:\r\n // trait.dataId = MRData.getRace(t.data).id;\r\n // break;\r\n // }\r\n // }\r\n // entity.equipmentTraits.push(trait);\r\n // }\r\n // }\r\n // }\r\n // }\r\n {\r\n const data = this._mainDB.entities3[entity.entity.key];\r\n if (data) {\r\n data.setup(entity);\r\n }\r\n }\r\n }\r\n}\r\nexports.DSetupScript = DSetupScript;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/importers/DSetupScript.ts?"); /***/ }), /***/ "./ts/mr/data/importers/DTerrainSettingImporter.ts": /*!*********************************************************!*\ !*** ./ts/mr/data/importers/DTerrainSettingImporter.ts ***! \*********************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DTerrainSettingImporter = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ../MRData */ \"./ts/mr/data/MRData.ts\");\r\nclass DTerrainSettingImporter {\r\n constructor(script) {\r\n let db = {};\r\n eval(script);\r\n (0, Common_1.assert)(db);\r\n this._db = db;\r\n this.import();\r\n }\r\n import() {\r\n for (const pair1 of Object.entries(this._db.terrainSettings)) {\r\n const key = pair1[0];\r\n const preset = pair1[1];\r\n const data = MRData_1.MRData.newTerrainSetting(key);\r\n // shapes\r\n for (const [shapeKey, rate] of Object.entries(preset.shapes)) {\r\n const dataId = MRData_1.MRData.getTerrainShape(shapeKey).id;\r\n data.shapeRefs.push({ dataId: dataId, rate: rate });\r\n }\r\n // structures\r\n if (preset.structures) {\r\n for (const [name, rate] of Object.entries(preset.structures)) {\r\n data.forceStructures.push({ typeName: name, rate: rate * 100 });\r\n }\r\n }\r\n }\r\n }\r\n}\r\nexports.DTerrainSettingImporter = DTerrainSettingImporter;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/importers/DTerrainSettingImporter.ts?"); /***/ }), /***/ "./ts/mr/data/index.ts": /*!*****************************!*\ !*** ./ts/mr/data/index.ts ***! \*****************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}));\r\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n__exportStar(__webpack_require__(/*! ./DEffect */ \"./ts/mr/data/DEffect.ts\"), exports);\r\n__exportStar(__webpack_require__(/*! ./DFaction */ \"./ts/mr/data/DFaction.ts\"), exports);\r\n__exportStar(__webpack_require__(/*! ./DFlavorEffect */ \"./ts/mr/data/DFlavorEffect.ts\"), exports);\r\n__exportStar(__webpack_require__(/*! ./DParameter */ \"./ts/mr/data/DParameter.ts\"), exports);\r\n__exportStar(__webpack_require__(/*! ./importers/DSetupScript */ \"./ts/mr/data/importers/DSetupScript.ts\"), exports);\r\n__exportStar(__webpack_require__(/*! ./importers/DSetupScripEvaluator */ \"./ts/mr/data/importers/DSetupScripEvaluator.ts\"), exports);\r\n__exportStar(__webpack_require__(/*! ./DTextManager */ \"./ts/mr/data/DTextManager.ts\"), exports);\r\n__exportStar(__webpack_require__(/*! ./MRData */ \"./ts/mr/data/MRData.ts\"), exports);\r\n__exportStar(__webpack_require__(/*! ./MRBasics */ \"./ts/mr/data/MRBasics.ts\"), exports);\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/data/index.ts?"); /***/ }), /***/ "./ts/mr/floorgen/FGenericRandomMapGenerator.ts": /*!******************************************************!*\ !*** ./ts/mr/floorgen/FGenericRandomMapGenerator.ts ***! \******************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.FGenericRandomMapGenerator = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst DTerrainPreset_1 = __webpack_require__(/*! ../data/DTerrainPreset */ \"./ts/mr/data/DTerrainPreset.ts\");\r\nconst UEffect_1 = __webpack_require__(/*! ../utility/UEffect */ \"./ts/mr/utility/UEffect.ts\");\r\nconst FMapData_1 = __webpack_require__(/*! ./FMapData */ \"./ts/mr/floorgen/FMapData.ts\");\r\nconst FSectorConnectionBuilder_1 = __webpack_require__(/*! ./FSectorConnectionBuilder */ \"./ts/mr/floorgen/FSectorConnectionBuilder.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ../data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst PluginParameters_1 = __webpack_require__(/*! ../PluginParameters */ \"./ts/mr/PluginParameters.ts\");\r\nconst RoomMinSize = 4;\r\nconst AreaMinSize = RoomMinSize + 3;\r\n/**\r\n * 床・壁・通路・区画情報 などマップの基本情報を生成するモジュール。\r\n *\r\n * 次のような要素はこのパスでは生成しない。\r\n * - アイテム\r\n * - 罠\r\n * - 階段\r\n * - 水路\r\n * - 壊せない壁\r\n * - 装飾\r\n * ...\r\n *\r\n * FloorGenerator は一度の map building で複数使われることがある。\r\n * 特に水路を生成する場合は「部屋を生成せず通路のみとする」モードで FloorGenerator を使い、\r\n * そうではないモードで生成したマップと合成する。\r\n *\r\n * このように各種障害や装飾の生成ソースとしても利用するため、データは GameMap とは独立する。\r\n *\r\n * https://github.com/marukrap/RoguelikeDevResources\r\n * http://www.roguebasin.com/index.php?title=Dungeon-Building_Algorithm\r\n */\r\nclass FGenericRandomMapGenerator {\r\n constructor(map, setting) {\r\n this._map = map;\r\n this._setting = setting;\r\n const shape = UEffect_1.UEffect.selectRating(this.random, setting.shapeRefs, x => x.rate);\r\n this._shape = shape ? MRData_1.MRData.terrainShapes[shape.dataId] : MRData_1.MRData.getTerrainShape(\"kTerrainShape_Default\");\r\n map.resetFromInnerSize(this._shape.width, this._shape.height, PluginParameters_1.paramRandomMapPaddingX, PluginParameters_1.paramRandomMapPaddingY);\r\n }\r\n get random() {\r\n return this._map.random();\r\n }\r\n generate() {\r\n if (!this.makeSectors()) {\r\n return;\r\n }\r\n this.makeSectorAdjacency();\r\n this.makeSectorConnections();\r\n this.makeRoomShapeDefinitions();\r\n this.makeStructureDefinitions();\r\n this.makeRooms();\r\n this.makePivots();\r\n this.makeEdgePins();\r\n this.makePinConnections();\r\n this.makePassageWay();\r\n this.makeBlocks();\r\n }\r\n reportError(message) {\r\n throw new Error(message);\r\n }\r\n makeSectors() {\r\n const countH = this._shape.divisionCountX;\r\n const countV = this._shape.divisionCountY;\r\n /*\r\n Area の最小構成は次のようになる。\r\n\r\n .= room\r\n\r\n +-------+\r\n | | < 1Tile\r\n | .... |\r\n | .... |\r\n | .... |\r\n | .... |\r\n | .... |\r\n | | < 2Tile\r\n | | < 2Tile\r\n +-------+\r\n ^ ^^\r\n 1Tile 2Tile\r\n \r\n\r\n - 右端と下端は、通路を垂直または水平に伸ばすための最小領域として残す。\r\n\r\n */\r\n // Split area\r\n {\r\n const w = this._map.innerWidth / countH;\r\n const h = this._map.innerHeight / countV;\r\n if (w < AreaMinSize || h < AreaMinSize) {\r\n this.reportError(\"Map size too small for number of area divisions.\");\r\n return false;\r\n }\r\n for (let y = 0; y < countV; y++) {\r\n for (let x = 0; x < countH; x++) {\r\n const sector = this._map.newSector();\r\n const sectorW = (x < countH - 1) ? w : this._map.innerWidth - (w * (countH - 1)); // 最後の Sector は一杯まで広げる\r\n const sectorH = (y < countV - 1) ? h : this._map.innerHeight - (h * (countV - 1)); // 最後の Sector は一杯まで広げる\r\n sector.setRect(this._map.ox + w * x, this._map.oy + h * y, sectorW, sectorH);\r\n }\r\n }\r\n }\r\n return true;\r\n }\r\n // 区画の隣接情報を作る\r\n makeSectorAdjacency() {\r\n for (const s1 of this._map.sectors()) {\r\n for (const s2 of this._map.sectors()) {\r\n if (s1 != s2) {\r\n if (s1.my1 <= s2.my2 && s1.my2 >= s2.my1) { // Y軸としては衝突している\r\n if ((s1.mx1 - 1) == s2.mx2) { // s1 は s2 の右側と隣接している\r\n this._map.attemptNewAdjacency(s1, FMapData_1.FDirection.L, s2, FMapData_1.FDirection.R);\r\n }\r\n else if ((s1.mx2 + 1) == s2.mx1) { // s1 は s2 の左側と隣接している\r\n this._map.attemptNewAdjacency(s1, FMapData_1.FDirection.R, s2, FMapData_1.FDirection.L);\r\n }\r\n }\r\n else if (s1.mx1 <= s2.mx2 && s1.mx2 >= s2.mx1) { // X軸としては衝突している\r\n if ((s1.my1 - 1) == s2.my2) { // s1 は s2 の下側と隣接している\r\n this._map.attemptNewAdjacency(s1, FMapData_1.FDirection.T, s2, FMapData_1.FDirection.B);\r\n }\r\n else if ((s1.my2 + 1) == s2.my1) { // s1 は s2 の上側と隣接している\r\n this._map.attemptNewAdjacency(s1, FMapData_1.FDirection.B, s2, FMapData_1.FDirection.T);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n // 実際に Connection を作成する。\r\n makeSectorConnections() {\r\n FSectorConnectionBuilder_1.FSectorConnectionBuilder.connect(this._map, this.random, this._shape);\r\n }\r\n // RoomShape を選択する。\r\n // 種類によっては行き止まりにしか生成できない、など制約があるので、Connection を作った後に処理する。\r\n makeRoomShapeDefinitions() {\r\n const sectors = this._map.sectors();\r\n const sectorCount = sectors.length;\r\n let shapeDefCount = this._shape.forceRoomShapes.length;\r\n if (shapeDefCount >= sectorCount) {\r\n shapeDefCount = sectorCount;\r\n }\r\n // まずは強制的に設定したいものを処理する\r\n {\r\n const shapes = new Array(sectorCount);\r\n for (let i = 0; i < shapeDefCount; i++) {\r\n shapes[i] = this._shape.forceRoomShapes[i].typeName;\r\n }\r\n this.random.mutableShuffleArray(shapes);\r\n for (let i = 0; i < sectorCount; i++) {\r\n if (shapes[i]) {\r\n sectors[i].roomShapeType = shapes[i];\r\n }\r\n }\r\n }\r\n }\r\n // 構造物。RoomShape とほぼ同じ。\r\n makeStructureDefinitions() {\r\n const sectors = this._map.sectors();\r\n const sectorCount = sectors.length;\r\n let structureDefCount = this._setting.forceStructures.length;\r\n if (structureDefCount >= sectorCount) {\r\n structureDefCount = sectorCount;\r\n }\r\n // まずは強制的に設定したいものを処理する\r\n {\r\n const structures = [];\r\n for (const s of this._setting.forceStructures) {\r\n if (this.random.nextIntWithMax(100) < s.rate) {\r\n structures.push(s.typeName);\r\n }\r\n }\r\n const shapes = new Array(sectorCount);\r\n for (let i = 0; i < structures.length; i++) {\r\n shapes[i] = structures[i];\r\n }\r\n this.random.mutableShuffleArray(shapes);\r\n for (let i = 0; i < sectorCount; i++) {\r\n if (shapes[i]) {\r\n sectors[i].structureType = shapes[i];\r\n }\r\n }\r\n }\r\n // for (const sector of sectors) {\r\n // if (!sector.structureType) {\r\n // const structure = UEffect.selectRating(this.random, this._setting.structureDefs, x => x.rate);\r\n // assert(structure);\r\n // sector.structureType = structure.typeName;\r\n // }\r\n // }\r\n }\r\n makeRooms() {\r\n // 大部屋?\r\n const grateHall = this._map.sectors().length == 1;\r\n // Room を作れそうな Sector を集める\r\n const candidateSectors = [];\r\n for (const sector of this._map.sectors()) {\r\n if (grateHall || sector.hasAnyConnection()) {\r\n candidateSectors.push(sector);\r\n }\r\n else {\r\n // Connection の無い Sector は、自動での部屋生成は不要。\r\n // 埋蔵金部屋などは別途作る。\r\n }\r\n }\r\n // candidateSectors の各 Sector に対して Room の生成有無をランダムに決める\r\n const candidateSectorCount = candidateSectors.length;\r\n const roomEnables = new Array(candidateSectorCount);\r\n let roomCount = 0;\r\n if (this._shape.roomCountMax == Infinity) {\r\n roomCount = candidateSectorCount;\r\n }\r\n else {\r\n roomCount = this.random.nextIntWithMinMax(this._shape.roomCountMin, this._shape.roomCountMax + 1);\r\n roomCount = Math.min(Math.max(roomCount, 2), candidateSectorCount);\r\n }\r\n for (let i = 0; i < roomCount; i++) {\r\n roomEnables[i] = true;\r\n }\r\n if (roomCount < roomEnables.length) {\r\n this.random.mutableShuffleArray(roomEnables);\r\n }\r\n // 各候補 Sector について、生成フラグの立っているものへ Room を作る\r\n for (let iSector = 0; iSector < candidateSectorCount; iSector++) {\r\n const sector = candidateSectors[iSector];\r\n if (roomEnables[iSector]) {\r\n const room = this._map.newRoom(sector);\r\n // 部屋を作れる範囲\r\n const [l, t, r, b] = sector.getRoomCandidateRelativeRect();\r\n const maxRoomWidth = (r - l) + 1;\r\n const maxRoomHeight = (b - t) + 1;\r\n if (sector.roomShapeType == \"FullPlane\") {\r\n room.setRect(sector.mx1 + l, sector.my1 + t, maxRoomWidth, maxRoomHeight);\r\n room.poorVisibility = true;\r\n }\r\n else if (sector.roomShapeType == \"HalfPlane\") {\r\n const sw = sector.width();\r\n const sh = sector.height();\r\n const w = sw / 2;\r\n const h = sh / 2;\r\n const ox = (sw - w) / 2;\r\n const oy = (sh - h) / 2;\r\n room.setRect(sector.mx1 + ox, sector.my1 + oy, w, h);\r\n room.poorVisibility = true;\r\n }\r\n else {\r\n const w = this.random.nextIntWithMinMax(RoomMinSize, maxRoomWidth);\r\n const h = this.random.nextIntWithMinMax(RoomMinSize, maxRoomHeight);\r\n const x = l + ((w != maxRoomWidth) ? this.random.nextIntWithMax(maxRoomWidth - w) : 0);\r\n const y = t + ((h != maxRoomHeight) ? this.random.nextIntWithMax(maxRoomHeight - h) : 0);\r\n room.setRect(sector.mx1 + x, sector.my1 + y, w, h);\r\n }\r\n }\r\n }\r\n }\r\n makePivots() {\r\n for (const sector of this._map.sectors()) {\r\n const room = sector.room();\r\n if (room) {\r\n // 部屋内に Pivot を作る\r\n const ox = room.mx1 - sector.mx1;\r\n const oy = room.my1 - sector.my1;\r\n (0, Common_1.assert)(ox >= 0);\r\n (0, Common_1.assert)(oy >= 0);\r\n sector.setPivot(ox + this.random.nextIntWithMax(room.width), oy + this.random.nextIntWithMax(room.height));\r\n }\r\n else {\r\n // 区画内に Pivot を作る\r\n const [l, t, r, b] = sector.getRoomCandidateRelativeRect();\r\n sector.setPivot(l + this.random.nextIntWithMax(r - l), t + this.random.nextIntWithMax(b - t));\r\n }\r\n }\r\n }\r\n makeEdgePins() {\r\n for (const sector of this._map.sectors()) {\r\n const room = sector.room();\r\n let width, height;\r\n let ox, oy;\r\n let outerL, outerR, outerT, outerB;\r\n if (room) {\r\n width = room.width;\r\n height = room.height;\r\n ox = room.mx1 - sector.mx1;\r\n oy = room.my1 - sector.my1;\r\n outerL = room.mx1 - 1;\r\n outerR = room.mx2 + 1;\r\n outerT = room.my1 - 1;\r\n outerB = room.my2 + 1;\r\n }\r\n else {\r\n width = sector.width();\r\n height = sector.height();\r\n ox = 0;\r\n oy = 0;\r\n outerL = -1;\r\n outerR = -1;\r\n outerT = -1;\r\n outerB = -1;\r\n }\r\n if (this._shape.wayConnectionMode == DTerrainPreset_1.FGenericRandomMapWayConnectionMode.RoomEdge) {\r\n for (let x = 0; x < width; x++) {\r\n sector.edge(FMapData_1.FDirection.T).addPin(ox + x);\r\n sector.edge(FMapData_1.FDirection.B).addPin(ox + x);\r\n }\r\n for (let y = 0; y < height; y++) {\r\n sector.edge(FMapData_1.FDirection.L).addPin(oy + y);\r\n sector.edge(FMapData_1.FDirection.R).addPin(oy + y);\r\n }\r\n }\r\n else if (this._shape.wayConnectionMode == DTerrainPreset_1.FGenericRandomMapWayConnectionMode.SectionEdge) {\r\n const sx = sector.mx1;\r\n const sy = sector.my1;\r\n for (let x = 0; x < sector.width() - 1; x++) { // 区画の右端に通路は作れないため、pin は作らない。そのための -1\r\n if ((sx + x) != outerL && (sx + x) != outerR) { // 部屋の外周に一致する場所には生成しない\r\n sector.edge(FMapData_1.FDirection.T).addPin(x);\r\n sector.edge(FMapData_1.FDirection.B).addPin(x);\r\n }\r\n }\r\n for (let y = 0; y < sector.height() - 1; y++) { // 区画の下端に通路は作れないため、pin は作らない。そのための -1\r\n if ((sy + y) != outerT && (sy + y) != outerB) { // 部屋の外周に一致する場所には生成しない\r\n sector.edge(FMapData_1.FDirection.L).addPin(y);\r\n sector.edge(FMapData_1.FDirection.R).addPin(y);\r\n }\r\n }\r\n }\r\n else {\r\n throw new Error(\"Unreachable.\");\r\n }\r\n }\r\n }\r\n makePinConnections() {\r\n for (const connection of this._map.connections()) {\r\n const pins1 = connection.edge1().pins();\r\n const pins2 = connection.edge2().pins();\r\n const sector1 = connection.edge1().sector();\r\n const sector2 = connection.edge2().sector();\r\n // 相手側\r\n const candidates1 = [];\r\n const candidates2 = [];\r\n if (connection.alignedAxis() == FMapData_1.FAxis.H) {\r\n for (const pin of pins1) {\r\n if (!sector2.isRoomBesideY(pin.my())) {\r\n candidates1.push(pin);\r\n }\r\n }\r\n for (const pin of pins2) {\r\n if (!sector1.isRoomBesideY(pin.my())) {\r\n candidates2.push(pin);\r\n }\r\n }\r\n }\r\n else {\r\n for (const pin of pins1) {\r\n if (!sector2.isRoomBesideX(pin.mx())) {\r\n candidates1.push(pin);\r\n }\r\n }\r\n for (const pin of pins2) {\r\n if (!sector1.isRoomBesideX(pin.mx())) {\r\n candidates2.push(pin);\r\n }\r\n }\r\n }\r\n /*\r\n isRoomBeside~ で外周チェックしないと、次のように通路ができてしまう。\r\n *----------\r\n | 通路\r\n +--+ +-----\r\n | |\r\n | |\r\n\r\n */\r\n connection.setConnectedPins(candidates1[this.random.nextIntWithMax(candidates1.length)], candidates2[this.random.nextIntWithMax(candidates2.length)]);\r\n }\r\n }\r\n makePassageWay() {\r\n const OriginToPrimaryWayMargin = 2;\r\n /*\r\n OriginToPrimaryWayMargin は、部屋の基準点 (@) と MainStreet の間に設けるマージン。\r\n\r\n こうしないと例えば\r\n ↓ここ みたいなでっぱりができてしまう。\r\n ##########\r\n #,,,,,,@##\r\n ###,######\r\n ###,######\r\n ###,,,####\r\n #####@####\r\n ##########\r\n\r\n このときの MainStreet 部分は次の x で示した部分となる。\r\n ##########\r\n #xxx,,,@##\r\n ###,######\r\n ###,######\r\n ###,######\r\n\r\n これを防ぐためには、MainStreet の Y 座標が、最低 2 tile 分は部屋の基準点から離れる必要がある。\r\n ##########\r\n #,,,,,,@##\r\n #,########\r\n #xxx######\r\n ###,######\r\n\r\n 逆にあえて袋小路作りたいときはこれを 0 とかにする。\r\n */\r\n for (const connection of this._map.connections()) {\r\n const pin1 = connection.pin1();\r\n const pin2 = connection.pin2();\r\n if (!pin1 || !pin2)\r\n continue;\r\n const secor1 = pin1.edge().sector();\r\n const secor2 = pin2.edge().sector();\r\n switch (connection.alignedAxis()) {\r\n case FMapData_1.FAxis.H: { // sector は横並び\r\n // Sector と Room の位置関係を確認\r\n let secorL;\r\n let secorR;\r\n if (secor1.mx1 < secor2.mx2) {\r\n secorL = secor1;\r\n secorR = secor2;\r\n }\r\n else {\r\n secorL = secor2;\r\n secorR = secor1;\r\n }\r\n const edgeL = secorL.edge(FMapData_1.FDirection.R); // 左側領域の、右端Edge\r\n const edgeR = secorR.edge(FMapData_1.FDirection.L); // 右側領域の、左端Edge\r\n const roomL = secorL.room();\r\n const roomR = secorR.room();\r\n // 部屋に隣接している位置。この X 座標に PrimaryWay を置くことはできない。\r\n const roomLOuterX = roomL ? roomL.mx2 + 1 : -100;\r\n const roomROuterX = roomR ? roomR.mx1 - 1 : -100;\r\n // PrimaryWay を配置する選択肢を作る (Pivot の間)\r\n const primaryWayXCandidates = [];\r\n const left = secorL.mx1 + secorL.px() + OriginToPrimaryWayMargin;\r\n const right = secorR.mx1 + secorR.px() - OriginToPrimaryWayMargin;\r\n for (let x = left; x <= right; x++) {\r\n if (x != roomLOuterX && x != roomROuterX) {\r\n primaryWayXCandidates.push(x);\r\n }\r\n }\r\n (0, Common_1.assert)(primaryWayXCandidates.length > 0);\r\n // PrimaryWay の X 座標を決める\r\n const primaryWayX = primaryWayXCandidates[this.random.nextIntWithMax(primaryWayXCandidates.length)];\r\n // PrimaryWay の Top, Bottom 座標を決める\r\n const primaryWayT = Math.min(pin1.my(), pin2.my());\r\n const primaryWayB = Math.max(pin1.my(), pin2.my());\r\n // Plot\r\n for (let y = primaryWayT; y <= primaryWayB; y++) {\r\n const block = this._map.block(primaryWayX, y);\r\n block.setComponent(FMapData_1.FBlockComponent.Passageway);\r\n }\r\n this.plotSecondaryWay(primaryWayX, pin1.my(), secor1, FMapData_1.FAxis.H);\r\n this.plotSecondaryWay(primaryWayX, pin2.my(), secor2, FMapData_1.FAxis.H);\r\n break;\r\n }\r\n case FMapData_1.FAxis.V: { // sector は縦並び\r\n // Sector と Room の位置関係を確認\r\n let secorT;\r\n let secorB;\r\n if (secor1.mx1 < secor2.mx2) {\r\n secorT = secor1;\r\n secorB = secor2;\r\n }\r\n else {\r\n secorT = secor2;\r\n secorB = secor1;\r\n }\r\n const roomT = secorT.room();\r\n const roomB = secorB.room();\r\n // 部屋に隣接している位置。この Y 座標に PrimaryWay を置くことはできない。\r\n const roomTOuterY = roomT ? roomT.my2 + 1 : -100;\r\n const roomBOuterY = roomB ? roomB.my1 - 1 : -100;\r\n // PrimaryWay を配置する選択肢を作る\r\n const primaryWayYCandidates = [];\r\n const top = secorT.my1 + secorT.py() + OriginToPrimaryWayMargin;\r\n const bottom = secorB.my1 + secorB.py() - OriginToPrimaryWayMargin;\r\n for (let y = top; y <= bottom; y++) {\r\n if (y != roomTOuterY && y != roomBOuterY) {\r\n primaryWayYCandidates.push(y);\r\n }\r\n }\r\n if (primaryWayYCandidates.length <= 0) {\r\n (0, Common_1.assert)(primaryWayYCandidates.length > 0);\r\n }\r\n // PrimaryWay の Y 座標を決める\r\n const primaryWayY = primaryWayYCandidates[this.random.nextIntWithMax(primaryWayYCandidates.length)];\r\n // PrimaryWay の Top, Bottom 座標を決める\r\n const primaryWayL = Math.min(pin1.mx(), pin2.mx());\r\n const primaryWayR = Math.max(pin1.mx(), pin2.mx());\r\n // Plot\r\n for (let x = primaryWayL; x <= primaryWayR; x++) {\r\n const block = this._map.block(x, primaryWayY);\r\n block.setComponent(FMapData_1.FBlockComponent.Passageway);\r\n }\r\n this.plotSecondaryWay(pin1.mx(), primaryWayY, secor1, FMapData_1.FAxis.V);\r\n this.plotSecondaryWay(pin2.mx(), primaryWayY, secor2, FMapData_1.FAxis.V);\r\n break;\r\n }\r\n default:\r\n throw new Error(\"Unreachable.\");\r\n }\r\n }\r\n }\r\n /**\r\n *\r\n * @param startX 始点座標 (PrimaryWai の端)\r\n * @param startY 始点座標 (PrimaryWai の端)\r\n * @param targetSector 終点となる Pivot を持つ Sector\r\n * @param relationship\r\n */\r\n plotSecondaryWay(startX, startY, targetSector, relationship) {\r\n const px = targetSector.mx1 + targetSector.px();\r\n const py = targetSector.my1 + targetSector.py();\r\n switch (relationship) {\r\n case FMapData_1.FAxis.H: { // sector は横並び\r\n // まずは Pin から基準点へ向かうように水平線を引いて、\r\n const l = Math.min(startX, px);\r\n const r = Math.max(startX, px);\r\n for (let x = l; x <= r; x++) {\r\n this._map.block(x, startY).setComponent(FMapData_1.FBlockComponent.Passageway);\r\n }\r\n // その点から基準点へ垂直に線を引く\r\n const t = Math.min(startY, py);\r\n const b = Math.max(startY, py);\r\n for (let y = t; y <= b; y++) {\r\n this._map.block(px, y).setComponent(FMapData_1.FBlockComponent.Passageway);\r\n }\r\n break;\r\n }\r\n case FMapData_1.FAxis.V: { // sector は縦並び\r\n // まずは Pin から基準点へ向かうように垂直線を引いて、\r\n const t = Math.min(startY, py);\r\n const b = Math.max(startY, py);\r\n for (let y = t; y <= b; y++) {\r\n this._map.block(startX, y).setComponent(FMapData_1.FBlockComponent.Passageway);\r\n }\r\n // その点から基準点へ水平に線を引く\r\n const l = Math.min(startX, px);\r\n const r = Math.max(startX, px);\r\n for (let x = l; x <= r; x++) {\r\n this._map.block(x, py).setComponent(FMapData_1.FBlockComponent.Passageway);\r\n }\r\n break;\r\n }\r\n default:\r\n throw new Error(\"Unreachable.\");\r\n }\r\n }\r\n makeBlocks() {\r\n for (const room of this._map.rooms()) {\r\n for (let y = room.my1; y <= room.my2; y++) {\r\n for (let x = room.mx1; x <= room.mx2; x++) {\r\n const block = this._map.block(x, y);\r\n block.setComponent(FMapData_1.FBlockComponent.Room);\r\n block.setRoomId(room.id());\r\n }\r\n }\r\n }\r\n }\r\n}\r\nexports.FGenericRandomMapGenerator = FGenericRandomMapGenerator;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/floorgen/FGenericRandomMapGenerator.ts?"); /***/ }), /***/ "./ts/mr/floorgen/FMapBuilder.ts": /*!***************************************!*\ !*** ./ts/mr/floorgen/FMapBuilder.ts ***! \***************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.FMapBuildPass_ResolveRoomShapes = exports.FMapBuildPass_MakeRoomId = exports.FMapBuilder = void 0;\r\nconst FMapBuildPass_1 = __webpack_require__(/*! ./passes/FMapBuildPass */ \"./ts/mr/floorgen/passes/FMapBuildPass.ts\");\r\nconst FMarkContinuationPass_1 = __webpack_require__(/*! ./passes/FMarkContinuationPass */ \"./ts/mr/floorgen/passes/FMarkContinuationPass.ts\");\r\nconst FEntryPointAndExitPointPass_1 = __webpack_require__(/*! ./passes/FEntryPointAndExitPointPass */ \"./ts/mr/floorgen/passes/FEntryPointAndExitPointPass.ts\");\r\nconst FMakeTileKindPass_1 = __webpack_require__(/*! ./passes/FMakeTileKindPass */ \"./ts/mr/floorgen/passes/FMakeTileKindPass.ts\");\r\nconst FMakeMonsterHousePass_1 = __webpack_require__(/*! ./passes/FMakeMonsterHousePass */ \"./ts/mr/floorgen/passes/FMakeMonsterHousePass.ts\");\r\nconst FMakeItemShopPass_1 = __webpack_require__(/*! ./passes/FMakeItemShopPass */ \"./ts/mr/floorgen/passes/FMakeItemShopPass.ts\");\r\nconst FDecorationPass_1 = __webpack_require__(/*! ./passes/FDecorationPass */ \"./ts/mr/floorgen/passes/FDecorationPass.ts\");\r\nconst FBackgroundWaterPass_1 = __webpack_require__(/*! ./passes/FBackgroundWaterPass */ \"./ts/mr/floorgen/passes/FBackgroundWaterPass.ts\");\r\nclass FMapBuilder {\r\n buildForRandomMap(data) {\r\n const passes = [\r\n new FMapBuildPass_MakeRoomId(),\r\n new FMarkContinuationPass_1.FMarkContinuationPass(),\r\n new FMakeTileKindPass_1.FMakeTileKindPass(),\r\n new FEntryPointAndExitPointPass_1.FEntryPointAndExitPointPass(),\r\n new FMakeMonsterHousePass_1.FMakeMonsterHouseForRandomMapPass(),\r\n new FMakeItemShopPass_1.FMakeItemShopPass(),\r\n new FBackgroundWaterPass_1.FBackgroundWaterPass(),\r\n new FDecorationPass_1.FDecorationPass(),\r\n ];\r\n // Apply passes\r\n passes.forEach(pass => pass.execute(data));\r\n }\r\n buildForFixedMap(data) {\r\n const passes = [\r\n new FMapBuildPass_MakeRoomId(),\r\n new FMapBuildPass_ResolveRoomShapes(),\r\n new FMarkContinuationPass_1.FMarkContinuationPass(),\r\n new FMakeMonsterHousePass_1.FMakeMonsterHouseForFixedMapPass(),\r\n new FMakeItemShopPass_1.FMakeItemShopPass(),\r\n ];\r\n // Apply passes\r\n passes.forEach(pass => pass.execute(data));\r\n }\r\n}\r\nexports.FMapBuilder = FMapBuilder;\r\n// Room としてマークされているが、RoomId 未割り当ての Block を解決する。\r\n// 主に固定マップ用。\r\nclass FMapBuildPass_MakeRoomId extends FMapBuildPass_1.FMapBuildPass {\r\n execute(map) {\r\n while (true) {\r\n // RoomId が割り当てられていないが、Room としてマークされている Block を集める\r\n const roomBlocks = map.innerBlocks.filter(block => block.isRoom() && block.roomId() == 0);\r\n if (roomBlocks.length == 0) {\r\n // 全部解決した。終了。\r\n break;\r\n }\r\n // 新しく部屋情報を作る\r\n const sector = map.newSector();\r\n const room = map.newRoom(sector);\r\n // まずは新しい部屋割り当ててみるようにする\r\n let current = [roomBlocks[0]];\r\n let next = [];\r\n while (current.length > 0) {\r\n current.forEach(b => {\r\n if (b.roomId() == 0) { // 上下左右の集計で、current に同じ Block が入ることがある。無駄な処理を省く。\r\n // ID を振る\r\n b.setRoomId(room.id());\r\n // 左\r\n const b1 = map.blockTry(b.mx - 1, b.my);\r\n if (b1 && b1.isRoom() && b1.roomId() == 0) {\r\n next.push(b1);\r\n }\r\n // 上\r\n const b2 = map.blockTry(b.mx, b.my - 1);\r\n if (b2 && b2.isRoom() && b2.roomId() == 0) {\r\n next.push(b2);\r\n }\r\n // 右\r\n const b3 = map.blockTry(b.mx + 1, b.my);\r\n if (b3 && b3.isRoom() && b3.roomId() == 0) {\r\n next.push(b3);\r\n }\r\n // 下\r\n const b4 = map.blockTry(b.mx, b.my + 1);\r\n if (b4 && b4.isRoom() && b4.roomId() == 0) {\r\n next.push(b4);\r\n }\r\n }\r\n });\r\n // swap\r\n [current, next] = [next, current];\r\n next = [];\r\n }\r\n // roomBlocks[0] から辿れるすべての Block に ID を振り終えた\r\n }\r\n }\r\n}\r\nexports.FMapBuildPass_MakeRoomId = FMapBuildPass_MakeRoomId;\r\n// [固定マップ用]\r\n// roomId が割り当てられている block を元に、Room の矩形を確定する。\r\nclass FMapBuildPass_ResolveRoomShapes extends FMapBuildPass_1.FMapBuildPass {\r\n execute(map) {\r\n for (const block of map.blocks()) {\r\n const room = map.room(block.roomId());\r\n room.tryInfrateRect(block.mx, block.my);\r\n }\r\n }\r\n}\r\nexports.FMapBuildPass_ResolveRoomShapes = FMapBuildPass_ResolveRoomShapes;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/floorgen/FMapBuilder.ts?"); /***/ }), /***/ "./ts/mr/floorgen/FMapData.ts": /*!************************************!*\ !*** ./ts/mr/floorgen/FMapData.ts ***! \************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.FMap = exports.FExitPont = exports.FEntryPont = exports.FRoom = exports.FSectorEdge = exports.FEdgePin = exports.FBlockComponent = exports.FAxis = exports.FDirection = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst LRandom_1 = __webpack_require__(/*! ts/mr/lively/LRandom */ \"./ts/mr/lively/LRandom.ts\");\r\nconst LBlock_1 = __webpack_require__(/*! ts/mr/lively/LBlock */ \"./ts/mr/lively/LBlock.ts\");\r\nconst FSector_1 = __webpack_require__(/*! ./data/FSector */ \"./ts/mr/floorgen/data/FSector.ts\");\r\nconst FMapBlock_1 = __webpack_require__(/*! ./data/FMapBlock */ \"./ts/mr/floorgen/data/FMapBlock.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ../data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nvar FDirection;\r\n(function (FDirection) {\r\n FDirection[FDirection[\"T\"] = 0] = \"T\";\r\n FDirection[FDirection[\"B\"] = 1] = \"B\";\r\n FDirection[FDirection[\"L\"] = 2] = \"L\";\r\n FDirection[FDirection[\"R\"] = 3] = \"R\";\r\n})(FDirection = exports.FDirection || (exports.FDirection = {}));\r\nvar FAxis;\r\n(function (FAxis) {\r\n FAxis[FAxis[\"H\"] = 0] = \"H\";\r\n FAxis[FAxis[\"V\"] = 1] = \"V\";\r\n})(FAxis = exports.FAxis || (exports.FAxis = {}));\r\nvar FBlockComponent;\r\n(function (FBlockComponent) {\r\n FBlockComponent[FBlockComponent[\"None\"] = 0] = \"None\";\r\n FBlockComponent[FBlockComponent[\"Room\"] = 1] = \"Room\";\r\n FBlockComponent[FBlockComponent[\"Passageway\"] = 2] = \"Passageway\";\r\n})(FBlockComponent = exports.FBlockComponent || (exports.FBlockComponent = {}));\r\nclass FEdgePin {\r\n constructor(edge, pos) {\r\n this._edge = edge;\r\n this._pos = pos;\r\n }\r\n edge() {\r\n return this._edge;\r\n }\r\n pos() {\r\n return this._pos;\r\n }\r\n mx() {\r\n const s = this._edge.sector();\r\n const d = this._edge.direction();\r\n if (d == FDirection.L) {\r\n return s.mx1;\r\n }\r\n else if (d == FDirection.R) {\r\n return s.mx2;\r\n }\r\n else {\r\n return s.mx1 + this._pos;\r\n }\r\n }\r\n my() {\r\n const s = this._edge.sector();\r\n const d = this._edge.direction();\r\n if (d == FDirection.T) {\r\n return s.my1;\r\n }\r\n else if (d == FDirection.B) {\r\n return s.my2;\r\n }\r\n else {\r\n return s.my1 + this._pos;\r\n }\r\n }\r\n}\r\nexports.FEdgePin = FEdgePin;\r\nclass FSectorEdge {\r\n constructor(sector, dir) {\r\n this._sector = sector;\r\n this._direction = dir;\r\n this._adjacencies = [];\r\n this._connections = [];\r\n this._pins = [];\r\n }\r\n sector() {\r\n return this._sector;\r\n }\r\n direction() {\r\n return this._direction;\r\n }\r\n resetLength(length) {\r\n this._pins = [];\r\n //for (let i = 0; i < length; i++) {\r\n // this._pins.push(new FEdgePin(this, i));\r\n //}\r\n }\r\n addAdjacency(adjacency) {\r\n this._adjacencies.push(adjacency);\r\n }\r\n hasAdjacency() {\r\n return this._adjacencies.length > 0;\r\n }\r\n adjacencies() {\r\n return this._adjacencies;\r\n }\r\n addConnection(connection) {\r\n this._connections.push(connection);\r\n }\r\n hasConnection() {\r\n return this._connections.length > 0;\r\n }\r\n hasConnectionFully() {\r\n return this._connections.length == this._adjacencies.length;\r\n }\r\n addPin(pos) {\r\n const pin = new FEdgePin(this, pos);\r\n this._pins.push(pin);\r\n }\r\n pins() {\r\n return this._pins;\r\n }\r\n isValidPinPos(pos) {\r\n return this._pins.find(pin => pin.pos() == pos) != undefined;\r\n }\r\n}\r\nexports.FSectorEdge = FSectorEdge;\r\nclass FRoom {\r\n constructor(map, id, sector) {\r\n this._mx1 = -1; // 有効範囲内左上座標 (Map 座標系)\r\n this._my1 = -1; // 有効範囲内左上座標 (Map 座標系)\r\n this._mx2 = -1; // 有効範囲内右下座標 (Map 座標系)\r\n this._my2 = -1; // 有効範囲内右下座標 (Map 座標系)\r\n this._structures = [];\r\n this.poorVisibility = false; // 視界不明瞭?\r\n this._map = map;\r\n this._id = id;\r\n this._sector = sector;\r\n }\r\n id() {\r\n return this._id;\r\n }\r\n sector() {\r\n return this._sector;\r\n }\r\n get mx1() {\r\n return this._mx1;\r\n }\r\n get my1() {\r\n return this._my1;\r\n }\r\n get mx2() {\r\n return this._mx2;\r\n }\r\n get my2() {\r\n return this._my2;\r\n }\r\n get width() {\r\n return this._mx2 - this._mx1 + 1;\r\n }\r\n get height() {\r\n return this._my2 - this._my1 + 1;\r\n }\r\n tryInfrateRect(mx, my) {\r\n if (this._id == 0)\r\n return;\r\n if (this._mx1 < 0) {\r\n this._mx1 = mx;\r\n this._my1 = my;\r\n this._mx2 = mx;\r\n this._my2 = my;\r\n }\r\n else {\r\n this._mx1 = Math.min(this._mx1, mx);\r\n this._my1 = Math.min(this._my1, my);\r\n this._mx2 = Math.max(this._mx2, mx);\r\n this._my2 = Math.max(this._my2, my);\r\n }\r\n }\r\n forEachBlocks(func) {\r\n if (this._id == 0)\r\n return;\r\n for (let y = this._my1; y <= this._my2; y++) {\r\n for (let x = this._mx1; x <= this._mx2; x++) {\r\n func(this._map.block(x, y));\r\n }\r\n }\r\n }\r\n setRect(mx, my, mw, mh) {\r\n this._mx1 = mx;\r\n this._my1 = my;\r\n this._mx2 = mx + mw - 1;\r\n this._my2 = my + mh - 1;\r\n }\r\n blocks() {\r\n const result = [];\r\n for (let my = this._my1; my <= this._my2; my++) {\r\n for (let mx = this._mx1; mx <= this._mx2; mx++) {\r\n result.push(this._map.block(mx, my));\r\n }\r\n }\r\n return result;\r\n }\r\n addStructureRef(value) {\r\n this._structures.push(value);\r\n }\r\n structures() {\r\n return this._structures;\r\n }\r\n}\r\nexports.FRoom = FRoom;\r\nclass FEntryPont {\r\n constructor(mx, my) {\r\n this._mx = mx;\r\n this._my = my;\r\n }\r\n mx() {\r\n return this._mx;\r\n }\r\n my() {\r\n return this._my;\r\n }\r\n}\r\nexports.FEntryPont = FEntryPont;\r\nclass FExitPont {\r\n constructor(mx, my) {\r\n this._mx = mx;\r\n this._my = my;\r\n }\r\n mx() {\r\n return this._mx;\r\n }\r\n my() {\r\n return this._my;\r\n }\r\n}\r\nexports.FExitPont = FExitPont;\r\nclass FMap {\r\n constructor(floorId, randSeed) {\r\n this._floorId = floorId;\r\n this._randSeed = randSeed;\r\n this._rand = new LRandom_1.LRandom(this._randSeed);\r\n this._innerWidth = 0;\r\n this._innerHeight = 0;\r\n this._fullWidth = 0;\r\n this._fullHeight = 0;\r\n this._paddingX = 0;\r\n this._paddingY = 0;\r\n this._blocks = [];\r\n this._innerBlocks = [];\r\n this._sectorAdjacencies = [];\r\n this._sectorConnections = [];\r\n this._sectors = [];\r\n this._rooms = [];\r\n this._structures = [];\r\n const floorData = floorId.floorInfo;\r\n const tempateData = floorData.template ? MRData_1.MRData.templateMaps.find(x => x.name == floorData.template) : undefined;\r\n this._templateId = (tempateData !== null && tempateData !== void 0 ? tempateData : MRData_1.MRData.templateMaps[1]).id;\r\n }\r\n resetFromInnerSize(innerWidth, innerHeight, paddingX, paddingY) {\r\n this.resetFromFullSize(innerWidth + (paddingX * 2), innerHeight + (paddingY * 2), paddingX, paddingY);\r\n }\r\n resetFromFullSize(fullWidth, fullHeight, paddingX, paddingY) {\r\n this._fullWidth = fullWidth;\r\n this._fullHeight = fullHeight;\r\n this._innerWidth = fullWidth - (paddingX * 2);\r\n this._innerHeight = fullHeight - (paddingY * 2);\r\n this._paddingX = paddingX;\r\n this._paddingY = paddingY;\r\n this._blocks = new Array(fullWidth * fullHeight);\r\n this._innerBlocks = []; //new Array(this._innerWidth * this._innerHeight);\r\n for (let i = 0; i < this._blocks.length; i++) {\r\n const mx = Math.trunc(i % this._fullWidth);\r\n const my = Math.trunc(i / this._fullWidth);\r\n const block = new FMapBlock_1.FMapBlock(mx, my);\r\n this._blocks[i] = block;\r\n if (this.ox <= mx && mx < this.ox + this._innerWidth &&\r\n this.oy <= my && my < this.oy + this._innerHeight) {\r\n this._innerBlocks.push(block);\r\n }\r\n else {\r\n block.setTileShape(LBlock_1.LTileShape.Wall);\r\n }\r\n }\r\n this._sectors = [new FSector_1.FSector(this, 0)]; // dummy\r\n this._rooms = [new FRoom(this, 0, this._sectors[0])]; // dummy\r\n }\r\n floorId() {\r\n return this._floorId;\r\n }\r\n random() {\r\n return this._rand;\r\n }\r\n /** Inner の左上 X 座標 */\r\n get ox() {\r\n return this._paddingX;\r\n }\r\n /** Inner の左上 Y 座標 */\r\n get oy() {\r\n return this._paddingY;\r\n }\r\n get fullWidth() {\r\n return this._fullWidth;\r\n }\r\n get fullHeight() {\r\n return this._fullHeight;\r\n }\r\n get innerWidth() {\r\n return this._innerWidth;\r\n }\r\n get innerHeight() {\r\n return this._innerHeight;\r\n }\r\n blocks() {\r\n return this._blocks;\r\n }\r\n get innerBlocks() {\r\n return this._innerBlocks;\r\n }\r\n innerBlock(x, y) {\r\n return this.block(this._paddingX + x, this._paddingY + y);\r\n }\r\n blockTry(x, y) {\r\n if (this.isValid(x, y)) {\r\n return this._blocks[y * this._fullWidth + x];\r\n }\r\n else {\r\n return undefined;\r\n }\r\n }\r\n block(x, y) {\r\n const block = this._blocks[y * this._fullWidth + x];\r\n (0, Common_1.assert)(block);\r\n return block;\r\n }\r\n sectors() {\r\n return this._sectors.filter(s => s.id() > 0);\r\n }\r\n newSector() {\r\n const sector = new FSector_1.FSector(this, this._sectors.length);\r\n this._sectors.push(sector);\r\n return sector;\r\n }\r\n attemptNewAdjacency(s1, s1Dir, s2, s2Dir) {\r\n const edge1 = s1.edge(s1Dir);\r\n const edge2 = s2.edge(s2Dir);\r\n const exists = this._sectorAdjacencies.find(a => a.hasPair(edge1, edge2));\r\n if (exists)\r\n return exists;\r\n const adjacency = new FSector_1.FSectorAdjacency(edge1, edge2);\r\n this._sectorAdjacencies.push(adjacency);\r\n edge1.addAdjacency(adjacency);\r\n edge2.addAdjacency(adjacency);\r\n return adjacency;\r\n }\r\n connectSectors(edge1, edge2) {\r\n (0, Common_1.assert)(edge1 != edge2);\r\n const connection = new FSector_1.FSectorConnection(this._sectorConnections.length, edge1, edge2);\r\n this._sectorConnections.push(connection);\r\n edge1.addConnection(connection);\r\n edge2.addConnection(connection);\r\n return connection;\r\n }\r\n adjacencies() {\r\n return this._sectorAdjacencies;\r\n }\r\n connections() {\r\n return this._sectorConnections;\r\n }\r\n room(roomId) {\r\n return this._rooms[roomId];\r\n }\r\n rooms_raw() {\r\n return this._rooms;\r\n }\r\n rooms() {\r\n return this._rooms.filter(s => s.id() > 0);\r\n }\r\n newRoom(sector) {\r\n const room = new FRoom(this, this._rooms.length, sector);\r\n this._rooms.push(room);\r\n sector.setRoom(room);\r\n return room;\r\n }\r\n structures() {\r\n return this._structures;\r\n }\r\n addStructure(structure) {\r\n this._structures.push(structure);\r\n }\r\n isValid(x, y) {\r\n return 0 <= x && x < this._fullWidth && 0 <= y && y < this._fullHeight;\r\n }\r\n setEntryPont(value) {\r\n this._entryPoint = value;\r\n }\r\n entryPoint() {\r\n return this._entryPoint;\r\n }\r\n setExitPont(value) {\r\n this._exitPont = value;\r\n }\r\n exitPont() {\r\n return this._exitPont;\r\n }\r\n rmmzFixedMapData() {\r\n (0, Common_1.assert)(this._floorId.isFixedMap2);\r\n return $dataMap;\r\n }\r\n get templateId() {\r\n return this._templateId;\r\n }\r\n // For Debug\r\n print() {\r\n let s = \"\";\r\n for (let y = 0; y < this._fullHeight; y++) {\r\n for (let x = 0; x < this._fullWidth; x++) {\r\n if (this._exitPont && this._exitPont.mx() == x && this._exitPont.my() == y) {\r\n s += \"!\";\r\n }\r\n else if (this._sectors.find(s => (s.mx1 + s.px()) == x && (s.my1 + s.py()) == y)) {\r\n s += \"@\";\r\n }\r\n else if (this.block(x, y).isContinuation()) {\r\n s += \"o\";\r\n }\r\n else if (this.block(x, y).isDoorway()) {\r\n s += \"&\";\r\n }\r\n else {\r\n switch (this.block(x, y).component()) {\r\n case FBlockComponent.None:\r\n s += \".\";\r\n break;\r\n case FBlockComponent.Room:\r\n s += \"*\";\r\n break;\r\n case FBlockComponent.Passageway:\r\n s += \"#\";\r\n break;\r\n }\r\n }\r\n }\r\n s += \"\\n\";\r\n }\r\n console.log(s);\r\n console.log(\"Seed:\", this._randSeed);\r\n }\r\n}\r\nexports.FMap = FMap;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/floorgen/FMapData.ts?"); /***/ }), /***/ "./ts/mr/floorgen/FSectorConnectionBuilder.ts": /*!****************************************************!*\ !*** ./ts/mr/floorgen/FSectorConnectionBuilder.ts ***! \****************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.FSectorConnectionBuilder = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst DTerrainPreset_1 = __webpack_require__(/*! ../data/DTerrainPreset */ \"./ts/mr/data/DTerrainPreset.ts\");\r\nconst FMapData_1 = __webpack_require__(/*! ./FMapData */ \"./ts/mr/floorgen/FMapData.ts\");\r\nclass FSectorConnectionBuilder {\r\n static connect(map, rand, shape) {\r\n switch (shape.connectionPreset) {\r\n case DTerrainPreset_1.DSectorConnectionPreset.Default:\r\n this.connectDefault(map, rand);\r\n break;\r\n case DTerrainPreset_1.DSectorConnectionPreset.C:\r\n this.connectC(map, rand, shape);\r\n break;\r\n case DTerrainPreset_1.DSectorConnectionPreset.H:\r\n this.connectH(map, rand, shape);\r\n break;\r\n default:\r\n throw new Error(\"Not implemented.\");\r\n }\r\n }\r\n // Sector ごとに、ランダムでいずれかの Adjacency を選択する。\r\n // 四辺のどれかひとつに向かって腕を伸ばすイメージ。\r\n static connectDefault(map, rand) {\r\n const connectionRaisedSectorIds = []; // Connection を作った Sector (相手側は含まない)\r\n const tracedSectorIds = []; // 一筆書きで通ったところ\r\n const sectorCount = map.sectors().length;\r\n // 接続の偏りを無くすため、最初に開始点 Sector を決めてそこから一筆書きの要領で適当に接続していく\r\n {\r\n // 開始 Sector\r\n let sector = map.sectors()[rand.nextIntWithMax(sectorCount)];\r\n for (let i = 0; i < sectorCount; i++) { // 最大でも Sector 総数までしかループしないので、念のための無限ループ回避\r\n // 接続候補を集める\r\n const candidateAdjacencies = [];\r\n for (const e of sector.edges()) {\r\n for (const a of e.adjacencies()) {\r\n const e2 = a.otherSide(e);\r\n if (!tracedSectorIds.includes(e2.sector().id())) { // 既に通った Sector は除外\r\n candidateAdjacencies.push(a);\r\n }\r\n }\r\n }\r\n // 接続する隣接情報を決定して接続\r\n if (candidateAdjacencies.length > 0) {\r\n const adjacency = candidateAdjacencies[rand.nextIntWithMax(candidateAdjacencies.length)];\r\n map.connectSectors(adjacency.edge1(), adjacency.edge2());\r\n connectionRaisedSectorIds.push(sector.id());\r\n tracedSectorIds.push(sector.id());\r\n sector = adjacency.otherSideBySector(sector).sector();\r\n }\r\n else {\r\n // 候補が無ければ行き止まり\r\n break;\r\n }\r\n }\r\n }\r\n // 次に、一筆書きで通らなかった Sector から通った Sector へ接続していく\r\n {\r\n for (let i = 0; i < sectorCount; i++) { // 最大でも Sector 総数までしかループしないので、念のための無限ループ回避\r\n for (const sector of map.sectors()) {\r\n if (!connectionRaisedSectorIds.includes(sector.id())) {\r\n // 接続候補を集める\r\n const candidateAdjacencies = [];\r\n for (const e of sector.edges()) {\r\n for (const a of e.adjacencies()) {\r\n const e2 = a.otherSide(e);\r\n if (connectionRaisedSectorIds.includes(e2.sector().id())) { // Connection 作成済みのところへ向かって接続したい\r\n candidateAdjacencies.push(a);\r\n }\r\n }\r\n }\r\n // 接続する隣接情報を決定して接続\r\n if (candidateAdjacencies.length > 0) {\r\n const adjacency = candidateAdjacencies[rand.nextIntWithMax(candidateAdjacencies.length)];\r\n map.connectSectors(adjacency.edge1(), adjacency.edge2());\r\n connectionRaisedSectorIds.push(sector.id());\r\n }\r\n }\r\n }\r\n if (connectionRaisedSectorIds.length == sectorCount) {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n static sector(map, shape, x, y) {\r\n const w = shape.divisionCountX;\r\n return map.sectors()[w * y + x];\r\n }\r\n static connectC(map, rand, shape) {\r\n (0, Common_1.assert)(shape.divisionCountX >= 3);\r\n (0, Common_1.assert)(shape.divisionCountY >= 3);\r\n const r = shape.divisionCountX - 1;\r\n const b = shape.divisionCountY - 1;\r\n // 上側1行\r\n for (let x = 0; x < r; x++) {\r\n const s1 = this.sector(map, shape, x, 0);\r\n const s2 = this.sector(map, shape, x + 1, 0);\r\n map.connectSectors(s1.edge(FMapData_1.FDirection.R), s2.edge(FMapData_1.FDirection.L));\r\n }\r\n // 左側1列\r\n for (let y = 0; y < b; y++) {\r\n const s1 = this.sector(map, shape, 0, y);\r\n const s2 = this.sector(map, shape, 0, y + 1);\r\n map.connectSectors(s1.edge(FMapData_1.FDirection.B), s2.edge(FMapData_1.FDirection.T));\r\n }\r\n // 下側1行\r\n for (let x = 0; x < r; x++) {\r\n const s1 = this.sector(map, shape, x, b);\r\n const s2 = this.sector(map, shape, x + 1, b);\r\n map.connectSectors(s1.edge(FMapData_1.FDirection.R), s2.edge(FMapData_1.FDirection.L));\r\n }\r\n }\r\n static connectH(map, rand, shape) {\r\n (0, Common_1.assert)(shape.divisionCountX >= 3);\r\n (0, Common_1.assert)(shape.divisionCountY >= 3);\r\n const r = shape.divisionCountX - 1;\r\n const b = shape.divisionCountY - 1;\r\n const c = Math.floor(shape.divisionCountY / 2);\r\n // 左側1列\r\n for (let y = 0; y < b; y++) {\r\n const s1 = this.sector(map, shape, 0, y);\r\n const s2 = this.sector(map, shape, 0, y + 1);\r\n map.connectSectors(s1.edge(FMapData_1.FDirection.B), s2.edge(FMapData_1.FDirection.T));\r\n }\r\n // 右側1列\r\n for (let y = 0; y < b; y++) {\r\n const s1 = this.sector(map, shape, r, y);\r\n const s2 = this.sector(map, shape, r, y + 1);\r\n map.connectSectors(s1.edge(FMapData_1.FDirection.B), s2.edge(FMapData_1.FDirection.T));\r\n }\r\n // 中央1行\r\n for (let x = 0; x < r; x++) {\r\n const s1 = this.sector(map, shape, x, c);\r\n const s2 = this.sector(map, shape, x + 1, c);\r\n map.connectSectors(s1.edge(FMapData_1.FDirection.R), s2.edge(FMapData_1.FDirection.L));\r\n }\r\n }\r\n}\r\nexports.FSectorConnectionBuilder = FSectorConnectionBuilder;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/floorgen/FSectorConnectionBuilder.ts?"); /***/ }), /***/ "./ts/mr/floorgen/FStructure.ts": /*!**************************************!*\ !*** ./ts/mr/floorgen/FStructure.ts ***! \**************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.FItemShopStructure = exports.FMonsterHouseStructure = exports.FStructure = void 0;\r\nclass FStructure {\r\n}\r\nexports.FStructure = FStructure;\r\nclass FMonsterHouseStructure extends FStructure {\r\n constructor(roomId, monsterHouseId) {\r\n super();\r\n this._roomId = roomId;\r\n this._monsterHouseTypeId = monsterHouseId;\r\n }\r\n roomId() {\r\n return this._roomId;\r\n }\r\n setMonsterHouseTypeId(value) {\r\n this._monsterHouseTypeId = value;\r\n }\r\n monsterHouseTypeId() {\r\n return this._monsterHouseTypeId;\r\n }\r\n}\r\nexports.FMonsterHouseStructure = FMonsterHouseStructure;\r\nclass FItemShopStructure extends FStructure {\r\n constructor(roomId, itemShopTypeId) {\r\n super();\r\n this._roomId = roomId;\r\n this._itemShopTypeId = itemShopTypeId;\r\n }\r\n roomId() {\r\n return this._roomId;\r\n }\r\n setItemShopTypeId(value) {\r\n this._itemShopTypeId = value;\r\n }\r\n itemShopTypeId() {\r\n return this._itemShopTypeId;\r\n }\r\n}\r\nexports.FItemShopStructure = FItemShopStructure;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/floorgen/FStructure.ts?"); /***/ }), /***/ "./ts/mr/floorgen/data/FMapBlock.ts": /*!******************************************!*\ !*** ./ts/mr/floorgen/data/FMapBlock.ts ***! \******************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.FMapBlock = void 0;\r\nconst LBlock_1 = __webpack_require__(/*! ts/mr/lively/LBlock */ \"./ts/mr/lively/LBlock.ts\");\r\nconst FMapData_1 = __webpack_require__(/*! ../FMapData */ \"./ts/mr/floorgen/FMapData.ts\");\r\nclass FMapBlock {\r\n constructor(mx, my) {\r\n this._mx = mx;\r\n this._my = my;\r\n this._tileShape = LBlock_1.LTileShape.Wall;\r\n this._blockComponent = FMapData_1.FBlockComponent.None;\r\n this._sectorId = 0;\r\n this._roomId = 0;\r\n this._doorway = false;\r\n this._continuation = false;\r\n this._shapeVisualPartIndex = 0;\r\n this._decorationVisualPartIndex = 0;\r\n this._fixedMapMonsterHouseTypeId = 0;\r\n this._fixedMapItemShopTypeId = 0;\r\n }\r\n get mx() {\r\n return this._mx;\r\n }\r\n get my() {\r\n return this._my;\r\n }\r\n setTileShape(value) {\r\n this._tileShape = value;\r\n }\r\n tileShape() {\r\n return this._tileShape;\r\n }\r\n setComponent(value) {\r\n this._blockComponent = value;\r\n }\r\n component() {\r\n return this._blockComponent;\r\n }\r\n setFixedMapMonsterHouseTypeId(value) {\r\n this._fixedMapMonsterHouseTypeId = value;\r\n }\r\n fixedMapMonsterHouseTypeId() {\r\n return this._fixedMapMonsterHouseTypeId;\r\n }\r\n setFixedMapItemShopTypeId(value) {\r\n this._fixedMapItemShopTypeId = value;\r\n }\r\n fixedMapItemShopTypeId() {\r\n return this._fixedMapItemShopTypeId;\r\n }\r\n setSectorId(value) {\r\n this._sectorId = value;\r\n }\r\n sectorId() {\r\n return this._sectorId;\r\n }\r\n setRoomId(value) {\r\n this._roomId = value;\r\n }\r\n // TODO: 水路かつ部屋、水路かつ通路、みたいなこともあるので分ける必要がある\r\n isRoom() {\r\n return this._blockComponent == FMapData_1.FBlockComponent.Room;\r\n }\r\n /**\r\n * 本質的なものとして通行可能であるか。\r\n * 例えば隠し通路 (通常攻撃で通路が姿を現す) の場合、tileKind は Wall であるが、Component は Passageway となる。\r\n */\r\n isPassagableComponent() {\r\n return this._blockComponent == FMapData_1.FBlockComponent.Room || this._blockComponent == FMapData_1.FBlockComponent.Passageway;\r\n }\r\n roomId() {\r\n return this._roomId;\r\n }\r\n setDoorway(value) {\r\n this._doorway = value;\r\n }\r\n isDoorway() {\r\n return this._doorway;\r\n }\r\n setContinuation(value) {\r\n this._continuation = value;\r\n }\r\n isContinuation() {\r\n return this._continuation;\r\n }\r\n get shapeVisualPartIndex() {\r\n return this._shapeVisualPartIndex;\r\n }\r\n setShapeVisualPartIndex(value) {\r\n this._shapeVisualPartIndex = value;\r\n }\r\n get decorationVisualPartIndex() {\r\n return this._decorationVisualPartIndex;\r\n }\r\n setDecorationVisualPartIndex(value) {\r\n this._decorationVisualPartIndex = value;\r\n }\r\n}\r\nexports.FMapBlock = FMapBlock;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/floorgen/data/FMapBlock.ts?"); /***/ }), /***/ "./ts/mr/floorgen/data/FSector.ts": /*!****************************************!*\ !*** ./ts/mr/floorgen/data/FSector.ts ***! \****************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.FSectorConnection = exports.FSectorAdjacency = exports.FSector = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst FMapData_1 = __webpack_require__(/*! ../FMapData */ \"./ts/mr/floorgen/FMapData.ts\");\r\n// 区画情報。今のところ、ランダムマップ生成時の一時情報。\r\nclass FSector {\r\n //private _wayPointsX: number[]; // x1~x2 間で、通路を作ってもよい X 座標\r\n //private _wayPointsY: number[]; // y1~y2 間で、通路を作ってもよい Y 座標\r\n constructor(map, id) {\r\n this._mx1 = -1; // 有効範囲内左上座標 (Map 座標系)\r\n this._my1 = -1; // 有効範囲内左上座標 (Map 座標系)\r\n this._mx2 = -1; // 有効範囲内右下座標 (Map 座標系)\r\n this._my2 = -1; // 有効範囲内右下座標 (Map 座標系)\r\n this._px = 0; // Pivot. x1 からの相対座標 (Room 座標系)\r\n this._py = 0; // Pivot. y1 からの相対座標 (Room 座標系)\r\n this._map = map;\r\n this._id = id;\r\n this._edges = [\r\n new FMapData_1.FSectorEdge(this, FMapData_1.FDirection.T),\r\n new FMapData_1.FSectorEdge(this, FMapData_1.FDirection.B),\r\n new FMapData_1.FSectorEdge(this, FMapData_1.FDirection.L),\r\n new FMapData_1.FSectorEdge(this, FMapData_1.FDirection.R),\r\n ];\r\n this._roomShapeType = \"\";\r\n this._structureType = \"\";\r\n //this._wayPointsX = [];\r\n //this._wayPointsY = [];\r\n }\r\n setRect(mx, my, mw, mh) {\r\n this._mx1 = mx;\r\n this._my1 = my;\r\n this._mx2 = mx + mw - 1;\r\n this._my2 = my + mh - 1;\r\n // Link block and ection\r\n for (let y = this._my1; y <= this._my2; y++) {\r\n for (let x = this._mx1; x <= this._mx2; x++) {\r\n this._map.block(x, y).setSectorId(this._id);\r\n }\r\n }\r\n // Update Edge length\r\n this._edges[FMapData_1.FDirection.T].resetLength(this.width());\r\n this._edges[FMapData_1.FDirection.B].resetLength(this.width());\r\n this._edges[FMapData_1.FDirection.L].resetLength(this.height());\r\n this._edges[FMapData_1.FDirection.R].resetLength(this.height());\r\n }\r\n /** ID. (0 is Dummy) */\r\n id() {\r\n return this._id;\r\n }\r\n /** 有効範囲内左上座標 (Map 座標系) */\r\n get mx1() {\r\n return this._mx1;\r\n }\r\n /** 有効範囲内左上座標 (Map 座標系) */\r\n get my1() {\r\n return this._my1;\r\n }\r\n /** 有効範囲内右下座標 (Map 座標系) */\r\n get mx2() {\r\n return this._mx2;\r\n }\r\n /** 有効範囲内右下座標 (Map 座標系) */\r\n get my2() {\r\n return this._my2;\r\n }\r\n px() {\r\n return this._px;\r\n }\r\n py() {\r\n return this._py;\r\n }\r\n get pivotMX() {\r\n return this._mx1 + this._px;\r\n }\r\n get pivotMY() {\r\n return this._my1 + this._py;\r\n }\r\n width() {\r\n return this._mx2 - this._mx1 + 1;\r\n }\r\n height() {\r\n return this._my2 - this._my1 + 1;\r\n }\r\n setPivot(px, py) {\r\n this._px = px;\r\n this._py = py;\r\n }\r\n edge(d) {\r\n return this._edges[d];\r\n }\r\n edges() {\r\n return this._edges;\r\n }\r\n get roomShapeType() {\r\n return this._roomShapeType;\r\n }\r\n set roomShapeType(value) {\r\n this._roomShapeType = value;\r\n }\r\n get structureType() {\r\n return this._structureType;\r\n }\r\n set structureType(value) {\r\n this._structureType = value;\r\n }\r\n room() {\r\n return this._room;\r\n }\r\n setRoom(room) {\r\n this._room = room;\r\n }\r\n // 指定された mx 座標が、この Sector に含まれる Room の左端のひとつ左、または、右端のひとつ右 (つまり床に隣接した壁) であるか\r\n isRoomBesideX(mx) {\r\n if (this._room) {\r\n return (this._room.mx1 - 1 == mx) || (this._room.mx2 + 1 == mx);\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n // 指定された my 座標が、この Sector に含まれる Room の上端のひとつ上、または、下端のひとつ下 (つまり床に隣接した壁) であるか\r\n isRoomBesideY(my) {\r\n if (this._room) {\r\n return (this._room.my1 - 1 == my) || (this._room.my2 + 1 == my);\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n //public setWeyPoints(x: number[], y: number[]) {\r\n // this._wayPointsX = x;\r\n // this._wayPointsY = y;\r\n //}\r\n GlobalToLocalX(gx) {\r\n return gx - this.mx1;\r\n }\r\n GlobalToLocalY(gy) {\r\n return gy - this.my1;\r\n }\r\n contains(mx, my) {\r\n return this._mx1 <= mx && mx < this._mx2 && this._my1 <= my && my < this._my2;\r\n }\r\n hasAnyConnection() {\r\n return this._edges.some(e => e.hasConnection());\r\n }\r\n // 部屋を作れる範囲 (Sector内のローカル座標)\r\n getRoomCandidateRelativeRect() {\r\n let l = 0;\r\n let t = 0;\r\n let r = this.width() - 1;\r\n let b = this.height() - 1;\r\n // 他の区画と接続されている方向は、Block 1 つ分のマージンが必要\r\n if (this.edge(FMapData_1.FDirection.L).hasConnection())\r\n l += 1;\r\n if (this.edge(FMapData_1.FDirection.R).hasConnection())\r\n r -= 2; // 右側は 2 ブロック、右 Sector と併せて、部屋間には最低 3 ブロック設けたい\r\n if (this.edge(FMapData_1.FDirection.T).hasConnection())\r\n t += 1;\r\n if (this.edge(FMapData_1.FDirection.B).hasConnection())\r\n b -= 2; // 下側は 2 ブロック、下 Sector と併せて、部屋間には最低 3 ブロック設けたい\r\n return [l, t, r, b];\r\n }\r\n}\r\nexports.FSector = FSector;\r\n// Sector の隣接性情報\r\nclass FSectorAdjacency {\r\n constructor(edge1, edge2) {\r\n this._edge1 = edge1;\r\n this._edge2 = edge2;\r\n }\r\n edge1() {\r\n return this._edge1;\r\n }\r\n edge2() {\r\n return this._edge2;\r\n }\r\n hasPair(e1, e2) {\r\n return (e1 == this._edge1 && e2 == this._edge2) || (e2 == this._edge1 && e1 == this._edge2);\r\n }\r\n otherSide(edge) {\r\n if (edge == this._edge1)\r\n return this._edge2;\r\n if (edge == this._edge2)\r\n return this._edge1;\r\n throw new Error();\r\n }\r\n otherSideBySector(sector) {\r\n if (sector == this._edge1.sector())\r\n return this._edge2;\r\n if (sector == this._edge2.sector())\r\n return this._edge1;\r\n throw new Error();\r\n }\r\n}\r\nexports.FSectorAdjacency = FSectorAdjacency;\r\nclass FSectorConnection {\r\n constructor(id, edge1, edge2) {\r\n this._id = id;\r\n this._edge1 = edge1;\r\n this._edge2 = edge2;\r\n }\r\n id() {\r\n return this._id;\r\n }\r\n edge1() {\r\n return this._edge1;\r\n }\r\n edge2() {\r\n return this._edge2;\r\n }\r\n pin1() {\r\n return this._pin1;\r\n }\r\n pin2() {\r\n return this._pin2;\r\n }\r\n alignedAxis() {\r\n return (this._edge1.direction() == FMapData_1.FDirection.L || this._edge1.direction() == FMapData_1.FDirection.R) ? FMapData_1.FAxis.H : FMapData_1.FAxis.V;\r\n }\r\n setConnectedPins(pin1, pin2) {\r\n (0, Common_1.assert)(this._edge1.pins().find(pin => pin == pin1)); // edge に含まれている pin であること\r\n (0, Common_1.assert)(this._edge2.pins().find(pin => pin == pin2)); // edge に含まれている pin であること\r\n this._pin1 = pin1;\r\n this._pin2 = pin2;\r\n }\r\n}\r\nexports.FSectorConnection = FSectorConnection;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/floorgen/data/FSector.ts?"); /***/ }), /***/ "./ts/mr/floorgen/passes/FBackgroundWaterPass.ts": /*!*******************************************************!*\ !*** ./ts/mr/floorgen/passes/FBackgroundWaterPass.ts ***! \*******************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.FBackgroundWaterPass = void 0;\r\nconst FMapBuildPass_1 = __webpack_require__(/*! ./FMapBuildPass */ \"./ts/mr/floorgen/passes/FMapBuildPass.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst DTemplateMap_1 = __webpack_require__(/*! ts/mr/data/DTemplateMap */ \"./ts/mr/data/DTemplateMap.ts\");\r\nconst LBlock_1 = __webpack_require__(/*! ts/mr/lively/LBlock */ \"./ts/mr/lively/LBlock.ts\");\r\n/**\r\n */\r\nclass FBackgroundWaterPass extends FMapBuildPass_1.FMapBuildPass {\r\n execute(map) {\r\n const template = MRData_1.MRData.templateMaps[map.templateId];\r\n if (false) {}\r\n }\r\n}\r\nexports.FBackgroundWaterPass = FBackgroundWaterPass;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/floorgen/passes/FBackgroundWaterPass.ts?"); /***/ }), /***/ "./ts/mr/floorgen/passes/FDecorationPass.ts": /*!**************************************************!*\ !*** ./ts/mr/floorgen/passes/FDecorationPass.ts ***! \**************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.FDecorationPass = void 0;\r\nconst FMapBuildPass_1 = __webpack_require__(/*! ./FMapBuildPass */ \"./ts/mr/floorgen/passes/FMapBuildPass.ts\");\r\nconst FMapData_1 = __webpack_require__(/*! ../FMapData */ \"./ts/mr/floorgen/FMapData.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst Noise_1 = __webpack_require__(/*! ts/mr/math/Noise */ \"./ts/mr/math/Noise.ts\");\r\nconst DTemplateMap_1 = __webpack_require__(/*! ts/mr/data/DTemplateMap */ \"./ts/mr/data/DTemplateMap.ts\");\r\n/**\r\n * ランダムマップの装飾\r\n */\r\nclass FDecorationPass extends FMapBuildPass_1.FMapBuildPass {\r\n execute(map) {\r\n /*\r\n const noise = new PerlinNoise(map.random().nextInt());\r\n\r\n for (let y = 0; y < map.fullHeight; y++) {\r\n for (let x = 0; x < map.fullWidth; x++) {\r\n const v = noise.noise2D(x / map.fullWidth, y / map.fullHeight);\r\n console.log(\"v\", v);\r\n }\r\n }\r\n */\r\n const template = MRData_1.MRData.templateMaps[map.templateId];\r\n this.makeFloorDecoration(map, template);\r\n this.makeWallDecoration(map, template);\r\n }\r\n makeFloorDecoration(map, template) {\r\n //const noise = new PerlinNoise(map.random().nextInt());\r\n //const noise = new SimplexNoise(map.random().nextInt());\r\n const freq = 0.1;\r\n //const basemag = 160.0; // だいたい 0~100 で出力できるようにする\r\n const basemag = 100.0;\r\n const thr = 50;\r\n const parts = template.partIndex[DTemplateMap_1.DBlockVisualPartType.FloorDecoration].map(x => template.parts[x]);\r\n const noises = parts.map(x => new Noise_1.SimplexNoise(map.random().nextInt()));\r\n for (const block of map.blocks()) {\r\n if (block.component() == FMapData_1.FBlockComponent.Room) {\r\n for (const [i, part] of parts.entries()) {\r\n let v = Math.abs(noises[i].noise2D((block.mx) * freq, (block.my) * freq));\r\n v = Math.floor(v * basemag);\r\n if (v > thr) {\r\n block.setDecorationVisualPartIndex(part.index);\r\n }\r\n }\r\n }\r\n }\r\n // for (let y = 0; y < map.fullHeight; y++) {\r\n // for (let x = 0; x < map.fullWidth; x++) {\r\n // map.block(x, y).templatePartIndex = 1;\r\n // }\r\n // }\r\n }\r\n makeWallDecoration(map, template) {\r\n //const noise = new PerlinNoise(map.random().nextInt());\r\n //const noise = new SimplexNoise(map.random().nextInt());\r\n const freq = 0.1;\r\n //const basemag = 160.0; // だいたい 0~100 で出力できるようにする\r\n const basemag = 100.0;\r\n const thr = 50;\r\n const parts = template.partIndex[DTemplateMap_1.DBlockVisualPartType.WallDecoration].map(x => template.parts[x]);\r\n //console.log(\"wall\", parts);\r\n const noises = parts.map(x => new Noise_1.SimplexNoise(map.random().nextInt()));\r\n for (const block of map.blocks()) {\r\n if (block.component() == FMapData_1.FBlockComponent.None && this.isAroundWalls(map, block)) {\r\n for (const [i, part] of parts.entries()) {\r\n let v = Math.abs(noises[i].noise2D((block.mx) * freq, (block.my) * freq));\r\n v = Math.floor(v * basemag);\r\n if (v > thr) {\r\n block.setDecorationVisualPartIndex(part.index);\r\n }\r\n }\r\n }\r\n }\r\n // for (let y = 0; y < map.fullHeight; y++) {\r\n // for (let x = 0; x < map.fullWidth; x++) {\r\n // map.block(x, y).templatePartIndex = 1;\r\n // }\r\n // }\r\n }\r\n isAroundWalls(map, block) {\r\n let b;\r\n b = map.blockTry(block.mx - 1, block.my - 1);\r\n if (b && b.component() != FMapData_1.FBlockComponent.None)\r\n return false;\r\n b = map.blockTry(block.mx, block.my - 1);\r\n if (b && b.component() != FMapData_1.FBlockComponent.None)\r\n return false;\r\n b = map.blockTry(block.mx + 1, block.my - 1);\r\n if (b && b.component() != FMapData_1.FBlockComponent.None)\r\n return false;\r\n b = map.blockTry(block.mx - 1, block.my);\r\n if (b && b.component() != FMapData_1.FBlockComponent.None)\r\n return false;\r\n b = map.blockTry(block.mx + 1, block.my);\r\n if (b && b.component() != FMapData_1.FBlockComponent.None)\r\n return false;\r\n b = map.blockTry(block.mx - 1, block.my + 1);\r\n if (b && b.component() != FMapData_1.FBlockComponent.None)\r\n return false;\r\n b = map.blockTry(block.mx, block.my + 1);\r\n if (b && b.component() != FMapData_1.FBlockComponent.None)\r\n return false;\r\n b = map.blockTry(block.mx + 1, block.my + 1);\r\n if (b && b.component() != FMapData_1.FBlockComponent.None)\r\n return false;\r\n return true;\r\n }\r\n}\r\nexports.FDecorationPass = FDecorationPass;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/floorgen/passes/FDecorationPass.ts?"); /***/ }), /***/ "./ts/mr/floorgen/passes/FEntryPointAndExitPointPass.ts": /*!**************************************************************!*\ !*** ./ts/mr/floorgen/passes/FEntryPointAndExitPointPass.ts ***! \**************************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.FEntryPointAndExitPointPass = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst FMapBuildPass_1 = __webpack_require__(/*! ./FMapBuildPass */ \"./ts/mr/floorgen/passes/FMapBuildPass.ts\");\r\nconst FMapData_1 = __webpack_require__(/*! ../FMapData */ \"./ts/mr/floorgen/FMapData.ts\");\r\n/**\r\n */\r\nclass FEntryPointAndExitPointPass extends FMapBuildPass_1.FMapBuildPass {\r\n execute(map) {\r\n const hasExitPoint = (map.exitPont() != undefined);\r\n (0, Common_1.assert)(!hasExitPoint);\r\n // ExitPoint\r\n {\r\n const candidates = map.innerBlocks.filter(b => b.isRoom() && b.isContinuation());\r\n (0, Common_1.assert)(candidates.length > 0);\r\n const block = candidates[map.random().nextIntWithMax(candidates.length)];\r\n map.setExitPont(new FMapData_1.FExitPont(block.mx, block.my));\r\n }\r\n }\r\n}\r\nexports.FEntryPointAndExitPointPass = FEntryPointAndExitPointPass;\r\n/*\r\nNOTE: 埋蔵金部屋を作る場合\r\n- 通路を引く前に、部屋の接続情報をいじって独立させる必要がある。\r\n - 後から通路を埋めるより、こちらの方が自然。特に、水路を経て独立させる場合、通通路を埋めるときに壁を使うか水路を使うか判断しなければならなくなる。\r\n- 地形生成後、アイテムを配置する。\r\n\r\nNOTE: 部屋を横断する水路を作る場合\r\n- 水路は水路レイヤーにひく。\r\n- 通路を引いた後、水路を引こうとする部屋の一方の入口から、他方の入口へ到達するルートがあるか確認して引く。\r\n- 横断水路を引くかどうかはオプションにしたい。\r\n\r\nNOTE: 二択屋を作る場合\r\n-\r\n*/ \r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/floorgen/passes/FEntryPointAndExitPointPass.ts?"); /***/ }), /***/ "./ts/mr/floorgen/passes/FMakeItemShopPass.ts": /*!****************************************************!*\ !*** ./ts/mr/floorgen/passes/FMakeItemShopPass.ts ***! \****************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.FMakeItemShopPass = void 0;\r\nconst FStructure_1 = __webpack_require__(/*! ../FStructure */ \"./ts/mr/floorgen/FStructure.ts\");\r\nconst FMapBuildPass_1 = __webpack_require__(/*! ./FMapBuildPass */ \"./ts/mr/floorgen/passes/FMapBuildPass.ts\");\r\n// Room の形状や、固定マップから設定された Block 情報などをもとに店となる Room をマークする。\r\nclass FMakeItemShopPass extends FMapBuildPass_1.FMapBuildPass {\r\n execute(map) {\r\n // Room 内の Block に固定マップから指定された MonsterHouse フラグが設定されている場合、\r\n // その Room をもとにして MonsterHouse を作る。\r\n for (const room of map.rooms()) {\r\n room.forEachBlocks((block) => {\r\n const shopId = block.fixedMapItemShopTypeId();\r\n if (shopId > 0) {\r\n const structure = map.structures().find(s => s instanceof FStructure_1.FItemShopStructure && s.itemShopTypeId() == shopId);\r\n if (structure) {\r\n // この部屋はマーク済み\r\n }\r\n else {\r\n const s = new FStructure_1.FItemShopStructure(room.id(), shopId);\r\n map.addStructure(s);\r\n room.addStructureRef(s);\r\n }\r\n }\r\n });\r\n }\r\n // TODO: ランダム生成\r\n }\r\n}\r\nexports.FMakeItemShopPass = FMakeItemShopPass;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/floorgen/passes/FMakeItemShopPass.ts?"); /***/ }), /***/ "./ts/mr/floorgen/passes/FMakeMonsterHousePass.ts": /*!********************************************************!*\ !*** ./ts/mr/floorgen/passes/FMakeMonsterHousePass.ts ***! \********************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.FMakeMonsterHouseForRandomMapPass = exports.FMakeMonsterHouseForFixedMapPass = void 0;\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst UEffect_1 = __webpack_require__(/*! ts/mr/utility/UEffect */ \"./ts/mr/utility/UEffect.ts\");\r\nconst FStructure_1 = __webpack_require__(/*! ../FStructure */ \"./ts/mr/floorgen/FStructure.ts\");\r\nconst FMapBuildPass_1 = __webpack_require__(/*! ./FMapBuildPass */ \"./ts/mr/floorgen/passes/FMapBuildPass.ts\");\r\n// Room の形状や、固定マップから設定された Block 情報などをもとにモンスターハウスとなる Room をマークする。\r\n/**\r\n * @deprecated\r\n */\r\nclass FMakeMonsterHouseForFixedMapPass extends FMapBuildPass_1.FMapBuildPass {\r\n execute(map) {\r\n // Room 内の Block に固定マップから指定された MonsterHouse フラグが設定されている場合、\r\n // その Room をもとにして MonsterHouse を作る。\r\n for (const room of map.rooms()) {\r\n room.forEachBlocks((block) => {\r\n const mh = block.fixedMapMonsterHouseTypeId();\r\n if (mh > 0) {\r\n const structure = map.structures().find(s => s instanceof FStructure_1.FMonsterHouseStructure && s.monsterHouseTypeId() == mh);\r\n if (structure) {\r\n // この部屋は MonsterHouse としてマーク済み\r\n }\r\n else {\r\n const s = new FStructure_1.FMonsterHouseStructure(room.id(), mh);\r\n map.addStructure(s);\r\n room.addStructureRef(s);\r\n }\r\n }\r\n });\r\n }\r\n // モンスターハウスが1つもなければランダム生成を試す。\r\n // if (!map.structures().find(x => x instanceof FMonsterHouseStructure)) {\r\n // const monsterHouse = map.floorId().floorInfo().monsterHouse;\r\n // // そもそも出現させるかを判定する\r\n // if (map.random().nextIntWithMax(100) < monsterHouse.rating) {\r\n // const pattern = this.selectPattern(monsterHouse.patterns, map.random());\r\n // if (pattern) {\r\n // const candidates = map.rooms().filter(x => x.structures().length == 0);\r\n // const room = map.random().selectOrUndefined(candidates);\r\n // if (room) {\r\n // const data = REData.monsterHouses.find(x => x.name == pattern.name);\r\n // if (!data) throw new Error(`MonsterHouses \"${pattern.name}\" は存在しません。`);\r\n // const s = new FMonsterHouseStructure(room.id(), data.id);\r\n // map.addStructure(s);\r\n // room.addStructureRef(s);\r\n // }\r\n // }\r\n // }\r\n // }\r\n }\r\n selectPattern(patterns, rand) {\r\n const sum = patterns.reduce((r, a) => r + a.rating, 0);\r\n if (sum > 0) {\r\n let value = rand.nextIntWithMax(sum);\r\n for (const p of patterns) {\r\n value -= p.rating;\r\n if (value < 0) {\r\n return p;\r\n }\r\n }\r\n }\r\n else {\r\n return undefined;\r\n }\r\n }\r\n}\r\nexports.FMakeMonsterHouseForFixedMapPass = FMakeMonsterHouseForFixedMapPass;\r\nclass FMakeMonsterHouseForRandomMapPass extends FMapBuildPass_1.FMapBuildPass {\r\n execute(map) {\r\n for (const sector of map.sectors()) {\r\n if (sector.structureType == \"MonsterHouse\") {\r\n const floorPreset = map.floorId().preset;\r\n const pattern = UEffect_1.UEffect.selectRating(map.random(), floorPreset.monsterHouses, x => x.rating);\r\n if (pattern) {\r\n const candidates = map.rooms().filter(x => x.structures().length == 0);\r\n const room = map.random().selectOrUndefined(candidates);\r\n if (room) {\r\n const data = MRData_1.MRData.getMonsterHouse(pattern.name);\r\n const s = new FStructure_1.FMonsterHouseStructure(room.id(), data.id);\r\n map.addStructure(s);\r\n room.addStructureRef(s);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}\r\nexports.FMakeMonsterHouseForRandomMapPass = FMakeMonsterHouseForRandomMapPass;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/floorgen/passes/FMakeMonsterHousePass.ts?"); /***/ }), /***/ "./ts/mr/floorgen/passes/FMakeTileKindPass.ts": /*!****************************************************!*\ !*** ./ts/mr/floorgen/passes/FMakeTileKindPass.ts ***! \****************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.FMakeTileKindPass = void 0;\r\nconst LBlock_1 = __webpack_require__(/*! ts/mr/lively/LBlock */ \"./ts/mr/lively/LBlock.ts\");\r\nconst FMapBuildPass_1 = __webpack_require__(/*! ./FMapBuildPass */ \"./ts/mr/floorgen/passes/FMapBuildPass.ts\");\r\n/**\r\n */\r\nclass FMakeTileKindPass extends FMapBuildPass_1.FMapBuildPass {\r\n execute(map) {\r\n // TODO: 適当状態\r\n for (const block of map.innerBlocks) {\r\n if (block.isPassagableComponent()) {\r\n block.setTileShape(LBlock_1.LTileShape.Floor);\r\n }\r\n else {\r\n block.setTileShape(LBlock_1.LTileShape.Wall);\r\n }\r\n }\r\n }\r\n}\r\nexports.FMakeTileKindPass = FMakeTileKindPass;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/floorgen/passes/FMakeTileKindPass.ts?"); /***/ }), /***/ "./ts/mr/floorgen/passes/FMapBuildPass.ts": /*!************************************************!*\ !*** ./ts/mr/floorgen/passes/FMapBuildPass.ts ***! \************************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.FMapBuildPass = void 0;\r\nclass FMapBuildPass {\r\n}\r\nexports.FMapBuildPass = FMapBuildPass;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/floorgen/passes/FMapBuildPass.ts?"); /***/ }), /***/ "./ts/mr/floorgen/passes/FMarkContinuationPass.ts": /*!********************************************************!*\ !*** ./ts/mr/floorgen/passes/FMarkContinuationPass.ts ***! \********************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.FMarkContinuationPass = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst FMapBuildPass_1 = __webpack_require__(/*! ./FMapBuildPass */ \"./ts/mr/floorgen/passes/FMapBuildPass.ts\");\r\nconst FMapData_1 = __webpack_require__(/*! ../FMapData */ \"./ts/mr/floorgen/FMapData.ts\");\r\nconst DHelper_1 = __webpack_require__(/*! ts/mr/data/DHelper */ \"./ts/mr/data/DHelper.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst DAnnotationReader_1 = __webpack_require__(/*! ts/mr/data/importers/DAnnotationReader */ \"./ts/mr/data/importers/DAnnotationReader.ts\");\r\nconst DEntityCategory_1 = __webpack_require__(/*! ts/mr/data/DEntityCategory */ \"./ts/mr/data/DEntityCategory.ts\");\r\n/**\r\n * [ランダムマップ・固定マップ用]\r\n * - 出口の位置を決め、そこからたどることができる Block にマークを付けていく。\r\n * - AI用の通路目的 Block を決める。 http://shiren2424.blog.fc2.com/blog-entry-119.html\r\n *\r\n * プレイヤーの初期位置などはこのマークのある Block から選択することになる。\r\n *\r\n * 侵入不可能な地形が確定した後に実行するのが望ましい。\r\n */\r\nclass FMarkContinuationPass extends FMapBuildPass_1.FMapBuildPass {\r\n execute(map) {\r\n // すべての部屋の入口 Block をマークする\r\n for (const room of map.rooms()) {\r\n if (room) {\r\n for (let mx = room.mx1; mx <= room.mx2; mx++) {\r\n // 上端\r\n if (map.isValid(mx, room.my1 - 1) && map.block(mx, room.my1 - 1).component() == FMapData_1.FBlockComponent.Passageway) {\r\n map.block(mx, room.my1).setDoorway(true);\r\n }\r\n // 下端\r\n if (map.isValid(mx, room.my2 + 1) && map.block(mx, room.my2 + 1).component() == FMapData_1.FBlockComponent.Passageway) {\r\n map.block(mx, room.my2).setDoorway(true);\r\n }\r\n }\r\n for (let my = room.my1; my <= room.my2; my++) {\r\n // 左端\r\n if (map.isValid(room.mx1 - 1, my) && map.block(room.mx1 - 1, my).component() == FMapData_1.FBlockComponent.Passageway) {\r\n map.block(room.mx1, my).setDoorway(true);\r\n }\r\n // 右端\r\n if (map.isValid(room.mx2 + 1, my) && map.block(room.mx2 + 1, my).component() == FMapData_1.FBlockComponent.Passageway) {\r\n map.block(room.mx2, my).setDoorway(true);\r\n }\r\n }\r\n }\r\n }\r\n {\r\n // 最初に見つかった床 Block を開始点とする\r\n const baseBlock = this.selectSeekStartBlock(map); //room.blocks().find(b => b.component() == FBlockComponent.Room);\r\n (0, Common_1.assert)(baseBlock);\r\n let current = [baseBlock];\r\n let next = [];\r\n while (current.length > 0) {\r\n current.forEach(b => {\r\n if (!b.isContinuation()) { // 上下左右の集計で、current に同じ Block が入ることがある。無駄な処理を省く。\r\n // ID を振る\r\n b.setContinuation(true);\r\n // 左\r\n const b1 = map.blockTry(b.mx - 1, b.my);\r\n if (b1 && b1.isPassagableComponent() && !b1.isContinuation()) {\r\n next.push(b1);\r\n }\r\n // 上\r\n const b2 = map.blockTry(b.mx, b.my - 1);\r\n if (b2 && b2.isPassagableComponent() && !b2.isContinuation()) {\r\n next.push(b2);\r\n }\r\n // 右\r\n const b3 = map.blockTry(b.mx + 1, b.my);\r\n if (b3 && b3.isPassagableComponent() && !b3.isContinuation()) {\r\n next.push(b3);\r\n }\r\n // 下\r\n const b4 = map.blockTry(b.mx, b.my + 1);\r\n if (b4 && b4.isPassagableComponent() && !b4.isContinuation()) {\r\n next.push(b4);\r\n }\r\n }\r\n });\r\n // swap\r\n [current, next] = [next, current];\r\n next = [];\r\n }\r\n // roomBlocks[0] から辿れるすべての Block に ID を振り終えた\r\n }\r\n }\r\n selectSeekStartBlock(map) {\r\n if (map.floorId().isRandomMap2) {\r\n // ランダムマップの場合は接続情報なども考慮し、\r\n // 埋蔵金部屋など独立した部屋を優先しないようにする\r\n const sectors = map.sectors();\r\n (0, Common_1.assert)(sectors.length > 0);\r\n const connectedSectors = sectors.filter(s => s.edges().find(e => e.hasConnection()) && s.room());\r\n let sector;\r\n if (connectedSectors.length > 0) {\r\n // 別の Sector を接続された Sector があれば、それらを優先する。\r\n sector = connectedSectors[map.random().nextIntWithMax(connectedSectors.length)];\r\n }\r\n else {\r\n // 大部屋マップなど、接続が無いもの。\r\n sector = sectors[map.random().nextIntWithMax(sectors.length)];\r\n }\r\n // フロア開始位置が通路というケースはないはずなので、この時点では何らかの room 必須とする\r\n const room = sector.room();\r\n (0, Common_1.assert)(room);\r\n const block = room.blocks().find(b => b.component() == FMapData_1.FBlockComponent.Room);\r\n (0, Common_1.assert)(block);\r\n return block;\r\n }\r\n else {\r\n // 固定マップの場合、EntryPoint を基準とする\r\n const entryPointEvent = map.rmmzFixedMapData().events.find(e => {\r\n if (!e)\r\n return false;\r\n const metadata = DAnnotationReader_1.DAnnotationReader.readSpawnerAnnotationFromPage(e.pages[0]);\r\n if (!metadata)\r\n return false;\r\n const entity = MRData_1.MRData.findEntity(metadata.entity);\r\n if (!entity)\r\n return false;\r\n return DEntityCategory_1.DEntityCategory.isEntryPoint(entity);\r\n });\r\n if (entryPointEvent) {\r\n // FIXME: ここでついでにやっちゃうのはあまりよくない気がするが…\r\n map.setEntryPont(new FMapData_1.FEntryPont(entryPointEvent.x, entryPointEvent.y));\r\n return map.block(entryPointEvent.x, entryPointEvent.y);\r\n }\r\n else {\r\n throw new Error(`\"RE-SystemPrefab:EntryPoint\" not found. (in ${DHelper_1.DHelpers.makeRmmzMapDebugName(map.floorId().rmmzFixedMapId2)})`);\r\n }\r\n }\r\n }\r\n}\r\nexports.FMarkContinuationPass = FMarkContinuationPass;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/floorgen/passes/FMarkContinuationPass.ts?"); /***/ }), /***/ "./ts/mr/lively/Extensions.ts": /*!************************************!*\ !*** ./ts/mr/lively/Extensions.ts ***! \************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nArray.prototype.pushArray = function (ary) {\r\n for (const i of ary)\r\n this.push(i);\r\n};\r\nArray.prototype.mutableResize = function (newSize, defaultValue) {\r\n while (this.length > newSize) {\r\n this.pop();\r\n }\r\n while (this.length < newSize) {\r\n this.push(defaultValue);\r\n }\r\n};\r\nArray.prototype.mutableRemoveAt = function (index) {\r\n if (index >= 0) {\r\n this.splice(index, 1);\r\n return true;\r\n }\r\n else {\r\n return false;\r\n }\r\n};\r\nArray.prototype.mutableRemove = function (predicate) {\r\n const index = this.findIndex(predicate);\r\n if (index >= 0) {\r\n this.splice(index, 1);\r\n return true;\r\n }\r\n else {\r\n return false;\r\n }\r\n};\r\nArray.prototype.mutableRemoveAll = function (predicate) {\r\n let count = 0;\r\n for (let i = this.length - 1; i >= 0; i--) {\r\n if (predicate(this[i])) {\r\n this.splice(i, 1);\r\n count++;\r\n }\r\n }\r\n return count > 0;\r\n};\r\nArray.prototype.mutableShuffle = function () {\r\n for (var i = (this.length - 1); 0 < i; i--) {\r\n // 0〜(i+1)の範囲で値を取得\r\n var r = Math.floor(Math.random() * (i + 1));\r\n // 要素の並び替えを実行\r\n var tmp = this[i];\r\n this[i] = this[r];\r\n this[r] = tmp;\r\n }\r\n};\r\nArray.prototype.distinct = function () {\r\n return Array.from(new Set(this));\r\n};\r\nArray.prototype.distinctObjects = function (key) {\r\n const knownElements = new Map();\r\n for (const i of this) {\r\n knownElements.set(key(i), i);\r\n }\r\n return Array.from(knownElements.values());\r\n};\r\nArray.prototype.immutableSort = function (compareFn) {\r\n return Object.assign([], this).sort(compareFn);\r\n};\r\nArray.prototype.selectMin = function (fn) {\r\n if (this.length <= 0)\r\n return undefined;\r\n let m = this[0];\r\n for (let i = 1; i < this.length; i++) {\r\n if (fn(m, this[i])) {\r\n m = this[i];\r\n }\r\n }\r\n return m;\r\n};\r\nArray.prototype.count = function (predicate) {\r\n let c = 0;\r\n for (const i of this) {\r\n if (predicate(i)) {\r\n c++;\r\n }\r\n }\r\n return c;\r\n};\r\nArray.prototype.isEmpty = function () {\r\n return this.length == 0;\r\n};\r\nArray.prototype.front = function () {\r\n (0, Common_1.assert)(this.length > 0);\r\n return this[0];\r\n};\r\nArray.prototype.back = function () {\r\n (0, Common_1.assert)(this.length > 0);\r\n return this[this.length - 1];\r\n};\r\nArray.prototype.backOrUndefined = function () {\r\n if (this.length <= 0)\r\n return undefined;\r\n return this[this.length - 1];\r\n};\r\n// ReadonlyArray.prototype.countIf = function(pred: (a: T) => boolean): number {\r\n// let result = 0;\r\n// for (const a of this) {\r\n// if (pred(a)) result++;\r\n// }\r\n// return result;\r\n// }\r\nArray.prototype.binarySearchIndex = function (target) {\r\n let idx = -1;\r\n let iMin = 0;\r\n let iMax = this.length - 1;\r\n while (iMin <= iMax) {\r\n let iMid = Math.floor((iMin + iMax) / 2);\r\n if (this[iMid] === target) {\r\n idx = iMid;\r\n break;\r\n }\r\n else if (this[iMid] < target) {\r\n iMin = iMid + 1;\r\n }\r\n else {\r\n iMax = iMid - 1;\r\n }\r\n }\r\n return idx;\r\n};\r\nNumber.prototype.clamp = function (min, max) {\r\n const num = this.valueOf();\r\n return Math.min(Math.max(num, min), max);\r\n};\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/Extensions.ts?"); /***/ }), /***/ "./ts/mr/lively/LActionToken.ts": /*!**************************************!*\ !*** ./ts/mr/lively/LActionToken.ts ***! \**************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LActionToken_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LActionToken = exports.LActionTokenType = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst LCommon_1 = __webpack_require__(/*! ./LCommon */ \"./ts/mr/lively/LCommon.ts\");\r\nvar LActionTokenType;\r\n(function (LActionTokenType) {\r\n LActionTokenType[LActionTokenType[\"Minor\"] = 0] = \"Minor\";\r\n LActionTokenType[LActionTokenType[\"Major\"] = 1] = \"Major\";\r\n})(LActionTokenType = exports.LActionTokenType || (exports.LActionTokenType = {}));\r\nlet LActionToken = LActionToken_1 = class LActionToken {\r\n constructor() {\r\n /*\r\n トークンの借金について\r\n ----------\r\n v0.3.0 までは TokenCount はマイナスになることも考慮されていたが、これからは考慮しない。\r\n もともとあやつり系のモンスター特技の実装を想定してトークンの借金を考えていたが、\r\n - 原作の動きを見てみると、1ターンに何回操られても、プレイヤーの行動スキップは1回だけ。\r\n - マイナス状態を許可すると、どこで不正な値になったのがの検出が困難であり実装難易度が上がる。\r\n といった事情により廃止。\r\n あやつりによるターンスキップは、ステートで表現してみる。\r\n つまり、操られると同時に「次ターン休み」状態を付加し、ラウンド開始時にトークンを配らない。\r\n */\r\n this._minorActionTokenCount = 0;\r\n // 変化によるインスタンス再構築でも行動回数を維持したい。(モンスターは変化の杖の効果を受けたターンは行動できる)\r\n this._majorActionTokenCount = 0;\r\n }\r\n clone() {\r\n const i = new LActionToken_1();\r\n i._minorActionTokenCount = 0;\r\n i._majorActionTokenCount = 0; // 新しく作られた Entity は Scheduler には入っていないので、ActionToken を持っているのは不自然\r\n return i;\r\n }\r\n //actionTokenCount(): number { return this._majorActionTokenCount; }\r\n //setActionTokenCount(value: number): void { this._majorActionTokenCount = value; }\r\n clearActionTokenCount() {\r\n this._minorActionTokenCount = 0;\r\n this._majorActionTokenCount = 0;\r\n }\r\n canMinorAction() {\r\n return this._minorActionTokenCount > 0;\r\n }\r\n canMajorAction() {\r\n return this._minorActionTokenCount > 0 && this._majorActionTokenCount > 0;\r\n }\r\n actionCount() {\r\n return Math.max(this._minorActionTokenCount, this._majorActionTokenCount);\r\n }\r\n reset(entity, count) {\r\n const data = entity.data;\r\n this._minorActionTokenCount = count;\r\n this._majorActionTokenCount = Math.max(count - data.majorActionDeclines, 1);\r\n }\r\n charge(count) {\r\n this._minorActionTokenCount += count;\r\n this._majorActionTokenCount += count;\r\n }\r\n consume(type) {\r\n this.verify(type);\r\n if (type == LCommon_1.LActionTokenConsumeType.MinorActed) {\r\n this._minorActionTokenCount = Math.max(this._minorActionTokenCount - 1, 0);\r\n return LActionTokenType.Minor;\r\n }\r\n else if (type == LCommon_1.LActionTokenConsumeType.MajorActed) {\r\n this._minorActionTokenCount = Math.max(this._minorActionTokenCount - 1, 0);\r\n this._majorActionTokenCount = Math.max(this._majorActionTokenCount - 1, 0);\r\n return LActionTokenType.Major;\r\n }\r\n else {\r\n if (this.canMajorAction()) {\r\n return this.consume(LCommon_1.LActionTokenConsumeType.MajorActed);\r\n }\r\n else {\r\n return this.consume(LCommon_1.LActionTokenConsumeType.MinorActed);\r\n }\r\n }\r\n }\r\n verify(type) {\r\n if (type == LCommon_1.LActionTokenConsumeType.MinorActed) {\r\n (0, Common_1.assert)(this._minorActionTokenCount > 0);\r\n }\r\n else if (type == LCommon_1.LActionTokenConsumeType.MajorActed) {\r\n (0, Common_1.assert)(this._minorActionTokenCount > 0);\r\n (0, Common_1.assert)(this._majorActionTokenCount > 0);\r\n }\r\n else {\r\n (0, Common_1.assert)(this._minorActionTokenCount >= 0 || this._majorActionTokenCount >= 0);\r\n }\r\n }\r\n};\r\nLActionToken = LActionToken_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LActionToken);\r\nexports.LActionToken = LActionToken;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/LActionToken.ts?"); /***/ }), /***/ "./ts/mr/lively/LBlock.ts": /*!********************************!*\ !*** ./ts/mr/lively/LBlock.ts ***! \********************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LBlock = exports.LBlockSystemDecoration = exports.LTileShape = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst FMapData_1 = __webpack_require__(/*! ts/mr/floorgen/FMapData */ \"./ts/mr/floorgen/FMapData.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ./MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LBlockLayer_1 = __webpack_require__(/*! ./LBlockLayer */ \"./ts/mr/lively/LBlockLayer.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ts/mr/system/MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst DCommon_1 = __webpack_require__(/*! ../data/DCommon */ \"./ts/mr/data/DCommon.ts\");\r\n/** Tile の本質的な形状 */\r\nvar LTileShape;\r\n(function (LTileShape) {\r\n /** 中空 */\r\n LTileShape[LTileShape[\"Void\"] = 0] = \"Void\";\r\n /** 床 */\r\n LTileShape[LTileShape[\"Floor\"] = 1] = \"Floor\";\r\n /** 壁 */\r\n LTileShape[LTileShape[\"Wall\"] = 2] = \"Wall\";\r\n /** 壊れない壁 */\r\n LTileShape[LTileShape[\"HardWall\"] = 3] = \"HardWall\";\r\n /** 水路 */\r\n LTileShape[LTileShape[\"Water\"] = 4] = \"Water\";\r\n //\t/** マップの外周の壊せない壁。配列外を示すダミー要素。 */\r\n //\tBorderWall,\r\n})(LTileShape = exports.LTileShape || (exports.LTileShape = {}));\r\nvar LBlockSystemDecoration;\r\n(function (LBlockSystemDecoration) {\r\n LBlockSystemDecoration[LBlockSystemDecoration[\"None\"] = 0] = \"None\";\r\n LBlockSystemDecoration[LBlockSystemDecoration[\"ItemShop\"] = 1] = \"ItemShop\";\r\n})(LBlockSystemDecoration = exports.LBlockSystemDecoration || (exports.LBlockSystemDecoration = {}));\r\n/**\r\n * GameBlock\r\n *\r\n * Block 内の同一レイヤーには、複数の Entity が同時に存在することがありえる。\r\n * 貫通属性を持ち、複数同時発射されれる Projectile など。(シレン2のかまいたちの矢等)\r\n */\r\nlet LBlock = class LBlock {\r\n constructor(x, y) {\r\n this._roomId = 0;\r\n this._blockComponent = FMapData_1.FBlockComponent.None;\r\n this._continuation = false;\r\n this._roomInnerEntrance = false;\r\n this._shopkeeperLine = false; // 店入口3マス\r\n this._passed = false; // 通過フラグ。操作キャラクターが通過したか (Player が一度でも把握したか)\r\n this._tileShape = LTileShape.Floor;\r\n // お店の床など、ゲームシステムとして明示したい装飾\r\n this._systemDecoration = LBlockSystemDecoration.None;\r\n this._mx = x;\r\n this._my = y;\r\n this._layers = [new LBlockLayer_1.REBlockLayer(), new LBlockLayer_1.REBlockLayer(), new LBlockLayer_1.REBlockLayer(), new LBlockLayer_1.REBlockLayer(), new LBlockLayer_1.REBlockLayer()];\r\n this._shapeVisualPartIndex = 0;\r\n this._decorationVisualPartIndex = 0;\r\n this.footprints = { factionDensities: [] };\r\n }\r\n /** 絶対座標 X */\r\n get mx() {\r\n return this._mx;\r\n }\r\n /** 絶対座標 Y */\r\n get my() {\r\n return this._my;\r\n }\r\n room() {\r\n if (this._roomId > 0)\r\n return MRLively_1.MRLively.mapView.currentMap.room(this._roomId);\r\n else\r\n return undefined;\r\n }\r\n /** 表示用 TileId. 通行判定や部屋内判定に使用するものではない点に注意。 */\r\n //public tileIds(): number[] | undefined {\r\n // return this._tileIds;\r\n //}\r\n /** 表示用 TileId. 通行判定や部屋内判定に使用するものではない点に注意。 */\r\n //public setTileIds(z: number, tileId: number): void {\r\n // this._tileIds[z] = tileId;\r\n // RESystem.integration.onUpdateTile(this._x, this._y, z, tileId);\r\n //}\r\n //tile(): LEntity {\r\n // return this._layers[BlockLayerKind.Terrain].entities()[0];\r\n //}\r\n tileShape() {\r\n //const attr = this.tile().findAttribute(RETileAttribute);\r\n //return attr ? attr.tileKind() : TileKind.Void;\r\n return this._tileShape;\r\n }\r\n get shapeVisualPartIndex() {\r\n return this._shapeVisualPartIndex;\r\n }\r\n get decorationVisualPartIndex() {\r\n return this._decorationVisualPartIndex;\r\n }\r\n setSystemDecoration(value) {\r\n this._systemDecoration = value;\r\n MRSystem_1.MRSystem.integration.onUpdateBlock(this);\r\n }\r\n systemDecoration() {\r\n return this._systemDecoration;\r\n }\r\n // public setVisualDecoration(type: number, index: number): void {\r\n // this._visualDecorationType = type;\r\n // this._visualDecorationIndex = index;\r\n // }\r\n /** 地面上で、歩行による移動が可能であるか。(中空や水地形ではない) */\r\n isFloorLikeShape() {\r\n return this._tileShape == LTileShape.Floor;\r\n }\r\n isWallLikeShape() {\r\n return this._tileShape == LTileShape.Wall || this._tileShape == LTileShape.HardWall;\r\n }\r\n /** 部屋内のブロックであるか */\r\n isRoom() {\r\n return this._roomId > 0;\r\n }\r\n /** 通路あるか */\r\n isPassageway() {\r\n return !this.isRoom();\r\n }\r\n isContinuation() {\r\n return this._continuation;\r\n }\r\n /** 部屋の入口であるか */\r\n isRoomInnerEntrance() {\r\n return this._roomInnerEntrance;\r\n }\r\n layers() {\r\n return this._layers;\r\n }\r\n layer(kind) {\r\n return this._layers[kind];\r\n }\r\n addEntity(layerKind, entity) {\r\n const layer = this._layers[layerKind];\r\n (0, Common_1.assert)(!layer.isContains(entity)); // 複数追加禁止\r\n //assert(!layer.isOccupied()); // 既に占有されている時は追加禁止\r\n if (layerKind == DCommon_1.DBlockLayerKind.Terrain) {\r\n // Tile Layer への複数追加は禁止\r\n (0, Common_1.assert)(this._layers[layerKind].entities().length == 0);\r\n }\r\n layer.addEntity(entity);\r\n }\r\n removeEntity(entity) {\r\n for (let i = 0; i < this._layers.length; i++) {\r\n if (this._layers[i].removeEntity(entity)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n removeAllEntites() {\r\n for (let i = 0; i < this._layers.length; i++) {\r\n this._layers[i].removeAllEntites();\r\n }\r\n }\r\n aliveEntity(layer) {\r\n const l = this._layers[layer];\r\n return l.entities().find(x => x.isAlive());\r\n }\r\n /** Block に含まれている Entity を取得する。 layerKind を指定した場合は、 */\r\n getEntities(layerKind) {\r\n const result = [];\r\n if (layerKind) {\r\n const layer = this._layers[layerKind];\r\n for (const entity of layer.entities()) {\r\n result.push(entity);\r\n }\r\n }\r\n else {\r\n for (const layer of this._layers) {\r\n for (const entity of layer.entities()) {\r\n result.push(entity);\r\n }\r\n }\r\n }\r\n return result;\r\n }\r\n getFirstEntity(layerKind) {\r\n const entities = this.getEntities(layerKind);\r\n return entities.length > 0 ? entities[0] : undefined;\r\n }\r\n /** Entity が含まれている Layer を検索する */\r\n findEntityLayerKind(entity) {\r\n const index = this._layers.findIndex(x => x.isContains(entity));\r\n if (index >= 0)\r\n return index;\r\n else\r\n return undefined;\r\n }\r\n /** Entity が含まれている Layer を検索する */\r\n findEntity(predicate) {\r\n for (const layer of this._layers) {\r\n for (const id of layer.entityIds()) {\r\n const entity = MRLively_1.MRLively.world.entity(id);\r\n if (predicate(entity))\r\n return entity;\r\n }\r\n }\r\n return undefined;\r\n }\r\n /** 指定した Entity がこの Block に含まれているか */\r\n containsEntity(entity) {\r\n return this.findEntityLayerKind(entity) != undefined;\r\n }\r\n updateFootpoints() {\r\n const fd = this.footprints.factionDensities;\r\n for (let i = 0; i < fd.length; i++) {\r\n if (fd[i] !== undefined && fd[i] > 0) {\r\n fd[i] -= 1;\r\n }\r\n }\r\n }\r\n setFootpoint(entity) {\r\n const factionId = entity.getInnermostFactionId();\r\n if (factionId) {\r\n const fd = this.footprints.factionDensities;\r\n fd[factionId] = 3;\r\n }\r\n }\r\n};\r\nLBlock = __decorate([\r\n Common_1.MRSerializable\r\n], LBlock);\r\nexports.LBlock = LBlock;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/LBlock.ts?"); /***/ }), /***/ "./ts/mr/lively/LBlockLayer.ts": /*!*************************************!*\ !*** ./ts/mr/lively/LBlockLayer.ts ***! \*************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.REBlockLayer = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ./MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\n// 同一レイヤーに、同時に複数の Entity は存在可能。\r\n// 例えばシレン2のかまいたちの矢は、発射直後の状態ではすべて同一タイル内に存在する。\r\n// またシレン2のバグから推測することもできる。\r\n// http://shiren2.lsx3.com/?plugin=paraedit&parnum=17&page=%A5%D0%A5%B0&refer=%A5%D0%A5%B0\r\nlet REBlockLayer = class REBlockLayer {\r\n constructor() {\r\n this._entityIds = [];\r\n }\r\n entityIds() {\r\n return this._entityIds;\r\n }\r\n entities() {\r\n return this._entityIds.map(x => MRLively_1.MRLively.world.entity(x));\r\n }\r\n firstEntity() {\r\n if (this._entityIds.length > 0)\r\n return MRLively_1.MRLively.world.entity(this._entityIds[0]);\r\n else\r\n return undefined;\r\n }\r\n isContainsAnyEntity() {\r\n return this._entityIds.length > 0;\r\n }\r\n isContains(entity) {\r\n return this._entityIds.findIndex(x => x.equals(entity.entityId())) >= 0;\r\n }\r\n isOccupied() {\r\n return this._entityIds.some(x => MRLively_1.MRLively.world.entity(x).blockOccupied);\r\n }\r\n addEntity(entity) {\r\n this._entityIds.push(entity.entityId());\r\n }\r\n removeEntity(entity) {\r\n const index = this._entityIds.findIndex(x => x.equals(entity.entityId()));\r\n if (index >= 0) {\r\n this._entityIds.splice(index, 1);\r\n return true;\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n removeAllEntites() {\r\n this._entityIds.splice(0);\r\n }\r\n};\r\nREBlockLayer = __decorate([\r\n Common_1.MRSerializable\r\n], REBlockLayer);\r\nexports.REBlockLayer = REBlockLayer;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/LBlockLayer.ts?"); /***/ }), /***/ "./ts/mr/lively/LChronus.ts": /*!**********************************!*\ !*** ./ts/mr/lively/LChronus.ts ***! \**********************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LChronus = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst data_1 = __webpack_require__(/*! ../data */ \"./ts/mr/data/index.ts\");\r\nlet LChronus = class LChronus {\r\n constructor() {\r\n this._totalSeconds = 0;\r\n this._currentTimeFrameIndex = 0;\r\n this._revisionNumber = 0;\r\n this._needsLivingTimeFrameRefresh = false;\r\n }\r\n get revisionNumber() {\r\n return this._revisionNumber;\r\n }\r\n /** 日中の秒数。(0 ~ MRData.chronus.secondsInDay-1) */\r\n get totalSeconds() {\r\n return this._totalSeconds;\r\n }\r\n /** 経過日数 */\r\n getTotalDays() {\r\n return Math.floor(this._totalSeconds / data_1.MRData.chronus.secondsInDay);\r\n }\r\n get currentTimeFrameIndex() {\r\n return this._currentTimeFrameIndex;\r\n }\r\n get currentTimeFrame() {\r\n return data_1.MRData.chronus.timeFrames[this._currentTimeFrameIndex];\r\n }\r\n get currentTimeFrameId() {\r\n return this.currentTimeFrame.timeFrameId;\r\n }\r\n getTimeFrameIndex() {\r\n let index = 0;\r\n const frames = data_1.MRData.chronus.timeFrames;\r\n for (let i = 0; i < frames.length; i++) {\r\n const frame = frames[i];\r\n if (this.isHourInRange(frame.startHour, frame.lastHouer)) {\r\n index = i;\r\n }\r\n }\r\n return index;\r\n }\r\n ;\r\n isHourInRange(start, last) {\r\n var hour = this.getClockHour();\r\n return hour >= start && hour <= last;\r\n }\r\n ;\r\n advanceRound() {\r\n this.advanceSeconds(data_1.MRData.chronus.secondsInRound);\r\n }\r\n advanceSeconds(secs) {\r\n if (!data_1.MRData.chronus.enabled)\r\n return;\r\n this._totalSeconds += secs;\r\n this.requireRefresh();\r\n }\r\n requireRefresh() {\r\n this._revisionNumber++;\r\n const oldTimeFrameKind = this.currentTimeFrame.kind;\r\n this._currentTimeFrameIndex = this.getTimeFrameIndex();\r\n if (oldTimeFrameKind !== this.currentTimeFrame.kind) {\r\n this.reserveLivingTimeFrameRefresh();\r\n }\r\n }\r\n reserveLivingTimeFrameRefresh() {\r\n this._needsLivingTimeFrameRefresh = true;\r\n }\r\n clearLivingTimeFrameRefresh() {\r\n this._needsLivingTimeFrameRefresh = false;\r\n }\r\n get needsLivingTimeFrameRefresh() {\r\n return this._needsLivingTimeFrameRefresh;\r\n }\r\n get weekIndex() {\r\n return this.getTotalDays() % data_1.MRData.chronus.getDaysOfWeek();\r\n }\r\n /** 現在の曜日名 */\r\n getWeekName() {\r\n return data_1.MRData.chronus.weekNames[this.weekIndex];\r\n }\r\n ;\r\n /** 現在の秒表示 (0~59) */\r\n getClockSecond() {\r\n return Math.floor(this._totalSeconds / data_1.MRData.chronus.secondsInMinute);\r\n }\r\n /** 現在の時表示 (0~23) */\r\n getClockHour() {\r\n return Math.floor(this._totalSeconds / data_1.MRData.chronus.secondsInHour % data_1.MRData.chronus.hoursInDay);\r\n }\r\n /** 現在の分表示 (0~59) */\r\n getClockMinute() {\r\n return Math.floor(this._totalSeconds / data_1.MRData.chronus.secondsInMinute % data_1.MRData.chronus.minutesInHour);\r\n }\r\n /** 現在の日表示 (1~12) */\r\n getCalendarDay() {\r\n let days = this.getTotalDays() % data_1.MRData.chronus.getDaysOfYear();\r\n for (let i = 0; i < data_1.MRData.chronus.daysOfMonth.length; i++) {\r\n if (days < data_1.MRData.chronus.daysOfMonth[i])\r\n return days + 1;\r\n days -= data_1.MRData.chronus.daysOfMonth[i];\r\n }\r\n throw new Error(\"Unreachable.\");\r\n }\r\n /** 現在の月表示 (1~12) */\r\n getCalendarMonth() {\r\n let days = this.getTotalDays() % data_1.MRData.chronus.getDaysOfYear();\r\n for (let i = 0; i < data_1.MRData.chronus.daysOfMonth.length; i++) {\r\n days -= data_1.MRData.chronus.daysOfMonth[i];\r\n if (days < 0)\r\n return i + 1;\r\n }\r\n throw new Error(\"Unreachable.\");\r\n }\r\n /** 現在の年表示 (1~12) */\r\n getCalendarYear() {\r\n return Math.floor(this.getTotalDays() / data_1.MRData.chronus.getDaysOfYear()) + 1;\r\n }\r\n getDisplayText() {\r\n return this.convertDateFormatText(\"YYYY/MM/DD HH24:MI\");\r\n }\r\n convertDateFormatText(format) {\r\n format = format.replace(/(YYYY)/gi, (substring, args) => {\r\n return this.getValuePadding(this.getCalendarYear(), substring.length);\r\n });\r\n format = format.replace(/MON/gi, () => {\r\n return data_1.MRData.chronus.monthNames[this.getCalendarMonth() - 1];\r\n });\r\n format = format.replace(/MM/gi, () => {\r\n return this.getValuePadding(this.getCalendarMonth(), String(data_1.MRData.chronus.getMonthOfYear()).length);\r\n });\r\n format = format.replace(/DDALL/gi, () => {\r\n return this.getValuePadding(this.getTotalDays());\r\n });\r\n format = format.replace(/DD/gi, () => {\r\n return this.getValuePadding(this.getCalendarDay(), String(data_1.MRData.chronus.getDaysOfMonth(this.getCalendarMonth())).length);\r\n });\r\n format = format.replace(/HH24/gi, () => {\r\n return this.getValuePadding(this.getClockHour(), 2);\r\n });\r\n format = format.replace(/HH12/gi, () => {\r\n return this.getValuePadding(this.getClockHour() % 12, 2);\r\n });\r\n format = format.replace(/AM/gi, () => {\r\n return Math.floor(this.getClockHour() / 12) === 0 ?\r\n $gameSystem.isJapanese() ? '午前' : 'Morning ' :\r\n $gameSystem.isJapanese() ? '午後' : 'Afternoon';\r\n });\r\n format = format.replace(/MI/gi, () => {\r\n return this.getValuePadding(this.getClockMinute(), 2);\r\n });\r\n format = format.replace(/DY/gi, () => {\r\n return this.getWeekName();\r\n });\r\n // format = format.replace(/TZ/gi, () => {\r\n // return this.getTimeZoneName();\r\n // });\r\n return format;\r\n }\r\n ;\r\n getValuePadding(value, digit = 0, padChar) {\r\n // if (this._disablePadding) {\r\n // return value;\r\n // }\r\n if (arguments.length === 2)\r\n padChar = '0';\r\n var result = '';\r\n for (var i = 0; i < digit; i++)\r\n result += padChar;\r\n result += value;\r\n return result.substr(-digit);\r\n }\r\n ;\r\n};\r\nLChronus = __decorate([\r\n Common_1.MRSerializable\r\n], LChronus);\r\nexports.LChronus = LChronus;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/LChronus.ts?"); /***/ }), /***/ "./ts/mr/lively/LCommon.ts": /*!*********************************!*\ !*** ./ts/mr/lively/LCommon.ts ***! \*********************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LActionTokenConsumeType = exports.LMinimapMarkerClass = exports.phaseCount = void 0;\r\nexports.phaseCount = 4;\r\nvar LMinimapMarkerClass;\r\n(function (LMinimapMarkerClass) {\r\n /** 表示なし */\r\n LMinimapMarkerClass[LMinimapMarkerClass[\"None\"] = 0] = \"None\";\r\n /** ユニット。最終的なマーカーは、視点の Entity と勢力によって決まる。 */\r\n LMinimapMarkerClass[LMinimapMarkerClass[\"Unit\"] = 1] = \"Unit\";\r\n LMinimapMarkerClass[LMinimapMarkerClass[\"Item\"] = 2] = \"Item\";\r\n LMinimapMarkerClass[LMinimapMarkerClass[\"Trap\"] = 3] = \"Trap\";\r\n LMinimapMarkerClass[LMinimapMarkerClass[\"ExitPoint\"] = 4] = \"ExitPoint\";\r\n})(LMinimapMarkerClass = exports.LMinimapMarkerClass || (exports.LMinimapMarkerClass = {}));\r\nvar LActionTokenConsumeType;\r\n(function (LActionTokenConsumeType) {\r\n /** MinorAction を実行した。 MinorToken を1つ消費する。 */\r\n LActionTokenConsumeType[LActionTokenConsumeType[\"MinorActed\"] = 0] = \"MinorActed\";\r\n /** MajorAction を実行した。 MajorToken を1つ消費する。 */\r\n LActionTokenConsumeType[LActionTokenConsumeType[\"MajorActed\"] = 1] = \"MajorActed\";\r\n /** 待機した。Major を優先的に消費する。 */\r\n LActionTokenConsumeType[LActionTokenConsumeType[\"WaitActed\"] = 2] = \"WaitActed\";\r\n})(LActionTokenConsumeType = exports.LActionTokenConsumeType || (exports.LActionTokenConsumeType = {}));\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/LCommon.ts?"); /***/ }), /***/ "./ts/mr/lively/LDeathResult.ts": /*!**************************************!*\ !*** ./ts/mr/lively/LDeathResult.ts ***! \**************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LDeathResult = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nlet LDeathResult = class LDeathResult {\r\n constructor() {\r\n this._states = [];\r\n }\r\n clear() {\r\n this._states = [];\r\n }\r\n clearStates() {\r\n this._states = [];\r\n }\r\n addState(id) {\r\n this._states.push(id);\r\n }\r\n states() {\r\n return this._states;\r\n }\r\n};\r\nLDeathResult = __decorate([\r\n Common_1.MRSerializable\r\n], LDeathResult);\r\nexports.LDeathResult = LDeathResult;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/LDeathResult.ts?"); /***/ }), /***/ "./ts/mr/lively/LEffectResult.ts": /*!***************************************!*\ !*** ./ts/mr/lively/LEffectResult.ts ***! \***************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LEffectResult = exports.LParamEffectResult = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst LIdentifyer_1 = __webpack_require__(/*! ts/mr/lively/LIdentifyer */ \"./ts/mr/lively/LIdentifyer.ts\");\r\nconst DParameter_1 = __webpack_require__(/*! ts/mr/data/DParameter */ \"./ts/mr/data/DParameter.ts\");\r\nconst SSoundManager_1 = __webpack_require__(/*! ts/mr/system/SSoundManager */ \"./ts/mr/system/SSoundManager.ts\");\r\nconst UName_1 = __webpack_require__(/*! ts/mr/utility/UName */ \"./ts/mr/utility/UName.ts\");\r\nconst DTextManager_1 = __webpack_require__(/*! ../data/DTextManager */ \"./ts/mr/data/DTextManager.ts\");\r\nconst DEffect_1 = __webpack_require__(/*! ../data/DEffect */ \"./ts/mr/data/DEffect.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ../data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst DFaction_1 = __webpack_require__(/*! ../data/DFaction */ \"./ts/mr/data/DFaction.ts\");\r\n// Game_ActionResult.hpDamage, mpDamage, tpDamage\r\nlet LParamEffectResult = class LParamEffectResult {\r\n //qualifying: DParameterQualifying;\r\n //priorotyMessage: DParameterQualifying | undefined;\r\n constructor(paramId) {\r\n this.damage = 0; // REData.parameters の要素数分の配列。それぞれのパラメータをどれだけ変動させるか。負値はダメージ。\r\n this.oldValue = 0;\r\n this.newValue = 0;\r\n this.drain = false;\r\n this.paramId = paramId;\r\n this.applyTarget = DEffect_1.DValuePoint.Actual;\r\n }\r\n paramDisplayName() {\r\n const data = MRData_1.MRData.parameters[this.paramId];\r\n if (this.applyTarget == DEffect_1.DValuePoint.Growth) {\r\n return data.displayNameMaximum;\r\n }\r\n else {\r\n return data.displayName;\r\n }\r\n }\r\n getValue(entity, recover) {\r\n const paramData = MRData_1.MRData.parameters[this.paramId];\r\n if (paramData.messageValueSource == DParameter_1.DParamMessageValueSource.Relative) {\r\n if (recover)\r\n return -this.damage;\r\n else\r\n return this.damage;\r\n }\r\n else if (paramData.messageValueSource == DParameter_1.DParamMessageValueSource.Absolute) {\r\n return entity.getActualParam(this.paramId);\r\n }\r\n else {\r\n throw new Error(\"Unreachable.\");\r\n }\r\n }\r\n};\r\nLParamEffectResult = __decorate([\r\n Common_1.MRSerializable\r\n], LParamEffectResult);\r\nexports.LParamEffectResult = LParamEffectResult;\r\n/**\r\n * 一度の Effect の適用結果。Visual で表示したいコンテンツのソースデータとなる。\r\n * メッセージに限らず、ポップアップやイメージ表情差分表示など、様々な Visual 表現に必要なすべてのデータを含む。\r\n */\r\nlet LEffectResult = class LEffectResult {\r\n constructor() {\r\n // 意味のある効果適用ができたかどうか。\r\n // 確率計算の前に、現状知りえる情報内で明らかに適用できるかどうかを判定する。\r\n // 例えば HP Full の時に回復アイテムを使ったときは false になったりする。\r\n // false の場合「しかし、なにもおこらなかった」を表示したりする。\r\n this.used = false;\r\n // 攻撃側の命中判定結果。true の場合命中。used == true の場合参照できる。\r\n this.missed = false;\r\n // 防御側の回避判定結果。true の場合命中。used == true の場合参照できる。\r\n this.evaded = false;\r\n // 物理攻撃であるか。回避判定に eva を使うか、mev を使うかきめたり、クリティカルの発生有無を決めるのに使う。\r\n // Game_Action.prototype.isPhysical 参照。\r\n this.physical = false;\r\n //drain: boolean = false;\r\n // Game_Action.prototype.itemCri\r\n this.critical = false;\r\n // 効果適用の成否。false の場合、 \"%1には効かなかった!\"\r\n // used, missed, evaded の判定後、実際に防御側のパラメータを変動させたかどうか。\r\n this.success = false;\r\n // HP に関係する効果であったか。文字の色を変えたりする\r\n this.hpAffected = false;\r\n this.paramEffects2 = [];\r\n //parameterDamags: number[] = []; // REData.parameters の要素数分の配列。それぞれのパラメータをどれだけ変動させるか。負値はダメージ。\r\n this.addedStates = [];\r\n this.removedStates = [];\r\n this.addedBuffs = [];\r\n this.addedDebuffs = [];\r\n this.removedBuffs = [];\r\n // 効果を受けたのは、Camera がフォーカスしている勢力に属する者であるか\r\n /** @deprecated */\r\n this.focusedFriendly = true;\r\n /** @deprecated */\r\n this.levelup = false;\r\n /** @deprecated */\r\n this.leveldown = false;\r\n this.gainedExp = 0;\r\n /*\r\n [2021/11/21]\r\n ----------\r\n まだ EffectResult 表示タイミングは体系化できているわけではないが、おおよそ見えてきた。\r\n 少なくとも CommandChain の終了時に、そのターンで起きたことをまとめて Flush したい。\r\n 経験値をまとめて表示するタイミングがこれに該当するが、これ以外の細かいメッセージも、もし出し忘れがあれば全部ここで出したい。\r\n そうすると、ターン開始時に open、ターン終了(CommandChain の終了時)に close(flush) でいいだろう。\r\n なおここでいう close はコマンドチェーンの Epilogue よりも後。本当に完全に終わった時なので注意。\r\n ワナ師状態で地雷の連鎖爆発が発生して経験値を得たときに備える。\r\n */\r\n this._revision = 0;\r\n this._commitedRevision = 0;\r\n this._dirty = false;\r\n }\r\n get looksFactionType() {\r\n return this.focusedFriendly ? DFaction_1.DFactionType.Friendly : DFaction_1.DFactionType.Hostile; // TODO: Natural\r\n }\r\n // Game_ActionResult.prototype.isHit\r\n isHit() {\r\n return this.used && !this.missed && !this.evaded;\r\n }\r\n clear() {\r\n this.used = false;\r\n this.missed = false;\r\n this.evaded = false;\r\n this.physical = false;\r\n this.critical = false;\r\n this.success = false;\r\n this.hpAffected = false;\r\n this.paramEffects2 = [];\r\n this.addedStates = [];\r\n this.removedStates = [];\r\n this.addedBuffs = [];\r\n this.addedDebuffs = [];\r\n this.removedBuffs = [];\r\n this.focusedFriendly = true;\r\n this.levelup = false;\r\n this.leveldown = false;\r\n this.gainedExp = 0;\r\n this.instanceChangedFrom = undefined;\r\n this._dirty = false;\r\n }\r\n clearParamEffects() {\r\n this.paramEffects2 = [];\r\n }\r\n hasResult() {\r\n return true;\r\n }\r\n get sourceEffect() {\r\n (0, Common_1.assert)(this.sourceEffectId);\r\n return MRData_1.MRData.effects[this.sourceEffectId];\r\n }\r\n // Game_ActionResult.prototype.isStateAdded\r\n isStateAdded(stateId) {\r\n return this.addedStates.includes(stateId);\r\n }\r\n ;\r\n // Game_ActionResult.prototype.pushAddedState\r\n pushAddedState(stateId) {\r\n if (!this.isStateAdded(stateId)) {\r\n this.addedStates.push(stateId);\r\n this._dirty = true;\r\n }\r\n }\r\n // Game_ActionResult.prototype.isStateRemoved\r\n isStateRemoved(stateId) {\r\n return this.removedStates.includes(stateId);\r\n }\r\n // Game_ActionResult.prototype.pushRemovedState\r\n pushRemovedState(stateId) {\r\n if (!this.isStateRemoved(stateId)) {\r\n this.removedStates.push(stateId);\r\n }\r\n this._dirty = true;\r\n }\r\n // Game_ActionResult.prototype.isBuffAdded\r\n isBuffAdded(paramId) {\r\n return this.addedBuffs.includes(paramId);\r\n }\r\n // Game_ActionResult.prototype.pushAddedBuff\r\n pushAddedBuff(paramId) {\r\n if (!this.isBuffAdded(paramId)) {\r\n this.addedBuffs.push(paramId);\r\n this._dirty = true;\r\n }\r\n }\r\n // Game_ActionResult.prototype.isDebuffAdded \r\n isDebuffAdded(paramId) {\r\n return this.addedDebuffs.includes(paramId);\r\n }\r\n // Game_ActionResult.prototype.pushAddedDebuff\r\n pushAddedDebuff(paramId) {\r\n if (!this.isDebuffAdded(paramId)) {\r\n this.addedDebuffs.push(paramId);\r\n this._dirty = true;\r\n }\r\n }\r\n // Game_ActionResult.prototype.isBuffRemoved\r\n isBuffRemoved(paramId) {\r\n return this.removedBuffs.includes(paramId);\r\n }\r\n // Game_ActionResult.prototype.pushRemovedBuff\r\n pushRemovedBuff(paramId) {\r\n if (!this.isBuffRemoved(paramId)) {\r\n this.removedBuffs.push(paramId);\r\n this._dirty = true;\r\n }\r\n }\r\n // Game_ActionResult.prototype.addedStateObjects\r\n addedStateObjects() {\r\n return this.addedStates.map(id => MRData_1.MRData.states[id]);\r\n }\r\n // Game_Action.prototype.makeSuccess\r\n makeSuccess() {\r\n this.success = true;\r\n this._dirty = true;\r\n }\r\n shouldShowMessage() {\r\n if (this._revision != this._commitedRevision)\r\n return true;\r\n //if (this._dirty) return true;[\r\n return false;\r\n //return (this._dirty || this._revision != this._commitedRevision);\r\n }\r\n refreshRevision() {\r\n this._commitedRevision = this._revision;\r\n if (this._revision > 10000) {\r\n this._revision = 0;\r\n this._commitedRevision = 0;\r\n }\r\n this._dirty = false;\r\n }\r\n // Window_BattleLog.prototype.displayActionResults\r\n showResultMessages(cctx, entity) {\r\n // if (this._revision != this._commitedRevision) {\r\n // }\r\n // else {\r\n // return;\r\n // }\r\n if (this.shouldShowMessage()) {\r\n this.refreshRevision();\r\n const targetName = UName_1.UName.makeUnitName(entity);\r\n if (this.instanceChangedFrom) {\r\n cctx.postMessage((0, Common_1.tr2)(\"%1は%2に変化した。\").format(MRData_1.MRData.entities[this.instanceChangedFrom].makeDisplayName(0), targetName));\r\n }\r\n if (this.missed) {\r\n // Window_BattleLog.prototype.displayMiss\r\n cctx.postMessage(DTextManager_1.DTextManager.enemyNoHit.format(targetName));\r\n if (this.physical) {\r\n SSoundManager_1.SSoundManager.playMiss();\r\n }\r\n }\r\n else {\r\n for (const param of this.paramEffects2) {\r\n this.displayParameterFlavorEffect(cctx, entity, targetName, param);\r\n //cctx.postMessage(this.makeParamDamageText(entity, targetName, param));\r\n }\r\n }\r\n const isActor = this.focusedFriendly;\r\n // Game_Actor.prototype.showAddedStates\r\n {\r\n for (const stateId of this.addedStates) {\r\n const state = MRData_1.MRData.states[stateId];\r\n const stateText = isActor ? state.message1 : state.message2;\r\n if (stateText) {\r\n cctx.postMessage(stateText.format(targetName));\r\n }\r\n }\r\n }\r\n // Game_Actor.prototype.showRemovedStates\r\n {\r\n for (const stateId of this.removedStates) {\r\n const state = MRData_1.MRData.states[stateId];\r\n if (state.message4) {\r\n cctx.postMessage(state.message4.format(targetName));\r\n }\r\n }\r\n }\r\n // Window_BattleLog.prototype.displayChangedBuffs\r\n {\r\n for (const paramId of this.addedBuffs) {\r\n const text = DTextManager_1.DTextManager.buffAdd.format(targetName, DTextManager_1.DTextManager.param(MRData_1.MRData.parameters[paramId].battlerParamId));\r\n cctx.postMessage(text);\r\n }\r\n for (const paramId of this.addedDebuffs) {\r\n const text = DTextManager_1.DTextManager.debuffAdd.format(targetName, DTextManager_1.DTextManager.param(MRData_1.MRData.parameters[paramId].battlerParamId));\r\n cctx.postMessage(text);\r\n }\r\n for (const paramId of this.removedBuffs) {\r\n const text = DTextManager_1.DTextManager.buffRemove.format(targetName, DTextManager_1.DTextManager.param(MRData_1.MRData.parameters[paramId].battlerParamId));\r\n cctx.postMessage(text);\r\n }\r\n }\r\n if (this.isHit() && !this.success) { // 条件は Window_BattleLog.prototype.displayFailure と同じ\r\n cctx.postMessage(DTextManager_1.DTextManager.actionFailure.format(targetName));\r\n }\r\n // 経験値\r\n {\r\n const targetName = LIdentifyer_1.LEntityDescription.makeDisplayText(UName_1.UName.makeUnitName(entity), LIdentifyer_1.DescriptionHighlightColor.UnitName);\r\n if (this.gainedExp > 0) {\r\n const text = DTextManager_1.DTextManager.obtainExp.format(this.gainedExp, DTextManager_1.DTextManager.exp);\r\n cctx.postMessage(text);\r\n }\r\n // Game_Actor.prototype.displayLevelUp\r\n if (this.levelup || this.leveldown) {\r\n if (this.levelup) {\r\n const text = DTextManager_1.DTextManager.levelUp.format(targetName, DTextManager_1.DTextManager.level, entity.getActualParam(MRBasics_1.MRBasics.params.level));\r\n cctx.postMessage(text);\r\n SSoundManager_1.SSoundManager.playLevelUp();\r\n }\r\n if (this.leveldown) {\r\n const text = (0, Common_1.tr2)(\"%1は%2が下がった!\").format(targetName, DTextManager_1.DTextManager.level);\r\n cctx.postMessage(text);\r\n SSoundManager_1.SSoundManager.playLevelUp();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n displayParameterFlavorEffect(cctx, entity, entityDisplayName, paramResult) {\r\n const param = MRData_1.MRData.parameters[paramResult.paramId];\r\n // 条件に一致する flavorEffect を探す。\r\n // 見つからなかったら Neature にフォールバック\r\n let flavorEffect = undefined;\r\n if (paramResult.parameterDamageEffect) {\r\n flavorEffect = this.selectParameterFlavorEffect(entity, paramResult, paramResult.parameterDamageEffect.getParameterFlavorEffectByLooksFaction(this.looksFactionType));\r\n if (!flavorEffect && this.looksFactionType != DFaction_1.DFactionType.Neutral) {\r\n flavorEffect = this.selectParameterFlavorEffect(entity, paramResult, paramResult.parameterDamageEffect.getParameterFlavorEffectByLooksFaction(DFaction_1.DFactionType.Neutral));\r\n }\r\n }\r\n if (!flavorEffect) {\r\n flavorEffect = this.selectParameterFlavorEffect(entity, paramResult, param.getParameterFlavorEffectByLooksFaction(this.looksFactionType));\r\n }\r\n if (!flavorEffect && this.looksFactionType != DFaction_1.DFactionType.Neutral) {\r\n flavorEffect = this.selectParameterFlavorEffect(entity, paramResult, param.getParameterFlavorEffectByLooksFaction(DFaction_1.DFactionType.Neutral));\r\n }\r\n let messageArgs = [];\r\n if (flavorEffect && flavorEffect.text.length > 0) {\r\n const paramName = paramResult.paramDisplayName();\r\n const relValue = Math.abs(paramResult.damage);\r\n const newValue = entity.getActualParam(paramResult.paramId);\r\n const oldValue = newValue - paramResult.damage;\r\n messageArgs = [\r\n entityDisplayName,\r\n paramName,\r\n param.makeDisplayValue(relValue),\r\n param.makeDisplayValue(oldValue),\r\n param.makeDisplayValue(newValue),\r\n ];\r\n }\r\n cctx.displayFlavorEffect(entity, flavorEffect, { messageFormatArgs: messageArgs });\r\n // if (!flavorEffect) {\r\n // return; // 再生するものは無かった\r\n // }\r\n // // Message 再生\r\n // if (flavorEffect.text) {\r\n // const paramName = paramResult.paramDisplayName();\r\n // const relValue = Math.abs(paramResult.damage);\r\n // const newValue = entity.actualParam(paramResult.paramId);\r\n // const oldValue = newValue - paramResult.damage;\r\n // const text = flavorEffect.text.format(\r\n // entityDisplayName,\r\n // paramName,\r\n // param.makeDisplayValue(relValue),\r\n // param.makeDisplayValue(oldValue),\r\n // param.makeDisplayValue(newValue));\r\n // cctx.postMessage(text);\r\n // }\r\n // // 効果音 再生\r\n // if (flavorEffect.sound) {\r\n // SSoundManager.playSe(flavorEffect.sound);\r\n // }\r\n // // アニメーション 再生\r\n // if (flavorEffect.rmmzAnimationId > 0) {\r\n // cctx.postAnimation(entity, flavorEffect.rmmzAnimationId, false); // 基本的に Log や Motion と並行再生したいので、 wait=false.\r\n // }\r\n // // Motion 再生\r\n // if (flavorEffect.motionId > 0) {\r\n // cctx.postSequel(entity, flavorEffect.motionId);\r\n // }\r\n }\r\n selectParameterFlavorEffect(entity, paramResult, effects) {\r\n for (let i = effects.length - 1; i >= 0; i--) {\r\n const effect = effects[i];\r\n if (effect) {\r\n if (this.meetsConditionParameterFlavorEffect(entity, paramResult, effect)) {\r\n return effect.flavorEffect;\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n meetsConditionParameterFlavorEffect(entity, paramResult, effect) {\r\n if (effect.point != paramResult.applyTarget) {\r\n return false;\r\n }\r\n if (paramResult.damage > 0 && effect.addition != DParameter_1.DValueAddition.Loss) {\r\n return false;\r\n }\r\n if (paramResult.damage < 0 && effect.addition != DParameter_1.DValueAddition.Gain) {\r\n return false;\r\n }\r\n if (paramResult.damage == 0 && effect.addition != DParameter_1.DValueAddition.None) {\r\n return false;\r\n }\r\n if (effect.conditionFormula) {\r\n const param = MRData_1.MRData.parameters[paramResult.paramId];\r\n const value = paramResult.newValue;\r\n const old = paramResult.oldValue;\r\n const min = entity.params.getActualMin(entity, param.id);\r\n const max = entity.getParamActualMax(param.id);\r\n const r = eval(effect.conditionFormula);\r\n if (!r) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n};\r\nLEffectResult = __decorate([\r\n Common_1.MRSerializable\r\n], LEffectResult);\r\nexports.LEffectResult = LEffectResult;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/LEffectResult.ts?"); /***/ }), /***/ "./ts/mr/lively/LEventServer.ts": /*!**************************************!*\ !*** ./ts/mr/lively/LEventServer.ts ***! \**************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LEventServer = exports.LEventResult = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ts/mr/system/MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ./MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nvar LEventResult;\r\n(function (LEventResult) {\r\n LEventResult[LEventResult[\"Pass\"] = 0] = \"Pass\";\r\n LEventResult[LEventResult[\"Handled\"] = 1] = \"Handled\";\r\n})(LEventResult = exports.LEventResult || (exports.LEventResult = {}));\r\n/*\r\n\r\n[2020/12/30] Command と Event を一緒にしてしまう?\r\n----------\r\nやめたほうがよさそう。\r\n\r\n例えば倉庫からアイテムを取り出した時の「アイテムが Inventory に入った」といったイベントを考えると、\r\n倉庫から取り出す~プレイヤーのInventoryに入れるまではアトミックな操作でありたい。\r\n※もしこの2つを Command にしたとき、1つ目は成功したけど2つ目は何らかの理由で失敗したとき、取り出した Item Entity が行方不明になる。\r\nちなみに移動でBlock間を移動するのも結局 Command 分けられずアトミックな操作とした経緯がある。\r\n\r\nイベント送信のタイミングについても、仮に2つのCommandそれぞれをフックしたとして、そのハンドラの中でまた何かが起こる可能性が生まれる。\r\nそうするとアトミック性が失われるため危険度が上がる。\r\n\r\n基本は次のようになりそう?\r\n- test** で事前検証\r\n- 状態変更を行う (非Command)\r\n- イベント通知\r\n\r\n*/\r\n/**\r\n *\r\n * Command との違い\r\n * ----------\r\n * - Command: 特定の Entity や攻撃対象など、行いたい動作に対して関係者が決まっているメソッドとして使う。\r\n * - Event: Commandの前後のタイミングを他に通知して、未知の割り込み動作を許可するタイミングとして使う。\r\n */\r\nlet LEventServer = class LEventServer {\r\n constructor() {\r\n this._entries = [];\r\n }\r\n subscribe(eventId, behavior) {\r\n (0, Common_1.assert)(behavior.hasId());\r\n this._entries.push({\r\n eventId: eventId,\r\n behaviorId: behavior.id(),\r\n });\r\n }\r\n unsubscribe(eventId, behavior) {\r\n const id = behavior.id();\r\n const index = this._entries.findIndex(e => e.eventId == eventId && e.behaviorId.equals(id));\r\n if (index >= 0) {\r\n this._entries.splice(index, 1);\r\n }\r\n }\r\n publish(cctx, eventId, args) {\r\n for (const e of this._entries) {\r\n if (e.eventId == eventId) {\r\n const b = MRLively_1.MRLively.world.behavior(e.behaviorId);\r\n const r = b.onEvent(cctx, eventId, args);\r\n if (r != LEventResult.Pass) {\r\n MRSystem_1.MRSystem.integration.onEventPublished(eventId, args, true);\r\n return false;\r\n }\r\n }\r\n }\r\n MRSystem_1.MRSystem.integration.onEventPublished(eventId, args, false);\r\n return true;\r\n }\r\n};\r\nLEventServer = __decorate([\r\n Common_1.MRSerializable\r\n], LEventServer);\r\nexports.LEventServer = LEventServer;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/LEventServer.ts?"); /***/ }), /***/ "./ts/mr/lively/LFieldEffect.ts": /*!**************************************!*\ !*** ./ts/mr/lively/LFieldEffect.ts ***! \**************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LSanctuaryFieldEffect = exports.LFieldEffect = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ../data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ../system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst LEnemyBehavior_1 = __webpack_require__(/*! ./behaviors/LEnemyBehavior */ \"./ts/mr/lively/behaviors/LEnemyBehavior.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ./MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\n/**\r\n * マップ上に継続的に何らかの効果を発揮する\r\n */\r\nclass LFieldEffect {\r\n /** 指定座標がこの FieldEffect の影響範囲内であるかを確認する。 */\r\n onCheckIncludes(mx, my) { return false; }\r\n /** entity が、指定座標へ歩行による移動ができるか確認する */\r\n onCheckPossibleMovement(entity, mx, my) { return false; }\r\n onStabilizeSituation(cctx) { return SCommand_1.SCommandResponse.Pass; }\r\n}\r\nexports.LFieldEffect = LFieldEffect;\r\n/** 聖域の効果 */\r\nlet LSanctuaryFieldEffect = class LSanctuaryFieldEffect extends LFieldEffect {\r\n constructor(owner) {\r\n super();\r\n this._ownerEntityId = owner.entityId().clone();\r\n }\r\n get owner() {\r\n return MRLively_1.MRLively.world.entity(this._ownerEntityId);\r\n }\r\n onCheckIncludes(mx, my) {\r\n const owner = this.owner;\r\n return (mx == owner.mx && my == owner.my);\r\n }\r\n onCheckPossibleMovement(entity, mx, my) {\r\n const owner = this.owner;\r\n if (entity.findEntityBehavior(LEnemyBehavior_1.LEnemyBehavior)) {\r\n return !(mx == owner.mx && my == owner.my);\r\n }\r\n return true;\r\n }\r\n // 歩行侵入時に以外にも Block への侵入は様々にあるので、\r\n // カバーしきれるように onStabilizeSituation() を使う。\r\n onStabilizeSituation(cctx) {\r\n const owner = this.owner;\r\n const block = MRLively_1.MRLively.mapView.currentMap.tryGetBlock(owner.mx, owner.my);\r\n if (block) {\r\n for (const entity of block.getEntities()) {\r\n // 戦闘不能ステート 付加\r\n if (entity.findEntityBehavior(LEnemyBehavior_1.LEnemyBehavior)) {\r\n entity.addState(MRBasics_1.MRBasics.states.dead);\r\n }\r\n }\r\n }\r\n return SCommand_1.SCommandResponse.Pass;\r\n }\r\n};\r\nLSanctuaryFieldEffect = __decorate([\r\n Common_1.MRSerializable\r\n], LSanctuaryFieldEffect);\r\nexports.LSanctuaryFieldEffect = LSanctuaryFieldEffect;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/LFieldEffect.ts?"); /***/ }), /***/ "./ts/mr/lively/LFloorId.ts": /*!**********************************!*\ !*** ./ts/mr/lively/LFloorId.ts ***! \**********************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LFloorId_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LFloorId = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst DHelper_1 = __webpack_require__(/*! ts/mr/data/DHelper */ \"./ts/mr/data/DHelper.ts\");\r\nconst DLand_1 = __webpack_require__(/*! ts/mr/data/DLand */ \"./ts/mr/data/DLand.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\n/**\r\n * LandId と フロア番号によってフロアを識別するもの。\r\n *\r\n * 初期verでは少々扱いづらかったため全フロアに一意の静的なFloorId を振ることで対策したが、\r\n * 次のような問題が出てきたため、改めて用意した。\r\n * - MRシステム管理下のすべてのマップは Land 内の Floor として扱った方が都合がよい。\r\n * - 例えば固定マップで召喚の罠を踏んだ時の出現エネミーはどこのテーブルからとる?\r\n * - FloorId を静的なものにしてしまうと、動的な Land 生成に対応しづらくなる。\r\n */\r\nlet LFloorId = LFloorId_1 = class LFloorId {\r\n // public static makeByRmmzNormalMapId(mapId: number): LFloorId {\r\n // const landId = MRData.maps[mapId].landId;\r\n // assert(landId > 0);\r\n // return new LFloorId(landId, DFloorClass.EventMap, mapId);\r\n // }\r\n constructor(landId, floorNumber) {\r\n this._landId = landId;\r\n this._floorNumber = floorNumber;\r\n }\r\n static makeEmpty() {\r\n return new LFloorId_1(0, 0);\r\n }\r\n static make(landId, floorNumber) {\r\n return new LFloorId_1(landId, floorNumber);\r\n }\r\n static makeFromKeys(landKey, floorKey) {\r\n const land = MRData_1.MRData.lands.find(x => x.name == landKey);\r\n if (!land)\r\n throw new Error(`Land \"${landKey}\" not found.`);\r\n const floorNumber = land.floorInfos.findIndex(x => x && x.key == floorKey);\r\n if (floorNumber <= 0)\r\n throw new Error(`Floor \"${floorKey}\" not found.`);\r\n return new LFloorId_1(land.id, floorNumber);\r\n }\r\n // public static makeFromEventMapData(mapData: DMap): LFloorId {\r\n // const land = MRData.lands[mapData.landId];\r\n // return new LFloorId(mapData.landId, land.eventMapIds.findIndex(x => x == mapData.id));\r\n // }\r\n static makeByRmmzFixedMapName(fixedMapName) {\r\n const mapId = $dataMapInfos.findIndex(x => x && x.name == fixedMapName);\r\n const landId = MRData_1.MRData.maps[mapId].landId;\r\n const land = MRData_1.MRData.lands[landId];\r\n const floorNumber = land.findFloorNumberByMapId(mapId);\r\n (0, Common_1.assert)(floorNumber > 0);\r\n return new LFloorId_1(landId, floorNumber);\r\n }\r\n get landId() {\r\n return this._landId;\r\n }\r\n get landData() {\r\n return MRData_1.MRData.lands[this._landId];\r\n }\r\n get floorNumber() {\r\n //assert(this._floorClass == DFloorClass.FloorMap);\r\n return this._floorNumber;\r\n }\r\n // public get eventMapIndex(): number {\r\n // //assert(this._floorClass == DFloorClass.EventMap);\r\n // return this._floorNumber;\r\n // }\r\n get preset() {\r\n const id = this.floorInfo.presetId;\r\n (0, Common_1.assert)(id > 0);\r\n return MRData_1.MRData.floorPresets[id];\r\n }\r\n get isEmpty() {\r\n return !this.hasAny;\r\n }\r\n get hasAny() {\r\n if (this._landId <= 0)\r\n return false;\r\n //if (this._floorClass == DFloorClass.FloorMap) {\r\n return this._floorNumber != 0;\r\n // }\r\n // else {\r\n // return this._floorNumber >= 0;\r\n // }\r\n }\r\n equals(other) {\r\n return this._landId == other._landId && this._floorNumber == other._floorNumber;\r\n }\r\n clone() {\r\n return new LFloorId_1(this._landId, /*this._floorClass,*/ this._floorNumber);\r\n }\r\n get floorInfo() {\r\n (0, Common_1.assert)(this.hasAny);\r\n const land = MRData_1.MRData.lands[this._landId];\r\n const info = land.floorInfos[this._floorNumber];\r\n (0, Common_1.assert)(info);\r\n return info;\r\n }\r\n /** this が示すフロアへ遷移するとなったときに、ロードするべき RMMZ MapId */\r\n get rmmzMapId() {\r\n (0, Common_1.assert)(this._landId > 0);\r\n if (this._landId == DHelper_1.DHelpers.VanillaLandId) {\r\n // MRシステム管理外\r\n return this._floorNumber;\r\n }\r\n else if (this.isEventMap2) {\r\n const i = this.floorInfo.eventMapIndex;\r\n (0, Common_1.assert)(i >= 0);\r\n const mapId = this.landData.eventMapIds[i];\r\n return mapId;\r\n }\r\n else {\r\n const fixedMapId = this.rmmzFixedMapId2;\r\n if (fixedMapId > 0) {\r\n return fixedMapId;\r\n }\r\n else {\r\n return MRData_1.MRData.lands[this._landId].rmmzMapId;\r\n }\r\n }\r\n }\r\n get rmmzFixedMapId2() {\r\n const land = this.landData;\r\n const map = land.getFixedMap(this.floorNumber);\r\n return map ? map.mapId : 0;\r\n }\r\n get isEventMap2() {\r\n return this.floorInfo.floorClass == DLand_1.DFloorClass.EventMap;\r\n }\r\n get isNormalMap2() {\r\n return this._landId == DHelper_1.DHelpers.VanillaLandId;\r\n }\r\n get isRandomMap2() {\r\n if (!this.isTacticsMap2)\r\n return false;\r\n if (this.isEventMap2)\r\n return false;\r\n return this.rmmzFixedMapId2 <= 0;\r\n }\r\n get isFixedMap2() {\r\n if (!this.isTacticsMap2)\r\n return false;\r\n return this.rmmzFixedMapId2 > 0;\r\n }\r\n get isSafetyMap2() {\r\n if (this._landId == DHelper_1.DHelpers.VanillaLandId) {\r\n const mapId = this.rmmzMapId;\r\n if (MRData_1.MRData.maps[mapId].safetyMap) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n //return this.floorInfo().safetyActions;\r\n }\r\n /** Entity を登場させるマップであるか。false の場合は通常の RMMZ マップ。Entity は登場せず、Event を非表示にすることもない。 */\r\n get isTacticsMap2() {\r\n if (this._landId == DHelper_1.DHelpers.VanillaLandId)\r\n return false;\r\n return this.floorInfo.floorClass == DLand_1.DFloorClass.FloorMap;\r\n }\r\n /** FloorInfo を取ることができるか */\r\n get isDungeonMap2() {\r\n return this.floorInfo.floorClass == DLand_1.DFloorClass.FloorMap;\r\n }\r\n get isFieldMap() {\r\n return this.floorInfo.mode == DLand_1.DFloorMode.Field;\r\n }\r\n get isRMMZDefaultSystemMap2() {\r\n if (this._landId != DHelper_1.DHelpers.VanillaLandId)\r\n return false;\r\n return MRData_1.MRData.maps[this._floorNumber].defaultSystem;\r\n }\r\n};\r\nLFloorId = LFloorId_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LFloorId);\r\nexports.LFloorId = LFloorId;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/LFloorId.ts?"); /***/ }), /***/ "./ts/mr/lively/LIdentifyer.ts": /*!*************************************!*\ !*** ./ts/mr/lively/LIdentifyer.ts ***! \*************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LEntityDescription_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LIdentifyer = exports.EntityIdentificationLevel = exports.LEntityDescription = exports.DescriptionHighlightColor = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst DEntity_1 = __webpack_require__(/*! ts/mr/data/DEntity */ \"./ts/mr/data/DEntity.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst SView_1 = __webpack_require__(/*! ts/mr/system/SView */ \"./ts/mr/system/SView.ts\");\r\nvar DescriptionHighlightColor;\r\n(function (DescriptionHighlightColor) {\r\n DescriptionHighlightColor[DescriptionHighlightColor[\"Identified\"] = 0] = \"Identified\";\r\n DescriptionHighlightColor[DescriptionHighlightColor[\"Unidentified\"] = 1] = \"Unidentified\";\r\n DescriptionHighlightColor[DescriptionHighlightColor[\"UserIdentified\"] = 2] = \"UserIdentified\";\r\n DescriptionHighlightColor[DescriptionHighlightColor[\"UnitName\"] = 3] = \"UnitName\";\r\n})(DescriptionHighlightColor = exports.DescriptionHighlightColor || (exports.DescriptionHighlightColor = {}));\r\n/**\r\n * LIdentifyer を通して生成される、Entity の説明情報。\r\n *\r\n * GUI に表示するものはすべてこのオブジェクトを通さなければならない。\r\n * Entity の名前を直接表示したり、DItem の情報を直接参照することは禁止。\r\n *\r\n * これは未識別アイテムや、アイテムに化けるモンスターを表現するために必要な仕組み。\r\n */\r\nlet LEntityDescription = LEntityDescription_1 = class LEntityDescription {\r\n constructor(iconIndex, name, level, upgrades, remaining, capacity) {\r\n this._iconIndex = iconIndex;\r\n this._name = name;\r\n this._highlightLevel = level;\r\n this._upgrades = upgrades;\r\n this._remaining = remaining;\r\n this._capacity = capacity;\r\n }\r\n iconIndex() {\r\n return this._iconIndex;\r\n }\r\n name() {\r\n return this._name;\r\n }\r\n displayText() {\r\n const color = LEntityDescription_1.getColorNumber(this._highlightLevel);\r\n let text = `\\\\I[${this._iconIndex}]\\\\C[${color}]${this._name}`;\r\n if (this._upgrades != 0) {\r\n text += (this._upgrades > 0) ? `+${this._upgrades}` : this._upgrades.toString();\r\n }\r\n if (this._remaining !== undefined) {\r\n text += `[${this._remaining}]`;\r\n }\r\n if (this._capacity !== undefined) {\r\n text += `[${this._capacity}]`;\r\n }\r\n text += `\\\\C[0]`;\r\n return text;\r\n }\r\n static getColorNumber(level) {\r\n return this._levelColorTable[level];\r\n }\r\n static makeDisplayText(name, level) {\r\n return `\\\\C[${this.getColorNumber(level)}]${name}\\\\C[0]`;\r\n }\r\n};\r\nLEntityDescription._levelColorTable = [\r\n 0,\r\n 14,\r\n 3,\r\n 14,\r\n 23, // Number\r\n];\r\nLEntityDescription = LEntityDescription_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LEntityDescription);\r\nexports.LEntityDescription = LEntityDescription;\r\nvar EntityIdentificationLevel;\r\n(function (EntityIdentificationLevel) {\r\n /** 未識別。 */\r\n EntityIdentificationLevel[EntityIdentificationLevel[\"Unidentified\"] = 0] = \"Unidentified\";\r\n /** 種別識別済み。名前が黄色で表示される。説明は見ることができる。修正値や呪いの有無はわからない。 */\r\n EntityIdentificationLevel[EntityIdentificationLevel[\"KindIdentified\"] = 1] = \"KindIdentified\";\r\n /** 個体識別済み。修正値や説明文も見ることができる。 */\r\n EntityIdentificationLevel[EntityIdentificationLevel[\"IndividualIdentified\"] = 2] = \"IndividualIdentified\";\r\n})(EntityIdentificationLevel = exports.EntityIdentificationLevel || (exports.EntityIdentificationLevel = {}));\r\n/**\r\n *\r\n * インスタンスはグローバルで唯一なものとし、必要なタイミングで初期化して使う。\r\n *\r\n *\r\n * 仕様メモ\r\n * ----------\r\n *\r\n * - 新種道具は常に識別済み。\r\n *\r\n * - ダンジョン突入時、持っているアイテムは識別済み。\r\n *\r\n * - 識別済みは次の2つで現される。\r\n * - グローバルな識別済みフラグ: 種類の識別。名前がわかる。\r\n * - ローカルな識別済みフラグ: Entity 単位の識別。杖の使用回数がわかる。\r\n *\r\n * - いかすしの巻物は、未識別だと [食べる] コマンドが表示されない。\r\n *\r\n * [食べる] [読む] などはいつどうやって識別する?\r\n * ----------\r\n *\r\n * コマンド(Activity)の機能として識別するべき?\r\n * それともアイテム側の機能として「食べられたとき」に識別するべき?\r\n *\r\n *\r\n *\r\n */\r\nlet LIdentifyer = class LIdentifyer {\r\n constructor() {\r\n /*\r\n [2022/11/1] WorldMap 対応に伴う識別ルールの整理\r\n ----------\r\n - WorldMap では最も難しい識別ルールとしたい\r\n - 草など、強化値・使用回数の無いアイテムは通常通り種別識別可能。(ゲーム開始後、一度でも使えば以後名前はわかる)\r\n - ただし呪いや祝福は、個体識別するまでわからない (シレン5相当)\r\n - LandからLandへ移ったとき\r\n - 難易度の低いLandへ移ったら、全部識別する、など。(シレン2 中級→初級ルート)\r\n - Land によっては、前の Land の状態のまま維持したい。\r\n - 別の Land への移動時に清算処理するのがいいかも。\r\n \r\n */\r\n /** 種別としての識別済みフラグ。undefined の場合、その Entity は常に少なくとも名前は識別済み。 Index: DEntityId */\r\n this._identificationStates = [];\r\n }\r\n reset(land) {\r\n this._identificationStates = [];\r\n for (const kind of MRData_1.MRData.pseudonymous.kinds()) {\r\n if (land.checkIdentifiedKind(kind)) {\r\n // land 内では、この kind は常に識別状態\r\n }\r\n else {\r\n const names = MRData_1.MRData.pseudonymous.getNameList(kind.id);\r\n const entities = MRData_1.MRData.entities.filter(x => x.entity.kindId == kind.id && x.identificationDifficulty == DEntity_1.DIdentificationDifficulty.Obscure);\r\n if (names.length < entities.length) {\r\n throw new Error((0, Common_1.tr2)(`Kind:${kind.key} の pseudonym が不足しています。(c: ${names.length})`));\r\n }\r\n names.mutableShuffle();\r\n for (let i = 0; i < entities.length; i++) {\r\n const entity = entities[i];\r\n this._identificationStates[entity.id] = {\r\n nameIdentified: false,\r\n pseudonym: names[i],\r\n nickname: undefined,\r\n };\r\n }\r\n }\r\n }\r\n }\r\n identifyGlobal(entityDataId) {\r\n const state = this._identificationStates[entityDataId];\r\n if (state) {\r\n state.nameIdentified = true;\r\n }\r\n }\r\n getEntityIdentificationLevel(viewSubject, entity) {\r\n const dataId = entity.dataId;\r\n const entityData = entity.data;\r\n const state = this._identificationStates[dataId];\r\n // そもそも未識別となりえないものは識別済みとする\r\n // if (!state) {\r\n // return EntityIdentificationLevel.IndividualIdentified;\r\n // }\r\n // 種別未識別になる(=名前が仮名になる)可能性がある?\r\n if (state) {\r\n if (entity.individualIdentified()) {\r\n // 個体識別済み\r\n return EntityIdentificationLevel.IndividualIdentified;\r\n }\r\n if (state.nameIdentified) { // 呪い状態などを受けないものは、名前識別済みであれば個体識別済みとする\r\n if (entityData.allowModifierState) {\r\n return EntityIdentificationLevel.KindIdentified;\r\n }\r\n else {\r\n return EntityIdentificationLevel.IndividualIdentified;\r\n }\r\n }\r\n else {\r\n return EntityIdentificationLevel.Unidentified;\r\n }\r\n }\r\n // 種別識別という状態を持つ必要が無ければ、個体識別済みかそうでないかのみ扱う。\r\n else {\r\n if (entity.individualIdentified()) {\r\n // 個体識別済み\r\n return EntityIdentificationLevel.IndividualIdentified;\r\n }\r\n else if (!entityData.allowModifierState) {\r\n // 呪い状態などを受けないものは、名前識別済みであれば個体識別済みとする\r\n return EntityIdentificationLevel.IndividualIdentified;\r\n }\r\n else {\r\n // 個体識別されていなくても、種別はわかる\r\n return EntityIdentificationLevel.KindIdentified;\r\n }\r\n }\r\n }\r\n resolveDescription(viewSubject, entity) {\r\n const dataId = entity.dataId;\r\n const entityData = entity.data;\r\n const state = this._identificationStates[dataId];\r\n //let individualIdentified = true;\r\n //let globalIdentified = true;\r\n let baseName = \"\";\r\n let level = DescriptionHighlightColor.Identified;\r\n const entityIdentificationLevel = this.getEntityIdentificationLevel(viewSubject, entity);\r\n // 個体識別済み?\r\n if (entityIdentificationLevel == EntityIdentificationLevel.IndividualIdentified) {\r\n level = DescriptionHighlightColor.Identified;\r\n }\r\n if (entityIdentificationLevel <= EntityIdentificationLevel.KindIdentified) {\r\n level = DescriptionHighlightColor.Unidentified;\r\n if (state) {\r\n if (state.nickname) {\r\n level = DescriptionHighlightColor.UserIdentified;\r\n baseName = state.nickname;\r\n }\r\n else {\r\n baseName = state.pseudonym;\r\n }\r\n }\r\n }\r\n // 呪い状態などを受けないものは、名前識別済みであれば個体識別済みとする\r\n // if (globalIdentified && !entityData.canModifierState) {\r\n // individualIdentified = true;\r\n // level = DescriptionHighlightColor.Identified;\r\n // }\r\n const nameView = SView_1.SView.getLookNames(viewSubject, entity);\r\n let displayName = baseName;\r\n if (entityIdentificationLevel >= EntityIdentificationLevel.KindIdentified) {\r\n displayName = nameView.name;\r\n }\r\n let upgrades = 0;\r\n if (entityIdentificationLevel >= EntityIdentificationLevel.IndividualIdentified) {\r\n upgrades = nameView.upgrades;\r\n }\r\n let remaining = undefined;\r\n if (nameView.remaining !== undefined && nameView.initialRemaining) {\r\n if (entityIdentificationLevel <= EntityIdentificationLevel.KindIdentified) {\r\n // 何かしら未識別?\r\n remaining = nameView.remaining - nameView.initialRemaining;\r\n // 未識別で1回も使用していない場合は回数欄は表示しない\r\n if (remaining === 0)\r\n remaining = undefined;\r\n }\r\n else {\r\n // 識別済み\r\n remaining = nameView.remaining;\r\n }\r\n }\r\n let capacity = undefined;\r\n if (nameView.capacity !== undefined) {\r\n capacity = nameView.capacity;\r\n }\r\n let iconIndex = nameView.iconIndex;\r\n if (entityIdentificationLevel <= EntityIdentificationLevel.KindIdentified) {\r\n // 何かしら未識別?\r\n }\r\n else if (entityIdentificationLevel >= EntityIdentificationLevel.IndividualIdentified) {\r\n // 個体識別済み\r\n const states = entity.states;\r\n if (states.length > 0) {\r\n // 祝福など、アイコン表示したいステートが付いているか?\r\n const state = states.find(x => x.stateData().displayNameIcon);\r\n if (state) {\r\n iconIndex = state.stateData().iconIndex;\r\n }\r\n }\r\n }\r\n return new LEntityDescription(iconIndex, displayName, level, upgrades, remaining, capacity);\r\n }\r\n checkGlobalIdentified(entity) {\r\n const dataId = entity.dataId;\r\n const state = this._identificationStates[dataId];\r\n if (!state)\r\n return true;\r\n else\r\n return state.nameIdentified;\r\n }\r\n setNickname(dataId, nickname) {\r\n const state = this._identificationStates[dataId];\r\n if (state) {\r\n state.nickname = nickname;\r\n }\r\n }\r\n // ユーティリティ\r\n makeDisplayText(viewSubject, entity) {\r\n return this.resolveDescription(viewSubject, entity).displayText();\r\n }\r\n};\r\nLIdentifyer = __decorate([\r\n Common_1.MRSerializable\r\n], LIdentifyer);\r\nexports.LIdentifyer = LIdentifyer;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/LIdentifyer.ts?"); /***/ }), /***/ "./ts/mr/lively/LJournal.ts": /*!**********************************!*\ !*** ./ts/mr/lively/LJournal.ts ***! \**********************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LJournal = exports.LChallengingStatus = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ../data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ../system/MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nvar LChallengingStatus;\r\n(function (LChallengingStatus) {\r\n LChallengingStatus[LChallengingStatus[\"None\"] = 0] = \"None\";\r\n LChallengingStatus[LChallengingStatus[\"Challenging\"] = 1] = \"Challenging\";\r\n})(LChallengingStatus = exports.LChallengingStatus || (exports.LChallengingStatus = {}));\r\n/**\r\n * ひとつの \"冒険\" に関する情報を表現するクラス\r\n *\r\n * World から Land に入ったときに初期化される。\r\n * Land 間移動では初期化されない。\r\n */\r\nlet LJournal = class LJournal {\r\n //private _entranceLandId: DLandId;\r\n constructor() {\r\n this._status = LChallengingStatus.None;\r\n this._exitResult = MRData_1.LandExitResult.Challenging;\r\n //this._entranceLandId = 0;\r\n }\r\n /** 最期の冒険の結果。次の冒険を開始するまでは値は維持される。 */\r\n get exitResult() {\r\n return this._exitResult;\r\n }\r\n get exitResultSummary() {\r\n return this._exitResult / 100;\r\n }\r\n /** 冒険の継続中であるか */\r\n get isChallenging() {\r\n return this._status == LChallengingStatus.Challenging;\r\n }\r\n /** ゲームオーバーなど、ペナルティを伴う挑戦結果であるか。 */\r\n get isPenaltyResult() {\r\n return MRData_1.LandExitResult.Gameover <= this._exitResult;\r\n }\r\n /** 冒険開始。基本的に拠点での起床時に開始する。拠点マップ(World)に居る時も、冒険中とみなす。(倉庫とかで倒れたりするので) */\r\n startChallenging( /*entryLandId: DLandId*/) {\r\n // 複数回に実行は許可する。\r\n //this._entranceLandId = entryLandId;\r\n this._exitResult = MRData_1.LandExitResult.Challenging;\r\n this._status = LChallengingStatus.Challenging;\r\n }\r\n /** 冒険終了 */\r\n finishChallenging() {\r\n this._status = LChallengingStatus.None;\r\n }\r\n /** 何らかの理由で Land から離脱 */\r\n commitLandResult(result) {\r\n this._exitResult = result;\r\n MRSystem_1.MRSystem.integration.onSetLandExitResult(result);\r\n }\r\n};\r\nLJournal = __decorate([\r\n Common_1.MRSerializable\r\n], LJournal);\r\nexports.LJournal = LJournal;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/LJournal.ts?"); /***/ }), /***/ "./ts/mr/lively/LLand.ts": /*!*******************************!*\ !*** ./ts/mr/lively/LLand.ts ***! \*******************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LLand = void 0;\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst LIdentifyer_1 = __webpack_require__(/*! ./LIdentifyer */ \"./ts/mr/lively/LIdentifyer.ts\");\r\nlet LLand = class LLand {\r\n constructor(landDataId) {\r\n this._landDataId = 0;\r\n this.identifyer = new LIdentifyer_1.LIdentifyer();\r\n this._landDataId = landDataId.id;\r\n }\r\n landData() {\r\n return MRData_1.MRData.lands[this._landDataId];\r\n }\r\n maxFloorNumber() {\r\n return this.landData().floorInfos.length - 1;\r\n }\r\n resetIdentifyer() {\r\n this.identifyer.reset(this.landData());\r\n }\r\n};\r\nLLand = __decorate([\r\n Common_1.MRSerializable\r\n], LLand);\r\nexports.LLand = LLand;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/LLand.ts?"); /***/ }), /***/ "./ts/mr/lively/LMap.ts": /*!******************************!*\ !*** ./ts/mr/lively/LMap.ts ***! \******************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LMap = exports.MovingMethod = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst LBlock_1 = __webpack_require__(/*! ./LBlock */ \"./ts/mr/lively/LBlock.ts\");\r\nconst LEntity_1 = __webpack_require__(/*! ./entity/LEntity */ \"./ts/mr/lively/entity/LEntity.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ./MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst Helpers_1 = __webpack_require__(/*! ts/mr/system/Helpers */ \"./ts/mr/system/Helpers.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ts/mr/system/MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst Vector2_1 = __webpack_require__(/*! ts/mr/math/Vector2 */ \"./ts/mr/math/Vector2.ts\");\r\nconst LObject_1 = __webpack_require__(/*! ./LObject */ \"./ts/mr/lively/LObject.ts\");\r\nconst LRoom_1 = __webpack_require__(/*! ./LRoom */ \"./ts/mr/lively/LRoom.ts\");\r\nconst LStructure_1 = __webpack_require__(/*! ./structures/LStructure */ \"./ts/mr/lively/structures/LStructure.ts\");\r\nconst FStructure_1 = __webpack_require__(/*! ts/mr/floorgen/FStructure */ \"./ts/mr/floorgen/FStructure.ts\");\r\nconst LMonsterHouseStructure_1 = __webpack_require__(/*! ./structures/LMonsterHouseStructure */ \"./ts/mr/lively/structures/LMonsterHouseStructure.ts\");\r\nconst LFloorId_1 = __webpack_require__(/*! ./LFloorId */ \"./ts/mr/lively/LFloorId.ts\");\r\nconst UMovement_1 = __webpack_require__(/*! ts/mr/utility/UMovement */ \"./ts/mr/utility/UMovement.ts\");\r\nconst LItemShopStructure_1 = __webpack_require__(/*! ./structures/LItemShopStructure */ \"./ts/mr/lively/structures/LItemShopStructure.ts\");\r\nconst DCommon_1 = __webpack_require__(/*! ../data/DCommon */ \"./ts/mr/data/DCommon.ts\");\r\nconst UBlock_1 = __webpack_require__(/*! ../utility/UBlock */ \"./ts/mr/utility/UBlock.ts\");\r\nconst USearch_1 = __webpack_require__(/*! ../utility/USearch */ \"./ts/mr/utility/USearch.ts\");\r\nvar MovingMethod;\r\n(function (MovingMethod) {\r\n MovingMethod[MovingMethod[\"Walk\"] = 0] = \"Walk\";\r\n MovingMethod[MovingMethod[\"Projectile\"] = 1] = \"Projectile\";\r\n MovingMethod[MovingMethod[\"Penetration\"] = 2] = \"Penetration\";\r\n})(MovingMethod = exports.MovingMethod || (exports.MovingMethod = {}));\r\n/**\r\n * マップオブジェクト。\r\n *\r\n * RMMZ のマップに対応するものでは無く、 Floor に対応するものである点に注意。\r\n * ID は RMMZ のマップ ID ではなく、 FloorId である。\r\n *\r\n * インスタンスは NewGame 時には存在しない。\r\n * 始めてそのマップへ遷移したときに生成され、以後は World に管理される Object としえ永久的に存在する。\r\n * これは Game_Actors と同じく、セーブデータの引継ぎに対応するための仕組みである。\r\n *\r\n */\r\nlet LMap = class LMap extends LObject_1.LObject {\r\n constructor(floorId) {\r\n super(LObject_1.LObjectType.Map);\r\n this._floorId = LFloorId_1.LFloorId.makeEmpty();\r\n this._width = 0;\r\n this._height = 0;\r\n this._blocks = [];\r\n this._entityIds = []; // マップ内に登場している Entity\r\n this._rooms = [];\r\n this._structures = [];\r\n this._mapdataRevision = 1;\r\n this._roundCount = 0;\r\n // 巻物による気配察知・道具感知効果。\r\n // Trait とは別物。Trait は腕輪など装備品と共に使うが、こちらは巻物など一度効果を受けたらあとは永続するもの。\r\n this.unitClarity = false;\r\n this.itemClarity = false;\r\n this.trapClarity = false; // マップ上の罠が見える: 敵味方問わず罠が見えるようになる。\r\n this.sightClarity = false; // 視界明瞭?\r\n this.keeperCount = 0;\r\n this.lastKeeperCount = 0;\r\n this._floorId = floorId.clone();\r\n this.uniqueSpawners = {};\r\n }\r\n isGCReady() {\r\n return false; // 自動削除しない\r\n }\r\n setup(mapData) {\r\n this.uniqueSpawners = {};\r\n this.unitClarity = false;\r\n this.itemClarity = false;\r\n this.trapClarity = false;\r\n this.sightClarity = false;\r\n this.build(mapData);\r\n }\r\n setupForRMMZDefaultMap() {\r\n this.setupEmptyMap(1, 1);\r\n }\r\n mapdataRevision() {\r\n return this._mapdataRevision;\r\n }\r\n increaseRevision() {\r\n this._mapdataRevision++;\r\n }\r\n roundCount() {\r\n return this._roundCount;\r\n }\r\n increaseRoundCount() {\r\n this._roundCount++;\r\n }\r\n get hasMapData() {\r\n return this._blocks.length > 0;\r\n }\r\n setupEmptyMap(width, height) {\r\n this._width = width;\r\n this._height = height;\r\n const count = this._width * this._height;\r\n this._blocks = new Array(count);\r\n for (let i = 0; i < count; i++) {\r\n const x = Math.trunc(i % this._width);\r\n const y = Math.trunc(i / this._width);\r\n this._blocks[i] = new LBlock_1.LBlock(x, y);\r\n this._blocks[i]._tileShape = LBlock_1.LTileShape.Floor;\r\n }\r\n }\r\n build(data) {\r\n this._roundCount = 0;\r\n {\r\n const width = data.fullWidth;\r\n const height = data.fullHeight;\r\n this.setupEmptyMap(width, height);\r\n for (let y = 0; y < height; y++) {\r\n for (let x = 0; x < width; x++) {\r\n const dataBlock = data.block(x, y);\r\n const mapBlock = this.block(x, y);\r\n const kind = dataBlock.tileShape();\r\n //const tile = mapBlock.tile();\r\n //const attr = tile.findAttribute(RETileAttribute);\r\n //assert(attr);\r\n //attr.setTileKind(kind);\r\n mapBlock._tileShape = kind;\r\n mapBlock._roomId = dataBlock.roomId();\r\n mapBlock._blockComponent = dataBlock.component();\r\n mapBlock._continuation = dataBlock.isContinuation();\r\n mapBlock._roomInnerEntrance = dataBlock.isDoorway();\r\n mapBlock._shapeVisualPartIndex = dataBlock.shapeVisualPartIndex;\r\n mapBlock._decorationVisualPartIndex = dataBlock.decorationVisualPartIndex;\r\n }\r\n }\r\n // Create Rooms\r\n this._rooms = data.rooms_raw().map(x => {\r\n const r = new LRoom_1.LRoom();\r\n r.setup(x);\r\n return r;\r\n });\r\n // Create Structures\r\n this._structures = [new LStructure_1.LStructure(0)]; // dummy\r\n for (const x of data.structures()) {\r\n if (x instanceof FStructure_1.FMonsterHouseStructure) {\r\n const s = new LMonsterHouseStructure_1.LMonsterHouseStructure(this._structures.length);\r\n s.setup(x.roomId(), x.monsterHouseTypeId());\r\n this._structures.push(s);\r\n }\r\n else if (x instanceof FStructure_1.FItemShopStructure) {\r\n const s = new LItemShopStructure_1.LItemShopStructure(this._structures.length);\r\n s.setup(x.roomId(), x.itemShopTypeId());\r\n this._structures.push(s);\r\n }\r\n else {\r\n throw new Error(\"Invalid Structure type.\");\r\n }\r\n }\r\n }\r\n }\r\n releaseMap() {\r\n this._removeAllEntities();\r\n this._width = 0;\r\n this._height = 0;\r\n this._blocks = [];\r\n }\r\n isValid() {\r\n return this._floorId.hasAny && this._width > 0;\r\n }\r\n floorId() {\r\n return this._floorId;\r\n }\r\n rooms() {\r\n return this._rooms;\r\n }\r\n room(roomId) {\r\n return this._rooms[roomId];\r\n }\r\n get isSingleRoomMap() {\r\n // [0] はダミー要素なので、 2 でチェック\r\n return this._rooms.length == 2;\r\n }\r\n structures() {\r\n return this._structures;\r\n }\r\n land2() {\r\n return MRLively_1.MRLively.world.land(this._floorId.landId);\r\n }\r\n floorData() {\r\n return this.land2().landData().floorInfos[this._floorId.floorNumber];\r\n }\r\n width() {\r\n return this._width;\r\n }\r\n height() {\r\n return this._height;\r\n }\r\n /*\r\n isFixedMap(): boolean {\r\n return REData.maps[this._floorId]?.mapKind == REFloorMapKind.FixedMap;\r\n }\r\n\r\n isRandomMap(): boolean {\r\n return REData.maps[this._floorId]?.mapKind == REFloorMapKind.RandomMap;\r\n }\r\n */\r\n blocks() {\r\n return this._blocks;\r\n }\r\n block(a1, a2) {\r\n let x, y;\r\n if (a1 instanceof Vector2_1.Vector2) {\r\n x = a1.x;\r\n y = a1.y;\r\n }\r\n else {\r\n x = a1;\r\n y = a2;\r\n }\r\n if (x < 0 || this._width <= x || y < 0 || this._height <= y) {\r\n return MRLively_1.MRLively.borderWall;\r\n }\r\n else {\r\n return this._blocks[y * this._width + x];\r\n }\r\n }\r\n tryGetBlock(x, y) {\r\n if (x < 0 || this._width <= x || y < 0 || this._height <= y) {\r\n return undefined;\r\n }\r\n else {\r\n return this._blocks[y * this._width + x];\r\n }\r\n }\r\n /**\r\n *\r\n * distance=0 の時は足元。\r\n * distance=1 の時は外周1マス。\r\n */\r\n getEdgeBlocks(x, y, distance) {\r\n (0, Common_1.assert)(distance >= 0);\r\n const result = [];\r\n if (distance == 0) {\r\n const block = this.tryGetBlock(x, y);\r\n if (block)\r\n result.push(block);\r\n }\r\n else {\r\n const x1 = x - distance;\r\n const y1 = y - distance;\r\n const x2 = x + distance;\r\n const y2 = y + distance;\r\n const count = distance * 2;\r\n /* ↓ここを始点に、時計回りに列挙していく。\r\n * uuuur\r\n * l r\r\n * l r\r\n * l r\r\n * ldddd\r\n */\r\n for (let i = 0; i < count; i++) {\r\n const block = this.tryGetBlock(x1 + i, y1);\r\n if (block)\r\n result.push(block);\r\n }\r\n for (let i = 0; i < count; i++) {\r\n const block = this.tryGetBlock(x2, y1 + i);\r\n if (block)\r\n result.push(block);\r\n }\r\n for (let i = 0; i < count; i++) {\r\n const block = this.tryGetBlock(x2 - i, y2);\r\n if (block)\r\n result.push(block);\r\n }\r\n for (let i = 0; i < count; i++) {\r\n const block = this.tryGetBlock(x1, y2 - i);\r\n if (block)\r\n result.push(block);\r\n }\r\n }\r\n return result;\r\n }\r\n /** \"部屋\" 内の \"床\" である Block を取得する */\r\n roomFloorBlocks() {\r\n return this._blocks.filter(b => b.isRoom() && b.tileShape() == LBlock_1.LTileShape.Floor);\r\n }\r\n /**\r\n * NPC や Enemy が出現可能な Block を取得する。\r\n *\r\n * - 既に Unit が存在している Block は対象外。\r\n * - 地続きではない Block も取得する。(堀内部や埋蔵金部屋)\r\n */\r\n getSpawnableBlocks(layer) {\r\n return this.roomFloorBlocks().filter(b => !b.layer(layer).isContainsAnyEntity());\r\n }\r\n isValidPosition(x, y) {\r\n return 0 <= x && x < this._width && 0 <= y && y < this._height;\r\n //return (0 <= x|| x < this._width || 0 <= y || y < this._height);\r\n //return (x < 0 || this._width <= x || y < 0 || this._height <= y);\r\n }\r\n roomId(a1, a2) {\r\n if (a1 instanceof LEntity_1.LEntity) {\r\n return this.roomId(a1.mx, a1.my);\r\n }\r\n else {\r\n return this.block(a1, a2)._roomId;\r\n }\r\n }\r\n entities() {\r\n return this._entityIds\r\n .map(id => { return MRLively_1.MRLively.world.entity(id); })\r\n .filter((e) => { return e != undefined; });\r\n }\r\n iterateEntities(func, fromTraits = false) {\r\n for (const id of this._entityIds) {\r\n const entity = MRLively_1.MRLively.world.entity(id);\r\n if (func(entity) === false)\r\n return false;\r\n }\r\n return true;\r\n }\r\n /** entity の視界内の Entity を取得する */\r\n getInsightEntities(subject) {\r\n return this.entities().filter(x => USearch_1.USearch.checkInSightEntity(subject, x));\r\n }\r\n // withOuter: 部屋の外周1マスも含むかどうか\r\n // public entitiesInRoom(roomId: LRoomId, withOuter: boolean): LEntity[] {\r\n // if (withOuter) {\r\n // const room = this.room(roomId);\r\n // const outers: LBlock[] = [];\r\n // room.forEachEdgeBlocks(b => outers.push(b));\r\n // return this.entities().filter(entity => this.roomId(entity) == roomId || (outers.find(b => b.mx == entity.mx && b.my == entity.my) != undefined));\r\n // }\r\n // else {\r\n // return this.entities().filter(entity => this.roomId(entity) == roomId);\r\n // }\r\n // }\r\n _addEntityInternal(entity) {\r\n // 新規で追加するほか、マップロード時に、そのマップに存在することになっている Entity の追加でも使うので、\r\n // floorId は外部で設定済みであることを前提とする。\r\n (0, Common_1.assert)(entity.floorId.equals(this.floorId()));\r\n (0, Common_1.assert)(entity.entityId().hasAny());\r\n (0, Common_1.assert)(!entity.hasParent());\r\n this._entityIds.push(entity.entityId());\r\n entity.setParent(this);\r\n entity.iterateBehaviorsReverse(b => {\r\n b.onEnteredMap(entity, this);\r\n return true;\r\n });\r\n }\r\n /**\r\n * Entity を現在の Floor の指定座標に登場させる。\r\n * @param entity\r\n * @param x\r\n * @param y\r\n * 既に現在の Floor 上に登場済みの Entity に対してこのメソッドを呼び出すと失敗する。\r\n */\r\n appearEntity(entity, x, y, layer) {\r\n (0, Common_1.assert)(entity.floorId.isEmpty);\r\n entity.floorId = this.floorId();\r\n this.locateEntity(entity, x, y, layer);\r\n this._addEntityInternal(entity);\r\n MRLively_1.MRLively.mapView.onEntityEnteredFromMap(entity);\r\n }\r\n // appearEntity の、マップ遷移時用\r\n // _reappearEntity(entity: LEntity): void {\r\n // assert(entity.floorId.equals(this.floorId()));\r\n // if (entity.isOnOffstage()) {\r\n // // ランダムマップ遷移時、Player などの UniqueEntity はこの状態になる\r\n // this._addEntityInternal(entity);\r\n // }\r\n // else {\r\n // const block = this.block(entity.mx, entity.my);\r\n // const layer = entity.getHomeLayer();\r\n // block.addEntity(layer, entity);\r\n // UMovement._postLocate(entity, undefined, block, this, undefined);\r\n // this._addEntityInternal(entity);\r\n // }\r\n // }\r\n _removeEntity(entity) {\r\n this._entityIds = this._entityIds.filter(x => !x.equals(entity.entityId()));\r\n this._removeEntityHelper(entity);\r\n }\r\n _removeAllEntities() {\r\n this._entityIds.forEach(x => {\r\n const entity = MRLively_1.MRLively.world.entity(x);\r\n this._removeEntityHelper(entity);\r\n //_removeEntity(entity);\r\n //entity.floorId = 0;\r\n //REGame.integration.onEntityLeavedMap(entity);\r\n });\r\n this._entityIds = [];\r\n }\r\n _removeEntityHelper(entity) {\r\n //assert(entity.ownerIsMap());\r\n //entity.clearOwner();\r\n (0, Common_1.assert)(entity.floorId.equals(this.floorId()));\r\n if (entity.floorId.isTacticsMap2) {\r\n const block = this.block(entity.mx, entity.my);\r\n block.removeEntity(entity);\r\n // MapData 未ロード時には、block には Entity が含まれていないこともあるため、\r\n // 本当に削除できたかのチェックは不要。\r\n }\r\n else {\r\n // RESystem 外のマップでは block を作っていないこともある\r\n }\r\n entity.floorId = LFloorId_1.LFloorId.makeEmpty();\r\n entity.clearParent();\r\n MRLively_1.MRLively.mapView.onEntityRemovedFromMap(entity);\r\n }\r\n onRemoveChild(obj) {\r\n if (obj instanceof LEntity_1.LEntity) {\r\n this._removeEntity(obj);\r\n }\r\n }\r\n /**\r\n * Entity の位置設定\r\n *\r\n * entity は map に追加済みであること。\r\n *\r\n * - moveEntity() と異なり、移動可能判定を行わずに強制移動する。\r\n * - マップ生成時の Entity 配置や、ワープ移動などで使用する。\r\n * - Visual に対して位置合わせを通知するため、歩行などアニメーションを伴う移動での使用は禁止。\r\n * - 侵入判定を伴う。\r\n */\r\n locateEntity(entity, x, y, toLayer) {\r\n //const map = MRLively.mapView.currentMap;\r\n (0, Common_1.assert)(entity.floorId.equals(this.floorId()));\r\n const oldBlock = this.block(entity.mx, entity.my);\r\n const newBlock = this.block(x, y);\r\n (0, Common_1.assert)(newBlock);\r\n const layer = (toLayer) ? toLayer : entity.getHomeLayer();\r\n oldBlock.removeEntity(entity);\r\n entity.mx = x;\r\n entity.my = y;\r\n newBlock.addEntity(layer, entity);\r\n UMovement_1.UMovement._postLocate(entity, oldBlock, newBlock, this, undefined);\r\n // Located 通知。これはアニメを伴う移動時は通知したくないのでここで行う。\r\n MRSystem_1.MRSystem.integration.onEntityLocated(entity);\r\n }\r\n /**\r\n * 指定した Block へ Entity が侵入できるか。\r\n */\r\n canMoveEntering(block, entity, method, layer) {\r\n if (method == MovingMethod.Walk) {\r\n if (UBlock_1.UBlock.checkPurifier(block, entity))\r\n return false; // 聖域の巻物とかがある\r\n }\r\n switch (method) {\r\n case MovingMethod.Walk:\r\n return !block.layers()[layer].isOccupied() && block.tileShape() == LBlock_1.LTileShape.Floor;\r\n case MovingMethod.Projectile:\r\n return !block.layers()[layer].isOccupied() && !block.isWallLikeShape();\r\n case MovingMethod.Penetration:\r\n return !block.layers()[layer].isOccupied();\r\n default:\r\n throw new Error(\"Not implemented.\");\r\n }\r\n }\r\n canLeaving(block, entity) {\r\n // TODO: 壁抜けや浮遊状態で変わる\r\n return /*!block->isOccupied() &&*/ block.tileShape() == LBlock_1.LTileShape.Floor;\r\n }\r\n // NOTE: 斜め移動の禁止は、隣接タイルや Entity が、自分の角を斜め移動可能とするか、で検知したほうがいいかも。\r\n // シレン5石像の洞窟の石像は、Entity扱いだが斜め移動禁止。\r\n // ちなみに、丸太の罠等では斜めすり抜けできる。\r\n // deprecated: use SMomementCommon\r\n checkPassage(entity, dir, method, toLayer) {\r\n const offset = Helpers_1.Helpers.dirToTileOffset(dir);\r\n const oldBlock = this.block(entity.mx, entity.my);\r\n const newBlock = this.block(entity.mx + offset.x, entity.my + offset.y);\r\n const layer = (toLayer) ? toLayer : entity.getHomeLayer();\r\n if (this.canLeaving(oldBlock, entity) && this.canMoveEntering(newBlock, entity, method, layer)) {\r\n return true;\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n /** 指定した Entity が、このマップ上に出現しているかを確認する。 */\r\n checkAppearing(entity) {\r\n return this._floorId.equals(entity.floorId) && !entity.isOnOffstage();\r\n }\r\n updateLocatedResults(cctx) {\r\n for (const entity of this.entities()) {\r\n if (entity._located) {\r\n for (const s of this._structures) {\r\n s.onEntityLocated(cctx, entity);\r\n }\r\n entity._located = false;\r\n }\r\n }\r\n }\r\n // Map 内に存在するが Block に含まれていない Entity を Block に追加する。\r\n // これは MapData が無いときに追加された Entity の状態を正常な状態にするために行う。\r\n refreshLocateToBlockAllEntites() {\r\n for (const entity of this.entities()) {\r\n const block = this.block(entity.mx, entity.my);\r\n (0, Common_1.assert)(block);\r\n if (!block.containsEntity(entity)) {\r\n const layer = entity.getHomeLayer();\r\n block.addEntity(layer, entity);\r\n if (!entity.isOnOffstage()) {\r\n UMovement_1.UMovement._postLocate(entity, undefined, block, this, undefined);\r\n }\r\n }\r\n }\r\n }\r\n needsRebuild() {\r\n const info = this._floorId.floorInfo;\r\n if (info.unique) {\r\n if (this._blocks.length == 0) {\r\n return true;\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n shouldUnloadAtMapTransferred() {\r\n return !this._floorId.floorInfo.unique;\r\n }\r\n updateFootpoints() {\r\n for (const block of this._blocks) {\r\n block.updateFootpoints();\r\n }\r\n }\r\n //----------\r\n // Helpers\r\n /** 足元の Entity を取得する */\r\n firstFeetEntity(entity) {\r\n const block = this.block(entity.mx, entity.my);\r\n const layer = block.layer(DCommon_1.DBlockLayerKind.Ground);\r\n return layer.firstEntity();\r\n }\r\n};\r\nLMap = __decorate([\r\n Common_1.MRSerializable\r\n], LMap);\r\nexports.LMap = LMap;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/LMap.ts?"); /***/ }), /***/ "./ts/mr/lively/LMapView.ts": /*!**********************************!*\ !*** ./ts/mr/lively/LMapView.ts ***! \**********************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LMapView = void 0;\r\nconst MRLively_1 = __webpack_require__(/*! ./MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ts/mr/system/MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst LObject_1 = __webpack_require__(/*! ./LObject */ \"./ts/mr/lively/LObject.ts\");\r\nconst LFloorId_1 = __webpack_require__(/*! ./LFloorId */ \"./ts/mr/lively/LFloorId.ts\");\r\nconst LUnitBehavior_1 = __webpack_require__(/*! ./behaviors/LUnitBehavior */ \"./ts/mr/lively/behaviors/LUnitBehavior.ts\");\r\nconst STransferMapDialog_1 = __webpack_require__(/*! ../system/dialogs/STransferMapDialog */ \"./ts/mr/system/dialogs/STransferMapDialog.ts\");\r\n/**\r\n * 始点位置。ツクールの Game_Player と連携する。\r\n *\r\n * ツクールのマップ移動=Game_Player の移動であるように、RE でもマップ移動=Camera の移動、となる。\r\n *\r\n *\r\n * 移動処理の整理\r\n * ----------\r\n * まず前提として、すべての Entity は必ず何らかのフロアに属する。\r\n * これは REシステム管理外のマップへ遷移するときも同様で、例えばプレイヤーキャラクターが REシステム管理外の ワールドマップのようなマップへ移動するとき、\r\n * ワールドマップを MapId:5 とすると、プレイヤーキャラクターの Entity は FloorId{land:0, floorNumber:5} に存在することとなる。\r\n *\r\n * > こうしておかないと、ゲームオーバーなどで強制フロア移動するときに REシステムとしての遷移先が見つからない事態になってしまう。\r\n *\r\n * ### 考えられる移動手段の例\r\n * - [場所移動] イベントコマンドによる、ランダムマップフロアへの移動 (REシステム内外関係なし)\r\n * - [場所移動] イベントコマンドによる、固定マップフロアへの移動 (REシステム内外関係なし)\r\n * - [場所移動] イベントコマンドによる、固定マップへの直接移動 (REシステム内外関係なし)\r\n * - 階段を \"降りる\" 等のアクションによる、フロア間の移動\r\n * - \"ゲームオーバー\" や \"脱出の巻物\"、\"イベント\" 等による、別 Land への移動\r\n * - \"ゲームオーバー\" や \"脱出の巻物\"、\"イベント\" 等による、REシステム管理外のマップへの移動\r\n *\r\n *\r\n * ### フロア移動を伴う場合は、必ず RMMZ 側の [場所移動] を行うようにする\r\n *\r\n * つまり $gamePlayer.reserveTransfar() を実行する、ということ。\r\n *\r\n * 階段を進むことによるランダムフロア間の移動では RMMZ としてのマップが変わることは無いためマップデータをロードする必要はないのだが、\r\n * これ以外のケースでは全て RMMZ マップのロードが必要になる。\r\n * ランダムフロア間の移動は最もメジャーであるが内部処理的にはこれ用に特別な処理が必要になる。でもそれはやめてシンプルにしたい。\r\n * そのため「フロアを移動するときは RMMZ 側の [場所移動] を行う」とする。\r\n *\r\n * ### 処理の流れ\r\n *\r\n * 1. $gamePlayer.reserveTransfar() を呼び出す\r\n * - REシステム外からは、イベントコマンドの [場所移動] により呼び出される。\r\n * - REシステム (特にコマンドチェーン) 内からは、REIntegration.onReserveTransferMap() を経由して呼び出される。\r\n * 2. RMMZ コアスクリプトの既定の流れでマップ遷移が行われる\r\n * 3. 既定の Game_Map.setup() 後、performFloorTransfer() で現在の $gameMap や $dataMap を元にフロアを構築する。\r\n *\r\n */\r\nlet LMapView = class LMapView {\r\n constructor() {\r\n this._focusedEntityId = LObject_1.LEntityId.makeEmpty();\r\n this.currentFloorId = LFloorId_1.LFloorId.makeEmpty();\r\n this.initializing = true;\r\n /** @deprecated */\r\n // private reserveFloorTransfer(floorId: LFloorId, x: number, y: number, d: number): void {\r\n // this._transferingNewFloorId = floorId;\r\n // this._transferingNewX = x;\r\n // this._transferingNewY = y;\r\n // MRSystem.integration.onReserveTransferMap(floorId.rmmzMapId(), x, y, d);\r\n // }\r\n // clearFloorTransfering() {\r\n // this._transferingNewFloorId = LFloorId.makeEmpty();\r\n // this._transferingNewX = 0;\r\n // this._transferingNewY = 0;\r\n // }\r\n }\r\n // private _transferingNewFloorId: LFloorId = LFloorId.makeEmpty();\r\n // private _transferingNewX: number = 0;\r\n // private _transferingNewY: number = 0;\r\n get currentMap() {\r\n return MRLively_1.MRLively.world.map(this.currentFloorId);\r\n }\r\n focusedEntityId() {\r\n return this._focusedEntityId;\r\n }\r\n /**\r\n * 現在フォーカスのある Entity を取得します。\r\n * 取得した Entity は、必ずしも Player ではない点に注意してください。\r\n * 操作中の Player を取得したい場合は LSystem.mainPlayerEntity を使用してください。\r\n */\r\n focusedEntity() {\r\n if (!this._focusedEntityId.hasAny())\r\n return undefined;\r\n return MRLively_1.MRLively.world.entity(this._focusedEntityId);\r\n }\r\n getFocusedEntity() {\r\n const entity = this.focusedEntity();\r\n (0, Common_1.assert)(entity);\r\n return entity;\r\n }\r\n focus(entity) {\r\n const oldEntity = this.focusedEntity();\r\n if (oldEntity) {\r\n const unit = oldEntity.findEntityBehavior(LUnitBehavior_1.LUnitBehavior);\r\n if (unit) {\r\n unit.setManualMovement(false);\r\n }\r\n }\r\n this._focusedEntityId = entity.entityId();\r\n this.currentFloorId = entity.floorId.clone();\r\n const unit = entity.findEntityBehavior(LUnitBehavior_1.LUnitBehavior);\r\n if (unit) {\r\n unit.setManualMovement(true);\r\n }\r\n }\r\n clearFocus() {\r\n this._focusedEntityId = LObject_1.LEntityId.makeEmpty();\r\n }\r\n get isFastForward() {\r\n const entty = this.focusedEntity();\r\n if (!entty)\r\n return false;\r\n const behavior = entty.findEntityBehavior(LUnitBehavior_1.LUnitBehavior);\r\n if (!behavior)\r\n return false;\r\n return behavior.dashInfo != undefined || behavior._fastforwarding;\r\n }\r\n // isFloorTransfering(): boolean {\r\n // return this._transferingNewFloorId.hasAny();\r\n // }\r\n // transferingNewFloorId(): LFloorId {\r\n // return this._transferingNewFloorId;\r\n // }\r\n // _reserveFloorTransferToFocusedEntity(cctx: SCommandContext): void {\r\n // const entity = this.focusedEntity();\r\n // if (entity) {\r\n // //cctx.openDialog(entity, new STransferMapDialog(STransferMapSource.FromCommand, entity.floorId, entity.mx, entity.my, 2), false);\r\n // MRSystem.dialogContext.open(new STransferMapDialog(STransferMapSource.FromCommand, entity.floorId, entity.mx, entity.my, entity.dir));\r\n // this.currentFloorId = entity.floorId.clone();\r\n // //this.reserveFloorTransfer(entity.floorId, entity.mx, entity.my, 2);\r\n // }\r\n // }\r\n onEntityTransferred(entity) {\r\n if (this.initializing)\r\n return; // NewGame 中は GameManager 側に任せる\r\n if (entity.entityId().equals(this._focusedEntityId)) {\r\n if (!this.currentFloorId.equals(entity.floorId)) {\r\n MRSystem_1.MRSystem.dialogContext.open(new STransferMapDialog_1.STransferMapDialog(STransferMapDialog_1.STransferMapSource.FromCommand, entity.floorId, entity.mx, entity.my, entity.dir));\r\n // この時点ではまだ CurrentFloorId は変更しない。STransferMapDialog でしかるべきタイミングで行う。\r\n // こうしておかないと performFloorTransfer() する前に、別マップへの遷移したことになってしまう。\r\n }\r\n }\r\n // // Camera が注視している Entity が別マップへ移動したら、マップ遷移\r\n // if (MRLively.camera.focusedEntityId().equals(entity.entityId()) &&\r\n // !mapFloorId.equals(entity.floorId) &&\r\n // cctx) {\r\n // MRLively.camera._reserveFloorTransferToFocusedEntity(cctx);\r\n // }\r\n }\r\n onEntityEnteredFromMap(entity) {\r\n MRSystem_1.MRSystem.integration.entityEnteredMap(entity);\r\n }\r\n onEntityRemovedFromMap(entity) {\r\n MRSystem_1.MRSystem.integration.entityLeavedMap(entity);\r\n }\r\n};\r\nLMapView = __decorate([\r\n Common_1.MRSerializable\r\n], LMapView);\r\nexports.LMapView = LMapView;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/LMapView.ts?"); /***/ }), /***/ "./ts/mr/lively/LMessageHistory.ts": /*!*****************************************!*\ !*** ./ts/mr/lively/LMessageHistory.ts ***! \*****************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LMessageHistory = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ./MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\n/**\r\n * Game_Message はログ表示という点では機能がマッチしなかったため、独自実装したもの。\r\n *\r\n * 前提としてユーザーと \"対話\" するためのものではないため、\r\n * Enter 待ちや選択肢の表示といった機能は持たず、ログを流すだけのシステムとなる。\r\n *\r\n * そういった対話が必要な場合は、VMessageLogWindow は非表示にして VMessageWindow に切り替えて使うこと。\r\n * このあたりもそれなりに複雑なので、ひとつのウィンドウにたくさんのことをさせたくない。\r\n * (実際に原作でも、ログ用ウィンドウと会話用ウィンドウではタイピングの有無などいろいろ差がある)\r\n */\r\nlet LMessageHistory = class LMessageHistory {\r\n constructor() {\r\n this._lastViewLineIndex = -1;\r\n this._texts = [];\r\n }\r\n clear() {\r\n this._texts = [];\r\n this._lastViewLineIndex = -1;\r\n }\r\n add(text) {\r\n this._texts.push(text);\r\n if (MRLively_1.MRLively.recorder.isSilentPlayback()) {\r\n this._lastViewLineIndex = this._texts.length;\r\n }\r\n }\r\n hasText() {\r\n return this._texts.length > 0;\r\n }\r\n texts() {\r\n return this._texts;\r\n }\r\n // テスト用。全メッセージを対象に、に特定の文字が含まれているかを確認する。\r\n includesText(text) {\r\n return !!this._texts.find(x => x.includes(text));\r\n }\r\n countIncludesText(text) {\r\n return this._texts.count(x => x.includes(text));\r\n }\r\n};\r\nLMessageHistory = __decorate([\r\n Common_1.MRSerializable\r\n], LMessageHistory);\r\nexports.LMessageHistory = LMessageHistory;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/LMessageHistory.ts?"); /***/ }), /***/ "./ts/mr/lively/LObject.ts": /*!*********************************!*\ !*** ./ts/mr/lively/LObject.ts ***! \*********************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LEntityId_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LObject = exports.LObjectType = exports.LEntityId = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ./MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nlet LEntityId = LEntityId_1 = class LEntityId {\r\n constructor(index, key) {\r\n this._index = index;\r\n this._key = key;\r\n }\r\n index2() {\r\n return this._index;\r\n }\r\n key2() {\r\n return this._key;\r\n }\r\n isEmpty() {\r\n return this._index == 0 && this._key == 0;\r\n }\r\n hasAny() {\r\n return this._index > 0 && this._key != 0;\r\n }\r\n equals(other) {\r\n return this._index == other._index && this._key == other._key;\r\n }\r\n clear() {\r\n this._index = 0;\r\n this._key = 0;\r\n }\r\n clone() {\r\n return new LEntityId_1(this._index, this._key);\r\n }\r\n static makeEmpty() {\r\n return new LEntityId_1(0, 0);\r\n }\r\n get object() {\r\n return MRLively_1.MRLively.world.object(this);\r\n }\r\n};\r\nLEntityId = LEntityId_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LEntityId);\r\nexports.LEntityId = LEntityId;\r\nvar LObjectType;\r\n(function (LObjectType) {\r\n LObjectType[LObjectType[\"Entity\"] = 0] = \"Entity\";\r\n LObjectType[LObjectType[\"State\"] = 1] = \"State\";\r\n LObjectType[LObjectType[\"Ability\"] = 2] = \"Ability\";\r\n LObjectType[LObjectType[\"Behavior\"] = 3] = \"Behavior\";\r\n LObjectType[LObjectType[\"Map\"] = 4] = \"Map\";\r\n})(LObjectType = exports.LObjectType || (exports.LObjectType = {}));\r\n/**\r\n * Behavior を保持するクラスのベースクラス\r\n *\r\n * [2021/3/14]\r\n * ----------\r\n * 現時点では、LEntity, LState, LAbility のベースクラスとなる。\r\n *\r\n */\r\nclass LObject {\r\n constructor(objectType) {\r\n this._objectId = LEntityId.makeEmpty();\r\n this._destroyed = false;\r\n this._parentObjectId = LEntityId.makeEmpty();\r\n this._objectType = objectType;\r\n }\r\n objectType() {\r\n return this._objectType;\r\n }\r\n __objectId() {\r\n return this._objectId;\r\n }\r\n hasId() {\r\n return this._objectId.hasAny();\r\n }\r\n _setObjectId(id) {\r\n (0, Common_1.assert)(id.hasAny()); // 無効IDの設定は禁止。リセットしたいときは _clearObjectId() を使うこと。\r\n (0, Common_1.assert)(!this.hasId()); // 再設定禁止。\r\n this._objectId = id;\r\n }\r\n _clearObjectId() {\r\n this._objectId = LEntityId.makeEmpty();\r\n }\r\n isUnique() {\r\n return false;\r\n }\r\n hasParent() {\r\n return this._parentObjectId.hasAny();\r\n }\r\n hasLivingParent() {\r\n if (this.hasParent()) {\r\n // 親は既に削除されていない?\r\n if (!!MRLively_1.MRLively.world.findObject(this._parentObjectId)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n isGCReady() {\r\n // Unique Entity は削除されない\r\n if (this.isUnique())\r\n return false;\r\n // 親から参照されているものは削除されない (明示的に除外されなければならない)\r\n if (this.hasLivingParent())\r\n return false;\r\n return true;\r\n }\r\n /**\r\n * 親 Object\r\n *\r\n * GC のタイミングで、owner がおらず、UniqueEntity や Map に出現している Entity のリストに存在しない Entity は削除される。\r\n */\r\n parentObjectId() {\r\n return this._parentObjectId;\r\n }\r\n parentObject() {\r\n return MRLively_1.MRLively.world.object(this._parentObjectId);\r\n }\r\n parentAs(ctor) {\r\n if (!this.hasParent())\r\n return undefined;\r\n const obj = this.parentObject();\r\n if (obj instanceof ctor) {\r\n return obj;\r\n }\r\n else {\r\n return undefined;\r\n }\r\n }\r\n setParent(parent) {\r\n if (this.hasParent()) {\r\n (0, Common_1.assert)(!this.hasParent());\r\n }\r\n const ownerId = parent.__objectId();\r\n (0, Common_1.assert)(ownerId.hasAny()); // ID を持たない親は設定できない\r\n this._parentObjectId = ownerId;\r\n }\r\n clearParent() {\r\n this._parentObjectId = LEntityId.makeEmpty();\r\n }\r\n findAncestor(func) {\r\n let obj = this;\r\n while (obj) {\r\n if (func(obj)) {\r\n return obj;\r\n }\r\n obj = obj.parentObject();\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Entity が存在している場所から除外する。\r\n *\r\n * 何らかの Inventory に入っているならそこから、Map 上に出現しているならその Map から除外する。\r\n * 除外された UniqueEntity 以外の Entity は、そのターンの間にいずれかから参照を得ない場合 GC によって削除される。\r\n */\r\n removeFromParent() {\r\n if (this.hasLivingParent()) {\r\n // onRemoveFromParent() では、parent を間接的に参照しているオブジェクトの後始末を行う。\r\n // 様々な理由で parent にアクセスするため、parent が null になる前に、this に通知する。\r\n this.onRemoveFromParent();\r\n // this への通知が終わった後、親から直接参照を外してもらう。\r\n // ここで parent が null になる。\r\n // ※ parent-child の関係を解除するのは、parent から行ってもらう方が自然。\r\n // child 側から外すには parent の具体的な型を知らなければならないが、それは不自然。\r\n this.parentObject().onRemoveChild(this);\r\n (0, Common_1.assert)(this._parentObjectId.isEmpty());\r\n }\r\n }\r\n /** destroy が要求されているか */\r\n isDestroyed() {\r\n return this._destroyed;\r\n }\r\n /**\r\n * Behavior から Entity を削除する場合、CommandContext.postDestroy() を使用してください。\r\n */\r\n destroy() {\r\n if (this._destroyed)\r\n return; // 複数回の呼び出しは許可する\r\n (0, Common_1.assert)(!this.isUnique());\r\n this.removeFromParent();\r\n this._destroyed = true;\r\n }\r\n onFinalize() {\r\n }\r\n behaviorIds() {\r\n return [];\r\n }\r\n onRemoveChild(obj) {\r\n throw new Error(\"Unreachable.\");\r\n }\r\n onRemoveFromParent() {\r\n }\r\n}\r\nexports.LObject = LObject;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/LObject.ts?"); /***/ }), /***/ "./ts/mr/lively/LParam.ts": /*!********************************!*\ !*** ./ts/mr/lively/LParam.ts ***! \********************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LParam_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LParamSet = exports.LParam = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst DEffect_1 = __webpack_require__(/*! ts/mr/data/DEffect */ \"./ts/mr/data/DEffect.ts\");\r\nconst DParameter_1 = __webpack_require__(/*! ts/mr/data/DParameter */ \"./ts/mr/data/DParameter.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ../data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\n/**\r\n * パラメータひとつ分の情報を保持するクラス。\r\n *\r\n * コアスクリプトでは Level, Exp, HP, MP, TP は Param ではない。\r\n * MaxHP, MaxMP は Param である。\r\n * 例えば「HP の param」は MaxHP のことである。\r\n *\r\n * パラメータの仕様\r\n * ----------\r\n *\r\n * -9999 ... -10 0 11 20 ... 9999\r\n * + +....................+------------------------+..................+ +\r\n * | . . . . | | | | . . . . . . |\r\n * + +....................+------------------------+..................+ +\r\n * |<-- --IdealMin -----|-- IdealMax(Base+Effort) -->|\r\n * |- Rate&Buff ->|\r\n * |<--- ActualMinValue |--------- ActualMaxValue ----------------->|\r\n * |<---- Damage -----|\r\n * |<---- ActualValue ----->|\r\n * |<---- MinLimit | MaxLimit --->|\r\n *\r\n *\r\n * ### MinLimit, MaxLimit (下限値, 上限値)\r\n * システム上とりえる最小値、最大値。\r\n * ユニットがどれほど成長・弱体化しても、この範囲を超えることは無い。\r\n *\r\n * ### IdealMinValue, IdealMaxValue (基本値の下限値, 基本値の上限値)\r\n * ユニットのレベルによって変化する値の範囲。\r\n * IdealMaxValue は、コアスクリプトの paramBasePlus() に該当する。\r\n * - Base: アクターの場合、レベルによって変化する値。エネミーの場合はエディタで入力された値。\r\n * - Plus: 装備による追加値 + 成長アイテムによる永続的な追加値。\r\n *\r\n * IdealMinValue は一般的には 0 であるが、装備の「つよさ」の最小値はその武器の攻撃力をマイナスにしたものとなる。\r\n *\r\n * ### ActualMinValue, ActualMaxValue (実際の下限値, 実際の上限値)\r\n * ActualMaxValue は コアスクリプトの param() に該当する。IdealMaxValue に対して、Trait等によるボーナスやバフを適用したもの。\r\n * ActualMinValue は今のところ、IdealMinValue と同じ値である。\r\n *\r\n * ### ActualValue\r\n * ActualMaxValue から Damage を減算したもの。\r\n * ダメージ計算に用いたり、ステータス画面に表示したりするもの。\r\n *\r\n * Refresh タイミング\r\n * ----------\r\n * コアスクリプトでは setHP() などで値が変わると、refresh() が呼ばれる。\r\n * 対して MRシステムでは、EffectContext による一連の処理が終わったタイミングで refresh() が呼ばれる。\r\n * この refresh 時にステートの付け外しが行われるが、その時にも IdealMaxValue の評価などが毎回行われるため、非常に処理に時間がかかる。\r\n *\r\n * ダメージ値は減算方式\r\n * ----------\r\n * 現在値は、最大値からダメージ値を減算することで求める。\r\n * 本システムは atk,def などのすべての基本パラメータは HP と同じように0~最大値の間で変化が起こるようになっているが、\r\n * 増分計算だと装備品の有無やモンスターの特技、能力の成長アイテムなどで変わるときにその前後の変化量から現在値を調整する処理が必要になり複雑になる。\r\n *\r\n * 例えば、HP最大時に薬草アイテムを使って、増えた分の HP だけ現在値を増やす処理。\r\n * 原作薬草だと 2 増えるが、最大 HP がバフを受けている場合、もっと大きく増える。\r\n * 最大 HP が増えた時は、HP を全快させるのが自然だろう。\r\n * しかしそのような処理にすると、例えばちからの最大値だけ増やすアイテムを使った時に、ちからを全快できたりする。\r\n * 個々のパラメータごとに処理を変えるか、あるいは Effect 側に回復の有無を設定するか… いずれにしても設定が増えることになってしまう。\r\n *\r\n * MRシステムはツクール標準と比べて、パラメータシステムがかなり複雑となっている。\r\n * 加算方式の場合、ただでさえ問題調査が難しくなりがちな副作用に起因した問題が、さらに増えることが予想される。\r\n *\r\n * 減算方式のデメリットは、最大HPが減ったときに、現在のダメージ量が新しい最大HPを上回る場合があること。\r\n * これについては値 0 になることを許可するか、 1 になるように補正する。\r\n */\r\nlet LParam = LParam_1 = class LParam {\r\n constructor(id) {\r\n this.parameterId = id;\r\n this._damageValue = 0;\r\n this._effortValue = 0;\r\n this._buff = 0;\r\n this._initialActualValue = 0;\r\n this._constantBuff = { level: 0, turn: 0, };\r\n this._ratioBuff = { level: 0, turn: 0, };\r\n this._damageValueChanged = false;\r\n this.reset();\r\n }\r\n reset() {\r\n var _a;\r\n const data = this.data;\r\n if (this.isAllowDamage) {\r\n this._damageValue = data.initialIdealValue - ((_a = data.initialValue) !== null && _a !== void 0 ? _a : 0);\r\n }\r\n else {\r\n this._damageValue = 0;\r\n }\r\n this._effortValue = 0;\r\n this._buff = 0;\r\n }\r\n clone() {\r\n const i = new LParam_1(this.parameterId);\r\n i._damageValue = this._damageValue;\r\n i._effortValue = this._effortValue;\r\n i._buff = this._buff;\r\n i._initialActualValue = this._initialActualValue;\r\n i._constantBuff = Object.assign({}, this._constantBuff);\r\n i._ratioBuff = Object.assign({}, this._ratioBuff);\r\n i._damageValueChanged = this._damageValueChanged;\r\n return i;\r\n }\r\n get data() {\r\n return MRData_1.MRData.parameters[this.parameterId];\r\n }\r\n get isDependent() {\r\n return this.data.type == DParameter_1.DParameterType.Dependent;\r\n }\r\n get isAllowDamage() {\r\n const data = this.data;\r\n return data.allowDamage && data.type != DParameter_1.DParameterType.Dependent;\r\n }\r\n //--------------------------------------------------------------------------\r\n // Limit range\r\n // Game_BattlerBase.prototype.paramMin\r\n getMinLimit() {\r\n return this.data.minLimit;\r\n }\r\n // Game_BattlerBase.prototype.paramMax\r\n getMaxLimit() {\r\n return this.data.maxLimit;\r\n }\r\n //--------------------------------------------------------------------------\r\n // Effort value\r\n effortValue() {\r\n return this._effortValue;\r\n }\r\n setEffortValue(value) {\r\n const data = this.data;\r\n this._effortValue = Math.round(value.clamp(data.minEffortLimit, data.maxEffortLimit));\r\n }\r\n gainEffortValue(value) {\r\n const data = this.data;\r\n this._effortValue = Math.round((this._effortValue + value).clamp(data.minEffortLimit, data.maxEffortLimit));\r\n }\r\n clearEffortValue() {\r\n this._effortValue = 0;\r\n }\r\n //--------------------------------------------------------------------------\r\n // Ideal range\r\n getIdealMinValue(self) {\r\n // TODO: 装備の強さからとる。強化値の分だけマイナスにできる。\r\n return this.data.minLimit;\r\n }\r\n // idealParamBasePlus\r\n getIdealMaxValue(self) {\r\n const base = this.getIdealMaxBase(self);\r\n const plus = this.getIdealMaxPlus(self);\r\n return base + plus;\r\n }\r\n // 現在のレベルやクラスに応じた基礎値。\r\n // 例えば FP だと常に 100. バフやアイテムによる最大 FP 上昇量は含まない。\r\n // Game_BattlerBase.prototype.paramBase\r\n getIdealMaxBase(self) {\r\n const data = this.data;\r\n const battlerParam = data.battlerParamId;\r\n if (battlerParam >= 0) {\r\n return self.getIdealParamBase(this.parameterId);\r\n }\r\n else {\r\n return data.initialIdealValue;\r\n }\r\n }\r\n getIdealMaxPlus(self) {\r\n const p1 = this.effortValue();\r\n const p2 = self.queryIdealParameterPlus(this.parameterId);\r\n return p1 + p2;\r\n }\r\n //--------------------------------------------------------------------------\r\n // Actual range\r\n getActualMin(self) {\r\n return this.getIdealMinValue(self);\r\n }\r\n // Game_BattlerBase.prototype.param\r\n getActualMax(self) {\r\n const a1 = this.getIdealMaxValue(self);\r\n const a2 = this.idealParamRate(self);\r\n const a3 = this.paramBuffRate(self);\r\n const a4 = this.buffPlus();\r\n const value = a1 *\r\n a2 *\r\n a3 +\r\n a4;\r\n const minLimit = this.getMinLimit();\r\n const maxLimit = this.getMaxLimit();\r\n return Math.round(value.clamp(minLimit, maxLimit));\r\n }\r\n // Game_BattlerBase.prototype.paramRate\r\n idealParamRate(self) {\r\n return self.traitsPi(MRBasics_1.MRBasics.traits.TRAIT_PARAM, this.parameterId);\r\n }\r\n // Game_BattlerBase.prototype.paramBuffRate\r\n // バフ適用レベル (正負の整数値。正規化されたレートではない点に注意)\r\n paramBuffRate(self) {\r\n return (this.buff() * 0.25 + 1.0) * this.buffRate();\r\n }\r\n actualParamDamge() {\r\n if (this.data.type == DParameter_1.DParameterType.Dependent) {\r\n (0, Common_1.assert)(this._damageValue === 0); // Dependent に対してダメージ値を持たせるのは禁止。一応変な値が入っていないかチェックしておく。\r\n }\r\n return this._damageValue;\r\n }\r\n get isDamageValueChanged() {\r\n return this._damageValueChanged;\r\n }\r\n clearDamageValueChanged() {\r\n this._damageValueChanged = false;\r\n }\r\n // ActualVale の clamp はいろいろな条件があるので、set 時点では行わない。\r\n // そのため一時的に 上限・下限を超えた値を持つことになる。\r\n setActualDamgeParam(value) {\r\n (0, Common_1.assert)(this.isAllowDamage); // Normal のみ許可。Dependent に対してダメージ値を持たせるのは禁止。\r\n if (this._damageValue !== value) {\r\n this._damageValue = value;\r\n this._damageValueChanged = true;\r\n }\r\n }\r\n gainActualParam(value) {\r\n (0, Common_1.assert)(this.isAllowDamage); // Normal のみ許可。Dependent に対してダメージ値を持たせるのは禁止。\r\n if (value !== 0) {\r\n this._damageValue -= value;\r\n this._damageValueChanged = true;\r\n }\r\n }\r\n //--------------------------------------------------------------------------\r\n // Buff\r\n getConstantBuff() {\r\n return this._constantBuff;\r\n }\r\n getRatioBuff() {\r\n return this._ratioBuff;\r\n }\r\n buff() {\r\n return this._buff;\r\n }\r\n buffPlus() {\r\n return this._constantBuff.level * MRData_1.MRData.parameters[this.parameterId].addBuffCoe;\r\n }\r\n buffRate() {\r\n return this._ratioBuff.level * MRData_1.MRData.parameters[this.parameterId].mulBuffCore + 1.0;\r\n }\r\n clearDamage(owner) {\r\n const data = this.data;\r\n if (data.initialValue === undefined) {\r\n this._damageValue = 0;\r\n }\r\n else {\r\n owner.setParamCurrentValue(this.parameterId, data.initialValue);\r\n }\r\n }\r\n //--------------------------------------------------------------------------\r\n resetInitialActualValue(value) {\r\n this._initialActualValue = value;\r\n }\r\n initialActualValue() {\r\n return this._initialActualValue;\r\n }\r\n addBuff(buff) {\r\n const b = (buff.type == DEffect_1.DBuffType.Add) ? this._constantBuff : this._ratioBuff;\r\n switch (buff.levelType) {\r\n case DEffect_1.DBuffLevelOp.Set:\r\n b.level = buff.level;\r\n break;\r\n case DEffect_1.DBuffLevelOp.Add:\r\n b.level += buff.level;\r\n break;\r\n default:\r\n throw new Error(\"Unreachable.\");\r\n }\r\n b.turn = buff.turn;\r\n }\r\n removeBuff() {\r\n this._constantBuff.level = 0;\r\n this._constantBuff.turn = 0;\r\n this._ratioBuff.level = 0;\r\n this._ratioBuff.turn = 0;\r\n }\r\n updateBuffs(owner) {\r\n if (this._constantBuff.turn > 0) {\r\n this._constantBuff.turn--;\r\n if (this._constantBuff.turn <= 0) {\r\n this._constantBuff.level = 0;\r\n owner._effectResult.pushRemovedBuff(this.parameterId);\r\n }\r\n }\r\n if (this._ratioBuff.turn > 0) {\r\n this._ratioBuff.turn--;\r\n if (this._ratioBuff.turn <= 0) {\r\n this._ratioBuff.level = 0;\r\n owner._effectResult.pushRemovedBuff(this.parameterId);\r\n }\r\n }\r\n }\r\n};\r\nLParam = LParam_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LParam);\r\nexports.LParam = LParam;\r\nlet LParamSet = class LParamSet {\r\n constructor() {\r\n this._params = [];\r\n }\r\n //--------------------------------------------------------------------------\r\n // Limit range\r\n getMinLimit(parameterId) {\r\n const param = this.param(parameterId);\r\n return param ? param.getMinLimit() : 0;\r\n }\r\n getMaxLimit(parameterId) {\r\n const param = this.param(parameterId);\r\n return param ? param.getMaxLimit() : Infinity;\r\n }\r\n //--------------------------------------------------------------------------\r\n // Ideal range\r\n getIdealMinValue(self, parameterId) {\r\n const param = this.param(parameterId);\r\n return param ? param.getIdealMinValue(self) : 0;\r\n }\r\n getIdealMaxValue(self, parameterId) {\r\n const param = this.param(parameterId);\r\n return param ? param.getIdealMaxValue(self) : 0;\r\n }\r\n //--------------------------------------------------------------------------\r\n // Actual range\r\n getActualMin(self, parameterId) {\r\n const param = this.param(parameterId);\r\n return param ? param.getActualMin(self) : 0;\r\n }\r\n getActualMax(self, parameterId) {\r\n const param = this.param(parameterId);\r\n return param ? param.getActualMax(self) : 0;\r\n }\r\n //--------------------------------------------------------------------------\r\n copyTo(other) {\r\n other._params = this._params.map(x => x ? x.clone() : undefined);\r\n }\r\n // public self(): LEntity {\r\n // assert(this._ownerId && this._ownerId.hasAny());\r\n // return REGame.world.entity(this._ownerId);\r\n // }\r\n clear() {\r\n this._params = [];\r\n }\r\n acquireParam(paramId) {\r\n const param = this._params[paramId];\r\n if (param) {\r\n return param;\r\n }\r\n else {\r\n const param = new LParam(paramId);\r\n this._params[paramId] = param;\r\n return param;\r\n }\r\n }\r\n resetAllConditions() {\r\n this._params.forEach(x => x === null || x === void 0 ? void 0 : x.reset());\r\n }\r\n // Game_BattlerBase.prototype.clearParamPlus\r\n clearParamPlus() {\r\n this._params.forEach(x => x === null || x === void 0 ? void 0 : x.clearEffortValue());\r\n }\r\n params() {\r\n return this._params;\r\n }\r\n param(paramId) {\r\n const param = this._params[paramId];\r\n //assert(param);\r\n return param;\r\n }\r\n hasParam(paramId) {\r\n return this._params[paramId] !== undefined;\r\n }\r\n updateBuffs(self) {\r\n for (const param of this._params) {\r\n if (param)\r\n param.updateBuffs(self);\r\n }\r\n }\r\n refresh(self) {\r\n // min/max clamp.\r\n // 再帰防止のため、setActualParam() ではなく直接フィールドへ設定する\r\n for (const param of this._params) {\r\n if (param && param.isAllowDamage) {\r\n const ideal = this.getActualMax(self, param.parameterId);\r\n let actual = (ideal - param.actualParamDamge());\r\n const minmax = self.queryParamMinMax(param.parameterId);\r\n if (actual < minmax.min) {\r\n actual = minmax.min;\r\n }\r\n if (actual > ideal) {\r\n actual = ideal;\r\n }\r\n if (ideal < 0)\r\n param.setActualDamgeParam(actual - ideal);\r\n else\r\n param.setActualDamgeParam(ideal - actual);\r\n param.clearDamageValueChanged();\r\n }\r\n }\r\n }\r\n};\r\nLParamSet = __decorate([\r\n Common_1.MRSerializable\r\n], LParamSet);\r\nexports.LParamSet = LParamSet;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/LParam.ts?"); /***/ }), /***/ "./ts/mr/lively/LParty.ts": /*!********************************!*\ !*** ./ts/mr/lively/LParty.ts ***! \********************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LParty = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ./MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LObject_1 = __webpack_require__(/*! ./LObject */ \"./ts/mr/lively/LObject.ts\");\r\nconst LEventServer_1 = __webpack_require__(/*! ./LEventServer */ \"./ts/mr/lively/LEventServer.ts\");\r\nconst LJournal_1 = __webpack_require__(/*! ./LJournal */ \"./ts/mr/lively/LJournal.ts\");\r\nconst LInventoryBehavior_1 = __webpack_require__(/*! ./entity/LInventoryBehavior */ \"./ts/mr/lively/entity/LInventoryBehavior.ts\");\r\n/**\r\n * 仲間キャラや、グループで動くモンスターをまとめる仕組み。\r\n * RMMZ の Party と Troop を合わせたようなもの。\r\n * member がいなくなると、GC される。\r\n *\r\n * Party には Leader が一人いる。\r\n * Leader がフロア移動すると、Party に属する全員が移動する。\r\n *\r\n * Leader ではないメンバーがフロア移動すると、そのメンバーは Party を脱退する。\r\n *\r\n * Party は勢力を表すものではない。\r\n * 仲間が倒されて Party を離脱しても、友好な Unique Entity として World 上には存在し、再び Party に入ることはできる。\r\n */\r\nlet LParty = class LParty {\r\n constructor() {\r\n this._id = 0;\r\n this._members = [];\r\n this._entries = [];\r\n this._leaderEntityId = LObject_1.LEntityId.makeEmpty();\r\n this.journal = new LJournal_1.LJournal();\r\n this.journal.startChallenging();\r\n }\r\n setup(id) {\r\n this._id = id;\r\n }\r\n id() {\r\n return this._id;\r\n }\r\n isEmpty() {\r\n return this._members.length == 0;\r\n }\r\n get members() {\r\n return this._members.map(e => MRLively_1.MRLively.world.entity(e));\r\n }\r\n addMember(entity) {\r\n (0, Common_1.assert)(entity.partyId() == 0);\r\n entity._partyId = this._id;\r\n this._members.push(entity.entityId());\r\n if (this._members.length == 1) {\r\n this._leaderEntityId = entity.entityId();\r\n }\r\n for (const b of entity.collectBehaviors()) {\r\n b.onPertyChanged(entity);\r\n }\r\n }\r\n removeMember(entity) {\r\n (0, Common_1.assert)(entity.partyId() == this._id);\r\n this._members.mutableRemove(e => e.equals(entity.entityId()));\r\n for (const b of entity.collectBehaviors())\r\n b.onPertyChanged(entity);\r\n // unsubscribe\r\n this._entries.mutableRemoveAll(x => MRLively_1.MRLively.world.behavior(x.behaviorId).ownerEntity() == entity);\r\n }\r\n subscribe(eventId, behavior) {\r\n (0, Common_1.assert)(behavior.hasId());\r\n this._entries.push({\r\n eventId: eventId,\r\n behaviorId: behavior.id(),\r\n });\r\n }\r\n unsubscribe(eventId, behavior) {\r\n const id = behavior.id();\r\n const index = this._entries.findIndex(e => e.eventId == eventId && e.behaviorId == id);\r\n if (index >= 0) {\r\n this._entries.splice(index, 1);\r\n }\r\n }\r\n send(eventId, args) {\r\n for (const e of this._entries) {\r\n if (e.eventId == eventId) {\r\n const b = MRLively_1.MRLively.world.behavior(e.behaviorId);\r\n const r = b.onPartyEvent(eventId, args);\r\n if (r != LEventServer_1.LEventResult.Pass) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n }\r\n /**\r\n * 挑戦開始。基本的に拠点での起床時に開始する。拠点マップ(World)に居る時も、冒険中とみなす。(倉庫とかで倒れたりするので)\r\n *\r\n * 開始後に繰り返し startChallenging() を呼び出しても良いものとする。\r\n * これは主に、Land に入ったときのステータスリセットなどに使う。\r\n */\r\n startChallenging( /*entryLandId: DLandId*/) {\r\n //this._entranceLandId = entryLandId;\r\n this.journal.startChallenging();\r\n }\r\n /** 挑戦終了 */\r\n finishChallenging() {\r\n // ステータスをリセット\r\n for (const member of this.members) {\r\n member.resetStatus();\r\n member.recoverAll();\r\n }\r\n if (this.journal.isPenaltyResult) {\r\n // 何らかのペナルティを伴う挑戦結果だった。\r\n // アイテムをすべて失う\r\n for (const member of this.members) {\r\n const inventory = member.findEntityBehavior(LInventoryBehavior_1.LInventoryBehavior);\r\n if (inventory) {\r\n inventory.reset();\r\n }\r\n }\r\n }\r\n else {\r\n // ペナルティ無し。\r\n }\r\n this.journal.finishChallenging();\r\n this.journal.startChallenging();\r\n }\r\n onMemberMovedLand(member, newLandId, oldLandId) {\r\n // if (this._leaderEntityId.equals(member.entityId())) {\r\n // const newLand = MRData.lands[newLandId];\r\n // const oldLand = MRData.lands[oldLandId];\r\n // if (newLand.isDungeonLand && !oldLand.isDungeonLand) {\r\n // // World から Dungeon への移動(突入)\r\n // this.journal.startChallenging(newLandId);\r\n // }\r\n // else if (!newLand.isDungeonLand && oldLand.isDungeonLand) {\r\n // // Dungeon から World への移動(帰還)\r\n // // TODO: ちゃんと LandRule を参照するべきだが、とりあえず #8 対応のため一律リセットにしておく\r\n // member.recoverAll();\r\n // }\r\n // }\r\n }\r\n};\r\nLParty = __decorate([\r\n Common_1.MRSerializable\r\n], LParty);\r\nexports.LParty = LParty;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/LParty.ts?"); /***/ }), /***/ "./ts/mr/lively/LQuest.ts": /*!********************************!*\ !*** ./ts/mr/lively/LQuest.ts ***! \********************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LQuestTask = exports.LQuestStatus = exports.LQuest = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ../data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nlet LQuest = class LQuest {\r\n // public set status(value: LQuestStatus) {\r\n // this._status = value;\r\n // }\r\n constructor(data) {\r\n this.dataId = data.id;\r\n this._status = LQuestStatus.Inactive;\r\n this._tasks = [];\r\n }\r\n /** 依頼人 */\r\n //client: LEntityId;\r\n get data() {\r\n return MRData_1.MRData.quests[this.dataId];\r\n }\r\n get status() {\r\n return this._status;\r\n }\r\n openQuest() {\r\n (0, Common_1.assert)(this._status === LQuestStatus.Inactive);\r\n this._status = LQuestStatus.Assignable;\r\n this.advanceQuestTask(this.data.tasks[0].key);\r\n }\r\n /**\r\n *\r\n * @return 新しくタスクを開始した場合、その LQuestTask インスタンスを返す。タスクを開始しなかった場合は undefined を返す。\r\n */\r\n advanceQuestTask(questTaskKey) {\r\n (0, Common_1.assert)(this._status === LQuestStatus.Assignable || this._status === LQuestStatus.InProgress);\r\n const taskData = this.data.tasks.find(x => x.key === questTaskKey);\r\n if (!taskData)\r\n throw new Error((0, Common_1.tr2)(\"QuestTask %1 が見つかりません。\").format(questTaskKey));\r\n if (this._tasks.find(x => x.data.key === questTaskKey)) {\r\n // 既に開始済み\r\n return undefined;\r\n }\r\n const task = new LQuestTask(taskData);\r\n this._tasks.push(task);\r\n this._status = LQuestStatus.InProgress;\r\n return task;\r\n }\r\n isQuestTaskAcivated(questTaskKey) {\r\n if (this._tasks.length <= 0)\r\n return false;\r\n return this._tasks[this._tasks.length - 1].data.key === questTaskKey;\r\n }\r\n};\r\nLQuest = __decorate([\r\n Common_1.MRSerializable\r\n], LQuest);\r\nexports.LQuest = LQuest;\r\n/** Quest の状態 */\r\nvar LQuestStatus;\r\n(function (LQuestStatus) {\r\n /** 出現していない。開始可能でもない。 */\r\n LQuestStatus[LQuestStatus[\"Inactive\"] = 0] = \"Inactive\";\r\n /** 依頼可能 */\r\n LQuestStatus[LQuestStatus[\"Assignable\"] = 1] = \"Assignable\";\r\n /** 進行中 */\r\n LQuestStatus[LQuestStatus[\"InProgress\"] = 2] = \"InProgress\";\r\n /** 完了 */\r\n LQuestStatus[LQuestStatus[\"Completed\"] = 3] = \"Completed\";\r\n /** 失敗・破棄 */\r\n LQuestStatus[LQuestStatus[\"Abandoned\"] = 4] = \"Abandoned\";\r\n})(LQuestStatus = exports.LQuestStatus || (exports.LQuestStatus = {}));\r\nclass LQuestTask {\r\n constructor(data) {\r\n this.dataId = data.id;\r\n }\r\n get data() {\r\n return MRData_1.MRData.questTasks[this.dataId];\r\n }\r\n}\r\nexports.LQuestTask = LQuestTask;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/LQuest.ts?"); /***/ }), /***/ "./ts/mr/lively/LQuestManager.ts": /*!***************************************!*\ !*** ./ts/mr/lively/LQuestManager.ts ***! \***************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LQuestManager = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ../data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst LQuest_1 = __webpack_require__(/*! ./LQuest */ \"./ts/mr/lively/LQuest.ts\");\r\n/**\r\n * 発生している・請けているクエストを管理する\r\n *\r\n * クエストを受けるのは Unit ではなく Player 自身である。\r\n * ゲーム中に1つのインスタンスが存在する。\r\n * 操作キャラを切り替えても、クエストノートは共有する感じ。\r\n */\r\nlet LQuestManager = class LQuestManager {\r\n constructor() {\r\n this._quests = []; // DQuest と 1:1。つまりゲーム開始時にすべてのクエストが生成される。\r\n }\r\n setup() {\r\n for (const data of MRData_1.MRData.quests) {\r\n if (data) {\r\n this._quests.push(new LQuest_1.LQuest(data));\r\n }\r\n else {\r\n this._quests.push(undefined);\r\n }\r\n }\r\n }\r\n getQuest(questKey) {\r\n const quest = this._quests.find(x => x.data.key === questKey);\r\n if (!quest)\r\n throw new Error(`Quest ${questKey} not found.`);\r\n return quest;\r\n }\r\n /**\r\n * 指定したクエストを受領できる状態にします。\r\n * @param questKey\r\n */\r\n openQuest(questKey) {\r\n const quest = this.getQuest(questKey);\r\n if (quest.status == LQuest_1.LQuestStatus.Inactive) {\r\n quest.openQuest();\r\n return quest;\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * 指定したクエストを開始する\r\n * @param questKey\r\n */\r\n // public assingQuest(questKey: string): void {\r\n // const quest = this._quests.find(x => x.data.key === questKey);\r\n // if (quest) {\r\n // quest.status = LQuestStatus.InProgress;\r\n // }\r\n // }\r\n /**\r\n * 指定したクエストの指定したタスクを開始する\r\n *\r\n * @return 新しくタスクを開始した場合、その LQuest インスタンスを返す。タスクを開始しなかった場合は undefined を返す。\r\n */\r\n advanceQuestTask(questKey, questTaskKey) {\r\n const quest = this._quests.find(x => x.data.key === questKey);\r\n if (quest) {\r\n const newTask = quest.advanceQuestTask(questTaskKey);\r\n if (newTask) {\r\n // 新しいタスクを開始した\r\n return { quest, newTask };\r\n }\r\n }\r\n return undefined;\r\n }\r\n isQuestInactived(questkKey) {\r\n return !!this._quests.find(x => x.data.key === questkKey && x.status === LQuest_1.LQuestStatus.Inactive);\r\n }\r\n isQuestTaskAcivated(questTaskKey) {\r\n for (const quest of this._quests) {\r\n if (quest) {\r\n if (quest.status === LQuest_1.LQuestStatus.InProgress) {\r\n if (quest.isQuestTaskAcivated(questTaskKey)) {\r\n return true;\r\n }\r\n }\r\n }\r\n }\r\n return false;\r\n }\r\n};\r\nLQuestManager = __decorate([\r\n Common_1.MRSerializable\r\n], LQuestManager);\r\nexports.LQuestManager = LQuestManager;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/LQuestManager.ts?"); /***/ }), /***/ "./ts/mr/lively/LRandom.ts": /*!*********************************!*\ !*** ./ts/mr/lively/LRandom.ts ***! \*********************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LRandom = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nlet LRandom = class LRandom {\r\n constructor(seed) {\r\n this._x = 123456789;\r\n this._y = 362436069;\r\n this._z = 521288629;\r\n this._w = seed;\r\n }\r\n resetSeed(seed) {\r\n this._x = 123456789;\r\n this._y = 362436069;\r\n this._z = 521288629;\r\n this._w = seed;\r\n }\r\n nextInt() {\r\n const t = this._x ^ (this._x << 11);\r\n this._x = this._y;\r\n this._y = this._z;\r\n this._z = this._w;\r\n this._w = (this._w ^ (this._w >> 19)) ^ (t ^ (t >> 8));\r\n return this._w;\r\n }\r\n // 0~(maxValue-1)\r\n nextIntWithMax(maxValue) {\r\n if (maxValue == 0) {\r\n return 0;\r\n }\r\n let r = this.nextInt();\r\n r %= maxValue;\r\n return r;\r\n }\r\n // minValue~(maxValue-1)\r\n nextIntWithMinMax(minValue, maxValue) {\r\n if (maxValue - minValue == 0) {\r\n return 0;\r\n }\r\n let r = this.nextInt();\r\n r %= maxValue - minValue;\r\n r += minValue;\r\n return r;\r\n }\r\n nextIntWithWidth(median, width) {\r\n return this.nextIntWithMinMax(median - width, median + width);\r\n }\r\n select(ary) {\r\n (0, Common_1.assert)(ary.length > 0);\r\n return ary[this.nextIntWithMax(ary.length)];\r\n }\r\n selectOrUndefined(ary) {\r\n if (ary.length > 0)\r\n return ary[this.nextIntWithMax(ary.length)];\r\n else\r\n return undefined;\r\n }\r\n mutableShuffleArray(array) {\r\n for (var i = (array.length - 1); 0 < i; i--) {\r\n // 0〜(i+1)の範囲で値を取得\r\n var r = this.nextIntWithMax(i + 2);\r\n // 要素の並び替えを実行\r\n var tmp = array[i];\r\n array[i] = array[r];\r\n array[r] = tmp;\r\n }\r\n }\r\n};\r\nLRandom = __decorate([\r\n Common_1.MRSerializable\r\n], LRandom);\r\nexports.LRandom = LRandom;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/LRandom.ts?"); /***/ }), /***/ "./ts/mr/lively/LReward.ts": /*!*********************************!*\ !*** ./ts/mr/lively/LReward.ts ***! \*********************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LReward = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ../data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\n/**\r\n * 特に経験値はステップ終了時にまとめて取得できる。\r\n * そういった遅延取得に関係するデータをまとめておくクラス。\r\n */\r\nlet LReward = class LReward {\r\n constructor() {\r\n this._exp = 0;\r\n }\r\n clear() {\r\n this._exp = 0;\r\n }\r\n exp() {\r\n return this._exp;\r\n }\r\n addExp(value) {\r\n this._exp += value;\r\n }\r\n apply(entity) {\r\n // const b = entity.findEntityBehavior(LBattlerBehavior);\r\n // if (b) {\r\n // b.gainExp(this._exp);\r\n // }\r\n if (entity.params.hasParam(MRBasics_1.MRBasics.params.exp)) {\r\n entity.gainActualParam(MRBasics_1.MRBasics.params.exp, this._exp, true);\r\n }\r\n this.clear();\r\n }\r\n};\r\nLReward = __decorate([\r\n Common_1.MRSerializable\r\n], LReward);\r\nexports.LReward = LReward;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/LReward.ts?"); /***/ }), /***/ "./ts/mr/lively/LRoom.ts": /*!*******************************!*\ !*** ./ts/mr/lively/LRoom.ts ***! \*******************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LRoom = exports.MonsterHouseState = void 0;\r\nconst MRLively_1 = __webpack_require__(/*! ./MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nvar MonsterHouseState;\r\n(function (MonsterHouseState) {\r\n MonsterHouseState[MonsterHouseState[\"Sleeping\"] = 0] = \"Sleeping\";\r\n MonsterHouseState[MonsterHouseState[\"Activated\"] = 1] = \"Activated\";\r\n})(MonsterHouseState = exports.MonsterHouseState || (exports.MonsterHouseState = {}));\r\nlet LRoom = class LRoom {\r\n constructor() {\r\n this._roomId = 0;\r\n this._mx1 = -1; // 有効範囲内左上座標\r\n this._my1 = -1; // 有効範囲内左上座標\r\n this._mx2 = -1; // 有効範囲内右下座標\r\n this._my2 = -1; // 有効範囲内右下座標\r\n this._poorVisibility = false; // 視界不明瞭?\r\n }\r\n setup(room) {\r\n this._roomId = room.id();\r\n this._mx1 = room.mx1;\r\n this._my1 = room.my1;\r\n this._mx2 = room.mx2;\r\n this._my2 = room.my2;\r\n this._poorVisibility = room.poorVisibility;\r\n }\r\n get mx1() {\r\n return this._mx1;\r\n }\r\n get my1() {\r\n return this._my1;\r\n }\r\n get mx2() {\r\n return this._mx2;\r\n }\r\n get my2() {\r\n return this._my2;\r\n }\r\n get width() {\r\n return this._mx2 - this._mx1 + 1;\r\n }\r\n get height() {\r\n return this._my2 - this._my1 + 1;\r\n }\r\n get poorVisibility() {\r\n return this._poorVisibility;\r\n }\r\n contains(mx, my) {\r\n return this._mx1 <= mx && mx <= this._mx2 && this._my1 <= my && my <= this._my2;\r\n }\r\n /** 外周1マスも考慮し、mx,my が部屋に含まれているか確認する */\r\n containsWithEdge(mx, my) {\r\n return this._mx1 - 1 <= mx && mx <= this._mx2 + 1 && this._my1 - 1 <= my && my <= this._my2 + 1;\r\n }\r\n forEachEntities(func) {\r\n for (const entity of MRLively_1.MRLively.mapView.currentMap.entities()) {\r\n if (this.contains(entity.mx, entity.my)) {\r\n func(entity);\r\n }\r\n }\r\n }\r\n findEntityInRoom(func) {\r\n for (const entity of MRLively_1.MRLively.mapView.currentMap.entities()) {\r\n if (this.contains(entity.mx, entity.my)) {\r\n if (func(entity)) {\r\n return entity;\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n /** 部屋内の Block を列挙する。 */\r\n forEachBlocks(func) {\r\n const map = MRLively_1.MRLively.mapView.currentMap;\r\n for (let y = this._my1; y <= this._my2; y++) {\r\n for (let x = this._mx1; x <= this._mx2; x++) {\r\n const block = map.block(x, y);\r\n func(block);\r\n }\r\n }\r\n }\r\n /** 部屋の外側、外周1タイル分の Block を列挙する */\r\n forEachEdgeBlocks(func) {\r\n const map = MRLively_1.MRLively.mapView.currentMap;\r\n const left = Math.max(0, this._mx1 - 1);\r\n const right = Math.min(this._mx2 + 1, map.width() - 1);\r\n if (1 <= this._my1) {\r\n for (let x = left; x <= right; x++) {\r\n func(map.block(x, this._my1 - 1));\r\n }\r\n }\r\n if (1 <= this._mx1) {\r\n for (let y = this._my1; y <= this._my2; y++) {\r\n func(map.block(this._mx1 - 1, y));\r\n }\r\n }\r\n if (this._mx2 < MRLively_1.MRLively.mapView.currentMap.width() - 1) {\r\n for (let y = this._my1; y <= this._my2; y++) {\r\n func(map.block(this._mx2 + 1, y));\r\n }\r\n }\r\n if (this._my2 < MRLively_1.MRLively.mapView.currentMap.height() - 1) {\r\n for (let x = left; x <= right; x++) {\r\n func(map.block(x, this._my2 + 1));\r\n }\r\n }\r\n }\r\n forEachSightableBlocks(func) {\r\n this.forEachBlocks(func);\r\n this.forEachEdgeBlocks(func);\r\n }\r\n /** 部屋の入口 Block リスト。埋蔵金部屋など、入り口が無い場合は空リストを返す。 */\r\n getRoomInnerEntranceBlocks() {\r\n const result = [];\r\n this.forEachBlocks(b => {\r\n if (b.isRoomInnerEntrance())\r\n result.push(b);\r\n });\r\n return result;\r\n }\r\n /**\r\n * 指定した Block が、この部屋として有効な視界内にあるかを確認する。\r\n * (部屋の床タイルと、周囲1マスの壁は有効視界である)\r\n *\r\n * @see USearch.checkInSightBlockFromSubject\r\n */\r\n checkVisibilityBlock(block) {\r\n return this._mx1 - 1 <= block.mx && block.mx <= this._mx2 + 1 &&\r\n this._my1 - 1 <= block.my && block.my <= this._my2 + 1;\r\n }\r\n};\r\nLRoom = __decorate([\r\n Common_1.MRSerializable\r\n], LRoom);\r\nexports.LRoom = LRoom;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/LRoom.ts?"); /***/ }), /***/ "./ts/mr/lively/LScheduler.ts": /*!************************************!*\ !*** ./ts/mr/lively/LScheduler.ts ***! \************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LScheduler2_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LScheduler2 = exports.LSchedulingUnit = exports.LSchedulerPhase = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst LUnitBehavior_1 = __webpack_require__(/*! ./behaviors/LUnitBehavior */ \"./ts/mr/lively/behaviors/LUnitBehavior.ts\");\r\nconst LObject_1 = __webpack_require__(/*! ./LObject */ \"./ts/mr/lively/LObject.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ./MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\n// @MRSerializable\r\n// export class LTOUnit {\r\n// private _id: LTOUnitId;\r\n// private _entityId: LEntityId;\t // 一連の実行中に Collapse などで map から消えたりしたら empty になる\r\n// //attr: LUnitAttribute; // cache for avoiding repeated find.\r\n// private _behaviorId: LBehaviorId;\r\n// private _factionId: DFactionId; // これも頻繁に参照するためキャッシュ\r\n// actionCount: number; // 行動順リストを作るための一時変数。等速の場合は1,倍速の場合は2.x\r\n// speedLevel: number; // 最新の Table を作った時の SpeedLevel. Entity のものと変化がある場合は Table を変更する必要がある。\r\n// speedLevel2: number; // Refresh 時の一時変数\r\n// public constructor(id: LTOUnitId, entity: LEntity, behavior: LUnitBehavior, actionCount: number) {\r\n// this._id = id;\r\n// this._entityId = entity.entityId();\r\n// this._behaviorId = behavior.id();\r\n// this.actionCount = actionCount;\r\n// this.speedLevel = 0;\r\n// this.speedLevel2 = 0;\r\n// this._factionId = entity.getOutwardFactionId();\r\n// assert(this._factionId > 0);\r\n// }\r\n// public id(): number {\r\n// return this._id;\r\n// }\r\n// public entityId(): LEntityId {\r\n// return this._entityId;\r\n// }\r\n// public entity(): LEntity {\r\n// return REGame.world.entity(this._entityId);\r\n// }\r\n// public factionId(): number {\r\n// return this._factionId;\r\n// }\r\n// public behavior(): LUnitBehavior {\r\n// return REGame.world.behavior(this._behaviorId) as LUnitBehavior;\r\n// }\r\n// public isValid(): boolean {\r\n// return this._entityId.hasAny();\r\n// }\r\n// public invalidate(): void {\r\n// this._entityId = LEntityId.makeEmpty();\r\n// }\r\n// public resetEntity(entity: LEntity): void {\r\n// this._entityId = entity.entityId();\r\n// this._behaviorId = entity.getEntityBehavior(LUnitBehavior).id();\r\n// }\r\n// }\r\nvar LSchedulerPhase;\r\n(function (LSchedulerPhase) {\r\n LSchedulerPhase[LSchedulerPhase[\"RoundStarting\"] = 0] = \"RoundStarting\";\r\n LSchedulerPhase[LSchedulerPhase[\"Processing\"] = 1] = \"Processing\";\r\n LSchedulerPhase[LSchedulerPhase[\"RoundEnding\"] = 2] = \"RoundEnding\";\r\n})(LSchedulerPhase = exports.LSchedulerPhase || (exports.LSchedulerPhase = {}));\r\nlet LSchedulingUnit = class LSchedulingUnit {\r\n constructor(index, entity, unitBehavior) {\r\n this._index = index;\r\n this._entityId = entity.entityId();\r\n this._unitBehaviorId = unitBehavior.id();\r\n this._factionId = entity.getOutwardFactionId();\r\n (0, Common_1.assert)(this._factionId > 0);\r\n this._iterationCountMax = 0;\r\n this._iterationCount = 0;\r\n //this.actionCount = 0;\r\n this.speedLevel = 0;\r\n this.speedLevel2 = 0;\r\n }\r\n index() {\r\n return this._index;\r\n }\r\n entityId() {\r\n return this._entityId;\r\n }\r\n get entity2() {\r\n return this.entity();\r\n }\r\n entity() {\r\n return MRLively_1.MRLively.world.entity(this._entityId);\r\n }\r\n factionId() {\r\n return this._factionId;\r\n }\r\n unitBehavior() {\r\n return MRLively_1.MRLively.world.behavior(this._unitBehaviorId);\r\n }\r\n calcActionCount() {\r\n const speedLevel = LScheduler2.getSpeedLevel(this.entity());\r\n if (speedLevel <= 0) {\r\n // 鈍足状態。行動回数としては 1 として扱う。\r\n // 実際に手番が回ることになるが、行動トークンを持っていないので行動できないことになる。\r\n return 1;\r\n }\r\n else {\r\n return speedLevel;\r\n }\r\n }\r\n isManual() {\r\n return this.unitBehavior().manualMovement();\r\n }\r\n isActionCompleted() {\r\n const actionToken = this.entity()._actionToken;\r\n return !actionToken.canMinorAction() && !actionToken.canMajorAction();\r\n }\r\n isValid() {\r\n return this._entityId.hasAny();\r\n }\r\n invalidate() {\r\n this._entityId = LObject_1.LEntityId.makeEmpty();\r\n }\r\n resetEntity(entity) {\r\n this._entityId = entity.entityId();\r\n this._unitBehaviorId = entity.getEntityBehavior(LUnitBehavior_1.LUnitBehavior).id();\r\n this._factionId = entity.getOutwardFactionId();\r\n (0, Common_1.assert)(this._factionId > 0);\r\n }\r\n resetIterationCount() {\r\n this._iterationCount = 0;\r\n }\r\n iterationCountMax() {\r\n return this._iterationCountMax;\r\n }\r\n setIterationCountMax(value) {\r\n this._iterationCountMax = value;\r\n }\r\n remainIterationCount() {\r\n return (this._iterationCountMax - this._iterationCount).clamp(0, this._iterationCountMax);\r\n }\r\n isIterationClosed() {\r\n return this._iterationCount >= this._iterationCountMax;\r\n }\r\n increaseIterationCount() {\r\n this._iterationCount++;\r\n }\r\n};\r\nLSchedulingUnit = __decorate([\r\n Common_1.MRSerializable\r\n], LSchedulingUnit);\r\nexports.LSchedulingUnit = LSchedulingUnit;\r\n// - Round 中に新たに発生した Unit は、今回 round では行動しない\r\nlet LScheduler2 = LScheduler2_1 = class LScheduler2 {\r\n constructor() {\r\n /*\r\n [2021/11/3] 行動順テーブル廃止\r\n ----------\r\n 行動速度の変化によってテーブルの再編成が必要になるが、その処理がかなり複雑になってきたため。\r\n 行動候補となるタイミングで都度 IterationCount などを判断する仕組みの方が、処理負荷は上がるが多少シンプルで柔軟に対応できる。\r\n */\r\n this.chedulerPhase = LSchedulerPhase.RoundStarting;\r\n // ターン実行中の Entity 発生・削除に備え、Map の Entities を直接参照せず、\r\n // Round 開始時に取り出しておく。そのためこの配列内の Entity が destroy されたときは\r\n // 要素に対して invalidaate しておく必要がある。\r\n this._schedulingUnits = [];\r\n this.nextSearchIndex = 0;\r\n this._currentPhaseIndex = 0;\r\n this.maxRunCount = 0;\r\n this.currentRunIndex = 0;\r\n // buildSchedulingUnits() 時点の最大行動回数。\r\n // あくまで参考値。Step 実行中の行動回数減少などは反映しない。\r\n this._maxActionCount = 0;\r\n }\r\n buildSchedulingUnits() {\r\n this._schedulingUnits = [];\r\n this._maxActionCount = 0;\r\n this.currentRunIndex = 0;\r\n // 行動できるすべての entity を集める\r\n for (const entity of MRLively_1.MRLively.mapView.currentMap.entities()) {\r\n const behavior = entity.findEntityBehavior(LUnitBehavior_1.LUnitBehavior);\r\n if (behavior) {\r\n //const canAct = entity.iterateStates(s => s.stateEffect().restriction != DStateRestriction.NotAction);\r\n //if (canAct) {\r\n const unit = this.newUnit(entity, behavior);\r\n //const speedLevel = this.getSpeedLevel(entity);\r\n const actionCount = unit.calcActionCount();\r\n //unit.actionCount = speedLevel;\r\n unit.speedLevel = unit.speedLevel2 = LScheduler2_1.getSpeedLevel(entity);\r\n // if (unit.actionCount < 0) {\r\n // unit.actionCount = 1;\r\n // }\r\n this._maxActionCount = Math.max(this._maxActionCount, actionCount);\r\n //}\r\n }\r\n }\r\n this.maxRunCount = this._maxActionCount;\r\n // 勢力順にソートしておく。\r\n // これによって Player を優先的に検索できるようになる。\r\n const sortedUnits = this._schedulingUnits.immutableSort((a, b) => { return MRData_1.MRData.factions[a.factionId()].schedulingOrder - MRData_1.MRData.factions[b.factionId()].schedulingOrder; });\r\n }\r\n schedulingUnits() {\r\n return this._schedulingUnits;\r\n }\r\n currentPhaseIndex() {\r\n return this._currentPhaseIndex;\r\n }\r\n newUnit(entity, behavior) {\r\n const unit = new LSchedulingUnit(this._schedulingUnits.length, entity, behavior);\r\n this._schedulingUnits.push(unit);\r\n return unit;\r\n }\r\n static getSpeedLevel(entity) {\r\n // TODO: ユニットテスト用。後で消す\r\n const b = entity.findEntityBehavior(LUnitBehavior_1.LUnitBehavior);\r\n if (b && b._speedLevel != 0)\r\n return b._speedLevel;\r\n const agi = entity.getActualParam(MRBasics_1.MRBasics.params.agi);\r\n const v = (agi >= 0) ? (Math.floor(agi / 100) + 1) : Math.floor(agi / 100);\r\n return v;\r\n }\r\n // schedulingUnits に行動トークンを配る。\r\n // 鈍足状態の Unit に対してはウェイトカウントの更新も行う。\r\n dealActionTokens() {\r\n // ターン開始時の各 unit の設定更新\r\n for (const unit of this._schedulingUnits) {\r\n const behavior = unit.unitBehavior();\r\n const entity = unit.entity();\r\n const speedLevel = LScheduler2_1.getSpeedLevel(entity);\r\n // 鈍足状態の対応。待ちターン数を更新\r\n if (speedLevel < 0) {\r\n if (behavior.waitTurnCount() == 0) {\r\n behavior.setWaitTurnCount(1);\r\n }\r\n else {\r\n behavior.setWaitTurnCount(behavior.waitTurnCount() - 1);\r\n }\r\n }\r\n // 行動トークンを更新\r\n if (behavior.waitTurnCount() == 0) {\r\n // 行動トークンを、速度の分だけ配る。\r\n entity._actionToken.reset(entity, Math.max(1, speedLevel));\r\n }\r\n else {\r\n // 鈍足状態。このターンは行動トークンをもらえない。\r\n }\r\n }\r\n }\r\n resetSeek() {\r\n this.nextSearchIndex = 0;\r\n }\r\n nextUnit(phase) {\r\n if (!this.isSeeking()) {\r\n return false; // iteration end.\r\n }\r\n while (true) {\r\n const unit = this._schedulingUnits[this.nextSearchIndex];\r\n this.nextSearchIndex++;\r\n if (this.pick(phase, unit)) {\r\n unit.resetIterationCount();\r\n return true;\r\n }\r\n if (this.nextSearchIndex >= this._schedulingUnits.length) {\r\n return false; // iteration end.\r\n }\r\n }\r\n }\r\n currentUnit() {\r\n const index = this.nextSearchIndex - 1;\r\n (0, Common_1.assert)(0 <= index && index < this._schedulingUnits.length);\r\n return this._schedulingUnits[index];\r\n }\r\n isSeeking() {\r\n return this.nextSearchIndex < this._schedulingUnits.length;\r\n }\r\n // https://1drv.ms/x/s!Ano7WuQbt_eBgcZLyMaObhXjKW0uig?e=nkrHye\r\n pick(phase, unit) {\r\n if (!unit.isValid())\r\n return false;\r\n if (!phase.testProcessable(unit.entity(), unit.unitBehavior()))\r\n return false;\r\n // Player に関しては、IterationCount は常に1である。マージは行わない。\r\n // 3 倍速 Player が 2 人いる場合は常に交互に操作することになる。\r\n if (unit.isManual()) {\r\n unit.setIterationCountMax(1);\r\n return true;\r\n }\r\n const actionCount = unit.calcActionCount();\r\n // 行動回数 1 の NPC の場合、他に行動回数が 2 以上 (倍速 Entity) が要る場合は行動しない。\r\n // つまり、行動優先度をさげ、速度が速い人に先をゆずる。\r\n if (actionCount == 1) {\r\n if (this.currentRunIndex >= this.maxRunCount - 1) {\r\n unit.setIterationCountMax(actionCount);\r\n return true;\r\n }\r\n else {\r\n return false;\r\n }\r\n /*\r\n let otherActionMax = 0;\r\n for (let i = 0; i < this._schedulingUnits.length; i++) {\r\n const unit2 = this._schedulingUnits[i];\r\n if (unit2.index() != unit.index() && !unit2.isActionCompleted()) {\r\n otherActionMax = Math.max(otherActionMax, unit2.actionCount);\r\n }\r\n }\r\n if (otherActionMax >= 2) {\r\n return false;\r\n }\r\n else {\r\n // このっているのは行動回数 1 のものだけなので、動いてよい\r\n unit.setIterationCountMax(1);\r\n return true;\r\n }\r\n */\r\n }\r\n // 倍速以上の NPCは、他に Manual で操作する Entity がいる場合交互に動くので、IterationCount は 1.\r\n // NPC しか残っていないときは、残行動数分まとめて動ける。\r\n if (actionCount >= 2) {\r\n let manualActionMax = 0;\r\n for (const unit2 of this._schedulingUnits) {\r\n if (unit2.isValid() && unit2.isManual() && !unit2.isActionCompleted()) {\r\n manualActionMax = Math.max(manualActionMax, actionCount);\r\n }\r\n }\r\n if (phase.isAllowIterationAtPrepare()) {\r\n if (manualActionMax > 0) {\r\n unit.setIterationCountMax(1);\r\n return true;\r\n }\r\n else {\r\n unit.setIterationCountMax(actionCount);\r\n return true;\r\n }\r\n }\r\n else {\r\n unit.setIterationCountMax(1);\r\n return true;\r\n }\r\n }\r\n throw new Error(\"Unreachable.\");\r\n }\r\n invalidateEntity(entity) {\r\n const index = this._schedulingUnits.findIndex(x => x.entityId().equals(entity.entityId()));\r\n if (index >= 0) {\r\n this._schedulingUnits[index].invalidate();\r\n }\r\n }\r\n resetEntity(entity) {\r\n const index = this._schedulingUnits.findIndex(x => x.entityId().equals(entity.entityId()));\r\n if (index >= 0) {\r\n this._schedulingUnits[index].resetEntity(entity);\r\n }\r\n }\r\n hasReadyEntity() {\r\n for (const unit of this._schedulingUnits) {\r\n const actionToken = unit.entity()._actionToken;\r\n if (!unit.isActionCompleted()) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n attemptRefreshSpeedLevel() {\r\n // 各 Entity の最新の SpeedLevel を取得しながら、Refresh が必要かチェックする\r\n const changesUnits = [];\r\n let maxSpeed = 0;\r\n for (const unit of this._schedulingUnits) {\r\n if (unit.isValid()) {\r\n const entity = unit.entity();\r\n unit.speedLevel2 = LScheduler2_1.getSpeedLevel(entity);\r\n const diff = unit.speedLevel2 - unit.speedLevel;\r\n if (unit.speedLevel2 > unit.speedLevel) {\r\n // 速度アップ\r\n changesUnits.push(unit);\r\n maxSpeed = Math.max(unit.speedLevel2, maxSpeed);\r\n unit.speedLevel = unit.speedLevel2;\r\n if (unit == this.currentUnit()) {\r\n // 素早さ草を飲んだ場合など、自分自身で速度アップした場合、Run をまたがずに直後に再行動したい。\r\n // この時行動速度が x1 の Unit しかいないのに Run を増やすと、モーションのタイミングがずれることがある。\r\n // 例えば、x1 Enemy が次の Run で行動することになるため、Player が移動後アイテムを拾ったときのモーションとの間に\r\n // Run1 の AIMajorPhase が入り、ここで Flush されるため、Player と Enemy のモーションがまとめて再生されなくなる。\r\n }\r\n else {\r\n this.maxRunCount = Math.max(this.maxRunCount, unit.speedLevel);\r\n }\r\n // 速度の増減分だけ、行動トークンも調整する。\r\n entity._actionToken.charge(diff);\r\n if (this.existsHighSpeedReadyEntity(unit)) {\r\n // 他に倍速 Entity がいる場合は iterationCount を増やしたくない。\r\n // \r\n // 例えば、素早さ草をのんだら直ちに Player にターンが回るが、\r\n // 倍速Enemyがいるときに Player が素早さ草を飲んでも Player にターンを回したくない。\r\n }\r\n else {\r\n unit.setIterationCountMax(unit.iterationCountMax() + diff);\r\n }\r\n }\r\n if (unit.speedLevel2 < unit.speedLevel) {\r\n // 速度ダウン\r\n entity._actionToken.charge(diff);\r\n unit.speedLevel = unit.speedLevel2;\r\n }\r\n }\r\n }\r\n }\r\n // subject 以外に、倍速かつまだ行動する可能性がある Unit が存在しているか?\r\n existsHighSpeedReadyEntity(subject) {\r\n for (const unit of this._schedulingUnits) {\r\n if (unit.isValid() && unit.index() != subject.index()) {\r\n if (unit.speedLevel > 1 && !unit.isActionCompleted()) {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n }\r\n};\r\nLScheduler2 = LScheduler2_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LScheduler2);\r\nexports.LScheduler2 = LScheduler2;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/LScheduler.ts?"); /***/ }), /***/ "./ts/mr/lively/LSchedulingResult.ts": /*!*******************************************!*\ !*** ./ts/mr/lively/LSchedulingResult.ts ***! \*******************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LSchedulingResult = exports.LPhaseResult = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst LActionToken_1 = __webpack_require__(/*! ./LActionToken */ \"./ts/mr/lively/LActionToken.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ./MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nlet LPhaseResult = class LPhaseResult {\r\n clear() {\r\n this.consumedActionToken = undefined;\r\n }\r\n};\r\nLPhaseResult = __decorate([\r\n Common_1.MRSerializable\r\n], LPhaseResult);\r\nexports.LPhaseResult = LPhaseResult;\r\nlet LSchedulingResult = class LSchedulingResult {\r\n constructor() {\r\n this._phaseResults = [];\r\n this.stateUpdatedInRun = false;\r\n }\r\n clear() {\r\n for (const phase of this._phaseResults) {\r\n if (phase) {\r\n phase.clear();\r\n }\r\n }\r\n this.stateUpdatedInRun = false;\r\n }\r\n setConsumedActionToken(phaseIndex, type) {\r\n const phase = this.acquirePhaseResult(phaseIndex);\r\n if (type == LActionToken_1.LActionTokenType.Major) {\r\n phase.consumedActionToken = type;\r\n }\r\n else if (type == LActionToken_1.LActionTokenType.Minor && phase.consumedActionToken === undefined) {\r\n phase.consumedActionToken = type;\r\n }\r\n }\r\n setConsumedActionTokeInCurrentPhase(type) {\r\n this.setConsumedActionToken(MRLively_1.MRLively.scheduler.currentPhaseIndex(), type);\r\n }\r\n consumedActionToken(phaseIndex) {\r\n const phase = this._phaseResults[phaseIndex];\r\n if (!phase)\r\n return undefined;\r\n return phase.consumedActionToken;\r\n }\r\n // public consumedActionTokenInCurrentPhase(type: LActionTokenType): LActionTokenType | undefined {\r\n // return this.setConsumedActionToken(REGame.scheduler.currentPhaseIndex(), type);\r\n // }\r\n acquirePhaseResult(phaseIndex) {\r\n if (phaseIndex >= this._phaseResults.length ||\r\n this._phaseResults[phaseIndex] == undefined) {\r\n const newData = new LPhaseResult();\r\n this._phaseResults[phaseIndex] = newData;\r\n return newData;\r\n }\r\n const data = this._phaseResults[phaseIndex];\r\n (0, Common_1.assert)(data);\r\n return data;\r\n }\r\n};\r\nLSchedulingResult = __decorate([\r\n Common_1.MRSerializable\r\n], LSchedulingResult);\r\nexports.LSchedulingResult = LSchedulingResult;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/LSchedulingResult.ts?"); /***/ }), /***/ "./ts/mr/lively/LScript.ts": /*!*********************************!*\ !*** ./ts/mr/lively/LScript.ts ***! \*********************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LScriptContext = exports.LScriptCallMode = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ./MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nvar LScriptCallMode;\r\n(function (LScriptCallMode) {\r\n LScriptCallMode[LScriptCallMode[\"Query\"] = 0] = \"Query\";\r\n LScriptCallMode[LScriptCallMode[\"Command\"] = 1] = \"Command\";\r\n})(LScriptCallMode = exports.LScriptCallMode || (exports.LScriptCallMode = {}));\r\nclass LScriptContext {\r\n constructor(id, entity, finalClassScript, label, mode) {\r\n this.talkingCommands = [];\r\n this.questIconKey = undefined;\r\n this.id = id;\r\n this.finalClassScript = finalClassScript;\r\n this.label = label;\r\n this.mode = mode;\r\n this.list = [];\r\n this.listIndex = 0;\r\n if (entity) {\r\n this.entityId = entity.entityId().clone();\r\n // Select list.\r\n const result = this.findListAndLabel(entity, this.label);\r\n if (result) {\r\n this.list = result.list;\r\n this.listIndex = result.index;\r\n }\r\n }\r\n else {\r\n const list = this.finalClassScript.list;\r\n const index1 = LScriptContext.findLabelIndex(list, this.label);\r\n if (index1 >= 0) {\r\n this.list = list;\r\n this.listIndex = index1;\r\n }\r\n }\r\n }\r\n setupEventScript() {\r\n return true;\r\n }\r\n get isValid() {\r\n return this.list.length > 0;\r\n }\r\n get entity() {\r\n (0, Common_1.assert)(this.entityId);\r\n return MRLively_1.MRLively.world.entity(this.entityId);\r\n }\r\n // NOTE: Visual の Collapse 中など、 entity が isDestroyed になっている場合がある。\r\n // MRLively.world.entity() で撮ろうとすると assert するので、引数で渡す。\r\n findListAndLabel(entity, label) {\r\n const prefab = entity.data.prefab();\r\n const lists = [\r\n prefab.scripts[0].list,\r\n this.finalClassScript.list,\r\n ];\r\n const spawner = entity.getUniqueSpawner();\r\n if (spawner && spawner.overrideEvent) {\r\n console.log(\"TODO: Event Page condition.\");\r\n lists.push(spawner.overrideEvent.pages[0].list);\r\n }\r\n for (let i = lists.length - 1; i >= 0; i--) {\r\n const list = lists[i];\r\n const index1 = LScriptContext.findLabelIndex(list, label);\r\n if (index1 >= 0) {\r\n return {\r\n list: list,\r\n index: index1,\r\n };\r\n }\r\n }\r\n return undefined;\r\n }\r\n static findLabelIndex(list, label) {\r\n for (let i = 0; i < list.length; i++) {\r\n const command = list[i];\r\n if (command.code === 118) {\r\n if (command.parameters[0] === label) {\r\n return i;\r\n }\r\n }\r\n }\r\n return -1;\r\n }\r\n}\r\nexports.LScriptContext = LScriptContext;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/LScript.ts?"); /***/ }), /***/ "./ts/mr/lively/LScriptManager.ts": /*!****************************************!*\ !*** ./ts/mr/lively/LScriptManager.ts ***! \****************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LScriptManager = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ../system/MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst LScript_1 = __webpack_require__(/*! ./LScript */ \"./ts/mr/lively/LScript.ts\");\r\nclass LScriptManager {\r\n constructor() {\r\n this._scriptContexts = [undefined]; // [0] is dummy.\r\n }\r\n getScriptContext(id) {\r\n const script = this._scriptContexts[id];\r\n (0, Common_1.assert)(script);\r\n return script;\r\n }\r\n callQuery(entity, finalClassScript, label) {\r\n const id = this.getId();\r\n const script = new LScript_1.LScriptContext(id, entity, finalClassScript, label, LScript_1.LScriptCallMode.Query);\r\n if (script.isValid) {\r\n this._scriptContexts[id] = script;\r\n MRSystem_1.MRSystem.integration.onStartEventScript(script);\r\n }\r\n return script;\r\n }\r\n callCommand(entity, finalClassScript, label) {\r\n const id = this.getId();\r\n const script = new LScript_1.LScriptContext(id, entity, finalClassScript, label, LScript_1.LScriptCallMode.Command);\r\n if (script.isValid) {\r\n this._scriptContexts[id] = script;\r\n MRSystem_1.MRSystem.integration.onStartEventScript(script);\r\n return true;\r\n }\r\n return false;\r\n }\r\n getId() {\r\n for (let i = 1; i < this._scriptContexts.length; i++) {\r\n if (!this._scriptContexts[i]) {\r\n return i;\r\n }\r\n }\r\n return this._scriptContexts.length;\r\n }\r\n}\r\nexports.LScriptManager = LScriptManager;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/LScriptManager.ts?"); /***/ }), /***/ "./ts/mr/lively/LShopArticle.ts": /*!**************************************!*\ !*** ./ts/mr/lively/LShopArticle.ts ***! \**************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LShopArticle = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nlet LShopArticle = class LShopArticle {\r\n constructor() {\r\n this._ownerShopStructureId = 0;\r\n }\r\n isSalling() {\r\n return this._ownerShopStructureId > 0;\r\n }\r\n};\r\nLShopArticle = __decorate([\r\n Common_1.MRSerializable\r\n], LShopArticle);\r\nexports.LShopArticle = LShopArticle;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/LShopArticle.ts?"); /***/ }), /***/ "./ts/mr/lively/LSystem.ts": /*!*********************************!*\ !*** ./ts/mr/lively/LSystem.ts ***! \*********************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LSystem = void 0;\r\nconst LObject_1 = __webpack_require__(/*! ./LObject */ \"./ts/mr/lively/LObject.ts\");\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ./MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst USearch_1 = __webpack_require__(/*! ../utility/USearch */ \"./ts/mr/utility/USearch.ts\");\r\n/**\r\n */\r\nlet LSystem = class LSystem {\r\n constructor() {\r\n // experimental: \"場所移動\" 等の基準となる、メインプレイヤーの Entity.\r\n // もし仲間がいるような場合、MainPlayerEntity がマップ移動したらついてきたりする。\r\n this.mainPlayerEntityId = LObject_1.LEntityId.makeEmpty();\r\n this.uniqueActorUnits = [];\r\n this.eventInterpreterContextKey = undefined;\r\n }\r\n get mainPlayerEntity() {\r\n return MRLively_1.MRLively.world.entity(MRLively_1.MRLively.system.mainPlayerEntityId);\r\n }\r\n getEventCommandTarget() {\r\n if (!this.eventInterpreterContextKey) {\r\n if (MRLively_1.MRLively.mapView.currentMap.floorId().isNormalMap2) {\r\n // key が指定されていないが、現在のマップがツクール標準システムのマップであれば、ツクール標準のコマンドを実行する\r\n return undefined;\r\n }\r\n else {\r\n // key が指定されていないが、現在のマップが MR システムのマップであれば、操作中 Player をターゲットにする\r\n return this.mainPlayerEntity;\r\n }\r\n }\r\n if (this.eventInterpreterContextKey == \"${Player}\") {\r\n // 操作中の Unit (Player) が対象\r\n return this.mainPlayerEntity;\r\n }\r\n return USearch_1.USearch.getEntityByKeyPattern(this.eventInterpreterContextKey);\r\n }\r\n};\r\nLSystem = __decorate([\r\n Common_1.MRSerializable\r\n], LSystem);\r\nexports.LSystem = LSystem;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/LSystem.ts?"); /***/ }), /***/ "./ts/mr/lively/LWorld.ts": /*!********************************!*\ !*** ./ts/mr/lively/LWorld.ts ***! \********************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LWorld = exports.LTransferEntityResult = void 0;\r\nconst LEntity_1 = __webpack_require__(/*! ./entity/LEntity */ \"./ts/mr/lively/entity/LEntity.ts\");\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ./MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LRandom_1 = __webpack_require__(/*! ts/mr/lively/LRandom */ \"./ts/mr/lively/LRandom.ts\");\r\nconst LObject_1 = __webpack_require__(/*! ./LObject */ \"./ts/mr/lively/LObject.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst LLand_1 = __webpack_require__(/*! ./LLand */ \"./ts/mr/lively/LLand.ts\");\r\nconst LParty_1 = __webpack_require__(/*! ./LParty */ \"./ts/mr/lively/LParty.ts\");\r\nconst UMovement_1 = __webpack_require__(/*! ts/mr/utility/UMovement */ \"./ts/mr/utility/UMovement.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ts/mr/system/MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst UState_1 = __webpack_require__(/*! ts/mr/utility/UState */ \"./ts/mr/utility/UState.ts\");\r\nconst LMap_1 = __webpack_require__(/*! ./LMap */ \"./ts/mr/lively/LMap.ts\");\r\nvar LTransferEntityResult;\r\n(function (LTransferEntityResult) {\r\n LTransferEntityResult[LTransferEntityResult[\"NoMoved\"] = 0] = \"NoMoved\";\r\n LTransferEntityResult[LTransferEntityResult[\"BlockMoved\"] = 1] = \"BlockMoved\";\r\n LTransferEntityResult[LTransferEntityResult[\"FloorMoved\"] = 2] = \"FloorMoved\";\r\n LTransferEntityResult[LTransferEntityResult[\"LandMoved\"] = 3] = \"LandMoved\";\r\n})(LTransferEntityResult = exports.LTransferEntityResult || (exports.LTransferEntityResult = {}));\r\n/**\r\n * 1ゲーム内に1インスタンス存在する。\r\n */\r\nlet LWorld = class LWorld {\r\n constructor() {\r\n this._objects = [];\r\n this._random = new LRandom_1.LRandom(Math.floor(Math.random() * 65535) + 1);\r\n this._objects = [undefined]; // [0] is dummy\r\n this._lands = [];\r\n for (const landData of MRData_1.MRData.lands) {\r\n const land = new LLand_1.LLand(landData);\r\n this._lands.push(land);\r\n }\r\n this._mapObjectIds = [];\r\n this._parties = [undefined]; // [0] is dummy\r\n }\r\n object(id) {\r\n const e = this._objects[id.index2()];\r\n if (e && e.__objectId().key2() == id.key2()) {\r\n return e;\r\n }\r\n else {\r\n if (!e) {\r\n throw new Error(`Unregisterd entity. (id: [${id.index2()}, ${id.key2()}])`);\r\n }\r\n else {\r\n throw new Error(`Destroyed entity. (id: [${id.index2()}, ${id.key2()}], actualy:[${e.__objectId().index2()}, ${e.__objectId().key2()}])`);\r\n }\r\n }\r\n }\r\n map(floorId) {\r\n (0, Common_1.assert)(!floorId.isEmpty);\r\n // セーブデータ引継ぎに備えて、動的作成とする。Game_Actors.actor() と同じ。\r\n let floors = this._mapObjectIds[floorId.landId];\r\n if (!floors) {\r\n floors = [];\r\n this._mapObjectIds[floorId.landId] = floors;\r\n }\r\n let mapId = floors[floorId.floorNumber];\r\n if (!mapId) {\r\n const map = new LMap_1.LMap(floorId);\r\n this._registerObject(map);\r\n mapId = map.__objectId();\r\n floors[floorId.floorNumber] = mapId;\r\n }\r\n return this.object(mapId);\r\n }\r\n findObject(id) {\r\n const e = this._objects[id.index2()];\r\n if (e && e.__objectId().key2() == id.key2()) {\r\n return e;\r\n }\r\n else {\r\n return undefined;\r\n }\r\n }\r\n iterateEntity(func) {\r\n for (const obj of this._objects) {\r\n if (obj && obj.objectType() == LObject_1.LObjectType.Entity) {\r\n if (func(obj) === false)\r\n return;\r\n }\r\n }\r\n }\r\n findEntity(id) {\r\n const obj = this.findObject(id);\r\n if (obj && obj.objectType() == LObject_1.LObjectType.Entity)\r\n return obj;\r\n else\r\n return undefined;\r\n }\r\n findFirstEntity(func) {\r\n const r = MRLively_1.MRLively.world.objects().find(x => {\r\n if (x instanceof LEntity_1.LEntity) {\r\n return func(x);\r\n }\r\n return false;\r\n });\r\n if (r && r instanceof LEntity_1.LEntity) {\r\n return r;\r\n }\r\n else {\r\n return undefined;\r\n }\r\n }\r\n getFirstEntityByKey(key) {\r\n const entity = this.findFirstEntity(x => x.data.entity.key == key);\r\n if (!entity)\r\n throw new Error(`Entity not found (${key})`);\r\n return entity;\r\n }\r\n findBehavior(id) {\r\n const obj = this.findObject(id);\r\n if (obj && obj.objectType() == LObject_1.LObjectType.Behavior)\r\n return obj;\r\n else\r\n return undefined;\r\n }\r\n objects() {\r\n return this._objects;\r\n }\r\n entity(id) {\r\n const e = this.findEntity(id);\r\n if (!e) {\r\n throw new Error(`Invalid entity type. (id: [${id.index2()}, ${id.key2()}])`);\r\n }\r\n return e;\r\n }\r\n behavior(id) {\r\n const e = this.findBehavior(id);\r\n if (!e) {\r\n throw new Error(`Invalid behavior type. (id: [${id.index2()}, ${id.key2()}])`);\r\n }\r\n return e;\r\n }\r\n entityByIndex(index) {\r\n const e = this._objects[index];\r\n (0, Common_1.assert)(e instanceof LEntity_1.LEntity);\r\n return e;\r\n }\r\n ability(id) {\r\n const e = this.object(id);\r\n if (e.objectType() == LObject_1.LObjectType.Ability)\r\n return e;\r\n else\r\n throw new Error(`Invalid ability type. (id: [${id.index2()}, ${id.key2()}])`);\r\n }\r\n random() {\r\n return this._random;\r\n }\r\n land(landId) {\r\n return this._lands[landId];\r\n }\r\n party(partyId) {\r\n const p = this._parties[partyId];\r\n (0, Common_1.assert)(p);\r\n return p;\r\n }\r\n /**\r\n * 新しい Entity を World 内に生成する。\r\n *\r\n * 生成された Entity はいずれの Floor にも属さない状態となっている。\r\n * 出現させるには transfarEntity() を呼び出す必要がある。\r\n */\r\n spawnEntity(entityDataId) {\r\n const entity = new LEntity_1.LEntity();\r\n entity.setupInstance(entityDataId);\r\n this._registerObject(entity);\r\n return entity;\r\n }\r\n /**\r\n * インスタンスを作成し、World に登録する。\r\n * この後、何らかの親オブジェクトに属さない場合、GC で削除される。\r\n */\r\n spawn(ctor) {\r\n const obj = new ctor();\r\n this._registerObject(obj);\r\n return obj;\r\n }\r\n newParty() {\r\n const party = new LParty_1.LParty();\r\n const index = this._parties.findIndex((x, i) => i > 0 && x == undefined);\r\n if (index < 0) {\r\n party.setup(this._parties.length);\r\n this._parties.push(party);\r\n }\r\n else {\r\n party.setup(index);\r\n this._parties[index] = party;\r\n }\r\n return party;\r\n }\r\n _registerObject(obj) {\r\n (0, Common_1.assert)(!obj.hasId());\r\n // TODO: 空き場所を愚直に線形探索。\r\n // 大量の Entity を扱うようになったら最適化する。\r\n const index = this._objects.findIndex((x, i) => i > 0 && x == undefined);\r\n if (index < 0) {\r\n obj._setObjectId(new LObject_1.LEntityId(this._objects.length, this._random.nextInt()));\r\n this._objects.push(obj);\r\n }\r\n else {\r\n obj._setObjectId(new LObject_1.LEntityId(index, this._random.nextInt()));\r\n this._objects[index] = obj;\r\n }\r\n }\r\n /**\r\n * Entity を指定した位置に移動する。\r\n * - 現在表示中のマップへ移動した場合、そのマップへ登場する。\r\n * - 移動先の同一 BlockLayer に別の Entity がいた場合、移動は失敗する。\r\n * - 表示中以外のマップ(固定マップ)へ移動した場合、\r\n * - 移動先の同一 BlockLayer に別の Entity がいた場合、移動は失敗する。\r\n *\r\n * 直ちに座標を変更するため、コマンドチェーン実行内からの呼び出しは禁止。\r\n * CommandContext.postTransferFloor() を使うこと。\r\n *\r\n * このメソッドで移動しても、足元に対するアクションは行わない。(罠を踏んだり、アイテムを拾ったりしない)\r\n *\r\n * mx, my は省略可能。これは、未ロードのランダムマップへの遷移時に使用する。\r\n */\r\n transferEntity(entity, floorId, mx = -1, my = -1) {\r\n //const currentMapId = MRLively.camera.currentMap;\r\n const mapFloorId = MRLively_1.MRLively.mapView.currentFloorId; //currentMap.floorId();\r\n const currentMap = mapFloorId.hasAny ? MRLively_1.MRLively.world.map(mapFloorId) : undefined;\r\n if (entity.floorId.hasAny && // 遷移前のマップが存在すること\r\n !mapFloorId.equals(floorId) && floorId.isRandomMap2) {\r\n // 未ロードのランダムマップへ遷移するとき、座標が明示されているのはおかしい\r\n (0, Common_1.assert)(mx < 0);\r\n (0, Common_1.assert)(my < 0);\r\n }\r\n const oldMX = entity.mx;\r\n const oldMY = entity.my;\r\n const oldFloorNumber = entity.floorId.floorNumber;\r\n const oldLandId = entity.floorId.landId;\r\n const newMap = MRLively_1.MRLively.world.map(floorId);\r\n // Floor 間移動?\r\n if (!entity.floorId.equals(floorId)) {\r\n UState_1.UState.attemptRemoveStateAtFloorTransfer(entity);\r\n }\r\n // if (mapFloorId.hasAny() && !mapFloorId.equals(floorId) && mapFloorId.equals(entity.floorId)) {\r\n // // 現在マップからの離脱\r\n // assert(currentMap);\r\n // currentMap._removeEntity(entity);\r\n // }\r\n // 現在マップからの離脱\r\n if (entity.floorId.hasAny) {\r\n const oldMap = MRLively_1.MRLively.world.map(entity.floorId);\r\n oldMap._removeEntity(entity);\r\n }\r\n // 新しいマップへの登場\r\n entity.floorId = floorId.clone();\r\n newMap._addEntityInternal(entity);\r\n // 座標の設定\r\n if (newMap.hasMapData) {\r\n // MapView 表示中のマップ上での移動\r\n newMap.locateEntity(entity, mx, my);\r\n }\r\n else {\r\n // 表示中ではないマップでの移動\r\n UMovement_1.UMovement.locateEntityAtFloorMoved(entity, floorId, mx, my);\r\n }\r\n // 座標確定後に、View へ通知する\r\n MRLively_1.MRLively.mapView.onEntityEnteredFromMap(entity);\r\n // if (mapFloorId.equals(floorId)) {\r\n // if (entity.floorId.equals(floorId)) {\r\n // // 現在マップ内での座標移動\r\n // UMovement.locateEntity(entity, mx, my);\r\n // }\r\n // else {\r\n // // 他の Floor から、現在表示中の Floor へ移動\r\n // entity.floorId = floorId;\r\n // UMovement.locateEntity(entity, mx, my);\r\n // assert(currentMap);\r\n // currentMap._addEntityInternal(entity);\r\n // }\r\n // }\r\n // else {\r\n // // 現在マップから他のフロアへの移動\r\n // UMovement.locateEntityAtFloorMoved(entity, floorId, mx, my);\r\n // }\r\n MRLively_1.MRLively.mapView.onEntityTransferred(entity);\r\n let result = LTransferEntityResult.NoMoved;\r\n if (entity.mx != oldMX || entity.my != oldMY) {\r\n result = LTransferEntityResult.BlockMoved;\r\n }\r\n if (entity.floorId.floorNumber != oldFloorNumber) {\r\n result = LTransferEntityResult.FloorMoved;\r\n }\r\n if (entity.floorId.landId != oldLandId) {\r\n result = LTransferEntityResult.LandMoved;\r\n }\r\n // Land 間移動が行われた\r\n if (oldLandId != floorId.landId) {\r\n MRSystem_1.MRSystem.groundRules.onEntityLandLeaved(entity);\r\n const party = entity.party();\r\n if (party) {\r\n party.onMemberMovedLand(entity, floorId.landId, oldLandId);\r\n }\r\n }\r\n return result;\r\n }\r\n _removeDestroyedObjects() {\r\n for (let i = 1; i < this._objects.length; i++) {\r\n const obj = this._objects[i];\r\n if (obj) {\r\n if (obj.isGCReady()) {\r\n // Unique Entity 以外で、いずれからの参照もない Entity は削除する\r\n obj.destroy();\r\n }\r\n if (obj.isDestroyed()) {\r\n obj.onFinalize();\r\n this._objects[i] = undefined;\r\n if (MRLively_1.MRLively.mapView.focusedEntityId().equals(obj.__objectId())) {\r\n MRLively_1.MRLively.mapView.clearFocus();\r\n }\r\n }\r\n }\r\n }\r\n // Party\r\n for (let i = 1; i < this._parties.length; i++) {\r\n const party = this._parties[i];\r\n if (party && party.isEmpty()) {\r\n this._parties[i] = undefined;\r\n }\r\n }\r\n }\r\n getEntityByRmmzActorId(rmmzActorId) {\r\n let actorEntity;\r\n MRLively_1.MRLively.world.iterateEntity(entity => {\r\n const actorData = entity.data.actor;\r\n if (actorData && actorData.rmmzActorId == rmmzActorId) {\r\n actorEntity = entity;\r\n return false;\r\n }\r\n return true;\r\n });\r\n (0, Common_1.assert)(actorEntity);\r\n return actorEntity;\r\n }\r\n};\r\nLWorld = __decorate([\r\n Common_1.MRSerializable\r\n], LWorld);\r\nexports.LWorld = LWorld;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/LWorld.ts?"); /***/ }), /***/ "./ts/mr/lively/MRGameExtension.ts": /*!*****************************************!*\ !*** ./ts/mr/lively/MRGameExtension.ts ***! \*****************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.MRGameExtension = void 0;\r\nclass MRGameExtension {\r\n}\r\nexports.MRGameExtension = MRGameExtension;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/MRGameExtension.ts?"); /***/ }), /***/ "./ts/mr/lively/MRLively.ts": /*!**********************************!*\ !*** ./ts/mr/lively/MRLively.ts ***! \**********************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.MRLively = void 0;\r\nconst MRGameExtension_1 = __webpack_require__(/*! ./MRGameExtension */ \"./ts/mr/lively/MRGameExtension.ts\");\r\n/**\r\n * 各 REGame_* インスタンスを保持する。\r\n *\r\n * コアスクリプトの $game* と同じ役割。\r\n */\r\nclass MRLively {\r\n static getCurrentLand() {\r\n return this.mapView.currentMap.land2();\r\n }\r\n static getCurrentIdentifyer() {\r\n return this.getCurrentLand().identifyer;\r\n }\r\n}\r\nexports.MRLively = MRLively;\r\nMRLively.TILE_LAYER_COUNT = 6;\r\nMRLively.ext = new MRGameExtension_1.MRGameExtension();\r\n// 冒険結果の表示中かどうか\r\nMRLively.challengeResultShowing = false;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/MRLively.ts?"); /***/ }), /***/ "./ts/mr/lively/abilities/LAbility.ts": /*!********************************************!*\ !*** ./ts/mr/lively/abilities/LAbility.ts ***! \********************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LAbility_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LAbility = void 0;\r\nconst LObject_1 = __webpack_require__(/*! ../LObject */ \"./ts/mr/lively/LObject.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst SBehaviorFactory_1 = __webpack_require__(/*! ts/mr/system/SBehaviorFactory */ \"./ts/mr/system/SBehaviorFactory.ts\");\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\n/**\r\n * Ability は Entity の各種行動や与・被Effect 時に追加の様々な効果を与えるもの。\r\n *\r\n * 振舞いは State と非常によく似ているが、Ability は合成印や新種道具の効果を表すものであり、\r\n * アイテムの詳細説明ウィンドウの効果欄に列挙されたりする。\r\n *\r\n *\r\n * [2021/2/20] Ability は Entity にはしないの?\r\n * ----------\r\n * State と同じだけど、いったんしない方向で行ってみる。\r\n * Entity にすればいろいろな応用が利きそうだけど現状はする・しないに対して明確な理由は出し切れない。\r\n * とりあえず YAGNI で。\r\n *\r\n * あと Entity としたとき、Behavior から ownerEntity をとるときにちょっと細工する必要があるのが不自然かも。\r\n *\r\n */\r\nlet LAbility = LAbility_1 = class LAbility extends LObject_1.LObject {\r\n constructor() {\r\n super(LObject_1.LObjectType.Ability);\r\n this._abilityId = 0;\r\n //private _ownerEntityId: LEntityId = { index: 0, key: 0 };\r\n this._behabiorIds = [];\r\n }\r\n clone(newOwner) {\r\n const ability = new LAbility_1();\r\n MRLively_1.MRLively.world._registerObject(ability);\r\n ability._abilityId = this._abilityId;\r\n for (const i of this.behabiors()) {\r\n const i2 = i.clone(newOwner);\r\n ability._behabiorIds.push(i2.id());\r\n i2.setParent(this);\r\n }\r\n return ability;\r\n }\r\n id() {\r\n return this.__objectId();\r\n }\r\n setup(abilityId /*, owner: LEntity*/) {\r\n this._abilityId = abilityId;\r\n //this.setParent(owner);\r\n MRLively_1.MRLively.world._registerObject(this);\r\n // TODO: test\r\n //this._behabiorIds = [new LKnockbackBehavior()];\r\n const b = SBehaviorFactory_1.SBehaviorManager.createBehavior(\"LKnockbackBehavior\");\r\n (0, Common_1.assert)(b);\r\n this.addBehavior(b);\r\n }\r\n abilityId() {\r\n return this._abilityId;\r\n }\r\n addBehavior(behavior) {\r\n (0, Common_1.assert)(behavior.hasId());\r\n this._behabiorIds.push(behavior.id());\r\n }\r\n behabiors() {\r\n return this._behabiorIds.map(id => MRLively_1.MRLively.world.behavior(id));\r\n }\r\n iterateBehaviors(func) {\r\n for (const id of this._behabiorIds) {\r\n if (func(MRLively_1.MRLively.world.behavior(id)) === false)\r\n return false;\r\n }\r\n return true;\r\n }\r\n onAttached(self) {\r\n this.behabiors().forEach(b => {\r\n b.setParent(this);\r\n b.onAttached(self);\r\n });\r\n }\r\n onDetached(self) {\r\n this.behabiors().forEach(b => {\r\n b.onDetached(self);\r\n b.destroy();\r\n });\r\n }\r\n onRemoveChild(entity) { }\r\n};\r\nLAbility = LAbility_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LAbility);\r\nexports.LAbility = LAbility;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/abilities/LAbility.ts?"); /***/ }), /***/ "./ts/mr/lively/abilities/LEntityDivisionBehavior.ts": /*!***********************************************************!*\ !*** ./ts/mr/lively/abilities/LEntityDivisionBehavior.ts ***! \***********************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LEntityDivisionBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LEntityDivisionBehavior = void 0;\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst UMovement_1 = __webpack_require__(/*! ts/mr/utility/UMovement */ \"./ts/mr/utility/UMovement.ts\");\r\nconst LBattlerBehavior_1 = __webpack_require__(/*! ../behaviors/LBattlerBehavior */ \"./ts/mr/lively/behaviors/LBattlerBehavior.ts\");\r\nconst LBehavior_1 = __webpack_require__(/*! ../behaviors/LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\nconst LMap_1 = __webpack_require__(/*! ../LMap */ \"./ts/mr/lively/LMap.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst HMovement_1 = __webpack_require__(/*! ../helpers/HMovement */ \"./ts/mr/lively/helpers/HMovement.ts\");\r\n/** @deprecated TODO: カウンターアクションとして、\"分裂\" スキルを発動するようにしたい */\r\nlet LEntityDivisionBehavior = LEntityDivisionBehavior_1 = class LEntityDivisionBehavior extends LBehavior_1.LBehavior {\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LEntityDivisionBehavior_1);\r\n return b;\r\n }\r\n [LBehavior_1.onDirectAttackDamaged](args, cctx) {\r\n const self = args.self;\r\n const battler = self.getEntityBehavior(LBattlerBehavior_1.LBattlerBehavior);\r\n if (self.isDeathStateAffected())\r\n return SCommand_1.SCommandResponse.Pass;\r\n const selfBlock = MRLively_1.MRLively.mapView.currentMap.block(self.mx, self.my);\r\n // 有効な隣接 Block があり、その方向へ移動可能かを調べる\r\n const candidates = UMovement_1.UMovement.getAdjacentBlocks(self).filter(b => HMovement_1.HMovement.checkPassageBlockToBlock(self, selfBlock, b, LMap_1.MovingMethod.Walk));\r\n if (candidates.length > 1) {\r\n const newBlock = candidates[cctx.random().nextIntWithMax(candidates.length)];\r\n const newEntity = self.clone();\r\n MRLively_1.MRLively.world.transferEntity(newEntity, self.floorId, newBlock.mx, newBlock.my);\r\n cctx.postSequel(newEntity, MRBasics_1.MRBasics.sequels.MoveSequel).setStartPosition(self.mx, self.my);\r\n cctx.postWaitSequel();\r\n }\r\n else {\r\n // 周囲に空きが無いため分裂できない\r\n }\r\n return SCommand_1.SCommandResponse.Pass;\r\n }\r\n};\r\nLEntityDivisionBehavior = LEntityDivisionBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LEntityDivisionBehavior);\r\nexports.LEntityDivisionBehavior = LEntityDivisionBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/abilities/LEntityDivisionBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/abilities/LGrabFootBehavior.ts": /*!*****************************************************!*\ !*** ./ts/mr/lively/abilities/LGrabFootBehavior.ts ***! \*****************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LGrabFootBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LGrabFootBehavior = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst UName_1 = __webpack_require__(/*! ts/mr/utility/UName */ \"./ts/mr/utility/UName.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LBehavior_1 = __webpack_require__(/*! ../behaviors/LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\nconst UMovement_1 = __webpack_require__(/*! ts/mr/utility/UMovement */ \"./ts/mr/utility/UMovement.ts\");\r\nconst LObject_1 = __webpack_require__(/*! ../LObject */ \"./ts/mr/lively/LObject.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst LEventServer_1 = __webpack_require__(/*! ../LEventServer */ \"./ts/mr/lively/LEventServer.ts\");\r\nconst Helpers_1 = __webpack_require__(/*! ts/mr/system/Helpers */ \"./ts/mr/system/Helpers.ts\");\r\n/**\r\n * 足つかみ。\r\n *\r\n *\r\n */\r\nlet LGrabFootBehavior = LGrabFootBehavior_1 = class LGrabFootBehavior extends LBehavior_1.LBehavior {\r\n constructor() {\r\n super();\r\n this._targetId = LObject_1.LEntityId.makeEmpty();\r\n }\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LGrabFootBehavior_1);\r\n return b;\r\n }\r\n onAttached(self) {\r\n // const target = UMovement.getFrontBlock(self).getFirstEntity(BlockLayerKind.Unit);\r\n // if (target) {\r\n // this._targetId = target.entityId();\r\n // }\r\n MRLively_1.MRLively.eventServer.subscribe(MRBasics_1.MRBasics.events.preWalk, this);\r\n }\r\n onDetached(self) {\r\n MRLively_1.MRLively.eventServer.unsubscribe(MRBasics_1.MRBasics.events.preWalk, this);\r\n }\r\n onEvent(cctx, eventId, args) {\r\n const self = this.ownerEntity();\r\n if (eventId == MRBasics_1.MRBasics.events.preWalk) {\r\n const e = args;\r\n if (this._targetId.isEmpty()) {\r\n if (UMovement_1.UMovement.checkDirectlyAdjacentEntity(self, e.walker) && Helpers_1.Helpers.isHostile(self, e.walker)) {\r\n // 新たなターゲットを見つけた\r\n this._targetId = e.walker.entityId();\r\n }\r\n }\r\n else {\r\n if (!UMovement_1.UMovement.checkDirectlyAdjacentEntity(self, e.walker)) {\r\n // これまで掴んでいたターゲットが強制移動等で離れた\r\n this._targetId = LObject_1.LEntityId.makeEmpty();\r\n }\r\n }\r\n if (e.walker.entityId().equals(this._targetId)) {\r\n self.dir = UMovement_1.UMovement.getLookAtDir(self, e.walker);\r\n cctx.postSequel(self, MRBasics_1.MRBasics.sequels.attack);\r\n cctx.postMessage((0, Common_1.tr2)(\"%1は身動きが取れない!\").format(UName_1.UName.makeUnitName(e.walker)));\r\n return LEventServer_1.LEventResult.Handled;\r\n }\r\n }\r\n return LEventServer_1.LEventResult.Pass;\r\n }\r\n};\r\nLGrabFootBehavior = LGrabFootBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LGrabFootBehavior);\r\nexports.LGrabFootBehavior = LGrabFootBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/abilities/LGrabFootBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/abilities/LKnockbackBehavior.ts": /*!******************************************************!*\ !*** ./ts/mr/lively/abilities/LKnockbackBehavior.ts ***! \******************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LKnockbackBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LKnockbackBehavior = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst LBehavior_1 = __webpack_require__(/*! ../behaviors/LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nlet LKnockbackBehavior = LKnockbackBehavior_1 = class LKnockbackBehavior extends LBehavior_1.LBehavior {\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LKnockbackBehavior_1);\r\n return b;\r\n }\r\n};\r\nLKnockbackBehavior = LKnockbackBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LKnockbackBehavior);\r\nexports.LKnockbackBehavior = LKnockbackBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/abilities/LKnockbackBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/activities/LActivity.ts": /*!**********************************************!*\ !*** ./ts/mr/lively/activities/LActivity.ts ***! \**********************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LActivity_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LActivity = exports.LDashType = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst SAIHelper_1 = __webpack_require__(/*! ts/mr/system/SAIHelper */ \"./ts/mr/system/SAIHelper.ts\");\r\nconst UMovement_1 = __webpack_require__(/*! ts/mr/utility/UMovement */ \"./ts/mr/utility/UMovement.ts\");\r\nconst LObject_1 = __webpack_require__(/*! ../LObject */ \"./ts/mr/lively/LObject.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst LCommon_1 = __webpack_require__(/*! ../LCommon */ \"./ts/mr/lively/LCommon.ts\");\r\nvar LDashType;\r\n(function (LDashType) {\r\n /** 直線ダッシュ。アイテムの前で止まる。 */\r\n LDashType[LDashType[\"StraightDash\"] = 0] = \"StraightDash\";\r\n /** iダッシュ。 */\r\n LDashType[LDashType[\"PositionalDash\"] = 1] = \"PositionalDash\";\r\n})(LDashType = exports.LDashType || (exports.LDashType = {}));\r\n/**\r\n * Unit の \"行動\"。\r\n *\r\n * 行動履歴として記録される。シリアライズされ、ファイルに保存される。\r\n *\r\n *\r\n *\r\n * Activity にするべきか迷ったとき\r\n * ----------\r\n * ### 未知の拡張機能により、行動がリジェクトされることを想定するか?\r\n */\r\nlet LActivity = LActivity_1 = class LActivity {\r\n //private _selectedItems: LEntityId[];\r\n constructor() {\r\n this._actionId = 0;\r\n this._actor = LObject_1.LEntityId.makeEmpty();\r\n this._subject = LObject_1.LEntityId.makeEmpty();\r\n this._object = LObject_1.LEntityId.makeEmpty();\r\n this._objects2 = [];\r\n this._skillId = 0;\r\n this._effectDirection = 0;\r\n this._entityDirection = 0;\r\n this._actionTokenConsumeType = undefined;\r\n this._args = undefined;\r\n this._selectedAction = \"\";\r\n }\r\n setup(actionId, actor, object, dir) {\r\n this._actionId = actionId;\r\n this._actor = actor.entityId().clone();\r\n this._subject = actor.entityId().clone();\r\n this._object = object ? object.entityId() : LObject_1.LEntityId.makeEmpty();\r\n this._objects2 = [];\r\n this._effectDirection = dir !== null && dir !== void 0 ? dir : 0;\r\n this._entityDirection = 0;\r\n this._actionTokenConsumeType = undefined;\r\n this._args = undefined;\r\n this._selectedAction = \"\";\r\n return this;\r\n }\r\n actionId() {\r\n return this._actionId;\r\n }\r\n get action() {\r\n return MRData_1.MRData.skills[this._actionId];\r\n }\r\n actor() {\r\n return MRLively_1.MRLively.world.entity(this._actor);\r\n }\r\n subject() {\r\n return MRLively_1.MRLively.world.entity(this._subject);\r\n }\r\n hasObject() {\r\n return this._object.hasAny();\r\n }\r\n object() {\r\n return MRLively_1.MRLively.world.entity(this._object);\r\n }\r\n setObject(object) {\r\n this._object = object.entityId();\r\n }\r\n objects2() {\r\n return this._objects2.map(x => MRLively_1.MRLively.world.entity(x));\r\n }\r\n setObjects2(objects) {\r\n this._objects2 = objects.map(x => x.entityId());\r\n }\r\n skillId() {\r\n return this._skillId;\r\n }\r\n withOtherSubject(subject) {\r\n this._subject = subject.entityId().clone();\r\n return this;\r\n }\r\n withEffectDirection(d) {\r\n this._effectDirection = d;\r\n return this;\r\n }\r\n effectDirection() {\r\n return this._effectDirection;\r\n }\r\n hasEffectDirection() {\r\n return this._effectDirection != 0;\r\n }\r\n entityDirection() {\r\n return this._entityDirection;\r\n }\r\n withEntityDirection(dir) {\r\n this._entityDirection = dir;\r\n return this;\r\n }\r\n withConsumeAction(consumeType) {\r\n if (consumeType !== undefined) {\r\n this._actionTokenConsumeType = consumeType;\r\n }\r\n else {\r\n if (this._actionId == MRBasics_1.MRBasics.actions.MoveToAdjacentActionId) {\r\n this._actionTokenConsumeType = LCommon_1.LActionTokenConsumeType.MinorActed;\r\n }\r\n else {\r\n this._actionTokenConsumeType = LCommon_1.LActionTokenConsumeType.MajorActed;\r\n }\r\n }\r\n return this;\r\n }\r\n isConsumeAction() {\r\n return this._actionTokenConsumeType != undefined;\r\n }\r\n consumeActionTokenType() {\r\n return this._actionTokenConsumeType;\r\n }\r\n getConsumeActionTokenType() {\r\n (0, Common_1.assert)(this._actionTokenConsumeType !== undefined);\r\n return this._actionTokenConsumeType;\r\n }\r\n withArgs(args) {\r\n this._args = args;\r\n return this;\r\n }\r\n args() {\r\n return this._args;\r\n }\r\n selectedAction() {\r\n return this._selectedAction;\r\n }\r\n toData() {\r\n return {\r\n actionId: this._actionId,\r\n actor: { index: this._actor.index2(), key: this._actor.key2() },\r\n subject: { index: this._subject.index2(), key: this._subject.key2() },\r\n object: { index: this._object.index2(), key: this._object.key2() },\r\n objects2: this._objects2.map(x => { return { index: x.index2(), key: x.key2() }; }),\r\n skillId: this._skillId,\r\n direction: this._effectDirection,\r\n entityDirection: this._entityDirection,\r\n actionTokenConsumeType: this._actionTokenConsumeType,\r\n args: this._args,\r\n selectedAction: this._selectedAction,\r\n };\r\n }\r\n static makeFromData(data) {\r\n const i = new LActivity_1();\r\n i._actionId = data.actionId;\r\n i._actor = new LObject_1.LEntityId(data.actor.index, data.actor.key);\r\n i._subject = new LObject_1.LEntityId(data.subject.index, data.subject.key);\r\n i._object = new LObject_1.LEntityId(data.object.index, data.object.key);\r\n i._objects2 = data.objects2.map(x => new LObject_1.LEntityId(x.index, x.key));\r\n i._skillId = data.skillId;\r\n i._effectDirection = data.direction;\r\n i._entityDirection = data.entityDirection;\r\n i._actionTokenConsumeType = data.actionTokenConsumeType;\r\n i._args = data.args;\r\n i._selectedAction = data.selectedAction;\r\n return i;\r\n }\r\n //--------------------\r\n // Utils\r\n static make(actor) {\r\n return (new LActivity_1()).setup(0, actor);\r\n }\r\n static makeDirectionChange(actor, dir) {\r\n return (new LActivity_1()).setup(MRBasics_1.MRBasics.actions.DirectionChangeActionId, actor, undefined, dir).withEntityDirection(dir);\r\n }\r\n static makeMoveToAdjacent(actor, dir) {\r\n return (new LActivity_1()).setup(MRBasics_1.MRBasics.actions.MoveToAdjacentActionId, actor, undefined, dir);\r\n }\r\n static makeMoveToAdjacentBlock(actor, block) {\r\n //assert(UMovement.blockDistance(actor.x, actor.y, block.x(), block.y()) <= 1); // 隣接ブロックであること\r\n (0, Common_1.assert)(UMovement_1.UMovement.checkAdjacentPositions(actor.mx, actor.my, block.mx, block.my)); // 隣接ブロックであること\r\n const dir = SAIHelper_1.SAIHelper.distanceToDir(actor.mx, actor.my, block.mx, block.my);\r\n return (new LActivity_1()).setup(MRBasics_1.MRBasics.actions.MoveToAdjacentActionId, actor, undefined, dir);\r\n }\r\n static makePrimaryUse(subject, object) {\r\n const reaction = object.data.reactions.find(x => x.primariyUse);\r\n if (reaction) {\r\n const a = (new LActivity_1()).setup(reaction.actionId, subject, object);\r\n return a;\r\n }\r\n else {\r\n return this.make(subject);\r\n }\r\n }\r\n static makePick(actor) {\r\n return (new LActivity_1()).setup(MRBasics_1.MRBasics.actions.PickActionId, actor);\r\n }\r\n static makePut(actor, object) {\r\n return (new LActivity_1()).setup(MRBasics_1.MRBasics.actions.PutActionId, actor, object);\r\n }\r\n static makeThrow(actor, object) {\r\n return (new LActivity_1()).setup(MRBasics_1.MRBasics.actions.ThrowActionId, actor, object);\r\n }\r\n static makeShooting(actor, object) {\r\n return (new LActivity_1()).setup(MRBasics_1.MRBasics.actions.ShootActionId, actor, object);\r\n }\r\n static makeFall(actor) {\r\n return (new LActivity_1()).setup(MRBasics_1.MRBasics.actions.FallActionId, actor);\r\n }\r\n static makeTrample(actor) {\r\n return (new LActivity_1()).setup(MRBasics_1.MRBasics.actions.trample, actor);\r\n }\r\n static makeExchange(actor, object) {\r\n return (new LActivity_1()).setup(MRBasics_1.MRBasics.actions.ExchangeActionId, actor, object);\r\n }\r\n static makeEquip(actor, object) {\r\n return (new LActivity_1()).setup(MRBasics_1.MRBasics.actions.EquipActionId, actor, object);\r\n }\r\n static makeEquipOff(actor, object) {\r\n return (new LActivity_1()).setup(MRBasics_1.MRBasics.actions.EquipOffActionId, actor, object);\r\n }\r\n static makeEat(actor, object) {\r\n return (new LActivity_1()).setup(MRBasics_1.MRBasics.actions.EatActionId, actor, object);\r\n }\r\n static makeWave(actor, object) {\r\n return (new LActivity_1()).setup(MRBasics_1.MRBasics.actions.WaveActionId, actor, object);\r\n }\r\n static makeRead(actor, object, targets) {\r\n const a = (new LActivity_1()).setup(MRBasics_1.MRBasics.actions.ReadActionId, actor, object);\r\n if (targets)\r\n a.setObjects2(targets);\r\n return a;\r\n }\r\n static makePutIn(actor, storage, items) {\r\n const a = (new LActivity_1()).setup(MRBasics_1.MRBasics.actions.PutInActionId, actor, storage);\r\n a._objects2 = items.map(x => x.entityId());\r\n return a;\r\n }\r\n static makePickOut(actor, storage, items) {\r\n const a = (new LActivity_1()).setup(MRBasics_1.MRBasics.actions.PickOutActionId, actor, storage);\r\n a._objects2 = items.map(x => x.entityId());\r\n return a;\r\n }\r\n static makeTalk(actor) {\r\n const a = (new LActivity_1()).setup(MRBasics_1.MRBasics.actions.talk, actor);\r\n return a;\r\n }\r\n // public static makeCollide(subject: LEntity, target: LEntity): LActivity {\r\n // const a = (new LActivity()).setup(MRBasics.actions.collide, subject);\r\n // a.setObjects2([target]);\r\n // return a;\r\n // }\r\n static makePerformSkill(actor, skillId, dirToFace) {\r\n (0, Common_1.assert)(skillId > 0);\r\n const a = (new LActivity_1()).setup(MRBasics_1.MRBasics.actions.performSkill, actor);\r\n if (dirToFace !== undefined)\r\n a._effectDirection = dirToFace;\r\n a._skillId = skillId;\r\n return a;\r\n }\r\n static makeDialogResult(actor, target, selectedAction) {\r\n const a = (new LActivity_1()).setup(MRBasics_1.MRBasics.actions.dialogResult, actor, target);\r\n a._selectedAction = selectedAction;\r\n return a;\r\n }\r\n};\r\nLActivity = LActivity_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LActivity);\r\nexports.LActivity = LActivity;\r\n/*\r\n[2021/10/20] 動作の予防について\r\n----------\r\n- 転び防止\r\n- 盗み防止\r\n- 爆発防止 (冷え香)\r\n- ワープ防止?\r\n\r\n当初これらは ActivityReaction でリジェクトすることで対応しようとしてたが、\r\nこれらの効果は EffectBehavior からも発動する必要になってきたためちょっと迷い中。\r\n\r\n例えば転ばせは Activity でも実現できるが、起点は Effect となるべき。\r\n転ばぬ先の杖、転び石効果、転び土偶、モンスター特技等から実行される。\r\n\r\n実際のところ、転び防止、盗み防止くらいなら EffectBehavior 側で相手の Trait を見て、発動しないだけでよい。\r\nReaction でリジェクトしたいのは、それ以外の条件によってはじきたいとき。\r\n例えば [話す] は、敵対 Entity ならリジェクトしたい。\r\n\r\n\r\n### Skill と Activity の違い\r\n\r\n今のところ、Activity は Core 外部から入力される行動の起点を示すもので、Recorder で記録されるもの、としている。\r\nまた、いくつかの Activity はシステムと強く結びついており、[置く] [交換] などは対象を選択する UI が必要となる。\r\n\r\n対して Skill は前準備無しで即 \"実行\" できる。対象を選択する必要はない。(あるいは事前に狙いをつけたものに対して発動する)。Skill には成否・命中判定が伴う。\r\nSkill は複数の Effect を含むことができるため、[転び] と [盗み] を同時に発動できる。\r\nこのため Skill == Activity にはできない。同様に Effect == Activity も NG。\r\nSpecialEffect == Activity ならまだ余地はありそうだが、SpecialEffect はステートやバフ付加など Activity 以外の処理を行いたいこともある。\r\n\r\nSkill や Effect は [転び] と [盗み] といったアクションと 1:1 にできないので、やっぱり Activity として再利用はできない。\r\n\r\n\r\n### 防止効果の指定方法\r\n\r\nもし Activity に [転び] と [盗み] といったものを実装するなら、防止 Trait は具体的な [転び防止] [盗み防止] ではなく、\r\n[指定IDのActivity防止] にすることができて、汎用性が上がる。\r\nActor と Reactor 側どちらかを指定できればなおよい。\r\nこれができると \"巻物忘れ\"([読む]ができない) などの実装も容易になる。\r\n→ 現状、Actor 側は SealActivity で実装済み。\r\n\r\n\r\n### 何を懸念している?→ [転び] [盗み] は Activity なのか?\r\n\r\n消去法によるアイデアなので、ほんとによいかちょっと不安。\r\n[移動] [向き変更] [拾う] [置く] [交換] といった行動までリジェクトできるような仕組みでよいのか?\r\n→ 別に構わないと思うし、実際にこれらはありえそう。\r\n 逆に、無理に別の分類にする意味のほうが薄いかもしれない。\r\n\r\nただ、Activity と効果が 1:1 だと面倒なこともある。\r\n例えば [盗む] と一言にいっても、\r\n- アイテム盗み\r\n- ゴールド盗み\r\n- ついばみ\r\n- すいこみ\r\n- アイテムをつかんで投げ捨てる\r\n等が考えられる。\r\nこれら一つずつ Activity と 防止 Trait を用意するのはちょっと面倒だし、設定ミスも起こりやすくなる。\r\nこういったケースではやっぱり [盗み防止] Trait ひとつで対応したいところ。\r\n\r\nそうするといくつかの効果をグループ化するような仕組みとなるので、[盗み防止] という具体的な Trait になるのもやむなしか。\r\n\r\nこれら Trait の説明文としては、\r\n- [盗み] に分類される特殊効果を防止します。\r\n- [転び] に分類される特殊効果を防止します。\r\n\r\n\r\n\r\n*/\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/activities/LActivity.ts?"); /***/ }), /***/ "./ts/mr/lively/ai2/LMinorActionExecutor.ts": /*!**************************************************!*\ !*** ./ts/mr/lively/ai2/LMinorActionExecutor.ts ***! \**************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LMinorActionExecutor_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LMinorActionExecutor = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst DPrefab_1 = __webpack_require__(/*! ts/mr/data/DPrefab */ \"./ts/mr/data/DPrefab.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst Helpers_1 = __webpack_require__(/*! ts/mr/system/Helpers */ \"./ts/mr/system/Helpers.ts\");\r\nconst SAIHelper_1 = __webpack_require__(/*! ts/mr/system/SAIHelper */ \"./ts/mr/system/SAIHelper.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst UMovement_1 = __webpack_require__(/*! ts/mr/utility/UMovement */ \"./ts/mr/utility/UMovement.ts\");\r\nconst LActivity_1 = __webpack_require__(/*! ../activities/LActivity */ \"./ts/mr/lively/activities/LActivity.ts\");\r\nconst LMoveDeterminer_1 = __webpack_require__(/*! ../ai/LMoveDeterminer */ \"./ts/mr/lively/ai/LMoveDeterminer.ts\");\r\nconst LCommon_1 = __webpack_require__(/*! ../LCommon */ \"./ts/mr/lively/LCommon.ts\");\r\nlet LMinorActionExecutor = LMinorActionExecutor_1 = class LMinorActionExecutor {\r\n clone() {\r\n return new LMinorActionExecutor_1();\r\n }\r\n executeMinorActionIfNeeded(cctx, agent, self) {\r\n if (agent.requiredSkillAction) {\r\n if (agent.requiredSkillAction.action.skillId == MRData_1.MRData.system.skills.wait) {\r\n const activity = LActivity_1.LActivity.make(self);\r\n if (agent.requiredSkillAction.forceMovedDirection) {\r\n activity.withEntityDirection(agent.requiredSkillAction.forceMovedDirection);\r\n }\r\n activity.withConsumeAction(LCommon_1.LActionTokenConsumeType.MinorActed);\r\n // 隣接していなければ相手を向いて待機。\r\n // 消費 Token を Major にしてしまうと、倍速1回行動の時に上手く動かないので Minor で消費する。\r\n cctx.postActivity(activity);\r\n return SCommand_1.SPhaseResult.Handled;\r\n }\r\n else if (agent.requiredSkillAction.action.skillId == MRData_1.MRData.system.skills.move ||\r\n agent.requiredSkillAction.action.skillId == MRData_1.MRData.system.skills.escape) {\r\n // 移動メイン\r\n if (self.data.prefab().moveType == DPrefab_1.DPrefabMoveType.Random) {\r\n if (this.perform(cctx, agent, self)) {\r\n return SCommand_1.SPhaseResult.Handled;\r\n }\r\n }\r\n }\r\n else {\r\n // メジャーアクションで何かしたいかもしれない。このフェーズでは何もしない。\r\n return SCommand_1.SPhaseResult.Pass;\r\n }\r\n }\r\n // ここまで来たら、攻撃対象も無いうえに移動ができなかったということ。\r\n // 例えば、壁に埋まっている状態。\r\n // FIXME: ここでやるのが最善かわからないが、攻撃対象が決められていない場合は\r\n // Major Phase でも行動消費するアクションがとれないので、ハングアップしてしまう。\r\n // ここで消費しておく。\r\n cctx.postConsumeActionToken(self, LCommon_1.LActionTokenConsumeType.WaitActed);\r\n return SCommand_1.SPhaseResult.Handled;\r\n }\r\n /**\r\n * 移動実行\r\n */\r\n perform(cctx, agent, self) {\r\n if (this.performInternal(cctx, agent, self)) {\r\n agent.clearSkipCount();\r\n return true;\r\n }\r\n return false;\r\n }\r\n // \r\n performInternal(cctx, agent, self) {\r\n // 目的地設定がなされてるのであればそこへ向かって移動する\r\n if (this.canModeToTarget(agent, self)) {\r\n if (this.moveToTarget(self, cctx, agent)) {\r\n return true;\r\n }\r\n else {\r\n // 壁際を斜め移動しようとした等、移動できなかった\r\n agent._decired.method = LMoveDeterminer_1.LMovingMethod.LHRule;\r\n }\r\n }\r\n if (agent._decired.passageway) {\r\n this.postMoveToAdjacent(self, agent._decired.passageway, cctx);\r\n return true;\r\n }\r\n if (agent.hasTargetDestination() &&\r\n self.mx == agent._movingTargetX &&\r\n self.my == agent._movingTargetY) {\r\n // 目標座標が指定されているが既に到達済みの場合は、ランダム移動を行わない。\r\n // 店主など、明示的に移動させない Entity が該当する。\r\n return true;\r\n }\r\n // 左折の法則による移動\r\n if (agent._decired.method == LMoveDeterminer_1.LMovingMethod.LHRule) {\r\n const block = UMovement_1.UMovement.getMovingCandidateBlockAsLHRule(self, self.dir);\r\n if (block) {\r\n this.postMoveToAdjacent(self, block, cctx);\r\n // 移動後、向きの修正\r\n const dir = (agent.hasTargetDestination()) ?\r\n SAIHelper_1.SAIHelper.distanceToDir(self.mx, self.my, agent._movingTargetX, agent._movingTargetY) : // 目標があるならそちらを向ける\r\n UMovement_1.UMovement.getLookAtDirFromPos(self.mx, self.my, block.mx, block.my); // 目標が無ければ進行方向を向く\r\n cctx.postActivity(LActivity_1.LActivity.makeDirectionChange(self, dir));\r\n return true;\r\n }\r\n }\r\n agent.increaseSkipCount();\r\n if (agent.skipCoun >= 6) {\r\n // 6連続で移動できなかったときはランダム移動\r\n const candidates = UMovement_1.UMovement.getMovableAdjacentTiles(self);\r\n if (candidates.length > 0) {\r\n const block = candidates[cctx.random().nextIntWithMax(candidates.length)];\r\n this.postMoveToAdjacent(self, block, cctx);\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n canModeToTarget(agent, self) {\r\n return agent.hasTargetDestination() && (self.mx != agent._movingTargetX || self.my != agent._movingTargetY);\r\n }\r\n moveToTarget(self, cctx, agent) {\r\n // 目的地設定済みで、未到達であること\r\n (0, Common_1.assert)(this.canModeToTarget(agent, self));\r\n const dir = SAIHelper_1.SAIHelper.distanceToDir(self.mx, self.my, agent._movingTargetX, agent._movingTargetY);\r\n if (dir != 0 && UMovement_1.UMovement.checkPassageToDir(self, dir)) {\r\n cctx.postActivity(LActivity_1.LActivity.makeDirectionChange(self, dir));\r\n cctx.postActivity(LActivity_1.LActivity.makeMoveToAdjacent(self, dir));\r\n //this.moveToAdjacent(self, block, cctx);\r\n cctx.postConsumeActionToken(self, LCommon_1.LActionTokenConsumeType.MinorActed);\r\n return true;\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n postMoveToAdjacent(self, block, cctx) {\r\n const dir = Helpers_1.Helpers.offsetToDir(block.mx - self.mx, block.my - self.my);\r\n cctx.postActivity(LActivity_1.LActivity.makeDirectionChange(self, dir));\r\n cctx.postActivity(LActivity_1.LActivity.makeMoveToAdjacent(self, dir));\r\n cctx.postConsumeActionToken(self, LCommon_1.LActionTokenConsumeType.MinorActed);\r\n }\r\n};\r\nLMinorActionExecutor = LMinorActionExecutor_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LMinorActionExecutor);\r\nexports.LMinorActionExecutor = LMinorActionExecutor;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/ai2/LMinorActionExecutor.ts?"); /***/ }), /***/ "./ts/mr/lively/ai2/LThinkingAction.ts": /*!*********************************************!*\ !*** ./ts/mr/lively/ai2/LThinkingAction.ts ***! \*********************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LThinkingAction = void 0;\r\nconst DSkill_1 = __webpack_require__(/*! ts/mr/data/DSkill */ \"./ts/mr/data/DSkill.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\n/**\r\n * Think フェーズで列挙される行動候補\r\n */\r\nclass LThinkingAction {\r\n constructor(action, targets) {\r\n this.action = action;\r\n this.targets = targets;\r\n }\r\n clone() {\r\n const i = new LThinkingAction(Object.assign({}, this.action), this.targets.map(x => x.clone()));\r\n i.priorityTargetX = this.priorityTargetX;\r\n i.priorityTargetY = this.priorityTargetY;\r\n i.priorityMovingDirection = this.priorityMovingDirection;\r\n i.forceMovedDirection = this.forceMovedDirection;\r\n return i;\r\n }\r\n get skill() { return MRData_1.MRData.skills[this.action.skillId]; }\r\n get isMinor() { return this.skill.skillClass == DSkill_1.DSkillClass.Minor; }\r\n get isMajor() { return this.skill.skillClass == DSkill_1.DSkillClass.Major; }\r\n}\r\nexports.LThinkingAction = LThinkingAction;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/ai2/LThinkingAction.ts?"); /***/ }), /***/ "./ts/mr/lively/ai2/LThinkingAgent.ts": /*!********************************************!*\ !*** ./ts/mr/lively/ai2/LThinkingAgent.ts ***! \********************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LThinkingAgent_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LThinkingAgent = exports.LThinkingActionRatings = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst DSpawner_1 = __webpack_require__(/*! ts/mr/data/DSpawner */ \"./ts/mr/data/DSpawner.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst SAIHelper_1 = __webpack_require__(/*! ts/mr/system/SAIHelper */ \"./ts/mr/system/SAIHelper.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst SEmittorPerformer_1 = __webpack_require__(/*! ts/mr/system/SEmittorPerformer */ \"./ts/mr/system/SEmittorPerformer.ts\");\r\nconst UAction_1 = __webpack_require__(/*! ts/mr/utility/UAction */ \"./ts/mr/utility/UAction.ts\");\r\nconst UEffect_1 = __webpack_require__(/*! ts/mr/utility/UEffect */ \"./ts/mr/utility/UEffect.ts\");\r\nconst UMovement_1 = __webpack_require__(/*! ts/mr/utility/UMovement */ \"./ts/mr/utility/UMovement.ts\");\r\nconst LMoveDeterminer_1 = __webpack_require__(/*! ../ai/LMoveDeterminer */ \"./ts/mr/lively/ai/LMoveDeterminer.ts\");\r\nconst HMovement_1 = __webpack_require__(/*! ../helpers/HMovement */ \"./ts/mr/lively/helpers/HMovement.ts\");\r\nconst LCommon_1 = __webpack_require__(/*! ../LCommon */ \"./ts/mr/lively/LCommon.ts\");\r\nconst LObject_1 = __webpack_require__(/*! ../LObject */ \"./ts/mr/lively/LObject.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LMinorActionExecutor_1 = __webpack_require__(/*! ./LMinorActionExecutor */ \"./ts/mr/lively/ai2/LMinorActionExecutor.ts\");\r\nclass LThinkingActionRatings {\r\n}\r\nexports.LThinkingActionRatings = LThinkingActionRatings;\r\n/*\r\n優先度の考え方\r\n----------\r\n「ある Action を、優先度 XX で許可する」という考えて扱うのがいいのかも。\r\n*/\r\nLThinkingActionRatings.Max = 1000;\r\nLThinkingActionRatings.Normal = 3;\r\nLThinkingActionRatings.Moving = -100;\r\nLThinkingActionRatings.Wait = -200;\r\nLThinkingActionRatings.Escape = 100;\r\nLThinkingActionRatings.Restriction1 = 200;\r\nLThinkingActionRatings.Restriction2 = 200;\r\nLThinkingActionRatings.BasicActionsBegin = 0;\r\nLThinkingActionRatings.BasicActionsEnd = 20;\r\nLThinkingActionRatings.ValidRatingRange = 10;\r\nlet LThinkingAgent = LThinkingAgent_1 = class LThinkingAgent {\r\n constructor(priority, determiners) {\r\n /*\r\n なんで新AIにしたの?\r\n ----------\r\n 旧AIの問題は、\r\n - CharacterAI の独立性が高いので、実際に行動決定する人 (CharacterAI の中の Detaminator) の優先度がコントロールできなかった。\r\n そのため AI が後勝ちになり、後から追加されたステートによって行動が変わることがあった。\r\n - 拡張が非常にやりづらい。\r\n 例えば 通常移動と逃げを判断する CharacterAI が分かれているので、\r\n 「基本の移動処理は踏襲しつつ、視界内に罠があったらそちらに移動する」みたいな処理を追加できない。\r\n 強引にやるなら、StandardAI と EscapeAI 双方を継承してそれぞれ用の拡張が要る。\r\n \r\n 対策として、最初に LThinkingAgent に行動候補をすべて集め、LThinkingAgent が最終的な決定を行うようにした。\r\n */\r\n // 徘徊移動ターゲットとなる座標。\r\n // _primaryTargetEntity ではなく、部屋の入り口などを示すこともある。\r\n this._wanderingTargetX = -1;\r\n this._wanderingTargetY = -1;\r\n this._noActionTurnCount = 0;\r\n this._decired = { method: LMoveDeterminer_1.LMovingMethod.LHRule };\r\n // 最初のフェーズで決定する、メインの行動対象 Entity.\r\n // 基本的に敵対 Entity であり、移動処理のために使用する。\r\n // 通常の AI はここに向かって移動する。\r\n // 逃げ AI はここから離れるように移動する。\r\n //\r\n // 対象決定の処理自体は共通なものなので、 Agent 側で行っておく。\r\n this._primaryTargetEntityId = LObject_1.LEntityId.makeEmpty();\r\n this._movingTargetX = -1;\r\n this._movingTargetY = -1;\r\n this._priority = priority;\r\n this._determiners = determiners;\r\n this._candidateActions = [];\r\n this._minorActionExecutor = new LMinorActionExecutor_1.LMinorActionExecutor();\r\n }\r\n clone() {\r\n const i = new LThinkingAgent_1(this._priority, this._determiners.map(x => x.clone()));\r\n i._wanderingTargetX = this._wanderingTargetX;\r\n i._wanderingTargetY = this._wanderingTargetY;\r\n i._noActionTurnCount = this._noActionTurnCount;\r\n i._decired = Object.assign({}, this._decired);\r\n i._movingTargetX = this._movingTargetX;\r\n i._movingTargetY = this._movingTargetY;\r\n i._candidateActions = this._candidateActions.map(x => x.clone());\r\n i._primaryTargetEntityId = this._primaryTargetEntityId;\r\n i._requiredSkillAction = this._requiredSkillAction;\r\n i._minorActionExecutor = this._minorActionExecutor.clone();\r\n return i;\r\n }\r\n get priority() {\r\n return this._priority;\r\n }\r\n get determiners() {\r\n return this._determiners;\r\n }\r\n get candidateSctions() {\r\n return this._candidateActions;\r\n }\r\n get requiredSkillAction() {\r\n return this._requiredSkillAction;\r\n }\r\n get rand() {\r\n return MRLively_1.MRLively.world.random();\r\n }\r\n get hasPrimaryTarget() {\r\n return this._primaryTargetEntityId.hasAny();\r\n }\r\n get primaryTargetEntityId() {\r\n return this._primaryTargetEntityId;\r\n }\r\n get primaryTarget() {\r\n return MRLively_1.MRLively.world.entity(this._primaryTargetEntityId);\r\n }\r\n addDeterminer(determiner) {\r\n this._determiners.push(determiner);\r\n }\r\n clearCandidateSctions() {\r\n this._candidateActions.length = 0;\r\n }\r\n addCandidateAction(action) {\r\n // 重複排除・上書き\r\n const index = this._candidateActions.findIndex((x) => x.action.skillId === action.action.skillId);\r\n if (index >= 0) {\r\n if (this._candidateActions[index].action.rating <= action.action.rating) {\r\n this._candidateActions[index] = action;\r\n }\r\n }\r\n else {\r\n this._candidateActions.push(action);\r\n }\r\n }\r\n // 目的地あり?\r\n hasWanderingDestination() {\r\n return this._wanderingTargetX >= 0 && this._wanderingTargetY >= 0;\r\n }\r\n hasTargetDestination() {\r\n return this._movingTargetX >= 0 && this._movingTargetY >= 0;\r\n }\r\n clearTargetPosition() {\r\n this._wanderingTargetX = -1;\r\n this._wanderingTargetY = -1;\r\n }\r\n get skipCoun() {\r\n return this._noActionTurnCount;\r\n }\r\n clearSkipCount() {\r\n this._noActionTurnCount = 0;\r\n }\r\n increaseSkipCount() {\r\n this._noActionTurnCount++;\r\n }\r\n think(self) {\r\n // 敵対の PrimaryTarget を探す。\r\n // \r\n // http://twist.jpn.org/sfcsiren/index.php?%E3%82%BF%E3%83%BC%E3%83%B3%E3%81%AE%E9%A0%86%E7%95%AA\r\n // の移動目標位置決定はもう少し後の Phase なのだが、敵対 Entity への移動目標位置決定はこの Phase で行う。\r\n // こうしておかないと、Player の移動を追うように Enemy が移動できなくなる。\r\n {\r\n // 視界内にいる敵対 Entity のうち、一番近い Entity を検索\r\n const target = UAction_1.UAction.findInSightNearlyHostileEntity(self);\r\n if (target) {\r\n this._primaryTargetEntityId = target.entityId().clone();\r\n // TODO: 仮\r\n const dir = SAIHelper_1.SAIHelper.entityDistanceToDir(self, target);\r\n self.dir = dir;\r\n }\r\n else {\r\n //console.log(\"NotImplemented.\");\r\n //this._targetPositionX = -1;\r\n //this._targetPositionY = -1;\r\n this._primaryTargetEntityId = LObject_1.LEntityId.makeEmpty();\r\n }\r\n }\r\n // 行動候補を集める\r\n {\r\n // 基本の onThink\r\n this._determiners.forEach((determiner) => {\r\n determiner.onThink(this, self);\r\n });\r\n // 拡張 onThink\r\n self.iterateBehaviorsReverse((behavior) => {\r\n behavior.onThink(self, this);\r\n });\r\n }\r\n // MajorAction を行いたいときは MinorAction は全部除外\r\n // const hasMajorAction = this._candidateSctions.some((x) => x.isMajor);\r\n // if (hasMajorAction) {\r\n // this._candidateSctions.mutableRemove(x => x.isMinor);\r\n // }\r\n // 行動候補からランダムに選択\r\n const skillAction = UEffect_1.UEffect.selectRating(this.rand, this._candidateActions, x => x.action.rating);\r\n //const skillAction = this.rand.selectOrUndefined(candidates);\r\n if (skillAction) {\r\n this._requiredSkillAction = skillAction;\r\n }\r\n else {\r\n this._requiredSkillAction = undefined;\r\n }\r\n if (self.mx == 19 && self.my == 13) {\r\n console.log(\"debug\");\r\n }\r\n // 移動先決定\r\n [this._movingTargetX, this._movingTargetY] = this.selectMovingTargetPosition(self);\r\n }\r\n selectMovingTargetPosition(self) {\r\n const spawner = self.getUniqueSpawner();\r\n if (this._requiredSkillAction && this._requiredSkillAction.priorityMovingDirection) {\r\n // 移動スキルに優先移動先が設定されている場合は、その方向に移動する\r\n const d = HMovement_1.HMovement.directionToOffset(this._requiredSkillAction.priorityMovingDirection);\r\n return [self.mx + d.x, self.my + d.y];\r\n }\r\n else if (this._requiredSkillAction && this._requiredSkillAction.priorityTargetX !== undefined && this._requiredSkillAction.priorityTargetY !== undefined) {\r\n return [this._requiredSkillAction.priorityTargetX, this._requiredSkillAction.priorityTargetY];\r\n }\r\n else if (this.hasPrimaryTarget) {\r\n // 攻撃対象が設定されていれば、常に目標座標を更新し続ける\r\n const target = this.primaryTarget;\r\n return [target.mx, target.my];\r\n }\r\n else if (spawner && spawner.moveType == DSpawner_1.DUniqueSpawnerMoveType.Homecoming) {\r\n return [spawner.mx, spawner.my];\r\n }\r\n //else if (prevHasPrimaryTarget != this._actionDeterminer.hasPrimaryTarget()) {\r\n // decide() によってこれまでの PrimaryTarget を見失った\r\n //this._moveDeterminer.setTargetPosition(-1, -1);\r\n // ↑見失った場合、Footpoint などを考慮して選択済みの移動目標を維持したいので、コメントアウトして様子を見る。\r\n //}\r\n return [this._wanderingTargetX, this._wanderingTargetY];\r\n }\r\n get isMinorActionRequired() {\r\n (0, Common_1.assert)(this._requiredSkillAction !== undefined);\r\n return this._requiredSkillAction.isMinor;\r\n }\r\n get isMajorActionRequired() {\r\n (0, Common_1.assert)(this._requiredSkillAction !== undefined);\r\n return this._requiredSkillAction.isMajor;\r\n }\r\n // public think(self: LEntity): SPhaseResult {\r\n // this._thinkingContext.reset();\r\n // self.iterateBehaviorsReverse((behavior) => {\r\n // behavior.onThink(self, this._thinkingContext);\r\n // });\r\n // return SPhaseResult.Handled;\r\n // }\r\n executeMinorActionIfNeeded(cctx, self) {\r\n return this._minorActionExecutor.executeMinorActionIfNeeded(cctx, this, self);\r\n }\r\n // Major で行動消費しても、この関数自体は呼び出されるので注意。\r\n executeMajorActionIfNeeded(cctx, self) {\r\n //if (this._attackTargetEntityId.hasAny()) {\r\n if (this.isMajorActionRequired) {\r\n (0, Common_1.assert)(this._requiredSkillAction);\r\n //// 通常攻撃\r\n {\r\n //const target = REGame.world.entity(this._attackTargetEntityId);\r\n // 発動可否チェック。本当に隣接している?\r\n //let valid = false;\r\n //if (Helpers.checkAdjacent(self, target)) {\r\n // valid = true;\r\n //}\r\n // 対象決定フェーズで予約した対象が、視界を外れたりしていないかを確認する\r\n const targetEntites = this._requiredSkillAction.targets.map(e => MRLively_1.MRLively.world.entity(e));\r\n if (UAction_1.UAction.checkEntityWithinSkillActionRange(self, MRData_1.MRData.skills[this._requiredSkillAction.action.skillId], false, targetEntites)) {\r\n // AI は移動後に PrimaryTarget の方向を向くようになっているため、\r\n // このままスキルを発動しようとすると空振りしてしまう。\r\n // ここで向きを Target の方向に向けておく。\r\n const pos = UMovement_1.UMovement.getCenter(targetEntites);\r\n self.dir = UMovement_1.UMovement.getLookAtDirFromPos(self.mx, self.my, pos.x, pos.y);\r\n SEmittorPerformer_1.SEmittorPerformer.makeWithSkill(self, self, this._requiredSkillAction.action.skillId).perform(cctx);\r\n cctx.postConsumeActionToken(self, LCommon_1.LActionTokenConsumeType.MajorActed);\r\n return SCommand_1.SPhaseResult.Handled;\r\n }\r\n else {\r\n // 別の Unit のアクションでマップ上から対象が消えた、など\r\n cctx.postConsumeActionToken(self, LCommon_1.LActionTokenConsumeType.MajorActed);\r\n return SCommand_1.SPhaseResult.Handled;\r\n }\r\n }\r\n }\r\n else {\r\n }\r\n return SCommand_1.SPhaseResult.Pass;\r\n }\r\n};\r\nLThinkingAgent = LThinkingAgent_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LThinkingAgent);\r\nexports.LThinkingAgent = LThinkingAgent;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/ai2/LThinkingAgent.ts?"); /***/ }), /***/ "./ts/mr/lively/ai2/LThinkingAgent_Standard.ts": /*!*****************************************************!*\ !*** ./ts/mr/lively/ai2/LThinkingAgent_Standard.ts ***! \*****************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LThinkingAgent_Standard = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst LThinkingAgent_1 = __webpack_require__(/*! ./LThinkingAgent */ \"./ts/mr/lively/ai2/LThinkingAgent.ts\");\r\nconst LThinkingDeterminer_Combat_1 = __webpack_require__(/*! ./LThinkingDeterminer_Combat */ \"./ts/mr/lively/ai2/LThinkingDeterminer_Combat.ts\");\r\nconst LThinkingDeterminer_Wandering_1 = __webpack_require__(/*! ./LThinkingDeterminer_Wandering */ \"./ts/mr/lively/ai2/LThinkingDeterminer_Wandering.ts\");\r\nlet LThinkingAgent_Standard = class LThinkingAgent_Standard extends LThinkingAgent_1.LThinkingAgent {\r\n constructor() {\r\n super(0, [\r\n new LThinkingDeterminer_Wandering_1.LThinkingDeterminer_Wandering(),\r\n new LThinkingDeterminer_Combat_1.LThinkingDeterminer_Combat(),\r\n ]);\r\n }\r\n};\r\nLThinkingAgent_Standard = __decorate([\r\n Common_1.MRSerializable\r\n], LThinkingAgent_Standard);\r\nexports.LThinkingAgent_Standard = LThinkingAgent_Standard;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/ai2/LThinkingAgent_Standard.ts?"); /***/ }), /***/ "./ts/mr/lively/ai2/LThinkingDeterminer.ts": /*!*************************************************!*\ !*** ./ts/mr/lively/ai2/LThinkingDeterminer.ts ***! \*************************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LThinkingDeterminer = void 0;\r\nclass LThinkingDeterminer {\r\n}\r\nexports.LThinkingDeterminer = LThinkingDeterminer;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/ai2/LThinkingDeterminer.ts?"); /***/ }), /***/ "./ts/mr/lively/ai2/LThinkingDeterminer_Blind.ts": /*!*******************************************************!*\ !*** ./ts/mr/lively/ai2/LThinkingDeterminer_Blind.ts ***! \*******************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LThinkingDeterminer_Blind_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LThinkingDeterminer_Blind = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst UAction_1 = __webpack_require__(/*! ts/mr/utility/UAction */ \"./ts/mr/utility/UAction.ts\");\r\nconst UMovement_1 = __webpack_require__(/*! ts/mr/utility/UMovement */ \"./ts/mr/utility/UMovement.ts\");\r\nconst LThinkingAction_1 = __webpack_require__(/*! ./LThinkingAction */ \"./ts/mr/lively/ai2/LThinkingAction.ts\");\r\nconst LThinkingAgent_1 = __webpack_require__(/*! ./LThinkingAgent */ \"./ts/mr/lively/ai2/LThinkingAgent.ts\");\r\nconst LThinkingDeterminer_1 = __webpack_require__(/*! ./LThinkingDeterminer */ \"./ts/mr/lively/ai2/LThinkingDeterminer.ts\");\r\nlet LThinkingDeterminer_Blind = LThinkingDeterminer_Blind_1 = class LThinkingDeterminer_Blind extends LThinkingDeterminer_1.LThinkingDeterminer {\r\n /*\r\n [2023/3/17] 優先度と 混乱AI との衝突\r\n ----------\r\n 混乱によるランダム移動は、目つぶしによる移動よりも優先度を高くする。\r\n ただ、このようにステート間が互いの事情に依存する優先度を考慮するのがちょっと気になる実装だが…。\r\n\r\n でも、逆に優先度を考慮しない場合は従来のように、後から追加されたステートが優先されてしまう。\r\n こればかりはある程度優先度のグループをつらざるを得ないのかも。\r\n */\r\n clone() {\r\n return new LThinkingDeterminer_Blind_1();\r\n }\r\n onThink(agent, self) {\r\n const frontDir = self.dir;\r\n // 正面に攻撃できそうな何かがあれば、行動候補として積む。\r\n const block = UMovement_1.UMovement.getAdjacentBlock(self, frontDir);\r\n const targets = UAction_1.UAction.getSkillEffectiveTargets(self, MRData_1.MRData.skills[MRData_1.MRData.system.skills.normalAttack], false).filter(e => e.mx == block.mx && e.my == block.my);\r\n if (targets.length > 0) {\r\n const action = new LThinkingAction_1.LThinkingAction({\r\n rating: LThinkingAgent_1.LThinkingActionRatings.Restriction1,\r\n skillId: MRData_1.MRData.system.skills.normalAttack,\r\n }, [targets[0].entityId()]);\r\n agent.addCandidateAction(action);\r\n }\r\n // 正面に移動できそう?\r\n if (UMovement_1.UMovement.checkPassageToDir(self, frontDir)) {\r\n const action = new LThinkingAction_1.LThinkingAction({\r\n rating: LThinkingAgent_1.LThinkingActionRatings.Restriction1,\r\n skillId: MRData_1.MRData.system.skills.move,\r\n }, []);\r\n action.priorityMovingDirection = frontDir;\r\n agent.addCandidateAction(action);\r\n return SCommand_1.SPhaseResult.Handled;\r\n }\r\n // 正面がダメなら、それ以外へランダムに移動してみる。\r\n const newDir = agent.rand.select(UMovement_1.UMovement.directions.filter(x => x != frontDir));\r\n if (UMovement_1.UMovement.checkPassageToDir(self, frontDir)) {\r\n const action = new LThinkingAction_1.LThinkingAction({\r\n rating: LThinkingAgent_1.LThinkingActionRatings.Restriction1,\r\n skillId: MRData_1.MRData.system.skills.move,\r\n }, []);\r\n action.priorityMovingDirection = newDir;\r\n agent.addCandidateAction(action);\r\n return SCommand_1.SPhaseResult.Handled;\r\n }\r\n // ここまで来てしまったら向きだけ変えて待機。\r\n const action = new LThinkingAction_1.LThinkingAction({\r\n rating: LThinkingAgent_1.LThinkingActionRatings.Restriction1,\r\n skillId: MRData_1.MRData.system.skills.wait,\r\n }, []);\r\n action.priorityMovingDirection = newDir;\r\n agent.addCandidateAction(action);\r\n return SCommand_1.SPhaseResult.Handled;\r\n }\r\n};\r\nLThinkingDeterminer_Blind = LThinkingDeterminer_Blind_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LThinkingDeterminer_Blind);\r\nexports.LThinkingDeterminer_Blind = LThinkingDeterminer_Blind;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/ai2/LThinkingDeterminer_Blind.ts?"); /***/ }), /***/ "./ts/mr/lively/ai2/LThinkingDeterminer_Combat.ts": /*!********************************************************!*\ !*** ./ts/mr/lively/ai2/LThinkingDeterminer_Combat.ts ***! \********************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LThinkingDeterminer_Combat_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LThinkingDeterminer_Combat = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst UAction_1 = __webpack_require__(/*! ts/mr/utility/UAction */ \"./ts/mr/utility/UAction.ts\");\r\nconst LThinkingAction_1 = __webpack_require__(/*! ./LThinkingAction */ \"./ts/mr/lively/ai2/LThinkingAction.ts\");\r\nconst LThinkingDeterminer_1 = __webpack_require__(/*! ./LThinkingDeterminer */ \"./ts/mr/lively/ai2/LThinkingDeterminer.ts\");\r\nlet LThinkingDeterminer_Combat = LThinkingDeterminer_Combat_1 = class LThinkingDeterminer_Combat extends LThinkingDeterminer_1.LThinkingDeterminer {\r\n clone() {\r\n return new LThinkingDeterminer_Combat_1();\r\n }\r\n onThink(agent, self) {\r\n //this._requiredSkillAction = undefined;\r\n const candidates = UAction_1.UAction.makeCandidateSkillActions(self, agent.primaryTargetEntityId);\r\n // const skillAction = cctx.random().selectOrUndefined(candidates);\r\n // if (skillAction) {\r\n // if (skillAction.action.skillId == MRData.system.skills.move) {\r\n // // 移動\r\n // //this._attackTargetEntityId = LEntityId.makeEmpty();\r\n // }\r\n // else {\r\n // this._requiredSkillAction = skillAction;\r\n // //this._attackTargetEntityId = target.entityId();\r\n // }\r\n // }\r\n // else {\r\n // //this._attackTargetEntityId = LEntityId.makeEmpty();\r\n // // 見失ったときも targetPosition は維持\r\n // }\r\n for (const action of candidates) {\r\n agent.addCandidateAction(new LThinkingAction_1.LThinkingAction(action.action, action.targets));\r\n }\r\n return SCommand_1.SPhaseResult.Handled;\r\n }\r\n};\r\nLThinkingDeterminer_Combat = LThinkingDeterminer_Combat_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LThinkingDeterminer_Combat);\r\nexports.LThinkingDeterminer_Combat = LThinkingDeterminer_Combat;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/ai2/LThinkingDeterminer_Combat.ts?"); /***/ }), /***/ "./ts/mr/lively/ai2/LThinkingDeterminer_Confusion.ts": /*!***********************************************************!*\ !*** ./ts/mr/lively/ai2/LThinkingDeterminer_Confusion.ts ***! \***********************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LThinkingDeterminer_Confusion_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LThinkingDeterminer_Confusion = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst Helpers_1 = __webpack_require__(/*! ts/mr/system/Helpers */ \"./ts/mr/system/Helpers.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst UAction_1 = __webpack_require__(/*! ts/mr/utility/UAction */ \"./ts/mr/utility/UAction.ts\");\r\nconst UMovement_1 = __webpack_require__(/*! ts/mr/utility/UMovement */ \"./ts/mr/utility/UMovement.ts\");\r\nconst LConfusionAI_1 = __webpack_require__(/*! ../ai/LConfusionAI */ \"./ts/mr/lively/ai/LConfusionAI.ts\");\r\nconst LThinkingAction_1 = __webpack_require__(/*! ./LThinkingAction */ \"./ts/mr/lively/ai2/LThinkingAction.ts\");\r\nconst LThinkingAgent_1 = __webpack_require__(/*! ./LThinkingAgent */ \"./ts/mr/lively/ai2/LThinkingAgent.ts\");\r\nconst LThinkingDeterminer_1 = __webpack_require__(/*! ./LThinkingDeterminer */ \"./ts/mr/lively/ai2/LThinkingDeterminer.ts\");\r\nlet LThinkingDeterminer_Confusion = LThinkingDeterminer_Confusion_1 = class LThinkingDeterminer_Confusion extends LThinkingDeterminer_1.LThinkingDeterminer {\r\n constructor(restriction) {\r\n super();\r\n this._restriction = restriction;\r\n }\r\n clone() {\r\n return new LThinkingDeterminer_Confusion_1(this._restriction);\r\n }\r\n onThink(agent, self) {\r\n // 方向決定\r\n const dir = agent.rand.select(UMovement_1.UMovement.directions);\r\n // 通常攻撃できるか試してみる。\r\n // 実際の攻撃は Major フェーズで行いたいので、ここでは行動は消費しない。\r\n // 攻撃候補を覚えておく。\r\n if (this._restriction != LConfusionAI_1.LConfusionAIRestriction.None) {\r\n const block = UMovement_1.UMovement.getAdjacentBlock(self, dir);\r\n let targets = UAction_1.UAction.getSkillEffectiveTargets(self, MRData_1.MRData.skills[MRData_1.MRData.system.skills.normalAttack], false).filter(e => e.mx == block.mx && e.my == block.my);\r\n if (this._restriction == LConfusionAI_1.LConfusionAIRestriction.AttcakToFriend) {\r\n targets = targets.filter(x => Helpers_1.Helpers.isFriend(self, x));\r\n }\r\n else if (this._restriction == LConfusionAI_1.LConfusionAIRestriction.AttcakToOpponent) {\r\n targets = targets.filter(x => Helpers_1.Helpers.isHostile(self, x));\r\n }\r\n if (targets.length > 0) {\r\n const action = new LThinkingAction_1.LThinkingAction({\r\n rating: LThinkingAgent_1.LThinkingActionRatings.Normal,\r\n skillId: MRData_1.MRData.system.skills.normalAttack,\r\n }, [targets[0].entityId()]);\r\n agent.addCandidateAction(action);\r\n return SCommand_1.SPhaseResult.Pass;\r\n }\r\n }\r\n // 移動してみる。移動出来たら行動を消費する。\r\n if (UMovement_1.UMovement.checkPassageToDir(self, dir)) {\r\n const action = new LThinkingAction_1.LThinkingAction({\r\n rating: LThinkingAgent_1.LThinkingActionRatings.Moving,\r\n skillId: MRData_1.MRData.system.skills.move,\r\n }, []);\r\n action.priorityMovingDirection = dir;\r\n agent.addCandidateAction(action);\r\n return SCommand_1.SPhaseResult.Pass;\r\n }\r\n return SCommand_1.SPhaseResult.Pass;\r\n }\r\n};\r\nLThinkingDeterminer_Confusion = LThinkingDeterminer_Confusion_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LThinkingDeterminer_Confusion);\r\nexports.LThinkingDeterminer_Confusion = LThinkingDeterminer_Confusion;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/ai2/LThinkingDeterminer_Confusion.ts?"); /***/ }), /***/ "./ts/mr/lively/ai2/LThinkingDeterminer_Escape.ts": /*!********************************************************!*\ !*** ./ts/mr/lively/ai2/LThinkingDeterminer_Escape.ts ***! \********************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LThinkingDeterminer_Escape_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LThinkingDeterminer_Escape = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LThinkingAction_1 = __webpack_require__(/*! ./LThinkingAction */ \"./ts/mr/lively/ai2/LThinkingAction.ts\");\r\nconst LThinkingAgent_1 = __webpack_require__(/*! ./LThinkingAgent */ \"./ts/mr/lively/ai2/LThinkingAgent.ts\");\r\nconst LThinkingDeterminer_1 = __webpack_require__(/*! ./LThinkingDeterminer */ \"./ts/mr/lively/ai2/LThinkingDeterminer.ts\");\r\nconst LThinkingHelper_1 = __webpack_require__(/*! ./LThinkingHelper */ \"./ts/mr/lively/ai2/LThinkingHelper.ts\");\r\nlet LThinkingDeterminer_Escape = LThinkingDeterminer_Escape_1 = class LThinkingDeterminer_Escape extends LThinkingDeterminer_1.LThinkingDeterminer {\r\n /*\r\n 逃げの実装に独自の Action を使うべきか?\r\n ----------\r\n 旧 AI では thinkMove で、Action を挟むことなく即移動処理を行っていた。\r\n\r\n\r\n ### 逃げが関係する者として留意が居るのは…?\r\n - 最優先で逃げる敵\r\n - 逃げるが、隣接したら攻撃してくる敵(からかいAI)\r\n - 一定距離を保つ敵 (これは Escape ではないかも?)\r\n あと、拡張機能として「ホームポジションに戻ろうとする」というのもある。\r\n やはり普段は「徘徊」あるいは「ホームポジション」に従うが、敵対を見つけた時に「逃げ」という特殊な選択をするものと考えるべきだろう。\r\n\r\n ### LThinkingAgent に TargetPosition を持たせるとしたら…\r\n - 同様に、他に TargetPosition を設定したい AI (競合する可能性) は無いか?\r\n\r\n ### Action に TargetPosition を持たせるとしたら…\r\n - 優先度は確定的ではないので注意。\r\n 上記の、とにかく逃げるAIと、からかいAIでは MoveAction の優先度が異なる。\r\n\r\n そうすると、今の徘徊の処理みたいに、Actionの決定と 実際の経路探索処理は別に分けたほうが良いのかもしれない?\r\n 拡張AIを作るとき、いちいち EscapeAI とかを継承して実装するのはなんか面倒。\r\n 考えられる拡張AIとしては「視界内に特定のEntityがあったら逃げる」とかだが、それなら「逃げる」だけ push しておくようにしたいところ。\r\n\r\n ### 「逃げ」Action を作るべきか?\r\n - 作らない場合は LThinkingAction にフラグを追加することになる。移動専用の情報が増えるのもちょっと気になるが…。\r\n - 作る場合は… 「逃げ」でも敵対が視界内にいないときは「徘徊」と同じ動きになるので、「移動」とかぶる。\r\n …まぁ、↑のよりはマシかも?\r\n \r\n ただ移動が絡むものとして、ポリゴン系の瞬間移動があるし(これも敵対がいなければ徘徊になる)、拡張ではバックステップのようなものも考えられるかもしれない。\r\n この場合、「逃げ」や「瞬間移動」にはオプション Target に Entity を入れておくといいかも。\r\n で、実際の行動時に Target がいなかったりすれば、「移動」にフォールバックする。\r\n\r\n ### ターゲット消失時と移動先\r\n 逃走中は目指している部屋の出口があるはず。\r\n そこでターゲットが消失した場合、escape として持っている出口へ向かうのか、wandering として持っている出口で向かうのか?\r\n ターゲット消失時にいきなり移動先が変わって見えるのはちょっと気持ち悪いかもしれない。\r\n\r\n ### 優先度の問題もある\r\n Move と Escape の優先度をどうしようか?Escape は↑のとおり、通常・最優先の2通りほしい。\r\n\r\n ### Move に集約する?\r\n escape や瞬間移動は enum で示すとか?\r\n\r\n でも、escape はともかく、瞬間移動を標準の移動メソッドにするのはかなり微妙。バックステップはなおさら。\r\n 仮に集約しても、優先度の異なる Escape の処理にはどのみに優先度というパラメータが必要になる。\r\n \r\n\r\n\r\n */\r\n clone() {\r\n return new LThinkingDeterminer_Escape_1();\r\n }\r\n onThink(agent, self) {\r\n const result = LThinkingHelper_1.LThinkingHelper.decideTargetPosition(agent, self, MRLively_1.MRLively.mapView.currentMap);\r\n if (result) {\r\n // agent._wanderingTargetX = result.mx;\r\n // agent._wanderingTargetY = result.my;\r\n if (result.mx === undefined) {\r\n const action = new LThinkingAction_1.LThinkingAction({\r\n rating: LThinkingAgent_1.LThinkingActionRatings.Wait,\r\n skillId: MRData_1.MRData.system.skills.wait,\r\n }, []);\r\n action.forceMovedDirection = result.dir;\r\n agent.addCandidateAction(action);\r\n }\r\n else {\r\n const action = new LThinkingAction_1.LThinkingAction({\r\n rating: LThinkingAgent_1.LThinkingActionRatings.Escape,\r\n skillId: MRData_1.MRData.system.skills.escape,\r\n }, []);\r\n action.priorityTargetX = result.mx;\r\n action.priorityTargetY = result.my;\r\n action.forceMovedDirection = result.dir;\r\n agent.addCandidateAction(action);\r\n }\r\n }\r\n // this.decideTargetPosition(agent, self, MRLively.mapView.currentMap);\r\n return SCommand_1.SPhaseResult.Handled;\r\n }\r\n};\r\nLThinkingDeterminer_Escape = LThinkingDeterminer_Escape_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LThinkingDeterminer_Escape);\r\nexports.LThinkingDeterminer_Escape = LThinkingDeterminer_Escape;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/ai2/LThinkingDeterminer_Escape.ts?"); /***/ }), /***/ "./ts/mr/lively/ai2/LThinkingDeterminer_RatedRandom.ts": /*!*************************************************************!*\ !*** ./ts/mr/lively/ai2/LThinkingDeterminer_RatedRandom.ts ***! \*************************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LThinkingDeterminer_RatedRandom_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LThinkingDeterminer_RatedRandom = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst UMovement_1 = __webpack_require__(/*! ts/mr/utility/UMovement */ \"./ts/mr/utility/UMovement.ts\");\r\nconst LThinkingAction_1 = __webpack_require__(/*! ./LThinkingAction */ \"./ts/mr/lively/ai2/LThinkingAction.ts\");\r\nconst LThinkingAgent_1 = __webpack_require__(/*! ./LThinkingAgent */ \"./ts/mr/lively/ai2/LThinkingAgent.ts\");\r\nconst LThinkingDeterminer_1 = __webpack_require__(/*! ./LThinkingDeterminer */ \"./ts/mr/lively/ai2/LThinkingDeterminer.ts\");\r\nlet LThinkingDeterminer_RatedRandom = LThinkingDeterminer_RatedRandom_1 = class LThinkingDeterminer_RatedRandom extends LThinkingDeterminer_1.LThinkingDeterminer {\r\n constructor() {\r\n super();\r\n this._randomRate = 50;\r\n }\r\n clone() {\r\n const i = new LThinkingDeterminer_RatedRandom_1();\r\n i._randomRate = this._randomRate;\r\n return i;\r\n }\r\n onThink(agent, self) {\r\n const rundomTurn = (agent.rand.nextIntWithMax(100) < this._randomRate);\r\n if (rundomTurn) {\r\n // 移動してみる。攻撃はしない。\r\n const dir = agent.rand.select(UMovement_1.UMovement.directions);\r\n if (UMovement_1.UMovement.checkPassageToDir(self, dir)) {\r\n const action = new LThinkingAction_1.LThinkingAction({\r\n rating: LThinkingAgent_1.LThinkingActionRatings.Moving,\r\n skillId: MRData_1.MRData.system.skills.move,\r\n }, []);\r\n action.priorityMovingDirection = dir;\r\n agent.addCandidateAction(action);\r\n return SCommand_1.SPhaseResult.Pass;\r\n }\r\n }\r\n else {\r\n // 普通に行動したいので、この Determiner としては何もしない。\r\n }\r\n return SCommand_1.SPhaseResult.Pass;\r\n }\r\n};\r\nLThinkingDeterminer_RatedRandom = LThinkingDeterminer_RatedRandom_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LThinkingDeterminer_RatedRandom);\r\nexports.LThinkingDeterminer_RatedRandom = LThinkingDeterminer_RatedRandom;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/ai2/LThinkingDeterminer_RatedRandom.ts?"); /***/ }), /***/ "./ts/mr/lively/ai2/LThinkingDeterminer_Wandering.ts": /*!***********************************************************!*\ !*** ./ts/mr/lively/ai2/LThinkingDeterminer_Wandering.ts ***! \***********************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LThinkingDeterminer_Wandering_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LThinkingDeterminer_Wandering = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst UMovement_1 = __webpack_require__(/*! ts/mr/utility/UMovement */ \"./ts/mr/utility/UMovement.ts\");\r\nconst LMoveDeterminer_1 = __webpack_require__(/*! ../ai/LMoveDeterminer */ \"./ts/mr/lively/ai/LMoveDeterminer.ts\");\r\nconst LBlockHelper_1 = __webpack_require__(/*! ../helpers/LBlockHelper */ \"./ts/mr/lively/helpers/LBlockHelper.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LThinkingAction_1 = __webpack_require__(/*! ./LThinkingAction */ \"./ts/mr/lively/ai2/LThinkingAction.ts\");\r\nconst LThinkingAgent_1 = __webpack_require__(/*! ./LThinkingAgent */ \"./ts/mr/lively/ai2/LThinkingAgent.ts\");\r\nconst LThinkingDeterminer_1 = __webpack_require__(/*! ./LThinkingDeterminer */ \"./ts/mr/lively/ai2/LThinkingDeterminer.ts\");\r\nlet LThinkingDeterminer_Wandering = LThinkingDeterminer_Wandering_1 = class LThinkingDeterminer_Wandering extends LThinkingDeterminer_1.LThinkingDeterminer {\r\n clone() {\r\n return new LThinkingDeterminer_Wandering_1();\r\n }\r\n onThink(agent, self) {\r\n agent.addCandidateAction(new LThinkingAction_1.LThinkingAction({\r\n conditionParam1: undefined,\r\n conditionParam2: undefined,\r\n conditionType: undefined,\r\n rating: LThinkingAgent_1.LThinkingActionRatings.Moving,\r\n skillId: MRData_1.MRData.system.skills.move,\r\n }, []));\r\n this.thinkMoving(agent, self);\r\n return SCommand_1.SPhaseResult.Handled;\r\n }\r\n thinkMoving(agent, self) {\r\n const rand = agent.rand;\r\n const map = MRLively_1.MRLively.mapView.currentMap;\r\n const block = map.block(self.mx, self.my);\r\n if (!agent.hasWanderingDestination()) {\r\n if (!block.isRoom()) {\r\n // 目的地なし, 現在位置が通路・迷路\r\n // => 左折の法則による移動\r\n agent._decired = { method: LMoveDeterminer_1.LMovingMethod.LHRule };\r\n return;\r\n }\r\n else {\r\n const room = MRLively_1.MRLively.mapView.currentMap.room(block._roomId);\r\n if (!block.isRoomInnerEntrance()) {\r\n // 目的地なし, 現在位置が部屋\r\n // => ランダムな入口を目的地に設定し、目的地に向かう移動。\r\n // => 入口が無ければ左折の法則による移動\r\n const block = this.findTargetRoomInnerEntranceBlock(self, rand, room);\r\n if (block) {\r\n agent._wanderingTargetX = block.mx;\r\n agent._wanderingTargetY = block.my;\r\n agent._decired = { method: LMoveDeterminer_1.LMovingMethod.ToTarget };\r\n return;\r\n }\r\n else {\r\n // 入り口のない部屋。左折の法則による移動を継続する。\r\n agent._decired = { method: LMoveDeterminer_1.LMovingMethod.LHRule };\r\n return;\r\n }\r\n }\r\n else {\r\n // 目的地なし, 現在位置が部屋の入口\r\n // => 現在位置以外のランダムな入口を目的地に設定し、左折の法則による移動\r\n // => 他に入口がなければ逆方向を向き、左折の法則による移動\r\n const block = this.findTargetRoomInnerEntranceBlock(self, rand, room);\r\n if (block) {\r\n agent._wanderingTargetX = block.mx;\r\n agent._wanderingTargetY = block.my;\r\n }\r\n else {\r\n self.dir = UMovement_1.UMovement.reverseDir(self.dir);\r\n }\r\n agent._decired = { method: LMoveDeterminer_1.LMovingMethod.LHRule };\r\n return;\r\n }\r\n }\r\n }\r\n else if (!this.canModeToTarget(agent, self)) {\r\n // 目的地あり 目的地が現在位置\r\n // => 目的地を解除し、左折の法則による移動\r\n agent.clearTargetPosition();\r\n // これは SFC シレン Wiki には乗っていない細工。\r\n // 部屋内から目的地にたどり着いたとき、現在の向きと通路の方向が直角だと、左折の法則で通路に侵入できなくなる。\r\n // 対策として、このときは隣接している通路ブロックへの移動を優先する。\r\n const blocks = UMovement_1.UMovement.getMovableAdjacentTiles(self).filter(b => b.isPassageway());\r\n if (blocks.length > 0) {\r\n agent._decired = { method: LMoveDeterminer_1.LMovingMethod.ToTarget, passageway: blocks[rand.nextIntWithMax(blocks.length)] };\r\n return;\r\n }\r\n else {\r\n agent._decired = { method: LMoveDeterminer_1.LMovingMethod.LHRule };\r\n return;\r\n }\r\n }\r\n else {\r\n // 目的地あり 目的地が現在位置でない\r\n // => 目的地に向かう移動 (moveToTarget() で移動)\r\n agent._decired = { method: LMoveDeterminer_1.LMovingMethod.ToTarget };\r\n return;\r\n }\r\n }\r\n canModeToTarget(agent, self) {\r\n return agent.hasWanderingDestination() && (self.mx != agent._wanderingTargetX || self.my != agent._wanderingTargetY);\r\n }\r\n findTargetRoomInnerEntranceBlock(self, rand, room) {\r\n const candidates1 = room.getRoomInnerEntranceBlocks().filter(b => b.mx != self.mx || b.my != self.my); // 足元フィルタ\r\n if (candidates1.length <= 0)\r\n return undefined;\r\n const candidates2 = [];\r\n for (const block of candidates1) {\r\n if (LBlockHelper_1.LBlockHelper.hasHostileFootpoint(block, self.getInnermostFactionId())) {\r\n candidates2.push(block);\r\n }\r\n }\r\n if (candidates2.length > 0) {\r\n return LBlockHelper_1.LBlockHelper.selectNearestBlock(candidates2, self);\r\n }\r\n else {\r\n const block = candidates1[rand.nextIntWithMax(candidates1.length)];\r\n return block;\r\n }\r\n }\r\n};\r\nLThinkingDeterminer_Wandering = LThinkingDeterminer_Wandering_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LThinkingDeterminer_Wandering);\r\nexports.LThinkingDeterminer_Wandering = LThinkingDeterminer_Wandering;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/ai2/LThinkingDeterminer_Wandering.ts?"); /***/ }), /***/ "./ts/mr/lively/ai2/LThinkingHelper.ts": /*!*********************************************!*\ !*** ./ts/mr/lively/ai2/LThinkingHelper.ts ***! \*********************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LThinkingHelper = void 0;\r\nconst SAIHelper_1 = __webpack_require__(/*! ts/mr/system/SAIHelper */ \"./ts/mr/system/SAIHelper.ts\");\r\nconst UAction_1 = __webpack_require__(/*! ts/mr/utility/UAction */ \"./ts/mr/utility/UAction.ts\");\r\nconst UBlock_1 = __webpack_require__(/*! ts/mr/utility/UBlock */ \"./ts/mr/utility/UBlock.ts\");\r\nconst UMovement_1 = __webpack_require__(/*! ts/mr/utility/UMovement */ \"./ts/mr/utility/UMovement.ts\");\r\nconst HMovement_1 = __webpack_require__(/*! ../helpers/HMovement */ \"./ts/mr/lively/helpers/HMovement.ts\");\r\nconst LMap_1 = __webpack_require__(/*! ../LMap */ \"./ts/mr/lively/LMap.ts\");\r\n;\r\nclass LThinkingHelper {\r\n static decideTargetPosition(agent, self, map) {\r\n const target = UAction_1.UAction.findInSightNearlyHostileEntity(self);\r\n if (target) {\r\n // 逃げたい Unit が視界内にいる。(部屋内・通路内は問わない)\r\n const block = map.block(self.mx, self.my);\r\n const room = map.room(block._roomId);\r\n // 自分が部屋内の入り口に立っていて、隣接する通路は逃げても大丈夫そうなら、通路へ逃げ込む\r\n if (block.isRoomInnerEntrance()) {\r\n const roomOuterEntrance = UBlock_1.UBlock.adjacentBlocks4(map, block.mx, block.my).find(x => x.isPassageway());\r\n if (roomOuterEntrance && !this.checkDeadInArea(self, target, roomOuterEntrance.mx, roomOuterEntrance.my)) {\r\n return { mx: roomOuterEntrance.mx, my: roomOuterEntrance.my };\r\n }\r\n }\r\n // \r\n const safetyInnerRoomEntrance = room.getRoomInnerEntranceBlocks()\r\n .filter(b => !this.checkDeadInArea(self, target, b.mx, b.my) && // block は敵対の向こう側にあるのでそっちは除外\r\n (b.mx != self.mx || b.my != self.my)) // 足元は除外\r\n .selectMin((a, b) => UMovement_1.UMovement.distanceSq(a.mx, a.my, b.mx, b.my));\r\n if (safetyInnerRoomEntrance) {\r\n // 相手に対して、背面等に通路がある。そこを目指す。\r\n //this._movingHelper.setTargetPosition(doorway.x(), doorway.y());\r\n return { mx: safetyInnerRoomEntrance.mx, my: safetyInnerRoomEntrance.my };\r\n }\r\n else {\r\n // 相手が通路側に立ちふさがっている場合など\r\n const rdir = SAIHelper_1.SAIHelper.entityDistanceToDir(target, self);\r\n const dir = SAIHelper_1.SAIHelper.entityDistanceToDir(self, target);\r\n // まず背面にまったく移動できないかチェック\r\n const blocks = UMovement_1.UMovement.getWay3FrontBlocks(self, rdir);\r\n if (!blocks.find(b => HMovement_1.HMovement.checkPassageBlockToBlock(self, block, b, LMap_1.MovingMethod.Walk))) {\r\n if (!UMovement_1.UMovement.checkAdjacentPositions(self.mx, self.my, target.mx, target.my)) {\r\n // 隣接していなければ相手を向いて待機。\r\n // 消費 Token を Major にしてしまうと、倍速1回行動の時に上手く動かないので Minor で消費する。\r\n // cctx.postActivity(\r\n // LActivity.make(self)\r\n // .withEntityDirection(dir)\r\n // .withConsumeAction(LActionTokenConsumeType.MinorActed));\r\n // return true;\r\n return { dir: dir };\r\n }\r\n else {\r\n // 観念して通常の移動を行う\r\n const doorway = agent.rand.selectOrUndefined(room.getRoomInnerEntranceBlocks());\r\n if (doorway) {\r\n // 出口を目的地設定して移動\r\n return { mx: doorway.mx, my: doorway.my };\r\n }\r\n else {\r\n // 出口の無い部屋。通常の移動プロセスにしたがう\r\n }\r\n }\r\n }\r\n else {\r\n // 後ろに逃げるスペースがあるなら、左折の法則で逆方向に逃げる\r\n const block2 = UMovement_1.UMovement.getMovingCandidateBlockAsLHRule(self, rdir);\r\n if (block2) {\r\n return { mx: block2.mx, my: block2.my };\r\n }\r\n else {\r\n throw new Error(\"Unreachable\");\r\n }\r\n // if (block2) {\r\n // cctx.postActivity(\r\n // LActivity.makeMoveToAdjacentBlock(self, block2)\r\n // .withEntityDirection(rdir)\r\n // .withConsumeAction(LActionTokenConsumeType.MinorActed));\r\n // return true;\r\n // }\r\n // else {\r\n // throw new Error(\"Unreachable\");\r\n // }\r\n }\r\n /*\r\n const dir = SAIHelper.entityDistanceToDir(target, self);\r\n if (UMovement.checkPassageToDir(self, dir)) {\r\n cctx.postActivity(\r\n LActivity.makeMoveToAdjacent(self, dir)\r\n .withEntityDirection(dir)\r\n .withConsumeAction());\r\n return SPhaseResult.Handled;\r\n }\r\n */\r\n }\r\n }\r\n return undefined;\r\n }\r\n // (mx, my) は subject から見て、hostileEntity の背面(向こう側)にあるかを判断する。\r\n // そっちの方向には行きたくない判断に使う。\r\n static checkDeadInArea(subject, hostileEntity, mx, my) {\r\n const sx = subject.mx;\r\n const sy = subject.my;\r\n const ex = hostileEntity.mx;\r\n const ey = hostileEntity.my;\r\n const dx = Math.abs(sx - ex);\r\n const dy = Math.abs(sy - ey);\r\n const checkH = () => {\r\n if (sx < ex) { // 自分が敵の左側\r\n if (ex <= mx) { // 相手の立っている位置とその右側はすべて Dead\r\n return true;\r\n }\r\n }\r\n else if (ex < sx) { // 自分が敵の右側\r\n if (mx <= ex) { // 相手の立っている位置とその左側はすべて Dead\r\n return true;\r\n }\r\n }\r\n else {\r\n // 同一座標はセーフ\r\n }\r\n };\r\n const checkV = () => {\r\n if (sy < ey) { // 自分が敵の上側\r\n if (ey <= my) { // 相手の立っている位置とその下側はすべて Dead\r\n return true;\r\n }\r\n }\r\n else if (ey < sy) { // 自分が敵の下側\r\n if (my <= ey) { // 相手の立っている位置とその上側はすべて Dead\r\n return true;\r\n }\r\n }\r\n else {\r\n // 同一座標はセーフ\r\n }\r\n };\r\n if (UMovement_1.UMovement.distanceSq(sx, sy, mx, my) <= UMovement_1.UMovement.distanceSq(ex, ey, mx, my)) {\r\n return false;\r\n }\r\n if (dx > dy) {\r\n if (checkH())\r\n return true;\r\n }\r\n else if (dx < dy) {\r\n if (checkV())\r\n return true;\r\n }\r\n else {\r\n if (checkH())\r\n return true;\r\n if (checkV())\r\n return true;\r\n }\r\n return false;\r\n }\r\n}\r\nexports.LThinkingHelper = LThinkingHelper;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/ai2/LThinkingHelper.ts?"); /***/ }), /***/ "./ts/mr/lively/ai/LActionDeterminer.ts": /*!**********************************************!*\ !*** ./ts/mr/lively/ai/LActionDeterminer.ts ***! \**********************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LActionDeterminer_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LActionDeterminer = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst SAIHelper_1 = __webpack_require__(/*! ts/mr/system/SAIHelper */ \"./ts/mr/system/SAIHelper.ts\");\r\nconst SEmittorPerformer_1 = __webpack_require__(/*! ts/mr/system/SEmittorPerformer */ \"./ts/mr/system/SEmittorPerformer.ts\");\r\nconst UAction_1 = __webpack_require__(/*! ts/mr/utility/UAction */ \"./ts/mr/utility/UAction.ts\");\r\nconst UMovement_1 = __webpack_require__(/*! ts/mr/utility/UMovement */ \"./ts/mr/utility/UMovement.ts\");\r\nconst LCommon_1 = __webpack_require__(/*! ../LCommon */ \"./ts/mr/lively/LCommon.ts\");\r\nconst LObject_1 = __webpack_require__(/*! ../LObject */ \"./ts/mr/lively/LObject.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nlet LActionDeterminer = LActionDeterminer_1 = class LActionDeterminer {\r\n constructor() {\r\n // 最初のフェーズで決定する、メインの行動対象 Entity.\r\n // 基本的に敵対 Entity であり、移動処理のために使用する。\r\n // 通常の AI はここに向かって移動する。\r\n // 逃げ AI はここから離れるように移動する。\r\n this._primaryTargetEntityId = LObject_1.LEntityId.makeEmpty();\r\n }\r\n clone() {\r\n var _a;\r\n const i = new LActionDeterminer_1();\r\n i._primaryTargetEntityId = this._primaryTargetEntityId.clone();\r\n if (this._requiredSkillAction) {\r\n i._requiredSkillAction = {\r\n action: this._requiredSkillAction.action,\r\n targets: (_a = this._requiredSkillAction) === null || _a === void 0 ? void 0 : _a.targets\r\n };\r\n }\r\n return i;\r\n }\r\n setPrimaryTargetEntityId(entityId) {\r\n this._primaryTargetEntityId = entityId;\r\n }\r\n setRequiredSkillAction(action) {\r\n this._requiredSkillAction = action;\r\n }\r\n decide(cctx, self) {\r\n // http://twist.jpn.org/sfcsiren/index.php?%E3%82%BF%E3%83%BC%E3%83%B3%E3%81%AE%E9%A0%86%E7%95%AA\r\n // の移動目標位置決定はもう少し後の Phase なのだが、敵対 Entity への移動目標位置決定はこの Phase で行う。\r\n // こうしておかないと、Player の移動を追うように Enemy が移動できなくなる。\r\n {\r\n // 視界内にいる敵対 Entity のうち、一番近い Entity を検索\r\n const target = UAction_1.UAction.findInSightNearlyHostileEntity(self);\r\n if (target) {\r\n this._primaryTargetEntityId = target.entityId().clone();\r\n // TODO: 仮\r\n const dir = SAIHelper_1.SAIHelper.entityDistanceToDir(self, target);\r\n self.dir = dir;\r\n }\r\n else {\r\n //console.log(\"NotImplemented.\");\r\n //this._targetPositionX = -1;\r\n //this._targetPositionY = -1;\r\n this._primaryTargetEntityId = LObject_1.LEntityId.makeEmpty();\r\n }\r\n /*\r\n if (target) {\r\n const targetBlock = REGame.map.block(target.x, target.y);\r\n // target は最も近い Entity となっているので、これと隣接しているか確認し、攻撃対象とする\r\n // TODO: このあたり、遠距離攻撃モンスターとかは変わる\r\n if (LCharacterAI.checkAdjacentDirectlyAttack(self, target) &&\r\n targetBlock &&!targetBlock.checkPurifier(self)) { // 聖域の巻物とか無ければ隣接攻撃可能。\r\n this._attackTargetEntityId = target.entityId();\r\n }\r\n else {\r\n this._attackTargetEntityId = LEntityId.makeEmpty();\r\n \r\n // 見失ったときも targetPosition は維持\r\n }\r\n }\r\n */\r\n }\r\n this._requiredSkillAction = undefined;\r\n const candidates = UAction_1.UAction.makeCandidateSkillActions(self, this._primaryTargetEntityId);\r\n const skillAction = cctx.random().selectOrUndefined(candidates);\r\n if (skillAction) {\r\n if (skillAction.action.skillId == MRData_1.MRData.system.skills.move) {\r\n // 移動\r\n //this._attackTargetEntityId = LEntityId.makeEmpty();\r\n }\r\n else {\r\n this._requiredSkillAction = skillAction;\r\n //this._attackTargetEntityId = target.entityId();\r\n }\r\n }\r\n else {\r\n //this._attackTargetEntityId = LEntityId.makeEmpty();\r\n // 見失ったときも targetPosition は維持\r\n }\r\n }\r\n isMoveRequested() {\r\n return !this._requiredSkillAction;\r\n }\r\n isMajorActionRequested() {\r\n return !!this._requiredSkillAction;\r\n }\r\n hasPrimaryTarget() {\r\n return this._primaryTargetEntityId.hasAny();\r\n }\r\n primaryTarget() {\r\n return MRLively_1.MRLively.world.entity(this._primaryTargetEntityId);\r\n }\r\n perform(cctx, self) {\r\n //if (this._attackTargetEntityId.hasAny()) {\r\n if (this._requiredSkillAction) {\r\n //// 通常攻撃\r\n {\r\n //const target = REGame.world.entity(this._attackTargetEntityId);\r\n // 発動可否チェック。本当に隣接している?\r\n //let valid = false;\r\n //if (Helpers.checkAdjacent(self, target)) {\r\n // valid = true;\r\n //}\r\n // 対象決定フェーズで予約した対象が、視界を外れたりしていないかを確認する\r\n const targetEntites = this._requiredSkillAction.targets.map(e => MRLively_1.MRLively.world.entity(e));\r\n if (UAction_1.UAction.checkEntityWithinSkillActionRange(self, MRData_1.MRData.skills[this._requiredSkillAction.action.skillId], false, targetEntites)) {\r\n // AI は移動後に PrimaryTarget の方向を向くようになっているため、\r\n // このままスキルを発動しようとすると空振りしてしまう。\r\n // ここで向きを Target の方向に向けておく。\r\n const pos = UMovement_1.UMovement.getCenter(targetEntites);\r\n self.dir = UMovement_1.UMovement.getLookAtDirFromPos(self.mx, self.my, pos.x, pos.y);\r\n SEmittorPerformer_1.SEmittorPerformer.makeWithSkill(self, self, this._requiredSkillAction.action.skillId).perform(cctx);\r\n cctx.postConsumeActionToken(self, LCommon_1.LActionTokenConsumeType.MajorActed);\r\n return true;\r\n }\r\n else {\r\n // 別の Unit のアクションでマップ上から対象が消えた、など\r\n cctx.postConsumeActionToken(self, LCommon_1.LActionTokenConsumeType.MajorActed);\r\n return true;\r\n }\r\n }\r\n }\r\n else {\r\n }\r\n return false;\r\n }\r\n};\r\nLActionDeterminer = LActionDeterminer_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LActionDeterminer);\r\nexports.LActionDeterminer = LActionDeterminer;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/ai/LActionDeterminer.ts?"); /***/ }), /***/ "./ts/mr/lively/ai/LBlindAI.ts": /*!*************************************!*\ !*** ./ts/mr/lively/ai/LBlindAI.ts ***! \*************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LBlindAI_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LBlindAI = void 0;\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst UAction_1 = __webpack_require__(/*! ts/mr/utility/UAction */ \"./ts/mr/utility/UAction.ts\");\r\nconst UMovement_1 = __webpack_require__(/*! ts/mr/utility/UMovement */ \"./ts/mr/utility/UMovement.ts\");\r\nconst LActivity_1 = __webpack_require__(/*! ../activities/LActivity */ \"./ts/mr/lively/activities/LActivity.ts\");\r\nconst LCharacterAI_1 = __webpack_require__(/*! ./LCharacterAI */ \"./ts/mr/lively/ai/LCharacterAI.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst LCommon_1 = __webpack_require__(/*! ../LCommon */ \"./ts/mr/lively/LCommon.ts\");\r\n;\r\nlet LBlindAI = LBlindAI_1 = class LBlindAI extends LCharacterAI_1.LCharacterAI {\r\n constructor() {\r\n super();\r\n this._candidateSkillActions = [];\r\n }\r\n clone() {\r\n const i = new LBlindAI_1();\r\n return i;\r\n }\r\n thinkMoving(cctx, self) {\r\n // 移動してみる。移動出来たら行動を消費する。\r\n const frontDir = self.dir;\r\n if (UMovement_1.UMovement.checkPassageToDir(self, frontDir)) {\r\n cctx.postActivity(LActivity_1.LActivity.makeMoveToAdjacent(self, frontDir)\r\n .withConsumeAction(LCommon_1.LActionTokenConsumeType.MinorActed));\r\n return SCommand_1.SPhaseResult.Handled;\r\n }\r\n // 通常攻撃できるか試してみる。\r\n // 実際の攻撃は Major フェーズで行いたいので、ここでは行動は消費しない。\r\n // 攻撃候補を覚えておく。\r\n const block = UMovement_1.UMovement.getAdjacentBlock(self, frontDir);\r\n const targets = UAction_1.UAction.getSkillEffectiveTargets(self, MRData_1.MRData.skills[MRData_1.MRData.system.skills.normalAttack], false).filter(e => e.mx == block.mx && e.my == block.my);\r\n if (targets.length > 0) {\r\n this._candidateSkillActions.push({ skillId: MRData_1.MRData.system.skills.normalAttack, target: targets[0].entityId() });\r\n return SCommand_1.SPhaseResult.Handled;\r\n }\r\n // 向いている方向以外へランダムにしてみる\r\n const newDir = cctx.random().select(UMovement_1.UMovement.directions.filter(x => x != frontDir));\r\n //const rightDir = UMovement.rotateDir(6, self.dir);\r\n if (UMovement_1.UMovement.checkPassageToDir(self, newDir)) {\r\n cctx.postActivity(LActivity_1.LActivity.makeMoveToAdjacent(self, newDir)\r\n .withEntityDirection(newDir)\r\n .withConsumeAction(LCommon_1.LActionTokenConsumeType.MinorActed));\r\n return SCommand_1.SPhaseResult.Handled;\r\n }\r\n // ここまで来てしまったら向きだけ変えて待機。\r\n cctx.postActivity(LActivity_1.LActivity.makeDirectionChange(self, newDir)\r\n .withConsumeAction(LCommon_1.LActionTokenConsumeType.MajorActed));\r\n return SCommand_1.SPhaseResult.Handled;\r\n }\r\n thinkAction(cctx, self) {\r\n if (this._candidateSkillActions.length > 0) {\r\n const action = this._candidateSkillActions[0];\r\n const target = MRLively_1.MRLively.world.entity(action.target);\r\n // 攻撃候補が有効なまま存在していれば、相手の方を向いて攻撃\r\n if (UAction_1.UAction.checkEntityWithinSkillActionRange(self, MRData_1.MRData.skills[action.skillId], false, [target])) {\r\n cctx.postActivity(LActivity_1.LActivity.makeDirectionChange(self, UMovement_1.UMovement.getLookAtDir(self, target)));\r\n cctx.postActivity(LActivity_1.LActivity.makePerformSkill(self, MRData_1.MRData.system.skills.normalAttack));\r\n }\r\n this._candidateSkillActions.shift();\r\n }\r\n // 攻撃の成否に関わらず行動を消費する。\r\n cctx.postConsumeActionToken(self, LCommon_1.LActionTokenConsumeType.MajorActed);\r\n return SCommand_1.SPhaseResult.Handled;\r\n }\r\n};\r\nLBlindAI = LBlindAI_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LBlindAI);\r\nexports.LBlindAI = LBlindAI;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/ai/LBlindAI.ts?"); /***/ }), /***/ "./ts/mr/lively/ai/LCharacterAI.ts": /*!*****************************************!*\ !*** ./ts/mr/lively/ai/LCharacterAI.ts ***! \*****************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LCharacterAI = void 0;\r\n/*\r\n\r\n [2021/8/24] タグのような仕組みを使うのはどうだろう\r\n ----------\r\n タイプタグとか。これは Behavior の方にも流用できそうな感じ。\r\n\r\n とりあえず AI で考えると、\r\n\r\n - entity.getAITagList() で、Behavior をなめて AITag リストを取り出す。\r\n - AITag は Normal, Escape, Confuse, ShopKeeper\r\n\r\n いやタグだけじゃ足りないかも。\r\n 状態を持っておく構造体が必要になる。\r\n\r\n そうするとやっぱりクラスを返す、で十分な気が…。\r\n\r\n\r\n\r\n ----------\r\n\r\n - 逃げるAIは全く別の CharacterAI作ったほうがいいかもしれない。\r\n - 隣接していても必ず矢を撃ってくるAI\r\n\r\n 敵に支援杖を振るモンスター\r\n ----------\r\n これはタイミングを慎重に考える必要がある。\r\n まず、Minor 時点で杖を振るか否かは「ドラフト行動」として決める。これは攻撃するかどうかを決めるのと同じタイミング。\r\n しかし実際に杖を振るタイミングは Major フェーズなので、対象として決めた相手が移動した結果、効果範囲外に出てしまうこともある。\r\n そうしたときは、Major でもう一度 Minor の思考処理を回す。\r\n シレン2でバッドカンガルー系がワンテンポ遅れて移動することがあるのは多分このため。\r\n\r\n 射程内であれば、必ずとくぎを使うモンスター\r\n ----------\r\n 矢を撃つモンスターなど。\r\n これは、行動パターンのレーティング 9 を特殊扱いしてみる?\r\n\r\n 非隣接時の歩行確率から考えたほうが良いか?(elonaはこれ)\r\n - elona のアルゴリズムだと、全く移動しないこともある。不思議のダンジョンとしては微妙かも?\r\n\r\n 「歩行」もアクションの1つとして扱ってみるとか?\r\n - 最初の候補アクション導出時に、隣接攻撃可能対象がいるなら、「歩行」を候補アクションリストから外す。\r\n - そのうえで、レーティング 9 を特殊扱い\r\n\r\n [2021/8/17] AI の変更・包含(合成)\r\n ----------\r\n - ステート\"恐怖\"などで Entity はそのまま、ステート要因で逃げAIがアクティブになることがある。\r\n - 混乱、目つぶし\r\n - 店主は、攻撃対象 Entity がいる場合は通常の敵と同じように行動する。\r\n\r\n やっぱり Behavior ごとに実装してオーバーライドがベターかな…。\r\n もし AI も拡張可能にする、を考えるとこれしかないかも。\r\n\r\n\r\n*/\r\n/**\r\n * Run のマージにより 1Run 内に複数回行動する場合、まず thinkMoving() が\r\n * 複数回呼ばれ、そのあと Token が残っている分だけ thinkAction() が呼ばれる。\r\n */\r\nclass LCharacterAI {\r\n}\r\nexports.LCharacterAI = LCharacterAI;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/ai/LCharacterAI.ts?"); /***/ }), /***/ "./ts/mr/lively/ai/LConfusionAI.ts": /*!*****************************************!*\ !*** ./ts/mr/lively/ai/LConfusionAI.ts ***! \*****************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LConfusionAI_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LConfusionAI = exports.LConfusionAIRestriction = void 0;\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst UAction_1 = __webpack_require__(/*! ts/mr/utility/UAction */ \"./ts/mr/utility/UAction.ts\");\r\nconst UMovement_1 = __webpack_require__(/*! ts/mr/utility/UMovement */ \"./ts/mr/utility/UMovement.ts\");\r\nconst LActivity_1 = __webpack_require__(/*! ../activities/LActivity */ \"./ts/mr/lively/activities/LActivity.ts\");\r\nconst LCharacterAI_1 = __webpack_require__(/*! ./LCharacterAI */ \"./ts/mr/lively/ai/LCharacterAI.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst Helpers_1 = __webpack_require__(/*! ts/mr/system/Helpers */ \"./ts/mr/system/Helpers.ts\");\r\nconst LCommon_1 = __webpack_require__(/*! ../LCommon */ \"./ts/mr/lively/LCommon.ts\");\r\n;\r\nvar LConfusionAIRestriction;\r\n(function (LConfusionAIRestriction) {\r\n /** 攻撃しない */\r\n LConfusionAIRestriction[LConfusionAIRestriction[\"None\"] = 0] = \"None\";\r\n /** 敵を攻撃 */\r\n LConfusionAIRestriction[LConfusionAIRestriction[\"AttcakToOpponent\"] = 1] = \"AttcakToOpponent\";\r\n /** 誰かを攻撃 */\r\n LConfusionAIRestriction[LConfusionAIRestriction[\"AttackToOther\"] = 2] = \"AttackToOther\";\r\n /** 味方を攻撃 */\r\n LConfusionAIRestriction[LConfusionAIRestriction[\"AttcakToFriend\"] = 3] = \"AttcakToFriend\";\r\n})(LConfusionAIRestriction = exports.LConfusionAIRestriction || (exports.LConfusionAIRestriction = {}));\r\nlet LConfusionAI = LConfusionAI_1 = class LConfusionAI extends LCharacterAI_1.LCharacterAI {\r\n constructor(restriction) {\r\n super();\r\n this._restriction = restriction;\r\n this._candidateSkillActions = [];\r\n }\r\n clone() {\r\n const i = new LConfusionAI_1(this._restriction);\r\n for (const s of this._candidateSkillActions) {\r\n i._candidateSkillActions.push({ skillId: s.skillId, target: s.target });\r\n }\r\n return i;\r\n }\r\n thinkMoving(cctx, self) {\r\n // 方向決定\r\n const dir = cctx.random().select(UMovement_1.UMovement.directions);\r\n // どのような理由があれ、向きは変更する\r\n cctx.postActivity(LActivity_1.LActivity.makeDirectionChange(self, dir));\r\n // 移動してみる。移動出来たら行動を消費する。\r\n if (UMovement_1.UMovement.checkPassageToDir(self, dir)) {\r\n cctx.postActivity(LActivity_1.LActivity.makeMoveToAdjacent(self, dir));\r\n cctx.postConsumeActionToken(self, LCommon_1.LActionTokenConsumeType.MinorActed);\r\n return SCommand_1.SPhaseResult.Handled;\r\n }\r\n // 通常攻撃できるか試してみる。\r\n // 実際の攻撃は Major フェーズで行いたいので、ここでは行動は消費しない。\r\n // 攻撃候補を覚えておく。\r\n if (this._restriction != LConfusionAIRestriction.None) {\r\n const block = UMovement_1.UMovement.getAdjacentBlock(self, dir);\r\n let targets = UAction_1.UAction.getSkillEffectiveTargets(self, MRData_1.MRData.skills[MRData_1.MRData.system.skills.normalAttack], false).filter(e => e.mx == block.mx && e.my == block.my);\r\n if (this._restriction == LConfusionAIRestriction.AttcakToFriend) {\r\n targets = targets.filter(x => Helpers_1.Helpers.isFriend(self, x));\r\n }\r\n else if (this._restriction == LConfusionAIRestriction.AttcakToOpponent) {\r\n targets = targets.filter(x => Helpers_1.Helpers.isHostile(self, x));\r\n }\r\n if (targets.length > 0) {\r\n this._candidateSkillActions.push({ skillId: MRData_1.MRData.system.skills.normalAttack, target: targets[0].entityId() });\r\n return SCommand_1.SPhaseResult.Handled;\r\n }\r\n }\r\n // ここまで来てしまったら何もせず待機行動。\r\n cctx.postConsumeActionToken(self, LCommon_1.LActionTokenConsumeType.MajorActed);\r\n return SCommand_1.SPhaseResult.Handled;\r\n }\r\n thinkAction(cctx, self) {\r\n if (this._candidateSkillActions.length > 0) {\r\n const action = this._candidateSkillActions[0];\r\n const target = MRLively_1.MRLively.world.entity(action.target);\r\n // 攻撃候補が有効なまま存在していれば、相手の方を向いて攻撃\r\n if (UAction_1.UAction.checkEntityWithinSkillActionRange(self, MRData_1.MRData.skills[action.skillId], false, [target])) {\r\n cctx.postActivity(LActivity_1.LActivity.makeDirectionChange(self, UMovement_1.UMovement.getLookAtDir(self, target)));\r\n cctx.postActivity(LActivity_1.LActivity.makePerformSkill(self, MRData_1.MRData.system.skills.normalAttack));\r\n }\r\n this._candidateSkillActions.shift();\r\n }\r\n // 攻撃の成否に関わらず行動を消費する。\r\n cctx.postConsumeActionToken(self, LCommon_1.LActionTokenConsumeType.MajorActed);\r\n return SCommand_1.SPhaseResult.Handled;\r\n }\r\n};\r\nLConfusionAI = LConfusionAI_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LConfusionAI);\r\nexports.LConfusionAI = LConfusionAI;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/ai/LConfusionAI.ts?"); /***/ }), /***/ "./ts/mr/lively/ai/LEscapeAI.ts": /*!**************************************!*\ !*** ./ts/mr/lively/ai/LEscapeAI.ts ***! \**************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LEscapeAI_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LEscapeAI = void 0;\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst SAIHelper_1 = __webpack_require__(/*! ts/mr/system/SAIHelper */ \"./ts/mr/system/SAIHelper.ts\");\r\nconst UAction_1 = __webpack_require__(/*! ts/mr/utility/UAction */ \"./ts/mr/utility/UAction.ts\");\r\nconst UMovement_1 = __webpack_require__(/*! ts/mr/utility/UMovement */ \"./ts/mr/utility/UMovement.ts\");\r\nconst LActivity_1 = __webpack_require__(/*! ../activities/LActivity */ \"./ts/mr/lively/activities/LActivity.ts\");\r\nconst LCharacterAI_1 = __webpack_require__(/*! ./LCharacterAI */ \"./ts/mr/lively/ai/LCharacterAI.ts\");\r\nconst LMap_1 = __webpack_require__(/*! ../LMap */ \"./ts/mr/lively/LMap.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst LMoveDeterminer_1 = __webpack_require__(/*! ./LMoveDeterminer */ \"./ts/mr/lively/ai/LMoveDeterminer.ts\");\r\nconst LCommon_1 = __webpack_require__(/*! ../LCommon */ \"./ts/mr/lively/LCommon.ts\");\r\nconst UBlock_1 = __webpack_require__(/*! ts/mr/utility/UBlock */ \"./ts/mr/utility/UBlock.ts\");\r\nconst HMovement_1 = __webpack_require__(/*! ../helpers/HMovement */ \"./ts/mr/lively/helpers/HMovement.ts\");\r\nlet LEscapeAI = LEscapeAI_1 = class LEscapeAI extends LCharacterAI_1.LCharacterAI {\r\n // private _movingHelper: LSaunteringAIHelper;\r\n // private _targetEntityId: LEntityId;\r\n constructor() {\r\n super();\r\n this._moveDeterminer = new LMoveDeterminer_1.LMoveDeterminer();\r\n // this._movingHelper = new LSaunteringAIHelper();\r\n // this._targetEntityId = LEntityId.makeEmpty();\r\n }\r\n clone() {\r\n const i = new LEscapeAI_1();\r\n return i;\r\n }\r\n // (mx, my) は subject から見て、hostileEntity の背面(向こう側)にあるかを判断する。\r\n // そっちの方向には行きたくない判断に使う。\r\n checkDeadInArea(subject, hostileEntity, mx, my) {\r\n const sx = subject.mx;\r\n const sy = subject.my;\r\n const ex = hostileEntity.mx;\r\n const ey = hostileEntity.my;\r\n const dx = Math.abs(sx - ex);\r\n const dy = Math.abs(sy - ey);\r\n const checkH = () => {\r\n if (sx < ex) { // 自分が敵の左側\r\n if (ex <= mx) { // 相手の立っている位置とその右側はすべて Dead\r\n return true;\r\n }\r\n }\r\n else if (ex < sx) { // 自分が敵の右側\r\n if (mx <= ex) { // 相手の立っている位置とその左側はすべて Dead\r\n return true;\r\n }\r\n }\r\n else {\r\n // 同一座標はセーフ\r\n }\r\n };\r\n const checkV = () => {\r\n if (sy < ey) { // 自分が敵の上側\r\n if (ey <= my) { // 相手の立っている位置とその下側はすべて Dead\r\n return true;\r\n }\r\n }\r\n else if (ey < sy) { // 自分が敵の下側\r\n if (my <= ey) { // 相手の立っている位置とその上側はすべて Dead\r\n return true;\r\n }\r\n }\r\n else {\r\n // 同一座標はセーフ\r\n }\r\n };\r\n if (UMovement_1.UMovement.distanceSq(sx, sy, mx, my) <= UMovement_1.UMovement.distanceSq(ex, ey, mx, my)) {\r\n return false;\r\n }\r\n if (dx > dy) {\r\n if (checkH())\r\n return true;\r\n }\r\n else if (dx < dy) {\r\n if (checkV())\r\n return true;\r\n }\r\n else {\r\n if (checkH())\r\n return true;\r\n if (checkV())\r\n return true;\r\n }\r\n return false;\r\n }\r\n thinkMoving(cctx, self) {\r\n this._moveDeterminer.decide(cctx, self);\r\n if (this.decideTargetPosition(cctx, self)) {\r\n return SCommand_1.SPhaseResult.Handled;\r\n }\r\n // 移動実行\r\n if (this._moveDeterminer.perform(cctx, self)) {\r\n return SCommand_1.SPhaseResult.Handled;\r\n }\r\n // ここまで来てしまったら待機。\r\n cctx.postActivity(LActivity_1.LActivity.make(self)\r\n .withConsumeAction(LCommon_1.LActionTokenConsumeType.WaitActed));\r\n return SCommand_1.SPhaseResult.Handled;\r\n }\r\n decideTargetPosition(cctx, self) {\r\n const target = UAction_1.UAction.findInSightNearlyHostileEntity(self);\r\n if (target) {\r\n // 逃げたい Unit が視界内にいる。(部屋内・通路内は問わない)\r\n const block = MRLively_1.MRLively.mapView.currentMap.block(self.mx, self.my);\r\n const room = MRLively_1.MRLively.mapView.currentMap.room(block._roomId);\r\n // 自分が部屋内の入り口に立っていて、隣接する通路は逃げても大丈夫そうなら、通路へ逃げ込む\r\n if (block.isRoomInnerEntrance()) {\r\n const roomOuterEntrance = UBlock_1.UBlock.adjacentBlocks4(MRLively_1.MRLively.mapView.currentMap, block.mx, block.my).find(x => x.isPassageway());\r\n if (roomOuterEntrance && !this.checkDeadInArea(self, target, roomOuterEntrance.mx, roomOuterEntrance.my)) {\r\n this._moveDeterminer.setTargetPosition(roomOuterEntrance.mx, roomOuterEntrance.my);\r\n return false;\r\n }\r\n }\r\n // \r\n const safetyInnerRoomEntrance = room.getRoomInnerEntranceBlocks()\r\n .filter(b => !this.checkDeadInArea(self, target, b.mx, b.my) && // block は敵対の向こう側にあるのでそっちは除外\r\n (b.mx != self.mx || b.my != self.my)) // 足元は除外\r\n .selectMin((a, b) => UMovement_1.UMovement.distanceSq(a.mx, a.my, b.mx, b.my));\r\n if (safetyInnerRoomEntrance) {\r\n // 相手に対して、背面等に通路がある。そこを目指す。\r\n //this._movingHelper.setTargetPosition(doorway.x(), doorway.y());\r\n this._moveDeterminer.setTargetPosition(safetyInnerRoomEntrance.mx, safetyInnerRoomEntrance.my);\r\n }\r\n else {\r\n // 相手が通路側に立ちふさがっている場合など\r\n const rdir = SAIHelper_1.SAIHelper.entityDistanceToDir(target, self);\r\n const dir = SAIHelper_1.SAIHelper.entityDistanceToDir(self, target);\r\n // まず背面にまったく移動できないかチェック\r\n const blocks = UMovement_1.UMovement.getWay3FrontBlocks(self, rdir);\r\n if (!blocks.find(b => HMovement_1.HMovement.checkPassageBlockToBlock(self, block, b, LMap_1.MovingMethod.Walk))) {\r\n if (!UMovement_1.UMovement.checkAdjacentPositions(self.mx, self.my, target.mx, target.my)) {\r\n // 隣接していなければ相手を向いて待機。\r\n // 消費 Token を Major にしてしまうと、倍速1回行動の時に上手く動かないので Minor で消費する。\r\n cctx.postActivity(LActivity_1.LActivity.make(self)\r\n .withEntityDirection(dir)\r\n .withConsumeAction(LCommon_1.LActionTokenConsumeType.MinorActed));\r\n return true;\r\n }\r\n else {\r\n // 観念して通常の移動を行う\r\n const doorway = cctx.random().selectOrUndefined(room.getRoomInnerEntranceBlocks());\r\n if (doorway) {\r\n // 出口を目的地設定して移動\r\n this._moveDeterminer.setTargetPosition(doorway.mx, doorway.my);\r\n }\r\n else {\r\n // 出口の内部屋。通常の移動プロセスにしたがう\r\n }\r\n }\r\n }\r\n else {\r\n // 左折の法則で逆方向に逃げる\r\n const block2 = UMovement_1.UMovement.getMovingCandidateBlockAsLHRule(self, rdir);\r\n if (block2) {\r\n cctx.postActivity(LActivity_1.LActivity.makeMoveToAdjacentBlock(self, block2)\r\n .withEntityDirection(rdir)\r\n .withConsumeAction(LCommon_1.LActionTokenConsumeType.MinorActed));\r\n return true;\r\n }\r\n else {\r\n throw new Error(\"Unreachable\");\r\n }\r\n }\r\n /*\r\n const dir = SAIHelper.entityDistanceToDir(target, self);\r\n if (UMovement.checkPassageToDir(self, dir)) {\r\n cctx.postActivity(\r\n LActivity.makeMoveToAdjacent(self, dir)\r\n .withEntityDirection(dir)\r\n .withConsumeAction());\r\n return SPhaseResult.Handled;\r\n }\r\n */\r\n }\r\n }\r\n return false;\r\n }\r\n thinkAction(cctx, self) {\r\n // この AI は逃げるだけで MajorAction はとらないため、なにもしない\r\n return SCommand_1.SPhaseResult.Pass;\r\n // 攻撃の成否に関わらず行動を消費する。\r\n //cctx.postConsumeActionToken(self, LActionTokenType.Major);\r\n //return SPhaseResult.Handled;\r\n }\r\n};\r\nLEscapeAI = LEscapeAI_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LEscapeAI);\r\nexports.LEscapeAI = LEscapeAI;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/ai/LEscapeAI.ts?"); /***/ }), /***/ "./ts/mr/lively/ai/LMoveDeterminer.ts": /*!********************************************!*\ !*** ./ts/mr/lively/ai/LMoveDeterminer.ts ***! \********************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LMoveDeterminer_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LMoveDeterminer = exports.LMovingMethod = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst Helpers_1 = __webpack_require__(/*! ts/mr/system/Helpers */ \"./ts/mr/system/Helpers.ts\");\r\nconst SAIHelper_1 = __webpack_require__(/*! ts/mr/system/SAIHelper */ \"./ts/mr/system/SAIHelper.ts\");\r\nconst UMovement_1 = __webpack_require__(/*! ts/mr/utility/UMovement */ \"./ts/mr/utility/UMovement.ts\");\r\nconst LActivity_1 = __webpack_require__(/*! ../activities/LActivity */ \"./ts/mr/lively/activities/LActivity.ts\");\r\nconst LBlockHelper_1 = __webpack_require__(/*! ../helpers/LBlockHelper */ \"./ts/mr/lively/helpers/LBlockHelper.ts\");\r\nconst LCommon_1 = __webpack_require__(/*! ../LCommon */ \"./ts/mr/lively/LCommon.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nvar LMovingMethod;\r\n(function (LMovingMethod) {\r\n LMovingMethod[LMovingMethod[\"ToTarget\"] = 0] = \"ToTarget\";\r\n LMovingMethod[LMovingMethod[\"LHRule\"] = 1] = \"LHRule\";\r\n})(LMovingMethod = exports.LMovingMethod || (exports.LMovingMethod = {}));\r\nlet LMoveDeterminer = LMoveDeterminer_1 = class LMoveDeterminer {\r\n constructor() {\r\n // 移動ターゲットとなる座標。\r\n // _primaryTargetEntity ではなく、部屋の入り口などを示すこともある。\r\n this._targetPositionX = -1;\r\n this._targetPositionY = -1;\r\n this._noActionTurnCount = 0;\r\n /*private*/ this._decired = { method: LMovingMethod.LHRule };\r\n }\r\n clone() {\r\n const i = new LMoveDeterminer_1();\r\n i._targetPositionX = this._targetPositionX;\r\n i._targetPositionY = this._targetPositionY;\r\n i._noActionTurnCount = this._noActionTurnCount;\r\n return i;\r\n }\r\n // decide() の後に呼び出すことで、通常の移動処理の目標位置をオーバーライドできる。\r\n setTargetPosition(x, y) {\r\n this._targetPositionX = x;\r\n this._targetPositionY = y;\r\n }\r\n decide(cctx, self) {\r\n const rand = cctx.random();\r\n const block = MRLively_1.MRLively.mapView.currentMap.block(self.mx, self.my);\r\n if (!this.hasDestination()) {\r\n if (!block.isRoom()) {\r\n // 目的地なし, 現在位置が通路・迷路\r\n // => 左折の法則による移動\r\n this._decired = { method: LMovingMethod.LHRule };\r\n return;\r\n }\r\n else {\r\n const room = MRLively_1.MRLively.mapView.currentMap.room(block._roomId);\r\n if (!block.isRoomInnerEntrance()) {\r\n // 目的地なし, 現在位置が部屋\r\n // => ランダムな入口を目的地に設定し、目的地に向かう移動。\r\n // => 入口が無ければ左折の法則による移動\r\n const block = this.findTargetRoomInnerEntranceBlock(self, rand, room);\r\n if (block) {\r\n this._targetPositionX = block.mx;\r\n this._targetPositionY = block.my;\r\n this._decired = { method: LMovingMethod.ToTarget };\r\n return;\r\n }\r\n else {\r\n // 入り口のない部屋。左折の法則による移動を継続する。\r\n this._decired = { method: LMovingMethod.LHRule };\r\n return;\r\n }\r\n }\r\n else {\r\n // 目的地なし, 現在位置が部屋の入口\r\n // => 現在位置以外のランダムな入口を目的地に設定し、左折の法則による移動\r\n // => 他に入口がなければ逆方向を向き、左折の法則による移動\r\n const block = this.findTargetRoomInnerEntranceBlock(self, rand, room);\r\n if (block) {\r\n this._targetPositionX = block.mx;\r\n this._targetPositionY = block.my;\r\n }\r\n else {\r\n self.dir = UMovement_1.UMovement.reverseDir(self.dir);\r\n }\r\n this._decired = { method: LMovingMethod.LHRule };\r\n return;\r\n }\r\n }\r\n }\r\n else if (!this.canModeToTarget(self)) {\r\n // 目的地あり 目的地が現在位置\r\n // => 目的地を解除し、左折の法則による移動\r\n this.clearTargetPosition();\r\n // これは SFC シレン Wiki には乗っていない細工。\r\n // 部屋内から目的地にたどり着いたとき、現在の向きと通路の方向が直角だと、左折の法則で通路に侵入できなくなる。\r\n // 対策として、このときは隣接している通路ブロックへの移動を優先する。\r\n const blocks = UMovement_1.UMovement.getMovableAdjacentTiles(self).filter(b => b.isPassageway());\r\n if (blocks.length > 0) {\r\n this._decired = { method: LMovingMethod.ToTarget, passageway: blocks[rand.nextIntWithMax(blocks.length)] };\r\n return;\r\n }\r\n else {\r\n this._decired = { method: LMovingMethod.LHRule };\r\n return;\r\n }\r\n }\r\n else {\r\n // 目的地あり 目的地が現在位置でない\r\n // => 目的地に向かう移動 (moveToTarget() で移動)\r\n this._decired = { method: LMovingMethod.ToTarget };\r\n return;\r\n }\r\n }\r\n clearTargetPosition() {\r\n this._targetPositionX = -1;\r\n this._targetPositionY = -1;\r\n }\r\n findTargetRoomInnerEntranceBlock(self, rand, room) {\r\n const candidates1 = room.getRoomInnerEntranceBlocks().filter(b => b.mx != self.mx || b.my != self.my); // 足元フィルタ\r\n if (candidates1.length <= 0)\r\n return undefined;\r\n const candidates2 = [];\r\n for (const block of candidates1) {\r\n if (LBlockHelper_1.LBlockHelper.hasHostileFootpoint(block, self.getInnermostFactionId())) {\r\n candidates2.push(block);\r\n }\r\n }\r\n if (candidates2.length > 0) {\r\n return LBlockHelper_1.LBlockHelper.selectNearestBlock(candidates2, self);\r\n }\r\n else {\r\n const block = candidates1[rand.nextIntWithMax(candidates1.length)];\r\n return block;\r\n }\r\n }\r\n /**\r\n * 移動実行\r\n */\r\n perform(cctx, self) {\r\n if (this.performInternal(cctx, self)) {\r\n this._noActionTurnCount = 0;\r\n return true;\r\n }\r\n return false;\r\n }\r\n // \r\n performInternal(cctx, self) {\r\n // 目的地設定がなされてるのであればそこへ向かって移動する\r\n if (this.canModeToTarget(self)) {\r\n if (this.moveToTarget(self, cctx)) {\r\n return true;\r\n }\r\n else {\r\n // 壁際を斜め移動しようとした等、移動できなかった\r\n this._decired.method = LMovingMethod.LHRule;\r\n }\r\n }\r\n if (this._decired.passageway) {\r\n this.postMoveToAdjacent(self, this._decired.passageway, cctx);\r\n return true;\r\n }\r\n if (this.hasDestination() &&\r\n self.mx == this._targetPositionX &&\r\n self.my == this._targetPositionY) {\r\n // 目標座標が指定されているが既に到達済みの場合は、ランダム移動を行わない。\r\n // 店主など、明示的に移動させない Entity が該当する。\r\n return true;\r\n }\r\n // 左折の法則による移動\r\n if (this._decired.method == LMovingMethod.LHRule) {\r\n const block = UMovement_1.UMovement.getMovingCandidateBlockAsLHRule(self, self.dir);\r\n if (block) {\r\n this.postMoveToAdjacent(self, block, cctx);\r\n // 移動後、向きの修正\r\n const dir = (this.hasDestination()) ?\r\n SAIHelper_1.SAIHelper.distanceToDir(self.mx, self.my, this._targetPositionX, this._targetPositionY) : // 目標があるならそちらを向ける\r\n UMovement_1.UMovement.getLookAtDirFromPos(self.mx, self.my, block.mx, block.my); // 目標が無ければ進行方向を向く\r\n cctx.postActivity(LActivity_1.LActivity.makeDirectionChange(self, dir));\r\n return true;\r\n }\r\n }\r\n this._noActionTurnCount++;\r\n if (this._noActionTurnCount >= 6) {\r\n // 6連続で移動できなかったときはランダム移動\r\n const candidates = UMovement_1.UMovement.getMovableAdjacentTiles(self);\r\n if (candidates.length > 0) {\r\n const block = candidates[cctx.random().nextIntWithMax(candidates.length)];\r\n this.postMoveToAdjacent(self, block, cctx);\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n canModeToTarget(self) {\r\n return this.hasDestination() && (self.mx != this._targetPositionX || self.my != this._targetPositionY);\r\n }\r\n moveToTarget(self, cctx) {\r\n // 目的地設定済みで、未到達であること\r\n (0, Common_1.assert)(this.canModeToTarget(self));\r\n const dir = SAIHelper_1.SAIHelper.distanceToDir(self.mx, self.my, this._targetPositionX, this._targetPositionY);\r\n if (dir != 0 && UMovement_1.UMovement.checkPassageToDir(self, dir)) {\r\n cctx.postActivity(LActivity_1.LActivity.makeDirectionChange(self, dir));\r\n cctx.postActivity(LActivity_1.LActivity.makeMoveToAdjacent(self, dir));\r\n //this.moveToAdjacent(self, block, cctx);\r\n cctx.postConsumeActionToken(self, LCommon_1.LActionTokenConsumeType.MinorActed);\r\n return true;\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n postMoveToAdjacent(self, block, cctx) {\r\n const dir = Helpers_1.Helpers.offsetToDir(block.mx - self.mx, block.my - self.my);\r\n cctx.postActivity(LActivity_1.LActivity.makeDirectionChange(self, dir));\r\n cctx.postActivity(LActivity_1.LActivity.makeMoveToAdjacent(self, dir));\r\n cctx.postConsumeActionToken(self, LCommon_1.LActionTokenConsumeType.MinorActed);\r\n }\r\n // 目的地あり?\r\n hasDestination() {\r\n return this._targetPositionX >= 0 && this._targetPositionY >= 0;\r\n }\r\n};\r\nLMoveDeterminer = LMoveDeterminer_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LMoveDeterminer);\r\nexports.LMoveDeterminer = LMoveDeterminer;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/ai/LMoveDeterminer.ts?"); /***/ }), /***/ "./ts/mr/lively/ai/LMovingTargetFinder.ts": /*!************************************************!*\ !*** ./ts/mr/lively/ai/LMovingTargetFinder.ts ***! \************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LMovingTargetFinder_Gold = exports.LMovingTargetFinder_Item = exports.LMovingTargetFinder = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst USearch_1 = __webpack_require__(/*! ts/mr/utility/USearch */ \"./ts/mr/utility/USearch.ts\");\r\n/**\r\n * LActionDeterminer で有効スキルが発生しなかったため移動処理を行う際に、移動先座標を決定するためのクラス。\r\n *\r\n * 移動先決定は様々なパターンがある。\r\n *\r\n * - 落ちているアイテムへ向かう\r\n * - 落ちているゴールドへ向かう\r\n * - アイテムまたはゴールドへ向かう\r\n * - 食べ物モンスターや土偶へ向かう\r\n * - 罠へ向かう (罠壊し)\r\n * - 階段へ向かう (ツッパリ)\r\n * - (HPが少なくなったら) 水路へ向かう\r\n *\r\n * 今後も多くの追加が予想される。\r\n * また Behavior 固有ではなく AI として共有されるものであるため、この検索処理を Behavior に実装するのは望ましくない。\r\n *\r\n * さらに AI のアーキテクチャはまだまだ手探り状態。\r\n * そのためできるだけ細かい粒度で機能を分割 (継承ではなく包含で) しておき、後々のリファクタリングに耐えやすいようにしておく。\r\n */\r\nlet LMovingTargetFinder = class LMovingTargetFinder {\r\n decide(self) { return undefined; }\r\n};\r\nLMovingTargetFinder = __decorate([\r\n Common_1.MRSerializable\r\n], LMovingTargetFinder);\r\nexports.LMovingTargetFinder = LMovingTargetFinder;\r\nlet LMovingTargetFinder_Item = class LMovingTargetFinder_Item {\r\n decide(self) {\r\n const item = USearch_1.USearch.findLatestItemInVisibilityBlocks(self);\r\n if (item) {\r\n return [item.mx, item.my];\r\n }\r\n return undefined;\r\n }\r\n};\r\nLMovingTargetFinder_Item = __decorate([\r\n Common_1.MRSerializable\r\n], LMovingTargetFinder_Item);\r\nexports.LMovingTargetFinder_Item = LMovingTargetFinder_Item;\r\nlet LMovingTargetFinder_Gold = class LMovingTargetFinder_Gold {\r\n decide(self) {\r\n const item = USearch_1.USearch.findLatestItemInVisibilityBlocks(self);\r\n if (item && item.checkLooksLikeGold()) {\r\n return [item.mx, item.my];\r\n }\r\n return undefined;\r\n }\r\n};\r\nLMovingTargetFinder_Gold = __decorate([\r\n Common_1.MRSerializable\r\n], LMovingTargetFinder_Gold);\r\nexports.LMovingTargetFinder_Gold = LMovingTargetFinder_Gold;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/ai/LMovingTargetFinder.ts?"); /***/ }), /***/ "./ts/mr/lively/ai/LRatedRandomAI.ts": /*!*******************************************!*\ !*** ./ts/mr/lively/ai/LRatedRandomAI.ts ***! \*******************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LRatedRandomAI_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LRatedRandomAI = void 0;\r\nconst LCharacterAI_1 = __webpack_require__(/*! ./LCharacterAI */ \"./ts/mr/lively/ai/LCharacterAI.ts\");\r\nconst LStandardAI_1 = __webpack_require__(/*! ./LStandardAI */ \"./ts/mr/lively/ai/LStandardAI.ts\");\r\nconst LConfusionAI_1 = __webpack_require__(/*! ./LConfusionAI */ \"./ts/mr/lively/ai/LConfusionAI.ts\");\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nlet LRatedRandomAI = LRatedRandomAI_1 = class LRatedRandomAI extends LCharacterAI_1.LCharacterAI {\r\n constructor() {\r\n super();\r\n this._randomRate = 50;\r\n this._rundomTurn = false;\r\n this._standardAI = new LStandardAI_1.LCharacterAI_Normal();\r\n // ランダム移動には混乱の処理を流用するが、その中のランダム攻撃は発動しないようにしておく\r\n this._randomAI = new LConfusionAI_1.LConfusionAI(LConfusionAI_1.LConfusionAIRestriction.None);\r\n }\r\n clone() {\r\n const i = new LRatedRandomAI_1();\r\n i._standardAI = this._standardAI.clone();\r\n i._randomAI = this._randomAI.clone();\r\n return i;\r\n }\r\n thinkMoving(cctx, self) {\r\n // ターンの最初に、今回はランダム移動なのか普通の行動かのか決める\r\n this._rundomTurn = (cctx.random().nextIntWithMax(100) < this._randomRate);\r\n if (this._rundomTurn) {\r\n return this._randomAI.thinkMoving(cctx, self);\r\n }\r\n else {\r\n return this._standardAI.thinkMoving(cctx, self);\r\n }\r\n }\r\n thinkAction(cctx, self) {\r\n (0, Common_1.assert)(!this._rundomTurn);\r\n return this._standardAI.thinkMoving(cctx, self);\r\n }\r\n};\r\nLRatedRandomAI = LRatedRandomAI_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LRatedRandomAI);\r\nexports.LRatedRandomAI = LRatedRandomAI;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/ai/LRatedRandomAI.ts?"); /***/ }), /***/ "./ts/mr/lively/ai/LStandardAI.ts": /*!****************************************!*\ !*** ./ts/mr/lively/ai/LStandardAI.ts ***! \****************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LCharacterAI_Normal_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LCharacterAI_Normal = void 0;\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst LCharacterAI_1 = __webpack_require__(/*! ./LCharacterAI */ \"./ts/mr/lively/ai/LCharacterAI.ts\");\r\nconst LActionDeterminer_1 = __webpack_require__(/*! ./LActionDeterminer */ \"./ts/mr/lively/ai/LActionDeterminer.ts\");\r\nconst LMoveDeterminer_1 = __webpack_require__(/*! ./LMoveDeterminer */ \"./ts/mr/lively/ai/LMoveDeterminer.ts\");\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst DPrefab_1 = __webpack_require__(/*! ts/mr/data/DPrefab */ \"./ts/mr/data/DPrefab.ts\");\r\nconst LCommon_1 = __webpack_require__(/*! ../LCommon */ \"./ts/mr/lively/LCommon.ts\");\r\nconst DSpawner_1 = __webpack_require__(/*! ts/mr/data/DSpawner */ \"./ts/mr/data/DSpawner.ts\");\r\n/**\r\n * https://yttm-work.jp/game_ai/game_ai_0001.html\r\n * https://wiki.denfaminicogamer.jp/ai_wiki/%E3%82%AD%E3%83%A3%E3%83%A9%E3%82%AF%E3%82%BF%E3%83%BCAI\r\n */\r\nlet LCharacterAI_Normal = LCharacterAI_Normal_1 = class LCharacterAI_Normal extends LCharacterAI_1.LCharacterAI {\r\n constructor() {\r\n super(...arguments);\r\n this._moveDeterminer = new LMoveDeterminer_1.LMoveDeterminer();\r\n this._actionDeterminer = new LActionDeterminer_1.LActionDeterminer();\r\n }\r\n clone() {\r\n const i = new LCharacterAI_Normal_1();\r\n i._moveDeterminer = this._moveDeterminer.clone();\r\n i._actionDeterminer = this._actionDeterminer.clone();\r\n return i;\r\n }\r\n setMovingTargetFinder(value) {\r\n this._movingTargetFinder = value;\r\n }\r\n thinkMoving(cctx, self) {\r\n const hasPrimaryTarget = this._actionDeterminer.hasPrimaryTarget();\r\n this._actionDeterminer.decide(cctx, self);\r\n this._moveDeterminer.decide(cctx, self);\r\n this.applyTargetPosition(self, hasPrimaryTarget);\r\n // moveDeterminer.decide によって決定された標準的な移動目標のオーバーライド\r\n {\r\n // 今回の decide() ではスキル使用が行われず移動が要求されている場合、\r\n // まずは特殊な移動先検索を実施してみる。\r\n if (this._actionDeterminer.isMoveRequested() && this._movingTargetFinder) {\r\n const pos = this._movingTargetFinder.decide(self);\r\n if (pos) {\r\n this._moveDeterminer.setTargetPosition(pos[0], pos[1]);\r\n this._moveDeterminer._decired = { method: LMoveDeterminer_1.LMovingMethod.ToTarget };\r\n }\r\n }\r\n }\r\n // 攻撃対象が設定されていれば、このフェーズでは何もしない\r\n if (this._actionDeterminer.isMajorActionRequested()) {\r\n return SCommand_1.SPhaseResult.Pass;\r\n }\r\n // 移動メイン\r\n if (self.data.prefab().moveType == DPrefab_1.DPrefabMoveType.Random) {\r\n if (this._moveDeterminer.perform(cctx, self)) {\r\n return SCommand_1.SPhaseResult.Handled;\r\n }\r\n }\r\n // ここまで来たら、攻撃対象も無いうえに移動ができなかったということ。\r\n // 例えば、壁に埋まっている状態。\r\n // FIXME: ここでやるのが最善かわからないが、攻撃対象が決められていない場合は\r\n // Major Phase でも行動消費するアクションがとれないので、ハングアップしてしまう。\r\n // ここで消費しておく。\r\n cctx.postConsumeActionToken(self, LCommon_1.LActionTokenConsumeType.WaitActed);\r\n return SCommand_1.SPhaseResult.Handled;\r\n }\r\n applyTargetPosition(self, prevHasPrimaryTarget) {\r\n const spawner = self.getUniqueSpawner();\r\n if (this._actionDeterminer.hasPrimaryTarget()) {\r\n // 攻撃対象が設定されていれば、常に目標座標を更新し続ける\r\n const target = this._actionDeterminer.primaryTarget();\r\n this._moveDeterminer.setTargetPosition(target.mx, target.my);\r\n }\r\n else if (spawner && spawner.moveType == DSpawner_1.DUniqueSpawnerMoveType.Homecoming) {\r\n this._moveDeterminer.setTargetPosition(spawner.mx, spawner.my);\r\n }\r\n else if (prevHasPrimaryTarget != this._actionDeterminer.hasPrimaryTarget()) {\r\n // decide() によってこれまでの PrimaryTarget を見失った\r\n //this._moveDeterminer.setTargetPosition(-1, -1);\r\n // ↑見失った場合、Footpoint などを考慮して選択済みの移動目標を維持したいので、コメントアウトして様子を見る。\r\n }\r\n }\r\n /*\r\n private updateSituation(self: LEntity): void {\r\n\r\n // http://twist.jpn.org/sfcsiren/index.php?%E3%82%BF%E3%83%BC%E3%83%B3%E3%81%AE%E9%A0%86%E7%95%AA\r\n // の移動目標位置決定はもう少し後の Phase なのだが、敵対 Entity への移動目標位置決定はこの Phase で行う。\r\n // こうしておかないと、Player の移動を追うように Enemy が移動できなくなる。\r\n {\r\n // 同じ部屋にいる敵対 Entity のうち、一番近い Entity を検索\r\n const roomId = REGame.map.roomId(self);\r\n const target = REGame.map.entitiesInRoom(roomId)\r\n .filter(e => Helpers.isHostile(self, e))\r\n .immutableSort((a, b) => Helpers.getDistance(self, a) - Helpers.getDistance(self, b))\r\n .find(e => Helpers.isHostile(self, e));\r\n if (target) {\r\n this._targetPositionX = target.x;\r\n this._targetPositionY = target.y;\r\n \r\n // target は最も近い Entity となっているので、これと隣接しているか確認し、攻撃対象とする\r\n if (Helpers.checkAdjacent(self, target)) {\r\n this._attackTargetEntityId = target.entityId();\r\n }\r\n\r\n return;\r\n }\r\n\r\n\r\n\r\n // target がひとつも見つからなければ、探索移動モード\r\n\r\n const block = REGame.map.block(self.x, self.y);\r\n if (!this.hasDestination()) {\r\n if (!block.isRoom()) {\r\n // 目的地なし, 現在位置が通路・迷路\r\n // => 左折の法則による移動\r\n }\r\n }\r\n\r\n\r\n \r\n else {\r\n console.log(\"NotImplemented.\");\r\n this._targetPositionX = -1;\r\n this._targetPositionY = -1;\r\n\r\n\r\n\r\n\r\n }\r\n }\r\n }\r\n */\r\n thinkAction(cctx, self) {\r\n if (this._actionDeterminer.perform(cctx, self)) {\r\n return SCommand_1.SPhaseResult.Handled;\r\n }\r\n return SCommand_1.SPhaseResult.Pass;\r\n }\r\n};\r\nLCharacterAI_Normal = LCharacterAI_Normal_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LCharacterAI_Normal);\r\nexports.LCharacterAI_Normal = LCharacterAI_Normal;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/ai/LStandardAI.ts?"); /***/ }), /***/ "./ts/mr/lively/behaviors/LActivityCharmBehavior.ts": /*!**********************************************************!*\ !*** ./ts/mr/lively/behaviors/LActivityCharmBehavior.ts ***! \**********************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LActivityCharmBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LActivityCharmBehavior = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ts/mr/system/MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst SEmittorPerformer_1 = __webpack_require__(/*! ts/mr/system/SEmittorPerformer */ \"./ts/mr/system/SEmittorPerformer.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LBehavior_1 = __webpack_require__(/*! ./LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\n/**\r\n *\r\n */\r\nlet LActivityCharmBehavior = LActivityCharmBehavior_1 = class LActivityCharmBehavior extends LBehavior_1.LBehavior {\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LActivityCharmBehavior_1);\r\n return b;\r\n }\r\n isCharmBehavior() {\r\n return true;\r\n }\r\n onActivity(self, cctx, actx) {\r\n const owner = this.ownerEntity();\r\n const activity = actx.activity();\r\n const reaction = owner.data.findReaction(activity.actionId());\r\n if (reaction) {\r\n for (const emittor of reaction.emittors()) {\r\n SEmittorPerformer_1.SEmittorPerformer.makeWithEmitor(self, self, emittor)\r\n .setItemEntity(self)\r\n .perform(cctx);\r\n }\r\n // TODO: test\r\n MRSystem_1.MRSystem.scheduler.reset();\r\n return SCommand_1.SCommandResponse.Handled;\r\n }\r\n // if (activity.actionId() == REBasics.actions.dead) {\r\n // return SCommandResponse.Handled;\r\n // }\r\n return SCommand_1.SCommandResponse.Pass;\r\n }\r\n onActivityReaction(self, cctx, activity) {\r\n // if (activity.actionId() == REBasics.actions.dead) {\r\n // return SCommandResponse.Handled;\r\n // }\r\n return SCommand_1.SCommandResponse.Pass;\r\n }\r\n};\r\nLActivityCharmBehavior = LActivityCharmBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LActivityCharmBehavior);\r\nexports.LActivityCharmBehavior = LActivityCharmBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/behaviors/LActivityCharmBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/behaviors/LActorBehavior.ts": /*!**************************************************!*\ !*** ./ts/mr/lively/behaviors/LActorBehavior.ts ***! \**************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LActorBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LActorBehavior = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LBattlerBehavior_1 = __webpack_require__(/*! ./LBattlerBehavior */ \"./ts/mr/lively/behaviors/LBattlerBehavior.ts\");\r\n/**\r\n */\r\nlet LActorBehavior = LActorBehavior_1 = class LActorBehavior extends LBattlerBehavior_1.LBattlerBehavior {\r\n constructor() {\r\n super();\r\n /*\r\n レベルの扱いや増減について\r\n ----------\r\n \r\n ### レベルをパラメータとするべきか?\r\n Actor の場合は経験値と密接な関係がある。仲間モンスターが経験値を得るようなシステムの場合も同様。\r\n - 経験値の増減によるレベルアップ\r\n - 敵スキルによるレベルダウン及び経験値ダウン\r\n - アイテムによるレベルの増減 (しあわせ草, 不幸の草)\r\n - アイテムによる経験値の増減 (しあわせの杖)\r\n - イベントによるレベルの増減\r\n \r\n 必ずしも経験値とレベルが結びつかないこともある点に注意。\r\n 敵モンスターは経験値の計算は行わず、経験値を得るような効果が発生したら、即レベルを上げる。\r\n \r\n ### 経験値をパラメータとするべきか?\r\n これもしないほうがいいかも。\r\n \r\n \r\n */\r\n this._classId = 0;\r\n // _level: number = 0;\r\n // _exp: number[] = [];\r\n this._skills = [];\r\n }\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LActorBehavior_1);\r\n throw new Error(\"Not implemented.\"); // TODO: base の LBattlerBehavior のコピー\r\n b._classId = this._classId;\r\n return b;\r\n }\r\n onAttached(self) {\r\n super.onAttached(self);\r\n this._classId = self.data.classId;\r\n //this._name = actor.name;\r\n //this._nickname = actor.nickname;\r\n //this._profile = actor.profile;\r\n this.initSkills();\r\n const a1 = self.getActualParam(MRBasics_1.MRBasics.params.level);\r\n const b1 = self.getActualParam(MRBasics_1.MRBasics.params.exp);\r\n //this.initEquips(actor.equips);\r\n //this.paramSet().clearParamPlus();\r\n self.recoverAll();\r\n }\r\n get rmmzActorId() {\r\n return this.ownerEntity().data.actorData().rmmzActorId;\r\n }\r\n // Game_Actor.prototype.actor\r\n actor() {\r\n const entity = this.ownerEntity().data;\r\n (0, Common_1.assert)(entity.actor);\r\n return entity.actor;\r\n }\r\n // Game_Actor.prototype.currentClass\r\n currentClass() {\r\n return MRData_1.MRData.classes[this._classId];\r\n }\r\n // Game_Actor.prototype.initSkills\r\n initSkills() {\r\n const level = this.ownerEntity().getActualParam(MRBasics_1.MRBasics.params.level);\r\n this._skills = [];\r\n for (const learning of this.currentClass().learnings) {\r\n if (learning.level <= level) {\r\n this.learnSkill(learning.skillId);\r\n }\r\n }\r\n }\r\n // Game_Actor.prototype.learnSkill\r\n learnSkill(skillId) {\r\n if (!this.isLearnedSkill(skillId)) {\r\n this._skills.push(skillId);\r\n this._skills.sort((a, b) => a - b);\r\n }\r\n }\r\n // Game_Actor.prototype.isLearnedSkill\r\n isLearnedSkill(skillId) {\r\n return this._skills.includes(skillId);\r\n }\r\n ;\r\n // Game_Actor.prototype.paramBase \r\n onQueryIdealParamBase(paramId, base) {\r\n const level = this.ownerEntity().getActualParam(MRBasics_1.MRBasics.params.level);\r\n const p = this.currentClass().params[MRData_1.MRData.parameters[paramId].battlerParamId];\r\n const v = (p ? p[level] : 0);\r\n (0, Common_1.assert)(v !== undefined);\r\n return base + v;\r\n }\r\n onQueryActions(actions) {\r\n actions.push(MRBasics_1.MRBasics.actions.ShootActionId);\r\n actions.push(MRBasics_1.MRBasics.actions.EatActionId);\r\n actions.push(MRBasics_1.MRBasics.actions.WaveActionId);\r\n return actions;\r\n }\r\n onCollectTraits(self, result) {\r\n super.onCollectTraits(self, result);\r\n for (const t of self.data.selfTraits) {\r\n result.push(t);\r\n }\r\n for (const t of this.currentClass().traits) {\r\n result.push(t);\r\n }\r\n }\r\n};\r\nLActorBehavior = LActorBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LActorBehavior);\r\nexports.LActorBehavior = LActorBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/behaviors/LActorBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/behaviors/LBattlerBehavior.ts": /*!****************************************************!*\ !*** ./ts/mr/lively/behaviors/LBattlerBehavior.ts ***! \****************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LBattlerBehavior = void 0;\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst UTransfer_1 = __webpack_require__(/*! ts/mr/utility/UTransfer */ \"./ts/mr/utility/UTransfer.ts\");\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst TStumble_1 = __webpack_require__(/*! ts/mr/transactions/TStumble */ \"./ts/mr/transactions/TStumble.ts\");\r\nlet LBattlerBehavior = class LBattlerBehavior extends LBehavior_1.LBehavior {\r\n /*\r\n [2021/12/14] レベルと経験値はパラメータ扱いしたほうがよい?\r\n ----------\r\n パラメータ扱いしておくと、レベルダウンや経験値取得の効果をパラメータダメージとして指定できるようになる。\r\n レベル吸収とかも。\r\n\r\n バフああんまりつけたくないかも?\r\n 一時的にレベルアップ・レベルダウンといった効果は確かに原作でもあるが…。\r\n でも本当にそれらを実装するとなったら、バフ扱いの方が都合がよい。\r\n\r\n Enemy,Actor というくくりにするよりは、\r\n \"経験値でレベルアップするBehavior\", \"経験値関係なくレベルアップするBehavior\" に分ける方が自然かも。\r\n そう考えると、Levelのバフは欲しいかもだけどExpのバフはさすがにいらないかも?\r\n いやでも経験値ダメージはありえるか…。\r\n\r\n */\r\n constructor() {\r\n super();\r\n }\r\n clone(newOwner) {\r\n throw new Error(); // LBattlerBehavior 自体の clone は禁止\r\n }\r\n paramSet() {\r\n return this.ownerEntity().params;\r\n }\r\n onAttached(self) {\r\n const params = this.paramSet();\r\n params.acquireParam(MRBasics_1.MRBasics.params.hp);\r\n params.acquireParam(MRBasics_1.MRBasics.params.mp);\r\n params.acquireParam(MRBasics_1.MRBasics.params.atk);\r\n params.acquireParam(MRBasics_1.MRBasics.params.def);\r\n params.acquireParam(MRBasics_1.MRBasics.params.mat);\r\n params.acquireParam(MRBasics_1.MRBasics.params.mdf);\r\n params.acquireParam(MRBasics_1.MRBasics.params.agi);\r\n params.acquireParam(MRBasics_1.MRBasics.params.luk);\r\n params.acquireParam(MRBasics_1.MRBasics.params.tp);\r\n params.acquireParam(MRBasics_1.MRBasics.params.fp);\r\n params.acquireParam(MRBasics_1.MRBasics.params.pow);\r\n }\r\n onQueryReactions(self, reactions) {\r\n // 敵味方を問わず、話しかけることは可能。\r\n reactions.push({ actionId: MRBasics_1.MRBasics.actions.talk });\r\n }\r\n // Game_BattlerBase.prototype.isGuard \r\n isGuard() {\r\n return false;\r\n }\r\n ;\r\n // Game_Actor.prototype.attackAnimationId1\r\n attackAnimationId() {\r\n return this.bareHandsAnimationId();\r\n }\r\n // Game_Actor.prototype.bareHandsAnimationId\r\n bareHandsAnimationId() {\r\n return MRData_1.MRData.system.bareHandsFlavorEffect;\r\n }\r\n //------------------------------------------------------------\r\n onCollectEffector(owner, data) {\r\n }\r\n onPermanentDeath(self, cctx) {\r\n const entity = this.ownerEntity();\r\n if (entity.isUnique()) {\r\n if (entity == MRLively_1.MRLively.mapView.focusedEntity()) {\r\n cctx.postSequel(entity, MRBasics_1.MRBasics.sequels.CollapseSequel);\r\n cctx.postWait(entity, 100);\r\n cctx.postWaitSequel(); // ゲームオーバー時の遷移で、\"倒れた\" メッセージの後に Wait が動くようにしたい\r\n TStumble_1.TStumble.postDropItems(cctx, entity, LBehavior_1.LGenerateDropItemCause.Dead);\r\n UTransfer_1.UTransfer.exitLand(cctx, entity, MRData_1.LandExitResult.Gameover);\r\n }\r\n else {\r\n // 仲間等\r\n throw new Error(\"Not implemented.\");\r\n }\r\n return SCommand_1.SCommandResponse.Handled;\r\n }\r\n return SCommand_1.SCommandResponse.Pass;\r\n }\r\n};\r\nLBattlerBehavior = __decorate([\r\n Common_1.MRSerializable\r\n], LBattlerBehavior);\r\nexports.LBattlerBehavior = LBattlerBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/behaviors/LBattlerBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/behaviors/LBehavior.ts": /*!*********************************************!*\ !*** ./ts/mr/lively/behaviors/LBehavior.ts ***! \*********************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\n/**\r\n *\r\n * [2020/11/30] シンボル関数名 vs Id(number)\r\n * ----------\r\n * 少なくとも、シンボルを関数名として使うのはやめた方がよさそう。\r\n * post 側は、相手側の関数名を知る必要は無くしたい。\r\n *\r\n * post では ActionId(Symbol or Number) を渡し、フレームワークによって\r\n * 従来の onPreReaction, onReaction を呼んでもらう。\r\n *\r\n * ### 相手側の関数名を知っていたいときもある\r\n *\r\n * 相手…というより、自分自身に post したいとき。向き変更や歩行が代表的かな。\r\n * これらは Action-Reaction のフレームワークがマッチしなかった者たち。\r\n *\r\n *\r\n *\r\n *\r\n * [2020/9/29] Behavior の代用\r\n * レンサのワナ、吸収の壺、あくまだんしゃく系\r\n *\r\n *\r\n * @note Attribute と Behavior を分ける必要はあるのか?\r\n * やはり移動がイメージしやすいかな。\r\n * Player, Enemy 共に Position は持つが、それをキー入力で更新するのか、AI で更新するのかは異なる。\r\n */\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LBehavior = exports.onGrounded = exports.onEffectResult = exports.onDirectAttackDamaged = exports.onAttackReaction = exports.onProceedFloorReaction = exports.onPerformStepFeetProcess = exports.onPreStepFeetProcess = exports.onPreStepFeetProcess_Actor = exports.onWalkedOnTopReaction = exports.onWalkedOnTopAction = exports.onMoveAsProjectile = exports.onThrowReaction = exports.onPreThrowReaction = exports.LGenerateDropItemCause = exports.LBehaviorGroup = exports.DecisionPhase = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ../../system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst LObject_1 = __webpack_require__(/*! ../LObject */ \"./ts/mr/lively/LObject.ts\");\r\nconst LEventServer_1 = __webpack_require__(/*! ../LEventServer */ \"./ts/mr/lively/LEventServer.ts\");\r\nvar DecisionPhase;\r\n(function (DecisionPhase) {\r\n //Prepare,\r\n DecisionPhase[DecisionPhase[\"Manual\"] = 0] = \"Manual\";\r\n DecisionPhase[DecisionPhase[\"AIMinor\"] = 1] = \"AIMinor\";\r\n DecisionPhase[DecisionPhase[\"UpdateState\"] = 2] = \"UpdateState\";\r\n DecisionPhase[DecisionPhase[\"ResolveAdjacentAndMovingTarget\"] = 3] = \"ResolveAdjacentAndMovingTarget\";\r\n DecisionPhase[DecisionPhase[\"AIMajor\"] = 4] = \"AIMajor\";\r\n})(DecisionPhase = exports.DecisionPhase || (exports.DecisionPhase = {}));\r\nvar LBehaviorGroup;\r\n(function (LBehaviorGroup) {\r\n LBehaviorGroup[LBehaviorGroup[\"Underlying\"] = 0] = \"Underlying\";\r\n LBehaviorGroup[LBehaviorGroup[\"SpecialAbility\"] = 1] = \"SpecialAbility\";\r\n})(LBehaviorGroup = exports.LBehaviorGroup || (exports.LBehaviorGroup = {}));\r\nvar LGenerateDropItemCause;\r\n(function (LGenerateDropItemCause) {\r\n LGenerateDropItemCause[LGenerateDropItemCause[\"Dead\"] = 0] = \"Dead\";\r\n LGenerateDropItemCause[LGenerateDropItemCause[\"Stumble\"] = 1] = \"Stumble\";\r\n})(LGenerateDropItemCause = exports.LGenerateDropItemCause || (exports.LGenerateDropItemCause = {}));\r\n;\r\nexports.onPreThrowReaction = Symbol(\"onPreThrowReaction\");\r\nexports.onThrowReaction = Symbol(\"onThrowReaction\");\r\nexports.onMoveAsProjectile = Symbol(\"onMoveAsProjectile\");\r\nexports.onWalkedOnTopAction = Symbol(\"onWalkedOnTopAction\");\r\nexports.onWalkedOnTopReaction = Symbol(\"onWalkedOnTopReaction\");\r\nexports.onPreStepFeetProcess_Actor = Symbol(\"onPreStepFeetProcess_Actor\");\r\nexports.onPreStepFeetProcess = Symbol(\"onPreStepFeetProcess\");\r\nexports.onPerformStepFeetProcess = Symbol(\"onPerformStepFeetProcess\");\r\n/**\r\n * (階段など) 進まれた\r\n */\r\nexports.onProceedFloorReaction = Symbol(\"onProceedFloorReaction\");\r\n/**\r\n * 攻撃された\r\n */\r\nexports.onAttackReaction = Symbol(\"onAttackReaction\");\r\n/**\r\n * 直接攻撃がヒットし、ダメージを受けた。\r\n * - 外れたときは呼ばれない。\r\n * - ヤリなど、隣接していなくても呼ばれることがある。\r\n */\r\nexports.onDirectAttackDamaged = Symbol(\"onDirectAttackDamaged\");\r\nexports.onEffectResult = Symbol(\"onEffectResult\");\r\n/**\r\n * 接地した。\r\n *\r\n * 落下とはことなり、例えば既にアイテムがあるところに落ちようとした時は周囲タイルへ落ちていくが、\r\n * そういった落下完了までの諸々の処理が解決され、本当に地面上に着地したときに呼ばれる。\r\n */\r\nexports.onGrounded = Symbol(\"onGrounded\");\r\n/*\r\n NOTE: test** について\r\n 指定された Command を実行できるかを確認する。\r\n その際、呪いのため装備を外せない等の場合はメッセージログを通じてプレイヤーに見える形で表示する。\r\n\r\n Command の実行可否にかかわらず、test** は \"絶対に World(Entity) の状態を変えない\" 点に注意。\r\n\r\n なお、実行できる可能性のある Action を返すことが目的の queryActions() とは異なるので注意。\r\n\r\n\r\n Pass : そもそも\r\n\r\n [2020/12/28]\r\n 例えば倉庫でアイテムを移す処理で…\r\n 1. Player 側の都合を考慮して、Item が取り出せるか確認する。(呪いなど)\r\n 2. 倉庫 側の都合を考慮して、Item を格納できるか確認する。(容量など)\r\n 3. 上記双方が OK の場合、Item を移す。\r\n 1 と 2 について、倉庫側の処理で呪いの有無を判断するのは責任範囲的におかしいので、Command にしておきたい。\r\n しかし、1 と 2 の時点では実際に Item を移していいのかはわからない。確認のみにとどめたい。\r\n*/\r\n/**\r\n * Entity の動作を定義する\r\n *\r\n *\r\n */\r\nclass LBehavior extends LObject_1.LObject {\r\n /*\r\n \r\n * Entity の動作をどのように定義するべきか?\r\n * ----------\r\n *\r\n * ### Command のデフォルトハンドラとして定義する\r\n * この方法は、定義したい動作が原子的で、どのような拡張が行われたとしても「不思議のダンジョン」として共通であると考えられる場合に選択する。\r\n * 例えば、次のようなものが考えられる。\r\n * - 隣接タイルへの移動\r\n * - スキルの発動\r\n *\r\n * ### Behavior として定義する\r\n *\r\n *\r\n * [2023/5/8] Behavior vs Trait\r\n * ----------\r\n * 再三考え直してるけど、やっぱり気になるのは DBehavior と DTrait という似たデータが分かれていること。\r\n *\r\n * もし統合する場合、 DTrait によって LBehavior を作る・作らないを決めることになる。\r\n *\r\n * でも…\r\n *\r\n * equippedTraits() や charmedTraits() のような、付け外しが可能なものもある。\r\n * こういったものも Behavior の仲間にしてしまうと、装備の付け外しに応じて、 LBehavior の付け外しも行う必要がある。\r\n * あるいは、装備品 Entity 側に equippedBehaviors 等、State と同じように親 Entity に影響する Behavior を作る必要がある。\r\n * …でも、これはこれでその方が自然かもしれない。\r\n *\r\n * Skyrim MOD 的に言えば、 Behavior は スクリプト(とその中の変数) に相当する。\r\n * Entity の拡張をサポートする重要な機能である。 LBehavior 自体を無くすのは難しい。\r\n *\r\n * よくある ECS の Component(変数) System(処理) に分ける手もあるが、開発初期に試したように、\r\n * これはこれで直感的ではなくなってしまう。\r\n *\r\n * そういう意味で、今の LBehavior の立ち位置は「丁度良い」ともいえる。\r\n *\r\n * 心配しているのは、何か明確な線引きが無いことで、将来的にふわふわと仕様が揺れてしまうこと。\r\n *\r\n * 例えば今、「壺割れず」と「すいだし」を作ろうとしている。これはどうするべきだろう?\r\n * LCrackedBehaviorは Behavior にする必要があるのか?\r\n * CrackedTrait と Command のデフォルト動作で実装してもよいのでは?\r\n * → よい。良いのだが、関連するコマンドを離れたところに定義することになるので、超密結合になる。\r\n * 影響調査などもやりづらい。\r\n * とすると、「機能」としてイメージしやすい単位で Behavior を作るのが良いのかもしれない。\r\n *\r\n * 「機能」の粒度は?\r\n * これも様々なので、一概には言えない。実装を続ける中で細分化することもある。\r\n * そうすると最初にがっつり方針を決めるのではなくて、将来的に統廃合するときの方針を考えたほうがよさそう。\r\n * と言ってもやれることは @deprecated 付けながら処理をコピーするだけになりそうだけど。\r\n * ただしセーブデータのコンバートまでやると重すぎるので、メジャーバージョンの中では古い機能は残すこと。\r\n *\r\n */\r\n constructor() {\r\n super(LObject_1.LObjectType.Behavior);\r\n this.dataId = 0;\r\n }\r\n get fullName() {\r\n return this.constructor.name;\r\n }\r\n get friendlyName() {\r\n const name = this.fullName;\r\n const index = name.indexOf(\"Behavior\");\r\n const longName = (index >= 0) ? name.substring(0, index) : name;\r\n if (longName[0] == \"L\") {\r\n return longName.substring(1);\r\n }\r\n else {\r\n return longName;\r\n }\r\n }\r\n setup(...args) {\r\n }\r\n id() {\r\n return this.__objectId();\r\n }\r\n ownerEntity() {\r\n const owner = this.parentObject();\r\n if (owner.objectType() == LObject_1.LObjectType.Ability ||\r\n owner.objectType() == LObject_1.LObjectType.State) {\r\n // Entity がフィールドに保持して参照する Object は、Entity までさかのぼって返す\r\n const owner2 = owner.parentObject();\r\n (0, Common_1.assert)(owner2.objectType() == LObject_1.LObjectType.Entity);\r\n return owner2;\r\n }\r\n else if (owner.objectType() == LObject_1.LObjectType.Entity) {\r\n return owner;\r\n }\r\n else {\r\n throw new Error();\r\n }\r\n }\r\n //--------------------------------------------------------------------------\r\n onQueryNameView(self, nameView) { }\r\n //--------------------------------------------------------------------------\r\n // Draft\r\n onGetDescriptions(descriptions) { }\r\n /**\r\n * 子オブジェクトが破棄されるなど、親オブジェクトから直ちに取り除くべき時に呼び出される。\r\n * この動作はキャンセルできないため、例えば呪い状態による装備の着脱判定などは行わず、確実に除外しなければならない。\r\n */\r\n onRemoveChild(entity) { }\r\n /**\r\n * 親オブジェクトから直ちに取り除くべき時に呼び出される。\r\n * この動作はキャンセルできないため、例えば呪い状態による装備の着脱判定などは行わず、確実に除外しなければならない。\r\n */\r\n onOwnerRemoveFromParent(owner) { }\r\n onAttached(self) { }\r\n onDetached(self) { }\r\n onInitialized(self, props) { }\r\n onEvent(cctx, eventId, args) { return LEventServer_1.LEventResult.Pass; }\r\n onPartyEvent(eventId, args) { return LEventServer_1.LEventResult.Pass; }\r\n onResetStatus(self) { }\r\n onThink(self, agent) { return SCommand_1.SPhaseResult.Pass; }\r\n //_ownerEntityId: LEntityId = { index: 0, key: 0 };\r\n //onRemoveEntityFromWhereabouts(cctx: SCommandContext, entity: LEntity): REResponse { return REResponse.Pass; }\r\n behaviorGroup() { return LBehaviorGroup.Underlying; }\r\n isCharmBehavior() { return false; }\r\n queryDisplayName() { return undefined; }\r\n queryPrefabId() { return undefined; }\r\n queryInnermostFactionId() { return undefined; }\r\n queryOutwardFactionId() { return undefined; }\r\n // Entity が Map に配置されるとき、どのレイヤーを基本とするか。\r\n // NOTE: Entity の種別等で決定できないので、フィールドで持たせている。\r\n // - やりすごし状態は、自身をアイテム化する状態異常として表現する。(やり過ごしを投げ当てる他、技によってもやり過ごし状態になる)\r\n // - アイテム擬態モンスターは正体を現しているかによってレイヤーが変わる。\r\n // - 土偶は落とすとアイテム、立てるとUnitのようにふるまう\r\n queryHomeLayer() { return undefined; }\r\n queryMinimapMarkerClass() { return undefined; }\r\n onQueryIdealParamBase(paramId, base) {\r\n return base;\r\n }\r\n onQuerySubEntities(key, result) { }\r\n //public onQueryParamMinMax(paramId: DParameterId, result: LParamMinMaxInfo): void { }\r\n onQueryPrice(result) { }\r\n // Attach されている Behavior や Attribute の状態に依存して変化する情報を取得する。\r\n // propertyId: see EntityProperties\r\n // undefined を返した場合は後続の Behavior の onQueryProperty() を呼び出し続ける。\r\n onQueryProperty(propertyId) { return undefined; }\r\n // results: index is DParameterId\r\n onQueryIdealParameterPlus(paramId) { return 0; }\r\n onQueryIdleSequelId() { return 0; }\r\n /**\r\n * この Behavior が Attach されている Entity が送信できる Action を取得する。\r\n * 例えばキャラクターはアイテムを \"拾う\" ことができる。\r\n *\r\n * 基本的に状態異常等は関係なく、その Entity が元々とれる行動を返すこと。\r\n * 例えば \"封印\" 状態であれば \"食べる\" ことはできないが、メニューから行動として\r\n * \"食べる\" を選択することはできるので、このメソッドは EatAction を返すべき。\r\n */\r\n onQueryActions(actions) { return actions; }\r\n /**\r\n * この Behavior が Attach されている Entity に対して送信できる Action を取得する。\r\n * 例えばアイテムはキャラクターに \"拾われる\" ことができる。\r\n *\r\n * こちらも onQueryActions() 同様、基本的に状態に関係なくEntity が反応できる行動を返すこと。\r\n * 例えば \"床に張り付いた聖域の巻物\" は \"拾う\" ことはできないが、メニューから行動として\r\n * \"拾う\" を選択することはできるので、このメソッドは PickAction を返すべき。\r\n *\r\n * 状況に応じて、そもそもメニューに表示したくない Action は返さないようにしてもよい。\r\n *\r\n * なお \"階段\" Entity がこのメソッドで PickAction を返すと、階段を拾うことができてしまう。\r\n */\r\n onQueryReactions(self, reactions) { }\r\n onCollectThinkingAgent(actions) { }\r\n // Game_Actor.prototype.attackAnimationId1\r\n // Game_Actor.prototype.attackAnimationId2\r\n onQueryAttackAnimationId(self, index) { return undefined; }\r\n onParamIdealPlusChanged(self, paramId, newValue, oldValue) { }\r\n onParamChanged(self, paramId, newValue, oldValue) { }\r\n /** 指定された依存パラメータの値を取得する。 */\r\n onGetDependentParameterIdealBaseValue(self, parameterId) { return undefined; }\r\n /** 指定された依存パラメータの値を設定する。 */\r\n onSetDependentParameterIdealBaseValue(self, parameterId, value) { }\r\n onRefreshConditions(self) { }\r\n // 従来ver は Command 扱いだった。\r\n // 行動決定に関係する通知は Scheduler から同期的に送られるが、\r\n // できればこれを RECommandContext.sendCommand みたいに公開したくないので個別定義にしている。\r\n // また実行内容も onAction などとは少し毛色が違うので、あえて分離してみる。\r\n onDecisionPhase(self, cctx, phase) { return SCommand_1.SPhaseResult.Pass; }\r\n *onCommand(self, cctx, cmd) { }\r\n onPreprocessActivity(cctx, activity) { return activity; }\r\n /**\r\n * onActivity が呼び出される前に呼び出されます。\r\n * Pass 以外を返した場合、activity が onActivity() に通知されることはありません。\r\n * これによって、特定の行動をキャンセルするような動作を実装できます。\r\n * 行動トークンの消費は呼び出し側で処理されます。\r\n */\r\n onPreActivity(self, cctx, actx) { return SCommand_1.SCommandResponse.Pass; }\r\n /**\r\n * Activity の処理。\r\n * [飲む] [振る] [読む] など。\r\n */\r\n onActivity(self, cctx, actx) { return SCommand_1.SCommandResponse.Pass; }\r\n /**\r\n * Activity を受ける側の処理。\r\n * [飲まれた] [振られた] [読まれた] など。\r\n */\r\n onActivityPreReaction(self, cctx, activity) { return SCommand_1.SCommandResponse.Pass; }\r\n onActivityReaction(self, cctx, activity) { return SCommand_1.SCommandResponse.Pass; }\r\n /**\r\n * @deprecated 地雷の即死効果で使用していた。今は使っていないので、折を見て削除する予定。\r\n */\r\n onPreApplyEffect(self, cctx, effect) { return SCommand_1.SCommandResponse.Pass; }\r\n /** 特定の Reaction に割り当てられている Effect を、命中判定無しで発動する。遠投の処理で使用する。 */\r\n onEmitEffect(self, cctx, actionId, subject, target, dir) { return SCommand_1.SCommandResponse.Pass; }\r\n onEffectSensed(self, cctx) { return SCommand_1.SCommandResponse.Pass; }\r\n onCollectEffector(owner, data) { }\r\n onCollectTraits(self, result) { }\r\n onCollectCharmdBehaviors(self, result) { }\r\n /** 主に AI 行動決定用に、スキルの一覧を取得する */\r\n onCollectSkillActions(result) { }\r\n *onCollectFieldEffect(self) { }\r\n onPostMakeSkillActions(candidates) { }\r\n onAfterStep(self, cctx) { return SCommand_1.SCommandResponse.Pass; }\r\n /** 1行動消費単位の終了時点 */\r\n onStepEnd(cctx) { return SCommand_1.SCommandResponse.Pass; }\r\n onStabilizeSituation(self, cctx) { return SCommand_1.SCommandResponse.Pass; }\r\n /**\r\n * 完全な死亡状態となった。\r\n * 復活草などの発動判定が行われた後、救いようが無くゲームオーバーとなった状態で、このハンドラが呼ばれたら復活してはならない。\r\n * 戦闘不能エフェクトやドロップアイテムの処理をオーバーライドできる。\r\n */\r\n onPermanentDeath(self, cctx) { return SCommand_1.SCommandResponse.Pass; }\r\n onPertyChanged(self) { }\r\n onEnteredMap(self, map) { }\r\n onTalk(self, cctx, person) { return SCommand_1.SCommandResponse.Pass; }\r\n onGenerateDropItems(self, cause, result) { }\r\n /** EffectBehavior で狙われたとき。効果を防止するには Cancel を返す。 */\r\n onPreviewRejection(self, cctx, rejection) { return SCommand_1.SCommandResponse.Pass; }\r\n onEffectPerformed(self, cctx, emittor) { return SCommand_1.SCommandResponse.Pass; }\r\n onCounterAction(self, cctx, data) { return SCommand_1.SCommandResponse.Pass; }\r\n //--------------------\r\n onCheckLooksLikeItem() { return false; }\r\n onCheckLooksLikeGold() { return false; }\r\n}\r\nexports.LBehavior = LBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/behaviors/LBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/behaviors/LCommonBehavior.ts": /*!***************************************************!*\ !*** ./ts/mr/lively/behaviors/LCommonBehavior.ts ***! \***************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LCommonBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LCommonBehavior = void 0;\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LBehavior_1 = __webpack_require__(/*! ./LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst USearch_1 = __webpack_require__(/*! ts/mr/utility/USearch */ \"./ts/mr/utility/USearch.ts\");\r\nconst SEmittorPerformer_1 = __webpack_require__(/*! ts/mr/system/SEmittorPerformer */ \"./ts/mr/system/SEmittorPerformer.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\n/**\r\n * 全 Entity に共通するもの。\r\n *\r\n * ひとまず、一般的ではないかもしれないけど、検証用途や一時的にここに機能を置くこともある。\r\n * というか現状何が本当に必要なのか不透明な状態なので、あるていど機能のまとまりが見えてきたら派生クラス作って分離していく。\r\n */\r\nlet LCommonBehavior = LCommonBehavior_1 = class LCommonBehavior extends LBehavior_1.LBehavior {\r\n constructor() {\r\n super(...arguments);\r\n this.reservedCounterActionIndex = -1;\r\n }\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LCommonBehavior_1);\r\n return b;\r\n }\r\n onQueryActions(actions) {\r\n return actions;\r\n }\r\n onActivity(self, cctx, actx) {\r\n const activity = actx.activity();\r\n if (activity.actionId() == MRBasics_1.MRBasics.actions.FallActionId) {\r\n const target = USearch_1.USearch.getFirstUnderFootEntity(self);\r\n if (target) {\r\n actx.postHandleActivity(cctx, target);\r\n return SCommand_1.SCommandResponse.Handled;\r\n }\r\n }\r\n return SCommand_1.SCommandResponse.Handled;\r\n }\r\n onDecisionPhase(self, cctx, phase) {\r\n if (phase == LBehavior_1.DecisionPhase.UpdateState) {\r\n for (const trait of self.traits(MRBasics_1.MRBasics.traits.SuddenSkillEffect)) {\r\n const chance = trait.value;\r\n if (cctx.random().nextIntWithMax(100) < (chance * 100)) {\r\n const skill = MRData_1.MRData.skills[trait.dataId];\r\n SEmittorPerformer_1.SEmittorPerformer.makeWithEmitor(self, self, skill.emittor())\r\n .perform(cctx);\r\n }\r\n }\r\n return SCommand_1.SPhaseResult.Pass;\r\n }\r\n return SCommand_1.SPhaseResult.Pass;\r\n }\r\n onEffectPerformed(self, cctx, emittor) {\r\n const data = self.data;\r\n if (this.reservedCounterActionIndex < 0) {\r\n for (const [i, act] of data.counterActions.entries()) {\r\n if (this.meetsCounterActionConditions(act, self._effectResult)) {\r\n this.reservedCounterActionIndex = i;\r\n break;\r\n }\r\n }\r\n }\r\n return SCommand_1.SCommandResponse.Pass;\r\n }\r\n onStabilizeSituation(self, cctx) {\r\n // 反撃相当の処理は Scheduler の特定のタイミングではなく、コマンドチェーンが完了した時に行う。\r\n // こうしないと、例えば地雷が連続で誘爆していくとき、1ステップ内で繰り返し performTrapEffect() を呼び出せない。\r\n if (this.reservedCounterActionIndex >= 0) {\r\n const data = self.data;\r\n self.iterateBehaviorsReverse(b => {\r\n return b.onCounterAction(self, cctx, data.counterActions[this.reservedCounterActionIndex]) == SCommand_1.SCommandResponse.Pass;\r\n });\r\n this.reservedCounterActionIndex = -1;\r\n }\r\n return SCommand_1.SCommandResponse.Pass;\r\n }\r\n meetsCounterActionConditions(data, effectResult) {\r\n if (data.conditionAttackType) {\r\n if (effectResult.sourceEffect) {\r\n const elementId = data.conditionAttackType;\r\n if (effectResult.sourceEffect.parameterQualifyings.find(x => x.elementIds.includes(elementId))) {\r\n return true;\r\n }\r\n }\r\n // if (effectResult.paramEffects2.find(x => x.qualifying.elementId == data.conditionAttackType)) {\r\n // return true;\r\n // }\r\n }\r\n return false;\r\n }\r\n};\r\nLCommonBehavior = LCommonBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LCommonBehavior);\r\nexports.LCommonBehavior = LCommonBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/behaviors/LCommonBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/behaviors/LCrackedBehavior.ts": /*!****************************************************!*\ !*** ./ts/mr/lively/behaviors/LCrackedBehavior.ts ***! \****************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LCrackedBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LCrackedBehavior = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LBehavior_1 = __webpack_require__(/*! ./LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\nconst LInventoryBehavior_1 = __webpack_require__(/*! ../entity/LInventoryBehavior */ \"./ts/mr/lively/entity/LInventoryBehavior.ts\");\r\nconst STask_1 = __webpack_require__(/*! ts/mr/system/tasks/STask */ \"./ts/mr/system/tasks/STask.ts\");\r\nconst UName_1 = __webpack_require__(/*! ts/mr/utility/UName */ \"./ts/mr/utility/UName.ts\");\r\nconst TDrop_1 = __webpack_require__(/*! ts/mr/transactions/TDrop */ \"./ts/mr/transactions/TDrop.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst SprinkleDropedRate = 15; // 15%\r\n/**\r\n */\r\nlet LCrackedBehavior = LCrackedBehavior_1 = class LCrackedBehavior extends LBehavior_1.LBehavior {\r\n /*\r\n */\r\n constructor() {\r\n super();\r\n }\r\n clone(newOwner) {\r\n return MRLively_1.MRLively.world.spawn(LCrackedBehavior_1);\r\n }\r\n onGetDescriptions(descriptions) {\r\n descriptions.push((0, Common_1.tr2)(\"\\\\I[160] 何かにぶつかると割れてしまう。\"));\r\n }\r\n *onCommand(self, cctx, cmd) {\r\n if (cmd instanceof SCommand_1.SEndProjectileMovingCommand) {\r\n // 壁に当たった?\r\n if (cmd.cause == SCommand_1.SEndProjectileMovingCause.NoPassage) {\r\n if (this.tryCrackeAndDropItems(cctx, self)) {\r\n yield STask_1.STaskYieldResult.Reject;\r\n }\r\n }\r\n }\r\n // 別の Entity に衝突した?\r\n if (cmd instanceof SCommand_1.SItemReactionCommand && cmd.itemActionId == MRBasics_1.MRBasics.actions.collide) {\r\n if (!this.checkProtected(self)) {\r\n cctx.postSequel(self, MRBasics_1.MRBasics.sequels.crack);\r\n cctx.postMessage((0, Common_1.tr2)(\"%1は割れた。\").format(UName_1.UName.makeNameAsItem(self)));\r\n // 格納されているアイテムをすべてぶつける\r\n const inventory = self.findEntityBehavior(LInventoryBehavior_1.LInventoryBehavior);\r\n if (inventory) {\r\n const items = inventory.items;\r\n inventory.clearItems();\r\n for (const item of items) {\r\n cctx.postCommandTask(new SCommand_1.SItemReactionCommand(MRBasics_1.MRBasics.actions.collide, item, cmd.target, [], cmd.subject, cmd.direction));\r\n }\r\n }\r\n cctx.postDestroy(self);\r\n }\r\n // 衝突した時の Effect 発動 (投げ当て1ダメージ) など、後続の処理は行いたいので、処理済みにはしない。\r\n }\r\n // 転んでバラまかれた?\r\n if (cmd instanceof SCommand_1.SSprinkleDropedCommand) {\r\n if (cctx.random().nextIntWithMax(100) < SprinkleDropedRate) {\r\n this.tryCrackeAndDropItems(cctx, self);\r\n }\r\n }\r\n }\r\n tryCrackeAndDropItems(cctx, self) {\r\n // 壺割れず?\r\n if (this.checkProtected(self))\r\n return false;\r\n cctx.postSequel(self, MRBasics_1.MRBasics.sequels.crack);\r\n cctx.postMessage((0, Common_1.tr2)(\"%1は割れた。\").format(UName_1.UName.makeNameAsItem(self)));\r\n TDrop_1.TDrop.makeFromEntityInventory(self)\r\n .withLocation(self.mx, self.my)\r\n .performe(cctx);\r\n // const inventory = self.findEntityBehavior(LInventoryBehavior);\r\n // if (inventory) {\r\n // for (const item of inventory.items) {\r\n // TDrop.dropOrDestroyEntityForce(cctx, item, self.mx, self.my);\r\n // }\r\n // }\r\n cctx.postDestroy(self);\r\n return true;\r\n }\r\n checkProtected(self) {\r\n return self.hasTrait(MRBasics_1.MRBasics.traits.StorageProtection);\r\n }\r\n};\r\nLCrackedBehavior = LCrackedBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LCrackedBehavior);\r\nexports.LCrackedBehavior = LCrackedBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/behaviors/LCrackedBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/behaviors/LDecisionBehavior.ts": /*!*****************************************************!*\ !*** ./ts/mr/lively/behaviors/LDecisionBehavior.ts ***! \*****************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LDecisionBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LDecisionBehavior = void 0;\r\nconst SPlayerDialog_1 = __webpack_require__(/*! ts/mr/system/dialogs/SPlayerDialog */ \"./ts/mr/system/dialogs/SPlayerDialog.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ../../system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst LBehavior_1 = __webpack_require__(/*! ./LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LUnitBehavior_1 = __webpack_require__(/*! ./LUnitBehavior */ \"./ts/mr/lively/behaviors/LUnitBehavior.ts\");\r\nconst UMovement_1 = __webpack_require__(/*! ts/mr/utility/UMovement */ \"./ts/mr/utility/UMovement.ts\");\r\nconst LActivity_1 = __webpack_require__(/*! ../activities/LActivity */ \"./ts/mr/lively/activities/LActivity.ts\");\r\nconst LStandardAI_1 = __webpack_require__(/*! ../ai/LStandardAI */ \"./ts/mr/lively/ai/LStandardAI.ts\");\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst LCommon_1 = __webpack_require__(/*! ../LCommon */ \"./ts/mr/lively/LCommon.ts\");\r\nconst LRouteSearch_1 = __webpack_require__(/*! ../helpers/LRouteSearch */ \"./ts/mr/lively/helpers/LRouteSearch.ts\");\r\nconst PluginParameters_1 = __webpack_require__(/*! ts/mr/PluginParameters */ \"./ts/mr/PluginParameters.ts\");\r\nconst LThinkingAgent_Standard_1 = __webpack_require__(/*! ../ai2/LThinkingAgent_Standard */ \"./ts/mr/lively/ai2/LThinkingAgent_Standard.ts\");\r\n/**\r\n * Scheduler から通知された各タイミングにおいて、行動決定を行う Behavior.\r\n *\r\n * この Behavior は標準的な行動決定のみ行う。\r\n * 状態異常による行動制限(&経過ターンのデクリメント)・暴走は、状態異常の Behavior 側で onDecisionPhase() をフックして実装する。\r\n */\r\nlet LDecisionBehavior = LDecisionBehavior_1 = class LDecisionBehavior extends LBehavior_1.LBehavior {\r\n constructor() {\r\n super(...arguments);\r\n this._characterAI = new LStandardAI_1.LCharacterAI_Normal();\r\n this._thinkingAgent = new LThinkingAgent_Standard_1.LThinkingAgent_Standard();\r\n }\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LDecisionBehavior_1);\r\n b._characterAI = this._characterAI.clone();\r\n return b;\r\n }\r\n characterAI() {\r\n return this._characterAI;\r\n }\r\n onCollectThinkingAgent(actions) {\r\n actions.push(this._thinkingAgent);\r\n }\r\n onDecisionPhase(self, cctx, phase) {\r\n if (phase == LBehavior_1.DecisionPhase.Manual) { // TODO: Manual っていう名前が良くない気がするので直したい。\r\n const unit = self.getEntityBehavior(LUnitBehavior_1.LUnitBehavior);\r\n unit._fastforwarding = false;\r\n if (this.decideAutoMove(cctx, self, unit)) {\r\n return SCommand_1.SPhaseResult.Handled;\r\n }\r\n const dialog = new SPlayerDialog_1.SPlayerDialog();\r\n cctx.openDialog(self, dialog, false);\r\n unit.clearStraightDashing();\r\n return SCommand_1.SPhaseResult.Handled;\r\n }\r\n else if (phase == LBehavior_1.DecisionPhase.AIMinor) {\r\n if (this.forceMajorActivity) {\r\n return SCommand_1.SPhaseResult.Pass;\r\n }\r\n if (PluginParameters_1.paramUseThinkingAgent) {\r\n self.think();\r\n (0, Common_1.assert)(self.thinkingAgent);\r\n return self.thinkingAgent.executeMinorActionIfNeeded(cctx, self);\r\n }\r\n else {\r\n return this._characterAI.thinkMoving(cctx, self);\r\n }\r\n }\r\n else if (phase == LBehavior_1.DecisionPhase.ResolveAdjacentAndMovingTarget) {\r\n // 後続をブロックする理由はない\r\n return SCommand_1.SPhaseResult.Pass;\r\n }\r\n else if (phase == LBehavior_1.DecisionPhase.AIMajor) {\r\n if (this.forceMajorActivity) {\r\n cctx.postActivity(this.forceMajorActivity);\r\n return SCommand_1.SPhaseResult.Handled;\r\n }\r\n if (PluginParameters_1.paramUseThinkingAgent) {\r\n if (self.thinkingAgent) {\r\n return self.thinkingAgent.executeMajorActionIfNeeded(cctx, self);\r\n }\r\n else {\r\n // 仮眠状態の Enemy が起きた場合、ステート側の onDecisionPhase で Minor がハンドルされた後、Major に飛んでくることがある。\r\n return SCommand_1.SPhaseResult.Pass;\r\n }\r\n }\r\n else {\r\n return this._characterAI.thinkAction(cctx, self);\r\n }\r\n }\r\n return SCommand_1.SPhaseResult.Pass;\r\n }\r\n decideAutoMove(cctx, self, unit) {\r\n if (unit.dashInfo) {\r\n let dir = self.dir;\r\n if (unit.dashInfo.targetX !== undefined && unit.dashInfo.targetY !== undefined) {\r\n if (self.mx == unit.dashInfo.targetX && self.my == unit.dashInfo.targetY) {\r\n return false; // 到達済み\r\n }\r\n let d = LRouteSearch_1.LRouteSearch.findDirectionTo(MRLively_1.MRLively.mapView.currentMap, self, self.mx, self.my, unit.dashInfo.targetX, unit.dashInfo.targetY);\r\n if (d) {\r\n dir = d;\r\n }\r\n }\r\n if (UMovement_1.UMovement.checkDashStopBlock(self, dir, unit.dashInfo.type)) {\r\n cctx.postActivity(LActivity_1.LActivity.makeMoveToAdjacent(self, dir)\r\n .withEntityDirection(dir)\r\n .withConsumeAction(LCommon_1.LActionTokenConsumeType.MinorActed));\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n};\r\nLDecisionBehavior = LDecisionBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LDecisionBehavior);\r\nexports.LDecisionBehavior = LDecisionBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/behaviors/LDecisionBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/behaviors/LEnemyBehavior.ts": /*!**************************************************!*\ !*** ./ts/mr/lively/behaviors/LEnemyBehavior.ts ***! \**************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LEnemyBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LEnemyBehavior = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst DSpawner_1 = __webpack_require__(/*! ts/mr/data/DSpawner */ \"./ts/mr/data/DSpawner.ts\");\r\nconst SEntityFactory_1 = __webpack_require__(/*! ts/mr/system/SEntityFactory */ \"./ts/mr/system/SEntityFactory.ts\");\r\nconst USpawner_1 = __webpack_require__(/*! ts/mr/utility/USpawner */ \"./ts/mr/utility/USpawner.ts\");\r\nconst internal_1 = __webpack_require__(/*! ../internal */ \"./ts/mr/lively/internal.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LBattlerBehavior_1 = __webpack_require__(/*! ./LBattlerBehavior */ \"./ts/mr/lively/behaviors/LBattlerBehavior.ts\");\r\nconst LInventoryBehavior_1 = __webpack_require__(/*! ../entity/LInventoryBehavior */ \"./ts/mr/lively/entity/LInventoryBehavior.ts\");\r\n/**\r\n */\r\nlet LEnemyBehavior = LEnemyBehavior_1 = class LEnemyBehavior extends LBattlerBehavior_1.LBattlerBehavior {\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LEnemyBehavior_1);\r\n return b;\r\n }\r\n constructor() {\r\n super();\r\n }\r\n onAttached(self) {\r\n super.onAttached(self);\r\n self.recoverAll();\r\n }\r\n enemyData() {\r\n const entity = this.ownerEntity().data;\r\n (0, Common_1.assert)(entity.enemy);\r\n return entity.enemy;\r\n }\r\n // Game_Enemy.prototype.paramBase\r\n onQueryIdealParamBase(paramId, base) {\r\n const param = this.enemyData().entity().idealParams[paramId];\r\n return base + ((param === undefined) ? 0 : param);\r\n }\r\n // Game_Enemy.prototype.exp\r\n exp() {\r\n return this.enemyData().exp;\r\n }\r\n onCollectTraits(self, result) {\r\n super.onCollectTraits(self, result);\r\n for (const t of this.enemyData().traits) {\r\n result.push(t);\r\n }\r\n }\r\n onCollectSkillActions(result) {\r\n super.onCollectSkillActions(result);\r\n for (const t of this.enemyData().actions) {\r\n result.push(t);\r\n }\r\n }\r\n // onPreApplyEffect(self: LEntity, cctx: SCommandContext, effect: SEffect): SCommandResponse {\r\n // const effectData = effect.data();\r\n // if (effectData.qualifyings.specialEffectQualifyings.find(x => x.code == DSpecialEffectCodes.DeadlyExplosion)) {\r\n // self.addState(REBasics.states.dead);\r\n // return SCommandResponse.Handled;\r\n // }\r\n // return SCommandResponse.Pass;\r\n // }\r\n onGenerateDropItems(self, cause, result) {\r\n const inventory = self.findEntityBehavior(LInventoryBehavior_1.LInventoryBehavior);\r\n if (inventory && inventory.hasAnyItem()) {\r\n for (const item of inventory.items) {\r\n inventory.removeEntity(item);\r\n result.push(item);\r\n }\r\n return;\r\n }\r\n if (!self._dropItemGenerated) {\r\n self._dropItemGenerated = true;\r\n const rand = MRLively_1.MRLively.world.random();\r\n switch (cause) {\r\n case internal_1.LGenerateDropItemCause.Dead:\r\n const rate = self.traitsSumOrDefault(MRBasics_1.MRBasics.traits.ItemDropRate, 0, 0.05); // そもそも ItemDrop を発生させるか率\r\n if (rand.nextIntWithMax(100) < rate * 100) {\r\n // Enemy 固有のドロップアイテム\r\n const item1 = this.selectDropItem(MRLively_1.MRLively.world.random());\r\n if (item1) {\r\n const info = DSpawner_1.DEntityCreateInfo.makeSingle(item1.entityId);\r\n info.gold = item1.gold;\r\n result.push(SEntityFactory_1.SEntityFactory.newEntity(info, self.floorId));\r\n return;\r\n }\r\n // 出現テーブルからのドロップアイテム\r\n const item2 = USpawner_1.USpawner.createItemFromSpawnTable(self.floorId, rand);\r\n if (item2) {\r\n result.push(item2);\r\n return;\r\n }\r\n }\r\n break;\r\n case internal_1.LGenerateDropItemCause.Stumble: {\r\n // 出現テーブルからのドロップアイテム\r\n const item2 = USpawner_1.USpawner.createItemFromSpawnTable(self.floorId, rand);\r\n if (item2) {\r\n result.push(item2);\r\n return;\r\n }\r\n break;\r\n }\r\n default:\r\n throw new Error(\"Unreachable.\");\r\n }\r\n }\r\n }\r\n selectDropItem(rand) {\r\n const items = this.enemyData().dropItems;\r\n const total = items.reduce((s, x) => s + x.denominator, 0);\r\n let r = rand.nextIntWithMax(total);\r\n for (const item of items) {\r\n if (r - item.denominator <= 0) {\r\n return item;\r\n }\r\n r -= item.denominator;\r\n }\r\n return undefined;\r\n }\r\n};\r\nLEnemyBehavior = LEnemyBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LEnemyBehavior);\r\nexports.LEnemyBehavior = LEnemyBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/behaviors/LEnemyBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/behaviors/LEntryPointBehavior.ts": /*!*******************************************************!*\ !*** ./ts/mr/lively/behaviors/LEntryPointBehavior.ts ***! \*******************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LEntryPointBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LEntryPointBehavior = void 0;\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst DCommon_1 = __webpack_require__(/*! ts/mr/data/DCommon */ \"./ts/mr/data/DCommon.ts\");\r\nconst LBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\nconst SEventExecutionDialog_1 = __webpack_require__(/*! ts/mr/system/dialogs/SEventExecutionDialog */ \"./ts/mr/system/dialogs/SEventExecutionDialog.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\n/**\r\n */\r\nlet LEntryPointBehavior = LEntryPointBehavior_1 = class LEntryPointBehavior extends LBehavior_1.LBehavior {\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LEntryPointBehavior_1);\r\n return b;\r\n }\r\n queryHomeLayer() {\r\n return DCommon_1.DBlockLayerKind.Ground;\r\n }\r\n onQueryReactions(self, reactions) {\r\n reactions.splice(0);\r\n reactions.push({ actionId: MRBasics_1.MRBasics.actions.BackwardFloorActionId });\r\n }\r\n [LBehavior_1.onProceedFloorReaction](args, cctx) {\r\n const entity = args.self;\r\n cctx.openDialog(entity, new SEventExecutionDialog_1.SEventExecutionDialog(entity.rmmzEventId, entity, entity), false);\r\n return SCommand_1.SCommandResponse.Handled;\r\n }\r\n};\r\nLEntryPointBehavior = LEntryPointBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LEntryPointBehavior);\r\nexports.LEntryPointBehavior = LEntryPointBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/behaviors/LEntryPointBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/behaviors/LEquipmentBehavior.ts": /*!******************************************************!*\ !*** ./ts/mr/lively/behaviors/LEquipmentBehavior.ts ***! \******************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LEquipmentBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LEquipmentBehavior = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst STask_1 = __webpack_require__(/*! ts/mr/system/tasks/STask */ \"./ts/mr/system/tasks/STask.ts\");\r\nconst LEntity_1 = __webpack_require__(/*! ../entity/LEntity */ \"./ts/mr/lively/entity/LEntity.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LBehavior_1 = __webpack_require__(/*! ./LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\nconst LEquipmentUserBehavior_1 = __webpack_require__(/*! ./LEquipmentUserBehavior */ \"./ts/mr/lively/behaviors/LEquipmentUserBehavior.ts\");\r\nconst LInventoryBehavior_1 = __webpack_require__(/*! ../entity/LInventoryBehavior */ \"./ts/mr/lively/entity/LInventoryBehavior.ts\");\r\nconst LItemBehavior_1 = __webpack_require__(/*! ./LItemBehavior */ \"./ts/mr/lively/behaviors/LItemBehavior.ts\");\r\nlet LEquipmentBehavior = LEquipmentBehavior_1 = class LEquipmentBehavior extends LBehavior_1.LBehavior {\r\n /*\r\n [2021/10/7] 錆スキルなど、ある Entity が内包(装備やインベントリなど)している Entity に対して効果を発揮するスキルはどう実装する?\r\n ----------\r\n これもスキルと効果は別に定義したほうがいいかも。\r\n ```\r\n 錆スキル ← Unit を対象としたスキル\r\n ┗武器さび ← Item を対象とした効果\r\n ┗盾さび ← Item を対象とした効果\r\n ```\r\n 懸念しているのは、対象を選択する条件の複雑さ。\r\n - 装備のみ対象とするか、イベントり全体か\r\n - 部位指定\r\n - 種類指定\r\n - 同一部位 (腕輪2つ装備できる場合) 全部か1つか\r\n - 特定印を持つアイテムを優先するか\r\n パッと思いつくだけでこのくらいある。\r\n これに加えて、\r\n - どのパラメータを対象とするか\r\n - 増減量\r\n - 振れ幅\r\n - ダメージ種類\r\n 等、[ダメージ]欄で指定できるようなもの。\r\n 場合によっては[特殊効果]も必要になる。装備しているものを呪う(呪いステート付加)など。\r\n\r\n 対象選択条件は、und のkindフィルタのように文字列を並べる方式にせざるを得ないかも。\r\n フィールドを細かく指定しても、Note 欄が長くなってしまう。\r\n\r\n ```\r\n \r\n \r\n ```\r\n\r\n ### どこまで Node で頑張るのか?\r\n\r\n - パラメータを変更するもの\r\n - ステートを操作するもの\r\n - 特定ステートにかかっていないものに対して、ステートを追加したい\r\n - 特定ステートがかかっているものに対して、パラメータを操作したい (重篤化みたいな)\r\n\r\n これだけを想定することにしてみる。\r\n 盗んでワープなど、具体的な行動を伴うものは Behavior で実装する。\r\n\r\n ### フィルタキー\r\n\r\n 以下は最低限必要かも。\r\n - 対象の存在している場所 (Equipment, Inventory など。基本的には Behavior の名前) …ネストは考えなくていいだろう。ありえなくはないが、現状思いつかないし、そこまで凝ったことにこのシステムを使うか?というのもある。やるとしたら Inventory-XXXXとか\r\n - 対象の種類\r\n - 対象のステート (追加されている・されていない)\r\n 種類については、大項目とタグで求めるのがいいかもしれない。\r\n\r\n 種類…というか分類?については現時点では仕様が固まっていない。\r\n ので、「タグ」という任意の分類方法を指定できるようにしてみたい。\r\n\r\n その他\r\n - 個数制限\r\n\r\n 効果のある奴だけ自動選択したい。\r\n たとえば錆スキルでは対象は当然 UpgradeValue を持つものだけ。\r\n そういったものをあえてフィルタキーで指定させるのは多重管理的な感じにもなり良くない気がする。\r\n\r\n\r\n\r\n\r\n\r\n\r\n */\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LEquipmentBehavior_1);\r\n return b;\r\n }\r\n onAttached(self) {\r\n (0, Common_1.assert)(self.findEntityBehavior(LItemBehavior_1.LItemBehavior));\r\n const data = self.data;\r\n if (data.upgradeMax > 0) {\r\n self.params.acquireParam(MRBasics_1.MRBasics.params.upgradeValue);\r\n }\r\n }\r\n onQueryReactions(self, reactions) {\r\n if (self.parentAs(LInventoryBehavior_1.LInventoryBehavior)) {\r\n reactions.push({ actionId: MRBasics_1.MRBasics.actions.EquipActionId });\r\n reactions.push({ actionId: MRBasics_1.MRBasics.actions.EquipOffActionId });\r\n }\r\n }\r\n onOwnerRemoveFromParent(owner) {\r\n if (!(owner instanceof LEntity_1.LEntity))\r\n return;\r\n const inventory = owner.parentObject();\r\n if (inventory instanceof LInventoryBehavior_1.LInventoryBehavior) {\r\n const unit = inventory.ownerEntity();\r\n const behavior = unit.getEntityBehavior(LEquipmentUserBehavior_1.LEquipmentUserBehavior);\r\n if (behavior.isEquipped(owner)) {\r\n const removed = behavior.removeEquitment(this.ownerEntity());\r\n (0, Common_1.assert)(removed);\r\n }\r\n }\r\n }\r\n *onCommand(self, cctx, cmd) {\r\n if (cmd instanceof SCommand_1.STestTakeItemCommand) {\r\n if (self.isCursed()) {\r\n cctx.postMessage((0, Common_1.tr2)(\"呪われている!\"));\r\n yield STask_1.STaskYieldResult.Reject;\r\n }\r\n }\r\n }\r\n};\r\nLEquipmentBehavior = LEquipmentBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LEquipmentBehavior);\r\nexports.LEquipmentBehavior = LEquipmentBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/behaviors/LEquipmentBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/behaviors/LEquipmentUserBehavior.ts": /*!**********************************************************!*\ !*** ./ts/mr/lively/behaviors/LEquipmentUserBehavior.ts ***! \**********************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LEquipmentUserBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LEquipmentUserBehavior = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ts/mr/system/MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst LObject_1 = __webpack_require__(/*! ../LObject */ \"./ts/mr/lively/LObject.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LBehavior_1 = __webpack_require__(/*! ./LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\nconst SSoundManager_1 = __webpack_require__(/*! ts/mr/system/SSoundManager */ \"./ts/mr/system/SSoundManager.ts\");\r\nconst UIdentify_1 = __webpack_require__(/*! ts/mr/utility/UIdentify */ \"./ts/mr/utility/UIdentify.ts\");\r\nconst UName_1 = __webpack_require__(/*! ts/mr/utility/UName */ \"./ts/mr/utility/UName.ts\");\r\nconst LEventServer_1 = __webpack_require__(/*! ../LEventServer */ \"./ts/mr/lively/LEventServer.ts\");\r\n/**\r\n * 装備アイテムを装備できる人。\r\n *\r\n * LInventoryBehavior が必須。\r\n * 装備アイテムは LInventoryBehavior が持っているものを参照する。\r\n * この Behavior が装備アイテムEntity の親になることは無い。\r\n */\r\nlet LEquipmentUserBehavior = LEquipmentUserBehavior_1 = class LEquipmentUserBehavior extends LBehavior_1.LBehavior {\r\n constructor() {\r\n super();\r\n this._slots = [];\r\n this._shortcutItemEntityId = LObject_1.LEntityId.makeEmpty();\r\n this._revisitonNumber = 0;\r\n }\r\n onAttached(self) {\r\n MRLively_1.MRLively.eventServer.subscribe(MRBasics_1.MRBasics.events.itemRemovedFromInventory, this);\r\n }\r\n onDetached(self) {\r\n MRLively_1.MRLively.eventServer.unsubscribe(MRBasics_1.MRBasics.events.itemRemovedFromInventory, this);\r\n }\r\n onEvent(cctx, eventId, args) {\r\n if (eventId == MRBasics_1.MRBasics.events.itemRemovedFromInventory) {\r\n this.onRemoveItemFromInventory(args.item);\r\n }\r\n return LEventServer_1.LEventResult.Pass;\r\n }\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LEquipmentUserBehavior_1);\r\n throw new Error(\"Not implemented.\"); // TODO: コピーされたインベントリから参照しないとダメでは?\r\n return b;\r\n }\r\n isEquipped(item) {\r\n const entityId = item.entityId();\r\n return this._slots.findIndex(part => part.itemEntityId.equals(entityId)) >= 0;\r\n }\r\n isShortcutEquipped(item) {\r\n return this._shortcutItemEntityId.equals(item.entityId());\r\n }\r\n // public get hasShortcut(): boolean {\r\n // return this._shortcutItemEntityId.hasAny();\r\n // }\r\n get shortcutItem() {\r\n if (this._shortcutItemEntityId.hasAny()) {\r\n return MRLively_1.MRLively.world.entity(this._shortcutItemEntityId);\r\n }\r\n return undefined;\r\n }\r\n equippedItemEntities() {\r\n const result = [];\r\n for (const part of this._slots) {\r\n if (part.itemEntityId.hasAny()) {\r\n result.push(MRLively_1.MRLively.world.entity(part.itemEntityId));\r\n }\r\n }\r\n return result;\r\n }\r\n revisitonNumber() {\r\n return this._revisitonNumber;\r\n }\r\n onQuerySubEntities(key, result) {\r\n if (key.path == \"Equipped\") {\r\n for (const item of this.equippedItemEntities()) {\r\n if (key.kindId) {\r\n if (key.kindId == item.kindDataId()) {\r\n result.push(item);\r\n }\r\n }\r\n else {\r\n result.push(item);\r\n }\r\n }\r\n }\r\n }\r\n // item が持つ paramId の増減量を計算する。\r\n // ステータスウィンドウの表示でも使うので、ここでは熟練度は考慮しない。\r\n static calcEquipmentParam(item, paramId) {\r\n const data = item.data;\r\n const equipmentData = data.equipment;\r\n if (equipmentData) {\r\n const upgrade = item.getActualParam(MRBasics_1.MRBasics.params.upgradeValue);\r\n const ep = equipmentData.parameters[paramId];\r\n if (ep) {\r\n return (ep.value + (upgrade * ep.upgradeRate));\r\n }\r\n else {\r\n // 最大TPなど、RMMZ 標準では存在しないパラメータに対して要求が来ることもあるので、その場合はなにもしない\r\n return 0;\r\n }\r\n }\r\n else {\r\n return 0;\r\n }\r\n }\r\n onQueryProperty(propertyId) {\r\n if (propertyId == MRSystem_1.MRSystem.properties.equipmentSlots) {\r\n // TODO: とりあえず全部有効にして返してみる\r\n return MRData_1.MRData.equipmentParts\r\n .filter(x => x.id != 0)\r\n .map((x) => x.id);\r\n }\r\n else\r\n super.onQueryProperty(propertyId);\r\n }\r\n // Game_Actor.prototype.paramPlus\r\n onQueryIdealParameterPlus(paramId) {\r\n const self = this.ownerEntity();\r\n const a = this.equippedItemEntities().reduce((r, e) => {\r\n const proficiency = self.traitsPi(MRBasics_1.MRBasics.traits.EquipmentProficiency, e.kindDataId());\r\n return r + LEquipmentUserBehavior_1.calcEquipmentParam(e, paramId) * proficiency;\r\n }, 0);\r\n return a;\r\n }\r\n onQueryActions(actions) {\r\n actions.push(MRBasics_1.MRBasics.actions.EquipActionId);\r\n actions.push(MRBasics_1.MRBasics.actions.EquipOffActionId);\r\n return actions;\r\n }\r\n onQueryAttackAnimationId(self, index) {\r\n if (index == 0) {\r\n for (const item of this.equippedItemEntities()) {\r\n if (item.data.equipment) {\r\n return item.data.equipment.targetRmmzAnimationId;\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n onCollectTraits(self, result) {\r\n super.onCollectTraits(self, result);\r\n for (const entity of this.equippedItemEntities()) {\r\n for (const trait of entity.data.equippedTraits()) {\r\n result.push(trait);\r\n }\r\n }\r\n }\r\n onActivity(self, cctx, actx) {\r\n const activity = actx.activity();\r\n if (activity.actionId() == MRBasics_1.MRBasics.actions.EquipActionId) {\r\n this.refreshSlots();\r\n const itemEntity = activity.object();\r\n (0, Common_1.assert)(itemEntity);\r\n const equipment = itemEntity.data.equipment;\r\n if (equipment) {\r\n // 武器、盾などの通常の装備アイテム\r\n const itemPart = equipment.equipmentPart;\r\n (0, Common_1.assert)(itemPart > 0);\r\n // まず空きが無いか調べてみる\r\n let slot = this._slots.find(x => x.partId == itemPart && x.itemEntityId.isEmpty());\r\n if (slot) {\r\n // 空きがあればそのまま装備\r\n this.equipOn(cctx, self, slot, itemEntity);\r\n }\r\n else {\r\n // 空きが無ければ交換対象を探す\r\n slot = this._slots.find(x => x.partId == itemPart);\r\n if (slot) {\r\n const localSlot = slot;\r\n // まずは外す\r\n this.postEquipOff(cctx, self, MRLively_1.MRLively.world.entity(localSlot.itemEntityId))\r\n .then2(c => {\r\n // 外せたら装備する\r\n this.equipOn(cctx, self, localSlot, itemEntity);\r\n });\r\n }\r\n else {\r\n // ここまでで slot が見つからなければ装備不可能\r\n cctx.postMessage((0, Common_1.tr2)(\"%1 は装備できない。\").format(UName_1.UName.makeNameAsItem(itemEntity)));\r\n }\r\n }\r\n }\r\n else {\r\n // 装備アイテムではないものを装備しようとしたときはショートカットに登録する\r\n this.equipOnShortcut(cctx, itemEntity);\r\n }\r\n return SCommand_1.SCommandResponse.Handled;\r\n }\r\n else if (activity.actionId() == MRBasics_1.MRBasics.actions.EquipOffActionId) {\r\n const itemEntity = activity.object();\r\n if (this._shortcutItemEntityId.equals(itemEntity.entityId())) {\r\n this.equipOffShortcut(cctx, itemEntity);\r\n }\r\n else {\r\n this.postEquipOff(cctx, self, itemEntity);\r\n }\r\n return SCommand_1.SCommandResponse.Handled;\r\n }\r\n return SCommand_1.SCommandResponse.Pass;\r\n }\r\n // テスト用ユーティリティ\r\n equipOnUtil(itemEntity) {\r\n this.refreshSlots();\r\n const equipment = itemEntity.data.equipment;\r\n (0, Common_1.assert)(equipment);\r\n const itemPart = equipment.equipmentPart;\r\n // let slot = this._slots.find(x => x.partId == itemPart && x.itemEntityId.isEmpty());\r\n const slot = this._slots.find(x => x.partId == itemPart);\r\n (0, Common_1.assert)(slot);\r\n slot.itemEntityId = itemEntity.entityId();\r\n this.ownerEntity().refreshConditions();\r\n }\r\n equipOn(cctx, self, slot, itemEntity) {\r\n slot.itemEntityId = itemEntity.entityId();\r\n this.ownerEntity().refreshConditions();\r\n UIdentify_1.UIdentify.identifyByTiming(cctx, self, itemEntity, MRBasics_1.MRBasics.actions.EquipActionId, false);\r\n SSoundManager_1.SSoundManager.playEquip();\r\n cctx.postMessage((0, Common_1.tr2)(\"%1 を装備した。\").format(UName_1.UName.makeNameAsItem(itemEntity)));\r\n if (itemEntity.isCursed()) {\r\n cctx.postMessage((0, Common_1.tr2)(\"呪われていた!\"));\r\n }\r\n this.onEquipmentChanged(self);\r\n }\r\n postEquipOff(cctx, self, itemEntity) {\r\n return cctx.postCommandTask(new SCommand_1.STestTakeItemCommand(itemEntity, self))\r\n .then2(c => {\r\n const removed = this.removeEquitment(itemEntity);\r\n if (removed) {\r\n SSoundManager_1.SSoundManager.playEquip();\r\n cctx.postMessage((0, Common_1.tr2)(\"%1 をはずした。\").format(UName_1.UName.makeNameAsItem(itemEntity)));\r\n }\r\n else {\r\n cctx.postMessage((0, Common_1.tr2)(\"何も起こらなかった。\"));\r\n }\r\n this.onEquipmentChanged(self);\r\n });\r\n }\r\n removeEquitment(itemEntity) {\r\n for (const slot of this._slots) {\r\n if (slot.itemEntityId.hasAny() && slot.itemEntityId.equals(itemEntity.entityId())) {\r\n slot.itemEntityId = LObject_1.LEntityId.makeEmpty();\r\n this._revisitonNumber++;\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n removeShortcut(itemEntity) {\r\n if (this._shortcutItemEntityId.hasAny() && this._shortcutItemEntityId.equals(itemEntity.entityId())) {\r\n this._shortcutItemEntityId = LObject_1.LEntityId.makeEmpty();\r\n return true;\r\n }\r\n return false;\r\n }\r\n equipOnShortcut(cctx, item) {\r\n this._shortcutItemEntityId = item.entityId();\r\n SSoundManager_1.SSoundManager.playEquip();\r\n cctx.postMessage((0, Common_1.tr2)(\"%1 を装備した。\").format(UName_1.UName.makeNameAsItem(item)));\r\n }\r\n equipOffShortcut(cctx, itemEntity) {\r\n if (this._shortcutItemEntityId.equals(itemEntity.entityId())) {\r\n SSoundManager_1.SSoundManager.playEquip();\r\n cctx.postMessage((0, Common_1.tr2)(\"%1 をはずした。\").format(UName_1.UName.makeNameAsItem(itemEntity)));\r\n this._shortcutItemEntityId = LObject_1.LEntityId.makeEmpty();\r\n }\r\n }\r\n onRemoveItemFromInventory(item) {\r\n if (item.entityId().equals(this._shortcutItemEntityId)) {\r\n this._shortcutItemEntityId = LObject_1.LEntityId.makeEmpty();\r\n }\r\n else {\r\n this.removeEquitment(item);\r\n }\r\n }\r\n refreshSlots() {\r\n const entity = this.ownerEntity();\r\n const equipmentSlots = entity.queryProperty(MRSystem_1.MRSystem.properties.equipmentSlots);\r\n // 現在の状態で、Slot のリストを作る\r\n const newSlots = equipmentSlots.map(x => { return { partId: x, itemEntityId: LObject_1.LEntityId.makeEmpty() }; });\r\n // 古い Slot リストから新しい Slot リストへ、同一種類の Slot の Entity を上から順に詰め直す\r\n for (const newSlot of newSlots) {\r\n const oldSlot = this._slots.find(x => x.partId == newSlot.partId && x.itemEntityId.hasAny());\r\n if (oldSlot) {\r\n [newSlot.itemEntityId, oldSlot.itemEntityId] = [oldSlot.itemEntityId, newSlot.itemEntityId];\r\n }\r\n }\r\n this._slots = newSlots;\r\n this._revisitonNumber++;\r\n }\r\n onEquipmentChanged(self) {\r\n MRSystem_1.MRSystem.integration.onEquipmentChanged(self);\r\n }\r\n};\r\nLEquipmentUserBehavior = LEquipmentUserBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LEquipmentUserBehavior);\r\nexports.LEquipmentUserBehavior = LEquipmentUserBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/behaviors/LEquipmentUserBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/behaviors/LEscapeBehavior.ts": /*!***************************************************!*\ !*** ./ts/mr/lively/behaviors/LEscapeBehavior.ts ***! \***************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LEscapeBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LEscapeBehavior = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst PluginParameters_1 = __webpack_require__(/*! ts/mr/PluginParameters */ \"./ts/mr/PluginParameters.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst LEscapeAI_1 = __webpack_require__(/*! ../ai/LEscapeAI */ \"./ts/mr/lively/ai/LEscapeAI.ts\");\r\nconst LThinkingDeterminer_Escape_1 = __webpack_require__(/*! ../ai2/LThinkingDeterminer_Escape */ \"./ts/mr/lively/ai2/LThinkingDeterminer_Escape.ts\");\r\nconst internal_1 = __webpack_require__(/*! ../internal */ \"./ts/mr/lively/internal.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\n/**\r\n */\r\nlet LEscapeBehavior = LEscapeBehavior_1 = class LEscapeBehavior extends internal_1.LBehavior {\r\n constructor() {\r\n super();\r\n this._escapeAI = new LEscapeAI_1.LEscapeAI();\r\n this._thinking = new LThinkingDeterminer_Escape_1.LThinkingDeterminer_Escape();\r\n }\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LEscapeBehavior_1);\r\n b._thinking = this._thinking.clone();\r\n return b;\r\n }\r\n behaviorGroup() {\r\n return internal_1.LBehaviorGroup.SpecialAbility;\r\n }\r\n onDecisionPhase(self, cctx, phase) {\r\n if (!PluginParameters_1.paramUseThinkingAgent) {\r\n if (phase == internal_1.DecisionPhase.AIMinor) {\r\n this._escapeAI.thinkMoving(cctx, self);\r\n return SCommand_1.SPhaseResult.Handled;\r\n }\r\n else if (phase == internal_1.DecisionPhase.AIMajor) {\r\n this._escapeAI.thinkAction(cctx, self);\r\n return SCommand_1.SPhaseResult.Handled;\r\n }\r\n }\r\n return SCommand_1.SPhaseResult.Pass;\r\n }\r\n onThink(self, agent) {\r\n return this._thinking.onThink(agent, self);\r\n }\r\n};\r\nLEscapeBehavior = LEscapeBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LEscapeBehavior);\r\nexports.LEscapeBehavior = LEscapeBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/behaviors/LEscapeBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/behaviors/LExitPointBehavior.ts": /*!******************************************************!*\ !*** ./ts/mr/lively/behaviors/LExitPointBehavior.ts ***! \******************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LExitPointBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LExitPointBehavior = void 0;\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst LBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst SEventExecutionDialog_1 = __webpack_require__(/*! ts/mr/system/dialogs/SEventExecutionDialog */ \"./ts/mr/system/dialogs/SEventExecutionDialog.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst DCommon_1 = __webpack_require__(/*! ts/mr/data/DCommon */ \"./ts/mr/data/DCommon.ts\");\r\n/**\r\n * [2021/8/14] 「戻る」の実装について\r\n * ----------\r\n *\r\n * まず制約として、階段の外見を変更できるようにする必要がある。\r\n * これを実現する一番手っ取り早い&ツクールの仕組みで頑張るなら、スイッチによるイベントページの切り替え。\r\n * SFCトルネコでは特定アイテムの所持で方向が変わるが、これはそのままツクールのイベントの[条件]を使えばよいだろう。\r\n *\r\n *\r\n *\r\n * [2020/11/1] NOTE: Player が乗ったときの UI 表示タイミング\r\n * ----------\r\n * 乗った瞬間ではなく、乗った次のターンの Dialog 表示時である点に注意。\r\n * ただ、これはアイテムなど「あしもと」に対して行う表示と同様のシステムになりそう。\r\n * - アイテムを拾うのは手番内。\r\n * - アイテムに「のった」表示も手番内。\r\n * - お店のアイテムにのったときの UI 表示は次のターン。\r\n *\r\n * あとこれはコアシステムとして必須の機能ではなくて、ユーザビリティのための便利機能。\r\n *\r\n * Dialog 側で足元の Entty の種別をみて Window 表示とかやると、また拡張性が微妙になる。\r\n * できれば Item や階段の Behavior 側の「乗られた」Reaction で、\r\n * 「次の Player Dialog Open時に表示したいユーザビリティアクション」みたいなものを、PlayerEntity の set して実現したいところ。\r\n * set はしてるけど、次に Player が行動不能だったりしたら破棄するだけ。\r\n *\r\n * …と考えてみたが、階段上へ移動 → モンスターの吹き飛ばしで階段上以外へ移動 → そのあとは UI 表示しない といこともあるので、この対策が何か必要。\r\n *\r\n * HC4 の時に実装したリアクションコマンド形式がいいかも。\r\n * Behavior に問い合わせ用のメソッド追加する必要があるけど、Entity に対してどんなアクションをとれるか聞く仕組みがあると自然。\r\n */\r\nlet LExitPointBehavior = LExitPointBehavior_1 = class LExitPointBehavior extends LBehavior_1.LBehavior {\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LExitPointBehavior_1);\r\n return b;\r\n }\r\n queryHomeLayer() {\r\n return DCommon_1.DBlockLayerKind.Ground;\r\n }\r\n onQueryReactions(self, reactions) {\r\n reactions.splice(0);\r\n reactions.push({ actionId: MRBasics_1.MRBasics.actions.ForwardFloorActionId });\r\n }\r\n [LBehavior_1.onProceedFloorReaction](args, cctx) {\r\n const entity = args.self;\r\n cctx.openDialog(entity, new SEventExecutionDialog_1.SEventExecutionDialog(entity.rmmzEventId, entity, entity), false);\r\n return SCommand_1.SCommandResponse.Handled;\r\n }\r\n};\r\nLExitPointBehavior = LExitPointBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LExitPointBehavior);\r\nexports.LExitPointBehavior = LExitPointBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/behaviors/LExitPointBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/behaviors/LExperienceBehavior.ts": /*!*******************************************************!*\ !*** ./ts/mr/lively/behaviors/LExperienceBehavior.ts ***! \*******************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LExperienceBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LExperienceBehavior = void 0;\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\nconst LEntity_1 = __webpack_require__(/*! ../entity/LEntity */ \"./ts/mr/lively/entity/LEntity.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst LEffectResult_1 = __webpack_require__(/*! ../LEffectResult */ \"./ts/mr/lively/LEffectResult.ts\");\r\nconst DEffect_1 = __webpack_require__(/*! ts/mr/data/DEffect */ \"./ts/mr/data/DEffect.ts\");\r\nlet LExperienceBehavior = LExperienceBehavior_1 = class LExperienceBehavior extends LBehavior_1.LBehavior {\r\n /*\r\n [2021/12/14] レベルと経験値はパラメータ扱いしたほうがよい?\r\n ----------\r\n パラメータ扱いしておくと、レベルダウンや経験値取得の効果をパラメータダメージとして指定できるようになる。\r\n レベル吸収とかも。\r\n\r\n バフああんまりつけたくないかも?\r\n 一時的にレベルアップ・レベルダウンといった効果は確かに原作でもあるが…。\r\n でも本当にそれらを実装するとなったら、バフ扱いの方が都合がよい。\r\n\r\n Enemy,Actor というくくりにするよりは、\r\n \"経験値でレベルアップするBehavior\", \"経験値関係なくレベルアップするBehavior\" に分ける方が自然かも。\r\n そう考えると、Levelのバフは欲しいかもだけどExpのバフはさすがにいらないかも?\r\n いやでも経験値ダメージはありえるか…。\r\n\r\n トルネコでは、モンスターも経験値テーブルを持つ。\r\n http://gamemonster.futene.net/wonder-dungeon/wd_torneko1.html\r\n 進化はしない。\r\n\r\n Level, Exp のほかに、Evolution というパラメータを持たせたらどうだろうか。\r\n 進化レベル。普通の Level とは独立。\r\n こうしておくと、\r\n - シレン2の仲間システムが実現しやすい。\r\n - トルネコ仕様の時は Evolution を使わなければよい。\r\n 基本的な考え方はポケモンと同様。\r\n Entity は \"次に進化する Entity\" をデータとして持っておく。\r\n 対応 Level が設定されていれば、レベルアップに伴い Evolution も上昇。それによって ChangeInstance する。\r\n\r\n しあわせ草や天使の種の実装は… 条件付き効果を使う?\r\n → やめたほうがいいかも。特にシレン2では Ev が上がるのか Lv が上がるのかは勢力に依る。\r\n しあわせの杖も同様。\r\n できれば エディタから設定するのは\r\n - Lv を増減\r\n - Exp を増減\r\n - (Ev を増減)\r\n だけにして、Behavior 側でなんとか解釈を変えたいところ。\r\n\r\n でも解釈を変えるっていうのは、例えば地雷による即死効果を分けた理由と衝突しそう。\r\n そちらは、Enemy が \"爆発\" という効果を知らなければならないのは不自然だろう、という背景がある。\r\n\r\n 原作効果を整理すると…\r\n - しあわせ草・天使の種\r\n - Player: Lv アップ\r\n - Monster: Ev アップ\r\n - NPC: なにもおこらない\r\n - 店主: Lv アップ\r\n - Friend: Lv アップ または なにもおこらない (仲間によってはイベントや特定アイテムでレベルアップとかある)\r\n - Friend Monster: Lv アップ (ギャザー系は無効化)\r\n - しあわせの杖\r\n - Player: 経験値取得\r\n - Player 以外: しあわせ草と同様\r\n - 不幸の杖\r\n - Player: Lv3 ダウン\r\n - Monster: Ev1 ダウン\r\n - くねくね\r\n - Player: Lv1 ダウン\r\n - Monster: Ev1 ダウン\r\n - 教皇\r\n - Player: 一時的にレベル半分\r\n - Monster: Ev1 ダウン\r\n 仲間のレベル仕様が注意点か。どのみち Behavior 側での制御が必要になる。\r\n モンスターは勢力に依る点があるので、Trait ではカバーできない。これも Behavior の実装が必要。\r\n\r\n Behavior の実装は次のどちらかになる。\r\n A. パラメータの変化直前に、変化対象を変換する。\r\n B. \"レベル操作\" という一段抽象的な効果として受け取り、self の性質に応じて変化するパラメータを決める。\r\n\r\n A は要注意。今回のようなレベルアップ効果以外にも、イベントや経験値によるレベルアップなど、\r\n 何も対策しないと、特殊扱いしたくないケースでも同様になってしまう。\r\n → 結局 \"アイテムやスキルの効果として\" という情報の追加が必要。\r\n\r\n アイテム側の設定として上記のようなのをカバーしきるのはかなり難しい。\r\n プログラムの実装もそうだが、作ったとしてもレベル・経験値変化系のアイテム全てに個別設定しなければならない。ミスしやすかったりメンテしづらくなる。\r\n アイテム側からは基本的に Player 主観で、\r\n - レベルを 1 上げる\r\n - 経験値を 500 得る\r\n といった設定だけすればよいようにしたい。\r\n\r\n そうするとやはり EffectContext → Entity へ パラメータを設定する間をフックして処理を変えられるような Behavior のメソッドが要るだろう。\r\n ただし、経験値の取得は EffectContext を出てから行われるため、必ずしも EffectContext 内から、というわけではない。\r\n\r\n\r\n [2021/12/16] 違和感\r\n ----------\r\n - 他のパラメータは減算方式で、デフォルトは Ideal.\r\n - レベルを上げるためのパラメータ計算方式が \"回復\"\r\n - でもこれはちからの最大値を上げるのも同様。\r\n\r\n\r\n [2022/8/31] 依存パラメータという考えはどうだろうか?\r\n ----------\r\n Lv は Exp の依存パラメータと考える。\r\n Lv という値は保持せず、常に Exp から計算される。\r\n LevelUp/Down 効果は Level という依存パラメータに対して行われるが、実体は Exp の増減となる。\r\n (これは Elona の各種スキルが、魅力などのパラメータに影響してくる動作と同じ)\r\n この考え方を取ると、Lv というパラメータを持たないので、2つのパラメータの同期に関する問題がなくなる。\r\n\r\n Exp がどのように Level に影響するかは Behavior 側で決めることになるため、\r\n キホンは Lv と Exp の関係を Behavior で定義することになる。\r\n Behavior が依存パラメータの増減要求を受け取り、影響するパラメータの変更を行う。\r\n (それは上記の通り Exp かもしれないし、Lv を持たなければ効果が無いし、モンスターの場合はランクダウンかもしれない)\r\n\r\n [22/10/19] 依存パラメータLevel と Exp と依存パラメータへのバフ\r\n ----------\r\n 「一時的にレベルを下げる」系のスキルを実装できるだろうか?\r\n\r\n まず思いつくのは Level に対するバフである。これの実現自体は簡単。\r\n 問題は、その時点で Exp とどう連携するか。\r\n\r\n もし NextExp を Level の ActualValue から計算すると、デバフを食らったときに普通は 現在Exp>NextExp となってしまう。\r\n 冪等性を重視する場合、この状態を維持することはできず、即レベルアップを繰り返し、デバフ中にもかかわらずレベルが上がってしまう。\r\n\r\n Levelを依存パラメータにする/しないに関わらず、 Exp は Leven の IdealValue から計算する必要があり、\r\n LevelUp/Down は Damage として表現するのではなく、最大値(IdealBase or IdealPlus)の変更として扱う必要がある。\r\n\r\n [22/10/19] Level は依存パラメータにしちゃダメかも\r\n ----------\r\n Expを持たない、モンスターのレベルが表現できなくなる。\r\n ダミー的な ExpParam を持たせてもいいが、そんな用途の余計な情報は出来るだけ持たせたくない。\r\n\r\n\r\n\r\n\r\n */\r\n // Level は依存パラメータであり、 Exp に応じて常に変化するため「前回値」が必要な時は別途持っておく必要がある。\r\n //private _currentLevel: number;\r\n constructor() {\r\n super();\r\n //this._currentLevel = 0;\r\n }\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LExperienceBehavior_1);\r\n return b;\r\n }\r\n onAttached(self) {\r\n const params = self.params;\r\n params.acquireParam(MRBasics_1.MRBasics.params.level);\r\n params.acquireParam(MRBasics_1.MRBasics.params.exp);\r\n this.resetLevel(self);\r\n }\r\n onResetStatus(self) {\r\n this.resetLevel(self);\r\n }\r\n onParamIdealPlusChanged(self, paramId, newValue, oldValue) {\r\n if (paramId == MRBasics_1.MRBasics.params.level) {\r\n this.refreshExpFromLevel(self, newValue, oldValue);\r\n }\r\n else if (paramId == MRBasics_1.MRBasics.params.exp) {\r\n throw new Error(\"Unreachable.\");\r\n }\r\n }\r\n onParamChanged(self, paramId, newValue, oldValue) {\r\n if (paramId == MRBasics_1.MRBasics.params.level) {\r\n //throw new Error(\"Unreachable.\");\r\n }\r\n else if (paramId == MRBasics_1.MRBasics.params.exp) {\r\n this.refreshLevelFromExp(self, newValue, oldValue);\r\n }\r\n }\r\n // override onGetDependentParameterIdealBaseValue(self: LEntity, parameterId: DParameterId): number | undefined {\r\n // if (parameterId == MRBasics.params.level) {\r\n // return this._currentLevel;\r\n // }\r\n // return undefined;\r\n // }\r\n // override onSetDependentParameterIdealBaseValue(self: LEntity, parameterId: DParameterId, value: number): void {\r\n // if (parameterId == MRBasics.params.level) {\r\n // // Level -> Exp へ Backword.\r\n // self.setParamCurrentValue(MRBasics.params.exp, this.expForLevel(self, value));\r\n // }\r\n // }\r\n onRefreshConditions(self) {\r\n }\r\n resetLevel(self) {\r\n //this._currentLevel = this.actor(self).initialLevel;\r\n this.setLevel(self, this.actor(self).initialLevel);\r\n }\r\n level(self) {\r\n return self.getEffortValue(MRBasics_1.MRBasics.params.level);\r\n }\r\n // Game_Actor.prototype.currentExp\r\n currentExp(self) {\r\n return self.getActualParam(MRBasics_1.MRBasics.params.exp);\r\n }\r\n // public maxLevel(self: LEntity): number {\r\n // return this.actor(self).maxLevel;\r\n // }\r\n // for test\r\n setLevel(self, value) {\r\n value = value.clamp(1, this.maxLevel(self));\r\n self.setEffortValue(MRBasics_1.MRBasics.params.level, value);\r\n //self.setParamCurrentValue(MRBasics.params.level, value);\r\n }\r\n gainLevel(self, value) {\r\n self.setEffortValue(MRBasics_1.MRBasics.params.level, self.getEffortValue(MRBasics_1.MRBasics.params.level) + value, LEntity_1.LParamChangedAction.None);\r\n //self.gainActualParam(MRBasics.params.level, value, false);\r\n }\r\n // Game_Actor.prototype.changeLevel = function(level, show) {\r\n // this.changeExp(this.expForLevel(level), show);\r\n // };\r\n // Game_Actor.prototype.nextLevelExp\r\n nextLevelExp(self) {\r\n return this.expForLevel(self, this.level(self) + 1);\r\n }\r\n // Game_Actor.prototype.actor\r\n actor(self) {\r\n const data = self.data.actor;\r\n (0, Common_1.assert)(data);\r\n return data;\r\n }\r\n // Game_Actor.prototype.maxLevel\r\n maxLevel(self) {\r\n return this.actor(self).maxLevel;\r\n }\r\n ;\r\n // Game_Actor.prototype.isMaxLevel\r\n isMaxLevel(self) {\r\n return this.level(self) >= this.maxLevel(self);\r\n }\r\n ;\r\n currentClass(self) {\r\n const classId = self.data.classId;\r\n return MRData_1.MRData.classes[classId];\r\n }\r\n // Game_Actor.prototype.expForLevel\r\n expForLevel(self, level) {\r\n const c = this.currentClass(self);\r\n const basis = c.expParams[0];\r\n const extra = c.expParams[1];\r\n const acc_a = c.expParams[2];\r\n const acc_b = c.expParams[3];\r\n return Math.round((basis * Math.pow(level - 1, 0.9 + acc_a / 250) * level * (level + 1)) /\r\n (6 + Math.pow(level, 2) / 50 / acc_b) +\r\n (level - 1) * extra);\r\n }\r\n // Game_Actor.prototype.currentLevelExp\r\n currentLevelExp(self) {\r\n return this.expForLevel(self, this.level(self));\r\n }\r\n setExp(self, value) {\r\n self.setParamCurrentValue(MRBasics_1.MRBasics.params.exp, value);\r\n }\r\n refreshExpFromLevel(self, newLevel, oldLevel) {\r\n //this._currentLevel = newLevel;\r\n this.setExp(self, this.expForLevel(self, newLevel));\r\n }\r\n // 現在 Exp に Level をあわせる\r\n refreshLevelFromExp(self, newExp, oldExp) {\r\n if (newExp == oldExp)\r\n return;\r\n // 検証。 _lastLevel は常に exp の変動とともに更新されていなければならない。\r\n // {\r\n // const e1 = this.expForLevel(self, this._currentLevel);\r\n // const e2 = this.expForLevel(self, this._currentLevel + 1);\r\n // assert(e1 <= oldExp && oldExp < e2);\r\n // }\r\n //const oldLevel = this._currentLevel;\r\n // if (newExp > oldExp) {\r\n // // LevelUp\r\n // while (this._currentLevel < this.maxLevel(self) && newExp >= this.expForLevel(self, this._currentLevel + 1)) {\r\n // this._currentLevel++;\r\n // this.onLevelUp(self/*, oldLevel*/);\r\n // }\r\n // }\r\n // else {\r\n // // LevelDown\r\n // while (newExp < this.expForLevel(self, this._currentLevel)) {\r\n // this._currentLevel--;\r\n // this.onLevelUp(self/*, oldLevel*/);\r\n // }\r\n // }\r\n // const lastLevel = oldLevel;\r\n while (!this.isMaxLevel(self) && newExp >= this.nextLevelExp(self)) {\r\n this.onLevelUp(self /*, oldLevel*/);\r\n }\r\n while (newExp < this.currentLevelExp(self)) {\r\n this.onLevelDown(self /*, oldLevel*/);\r\n }\r\n }\r\n // Game_Actor.prototype.levelUp\r\n onLevelUp(self /*, oldLevel: number*/) {\r\n // const oldValue = self.actualParam(MRBasics.params.level);\r\n this.gainLevel(self, 1);\r\n //this.ownerEntity()._effectResult.levelup = true;\r\n const result = this.ownerEntity()._effectResult;\r\n const paramResult = new LEffectResult_1.LParamEffectResult(MRBasics_1.MRBasics.params.level);\r\n paramResult.applyTarget = DEffect_1.DValuePoint.Growth;\r\n paramResult.damage = -1;\r\n //paramResult.oldValue = oldLevel;\r\n result.paramEffects2.push(paramResult);\r\n result._revision++;\r\n //for (const learning of this.currentClass().learnings) {\r\n // if (learning.level === this._level) {\r\n // this.learnSkill(learning.skillId);\r\n // }\r\n //}\r\n }\r\n // Game_Actor.prototype.levelDown\r\n onLevelDown(self /*, oldLevel: number*/) {\r\n this.gainLevel(self, -1);\r\n // this.ownerEntity()._effectResult.leveldown = true;\r\n // this.ownerEntity()._effectResult._revision++;\r\n }\r\n};\r\nLExperienceBehavior = LExperienceBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LExperienceBehavior);\r\nexports.LExperienceBehavior = LExperienceBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/behaviors/LExperienceBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/behaviors/LFlockBehavior.ts": /*!**************************************************!*\ !*** ./ts/mr/lively/behaviors/LFlockBehavior.ts ***! \**************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LFlockBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LFlockBehavior = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst internal_1 = __webpack_require__(/*! ../internal */ \"./ts/mr/lively/internal.ts\");\r\nconst LEventServer_1 = __webpack_require__(/*! ../LEventServer */ \"./ts/mr/lively/LEventServer.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nlet LFlockBehavior = LFlockBehavior_1 = class LFlockBehavior extends internal_1.LBehavior {\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LFlockBehavior_1);\r\n return b;\r\n }\r\n onAttached(self) {\r\n }\r\n onDetached(self) {\r\n }\r\n onPertyChanged(self) {\r\n if (self.partyId() > 0) {\r\n MRLively_1.MRLively.world.party(self.partyId()).subscribe(MRBasics_1.MRBasics.events.effectReacted, this);\r\n }\r\n }\r\n onPartyEvent(eventId, args) {\r\n if (eventId == MRBasics_1.MRBasics.events.effectReacted) {\r\n this.ownerEntity().removeState(MRData_1.MRData.getState(\"kState_仮眠2\").id);\r\n }\r\n return LEventServer_1.LEventResult.Pass;\r\n }\r\n};\r\nLFlockBehavior = LFlockBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LFlockBehavior);\r\nexports.LFlockBehavior = LFlockBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/behaviors/LFlockBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/behaviors/LGlueToGroundBehavior.ts": /*!*********************************************************!*\ !*** ./ts/mr/lively/behaviors/LGlueToGroundBehavior.ts ***! \*********************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LGlueToGroundBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LGlueToGroundBehavior = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst UName_1 = __webpack_require__(/*! ts/mr/utility/UName */ \"./ts/mr/utility/UName.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LBehavior_1 = __webpack_require__(/*! ./LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\nconst STask_1 = __webpack_require__(/*! ts/mr/system/tasks/STask */ \"./ts/mr/system/tasks/STask.ts\");\r\n/**\r\n * 置くと床に張り付く\r\n */\r\nlet LGlueToGroundBehavior = LGlueToGroundBehavior_1 = class LGlueToGroundBehavior extends LBehavior_1.LBehavior {\r\n constructor() {\r\n super(...arguments);\r\n this._glued = false;\r\n }\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LGlueToGroundBehavior_1);\r\n throw new Error(\"Not implemented.\");\r\n }\r\n get glued() {\r\n return this._glued;\r\n }\r\n set glued(value) {\r\n this._glued = value;\r\n }\r\n onActivityPreReaction(self, cctx, activity) {\r\n if (activity.actionId() == MRBasics_1.MRBasics.actions.PickActionId) {\r\n if (this._glued) {\r\n cctx.postMessage((0, Common_1.tr2)(\"%1は地面にはりついている。\").format(UName_1.UName.makeNameAsItem(self)));\r\n return SCommand_1.SCommandResponse.Canceled;\r\n }\r\n }\r\n return SCommand_1.SCommandResponse.Pass;\r\n }\r\n [LBehavior_1.onGrounded](args, cctx) {\r\n this._glued = true;\r\n return SCommand_1.SCommandResponse.Pass;\r\n }\r\n *onCommand(self, cctx, cmd) {\r\n if (cmd instanceof SCommand_1.STestTakeItemCommand) {\r\n if (this._glued) {\r\n cctx.postMessage((0, Common_1.tr2)(\"%1は地面にはりついている。\").format(UName_1.UName.makeNameAsItem(self)));\r\n return STask_1.STaskYieldResult.Reject;\r\n }\r\n }\r\n }\r\n};\r\nLGlueToGroundBehavior = LGlueToGroundBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LGlueToGroundBehavior);\r\nexports.LGlueToGroundBehavior = LGlueToGroundBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/behaviors/LGlueToGroundBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/behaviors/LGoldBehavior.ts": /*!*************************************************!*\ !*** ./ts/mr/lively/behaviors/LGoldBehavior.ts ***! \*************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LGoldBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LGoldBehavior = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst DTextManager_1 = __webpack_require__(/*! ts/mr/data/DTextManager */ \"./ts/mr/data/DTextManager.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LBehavior_1 = __webpack_require__(/*! ./LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\n/**\r\n * お金\r\n */\r\nlet LGoldBehavior = LGoldBehavior_1 = class LGoldBehavior extends LBehavior_1.LBehavior {\r\n /*\r\n [2021/9/29] 金額の持ち方\r\n -----------\r\n ### upgradeValue や capacity と共有してみる?\r\n しないほうがよさそう。\r\n それぞれ値の範囲が決まっている。 (-ベース~+99 など)\r\n\r\n ### GoldBehavior のフィールドとして持つ?\r\n お金専用の処理が組みやすいが、Editorからいろいろ設定するときに専用のGUIが必要になってしまう。\r\n\r\n ### Goldパラメータを作る\r\n 安牌かも。\r\n 実質お金という固有のアイテムでしか使わないパラメータではあるが、これを利用することで\r\n - アイテムのダメージ計算として \"a.gold/10\" のように指定し、EffectContext を使用した通常のダメージが使える。\r\n - 出現テーブルでエンティティのパラメータとして金額氏を指定できる。特定のダンジョンやフロアでは落ちているお金の金額が大きい、といった表現ができる。\r\n */\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LGoldBehavior_1);\r\n return b;\r\n }\r\n constructor() {\r\n super();\r\n }\r\n onAttached(self) {\r\n const params = self.params;\r\n params.acquireParam(MRBasics_1.MRBasics.params.gold);\r\n }\r\n queryDisplayName() {\r\n const data = this.ownerEntity().data;\r\n return {\r\n name: this.gold().toString() + DTextManager_1.DTextManager.currencyUnit,\r\n iconIndex: data.display.iconIndex,\r\n upgrades: 0,\r\n };\r\n }\r\n onCheckLooksLikeGold() {\r\n return true;\r\n }\r\n gold() {\r\n return this.ownerEntity().getActualParam(MRBasics_1.MRBasics.params.gold);\r\n }\r\n setGold(value) {\r\n this.ownerEntity().setParamCurrentValue(MRBasics_1.MRBasics.params.gold, value);\r\n }\r\n};\r\nLGoldBehavior = LGoldBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LGoldBehavior);\r\nexports.LGoldBehavior = LGoldBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/behaviors/LGoldBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/behaviors/LGoldThiefBehavior.ts": /*!******************************************************!*\ !*** ./ts/mr/lively/behaviors/LGoldThiefBehavior.ts ***! \******************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LGoldThiefBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LGoldThiefBehavior = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst DCommon_1 = __webpack_require__(/*! ts/mr/data/DCommon */ \"./ts/mr/data/DCommon.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst Helpers_1 = __webpack_require__(/*! ts/mr/system/Helpers */ \"./ts/mr/system/Helpers.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst UMovement_1 = __webpack_require__(/*! ts/mr/utility/UMovement */ \"./ts/mr/utility/UMovement.ts\");\r\nconst LEscapeAI_1 = __webpack_require__(/*! ../ai/LEscapeAI */ \"./ts/mr/lively/ai/LEscapeAI.ts\");\r\nconst LMovingTargetFinder_1 = __webpack_require__(/*! ../ai/LMovingTargetFinder */ \"./ts/mr/lively/ai/LMovingTargetFinder.ts\");\r\nconst LStandardAI_1 = __webpack_require__(/*! ../ai/LStandardAI */ \"./ts/mr/lively/ai/LStandardAI.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LBehavior_1 = __webpack_require__(/*! ./LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\nconst LInventoryBehavior_1 = __webpack_require__(/*! ../entity/LInventoryBehavior */ \"./ts/mr/lively/entity/LInventoryBehavior.ts\");\r\n/**\r\n *\r\n */\r\nlet LGoldThiefBehavior = LGoldThiefBehavior_1 = class LGoldThiefBehavior extends LBehavior_1.LBehavior {\r\n constructor() {\r\n super();\r\n this._standardAI = new LStandardAI_1.LCharacterAI_Normal();\r\n this._escapeAI = new LEscapeAI_1.LEscapeAI();\r\n this._standardAI.setMovingTargetFinder(new LMovingTargetFinder_1.LMovingTargetFinder_Gold());\r\n }\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LGoldThiefBehavior_1);\r\n return b;\r\n }\r\n onPostMakeSkillActions(candidates) {\r\n const self = this.ownerEntity();\r\n const blocks = UMovement_1.UMovement.getAdjacentBlocks(self);\r\n // 隣接している Unit をチェック。アイテムが同時に隣接していても、こちらを優先したい。\r\n for (const block of blocks) {\r\n const target = block.getFirstEntity(DCommon_1.DBlockLayerKind.Unit);\r\n if (target && Helpers_1.Helpers.isHostile(self, target)) {\r\n const inventory = target.findEntityBehavior(LInventoryBehavior_1.LInventoryBehavior);\r\n if (inventory) {\r\n if (inventory.gold() > 0) {\r\n candidates.push({\r\n action: { rating: 100, skillId: MRData_1.MRData.getSkill(\"kSkill_ゴールド盗み\").id },\r\n targets: [target.entityId()],\r\n });\r\n }\r\n }\r\n // 隣接する敵対者を見つけた\r\n return;\r\n }\r\n }\r\n /*\r\n // 次にアイテムをチェック\r\n for (const block of blocks) {\r\n\r\n const item = block.getFirstEntity(DBlockLayerKind.Ground);\r\n if (item && item.findEntityBehavior(LItemBehavior)) {\r\n // 隣接するアイテムを見つけた\r\n if (item == USearch.findLatestItemInVisibilityBlocks(self)) { // それは視界内の最も新しいアイテム?\r\n candidates.push({\r\n action: { rating: 100, skillId: REData.getSkill(\"kSkill_ゴールド盗み\").id },\r\n targets: [item.entityId()],\r\n });\r\n }\r\n return;\r\n }\r\n }\r\n */\r\n }\r\n onDecisionPhase(self, cctx, phase) {\r\n if (phase == LBehavior_1.DecisionPhase.AIMinor) {\r\n this.activeAI(self).thinkMoving(cctx, self);\r\n return SCommand_1.SPhaseResult.Handled;\r\n }\r\n else if (phase == LBehavior_1.DecisionPhase.AIMajor) {\r\n this.activeAI(self).thinkAction(cctx, self);\r\n return SCommand_1.SPhaseResult.Handled;\r\n }\r\n return SCommand_1.SPhaseResult.Pass;\r\n }\r\n activeAI(self) {\r\n const inventory = self.getEntityBehavior(LInventoryBehavior_1.LInventoryBehavior);\r\n if (inventory.hasAnyItem()) {\r\n return this._escapeAI;\r\n }\r\n else {\r\n return this._standardAI;\r\n }\r\n }\r\n};\r\nLGoldThiefBehavior = LGoldThiefBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LGoldThiefBehavior);\r\nexports.LGoldThiefBehavior = LGoldThiefBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/behaviors/LGoldThiefBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/behaviors/LItemBehavior.ts": /*!*************************************************!*\ !*** ./ts/mr/lively/behaviors/LItemBehavior.ts ***! \*************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LItemBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LItemBehavior = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst SEmittorPerformer_1 = __webpack_require__(/*! ts/mr/system/SEmittorPerformer */ \"./ts/mr/system/SEmittorPerformer.ts\");\r\nconst UIdentify_1 = __webpack_require__(/*! ts/mr/utility/UIdentify */ \"./ts/mr/utility/UIdentify.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LBehavior_1 = __webpack_require__(/*! ./LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\nconst UAction_1 = __webpack_require__(/*! ts/mr/utility/UAction */ \"./ts/mr/utility/UAction.ts\");\r\nconst TDrop_1 = __webpack_require__(/*! ts/mr/transactions/TDrop */ \"./ts/mr/transactions/TDrop.ts\");\r\n/**\r\n * Item として表現する Entity の共通 Behavior\r\n */\r\nlet LItemBehavior = LItemBehavior_1 = class LItemBehavior extends LBehavior_1.LBehavior {\r\n constructor() {\r\n super();\r\n this._shopStructureId = 0;\r\n }\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LItemBehavior_1);\r\n return b;\r\n }\r\n // public itemDataId(): DItemDataId {\r\n // const entity = this.ownerEntity().data();\r\n // assert(entity.itemData);\r\n // return entity.itemData.id;\r\n // }\r\n // public itemData(): DItem {\r\n // const entity = this.ownerEntity().data();\r\n // assert(entity.itemData);\r\n // return entity.itemData;\r\n // }\r\n shopStructureId() {\r\n return this._shopStructureId;\r\n }\r\n setShopStructureId(value) {\r\n this._shopStructureId = value;\r\n }\r\n // public onQueryParamMinMax(paramId: DParameterId, result: LParamMinMaxInfo): void {\r\n // const self = this.ownerEntity();\r\n // if (self.params().param(paramId) !== undefined) {\r\n // if (paramId == REBasics.params.upgradeValue) {\r\n // }\r\n // }\r\n // }\r\n *onCommand(self, cctx, cmd) {\r\n if (cmd instanceof SCommand_1.SItemReactionCommand) {\r\n if (cmd.itemActionId == MRBasics_1.MRBasics.actions.collide) {\r\n // TODO: このあたり、 Reaction 関係の処理は Common に移動していいかも。\r\n // destroy の有無は Reaction 側に付ける。\r\n // これによって、単に1ダメ与えてロストするようなのをやめることもできる。\r\n const hasReaction = this.applyHitEffect(cctx, self, MRBasics_1.MRBasics.actions.collide, cmd.target, cmd.subject, cmd.direction, (targets) => {\r\n if (targets.find(x => !x._effectResult.missed)) {\r\n // ここは postDestroy() ではなく普通の destroy().\r\n // 上記 applyEffect() の中から postAnimation() が実行されるが、\r\n // ここで postDestroy() してしまうと、アニメーション中ずっと表示され続けてしまう。\r\n self.destroy();\r\n }\r\n else {\r\n UAction_1.UAction.postDropOrDestroy(cctx, self, self.mx, self.my);\r\n }\r\n });\r\n if (!hasReaction) {\r\n TDrop_1.TDrop.makeFromSingleItem(self)\r\n .withLocation(cmd.target.mx, cmd.target.my)\r\n .performe(cctx);\r\n }\r\n //chain.accept();\r\n }\r\n }\r\n }\r\n onCollectTraits(self, result) {\r\n super.onCollectTraits(self, result);\r\n for (const trait of self.data.selfTraits) {\r\n result.push(trait);\r\n }\r\n }\r\n /*\r\n onActivity(self: LEntity, cctx: SCommandContext, actx: SActivityContext): SCommandResponse {\r\n const activity = actx.activity();\r\n if (activity.actionId() == MRBasics.actions.collide) {\r\n \r\n \r\n const target = activity.objects2()[0];\r\n const subject = new SEffectSubject(activity.subject());\r\n actx.postHandleActivity(cctx, target)\r\n .then(() => {\r\n this.applyHitEffect(cctx, self, MRBasics.actions.collide, target, subject.entity(), activity.effectDirection(), (targets: LEntity[]) => {\r\n if (targets.find(x => !x._effectResult.missed)) {\r\n // ここは postDestroy() ではなく普通の destroy().\r\n // 上記 applyEffect() の中から postAnimation() が実行されるが、\r\n // ここで postDestroy() してしまうと、アニメーション中ずっと表示され続けてしまう。\r\n self.destroy();\r\n }\r\n else {\r\n UAction.postDropOrDestroy(cctx, self, self.mx, self.my);\r\n }\r\n });\r\n return SHandleCommandResult.Resolved;\r\n })\r\n .catch(() => {\r\n throw new Error(\"Not implemented.\");\r\n });\r\n \r\n return SCommandResponse.Handled;\r\n }\r\n\r\n return SCommandResponse.Pass;\r\n }\r\n */\r\n onActivityReaction(self, cctx, activity) {\r\n // [振られた]\r\n if (activity.actionId() == MRBasics_1.MRBasics.actions.WaveActionId) {\r\n const actor = activity.actor();\r\n const reaction = self.data.getReaction(MRBasics_1.MRBasics.actions.WaveActionId);\r\n for (const emittor of reaction.emittors()) {\r\n SEmittorPerformer_1.SEmittorPerformer.makeWithEmitor(actor, actor, emittor)\r\n .setItemEntity(self)\r\n .perform(cctx);\r\n }\r\n }\r\n // [読まれた]\r\n else if (activity.actionId() == MRBasics_1.MRBasics.actions.ReadActionId) {\r\n const actor = activity.actor();\r\n UIdentify_1.UIdentify.identifyByTiming(cctx, actor, self, activity.actionId());\r\n const reaction = self.data.getReaction(MRBasics_1.MRBasics.actions.ReadActionId);\r\n for (const emittor of reaction.emittors()) {\r\n SEmittorPerformer_1.SEmittorPerformer.makeWithEmitor(actor, actor, emittor)\r\n .setItemEntity(self)\r\n .setSelectedTargetItems(activity.objects2())\r\n .perform(cctx);\r\n cctx.postDestroy(self);\r\n }\r\n }\r\n // [食べられた]\r\n else if (activity.actionId() == MRBasics_1.MRBasics.actions.EatActionId) {\r\n const subject = activity.actor();\r\n const reactor = activity.object();\r\n if (reactor) {\r\n UIdentify_1.UIdentify.identifyByTiming(cctx, subject, reactor, activity.actionId());\r\n const reaction = self.data.getReaction(MRBasics_1.MRBasics.actions.EatActionId);\r\n for (const emittor of reaction.emittors()) {\r\n SEmittorPerformer_1.SEmittorPerformer.makeWithEmitor(subject, subject, emittor)\r\n .setItemEntity(self)\r\n .setSelectedTargetItems(activity.objects2())\r\n .perform(cctx);\r\n // 食べられたので削除。\r\n // [かじる] も [食べる] の一部として考えるような場合は Entity が削除されることは無いので、\r\n // actor 側で destroy するのは望ましくない。\r\n cctx.postDestroy(self);\r\n }\r\n //cctx.post(reactor, subject, new SEffectSubject(subject), undefined, onEatReaction);\r\n }\r\n return SCommand_1.SCommandResponse.Handled;\r\n }\r\n return SCommand_1.SCommandResponse.Pass;\r\n }\r\n onEmitEffect(self, cctx, actionId, subject, target, dir) {\r\n this.applyHitEffect(cctx, self, actionId, target, subject, dir);\r\n return SCommand_1.SCommandResponse.Pass;\r\n }\r\n applyHitEffect(cctx, self, actionId, target, subject, effectDir, onPerformedFunc) {\r\n const entityData = self.data;\r\n //const emittors = entityData.emittorSet.emittors(cause);\r\n const reaction = entityData.findReaction(actionId);\r\n if (reaction) {\r\n const emittors = reaction.emittors();\r\n if (emittors.length > 0) {\r\n cctx.postCall(() => {\r\n for (const emittor of emittors) {\r\n //SEmittorPerformer.makeWithEmitor(subject.entity(), emittor)\r\n SEmittorPerformer_1.SEmittorPerformer.makeWithEmitor(subject, target, emittor)\r\n .setItemEntity(self)\r\n .setDffectDirection(effectDir)\r\n .perform(cctx, onPerformedFunc);\r\n }\r\n });\r\n }\r\n return true;\r\n }\r\n else {\r\n // 吹き飛ばした Enemy が他 Enemy と衝突した場合など、Reaction を持たない場合\r\n return false;\r\n }\r\n }\r\n // TODO: すごく仮。今はアイテムが盗みスキルの効果を受け取るためだけにある\r\n [LBehavior_1.onAttackReaction](args, cctx) {\r\n const self = args.self;\r\n const effectContext = args.args.effectContext;\r\n if (effectContext) {\r\n const targets = [self];\r\n effectContext.applyWithWorth(cctx, targets);\r\n return SCommand_1.SCommandResponse.Handled;\r\n }\r\n return SCommand_1.SCommandResponse.Pass;\r\n }\r\n};\r\nLItemBehavior = LItemBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LItemBehavior);\r\nexports.LItemBehavior = LItemBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/behaviors/LItemBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/behaviors/LItemImitatorBehavior.ts": /*!*********************************************************!*\ !*** ./ts/mr/lively/behaviors/LItemImitatorBehavior.ts ***! \*********************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LItemImitatorBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LItemImitatorBehavior = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst Helpers_1 = __webpack_require__(/*! ts/mr/system/Helpers */ \"./ts/mr/system/Helpers.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ts/mr/system/MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst UAction_1 = __webpack_require__(/*! ts/mr/utility/UAction */ \"./ts/mr/utility/UAction.ts\");\r\nconst SEntityFactory_1 = __webpack_require__(/*! ts/mr/system/SEntityFactory */ \"./ts/mr/system/SEntityFactory.ts\");\r\nconst LEventServer_1 = __webpack_require__(/*! ../LEventServer */ \"./ts/mr/lively/LEventServer.ts\");\r\nconst LObject_1 = __webpack_require__(/*! ../LObject */ \"./ts/mr/lively/LObject.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LState_1 = __webpack_require__(/*! ../states/LState */ \"./ts/mr/lively/states/LState.ts\");\r\nconst LBehavior_1 = __webpack_require__(/*! ./LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\nconst DCommon_1 = __webpack_require__(/*! ts/mr/data/DCommon */ \"./ts/mr/data/DCommon.ts\");\r\nconst DSpawner_1 = __webpack_require__(/*! ts/mr/data/DSpawner */ \"./ts/mr/data/DSpawner.ts\");\r\nconst LCommon_1 = __webpack_require__(/*! ../LCommon */ \"./ts/mr/lively/LCommon.ts\");\r\nconst STask_1 = __webpack_require__(/*! ts/mr/system/tasks/STask */ \"./ts/mr/system/tasks/STask.ts\");\r\n/**\r\n * Item に化けるモンスター。\r\n *\r\n * [2021/6/20] 化けるItem自体のEntityと合成するか、それは内包して見た目だけコントールするか\r\n * ----------\r\n *\r\n * 後者で行ってみる。\r\n *\r\n * 後者の場合、基本的にはこの Behavior で名前、アイコン、種別、コマンドリストなどをオーバーライドして対応できる。\r\n * アイテムによっては 水がめの [くむ]、草投げの杖の [いれる]、いかすしの巻物の [たべる] など基本と異なるコマンドがあるが、\r\n * それは内包しているアイテム Entity に対して中継すればよいだけ。説明文、使用回数や修正値もこのように参照できる。\r\n *\r\n * 前者の場合、真のアイテム種別などをモンスターEntity自身が持ってしまうことになるため、\r\n * 種別の区別が必要になる色々な処理に細工が必要になる。\r\n * たとえば、ひま投げで投げられた化けモンスターが、合成の壺や草効果の壺に入った時。\r\n * 壺側の処理として、Entityが2つの種類を持つ可能性を考慮するのは何か違うきがするし、\r\n * そういった処理を常に気を付けながら実装しなければならないのはNG.\r\n *\r\n * どちらの場合にしても、例えば草、杖といった \"種別\" は、表示用と処理用の2つが必要になる。\r\n *\r\n * [2021/6/21] アイテム化けはスキルおよびステートとして扱う\r\n * ----------\r\n *\r\n * こうしないと、完全にあるモンスター専用の Behavior を作る必要がある。\r\n * それはカスタマイズ性を著しく下げるため避けたいところ。\r\n * その場合は既存の AI の仕組みをオーバーライドする必要もあり、AI 側はそのような使われ方を想定して実装しなければならず負担が大きい。\r\n *\r\n * アイテム化けスキルは「敵対Entityが視界内にいなければ優先的に発動する」スキルとして実装する。\r\n * またこのスキルは「アイテム化けステートを付加する」のみの効果とする。\r\n *\r\n *\r\n *\r\n *\r\n */\r\nlet LItemImitatorBehavior = LItemImitatorBehavior_1 = class LItemImitatorBehavior extends LBehavior_1.LBehavior {\r\n constructor() {\r\n super();\r\n //private _itemId: DItemDataId = 0;\r\n this._itemEntityId = LObject_1.LEntityId.makeEmpty();\r\n }\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LItemImitatorBehavior_1);\r\n b._itemEntityId = this._itemEntityId.clone();\r\n return b;\r\n }\r\n onAttached(self) {\r\n (0, Common_1.assert)(this._itemEntityId.isEmpty());\r\n MRLively_1.MRLively.eventServer.subscribe(MRBasics_1.MRBasics.events.preWalk, this);\r\n MRLively_1.MRLively.eventServer.subscribe(MRBasics_1.MRBasics.events.prePut, this);\r\n }\r\n onDetached(self) {\r\n (0, Common_1.assert)(this._itemEntityId.hasAny());\r\n MRLively_1.MRLively.eventServer.unsubscribe(MRBasics_1.MRBasics.events.preWalk, this);\r\n MRLively_1.MRLively.eventServer.unsubscribe(MRBasics_1.MRBasics.events.prePut, this);\r\n this.itemEntity().clearParent();\r\n }\r\n onEnteredMap(self, map) {\r\n if (this._itemEntityId.isEmpty()) {\r\n const rand = MRLively_1.MRLively.world.random();\r\n const floorId = map.floorId();\r\n const list = map.land2().landData().appearanceTable.items[floorId.floorNumber];\r\n const data = rand.selectOrUndefined(list);\r\n const item = (data) ?\r\n SEntityFactory_1.SEntityFactory.newEntity(data.spawiInfo, floorId) :\r\n SEntityFactory_1.SEntityFactory.newEntity(DSpawner_1.DEntityCreateInfo.makeSingle(MRData_1.MRData.system.fallbackItemEntityId));\r\n item.setParent(this);\r\n this._itemEntityId = item.entityId();\r\n }\r\n }\r\n queryDisplayName() {\r\n return this.itemEntity().getDisplayName();\r\n }\r\n queryPrefabId() {\r\n const e = this.itemEntity().data;\r\n return e.prefabId;\r\n }\r\n queryHomeLayer() {\r\n return DCommon_1.DBlockLayerKind.Ground;\r\n }\r\n queryMinimapMarkerClass() {\r\n return LCommon_1.LMinimapMarkerClass.Item;\r\n }\r\n onQueryReactions(self, reactions) {\r\n for (const a of this.itemEntity().queryReactions()) {\r\n reactions.push(a);\r\n }\r\n }\r\n itemEntity() {\r\n return MRLively_1.MRLively.world.entity(this._itemEntityId);\r\n }\r\n queryOutwardFactionId() {\r\n return MRData_1.MRData.system.factions.neutral;\r\n }\r\n *onCommand(self, cctx, cmd) {\r\n var _a;\r\n // \r\n if (cmd instanceof SCommand_1.STestTakeItemCommand) {\r\n const actor = cmd.actor;\r\n if (Helpers_1.Helpers.isHostileFactionId(actor.getOutwardFactionId(), self.getInnermostFactionId())) {\r\n (_a = this.parentAs(LState_1.LState)) === null || _a === void 0 ? void 0 : _a.removeThisState();\r\n self.removeFromParent();\r\n MRLively_1.MRLively.mapView.currentMap.appearEntity(self, actor.mx, actor.my);\r\n UAction_1.UAction.postDropOrDestroyOnCurrentPos(MRSystem_1.MRSystem.commandContext, self, self.getHomeLayer());\r\n return STask_1.STaskYieldResult.Reject;\r\n }\r\n }\r\n }\r\n onEvent(cctx, eventId, args) {\r\n var _a;\r\n const self = this.ownerEntity();\r\n if (eventId == MRBasics_1.MRBasics.events.preWalk) {\r\n const e = args;\r\n // 敵対 Entity が、歩行によって同じ座標に移動しようとしたらステート解除\r\n if (Helpers_1.Helpers.isHostileFactionId(e.walker.getOutwardFactionId(), self.getInnermostFactionId()) &&\r\n e.targetX == self.mx && e.targetY == self.my) {\r\n (_a = this.parentAs(LState_1.LState)) === null || _a === void 0 ? void 0 : _a.removeThisState();\r\n return LEventServer_1.LEventResult.Handled;\r\n }\r\n }\r\n else if (eventId == MRBasics_1.MRBasics.events.prePut) {\r\n /*\r\n const e = args as PutEventArgs;\r\n if (Helpers.isHostileFactionId(e.actor.getOutwardFactionId(), self.getInnermostFactionId())) {\r\n this.parentAs(LState)?.removeThisState();\r\n \r\n self.removeFromParent();\r\n REGame.map.appearEntity(self, e.actor.x, e.actor.y);\r\n UAction.postDropOrDestroy(RESystem.commandContext, self, self.getHomeLayer(), 0);\r\n\r\n return LEventResult.Handled;\r\n }\r\n */\r\n }\r\n return LEventServer_1.LEventResult.Pass;\r\n }\r\n};\r\nLItemImitatorBehavior = LItemImitatorBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LItemImitatorBehavior);\r\nexports.LItemImitatorBehavior = LItemImitatorBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/behaviors/LItemImitatorBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/behaviors/LItemThiefBehavior.ts": /*!******************************************************!*\ !*** ./ts/mr/lively/behaviors/LItemThiefBehavior.ts ***! \******************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LItemThiefBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LItemThiefBehavior = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst DCommon_1 = __webpack_require__(/*! ts/mr/data/DCommon */ \"./ts/mr/data/DCommon.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst Helpers_1 = __webpack_require__(/*! ts/mr/system/Helpers */ \"./ts/mr/system/Helpers.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst UMovement_1 = __webpack_require__(/*! ts/mr/utility/UMovement */ \"./ts/mr/utility/UMovement.ts\");\r\nconst USearch_1 = __webpack_require__(/*! ts/mr/utility/USearch */ \"./ts/mr/utility/USearch.ts\");\r\nconst LEscapeAI_1 = __webpack_require__(/*! ../ai/LEscapeAI */ \"./ts/mr/lively/ai/LEscapeAI.ts\");\r\nconst LMovingTargetFinder_1 = __webpack_require__(/*! ../ai/LMovingTargetFinder */ \"./ts/mr/lively/ai/LMovingTargetFinder.ts\");\r\nconst LStandardAI_1 = __webpack_require__(/*! ../ai/LStandardAI */ \"./ts/mr/lively/ai/LStandardAI.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LBehavior_1 = __webpack_require__(/*! ./LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\nconst LInventoryBehavior_1 = __webpack_require__(/*! ../entity/LInventoryBehavior */ \"./ts/mr/lively/entity/LInventoryBehavior.ts\");\r\nconst LItemBehavior_1 = __webpack_require__(/*! ./LItemBehavior */ \"./ts/mr/lively/behaviors/LItemBehavior.ts\");\r\n/**\r\n *\r\n */\r\nlet LItemThiefBehavior = LItemThiefBehavior_1 = class LItemThiefBehavior extends LBehavior_1.LBehavior {\r\n constructor() {\r\n super();\r\n this._standardAI = new LStandardAI_1.LCharacterAI_Normal();\r\n this._escapeAI = new LEscapeAI_1.LEscapeAI();\r\n this._standardAI.setMovingTargetFinder(new LMovingTargetFinder_1.LMovingTargetFinder_Item());\r\n }\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LItemThiefBehavior_1);\r\n return b;\r\n }\r\n behaviorGroup() {\r\n return LBehavior_1.LBehaviorGroup.SpecialAbility;\r\n }\r\n onPostMakeSkillActions(candidates) {\r\n const self = this.ownerEntity();\r\n const blocks = UMovement_1.UMovement.getAdjacentBlocks(self);\r\n // まずは隣接している Unit をチェック。床落ちアイテムと隣接していても、こちらを優先したい。\r\n for (const block of blocks) {\r\n const target = block.getFirstEntity(DCommon_1.DBlockLayerKind.Unit);\r\n if (target && Helpers_1.Helpers.isHostile(self, target)) {\r\n const inventory = target.findEntityBehavior(LInventoryBehavior_1.LInventoryBehavior);\r\n if (inventory) {\r\n if (inventory.items.length > 0) {\r\n candidates.push({\r\n action: { rating: 100, skillId: MRData_1.MRData.getSkill(\"kSkill_アイテム盗み\").id },\r\n targets: [target.entityId()],\r\n });\r\n }\r\n }\r\n // 隣接する敵対者を見つけた\r\n return;\r\n }\r\n }\r\n // 次に床落ちアイテムをチェック\r\n for (const block of blocks) {\r\n const item = block.getFirstEntity(DCommon_1.DBlockLayerKind.Ground);\r\n if (item && item.findEntityBehavior(LItemBehavior_1.LItemBehavior)) {\r\n // 隣接する床落ちアイテムを見つけた\r\n // ただし、Unit もいるなら盗まない\r\n if (!!block.getFirstEntity(DCommon_1.DBlockLayerKind.Unit))\r\n continue;\r\n if (item == USearch_1.USearch.findLatestItemInVisibilityBlocks(self)) { // それは視界内の最も新しいアイテム?\r\n candidates.push({\r\n action: { rating: 100, skillId: MRData_1.MRData.getSkill(\"kSkill_アイテム盗み\").id },\r\n targets: [item.entityId()],\r\n });\r\n }\r\n return;\r\n }\r\n }\r\n }\r\n onDecisionPhase(self, cctx, phase) {\r\n if (phase == LBehavior_1.DecisionPhase.AIMinor) {\r\n this.activeAI(self).thinkMoving(cctx, self);\r\n return SCommand_1.SPhaseResult.Handled;\r\n }\r\n else if (phase == LBehavior_1.DecisionPhase.AIMajor) {\r\n this.activeAI(self).thinkAction(cctx, self);\r\n return SCommand_1.SPhaseResult.Handled;\r\n }\r\n return SCommand_1.SPhaseResult.Pass;\r\n }\r\n activeAI(self) {\r\n const inventory = self.getEntityBehavior(LInventoryBehavior_1.LInventoryBehavior);\r\n if (inventory.hasAnyItem()) {\r\n return this._escapeAI;\r\n }\r\n else {\r\n return this._standardAI;\r\n }\r\n }\r\n};\r\nLItemThiefBehavior = LItemThiefBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LItemThiefBehavior);\r\nexports.LItemThiefBehavior = LItemThiefBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/behaviors/LItemThiefBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/behaviors/LItemUserBehavior.ts": /*!*****************************************************!*\ !*** ./ts/mr/lively/behaviors/LItemUserBehavior.ts ***! \*****************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LItemUserBehavior = void 0;\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LBehavior_1 = __webpack_require__(/*! ./LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\n/**\r\n * @deprecated\r\n */\r\nclass LItemUserBehavior extends LBehavior_1.LBehavior {\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LItemUserBehavior);\r\n return b;\r\n }\r\n}\r\nexports.LItemUserBehavior = LItemUserBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/behaviors/LItemUserBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/behaviors/LParamBehavior.ts": /*!**************************************************!*\ !*** ./ts/mr/lively/behaviors/LParamBehavior.ts ***! \**************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LParamBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LParamBehavior = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst internal_1 = __webpack_require__(/*! ../internal */ \"./ts/mr/lively/internal.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\n/**\r\n * パラメータの定数加算\r\n */\r\nlet LParamBehavior = LParamBehavior_1 = class LParamBehavior extends internal_1.LBehavior {\r\n constructor() {\r\n super();\r\n this._values = [];\r\n }\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LParamBehavior_1);\r\n b._values = this._values.slice();\r\n return b;\r\n }\r\n onInitialized(self, params) {\r\n if (params) {\r\n this.setParamBase(params.paramId, params.value); // TODO: type\r\n }\r\n }\r\n setParamBase(paramId, value) {\r\n this._values[paramId] = value;\r\n }\r\n behaviorGroup() {\r\n return internal_1.LBehaviorGroup.SpecialAbility;\r\n }\r\n onQueryIdealParamBase(paramId, base) {\r\n const param = this._values[paramId];\r\n return base + ((param === undefined) ? 0 : param);\r\n }\r\n};\r\nLParamBehavior = LParamBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LParamBehavior);\r\nexports.LParamBehavior = LParamBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/behaviors/LParamBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/behaviors/LPreventionBehavior.ts": /*!*******************************************************!*\ !*** ./ts/mr/lively/behaviors/LPreventionBehavior.ts ***! \*******************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LStumblePreventionBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LStumblePreventionBehavior = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst UName_1 = __webpack_require__(/*! ts/mr/utility/UName */ \"./ts/mr/utility/UName.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LBehavior_1 = __webpack_require__(/*! ./LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\n/**\r\n *\r\n */\r\nlet LStumblePreventionBehavior = LStumblePreventionBehavior_1 = class LStumblePreventionBehavior extends LBehavior_1.LBehavior {\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LStumblePreventionBehavior_1);\r\n return b;\r\n }\r\n onPreviewRejection(self, cctx, rejection) {\r\n if (rejection.kind == \"Effect\") {\r\n // Effect の発動自体を防ぎたい。\r\n // もし EffectBehavior だけでガードすると、転び石のダメージは防げない。\r\n if (rejection.effect.effect.key == \"kEntity_転び石A\") {\r\n return this.rejectStumble(cctx, self);\r\n }\r\n }\r\n else if (rejection.kind == \"EffectBehavior\") {\r\n if (rejection.id == MRBasics_1.MRBasics.effectBehaviors.stumble) {\r\n return this.rejectStumble(cctx, self);\r\n }\r\n }\r\n return SCommand_1.SCommandResponse.Pass;\r\n }\r\n rejectStumble(cctx, self) {\r\n if (self.getActualParam(MRBasics_1.MRBasics.params.remaining) > 0) {\r\n cctx.postMessage((0, Common_1.tr2)(\"%1の効果で転ばなかった。\").format(UName_1.UName.makeNameAsItem(self)));\r\n // 使用回数を減らして効果を防止する\r\n self.gainActualParam(MRBasics_1.MRBasics.params.remaining, -1, true);\r\n return SCommand_1.SCommandResponse.Canceled;\r\n }\r\n return SCommand_1.SCommandResponse.Pass;\r\n }\r\n};\r\nLStumblePreventionBehavior = LStumblePreventionBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LStumblePreventionBehavior);\r\nexports.LStumblePreventionBehavior = LStumblePreventionBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/behaviors/LPreventionBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/behaviors/LRaceBehavior.ts": /*!*************************************************!*\ !*** ./ts/mr/lively/behaviors/LRaceBehavior.ts ***! \*************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LRaceBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LRaceBehavior = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LBattlerBehavior_1 = __webpack_require__(/*! ./LBattlerBehavior */ \"./ts/mr/lively/behaviors/LBattlerBehavior.ts\");\r\n/**\r\n * LEntity の持つ Race に基づいて種族を表現する Behavior。\r\n */\r\nlet LRaceBehavior = LRaceBehavior_1 = class LRaceBehavior extends LBattlerBehavior_1.LBattlerBehavior {\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LRaceBehavior_1);\r\n return b;\r\n }\r\n races(self) {\r\n return self.data.raceIds.map(x => MRData_1.MRData.races[x]); // TODO: data レイヤーの分は、先に結合しておいていいかも。速度的な理由で。\r\n }\r\n onCollectTraits(self, result) {\r\n for (const race of this.races(self)) {\r\n for (const t of race.traits) {\r\n result.push(t);\r\n }\r\n }\r\n }\r\n};\r\nLRaceBehavior = LRaceBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LRaceBehavior);\r\nexports.LRaceBehavior = LRaceBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/behaviors/LRaceBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/behaviors/LRatedRandomAIBehavior.ts": /*!**********************************************************!*\ !*** ./ts/mr/lively/behaviors/LRatedRandomAIBehavior.ts ***! \**********************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LRatedRandomAIBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LRatedRandomAIBehavior = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst PluginParameters_1 = __webpack_require__(/*! ts/mr/PluginParameters */ \"./ts/mr/PluginParameters.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst LRatedRandomAI_1 = __webpack_require__(/*! ../ai/LRatedRandomAI */ \"./ts/mr/lively/ai/LRatedRandomAI.ts\");\r\nconst LThinkingDeterminer_RatedRandom_1 = __webpack_require__(/*! ../ai2/LThinkingDeterminer_RatedRandom */ \"./ts/mr/lively/ai2/LThinkingDeterminer_RatedRandom.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LBehavior_1 = __webpack_require__(/*! ./LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\n/**\r\n *\r\n */\r\nlet LRatedRandomAIBehavior = LRatedRandomAIBehavior_1 = class LRatedRandomAIBehavior extends LBehavior_1.LBehavior {\r\n constructor() {\r\n /*\r\n なぜ Behavior として実装するのか?\r\n ----------\r\n \"封印\" 状態の実装は Behavior の無効化として実装したいため。\r\n - \"特殊能力\" は Behavior として実装する。\r\n - \"特性\" は Trait として実装する。\r\n */\r\n super(...arguments);\r\n this._characterAI = new LRatedRandomAI_1.LRatedRandomAI();\r\n this._thinking = new LThinkingDeterminer_RatedRandom_1.LThinkingDeterminer_RatedRandom();\r\n }\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LRatedRandomAIBehavior_1);\r\n b._characterAI = this._characterAI.clone();\r\n b._thinking = this._thinking.clone();\r\n return b;\r\n }\r\n behaviorGroup() {\r\n return LBehavior_1.LBehaviorGroup.SpecialAbility;\r\n }\r\n onDecisionPhase(self, cctx, phase) {\r\n if (PluginParameters_1.paramUseThinkingAgent) {\r\n return SCommand_1.SPhaseResult.Pass;\r\n }\r\n if (phase == LBehavior_1.DecisionPhase.Manual) {\r\n throw new Error(\"Not implemented.\");\r\n }\r\n else if (phase == LBehavior_1.DecisionPhase.AIMinor) {\r\n return this._characterAI.thinkMoving(cctx, self);\r\n }\r\n else if (phase == LBehavior_1.DecisionPhase.ResolveAdjacentAndMovingTarget) {\r\n return SCommand_1.SPhaseResult.Pass;\r\n }\r\n else if (phase == LBehavior_1.DecisionPhase.AIMajor) {\r\n return this._characterAI.thinkAction(cctx, self);\r\n }\r\n return SCommand_1.SPhaseResult.Pass;\r\n }\r\n onThink(self, agent) {\r\n if (PluginParameters_1.paramUseThinkingAgent) {\r\n return this._thinking.onThink(agent, self);\r\n }\r\n return SCommand_1.SPhaseResult.Pass;\r\n }\r\n};\r\nLRatedRandomAIBehavior = LRatedRandomAIBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LRatedRandomAIBehavior);\r\nexports.LRatedRandomAIBehavior = LRatedRandomAIBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/behaviors/LRatedRandomAIBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/behaviors/LRevivalItemBehavior.ts": /*!********************************************************!*\ !*** ./ts/mr/lively/behaviors/LRevivalItemBehavior.ts ***! \********************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LRevivalItemBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LRevivalItemBehavior = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LBehavior_1 = __webpack_require__(/*! ./LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\n/**\r\n *\r\n */\r\nlet LRevivalItemBehavior = LRevivalItemBehavior_1 = class LRevivalItemBehavior extends LBehavior_1.LBehavior {\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LRevivalItemBehavior_1);\r\n return b;\r\n }\r\n isCharmBehavior() {\r\n return true;\r\n }\r\n onStabilizeSituation(self, cctx) {\r\n // if (self.isDeathStateAffected()) {\r\n // self.removeDeadStates();\r\n // assert(!self.isDeathStateAffected());\r\n // }\r\n return SCommand_1.SCommandResponse.Pass;\r\n }\r\n};\r\nLRevivalItemBehavior = LRevivalItemBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LRevivalItemBehavior);\r\nexports.LRevivalItemBehavior = LRevivalItemBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/behaviors/LRevivalItemBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/behaviors/LSanctuaryBehavior.ts": /*!******************************************************!*\ !*** ./ts/mr/lively/behaviors/LSanctuaryBehavior.ts ***! \******************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LSanctuaryBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LSanctuaryBehavior = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst LFieldEffect_1 = __webpack_require__(/*! ../LFieldEffect */ \"./ts/mr/lively/LFieldEffect.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LBehavior_1 = __webpack_require__(/*! ./LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\nconst LGlueToGroundBehavior_1 = __webpack_require__(/*! ./LGlueToGroundBehavior */ \"./ts/mr/lively/behaviors/LGlueToGroundBehavior.ts\");\r\n/**\r\n */\r\nlet LSanctuaryBehavior = LSanctuaryBehavior_1 = class LSanctuaryBehavior extends LBehavior_1.LBehavior {\r\n constructor() {\r\n super();\r\n }\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LSanctuaryBehavior_1);\r\n return b;\r\n }\r\n onAttached(self) {\r\n this._fieldEffect = new LFieldEffect_1.LSanctuaryFieldEffect(self);\r\n }\r\n onDetached(self) {\r\n this._fieldEffect = undefined;\r\n }\r\n onActivityReaction(self, cctx, activity) {\r\n if (activity.actionId() == MRBasics_1.MRBasics.actions.ReadActionId) {\r\n cctx.postMessage((0, Common_1.tr2)(\"しかしなにもおこらなかった。\"));\r\n }\r\n return SCommand_1.SCommandResponse.Pass;\r\n }\r\n *onCollectFieldEffect(self) {\r\n const glue = self.getEntityBehavior(LGlueToGroundBehavior_1.LGlueToGroundBehavior);\r\n if (glue.glued && this._fieldEffect) {\r\n yield this._fieldEffect;\r\n }\r\n }\r\n};\r\nLSanctuaryBehavior = LSanctuaryBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LSanctuaryBehavior);\r\nexports.LSanctuaryBehavior = LSanctuaryBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/behaviors/LSanctuaryBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/behaviors/LSelfExplosionBehavior.ts": /*!**********************************************************!*\ !*** ./ts/mr/lively/behaviors/LSelfExplosionBehavior.ts ***! \**********************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LSelfExplosionBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LSelfExplosionBehavior = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LBehavior_1 = __webpack_require__(/*! ./LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst LActivity_1 = __webpack_require__(/*! ../activities/LActivity */ \"./ts/mr/lively/activities/LActivity.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\n/**\r\n */\r\nlet LSelfExplosionBehavior = LSelfExplosionBehavior_1 = class LSelfExplosionBehavior extends LBehavior_1.LBehavior {\r\n /*\r\n 自爆はステート?\r\n ----------\r\n ステートにしておくと、グラフィックの変更を GUI で指定しやすくなる。\r\n\r\n\r\n 爆発効果\r\n ----------\r\n - 味方は割合ダメージを受ける\r\n - モンスターは消滅する。(味方モンスターも同様)\r\n - 自爆能力を持つモンスターは誘爆する。\r\n - アイテムは消滅する。\r\n - 地雷罠は誘爆する。\r\n\r\n 当初は爆発スキル側で相手に応じて効果を変えようとしていたが、\r\n 効果の発動側が相手の種類を気にするのはやはり拡張性の点からよろしくない。\r\n\r\n 爆発ひとつとっても、「HP半分」「HP1/4」「HP1」「定数ダメージ」など様々ある。\r\n しかし誘爆はこれらすべてで同一。\r\n 設定をそれぞれの爆発効果スキルに行うのは手間がかかるしミスも増える。\r\n\r\n 少なくとも誘爆の処理は地雷Behaviorや自爆Behavior側で行うべき。\r\n そうすると「消滅」は「爆発に分類された効果」を受けた時のアイテム・モンスター側の都合なので、\r\n それぞれのBehavior側で実装するのがいいかも。\r\n\r\n ### 攻撃属性として \"爆発\" を特殊扱いする?\r\n\r\n NG. 即死しない爆発もある。\r\n これに対しては普通の爆発耐性を考慮してダメージを減らしたりできる。\r\n\r\n 攻撃属性に \"爆発\" \"即死爆発\" を用意する?\r\n 複数用意すると耐性設定するときにミスにつながるので避けたいところ。\r\n\r\n ### ダメージ効果に対して \"タグ\" を設定する\r\n\r\n\r\n */\r\n constructor() {\r\n super();\r\n }\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LSelfExplosionBehavior_1);\r\n return b;\r\n }\r\n [LBehavior_1.onEffectResult](args, cctx) {\r\n const self = args.self;\r\n // 既に戦闘不能なら処理不要\r\n if (self.isDeathStateAffected())\r\n return SCommand_1.SCommandResponse.Pass;\r\n const mhp = self.getParamActualMax(MRBasics_1.MRBasics.params.hp);\r\n const hp = self.getActualParam(MRBasics_1.MRBasics.params.hp);\r\n if (hp < 10) { // 残り1桁で爆発\r\n const skill = MRData_1.MRData.getSkill(\"kSkill_大爆発\");\r\n cctx.postActivity(LActivity_1.LActivity.makePerformSkill(self, skill.id));\r\n cctx.postCall(() => cctx.postDestroy(self));\r\n return SCommand_1.SCommandResponse.Handled;\r\n }\r\n if (hp < mhp * 0.5) { // 残り 50% で着火状態\r\n const stateId = MRData_1.MRData.getState(\"kState_UT自爆着火\").id;\r\n if (!self.hasState(stateId)) {\r\n self.addState(stateId);\r\n }\r\n return SCommand_1.SCommandResponse.Handled;\r\n }\r\n return SCommand_1.SCommandResponse.Pass;\r\n }\r\n};\r\nLSelfExplosionBehavior = LSelfExplosionBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LSelfExplosionBehavior);\r\nexports.LSelfExplosionBehavior = LSelfExplosionBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/behaviors/LSelfExplosionBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/behaviors/LShopkeeperBehavior.ts": /*!*******************************************************!*\ !*** ./ts/mr/lively/behaviors/LShopkeeperBehavior.ts ***! \*******************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LShopkeeperBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LMovingTargetFinder_Shopkeeper = exports.LShopkeeperBehavior = void 0;\r\nconst LBehavior_1 = __webpack_require__(/*! ./LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst LDecisionBehavior_1 = __webpack_require__(/*! ./LDecisionBehavior */ \"./ts/mr/lively/behaviors/LDecisionBehavior.ts\");\r\nconst LMovingTargetFinder_1 = __webpack_require__(/*! ../ai/LMovingTargetFinder */ \"./ts/mr/lively/ai/LMovingTargetFinder.ts\");\r\nconst SEventExecutionDialog_1 = __webpack_require__(/*! ts/mr/system/dialogs/SEventExecutionDialog */ \"./ts/mr/system/dialogs/SEventExecutionDialog.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst LInventoryBehavior_1 = __webpack_require__(/*! ../entity/LInventoryBehavior */ \"./ts/mr/lively/entity/LInventoryBehavior.ts\");\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst LThinkingAgent_1 = __webpack_require__(/*! ../ai2/LThinkingAgent */ \"./ts/mr/lively/ai2/LThinkingAgent.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst LThinkingAction_1 = __webpack_require__(/*! ../ai2/LThinkingAction */ \"./ts/mr/lively/ai2/LThinkingAction.ts\");\r\n/**\r\n */\r\nlet LShopkeeperBehavior = LShopkeeperBehavior_1 = class LShopkeeperBehavior extends LBehavior_1.LBehavior {\r\n constructor() {\r\n super(...arguments);\r\n this._shopStructureId = 0;\r\n this._shopkeeperIndex = 0; // ひとつの Shop 内での、店主番号\r\n }\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LShopkeeperBehavior_1);\r\n return b;\r\n }\r\n shopStructureId() {\r\n return this._shopStructureId;\r\n }\r\n shopkeeperIndex() {\r\n return this._shopkeeperIndex;\r\n }\r\n shop() {\r\n return MRLively_1.MRLively.mapView.currentMap.structures()[this._shopStructureId];\r\n }\r\n // この店主が守るべき入り口情報。大部屋の場合は全店主が同じ個所を指すこともある。\r\n shopEntrance() {\r\n return this.shop().shopEntrance(this._shopkeeperIndex);\r\n }\r\n setup(shopStructureId, shopkeeperIndex) {\r\n this._shopStructureId = shopStructureId;\r\n this._shopkeeperIndex = shopkeeperIndex;\r\n }\r\n onAttached(self) {\r\n const decision = self.getEntityBehavior(LDecisionBehavior_1.LDecisionBehavior);\r\n decision.characterAI().setMovingTargetFinder(new LMovingTargetFinder_Shopkeeper(this));\r\n }\r\n onThink(self, agent) {\r\n const shop = this.shop();\r\n const entrance = this.shopEntrance();\r\n const targetPos = shop.checkBilling() ? [entrance.gateX(), entrance.gateY()] : [entrance.homeX(), entrance.homeY()];\r\n if (targetPos[0] == self.mx && targetPos[1] == self.my) {\r\n const action = new LThinkingAction_1.LThinkingAction({\r\n rating: LThinkingAgent_1.LThinkingActionRatings.BasicActionsEnd + 1,\r\n skillId: MRData_1.MRData.system.skills.wait,\r\n }, []);\r\n agent.addCandidateAction(action);\r\n }\r\n else {\r\n const action = new LThinkingAction_1.LThinkingAction({\r\n rating: LThinkingAgent_1.LThinkingActionRatings.Moving,\r\n skillId: MRData_1.MRData.system.skills.move,\r\n }, []);\r\n action.priorityTargetX = targetPos[0];\r\n action.priorityTargetY = targetPos[1];\r\n agent.addCandidateAction(action);\r\n }\r\n return SCommand_1.SPhaseResult.Pass;\r\n }\r\n onDecisionPhase(self, cctx, phase) {\r\n /*\r\n if (phase == DecisionPhase.AIMinor) {\r\n // 右へ移動するだけ\r\n let dir = 6;\r\n\r\n // ランダム移動\r\n //const table = [1,2,3,4,6,7,8,9];\r\n //const dir = table[REGame.world.random().nextIntWithMax(8)];\r\n\r\n\r\n if (dir != 0 && REGame.map.checkPassage(self, dir, MovingMethod.Walk)) {\r\n cctx.postActivity(LActivity.makeDirectionChange(self, dir));\r\n cctx.postActivity(LActivity.makeMoveToAdjacent(self, dir));\r\n }\r\n cctx.postConsumeActionToken(self);\r\n return SPhaseResult.Handled;\r\n }\r\n */\r\n return SCommand_1.SPhaseResult.Pass;\r\n }\r\n onTalk(self, cctx, person) {\r\n const dialog = new SEventExecutionDialog_1.SEventExecutionDialog(self.rmmzEventId, self, person);\r\n dialog.billingPrice = this.shop().getBillingPrice();\r\n dialog.depositPrice = this.shop().getDepositPriece();\r\n cctx.openDialog(self, dialog, false);\r\n // .then(dialog => {\r\n // console.log(\"dialog\", dialog);\r\n // });\r\n return SCommand_1.SCommandResponse.Handled;\r\n }\r\n onActivityReaction(self, cctx, activity) {\r\n if (activity.actionId() == MRBasics_1.MRBasics.actions.dialogResult) {\r\n if (activity.selectedAction() == \"yes\") {\r\n const billingPrice = this.shop().getBillingPrice();\r\n const subject = activity.subject();\r\n const inventory = subject.getEntityBehavior(LInventoryBehavior_1.LInventoryBehavior);\r\n if (inventory.gold() >= billingPrice) {\r\n inventory.loseGold(billingPrice);\r\n this.shop().commitBilling();\r\n }\r\n else {\r\n throw new Error(\"Not implemented.\");\r\n }\r\n }\r\n return SCommand_1.SCommandResponse.Handled;\r\n }\r\n return SCommand_1.SCommandResponse.Pass;\r\n }\r\n};\r\nLShopkeeperBehavior = LShopkeeperBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LShopkeeperBehavior);\r\nexports.LShopkeeperBehavior = LShopkeeperBehavior;\r\nlet LMovingTargetFinder_Shopkeeper = class LMovingTargetFinder_Shopkeeper extends LMovingTargetFinder_1.LMovingTargetFinder {\r\n constructor(shopkeeper) {\r\n super();\r\n this._ownerShopkeeperId = shopkeeper.id();\r\n }\r\n decide(self) {\r\n const shopkeeper = MRLively_1.MRLively.world.behavior(this._ownerShopkeeperId);\r\n const shop = shopkeeper.shop();\r\n // const room = REGame.map.room(shop.roomId());\r\n // room.\r\n // shop.clientFaction()\r\n const entrance = shopkeeper.shopEntrance();\r\n if (shop.checkBilling()) {\r\n return [entrance.gateX(), entrance.gateY()];\r\n }\r\n else {\r\n return [entrance.homeX(), entrance.homeY()];\r\n }\r\n }\r\n};\r\nLMovingTargetFinder_Shopkeeper = __decorate([\r\n Common_1.MRSerializable\r\n], LMovingTargetFinder_Shopkeeper);\r\nexports.LMovingTargetFinder_Shopkeeper = LMovingTargetFinder_Shopkeeper;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/behaviors/LShopkeeperBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/behaviors/LStorageBehavior.ts": /*!****************************************************!*\ !*** ./ts/mr/lively/behaviors/LStorageBehavior.ts ***! \****************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LStorageBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LStorageBehavior = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LBehavior_1 = __webpack_require__(/*! ./LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\n/**\r\n *\r\n */\r\nlet LStorageBehavior = LStorageBehavior_1 = class LStorageBehavior extends LBehavior_1.LBehavior {\r\n constructor() {\r\n super();\r\n }\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LStorageBehavior_1);\r\n return b;\r\n }\r\n};\r\nLStorageBehavior = LStorageBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LStorageBehavior);\r\nexports.LStorageBehavior = LStorageBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/behaviors/LStorageBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/behaviors/LSurvivorBehavior.ts": /*!*****************************************************!*\ !*** ./ts/mr/lively/behaviors/LSurvivorBehavior.ts ***! \*****************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LSurvivorBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LSurvivorBehavior = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst PluginParameters_1 = __webpack_require__(/*! ts/mr/PluginParameters */ \"./ts/mr/PluginParameters.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LBehavior_1 = __webpack_require__(/*! ./LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\n/**\r\n *\r\n */\r\nlet LSurvivorBehavior = LSurvivorBehavior_1 = class LSurvivorBehavior extends LBehavior_1.LBehavior {\r\n constructor() {\r\n super();\r\n /*\r\n [2021/11/18] 拡張に対応できるだろうか?\r\n ----------\r\n 似たようなサバイバルパラメータとして考えられるのは、\r\n - 水分\r\n - 疲労度 (元気度)\r\n \r\n 影響を与える要素は、\r\n - モンスター、罠、アイテムによる回復\r\n - モンスター、罠、アイテムによる上限の変化\r\n - モンスター、罠、アイテムによる減少 (ハラヘリー)\r\n - 減少の防止(ハラヘリ除け) → 上記効果の \"減少\" 時のみ有効。Cur,Max共に。\r\n - 減少値の軽減 (皮の盾) → 自動減少にのみ影響\r\n - 減少値の無効化 (ハラヘラズ)\r\n - 減少値の増加 (ハラヘリ) → 自動減少にのみ影響\r\n \r\n パラメータを正常値に保つ影響として、\r\n - HPの自動回復\r\n この辺りは「ステートの自動付加」で表現するのが妥当だろうか。\r\n \r\n パラメータを失った影響として、\r\n - HPの自動減少\r\n この辺りは「ステートの自動付加」で表現するのが妥当だろうか。\r\n \r\n ステートやりくりである程度 Behavior に依存せずに処理することもできそうだが、\r\n それはそれでちょっと複雑になりすぎそう。\r\n \r\n 特定のパラメータを「サバイバルパラメータ」としてマークして、それに対して上記を Trait としてカバーするような Behavior にしたほうが、\r\n ある程度柔軟性を持ちつつわかりやすいかもしれない。\r\n */\r\n this._basicLoss = PluginParameters_1.paramFPLoss;\r\n this._basicLoss = PluginParameters_1.paramFPLoss;\r\n this._prevFP = Infinity;\r\n }\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LSurvivorBehavior_1);\r\n return b;\r\n }\r\n onAttached(self) {\r\n //const battler = this.ownerEntity().getBehavior(LBattlerBehavior);\r\n //battler.setupExParam(DBasics.params.fp);\r\n }\r\n onDecisionPhase(self, cctx, phase) {\r\n if (phase == LBehavior_1.DecisionPhase.UpdateState) {\r\n const fp1 = self.getActualParam(MRBasics_1.MRBasics.params.fp);\r\n if (fp1 > this._prevFP) {\r\n this._prevFP = fp1;\r\n }\r\n else {\r\n var loss = this._basicLoss;\r\n loss *= self.traitsPi(MRBasics_1.MRBasics.traits.SurvivalParamLossRate, MRBasics_1.MRBasics.params.fp);\r\n // FP 減少\r\n self.gainActualParam(MRBasics_1.MRBasics.params.fp, -loss, true);\r\n const fp2 = self.getActualParam(MRBasics_1.MRBasics.params.fp);\r\n if (fp1 > 0 && fp2 <= 0) {\r\n // 今回の更新で FP が 0 になったのであれば、メッセージを表示する\r\n cctx.postMessage((0, Common_1.tr2)(\"だめだ、もう倒れそうだ! 早くなにか食べないと!\"));\r\n }\r\n /*\r\n switch (self.actualParam(REBasics.params.fp)) {\r\n case 3:\r\n //cctx.postBalloon(entity, 6, false);\r\n cctx.postMessage(tr2(\"だめだ! もう倒れそうだ!\"));\r\n //cctx.postWait(entity, 10);\r\n break;\r\n case 2:\r\n cctx.postMessage(tr2(\"早く・・・なにか食べないと・・・\"))\r\n //cctx.postWait(entity, 10);\r\n break;\r\n case 1:\r\n cctx.postMessage(tr2(\"飢え死にしてしまう!\"));\r\n //cctx.postWait(entity, 10);\r\n break;\r\n }\r\n */\r\n if (fp2 <= 0) {\r\n // 満腹度 0 による HP 減少\r\n self.gainActualParam(MRBasics_1.MRBasics.params.hp, -1, true);\r\n if (self.isDeathStateAffected()) {\r\n cctx.postMessage((0, Common_1.tr2)(\"おなかがすいて倒れた・・・\"));\r\n }\r\n }\r\n else {\r\n // HP自動回復\r\n self.gainActualParam(MRBasics_1.MRBasics.params.hp, 1, true);\r\n }\r\n this._prevFP = fp2;\r\n }\r\n return SCommand_1.SPhaseResult.Pass;\r\n }\r\n else {\r\n return SCommand_1.SPhaseResult.Pass;\r\n }\r\n }\r\n};\r\nLSurvivorBehavior = LSurvivorBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LSurvivorBehavior);\r\nexports.LSurvivorBehavior = LSurvivorBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/behaviors/LSurvivorBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/behaviors/LTrapBehavior.ts": /*!*************************************************!*\ !*** ./ts/mr/lively/behaviors/LTrapBehavior.ts ***! \*************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LTrapBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LTrapBehavior = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ts/mr/system/MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst LBehavior_1 = __webpack_require__(/*! ./LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\nconst LItemBehavior_1 = __webpack_require__(/*! ./LItemBehavior */ \"./ts/mr/lively/behaviors/LItemBehavior.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LEventServer_1 = __webpack_require__(/*! ../LEventServer */ \"./ts/mr/lively/LEventServer.ts\");\r\nconst UMovement_1 = __webpack_require__(/*! ts/mr/utility/UMovement */ \"./ts/mr/utility/UMovement.ts\");\r\nconst SEmittorPerformer_1 = __webpack_require__(/*! ts/mr/system/SEmittorPerformer */ \"./ts/mr/system/SEmittorPerformer.ts\");\r\nconst PluginParameters_1 = __webpack_require__(/*! ts/mr/PluginParameters */ \"./ts/mr/PluginParameters.ts\");\r\n/**\r\n *\r\n * [2021/5/26]\r\n * ----------\r\n * - 全ての Unit は罠にかかる可能性を持っている。\r\n * - 仲間 Unit は TrapThrough Trait を持たせて、一切かからないようにしてみる。仲間システム作ったら。\r\n * - Trap は中立勢力にする。今のところ敵対でも問題ないかもしれないけど、多分中立の方が自然。\r\n * - 条件によってはモンスターに対して効果発動することもあるし\r\n * - 範囲攻撃巻物の対象外にしやすいし\r\n * - ミニマップ表示やりやすいし\r\n * - Trap は罠にかけたい勢力を持っている (デフォルトは Player)\r\n * - 罠にかけたい勢力側に TrapMaster がいたら、その敵対勢力を罠にかけるようにする。\r\n * - 両方の勢力に TrapMaster がいたら、何もしない。\r\n *\r\n * [2021/11/14] 罠の発動確率\r\n * ----------\r\n * 原作だと、見えない状態と見えている状態で踏んだ時で確率が変わる。\r\n * またダンジョンによっても変わる。(逃げコンセプトダンジョンなど)\r\n * 罠によっても変わる?\r\n * 強化バネやワープポイント、ポイントスイッチは罠に見えるが罠ではない。どちらかというと階段に近いオブジェクト。\r\n *\r\n */\r\nlet LTrapBehavior = LTrapBehavior_1 = class LTrapBehavior extends LBehavior_1.LBehavior {\r\n constructor() {\r\n super();\r\n /*\r\n 効果は Trap を performer とした Emittor として発動する\r\n ----------\r\n 踏んだ人が必ず Trap の上にいるとは限らない。\r\n 代表的なものだと、ワナ作動の巻物。\r\n */\r\n this._exposed = false;\r\n this._recharging = false;\r\n this._launching = false;\r\n }\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LTrapBehavior_1);\r\n b._exposed = this._exposed;\r\n return b;\r\n }\r\n /**\r\n * 露出しているかどうか。\r\n * 罠が踏まれたり、空振りや魔法弾の通過で発見された状態で、勢力に関わらず可視である。\r\n */\r\n exposed() {\r\n return this._exposed;\r\n }\r\n isExposedFor(target) {\r\n if (MRLively_1.MRLively.mapView.currentMap.trapClarity)\r\n return true;\r\n if (target.hasTrait(MRBasics_1.MRBasics.traits.ForceVisible))\r\n return true;\r\n return this.exposed();\r\n }\r\n setExposed(value) {\r\n this._exposed = value;\r\n }\r\n onQueryReactions(self, reactions) {\r\n // Trap 側で Action を非表示にする方がよいだろう。\r\n // 例えば Trap を標準システムではなく拡張と考えた時、\r\n // Player 側からは「Trap であるか」といった判断はするべきではない。\r\n reactions.mutableRemoveAll(x => x.actionId == MRBasics_1.MRBasics.actions.PickActionId ||\r\n x.actionId == MRBasics_1.MRBasics.actions.ThrowActionId);\r\n reactions.push({ actionId: MRBasics_1.MRBasics.actions.trample });\r\n }\r\n onAttached(self) {\r\n (0, Common_1.assert)(this.ownerEntity().findEntityBehavior(LItemBehavior_1.LItemBehavior));\r\n MRLively_1.MRLively.eventServer.subscribe(MRBasics_1.MRBasics.events.skillEmitted, this);\r\n }\r\n onDetached(self) {\r\n MRLively_1.MRLively.eventServer.unsubscribe(MRBasics_1.MRBasics.events.skillEmitted, this);\r\n }\r\n onEvent(cctx, eventId, args) {\r\n if (eventId == MRBasics_1.MRBasics.events.skillEmitted) {\r\n const entity = this.ownerEntity();\r\n const e = args;\r\n if (this.checkValidTarget(e.performer) && // 攻撃者はこの罠にかかることができる?\r\n e.skillId == MRData_1.MRData.system.skills.normalAttack && // 通常攻撃?\r\n e.targets.length == 0 && // 攻撃対象がない?(明示的な空振り)\r\n !UMovement_1.UMovement.checkDiagonalWallCornerCrossing(e.performer, e.performer.dir) && // 壁角チェック\r\n UMovement_1.UMovement.getFrontBlock(e.performer).containsEntity(entity)) { // 目の前にこの罠がある?\r\n // 空振りによる発見\r\n this._exposed = true;\r\n }\r\n }\r\n return LEventServer_1.LEventResult.Pass;\r\n }\r\n checkValidTarget(entity) {\r\n return entity.getOutwardFactionId() === MRData_1.MRData.system.trapTargetFactionId;\r\n }\r\n triggerRate(target) {\r\n if (this.isExposedFor(target))\r\n return PluginParameters_1.paramExposedTrapTriggerRate;\r\n else\r\n return PluginParameters_1.paramHiddenTrapTriggerRate;\r\n }\r\n testTrigger(target, rand) {\r\n // 罠回避の方がプラスステートなので優先してみる\r\n if (target.hasTrait(MRBasics_1.MRBasics.traits.DisableTrap))\r\n return false;\r\n // 罠必中はどちらかというとマイナスステート\r\n if (target.hasTrait(MRBasics_1.MRBasics.traits.DrawInTrap))\r\n return true;\r\n const r = rand.nextIntWithMax(100);\r\n return (r < this.triggerRate(target));\r\n }\r\n [LBehavior_1.onPreStepFeetProcess](e, cctx) {\r\n const self = this.ownerEntity();\r\n const target = e.sender;\r\n // この罠にかかることができる?\r\n if (!this.checkValidTarget(target))\r\n return SCommand_1.SCommandResponse.Pass;\r\n // Exposed を変更する前に発動判定\r\n const trigger = this.testTrigger(target, cctx.random());\r\n // 発動の成否にかかわらず、露出\r\n this.setExposed(true);\r\n cctx.postMessage((0, Common_1.tr)(\"{0} を踏んだ!\", self.getDisplayName().name));\r\n if (trigger) {\r\n this._launching = true;\r\n MRSystem_1.MRSystem.sequelContext.trapPerforming = true;\r\n }\r\n else {\r\n cctx.postMessage((0, Common_1.tr)(\"しかし罠にはかからなかった。\"));\r\n }\r\n return SCommand_1.SCommandResponse.Canceled;\r\n }\r\n [LBehavior_1.onPerformStepFeetProcess](e, cctx) {\r\n const self = this.ownerEntity();\r\n const target = e.sender;\r\n if (this._launching) {\r\n this._launching = false;\r\n this.performTrapEffect(self, cctx, target.dir);\r\n return SCommand_1.SCommandResponse.Handled;\r\n }\r\n return SCommand_1.SCommandResponse.Canceled;\r\n }\r\n // [onWalkedOnTopReaction](e: CommandArgs, cctx: SCommandContext): SCommandResponse {\r\n // const self = this.ownerEntity();\r\n // const target = e.sender;\r\n // // この罠にかかることができる?\r\n // if (!this.checkValidTarget(target)) return SCommandResponse.Pass;\r\n // // Exposed を変更する前に発動判定\r\n // const trigger = this.testTrigger(target, cctx.random());\r\n // // 発動の成否にかかわらず、露出\r\n // this.setExposed(true);\r\n // cctx.postMessage(tr(\"{0} を踏んだ!\", self.getDisplayName().name));\r\n // if (trigger) {\r\n // this.performTrapEffect(self, cctx, target.dir);\r\n // }\r\n // else {\r\n // cctx.postMessage(tr(\"しかし罠にはかからなかった。\"));\r\n // }\r\n // return SCommandResponse.Handled;\r\n // }\r\n onActivityReaction(self, cctx, activity) {\r\n // [踏まれた]\r\n if (activity.actionId() == MRBasics_1.MRBasics.actions.trample) {\r\n this.performTrapEffect(self, cctx, activity.actor().dir);\r\n }\r\n else if (activity.actionId() == MRBasics_1.MRBasics.actions.FallActionId) {\r\n this.performTrapEffect(self, cctx, activity.actor().dir);\r\n }\r\n return SCommand_1.SCommandResponse.Pass;\r\n }\r\n performTrapEffect(self, cctx, actorDir) {\r\n if (this._recharging)\r\n return;\r\n //const trapItem = this.ownerEntity().getBehavior(LItemBehavior);\r\n //const itemData = trapItem.itemData();\r\n // const emittors = self.data().emittorSet.emittors(DEffectCause.Affect);\r\n // assert(emittors.length == 1); // TODO: とりあえず\r\n //const emittor = emittors[0];\r\n const emittor = self.data.mainEmittor();\r\n if (emittor) {\r\n if (true) {\r\n SEmittorPerformer_1.SEmittorPerformer.makeWithEmitor(self, self, emittor)\r\n .setDffectDirection(UMovement_1.UMovement.getRightDir(actorDir))\r\n .setProjectilePriorityEffectSet(emittor)\r\n .perform(cctx);\r\n }\r\n // else {\r\n // const subject = new SEffectorFact(e.self, emittor.effectSet, SEffectIncidentType.IndirectAttack, target.dir);\r\n // const effectContext = new SEffectContext(subject, cctx.random());\r\n // //console.log(result);\r\n // cctx.postAnimation(e.sender, 35, true);\r\n // // TODO: ここでラムダ式も post して apply したい。\r\n // cctx.postCall(() => {\r\n // effectContext.applyWithWorth(cctx, [target]);\r\n // });\r\n // }\r\n //cctx.postMessage(tr(\"しかし ワナには かからなかった。\"));\r\n }\r\n this._recharging = true;\r\n this._exposed = true;\r\n self.addState(MRBasics_1.MRBasics.states.trapPerformed);\r\n }\r\n onStepEnd(cctx) {\r\n this._recharging = false;\r\n return SCommand_1.SCommandResponse.Pass;\r\n }\r\n /*\r\n [2021/10/31] カウンターアタックについて\r\n ----------\r\n 特定の効果を受けたら、スキルorEffectを発動する仕組み。\r\n\r\n 通常の行動順ルーチンにおける「反撃」ではないため注意。\r\n\r\n EffectContextの中から即時発動するのは避けたほうがいいかも?\r\n 例えば攻撃ヒット後、移動する効果(ヒットアンドアウェイスキルなど?)の拡張を考えると、\r\n Target側はまず「予約」しておき、効果適用処理が一通り終わった後に発動するのがいいだろう。\r\n (3方向同時攻撃などを考えると、本当に完全に終わった時が望ましい)\r\n\r\n */\r\n //_required = false;\r\n onEffectPerformed(self, cctx, emittor) {\r\n // if (!this._recharging) {\r\n // this._required = true;\r\n // // for (const param of self._effectResult.paramEffects) {\r\n // // }\r\n // }\r\n return SCommand_1.SCommandResponse.Pass;\r\n }\r\n onCounterAction(self, cctx, data) {\r\n if (!this._recharging) {\r\n this.performTrapEffect(self, cctx, 0);\r\n }\r\n return SCommand_1.SCommandResponse.Handled;\r\n }\r\n};\r\nLTrapBehavior = LTrapBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LTrapBehavior);\r\nexports.LTrapBehavior = LTrapBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/behaviors/LTrapBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/behaviors/LUnitBehavior.ts": /*!*************************************************!*\ !*** ./ts/mr/lively/behaviors/LUnitBehavior.ts ***! \*************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LUnitBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LUnitBehavior = void 0;\r\nconst SCommand_1 = __webpack_require__(/*! ../../system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst SCommandContext_1 = __webpack_require__(/*! ../../system/SCommandContext */ \"./ts/mr/system/SCommandContext.ts\");\r\nconst LBehavior_1 = __webpack_require__(/*! ./LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst Helpers_1 = __webpack_require__(/*! ts/mr/system/Helpers */ \"./ts/mr/system/Helpers.ts\");\r\nconst LInventoryBehavior_1 = __webpack_require__(/*! ../entity/LInventoryBehavior */ \"./ts/mr/lively/entity/LInventoryBehavior.ts\");\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst UMovement_1 = __webpack_require__(/*! ts/mr/utility/UMovement */ \"./ts/mr/utility/UMovement.ts\");\r\nconst SEffectContext_1 = __webpack_require__(/*! ts/mr/system/SEffectContext */ \"./ts/mr/system/SEffectContext.ts\");\r\nconst LActivity_1 = __webpack_require__(/*! ../activities/LActivity */ \"./ts/mr/lively/activities/LActivity.ts\");\r\nconst LIdentifyer_1 = __webpack_require__(/*! ../LIdentifyer */ \"./ts/mr/lively/LIdentifyer.ts\");\r\nconst SSoundManager_1 = __webpack_require__(/*! ts/mr/system/SSoundManager */ \"./ts/mr/system/SSoundManager.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst LMap_1 = __webpack_require__(/*! ../LMap */ \"./ts/mr/lively/LMap.ts\");\r\nconst internal_1 = __webpack_require__(/*! ../internal */ \"./ts/mr/lively/internal.ts\");\r\nconst UName_1 = __webpack_require__(/*! ts/mr/utility/UName */ \"./ts/mr/utility/UName.ts\");\r\nconst SEmittorPerformer_1 = __webpack_require__(/*! ts/mr/system/SEmittorPerformer */ \"./ts/mr/system/SEmittorPerformer.ts\");\r\nconst SView_1 = __webpack_require__(/*! ts/mr/system/SView */ \"./ts/mr/system/SView.ts\");\r\nconst UAction_1 = __webpack_require__(/*! ts/mr/utility/UAction */ \"./ts/mr/utility/UAction.ts\");\r\nconst SEventExecutionDialog_1 = __webpack_require__(/*! ts/mr/system/dialogs/SEventExecutionDialog */ \"./ts/mr/system/dialogs/SEventExecutionDialog.ts\");\r\nconst DCommon_1 = __webpack_require__(/*! ts/mr/data/DCommon */ \"./ts/mr/data/DCommon.ts\");\r\nconst LGoldBehavior_1 = __webpack_require__(/*! ./LGoldBehavior */ \"./ts/mr/lively/behaviors/LGoldBehavior.ts\");\r\nconst USearch_1 = __webpack_require__(/*! ts/mr/utility/USearch */ \"./ts/mr/utility/USearch.ts\");\r\nconst ULimitations_1 = __webpack_require__(/*! ts/mr/utility/ULimitations */ \"./ts/mr/utility/ULimitations.ts\");\r\nconst LTrapBehavior_1 = __webpack_require__(/*! ./LTrapBehavior */ \"./ts/mr/lively/behaviors/LTrapBehavior.ts\");\r\nconst SFeetDialog_1 = __webpack_require__(/*! ts/mr/system/dialogs/SFeetDialog */ \"./ts/mr/system/dialogs/SFeetDialog.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ts/mr/system/MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst TStumble_1 = __webpack_require__(/*! ts/mr/transactions/TStumble */ \"./ts/mr/transactions/TStumble.ts\");\r\nconst TThrow_1 = __webpack_require__(/*! ts/mr/transactions/TThrow */ \"./ts/mr/transactions/TThrow.ts\");\r\nvar LFeetProcess;\r\n(function (LFeetProcess) {\r\n LFeetProcess[LFeetProcess[\"None\"] = 0] = \"None\";\r\n LFeetProcess[LFeetProcess[\"Dialog\"] = 1] = \"Dialog\";\r\n LFeetProcess[LFeetProcess[\"RideOnMessage\"] = 2] = \"RideOnMessage\";\r\n LFeetProcess[LFeetProcess[\"AutoPick\"] = 3] = \"AutoPick\";\r\n})(LFeetProcess || (LFeetProcess = {}));\r\n/**\r\n *\r\n */\r\nlet LUnitBehavior = LUnitBehavior_1 = class LUnitBehavior extends LBehavior_1.LBehavior {\r\n constructor() {\r\n super(...arguments);\r\n this._factionId = MRData_1.MRData.system.factions.neutral;\r\n this._speedLevel = 0; // ユニットテスト用。 1 が基本, 0は無効値。2は倍速。3は3倍速。-1は鈍足。\r\n this._waitTurnCount = 0; // 内部パラメータ。待ち数。次のターン、行動できるかどうか。\r\n this._manualMovement = false; // マニュアル操作するかどうか。\r\n this._targetingEntityId = 0; // AIMinor Phase で、攻撃対象を確定したかどうか。以降、Run 内では iterationCount が残っていても MinorAction を行わない\r\n //_straightDashing: boolean = false;\r\n this.dashInfo = undefined;\r\n this._fastforwarding = false;\r\n // 歩行移動したため、足元にある Entity に対して処理が必要かどうか。\r\n // アイテムを拾おうとしたり、罠の起動判定を行ったりする。\r\n this._requiredFeetProcess = false;\r\n this._requiredTrapProcess = false;\r\n }\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LUnitBehavior_1);\r\n b._factionId = this._factionId;\r\n b._speedLevel = this._speedLevel;\r\n b._waitTurnCount = this._waitTurnCount;\r\n b._manualMovement = this._manualMovement;\r\n b._targetingEntityId = this._targetingEntityId;\r\n b.dashInfo = this.dashInfo ? Object.assign({}, this.dashInfo) : undefined;\r\n b._fastforwarding = this._fastforwarding;\r\n return b;\r\n }\r\n onInitialized(self, params) {\r\n if (params) {\r\n this.setFactionId(params.factionId); // TODO: type\r\n }\r\n }\r\n // Battler params\r\n //factionId(): number { return this._factionId; }\r\n setFactionId(value) { this._factionId = value; return this; }\r\n //speedLevel(): number { return this._speedLevel; }\r\n setSpeedLevel(value) { this._speedLevel = value; return this; }\r\n waitTurnCount() { return this._waitTurnCount; }\r\n setWaitTurnCount(value) { this._waitTurnCount = value; return this; }\r\n manualMovement() { return this._manualMovement; }\r\n setManualMovement(value) { this._manualMovement = value; return this; }\r\n clearStraightDashing() {\r\n this.dashInfo = undefined;\r\n }\r\n queryInnermostFactionId() {\r\n return this._factionId;\r\n }\r\n queryOutwardFactionId() {\r\n return this._factionId;\r\n }\r\n requiredFeetProcess() {\r\n return this._requiredFeetProcess;\r\n }\r\n clearFeetProcess() {\r\n this._requiredFeetProcess = false;\r\n }\r\n requiredTrapProcess() {\r\n return this._requiredTrapProcess;\r\n }\r\n clearTrapProcess() {\r\n this._requiredTrapProcess = false;\r\n }\r\n // queryCharacterFileName(): DPrefabActualImage | undefined {\r\n // const self = this.ownerEntity();\r\n // const e = self.data;\r\n // const p = MRData.prefabs[e.prefabId];\r\n // const image = { ...p.image };\r\n // if (p.stateImages.length > 0) {\r\n // self.iterateStates(s => {\r\n // const i = p.stateImages.find(x => x.stateId == s.stateDataId());\r\n // if (i) {\r\n // image.characterName = i.characterName;\r\n // image.characterIndex = i.characterIndex;\r\n // return false;\r\n // }\r\n // return true;\r\n // });\r\n // }\r\n // return image;\r\n // }\r\n queryHomeLayer() {\r\n return DCommon_1.DBlockLayerKind.Unit;\r\n }\r\n onQueryActions(actions) {\r\n return actions.concat([\r\n MRBasics_1.MRBasics.actions.trample,\r\n MRBasics_1.MRBasics.actions.PickActionId,\r\n MRBasics_1.MRBasics.actions.PutActionId,\r\n //DBasics.actions.ExchangeActionId,\r\n MRBasics_1.MRBasics.actions.ThrowActionId,\r\n MRBasics_1.MRBasics.actions.ReadActionId,\r\n MRBasics_1.MRBasics.actions.ForwardFloorActionId,\r\n MRBasics_1.MRBasics.actions.BackwardFloorActionId,\r\n ]);\r\n }\r\n onQueryReactions(self, reactions) {\r\n reactions.push({ actionId: MRBasics_1.MRBasics.actions.AttackActionId });\r\n }\r\n onEffectSensed(self, cctx) {\r\n this.dashInfo = undefined;\r\n return SCommand_1.SCommandResponse.Pass;\r\n }\r\n onActivity(self, cctx, actx) {\r\n const subject = new SEffectContext_1.SEffectSubject(self);\r\n const activity = actx.activity();\r\n if (self.traitsWithId(MRBasics_1.MRBasics.traits.SealActivity, activity.actionId()).length > 0) {\r\n cctx.postMessage((0, Common_1.tr2)(\"しかしなにもおこらなかった。\"));\r\n return SCommand_1.SCommandResponse.Canceled;\r\n }\r\n // 演出の処理\r\n {\r\n const action = MRData_1.MRData.skills[activity.actionId()];\r\n const name = LIdentifyer_1.LEntityDescription.makeDisplayText(UName_1.UName.makeUnitName(self), LIdentifyer_1.DescriptionHighlightColor.UnitName);\r\n cctx.displayFlavorEffect(self, action.flavorEffect, {\r\n messageFormatArgs: [name],\r\n motionObjectEntity: activity.hasObject() ? activity.object() : undefined\r\n });\r\n }\r\n if (activity.entityDirection() > 0) {\r\n self.dir = activity.entityDirection();\r\n }\r\n if (activity.actionId() == MRBasics_1.MRBasics.actions.DirectionChangeActionId) {\r\n //self.dir = activity.direction();\r\n return SCommand_1.SCommandResponse.Handled;\r\n }\r\n else if (activity.actionId() == MRBasics_1.MRBasics.actions.MoveToAdjacentActionId) {\r\n if (self.hasTrait(MRBasics_1.MRBasics.traits.DisableMovement)) {\r\n return SCommand_1.SCommandResponse.Canceled;\r\n }\r\n const offset = Helpers_1.Helpers.dirToTileOffset(activity.effectDirection());\r\n const startX = self.mx;\r\n const startY = self.my;\r\n // Prepare event\r\n const args = { walker: self, targetX: self.mx + offset.x, targetY: self.my + offset.y };\r\n if (!MRLively_1.MRLively.eventServer.publish(cctx, MRBasics_1.MRBasics.events.preWalk, args))\r\n return SCommand_1.SCommandResponse.Canceled;\r\n const dashInfo = activity.args();\r\n if (dashInfo && dashInfo) {\r\n this.dashInfo = dashInfo;\r\n }\r\n const layer = self.getHomeLayer();\r\n if (UMovement_1.UMovement.moveEntity(cctx, self, self.mx + offset.x, self.my + offset.y, LMap_1.MovingMethod.Walk, layer)) {\r\n cctx.postSequel(self, MRBasics_1.MRBasics.sequels.MoveSequel).setStartPosition(startX, startY);\r\n // Projectile の移動では通知したくないので、UMovement.moveEntity() の中ではなく Unit の移動側で通知する。\r\n MRLively_1.MRLively.eventServer.publish(cctx, MRBasics_1.MRBasics.events.walked, args);\r\n // 次の DialogOpen 時に足元の優先コマンドを表示したりする\r\n self.immediatelyAfterAdjacentMoving = true;\r\n this._requiredFeetProcess = true;\r\n this._requiredTrapProcess = true;\r\n return SCommand_1.SCommandResponse.Handled;\r\n }\r\n }\r\n else if (activity.actionId() == MRBasics_1.MRBasics.actions.performSkill) {\r\n if (activity.hasEffectDirection())\r\n self.dir = activity.effectDirection();\r\n SEmittorPerformer_1.SEmittorPerformer.makeWithSkill(self, self, activity.skillId()).perform(cctx);\r\n return SCommand_1.SCommandResponse.Handled;\r\n }\r\n else if (activity.actionId() == MRBasics_1.MRBasics.actions.ForwardFloorActionId ||\r\n activity.actionId() == MRBasics_1.MRBasics.actions.BackwardFloorActionId) {\r\n const reactor = activity.object();\r\n if (reactor) {\r\n cctx.post(reactor, self, subject, undefined, LBehavior_1.onProceedFloorReaction);\r\n }\r\n }\r\n else if (activity.actionId() == MRBasics_1.MRBasics.actions.PickActionId) {\r\n const inventory = self.findEntityBehavior(LInventoryBehavior_1.LInventoryBehavior);\r\n if (inventory) {\r\n const block = MRLively_1.MRLively.mapView.currentMap.block(self.mx, self.my);\r\n const layer = block.layer(DCommon_1.DBlockLayerKind.Ground);\r\n const itemEntity = layer.firstEntity();\r\n if (itemEntity) {\r\n actx.postHandleActivity(cctx, itemEntity)\r\n .then(() => {\r\n const name = LIdentifyer_1.LEntityDescription.makeDisplayText(UName_1.UName.makeUnitName(self), LIdentifyer_1.DescriptionHighlightColor.UnitName);\r\n const gold = itemEntity.findEntityBehavior(LGoldBehavior_1.LGoldBehavior);\r\n if (gold) {\r\n // お金だった\r\n inventory.gainGold(gold.gold());\r\n MRLively_1.MRLively.mapView.currentMap._removeEntity(itemEntity);\r\n cctx.postDestroy(itemEntity);\r\n cctx.postMessage((0, Common_1.tr2)(\"%1は%2をひろった\").format(name, UName_1.UName.makeNameAsItem(itemEntity)));\r\n SSoundManager_1.SSoundManager.playPickItem();\r\n }\r\n else {\r\n // 普通のアイテムだった\r\n if (inventory.canAddEntityWithStacking(itemEntity)) {\r\n MRLively_1.MRLively.mapView.currentMap._removeEntity(itemEntity);\r\n inventory.addEntityWithStacking(itemEntity);\r\n cctx.postMessage((0, Common_1.tr2)(\"%1は%2をひろった\").format(name, UName_1.UName.makeNameAsItem(itemEntity)));\r\n SSoundManager_1.SSoundManager.playPickItem();\r\n }\r\n else {\r\n cctx.postMessage((0, Common_1.tr2)(\"持ち物がいっぱいで拾えない。\"));\r\n cctx.postMessage((0, Common_1.tr2)(\"%1に乗った。\").format(UName_1.UName.makeNameAsItem(itemEntity)));\r\n }\r\n }\r\n return SCommandContext_1.SHandleCommandResult.Resolved;\r\n });\r\n }\r\n }\r\n }\r\n else if (activity.actionId() == MRBasics_1.MRBasics.actions.PutActionId) {\r\n // Prepare event\r\n const args = { actor: self };\r\n if (!MRLively_1.MRLively.eventServer.publish(cctx, MRBasics_1.MRBasics.events.prePut, args))\r\n return SCommand_1.SCommandResponse.Canceled;\r\n const itemEntity = activity.object(); //cmd.reactor();\r\n const inventory = self.findEntityBehavior(LInventoryBehavior_1.LInventoryBehavior);\r\n (0, Common_1.assert)(itemEntity);\r\n (0, Common_1.assert)(inventory);\r\n const block = MRLively_1.MRLively.mapView.currentMap.block(self.mx, self.my);\r\n const layer = block.layer(DCommon_1.DBlockLayerKind.Ground);\r\n // 足元に置けそうなら試行\r\n if (!layer.isContainsAnyEntity()) {\r\n cctx.postCommandTask(new SCommand_1.STestTakeItemCommand(itemEntity, self))\r\n .then2(() => {\r\n if (ULimitations_1.ULimitations.isItemCountFullyInMap()) {\r\n cctx.postMessage((0, Common_1.tr2)(\"不思議な力で行動できなかった。\"));\r\n }\r\n else {\r\n itemEntity.removeFromParent();\r\n MRLively_1.MRLively.mapView.currentMap.appearEntity(itemEntity, self.mx, self.my);\r\n cctx.postMessage((0, Common_1.tr)(\"{0} を置いた。\", UName_1.UName.makeNameAsItem(itemEntity)));\r\n cctx.post(itemEntity, self, subject, undefined, internal_1.onGrounded);\r\n }\r\n });\r\n }\r\n else {\r\n cctx.postMessage((0, Common_1.tr)(\"置けなかった。\"));\r\n }\r\n return SCommand_1.SCommandResponse.Handled;\r\n }\r\n else if (activity.actionId() == MRBasics_1.MRBasics.actions.ThrowActionId) {\r\n // FIXME: [撃つ] とかなり似ているので、長くなるようならまとめたほうがいいかも\r\n TThrow_1.TThrow.throwAllStack(cctx, self, self, activity.object());\r\n return SCommand_1.SCommandResponse.Handled;\r\n }\r\n else if (activity.actionId() == MRBasics_1.MRBasics.actions.ShootActionId) {\r\n TThrow_1.TThrow.throwSingleStack(cctx, self, self, activity.object());\r\n return SCommand_1.SCommandResponse.Handled;\r\n }\r\n else if (activity.actionId() == MRBasics_1.MRBasics.actions.ExchangeActionId) {\r\n const inventory = self.getEntityBehavior(LInventoryBehavior_1.LInventoryBehavior);\r\n const item1 = activity.object();\r\n const block = MRLively_1.MRLively.mapView.currentMap.block(self.mx, self.my);\r\n const layer = block.layer(DCommon_1.DBlockLayerKind.Ground);\r\n const item2 = layer.firstEntity();\r\n if (item2) {\r\n // TODO: 呪いの処理など、アイテムを今いる場所から取り外せるかチェック入れる\r\n MRLively_1.MRLively.mapView.currentMap._removeEntity(item2);\r\n inventory.removeEntity(item1);\r\n MRLively_1.MRLively.mapView.currentMap.appearEntity(item1, self.mx, self.my);\r\n inventory.addEntity(item2);\r\n cctx.postMessage((0, Common_1.tr)(\"{0} と {1} を交換した。\", UName_1.UName.makeNameAsItem(item1), UName_1.UName.makeNameAsItem(item2)));\r\n SSoundManager_1.SSoundManager.playPickItem();\r\n }\r\n else {\r\n cctx.postMessage((0, Common_1.tr2)(\"足元には何もない。\"));\r\n }\r\n }\r\n else if (activity.actionId() == MRBasics_1.MRBasics.actions.WaveActionId) {\r\n cctx.postSequel(self, MRBasics_1.MRBasics.sequels.attack);\r\n actx.postHandleActivity(cctx, activity.object());\r\n return SCommand_1.SCommandResponse.Handled;\r\n }\r\n else if (activity.actionId() == MRBasics_1.MRBasics.actions.EatActionId) {\r\n cctx.postSequel(self, MRBasics_1.MRBasics.sequels.useItem, undefined, undefined, activity.object());\r\n actx.postHandleActivity(cctx, activity.object());\r\n return SCommand_1.SCommandResponse.Handled;\r\n }\r\n // [読む] ※↑の[振る] や EaterBehavior とほぼ同じ実装になっている。共通化したいところ。\r\n else if (activity.actionId() == MRBasics_1.MRBasics.actions.ReadActionId) {\r\n cctx.postSequel(self, MRBasics_1.MRBasics.sequels.useItem, undefined, undefined, activity.object());\r\n actx.postHandleActivity(cctx, activity.object());\r\n return SCommand_1.SCommandResponse.Handled;\r\n }\r\n else if (activity.actionId() == MRBasics_1.MRBasics.actions.PutInActionId) {\r\n const selfInventory = self.getEntityBehavior(LInventoryBehavior_1.LInventoryBehavior);\r\n const storage = activity.object();\r\n const storageInventory = storage.getEntityBehavior(LInventoryBehavior_1.LInventoryBehavior);\r\n const items = activity.objects2();\r\n for (const item of items) {\r\n cctx.postCommandTask(new SCommand_1.STestTakeItemCommand(item, self)) // item を取り出せる?\r\n .thenCommandTask(new SCommand_1.STestAddItemCommand(storage, item)) // item を格納できる?\r\n .then2(c => {\r\n item.removeFromParent();\r\n storageInventory.addEntity(item);\r\n cctx.postMessage((0, Common_1.tr)(\"{0} に {1} を入れた。\", UName_1.UName.makeNameAsItem(storage), UName_1.UName.makeNameAsItem(item)));\r\n });\r\n // item.removeFromParent();\r\n // storageInventory.addEntity(item);\r\n // cctx.postMessage(tr(\"{0} に {1} を入れた。\", UName.makeNameAsItem(storage), UName.makeNameAsItem(item)));\r\n }\r\n }\r\n else if (activity.actionId() == MRBasics_1.MRBasics.actions.PickOutActionId) {\r\n const selfInventory = self.getEntityBehavior(LInventoryBehavior_1.LInventoryBehavior);\r\n for (const item of activity.objects2()) {\r\n cctx.postCommandTask(new SCommand_1.STestTakeItemCommand(item, self)) // item を取り出せる?\r\n .thenCommandTask(new SCommand_1.STestAddItemCommand(self, item)) // item を格納できる?\r\n .then2(c => {\r\n item.removeFromParent();\r\n selfInventory.addEntity(item);\r\n cctx.postMessage((0, Common_1.tr)(\"{0} を取り出した。\", UName_1.UName.makeNameAsItem(item)));\r\n });\r\n }\r\n //PickOutActionId\r\n }\r\n else if (activity.actionId() == MRBasics_1.MRBasics.actions.talk) {\r\n const target = UAction_1.UAction.findTalkableFront(self);\r\n if (target) {\r\n cctx.postCall(() => {\r\n target.iterateBehaviorsReverse(b => {\r\n return b.onTalk(target, cctx, self) == SCommand_1.SCommandResponse.Pass;\r\n });\r\n });\r\n }\r\n }\r\n else if (activity.actionId() == MRBasics_1.MRBasics.actions.dialogResult) {\r\n actx.postHandleActivity(cctx, activity.object());\r\n return SCommand_1.SCommandResponse.Handled;\r\n }\r\n else if (activity.actionId() == MRBasics_1.MRBasics.actions.stumble) {\r\n TStumble_1.TStumble.postStumble(cctx, self, self.dir);\r\n //return SCommandResponse.Handled;\r\n }\r\n else if (activity.actionId() == MRBasics_1.MRBasics.actions.trample) {\r\n const target = USearch_1.USearch.getFirstUnderFootEntity(self);\r\n if (target) {\r\n actx.postHandleActivity(cctx, target);\r\n return SCommand_1.SCommandResponse.Handled;\r\n }\r\n }\r\n return SCommand_1.SCommandResponse.Pass;\r\n }\r\n [LBehavior_1.onAttackReaction](args, cctx) {\r\n const self = args.self;\r\n //const effectContext = cmd.effectContext();\r\n const effectContext = args.args.effectContext;\r\n if (effectContext) {\r\n const targets = [self];\r\n effectContext.applyWithWorth(cctx, targets)\r\n .then(() => {\r\n if (!USearch_1.USearch.hasBlindness(self)) {\r\n // 相手が可視であれば、その方向を向く\r\n const subject = effectContext.effectorFact().subject();\r\n if (SView_1.SView.getEntityVisibility(subject).visible) {\r\n self.dir = UMovement_1.UMovement.getLookAtDir(self, subject);\r\n }\r\n }\r\n for (const target of targets) {\r\n if (target._effectResult.isHit()) {\r\n cctx.post(target, self, new SEffectContext_1.SEffectSubject(effectContext.effectorFact().subject()), undefined, LBehavior_1.onDirectAttackDamaged);\r\n }\r\n }\r\n cctx.postCall(() => {\r\n self.sendPartyEvent(MRBasics_1.MRBasics.events.effectReacted, undefined);\r\n });\r\n return true;\r\n });\r\n return SCommand_1.SCommandResponse.Handled;\r\n }\r\n return SCommand_1.SCommandResponse.Pass;\r\n }\r\n [internal_1.onPreStepFeetProcess_Actor](e, cctx) {\r\n const self = this.ownerEntity();\r\n const [result, targetEntity] = this.judgeFeetProcess(self);\r\n if (result == LFeetProcess.Dialog) {\r\n MRSystem_1.MRSystem.sequelContext.trapPerforming = true;\r\n }\r\n return SCommand_1.SCommandResponse.Pass;\r\n }\r\n [LBehavior_1.onWalkedOnTopAction](args, cctx) {\r\n const self = this.ownerEntity();\r\n const [result, targetEntity] = this.judgeFeetProcess(self);\r\n switch (result) {\r\n case LFeetProcess.None:\r\n break;\r\n case LFeetProcess.Dialog:\r\n if (targetEntity) {\r\n cctx.openDialog(self, new SFeetDialog_1.SFeetDialog(self, targetEntity), false);\r\n }\r\n break;\r\n case LFeetProcess.RideOnMessage:\r\n if (targetEntity) {\r\n cctx.postMessage((0, Common_1.tr2)(\"%1 に乗った。\").format(UName_1.UName.makeNameAsItem(targetEntity)));\r\n }\r\n break;\r\n case LFeetProcess.AutoPick:\r\n // 歩行による自動拾得から実行される場合、この時点では Sequel は Flush されていないことがある。\r\n // v0.5.0 時点では Pick のハンドリングでは REGame.map._removeEntity() を直接実行しているので、\r\n // その前に Flush しておかないと、移動前にいきなり Item が消えたように見えてしまう。\r\n MRSystem_1.MRSystem.sequelContext.attemptFlush(true);\r\n cctx.postActivity(LActivity_1.LActivity.makePick(self));\r\n break;\r\n default:\r\n throw new Error(\"Unreachable.\");\r\n }\r\n return SCommand_1.SCommandResponse.Pass;\r\n }\r\n // 歩行移動時、足元に何かアクションを行えるものがあれば、そのアクションをチェックする。\r\n judgeFeetProcess(self) {\r\n if (this._manualMovement) {\r\n if (self.immediatelyAfterAdjacentMoving) {\r\n const targetEntity = MRLively_1.MRLively.mapView.currentMap.firstFeetEntity(self);\r\n if (targetEntity && !targetEntity.findEntityBehavior(LTrapBehavior_1.LTrapBehavior)) {\r\n const reactions = targetEntity.queryReactions();\r\n if (reactions.length > 0) {\r\n if (!!reactions.find(x => x.actionId == MRBasics_1.MRBasics.actions.PickActionId) &&\r\n !targetEntity._shopArticle.isSalling()) {\r\n if (this.dashInfo && this.dashInfo.type == LActivity_1.LDashType.StraightDash) {\r\n return [LFeetProcess.RideOnMessage, targetEntity];\r\n }\r\n else {\r\n // 歩行移動時に足元に拾えるものがあれば取得試行\r\n return [LFeetProcess.AutoPick, targetEntity];\r\n }\r\n }\r\n else {\r\n return [LFeetProcess.Dialog, targetEntity];\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return [LFeetProcess.None, undefined];\r\n }\r\n onTalk(self, cctx, person) {\r\n cctx.openDialog(self, new SEventExecutionDialog_1.SEventExecutionDialog(self.rmmzEventId, self, person), false);\r\n return SCommand_1.SCommandResponse.Pass;\r\n }\r\n onDecisionPhase(self, cctx, phase) {\r\n if (phase == internal_1.DecisionPhase.ResolveAdjacentAndMovingTarget) {\r\n return SCommand_1.SPhaseResult.Pass;\r\n }\r\n return SCommand_1.SPhaseResult.Pass;\r\n }\r\n};\r\nLUnitBehavior = LUnitBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LUnitBehavior);\r\nexports.LUnitBehavior = LUnitBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/behaviors/LUnitBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/behaviors/activities/LProjectileBehavior.ts": /*!******************************************************************!*\ !*** ./ts/mr/lively/behaviors/activities/LProjectileBehavior.ts ***! \******************************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LProjectileBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LProjectileBehavior = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst Helpers_1 = __webpack_require__(/*! ts/mr/system/Helpers */ \"./ts/mr/system/Helpers.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst SEffectContext_1 = __webpack_require__(/*! ts/mr/system/SEffectContext */ \"./ts/mr/system/SEffectContext.ts\");\r\nconst UMovement_1 = __webpack_require__(/*! ts/mr/utility/UMovement */ \"./ts/mr/utility/UMovement.ts\");\r\nconst LBehavior_1 = __webpack_require__(/*! ../LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\nconst LMap_1 = __webpack_require__(/*! ts/mr/lively/LMap */ \"./ts/mr/lively/LMap.ts\");\r\nconst UAction_1 = __webpack_require__(/*! ts/mr/utility/UAction */ \"./ts/mr/utility/UAction.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst SEffectApplyer_1 = __webpack_require__(/*! ts/mr/system/SEffectApplyer */ \"./ts/mr/system/SEffectApplyer.ts\");\r\nconst DEffect_1 = __webpack_require__(/*! ts/mr/data/DEffect */ \"./ts/mr/data/DEffect.ts\");\r\nconst DCommon_1 = __webpack_require__(/*! ts/mr/data/DCommon */ \"./ts/mr/data/DCommon.ts\");\r\nconst SActionHitTest_1 = __webpack_require__(/*! ts/mr/system/SActionHitTest */ \"./ts/mr/system/SActionHitTest.ts\");\r\nconst PluginParameters_1 = __webpack_require__(/*! ts/mr/PluginParameters */ \"./ts/mr/PluginParameters.ts\");\r\n/**\r\n * 投射可能であるか。従来の Throwable の拡張。\r\n *\r\n * それは、\r\n * - 直線状に投げることができる。\r\n * - 吹き飛ばすことができる。\r\n * - 別の Unit に衝突することができる。\r\n * - 自然落下することができる。\r\n * - 壁に当たって落下することができる。\r\n */\r\nlet LProjectileBehavior = LProjectileBehavior_1 = class LProjectileBehavior extends LBehavior_1.LBehavior {\r\n constructor() {\r\n super(...arguments);\r\n this.blowDirection = 0; // 吹き飛ばし方向\r\n this.blowMoveCount = 0; // 吹き飛ばし移動数\r\n //blowMoveCountMax: number = 0; // 吹き飛ばし移動数\r\n this._effectSet = 0;\r\n //private _effectSubject: LEntityId | undefined;\r\n this._penetration = false;\r\n }\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LProjectileBehavior_1);\r\n b.blowDirection = this.blowDirection;\r\n b.blowMoveCount = this.blowMoveCount;\r\n return b;\r\n }\r\n // こちらはアイテムが投げられたとき。\r\n static startMoveAsProjectile(cctx, entity, subject, dir, distance) {\r\n const common = entity.findEntityBehavior(LProjectileBehavior_1);\r\n (0, Common_1.assert)(common);\r\n // 普通のアイテムは吹き飛ばし扱いで移動開始\r\n common.blowDirection = dir;\r\n common.blowMoveCount = distance;\r\n //common.blowMoveCountMax = distance;\r\n //entity.dir = args.sender.dir;\r\n common._penetration = entity.hasTrait(MRBasics_1.MRBasics.traits.PenetrationItem);\r\n if (!common._penetration) {\r\n common._penetration = subject.entity().hasTrait(MRBasics_1.MRBasics.traits.PenetrationThrower);\r\n }\r\n if (common._penetration) {\r\n common.blowMoveCount = Infinity;\r\n }\r\n entity.addState(MRData_1.MRData.getState(\"kState_System_Projectile\").id, false);\r\n cctx.post(entity, entity, subject, undefined, LBehavior_1.onMoveAsProjectile);\r\n }\r\n // こちらは飛び道具効果のあるスキル(ブレスや魔法弾)\r\n static startMoveAsEffectProjectile(cctx, entity, subject, dir, length, effectSet) {\r\n const common = entity.findEntityBehavior(LProjectileBehavior_1);\r\n (0, Common_1.assert)(common);\r\n common._effectSet = effectSet.id;\r\n common.blowDirection = dir;\r\n common.blowMoveCount = length;\r\n entity.addState(MRData_1.MRData.getState(\"kState_System_Projectile\").id, false);\r\n cctx.post(entity, entity, subject, undefined, LBehavior_1.onMoveAsProjectile);\r\n }\r\n clearKnockback() {\r\n this.blowDirection = 0;\r\n this.blowMoveCount = 0;\r\n }\r\n hitType() {\r\n if (this._effectSet)\r\n return this.effectSet.hitType();\r\n return DEffect_1.DEffectHitType.Certain;\r\n }\r\n get effectSet() {\r\n (0, Common_1.assert)(this._effectSet);\r\n return MRData_1.MRData.emittors[this._effectSet].effectSuite;\r\n }\r\n onQueryReactions(self, reactions) {\r\n reactions.push({ actionId: MRBasics_1.MRBasics.actions.ThrowActionId });\r\n }\r\n // 投げられた\r\n [LBehavior_1.onThrowReaction](args, cctx) {\r\n const self = args.self;\r\n MRLively_1.MRLively.mapView.currentMap.appearEntity(self, self.mx, self.my, DCommon_1.DBlockLayerKind.Projectile);\r\n LProjectileBehavior_1.startMoveAsProjectile(cctx, self, args.subject, args.sender.dir, PluginParameters_1.paramThrowingDistance);\r\n return SCommand_1.SCommandResponse.Pass;\r\n }\r\n // Projectile として移動\r\n [LBehavior_1.onMoveAsProjectile](args, cctx) {\r\n const self = args.self;\r\n const common = self.findEntityBehavior(LProjectileBehavior_1);\r\n (0, Common_1.assert)(common);\r\n (0, Common_1.assert)(this.blowDirection != 0);\r\n //const args = (cmd.args() as REMoveToAdjacentArgs);\r\n const offset = Helpers_1.Helpers.dirToTileOffset(this.blowDirection);\r\n const tx = self.mx + offset.x;\r\n const ty = self.my + offset.y;\r\n self.dir = this.blowDirection;\r\n if (UMovement_1.UMovement.moveEntity(cctx, self, tx, ty, this._penetration ? LMap_1.MovingMethod.Penetration : LMap_1.MovingMethod.Projectile, DCommon_1.DBlockLayerKind.Projectile)) {\r\n cctx.postSequel(self, MRBasics_1.MRBasics.sequels.blowMoveSequel);\r\n common.blowMoveCount--;\r\n const subject = args.subject.entity(); //activity.subject();\r\n if (this._penetration) {\r\n this.processEffectForPenetration(cctx, self, tx, ty, args.subject);\r\n }\r\n else {\r\n this.processEffectForNormal(cctx, self, tx, ty, args.subject);\r\n }\r\n return SCommand_1.SCommandResponse.Handled;\r\n }\r\n else {\r\n // 移動できなかったら終了。\r\n // 遠投の場合もここに来る。\r\n this.endMoving(cctx, self, SCommand_1.SEndProjectileMovingCause.NoPassage);\r\n }\r\n return SCommand_1.SCommandResponse.Pass;\r\n }\r\n // [onCollideAction](args: CommandArgs, cctx: SCommandContext): SCommandResponse {\r\n // throw new Error(\"deprecated.\");\r\n // /*\r\n // if (this._effectSet) {\r\n // const self = args.self;\r\n // const target = args.sender;\r\n // const subject = args.subject;\r\n // cctx.postDestroy(self);\r\n // //this.applyEffect(cctx, self, args.sender, args.subject, DEffectCause.Affect);\r\n // const animationId = 1; // TODO:\r\n // const effectSubject = new SEffectorFact(subject.entity(), this._effectSet, SEffectIncidentType.IndirectAttack, this.blowDirection);\r\n // const effectContext = new SEffectContext(effectSubject, cctx.random());\r\n // cctx.postAnimation(target, animationId, true);\r\n // // アニメーションを Wait してから効果を発動したいので、ここでは post が必要。\r\n // cctx.postCall(() => {\r\n // effectContext.applyWithWorth(cctx, [target]);\r\n // });\r\n // return SCommandResponse.Handled;\r\n // }\r\n // else {\r\n // return SCommandResponse.Pass;\r\n // }\r\n // */\r\n // }\r\n processEffectForNormal(cctx, self, x, y, subject) {\r\n // 他 Unit との衝突判定\r\n const hitTarget = MRLively_1.MRLively.mapView.currentMap.block(x, y).aliveEntity(DCommon_1.DBlockLayerKind.Unit);\r\n if (hitTarget) {\r\n if (hitTarget.hasTrait(MRBasics_1.MRBasics.traits.PhysicalProjectileReflector)) {\r\n // 跳ね返し\r\n this.blowDirection = UMovement_1.UMovement.reverseDir(this.blowDirection);\r\n this.blowMoveCount++; // 水晶オブジェクトの下に落ちても困るので、移動数を+1\r\n cctx.postAnimation(hitTarget, 2, false);\r\n }\r\n else if (!SActionHitTest_1.SActionHitTest.testProjectle(subject.entity(), self, hitTarget, this.hitType(), cctx.random())) {\r\n // 当たらなかった\r\n this.endMoving(cctx, self, SCommand_1.SEndProjectileMovingCause.Fall);\r\n return;\r\n }\r\n else if (this._effectSet) {\r\n // スキルや魔法弾\r\n //\r\n // v0.4.0 時点ではこの if の else 側から投げられる CollideActivity を LProjectableBehavior(self) の onActivity で受けて処理をしていた。\r\n // しかしワナを実装するにあたり、Projectile が ItemBehavior も兼ねるケースが出てきた。\r\n // そのままだと ItemBehavior.onActivity の Collide ハンドラに流れてしまい優先 Effect が適用できないので、\r\n // 優先 Effect を持っている場合はここで直に処理してしまう。\r\n //\r\n // ちなみに矢の罠が出す Projectile を、木の矢アイテムではなくワナ専用の Entity を使う案もあったが、\r\n // 次のような理由で木の矢アイテムを直接飛ばしている。\r\n // - 外れて落下するときに新たに Entity を生成するのが若干煩雑だった\r\n // - 矢弾をキャッチしてインベントリに加える(マゼルン系)実装で都合が悪い\r\n const target = hitTarget; //activity.objects2()[0];\r\n cctx.postDestroy(self);\r\n //this.applyEffect(cctx, self, args.sender, args.subject, DEffectCause.Affect);\r\n const effectSubject = new SEffectApplyer_1.SEffectorFact(subject.entity(), this.effectSet, SEffectContext_1.SEffectIncidentType.IndirectAttack, this.blowDirection);\r\n const effectContext = new SEffectContext_1.SEffectContext(effectSubject, cctx.random());\r\n // アニメーションを Wait してから効果を発動したいので、ここでは post が必要。\r\n cctx.postCall(() => {\r\n effectContext.applyWithWorth(cctx, [target]);\r\n });\r\n return;\r\n }\r\n else {\r\n cctx.postCommandTask(new SCommand_1.SItemReactionCommand(MRBasics_1.MRBasics.actions.collide, self, hitTarget, [], subject.entity(), this.blowDirection));\r\n return;\r\n }\r\n }\r\n if (this.blowMoveCount <= 0) {\r\n this.endMoving(cctx, self, SCommand_1.SEndProjectileMovingCause.Fall);\r\n }\r\n else {\r\n cctx.post(self, self, subject, undefined, LBehavior_1.onMoveAsProjectile);\r\n }\r\n }\r\n processEffectForPenetration(cctx, self, x, y, subject) {\r\n (0, Common_1.assert)(this._penetration);\r\n // 他 Unit との衝突判定\r\n const hitTarget = MRLively_1.MRLively.mapView.currentMap.block(x, y).aliveEntity(DCommon_1.DBlockLayerKind.Unit);\r\n if (hitTarget) {\r\n if (!SActionHitTest_1.SActionHitTest.testProjectle(subject.entity(), self, hitTarget, this.hitType(), cctx.random())) {\r\n // 当たらなかった。貫通なので移動は続行する。\r\n }\r\n else if (this._effectSet) {\r\n throw new Error(\"Not implemented.\");\r\n }\r\n else {\r\n cctx.postEmitEffect(self, MRBasics_1.MRBasics.actions.collide, subject.entity(), hitTarget, this.blowDirection);\r\n }\r\n }\r\n cctx.post(self, self, subject, undefined, LBehavior_1.onMoveAsProjectile);\r\n /*\r\n 遠投状態の場合当たっても削除しないが、そもそも Projectile の削除はどちらで行うべき?\r\n ----------\r\n ItemBehavior 側の方が自然なことが多いかも?\r\n 例えば回数制限のある \"読む\" を考えると、この消滅は Item 側で行うべき。\r\n \r\n 今のところは 遠投くらいしか判断することが無いのでどちらでもよいのか?\r\n ひま投げ等関係なく、普通に投げられたとき、ぶつかっても消滅しないアイテムはあるか?\r\n → 原作では多分無い。\r\n\r\n ひま投げと絡めて考えると、PenetrationItem であっても、ひま投げされたときは貫通しない。(つまり、普通に消滅する)\r\n もし\r\n - ひま投げも collide を発動する。(これは自然)\r\n - 普通の投げで消滅する・しないを ItemBehavior 側でコントロールする。\r\n とした場合、 ItemBehavior はひま投げが原因かどうかを知らなければならない。これはどちらかというとよろしくない。\r\n\r\n 一方、マゼルン系は、collide を受けた時、その Projectile が Penetration であるかは知れないとダメ。\r\n\r\n 遠投ねだやしの動きは参考になりそう?\r\n 遠投は基本的に、マップ端までにヒットした Uint を一度リストに覚えておき、\r\n 遠投移動終了時に全部処理を行う。\r\n この時、このすべての Unit に対して、collide Activity を実行することになる。\r\n\r\n …でもそう考えると、これは Activity にするべきではないかもしれない。\r\n マゼルンは、Collide Activity をキャンセルすることでアイテムを飲み込む。\r\n 遠投状態で Collide Activity を送ってしまうと、貫通したのに飲み込まれたりする。\r\n \r\n\r\n */\r\n }\r\n endMoving(cctx, self, cause) {\r\n this.clearKnockback();\r\n const entityData = self.data;\r\n // 表示変更用のステート解除\r\n self.removeState(MRData_1.MRData.getState(\"kState_System_Projectile\").id);\r\n cctx.postCommandTask(new SCommand_1.SEndProjectileMovingCommand(self, cause))\r\n .then2(c => {\r\n /*\r\n 矢ワナは効果のオーバーライドがあるので startMoveAsEffectProjectile で開始する。\r\n しかしこれで開始した場合、end 時に entity が消滅する。\r\n \r\n 揮発性かどうかを属性として持たせたいが、次のどちらにするべきか?\r\n - Entity側に持たせる\r\n - Effect側に持たせる\r\n \r\n Entity側に持たせるのが無難かも。\r\n 指定し忘れで魔法弾が地面に落ちてしまうようなことも無いだろう。\r\n */\r\n if (entityData.volatilityProjectile || this._penetration) {\r\n cctx.postDestroy(self);\r\n }\r\n else {\r\n UAction_1.UAction.postFall(cctx, self);\r\n /*\r\n \r\n UAction.postStepOnGround(cctx, self);\r\n \r\n // TODO: 落下先に罠があるときは、postStepOnGround と postDropToGroundOrDestroy の間でここで罠の処理を行いたい。\r\n // 木の矢の罠の上にアイテムを落としたとき、矢の移動処理・攻撃判定が終わった後に、罠上に落ちたアイテムの drop の処理が行われる。\r\n \r\n cctx.postCall(() => {\r\n UAction.postDropOrDestroyOnCurrentPos(cctx, self, self.getHomeLayer());\r\n });\r\n \r\n // HomeLayer へ移動\r\n //SMovementCommon.locateEntity(self, self.x, self.y);\r\n //cctx.postSequel(self, RESystem.sequels.dropSequel, { movingDir: this.blowDirection });\r\n //this.clearKnockback();\r\n // TODO: 落下\r\n //SActionCommon.postStepOnGround(cctx, self);\r\n */\r\n }\r\n });\r\n }\r\n};\r\nLProjectileBehavior = LProjectileBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LProjectileBehavior);\r\nexports.LProjectileBehavior = LProjectileBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/behaviors/activities/LProjectileBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/entity/LEntity.ts": /*!****************************************!*\ !*** ./ts/mr/lively/entity/LEntity.ts ***! \****************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LEntity_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LEntity = exports.LParamChangedAction = void 0;\r\nconst LBehavior_1 = __webpack_require__(/*! ../behaviors/LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ../../system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ts/mr/system/MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst LObject_1 = __webpack_require__(/*! ../LObject */ \"./ts/mr/lively/LObject.ts\");\r\nconst LEffectResult_1 = __webpack_require__(/*! ts/mr/lively/LEffectResult */ \"./ts/mr/lively/LEffectResult.ts\");\r\nconst LFloorId_1 = __webpack_require__(/*! ../LFloorId */ \"./ts/mr/lively/LFloorId.ts\");\r\nconst DParameter_1 = __webpack_require__(/*! ts/mr/data/DParameter */ \"./ts/mr/data/DParameter.ts\");\r\nconst SAbilityFactory_1 = __webpack_require__(/*! ts/mr/system/SAbilityFactory */ \"./ts/mr/system/SAbilityFactory.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst DEntity_1 = __webpack_require__(/*! ts/mr/data/DEntity */ \"./ts/mr/data/DEntity.ts\");\r\nconst SEntityFactory_1 = __webpack_require__(/*! ts/mr/system/SEntityFactory */ \"./ts/mr/system/SEntityFactory.ts\");\r\nconst LParam_1 = __webpack_require__(/*! ../LParam */ \"./ts/mr/lively/LParam.ts\");\r\nconst UState_1 = __webpack_require__(/*! ts/mr/utility/UState */ \"./ts/mr/utility/UState.ts\");\r\nconst DEffect_1 = __webpack_require__(/*! ts/mr/data/DEffect */ \"./ts/mr/data/DEffect.ts\");\r\nconst LReward_1 = __webpack_require__(/*! ../LReward */ \"./ts/mr/lively/LReward.ts\");\r\nconst DCommon_1 = __webpack_require__(/*! ../../data/DCommon */ \"./ts/mr/data/DCommon.ts\");\r\nconst LActionToken_1 = __webpack_require__(/*! ../LActionToken */ \"./ts/mr/lively/LActionToken.ts\");\r\nconst LCommon_1 = __webpack_require__(/*! ../LCommon */ \"./ts/mr/lively/LCommon.ts\");\r\nconst LShopArticle_1 = __webpack_require__(/*! ../LShopArticle */ \"./ts/mr/lively/LShopArticle.ts\");\r\nconst LSchedulingResult_1 = __webpack_require__(/*! ../LSchedulingResult */ \"./ts/mr/lively/LSchedulingResult.ts\");\r\nconst LDeathResult_1 = __webpack_require__(/*! ../LDeathResult */ \"./ts/mr/lively/LDeathResult.ts\");\r\nconst LUnitBehavior_1 = __webpack_require__(/*! ../behaviors/LUnitBehavior */ \"./ts/mr/lively/behaviors/LUnitBehavior.ts\");\r\nconst PluginParameters_1 = __webpack_require__(/*! ../../PluginParameters */ \"./ts/mr/PluginParameters.ts\");\r\nconst LMap_1 = __webpack_require__(/*! ../LMap */ \"./ts/mr/lively/LMap.ts\");\r\nvar BlockLayer;\r\n(function (BlockLayer) {\r\n /** 地形情報。壁・水路など。 */\r\n BlockLayer[BlockLayer[\"Terrain\"] = 0] = \"Terrain\";\r\n /** 地表に落ちているもの。アイテム・ワナ・階段など。 */\r\n BlockLayer[BlockLayer[\"Surface\"] = 1] = \"Surface\";\r\n /** ユニット。PC・仲間・モンスター・土偶など。 */\r\n BlockLayer[BlockLayer[\"Unit\"] = 2] = \"Unit\";\r\n /** 発射物。矢、魔法弾、吹き飛ばされたUnitなど。 */\r\n BlockLayer[BlockLayer[\"Projectile\"] = 3] = \"Projectile\";\r\n})(BlockLayer || (BlockLayer = {}));\r\nvar LParamChangedAction;\r\n(function (LParamChangedAction) {\r\n LParamChangedAction[LParamChangedAction[\"None\"] = 0] = \"None\";\r\n LParamChangedAction[LParamChangedAction[\"WithRefresh\"] = 2] = \"WithRefresh\";\r\n LParamChangedAction[LParamChangedAction[\"WithNotification\"] = 4] = \"WithNotification\";\r\n LParamChangedAction[LParamChangedAction[\"All\"] = 6] = \"All\";\r\n})(LParamChangedAction = exports.LParamChangedAction || (exports.LParamChangedAction = {}));\r\n/**\r\n * [2021/5/27] 祝福・呪い・封印\r\n * ----------\r\n * ### 印にするべきか?\r\n * シレンタイトルでは 2 だけこのパターン。\r\n * 印であることを利用した予防やモンスター対策など小技があるが、印を埋めると無害化できるので\r\n * このパターンはかなりプレイヤーに有利なルールと言える。\r\n * また性質上、装備品以外は呪い状態にできないのであんまりよくないかも。\r\n *\r\n * ### State にするべきか?独立したパラメータにするべきか?\r\n * これら3ステートは排他なので state にした場合はその上書きや解除の処理が必要になる。\r\n *\r\n * また例えば祝福は草など他のアイテム効果を高めるだけでなく、祝福状態自体に「一定確率で呪いを防ぐ」みたいな効果もある。\r\n * 祝福によるダメージ増加、効果2倍などはそれぞれ 武器、草アイテム Entity 側で、祝福されているかどうかをチェックして対応するべき。\r\n * でも呪い防止は祝福自体の効果なので、Behavior にするべきだろう。\r\n * RMMZ の仕組みの上に乗っているのでステート有効度で制御できるようにもなる。\r\n */\r\n/**\r\n * システムを構成する最も原始的な要素。\r\n * プレイヤー、仲間、モンスター、アイテム、ワナ、地形、飛翔体(矢、魔法弾)などの、状態をもちえるすべての要素のベースクラス。\r\n *\r\n * 複数の Attribute や Behavior をアタッチすることで、動作を定義していく。\r\n *\r\n * Entity のライフサイクル\r\n * ----------\r\n * - インスタンスの作成は newEntity() で行う。\r\n * - すべての Entity は必ず World に存在することになる。\r\n * - 破棄は destroy()。 ※直ちにインスタンスが削除されるのではなく、削除マークが付けられ、後で削除される。\r\n *\r\n * @note\r\n * BlockLayer は種別のような他の情報から求めるべきかもしれないが、Entity によっては固定されることは無い。\r\n * - アイテム変化するモンスターは自身の種別を変更することになるが、それだと BlockLayer を変更することと変わらない。\r\n * - アイテムとして持っている土偶を立てたときは、振舞いは Item から Unit に変わる。これも結局状態変更することと変わらない。\r\n *\r\n * @note\r\n * 以前オブジェクトの参照と寿命管理のために LObject をベースクラスとし、Entity だけではなく Map 等もその派生としていたことがあったが、\r\n * セーブデータ作成や、World から Entity を検索するとき等の書き方が非常に煩雑になってしまったため廃止した。\r\n *\r\n *\r\n *\r\n * 座標と Map 上への配置状況について\r\n * ----------\r\n *\r\n * 座標 x,y のマイナス値は正当な値。これは、Floor 内には存在しているが Map 上には配置されていない状態を示す。\r\n * イメージとしては、概念として存在しているが、現実世界に登場していない状態。\r\n * お店のセキュリティシステムなど、Map 上に存在する必要はないが Floor 内に存在し、影響を与える Entity でこの状態になることがある。\r\n * また、フロア移動 ~ Map 上へ配置までの間では、通常の Entity も一時的にこの状態になることがある。\r\n */\r\nlet LEntity = LEntity_1 = class LEntity extends LObject_1.LObject {\r\n constructor() {\r\n super(LObject_1.LObjectType.Entity);\r\n this._entityDataId = 0;\r\n this._basicBehaviors = []; // Entity 生成時にセットされる基本 Behavior. Entity 破棄まで変更されることは無い。\r\n this._rmmzEventId = 0;\r\n /**\r\n * この Entity 個体として識別済みであるか。\r\n */\r\n this._individualIdentified = false;\r\n this._partyId = 0;\r\n this._name = \"\"; // 主にデバッグ用\r\n // HC3 で作ってた CommonAttribute はこっちに持ってきた。\r\n // これらは Entity ごとに一意であるべきで、Framework が必要としている必須パラメータ。\r\n // Attribute よりはこっちに置いた方がいいだろう。\r\n this._displayName = '';\r\n this._iconName = '';\r\n //_blockLayer: BlockLayer = BlockLayer.Unit;\r\n this._weight = 1; // 重さ\r\n /**\r\n * 固定マップにおいて、エディタで配置したイベントを元に作られた Entity であるかどうか。\r\n *\r\n * 基本的には Database マップの Event をコピーして使いたいが、固定の出口、固定NPC、その他未知の固定イベントの設置は考えられる。\r\n * 特に固定出口はツクールのエディタから「場所移動」によって遷移先を決めるのに都合がよいため、静的 Event と Entity は関連付けておきたい。\r\n *\r\n * 注意点としては、一度 map から離れると静的 Event との関連付けが解除されること。\r\n * 例えば固定のアイテムが落ちていたとして、それを拾って再び置いたときは、Entity は同一だが異なる動的 Event と関連付けられる。\r\n * 仮に階段をインベントリに入れてからまた置くと、「場所移動」実行内容が定義されている Event との関連付けが解除されるため、移動ができなくなる。\r\n * これは現状の仕様とする。\r\n */\r\n this.inhabitsCurrentFloor = false;\r\n this.keeper = false;\r\n // HC3 までは PositionalAttribute に持たせていたが、こっちに持ってきた。\r\n // お店のセキュリティシステムなど、これらを使わない Entity もあるのだが、\r\n // ほとんどの Entity が持つことになるパラメータなので、Attribute にするとコードが複雑になりすぎる。\r\n /**\r\n * Entity が存在しているフロア。\r\n *\r\n * 0 は、World には存在しているがいずれの Floor(Map) 上にもいないことを示し、\r\n * これは通常、別 Entity の Inventory の中にいる状態。\r\n *\r\n * 直接変更禁止。transfarMap を使うこと\r\n */\r\n this.floorId = LFloorId_1.LFloorId.makeEmpty();\r\n this.mx = 0; /**< 論理 X 座標。マップ座標系。マイナス値は正当(クラスコメント参照) */\r\n this.my = 0; /**< 論理 Y 座標。マップ座標系。マイナス値は正当(クラスコメント参照) */\r\n //--------------------\r\n // 以下、一時的に Entity に直接持たせてる Attr. 利用率とかで、別途 Attr クラスに分けたりする。\r\n this.dir = 2; // Numpad Dir\r\n // Block を占有するかどうか\r\n this.blockOccupied = true;\r\n // 隣接移動直後の DialogOpend かどうか。\r\n // 階段などの Entity に対しては足元コマンドを自動表示したりする。\r\n // ユーザビリティのためだけに参照する点に注意。セーブデータをロードした直後はウィンドウを表示したりしたくないので、セーブデータに含まれる。\r\n this.immediatelyAfterAdjacentMoving = false;\r\n // Unit の状態異常のほか、アイテムの呪い、祝福、封印などでも使用する。\r\n // とりあえず Entity に持たせて様子見。\r\n this._states = [];\r\n this._needVisualRefresh = false;\r\n this._abilities = [];\r\n // EffectResult はコアスクリプトの ActionResult 同様、System ではなく Entity 側に持たせてみる。\r\n // EffectContext に持たせて持ちまわってもよいのだが、ステート変更やパラメータ増減など様々なタイミングで参照されるため\r\n // それらすべての関数で EffectContext を持ちまわるのはかなり煩雑なコードになってしまう。\r\n this._effectResult = new LEffectResult_1.LEffectResult();\r\n this._schedulingResult = new LSchedulingResult_1.LSchedulingResult();\r\n this._deathResult = new LDeathResult_1.LDeathResult();\r\n this._reward = new LReward_1.LReward();\r\n // onEntityLocated イベントの発行を遅延実行するためのフラグ\r\n this._located = false;\r\n this._actionToken = new LActionToken_1.LActionToken();\r\n //----------------------------------------\r\n this._dropItemGenerated = false;\r\n // // true を返したら効果適用可能\r\n // public previewEffectBehaviorRejection(cctx: SCommandContext, effect: DEffect): boolean {\r\n // let result: any = SCommandResponse.Pass;\r\n // this.iterateBehaviorsReverse(b => {\r\n // result = b.onPreviewEffectRejection(cctx, this, effect);\r\n // return result == SCommandResponse.Pass;\r\n // });\r\n // return result != SCommandResponse.Canceled;\r\n // }\r\n // // true を返したら効果適用可能\r\n // public previewEffectBehaviorReaction(cctx: SCommandContext, id: DEffectBehaviorId): boolean {\r\n // let result: any = SCommandResponse.Pass;\r\n // this.iterateBehaviorsReverse(b => {\r\n // result = b.onPreviewEffectBehaviorRejection(cctx, this, id);\r\n // return result == SCommandResponse.Pass;\r\n // });\r\n // return result != SCommandResponse.Canceled;\r\n // }\r\n //----------------------------------------\r\n this._shopArticle = new LShopArticle_1.LShopArticle();\r\n //----------------------------------------\r\n // Stack support\r\n this._stackCount = 1;\r\n this._params = new LParam_1.LParamSet();\r\n }\r\n setupInstance(entityDataId) {\r\n if (this._entityDataId > 0) {\r\n // Change Instance\r\n this.clearInstance();\r\n this._effectResult.instanceChangedFrom = this._entityDataId;\r\n this._entityDataId = entityDataId;\r\n SEntityFactory_1.SEntityFactory.buildEntity(this);\r\n // 現在マップ上での変更であれば、再出現の処理を回すことで、見た目もリセットする\r\n if (this.floorId.equals(MRLively_1.MRLively.mapView.currentMap.floorId())) {\r\n MRSystem_1.MRSystem.integration.entityReEnterMap(this);\r\n }\r\n }\r\n else {\r\n this._entityDataId = entityDataId;\r\n }\r\n // 初期識別状態\r\n this._individualIdentified = (this.data.identificationDifficulty == DEntity_1.DIdentificationDifficulty.Clearly);\r\n this._params.clear();\r\n const params = this.data.idealParams;\r\n for (let i = 0; i < params.length; i++) {\r\n const value = params[i];\r\n if (value !== undefined) {\r\n const param = this._params.acquireParam(i);\r\n param.setActualDamgeParam(this._params.getActualMax(this, i) - value);\r\n }\r\n }\r\n this.resetInitialActualParam();\r\n }\r\n //----------------------------------------\r\n // Object Reference Management\r\n get dataId() {\r\n return this._entityDataId;\r\n }\r\n get data() {\r\n return MRData_1.MRData.entities[this._entityDataId];\r\n }\r\n kindDataId() {\r\n return this.data.entity.kindId;\r\n }\r\n kindData() {\r\n return MRData_1.MRData.categories[this.data.entity.kindId];\r\n }\r\n entityId() {\r\n //return this._id;\r\n return this.__objectId();\r\n }\r\n equals(other) {\r\n return this.entityId().equals(other.entityId());\r\n }\r\n isGCReady() {\r\n // 何らかのフロア上にいる場合は削除されない (明示的に除外されなければならない)\r\n if (this.floorId.hasAny)\r\n return false;\r\n return super.isGCReady();\r\n }\r\n // public _setObjectId(id: LObjectId): void {\r\n // super._setObjectId(id);\r\n // this._params._ownerId = id.clone();\r\n // }\r\n get rmmzEventId() {\r\n return this._rmmzEventId;\r\n }\r\n setRmmzEventId(value) {\r\n this._rmmzEventId = value;\r\n }\r\n getUniqueSpawner() {\r\n // this.map だと、アイテムを拾った瞬間に FloorId は Empty となるため、メッセージなどに正しい名前が表示できなかったりする。\r\n return MRLively_1.MRLively.mapView.currentMap.uniqueSpawners[this.dataId];\r\n }\r\n /**\r\n * この Entity のクローンを作成し、World に登録する。\r\n * Behavior, State など子要素もディープクローンされる。\r\n * クローンは特定の親に属していない状態となるため、このあと直ちにマップ上への配置やインベントリへの追加などを行うこと。\r\n * そうしなければ GC により削除される。\r\n */\r\n clone() {\r\n const entity = MRLively_1.MRLively.world.spawnEntity(this._entityDataId);\r\n entity._partyId = this._partyId;\r\n entity._individualIdentified = this._individualIdentified;\r\n entity._name = this._name;\r\n entity._displayName = this._displayName;\r\n entity._iconName = this._iconName;\r\n entity._rmmzEventId = 0; // 固定マップのイベントを参照するわけではないのでリセット\r\n entity.inhabitsCurrentFloor = false; // true のまま引き継いでしまうと、新たに生成された Entity に対応する RMMZ Event が生成されない\r\n entity.floorId = LFloorId_1.LFloorId.makeEmpty();\r\n entity.mx = 0;\r\n entity.my = 0;\r\n entity.dir = this.dir;\r\n entity._actionToken = this._actionToken.clone();\r\n entity._stackCount = this._stackCount; // \"分裂\" という意味ではスタック数もコピーしてもよさそう。TODO: タイトル要求と大きくかかわるのでオプションにした方がいいかも。\r\n //entity.blockOccupied = this.blockOccupied;\r\n //entity.immediatelyAfterAdjacentMoving = this.immediatelyAfterAdjacentMoving;\r\n //entity._effectResult = new LEffectResult();\r\n //entity._actionConsumed = this._actionConsumed;\r\n //entity._located = this._located;\r\n this._params.copyTo(entity._params);\r\n entity._needVisualRefresh = true; // とりあえず\r\n entity._dropItemGenerated = false; // 新しく現れた Entity は drop の可能性がある\r\n for (const i of this.basicBehaviors) {\r\n const i2 = i.clone(entity);\r\n entity._basicBehaviors.push(i2.id());\r\n i2.setParent(entity);\r\n }\r\n for (const i of this.states) {\r\n const i2 = i.clone(entity);\r\n entity._states.push(i2.id());\r\n i2.setParent(entity);\r\n }\r\n for (const i of this.abilities()) {\r\n const i2 = i.clone(entity);\r\n entity._abilities.push(i2.id());\r\n i2.setParent(entity);\r\n }\r\n return entity;\r\n }\r\n onFinalize() {\r\n // 現在マップ上の Entity 削除\r\n if (this.floorId.equals(MRLively_1.MRLively.mapView.currentMap.floorId())) {\r\n MRLively_1.MRLively.mapView.currentMap._removeEntity(this);\r\n }\r\n this.clearInstance();\r\n MRLively_1.MRLively.scheduler.invalidateEntity(this);\r\n }\r\n clearInstance() {\r\n this.removeAllBehaviors();\r\n //this.removeAllAbilities(); // TODO: assert するのでコメントアウト\r\n this.removeAllStates(false);\r\n }\r\n onRemoveChild(obj) {\r\n if (obj instanceof LEntity_1) {\r\n for (const b of this.basicBehaviors) {\r\n b.onRemoveChild(obj);\r\n }\r\n }\r\n //else if (obj instanceof LBehavior) {\r\n // for (const b of this.basicBehaviors()) {\r\n // b.onRemoveChild(obj);\r\n // }\r\n //}\r\n else {\r\n // TODO: State とか Ability とか\r\n throw new Error(\"Not implemented.\");\r\n }\r\n }\r\n onRemoveFromParent() {\r\n for (const b of this.basicBehaviors) {\r\n b.onOwnerRemoveFromParent(this);\r\n }\r\n }\r\n parentEntity() {\r\n if (this.parentObjectId().hasAny()) {\r\n return MRLively_1.MRLively.world.entity(this.parentObjectId());\r\n }\r\n else {\r\n return undefined;\r\n }\r\n }\r\n isPlayer() {\r\n return this.entityId().equals(MRLively_1.MRLively.mapView.focusedEntityId());\r\n }\r\n isUnit() {\r\n return !!this.findEntityBehavior(LUnitBehavior_1.LUnitBehavior);\r\n }\r\n // public isItem(): boolean {\r\n // return !!this.data().itemData;\r\n // }\r\n partyId() {\r\n return this._partyId;\r\n }\r\n party() {\r\n if (this._partyId == 0)\r\n return undefined;\r\n else\r\n return MRLively_1.MRLively.world.party(this._partyId);\r\n }\r\n get map() {\r\n return MRLively_1.MRLively.world.map(this.floorId);\r\n }\r\n individualIdentified() {\r\n return this._individualIdentified;\r\n }\r\n setIndividualIdentified(value) {\r\n this._individualIdentified = value;\r\n }\r\n /**\r\n * すべての状態をリセットする。\r\n *\r\n * recoverAll() は buffs 等一部リセットされないものがあるが、このメソッドは全てリセットする。\r\n * 拠点へ戻ったときなどで完全リセットしたいときに使う。\r\n */\r\n resetStatus() {\r\n this._params.resetAllConditions();\r\n this.removeAllStates(false);\r\n this.iterateBehaviorsReverse((b) => {\r\n b.onResetStatus(this);\r\n });\r\n }\r\n /**\r\n * この Entity 存在し得るマップ上の位置を取得する。\r\n * Entity が別の Entity の持ち物などに入っている場合、その Entity の位置を返す。\r\n */\r\n getLocation() {\r\n let result;\r\n this.findAncestor(obj => {\r\n if (obj instanceof LEntity_1) {\r\n const parent = obj.parentObject();\r\n if (parent instanceof LMap_1.LMap) {\r\n result = {\r\n floorId: obj.floorId,\r\n mx: obj.mx,\r\n my: obj.my,\r\n };\r\n return true;\r\n }\r\n }\r\n return false;\r\n });\r\n return result;\r\n }\r\n //--------------------------------------------------------------------------------\r\n // Parameters\r\n get params() {\r\n return this._params;\r\n }\r\n /**\r\n * 装備効果やバフが反映された、実際の最大値 (UIの表示やダメージ計算に使用する、一般的な最大値) を取得する。\r\n * @param paramId\r\n */\r\n getParamActualMax(paramId) {\r\n return this._params.getActualMax(this, paramId);\r\n }\r\n getEffortValue(paramId) {\r\n const param = this.params.param(paramId);\r\n return param ? param.effortValue() : 0;\r\n }\r\n setEffortValue(paramId, value, action = LParamChangedAction.All) {\r\n const param = this.params.param(paramId);\r\n if (param) {\r\n let oldEffortValue = 0;\r\n let oldActualValue = 0;\r\n if (action & LParamChangedAction.WithNotification) {\r\n oldEffortValue = this.getEffortValue(paramId);\r\n oldActualValue = this.getActualParam(paramId);\r\n }\r\n param.setEffortValue(value);\r\n if (action & LParamChangedAction.WithNotification) {\r\n const newEffortValue = this.getEffortValue(paramId);\r\n const newActualValue = this.getActualParam(paramId);\r\n if (newEffortValue !== oldEffortValue) {\r\n this.notifyParamIdealPlusChanged(paramId, newEffortValue, oldEffortValue);\r\n }\r\n if (newActualValue !== oldActualValue) {\r\n this.notifyParamChanged(paramId, newActualValue, oldActualValue);\r\n }\r\n }\r\n if (action & LParamChangedAction.WithRefresh) {\r\n this.refreshConditions();\r\n }\r\n }\r\n }\r\n getActualParam(paramId) {\r\n const param = this._params.param(paramId);\r\n let value = 0;\r\n const forceValue = this.traitMaxOrDefault(MRBasics_1.MRBasics.traits.ForceParameter, paramId, undefined);\r\n if (forceValue !== undefined) {\r\n value = forceValue;\r\n }\r\n else if (param) {\r\n if (param.data.type == DParameter_1.DParameterType.Dependent) {\r\n value = this.getDependentParameterCurrentValue(paramId);\r\n }\r\n else {\r\n value = this._params.getActualMax(this, paramId) - param.actualParamDamge();\r\n }\r\n }\r\n const minLimit = this._params.getMinLimit(paramId);\r\n const maxLimit = this._params.getMaxLimit(paramId);\r\n return Math.round(value.clamp(minLimit, maxLimit));\r\n }\r\n /** 直接設定 */\r\n setParamCurrentValue(paramId, value) {\r\n const data = MRData_1.MRData.parameters[paramId];\r\n const max = this._params.getActualMax(this, paramId);\r\n if (data.type == DParameter_1.DParameterType.Dependent) {\r\n this.setDependentParameterCurrentValue(paramId, value);\r\n }\r\n else {\r\n this.setActualDamgeParam(paramId, max - value);\r\n }\r\n }\r\n notifyParamIdealPlusChanged(paramId, newValue, oldValue) {\r\n this.iterateBehaviorsReverse(b => b.onParamIdealPlusChanged(this, paramId, newValue, oldValue));\r\n }\r\n notifyParamChanged(paramId, newValue, oldValue) {\r\n this.iterateBehaviorsReverse(b => b.onParamChanged(this, paramId, newValue, oldValue));\r\n }\r\n getDependentParameterCurrentValue(paramId) {\r\n let result = undefined;\r\n this.iterateBehaviorsReverse(b => {\r\n result = b.onGetDependentParameterIdealBaseValue(this, paramId);\r\n return result === undefined;\r\n });\r\n return result !== null && result !== void 0 ? result : 0;\r\n }\r\n setDependentParameterCurrentValue(paramId, value) {\r\n this.iterateBehaviorsReverse(b => {\r\n b.onSetDependentParameterIdealBaseValue(this, paramId, value);\r\n return true;\r\n });\r\n this.refreshConditions();\r\n }\r\n setActualDamgeParam(paramId, value) {\r\n const param = this._params.param(paramId);\r\n if (param) {\r\n if (param.actualParamDamge() != value) {\r\n const oldValue = this.getActualParam(paramId);\r\n param.setActualDamgeParam(value);\r\n this.notifyParamChanged(paramId, this.getActualParam(paramId), oldValue);\r\n this.refreshConditions();\r\n }\r\n }\r\n else {\r\n throw new Error(`LParam not registerd (paramId:${paramId})`);\r\n }\r\n }\r\n // TODO: current param\r\n gainActualParam(paramId, value, refresh) {\r\n if (value === 0)\r\n return; // refresh とか発生させる意味なし\r\n const param = this._params.param(paramId);\r\n if (param) {\r\n if (param.data.type == DParameter_1.DParameterType.Dependent) {\r\n // TODO: 今は level だけなのでよいが、actual から増分するのはバフとか考慮する必要があるので良くない\r\n const oldValue = this.getActualParam(paramId);\r\n this.setDependentParameterCurrentValue(paramId, this.getActualParam(paramId) + value);\r\n }\r\n else {\r\n const oldValue = this.getActualParam(paramId);\r\n param.gainActualParam(value);\r\n this.notifyParamChanged(paramId, this.getActualParam(paramId), oldValue);\r\n if (refresh) {\r\n this.refreshConditions();\r\n }\r\n }\r\n }\r\n else {\r\n throw new Error(`LParam not registerd (paramId:${paramId})`);\r\n }\r\n }\r\n resetInitialActualParam() {\r\n for (const param of this._params.params()) {\r\n if (param) {\r\n param.resetInitialActualValue(this.getActualParam(param.parameterId));\r\n }\r\n }\r\n }\r\n refreshConditions() {\r\n // 副作用によって HP が 0 以下になったときは、 1 のまま残したい。\r\n // このフラグによって、 前回 refresh 時から HP に対して直接変更があったかを判断する。\r\n // refresh 前に、直接 DamageValue が変えられていた場合は false のまま。\r\n let hpSideEffects = false;\r\n const hpParam = this._params.param(MRBasics_1.MRBasics.params.hp);\r\n if (hpParam) {\r\n hpSideEffects = !hpParam.isDamageValueChanged;\r\n const dead = !!this.states.find(s => s.stateDataId() == MRBasics_1.MRBasics.states.dead || s.stateData().deadState);\r\n const hp = this.getActualParam(MRBasics_1.MRBasics.params.hp);\r\n // 外部から addState() 等で DeathState が与えられた場合は HP0 にする\r\n if (dead && hp != 0) {\r\n hpParam.setActualDamgeParam(this._params.getActualMax(this, MRBasics_1.MRBasics.params.hp));\r\n this.removeAllStates(true);\r\n }\r\n }\r\n // Min/Max clamp.\r\n this._params.refresh(this);\r\n this.basicBehaviors.forEach(b => b.onRefreshConditions(this));\r\n // refresh 後、HP が 0 なら DeadState を付加する\r\n const mhp = this._params.getActualMax(this, MRBasics_1.MRBasics.params.hp);\r\n if (mhp !== 0) {\r\n const hp = this.getActualParam(MRBasics_1.MRBasics.params.hp);\r\n if (hp <= 0) {\r\n //if (beforeLivingLike && hpParam) {\r\n if (hpParam && hpSideEffects) {\r\n hpParam.setActualDamgeParam(mhp - 1);\r\n }\r\n else if (!this.isDeathStateAffected()) {\r\n this.addState(MRBasics_1.MRBasics.states.dead, false);\r\n }\r\n }\r\n else {\r\n if (this.isDeathStateAffected()) { // removeState() はけっこういろいろやるので、不要なら実行しない\r\n this.removeState(MRBasics_1.MRBasics.states.dead);\r\n }\r\n }\r\n }\r\n // ステートの Refresh\r\n this._states = UState_1.UState.resolveStates(this, [], []).map(s => s.id());\r\n }\r\n //--------------------------------------------------------------------------------\r\n // Buff\r\n addBuff(buff) {\r\n const param = this._params.param(buff.paramId);\r\n if (param) {\r\n param.addBuff(buff);\r\n this.refreshConditions();\r\n if (buff.level < 0) {\r\n this._effectResult.pushAddedDebuff(buff.paramId);\r\n }\r\n else {\r\n this._effectResult.pushAddedBuff(buff.paramId);\r\n }\r\n }\r\n }\r\n removeBuff(paramId) {\r\n const param = this._params.param(paramId);\r\n if (param) {\r\n param.removeBuff();\r\n this.refreshConditions();\r\n this._effectResult.pushRemovedBuff(paramId);\r\n }\r\n }\r\n //----------------------------------------\r\n // Traits\r\n // Game_BattlerBase.prototype.allTraits\r\n allTraits() {\r\n return this.collectTraits();\r\n }\r\n // Game_BattlerBase.prototype.traits\r\n traits(code) {\r\n return this.allTraits().filter(trait => trait.code === code);\r\n }\r\n hasTrait(code) {\r\n return this.allTraits().find(t => t.code == code) !== undefined;\r\n }\r\n // Game_BattlerBase.prototype.traitsWithId\r\n traitsWithId(code, id) {\r\n return this.allTraits().filter(trait => trait.code === code && trait.dataId === id);\r\n }\r\n // Game_BattlerBase.prototype.traitsPi\r\n traitsPi(code, id) {\r\n return this.traitsWithId(code, id).reduce((r, trait) => r * trait.value, 1);\r\n }\r\n // Game_BattlerBase.prototype.traitsSum\r\n traitsSum(code, id) {\r\n const traits = this.traitsWithId(code, id);\r\n return traits.reduce((r, trait) => r + trait.value, 0);\r\n }\r\n traitsSumOrDefault(code, id, defaultValue) {\r\n const traits = this.traitsWithId(code, id);\r\n return (traits.length == 0) ? defaultValue : traits.reduce((r, trait) => r + trait.value, 0);\r\n }\r\n traitMaxOrDefault(code, dataId, defaultValue) {\r\n const traits = this.traitsWithId(code, dataId);\r\n if (traits.length == 0) {\r\n return defaultValue;\r\n }\r\n else {\r\n return traits.reduce((r, trait) => Math.max(r, trait.value), 0);\r\n }\r\n }\r\n // Game_BattlerBase.prototype.traitsSumAll\r\n traitsSumAll(code) {\r\n return this.traits(code).reduce((r, trait) => r + trait.value, 0);\r\n }\r\n // Game_BattlerBase.prototype.traitsSet\r\n // 指定した code の Trait の dataId のリストを返す\r\n traitsSet(code) {\r\n //const emptyNumbers: number[] = [];\r\n //return this.traits(code).reduce((r, trait) => r.concat(trait.dataId), emptyNumbers);\r\n const result = [];\r\n for (const trait of this.traits(code)) {\r\n result.push(trait.dataId);\r\n }\r\n return result;\r\n }\r\n // Game_BattlerBase.prototype.xparam\r\n xparam(xparamId) {\r\n return this.traitsSum(MRBasics_1.MRBasics.traits.TRAIT_XPARAM, xparamId);\r\n }\r\n xparamOrDefault(xparamId, defaultValue) {\r\n return this.traitsSumOrDefault(MRBasics_1.MRBasics.traits.TRAIT_XPARAM, xparamId, defaultValue);\r\n }\r\n // Game_BattlerBase.prototype.sparam\r\n sparam(sparamId) {\r\n return this.traitsPi(MRBasics_1.MRBasics.traits.TRAIT_SPARAM, sparamId);\r\n }\r\n // Game_BattlerBase.prototype.elementRate\r\n elementRate(elementId) {\r\n return this.traitsPi(MRBasics_1.MRBasics.traits.TRAIT_ELEMENT_RATE, elementId);\r\n }\r\n // ステート有効度\r\n // Game_BattlerBase.prototype.stateRate\r\n stateRate(stateId) {\r\n return this.traitsPi(MRBasics_1.MRBasics.traits.TRAIT_STATE_RATE, stateId);\r\n }\r\n ;\r\n // Game_BattlerBase.prototype.attackElements\r\n attackElements() {\r\n return this.traitsSet(MRBasics_1.MRBasics.traits.TRAIT_ATTACK_ELEMENT);\r\n }\r\n //----------------------------------------\r\n // FieldEffect\r\n *fieldEffects() {\r\n // TODO: behavior も Generator 対応\r\n const behaviors = [];\r\n this.iterateBehaviorsReverse(b => {\r\n behaviors.push(b);\r\n }, true);\r\n for (const b of behaviors) {\r\n yield* b.onCollectFieldEffect(this);\r\n }\r\n }\r\n //----------------------------------------\r\n // Property\r\n getDisplayName() {\r\n const data = this.data;\r\n let name = \"\";\r\n const spawner = this.getUniqueSpawner();\r\n if (spawner && spawner.displayName) {\r\n name = spawner.displayName;\r\n }\r\n else {\r\n for (const b of this.collectBehaviors().reverse()) {\r\n const v = b.queryDisplayName();\r\n if (v)\r\n return v;\r\n }\r\n name = data.makeDisplayName(this._stackCount);\r\n }\r\n const result = { name: name, iconIndex: data.display.iconIndex, upgrades: 0 };\r\n const upgrades = this._params.param(MRBasics_1.MRBasics.params.upgradeValue);\r\n if (upgrades) {\r\n result.upgrades = this.getActualParam(MRBasics_1.MRBasics.params.upgradeValue);\r\n }\r\n // TODO: test\r\n const remaining = this._params.param(MRBasics_1.MRBasics.params.remaining);\r\n if (remaining) {\r\n result.remaining = this.getActualParam(MRBasics_1.MRBasics.params.remaining);\r\n result.initialRemaining = remaining.initialActualValue();\r\n }\r\n this.iterateBehaviors2(b => {\r\n b.onQueryNameView(this, result);\r\n return true;\r\n });\r\n return result;\r\n }\r\n getPrefabId() {\r\n for (const b of this.collectBehaviors().reverse()) {\r\n const v = b.queryPrefabId();\r\n if (v)\r\n return v;\r\n }\r\n return this.data.prefabId;\r\n }\r\n // this が真に属する Faction。通常、getOutwardFactionId() を使うべき。\r\n getInnermostFactionId() {\r\n for (const b of this.collectBehaviors().reverse()) {\r\n const v = b.queryInnermostFactionId();\r\n if (v)\r\n return v;\r\n }\r\n return MRData_1.MRData.system.factions.neutral;\r\n }\r\n // 対外的な Faction。モンスターがアイテムに化けているといった場合、InnermostFactionId とは異なる値を返す。\r\n getOutwardFactionId() {\r\n for (const b of this.collectBehaviors().reverse()) {\r\n const v = b.queryOutwardFactionId();\r\n if (v)\r\n return v;\r\n }\r\n return MRData_1.MRData.system.factions.neutral;\r\n }\r\n getHomeLayer() {\r\n for (const b of this.collectBehaviors().reverse()) {\r\n const v = b.queryHomeLayer();\r\n if (v)\r\n return v;\r\n }\r\n return DCommon_1.DBlockLayerKind.Ground;\r\n }\r\n queryMinimapMarkerClass() {\r\n let value = undefined;\r\n this.iterateBehaviorsReverse(b => {\r\n value = b.queryMinimapMarkerClass();\r\n return value === undefined;\r\n });\r\n return value !== null && value !== void 0 ? value : LCommon_1.LMinimapMarkerClass.None;\r\n }\r\n getIdealParamBase(paramId) {\r\n let value = 0;\r\n this.iterateBehaviorsReverse(b => {\r\n value = b.onQueryIdealParamBase(paramId, value);\r\n return true;\r\n });\r\n return value;\r\n }\r\n querySubEntities(key) {\r\n const result = [];\r\n this.iterateBehaviorsReverse(b => {\r\n b.onQuerySubEntities(key, result);\r\n return true;\r\n });\r\n return result;\r\n }\r\n queryParamMinMax(paramId) {\r\n const param = MRData_1.MRData.parameters[paramId];\r\n const result = { min: param.minLimit, max: param.maxLimit };\r\n if (paramId == MRBasics_1.MRBasics.params.upgradeValue) {\r\n const data = this.data;\r\n result.min = data.upgradeMin;\r\n result.max = data.upgradeMax;\r\n }\r\n /*\r\n this.iterateBehaviorsReverse(b => {\r\n const r: LParamMinMaxInfo = {};\r\n b.onQueryParamMinMax(paramId, r);\r\n if (r.min) result.min = r.min;\r\n if (r.max) result.max = r.max;\r\n return true;\r\n });\r\n */\r\n return result;\r\n }\r\n queryPrice() {\r\n const data = this.data;\r\n const result = { sellingPrice: data.sellingPrice2, purchasePrice: data.purchasePrice };\r\n this.iterateBehaviorsReverse(b => {\r\n b.onQueryPrice(result);\r\n return true;\r\n });\r\n return result;\r\n }\r\n queryRaceIds() {\r\n return this.data.raceIds;\r\n }\r\n getAttackAnimationId(index) {\r\n let result = undefined;\r\n this.iterateBehaviorsReverse(b => {\r\n result = b.onQueryAttackAnimationId(this, index);\r\n return result === undefined;\r\n });\r\n return result !== null && result !== void 0 ? result : 1; // TODO: bare hand animation\r\n }\r\n //----------------------------------------\r\n // Behavior\r\n // スクリプトコマンド用簡易API\r\n behavior(name) {\r\n return this.findEntityBehaviorByName(name);\r\n }\r\n get basicBehaviors() {\r\n return this._basicBehaviors.map(x => MRLively_1.MRLively.world.behavior(x));\r\n }\r\n // public addBehavior(ctor: { new(...args: any[]): T }, ...args: any[]): T {\r\n // const behavior = new ctor();\r\n // (behavior as T).setup(...args);\r\n // MRLively.world._registerObject(behavior);\r\n // this._addBehavior(behavior);\r\n // return behavior;\r\n // }\r\n /** 指定された Behavior を World に登録してから、この Entity に追加します。 */\r\n addBehavior(behavior) {\r\n MRLively_1.MRLively.world._registerObject(behavior);\r\n this._addBehavior(behavior);\r\n }\r\n _addBehavior(behavior) {\r\n (0, Common_1.assert)(behavior.hasId());\r\n (0, Common_1.assert)(this.entityId().hasAny());\r\n this._basicBehaviors.push(behavior.id());\r\n behavior.setParent(this);\r\n behavior.onAttached(this);\r\n // TODO: newEntity 最後で、こてい Behavior 全部そろってからにしたい\r\n // const params = this.data.getMergedBehaviorParams(behavior.fullName, behavior.friendlyName);\r\n // behavior.onInitialized(this, params);\r\n return behavior;\r\n }\r\n removeBehavior(behavior) {\r\n const index = this._basicBehaviors.findIndex(x => x.equals(behavior.id()));\r\n if (index >= 0) {\r\n this._basicBehaviors.splice(index, 1);\r\n behavior.clearParent();\r\n behavior.onDetached(this);\r\n behavior.destroy();\r\n }\r\n }\r\n /** 全ての Behavior を除外します。 */\r\n removeAllBehaviors() {\r\n this.basicBehaviors.forEach(b => {\r\n b.clearParent();\r\n b.onDetached(this);\r\n b.destroy();\r\n });\r\n this._basicBehaviors = [];\r\n }\r\n //--------------------------------------------------------------------------------\r\n // State\r\n addState(stateId, refresh = true, level = 1, levelType = DEffect_1.LStateLevelType.RelativeValue) {\r\n if (levelType == DEffect_1.LStateLevelType.AbsoluteValue && level == 0)\r\n return; // level=0 となる場合は設定不要\r\n this._states = UState_1.UState.resolveStates(this, [{ stateId: stateId, level: level, levelType: levelType }], []).map(s => s.id());\r\n // 自動追加の更新を行う\r\n this._states = UState_1.UState.resolveStates(this, [], []).map(s => s.id());\r\n this._needVisualRefresh = true;\r\n if (this.isDeathStateAffected()) {\r\n this.makeDeathResultStates();\r\n }\r\n }\r\n get states() {\r\n return this._states.map(id => MRLively_1.MRLively.world.object(id));\r\n }\r\n isStateAffected(stateId) {\r\n return this.states.findIndex(s => s.stateDataId() == stateId) >= 0;\r\n }\r\n removeStates(stateIds) {\r\n if (stateIds.length == 0)\r\n return;\r\n this._states = UState_1.UState.resolveStates(this, [], stateIds).map(s => s.id());\r\n // 自動追加の更新を行う\r\n this._states = UState_1.UState.resolveStates(this, [], []).map(s => s.id());\r\n this._needVisualRefresh = true;\r\n }\r\n removeState(stateId) {\r\n this.removeStates([stateId]);\r\n }\r\n /** 全ての State を除外します。 */\r\n removeAllStates(withoutDeadStates) {\r\n if (withoutDeadStates) {\r\n const removes = this.states.filter(s => !s.isDeathState).map(s => s.stateDataId());\r\n this.removeStates(removes);\r\n }\r\n else {\r\n this.states.forEach(s => {\r\n s.clearParent();\r\n s.onDetached(this);\r\n });\r\n this._states = [];\r\n }\r\n this._needVisualRefresh = true;\r\n }\r\n findState(stateId) {\r\n let result = undefined;\r\n this.iterateStates((s) => {\r\n if (s.stateDataId() == stateId) {\r\n result = s;\r\n return false;\r\n }\r\n return true;\r\n });\r\n return result;\r\n }\r\n hasState(stateId) {\r\n return !!this.findState(stateId);\r\n }\r\n isBlessed() {\r\n return this.isStateAffected(MRData_1.MRData.system.states.bless);\r\n }\r\n isCursed() {\r\n return this.isStateAffected(MRData_1.MRData.system.states.curse);\r\n }\r\n isSealed() {\r\n return this.isStateAffected(MRData_1.MRData.system.states.seal);\r\n }\r\n // Game_BattlerBase.prototype.isDeathStateAffected\r\n isDeathStateAffected() {\r\n return !!this.states.find(s => s.isDeathState);\r\n }\r\n removeDeadStates() {\r\n const stateIds = this.states.filter(s => s.stateDataId() == MRBasics_1.MRBasics.states.dead || s.stateData().deadState).map(s => s.stateDataId());\r\n this.removeStates(stateIds);\r\n }\r\n // Game_Battler.prototype.isStateAddable\r\n isStateAddable(stateId) {\r\n return !this.isStateResist(stateId);\r\n // return (\r\n // this.isAlive() &&\r\n // $dataStates[stateId] &&\r\n // !this.isStateResist(stateId) &&\r\n // !this.isStateRestrict(stateId)\r\n // );\r\n }\r\n // Game_BattlerBase.prototype.stateResistSet\r\n stateResistSet() {\r\n return this.traitsSet(MRBasics_1.MRBasics.traits.TRAIT_STATE_RESIST);\r\n }\r\n isStateResist(stateId) {\r\n return this.stateResistSet().includes(stateId);\r\n }\r\n //--------------------------------------------------------------------------------\r\n // LAbility\r\n addAbility(abilityId) {\r\n const index = this._abilities.findIndex(id => (MRLively_1.MRLively.world.ability(id)).abilityId() == abilityId);\r\n if (index >= 0) {\r\n }\r\n else {\r\n const ability = SAbilityFactory_1.SAbilityFactory.newAbility(abilityId);\r\n ability.setParent(this);\r\n (0, Common_1.assert)(ability.hasId());\r\n this._abilities.push(ability.id());\r\n ability.onAttached(this);\r\n }\r\n }\r\n removeAbility(abilityId) {\r\n const index = this._abilities.findIndex(id => (MRLively_1.MRLively.world.ability(id)).abilityId() == abilityId);\r\n if (index >= 0) {\r\n MRLively_1.MRLively.world.ability(this._abilities[index]).onDetached(this);\r\n this._abilities.splice(index, 1);\r\n }\r\n }\r\n removeAllAbilities() {\r\n this.abilities().forEach(s => {\r\n s.onDetached(this);\r\n });\r\n this._abilities = [];\r\n }\r\n abilities() {\r\n return this._abilities.map(id => MRLively_1.MRLively.world.object(id));\r\n }\r\n /**\r\n * Entity が存在している場所から除外する。\r\n *\r\n * 何らかの Inventory に入っているならそこから、Map 上に出現しているならその Block から除外する。\r\n * 除外された UniqueEntity 以外の Entity は、そのターンの間にいずれかから参照を得ない場合 GC によって削除される。\r\n */\r\n /*\r\n callRemoveFromWhereabouts(cctx: SCommandContext): REResponse {\r\n const parent = this.parentEntity();\r\n if (parent) {\r\n const response = parent._callBehaviorIterationHelper((behavior: LBehavior) => {\r\n return behavior.onRemoveEntityFromWhereabouts(cctx, this);\r\n });\r\n assert(this.parentObjectId().index2() == 0); // 何らか削除されているはず\r\n return response;\r\n }\r\n else if (this.floorId.hasAny()) {\r\n REGame.map._removeEntity(this);\r\n return REResponse.Succeeded;\r\n }\r\n else {\r\n throw new Error();\r\n }\r\n }\r\n */\r\n /**\r\n * 動的に生成した Game_Event が参照する EventData.\r\n * 頻繁にアクセスされる可能性があるので Attribute ではなくこちらに持たせている。\r\n */\r\n //eventData(): IDataMapEvent | undefined {\r\n // return this._eventData;\r\n //}\r\n /**\r\n * ゲーム全体にわたって絶対に破棄 (destroy) されることの無い Entity (UniqueEntity) であるかどうか\r\n *\r\n * Player や (ダンジョンを抜けても状態を保持する)仲間などが該当する。\r\n * これらはダンジョン内で倒れてもマップから \"除外\" されるだけで \"破棄\" されることはない。\r\n *\r\n * UniqueEntity のインベントリに入れられたアイテム等は UniqueEntity ではないので注意。\r\n */\r\n isUnique() {\r\n return MRLively_1.MRLively.system.uniqueActorUnits.findIndex(id => id.equals(this.entityId())) >= 0;\r\n }\r\n /**\r\n * フォーカスされている Entity であるか。\r\n *\r\n * フォーカス=操作中と考えてよい。\r\n * メッセージ表示時に主語を省略するといった処理で参照する。\r\n */\r\n isFocused() {\r\n return MRLively_1.MRLively.mapView.focusedEntityId().equals(this.entityId());\r\n }\r\n /**\r\n * Entity が機能を果たせる状態にあるか(破棄準備状態であるか)\r\n *\r\n * HP0 となっても直ちに破棄準備状態となるわけではなく、例えば復活草の効果を受けて回復することがある。\r\n * その他、仮に不死の Entity がいる場合、HP が 0 になろうともマップにとどまる限りは true となるべき。\r\n *\r\n * そのためこの値が false の場合は、Entity が完全に機能を停止して World から取り除かれようとしていることを示す。\r\n * 各種処理で、こういった Entity を存在しないものとして扱うためにこのフラグを確認する。\r\n */\r\n isAlive() {\r\n return !this.isDestroyed() || this.isDeathStateAffected();\r\n }\r\n /**\r\n * この Entity に直接アタッチされている Behavior を検索します。\r\n * State や Ability にアタッチされている Behavior は対象外です。\r\n */\r\n findEntityBehavior(ctor) {\r\n for (let i = 0; i < this._basicBehaviors.length; i++) {\r\n const a = MRLively_1.MRLively.world.behavior(this._basicBehaviors[i]);\r\n if (a instanceof ctor) {\r\n return a;\r\n }\r\n }\r\n return undefined;\r\n }\r\n findEntityBehaviorBy(func) {\r\n for (let i = 0; i < this._basicBehaviors.length; i++) {\r\n const b = MRLively_1.MRLively.world.behavior(this._basicBehaviors[i]);\r\n if (func(b)) {\r\n return b;\r\n }\r\n }\r\n return undefined;\r\n }\r\n findEntityBehaviorByName(name) {\r\n const lowerName = name.toLocaleLowerCase();\r\n for (const id of this._basicBehaviors) {\r\n const b = MRLively_1.MRLively.world.behavior(id);\r\n let behaviorName = b.constructor.name;\r\n const index = behaviorName.lastIndexOf(\"Behavior\");\r\n if (index >= 0) {\r\n behaviorName = behaviorName.substring(0, index);\r\n }\r\n if (behaviorName.toLocaleLowerCase().endsWith(lowerName)) {\r\n return b;\r\n }\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * この Entity に直接アタッチされている Behavior を取得します。\r\n * State や Ability にアタッチされている Behavior は対象外です。\r\n * 見つからない場合は例外が発生します。\r\n */\r\n getEntityBehavior(ctor) {\r\n const b = this.findEntityBehavior(ctor);\r\n if (!b)\r\n throw new Error();\r\n return b;\r\n }\r\n _iterateBehaviors(func) {\r\n const states = this.states;\r\n for (let i = states.length - 1; i >= 0; i--) {\r\n const behabiors = states[i].stateBehabiors();\r\n for (let i2 = behabiors.length - 1; i2 >= 0; i2--) {\r\n if (!func(behabiors[i2])) {\r\n return;\r\n }\r\n }\r\n }\r\n for (let i = this._basicBehaviors.length - 1; i >= 0; i--) {\r\n if (!func(MRLively_1.MRLively.world.behavior(this._basicBehaviors[i]))) {\r\n return;\r\n }\r\n }\r\n }\r\n queryProperty(propertyId) {\r\n let result = undefined;\r\n this._iterateBehaviors(b => {\r\n result = b.onQueryProperty(propertyId);\r\n return result == undefined;\r\n });\r\n return result !== null && result !== void 0 ? result : MRSystem_1.MRSystem.propertyData[propertyId].defaultValue;\r\n }\r\n /**\r\n * Visual としての Idle 状態での再生 Sequel.\r\n *\r\n * 状態異常等で変わる。\r\n */\r\n queryIdleSequelId() {\r\n let id = 0;\r\n this.iterateBehaviorsReverse(b => {\r\n id = b.onQueryIdleSequelId();\r\n return !id;\r\n });\r\n return id ? id : MRBasics_1.MRBasics.sequels.idle;\r\n }\r\n queryActions() {\r\n let result = [];\r\n for (let i = 0; i < this._basicBehaviors.length; i++) { // 前方から\r\n result = MRLively_1.MRLively.world.behavior(this._basicBehaviors[i]).onQueryActions(result);\r\n }\r\n return result;\r\n }\r\n queryReactions() {\r\n // 既定では、すべての Entity は Item として Map に存在できる。\r\n // Item 扱いしたくないものは、Behavior 側でこれらの Action を取り除く。\r\n // FIXME: 既定では拾ったり投げたりできないほうがいいかも。階段とか罠とか、間違って操作してしまう。やっぱりすべてに共通なものをここに置きたい。\r\n let result = this.data.reactions.map(x => { return { actionId: x.actionId, displayName: x.overrideDisplayCommandName }; });\r\n result = result.concat([\r\n //DBasics.actions.ExchangeActionId,\r\n { actionId: MRBasics_1.MRBasics.actions.ThrowActionId },\r\n { actionId: MRBasics_1.MRBasics.actions.FallActionId },\r\n { actionId: MRBasics_1.MRBasics.actions.DropActionId },\r\n ]);\r\n if (this.isOnGround()) {\r\n // Ground Layer 上に存在していれば、拾われる可能性がある\r\n result.push({ actionId: MRBasics_1.MRBasics.actions.PickActionId });\r\n }\r\n else {\r\n result.push({ actionId: MRBasics_1.MRBasics.actions.PutActionId });\r\n }\r\n //for (let i = 0; i < this._basicBehaviors.length; i++) {\r\n //result = REGame.world.behavior(this._basicBehaviors[i]).onQueryReactions(result);\r\n //}\r\n for (const b of this.collectBehaviors()) {\r\n b.onQueryReactions(this, result);\r\n }\r\n // Spawner によって Reaction 名が指定されていれば、それを使う\r\n const spawner = this.getUniqueSpawner();\r\n if (spawner && spawner.reactions) {\r\n for (const reaction of result) {\r\n const key = MRData_1.MRData.skills[reaction.actionId].key;\r\n const r = spawner.reactions.find(x => x.key === key);\r\n if (r) {\r\n reaction.displayName = r.name;\r\n }\r\n }\r\n }\r\n return result;\r\n }\r\n collectTraits() {\r\n const result = [];\r\n this.iterateBehaviorsReverse(b => {\r\n b.onCollectTraits(this, result);\r\n }, true);\r\n // Behavior とは別に、State 自体が持っている Trait も含める\r\n this.iterateStates(s => {\r\n s.stateEffect().traits.forEach(x => result.push(x));\r\n });\r\n return result;\r\n }\r\n collectSkillActions() {\r\n const result = [];\r\n for (const i of this.collectBehaviors()) {\r\n i.onCollectSkillActions(result);\r\n }\r\n return result;\r\n }\r\n queryIdealParameterPlus(paramId) {\r\n return this.collectBehaviors().reduce((r, b) => r + b.onQueryIdealParameterPlus(paramId), 0);\r\n }\r\n /** @deprecated use collectBehaviors*/\r\n _callBehaviorIterationHelper(func) {\r\n const abilities = this.abilities();\r\n let response = SCommand_1.SCommandResponse.Pass;\r\n for (let i = abilities.length - 1; i >= 0; i--) {\r\n for (const b of abilities[i].behabiors()) {\r\n let r = func(b);\r\n if (r != SCommand_1.SCommandResponse.Pass) {\r\n response = r;\r\n }\r\n }\r\n }\r\n for (let i = this._basicBehaviors.length - 1; i >= 0; i--) {\r\n let r = func(MRLively_1.MRLively.world.behavior((this._basicBehaviors[i])));\r\n if (r != SCommand_1.SCommandResponse.Pass) {\r\n response = r;\r\n break;\r\n }\r\n }\r\n return response;\r\n }\r\n // TODO: State と通常の Behavior を分けるのやめる。\r\n // 今後印なども同じような実装となるが、型の違う Behavior を検索して呼び出すのが煩雑になりすぎる。\r\n /** @deprecated use collectBehaviors*/\r\n _callStateIterationHelper(func) {\r\n const states = this.states;\r\n let response = SCommand_1.SCommandResponse.Pass;\r\n for (let i = states.length - 1; i >= 0; i--) {\r\n response = states[i]._callStateIterationHelper(func);\r\n }\r\n return response;\r\n }\r\n /** @deprecated use collectBehaviors*/\r\n static _iterateBehavior(behaviorIds, func, isContinue) {\r\n let result = undefined;\r\n for (let iBehavior = behaviorIds.length - 1; iBehavior >= 0; iBehavior--) {\r\n const behavior = MRLively_1.MRLively.world.behavior(behaviorIds[iBehavior]);\r\n result = func(behavior);\r\n if (!isContinue(result)) {\r\n return result;\r\n }\r\n }\r\n return result;\r\n }\r\n /*\r\n public static _iterationHelper_ProcessPhase(objects: readonly TObject[], func: (x: LBehavior) => SPhaseResult): SPhaseResult | undefined {\r\n for (let iObject = objects.length - 1; iObject >= 0; iObject--) {\r\n const r = LEntity._iterateBehavior(objects[iObject].behaviorIds(), func, r => r == SPhaseResult.Pass);\r\n if (r) return r;\r\n }\r\n return SPhaseResult.Pass;\r\n }\r\n */\r\n /** @deprecated use iterateBehaviors2*/\r\n iterateBehaviors(func) {\r\n for (const id of this._basicBehaviors) {\r\n func(MRLively_1.MRLively.world.behavior(id));\r\n }\r\n }\r\n iterateStates(func) {\r\n for (const id of this._states) {\r\n if (func(MRLively_1.MRLively.world.object(id)) === false)\r\n return false;\r\n }\r\n return true;\r\n }\r\n iterateBehaviors2(func) {\r\n const sealedSpecialAbility = this.traits(MRBasics_1.MRBasics.traits.SealSpecialAbility).length > 0;\r\n for (let i = 0; i < this._basicBehaviors.length; i++) {\r\n const j = MRLively_1.MRLively.world.behavior(this._basicBehaviors[i]);\r\n if (sealedSpecialAbility && j.behaviorGroup() == LBehavior_1.LBehaviorGroup.SpecialAbility)\r\n continue;\r\n if (!func(j))\r\n return false;\r\n // Sub behaviors\r\n const behaviors = [];\r\n j.onCollectCharmdBehaviors(this, behaviors);\r\n for (let iCharmed = 0; iCharmed < behaviors.length; iCharmed++) {\r\n if (func(behaviors[iCharmed]) === false)\r\n return false;\r\n }\r\n }\r\n for (let i = 0; i < this._states.length; i++) {\r\n const j = MRLively_1.MRLively.world.object(this._states[i]);\r\n if (!j.iterateBehaviors(b => func(b)))\r\n return false;\r\n }\r\n for (let i = 0; i < this._abilities.length; i++) {\r\n const j = MRLively_1.MRLively.world.object(this._abilities[i]);\r\n if (!j.iterateBehaviors(b => func(b)))\r\n return false;\r\n }\r\n return true;\r\n }\r\n iterateBehaviorsReverse(func, fromTraits = false) {\r\n for (let i = this._states.length - 1; i >= 0; i--) {\r\n const j = MRLively_1.MRLively.world.object(this._states[i]);\r\n if (!j.iterateBehaviors(b => func(b)))\r\n return false;\r\n }\r\n for (let i = this._abilities.length - 1; i >= 0; i--) {\r\n const j = MRLively_1.MRLively.world.object(this._abilities[i]);\r\n if (!j.iterateBehaviors(b => func(b)))\r\n return false;\r\n }\r\n const sealedSpecialAbility = (!fromTraits) ?\r\n this.traits(MRBasics_1.MRBasics.traits.SealSpecialAbility).length > 0 :\r\n false;\r\n for (let i = this._basicBehaviors.length - 1; i >= 0; i--) {\r\n const j = MRLively_1.MRLively.world.behavior(this._basicBehaviors[i]);\r\n if (sealedSpecialAbility && j.behaviorGroup() == LBehavior_1.LBehaviorGroup.SpecialAbility)\r\n continue;\r\n if (func(j) === false)\r\n return false;\r\n // Sub behaviors\r\n const behaviors = [];\r\n j.onCollectCharmdBehaviors(this, behaviors);\r\n for (let iCharmed = behaviors.length - 1; iCharmed >= 0; iCharmed--) {\r\n if (func(behaviors[iCharmed]) === false)\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n /** @deprecated iterateBehaviorsReverse */\r\n collectBehaviors() {\r\n const result = [];\r\n this.iterateBehaviors2(b => {\r\n result.push(b);\r\n return true;\r\n });\r\n return result;\r\n }\r\n _callDecisionPhase(cctx, phase) {\r\n let result = SCommand_1.SPhaseResult.Pass;\r\n this.iterateBehaviorsReverse(b => {\r\n result = b.onDecisionPhase(this, cctx, phase);\r\n return result == SCommand_1.SPhaseResult.Pass;\r\n });\r\n return result;\r\n }\r\n _sendActivity(cctx, actx) {\r\n let result = SCommand_1.SCommandResponse.Pass;\r\n this.iterateBehaviorsReverse(b => {\r\n result = b.onPreActivity(this, cctx, actx);\r\n return result == SCommand_1.SCommandResponse.Pass;\r\n });\r\n if (result != SCommand_1.SCommandResponse.Pass)\r\n return result;\r\n this.iterateBehaviorsReverse(b => {\r\n result = b.onActivity(this, cctx, actx);\r\n return result == SCommand_1.SCommandResponse.Pass;\r\n });\r\n return result;\r\n }\r\n _sendActivityReaction(cctx, activity) {\r\n return this._callBehaviorIterationHelper(x => x.onActivityReaction(this, cctx, activity));\r\n }\r\n makeSaveContents() {\r\n let contents = {};\r\n contents.id = this.entityId();\r\n contents.floorId = this.floorId;\r\n contents.x = this.mx;\r\n contents.y = this.my;\r\n contents.behaviors = this._basicBehaviors;\r\n return contents;\r\n }\r\n extractSaveContents(contents) {\r\n this._setObjectId(contents.id);\r\n this.floorId = contents.floorId;\r\n this.mx = contents.x;\r\n this.my = contents.y;\r\n this._basicBehaviors = contents.behaviors;\r\n }\r\n //--------------------------------------------------------------------------------\r\n // Map Utils\r\n /**\r\n * この Entity が GroundLayer 上に存在しているかを確認する。\r\n * Map 上に出現していても、Ground 以外のレイヤーに存在している場合は false を返す。\r\n */\r\n isOnGround() {\r\n if (this.floorId.hasAny) {\r\n const block = MRLively_1.MRLively.mapView.currentMap.block(this.mx, this.my);\r\n return block.findEntityLayerKind(this) == DCommon_1.DBlockLayerKind.Ground;\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n //isTile(): boolean {\r\n // return this.findAttribute(RETileAttribute) != undefined;\r\n //}\r\n /** 0 is Invalid. */\r\n roomId() {\r\n return MRLively_1.MRLively.mapView.currentMap.block(this.mx, this.my)._roomId;\r\n }\r\n isOnRoom() {\r\n return this.roomId() > 0;\r\n }\r\n isOnPassageWay() {\r\n return this.roomId() <= 0;\r\n }\r\n layer() {\r\n const r = MRLively_1.MRLively.mapView.currentMap.block(this.mx, this.my).findEntityLayerKind(this);\r\n (0, Common_1.assert)(r);\r\n return r;\r\n }\r\n /** 特定の座標を持っておらず、Floor へ進入中であるかどうか。Map がロードされた後、EntryPoint へ配置される状態。 */\r\n isOnOffstage() {\r\n return this.mx < 0;\r\n }\r\n /** 現在のマップ上に出現しているか (いずれかの Block 上に存在しているか) */\r\n isAppearedOnMap() {\r\n if (!MRLively_1.MRLively.mapView.currentMap.isValidPosition(this.mx, this.my))\r\n return false;\r\n const block = MRLively_1.MRLively.mapView.currentMap.block(this.mx, this.my);\r\n return block.containsEntity(this);\r\n }\r\n //_thinkingContext: LThinkingContext | undefined;\r\n think() {\r\n // Priority の一番大きい Agent を取得する\r\n const agents = [];\r\n this.iterateBehaviorsReverse(b => {\r\n b.onCollectThinkingAgent(agents);\r\n });\r\n if (agents.length == 0)\r\n return;\r\n const agent = agents.reduce((prev, current) => (prev.priority > current.priority) ? prev : current);\r\n this.thinkingAgent = agent;\r\n this.thinkingAgent.clearCandidateSctions();\r\n this.thinkingAgent.think(this);\r\n //this._thinkingContext = new LThinkingContext();\r\n }\r\n generateDropItems(cause) {\r\n const result = [];\r\n this.iterateBehaviorsReverse(b => {\r\n b.onGenerateDropItems(this, cause, result);\r\n return true;\r\n });\r\n return result;\r\n }\r\n // Game_BattlerBase.prototype.recoverAll\r\n recoverAll() {\r\n this.removeAllStates(false);\r\n this.params.params().forEach(x => {\r\n if (x && x.data.recoverTarget) {\r\n x.clearDamage(this);\r\n }\r\n });\r\n }\r\n ;\r\n //----------------------------------------\r\n // true を返したら効果適用可能\r\n previewRejection(cctx, rejection) {\r\n let result = SCommand_1.SCommandResponse.Pass;\r\n this.iterateBehaviorsReverse(b => {\r\n result = b.onPreviewRejection(this, cctx, rejection);\r\n return result == SCommand_1.SCommandResponse.Pass;\r\n });\r\n return result != SCommand_1.SCommandResponse.Canceled;\r\n }\r\n //----------------------------------------\r\n // 未分類。何かしらシステム化したほうがよさそうなもの\r\n sendPartyEvent(eventId, args) {\r\n if (this._partyId > 0) {\r\n return MRLively_1.MRLively.world.party(this._partyId).send(eventId, args);\r\n }\r\n return true;\r\n }\r\n checkLooksLikeItem() {\r\n for (const b of this.collectBehaviors().reverse()) {\r\n const v = b.onCheckLooksLikeItem();\r\n if (v)\r\n return v;\r\n }\r\n return false;\r\n }\r\n checkLooksLikeGold() {\r\n for (const b of this.collectBehaviors().reverse()) {\r\n const v = b.onCheckLooksLikeGold();\r\n if (v)\r\n return v;\r\n }\r\n return false;\r\n }\r\n makeDeathResultStates() {\r\n this._deathResult.clearStates();\r\n this.iterateStates(s => this._deathResult.addState(s.stateDataId()));\r\n }\r\n canStack() {\r\n return !!this.collectTraits().find(x => x.code == MRBasics_1.MRBasics.traits.Stackable);\r\n }\r\n checkStackable(other) {\r\n if (!this.collectTraits().find(x => x.code == MRBasics_1.MRBasics.traits.Stackable))\r\n return false;\r\n if (!other.collectTraits().find(x => x.code == MRBasics_1.MRBasics.traits.Stackable))\r\n return false;\r\n // TODO: 今は矢だけなのでこれでよいが、アタッチされているAbilityなども見るべき\r\n return this.dataId == other.dataId;\r\n }\r\n isStacked() {\r\n (0, Common_1.assert)(this._stackCount >= 1);\r\n return this._stackCount >= 2;\r\n }\r\n /**\r\n * 指定 Entity をスタックに入れ、削除する。\r\n */\r\n increaseStack(other) {\r\n (0, Common_1.assert)(this.checkStackable(other));\r\n this._stackCount = Math.min(this._stackCount + other._stackCount, PluginParameters_1.paramMaxEntityStackCount);\r\n other.destroy();\r\n }\r\n /**\r\n * スタックを減らして新しい Entity を作成する。\r\n */\r\n decreaseStack() {\r\n (0, Common_1.assert)(this._stackCount >= 2);\r\n this._stackCount--;\r\n const newEntity = this.clone();\r\n newEntity._stackCount = 1;\r\n return newEntity;\r\n }\r\n //----------------------------------------\r\n // Debug Utils\r\n debugDisplayName() {\r\n return `Entity:${this._name}(${this.entityId().index2()}:${this.entityId().key2()})-(${this.data.entity.key})`;\r\n }\r\n //----------------------------------------\r\n // Fomula properties\r\n get hp() {\r\n return this.getActualParam(MRBasics_1.MRBasics.params.hp);\r\n }\r\n get atk() {\r\n return this.getActualParam(MRBasics_1.MRBasics.params.atk);\r\n }\r\n get def() {\r\n return this.getActualParam(MRBasics_1.MRBasics.params.def);\r\n }\r\n get agi() {\r\n return this.getActualParam(MRBasics_1.MRBasics.params.agi);\r\n }\r\n get fp() {\r\n return this.getActualParam(MRBasics_1.MRBasics.params.fp);\r\n }\r\n};\r\nLEntity = LEntity_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LEntity);\r\nexports.LEntity = LEntity;\r\n;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/entity/LEntity.ts?"); /***/ }), /***/ "./ts/mr/lively/entity/LInventoryBehavior.ts": /*!***************************************************!*\ !*** ./ts/mr/lively/entity/LInventoryBehavior.ts ***! \***************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\n/**\r\n *\r\n * [2021/9/26] モンスターのアイテムドロップ\r\n * ----------\r\n *\r\n * - 倒されたときのランダムアイテムドロップ\r\n * - 転ばされたときのランダムアイテムドロップ\r\n * - 倒されたときの固有アイテムドロップ (Mr.ブーン系など)\r\n * - ケンゴウ系能力によってはじかれた装備品\r\n * - マゼルン系おとす合成後アイテム\r\n *\r\n * モンスターから出てくるアイテムはこれらのいずれか。\r\n * 例えば Mr.ブーン はケンゴウ系能力で装備品をはじかれた後は、倒されても草を落とさない。\r\n *\r\n * ### 実装方針\r\n *\r\n * まずインベントリと、アイテムドロップフラグというものを作っておく。\r\n *\r\n * 倒されたとき…\r\n * - インベントリにアイテムがある場合、アイテムドロップフラグは考慮せずに、そのアイテムを落とす。\r\n * - 転んだ・弾かれたなどで UnitEntity が何かアイテムを生成した場合、アイテムドロップフラグをON.\r\n * - アイテムドロップフラグがONの場合、倒されてもアイテムを落とさない。\r\n * - 倒されたときにアイテムドロップフラグが OFF の場合、アイテムドロップ処理を開始する。\r\n * - 固有アイテムがあれば落とす。\r\n * - なければ、フロアの「てきがおとすもの」テーブルに従いドロップする。\r\n *\r\n *\r\n *\r\n * [2020/11/29] Note:\r\n * ----------\r\n * Inventory の定義をどこまでにするのかによるけど、\r\n * 「アイテムを持てる」という視点だと、Inventory は必ず Unit がもつ、というわけではない点に注意。\r\n *\r\n * - Player は持ち物として Inventory がある。\r\n * - 仲間によっては持ち物を持てる (シレン2 マーモ)\r\n * - モンスターも、アイテムを拾って保持し、投げる者がいる (シレン2 アメンジャ)\r\n * - 行商人も、アイテムを拾って保持する。(値札をつける)\r\n * - 倉庫を Entity とするかは微妙なところだが、しておくと UI が共通化できそう\r\n * - 壺は Inventory を持つアイテム、と考えられそう\r\n *\r\n * アイテムに関連する共通アクション\r\n * - 拾う\r\n * - 交換\r\n * - 置く\r\n * - 投げる\r\n * - (放り投げる)\r\n * - (落とす)\r\n * - (落下する)\r\n * - (ばらまく) : 転ばされた時。壺は稀に割れる\r\n *\r\n * 壺\r\n * - 入れる\r\n * - だす\r\n *\r\n * 固有アクション\r\n * - 食べる\r\n * - 振る\r\n * - 読む\r\n * - …など。\r\n *\r\n * NPCに対して スリ取り・スリ入れ ができるようなシステムを考えると、NPC は全員 Inventory を持つことになりそう。\r\n *\r\n *\r\n * ### UI共通化について\r\n *\r\n * \"持ち物リスト\" という画面を出すタイミングは、前述の Inventory を持ち得る Entity に共通すること。(モンスター能力は違うかもだけど)\r\n *\r\n * Inventory の内容を表示する画面、という考えて作っておくと再利用いろいろできそう。\r\n *\r\n *\r\n *\r\n * [2021/7/8] アイテムのスタック\r\n * ----------\r\n * ### スタックできるもの\r\n * - 矢弾\r\n * - 札\r\n * 種別として固定しない方がいいかも。\r\n *\r\n * ### スタックできる基準\r\n * elona だと、呪われていたりすると別スタック。\r\n * シレンだと、統合先の状態に合わせてスタックできる。\r\n * - つまり、スタックの条件はタイトルによって異なる。\r\n *\r\n * また、アイテムの種類ではなくインベントリの種類によっても異なるので注意。\r\n * - 壺インベントリの場合はスタックしない\r\n *\r\n * ### スタック数と使用回数は別物?\r\n * elona 的には別物。\r\n * こっちでも別物扱いの方がいいだろう。使用回数[0]はスタック0ではない。\r\n * スタック0はそもそも存在しないことを示す。\r\n *\r\n * ### スタックするタイミングは?\r\n * 少なくとも、インベントリに入ったタイミングではない。\r\n * [交換] では矢やお金はスタックされない。\r\n *\r\n */\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LInventoryBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LInventoryBehavior = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LBehavior_1 = __webpack_require__(/*! ../behaviors/LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ts/mr/system/MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst PluginParameters_1 = __webpack_require__(/*! ts/mr/PluginParameters */ \"./ts/mr/PluginParameters.ts\");\r\nconst STask_1 = __webpack_require__(/*! ts/mr/system/tasks/STask */ \"./ts/mr/system/tasks/STask.ts\");\r\nconst UName_1 = __webpack_require__(/*! ts/mr/utility/UName */ \"./ts/mr/utility/UName.ts\");\r\n//import { TDrop } from \"ts/mr/transactions/TDrop\";\r\nlet LInventoryBehavior = LInventoryBehavior_1 = class LInventoryBehavior extends LBehavior_1.LBehavior {\r\n constructor() {\r\n super();\r\n this._items = [];\r\n this._gold = 0;\r\n this._capacity = PluginParameters_1.paramSandboxWorldSystem ? 999 : PluginParameters_1.paramInventoryCapacity;\r\n this._storage = false;\r\n }\r\n get entities() {\r\n return this._items;\r\n }\r\n set entities(value) {\r\n this._items = value;\r\n }\r\n get capacity() {\r\n return this._capacity;\r\n }\r\n set capacity(value) {\r\n this._capacity = value;\r\n }\r\n get itemCount() {\r\n return this._items.length;\r\n }\r\n get remaining() {\r\n return this._capacity - this._items.length;\r\n }\r\n get isFully() {\r\n return this._items.length >= this._capacity;\r\n }\r\n get isStorage() {\r\n return this._storage;\r\n }\r\n hasAnyItem() {\r\n return this._items.length > 0;\r\n }\r\n get items() {\r\n return this._items.map(x => MRLively_1.MRLively.world.entity(x));\r\n }\r\n onInitialized(self, props) {\r\n if (props.code == \"Inventory\") {\r\n this.capacity = MRLively_1.MRLively.world.random().nextIntWithMinMax(props.minCapacity, props.maxCapacity + 1);\r\n this._storage = props.storage;\r\n }\r\n }\r\n onQueryNameView(self, nameView) {\r\n if (this._storage) {\r\n nameView.capacity = this.capacity - this._items.length;\r\n }\r\n }\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LInventoryBehavior_1);\r\n // Item のディープコピーはやめてみる。\r\n // 盗み能力を持つ敵にわざとアイテムを盗ませて分裂の杖を振ればアイテム増殖ができてしまうことになる。\r\n b._items = [];\r\n b._gold = this._gold;\r\n return b;\r\n }\r\n /** [ScriptCommandAPI] */\r\n clearItems() {\r\n const items = this.items;\r\n for (let i = items.length - 1; i >= 0; i--) {\r\n items[i].removeFromParent();\r\n }\r\n }\r\n reset() {\r\n // destroy items\r\n for (const entity of this.items) {\r\n (0, Common_1.assert)(entity.parentObject() == this);\r\n entity.clearParent();\r\n entity.destroy();\r\n }\r\n this._items.splice(0);\r\n this._gold = 0;\r\n }\r\n resetCapacity(newCapacity) {\r\n // // あふれる分は削除する\r\n // if (newCapacity < this._capacity) {\r\n // const items = this.items;\r\n // const removeItems = [];\r\n // for (let i = items.length - 1; i >= newCapacity; i--) {\r\n // removeItems.push(items[i]);\r\n // }\r\n // for (const item of removeItems) {\r\n // if (paramDestroyOverflowingItems) {\r\n // item.removeFromParent();\r\n // item.destroy();\r\n // }\r\n // else {\r\n // //TDrop.dropOrDestroyEntityForce(cctx, item, mx, my);\r\n // }\r\n // }\r\n // }\r\n // 消える分のアイテムはあらかじめ呼び出し側で処理しておくこと。\r\n (0, Common_1.assert)(newCapacity >= this._items.length);\r\n this._capacity = newCapacity.clamp(0, PluginParameters_1.paramDefaultStorageLimit);\r\n }\r\n iterateItems(func) {\r\n for (const id of this._items) {\r\n const r = func(MRLively_1.MRLively.world.entity(id));\r\n if (r === false)\r\n break;\r\n }\r\n }\r\n contains(entity) {\r\n return this._items.findIndex(x => x.equals(entity.entityId())) >= 0;\r\n }\r\n addEntity(entity) {\r\n (0, Common_1.assert)(!entity.parentEntity());\r\n (0, Common_1.assert)(!entity.isDestroyed());\r\n (0, Common_1.assert)(!this.isFully);\r\n const id = entity.entityId();\r\n (0, Common_1.assert)(this._items.find(x => x.equals(id)) === undefined);\r\n this._items.push(id);\r\n entity.setParent(this);\r\n }\r\n canAddEntityWithStacking(item) {\r\n if (item.hasTrait(MRBasics_1.MRBasics.traits.Stackable)) {\r\n // スタック可能なアイテムを追加しようとしているなら、同種があるかどうかをチェックする。\r\n const targetItem = this.items.find(x => x.checkStackable(item));\r\n if (targetItem) {\r\n return true;\r\n // const remaining = paramMaxEntityStackCount - targetItem._stackCount;\r\n // if (item._stackCount <= remaining) {\r\n // return true;\r\n // }\r\n }\r\n }\r\n return !this.isFully;\r\n }\r\n addEntityWithStacking(entity) {\r\n (0, Common_1.assert)(!entity.parentEntity());\r\n for (const item of this.items) {\r\n if (item.checkStackable(entity)) {\r\n item.increaseStack(entity);\r\n return;\r\n }\r\n }\r\n (0, Common_1.assert)(!this.isFully);\r\n this.addEntity(entity);\r\n }\r\n removeEntity(entity) {\r\n (0, Common_1.assert)(entity.parentObject() == this);\r\n const id = entity.entityId();\r\n const index = this._items.findIndex(x => x.equals(id));\r\n (0, Common_1.assert)(index >= 0);\r\n this._items.splice(index, 1);\r\n entity.clearParent();\r\n // TODO: onRemoveChild と統合したほうがいいかも。\r\n const args = { item: entity };\r\n MRLively_1.MRLively.eventServer.publish(MRSystem_1.MRSystem.commandContext, MRBasics_1.MRBasics.events.itemRemovedFromInventory, args);\r\n }\r\n onRemoveChild(entity) {\r\n if (this._items.mutableRemove(x => x.equals(entity.entityId()))) {\r\n entity.clearParent();\r\n const args = { item: entity };\r\n MRLively_1.MRLively.eventServer.publish(MRSystem_1.MRSystem.commandContext, MRBasics_1.MRBasics.events.itemRemovedFromInventory, args);\r\n }\r\n }\r\n onCollectTraits(self, result) {\r\n super.onCollectTraits(self, result);\r\n this.iterateItems(item => {\r\n result.pushArray(item.data.charmedTraits());\r\n });\r\n }\r\n onCollectCharmdBehaviors(self, result) {\r\n this.iterateItems(item => {\r\n item.iterateBehaviorsReverse(b => {\r\n if (b.isCharmBehavior()) {\r\n result.push(b);\r\n }\r\n });\r\n });\r\n }\r\n onPreviewRejection(self, cctx, rejection) {\r\n let result = true;\r\n this.iterateItems(item => {\r\n if (item.data.isTraitCharmItem) {\r\n if (!item.previewRejection(cctx, rejection)) {\r\n result = false;\r\n return false;\r\n }\r\n }\r\n return true;\r\n });\r\n if (!result)\r\n return SCommand_1.SCommandResponse.Canceled;\r\n return SCommand_1.SCommandResponse.Pass;\r\n }\r\n *onCommand(self, cctx, cmd) {\r\n if (cmd instanceof SCommand_1.STestAddItemCommand) {\r\n // 壺の中に壺は入れられない。\r\n if (this._storage && cmd.item.hasTrait(MRBasics_1.MRBasics.traits.DisallowIntoStorage)) {\r\n cctx.postMessage((0, Common_1.tr2)(\"%1を入れることはできない。\").format(UName_1.UName.makeNameAsItem(cmd.item)));\r\n return;\r\n }\r\n if (!this.isFully) {\r\n yield STask_1.STaskYieldResult.Accept;\r\n }\r\n }\r\n }\r\n // onPreviewEffectRejection(cctx: SCommandContext, self: LEntity, effect: DEffect): SCommandResponse {\r\n // let result = true;\r\n // this.iterateItems(item => {\r\n // if (item.data().isTraitCharmItem) {\r\n // if (!item.previewEffectBehaviorRejection(context, effect)) {\r\n // result = false;\r\n // return false;\r\n // }\r\n // }\r\n // return true;\r\n // });\r\n // if (!result) return SCommandResponse.Canceled;\r\n // return SCommandResponse.Pass;\r\n // }\r\n // onPreviewEffectBehaviorRejection(cctx: SCommandContext, self: LEntity, id: DEffectBehaviorId): SCommandResponse {\r\n // let result = true;\r\n // this.iterateItems(item => {\r\n // if (item.data().isTraitCharmItem) {\r\n // if (!item.previewEffectBehaviorReaction(context, id)) {\r\n // result = false;\r\n // return false;\r\n // }\r\n // }\r\n // return true;\r\n // });\r\n // if (!result) return SCommandResponse.Canceled;\r\n // return SCommandResponse.Pass;\r\n // }\r\n /*\r\n onRemoveEntityFromWhereabouts(cctx: SCommandContext, entity: LEntity): REResponse {\r\n const index = this._entities.findIndex(x => x.equals(entity.entityId()));\r\n if (index >= 0) {\r\n assert(entity.parentEntity() == this.ownerEntity());\r\n entity.clearParent();\r\n \r\n this._entities.splice(index, 1);\r\n }\r\n\r\n return REResponse.Pass;\r\n }\r\n */\r\n // Game_Party.prototype.gold\r\n gold() {\r\n return this._gold;\r\n }\r\n // Game_Party.prototype.gainGold\r\n gainGold(amount) {\r\n this._gold = (this._gold + amount).clamp(0, this.maxGold());\r\n }\r\n // Game_Party.prototype.loseGold\r\n loseGold(amount) {\r\n this.gainGold(-amount);\r\n }\r\n // Game_Party.prototype.maxGold\r\n maxGold() {\r\n return 99999999;\r\n }\r\n};\r\nLInventoryBehavior = LInventoryBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LInventoryBehavior);\r\nexports.LInventoryBehavior = LInventoryBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/entity/LInventoryBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/helpers/HMap.ts": /*!**************************************!*\ !*** ./ts/mr/lively/helpers/HMap.ts ***! \**************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.HMap = void 0;\r\nconst HMovement_1 = __webpack_require__(/*! ./HMovement */ \"./ts/mr/lively/helpers/HMovement.ts\");\r\nclass HMap {\r\n /**\r\n * 指定した座標から正面の Block を取得する\r\n */\r\n static getFrontBlock(map, x, y, d) {\r\n const offset = HMovement_1.HMovement.directionToOffset(d);\r\n const block = map.block(x + offset.x, y + offset.y);\r\n return block;\r\n }\r\n}\r\nexports.HMap = HMap;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/helpers/HMap.ts?"); /***/ }), /***/ "./ts/mr/lively/helpers/HMovement.ts": /*!*******************************************!*\ !*** ./ts/mr/lively/helpers/HMovement.ts ***! \*******************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.HMovement = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst DCommon_1 = __webpack_require__(/*! ts/mr/data/DCommon */ \"./ts/mr/data/DCommon.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nclass HMovement {\r\n static directionToOffset(d) {\r\n return { x: this.directionOffset[d][0], y: this.directionOffset[d][1] };\r\n }\r\n /**\r\n * 座標オフセットを向きに変換する\r\n */\r\n static offsetToDirectionSafety(offsetX, offsetY) {\r\n return this.offsetToDirection(offsetX, offsetY) || 2;\r\n }\r\n /**\r\n * 座標オフセットを向きに変換する\r\n */\r\n static offsetToDirection(offsetX, offsetY) {\r\n if (offsetX == 0) {\r\n if (offsetY == 0) {\r\n return undefined;\r\n }\r\n else if (offsetY > 0) {\r\n return 2;\r\n }\r\n else { // if (offsetY < 0)\r\n return 8;\r\n }\r\n }\r\n else if (offsetX > 0) {\r\n if (offsetY == 0) {\r\n return 6;\r\n }\r\n else if (offsetY > 0) {\r\n return 3;\r\n }\r\n else { // if (offsetY < 0)\r\n return 9;\r\n }\r\n }\r\n else { // if (offsetX < 0)\r\n if (offsetY == 0) {\r\n return 4;\r\n }\r\n else if (offsetY > 0) {\r\n return 1;\r\n }\r\n else { // if (offsetY < 0)\r\n return 7;\r\n }\r\n }\r\n }\r\n // 2点間の距離 (到達に必要な移動ブロック数) を求める。\r\n // 斜め移動を許可している Block 単位の距離なので、マンハッタン距離やユークリッド距離とは違う点に注意。\r\n /** @deprecated LBlockHelper */\r\n static blockDistance(x1, y1, x2, y2) {\r\n const dx = Math.abs(x2 - x1);\r\n const dy = Math.abs(y2 - y1);\r\n return Math.max(dx, dy);\r\n }\r\n /**\r\n * 指定した向きが斜め方向であるかを判断する\r\n */\r\n static isDiagonalMoving(d) {\r\n return (d % 2) != 0;\r\n }\r\n /**\r\n * 8(↑) 方向を基準としたローカル座標を、dir 方向に回転させたときのローカル座標を求める。\r\n * (ローカル座標は、座標の代わりに向きを指定)\r\n */\r\n static rotatePositionByDir(localDir, dir) {\r\n const localPos = this.directionToOffset(localDir);\r\n return this.transformRotationBlock(localPos.x, localPos.y, dir);\r\n }\r\n /**\r\n * 8(↑) 方向を基準としたローカル座標を、dir 方向に回転させたときのローカル座標を求める\r\n * @param localX\r\n * @param localY\r\n * @param dir\r\n *\r\n * 隣接ブロックや短い距離の扇形を変換するときなどで使用する。\r\n * 射程無限など広大な範囲をこれで変換するとパフォーマンスに影響が出るので、\r\n * そういったものは別途メソッドを用意すること。(TODO:)\r\n */\r\n static transformRotationBlock(localX, localY, dir) {\r\n /*\r\n\r\n 距離3を例にする。\r\n\r\n まず↓のように辺を分けて考える。\r\n\r\n 00001\r\n 3...1\r\n 3.@.1\r\n 3...1\r\n 32222\r\n\r\n 時計回りを正の移動方向と考えて、四辺は各 Edge の始点とする。(例:左上は Edge[0] の始点)\r\n\r\n \r\n\r\n\r\n */\r\n const distance = this.blockDistance(0, 0, localX, localY);\r\n const edgeLength = distance * 2;\r\n const edges = [\r\n {\r\n x: this.directionToOffset(7).x * distance,\r\n y: this.directionToOffset(7).y * distance,\r\n forwardX: 1,\r\n forwardY: 0,\r\n beginOffset: 0 * edgeLength,\r\n endOffset: 1 * edgeLength,\r\n },\r\n {\r\n x: this.directionToOffset(9).x * distance,\r\n y: this.directionToOffset(9).y * distance,\r\n forwardX: 0,\r\n forwardY: 1,\r\n beginOffset: 1 * edgeLength,\r\n endOffset: 2 * edgeLength,\r\n },\r\n {\r\n x: this.directionToOffset(3).x * distance,\r\n y: this.directionToOffset(3).y * distance,\r\n forwardX: -1,\r\n forwardY: 0,\r\n beginOffset: 2 * edgeLength,\r\n endOffset: 3 * edgeLength,\r\n },\r\n {\r\n x: this.directionToOffset(1).x * distance,\r\n y: this.directionToOffset(1).y * distance,\r\n forwardX: 0,\r\n forwardY: -1,\r\n beginOffset: 3 * edgeLength,\r\n endOffset: 4 * edgeLength,\r\n }\r\n ];\r\n let pos = -1;\r\n for (const edge of edges) {\r\n const sx = Math.min(edge.x, edge.x + edge.forwardX * edgeLength);\r\n const sy = Math.min(edge.y, edge.y + edge.forwardY * edgeLength);\r\n const ex = Math.max(edge.x, edge.x + edge.forwardX * edgeLength);\r\n const ey = Math.max(edge.y, edge.y + edge.forwardY * edgeLength);\r\n if (sx <= localX && localX <= ex && sy <= localY && localY <= ey) {\r\n pos = this.blockDistance(edge.x, edge.y, localX, localY) + edge.beginOffset;\r\n break;\r\n }\r\n }\r\n (0, Common_1.assert)(pos >= 0);\r\n // dir に向けるには、外周上を何 Block 分移動すればよいか?\r\n const offset = this._edgeOffsetTable[dir] * distance;\r\n const newPos = (pos + offset) % edges[3].endOffset; // 特に dir=7で変換すると、右方向が1週分回ることもある\r\n const edge = edges.find(e => e.beginOffset <= newPos && newPos < e.endOffset);\r\n (0, Common_1.assert)(edge);\r\n const edgeLocalPos = newPos - edge.beginOffset;\r\n return {\r\n x: edge.x + (edge.forwardX * edgeLocalPos),\r\n y: edge.y + (edge.forwardY * edgeLocalPos),\r\n };\r\n }\r\n /**\r\n * entity が oldBlock から newBlock へ \"歩行\" 移動できるか判定する。\r\n *\r\n * 地形および Block 性質を判断材料とする点に注意。 (Block 種類及び Block 性質と、Entity 性質の確認)\r\n * 状態異常などによる移動制限は Behavior など他で行う。\r\n *\r\n * 移動可否は entity や Block の性質を考慮する。\r\n * 例えば entity が水路侵入可能であり、Block が水路であれば移動先候補になる。\r\n */\r\n static checkPassageBlockToBlock(entity, oldBlock, newBlock, method, layer) {\r\n const map = MRLively_1.MRLively.mapView.currentMap;\r\n const actualLayer = layer || entity.getHomeLayer();\r\n const dx = newBlock.mx - oldBlock.mx;\r\n const dy = newBlock.my - oldBlock.my;\r\n if (Math.abs(dx) > 1)\r\n return false; // 隣接 Block への移動ではない\r\n if (Math.abs(dy) > 1)\r\n return false; // 隣接 Block への移動ではない\r\n if (layer == DCommon_1.DBlockLayerKind.Projectile) {\r\n // 矢の罠など、壁Blockを移動開始地点とする場合に備える。\r\n // この場合は移動先への侵入判定のみ行い、斜め移動のエッジ判定は不要。\r\n if (!map.canMoveEntering(newBlock, entity, method, actualLayer))\r\n return false;\r\n }\r\n else {\r\n if (!map.canLeaving(oldBlock, entity))\r\n return false;\r\n if (!map.canMoveEntering(newBlock, entity, method, actualLayer))\r\n return false;\r\n const d = this.offsetToDirectionSafety(dx, dy);\r\n if (this.isDiagonalMoving(d)) {\r\n // 斜め移動の場合\r\n const fl = this.rotatePositionByDir(7, d); // 左前\r\n const fr = this.rotatePositionByDir(9, d); // 右前\r\n const flBlock = map.block(entity.mx + fl.x, entity.my + fl.y);\r\n const frBlock = map.block(entity.mx + fr.x, entity.my + fr.y);\r\n if (flBlock.isWallLikeShape())\r\n return false; // 壁があるので移動できない\r\n if (frBlock.isWallLikeShape())\r\n return false; // 壁があるので移動できない\r\n }\r\n else {\r\n // 平行移動の場合\r\n }\r\n }\r\n return true;\r\n }\r\n}\r\nexports.HMovement = HMovement;\r\nHMovement.directions8 = [1, 2, 3, 4, 6, 7, 8, 9];\r\nHMovement.directionOffset = [\r\n [0, 0],\r\n [-1, 1], [0, 1], [1, 1],\r\n [-1, 0], [0, 0], [1, 0],\r\n [-1, -1], [0, -1], [1, -1],\r\n];\r\nHMovement.adjacent8Offsets = [\r\n [-1, -1], [0, -1], [1, -1],\r\n [-1, 0], [1, 0],\r\n [-1, 1], [0, 1], [1, 1],\r\n];\r\n// 8 を基準に時計回り\r\nHMovement._edgeOffsetTable = [\r\n 0,\r\n 5, 4, 3,\r\n 6, 0, 2,\r\n 7, 0, 1,\r\n];\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/helpers/HMovement.ts?"); /***/ }), /***/ "./ts/mr/lively/helpers/LBlockHelper.ts": /*!**********************************************!*\ !*** ./ts/mr/lively/helpers/LBlockHelper.ts ***! \**********************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LBlockHelper = void 0;\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst Helpers_1 = __webpack_require__(/*! ts/mr/system/Helpers */ \"./ts/mr/system/Helpers.ts\");\r\nclass LBlockHelper {\r\n /**\r\n * 指定した factionId に敵対的な footpoint を持つかどうかを返す。\r\n * @param factionId\r\n */\r\n static hasHostileFootpoint(block, factionId) {\r\n for (const faction of MRData_1.MRData.factions) {\r\n if (factionId === faction.id) {\r\n continue;\r\n }\r\n if (!Helpers_1.Helpers.isHostileFactionId(factionId, faction.id)) {\r\n continue;\r\n }\r\n const footprints = block.footprints;\r\n const factionDensities = footprints.factionDensities;\r\n const density = factionDensities[faction.id];\r\n if (density !== undefined && density > 0) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n /**\r\n * 指定した blocks のうち、self から最も近い block を返す。\r\n */\r\n static selectNearestBlock(blocks, entity) {\r\n if (blocks.length <= 0) {\r\n return undefined;\r\n }\r\n let nearestBlock = blocks[0];\r\n let nearestDistance = this.blockDistance(nearestBlock.mx, nearestBlock.my, entity.mx, entity.my);\r\n for (let i = 1; i < blocks.length; i++) {\r\n const block = blocks[i];\r\n const distance = this.blockDistance(block.mx, block.my, entity.mx, entity.my);\r\n if (distance < nearestDistance) {\r\n nearestBlock = block;\r\n nearestDistance = distance;\r\n }\r\n }\r\n return nearestBlock;\r\n }\r\n /**\r\n * 2点間の距離 (到達に必要な移動ブロック数) を求める。\r\n * 斜め移動を許可している Block 単位の距離なので、マンハッタン距離やユークリッド距離とは違う点に注意。\r\n */\r\n static blockDistance(x1, y1, x2, y2) {\r\n const dx = Math.abs(x2 - x1);\r\n const dy = Math.abs(y2 - y1);\r\n return Math.max(dx, dy);\r\n }\r\n}\r\nexports.LBlockHelper = LBlockHelper;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/helpers/LBlockHelper.ts?"); /***/ }), /***/ "./ts/mr/lively/helpers/LRouteSearch.ts": /*!**********************************************!*\ !*** ./ts/mr/lively/helpers/LRouteSearch.ts ***! \**********************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LRouteSearch = void 0;\r\nconst LMap_1 = __webpack_require__(/*! ../LMap */ \"./ts/mr/lively/LMap.ts\");\r\nconst HMap_1 = __webpack_require__(/*! ./HMap */ \"./ts/mr/lively/helpers/HMap.ts\");\r\nconst HMovement_1 = __webpack_require__(/*! ./HMovement */ \"./ts/mr/lively/helpers/HMovement.ts\");\r\n// https://ja.wikipedia.org/wiki/A*\r\n// https://qiita.com/2dgames_jp/items/f29e915357c1decbc4b7\r\nclass LRouteSearch {\r\n /** RMMZ の自動移動の検索処理 */\r\n static findDirectionTo(map, entity, startX, startY, goalX, goalY) {\r\n const searchLimit = 12; // FIXME:\r\n const mapWidth = map.width();\r\n const nodeList = [];\r\n const openList = [];\r\n const closedList = [];\r\n if (startX === goalX && startY === goalY) {\r\n return undefined;\r\n }\r\n const start = {\r\n parent: null,\r\n x: startX,\r\n y: startY,\r\n g: 0,\r\n f: this.h(startX, startY, goalX, goalY), // 距離というか、タイル数。 RMMZ だと、斜め移動が考慮されない。\r\n };\r\n let best = start;\r\n nodeList.push(start);\r\n openList.push(start.y * mapWidth + start.x);\r\n while (nodeList.length > 0) {\r\n // f(スコア?)が最も小さいものを探す\r\n let bestIndex = 0;\r\n for (let i = 0; i < nodeList.length; i++) {\r\n if (nodeList[i].f < nodeList[bestIndex].f) {\r\n bestIndex = i;\r\n }\r\n }\r\n const current = nodeList[bestIndex];\r\n const x1 = current.x;\r\n const y1 = current.y;\r\n const pos1 = y1 * mapWidth + x1;\r\n const g1 = current.g;\r\n // Close 処理?\r\n // current を nodeList, openList から除外し、closedList に追加\r\n nodeList.splice(bestIndex, 1);\r\n openList.splice(openList.indexOf(pos1), 1);\r\n closedList.push(pos1);\r\n if (current.x === goalX && current.y === goalY) {\r\n best = current;\r\n break;\r\n }\r\n if (g1 >= searchLimit) {\r\n continue;\r\n }\r\n for (const direction of HMovement_1.HMovement.directions8) {\r\n const x2 = this.xWithDirection(x1, direction);\r\n const y2 = this.yWithDirection(y1, direction);\r\n const pos2 = y2 * mapWidth + x2;\r\n if (closedList.includes(pos2)) {\r\n continue; // 既に通ったところだった\r\n }\r\n if (!this.canPass(map, entity, x1, y1, direction)) {\r\n continue; // current から direction 方向に移動できない\r\n }\r\n const g2 = g1 + 1;\r\n const index2 = openList.indexOf(pos2);\r\n if (index2 < 0 || g2 < nodeList[index2].g) {\r\n let neighbor;\r\n if (index2 >= 0) {\r\n neighbor = nodeList[index2]; // 既に OpenList にある場合は、そのノードの情報を更新する\r\n }\r\n else {\r\n neighbor = { parent: null, x: 0, y: 0, g: 0, f: 0 };\r\n nodeList.push(neighbor);\r\n openList.push(pos2);\r\n }\r\n neighbor.parent = current;\r\n neighbor.x = x2;\r\n neighbor.y = y2;\r\n neighbor.g = g2;\r\n neighbor.f = g2 + this.h(x2, y2, goalX, goalY);\r\n if (!best || neighbor.f - neighbor.g < best.f - best.g) {\r\n best = neighbor;\r\n }\r\n }\r\n }\r\n }\r\n // StartNode のひとつ前に戻るまで逆に辿る\r\n let node = best;\r\n while (node.parent && node.parent !== start) {\r\n node = node.parent;\r\n }\r\n return HMovement_1.HMovement.offsetToDirection(node.x - start.x, node.y - start.y);\r\n // const deltaX1 = $gameMap.deltaX(node.x, start.x);\r\n // const deltaY1 = $gameMap.deltaY(node.y, start.y);\r\n // if (deltaY1 > 0) {\r\n // return 2;\r\n // } else if (deltaX1 < 0) {\r\n // return 4;\r\n // } else if (deltaX1 > 0) {\r\n // return 6;\r\n // } else if (deltaY1 < 0) {\r\n // return 8;\r\n // }\r\n // const deltaX2 = this.deltaXFrom(goalX);\r\n // const deltaY2 = this.deltaYFrom(goalY);\r\n // if (Math.abs(deltaX2) > Math.abs(deltaY2)) {\r\n // return deltaX2 > 0 ? 4 : 6;\r\n // } else if (deltaY2 !== 0) {\r\n // return deltaY2 > 0 ? 8 : 2;\r\n // }\r\n //return 0;\r\n }\r\n static xWithDirection(x, d) {\r\n return x + HMovement_1.HMovement.directionToOffset(d).x;\r\n //const x2 = $gameMap.roundXWithDirection(x1, direction);\r\n }\r\n ;\r\n static yWithDirection(y, d) {\r\n return y + HMovement_1.HMovement.directionToOffset(d).y;\r\n //const y2 = $gameMap.roundYWithDirection(y1, direction);\r\n }\r\n ;\r\n static canPass(map, entity, x, y, d) {\r\n const block1 = map.block(x, y);\r\n const block2 = HMap_1.HMap.getFrontBlock(map, x, y, d);\r\n return HMovement_1.HMovement.checkPassageBlockToBlock(entity, block1, block2, LMap_1.MovingMethod.Walk);\r\n }\r\n // チェビシェフ距離\r\n static h(nodeX, nodeY, goalX, goalY) {\r\n return Math.max(Math.abs(nodeX - goalX), Math.abs(nodeY - goalY));\r\n }\r\n}\r\nexports.LRouteSearch = LRouteSearch;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/helpers/LRouteSearch.ts?"); /***/ }), /***/ "./ts/mr/lively/internal.ts": /*!**********************************!*\ !*** ./ts/mr/lively/internal.ts ***! \**********************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}));\r\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n__exportStar(__webpack_require__(/*! ./behaviors/LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\"), exports);\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/internal.ts?"); /***/ }), /***/ "./ts/mr/lively/states/LDebugMoveRight.ts": /*!************************************************!*\ !*** ./ts/mr/lively/states/LDebugMoveRight.ts ***! \************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LDebugMoveRightBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LDebugMoveRightBehavior = void 0;\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst LMap_1 = __webpack_require__(/*! ../LMap */ \"./ts/mr/lively/LMap.ts\");\r\nconst LActivity_1 = __webpack_require__(/*! ../activities/LActivity */ \"./ts/mr/lively/activities/LActivity.ts\");\r\nconst LCommon_1 = __webpack_require__(/*! ../LCommon */ \"./ts/mr/lively/LCommon.ts\");\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst LThinkingAgent_1 = __webpack_require__(/*! ../ai2/LThinkingAgent */ \"./ts/mr/lively/ai2/LThinkingAgent.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst PluginParameters_1 = __webpack_require__(/*! ts/mr/PluginParameters */ \"./ts/mr/PluginParameters.ts\");\r\nconst LThinkingAction_1 = __webpack_require__(/*! ../ai2/LThinkingAction */ \"./ts/mr/lively/ai2/LThinkingAction.ts\");\r\nlet LDebugMoveRightBehavior = LDebugMoveRightBehavior_1 = class LDebugMoveRightBehavior extends LBehavior_1.LBehavior {\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LDebugMoveRightBehavior_1);\r\n return b;\r\n }\r\n onDecisionPhase(self, cctx, phase) {\r\n if (PluginParameters_1.paramUseThinkingAgent)\r\n return SCommand_1.SPhaseResult.Pass;\r\n if (phase == LBehavior_1.DecisionPhase.AIMinor) {\r\n // 右へ移動するだけ\r\n let dir = 6;\r\n // ランダム移動\r\n //const table = [1,2,3,4,6,7,8,9];\r\n //const dir = table[REGame.world.random().nextIntWithMax(8)];\r\n if (dir != 0 && MRLively_1.MRLively.mapView.currentMap.checkPassage(self, dir, LMap_1.MovingMethod.Walk)) {\r\n cctx.postActivity(LActivity_1.LActivity.makeDirectionChange(self, dir));\r\n cctx.postActivity(LActivity_1.LActivity.makeMoveToAdjacent(self, dir));\r\n }\r\n cctx.postConsumeActionToken(self, LCommon_1.LActionTokenConsumeType.MinorActed);\r\n return SCommand_1.SPhaseResult.Handled;\r\n }\r\n return super.onDecisionPhase(self, cctx, phase);\r\n }\r\n onThink(self, agent) {\r\n const action = new LThinkingAction_1.LThinkingAction({\r\n rating: LThinkingAgent_1.LThinkingActionRatings.Max,\r\n skillId: MRData_1.MRData.system.skills.move,\r\n }, []);\r\n action.priorityMovingDirection = 6;\r\n agent.addCandidateAction(action);\r\n return SCommand_1.SPhaseResult.Pass;\r\n }\r\n};\r\nLDebugMoveRightBehavior = LDebugMoveRightBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LDebugMoveRightBehavior);\r\nexports.LDebugMoveRightBehavior = LDebugMoveRightBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/states/LDebugMoveRight.ts?"); /***/ }), /***/ "./ts/mr/lively/states/LGenericRMMZStateBehavior.ts": /*!**********************************************************!*\ !*** ./ts/mr/lively/states/LGenericRMMZStateBehavior.ts ***! \**********************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LGenericRMMZStateBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LGenericRMMZStateBehavior = void 0;\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst LBehavior_1 = __webpack_require__(/*! ../behaviors/LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\nconst LState_1 = __webpack_require__(/*! ./LState */ \"./ts/mr/lively/states/LState.ts\");\r\nconst DState_1 = __webpack_require__(/*! ts/mr/data/DState */ \"./ts/mr/data/DState.ts\");\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LConfusionAI_1 = __webpack_require__(/*! ../ai/LConfusionAI */ \"./ts/mr/lively/ai/LConfusionAI.ts\");\r\nconst LUnitBehavior_1 = __webpack_require__(/*! ../behaviors/LUnitBehavior */ \"./ts/mr/lively/behaviors/LUnitBehavior.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst UMovement_1 = __webpack_require__(/*! ts/mr/utility/UMovement */ \"./ts/mr/utility/UMovement.ts\");\r\nconst LBlindAI_1 = __webpack_require__(/*! ../ai/LBlindAI */ \"./ts/mr/lively/ai/LBlindAI.ts\");\r\nconst UName_1 = __webpack_require__(/*! ts/mr/utility/UName */ \"./ts/mr/utility/UName.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst PluginParameters_1 = __webpack_require__(/*! ts/mr/PluginParameters */ \"./ts/mr/PluginParameters.ts\");\r\nconst LThinkingDeterminer_Confusion_1 = __webpack_require__(/*! ../ai2/LThinkingDeterminer_Confusion */ \"./ts/mr/lively/ai2/LThinkingDeterminer_Confusion.ts\");\r\nconst LThinkingDeterminer_Blind_1 = __webpack_require__(/*! ../ai2/LThinkingDeterminer_Blind */ \"./ts/mr/lively/ai2/LThinkingDeterminer_Blind.ts\");\r\nlet LGenericRMMZStateBehavior = LGenericRMMZStateBehavior_1 = class LGenericRMMZStateBehavior extends LBehavior_1.LBehavior {\r\n constructor() {\r\n super();\r\n this._stateTurn = 0;\r\n }\r\n clone(newOwner) {\r\n var _a;\r\n const b = MRLively_1.MRLively.world.spawn(LGenericRMMZStateBehavior_1);\r\n b._stateTurn = this._stateTurn;\r\n b._thinking = (_a = this._thinking) === null || _a === void 0 ? void 0 : _a.clone();\r\n return b;\r\n }\r\n // Game_BattlerBase.prototype.isStateExpired \r\n isStateExpired() {\r\n return this._stateTurn !== null && this._stateTurn <= 0;\r\n }\r\n // Game_BattlerBase.prototype.resetStateCounts\r\n resetStateCounts() {\r\n const effect = this.stateEffect();\r\n this._stateTurn = null;\r\n const data = effect.autoRemovals.find(x => x.kind == DState_1.DAutoRemovalTiming.TurnEnd);\r\n if (data && data.kind === DState_1.DAutoRemovalTiming.TurnEnd) {\r\n if (data.minTurns == data.maxTurns) {\r\n this._stateTurn = data.maxTurns;\r\n }\r\n else {\r\n const variance = 1 + Math.max(data.maxTurns - data.minTurns, 0);\r\n this._stateTurn = data.minTurns + MRLively_1.MRLively.world.random().nextIntWithMax(variance);\r\n }\r\n }\r\n }\r\n updateStateTurns() {\r\n if (this._stateTurn && this._stateTurn > 0) {\r\n this._stateTurn--;\r\n }\r\n }\r\n // Game_Battler.prototype.removeStatesAuto\r\n removeStatesAuto() {\r\n var _a;\r\n if (this.isStateExpired()) {\r\n //this.removeThisState();\r\n (_a = this.parentAs(LState_1.LState)) === null || _a === void 0 ? void 0 : _a.removeThisState();\r\n }\r\n }\r\n state() {\r\n const parent = this.parentAs(LState_1.LState);\r\n (0, Common_1.assert)(parent);\r\n return parent;\r\n }\r\n stateData() {\r\n const parent = this.parentAs(LState_1.LState);\r\n (0, Common_1.assert)(parent);\r\n return parent.stateData();\r\n }\r\n stateEffect() {\r\n const parent = this.parentAs(LState_1.LState);\r\n (0, Common_1.assert)(parent);\r\n return parent.stateEffect();\r\n }\r\n onAttached(self) {\r\n this.resetStateCounts();\r\n //REGame.eventServer.subscribe(DBasics.events.roomEnterd, this);\r\n const effect = this.stateEffect();\r\n if (PluginParameters_1.paramUseThinkingAgent) {\r\n if (effect.restriction == DState_1.DStateRestriction.AttackToOther) {\r\n this._thinking = new LThinkingDeterminer_Confusion_1.LThinkingDeterminer_Confusion(LConfusionAI_1.LConfusionAIRestriction.AttackToOther);\r\n }\r\n else if (effect.restriction == DState_1.DStateRestriction.Blind) {\r\n this._thinking = new LThinkingDeterminer_Blind_1.LThinkingDeterminer_Blind();\r\n }\r\n }\r\n else {\r\n if (effect.restriction == DState_1.DStateRestriction.AttackToOther) {\r\n this._characterAI = new LConfusionAI_1.LConfusionAI(LConfusionAI_1.LConfusionAIRestriction.AttackToOther);\r\n }\r\n else if (effect.restriction == DState_1.DStateRestriction.Blind) {\r\n this._characterAI = new LBlindAI_1.LBlindAI();\r\n }\r\n }\r\n }\r\n onDetached(self) {\r\n }\r\n onQueryIdleSequelId() {\r\n return this.stateData().idleSequel;\r\n }\r\n /*\r\n onQueryIdealParameterPlus(parameterId: DParameterId): number {\r\n const data = this.stateData();\r\n const formula = data.parameterBuffFormulas[parameterId];\r\n if (formula) {\r\n const slv = this.state().level();\r\n try {\r\n const v = eval(formula);\r\n return v;\r\n } catch (e) {\r\n console.error(e);\r\n return 0;\r\n }\r\n }\r\n\r\n return 0;\r\n }\r\n */\r\n onDecisionPhase(self, cctx, phase) {\r\n if (this._characterAI) {\r\n if (phase == LBehavior_1.DecisionPhase.AIMinor) {\r\n return this._characterAI.thinkMoving(cctx, self);\r\n }\r\n else if (phase == LBehavior_1.DecisionPhase.AIMajor) {\r\n return this._characterAI.thinkAction(cctx, self);\r\n }\r\n }\r\n // if (this._thinking) {\r\n // return SPhaseResult.Pass;\r\n // }\r\n // 解除判定\r\n if (phase == LBehavior_1.DecisionPhase.UpdateState) {\r\n this.updateStateTurns();\r\n this.removeStatesAuto();\r\n //this.count++;\r\n //if (this.count > 2) {\r\n // this.removeThisState();\r\n //}\r\n return SCommand_1.SPhaseResult.Pass;\r\n }\r\n else if (phase == LBehavior_1.DecisionPhase.Manual ||\r\n phase == LBehavior_1.DecisionPhase.AIMinor ||\r\n phase == LBehavior_1.DecisionPhase.AIMajor) {\r\n const effect = this.stateEffect();\r\n if (effect.restriction == DState_1.DStateRestriction.None) {\r\n return SCommand_1.SPhaseResult.Pass;\r\n }\r\n else if (effect.restriction == DState_1.DStateRestriction.NotAction) {\r\n //cctx.postConsumeActionToken(self, LActionTokenType.Major);\r\n // 行動スキップ\r\n return SCommand_1.SPhaseResult.Handled;\r\n }\r\n else {\r\n //throw new Error(\"Not implemented.\");\r\n //return SPhaseResult.Handled;\r\n return SCommand_1.SPhaseResult.Pass;\r\n }\r\n }\r\n else {\r\n return SCommand_1.SPhaseResult.Pass;\r\n }\r\n }\r\n onThink(self, agent) {\r\n if (this._thinking) {\r\n return this._thinking.onThink(agent, self);\r\n }\r\n else {\r\n return SCommand_1.SPhaseResult.Pass;\r\n }\r\n }\r\n onActivity(self, cctx, actx) {\r\n const state = this.state();\r\n const traits = [];\r\n state.collectTraits(self, traits);\r\n //if (self.traitsWithId(REBasics.traits.SealActivity, activity.actionId()).length > 0) {\r\n if (traits.find(t => t.code == MRBasics_1.MRBasics.traits.SealActivity && t.dataId == actx.activity().actionId())) {\r\n const data = this.stateData();\r\n const targetName = UName_1.UName.makeUnitName(self);\r\n cctx.postMessage(data.message3.format(targetName));\r\n return SCommand_1.SCommandResponse.Canceled;\r\n }\r\n return SCommand_1.SCommandResponse.Pass;\r\n }\r\n onPreprocessActivity(cctx, activity) {\r\n const effect = this.stateEffect();\r\n if (effect.restriction == DState_1.DStateRestriction.AttackToOther) {\r\n const unit = activity.actor().findEntityBehavior(LUnitBehavior_1.LUnitBehavior);\r\n if (unit && unit.manualMovement()) { // Player?\r\n // 歩行移動であれば、方向をランダムにする\r\n if (activity.actionId() == MRBasics_1.MRBasics.actions.MoveToAdjacentActionId) {\r\n const dir = cctx.random().select(UMovement_1.UMovement.directions);\r\n activity\r\n .withEffectDirection(dir)\r\n .withEntityDirection(dir);\r\n return activity;\r\n }\r\n // 通常攻撃であれば、方向をランダムにする\r\n if (activity.actionId() == MRBasics_1.MRBasics.actions.performSkill && activity.skillId() == MRData_1.MRData.system.skills.normalAttack) {\r\n const dir = cctx.random().select(UMovement_1.UMovement.directions);\r\n activity.withEntityDirection(dir);\r\n return activity;\r\n }\r\n }\r\n }\r\n return activity;\r\n }\r\n};\r\nLGenericRMMZStateBehavior = LGenericRMMZStateBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LGenericRMMZStateBehavior);\r\nexports.LGenericRMMZStateBehavior = LGenericRMMZStateBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/states/LGenericRMMZStateBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/states/LIllusionStateBehavior.ts": /*!*******************************************************!*\ !*** ./ts/mr/lively/states/LIllusionStateBehavior.ts ***! \*******************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LIllusionStateBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LIllusionStateBehavior = void 0;\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst LBehavior_1 = __webpack_require__(/*! ../behaviors/LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LEscapeAI_1 = __webpack_require__(/*! ../ai/LEscapeAI */ \"./ts/mr/lively/ai/LEscapeAI.ts\");\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nlet LIllusionStateBehavior = LIllusionStateBehavior_1 = class LIllusionStateBehavior extends LBehavior_1.LBehavior {\r\n constructor() {\r\n super();\r\n this._characterAI = new LEscapeAI_1.LEscapeAI();\r\n }\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LIllusionStateBehavior_1);\r\n b._characterAI = this._characterAI.clone();\r\n return b;\r\n }\r\n onDecisionPhase(self, cctx, phase) {\r\n if (this._characterAI) {\r\n if (phase == LBehavior_1.DecisionPhase.AIMinor) {\r\n return this._characterAI.thinkMoving(cctx, self);\r\n }\r\n else if (phase == LBehavior_1.DecisionPhase.AIMajor) {\r\n return this._characterAI.thinkAction(cctx, self);\r\n }\r\n }\r\n return SCommand_1.SPhaseResult.Pass;\r\n }\r\n};\r\nLIllusionStateBehavior = LIllusionStateBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LIllusionStateBehavior);\r\nexports.LIllusionStateBehavior = LIllusionStateBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/states/LIllusionStateBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/states/LItemStandingState.ts": /*!***************************************************!*\ !*** ./ts/mr/lively/states/LItemStandingState.ts ***! \***************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LItemStandingBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LItemStandingBehavior = void 0;\r\nconst LBehavior_1 = __webpack_require__(/*! ../behaviors/LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst DCommon_1 = __webpack_require__(/*! ts/mr/data/DCommon */ \"./ts/mr/data/DCommon.ts\");\r\nlet LItemStandingBehavior = LItemStandingBehavior_1 = class LItemStandingBehavior extends LBehavior_1.LBehavior {\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LItemStandingBehavior_1);\r\n return b;\r\n }\r\n queryHomeLayer() {\r\n return DCommon_1.DBlockLayerKind.Unit;\r\n }\r\n};\r\nLItemStandingBehavior = LItemStandingBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LItemStandingBehavior);\r\nexports.LItemStandingBehavior = LItemStandingBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/states/LItemStandingState.ts?"); /***/ }), /***/ "./ts/mr/lively/states/LNapStateBehavior.ts": /*!**************************************************!*\ !*** ./ts/mr/lively/states/LNapStateBehavior.ts ***! \**************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LNapStateBehavior_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LNapStateBehavior = void 0;\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst Helpers_1 = __webpack_require__(/*! ts/mr/system/Helpers */ \"./ts/mr/system/Helpers.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst LBehavior_1 = __webpack_require__(/*! ../behaviors/LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LState_1 = __webpack_require__(/*! ./LState */ \"./ts/mr/lively/states/LState.ts\");\r\nconst LEventServer_1 = __webpack_require__(/*! ../LEventServer */ \"./ts/mr/lively/LEventServer.ts\");\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst UMovement_1 = __webpack_require__(/*! ts/mr/utility/UMovement */ \"./ts/mr/utility/UMovement.ts\");\r\nvar GetUpReserved;\r\n(function (GetUpReserved) {\r\n GetUpReserved[GetUpReserved[\"None\"] = 0] = \"None\";\r\n GetUpReserved[GetUpReserved[\"Random\"] = 1] = \"Random\";\r\n GetUpReserved[GetUpReserved[\"Certainly\"] = 2] = \"Certainly\";\r\n})(GetUpReserved || (GetUpReserved = {}));\r\nlet LNapStateBehavior = LNapStateBehavior_1 = class LNapStateBehavior extends LBehavior_1.LBehavior {\r\n constructor() {\r\n super(...arguments);\r\n this._getUpReserved = GetUpReserved.None;\r\n }\r\n clone(newOwner) {\r\n const b = MRLively_1.MRLively.world.spawn(LNapStateBehavior_1);\r\n b._getUpReserved = this._getUpReserved;\r\n return b;\r\n }\r\n onAttached(self) {\r\n MRLively_1.MRLively.eventServer.subscribe(MRBasics_1.MRBasics.events.roomEnterd, this);\r\n MRLively_1.MRLively.eventServer.subscribe(MRBasics_1.MRBasics.events.walked, this);\r\n MRLively_1.MRLively.eventServer.subscribe(MRBasics_1.MRBasics.events.skillEmitted, this);\r\n }\r\n onDetached(self) {\r\n MRLively_1.MRLively.eventServer.unsubscribe(MRBasics_1.MRBasics.events.roomEnterd, this);\r\n MRLively_1.MRLively.eventServer.unsubscribe(MRBasics_1.MRBasics.events.walked, this);\r\n MRLively_1.MRLively.eventServer.unsubscribe(MRBasics_1.MRBasics.events.skillEmitted, this);\r\n }\r\n onEvent(cctx, eventId, args) {\r\n const self = this.ownerEntity();\r\n // handleRoomEnterd\r\n if (eventId == MRBasics_1.MRBasics.events.roomEnterd) {\r\n const e = args;\r\n const block = MRLively_1.MRLively.mapView.currentMap.block(self.mx, self.my);\r\n if (block._roomId == e.newRoomId) {\r\n this.attemptReserveGetUp(self, e.entity);\r\n }\r\n }\r\n else if (eventId == MRBasics_1.MRBasics.events.walked) {\r\n const e = args;\r\n if (UMovement_1.UMovement.checkAdjacentEntities(self, e.walker)) {\r\n this.attemptReserveGetUp(self, e.walker);\r\n }\r\n }\r\n else if (eventId == MRBasics_1.MRBasics.events.skillEmitted) {\r\n const e = args;\r\n const block = MRLively_1.MRLively.mapView.currentMap.block(self.mx, self.my);\r\n if (block._roomId == e.performer.roomId()) {\r\n this.attemptReserveGetUp(self, e.performer);\r\n }\r\n }\r\n return LEventServer_1.LEventResult.Pass;\r\n }\r\n attemptReserveGetUp(self, target) {\r\n // 起きるの確定済みなので判定不要\r\n if (this._getUpReserved == GetUpReserved.Certainly)\r\n return;\r\n // 忍び足の場合は起きる判定を発生させない\r\n const traits = target.allTraits();\r\n if (traits.find(t => t.code == MRBasics_1.MRBasics.traits.SilentStep))\r\n return;\r\n if (Helpers_1.Helpers.isHostile(target, self)) {\r\n if (traits.find(t => t.code == MRBasics_1.MRBasics.traits.AwakeStep)) {\r\n this._getUpReserved = GetUpReserved.Certainly;\r\n }\r\n else {\r\n this._getUpReserved = GetUpReserved.Random;\r\n }\r\n }\r\n }\r\n onQueryIdleSequelId() {\r\n return MRBasics_1.MRBasics.sequels.asleep;\r\n }\r\n onDecisionPhase(self, cctx, phase) {\r\n var _a, _b;\r\n // if (phase == DecisionPhase.UpdateState) {\r\n // return SPhaseResult.Pass;\r\n // }\r\n // else\r\n if (phase == LBehavior_1.DecisionPhase.ResolveAdjacentAndMovingTarget) {\r\n if (this._getUpReserved == GetUpReserved.Certainly) {\r\n (_a = this.parentAs(LState_1.LState)) === null || _a === void 0 ? void 0 : _a.removeThisState();\r\n }\r\n else if (this._getUpReserved == GetUpReserved.Random) {\r\n const r = cctx.random().nextIntWithMax(100);\r\n if (r < 50) { // 50%\r\n (_b = this.parentAs(LState_1.LState)) === null || _b === void 0 ? void 0 : _b.removeThisState();\r\n }\r\n }\r\n this._getUpReserved = GetUpReserved.None;\r\n return SCommand_1.SPhaseResult.Pass;\r\n }\r\n // else if (phase == DecisionPhase.Manual ||\r\n // phase == DecisionPhase.AIMinor ||\r\n // phase == DecisionPhase.AIMajor) {\r\n // // Skip action\r\n // cctx.postConsumeActionToken(self, LActionTokenType.Major);\r\n // return SPhaseResult.Handled;\r\n // }\r\n return SCommand_1.SPhaseResult.Pass;\r\n }\r\n};\r\nLNapStateBehavior = LNapStateBehavior_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LNapStateBehavior);\r\nexports.LNapStateBehavior = LNapStateBehavior;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/states/LNapStateBehavior.ts?"); /***/ }), /***/ "./ts/mr/lively/states/LState.ts": /*!***************************************!*\ !*** ./ts/mr/lively/states/LState.ts ***! \***************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar LState_1;\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LState = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst DState_1 = __webpack_require__(/*! ts/mr/data/DState */ \"./ts/mr/data/DState.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ts/mr/system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst LObject_1 = __webpack_require__(/*! ../LObject */ \"./ts/mr/lively/LObject.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LEntity_1 = __webpack_require__(/*! ../entity/LEntity */ \"./ts/mr/lively/entity/LEntity.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\n/*\r\n[2021/9/14] 敵・味方で効果の変わるステート\r\n----------\r\n\r\n- 案A: 1つのステートを使い、NOTE でマッチ条件を指定する。マッチしなければ GUI の設定にフォールバックする。\r\n- 案B: 2つ以上のステートを使い、スキルやアイテム側の設定として、対象種類ごとに与えるステートを変化させる。\r\n- 案C: 2つ以上のステートを使い、親子関係で表現する。子ステートにマッチするものが無ければ親にフォールバックする。\r\n- 案D: ステートグループを利用する。\r\n\r\nまず案Bはよくない。\r\n状態異常ひとつとっても、付与する状況は様々。アイテム効果、スキル効果、罠効果、等…\r\nこれらすべての同様の設定を行う必要があるため設定ミスの温床になる。\r\n\r\n案Aの場合、Traitの制御が難しい。\r\n味方の場合は Trait.A のみ有効にする。敵の場合は Trait.B のみ有効にする、など。\r\n\r\n案Bの場合、例えば透明状態なら\r\n- 透明\r\n - 透明(プレイヤー) : 混乱なし\r\n - 透明(エネミー) : 混乱付き\r\nというように3つのステートを作る必要がある。\r\nデータ量は増えるが、NOTE欄ではなくパッと目につく GUI 上に出てくるので、泥臭いけどわかりやすいかも。\r\n\r\n案Dはちょっと違うかも。\r\n例えば睡眠状態で、プレイヤーとエネミーでターンが異なる場合を考えてた時。\r\n本来ステートグループは仮眠・睡眠・爆睡のような排他を表現するのに使う。\r\n今回やりたいのは、この個々のステートに対する追加情報とするべき。\r\n\r\n\r\n### B案をもうちょい詰める\r\n\r\n- 透明\r\n - 透明(プレイヤー) : 混乱なし\r\n - 透明(エネミー) : 混乱付き\r\n\r\nこういうのがあるとき、実際にアタッチできるのは「透明」だけとしたほうがいいだろう。\r\nそうしないと、「あるEntityに透明ステートがついているか?」を判断するときに条件が増える。\r\nガワは「透明」実際の効果は「透明(エネミー)」のように、LState の中で透過的に扱えるようにしたほうがいいだろう。\r\n\r\n\r\n### 敵・味方で効果の変わる効果(スキル)\r\n\r\nこちらもステートと同じ仕組みが要るかも。\r\n代表例は爆発。プレイヤー・仲間にはダメージ。敵・アイテムは消滅。\r\n\r\n普通の攻撃はアイテムには通らないけど、その辺も制御できるようにする必要がある。\r\nスキルはデフォルトで Unit のみ、条件を追加すればアイテムも可能、とか。\r\n罠壊しはこの仕組みでできるかも。\r\n\r\n内部的には、Emittor は同一。Effect が異なる。\r\n\r\n\r\n[2021/8/29] 封印\r\n----------\r\n\r\nモンスターの特性と特殊能力\r\nhttp://twist.jpn.org/sfcsiren/index.php?%E3%83%A2%E3%83%B3%E3%82%B9%E3%82%BF%E3%83%BC%E3%81%AE%E7%89%B9%E6%80%A7%E3%81%A8%E7%89%B9%E6%AE%8A%E8%83%BD%E5%8A%9B\r\n\r\n- \"特殊能力\" \"特性\" 共に、ステートを適用するものがある?\r\n - 上記表では \"速度変化\" と \"AIに関わるもの\" だけ。REとしては必ずしもステートとして表現する必要はない。\r\n- 分裂については \"特殊能力\" \"特性\" 両方でありえる。\r\n\r\n\r\n### 特殊能力\r\n- 倍速\r\n- ランダム移動 (※パコレプキンの移動は \"特技\" に分類される (キグニ状態・めつぶし状態で消える))\r\n - ただし内部的には AI のオーバーライドなので、上記表に従わなくても実現可。\r\n- 攻撃を受けると分裂\r\n- 逃げ\r\n- 自爆\r\n- 透明\r\n- どろぼう\r\n - アイテムへ向かって移動する\r\n - 盗んだ後は逃げAI\r\n- 攻撃を受けるとワープ はぐれメタル: https://c6h5ch3.hatenadiary.org/entry/20151109/1447032154\r\n- まちぶせ: うごくせきぞう\r\n\r\n### 特性\r\n- アイテムを落とす\r\n- 出現時、永続睡眠ステート\r\n- 出現時、常に起きている (マドハンド)\r\n- 出現時、アイテムに化ける\r\n- 出現時、他モンスターに化ける\r\n- メタル属性 はぐれメタルは封印してもダメージ1: https://c6h5ch3.hatenadiary.org/entry/20151109/1447032154\r\n\r\n\r\n### 方針\r\n\r\n- 特殊能力は \"特殊能力Behavior\" として実装する。封印状態では、この Behavior へ通知が行われなくなる。\r\n\r\n火炎入道や正面戦士の「外見特性」は、REとしては特殊能力に混ぜてしまうことにする。今回は不要だし、実装は大変そう。\r\n\r\n\r\n*/\r\n/*\r\n[2021/8/25] 混乱\r\n----------\r\nLConfusionAI のコメントに書いた通り、ランダム行動の決定は Behavior 内ではなく AI や Dialog 側で行う。\r\nしかしそうすると ManualActionDialog 上で乱数を生成することになるため、行動履歴と一致しなくなる。\r\n\r\n行動履歴は「REシステム外部からのActivity入力を記録する」方法で実現しているため、実質これはキー入力ログ。\r\n混乱を実装するには、これが Behavior に流れる前に1枚レイヤーを挟んで、乱数を使って加工してから Behavior に流さなければならない。\r\n(AI から使う都合もあって、Behavior 内でランダムに方向を変えたりしたくない)\r\n\r\n混乱以外ではゾワゾワ状態でもこのフックが必要になる。\r\n催眠やノーコン状態でもあったほうが良いか?\r\n- 基本的に、「状態異常にかかっていたとしても、正常状態のアクティビティを実行したいことがあるか?」がポイントになる。\r\n イベント実行が主なところか。\r\n- AI に影響があるのか、Activity に影響があるのかは明確にしたほうが良い。\r\n - 混乱はAI.\r\n - ゾワゾワ, ノーコンは Activity\r\n- AI というより Dicision と考えたほうがいいかも?\r\n - 混乱\r\n - プレイヤーには部分的に影響を与えるもの\r\n - AI全体を変えるもの\r\n - バーサーク\r\n - 催眠\r\n - プレイヤー・エネミー問わず、 Dicisionを乗っ取る\r\n\r\n混乱とゾワゾワが混在した時は?\r\nゾワゾワ有効になってほしい。ランダムに向いた方向と、実際には逆に何もないところを攻撃してほしい。\r\n\r\n\r\n[2021/8/23] 速度変化 再考\r\n----------\r\n\r\n「重ね掛け可能なターン制限付きバフ」とするか、「ステートグループを組んで排他制御」するか?\r\n\r\n前者をベースに考えるのがいいだろう。\r\n本質的にはこっちの方が自然。\r\n倍速モンスターとかは「基本速度」を property として返してもらい、それからの相対的な増減をバフとして表現する。\r\n\r\nステート側は、「戦闘不能」と同じく「パラメータの値によって自動付加」されるものとする。\r\n外部から明示的に「鈍足」「倍速」「3倍速」が付与された場合、強制的にその分だけバフレベルを増やす。\r\n\r\nバフは「レベル付きステート」として現す。ゲーム中では隠しステート扱い。\r\nつまり速度変化を構成するステートは次の通り。\r\n- 速度バフ(10ターンで解除, レベル-1,0,1,2, 式は\"eva+=level\")\r\n- 鈍足(自動付加条件\"eva<=-1\", 同時付加ステート\"速度バフ:-1\")\r\n- 倍速(自動付加条件\"eva==1\", 同時付加ステート\"速度バフ:1\")\r\n- 3倍速(自動付加条件\"eva>=2\", 同時付加ステート\"速度バフ:2\")\r\n- 速度ステートグループ(鈍足, 倍速, 3倍速 を排他) ※\"ステート無効化\"でも排他は表現できるが新たな付加ができなくなるので、新たな仕組みが要る。\r\n\r\nその他の操作は次の通り。\r\n- バフステートは付加時に絶対・相対でレベルを指定できる。\r\n- 同一パラメータに対して複数のバフステートを定義できる。例えば、解除条件が違うケースを想定する。\r\n- 速度バフを解除するには [速度バフ] ステートを解除する。\r\n- オオイカリ状態等で速度変化を禁止する場合、上記ステートすべてに対する \"ステート無効化\" を設定する。\r\n\r\n\r\n\r\n[2021/6/29] 予防や排他\r\n----------\r\n\r\n- 仮眠 < 睡眠 < 不眠\r\n- スーパー状態は、\"悪い状態異常\" を受けた時に \"確率で解除\" される。\r\n - 悪い状態異常とは?\r\n\r\n### 主な予防効果\r\n- 不眠\r\n- オオイカリ (速度変化しなくなる)\r\n- 予防の巻物\r\nグループ化。エディタからは、タグのような感じで指定したい。\r\n上記は、ステート有効度のような感じでタグを指定する感じ。\r\n\r\n### 排他\r\n- 目つぶし草・目薬草\r\n- 仮眠・睡眠・爆睡・不眠\r\n- かなしばり < 強烈かなしばり\r\n- 痛み分け < 強烈いたみわけ\r\n- イカリ < オオイカリ\r\nタグの定義側で、排他かどうか設定できるようにしてみようか。\r\n\r\n### 重篤化\r\n- 2倍速・倍速・鈍足・かなしばり\r\n\r\nかなしばり中に倍速の杖を受けたりすると、かなしばり解除→倍速 になる。\r\nグループ化よりも、重ねがけで別ステートに変化するような設定にしたほうがよさそう?\r\n\r\n個々のステートにタグ設定するときに合わせて Level(Priority) を設定できるようにしてみようか。\r\n\r\nもしくは、空腹やピンチと同じようにパラメータ評価式に応じて付与するのもありか?\r\nでもターン経過で解除、がやりづらくなりそう?\r\n\r\n倍速に関しては、モンスターの基礎的な素質としての倍速と、状態異常の倍速は分けて考える必要がある。\r\n例えば、倍速モンスターに鈍足の杖を振ると等速になるが、何らかの方法で状態異常を解除したら、倍速に戻るべき。\r\nただその時は鈍足エフェクトは出ないのが悩みどころ…。\r\n\r\n速度変化はバフととらえるのがいいかな?もしかして。\r\n\r\n\r\n### ステート変化\r\n- バクスイ -> 倍速\r\n放置してると重症化するような考え方の方がいいかも。\r\nターン経過で解除ではなく、別のステートに変化する。\r\n\r\n\r\n### 特殊な解除条件\r\n- 影縫い < ワープ\r\n- 手封じ\r\n- スーパー\r\n- 仮眠 < 攻撃\r\n- やりすごし < 攻撃\r\n- ふんばり < ピッピッピが隣接している間\r\n- 仮眠1 < 部屋侵入\r\n- 仮眠2 < 攻撃\r\n- 笑い\r\nこれらは Trait や Behavior 指定かな。\r\n\r\n### 状態異常扱い?\r\n- 空腹\r\n- ピンチ\r\nTraitでダメージ計算式みたいに評価式指定かな。\r\n*/\r\n/**\r\n * Entity に着脱するステートの単位。\r\n *\r\n * RE において State とは、StateBehavior をグループ化するもの。\r\n * StateBehavior は仮眠、鈍足など具体的な処理を定義する。\r\n *\r\n * グループ化の仕組みにより、例えば \"透視状態になるがハラヘリ速度が倍になる\" といった\r\n * カスタマイズを施しやすくなる。\r\n *\r\n * 振舞いは Ability と非常によく似ているが、State は RMMZ のステートと同じく状態異常を主に表すものであり、\r\n * 特徴的なところだと \"全快\" するアイテムやイベントによってすべてでタッチされたりする。\r\n */\r\nlet LState = LState_1 = class LState extends LObject_1.LObject {\r\n constructor() {\r\n super(LObject_1.LObjectType.State);\r\n //private _ownerEntity: LEntity | undefined; // シリアライズしない\r\n this._stateId = 0;\r\n this._submatchEffectIndex = -1;\r\n this._stateBehabiors = []; // LStateTraitBehavior\r\n this._level = 0;\r\n MRLively_1.MRLively.world._registerObject(this);\r\n }\r\n clone(newOwner) {\r\n const state = new LState_1();\r\n state._stateId = this._stateId;\r\n state._level = this._level;\r\n for (const i of this.stateBehabiors()) {\r\n const i2 = i.clone(newOwner);\r\n state._stateBehabiors.push(i2.id());\r\n i2.setParent(state);\r\n }\r\n return state;\r\n }\r\n setup(stateId) {\r\n (0, Common_1.assert)(stateId > 0);\r\n this._stateId = stateId;\r\n }\r\n id() {\r\n return this.__objectId();\r\n }\r\n stateDataId() {\r\n return this._stateId;\r\n }\r\n stateData() {\r\n return MRData_1.MRData.states[this._stateId];\r\n }\r\n get isDeathState() {\r\n const data = this.stateData();\r\n return data.id == MRBasics_1.MRBasics.states.dead || data.deadState;\r\n }\r\n stateEffect() {\r\n const data = this.stateData();\r\n if (this._submatchEffectIndex >= 0)\r\n return MRData_1.MRData.states[data.submatchStates[this._submatchEffectIndex]].effect;\r\n else\r\n return data.effect;\r\n }\r\n submatchEffectIndex() {\r\n return this._submatchEffectIndex;\r\n }\r\n stateBehabiors() {\r\n return this._stateBehabiors.map(x => MRLively_1.MRLively.world.behavior(x));\r\n }\r\n behaviorIds() {\r\n return this._stateBehabiors;\r\n }\r\n level() {\r\n return this._level;\r\n }\r\n setLevel(value) {\r\n this._level = value;\r\n }\r\n /** 全ての Behavior を除外します。 */\r\n removeAllBehaviors() {\r\n const self = this.parentObject();\r\n this.stateBehabiors().forEach(b => {\r\n b.clearParent();\r\n b.onDetached(self);\r\n b.destroy();\r\n });\r\n this._stateBehabiors = [];\r\n }\r\n //public ownerEntity(): LEntity {\r\n // assert(this._ownerEntity);\r\n // return this._ownerEntity;\r\n //}\r\n //_setOwnerEntty(entity: LEntity) {\r\n // this._ownerEntity = entity;\r\n //}\r\n recast() {\r\n // 同じ state が add された\r\n }\r\n onAttached(self) {\r\n for (const b of this.stateBehabiors()) {\r\n b.onAttached(self);\r\n }\r\n }\r\n onDetached(self) {\r\n for (const b of this.stateBehabiors()) {\r\n b.onDetached(self);\r\n }\r\n }\r\n removeThisState() {\r\n const entity = this.parentAs(LEntity_1.LEntity);\r\n if (entity) {\r\n entity.removeState(this._stateId);\r\n }\r\n }\r\n collectTraits(self, result) {\r\n this.stateEffect().traits.forEach(x => result.push(x));\r\n this.iterateBehaviors(x => {\r\n x.onCollectTraits(self, result);\r\n return true;\r\n });\r\n }\r\n iterateBehaviors(func) {\r\n for (const id of this._stateBehabiors) {\r\n if (func(MRLively_1.MRLively.world.behavior(id)) === false)\r\n return false;\r\n }\r\n return true;\r\n }\r\n // deprecated:\r\n _callStateIterationHelper(func) {\r\n let response = SCommand_1.SCommandResponse.Pass;\r\n for (let i = this._stateBehabiors.length - 1; i >= 0; i--) {\r\n const behavior = MRLively_1.MRLively.world.behavior(this._stateBehabiors[i]);\r\n const r = func(behavior);\r\n if (r != SCommand_1.SCommandResponse.Pass) {\r\n response = r;\r\n }\r\n if ((0, SCommand_1.checkContinuousResponse)(r)) {\r\n break;\r\n }\r\n }\r\n return response;\r\n }\r\n //------------------------------------------------------------------------------\r\n //\r\n checkRemoveAtDamageTesting(paramId) {\r\n for (const r of this.stateEffect().autoRemovals) {\r\n if (r.kind == DState_1.DAutoRemovalTiming.DamageTesting && r.paramId == paramId) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n};\r\nLState = LState_1 = __decorate([\r\n Common_1.MRSerializable\r\n], LState);\r\nexports.LState = LState;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/states/LState.ts?"); /***/ }), /***/ "./ts/mr/lively/structures/LItemShopStructure.ts": /*!*******************************************************!*\ !*** ./ts/mr/lively/structures/LItemShopStructure.ts ***! \*******************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LItemShopStructure = exports.LShopEntrance = void 0;\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LStructure_1 = __webpack_require__(/*! ./LStructure */ \"./ts/mr/lively/structures/LStructure.ts\");\r\nconst LItemBehavior_1 = __webpack_require__(/*! ../behaviors/LItemBehavior */ \"./ts/mr/lively/behaviors/LItemBehavior.ts\");\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst HMovement_1 = __webpack_require__(/*! ../helpers/HMovement */ \"./ts/mr/lively/helpers/HMovement.ts\");\r\n// 店の入り口情報\r\nlet LShopEntrance = class LShopEntrance {\r\n constructor(index) {\r\n this._homeX = 0;\r\n this._homeY = 0;\r\n this._gateX = 0;\r\n this._gateY = 0;\r\n this._index = index;\r\n }\r\n setup(homeX, homeY, gateX, gateY) {\r\n (0, Common_1.assert)(HMovement_1.HMovement.blockDistance(homeX, homeY, gateX, gateY) == 1);\r\n this._homeX = homeX;\r\n this._homeY = homeY;\r\n this._gateX = gateX;\r\n this._gateY = gateY;\r\n }\r\n index() {\r\n return this._index;\r\n }\r\n homeX() {\r\n return this._homeX;\r\n }\r\n homeY() {\r\n return this._homeY;\r\n }\r\n gateX() {\r\n return this._gateX;\r\n }\r\n gateY() {\r\n return this._gateY;\r\n }\r\n};\r\nLShopEntrance = __decorate([\r\n Common_1.MRSerializable\r\n], LShopEntrance);\r\nexports.LShopEntrance = LShopEntrance;\r\nlet LItemShopStructure = class LItemShopStructure extends LStructure_1.LStructure {\r\n constructor() {\r\n super(...arguments);\r\n this._roomId = 0;\r\n this._itemShopTypeId = 0;\r\n this._sellngItems = [];\r\n //private _initialSumOfPrices: number = 0;\r\n this._gates = [];\r\n }\r\n //private _monsterHouseState: MonsterHouseState = MonsterHouseState.Sleeping;\r\n setup(roomId, itemShopTypeId) {\r\n this._roomId = roomId;\r\n this._itemShopTypeId = itemShopTypeId;\r\n }\r\n roomId() {\r\n return this._roomId;\r\n }\r\n itemShopTypeId() {\r\n return this._itemShopTypeId;\r\n }\r\n clientFaction() {\r\n return MRData_1.MRData.system.factions.player;\r\n }\r\n addShopEntrance(homeX, homeY, gateX, gateY) {\r\n const entrance = new LShopEntrance(this._gates.length);\r\n entrance.setup(homeX, homeY, gateX, gateY);\r\n this._gates.push(entrance);\r\n return entrance;\r\n }\r\n shopEntrance(shopkeeperIndex) {\r\n return this._gates[shopkeeperIndex];\r\n }\r\n // 対価を得ずに所有(床置き)を失っている商品\r\n getLossItems() {\r\n const result = [];\r\n const room = MRLively_1.MRLively.mapView.currentMap.room(this._roomId);\r\n for (const id of this._sellngItems) {\r\n const item = MRLively_1.MRLively.world.entity(id);\r\n if (item.floorId.equals(MRLively_1.MRLively.mapView.currentMap.floorId()) && room.contains(item.mx, item.my)) {\r\n const block = MRLively_1.MRLively.mapView.currentMap.block(item.mx, item.my);\r\n (0, Common_1.assert)(block.containsEntity(item)); // 一応、本当に Block に含まれているかチェックする\r\n // 所有\r\n }\r\n else {\r\n result.push(item);\r\n }\r\n }\r\n return result;\r\n }\r\n // どんなアイテムをいくつアイテムを生成するかは地形等の情報により変わるため、\r\n // このクラスの中ではなく MapBuilder 側で決める。その決まった情報をこの関数にセットする。\r\n setInitialItems(items) {\r\n //this._initialSumOfPrices = 0;\r\n for (const item of items) {\r\n //this._initialSumOfPrices += item.data().buyingPrice;\r\n const b = item.getEntityBehavior(LItemBehavior_1.LItemBehavior);\r\n (0, Common_1.assert)(b.shopStructureId() == 0);\r\n b.setShopStructureId(this.id());\r\n this._sellngItems.push(item.entityId());\r\n }\r\n }\r\n // 請求額\r\n getBillingPrice() {\r\n const items = this.getLossItems();\r\n return items.reduce((r, i) => r + i.queryPrice().sellingPrice, 0);\r\n }\r\n // 買取中の未精算額\r\n getDepositPriece() {\r\n return 0;\r\n }\r\n commitBilling() {\r\n const items = this.getLossItems();\r\n for (const item of items) {\r\n this._sellngItems.mutableRemove(id => id.equals(item.entityId()));\r\n item.getEntityBehavior(LItemBehavior_1.LItemBehavior).setShopStructureId(0);\r\n }\r\n }\r\n // actor に対して請求状態であるかを判断する\r\n // ※現状では請求対象は Player 勢力のみであるため、商品が失われた原因までは考慮していない\r\n checkBilling( /*actor: LEntity*/) {\r\n return this.getLossItems().length > 0;\r\n }\r\n updateSecuritySystemState() {\r\n }\r\n onEntityLocated(cctx, entity) {\r\n const block = MRLively_1.MRLively.mapView.currentMap.block(entity.mx, entity.my);\r\n if (block._roomId == this._roomId) {\r\n }\r\n }\r\n};\r\nLItemShopStructure = __decorate([\r\n Common_1.MRSerializable\r\n], LItemShopStructure);\r\nexports.LItemShopStructure = LItemShopStructure;\r\n/*\r\n\r\n[2021/10/2] 請求状態の条件 - パラメータ変化の検知\r\n----------\r\n\r\n杖の使用回数や壺の残容量は値段に影響する。\r\n\r\n気になるのが壺。\r\n杖の使用回数は Param の仕組みとして現在値を減算するだけでよいが、\r\n壺は中に入っているアイテムの数で算出するべき。\r\nつまり、Param の \"現在値\" は変化させない方がよい。\r\nというか、変化させるとアイテムの数と多重管理になるので不具合の温床になる。\r\n\r\nそれが意味するのは、壺についてはパラメータ変化のイベントを発行するなどで通知を行うことができない、ということ。\r\nより拡張を考えるなら、例えば腕輪にヒビが入っていたら値段を下げるとかも考えられそう。\r\n\r\n店側が知りたいのは、お店初期状態との差。x\r\n- 初期の値札付きアイテムとの値段の差。\r\n- その減算が発生した原因の人(Entity)\r\n\r\n…とはいえ、本当に「誰がどれだけ店に損失を与えたか」を覚えておくべきなのだろうか?\r\n\r\n基本的には Player 勢力しか買い物はしない。\r\nAI に買い物をさせるのは単純に実装が大変というのもあるが、そもそもそんなNPCを作る意味があるのか、作って面白いシステムになるのか疑問。\r\nたとえば Player 妨害を目的として、店売りアイテムを買いあさるようになNPCやモンスターは考えられるが、\r\nそういった買い手に通常の売買の処理が必要とは限らない。\r\nオープンワールドでNPC同士が売買するようなシステムを考えるならNPCごとに所持金を持たせるのはアリだが、\r\nダンジョンではフロアをまたいだら基本的にNPCは消える。\r\n\r\n他勢力に Player 同様の買い物処理が必要なケースは、PvP だろう。\r\nただ複数の仲間を動かすシステムを見ているとわかるが、操作ストレスがものすごい。\r\n斬新ではあるけど、PvPシステムの実装はおそらく無いだろう。\r\n\r\nそうすると店は「Player勢力にだけアイテムを売る」を前提としてよい。\r\nまた「Player以外は店売りアイテムに触らない」を徹底すれば、パラメータ減少の原因は Player と考えてよい。\r\n\r\n店側は\r\n- 減算の原因を知る必要がある\r\nが、\r\n- 減算の原因を覚えておく必要はない\r\nとなる。\r\n\r\n前者は地雷等の事故による商品消失の処理に必要。\r\nこのときは店が覚えている「初期アイテム状態」自体を減らす必要がある。\r\n\r\n- 事故でないのに、店の価値が元よりも下がったら、それは Player の責任。\r\n\r\nという考えにできるだろう。\r\n\r\nこの考えを元にすると、価値のチェックは床上アイテムを総なめして値段を計算するだけでよくなる。\r\n「事故」をなんとか検出すればよい。\r\n\r\n### 風来のブーンの実装\r\n\r\nアイテムの使用回数は見ていないようだった。\r\n\r\nShop クラスは @store で、商品アイテムをキー、支払い責任者を値とする Map で管理していた。\r\nItem は owner の Shop を参照しており、自分が削除された時の処理 (Item.on_die) から、引数で受け取った原因 actor とともにこの Map に登録する。\r\n\r\n\r\n[2021/9/30] 請求状態の条件\r\n----------\r\n爆発で商品が消滅しても、請求されない。\r\nつまり、単に床から離れただけでは請求状態とはならないということ。\r\n\r\nまた様々な条件に対して ShopStructure や ShopkeeprBehavior 側で対策するのは拡張性に乏しくなる。\r\n\r\n地雷と同じワナによる事故であっても、落とし穴にアイテムが落ちて消えた場合は請求される?(未確認)\r\n地雷は請求されないが、バクハの巻物は請求される。(これはバクハの巻物の awarder がプレイヤーであることから判断できそう)\r\n\r\n機械的に実装できる可能性があるとすれば、「勢力が Player である awarder の行動が影響で、商品が店の床から除かれたとき」だろう。\r\nただ Effect と必ず伴うわけではないため、EffectContext の扱いはもう少し頑張る必要があるかも。\r\nこの方法で本当に行けるかはわからないので、ひとつずつ検証するしかないだろう…。\r\n\r\n\r\n### 「大洪水の罠」を拡張機能として実装するなら?\r\n\r\n店主は「大洪水だ!階段へ急げ!」と具体的なメッセージを出してくる。\r\nこの状態は大部屋になった時と同じと考えられる。\r\n店主が EffectContext を通して状態を変えられるようなものではないため、\r\nこの状態は ShopStructure 側で管理するべきだろう。\r\n\r\n\r\n### 単に「拾われた」「床から離れた」を見るだけでは足りない\r\n\r\n矢や杖など、拾われずとも使用されることで「価値」が減るものがある。\r\n正直、価値が失われた原因を ShopStructure まで伝えるのは個々のアクション全部で頑張る必要がありそうで辛そう。\r\n- スタックが減る\r\n- 杖の使用回数が減る\r\n- 装備の修正値が減る\r\n- 壺の容量が減る\r\n- 進行中のタイトルだと、装備の耐久力の低下も考えられる。\r\nEffectContext を通すとも限らないので、処理を行う箇所を一元化することもできない…。\r\n\r\n### 床にあるアイテムの「価値」の総和の変化で判断する?\r\n\r\nこの場合各所から通知を受け取る必要は無くなるが、代わりに原因が分からない。\r\n地雷かバクハの巻物かを区別できない。\r\n\r\n地雷(の爆破Effect)に対して、例えば店の元の価値を減らすような処理を入れるのもできるが、\r\nそれは他のアイテム消滅に関係する箇所に全部処理を入れるということになる。\r\nそもそもやっぱり地雷側が店の都合を知っていなければならないのはおかしいだろう。\r\n\r\n\r\n\r\n\r\n\r\n\r\n[2021/9/28] 泥棒の条件\r\n----------\r\n泥棒の条件は、\r\n- 店主が店の入り口をふさぐ状態で、購入者が部屋の外に出ること。\r\nアイテムを店の外に投げたりしただけでは、泥棒にならない。\r\n\r\nまた\r\n- 値札のついたアイテムを持っている状態で店の外に立っているだけでは泥棒にならない。\r\n例えば\r\n- 店の外からアイテムを回収してもすぐに泥棒にはならない。(不思議の幻想郷の動作だが、「店主は慌てている」とメッセージが表示されるだけ)\r\n- 店主に高跳び草を投げてから値札のついたアイテムを持ち出しても、店主が店に戻るまで泥棒にならない。(シレン2)\r\n - ただし店主を地雷に巻き込む等で倒す → アイテムを持ち出す では泥棒になる。店主の存在が影響するとは限らない。\r\n 店主がいる・いないで何かしら特殊な処理が組まれていそう。\r\n\r\nいずれにしても、値札アイテムが床上から除かれたかどうかは「店オブジェクト」で管理する必要がある。(店主Entityではなく)\r\n\r\n\r\n\r\n\r\n[2021/9/28] 買い物の処理\r\n----------\r\n\r\n- 「話しかけ」で会話を始める。\r\n- RMMZイベントで選択肢を提供する。(Prefabで定義する)\r\n\r\n### どうやって選択肢の結果を伝える?\r\nActivity にしたいところ。Recorder に保存したいので。\r\n\r\n実現方法は次の「ちなみに行商人は?」を参照。\r\nアイテム選択ダイアログが出ないが、代わりに◆プラグインコマンド「要求されている金額を変数に代入」みたいなコマンドを使うことになるだろう。\r\n\r\n\r\n\r\n### ちなみに行商人は?\r\n\r\n- アイテムを選択する\r\n- 金額に合意する\r\nという2つのダイアログを使うことになるが…\r\nできれば HTTP のようにステートレスにしたいところ。\r\nNPC同士の売買やRecorderへの保存がやりやすくなるかも。\r\n\r\n「行商人との会話Dialog」を専用で作る必要がありそう。状態は Dialog 側で持ちたいので。\r\nまぁ普通のイベントDialogに任意プロパティを持たせるようにしてもよいが…。\r\n\r\n典型的には次のようなイベントとなる。\r\n\r\n```\r\n◆文章「いらっしゃい。」\r\n◆プラグインコマンド「アイテム選択」 # 子VisualDialogを表示する。この結果は現在Dialogの slectedItems に保存される。\r\n◆プラグインコマンド「選択アイテムの値段を変数に代入」\r\n◆文章「\\V[1]G になります。」\r\n◆選択肢 はい\r\n ◆プラグインコマンド「アクティビティPost(Yes)」 # または、Dialogで一段ラップするのもありか。\r\n ◆文章「ありがとうございます。」\r\n◆選択肢 いいえ\r\n ◆文章「またどうぞ。」\r\n```\r\n\r\n*/ \r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/structures/LItemShopStructure.ts?"); /***/ }), /***/ "./ts/mr/lively/structures/LMonsterHouseStructure.ts": /*!***********************************************************!*\ !*** ./ts/mr/lively/structures/LMonsterHouseStructure.ts ***! \***********************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LMonsterHouseStructure = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst Helpers_1 = __webpack_require__(/*! ts/mr/system/Helpers */ \"./ts/mr/system/Helpers.ts\");\r\nconst LRoom_1 = __webpack_require__(/*! ../LRoom */ \"./ts/mr/lively/LRoom.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LStructure_1 = __webpack_require__(/*! ./LStructure */ \"./ts/mr/lively/structures/LStructure.ts\");\r\nconst SSoundManager_1 = __webpack_require__(/*! ts/mr/system/SSoundManager */ \"./ts/mr/system/SSoundManager.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nlet LMonsterHouseStructure = class LMonsterHouseStructure extends LStructure_1.LStructure {\r\n constructor() {\r\n super(...arguments);\r\n this._roomId = 0;\r\n this._monsterHouseTypeId = 0;\r\n this._monsterHouseFactionId = 0;\r\n this._monsterHouseState = LRoom_1.MonsterHouseState.Sleeping;\r\n }\r\n // モンスターハウスの巻物などで動的に生成されることもあるため、FMonsterHouseStructure は参照しないようにする\r\n setup(roomId, monsterHouseTypeId) {\r\n this._roomId = roomId;\r\n this._monsterHouseTypeId = monsterHouseTypeId;\r\n this._monsterHouseFactionId = MRData_1.MRData.system.factions.enemy;\r\n this._monsterHouseState = LRoom_1.MonsterHouseState.Sleeping;\r\n }\r\n roomId() {\r\n return this._roomId;\r\n }\r\n get room() {\r\n return MRLively_1.MRLively.mapView.currentMap.room(this._roomId);\r\n }\r\n monsterHouseTypeId() {\r\n return this._monsterHouseTypeId;\r\n }\r\n monsterHouseData() {\r\n return MRData_1.MRData.monsterHouses[this._monsterHouseTypeId];\r\n }\r\n monsterHouseFactionId() {\r\n return this._monsterHouseFactionId;\r\n }\r\n monsterHouseState() {\r\n return this._monsterHouseState;\r\n }\r\n startMonsterHouse(cctx) {\r\n (0, Common_1.assert)(this._monsterHouseTypeId > 0);\r\n (0, Common_1.assert)(this._monsterHouseState == LRoom_1.MonsterHouseState.Sleeping);\r\n cctx.postWaitSequel();\r\n cctx.postMessage((0, Common_1.tr2)(\"モンスターハウスだ!\"));\r\n SSoundManager_1.SSoundManager.playBgm(this.monsterHouseData().bgm);\r\n this._monsterHouseState = LRoom_1.MonsterHouseState.Activated;\r\n // 睡眠ステート解除。\r\n // StateGroup で解除はしない。例えば部屋の外から睡眠の杖で眠ったモンスターは、モンスターハウスが発動しても直ちに目を覚まさない。\r\n this.room.forEachEntities(entity => {\r\n entity.removeState(MRBasics_1.MRBasics.states.monsterHouseSleepStateId);\r\n });\r\n }\r\n onEntityLocated(cctx, entity) {\r\n const block = MRLively_1.MRLively.mapView.currentMap.block(entity.mx, entity.my);\r\n if (block._roomId == this._roomId) {\r\n // モンスターハウスから見て、侵入してきた entity が敵対関係にあれば、起動する\r\n if (Helpers_1.Helpers.isHostileFactionId(this.monsterHouseFactionId(), entity.getOutwardFactionId()) &&\r\n this.monsterHouseState() == LRoom_1.MonsterHouseState.Sleeping) {\r\n this.startMonsterHouse(cctx);\r\n }\r\n }\r\n }\r\n};\r\nLMonsterHouseStructure = __decorate([\r\n Common_1.MRSerializable\r\n], LMonsterHouseStructure);\r\nexports.LMonsterHouseStructure = LMonsterHouseStructure;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/structures/LMonsterHouseStructure.ts?"); /***/ }), /***/ "./ts/mr/lively/structures/LStructure.ts": /*!***********************************************!*\ !*** ./ts/mr/lively/structures/LStructure.ts ***! \***********************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LStructure = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nlet LStructure = class LStructure {\r\n constructor(id) {\r\n this._id = id;\r\n }\r\n id() {\r\n return this._id;\r\n }\r\n onEntityLocated(cctx, entity) {\r\n }\r\n};\r\nLStructure = __decorate([\r\n Common_1.MRSerializable\r\n], LStructure);\r\nexports.LStructure = LStructure;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/lively/structures/LStructure.ts?"); /***/ }), /***/ "./ts/mr/math/Math.ts": /*!****************************!*\ !*** ./ts/mr/math/Math.ts ***! \****************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\n/**\r\n * 補間関数の定義。\r\n * 各関数の引数は、t:現在時間(0.0~d) b:開始値 c:値の変化量 (目標値-開始値) d:変化にかける時間。\r\n */\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.linear = void 0;\r\nfunction linear(t, b, c, d) {\r\n return c * (t / d) + b;\r\n}\r\nexports.linear = linear;\r\n;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/math/Math.ts?"); /***/ }), /***/ "./ts/mr/math/Noise.ts": /*!*****************************!*\ !*** ./ts/mr/math/Noise.ts ***! \*****************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\n// see https://github.com/josephg/noisejs/blob/master/perlin.js\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SimplexNoise = exports.PerlinNoise = void 0;\r\nclass Grad {\r\n constructor(x, y, z) {\r\n this.x = x;\r\n this.y = y;\r\n this.z = z;\r\n }\r\n dot2(x, y) {\r\n return this.x * x + this.y * y;\r\n }\r\n}\r\nconst grad3 = [\r\n new Grad(1, 1, 0), new Grad(-1, 1, 0), new Grad(1, -1, 0), new Grad(-1, -1, 0),\r\n new Grad(1, 0, 1), new Grad(-1, 0, 1), new Grad(1, 0, -1), new Grad(-1, 0, -1),\r\n new Grad(0, 1, 1), new Grad(0, -1, 1), new Grad(0, 1, -1), new Grad(0, -1, -1)\r\n];\r\nconst p = [\r\n 151, 160, 137, 91, 90, 15,\r\n 131, 13, 201, 95, 96, 53, 194, 233, 7, 225, 140, 36, 103, 30, 69, 142, 8, 99, 37, 240, 21, 10, 23,\r\n 190, 6, 148, 247, 120, 234, 75, 0, 26, 197, 62, 94, 252, 219, 203, 117, 35, 11, 32, 57, 177, 33,\r\n 88, 237, 149, 56, 87, 174, 20, 125, 136, 171, 168, 68, 175, 74, 165, 71, 134, 139, 48, 27, 166,\r\n 77, 146, 158, 231, 83, 111, 229, 122, 60, 211, 133, 230, 220, 105, 92, 41, 55, 46, 245, 40, 244,\r\n 102, 143, 54, 65, 25, 63, 161, 1, 216, 80, 73, 209, 76, 132, 187, 208, 89, 18, 169, 200, 196,\r\n 135, 130, 116, 188, 159, 86, 164, 100, 109, 198, 173, 186, 3, 64, 52, 217, 226, 250, 124, 123,\r\n 5, 202, 38, 147, 118, 126, 255, 82, 85, 212, 207, 206, 59, 227, 47, 16, 58, 17, 182, 189, 28, 42,\r\n 223, 183, 170, 213, 119, 248, 152, 2, 44, 154, 163, 70, 221, 153, 101, 155, 167, 43, 172, 9,\r\n 129, 22, 39, 253, 19, 98, 108, 110, 79, 113, 224, 232, 178, 185, 112, 104, 218, 246, 97, 228,\r\n 251, 34, 242, 193, 238, 210, 144, 12, 191, 179, 162, 241, 81, 51, 145, 235, 249, 14, 239, 107,\r\n 49, 192, 214, 31, 181, 199, 106, 157, 184, 84, 204, 176, 115, 121, 50, 45, 127, 4, 150, 254,\r\n 138, 236, 205, 93, 222, 114, 67, 29, 24, 72, 243, 141, 128, 195, 78, 66, 215, 61, 156, 180\r\n];\r\nconst F2 = 0.5 * (Math.sqrt(3) - 1);\r\nconst G2 = (3 - Math.sqrt(3)) / 6;\r\nclass PerlinNoise {\r\n constructor(seed) {\r\n seed = seed !== null && seed !== void 0 ? seed : Math.random();\r\n seed = Math.floor(seed);\r\n if (seed < 256) {\r\n seed |= seed << 8;\r\n }\r\n if (seed > 65535) {\r\n seed %= 65535;\r\n }\r\n console.log(\"seed\", seed);\r\n this.perm = new Array(512);\r\n this.gradP = new Array(512);\r\n for (let i = 0; i < 256; i++) {\r\n let v;\r\n if (i & 1) {\r\n v = p[i] ^ (seed & 255);\r\n }\r\n else {\r\n v = p[i] ^ ((seed >> 8) & 255);\r\n }\r\n this.perm[i] = this.perm[i + 256] = v;\r\n this.gradP[i] = this.gradP[i + 256] = grad3[v % 12];\r\n }\r\n }\r\n noise2D(x, y) {\r\n // Find unit grid cell containing point\r\n var X = Math.floor(x), Y = Math.floor(y);\r\n // Get relative xy coordinates of point within that cell\r\n x = x - X;\r\n y = y - Y;\r\n // Wrap the integer cells at 255 (smaller integer period can be introduced here)\r\n X = X & 255;\r\n Y = Y & 255;\r\n // Calculate noise contributions from each of the four corners\r\n var n00 = this.gradP[X + this.perm[Y]].dot2(x, y);\r\n var n01 = this.gradP[X + this.perm[Y + 1]].dot2(x, y - 1);\r\n var n10 = this.gradP[X + 1 + this.perm[Y]].dot2(x - 1, y);\r\n var n11 = this.gradP[X + 1 + this.perm[Y + 1]].dot2(x - 1, y - 1);\r\n // Compute the fade curve value for x\r\n var u = this.fade(x);\r\n // Interpolate the four results\r\n return this.lerp(this.lerp(n00, n10, u), this.lerp(n01, n11, u), this.fade(y));\r\n }\r\n fade(t) {\r\n return t * t * t * (t * (t * 6 - 15) + 10);\r\n }\r\n lerp(a, b, t) {\r\n return (1 - t) * a + t * b;\r\n }\r\n}\r\nexports.PerlinNoise = PerlinNoise;\r\nclass SimplexNoise {\r\n constructor(seed) {\r\n seed = seed !== null && seed !== void 0 ? seed : Math.random();\r\n seed = Math.floor(seed);\r\n if (seed < 256) {\r\n seed |= seed << 8;\r\n }\r\n if (seed > 65535) {\r\n seed %= 65535;\r\n }\r\n this.perm = new Array(512);\r\n this.gradP = new Array(512);\r\n for (let i = 0; i < 256; i++) {\r\n let v;\r\n if (i & 1) {\r\n v = p[i] ^ (seed & 255);\r\n }\r\n else {\r\n v = p[i] ^ ((seed >> 8) & 255);\r\n }\r\n this.perm[i] = this.perm[i + 256] = v;\r\n this.gradP[i] = this.gradP[i + 256] = grad3[v % 12];\r\n }\r\n }\r\n noise2D(xin, yin) {\r\n var n0, n1, n2; // Noise contributions from the three corners\r\n // Skew the input space to determine which simplex cell we're in\r\n var s = (xin + yin) * F2; // Hairy factor for 2D\r\n var i = Math.floor(xin + s);\r\n var j = Math.floor(yin + s);\r\n var t = (i + j) * G2;\r\n var x0 = xin - i + t; // The x,y distances from the cell origin, unskewed.\r\n var y0 = yin - j + t;\r\n // For the 2D case, the simplex shape is an equilateral triangle.\r\n // Determine which simplex we are in.\r\n var i1, j1; // Offsets for second (middle) corner of simplex in (i,j) coords\r\n if (x0 > y0) { // lower triangle, XY order: (0,0)->(1,0)->(1,1)\r\n i1 = 1;\r\n j1 = 0;\r\n }\r\n else { // upper triangle, YX order: (0,0)->(0,1)->(1,1)\r\n i1 = 0;\r\n j1 = 1;\r\n }\r\n // A step of (1,0) in (i,j) means a step of (1-c,-c) in (x,y), and\r\n // a step of (0,1) in (i,j) means a step of (-c,1-c) in (x,y), where\r\n // c = (3-sqrt(3))/6\r\n var x1 = x0 - i1 + G2; // Offsets for middle corner in (x,y) unskewed coords\r\n var y1 = y0 - j1 + G2;\r\n var x2 = x0 - 1 + 2 * G2; // Offsets for last corner in (x,y) unskewed coords\r\n var y2 = y0 - 1 + 2 * G2;\r\n // Work out the hashed gradient indices of the three simplex corners\r\n i &= 255;\r\n j &= 255;\r\n var gi0 = this.gradP[i + this.perm[j]];\r\n var gi1 = this.gradP[i + i1 + this.perm[j + j1]];\r\n var gi2 = this.gradP[i + 1 + this.perm[j + 1]];\r\n // Calculate the contribution from the three corners\r\n var t0 = 0.5 - x0 * x0 - y0 * y0;\r\n if (t0 < 0) {\r\n n0 = 0;\r\n }\r\n else {\r\n t0 *= t0;\r\n n0 = t0 * t0 * gi0.dot2(x0, y0); // (x,y) of grad3 used for 2D gradient\r\n }\r\n var t1 = 0.5 - x1 * x1 - y1 * y1;\r\n if (t1 < 0) {\r\n n1 = 0;\r\n }\r\n else {\r\n t1 *= t1;\r\n n1 = t1 * t1 * gi1.dot2(x1, y1);\r\n }\r\n var t2 = 0.5 - x2 * x2 - y2 * y2;\r\n if (t2 < 0) {\r\n n2 = 0;\r\n }\r\n else {\r\n t2 *= t2;\r\n n2 = t2 * t2 * gi2.dot2(x2, y2);\r\n }\r\n // Add contributions from each corner to get the final noise value.\r\n // The result is scaled to return values in the interval [-1,1].\r\n return 70 * (n0 + n1 + n2);\r\n }\r\n}\r\nexports.SimplexNoise = SimplexNoise;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/math/Noise.ts?"); /***/ }), /***/ "./ts/mr/math/Vector2.ts": /*!*******************************!*\ !*** ./ts/mr/math/Vector2.ts ***! \*******************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\n// NOTE: 実行速度よりも書きやすさ・安全性重視で。\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Vector2 = void 0;\r\nclass Vector2 {\r\n constructor(x = 0.0, y = 0.0) {\r\n this.x = 0.0;\r\n this.y = 0.0;\r\n this.x = x;\r\n this.y = y;\r\n }\r\n static clone(value) {\r\n return new Vector2(value.x, value.y);\r\n }\r\n static add(a, b) {\r\n if (typeof b === \"number\") {\r\n return new Vector2(a.x + b, a.y + b);\r\n }\r\n else {\r\n return new Vector2(a.x + b.x, a.y + b.y);\r\n }\r\n }\r\n static sub(a, b) {\r\n if (typeof b === \"number\") {\r\n return new Vector2(a.x - b, a.y - b);\r\n }\r\n else {\r\n return new Vector2(a.x - b.x, a.y - b.y);\r\n }\r\n }\r\n static mul(a, b) {\r\n if (typeof b === \"number\") {\r\n return new Vector2(a.x * b, a.y * b);\r\n }\r\n else {\r\n return new Vector2(a.x * b.x, a.y * b.y);\r\n }\r\n }\r\n static div(a, b) {\r\n if (typeof b === \"number\") {\r\n return new Vector2(a.x / b, a.y / b);\r\n }\r\n else {\r\n return new Vector2(a.x / b.x, a.y / b.y);\r\n }\r\n }\r\n static sign(value) {\r\n return new Vector2((value.x < 0.0) ? -1.0 : ((value.x > 0.0) ? 1.0 : 0.0), (value.y < 0.0) ? -1.0 : ((value.y > 0.0) ? 1.0 : 0.0));\r\n }\r\n}\r\nexports.Vector2 = Vector2;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/math/Vector2.ts?"); /***/ }), /***/ "./ts/mr/rmmz/Common.ts": /*!******************************!*\ !*** ./ts/mr/rmmz/Common.ts ***! \******************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.RmmzEventTriggerType = void 0;\r\nvar RmmzEventTriggerType;\r\n(function (RmmzEventTriggerType) {\r\n RmmzEventTriggerType[RmmzEventTriggerType[\"Button\"] = 0] = \"Button\";\r\n RmmzEventTriggerType[RmmzEventTriggerType[\"TouchFromPlayer\"] = 1] = \"TouchFromPlayer\";\r\n RmmzEventTriggerType[RmmzEventTriggerType[\"TouchFromEvent\"] = 2] = \"TouchFromEvent\";\r\n RmmzEventTriggerType[RmmzEventTriggerType[\"Autorun\"] = 3] = \"Autorun\";\r\n RmmzEventTriggerType[RmmzEventTriggerType[\"Parallel\"] = 4] = \"Parallel\";\r\n})(RmmzEventTriggerType = exports.RmmzEventTriggerType || (exports.RmmzEventTriggerType = {}));\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/rmmz/Common.ts?"); /***/ }), /***/ "./ts/mr/rmmz/DataManager.ts": /*!***********************************!*\ !*** ./ts/mr/rmmz/DataManager.ts ***! \***********************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nconst SGameManager_1 = __webpack_require__(/*! ../system/SGameManager */ \"./ts/mr/system/SGameManager.ts\");\r\nconst DHelper_1 = __webpack_require__(/*! ../data/DHelper */ \"./ts/mr/data/DHelper.ts\");\r\nconst PluginParameters_1 = __webpack_require__(/*! ../PluginParameters */ \"./ts/mr/PluginParameters.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\n/*\r\n [2020/11/2] マップ読み込みメモ\r\n ----------\r\n 制約: RMMZ は Scene_Map に遷移するたびに、マップデータのロードが行われる。\r\n goto, call 関係なしで、メニューや先頭から戻ってきたときもロードされる。\r\n\r\n ### 固定マップ\r\n 倉庫・訓練場・ボス部屋・チュートリアルマップなどが該当する。\r\n 当初は Land から独立したマップとして考えていたが、ひとまず他とローディングのフローを合わせるため、\r\n Land に属することを必須としてみる。\r\n\r\n 例えば通常の RMMZ のマップから倉庫マップに移動したいときは、通常のマップ移動とは異なる。\r\n 「倉庫LandのF1を倉庫マップとする」といった設定を Land マップで行い、\r\n イベントからはスクリプトコマンドなどで「倉庫LandのF1へ移動する」\r\n\r\n ### シャッフルダンジョンマップ\r\n\r\n ### ランダムマップ\r\n イベントや階段などのマップ遷移は、[Land 情報マップID, フロア番号] を与えて遷移する。\r\n その後、対応するテンプレートマップへ遷移する。\r\n 実際に表示される RMMZ のマップは、このテンプレートマップとなる。\r\n\r\n > このようにして、RE システムがアクティブな時のマップは、どんなパターンであれ\r\n > 必ず \"Floor\" 扱いされたマップがロードされた状態となる。\r\n > こうしておかないとマップロード処理が非常に煩雑になる。\r\n\r\n\r\n ### 固定及びシャッフルマップのイベントについて\r\n これらのマップには RMMZ のイベントを配置することができる。\r\n 特にボス部屋で演出のためにイベントを起動する要求は非常に多い。\r\n またボスの初期位置を決めるためにも使う。\r\n\r\n これらのイベントはマップへ遷移したあと、そのマップのイベントから Entity を作ることになるが、\r\n RMMZ の頻繁なマップロードのタイミングに対応するため対策が必要となる。\r\n - REMap の生成元となった MapId を覚えておく。\r\n - マップ遷移が行われたとき、↑で覚えている ID と同じマップであれば Entity を生成しない。(以前のをそのまま使う)\r\n - イベントから生成した Entity はすべて AdhocEntity とする。\r\n\r\n これらの制約のため、REVisual 等は Game_Event のインスタンスを直接参照してはならない。\r\n eventId で参照すること。\r\n\r\n\r\n*/\r\nconst _DataManager_createGameObjects = DataManager.createGameObjects;\r\nDataManager.createGameObjects = function () {\r\n var _a;\r\n _DataManager_createGameObjects.call(this);\r\n SGameManager_1.SGameManager.createGameObjects();\r\n // Link UniqueUnit and Game_Actor\r\n if (PluginParameters_1.paramForceSync) {\r\n for (const entityId of MRLively_1.MRLively.system.uniqueActorUnits) {\r\n const entity = MRLively_1.MRLively.world.entity(entityId);\r\n if (entity) {\r\n const actorId = (_a = entity.data.actor) === null || _a === void 0 ? void 0 : _a.rmmzActorId;\r\n if (actorId) {\r\n const gameActor = $gameActors.actor(actorId);\r\n if (gameActor) {\r\n gameActor._entityId_MR = entityId.clone();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n};\r\nconst _DataManager_setupNewGame = DataManager.setupNewGame;\r\nDataManager.setupNewGame = function () {\r\n _DataManager_setupNewGame.call(this);\r\n SGameManager_1.SGameManager.setupNewGame();\r\n};\r\nconst _DataManager_makeSaveContents = DataManager.makeSaveContents;\r\nDataManager.makeSaveContents = function () {\r\n const contents = _DataManager_makeSaveContents.call(this);\r\n contents.re = SGameManager_1.SGameManager.makeSaveContents();\r\n return contents;\r\n};\r\nconst _DataManager_extractSaveContents = DataManager.extractSaveContents;\r\nDataManager.extractSaveContents = function (contents) {\r\n _DataManager_extractSaveContents.call(this, contents);\r\n SGameManager_1.SGameManager.loadGame(contents.re, true);\r\n};\r\n// メモ欄に同じタグが複数あった場合、配列としてmetaプロパティに登録する。\r\n// https://makonet.sakura.ne.jp/rpg_tkool/Old/contents/MetaDataEx.js\r\n//const _DataManager_extractMetadata = DataManager.extractMetadata;\r\nDataManager.extractMetadata = function (data) {\r\n DHelper_1.DHelpers.extractMetadata(data);\r\n};\r\nconst _DataManager_saveGame = DataManager.saveGame;\r\nDataManager.saveGame = function (savefileId) {\r\n return _DataManager_saveGame.call(this, savefileId);\r\n};\r\nconst _DataManager_loadGame = DataManager.loadGame;\r\nDataManager.loadGame = function (savefileId) {\r\n return _DataManager_loadGame.call(this, savefileId);\r\n};\r\nconst _DataManager_onLoad = DataManager.onLoad;\r\nDataManager.onLoad = function (object) {\r\n _DataManager_onLoad.call(this, object);\r\n /*\r\n if (object === $dataMap && $gameMap) {\r\n for (const event of $gameMap.events()) {\r\n if (event instanceof Game_REPrefabEvent) {\r\n event.restorePrefabEventData();\r\n }\r\n }\r\n }\r\n */\r\n};\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/rmmz/DataManager.ts?"); /***/ }), /***/ "./ts/mr/rmmz/FloorRestartSequence.ts": /*!********************************************!*\ !*** ./ts/mr/rmmz/FloorRestartSequence.ts ***! \********************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.FloorRestartSequence = void 0;\r\nconst MRLively_1 = __webpack_require__(/*! ../lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ../system/MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nvar FloorRestartStep;\r\n(function (FloorRestartStep) {\r\n FloorRestartStep[FloorRestartStep[\"Idle\"] = 0] = \"Idle\";\r\n FloorRestartStep[FloorRestartStep[\"FadeOut\"] = 1] = \"FadeOut\";\r\n FloorRestartStep[FloorRestartStep[\"Loading\"] = 2] = \"Loading\";\r\n FloorRestartStep[FloorRestartStep[\"FadeIn\"] = 3] = \"FadeIn\";\r\n})(FloorRestartStep || (FloorRestartStep = {}));\r\nclass FloorRestartSequence {\r\n static isProcessing() {\r\n return this._step != FloorRestartStep.Idle || MRSystem_1.MRSystem.requestedRestartFloorItem.hasAny();\r\n }\r\n static update(scene) {\r\n switch (this._step) {\r\n case FloorRestartStep.Idle: {\r\n if (MRSystem_1.MRSystem.requestedRestartFloorItem.hasAny()) {\r\n // Scene_Load.prototype.executeLoad() のように、DataManager.loadGame() の後にフェードアウトするのはNG。\r\n // 暗転前に $gameXXXX が全て復元され、変な位置にプレイヤーが表示されたりしてしまう。\r\n scene.fadeOutAll();\r\n this._step = FloorRestartStep.FadeOut;\r\n console.log(\"to FadeOut\");\r\n }\r\n break;\r\n }\r\n case FloorRestartStep.FadeOut: {\r\n console.log(\"FadeOut\");\r\n if (!scene.isFading()) {\r\n console.log(\"if FadeOut\");\r\n const savefileId = 0; //$gameSystem.savefileId();\r\n DataManager.loadGame(savefileId)\r\n .then(() => this.onLoadSuccess(scene))\r\n .catch(() => this.onLoadFailure(scene));\r\n this._step = FloorRestartStep.Loading;\r\n }\r\n break;\r\n }\r\n case FloorRestartStep.Loading: {\r\n break;\r\n }\r\n case FloorRestartStep.FadeIn: {\r\n if (!scene.isFading()) {\r\n this._step = FloorRestartStep.Idle;\r\n }\r\n break;\r\n }\r\n default:\r\n throw new Error(\"Unreachable.\");\r\n }\r\n }\r\n static onLoadSuccess(scene) {\r\n SceneManager.goto(Scene_Map);\r\n this._step = FloorRestartStep.FadeIn;\r\n const item = MRLively_1.MRLively.world.entity(MRSystem_1.MRSystem.requestedRestartFloorItem);\r\n item.removeFromParent();\r\n item.destroy();\r\n MRSystem_1.MRSystem.requestedRestartFloorItem.clear();\r\n }\r\n static onLoadFailure(scene) {\r\n throw new Error(\"onLoadFailure\");\r\n }\r\n}\r\nexports.FloorRestartSequence = FloorRestartSequence;\r\nFloorRestartSequence._step = FloorRestartStep.Idle;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/rmmz/FloorRestartSequence.ts?"); /***/ }), /***/ "./ts/mr/rmmz/Game_BattlerBase.ts": /*!****************************************!*\ !*** ./ts/mr/rmmz/Game_BattlerBase.ts ***! \****************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nconst data_1 = __webpack_require__(/*! ../data */ \"./ts/mr/data/index.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nObject.defineProperties(Game_BattlerBase.prototype, {\r\n hp: {\r\n get: function () {\r\n const entuty = this.getEntity_MR();\r\n if (entuty)\r\n return entuty.getActualParam(data_1.MRBasics.params.hp);\r\n else\r\n return this._hp;\r\n },\r\n configurable: true\r\n },\r\n});\r\nGame_BattlerBase.prototype.getEntity_MR = function () {\r\n if (this._entityId_MR && this._entityId_MR.hasAny()) {\r\n return MRLively_1.MRLively.world.entity(this._entityId_MR);\r\n }\r\n return undefined;\r\n};\r\nconst _Game_BattlerBase_param = Game_BattlerBase.prototype.param;\r\nGame_BattlerBase.prototype.param = function (paramId) {\r\n const entuty = this.getEntity_MR();\r\n if (entuty) {\r\n switch (paramId) {\r\n case 0: return entuty.getIdealParamBase(paramId + 1); // mhp\r\n case 1: return entuty.getIdealParamBase(paramId + 1); // mmp\r\n default: return entuty.getActualParam(paramId + 1);\r\n }\r\n }\r\n return _Game_BattlerBase_param.call(this, paramId);\r\n};\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/rmmz/Game_BattlerBase.ts?"); /***/ }), /***/ "./ts/mr/rmmz/Game_CharacterBase.ts": /*!******************************************!*\ !*** ./ts/mr/rmmz/Game_CharacterBase.ts ***! \******************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst _Game_CharacterBase_initMembers = Game_CharacterBase.prototype.initMembers;\r\nGame_CharacterBase.prototype.initMembers = function () {\r\n _Game_CharacterBase_initMembers.call(this);\r\n};\r\nGame_CharacterBase.prototype.isREEvent = function () {\r\n return false;\r\n};\r\nGame_CharacterBase.prototype.isREPrefab = function () {\r\n return false;\r\n};\r\nGame_CharacterBase.prototype.isRESpritePrepared = function () {\r\n return false;\r\n};\r\nGame_CharacterBase.prototype.isREExtinct = function () {\r\n return false;\r\n};\r\nGame_CharacterBase.prototype.increaseRERevision = function () {\r\n if (!this._reRevision)\r\n this._reRevision = 0; // initMembers() で初期化してしまうと、Pool からの再利用時に初期化されてしまうので、ここで作る\r\n this._reRevision++;\r\n};\r\nGame_CharacterBase.prototype.reRevision = function () {\r\n if (!this._reRevision)\r\n return 0;\r\n return this._reRevision;\r\n};\r\nconst _Game_CharacterBase_updatePattern = Game_CharacterBase.prototype.updatePattern;\r\nGame_CharacterBase.prototype.updatePattern = function () {\r\n if (MRLively_1.MRLively.mapView.currentMap.floorId().isTacticsMap2) {\r\n // RE System の下では、見た目の制御は Sequel に任せる\r\n }\r\n else {\r\n _Game_CharacterBase_updatePattern.call(this);\r\n }\r\n};\r\nconst _Game_CharacterBase_updateAnimation = Game_CharacterBase.prototype.updateAnimation;\r\nGame_CharacterBase.prototype.updateAnimation = function () {\r\n if (MRLively_1.MRLively.mapView.currentMap.floorId().isTacticsMap2) {\r\n // RE System の下では、見た目の制御は Sequel に任せる\r\n }\r\n else {\r\n _Game_CharacterBase_updateAnimation.call(this);\r\n }\r\n};\r\nGame_CharacterBase.prototype.popupDamage_RE = function (value, color) {\r\n if (!this._popupDamages_RE)\r\n this._popupDamages_RE = [];\r\n this._popupDamages_RE.push({ value: value, color: color });\r\n};\r\nGame_CharacterBase.prototype.isDamagePopupRequested_RE = function () {\r\n return this._popupDamages_RE !== undefined && this._popupDamages_RE.length > 0;\r\n};\r\nGame_CharacterBase.prototype.clearDamagePopup_RE = function () {\r\n this._popupDamages_RE = undefined;\r\n};\r\nGame_CharacterBase.prototype.shiftDamageInfo_RE = function () {\r\n (0, Common_1.assert)(this._popupDamages_RE);\r\n const r = this._popupDamages_RE.shift();\r\n (0, Common_1.assert)(r);\r\n return r;\r\n};\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/rmmz/Game_CharacterBase.ts?"); /***/ }), /***/ "./ts/mr/rmmz/Game_Event.ts": /*!**********************************!*\ !*** ./ts/mr/rmmz/Game_Event.ts ***! \**********************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst SRmmzHelpers_1 = __webpack_require__(/*! ts/mr/system/SRmmzHelpers */ \"./ts/mr/system/SRmmzHelpers.ts\");\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst DAnnotationReader_1 = __webpack_require__(/*! ../data/importers/DAnnotationReader */ \"./ts/mr/data/importers/DAnnotationReader.ts\");\r\nconst MRDataManager_1 = __webpack_require__(/*! ../data/MRDataManager */ \"./ts/mr/data/MRDataManager.ts\");\r\nconst MRView_1 = __webpack_require__(/*! ../view/MRView */ \"./ts/mr/view/MRView.ts\");\r\nconst dummyMapEvent = {\r\n id: 0,\r\n name: \"\",\r\n note: \"\",\r\n pages: [],\r\n x: 0,\r\n y: 0,\r\n};\r\n/*\r\nconst _Game_Event_initialize = Game_Event.prototype.initialize;\r\nGame_Event.prototype.initialize = function(mapId: number, eventId: number) {\r\n if (mapId > 0) {\r\n _Game_Event_initialize.call(this, mapId, eventId);\r\n }\r\n else {\r\n console.log(\"_Game_Event_initialize\");\r\n Game_Character.prototype.initialize.call(this);\r\n }\r\n};\r\n*/\r\nvar _Game_Event_initialize = Game_Event.prototype.initialize;\r\nGame_Event.prototype.initialize = function (mapId, eventId) {\r\n _Game_Event_initialize.call(this, mapId, eventId);\r\n // @MR-EventPage によるページごとの追加情報を取り出しておく\r\n const pages = this.event().pages;\r\n for (let i = 0; i < pages.length; i++) {\r\n const page = pages[i];\r\n const annotation = page ?\r\n DAnnotationReader_1.DAnnotationReader.readEventPageAnnotation(page) :\r\n undefined;\r\n this._MREventPageAnnotations.push(annotation);\r\n }\r\n};\r\nvar _Game_Event_initMembers = Game_Event.prototype.initMembers;\r\nGame_Event.prototype.initMembers = function () {\r\n // RE-Event の場合、mapId は \"MR-Prefabs\" のマップのイベントとして扱う。\r\n // セルフスイッチをコントロールするときに参照される。\r\n // REシステムとしてはセルフスイッチは使用しないため実際のところなんでもよい。\r\n _Game_Event_initMembers.call(this);\r\n this._prefabId_RE = 0;\r\n this._spritePrepared_RE = false;\r\n this._pageData_RE = [];\r\n this._MREventPageAnnotations = [];\r\n //this._MRVisualId = 0;\r\n};\r\nvar _Game_Event_event = Game_Event.prototype.event;\r\nGame_Event.prototype.event = function () {\r\n if (this.isREEvent() || this._mapId == MRDataManager_1.MRDataManager.databaseMapId) {\r\n // Game_Event のコンストラクタは event() を呼び出し、初期座標を決めようとする。\r\n // その時点では this._eventData をセットすることは TypeScript の仕様上不可能なので、ダミーを参照させる。\r\n // 実際のところ Entity と Event の座標同期は update で常に行われるため、初期座標が (0,0) でも問題はない。\r\n return (this._eventData_RE) ? this._eventData_RE : dummyMapEvent;\r\n }\r\n else {\r\n return _Game_Event_event.call(this);\r\n }\r\n};\r\nvar _Game_Event_isTriggerIn = Game_Event.prototype.isTriggerIn;\r\nGame_Event.prototype.isTriggerIn = function (triggers) {\r\n if (this.isREEntity())\r\n return false; // イベント実行タイミングはすべて RE システム無いから決められる\r\n else\r\n return triggers.includes(this._trigger);\r\n};\r\nvar _Game_Event_setupPageSettings = Game_Event.prototype.setupPageSettings;\r\nGame_Event.prototype.setupPageSettings = function () {\r\n _Game_Event_setupPageSettings.call(this);\r\n this._isREEntity = !!SRmmzHelpers_1.SRmmzHelpers.readEntityMetadata(this, this._mapId);\r\n this._reEventData = (this._pageIndex >= 0) ? DAnnotationReader_1.DAnnotationReader.readREEventAnnotationFromPage(this.page()) : undefined;\r\n this._MRFloorEventAnnotation = (this._pageIndex >= 0) ? DAnnotationReader_1.DAnnotationReader.readFloorEventAnnotationFromPage(this.page()) : undefined;\r\n};\r\nvar _Game_Event_meetsConditions = Game_Event.prototype.meetsConditions;\r\nGame_Event.prototype.meetsConditions = function (page) {\r\n if (!_Game_Event_meetsConditions.call(this, page)) {\r\n return false;\r\n }\r\n const index = this.event().pages.findIndex(x => x == page);\r\n // @MR-EventPage による条件チェック\r\n {\r\n const additionalData = this._MREventPageAnnotations[index];\r\n if (additionalData) {\r\n if (additionalData.conditionActivatedQuestTaskKey) {\r\n if (!MRLively_1.MRLively.questManager.isQuestTaskAcivated(additionalData.conditionActivatedQuestTaskKey)) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n (0, Common_1.assert)(index >= 0);\r\n const additionalData = this._pageData_RE[index];\r\n if (additionalData && additionalData.condition_state) {\r\n if (MRView_1.MRView.entityVisualSet) {\r\n const visual = MRView_1.MRView.entityVisualSet.findEntityVisualByRMMZEventId(this.eventId());\r\n if (visual) {\r\n const statekey = additionalData.condition_state;\r\n const state = visual.entity()._states.find(x => MRLively_1.MRLively.world.object(x).stateData().key == statekey);\r\n if (!state) {\r\n return false;\r\n }\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n return true;\r\n};\r\nconst _Game_Event_update = Game_Event.prototype.update;\r\nGame_Event.prototype.update = function () {\r\n // if (REGame.map.floorId().isEntitySystemMap()) {\r\n // }\r\n // else {\r\n _Game_Event_update.call(this);\r\n // }\r\n};\r\nconst _Game_Event_refresh = Game_Event.prototype.refresh;\r\nGame_Event.prototype.refresh = function () {\r\n _Game_Event_refresh.call(this);\r\n this._MRNeedsRefresh = true;\r\n};\r\nGame_Event.prototype.setupPrefab = function (prefab, mapId, eventData) {\r\n this._mapId = mapId;\r\n this._prefabId_RE = prefab.id;\r\n this._eventData_RE = eventData;\r\n this._pageData_RE = [];\r\n for (let i = 0; i < this._eventData_RE.pages.length; i++) {\r\n const data = DAnnotationReader_1.DAnnotationReader.readREEventAnnotationFromPage(this._eventData_RE.pages[i]);\r\n if (data) {\r\n this._pageData_RE[i] = data;\r\n }\r\n }\r\n this.refresh();\r\n};\r\nGame_Event.prototype.resetPrefab = function (prefab) {\r\n this._pageIndex = -2; // pageIndex に変化が無い場合、refresh() しても setupPage() が呼ばれなくなるので、先にリセットする。\r\n this.setupPrefab(prefab, prefab.rmmzMapId, prefab.rmmzEventData);\r\n};\r\nGame_Event.prototype.isREEntity = function () {\r\n return this._isREEntity;\r\n};\r\nGame_Event.prototype.isREEvent = function () {\r\n return this._prefabId_RE > 0;\r\n};\r\nGame_Event.prototype.isREPrefab = function () {\r\n return this._prefabId_RE > 0;\r\n};\r\nGame_Event.prototype.isREExtinct = function () {\r\n return this._erased;\r\n};\r\nGame_Event.prototype.isRESpritePrepared = function () {\r\n return this._spritePrepared_RE;\r\n};\r\nGame_Event.prototype.setSpritePrepared = function (value) {\r\n this._spritePrepared_RE = true;\r\n};\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/rmmz/Game_Event.ts?"); /***/ }), /***/ "./ts/mr/rmmz/Game_Interpreter.ts": /*!****************************************!*\ !*** ./ts/mr/rmmz/Game_Interpreter.ts ***! \****************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nconst UTransfer_1 = __webpack_require__(/*! ts/mr/utility/UTransfer */ \"./ts/mr/utility/UTransfer.ts\");\r\nconst DSpawner_1 = __webpack_require__(/*! ../data/DSpawner */ \"./ts/mr/data/DSpawner.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ../data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst LExperienceBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LExperienceBehavior */ \"./ts/mr/lively/behaviors/LExperienceBehavior.ts\");\r\nconst LInventoryBehavior_1 = __webpack_require__(/*! ../lively/entity/LInventoryBehavior */ \"./ts/mr/lively/entity/LInventoryBehavior.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst internal_1 = __webpack_require__(/*! ../system/internal */ \"./ts/mr/system/internal.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ../system/MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nGame_Interpreter.prototype.getMRInterpreterContext = function () {\r\n if (!this._MR_EventScriptRunnerId)\r\n return undefined;\r\n return $gameSystem.getMREventScriptRunnerManager().getRunner(this._MR_EventScriptRunnerId);\r\n};\r\nGame_Interpreter.prototype.nextEventCommand = function () {\r\n const command = this._list[this._index + 1];\r\n if (command) {\r\n return command;\r\n }\r\n else {\r\n return undefined;\r\n }\r\n};\r\nGame_Interpreter.prototype.MR_resetList = function (list, index) {\r\n this._list = list;\r\n this._index = index;\r\n this._waitCount = 0;\r\n this._waitMode = \"\";\r\n};\r\nconst _Game_Interpreter_setup = Game_Interpreter.prototype.setup;\r\nGame_Interpreter.prototype.setup = function (list, eventId) {\r\n _Game_Interpreter_setup.call(this, list, eventId);\r\n if (this._eventId != 0) {\r\n // コモンイベントではなく、イベント実行内容からの呼び出し。\r\n // イベントコマンドの対象をリセットしておく。\r\n MRLively_1.MRLively.system.eventInterpreterContextKey = undefined;\r\n }\r\n};\r\nconst _Game_Interpreter_updateWaitMode = Game_Interpreter.prototype.updateWaitMode;\r\nGame_Interpreter.prototype.updateWaitMode = function () {\r\n if (this._waitMode == \"REResultWinodw\") {\r\n return MRLively_1.MRLively.challengeResultShowing;\r\n }\r\n else if (this._waitMode == \"MR-Dialog\") {\r\n return MRSystem_1.MRSystem.dialogContext._hasDialogModel() || MRSystem_1.MRSystem.commandContext.checkOpenDialogRequired();\r\n }\r\n else {\r\n return _Game_Interpreter_updateWaitMode.call(this);\r\n }\r\n};\r\nconst _Game_Interpreter_command101 = Game_Interpreter.prototype.command101;\r\nGame_Interpreter.prototype.command101 = function (params) {\r\n const result = _Game_Interpreter_command101.call(this, params);\r\n const next = this.nextEventCommand();\r\n if (next) {\r\n if ((next.code == 357 && next.parameters[1] == \"MR-ShowPostTalkDialog\")) {\r\n this._index++;\r\n this.command357(next.parameters);\r\n }\r\n if (next.code == 355 && next.parameters[0].includes(\"MR.showPostTalkDialog\")) {\r\n this._index++;\r\n this.command355();\r\n }\r\n }\r\n return result;\r\n};\r\n// [条件分岐] Conditional Branch\r\nconst _Game_Interpreter_command111 = Game_Interpreter.prototype.command111;\r\nGame_Interpreter.prototype.command111 = function (params) {\r\n let handled = false;\r\n const entity = MRLively_1.MRLively.system.getEventCommandTarget();\r\n if (entity) {\r\n let result = false;\r\n switch (params[0]) {\r\n case 7: { // Gold\r\n const inventory = entity.findEntityBehavior(LInventoryBehavior_1.LInventoryBehavior);\r\n if (inventory) {\r\n switch (params[2]) {\r\n case 0: // Greater than or equal to\r\n result = inventory.gold() >= params[1];\r\n break;\r\n case 1: // Less than or equal to\r\n result = inventory.gold() <= params[1];\r\n break;\r\n case 2: // Less than\r\n result = inventory.gold() < params[1];\r\n break;\r\n }\r\n }\r\n handled = true;\r\n break;\r\n }\r\n case 8: { // Item\r\n const inventory = entity.findEntityBehavior(LInventoryBehavior_1.LInventoryBehavior);\r\n if (inventory) {\r\n const entityDataId = MRData_1.MRData.itemData(params[1]).entityId;\r\n result = !!inventory.items.find(x => x.dataId == entityDataId);\r\n }\r\n handled = true;\r\n break;\r\n }\r\n case 12: { // Script\r\n // \"MR.\" に続けて関数を呼び出せるようにしたいので、このスコープで eval を実行する。\r\n const MR = this.getMRInterpreterContext();\r\n result = !!eval(params[1]);\r\n handled = true;\r\n break;\r\n }\r\n }\r\n if (handled) {\r\n this._branch[this._indent] = result;\r\n if (this._branch[this._indent] === false) {\r\n this.skipBranch();\r\n }\r\n return true;\r\n }\r\n }\r\n return _Game_Interpreter_command111.call(this, params);\r\n};\r\n// [場所移動] Transfer Player\r\nconst _Game_Interpreter_command201 = Game_Interpreter.prototype.command201;\r\nGame_Interpreter.prototype.command201 = function (params) {\r\n if (!_Game_Interpreter_command201.call(this, params))\r\n return false;\r\n UTransfer_1.UTransfer.transterRmmzDirectly($gamePlayer._newMapId, $gamePlayer._newX, $gamePlayer._newY, $gamePlayer._newDirection);\r\n return true;\r\n};\r\n// Change Party Member\r\nconst _Game_Interpreter_command129 = Game_Interpreter.prototype.command129;\r\nGame_Interpreter.prototype.command129 = function (params) {\r\n const result = _Game_Interpreter_command129.call(this, params);\r\n const rmmzActorId = $gameParty.members()[0].actorId();\r\n MRLively_1.MRLively.mapView.focus(MRLively_1.MRLively.world.getEntityByRmmzActorId(rmmzActorId));\r\n return result;\r\n};\r\n// [お金の増減] Change Gold\r\nconst _Game_Interpreter_command125 = Game_Interpreter.prototype.command125;\r\nGame_Interpreter.prototype.command125 = function (params) {\r\n var _a;\r\n const entity = MRLively_1.MRLively.system.getEventCommandTarget();\r\n if (!entity) {\r\n // RMMZ default process.\r\n return _Game_Interpreter_command125.call(this, params);\r\n }\r\n else {\r\n // MR-System process.\r\n const value = this.operateValue(params[0], params[1], params[2]);\r\n (_a = entity.findEntityBehavior(LInventoryBehavior_1.LInventoryBehavior)) === null || _a === void 0 ? void 0 : _a.gainGold(value);\r\n }\r\n return true;\r\n};\r\n// [アイテムの増減] Change Items\r\nconst _Game_Interpreter_command126 = Game_Interpreter.prototype.command126;\r\nGame_Interpreter.prototype.command126 = function (params) {\r\n const entity = MRLively_1.MRLively.system.getEventCommandTarget();\r\n if (!entity) {\r\n // RMMZ default process.\r\n return _Game_Interpreter_command126.call(this, params);\r\n }\r\n else {\r\n // MR-System process.\r\n const entityData = MRData_1.MRData.itemData(params[0]);\r\n gainItemHelper(this, entity, params[1], params[2], params[3], entityData.entityId);\r\n return true;\r\n }\r\n};\r\n// Change Weapons\r\nconst _Game_Interpreter_command127 = Game_Interpreter.prototype.command127;\r\nGame_Interpreter.prototype.command127 = function (params) {\r\n const entity = MRLively_1.MRLively.system.getEventCommandTarget();\r\n if (!entity) {\r\n // RMMZ default process.\r\n return _Game_Interpreter_command127.call(this, params);\r\n }\r\n else {\r\n // MR-System process.\r\n const entityData = MRData_1.MRData.getItemFromRmmzWeaponId(params[0]);\r\n gainItemHelper(this, entity, params[1], params[2], params[3], entityData.id);\r\n return true;\r\n }\r\n};\r\n// Change Armors\r\nconst _Game_Interpreter_command128 = Game_Interpreter.prototype.command128;\r\nGame_Interpreter.prototype.command128 = function (params) {\r\n const entity = MRLively_1.MRLively.system.getEventCommandTarget();\r\n if (!entity) {\r\n // RMMZ default process.\r\n return _Game_Interpreter_command128.call(this, params);\r\n }\r\n else {\r\n // MR-System process.\r\n const entityData = MRData_1.MRData.getItemFromRmmzArmorId(params[0]);\r\n gainItemHelper(this, entity, params[1], params[2], params[3], entityData.id);\r\n return true;\r\n }\r\n};\r\n// Change Level\r\nconst _Game_Interpreter_command316 = Game_Interpreter.prototype.command316;\r\nGame_Interpreter.prototype.command316 = function (params) {\r\n var _a;\r\n const entity = MRLively_1.MRLively.system.getEventCommandTarget();\r\n if (!entity) {\r\n // RMMZ default process.\r\n return _Game_Interpreter_command316.call(this, params);\r\n }\r\n else {\r\n // MR-System process.\r\n if (params[1] === 0) { // TOOD: \r\n const entity = MRLively_1.MRLively.system.getEventCommandTarget();\r\n if (entity) {\r\n const value = this.operateValue(params[2], params[3], params[4]);\r\n (_a = entity.findEntityBehavior(LExperienceBehavior_1.LExperienceBehavior)) === null || _a === void 0 ? void 0 : _a.setLevel(entity, value);\r\n }\r\n }\r\n return true;\r\n }\r\n};\r\n// Recover All\r\nconst _Game_Interpreter_command314 = Game_Interpreter.prototype.command314;\r\nGame_Interpreter.prototype.command314 = function (params) {\r\n const entity = MRLively_1.MRLively.system.getEventCommandTarget();\r\n if (!entity) {\r\n // RMMZ default process.\r\n return _Game_Interpreter_command314.call(this, params);\r\n }\r\n else {\r\n // MR-System process.\r\n if (params[1] === 0) { // TOOD: \r\n const entity = MRLively_1.MRLively.system.getEventCommandTarget();\r\n if (entity) {\r\n entity.recoverAll();\r\n }\r\n }\r\n return true;\r\n }\r\n};\r\n// Script\r\nconst _Game_Interpreter_command355 = Game_Interpreter.prototype.command355;\r\nGame_Interpreter.prototype.command355 = function () {\r\n const runenr = this.getMRInterpreterContext();\r\n if (runenr) {\r\n // \"MR.\" に続けて関数を呼び出せるようにしたいので、このスコープで eval を実行する。\r\n const MR = runenr;\r\n let script = this.currentCommand().parameters[0] + \"\\n\";\r\n while (this.nextEventCode() === 655) {\r\n this._index++;\r\n script += this.currentCommand().parameters[0] + \"\\n\";\r\n }\r\n eval(script);\r\n return true;\r\n }\r\n else {\r\n return _Game_Interpreter_command355.call(this);\r\n }\r\n};\r\nfunction gainItemHelper(interpreter, unit, operation, operandType, operand, itemEntityDataId) {\r\n const inventory = unit.findEntityBehavior(LInventoryBehavior_1.LInventoryBehavior);\r\n if (inventory) {\r\n const value = Math.min(interpreter.operateValue(operation, operandType, operand), inventory.remaining);\r\n for (let i = 0; i < value; i++) {\r\n const item = internal_1.SEntityFactory.newEntity(DSpawner_1.DEntityCreateInfo.makeSingle(itemEntityDataId));\r\n inventory.addEntity(item);\r\n }\r\n }\r\n}\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/rmmz/Game_Interpreter.ts?"); /***/ }), /***/ "./ts/mr/rmmz/Game_MREventScriptRunner.ts": /*!************************************************!*\ !*** ./ts/mr/rmmz/Game_MREventScriptRunner.ts ***! \************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Game_MREventScriptRunner = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst DScript_1 = __webpack_require__(/*! ../data/DScript */ \"./ts/mr/data/DScript.ts\");\r\nconst LScript_1 = __webpack_require__(/*! ../lively/LScript */ \"./ts/mr/lively/LScript.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ../system/MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nclass Game_MREventScriptRunner {\r\n constructor(script) {\r\n this.scriptId = script.id;\r\n this._interpreter = new Game_Interpreter();\r\n this._interpreter._MR_EventScriptRunnerId = script.id;\r\n this._interpreter.setup(script.list, 0);\r\n // ProgramCounter を label に合わせる。\r\n const index = LScript_1.LScriptContext.findLabelIndex(script.list, script.label);\r\n if (index >= 0) {\r\n this._interpreter._index = index;\r\n }\r\n }\r\n get isRunning() {\r\n return this._interpreter.isRunning();\r\n }\r\n get scriptContext() {\r\n return MRLively_1.MRLively.scriptManager.getScriptContext(this.scriptId);\r\n }\r\n update() {\r\n this._interpreter.update();\r\n }\r\n //------------------------------------------------------------------------------\r\n // 以下、イベントのスクリプトから呼び出すためのもの。\r\n // 量が非常に多くなることが予想されるため、プラグインコマンドとは別に定義している。\r\n setQuestIcon(questIconKey) {\r\n this.scriptContext.questIconKey = questIconKey;\r\n }\r\n openQuest(questKey) {\r\n MRSystem_1.MRSystem.questManager.openQuest(questKey);\r\n $gameMap.refresh();\r\n }\r\n isQuestInactived(questKey) {\r\n return MRLively_1.MRLively.questManager.isQuestInactived(questKey);\r\n }\r\n isQuestTaskAcivated(questTaskKey) {\r\n return MRLively_1.MRLively.questManager.isQuestTaskAcivated(questTaskKey);\r\n }\r\n /**\r\n * この Entity が持つアクティブな選択肢を調べ、選択肢ウィンドウを表示します。\r\n */\r\n showPostTalkDialog() {\r\n const sctx = this.scriptContext;\r\n const entity = sctx.entity;\r\n // NOTE: コモンイベントの呼び出し同様、子スクリプトを実行するときは Context を新しく作る。\r\n const s = new DScript_1.DScript(this._interpreter._list);\r\n const r = MRLively_1.MRLively.scriptManager.callQuery(entity, s, \"MRQuery-GetPostTalkCommands\");\r\n const commands = r.talkingCommands;\r\n const choices = commands.map(x => x.displayName);\r\n const cancelIndex = commands.findIndex(x => x.label == \"MRCommand-OnEndTalk\");\r\n if (cancelIndex < 0) {\r\n commands.push({ label: \"MRCommand-OnEndTalk\", displayName: (0, Common_1.tr2)(\"さようなら\") });\r\n }\r\n // command102 (Show Choices) と同様の処理\r\n const cancelType = -2;\r\n const defaultType = 0;\r\n const positionType = 2;\r\n const background = 0;\r\n $gameMessage.setChoices(choices, defaultType, cancelType);\r\n $gameMessage.setChoiceBackground(background);\r\n $gameMessage.setChoicePositionType(positionType);\r\n $gameMessage.setChoiceCallback(n => {\r\n console.log(\"setChoiceCallback\", n);\r\n // Jump to label\r\n const result = sctx.findListAndLabel(entity, commands[n].label);\r\n if (result) {\r\n if (result.list == this._interpreter._list) {\r\n this._interpreter._index = result.index;\r\n }\r\n else {\r\n this._interpreter.MR_resetList(result.list, result.index);\r\n }\r\n }\r\n // const index = LScriptContext.findLabelIndex(this._list, commands[n].label);\r\n // if (index >= 0) {\r\n // this._index = index;\r\n // }\r\n //(this._branch as any)[this._indent] = n;\r\n });\r\n this._interpreter.setWaitMode(\"message\");\r\n }\r\n}\r\nexports.Game_MREventScriptRunner = Game_MREventScriptRunner;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/rmmz/Game_MREventScriptRunner.ts?"); /***/ }), /***/ "./ts/mr/rmmz/Game_MREventScriptRunnerManager.ts": /*!*******************************************************!*\ !*** ./ts/mr/rmmz/Game_MREventScriptRunnerManager.ts ***! \*******************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Game_MREventScriptRunnerManager = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst Game_MREventScriptRunner_1 = __webpack_require__(/*! ./Game_MREventScriptRunner */ \"./ts/mr/rmmz/Game_MREventScriptRunner.ts\");\r\nlet Game_MREventScriptRunnerManager = class Game_MREventScriptRunnerManager {\r\n constructor() {\r\n this._eventScriptRunners = [];\r\n }\r\n getRunner(runnerId) {\r\n return this._eventScriptRunners[runnerId];\r\n }\r\n isAnyRunning() {\r\n for (const runner of this._eventScriptRunners) {\r\n if (runner) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n start(script) {\r\n const runner = new Game_MREventScriptRunner_1.Game_MREventScriptRunner(script);\r\n this._eventScriptRunners[script.id] = runner;\r\n // Query では即実行したい。context を取るため、 _eventScriptRunners に add してから実行する。\r\n runner.update();\r\n }\r\n update() {\r\n for (const runner of this._eventScriptRunners) {\r\n if (runner) {\r\n runner.update();\r\n if (!runner.isRunning) {\r\n this.onEnd(runner);\r\n }\r\n }\r\n }\r\n ;\r\n }\r\n onEnd(runner) {\r\n this._eventScriptRunners[runner.scriptId] = undefined;\r\n }\r\n};\r\nGame_MREventScriptRunnerManager = __decorate([\r\n Common_1.MRSerializable\r\n], Game_MREventScriptRunnerManager);\r\nexports.Game_MREventScriptRunnerManager = Game_MREventScriptRunnerManager;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/rmmz/Game_MREventScriptRunnerManager.ts?"); /***/ }), /***/ "./ts/mr/rmmz/Game_Map.ts": /*!********************************!*\ !*** ./ts/mr/rmmz/Game_Map.ts ***! \********************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nconst SView_1 = __webpack_require__(/*! ts/mr/system/SView */ \"./ts/mr/system/SView.ts\");\r\nconst MRDataManager_1 = __webpack_require__(/*! ../data/MRDataManager */ \"./ts/mr/data/MRDataManager.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst SRmmzHelpers_1 = __webpack_require__(/*! ../system/SRmmzHelpers */ \"./ts/mr/system/SRmmzHelpers.ts\");\r\nconst MRView_1 = __webpack_require__(/*! ../view/MRView */ \"./ts/mr/view/MRView.ts\");\r\nconst RMMZHelper_1 = __webpack_require__(/*! ./RMMZHelper */ \"./ts/mr/rmmz/RMMZHelper.ts\");\r\nGame_Map.prototype.unlinkREEvents = function () {\r\n for (const event of this.events()) {\r\n if (event.isREEvent()) {\r\n $dataMap.events[event.eventId()] = null;\r\n }\r\n }\r\n};\r\n// Map 移動したときに呼ばれる。\r\n// セーブデータをロードしたときは呼ばれない。\r\n//\r\n// SceneManager.updateScene\r\n// Scene_Map.prototype.isReady \r\n// Scene_Map.prototype.onMapLoaded \r\n// Game_Player.prototype.performTransfer\r\n// Game_Map.prototype.setup\r\n//\r\n// SceneManager.updateScene (上記 isReady チェック後)\r\n// Scene_Map.prototype.start\r\n// Scene_Map.prototype.onTransferEnd\r\n// Scene_Base.prototype.requestAutosave\r\nconst _Game_Map_setup = Game_Map.prototype.setup;\r\nGame_Map.prototype.setup = function (mapId) {\r\n var _a;\r\n MRLively_1.MRLively.messageHistory.clear();\r\n // Game_Map.setup が呼ばれるのは、マップが切り替わるとき。\r\n // タイミングの都合で DataManager.onLoad によって前のマップの REEvent が $dataMap.event に含まれているので、これを削除しておく。\r\n //this.unlinkREEvents();\r\n _Game_Map_setup.call(this, mapId);\r\n // performTransfer() が呼ばれる時点では、RMMZ のマップ情報はロード済み。\r\n // transfarEntity で Player 操作中の Entity も別マップへ移動する。\r\n // この中で、Camera が Player を注視していれば Camera も Floor を移動することで、\r\n // REシステムとしてのマップ遷移も行われる。\r\n //\r\n // Game_Map 呼び出し元の Game_Player.performTransfer() で行うのも手だが、\r\n // performTransfer() は同一マップ内で位置だけ移動するときも呼び出されるため、\r\n // 本当に別マップに移動したときだけ処理したいものは Game_Map.setup() で行った方がよい。\r\n // Land 定義マップ、初期配置されているイベントを非表示にしておく。\r\n // ランダム Entity 生成ではこれが動的イベントの原本になることもあるので、削除はしない。\r\n if (MRDataManager_1.MRDataManager.isLandMap(mapId)) {\r\n for (const event of this.events()) {\r\n event.setTransparent(true);\r\n }\r\n $gamePlayer.hideFollowers();\r\n }\r\n (_a = MRView_1.MRView.dialogManager) === null || _a === void 0 ? void 0 : _a.onRmmzSetupMapCompleted();\r\n // TacticsMap であれば、@MR-Spawner である Event を非表示にしておく\r\n if (MRLively_1.MRLively.mapView.currentFloorId.isTacticsMap2) {\r\n for (const event of this.events()) {\r\n const data = SRmmzHelpers_1.SRmmzHelpers.readEntityMetadata(event, $gameMap.mapId());\r\n if (data) {\r\n event.setTransparent(true);\r\n }\r\n }\r\n $gamePlayer.hideFollowers();\r\n }\r\n};\r\nconst _Game_Map_isEventRunning = Game_Map.prototype.isEventRunning;\r\nGame_Map.prototype.isEventRunning = function () {\r\n return _Game_Map_isEventRunning.call(this) || $gameSystem.getMREventScriptRunnerManager().isAnyRunning();\r\n};\r\nconst _Game_Map_tileset = Game_Map.prototype.tileset;\r\nGame_Map.prototype.tileset = function () {\r\n const view = SView_1.SView.getTilemapView();\r\n if (view.tilesetId)\r\n return $dataTilesets[view.tilesetId];\r\n else\r\n return _Game_Map_tileset.call(this);\r\n};\r\nconst _Game_Map_update = Game_Map.prototype.update;\r\nGame_Map.prototype.update = function (sceneActive) {\r\n _Game_Map_update.call(this, sceneActive);\r\n //SGameManager.attemptRestartFloor();\r\n if (MRLively_1.MRLively.mapView.currentMap.lastKeeperCount != MRLively_1.MRLively.mapView.currentMap.keeperCount &&\r\n MRLively_1.MRLively.mapView.currentMap.keeperCount == 0) {\r\n RMMZHelper_1.RMMZHelper.triggerOnKeeperLostEvent();\r\n }\r\n MRLively_1.MRLively.mapView.currentMap.lastKeeperCount = MRLively_1.MRLively.mapView.currentMap.keeperCount;\r\n};\r\n/*\r\nGame_Map.prototype.isRMMZDefaultSystemMap = function(): boolean {\r\n return REData.maps[this.mapId()].defaultSystem;\r\n}\r\n\r\nGame_Map.prototype.isRESystemMap = function(): boolean {\r\n return REGame.map.isValid();\r\n}\r\n*/\r\nconst _Game_Map_autoplay = Game_Map.prototype.autoplay;\r\nGame_Map.prototype.autoplay = function () {\r\n const floorId = MRLively_1.MRLively.mapView.currentMap.floorId();\r\n if (floorId.isDungeonMap2) {\r\n const data = floorId.floorInfo;\r\n if (data.bgmName != \"\") {\r\n AudioManager.playBgm({ name: data.bgmName, pan: 0, pitch: data.bgmPitch, volume: data.bgmVolume }, 0);\r\n return;\r\n }\r\n }\r\n _Game_Map_autoplay.call(this);\r\n};\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/rmmz/Game_Map.ts?"); /***/ }), /***/ "./ts/mr/rmmz/Game_Message.ts": /*!************************************!*\ !*** ./ts/mr/rmmz/Game_Message.ts ***! \************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\n// ウィンドウ表示中の制限は Game_Message.isBusy にほぼ集約されているので、\r\n// REシステムのウィンドウによる制限もここで行う。\r\n// そうしないと、Game_Player の移動可能判定やイベント起動判定、メニュー遷移など\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nconst MRLively_1 = __webpack_require__(/*! ../lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\n// たくさんの場所に条件を追加しなければならなくなる。\r\nconst _Game_Message_isBusy = Game_Message.prototype.isBusy;\r\nGame_Message.prototype.isBusy = function () {\r\n return (_Game_Message_isBusy.call(this) ||\r\n MRLively_1.MRLively.challengeResultShowing);\r\n};\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/rmmz/Game_Message.ts?"); /***/ }), /***/ "./ts/mr/rmmz/Game_Player.ts": /*!***********************************!*\ !*** ./ts/mr/rmmz/Game_Player.ts ***! \***********************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nconst MRLively_1 = __webpack_require__(/*! ../lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst MRView_1 = __webpack_require__(/*! ../view/MRView */ \"./ts/mr/view/MRView.ts\");\r\nconst RMMZHelper_1 = __webpack_require__(/*! ./RMMZHelper */ \"./ts/mr/rmmz/RMMZHelper.ts\");\r\nconst _Game_Player_initMembers = Game_Player.prototype.initMembers;\r\nGame_Player.prototype.initMembers = function () {\r\n _Game_Player_initMembers.call(this);\r\n};\r\nconst _Game_Player_isTransparent = Game_Player.prototype.isTransparent;\r\nGame_Player.prototype.isTransparent = function () {\r\n if (MRLively_1.MRLively.mapView.currentMap.floorId().isTacticsMap2)\r\n return true; // RE マップ中は常に非表示\r\n else\r\n return _Game_Player_isTransparent.call(this);\r\n};\r\nconst _Game_Player_canMove = Game_Player.prototype.canMove;\r\nGame_Player.prototype.canMove = function () {\r\n var _a, _b;\r\n // これが false, false になっている。\r\n // 変な dialog が出ている気がする。\r\n console.log(\"Game_Player.prototype.canMove\", (_a = MRView_1.MRView.dialogManager) === null || _a === void 0 ? void 0 : _a.dialogNavigator);\r\n // REma マップではマニュアル移動を禁止\r\n if (MRLively_1.MRLively.mapView.currentMap.floorId().isTacticsMap2) {\r\n return false;\r\n }\r\n // 通常マップでも、 Dialog 表示中は移動を禁止する\r\n if (!((_b = MRView_1.MRView.dialogManager) === null || _b === void 0 ? void 0 : _b.dialogNavigator.isEmpty)) {\r\n return false;\r\n }\r\n return _Game_Player_canMove.call(this);\r\n};\r\nconst _Game_Player_refresh = Game_Player.prototype.refresh;\r\nGame_Player.prototype.refresh = function () {\r\n _Game_Player_refresh.call(this);\r\n if (RMMZHelper_1.RMMZHelper.isRESystemMap()) {\r\n // ランダムマップで配置された結果を、Player 位置に再設定する。\r\n // Game_Player.prototype.performTransfer() の処理は次の順で行われる。\r\n // - $gameMap.setup()\r\n // - locate(newPos);\r\n // - refresh();\r\n // ランダム配置は $gameMap.setup() の中で行われるが、その後 $gamePlayer.locate があるので、\r\n // 座標の再設定は refresh() のタイミングで行う必要がある。\r\n // なお、locate() を呼んでいるのは、合わせて $gameMap.setDisplayPos() が必要だから。\r\n // これが無いと、プレイヤー初期位置が画面中央になるようにスクロールしてくれない。\r\n const entity = MRLively_1.MRLively.mapView.focusedEntity();\r\n if (entity) {\r\n $gamePlayer.locate(entity.mx, entity.my);\r\n }\r\n }\r\n};\r\nconst _Game_Player_update = Game_Player.prototype.update;\r\nGame_Player.prototype.update = function (sceneActive) {\r\n /*\r\n if ($gameMap.isRESystemMap()) {\r\n const entity = REGame.camera.focusedEntity();\r\n if (entity && REVisual.entityVisualSet) {\r\n const visual = REVisual.entityVisualSet.findEntityVisualByEntity(entity);\r\n if (visual) {\r\n const pos = visual.position();\r\n //console.log(\"this._realX\", this._realX - pos.x);\r\n \r\n const lastScrolledX = this.scrolledX();\r\n const lastScrolledY = this.scrolledY();\r\n\r\n this._realX = pos.x;\r\n this._realY = pos.y;\r\n this._x = entity.x;\r\n this._y = entity.y;\r\n\r\n this.updateScroll(lastScrolledX, lastScrolledY);\r\n }\r\n }\r\n }\r\n else {\r\n */\r\n _Game_Player_update.call(this, sceneActive);\r\n //}\r\n};\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/rmmz/Game_Player.ts?"); /***/ }), /***/ "./ts/mr/rmmz/Game_System.ts": /*!***********************************!*\ !*** ./ts/mr/rmmz/Game_System.ts ***! \***********************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nconst Game_MREventScriptRunnerManager_1 = __webpack_require__(/*! ./Game_MREventScriptRunnerManager */ \"./ts/mr/rmmz/Game_MREventScriptRunnerManager.ts\");\r\nGame_System.prototype.getMREventScriptRunnerManager = function () {\r\n if (!this._MR_MREventScriptRunnerManager) {\r\n this._MR_MREventScriptRunnerManager = new Game_MREventScriptRunnerManager_1.Game_MREventScriptRunnerManager();\r\n }\r\n return this._MR_MREventScriptRunnerManager;\r\n};\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/rmmz/Game_System.ts?"); /***/ }), /***/ "./ts/mr/rmmz/JsonEx.ts": /*!******************************!*\ !*** ./ts/mr/rmmz/JsonEx.ts ***! \******************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nconst SBehaviorFactory_1 = __webpack_require__(/*! ts/mr/system/SBehaviorFactory */ \"./ts/mr/system/SBehaviorFactory.ts\");\r\n/**\r\n * セーブデータをロードするとき、JsonEx._decode の window[value[\"@\"]] では\r\n * クラス名を指定して prototype をとることができなかった。\r\n *\r\n * window に直接手を入れていいものか判断付かないため、\r\n * JsonEx._decode をオーバーライドしてインスタンスを作成できるようにしている。\r\n */\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nfunction createInstance(name) {\r\n if (name.endsWith(\"Behavior\")) {\r\n const i = SBehaviorFactory_1.SBehaviorManager.createBehaviorInstance(name);\r\n if (i)\r\n return i;\r\n }\r\n return Common_1.TypeStore.createInstance(name);\r\n}\r\nconst _JsonEx__decode = JsonEx._decode;\r\nJsonEx._decode = function (value) {\r\n const type = Object.prototype.toString.call(value);\r\n if (type === \"[object Object]\" || type === \"[object Array]\") {\r\n if (value[\"@\"]) {\r\n const constructor = window[value[\"@\"]];\r\n if (constructor) {\r\n Object.setPrototypeOf(value, constructor.prototype);\r\n }\r\n else {\r\n const i = createInstance(value[\"@\"]);\r\n Object.assign(i, value);\r\n value = i;\r\n }\r\n }\r\n for (const key of Object.keys(value)) {\r\n value[key] = this._decode(value[key]);\r\n }\r\n }\r\n return value;\r\n};\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/rmmz/JsonEx.ts?"); /***/ }), /***/ "./ts/mr/rmmz/PluginCommands.ts": /*!**************************************!*\ !*** ./ts/mr/rmmz/PluginCommands.ts ***! \**************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst LFloorId_1 = __webpack_require__(/*! ts/mr/lively/LFloorId */ \"./ts/mr/lively/LFloorId.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ts/mr/system/MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst MRView_1 = __webpack_require__(/*! ts/mr/view/MRView */ \"./ts/mr/view/MRView.ts\");\r\nconst UTransfer_1 = __webpack_require__(/*! ts/mr/utility/UTransfer */ \"./ts/mr/utility/UTransfer.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ../data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst LEntity_1 = __webpack_require__(/*! ../lively/entity/LEntity */ \"./ts/mr/lively/entity/LEntity.ts\");\r\nconst SWarehouseStoreDialog_1 = __webpack_require__(/*! ../system/dialogs/SWarehouseStoreDialog */ \"./ts/mr/system/dialogs/SWarehouseStoreDialog.ts\");\r\nconst USearch_1 = __webpack_require__(/*! ../utility/USearch */ \"./ts/mr/utility/USearch.ts\");\r\nconst SWarehouseWithdrawDialog_1 = __webpack_require__(/*! ../system/dialogs/SWarehouseWithdrawDialog */ \"./ts/mr/system/dialogs/SWarehouseWithdrawDialog.ts\");\r\nconst UProperty_1 = __webpack_require__(/*! ../utility/UProperty */ \"./ts/mr/utility/UProperty.ts\");\r\nconst SItemSellDialog_1 = __webpack_require__(/*! ../system/dialogs/SItemSellDialog */ \"./ts/mr/system/dialogs/SItemSellDialog.ts\");\r\nconst RMMZHelper_1 = __webpack_require__(/*! ./RMMZHelper */ \"./ts/mr/rmmz/RMMZHelper.ts\");\r\nconst LInventoryBehavior_1 = __webpack_require__(/*! ../lively/entity/LInventoryBehavior */ \"./ts/mr/lively/entity/LInventoryBehavior.ts\");\r\nconst DScript_1 = __webpack_require__(/*! ../data/DScript */ \"./ts/mr/data/DScript.ts\");\r\nconst pluginName = \"LN_MysteryRogueSystem\";\r\nPluginManager.registerCommand(pluginName, \"RE.ShowChallengeResult\", (args) => {\r\n MRLively_1.MRLively.challengeResultShowing = true;\r\n $gameMap._interpreter.setWaitMode(\"REResultWinodw\");\r\n});\r\nPluginManager.registerCommand(pluginName, \"MR-SetContext\", (args) => {\r\n const key = args.key;\r\n if (!key || key == \"default\") {\r\n MRLively_1.MRLively.system.eventInterpreterContextKey = undefined;\r\n }\r\n else {\r\n MRLively_1.MRLively.system.eventInterpreterContextKey = key;\r\n }\r\n});\r\nPluginManager.registerCommand(pluginName, \"MR-ShowWarehouseStoreDialog\", (args) => {\r\n const serviceProviderKey = args.serviceProviderKey;\r\n const serviceUserKey = args.serviceUserKey;\r\n if (MRView_1.MRView.sequelFactory) {\r\n const player = MRLively_1.MRLively.mapView.getFocusedEntity();\r\n MRSystem_1.MRSystem.commandContext.openDialog(player, new SWarehouseStoreDialog_1.SWarehouseStoreDialog(USearch_1.USearch.getEntityByKeyPattern(serviceUserKey), USearch_1.USearch.getEntityByKeyPattern(serviceProviderKey)), false)\r\n .then((d) => {\r\n $gameVariables.setValue(MRBasics_1.MRBasics.variables.result, d.result);\r\n });\r\n $gameMap._interpreter.setWaitMode(\"MR-Dialog\");\r\n }\r\n});\r\nPluginManager.registerCommand(pluginName, \"MR-ShowWarehouseWithdrawDialog\", (args) => {\r\n const serviceProviderKey = args.serviceProviderKey;\r\n const serviceUserKey = args.serviceUserKey;\r\n if (MRView_1.MRView.sequelFactory) {\r\n const player = MRLively_1.MRLively.mapView.getFocusedEntity();\r\n MRSystem_1.MRSystem.commandContext.openDialog(player, new SWarehouseWithdrawDialog_1.SWarehouseWithdrawDialog(USearch_1.USearch.getEntityByKeyPattern(serviceUserKey), USearch_1.USearch.getEntityByKeyPattern(serviceProviderKey)), false)\r\n .then((d) => {\r\n $gameVariables.setValue(MRBasics_1.MRBasics.variables.result, d.result);\r\n });\r\n $gameMap._interpreter.setWaitMode(\"MR-Dialog\");\r\n }\r\n});\r\nPluginManager.registerCommand(pluginName, \"MR-ShowItemSellDialog\", (args) => {\r\n const serviceProviderKey = args.serviceProviderKey;\r\n const serviceUserKey = args.serviceUserKey;\r\n const inventoryOwnerKey = args.inventoryOwnerKey;\r\n if (MRView_1.MRView.sequelFactory) {\r\n const player = MRLively_1.MRLively.mapView.getFocusedEntity();\r\n MRSystem_1.MRSystem.commandContext.openDialog(player, new SItemSellDialog_1.SItemSellDialog(USearch_1.USearch.getEntityByKeyPattern(serviceProviderKey), USearch_1.USearch.getEntityByKeyPattern(serviceUserKey), USearch_1.USearch.getEntityByKeyPattern(inventoryOwnerKey)), false)\r\n .then((d) => {\r\n $gameVariables.setValue(MRBasics_1.MRBasics.variables.result, d.resultItems.length);\r\n });\r\n $gameMap._interpreter.setWaitMode(\"MR-Dialog\");\r\n }\r\n});\r\nPluginManager.registerCommand(pluginName, \"MR-ProceedFloorForward\", function (args) {\r\n UTransfer_1.UTransfer.proceedFloorForwardForPlayer(MRSystem_1.MRSystem.commandContext);\r\n});\r\nPluginManager.registerCommand(pluginName, \"MR-ProceedFloorBackword\", function (args) {\r\n const entity = MRLively_1.MRLively.mapView.focusedEntity();\r\n if (entity) {\r\n const floorId = entity.floorId;\r\n const newFloorNumber = floorId.floorNumber - 1;\r\n // 最初のフロアから戻った?\r\n if (newFloorNumber <= 0) {\r\n MRSystem_1.MRSystem.integration.onSetLandExitResult(MRData_1.LandExitResult.Escape);\r\n throw new Error(\"Not implemented\"); // TODO: ExitFloorId とる\r\n // const exitRMMZMapId = floorId.landData.exitMapData.mapId;\r\n // assert(exitRMMZMapId > 0);\r\n //const result = this.command201([0, exitRMMZMapId, 0, 0, 2, 0]);\r\n //assert(result);\r\n }\r\n else {\r\n const newFloorId = LFloorId_1.LFloorId.make(floorId.landId, newFloorNumber);\r\n MRLively_1.MRLively.world.transferEntity(entity, newFloorId);\r\n // イベントからの遷移は普通の [場所移動] コマンドと同じように WaitMode を設定する必要がある。\r\n // しないと、例えば直前に表示していたメッセージウィンドウのクローズなどを待たずに遷移が発生し、isBusy() でハングする。\r\n this.setWaitMode(\"transfer\");\r\n }\r\n }\r\n});\r\nPluginManager.registerCommand(pluginName, \"MR-LivingResult-GetIncludesState\", function (args) {\r\n const actorKey = args[\"actorKey\"];\r\n const stateKey = args[\"stateKey\"];\r\n let actor;\r\n if (actorKey) {\r\n const r = MRLively_1.MRLively.world.objects().find(x => {\r\n if (x instanceof LEntity_1.LEntity) {\r\n if (x.data.entity.key == actorKey) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n });\r\n if (r && r instanceof LEntity_1.LEntity) {\r\n actor = r;\r\n }\r\n }\r\n else {\r\n const r = MRLively_1.MRLively.mapView.focusedEntity();\r\n if (r) {\r\n actor = r;\r\n }\r\n }\r\n if (actor) {\r\n const stateId = MRData_1.MRData.getState(stateKey).id;\r\n const has = actor._deathResult.states().includes(stateId);\r\n $gameVariables.setValue(MRBasics_1.MRBasics.variables.result, has ? 1 : 0);\r\n }\r\n else {\r\n $gameVariables.setValue(MRBasics_1.MRBasics.variables.result, -1);\r\n }\r\n});\r\nPluginManager.registerCommand(pluginName, \"MR-StartChallenge\", function (args) {\r\n const entity = MRLively_1.MRLively.system.getEventCommandTarget();\r\n if (entity) {\r\n const party = entity.party();\r\n if (party) {\r\n party.startChallenging();\r\n }\r\n }\r\n});\r\nPluginManager.registerCommand(pluginName, \"MR-FinishChallenge\", function (args) {\r\n const entity = MRLively_1.MRLively.system.getEventCommandTarget();\r\n if (entity) {\r\n const party = entity.party();\r\n if (party) {\r\n party.finishChallenging();\r\n }\r\n }\r\n});\r\nPluginManager.registerCommand(pluginName, \"MR-SetProperty\", function (args) {\r\n const entityKey = args[\"entityKey\"];\r\n const propertyPath = args[\"property\"];\r\n const value = args[\"value\"];\r\n UProperty_1.UProperty.setValue(entityKey, propertyPath, UProperty_1.UProperty.getValueByVariablePattern(value));\r\n});\r\nPluginManager.registerCommand(pluginName, \"MR-GetProperty\", function (args) {\r\n const entityKey = args[\"entityKey\"];\r\n const property = args[\"property\"];\r\n const variable = args[\"variable\"];\r\n const entity = USearch_1.USearch.getEntityByKeyPattern(entityKey);\r\n RMMZHelper_1.RMMZHelper.setVariable(variable, UProperty_1.UProperty.getValueFromEntity(entity, property));\r\n});\r\nPluginManager.registerCommand(pluginName, \"MR-ResetStatus\", function (args) {\r\n const entityKey = args[\"entityKey\"];\r\n const entity = USearch_1.USearch.getEntityByKeyPattern(entityKey);\r\n entity.resetStatus();\r\n});\r\nPluginManager.registerCommand(pluginName, \"MR-ResetInventory\", function (args) {\r\n const entityKey = args[\"entityKey\"];\r\n const entity = USearch_1.USearch.getEntityByKeyPattern(entityKey);\r\n const inventory = entity.findEntityBehavior(LInventoryBehavior_1.LInventoryBehavior);\r\n if (inventory) {\r\n inventory.reset();\r\n }\r\n});\r\nPluginManager.registerCommand(pluginName, \"MR-AddPostTalkCommand\", function (args) {\r\n const label = args[\"label\"];\r\n const name = args[\"name\"];\r\n const runenr = this.getMRInterpreterContext();\r\n (0, Common_1.assert)(runenr);\r\n const ctx = runenr.scriptContext;\r\n ctx.talkingCommands.push({ label: label, displayName: name });\r\n});\r\nPluginManager.registerCommand(pluginName, \"MR-ShowPostTalkDialog\", function (args) {\r\n console.warn(\"MR-ShowPostTalkDialog is deprecated. Use MR.showPostTalkDialog.\");\r\n const runenr = this.getMRInterpreterContext();\r\n (0, Common_1.assert)(runenr);\r\n const sctx = runenr.scriptContext;\r\n const entity = sctx.entity;\r\n // NOTE: コモンイベントの呼び出し同様、子スクリプトを実行するときは Context を新しく作る。\r\n //{\r\n const s = new DScript_1.DScript(this._list);\r\n const r = MRLively_1.MRLively.scriptManager.callQuery(sctx.entity, s, \"MRQuery-GetPostTalkCommands\");\r\n const commands = r.talkingCommands;\r\n //return;\r\n //}\r\n //const ctx = this.getMRInterpreterContext().scriptContext;\r\n const choices = commands.map(x => x.displayName);\r\n const cancelIndex = commands.findIndex(x => x.label == \"MRCommand-OnEndTalk\");\r\n if (cancelIndex < 0) {\r\n commands.push({ label: \"MRCommand-OnEndTalk\", displayName: \"さようなら\" });\r\n }\r\n // command102 (Show Choices) と同様の処理\r\n const cancelType = -2;\r\n const defaultType = 0;\r\n const positionType = 2;\r\n const background = 0;\r\n $gameMessage.setChoices(choices, defaultType, cancelType);\r\n $gameMessage.setChoiceBackground(background);\r\n $gameMessage.setChoicePositionType(positionType);\r\n $gameMessage.setChoiceCallback(n => {\r\n console.log(\"setChoiceCallback\", n);\r\n // Jump to label\r\n const result = sctx.findListAndLabel(entity, commands[n].label);\r\n if (result) {\r\n if (result.list == this._list) {\r\n this._index = result.index;\r\n }\r\n else {\r\n this.MR_resetList(result.list, result.index);\r\n }\r\n }\r\n // const index = LScriptContext.findLabelIndex(this._list, commands[n].label);\r\n // if (index >= 0) {\r\n // this._index = index;\r\n // }\r\n //(this._branch as any)[this._indent] = n;\r\n });\r\n this.setWaitMode(\"message\");\r\n});\r\nPluginManager.registerCommand(pluginName, \"MR-OpenQuest\", function (args) {\r\n const questKey = args[\"questKey\"];\r\n MRLively_1.MRLively.questManager.openQuest(questKey);\r\n});\r\nPluginManager.registerCommand(pluginName, \"MR-AdvanceQuestTask\", function (args) {\r\n const questKey = args[\"questKey\"];\r\n const questTaskKey = args[\"questTaskKey\"];\r\n MRLively_1.MRLively.questManager.advanceQuestTask(questKey, questTaskKey);\r\n});\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/rmmz/PluginCommands.ts?"); /***/ }), /***/ "./ts/mr/rmmz/PrefabEvent.ts": /*!***********************************!*\ !*** ./ts/mr/rmmz/PrefabEvent.ts ***! \***********************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\n/**\r\n * RE用動的スプライトのライフサイクル\r\n * ----------\r\n * Entity が削除されても、動的に作成された REEvent 及び対応する CharacterSprite は\r\n * 非表示になるだけで、削除されることは無い。\r\n * 新たな Entity が作成されると、これが再利用される。\r\n *\r\n * REEvent は通常の Event と同じ更新処理を適用したいため、$gameMap.events で管理される。\r\n * REEvent のインスタンス削除が発生すれば当然このリストからも取り除く必要があるが、\r\n * そうすると取り除いた箇所の index が undefined になってしまう。\r\n * コアスクリプトはそのような状態を想定していないためクラッシュする。\r\n */\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst MRView_1 = __webpack_require__(/*! ../view/MRView */ \"./ts/mr/view/MRView.ts\");\r\nGame_Map.prototype.spawnREEvent = function (prefab, resetEventId, overrideEventData) {\r\n if (!$dataMap.events) {\r\n throw new Error();\r\n }\r\n (0, Common_1.assert)(prefab.id > 0);\r\n (0, Common_1.assert)(prefab.rmmzEventData.id > 0);\r\n const eventData = overrideEventData !== null && overrideEventData !== void 0 ? overrideEventData : prefab.rmmzEventData;\r\n // override 指定がある場合は既存イベントを再 setup する。\r\n // これによって固定マップのイベントではなく、Prefab マップのイベント内容として構築される。\r\n if (resetEventId) {\r\n const data = $dataMap.events[resetEventId];\r\n (0, Common_1.assert)(data);\r\n const event = this._events[resetEventId];\r\n event.initMembers();\r\n event.increaseRERevision();\r\n event.setupPrefab(prefab, $gameMap.mapId(), data);\r\n return event;\r\n }\r\n // フリー状態の REEvent を探してみる\r\n let eventId = this._events.findIndex(e => e && e.isREEvent() && e.isREExtinct());\r\n if (eventId < 0) {\r\n // 見つからなければ新しく作る\r\n eventId = this._events.length;\r\n const event = new Game_Event(prefab.rmmzMapId, eventId);\r\n event.setupPrefab(prefab, prefab.rmmzMapId, eventData);\r\n this._events[eventId] = event;\r\n return event;\r\n }\r\n else {\r\n const event = this._events[eventId];\r\n (0, Common_1.assert)(event.isREEvent());\r\n // 再構築\r\n const spritePrepared_RE = event.isRESpritePrepared();\r\n event.initMembers();\r\n event.increaseRERevision();\r\n event.setupPrefab(prefab, prefab.rmmzMapId, eventData);\r\n event.setSpritePrepared(spritePrepared_RE); // initMembers でリセットされるが、スプライト割り当て済みフラグは維持する\r\n return event;\r\n }\r\n};\r\n/*\r\nGame_Map.prototype.spawnREEventFromCurrentMapEvent = function(eventId: number): Game_REPrefabEvent {\r\n var event = new Game_REPrefabEvent(this._mapId, this._mapId, eventId);\r\n this._events[eventId] = event;\r\n return event;\r\n}\r\n*/\r\nGame_Map.prototype.getREPrefabEvents = function () {\r\n return this.events().filter(function (event) {\r\n return event.isREPrefab();\r\n });\r\n};\r\n// Scene 開始時の Sprite 生成\r\nvar _Spriteset_Map_createCharacters = Spriteset_Map.prototype.createCharacters;\r\nSpriteset_Map.prototype.createCharacters = function () {\r\n this._prefabSpriteIdRE = this._counter + 1;\r\n _Spriteset_Map_createCharacters.call(this);\r\n for (let i = 0; i < this._characterSprites.length; i++) {\r\n const sprite = this._characterSprites[i];\r\n if (sprite._character instanceof Game_Event) {\r\n // 固定マップで初期配置されているイベント用\r\n sprite._spriteIndex = i;\r\n if (sprite._character.isREEvent()) {\r\n sprite._character.setSpritePrepared(true);\r\n }\r\n }\r\n }\r\n};\r\nvar _Spriteset_Map_update = Spriteset_Map.prototype.update;\r\nSpriteset_Map.prototype.update = function () {\r\n this.updateREPrefabEvent();\r\n _Spriteset_Map_update.call(this);\r\n};\r\nSpriteset_Map.prototype.updateREPrefabEvent = function () {\r\n $gameMap.getREPrefabEvents().forEach((event) => {\r\n if (!event.isRESpritePrepared()) {\r\n this.makeREPrefabEventSprite(event);\r\n }\r\n });\r\n /*\r\n for (var i = 0, n = this._characterSprites.length; i < n; i++) {\r\n const sprite = this._characterSprites[i];\r\n \r\n if (sprite.isRECharacterExtinct() && !sprite._character.isAnimationPlaying()) {\r\n this.removeREPrefabEventSprite(i--);\r\n n--;\r\n }\r\n }\r\n */\r\n // Visual と Sprite を関連付ける\r\n if (MRView_1.MRView.entityVisualSet) {\r\n for (const visual of MRView_1.MRView.entityVisualSet.entityVisuals()) {\r\n if (visual.rmmzSpriteIndex() < 0) {\r\n const spriteIndex = this._characterSprites.findIndex(s => (s._character instanceof Game_Event) && s._character.eventId() == visual.rmmzEventId());\r\n if (spriteIndex < 0) {\r\n console.log(this._characterSprites);\r\n console.log(\"visual\", visual);\r\n }\r\n (0, Common_1.assert)(spriteIndex >= 0);\r\n visual._setSpriteIndex(spriteIndex);\r\n }\r\n }\r\n /*\r\n this._characterSprites.forEach((sprite, index) => {\r\n if (REVisual.entityVisualSet && sprite._character.isREEvent()) {\r\n const event = (sprite._character as Game_Event);\r\n const visual = REVisual.entityVisualSet.findEntityVisualByRMMZEventId(event.eventId());\r\n visual?._setSpriteIndex(index);\r\n if (event instanceof Game_REPrefabEvent) {\r\n event.setSpritePrepared(true);\r\n }\r\n }\r\n });\r\n */\r\n }\r\n};\r\nSpriteset_Map.prototype.makeREPrefabEventSprite = function (event) {\r\n (0, Common_1.assert)(MRView_1.MRView.sequelFactory);\r\n event.setSpritePrepared(true);\r\n var sprite = new Sprite_Character(event);\r\n const spriteIndex = this._characterSprites.length;\r\n this._characterSprites.push(sprite);\r\n sprite._spriteIndex = spriteIndex;\r\n const t = this._tilemap;\r\n t.addChild(sprite);\r\n //console.log(\"makeREPrefabEventSprite this._characterSprites\", this._characterSprites.length);\r\n};\r\n/*\r\nSpriteset_Map.prototype.removeREPrefabEventSprite = function(index: number) {\r\n var sprite = this._characterSprites[index];\r\n this._characterSprites.splice(index, 1);\r\n sprite.endAllEffect();\r\n\r\n const t: any = this._tilemap;\r\n t.removeChild(sprite);\r\n};\r\n\r\n*/\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/rmmz/PrefabEvent.ts?"); /***/ }), /***/ "./ts/mr/rmmz/RMMZHelper.ts": /*!**********************************!*\ !*** ./ts/mr/rmmz/RMMZHelper.ts ***! \**********************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.RMMZHelper = void 0;\r\nconst MRDataManager_1 = __webpack_require__(/*! ts/mr/data/MRDataManager */ \"./ts/mr/data/MRDataManager.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst MRView_1 = __webpack_require__(/*! ts/mr/view/MRView */ \"./ts/mr/view/MRView.ts\");\r\nconst DScript_1 = __webpack_require__(/*! ../data/DScript */ \"./ts/mr/data/DScript.ts\");\r\nclass RMMZHelper {\r\n static isRESystemMap() {\r\n return MRDataManager_1.MRDataManager.isRESystemMap($gameMap.mapId());\r\n }\r\n static setRegionId(x, y, regionId) {\r\n //if ($dataMap.data) {\r\n // const width = $dataMap.width ?? 0;\r\n // const height = $dataMap.height ?? 0;\r\n // $dataMap.data[(5 * height + y) * width + x] = regionId;\r\n //}\r\n this.setRETileData(x, y, 5, regionId);\r\n }\r\n static setRETileData(x, y, z, value) {\r\n var _a, _b;\r\n if ($dataMap.data) {\r\n const width = (_a = $dataMap.width) !== null && _a !== void 0 ? _a : 0;\r\n const height = (_b = $dataMap.height) !== null && _b !== void 0 ? _b : 0;\r\n $dataMap.data[(z * height + y) * width + x] = value;\r\n }\r\n }\r\n static mapAutoTileId(dirBits) {\r\n const index = this._autoTileTable.findIndex(x => x == dirBits);\r\n if (index >= 0)\r\n return index;\r\n else\r\n return 0;\r\n }\r\n static syncCameraPositionToGamePlayer() {\r\n if ($gamePlayer.isTransferring())\r\n return;\r\n const entity = MRLively_1.MRLively.mapView.focusedEntity();\r\n if (entity && MRView_1.MRView.entityVisualSet) {\r\n const visual = MRView_1.MRView.entityVisualSet.findEntityVisualByEntity(entity);\r\n if (visual) {\r\n // [2021/11/22] 移動→ワープのように、内部で locate を伴いつつ Sequel が連続で呼び出されたとき、\r\n // この refresh が visual ではなく entity の座標を元に位置を再設定するため一瞬画面がズレる問題があった。\r\n // 今は不要かと判断できるが、経過を見つつ削除する。\r\n // if (REVisual._playerPosRefreshNeed) {\r\n // $gamePlayer.locate(entity.x, entity.y);\r\n // $gamePlayer.refresh();\r\n // REVisual._playerPosRefreshNeed = false;\r\n // return;\r\n // }\r\n const pos = visual.position();\r\n //console.log(\"this._realX\", this._realX - pos.x);\r\n const lastScrolledX = $gamePlayer.scrolledX();\r\n const lastScrolledY = $gamePlayer.scrolledY();\r\n $gamePlayer._realX = pos.x;\r\n $gamePlayer._realY = pos.y;\r\n $gamePlayer._x = Math.floor(pos.x); //entity.x;\r\n $gamePlayer._y = Math.floor(pos.y); //entity.y;\r\n //console.log(\"lastScrolledX\", pos.x, pos.y, lastScrolledX, lastScrolledY);\r\n //console.log(\"$gameMap\", $gameMap);\r\n $gamePlayer.updateScroll(lastScrolledX, lastScrolledY);\r\n //$gamePlayer.center($gamePlayer._x, $gamePlayer._y);\r\n }\r\n }\r\n }\r\n static triggerOnStartEvent() {\r\n for (const event of $gameMap.events()) {\r\n if (event._reEventData && event._reEventData.trigger && event._reEventData.trigger == \"onStart\") {\r\n //console.log(\"trigger is deprecated. use MRCommand-OnStart.\")\r\n //if (event.x == 0) {\r\n event.start();\r\n //}\r\n }\r\n if (event._MRFloorEventAnnotation) {\r\n MRLively_1.MRLively.scriptManager.callQuery(undefined, new DScript_1.DScript(event.list()), \"MRCommand-OnStart\");\r\n }\r\n // if (event._MREntityId) {\r\n // MRLively.scriptManager.callQuery(\r\n // MRLively.world.entity(event._MREntityId),\r\n // new DScript(event.list()),\r\n // \"MRCommand-OnStart\");\r\n // }\r\n }\r\n }\r\n static triggerOnKeeperLostEvent() {\r\n for (const event of $gameMap.events()) {\r\n if (event._reEventData && event._reEventData.trigger && event._reEventData.trigger == \"onKeeperLost\") {\r\n event.start();\r\n }\r\n }\r\n }\r\n static setVariable(pattern, value) {\r\n const id = parseInt(pattern);\r\n if (!isNaN(id)) {\r\n $gameVariables.setValue(id, value);\r\n }\r\n else {\r\n const index = $dataSystem.variables.findIndex(x => x && x == pattern);\r\n if (index >= 0) {\r\n $gameVariables.setValue(index, value);\r\n }\r\n else {\r\n throw new Error(`${pattern} not found.`);\r\n }\r\n }\r\n }\r\n}\r\nexports.RMMZHelper = RMMZHelper;\r\n// https://www.f-sp.com/category/RPG%E3%83%84%E3%82%AF%E3%83%BC%E3%83%AB?page=1480575168\r\n// 異種タイルが 1\r\nRMMZHelper._autoTileTable = [\r\n 0b000000000,\r\n 0b001000000,\r\n 0b100000000,\r\n 0b101000000,\r\n 0b000000100,\r\n 0b001000100,\r\n 0b100000100,\r\n 0b101000100,\r\n 0b000000001,\r\n 0b001000001,\r\n 0b100000001,\r\n 0b101000001,\r\n 0b000000101,\r\n 0b001000101,\r\n 0b100000101,\r\n 0b101000101,\r\n 0b001001001,\r\n 0b101001001,\r\n 0b001001101,\r\n 0b101001101,\r\n 0b111000000,\r\n 0b111000100,\r\n 0b111000001,\r\n 0b111000101,\r\n 0b100100100,\r\n 0b100100101,\r\n 0b101100100,\r\n 0b101100101,\r\n 0b000000111,\r\n 0b001000111,\r\n 0b100000111,\r\n 0b101000111,\r\n 0b101101101,\r\n 0b111000111,\r\n 0b111100100, // tileId: 0\r\n];\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/rmmz/RMMZHelper.ts?"); /***/ }), /***/ "./ts/mr/rmmz/RMMZIntegration.ts": /*!***************************************!*\ !*** ./ts/mr/rmmz/RMMZIntegration.ts ***! \***************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.RMMZIntegration = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ../data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst SIntegration_1 = __webpack_require__(/*! ../system/SIntegration */ \"./ts/mr/system/SIntegration.ts\");\r\nconst MRView_1 = __webpack_require__(/*! ../view/MRView */ \"./ts/mr/view/MRView.ts\");\r\nconst SRmmzHelpers_1 = __webpack_require__(/*! ts/mr/system/SRmmzHelpers */ \"./ts/mr/system/SRmmzHelpers.ts\");\r\nconst VMapEditor_1 = __webpack_require__(/*! ./VMapEditor */ \"./ts/mr/rmmz/VMapEditor.ts\");\r\nconst SEntityFactory_1 = __webpack_require__(/*! ts/mr/system/SEntityFactory */ \"./ts/mr/system/SEntityFactory.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst FloorRestartSequence_1 = __webpack_require__(/*! ./FloorRestartSequence */ \"./ts/mr/rmmz/FloorRestartSequence.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ../data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst LActorBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LActorBehavior */ \"./ts/mr/lively/behaviors/LActorBehavior.ts\");\r\nconst LEquipmentUserBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LEquipmentUserBehavior */ \"./ts/mr/lively/behaviors/LEquipmentUserBehavior.ts\");\r\nclass RMMZIntegration extends SIntegration_1.SIntegration {\r\n onEventPublished(eventId, args, handled) {\r\n }\r\n onReserveTransferMap(mapId, x, y, d) {\r\n $gamePlayer.reserveTransfer(mapId, x, y, d, 0);\r\n // マップ遷移後、同一マップへの遷移でも Game_Map.setup が実行されるようにする。Scene_Load の処理と同じ。\r\n $gamePlayer.requestMapReload();\r\n // 主に演出のため ExitMap への遷移時にプレイヤーの表示をOFFにする。\r\n // 対策しないと、ExitMap へ移動したときに一瞬プレイヤーが見えてしまう。\r\n if (MRData_1.MRData.maps[mapId].exitMap) {\r\n $gamePlayer.setTransparent(true);\r\n }\r\n // この後のコアスクリプト側の流れ\r\n // - Scene_Map.prototype.updateTransferPlayer() にて、新しい Scene_Map が作成され Scene 遷移する。\r\n // \r\n }\r\n onEntityLocated(entity) {\r\n if (entity.entityId().equals(MRLively_1.MRLively.mapView.focusedEntityId())) {\r\n MRView_1.MRView._playerPosRefreshNeed = true;\r\n }\r\n // NOTE: ここでは Visual と Entity の座標を同期するようなことはしない。\r\n //\r\n // 一部の Motion (例えば、DropMotion) では登場位置から現在位置に向かって\r\n // 移動するようなモーションを組むことがあるが、そのような場合は\r\n // onEntityEnteredMap() 時点で設定された Visual の座標を登場位置として使い、\r\n // Motion 発生時の Entity の座標へ向かって移動させたい。\r\n //\r\n // ここで同期してしまうと、その登場位置が失われてしまう。\r\n // transferEntity 直後に Motion (例えば、DropMotion) を再生しようとすると、\r\n // StartPosition が locate 前のものになってしまうので、ここで visual の座標を同期する。\r\n // const visual = MRView.entityVisualSet?.findEntityVisualByEntity(entity);\r\n // if (visual) {\r\n // visual.setX(entity.mx);\r\n // visual.setY(entity.my);\r\n // }\r\n }\r\n onLocateRmmzEvent(eventId, x, y) {\r\n const rmmzEvent = $gameMap.event(eventId);\r\n rmmzEvent.locate(0, 0);\r\n }\r\n onLoadFixedMapData(map) {\r\n SRmmzHelpers_1.SRmmzHelpers.buildFixedMapData(map);\r\n }\r\n onLoadFixedMapEvents() {\r\n MRLively_1.MRLively.mapView.currentMap.keeperCount = 0;\r\n // 固定マップ上のイベント情報から Entity を作成する\r\n $gameMap.events().forEach((e) => {\r\n const spawner = SRmmzHelpers_1.SRmmzHelpers.readEntityMetadata(e, $gameMap.mapId());\r\n if (e && spawner) {\r\n if (spawner.troopId > 0) {\r\n SEntityFactory_1.SEntityFactory.spawnTroopAndMembers(MRLively_1.MRLively.mapView.currentMap, MRData_1.MRData.troops[spawner.troopId], e.x, e.y, spawner.stateIds);\r\n e.setTransparent(true);\r\n }\r\n else {\r\n const entity = SRmmzHelpers_1.SRmmzHelpers.createEntityFromRmmzEvent(spawner, e.eventId(), e.x, e.y);\r\n MRLively_1.MRLively.mapView.currentMap.uniqueSpawners[entity.dataId] = spawner;\r\n (0, Common_1.assert)(entity.data.prefabId > 0);\r\n if (entity.inhabitsCurrentFloor) {\r\n SRmmzHelpers_1.SRmmzHelpers.linkEntityAndEvent(entity, e);\r\n }\r\n else {\r\n e.setTransparent(true);\r\n }\r\n if (spawner.keeper) {\r\n entity.keeper = true;\r\n MRLively_1.MRLively.mapView.currentMap.keeperCount++;\r\n }\r\n }\r\n }\r\n });\r\n MRLively_1.MRLively.mapView.currentMap.lastKeeperCount = MRLively_1.MRLively.mapView.currentMap.keeperCount;\r\n }\r\n onGetFixedMapUnqueSpawners() {\r\n return SRmmzHelpers_1.SRmmzHelpers.getUnqueSpawners($gameMap);\r\n }\r\n onMapSetupCompleted(map) {\r\n // マップの初期化が完了したら、マップ上のイベントを非表示にする。\r\n for (const event of $gameMap.events()) {\r\n if (!event.isREEvent()) {\r\n event.setTransparent(true);\r\n }\r\n }\r\n }\r\n onUpdateBlock(block) {\r\n if (MRView_1.MRView.mapBuilder) {\r\n //const width = $dataMap.width;\r\n //const height = $dataMap.height;\r\n //$dataMap.data[(z * height + y) * width + x] = tileId;\r\n //REVisual.mapBuilder.setTileId\r\n //REVisual.mapBuilder.set\r\n MRView_1.MRView.mapBuilder.refreshBlock(block);\r\n if (MRView_1.MRView.spriteset) {\r\n MRView_1.MRView.spriteset._tilemap.refresh();\r\n }\r\n }\r\n }\r\n onRefreshGameMap(map) {\r\n MRView_1.MRView.mapBuilder = new VMapEditor_1.VMapEditor(map);\r\n MRView_1.MRView.mapBuilder.build();\r\n //const builder = new GameMapBuilder();\r\n //builder.build(map);\r\n }\r\n onFlushEffectResult(entity) {\r\n var _a;\r\n const visual = (_a = MRView_1.MRView.entityVisualSet) === null || _a === void 0 ? void 0 : _a.findEntityVisualByEntity(entity);\r\n if (visual) {\r\n visual.showEffectResult();\r\n }\r\n }\r\n onFlushSequelSet(sequelSet) {\r\n }\r\n onCheckVisualSequelRunning() {\r\n if (FloorRestartSequence_1.FloorRestartSequence.isProcessing()) {\r\n return true;\r\n }\r\n if (SceneManager.isCurrentSceneBusy()) {\r\n // マップ遷移などのフェード中\r\n return true;\r\n }\r\n if (MRView_1.MRView.entityVisualSet)\r\n return MRView_1.MRView.entityVisualSet.visualRunning();\r\n else\r\n return false;\r\n }\r\n onOpenDialog(model) {\r\n var _a;\r\n (_a = MRView_1.MRView.dialogManager) === null || _a === void 0 ? void 0 : _a.openDialog(model);\r\n }\r\n onUpdateDialog(context) {\r\n const manager = MRView_1.MRView.dialogManager;\r\n if (manager) {\r\n (0, Common_1.assert)(!manager.dialogNavigator.isEmpty);\r\n manager.dialogNavigator.update(context);\r\n }\r\n }\r\n onDialogClosed(context, dialog) {\r\n const manager = MRView_1.MRView.dialogManager;\r\n if (manager) {\r\n manager.dialogNavigator.closeDialog(context, dialog);\r\n }\r\n }\r\n onCurrentMapChanged() {\r\n }\r\n onEntityEnteredMap(entity) {\r\n if (MRView_1.MRView.entityVisualSet) {\r\n MRView_1.MRView.entityVisualSet.createVisual2(entity);\r\n }\r\n else {\r\n // フロア遷移直後は、初期配置処理時点ではまだ Visual(SpriteSet) の準備ができていないことがある。\r\n // この時点では Visual や Sprite は作られないが、VisualSet を new したときに、その時点の map 上の Entity を元に全部作られる。\r\n // これは RMMZ の仕様。Game_Map や Scene_Map の処理はデフォルトでもかなり複雑なので、\r\n // MRシステムの都合でさらに複雑にするのは避けたいところ。なので Visual 側から見ると少し歪かもしれないが、頑張って RMMZ に合わせる。\r\n }\r\n }\r\n onEntityLeavedMap(entity) {\r\n var _a;\r\n (_a = MRView_1.MRView.entityVisualSet) === null || _a === void 0 ? void 0 : _a.reserveDeleteVisual(entity);\r\n // Entity と RMMZ-Event の関連付けを解除\r\n entity.inhabitsCurrentFloor = false;\r\n SRmmzHelpers_1.SRmmzHelpers.unlinkEntityAndEvent(entity);\r\n if (entity.keeper) {\r\n entity.keeper = false;\r\n MRLively_1.MRLively.mapView.currentMap.keeperCount--;\r\n }\r\n }\r\n onEntityReEnterMap(entity) {\r\n // this.onEntityLeavedMap(entity);\r\n // this.onEntityEnteredMap(entity);\r\n }\r\n onSetLandExitResult(result) {\r\n $gameVariables.setValue(MRBasics_1.MRBasics.variables.landExitResultDetail, result);\r\n $gameVariables.setValue(MRBasics_1.MRBasics.variables.landExitResult, Math.floor(result / 100));\r\n }\r\n onEquipmentChanged(entity) {\r\n const actor = entity.findEntityBehavior(LActorBehavior_1.LActorBehavior);\r\n const equipmentUser = entity.findEntityBehavior(LEquipmentUserBehavior_1.LEquipmentUserBehavior);\r\n if (actor && equipmentUser) {\r\n const rmmzActor = $gameActors.actor(actor.rmmzActorId);\r\n (0, Common_1.assert)(rmmzActor);\r\n const items = equipmentUser.equippedItemEntities();\r\n rmmzActor._equips = [];\r\n for (let i = 0; i < items.length; i++) {\r\n const itemData = items[i].data.item();\r\n rmmzActor._equips[i] = new Game_Item();\r\n if (itemData.rmmzWeaponId > 0) {\r\n rmmzActor._equips[i].setEquip(true, itemData.rmmzWeaponId);\r\n }\r\n else {\r\n rmmzActor._equips[i].setEquip(false, itemData.rmmzArmorId);\r\n }\r\n }\r\n rmmzActor.refresh();\r\n }\r\n }\r\n onStartEventScript(script) {\r\n $gameSystem.getMREventScriptRunnerManager().start(script);\r\n }\r\n}\r\nexports.RMMZIntegration = RMMZIntegration;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/rmmz/RMMZIntegration.ts?"); /***/ }), /***/ "./ts/mr/rmmz/Scene_Boot.ts": /*!**********************************!*\ !*** ./ts/mr/rmmz/Scene_Boot.ts ***! \**********************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nconst MRDataManager_1 = __webpack_require__(/*! ../data/MRDataManager */ \"./ts/mr/data/MRDataManager.ts\");\r\nconst RMMZIntegration_1 = __webpack_require__(/*! ./RMMZIntegration */ \"./ts/mr/rmmz/RMMZIntegration.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ../system/MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst MRView_1 = __webpack_require__(/*! ../view/MRView */ \"./ts/mr/view/MRView.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst SBehaviorFactory_1 = __webpack_require__(/*! ../system/SBehaviorFactory */ \"./ts/mr/system/SBehaviorFactory.ts\");\r\n/*\r\nimport { ImGuiIO } from \"../imgui-js/imgui\";\r\nimport * as ImGui from \"../imgui-js/imgui\";\r\nimport * as ImGui_Impl from \"./imgui/imgui_impl\";\r\n\r\nlet font: ImGui.ImFont | null = null;\r\n\r\nasync function LoadArrayBuffer(url: string): Promise {\r\n const response: Response = await fetch(url);\r\n return response.arrayBuffer();\r\n}\r\n\r\nasync function AddFontFromFileTTF(url: string, size_pixels: number, font_cfg: ImGui.ImFontConfig | null = null, glyph_ranges: number | null = null): Promise {\r\n font_cfg = font_cfg || new ImGui.ImFontConfig();\r\n font_cfg.Name = font_cfg.Name || `${url.split(/[\\\\\\/]/).pop()}, ${size_pixels.toFixed(0)}px`;\r\n return ImGui.GetIO().Fonts.AddFontFromMemoryTTF(await LoadArrayBuffer(url), size_pixels, font_cfg, glyph_ranges);\r\n}\r\n\r\nasync function _init(): Promise {\r\n console.log(\"Total allocated space (uordblks) @ _init:\", ImGui.bind.mallinfo().uordblks);\r\n\r\n // Setup Dear ImGui binding\r\n ImGui.IMGUI_CHECKVERSION();\r\n ImGui.CreateContext();\r\n\r\n const io: ImGuiIO = ImGui.GetIO();\r\n // io.ConfigFlags |= ImGui.ConfigFlags.NavEnableKeyboard; // Enable Keyboard Controls\r\n\r\n // Setup style\r\n ImGui.StyleColorsDark();\r\n //ImGui.StyleColorsClassic();\r\n\r\n // Load Fonts\r\n // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.\r\n // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.\r\n // - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit).\r\n // - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call.\r\n // - Read 'misc/fonts/README.txt' for more instructions and details.\r\n // - Remember that in C/C++ if you want to include a backslash \\ in a string literal you need to write a double backslash \\\\ !\r\n io.Fonts.AddFontDefault();\r\n font = await AddFontFromFileTTF(\"../imgui/misc/fonts/Roboto-Medium.ttf\", 16.0);\r\n // font = await AddFontFromFileTTF(\"../imgui/misc/fonts/Cousine-Regular.ttf\", 15.0);\r\n // font = await AddFontFromFileTTF(\"../imgui/misc/fonts/DroidSans.ttf\", 16.0);\r\n // font = await AddFontFromFileTTF(\"../imgui/misc/fonts/ProggyTiny.ttf\", 10.0);\r\n // font = await AddFontFromFileTTF(\"c:\\\\Windows\\\\Fonts\\\\ArialUni.ttf\", 18.0, null, io.Fonts.GetGlyphRangesJapanese());\r\n // font = await AddFontFromFileTTF(\"https://raw.githubusercontent.com/googlei18n/noto-cjk/master/NotoSansJP-Regular.otf\", 18.0, null, io.Fonts.GetGlyphRangesJapanese());\r\n ImGui.IM_ASSERT(font !== null);\r\n\r\n if (typeof(window) !== \"undefined\") {\r\n const output: HTMLElement = document.getElementById(\"output\") || document.body;\r\n const canvas: HTMLCanvasElement = document.createElement(\"canvas\");\r\n output.appendChild(canvas);\r\n canvas.tabIndex = 1;\r\n canvas.style.position = \"absolute\";\r\n canvas.style.left = \"0px\";\r\n canvas.style.right = \"0px\";\r\n canvas.style.top = \"0px\";\r\n canvas.style.bottom = \"0px\";\r\n canvas.style.width = \"100%\";\r\n canvas.style.height = \"100%\";\r\n ImGui_Impl.Init(canvas);\r\n } else {\r\n ImGui_Impl.Init(null);\r\n }\r\n\r\n //StartUpImage();\r\n //StartUpVideo();\r\n\r\n //if (typeof(window) !== \"undefined\") {\r\n // window.requestAnimationFrame(_loop);\r\n //}\r\n}\r\n*/\r\nconst _Scene_Boot_isReady = Scene_Boot.prototype.isReady;\r\nScene_Boot.prototype.isReady = function () {\r\n // ベースの isReady の中から onDatabaseLoaded が呼び出される\r\n const result = _Scene_Boot_isReady.call(this);\r\n if (!MRDataManager_1.MRDataManager.isImportCompleted()) {\r\n return false;\r\n }\r\n else {\r\n MRData_1.MRData.verify();\r\n // Database マップの読み込みが完了\r\n return result;\r\n }\r\n};\r\nconst _Scene_Boot_onDatabaseLoaded = Scene_Boot.prototype.onDatabaseLoaded;\r\nScene_Boot.prototype.onDatabaseLoaded = function () {\r\n _Scene_Boot_onDatabaseLoaded.call(this);\r\n MRDataManager_1.MRDataManager.load();\r\n SBehaviorFactory_1.SBehaviorManager.initialize();\r\n MRView_1.MRView.initialize();\r\n MRSystem_1.MRSystem.integration = new RMMZIntegration_1.RMMZIntegration();\r\n};\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/rmmz/Scene_Boot.ts?"); /***/ }), /***/ "./ts/mr/rmmz/Scene_Load.ts": /*!**********************************!*\ !*** ./ts/mr/rmmz/Scene_Load.ts ***! \**********************************/ /***/ (() => { "use strict"; eval("\r\nconst _Scene_Load_onLoadSuccess = Scene_Load.prototype.onLoadSuccess;\r\nScene_Load.prototype.onLoadSuccess = function () {\r\n _Scene_Load_onLoadSuccess.call(this);\r\n};\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/rmmz/Scene_Load.ts?"); /***/ }), /***/ "./ts/mr/rmmz/Scene_MRQuest.ts": /*!*************************************!*\ !*** ./ts/mr/rmmz/Scene_MRQuest.ts ***! \*************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Scene_MRQuest = void 0;\r\nconst VQuestClassWindow_1 = __webpack_require__(/*! ../view/window/windows/VQuestClassWindow */ \"./ts/mr/view/window/windows/VQuestClassWindow.ts\");\r\nconst VUIElement_1 = __webpack_require__(/*! ../view/ui/VUIElement */ \"./ts/mr/view/ui/VUIElement.ts\");\r\nconst VQuestListWindow_1 = __webpack_require__(/*! ../view/window/windows/VQuestListWindow */ \"./ts/mr/view/window/windows/VQuestListWindow.ts\");\r\nclass Scene_MRQuest extends Scene_MenuBase {\r\n create() {\r\n super.create();\r\n this.createQuestClassWindow();\r\n this.createQuestListWindow();\r\n this.createQuestDetailsWindow();\r\n this._questClassWindow.activate();\r\n }\r\n createQuestClassWindow() {\r\n const window = new VQuestClassWindow_1.VQuestClassWindow(VUIElement_1.VLayout.makeGridRect(0, 0, 4, 2)); //new Rectangle(0, 0, 200, VWindowHelper.calcWindowHeight(1, true)));\r\n this.addWindow(window);\r\n this._questClassWindow = window;\r\n }\r\n createQuestListWindow() {\r\n const window = new VQuestListWindow_1.VQuestListWindow(VUIElement_1.VLayout.makeGridRect(0, 2, 4, 10));\r\n this.addWindow(window);\r\n this._questListWindow = window;\r\n }\r\n createQuestDetailsWindow() {\r\n }\r\n}\r\nexports.Scene_MRQuest = Scene_MRQuest;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/rmmz/Scene_MRQuest.ts?"); /***/ }), /***/ "./ts/mr/rmmz/Scene_Map.ts": /*!*********************************!*\ !*** ./ts/mr/rmmz/Scene_Map.ts ***! \*********************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ../system/MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst VEntityManager_1 = __webpack_require__(/*! ../view/VEntityManager */ \"./ts/mr/view/VEntityManager.ts\");\r\nconst MRView_1 = __webpack_require__(/*! ../view/MRView */ \"./ts/mr/view/MRView.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst RMMZHelper_1 = __webpack_require__(/*! ./RMMZHelper */ \"./ts/mr/rmmz/RMMZHelper.ts\");\r\nconst SMainMenuDialog_1 = __webpack_require__(/*! ts/mr/system/dialogs/SMainMenuDialog */ \"./ts/mr/system/dialogs/SMainMenuDialog.ts\");\r\nconst FloorRestartSequence_1 = __webpack_require__(/*! ./FloorRestartSequence */ \"./ts/mr/rmmz/FloorRestartSequence.ts\");\r\nconst STransferMapDialog_1 = __webpack_require__(/*! ../system/dialogs/STransferMapDialog */ \"./ts/mr/system/dialogs/STransferMapDialog.ts\");\r\nconst _Scene_Map_isReady = Scene_Map.prototype.isReady;\r\nScene_Map.prototype.isReady = function () {\r\n return _Scene_Map_isReady.call(this);\r\n};\r\nconst _Scene_Map_onMapLoaded = Scene_Map.prototype.onMapLoaded;\r\nScene_Map.prototype.onMapLoaded = function () {\r\n _Scene_Map_onMapLoaded.call(this);\r\n};\r\n// 遷移後、フェードイン開始前\r\nconst _Scene_Map_onTransferEnd = Scene_Map.prototype.onTransferEnd;\r\nScene_Map.prototype.onTransferEnd = function () {\r\n var _a;\r\n _Scene_Map_onTransferEnd.call(this);\r\n (_a = MRView_1.MRView._messageWindowSet) === null || _a === void 0 ? void 0 : _a.attemptStartDisplayFloorName();\r\n};\r\n// マップ切り替えのたびに呼び出される。\r\n// Scene_Map.updateTransferPlayer() でマップ遷移を検出すると、\r\n// goto(Scene_Map) で別インスタンスの Scene_Map へ遷移する。\r\nconst _Scene_Map_create = Scene_Map.prototype.create;\r\nScene_Map.prototype.create = function () {\r\n _Scene_Map_create.call(this);\r\n};\r\nconst _Scene_Map_createDisplayObjects = Scene_Map.prototype.createDisplayObjects;\r\nScene_Map.prototype.createDisplayObjects = function () {\r\n // refresh はホントは onMapLoaded のフック内で呼ぶのが自然な気がするが、\r\n // createDisplayObjects() の前に呼んでおきたい。\r\n // そうしないと、特にランダムダンジョン内にいるときのセーブデータをロードした後、Tilemap 生成とのタイミングの問題で何も表示されなくなる。\r\n if (MRLively_1.MRLively.mapView.currentMap.floorId().isTacticsMap2) {\r\n MRSystem_1.MRSystem.mapManager.attemptRefreshVisual();\r\n }\r\n // ベースの createDisplayObjects() では update() が一度呼ばれるため、先にインスタンスを作っておく\r\n (0, Common_1.assert)(!MRView_1.MRView.entityVisualSet);\r\n MRView_1.MRView.entityVisualSet = new VEntityManager_1.VEntityManager();\r\n _Scene_Map_createDisplayObjects.call(this);\r\n // REVisual の中で Window を作りたいが、ベースの createWindowLayer() を先に実行しておく必要がある。\r\n // その後 createWindows() を呼び出す。\r\n MRView_1.MRView.onSceneChanged(this);\r\n};\r\nconst _Scene_Map_start = Scene_Map.prototype.start;\r\nScene_Map.prototype.start = function () {\r\n _Scene_Map_start.call(this);\r\n};\r\nconst _Scene_Map_terminate = Scene_Map.prototype.terminate;\r\nScene_Map.prototype.terminate = function () {\r\n _Scene_Map_terminate.call(this);\r\n if (MRView_1.MRView.entityVisualSet) {\r\n MRView_1.MRView.entityVisualSet.ternimate();\r\n MRView_1.MRView.entityVisualSet = undefined;\r\n }\r\n if (MRView_1.MRView.spriteSet2) {\r\n //REVisual.spriteSet2.destroy();\r\n MRView_1.MRView.spriteSet2 = undefined;\r\n }\r\n};\r\nfunction isTransterEffectRunning() {\r\n if (MRView_1.MRView._messageWindowSet) {\r\n return MRView_1.MRView._messageWindowSet._floorNameWindow.isEffectRunning();\r\n }\r\n else {\r\n return false;\r\n }\r\n}\r\nconst _Scene_Map_update = Scene_Map.prototype.update;\r\nScene_Map.prototype.update = function () {\r\n $gameSystem.getMREventScriptRunnerManager().update();\r\n FloorRestartSequence_1.FloorRestartSequence.update(this);\r\n if (!isTransterEffectRunning()) {\r\n if (MRLively_1.MRLively.mapView.currentMap.floorId().isTacticsMap2) {\r\n if (!$gameMap.isEventRunning()) { // イベント実行中はシミュレーションを行わない\r\n if (STransferMapDialog_1.STransferMapDialog.isFloorTransfering) {\r\n // マップ遷移中はコアシステムとしては何もしない。\r\n // performFloorTransfer() すること。\r\n //return;\r\n }\r\n else {\r\n MRSystem_1.MRSystem.scheduler.stepSimulation();\r\n }\r\n }\r\n MRSystem_1.MRSystem.minimapData.update();\r\n }\r\n else {\r\n // 普通のマップの時は、Command 実行用の Scheduler をずっと動かしておく\r\n MRLively_1.MRLively.immediatelyCommandExecuteScheduler.stepSimulation();\r\n }\r\n }\r\n else {\r\n }\r\n MRView_1.MRView.update();\r\n // Entity と Game_Player の位置を合わせるときは、↑で先に REVisual の座標を更新した後、\r\n // Scene_Map.update の前に同期をかける必要がある。\r\n // 位置合わせは Game_Player だけではなく Game_Map や Game_Screen など様々なオブジェクトに対しても影響するため、\r\n // ここでまず Game_Player を調整した後、残りはコアスクリプトに任せる。\r\n // (ただし _realX などが中途半端だと座標移動がかかえるので、REMap 上ではすべての Character の update を切っている)\r\n if (MRLively_1.MRLively.mapView.currentMap.floorId().isTacticsMap2) {\r\n if (MRView_1.MRView._syncCamera) {\r\n RMMZHelper_1.RMMZHelper.syncCameraPositionToGamePlayer();\r\n }\r\n }\r\n _Scene_Map_update.call(this);\r\n};\r\nconst _Scene_Map_callMenu = Scene_Map.prototype.callMenu;\r\nScene_Map.prototype.callMenu = function () {\r\n if (MRLively_1.MRLively.mapView.currentMap.floorId().isRMMZDefaultSystemMap2) {\r\n // 通常の RMMZ マップ & システム\r\n _Scene_Map_callMenu.call(this);\r\n }\r\n else {\r\n // セーフティマップ。ManualActionDialog は無いので、ここから MainMenu を表示する。\r\n (0, Common_1.assert)(MRSystem_1.MRSystem.dialogContext.dialogs().length == 0);\r\n const actorEntity = MRLively_1.MRLively.mapView.focusedEntity();\r\n (0, Common_1.assert)(actorEntity);\r\n MRSystem_1.MRSystem.commandContext.openDialog(actorEntity, new SMainMenuDialog_1.SMainMenuDialog(actorEntity), false);\r\n this.menuCalling = false;\r\n }\r\n};\r\nconst _Scene_Map_updateCallMenu = Scene_Map.prototype.updateCallMenu;\r\nScene_Map.prototype.updateCallMenu = function () {\r\n if (MRLively_1.MRLively.mapView.currentMap.floorId().isRMMZDefaultSystemMap2) {\r\n // 通常の RMMZ マップ & システム\r\n _Scene_Map_updateCallMenu.call(this);\r\n }\r\n else if (MRLively_1.MRLively.mapView.currentMap.floorId().isTacticsMap2) {\r\n // タクティクスマップ。MainMenu の表示は ManualActionDialog から行う。\r\n // Scene_Map からのメニュー表示は行わない。\r\n this.menuCalling = false;\r\n }\r\n else {\r\n // セーフティマップ。ManualActionDialog は無いので、ここから MainMenu を表示する。\r\n if (MRSystem_1.MRSystem.dialogContext.dialogs().length == 0) {\r\n _Scene_Map_updateCallMenu.call(this);\r\n }\r\n }\r\n};\r\nconst _Scene_Map_shouldAutosave = Scene_Map.prototype.shouldAutosave;\r\nScene_Map.prototype.shouldAutosave = function () {\r\n if (MRLively_1.MRLively.mapView.currentMap.floorId().isTacticsMap2) {\r\n return true;\r\n }\r\n else {\r\n return _Scene_Map_shouldAutosave.call(this);\r\n }\r\n};\r\nconst _Scene_Map_isAutosaveEnabled = Scene_Map.prototype.isAutosaveEnabled;\r\nScene_Base.prototype.isAutosaveEnabled = function () {\r\n if (MRLively_1.MRLively.mapView.currentMap.floorId().isTacticsMap2) {\r\n return true;\r\n }\r\n else {\r\n return _Scene_Map_isAutosaveEnabled.call(this);\r\n }\r\n};\r\nconst _Scene_Map_fadeOutForTransfer = Scene_Map.prototype.fadeOutForTransfer;\r\nScene_Map.prototype.fadeOutForTransfer = function () {\r\n if (FloorRestartSequence_1.FloorRestartSequence.isProcessing()) {\r\n // Scene_Map.stop() で再びフェードアウトが開始してしまうのを避ける\r\n }\r\n else {\r\n _Scene_Map_fadeOutForTransfer.call(this);\r\n }\r\n};\r\nconst _Scene_Map_needsFadeIn = Scene_Map.prototype.needsFadeIn;\r\nScene_Map.prototype.needsFadeIn = function () {\r\n if (FloorRestartSequence_1.FloorRestartSequence.isProcessing()) {\r\n return true;\r\n }\r\n else {\r\n return _Scene_Map_needsFadeIn.call(this);\r\n }\r\n};\r\n// const _Scene_Map_isMapTouchOk = Scene_Map.prototype.isMapTouchOk;\r\n// Scene_Map.prototype.isMapTouchOk = function() {\r\n// if (MRLively.mapView.currentMap.floorId().isTacticsMap2) {\r\n// }\r\n// else {\r\n// }\r\n// }\r\n// const _Scene_Map_onMapTouch = Scene_Map.prototype.onMapTouch;\r\n// Scene_Map.prototype.onMapTouch = function() {\r\n// console.log(\"onMapTouch\");\r\n// if (MRLively.mapView.currentMap.floorId().isTacticsMap2) {\r\n// const x = $gameMap.canvasToMapX(TouchInput.x);\r\n// const y = $gameMap.canvasToMapY(TouchInput.y);\r\n// console.log(\"onMapTouch: \" + x + \", \" + y);\r\n// }\r\n// else {\r\n// _Scene_Map_onMapTouch.call(this);\r\n// }\r\n// }\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/rmmz/Scene_Map.ts?"); /***/ }), /***/ "./ts/mr/rmmz/Scene_Save.ts": /*!**********************************!*\ !*** ./ts/mr/rmmz/Scene_Save.ts ***! \**********************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nconst MRLively_1 = __webpack_require__(/*! ../lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst _Scene_Save_executeSave = Scene_Save.prototype.executeSave;\r\nScene_Save.prototype.executeSave = function (savefileId) {\r\n _Scene_Save_executeSave.call(this, savefileId);\r\n MRLively_1.MRLively.recorder.setSavefileId(savefileId);\r\n};\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/rmmz/Scene_Save.ts?"); /***/ }), /***/ "./ts/mr/rmmz/Scene_Title.ts": /*!***********************************!*\ !*** ./ts/mr/rmmz/Scene_Title.ts ***! \***********************************/ /***/ (() => { "use strict"; eval("\r\nvar _Scene_Title_start = Scene_Title.prototype.start;\r\nScene_Title.prototype.start = function () {\r\n _Scene_Title_start.call(this);\r\n};\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/rmmz/Scene_Title.ts?"); /***/ }), /***/ "./ts/mr/rmmz/Sprite_Character.ts": /*!****************************************!*\ !*** ./ts/mr/rmmz/Sprite_Character.ts ***! \****************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nconst MRView_1 = __webpack_require__(/*! ts/mr/view/MRView */ \"./ts/mr/view/MRView.ts\");\r\nconst VCharacterSpriteSet_1 = __webpack_require__(/*! ts/mr/view/VCharacterSpriteSet */ \"./ts/mr/view/VCharacterSpriteSet.ts\");\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst Sprite_CharacterDamage_RE_1 = __webpack_require__(/*! ./Sprite_CharacterDamage_RE */ \"./ts/mr/rmmz/Sprite_CharacterDamage_RE.ts\");\r\nconst VIconSprite_1 = __webpack_require__(/*! ../view/sprites/VIconSprite */ \"./ts/mr/view/sprites/VIconSprite.ts\");\r\nconst dir8PatternYTable = [\r\n 0,\r\n 4, 0, 6,\r\n 1, 0, 2,\r\n 5, 3, 7,\r\n];\r\nconst dir4PatternYTable = [\r\n 0,\r\n 0, 0, 0,\r\n 1, 0, 2,\r\n 3, 3, 3,\r\n];\r\nSprite_Character.prototype.setStateIcons = function (icons) {\r\n this._stateIcons = icons;\r\n};\r\nconst _Sprite_Character_initMembers = Sprite_Character.prototype.initMembers;\r\nSprite_Character.prototype.initMembers = function () {\r\n _Sprite_Character_initMembers.call(this);\r\n this._stateIcons = [];\r\n this._stateIconSprite = new VIconSprite_1.VIconSprite();\r\n this._stateIconSprite.anchor.x = 0.5;\r\n this._stateIconSprite.anchor.y = 1;\r\n this._stateIconSprite.visible = false; // ちらつき回避\r\n this.addChild(this._stateIconSprite);\r\n this._MRQuestMarkerIcon = new VIconSprite_1.VIconSprite();\r\n this._MRQuestMarkerIcon.anchor.x = 0.5;\r\n this._MRQuestMarkerIcon.anchor.y = 1;\r\n this._MRQuestMarkerIcon.visible = false;\r\n this.addChild(this._MRQuestMarkerIcon);\r\n this._reRevision = 0;\r\n};\r\n// 8 方向パターン\r\nconst _Sprite_Character_characterPatternY = Sprite_Character.prototype.characterPatternY;\r\nSprite_Character.prototype.characterPatternY = function () {\r\n if (this._character.characterName().endsWith(\"-X\")) {\r\n return dir8PatternYTable[this._character.direction()];\r\n }\r\n else {\r\n return dir4PatternYTable[this._character.direction()];\r\n }\r\n};\r\nconst _Sprite_Character_update = Sprite_Character.prototype.update;\r\nSprite_Character.prototype.update = function () {\r\n _Sprite_Character_update.call(this);\r\n if (this._reRevision != this._character.reRevision()) {\r\n this._reRevision = this._character.reRevision();\r\n this._stateIcons = [];\r\n this._stateIconSprite.visible = false;\r\n }\r\n const visual = this.findVisual();\r\n if (visual) {\r\n if (!this._spriteSet) {\r\n this._spriteSet = new VCharacterSpriteSet_1.VCharacterSpriteSet(this.parent, this);\r\n }\r\n if (this._spriteSet) {\r\n this._spriteSet.update();\r\n }\r\n // Update state icon\r\n {\r\n if (this._stateIcons.length > 0) {\r\n this._stateIconSprite.setIcon(this._stateIcons[0]); // TODO: 複数\r\n this._stateIconSprite.y = this.bitmap ? -this.patternHeight() : 0; // bitmap が無いと Character の高さが取れないので\r\n this._stateIconSprite.visible = true;\r\n }\r\n else {\r\n this._stateIconSprite.visible = false;\r\n }\r\n }\r\n // Quest flag icon\r\n if (this._MRQuestMarkerIcon.visible) {\r\n this._MRQuestMarkerIcon.x = 10;\r\n this._MRQuestMarkerIcon.y = this.bitmap ? -(this.patternHeight() - 10) : 0;\r\n this._MRQuestMarkerIcon.scale.y = Math.sin(Graphics.frameCount / 30.0) * 0.1 + 0.9;\r\n }\r\n // 寿命管理が複雑なので、間違ったものを参照していないか検証しておく\r\n if (visual.rmmzSpriteIndex() != this._spriteIndex) {\r\n console.log(\"err\", this);\r\n }\r\n (0, Common_1.assert)(visual.rmmzSpriteIndex() == this._spriteIndex);\r\n }\r\n else {\r\n this._stateIconSprite.visible = false;\r\n this._MRQuestMarkerIcon.visible = false;\r\n }\r\n this.updateDamagePopup_RE();\r\n};\r\nSprite_Character.prototype.endAllEffect = function () {\r\n // TODO: https://raw.githubusercontent.com/triacontane/RPGMakerMV/master/EventReSpawn.js\r\n};\r\nSprite_Character.prototype.findVisual = function () {\r\n if (!MRView_1.MRView.entityVisualSet)\r\n return undefined;\r\n const event = this._character;\r\n if (event instanceof Game_Event) {\r\n const visual = MRView_1.MRView.entityVisualSet.findEntityVisualByRMMZEventId(event.eventId());\r\n return visual;\r\n }\r\n else {\r\n return undefined;\r\n }\r\n};\r\nSprite_Character.prototype.updateDamagePopup_RE = function () {\r\n this.attemtSetupDamagePopup_RE();\r\n if (this._damageSprites_RE && this._damageSprites_RE.length > 0) {\r\n for (var i = 0; i < this._damageSprites_RE.length; i++) {\r\n this._damageSprites_RE[i].update();\r\n }\r\n if (!this._damageSprites_RE[0].isPlaying()) {\r\n this.getPopupParent_RE().removeChild(this._damageSprites_RE[0]);\r\n this._damageSprites_RE.shift();\r\n }\r\n }\r\n // if (this._popupFlash) {\r\n // this.updateDamagePopupFlash();\r\n // }\r\n};\r\nSprite_Character.prototype.attemtSetupDamagePopup_RE = function () {\r\n if (!this._character.isDamagePopupRequested_RE())\r\n return;\r\n var sprite = new Sprite_CharacterDamage_RE_1.Sprite_CharacterDamage_RE();\r\n sprite.x = this.x + this.damageOffsetX_RE();\r\n sprite.y = this.y + this.damageOffsetY_RE();\r\n if (!sprite.z)\r\n sprite.z = 9;\r\n sprite.setupCharacter(this._character);\r\n if (!this._damageSprites_RE)\r\n this._damageSprites_RE = [];\r\n this._damageSprites_RE.push(sprite);\r\n this.getPopupParent_RE().addChild(sprite);\r\n //this._character.clearDamagePopup();\r\n // if (!sprite.isMiss() && !sprite.isRecover()) {\r\n // this.setupDamagePopupFlash();\r\n // }\r\n};\r\n// Sprite_Character.prototype.setupDamagePopupFlash_RE = function() {\r\n// var flashColor = $gameSystem.getPopupDamageFlash();\r\n// if (!flashColor) return;\r\n// this._popupFlash = flashColor.clone();\r\n// this._popupFlashSpeed = Math.floor(this._popupFlash[3] / 30);\r\n// this.updateDamagePopupFlash();\r\n// }\r\nSprite_Character.prototype.damageOffsetX_RE = function () {\r\n return 0;\r\n};\r\nSprite_Character.prototype.damageOffsetY_RE = function () {\r\n return 0;\r\n};\r\nSprite_Character.prototype.getPopupParent_RE = function () {\r\n return this.parent;\r\n //return paramOnTop ? this.parent.parent.parent : this.parent;\r\n};\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/rmmz/Sprite_Character.ts?"); /***/ }), /***/ "./ts/mr/rmmz/Sprite_CharacterDamage_RE.ts": /*!*************************************************!*\ !*** ./ts/mr/rmmz/Sprite_CharacterDamage_RE.ts ***! \*************************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Sprite_CharacterDamage_RE = void 0;\r\nclass Sprite_CharacterDamage_RE extends Sprite_Damage {\r\n setupCharacter(character) {\r\n var damageInfo = character.shiftDamageInfo_RE();\r\n // this._toneColor = [0, 0,0, 0];//$gameSystem.getPopupDamageTone();\r\n // this._mirror = damageInfo.mirror;\r\n // this._damageInfo = damageInfo;\r\n // this._digit = 0;\r\n // if (this.isMiss()) {\r\n // this.createMissForCharacter();\r\n // } else {\r\n this.createDigits(damageInfo.value);\r\n // }\r\n // if (damageInfo.critical) {\r\n // this.setupCriticalEffect();\r\n // }\r\n }\r\n updateChild(sprite) {\r\n sprite.y = -this.easeOutExpo(90 - this._duration, 0, 50, 90);\r\n /*\r\n sprite.dy += 0.5;\r\n sprite.ry += sprite.dy;\r\n if (sprite.ry >= 0) {\r\n sprite.ry = 0;\r\n sprite.dy *= -0.6;\r\n }\r\n sprite.y = Math.round(sprite.ry);\r\n sprite.setBlendColor(this._flashColor);\r\n */\r\n }\r\n easeOutExpo(t, b, c, d) {\r\n return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b;\r\n }\r\n}\r\nexports.Sprite_CharacterDamage_RE = Sprite_CharacterDamage_RE;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/rmmz/Sprite_CharacterDamage_RE.ts?"); /***/ }), /***/ "./ts/mr/rmmz/Spriteset_Base.ts": /*!**************************************!*\ !*** ./ts/mr/rmmz/Spriteset_Base.ts ***! \**************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nconst VFloatingAnimationSprite_1 = __webpack_require__(/*! ../view/sprites/VFloatingAnimationSprite */ \"./ts/mr/view/sprites/VFloatingAnimationSprite.ts\");\r\nSpriteset_Base.prototype.createMRFloatingAnimationSprite = function (animation, x, y) {\r\n const mv = this.isMVAnimation(animation);\r\n const sprite = new (mv ? Sprite_AnimationMV : Sprite_Animation)(undefined);\r\n const targetSprite = new VFloatingAnimationSprite_1.VFloatingAnimationTargetSprite(undefined);\r\n targetSprite.animationSprite = sprite;\r\n const targetSprites = [targetSprite];\r\n for (const s of targetSprites) {\r\n s.x = x;\r\n s.y = y;\r\n this._effectsContainer.addChild(s);\r\n }\r\n sprite.setup(targetSprites, animation, false, 0, null);\r\n sprite.targetObjects = []; // これには本来、 Game_Character または Game_Battler を格納する。でも FloatingAnimation は Game_Character に紐付かないので、空配列を自分で作っておく。\r\n this._effectsContainer.addChild(sprite);\r\n this._animationSprites.push(sprite);\r\n this._mrFloatingAnimationSprites.push(targetSprite);\r\n};\r\nconst _Spriteset_Base_initialize = Spriteset_Base.prototype.initialize;\r\nSpriteset_Base.prototype.initialize = function () {\r\n _Spriteset_Base_initialize.call(this);\r\n this._mrFloatingAnimationSprites = [];\r\n};\r\nconst _Spriteset_Base_removeAnimation = Spriteset_Base.prototype.removeAnimation;\r\nSpriteset_Base.prototype.removeAnimation = function (sprite) {\r\n _Spriteset_Base_removeAnimation.call(this, sprite);\r\n // Destroy VFloatingAnimationTargetSprite\r\n for (let i = this._mrFloatingAnimationSprites.length - 1; i >= 0; i--) {\r\n const targetSprite = this._mrFloatingAnimationSprites[i];\r\n if (targetSprite.animationSprite == sprite) {\r\n this._effectsContainer.removeChild(targetSprite);\r\n this._mrFloatingAnimationSprites.splice(i, 1);\r\n targetSprite.destroy();\r\n }\r\n }\r\n};\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/rmmz/Spriteset_Base.ts?"); /***/ }), /***/ "./ts/mr/rmmz/Spriteset_Map.ts": /*!*************************************!*\ !*** ./ts/mr/rmmz/Spriteset_Map.ts ***! \*************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nconst VSpriteSet_1 = __webpack_require__(/*! ts/mr/view/VSpriteSet */ \"./ts/mr/view/VSpriteSet.ts\");\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst MRView_1 = __webpack_require__(/*! ../view/MRView */ \"./ts/mr/view/MRView.ts\");\r\nconst RMMZHelper_1 = __webpack_require__(/*! ./RMMZHelper */ \"./ts/mr/rmmz/RMMZHelper.ts\");\r\nconst _Spriteset_Map_initialize = Spriteset_Map.prototype.initialize;\r\nSpriteset_Map.prototype.initialize = function () {\r\n (0, Common_1.assert)(!MRView_1.MRView.spriteSet2);\r\n _Spriteset_Map_initialize.call(this);\r\n};\r\nconst _Spriteset_Map_destroy = Spriteset_Map.prototype.destroy;\r\nSpriteset_Map.prototype.destroy = function (options) {\r\n _Spriteset_Map_destroy.call(this, options);\r\n};\r\nvar _Spriteset_Map_prototype_createLowerLayer = Spriteset_Map.prototype.createLowerLayer;\r\nSpriteset_Map.prototype.createLowerLayer = function () {\r\n _Spriteset_Map_prototype_createLowerLayer.call(this);\r\n};\r\nvar _Spriteset_Map_prototype_createPictures = Spriteset_Map.prototype.createPictures;\r\nSpriteset_Map.prototype.createPictures = function () {\r\n if (RMMZHelper_1.RMMZHelper.isRESystemMap()) {\r\n // VisibilityShadow はピクチャなどよりも先に描画したいので、Picture のレイヤーよりも先に作っておく\r\n MRView_1.MRView.spriteSet2 = new VSpriteSet_1.VSpriteSet(this);\r\n }\r\n else {\r\n MRView_1.MRView.spriteSet2 = undefined;\r\n }\r\n _Spriteset_Map_prototype_createPictures.call(this);\r\n};\r\nvar _Spriteset_Map_prototype_createCharacters = Spriteset_Map.prototype.createCharacters;\r\nSpriteset_Map.prototype.createCharacters = function () {\r\n _Spriteset_Map_prototype_createCharacters.call(this);\r\n MRView_1.MRView.spriteset = this;\r\n};\r\nvar _Spriteset_Map_prototype_updateTilemap = Spriteset_Map.prototype.updateTilemap;\r\nSpriteset_Map.prototype.updateTilemap = function () {\r\n var _a;\r\n _Spriteset_Map_prototype_updateTilemap.call(this);\r\n // SpriteSet、特に VisibilityShadow の更新は Tilemap のタイミングと合わせないと微妙に位置がずれたりする。\r\n (_a = MRView_1.MRView.spriteSet2) === null || _a === void 0 ? void 0 : _a.update();\r\n};\r\n/*\r\ndeclare global {\r\n interface Spriteset_Map {\r\n onSpawnMapSkillEffectEvent(event: Game_Event): void;\r\n onDespawnMapSkillEffectEvent(event: Game_Event): void;\r\n }\r\n}\r\n\r\n\r\n\r\nSpriteset_Map.prototype.onSpawnMapSkillEffectEvent = function(event: Game_Event) {\r\n let sprite = new Sprite_Character(event);\r\n this._characterSprites.push(sprite);\r\n this._tilemap.addChild(sprite);\r\n}\r\n\r\nSpriteset_Map.prototype.onDespawnMapSkillEffectEvent = function(despawndEvent: Game_Event) {\r\n assert(despawndEvent._eventIndex != undefined);\r\n for (let i = 0; i < this._characterSprites.length; i++) {\r\n let character = this._characterSprites[i]._character;\r\n let event = (character as Game_Event);\r\n if (event) {\r\n if (event._eventIndex != undefined) {\r\n if (event._eventIndex == despawndEvent._eventIndex) {\r\n this._tilemap.removeChild(this._characterSprites[i]);\r\n this._characterSprites.splice(i, 1);\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n}\r\n*/\r\n//--------------------------------------------------------------------------------\r\n// VisibilityShadow\r\nvar _Spriteset_Map_prototype_createUpperLayer = Spriteset_Map.prototype.createUpperLayer;\r\nSpriteset_Map.prototype.createUpperLayer = function () {\r\n _Spriteset_Map_prototype_createUpperLayer.call(this);\r\n};\r\nvar _Spriteset_Map_prototype_updateShadow = Spriteset_Map.prototype.updateShadow;\r\nSpriteset_Map.prototype.updateShadow = function () {\r\n _Spriteset_Map_prototype_updateShadow.call(this);\r\n};\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/rmmz/Spriteset_Map.ts?"); /***/ }), /***/ "./ts/mr/rmmz/StorageManager.ts": /*!**************************************!*\ !*** ./ts/mr/rmmz/StorageManager.ts ***! \**************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}));\r\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n});\r\nvar __importStar = (this && this.__importStar) || function (mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.RmmzStorageManager = void 0;\r\nconst fs = __importStar(__webpack_require__(/*! fs */ \"fs\"));\r\n// JS の StorageManager と名前衝突するので、再定義したもの\r\nclass RmmzStorageManager {\r\n static ensureSaveDirectory() {\r\n const path = this.fileDirectoryPath();\r\n if (!fs.existsSync(path)) {\r\n fs.mkdirSync(path);\r\n }\r\n }\r\n static fileDirectoryPath() {\r\n //assert(process.mainModule);\r\n const path = __webpack_require__(/*! path */ \"path\");\r\n const base = process.cwd(); //path.dirname(process.mainModule.filename);\r\n return path.join(base, \"save/\");\r\n }\r\n ;\r\n}\r\nexports.RmmzStorageManager = RmmzStorageManager;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/rmmz/StorageManager.ts?"); /***/ }), /***/ "./ts/mr/rmmz/Tilemap.ts": /*!*******************************!*\ !*** ./ts/mr/rmmz/Tilemap.ts ***! \*******************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.TilemapRendererId = void 0;\r\nconst FMapData_1 = __webpack_require__(/*! ts/mr/floorgen/FMapData */ \"./ts/mr/floorgen/FMapData.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst MRView_1 = __webpack_require__(/*! ts/mr/view/MRView */ \"./ts/mr/view/MRView.ts\");\r\nvar TilemapRendererId;\r\n(function (TilemapRendererId) {\r\n TilemapRendererId[TilemapRendererId[\"Default\"] = 0] = \"Default\";\r\n TilemapRendererId[TilemapRendererId[\"Minimap\"] = 2] = \"Minimap\";\r\n TilemapRendererId[TilemapRendererId[\"Shadow\"] = 3] = \"Shadow\";\r\n})(TilemapRendererId = exports.TilemapRendererId || (exports.TilemapRendererId = {}));\r\nconst show = false;\r\nconst showAutotileShapeId = false;\r\nconst startTileId = 768;\r\n// 壁と隣接している床オートタイル用のテーブル\r\nconst FLOOR_AUTOTILE_TABLE2 = [\r\n [[2, 4], [1, 4], [2, 3], [1, 3]],\r\n [[2, 0], [1, 4], [2, 3], [1, 3]],\r\n [[2, 4], [3, 0], [2, 3], [1, 3]],\r\n [[2, 0], [3, 0], [2, 3], [1, 3]],\r\n [[2, 4], [1, 4], [2, 3], [3, 1]],\r\n [[2, 0], [1, 4], [2, 3], [3, 1]],\r\n [[2, 4], [3, 0], [2, 3], [3, 1]],\r\n [[2, 0], [3, 0], [2, 3], [3, 1]],\r\n [[2, 4], [1, 4], [2, 1], [1, 3]],\r\n [[2, 0], [1, 4], [2, 1], [1, 3]],\r\n [[2, 4], [3, 0], [2, 1], [1, 3]],\r\n [[2, 0], [3, 0], [2, 1], [1, 3]],\r\n [[2, 4], [1, 4], [2, 1], [3, 1]],\r\n [[2, 0], [1, 4], [2, 1], [3, 1]],\r\n [[2, 4], [3, 0], [2, 1], [3, 1]],\r\n [[2, 0], [3, 0], [2, 1], [3, 1]],\r\n [[1 /*0*/, 4], [1, 4], [0, 3], [1, 3]],\r\n [[0, 4], [3, 0], [0, 3], [1, 3]],\r\n [[0, 4], [1, 4], [0, 3], [3, 1]],\r\n [[0, 4], [3, 0], [0, 3], [3, 1]],\r\n [[2, 2], [1, 2], [2, 3], [1, 3]],\r\n [[2, 2], [1, 2], [2, 3], [3, 1]],\r\n [[2, 2], [1, 2], [2, 1], [1, 3]],\r\n [[2, 2], [1, 2], [2, 1], [3, 1]],\r\n [[2, 4], [3, 4], [2, 3], [3, 3]],\r\n [[2, 4], [3, 4], [2, 1], [3, 3]],\r\n [[2, 0], [3, 4], [2, 3], [3, 3]],\r\n [[2, 0], [3, 4], [2, 1], [3, 3]],\r\n [[2, 4], [1, 4], [2, 4 /*5*/], [1, 4 /*5*/]],\r\n [[2, 0], [1, 4], [2, 5], [1, 5]],\r\n [[2, 4], [3, 0], [2, 5], [1, 5]],\r\n [[2, 0], [3, 0], [2, 5], [1, 5]],\r\n [[0, 4], [3, 4], [0, 3], [3, 3]],\r\n [[2, 2], [1, 2], [2, 5], [1, 5]],\r\n [[0, 2], [1, 2], [0, 3], [1, 3]],\r\n [[0, 2], [1, 2], [0, 3], [3, 1]],\r\n [[2, 2], [2, 2], [2, 3], [3, 3]],\r\n [[2, 2], [3, 2], [2, 1], [3, 3]],\r\n [[2, 4], [3, 4], [2, 5], [3, 5]],\r\n [[2, 0], [3, 4], [2, 5], [3, 5]],\r\n [[0, 4], [1, 4], [0, 4], [1, 4]],\r\n [[0, 4], [3, 0], [0, 5], [1, 5]],\r\n [[0, 2], [3, 2], [0, 3], [3, 3]],\r\n [[0, 2], [1, 2], [0, 5], [1, 5]],\r\n [[0, 4], [3, 4], [0, 5], [3, 5]],\r\n [[2, 2], [3, 2], [2, 5], [3, 5]],\r\n [[0, 2], [3, 2], [0, 5], [3, 5]],\r\n [[0, 0], [1, 0], [0, 1], [1, 1]]\r\n];\r\n// 床と隣接している壁オートタイル用のテーブル\r\nconst WALL_AUTOTILE_TABLE2 = [\r\n [[2, 2], [1, 2], [2, 1], [1, 1]],\r\n [[0, 2], [1, 2], [0, 1], [1, 1]],\r\n [[2, 0], [1, 0], [2, 1], [1, 1]],\r\n [[0, 0], [1, 0], [0, 1], [1, 1]],\r\n [[2, 2], [3, 2], [2, 1], [3, 1]],\r\n [[0, 2], [3, 2], [0, 1], [3, 1]],\r\n [[2, 0], [3, 0], [2, 1], [3, 1]],\r\n [[0, 0], [3, 0], [0, 1], [3, 1]],\r\n [[2, 2], [1, 2], [2, 3], [1, 3]],\r\n [[0, 2], [1, 2], [0, 3], [1, 3]],\r\n [[2, 0], [1, 0], [2, 3], [1, 3]],\r\n [[1, 0], [1, 0], [0, 3], [1, 3]],\r\n [[2, 2], [3, 2], [2, 3], [3, 3]],\r\n [[0, 2], [3, 2], [0, 3], [3, 3]],\r\n [[2, 0], [3, 0], [2, 3], [3, 3]],\r\n [[0, 0], [3, 0], [0, 3], [3, 3]]\r\n];\r\nfunction isTileA4Floor(tileId) {\r\n const kind = Tilemap.getAutotileKind(tileId);\r\n if (80 <= kind && kind <= 87)\r\n return true;\r\n if (96 <= kind && kind <= 103)\r\n return true;\r\n if (112 <= kind && kind <= 119)\r\n return true;\r\n return false;\r\n}\r\nfunction isTileA4Wall(tileId) {\r\n const kind = Tilemap.getAutotileKind(tileId);\r\n if (88 <= kind && kind <= 95)\r\n return true;\r\n if (104 <= kind && kind <= 111)\r\n return true;\r\n if (120 <= kind && kind <= 127)\r\n return true;\r\n return false;\r\n}\r\nconst _Tilemap__addSpot = Tilemap.prototype._addSpot;\r\nTilemap.prototype._addSpot = function (startX, startY, x, y) {\r\n _Tilemap__addSpot.call(this, startX, startY, x, y);\r\n const mx = startX + x;\r\n const my = startY + y;\r\n const dx = x * this.tileWidth;\r\n const dy = y * this.tileHeight;\r\n const tileId5 = this._readMapData(mx, my, 5); // region\r\n const tileId0 = this._readMapData(mx, my, 0);\r\n const tileId1 = this._readMapData(mx, my, 1);\r\n const tileId2 = this._readMapData(mx, my, 2);\r\n const tileId3 = this._readMapData(mx, my, 3);\r\n const tileId4 = this._readMapData(mx, my, 4);\r\n //if (REGame.map.isValid()) {\r\n if (show) {\r\n const block = MRLively_1.MRLively.mapView.currentMap.block(mx, my);\r\n if (block._roomId > 0) {\r\n this._addTile(this._upperLayer, startTileId + block._roomId, dx, dy);\r\n }\r\n else if (block._blockComponent == FMapData_1.FBlockComponent.Passageway) {\r\n this._addTile(this._upperLayer, startTileId + 8, dx, dy);\r\n }\r\n }\r\n if (showAutotileShapeId) {\r\n const shape = Tilemap.getAutotileShape(tileId0);\r\n this._addTile(this._upperLayer, startTileId + shape, dx, dy);\r\n }\r\n // ガイドグリッドの描画\r\n if (this._lowerLayer._rendererId != 2) {\r\n if (MRView_1.MRView.guideGrid && MRView_1.MRView.guideGrid.isVisible()) {\r\n const tile = MRView_1.MRView.guideGrid.readMapData(mx, my);\r\n this._addTile(this._lowerLayer, tile, dx, dy);\r\n }\r\n }\r\n /*\r\nif (tileId5 == 8) {\r\n console.log(\"m\", mx, my);\r\n console.log(\"tileId5\", tileId5);\r\n console.log(\"tileId0\", tileId0);\r\n console.log(\"tileId1\", tileId1);\r\n console.log(\"tileId2\", tileId2);\r\n console.log(\"tileId3\", tileId3);\r\n console.log(\"tileId4\", tileId4);\r\n throw new Error();\r\n this._addTile(this._upperLayer, startTileId + 1, dx, dy);\r\n}\r\n\r\nif (tileId5 == 1) {\r\n console.log(\"m\", mx, my);\r\n console.log(\"tileId5\", tileId5);\r\n console.log(\"tileId0\", tileId0);\r\n console.log(\"tileId1\", tileId1);\r\n console.log(\"tileId2\", tileId2);\r\n console.log(\"tileId3\", tileId3);\r\n console.log(\"tileId4\", tileId4);\r\n throw new Error();\r\n this._addTile(this._upperLayer, startTileId + 10, dx, dy);\r\n}\r\n*/\r\n};\r\nconst _Tilemap__addAutotile = Tilemap.prototype._addAutotile;\r\nTilemap.prototype._addAutotile = function (layer, tileId, dx, dy) {\r\n const kind = Tilemap.getAutotileKind(tileId);\r\n if (MRLively_1.MRLively.mapView.currentMap.floorId().isTacticsMap2 && Tilemap.isTileA4(tileId)) {\r\n const x = dx / this.tileWidth;\r\n const y = dy / this.tileHeight;\r\n const ox = Math.ceil(this.origin.x);\r\n const oy = Math.ceil(this.origin.y);\r\n const startX = Math.floor((ox - this._margin) / this.tileWidth);\r\n const startY = Math.floor((oy - this._margin) / this.tileHeight);\r\n const mx = startX + x;\r\n const my = startY + y;\r\n const shape = Tilemap.getAutotileShape(tileId);\r\n const tx = kind % 8;\r\n const ty = Math.floor(kind / 8);\r\n const w1 = this.tileWidth / 2;\r\n const h1 = this.tileHeight / 2;\r\n let autotileTable = Tilemap.FLOOR_AUTOTILE_TABLE;\r\n // kind の予約枠は次の通り。\r\n // - A1 は 0~15 (最大16個)\r\n // - A2 は 16~47 (最大32個)\r\n // - A3 は 48~80 (最大32個)\r\n // - A4 は 80~127 (最大48個)\r\n //\r\n // tx,ty は、これらが横8個の論理的なグリッドに並んでいると考えた時のセル番号。\r\n //\r\n // A4 では、上面と側面は別の AutoTile kind で表現されている。\r\n // A4 画像には横8個、縦6個の計 48 個の AutoTile が存在することになる。\r\n const setNumber = 3;\r\n const bx = tx * 2;\r\n const by = Math.floor((ty - 10) * 2.5 + (ty % 2 === 1 ? 0.5 : 0));\r\n const syOffsets = [0, 0, 0, 0];\r\n if (ty % 2 === 1) {\r\n // 壁\r\n autotileTable = Tilemap.WALL_AUTOTILE_TABLE;\r\n syOffsets[0] = -h1;\r\n syOffsets[1] = -h1;\r\n if (shape == 11) {\r\n if (mx > 0) {\r\n const tileId2 = this._readMapData(mx - 1, my, 0);\r\n if (isTileA4Floor(tileId2)) {\r\n autotileTable = WALL_AUTOTILE_TABLE2;\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n // 上面\r\n if (shape == 16) {\r\n if (mx > 0) {\r\n const tileId2 = this._readMapData(mx - 1, my, 0);\r\n if (isTileA4Wall(tileId2)) {\r\n autotileTable = FLOOR_AUTOTILE_TABLE2;\r\n }\r\n }\r\n }\r\n else if (shape == 36) {\r\n if (mx < this.width - 1) {\r\n const tileId2 = this._readMapData(mx + 1, my, 0);\r\n if (isTileA4Wall(tileId2)) {\r\n autotileTable = FLOOR_AUTOTILE_TABLE2;\r\n }\r\n }\r\n }\r\n else if (shape == 28 || shape == 40) {\r\n if (my < this.height - 1) {\r\n const tileId2 = this._readMapData(mx, my + 1, 0);\r\n if (isTileA4Wall(tileId2)) {\r\n autotileTable = FLOOR_AUTOTILE_TABLE2;\r\n }\r\n }\r\n }\r\n }\r\n const table = autotileTable[shape];\r\n for (let i = 0; i < 4; i++) {\r\n const qsx = table[i][0];\r\n const qsy = table[i][1];\r\n const sx1 = (bx * 2 + qsx) * w1;\r\n const sy1 = (by * 2 + qsy) * h1;\r\n const dx1 = dx + (i % 2) * w1;\r\n const dy1 = dy + Math.floor(i / 2) * h1;\r\n layer.addRect(setNumber, sx1, sy1 + syOffsets[i], dx1, dy1, w1, h1);\r\n }\r\n }\r\n else {\r\n _Tilemap__addAutotile.call(this, layer, tileId, dx, dy);\r\n }\r\n};\r\n// RMMZ は複数の Tilemap を描画すると、Tileset を共有してしまう。\r\n// 通常のマップとは別に、ミニマップ描画用の Tilemap.Renderer を使うことで回避する。\r\nPIXI.Renderer.registerPlugin(\"rpgtilemap2\", Tilemap.Renderer);\r\nPIXI.Renderer.registerPlugin(\"rpgtilemap3\", Tilemap.Renderer);\r\nfunction getTilemapRenderer(renderer, id) {\r\n switch (id) {\r\n case TilemapRendererId.Minimap:\r\n //return undefined;\r\n return renderer.plugins.rpgtilemap2;\r\n case TilemapRendererId.Shadow:\r\n return undefined;\r\n return renderer.plugins.rpgtilemap3;\r\n default:\r\n return renderer.plugins.rpgtilemap;\r\n }\r\n}\r\nconst _Tilemap_initialize = Tilemap.prototype.initialize;\r\nTilemap.prototype.initialize = function () {\r\n _Tilemap_initialize.apply(this);\r\n this.selfVisible = true;\r\n};\r\nTilemap.prototype.setRendererId = function (id) {\r\n this._lowerLayer._rendererId = id;\r\n};\r\nTilemap.Layer.prototype.render = function (renderer) {\r\n const gl = renderer.gl;\r\n const tilemapRenderer = getTilemapRenderer(renderer, this._rendererId);\r\n if (!tilemapRenderer)\r\n return;\r\n const shader = tilemapRenderer.getShader();\r\n const matrix = shader.uniforms.uProjectionMatrix;\r\n // \"めつぶし\" 状態の対応。\r\n // Tilemap.visible は子 Sprite すべてを非表示にするためキャラクターが消えてしまう。\r\n // そのため Tilemap だけを表示しないように、ここで対策する。\r\n if (this.parent instanceof Tilemap && !this.parent.selfVisible) {\r\n return false;\r\n }\r\n //--------------------\r\n // 以下、 Tilemap.Layer.prototype.render のコピー\r\n renderer.batch.setObjectRenderer(tilemapRenderer);\r\n renderer.projection.projectionMatrix.copyTo(matrix);\r\n matrix.append(this.worldTransform);\r\n renderer.shader.bind(shader);\r\n if (this._needsTexturesUpdate) {\r\n tilemapRenderer.updateTextures(renderer, this._images);\r\n this._needsTexturesUpdate = false;\r\n }\r\n tilemapRenderer.bindTextures(renderer);\r\n renderer.geometry.bind(this._vao, shader);\r\n this._updateIndexBuffer();\r\n if (this._needsVertexUpdate) {\r\n this._updateVertexBuffer();\r\n this._needsVertexUpdate = false;\r\n }\r\n renderer.geometry.updateBuffers();\r\n const numElements = this._elements.length;\r\n if (numElements > 0) {\r\n renderer.state.set(this._state);\r\n renderer.geometry.draw(gl.TRIANGLES, numElements * 6, 0);\r\n }\r\n};\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/rmmz/Tilemap.ts?"); /***/ }), /***/ "./ts/mr/rmmz/VMapEditor.ts": /*!**********************************!*\ !*** ./ts/mr/rmmz/VMapEditor.ts ***! \**********************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VMapEditor = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst DHelper_1 = __webpack_require__(/*! ts/mr/data/DHelper */ \"./ts/mr/data/DHelper.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst FMapData_1 = __webpack_require__(/*! ts/mr/floorgen/FMapData */ \"./ts/mr/floorgen/FMapData.ts\");\r\nconst LBlock_1 = __webpack_require__(/*! ts/mr/lively/LBlock */ \"./ts/mr/lively/LBlock.ts\");\r\nconst DTemplateMap_1 = __webpack_require__(/*! ts/mr/data/DTemplateMap */ \"./ts/mr/data/DTemplateMap.ts\");\r\nconst SEditMapHelper_1 = __webpack_require__(/*! ../system/utils/SEditMapHelper */ \"./ts/mr/system/utils/SEditMapHelper.ts\");\r\nvar SubTile;\r\n(function (SubTile) {\r\n SubTile[SubTile[\"UL\"] = 0] = \"UL\";\r\n SubTile[SubTile[\"UR\"] = 1] = \"UR\";\r\n SubTile[SubTile[\"LL\"] = 2] = \"LL\";\r\n SubTile[SubTile[\"LR\"] = 3] = \"LR\";\r\n})(SubTile || (SubTile = {}));\r\n/**\r\n * RE Core 側で生成されたマップ (ランダムマップ) を、RMMZ 側のマップデータに反映する。\r\n */\r\nclass VMapEditor {\r\n constructor(coreMap) {\r\n this._coreMap = coreMap;\r\n const floorData = coreMap.floorData();\r\n const templateMap = floorData.template ? MRData_1.MRData.templateMaps.find(x => x.name == floorData.template) : MRData_1.MRData.templateMaps[1];\r\n (0, Common_1.assert)(templateMap);\r\n this._templateMap = templateMap;\r\n this._helper = new VEditMapHelper();\r\n }\r\n build() {\r\n $dataMap.tilesetId = this._templateMap.tilesetId;\r\n $dataMap.width = this._coreMap.width();\r\n $dataMap.height = this._coreMap.height();\r\n $dataMap.data = new Array($dataMap.width * $dataMap.height * 5);\r\n $gameMap.changeTileset($dataMap.tilesetId);\r\n if (this._coreMap.floorId().isFixedMap2) {\r\n }\r\n else {\r\n for (let y = 0; y < $dataMap.height; y++) {\r\n for (let x = 0; x < $dataMap.width; x++) {\r\n const block = this._coreMap.block(x, y);\r\n this.refreshBlock(block);\r\n }\r\n }\r\n }\r\n }\r\n refreshBlock(block) {\r\n const x = block.mx;\r\n const y = block.my;\r\n // Shape\r\n {\r\n const partIndex = block.shapeVisualPartIndex;\r\n if (partIndex > 0) {\r\n const part = this._templateMap.parts[partIndex];\r\n this.putPart(x, y, 0, part);\r\n }\r\n // TODO: 古い方式\r\n else {\r\n switch (block.tileShape()) {\r\n case LBlock_1.LTileShape.Floor:\r\n if (block.systemDecoration() == LBlock_1.LBlockSystemDecoration.ItemShop) {\r\n // お店の床装飾\r\n this._helper.putAutoTile(x, y, 0, this._templateMap.itemShopFloorAutoTileKind);\r\n }\r\n else {\r\n this._helper.putAutoTile(x, y, 0, this._templateMap.floorAutoTileKind);\r\n }\r\n break;\r\n case LBlock_1.LTileShape.Wall:\r\n this._helper.putAutoTile(x, y, 0, this._templateMap.floorAutoTileKind);\r\n if (this._helper.isValidPos(x, y + 1) && this._coreMap.block(x, y + 1)._blockComponent != FMapData_1.FBlockComponent.None) {\r\n this._helper.putAutoTile(x, y, 1, this._templateMap.wallEdgeAutoTileKind);\r\n }\r\n else {\r\n this._helper.putAutoTile(x, y, 1, this._templateMap.wallHeadAutoTileKind);\r\n }\r\n break;\r\n default:\r\n throw new Error(\"Not implemented.\");\r\n }\r\n }\r\n }\r\n // Decoration\r\n {\r\n const partIndex = block.decorationVisualPartIndex;\r\n if (partIndex > 0) {\r\n const part = this._templateMap.parts[partIndex];\r\n this.putPart(x, y, 2, part);\r\n }\r\n }\r\n }\r\n putPart(x, y, z, part) {\r\n (0, Common_1.assert)(part);\r\n switch (part.tileType) {\r\n case DTemplateMap_1.DBlockVisualPartTileType.Normal:\r\n for (let i = 0; i < part.height; i++) {\r\n const cy = y - i;\r\n if (this._helper.isValidPos(x, cy)) {\r\n this._helper.setTileId(x, y, z, part.tiles[i]);\r\n }\r\n }\r\n break;\r\n case DTemplateMap_1.DBlockVisualPartTileType.Autotile:\r\n this._helper.putAutoTile(x, y, z, part.tiles[0]);\r\n break;\r\n default:\r\n throw new Error(\"Unreachable.\");\r\n }\r\n }\r\n}\r\nexports.VMapEditor = VMapEditor;\r\nclass VEditMapHelper extends SEditMapHelper_1.SEditMapHelper {\r\n width() {\r\n return $dataMap.width;\r\n }\r\n height() {\r\n return $dataMap.width;\r\n }\r\n onIsValidPos(x, y) {\r\n return (0 <= x && x < this.width() && 0 <= y && y < this.height());\r\n }\r\n onGetTileId(x, y, z) {\r\n const width = $dataMap.width;\r\n const height = $dataMap.height;\r\n return $dataMap.data[(z * height + y) * width + x] || 0;\r\n }\r\n onSetTileId(x, y, z, tileId) {\r\n const width = $dataMap.width;\r\n const height = $dataMap.height;\r\n $dataMap.data[(z * height + y) * width + x] = tileId;\r\n }\r\n getSameKindTile(x, y, z, componentOrAutoTileKind) {\r\n const tileId = this.onGetTileId(x, y, z);\r\n if (Tilemap.isAutotile(tileId) && Tilemap.getAutotileKind(tileId) == componentOrAutoTileKind) {\r\n return true;\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n onGetAutotileTable(componentOrAutoTileKind) {\r\n return (DHelper_1.DHelpers.isWallSideAutoTile(componentOrAutoTileKind)) ? SEditMapHelper_1.SEditMapHelper._subtileToAutoTileTable_Wall : SEditMapHelper_1.SEditMapHelper._subtileToAutoTileTable;\r\n }\r\n}\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/rmmz/VMapEditor.ts?"); /***/ }), /***/ "./ts/mr/rmmz/WindowLayer.ts": /*!***********************************!*\ !*** ./ts/mr/rmmz/WindowLayer.ts ***! \***********************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nconst PluginParameters_1 = __webpack_require__(/*! ../PluginParameters */ \"./ts/mr/PluginParameters.ts\");\r\nconst _WindowLayer_prototype_render = WindowLayer.prototype.render;\r\nWindowLayer.prototype.render = function (renderer) {\r\n if (PluginParameters_1.paramDisableWindowStencil) {\r\n // NOTE: 元々は TilemapWindow が背面になっても全面ウィンドウを透過して見えるようにするため\r\n // this._isWindow = false; を使っていた。\r\n // しかし元の WindowLayer.render ではこのフラグによって描画順が変わってしまうため、\r\n // 単に _isWindow = false しただけだと常に TilemapWindow が最前面になってしまう。\r\n if (!this.visible) {\r\n return;\r\n }\r\n for (const child of this.children) {\r\n if (child.visible) {\r\n child.render(renderer);\r\n }\r\n }\r\n renderer.batch.flush();\r\n }\r\n else {\r\n _WindowLayer_prototype_render.call(this, renderer);\r\n }\r\n};\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/rmmz/WindowLayer.ts?"); /***/ }), /***/ "./ts/mr/rmmz/Window_MapName.ts": /*!**************************************!*\ !*** ./ts/mr/rmmz/Window_MapName.ts ***! \**************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nconst RMMZHelper_1 = __webpack_require__(/*! ./RMMZHelper */ \"./ts/mr/rmmz/RMMZHelper.ts\");\r\nconst _Window_MapName_update = Window_MapName.prototype.update;\r\nWindow_MapName.prototype.update = function () {\r\n if (RMMZHelper_1.RMMZHelper.isRESystemMap()) {\r\n // RESystem マップでは標準のマップ名表示は使わない\r\n }\r\n else {\r\n _Window_MapName_update.call(this);\r\n }\r\n};\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/rmmz/Window_MapName.ts?"); /***/ }), /***/ "./ts/mr/system/Helpers.ts": /*!*********************************!*\ !*** ./ts/mr/system/Helpers.ts ***! \*********************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Helpers = void 0;\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst Vector2_1 = __webpack_require__(/*! ts/mr/math/Vector2 */ \"./ts/mr/math/Vector2.ts\");\r\nconst DFaction_1 = __webpack_require__(/*! ../data/DFaction */ \"./ts/mr/data/DFaction.ts\");\r\nclass Helpers {\r\n static dirToTileOffset(dir) {\r\n return this._dirToTileOffsetTable[dir];\r\n }\r\n /** @deprecated HMovement */\r\n static offsetToDir(offsetX, offsetY) {\r\n if (offsetX == 0) {\r\n if (offsetY == 0) {\r\n return 2; // FailSafe.\r\n }\r\n else if (offsetY > 0) {\r\n return 2;\r\n }\r\n else { // if (offsetY < 0)\r\n return 8;\r\n }\r\n }\r\n else if (offsetX > 0) {\r\n if (offsetY == 0) {\r\n return 6;\r\n }\r\n else if (offsetY > 0) {\r\n return 3;\r\n }\r\n else { // if (offsetY < 0)\r\n return 9;\r\n }\r\n }\r\n else { // if (offsetX < 0)\r\n if (offsetY == 0) {\r\n return 4;\r\n }\r\n else if (offsetY > 0) {\r\n return 1;\r\n }\r\n else { // if (offsetY < 0)\r\n return 7;\r\n }\r\n }\r\n }\r\n static makeFrontPosition(x, y, dir, length) {\r\n const offset = this._dirToTileOffsetTable[dir];\r\n return new Vector2_1.Vector2(x + offset.x * length, y + offset.y * length);\r\n }\r\n static makeEntityFrontPosition(entity, length) {\r\n const offset = this._dirToTileOffsetTable[entity.dir];\r\n return new Vector2_1.Vector2(entity.mx + offset.x * length, entity.my + offset.y * length);\r\n }\r\n // 2 つの Entity 間の直線距離を取得\r\n static getDistance(entity1, entity2) {\r\n const x = entity1.mx - entity2.mx;\r\n const y = entity1.my - entity2.my;\r\n return Math.sqrt((x * x) + (y * y));\r\n }\r\n // 敵対勢力であるかを確認\r\n static isHostile(subject, target) {\r\n return this.isHostileFactionId(subject.getOutwardFactionId(), target.getOutwardFactionId());\r\n }\r\n // 味方であるかを確認\r\n // (target が subject に対して中立である場合は false を返すので注意)\r\n static isFriend(subject, target) {\r\n return this.isFriendFactionId(subject.getOutwardFactionId(), target.getOutwardFactionId());\r\n }\r\n // subject から見て、target はどのような勢力の相手かを判定する。\r\n // subject や target の勢力を直接判断するわけではない点に注意。\r\n static getLooksToFactionType(subject, target) {\r\n if (this.isFriend(subject, target)) {\r\n return DFaction_1.DFactionType.Friendly;\r\n }\r\n else if (this.isHostile(subject, target)) {\r\n return DFaction_1.DFactionType.Hostile;\r\n }\r\n else {\r\n return DFaction_1.DFactionType.Neutral;\r\n }\r\n }\r\n static isHostileFactionId(subject, target) {\r\n return (MRData_1.MRData.factions[subject].hostileBits & (1 << target)) != 0;\r\n }\r\n static isFriendFactionId(subject, target) {\r\n if (subject == target)\r\n return true;\r\n return (MRData_1.MRData.factions[subject].friendBits & (1 << target)) != 0;\r\n }\r\n // public static isAdjacent(entity1: LEntity, entity2: LEntity): boolean {\r\n // return (Math.abs(entity1.x - entity2.x) <= 1 && Math.abs(entity1.y - entity2.y) <= 1);\r\n // }\r\n static lerp(v1, v2, t) {\r\n return v1 + ((v2 - v1) * t);\r\n }\r\n}\r\nexports.Helpers = Helpers;\r\nHelpers._dirToTileOffsetTable = [\r\n { x: 0, y: 0 },\r\n { x: -1, y: 1 }, { x: 0, y: 1 }, { x: 1, y: 1 },\r\n { x: -1, y: 0 }, { x: 0, y: 0 }, { x: 1, y: 0 },\r\n { x: -1, y: -1 }, { x: 0, y: -1 }, { x: 1, y: -1 },\r\n];\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/Helpers.ts?"); /***/ }), /***/ "./ts/mr/system/MRSystem.ts": /*!**********************************!*\ !*** ./ts/mr/system/MRSystem.ts ***! \**********************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.MRSystem = void 0;\r\nconst MRSystemExtension_1 = __webpack_require__(/*! ./MRSystemExtension */ \"./ts/mr/system/MRSystemExtension.ts\");\r\nconst LObject_1 = __webpack_require__(/*! ../lively/LObject */ \"./ts/mr/lively/LObject.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst DSystem_1 = __webpack_require__(/*! ../data/DSystem */ \"./ts/mr/data/DSystem.ts\");\r\nclass MRSystem {\r\n static get fovSystem() {\r\n switch (MRLively_1.MRLively.mapView.currentFloorId.floorInfo.fovSystem) {\r\n case DSystem_1.DFovSystem.RoomBounds:\r\n return this.roomBoundsFovSystem;\r\n case DSystem_1.DFovSystem.SymmetricShadowcast:\r\n return this.symmetricShadowcastFovSystem;\r\n default:\r\n throw new Error(\"Unknown fov system\");\r\n }\r\n }\r\n}\r\nexports.MRSystem = MRSystem;\r\nMRSystem.propertyData = [\r\n { id: 0, defaultValue: undefined },\r\n { id: 1, defaultValue: 0 },\r\n { id: 2, defaultValue: 1 },\r\n { id: 3, defaultValue: [] }, // equipmentSlots\r\n];\r\nMRSystem.properties = {\r\n equipmentSlots: 3,\r\n};\r\n// System\r\nMRSystem.ext = new MRSystemExtension_1.MRSystemExtension();\r\nMRSystem.requestedPlayback = false;\r\nMRSystem.unittest = false;\r\nMRSystem.requestedRestartFloorItem = LObject_1.LEntityId.makeEmpty();\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/MRSystem.ts?"); /***/ }), /***/ "./ts/mr/system/MRSystemExtension.ts": /*!*******************************************!*\ !*** ./ts/mr/system/MRSystemExtension.ts ***! \*******************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.MRSystemExtension = void 0;\r\nclass MRSystemExtension {\r\n onNewEntity(entity, data) { }\r\n}\r\nexports.MRSystemExtension = MRSystemExtension;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/MRSystemExtension.ts?"); /***/ }), /***/ "./ts/mr/system/SAIHelper.ts": /*!***********************************!*\ !*** ./ts/mr/system/SAIHelper.ts ***! \***********************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SAIHelper = void 0;\r\nclass SAIHelper {\r\n static axisToDir(dx, dy) {\r\n // Y-Down なので、イメージ的には ↓方向が 0(=1=Math.PI*2). 反時計回りが+\r\n let r = Math.atan2(dx, dy);\r\n r = (r + Math.PI) / (Math.PI * 2.0); // 1週を 0~1 にする。+PIしているので、↑が 0 になる。\r\n r += 1.0 / 16.0;\r\n let index = 0;\r\n if (0.0 < r && r < 1.0)\r\n index = Math.floor(r * 8);\r\n return this.axisToDirIndices[index];\r\n /*\r\n if (dx < 0) { // Left\r\n if (dy < 0) { // Up\r\n return 7;\r\n }\r\n else if (dy > 0) { // Down\r\n return 1;\r\n }\r\n else { // N\r\n return 4;\r\n }\r\n }\r\n else if (dx > 0) { // Right\r\n if (dy < 0) { // Up\r\n return 9;\r\n }\r\n else if (dy > 0) { // Down\r\n return 3;\r\n }\r\n else { // N\r\n return 6;\r\n }\r\n }\r\n else { // N\r\n if (dy < 0) { // Up\r\n return 8;\r\n }\r\n else if (dy > 0) { // Down\r\n return 2;\r\n }\r\n else { // N\r\n return 0;\r\n }\r\n }\r\n */\r\n }\r\n static distanceToDir(startX, startY, goalX, goalY) {\r\n const dx = goalX - startX;\r\n const dy = goalY - startY;\r\n return this.axisToDir(dx, dy);\r\n }\r\n static entityDistanceToDir(start, target) {\r\n const dx = target.mx - start.mx;\r\n const dy = target.my - start.my;\r\n return this.axisToDir(dx, dy);\r\n }\r\n}\r\nexports.SAIHelper = SAIHelper;\r\n// 左折の法則\r\nSAIHelper._movingPriority = [\r\n /* 0 */ [],\r\n /* 1 */ [1, 2, 4, 3, 7],\r\n /* 2 */ [2, 3, 1, 6, 4],\r\n /* 3 */ [3, 6, 2, 9, 1],\r\n /* 4 */ [4, 1, 7, 2, 8],\r\n /* 5 */ [],\r\n /* 6 */ [6, 9, 3, 8, 2],\r\n /* 7 */ [7, 4, 8, 1, 9],\r\n /* 8 */ [8, 7, 9, 4, 6],\r\n /* 9 */ [9, 8, 6, 7, 3],\r\n];\r\nSAIHelper.axisToDirIndices = [8, 7, 4, 1, 2, 3, 6, 9];\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/SAIHelper.ts?"); /***/ }), /***/ "./ts/mr/system/SAbilityFactory.ts": /*!*****************************************!*\ !*** ./ts/mr/system/SAbilityFactory.ts ***! \*****************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SAbilityFactory = void 0;\r\nconst LAbility_1 = __webpack_require__(/*! ts/mr/lively/abilities/LAbility */ \"./ts/mr/lively/abilities/LAbility.ts\");\r\nclass SAbilityFactory {\r\n static newAbility(abilityId) {\r\n const ability = new LAbility_1.LAbility();\r\n ability.setup(abilityId);\r\n return ability;\r\n }\r\n}\r\nexports.SAbilityFactory = SAbilityFactory;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/SAbilityFactory.ts?"); /***/ }), /***/ "./ts/mr/system/SActionHitTest.ts": /*!****************************************!*\ !*** ./ts/mr/system/SActionHitTest.ts ***! \****************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SActionHitTest = void 0;\r\nconst DEffect_1 = __webpack_require__(/*! ../data/DEffect */ \"./ts/mr/data/DEffect.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ../data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst PluginParameters_1 = __webpack_require__(/*! ../PluginParameters */ \"./ts/mr/PluginParameters.ts\");\r\nclass SActionHitTest {\r\n /**\r\n * Projectle 用の命中判定\r\n *\r\n * RMMZ では命中判定とダメージ適用を1つの処理で行っているが、\r\n * MR では飛び道具の命中判定の後に様々な処理が割り込む可能性があるため、分ける必要がある。\r\n * 例えば飛び道具の反射など。\r\n */\r\n static testProjectle(subject, projectile, target, hitType, rand) {\r\n const r1 = this.testCertainIndirectHits(subject, projectile, target);\r\n if (r1 !== undefined) {\r\n return r1;\r\n }\r\n // 攻撃側命中率\r\n const hitRate = (hitType == DEffect_1.DEffectHitType.Physical) ? PluginParameters_1.paraIndirectPhysicalHitRate : 100;\r\n // 受け側回避率\r\n const evaRate = this.evaRate(target, hitType) * 100;\r\n const missed = rand.nextIntWithMax(100) >= hitRate;\r\n const evaded = !missed && rand.nextIntWithMax(100) < evaRate;\r\n return !missed && !evaded;\r\n }\r\n static evaRate(target, hitType) {\r\n if (hitType == DEffect_1.DEffectHitType.Physical) {\r\n return target.xparam(MRBasics_1.MRBasics.xparams.eva);\r\n }\r\n else if (hitType == DEffect_1.DEffectHitType.Magical) {\r\n return target.xparam(MRBasics_1.MRBasics.xparams.mev);\r\n }\r\n else {\r\n return 0;\r\n }\r\n }\r\n static testCertainIndirectHits(subject, projectile, target) {\r\n const awful = subject.hasTrait(MRBasics_1.MRBasics.traits.AwfulPhysicalIndirectAttack);\r\n const hit = subject.hasTrait(MRBasics_1.MRBasics.traits.CertainIndirectAttack);\r\n const avoid = target.hasTrait(MRBasics_1.MRBasics.traits.DodgePhysicalIndirectAttack);\r\n if (hit && avoid) {\r\n // 絶対命中と絶対回避がコンフリクトしている場合は通常の判定を行う\r\n return undefined;\r\n }\r\n else if (avoid) {\r\n // 間接攻撃回避\r\n // result.missed = true;\r\n // result.evaded = true;\r\n return false;\r\n }\r\n else if (hit) {\r\n // 間接攻撃 - 絶対命中 (へた投げより優先)\r\n // result.missed = false;\r\n // result.evaded = false;\r\n return true;\r\n }\r\n else if (awful) {\r\n // 間接攻撃命中なし(へた投げ)\r\n // result.missed = true;\r\n // result.evaded = true;\r\n return false;\r\n }\r\n return undefined;\r\n }\r\n}\r\nexports.SActionHitTest = SActionHitTest;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/SActionHitTest.ts?"); /***/ }), /***/ "./ts/mr/system/SActivityContext.ts": /*!******************************************!*\ !*** ./ts/mr/system/SActivityContext.ts ***! \******************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SActivityContext = void 0;\r\nconst SCommand_1 = __webpack_require__(/*! ./SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst SCommandContext_1 = __webpack_require__(/*! ./SCommandContext */ \"./ts/mr/system/SCommandContext.ts\");\r\nconst STask_1 = __webpack_require__(/*! ./tasks/STask */ \"./ts/mr/system/tasks/STask.ts\");\r\n/**\r\n * Activity の 3Way-Handshake\r\n */\r\nclass SActivityContext {\r\n constructor(activity) {\r\n this._activity = activity;\r\n }\r\n activity() {\r\n return this._activity;\r\n }\r\n /** 一連の処理が成功したとき */\r\n then(func) {\r\n this._thenFunc = func;\r\n return this;\r\n }\r\n /** リジェクトされた/ハンドリングされなかったとき */\r\n catch(func) {\r\n this._catchFunc = func;\r\n return this;\r\n }\r\n /**\r\n * onActivity の中から呼び出すこと。\r\n */\r\n postHandleActivity(cctx, objectum) {\r\n const command = new SCommandContext_1.HandleActivityCommand();\r\n const m1 = () => {\r\n // 相手側前処理\r\n // ここで any を使っているのは、TS2367 の対策のため。2021/9/29次点では Open の問題で、今のところ逃げ道がないみたい。\r\n // https://github.com/microsoft/TypeScript/issues/9998\r\n let result1 = SCommand_1.SCommandResponse.Pass;\r\n objectum.iterateBehaviorsReverse(b => {\r\n result1 = b.onActivityPreReaction(objectum, cctx, this._activity);\r\n if (result1 != SCommand_1.SCommandResponse.Pass) { // TODO: ここ Succeeded のほうがいいかも\r\n return false;\r\n }\r\n else {\r\n return true;\r\n }\r\n });\r\n // 相手側で reject されてなければ本処理\r\n if (result1 != SCommand_1.SCommandResponse.Canceled) {\r\n const then = command._thenFunc;\r\n //if (then) {\r\n const m2 = () => {\r\n const result2 = then ? then() : SCommandContext_1.SHandleCommandResult.Resolved;\r\n if (result2 == SCommandContext_1.SHandleCommandResult.Resolved) {\r\n // 本処理も成功したので相手側の後処理を行う\r\n objectum.iterateBehaviorsReverse(b => {\r\n b.onActivityReaction(objectum, cctx, this._activity);\r\n return true;\r\n });\r\n if (this._thenFunc)\r\n this._thenFunc();\r\n }\r\n else {\r\n // 本処理失敗\r\n if (this._catchFunc)\r\n this._catchFunc();\r\n }\r\n return SCommand_1.SCommandResponse.Pass;\r\n };\r\n cctx.postTask2(new STask_1.STask(\"HandleActivity.2\", m2));\r\n //}\r\n }\r\n else {\r\n // 相手側の前処理ではじかれた\r\n if (command._catchFunc)\r\n command._catchFunc();\r\n if (this._catchFunc)\r\n this._catchFunc();\r\n }\r\n return SCommand_1.SCommandResponse.Pass;\r\n };\r\n cctx.postTask2(new STask_1.STask(\"HandleActivity\", m1));\r\n return command;\r\n }\r\n}\r\nexports.SActivityContext = SActivityContext;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/SActivityContext.ts?"); /***/ }), /***/ "./ts/mr/system/SActivityRecorder.ts": /*!*******************************************!*\ !*** ./ts/mr/system/SActivityRecorder.ts ***! \*******************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}));\r\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n});\r\nvar __importStar = (this && this.__importStar) || function (mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n};\r\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SActivityRecorder = exports.ActivityRecordingCommandType = void 0;\r\nconst fs = __importStar(__webpack_require__(/*! fs */ \"fs\"));\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ./MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst LActivity_1 = __webpack_require__(/*! ts/mr/lively/activities/LActivity */ \"./ts/mr/lively/activities/LActivity.ts\");\r\nconst StorageManager_1 = __webpack_require__(/*! ts/mr/rmmz/StorageManager */ \"./ts/mr/rmmz/StorageManager.ts\");\r\nvar ActivityRecordingCommandType;\r\n(function (ActivityRecordingCommandType) {\r\n ActivityRecordingCommandType[ActivityRecordingCommandType[\"Activity\"] = 1] = \"Activity\";\r\n ActivityRecordingCommandType[ActivityRecordingCommandType[\"CloseMainDialog\"] = 2] = \"CloseMainDialog\";\r\n})(ActivityRecordingCommandType = exports.ActivityRecordingCommandType || (exports.ActivityRecordingCommandType = {}));\r\nvar RecorderMode;\r\n(function (RecorderMode) {\r\n RecorderMode[RecorderMode[\"Idle\"] = 0] = \"Idle\";\r\n RecorderMode[RecorderMode[\"Recording\"] = 1] = \"Recording\";\r\n RecorderMode[RecorderMode[\"Playback\"] = 2] = \"Playback\";\r\n})(RecorderMode || (RecorderMode = {}));\r\nclass SActivityRecorder {\r\n constructor() {\r\n this._recorderMode = RecorderMode.Idle;\r\n this._playbackCommandIndex = 0;\r\n this._savefileId = 0;\r\n this._silentPlayback = false;\r\n }\r\n setSavefileId(id) {\r\n this._savefileId = id;\r\n }\r\n isIdle() {\r\n return this._recorderMode == RecorderMode.Idle;\r\n }\r\n isRecording() {\r\n return this._recorderMode == RecorderMode.Recording;\r\n }\r\n isPlayback() {\r\n return this._recorderMode == RecorderMode.Playback;\r\n //return this._playbackCommands != undefined && this._playbackCommandIndex < this._playbackCommands.length;\r\n }\r\n checkPlaybackRemaining(count) {\r\n (0, Common_1.assert)(this._playbackCommands);\r\n return (this._playbackCommands.length - this._playbackCommandIndex) <= count;\r\n }\r\n startRecording() {\r\n this.closeFile();\r\n StorageManager_1.RmmzStorageManager.ensureSaveDirectory();\r\n this._recorderMode = RecorderMode.Recording;\r\n return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {\r\n this._stream = fs.createWriteStream(this.filePath());\r\n this._stream.on(\"open\", () => resolve(true));\r\n this._stream.on(\"error\", () => reject(false));\r\n }));\r\n /*\r\n this._stream = fs.createWriteStream(this.filePath());\r\n assert(this._stream);\r\n this._stream.on(\"open\", () => {\r\n console.log(\"createReadStream\");\r\n });\r\n this._stream.on(\"ready\", () => {\r\n console.log(\"2\");\r\n });\r\n this._stream.on(\"finish\", () => {\r\n console.log(\"3\");\r\n });\r\n */\r\n }\r\n stopRecording() {\r\n if (this._stream) {\r\n this._stream.close();\r\n this._recorderMode = RecorderMode.Idle;\r\n }\r\n return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {\r\n if (this._stream) {\r\n this._stream.on(\"close\", () => resolve(true));\r\n }\r\n }));\r\n }\r\n restartRecording() {\r\n this.closeFile();\r\n const options = {\r\n flags: \"a\" // 追加書き込みモード\r\n };\r\n this._stream = fs.createWriteStream(this.filePath(), options);\r\n this._recorderMode = RecorderMode.Recording;\r\n }\r\n filePath() {\r\n //const dir = RESystem.unittest ? \"\" : RmmzStorageManager.fileDirectoryPath();\r\n const dir = StorageManager_1.RmmzStorageManager.fileDirectoryPath();\r\n return (dir + `re${this._savefileId}.resave`).replace(/\\\\/g, \"/\");\r\n }\r\n push(cmd) {\r\n (0, Common_1.assert)(this._stream);\r\n // 平均実行時間は 0.02[ms]\r\n this._stream.write(JSON.stringify(cmd) + \",\\n\");\r\n }\r\n attemptStartPlayback(silent) {\r\n this.closeFile();\r\n const filepath = this.filePath();\r\n if (!fs.existsSync(filepath)) {\r\n // ファイルが無かった。実行不要。\r\n return false;\r\n }\r\n const data = fs.readFileSync(filepath, { encoding: \"utf8\" });\r\n const json = \"[\" + data.substring(0, data.length - 2) + \"]\";\r\n this._playbackCommands = JSON.parse(json);\r\n if (!this._playbackCommands || this._playbackCommands.length == 0) {\r\n // ファイルが空っぽだった。実行不要。\r\n return false;\r\n }\r\n this._playbackCommandIndex = 0;\r\n this._recorderMode = RecorderMode.Playback;\r\n this._silentPlayback = silent;\r\n return true;\r\n }\r\n clearSilentPlayback() {\r\n this._silentPlayback = false;\r\n }\r\n isSilentPlayback() {\r\n return this._silentPlayback;\r\n }\r\n closeFile() {\r\n if (this._stream) {\r\n this._stream.close();\r\n this._stream = undefined;\r\n }\r\n }\r\n runPlaybackCommand(dialog) {\r\n (0, Common_1.assert)(this._playbackCommands);\r\n (0, Common_1.assert)(this.isPlayback());\r\n // DialogClose まで一気に実行する\r\n do {\r\n const cmd = this._playbackCommands[this._playbackCommandIndex];\r\n this._playbackCommandIndex++;\r\n if (!this.doCommand(dialog, cmd)) {\r\n break;\r\n }\r\n } while (this._playbackCommandIndex < this._playbackCommands.length);\r\n if (this._playbackCommandIndex < this._playbackCommands.length) {\r\n return true;\r\n }\r\n else {\r\n this._recorderMode == RecorderMode.Idle;\r\n //this._silentPlayback = false;\r\n return false;\r\n }\r\n }\r\n doCommand(dialog, cmd) {\r\n switch (cmd.type) {\r\n case ActivityRecordingCommandType.Activity: {\r\n (0, Common_1.assert)(cmd.activity);\r\n MRSystem_1.MRSystem.commandContext.postActivity(LActivity_1.LActivity.makeFromData(cmd.activity));\r\n return true;\r\n }\r\n case ActivityRecordingCommandType.CloseMainDialog: {\r\n return false;\r\n }\r\n default:\r\n throw new Error(\"Unreachable.\");\r\n break;\r\n }\r\n /*\r\n switch (cmd.type) {\r\n case RERecordingCommandType.Action: {\r\n const actionId: number = cmd.data.actionId;\r\n const actorEntityId = new LEntityId(cmd.data.actorEntityId._index, cmd.data.actorEntityId._key);\r\n const args: any = cmd.data.args;\r\n RESystem.commandContext.postActionOneWay(actionId, REGame.world.entity(actorEntityId), undefined, undefined, args);\r\n return true;\r\n }\r\n case RERecordingCommandType.ConsumeActionToken: {\r\n const id = new LEntityId(cmd.data.entityId._index, cmd.data.entityId._key);\r\n\r\n const causeEntity = RESystem.dialogContext.causeEntity();\r\n console.log(\"id\", id);\r\n assert(causeEntity);\r\n console.log(\"causeEntity.entityId()\", causeEntity.entityId());\r\n console.log(\"id.equals(causeEntity.entityId())\", id.equals(causeEntity.entityId()));\r\n assert(id.equals(causeEntity.entityId()));\r\n\r\n RESystem.commandContext.postConsumeActionToken(REGame.world.entity(id));\r\n dialog.consumeAction(); // TODO:\r\n dialog.submit(); // TODO:\r\n return false;\r\n }\r\n default:\r\n throw new Error();\r\n break;\r\n }\r\n */\r\n }\r\n}\r\nexports.SActivityRecorder = SActivityRecorder;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/SActivityRecorder.ts?"); /***/ }), /***/ "./ts/mr/system/SBehaviorFactory.ts": /*!******************************************!*\ !*** ./ts/mr/system/SBehaviorFactory.ts ***! \******************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SBehaviorManager = void 0;\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LDebugMoveRight_1 = __webpack_require__(/*! ts/mr/lively/states/LDebugMoveRight */ \"./ts/mr/lively/states/LDebugMoveRight.ts\");\r\nconst LNapStateBehavior_1 = __webpack_require__(/*! ts/mr/lively/states/LNapStateBehavior */ \"./ts/mr/lively/states/LNapStateBehavior.ts\");\r\nconst LKnockbackBehavior_1 = __webpack_require__(/*! ts/mr/lively/abilities/LKnockbackBehavior */ \"./ts/mr/lively/abilities/LKnockbackBehavior.ts\");\r\nconst LCommonBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LCommonBehavior */ \"./ts/mr/lively/behaviors/LCommonBehavior.ts\");\r\nconst LDecisionBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LDecisionBehavior */ \"./ts/mr/lively/behaviors/LDecisionBehavior.ts\");\r\nconst LUnitBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LUnitBehavior */ \"./ts/mr/lively/behaviors/LUnitBehavior.ts\");\r\nconst LInventoryBehavior_1 = __webpack_require__(/*! ts/mr/lively/entity/LInventoryBehavior */ \"./ts/mr/lively/entity/LInventoryBehavior.ts\");\r\nconst LItemUserBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LItemUserBehavior */ \"./ts/mr/lively/behaviors/LItemUserBehavior.ts\");\r\nconst LEquipmentUserBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LEquipmentUserBehavior */ \"./ts/mr/lively/behaviors/LEquipmentUserBehavior.ts\");\r\nconst LExitPointBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LExitPointBehavior */ \"./ts/mr/lively/behaviors/LExitPointBehavior.ts\");\r\nconst LEnemyBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LEnemyBehavior */ \"./ts/mr/lively/behaviors/LEnemyBehavior.ts\");\r\nconst LActorBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LActorBehavior */ \"./ts/mr/lively/behaviors/LActorBehavior.ts\");\r\nconst LItemBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LItemBehavior */ \"./ts/mr/lively/behaviors/LItemBehavior.ts\");\r\nconst LEntryPointBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LEntryPointBehavior */ \"./ts/mr/lively/behaviors/LEntryPointBehavior.ts\");\r\nconst LGenericRMMZStateBehavior_1 = __webpack_require__(/*! ts/mr/lively/states/LGenericRMMZStateBehavior */ \"./ts/mr/lively/states/LGenericRMMZStateBehavior.ts\");\r\nconst LItemImitatorBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LItemImitatorBehavior */ \"./ts/mr/lively/behaviors/LItemImitatorBehavior.ts\");\r\nconst LIllusionStateBehavior_1 = __webpack_require__(/*! ts/mr/lively/states/LIllusionStateBehavior */ \"./ts/mr/lively/states/LIllusionStateBehavior.ts\");\r\nconst LGrabFootBehavior_1 = __webpack_require__(/*! ../lively/abilities/LGrabFootBehavior */ \"./ts/mr/lively/abilities/LGrabFootBehavior.ts\");\r\nconst LEquipmentBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LEquipmentBehavior */ \"./ts/mr/lively/behaviors/LEquipmentBehavior.ts\");\r\nconst LRevivalItemBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LRevivalItemBehavior */ \"./ts/mr/lively/behaviors/LRevivalItemBehavior.ts\");\r\nconst LItemStandingState_1 = __webpack_require__(/*! ../lively/states/LItemStandingState */ \"./ts/mr/lively/states/LItemStandingState.ts\");\r\nconst LSelfExplosionBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LSelfExplosionBehavior */ \"./ts/mr/lively/behaviors/LSelfExplosionBehavior.ts\");\r\nconst LProjectileBehavior_1 = __webpack_require__(/*! ../lively/behaviors/activities/LProjectileBehavior */ \"./ts/mr/lively/behaviors/activities/LProjectileBehavior.ts\");\r\nconst LExperienceBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LExperienceBehavior */ \"./ts/mr/lively/behaviors/LExperienceBehavior.ts\");\r\n//import { LEaterBehavior } from \"../lively/behaviors/actors/LEaterBehavior\";\r\nconst LSurvivorBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LSurvivorBehavior */ \"./ts/mr/lively/behaviors/LSurvivorBehavior.ts\");\r\nconst LRaceBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LRaceBehavior */ \"./ts/mr/lively/behaviors/LRaceBehavior.ts\");\r\nconst LTrapBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LTrapBehavior */ \"./ts/mr/lively/behaviors/LTrapBehavior.ts\");\r\nconst LParamBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LParamBehavior */ \"./ts/mr/lively/behaviors/LParamBehavior.ts\");\r\nconst LRatedRandomAIBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LRatedRandomAIBehavior */ \"./ts/mr/lively/behaviors/LRatedRandomAIBehavior.ts\");\r\nconst LEntityDivisionBehavior_1 = __webpack_require__(/*! ../lively/abilities/LEntityDivisionBehavior */ \"./ts/mr/lively/abilities/LEntityDivisionBehavior.ts\");\r\nconst LSanctuaryBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LSanctuaryBehavior */ \"./ts/mr/lively/behaviors/LSanctuaryBehavior.ts\");\r\nconst LGlueToGroundBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LGlueToGroundBehavior */ \"./ts/mr/lively/behaviors/LGlueToGroundBehavior.ts\");\r\nconst LPreventionBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LPreventionBehavior */ \"./ts/mr/lively/behaviors/LPreventionBehavior.ts\");\r\nconst LGoldThiefBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LGoldThiefBehavior */ \"./ts/mr/lively/behaviors/LGoldThiefBehavior.ts\");\r\nconst LActivityCharmBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LActivityCharmBehavior */ \"./ts/mr/lively/behaviors/LActivityCharmBehavior.ts\");\r\nconst LGoldBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LGoldBehavior */ \"./ts/mr/lively/behaviors/LGoldBehavior.ts\");\r\nconst LEscapeBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LEscapeBehavior */ \"./ts/mr/lively/behaviors/LEscapeBehavior.ts\");\r\nconst LFlockBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LFlockBehavior */ \"./ts/mr/lively/behaviors/LFlockBehavior.ts\");\r\nconst LStorageBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LStorageBehavior */ \"./ts/mr/lively/behaviors/LStorageBehavior.ts\");\r\nconst LItemThiefBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LItemThiefBehavior */ \"./ts/mr/lively/behaviors/LItemThiefBehavior.ts\");\r\nconst LShopkeeperBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LShopkeeperBehavior */ \"./ts/mr/lively/behaviors/LShopkeeperBehavior.ts\");\r\nconst LCrackedBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LCrackedBehavior */ \"./ts/mr/lively/behaviors/LCrackedBehavior.ts\");\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ../data/MRData */ \"./ts/mr/data/MRData.ts\");\r\n;\r\nclass SBehaviorManager {\r\n /**\r\n * ゲーム開始時の初期化処理。DB にも登録するので、繰り返し呼び出してはならない。\r\n * @param fullName\r\n */\r\n static initialize() {\r\n this._behaviorEntries = [];\r\n this.register(\"kBehavior_Common\", \"LCommonBehavior\", \"Common\", LCommonBehavior_1.LCommonBehavior);\r\n this.register(\"kBehavior_Decision\", \"LDecisionBehavior\", \"Decision\", LDecisionBehavior_1.LDecisionBehavior);\r\n this.register(\"kBehavior_Unit\", \"LUnitBehavior\", \"Unit\", LUnitBehavior_1.LUnitBehavior);\r\n this.register(\"kBehavior_Inventory\", \"LInventoryBehavior\", \"Inventory\", LInventoryBehavior_1.LInventoryBehavior);\r\n this.register(\"kBehavior_ItemUser\", \"LItemUserBehavior\", \"_ItemUser\", LItemUserBehavior_1.LItemUserBehavior);\r\n this.register(\"kBehavior_Equipment\", \"LEquipmentBehavior\", \"Equipment\", LEquipmentBehavior_1.LEquipmentBehavior);\r\n this.register(\"kBehavior_EquipmentUser\", \"LEquipmentUserBehavior\", \"_EquipmentUser\", LEquipmentUserBehavior_1.LEquipmentUserBehavior);\r\n this.register(\"kBehavior_Actor\", \"LActorBehavior\", \"_Actor\", LActorBehavior_1.LActorBehavior);\r\n this.register(\"kBehavior_ExitPoint\", \"LExitPointBehavior\", \"_ExitPoint\", LExitPointBehavior_1.LExitPointBehavior);\r\n this.register(\"kBehavior_EntryPoint\", \"LEntryPointBehavior\", \"_EntryPoint\", LEntryPointBehavior_1.LEntryPointBehavior);\r\n this.register(\"kBehavior_Enemy\", \"LEnemyBehavior\", \"_Enemy\", LEnemyBehavior_1.LEnemyBehavior);\r\n this.register(\"kBehavior_GenericRMMZState\", \"LGenericRMMZStateBehavior\", \"_GenericRMMZState\", LGenericRMMZStateBehavior_1.LGenericRMMZStateBehavior);\r\n this.register(\"kBehavior_Item\", \"LItemBehavior\", \"_Item\", LItemBehavior_1.LItemBehavior);\r\n this.register(\"kBehavior_NapState\", \"LNapStateBehavior\", \"NapState\", LNapStateBehavior_1.LNapStateBehavior);\r\n this.register(\"kBehavior_ItemImitator\", \"LItemImitatorBehavior\", \"ItemImitator\", LItemImitatorBehavior_1.LItemImitatorBehavior);\r\n this.register(\"kBehavior_IllusionState\", \"LIllusionStateBehavior\", \"IllusionState\", LIllusionStateBehavior_1.LIllusionStateBehavior);\r\n this.register(\"kBehavior_GrabFoot\", \"LGrabFootBehavior\", \"FootBehavior\", LGrabFootBehavior_1.LGrabFootBehavior);\r\n this.register(\"kBehavior_RevivalItem\", \"LRevivalItemBehavior\", \"RevivalItem\", LRevivalItemBehavior_1.LRevivalItemBehavior);\r\n this.register(\"kBehavior_ItemStanding\", \"LItemStandingBehavior\", \"ItemStanding\", LItemStandingState_1.LItemStandingBehavior);\r\n this.register(\"kBehavior_Projectile\", \"LProjectileBehavior\", \"Projectile\", LProjectileBehavior_1.LProjectileBehavior);\r\n this.register(\"kBehavior_Experience\", \"LExperienceBehavior\", \"Experience\", LExperienceBehavior_1.LExperienceBehavior);\r\n this.register(\"kBehavior_Eater\", \"LEaterBehavior\", \"Eater\", LActorBehavior_1.LActorBehavior);\r\n this.register(\"kBehavior_Survivor\", \"LSurvivorBehavior\", \"Survivor\", LSurvivorBehavior_1.LSurvivorBehavior);\r\n this.register(\"kBehavior_Race\", \"LRaceBehavior\", \"Race\", LRaceBehavior_1.LRaceBehavior);\r\n this.register(\"kBehavior_Trap\", \"LTrapBehavior\", \"Trap\", LTrapBehavior_1.LTrapBehavior);\r\n this.register(\"kBehavior_Param\", \"LParamBehavior\", \"Param\", LParamBehavior_1.LParamBehavior);\r\n this.register(\"kBehavior_RatedRandomAI\", \"LRatedRandomAIBehavior\", \"RatedRandomAI\", LRatedRandomAIBehavior_1.LRatedRandomAIBehavior);\r\n this.register(\"kBehavior_EntityDivision\", \"LEntityDivisionBehavior\", \"EntityDivision\", LEntityDivisionBehavior_1.LEntityDivisionBehavior);\r\n this.register(\"kBehavior_Sanctuary\", \"LSanctuaryBehavior\", \"Sanctuary\", LSanctuaryBehavior_1.LSanctuaryBehavior);\r\n this.register(\"kBehavior_GlueToGround\", \"LGlueToGroundBehavior\", \"GlueToGround\", LGlueToGroundBehavior_1.LGlueToGroundBehavior);\r\n this.register(\"kBehavior_StumblePrevention\", \"LStumblePreventionBehavior\", \"StumblePrevention\", LPreventionBehavior_1.LStumblePreventionBehavior);\r\n this.register(\"kBehavior_GoldThief\", \"LGoldThiefBehavior\", \"GoldThief\", LGoldThiefBehavior_1.LGoldThiefBehavior);\r\n this.register(\"kBehavior_ActivityCharm\", \"LActivityCharmBehavior\", \"ActivityCharm\", LActivityCharmBehavior_1.LActivityCharmBehavior);\r\n this.register(\"kBehavior_Gold\", \"LGoldBehavior\", \"Gold\", LGoldBehavior_1.LGoldBehavior);\r\n this.register(\"kBehavior_Escape\", \"LEscapeBehavior\", \"Escape\", LEscapeBehavior_1.LEscapeBehavior);\r\n this.register(\"kBehavior_Flock\", \"LFlockBehavior\", \"Flock\", LFlockBehavior_1.LFlockBehavior);\r\n this.register(\"kBehavior_Storage\", \"LStorageBehavior\", \"Storage\", LStorageBehavior_1.LStorageBehavior);\r\n this.register(\"kBehavior_ItemThief\", \"LItemThiefBehavior\", \"ItemThief\", LItemThiefBehavior_1.LItemThiefBehavior);\r\n this.register(\"kBehavior_Shopkeeper\", \"LShopkeeperBehavior\", \"Shopkeeper\", LShopkeeperBehavior_1.LShopkeeperBehavior);\r\n this.register(\"kBehavior_CrackedBehavior\", \"LCrackedBehavior\", \"CrackedBehavior\", LCrackedBehavior_1.LCrackedBehavior);\r\n this.register(\"kBehavior_Knockback\", \"LKnockbackBehavior\", \"Knockback\", LKnockbackBehavior_1.LKnockbackBehavior);\r\n this.register(\"kBehavior_SelfExplosion\", \"LSelfExplosionBehavior\", \"SelfExplosion\", LSelfExplosionBehavior_1.LSelfExplosionBehavior);\r\n this.register(\"kBehavior_DebugMoveRight\", \"LDebugMoveRightBehavior\", \"DebugMoveRight\", LDebugMoveRight_1.LDebugMoveRightBehavior);\r\n }\r\n static register(key, fullName, friendlyName, ctor) {\r\n const data = MRData_1.MRData.getBehavior(key); //MRData.newBehavior(key, fullName, friendlyName);\r\n (0, Common_1.assert)(this._behaviorEntries[data.id] === undefined);\r\n this._behaviorEntries[data.id] = {\r\n dataId: data.id,\r\n create: () => new ctor(),\r\n };\r\n }\r\n /**\r\n * プログラム内で Behavior を作成する際のユーティリティです。\r\n */\r\n static addBehavior(target, ctor, ...args) {\r\n const behavior = new ctor();\r\n behavior.setup(...args);\r\n target.addBehavior(behavior);\r\n return behavior;\r\n }\r\n static attachBehaviors(entity, behaviors) {\r\n behaviors.forEach(info => {\r\n const b = this.createBehavior(info.data.fullName);\r\n if (b)\r\n entity._addBehavior(b);\r\n else\r\n throw new Error(`Behavior \"${info.data.fullName}\" that you tried to add to the entity \"${entity._name}\" is invalid.`);\r\n });\r\n }\r\n /*\r\n public static attachBehaviorsToState(state: LState, names: string[]): void {\r\n const behavior = new LGenericRMMZStateBehavior();\r\n REGame.world._registerBehavior(behavior);\r\n\r\n \r\n const behabiors: LStateTraitBehavior[] = [behavior];\r\n for (const behaviorName of state.stateData().behaviors) {\r\n const b = SBehaviorFactory.createBehavior(behaviorName) as LStateTraitBehavior;\r\n if (!b) throw new Error(`Behavior \"${behaviorName}\" specified in state \"${stateId}:${this.stateData().displayName}\" is invalid.`);\r\n behabiors.push(b);\r\n }\r\n\r\n\r\n names.forEach(name => {\r\n const b = this.createBehavior(name);\r\n if (b)\r\n entity._addBehavior(b);\r\n else\r\n throw new Error(`Behavior \"${name}\" that you tried to add to the entity \"${entity._name}\" is invalid.`);\r\n });\r\n }\r\n */\r\n static createBehavior(name) {\r\n const b = this.createBehaviorInstance(name);\r\n if (!b)\r\n return undefined;\r\n MRLively_1.MRLively.world._registerObject(b);\r\n return b;\r\n }\r\n static createBehaviorInstance(name) {\r\n const e = this._behaviorEntries.find(x => {\r\n if (!x)\r\n return false;\r\n const data = MRData_1.MRData.behavior[x.dataId];\r\n return data.fullName == name || data.friendlyName == name;\r\n });\r\n if (e) {\r\n return e.create();\r\n }\r\n else {\r\n return undefined;\r\n }\r\n }\r\n}\r\nexports.SBehaviorManager = SBehaviorManager;\r\n// Index is DBehaviorId.\r\nSBehaviorManager._behaviorEntries = [];\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/SBehaviorFactory.ts?"); /***/ }), /***/ "./ts/mr/system/SCommand.ts": /*!**********************************!*\ !*** ./ts/mr/system/SCommand.ts ***! \**********************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SSprinkleDropedCommand = exports.SItemReactionCommand = exports.SEndProjectileMovingCause = exports.SEndProjectileMovingCommand = exports.STestAddItemCommand = exports.STestTakeItemCommand = exports.SCommand = exports.checkContinuousResponse = exports.SPhaseResult = exports.SCommandResponse = void 0;\r\n/**\r\n * RECommand の処理結果\r\n *\r\n *\r\n *\r\n * NOTE:\r\n * Behavior の Command 実行処理は、直前の Behavior の Response 結果にかかわらず呼び出されます。\r\n * 直前の結果が Pass であるような前提を期待せず、基本的には\r\n * 「直前の Behavior の処理で Command が失敗したら、この Command も実行しない」といった判定を入れてください。\r\n * 例外は「武器を振るだけでステータスダウン」のような、Command の成否にかかわらず実行したい処理です。\r\n *\r\n */\r\nvar SCommandResponse;\r\n(function (SCommandResponse) {\r\n /**\r\n * 目的の処理を、意味のある結果を以って実行し終え、Command は実行済みであることを示します。\r\n *\r\n * Behavior の実装の中でこのコマンドを return した場合、後続の Behavior に Command は通知されません。\r\n */\r\n SCommandResponse[SCommandResponse[\"Handled\"] = 0] = \"Handled\";\r\n /** RECommand はハンドリングされませんでした。続けて後続の Behavior に RECommand を通知します。 */\r\n SCommandResponse[SCommandResponse[\"Pass\"] = 1] = \"Pass\";\r\n /** 状態異常の制限により、目的の処理を実行できなかったことを示します。後続の Behavior に RECommand は通知されません。 */\r\n SCommandResponse[SCommandResponse[\"Canceled\"] = 2] = \"Canceled\";\r\n //Aborted,\r\n /*\r\n デフォルトの動作をオーバーライドしたいケース\r\n - Behavior を additionalBehavior として追加する\r\n\r\n\r\n\r\n 全部 Behavior が Pass を返した場合は?\r\n - Entity は指定コマンドに対して無関心であるか、処理が想定されていない(未知のアクションである)ということ。\r\n この場合データ保護の観点から、コマンド発行側は「意味のないことをした」として処理しなければならない。\r\n 例えばアイテムっぽいものを拾おうとしたが、そのアイテムっぽいEntity が\r\n Pick アクションを処理できない (Pass を返した) 場合は、elona 的な「空気をつかんだ」にする。\r\n */\r\n})(SCommandResponse = exports.SCommandResponse || (exports.SCommandResponse = {}));\r\nvar SPhaseResult;\r\n(function (SPhaseResult) {\r\n /** Behavior Chain の実行を続ける。 */\r\n SPhaseResult[SPhaseResult[\"Pass\"] = 0] = \"Pass\";\r\n /** Behavior Chain の実行を終了する。 */\r\n SPhaseResult[SPhaseResult[\"Handled\"] = 1] = \"Handled\";\r\n})(SPhaseResult = exports.SPhaseResult || (exports.SPhaseResult = {}));\r\nfunction checkContinuousResponse(r) {\r\n return r == SCommandResponse.Pass;\r\n}\r\nexports.checkContinuousResponse = checkContinuousResponse;\r\n// export enum SCommandResolveMode {\r\n// /**\r\n// * Command は Behavior に対して、処理の許可を問い合わせるものであることを示す。\r\n// * \r\n// * onCommand() では、\r\n// * - accept() を呼び出すと、postCommand() の後続 Task が続行される。\r\n// * - accept() が一度も呼ばれない場合、postCommand() の後続 Task は実行されない。\r\n// */\r\n// Accept,\r\n// /**\r\n// * Command は Behavior に対して、処理の拒否を問い合わせるものであることを示す。\r\n// * \r\n// * onCommand() では、\r\n// * - reject() を呼び出すと、postCommand() の後続 Task は続行されない。\r\n// * - reject() が一度も呼ばれない場合、postCommand() の後続 Task が実行される。\r\n// */\r\n// Reject,\r\n// }\r\n/**\r\n * onCommand の引数。\r\n *\r\n * LActivity と似ているが、こちらは Recoding 対象外。シリアライズされるものではない。\r\n * LActivity は意思決定の履歴と考えることができる。対して SCommand は単純な引数のセットである。\r\n *\r\n * Entity の行動ではなく、 GUI フレームワークでよくあるイベントのようなものであると考えるとわかりやすいかもしれない。\r\n * 例えばメニューを実行するコマンドはよく使うが、それと同じ仕組みで、メニューの実行自体ができるかどうかをチェックするコマンドもある。\r\n *\r\n * [2023/4/5]\r\n * ----------\r\n * Data に Command 持たせて CommandId で運用していたが、継承ベースに変更した。\r\n * 理由は、\r\n * - コマンドに紐づく引数がわかりやすい。\r\n * - 元の DCommand 実装時から時間が経ったが、 DB 化する利点があまり思いつかなかった。\r\n *\r\n * 将来的なこととして、 Command じゃなくて Query という名前の方がいいかも知しれない。\r\n * 今の Command の用途は何か実行させるだけではなく、実行できるかどうかを確認するために使うこともある。\r\n */\r\nclass SCommand {\r\n constructor(receiver, acceptRequired) {\r\n this.receiver = receiver;\r\n this.acceptRequired = acceptRequired;\r\n //this.target = target;\r\n //this._objects = [];\r\n }\r\n // public get objects(): readonly LEntity[] {\r\n // return this._objects;\r\n // }\r\n // public withObject(object: LEntity): this {\r\n // this._objects = [object];\r\n // return this;\r\n // }\r\n // public withObjects(objects: readonly LEntity[]): this {\r\n // this._objects = objects;\r\n // return this;\r\n // }\r\n *onExecute(entity, cctx) {\r\n }\r\n}\r\nexports.SCommand = SCommand;\r\n/**\r\n * Item (target) を、今ある場所 (Owner) から取り出せるかテストする。\r\nMRBasics.commands.testPickOutItem\r\n */\r\nclass STestTakeItemCommand extends SCommand {\r\n constructor(item, actor) {\r\n super(item, false);\r\n this.actor = actor;\r\n }\r\n}\r\nexports.STestTakeItemCommand = STestTakeItemCommand;\r\n/**\r\n * Item (target) を、Owner (actor) へ追加できるかテストする。\r\n * MRBasics.commands.testPutInItem\r\n */\r\nclass STestAddItemCommand extends SCommand {\r\n constructor(entity, item) {\r\n super(entity, true);\r\n this.item = item;\r\n }\r\n}\r\nexports.STestAddItemCommand = STestAddItemCommand;\r\nclass SEndProjectileMovingCommand extends SCommand {\r\n constructor(receiver, cause) {\r\n super(receiver, false);\r\n this.cause = cause;\r\n }\r\n}\r\nexports.SEndProjectileMovingCommand = SEndProjectileMovingCommand;\r\nvar SEndProjectileMovingCause;\r\n(function (SEndProjectileMovingCause) {\r\n SEndProjectileMovingCause[SEndProjectileMovingCause[\"Fall\"] = 0] = \"Fall\";\r\n SEndProjectileMovingCause[SEndProjectileMovingCause[\"NoPassage\"] = 1] = \"NoPassage\";\r\n SEndProjectileMovingCause[SEndProjectileMovingCause[\"HitToEntity\"] = 2] = \"HitToEntity\";\r\n})(SEndProjectileMovingCause = exports.SEndProjectileMovingCause || (exports.SEndProjectileMovingCause = {}));\r\n/*\r\n[2023/4/19] SystemAction と ItemAction(仮) に分けたほうが良いのでは?\r\n----------\r\n\r\nItemAction は、 Entity の Reaction に指定できるもの。\r\n今 LItemBehavior が持っているようなのが対象で、次のようなものがある。\r\n- 食べる\r\n- 読む\r\n- 振る\r\n- 衝突する\r\nこれらは subject,target,item が必要であり、Reaction にて Effect を発動できるなど、ほぼフレームワーク化できる。\r\n考え方としては、「subject が target へ item を action させる」という具合。\r\n- Player が Player へ Item を 食べさせる\r\n- Player が Enemy へ Item を 衝突させる\r\n\r\n対して、次のようなものは Reaction を伴うようなものではない。\r\n- 移動する\r\n- (NPCと)話す\r\n- (罠で)転ぶ\r\n- スキルを発動する\r\n- (足元のアイテムを)拾う\r\n- (足元のアイテムと)交換する\r\n強引に伴わせることもできるし今はそうなっているが、このため処理のイメージが非常につかみにくくなっている。\r\n\r\nItem を伴う Activity はいったん全部 ItemAction にしてもよいかもしれない。\r\n- 拾う\r\n- 交換する\r\n- 投げる\r\nこのあたりも Item を伴う。\r\n\r\n*/\r\nclass SItemReactionCommand extends SCommand {\r\n constructor(itemActionId, item, target, objects, subject, direction) {\r\n super(item, false);\r\n this.itemActionId = itemActionId;\r\n this.item = item;\r\n this.target = target;\r\n this.objects = [...objects];\r\n this.subject = subject;\r\n this.direction = direction;\r\n }\r\n}\r\nexports.SItemReactionCommand = SItemReactionCommand;\r\n/**\r\n * 罠などで転びバラまかれた Item に対して通知するコマンド。\r\n *\r\n * 転ばぬ先の杖や、モンスターが転び石にかかったときなど、いわゆる「アイテムドロップ」の時は発生しない。\r\n * このコマンドでは、壺などのアイテムが割れる可能性がある。\r\n */\r\nclass SSprinkleDropedCommand extends SCommand {\r\n constructor(item) {\r\n super(item, false);\r\n this.item = item;\r\n }\r\n}\r\nexports.SSprinkleDropedCommand = SSprinkleDropedCommand;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/SCommand.ts?"); /***/ }), /***/ "./ts/mr/system/SCommandContext.ts": /*!*****************************************!*\ !*** ./ts/mr/system/SCommandContext.ts ***! \*****************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SCommandContext = exports.HandleActivityCommand = exports.SHandleCommandResult = void 0;\r\nconst SCommand_1 = __webpack_require__(/*! ./SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst SSequel_1 = __webpack_require__(/*! ./SSequel */ \"./ts/mr/system/SSequel.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ./MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst SActivityPlaybackDialog_1 = __webpack_require__(/*! ts/mr/system/dialogs/SActivityPlaybackDialog */ \"./ts/mr/system/dialogs/SActivityPlaybackDialog.ts\");\r\nconst LUnitBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LUnitBehavior */ \"./ts/mr/lively/behaviors/LUnitBehavior.ts\");\r\nconst SActivityContext_1 = __webpack_require__(/*! ./SActivityContext */ \"./ts/mr/system/SActivityContext.ts\");\r\nconst STask_1 = __webpack_require__(/*! ./tasks/STask */ \"./ts/mr/system/tasks/STask.ts\");\r\nconst SSoundManager_1 = __webpack_require__(/*! ./SSoundManager */ \"./ts/mr/system/SSoundManager.ts\");\r\nvar SHandleCommandResult;\r\n(function (SHandleCommandResult) {\r\n SHandleCommandResult[SHandleCommandResult[\"Resolved\"] = 0] = \"Resolved\";\r\n SHandleCommandResult[SHandleCommandResult[\"Rejected\"] = 1] = \"Rejected\";\r\n})(SHandleCommandResult = exports.SHandleCommandResult || (exports.SHandleCommandResult = {}));\r\nclass HandleActivityCommand {\r\n then(func) {\r\n this._thenFunc = func;\r\n return this;\r\n }\r\n catch(func) {\r\n this._catchFunc = func;\r\n return this;\r\n }\r\n}\r\nexports.HandleActivityCommand = HandleActivityCommand;\r\n/**\r\n *\r\n * 基本的な使い方\r\n * ----------\r\n *\r\n * 次のようにすることで、 Task を積むことができる。\r\n * ```\r\n * ctx.post(...);\r\n * ctx.post(...);\r\n * ctx.post(...);\r\n * ```\r\n *\r\n * post の実行順序\r\n * ----------\r\n *\r\n * ```\r\n * ctx.post(_ => { // A\r\n * ctx.post(...); // B\r\n * });\r\n * ctx.post(_ => { // C\r\n * ctx.post(...); // D\r\n * });\r\n * ctx.post(...); // E\r\n * ```\r\n *\r\n * この場合、まず [A, C, E] のような TaskList ができる。\r\n * これを実行した結果、次に [B, D] のような TaskList ができる。\r\n * 結果的に Task の実行順は A > C > E > B > D となる。\r\n *\r\n * このケースの場合、事前の Task の結果によって実行の可否を制御することはできない。\r\n * つまり一度 TaskList に積まれた Task は、必ず実行される。\r\n *\r\n * 条件を付けたい場合は次の then, catch を使用する。\r\n *\r\n * then, catch\r\n * ----------\r\n *\r\n * then, catch を使うことで、post した Task の成否に応じて実行する処理をチェーンできる。\r\n * ```\r\n * ctx.post(...)\r\n * .then() // 1つ目の post の処理が成功したら実行される\r\n * .catch(); // 1つ目の post の処理が失敗したら実行される\r\n * ctx.post(...); // 上記成否にかかわらず実行される。\r\n * ctx.post(...);\r\n * ```\r\n * then, catch の処理は、起点となる Task と同一の TaskList 上で実行される。\r\n * 例えば上記の場合、2つ目の post の前に実行される。\r\n *\r\n * then は新たな Task を生成して返すが、catch は this を返す。\r\n * メソッドチェーンを書きたい場合は、catch を先に書くのが無難。\r\n *\r\n * ```\r\n * ctx.post(A)\r\n * .catch(A失敗)\r\n * .then(B)\r\n * .catch(B失敗)\r\n * .then(C)\r\n * ```\r\n *\r\n * finally\r\n * ----------\r\n *\r\n * 成否にかかわらず、SubTaskChain の最後に必ず実行したい処理を finally で追加できる。\r\n * ```\r\n * ctx.post(onAnyAction)\r\n * .then(...)\r\n * .catch(...)\r\n * .finally(_ => {\r\n *\r\n * });\r\n * ```\r\n *\r\n * エラー時に実行される then と catch\r\n * ----------\r\n *\r\n * エラーした場合、\r\n * - 以降の then は呼ばれない。\r\n * - 以降の、直近の catch 1つが呼ばれる。\r\n *\r\n * ```\r\n * ctx.post(A)\r\n * .catch(A失敗)\r\n * .then(B) // ここで失敗したら、\r\n * .then(C)\r\n * .catch(B失敗) // この catch だけが実行される。\r\n * .then(D) // これは呼ばれない。\r\n * .catch(失敗) // これは呼ばれない。\r\n *\r\n * resolve と reject\r\n * ----------\r\n *\r\n * Promise 同様、実行関数は次の形が基本となる。\r\n *\r\n * ```\r\n * (c) => {\r\n * if (成功) {\r\n * c.resolve();\r\n * }\r\n * else {\r\n * c.reject();\r\n * }\r\n * }\r\n * ```\r\n *\r\n * デフォルトは resolve とする。 Behavior 側にコマンドハンドラが1つも無い場合はエラーにせず先に進みたい。\r\n * resolve() したら、その時点でチェインされている Task を Priority に設定する。\r\n * つまり、\r\n * ```\r\n * ctx.post(...) // A\r\n * c.resolve(); // B(呼び出し元の then)\r\n * ctx.post(...) // C\r\n * ```\r\n * このような場合、実行順は B > A > C となる。\r\n *\r\n * 順序通りにしたい場合、次のような postResolve を作るのもありかもしれない。(使うかわからないので未対応)\r\n * ```\r\n * ctx.post(...) // A\r\n * ctx.postResolve(c); // B(呼び出し元の then)\r\n * ctx.post(...) // C\r\n * ```\r\n *\r\n * Behavior 側のコマンドハンドラ側の制限事項・注意点\r\n * ----------\r\n *\r\n * 誤用防止のため、resolve, reject は1度しか呼び出すことはできない。\r\n * コマンドハンドラは次のように Handled を返し、後続のコマンドハンドラの呼び出しを抑制しなければならない。\r\n * ```\r\n * onAnyAction(c) {\r\n * if (...) {\r\n * c.resolve();\r\n * return Handled;\r\n * }\r\n * else {\r\n * c.reject();\r\n * return Handled;\r\n * }\r\n * else {\r\n * return Pass;\r\n * }\r\n * }\r\n * ```\r\n *\r\n * コマンドハンドラ側で Dialog 表示を伴う際の基本的な書き方は次のようになる。\r\n * ```\r\n * onAnyAction(c) {\r\n * ctx.postDialog(..., _ => {\r\n * if (...) {\r\n * c.resolve();\r\n * }\r\n * else {\r\n * c.reject();\r\n * }\r\n * });\r\n * return Handled;\r\n * }\r\n * ```\r\n * resolve() や reject() は遅延実行の形になるが実行はされるので、 Handled を返すべきである。\r\n *\r\n *\r\n */\r\nclass SCommandContext {\r\n constructor(sequelContext) {\r\n this._recodingCommandList = [];\r\n this._runningCommandList = [];\r\n this._afterChainCommandList = [];\r\n this._messageIndex = 0;\r\n this._commandChainRunning = false;\r\n this.__whenWaitingTasks = [];\r\n this._subTaskChainStack = [];\r\n this._sequelContext = sequelContext;\r\n }\r\n pushSubTaskChain(c) {\r\n this._subTaskChainStack.push(c);\r\n }\r\n popSubTaskChain(c) {\r\n (0, Common_1.assert)(this._subTaskChainStack[this._subTaskChainStack.length - 1] == c);\r\n this._subTaskChainStack.push(c);\r\n }\r\n get currentSubTaskChain() {\r\n return this._subTaskChainStack.length > 0 ? this._subTaskChainStack[this._subTaskChainStack.length - 1] : undefined;\r\n }\r\n get isRunning() {\r\n return this._nextPriorityTask != undefined ||\r\n this._messageIndex < this._runningCommandList.length ||\r\n this._recodingCommandList.length != 0 ||\r\n this._afterChainCommandList.length != 0 ||\r\n this.__whenWaitingTasks.length != 0;\r\n }\r\n get isRecordingListEmpty() {\r\n return this._recodingCommandList.length == 0;\r\n }\r\n get isEmpty() {\r\n return !this.isRunning && this.isRecordingListEmpty;\r\n }\r\n // マップ切り替え時に実行\r\n clear() {\r\n this._recodingCommandList = [];\r\n this._runningCommandList = [];\r\n this._messageIndex = 0;\r\n this._commandChainRunning = false;\r\n }\r\n get dialogContext() {\r\n return MRSystem_1.MRSystem.dialogContext;\r\n }\r\n random() {\r\n return MRLively_1.MRLively.world.random();\r\n }\r\n checkOpenDialogRequired() {\r\n return this._recodingCommandList.find(x => x._name == \"openDialog\") !== undefined;\r\n }\r\n // TODO: private. 同期的な実行なのでこれを読んだ後に c が何らかの結果を持っていることを期待してはならない。\r\n // public callCommand(c: SSubTaskChain, cmd: SCommand): void {\r\n // // if (result == SCommandResponse.Pass) {\r\n // // c.next();\r\n // // }\r\n // }\r\n makeTask(action) {\r\n const task = new STask_1.STask(\"Task\", undefined);\r\n task._callMethod = STask_1.STaskCallMethod.Then;\r\n task._thenFunc2 = action;\r\n task._subChain = new STask_1.SSubTaskChain(this, task);\r\n return task;\r\n }\r\n makeCommandTask(cmd) {\r\n const task = new STask_1.STask(\"Task\", undefined);\r\n task._callMethod = STask_1.STaskCallMethod.Iterator;\r\n task._subChain = new STask_1.SSubTaskChain(this, task);\r\n task._subChain.hold();\r\n const c = task._subChain;\r\n const cctx = this;\r\n task._iterator = function* () {\r\n // まずは普通に、onCommand() を呼び出すチェーンを作る\r\n const behaviors = [];\r\n cmd.receiver.iterateBehaviorsReverse(b => behaviors.push(b));\r\n for (const b of behaviors) {\r\n yield* b.onCommand(cmd.receiver, cctx, cmd);\r\n }\r\n // 最後に DefaultHandler を差し込む\r\n yield* cmd.onExecute(cmd.receiver, cctx);\r\n }();\r\n task._onIteratorFinalized = (result) => {\r\n if (cmd.acceptRequired) {\r\n // finally で結果を判断する。明示的に accept() されたら次の Task へ進む。\r\n if (result == STask_1.STaskYieldResult.Accept) {\r\n c.next();\r\n }\r\n else {\r\n c.handleInternal(STask_1.STaskResult.Reject);\r\n }\r\n }\r\n else {\r\n // チェーンの最後にタスクを付ける。ここまでたどり着けば自動的に成功扱い。次の Task へ進む。\r\n if (result == STask_1.STaskYieldResult.Success) {\r\n c.next();\r\n }\r\n // 最後に catch. ここに来たら次の Task へは進めない。\r\n else {\r\n c.handleInternal(STask_1.STaskResult.Reject);\r\n }\r\n }\r\n };\r\n task.command = cmd;\r\n return task;\r\n }\r\n postTask2(task) {\r\n this.pushRecodingCommandList(task);\r\n return task;\r\n }\r\n postTask(action) {\r\n const task = this.makeTask(action);\r\n this.postTask2(task);\r\n return task;\r\n }\r\n postCommandTask(cmd) {\r\n const task = this.makeCommandTask(cmd);\r\n this.postTask2(task);\r\n return task;\r\n }\r\n whenAll(tasks) {\r\n const task = new STask_1.STask(\"Task\", undefined);\r\n task._callMethod = STask_1.STaskCallMethod.Then;\r\n task._subChain = new STask_1.SSubTaskChain(this, task);\r\n task._callMethod = STask_1.STaskCallMethod.When;\r\n task._whenWaitingTasks = tasks;\r\n this.__whenWaitingTasks.push(task);\r\n task._status = STask_1.STaskStatus.Pending;\r\n return task;\r\n }\r\n postConsumeActionToken(entity, tokenType) {\r\n const behavior = entity.findEntityBehavior(LUnitBehavior_1.LUnitBehavior);\r\n (0, Common_1.assert)(behavior);\r\n entity._actionToken.verify(tokenType);\r\n const m1 = () => {\r\n Common_1.Log.doCommand(\"ConsumeActionToken\");\r\n this.attemptConsumeActionToken(entity, tokenType);\r\n return SCommand_1.SCommandResponse.Handled;\r\n };\r\n this.pushRecodingCommandList(new STask_1.STask(\"ConsumeActionToken\", m1));\r\n Common_1.Log.postCommand(\"ConsumeActionToken\");\r\n }\r\n /*\r\n [2022/5/28] postActivity vs postCall(メソッド直接コール) vs post(シンボル)\r\n ----------\r\n ### postActivity\r\n - 例えば Move は 3-Way する必要はない。\r\n - でも、逆に言えば今のところ、Move 以外は 3-Way する余地はある。\r\n - 引数は any を使う必要がある。\r\n \r\n ### postCall(メソッド直接コール)\r\n - 引数を柔軟に決められる。TurnEnd など、フレームワークで決められたタイミングを通知するために使うべき。\r\n\r\n ### post(シンボル)\r\n - 引数は any を使う必要がある。\r\n - 現時点までで作ったシンボルを見ると、上記2つに統合してもよさそう。\r\n - Activity から別の Activity を投げるのは OK(ゲイズのあやつりなど)なので、シンボル使う意味も薄くなってきてる。\r\n - 必要そうなのは test 系。つまり、複数の Activity から使いたい共通のハンドシェイク。\r\n - test 系の統合は難しい。例えば今は testPickOutItem でアイテムをその場から取り出せるかをチェックするが、\r\n 統合するなら Reaction 側で取り出す系の Activity 全てに反応しなければならない。\r\n 当然ながら、拡張性が乏しくなる。\r\n - 今の 聖域の巻物の onActivityPreReaction も危険。\r\n - onWalkedOnTopAction も共通処理か。Move や Fall など、地面上を移動したときの共通処理。\r\n\r\n ### SActivityContext にシンボルも混ぜてあげる案\r\n \r\n\r\n */\r\n postActivity(srcActivity, withPreprocess = true) {\r\n let activity = srcActivity;\r\n if (withPreprocess) {\r\n for (const b of srcActivity.actor().collectBehaviors().reverse()) {\r\n activity = b.onPreprocessActivity(this, activity);\r\n }\r\n }\r\n if (activity.isConsumeAction()) {\r\n activity.actor()._actionToken.verify(activity.getConsumeActionTokenType());\r\n }\r\n const actx = new SActivityContext_1.SActivityContext(srcActivity);\r\n const m1 = () => {\r\n Common_1.Log.doCommand(\"Activity\");\r\n if (activity.isConsumeAction()) {\r\n const entity = activity.actor();\r\n this.attemptConsumeActionToken(entity, activity.getConsumeActionTokenType());\r\n }\r\n const r = activity.actor()._sendActivity(this, actx);\r\n // if (r != SCommandResponse.Canceled) { // TODO: ここ Succeeded のほうがいいかも\r\n // if (activity.hasObject()) {\r\n // this.postCall(() => {\r\n // activity.object()._sendActivityReaction(this, activity);\r\n // });\r\n // }\r\n // }\r\n if (r == SCommand_1.SCommandResponse.Pass) {\r\n if (actx._catchFunc)\r\n actx._catchFunc();\r\n }\r\n return r;\r\n };\r\n this.pushRecodingCommandList(new STask_1.STask(\"Activity\", m1));\r\n Common_1.Log.postCommand(\"Activity\");\r\n return actx;\r\n }\r\n attemptConsumeActionToken(entity, tokenType) {\r\n const consumedType = entity._actionToken.consume(tokenType);\r\n entity._schedulingResult.setConsumedActionTokeInCurrentPhase(consumedType);\r\n // ターンエンド\r\n {\r\n //const entity = REGame.scheduler.currentTurnEntity();\r\n //if (entity) {\r\n // 風来のシレン Wiki の行動順ではそれぞれ Phase が分かれているように見えるが、\r\n // 実際のステート更新は、各 step の終了時で行われるべき。\r\n //\r\n // 例えば倍速 Enemy の場合、次のような順で処理が動いてほしい。\r\n // - 敵行動\r\n // - 混乱解除判定\r\n // - 敵行動\r\n // - 混乱解除判定\r\n // \r\n // これを阻害する可能性として、Scheduler.md にまとめている「Run のマージ」という仕組みがある。\r\n // ステート更新を SSchedulerPhase にしてしまうと、\r\n // - 敵行動\r\n // - 敵行動\r\n // - 混乱解除判定\r\n // - 混乱解除判定\r\n // という順で実行されてしまう。\r\n //\r\n // そのため onTurnEnd のタイミングでステート更新をかける。\r\n //\r\n entity._effectResult.clear(); // TODO: 仮\r\n entity.params.updateBuffs(entity);\r\n //entity._effectResult.showResultMessages(RESystem.commandContext, entity); // TODO: 仮\r\n MRSystem_1.MRSystem.integration.flushEffectResultOneEntity(entity);\r\n //entity._callDecisionPhase(RESystem.commandContext, DecisionPhase.UpdateState);\r\n // REGame.scheduler.clearCurrentTurnEntity();\r\n //}\r\n }\r\n }\r\n /** @deprecated use postCommandTask() */\r\n callSymbol(target, sender, subject, args, symbol) {\r\n const response = target._callBehaviorIterationHelper((behavior) => {\r\n const func = behavior[symbol];\r\n if (func) {\r\n const args2 = { self: target, sender: sender, subject: subject, args: args };\r\n const r1 = func.call(behavior, args2, this);\r\n return r1;\r\n }\r\n else {\r\n return SCommand_1.SCommandResponse.Pass;\r\n }\r\n });\r\n return response;\r\n }\r\n // TODO: sender っていうのがすごくわかりづらい。\r\n // target と sender は基本的に self で同一なのでそうして、\r\n // こうかてきようさきにしたいものを target として引数整理したほうがよさそう。\r\n /** @deprecated use postCommandTask() */\r\n post(target, sender, subject, args, symbol, result) {\r\n const m1 = () => {\r\n const response = this.callSymbol(target, sender, subject, args, symbol);\r\n if (response != SCommand_1.SCommandResponse.Canceled) {\r\n // コマンドが処理されなかった\r\n if (result) {\r\n result();\r\n }\r\n }\r\n return response;\r\n };\r\n this.pushRecodingCommandList(new STask_1.STask(\"Post\", m1));\r\n Common_1.Log.postCommand(\"Post\");\r\n return this._recodingCommandList[this._recodingCommandList.length - 1];\r\n }\r\n postCall(func) {\r\n const m1 = () => {\r\n Common_1.Log.doCommand(\"Call\");\r\n func();\r\n return SCommand_1.SCommandResponse.Handled;\r\n };\r\n this.pushRecodingCommandList(new STask_1.STask(\"Call\", m1));\r\n Common_1.Log.postCommand(\"Call\");\r\n return this._recodingCommandList[this._recodingCommandList.length - 1];\r\n }\r\n openDialog(causeEntity, dialogModel, afterChain) {\r\n const m1 = () => {\r\n Common_1.Log.doCommand(\"OpenDialog\");\r\n MRSystem_1.MRSystem.dialogContext.setCauseEntity(causeEntity);\r\n if (MRLively_1.MRLively.recorder.isPlayback()) {\r\n MRSystem_1.MRSystem.dialogContext.open(new SActivityPlaybackDialog_1.SActivityPlaybackDialog());\r\n }\r\n else {\r\n MRSystem_1.MRSystem.dialogContext.open(dialogModel);\r\n }\r\n return SCommand_1.SCommandResponse.Handled;\r\n };\r\n if (afterChain)\r\n this.pushAfterChainCommandList(new STask_1.STask(\"openDialog\", m1));\r\n else\r\n this.pushRecodingCommandList(new STask_1.STask(\"openDialog\", m1));\r\n Common_1.Log.postCommand(\"openDialog\");\r\n return dialogModel;\r\n }\r\n displayFlavorEffect(entity, flavorEffect, options) {\r\n if (flavorEffect) {\r\n if (flavorEffect.text) {\r\n for (const t of flavorEffect.text) {\r\n this.postMessage(t.format(...options.messageFormatArgs));\r\n }\r\n }\r\n if (flavorEffect.sound) {\r\n SSoundManager_1.SSoundManager.playSe(flavorEffect.sound);\r\n }\r\n if (flavorEffect.rmmzAnimationId > 0) {\r\n this.postAnimation(entity, flavorEffect.rmmzAnimationId, false);\r\n }\r\n if (flavorEffect.motionId > 0) {\r\n this.postSequel(entity, flavorEffect.motionId, undefined, undefined, options.motionObjectEntity);\r\n }\r\n }\r\n }\r\n postSequel(entity, sequelId, targetX, targetY, args) {\r\n (0, Common_1.assert)(sequelId > 0);\r\n const tx = targetX !== null && targetX !== void 0 ? targetX : entity.mx;\r\n const ty = targetY !== null && targetY !== void 0 ? targetY : entity.my;\r\n const s = new SSequel_1.SMotionSequel(entity, sequelId, tx, ty, args);\r\n const m1 = () => {\r\n Common_1.Log.doCommand(\"Sequel\");\r\n this._sequelContext.addSequel(s);\r\n return SCommand_1.SCommandResponse.Handled;\r\n };\r\n this.pushRecodingCommandList(new STask_1.STask(\"Sequel\", m1));\r\n Common_1.Log.postCommand(\"Sequel\");\r\n return s;\r\n }\r\n // 動きを伴わず、Animation だけ表示するのに使う。 Sequel 作るまでもないものとか。\r\n postAnimation(entity, animationId, wait) {\r\n if (animationId <= 0)\r\n return;\r\n const m1 = () => {\r\n Common_1.Log.doCommand(\"Animation\");\r\n this._sequelContext.addSequel(new SSequel_1.SAnumationSequel(entity, animationId, wait));\r\n return SCommand_1.SCommandResponse.Handled;\r\n };\r\n this.pushRecodingCommandList(new STask_1.STask(\"Animation\", m1));\r\n Common_1.Log.postCommand(\"Animation\");\r\n }\r\n postFloatingAnimation(entity, mx, my, rmmzAnimationId, wait) {\r\n if (rmmzAnimationId <= 0)\r\n return;\r\n const m1 = () => {\r\n Common_1.Log.doCommand(\"Animation\");\r\n this._sequelContext.addSequel(new SSequel_1.SFloatingAnumationSequel(entity, rmmzAnimationId, mx, my, wait));\r\n return SCommand_1.SCommandResponse.Handled;\r\n };\r\n this.pushRecodingCommandList(new STask_1.STask(\"Animation\", m1));\r\n Common_1.Log.postCommand(\"Animation\");\r\n }\r\n postBalloon(entity, balloonId, wait) {\r\n if (balloonId <= 0)\r\n return;\r\n const m1 = () => {\r\n Common_1.Log.doCommand(\"Balloon\");\r\n this._sequelContext.addSequel(new SSequel_1.SBalloonSequel(entity, balloonId, wait));\r\n return SCommand_1.SCommandResponse.Handled;\r\n };\r\n this.pushRecodingCommandList(new STask_1.STask(\"Balloon\", m1));\r\n Common_1.Log.postCommand(\"Balloon\");\r\n }\r\n postWaitSequel() {\r\n const m1 = () => {\r\n Common_1.Log.doCommand(\"WaitSequel\");\r\n this._sequelContext.flushSequelSet(true);\r\n return SCommand_1.SCommandResponse.Handled;\r\n };\r\n this.pushRecodingCommandList(new STask_1.STask(\"WaitSequel\", m1));\r\n Common_1.Log.postCommand(\"WaitSequel\");\r\n }\r\n postWait(entity, waitCount) {\r\n const m1 = () => {\r\n Common_1.Log.doCommand(\"Wait\");\r\n this._sequelContext.addSequel(new SSequel_1.SWaitSequel(entity, waitCount));\r\n return SCommand_1.SCommandResponse.Handled;\r\n };\r\n this.pushRecodingCommandList(new STask_1.STask(\"Wait\", m1));\r\n Common_1.Log.postCommand(\"Wait\");\r\n }\r\n postEmitEffect(entity, actionId, subject, target, dir) {\r\n const m1 = () => {\r\n entity.iterateBehaviorsReverse(b => {\r\n const r = b.onEmitEffect(entity, this, actionId, subject, target, dir);\r\n return r == SCommand_1.SCommandResponse.Pass;\r\n });\r\n return SCommand_1.SCommandResponse.Pass;\r\n };\r\n this.pushRecodingCommandList(new STask_1.STask(\"ApplyEffect\", m1));\r\n Common_1.Log.postCommand(\"ApplyEffect\");\r\n }\r\n postDestroy(entity) {\r\n const m1 = () => {\r\n Common_1.Log.doCommand(\"Destroy\");\r\n // 消滅時に何かアニメーションを再生したいとき、postAnimation() と postDestroy() を連続で実行することがある。\r\n // その場合 flush しておかないと、先に GC で Entity の消滅と Sprite の消滅が先に行われ、アニメーションが表示されない。\r\n //this._sequelContext.flushSequelSet();\r\n entity.destroy();\r\n return SCommand_1.SCommandResponse.Handled;\r\n };\r\n this.pushRecodingCommandList(new STask_1.STask(\"Destroy\", m1));\r\n Common_1.Log.postCommand(\"Destroy\");\r\n }\r\n postMessage(text) {\r\n (0, Common_1.assert)(text); // 空メッセージが来るときは何かおかしいことが多いのでガードしておく\r\n const m1 = () => {\r\n Common_1.Log.doCommand(\"Message\");\r\n MRLively_1.MRLively.messageHistory.add(text);\r\n return SCommand_1.SCommandResponse.Handled;\r\n };\r\n this.pushRecodingCommandList(new STask_1.STask(\"Message\", m1));\r\n Common_1.Log.postCommand(\"Message\");\r\n }\r\n postEffectResult(entity) {\r\n const m1 = () => {\r\n if (entity)\r\n MRSystem_1.MRSystem.integration.flushEffectResultOneEntity(entity);\r\n else\r\n MRSystem_1.MRSystem.integration.flushEffectResult();\r\n return SCommand_1.SCommandResponse.Handled;\r\n };\r\n this.pushRecodingCommandList(new STask_1.STask(\"EffectResult\", m1));\r\n }\r\n /**\r\n * フロア移動\r\n * @param entity\r\n * @param floorId\r\n * @param x\r\n * @param y\r\n * @param d\r\n */\r\n postTransferFloor(entity, floorId, x = 0, y = 0, d = 0) {\r\n const m1 = () => {\r\n Common_1.Log.doCommand(\"TransferFloor\");\r\n MRLively_1.MRLively.world.transferEntity(entity, floorId, x, y);\r\n return SCommand_1.SCommandResponse.Handled;\r\n };\r\n this.pushRecodingCommandList(new STask_1.STask(\"TransferFloor\", m1));\r\n Common_1.Log.postCommand(\"TransferFloor\");\r\n }\r\n _processCommand() {\r\n if (this._nextPriorityTask) {\r\n // 優先タスクがあるので、swap は今回は待つ\r\n }\r\n else {\r\n if (this._messageIndex >= this._runningCommandList.length) {\r\n if (this._recodingCommandList.length > 0 || this._afterChainCommandList.length > 0 || this.__whenWaitingTasks.length > 0) {\r\n this._submit();\r\n }\r\n else {\r\n }\r\n }\r\n else {\r\n }\r\n }\r\n if (this.isRunning) {\r\n // 今回実行したい Task は?\r\n const task = this._nextPriorityTask ? this._nextPriorityTask : this._runningCommandList[this._messageIndex];\r\n this._nextPriorityTask = undefined;\r\n // Task 実行\\\r\n (0, Common_1.assert)(task);\r\n if (task.call(this)) {\r\n return;\r\n }\r\n // ここまでで、最後に実行した Task の nextTask が無ければ、TaskList にある次の Task へ進む\r\n if (!this._nextPriorityTask) {\r\n if (this._commandChainRunning) {\r\n this._messageIndex++;\r\n if (this._messageIndex >= this._runningCommandList.length) {\r\n this._commandChainRunning = false;\r\n Common_1.Log.d(\"<<<<[End CommandChain]\");\r\n // CommandChain 中に post されたものがあれば、続けて swap して実行開始してみる\r\n if (this._recodingCommandList.length > 0 || this._afterChainCommandList.length > 0 || this.__whenWaitingTasks.length > 0) {\r\n this._submit();\r\n }\r\n }\r\n }\r\n else {\r\n // _runningCommandList はすべて実行済みだが、外部から _nextPriorityTask が指定されていた\r\n }\r\n }\r\n }\r\n }\r\n // Decision の後に実行する\r\n _submit() {\r\n (0, Common_1.assert)(!this._commandChainRunning);\r\n // swap\r\n [this._runningCommandList, this._recodingCommandList] = [this._recodingCommandList, this._runningCommandList];\r\n // clear\r\n this._recodingCommandList.splice(0);\r\n this._messageIndex = 0;\r\n if (this.__whenWaitingTasks.length > 0) {\r\n const tasks = this.__whenWaitingTasks;\r\n this.__whenWaitingTasks = [];\r\n for (const task of tasks) {\r\n (0, Common_1.assert)(task._status == STask_1.STaskStatus.Pending);\r\n let completed = true; // 万一、ひとつも無ければ完了扱いにする (次のタスクを実行する)\r\n for (const t of task._whenWaitingTasks) {\r\n if (!t.isCompleted) {\r\n completed = false;\r\n break;\r\n }\r\n }\r\n if (completed) {\r\n this._runningCommandList.push(task);\r\n }\r\n else {\r\n this.__whenWaitingTasks.push(task);\r\n }\r\n }\r\n }\r\n if (this._runningCommandList.length > 0) {\r\n Common_1.Log.d(\">>>>[Start CommandChain]\");\r\n this._commandChainRunning = true;\r\n }\r\n else if (this._afterChainCommandList.length > 0) {\r\n [this._runningCommandList, this._afterChainCommandList] = [this._afterChainCommandList, this._runningCommandList];\r\n this._afterChainCommandList.splice(0);\r\n this._commandChainRunning = true;\r\n }\r\n }\r\n _setNextPriorityTask(task) {\r\n (0, Common_1.assert)(task);\r\n (0, Common_1.assert)(!this._nextPriorityTask);\r\n (0, Common_1.assert)(task._status == STask_1.STaskStatus.Pending);\r\n this._nextPriorityTask = task;\r\n }\r\n pushRecodingCommandList(task) {\r\n (0, Common_1.assert)(task._status == STask_1.STaskStatus.Created);\r\n task._status = STask_1.STaskStatus.Pending;\r\n this._recodingCommandList.push(task);\r\n }\r\n pushAfterChainCommandList(task) {\r\n (0, Common_1.assert)(task._status == STask_1.STaskStatus.Created);\r\n task._status = STask_1.STaskStatus.Pending;\r\n this._afterChainCommandList.push(task);\r\n }\r\n}\r\nexports.SCommandContext = SCommandContext;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/SCommandContext.ts?"); /***/ }), /***/ "./ts/mr/system/SCommon.ts": /*!*********************************!*\ !*** ./ts/mr/system/SCommon.ts ***! \*********************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SWarehouseDialogResult = exports.SStepPhase = void 0;\r\nvar SStepPhase;\r\n(function (SStepPhase) {\r\n SStepPhase[SStepPhase[\"RunStarting\"] = 0] = \"RunStarting\";\r\n SStepPhase[SStepPhase[\"PhaseStarting\"] = 1] = \"PhaseStarting\";\r\n SStepPhase[SStepPhase[\"StepStarting\"] = 2] = \"StepStarting\";\r\n SStepPhase[SStepPhase[\"MainProcess\"] = 3] = \"MainProcess\";\r\n SStepPhase[SStepPhase[\"MainProcessClosing\"] = 4] = \"MainProcessClosing\";\r\n SStepPhase[SStepPhase[\"AfterProcess\"] = 5] = \"AfterProcess\";\r\n SStepPhase[SStepPhase[\"AfterProcessClosing\"] = 6] = \"AfterProcessClosing\";\r\n SStepPhase[SStepPhase[\"StepClosing\"] = 7] = \"StepClosing\";\r\n SStepPhase[SStepPhase[\"PhaseClosing\"] = 8] = \"PhaseClosing\";\r\n SStepPhase[SStepPhase[\"RunClosing\"] = 9] = \"RunClosing\";\r\n SStepPhase[SStepPhase[\"Closed\"] = 10] = \"Closed\";\r\n})(SStepPhase = exports.SStepPhase || (exports.SStepPhase = {}));\r\nvar SWarehouseDialogResult;\r\n(function (SWarehouseDialogResult) {\r\n SWarehouseDialogResult[SWarehouseDialogResult[\"Succeeded\"] = 0] = \"Succeeded\";\r\n SWarehouseDialogResult[SWarehouseDialogResult[\"SucceededAsMuch\"] = 1] = \"SucceededAsMuch\";\r\n SWarehouseDialogResult[SWarehouseDialogResult[\"Cancel\"] = -1] = \"Cancel\";\r\n SWarehouseDialogResult[SWarehouseDialogResult[\"FullyCanceled\"] = -2] = \"FullyCanceled\";\r\n})(SWarehouseDialogResult = exports.SWarehouseDialogResult || (exports.SWarehouseDialogResult = {}));\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/SCommon.ts?"); /***/ }), /***/ "./ts/mr/system/SDebugHelpers.ts": /*!***************************************!*\ !*** ./ts/mr/system/SDebugHelpers.ts ***! \***************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SDebugHelpers = void 0;\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nclass SDebugHelpers {\r\n static setHP(entity, value) {\r\n const mhp = entity.getParamActualMax(MRBasics_1.MRBasics.params.hp);\r\n entity.setActualDamgeParam(MRBasics_1.MRBasics.params.hp, mhp - value);\r\n }\r\n static setFP(entity, value) {\r\n const max = entity.getParamActualMax(MRBasics_1.MRBasics.params.fp);\r\n entity.setActualDamgeParam(MRBasics_1.MRBasics.params.fp, max - value);\r\n }\r\n}\r\nexports.SDebugHelpers = SDebugHelpers;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/SDebugHelpers.ts?"); /***/ }), /***/ "./ts/mr/system/SDialog.ts": /*!*********************************!*\ !*** ./ts/mr/system/SDialog.ts ***! \*********************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SDialog = exports.SDialogAction = void 0;\r\nconst LFloorId_1 = __webpack_require__(/*! ts/mr/lively/LFloorId */ \"./ts/mr/lively/LFloorId.ts\");\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ./MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nvar SDialogAction;\r\n(function (SDialogAction) {\r\n SDialogAction[SDialogAction[\"None\"] = 0] = \"None\";\r\n SDialogAction[SDialogAction[\"Submit\"] = 1] = \"Submit\";\r\n SDialogAction[SDialogAction[\"Cancel\"] = 2] = \"Cancel\";\r\n SDialogAction[SDialogAction[\"CloseAllSubDialogs\"] = 3] = \"CloseAllSubDialogs\";\r\n})(SDialogAction = exports.SDialogAction || (exports.SDialogAction = {}));\r\n/**\r\n * GameDialog\r\n *\r\n * Dialog と名前がついているが、必ずしも UI を持つものではない。\r\n * 名前通り、エンドユーザーとの「対話」のためのインターフェイスを実装する。\r\n *\r\n * MVP ライクな実装にしているが、これはユニットテスト可能にするため。\r\n *\r\n *\r\n */\r\nclass SDialog {\r\n constructor() {\r\n // この Dialog を開いたフロア。\r\n // 複数のフロアにまたがって実行されるとき、Close を Recorder に記録しないように制御するために使う。\r\n this._openedFloorId = LFloorId_1.LFloorId.makeEmpty();\r\n this._dialogResult = {\r\n action: SDialogAction.None,\r\n selectedItems: [],\r\n };\r\n }\r\n onUpdate(context) { }\r\n isVisualIntegration() {\r\n return true;\r\n }\r\n then(func) {\r\n this._resultCallback = (d) => {\r\n func(d);\r\n };\r\n }\r\n submit() {\r\n (0, Common_1.assert)(this._dialogResult.action == SDialogAction.None); // ここでエラーになる場合は、resutl コールバック内で submit したのに return false した可能性がある。\r\n this._dialogResult.action = SDialogAction.Submit;\r\n this._closeSelfAndSubDialogs();\r\n }\r\n cancel() {\r\n (0, Common_1.assert)(this._dialogResult.action == SDialogAction.None);\r\n this._dialogResult.action = SDialogAction.Cancel;\r\n this._closeSelfAndSubDialogs();\r\n }\r\n /**\r\n * 全てのサブダイアログを閉じます。Action は Submit ではありません。\r\n */\r\n closeAllSubDialogs() {\r\n (0, Common_1.assert)(MRSystem_1.MRSystem.dialogContext.dialogs().length >= 2);\r\n (0, Common_1.assert)(this._dialogResult.action == SDialogAction.None);\r\n this._dialogResult.action = SDialogAction.CloseAllSubDialogs;\r\n this._closeSelfAndSubDialogs();\r\n }\r\n _closeSelfAndSubDialogs() {\r\n MRSystem_1.MRSystem.dialogContext._closeDialog(this);\r\n if (this._resultCallbackVisual) {\r\n this._resultCallbackVisual(this);\r\n }\r\n if (this._resultCallback) {\r\n this._resultCallback(this);\r\n }\r\n }\r\n get dialogResult() {\r\n return this._dialogResult;\r\n }\r\n get resultAction() {\r\n return this._dialogResult.action;\r\n }\r\n get isSubmitted() {\r\n return this._dialogResult.action == SDialogAction.Submit;\r\n }\r\n // public isCanceled(): boolean {\r\n // return this._dialogResult.action == SDialogAction.Cancel;\r\n // }\r\n /**\r\n * SubDialog を開く。\r\n *\r\n * onResult が呼ばれた時点で、dialog はスタックから取り除かれている。\r\n *\r\n * onResult は、SubDialog が閉じられた時点で呼ばれます。\r\n * onResult で親 Dialog に対してデフォルトの処理を行う場合は、false または void を返してください。\r\n * デフォルトの処理は、子 Dialog の結果を親 Dialog に引き継ぐように反映します。\r\n * つまり、\r\n * - 子 Dialog が Submit された場合は、親 Dialog も Submit となり、 Close されます。\r\n * - 子 Dialog が Cancel された場合は、親 Dialog は Close されません。\r\n *\r\n * onResult で親 Dialog に対してデフォルトの処理を行わない場合は、true を返してください。\r\n * 例えば未識別アイテムの名前付けウィンドウでは、名前を決定すると Submit 結果となりますが、\r\n * その時その親 (通常は ItemListDialog) は Close しません。\r\n */\r\n openSubDialog(dialog, onResult) {\r\n dialog._resultCallbackVisual = (model) => {\r\n const handled = (onResult) ? onResult(model) : false;\r\n if (!handled) {\r\n switch (model.resultAction) {\r\n case SDialogAction.Submit:\r\n this.submit();\r\n break;\r\n case SDialogAction.Cancel:\r\n // ほとんどの場合ひとつ前の Dialog に戻ることを想定しているため、\r\n // 親 Dialog まで cancel を伝播するようなことはしない。\r\n break;\r\n case SDialogAction.CloseAllSubDialogs:\r\n if (MRSystem_1.MRSystem.dialogContext.dialogs().length >= 2) {\r\n this.closeAllSubDialogs();\r\n }\r\n break;\r\n }\r\n }\r\n };\r\n MRSystem_1.MRSystem.dialogContext.open(dialog);\r\n }\r\n}\r\nexports.SDialog = SDialog;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/SDialog.ts?"); /***/ }), /***/ "./ts/mr/system/SDialogContext.ts": /*!****************************************!*\ !*** ./ts/mr/system/SDialogContext.ts ***! \****************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SDialogContext = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst SActivityRecorder_1 = __webpack_require__(/*! ./SActivityRecorder */ \"./ts/mr/system/SActivityRecorder.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ./MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst SActivityPlaybackDialog_1 = __webpack_require__(/*! ./dialogs/SActivityPlaybackDialog */ \"./ts/mr/system/dialogs/SActivityPlaybackDialog.ts\");\r\nclass SDialogContext {\r\n constructor(cctx) {\r\n this._commandContext = cctx;\r\n this._dialogs = [];\r\n }\r\n open(dialog) {\r\n dialog._openedFloorId = MRLively_1.MRLively.mapView.currentFloorId.clone();\r\n this._dialogs.push(dialog);\r\n MRSystem_1.MRSystem.integration.openDialog(dialog);\r\n }\r\n pop() {\r\n const dialogIsPlaybck = this.activeDialog() instanceof SActivityPlaybackDialog_1.SActivityPlaybackDialog;\r\n const otherFloorOpened = !this.activeDialog()._openedFloorId.equals(MRLively_1.MRLively.mapView.currentMap.floorId());\r\n this._dialogs.pop();\r\n if (this._dialogs.length == 0) {\r\n if (MRLively_1.MRLively.recorder.isRecording()) {\r\n if (dialogIsPlaybck) {\r\n // SCommandPlaybackDialog が最後のコマンドを実行し終えた時に備える。\r\n // ここで記録してしまうと、回想が終わるたびに \"待機\" が増えてしまう。\r\n }\r\n else if (otherFloorOpened) {\r\n }\r\n else {\r\n MRLively_1.MRLively.recorder.push({\r\n type: SActivityRecorder_1.ActivityRecordingCommandType.CloseMainDialog,\r\n activity: null,\r\n });\r\n }\r\n }\r\n }\r\n }\r\n dialogs() {\r\n return this._dialogs;\r\n }\r\n activeDialog() {\r\n (0, Common_1.assert)(this._hasDialogModel());\r\n return this._dialogs[this._dialogs.length - 1];\r\n }\r\n causeEntity() {\r\n return this._causeEntity;\r\n }\r\n /*\r\n dialog(): REDialog {\r\n if (this._dialogModel)\r\n return this._dialogModel;\r\n else\r\n throw new Error(\"_dialogModel\");\r\n }\r\n */\r\n commandContext() {\r\n return this._commandContext;\r\n }\r\n postActivity(activity) {\r\n this._commandContext.postActivity(activity);\r\n if (MRLively_1.MRLively.recorder.isRecording()) {\r\n MRLively_1.MRLively.recorder.push({\r\n type: SActivityRecorder_1.ActivityRecordingCommandType.Activity,\r\n activity: activity.toData(),\r\n });\r\n }\r\n }\r\n _closeDialog(dialog) {\r\n (0, Common_1.assert)(this.activeDialog() == dialog); // TODO: stack ぜんぶ見て、見つかったものをその子を close したほうがいいかも?\r\n this.pop();\r\n MRSystem_1.MRSystem.integration.dialogClosed(this, dialog);\r\n }\r\n /**\r\n * 移動後のアイテム拾いや矢弾の装備など、ターンを消費しないが、一度コマンドチェーンを実行したいときに使う。\r\n */\r\n /*\r\n public postReopen(): void {\r\n const entity = this.causeEntity();\r\n const model = this.activeDialog();\r\n\r\n this.closeDialog();\r\n\r\n assert(entity);\r\n this._commandContext.openDialog(entity, model, true);\r\n }\r\n */\r\n setCauseEntity(value) {\r\n this._causeEntity = value;\r\n }\r\n //_setDialogModel(value: REDialog | null) {\r\n // this._dialogModel = value;\r\n //}\r\n _hasDialogModel() {\r\n return this._dialogs.length > 0;\r\n }\r\n _update() {\r\n (0, Common_1.assert)(this._hasDialogModel());\r\n //REGame.recorder._recording = true;\r\n const dialog = this.activeDialog();\r\n dialog.onUpdate(this);\r\n if (this._hasDialogModel() && // dialog.onUpdate() の中で submit が走り、Dialog が閉じられることに備える\r\n dialog.isVisualIntegration()) {\r\n MRSystem_1.MRSystem.integration.updateDialog(this);\r\n }\r\n //REGame.recorder._recording = false;\r\n //if (this._visual) {\r\n // this._visual.onUpdate(this);\r\n //}\r\n }\r\n}\r\nexports.SDialogContext = SDialogContext;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/SDialogContext.ts?"); /***/ }), /***/ "./ts/mr/system/SEffectApplyer.ts": /*!****************************************!*\ !*** ./ts/mr/system/SEffectApplyer.ts ***! \****************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SEffectApplyer = exports.SParameterEffect = exports.SParameterEffectApplyType = exports.SEffectorFact = exports.SEffect = void 0;\r\nconst MRBasics_1 = __webpack_require__(/*! ../data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst DEffect_1 = __webpack_require__(/*! ../data/DEffect */ \"./ts/mr/data/DEffect.ts\");\r\nconst DItemEffect_1 = __webpack_require__(/*! ../data/DItemEffect */ \"./ts/mr/data/DItemEffect.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ../data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst LProjectileBehavior_1 = __webpack_require__(/*! ../lively/behaviors/activities/LProjectileBehavior */ \"./ts/mr/lively/behaviors/activities/LProjectileBehavior.ts\");\r\nconst LBattlerBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LBattlerBehavior */ \"./ts/mr/lively/behaviors/LBattlerBehavior.ts\");\r\nconst LEffectResult_1 = __webpack_require__(/*! ../lively/LEffectResult */ \"./ts/mr/lively/LEffectResult.ts\");\r\nconst UIdentify_1 = __webpack_require__(/*! ../utility/UIdentify */ \"./ts/mr/utility/UIdentify.ts\");\r\nconst UTransfer_1 = __webpack_require__(/*! ../utility/UTransfer */ \"./ts/mr/utility/UTransfer.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ./MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst SEffectContext_1 = __webpack_require__(/*! ./SEffectContext */ \"./ts/mr/system/SEffectContext.ts\");\r\nconst PluginParameters_1 = __webpack_require__(/*! ../PluginParameters */ \"./ts/mr/PluginParameters.ts\");\r\nconst UState_1 = __webpack_require__(/*! ../utility/UState */ \"./ts/mr/utility/UState.ts\");\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\n/**\r\n * DEffect に対するインスタンス情報。\r\n * Effect 発動者や対象などの関係者の紐づけや、実行時にエフェクトの各プロパティについて、オーバーライドされた値を保持する。\r\n */\r\nclass SEffect {\r\n constructor(fact, effect) {\r\n this._fact = fact;\r\n this._data = effect;\r\n //this._hitType = effect.hitType;\r\n //this._successRate = effect.successRate;\r\n //this._targetModifier = new SEffectModifier(fact.subject(), effect);\r\n // subject の現在値を初期パラメータとする。\r\n // 装備品 Behavior はここへ値を加算したりする。\r\n //this._subjectActualParams = [];\r\n this._parameterEffects2 = [];\r\n for (const p of effect.effect.parameterQualifyings) {\r\n const paramEffect = new SParameterEffect(p);\r\n this._parameterEffects2.push(paramEffect);\r\n // Check fixed damage.\r\n const trait = fact.subject().traitsWithId(MRBasics_1.MRBasics.traits.FixedDamage, p._parameterId).backOrUndefined();\r\n if (trait) {\r\n paramEffect.fixedDamage = trait.value;\r\n }\r\n }\r\n }\r\n fact() {\r\n return this._fact;\r\n }\r\n subject() {\r\n return this._fact.subject();\r\n }\r\n data() {\r\n return this._data;\r\n }\r\n // public targetModifier(): SEffectModifier {\r\n // return this._targetModifier;\r\n // }\r\n get successRate() {\r\n return this.data().effect.successRate;\r\n }\r\n isCertainHit() {\r\n return this.data().effect.hitType == DEffect_1.DEffectHitType.Certain;\r\n }\r\n isPhysical() {\r\n return this.data().effect.hitType == DEffect_1.DEffectHitType.Physical;\r\n }\r\n isMagical() {\r\n return this.data().effect.hitType == DEffect_1.DEffectHitType.Magical;\r\n }\r\n // 0.0~1.0\r\n // クラスの特徴などで [追加能力値:命中+x] が無いと 0 になり全く命中しなくなる。\r\n // Game_Action.prototype.itemHit\r\n hitRate() {\r\n const successRate = this.successRate;\r\n if (this.isPhysical()) {\r\n const subject = this.subject();\r\n const hit = (subject) ? subject.xparamOrDefault(MRBasics_1.MRBasics.xparams.hit, 1.0) : 1.0;\r\n return successRate * 0.01 * hit;\r\n }\r\n else {\r\n return successRate * 0.01;\r\n }\r\n }\r\n // Game_Action.prototype.itemEva\r\n evaRate(target) {\r\n if (this.isPhysical()) {\r\n return target.xparam(MRBasics_1.MRBasics.xparams.eva);\r\n }\r\n else if (this.isMagical()) {\r\n return target.xparam(MRBasics_1.MRBasics.xparams.mev);\r\n }\r\n else {\r\n return 0;\r\n }\r\n }\r\n // Game_Action.prototype.itemCri\r\n criRate(target) {\r\n const subject = this.subject();\r\n const cri = (subject) ? subject.xparam(MRBasics_1.MRBasics.xparams.cri) : 1.0;\r\n return this._data.effect.critical\r\n ? cri * (1 - target.xparam(MRBasics_1.MRBasics.xparams.cev))\r\n : 0;\r\n }\r\n // Game_Action.prototype.lukEffectRate\r\n lukEffectRate(target) {\r\n const subject = this.subject();\r\n const subject_luk = subject ? subject.getActualParam(MRBasics_1.MRBasics.params.luk) : 0.0;\r\n const target_luk = target.getActualParam(MRBasics_1.MRBasics.params.luk);\r\n return Math.max(1.0 + (subject_luk - target_luk) * 0.001, 0.0);\r\n }\r\n hasParamDamage() {\r\n //return this._parameterEffects.findIndex(x => x && x.applyType != SParameterEffectApplyType.None) >= 0;\r\n return this._parameterEffects2.findIndex(x => x && x.applyType != SParameterEffectApplyType.None) >= 0;\r\n }\r\n parameterEffects2() {\r\n return this._parameterEffects2;\r\n }\r\n otherEffectQualifyings() {\r\n return this._data.effect.otherEffectQualifyings;\r\n }\r\n effectBehaviors() {\r\n return this._data.effect.effectBehaviors;\r\n }\r\n specialEffectQualifyings() {\r\n return this._data.effect.rmmzSpecialEffectQualifyings;\r\n }\r\n buffQualifying() {\r\n return this._data.effect.buffQualifying;\r\n }\r\n}\r\nexports.SEffect = SEffect;\r\n// export interface SSubEffect {\r\n// subTargetKey: DSubComponentEffectTargetKey;\r\n// effect: SEffect;\r\n// }\r\n// 攻撃側\r\nclass SEffectorFact {\r\n constructor(subject, effects, incidentType, dir) {\r\n // 適用側 (攻撃側) の関係者。\r\n // 攻撃発動Unit だけではなく、装備品(武器・防具・装飾品)、合成印など、ダメージ計算式やバフに影響するすべての Entity。\r\n //\r\n // 矢弾や魔法弾を打った場合、その Projectile Entity も effectors に含まれる。\r\n // なお、魔法反射や吹き飛ばし移動は Command 側で処理する。EffectContext はあくまでパラメータの変化に関係する処理のみを行う。\r\n this._effectors = [];\r\n // 以下、Behavior 持ち回りで編集される要素\r\n //private _subjectActualParams: number[];\r\n this._effects = [];\r\n this._subject = subject;\r\n this._subjectEffects = effects;\r\n this._subjectBattlerBehavior = subject.findEntityBehavior(LBattlerBehavior_1.LBattlerBehavior);\r\n this._incidentType = incidentType;\r\n this._incidentEntityKind = 0;\r\n this._direction = dir;\r\n this._genericEffectRate = 1.0;\r\n for (const i of effects.targetEffects()) {\r\n this._effects.push(new SEffect(this, i));\r\n }\r\n // for (const i of effects.subEffects) {\r\n // const e = new SEffect(this, i.effect);\r\n // this._subEffects.push({\r\n // subTargetKey: i.key,\r\n // effect: e,\r\n // });\r\n // }\r\n this._selfModifier = new SEffect(this, effects.selfEffect);\r\n if (effects.succeededSelfEffect) {\r\n this._succeededSelfModifier = new SEffect(this, effects.succeededSelfEffect);\r\n }\r\n this._subject.iterateBehaviors2(b => {\r\n b.onCollectEffector(this._subject, this);\r\n return true;\r\n });\r\n }\r\n withIncidentEntityKind(value) {\r\n this._incidentEntityKind = value;\r\n // この種類を扱うのは得意?\r\n if (this._incidentEntityKind > 0) {\r\n this._genericEffectRate = this._subject.traitsPi(MRBasics_1.MRBasics.traits.EffectProficiency, this._incidentEntityKind);\r\n }\r\n else {\r\n this._incidentEntityKind = 1.0;\r\n }\r\n return this;\r\n }\r\n withItem(item) {\r\n this._item = item;\r\n return this;\r\n }\r\n withSkill(skill) {\r\n this._sourceSkill = skill;\r\n return this;\r\n }\r\n subject() {\r\n return this._subject;\r\n }\r\n subjectBehavior() {\r\n return this._subjectBattlerBehavior;\r\n }\r\n effectSet() {\r\n return this._subjectEffects;\r\n }\r\n // public subEffects(): SSubEffect[] {\r\n // return this._subEffects;\r\n // }\r\n incidentType() {\r\n return this._incidentType;\r\n }\r\n incidentEntityKind() {\r\n return this._incidentEntityKind;\r\n }\r\n item() {\r\n return this._item;\r\n }\r\n sourceSkill() {\r\n return this._sourceSkill;\r\n }\r\n direction() {\r\n return this._direction;\r\n }\r\n selfModifier() {\r\n return this._selfModifier;\r\n }\r\n succeededSelfModifier() {\r\n return this._succeededSelfModifier;\r\n }\r\n //--------------------\r\n // onCollectEffector から使うもの\r\n addEffector(entity) {\r\n this._effectors.push(entity);\r\n }\r\n //--------------------\r\n // apply から使うもの\r\n genericEffectRate() {\r\n return this._genericEffectRate;\r\n }\r\n effects() {\r\n return this._effects;\r\n }\r\n}\r\nexports.SEffectorFact = SEffectorFact;\r\nvar SParameterEffectApplyType;\r\n(function (SParameterEffectApplyType) {\r\n SParameterEffectApplyType[SParameterEffectApplyType[\"None\"] = 0] = \"None\";\r\n SParameterEffectApplyType[SParameterEffectApplyType[\"Damage\"] = 1] = \"Damage\";\r\n SParameterEffectApplyType[SParameterEffectApplyType[\"Recover\"] = 2] = \"Recover\";\r\n})(SParameterEffectApplyType = exports.SParameterEffectApplyType || (exports.SParameterEffectApplyType = {}));\r\n// DParameterEffect とよく似ているが、こちらは動的なデータとして扱うものの集合。\r\n// 例えば通常の武器は isDrain=falseでも、回復印が付いていたら isDrain=true にするなど、\r\n// 関連する情報を統合した最終的な Effect として作り上げるために使う。\r\nclass SParameterEffect {\r\n constructor(data) {\r\n this.qualifying = data;\r\n switch (data.applyType) {\r\n case DEffect_1.DParameterEffectApplyType.Damage:\r\n this.applyType = SParameterEffectApplyType.Damage;\r\n this.isDrain = false;\r\n break;\r\n case DEffect_1.DParameterEffectApplyType.Recover:\r\n this.applyType = SParameterEffectApplyType.Recover;\r\n this.isDrain = false;\r\n break;\r\n case DEffect_1.DParameterEffectApplyType.Drain:\r\n this.applyType = SParameterEffectApplyType.Damage;\r\n this.isDrain = true;\r\n break;\r\n default:\r\n throw new Error();\r\n }\r\n this.paramId = data._parameterId;\r\n this.elementIds = data.elementIds;\r\n (0, Common_1.assert)(this.elementIds.length > 0);\r\n this.formula = data.formula;\r\n this.variance = data.variance;\r\n this._valid = true;\r\n }\r\n isRecover() {\r\n return this.applyType == SParameterEffectApplyType.Recover;\r\n }\r\n get isValid() {\r\n return this._valid;\r\n }\r\n set isValid(value) {\r\n this._valid = value;\r\n }\r\n evalConditions(target) {\r\n if (this.qualifying.fallback) {\r\n this._valid = false;\r\n }\r\n else if (target.params.hasParam(this.paramId)) {\r\n this._valid = this.meetsConditions(target);\r\n }\r\n else {\r\n this._valid = false;\r\n }\r\n }\r\n meetsConditions(target) {\r\n if (this.qualifying.conditionTargetCategoryId > 0) {\r\n if (this.qualifying.conditionTargetCategoryId != target.kindDataId()) {\r\n return false;\r\n }\r\n }\r\n if (this.qualifying.conditionFormula) {\r\n const a = MRSystem_1.MRSystem.formulaOperandA;\r\n a.wrap(target);\r\n try {\r\n const r = eval(this.qualifying.conditionFormula);\r\n return r;\r\n }\r\n catch (e) {\r\n console.error(e);\r\n return false;\r\n }\r\n }\r\n else {\r\n return true;\r\n }\r\n }\r\n}\r\nexports.SParameterEffect = SParameterEffect;\r\n/*\r\nexport class SEffectModifier {\r\n private _data: DEffect;\r\n private _parameterEffects2: SParameterEffect[];\r\n\r\n public constructor(subject: LEntity, q: DEffect) {\r\n this._data = q;\r\n\r\n\r\n // subject の現在値を初期パラメータとする。\r\n // 装備品 Behavior はここへ値を加算したりする。\r\n //this._subjectActualParams = [];\r\n this._parameterEffects2 = [];\r\n for (const p of q.parameterQualifyings) {\r\n const paramEffect = new SParameterEffect(p);\r\n this._parameterEffects2.push(paramEffect);\r\n\r\n // Check fixed damage.\r\n const trait = subject.traitsWithId(MRBasics.traits.FixedDamage, p._parameterId).backOrUndefined();\r\n if (trait) {\r\n paramEffect.fixedDamage = trait.value;\r\n }\r\n }\r\n\r\n // for (let i = 0; i < REData.parameters.length; i++) {\r\n // //this._subjectActualParams[i] = this._subjectBattlerBehavior ? this._subjectBattlerBehavior.actualParam(i) : 0;\r\n // this._parameterEffects[i] = undefined;\r\n // }\r\n\r\n // // Effect 展開\r\n // q.parameterQualifyings.forEach(x => {\r\n // this._parameterEffects[x.parameterId] = new SParameterEffect(x);\r\n // });\r\n }\r\n \r\n // public parameterEffect(paramId: DParameterId): SParameterEffect | undefined {\r\n // return this._parameterEffects[paramId];\r\n // }\r\n \r\n public hasParamDamage(): boolean {\r\n //return this._parameterEffects.findIndex(x => x && x.applyType != SParameterEffectApplyType.None) >= 0;\r\n return this._parameterEffects2.findIndex(x => x && x.applyType != SParameterEffectApplyType.None) >= 0;\r\n }\r\n\r\n public parameterEffects2(): readonly SParameterEffect[] {\r\n return this._parameterEffects2;\r\n }\r\n \r\n public otherEffectQualifyings(): DOtherEffectQualifying[] {\r\n return this._data.otherEffectQualifyings;\r\n }\r\n\r\n public effectBehaviors(): DSpecialEffectRef[] {\r\n return this._data.effectBehaviors;\r\n }\r\n \r\n public specialEffectQualifyings(): IDataEffect[] {\r\n return this._data.rmmzSpecialEffectQualifyings;\r\n }\r\n\r\n public buffQualifying(): DParamBuff[] {\r\n return this._data.buffQualifying;\r\n }\r\n}\r\n*/\r\n/**\r\n * 成否判定後、実際にパラメータやステートに変化を与える\r\n */\r\nclass SEffectApplyer {\r\n constructor(effect, rand) {\r\n this._effect = effect;\r\n this._rand = rand;\r\n }\r\n apply(cctx, modifier, target) {\r\n const result = target._effectResult;\r\n const sourceSkillId = this._effect.fact().sourceSkill();\r\n if (sourceSkillId) {\r\n if (target.traitsWithId(MRBasics_1.MRBasics.traits.SkillGuard, sourceSkillId).length > 0) {\r\n return;\r\n }\r\n }\r\n // 条件に一致する or 条件を持たない Param 効果をアクティブにする\r\n let fallback = true;\r\n for (const paramEffect of modifier.parameterEffects2()) {\r\n paramEffect.evalConditions(target);\r\n if (paramEffect.isValid) {\r\n fallback = false;\r\n }\r\n }\r\n if (fallback) {\r\n // アクティブなものが1つも無いときは fallback を実行\r\n const p = modifier.parameterEffects2().find(x => x.qualifying.fallback);\r\n if (p)\r\n p.isValid = true;\r\n }\r\n // Damage\r\n //for (let i = 0; i < REData.parameters.length; i++) {\r\n //const pe = modifier.parameterEffect(i);\r\n for (const paramEffect of modifier.parameterEffects2())\r\n if (paramEffect && paramEffect.applyType != SParameterEffectApplyType.None) {\r\n if (paramEffect.isValid) {\r\n if (paramEffect.paramId != 0) {\r\n const value = this.makeDamageValue(paramEffect, target, result.critical);\r\n this.executeDamage(paramEffect, target, value, result);\r\n }\r\n }\r\n // applyDeathVulnerable\r\n // Item に対して致死爆発を適用するときなど、 Param を持っていない者に対しても処理したいので、isValid は考慮しない。\r\n for (const elementId of paramEffect.elementIds) {\r\n for (const trait of target.traitsWithId(MRBasics_1.MRBasics.traits.DeathVulnerableElement, elementId)) {\r\n this.addState(target, trait.value, result);\r\n }\r\n }\r\n }\r\n // }\r\n // Effect\r\n for (const effect of modifier.specialEffectQualifyings()) {\r\n this.applyItemEffect(cctx, target, effect, result);\r\n }\r\n for (const buff of modifier.buffQualifying()) {\r\n target.addBuff(buff);\r\n result.makeSuccess();\r\n }\r\n for (const effect of modifier.otherEffectQualifyings()) {\r\n this.applyOtherEffect(cctx, target, effect, result);\r\n }\r\n for (const effect of modifier.effectBehaviors()) {\r\n const b = MRSystem_1.MRSystem.effectBehaviorManager.get(effect.specialEffectId);\r\n b.onApplyTargetEffect(cctx, effect, this._effect.fact().subject(), this._effect.fact().item(), modifier, target, target._effectResult);\r\n }\r\n this.applyItemUserEffect(target);\r\n target.refreshConditions();\r\n // 効果適用後の値は refresh() 後でとらないと、min-max clamp されていない。\r\n for (const paramResult of result.paramEffects2) {\r\n paramResult.newValue = target.getActualParam(paramResult.paramId);\r\n }\r\n }\r\n // Game_Action.prototype.makeDamageValue\r\n makeDamageValue(paramEffect, target, critical) {\r\n // Check fixed damage\r\n if (!paramEffect.isRecover() && paramEffect.fixedDamage) {\r\n return paramEffect.fixedDamage;\r\n }\r\n const baseValue = this.evalDamageFormula(paramEffect, target);\r\n let value = baseValue * this.calcElementRate(paramEffect, target);\r\n if (this._effect.isPhysical()) {\r\n value *= target.sparam(MRBasics_1.MRBasics.sparams.pdr);\r\n }\r\n if (this._effect.isMagical()) {\r\n value *= target.sparam(MRBasics_1.MRBasics.sparams.mdr);\r\n }\r\n if (baseValue < 0) {\r\n value *= this.elemetedRecoverRate(target, paramEffect);\r\n }\r\n if (baseValue < 0) {\r\n value *= target.sparam(MRBasics_1.MRBasics.sparams.rec);\r\n }\r\n if (critical) {\r\n value = this.applyCritical(value);\r\n }\r\n value = this.applyVariance(value, paramEffect.variance);\r\n value = this.applyGuard(value, target);\r\n value = this.applyProficiency(value);\r\n value = this.applyDamageRate(value, paramEffect.paramId, target);\r\n value = this.applyRaceRate(value, target);\r\n value = Math.round(value);\r\n return value;\r\n }\r\n elemetedRecoverRate(target, paramEffect) {\r\n // traitsSum だと、デフォルト値が 0.0 になるため、全ての Battler にひとつの ElementedRecoveryRate を持たせておかないと回復ができなくなる。\r\n // 命中率と同じではあるが、ちょっとそれは面倒すぎる。\r\n let rate = 1.0;\r\n for (const elementId of paramEffect.elementIds) {\r\n rate *= target.traitsPi(MRBasics_1.MRBasics.traits.ElementedRecoveryRate, elementId);\r\n }\r\n return rate;\r\n }\r\n // Game_Action.prototype.evalDamageFormula\r\n evalDamageFormula(paramEffect, target) {\r\n try {\r\n // const a = this._effect.subject(); // eslint-disable-line no-unused-vars\r\n // const b = target; // eslint-disable-line no-unused-vars\r\n // const c = this._effect.fact().item(); // eslint-disable-line no-unused-vars\r\n const a = MRSystem_1.MRSystem.formulaOperandA;\r\n const b = MRSystem_1.MRSystem.formulaOperandB;\r\n const c = MRSystem_1.MRSystem.formulaOperandC;\r\n a.wrap(this._effect.subject());\r\n b.wrap(target);\r\n c.wrap(this._effect.fact().item());\r\n // UnitTest から実行される場合に備えて undefined チェック\r\n const v = (typeof $gameVariables == \"undefined\") ? undefined : $gameVariables._data; // eslint-disable-line no-unused-vars\r\n const sign = paramEffect.isRecover() ? -1 : 1;\r\n let value = Math.max(eval(paramEffect.formula), 0); // * sign;\r\n value = Math.max(value, 1); // 最低1にしてみる\r\n value *= sign;\r\n // if (paramEffect.isRecover()) {\r\n // }\r\n // else {\r\n // }\r\n return isNaN(value) ? 0 : value;\r\n }\r\n catch (e) {\r\n return 0;\r\n }\r\n }\r\n // Game_Action.prototype.calcElementRate\r\n calcElementRate(paramEffect, target) {\r\n let rate = 1.0;\r\n for (const elementId of paramEffect.elementIds) {\r\n if (elementId < 0) {\r\n const subjectBehavior = this._effect.subject();\r\n const attackElements = subjectBehavior ? subjectBehavior.attackElements() : [];\r\n rate *= this.elementsMaxRate(target, attackElements);\r\n }\r\n else {\r\n rate *= target.elementRate(elementId);\r\n }\r\n }\r\n return rate;\r\n }\r\n // Game_Action.prototype.elementsMaxRate\r\n elementsMaxRate(target, elements) {\r\n if (elements.length > 0) {\r\n const rates = elements.map(elementId => target.elementRate(elementId));\r\n return Math.max(...rates);\r\n }\r\n else {\r\n return 1;\r\n }\r\n }\r\n // Game_Action.prototype.applyCritical\r\n applyCritical(damage) {\r\n return damage * 3;\r\n }\r\n // Game_Action.prototype.applyVariance\r\n applyVariance(damage, variance) {\r\n const amp = Math.floor(Math.max((Math.abs(damage) * variance) / 100, 0));\r\n const v = this._rand.nextIntWithMax(amp + 1) + this._rand.nextIntWithMax(amp + 1) - amp;\r\n return damage >= 0 ? damage + v : damage - v;\r\n }\r\n // Game_Action.prototype.applyGuard\r\n applyGuard(damage, target) {\r\n //const targetBehavior = this._effectorFact();\r\n const isGuard = false; //(targetBehavior) ? targetBehavior.isGuard() : false;\r\n // TODO: guard\r\n return damage / (damage > 0 && isGuard ? 2 * target.sparam(MRBasics_1.MRBasics.sparams.grd) : 1);\r\n }\r\n applyProficiency(damage) {\r\n return damage * this._effect.fact().genericEffectRate();\r\n }\r\n applyDamageRate(damage, paramId, target) {\r\n if (damage > 0) {\r\n return damage * target.traitsPi(MRBasics_1.MRBasics.traits.ParamDamageRate, paramId);\r\n }\r\n // else if (damage < 0) {\r\n // target.traitsPi(REBasics.traits.RecoverRate);\r\n // }\r\n else {\r\n return damage;\r\n }\r\n }\r\n getRacePointRate(count) {\r\n // 最初の印は等倍。以降は 0.1 倍。\r\n // 原作ではかなり細かく設定されているが、ひとまずはこの仕様で。\r\n // http://shiren2.lsx3.com/?%B0%F5\r\n if (count == 0)\r\n return 1.0;\r\n return 0.1;\r\n }\r\n applyRaceRate(damage, target) {\r\n const traits = this._effect.subject().traits(MRBasics_1.MRBasics.traits.RaceRate);\r\n if (traits.length > 0) {\r\n const points = [];\r\n // value (特効倍率) の大きい順にソートする\r\n traits.sort((a, b) => {\r\n return a.value - b.value;\r\n });\r\n // Race ごとに、特効割合を計算する\r\n for (const t of traits) {\r\n if (points[t.dataId] === undefined) {\r\n points[t.dataId] = {\r\n value: 0,\r\n count: 0,\r\n };\r\n }\r\n const p = points[t.dataId];\r\n p.value += t.value * this.getRacePointRate(p.count); // 印の重ね掛けに対する割合調整\r\n p.count++;\r\n }\r\n // 対象が持つ Race に特効割合を加算していく\r\n let rate = 0;\r\n let count = 0;\r\n for (const raceId of target.queryRaceIds()) {\r\n if (points[raceId] !== undefined) {\r\n rate += points[raceId].value;\r\n count++;\r\n }\r\n }\r\n if (count > 0) {\r\n return rate * damage;\r\n }\r\n }\r\n return damage;\r\n }\r\n // Game_Action.prototype.executeDamage\r\n // Game_Action.prototype.executeHpDamage\r\n executeDamage(paramEffect, target, value, result) {\r\n //const b = target.findBehavior(LBattlerBehavior);\r\n //assert(b);\r\n var _a;\r\n //b.gainActualParam(DBasics.params.hp, -value);\r\n const oldValue = target.getActualParam(paramEffect.paramId);\r\n if (value === 0) {\r\n result.critical = false;\r\n }\r\n if (paramEffect.isDrain) {\r\n value = Math.min(oldValue, value);\r\n }\r\n result.makeSuccess();\r\n if (paramEffect.qualifying.applyTarget == DEffect_1.DValuePoint.Actual) {\r\n target.gainActualParam(paramEffect.paramId, -value, false);\r\n if (value > 0) {\r\n // TODO:\r\n //target.onDamage(value);\r\n this.removeStatesByDamage(target, paramEffect.paramId);\r\n }\r\n this.gainDrainedParam(paramEffect, value);\r\n }\r\n else if (paramEffect.qualifying.applyTarget == DEffect_1.DValuePoint.Growth) {\r\n (_a = target.params.params()[paramEffect.paramId]) === null || _a === void 0 ? void 0 : _a.gainEffortValue(-value);\r\n }\r\n else {\r\n throw new Error(\"Not implemented.\");\r\n }\r\n if (!paramEffect.qualifying.silent) {\r\n const paramResult = new LEffectResult_1.LParamEffectResult(paramEffect.paramId);\r\n paramResult.applyTarget = paramEffect.qualifying.applyTarget;\r\n paramResult.damage = value;\r\n paramResult.oldValue = oldValue;\r\n paramResult.parameterDamageEffect = paramEffect.qualifying;\r\n //paramResult.newValue = target.actualParam(paramEffect.paramId);\r\n paramResult.drain = paramEffect.isDrain;\r\n result.paramEffects2.push(paramResult);\r\n }\r\n //console.log(\"damage\", paramEffect.paramId, value);\r\n if (paramEffect.paramId == MRBasics_1.MRBasics.params.hp) {\r\n result.hpAffected = true;\r\n }\r\n }\r\n // Game_Action.prototype.gainDrainedHp\r\n gainDrainedParam(paramEffect, value) {\r\n if (paramEffect.isDrain) {\r\n let gainTarget = this._effect.subject();\r\n // TODO:\r\n //if (this._reflectionTarget) {\r\n // gainTarget = this._reflectionTarget;\r\n //}\r\n if (gainTarget) {\r\n gainTarget.gainActualParam(paramEffect.paramId, value, false);\r\n }\r\n }\r\n }\r\n // Game_Action.prototype.applyItemEffect\r\n applyItemEffect(cctx, target, effect, result) {\r\n switch (effect.code) {\r\n case DItemEffect_1.DItemEffect.EFFECT_RECOVER_HP:\r\n throw new Error(\"Not implemented.\");\r\n //this.itemEffectRecoverHp(target, effect);\r\n break;\r\n case DItemEffect_1.DItemEffect.EFFECT_RECOVER_MP:\r\n throw new Error(\"Not implemented.\");\r\n //this.itemEffectRecoverMp(target, effect);\r\n break;\r\n case DItemEffect_1.DItemEffect.EFFECT_GAIN_TP:\r\n throw new Error(\"Not implemented.\");\r\n //this.itemEffectGainTp(target, effect);\r\n break;\r\n case DItemEffect_1.DItemEffect.EFFECT_ADD_STATE:\r\n this.itemEffectAddState(target, effect, result);\r\n break;\r\n case DItemEffect_1.DItemEffect.EFFECT_REMOVE_STATE:\r\n this.itemEffectRemoveState(target, effect, result);\r\n break;\r\n case DItemEffect_1.DItemEffect.EFFECT_ADD_BUFF:\r\n throw new Error(\"Not implemented.\");\r\n //this.itemEffectAddBuff(target, effect);\r\n break;\r\n case DItemEffect_1.DItemEffect.EFFECT_ADD_DEBUFF:\r\n throw new Error(\"Not implemented.\");\r\n //this.itemEffectAddDebuff(target, effect);\r\n break;\r\n case DItemEffect_1.DItemEffect.EFFECT_REMOVE_BUFF:\r\n throw new Error(\"Not implemented.\");\r\n //this.itemEffectRemoveBuff(target, effect);\r\n break;\r\n case DItemEffect_1.DItemEffect.EFFECT_REMOVE_DEBUFF:\r\n throw new Error(\"Not implemented.\");\r\n //this.itemEffectRemoveDebuff(target, effect);\r\n break;\r\n case DItemEffect_1.DItemEffect.EFFECT_SPECIAL:\r\n this.itemEffectSpecial(cctx, target, effect, result);\r\n break;\r\n case DItemEffect_1.DItemEffect.EFFECT_GROW:\r\n throw new Error(\"Not implemented.\");\r\n //this.itemEffectGrow(target, effect);\r\n break;\r\n case DItemEffect_1.DItemEffect.EFFECT_LEARN_SKILL:\r\n throw new Error(\"Not implemented.\");\r\n //this.itemEffectLearnSkill(target, effect);\r\n break;\r\n case DItemEffect_1.DItemEffect.EFFECT_COMMON_EVENT:\r\n throw new Error(\"Not implemented.\");\r\n //this.itemEffectCommonEvent(target, effect);\r\n break;\r\n }\r\n }\r\n // Game_Action.prototype.applyItemEffect\r\n applyOtherEffect(cctx, targetEntity, effect, result) {\r\n switch (effect.key) {\r\n case \"kSystemEffect_ふきとばし\":\r\n const subject = this._effect.subject();\r\n LProjectileBehavior_1.LProjectileBehavior.startMoveAsProjectile(cctx, targetEntity, new SEffectContext_1.SEffectSubject(subject), this._effect.fact().direction(), PluginParameters_1.paramThrowingDistance);\r\n break;\r\n case \"kSystemEffect_脱出\":\r\n cctx.postSequel(targetEntity, MRBasics_1.MRBasics.sequels.escape);\r\n UTransfer_1.UTransfer.exitLand(cctx, targetEntity, MRData_1.LandExitResult.Escape);\r\n break;\r\n case \"kSystemEffect_識別\":\r\n UIdentify_1.UIdentify.identify(cctx, targetEntity, true);\r\n break;\r\n default:\r\n throw new Error(\"Not implemented.\");\r\n }\r\n }\r\n // public applyDeathVulnerable(): void {\r\n // }\r\n // Game_Action.prototype.applyItemUserEffect\r\n applyItemUserEffect(target) {\r\n // TODO:\r\n //const value = Math.floor(this.item().tpGain * this.subject().tcr);\r\n //this.subject().gainSilentTp(value);\r\n }\r\n // Game_Action.prototype.itemEffectAddState\r\n // TODO: SAddStateSpecialEffect.itemEffectAddState にまとめたい\r\n itemEffectAddState(target, effect, result) {\r\n if (effect.dataId === 0) {\r\n // ID=0 は \"通常攻撃\" という特殊な状態付加となる。\r\n // RESystem としては処理不要。\r\n }\r\n else {\r\n this.itemEffectAddNormalState(target, effect, result);\r\n }\r\n }\r\n // Game_Action.prototype.itemEffectAddNormalState\r\n // TODO: SAddStateSpecialEffect.itemEffectAddNormalState にまとめたい\r\n itemEffectAddNormalState(target, effect, result) {\r\n const stateData = MRData_1.MRData.states[effect.dataId];\r\n // そもそもステート無効化を持っている場合は追加自体行わない。\r\n // RMMZ標準では、一度追加した後の refresh で remove している。\r\n // ただこれだと makeSuccess() が動いてしまうので、いらないメッセージが出てしまう。\r\n const stateAddable = target.isStateAddable(effect.dataId);\r\n if (!stateAddable)\r\n return;\r\n if (!UState_1.UState.meetsApplyConditions(stateData, target)) {\r\n return;\r\n }\r\n let chance = effect.value1;\r\n if (!this._effect.isCertainHit()) {\r\n chance *= target.stateRate(effect.dataId);\r\n chance *= this._effect.lukEffectRate(target);\r\n }\r\n if (this._rand.nextIntWithMax(100) < (chance * 100)) {\r\n this.addState(target, effect.dataId, result);\r\n }\r\n }\r\n // TODO: SAddStateSpecialEffect.addState にまとめたい\r\n addState(target, stateId, result) {\r\n target.addState(stateId);\r\n result.makeSuccess();\r\n const stateData = MRData_1.MRData.states[stateId];\r\n if (stateData.deadState) {\r\n result.clearParamEffects();\r\n }\r\n }\r\n removeStatesByDamage(target, paramId) {\r\n const removeStates = [];\r\n target.iterateStates(s => {\r\n const data = s.stateData();\r\n for (const r of data.effect.damageRemovels) {\r\n if (r.paramId == paramId &&\r\n this._rand.nextIntWithMax(100) < r.chance) {\r\n removeStates.push(s.stateDataId());\r\n }\r\n }\r\n });\r\n target.removeStates(removeStates);\r\n }\r\n // Game_Action.prototype.itemEffectRemoveState \r\n itemEffectRemoveState(target, effect, result) {\r\n let chance = effect.value1;\r\n if (this._rand.nextIntWithMax(100) < (chance * 100)) {\r\n target.removeState(effect.dataId);\r\n result.makeSuccess();\r\n }\r\n }\r\n ;\r\n // Game_Action.prototype.itemEffectSpecial\r\n itemEffectSpecial(cctx, target, effect, result) {\r\n if (effect.dataId === DItemEffect_1.DItemEffect.SPECIAL_EFFECT_ESCAPE) {\r\n cctx.postDestroy(target);\r\n result.makeSuccess();\r\n }\r\n }\r\n}\r\nexports.SEffectApplyer = SEffectApplyer;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/SEffectApplyer.ts?"); /***/ }), /***/ "./ts/mr/system/SEffectContext.ts": /*!****************************************!*\ !*** ./ts/mr/system/SEffectContext.ts ***! \****************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SEffectContext = exports.SEffectSubject = exports.SEffectIncidentType = void 0;\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst LBattlerBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LBattlerBehavior */ \"./ts/mr/lively/behaviors/LBattlerBehavior.ts\");\r\nconst Helpers_1 = __webpack_require__(/*! ./Helpers */ \"./ts/mr/system/Helpers.ts\");\r\nconst LEnemyBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LEnemyBehavior */ \"./ts/mr/lively/behaviors/LEnemyBehavior.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst SEffectApplyer_1 = __webpack_require__(/*! ./SEffectApplyer */ \"./ts/mr/system/SEffectApplyer.ts\");\r\nconst internal_1 = __webpack_require__(/*! ../lively/internal */ \"./ts/mr/lively/internal.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ./SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst LObject_1 = __webpack_require__(/*! ../lively/LObject */ \"./ts/mr/lively/LObject.ts\");\r\nconst UEffect_1 = __webpack_require__(/*! ../utility/UEffect */ \"./ts/mr/utility/UEffect.ts\");\r\nconst UAction_1 = __webpack_require__(/*! ../utility/UAction */ \"./ts/mr/utility/UAction.ts\");\r\nvar SEffectIncidentType;\r\n(function (SEffectIncidentType) {\r\n /** 直接攻撃 (ヤリなど、隣接していない場合もあり得る) */\r\n SEffectIncidentType[SEffectIncidentType[\"DirectAttack\"] = 0] = \"DirectAttack\";\r\n /** 間接攻撃 (矢など) */\r\n SEffectIncidentType[SEffectIncidentType[\"IndirectAttack\"] = 1] = \"IndirectAttack\";\r\n})(SEffectIncidentType = exports.SEffectIncidentType || (exports.SEffectIncidentType = {}));\r\nclass SEffectSubject {\r\n constructor(entity) {\r\n this._entity = entity;\r\n }\r\n entity() {\r\n return this._entity;\r\n }\r\n}\r\nexports.SEffectSubject = SEffectSubject;\r\n/**\r\n * ダメージや状態異常、バフの適用など、パラメータ操作に関わる一連の処理を行う。\r\n *\r\n * - インスタンスは1度のコマンドチェーンで複数個作られることもある。(3方向同時攻撃など)\r\n * 複数対象への攻撃中、途中でパラメータ変動を伴うフィードバックを受ける可能性もあるため、\r\n * 複数のダメージ適用でひとつのインスタンスを使いまわすのは禁止。\r\n * また LLVM の Pass のように、関係者で REEffectContext を持ちまわって加工しながら Effect を積んでいく使い方になるが、\r\n * 状態異常をダメージに変換するようなエネミーを設計するときには Effector 側が積んだ Effect を変更することになる。\r\n * そのためインスタンスは別にしないと、同時攻撃で他の攻撃対象に影響が出てしまうことがある。\r\n * - インスタンスは Command に乗せて持ち回り、コマンドチェーン内で必ず Apply する。外には出ない。(そうしないと Attr に保存するような事態になるので)\r\n *\r\n * 戦闘不能について\r\n * ----------\r\n * ツクールの仕様にできるだけ寄せてみる。ツクールの仕様は…\r\n * - 戦闘不能ステートID は Game_Battler.deathStateId() で取得 (1)\r\n * - Game_Battler.refresh() で、HP が 0 であれば deathState が追加される。\r\n * - Game_BattlerBase.addNewState() で、で、deathState が追加されたら die() が呼ばれ HP 0 になる。\r\n * - Game_Battler.removeState() で、deathState が取り除かれたら revivie() が呼ばれ HP 1 になる。\r\n * - refresh() はダメージ適用や装備変更など様々なタイミングで呼び出される。\r\n * - Game_Action.apply() > executeHpDamage() > Game_Battler.gainHp() > setHp() > refresh() 等。\r\n *\r\n *\r\n *\r\n * [2020/11/11] 複数ターゲットへの攻撃をひとつの EffectContext にまとめるべき?\r\n * ----------\r\n * 分けた場合、1つの対象への処理が終わったすぐ後に、フィードバックの処理を始めることができる。\r\n * 例えば、3体まとめて攻撃するとき、1体目に攻撃したときに反撃をもらい倒れてしまったとき、後続を攻撃するか、といった具合。\r\n * …でもこのケースだと EffectContext の中で戦闘不能を判断できるか。やる・やらないは別として。\r\n *\r\n * とにかく一度に複数対象へのダメージ適用を「中断」する可能性があるか?ということ。\r\n * そうかんがえると「ほとんど無い」\r\n * EffectContext 自体が複数対象へのダメージ適用をサポートしたとしても、\r\n * もしそのような中断がやりたければひとつずつインスタンス作って addTarget すればいいだけなので、まとめる方向で作ってよさそう。\r\n */\r\nclass SEffectContext {\r\n // 経験値など、報酬に関わるフィードバックを得る人。\r\n // 基本は effectors と同じだが、反射や投げ返しを行ったときは経験値を得る人が変わるため、その対応のために必要となる。\r\n //private _awarder: LEntity[] = [];\r\n // 被適用側 (防御側) の関係者。AttackCommand を受け取ったときなど、ダメージ計算したい直前に構築する。\r\n // effectors と同じく、装備品なども含まれる。(サビなど修正値ダウンしたり、ひびが入ったり、燃えたりといった処理のため)\r\n //private _effectees: LEntity[] = [];\r\n //private _targetEntity: REGame_Entity;\r\n //private _targetBattlerBehavior: LBattlerBehavior;\r\n constructor(subject, rand) {\r\n this._effectorFact = subject;\r\n this._rand = rand;\r\n }\r\n effectorFact() {\r\n return this._effectorFact;\r\n }\r\n applyWithWorth(cctx, targets) {\r\n const applies = UEffect_1.UEffect.resolveApplyEffects(this._effectorFact.effects(), targets, cctx.random());\r\n for (const info of applies.targets) {\r\n for (const effect of info.actualEffects) {\r\n if (info.target.previewRejection(cctx, { kind: \"Effect\", effect: effect.data() })) {\r\n this.applyWithHitTest(cctx, effect, info.target, info.mainTarget);\r\n }\r\n }\r\n // for (const [key, value] of info.targets.entries()) {\r\n // const effects = this.selectEffects(value, cctx.random());\r\n // for (const effect of effects) {\r\n // if (key.previewRejection(cctx, { kind: \"Effect\", effect: effect.data() })) {\r\n // this.applyWithHitTest(cctx, effect, key, info.mainTarget);\r\n // }\r\n // }\r\n // //entries.push(`${key}:${value}`);\r\n // }\r\n }\r\n // //let deadCount = 0;\r\n // for (const target of targets) {\r\n // const localTargets = new Map();\r\n // // まず SubComponent を含めた適用対象を取り出す\r\n // for (const effect of this._effectorFact.effects()) {\r\n // // Find sub-components\r\n // const subComponentKey = effect.data().matchConditions.key;\r\n // if (subComponentKey) {\r\n // for (const subTarget of target.querySubEntities(subComponentKey)) {\r\n // const pair = localTargets.get(subTarget);\r\n // if (pair) {\r\n // pair.push(effect);\r\n // }\r\n // else {\r\n // localTargets.set(subTarget, [effect]);\r\n // }\r\n // }\r\n // }\r\n // else {\r\n // // Main Effect\r\n // const pair = localTargets.get(target);\r\n // if (pair) {\r\n // pair.push(effect);\r\n // }\r\n // else {\r\n // localTargets.set(target, [effect]);\r\n // }\r\n // }\r\n // }\r\n // for (const [key, value] of localTargets.entries()) {\r\n // const effects = this.selectEffects(value, cctx.random());\r\n // for (const effect of effects) {\r\n // if (key.previewRejection(cctx, { kind: \"Effect\", effect: effect.data() })) {\r\n // this.applyWithHitTest(cctx, effect, key, target);\r\n // }\r\n // }\r\n // //entries.push(`${key}:${value}`);\r\n // }\r\n // //this.applyEffectToTarget(cctx, subEffect.effect, subTarget);\r\n // //const effect = this._effectorFact.selectEffect(target);\r\n // // if (target.previewRejection(cctx, { kind: \"Effect\", effect: effect.data() })) {\r\n // // const targets = new Map();\r\n // // targets.set(target, [effect]);\r\n // // // Main Effect\r\n // // this.applyEffectToTarget(cctx, effect, target);\r\n // // // Sub Effects\r\n // // for (const subEffect of this._effectorFact.subEffects()) {\r\n // // for (const subTarget of target.querySubEntities(subEffect.subTargetKey)) {\r\n // // this.applyEffectToTarget(cctx, subEffect.effect, subTarget);\r\n // // }\r\n // // }\r\n // // }\r\n // }\r\n return cctx.postCall(() => { });\r\n }\r\n // public selectEffects(effectList: SEffect[], rand: LRandom): SEffect[] {\r\n // const ratingMax = Math.max(...effectList.map(a => a.data().conditions.applyRating ?? 0));\r\n // if (ratingMax > 0) {\r\n // const effect = this.selectEffect(effectList.filter(x => !!x.data().conditions.applyRating), rand);\r\n // return effect ? [effect] : [];\r\n // }\r\n // else {\r\n // return effectList;\r\n // }\r\n // };\r\n // public selectEffect(effectList: SEffect[], rand: LRandom): SEffect | undefined {\r\n // const ratingMax = Math.max(...effectList.map(a => a.data().conditions.applyRating ?? 0));\r\n // const ratingZero = ratingMax - 10;//- 3;\r\n // const sum = effectList.reduce((r, a) => r + (a.data().conditions.applyRating ?? 0) - ratingZero, 0);\r\n // if (sum > 0) {\r\n // let value = rand.nextIntWithMax(sum);\r\n // for (const action of effectList) {\r\n // if (!action.data().conditions.applyRating) continue;\r\n // value -= (action.data().conditions.applyRating ?? 0) - ratingZero;\r\n // if (value < 0) {\r\n // return action;\r\n // }\r\n // }\r\n // } else {\r\n // return undefined;\r\n // }\r\n // }\r\n // private applyEffectToTarget(cctx: SCommandContext, effect: SEffect, target: LEntity, animationTarget: LEntity): void {\r\n // this.applyWithHitTest(cctx, effect, target, animationTarget);\r\n // }\r\n findAnimationEntity(entity) {\r\n if (!entity.hasParent())\r\n return undefined;\r\n const parent = entity.parentObject();\r\n if (parent.objectType() == LObject_1.LObjectType.Map && entity.objectType() == LObject_1.LObjectType.Entity)\r\n return entity;\r\n return this.findAnimationEntity(parent);\r\n }\r\n // Game_Action.prototype.apply\r\n applyWithHitTest(cctx, effect, target, animationTarget) {\r\n const targetBattlerBehavior = target.findEntityBehavior(LBattlerBehavior_1.LBattlerBehavior);\r\n const effectData = effect.data();\r\n const result = target._effectResult;\r\n result.clear();\r\n result.sourceEffectId = effectData.effectId;\r\n if (effectData.effect.hasAnyValidEffect()) {\r\n result._revision++;\r\n }\r\n else {\r\n // この Effect を適用しても、データ的な効果はない。\r\n // そのようなときは \"効かなかった\" といったメッセージも表示しない。\r\n }\r\n // Animation\r\n // ワープなど、特殊効果の中から Motion が発動することもあるため、apply の前に post しておく。\r\n {\r\n let animationPosted = false;\r\n const effectData = effect.data();\r\n const behavior = this._effectorFact.subjectBehavior();\r\n const attackFlavorEffect = behavior ? behavior.attackAnimationId() : MRData_1.MRData.system.bareHandsFlavorEffect;\r\n const flavorEffect = (effectData.effect.flavorEffect === undefined) ? attackFlavorEffect : effectData.effect.flavorEffect;\r\n if (flavorEffect) {\r\n const animationTarget2 = this.findAnimationEntity(target);\r\n if (animationTarget2) {\r\n cctx.displayFlavorEffect(animationTarget2, flavorEffect, { messageFormatArgs: [] });\r\n animationPosted = true;\r\n }\r\n }\r\n const selfEffect = this._effectorFact.effectSet().succeededSelfEffect;\r\n if (selfEffect) {\r\n if (selfEffect.effect.flavorEffect) {\r\n cctx.displayFlavorEffect(effect.subject(), selfEffect.effect.flavorEffect, { messageFormatArgs: [] });\r\n animationPosted = true;\r\n }\r\n }\r\n if (animationPosted) {\r\n cctx.postWaitSequel();\r\n }\r\n }\r\n // 以下、アニメーションが終わった後に実行したい。\r\n return cctx.postCall(() => {\r\n if (targetBattlerBehavior) {\r\n result.used = this.testApply(targetBattlerBehavior);\r\n // 命中判定\r\n this.judgeHits(effect, target, result);\r\n result.physical = effect.isPhysical();\r\n if (result.isHit()) {\r\n this.applyCore(cctx, effect, target, result);\r\n }\r\n //this.updateLastTarget(target);\r\n }\r\n else {\r\n this.applyCore(cctx, effect, target, result);\r\n }\r\n const focusedEntity = MRLively_1.MRLively.mapView.focusedEntity();\r\n const friendlySubject = focusedEntity ? Helpers_1.Helpers.isFriend(effect.subject(), focusedEntity) : false;\r\n if (friendlySubject) { // subject は味方\r\n result.focusedFriendly = Helpers_1.Helpers.isFriend(effect.subject(), target);\r\n }\r\n else { // subject は味方以外 (敵・NPC)\r\n result.focusedFriendly = true; // 敵 vs 敵のときは、味方用のメッセージを表示したい (\"ダメージを受けた!\")\r\n }\r\n // ダメージ試行時のステート解除判定 (かなしばりなど)\r\n // 実際にダメージが発生したかではなく、ダメージを与えようとしたか (回復ではないか) で判断する。\r\n {\r\n const removeStates = [];\r\n for (const p of effect.parameterEffects2()) {\r\n if (p && !p.isRecover()) {\r\n target.iterateStates(s => {\r\n if (s.checkRemoveAtDamageTesting(p.paramId)) {\r\n removeStates.push(s.stateDataId());\r\n }\r\n return true;\r\n });\r\n }\r\n }\r\n target.removeStates(removeStates);\r\n }\r\n {\r\n cctx.post(target, effect.subject(), new SEffectSubject(this._effectorFact.subject()), undefined, internal_1.onEffectResult);\r\n }\r\n // ここで Flush している理由は次の通り。\r\n // 1. ダメージを個々に表示したい\r\n // 2. 表示の順序関係を守りたい\r\n //\r\n // 1については、連撃等何らかの理由で複数回受けたときに個別に表示する。\r\n // 経験値の場合はまとめて表示したいのでこことは異なる箇所で表示するが、これはそうではないケース。\r\n // 例えば「Aは合計でXXXのダメージを受けた」といったように後でまとめて表示する場合はこの処理はいらない。\r\n //\r\n // 2については、現状では経験値の表示処理など後でまとめて表示するとき、その順序関係は Entity 順になってしまうため。\r\n cctx.postEffectResult(target);\r\n if (target.isDeathStateAffected()) {\r\n //deadCount++;\r\n const battler = target.findEntityBehavior(LBattlerBehavior_1.LBattlerBehavior);\r\n if (battler instanceof LEnemyBehavior_1.LEnemyBehavior) {\r\n this._effectorFact.subject()._reward.addExp(battler.exp());\r\n }\r\n }\r\n });\r\n }\r\n judgeHits(effect, target, result) {\r\n const subject = this._effectorFact.subject();\r\n if (subject) {\r\n if (SEffectContext.judgeCertainHits(subject, effect, this._effectorFact.incidentType(), target, result)) {\r\n return;\r\n }\r\n }\r\n else {\r\n // 罠Entityなど。\r\n }\r\n const hitRate = effect.hitRate() * 100; // 攻撃側命中率\r\n const evaRate = effect.evaRate(target) * 100; // 受け側回避率\r\n result.missed = result.used && this._rand.nextIntWithMax(100) >= hitRate;\r\n result.evaded = !result.missed && this._rand.nextIntWithMax(100) < evaRate;\r\n }\r\n static judgeCertainHits(subject, effect, type, target, result) {\r\n if (type == SEffectIncidentType.DirectAttack) {\r\n if (subject.traits(MRBasics_1.MRBasics.traits.CertainDirectAttack).length > 0) {\r\n // 直接攻撃必中\r\n result.missed = false;\r\n result.evaded = false;\r\n return true;\r\n }\r\n }\r\n else if (type == SEffectIncidentType.IndirectAttack) {\r\n const awful = (subject.traits(MRBasics_1.MRBasics.traits.AwfulPhysicalIndirectAttack).length > 0);\r\n const hit = (subject.traits(MRBasics_1.MRBasics.traits.CertainIndirectAttack).length > 0);\r\n const avoid = (target.traits(MRBasics_1.MRBasics.traits.DodgePhysicalIndirectAttack).length > 0);\r\n if (hit && avoid) {\r\n // 絶対命中と絶対回避がコンフリクトしている場合は通常の判定を行う\r\n return false;\r\n }\r\n else if (avoid) {\r\n // 間接攻撃回避\r\n result.missed = true;\r\n result.evaded = true;\r\n return true;\r\n }\r\n else if (hit) {\r\n // 間接攻撃 - 絶対命中 (へた投げより優先)\r\n result.missed = false;\r\n result.evaded = false;\r\n return true;\r\n }\r\n else if (awful) {\r\n // 間接攻撃命中なし(へた投げ)\r\n result.missed = true;\r\n result.evaded = true;\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n // Game_Action.prototype.testApply\r\n testApply(target) {\r\n // NOTE: コアスクリプトではバトル中かどうかで成否判定が変わったりするが、\r\n // 本システムでは常に戦闘中のようにふるまう。\r\n return this.testLifeAndDeath(target);\r\n }\r\n // Game_Action.prototype.testLifeAndDeath\r\n testLifeAndDeath(targetBattlerBehavior) {\r\n /*\r\n const itemScope = this._effectorFact.rmmzEffectScope()\r\n if (UAction.isForOpponent(itemScope) || UAction.isForAliveFriend(itemScope)) {\r\n return targetBattlerBehavior.isAlive();\r\n } else if (UAction.isForDeadFriend(itemScope)) {\r\n return targetBattlerBehavior.isDead();\r\n } else {\r\n return true;\r\n }\r\n */\r\n return true;\r\n }\r\n applyCore(cctx, effect, target, result) {\r\n // Override?\r\n {\r\n let result = SCommand_1.SCommandResponse.Pass;\r\n target.iterateBehaviorsReverse(b => {\r\n result = b.onPreApplyEffect(target, cctx, effect);\r\n return result == SCommand_1.SCommandResponse.Pass;\r\n });\r\n if (result != SCommand_1.SCommandResponse.Pass)\r\n return;\r\n }\r\n if (effect.hasParamDamage()) {\r\n const criRate = effect.criRate(target) * 100;\r\n result.critical = (this._rand.nextIntWithMax(100) < criRate);\r\n }\r\n const applyer = new SEffectApplyer_1.SEffectApplyer(effect, this._rand);\r\n applyer.apply(cctx, effect, target);\r\n applyer.apply(cctx, this._effectorFact.selfModifier(), this._effectorFact.subject());\r\n if (target._effectResult.success) {\r\n const effect2 = this._effectorFact.succeededSelfModifier();\r\n if (effect2) {\r\n applyer.apply(cctx, effect2, this._effectorFact.subject());\r\n }\r\n }\r\n // 成否がなんであれ、何らかの効果を与えようという意思が働いたことを通知する\r\n UAction_1.UAction.postEffectSensed(cctx, target);\r\n }\r\n}\r\nexports.SEffectContext = SEffectContext;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/SEffectContext.ts?"); /***/ }), /***/ "./ts/mr/system/SEmittorPerformer.ts": /*!*******************************************!*\ !*** ./ts/mr/system/SEmittorPerformer.ts ***! \*******************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SEmittorPerformer = void 0;\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst DEffect_1 = __webpack_require__(/*! ts/mr/data/DEffect */ \"./ts/mr/data/DEffect.ts\");\r\nconst DSpawner_1 = __webpack_require__(/*! ts/mr/data/DSpawner */ \"./ts/mr/data/DSpawner.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst LProjectileBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/activities/LProjectileBehavior */ \"./ts/mr/lively/behaviors/activities/LProjectileBehavior.ts\");\r\nconst internal_1 = __webpack_require__(/*! ts/mr/lively/internal */ \"./ts/mr/lively/internal.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst SEffectContext_1 = __webpack_require__(/*! ./SEffectContext */ \"./ts/mr/system/SEffectContext.ts\");\r\nconst SEntityFactory_1 = __webpack_require__(/*! ./SEntityFactory */ \"./ts/mr/system/SEntityFactory.ts\");\r\nconst UMovement_1 = __webpack_require__(/*! ../utility/UMovement */ \"./ts/mr/utility/UMovement.ts\");\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst DCommon_1 = __webpack_require__(/*! ../data/DCommon */ \"./ts/mr/data/DCommon.ts\");\r\nconst SEffectApplyer_1 = __webpack_require__(/*! ./SEffectApplyer */ \"./ts/mr/system/SEffectApplyer.ts\");\r\nconst USearch_1 = __webpack_require__(/*! ../utility/USearch */ \"./ts/mr/utility/USearch.ts\");\r\nconst UAction_1 = __webpack_require__(/*! ../utility/UAction */ \"./ts/mr/utility/UAction.ts\");\r\nconst UName_1 = __webpack_require__(/*! ../utility/UName */ \"./ts/mr/utility/UName.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ./SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nclass SEmittorPerformer {\r\n constructor(subject, performer) {\r\n /** スキルとして発動する場合のスキルID. スキルではない場合 0. */\r\n this._skillId = 0;\r\n /** Emittor がアイテムを対象とする場合、その対象となるアイテム */\r\n this._selectedTargetItems = [];\r\n /** 対象に効果を適用する際の基準となる向き。ノックバック方向等に使用する。0 の場合、performer の向きを採用する。 */\r\n this._effectDirection = 0;\r\n this._subject = subject;\r\n this._performer = performer;\r\n this._onPerformed = undefined;\r\n }\r\n static makeWithSkill(subject, performer, skillId) {\r\n (0, Common_1.assert)(skillId > 0);\r\n const i = new SEmittorPerformer(subject, performer);\r\n i._skillId = skillId;\r\n return i;\r\n }\r\n static makeWithEmitor(subject, performer, emittor) {\r\n const i = new SEmittorPerformer(subject, performer);\r\n i._emittor = emittor;\r\n return i;\r\n }\r\n setSkillId(value) {\r\n this._skillId = value;\r\n return this;\r\n }\r\n setEmittor(value) {\r\n this._emittor = value;\r\n return this;\r\n }\r\n setItemEntity(value) {\r\n this._itemEntity = value;\r\n return this;\r\n }\r\n setSelectedTargetItems(value) {\r\n this._selectedTargetItems = value;\r\n return this;\r\n }\r\n setDffectDirection(value) {\r\n this._effectDirection = value;\r\n return this;\r\n }\r\n setProjectilePriorityEffectSet(value) {\r\n this._projectilePriorityEffectSet = value;\r\n return this;\r\n }\r\n perform(cctx, onPerformed) {\r\n this._onPerformed = onPerformed;\r\n if (this._skillId > 0) {\r\n this.performeSkill(cctx, this._performer, this._skillId);\r\n }\r\n else if (this._emittor) {\r\n this.performeEffect(cctx, this._performer, this._emittor, (this._effectDirection > 0) ? this._effectDirection : this._performer.dir, this._itemEntity, this._selectedTargetItems, 0);\r\n }\r\n else {\r\n throw new Error(\"Unreachable.\");\r\n }\r\n }\r\n /**\r\n * スキル発動\r\n *\r\n * 単純にスキルを発動する。地形や相手の状態による成否はこの中で判断する。\r\n */\r\n performeSkill(cctx, performer, skillId) {\r\n const skill = MRData_1.MRData.skills[skillId];\r\n ///const effector = new SEffectorFact(entity, skill.effect);\r\n // もともと UntBehavior.onAction() で AttackActionId をフックして処理していたが、こちらに持ってきた。\r\n // Attack という Action よりは、「スキル発動」という Action を実行する方が自然かも。\r\n cctx.displayFlavorEffect(performer, skill.flavorEffect, { messageFormatArgs: [UName_1.UName.makeUnitName(performer), skill.name] });\r\n const effect = skill.emittor();\r\n if (effect) {\r\n this.performeEffect(cctx, performer, effect, performer.dir, undefined, [], skillId);\r\n }\r\n }\r\n canPayParamCost(entity, paramId, cost) {\r\n if (cost.type == DEffect_1.DParamCostType.Decrease) {\r\n if (entity.getActualParam(paramId) < cost.value)\r\n return false;\r\n }\r\n else if (cost.type == DEffect_1.DParamCostType.Increase) {\r\n const d = entity.getParamActualMax(paramId) - entity.getActualParam(paramId);\r\n if (d < cost.value)\r\n return false;\r\n }\r\n else {\r\n throw new Error(\"Unreachable.\");\r\n }\r\n return true;\r\n }\r\n payParamCost(entity, paramId, cost) {\r\n if (cost.type == DEffect_1.DParamCostType.Decrease) {\r\n entity.gainActualParam(paramId, -cost.value, true);\r\n }\r\n else if (cost.type == DEffect_1.DParamCostType.Increase) {\r\n entity.gainActualParam(paramId, cost.value, true);\r\n }\r\n else {\r\n throw new Error(\"Unreachable.\");\r\n }\r\n }\r\n canPaySkillCost(performer, costs, item) {\r\n const performerCosts = costs.paramCosts[DEffect_1.DSkillCostSource.Actor];\r\n if (performerCosts) {\r\n for (let paramId = 0; paramId < performerCosts.length; paramId++) {\r\n const cost = performerCosts[paramId];\r\n if (cost !== undefined) {\r\n if (!this.canPayParamCost(performer, paramId, cost))\r\n return false;\r\n }\r\n }\r\n }\r\n else {\r\n // No cost. Available.\r\n }\r\n const itemCosts = costs.paramCosts[DEffect_1.DSkillCostSource.Item];\r\n if (itemCosts) {\r\n for (let paramId = 0; paramId < itemCosts.length; paramId++) {\r\n const cost = itemCosts[paramId];\r\n if (cost !== undefined) {\r\n if (!item)\r\n return false; // ItemCost があるのに item が無い場合は発動不可能\r\n if (!this.canPayParamCost(item, paramId, cost))\r\n return false;\r\n }\r\n }\r\n }\r\n else {\r\n // No cost. Available.\r\n }\r\n return true;\r\n }\r\n paySkillCost(performer, costs, item) {\r\n const performerCosts = costs.paramCosts[DEffect_1.DSkillCostSource.Actor];\r\n if (performerCosts) {\r\n for (let paramId = 0; paramId < performerCosts.length; paramId++) {\r\n const cost = performerCosts[paramId];\r\n if (cost !== undefined) {\r\n this.payParamCost(performer, paramId, cost);\r\n }\r\n }\r\n }\r\n const itemCosts = costs.paramCosts[DEffect_1.DSkillCostSource.Item];\r\n if (itemCosts) {\r\n for (let paramId = 0; paramId < itemCosts.length; paramId++) {\r\n const cost = itemCosts[paramId];\r\n if (cost !== undefined) {\r\n (0, Common_1.assert)(item);\r\n this.payParamCost(item, paramId, cost);\r\n }\r\n }\r\n }\r\n }\r\n raiseSkillEmitted(cctx, performer, targets, skillId) {\r\n const args = {\r\n performer: performer,\r\n targets: targets,\r\n skillId: skillId,\r\n };\r\n MRLively_1.MRLively.eventServer.publish(cctx, MRBasics_1.MRBasics.events.skillEmitted, args);\r\n }\r\n onPerformed(cctx, targets) {\r\n if (this._onPerformed) {\r\n this._onPerformed(targets);\r\n }\r\n if (this._emittor) {\r\n const emittor = this._emittor;\r\n for (const target of targets) {\r\n target.iterateBehaviorsReverse(b => {\r\n return b.onEffectPerformed(target, cctx, emittor) == SCommand_1.SCommandResponse.Pass;\r\n });\r\n }\r\n }\r\n }\r\n /**\r\n *\r\n * @param cctx\r\n * @param performer\r\n * @param emittor\r\n * @param itemData 杖など\r\n */\r\n performeEffect(cctx, performer, emittor, effectDir, itemEntity, selectedItems, skillId) {\r\n // コストで発動可否判断\r\n if (!this.canPaySkillCost(performer, emittor.costs, itemEntity)) {\r\n return;\r\n }\r\n // コスト消費\r\n this.paySkillCost(performer, emittor.costs, itemEntity);\r\n // 発動側アニメーション\r\n {\r\n if (emittor.selfAnimationId > 0) {\r\n cctx.postAnimation(performer, emittor.selfAnimationId, true);\r\n }\r\n if (emittor.selfSequelId > 0) {\r\n cctx.postSequel(performer, emittor.selfSequelId, undefined, undefined, true);\r\n }\r\n }\r\n //const subject = performer.getEntityBehavior(LBattlerBehavior);\r\n if (emittor.scope.range == DEffect_1.DEffectFieldScopeType.Performer) {\r\n const effectSubject = new SEffectApplyer_1.SEffectorFact(this._subject, emittor.effectSuite, SEffectContext_1.SEffectIncidentType.IndirectAttack, effectDir /*performer.dir*/);\r\n if (itemEntity) {\r\n effectSubject.withIncidentEntityKind(itemEntity.kindDataId());\r\n effectSubject.withItem(itemEntity);\r\n }\r\n if (skillId > 0) {\r\n effectSubject.withSkill(skillId);\r\n }\r\n const effectContext = new SEffectContext_1.SEffectContext(effectSubject, cctx.random());\r\n // if (emittor.effect.rmmzAnimationId) {\r\n // cctx.postAnimation(performer, emittor.effect.rmmzAnimationId, true);\r\n // }\r\n const targets = [performer];\r\n // アニメーションを Wait してから効果を発動したいので、ここでは post が必要。\r\n cctx.postCall(() => {\r\n effectContext.applyWithWorth(cctx, targets);\r\n this.onPerformed(cctx, targets);\r\n if (skillId > 0) {\r\n this.raiseSkillEmitted(cctx, performer, targets, skillId);\r\n }\r\n });\r\n }\r\n else if (emittor.scope.range == DEffect_1.DEffectFieldScopeType.Front1) {\r\n const frontBlock = UMovement_1.UMovement.getFrontBlock(performer);\r\n // 攻撃エフェクト (TODO: Front1 に限らず、効果範囲の重心に対して発動するようにする)\r\n let targetAreaAnimationId = emittor.targetAreaAnimationId;\r\n if (targetAreaAnimationId < 0) { // RMMZ の仕様として、-1 は装備武器のアニメーションを使用する\r\n targetAreaAnimationId = performer.getAttackAnimationId(0);\r\n }\r\n cctx.postFloatingAnimation(performer, frontBlock.mx, frontBlock.my, targetAreaAnimationId, false);\r\n // TODO: ユーザー側モーション\r\n cctx.postSequel(performer, MRBasics_1.MRBasics.sequels.attack);\r\n // TODO: 正面3方向攻撃とかの場合はここをループする\r\n //for ()\r\n {\r\n // 攻撃対象決定\r\n //const target = cctx.findReactorEntityInBlock(UMovement.getFrontBlock(performer), DBasics.actions.AttackActionId);\r\n const targets = this.getTargetInBlock(frontBlock, emittor.scope);\r\n for (const target of targets) {\r\n const effectSubject = new SEffectApplyer_1.SEffectorFact(this._subject, emittor.effectSuite, SEffectContext_1.SEffectIncidentType.DirectAttack, performer.dir);\r\n if (itemEntity) {\r\n effectSubject.withIncidentEntityKind(itemEntity.kindDataId());\r\n effectSubject.withItem(itemEntity);\r\n }\r\n if (skillId > 0) {\r\n effectSubject.withSkill(skillId);\r\n }\r\n const effectContext = new SEffectContext_1.SEffectContext(effectSubject, cctx.random());\r\n //effectContext.addEffector(effector);\r\n if (UMovement_1.UMovement.checkDiagonalWallCornerCrossing(performer, performer.dir)) {\r\n // 斜め向きで壁の角と交差しているので通常攻撃は通らない\r\n }\r\n else {\r\n // const rmmzAnimationId = (emittor.effect.rmmzAnimationId < 0) ? subject.attackAnimationId() : emittor.effect.rmmzAnimationId;\r\n // if (rmmzAnimationId > 0) {\r\n // cctx.postAnimation(target, rmmzAnimationId, true);\r\n // }\r\n // TODO: SEffectSubject はダミー\r\n cctx.post(target, performer, new SEffectContext_1.SEffectSubject(performer), { effectContext: effectContext }, internal_1.onAttackReaction)\r\n .then(() => {\r\n this.onPerformed(cctx, [target]);\r\n if (skillId > 0) {\r\n //this.raiseSkillEmitted(cctx, performer, [target], skillId);\r\n }\r\n return true;\r\n });\r\n }\r\n }\r\n // target が無くても、スキル発動したことは伝える\r\n if (skillId > 0)\r\n this.raiseSkillEmitted(cctx, performer, targets, skillId);\r\n }\r\n }\r\n else if (emittor.scope.range == DEffect_1.DEffectFieldScopeType.StraightProjectile) {\r\n this.performeEffect_StraightProjectile(cctx, performer, emittor, itemEntity, performer.mx, performer.my, performer.dir);\r\n }\r\n else if (emittor.scope.range == DEffect_1.DEffectFieldScopeType.ReceiveProjectile) {\r\n const dir = this._effectDirection != 0 ? this._effectDirection : performer.dir;\r\n const block = USearch_1.USearch.findFirstWallInDirection(performer.mx, performer.my, dir);\r\n this.performeEffect_StraightProjectile(cctx, performer, emittor, itemEntity, block.mx, block.my, UMovement_1.UMovement.reverseDir(dir));\r\n }\r\n else if (emittor.scope.range == DEffect_1.DEffectFieldScopeType.Selection) {\r\n const effectSubject = new SEffectApplyer_1.SEffectorFact(this._subject, emittor.effectSuite, SEffectContext_1.SEffectIncidentType.IndirectAttack, effectDir /*performer.dir*/);\r\n if (itemEntity) {\r\n effectSubject.withIncidentEntityKind(itemEntity.kindDataId());\r\n effectSubject.withItem(itemEntity);\r\n }\r\n if (skillId > 0) {\r\n effectSubject.withSkill(skillId);\r\n }\r\n const effectContext = new SEffectContext_1.SEffectContext(effectSubject, cctx.random());\r\n effectContext.applyWithWorth(cctx, selectedItems);\r\n this.onPerformed(cctx, selectedItems);\r\n }\r\n else if (emittor.scope.range == DEffect_1.DEffectFieldScopeType.Around || emittor.scope.range == DEffect_1.DEffectFieldScopeType.AroundAndCenter) {\r\n const withCenter = (emittor.scope.range == DEffect_1.DEffectFieldScopeType.AroundAndCenter);\r\n const targets = [];\r\n USearch_1.USearch.iterateAroundEntities(performer.mx, performer.my, emittor.scope.length, withCenter, (entity) => {\r\n if (!entity.equals(performer)) {\r\n targets.push(entity);\r\n }\r\n });\r\n this.applyEffect(cctx, performer, emittor, targets, skillId, itemEntity);\r\n }\r\n else if (emittor.scope.range == DEffect_1.DEffectFieldScopeType.Center) {\r\n const targets = [];\r\n const block = MRLively_1.MRLively.mapView.currentMap.tryGetBlock(performer.mx, performer.my);\r\n if (block) {\r\n for (const entity of block.getEntities()) {\r\n if (!entity.equals(performer)) {\r\n targets.push(entity);\r\n }\r\n }\r\n }\r\n this.applyEffect(cctx, performer, emittor, targets, skillId, itemEntity);\r\n }\r\n else if (emittor.scope.range == DEffect_1.DEffectFieldScopeType.Room) {\r\n const targets = [];\r\n MRLively_1.MRLively.mapView.currentMap.room(performer.roomId()).forEachEntities(entity => {\r\n if (UAction_1.UAction.testFactionMatch(performer, entity, DEffect_1.DRmmzEffectScope.Opponent_All)) {\r\n targets.push(entity);\r\n }\r\n ;\r\n });\r\n this.applyEffect(cctx, performer, emittor, targets, skillId, itemEntity);\r\n }\r\n else if (emittor.scope.range == DEffect_1.DEffectFieldScopeType.Map) {\r\n const targets = [];\r\n MRLively_1.MRLively.mapView.currentMap.entities().filter(entity => {\r\n if (UAction_1.UAction.testFactionMatch(performer, entity, DEffect_1.DRmmzEffectScope.Everyone)) {\r\n targets.push(entity);\r\n }\r\n ;\r\n });\r\n this.applyEffect(cctx, performer, emittor, targets, skillId, itemEntity);\r\n }\r\n else {\r\n throw new Error(\"Not implemented.\");\r\n }\r\n }\r\n performeEffect_StraightProjectile(cctx, performer, emittor, itemEntity, startX, startY, dir) {\r\n const createInfo = DSpawner_1.DEntityCreateInfo.makeSingle(MRData_1.MRData.getEntity(emittor.scope.projectilePrefabKey).id).withStackCount(1);\r\n const bullet = SEntityFactory_1.SEntityFactory.newEntity(createInfo);\r\n MRLively_1.MRLively.mapView.currentMap.appearEntity(bullet, startX, startY);\r\n bullet.dir = dir;\r\n // Projectile は item とは異なる Entity であり、Projectile 自体はデータベース上では Effect を持たない。\r\n // そのため、Projectile の発生原因となった item から Hit 時の Effect を取り出し、Projectile 衝突時にこれを発動する。\r\n //const emittorEffects = itemEntity?.data().emittorSet.emittors(DEffectCause.Hit);\r\n const itemEmittors = itemEntity === null || itemEntity === void 0 ? void 0 : itemEntity.data.getReaction(MRBasics_1.MRBasics.actions.collide).emittors();\r\n // ↑今は杖用。杖を投げ当てた時と同じ効果を取り出す。\r\n //const actualEmittor = emittorEffects ?? emittor;\r\n let actualEmittor = emittor;\r\n if (itemEmittors) {\r\n (0, Common_1.assert)(itemEmittors.length == 1); // TODO: 今は一つだけ\r\n actualEmittor = itemEmittors[0];\r\n }\r\n let actualEffectSet = actualEmittor;\r\n if (this._projectilePriorityEffectSet) {\r\n actualEffectSet = this._projectilePriorityEffectSet;\r\n }\r\n LProjectileBehavior_1.LProjectileBehavior.startMoveAsEffectProjectile(cctx, bullet, new SEffectContext_1.SEffectSubject(performer), dir, emittor.scope.length, actualEffectSet);\r\n }\r\n applyEffect(cctx, performer, emittor, targets, skillId, itemEntity) {\r\n const effectSubject = new SEffectApplyer_1.SEffectorFact(this._subject, emittor.effectSuite, SEffectContext_1.SEffectIncidentType.DirectAttack, performer.dir);\r\n if (itemEntity) {\r\n effectSubject.withIncidentEntityKind(itemEntity.kindDataId());\r\n effectSubject.withItem(itemEntity);\r\n }\r\n if (skillId > 0) {\r\n effectSubject.withSkill(skillId);\r\n }\r\n const effectContext = new SEffectContext_1.SEffectContext(effectSubject, cctx.random());\r\n cctx.postCall(() => {\r\n effectContext.applyWithWorth(cctx, targets);\r\n this.onPerformed(cctx, targets);\r\n if (skillId > 0) {\r\n this.raiseSkillEmitted(cctx, performer, targets, skillId);\r\n }\r\n });\r\n }\r\n getTargetInBlock(block, scope) {\r\n if (scope.layerScope == DCommon_1.DBlockLayerScope.TopOnly) {\r\n for (let i = DCommon_1.DBlockLayerKind.Top; i >= 0; i--) {\r\n if (scope.layers.includes(i)) {\r\n const entity = block.layer(i).firstEntity();\r\n if (entity) {\r\n return [entity];\r\n }\r\n }\r\n }\r\n return [];\r\n }\r\n else if (scope.layerScope == DCommon_1.DBlockLayerScope.All) {\r\n throw new Error(\"Not implemented.\");\r\n }\r\n else {\r\n throw new Error(\"Unreachable.\");\r\n }\r\n }\r\n}\r\nexports.SEmittorPerformer = SEmittorPerformer;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/SEmittorPerformer.ts?"); /***/ }), /***/ "./ts/mr/system/SEntityFactory.ts": /*!****************************************!*\ !*** ./ts/mr/system/SEntityFactory.ts ***! \****************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SEntityFactory = exports.SEntityBuilder = void 0;\r\nconst MRData_1 = __webpack_require__(/*! ../data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LDecisionBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LDecisionBehavior */ \"./ts/mr/lively/behaviors/LDecisionBehavior.ts\");\r\nconst LUnitBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LUnitBehavior */ \"./ts/mr/lively/behaviors/LUnitBehavior.ts\");\r\nconst LExitPointBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LExitPointBehavior */ \"./ts/mr/lively/behaviors/LExitPointBehavior.ts\");\r\nconst LCommonBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LCommonBehavior */ \"./ts/mr/lively/behaviors/LCommonBehavior.ts\");\r\nconst LInventoryBehavior_1 = __webpack_require__(/*! ts/mr/lively/entity/LInventoryBehavior */ \"./ts/mr/lively/entity/LInventoryBehavior.ts\");\r\nconst LItemBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LItemBehavior */ \"./ts/mr/lively/behaviors/LItemBehavior.ts\");\r\nconst LTrapBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LTrapBehavior */ \"./ts/mr/lively/behaviors/LTrapBehavior.ts\");\r\nconst LEnemyBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LEnemyBehavior */ \"./ts/mr/lively/behaviors/LEnemyBehavior.ts\");\r\nconst LEquipmentBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LEquipmentBehavior */ \"./ts/mr/lively/behaviors/LEquipmentBehavior.ts\");\r\nconst LEquipmentUserBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LEquipmentUserBehavior */ \"./ts/mr/lively/behaviors/LEquipmentUserBehavior.ts\");\r\nconst LEntryPointBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LEntryPointBehavior */ \"./ts/mr/lively/behaviors/LEntryPointBehavior.ts\");\r\nconst LActorBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LActorBehavior */ \"./ts/mr/lively/behaviors/LActorBehavior.ts\");\r\nconst SBehaviorFactory_1 = __webpack_require__(/*! ./SBehaviorFactory */ \"./ts/mr/system/SBehaviorFactory.ts\");\r\nconst LProjectileBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/activities/LProjectileBehavior */ \"./ts/mr/lively/behaviors/activities/LProjectileBehavior.ts\");\r\nconst LSurvivorBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LSurvivorBehavior */ \"./ts/mr/lively/behaviors/LSurvivorBehavior.ts\");\r\nconst LEntityDivisionBehavior_1 = __webpack_require__(/*! ts/mr/lively/abilities/LEntityDivisionBehavior */ \"./ts/mr/lively/abilities/LEntityDivisionBehavior.ts\");\r\nconst LSanctuaryBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LSanctuaryBehavior */ \"./ts/mr/lively/behaviors/LSanctuaryBehavior.ts\");\r\nconst LGlueToGroundBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LGlueToGroundBehavior */ \"./ts/mr/lively/behaviors/LGlueToGroundBehavior.ts\");\r\nconst UMovement_1 = __webpack_require__(/*! ../utility/UMovement */ \"./ts/mr/utility/UMovement.ts\");\r\nconst LFlockBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LFlockBehavior */ \"./ts/mr/lively/behaviors/LFlockBehavior.ts\");\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst LStorageBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LStorageBehavior */ \"./ts/mr/lively/behaviors/LStorageBehavior.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst LRatedRandomAIBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LRatedRandomAIBehavior */ \"./ts/mr/lively/behaviors/LRatedRandomAIBehavior.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ./MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst LGrabFootBehavior_1 = __webpack_require__(/*! ../lively/abilities/LGrabFootBehavior */ \"./ts/mr/lively/abilities/LGrabFootBehavior.ts\");\r\nconst LItemThiefBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LItemThiefBehavior */ \"./ts/mr/lively/behaviors/LItemThiefBehavior.ts\");\r\nconst LShopkeeperBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LShopkeeperBehavior */ \"./ts/mr/lively/behaviors/LShopkeeperBehavior.ts\");\r\nconst LGoldBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LGoldBehavior */ \"./ts/mr/lively/behaviors/LGoldBehavior.ts\");\r\nconst LGoldThiefBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LGoldThiefBehavior */ \"./ts/mr/lively/behaviors/LGoldThiefBehavior.ts\");\r\nconst LParamBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LParamBehavior */ \"./ts/mr/lively/behaviors/LParamBehavior.ts\");\r\nconst LEscapeBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LEscapeBehavior */ \"./ts/mr/lively/behaviors/LEscapeBehavior.ts\");\r\nconst LPreventionBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LPreventionBehavior */ \"./ts/mr/lively/behaviors/LPreventionBehavior.ts\");\r\nconst LActivityCharmBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LActivityCharmBehavior */ \"./ts/mr/lively/behaviors/LActivityCharmBehavior.ts\");\r\nconst LExperienceBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LExperienceBehavior */ \"./ts/mr/lively/behaviors/LExperienceBehavior.ts\");\r\nconst LRaceBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LRaceBehavior */ \"./ts/mr/lively/behaviors/LRaceBehavior.ts\");\r\nconst DEntityCategory_1 = __webpack_require__(/*! ../data/DEntityCategory */ \"./ts/mr/data/DEntityCategory.ts\");\r\nconst DSpawner_1 = __webpack_require__(/*! ../data/DSpawner */ \"./ts/mr/data/DSpawner.ts\");\r\nconst LCrackedBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LCrackedBehavior */ \"./ts/mr/lively/behaviors/LCrackedBehavior.ts\");\r\nclass SEntityBuilder {\r\n constructor(data) {\r\n this._baseList = [];\r\n this.data = data;\r\n //this.setupCommon();\r\n }\r\n addBaseBehavior(ctor, params = undefined) {\r\n const data = MRData_1.MRData.getBehavior(ctor.name);\r\n const entry = this._baseList.find(e => e.behaviorId === data.id);\r\n if (entry) {\r\n if (params) {\r\n if (entry.params) {\r\n (0, Common_1.assert)(entry.params.code === params.code);\r\n Object.assign(entry.params, params);\r\n }\r\n else {\r\n entry.params = Object.assign({}, params);\r\n }\r\n }\r\n }\r\n else {\r\n this._baseList.push({ behaviorId: data.id, params: params });\r\n }\r\n return this;\r\n }\r\n /**\r\n * 新しい Entity を作成し、World に追加する\r\n */\r\n spawn() {\r\n const entity = MRLively_1.MRLively.world.spawnEntity(this.data.id);\r\n this.build(entity);\r\n return entity;\r\n }\r\n /**\r\n * 既存の Entity に対して構築処理を実行する。\r\n */\r\n build(entity) {\r\n var _a;\r\n (0, Common_1.assert)(entity.behaviorIds().length === 0);\r\n // Merge\r\n const behaviorList = [...this._baseList];\r\n for (const entryInstantiation of this.data.entity.behaviors) {\r\n const entry = behaviorList.find(e => e.behaviorId == entryInstantiation.behaviorId);\r\n if (entry) {\r\n if (entryInstantiation.props) {\r\n if (entry.params) {\r\n (0, Common_1.assert)(entry.params.code === entryInstantiation.props.code);\r\n Object.assign(entry.params, entryInstantiation.props);\r\n }\r\n else {\r\n entry.params = Object.assign({}, entryInstantiation.props);\r\n }\r\n }\r\n }\r\n else {\r\n behaviorList.push({ behaviorId: entryInstantiation.behaviorId, params: entryInstantiation.props });\r\n }\r\n }\r\n // Behavior を作成\r\n const initPairs = [];\r\n for (const entry of behaviorList) {\r\n const data = MRData_1.MRData.behavior[entry.behaviorId];\r\n if (!entity.findEntityBehaviorBy(b => b.fullName == data.fullName)) {\r\n const behavior = SBehaviorFactory_1.SBehaviorManager.createBehaviorInstance(data.fullName);\r\n if (!behavior) {\r\n throw new Error(`Behavior ${data.fullName} not found.`);\r\n }\r\n entity.addBehavior(behavior);\r\n initPairs.push([behavior, entry]);\r\n }\r\n }\r\n // 最後に onInitialized を呼ぶ\r\n for (const [behavior, entry] of initPairs) {\r\n behavior.onInitialized(entity, (_a = entry.params) !== null && _a !== void 0 ? _a : { code: \"Unknown\" });\r\n }\r\n MRSystem_1.MRSystem.ext.onNewEntity(entity, entity.data);\r\n }\r\n // public addBaseBehavior(name: string): this {\r\n // this._baseList.push({ name: name });\r\n // return this;\r\n // }\r\n // public addBaseBehavior(name: string): this {\r\n // this._baseList.push({ name: name });\r\n // return this;\r\n // }\r\n setupCommon() {\r\n this.addBaseBehavior(LCommonBehavior_1.LCommonBehavior);\r\n this.addBaseBehavior(LProjectileBehavior_1.LProjectileBehavior);\r\n this.addBaseBehavior(LItemBehavior_1.LItemBehavior);\r\n }\r\n setupActor() {\r\n this.setupCommon();\r\n this.addBaseBehavior(LDecisionBehavior_1.LDecisionBehavior);\r\n this.addBaseBehavior(LUnitBehavior_1.LUnitBehavior, { code: \"Unit\", factionId: MRData_1.MRData.system.factions.player });\r\n this.addBaseBehavior(LInventoryBehavior_1.LInventoryBehavior);\r\n this.addBaseBehavior(LEquipmentUserBehavior_1.LEquipmentUserBehavior);\r\n this.addBaseBehavior(LExperienceBehavior_1.LExperienceBehavior);\r\n this.addBaseBehavior(LActorBehavior_1.LActorBehavior); // この時点の装備品などで初期パラメータを作るので、後ろに追加しておく\r\n //this.addBaseBehavior(LEaterBehavior);\r\n this.addBaseBehavior(LSurvivorBehavior_1.LSurvivorBehavior);\r\n return this;\r\n }\r\n setupMonster(enemyEntityData) {\r\n this.setupCommon();\r\n this.addBaseBehavior(LDecisionBehavior_1.LDecisionBehavior);\r\n this.addBaseBehavior(LUnitBehavior_1.LUnitBehavior, { code: \"Unit\", factionId: enemyEntityData.factionId });\r\n this.addBaseBehavior(LInventoryBehavior_1.LInventoryBehavior);\r\n this.addBaseBehavior(LEnemyBehavior_1.LEnemyBehavior);\r\n this.addBaseBehavior(LRaceBehavior_1.LRaceBehavior);\r\n this.setupDirectly_Enemy(enemyEntityData);\r\n return this;\r\n }\r\n setupItem() {\r\n this.setupCommon();\r\n const entityData = this.data;\r\n if (entityData.entity.kindId == MRBasics_1.MRBasics.entityCategories.WeaponKindId ||\r\n entityData.entity.kindId == MRBasics_1.MRBasics.entityCategories.ShieldKindId) {\r\n this.addBaseBehavior(LEquipmentBehavior_1.LEquipmentBehavior);\r\n }\r\n // for (const name of entityData.entity.abilityNames) {\r\n // const data = MRData.abilities.find(x => x.key == name);\r\n // if (!data) throw new Error(`Ability \"${name}\" not found.`);\r\n // e.addAbility(data.id);\r\n // }\r\n this.setupDirectly_Item(entityData);\r\n return this;\r\n }\r\n setupTrap(itemId) {\r\n const item = MRData_1.MRData.itemData(itemId);\r\n this.setupCommon();\r\n this.addBaseBehavior(LTrapBehavior_1.LTrapBehavior);\r\n return this;\r\n }\r\n setupEntryPoint() {\r\n this.addBaseBehavior(LProjectileBehavior_1.LProjectileBehavior);\r\n this.addBaseBehavior(LEntryPointBehavior_1.LEntryPointBehavior);\r\n return this;\r\n }\r\n setupExitPoint() {\r\n this.addBaseBehavior(LProjectileBehavior_1.LProjectileBehavior);\r\n this.addBaseBehavior(LExitPointBehavior_1.LExitPointBehavior);\r\n return this;\r\n }\r\n setupOrnament(prefab) {\r\n this.addBaseBehavior(LProjectileBehavior_1.LProjectileBehavior);\r\n return this;\r\n }\r\n // NOTE: エディタ側である程度カスタマイズできるように Note の設計を進めていたのだが、\r\n // どのぐらいの粒度で Behabior を分けるべきなのか現時点では決められなかった。(Activity単位がいいのか、Ability単位か、機能単位か)\r\n // そのためここで直定義して一通り作ってみた後、再検討する。\r\n setupDirectly_Item(entityData) {\r\n switch (entityData.entity.key) {\r\n case \"kEntity_聖域の巻物A\":\r\n this.addBaseBehavior(LSanctuaryBehavior_1.LSanctuaryBehavior);\r\n this.addBaseBehavior(LGlueToGroundBehavior_1.LGlueToGroundBehavior);\r\n break;\r\n case \"kEntity_保存の壺A\":\r\n this.addBaseBehavior(LInventoryBehavior_1.LInventoryBehavior);\r\n this.addBaseBehavior(LStorageBehavior_1.LStorageBehavior);\r\n this.addBaseBehavior(LCrackedBehavior_1.LCrackedBehavior);\r\n break;\r\n case \"kEntity_GoldA\":\r\n this.addBaseBehavior(LGoldBehavior_1.LGoldBehavior);\r\n break;\r\n case \"kEntity_転ばぬ先の杖A\":\r\n this.addBaseBehavior(LPreventionBehavior_1.LStumblePreventionBehavior);\r\n break;\r\n case \"kEntity_RevivalGrassA\":\r\n this.addBaseBehavior(LActivityCharmBehavior_1.LActivityCharmBehavior);\r\n break;\r\n }\r\n }\r\n setupDirectly_Enemy(entityData) {\r\n switch (entityData.entity.key) {\r\n case \"kEnemy_バットA\":\r\n case \"kEnemy_黒幕バットA\":\r\n this.addBaseBehavior(LRatedRandomAIBehavior_1.LRatedRandomAIBehavior);\r\n break;\r\n case \"kEnemy_ウルフA\":\r\n this.addBaseBehavior(LParamBehavior_1.LParamBehavior, { code: \"Param\", paramId: MRBasics_1.MRBasics.params.agi, value: 100 });\r\n break;\r\n case \"kEnemy_苗色スライムA\":\r\n this.addBaseBehavior(LEntityDivisionBehavior_1.LEntityDivisionBehavior);\r\n break;\r\n case \"kEnemy_軍隊ウルフA\":\r\n this.addBaseBehavior(LFlockBehavior_1.LFlockBehavior);\r\n break;\r\n case \"kEnemy_バインドゴーレムA\":\r\n this.addBaseBehavior(LGrabFootBehavior_1.LGrabFootBehavior);\r\n break;\r\n case \"kEnemy_NPC汎用A\":\r\n this.addBaseBehavior(LUnitBehavior_1.LUnitBehavior, { code: \"Unit\", factionId: MRData_1.MRData.system.factions.neutral }); // overwrite\r\n break;\r\n case \"kEnemy_瑠璃猫A\":\r\n this.addBaseBehavior(LItemThiefBehavior_1.LItemThiefBehavior);\r\n break;\r\n case \"kEnemy_小金猫A\":\r\n this.addBaseBehavior(LGoldThiefBehavior_1.LGoldThiefBehavior);\r\n break;\r\n case \"kEnemy_金剛猫A\":\r\n this.addBaseBehavior(LEscapeBehavior_1.LEscapeBehavior);\r\n this.addBaseBehavior(LParamBehavior_1.LParamBehavior, { code: \"Param\", paramId: MRBasics_1.MRBasics.params.agi, value: 100 });\r\n break;\r\n case \"kEnemy_店主A\":\r\n this.addBaseBehavior(LShopkeeperBehavior_1.LShopkeeperBehavior);\r\n break;\r\n }\r\n }\r\n}\r\nexports.SEntityBuilder = SEntityBuilder;\r\nclass SEntityFactory {\r\n static newActor(entityId) {\r\n return new SEntityBuilder(MRData_1.MRData.entities[entityId])\r\n .setupActor()\r\n .spawn();\r\n }\r\n // private static setupCommon(e: LEntity): void {\r\n // e.addBehavior(LCommonBehavior);\r\n // e.addBehavior(LProjectileBehavior);\r\n // e.addBehavior(LItemBehavior);\r\n // }\r\n // public static newMonster(enemyEntityData: DEntity): LEntity {\r\n // const e = REGame.world.spawnEntity(enemyEntityData.id);\r\n // this.buildMonster(e, enemyEntityData);\r\n // return e;\r\n // }\r\n static newBasicExitPoint() {\r\n return new SEntityBuilder(MRData_1.MRData.getEntity(\"kEntity_ExitPointA\"))\r\n .setupExitPoint()\r\n .spawn();\r\n }\r\n // public static newEntryPoint(entityId: DEntityId): LEntity {\r\n // assert(REData.getEntity(\"kEntity_EntryPointA\").id == entityId);\r\n // const e = REGame.world.spawnEntity(entityId);\r\n // this.buildEntryPoint(e);\r\n // return e;\r\n // }\r\n static newEntity(createInfo, floorId) {\r\n const entityData = MRData_1.MRData.entities[createInfo.entityId];\r\n const entity = MRLively_1.MRLively.world.spawnEntity(entityData.id);\r\n this.buildEntity(entity);\r\n // ステート追加\r\n for (const stateId of createInfo.stateIds) {\r\n entity.addState(stateId);\r\n }\r\n entity._name = createInfo.debugName;\r\n if (createInfo.stackCount !== undefined) {\r\n entity._stackCount = createInfo.stackCount;\r\n }\r\n else if (entityData.initialStackCount !== undefined) {\r\n entity._stackCount = MRLively_1.MRLively.world.random().nextIntWithMinMax(entityData.initialStackCount.minValue, entityData.initialStackCount.maxValue + 1);\r\n }\r\n else {\r\n entity._stackCount = 1;\r\n }\r\n // 個体識別済みチェック\r\n if (floorId) {\r\n if (floorId.landData.checkIdentifiedEntity(entity.kindData())) {\r\n entity.setIndividualIdentified(true);\r\n }\r\n }\r\n {\r\n const goldBehavior = entity.findEntityBehavior(LGoldBehavior_1.LGoldBehavior);\r\n if (goldBehavior) {\r\n goldBehavior.setGold(createInfo.gold);\r\n }\r\n }\r\n return entity;\r\n }\r\n static buildEntity(entity) {\r\n const dataId = entity.dataId;\r\n (0, Common_1.assert)(dataId > 0);\r\n const entityData = MRData_1.MRData.entities[dataId];\r\n const prefab = MRData_1.MRData.prefabs[entityData.prefabId];\r\n const builder = new SEntityBuilder(entityData);\r\n if (DEntityCategory_1.DEntityCategory.isMonster(entityData)) {\r\n builder.setupMonster(entityData);\r\n }\r\n else if (DEntityCategory_1.DEntityCategory.isTrap(entityData)) {\r\n builder.setupTrap(entityData.item().id);\r\n }\r\n else if (DEntityCategory_1.DEntityCategory.isEntryPoint(entityData)) {\r\n builder.setupEntryPoint();\r\n }\r\n else if (DEntityCategory_1.DEntityCategory.isExitPoint(entityData)) {\r\n builder.setupExitPoint();\r\n }\r\n else if (DEntityCategory_1.DEntityCategory.isOrnament(entityData)) {\r\n builder.setupOrnament(prefab);\r\n }\r\n else {\r\n builder.setupItem();\r\n }\r\n builder.build(entity);\r\n }\r\n static spawnTroopAndMembers(map, troop, mx, my, stateIds) {\r\n const result = [];\r\n const party = MRLively_1.MRLively.world.newParty();\r\n for (const entityId of troop.members) {\r\n const entity = this.newEntity(DSpawner_1.DEntityCreateInfo.makeSingle(entityId, stateIds), map.floorId());\r\n party.addMember(entity);\r\n result.push(entity);\r\n const block = UMovement_1.UMovement.selectNearbyLocatableBlock(map, MRLively_1.MRLively.world.random(), mx, my, entity.getHomeLayer(), entity);\r\n if (block) {\r\n MRLively_1.MRLively.world.transferEntity(entity, map.floorId(), block.mx, block.my);\r\n }\r\n else {\r\n // 配置できないなら無理に出さない\r\n }\r\n }\r\n return result;\r\n }\r\n}\r\nexports.SEntityFactory = SEntityFactory;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/SEntityFactory.ts?"); /***/ }), /***/ "./ts/mr/system/SFormulaOperand.ts": /*!*****************************************!*\ !*** ./ts/mr/system/SFormulaOperand.ts ***! \*****************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SFormulaOperand = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ../data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ../data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst PluginParameters_1 = __webpack_require__(/*! ../PluginParameters */ \"./ts/mr/PluginParameters.ts\");\r\n/**\r\n * [ダメージ計算式] の a や b といった項を表すクラス。\r\n */\r\nclass SFormulaOperand {\r\n constructor() {\r\n var prop = {};\r\n for (const param of MRData_1.MRData.parameters) {\r\n prop[param.code] = {\r\n get: () => {\r\n if (PluginParameters_1.paramPowerToAtk && param.id == MRBasics_1.MRBasics.params.atk) {\r\n const entity = this.entity();\r\n const atk = entity.getActualParam(MRBasics_1.MRBasics.params.atk);\r\n const pow = entity.getActualParam(MRBasics_1.MRBasics.params.pow);\r\n // NOTE:\r\n // ↓原作のダメージ計算式。\r\n // http://000.la.coocan.jp/torneco/damage.html\r\n // 基本攻撃力+{基本攻撃力×(剣の強さ+ちから-8)/16の小数点以下を四捨五入した値}\r\n // 基本攻撃力×(剣の強さ+ちから+8)/16\r\n //\r\n // 原作のダメージはおおよそ 1~200 で計算されることが多いのに対し、RMMZ は 100~ の大きい値を扱う。\r\n // エディタもそのように使うことを前提としているため、原作の計算式をそのまま使うことは難しい。。\r\n // ちからを大きくしても、武器に定数加算しかされない。(8増やしても最終ダメージに+8しかされない)\r\n // \r\n // 本プラグインとしては、「何もしない」状態、つまりちからが初期値 8 の時に、\r\n // RMMZ デフォルトのダメージ計算式を使って計算したのと同じ攻撃力となるのが望ましいだろう。\r\n // ↓初版の没式。これだと既に攻撃力にちからが影響しない。\r\n // 全体の ATK から、装備による上昇分の ATK を引くことで、素の ATK を求める。\r\n // これを 基本攻撃力(素手の攻撃力) とする。\r\n //const eatk = entity.queryIdealParameterPlus(MRBasics.params.atk); // Equipments ATK\r\n //const baseAtk = Math.max(atk - eatk, 1);\r\n ////return atk + Math.round(atk * (eatk + pow - 8) / 16);\r\n //return baseAtk + Math.round(eatk * (pow / 8.0));\r\n // - ちからが 8 であるときの結果は atk そのままとなる。\r\n // - ちからが 0 のときは結果は元の atk の半分となる。\r\n // - ちからが 24 であるときの結果は atk の2倍となる。\r\n return atk + (atk * ((pow - 8) / 16.0));\r\n }\r\n else {\r\n return this.entity().getActualParam(param.id);\r\n }\r\n },\r\n configurable: true\r\n };\r\n prop[\"max_\" + param.code] = {\r\n get: () => {\r\n return this.entity().getParamActualMax(param.id);\r\n },\r\n configurable: true\r\n };\r\n }\r\n ;\r\n Object.defineProperties(this, prop);\r\n }\r\n entity() {\r\n (0, Common_1.assert)(this._entity);\r\n return this._entity;\r\n }\r\n wrap(entity) {\r\n this._entity = entity;\r\n }\r\n}\r\nexports.SFormulaOperand = SFormulaOperand;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/SFormulaOperand.ts?"); /***/ }), /***/ "./ts/mr/system/SFovShadowMap.ts": /*!***************************************!*\ !*** ./ts/mr/system/SFovShadowMap.ts ***! \***************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SFovShadowMap = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst DSystem_1 = __webpack_require__(/*! ../data/DSystem */ \"./ts/mr/data/DSystem.ts\");\r\nconst SFovHelper_1 = __webpack_require__(/*! ./utils/SFovHelper */ \"./ts/mr/system/utils/SFovHelper.ts\");\r\nclass SFovShadowMap {\r\n constructor() {\r\n this._map = undefined;\r\n this._data = [];\r\n }\r\n get width() {\r\n (0, Common_1.assert)(this._map);\r\n return this._map.width();\r\n }\r\n get height() {\r\n (0, Common_1.assert)(this._map);\r\n return this._map.height();\r\n }\r\n setup(map) {\r\n this._map = map;\r\n this._fovMap = new FovMap(this._map, this);\r\n this._data = new Array(map.width() * map.height());\r\n this.clear();\r\n // test\r\n {\r\n //SFovHelper.computeFov(this._fovMap, 13, 24, 5, false, DFovSystem.SymmetricShadowcast);\r\n }\r\n // test\r\n // this.set(13, 24, 1);\r\n // this.set(12, 24, 1);\r\n // this.set(13, 23, 1);\r\n }\r\n locate(mx, my, radius) {\r\n if (!this._fovMap)\r\n return;\r\n this.clear();\r\n SFovHelper_1.SFovHelper.computeFov(this._fovMap, mx, my, radius, false, DSystem_1.DFovSystem.SymmetricShadowcast);\r\n }\r\n isValid(mx, my) {\r\n return (0 <= mx && mx < this.width) && (0 <= my && my < this.height);\r\n }\r\n isVisible(mx, my) {\r\n //if (!this._map) return false;\r\n //return this._map.block(mx, my)._passed;\r\n return this._data[my * this.width + mx] > 0;\r\n }\r\n clear() {\r\n for (let i = 0; i < this._data.length; i++) {\r\n this._data[i] = 0;\r\n }\r\n }\r\n set(mx, my, visible) {\r\n this._data[my * this.width + mx] = visible ? 1 : 0;\r\n }\r\n}\r\nexports.SFovShadowMap = SFovShadowMap;\r\nclass FovMap extends SFovHelper_1.IFovMap {\r\n constructor(map, shadowMap) {\r\n super();\r\n this._map = map;\r\n this._shadowMap = shadowMap;\r\n }\r\n getWidth() {\r\n return this._map.width();\r\n }\r\n getHeight() {\r\n return this._map.height();\r\n }\r\n getTransparent(x, y) {\r\n return this._map.block(x, y).isFloorLikeShape();\r\n }\r\n setFov(x, y, fov) {\r\n //this._map.block(x, y)._passed = fov;\r\n this._shadowMap.set(x, y, fov);\r\n }\r\n}\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/SFovShadowMap.ts?"); /***/ }), /***/ "./ts/mr/system/SGameManager.ts": /*!**************************************!*\ !*** ./ts/mr/system/SGameManager.ts ***! \**************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SGameManager = void 0;\r\nconst MRLively_1 = __webpack_require__(/*! ../lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst internal_1 = __webpack_require__(/*! ./internal */ \"./ts/mr/system/internal.ts\");\r\nconst LWorld_1 = __webpack_require__(/*! ../lively/LWorld */ \"./ts/mr/lively/LWorld.ts\");\r\nconst LSystem_1 = __webpack_require__(/*! ../lively/LSystem */ \"./ts/mr/lively/LSystem.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ../data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst SScheduler_1 = __webpack_require__(/*! ./scheduling/SScheduler */ \"./ts/mr/system/scheduling/SScheduler.ts\");\r\nconst LMapView_1 = __webpack_require__(/*! ../lively/LMapView */ \"./ts/mr/lively/LMapView.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ./MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst SActivityRecorder_1 = __webpack_require__(/*! ./SActivityRecorder */ \"./ts/mr/system/SActivityRecorder.ts\");\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst LMessageHistory_1 = __webpack_require__(/*! ts/mr/lively/LMessageHistory */ \"./ts/mr/lively/LMessageHistory.ts\");\r\nconst SSequelContext_1 = __webpack_require__(/*! ./SSequelContext */ \"./ts/mr/system/SSequelContext.ts\");\r\nconst SCommandContext_1 = __webpack_require__(/*! ./SCommandContext */ \"./ts/mr/system/SCommandContext.ts\");\r\nconst SImmediatelyCommandExecuteScheduler_1 = __webpack_require__(/*! ./SImmediatelyCommandExecuteScheduler */ \"./ts/mr/system/SImmediatelyCommandExecuteScheduler.ts\");\r\nconst LEventServer_1 = __webpack_require__(/*! ts/mr/lively/LEventServer */ \"./ts/mr/lively/LEventServer.ts\");\r\nconst SMinimapData_1 = __webpack_require__(/*! ./SMinimapData */ \"./ts/mr/system/SMinimapData.ts\");\r\nconst LScheduler_1 = __webpack_require__(/*! ts/mr/lively/LScheduler */ \"./ts/mr/lively/LScheduler.ts\");\r\nconst FMapData_1 = __webpack_require__(/*! ts/mr/floorgen/FMapData */ \"./ts/mr/floorgen/FMapData.ts\");\r\nconst FMapBuilder_1 = __webpack_require__(/*! ts/mr/floorgen/FMapBuilder */ \"./ts/mr/floorgen/FMapBuilder.ts\");\r\nconst FGenericRandomMapGenerator_1 = __webpack_require__(/*! ts/mr/floorgen/FGenericRandomMapGenerator */ \"./ts/mr/floorgen/FGenericRandomMapGenerator.ts\");\r\nconst SMapManager_1 = __webpack_require__(/*! ./SMapManager */ \"./ts/mr/system/SMapManager.ts\");\r\nconst SDialogContext_1 = __webpack_require__(/*! ./SDialogContext */ \"./ts/mr/system/SDialogContext.ts\");\r\nconst SGroundRules_1 = __webpack_require__(/*! ./SGroundRules */ \"./ts/mr/system/SGroundRules.ts\");\r\nconst LBlock_1 = __webpack_require__(/*! ts/mr/lively/LBlock */ \"./ts/mr/lively/LBlock.ts\");\r\nconst UTransfer_1 = __webpack_require__(/*! ts/mr/utility/UTransfer */ \"./ts/mr/utility/UTransfer.ts\");\r\nconst STurnContext_1 = __webpack_require__(/*! ./STurnContext */ \"./ts/mr/system/STurnContext.ts\");\r\nconst SSpecialEffectManager_1 = __webpack_require__(/*! ./effect/SSpecialEffectManager */ \"./ts/mr/system/effect/SSpecialEffectManager.ts\");\r\nconst SFormulaOperand_1 = __webpack_require__(/*! ./SFormulaOperand */ \"./ts/mr/system/SFormulaOperand.ts\");\r\nconst LInventoryBehavior_1 = __webpack_require__(/*! ../lively/entity/LInventoryBehavior */ \"./ts/mr/lively/entity/LInventoryBehavior.ts\");\r\nconst DSpawner_1 = __webpack_require__(/*! ../data/DSpawner */ \"./ts/mr/data/DSpawner.ts\");\r\nconst UEffect_1 = __webpack_require__(/*! ../utility/UEffect */ \"./ts/mr/utility/UEffect.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ../data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst LEquipmentUserBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LEquipmentUserBehavior */ \"./ts/mr/lively/behaviors/LEquipmentUserBehavior.ts\");\r\nconst LChronus_1 = __webpack_require__(/*! ../lively/LChronus */ \"./ts/mr/lively/LChronus.ts\");\r\nconst SFovShadowMap_1 = __webpack_require__(/*! ./SFovShadowMap */ \"./ts/mr/system/SFovShadowMap.ts\");\r\nconst SMapDataManager_1 = __webpack_require__(/*! ./SMapDataManager */ \"./ts/mr/system/SMapDataManager.ts\");\r\nconst STransferMapDialog_1 = __webpack_require__(/*! ./dialogs/STransferMapDialog */ \"./ts/mr/system/dialogs/STransferMapDialog.ts\");\r\nconst SRoomBoundsFovSystem_1 = __webpack_require__(/*! ./fov/SRoomBoundsFovSystem */ \"./ts/mr/system/fov/SRoomBoundsFovSystem.ts\");\r\nconst SSymmetricShadowcastFovSystem_1 = __webpack_require__(/*! ./fov/SSymmetricShadowcastFovSystem */ \"./ts/mr/system/fov/SSymmetricShadowcastFovSystem.ts\");\r\nconst LQuestManager_1 = __webpack_require__(/*! ../lively/LQuestManager */ \"./ts/mr/lively/LQuestManager.ts\");\r\nconst LScriptManager_1 = __webpack_require__(/*! ../lively/LScriptManager */ \"./ts/mr/lively/LScriptManager.ts\");\r\nconst SQuestManager_1 = __webpack_require__(/*! ./SQuestManager */ \"./ts/mr/system/SQuestManager.ts\");\r\nconst MRView_1 = __webpack_require__(/*! ../view/MRView */ \"./ts/mr/view/MRView.ts\");\r\n/**\r\n */\r\nclass SGameManager {\r\n static createSystemObjects() {\r\n MRSystem_1.MRSystem.sequelContext = new SSequelContext_1.SSequelContext();\r\n MRSystem_1.MRSystem.commandContext = new SCommandContext_1.SCommandContext(MRSystem_1.MRSystem.sequelContext);\r\n MRSystem_1.MRSystem.dialogContext = new SDialogContext_1.SDialogContext(MRSystem_1.MRSystem.commandContext);\r\n MRSystem_1.MRSystem.turnContext = new STurnContext_1.STurnContext();\r\n MRSystem_1.MRSystem.scheduler = new SScheduler_1.SScheduler();\r\n MRSystem_1.MRSystem.minimapData = new SMinimapData_1.SMinimapData();\r\n MRSystem_1.MRSystem.fovShadowMap = new SFovShadowMap_1.SFovShadowMap();\r\n MRSystem_1.MRSystem.mapManager = new SMapManager_1.SMapManager();\r\n MRSystem_1.MRSystem.groundRules = new SGroundRules_1.SGroundRules();\r\n MRSystem_1.MRSystem.effectBehaviorManager = new SSpecialEffectManager_1.SSpecialEffectManager();\r\n MRSystem_1.MRSystem.mapDataManager = new SMapDataManager_1.SMapDataManager();\r\n MRSystem_1.MRSystem.questManager = new SQuestManager_1.SQuestManager();\r\n MRSystem_1.MRSystem.requestedPlayback = false;\r\n MRSystem_1.MRSystem.formulaOperandA = new SFormulaOperand_1.SFormulaOperand();\r\n MRSystem_1.MRSystem.formulaOperandB = new SFormulaOperand_1.SFormulaOperand();\r\n MRSystem_1.MRSystem.formulaOperandC = new SFormulaOperand_1.SFormulaOperand();\r\n MRSystem_1.MRSystem.roomBoundsFovSystem = new SRoomBoundsFovSystem_1.SRoomBoundsFovSystem();\r\n MRSystem_1.MRSystem.symmetricShadowcastFovSystem = new SSymmetricShadowcastFovSystem_1.SSymmetricShadowcastFovSystem();\r\n }\r\n // DataManager.createGameObjects に従って呼び出される。\r\n // ゲーム起動時に1回呼び出される点に注意。NewGame 選択時に改めて1回呼び出される。\r\n static createGameObjects() {\r\n this.createSystemObjects();\r\n MRLively_1.MRLively.immediatelyCommandExecuteScheduler = new SImmediatelyCommandExecuteScheduler_1.SImmediatelyCommandExecuteScheduler();\r\n MRLively_1.MRLively.system = new LSystem_1.LSystem();\r\n MRLively_1.MRLively.world = new LWorld_1.LWorld();\r\n //MRLively.camera.currentMap = new LMap();\r\n MRLively_1.MRLively.mapView = new LMapView_1.LMapView();\r\n MRLively_1.MRLively.scheduler = new LScheduler_1.LScheduler2();\r\n MRLively_1.MRLively.recorder = new SActivityRecorder_1.SActivityRecorder();\r\n MRLively_1.MRLively.messageHistory = new LMessageHistory_1.LMessageHistory();\r\n MRLively_1.MRLively.eventServer = new LEventServer_1.LEventServer();\r\n MRLively_1.MRLively.chronus = new LChronus_1.LChronus();\r\n MRLively_1.MRLively.questManager = new LQuestManager_1.LQuestManager();\r\n MRLively_1.MRLively.scriptManager = new LScriptManager_1.LScriptManager();\r\n MRLively_1.MRLively.borderWall = new LBlock_1.LBlock(-1, -1);\r\n MRLively_1.MRLively.questManager.setup();\r\n // Create unique units\r\n for (const entityId of MRData_1.MRData.actors) {\r\n if (entityId > 0) {\r\n const actor = MRData_1.MRData.entities[entityId].actorData();\r\n if (actor.id > 0) {\r\n const unit = internal_1.SEntityFactory.newActor(entityId);\r\n //unit.prefabKey = `Actor:${actor.id}`;\r\n //unit.floorId = LFlo;//x.initialFloorId;\r\n unit.mx = actor.initialX;\r\n unit.my = actor.initialY;\r\n MRLively_1.MRLively.system.uniqueActorUnits.push(unit.entityId().clone());\r\n }\r\n }\r\n }\r\n }\r\n // もともとは createGameObjects() と一緒だったが、タイミングを Game_Player の位置設定後にしたかったため分けた\r\n static setupNewGame() {\r\n MRLively_1.MRLively.mapView.initializing = true;\r\n // TODO: とりあえずまずは全部同じにしてテスト\r\n //RESystem.skillBehaviors = REData.skills.map(x => new LNormalAttackSkillBehavior());\r\n // 1 番 Actor をデフォルトで操作可能 (Player) とする\r\n //\r\n //REGame.system.mainPlayerEntityId = firstActor.entityId();\r\n //REGame.camera.focus(firstActor);\r\n let firstActor;\r\n // if ($gameParty) {\r\n // const rmmzActorId = $gameParty.members()[0].actorId();\r\n // firstActor = REGame.world.getEntityByRmmzActorId(rmmzActorId);\r\n // }\r\n // else {\r\n // firstActor = REGame.world.entity(REGame.system.uniqueActorUnits[0]);\r\n // }\r\n MRLively_1.MRLively.world.iterateEntity(x => {\r\n if (x.dataId == MRData_1.MRData.system.initialPartyMembers[0]) {\r\n firstActor = x;\r\n return false;\r\n }\r\n return true;\r\n });\r\n (0, Common_1.assert)(firstActor);\r\n MRLively_1.MRLively.system.mainPlayerEntityId = firstActor.entityId();\r\n MRLively_1.MRLively.mapView.focus(firstActor);\r\n // Player を Party に入れる\r\n const party = MRLively_1.MRLively.world.newParty();\r\n party.addMember(firstActor);\r\n // Player の初期位置を、RMMZ 初期位置に合わせる\r\n UTransfer_1.UTransfer.transterRmmzDirectly($dataSystem.startMapId, $dataSystem.startX, $dataSystem.startY, 2);\r\n MRSystem_1.MRSystem.dialogContext.open(new STransferMapDialog_1.STransferMapDialog(STransferMapDialog_1.STransferMapSource.FromRmmzNewGame, firstActor.floorId, firstActor.mx, firstActor.my, firstActor.dir));\r\n MRLively_1.MRLively.mapView.currentFloorId = firstActor.floorId.clone();\r\n // Game_Player.setupForNewGame() でも reserveTransfer() してるので、\r\n // こちらも座標設定だけではなく、遷移のフレームワークを動かしておくのがよいかも。\r\n MRLively_1.MRLively.mapView.initializing = false;\r\n // ニューゲーム時には、チャレンジ開始状態にする (主にテストプレイで直接 Land 内に遷移したときのために)\r\n party.startChallenging();\r\n // test\r\n //REGame.camera.focusedEntity()?.setActualParam(DBasics.params.hp, 2);\r\n if (false) {}\r\n }\r\n // performTransfer() が呼ばれる時点で、RMMZ のマップ情報はロード済みでなければならない。\r\n // - 固定マップの場合は、そのマップがロード済みであること。\r\n // - ランダムマップの場合は、テーブル定義マップがロード済みであること。\r\n static performFloorTransfer(transfaringInfo) {\r\n //if (MRLively.camera.isFloorTransfering()) {\r\n //const focusedEntity = REGame.camera.focusedEntity();\r\n //const currentFloorId = focusedEntity ? focusedEntity.floorId : LFloorId.makeEmpty();\r\n //const currentFloorId = MRLively.mapView.currentMap.floorId();\r\n const newFloorId = transfaringInfo.newFloorId;\r\n // 別 Land への遷移?\r\n if (transfaringInfo.isLandTransfering) {\r\n MRLively_1.MRLively.world.land(newFloorId.landId).resetIdentifyer();\r\n }\r\n const oldMap = transfaringInfo.oldMap;\r\n if (oldMap && oldMap.shouldUnloadAtMapTransferred()) {\r\n //oldMap._removeAllEntities();\r\n // 先に Map をクリーンアップしておく。\r\n // 内部から onEntityLeavedMap() が呼び出され、ここで Game_Event の erase が走るため、\r\n // Game_Map 構築後にクリーンアップしてしまうと、新しく作成された Event が消えてしまう。\r\n oldMap.releaseMap();\r\n }\r\n const newMap = transfaringInfo.newMap;\r\n if (newFloorId.isTacticsMap2) {\r\n MRSystem_1.MRSystem.fovShadowMap.setup(newMap);\r\n if (newMap.needsRebuild()) {\r\n const rand = MRLively_1.MRLively.world.random();\r\n const mapSeed = rand.nextInt();\r\n console.log(\"seed:\", mapSeed);\r\n const mapData = new FMapData_1.FMap(newFloorId, mapSeed);\r\n if (newFloorId.rmmzFixedMapId2 > 0) {\r\n // 固定マップ\r\n MRSystem_1.MRSystem.integration.onLoadFixedMapData(mapData);\r\n const builder = new FMapBuilder_1.FMapBuilder();\r\n builder.buildForFixedMap(mapData);\r\n }\r\n else {\r\n const floorInto = newFloorId.floorInfo;\r\n const preset = floorInto.presetId ? MRData_1.MRData.floorPresets[floorInto.presetId] : MRData_1.MRData.floorPresets[MRBasics_1.MRBasics.defaultTerrainPresetId];\r\n const settingId = UEffect_1.UEffect.selectRating(rand, preset.terrains, x => x.rating);\r\n (0, Common_1.assert)(settingId);\r\n const setting = MRData_1.MRData.terrainSettings[settingId.terrainSettingsId];\r\n (new FGenericRandomMapGenerator_1.FGenericRandomMapGenerator(mapData, setting).generate());\r\n const builder = new FMapBuilder_1.FMapBuilder();\r\n builder.buildForRandomMap(mapData);\r\n mapData.print();\r\n }\r\n // マップ構築\r\n (0, Common_1.assert)(newFloorId.equals(newMap.floorId()));\r\n newMap.setup(mapData);\r\n MRSystem_1.MRSystem.mapManager.setMap(newMap);\r\n MRSystem_1.MRSystem.mapManager.setupMap(mapData);\r\n }\r\n else {\r\n }\r\n }\r\n else {\r\n // Entity を登場させない、通常の RMMZ マップ\r\n (0, Common_1.assert)(newFloorId.equals(newMap.floorId()));\r\n newMap.setupForRMMZDefaultMap();\r\n }\r\n MRSystem_1.MRSystem.minimapData.clear();\r\n MRSystem_1.MRSystem.scheduler.reset();\r\n Common_1.Log.d(\"PerformFloorTransfer\");\r\n //}\r\n }\r\n // テスト用\r\n static makeSaveContentsCore() {\r\n let contents = {};\r\n contents.system = MRLively_1.MRLively.system;\r\n contents.world = MRLively_1.MRLively.world;\r\n contents.map = MRLively_1.MRLively.mapView.currentMap;\r\n contents.camera = MRLively_1.MRLively.mapView;\r\n contents.scheduler = MRLively_1.MRLively.scheduler;\r\n contents.messageHistory = MRLively_1.MRLively.messageHistory;\r\n contents.eventServer = MRLively_1.MRLively.eventServer;\r\n contents.chronus = MRLively_1.MRLively.chronus;\r\n contents.questManager = MRLively_1.MRLively.questManager;\r\n return contents;\r\n }\r\n static loadSaveContentsCore(contents) {\r\n MRLively_1.MRLively.system = contents.system;\r\n MRLively_1.MRLively.world = contents.world;\r\n //MRLively.camera.currentMap = contents.map;\r\n MRLively_1.MRLively.mapView = contents.camera;\r\n MRLively_1.MRLively.scheduler = contents.scheduler;\r\n MRLively_1.MRLively.messageHistory = contents.messageHistory;\r\n MRLively_1.MRLively.eventServer = contents.eventServer;\r\n MRLively_1.MRLively.chronus = contents.chronus;\r\n MRLively_1.MRLively.questManager = contents.questManager;\r\n }\r\n static makeSaveContents() {\r\n const contents = this.makeSaveContentsCore();\r\n if (!MRSystem_1.MRSystem.floorStartSaveContents) {\r\n MRSystem_1.MRSystem.floorStartSaveContents = JsonEx.stringify(contents);\r\n }\r\n return contents;\r\n }\r\n static loadGameObjects(contents) {\r\n var _a;\r\n this.loadSaveContentsCore(contents);\r\n // const map = MRLively.world.objects().find(x => x && x.objectType() == LObjectType.Map);\r\n // assert(map);\r\n // MRLively.camera.currentMap = map as LMap;\r\n MRSystem_1.MRSystem.mapManager.setMap(MRLively_1.MRLively.mapView.currentMap);\r\n // Visual 側の準備が整い次第、Game レイヤーが持っているマップ情報を Visual に反映してほしい\r\n MRSystem_1.MRSystem.mapManager.requestRefreshVisual();\r\n MRSystem_1.MRSystem.mapDataManager.unloadAllData();\r\n (_a = MRView_1.MRView.dialogManager) === null || _a === void 0 ? void 0 : _a.onLoadGame();\r\n }\r\n static loadGame(contents, withPlayback) {\r\n this.createSystemObjects();\r\n this.loadGameObjects(contents);\r\n if (MRSystem_1.MRSystem.requestedRestartFloorItem.hasAny()) {\r\n return;\r\n }\r\n if (withPlayback) {\r\n // コアスクリプト側が例外を捨てているので、そのままだとこの辺りで発生したエラーの詳細がわからなくなる。\r\n // そのため独自に catch してエラーを出力している。\r\n try {\r\n if (true) {\r\n MRLively_1.MRLively.recorder.attemptStartPlayback(false);\r\n }\r\n else {}\r\n }\r\n catch (e) {\r\n console.error(e);\r\n throw e;\r\n }\r\n }\r\n }\r\n}\r\nexports.SGameManager = SGameManager;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/SGameManager.ts?"); /***/ }), /***/ "./ts/mr/system/SGroundRules.ts": /*!**************************************!*\ !*** ./ts/mr/system/SGroundRules.ts ***! \**************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SGroundRules = void 0;\r\n/**\r\n * ゲーム進行中の重要なタイミングで、各種オブジェクトの状態を調整するクラス。\r\n * タイトルや難易度ごとに調整できるように独立させておく。\r\n *\r\n * 例えばハードなルールではダンジョン内で倒れたときに持ち物をすべてロストするが、\r\n * イージーモードでは装備品は残す、といった変化に対応できるようにする。\r\n */\r\nclass SGroundRules {\r\n onEntityLandLeaved(entity) {\r\n /*\r\n const actor = entity.findBehavior(LActorBehavior);\r\n if (actor) {\r\n actor.resetLevel();\r\n }\r\n\r\n const battler = entity.findBehavior(LBattlerBehavior);\r\n if (battler) {\r\n battler.resetAllConditions();\r\n }\r\n */\r\n }\r\n}\r\nexports.SGroundRules = SGroundRules;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/SGroundRules.ts?"); /***/ }), /***/ "./ts/mr/system/SImmediatelyCommandExecuteScheduler.ts": /*!*************************************************************!*\ !*** ./ts/mr/system/SImmediatelyCommandExecuteScheduler.ts ***! \*************************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SImmediatelyCommandExecuteScheduler = void 0;\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ./MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\n/**\r\n * ターン制御や Sequel の再生を伴わずに Command だけ実行する Scheduler。\r\n *\r\n * stepSimulation() 実行時に、Command が溜まっているばあは即時すべて実行する。\r\n *\r\n * RMMZ 側の制御に置かれたセーフティエリアマップ (拠点マップ) から、\r\n * プラグインコマンドなどを通して Entity へ Command を送るときに使う。\r\n * - アイテムの増減\r\n * - ステータスの増減\r\n * ...等。\r\n */\r\nclass SImmediatelyCommandExecuteScheduler {\r\n stepSimulation() {\r\n const dialogContext = MRSystem_1.MRSystem.dialogContext;\r\n const commandContext = MRSystem_1.MRSystem.commandContext;\r\n //MRLively.camera.syncToFocusedEntity(dialogContext);\r\n while (true) {\r\n if (commandContext.isRunning) {\r\n commandContext._processCommand();\r\n MRSystem_1.MRSystem.sequelContext.attemptFlush(false);\r\n return;\r\n }\r\n else {\r\n // 実行予約が溜まっているなら submit して実行開始する。\r\n // ※もともと callDecisionPhase() と後に毎回直接呼んでいたのだが、\r\n // onTurnEnd() などもサポートしはじめて呼び出し忘れが多くなった。\r\n // そもそもいつ呼び出すべきなのか分かりづらいので、submit の呼び出しは一元化する。\r\n if (!commandContext.isRecordingListEmpty) {\r\n commandContext._submit(); // swap\r\n }\r\n }\r\n if (dialogContext._hasDialogModel()) {\r\n dialogContext._update();\r\n if (dialogContext._hasDialogModel()) {\r\n return;\r\n }\r\n }\r\n if (commandContext.isRunning) {\r\n // コマンド実行中。まだフェーズを進ませない\r\n }\r\n else {\r\n MRLively_1.MRLively.world._removeDestroyedObjects();\r\n }\r\n if (commandContext.isEmpty) {\r\n break;\r\n }\r\n }\r\n }\r\n}\r\nexports.SImmediatelyCommandExecuteScheduler = SImmediatelyCommandExecuteScheduler;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/SImmediatelyCommandExecuteScheduler.ts?"); /***/ }), /***/ "./ts/mr/system/SIntegration.ts": /*!**************************************!*\ !*** ./ts/mr/system/SIntegration.ts ***! \**************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SIntegration = void 0;\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LObject_1 = __webpack_require__(/*! ../lively/LObject */ \"./ts/mr/lively/LObject.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ./MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nclass SIntegration {\r\n //--------------------\r\n // Visual notifications\r\n refreshGameMap(map) {\r\n if (!MRLively_1.MRLively.recorder.isSilentPlayback()) {\r\n this.onRefreshGameMap(map);\r\n }\r\n }\r\n flushEffectResultOneEntity(entity) {\r\n if (entity._effectResult.hasResult()) {\r\n this.onFlushEffectResult(entity);\r\n entity._effectResult.showResultMessages(MRSystem_1.MRSystem.commandContext, entity);\r\n entity._effectResult.clear();\r\n }\r\n }\r\n flushEffectResult() {\r\n for (const obj of MRLively_1.MRLively.world.objects()) {\r\n if (obj && obj.objectType() == LObject_1.LObjectType.Entity) {\r\n const entity = obj;\r\n this.flushEffectResultOneEntity(entity);\r\n }\r\n }\r\n }\r\n flushSequelSet(sequelSet) {\r\n if (!MRLively_1.MRLively.recorder.isSilentPlayback()) {\r\n this.onFlushSequelSet(sequelSet);\r\n }\r\n }\r\n checkVisualSequelRunning() {\r\n if (!MRLively_1.MRLively.recorder.isSilentPlayback()) {\r\n return this.onCheckVisualSequelRunning();\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n openDialog(model) {\r\n if (!MRLively_1.MRLively.recorder.isSilentPlayback()) {\r\n this.onOpenDialog(model);\r\n }\r\n }\r\n updateDialog(context) {\r\n if (!MRLively_1.MRLively.recorder.isSilentPlayback()) {\r\n this.onUpdateDialog(context);\r\n }\r\n }\r\n dialogClosed(context, dialog) {\r\n if (!MRLively_1.MRLively.recorder.isSilentPlayback()) {\r\n this.onDialogClosed(context, dialog);\r\n }\r\n }\r\n raiseCurrentMapChanged() {\r\n if (!MRLively_1.MRLively.recorder.isSilentPlayback()) {\r\n this.onCurrentMapChanged();\r\n }\r\n }\r\n entityEnteredMap(entity) {\r\n if (!MRLively_1.MRLively.recorder.isSilentPlayback()) {\r\n if (!entity.floorId.equals(MRLively_1.MRLively.mapView.currentFloorId))\r\n return;\r\n this.onEntityEnteredMap(entity);\r\n }\r\n }\r\n entityLeavedMap(entity) {\r\n if (!MRLively_1.MRLively.recorder.isSilentPlayback()) {\r\n this.onEntityLeavedMap(entity);\r\n }\r\n }\r\n entityReEnterMap(entity) {\r\n if (!MRLively_1.MRLively.recorder.isSilentPlayback()) {\r\n if (!entity.floorId.equals(MRLively_1.MRLively.mapView.currentFloorId))\r\n return;\r\n this.onEntityReEnterMap(entity);\r\n }\r\n }\r\n}\r\nexports.SIntegration = SIntegration;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/SIntegration.ts?"); /***/ }), /***/ "./ts/mr/system/SMapDataManager.ts": /*!*****************************************!*\ !*** ./ts/mr/system/SMapDataManager.ts ***! \*****************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SMapDataManager = void 0;\r\nclass SMapDataManager {\r\n constructor() {\r\n this._dataList = []; // [LandId][FloorId]\r\n }\r\n // public loadMapData(landId: number, floorId: number): LMapData {\r\n // if (this._dataList[landId] == null) {\r\n // this._dataList[landId] = [];\r\n // }\r\n // if (this._dataList[landId][floorId] == null) {\r\n // this._dataList[landId][floorId] = new LMapData(landId, floorId);\r\n // }\r\n // return this._dataList[landId][floorId];\r\n // }\r\n unloadAllData() {\r\n this._dataList = [];\r\n }\r\n}\r\nexports.SMapDataManager = SMapDataManager;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/SMapDataManager.ts?"); /***/ }), /***/ "./ts/mr/system/SMapManager.ts": /*!*************************************!*\ !*** ./ts/mr/system/SMapManager.ts ***! \*************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SMapManager = void 0;\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ./MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst internal_1 = __webpack_require__(/*! ./internal */ \"./ts/mr/system/internal.ts\");\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst UMovement_1 = __webpack_require__(/*! ../utility/UMovement */ \"./ts/mr/utility/UMovement.ts\");\r\nconst SMonsterHouseBuilder_1 = __webpack_require__(/*! ./map/SMonsterHouseBuilder */ \"./ts/mr/system/map/SMonsterHouseBuilder.ts\");\r\nconst LMonsterHouseStructure_1 = __webpack_require__(/*! ts/mr/lively/structures/LMonsterHouseStructure */ \"./ts/mr/lively/structures/LMonsterHouseStructure.ts\");\r\nconst LItemShopStructure_1 = __webpack_require__(/*! ts/mr/lively/structures/LItemShopStructure */ \"./ts/mr/lively/structures/LItemShopStructure.ts\");\r\nconst SItemShopBuilder_1 = __webpack_require__(/*! ./map/SItemShopBuilder */ \"./ts/mr/system/map/SItemShopBuilder.ts\");\r\nconst USearch_1 = __webpack_require__(/*! ../utility/USearch */ \"./ts/mr/utility/USearch.ts\");\r\nconst DCommon_1 = __webpack_require__(/*! ../data/DCommon */ \"./ts/mr/data/DCommon.ts\");\r\nconst USpawner_1 = __webpack_require__(/*! ../utility/USpawner */ \"./ts/mr/utility/USpawner.ts\");\r\nconst ULimitations_1 = __webpack_require__(/*! ../utility/ULimitations */ \"./ts/mr/utility/ULimitations.ts\");\r\nconst PluginParameters_1 = __webpack_require__(/*! ../PluginParameters */ \"./ts/mr/PluginParameters.ts\");\r\nconst DEntityCategory_1 = __webpack_require__(/*! ../data/DEntityCategory */ \"./ts/mr/data/DEntityCategory.ts\");\r\nconst UEffect_1 = __webpack_require__(/*! ../utility/UEffect */ \"./ts/mr/utility/UEffect.ts\");\r\n/**\r\n * LMap へのアイテムや敵の生成・配置など、ゲーム進行に伴う Map 上の変化を管理するクラス。\r\n */\r\nclass SMapManager {\r\n constructor() {\r\n this._enemySpanwRate = 10;\r\n this._enemySpawnCount = 0; // TODO: これは Ojbect 側に持って行かないとまずいかも\r\n this._needRefreshVisual = false;\r\n //this._map = MRLively.camera.currentMap;\r\n this._enemySpawnCount = this._enemySpanwRate;\r\n }\r\n get exitPoint() {\r\n (0, Common_1.assert)(this._exitPoint);\r\n return this._exitPoint;\r\n }\r\n setMap(map) {\r\n this._map = map;\r\n }\r\n get map() {\r\n (0, Common_1.assert)(this._map);\r\n return this._map;\r\n }\r\n rand() {\r\n return MRLively_1.MRLively.world.random();\r\n }\r\n setupMap(initialMap) {\r\n const newFloorId = this.map.floorId();\r\n if (newFloorId.isNormalMap2) {\r\n }\r\n else if (newFloorId.isRandomMap2) {\r\n this.setupRandomMap(initialMap);\r\n }\r\n else {\r\n this.setupFixedMap(initialMap);\r\n }\r\n MRSystem_1.MRSystem.integration.onMapSetupCompleted(this.map);\r\n }\r\n setupRandomMap(initialMap) {\r\n const floorId = this.map.floorId();\r\n this.requestRefreshVisual();\r\n // 階段を配置する\r\n // TODO: お店の外\r\n {\r\n const exitPoint = initialMap.exitPont();\r\n if (exitPoint) {\r\n const appearanceTable = MRData_1.MRData.lands[floorId.landId].appearanceTable;\r\n const prefab = appearanceTable.system[floorId.floorNumber].find(e => {\r\n return DEntityCategory_1.DEntityCategory.isExitPoint(e.spawiInfo.entityData());\r\n });\r\n (0, Common_1.assert)(prefab);\r\n this._exitPoint = internal_1.SEntityFactory.newBasicExitPoint();\r\n MRLively_1.MRLively.world.transferEntity(this._exitPoint, floorId, exitPoint.mx(), exitPoint.my());\r\n }\r\n }\r\n const enterdEntities = this.enterEntitiesToCurrentMap();\r\n this.buildStructurs();\r\n // この Floor にいるべき Entity を配置する\r\n {\r\n //const objects = REGame.world.objects();\r\n for (const entity of enterdEntities) {\r\n if (entity.floorId.equals(this.map.floorId())) {\r\n const layer = entity.getHomeLayer();\r\n const block = this.findSpawnableBlockRandom(layer);\r\n (0, Common_1.assert)(block);\r\n this.map.locateEntity(entity, block.mx, block.my);\r\n }\r\n }\r\n }\r\n // Enemy 初期生成\r\n const enemyCount = 5;\r\n for (let i = 0; i < enemyCount; i++) {\r\n const candidateBlocks = this.map.getSpawnableBlocks(DCommon_1.DBlockLayerKind.Unit);\r\n if (candidateBlocks.length > 0) {\r\n const block = candidateBlocks[this.rand().nextIntWithMax(candidateBlocks.length)];\r\n this.spawnEnemy(block.mx, block.my);\r\n }\r\n }\r\n // Item 初期生成\r\n const itemCount = 5;\r\n for (let i = 0; i < itemCount; i++) {\r\n const candidateBlocks = this.map.getSpawnableBlocks(DCommon_1.DBlockLayerKind.Ground);\r\n if (candidateBlocks.length > 0) {\r\n const block = candidateBlocks[this.rand().nextIntWithMax(candidateBlocks.length)];\r\n this.spawnItem(block.mx, block.my);\r\n }\r\n }\r\n // Trap 初期生成\r\n const trapCount = 5;\r\n this.spawnTraps(trapCount);\r\n // Event 配置\r\n const eventTable = this.map.land2().landData().appearanceTable.events[floorId.floorNumber];\r\n for (const i of eventTable) {\r\n MRSystem_1.MRSystem.integration.onLocateRmmzEvent(i.rmmzEventId, 0, 0);\r\n }\r\n }\r\n setupFixedMap(initialMap) {\r\n MRSystem_1.MRSystem.integration.onLoadFixedMapEvents();\r\n this.buildStructurs();\r\n const enterdEntities = this.enterEntitiesToCurrentMap();\r\n const entryPoint = initialMap.entryPoint();\r\n (0, Common_1.assert)(entryPoint);\r\n for (const entity of enterdEntities) {\r\n if (entity.isOnOffstage()) {\r\n // TODO: 複数 Entity が重なるときの対策\r\n this.map.locateEntity(entity, entryPoint.mx(), entryPoint.my());\r\n }\r\n }\r\n // Locate unique entites\r\n const uniqueSpawners = MRSystem_1.MRSystem.integration.onGetFixedMapUnqueSpawners();\r\n for (const spawner of uniqueSpawners) {\r\n const entity = USearch_1.USearch.getUniqueActorById(spawner.entityId);\r\n this.map.uniqueSpawners[entity.dataId] = spawner;\r\n MRLively_1.MRLively.world.transferEntity(entity, this.map.floorId(), spawner.mx, spawner.my);\r\n }\r\n }\r\n setupInitial() {\r\n }\r\n buildStructurs() {\r\n // モンスターハウス\r\n for (const s of this.map.structures()) {\r\n if (s.id() == 0) {\r\n // dummy\r\n }\r\n else if (s instanceof LMonsterHouseStructure_1.LMonsterHouseStructure) {\r\n const builder = new SMonsterHouseBuilder_1.SMonsterHouseBuilder();\r\n builder.build(this, s, this.rand());\r\n }\r\n else if (s instanceof LItemShopStructure_1.LItemShopStructure) {\r\n console.log(\"ItemShop!!\");\r\n const builder = new SItemShopBuilder_1.SItemShopBuilder();\r\n builder.build(this, s, this.rand());\r\n }\r\n else {\r\n throw new Error(\"Not implemented.\");\r\n }\r\n }\r\n }\r\n requestRefreshVisual() {\r\n this._needRefreshVisual = true;\r\n }\r\n attemptRefreshVisual() {\r\n if (this._needRefreshVisual) {\r\n if (this.map.floorId().isRandomMap2) {\r\n MRSystem_1.MRSystem.integration.refreshGameMap(MRLively_1.MRLively.mapView.currentMap);\r\n }\r\n else {\r\n // 固定マップの場合は RMMZ 側で既に準備済みなので更新不要\r\n }\r\n this._needRefreshVisual = false;\r\n }\r\n }\r\n updateRound() {\r\n this._enemySpawnCount--;\r\n if (this._enemySpawnCount <= 0) {\r\n this._enemySpawnCount = this._enemySpanwRate;\r\n this.spawnRandomEnemy();\r\n }\r\n }\r\n // 現在の Map(Floor) に存在するべき Entity を、Map に登場 (追加) させる\r\n // ※追加だけ。配置方法はマップの種類によって変わるので、この関数では行わない。\r\n enterEntitiesToCurrentMap() {\r\n this.map.refreshLocateToBlockAllEntites();\r\n return this.map.entities();\r\n // const player = MRLively.mapView.focusedEntity();\r\n // assert(player)\r\n // const result: LEntity[] = [];\r\n // const isFixedMap = this.map.floorId().isFixedMap();\r\n // const objects = MRLively.world.objects();\r\n // for (let i = 1; i < objects.length; i++) {\r\n // const obj = objects[i];\r\n // if (obj && obj.objectType() == LObjectType.Entity) {\r\n // const entity = obj as LEntity;\r\n // // enterEntitiesToCurrentMap() が呼ばれる前に Map の setup が行われている。\r\n // // 固定マップの場合は既にいくつか Entity が追加されていることがあるので、\r\n // // それはここでは追加しない。\r\n // const isEnterd = entity.hasParent();\r\n // // onLoadFixedMapEvents() によって既に追加されているものは対象外\r\n // if (entity.isAppearedOnMap()) continue;\r\n // if (this.map.floorId().equals(entity.floorId) && !isEnterd) {\r\n // //if (isFixedMap) {\r\n // this.map._reappearEntity(entity);\r\n // result.push(entity);\r\n // //}\r\n // /*\r\n // else {\r\n // const layer = entity.queryProperty(RESystem.properties.homeLayer);\r\n // const block = this.findSpawnableBlockRandom(entity, layer);\r\n // assert(block);\r\n // //const block = this.block(entity.x, entity.y);\r\n // //const layer = entity.queryProperty(RESystem.properties.homeLayer);\r\n // block.addEntity(layer, entity);\r\n // this._map._addEntityInternal(entity);\r\n // }\r\n // */\r\n // }\r\n // }\r\n // }\r\n // return result;\r\n }\r\n findSpawnableBlockRandom(layer) {\r\n // \r\n const spawnableBlocks = this.map.roomFloorBlocks().filter(b => b.isContinuation() && !b.layer(layer).isContainsAnyEntity());\r\n if (spawnableBlocks.length == 0)\r\n return undefined;\r\n const candidateBlocks = spawnableBlocks;\r\n if (candidateBlocks.length == 0)\r\n return undefined;\r\n return candidateBlocks[this.rand().nextIntWithMax(candidateBlocks.length)];\r\n }\r\n spawnRandomEnemy() {\r\n const block = USearch_1.USearch.selectUnitSpawnableBlock(this.rand());\r\n if (block) {\r\n this.spawnEnemy(block.mx, block.my);\r\n }\r\n else {\r\n //throw new Error(\"Not implemented.\");\r\n }\r\n }\r\n /** 出現テーブルからランダムに選択して Entity を作る */\r\n spawnEnemy(mx, my) {\r\n const floorId = this.map.floorId();\r\n const table = this.map.land2().landData().appearanceTable;\r\n if (table.enemies.length == 0)\r\n return []; // 出現テーブルが空\r\n const list = table.enemies[floorId.floorNumber];\r\n if (list.length == 0)\r\n return []; // 出現テーブルが空\r\n const data = UEffect_1.UEffect.selectRatingForce(this.rand(), list, 100, x => x.spawiInfo.rate);\r\n let entites;\r\n if (data.spawiInfo.troopId > 0) {\r\n entites = internal_1.SEntityFactory.spawnTroopAndMembers(this.map, MRData_1.MRData.troops[data.spawiInfo.troopId], mx, my, data.spawiInfo.stateIds);\r\n }\r\n else {\r\n const entity = internal_1.SEntityFactory.newEntity(data.spawiInfo, floorId);\r\n MRLively_1.MRLively.world.transferEntity(entity, floorId, mx, my);\r\n entites = [entity];\r\n }\r\n // 向きをランダムに決定\r\n const dir = this.rand().select(UMovement_1.UMovement.directions);\r\n for (const e of entites) {\r\n e.dir = dir;\r\n }\r\n return entites;\r\n }\r\n /** 出現テーブルからランダムに選択して Item を作る */\r\n spawnItem(mx, my) {\r\n const floorId = this.map.floorId();\r\n const entity = USpawner_1.USpawner.createItemFromSpawnTable(floorId, this.rand());\r\n if (entity) {\r\n MRLively_1.MRLively.world.transferEntity(entity, floorId, mx, my);\r\n }\r\n return entity;\r\n }\r\n /** 出現テーブルからランダムに選択して Trap を作る */\r\n spawnTrap(mx, my) {\r\n const floorId = this.map.floorId();\r\n const entity = USpawner_1.USpawner.createTrapFromSpawnTable(floorId, this.rand());\r\n if (entity) {\r\n MRLively_1.MRLively.world.transferEntity(entity, floorId, mx, my);\r\n }\r\n }\r\n spawnTraps(count) {\r\n const remain = PluginParameters_1.paramMaxTrapsInMap - ULimitations_1.ULimitations.getTrapCountInMap();\r\n const actualCount = Math.min(count, remain);\r\n const candidateBlocks = this.map.getSpawnableBlocks(DCommon_1.DBlockLayerKind.Ground);\r\n for (let i = 0; i < actualCount; i++) {\r\n if (candidateBlocks.length > 0) {\r\n const block = candidateBlocks[this.rand().nextIntWithMax(candidateBlocks.length)];\r\n const entity = this.spawnTrap(block.mx, block.my);\r\n candidateBlocks.mutableRemove(x => x == block);\r\n }\r\n }\r\n }\r\n}\r\nexports.SMapManager = SMapManager;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/SMapManager.ts?"); /***/ }), /***/ "./ts/mr/system/SMinimapData.ts": /*!**************************************!*\ !*** ./ts/mr/system/SMinimapData.ts ***! \**************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SMinimapData = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst FMapData_1 = __webpack_require__(/*! ts/mr/floorgen/FMapData */ \"./ts/mr/floorgen/FMapData.ts\");\r\nconst LBattlerBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LBattlerBehavior */ \"./ts/mr/lively/behaviors/LBattlerBehavior.ts\");\r\nconst LItemBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LItemBehavior */ \"./ts/mr/lively/behaviors/LItemBehavior.ts\");\r\nconst LTrapBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LTrapBehavior */ \"./ts/mr/lively/behaviors/LTrapBehavior.ts\");\r\nconst LExitPointBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LExitPointBehavior */ \"./ts/mr/lively/behaviors/LExitPointBehavior.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst Helpers_1 = __webpack_require__(/*! ./Helpers */ \"./ts/mr/system/Helpers.ts\");\r\nconst SNavigationHelper_1 = __webpack_require__(/*! ./SNavigationHelper */ \"./ts/mr/system/SNavigationHelper.ts\");\r\nconst SView_1 = __webpack_require__(/*! ./SView */ \"./ts/mr/system/SView.ts\");\r\nconst DHelper_1 = __webpack_require__(/*! ../data/DHelper */ \"./ts/mr/data/DHelper.ts\");\r\nconst LCommon_1 = __webpack_require__(/*! ../lively/LCommon */ \"./ts/mr/lively/LCommon.ts\");\r\nconst SEditMapHelper_1 = __webpack_require__(/*! ./utils/SEditMapHelper */ \"./ts/mr/system/utils/SEditMapHelper.ts\");\r\nconst ExitPointTileIdOffset = 14;\r\nclass SMiniMapAutoTileHelper extends SEditMapHelper_1.SEditMapHelper {\r\n onIsValidPos(x, y) { throw new Error(\"Unreachable\"); }\r\n onGetTileId(x, y, z) { throw new Error(\"Unreachable\"); }\r\n onSetTileId(x, y, z, tileId) { throw new Error(\"Unreachable\"); }\r\n getSameKindTile(x, y, z, component) {\r\n const block = MRLively_1.MRLively.mapView.currentMap.tryGetBlock(x, y);\r\n if (!block)\r\n return true; // マップ範囲外は同種とすることで、境界外にも広がっているように見せる\r\n if (!block._passed)\r\n return true; // 未踏なら壁Edgeなどは表示したくないので、同種扱いする\r\n if (block._blockComponent == component)\r\n return true;\r\n return false;\r\n }\r\n}\r\nclass SMinimapData {\r\n constructor() {\r\n this._width = 0;\r\n this._height = 0;\r\n this._data = [];\r\n this._tilemapResetNeeded = true;\r\n this._refreshNeeded = true;\r\n this._autoTileHelper = new SMiniMapAutoTileHelper();\r\n }\r\n clear() {\r\n this._width = 0;\r\n this._height = 0;\r\n this._tilemapResetNeeded = true;\r\n }\r\n reset(width, height) {\r\n this._width = width;\r\n this._height = height;\r\n this._data = new Array(this._width * this._height * 4);\r\n this._tilemapResetNeeded = true;\r\n }\r\n width() {\r\n return this._width;\r\n }\r\n height() {\r\n return this._height;\r\n }\r\n // Tilemap に登録する、 RMMZ と同じフォーマットのマップデータ\r\n data() {\r\n return this._data;\r\n }\r\n setData(x, y, z, value) {\r\n (0, Common_1.assert)(this.isValid(x, y, z));\r\n this._data[(z * this._height + y) * this._width + x] = value;\r\n }\r\n getData(x, y, z) {\r\n (0, Common_1.assert)(this.isValid(x, y, z));\r\n return this._data[(z * this._height + y) * this._width + x];\r\n }\r\n isValid(x, y, z) {\r\n return (0 <= x && x < this._width) && (0 <= y && y < this._height) && (0 <= z && z < 4);\r\n }\r\n isTilemapResetNeeded() {\r\n return this._tilemapResetNeeded;\r\n }\r\n clearTilemapResetNeeded() {\r\n this._tilemapResetNeeded = false;\r\n }\r\n setTilemapResetNeeded() {\r\n this._tilemapResetNeeded = true;\r\n }\r\n setRefreshNeeded() {\r\n this._refreshNeeded = true;\r\n }\r\n //public isRefreshNeeded(): boolean {\r\n // return this._tilemapResetNeeded;\r\n //}\r\n playerMarkerTileId() {\r\n return DHelper_1.DHelpers.TILE_ID_A5 + 9;\r\n }\r\n itemMarkerTileId() {\r\n return DHelper_1.DHelpers.TILE_ID_A5 + 10;\r\n }\r\n enemyMarkerTileId() {\r\n return DHelper_1.DHelpers.TILE_ID_A5 + 11;\r\n }\r\n exitMarkerTileId() {\r\n return DHelper_1.DHelpers.TILE_ID_A5 + ExitPointTileIdOffset;\r\n }\r\n // 地形表示の更新\r\n refresh() {\r\n const map = MRLively_1.MRLively.mapView.currentMap;\r\n const width = map.width();\r\n const height = map.height();\r\n for (let y = 0; y < height; y++) {\r\n for (let x = 0; x < width; x++) {\r\n const block = map.block(x, y);\r\n switch (block._blockComponent) {\r\n default:\r\n const tileId = this._autoTileHelper.getAutotileShape(x, y, 0, FMapData_1.FBlockComponent.None);\r\n if (block._passed)\r\n this.setData(x, y, 0, DHelper_1.DHelpers.TILE_ID_A2 + tileId);\r\n else\r\n this.setData(x, y, 0, 0);\r\n break;\r\n case FMapData_1.FBlockComponent.Room:\r\n case FMapData_1.FBlockComponent.Passageway:\r\n if (block._passed)\r\n this.setData(x, y, 0, DHelper_1.DHelpers.TILE_ID_A5 + 1);\r\n else\r\n this.setData(x, y, 0, 0);\r\n break;\r\n }\r\n }\r\n }\r\n this._refreshNeeded = false;\r\n }\r\n update() {\r\n const map = MRLively_1.MRLively.mapView.currentMap;\r\n const width = map.width();\r\n const height = map.height();\r\n const subject = MRLively_1.MRLively.mapView.focusedEntity();\r\n (0, Common_1.assert)(subject);\r\n if (width != this._width || height != this._height) {\r\n this.reset(width, height);\r\n }\r\n if (this._refreshNeeded) {\r\n this.refresh();\r\n }\r\n // Clear\r\n for (let y = 0; y < height; y++) {\r\n for (let x = 0; x < width; x++) {\r\n this.setData(x, y, 1, 0);\r\n }\r\n }\r\n for (const entity of map.entities()) {\r\n const markerClass = entity.queryMinimapMarkerClass();\r\n if (markerClass != LCommon_1.LMinimapMarkerClass.None) {\r\n switch (markerClass) {\r\n case LCommon_1.LMinimapMarkerClass.Item:\r\n this.setData(entity.mx, entity.my, 1, this.itemMarkerTileId());\r\n break;\r\n default:\r\n throw new Error(\"Not implemetend.\");\r\n }\r\n }\r\n else {\r\n const tileId = this.getDefiniteMarkerTileId(subject, entity);\r\n if (tileId) {\r\n this.setData(entity.mx, entity.my, 1, tileId);\r\n }\r\n else {\r\n }\r\n }\r\n }\r\n }\r\n getDefiniteMarkerTileId(subject, entity) {\r\n if (!SView_1.SView.getMinimapVisibility(entity).visible) {\r\n // 何も表示しない\r\n return 0;\r\n }\r\n else if (entity.entityId().equals(subject.entityId())) {\r\n return this.playerMarkerTileId();\r\n }\r\n else {\r\n if (SNavigationHelper_1.SNavigationHelper.testVisibilityForMinimap(subject, entity)) {\r\n if (entity.findEntityBehavior(LTrapBehavior_1.LTrapBehavior)) {\r\n return DHelper_1.DHelpers.TILE_ID_A5 + 13;\r\n }\r\n else if (entity.findEntityBehavior(LBattlerBehavior_1.LBattlerBehavior)) {\r\n if (Helpers_1.Helpers.isHostile(subject, entity)) {\r\n // 敵対勢力\r\n return this.enemyMarkerTileId();\r\n }\r\n else {\r\n // 中立 or 味方\r\n return DHelper_1.DHelpers.TILE_ID_A5 + 12;\r\n }\r\n }\r\n else if (entity.findEntityBehavior(LItemBehavior_1.LItemBehavior)) {\r\n return this.itemMarkerTileId();\r\n }\r\n else if (entity.findEntityBehavior(LExitPointBehavior_1.LExitPointBehavior)) {\r\n return this.exitMarkerTileId();\r\n }\r\n }\r\n }\r\n return 0;\r\n }\r\n}\r\nexports.SMinimapData = SMinimapData;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/SMinimapData.ts?"); /***/ }), /***/ "./ts/mr/system/SNavigationHelper.ts": /*!*******************************************!*\ !*** ./ts/mr/system/SNavigationHelper.ts ***! \*******************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SNavigationHelper = void 0;\r\nconst LTrapBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LTrapBehavior */ \"./ts/mr/lively/behaviors/LTrapBehavior.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ../data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst LExitPointBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LExitPointBehavior */ \"./ts/mr/lively/behaviors/LExitPointBehavior.ts\");\r\nconst HMovement_1 = __webpack_require__(/*! ../lively/helpers/HMovement */ \"./ts/mr/lively/helpers/HMovement.ts\");\r\nconst PluginParameters_1 = __webpack_require__(/*! ../PluginParameters */ \"./ts/mr/PluginParameters.ts\");\r\nconst UMovement_1 = __webpack_require__(/*! ../utility/UMovement */ \"./ts/mr/utility/UMovement.ts\");\r\nconst Helpers_1 = __webpack_require__(/*! ./Helpers */ \"./ts/mr/system/Helpers.ts\");\r\n// いわゆる ナビゲーションAI 関係のサポート\r\nclass SNavigationHelper {\r\n /*\r\n public static checkVisible(subject: LEntity, target: LEntity): boolean {\r\n const trap = target.findBehavior(LTrapBehavior);\r\n if (trap && !trap.exposed()) return false;\r\n\r\n // TODO: 透明状態とか\r\n\r\n return true;\r\n }\r\n\r\n */\r\n /**\r\n * subject から見て target は可視であるか\r\n *\r\n * ミニマップ表示に使う。AIでは想定していない\r\n *\r\n * @deprecated SView.getEntityVisibility\r\n */\r\n static testVisibilityForMinimap(subject, target) {\r\n const map = MRLively_1.MRLively.mapView.currentMap;\r\n const targetBlock = MRLively_1.MRLively.mapView.currentMap.block(target.mx, target.my);\r\n // Trap は未発見の場合、どのような勢力からであっても不可視\r\n const trap = target.findEntityBehavior(LTrapBehavior_1.LTrapBehavior);\r\n if (trap) {\r\n if (map.trapClarity)\r\n return true;\r\n if (!trap.exposed())\r\n return false;\r\n }\r\n // 味方は常に視認可能\r\n if (Helpers_1.Helpers.isFriend(subject, target)) {\r\n return true;\r\n }\r\n // 隣接していれば Faction を問わず見える\r\n if (UMovement_1.UMovement.checkAdjacentEntities(subject, target)) {\r\n return true;\r\n }\r\n // 同じ部屋にいれば Faction を問わず見える\r\n if (subject.isOnRoom() && subject.roomId() == target.roomId()) {\r\n const room = map.room(subject.roomId());\r\n if (room.poorVisibility) {\r\n // 視界不明瞭マップでは視界半径をチェック\r\n if (HMovement_1.HMovement.blockDistance(subject.mx, subject.my, target.mx, target.my) <= PluginParameters_1.paramDefaultVisibiltyLength) {\r\n return true;\r\n }\r\n }\r\n else {\r\n return true;\r\n }\r\n }\r\n // const block = map.block(target.x, target.y);\r\n // if (block._passed) {\r\n // return true;\r\n // }\r\n if (map.unitClarity) {\r\n if (target.isUnit()) {\r\n return true;\r\n }\r\n }\r\n if (map.itemClarity) {\r\n if (this.isItem(target)) {\r\n return true;\r\n }\r\n }\r\n if (Helpers_1.Helpers.isHostile(subject, target)) {\r\n if (subject.collectTraits().find(t => t.code == MRBasics_1.MRBasics.traits.UnitVisitor)) {\r\n return true;\r\n }\r\n }\r\n else {\r\n // 中立 target は、踏破済みの Block 上なら見える\r\n if (targetBlock._passed) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n static isItem(entity) {\r\n if (!!entity.data.itemData) {\r\n if (!entity.findEntityBehavior(LExitPointBehavior_1.LExitPointBehavior)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\nexports.SNavigationHelper = SNavigationHelper;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/SNavigationHelper.ts?"); /***/ }), /***/ "./ts/mr/system/SQuestManager.ts": /*!***************************************!*\ !*** ./ts/mr/system/SQuestManager.ts ***! \***************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SQuestManager = void 0;\r\nconst MRLively_1 = __webpack_require__(/*! ../lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nclass SQuestManager {\r\n openQuest(questKey) {\r\n const newQuest = MRLively_1.MRLively.questManager.openQuest(questKey);\r\n // if (newQuest) {\r\n // MRSystem.commandContext.postMessage(tr2(\"クエスト \\\"%1\\\" を開始しました。\").format(questKey));\r\n // }\r\n }\r\n advanceQuestTask(questKey, questTaskKey) {\r\n // const info = MRLively.questManager.advanceQuestTask(questKey, questTaskKey);\r\n // if (info) {\r\n // MRSystem.commandContext.postMessage(tr2(\"クエスト \\\"%1\\\" を開始しました。\").format(info.));\r\n // }\r\n }\r\n}\r\nexports.SQuestManager = SQuestManager;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/SQuestManager.ts?"); /***/ }), /***/ "./ts/mr/system/SRmmzHelpers.ts": /*!**************************************!*\ !*** ./ts/mr/system/SRmmzHelpers.ts ***! \**************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SRmmzHelpers = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst FMapData_1 = __webpack_require__(/*! ts/mr/floorgen/FMapData */ \"./ts/mr/floorgen/FMapData.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LBlock_1 = __webpack_require__(/*! ts/mr/lively/LBlock */ \"./ts/mr/lively/LBlock.ts\");\r\nconst PluginParameters_1 = __webpack_require__(/*! ts/mr/PluginParameters */ \"./ts/mr/PluginParameters.ts\");\r\nconst internal_1 = __webpack_require__(/*! ./internal */ \"./ts/mr/system/internal.ts\");\r\nconst DSpawner_1 = __webpack_require__(/*! ts/mr/data/DSpawner */ \"./ts/mr/data/DSpawner.ts\");\r\nconst DAnnotationReader_1 = __webpack_require__(/*! ../data/importers/DAnnotationReader */ \"./ts/mr/data/importers/DAnnotationReader.ts\");\r\nconst DHelper_1 = __webpack_require__(/*! ../data/DHelper */ \"./ts/mr/data/DHelper.ts\");\r\n/**\r\n * RMMZ データ ($dataXXXX) に依存する処理。\r\n * これらは もともと rmmz フォルダ内 (RMMZIntegration 等) で定義していたが UnitTest でも使用する必要がでてきたため、\r\n * Visual レイヤーにアクセスする rmmz フォルダからは独立させたもの。\r\n */\r\nclass SRmmzHelpers {\r\n static readEntityMetadata(event, rmmzMapId) {\r\n if (event._pageIndex >= 0) {\r\n const data = event.event();\r\n (0, Common_1.assert)(data);\r\n return DSpawner_1.DEntitySpawner.makeFromEventPageData(data, event.page(), rmmzMapId);\r\n }\r\n else {\r\n return undefined;\r\n }\r\n }\r\n // public static isItemPrefab(data: RmmzEventPrefabMetadata): boolean {\r\n // return !!data.itemId;\r\n // }\r\n //public static isExitPointPrefab(data: RMMZEventEntityMetadata): boolean {\r\n // return data.prefab.includes(\"ExitPoint\");\r\n //}\r\n // こちらは UnitTest 用。Game_Event は使えないので $dataMap から、最初のイベントページ固定で作る\r\n static createEntitiesFromRmmzFixedMapEventData(rmmzMapId) {\r\n $dataMap.events.forEach((e) => {\r\n if (e) {\r\n const data = DSpawner_1.DEntitySpawner.makeFromEventData(e, rmmzMapId);\r\n if (data) {\r\n if (data.troopId > 0) {\r\n internal_1.SEntityFactory.spawnTroopAndMembers(MRLively_1.MRLively.mapView.currentMap, MRData_1.MRData.troops[data.troopId], e.x, e.y, data.stateIds);\r\n }\r\n else {\r\n if (data.entityId < 0) {\r\n throw new Error(\"Invalid enity data.\");\r\n }\r\n this.createEntityFromRmmzEvent(data, e.id, e.x, e.y);\r\n }\r\n }\r\n }\r\n });\r\n }\r\n /**\r\n * 指定したマップ内に存在している Game_Event のアクティブなページから、UnqueSpawner を取得します。\r\n * @param rmmzGameMap\r\n * @returns\r\n */\r\n static getUnqueSpawners(rmmzGameMap) {\r\n const result = [];\r\n for (const e of rmmzGameMap.events()) {\r\n if (e) {\r\n const annotation = DAnnotationReader_1.DAnnotationReader.readUniqueSpawnerAnnotationFromPage(e.page());\r\n if (annotation) {\r\n const spawner = DSpawner_1.DEntitySpawner.makeFromAnnotation(annotation);\r\n spawner.mx = e.x;\r\n spawner.my = e.y;\r\n if (annotation.override) {\r\n spawner.overrideRmmzEventMapId = rmmzGameMap.mapId();\r\n spawner.overrideRmmzEventId = e.event().id;\r\n spawner.overrideEvent = e.event();\r\n }\r\n result.push(spawner);\r\n }\r\n }\r\n }\r\n return result;\r\n }\r\n static createEntityFromRmmzEvent(data, eventId, x, y) {\r\n const entity = internal_1.SEntityFactory.newEntity(data, MRLively_1.MRLively.mapView.currentMap.floorId());\r\n if (data.override) {\r\n entity.inhabitsCurrentFloor = true;\r\n //this.linkEntityAndEvent(entity, event);\r\n }\r\n MRLively_1.MRLively.world.transferEntity(entity, MRLively_1.MRLively.mapView.currentMap.floorId(), x, y);\r\n return entity;\r\n }\r\n static linkEntityAndEvent(entity, event) {\r\n entity.setRmmzEventId(event.eventId());\r\n event._MREntityId = entity.entityId().clone();\r\n }\r\n static unlinkEntityAndEvent(entity) {\r\n const eventId = entity.rmmzEventId;\r\n if (eventId > 0) {\r\n const event = $gameMap.event(eventId);\r\n if (event) {\r\n event._MREntityId = undefined;\r\n }\r\n }\r\n entity.setRmmzEventId(0);\r\n }\r\n static getRegionId(x, y) {\r\n var _a, _b;\r\n if ($dataMap.data) {\r\n const width = (_a = $dataMap.width) !== null && _a !== void 0 ? _a : 0;\r\n const height = (_b = $dataMap.height) !== null && _b !== void 0 ? _b : 0;\r\n return $dataMap.data[(5 * height + y) * width + x];\r\n }\r\n else {\r\n return 0;\r\n }\r\n }\r\n static buildFixedMapData(map) {\r\n var _a, _b;\r\n if (!$dataMap) {\r\n throw new Error();\r\n }\r\n const width = (_a = $dataMap.width) !== null && _a !== void 0 ? _a : 10;\r\n const height = (_b = $dataMap.height) !== null && _b !== void 0 ? _b : 10;\r\n map.resetFromFullSize(width, height, 0, 0);\r\n let regionCount = 0;\r\n for (let y = 0; y < map.innerHeight; y++) {\r\n for (let x = 0; x < map.innerWidth; x++) {\r\n const block = map.block(x, y);\r\n block.setTileShape(this.getTileShape(x, y));\r\n const regionId = this.getRegionId(x, y);\r\n if (regionId == PluginParameters_1.paramFixedMapRoomRegionId) {\r\n block.setComponent(FMapData_1.FBlockComponent.Room);\r\n }\r\n else if (regionId == PluginParameters_1.paramFixedMapMonsterHouseRoomRegionId) {\r\n block.setComponent(FMapData_1.FBlockComponent.Room);\r\n block.setFixedMapMonsterHouseTypeId(MRBasics_1.MRBasics.monsterHouses.fixed);\r\n }\r\n else if (regionId == PluginParameters_1.paramFixedMapItemShopRoomRegionId) {\r\n block.setComponent(FMapData_1.FBlockComponent.Room);\r\n block.setFixedMapItemShopTypeId(MRBasics_1.MRBasics.itemShops.fixed);\r\n }\r\n else if (regionId == PluginParameters_1.paramFixedMapPassagewayRegionId) {\r\n block.setComponent(FMapData_1.FBlockComponent.Passageway);\r\n }\r\n if (regionId > 0) {\r\n regionCount++;\r\n }\r\n }\r\n }\r\n // region の指定が全く無いマップは、全てのブロックを Room にする\r\n if (regionCount == 0) {\r\n for (let y = 0; y < map.innerHeight; y++) {\r\n for (let x = 0; x < map.innerWidth; x++) {\r\n const block = map.block(x, y);\r\n block.setComponent(FMapData_1.FBlockComponent.Room);\r\n }\r\n }\r\n }\r\n }\r\n static getTileShape(mx, my) {\r\n if (Game_Map_Impl.checkPassage(mx, my, 0xF)) {\r\n const tiles = Game_Map_Impl.allTiles(mx, my);\r\n for (const t of tiles) {\r\n // RMMZ で壁オートタイル(A4)は、上面にあたる部分が必ず通行可能となる。\r\n // 単純に通行可否で TileShape を決定してしまうと、MRとして壁にしたい部分も床となってしまう。\r\n // そのため、A4 を一律 Wall 扱いする。\r\n if (DHelper_1.DHelpers.isTileA4(t))\r\n return LBlock_1.LTileShape.HardWall;\r\n }\r\n return LBlock_1.LTileShape.Floor;\r\n }\r\n else {\r\n return LBlock_1.LTileShape.HardWall;\r\n }\r\n }\r\n}\r\nexports.SRmmzHelpers = SRmmzHelpers;\r\n/**\r\n * Game_Map のうち通行判定など、$dataMap を参照したい処理を持ってきたもの。\r\n * UnitTest でも使いたいので Game_Map は参照できない。\r\n */\r\nclass Game_Map_Impl {\r\n // Game_Map.prototype.tileset\r\n static tileset() {\r\n return $dataTilesets[$dataMap.tilesetId];\r\n }\r\n ;\r\n // Game_Map.prototype.tilesetFlags\r\n static tilesetFlags() {\r\n const tileset = this.tileset();\r\n if (tileset) {\r\n return tileset.flags;\r\n }\r\n else {\r\n return [];\r\n }\r\n }\r\n // Game_Map.prototype.layeredTiles\r\n static layeredTiles(x, y) {\r\n const tiles = [];\r\n for (let i = 0; i < 4; i++) {\r\n tiles.push(this.tileId(x, y, 3 - i));\r\n }\r\n return tiles;\r\n }\r\n ;\r\n // Game_Map.prototype.allTiles \r\n static allTiles(x, y) {\r\n // Tile 化された Event は考慮しない (Game_Event は参照できない)\r\n return this.layeredTiles(x, y);\r\n }\r\n ;\r\n // Game_Map.prototype.checkPassage \r\n static checkPassage(x, y, bit) {\r\n const flags = this.tilesetFlags();\r\n const tiles = this.allTiles(x, y);\r\n for (const tile of tiles) {\r\n const flag = flags[tile];\r\n if ((flag & 0x10) !== 0) {\r\n // [*] No effect on passage\r\n continue;\r\n }\r\n if ((flag & bit) === 0) {\r\n // [o] Passable\r\n return true;\r\n }\r\n if ((flag & bit) === bit) {\r\n // [x] Impassable\r\n return false;\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\n// Game_Map.prototype.tileId\r\nGame_Map_Impl.tileId = function (x, y, z) {\r\n const width = $dataMap.width;\r\n const height = $dataMap.height;\r\n return $dataMap.data[(z * height + y) * width + x] || 0;\r\n};\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/SRmmzHelpers.ts?"); /***/ }), /***/ "./ts/mr/system/SSequel.ts": /*!*********************************!*\ !*** ./ts/mr/system/SSequel.ts ***! \*********************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SSequelSet = exports.SSequelRun = exports.SSequelClip = exports.SWaitSequel = exports.SBalloonSequel = exports.SFloatingAnumationSequel = exports.SAnumationSequel = exports.SMotionSequel = exports.SSequelUnit = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ../data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\n/**\r\n * Sequel\r\n *\r\n * Sequel 個別にデータを持たせたいときに利用予定 (継承よりはフィールドに持たせた方がいいかも)\r\n */\r\nclass SSequelUnit {\r\n constructor(entity, parallel, args) {\r\n this._entity = entity;\r\n this._parallel = parallel;\r\n this._args = args;\r\n }\r\n entity() {\r\n return this._entity;\r\n }\r\n isParallel() {\r\n return this._parallel;\r\n }\r\n args() {\r\n return this._args;\r\n }\r\n}\r\nexports.SSequelUnit = SSequelUnit;\r\nclass SMotionSequel extends SSequelUnit {\r\n constructor(entity, sequelId, targetX, targetY, args) {\r\n super(entity, MRData_1.MRData.sequels[sequelId].parallel, args);\r\n this._sequelId = sequelId;\r\n this._targetX = targetX;\r\n this._targetY = targetY;\r\n this._relatedSequels = [];\r\n }\r\n sequelId() {\r\n return this._sequelId;\r\n }\r\n data() {\r\n return MRData_1.MRData.sequels[this._sequelId];\r\n }\r\n setStartPosition(x, y) {\r\n this._startX = x;\r\n this._startY = y;\r\n }\r\n hasStartPosition() {\r\n return !!this._startX && !!this._startY;\r\n }\r\n startX() {\r\n (0, Common_1.assert)(this._startX !== undefined);\r\n return this._startX;\r\n }\r\n startY() {\r\n (0, Common_1.assert)(this._startY !== undefined);\r\n return this._startY;\r\n }\r\n targetX() {\r\n return this._targetX;\r\n }\r\n targetY() {\r\n return this._targetY;\r\n }\r\n isFluidSequence() {\r\n return this._relatedSequels.length > 0;\r\n }\r\n relatedSequels() {\r\n return this._relatedSequels;\r\n }\r\n addRelatedSequels(value) {\r\n this._relatedSequels.push(value);\r\n }\r\n}\r\nexports.SMotionSequel = SMotionSequel;\r\nclass SAnumationSequel extends SSequelUnit {\r\n constructor(entity, anumationlId, wait) {\r\n super(entity, !wait, undefined); // wait するときは parallel にしない。してしまうと、直後に post したメッセージなどが先に進んでしまう。\r\n this._anumationlId = anumationlId;\r\n this._isWait = wait;\r\n }\r\n anumationlId() {\r\n return this._anumationlId;\r\n }\r\n isWait() {\r\n return this._isWait;\r\n }\r\n}\r\nexports.SAnumationSequel = SAnumationSequel;\r\nclass SFloatingAnumationSequel extends SSequelUnit {\r\n constructor(entity, anumationlId, mx, my, wait) {\r\n super(entity, false, undefined);\r\n this.anumationlId = anumationlId;\r\n this.mx = mx;\r\n this.my = my;\r\n this._isWait = wait;\r\n }\r\n isWait() {\r\n return this._isWait;\r\n }\r\n}\r\nexports.SFloatingAnumationSequel = SFloatingAnumationSequel;\r\nclass SBalloonSequel extends SSequelUnit {\r\n constructor(entity, balloonId, wait) {\r\n super(entity, !wait, undefined); // wait するときは parallel にしない。してしまうと、直後に post したメッセージなどが先に進んでしまう。\r\n this._balloonId = balloonId;\r\n this._isWait = wait;\r\n }\r\n balloonId() {\r\n return this._balloonId;\r\n }\r\n isWait() {\r\n return this._isWait;\r\n }\r\n}\r\nexports.SBalloonSequel = SBalloonSequel;\r\nclass SWaitSequel extends SSequelUnit {\r\n constructor(entity, waitCount) {\r\n super(entity, true, undefined);\r\n this._waitCount = waitCount;\r\n }\r\n waitCount() {\r\n return this._waitCount;\r\n }\r\n}\r\nexports.SWaitSequel = SWaitSequel;\r\n// export class SFlavorEffect {\r\n// private _entity: LEntity;\r\n// private _parallel: boolean;\r\n// private _args: any | undefined;\r\n// constructor(entity: LEntity, parallel: boolean, args: any | undefined) {\r\n// this._entity = entity;\r\n// this._parallel = parallel;\r\n// this._args = args;\r\n// }\r\n// entity(): LEntity {\r\n// return this._entity;\r\n// }\r\n// isParallel(): boolean {\r\n// return this._parallel;\r\n// }\r\n// args(): any | undefined {\r\n// return this._args;\r\n// }\r\n// }\r\n/**\r\n * ある Entity に連続適用する Sequel のリスト。\r\n *\r\n * 倍速移動などで、複数の Sequel が追加されることがある。\r\n */\r\nclass SSequelClip {\r\n constructor(firstItem) {\r\n this._sequels = [firstItem];\r\n this.fastForward = MRLively_1.MRLively.mapView.isFastForward;\r\n }\r\n sequels() {\r\n return this._sequels;\r\n }\r\n entity() {\r\n return this._sequels[0].entity();\r\n }\r\n isParallel() {\r\n return this._sequels[0].isParallel();\r\n }\r\n hasMotionSeque() {\r\n return this._sequels.findIndex(s => (s instanceof SMotionSequel)) >= 0;\r\n }\r\n add(sequel) {\r\n // Needs marge?\r\n if (sequel instanceof SMotionSequel) {\r\n if (sequel.data().fluidSequence) {\r\n const s = this._sequels.find(x => (x instanceof SMotionSequel) && x.sequelId() == sequel.sequelId());\r\n if (s) {\r\n s.addRelatedSequels(sequel);\r\n return;\r\n }\r\n }\r\n }\r\n this._sequels.push(sequel);\r\n }\r\n}\r\nexports.SSequelClip = SSequelClip;\r\n/**\r\n * 並列実行の単位。同時実行できる RESequelClip はまとめてひとつの SequelRun に属する。\r\n */\r\nclass SSequelRun {\r\n constructor(firstItem) {\r\n this._clips = [new SSequelClip(firstItem)];\r\n }\r\n clips() {\r\n return this._clips;\r\n }\r\n isParallel() {\r\n return this._clips[0].isParallel();\r\n }\r\n hasMotionSeque() {\r\n return this._clips.findIndex(clip => clip.hasMotionSeque()) >= 0;\r\n }\r\n add(sequel) {\r\n (0, Common_1.assert)(sequel.isParallel() == this.isParallel());\r\n const index = this._clips.findIndex(x => x.entity() == sequel.entity());\r\n if (index < 0) {\r\n this._clips.push(new SSequelClip(sequel));\r\n }\r\n else {\r\n this._clips[index].add(sequel);\r\n }\r\n }\r\n}\r\nexports.SSequelRun = SSequelRun;\r\n/**\r\n * 一連のコマンドチェーン内で発生した Sequel を、並列実行などを考慮して整理して保持する。\r\n * その後 Visual レイヤーに渡り、アニメーションが実行される。\r\n */\r\nclass SSequelSet {\r\n constructor() {\r\n this._runs = [];\r\n this._allParallel = true;\r\n this._waitForAll = true;\r\n this._isEmpty = true;\r\n }\r\n runs() {\r\n return this._runs;\r\n }\r\n isAllParallel() {\r\n return this._allParallel;\r\n }\r\n isEmpty() {\r\n return this._isEmpty;\r\n }\r\n reset() {\r\n this._runs.splice(0);\r\n this._allParallel = true;\r\n this._isEmpty = true;\r\n this._waitForAll = false;\r\n }\r\n waitForAll() {\r\n this._waitForAll = true;\r\n }\r\n isWaitForAll() {\r\n return this._waitForAll;\r\n }\r\n addSequel(sequel) {\r\n let newRun = false;\r\n if (this._runs.length == 0) {\r\n // 初回\r\n newRun = true;\r\n }\r\n else if (!sequel.isParallel()) {\r\n // 並列実行しないものは新しい Run へ追加する\r\n newRun = true;\r\n }\r\n else {\r\n const lastRun = this._runs[this._runs.length - 1];\r\n if (!lastRun.isParallel()) {\r\n // 並列 Sequel を追加しようとしたが、追加済みの終端は非並列だった。\r\n // 新しい Run へ追加する。\r\n newRun = true;\r\n }\r\n else {\r\n // 並列 Sequel が連続\r\n }\r\n }\r\n if (newRun) {\r\n this._runs.push(new SSequelRun(sequel));\r\n }\r\n else {\r\n this._runs[this._runs.length - 1].add(sequel);\r\n }\r\n if (!sequel.isParallel()) {\r\n this._allParallel = false;\r\n }\r\n this._isEmpty = false;\r\n }\r\n}\r\nexports.SSequelSet = SSequelSet;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/SSequel.ts?"); /***/ }), /***/ "./ts/mr/system/SSequelContext.ts": /*!****************************************!*\ !*** ./ts/mr/system/SSequelContext.ts ***! \****************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SSequelContext = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst SSequel_1 = __webpack_require__(/*! ts/mr/system/SSequel */ \"./ts/mr/system/SSequel.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ./MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nclass SSequelContext {\r\n constructor() {\r\n this._sequelSet = new SSequel_1.SSequelSet();\r\n this.trapPerforming = false;\r\n }\r\n clear() {\r\n this._sequelSet = new SSequel_1.SSequelSet();\r\n }\r\n isEmptySequelSet() {\r\n return this._sequelSet.isEmpty();\r\n }\r\n // public isMoveOnly(): boolean {\r\n // for (const run of this._sequelSet.runs()) {\r\n // for (const clip of run.clips()) {\r\n // for (const s of clip.sequels()) {\r\n // if (s instanceof SMotionSequel && s.sequelId() == MRBasics.sequels.MoveSequel) {\r\n // }\r\n // else {\r\n // return false;\r\n // }\r\n // }\r\n // }\r\n // }\r\n // return true;\r\n // }\r\n attemptFlush(force) {\r\n // 攻撃などのメジャーアクションで同期的 Sequel が post されていれば flush.\r\n // もし歩行など並列のみであればあとでまとめて実行したので不要。\r\n if (!this._sequelSet.isAllParallel() || force) {\r\n this.flushSequelSet(false);\r\n }\r\n }\r\n addSequel(sequel) {\r\n this._sequelSet.addSequel(sequel);\r\n }\r\n flushSequelSet(waitForAll) {\r\n Common_1.Log.d(\"[FlushSequel]\");\r\n if (!this.isEmptySequelSet()) {\r\n if (MRLively_1.MRLively.signalFlushSequelSet) {\r\n MRLively_1.MRLively.signalFlushSequelSet(this._sequelSet);\r\n }\r\n if (waitForAll) {\r\n this._sequelSet.waitForAll();\r\n }\r\n MRSystem_1.MRSystem.integration.flushSequelSet(this._sequelSet);\r\n this._sequelSet = new SSequel_1.SSequelSet();\r\n }\r\n }\r\n}\r\nexports.SSequelContext = SSequelContext;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/SSequelContext.ts?"); /***/ }), /***/ "./ts/mr/system/SSoundManager.ts": /*!***************************************!*\ !*** ./ts/mr/system/SSoundManager.ts ***! \***************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SSoundManager = void 0;\r\nclass SSoundManager {\r\n static playSystemSound(n) {\r\n if (typeof SoundManager !== 'undefined') {\r\n SoundManager.playSystemSound(n);\r\n }\r\n }\r\n static playBgm(sound) {\r\n if (typeof SoundManager !== 'undefined') {\r\n AudioManager.playBgm(sound, 0);\r\n }\r\n }\r\n static playSe(sound) {\r\n if (typeof SoundManager !== 'undefined') {\r\n AudioManager.playSe(sound);\r\n }\r\n }\r\n static playEquip() {\r\n this.playSystemSound(4);\r\n }\r\n static playMiss() {\r\n this.playSystemSound(17);\r\n }\r\n ;\r\n static playPickItem() {\r\n this.playSe({ name: \"Item1\", volume: 80, pitch: 100, pan: 0 });\r\n }\r\n static playLevelUp() {\r\n this.playSe({ name: \"Item3\", volume: 80, pitch: 100, pan: 0 });\r\n }\r\n}\r\nexports.SSoundManager = SSoundManager;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/SSoundManager.ts?"); /***/ }), /***/ "./ts/mr/system/SStateFactory.ts": /*!***************************************!*\ !*** ./ts/mr/system/SStateFactory.ts ***! \***************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SStateFactory = void 0;\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LGenericRMMZStateBehavior_1 = __webpack_require__(/*! ts/mr/lively/states/LGenericRMMZStateBehavior */ \"./ts/mr/lively/states/LGenericRMMZStateBehavior.ts\");\r\nconst LState_1 = __webpack_require__(/*! ts/mr/lively/states/LState */ \"./ts/mr/lively/states/LState.ts\");\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst internal_1 = __webpack_require__(/*! ./internal */ \"./ts/mr/system/internal.ts\");\r\nclass SStateFactory {\r\n static newState(stateId) {\r\n const state = new LState_1.LState();\r\n state.setup(stateId);\r\n const behavior = new LGenericRMMZStateBehavior_1.LGenericRMMZStateBehavior();\r\n MRLively_1.MRLively.world._registerObject(behavior);\r\n //const behabiors: LStateTraitBehavior[] = [behavior];\r\n const behabiors = [behavior];\r\n for (const behavior of state.stateEffect().behaviors) {\r\n (0, Common_1.assert)(!behavior.props); // 未サポート\r\n const b = internal_1.SBehaviorManager.createBehavior(behavior.data.fullName); // as LStateTraitBehavior;\r\n if (!b)\r\n throw new Error(`Behavior \"${behavior.data.fullName}\" specified in state \"${stateId}:${state.stateData().displayName}\" is invalid.`);\r\n behabiors.push(b);\r\n }\r\n for (const b of behabiors) {\r\n b.setParent(state);\r\n }\r\n state._stateBehabiors = behabiors.map(x => x.id());\r\n return state;\r\n }\r\n}\r\nexports.SStateFactory = SStateFactory;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/SStateFactory.ts?"); /***/ }), /***/ "./ts/mr/system/STurnContext.ts": /*!**************************************!*\ !*** ./ts/mr/system/STurnContext.ts ***! \**************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.STurnContext = void 0;\r\n/**\r\n * 手番に関係するタイミング通知を受けた処理を明確に定義するためのクラス。\r\n *\r\n *\r\n */\r\nclass STurnContext {\r\n}\r\nexports.STurnContext = STurnContext;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/STurnContext.ts?"); /***/ }), /***/ "./ts/mr/system/SView.ts": /*!*******************************!*\ !*** ./ts/mr/system/SView.ts ***! \*******************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SView = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst DState_1 = __webpack_require__(/*! ts/mr/data/DState */ \"./ts/mr/data/DState.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LIllusionStateBehavior_1 = __webpack_require__(/*! ts/mr/lively/states/LIllusionStateBehavior */ \"./ts/mr/lively/states/LIllusionStateBehavior.ts\");\r\nconst LUnitBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LUnitBehavior */ \"./ts/mr/lively/behaviors/LUnitBehavior.ts\");\r\nconst LTrapBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LTrapBehavior */ \"./ts/mr/lively/behaviors/LTrapBehavior.ts\");\r\nconst USearch_1 = __webpack_require__(/*! ../utility/USearch */ \"./ts/mr/utility/USearch.ts\");\r\nconst Helpers_1 = __webpack_require__(/*! ./Helpers */ \"./ts/mr/system/Helpers.ts\");\r\nconst LExitPointBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LExitPointBehavior */ \"./ts/mr/lively/behaviors/LExitPointBehavior.ts\");\r\n/**\r\n * 試験運用中。\r\n *\r\n * すべて Behavior で賄おうとしていたが、パフォーマンスの影響と複雑化を考慮し、\r\n * ボトムアップだけの方法ではなくトップダウンで固有の機能を実現する手段を入れてみる。\r\n */\r\nclass SView {\r\n // subject から見た entity はどのように見えるのか?\r\n static getLookNames(subject, entity) {\r\n if (!subject.entityId().equals(entity.entityId())) {\r\n if (entity.findEntityBehavior(LUnitBehavior_1.LUnitBehavior)) {\r\n if (subject.states.find(s => s.stateEffect().restriction == DState_1.DStateRestriction.Blind)) {\r\n return {\r\n name: (0, Common_1.tr2)(\"なにものか\"),\r\n iconIndex: 0,\r\n upgrades: 0,\r\n };\r\n }\r\n // まどわし状態\r\n if (subject.collectBehaviors().find(s => s instanceof LIllusionStateBehavior_1.LIllusionStateBehavior)) {\r\n return {\r\n name: (0, Common_1.tr2)(\"???\"),\r\n iconIndex: 0,\r\n upgrades: 0,\r\n };\r\n }\r\n }\r\n }\r\n return entity.getDisplayName();\r\n }\r\n static getTilemapView() {\r\n const subject = MRLively_1.MRLively.mapView.focusedEntity();\r\n if (subject) {\r\n if (subject.states.find(s => s.stateEffect().restriction == DState_1.DStateRestriction.Blind)) {\r\n return {\r\n visible: false,\r\n tilesetId: 0,\r\n };\r\n }\r\n }\r\n return { visible: true, tilesetId: undefined };\r\n }\r\n static getMinimapVisibility(entity) {\r\n const subject = MRLively_1.MRLively.mapView.focusedEntity();\r\n // if (!entity.floorId.equals(REGame.map.floorId())) {\r\n // return { visible: false, translucent: false };\r\n // }\r\n if (subject && !subject.entityId().equals(entity.entityId())) {\r\n // entity は操作中キャラ以外\r\n // // subject が目つぶし状態なら見えない\r\n // if (subject.states().find(s => s.stateEffect().restriction == DStateRestriction.Blind)) {\r\n // return { visible: false, translucent: false };\r\n // }\r\n // // entity が透明状態なら見えない\r\n // //if (entity.traits(REBasics.traits.Invisible).length > 0) {\r\n // if (!USearch.isVisibleFromSubject(subject, entity)) {\r\n // return { visible: false, translucent: false };\r\n // }\r\n // // entity が露出していない罠なら見えない\r\n // const trap = entity.findEntityBehavior(LTrapBehavior);\r\n // if (trap) {\r\n // if (!trap.isExposedFor(subject)) {\r\n // return { visible: false, translucent: false };\r\n // }\r\n // }\r\n // 見えないものを先にはじく\r\n if (this.checkEntityInvisible(subject, entity)) {\r\n return { visible: false, translucent: false };\r\n }\r\n // 次に見えるべきをチェック\r\n if (!this.checkEntityVisible(subject, entity)) {\r\n return { visible: false, translucent: false };\r\n }\r\n // if (!Helpers.isHostile(subject, entity)) {\r\n // const targetBlock = REGame.map.block(entity.mx, entity.my);\r\n // // 中立 target は、踏破済みの Block 上なら見える\r\n // if (!targetBlock._passed) {\r\n // return { visible: false, translucent: false };\r\n // }\r\n // }\r\n // else if (UMovement.checkAdjacentEntities(subject, entity)) {\r\n // // 隣接している相手は、基本的に見える\r\n // }\r\n // else {\r\n // // 部屋内?\r\n // if (subject.isOnRoom()) {\r\n // if (subject.roomId() != entity.roomId()) {\r\n // return { visible: false, translucent: false };\r\n // }\r\n // }\r\n // else {\r\n // }\r\n // }\r\n // subject が惑わし状態?\r\n if (subject.collectBehaviors().find(s => s instanceof LIllusionStateBehavior_1.LIllusionStateBehavior)) {\r\n if (entity.findEntityBehavior(LUnitBehavior_1.LUnitBehavior)) {\r\n return { visible: true, translucent: false, image: MRData_1.MRData.prefabs[MRBasics_1.MRBasics.prefabs.illusionActor].image };\r\n }\r\n else {\r\n return { visible: true, translucent: false, image: MRData_1.MRData.prefabs[MRBasics_1.MRBasics.prefabs.illusionItem].image };\r\n }\r\n }\r\n }\r\n else {\r\n // entity は操作中キャラ (自分自身は基本的に見える)\r\n // 透明状態\r\n if (entity.traits(MRBasics_1.MRBasics.traits.Invisible).length > 0) {\r\n return { visible: true, translucent: true };\r\n }\r\n }\r\n return { visible: true, translucent: false };\r\n }\r\n /**\r\n * subject から entity が可視であるか。\r\n *\r\n * 基本的にプレイヤーから見た視界の表示で使用する。\r\n * AI 用の視界判定処理とは微妙に異なるので注意。\r\n * 例えば、部屋の外であっても、一度通過したブロックにあるアイテムは可視である。\r\n *\r\n * ミニマップの処理とも微妙に違う点に注意。\r\n * 影無しフロアでは、ミニマップには表示されないが、タイルマップ上に表示されるものもある。\r\n * つまり、基本的にミニマップ表示判定よりもタイルマップ表示判定の方が強い。\r\n */\r\n static getEntityVisibility(entity) {\r\n return this.getMinimapVisibility(entity);\r\n }\r\n /** 見えなくなる条件をチェックする */\r\n static checkEntityInvisible(subject, target) {\r\n // 自分自身は常に見える\r\n //if (subject.entityId().equals(target.entityId())) return true;\r\n // subject が目つぶし状態なら見えない\r\n if (USearch_1.USearch.hasBlindness(subject))\r\n return true;\r\n // target が透明状態\r\n if (!USearch_1.USearch.isVisibleFromSubject(subject, target))\r\n return true;\r\n // target が露出していない罠なら見えない\r\n const trap = target.findEntityBehavior(LTrapBehavior_1.LTrapBehavior);\r\n if (trap) {\r\n if (!trap.isExposedFor(subject)) {\r\n return true;\r\n }\r\n }\r\n // 見える\r\n return false;\r\n }\r\n /** 見える条件をチェックする */\r\n static checkEntityVisible(subject, target) {\r\n // 自分自身は常に見える\r\n //if (subject.entityId().equals(target.entityId())) return true;\r\n //if (REGame.map.unitClarity) return true;\r\n const map = MRLively_1.MRLively.mapView.currentMap;\r\n // あかりの巻物など、フロア自体に可視効果がある\r\n if (map.unitClarity) {\r\n if (target.isUnit()) {\r\n return true;\r\n }\r\n }\r\n if (map.itemClarity) {\r\n if (this.isItem(target)) {\r\n return true;\r\n }\r\n }\r\n // 味方は常に視認可能\r\n if (Helpers_1.Helpers.isFriend(subject, target)) {\r\n return true;\r\n }\r\n // 中立 target は、踏破済みの Block 上なら見える\r\n if (!Helpers_1.Helpers.isHostile(subject, target)) {\r\n const targetBlock = MRLively_1.MRLively.mapView.currentMap.block(target.mx, target.my);\r\n if (targetBlock._passed) {\r\n return true;\r\n }\r\n }\r\n // 地形やマップの状態的に見える\r\n if (USearch_1.USearch.checkInSightEntity(subject, target)) {\r\n return true;\r\n }\r\n // 見えない\r\n return false;\r\n }\r\n static isItem(entity) {\r\n if (!!entity.data.itemData) {\r\n if (!entity.findEntityBehavior(LExitPointBehavior_1.LExitPointBehavior)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\nexports.SView = SView;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/SView.ts?"); /***/ }), /***/ "./ts/mr/system/dialogs/SActivityPlaybackDialog.ts": /*!*********************************************************!*\ !*** ./ts/mr/system/dialogs/SActivityPlaybackDialog.ts ***! \*********************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SActivityPlaybackDialog = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst SDialog_1 = __webpack_require__(/*! ts/mr/system/SDialog */ \"./ts/mr/system/SDialog.ts\");\r\n/**\r\n * Playback 中に他の Dialog の代用となる特殊な Dialog.\r\n */\r\nclass SActivityPlaybackDialog extends SDialog_1.SDialog {\r\n isVisualIntegration() {\r\n return false;\r\n }\r\n onUpdate(context) {\r\n (0, Common_1.assert)(MRLively_1.MRLively.recorder.isPlayback());\r\n if (!MRLively_1.MRLively.recorder.runPlaybackCommand(this)) {\r\n MRLively_1.MRLively.recorder.restartRecording();\r\n }\r\n this.submit();\r\n }\r\n}\r\nexports.SActivityPlaybackDialog = SActivityPlaybackDialog;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/dialogs/SActivityPlaybackDialog.ts?"); /***/ }), /***/ "./ts/mr/system/dialogs/SCommonCommand.ts": /*!************************************************!*\ !*** ./ts/mr/system/dialogs/SCommonCommand.ts ***! \************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SCommonCommand = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst LActivity_1 = __webpack_require__(/*! ts/mr/lively/activities/LActivity */ \"./ts/mr/lively/activities/LActivity.ts\");\r\nconst UAction_1 = __webpack_require__(/*! ts/mr/utility/UAction */ \"./ts/mr/utility/UAction.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ../MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst SItemSelectionDialog_1 = __webpack_require__(/*! ./SItemSelectionDialog */ \"./ts/mr/system/dialogs/SItemSelectionDialog.ts\");\r\nclass SCommonCommand {\r\n static handleAction(dialog, actor, inventory, item, actionId) {\r\n if (UAction_1.UAction.checkItemSelectionRequired(item, actionId)) {\r\n // 対象アイテムの選択が必要\r\n const model = new SItemSelectionDialog_1.SItemSelectionDialog(actor, inventory, false);\r\n dialog.openSubDialog(model, (result) => {\r\n if (result.isSubmitted) {\r\n const target = model.selectedSingleEntity();\r\n (0, Common_1.assert)(target);\r\n const activity = (new LActivity_1.LActivity).setup(actionId, actor, item, actor.dir);\r\n activity.setObjects2([target]);\r\n MRSystem_1.MRSystem.dialogContext.postActivity(activity);\r\n }\r\n else {\r\n //this.activateCommandWindow();\r\n }\r\n return false;\r\n });\r\n }\r\n else {\r\n const activity = (new LActivity_1.LActivity).setup(actionId, actor, item, actor.dir);\r\n MRSystem_1.MRSystem.dialogContext.postActivity(activity);\r\n dialog.submit();\r\n }\r\n }\r\n}\r\nexports.SCommonCommand = SCommonCommand;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/dialogs/SCommonCommand.ts?"); /***/ }), /***/ "./ts/mr/system/dialogs/SDetailsDialog.ts": /*!************************************************!*\ !*** ./ts/mr/system/dialogs/SDetailsDialog.ts ***! \************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SDetailsDialog = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst LIdentifyer_1 = __webpack_require__(/*! ts/mr/lively/LIdentifyer */ \"./ts/mr/lively/LIdentifyer.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst UName_1 = __webpack_require__(/*! ts/mr/utility/UName */ \"./ts/mr/utility/UName.ts\");\r\nconst SDialog_1 = __webpack_require__(/*! ../SDialog */ \"./ts/mr/system/SDialog.ts\");\r\nclass SDetailsDialog extends SDialog_1.SDialog {\r\n constructor(entity) {\r\n super();\r\n this._entity = entity;\r\n this.descriptions = [];\r\n this._entity.iterateBehaviors2((b) => {\r\n b.onGetDescriptions(this.descriptions);\r\n return true;\r\n });\r\n }\r\n entity() {\r\n return this._entity;\r\n }\r\n get summary() {\r\n return UName_1.UName.makeNameAsItem(this._entity);\r\n }\r\n get description() {\r\n const subject = MRLively_1.MRLively.mapView.focusedEntity();\r\n (0, Common_1.assert)(subject);\r\n if (MRLively_1.MRLively.getCurrentIdentifyer().getEntityIdentificationLevel(subject, this._entity) == LIdentifyer_1.EntityIdentificationLevel.Unidentified) {\r\n return (0, Common_1.tr2)(\"このアイテムは識別されていません。\");\r\n }\r\n else {\r\n return this._entity.data.description;\r\n }\r\n }\r\n}\r\nexports.SDetailsDialog = SDetailsDialog;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/dialogs/SDetailsDialog.ts?"); /***/ }), /***/ "./ts/mr/system/dialogs/SDialogCommand.ts": /*!************************************************!*\ !*** ./ts/mr/system/dialogs/SDialogCommand.ts ***! \************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SDialogCommand = exports.SDialogSystemCommand = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nvar SDialogSystemCommand;\r\n(function (SDialogSystemCommand) {\r\n SDialogSystemCommand[\"SetShortcutSet\"] = \"SetShortcutSet\";\r\n SDialogSystemCommand[\"UnsetShortcutSet\"] = \"UnsetShortcutSet\";\r\n SDialogSystemCommand[\"Peek\"] = \"Peek\";\r\n SDialogSystemCommand[\"PutIn\"] = \"PutIn\";\r\n SDialogSystemCommand[\"PickOut\"] = \"PickOut\";\r\n})(SDialogSystemCommand = exports.SDialogSystemCommand || (exports.SDialogSystemCommand = {}));\r\n/**\r\n * UI のコマンドリストなどに表示するアクションアイテム。\r\n * QAction のようなもの。\r\n */\r\nclass SDialogCommand {\r\n constructor() {\r\n this._displayName = \"\";\r\n this._actionId = 0;\r\n }\r\n static makeActivityCommand(actionId, displayName, handler) {\r\n const cmd = new SDialogCommand();\r\n cmd._displayName = displayName !== null && displayName !== void 0 ? displayName : MRData_1.MRData.skills[actionId].name;\r\n cmd._actionId = actionId;\r\n cmd._activityCommandHandler = handler;\r\n return cmd;\r\n }\r\n static makeSystemCommand(displayName, systemCommandId, handler) {\r\n const cmd = new SDialogCommand();\r\n cmd._displayName = displayName;\r\n cmd._systemCommandId = systemCommandId;\r\n cmd._systemCommandIdHandler = handler;\r\n return cmd;\r\n }\r\n get displayName() {\r\n return this._displayName;\r\n }\r\n get isActivityCommand() {\r\n return this._actionId != 0;\r\n }\r\n get actionId() {\r\n return this._actionId;\r\n }\r\n get activityCommandHandler() {\r\n (0, Common_1.assert)(this._activityCommandHandler);\r\n return this._activityCommandHandler;\r\n }\r\n get isSystemCommand() {\r\n return this._systemCommandId !== undefined;\r\n }\r\n get systemCommandId() {\r\n (0, Common_1.assert)(this._systemCommandId !== undefined);\r\n return this._systemCommandId;\r\n }\r\n get systemCommandIdHandler() {\r\n (0, Common_1.assert)(this._systemCommandIdHandler);\r\n return this._systemCommandIdHandler;\r\n }\r\n execute() {\r\n if (this._activityCommandHandler) {\r\n this._activityCommandHandler(this._actionId);\r\n }\r\n else if (this._systemCommandIdHandler) {\r\n this._systemCommandIdHandler(this.systemCommandId);\r\n }\r\n else {\r\n throw new Error(\"Unreachable.\");\r\n }\r\n }\r\n}\r\nexports.SDialogCommand = SDialogCommand;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/dialogs/SDialogCommand.ts?"); /***/ }), /***/ "./ts/mr/system/dialogs/SEventExecutionDialog.ts": /*!*******************************************************!*\ !*** ./ts/mr/system/dialogs/SEventExecutionDialog.ts ***! \*******************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SEventExecutionDialog = void 0;\r\nconst SDialog_1 = __webpack_require__(/*! ts/mr/system/SDialog */ \"./ts/mr/system/SDialog.ts\");\r\nclass SEventExecutionDialog extends SDialog_1.SDialog {\r\n constructor(rmmzEventId, owner, player) {\r\n super();\r\n this.owner = owner;\r\n this.player = player;\r\n this._rmmzEventId = rmmzEventId;\r\n this.billingPrice = 0;\r\n this.depositPrice = 0;\r\n }\r\n /** @deprecated */\r\n rmmzEventId() {\r\n return this._rmmzEventId;\r\n }\r\n get rmmzEvent() {\r\n const spawner = this.owner.getUniqueSpawner();\r\n if (!spawner)\r\n return undefined;\r\n if (spawner.overrideRmmzEventMapId != $gameMap.mapId())\r\n return undefined;\r\n return $gameMap.event(spawner.overrideRmmzEventId);\r\n }\r\n}\r\nexports.SEventExecutionDialog = SEventExecutionDialog;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/dialogs/SEventExecutionDialog.ts?"); /***/ }), /***/ "./ts/mr/system/dialogs/SFeetDialog.ts": /*!*********************************************!*\ !*** ./ts/mr/system/dialogs/SFeetDialog.ts ***! \*********************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SFeetDialog = void 0;\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst LInventoryBehavior_1 = __webpack_require__(/*! ts/mr/lively/entity/LInventoryBehavior */ \"./ts/mr/lively/entity/LInventoryBehavior.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst SDialog_1 = __webpack_require__(/*! ../SDialog */ \"./ts/mr/system/SDialog.ts\");\r\nconst SCommonCommand_1 = __webpack_require__(/*! ./SCommonCommand */ \"./ts/mr/system/dialogs/SCommonCommand.ts\");\r\nconst SDialogCommand_1 = __webpack_require__(/*! ./SDialogCommand */ \"./ts/mr/system/dialogs/SDialogCommand.ts\");\r\nconst SItemListDialog_1 = __webpack_require__(/*! ./SItemListDialog */ \"./ts/mr/system/dialogs/SItemListDialog.ts\");\r\nclass SFeetDialog extends SDialog_1.SDialog {\r\n constructor(actorEntity, targetEntity) {\r\n super();\r\n this._actorEntityId = actorEntity.entityId();\r\n this._itemEntityId = targetEntity.entityId();\r\n }\r\n get actor() {\r\n return MRLively_1.MRLively.world.entity(this._actorEntityId);\r\n }\r\n get item() {\r\n return MRLively_1.MRLively.world.entity(this._itemEntityId);\r\n }\r\n makeActionList() {\r\n const item = this.item;\r\n const actor = this.actor;\r\n let commands = [];\r\n // itemEntity が受け取れる Action を、actor が実行できる Action でフィルタすると、\r\n // 実際に実行できる Action のリストができる。\r\n const actions = actor.queryActions();\r\n const reactions = item.queryReactions();\r\n const actualActions = reactions\r\n .filter(x => actions.includes(x.actionId))\r\n .distinctObjects(x => x.actionId);\r\n // [撃つ] があれば [投げる] を除く\r\n {\r\n if (!!actualActions.find(x => x.actionId == MRBasics_1.MRBasics.actions.ShootActionId)) {\r\n actualActions.mutableRemove(x => x.actionId == MRBasics_1.MRBasics.actions.ThrowActionId);\r\n }\r\n }\r\n commands = commands.concat(SItemListDialog_1.SItemListDialog.normalizeActionList(actualActions)\r\n .map(a => SDialogCommand_1.SDialogCommand.makeActivityCommand(a.actionId, a.displayName, _ => this.handleAction(a.actionId))));\r\n return commands;\r\n }\r\n handleAction(actionId) {\r\n SCommonCommand_1.SCommonCommand.handleAction(this, this.actor, this.actor.getEntityBehavior(LInventoryBehavior_1.LInventoryBehavior), this.item, actionId);\r\n }\r\n}\r\nexports.SFeetDialog = SFeetDialog;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/dialogs/SFeetDialog.ts?"); /***/ }), /***/ "./ts/mr/system/dialogs/SInventoryDialogBase.ts": /*!******************************************************!*\ !*** ./ts/mr/system/dialogs/SInventoryDialogBase.ts ***! \******************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SInventoryDialogBase = void 0;\r\nconst SDialog_1 = __webpack_require__(/*! ../SDialog */ \"./ts/mr/system/SDialog.ts\");\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nclass SInventoryDialogBase extends SDialog_1.SDialog {\r\n constructor(inventory) {\r\n super();\r\n this.inventoryOwner = inventory.ownerEntity();\r\n this.inventory = inventory;\r\n //this.canMultiSelect = canMultiSelect;\r\n this._focusedEntity = undefined;\r\n this._selectedEntities = [];\r\n this._multiSelectMode = false;\r\n this._items = this.inventory.items;\r\n this.multipleSelectionEnabled = false;\r\n }\r\n get items() {\r\n return this._items;\r\n }\r\n get isMultiSelectMode() {\r\n return this._multiSelectMode;\r\n }\r\n canMultiSelect() {\r\n return false;\r\n }\r\n /** カーソル位置の Item */\r\n focusedEntity() {\r\n (0, Common_1.assert)(this._focusedEntity);\r\n return this._focusedEntity;\r\n }\r\n selectedSingleEntity() {\r\n (0, Common_1.assert)(!this._multiSelectMode);\r\n (0, Common_1.assert)(this._selectedEntities.length == 1);\r\n (0, Common_1.assert)(this._selectedEntities[0]);\r\n return this._selectedEntities[0];\r\n }\r\n selectedEntities() {\r\n return this._selectedEntities;\r\n }\r\n /** View でカーソル位置が変わった時に呼び出す。 */\r\n focusEntity(entity) {\r\n this._focusedEntity = entity;\r\n if (!this.isMultiSelectMode) {\r\n this._selectedEntities[0] = entity;\r\n }\r\n }\r\n getItemSelectedIndex(entity) {\r\n return this._selectedEntities.indexOf(entity);\r\n }\r\n toggleMultipeSelection() {\r\n if (this._focusedEntity) {\r\n if (!this._multiSelectMode) {\r\n // 最初に複数選択されて、複数選択モードに入る場合は [0] を維持する\r\n this._multiSelectMode = true;\r\n }\r\n else {\r\n // if (this._selectedEntities.length == 0)\r\n // \r\n if (this._selectedEntities.includes(this._focusedEntity)) {\r\n this._selectedEntities.mutableRemove(x => x == this._focusedEntity);\r\n }\r\n else {\r\n this._selectedEntities.push(this._focusedEntity);\r\n }\r\n this._multiSelectMode = this._selectedEntities.length > 0;\r\n }\r\n }\r\n }\r\n}\r\nexports.SInventoryDialogBase = SInventoryDialogBase;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/dialogs/SInventoryDialogBase.ts?"); /***/ }), /***/ "./ts/mr/system/dialogs/SItemListDialog.ts": /*!*************************************************!*\ !*** ./ts/mr/system/dialogs/SItemListDialog.ts ***! \*************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SItemListDialog = exports.SItemListDialogSourceAction = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst LActivity_1 = __webpack_require__(/*! ts/mr/lively/activities/LActivity */ \"./ts/mr/lively/activities/LActivity.ts\");\r\nconst LEquipmentUserBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LEquipmentUserBehavior */ \"./ts/mr/lively/behaviors/LEquipmentUserBehavior.ts\");\r\nconst LInventoryBehavior_1 = __webpack_require__(/*! ts/mr/lively/entity/LInventoryBehavior */ \"./ts/mr/lively/entity/LInventoryBehavior.ts\");\r\nconst LStorageBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LStorageBehavior */ \"./ts/mr/lively/behaviors/LStorageBehavior.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ../MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst SCommonCommand_1 = __webpack_require__(/*! ./SCommonCommand */ \"./ts/mr/system/dialogs/SCommonCommand.ts\");\r\nconst SDialogCommand_1 = __webpack_require__(/*! ./SDialogCommand */ \"./ts/mr/system/dialogs/SDialogCommand.ts\");\r\nconst SItemSelectionDialog_1 = __webpack_require__(/*! ./SItemSelectionDialog */ \"./ts/mr/system/dialogs/SItemSelectionDialog.ts\");\r\nconst SInventoryDialogBase_1 = __webpack_require__(/*! ./SInventoryDialogBase */ \"./ts/mr/system/dialogs/SInventoryDialogBase.ts\");\r\nvar SItemListDialogSourceAction;\r\n(function (SItemListDialogSourceAction) {\r\n SItemListDialogSourceAction[SItemListDialogSourceAction[\"Default\"] = 0] = \"Default\";\r\n SItemListDialogSourceAction[SItemListDialogSourceAction[\"Peek\"] = 1] = \"Peek\";\r\n})(SItemListDialogSourceAction = exports.SItemListDialogSourceAction || (exports.SItemListDialogSourceAction = {}));\r\nclass SItemListDialog extends SInventoryDialogBase_1.SInventoryDialogBase {\r\n constructor(actorEntity, inventory, sourceAction) {\r\n super(inventory);\r\n this._actorEntityId = actorEntity.entityId();\r\n this.sourceAction = sourceAction;\r\n }\r\n get actor() {\r\n return MRLively_1.MRLively.world.entity(this._actorEntityId);\r\n }\r\n makeActionList() {\r\n return (!this.isMultiSelectMode) ?\r\n this.makeActionList_SingleSelected() :\r\n this.makeActionList_MultiSelected();\r\n }\r\n makeActionList_SingleSelected() {\r\n const item = this.selectedSingleEntity();\r\n // SafetyMap など、ダンジョンマップ以外では ActionList を生成しない\r\n if (!MRLively_1.MRLively.mapView.currentMap.floorId().isTacticsMap2) {\r\n return [];\r\n }\r\n const actor = this.actor;\r\n let commands = [];\r\n if (this.sourceAction == SItemListDialogSourceAction.Peek) {\r\n commands.push(SDialogCommand_1.SDialogCommand.makeSystemCommand((0, Common_1.tr2)(\"取り出す\"), SDialogCommand_1.SDialogSystemCommand.PickOut, _ => this.handlePickOut()));\r\n }\r\n else {\r\n if (item.findEntityBehavior(LStorageBehavior_1.LStorageBehavior)) {\r\n commands.push(SDialogCommand_1.SDialogCommand.makeSystemCommand((0, Common_1.tr2)(\"見る\"), SDialogCommand_1.SDialogSystemCommand.Peek, _ => this.handlePeek()));\r\n commands.push(SDialogCommand_1.SDialogCommand.makeSystemCommand((0, Common_1.tr2)(\"入れる\"), SDialogCommand_1.SDialogSystemCommand.PutIn, _ => this.handlePutIn()));\r\n }\r\n }\r\n if (item.data.shortcut) {\r\n const equipments = actor.getEntityBehavior(LEquipmentUserBehavior_1.LEquipmentUserBehavior);\r\n const shorcutItem = equipments.shortcutItem;\r\n if (shorcutItem && shorcutItem == item) {\r\n commands.push(SDialogCommand_1.SDialogCommand.makeSystemCommand((0, Common_1.tr2)(\"はずす\"), SDialogCommand_1.SDialogSystemCommand.UnsetShortcutSet, _ => this.handleShortcutUnset()));\r\n }\r\n else {\r\n commands.push(SDialogCommand_1.SDialogCommand.makeSystemCommand((0, Common_1.tr2)(\"セット\"), SDialogCommand_1.SDialogSystemCommand.SetShortcutSet, _ => this.handleShortcutSet()));\r\n }\r\n }\r\n // itemEntity が受け取れる Action を、actor が実行できる Action でフィルタすると、\r\n // 実際に実行できる Action のリストができる。\r\n const actions = actor.queryActions();\r\n const reactions = item.queryReactions();\r\n const actualActions = reactions\r\n .filter(x => actions.includes(x.actionId))\r\n .distinctObjects(x => x.actionId);\r\n // コマンドカスタマイズ。\r\n // ここで行うのはあくまで見た目に関係するもの。\r\n // Actor や Item が性質として持っている ActionList と、実際に UI からどれを選択できるようにするかは別物なので、\r\n // 例えば「Item に非表示 Action を持たせる」みたいな案があったが、それはやっぱりおかしいだろう。\r\n // 操作性はタイトルとして決める。そしてタイトルごとに大きく変えるべきは View。なのでここで対応してみる。\r\n {\r\n // [装備] [はずす] チェック\r\n {\r\n const equipments = actor.getEntityBehavior(LEquipmentUserBehavior_1.LEquipmentUserBehavior);\r\n if (equipments.isEquipped(item))\r\n actualActions.mutableRemove(x => x.actionId == MRBasics_1.MRBasics.actions.EquipActionId); // [装備] を除く\r\n else\r\n actualActions.mutableRemove(x => x.actionId == MRBasics_1.MRBasics.actions.EquipOffActionId); // [はずす] を除く\r\n }\r\n // 足元に何かあれば [置く] を [交換] にする\r\n {\r\n const feetEntity = MRLively_1.MRLively.mapView.currentMap.firstFeetEntity(actor);\r\n if (feetEntity) {\r\n if (actualActions.mutableRemove(x => x.actionId == MRBasics_1.MRBasics.actions.PutActionId)) {\r\n actualActions.push({ actionId: MRBasics_1.MRBasics.actions.ExchangeActionId });\r\n }\r\n }\r\n }\r\n // [撃つ] があれば [投げる] を除く\r\n {\r\n if (!!actualActions.find(x => x.actionId == MRBasics_1.MRBasics.actions.ShootActionId)) {\r\n actualActions.mutableRemove(x => x.actionId == MRBasics_1.MRBasics.actions.ThrowActionId);\r\n }\r\n }\r\n }\r\n commands = commands.concat(SItemListDialog.normalizeActionList(actualActions)\r\n .map(a => SDialogCommand_1.SDialogCommand.makeActivityCommand(a.actionId, a.displayName, _ => this.handleAction(a.actionId))));\r\n return commands;\r\n }\r\n makeActionList_MultiSelected() {\r\n let commands = [];\r\n if (this.sourceAction == SItemListDialogSourceAction.Peek) {\r\n commands.push(SDialogCommand_1.SDialogCommand.makeSystemCommand((0, Common_1.tr2)(\"取り出す\"), SDialogCommand_1.SDialogSystemCommand.PickOut, _ => this.handlePickOut()));\r\n }\r\n return commands;\r\n }\r\n static normalizeActionList(actions) {\r\n return actions\r\n .distinctObjects(x => x.actionId)\r\n .immutableSort((a, b) => {\r\n const ad = MRData_1.MRData.skills[a.actionId];\r\n const bd = MRData_1.MRData.skills[b.actionId];\r\n if (ad.priority == bd.priority)\r\n return ad.id - bd.id;\r\n return bd.priority - ad.priority; // 降順\r\n });\r\n }\r\n handleAction(actionId) {\r\n const itemEntity = this.selectedSingleEntity();\r\n SCommonCommand_1.SCommonCommand.handleAction(this, this.actor, this.inventory, itemEntity, actionId);\r\n }\r\n handleShortcutSet() {\r\n const itemEntity = this.selectedSingleEntity();\r\n const equipmentUser = this.actor.getEntityBehavior(LEquipmentUserBehavior_1.LEquipmentUserBehavior);\r\n equipmentUser.equipOnShortcut(MRSystem_1.MRSystem.commandContext, itemEntity);\r\n this.closeAllSubDialogs();\r\n }\r\n handleShortcutUnset() {\r\n const itemEntity = this.selectedSingleEntity();\r\n const equipmentUser = this.actor.getEntityBehavior(LEquipmentUserBehavior_1.LEquipmentUserBehavior);\r\n equipmentUser.equipOffShortcut(MRSystem_1.MRSystem.commandContext, itemEntity);\r\n this.closeAllSubDialogs();\r\n }\r\n handlePeek() {\r\n const itemEntity = this.selectedSingleEntity();\r\n const inventory = itemEntity.getEntityBehavior(LInventoryBehavior_1.LInventoryBehavior);\r\n const model = new SItemListDialog(this.actor, inventory, SItemListDialogSourceAction.Peek);\r\n model.multipleSelectionEnabled = true;\r\n this.openSubDialog(model, (result) => {\r\n //this.submit();\r\n return false;\r\n });\r\n }\r\n handlePutIn() {\r\n const storage = this.selectedSingleEntity();\r\n const model = new SItemSelectionDialog_1.SItemSelectionDialog(this.actor, this.inventory, true);\r\n model.multipleSelectionEnabled = true;\r\n this.openSubDialog(model, (result) => {\r\n console.log(\"model.selectedEntities()\", model.selectedEntities());\r\n const activity = LActivity_1.LActivity.makePutIn(this.actor, storage, model.selectedEntities());\r\n MRSystem_1.MRSystem.dialogContext.postActivity(activity);\r\n this.submit(); // submit にする。 (cancel ではなく)\r\n return true; // submit() を呼んだので Handled.\r\n });\r\n }\r\n handlePickOut() {\r\n const storage = this.inventory.ownerEntity();\r\n const activity = LActivity_1.LActivity.makePickOut(this.actor, storage, this.selectedEntities());\r\n MRSystem_1.MRSystem.dialogContext.postActivity(activity);\r\n this.submit();\r\n }\r\n}\r\nexports.SItemListDialog = SItemListDialog;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/dialogs/SItemListDialog.ts?"); /***/ }), /***/ "./ts/mr/system/dialogs/SItemSelectionDialog.ts": /*!******************************************************!*\ !*** ./ts/mr/system/dialogs/SItemSelectionDialog.ts ***! \******************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SItemSelectionDialog = void 0;\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst SInventoryDialogBase_1 = __webpack_require__(/*! ./SInventoryDialogBase */ \"./ts/mr/system/dialogs/SInventoryDialogBase.ts\");\r\nclass SItemSelectionDialog extends SInventoryDialogBase_1.SInventoryDialogBase {\r\n constructor(actorEntity, inventory, canMultiSelect) {\r\n super(inventory);\r\n this._actorEntityId = actorEntity.entityId();\r\n this._canMultiSelect = canMultiSelect;\r\n }\r\n canMultiSelect() {\r\n return this._canMultiSelect;\r\n }\r\n // public get isMultiSelectMode(): boolean {\r\n // return this._multiSelectMode;\r\n // }\r\n entity() {\r\n return MRLively_1.MRLively.world.entity(this._actorEntityId);\r\n }\r\n}\r\nexports.SItemSelectionDialog = SItemSelectionDialog;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/dialogs/SItemSelectionDialog.ts?"); /***/ }), /***/ "./ts/mr/system/dialogs/SItemSellDialog.ts": /*!*************************************************!*\ !*** ./ts/mr/system/dialogs/SItemSellDialog.ts ***! \*************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SItemSellDialog = void 0;\r\nconst LInventoryBehavior_1 = __webpack_require__(/*! ts/mr/lively/entity/LInventoryBehavior */ \"./ts/mr/lively/entity/LInventoryBehavior.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst UInventory_1 = __webpack_require__(/*! ts/mr/utility/UInventory */ \"./ts/mr/utility/UInventory.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ../MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst SInventoryDialogBase_1 = __webpack_require__(/*! ./SInventoryDialogBase */ \"./ts/mr/system/dialogs/SInventoryDialogBase.ts\");\r\nclass SItemSellDialog extends SInventoryDialogBase_1.SInventoryDialogBase {\r\n constructor(serviceProvider, serviceUser, inventoryHolder) {\r\n super(inventoryHolder.getEntityBehavior(LInventoryBehavior_1.LInventoryBehavior));\r\n this.multipleSelectionEnabled = true;\r\n this._serviceProviderId = serviceProvider.entityId();\r\n this._serviceUserId = serviceUser.entityId();\r\n this._resultItems = [];\r\n }\r\n get serviceProvider() {\r\n return MRLively_1.MRLively.world.entity(this._serviceProviderId);\r\n }\r\n get serviceUser() {\r\n return MRLively_1.MRLively.world.entity(this._serviceUserId);\r\n }\r\n get resultItems() {\r\n return this._resultItems.map(e => MRLively_1.MRLively.world.entity(e));\r\n }\r\n setResultItems(items) {\r\n this._resultItems = items.map(e => e.entityId());\r\n }\r\n submitSell() {\r\n UInventory_1.UInventory.postSellItemsAndDestroy(MRSystem_1.MRSystem.commandContext, this.serviceUser, this.resultItems);\r\n this.submit();\r\n }\r\n}\r\nexports.SItemSellDialog = SItemSellDialog;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/dialogs/SItemSellDialog.ts?"); /***/ }), /***/ "./ts/mr/system/dialogs/SMainMenuDialog.ts": /*!*************************************************!*\ !*** ./ts/mr/system/dialogs/SMainMenuDialog.ts ***! \*************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SMainMenuDialog = void 0;\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst SDialog_1 = __webpack_require__(/*! ../SDialog */ \"./ts/mr/system/SDialog.ts\");\r\nclass SMainMenuDialog extends SDialog_1.SDialog {\r\n constructor(entity) {\r\n super();\r\n this._entityId = entity.entityId();\r\n }\r\n entity() {\r\n return MRLively_1.MRLively.world.entity(this._entityId);\r\n }\r\n}\r\nexports.SMainMenuDialog = SMainMenuDialog;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/dialogs/SMainMenuDialog.ts?"); /***/ }), /***/ "./ts/mr/system/dialogs/SNicknameDialog.ts": /*!*************************************************!*\ !*** ./ts/mr/system/dialogs/SNicknameDialog.ts ***! \*************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SNicknameDialog = void 0;\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst SDialog_1 = __webpack_require__(/*! ../SDialog */ \"./ts/mr/system/SDialog.ts\");\r\nclass SNicknameDialog extends SDialog_1.SDialog {\r\n constructor(actorEntity, targetItem) {\r\n super();\r\n this._actorEntityId = actorEntity.entityId();\r\n this._targetItemId = targetItem.entityId();\r\n }\r\n // public get actor(): LEntity {\r\n // return REGame.world.entity(this._actorEntityId);\r\n // }\r\n get item() {\r\n return MRLively_1.MRLively.world.entity(this._targetItemId);\r\n }\r\n setNickname(name) {\r\n MRLively_1.MRLively.getCurrentIdentifyer().setNickname(this.item.dataId, name);\r\n }\r\n}\r\nexports.SNicknameDialog = SNicknameDialog;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/dialogs/SNicknameDialog.ts?"); /***/ }), /***/ "./ts/mr/system/dialogs/SPlayerDialog.ts": /*!***********************************************!*\ !*** ./ts/mr/system/dialogs/SPlayerDialog.ts ***! \***********************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SPlayerDialog = void 0;\r\nconst SDialog_1 = __webpack_require__(/*! ../SDialog */ \"./ts/mr/system/SDialog.ts\");\r\nclass SPlayerDialog extends SDialog_1.SDialog {\r\n constructor() {\r\n super();\r\n }\r\n onUpdate(context) {\r\n }\r\n}\r\nexports.SPlayerDialog = SPlayerDialog;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/dialogs/SPlayerDialog.ts?"); /***/ }), /***/ "./ts/mr/system/dialogs/STransferMapDialog.ts": /*!****************************************************!*\ !*** ./ts/mr/system/dialogs/STransferMapDialog.ts ***! \****************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.STransferMapSource = exports.STransferMapDialog = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst UMovement_1 = __webpack_require__(/*! ts/mr/utility/UMovement */ \"./ts/mr/utility/UMovement.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ../MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst SDialog_1 = __webpack_require__(/*! ../SDialog */ \"./ts/mr/system/SDialog.ts\");\r\nconst SGameManager_1 = __webpack_require__(/*! ../SGameManager */ \"./ts/mr/system/SGameManager.ts\");\r\n/**\r\n * マップ遷移のダイアログ\r\n *\r\n * コアスクリプトの Game_Player.reserveTransfer > Game_Player.performTransfer の一連の流れに対応する。\r\n * View 側のフェードエフェクトなどのために、実際の対象の移動を非同期実行するため、Dialog としている。\r\n * ※元々は LCamera にあった機能だが、その性質は Dialog と非常に似ているため、こちらに移動した。\r\n */\r\nclass STransferMapDialog extends SDialog_1.SDialog {\r\n constructor(source, floorId, x, y, d) {\r\n super();\r\n this._transferingNewX = 0;\r\n this._transferingNewY = 0;\r\n this.source = source;\r\n this._transferingOldFloorId = MRLively_1.MRLively.mapView.currentFloorId.clone();\r\n this._transferingNewFloorId = floorId.clone();\r\n this._transferingNewX = x;\r\n this._transferingNewY = y;\r\n this._newDirection = d;\r\n if (this.source == STransferMapSource.FromCommand) {\r\n MRSystem_1.MRSystem.integration.onReserveTransferMap(floorId.rmmzMapId, x, y, d);\r\n }\r\n }\r\n static get isFloorTransfering() {\r\n if (!MRSystem_1.MRSystem.dialogContext._hasDialogModel())\r\n return false;\r\n const dialog = MRSystem_1.MRSystem.dialogContext.activeDialog();\r\n return dialog instanceof STransferMapDialog;\r\n }\r\n static get current() {\r\n const dialog = MRSystem_1.MRSystem.dialogContext.activeDialog();\r\n (0, Common_1.assert)(dialog instanceof STransferMapDialog);\r\n return dialog;\r\n }\r\n // 別 Land への遷移?\r\n get isLandTransfering() {\r\n return this._transferingOldFloorId.landId != this._transferingNewFloorId.landId;\r\n }\r\n get oldMap() {\r\n if (this._transferingOldFloorId.isEmpty)\r\n return undefined;\r\n return MRLively_1.MRLively.world.map(this._transferingOldFloorId);\r\n }\r\n get newFloorId() {\r\n return this._transferingNewFloorId;\r\n }\r\n get newMap() {\r\n return MRLively_1.MRLively.world.map(this._transferingNewFloorId);\r\n }\r\n performFloorTransfer() {\r\n // MapManager による構築中は currentMap を遷移後のものとして扱っているため、事前に変更しておく\r\n MRLively_1.MRLively.mapView.currentFloorId = this._transferingNewFloorId.clone();\r\n SGameManager_1.SGameManager.performFloorTransfer(this);\r\n // 今のところ、map の needsRebuild() が立ってないと Map 内の Entity の再配置が行われず、 located が発生しない。\r\n // そのままだと Minimap 等が更新されないため、ここで located を発生させる。\r\n const player = MRLively_1.MRLively.mapView.focusedEntity();\r\n (0, Common_1.assert)(player);\r\n const map = this.newMap;\r\n const block = map.block(player.mx, player.my);\r\n UMovement_1.UMovement._postLocate(player, undefined, block, map, undefined);\r\n }\r\n}\r\nexports.STransferMapDialog = STransferMapDialog;\r\nvar STransferMapSource;\r\n(function (STransferMapSource) {\r\n STransferMapSource[STransferMapSource[\"FromCommand\"] = 0] = \"FromCommand\";\r\n STransferMapSource[STransferMapSource[\"FromRmmzNewGame\"] = 1] = \"FromRmmzNewGame\";\r\n STransferMapSource[STransferMapSource[\"FromRmmzEventCommand\"] = 2] = \"FromRmmzEventCommand\";\r\n})(STransferMapSource = exports.STransferMapSource || (exports.STransferMapSource = {}));\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/dialogs/STransferMapDialog.ts?"); /***/ }), /***/ "./ts/mr/system/dialogs/SWarehouseStoreDialog.ts": /*!*******************************************************!*\ !*** ./ts/mr/system/dialogs/SWarehouseStoreDialog.ts ***! \*******************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SWarehouseStoreDialog = void 0;\r\nconst LInventoryBehavior_1 = __webpack_require__(/*! ts/mr/lively/entity/LInventoryBehavior */ \"./ts/mr/lively/entity/LInventoryBehavior.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst UInventory_1 = __webpack_require__(/*! ts/mr/utility/UInventory */ \"./ts/mr/utility/UInventory.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ../MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst SCommon_1 = __webpack_require__(/*! ../SCommon */ \"./ts/mr/system/SCommon.ts\");\r\nconst SInventoryDialogBase_1 = __webpack_require__(/*! ./SInventoryDialogBase */ \"./ts/mr/system/dialogs/SInventoryDialogBase.ts\");\r\nclass SWarehouseStoreDialog extends SInventoryDialogBase_1.SInventoryDialogBase {\r\n // private _closeRequested: boolean = false;\r\n constructor(user, warehouse) {\r\n super(user.getEntityBehavior(LInventoryBehavior_1.LInventoryBehavior));\r\n this.multipleSelectionEnabled = true;\r\n this._userEntityId = user.entityId();\r\n this._warehouseEntityId = warehouse.entityId();\r\n this._warehouseInventoryBehaviorId = warehouse.getEntityBehavior(LInventoryBehavior_1.LInventoryBehavior).id();\r\n this._resultItems = [];\r\n this._result = SCommon_1.SWarehouseDialogResult.Cancel;\r\n }\r\n get user() {\r\n return MRLively_1.MRLively.world.entity(this._userEntityId);\r\n }\r\n get warehouseEntity() {\r\n return MRLively_1.MRLively.world.entity(this._warehouseEntityId);\r\n }\r\n get warehouseInventory() {\r\n return MRLively_1.MRLively.world.behavior(this._warehouseInventoryBehaviorId);\r\n }\r\n resultItems() {\r\n return this._resultItems.map(e => MRLively_1.MRLively.world.entity(e));\r\n }\r\n get result() {\r\n return this._result;\r\n }\r\n storeItems(items) {\r\n this._resultItems = items.map(e => e.entityId());\r\n const r = { code: SCommon_1.SWarehouseDialogResult.Succeeded, items: [] };\r\n UInventory_1.UInventory.postStoreItemsToWarehouse(MRSystem_1.MRSystem.commandContext, this.user, this.warehouseEntity, items, r)\r\n .finally(_ => {\r\n this._result = r.code;\r\n this.submit();\r\n });\r\n }\r\n}\r\nexports.SWarehouseStoreDialog = SWarehouseStoreDialog;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/dialogs/SWarehouseStoreDialog.ts?"); /***/ }), /***/ "./ts/mr/system/dialogs/SWarehouseWithdrawDialog.ts": /*!**********************************************************!*\ !*** ./ts/mr/system/dialogs/SWarehouseWithdrawDialog.ts ***! \**********************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SWarehouseWithdrawDialog = void 0;\r\nconst LInventoryBehavior_1 = __webpack_require__(/*! ts/mr/lively/entity/LInventoryBehavior */ \"./ts/mr/lively/entity/LInventoryBehavior.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst UInventory_1 = __webpack_require__(/*! ts/mr/utility/UInventory */ \"./ts/mr/utility/UInventory.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ../MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst SCommon_1 = __webpack_require__(/*! ../SCommon */ \"./ts/mr/system/SCommon.ts\");\r\nconst SInventoryDialogBase_1 = __webpack_require__(/*! ./SInventoryDialogBase */ \"./ts/mr/system/dialogs/SInventoryDialogBase.ts\");\r\nclass SWarehouseWithdrawDialog extends SInventoryDialogBase_1.SInventoryDialogBase {\r\n constructor(user, warehouse) {\r\n super(warehouse.getEntityBehavior(LInventoryBehavior_1.LInventoryBehavior));\r\n this.multipleSelectionEnabled = true;\r\n this._userEntityId = user.entityId();\r\n this._userInventoryBehaviorId = user.getEntityBehavior(LInventoryBehavior_1.LInventoryBehavior).id();\r\n this._warehouseEntityId = warehouse.entityId();\r\n this._resultItems = [];\r\n this._result = SCommon_1.SWarehouseDialogResult.Cancel;\r\n }\r\n get user() {\r\n return MRLively_1.MRLively.world.entity(this._userEntityId);\r\n }\r\n get userInventory() {\r\n return MRLively_1.MRLively.world.behavior(this._userInventoryBehaviorId);\r\n }\r\n get warehouseEntity() {\r\n return MRLively_1.MRLively.world.entity(this._warehouseEntityId);\r\n }\r\n // public setResultItems(items: LEntity[]) {\r\n // this._resultItems = items.map(e => e.entityId());\r\n // }\r\n resultItems() {\r\n return this._resultItems.map(e => MRLively_1.MRLively.world.entity(e));\r\n }\r\n get result() {\r\n return this._result;\r\n }\r\n withdrawItems(items) {\r\n this._resultItems = items.map(e => e.entityId());\r\n const r = { code: SCommon_1.SWarehouseDialogResult.Succeeded, items: [] };\r\n UInventory_1.UInventory.postWithdrawItemsToWarehouse(MRSystem_1.MRSystem.commandContext, this.user, this.warehouseEntity, items, r)\r\n .finally(_ => {\r\n this._result = r.code;\r\n this.submit();\r\n });\r\n }\r\n}\r\nexports.SWarehouseWithdrawDialog = SWarehouseWithdrawDialog;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/dialogs/SWarehouseWithdrawDialog.ts?"); /***/ }), /***/ "./ts/mr/system/effect/SSpecialEffectManager.ts": /*!******************************************************!*\ !*** ./ts/mr/system/effect/SSpecialEffectManager.ts ***! \******************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SSpecialEffectManager = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst SGoldStealSpecialEffect_1 = __webpack_require__(/*! ./effects/SGoldStealSpecialEffect */ \"./ts/mr/system/effect/effects/SGoldStealSpecialEffect.ts\");\r\nconst SItemStealSpecialEffect_1 = __webpack_require__(/*! ./effects/SItemStealSpecialEffect */ \"./ts/mr/system/effect/effects/SItemStealSpecialEffect.ts\");\r\nconst SLevelDownSpecialEffect_1 = __webpack_require__(/*! ./effects/SLevelDownSpecialEffect */ \"./ts/mr/system/effect/effects/SLevelDownSpecialEffect.ts\");\r\nconst SWrapSpecialEffect_1 = __webpack_require__(/*! ./effects/SWrapSpecialEffect */ \"./ts/mr/system/effect/effects/SWrapSpecialEffect.ts\");\r\nconst SStumbleSpecialEffect_1 = __webpack_require__(/*! ./effects/SStumbleSpecialEffect */ \"./ts/mr/system/effect/effects/SStumbleSpecialEffect.ts\");\r\nconst STransferToNextFloorSpecialEffect_1 = __webpack_require__(/*! ./effects/STransferToNextFloorSpecialEffect */ \"./ts/mr/system/effect/effects/STransferToNextFloorSpecialEffect.ts\");\r\nconst STransferToLowerFloorSpecialEffect_1 = __webpack_require__(/*! ./effects/STransferToLowerFloorSpecialEffect */ \"./ts/mr/system/effect/effects/STransferToLowerFloorSpecialEffect.ts\");\r\nconst STrapProliferationSpecialEffect_1 = __webpack_require__(/*! ./effects/STrapProliferationSpecialEffect */ \"./ts/mr/system/effect/effects/STrapProliferationSpecialEffect.ts\");\r\nconst SDispelEquipmentsSpecialEffect_1 = __webpack_require__(/*! ./effects/SDispelEquipmentsSpecialEffect */ \"./ts/mr/system/effect/effects/SDispelEquipmentsSpecialEffect.ts\");\r\nconst SChangeInstanceSpecialEffect_1 = __webpack_require__(/*! ./effects/SChangeInstanceSpecialEffect */ \"./ts/mr/system/effect/effects/SChangeInstanceSpecialEffect.ts\");\r\nconst SRestartFloorSpecialEffect_1 = __webpack_require__(/*! ./effects/SRestartFloorSpecialEffect */ \"./ts/mr/system/effect/effects/SRestartFloorSpecialEffect.ts\");\r\nconst SClarificationSpecialEffect_1 = __webpack_require__(/*! ./effects/SClarificationSpecialEffect */ \"./ts/mr/system/effect/effects/SClarificationSpecialEffect.ts\");\r\nconst SDivisionSpecialEffect_1 = __webpack_require__(/*! ./effects/SDivisionSpecialEffect */ \"./ts/mr/system/effect/effects/SDivisionSpecialEffect.ts\");\r\nconst SRemoveStatesByIntentionsSpecialEffect_1 = __webpack_require__(/*! ./effects/SRemoveStatesByIntentionsSpecialEffect */ \"./ts/mr/system/effect/effects/SRemoveStatesByIntentionsSpecialEffect.ts\");\r\nconst SPerformeSkillSpecialEffect_1 = __webpack_require__(/*! ./effects/SPerformeSkillSpecialEffect */ \"./ts/mr/system/effect/effects/SPerformeSkillSpecialEffect.ts\");\r\nconst SRemoveStateSpecialEffect_1 = __webpack_require__(/*! ./effects/SRemoveStateSpecialEffect */ \"./ts/mr/system/effect/effects/SRemoveStateSpecialEffect.ts\");\r\nconst SAddStateSpecialEffect_1 = __webpack_require__(/*! ./effects/SAddStateSpecialEffect */ \"./ts/mr/system/effect/effects/SAddStateSpecialEffect.ts\");\r\nconst SGainCapacitySpecialEffect_1 = __webpack_require__(/*! ./effects/SGainCapacitySpecialEffect */ \"./ts/mr/system/effect/effects/SGainCapacitySpecialEffect.ts\");\r\nconst SSuckOutSpecialEffect_1 = __webpack_require__(/*! ./effects/SSuckOutSpecialEffect */ \"./ts/mr/system/effect/effects/SSuckOutSpecialEffect.ts\");\r\nclass SSpecialEffectManager {\r\n constructor() {\r\n this.behaviors = []; // Index is DSkillBehaviorId\r\n this.setupBuiltins();\r\n }\r\n register(specialEffectId, behavior) {\r\n this.behaviors[specialEffectId] = behavior;\r\n }\r\n find(specialEffectId) {\r\n return this.behaviors[specialEffectId];\r\n }\r\n get(specialEffectId) {\r\n const b = this.find(specialEffectId);\r\n (0, Common_1.assert)(b);\r\n return b;\r\n }\r\n setupBuiltins() {\r\n this.register(MRBasics_1.MRBasics.effectBehaviors.itemSteal, new SItemStealSpecialEffect_1.SItemStealSpecialEffect());\r\n this.register(MRBasics_1.MRBasics.effectBehaviors.goldSteal, new SGoldStealSpecialEffect_1.SGoldStealSpecialEffect());\r\n this.register(MRBasics_1.MRBasics.effectBehaviors.levelDown, new SLevelDownSpecialEffect_1.SLevelDownSpecialEffect());\r\n this.register(MRBasics_1.MRBasics.effectBehaviors.randomWarp, new SWrapSpecialEffect_1.SWarpSpecialEffect());\r\n this.register(MRBasics_1.MRBasics.effectBehaviors.stumble, new SStumbleSpecialEffect_1.SStumbleSpecialEffect());\r\n this.register(MRBasics_1.MRBasics.effectBehaviors.transferToNextFloor, new STransferToNextFloorSpecialEffect_1.STransferToNextFloorSpecialEffect());\r\n this.register(MRBasics_1.MRBasics.effectBehaviors.transferToLowerFloor, new STransferToLowerFloorSpecialEffect_1.STransferToLowerFloorSpecialEffect());\r\n this.register(MRBasics_1.MRBasics.effectBehaviors.trapProliferation, new STrapProliferationSpecialEffect_1.STrapProliferationSpecialEffect());\r\n this.register(MRBasics_1.MRBasics.effectBehaviors.dispelEquipments, new SDispelEquipmentsSpecialEffect_1.SDispelEquipmentsSpecialEffect());\r\n this.register(MRBasics_1.MRBasics.effectBehaviors.changeInstance, new SChangeInstanceSpecialEffect_1.SChangeInstanceSpecialEffect());\r\n this.register(MRBasics_1.MRBasics.effectBehaviors.restartFloor, new SRestartFloorSpecialEffect_1.SRestartFloorSpecialEffect());\r\n this.register(MRBasics_1.MRBasics.effectBehaviors.clarification, new SClarificationSpecialEffect_1.SClarificationSpecialEffect());\r\n this.register(MRBasics_1.MRBasics.effectBehaviors.division, new SDivisionSpecialEffect_1.SDivisionSpecialEffect());\r\n this.register(MRBasics_1.MRBasics.effectBehaviors.addState, new SAddStateSpecialEffect_1.SAddStateSpecialEffect());\r\n this.register(MRBasics_1.MRBasics.effectBehaviors.removeState, new SRemoveStateSpecialEffect_1.SRemoveStateSpecialEffect());\r\n this.register(MRBasics_1.MRBasics.effectBehaviors.removeStatesByIntentions, new SRemoveStatesByIntentionsSpecialEffect_1.SRemoveStatesByIntentionsSpecialEffect());\r\n this.register(MRBasics_1.MRBasics.effectBehaviors.performeSkill, new SPerformeSkillSpecialEffect_1.SPerformeSkillSpecialEffect());\r\n this.register(MRBasics_1.MRBasics.effectBehaviors.gainCapacity, new SGainCapacitySpecialEffect_1.SGainCapacitySpecialEffect());\r\n this.register(MRBasics_1.MRBasics.effectBehaviors.suckOut, new SSuckOutSpecialEffect_1.SSuckOutSpecialEffect());\r\n }\r\n}\r\nexports.SSpecialEffectManager = SSpecialEffectManager;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/effect/SSpecialEffectManager.ts?"); /***/ }), /***/ "./ts/mr/system/effect/effects/SAddStateSpecialEffect.ts": /*!***************************************************************!*\ !*** ./ts/mr/system/effect/effects/SAddStateSpecialEffect.ts ***! \***************************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SAddStateSpecialEffect = void 0;\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst UState_1 = __webpack_require__(/*! ts/mr/utility/UState */ \"./ts/mr/utility/UState.ts\");\r\nconst SSpecialEffect_1 = __webpack_require__(/*! ./SSpecialEffect */ \"./ts/mr/system/effect/effects/SSpecialEffect.ts\");\r\nclass SAddStateSpecialEffect extends SSpecialEffect_1.SSpecialEffect {\r\n onApplyTargetEffect(cctx, data, performer, item, modifier, target, result) {\r\n SAddStateSpecialEffect.itemEffectAddState(target, modifier, data, cctx.random(), result);\r\n }\r\n // Game_Action.prototype.itemEffectAddState\r\n static itemEffectAddState(target, effect, effectRef, rand, result) {\r\n if (effectRef.dataId === 0) {\r\n // ID=0 は \"通常攻撃\" という特殊な状態付加となる。\r\n // RESystem としては処理不要。\r\n }\r\n else {\r\n this.itemEffectAddNormalState(target, effect, effectRef, rand, result);\r\n }\r\n }\r\n // Game_Action.prototype.itemEffectAddNormalState\r\n static itemEffectAddNormalState(target, effect, effectRef, rand, result) {\r\n const stateData = MRData_1.MRData.states[effectRef.dataId];\r\n // そもそもステート無効化を持っている場合は追加自体行わない。\r\n // RMMZ標準では、一度追加した後の refresh で remove している。\r\n // ただこれだと makeSuccess() が動いてしまうので、いらないメッセージが出てしまう。\r\n const stateAddable = target.isStateAddable(effectRef.dataId);\r\n if (!stateAddable)\r\n return;\r\n if (!UState_1.UState.meetsApplyConditions(stateData, target)) {\r\n return;\r\n }\r\n let chance = effectRef.value;\r\n if (!effect.isCertainHit()) {\r\n chance *= target.stateRate(effectRef.dataId);\r\n chance *= effect.lukEffectRate(target);\r\n }\r\n if (rand.nextIntWithMax(100) < (chance * 100)) {\r\n SAddStateSpecialEffect.addState(target, effectRef.dataId, result);\r\n }\r\n }\r\n static addState(target, stateId, result) {\r\n target.addState(stateId);\r\n result.makeSuccess();\r\n const stateData = MRData_1.MRData.states[stateId];\r\n if (stateData.deadState) {\r\n result.clearParamEffects();\r\n }\r\n }\r\n}\r\nexports.SAddStateSpecialEffect = SAddStateSpecialEffect;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/effect/effects/SAddStateSpecialEffect.ts?"); /***/ }), /***/ "./ts/mr/system/effect/effects/SChangeInstanceSpecialEffect.ts": /*!*********************************************************************!*\ !*** ./ts/mr/system/effect/effects/SChangeInstanceSpecialEffect.ts ***! \*********************************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SChangeInstanceSpecialEffect = void 0;\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst LEquipmentUserBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LEquipmentUserBehavior */ \"./ts/mr/lively/behaviors/LEquipmentUserBehavior.ts\");\r\nconst LInventoryBehavior_1 = __webpack_require__(/*! ts/mr/lively/entity/LInventoryBehavior */ \"./ts/mr/lively/entity/LInventoryBehavior.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst USpawner_1 = __webpack_require__(/*! ts/mr/utility/USpawner */ \"./ts/mr/utility/USpawner.ts\");\r\nconst SSpecialEffect_1 = __webpack_require__(/*! ./SSpecialEffect */ \"./ts/mr/system/effect/effects/SSpecialEffect.ts\");\r\nclass SChangeInstanceSpecialEffect extends SSpecialEffect_1.SSpecialEffect {\r\n onApplyTargetEffect(cctx, data, performer, item, modifier, target, result) {\r\n const entityData = (() => {\r\n if (data.entityId)\r\n return MRData_1.MRData.entities[data.entityId];\r\n else\r\n return cctx.random().select(USpawner_1.USpawner.getEnemiesFromSpawnTable(target.floorId));\r\n })();\r\n const prevIsUnit = target.isUnit();\r\n target.setupInstance(entityData.id);\r\n // TODO: リリース前暫定対応。\r\n // ここで直接 Behavior を参照してるのであまりよくない。\r\n // Instance が変わったことをしめす Event を実装したほうがいいだろう。\r\n // かつ、その Event はグローバルなイベントではなく、特定の Entity の状態変化を \"監視\" 出来るような仕組みにしたい。\r\n {\r\n const inventory = target.parentAs(LInventoryBehavior_1.LInventoryBehavior);\r\n if (inventory) {\r\n const owner = inventory.ownerEntity();\r\n const equipmentUser = owner.findEntityBehavior(LEquipmentUserBehavior_1.LEquipmentUserBehavior);\r\n if (equipmentUser) {\r\n if (equipmentUser.isShortcutEquipped(target)) {\r\n equipmentUser.removeShortcut(target);\r\n }\r\n else {\r\n equipmentUser.removeEquitment(target);\r\n }\r\n }\r\n }\r\n }\r\n result.makeSuccess();\r\n if (prevIsUnit) {\r\n MRLively_1.MRLively.scheduler.resetEntity(target);\r\n }\r\n }\r\n}\r\nexports.SChangeInstanceSpecialEffect = SChangeInstanceSpecialEffect;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/effect/effects/SChangeInstanceSpecialEffect.ts?"); /***/ }), /***/ "./ts/mr/system/effect/effects/SClarificationSpecialEffect.ts": /*!********************************************************************!*\ !*** ./ts/mr/system/effect/effects/SClarificationSpecialEffect.ts ***! \********************************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SClarificationSpecialEffect = void 0;\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ../../MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst SSpecialEffect_1 = __webpack_require__(/*! ./SSpecialEffect */ \"./ts/mr/system/effect/effects/SSpecialEffect.ts\");\r\nclass SClarificationSpecialEffect extends SSpecialEffect_1.SSpecialEffect {\r\n onApplyTargetEffect(cctx, data, performer, item, modifier, target, result) {\r\n const map = MRLively_1.MRLively.mapView.currentMap;\r\n cctx.postCall(() => {\r\n switch (data.value) {\r\n case MRBasics_1.DClarificationType.Unit:\r\n map.unitClarity = true;\r\n MRSystem_1.MRSystem.minimapData.setRefreshNeeded();\r\n break;\r\n case MRBasics_1.DClarificationType.Item:\r\n map.itemClarity = true;\r\n MRSystem_1.MRSystem.minimapData.setRefreshNeeded();\r\n break;\r\n case MRBasics_1.DClarificationType.Trap:\r\n map.trapClarity = true;\r\n MRSystem_1.MRSystem.minimapData.setRefreshNeeded();\r\n break;\r\n case MRBasics_1.DClarificationType.Terrain:\r\n MRLively_1.MRLively.mapView.currentMap.blocks().forEach(b => b._passed = true);\r\n MRSystem_1.MRSystem.minimapData.setRefreshNeeded();\r\n break;\r\n case MRBasics_1.DClarificationType.Sight:\r\n map.sightClarity = true;\r\n MRSystem_1.MRSystem.minimapData.setRefreshNeeded();\r\n break;\r\n default:\r\n throw new Error(\"Unreachable.\");\r\n }\r\n });\r\n result.makeSuccess();\r\n }\r\n}\r\nexports.SClarificationSpecialEffect = SClarificationSpecialEffect;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/effect/effects/SClarificationSpecialEffect.ts?"); /***/ }), /***/ "./ts/mr/system/effect/effects/SDispelEquipmentsSpecialEffect.ts": /*!***********************************************************************!*\ !*** ./ts/mr/system/effect/effects/SDispelEquipmentsSpecialEffect.ts ***! \***********************************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SDispelEquipmentsSpecialEffect = void 0;\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst LEquipmentUserBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LEquipmentUserBehavior */ \"./ts/mr/lively/behaviors/LEquipmentUserBehavior.ts\");\r\nconst SSpecialEffect_1 = __webpack_require__(/*! ./SSpecialEffect */ \"./ts/mr/system/effect/effects/SSpecialEffect.ts\");\r\n/**\r\n * @deprecated\r\n */\r\nclass SDispelEquipmentsSpecialEffect extends SSpecialEffect_1.SSpecialEffect {\r\n onApplyTargetEffect(cctx, data, performer, item, modifier, target, result) {\r\n const equipmentUser = target.findEntityBehavior(LEquipmentUserBehavior_1.LEquipmentUserBehavior);\r\n if (equipmentUser) {\r\n const items = equipmentUser.equippedItemEntities();\r\n if (this.testApply(items)) {\r\n for (const item of items) {\r\n if (item.isStateAffected(MRData_1.MRData.system.states.curse)) {\r\n item.removeState(MRData_1.MRData.system.states.curse);\r\n result.makeSuccess();\r\n item._effectResult._revision++;\r\n }\r\n }\r\n }\r\n else {\r\n // No effect.\r\n }\r\n }\r\n }\r\n testApply(items) {\r\n return !!items.find(x => x.isStateAffected(MRData_1.MRData.system.states.curse));\r\n }\r\n}\r\nexports.SDispelEquipmentsSpecialEffect = SDispelEquipmentsSpecialEffect;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/effect/effects/SDispelEquipmentsSpecialEffect.ts?"); /***/ }), /***/ "./ts/mr/system/effect/effects/SDivisionSpecialEffect.ts": /*!***************************************************************!*\ !*** ./ts/mr/system/effect/effects/SDivisionSpecialEffect.ts ***! \***************************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SDivisionSpecialEffect = void 0;\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst HMovement_1 = __webpack_require__(/*! ts/mr/lively/helpers/HMovement */ \"./ts/mr/lively/helpers/HMovement.ts\");\r\nconst LMap_1 = __webpack_require__(/*! ts/mr/lively/LMap */ \"./ts/mr/lively/LMap.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst UMovement_1 = __webpack_require__(/*! ts/mr/utility/UMovement */ \"./ts/mr/utility/UMovement.ts\");\r\nconst SSpecialEffect_1 = __webpack_require__(/*! ./SSpecialEffect */ \"./ts/mr/system/effect/effects/SSpecialEffect.ts\");\r\nclass SDivisionSpecialEffect extends SSpecialEffect_1.SSpecialEffect {\r\n onApplyTargetEffect(cctx, data, performer, item, modifier, target, result) {\r\n const block = MRLively_1.MRLively.mapView.currentMap.block(target.mx, target.my);\r\n result.makeSuccess();\r\n // 有効な隣接 Block があり、その方向へ移動可能かを調べる\r\n const candidates = UMovement_1.UMovement.getAdjacentBlocks(target).filter(b => HMovement_1.HMovement.checkPassageBlockToBlock(target, block, b, LMap_1.MovingMethod.Walk));\r\n if (candidates.length > 1) {\r\n const newBlock = candidates[cctx.random().nextIntWithMax(candidates.length)];\r\n const newEntity = target.clone();\r\n MRLively_1.MRLively.world.transferEntity(newEntity, target.floorId, newBlock.mx, newBlock.my);\r\n cctx.postSequel(newEntity, MRBasics_1.MRBasics.sequels.MoveSequel).setStartPosition(target.mx, target.my);\r\n cctx.postWaitSequel();\r\n }\r\n else {\r\n // 周囲に空きが無いため分裂できない\r\n }\r\n }\r\n}\r\nexports.SDivisionSpecialEffect = SDivisionSpecialEffect;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/effect/effects/SDivisionSpecialEffect.ts?"); /***/ }), /***/ "./ts/mr/system/effect/effects/SGainCapacitySpecialEffect.ts": /*!*******************************************************************!*\ !*** ./ts/mr/system/effect/effects/SGainCapacitySpecialEffect.ts ***! \*******************************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SGainCapacitySpecialEffect = void 0;\r\nconst SSpecialEffect_1 = __webpack_require__(/*! ./SSpecialEffect */ \"./ts/mr/system/effect/effects/SSpecialEffect.ts\");\r\nconst LInventoryBehavior_1 = __webpack_require__(/*! ts/mr/lively/entity/LInventoryBehavior */ \"./ts/mr/lively/entity/LInventoryBehavior.ts\");\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst UName_1 = __webpack_require__(/*! ts/mr/utility/UName */ \"./ts/mr/utility/UName.ts\");\r\nconst PluginParameters_1 = __webpack_require__(/*! ts/mr/PluginParameters */ \"./ts/mr/PluginParameters.ts\");\r\nconst TDrop_1 = __webpack_require__(/*! ts/mr/transactions/TDrop */ \"./ts/mr/transactions/TDrop.ts\");\r\nclass SGainCapacitySpecialEffect extends SSpecialEffect_1.SSpecialEffect {\r\n onApplyTargetEffect(cctx, data, performer, item, modifier, target, result) {\r\n const inventory = target.findEntityBehavior(LInventoryBehavior_1.LInventoryBehavior);\r\n if (inventory && inventory.isStorage) {\r\n const oldCapacity = inventory.capacity;\r\n const newCapacity = oldCapacity + data.value;\r\n const location = target.getLocation();\r\n (0, Common_1.assert)(location); // not implemented.\r\n // あふれる分は削除する\r\n if (newCapacity < inventory.capacity) {\r\n const items = inventory.items;\r\n const removeItems = [];\r\n for (let i = items.length - 1; i >= newCapacity; i--) {\r\n removeItems.push(items[i]);\r\n }\r\n for (const item of removeItems) {\r\n if (PluginParameters_1.paramDestroyOverflowingItems) {\r\n item.removeFromParent();\r\n item.destroy();\r\n }\r\n else {\r\n TDrop_1.TDrop.dropOrDestroyEntityForce(cctx, item, location.mx, location.my);\r\n }\r\n }\r\n }\r\n inventory.resetCapacity(newCapacity);\r\n if (result) {\r\n if (inventory.capacity < oldCapacity) {\r\n cctx.postMessage((0, Common_1.tr2)(\"%1の容量が減った。\").format(UName_1.UName.makeNameAsItem(target)));\r\n result.makeSuccess();\r\n }\r\n else if (inventory.capacity > oldCapacity) {\r\n cctx.postMessage((0, Common_1.tr2)(\"%1の容量が増えた!\").format(UName_1.UName.makeNameAsItem(target)));\r\n result.makeSuccess();\r\n }\r\n }\r\n }\r\n }\r\n}\r\nexports.SGainCapacitySpecialEffect = SGainCapacitySpecialEffect;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/effect/effects/SGainCapacitySpecialEffect.ts?"); /***/ }), /***/ "./ts/mr/system/effect/effects/SGoldStealSpecialEffect.ts": /*!****************************************************************!*\ !*** ./ts/mr/system/effect/effects/SGoldStealSpecialEffect.ts ***! \****************************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SGoldStealSpecialEffect = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst DSpawner_1 = __webpack_require__(/*! ts/mr/data/DSpawner */ \"./ts/mr/data/DSpawner.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst LInventoryBehavior_1 = __webpack_require__(/*! ts/mr/lively/entity/LInventoryBehavior */ \"./ts/mr/lively/entity/LInventoryBehavior.ts\");\r\nconst UName_1 = __webpack_require__(/*! ts/mr/utility/UName */ \"./ts/mr/utility/UName.ts\");\r\nconst SEntityFactory_1 = __webpack_require__(/*! ../../SEntityFactory */ \"./ts/mr/system/SEntityFactory.ts\");\r\nconst SSpecialEffect_1 = __webpack_require__(/*! ./SSpecialEffect */ \"./ts/mr/system/effect/effects/SSpecialEffect.ts\");\r\nconst SItemStealSpecialEffect_1 = __webpack_require__(/*! ./SItemStealSpecialEffect */ \"./ts/mr/system/effect/effects/SItemStealSpecialEffect.ts\");\r\nclass SGoldStealSpecialEffect extends SSpecialEffect_1.SSpecialEffect {\r\n onApplyTargetEffect(cctx, data, performer, item, modifier, target, result) {\r\n const gold = this.pickGold(target, cctx.random());\r\n if (!gold) {\r\n cctx.postMessage((0, Common_1.tr2)(\"なにも盗めなかった。\"));\r\n return;\r\n }\r\n const inventory = performer.getEntityBehavior(LInventoryBehavior_1.LInventoryBehavior);\r\n inventory.addEntity(gold);\r\n SItemStealSpecialEffect_1.SItemStealSpecialEffect.postWarpBySteal(cctx, performer, UName_1.UName.makeNameAsItem(gold));\r\n }\r\n pickGold(target, rand) {\r\n const inventory = target.findEntityBehavior(LInventoryBehavior_1.LInventoryBehavior);\r\n if (!inventory)\r\n return undefined;\r\n const gold = inventory.gold();\r\n if (gold <= 0)\r\n return undefined;\r\n const damage = 1000; // TODO:\r\n const steal = Math.min(damage, gold);\r\n const entity = SEntityFactory_1.SEntityFactory.newEntity(DSpawner_1.DEntityCreateInfo.makeSingle(MRData_1.MRData.system.fallbackGoldEntityId, []));\r\n entity.setParamCurrentValue(MRBasics_1.MRBasics.params.gold, steal);\r\n inventory.gainGold(-steal);\r\n return entity;\r\n }\r\n}\r\nexports.SGoldStealSpecialEffect = SGoldStealSpecialEffect;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/effect/effects/SGoldStealSpecialEffect.ts?"); /***/ }), /***/ "./ts/mr/system/effect/effects/SItemStealSpecialEffect.ts": /*!****************************************************************!*\ !*** ./ts/mr/system/effect/effects/SItemStealSpecialEffect.ts ***! \****************************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SItemStealSpecialEffect = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst LEquipmentUserBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LEquipmentUserBehavior */ \"./ts/mr/lively/behaviors/LEquipmentUserBehavior.ts\");\r\nconst LInventoryBehavior_1 = __webpack_require__(/*! ts/mr/lively/entity/LInventoryBehavior */ \"./ts/mr/lively/entity/LInventoryBehavior.ts\");\r\nconst UAction_1 = __webpack_require__(/*! ts/mr/utility/UAction */ \"./ts/mr/utility/UAction.ts\");\r\nconst UName_1 = __webpack_require__(/*! ts/mr/utility/UName */ \"./ts/mr/utility/UName.ts\");\r\nconst USearch_1 = __webpack_require__(/*! ts/mr/utility/USearch */ \"./ts/mr/utility/USearch.ts\");\r\nconst SSpecialEffect_1 = __webpack_require__(/*! ./SSpecialEffect */ \"./ts/mr/system/effect/effects/SSpecialEffect.ts\");\r\nclass SItemStealSpecialEffect extends SSpecialEffect_1.SSpecialEffect {\r\n onApplyTargetEffect(cctx, data, performer, item, modifier, target, result) {\r\n result.makeSuccess();\r\n // TODO: これだとアイテム化けに対応できない\r\n //if (target.findEntityBehavior(LItemBehavior)) {\r\n if (USearch_1.USearch.isNeutralItem(target)) {\r\n const inventory = performer.getEntityBehavior(LInventoryBehavior_1.LInventoryBehavior);\r\n // TODO: 取得可否判定は行うが、通常の「拾う」とは違う。メッセージは表示したくないし、ゴールドを盗んだ時はアイテムとしてインベントリに入れたい。\r\n UAction_1.UAction.postPickItem(cctx, performer, inventory, target)\r\n .then(() => {\r\n SItemStealSpecialEffect.postWarpBySteal(cctx, performer, UName_1.UName.makeNameAsItem(target));\r\n return true;\r\n });\r\n }\r\n else {\r\n const item = this.pickItem(target, cctx.random());\r\n if (!item) {\r\n cctx.postMessage((0, Common_1.tr2)(\"なにも盗めなかった。\"));\r\n return;\r\n }\r\n const inventory = performer.getEntityBehavior(LInventoryBehavior_1.LInventoryBehavior);\r\n inventory.addEntity(item);\r\n SItemStealSpecialEffect.postWarpBySteal(cctx, performer, UName_1.UName.makeNameAsItem(item));\r\n }\r\n }\r\n pickItem(target, rand) {\r\n const inventory = target.findEntityBehavior(LInventoryBehavior_1.LInventoryBehavior);\r\n if (!inventory)\r\n return undefined;\r\n let items = inventory.items;\r\n if (items.length == 0)\r\n return undefined;\r\n // 装備中のアイテムは除外\r\n const equipmentUser = target.findEntityBehavior(LEquipmentUserBehavior_1.LEquipmentUserBehavior);\r\n if (equipmentUser) {\r\n items = items.filter(x => !equipmentUser.isEquipped(x) && !equipmentUser.isShortcutEquipped(x));\r\n }\r\n if (items.length == 0)\r\n return undefined;\r\n const item = rand.select(items);\r\n inventory.removeEntity(item);\r\n return item;\r\n }\r\n static postWarpBySteal(cctx, performer, itemName) {\r\n cctx.postMessage((0, Common_1.tr2)(\"%1は%2を盗んだ!\").format(UName_1.UName.makeUnitName(performer), itemName));\r\n UAction_1.UAction.postWarp(cctx, performer);\r\n }\r\n}\r\nexports.SItemStealSpecialEffect = SItemStealSpecialEffect;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/effect/effects/SItemStealSpecialEffect.ts?"); /***/ }), /***/ "./ts/mr/system/effect/effects/SLevelDownSpecialEffect.ts": /*!****************************************************************!*\ !*** ./ts/mr/system/effect/effects/SLevelDownSpecialEffect.ts ***! \****************************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SLevelDownSpecialEffect = void 0;\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst LExperienceBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LExperienceBehavior */ \"./ts/mr/lively/behaviors/LExperienceBehavior.ts\");\r\nconst SSpecialEffect_1 = __webpack_require__(/*! ./SSpecialEffect */ \"./ts/mr/system/effect/effects/SSpecialEffect.ts\");\r\nclass SLevelDownSpecialEffect extends SSpecialEffect_1.SSpecialEffect {\r\n onApplyTargetEffect(cctx, data, performer, item, modifier, target, result) {\r\n const param = target.params.param(MRBasics_1.MRBasics.params.level);\r\n if (!param)\r\n return;\r\n const experience = target.findEntityBehavior(LExperienceBehavior_1.LExperienceBehavior);\r\n if (!experience)\r\n return;\r\n // refresh は ApplyEffect の最後で行いたいので、ここでは直接設定のみ行う\r\n const level = target.getEffortValue(MRBasics_1.MRBasics.params.level);\r\n if (level > 1) {\r\n // レベル減算\r\n target.setEffortValue(MRBasics_1.MRBasics.params.level, level - 1);\r\n // 次のレベルアップまでに必要な経験値をあと 1 の状態にする。\r\n // NOTE: ここでやるべきか、 LExperienceBehavior 側でやるべきか悩ましいところだけど、\r\n // コアスクリプトではレベルダウン時のこのような調整処理はサポートしていない。\r\n // またもし LExperienceBehavior でやるなら、レベル増減の「原因」を onParamChanged まで通知しなければならず、複雑になる。\r\n experience.setExp(target, experience.nextLevelExp(target) - 1);\r\n result.leveldown = true;\r\n result.makeSuccess();\r\n }\r\n }\r\n}\r\nexports.SLevelDownSpecialEffect = SLevelDownSpecialEffect;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/effect/effects/SLevelDownSpecialEffect.ts?"); /***/ }), /***/ "./ts/mr/system/effect/effects/SPerformeSkillSpecialEffect.ts": /*!********************************************************************!*\ !*** ./ts/mr/system/effect/effects/SPerformeSkillSpecialEffect.ts ***! \********************************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SPerformeSkillSpecialEffect = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst LActivity_1 = __webpack_require__(/*! ts/mr/lively/activities/LActivity */ \"./ts/mr/lively/activities/LActivity.ts\");\r\nconst SSpecialEffect_1 = __webpack_require__(/*! ./SSpecialEffect */ \"./ts/mr/system/effect/effects/SSpecialEffect.ts\");\r\nclass SPerformeSkillSpecialEffect extends SSpecialEffect_1.SSpecialEffect {\r\n onApplyTargetEffect(cctx, data, performer, item, modifier, target, result) {\r\n (0, Common_1.assert)(data.dataId);\r\n const skillId = data.dataId;\r\n cctx.postActivity(LActivity_1.LActivity.makePerformSkill(target, skillId));\r\n result.makeSuccess();\r\n }\r\n}\r\nexports.SPerformeSkillSpecialEffect = SPerformeSkillSpecialEffect;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/effect/effects/SPerformeSkillSpecialEffect.ts?"); /***/ }), /***/ "./ts/mr/system/effect/effects/SRemoveStateSpecialEffect.ts": /*!******************************************************************!*\ !*** ./ts/mr/system/effect/effects/SRemoveStateSpecialEffect.ts ***! \******************************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SRemoveStateSpecialEffect = void 0;\r\nconst SSpecialEffect_1 = __webpack_require__(/*! ./SSpecialEffect */ \"./ts/mr/system/effect/effects/SSpecialEffect.ts\");\r\nclass SRemoveStateSpecialEffect extends SSpecialEffect_1.SSpecialEffect {\r\n onApplyTargetEffect(cctx, data, performer, item, modifier, target, result) {\r\n if (!data.dataId)\r\n return;\r\n let chance = data.value;\r\n if (cctx.random().nextIntWithMax(100) < (chance * 100)) {\r\n target.removeState(data.dataId);\r\n result.makeSuccess();\r\n }\r\n }\r\n}\r\nexports.SRemoveStateSpecialEffect = SRemoveStateSpecialEffect;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/effect/effects/SRemoveStateSpecialEffect.ts?"); /***/ }), /***/ "./ts/mr/system/effect/effects/SRemoveStatesByIntentionsSpecialEffect.ts": /*!*******************************************************************************!*\ !*** ./ts/mr/system/effect/effects/SRemoveStatesByIntentionsSpecialEffect.ts ***! \*******************************************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SRemoveStatesByIntentionsSpecialEffect = void 0;\r\nconst SSpecialEffect_1 = __webpack_require__(/*! ./SSpecialEffect */ \"./ts/mr/system/effect/effects/SSpecialEffect.ts\");\r\nclass SRemoveStatesByIntentionsSpecialEffect extends SSpecialEffect_1.SSpecialEffect {\r\n onApplyTargetEffect(cctx, data, performer, item, modifier, target, result) {\r\n const intentions = data.value;\r\n const removeStateIds = target.states\r\n .filter(x => (x.stateData().intentions & intentions) === intentions)\r\n .map(x => x.stateDataId());\r\n if (removeStateIds.length > 0) {\r\n target.removeStates(removeStateIds);\r\n result.makeSuccess();\r\n }\r\n }\r\n}\r\nexports.SRemoveStatesByIntentionsSpecialEffect = SRemoveStatesByIntentionsSpecialEffect;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/effect/effects/SRemoveStatesByIntentionsSpecialEffect.ts?"); /***/ }), /***/ "./ts/mr/system/effect/effects/SRestartFloorSpecialEffect.ts": /*!*******************************************************************!*\ !*** ./ts/mr/system/effect/effects/SRestartFloorSpecialEffect.ts ***! \*******************************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SRestartFloorSpecialEffect = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ../../MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst SSpecialEffect_1 = __webpack_require__(/*! ./SSpecialEffect */ \"./ts/mr/system/effect/effects/SSpecialEffect.ts\");\r\nclass SRestartFloorSpecialEffect extends SSpecialEffect_1.SSpecialEffect {\r\n onApplyTargetEffect(cctx, data, performer, item, modifier, target, result) {\r\n (0, Common_1.assert)(item);\r\n // セーブデータをロードするので、GameObject 全部作り直すことになる。\r\n // Effect 適用処理はこの関数の後もまだ続くので、ここでロードをしてしまうと危ない。\r\n // なので実行を予約しておく。\r\n MRSystem_1.MRSystem.requestedRestartFloorItem = item.entityId();\r\n result.makeSuccess();\r\n }\r\n}\r\nexports.SRestartFloorSpecialEffect = SRestartFloorSpecialEffect;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/effect/effects/SRestartFloorSpecialEffect.ts?"); /***/ }), /***/ "./ts/mr/system/effect/effects/SSpecialEffect.ts": /*!*******************************************************!*\ !*** ./ts/mr/system/effect/effects/SSpecialEffect.ts ***! \*******************************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SSpecialEffect = void 0;\r\nclass SSpecialEffect {\r\n onApplyTargetEffect(cctx, data, performer, item, modifier, target, result) {\r\n }\r\n}\r\nexports.SSpecialEffect = SSpecialEffect;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/effect/effects/SSpecialEffect.ts?"); /***/ }), /***/ "./ts/mr/system/effect/effects/SStumbleSpecialEffect.ts": /*!**************************************************************!*\ !*** ./ts/mr/system/effect/effects/SStumbleSpecialEffect.ts ***! \**************************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SStumbleSpecialEffect = void 0;\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst LActivity_1 = __webpack_require__(/*! ts/mr/lively/activities/LActivity */ \"./ts/mr/lively/activities/LActivity.ts\");\r\nconst SSpecialEffect_1 = __webpack_require__(/*! ./SSpecialEffect */ \"./ts/mr/system/effect/effects/SSpecialEffect.ts\");\r\n// 転ぶ (一般的な英語は fall だが、本システムとして fall はいろいろ使うので混乱を避けるため stumble にしてみる)\r\nclass SStumbleSpecialEffect extends SSpecialEffect_1.SSpecialEffect {\r\n onApplyTargetEffect(cctx, data, performer, item, modifier, target, result) {\r\n result.makeSuccess();\r\n if (target.previewRejection(cctx, { kind: \"EffectBehavior\", id: data.specialEffectId })) {\r\n const activity = (new LActivity_1.LActivity()).setup(MRBasics_1.MRBasics.actions.stumble, target);\r\n cctx.postActivity(activity);\r\n }\r\n // const inventory = target.findEntityBehavior(LInventoryBehavior);\r\n // if (inventory) {\r\n // const item = inventory.getDefenselessItems()[0];\r\n // // TODO: 地形などを考慮して、本当に落とすアイテムを決める\r\n // const dropItems = [item];\r\n // for (const item of dropItems) {\r\n // inventory.removeEntity(item);\r\n // //REGame.world._transferEntity(item, REGame.map.floorId(), mx, my);\r\n // }\r\n // }\r\n }\r\n}\r\nexports.SStumbleSpecialEffect = SStumbleSpecialEffect;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/effect/effects/SStumbleSpecialEffect.ts?"); /***/ }), /***/ "./ts/mr/system/effect/effects/SSuckOutSpecialEffect.ts": /*!**************************************************************!*\ !*** ./ts/mr/system/effect/effects/SSuckOutSpecialEffect.ts ***! \**************************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SSuckOutSpecialEffect = void 0;\r\nconst SSpecialEffect_1 = __webpack_require__(/*! ./SSpecialEffect */ \"./ts/mr/system/effect/effects/SSpecialEffect.ts\");\r\nconst TDrop_1 = __webpack_require__(/*! ts/mr/transactions/TDrop */ \"./ts/mr/transactions/TDrop.ts\");\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst UName_1 = __webpack_require__(/*! ts/mr/utility/UName */ \"./ts/mr/utility/UName.ts\");\r\nclass SSuckOutSpecialEffect extends SSpecialEffect_1.SSpecialEffect {\r\n onApplyTargetEffect(cctx, data, performer, item, modifier, target, result) {\r\n const t = TDrop_1.TDrop.makeFromEntityInventory(target)\r\n .withLocation(performer.mx, performer.my);\r\n if (t.testValidEffect()) {\r\n // 処理前の容量でメッセージを作っておく\r\n const message = (0, Common_1.tr2)(\"%1からアイテムを取り出した。\").format(UName_1.UName.makeNameAsItem(target));\r\n t.performe(cctx);\r\n cctx.postMessage(message);\r\n }\r\n result.makeSuccess();\r\n }\r\n}\r\nexports.SSuckOutSpecialEffect = SSuckOutSpecialEffect;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/effect/effects/SSuckOutSpecialEffect.ts?"); /***/ }), /***/ "./ts/mr/system/effect/effects/STransferToLowerFloorSpecialEffect.ts": /*!***************************************************************************!*\ !*** ./ts/mr/system/effect/effects/STransferToLowerFloorSpecialEffect.ts ***! \***************************************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.STransferToLowerFloorSpecialEffect = void 0;\r\nconst DLand_1 = __webpack_require__(/*! ts/mr/data/DLand */ \"./ts/mr/data/DLand.ts\");\r\nconst LFloorId_1 = __webpack_require__(/*! ts/mr/lively/LFloorId */ \"./ts/mr/lively/LFloorId.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst UTransfer_1 = __webpack_require__(/*! ts/mr/utility/UTransfer */ \"./ts/mr/utility/UTransfer.ts\");\r\nconst SSpecialEffect_1 = __webpack_require__(/*! ./SSpecialEffect */ \"./ts/mr/system/effect/effects/SSpecialEffect.ts\");\r\nclass STransferToLowerFloorSpecialEffect extends SSpecialEffect_1.SSpecialEffect {\r\n onApplyTargetEffect(cctx, data, performer, item, modifier, target, result) {\r\n const land = MRLively_1.MRLively.mapView.currentMap.land2();\r\n const landData = land.landData();\r\n // Flat land では処理不要\r\n if (landData.forwardDirection == DLand_1.DLandForwardDirection.Flat)\r\n return;\r\n const currentFloorId = target.floorId;\r\n const newFloorNumber = currentFloorId.floorNumber + ((landData.forwardDirection == DLand_1.DLandForwardDirection.Downhill) ? 1 : -1);\r\n if (1 <= newFloorNumber && newFloorNumber < land.maxFloorNumber()) {\r\n // 次のフロアへ\r\n if (target.isPlayer()) {\r\n UTransfer_1.UTransfer.proceedFloorForwardForPlayer(cctx);\r\n }\r\n else {\r\n const newFloorId = LFloorId_1.LFloorId.make(currentFloorId.landId, newFloorNumber);\r\n MRLively_1.MRLively.world.transferEntity(target, newFloorId);\r\n }\r\n result.makeSuccess();\r\n }\r\n else {\r\n // 移動できない\r\n }\r\n }\r\n}\r\nexports.STransferToLowerFloorSpecialEffect = STransferToLowerFloorSpecialEffect;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/effect/effects/STransferToLowerFloorSpecialEffect.ts?"); /***/ }), /***/ "./ts/mr/system/effect/effects/STransferToNextFloorSpecialEffect.ts": /*!**************************************************************************!*\ !*** ./ts/mr/system/effect/effects/STransferToNextFloorSpecialEffect.ts ***! \**************************************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.STransferToNextFloorSpecialEffect = void 0;\r\nconst LFloorId_1 = __webpack_require__(/*! ts/mr/lively/LFloorId */ \"./ts/mr/lively/LFloorId.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst UTransfer_1 = __webpack_require__(/*! ts/mr/utility/UTransfer */ \"./ts/mr/utility/UTransfer.ts\");\r\nconst SSpecialEffect_1 = __webpack_require__(/*! ./SSpecialEffect */ \"./ts/mr/system/effect/effects/SSpecialEffect.ts\");\r\nclass STransferToNextFloorSpecialEffect extends SSpecialEffect_1.SSpecialEffect {\r\n onApplyTargetEffect(cctx, data, performer, item, modifier, target, result) {\r\n const land = MRLively_1.MRLively.mapView.currentMap.land2();\r\n const currentFloorId = target.floorId;\r\n const newFloorNumber = currentFloorId.floorNumber + 1;\r\n if (1 <= newFloorNumber || newFloorNumber < land.maxFloorNumber()) {\r\n // 次のフロアへ\r\n if (target.isPlayer()) {\r\n UTransfer_1.UTransfer.proceedFloorForwardForPlayer(cctx);\r\n }\r\n else {\r\n const newFloorId = LFloorId_1.LFloorId.make(currentFloorId.landId, newFloorNumber);\r\n MRLively_1.MRLively.world.transferEntity(target, newFloorId);\r\n }\r\n result.makeSuccess();\r\n }\r\n else {\r\n // 移動できない\r\n }\r\n }\r\n}\r\nexports.STransferToNextFloorSpecialEffect = STransferToNextFloorSpecialEffect;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/effect/effects/STransferToNextFloorSpecialEffect.ts?"); /***/ }), /***/ "./ts/mr/system/effect/effects/STrapProliferationSpecialEffect.ts": /*!************************************************************************!*\ !*** ./ts/mr/system/effect/effects/STrapProliferationSpecialEffect.ts ***! \************************************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.STrapProliferationSpecialEffect = void 0;\r\nconst MRSystem_1 = __webpack_require__(/*! ../../MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst SSpecialEffect_1 = __webpack_require__(/*! ./SSpecialEffect */ \"./ts/mr/system/effect/effects/SSpecialEffect.ts\");\r\nclass STrapProliferationSpecialEffect extends SSpecialEffect_1.SSpecialEffect {\r\n onApplyTargetEffect(cctx, data, performer, item, modifier, target, result) {\r\n MRSystem_1.MRSystem.mapManager.spawnTraps(30);\r\n result.makeSuccess();\r\n }\r\n}\r\nexports.STrapProliferationSpecialEffect = STrapProliferationSpecialEffect;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/effect/effects/STrapProliferationSpecialEffect.ts?"); /***/ }), /***/ "./ts/mr/system/effect/effects/SWrapSpecialEffect.ts": /*!***********************************************************!*\ !*** ./ts/mr/system/effect/effects/SWrapSpecialEffect.ts ***! \***********************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SWarpSpecialEffect = void 0;\r\nconst UAction_1 = __webpack_require__(/*! ts/mr/utility/UAction */ \"./ts/mr/utility/UAction.ts\");\r\nconst SSpecialEffect_1 = __webpack_require__(/*! ./SSpecialEffect */ \"./ts/mr/system/effect/effects/SSpecialEffect.ts\");\r\nclass SWarpSpecialEffect extends SSpecialEffect_1.SSpecialEffect {\r\n onApplyTargetEffect(cctx, data, performer, item, modifier, target, result) {\r\n UAction_1.UAction.postWarp(cctx, target);\r\n result.makeSuccess();\r\n }\r\n}\r\nexports.SWarpSpecialEffect = SWarpSpecialEffect;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/effect/effects/SWrapSpecialEffect.ts?"); /***/ }), /***/ "./ts/mr/system/fov/SFovSystem.ts": /*!****************************************!*\ !*** ./ts/mr/system/fov/SFovSystem.ts ***! \****************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SFovSystem = void 0;\r\nclass SFovSystem {\r\n}\r\nexports.SFovSystem = SFovSystem;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/fov/SFovSystem.ts?"); /***/ }), /***/ "./ts/mr/system/fov/SRoomBoundsFovSystem.ts": /*!**************************************************!*\ !*** ./ts/mr/system/fov/SRoomBoundsFovSystem.ts ***! \**************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SRoomBoundsFovSystem = void 0;\r\nconst HMovement_1 = __webpack_require__(/*! ts/mr/lively/helpers/HMovement */ \"./ts/mr/lively/helpers/HMovement.ts\");\r\nconst PluginParameters_1 = __webpack_require__(/*! ts/mr/PluginParameters */ \"./ts/mr/PluginParameters.ts\");\r\nconst UMovement_1 = __webpack_require__(/*! ts/mr/utility/UMovement */ \"./ts/mr/utility/UMovement.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ../MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst SFovSystem_1 = __webpack_require__(/*! ./SFovSystem */ \"./ts/mr/system/fov/SFovSystem.ts\");\r\nclass SRoomBoundsFovSystem extends SFovSystem_1.SFovSystem {\r\n markBlockPlayerPassed(map, mx, my) {\r\n const block = map.block(mx, my);\r\n block._passed = true;\r\n if (block._roomId > 0) {\r\n const room = map.room(block._roomId);\r\n if (room.poorVisibility) {\r\n room.forEachSightableBlocks(b => {\r\n if (HMovement_1.HMovement.blockDistance(block.mx, block.my, b.mx, b.my) <= PluginParameters_1.paramDefaultVisibiltyLength) {\r\n b._passed = true;\r\n }\r\n });\r\n }\r\n else {\r\n room.forEachSightableBlocks(b => b._passed = true);\r\n }\r\n }\r\n else {\r\n // 通路なら外周1タイルを通過済みにする\r\n UMovement_1.UMovement.adjacent8Offsets.forEach(offset => {\r\n const x = block.mx + offset[0];\r\n const y = block.my + offset[1];\r\n if (map.isValidPosition(x, y)) {\r\n map.block(x, y)._passed = true;\r\n }\r\n });\r\n }\r\n MRSystem_1.MRSystem.minimapData.setRefreshNeeded();\r\n }\r\n}\r\nexports.SRoomBoundsFovSystem = SRoomBoundsFovSystem;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/fov/SRoomBoundsFovSystem.ts?"); /***/ }), /***/ "./ts/mr/system/fov/SSymmetricShadowcastFovSystem.ts": /*!***********************************************************!*\ !*** ./ts/mr/system/fov/SSymmetricShadowcastFovSystem.ts ***! \***********************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SSymmetricShadowcastFovSystem = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst DSystem_1 = __webpack_require__(/*! ts/mr/data/DSystem */ \"./ts/mr/data/DSystem.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ../MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst SFovHelper_1 = __webpack_require__(/*! ../utils/SFovHelper */ \"./ts/mr/system/utils/SFovHelper.ts\");\r\nconst SFovSystem_1 = __webpack_require__(/*! ./SFovSystem */ \"./ts/mr/system/fov/SFovSystem.ts\");\r\nclass SSymmetricShadowcastFovSystem extends SFovSystem_1.SFovSystem {\r\n constructor() {\r\n super();\r\n this._fovMap = new FovMap();\r\n }\r\n markBlockPlayerPassed(map, mx, my) {\r\n const radius = 6;\r\n // LBlock のフラグを更新\r\n this._fovMap.setMap(map);\r\n this._fovMap.clear();\r\n SFovHelper_1.SFovHelper.computeFov(this._fovMap, mx, my, radius, false, DSystem_1.DFovSystem.SymmetricShadowcast);\r\n this._fovMap.apply();\r\n // 表示用のシャドウマップデータを更新\r\n MRSystem_1.MRSystem.fovShadowMap.locate(mx, my, radius);\r\n MRSystem_1.MRSystem.minimapData.setRefreshNeeded();\r\n }\r\n}\r\nexports.SSymmetricShadowcastFovSystem = SSymmetricShadowcastFovSystem;\r\n// computeFov の結果を LBlock へ反映させるためのもの\r\nclass FovMap extends SFovHelper_1.IFovMap {\r\n constructor() {\r\n super();\r\n this._map = undefined;\r\n this._data = [];\r\n }\r\n setMap(map) {\r\n this._map = map;\r\n const len = map.width() * map.height();\r\n if (this._data.length !== len) {\r\n this._data = new Array(len);\r\n }\r\n }\r\n clear() {\r\n for (let i = 0; i < this._data.length; i++) {\r\n this._data[i] = 0;\r\n }\r\n }\r\n apply() {\r\n (0, Common_1.assert)(this._map);\r\n const width = this._map.width();\r\n const height = this._map.height();\r\n for (let y = 0; y < height; y++) {\r\n for (let x = 0; x < width; x++) {\r\n const block = this._map.block(x, y);\r\n if (this._data[y * width + x] > 0) {\r\n block._passed = true;\r\n }\r\n }\r\n }\r\n }\r\n getWidth() {\r\n (0, Common_1.assert)(this._map);\r\n return this._map.width();\r\n }\r\n getHeight() {\r\n (0, Common_1.assert)(this._map);\r\n return this._map.height();\r\n }\r\n getTransparent(x, y) {\r\n (0, Common_1.assert)(this._map);\r\n return this._map.block(x, y).isFloorLikeShape();\r\n }\r\n setFov(x, y, fov) {\r\n this._data[y * this.getWidth() + x] = fov ? 1 : 0;\r\n }\r\n}\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/fov/SSymmetricShadowcastFovSystem.ts?"); /***/ }), /***/ "./ts/mr/system/internal.ts": /*!**********************************!*\ !*** ./ts/mr/system/internal.ts ***! \**********************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}));\r\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n__exportStar(__webpack_require__(/*! ./SBehaviorFactory */ \"./ts/mr/system/SBehaviorFactory.ts\"), exports);\r\n__exportStar(__webpack_require__(/*! ./SEntityFactory */ \"./ts/mr/system/SEntityFactory.ts\"), exports);\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/internal.ts?"); /***/ }), /***/ "./ts/mr/system/map/SItemShopBuilder.ts": /*!**********************************************!*\ !*** ./ts/mr/system/map/SItemShopBuilder.ts ***! \**********************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SItemShopBuilder = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst DEntityCategory_1 = __webpack_require__(/*! ts/mr/data/DEntityCategory */ \"./ts/mr/data/DEntityCategory.ts\");\r\nconst LShopkeeperBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LShopkeeperBehavior */ \"./ts/mr/lively/behaviors/LShopkeeperBehavior.ts\");\r\nconst LBlock_1 = __webpack_require__(/*! ts/mr/lively/LBlock */ \"./ts/mr/lively/LBlock.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst UMovement_1 = __webpack_require__(/*! ts/mr/utility/UMovement */ \"./ts/mr/utility/UMovement.ts\");\r\nconst USpawner_1 = __webpack_require__(/*! ts/mr/utility/USpawner */ \"./ts/mr/utility/USpawner.ts\");\r\nconst SEntityFactory_1 = __webpack_require__(/*! ../SEntityFactory */ \"./ts/mr/system/SEntityFactory.ts\");\r\nclass SItemShopBuilder {\r\n build(manager, info, rand) {\r\n const map = manager.map;\r\n const room = map.room(info.roomId());\r\n room.forEachBlocks(block => {\r\n block.setSystemDecoration(LBlock_1.LBlockSystemDecoration.ItemShop);\r\n //USpawner.spawnSingleEntity(\"kEnemy_店主A\", block.x(), block.y());\r\n /*\r\n // Enemy\r\n if (rand.nextIntWithMax(100) < 50) {\r\n const entities = manager.spawnEnemy(block.x(), block.y());\r\n for (const entity of entities) {\r\n entity.addState(DBasics.states.nap);\r\n }\r\n }\r\n\r\n // Item & Trap\r\n const groundRD = 80;\r\n const rd = rand.nextIntWithMax(100);\r\n if (rd < groundRD) {\r\n if (rd < (groundRD / 2)) {\r\n manager.spawnItem(block.x(), block.y());\r\n }\r\n else {\r\n manager.spawnTrap(block.x(), block.y());\r\n }\r\n }\r\n */\r\n });\r\n // 店主配置\r\n const entrances = this.setupEntranceBlocks(room);\r\n for (const entrance of entrances) {\r\n const e = info.addShopEntrance(entrance.home.mx, entrance.home.my, entrance.gate.mx, entrance.gate.my);\r\n const entity = USpawner_1.USpawner.spawnSingleEntity(\"kEnemy_店主A\", entrance.home.mx, entrance.home.my);\r\n const behavior = entity.getEntityBehavior(LShopkeeperBehavior_1.LShopkeeperBehavior);\r\n behavior.setup(info.id(), e.index());\r\n }\r\n // アイテム配置\r\n const floorId = manager.map.floorId();\r\n const items = manager.map.land2().landData().appearanceTable.shop[floorId.floorNumber].filter(e => DEntityCategory_1.DEntityCategory.isItem(e.spawiInfo.entityData()));\r\n if (items.length > 0) {\r\n const spawnedItems = [];\r\n const center = UMovement_1.UMovement.getCenterOfRoom(room);\r\n for (let my = center.y - 1; my <= center.y + 1; my++) {\r\n for (let mx = center.x - 1; mx <= center.x + 1; mx++) {\r\n if (room.contains(mx, my)) {\r\n const data = manager.rand().select(items);\r\n const entity = SEntityFactory_1.SEntityFactory.newEntity(data.spawiInfo, floorId);\r\n MRLively_1.MRLively.world.transferEntity(entity, floorId, mx, my);\r\n spawnedItems.push(entity);\r\n // 値札をつける\r\n //entity._shopArticle._ownerShopStructureId = info.id();\r\n }\r\n }\r\n }\r\n info.setInitialItems(spawnedItems);\r\n }\r\n }\r\n setupEntranceBlocks(room) {\r\n const result = [];\r\n for (const block of room.getRoomInnerEntranceBlocks()) {\r\n let block1 = undefined;\r\n let block2 = undefined;\r\n if (block.mx == room.mx1) { // 部屋の左側\r\n block1 = this.getInRoomFloorBlock(room, block.mx, block.my - 1);\r\n block2 = this.getInRoomFloorBlock(room, block.mx, block.my + 1);\r\n }\r\n else if (block.mx == room.mx2) { // 部屋の右側\r\n block1 = this.getInRoomFloorBlock(room, block.mx, block.my - 1);\r\n block2 = this.getInRoomFloorBlock(room, block.mx, block.my + 1);\r\n }\r\n else if (block.my == room.my1) { // 部屋の上側\r\n block1 = this.getInRoomFloorBlock(room, block.mx - 1, block.my);\r\n block2 = this.getInRoomFloorBlock(room, block.mx + 1, block.my);\r\n }\r\n else if (block.my == room.my2) { // 部屋の下側\r\n block1 = this.getInRoomFloorBlock(room, block.mx - 1, block.my);\r\n block2 = this.getInRoomFloorBlock(room, block.mx + 1, block.my);\r\n }\r\n (0, Common_1.assert)(block1 || block2);\r\n block._shopkeeperLine = true;\r\n if (block1)\r\n block1._shopkeeperLine = true;\r\n if (block2)\r\n block2._shopkeeperLine = true;\r\n const home = block1 !== null && block1 !== void 0 ? block1 : block2;\r\n (0, Common_1.assert)(home);\r\n result.push({\r\n home: home,\r\n gate: block,\r\n });\r\n }\r\n return result;\r\n }\r\n getInRoomFloorBlock(room, mx, my) {\r\n if (!room.contains(mx, my))\r\n return undefined;\r\n const block = MRLively_1.MRLively.mapView.currentMap.tryGetBlock(mx, my);\r\n if (!block)\r\n return undefined;\r\n if (!block.isFloorLikeShape())\r\n return undefined;\r\n return block;\r\n }\r\n}\r\nexports.SItemShopBuilder = SItemShopBuilder;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/map/SItemShopBuilder.ts?"); /***/ }), /***/ "./ts/mr/system/map/SMonsterHouseBuilder.ts": /*!**************************************************!*\ !*** ./ts/mr/system/map/SMonsterHouseBuilder.ts ***! \**************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SMonsterHouseBuilder = void 0;\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst PluginParameters_1 = __webpack_require__(/*! ts/mr/PluginParameters */ \"./ts/mr/PluginParameters.ts\");\r\nclass SMonsterHouseBuilder {\r\n build(manager, info, rand) {\r\n const map = manager.map;\r\n const room = map.room(info.roomId());\r\n const blockCount = room.width * room.height;\r\n // Enemy\r\n const enemyCount = rand.nextIntWithMinMax(PluginParameters_1.paramMonsterHouseEnemiesMin, PluginParameters_1.paramMonsterHouseEnemiesMax + 1);\r\n for (let i = 0; i < enemyCount; i++) {\r\n const id = rand.nextIntWithMax(blockCount);\r\n const mx = room.mx1 + Math.floor(id % room.width);\r\n const my = room.my1 + Math.floor(id / room.width);\r\n const entities = manager.spawnEnemy(mx, my);\r\n for (const entity of entities) {\r\n entity.addState(MRBasics_1.MRBasics.states.monsterHouseSleepStateId);\r\n }\r\n }\r\n // Item & Trap\r\n const itemCount = rand.nextIntWithMinMax(PluginParameters_1.paramMonsterHouseItemsMin, PluginParameters_1.paramMonsterHouseItemsMax + 1);\r\n for (let i = 0; i < itemCount; i++) {\r\n const id = rand.nextIntWithMax(blockCount);\r\n const mx = room.mx1 + Math.floor(id % room.width);\r\n const my = room.my1 + Math.floor(id / room.width);\r\n const groundRD = 80;\r\n const rd = rand.nextIntWithMax(100);\r\n if (rd < groundRD) {\r\n if (rd < (groundRD / 2)) {\r\n manager.spawnItem(mx, my);\r\n }\r\n else {\r\n manager.spawnTrap(mx, my);\r\n }\r\n }\r\n }\r\n }\r\n}\r\nexports.SMonsterHouseBuilder = SMonsterHouseBuilder;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/map/SMonsterHouseBuilder.ts?"); /***/ }), /***/ "./ts/mr/system/scheduling/SChainAfterScheduler.ts": /*!*********************************************************!*\ !*** ./ts/mr/system/scheduling/SChainAfterScheduler.ts ***! \*********************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SChainAfterScheduler = void 0;\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ../SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst UAction_1 = __webpack_require__(/*! ts/mr/utility/UAction */ \"./ts/mr/utility/UAction.ts\");\r\nconst internal_1 = __webpack_require__(/*! ts/mr/lively/internal */ \"./ts/mr/lively/internal.ts\");\r\nconst LActivity_1 = __webpack_require__(/*! ts/mr/lively/activities/LActivity */ \"./ts/mr/lively/activities/LActivity.ts\");\r\nconst TStumble_1 = __webpack_require__(/*! ts/mr/transactions/TStumble */ \"./ts/mr/transactions/TStumble.ts\");\r\nvar SChainAfterSchedulerPhase;\r\n(function (SChainAfterSchedulerPhase) {\r\n SChainAfterSchedulerPhase[SChainAfterSchedulerPhase[\"Prologue\"] = 0] = \"Prologue\";\r\n SChainAfterSchedulerPhase[SChainAfterSchedulerPhase[\"StabilizeSituation\"] = 1] = \"StabilizeSituation\";\r\n SChainAfterSchedulerPhase[SChainAfterSchedulerPhase[\"PreviewDead\"] = 2] = \"PreviewDead\";\r\n SChainAfterSchedulerPhase[SChainAfterSchedulerPhase[\"ResolvePermanentDeath\"] = 3] = \"ResolvePermanentDeath\";\r\n SChainAfterSchedulerPhase[SChainAfterSchedulerPhase[\"Epilogue\"] = 4] = \"Epilogue\";\r\n})(SChainAfterSchedulerPhase || (SChainAfterSchedulerPhase = {}));\r\nclass SChainAfterScheduler {\r\n constructor() {\r\n this._phase = SChainAfterSchedulerPhase.Prologue;\r\n }\r\n reset() {\r\n this._phase = SChainAfterSchedulerPhase.Prologue;\r\n }\r\n isRunning() {\r\n return this._phase != SChainAfterSchedulerPhase.Epilogue;\r\n }\r\n isEnd() {\r\n return this._phase == SChainAfterSchedulerPhase.Epilogue;\r\n }\r\n process(cctx) {\r\n while (this.isRunning()) {\r\n switch (this._phase) {\r\n case SChainAfterSchedulerPhase.Prologue:\r\n this.process_Prologue(cctx);\r\n break;\r\n case SChainAfterSchedulerPhase.StabilizeSituation:\r\n this.process_StabilizeSituation(cctx);\r\n break;\r\n case SChainAfterSchedulerPhase.PreviewDead:\r\n this.process_PreviewDead(cctx);\r\n break;\r\n case SChainAfterSchedulerPhase.ResolvePermanentDeath:\r\n this.process_ResolvePermanentDeath(cctx);\r\n break;\r\n default:\r\n throw new Error(\"Unreachable.\");\r\n }\r\n if (cctx.isRunning) {\r\n break;\r\n }\r\n }\r\n }\r\n process_Prologue(cctx) {\r\n this._phase = SChainAfterSchedulerPhase.StabilizeSituation;\r\n }\r\n process_StabilizeSituation(cctx) {\r\n const currentMap = MRLively_1.MRLively.mapView.currentMap;\r\n {\r\n for (const entity of currentMap.entities()) {\r\n const block = currentMap.block(entity.mx, entity.my);\r\n const currentLayer = block.findEntityLayerKind(entity);\r\n if (currentLayer) {\r\n const homeLayer = entity.getHomeLayer();\r\n if (currentLayer != homeLayer) {\r\n UAction_1.UAction.postDropOrDestroyOnCurrentPos(cctx, entity, homeLayer);\r\n }\r\n }\r\n else {\r\n // 脱出の巻物などでマップを移動したときは、この時点で currentMap が変わっている。\r\n // また currentMap は MapData 未ロードである場合もある。\r\n }\r\n }\r\n }\r\n for (const entity of currentMap.entities()) {\r\n entity.iterateBehaviorsReverse(b => {\r\n b.onStabilizeSituation(entity, cctx);\r\n return true;\r\n });\r\n for (const fe of entity.fieldEffects()) {\r\n fe.onStabilizeSituation(cctx);\r\n }\r\n }\r\n this._phase = SChainAfterSchedulerPhase.PreviewDead;\r\n }\r\n process_PreviewDead(cctx) {\r\n for (const entity of MRLively_1.MRLively.mapView.currentMap.entities()) {\r\n if (entity.isDeathStateAffected()) {\r\n cctx.postActivity((new LActivity_1.LActivity()).setup(MRBasics_1.MRBasics.actions.dead, entity));\r\n }\r\n }\r\n this._phase = SChainAfterSchedulerPhase.ResolvePermanentDeath;\r\n }\r\n process_ResolvePermanentDeath(cctx) {\r\n // 戦闘不能の確定処理\r\n for (const entity of MRLively_1.MRLively.mapView.currentMap.entities()) {\r\n if (entity.isDeathStateAffected()) {\r\n let result = SCommand_1.SCommandResponse.Pass;\r\n entity.iterateBehaviorsReverse(b => {\r\n result = b.onPermanentDeath(entity, cctx);\r\n return result == SCommand_1.SCommandResponse.Pass;\r\n });\r\n if (result == SCommand_1.SCommandResponse.Pass) {\r\n cctx.postSequel(entity, MRBasics_1.MRBasics.sequels.CollapseSequel);\r\n TStumble_1.TStumble.postDropItems(cctx, entity, internal_1.LGenerateDropItemCause.Dead);\r\n cctx.postDestroy(entity);\r\n }\r\n }\r\n }\r\n this._phase = SChainAfterSchedulerPhase.Epilogue;\r\n }\r\n}\r\nexports.SChainAfterScheduler = SChainAfterScheduler;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/scheduling/SChainAfterScheduler.ts?"); /***/ }), /***/ "./ts/mr/system/scheduling/SScheduler.ts": /*!***********************************************!*\ !*** ./ts/mr/system/scheduling/SScheduler.ts ***! \***********************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SScheduler = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../../Common */ \"./ts/mr/Common.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../../lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ../MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst LScheduler_1 = __webpack_require__(/*! ts/mr/lively/LScheduler */ \"./ts/mr/lively/LScheduler.ts\");\r\nconst SStepScheduler_1 = __webpack_require__(/*! ./SStepScheduler */ \"./ts/mr/system/scheduling/SStepScheduler.ts\");\r\nconst SChainAfterScheduler_1 = __webpack_require__(/*! ./SChainAfterScheduler */ \"./ts/mr/system/scheduling/SChainAfterScheduler.ts\");\r\nclass SScheduler {\r\n constructor() {\r\n this._data = MRLively_1.MRLively.scheduler;\r\n this._stepScheduler = new SStepScheduler_1.SStepScheduler2(this);\r\n this._chainAfterScheduler = new SChainAfterScheduler_1.SChainAfterScheduler();\r\n this._brace = false;\r\n this._occupy = false;\r\n }\r\n reset() {\r\n this._data = MRLively_1.MRLively.scheduler;\r\n this._data.chedulerPhase = LScheduler_1.LSchedulerPhase.RoundStarting;\r\n this._stepScheduler.start();\r\n this._chainAfterScheduler.reset();\r\n this._brace = false;\r\n this._occupy = false;\r\n }\r\n data() {\r\n return this._data;\r\n }\r\n stepSimulation() {\r\n const dialogContext = MRSystem_1.MRSystem.dialogContext;\r\n const commandContext = MRSystem_1.MRSystem.commandContext;\r\n while (true) {\r\n //MRLively.camera.syncToFocusedEntity(dialogContext);\r\n // フレーム待ち\r\n //if (REGame.scheduler.updateWaiting()) {\r\n // break;\r\n //}\r\n // Sequel 終了待ち\r\n if (MRSystem_1.MRSystem.integration.checkVisualSequelRunning()) {\r\n // Sequel 実行中\r\n break;\r\n }\r\n // if (MRLively.camera.isFloorTransfering()) {\r\n // // マップ遷移中。\r\n // // postTransferFloor() の実行によって遷移が発生した場合は一度実行ループを抜けておかないと、\r\n // // 遷移が実際に行われる前に次のコマンド実行に進んでしまう。\r\n // break;\r\n // }\r\n if (this._brace) {\r\n this._brace = false;\r\n break;\r\n }\r\n /*\r\n if (RESystem.commandContext.visualAnimationWaiting()) {\r\n if (RESystem.integration.onCheckVisualSequelRunning()) {\r\n // Sequel 実行中\r\n break;\r\n }\r\n else {\r\n // Sequel 終了\r\n RESystem.commandContext.clearVisualAnimationWaiting();\r\n }\r\n }\r\n */\r\n // 現在のコマンドリストの実行は終了しているが、Visual 側がアニメーション中であれば完了を待ってから次の Unit の行動を始めたい\r\n if (!commandContext.isRunning && MRSystem_1.MRSystem.integration.checkVisualSequelRunning()) {\r\n break;\r\n }\r\n // Dialog 表示中でも update を抜けた時に詰まれているコマンドは実行されるようにしたい。\r\n // 向き変更なども Activity 化しておかないと、行動履歴が付けづらい。\r\n // そのため Dialog の update 前に Command 実行しておく。\r\n if (commandContext.isRunning) {\r\n commandContext._processCommand();\r\n if (!commandContext.isRunning) {\r\n // _processCommand() の後で isRunning が落ちていたら、\r\n // 実行中コマンドリストの実行が完了した。\r\n this.onCommandChainConsumed();\r\n }\r\n MRSystem_1.MRSystem.sequelContext.attemptFlush(false);\r\n continue;\r\n }\r\n let continue_cc = true;\r\n if (dialogContext._hasDialogModel()) {\r\n dialogContext._update();\r\n if (dialogContext._hasDialogModel()) {\r\n // Dialog 表示中は後続コマンドを実行しない\r\n break;\r\n }\r\n else {\r\n // update() で Dialog が Close された。\r\n // すぐに post されたコマンドの実行を始める。\r\n // こうしておかないと、移動 Sequel 開始までに 1Frame 空いてしまうため、一瞬遅延してみえてしまう。\r\n const entity = dialogContext.causeEntity();\r\n if (entity) {\r\n entity.immediatelyAfterAdjacentMoving = false;\r\n }\r\n continue_cc = false;\r\n }\r\n }\r\n if (continue_cc) {\r\n // 実行予約が溜まっているなら submit して実行開始する。\r\n // ※もともと callDecisionPhase() と後に毎回直接呼んでいたのだが、\r\n // onTurnEnd() などもサポートしはじめて呼び出し忘れが多くなった。\r\n // そもそもいつ呼び出すべきなのか分かりづらいので、submit の呼び出しは一元化する。\r\n //if (!commandContext.isRecordingListEmpty()) {\r\n // commandContext._submit(); // swap\r\n //}\r\n (0, Common_1.assert)(commandContext.isRecordingListEmpty);\r\n MRLively_1.MRLively.world._removeDestroyedObjects();\r\n this.stepSimulationInternal();\r\n }\r\n }\r\n this._occupy = false;\r\n }\r\n stepSimulationInternal() {\r\n switch (this._data.chedulerPhase) {\r\n case LScheduler_1.LSchedulerPhase.RoundStarting:\r\n this.update_RoundStarting();\r\n break;\r\n case LScheduler_1.LSchedulerPhase.Processing:\r\n this.update_ProcessPhase();\r\n break;\r\n case LScheduler_1.LSchedulerPhase.RoundEnding:\r\n this.update_RoundEnding();\r\n break;\r\n default:\r\n throw new Error(\"Unreachable.\");\r\n }\r\n }\r\n update_RoundStarting() {\r\n // 敵の生成など\r\n MRSystem_1.MRSystem.mapManager.updateRound();\r\n this._data.buildSchedulingUnits();\r\n this._data.dealActionTokens();\r\n this._data.chedulerPhase = LScheduler_1.LSchedulerPhase.Processing;\r\n this._occupy = true;\r\n this._stepScheduler.start();\r\n }\r\n update_ProcessPhase() {\r\n if (!this._stepScheduler.process()) {\r\n this._data.chedulerPhase = LScheduler_1.LSchedulerPhase.RoundEnding;\r\n }\r\n }\r\n update_RoundEnding() {\r\n MRLively_1.MRLively.chronus.advanceRound();\r\n //if (RESystem.sequelContext.isEmptySequelSet()) {\r\n if (this._occupy) {\r\n // RoundStart からここまで、一度もシミュレーションループから抜けなかった場合は一度制御を返すようにする。\r\n // こうしておかないとゲームがハングする。\r\n // マップにいるすべての Entity が状態異常等で行動不能な場合にこのケースが発生する。\r\n // マップ侵入後、方向キーを押しっぱなしにしておくと、Player の Move モーションが再生されず進行方向にワープしたように見えてしまう問題の対策。\r\n // 普通であれば ManualDialog が表示されている間はシミュレーションループは回らないので stepSimulation() から制御が返るが、\r\n // 押しっぱなしの場合 Dialog 表示→ キー入力判定 → 移動処理 → postSequel() が一気に行われる。\r\n // そのため RoundStarting → RoundEnding まで一度も制御を返さず来てしまうため、brace = true となり、1フレームだけ Idle Sequel を再生する猶予ができてしまった。\r\n if (MRSystem_1.MRSystem.sequelContext.isEmptySequelSet()) {\r\n this._brace = true;\r\n }\r\n }\r\n else {\r\n // ターン終了時に Sequel が残っていればすべて掃き出す\r\n MRSystem_1.MRSystem.sequelContext.flushSequelSet(false);\r\n }\r\n MRLively_1.MRLively.mapView.currentMap.updateFootpoints();\r\n this._data.chedulerPhase = LScheduler_1.LSchedulerPhase.RoundStarting;\r\n }\r\n // 遅延予約済みのコマンドすべて実行し終え、次のフェーズに進もうとしている状態。\r\n // ここで新たにコマンドを post すると、フェーズは進まず新たなコマンドチェーンを開始できる。\r\n onCommandChainConsumed() {\r\n if (!this._chainAfterScheduler.isEnd()) {\r\n this._chainAfterScheduler.process(MRSystem_1.MRSystem.commandContext);\r\n // SChainAfterScheduler 最後の Phase で詰まれたコマンドに対して繰り返し SChainAfterScheduler を回したいこともあるので、\r\n // 一連の処理が終わったら直ちにリセットしておく。\r\n // ※以前は process に入ってからリセットしていたが、それだと process に入る前に連続 post されたときに処理ができなくなる。\r\n if (this._chainAfterScheduler.isEnd()) {\r\n this._chainAfterScheduler.reset();\r\n }\r\n }\r\n }\r\n}\r\nexports.SScheduler = SScheduler;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/scheduling/SScheduler.ts?"); /***/ }), /***/ "./ts/mr/system/scheduling/SSchedulerPhase.ts": /*!****************************************************!*\ !*** ./ts/mr/system/scheduling/SSchedulerPhase.ts ***! \****************************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SSchedulerPhase = void 0;\r\nclass SSchedulerPhase {\r\n onStart() { }\r\n onAfterProcess(entity) { }\r\n // Phase 終了時に1度呼ばれる\r\n onEnd(scheduler) { }\r\n}\r\nexports.SSchedulerPhase = SSchedulerPhase;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/scheduling/SSchedulerPhase.ts?"); /***/ }), /***/ "./ts/mr/system/scheduling/SSchedulerPhaseImpl.ts": /*!********************************************************!*\ !*** ./ts/mr/system/scheduling/SSchedulerPhaseImpl.ts ***! \********************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SSchedulerPhase_AIMajorAction = exports.SSchedulerPhase_CheckFeetMoved = exports.SSchedulerPhase_ResolveAdjacentAndMovingTarget = exports.SSchedulerPhase_AIMinorAction = exports.SSchedulerPhase_ManualAction = void 0;\r\nconst LBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ../MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst UAction_1 = __webpack_require__(/*! ../../utility/UAction */ \"./ts/mr/utility/UAction.ts\");\r\nconst LItemShopStructure_1 = __webpack_require__(/*! ../../lively/structures/LItemShopStructure */ \"./ts/mr/lively/structures/LItemShopStructure.ts\");\r\nconst SSchedulerPhase_1 = __webpack_require__(/*! ./SSchedulerPhase */ \"./ts/mr/system/scheduling/SSchedulerPhase.ts\");\r\nconst Common_1 = __webpack_require__(/*! ../../Common */ \"./ts/mr/Common.ts\");\r\n// export class SSchedulerPhase_Prepare extends SSchedulerPhase {\r\n// testProcessable(entity: LEntity, unitBehavior: LUnitBehavior): boolean {\r\n// return true;\r\n// }\r\n// onProcess(entity: LEntity, unitBehavior: LUnitBehavior): void {\r\n// if (entity) {\r\n// entity._callDecisionPhase(RESystem.commandContext, DecisionPhase.Prepare);\r\n// }\r\n// }\r\n// }\r\nclass SSchedulerPhase_ManualAction extends SSchedulerPhase_1.SSchedulerPhase {\r\n isAllowIterationAtPrepare() {\r\n return false;\r\n }\r\n onStart() {\r\n // マップ移動に伴う初期配置後、onLocatedEntity イベントを発行したい\r\n MRLively_1.MRLively.mapView.currentMap.updateLocatedResults(MRSystem_1.MRSystem.commandContext);\r\n }\r\n testProcessable(entity, unitBehavior) {\r\n return unitBehavior.manualMovement() && entity._actionToken.canMajorAction();\r\n }\r\n onProcess(entity, unitBehavior) {\r\n (0, Common_1.assert)(this.testProcessable(entity, unitBehavior));\r\n // 倍速対策。Pallarel 付きでも強制的に Flush.\r\n MRSystem_1.MRSystem.sequelContext.flushSequelSet(false);\r\n entity._callDecisionPhase(MRSystem_1.MRSystem.commandContext, LBehavior_1.DecisionPhase.Manual);\r\n }\r\n}\r\nexports.SSchedulerPhase_ManualAction = SSchedulerPhase_ManualAction;\r\n// モンスターの移動・攻撃対象決定\r\nclass SSchedulerPhase_AIMinorAction extends SSchedulerPhase_1.SSchedulerPhase {\r\n isAllowIterationAtPrepare() {\r\n // 移動フェーズでは、iteration を組んでまとめて移動は禁止。\r\n // ステート更新は全 Entity の移動が終わった後に行いたいので、\r\n // こうしておかないと倍速モンスターのステートターン数が余分に出てしまう。\r\n return false;\r\n }\r\n onStart() {\r\n for (const s of MRLively_1.MRLively.mapView.currentMap.structures()) {\r\n if (s instanceof LItemShopStructure_1.LItemShopStructure) {\r\n }\r\n }\r\n }\r\n testProcessable(entity, unitBehavior) {\r\n return !unitBehavior.manualMovement() &&\r\n entity._actionToken.canMinorAction() &&\r\n unitBehavior._targetingEntityId <= 0; // Minor では行動対象決定の判定も見る\r\n }\r\n onProcess(entity, unitBehavior) {\r\n (0, Common_1.assert)(this.testProcessable(entity, unitBehavior));\r\n entity._callDecisionPhase(MRSystem_1.MRSystem.commandContext, LBehavior_1.DecisionPhase.AIMinor);\r\n }\r\n onEnd(scheduler) {\r\n for (const unit of scheduler.data()._schedulingUnits) {\r\n if (unit.isValid()) {\r\n const unitBehavior = unit.unitBehavior();\r\n if (unitBehavior.requiredTrapProcess() ||\r\n unitBehavior.requiredFeetProcess()) { // 足元 Dialog の前処理がしたい\r\n UAction_1.UAction.postPreStepFeetProcess(MRSystem_1.MRSystem.commandContext, unit.entity());\r\n unitBehavior.clearTrapProcess();\r\n }\r\n }\r\n }\r\n // ここまでの Phase で \"歩行\" Sequel のみ発生している場合に備え、\r\n // 罠の上へ移動している動きにしたいのでここで Flush.\r\n //RESystem.sequelContext.flushSequelSet();\r\n //RESystem.sequelContext.attemptFlush(!RESystem.sequelContext.isMoveOnly());\r\n //RESystem.sequelContext.attemptFlush(false);\r\n MRSystem_1.MRSystem.sequelContext.attemptFlush(MRSystem_1.MRSystem.sequelContext.trapPerforming);\r\n MRSystem_1.MRSystem.sequelContext.trapPerforming = false;\r\n // true で実行しないと、このあとの stumble に伴う drop が、Move と並列実行されてしまう。\r\n // 先に Move は Flush しておきたい。\r\n // しかしこの時点ではまだ罠の発動判定をしていないので、true にしても効果が無い。\r\n // でももしワナの発動が無かったら、false のまま実行したい。\r\n // → 罠の発動判定と、発動処理を別にしなければならないかも。\r\n // TODO: 発動 trap リストをどこかに作っておきたい\r\n for (const entity of MRLively_1.MRLively.mapView.currentMap.entities()) {\r\n UAction_1.UAction.postAttemptPerformStepFeetProcess(MRSystem_1.MRSystem.commandContext, entity);\r\n }\r\n // ステート更新は全 Entity の移動が終わった後に行いたい\r\n // let feetRequired = false;\r\n for (const unit of scheduler.data()._schedulingUnits) {\r\n if (unit.isValid()) {\r\n const entity = unit.entity();\r\n // - Manual の場合はここで必ずステート更新\r\n // - NPC の場合は、移動が発生していたら更新\r\n if (unit.isManual() ||\r\n entity._schedulingResult.consumedActionToken(scheduler.data().currentPhaseIndex()) !== undefined) {\r\n entity._callDecisionPhase(MRSystem_1.MRSystem.commandContext, LBehavior_1.DecisionPhase.UpdateState);\r\n entity._schedulingResult.stateUpdatedInRun = true;\r\n }\r\n // 現在 step 内で何らかのトークン消費があった場合は行動が発生したとみなし、それに関する処理を行う\r\n //if () {\r\n //}\r\n // if (unit.unitBehavior().requiredFeetProcess()) {\r\n // feetRequired = true;\r\n // }\r\n }\r\n }\r\n // if (feetRequired) {\r\n // RESystem.sequelContext.attemptFlush(true);\r\n // }\r\n // else {\r\n // RESystem.sequelContext.attemptFlush(false);\r\n // }\r\n // 罠の処理は Phase 終了時に行う必要がある。\r\n // 罠の発動タイミングは Minor と Major で異なる点に注意。\r\n // Minor では、Phase終了時、つまり全 Unit の1回分(≒1Block分)の移動が終わった時に行う必要がある。\r\n for (const unit of scheduler.data()._schedulingUnits) {\r\n if (unit.isValid()) {\r\n const unitBehavior = unit.unitBehavior();\r\n if (unitBehavior.requiredFeetProcess()) {\r\n UAction_1.UAction.postStepOnGround(MRSystem_1.MRSystem.commandContext, unit.entity());\r\n unitBehavior.clearFeetProcess();\r\n }\r\n }\r\n }\r\n }\r\n}\r\nexports.SSchedulerPhase_AIMinorAction = SSchedulerPhase_AIMinorAction;\r\n// 状態異常の発動・解除、HPの自然回復・減少\r\n/*\r\nexport class SSchedulerPhase_UpdateState extends SSchedulerPhase {\r\n onProcess(unit: UnitInfo): void {\r\n const entity = REGame.world.findEntity(unit.entityId);\r\n if (entity) {\r\n entity._callDecisionPhase(RESystem.commandContext, DecisionPhase.UpdateState);\r\n }\r\n }\r\n}\r\n*/\r\n// 敵対勢力の入室・退室・隣接によるモンスターの浅い眠り状態解除・目的地設定\r\nclass SSchedulerPhase_ResolveAdjacentAndMovingTarget extends SSchedulerPhase_1.SSchedulerPhase {\r\n isAllowIterationAtPrepare() {\r\n return false;\r\n }\r\n onStart() {\r\n MRLively_1.MRLively.mapView.currentMap.updateLocatedResults(MRSystem_1.MRSystem.commandContext);\r\n }\r\n testProcessable(entity, unitBehavior) {\r\n return true;\r\n }\r\n onProcess(entity, unitBehavior) {\r\n (0, Common_1.assert)(this.testProcessable(entity, unitBehavior));\r\n entity._callDecisionPhase(MRSystem_1.MRSystem.commandContext, LBehavior_1.DecisionPhase.ResolveAdjacentAndMovingTarget);\r\n }\r\n}\r\nexports.SSchedulerPhase_ResolveAdjacentAndMovingTarget = SSchedulerPhase_ResolveAdjacentAndMovingTarget;\r\n// 罠発動\r\nclass SSchedulerPhase_CheckFeetMoved extends SSchedulerPhase_1.SSchedulerPhase {\r\n isAllowIterationAtPrepare() {\r\n return false;\r\n }\r\n onStart() {\r\n // ここまでの Phase で \"歩行\" Sequel のみ発生している場合に備え、\r\n // 罠の上へ移動している動きにしたいのでここで Flush.\r\n //RESystem.sequelContext.flushSequelSet();\r\n MRSystem_1.MRSystem.sequelContext.attemptFlush(true);\r\n }\r\n testProcessable(entity, unitBehavior) {\r\n return unitBehavior.requiredFeetProcess();\r\n }\r\n onProcess(entity, unitBehavior) {\r\n (0, Common_1.assert)(this.testProcessable(entity, unitBehavior));\r\n if (unitBehavior.requiredFeetProcess()) {\r\n UAction_1.UAction.postStepOnGround(MRSystem_1.MRSystem.commandContext, entity);\r\n unitBehavior.clearFeetProcess();\r\n }\r\n }\r\n}\r\nexports.SSchedulerPhase_CheckFeetMoved = SSchedulerPhase_CheckFeetMoved;\r\nclass SSchedulerPhase_AIMajorAction extends SSchedulerPhase_1.SSchedulerPhase {\r\n isAllowIterationAtPrepare() {\r\n return true;\r\n }\r\n testProcessable(entity, unitBehavior) {\r\n return !unitBehavior.manualMovement() && entity._actionToken.canMajorAction();\r\n }\r\n onProcess(entity, unitBehavior) {\r\n //assert(this.testProcessable(entity, unitBehavior));\r\n if (this.testProcessable(entity, unitBehavior)) {\r\n entity._callDecisionPhase(MRSystem_1.MRSystem.commandContext, LBehavior_1.DecisionPhase.AIMajor);\r\n // if (entity._schedulingResult.consumedActionToken(scheduler.data().currentPhaseIndex()) !== undefined) {\r\n // }\r\n if (!entity._schedulingResult.stateUpdatedInRun) {\r\n entity._callDecisionPhase(MRSystem_1.MRSystem.commandContext, LBehavior_1.DecisionPhase.UpdateState);\r\n entity._schedulingResult.stateUpdatedInRun = true;\r\n }\r\n }\r\n }\r\n}\r\nexports.SSchedulerPhase_AIMajorAction = SSchedulerPhase_AIMajorAction;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/scheduling/SSchedulerPhaseImpl.ts?"); /***/ }), /***/ "./ts/mr/system/scheduling/SStepScheduler.ts": /*!***************************************************!*\ !*** ./ts/mr/system/scheduling/SStepScheduler.ts ***! \***************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SStepScheduler2 = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../../Common */ \"./ts/mr/Common.ts\");\r\nconst LCommon_1 = __webpack_require__(/*! ../../lively/LCommon */ \"./ts/mr/lively/LCommon.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../../lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ../MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst SCommon_1 = __webpack_require__(/*! ../SCommon */ \"./ts/mr/system/SCommon.ts\");\r\nconst SSchedulerPhaseImpl_1 = __webpack_require__(/*! ./SSchedulerPhaseImpl */ \"./ts/mr/system/scheduling/SSchedulerPhaseImpl.ts\");\r\n// SScheduler が複雑になってきたので、Run 1つ分の実行部分を分離したもの。\r\n// Note:\r\n// - Run は複数の Phase から成る\r\n// - 1つの Phase では全 Entity に対して Process を実行する\r\nclass SStepScheduler2 {\r\n constructor(scheduler) {\r\n this._scheduler = scheduler;\r\n this._data = scheduler.data();\r\n this._cctx = MRSystem_1.MRSystem.commandContext;\r\n this._stepPhase = SCommon_1.SStepPhase.RunStarting;\r\n this._phases = [\r\n //new SSchedulerPhase_Prepare(),\r\n new SSchedulerPhaseImpl_1.SSchedulerPhase_ManualAction(),\r\n new SSchedulerPhaseImpl_1.SSchedulerPhase_AIMinorAction(),\r\n //new SSchedulerPhase_UpdateState(),\r\n new SSchedulerPhaseImpl_1.SSchedulerPhase_ResolveAdjacentAndMovingTarget(),\r\n //new SSchedulerPhase_CheckFeetMoved(),\r\n new SSchedulerPhaseImpl_1.SSchedulerPhase_AIMajorAction(),\r\n ];\r\n (0, Common_1.assert)(this._phases.length == LCommon_1.phaseCount);\r\n }\r\n start() {\r\n this._data = this._scheduler.data();\r\n this._data.nextSearchIndex = 0;\r\n this._data._currentPhaseIndex = -1;\r\n this._stepPhase = SCommon_1.SStepPhase.RunStarting;\r\n // Reset attack/move target\r\n for (const unit of this._data.schedulingUnits()) {\r\n if (unit.isValid()) {\r\n unit.unitBehavior()._targetingEntityId = 0;\r\n }\r\n }\r\n }\r\n process() {\r\n (0, Common_1.assert)(this._stepPhase != SCommon_1.SStepPhase.Closed);\r\n while (true) {\r\n if (this.isSequenceClosed()) {\r\n break;\r\n }\r\n if (MRSystem_1.MRSystem.commandContext.isRunning) {\r\n break;\r\n }\r\n this.processCore2();\r\n }\r\n return !this.isSequenceClosed();\r\n }\r\n isSequenceClosed() {\r\n return this._stepPhase == SCommon_1.SStepPhase.Closed;\r\n }\r\n currentPhase() {\r\n const index = this._data.currentPhaseIndex();\r\n (0, Common_1.assert)(0 <= index && index < this._phases.length);\r\n return this._phases[index];\r\n }\r\n processCore2() {\r\n switch (this._stepPhase) {\r\n case SCommon_1.SStepPhase.RunStarting:\r\n this.process_RunStarting();\r\n break;\r\n case SCommon_1.SStepPhase.PhaseStarting:\r\n this.process_PhaseStarting();\r\n break;\r\n case SCommon_1.SStepPhase.StepStarting:\r\n this.process_StepStarting();\r\n break;\r\n case SCommon_1.SStepPhase.MainProcess:\r\n this.process_MainProcess();\r\n break;\r\n case SCommon_1.SStepPhase.MainProcessClosing:\r\n this.process_MainProcessClosing();\r\n break;\r\n case SCommon_1.SStepPhase.AfterProcess:\r\n this.process_AfterProcess();\r\n break;\r\n case SCommon_1.SStepPhase.AfterProcessClosing:\r\n this.process_AfterProcessClosing();\r\n break;\r\n case SCommon_1.SStepPhase.StepClosing:\r\n this.process_StepClosing();\r\n break;\r\n case SCommon_1.SStepPhase.PhaseClosing:\r\n this.process_PhaseClosing();\r\n break;\r\n case SCommon_1.SStepPhase.RunClosing:\r\n this.process_RunClosing();\r\n break;\r\n case SCommon_1.SStepPhase.Closed:\r\n throw new Error(\"Unreachable.\");\r\n default:\r\n throw new Error(\"Unreachable.\");\r\n }\r\n }\r\n process_RunStarting() {\r\n for (const unit of this._data.schedulingUnits()) {\r\n if (unit.isValid()) {\r\n unit.entity()._schedulingResult.clear();\r\n }\r\n }\r\n if (this._data.schedulingUnits().length <= 0) {\r\n // Unit がひとつもない。何もする必要はない。(プレイヤーは常に存在しているはずなので、通常、ここに来ることは無い)\r\n this._stepPhase = SCommon_1.SStepPhase.RunClosing;\r\n }\r\n else {\r\n this._data._currentPhaseIndex = -1;\r\n this._stepPhase = SCommon_1.SStepPhase.PhaseStarting;\r\n }\r\n }\r\n process_PhaseStarting() {\r\n this._data.resetSeek();\r\n this._data._currentPhaseIndex++;\r\n if (this._data._currentPhaseIndex >= this._phases.length) {\r\n // 全 Phase 実行完了\r\n this._stepPhase = SCommon_1.SStepPhase.RunClosing;\r\n }\r\n else {\r\n this.currentPhase().onStart();\r\n this._stepPhase = SCommon_1.SStepPhase.StepStarting;\r\n }\r\n }\r\n process_StepStarting() {\r\n if (this._data.nextUnit(this.currentPhase())) {\r\n this._stepPhase = SCommon_1.SStepPhase.MainProcess;\r\n }\r\n else {\r\n // currentPhase で実行の必要があるものはすべて終えた\r\n this._stepPhase = SCommon_1.SStepPhase.PhaseClosing;\r\n }\r\n }\r\n process_MainProcess() {\r\n const unit = this._data.currentUnit();\r\n if (unit.isValid()) {\r\n this.currentPhase().onProcess(unit.entity(), unit.unitBehavior());\r\n }\r\n // この後は、\r\n // - もし onProcess で Command が詰まれていれば一度 process から抜けたのち、process_MainProcessClosing() へ移る。\r\n // - Command が詰まれなかったら process を抜けずに process_MainProcessClosing() へ移る。\r\n this._stepPhase = SCommon_1.SStepPhase.MainProcessClosing;\r\n }\r\n process_MainProcessClosing() {\r\n this._stepPhase = SCommon_1.SStepPhase.AfterProcess;\r\n }\r\n process_AfterProcess() {\r\n for (const entity of MRLively_1.MRLively.mapView.currentMap.entities()) {\r\n entity._callBehaviorIterationHelper(behavior => behavior.onAfterStep(entity, MRSystem_1.MRSystem.commandContext));\r\n }\r\n // この後の流れは process_MainProcessClosing と同様。必要であれば一度 process を抜ける。\r\n this._stepPhase = SCommon_1.SStepPhase.AfterProcessClosing;\r\n }\r\n process_AfterProcessClosing() {\r\n this._stepPhase = SCommon_1.SStepPhase.StepClosing;\r\n }\r\n process_StepClosing() {\r\n const unit = this._data.currentUnit();\r\n unit.increaseIterationCount();\r\n this.onStepProcessEnd(unit);\r\n if (unit.isIterationClosed()) {\r\n if (this._data.isSeeking()) {\r\n // まだ実行するべき Step があるかも。(実際に next してみるまではわからない)\r\n this._stepPhase = SCommon_1.SStepPhase.StepStarting;\r\n }\r\n else {\r\n // Step の実行が終わった。Phase 終了。\r\n this._stepPhase = SCommon_1.SStepPhase.PhaseClosing;\r\n }\r\n }\r\n else {\r\n // まだ iterationCount が残っているので、同じ Step を再び実行する\r\n this._stepPhase = SCommon_1.SStepPhase.MainProcess;\r\n }\r\n }\r\n process_PhaseClosing() {\r\n this.currentPhase().onEnd(this._scheduler);\r\n this._stepPhase = SCommon_1.SStepPhase.PhaseStarting;\r\n }\r\n process_RunClosing() {\r\n //if (this._data.hasReadyEntity()) {\r\n //console.log(\"まだ行動できる Entity が残っている\");\r\n // まだ行動できる Entity が残っている場合は Run を続ける\r\n this._data.currentRunIndex++;\r\n if (this._data.currentRunIndex >= this._data.maxRunCount) {\r\n this._stepPhase = SCommon_1.SStepPhase.Closed;\r\n }\r\n else {\r\n this._stepPhase = SCommon_1.SStepPhase.RunStarting;\r\n }\r\n }\r\n // onProcess ひとつから発行されるコマンドチェーンを実行し終えたタイミング。\r\n // Manual, Minor, Major 等フェーズのたびに発生する。\r\n onStepProcessEnd(unit) {\r\n //if (this._stepPhase == SStepPhase.AfterProcess) {\r\n // REGame.scheduler.actorEntities().forEach(entity => {\r\n // entity._callBehaviorIterationHelper(behavior => behavior.onStepEnd(RESystem.commandContext));\r\n // });\r\n // Trap の状態リセットも行いたいので、マップ上の全 Entity に対して通知する\r\n for (const entity of MRLively_1.MRLively.mapView.currentMap.entities()) {\r\n entity._callBehaviorIterationHelper(behavior => behavior.onStepEnd(MRSystem_1.MRSystem.commandContext));\r\n }\r\n //}\r\n if (unit.isValid()) {\r\n const entity = unit.entity();\r\n //entity._effectResult.showResultMessages(RESystem.commandContext, entity);\r\n entity._reward.apply(entity);\r\n entity._effectResult.showResultMessages(MRSystem_1.MRSystem.commandContext, entity);\r\n entity._effectResult.clear();\r\n }\r\n this._data.attemptRefreshSpeedLevel();\r\n }\r\n}\r\nexports.SStepScheduler2 = SStepScheduler2;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/scheduling/SStepScheduler.ts?"); /***/ }), /***/ "./ts/mr/system/tasks/STask.ts": /*!*************************************!*\ !*** ./ts/mr/system/tasks/STask.ts ***! \*************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SSubTaskChain = exports.STaskResult = exports.STaskCallMethod = exports.STask = exports.STaskStatus = exports.STaskYieldResult = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ../SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nvar STaskYieldResult;\r\n(function (STaskYieldResult) {\r\n STaskYieldResult[STaskYieldResult[\"Running\"] = 0] = \"Running\";\r\n STaskYieldResult[STaskYieldResult[\"Reject\"] = 1] = \"Reject\";\r\n STaskYieldResult[STaskYieldResult[\"Success\"] = 2] = \"Success\";\r\n STaskYieldResult[STaskYieldResult[\"Accept\"] = 3] = \"Accept\";\r\n})(STaskYieldResult = exports.STaskYieldResult || (exports.STaskYieldResult = {}));\r\nvar STaskStatus;\r\n(function (STaskStatus) {\r\n STaskStatus[STaskStatus[\"Created\"] = 0] = \"Created\";\r\n STaskStatus[STaskStatus[\"Pending\"] = 1] = \"Pending\";\r\n STaskStatus[STaskStatus[\"Running\"] = 2] = \"Running\";\r\n STaskStatus[STaskStatus[\"Succeeded\"] = 3] = \"Succeeded\";\r\n STaskStatus[STaskStatus[\"Handled\"] = 4] = \"Handled\";\r\n})(STaskStatus = exports.STaskStatus || (exports.STaskStatus = {}));\r\nclass STask {\r\n constructor(name, entryFunc, chainFunc, prev) {\r\n this._callMethod = STaskCallMethod.Default;\r\n this._whenWaitingTasks = []; // whenAny, whenAll で指定された Task. これらの Task が全て完了したら、この Task を実行する。\r\n (0, Common_1.assert)(!(entryFunc && chainFunc));\r\n this._status = STaskStatus.Created;\r\n this._name = name;\r\n this._entryFunc = entryFunc;\r\n this._chainFunc = chainFunc;\r\n //this._result = STaskResult.Succeeded;\r\n //this._prev = prev;\r\n }\r\n get isCompleted() { return this._status > STaskStatus.Running; }\r\n then(func) {\r\n (0, Common_1.assert)(!this._nextTask);\r\n const task = this.thenTask(new STask(\"then\", undefined, func));\r\n return task;\r\n }\r\n then2(func) {\r\n (0, Common_1.assert)(this._subChain);\r\n const task = this.thenTask(new STask(\"then\", undefined, undefined));\r\n task._subChain = this._subChain;\r\n task._thenFunc2 = func;\r\n return task;\r\n }\r\n thenTask(task) {\r\n (0, Common_1.assert)(!this._nextTask);\r\n (0, Common_1.assert)(task._status == STaskStatus.Created);\r\n task._status = STaskStatus.Pending;\r\n this._nextTask = task;\r\n return this._nextTask;\r\n }\r\n // SCommand で thenTask() するユーティリティ\r\n thenCommandTask(cmd) {\r\n (0, Common_1.assert)(this._subChain);\r\n const cctx = this._subChain._ctx;\r\n return this.thenTask(cctx.makeCommandTask(cmd));\r\n }\r\n catch(func) {\r\n (0, Common_1.assert)(!this._catchFunc);\r\n this._catchFunc = func;\r\n return this;\r\n }\r\n finally(func) {\r\n (0, Common_1.assert)(this._subChain);\r\n (0, Common_1.assert)(!this._nextTask);\r\n const task = this.thenTask(new STask(\"finally\", undefined, undefined));\r\n task._subChain = this._subChain;\r\n task._finallyFunc = func;\r\n return task;\r\n }\r\n call(cctx) {\r\n (0, Common_1.assert)(this._status == STaskStatus.Pending);\r\n this._status = STaskStatus.Running;\r\n if (this._callMethod == STaskCallMethod.Default) {\r\n // deprecated\r\n // if (this._result == STaskResult.Rejected) {\r\n // // if (this._catchFunc) {\r\n // // this._catchFunc();\r\n // // }\r\n // throw new Error();\r\n // }\r\n // else {\r\n // const c: STaskChain = {\r\n // resolve: () => {\r\n // this._result = STaskResult.Succeeded;\r\n // this.setNextPriorityTaskIfNeeded(cctx);\r\n // },\r\n // reject: () => {\r\n // this._result = STaskResult.Rejected;\r\n // },\r\n // _command: this,\r\n // };\r\n if (this._entryFunc) {\r\n this._status = (this._entryFunc() != SCommand_1.SCommandResponse.Canceled) ? STaskStatus.Succeeded : STaskStatus.Handled;\r\n }\r\n else if (this._chainFunc) {\r\n this._status = (this._chainFunc()) ? STaskStatus.Succeeded : STaskStatus.Handled;\r\n }\r\n if (this._status != STaskStatus.Handled) {\r\n // つながっている Task があれば、次にそれを実行してみる\r\n if (this._nextTask && !this._subChain) {\r\n cctx._setNextPriorityTask(this._nextTask);\r\n }\r\n }\r\n // }\r\n }\r\n else {\r\n (0, Common_1.assert)(this._subChain);\r\n cctx.pushSubTaskChain(this._subChain);\r\n if (this._callMethod == STaskCallMethod.When) {\r\n const status = this.checkWaitingTasksStatus();\r\n if (status == STaskStatus.Succeeded) {\r\n // ここでは next() せず、prologueCalling() の処理と共に next() する\r\n }\r\n else {\r\n this._subChain.reject();\r\n }\r\n this.prologueCalling(undefined);\r\n }\r\n else if (this._callMethod == STaskCallMethod.Then) {\r\n if (this._finallyFunc) {\r\n this._finallyFunc(this._subChain);\r\n this.prologueCalling(undefined);\r\n }\r\n else {\r\n (0, Common_1.assert)(this._thenFunc2);\r\n const blockTask = this._thenFunc2(this._subChain);\r\n this.prologueCalling(blockTask);\r\n }\r\n }\r\n else if (this._callMethod == STaskCallMethod.Iterator) {\r\n (0, Common_1.assert)(this._iterator);\r\n const result = this._iterator.next();\r\n if (result.done) {\r\n if (this._onIteratorFinalized)\r\n this._onIteratorFinalized(STaskYieldResult.Success);\r\n // goto next.\r\n }\r\n else if (result.value == STaskYieldResult.Running) {\r\n return true;\r\n }\r\n else if (result.value == STaskYieldResult.Reject) {\r\n if (this._onIteratorFinalized)\r\n this._onIteratorFinalized(result.value);\r\n // goto next.\r\n }\r\n else if (result.value == STaskYieldResult.Success) {\r\n if (this._onIteratorFinalized)\r\n this._onIteratorFinalized(result.value);\r\n // goto next.\r\n }\r\n else if (result.value == STaskYieldResult.Accept) {\r\n if (this._onIteratorFinalized)\r\n this._onIteratorFinalized(result.value);\r\n // goto next.\r\n }\r\n else {\r\n throw new Error(\"Unreachable.\");\r\n }\r\n }\r\n else {\r\n (0, Common_1.assert)(this._catchFunc);\r\n this._catchFunc(this._subChain);\r\n this.prologueCalling(undefined);\r\n }\r\n cctx.popSubTaskChain(this._subChain);\r\n }\r\n return false;\r\n }\r\n prologueCalling(blockTask) {\r\n (0, Common_1.assert)(this._subChain);\r\n if (this._status != STaskStatus.Running) {\r\n // ハンドラ内でユーザーが明示的に next() や reject() した場合は、自動的な next() 呼び出しは不要。\r\n }\r\n else if (this._subChain._holding) {\r\n // hold() が呼ばれた場合、ユーザーは明示的に next() や reject() を呼ばなければならない。\r\n }\r\n else { // 上記以外は自動的に next() する\r\n if (blockTask) {\r\n blockTask._blockingTask = this;\r\n }\r\n else {\r\n if (this._blockingTask) {\r\n (0, Common_1.assert)(this._blockingTask._subChain);\r\n this._blockingTask._subChain.next();\r\n }\r\n this._subChain.next();\r\n }\r\n }\r\n }\r\n // ひとつでも実行中であれば Runnning, ひとつでも Rejected なら Rejected. すべて成功しているなら Succeeded.\r\n checkWaitingTasksStatus() {\r\n let status = STaskStatus.Succeeded;\r\n for (let task of this._whenWaitingTasks) {\r\n if (task._status == STaskStatus.Running) {\r\n status = STaskStatus.Running;\r\n break;\r\n }\r\n else if (task._status == STaskStatus.Handled) {\r\n status = STaskStatus.Handled;\r\n break;\r\n }\r\n }\r\n return status;\r\n }\r\n setNextPriorityTaskIfNeeded(ctx) {\r\n if (this._nextTask) {\r\n ctx._setNextPriorityTask(this._nextTask);\r\n }\r\n }\r\n}\r\nexports.STask = STask;\r\nvar STaskCallMethod;\r\n(function (STaskCallMethod) {\r\n STaskCallMethod[STaskCallMethod[\"Default\"] = 0] = \"Default\";\r\n STaskCallMethod[STaskCallMethod[\"Then\"] = 1] = \"Then\";\r\n STaskCallMethod[STaskCallMethod[\"Catch\"] = 2] = \"Catch\";\r\n STaskCallMethod[STaskCallMethod[\"When\"] = 3] = \"When\";\r\n STaskCallMethod[STaskCallMethod[\"Iterator\"] = 4] = \"Iterator\";\r\n})(STaskCallMethod = exports.STaskCallMethod || (exports.STaskCallMethod = {}));\r\nvar STaskChainMethod;\r\n(function (STaskChainMethod) {\r\n STaskChainMethod[STaskChainMethod[\"Next\"] = 0] = \"Next\";\r\n STaskChainMethod[STaskChainMethod[\"Handled\"] = 1] = \"Handled\";\r\n})(STaskChainMethod || (STaskChainMethod = {}));\r\nvar STaskResult;\r\n(function (STaskResult) {\r\n STaskResult[STaskResult[\"Reject\"] = 0] = \"Reject\";\r\n STaskResult[STaskResult[\"Accept\"] = 1] = \"Accept\";\r\n})(STaskResult = exports.STaskResult || (exports.STaskResult = {}));\r\n/**\r\n * コンストラクタで指定された Task の実行状態の管理及び、次の Task の実行を行う。\r\n * インスタンスは基本的に cctx.postTask() の時に作られる。\r\n * STask の then() したときには新しいインスタンスは作られない。\r\n */\r\nclass SSubTaskChain {\r\n // /**\r\n // * 明示的に accept() が呼ばれたときに、次の Task が実行されるようにするかどうか。\r\n // */\r\n // requireExplicitAccept: boolean = false;\r\n constructor(ctx, task) {\r\n this._ctx = ctx;\r\n this._currentTask = task;\r\n this._error = false;\r\n this._errorHandled = false;\r\n this._postedMethod = STaskChainMethod.Next;\r\n this._taskResult = undefined; //STaskResult.Accept;\r\n this._holding = false;\r\n }\r\n get allowReject() { return this._currentTask !== undefined && (this._currentTask.command === undefined || !this._currentTask.command.acceptRequired); }\r\n get allowAccept() { return this._currentTask !== undefined && (this._currentTask.command !== undefined && this._currentTask.command.acceptRequired); }\r\n hold() {\r\n this._holding = true;\r\n }\r\n next() {\r\n this._postedMethod = STaskChainMethod.Next;\r\n this._holding = false;\r\n this.processOrPost();\r\n }\r\n accept() {\r\n if (!this.allowAccept)\r\n throw new Error((0, Common_1.tr2)(\"このコマンド %1 では accept() は呼び出せません。\").format(this.makeCommandName()));\r\n this.handleInternal(STaskResult.Accept);\r\n }\r\n reject() {\r\n if (!this.allowReject)\r\n throw new Error((0, Common_1.tr2)(\"このコマンド %1 では reject() は呼び出せません。\").format(this.makeCommandName()));\r\n this.handleInternal(STaskResult.Reject);\r\n }\r\n handleInternal(taskResult) {\r\n this._postedMethod = STaskChainMethod.Handled;\r\n this._taskResult = taskResult;\r\n this._holding = false;\r\n this.processOrPost();\r\n }\r\n makeCommandName() {\r\n if (!this._currentTask)\r\n return \"null\";\r\n return this._currentTask.command ? this._currentTask.command.constructor.name : \"anonymous\";\r\n }\r\n processOrPost() {\r\n const last = this._ctx._subTaskChainStack[this._ctx._subTaskChainStack.length - 1];\r\n if (last != this) {\r\n last._postedChain = this;\r\n }\r\n else {\r\n this.processInternal();\r\n }\r\n }\r\n processInternal() {\r\n if (this._postedMethod == STaskChainMethod.Next) {\r\n this.nextInternal();\r\n }\r\n else if (this._postedMethod == STaskChainMethod.Handled) {\r\n this.handledInternal();\r\n }\r\n else {\r\n throw new Error(\"Unreachable.\");\r\n }\r\n }\r\n nextInternal() {\r\n (0, Common_1.assert)(this._currentTask);\r\n this._currentTask._status = STaskStatus.Succeeded;\r\n if (this._error) {\r\n (0, Common_1.assert)(this._currentTask._catchFunc || this._currentTask._finallyFunc); // catch または finally から実行できる\r\n // 次の finally へ\r\n let t = this._currentTask._nextTask;\r\n this._currentTask = undefined;\r\n while (t) {\r\n if (t._finallyFunc) {\r\n t._callMethod = STaskCallMethod.Then;\r\n this._ctx._setNextPriorityTask(t);\r\n this._currentTask = t;\r\n break;\r\n }\r\n if (!this._errorHandled) {\r\n if (t._catchFunc) {\r\n t._callMethod = STaskCallMethod.Catch;\r\n this._ctx._setNextPriorityTask(t);\r\n this._currentTask = t;\r\n this._errorHandled = true;\r\n break;\r\n }\r\n }\r\n t = t._nextTask;\r\n }\r\n }\r\n else {\r\n // いわゆる resolve()\r\n const next = this._currentTask._nextTask;\r\n this._currentTask = undefined;\r\n if (next && (next._thenFunc2 || (next === null || next === void 0 ? void 0 : next._finallyFunc) || next._iterator)) {\r\n next._callMethod = (next._iterator) ? STaskCallMethod.Iterator : STaskCallMethod.Then;\r\n this._ctx._setNextPriorityTask(next);\r\n this._currentTask = next;\r\n }\r\n }\r\n if (!this._currentTask) {\r\n this.close();\r\n }\r\n }\r\n handledInternal() {\r\n (0, Common_1.assert)(this._currentTask);\r\n (0, Common_1.assert)(!this._errorHandled);\r\n this._error = true;\r\n this._currentTask._status = STaskStatus.Handled;\r\n // Task につながっている直近の catch を探してみる\r\n let t = this._currentTask._nextTask;\r\n this._currentTask = undefined;\r\n while (t) {\r\n if (t._finallyFunc) {\r\n t._callMethod = STaskCallMethod.Then;\r\n this._ctx._setNextPriorityTask(t);\r\n this._currentTask = t;\r\n break;\r\n }\r\n if (t._catchFunc) {\r\n t._callMethod = STaskCallMethod.Catch;\r\n this._ctx._setNextPriorityTask(t);\r\n this._currentTask = t;\r\n this._errorHandled = true;\r\n break;\r\n }\r\n t = t._nextTask;\r\n }\r\n if (!this._currentTask) {\r\n this.close();\r\n }\r\n }\r\n close() {\r\n // assert(this._ctx._subTaskChainStack[this._ctx._subTaskChainStack.length - 1] == this);\r\n // this._ctx._subTaskChainStack.pop();\r\n if (this._postedChain) {\r\n this._postedChain.processInternal();\r\n }\r\n }\r\n}\r\nexports.SSubTaskChain = SSubTaskChain;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/tasks/STask.ts?"); /***/ }), /***/ "./ts/mr/system/utils/SEditMapHelper.ts": /*!**********************************************!*\ !*** ./ts/mr/system/utils/SEditMapHelper.ts ***! \**********************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SEditMapHelper = void 0;\r\nvar SubTile;\r\n(function (SubTile) {\r\n SubTile[SubTile[\"UL\"] = 0] = \"UL\";\r\n SubTile[SubTile[\"UR\"] = 1] = \"UR\";\r\n SubTile[SubTile[\"LL\"] = 2] = \"LL\";\r\n SubTile[SubTile[\"LR\"] = 3] = \"LR\";\r\n})(SubTile || (SubTile = {}));\r\nclass SEditMapHelper {\r\n isValidPos(x, y) {\r\n return this.onIsValidPos(x, y);\r\n }\r\n setTileId(x, y, z, tileId) {\r\n this.onSetTileId(x, y, z, tileId);\r\n }\r\n putAutoTile(x, y, z, autoTileKind) {\r\n const tileId = Tilemap.makeAutotileId(autoTileKind, this.getAutotileShape(x, y, z, autoTileKind));\r\n this.setTileId(x, y, z, tileId);\r\n if (this.isValidPos(x - 1, y - 1))\r\n this.refreshAutoTile(x - 1, y - 1, z, autoTileKind);\r\n if (this.isValidPos(x, y - 1))\r\n this.refreshAutoTile(x, y - 1, z, autoTileKind);\r\n if (this.isValidPos(x + 1, y - 1))\r\n this.refreshAutoTile(x + 1, y - 1, z, autoTileKind);\r\n if (this.isValidPos(x - 1, y))\r\n this.refreshAutoTile(x - 1, y, z, autoTileKind);\r\n if (this.isValidPos(x + 1, y))\r\n this.refreshAutoTile(x + 1, y, z, autoTileKind);\r\n if (this.isValidPos(x - 1, y + 1))\r\n this.refreshAutoTile(x - 1, y + 1, z, autoTileKind);\r\n if (this.isValidPos(x, y + 1))\r\n this.refreshAutoTile(x, y + 1, z, autoTileKind);\r\n if (this.isValidPos(x + 1, y + 1))\r\n this.refreshAutoTile(x + 1, y + 1, z, autoTileKind);\r\n }\r\n tileId(x, y, z) {\r\n return this.onGetTileId(x, y, z);\r\n }\r\n refreshAutoTile(x, y, z, autoTileKind) {\r\n if (Tilemap.getAutotileKind(this.tileId(x, y, z)) == autoTileKind) {\r\n const tileId = Tilemap.makeAutotileId(autoTileKind, this.getAutotileShape(x, y, z, autoTileKind));\r\n this.setTileId(x, y, z, tileId);\r\n }\r\n }\r\n getAutotileShape(x, y, z, component) {\r\n let subtiles = [0, 0, 0, 0];\r\n {\r\n const checkOffsets = [{ x: -1, y: -1 }, { x: 1, y: -1 }, { x: -1, y: 1 }, { x: 1, y: 1 }];\r\n // 左上、右上、左下、右下、の順で SubtileID (1~5) を決定する\r\n for (let i = 0; i < 4; i++) {\r\n const ox = checkOffsets[i].x;\r\n const oy = checkOffsets[i].y;\r\n const diag = this.getSameKindTile(x + ox, y + oy, z, component); // 対角\r\n const hori = this.getSameKindTile(x + ox, y, z, component); // 横\r\n const vert = this.getSameKindTile(x, y + oy, z, component); // 縦\r\n if (diag && vert && hori)\r\n subtiles[i] = 1; // 1: すべて同種タイル\r\n else if (!diag && vert && hori)\r\n subtiles[i] = 2; // 2: 縦と横が同種タイル (対角のみ異種タイル)\r\n else if (!vert && hori)\r\n subtiles[i] = 3; // 3: 縦のみ異種タイル (横のみ同種タイル・対角は不問)\r\n else if (vert && !hori)\r\n subtiles[i] = 4; // 4: 横のみ異種タイル (縦のみ同種タイル・対角は不問)\r\n else\r\n subtiles[i] = 5; // 5: 縦と横が異種タイル (対角は不問)\r\n }\r\n }\r\n // subtiles が一致するものを線形で検索\r\n const id = this.onGetAutotileTable(component).findIndex(x => {\r\n return x[SubTile.UL] == subtiles[SubTile.UL] &&\r\n x[SubTile.UR] == subtiles[SubTile.UR] &&\r\n x[SubTile.LL] == subtiles[SubTile.LL] &&\r\n x[SubTile.LR] == subtiles[SubTile.LR];\r\n });\r\n if (id >= 0)\r\n return id;\r\n else\r\n return 0;\r\n }\r\n onGetAutotileTable(componentOrAutoTileKind) {\r\n return SEditMapHelper._subtileToAutoTileTable;\r\n }\r\n}\r\nexports.SEditMapHelper = SEditMapHelper;\r\n// 1: すべて同種タイル\r\n// 2: 対角のみ異種タイル (縦と横が同種タイル)\r\n// 3: 縦のみ異種タイル (横のみ同種タイル・対角は不問)\r\n// 4: 横のみ異種タイル (縦のみ同種タイル・対角は不問)\r\n// 5: 縦と横が異種タイル (非隣接タイル・対角は不問)\r\n// これらを↓に沿って配置したもの\r\n// https://www.f-sp.com/category/RPG%E3%83%84%E3%82%AF%E3%83%BC%E3%83%AB?page=1480575168\r\nSEditMapHelper._subtileToAutoTileTable = [\r\n [1, 1, 1, 1], [2, 1, 1, 1], [1, 2, 1, 1], [2, 2, 1, 1], [1, 1, 1, 2], [2, 1, 1, 2], [1, 2, 1, 2], [2, 2, 1, 2],\r\n [1, 1, 2, 1], [2, 1, 2, 1], [1, 2, 2, 1], [2, 2, 2, 1], [1, 1, 2, 2], [2, 1, 2, 2], [1, 2, 2, 2], [2, 2, 2, 2],\r\n [4, 1, 4, 1], [4, 2, 4, 1], [4, 1, 4, 2], [4, 2, 4, 2], [3, 3, 1, 1], [3, 3, 1, 2], [3, 3, 2, 1], [3, 3, 2, 2],\r\n [1, 4, 1, 4], [1, 4, 2, 4], [2, 4, 1, 4], [2, 4, 2, 4], [1, 1, 3, 3], [2, 1, 3, 3], [1, 2, 3, 3], [2, 2, 3, 3],\r\n [4, 4, 4, 4], [3, 3, 3, 3], [5, 3, 4, 1], [5, 3, 4, 2], [3, 5, 1, 4], [3, 5, 2, 4], [1, 4, 3, 5], [2, 4, 3, 5],\r\n [4, 1, 5, 3], [4, 2, 5, 3], [5, 5, 4, 4], [5, 3, 5, 3], [4, 4, 5, 5], [3, 5, 3, 5], [5, 5, 5, 5], [5, 5, 5, 5],\r\n];\r\nSEditMapHelper._subtileToAutoTileTable_Wall = [\r\n [1, 1, 1, 1], [4, 1, 4, 1], [3, 3, 1, 1], [5, 2, 4, 1],\r\n [1, 4, 1, 4], [4, 4, 4, 4], [3, 5, 1, 4], [5, 5, 4, 4],\r\n [1, 1, 3, 3], [4, 1, 5, 4], [3, 3, 3, 3], [5, 3, 5, 3],\r\n [1, 4, 3, 5], [4, 4, 5, 5], [3, 5, 3, 5], [5, 5, 5, 5],\r\n];\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/utils/SEditMapHelper.ts?"); /***/ }), /***/ "./ts/mr/system/utils/SFovHelper.ts": /*!******************************************!*\ !*** ./ts/mr/system/utils/SFovHelper.ts ***! \******************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SFovHelper = exports.IFovMap = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst DSystem_1 = __webpack_require__(/*! ts/mr/data/DSystem */ \"./ts/mr/data/DSystem.ts\");\r\n// export interface SComputeFovResultBlock {\r\n// fov: boolean;\r\n// transparent: boolean; // 壁の場合、false\r\n// }\r\n// export class SComputeFovResult {\r\n// private _width: number;\r\n// private _height: number;\r\n// private _data: SComputeFovResultBlock[];\r\n// public constructor() {\r\n// this._width = 0;\r\n// this._height = 0;\r\n// this._data = [];\r\n// }\r\n// public get width(): number {\r\n// return this._width;\r\n// }\r\n// public get height(): number {\r\n// return this._height;\r\n// }\r\n// public get cells(): SComputeFovResultBlock[] {\r\n// return this._data;\r\n// }\r\n// public setup(width: number, height: number): void {\r\n// this._width = width;\r\n// this._height = height;\r\n// this._data = new Array(width * height);\r\n// for (let i = 0; i < this._data.length; i++) {\r\n// this._data[i] = {\r\n// fov: false,\r\n// transparent: true,\r\n// };\r\n// }\r\n// }\r\n// public clear(): void {\r\n// for (let i = 0; i < this._data.length; i++) {\r\n// this._data[i].fov = false;\r\n// this._data[i].transparent = true;\r\n// }\r\n// }\r\n// public clearFov(): void {\r\n// for (let i = 0; i < this._data.length; i++) {\r\n// this._data[i].fov = false;\r\n// }\r\n// }\r\n// public inBounds(x: number, y: number): boolean {\r\n// return 0 <= x && x < this.width && 0 <= y && y < this.height;\r\n// }\r\n// public get(x: number, y: number): SComputeFovResultBlock {\r\n// return this._data[y * this.width + x];\r\n// }\r\n// }\r\nclass IFovMap {\r\n inBounds(x, y) {\r\n return 0 <= x && x < this.getWidth() && 0 <= y && y < this.getHeight();\r\n }\r\n}\r\nexports.IFovMap = IFovMap;\r\nclass SFovHelper {\r\n static computeFov(map, pov_x, pov_y, max_radius, light_walls, algo) {\r\n (0, Common_1.assert)(map.inBounds(pov_x, pov_y));\r\n //map.clear();\r\n switch (algo) {\r\n case DSystem_1.DFovSystem.RoomBounds:\r\n //SFovHelper.computeFovDfov(pov_x, pov_y, max_radius, light_walls, map);\r\n break;\r\n case DSystem_1.DFovSystem.SymmetricShadowcast:\r\n this.compute_fov_symmetric_shadowcast(map, pov_x, pov_y, max_radius, light_walls);\r\n break;\r\n default:\r\n throw new Error(\"Unreachable.\");\r\n }\r\n }\r\n static compute_fov_symmetric_shadowcast(map, pov_x, pov_y, max_radius, light_walls) {\r\n // 始点のセルを可視にする。\r\n map.setFov(pov_x, pov_y, true); // map.cells[pov_x + pov_y * map.width].fov = true;\r\n for (let quadrant = 0; quadrant < 4; quadrant++) {\r\n const row = {\r\n pov_x: pov_x,\r\n pov_y: pov_y,\r\n quadrant: quadrant,\r\n depth: 1,\r\n slope_low: -1.0,\r\n slope_high: 1.0,\r\n };\r\n this.scan(map, row);\r\n }\r\n const radius_squared = max_radius * max_radius;\r\n const width = map.getWidth();\r\n const height = map.getHeight();\r\n for (let y = 0; y < height; ++y) {\r\n for (let x = 0; x < width; ++x) {\r\n if (!light_walls && !map.getTransparent(x, y)) {\r\n map.setFov(x, y, false);\r\n }\r\n // 最大範囲外は強制的に不可視とする。\r\n if (max_radius > 0) {\r\n const dx = x - pov_x;\r\n const dy = y - pov_y;\r\n if (dx * dx + dy * dy >= radius_squared) {\r\n map.setFov(x, y, false);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n static scan(map, row) {\r\n const xx = this.quadrant_table[row.quadrant][0];\r\n const xy = this.quadrant_table[row.quadrant][1];\r\n const yx = this.quadrant_table[row.quadrant][2];\r\n const yy = this.quadrant_table[row.quadrant][3];\r\n if (!map.inBounds(row.pov_x + row.depth * xx, row.pov_y + row.depth * yx)) {\r\n return; // Row.depth is out-of-bounds.\r\n }\r\n const column_min = this.round_half_up(row.depth * row.slope_low);\r\n const column_max = this.round_half_down(row.depth * row.slope_high);\r\n let prev_tile_is_wall = false;\r\n for (let column = column_min; column <= column_max; ++column) {\r\n const map_x = row.pov_x + row.depth * xx + column * xy;\r\n const map_y = row.pov_y + row.depth * yx + column * yy;\r\n if (!map.inBounds(map_x, map_y)) {\r\n continue; // Tile is out-of-bounds.\r\n }\r\n //const map_cell: SComputeFovResultBlock = map.cells[map_x + map_y * map.width];\r\n const is_wall = !map.getTransparent(map_x, map_y);\r\n if (is_wall || this.is_symmetric(row, column)) {\r\n map.setFov(map_x, map_y, true);\r\n }\r\n if (prev_tile_is_wall && !is_wall) { // Floor tile to wall tile.\r\n row.slope_low = this.slope(row.depth, column); // Shrink the view.\r\n }\r\n if (column != column_min && !prev_tile_is_wall && is_wall) { // Wall tile to floor tile.\r\n // Track the slopes of the last transparent tiles and recurse into them.\r\n const next_row = {\r\n pov_x: row.pov_x,\r\n pov_y: row.pov_y,\r\n quadrant: row.quadrant,\r\n depth: row.depth + 1,\r\n slope_low: row.slope_low,\r\n slope_high: this.slope(row.depth, column),\r\n };\r\n this.scan(map, next_row);\r\n }\r\n prev_tile_is_wall = is_wall;\r\n }\r\n if (!prev_tile_is_wall) {\r\n // Tail recuse into the next row.\r\n row.depth += 1;\r\n this.scan(map, row);\r\n }\r\n }\r\n /**\r\n Calculates new start and end slopes.\r\n\r\n The line is tangent to the left edge of the current tile, so we can use a\r\n single slope function for both start and end slopes.\r\n */\r\n static slope(row_depth, column) { return (2.0 * column - 1.0) / (2.0 * row_depth); }\r\n /**\r\n Round half numbers towards infinity.\r\n */\r\n static round_half_up(n) { return Math.floor(Math.round(n * (1.0 + Number.EPSILON))); }\r\n /**\r\n Round half numbers towards negative infinity.\r\n */\r\n static round_half_down(n) { return Math.floor(Math.round(n * (1.0 - Number.EPSILON))); }\r\n /**\r\n Returns true if a given floor tile can be seen symmetrically from the origin.\r\n\r\n It returns true if the central point of the tile is in the sector swept out\r\n by the row’s start and end slopes. Otherwise, it returns false.\r\n */\r\n static is_symmetric(row, column) {\r\n return column >= row.depth * row.slope_low && column <= row.depth * row.slope_high;\r\n }\r\n}\r\nexports.SFovHelper = SFovHelper;\r\nSFovHelper.quadrant_table = [\r\n [1, 0, 0, 1],\r\n [0, 1, 1, 0],\r\n [0, -1, -1, 0],\r\n [-1, 0, 0, -1],\r\n];\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/system/utils/SFovHelper.ts?"); /***/ }), /***/ "./ts/mr/transactions/TDrop.ts": /*!*************************************!*\ !*** ./ts/mr/transactions/TDrop.ts ***! \*************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.TDrop = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ../data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst LInventoryBehavior_1 = __webpack_require__(/*! ../lively/entity/LInventoryBehavior */ \"./ts/mr/lively/entity/LInventoryBehavior.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst ULimitations_1 = __webpack_require__(/*! ../utility/ULimitations */ \"./ts/mr/utility/ULimitations.ts\");\r\nconst UMovement_1 = __webpack_require__(/*! ../utility/UMovement */ \"./ts/mr/utility/UMovement.ts\");\r\nconst UName_1 = __webpack_require__(/*! ../utility/UName */ \"./ts/mr/utility/UName.ts\");\r\nclass TDrop {\r\n constructor() {\r\n this._items = [];\r\n }\r\n static makeFromSingleItem(item) {\r\n const t = new TDrop();\r\n t._items = [item];\r\n return t;\r\n }\r\n static makeFromEntityInventory(inventoryOwner) {\r\n const t = new TDrop();\r\n const inventory = inventoryOwner.findEntityBehavior(LInventoryBehavior_1.LInventoryBehavior);\r\n if (inventory) {\r\n t._items = inventory.items;\r\n }\r\n return t;\r\n }\r\n withLocation(mx, my) {\r\n this._mx = mx;\r\n this._my = my;\r\n return this;\r\n }\r\n testValidEffect() {\r\n return this._items.length > 0;\r\n }\r\n performe(cctx) {\r\n var _a, _b;\r\n for (const item of this._items) {\r\n const mx = (_a = this._mx) !== null && _a !== void 0 ? _a : item.mx;\r\n const my = (_b = this._my) !== null && _b !== void 0 ? _b : item.my;\r\n this.performeSingleItem(cctx, item, mx, my);\r\n }\r\n }\r\n performeSingleItem(cctx, item, mx, my) {\r\n TDrop.dropOrDestroyEntityForce(cctx, item, mx, my);\r\n }\r\n /**\r\n * entity を現在位置から HomeLayer へ落とす。\"Fall\" ではないため、これによって罠が発動したりすることは無い。\r\n *\r\n * entity がその場所から取り出せるかはテストしない。\r\n *\r\n * @param cctx\r\n * @param item\r\n */\r\n static dropOrDestroyEntityForce(cctx, item, mx, my) {\r\n const map = MRLively_1.MRLively.mapView.currentMap;\r\n item.removeFromParent();\r\n MRLively_1.MRLively.world.transferEntity(item, map.floorId(), mx, my);\r\n if (ULimitations_1.ULimitations.isItemCountFullyInMap()) {\r\n }\r\n else {\r\n const targetLayer = item.getHomeLayer();\r\n const block = UMovement_1.UMovement.selectNearbyLocatableBlock(item.map, cctx.random(), item.mx, item.my, targetLayer, item);\r\n if (block) {\r\n item.map.locateEntity(item, block.mx, block.my, targetLayer);\r\n cctx.postSequel(item, MRBasics_1.MRBasics.sequels.dropSequel);\r\n return;\r\n }\r\n }\r\n // 落下できるところが無ければ Entity 削除\r\n cctx.postMessage((0, Common_1.tr2)(\"%1は消えてしまった…。\").format(UName_1.UName.makeNameAsItem(item)));\r\n cctx.postDestroy(item);\r\n }\r\n}\r\nexports.TDrop = TDrop;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/transactions/TDrop.ts?"); /***/ }), /***/ "./ts/mr/transactions/TStumble.ts": /*!****************************************!*\ !*** ./ts/mr/transactions/TStumble.ts ***! \****************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.TStumble = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst DCommon_1 = __webpack_require__(/*! ../data/DCommon */ \"./ts/mr/data/DCommon.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ../data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LEquipmentUserBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LEquipmentUserBehavior */ \"./ts/mr/lively/behaviors/LEquipmentUserBehavior.ts\");\r\nconst LInventoryBehavior_1 = __webpack_require__(/*! ../lively/entity/LInventoryBehavior */ \"./ts/mr/lively/entity/LInventoryBehavior.ts\");\r\nconst internal_1 = __webpack_require__(/*! ../lively/internal */ \"./ts/mr/lively/internal.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ../system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst UAction_1 = __webpack_require__(/*! ../utility/UAction */ \"./ts/mr/utility/UAction.ts\");\r\n/**\r\n * [転倒] に関する処理。\r\n *\r\n *\r\n *\r\n */\r\nclass TStumble {\r\n /**\r\n * 転倒し、アイテムをばらまく。\r\n * ダメージは入らないので注意。\r\n * 罠や杖による転倒は微ダメージだが、モンスターのスキルで転倒したときはより大きいダメージが発生するケースもあるため、ここではダメージ処理は行わない。\r\n */\r\n static postStumble(cctx, entity, dir) {\r\n if (entity.isPlayer())\r\n this.postStumbleForPlayer(cctx, entity, dir);\r\n else\r\n this.postStumbleForNPC(cctx, entity);\r\n cctx.postSequel(entity, MRBasics_1.MRBasics.sequels.stumble);\r\n }\r\n /** 操作中 Unit 用の転倒時アイテムバラまき。インベントリからランダムに選択されたアイテムを、足元ではなく前方にバラまく。 */\r\n static postStumbleForPlayer(cctx, entity, dir) {\r\n const inventory = entity.findEntityBehavior(LInventoryBehavior_1.LInventoryBehavior);\r\n if (inventory) {\r\n const items = this.getDefenselessInventoryItems(entity);\r\n const positions = this.StumbleTable[dir];\r\n (0, Common_1.assert)(positions.length > 0);\r\n const loops = Math.min(items.length, positions.length);\r\n let iItem = 0;\r\n for (let i = 0; i < positions.length && iItem < items.length; i++) {\r\n const mx = entity.mx + positions[i].x;\r\n const my = entity.my + positions[i].y;\r\n // 地形などを考慮して、本当に落とすアイテムを決める\r\n const block = MRLively_1.MRLively.mapView.currentMap.tryGetBlock(mx, my);\r\n if (block && block.isFloorLikeShape() && !block.layer(DCommon_1.DBlockLayerKind.Ground).isContainsAnyEntity()) {\r\n const item = items[iItem];\r\n item.removeFromParent();\r\n MRLively_1.MRLively.world.transferEntity(item, MRLively_1.MRLively.mapView.currentMap.floorId(), entity.mx, entity.my);\r\n cctx.postTransferFloor(item, MRLively_1.MRLively.mapView.currentMap.floorId(), mx, my);\r\n cctx.postSequel(item, MRBasics_1.MRBasics.sequels.jump);\r\n cctx.postCommandTask(new SCommand_1.SSprinkleDropedCommand(item));\r\n iItem++;\r\n }\r\n }\r\n }\r\n }\r\n static postStumbleForNPC(cctx, entity) {\r\n this.postDropItems(cctx, entity, internal_1.LGenerateDropItemCause.Stumble);\r\n }\r\n static postDropItems(cctx, entity, cause) {\r\n const map = MRLively_1.MRLively.mapView.currentMap;\r\n (0, Common_1.assert)(map.checkAppearing(entity));\r\n const items = entity.generateDropItems(cause);\r\n for (const item of items) {\r\n UAction_1.UAction.postDropOrDestroy(cctx, item, entity.mx, entity.my);\r\n }\r\n }\r\n static getDefenselessInventoryItems(entity) {\r\n const inventory = entity.findEntityBehavior(LInventoryBehavior_1.LInventoryBehavior);\r\n const equipmentUser = entity.findEntityBehavior(LEquipmentUserBehavior_1.LEquipmentUserBehavior);\r\n if (!inventory)\r\n return [];\r\n if (equipmentUser) {\r\n return inventory.items.filter(x => !equipmentUser.isEquipped(x));\r\n }\r\n else {\r\n return inventory.items;\r\n }\r\n }\r\n}\r\nexports.TStumble = TStumble;\r\n/* ⑦⑤④\r\n ②①⑥\r\n P③⑧\r\n*/\r\nTStumble.StumbleTable = [\r\n [],\r\n // ⑧③P\r\n // ⑥①②\r\n // ④⑤⑦\r\n [{ x: -1, y: 1 }, { x: -1, y: 0 }, { x: 0, y: 1 }, { x: -2, y: 2 }, { x: -1, y: 2 }, { x: -2, y: 1 }, { x: 0, y: 2 }, { x: -2, y: 0 }],\r\n // P\r\n // ③①②\r\n // ⑧⑥④⑤⑦\r\n [{ x: 0, y: 1 }, { x: 1, y: 1 }, { x: -1, y: 1 }, { x: 0, y: 2 }, { x: 1, y: 2 }, { x: -1, y: 2 }, { x: 2, y: 2 }, { x: -2, y: 2 }],\r\n // P②⑦\r\n // ③①⑤\r\n // ⑧⑥④\r\n [{ x: 1, y: 1 }, { x: 1, y: 0 }, { x: 0, y: 1 }, { x: 2, y: 2 }, { x: 2, y: 1 }, { x: 1, y: 2 }, { x: 2, y: 0 }, { x: 0, y: 2 }],\r\n // ⑧\r\n // ⑥③\r\n // ④①P\r\n // ⑤②\r\n // ⑦\r\n [{ x: -1, y: 0 }, { x: -1, y: 1 }, { x: -1, y: -1 }, { x: -2, y: 0 }, { x: -2, y: 1 }, { x: -2, y: -1 }, { x: -2, y: -2 }, { x: -2, y: 2 }],\r\n [],\r\n // ⑦\r\n // ②⑤\r\n // P①④\r\n // ③⑥\r\n // ⑧\r\n [{ x: 1, y: 0 }, { x: 1, y: -1 }, { x: 1, y: 1 }, { x: 2, y: 0 }, { x: 2, y: -1 }, { x: 2, y: 1 }, { x: 2, y: -2 }, { x: 2, y: 2 }],\r\n // ④⑥⑧\r\n // ⑤①③\r\n // ⑦②P\r\n [{ x: -1, y: -1 }, { x: -1, y: 0 }, { x: 0, y: -1 }, { x: -2, y: -2 }, { x: -2, y: -1 }, { x: -1, y: -2 }, { x: -2, y: 0 }, { x: 0, y: -2 }],\r\n // ⑦⑤④⑥⑧\r\n // ②①③\r\n // P\r\n [{ x: 0, y: -1 }, { x: -1, y: -1 }, { x: 1, y: -1 }, { x: 0, y: -2 }, { x: -1, y: -2 }, { x: 1, y: -2 }, { x: -2, y: -2 }, { x: 2, y: -2 }],\r\n // ⑦⑤④\r\n // ②①⑥\r\n // P③⑧\r\n [{ x: 1, y: -1 }, { x: 0, y: -1 }, { x: 1, y: 0 }, { x: 2, y: -2 }, { x: 1, y: -2 }, { x: 2, y: -1 }, { x: 0, y: -2 }, { x: 2, y: 0 }],\r\n];\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/transactions/TStumble.ts?"); /***/ }), /***/ "./ts/mr/transactions/TThrow.ts": /*!**************************************!*\ !*** ./ts/mr/transactions/TThrow.ts ***! \**************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.TThrow = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst LBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LBehavior */ \"./ts/mr/lively/behaviors/LBehavior.ts\");\r\nconst SEffectContext_1 = __webpack_require__(/*! ../system/SEffectContext */ \"./ts/mr/system/SEffectContext.ts\");\r\nconst UName_1 = __webpack_require__(/*! ../utility/UName */ \"./ts/mr/utility/UName.ts\");\r\nclass TThrow {\r\n static throwAllStack(cctx, actor, subject, item) {\r\n // [投げる] は便利コマンドのようなもの。\r\n // 具体的にどのように振舞うのか (直線に飛ぶのか、放物線状に動くのか、転がるのか) を決めるのは相手側\r\n const effectSubject = new SEffectContext_1.SEffectSubject(subject);\r\n cctx.post(item, actor, effectSubject, undefined, LBehavior_1.onPreThrowReaction)\r\n .then(() => {\r\n //itemEntity.callRemoveFromWhereabouts(cctx);\r\n item.removeFromParent();\r\n item.mx = actor.mx;\r\n item.my = actor.my;\r\n /*\r\n let actual: LEntity;\r\n if (itemEntity.isStacked()) {\r\n // スタックされていれば減らして新たな entity を生成\r\n actual = itemEntity.decreaseStack();\r\n //console.log(\"self.floorId\", self.floorId);\r\n //REGame.world._transferEntity(actual, self.floorId, self.x, self.y);\r\n }\r\n else {\r\n // スタックされていなければそのまま打ち出す\r\n itemEntity.removeFromParent();\r\n actual = itemEntity;\r\n }\r\n\r\n actual.x = self.x;\r\n actual.y = self.y;\r\n */\r\n cctx.post(item, actor, effectSubject, undefined, LBehavior_1.onThrowReaction)\r\n .then(() => {\r\n cctx.postMessage((0, Common_1.tr2)(\"%1を投げた。\").format(UName_1.UName.makeNameAsItem(item)));\r\n return true;\r\n });\r\n return true;\r\n });\r\n }\r\n static throwSingleStack(cctx, actor, subject, item) {\r\n const effectSubject = new SEffectContext_1.SEffectSubject(subject);\r\n cctx.post(item, actor, effectSubject, undefined, LBehavior_1.onPreThrowReaction)\r\n .then(() => {\r\n let actual;\r\n if (item.isStacked()) {\r\n // スタックされていれば減らして新たな entity を生成\r\n actual = item.decreaseStack();\r\n //console.log(\"self.floorId\", self.floorId);\r\n //REGame.world._transferEntity(actual, self.floorId, self.x, self.y);\r\n }\r\n else {\r\n // スタックされていなければそのまま打ち出す\r\n item.removeFromParent();\r\n actual = item;\r\n }\r\n actual.mx = actor.mx;\r\n actual.my = actor.my;\r\n cctx.post(actual, actor, effectSubject, undefined, LBehavior_1.onThrowReaction)\r\n .then(() => {\r\n cctx.postMessage((0, Common_1.tr2)(\"%1を撃った\".format(UName_1.UName.makeNameAsItem(actual))));\r\n return true;\r\n });\r\n return true;\r\n });\r\n }\r\n}\r\nexports.TThrow = TThrow;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/transactions/TThrow.ts?"); /***/ }), /***/ "./ts/mr/utility/UAction.ts": /*!**********************************!*\ !*** ./ts/mr/utility/UAction.ts ***! \**********************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.UAction = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst DEffect_1 = __webpack_require__(/*! ts/mr/data/DEffect */ \"./ts/mr/data/DEffect.ts\");\r\nconst DHelper_1 = __webpack_require__(/*! ts/mr/data/DHelper */ \"./ts/mr/data/DHelper.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst internal_1 = __webpack_require__(/*! ts/mr/lively/internal */ \"./ts/mr/lively/internal.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ../data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst DCommon_1 = __webpack_require__(/*! ../data/DCommon */ \"./ts/mr/data/DCommon.ts\");\r\nconst LIdentifyer_1 = __webpack_require__(/*! ../lively/LIdentifyer */ \"./ts/mr/lively/LIdentifyer.ts\");\r\nconst Helpers_1 = __webpack_require__(/*! ../system/Helpers */ \"./ts/mr/system/Helpers.ts\");\r\nconst SEffectContext_1 = __webpack_require__(/*! ../system/SEffectContext */ \"./ts/mr/system/SEffectContext.ts\");\r\nconst SSoundManager_1 = __webpack_require__(/*! ../system/SSoundManager */ \"./ts/mr/system/SSoundManager.ts\");\r\nconst UBlock_1 = __webpack_require__(/*! ./UBlock */ \"./ts/mr/utility/UBlock.ts\");\r\nconst UMovement_1 = __webpack_require__(/*! ./UMovement */ \"./ts/mr/utility/UMovement.ts\");\r\nconst UName_1 = __webpack_require__(/*! ./UName */ \"./ts/mr/utility/UName.ts\");\r\nconst USearch_1 = __webpack_require__(/*! ./USearch */ \"./ts/mr/utility/USearch.ts\");\r\nconst LActivity_1 = __webpack_require__(/*! ../lively/activities/LActivity */ \"./ts/mr/lively/activities/LActivity.ts\");\r\nconst ULimitations_1 = __webpack_require__(/*! ./ULimitations */ \"./ts/mr/utility/ULimitations.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ../system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst LThinkingAgent_1 = __webpack_require__(/*! ../lively/ai2/LThinkingAgent */ \"./ts/mr/lively/ai2/LThinkingAgent.ts\");\r\nclass UAction {\r\n /*\r\n // TODO: Activity 経由で設定したい。.withConsumeAction()と一緒に使いたいので。\r\n public static postPerformSkill(cctx: SCommandContext, performer: LEntity, skillId: DSkillDataId): void {\r\n context.postCall(() => {\r\n SEmittorPerformer.makeWithSkill(performer, skillId).performe(context);\r\n });\r\n }\r\n */\r\n static postEffectSensed(cctx, entity) {\r\n cctx.postCall(() => {\r\n entity.iterateBehaviorsReverse(b => b.onEffectSensed(entity, cctx));\r\n });\r\n }\r\n static postStepOnGround(cctx, entity) {\r\n const block = MRLively_1.MRLively.mapView.currentMap.block(entity.mx, entity.my);\r\n const layer = block.layer(DCommon_1.DBlockLayerKind.Ground);\r\n const reactor = layer.firstEntity();\r\n if (reactor) {\r\n cctx.post(entity, reactor, new SEffectContext_1.SEffectSubject(entity), undefined, internal_1.onWalkedOnTopAction);\r\n cctx.post(reactor, entity, new SEffectContext_1.SEffectSubject(reactor), undefined, internal_1.onWalkedOnTopReaction);\r\n }\r\n }\r\n static postPreStepFeetProcess(cctx, entity) {\r\n const block = MRLively_1.MRLively.mapView.currentMap.block(entity.mx, entity.my);\r\n const layer = block.layer(DCommon_1.DBlockLayerKind.Ground);\r\n const reactor = layer.firstEntity();\r\n if (reactor) {\r\n cctx.callSymbol(entity, reactor, new SEffectContext_1.SEffectSubject(entity), undefined, internal_1.onPreStepFeetProcess_Actor);\r\n cctx.callSymbol(reactor, entity, new SEffectContext_1.SEffectSubject(reactor), undefined, internal_1.onPreStepFeetProcess);\r\n //cctx.post(reactor, entity, new SEffectSubject(reactor), undefined, onStepOnTrap);\r\n }\r\n }\r\n static postAttemptPerformStepFeetProcess(cctx, entity) {\r\n const block = MRLively_1.MRLively.mapView.currentMap.block(entity.mx, entity.my);\r\n const layer = block.layer(DCommon_1.DBlockLayerKind.Ground);\r\n const reactor = layer.firstEntity();\r\n if (reactor) {\r\n cctx.post(reactor, entity, new SEffectContext_1.SEffectSubject(reactor), undefined, internal_1.onPerformStepFeetProcess);\r\n }\r\n }\r\n static postFall(cctx, entity) {\r\n cctx.postActivity(LActivity_1.LActivity.makeFall(entity))\r\n .then(() => {\r\n this.postDropOrDestroyOnCurrentPos(cctx, entity, entity.getHomeLayer());\r\n })\r\n .catch(() => {\r\n this.postDropOrDestroyOnCurrentPos(cctx, entity, entity.getHomeLayer());\r\n });\r\n }\r\n /** @deprecated */\r\n static postPickItem(cctx, self, inventory, itemEntity) {\r\n return cctx.postCommandTask(new SCommand_1.STestAddItemCommand(self, itemEntity))\r\n .then2(() => {\r\n MRLively_1.MRLively.mapView.currentMap._removeEntity(itemEntity);\r\n inventory.addEntityWithStacking(itemEntity);\r\n const name = LIdentifyer_1.LEntityDescription.makeDisplayText(UName_1.UName.makeUnitName(self), LIdentifyer_1.DescriptionHighlightColor.UnitName);\r\n cctx.postMessage((0, Common_1.tr)(\"{0} は {1} をひろった\", name, UName_1.UName.makeNameAsItem(itemEntity)));\r\n SSoundManager_1.SSoundManager.playPickItem();\r\n });\r\n }\r\n /**\r\n * entity を現在マップの指定位置へ落とす。\"Fall\" ではないため、これによって罠が発動したりすることは無い。\r\n *\r\n * @deprecated use TDrop\r\n */\r\n static postDropOrDestroy(cctx, entity, mx, my) {\r\n cctx.postCall(() => {\r\n MRLively_1.MRLively.world.transferEntity(entity, MRLively_1.MRLively.mapView.currentMap.floorId(), mx, my);\r\n this.postDropOrDestroyOnCurrentPos(cctx, entity, entity.getHomeLayer());\r\n });\r\n }\r\n /**\r\n * entity を現在位置から HomeLayer へ落とす。\"Fall\" ではないため、これによって罠が発動したりすることは無い。\r\n *\r\n * @deprecated use TDrop\r\n */\r\n static postDropOrDestroyOnCurrentPos(cctx, entity, targetLayer) {\r\n if (ULimitations_1.ULimitations.isItemCountFullyInMap()) {\r\n }\r\n else {\r\n const block = UMovement_1.UMovement.selectNearbyLocatableBlock(entity.map, cctx.random(), entity.mx, entity.my, targetLayer, entity);\r\n if (block) {\r\n //context.postSequel(entity, RESystem.sequels.dropSequel, { movingDir: blowDirection });\r\n //context.postCall(() => {\r\n entity.map.locateEntity(entity, block.mx, block.my, targetLayer);\r\n //REGame.world._transferEntity(entity, REGame.map.floorId(), block.x(), block.y());\r\n cctx.postSequel(entity, MRBasics_1.MRBasics.sequels.dropSequel);\r\n //});\r\n return;\r\n }\r\n }\r\n // 落下できるところが無ければ Entity 削除\r\n cctx.postMessage((0, Common_1.tr2)(\"%1は消えてしまった…。\").format(UName_1.UName.makeNameAsItem(entity)));\r\n cctx.postDestroy(entity);\r\n }\r\n static postWarp(cctx, entity) {\r\n const block = USearch_1.USearch.selectUnitSpawnableBlock(cctx.random());\r\n if (block) {\r\n cctx.postTransferFloor(entity, entity.floorId, block.mx, block.my); // SpecialEffect として実行される場合は事前にpostされる発動側Animationを待ちたいので post.\r\n cctx.postSequel(entity, MRBasics_1.MRBasics.sequels.warp);\r\n }\r\n else {\r\n throw new Error(\"Not implemented.\");\r\n }\r\n }\r\n /**\r\n * item を actionId として使うとき、対象アイテムの選択が必要であるかを判断する。\r\n */\r\n static checkItemSelectionRequired(item, actionId) {\r\n const reaction = item.data.findReaction(actionId);\r\n if (reaction) {\r\n for (const emittor of reaction.emittors()) {\r\n if (emittor.scope.range == DEffect_1.DEffectFieldScopeType.Selection)\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n static checkAdjacentDirectlyAttack(self, target) {\r\n const map = MRLively_1.MRLively.mapView.currentMap;\r\n const selfBlock = map.block(self.mx, self.my);\r\n const targetBlock = map.block(target.mx, target.my);\r\n const dx = targetBlock.mx - selfBlock.mx;\r\n const dy = targetBlock.my - selfBlock.my;\r\n if (Math.abs(dx) > 1)\r\n return false; // 隣接 Block への攻撃ではない\r\n if (Math.abs(dy) > 1)\r\n return false; // 隣接 Block への攻撃ではない\r\n const d = Helpers_1.Helpers.offsetToDir(dx, dy);\r\n if (UMovement_1.UMovement.checkDiagonalWallCornerCrossing(self, d))\r\n return false; // 壁があるので攻撃できない\r\n return true;\r\n }\r\n /**\r\n * スキルの効果範囲内にいる、有効な対象を取得する\r\n * @param performer\r\n * @param skill\r\n */\r\n static getSkillEffectiveTargets(performer, skill, checkFaction) {\r\n const effect = skill.emittor();\r\n return this.searchTargetEntities(performer, effect.scope, skill.rmmzEffectScope, checkFaction);\r\n }\r\n static makeCandidateSkillActions(performer, primaryTargetId) {\r\n let actions = performer.collectSkillActions();\r\n let result = [];\r\n if (performer.hasTrait(MRBasics_1.MRBasics.traits.SealSpecialAbility)) {\r\n actions = actions.filter(x => x.skillId == MRData_1.MRData.system.skills.normalAttack);\r\n }\r\n // まずは射程や地形状況を考慮して、発動可能な Skill を集める\r\n for (const action of actions) {\r\n const targets = this.getSkillEffectiveTargets(performer, MRData_1.MRData.skills[action.skillId], true);\r\n if (targets.length > 0) {\r\n result.push({ action: action, targets: targets.map(e => e.entityId()) });\r\n }\r\n }\r\n // \"移動\" は特別扱い。まずは常に使用できるものとして追加しておく\r\n if (!result.find(x => x.action.skillId == MRData_1.MRData.system.skills.move)) {\r\n result.push({\r\n action: {\r\n conditionParam1: undefined,\r\n conditionParam2: undefined,\r\n conditionType: undefined,\r\n rating: LThinkingAgent_1.LThinkingActionRatings.Moving,\r\n skillId: MRData_1.MRData.system.skills.move,\r\n },\r\n targets: []\r\n });\r\n }\r\n // 状況に応じた候補追加\r\n performer.iterateBehaviorsReverse(b => {\r\n b.onPostMakeSkillActions(result);\r\n });\r\n if (performer.hasTrait(MRBasics_1.MRBasics.traits.UseSkillForced)) {\r\n result.mutableRemove(x => x.action.skillId == MRData_1.MRData.system.skills.normalAttack);\r\n }\r\n let maxRating = 0;\r\n result.forEach(r => maxRating = Math.max(r.action.rating, maxRating));\r\n // 最大 Rating からの差が 5 以内を有効とする\r\n result = result.filter(x => x.action.rating >= maxRating - 5);\r\n // 攻撃対象が隣接していれば、\"移動\" を外す\r\n if (primaryTargetId.hasAny() && UMovement_1.UMovement.checkEntityAdjacent(performer, MRLively_1.MRLively.world.entity(primaryTargetId))) {\r\n result.mutableRemove(x => x.action.skillId == MRData_1.MRData.system.skills.move);\r\n }\r\n else {\r\n let found = false;\r\n for (const c of result) {\r\n for (const id of c.targets) {\r\n const target = MRLively_1.MRLively.world.entity(id);\r\n if (UMovement_1.UMovement.checkEntityAdjacent(performer, target)) {\r\n result.mutableRemove(x => x.action.skillId == MRData_1.MRData.system.skills.move);\r\n found = true;\r\n break;\r\n }\r\n }\r\n if (found)\r\n break;\r\n }\r\n }\r\n return result;\r\n }\r\n static testFactionMatch(performer, target, scope) {\r\n if (scope == DEffect_1.DRmmzEffectScope.Everyone) {\r\n return true;\r\n }\r\n else if (DHelper_1.DHelpers.isForFriend(scope)) {\r\n if (Helpers_1.Helpers.isFriend(performer, target))\r\n return true;\r\n }\r\n else if (DHelper_1.DHelpers.isForOpponent(scope)) {\r\n if (Helpers_1.Helpers.isHostile(performer, target))\r\n return true;\r\n }\r\n else {\r\n // TODO: 中立は未対応\r\n throw new Error(\"Not implemented.\");\r\n }\r\n return false;\r\n }\r\n static searchTargetEntities(performer, scope, rmmzEffectScope, checkFaction) {\r\n if (scope.range == DEffect_1.DEffectFieldScopeType.Performer) {\r\n return [performer];\r\n }\r\n else if (scope.range == DEffect_1.DEffectFieldScopeType.Front1) {\r\n // ターゲット候補を集める\r\n const candidates = UMovement_1.UMovement.getAdjacentEntities(performer).filter(target => {\r\n if (checkFaction) {\r\n if (!this.testFactionMatch(performer, target, rmmzEffectScope))\r\n return false;\r\n }\r\n if (!this.checkAdjacentDirectlyAttack(performer, target))\r\n return false; // 壁の角など、隣接攻撃できなければダメ\r\n const targetBlock = MRLively_1.MRLively.mapView.currentMap.block(target.mx, target.my);\r\n if (!targetBlock || UBlock_1.UBlock.checkPurifier(targetBlock, performer))\r\n return false; // target の場所に聖域効果があるならダメ\r\n return true;\r\n });\r\n return candidates;\r\n /*\r\n // 隣接している有効な対象がいない\r\n if (candidates.length <= 0) return undefined;\r\n\r\n // 前ターンで攻撃したものがいれば、引き続き優先ターゲットにしてみる\r\n let target = candidates.find(e => e.entityId().equals(prevTargetEntityId));\r\n\r\n // 対象をランダム選択\r\n if (!target) {\r\n target = REGame.world.random().select(candidates);\r\n }\r\n\r\n assert(target);\r\n\r\n return { action: action, targets: [target] };\r\n */\r\n /*\r\n \r\n if (LCharacterAI.checkAdjacentDirectlyAttack(self, target) &&\r\n targetBlock &&!targetBlock.checkPurifier(self)) { // 聖域の巻物とか無ければ隣接攻撃可能。\r\n this._attackTargetEntityId = target.entityId();\r\n }\r\n */\r\n }\r\n else if (scope.range == DEffect_1.DEffectFieldScopeType.StraightProjectile) {\r\n let candidates = [];\r\n for (const dir of UMovement_1.UMovement.directions) {\r\n //const [ox, oy] = Helpers._dirToTileOffsetTable[dir];\r\n const ox = Helpers_1.Helpers._dirToTileOffsetTable[dir].x;\r\n const oy = Helpers_1.Helpers._dirToTileOffsetTable[dir].y;\r\n for (let i = 1; i < scope.length; i++) { // 足元を含む必要はないので i=1 から開始\r\n const x = performer.mx + (ox * i);\r\n const y = performer.my + (oy * i);\r\n const block = MRLively_1.MRLively.mapView.currentMap.tryGetBlock(x, y);\r\n // マップ外まで見たら列挙終了\r\n if (!block) {\r\n break;\r\n }\r\n // Block の視界内チェック (部屋の外周 1 マスは視界内)\r\n if (scope.area == DEffect_1.DEffectFieldScopeArea.Room) {\r\n const room = block.room();\r\n if (room) {\r\n if (USearch_1.USearch.checkInSightBlockFromSubject(performer, block)) {\r\n // 視界内\r\n }\r\n else {\r\n // 視界外\r\n break;\r\n }\r\n }\r\n else {\r\n // 通路内では隣接のみ視界内としたい\r\n if (i == 2)\r\n break;\r\n }\r\n }\r\n else if (scope.area == DEffect_1.DEffectFieldScopeArea.Floor) {\r\n throw new Error(\"Not implemented.\");\r\n }\r\n else {\r\n throw new Error(\"Unreachable\");\r\n }\r\n // Block 内の Target にできる Entity を集める\r\n const targets = block.getEntities().filter(target => {\r\n // 勢力チェック\r\n if (!this.testFactionMatch(performer, target, rmmzEffectScope))\r\n return false;\r\n return true;\r\n });\r\n if (targets.length > 0) {\r\n candidates = candidates.concat(targets);\r\n }\r\n }\r\n }\r\n return candidates;\r\n }\r\n else if (scope.range == DEffect_1.DEffectFieldScopeType.Room) {\r\n const candidates = [];\r\n MRLively_1.MRLively.mapView.currentMap.room(performer.roomId()).forEachEntities(entity => {\r\n if (this.testFactionMatch(performer, entity, rmmzEffectScope)) {\r\n candidates.push(entity);\r\n }\r\n ;\r\n });\r\n return candidates;\r\n }\r\n else {\r\n throw new Error(\"Unreachable.\");\r\n }\r\n return [];\r\n }\r\n /** skillAction の射程範囲内に、有効なターゲットが1つでも含まれているか確認する */\r\n //public static checkEntityWithinSkillActionRange(performer: LEntity, skillAction: CandidateSkillAction): boolean {\r\n static checkEntityWithinSkillActionRange(performer, skill, checkFaction, targets) {\r\n //const skill = REData.skills[skillAction.action.skillId];\r\n const effect = skill.emittor();\r\n //let count = 0;\r\n const entities = this.searchTargetEntities(performer, effect.scope, skill.rmmzEffectScope, checkFaction);\r\n for (const target of targets) { //skillAction.targets) {\r\n if (!!entities.find(x => x == target)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n //for (const t of skillAction.targets) {\r\n // if (this.checkEntityWithinRange(performer, effect, skill.rmmzEffectScope, t)) {\r\n // return true;\r\n // }\r\n //}\r\n //return count > 0;\r\n }\r\n /** effect の射程範囲内に target が含まれているかを確認する */\r\n /*\r\n public static checkEntityWithinRange(performer: LEntity, effect: DEffect, rmmzScope: DRmmzEffectScope, target: LEntity): boolean {\r\n const entities = this.searchTargetEntities(performer, effect.scope, rmmzScope);\r\n return !!entities.find(x => x == target);\r\n }\r\n */\r\n // public static chekcVisible(subject: LEntity, target: LEntity): boolean {\r\n // if (subject.hasTrait(REBasics.traits.bli))\r\n // return (target.traits(REBasics.traits.Invisible).length == 0);\r\n // }\r\n /**\r\n * self の視界内にいる敵対 Entity のうち、一番近いものを検索する。\r\n */\r\n // TODO: Move o USerarch\r\n static findInSightNearlyHostileEntity(self) {\r\n if (USearch_1.USearch.hasBlindness(self))\r\n return undefined; // 盲目\r\n return MRLively_1.MRLively.mapView.currentMap.getInsightEntities(self)\r\n .filter(e => Helpers_1.Helpers.isHostile(self, e) && USearch_1.USearch.isVisibleFromSubject(self, e))\r\n .immutableSort((a, b) => Helpers_1.Helpers.getDistance(self, a) - Helpers_1.Helpers.getDistance(self, b))\r\n .find(e => Helpers_1.Helpers.isHostile(self, e));\r\n }\r\n /**\r\n * 正面に話しかけられる Entity がいれば返す。\r\n */\r\n static findTalkableFront(entity) {\r\n const frontBlock = UMovement_1.UMovement.getFrontBlock(entity);\r\n const frontTarget = frontBlock.getFirstEntity();\r\n if (frontTarget && !Helpers_1.Helpers.isHostile(entity, frontTarget)) {\r\n if (!!frontTarget.queryReactions().find(x => x.actionId == MRBasics_1.MRBasics.actions.talk)) {\r\n return frontTarget;\r\n }\r\n }\r\n return undefined;\r\n }\r\n}\r\nexports.UAction = UAction;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/utility/UAction.ts?"); /***/ }), /***/ "./ts/mr/utility/UBlock.ts": /*!*********************************!*\ !*** ./ts/mr/utility/UBlock.ts ***! \*********************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.UBlock = void 0;\r\nconst LBlock_1 = __webpack_require__(/*! ts/mr/lively/LBlock */ \"./ts/mr/lively/LBlock.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\n/**\r\n * 様々な条件で Block を取得する方法を提供する。\r\n */\r\nclass UBlock {\r\n static pos(a1, a2) {\r\n if (a1 instanceof LBlock_1.LBlock) {\r\n return [a1.mx, a1.my];\r\n }\r\n else {\r\n return [a1, a2];\r\n }\r\n }\r\n static adjacentBlocks4(map, a1, a2) {\r\n const [x, y] = this.pos(a1, a2);\r\n return [\r\n map.block(x, y - 1),\r\n map.block(x - 1, y),\r\n map.block(x + 1, y),\r\n map.block(x, y + 1),\r\n ];\r\n }\r\n /** 指定座標の周囲 8 Block を取得する */\r\n static adjacentBlocks8XY(map, x, y) {\r\n return [\r\n map.block(x - 1, y - 1),\r\n map.block(x, y - 1),\r\n map.block(x + 1, y - 1),\r\n map.block(x - 1, y),\r\n map.block(x + 1, y),\r\n map.block(x - 1, y + 1),\r\n map.block(x, y + 1),\r\n map.block(x + 1, y + 1),\r\n ];\r\n }\r\n /** 指定 Block の周囲 8 Block を取得する */\r\n static getAdjacentBlocks8(map, block) {\r\n return this.adjacentBlocks8XY(map, block.mx, block.my);\r\n }\r\n /*\r\n public static iterateAdjacentBlocks8(map: LMap, block: LBlock, func: (b: LBlock) => void): void {\r\n const x = block.x();\r\n const y = block.y();\r\n for (const offset of UMovement.adjacent8Offsets) {\r\n const b = map.tryGetBlock(x + offset[0], y + offset[1]);\r\n if (b) {\r\n func(b);\r\n }\r\n }\r\n }\r\n */\r\n /** 指定した Entity にとって、この Block が浄化属性 (聖域の巻物) となるか */\r\n static checkPurifier(block, entity) {\r\n // FIXME: とりあえず決め打ちで、Enemy に対する SanctuaryBehavior のみチェックする\r\n // if (entity.findEntityBehavior(LEnemyBehavior)) {\r\n // const sanctuary = block.findEntity(e => !!e.findEntityBehavior(LSanctuaryBehavior));\r\n // if (sanctuary) {\r\n // // TODO: 張り付き?\r\n // return true;\r\n // }\r\n // }\r\n for (const entity2 of MRLively_1.MRLively.mapView.currentMap.entities()) {\r\n for (const fieldEffect of entity2.fieldEffects()) {\r\n // TODO: とりあえず今は LSanctuaryBehavior でしか使っていないので、通行可否で判断している\r\n if (!fieldEffect.onCheckPossibleMovement(entity, block.mx, block.my)) {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\nexports.UBlock = UBlock;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/utility/UBlock.ts?"); /***/ }), /***/ "./ts/mr/utility/UDialog.ts": /*!**********************************!*\ !*** ./ts/mr/utility/UDialog.ts ***! \**********************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.UDialog = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst LInventoryBehavior_1 = __webpack_require__(/*! ../lively/entity/LInventoryBehavior */ \"./ts/mr/lively/entity/LInventoryBehavior.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst SFeetDialog_1 = __webpack_require__(/*! ../system/dialogs/SFeetDialog */ \"./ts/mr/system/dialogs/SFeetDialog.ts\");\r\nconst SItemListDialog_1 = __webpack_require__(/*! ../system/dialogs/SItemListDialog */ \"./ts/mr/system/dialogs/SItemListDialog.ts\");\r\nclass UDialog {\r\n static postOpenInventoryDialog(cctx, entity, onClosed) {\r\n const dctx = cctx.dialogContext;\r\n const inventory = entity.findEntityBehavior(LInventoryBehavior_1.LInventoryBehavior);\r\n if (inventory) {\r\n dctx.activeDialog().openSubDialog(new SItemListDialog_1.SItemListDialog(entity, inventory, SItemListDialog_1.SItemListDialogSourceAction.Default), onClosed);\r\n return true;\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n static postOpenFeetDialog(cctx, entity, onClosed) {\r\n const dctx = cctx.dialogContext;\r\n const feetEntity = MRLively_1.MRLively.mapView.currentMap.firstFeetEntity(entity);\r\n if (feetEntity) {\r\n dctx.activeDialog().openSubDialog(new SFeetDialog_1.SFeetDialog(entity, feetEntity), onClosed);\r\n return true;\r\n }\r\n else {\r\n cctx.postMessage((0, Common_1.tr2)(\"足元には何もない。\"));\r\n return false;\r\n }\r\n }\r\n static openSkillDialog(dctx, model, entity) {\r\n }\r\n}\r\nexports.UDialog = UDialog;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/utility/UDialog.ts?"); /***/ }), /***/ "./ts/mr/utility/UEffect.ts": /*!**********************************!*\ !*** ./ts/mr/utility/UEffect.ts ***! \**********************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.UEffect = exports.UResolvedApplyEffects = exports.UResolvedApplyEffectTarget = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\n// export interface UResolveApplyEffects {\r\n// mainTarget: LEntity; // 参考情報\r\n// targets: Map; // 必要であれば mainTarget も含まれている。\r\n// }\r\nclass UResolvedApplyEffectTarget {\r\n constructor(target, mainTarget) {\r\n this.target = target;\r\n this.mainTarget = mainTarget;\r\n this.candidateEffects = [];\r\n this.actualEffects = [];\r\n }\r\n}\r\nexports.UResolvedApplyEffectTarget = UResolvedApplyEffectTarget;\r\nclass UResolvedApplyEffects {\r\n constructor() {\r\n this.targets = [];\r\n }\r\n addCandidateTargetEffect(target, mainTarget, effect) {\r\n const t1 = this.targets.find(x => x.target == target);\r\n if (t1) {\r\n (0, Common_1.assert)(t1.mainTarget == mainTarget);\r\n t1.candidateEffects.push(effect);\r\n }\r\n else {\r\n const t2 = new UResolvedApplyEffectTarget(target, mainTarget);\r\n t2.candidateEffects.push(effect);\r\n this.targets.push(t2);\r\n }\r\n }\r\n}\r\nexports.UResolvedApplyEffects = UResolvedApplyEffects;\r\n/**\r\n * Effect 関係のヘルパー\r\n */\r\nclass UEffect {\r\n static resolveApplyEffects(allEffects, targets, rand) {\r\n const result = new UResolvedApplyEffects();\r\n // まず SubComponent を含めた適用対象と候補 Effect を取り出す\r\n for (const target of targets) {\r\n this.selectCandidateTargetEffects(result, allEffects, target, rand);\r\n }\r\n // 候補 Effect から実際に適用する Effect を決める\r\n for (const target of result.targets) {\r\n this.resolveApplyEffectsSingleTarget(target, rand);\r\n }\r\n return result;\r\n }\r\n static selectCandidateTargetEffects(result, allEffects, target, rand) {\r\n for (const effect of allEffects) {\r\n // Find sub-components\r\n const subComponentKey = effect.data().effect.subEntityFindKey.key;\r\n if (subComponentKey) {\r\n for (const subTarget of target.querySubEntities(subComponentKey)) {\r\n result.addCandidateTargetEffect(subTarget, target, effect);\r\n }\r\n }\r\n else {\r\n // Main Effect\r\n result.addCandidateTargetEffect(target, target, effect);\r\n }\r\n }\r\n }\r\n static resolveApplyEffectsSingleTarget(result, rand) {\r\n // 条件無し Effect はそのまま使える\r\n const wthoutConditionEffects = result.candidateEffects.filter(x => !x.data().hasCondition());\r\n for (const effect of wthoutConditionEffects) {\r\n result.actualEffects.push(effect);\r\n }\r\n // 条件でフィルタリング\r\n const candidates = result.candidateEffects.filter(x => x.data().hasCondition() && this.meetsCondition(x, result.target));\r\n if (candidates.length > 0) {\r\n const ratedCandidates = [];\r\n for (const effect of candidates) {\r\n if (effect.data().conditions.applyRating > 0) {\r\n // レート付きの Effect は後程選択する\r\n ratedCandidates.push(effect);\r\n }\r\n else {\r\n // レート無しはここで確定\r\n result.actualEffects.push(effect);\r\n }\r\n }\r\n // レート付きの中から1つ選択\r\n const re = this.selectEffect(ratedCandidates, rand);\r\n if (re) {\r\n result.actualEffects.push(re);\r\n }\r\n }\r\n else {\r\n // 条件に一致するものが無かったら、fallback を使う\r\n for (const effect of result.candidateEffects.filter(x => x.data().conditions.fallback)) {\r\n result.actualEffects.push(effect);\r\n }\r\n }\r\n }\r\n static meetsCondition(effect, target) {\r\n const data = effect.data();\r\n const entityData = target.data;\r\n if (data.conditions.fallback) {\r\n return false;\r\n }\r\n if (data.conditions.targetCategoryId != 0) {\r\n if (data.conditions.targetCategoryId != target.kindDataId()) {\r\n return false;\r\n }\r\n }\r\n if (data.conditions.targetRaceId != 0) {\r\n if (!target.queryRaceIds().includes(data.conditions.targetRaceId)) {\r\n return false;\r\n }\r\n }\r\n // 条件にすべて一致 or 条件がひとつもない\r\n return true;\r\n }\r\n static selectEffect(effectList, rand) {\r\n return this.selectRating(rand, effectList, x => x.data().conditions.applyRating);\r\n }\r\n static selectRating(rand, items, rating) {\r\n const ratingMax = Math.max(...items.map(a => rating(a)));\r\n const ratingZero = ratingMax - 10; //- 3;\r\n const actualItems = items.filter(a => rating(a) > ratingZero);\r\n const sum = actualItems.reduce((r, a) => r + rating(a) - ratingZero, 0);\r\n if (sum > 0) {\r\n let value = rand.nextIntWithMax(sum);\r\n for (const item of actualItems) {\r\n const r = rating(item);\r\n if (!r)\r\n continue;\r\n value -= (r) - ratingZero;\r\n if (value < 0) {\r\n return item;\r\n }\r\n }\r\n throw new Error(\"Unreachable.\");\r\n }\r\n else {\r\n return undefined;\r\n }\r\n }\r\n /**\r\n *\r\n * @param rand\r\n * @param items\r\n * @param excludeDiff この値以上離れているレーティングはそもそも採用しない\r\n * @param rating\r\n * @returns\r\n */\r\n static selectRatingForce(rand, items, excludeDiff, rating) {\r\n (0, Common_1.assert)(items.length > 0);\r\n const ratingMax = Math.max(...items.map(a => rating(a)));\r\n const ratingZero = ratingMax - excludeDiff;\r\n const actualItems = items.filter(a => rating(a) > ratingZero);\r\n const sum = actualItems.reduce((r, a) => r + rating(a) - ratingZero, 0);\r\n if (sum > 0) {\r\n let value = rand.nextIntWithMax(sum);\r\n for (const item of actualItems) {\r\n const r = rating(item);\r\n if (!r)\r\n continue;\r\n value -= (r) - ratingZero;\r\n if (value < 0) {\r\n return item;\r\n }\r\n }\r\n throw new Error(\"Unreachable.\");\r\n }\r\n else {\r\n // レーティングがすべて 0 なら普通にランダム選択する\r\n return items[rand.nextIntWithMax(items.length)];\r\n }\r\n }\r\n}\r\nexports.UEffect = UEffect;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/utility/UEffect.ts?"); /***/ }), /***/ "./ts/mr/utility/UIdentify.ts": /*!************************************!*\ !*** ./ts/mr/utility/UIdentify.ts ***! \************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.UIdentify = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst UName_1 = __webpack_require__(/*! ./UName */ \"./ts/mr/utility/UName.ts\");\r\nclass UIdentify {\r\n static identifyByTiming(cctx, actor, target, actionId, withMessage = true) {\r\n if (MRLively_1.MRLively.mapView.focusedEntity() != actor)\r\n return;\r\n const data = target.data;\r\n if (data.identificationReaction > 0 && data.identificationReaction == actionId) {\r\n this.identify(cctx, target, withMessage);\r\n }\r\n }\r\n /**\r\n * 指定した Entity を識別する。\r\n */\r\n static identify(cctx, target, withMessage) {\r\n if (MRLively_1.MRLively.getCurrentIdentifyer().checkGlobalIdentified(target)) {\r\n // 既に名前識別済みであれば個体識別するだけでOK\r\n target.setIndividualIdentified(true);\r\n }\r\n else {\r\n // 名前未識別であればメッセージも表示する\r\n const name1 = UName_1.UName.makeNameAsItem(target);\r\n target.setIndividualIdentified(true);\r\n MRLively_1.MRLively.getCurrentIdentifyer().identifyGlobal(target.dataId);\r\n const name2 = UName_1.UName.makeNameAsItem(target);\r\n if (withMessage) {\r\n cctx.postMessage((0, Common_1.tr2)(\"%1は%2だった。\").format(name1, name2));\r\n }\r\n }\r\n }\r\n}\r\nexports.UIdentify = UIdentify;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/utility/UIdentify.ts?"); /***/ }), /***/ "./ts/mr/utility/UInventory.ts": /*!*************************************!*\ !*** ./ts/mr/utility/UInventory.ts ***! \*************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.UInventory = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst LEquipmentUserBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LEquipmentUserBehavior */ \"./ts/mr/lively/behaviors/LEquipmentUserBehavior.ts\");\r\nconst LInventoryBehavior_1 = __webpack_require__(/*! ../lively/entity/LInventoryBehavior */ \"./ts/mr/lively/entity/LInventoryBehavior.ts\");\r\nconst SCommand_1 = __webpack_require__(/*! ../system/SCommand */ \"./ts/mr/system/SCommand.ts\");\r\nconst SCommon_1 = __webpack_require__(/*! ../system/SCommon */ \"./ts/mr/system/SCommon.ts\");\r\nconst SEffectContext_1 = __webpack_require__(/*! ../system/SEffectContext */ \"./ts/mr/system/SEffectContext.ts\");\r\nconst UName_1 = __webpack_require__(/*! ./UName */ \"./ts/mr/utility/UName.ts\");\r\nclass UInventory {\r\n /**\r\n * Inventory のソート。\r\n *\r\n * NOTE: LEquipmentUserBehavior を使いたいが、LInventoryBehavior に実装してしまうと import の循環参照が発生するためこちらで実装する。\r\n */\r\n static sort(inventory) {\r\n const equipmentUser = inventory.ownerEntity().findEntityBehavior(LEquipmentUserBehavior_1.LEquipmentUserBehavior);\r\n const entities = this.makeMergedStackables(inventory);\r\n let result;\r\n if (equipmentUser) {\r\n result = entities.sort((a, b) => {\r\n const sa = equipmentUser.isEquipped(a) ? a.kindDataId() : a.kindDataId() + 10000;\r\n const sb = equipmentUser.isEquipped(b) ? b.kindDataId() : b.kindDataId() + 10000;\r\n if (sa == sb) {\r\n // DataId も確認\r\n return a.dataId - b.dataId;\r\n }\r\n else {\r\n return sa - sb;\r\n }\r\n });\r\n }\r\n else {\r\n result = entities.sort((a, b) => {\r\n const sa = a.kindDataId();\r\n const sb = b.kindDataId();\r\n return sa - sb;\r\n });\r\n }\r\n inventory.entities = result.map(x => x.entityId().clone());\r\n }\r\n static makeMergedStackables(inventory) {\r\n const entities = inventory.items;\r\n for (let i = entities.length - 1; i >= 0; i--) { // 後ろからループ\r\n for (let j = i - 1; j >= 0; j--) { // i のひとつ前から前方へ確認\r\n const src = entities[i];\r\n const dst = entities[j];\r\n if (dst.checkStackable(src)) {\r\n dst.increaseStack(src);\r\n entities.mutableRemoveAt(i);\r\n break;\r\n }\r\n }\r\n }\r\n return entities;\r\n }\r\n /**\r\n * [預ける]\r\n */\r\n static postStoreItemsToWarehouse(cctx, user, warehouse, items, outResult) {\r\n const userInventory = user.getEntityBehavior(LInventoryBehavior_1.LInventoryBehavior);\r\n const warehouseInventory = warehouse.getEntityBehavior(LInventoryBehavior_1.LInventoryBehavior);\r\n return cctx.postTask(c => {\r\n if (warehouseInventory.itemCount + items.length > warehouseInventory.capacity) {\r\n cctx.postMessage((0, Common_1.tr2)(\"倉庫がいっぱいです。\"));\r\n outResult.code = SCommon_1.SWarehouseDialogResult.FullyCanceled;\r\n c.reject();\r\n }\r\n }).then2(c => {\r\n const tasks = items.map(item => \r\n // item を取り出せるか確認\r\n cctx.postCommandTask(new SCommand_1.STestTakeItemCommand(item, user))\r\n // item を格納できるか確認\r\n .thenCommandTask(new SCommand_1.STestAddItemCommand(warehouse, item))\r\n .then2(_ => {\r\n // Item を移す\r\n userInventory.removeEntity(item);\r\n warehouseInventory.addEntity(item);\r\n cctx.postMessage((0, Common_1.tr2)(\"%1を預けた。\").format(UName_1.UName.makeNameAsItem(item)));\r\n this.sort(warehouseInventory);\r\n outResult.items.push(item);\r\n }));\r\n return cctx.whenAll(tasks);\r\n });\r\n }\r\n /**\r\n * [引き出す]\r\n */\r\n static postWithdrawItemsToWarehouse(cctx, user, warehouse, items, outResult) {\r\n const userInventory = user.getEntityBehavior(LInventoryBehavior_1.LInventoryBehavior);\r\n const warehouseInventory = warehouse.getEntityBehavior(LInventoryBehavior_1.LInventoryBehavior);\r\n const subject = new SEffectContext_1.SEffectSubject(user);\r\n return cctx.postTask(c => {\r\n if (userInventory.itemCount + items.length > userInventory.capacity) {\r\n cctx.postMessage((0, Common_1.tr2)(\"もちものがいっぱいです。\"));\r\n outResult.code = SCommon_1.SWarehouseDialogResult.FullyCanceled;\r\n c.reject();\r\n }\r\n }).then2(_ => {\r\n const tasks = items.map(item => \r\n // item を取り出せるか確認\r\n cctx.postCommandTask(new SCommand_1.STestTakeItemCommand(item, user))\r\n // item を格納できるか確認\r\n .thenCommandTask(new SCommand_1.STestAddItemCommand(user, item))\r\n .then2(_ => {\r\n // Item を移す\r\n warehouseInventory.removeEntity(item);\r\n userInventory.addEntity(item);\r\n cctx.postMessage((0, Common_1.tr2)(\"%1を取り出した。\").format(UName_1.UName.makeNameAsItem(item)));\r\n outResult.items.push(item);\r\n }));\r\n return cctx.whenAll(tasks);\r\n });\r\n /*\r\n items.forEach(item => {\r\n // Item を取り出せるか確認\r\n cctx.post(warehouse, warehouse, subject, item, testPickOutItem,\r\n () => {\r\n \r\n // Item を格納できるか確認\r\n cctx.postCommandTask(user, SCommand.make(MRBasics.commands.testPutInItem).withObject(item))\r\n .then2(__filename => {\r\n \r\n // Item を移す\r\n warehouseInventory.removeEntity(item);\r\n userInventory.addEntity(item);\r\n \r\n cctx.postMessage(tr2(\"%1を取り出した。\").format(UName.makeNameAsItem(item)));\r\n //resultItems.push(item.entityId());\r\n });\r\n return true;\r\n });\r\n });\r\n */\r\n }\r\n /**\r\n * [売る]\r\n */\r\n static postSellItemsAndDestroy(cctx, customer, items) {\r\n const customerInventory = customer.getEntityBehavior(LInventoryBehavior_1.LInventoryBehavior);\r\n const subject = new SEffectContext_1.SEffectSubject(customer);\r\n let testCount = 0;\r\n for (const item of items) {\r\n cctx.postCommandTask(new SCommand_1.STestTakeItemCommand(item, customer)) // item を取り出せる?\r\n .then2(c => {\r\n testCount++;\r\n if (testCount >= items.length) {\r\n // 全部確認完了\r\n let price = 0;\r\n for (const item of items) {\r\n price += item.data.purchasePrice;\r\n item.removeFromParent();\r\n item.destroy();\r\n }\r\n customerInventory.gainGold(price);\r\n }\r\n });\r\n }\r\n }\r\n}\r\nexports.UInventory = UInventory;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/utility/UInventory.ts?"); /***/ }), /***/ "./ts/mr/utility/ULimitations.ts": /*!***************************************!*\ !*** ./ts/mr/utility/ULimitations.ts ***! \***************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ULimitations = void 0;\r\nconst LTrapBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LTrapBehavior */ \"./ts/mr/lively/behaviors/LTrapBehavior.ts\");\r\nconst LUnitBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LUnitBehavior */ \"./ts/mr/lively/behaviors/LUnitBehavior.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst PluginParameters_1 = __webpack_require__(/*! ../PluginParameters */ \"./ts/mr/PluginParameters.ts\");\r\nclass ULimitations {\r\n static getItemCountInMap() {\r\n const map = MRLively_1.MRLively.mapView.currentMap;\r\n let count = 0;\r\n // Unit, Trap 以外を集計\r\n map.iterateEntities(e => {\r\n if (!e.findEntityBehavior(LUnitBehavior_1.LUnitBehavior) && !e.findEntityBehavior(LTrapBehavior_1.LTrapBehavior)) {\r\n count++;\r\n }\r\n });\r\n return count;\r\n }\r\n static isItemCountFullyInMap() {\r\n return this.getItemCountInMap() >= PluginParameters_1.paramMaxItemsInMap;\r\n }\r\n static getTrapCountInMap() {\r\n const map = MRLively_1.MRLively.mapView.currentMap;\r\n let count = 0;\r\n map.iterateEntities(e => {\r\n if (e.findEntityBehavior(LTrapBehavior_1.LTrapBehavior)) {\r\n count++;\r\n }\r\n });\r\n return count;\r\n }\r\n static getResidualsTrapCountInMap() {\r\n return Math.max(PluginParameters_1.paramMaxTrapsInMap - this.getTrapCountInMap(), 0);\r\n }\r\n}\r\nexports.ULimitations = ULimitations;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/utility/ULimitations.ts?"); /***/ }), /***/ "./ts/mr/utility/UMovement.ts": /*!************************************!*\ !*** ./ts/mr/utility/UMovement.ts ***! \************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.UMovement = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LMap_1 = __webpack_require__(/*! ts/mr/lively/LMap */ \"./ts/mr/lively/LMap.ts\");\r\nconst Helpers_1 = __webpack_require__(/*! ../system/Helpers */ \"./ts/mr/system/Helpers.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ../system/MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst UBlock_1 = __webpack_require__(/*! ts/mr/utility/UBlock */ \"./ts/mr/utility/UBlock.ts\");\r\nconst DCommon_1 = __webpack_require__(/*! ../data/DCommon */ \"./ts/mr/data/DCommon.ts\");\r\nconst HMovement_1 = __webpack_require__(/*! ../lively/helpers/HMovement */ \"./ts/mr/lively/helpers/HMovement.ts\");\r\nconst LActivity_1 = __webpack_require__(/*! ../lively/activities/LActivity */ \"./ts/mr/lively/activities/LActivity.ts\");\r\nclass UMovement {\r\n static distanceSq(x1, y1, x2, y2) {\r\n const x = x1 - x2;\r\n const y = y1 - y2;\r\n return (x * x) + (y * y);\r\n }\r\n /**\r\n * 向き反転\r\n */\r\n static reverseDir(d) {\r\n return 10 - d;\r\n }\r\n /**\r\n * 2 つの Entity が隣接しているか確認する\r\n */\r\n static checkAdjacentEntities(entity1, entity2) {\r\n return (Math.abs(entity1.mx - entity2.mx) <= 1 && Math.abs(entity1.my - entity2.my) <= 1);\r\n }\r\n /**\r\n * 2つの 座標 が隣接しているかどうか\r\n */\r\n static checkAdjacentPositions(x1, y1, x2, y2) {\r\n const dx = x1 - x2;\r\n const dy = y1 - y2;\r\n return Math.abs(dx) <= 1 && Math.abs(dy) <= 1;\r\n }\r\n /**\r\n * 2つの Entity が隣接しているかどうか\r\n */\r\n static checkEntityAdjacent(e1, e2) {\r\n const dx = e1.mx - e2.mx;\r\n const dy = e1.my - e2.my;\r\n return Math.abs(dx) <= 1 && Math.abs(dy) <= 1;\r\n }\r\n /**\r\n * 2つの Entity が直接隣接しているかどうか (壁角を挟んだ斜めは隣接とみなさない)\r\n */\r\n static checkDirectlyAdjacentEntity(e1, e2) {\r\n const d = this.getLookAtDir(e1, e2);\r\n if (this.checkDiagonalWallCornerCrossing(e1, d))\r\n return false;\r\n return this.checkEntityAdjacent(e1, e2);\r\n }\r\n /**\r\n * entity が指定方向(斜め)を向くとき、壁の角と交差しているかを確認する。\r\n */\r\n static checkDiagonalWallCornerCrossing(entity, d) {\r\n const map = MRLively_1.MRLively.mapView.currentMap;\r\n if (HMovement_1.HMovement.isDiagonalMoving(d)) {\r\n // 斜め場合\r\n const fl = HMovement_1.HMovement.rotatePositionByDir(7, d); // 左前\r\n const fr = HMovement_1.HMovement.rotatePositionByDir(9, d); // 右前\r\n const flBlock = map.block(entity.mx + fl.x, entity.my + fl.y);\r\n const frBlock = map.block(entity.mx + fr.x, entity.my + fr.y);\r\n if (flBlock.isWallLikeShape())\r\n return true;\r\n if (frBlock.isWallLikeShape())\r\n return true;\r\n return false;\r\n }\r\n else {\r\n // 平行の場合\r\n return false;\r\n }\r\n }\r\n /**\r\n * entity が指定した方向に歩行移動できるかを確認する。\r\n */\r\n static checkPassageToDir(entity, dir) {\r\n const offset = Helpers_1.Helpers.dirToTileOffset(dir);\r\n const map = MRLively_1.MRLively.mapView.currentMap;\r\n const oldBlock = map.block(entity.mx, entity.my);\r\n const newBlock = map.block(entity.mx + offset.x, entity.my + offset.y);\r\n return HMovement_1.HMovement.checkPassageBlockToBlock(entity, oldBlock, newBlock, LMap_1.MovingMethod.Walk);\r\n }\r\n /**\r\n * entity が指定した隣接位置へ移動できるかを確認する。\r\n */\r\n /*\r\n public static checkPassageToAdjacent(entity: LEntity, mx: number, my: number): boolean {\r\n const map = REGame.map;\r\n const oldBlock = map.block(entity.x, entity.y);\r\n const newBlock = map.block(mx, my);\r\n return this.checkPassageBlockToBlock(entity, oldBlock, newBlock, MovingMethod.Walk);\r\n }\r\n */\r\n /**\r\n * base が target を向く時の方向を計算する\r\n */\r\n static getLookAtDir(base, target) {\r\n const dx = target.mx - base.mx;\r\n const dy = target.my - base.my;\r\n return Helpers_1.Helpers.offsetToDir(dx, dy);\r\n }\r\n /**\r\n * base が target を向く時の方向を計算する\r\n */\r\n static getLookAtDirFromPos(baseX, baseY, targetX, targetY) {\r\n return Helpers_1.Helpers.offsetToDir(targetX - baseX, targetY - baseY);\r\n }\r\n /**\r\n * 重心を取得する\r\n */\r\n static getCenter(entities) {\r\n let x = 0;\r\n let y = 0;\r\n for (const e of entities) {\r\n x += e.mx;\r\n y += e.my;\r\n }\r\n return { x: Math.floor(x / entities.length), y: Math.floor(y / entities.length) };\r\n }\r\n /**\r\n * 重心を取得する\r\n */\r\n static getCenterOfRoom(room) {\r\n const x = (room.mx1 + room.mx2) / 2;\r\n const y = (room.my1 + room.my2) / 2;\r\n return { x: Math.floor(x), y: Math.floor(y) };\r\n }\r\n /**\r\n * 方向 d から時計回りに、次の方向を求める\r\n */\r\n static getNextDirCW(d) {\r\n switch (d) {\r\n case 1: return 4;\r\n case 2: return 1;\r\n case 3: return 2;\r\n case 4: return 7;\r\n case 6: return 3;\r\n case 7: return 8;\r\n case 8: return 9;\r\n case 9: return 6;\r\n default: return 2;\r\n }\r\n }\r\n /**\r\n * 方向 d に対する右手方向を求める\r\n */\r\n static getRightDir(d) {\r\n return this.getNextDirCW(this.getNextDirCW(d));\r\n }\r\n /**\r\n * Entity に隣接する指定した方向にある Block を取得する。\r\n * @param entity\r\n * @param dir\r\n * @returns\r\n */\r\n static getAdjacentBlock(entity, dir) {\r\n const offset = Helpers_1.Helpers._dirToTileOffsetTable[dir];\r\n const block = MRLively_1.MRLively.mapView.currentMap.block(entity.mx + offset.x, entity.my + offset.y);\r\n return block;\r\n }\r\n /**\r\n * Entity の正面の Block を取得する\r\n */\r\n static getFrontBlock(entity) {\r\n const front = Helpers_1.Helpers.makeEntityFrontPosition(entity, 1);\r\n const block = MRLively_1.MRLively.mapView.currentMap.block(front.x, front.y);\r\n return block;\r\n }\r\n /**\r\n * Entity の周囲 8 マスの Block を取得する。(有効座標のみ)\r\n */\r\n static getAdjacentBlocks(entity) {\r\n const map = MRLively_1.MRLively.mapView.currentMap;\r\n (0, Common_1.assert)(map.floorId().equals(entity.floorId));\r\n const blocks = [];\r\n for (const offset of this.adjacent8Offsets) {\r\n const x = entity.mx + offset[0];\r\n const y = entity.my + offset[1];\r\n if (map.isValidPosition(x, y)) {\r\n blocks.push(map.block(x, y));\r\n }\r\n }\r\n return blocks;\r\n }\r\n /**\r\n * Entity の周囲 8 マスの隣接 Entity を取得する。\r\n * layerKind を指定すると、そのレイヤーだけ取得する。\r\n * 足元は取得しない。\r\n * 単純に列挙するだけで、通行判定や攻撃可能判定は行わない。\r\n */\r\n static getAdjacentEntities(entity, layerKind) {\r\n const result = [];\r\n for (const block of this.getAdjacentBlocks(entity)) {\r\n for (const entity of block.getEntities()) {\r\n result.push(entity);\r\n }\r\n }\r\n return result;\r\n }\r\n /**\r\n *\r\n */\r\n static getNextAdjacentEntityDirCW(entity) {\r\n const map = MRLively_1.MRLively.mapView.currentMap;\r\n let d = entity.dir;\r\n for (let i = 0; i < 9; i++) {\r\n const offset = Helpers_1.Helpers.dirToTileOffset(d);\r\n const mx = entity.mx + offset.x;\r\n const my = entity.my + offset.y;\r\n const e = map.block(mx, my).aliveEntity(DCommon_1.DBlockLayerKind.Unit);\r\n if (e) {\r\n return d;\r\n }\r\n d = this.getNextDirCW(d);\r\n }\r\n return entity.dir;\r\n }\r\n /**\r\n * 左折の法則に従い、移動候補にできる Block を優先度順に取得する。\r\n */\r\n static getMovingCandidateBlockAsLHRule(entity, dir) {\r\n /*\r\n const result: LBlock[] = [];\r\n for (const offset of this.LHRuleOffsets) {\r\n const pos = this.transformRotationBlock(offset.x, offset.y, entity.dir);\r\n const block = REGame.map.tryGetBlock(pos.x, pos.y);\r\n if (block) result.push(block);\r\n }\r\n */\r\n const map = MRLively_1.MRLively.mapView.currentMap;\r\n const oldBlock = map.block(entity.mx, entity.my);\r\n for (const offset of this.LHRuleOffsets) {\r\n const pos = HMovement_1.HMovement.transformRotationBlock(offset.x, offset.y, dir);\r\n const block = map.tryGetBlock(entity.mx + pos.x, entity.my + pos.y);\r\n if (block && HMovement_1.HMovement.checkPassageBlockToBlock(entity, oldBlock, block, LMap_1.MovingMethod.Walk)) {\r\n return block;\r\n }\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * dir 方向の正面 3 Block を取得する。\r\n */\r\n static getWay3FrontBlocks(entity, dir) {\r\n const result = [];\r\n const map = MRLively_1.MRLively.mapView.currentMap;\r\n for (const offset of this.way3Offsets) {\r\n const pos = HMovement_1.HMovement.transformRotationBlock(offset.x, offset.y, dir);\r\n const block = map.tryGetBlock(entity.mx + pos.x, entity.my + pos.y);\r\n if (block) {\r\n result.push(block);\r\n }\r\n }\r\n return result;\r\n }\r\n /**\r\n * \"移動\" できる隣接 Block を取得する\r\n */\r\n static getMovableAdjacentTiles(entity) {\r\n const result = [];\r\n const map = MRLively_1.MRLively.mapView.currentMap;\r\n const oldBlock = map.block(entity.mx, entity.my);\r\n for (const d of this.AdjacentDirs) {\r\n const offset = Helpers_1.Helpers.dirToTileOffset(d);\r\n const block = map.tryGetBlock(entity.mx + offset.x, entity.my + offset.y);\r\n if (block && HMovement_1.HMovement.checkPassageBlockToBlock(entity, oldBlock, block, LMap_1.MovingMethod.Walk)) {\r\n result.push(block);\r\n }\r\n }\r\n return result;\r\n }\r\n /** entity を配置できる直近の Block を選択する。 */\r\n static selectNearbyLocatableBlock(map, rand, mx, my, layerKind, entity) {\r\n const maxDistance = 3;\r\n for (let distance = 0; distance <= maxDistance; distance++) {\r\n const candidates = map.getEdgeBlocks(mx, my, distance)\r\n .filter(b => {\r\n if (b.isWallLikeShape()) {\r\n // 壁の中には落ちない\r\n return false;\r\n }\r\n const layer = b.layer(layerKind);\r\n if (layer.isContainsAnyEntity()) // 既に何か Entity がいる?\r\n if (layer.entityIds().length == 1 && layer.entityIds()[0].equals(entity.entityId()))\r\n return true; // それが自分自身であれば配置はできることにする。再Drop とかで使いたい。\r\n else\r\n return false;\r\n else\r\n return true;\r\n });\r\n if (candidates.length > 0) {\r\n return rand.select(candidates);\r\n }\r\n }\r\n return undefined;\r\n }\r\n static rotateDir(localDir, dir) {\r\n const localPos = Helpers_1.Helpers.dirToTileOffset(localDir);\r\n const pos = HMovement_1.HMovement.transformRotationBlock(localPos.x, localPos.y, dir);\r\n return Helpers_1.Helpers.offsetToDir(pos.x, pos.y);\r\n }\r\n static checkDashStopBlock(entity, dir, type) {\r\n const x = entity.mx;\r\n const y = entity.my;\r\n const map = MRLively_1.MRLively.mapView.currentMap;\r\n const front = Helpers_1.Helpers.dirToTileOffset(dir);\r\n const block = map.block(x, y);\r\n const frontBlock = map.block(x + front.x, y + front.y);\r\n if (!HMovement_1.HMovement.checkPassageBlockToBlock(entity, block, frontBlock, LMap_1.MovingMethod.Walk))\r\n return false; // そもそも Block 間の移動ができない\r\n //if (type == LDashType.StraightDash) {\r\n if (block.layer(DCommon_1.DBlockLayerKind.Ground).isContainsAnyEntity())\r\n return false; // 足元に何かしらある場合はダッシュ停止\r\n // }\r\n // else {\r\n // }\r\n if (block._roomId != frontBlock._roomId)\r\n return false; // 部屋と部屋や、部屋と通路の境界\r\n // 周辺ブロックのチェック\r\n if (type == LActivity_1.LDashType.StraightDash) {\r\n if (UBlock_1.UBlock.adjacentBlocks8XY(map, x, y).find(b => b.layer(DCommon_1.DBlockLayerKind.Unit).isContainsAnyEntity() || b.layer(DCommon_1.DBlockLayerKind.Ground).isContainsAnyEntity()))\r\n return false;\r\n }\r\n if (block.isPassageway()) {\r\n const back = Helpers_1.Helpers.dirToTileOffset(this.reverseDir(dir));\r\n const count1 = UBlock_1.UBlock.adjacentBlocks4(map, x + back.x, y + back.y).filter(b => b.isFloorLikeShape()).length;\r\n const count2 = UBlock_1.UBlock.adjacentBlocks4(map, x, y).filter(b => b.isFloorLikeShape()).length;\r\n if (count1 < count2)\r\n return false;\r\n }\r\n else {\r\n if (block.isRoomInnerEntrance())\r\n return false;\r\n }\r\n return true;\r\n }\r\n static moveEntity(cctx, entity, x, y, method, toLayer) {\r\n const map = MRLively_1.MRLively.mapView.currentMap;\r\n (0, Common_1.assert)(entity.floorId.equals(map.floorId()));\r\n if (!map.isValidPosition(x, y)) {\r\n return false; // マップ外への移動\r\n }\r\n const oldBlock = map.block(entity.mx, entity.my);\r\n const newBlock = map.block(x, y);\r\n if (HMovement_1.HMovement.checkPassageBlockToBlock(entity, oldBlock, newBlock, method, toLayer)) {\r\n (0, Common_1.assert)(oldBlock.removeEntity(entity));\r\n entity.mx = x;\r\n entity.my = y;\r\n newBlock.addEntity(toLayer, entity);\r\n this._postLocate(entity, oldBlock, newBlock, map, cctx);\r\n return true;\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n static locateEntityAtFloorMoved(entity, floorId, x, y) {\r\n entity.floorId = floorId.clone();\r\n entity.mx = x;\r\n entity.my = y;\r\n }\r\n static _postLocate(entity, oldBlock, newBlock, map, cctx) {\r\n (0, Common_1.assert)(!entity.isOnOffstage());\r\n newBlock.setFootpoint(entity);\r\n if (MRLively_1.MRLively.mapView.focusedEntityId().equals(entity.entityId())) {\r\n MRSystem_1.MRSystem.fovSystem.markBlockPlayerPassed(map, newBlock.mx, newBlock.my);\r\n }\r\n if (oldBlock && cctx) {\r\n if (oldBlock._roomId != newBlock._roomId) {\r\n const args = {\r\n entity: entity,\r\n newRoomId: newBlock._roomId,\r\n oldRoomId: oldBlock._roomId,\r\n };\r\n MRLively_1.MRLively.eventServer.publish(cctx, MRBasics_1.MRBasics.events.roomEnterd, args);\r\n MRLively_1.MRLively.eventServer.publish(cctx, MRBasics_1.MRBasics.events.roomLeaved, args);\r\n }\r\n }\r\n entity._located = true;\r\n }\r\n}\r\nexports.UMovement = UMovement;\r\n// 8 を基準に時計回り\r\nUMovement._edgeOffsetTable = [\r\n 0,\r\n 5, 4, 3,\r\n 6, 0, 2,\r\n 7, 0, 1,\r\n];\r\n// 左折の法則のオフセット\r\n// http://twist.jpn.org/sfcsiren/index.php?%E3%83%A2%E3%83%B3%E3%82%B9%E3%82%BF%E3%83%BC%E3%81%AE%E8%A1%8C%E5%8B%95%E3%82%A2%E3%83%AB%E3%82%B4%E3%83%AA%E3%82%BA%E3%83%A0#zd804a50\r\nUMovement.LHRuleOffsets = [\r\n { x: 0, y: -1 }, { x: -1, y: -1 }, { x: 1, y: -1 }, { x: -1, y: 0 }, { x: 1, y: 0 }\r\n];\r\n// 正面3方向用オフセット\r\nUMovement.way3Offsets = [\r\n { x: 0, y: -1 }, { x: -1, y: -1 }, { x: 1, y: -1 }\r\n];\r\nUMovement.directions = [\r\n 1, 2, 3, 4, 6, 7, 8, 9,\r\n];\r\nUMovement.adjacent8Offsets = [\r\n [-1, -1], [0, -1], [1, -1],\r\n [-1, 0], [1, 0],\r\n [-1, 1], [0, 1], [1, 1],\r\n];\r\nUMovement.AdjacentDirs = [1, 2, 3, 4, 6, 7, 8, 9];\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/utility/UMovement.ts?"); /***/ }), /***/ "./ts/mr/utility/UName.ts": /*!********************************!*\ !*** ./ts/mr/utility/UName.ts ***! \********************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.UName = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst LIdentifyer_1 = __webpack_require__(/*! ts/mr/lively/LIdentifyer */ \"./ts/mr/lively/LIdentifyer.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst SView_1 = __webpack_require__(/*! ts/mr/system/SView */ \"./ts/mr/system/SView.ts\");\r\nclass UName {\r\n /**\r\n * [focus] から見た [entity] のユニット名。アイコンを伴わない。\r\n */\r\n static makeUnitName(entity, viewSubject) {\r\n if (!viewSubject)\r\n viewSubject = MRLively_1.MRLively.mapView.focusedEntity();\r\n (0, Common_1.assert)(viewSubject);\r\n const nameView = SView_1.SView.getLookNames(viewSubject, entity);\r\n const targetName = LIdentifyer_1.LEntityDescription.makeDisplayText(nameView.name, LIdentifyer_1.DescriptionHighlightColor.UnitName);\r\n return targetName;\r\n }\r\n /**\r\n * アイコンを伴う。識別状態によってテキストの色が変わる。\r\n */\r\n static makeNameAsItem(entity, viewSubject) {\r\n if (!viewSubject)\r\n viewSubject = MRLively_1.MRLively.mapView.focusedEntity();\r\n (0, Common_1.assert)(viewSubject);\r\n return MRLively_1.MRLively.getCurrentIdentifyer().makeDisplayText(viewSubject, entity);\r\n }\r\n}\r\nexports.UName = UName;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/utility/UName.ts?"); /***/ }), /***/ "./ts/mr/utility/UProperty.ts": /*!************************************!*\ !*** ./ts/mr/utility/UProperty.ts ***! \************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.UPropertyPath = exports.UComponentType = exports.UProperty = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst SFormulaOperand_1 = __webpack_require__(/*! ../system/SFormulaOperand */ \"./ts/mr/system/SFormulaOperand.ts\");\r\nconst USearch_1 = __webpack_require__(/*! ./USearch */ \"./ts/mr/utility/USearch.ts\");\r\nclass UProperty {\r\n static setValue(key, path, value) {\r\n const entity = USearch_1.USearch.getEntityByKeyPattern(key);\r\n //const entity = REGame.world.getFirstEntityByKey(key);\r\n const propPath = new UPropertyPath(path);\r\n const obj = this.getObject(entity, propPath);\r\n if (!propPath.propertyName) {\r\n throw new Error(\"Invalid property name.\");\r\n }\r\n if (obj) {\r\n if (propPath.behaviorName) {\r\n const behavior = entity.findEntityBehaviorByName(propPath.behaviorName);\r\n if (!behavior)\r\n new Error(`Behavior not found. ${path}`);\r\n behavior[propPath.propertyName] = value;\r\n }\r\n // else if (propPath.propertyName) {\r\n // let value: any = undefined;\r\n // eval(`value = obj.${propPath.propertyName}`);\r\n // return value;\r\n // }\r\n }\r\n else {\r\n throw new Error(`Invalid property path. ${path}`);\r\n }\r\n // if (propPath.componentType == UComponentType.Behavior) {\r\n // assert(propPath.behaviorName);\r\n // assert(propPath.propertyName);\r\n // let behavior;\r\n // for (const b of entity.basicBehaviors()) {\r\n // if (b.constructor.name.toLowerCase().includes(propPath.behaviorName)) {\r\n // behavior = b;\r\n // }\r\n // }\r\n // if (behavior) {\r\n // (behavior as any)[propPath.propertyName] = value;\r\n // }\r\n // }\r\n // else {\r\n // throw new Error(\"Not implemented.\");\r\n // }\r\n }\r\n static getValue(key, path) {\r\n const entity = MRLively_1.MRLively.world.getFirstEntityByKey(key);\r\n throw this.getValueFromEntity(entity, path);\r\n }\r\n static getValueFromEntity(entity, path) {\r\n const propPath = new UPropertyPath(path);\r\n const obj = this.getObject(entity, propPath);\r\n // プロパティ名が指定されていない場合、 Object の存在自体を 1 or 0 で返す\r\n if (!propPath.propertyName) {\r\n return (obj !== undefined) ? 1 : 0;\r\n }\r\n if (obj) {\r\n if (propPath.behaviorName) {\r\n const behavior = entity.findEntityBehaviorByName(propPath.behaviorName);\r\n if (!behavior)\r\n new Error(`Behavior not found. ${path}`);\r\n let value = undefined;\r\n eval(`value = behavior.${propPath.propertyName}`);\r\n return value;\r\n }\r\n else if (propPath.propertyName) {\r\n let value = undefined;\r\n eval(`value = obj.${propPath.propertyName}`);\r\n return value;\r\n }\r\n }\r\n else {\r\n throw new Error(`Invalid property path. ${path}`);\r\n }\r\n }\r\n static getObject(entity, path) {\r\n if (path.componentType == UComponentType.Entity) {\r\n return entity;\r\n }\r\n else if (path.componentType == UComponentType.Param) {\r\n const op = new SFormulaOperand_1.SFormulaOperand();\r\n op.wrap(entity);\r\n return op;\r\n }\r\n else if (path.componentType == UComponentType.State) {\r\n return entity.states.find(x => x.stateData().key == path.element);\r\n }\r\n // else if (path.componentType == UComponentType.Behavior) {\r\n // let behavior;\r\n // for (const b of entity.basicBehaviors()) {\r\n // if (b.constructor.name.toLowerCase().includes(path.behaviorName)) {\r\n // behavior = b;\r\n // }\r\n // }\r\n // return behavior;\r\n // }\r\n else {\r\n throw new Error(\"Not implemented.\");\r\n }\r\n }\r\n static getValueByVariablePattern(pattern) {\r\n if (pattern.startsWith(\"${\")) {\r\n const i = pattern.indexOf(\"}\");\r\n if (i >= 0) {\r\n const name = pattern.substring(2, i);\r\n const id = parseInt(pattern);\r\n if (!isNaN(id)) {\r\n return $gameVariables.value(id);\r\n }\r\n else {\r\n const id = $dataSystem.variables.findIndex(x => x && x == name);\r\n if (id >= 0) {\r\n return $gameVariables.value(id);\r\n }\r\n else {\r\n throw new Error(`${pattern} not found.`);\r\n }\r\n }\r\n }\r\n }\r\n const numberValue = parseInt(pattern);\r\n if (!isNaN(numberValue)) {\r\n return numberValue;\r\n }\r\n else {\r\n return eval(pattern);\r\n }\r\n }\r\n}\r\nexports.UProperty = UProperty;\r\nvar UComponentType;\r\n(function (UComponentType) {\r\n UComponentType[UComponentType[\"Entity\"] = 0] = \"Entity\";\r\n UComponentType[UComponentType[\"Param\"] = 1] = \"Param\";\r\n //Behavior,\r\n UComponentType[UComponentType[\"State\"] = 2] = \"State\";\r\n UComponentType[UComponentType[\"Ability\"] = 3] = \"Ability\";\r\n})(UComponentType = exports.UComponentType || (exports.UComponentType = {}));\r\n/**\r\n *\r\n * 書式:\r\n * ```\r\n * [componentType:][componentName.]propertyName\r\n * ```\r\n *\r\n * 将来的に、だが、例えば State の持続時間を指定したいときは、\r\n * - \"State[睡眠]:turns\", 20\r\n * State の持っている behabior のプロパティを指定したいときは、\r\n * - \"State(睡眠):generic.xxxx\", 20\r\n */\r\nclass UPropertyPath {\r\n constructor(path) {\r\n const tokens1 = path.split(\":\");\r\n let after;\r\n let componentType = undefined;\r\n if (tokens1.length == 1) {\r\n after = tokens1[0];\r\n }\r\n else {\r\n after = tokens1[1];\r\n }\r\n if (tokens1.length >= 2 || tokens1[0].includes(\"[\")) {\r\n // Parse type and element\r\n const regex = /([a-z]+)(\\[.+\\])*/gi;\r\n const result = regex.exec(tokens1[0]);\r\n (0, Common_1.assert)(result);\r\n const type = result[1];\r\n componentType = this.parseComponentType(type);\r\n const element = result[2];\r\n if (element) {\r\n this.element = element.substring(1, element.length - 1);\r\n }\r\n if (tokens1.length == 1) {\r\n after = \"\";\r\n }\r\n }\r\n if (after.length == 0) {\r\n if (componentType === undefined) {\r\n componentType = UComponentType.Param; // デフォルトは Param とする。これがもっともよく使う\r\n }\r\n }\r\n else {\r\n // [componentType:] の後ろの部分を . で split\r\n const tokens2 = after.split(\".\");\r\n if (tokens2.length >= 2) {\r\n this.behaviorName = tokens2[0];\r\n this.propertyName = tokens2.slice(1).join(\".\");\r\n if (componentType === undefined) {\r\n componentType = UComponentType.Entity;\r\n }\r\n }\r\n else {\r\n this.propertyName = tokens2.join(\".\");\r\n if (componentType === undefined) {\r\n componentType = UComponentType.Param; // デフォルトは Param とする。これがもっともよく使う\r\n }\r\n }\r\n }\r\n this.componentType = componentType;\r\n }\r\n parseComponentType(type) {\r\n switch (type.toLocaleLowerCase()) {\r\n case \"entity\":\r\n return UComponentType.Entity;\r\n case \"param\":\r\n return UComponentType.Param;\r\n // case \"behavior\":\r\n // return UComponentType.Behavior;\r\n case \"state\":\r\n return UComponentType.State;\r\n case \"ability\":\r\n return UComponentType.Ability;\r\n default:\r\n throw new Error((0, Common_1.tr2)(\"プロパティパスのコンポーネント種類が不正です。(%1)\").format(type));\r\n }\r\n }\r\n}\r\nexports.UPropertyPath = UPropertyPath;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/utility/UProperty.ts?"); /***/ }), /***/ "./ts/mr/utility/USearch.ts": /*!**********************************!*\ !*** ./ts/mr/utility/USearch.ts ***! \**********************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.USearch = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst DCommon_1 = __webpack_require__(/*! ../data/DCommon */ \"./ts/mr/data/DCommon.ts\");\r\nconst DState_1 = __webpack_require__(/*! ../data/DState */ \"./ts/mr/data/DState.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ../data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst LEntryPointBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LEntryPointBehavior */ \"./ts/mr/lively/behaviors/LEntryPointBehavior.ts\");\r\nconst LExitPointBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LExitPointBehavior */ \"./ts/mr/lively/behaviors/LExitPointBehavior.ts\");\r\nconst LItemBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LItemBehavior */ \"./ts/mr/lively/behaviors/LItemBehavior.ts\");\r\nconst LTrapBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LTrapBehavior */ \"./ts/mr/lively/behaviors/LTrapBehavior.ts\");\r\nconst LUnitBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LUnitBehavior */ \"./ts/mr/lively/behaviors/LUnitBehavior.ts\");\r\nconst HMovement_1 = __webpack_require__(/*! ../lively/helpers/HMovement */ \"./ts/mr/lively/helpers/HMovement.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst PluginParameters_1 = __webpack_require__(/*! ../PluginParameters */ \"./ts/mr/PluginParameters.ts\");\r\nconst Helpers_1 = __webpack_require__(/*! ../system/Helpers */ \"./ts/mr/system/Helpers.ts\");\r\nconst UMovement_1 = __webpack_require__(/*! ./UMovement */ \"./ts/mr/utility/UMovement.ts\");\r\n/**\r\n * 攻撃対象範囲などの検索ヘルパー\r\n */\r\nclass USearch {\r\n /**\r\n * 失明状態であるか (self は他を視認できないか)\r\n */\r\n static hasBlindness(self) {\r\n return self.states.find(s => s.stateEffect().restriction == DState_1.DStateRestriction.Blind) !== undefined;\r\n }\r\n /**\r\n * 可視であるか\r\n */\r\n static isVisible(target) {\r\n return !target.hasTrait(MRBasics_1.MRBasics.traits.Invisible);\r\n }\r\n /**\r\n * subject から見て target は可視であるか\r\n * ※視界内か、ではない点に注意\r\n */\r\n static isVisibleFromSubject(subject, target) {\r\n // あかりの巻物など、フロア自体に可視効果がある\r\n if (MRLively_1.MRLively.mapView.currentMap.unitClarity)\r\n return true;\r\n // よく見え状態なら、相手が透明状態でも見える\r\n if (subject.hasTrait(MRBasics_1.MRBasics.traits.ForceVisible))\r\n return true;\r\n // 相手が透明状態なので、見えない\r\n if (target.hasTrait(MRBasics_1.MRBasics.traits.Invisible))\r\n return false;\r\n return true;\r\n }\r\n /**\r\n * subject から見て、 target は視界内であるか。\r\n * ※可視であるか、ではない点に注意。この関数は地形や位置関係による視界チェックとなる。\r\n */\r\n static checkInSightEntity(subject, target) {\r\n if (subject.isOnRoom()) {\r\n const map = MRLively_1.MRLively.mapView.currentMap;\r\n const subjectRoom = map.room(subject.roomId());\r\n // 部屋の外周にも含まれず、部屋の外にいる target を見ることはできない。\r\n if (!subjectRoom.containsWithEdge(target.mx, target.my))\r\n return false;\r\n // 視界不明瞭部屋の場合、遠いところにいる target は見えない。\r\n if (subjectRoom.poorVisibility) {\r\n if (HMovement_1.HMovement.blockDistance(subject.mx, subject.my, target.mx, target.my) > PluginParameters_1.paramDefaultVisibiltyLength) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n else {\r\n // 通路内では隣接している場合のみ見える。\r\n return UMovement_1.UMovement.checkAdjacentEntities(subject, target);\r\n }\r\n }\r\n /**\r\n * subject から見て、 block は可視であるか\r\n * @param subject\r\n * @param block\r\n */\r\n static checkInSightBlockFromSubject(subject, block) {\r\n // 失明状態?\r\n if (this.hasBlindness(subject))\r\n return false;\r\n if (subject.isOnRoom()) {\r\n // 部屋の中からは、部屋の外周上の Block も可視となる\r\n const room = MRLively_1.MRLively.mapView.currentMap.room(subject.roomId());\r\n return room.checkVisibilityBlock(block);\r\n }\r\n else {\r\n // 部屋の外にいる場合、たとえ部屋の外周 Block 上にいても、部屋内は見えない。\r\n // 隣接のみ見える。\r\n return UMovement_1.UMovement.checkAdjacentPositions(subject.mx, subject.my, block.mx, block.my);\r\n }\r\n }\r\n /**\r\n * 指定された entity が中立的なアイテムか(=普通に誰でも拾うことができるか)\r\n */\r\n static isNeutralItem(entity) {\r\n // Unit は何らかの勢力に属し、Unitレイヤー上で活動するもの。一般的にはアイテムとして拾うことはできない。\r\n if (entity.findEntityBehavior(LUnitBehavior_1.LUnitBehavior))\r\n return false;\r\n // Trap は対象勢力を持ち、その勢力は拾うことはできない。\r\n if (entity.findEntityBehavior(LTrapBehavior_1.LTrapBehavior))\r\n return false;\r\n // 階段\r\n if (entity.findEntityBehavior(LExitPointBehavior_1.LExitPointBehavior))\r\n return false;\r\n if (entity.findEntityBehavior(LEntryPointBehavior_1.LEntryPointBehavior))\r\n return false;\r\n return !!entity.findEntityBehavior(LItemBehavior_1.LItemBehavior);\r\n }\r\n /**\r\n * mx, my を中心として、length タイル分離れた位置を列挙する。\r\n * length=1 の場合は周囲 8 マス。\r\n * 外周のみ列挙するため、2マス範囲内を全て列挙したい場合は lengthに 1,2を与えて複数回この関数を呼び出すこと。\r\n * 列挙順は左上から時計回り。\r\n */\r\n static iterateAroundPositions(mx, my, length, func) {\r\n if (length == 0)\r\n return;\r\n const x1 = mx - length;\r\n const y1 = my - length;\r\n const x2 = mx + length;\r\n const y2 = my + length;\r\n /*\r\n 以下4つの for では次のように列挙を担当する。\r\n 112\r\n 4 2\r\n 433\r\n */\r\n for (let x = x1; x < x2; x++) {\r\n func(x, y1);\r\n }\r\n for (let y = y1; y < y2; y++) {\r\n func(x2, y);\r\n }\r\n for (let x = x2; x > x1; x--) {\r\n func(x, y2);\r\n }\r\n for (let y = y2; y > y1; y--) {\r\n func(x1, y);\r\n }\r\n }\r\n /**\r\n * iterateAroundPositions() を使用して、有効 Block を列挙する。\r\n */\r\n static iterateAroundBlocks(mx, my, length, withCenter, func) {\r\n (0, Common_1.assert)(length >= 1);\r\n if (withCenter) {\r\n const block = MRLively_1.MRLively.mapView.currentMap.tryGetBlock(mx, my);\r\n if (block)\r\n func(block);\r\n }\r\n this.iterateAroundPositions(mx, my, length, (mx, my) => {\r\n const block = MRLively_1.MRLively.mapView.currentMap.tryGetBlock(mx, my);\r\n if (block)\r\n func(block);\r\n });\r\n }\r\n /**\r\n * iterateAroundPositions() を使用して、範囲に含まれている全ての Entity を列挙する。\r\n */\r\n static iterateAroundEntities(mx, my, length, withCenter, func) {\r\n this.iterateAroundBlocks(mx, my, length, withCenter, (block) => {\r\n for (const entity of block.getEntities()) {\r\n func(entity);\r\n }\r\n });\r\n }\r\n static getFirstUnderFootEntity(entity) {\r\n const block = MRLively_1.MRLively.mapView.currentMap.tryGetBlock(entity.mx, entity.my);\r\n if (block) {\r\n const target = block.getFirstEntity(DCommon_1.DBlockLayerKind.Ground);\r\n return target;\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Unit が出現可能な Block を選択する。\r\n */\r\n static selectUnitSpawnableBlock(rand) {\r\n // 空いている Block をランダムに選択して配置する\r\n const spawnableBlocks = MRLively_1.MRLively.mapView.currentMap.getSpawnableBlocks(DCommon_1.DBlockLayerKind.Unit);\r\n if (spawnableBlocks.length == 0)\r\n return null;\r\n const player = MRLively_1.MRLively.mapView.focusedEntity();\r\n (0, Common_1.assert)(player);\r\n const px = player.mx;\r\n const py = player.my;\r\n // まず操作キャラのすぐ近くは避けて検索してみる\r\n let candidateBlocks = spawnableBlocks.filter(b => {\r\n const dx = Math.abs(b.mx - px);\r\n const dy = Math.abs(b.my - py);\r\n return dx > PluginParameters_1.paramEnemySpawnInvalidArea || dy > PluginParameters_1.paramEnemySpawnInvalidArea;\r\n });\r\n // 部屋が複数ある場合、Player 以外の部屋を選ぶ\r\n if (!MRLively_1.MRLively.mapView.currentMap.isSingleRoomMap) {\r\n candidateBlocks = candidateBlocks.filter(b => (b._roomId != player.roomId()));\r\n }\r\n if (candidateBlocks.length > 0) {\r\n return candidateBlocks[rand.nextIntWithMax(candidateBlocks.length)];\r\n }\r\n // 操作キャラの近くしかなかった場合はやむなし\r\n return rand.select(spawnableBlocks);\r\n }\r\n /*\r\n private static getRondomWarpRoom(rand: LRandom): LRoom {\r\n const rooms = REGame.map.rooms();\r\n assert(rooms.length > 0);\r\n if (rooms.length == 1) return rooms[0];\r\n\r\n const player = REGame.camera.focusedEntity();\r\n if (player) {\r\n return rand.select(rooms.filter(r => r.contains(player.x, player.y)));\r\n }\r\n else {\r\n return rand.select(rooms);\r\n }\r\n }\r\n */\r\n /**\r\n * 指定した Entity が、scope 範囲内に含まれているかを確認する\r\n */\r\n // public static checkEntityInEffectorScope(entity: LEntity, scope: DEffectFieldScope): boolean {\r\n // }\r\n /**\r\n * entity の視界内にある最も後に出現したアイテムを探す\r\n */\r\n static findLatestItemInVisibilityBlocks(entity) {\r\n const roomId = entity.roomId();\r\n const items = MRLively_1.MRLively.mapView.currentMap.entities().filter(e => {\r\n if (e.roomId() != roomId)\r\n return false;\r\n if (!this.isNeutralItem(e))\r\n return false;\r\n return true;\r\n });\r\n if (items.length > 0) {\r\n return items[items.length - 1];\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * 指定した向きへまっすぐ向かったとき、最初にぶつかる壁を取得する。\r\n * (mx,my) は含まない。\r\n */\r\n static findFirstWallInDirection(mx, my, dir) {\r\n const map = MRLively_1.MRLively.mapView.currentMap;\r\n let i = 1;\r\n while (true) {\r\n const offset = Helpers_1.Helpers._dirToTileOffsetTable[dir];\r\n const x = mx + offset.x * i;\r\n const y = my + offset.y * i;\r\n if (!map.isValidPosition(x, y))\r\n break;\r\n const block = map.tryGetBlock(x, y);\r\n if (block && block.isWallLikeShape()) {\r\n return block;\r\n }\r\n i++;\r\n }\r\n throw new Error(\"Unreachable.\");\r\n }\r\n static getUniqueActorByKey(key) {\r\n const entity = MRLively_1.MRLively.system.uniqueActorUnits\r\n .map(x => MRLively_1.MRLively.world.entity(x))\r\n .find(x => x.data.entity.key == key);\r\n if (!entity)\r\n throw new Error((0, Common_1.tr2)(\"%1はアクターの中から見つかりませんでした。\").format(key));\r\n return entity;\r\n }\r\n static getUniqueActorById(dataId) {\r\n const entity = MRLively_1.MRLively.system.uniqueActorUnits\r\n .map(x => MRLively_1.MRLively.world.entity(x))\r\n .find(x => x.data.id == dataId);\r\n if (!entity)\r\n throw new Error((0, Common_1.tr2)(\"%1はアクターの中から見つかりませんでした。\").format(dataId));\r\n return entity;\r\n }\r\n static getEntityByKeyPattern(keyPattern) {\r\n if (keyPattern == \"${Player}\") {\r\n return MRLively_1.MRLively.mapView.getFocusedEntity();\r\n }\r\n else {\r\n const entity = MRLively_1.MRLively.system.uniqueActorUnits\r\n .map(x => MRLively_1.MRLively.world.entity(x))\r\n .find(x => x.data.entity.key == keyPattern);\r\n if (!entity)\r\n throw new Error((0, Common_1.tr2)(\"%1は見つかりませんでした。\").format(keyPattern));\r\n return entity;\r\n }\r\n }\r\n}\r\nexports.USearch = USearch;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/utility/USearch.ts?"); /***/ }), /***/ "./ts/mr/utility/USpawner.ts": /*!***********************************!*\ !*** ./ts/mr/utility/USpawner.ts ***! \***********************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.USpawner = void 0;\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst SEntityFactory_1 = __webpack_require__(/*! ts/mr/system/SEntityFactory */ \"./ts/mr/system/SEntityFactory.ts\");\r\nconst DSpawner_1 = __webpack_require__(/*! ../data/DSpawner */ \"./ts/mr/data/DSpawner.ts\");\r\nconst UEffect_1 = __webpack_require__(/*! ./UEffect */ \"./ts/mr/utility/UEffect.ts\");\r\nclass USpawner {\r\n static spawnSingleEntity(entityKey, mx, my) {\r\n const floorId = MRLively_1.MRLively.mapView.currentMap.floorId();\r\n const entity = SEntityFactory_1.SEntityFactory.newEntity(DSpawner_1.DEntityCreateInfo.makeSingle(MRData_1.MRData.getEntity(entityKey).id), floorId);\r\n MRLively_1.MRLively.world.transferEntity(entity, floorId, mx, my);\r\n return entity;\r\n }\r\n static getEnemiesFromSpawnTable(floorId) {\r\n const result = new Set();\r\n const table = floorId.landData.appearanceTable;\r\n const enemyList = table.enemies[floorId.floorNumber];\r\n if (enemyList) {\r\n for (const enemy of enemyList) {\r\n if (enemy.spawiInfo.troopId > 0) {\r\n // グループ出現\r\n const troop = MRData_1.MRData.troops[enemy.spawiInfo.troopId];\r\n for (const m of troop.members) {\r\n result.add(m);\r\n }\r\n }\r\n else {\r\n // 単体出現\r\n result.add(enemy.spawiInfo.entityId);\r\n }\r\n }\r\n }\r\n if (result.size == 0) {\r\n result.add(MRData_1.MRData.system.fallbackEnemyEntityId);\r\n }\r\n return Array.from(result.values()).map(x => MRData_1.MRData.entities[x]);\r\n }\r\n /**\r\n * 指定したフロアの出現テーブルから、アイテムを作成する。\r\n * 作成したアイテムはマップ上に出現していない。\r\n */\r\n static createItemFromSpawnTable(floorId, rand) {\r\n const table = floorId.landData.appearanceTable;\r\n if (table.items.length == 0)\r\n return undefined; // 出現テーブルが空\r\n const list = table.items[floorId.floorNumber];\r\n if (list.length == 0)\r\n return undefined; // 出現テーブルが空\r\n const data = UEffect_1.UEffect.selectRatingForce(rand, list, 100, x => x.spawiInfo.rate);\r\n const entity = SEntityFactory_1.SEntityFactory.newEntity(data.spawiInfo, floorId);\r\n return entity;\r\n }\r\n /**\r\n * 指定したフロアの出現テーブルから、罠を作成する。\r\n * 作成したアイテムはマップ上に出現していない。\r\n */\r\n static createTrapFromSpawnTable(floorId, rand) {\r\n const table = floorId.landData.appearanceTable;\r\n if (table.traps.length == 0)\r\n return undefined; // 出現テーブルが空\r\n const list = table.traps[floorId.floorNumber];\r\n if (list.length == 0)\r\n return undefined; // 出現テーブルが空\r\n const data = UEffect_1.UEffect.selectRatingForce(rand, list, 100, x => x.spawiInfo.rate);\r\n const entity = SEntityFactory_1.SEntityFactory.newEntity(data.spawiInfo, floorId);\r\n return entity;\r\n }\r\n static createItemFromSpawnTableOrDefault(floorId, rand) {\r\n const entity = this.createItemFromSpawnTable(floorId, rand);\r\n if (entity)\r\n return entity;\r\n return SEntityFactory_1.SEntityFactory.newEntity(DSpawner_1.DEntityCreateInfo.makeSingle(MRData_1.MRData.system.fallbackItemEntityId), floorId);\r\n }\r\n}\r\nexports.USpawner = USpawner;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/utility/USpawner.ts?"); /***/ }), /***/ "./ts/mr/utility/UState.ts": /*!*********************************!*\ !*** ./ts/mr/utility/UState.ts ***! \*********************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.UState = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst DEffect_1 = __webpack_require__(/*! ts/mr/data/DEffect */ \"./ts/mr/data/DEffect.ts\");\r\nconst DState_1 = __webpack_require__(/*! ts/mr/data/DState */ \"./ts/mr/data/DState.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst SStateFactory_1 = __webpack_require__(/*! ts/mr/system/SStateFactory */ \"./ts/mr/system/SStateFactory.ts\");\r\nconst Diag_1 = __webpack_require__(/*! ../Diag */ \"./ts/mr/Diag.ts\");\r\nclass UState {\r\n static effect(state) {\r\n if (state.submatchEffectIndex >= 0)\r\n return MRData_1.MRData.states[state.submatchEffectIndex].effect;\r\n else\r\n return state.data.effect;\r\n }\r\n /**\r\n * ステート追加・削除のメイン処理\r\n *\r\n * ステートには能力値の変化を与えるものや、現在の能力値によって自動付加されるものがある。\r\n * 例えばステートをまとめて追加する場合、ひとつ追加するたびに自動付加の判定を行うと、\r\n * 想定外のステート追加が一瞬発生してすぐ削除されるなど予測しづらい副作用を伴うことがある。\r\n *\r\n * そのため一度にまとめて追加する場合はまず先にすべてのステートを評価し、\r\n * 本当に消すべきもの・残すべきもの・追加するべきものを判断して必要な操作だけを行えるようにする。\r\n */\r\n static resolveStates(entity, newStates, removeStateIds) {\r\n const entityData = entity.data;\r\n const currentStates = entity.states.map(s => { return { data: s.stateData(), submatchEffectIndex: s.submatchEffectIndex(), removing: false, new: false, level: s.level() }; });\r\n const stateGroups = MRData_1.MRData.stateGroups.map(sg => { return { data: sg, states: [] }; });\r\n // 新規ステート\r\n for (const newState of newStates) {\r\n let state = currentStates.find(s => s.data.id == newState.stateId);\r\n if (state) {\r\n // 既に追加済み\r\n }\r\n else if (!entity.isStateAddable(newState.stateId)) {\r\n // 耐性がある等、追加できない\r\n continue;\r\n }\r\n else {\r\n state = {\r\n data: MRData_1.MRData.states[newState.stateId],\r\n submatchEffectIndex: this.selectEffectIndex(entity, MRData_1.MRData.states[newState.stateId]),\r\n removing: false,\r\n new: true,\r\n level: 0\r\n };\r\n currentStates.push(state);\r\n }\r\n // Level 設定\r\n switch (newState.levelType) {\r\n case DEffect_1.LStateLevelType.AbsoluteValue:\r\n state.level = newState.level;\r\n break;\r\n case DEffect_1.LStateLevelType.RelativeValue:\r\n state.level += newState.level;\r\n break;\r\n default:\r\n throw new Error(\"Unreachable.\");\r\n }\r\n // level 0 は削除\r\n if (state.level == 0) {\r\n state.removing = true;\r\n }\r\n }\r\n // 明示的に削除するべきものに削除マークを付ける\r\n for (const stateId of removeStateIds) {\r\n const state = currentStates.find(s => s.data.id == stateId);\r\n if (state) {\r\n state.removing = true;\r\n }\r\n }\r\n // 既存ステートのうち自動付加・自動削除条件を持つものは、満たされてないものに削除マークをつける\r\n for (const state of currentStates) {\r\n if (state.data.autoAdditionCondition) {\r\n let cond = false;\r\n try {\r\n const a = entity;\r\n cond = eval(state.data.autoAdditionCondition);\r\n }\r\n catch (e) {\r\n Diag_1.Diag.error((0, Common_1.tr2)(\"ステートの自動付加条件の評価に失敗しました。ステートID: %1 条件: %2\").format(state.data.id, state.data.autoAdditionCondition));\r\n }\r\n if (!cond) {\r\n state.removing = true;\r\n }\r\n }\r\n // 削除のチェック\r\n if (this.checkRemoveAtActualParam(this.effect(state), entity)) {\r\n state.removing = true;\r\n }\r\n }\r\n // 自動付加条件を満たすステートを、いったんすべて追加する\r\n for (const data of MRData_1.MRData.states) {\r\n if (data.autoAdditionCondition && !currentStates.find(s => s.data.id == data.id)) {\r\n let cond = false;\r\n try {\r\n const a = entity;\r\n cond = eval(data.autoAdditionCondition);\r\n }\r\n catch (e) {\r\n Diag_1.Diag.error((0, Common_1.tr2)(\"ステートの自動付加条件の評価に失敗しました。ステートID: %1 条件: %2\").format(data.id, data.autoAdditionCondition));\r\n }\r\n if (cond === true) {\r\n currentStates.push({\r\n data: data,\r\n submatchEffectIndex: this.selectEffectIndex(entity, data),\r\n removing: false,\r\n new: true, level: 1\r\n });\r\n }\r\n }\r\n }\r\n for (const data of entityData.autoAdditionStates) {\r\n if (!currentStates.find(s => s.data.id == data.stateId)) {\r\n const a = entity;\r\n const cond = eval(data.condition);\r\n if (cond === true) {\r\n currentStates.push({\r\n data: MRData_1.MRData.states[data.stateId],\r\n submatchEffectIndex: this.selectEffectIndex(entity, MRData_1.MRData.states[data.stateId]),\r\n removing: false, new: true, level: 1\r\n });\r\n }\r\n }\r\n }\r\n // StateGroup に State を集める\r\n for (const state of currentStates) {\r\n for (const stateGroupId of state.data.stateGroupIds) {\r\n stateGroups[stateGroupId].states.push(state);\r\n }\r\n }\r\n // 後の処理をしやすくするため、グループごとに優先度でソートしておく (昇順)\r\n for (const stateGroup of stateGroups) {\r\n if (stateGroup.states.length > 0) {\r\n stateGroup.states.sort((a, b) => {\r\n if (a.data.priority == b.data.priority)\r\n return a.data.id - b.data.id;\r\n else\r\n return a.data.priority - b.data.priority;\r\n });\r\n }\r\n }\r\n // 排他ステートの処理。\r\n // グループごとの一番後ろの state (優先度が一番大きい) だけ残して、削除マークを付ける。\r\n for (const stateGroup of stateGroups) {\r\n if (stateGroup.data.exclusive) {\r\n // 削除マークのついていない一番後ろの state を探す\r\n let thr = -1;\r\n for (let i = stateGroup.states.length - 1; i >= 0; i--) {\r\n if (!stateGroup.states[i].removing) {\r\n thr = i;\r\n break;\r\n }\r\n }\r\n // そこまで消す\r\n for (let i = 0; i < thr; i++) {\r\n stateGroup.states[i].removing = true;\r\n }\r\n }\r\n }\r\n // 削除マーク付きで、実際に存在している LState を削除する\r\n const oldStates = entity.states;\r\n for (const workState of currentStates) {\r\n if (workState.removing) {\r\n const state = oldStates.find(s => s.stateDataId() == workState.data.id);\r\n if (state) {\r\n state.clearParent();\r\n state.onDetached(entity);\r\n entity._effectResult.pushRemovedState(workState.data.id);\r\n }\r\n }\r\n }\r\n // 新たなリストを作る\r\n const result = [];\r\n for (const workState of currentStates) {\r\n if (!workState.removing) {\r\n let state = oldStates.find(s => s.stateDataId() == workState.data.id);\r\n if (state) {\r\n if (workState.new) {\r\n (0, Common_1.assert)(!workState.new);\r\n }\r\n state.recast();\r\n }\r\n else {\r\n (0, Common_1.assert)(workState.new);\r\n state = SStateFactory_1.SStateFactory.newState(workState.data.id);\r\n state._submatchEffectIndex = workState.submatchEffectIndex;\r\n state.setParent(entity);\r\n (0, Common_1.assert)(state.hasId());\r\n state.onAttached(entity);\r\n entity._effectResult.pushAddedState(workState.data.id);\r\n }\r\n state.setLevel(workState.level);\r\n result.push(state);\r\n }\r\n }\r\n return result;\r\n }\r\n static selectEffectIndex(entity, state) {\r\n for (let i = state.submatchStates.length - 1; i >= 0; i--) {\r\n const stateId = state.submatchStates[i];\r\n const effect = MRData_1.MRData.states[stateId].effect;\r\n if (this.meetsConditions(entity, effect)) {\r\n return i;\r\n }\r\n }\r\n return -1;\r\n }\r\n static meetsConditions(entity, effect) {\r\n //const entityData = entity.data();\r\n if (effect.matchConditions.kindId != 0) {\r\n const kindId = entity.kindDataId();\r\n if (effect.matchConditions.kindId != kindId) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n static checkRemoveAtActualParam(effect, entity) {\r\n const a = entity;\r\n for (const r of effect.autoRemovals) {\r\n if (r.kind == DState_1.DAutoRemovalTiming.ActualParam) {\r\n const v = eval(r.formula);\r\n if (v === true) {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n }\r\n static attemptRemoveStateAtFloorTransfer(entity) {\r\n const removes = [];\r\n entity.iterateStates(s => {\r\n if (s.stateEffect().autoRemovals.find(x => x.kind == DState_1.DAutoRemovalTiming.FloorTransfer)) {\r\n removes.push(s.stateDataId());\r\n }\r\n return true;\r\n });\r\n entity.removeStates(removes);\r\n }\r\n static meetsApplyConditions(state, target) {\r\n if (state.applyConditions.kindIds.length > 0) {\r\n if (!state.applyConditions.kindIds.find(x => x === target.kindDataId())) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n}\r\nexports.UState = UState;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/utility/UState.ts?"); /***/ }), /***/ "./ts/mr/utility/UTransfer.ts": /*!************************************!*\ !*** ./ts/mr/utility/UTransfer.ts ***! \************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.UTransfer = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst DHelper_1 = __webpack_require__(/*! ts/mr/data/DHelper */ \"./ts/mr/data/DHelper.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst MRDataManager_1 = __webpack_require__(/*! ts/mr/data/MRDataManager */ \"./ts/mr/data/MRDataManager.ts\");\r\nconst LFloorId_1 = __webpack_require__(/*! ts/mr/lively/LFloorId */ \"./ts/mr/lively/LFloorId.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nclass UTransfer {\r\n /**\r\n * RMMZ コアスクリプト側からの マップ(と Player Entity) 遷移。\r\n * ニューゲーム時や [場所移動] イベントなどで使用する。\r\n *\r\n * @param cctx マップ遷移が発生する場合、STransferMapDialog を post する。\r\n */\r\n static transterRmmzDirectly(newMapId, newX, newY, newDir) {\r\n const landId = MRData_1.MRData.maps[newMapId].landId;\r\n const mapData = MRData_1.MRData.maps[newMapId];\r\n //let actualMapId = 0;\r\n let actualFloorNumber = 0;\r\n let actualX = -1;\r\n let actualY = -1;\r\n if (landId == DHelper_1.DHelpers.VanillaLandId || mapData.eventMap) {\r\n // REシステム管理外\r\n //actualMapId = newMapId;\r\n actualFloorNumber = newMapId;\r\n actualX = newX;\r\n actualY = newY;\r\n }\r\n else if (MRDataManager_1.MRDataManager.isLandMap(newMapId)) {\r\n (0, Common_1.assert)(newY === 0);\r\n const floorNumber = newX;\r\n const land = MRData_1.MRData.lands[landId];\r\n const fixedMap = land.getFixedMap(floorNumber);\r\n if (fixedMap) {\r\n // Land 定義マップ経由の、固定マップへの移動\r\n //actualMapId = rmmzFixedMapId;\r\n actualFloorNumber = floorNumber;\r\n actualX = -1;\r\n actualY = -1;\r\n }\r\n else {\r\n // Land 定義マップ経由の、ランダムマップへの移動\r\n //actualMapId = newMapId;\r\n actualFloorNumber = floorNumber;\r\n actualX = -1;\r\n actualY = -1;\r\n }\r\n }\r\n else if (MRDataManager_1.MRDataManager.isRESystemMap(newMapId)) {\r\n // 固定マップへの直接遷移\r\n const mapInfo = $dataMapInfos[newMapId];\r\n (0, Common_1.assert)(mapInfo);\r\n //const fixedMapName = mapInfo.name;\r\n const land = MRData_1.MRData.lands[landId];\r\n //actualMapId = newMapId;\r\n actualFloorNumber = land.findFloorNumberByMapId(newMapId);\r\n actualX = newX;\r\n actualY = newY;\r\n if (actualFloorNumber < 0) {\r\n throw new Error((0, Common_1.tr2)(\"Landフロアテーブルに設定が無い固定マップへ移動しようとしました。\\nland:%1, map:%2\").format(land.name, mapInfo.name));\r\n }\r\n }\r\n else {\r\n throw new Error(\"Unreachable.\");\r\n }\r\n const floorId = new LFloorId_1.LFloorId(landId, actualFloorNumber);\r\n const playerEntity = MRLively_1.MRLively.mapView.focusedEntity();\r\n if (playerEntity) {\r\n MRLively_1.MRLively.world.transferEntity(playerEntity, floorId, actualX, actualY);\r\n if (newDir !== 0) {\r\n playerEntity.dir = newDir;\r\n }\r\n }\r\n }\r\n /**\r\n * entity を今いる Land から抜けさせ、ExitMap へ移動させる。\r\n */\r\n static exitLand(cctx, entity, result) {\r\n var _a;\r\n (0, Common_1.assert)(entity == MRLively_1.MRLively.mapView.focusedEntity()); // Player であるはず\r\n (_a = entity.party()) === null || _a === void 0 ? void 0 : _a.journal.commitLandResult(result);\r\n const map = MRLively_1.MRLively.mapView.currentMap;\r\n const landData = map.land2().landData();\r\n const exitMapFloorId = LFloorId_1.LFloorId.make(landData.id, landData.exitMapFloorNumber);\r\n cctx.postTransferFloor(entity, exitMapFloorId);\r\n }\r\n static proceedFloorForwardForPlayer(cctx, interpreter) {\r\n var _a;\r\n const entity = MRLively_1.MRLively.mapView.focusedEntity();\r\n if (entity) {\r\n const floorId = entity.floorId;\r\n const newFloorNumber = floorId.floorNumber + 1;\r\n // 最後のフロアを踏破した?\r\n if (newFloorNumber > MRLively_1.MRLively.mapView.currentMap.land2().maxFloorNumber()) {\r\n // ExitMap 取得\r\n const newFloorId = LFloorId_1.LFloorId.make(floorId.landId, floorId.landData.exitMapFloorNumber);\r\n (_a = entity.party()) === null || _a === void 0 ? void 0 : _a.journal.commitLandResult(MRData_1.LandExitResult.Goal);\r\n MRLively_1.MRLively.world.transferEntity(entity, newFloorId);\r\n //$gamePlayer.reserveTransfer(exitRMMZMapId, 0, 0, 2, 0);\r\n //const result = this.command201([0, exitRMMZMapId, 0, 0, 2, 0]);\r\n //assert(result);\r\n }\r\n else {\r\n const newFloorId = LFloorId_1.LFloorId.make(floorId.landId, newFloorNumber);\r\n MRLively_1.MRLively.world.transferEntity(entity, newFloorId);\r\n }\r\n if (interpreter) {\r\n // イベントからの遷移は普通の [場所移動] コマンドと同じように WaitMode を設定する必要がある。\r\n // しないと、例えば直前に表示していたメッセージウィンドウのクローズなどを待たずに遷移が発生し、isBusy() でハングする。\r\n interpreter.setWaitMode(\"transfer\");\r\n }\r\n }\r\n }\r\n}\r\nexports.UTransfer = UTransfer;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/utility/UTransfer.ts?"); /***/ }), /***/ "./ts/mr/view/MRView.ts": /*!******************************!*\ !*** ./ts/mr/view/MRView.ts ***! \******************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.MRView = void 0;\r\nconst VAnimation_1 = __webpack_require__(/*! ./animation/VAnimation */ \"./ts/mr/view/animation/VAnimation.ts\");\r\nconst MRVisualExtension_1 = __webpack_require__(/*! ./MRVisualExtension */ \"./ts/mr/view/MRVisualExtension.ts\");\r\nconst VSequelFactory_1 = __webpack_require__(/*! ./VSequelFactory */ \"./ts/mr/view/VSequelFactory.ts\");\r\nconst VMapGuideGrid_1 = __webpack_require__(/*! ./VMapGuideGrid */ \"./ts/mr/view/VMapGuideGrid.ts\");\r\nconst VMessageWindowSet_1 = __webpack_require__(/*! ./VMessageWindowSet */ \"./ts/mr/view/VMessageWindowSet.ts\");\r\nconst VChallengeResultWindow_1 = __webpack_require__(/*! ./window/windows/VChallengeResultWindow */ \"./ts/mr/view/window/windows/VChallengeResultWindow.ts\");\r\nconst VChronus_1 = __webpack_require__(/*! ./VChronus */ \"./ts/mr/view/VChronus.ts\");\r\nconst VDialogManager_1 = __webpack_require__(/*! ./VDialogManager */ \"./ts/mr/view/VDialogManager.ts\");\r\nconst PluginParameters_1 = __webpack_require__(/*! ../PluginParameters */ \"./ts/mr/PluginParameters.ts\");\r\nconst VWindowFactory_1 = __webpack_require__(/*! ./window/VWindowFactory */ \"./ts/mr/view/window/VWindowFactory.ts\");\r\n/**\r\n * REシステムと RMMZ の橋渡しを行うモジュールのルートクラス。\r\n *\r\n * Game_XXXX モジュールと連携する必要があるため、インスタンスの寿命はグローバル (NewGame のたびに生成)\r\n *\r\n * 普通のプラグインであれば Scene_Map を拡張してそこに持たせるべきな情報もこちらに持たせているが、\r\n * これは他プラグインとの競合対策や Scene_Map の拡張による複雑化防止のため。\r\n */\r\nclass MRView {\r\n static initialize() {\r\n this.finalize();\r\n this.sequelFactory = new VSequelFactory_1.VSequelFactory();\r\n this.dialogManager = new VDialogManager_1.VDialogManager();\r\n this.windowFactory = new VWindowFactory_1.VWindowFactory();\r\n }\r\n static onSceneChanged(scene) {\r\n this.scene = scene;\r\n // createWindows\r\n this._challengeResultWindow = new VChallengeResultWindow_1.VChallengeResultWindow();\r\n this.scene.addWindow(this._challengeResultWindow);\r\n this._messageWindowSet = new VMessageWindowSet_1.VMessageWindowSet(scene);\r\n this.guideGrid = new VMapGuideGrid_1.VMapGuideGrid();\r\n if (PluginParameters_1.paramSandboxWorldSystem) {\r\n this.chronus = new VChronus_1.VChronus(scene);\r\n }\r\n this.ext.onMapVisualSetup();\r\n }\r\n static finalize() {\r\n this.sequelFactory = undefined;\r\n this.dialogManager = undefined;\r\n }\r\n static update() {\r\n var _a, _b, _c, _d, _e;\r\n (_a = this.entityVisualSet) === null || _a === void 0 ? void 0 : _a.update();\r\n (_b = this.guideGrid) === null || _b === void 0 ? void 0 : _b.update();\r\n (_c = this._messageWindowSet) === null || _c === void 0 ? void 0 : _c.update();\r\n VAnimation_1.VAnimation.update();\r\n (_d = this.dialogManager) === null || _d === void 0 ? void 0 : _d.dialogNavigator.lateUpdate();\r\n (_e = this.chronus) === null || _e === void 0 ? void 0 : _e.update();\r\n }\r\n}\r\nexports.MRView = MRView;\r\n// グローバルな情報\r\nMRView.ext = new MRVisualExtension_1.MRVisualExtension();\r\nMRView._syncCamera = true;\r\nMRView._playerPosRefreshNeed = false;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/MRView.ts?"); /***/ }), /***/ "./ts/mr/view/MRVisualExtension.ts": /*!*****************************************!*\ !*** ./ts/mr/view/MRVisualExtension.ts ***! \*****************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.MRVisualExtension = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\n/**\r\n * NOTE: なぜわざわざプロパティと setter にしている?\r\n * ----------\r\n * アップデートで当該の関数が削除された時、 set 時にそれに気づけるようにするため。\r\n * 特に、 JavaScript(TypeScriptではなく) で拡張機能を作るとき用。\r\n */\r\nclass MRVisualExtension {\r\n constructor() {\r\n this._onMapVisualSetup = () => { };\r\n this._onOpenDialog = (model) => { return undefined; };\r\n this._onCreateWindow = (name, rect) => { return undefined; };\r\n }\r\n setOnMapVisualSetup(value) { (0, Common_1.assert)(this._onMapVisualSetup); this._onMapVisualSetup = value; }\r\n get onMapVisualSetup() { return this._onMapVisualSetup; }\r\n /**\r\n * 指定された SDialog に対して開く VDialog をオーバーライドします。\r\n * 必要に応じて instanceof で型チェックして、それぞれの VDialog を返すように実装してください。\r\n */\r\n setOnOpenDialog(value) { (0, Common_1.assert)(this._onOpenDialog); this._onOpenDialog = value; }\r\n get onOpenDialog() { return this._onOpenDialog; }\r\n /**\r\n * プラグイン内で作成されるウィンドウをオーバーライドします。\r\n */\r\n setOnCreateWindow(value) { (0, Common_1.assert)(this._onCreateWindow); this._onCreateWindow = value; }\r\n get onCreateWindow() { return this._onCreateWindow; }\r\n}\r\nexports.MRVisualExtension = MRVisualExtension;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/MRVisualExtension.ts?"); /***/ }), /***/ "./ts/mr/view/VCharacterSpriteSet.ts": /*!*******************************************!*\ !*** ./ts/mr/view/VCharacterSpriteSet.ts ***! \*******************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VCharacterSpriteSet = void 0;\r\nconst DEntityProperties_1 = __webpack_require__(/*! ts/mr/data/DEntityProperties */ \"./ts/mr/data/DEntityProperties.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst LEquipmentUserBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LEquipmentUserBehavior */ \"./ts/mr/lively/behaviors/LEquipmentUserBehavior.ts\");\r\nconst ZOFFSET_TABLE_RIGHT_HAND = [\r\n 0,\r\n -1, 1, 1,\r\n -1, 0, 1,\r\n -1, -1, 1,\r\n];\r\nconst ZOFFSET_TABLE_LEFT_HAND = [\r\n 0,\r\n 1, 1, -1,\r\n 1, 0, -1,\r\n 1, -1, -1,\r\n];\r\n/**\r\n *\r\n */\r\nclass VCharacterSpriteSet {\r\n constructor(parent, owner) {\r\n this._parent = parent;\r\n this._owner = owner;\r\n this._sprites = [];\r\n this._revisionNumber = 0;\r\n }\r\n update() {\r\n var _a;\r\n const visual = this._owner.findVisual();\r\n const equipments = visual === null || visual === void 0 ? void 0 : visual.entity().findEntityBehavior(LEquipmentUserBehavior_1.LEquipmentUserBehavior);\r\n if (visual && equipments) {\r\n if (this._revisionNumber != equipments.revisitonNumber()) {\r\n const items = equipments.equippedItemEntities();\r\n // 装備中のアイテムリストとスプライト情報の配列サイズを揃えておく\r\n while (this._sprites.length > items.length) {\r\n (_a = this._sprites[this._sprites.length - 1].sprite) === null || _a === void 0 ? void 0 : _a.destroy();\r\n this._sprites.pop();\r\n }\r\n while (this._sprites.length < items.length) {\r\n this._sprites.push({\r\n imageName: \"\",\r\n sprite: undefined,\r\n itemEntityDataId: 0,\r\n });\r\n }\r\n for (let i = 0; i < items.length; i++) {\r\n const itemEntityData = items[i].data;\r\n const newImage = itemEntityData.entity.equipmentImage.name;\r\n const current = (i < this._sprites.length) ? this._sprites[i].imageName : \"\";\r\n const spriteData = this._sprites[i];\r\n spriteData.itemEntityDataId = itemEntityData.id;\r\n if (current != newImage) {\r\n this._sprites[i].imageName = newImage;\r\n if (!spriteData.sprite) {\r\n spriteData.sprite = new Sprite(undefined);\r\n }\r\n spriteData.sprite.bitmap = ImageManager.loadCharacter(newImage);\r\n spriteData.sprite.visible = false;\r\n spriteData.sprite.anchor.x = 0.5;\r\n spriteData.sprite.anchor.y = 1.0;\r\n }\r\n else if (newImage == \"\" && spriteData.sprite) {\r\n spriteData.sprite.bitmap = undefined;\r\n }\r\n }\r\n // 追加処理。\r\n // 装備アイテムのイメージは Z-Offset を設定する必要があるため、CharacterSprite の子ではなく、その親に追加する。\r\n {\r\n // 一度除外する\r\n for (const s of this._sprites) {\r\n if (s.sprite)\r\n this._parent.removeChild(s.sprite);\r\n }\r\n // 装備スロットIDの若い方が上に表示されるように追加する\r\n for (const s of this._sprites.slice().reverse()) {\r\n if (s.sprite)\r\n this._parent.addChild(s.sprite);\r\n }\r\n }\r\n this._revisionNumber = equipments.revisitonNumber();\r\n }\r\n const pw = this._owner.patternWidth();\r\n const ph = this._owner.patternHeight();\r\n const sx = (this._owner.characterBlockX() + this._owner.characterPatternX()) * pw;\r\n const sy = (this._owner.characterBlockY() + this._owner.characterPatternY()) * ph;\r\n const d = this._owner._character.direction();\r\n for (const s of this._sprites) {\r\n if (s.sprite) {\r\n s.sprite.setFrame(sx, sy, pw, ph);\r\n // Owner と同期する\r\n s.sprite.position = this._owner.position;\r\n s.sprite.visible = this._owner.visible;\r\n s.sprite.opacity = this._owner.opacity;\r\n if (MRData_1.MRData.entities[s.itemEntityDataId].entity.equipmentImage.side == DEntityProperties_1.DItemEquipmentSide.Right) {\r\n s.sprite.z = this._owner.z + ZOFFSET_TABLE_RIGHT_HAND[d];\r\n }\r\n else {\r\n s.sprite.z = this._owner.z + ZOFFSET_TABLE_LEFT_HAND[d];\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n for (const s of this._sprites) {\r\n if (s.sprite) {\r\n s.sprite.visible = true;\r\n }\r\n }\r\n }\r\n }\r\n}\r\nexports.VCharacterSpriteSet = VCharacterSpriteSet;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/VCharacterSpriteSet.ts?"); /***/ }), /***/ "./ts/mr/view/VChronus.ts": /*!********************************!*\ !*** ./ts/mr/view/VChronus.ts ***! \********************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VChronusWindow = exports.VChronus = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst data_1 = __webpack_require__(/*! ../data */ \"./ts/mr/data/index.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ../lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst MRView_1 = __webpack_require__(/*! ./MRView */ \"./ts/mr/view/MRView.ts\");\r\nconst VAnimation_1 = __webpack_require__(/*! ./animation/VAnimation */ \"./ts/mr/view/animation/VAnimation.ts\");\r\nclass VChronus {\r\n constructor(scene) {\r\n this._timeFrameId = -1;\r\n this._livingTimeRefreshFrameCount = -1;\r\n this._fadeBitmap = new Bitmap(32, 32);\r\n this._fadeBitmap.fillAll(\"black\");\r\n this._fadeSprite = new Sprite(this._fadeBitmap);\r\n this._fadeSprite.anchor.x = 0.5;\r\n this._fadeSprite.anchor.y = 0.5;\r\n this._fadeSprite.scale.x = Graphics._width / 32;\r\n this._fadeSprite.scale.y = Graphics._height / 32;\r\n this._fadeSprite.x = Graphics._width / 2;\r\n this._fadeSprite.y = Graphics._height / 2;\r\n this._fadeSprite.opacity = 0;\r\n scene.addChild(this._fadeSprite);\r\n this._textBitmap = new Bitmap(Graphics._width, 80);\r\n this._textSprite = new Sprite(this._textBitmap);\r\n this._textSprite.anchor.x = 0.5;\r\n this._textSprite.anchor.y = 0.5;\r\n this._textSprite.scale.x = Graphics._width / 32;\r\n this._textSprite.scale.y = Graphics._height / 32;\r\n this._textSprite.opacity = 0;\r\n scene.addChild(this._textSprite);\r\n this._textBitmap.drawText(\"test\", 0, 0, Graphics._width, 80, \"center\");\r\n this._fadeAnimation = new VAnimation_1.VKeyFrameAnimationCurve();\r\n this._fadeAnimation.addFrame(0, 0);\r\n this._fadeAnimation.addFrame(60, 255);\r\n this._fadeAnimation.addFrame(120, 255);\r\n this._fadeAnimation.addFrame(180, 0);\r\n this._chronusWindow = MRView_1.MRView.windowFactory.createWindowr(VChronusWindow, new Rectangle(0, 0, 200, 60));\r\n scene.addWindow(this._chronusWindow);\r\n }\r\n update() {\r\n if (!data_1.MRData.chronus.enabled)\r\n return;\r\n const chronus = MRLively_1.MRLively.chronus;\r\n if (this._timeFrameId != chronus.currentTimeFrameId) {\r\n this._timeFrameId = chronus.currentTimeFrameId;\r\n this.setTint(this._timeFrameId, true);\r\n }\r\n if (this._livingTimeRefreshFrameCount < 0) {\r\n if (chronus.needsLivingTimeFrameRefresh) {\r\n this._livingTimeRefreshFrameCount = 0;\r\n }\r\n }\r\n else {\r\n this._fadeSprite.opacity = this._fadeAnimation.evaluate(this._livingTimeRefreshFrameCount);\r\n this._livingTimeRefreshFrameCount++;\r\n if (this._livingTimeRefreshFrameCount >= this._fadeAnimation.lastFrameTime()) {\r\n this._livingTimeRefreshFrameCount = -1;\r\n chronus.clearLivingTimeFrameRefresh();\r\n }\r\n }\r\n }\r\n getEffectDuration() {\r\n return 120;\r\n }\r\n setTint(timeFrameId, withEffect) {\r\n const info = data_1.MRData.chronus.timeTones.find(x => x.timeFrameId == timeFrameId);\r\n (0, Common_1.assert)(info);\r\n const tone = [...info.value];\r\n // if (this.getWeatherTypeId() !== 0) {\r\n // tone[0] = tone[0] > 0 ? tone[0] / 7 : tone[0] - 14;\r\n // tone[1] = tone[1] > 0 ? tone[1] / 7 : tone[1] - 14;\r\n // tone[2] = tone[2] > 0 ? tone[2] / 7 : tone[1] - 14;\r\n // tone[3] = tone[3] === 0 ? 68 : tone[3] + 14;\r\n // }\r\n $gameScreen.startTint(tone, withEffect ? this.getEffectDuration() : 0);\r\n }\r\n ;\r\n}\r\nexports.VChronus = VChronus;\r\nclass VChronusWindow extends Window_Base {\r\n constructor(rect) {\r\n super(rect);\r\n this._isWindow = false;\r\n this._revisionNumber = 0;\r\n this.refresh();\r\n }\r\n get chronus() {\r\n return MRLively_1.MRLively.chronus;\r\n }\r\n update() {\r\n super.update();\r\n if (this._revisionNumber !== this.chronus.revisionNumber) {\r\n this._revisionNumber = this.chronus.revisionNumber;\r\n this.refresh();\r\n }\r\n }\r\n refresh() {\r\n this.contents.clear();\r\n var width = this.contents.width;\r\n var height = this.lineHeight();\r\n this.contents.drawText(this.chronus.getDisplayText(), 0, 0, width, height, 'left');\r\n }\r\n}\r\nexports.VChronusWindow = VChronusWindow;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/VChronus.ts?"); /***/ }), /***/ "./ts/mr/view/VDialogManager.ts": /*!**************************************!*\ !*** ./ts/mr/view/VDialogManager.ts ***! \**************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VDialogManager = void 0;\r\nconst Common_1 = __webpack_require__(/*! ../Common */ \"./ts/mr/Common.ts\");\r\nconst SDetailsDialog_1 = __webpack_require__(/*! ../system/dialogs/SDetailsDialog */ \"./ts/mr/system/dialogs/SDetailsDialog.ts\");\r\nconst SEventExecutionDialog_1 = __webpack_require__(/*! ../system/dialogs/SEventExecutionDialog */ \"./ts/mr/system/dialogs/SEventExecutionDialog.ts\");\r\nconst SFeetDialog_1 = __webpack_require__(/*! ../system/dialogs/SFeetDialog */ \"./ts/mr/system/dialogs/SFeetDialog.ts\");\r\nconst SItemListDialog_1 = __webpack_require__(/*! ../system/dialogs/SItemListDialog */ \"./ts/mr/system/dialogs/SItemListDialog.ts\");\r\nconst SItemSelectionDialog_1 = __webpack_require__(/*! ../system/dialogs/SItemSelectionDialog */ \"./ts/mr/system/dialogs/SItemSelectionDialog.ts\");\r\nconst SItemSellDialog_1 = __webpack_require__(/*! ../system/dialogs/SItemSellDialog */ \"./ts/mr/system/dialogs/SItemSellDialog.ts\");\r\nconst SMainMenuDialog_1 = __webpack_require__(/*! ../system/dialogs/SMainMenuDialog */ \"./ts/mr/system/dialogs/SMainMenuDialog.ts\");\r\nconst SNicknameDialog_1 = __webpack_require__(/*! ../system/dialogs/SNicknameDialog */ \"./ts/mr/system/dialogs/SNicknameDialog.ts\");\r\nconst SPlayerDialog_1 = __webpack_require__(/*! ../system/dialogs/SPlayerDialog */ \"./ts/mr/system/dialogs/SPlayerDialog.ts\");\r\nconst SWarehouseStoreDialog_1 = __webpack_require__(/*! ../system/dialogs/SWarehouseStoreDialog */ \"./ts/mr/system/dialogs/SWarehouseStoreDialog.ts\");\r\nconst SWarehouseWithdrawDialog_1 = __webpack_require__(/*! ../system/dialogs/SWarehouseWithdrawDialog */ \"./ts/mr/system/dialogs/SWarehouseWithdrawDialog.ts\");\r\nconst VDialogNavigator_1 = __webpack_require__(/*! ./dialogs/VDialogNavigator */ \"./ts/mr/view/dialogs/VDialogNavigator.ts\");\r\nconst VEventExecutionDialog_1 = __webpack_require__(/*! ./dialogs/VEventExecutionDialog */ \"./ts/mr/view/dialogs/VEventExecutionDialog.ts\");\r\nconst VDetailsDialog_1 = __webpack_require__(/*! ./dialogs/VDetailsDialog */ \"./ts/mr/view/dialogs/VDetailsDialog.ts\");\r\nconst VFeetDialog_1 = __webpack_require__(/*! ./dialogs/VFeetDialog */ \"./ts/mr/view/dialogs/VFeetDialog.ts\");\r\nconst VItemListDialog_1 = __webpack_require__(/*! ./dialogs/VItemListDialog */ \"./ts/mr/view/dialogs/VItemListDialog.ts\");\r\nconst VItemSelectionDialog_1 = __webpack_require__(/*! ./dialogs/VItemSelectionDialog */ \"./ts/mr/view/dialogs/VItemSelectionDialog.ts\");\r\nconst VItemSellDialog_1 = __webpack_require__(/*! ./dialogs/VItemSellDialog */ \"./ts/mr/view/dialogs/VItemSellDialog.ts\");\r\nconst VMenuDialog_1 = __webpack_require__(/*! ./dialogs/VMenuDialog */ \"./ts/mr/view/dialogs/VMenuDialog.ts\");\r\nconst VNicknameDialog_1 = __webpack_require__(/*! ./dialogs/VNicknameDialog */ \"./ts/mr/view/dialogs/VNicknameDialog.ts\");\r\nconst VPlayerDialog_1 = __webpack_require__(/*! ./dialogs/VPlayerDialog */ \"./ts/mr/view/dialogs/VPlayerDialog.ts\");\r\nconst VWarehouseStoreDialog_1 = __webpack_require__(/*! ./dialogs/VWarehouseStoreDialog */ \"./ts/mr/view/dialogs/VWarehouseStoreDialog.ts\");\r\nconst VWarehouseWithdrawDialog_1 = __webpack_require__(/*! ./dialogs/VWarehouseWithdrawDialog */ \"./ts/mr/view/dialogs/VWarehouseWithdrawDialog.ts\");\r\nconst MRView_1 = __webpack_require__(/*! ./MRView */ \"./ts/mr/view/MRView.ts\");\r\nconst STransferMapDialog_1 = __webpack_require__(/*! ../system/dialogs/STransferMapDialog */ \"./ts/mr/system/dialogs/STransferMapDialog.ts\");\r\nconst VTransferMapDialog_1 = __webpack_require__(/*! ./dialogs/VTransferMapDialog */ \"./ts/mr/view/dialogs/VTransferMapDialog.ts\");\r\nclass VDialogManager {\r\n constructor() {\r\n this.dialogNavigator = new VDialogNavigator_1.VDialogNavigator();\r\n }\r\n openDialog(model) {\r\n let dialog = MRView_1.MRView.ext.onOpenDialog(model);\r\n if (!dialog) {\r\n if (model instanceof SPlayerDialog_1.SPlayerDialog)\r\n dialog = new VPlayerDialog_1.VPlayerDialog(model);\r\n else if (model instanceof SEventExecutionDialog_1.SEventExecutionDialog)\r\n dialog = new VEventExecutionDialog_1.VEventExecutionDialog(model);\r\n else if (model instanceof SWarehouseStoreDialog_1.SWarehouseStoreDialog)\r\n dialog = new VWarehouseStoreDialog_1.VWarehouseStoreDialog(model);\r\n else if (model instanceof SWarehouseWithdrawDialog_1.SWarehouseWithdrawDialog)\r\n dialog = new VWarehouseWithdrawDialog_1.VWarehouseWithdrawDialog(model);\r\n else if (model instanceof SMainMenuDialog_1.SMainMenuDialog)\r\n dialog = new VMenuDialog_1.VMainMenuDialog(model);\r\n else if (model instanceof SFeetDialog_1.SFeetDialog)\r\n dialog = new VFeetDialog_1.VFeetDialog(model);\r\n else if (model instanceof SItemListDialog_1.SItemListDialog)\r\n dialog = new VItemListDialog_1.VItemListDialog(model);\r\n else if (model instanceof SItemSelectionDialog_1.SItemSelectionDialog)\r\n dialog = new VItemSelectionDialog_1.VItemSelectionDialog(model);\r\n else if (model instanceof SDetailsDialog_1.SDetailsDialog)\r\n dialog = new VDetailsDialog_1.VDetailsDialog(model);\r\n else if (model instanceof SItemSellDialog_1.SItemSellDialog)\r\n dialog = new VItemSellDialog_1.VItemSellDialog(model);\r\n else if (model instanceof SNicknameDialog_1.SNicknameDialog)\r\n dialog = new VNicknameDialog_1.VNicknameDialog(model);\r\n else if (model instanceof STransferMapDialog_1.STransferMapDialog)\r\n dialog = new VTransferMapDialog_1.VTransferMapDialog(model);\r\n }\r\n (0, Common_1.assert)(dialog);\r\n this.dialogNavigator.openDialog(dialog);\r\n }\r\n onLoadGame() {\r\n this.dialogNavigator.clear();\r\n }\r\n onRmmzSetupMapCompleted() {\r\n const dialog = this.dialogNavigator.currentDialog;\r\n if (dialog instanceof VTransferMapDialog_1.VTransferMapDialog)\r\n dialog.onRmmzSetupMapCompleted();\r\n }\r\n}\r\nexports.VDialogManager = VDialogManager;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/VDialogManager.ts?"); /***/ }), /***/ "./ts/mr/view/VDirectionArrow.ts": /*!***************************************!*\ !*** ./ts/mr/view/VDirectionArrow.ts ***! \***************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VDirectionArrow = void 0;\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst MRView_1 = __webpack_require__(/*! ./MRView */ \"./ts/mr/view/MRView.ts\");\r\nclass VDirectionArrow extends Sprite {\r\n constructor() {\r\n super(undefined);\r\n this._x = 100;\r\n this._y = 100;\r\n this._dir = 0;\r\n this._crossDiagonal = false;\r\n this._bitmap = ImageManager.loadSystem(\"MR-DirectionArrow\");\r\n this._sprites = [\r\n new Sprite(this._bitmap), new Sprite(this._bitmap), new Sprite(this._bitmap),\r\n new Sprite(this._bitmap), new Sprite(this._bitmap), new Sprite(this._bitmap),\r\n new Sprite(this._bitmap), new Sprite(this._bitmap), new Sprite(this._bitmap),\r\n ];\r\n const parent = this;\r\n this._sprites.forEach((s, i) => {\r\n parent.addChild(s);\r\n });\r\n }\r\n setPosition(x, y) {\r\n this._x = x;\r\n this._y = y;\r\n }\r\n setDirection(d) {\r\n this._dir = d;\r\n }\r\n setCrossDiagonal(d) {\r\n this._crossDiagonal = d;\r\n }\r\n // override\r\n update() {\r\n if (MRLively_1.MRLively.mapView.currentMap.floorId().isTacticsMap2) {\r\n this.visible = true;\r\n }\r\n else {\r\n this.visible = false;\r\n return;\r\n }\r\n const entity = MRLively_1.MRLively.mapView.focusedEntity();\r\n if (entity && MRView_1.MRView.entityVisualSet) {\r\n const visual = MRView_1.MRView.entityVisualSet.findEntityVisualByEntity(entity);\r\n if (!visual) {\r\n // マップ遷移直後など、まだターゲットが生成されていないことがある\r\n this.visible = false;\r\n return;\r\n }\r\n const sprite = visual.getRmmzSprite();\r\n this.setPosition(sprite.x, sprite.y);\r\n }\r\n const size = this._bitmap.width;\r\n this._sprites.forEach((s, i) => {\r\n s.setFrame(0, i * size, size, size);\r\n });\r\n const ox = -(size / 2);\r\n const oy = -size;\r\n this._sprites[0].x = ox + this._x - size;\r\n this._sprites[0].y = oy + this._y + size;\r\n this._sprites[1].x = ox + this._x;\r\n this._sprites[1].y = oy + this._y + size;\r\n this._sprites[2].x = ox + this._x + size;\r\n this._sprites[2].y = oy + this._y + size;\r\n this._sprites[3].x = ox + this._x - size;\r\n this._sprites[3].y = oy + this._y;\r\n this._sprites[4].x = ox + this._x;\r\n this._sprites[4].y = oy + this._y;\r\n this._sprites[5].x = ox + this._x + size;\r\n this._sprites[5].y = oy + this._y;\r\n this._sprites[6].x = ox + this._x - size;\r\n this._sprites[6].y = oy + this._y - size;\r\n this._sprites[7].x = ox + this._x;\r\n this._sprites[7].y = oy + this._y - size;\r\n this._sprites[8].x = ox + this._x + size;\r\n this._sprites[8].y = oy + this._y - size;\r\n if (this._crossDiagonal) {\r\n this._sprites[1].visible = this._sprites[3].visible = this._sprites[5].visible = this._sprites[7].visible = false;\r\n this._sprites[0].visible = this._sprites[2].visible = this._sprites[6].visible = this._sprites[8].visible = true;\r\n }\r\n else {\r\n for (let i = 0; i < this._sprites.length; i++) {\r\n this._sprites[i].visible = (this._dir - 1 == i);\r\n }\r\n }\r\n }\r\n}\r\nexports.VDirectionArrow = VDirectionArrow;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/VDirectionArrow.ts?"); /***/ }), /***/ "./ts/mr/view/VEntity.ts": /*!*******************************!*\ !*** ./ts/mr/view/VEntity.ts ***! \*******************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VEntity = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst Vector2_1 = __webpack_require__(/*! ts/mr/math/Vector2 */ \"./ts/mr/math/Vector2.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst Helpers_1 = __webpack_require__(/*! ts/mr/system/Helpers */ \"./ts/mr/system/Helpers.ts\");\r\nconst VSequelContext_1 = __webpack_require__(/*! ts/mr/view/VSequelContext */ \"./ts/mr/view/VSequelContext.ts\");\r\nconst MRView_1 = __webpack_require__(/*! ./MRView */ \"./ts/mr/view/MRView.ts\");\r\nconst SNavigationHelper_1 = __webpack_require__(/*! ts/mr/system/SNavigationHelper */ \"./ts/mr/system/SNavigationHelper.ts\");\r\nconst LUnitBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LUnitBehavior */ \"./ts/mr/lively/behaviors/LUnitBehavior.ts\");\r\nconst SView_1 = __webpack_require__(/*! ts/mr/system/SView */ \"./ts/mr/system/SView.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ../data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst DCommon_1 = __webpack_require__(/*! ../data/DCommon */ \"./ts/mr/data/DCommon.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ../data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst DScript_1 = __webpack_require__(/*! ../data/DScript */ \"./ts/mr/data/DScript.ts\");\r\nconst DSystem_1 = __webpack_require__(/*! ../data/DSystem */ \"./ts/mr/data/DSystem.ts\");\r\n/**\r\n * Entity の「見た目」を表現するためのクラス。\r\n *\r\n * RMMZ 向けのこのクラスの実装では、直接 Sprite を出したりするわけではない点に注意。\r\n * Mnager からのインスタンス生成と同時に、動的に Game_Event が生成され、このクラスはその Game_Event を操作する。\r\n */\r\nclass VEntity {\r\n constructor(id, entity, rmmzEventId) {\r\n this._initialUpdate = true;\r\n //private _visibilityOpacity: number = 1.0;\r\n this._visibilityOpacityStart = 1.0;\r\n this._visibilityOpacityTarget = 1.0;\r\n this._visibilityFrame = 0;\r\n this._prevVisibility = true;\r\n this.reservedDestroy = false;\r\n this.visualTransparent = false;\r\n this.id = id;\r\n this._entity = entity;\r\n this._rmmzEventId = rmmzEventId;\r\n this._rmmzSpriteIndex = -1;\r\n this._sequelContext = new VSequelContext_1.VSequelContext(this);\r\n this._position = new Vector2_1.Vector2(entity.mx, entity.my);\r\n this._sequelOpacity = 1.0;\r\n }\r\n entity() {\r\n return this._entity;\r\n }\r\n rmmzEventId() {\r\n return this._rmmzEventId;\r\n }\r\n rmmzEvent() {\r\n return $gameMap.event(this._rmmzEventId);\r\n }\r\n rmmzSpriteIndex() {\r\n return this._rmmzSpriteIndex;\r\n }\r\n rmmzSprite() {\r\n return (MRView_1.MRView.spriteset) ? MRView_1.MRView.spriteset._characterSprites[this._rmmzSpriteIndex] : undefined;\r\n }\r\n getRmmzSprite() {\r\n const s = this.rmmzSprite();\r\n (0, Common_1.assert)(s);\r\n return s;\r\n }\r\n isVisible() {\r\n const focusedEntity = MRLively_1.MRLively.mapView.focusedEntity();\r\n return focusedEntity ? SNavigationHelper_1.SNavigationHelper.testVisibilityForMinimap(focusedEntity, this._entity) : false;\r\n }\r\n position() {\r\n return this._position;\r\n }\r\n x() {\r\n return this._position.x;\r\n }\r\n y() {\r\n return this._position.y;\r\n }\r\n setX(value) {\r\n this._position.x = value;\r\n }\r\n setY(value) {\r\n this._position.y = value;\r\n }\r\n setPosition(value) {\r\n this._position = value;\r\n }\r\n resetPosition() {\r\n this._position.x = this._entity.mx;\r\n this._position.y = this._entity.my;\r\n }\r\n sequelContext() {\r\n return this._sequelContext;\r\n }\r\n getIdleSequelId() {\r\n return this._entity.queryIdleSequelId();\r\n }\r\n _setSpriteIndex(value) {\r\n this._rmmzSpriteIndex = value;\r\n }\r\n // public visibility(): SEntityVisibility {\r\n // assert(this._visibility);\r\n // return this._visibility;\r\n // }\r\n actualImage() {\r\n (0, Common_1.assert)(this._actualImage);\r\n return this._actualImage;\r\n }\r\n // 0~1\r\n setOpacity(value) {\r\n this._sequelOpacity = value;\r\n }\r\n imageOverriden() {\r\n return this._actualImage !== undefined;\r\n }\r\n _update() {\r\n (0, Common_1.assert)(MRView_1.MRView.sequelFactory);\r\n if (this._rmmzEventId >= 0) {\r\n //const tileSize = REVisual.manager.tileSize();\r\n const event = $gameMap.event(this._rmmzEventId);\r\n const entity = this.entity();\r\n this._visibility = SView_1.SView.getEntityVisibility(entity);\r\n {\r\n const oldOverriden = this.imageOverriden();\r\n this._actualImage = this.getCharacterImage(entity, this._visibility);\r\n if (this._actualImage) {\r\n event.setImage(this._actualImage.characterName, this._actualImage.characterIndex);\r\n if (event.isDirectionFixed() != this._actualImage.directionFix) {\r\n event.setDirection(this._actualImage.direction);\r\n event.setDirectionFix(this._actualImage.directionFix);\r\n }\r\n event.setStepAnime(this._actualImage.stepAnime);\r\n event.setWalkAnime(this._actualImage.walkAnime);\r\n if (!this._actualImage.stepAnime && !this._actualImage.walkAnime) {\r\n event.setPattern(this._actualImage.pattern);\r\n }\r\n }\r\n // 優先表示 Image が無くなった? (Prefab のものに戻したい)\r\n const newOverriden = this.imageOverriden();\r\n if (!newOverriden && newOverriden != oldOverriden) {\r\n // - event.refresh() では、pageIndex に変化が無い場合、実際に元に戻そうとはしない。\r\n // event.setupPage() を呼ぶことで強制的に元に戻せる。\r\n // - 単に event.setupPage() を呼ぶだけだと、event.setDirection() した状態が維持されてしまう。\r\n // 完全に戻すには event._originalDirection などもリセットしてからにする必要がある。\r\n // ちょっとハックなので本当は event.initMembers() とかで戻したいのだが、\r\n // initMembers() は MR システム側で必要な変数の初期化も行われるためそれはやりたくない。\r\n event._originalPattern = 1;\r\n event._originalDirection = 2;\r\n event.setupPage();\r\n }\r\n }\r\n if (entity._needVisualRefresh) {\r\n entity._needVisualRefresh = false;\r\n const prefabId = entity.getPrefabId();\r\n if (event._prefabId_RE != prefabId) {\r\n event.resetPrefab(MRData_1.MRData.prefabs[prefabId]);\r\n }\r\n event.refresh();\r\n }\r\n event.setDirection(entity.dir);\r\n if (this.visualTransparent) {\r\n // 演出のために透明化を強制されている\r\n event.setTransparent(true);\r\n }\r\n else {\r\n event.setTransparent(!this._visibility.visible);\r\n }\r\n // Sequel の更新は、\r\n // - 表示プロパティの後で行う必要がある。こうしないと、Sequel 更新内での不透明度の調整が効かなくなる。\r\n // - 姿勢同期の前で行う必要がある。こうしないと、座標更新が1フレーム遅れてカクカクして見えてしまう。\r\n this._sequelContext._update();\r\n // 姿勢同期\r\n event._x = this._position.x;\r\n event._y = this._position.y;\r\n event._realX = this._position.x; //(this._position.x * tileSize.x) + (tileSize.x / 2);\r\n event._realY = this._position.y; //(this._position.y * tileSize.y) + (tileSize.y / 2);\r\n // NOTE: 罠を踏んだ後、Sequel の再生が終わるまで露出した罠が表示されない問題があった。\r\n // ただ既存問題が見切れていないためコメントアウト。\r\n //if (REVisual._syncCamera) {\r\n this.updateOpacity(entity, event, this._visibility);\r\n //}\r\n const sprite = this.rmmzSprite();\r\n if (sprite) {\r\n const entity = this.entity();\r\n if (entity.findEntityBehavior(LUnitBehavior_1.LUnitBehavior)) {\r\n sprite.setStateIcons(entity.states.map(state => state.stateData().iconIndex));\r\n }\r\n if (event._MRNeedsRefresh) {\r\n event._MRNeedsRefresh = false;\r\n this.refreshQuestIcon(event, sprite);\r\n }\r\n }\r\n }\r\n }\r\n updateOpacity(entity, event, visibility) {\r\n // 初回更新時に、現在の表示状態を覚えておく。フェードインを正しく開始できるようにするため。\r\n if (this._initialUpdate) {\r\n this._initialUpdate = false;\r\n this._prevVisibility = this.isVisible();\r\n if (!this._prevVisibility) {\r\n event.setOpacity(0);\r\n }\r\n }\r\n // フェードイン・フェードアウトの開始判定。\r\n const opacityFrames = 10;\r\n const visible = this.isVisible();\r\n if (this._prevVisibility != visible) {\r\n this._prevVisibility = visible;\r\n if (visible) {\r\n // フェードイン\r\n this._visibilityOpacityStart = event.opacity();\r\n this._visibilityOpacityTarget = this.getActualOpacity(this._entity, visibility);\r\n this._visibilityFrame = opacityFrames;\r\n }\r\n else {\r\n // フェードアウト\r\n this._visibilityOpacityStart = event.opacity();\r\n this._visibilityOpacityTarget = 0;\r\n this._visibilityFrame = opacityFrames;\r\n }\r\n }\r\n let opacity = 255;\r\n if (this._visibilityFrame > 0) {\r\n this._visibilityFrame--;\r\n if (this._visibilityFrame > 0) {\r\n opacity = (Helpers_1.Helpers.lerp(this._visibilityOpacityTarget, this._visibilityOpacityStart, this._visibilityFrame / opacityFrames));\r\n }\r\n else {\r\n opacity = this._visibilityOpacityTarget;\r\n }\r\n }\r\n else {\r\n opacity = this.getActualOpacity(entity, visibility);\r\n }\r\n event.setOpacity(opacity * this._sequelOpacity);\r\n }\r\n getCharacterImage(entity, visibility) {\r\n // 視点となる人の都合で見え方が変わるようであれば、それが最優先\r\n if (visibility.image) {\r\n return visibility.image;\r\n }\r\n return undefined;\r\n // // ステートなどで上書きされているもの\r\n // const overridenImage = entity.getCharacterImage();\r\n // if (overridenImage) {\r\n // return overridenImage;\r\n // }\r\n // return undefined;\r\n // デフォルトはプレハブから\r\n // const prefab = REData.prefabs[ entity.data.prefabId];\r\n // return prefab.image;\r\n }\r\n getActualOpacity(entity, visibility) {\r\n if (!visibility.visible)\r\n return 0;\r\n if (visibility.translucent)\r\n return 127;\r\n return 255;\r\n /*\r\n if (entity.traits(DTraits.Invisible).length > 0) {\r\n if (REGame.camera.focusedEntityId().equals(entity.entityId())) {\r\n return 127;\r\n }\r\n else {\r\n return 0;\r\n }\r\n }\r\n else {\r\n return 255;\r\n }\r\n */\r\n }\r\n showEffectResult() {\r\n const result = this.entity()._effectResult;\r\n if (this._rmmzEventId >= 0) {\r\n const event = $gameMap.event(this._rmmzEventId);\r\n const hpParams = result.paramEffects2.filter(i => i.paramId == MRBasics_1.MRBasics.params.hp);\r\n if (hpParams.length > 0) {\r\n const hpDamage = hpParams.reduce((r, i) => r + i.damage, 0);\r\n event.popupDamage_RE(hpDamage, DCommon_1.DColorIndex.Default);\r\n }\r\n }\r\n }\r\n refreshQuestIcon(rmmzEvent, sprite) {\r\n const result = MRLively_1.MRLively.scriptManager.callQuery(this._entity, new DScript_1.DScript(rmmzEvent.list()), \"MRQuery-GetQuestIcon\");\r\n sprite._MRQuestMarkerIcon.setIcon(DSystem_1.DSystem.getQuestMarkerIcon(result.questIconKey));\r\n }\r\n}\r\nexports.VEntity = VEntity;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/VEntity.ts?"); /***/ }), /***/ "./ts/mr/view/VEntityManager.ts": /*!**************************************!*\ !*** ./ts/mr/view/VEntityManager.ts ***! \**************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VEntityManager = void 0;\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst VSequelManager_1 = __webpack_require__(/*! ./VSequelManager */ \"./ts/mr/view/VSequelManager.ts\");\r\nconst VEntity_1 = __webpack_require__(/*! ./VEntity */ \"./ts/mr/view/VEntity.ts\");\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst SRmmzHelpers_1 = __webpack_require__(/*! ../system/SRmmzHelpers */ \"./ts/mr/system/SRmmzHelpers.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ../data/MRData */ \"./ts/mr/data/MRData.ts\");\r\n/**\r\n * EntityVisual の管理クラス。\r\n *\r\n * Spriteset_Map と同じように、Scene_Map の生成・破棄に合わせて Sprite の表示状態を制御する。\r\n * 実際にこのクラスが Sprite を生成するものではない点に注意。\r\n *\r\n * なお、Spriteset_Map は SceneManager.onBeforeSceneStart() からの Scene(PIXI.Stage) の destory により破棄される。\r\n */\r\nclass VEntityManager {\r\n //private _reservedDeleteVisuals: REVisual_Entity[];\r\n constructor() {\r\n this._visualEntities = [];\r\n this._sequelManager = new VSequelManager_1.VSequelManager(this);\r\n //this._reservedDeleteVisuals = [];\r\n MRLively_1.MRLively.signalFlushSequelSet = (x) => this.handleFlushSequelSet(x);\r\n // init 時点の map 上にいる Entity から Visual を作る\r\n if (MRLively_1.MRLively.mapView.currentFloorId.isTacticsMap2) {\r\n this.resetVisuals();\r\n }\r\n }\r\n resetVisuals() {\r\n for (const visual of this._visualEntities) {\r\n this.detachVisual(visual);\r\n }\r\n this._visualEntities = [];\r\n MRLively_1.MRLively.mapView.currentMap.entities().forEach(x => {\r\n this.createVisual2(x);\r\n });\r\n }\r\n entityVisuals() {\r\n return this._visualEntities;\r\n }\r\n ternimate() {\r\n // for (const visual of this._visualEntities) {\r\n // const entity = visual.entity();\r\n // if (entity.inhabitsCurrentFloor) {\r\n // }\r\n // else {\r\n // const event = $gameMap.event(entity.rmmzEventId);\r\n // assert(event);\r\n // event.erase(); // 再利用可能にする\r\n // entity.rmmzEventId = 0;\r\n // }\r\n // }\r\n this._visualEntities = [];\r\n }\r\n update() {\r\n this._sequelManager.update();\r\n //this._sequelManager.postUpdate();\r\n this._visualEntities.forEach(x => {\r\n x._update();\r\n });\r\n //this._sequelManager.update();\r\n this._sequelManager.postUpdate();\r\n this.deleteVisuals();\r\n }\r\n sequelManager() {\r\n return this._sequelManager;\r\n }\r\n findEntityVisualByEntity(entity) {\r\n return this._visualEntities.find(x => x.entity().entityId() == entity.entityId());\r\n }\r\n getEntityVisualByEntity(entity) {\r\n const v = this.findEntityVisualByEntity(entity);\r\n (0, Common_1.assert)(v);\r\n return v;\r\n }\r\n findEntityVisualByRMMZEventId(rmmzEventId) {\r\n return this._visualEntities.find(x => x.rmmzEventId() == rmmzEventId);\r\n }\r\n visualRunning() {\r\n return this._sequelManager.isRunning;\r\n }\r\n reserveDeleteVisual(entity) {\r\n const index = this._visualEntities.findIndex(x => x.entity() == entity);\r\n if (index >= 0) {\r\n const visual = this._visualEntities[index];\r\n visual.reservedDestroy = true;\r\n }\r\n }\r\n deleteVisuals() {\r\n for (let i = this._visualEntities.length - 1; i >= 0; i--) {\r\n const visual = this._visualEntities[i];\r\n if (visual.reservedDestroy) {\r\n if (visual.sequelContext().isLogicalCompleted2()) {\r\n this.detachVisual(visual);\r\n // NOTE: このメソッドはマップ遷移時の全開放時もよばれるが、\r\n // そのときはマップ遷移後に Spriteset_Map が新しいインスタンスで new されるため、\r\n // ↑の erase() の意味もあまりないが、影響はないため現状とする。\r\n this._visualEntities.splice(i, 1);\r\n }\r\n }\r\n }\r\n }\r\n detachVisual(visual) {\r\n this._sequelManager.removeVisual(visual);\r\n $gameMap.event(visual.rmmzEventId()).erase();\r\n }\r\n handleFlushSequelSet(sequelSet) {\r\n this._sequelManager.setup(sequelSet);\r\n }\r\n createVisual2(entity) {\r\n let overrideEvent;\r\n const floorNumber = MRLively_1.MRLively.mapView.currentMap.floorId().floorNumber;\r\n const land = MRLively_1.MRLively.mapView.currentMap.land2();\r\n for (const info of land.landData().appearanceTable.entities) {\r\n if (info.startFloorNumber <= floorNumber && floorNumber <= info.lastFloorNumber) {\r\n if (info.spawiInfo.entityId == entity.dataId) {\r\n overrideEvent = info.spawiInfo.overrideEvent;\r\n }\r\n }\r\n }\r\n const prefabId = entity.getPrefabId();\r\n const prefab = MRData_1.MRData.prefabs[prefabId];\r\n if (entity.inhabitsCurrentFloor) {\r\n // entity は、RMMZ のマップ上に初期配置されているイベントを元に作成された。\r\n // 固定マップの場合はここに入ってくるが、$gameMap.events の既存のインスタンスを参照しているため追加は不要。\r\n (0, Common_1.assert)(entity.rmmzEventId > 0);\r\n $gameMap.spawnREEvent(prefab, entity.rmmzEventId, undefined);\r\n }\r\n else {\r\n //assert(entity.rmmzEventId == 0);\r\n if (entity.rmmzEventId > 0 && $gameMap.event(entity.rmmzEventId)) {\r\n // セーブデータのロード後はここに来る。\r\n // Visual 用に作った Event もセーブデータに含まれているため。\r\n // ちょっと不自然な動作な気がするけど、対策するならまずオートセーブのタイミングを考え直さないとならない。\r\n // ただオートセーブのタイミングは RMMZ の都合で決められているので、それを曲げるのはやめたほうがいいかも。\r\n // 他プラグインとの競合も心配。\r\n (0, Common_1.assert)($gameMap.event(entity.rmmzEventId));\r\n }\r\n else {\r\n // entity に対応する動的イベントを新たに生成する\r\n const event = $gameMap.spawnREEvent(prefab, undefined, overrideEvent);\r\n SRmmzHelpers_1.SRmmzHelpers.linkEntityAndEvent(entity, event);\r\n }\r\n }\r\n this.createVisual(entity);\r\n }\r\n createVisual(entity) {\r\n let event = undefined;\r\n if (entity.rmmzEventId > 0) {\r\n event = $gameMap.event(entity.rmmzEventId);\r\n }\r\n //else if (entity.prefabKey.kind == 0 && entity.prefabKey.id > 0) {\r\n // 固定マップ用。現在マップに出現しているイベントから作る\r\n // event = $gameMap.event(entity.prefabKey.id);\r\n //}\r\n else {\r\n // Tile などは Visual を作らない\r\n return;\r\n }\r\n if (!event) {\r\n throw new Error();\r\n }\r\n (0, Common_1.assert)(event.isREEvent());\r\n const visual = new VEntity_1.VEntity(this._visualEntities.length, entity, event.eventId());\r\n this._visualEntities.push(visual);\r\n //event._MRVisualId = visual.id;\r\n }\r\n}\r\nexports.VEntityManager = VEntityManager;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/VEntityManager.ts?"); /***/ }), /***/ "./ts/mr/view/VHelper.ts": /*!*******************************!*\ !*** ./ts/mr/view/VHelper.ts ***! \*******************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VHelper = void 0;\r\nclass VHelper {\r\n static setIconFrame(sprite, iconIndex) {\r\n const pw = ImageManager.iconWidth;\r\n const ph = ImageManager.iconHeight;\r\n const sx = (iconIndex % 16) * pw;\r\n const sy = Math.floor(iconIndex / 16) * ph;\r\n sprite.setFrame(sx, sy, pw, ph);\r\n }\r\n // Game_CharacterBase.prototype.screenX\r\n // ※タイルの中央\r\n static toScreenX(mx) {\r\n const tw = $gameMap.tileWidth();\r\n const scrolledX = $gameMap.adjustX(mx);\r\n return Math.floor(scrolledX * tw + tw / 2);\r\n }\r\n // Game_CharacterBase.prototype.screenY\r\n // ※タイルの下端\r\n static toScreenY(my, center = false) {\r\n const th = $gameMap.tileHeight();\r\n const scrolledY = $gameMap.adjustY(my);\r\n if (center)\r\n return Math.floor(scrolledY * th + th / 2);\r\n else\r\n return Math.floor(scrolledY * th + th);\r\n }\r\n}\r\nexports.VHelper = VHelper;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/VHelper.ts?"); /***/ }), /***/ "./ts/mr/view/VHudWindow.ts": /*!**********************************!*\ !*** ./ts/mr/view/VHudWindow.ts ***! \**********************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VHudWindow = void 0;\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst LInventoryBehavior_1 = __webpack_require__(/*! ts/mr/lively/entity/LInventoryBehavior */ \"./ts/mr/lively/entity/LInventoryBehavior.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst LExperienceBehavior_1 = __webpack_require__(/*! ../lively/behaviors/LExperienceBehavior */ \"./ts/mr/lively/behaviors/LExperienceBehavior.ts\");\r\nconst gaugeHeight = 6;\r\nclass VHudWindow extends Window_StatusBase {\r\n //private _floorNumberBitmap: Bitmap;\r\n //private _floorNumberSprite: Sprite;\r\n // private _levelLabel: VTextImage;\r\n // private _floorLabel: VTextImage;\r\n constructor() {\r\n super(new Rectangle(0, 0, Graphics.boxWidth, 100)); // 画面全体を覆うとツクールデフォルトの MessageWindow などが見えなくなってしまう\r\n this.frameVisible = false;\r\n this.backOpacity = 0;\r\n this.visible = false;\r\n // this._levelLabel = new VTextImage(ImageManager.loadSystem(\"MRUI-1\"));\r\n // this._levelLabel.setFrame(0, 0, 82, 30);\r\n // this._levelLabel.label = \"Lv\";\r\n // this._levelLabel.labelMarginLeft = 8;\r\n // this._levelLabel.labelMarginTop = 6;\r\n // this._levelLabel.labelMarginRight = 8;\r\n // this._levelLabel.text = \"100\";\r\n // this._levelLabel.textMarginLeft = 36;\r\n // this._levelLabel.textMarginTop = 9;\r\n // this._levelLabel.textMarginRight = 8;\r\n // this.addChild(this._levelLabel);\r\n // this._floorLabel = new VTextImage(ImageManager.loadSystem(\"MRUI-1\"));\r\n // this._floorLabel.x = 0;\r\n // this._floorLabel.y = 30;\r\n // this._floorLabel.setFrame(0, 30, 82, 64);\r\n // this._floorLabel.label = \"Floor\";\r\n // this._floorLabel.labelFontSize = 14;\r\n // this._floorLabel.labelMarginLeft = 10;\r\n // this._floorLabel.labelMarginTop = 6;\r\n // this._floorLabel.labelMarginRight = 8;\r\n // this._floorLabel.text = \"100\";\r\n // this._floorLabel.textAligntment = \"center\";\r\n // this._floorLabel.textMarginLeft = 8;\r\n // this._floorLabel.textMarginTop = 24;\r\n // this._floorLabel.textMarginRight = 8;\r\n // this.addChild(this._floorLabel);\r\n //this._floorNumberBitmap = new Bitmap(64, 64);\r\n //this._floorNumberBitmap.drawText(\"1F\", 0, 0, 64, lineHeight, \"left\");\r\n //this._floorNumberSprite = new Sprite(this._floorNumberBitmap);\r\n //this.addChild(this._floorNumberSprite);\r\n this.refresh();\r\n }\r\n refresh() {\r\n super.refresh();\r\n this.contents.clear();\r\n const entity = MRLively_1.MRLively.mapView.focusedEntity();\r\n if (!entity)\r\n return;\r\n const experience = entity.findEntityBehavior(LExperienceBehavior_1.LExperienceBehavior);\r\n if (!experience)\r\n return;\r\n const inventory = entity.findEntityBehavior(LInventoryBehavior_1.LInventoryBehavior);\r\n if (!inventory)\r\n return;\r\n const hp = entity.getActualParam(MRBasics_1.MRBasics.params.hp);\r\n const mhp = entity.getParamActualMax(MRBasics_1.MRBasics.params.hp);\r\n const fp = entity.getActualParam(MRBasics_1.MRBasics.params.fp);\r\n const mfp = entity.getParamActualMax(MRBasics_1.MRBasics.params.fp);\r\n const level = experience.level(entity);\r\n const prevExp = experience.expForLevel(entity, experience.level(entity));\r\n const nextExp = experience.nextLevelExp(entity);\r\n const extRatio = Math.max(0, (experience.currentExp(entity) - prevExp) / (nextExp - prevExp));\r\n if (MRLively_1.MRLively.mapView.currentMap.floorId().isTacticsMap2) {\r\n this.drawFloorNumber(0, 0, MRLively_1.MRLively.mapView.currentMap.floorId());\r\n }\r\n this.drawLevel(150, 0, level, extRatio);\r\n this.drawHpFp(300, 0, hp, mhp, fp, mfp);\r\n this.drawGold(inventory.gold());\r\n //this.placeBasicGauges($gameParty.members()[0], 0, 0);\r\n }\r\n update() {\r\n this.refresh();\r\n if (MRLively_1.MRLively.mapView.currentMap.floorId().isTacticsMap2 || MRLively_1.MRLively.mapView.currentMap.floorId().isSafetyMap2) {\r\n this.visible = true;\r\n }\r\n else {\r\n this.visible = false;\r\n }\r\n // this._levelLabel.update();\r\n // this._floorLabel.update();\r\n }\r\n drawFloorNumber(x, y, floorId) {\r\n this.drawText(floorId.floorNumber.toString(), x, y, 32, \"right\");\r\n this.changeTextColor(this.paramTitleColor());\r\n this.drawText(\"F\", x + 32, y, 32, \"left\");\r\n this.resetTextColor();\r\n }\r\n drawLevel(x, y, level, expRatio) {\r\n const t1 = \"Lv \";\r\n const t2 = level.toString();\r\n const width = this.textWidth(t1 + \"000\");\r\n const w1 = this.textWidth(t1);\r\n // Text\r\n this.changeTextColor(this.paramTitleColor());\r\n this.drawText(t1, x, y, w1, \"left\");\r\n this.resetTextColor();\r\n this.drawText(t2, x + w1, y, width - w1, \"left\");\r\n // Gauge\r\n this.contents.fillRect(x, y + this.lineHeight(), width, gaugeHeight, ColorManager.gaugeBackColor());\r\n this.contents.fillRect(x, y + this.lineHeight(), width * expRatio, gaugeHeight, this.expGugeColor());\r\n }\r\n drawHpFp(x, y, hp, maxHp, fp, maxFp) {\r\n const width = 250;\r\n const t1 = \"HP \";\r\n const t2 = `${hp} / ${maxHp}`;\r\n const w1 = this.textWidth(t1);\r\n const w2 = this.textWidth(t2);\r\n // Text\r\n this.changeTextColor(this.paramTitleColor());\r\n this.drawText(t1, x, y, w1, \"left\");\r\n this.resetTextColor();\r\n this.drawText(t2, x + w1, y, w2, \"left\");\r\n // Gauge\r\n this.contents.fillRect(x, y + this.lineHeight(), width, gaugeHeight, ColorManager.gaugeBackColor());\r\n this.contents.fillRect(x, y + this.lineHeight(), width * (hp / maxHp), gaugeHeight, this.hpGaugeFullyColor());\r\n this.contents.fillRect(x, y + this.lineHeight() + gaugeHeight + 1, width, gaugeHeight, ColorManager.gaugeBackColor());\r\n this.contents.fillRect(x, y + this.lineHeight() + gaugeHeight + 1, width * (fp / maxFp), gaugeHeight, this.fpGaugeColor());\r\n }\r\n drawGold(gold) {\r\n const t1 = \" G\";\r\n const t2 = gold.toString();\r\n const w1 = this.textWidth(t1);\r\n const w2 = this.textWidth(t2);\r\n const x = this.contents.width - (w1 + w2) - 56; // メニューボタンに隠れる分をオフセットする\r\n const y = 0;\r\n this.drawText(t2, x, y, w2, \"right\");\r\n this.changeTextColor(this.paramTitleColor());\r\n this.drawText(t1, x + w2, y, w1, \"right\");\r\n this.resetTextColor();\r\n }\r\n paramTitleColor() {\r\n return ColorManager.textColor(23);\r\n }\r\n expGugeColor() {\r\n return ColorManager.hpGaugeColor2();\r\n }\r\n hpGaugeFullyColor() {\r\n return ColorManager.textColor(3);\r\n }\r\n fpGaugeColor() {\r\n return ColorManager.textColor(23);\r\n }\r\n}\r\nexports.VHudWindow = VHudWindow;\r\nVHudWindow.HeaderHeight = 70;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/VHudWindow.ts?"); /***/ }), /***/ "./ts/mr/view/VMapGuideGrid.ts": /*!*************************************!*\ !*** ./ts/mr/view/VMapGuideGrid.ts ***! \*************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VMapGuideGrid = void 0;\r\nconst FMapData_1 = __webpack_require__(/*! ts/mr/floorgen/FMapData */ \"./ts/mr/floorgen/FMapData.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst Helpers_1 = __webpack_require__(/*! ts/mr/system/Helpers */ \"./ts/mr/system/Helpers.ts\");\r\nconst MRView_1 = __webpack_require__(/*! ./MRView */ \"./ts/mr/view/MRView.ts\");\r\nconst StartETileId = 768;\r\nclass VMapGuideGrid {\r\n constructor() {\r\n this._mapData = [];\r\n this._mapWidth = 0;\r\n this._mapHeight = 0;\r\n this._visible = false;\r\n this._mapdataRevision = 0;\r\n this._entityDir = 0;\r\n }\r\n setVisible(v) {\r\n var _a;\r\n this._visible = v;\r\n (_a = MRView_1.MRView.spriteset) === null || _a === void 0 ? void 0 : _a._tilemap.refresh();\r\n }\r\n isVisible() {\r\n return this._visible;\r\n }\r\n update() {\r\n let refresh = false;\r\n const entity = MRLively_1.MRLively.mapView.focusedEntity();\r\n if (this._mapdataRevision != MRLively_1.MRLively.mapView.currentMap.mapdataRevision()) {\r\n this._mapdataRevision = MRLively_1.MRLively.mapView.currentMap.mapdataRevision();\r\n refresh = true;\r\n }\r\n if (entity && this._entityDir != entity.dir) {\r\n this._entityDir = entity.dir;\r\n refresh = true;\r\n }\r\n if (refresh) {\r\n this.refresh();\r\n }\r\n }\r\n readMapData(x, y) {\r\n return this._mapData[(y * this._mapWidth) + x];\r\n }\r\n setMapData(x, y, value) {\r\n this._mapData[(y * this._mapWidth) + x] = value;\r\n }\r\n refresh() {\r\n var _a;\r\n this._mapWidth = $gameMap.width();\r\n this._mapHeight = $gameMap.height();\r\n const len = this._mapWidth * this._mapHeight;\r\n if (!this._mapData || this._mapData.length < len) {\r\n this._mapData = new Array(len);\r\n }\r\n const map = MRLively_1.MRLively.mapView.currentMap;\r\n for (let y = 0; y < this._mapHeight; y++) {\r\n for (let x = 0; x < this._mapWidth; x++) {\r\n const block = map.block(x, y);\r\n //if ($gameMap.checkPassage(x, y, 0xF)) {\r\n if (block._blockComponent != FMapData_1.FBlockComponent.None) {\r\n this.setMapData(x, y, StartETileId + 1);\r\n }\r\n else {\r\n this.setMapData(x, y, 0);\r\n }\r\n }\r\n }\r\n const entity = MRLively_1.MRLively.mapView.focusedEntity();\r\n if (entity) {\r\n for (let i = 0; i < 100; i++) {\r\n const offset = Helpers_1.Helpers._dirToTileOffsetTable[entity.dir];\r\n const x = entity.mx + offset.x * i;\r\n const y = entity.my + offset.y * i;\r\n const block = map.tryGetBlock(x, y);\r\n if (block && block._blockComponent != FMapData_1.FBlockComponent.None) {\r\n this.setMapData(x, y, StartETileId + 2);\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n }\r\n (_a = MRView_1.MRView.spriteset) === null || _a === void 0 ? void 0 : _a._tilemap.refresh();\r\n }\r\n}\r\nexports.VMapGuideGrid = VMapGuideGrid;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/VMapGuideGrid.ts?"); /***/ }), /***/ "./ts/mr/view/VMessageWindowSet.ts": /*!*****************************************!*\ !*** ./ts/mr/view/VMessageWindowSet.ts ***! \*****************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VMessageWindowSet = void 0;\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst PluginParameters_1 = __webpack_require__(/*! ../PluginParameters */ \"./ts/mr/PluginParameters.ts\");\r\nconst VSceneMapView_Default_1 = __webpack_require__(/*! ./rules/default/VSceneMapView_Default */ \"./ts/mr/view/rules/default/VSceneMapView_Default.ts\");\r\nconst VHudWindow_1 = __webpack_require__(/*! ./VHudWindow */ \"./ts/mr/view/VHudWindow.ts\");\r\nconst VFloorNameWindow_1 = __webpack_require__(/*! ./window/windows/VFloorNameWindow */ \"./ts/mr/view/window/windows/VFloorNameWindow.ts\");\r\nconst VMessageLogWindow_1 = __webpack_require__(/*! ./window/windows/VMessageLogWindow */ \"./ts/mr/view/window/windows/VMessageLogWindow.ts\");\r\nconst VWindowHelper_1 = __webpack_require__(/*! ./window/VWindowHelper */ \"./ts/mr/view/window/VWindowHelper.ts\");\r\nconst VMinimapWindow_1 = __webpack_require__(/*! ./window/windows/VMinimapWindow */ \"./ts/mr/view/window/windows/VMinimapWindow.ts\");\r\n/**\r\n * Scene_Message 相当の機能。\r\n *\r\n * Scene_Map をオーバーライドして実装すると他プラグインと衝突するための名前調整など小細工が要ることが多いので、こちらにまとめている。\r\n */\r\nclass VMessageWindowSet {\r\n constructor(scene) {\r\n this._scene = scene;\r\n this._shadowBitmap = new Bitmap(32, 32);\r\n this._shadowBitmap.fillAll(\"black\");\r\n this._shadowSprite = new Sprite(this._shadowBitmap);\r\n this._shadowSprite.setFrame(0, 0, 32, 32);\r\n this._shadowSprite.scale.x = (Graphics.boxWidth / 32) + 1;\r\n this._shadowSprite.scale.y = (Graphics.boxHeight / 32) + 1;\r\n //this._shadowSprite.visible = false;\r\n scene._spriteset.addChild(this._shadowSprite);\r\n //this._messageWindow = new VMessageWindow(REGame.message, this.messageWindowRect());\r\n //this._scene.addWindow(this._messageWindow);\r\n this._floorNameWindow = new VFloorNameWindow_1.VFloorNameWindow(new Rectangle(0, 0, Graphics.boxWidth, Graphics.boxHeight));\r\n this._scene.addWindow(this._floorNameWindow);\r\n this._minimapWindow = new VMinimapWindow_1.VMinimapWindow(new Rectangle(0, VHudWindow_1.VHudWindow.HeaderHeight, Graphics.boxWidth, Graphics.boxHeight));\r\n this._scene.addWindow(this._minimapWindow);\r\n //this._scene._windowLayer.addChildAt( this._minimapWindow , 0);\r\n this._fadeDuration = 0;\r\n this._fadeOpacity = 0;\r\n this._fadeSign = 0;\r\n if (PluginParameters_1.paramUIMode.toLowerCase() === \"traditional\") {\r\n this._hudSpriteSet = new VHudWindow_1.VHudWindow();\r\n this._scene.addWindow(this._hudSpriteSet);\r\n this._logWindow = new VMessageLogWindow_1.VMessageLogWindow(MRLively_1.MRLively.messageHistory, this.messageWindowRect());\r\n this._scene.addWindow(this._logWindow);\r\n }\r\n else {\r\n this._sceneMapView = new VSceneMapView_Default_1.VSceneMapView_Default(scene);\r\n }\r\n }\r\n messageWindowRect() {\r\n const padding = 30;\r\n const ww = Graphics.boxWidth;\r\n const wh = VWindowHelper_1.VWindowHelper.calcWindowHeight(2, false) + 8;\r\n const wx = (Graphics.boxWidth - ww) / 2;\r\n const wy = Graphics.boxHeight - wh;\r\n return new Rectangle(wx + padding, wy - padding, ww - padding * 2, wh);\r\n }\r\n attemptStartDisplayFloorName() {\r\n if ($gameMap.displayName()) {\r\n this._fadeDuration = 0;\r\n this._fadeOpacity = 255;\r\n this._floorNameWindow.open();\r\n }\r\n }\r\n startFadeIn() {\r\n this._fadeSign = 1;\r\n this._fadeDuration = 30;\r\n this._fadeOpacity = 255;\r\n //this._shadowSprite.visible = true;\r\n }\r\n update() {\r\n if (this._floorNameWindow.isEffectRunning()) {\r\n if (this._floorNameWindow.showCount() == 60) {\r\n this.startFadeIn();\r\n }\r\n }\r\n if (this._fadeDuration > 0) {\r\n const d = this._fadeDuration;\r\n if (this._fadeSign > 0) {\r\n this._fadeOpacity -= this._fadeOpacity / d;\r\n }\r\n else {\r\n this._fadeOpacity += (255 - this._fadeOpacity) / d;\r\n }\r\n this._fadeDuration--;\r\n }\r\n this._shadowSprite.opacity = this._fadeOpacity;\r\n if (this._sceneMapView) {\r\n this._sceneMapView.update();\r\n }\r\n }\r\n}\r\nexports.VMessageWindowSet = VMessageWindowSet;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/VMessageWindowSet.ts?"); /***/ }), /***/ "./ts/mr/view/VSequel.ts": /*!*******************************!*\ !*** ./ts/mr/view/VSequel.ts ***! \*******************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VSequel = void 0;\r\nclass VSequel {\r\n}\r\nexports.VSequel = VSequel;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/VSequel.ts?"); /***/ }), /***/ "./ts/mr/view/VSequelContext.ts": /*!**************************************!*\ !*** ./ts/mr/view/VSequelContext.ts ***! \**************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VSequelContext = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst Vector2_1 = __webpack_require__(/*! ts/mr/math/Vector2 */ \"./ts/mr/math/Vector2.ts\");\r\nconst SSequel_1 = __webpack_require__(/*! ts/mr/system/SSequel */ \"./ts/mr/system/SSequel.ts\");\r\nconst MRView_1 = __webpack_require__(/*! ./MRView */ \"./ts/mr/view/MRView.ts\");\r\n/**\r\n * VEntity 1つに対する、モーションの実行状態を表す。\r\n */\r\nclass VSequelContext {\r\n constructor(entityVisual) {\r\n this._currentClip = -1;\r\n this._frameCount = 0;\r\n this._timeScale = 0;\r\n this._cuurentFinished = false;\r\n this._cancellationLocked = false;\r\n this._startPosition = new Vector2_1.Vector2(0, 0);\r\n this._currentIdleSequelId = 0;\r\n this._animationWaiting = false;\r\n this._balloonWaiting = false;\r\n this._waitFrameCount = 0;\r\n this._entityVisual = entityVisual;\r\n }\r\n sequel() {\r\n (0, Common_1.assert)(this._currentSequel);\r\n return this._currentSequel;\r\n }\r\n frameCount() {\r\n return this._frameCount;\r\n }\r\n timeScale() {\r\n return this._timeScale;\r\n }\r\n isFastForward() {\r\n return this._clip ? this._clip.fastForward : false;\r\n }\r\n /** Sequel 開始時の Visual の position */\r\n startPosition() {\r\n return this._startPosition;\r\n }\r\n finished() {\r\n if (this._clip) {\r\n const rmmzAnimationWainting = (this._animationWaiting) ? this._entityVisual.rmmzEvent().isAnimationPlaying() : false;\r\n const rmmzBalloonWainting = (this._balloonWaiting) ? this._entityVisual.rmmzEvent().isBalloonPlaying() : false;\r\n return !rmmzAnimationWainting && !rmmzBalloonWainting && this._cuurentFinished && this._currentClip >= this._clip.sequels().length;\r\n }\r\n else {\r\n return true;\r\n }\r\n }\r\n isCancellationLocked() {\r\n return this._cancellationLocked;\r\n }\r\n isAnimationWaintng(globalWaiting) {\r\n if ((globalWaiting || this._animationWaiting) && this._entityVisual.rmmzEvent().isAnimationPlaying()) {\r\n return true;\r\n }\r\n if ((globalWaiting || this._balloonWaiting) && this._entityVisual.rmmzEvent().isBalloonPlaying()) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n isFrameWaiting() {\r\n return this._waitFrameCount > 0;\r\n }\r\n isLogicalCompleted2() {\r\n //if (this._currentIdleSequelId > 0) return true;\r\n if (this._currentClip < 0)\r\n return true;\r\n return this.isLogicalCompleted(false);\r\n }\r\n isLogicalCompleted(globalWaiting) {\r\n return !this.isCancellationLocked() && !this.isAnimationWaintng(globalWaiting) && !this.isFrameWaiting();\r\n //return this.isCancellationLocked() || this.isAnimationWaintng() || this.isFrameWaiting();\r\n }\r\n lockCamera() {\r\n MRView_1.MRView._syncCamera = false;\r\n }\r\n unlockCamera() {\r\n MRView_1.MRView._syncCamera = true;\r\n }\r\n unlockCancellation() {\r\n this._cancellationLocked = false;\r\n }\r\n startAnimation(rmmzAnimationId) {\r\n $gameTemp.requestAnimation([this._entityVisual.rmmzEvent()], rmmzAnimationId, false);\r\n }\r\n end() {\r\n this.unlockCancellation();\r\n this._cuurentFinished = true;\r\n }\r\n _start(clip) {\r\n this._clip = clip;\r\n this._currentClip = -1;\r\n this._timeScale = clip.sequels().length;\r\n this._cuurentFinished = false;\r\n this._currentIdleSequelId = 0;\r\n this._next();\r\n }\r\n _next() {\r\n while (this._clip) {\r\n this._currentClip++;\r\n this._animationWaiting = false;\r\n this._balloonWaiting = false;\r\n if (this._currentClip < this._clip.sequels().length) {\r\n const unit = this._clip.sequels()[this._currentClip];\r\n if (unit instanceof SSequel_1.SMotionSequel) {\r\n this._startSequel(unit);\r\n this._cancellationLocked = true; // end() 必須にする\r\n break;\r\n }\r\n else if (unit instanceof SSequel_1.SAnumationSequel) {\r\n this._startAnimation(unit);\r\n if (this._animationWaiting) {\r\n break;\r\n }\r\n }\r\n else if (unit instanceof SSequel_1.SFloatingAnumationSequel) {\r\n this._startFloatingAnimation(unit);\r\n if (this._animationWaiting) {\r\n break;\r\n }\r\n }\r\n else if (unit instanceof SSequel_1.SBalloonSequel) {\r\n this._startBalloon(unit);\r\n if (this._balloonWaiting) {\r\n break;\r\n }\r\n }\r\n else if (unit instanceof SSequel_1.SWaitSequel) {\r\n this._startWaitSequel(unit);\r\n break;\r\n }\r\n else {\r\n (0, Common_1.assert)(0);\r\n }\r\n }\r\n else {\r\n this._clip = undefined;\r\n break;\r\n }\r\n }\r\n }\r\n _startSequel(sequel) {\r\n if (!MRView_1.MRView.sequelFactory)\r\n throw new Error();\r\n this._currentSequel = sequel;\r\n this._currentVisualSequel = MRView_1.MRView.sequelFactory.createVisualSequel(sequel.sequelId());\r\n this._frameCount = 0;\r\n this._cancellationLocked = false;\r\n this._cuurentFinished = false;\r\n this._currentIdleSequelId = 0;\r\n if (sequel.hasStartPosition()) {\r\n this._startPosition.x = sequel.startX();\r\n this._startPosition.y = sequel.startY();\r\n this._entityVisual.setPosition(new Vector2_1.Vector2(this._startPosition.x, this._startPosition.y));\r\n }\r\n else {\r\n this._startPosition = Vector2_1.Vector2.clone(this._entityVisual.position());\r\n }\r\n }\r\n _startAnimation(unit) {\r\n $gameTemp.requestAnimation([this._entityVisual.rmmzEvent()], unit.anumationlId(), false);\r\n if (unit.isWait()) {\r\n this._animationWaiting = true;\r\n }\r\n }\r\n _startFloatingAnimation(unit) {\r\n var _a;\r\n (_a = MRView_1.MRView.sequelFactory) === null || _a === void 0 ? void 0 : _a.startFloatingAnimation(unit.anumationlId, unit.mx, unit.my);\r\n if (unit.isWait()) {\r\n this._animationWaiting = true;\r\n }\r\n }\r\n _startBalloon(unit) {\r\n $gameTemp.requestBalloon(this._entityVisual.rmmzEvent(), unit.balloonId());\r\n if (unit.isWait()) {\r\n this._balloonWaiting = true;\r\n }\r\n }\r\n _startWaitSequel(sequel) {\r\n this._waitFrameCount = sequel.waitCount();\r\n }\r\n _update() {\r\n if (this._currentVisualSequel) {\r\n this._currentVisualSequel.onUpdate(this._entityVisual, this);\r\n this._frameCount += 1;\r\n if (this._cuurentFinished) {\r\n // onUpdate() 実行によりアニメーションが終了した\r\n this._currentVisualSequel = undefined;\r\n }\r\n }\r\n if (this._waitFrameCount > 0) {\r\n this._waitFrameCount--;\r\n }\r\n let idleRequested = false;\r\n if (this._clip) {\r\n const rmmzAnimationWainting = (this._animationWaiting) ? this._entityVisual.rmmzEvent().isAnimationPlaying() : false;\r\n const rmmzBalloonWainting = (this._balloonWaiting) ? this._entityVisual.rmmzEvent().isBalloonPlaying() : false;\r\n // MotionSequel を持っていなければ Idle モーションを再生したい。 (AnimationSequel のみのとき)\r\n idleRequested = !this._clip.hasMotionSeque();\r\n // current の Sequel は完了しているが、全体としては未完了の場合は次の Sequel に進む\r\n if (!rmmzAnimationWainting && !rmmzBalloonWainting && this._cuurentFinished && this._currentClip < this._clip.sequels().length) {\r\n this._next();\r\n }\r\n }\r\n else {\r\n idleRequested = true;\r\n }\r\n if (idleRequested) {\r\n const id = this._entityVisual.getIdleSequelId();\r\n if (this._currentIdleSequelId != id) {\r\n if (id != 0) {\r\n const pos = this._entityVisual.position();\r\n this._startSequel(new SSequel_1.SMotionSequel(this._entityVisual.entity(), id, pos.x, pos.y, undefined));\r\n this._currentIdleSequelId = id;\r\n }\r\n }\r\n }\r\n }\r\n}\r\nexports.VSequelContext = VSequelContext;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/VSequelContext.ts?"); /***/ }), /***/ "./ts/mr/view/VSequelFactory.ts": /*!**************************************!*\ !*** ./ts/mr/view/VSequelFactory.ts ***! \**************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VSequelFactory = void 0;\r\nconst VCollapseSequel_1 = __webpack_require__(/*! ./sequels/VCollapseSequel */ \"./ts/mr/view/sequels/VCollapseSequel.ts\");\r\nconst AttackSequel_1 = __webpack_require__(/*! ./sequels/AttackSequel */ \"./ts/mr/view/sequels/AttackSequel.ts\");\r\nconst VBlowMoveSequel_1 = __webpack_require__(/*! ./sequels/VBlowMoveSequel */ \"./ts/mr/view/sequels/VBlowMoveSequel.ts\");\r\nconst VMoveSequel_1 = __webpack_require__(/*! ./sequels/VMoveSequel */ \"./ts/mr/view/sequels/VMoveSequel.ts\");\r\nconst VIdleSequel_1 = __webpack_require__(/*! ./sequels/VIdleSequel */ \"./ts/mr/view/sequels/VIdleSequel.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst VAsleepSequel_1 = __webpack_require__(/*! ./sequels/VAsleepSequel */ \"./ts/mr/view/sequels/VAsleepSequel.ts\");\r\nconst VCommonStoppedSequel_1 = __webpack_require__(/*! ./sequels/VCommonStoppedSequel */ \"./ts/mr/view/sequels/VCommonStoppedSequel.ts\");\r\nconst VDropSequel_1 = __webpack_require__(/*! ./sequels/VDropSequel */ \"./ts/mr/view/sequels/VDropSequel.ts\");\r\nconst VEscapeSequel_1 = __webpack_require__(/*! ./sequels/VEscapeSequel */ \"./ts/mr/view/sequels/VEscapeSequel.ts\");\r\nconst VEarthquake2Sequel_1 = __webpack_require__(/*! ./sequels/VEarthquake2Sequel */ \"./ts/mr/view/sequels/VEarthquake2Sequel.ts\");\r\nconst VUseItemSequel_1 = __webpack_require__(/*! ./sequels/VUseItemSequel */ \"./ts/mr/view/sequels/VUseItemSequel.ts\");\r\nconst VExplosionSequel_1 = __webpack_require__(/*! ./sequels/VExplosionSequel */ \"./ts/mr/view/sequels/VExplosionSequel.ts\");\r\nconst VDownSequel_1 = __webpack_require__(/*! ./sequels/VDownSequel */ \"./ts/mr/view/sequels/VDownSequel.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ../data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst VWarpSequel_1 = __webpack_require__(/*! ./sequels/VWarpSequel */ \"./ts/mr/view/sequels/VWarpSequel.ts\");\r\nconst VStumbleSequel_1 = __webpack_require__(/*! ./sequels/VStumbleSequel */ \"./ts/mr/view/sequels/VStumbleSequel.ts\");\r\nconst VJumpSequel_1 = __webpack_require__(/*! ./sequels/VJumpSequel */ \"./ts/mr/view/sequels/VJumpSequel.ts\");\r\nconst MRView_1 = __webpack_require__(/*! ./MRView */ \"./ts/mr/view/MRView.ts\");\r\nconst VHelper_1 = __webpack_require__(/*! ./VHelper */ \"./ts/mr/view/VHelper.ts\");\r\nconst VCrackSequel_1 = __webpack_require__(/*! ./sequels/VCrackSequel */ \"./ts/mr/view/sequels/VCrackSequel.ts\");\r\n/**\r\n */\r\nclass VSequelFactory {\r\n constructor() {\r\n this._visualSequelFactory = [];\r\n this._visualSequelFactory[MRBasics_1.MRBasics.sequels.idle] = () => new VIdleSequel_1.VIdleSequel();\r\n this._visualSequelFactory[MRBasics_1.MRBasics.sequels.MoveSequel] = () => new VMoveSequel_1.REVisualSequel_Move();\r\n this._visualSequelFactory[MRBasics_1.MRBasics.sequels.blowMoveSequel] = () => new VBlowMoveSequel_1.VBlowMoveSequel();\r\n this._visualSequelFactory[MRBasics_1.MRBasics.sequels.dropSequel] = () => new VDropSequel_1.VDropSequel();\r\n this._visualSequelFactory[MRBasics_1.MRBasics.sequels.attack] = () => new AttackSequel_1.VAttackSequel();\r\n this._visualSequelFactory[MRBasics_1.MRBasics.sequels.CollapseSequel] = () => new VCollapseSequel_1.VCollapseSequel();\r\n this._visualSequelFactory[MRBasics_1.MRBasics.sequels.commonStopped] = () => new VCommonStoppedSequel_1.VCommonStoppedSequel();\r\n this._visualSequelFactory[MRBasics_1.MRBasics.sequels.asleep] = () => new VAsleepSequel_1.VAsleepSequel();\r\n this._visualSequelFactory[MRBasics_1.MRBasics.sequels.escape] = () => new VEscapeSequel_1.VEscapeSequel();\r\n this._visualSequelFactory[MRBasics_1.MRBasics.sequels.earthquake2] = () => new VEarthquake2Sequel_1.VEarthquake2Sequel();\r\n this._visualSequelFactory[MRBasics_1.MRBasics.sequels.useItem] = () => new VUseItemSequel_1.VUseItemSequel();\r\n this._visualSequelFactory[MRBasics_1.MRBasics.sequels.explosion] = () => new VExplosionSequel_1.VExplosionSequel();\r\n this._visualSequelFactory[MRBasics_1.MRBasics.sequels.down] = () => new VDownSequel_1.VDownSequel();\r\n this._visualSequelFactory[MRBasics_1.MRBasics.sequels.warp] = () => new VWarpSequel_1.VWarpSequel();\r\n this._visualSequelFactory[MRBasics_1.MRBasics.sequels.stumble] = () => new VStumbleSequel_1.VStumbleSequel();\r\n this._visualSequelFactory[MRBasics_1.MRBasics.sequels.jump] = () => new VJumpSequel_1.VJumpSequel();\r\n this._visualSequelFactory[MRBasics_1.MRBasics.sequels.crack] = () => new VCrackSequel_1.VCrackSequel();\r\n }\r\n createVisualSequel(sequelId) {\r\n const factory = this._visualSequelFactory[sequelId];\r\n if (factory) {\r\n return factory();\r\n }\r\n else {\r\n throw new Error(`Visual Sequel not registerd. (id: ${sequelId}, name: ${MRData_1.MRData.sequels[sequelId].name})`);\r\n }\r\n }\r\n startFloatingAnimation(animationId, mx, my) {\r\n const spriteset = MRView_1.MRView.spriteSet2;\r\n if (spriteset) {\r\n spriteset.spritesetMap.createMRFloatingAnimationSprite($dataAnimations[animationId], VHelper_1.VHelper.toScreenX(mx), VHelper_1.VHelper.toScreenY(my, true));\r\n }\r\n }\r\n}\r\nexports.VSequelFactory = VSequelFactory;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/VSequelFactory.ts?"); /***/ }), /***/ "./ts/mr/view/VSequelManager.ts": /*!**************************************!*\ !*** ./ts/mr/view/VSequelManager.ts ***! \**************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VSequelManager = void 0;\r\nconst MRView_1 = __webpack_require__(/*! ./MRView */ \"./ts/mr/view/MRView.ts\");\r\nclass VSequelManager {\r\n constructor(entityVisualSet) {\r\n this._currentSequelRun = -1;\r\n this._runningVisuals = [];\r\n this._entityVisualSet = entityVisualSet;\r\n }\r\n setup(sequelSet) {\r\n this._activeSequelSet = sequelSet;\r\n this._currentSequelRun = -1;\r\n this._runningVisuals.splice(0);\r\n this.update();\r\n }\r\n get isRunning() {\r\n return this._activeSequelSet != undefined;\r\n }\r\n update() {\r\n if (this._activeSequelSet) {\r\n const runs = this._activeSequelSet.runs();\r\n if (this._currentSequelRun >= runs.length && this.isLogicalCompleted()) {\r\n // すべてのアニメーションが終了した\r\n this.onFinishedAllSequels();\r\n }\r\n else {\r\n let next = -1;\r\n if (this._currentSequelRun < 0) {\r\n // initial\r\n next = 0;\r\n }\r\n else if (this.isLogicalCompleted()) {\r\n // 再生中のものがすべて完了していれば次へ\r\n next = this._currentSequelRun + 1;\r\n }\r\n // 毎フレームは実行しないようにしたい。\r\n // initial か、this.isLogicalCompleted()=true のときだけ実行したい。\r\n if (next >= 0) {\r\n this._currentSequelRun = next;\r\n if (this._currentSequelRun < runs.length) {\r\n // 次の Run を開始する\r\n const run = runs[this._currentSequelRun];\r\n run.clips().forEach(x => {\r\n const visual = this._entityVisualSet.findEntityVisualByEntity(x.entity());\r\n if (visual) {\r\n MRView_1.MRView._syncCamera = false;\r\n visual.sequelContext()._start(x);\r\n this._runningVisuals.push(visual);\r\n }\r\n });\r\n }\r\n }\r\n }\r\n }\r\n }\r\n postUpdate() {\r\n if (this._activeSequelSet) {\r\n const runs = this._activeSequelSet.runs();\r\n if (this._currentSequelRun >= (runs.length - 1) && this.isLogicalCompleted()) {\r\n // すべてのアニメーションが終了した\r\n this.onFinishedAllSequels();\r\n }\r\n }\r\n }\r\n // 再生中の途中削除など\r\n removeVisual(visual) {\r\n const index = this._runningVisuals.indexOf(visual);\r\n if (index >= 0) {\r\n this._runningVisuals.splice(index, 1);\r\n }\r\n }\r\n onFinishedAllSequels() {\r\n this._runningVisuals.splice(0);\r\n this._activeSequelSet = undefined;\r\n MRView_1.MRView._syncCamera = true;\r\n }\r\n // 現在実行中の Run に含まれる Visual (_runningVisuals) の Sequel が、\r\n // unlock されるまで実行されているか。\r\n isLogicalCompleted() {\r\n const waitForAll = (this._activeSequelSet) ? this._activeSequelSet.isWaitForAll() : false;\r\n for (let i = 0; i < this._runningVisuals.length; i++) {\r\n const c = this._runningVisuals[i].sequelContext();\r\n if (!c.isLogicalCompleted(waitForAll)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n}\r\nexports.VSequelManager = VSequelManager;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/VSequelManager.ts?"); /***/ }), /***/ "./ts/mr/view/VSpriteSet.ts": /*!**********************************!*\ !*** ./ts/mr/view/VSpriteSet.ts ***! \**********************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VSpriteSet = void 0;\r\nconst Tilemap_1 = __webpack_require__(/*! ts/mr/rmmz/Tilemap */ \"./ts/mr/rmmz/Tilemap.ts\");\r\nconst SView_1 = __webpack_require__(/*! ../system/SView */ \"./ts/mr/system/SView.ts\");\r\nconst VSymmetricFovShadow_1 = __webpack_require__(/*! ./fov/VSymmetricFovShadow */ \"./ts/mr/view/fov/VSymmetricFovShadow.ts\");\r\nconst VDirectionArrow_1 = __webpack_require__(/*! ./VDirectionArrow */ \"./ts/mr/view/VDirectionArrow.ts\");\r\nconst VVisibilityShadow_1 = __webpack_require__(/*! ./VVisibilityShadow */ \"./ts/mr/view/VVisibilityShadow.ts\");\r\nclass VSpriteSet {\r\n constructor(spritesetMap) {\r\n this.spritesetMap = spritesetMap;\r\n this._visibilityShadow = new VVisibilityShadow_1.VVisibilityShadow(spritesetMap);\r\n this._symmetricFovShadow = new VSymmetricFovShadow_1.VSymmetricFovShadow(this);\r\n this._directionArrow = new VDirectionArrow_1.VDirectionArrow();\r\n this.spritesetMap.addChild(this._directionArrow);\r\n this.spritesetMap._tilemap.setRendererId(Tilemap_1.TilemapRendererId.Default);\r\n }\r\n destroy() {\r\n }\r\n directionArrow() {\r\n return this._directionArrow;\r\n }\r\n update() {\r\n this._visibilityShadow._update();\r\n this._symmetricFovShadow.updateShadowTiles();\r\n this.spritesetMap._tilemap.selfVisible = SView_1.SView.getTilemapView().visible;\r\n //this._spritesetMap._tilemap.visible = SView.getTilemapView().visible;\r\n //this._spritesetMap._tilemap.setBitmaps([]);\r\n }\r\n}\r\nexports.VSpriteSet = VSpriteSet;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/VSpriteSet.ts?"); /***/ }), /***/ "./ts/mr/view/VVisibilityShadow.ts": /*!*****************************************!*\ !*** ./ts/mr/view/VVisibilityShadow.ts ***! \*****************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VVisibilityShadow = void 0;\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst VAnimation_1 = __webpack_require__(/*! ./animation/VAnimation */ \"./ts/mr/view/animation/VAnimation.ts\");\r\nconst VEasing_1 = __webpack_require__(/*! ./animation/VEasing */ \"./ts/mr/view/animation/VEasing.ts\");\r\nconst MRView_1 = __webpack_require__(/*! ./MRView */ \"./ts/mr/view/MRView.ts\");\r\nconst VisibilityShadowTileSize = 48;\r\nclass VVisibilityShadow {\r\n constructor(spritesetMap) {\r\n this._spritesetMap = spritesetMap;\r\n this._visibilityShadowBitmap = ImageManager.loadSystem(\"MR-VisibilityShadow\");\r\n //this._visibilityShadowBitmap = ImageManager.loadSystem(\"MR-VisibilityShadow-Grid\");\r\n this._visibilityShadowInnerSprites = [];\r\n this._visibilityShadowInnerSprites[1] = this.createVisibilityShadowPart(16, 0.5, 0.5);\r\n this._visibilityShadowInnerSprites[2] = this.createVisibilityShadowPart(17, 0.5, 0.5);\r\n this._visibilityShadowInnerSprites[3] = this.createVisibilityShadowPart(18, 0.5, 0.5);\r\n this._visibilityShadowInnerSprites[4] = this.createVisibilityShadowPart(11, 0.5, 0.5);\r\n this._visibilityShadowInnerSprites[6] = this.createVisibilityShadowPart(13, 0.5, 0.5);\r\n this._visibilityShadowInnerSprites[7] = this.createVisibilityShadowPart(6, 0.5, 0.5);\r\n this._visibilityShadowInnerSprites[8] = this.createVisibilityShadowPart(7, 0.5, 0.5);\r\n this._visibilityShadowInnerSprites[9] = this.createVisibilityShadowPart(8, 0.5, 0.5);\r\n // Outer 内側に Anchor をつける\r\n this._visibilityShadowOuterSprites = [];\r\n this._visibilityShadowOuterSprites[2] = this.createVisibilityShadowPart(22, 0.5, 0.0);\r\n this._visibilityShadowOuterSprites[4] = this.createVisibilityShadowPart(10, 1.0, 0.5);\r\n this._visibilityShadowOuterSprites[6] = this.createVisibilityShadowPart(14, 0.0, 0.5);\r\n this._visibilityShadowOuterSprites[8] = this.createVisibilityShadowPart(2, 0.5, 1.0);\r\n this._mx1 = -1000;\r\n this._my1 = -1000;\r\n this._mx2 = -1000;\r\n this._my2 = -1000;\r\n this._inRoom = false;\r\n }\r\n _update() {\r\n const spritesVisible = !MRLively_1.MRLively.mapView.currentMap.sightClarity;\r\n for (const s of this._visibilityShadowInnerSprites) {\r\n if (s)\r\n s.visible = spritesVisible;\r\n }\r\n for (const s of this._visibilityShadowOuterSprites) {\r\n if (s)\r\n s.visible = spritesVisible;\r\n }\r\n if (MRLively_1.MRLively.mapView.currentMap.sightClarity) {\r\n return;\r\n }\r\n const focusedEntity = MRLively_1.MRLively.mapView.focusedEntity();\r\n if (MRView_1.MRView.entityVisualSet && focusedEntity) {\r\n const visual = MRView_1.MRView.entityVisualSet.findEntityVisualByEntity(focusedEntity);\r\n if (visual) {\r\n const unit = $gamePlayer;\r\n const sprite = visual.rmmzSprite();\r\n if (sprite) {\r\n let tx1 = 0; // タイル左辺\r\n let tx2 = 0; // タイル右辺\r\n let ty1 = 0; // タイル上辺\r\n let ty2 = 0; // タイル下辺\r\n const unitRealX = unit._realX;\r\n const unitRealY = unit._realY;\r\n // LRoom は四捨五入した値から得るようにすると、部屋に入った時滑らかに影を動かせる\r\n const unitX = Math.round(unitRealX);\r\n const unitY = Math.round(unitRealY);\r\n const room = MRLively_1.MRLively.mapView.currentMap.rooms().find(room => room.contains(unitX, unitY));\r\n if (room) {\r\n tx1 = $gameMap.adjustX(room.mx1);\r\n tx2 = $gameMap.adjustX(room.mx2);\r\n ty1 = $gameMap.adjustY(room.my1);\r\n ty2 = $gameMap.adjustY(room.my2);\r\n }\r\n else {\r\n tx1 = $gameMap.adjustX(unitRealX);\r\n tx2 = $gameMap.adjustX(unitRealX);\r\n ty1 = $gameMap.adjustY(unitRealY);\r\n ty2 = $gameMap.adjustY(unitRealY);\r\n }\r\n if (this._inRoom != (!!room)) {\r\n this.animateVisibleAreaRect(tx1, ty1, tx2, ty2);\r\n this._inRoom = (!!room);\r\n }\r\n if (this._mx1Animation && !this._mx1Animation.isFinished()) {\r\n this._mx1Animation.curve._targetValue = tx1;\r\n }\r\n else {\r\n this._mx1 = tx1;\r\n }\r\n if (this._my1Animation && !this._my1Animation.isFinished()) {\r\n this._my1Animation.curve._targetValue = ty1;\r\n }\r\n else {\r\n this._my1 = ty1;\r\n }\r\n if (this._mx2Animation && !this._mx2Animation.isFinished()) {\r\n this._mx2Animation.curve._targetValue = tx2;\r\n }\r\n else {\r\n this._mx2 = tx2;\r\n }\r\n if (this._my2Animation && !this._my2Animation.isFinished()) {\r\n this._my2Animation.curve._targetValue = ty2;\r\n }\r\n else {\r\n this._my2 = ty2;\r\n }\r\n this.updateVisibleAreaRect();\r\n }\r\n }\r\n }\r\n }\r\n animateVisibleAreaRect(mx1, my1, mx2, my2) {\r\n if (this._mx1 <= -1000) {\r\n this._mx1 = mx1;\r\n this._my1 = my1;\r\n this._mx2 = mx2;\r\n this._my2 = my2;\r\n }\r\n else {\r\n const base = this._visibilityShadowInnerSprites[1];\r\n this._mx1Animation = VAnimation_1.VAnimation.startAt(base, \"mx1\", this._mx1, mx1, 0.1, VEasing_1.easing.outQuad, v => { this._mx1 = v; });\r\n this._my1Animation = VAnimation_1.VAnimation.startAt(base, \"my1\", this._my1, my1, 0.1, VEasing_1.easing.outQuad, v => { this._my1 = v; });\r\n this._mx2Animation = VAnimation_1.VAnimation.startAt(base, \"mx2\", this._mx2, mx2, 0.1, VEasing_1.easing.outQuad, v => { this._mx2 = v; });\r\n this._my2Animation = VAnimation_1.VAnimation.startAt(base, \"my2\", this._my2, my2, 0.1, VEasing_1.easing.outQuad, v => { this._my2 = v; });\r\n }\r\n }\r\n updateVisibleAreaRect() {\r\n const tileWidth = $gameMap.tileWidth();\r\n const tileHeight = $gameMap.tileHeight();\r\n const tx1 = this._mx1 * tileWidth;\r\n const tx2 = this._mx2 * tileWidth + tileWidth;\r\n const ty1 = this._my1 * tileHeight;\r\n const ty2 = this._my2 * tileHeight + tileHeight;\r\n const tw = tx2 - tx1;\r\n const th = ty2 - ty1;\r\n // InnerShadow の 9-Sprites の中心線を表す矩形\r\n // Shadow の Sprite は anchor(0.5, 0.5) であるため調整する\r\n const sx1 = tx1 - (tileWidth / 2.0);\r\n const sx2 = tx2 + (tileHeight / 2.0);\r\n const sy1 = ty1 - (tileWidth / 2.0);\r\n const sy2 = ty2 + (tileHeight / 2.0);\r\n const sw = sx2 - sx1;\r\n const sy = sy2 - sy1;\r\n // center\r\n const cx = sx1 + sw / 2.0;\r\n const cy = sy1 + sy / 2.0;\r\n this._visibilityShadowInnerSprites[1].position.set(sx1, sy2);\r\n this._visibilityShadowInnerSprites[2].position.set(cx, sy2);\r\n this._visibilityShadowInnerSprites[3].position.set(sx2, sy2);\r\n this._visibilityShadowInnerSprites[4].position.set(sx1, cy);\r\n this._visibilityShadowInnerSprites[6].position.set(sx2, cy);\r\n this._visibilityShadowInnerSprites[7].position.set(sx1, sy1);\r\n this._visibilityShadowInnerSprites[8].position.set(cx, sy1);\r\n this._visibilityShadowInnerSprites[9].position.set(sx2, sy1);\r\n this._visibilityShadowInnerSprites[2].scale.x = tw / tileWidth;\r\n this._visibilityShadowInnerSprites[4].scale.y = th / tileHeight;\r\n this._visibilityShadowInnerSprites[6].scale.y = th / tileWidth;\r\n this._visibilityShadowInnerSprites[8].scale.x = tw / tileHeight;\r\n // Outer\r\n // +------------------+\r\n // | [8] |\r\n // +---+----------+---+\r\n // | | | |\r\n // |[4]| Inner |[6]|\r\n // | | | |\r\n // +---+----------+---+\r\n // | [2] |\r\n // +------------------+\r\n const osx1 = tx1 - tileWidth;\r\n const osx2 = tx2 + tileHeight;\r\n const osy1 = ty1 - tileWidth;\r\n const osy2 = ty2 + tileHeight;\r\n const osw = (osx2 - osx1);\r\n const osh = (osy2 - osy1);\r\n this._visibilityShadowOuterSprites[2].position.set(osx1 + osw / 2.0, osy2);\r\n this._visibilityShadowOuterSprites[4].position.set(osx1, osy1 + osh / 2.0);\r\n this._visibilityShadowOuterSprites[6].position.set(osx2, osy1 + osh / 2.0);\r\n this._visibilityShadowOuterSprites[8].position.set(osx1 + osw / 2.0, osy1);\r\n const scale = (this._mx2 - this._mx1) + (this._spritesetMap._tilemap.width / this._spritesetMap._tilemap.tileWidth);\r\n this._visibilityShadowOuterSprites[2].scale.set(scale * 2, scale);\r\n this._visibilityShadowOuterSprites[4].scale.set(scale, osh / tileHeight); // 上下と重ならないように縦だけ調整\r\n this._visibilityShadowOuterSprites[6].scale.set(scale, osh / tileHeight); // 上下と重ならないように縦だけ調整\r\n this._visibilityShadowOuterSprites[8].scale.set(scale * 2, scale);\r\n }\r\n createVisibilityShadowPart(frame, anchorX, anchorY) {\r\n const tileWidth = $gameMap.tileWidth();\r\n const tileHeight = $gameMap.tileHeight();\r\n const sprite = new Sprite(this._visibilityShadowBitmap);\r\n sprite.setFrame((frame % 5) * tileWidth, Math.floor(frame / 5) * tileHeight, tileWidth, tileHeight);\r\n sprite.anchor.set(anchorX, anchorY); // 9sprite で拡大を伴うものがあるため中央にしておいた方が計算しやすい\r\n this._spritesetMap.addChild(sprite);\r\n return sprite;\r\n }\r\n}\r\nexports.VVisibilityShadow = VVisibilityShadow;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/VVisibilityShadow.ts?"); /***/ }), /***/ "./ts/mr/view/animation/VAnimation.ts": /*!********************************************!*\ !*** ./ts/mr/view/animation/VAnimation.ts ***! \********************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VAnimation = exports.VAnimationInstance = exports.VKeyFrameAnimationCurve = exports.VKeyFrameTangentMode = exports.VEasingAnimationCurve = exports.VAnimationCurve = exports.VAnimationWrapMode = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\n/** アニメーションの繰り返し方法 */\r\nvar VAnimationWrapMode;\r\n(function (VAnimationWrapMode) {\r\n /** 繰り返しを行わず、1度だけ再生します。 */\r\n VAnimationWrapMode[VAnimationWrapMode[\"Once\"] = 0] = \"Once\";\r\n /** 最後まで再生された後、先頭に戻ってループします。 */\r\n VAnimationWrapMode[VAnimationWrapMode[\"Loop\"] = 1] = \"Loop\";\r\n /** 最後まで再生された後、逆方向に戻ってループします。 */\r\n VAnimationWrapMode[VAnimationWrapMode[\"Alternate\"] = 2] = \"Alternate\";\r\n})(VAnimationWrapMode = exports.VAnimationWrapMode || (exports.VAnimationWrapMode = {}));\r\nclass VAnimationCurve {\r\n constructor() {\r\n this._wrapMode = VAnimationWrapMode.Once;\r\n }\r\n /** 指定した時間における値を評価します。*/\r\n evaluate(time) {\r\n return this.onEvaluate(this.calculateLocalTime(time, this.lastFrameTime(), this._wrapMode));\r\n }\r\n /** アニメーションの終端の時間を取得します。 */\r\n lastFrameTime() {\r\n return this.onGetLastFrameTime();\r\n }\r\n /** アニメーションの繰り返しの動作を取得します。 */\r\n wrapMode() {\r\n return this._wrapMode;\r\n }\r\n /** アニメーションの繰り返しの動作を設定します。(default: Once) */\r\n setWrapMode(mode) {\r\n this._wrapMode = mode;\r\n }\r\n onEvaluate(time) {\r\n return 0;\r\n }\r\n onGetLastFrameTime() {\r\n return 0;\r\n }\r\n calculateLocalTime(time, duration, wrapMode) {\r\n let localTime = 0.0;\r\n switch (wrapMode) {\r\n case VAnimationWrapMode.Once:\r\n localTime = Math.min(time, duration);\r\n break;\r\n case VAnimationWrapMode.Loop:\r\n localTime = time % duration;\r\n break;\r\n case VAnimationWrapMode.Alternate:\r\n {\r\n const freq = duration * 2;\r\n const t = (time % freq);\r\n const phase = t / freq;\r\n if (phase <= 0.5) {\r\n localTime = t;\r\n }\r\n else {\r\n localTime = freq - t;\r\n }\r\n break;\r\n }\r\n default:\r\n throw new Error(\"Unreachable.\");\r\n }\r\n return localTime;\r\n }\r\n}\r\nexports.VAnimationCurve = VAnimationCurve;\r\nclass VEasingAnimationCurve extends VAnimationCurve {\r\n constructor(startValue, targetValue, duration, func) {\r\n super();\r\n this._startValue = startValue;\r\n this._targetValue = targetValue;\r\n this._duration = duration;\r\n this._func = func;\r\n }\r\n onEvaluate(time) {\r\n const t = this._func(time / this._duration);\r\n return (this._targetValue - this._startValue) * t + this._startValue;\r\n }\r\n onGetLastFrameTime() {\r\n return this._duration;\r\n }\r\n}\r\nexports.VEasingAnimationCurve = VEasingAnimationCurve;\r\nvar VKeyFrameTangentMode;\r\n(function (VKeyFrameTangentMode) {\r\n /** 線形補間 */\r\n VKeyFrameTangentMode[VKeyFrameTangentMode[\"Linear\"] = 0] = \"Linear\";\r\n /** 接線 (速度) を使用した補間 (エルミートスプライン) */\r\n VKeyFrameTangentMode[VKeyFrameTangentMode[\"Tangent\"] = 1] = \"Tangent\";\r\n /** キーフレームの値を通過するなめらかな補間 (Catmull-Rom) */\r\n VKeyFrameTangentMode[VKeyFrameTangentMode[\"Auto\"] = 2] = \"Auto\";\r\n /** 補間なし */\r\n VKeyFrameTangentMode[VKeyFrameTangentMode[\"Constant\"] = 3] = \"Constant\";\r\n})(VKeyFrameTangentMode = exports.VKeyFrameTangentMode || (exports.VKeyFrameTangentMode = {}));\r\nclass VKeyFrameAnimationCurve extends VAnimationCurve {\r\n constructor() {\r\n super();\r\n this._keyFrames = [];\r\n this._defaultValue = 0.0;\r\n }\r\n addKeyFrame(keyFrame) {\r\n // そのまま追加できる\r\n if (this._keyFrames.isEmpty() || this._keyFrames.back().time <= keyFrame.time) {\r\n this._keyFrames.push(keyFrame);\r\n }\r\n // 追加後のソートが必要\r\n else {\r\n throw new Error(\"Not implemetend.\");\r\n }\r\n }\r\n addFrame(time, value, rightTangentMode = VKeyFrameTangentMode.Linear, tangent = 0.0) {\r\n const k = {\r\n time: time,\r\n value: value,\r\n leftTangentMode: VKeyFrameTangentMode.Constant,\r\n leftTangent: 0.0,\r\n rightTangentMode: rightTangentMode,\r\n rightTangent: tangent,\r\n };\r\n if (!this._keyFrames.isEmpty() && this._keyFrames.front().time <= time) {\r\n const ikey0 = this.findKeyFrameIndex(time);\r\n (0, Common_1.assert)(ikey0 >= 0);\r\n const key0 = this._keyFrames[ikey0];\r\n k.leftTangentMode = key0.rightTangentMode;\r\n k.leftTangent = -key0.rightTangent;\r\n }\r\n else {\r\n k.leftTangentMode = VKeyFrameTangentMode.Constant;\r\n k.leftTangent = 0.0;\r\n }\r\n this.addKeyFrame(k);\r\n return this;\r\n }\r\n onEvaluate(time) {\r\n if (this._keyFrames.length == 0) {\r\n return this._defaultValue;\r\n }\r\n // time が最初のフレーム位置より前の場合は Clamp\r\n if (time < this._keyFrames.front().time) {\r\n return this._keyFrames.front().value;\r\n }\r\n // キーがひとつだけの場合はそのキーの値\r\n else if (this._keyFrames.length == 1) {\r\n return this._keyFrames.front().value;\r\n }\r\n // time が終端以降の場合は終端の値\r\n else if (time >= this._keyFrames.back().time) {\r\n return this._keyFrames.back().value;\r\n }\r\n // 以上以外の場合は補間する\r\n else {\r\n const ikey0 = this.findKeyFrameIndex(time);\r\n const key0 = this._keyFrames[ikey0];\r\n const key1 = this._keyFrames[ikey0 + 1];\r\n const p0 = key0.value;\r\n const p1 = key1.value;\r\n const t0 = (key0.time);\r\n const t1 = (key1.time);\r\n const t = (time - t0) / (t1 - t0);\r\n // まず2種類のモードで保管する。最後にそれらを t で線形補間することで、異なる TangentMode を補間する\r\n const modes = [key0.rightTangentMode, key1.leftTangentMode];\r\n const values = [0, 0];\r\n for (let i = 0; i < 2; i++) {\r\n switch (modes[i]) {\r\n // 補間無し\r\n case VKeyFrameTangentMode.Constant:\r\n {\r\n values[i] = p0;\r\n break;\r\n }\r\n // 線形\r\n case VKeyFrameTangentMode.Linear:\r\n {\r\n values[i] = p0 + (p1 - p0) * t;\r\n break;\r\n }\r\n // 三次補間\r\n case VKeyFrameTangentMode.Tangent:\r\n {\r\n values[i] = this.hermite(p0, key0.rightTangent, p1, key1.leftTangent, t);\r\n break;\r\n }\r\n // Catmull-Rom\r\n case VKeyFrameTangentMode.Auto:\r\n {\r\n // ループ再生で time が終端を超えている場合、\r\n // この時点でkey の値は ループ開始位置のひとつ前のキーを指している\r\n const begin = this._keyFrames.front();\r\n const end = this._keyFrames.back();\r\n // この補間には、begin のひとつ前と end のひとつ後の値が必要。\r\n // それぞれが始点、終点の場合はループするように補間する\r\n values[i] = this.catmullRom(((key0.time == begin.time) ? end.value : this._keyFrames[ikey0 - 1].value), p0, p1, ((key1.time == end.time) ? begin.value : this._keyFrames[ikey0 + 2].value), t);\r\n break;\r\n }\r\n }\r\n }\r\n return values[0] + (values[1] - values[0]) * t;\r\n }\r\n }\r\n onGetLastFrameTime() {\r\n if (this._keyFrames.length == 0)\r\n return 0.0;\r\n return this._keyFrames[this._keyFrames.length - 1].time;\r\n }\r\n findKeyFrameIndex(time) {\r\n // TODO: 二分探索\r\n for (let i = this._keyFrames.length - 1; i >= 0; i--) {\r\n if (this._keyFrames[i].time <= time) {\r\n return i;\r\n }\r\n }\r\n return -1;\r\n }\r\n hermite(v1, a1, v2, a2, t) {\r\n const a = 2.0 * (v1 - v2) + (a1 + a2);\r\n const b = 3.0 * (v2 - v1) - (2.0 * a1) - a2;\r\n let r = a;\r\n r *= t;\r\n r += b;\r\n r *= t;\r\n r += a1;\r\n r *= t;\r\n return r + v1;\r\n }\r\n catmullRom(v1, v2, v3, v4, t) {\r\n const d1 = (v3 - v1) * 0.5;\r\n const d2 = (v4 - v2) * 0.5;\r\n return (2.0 * v2 - 2.0 * v3 + d1 + d2) * t * t * t + (-3.0 * v2 + 3.0 * v3 - 2.0 * d1 - d2) * t * t + d1 * t + v2;\r\n }\r\n}\r\nexports.VKeyFrameAnimationCurve = VKeyFrameAnimationCurve;\r\nclass VAnimationInstance {\r\n constructor(/*container: PIXI.Container,*/ key, curve, setter) {\r\n //this.container = container;\r\n this.key = key;\r\n this.curve = curve;\r\n this.setter = setter;\r\n this.time = 0;\r\n //this.timeOffset = 0;\r\n }\r\n update(elapsedTime) {\r\n const oldFinished = this.isFinished();\r\n this.time += elapsedTime;\r\n const value = this.curve.evaluate(/*this.timeOffset + */ this.time);\r\n this.setter(value);\r\n if (this._then) {\r\n const afterFinished = this.isFinished();\r\n if (afterFinished && oldFinished != afterFinished) {\r\n this._then();\r\n }\r\n }\r\n }\r\n isFinished() {\r\n if (this.curve.wrapMode() == VAnimationWrapMode.Once) {\r\n return this.time >= this.curve.lastFrameTime();\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n then(func) {\r\n this._then = func;\r\n }\r\n}\r\nexports.VAnimationInstance = VAnimationInstance;\r\nclass VAnimation {\r\n static start(container, key, curve, setter, timeOffset = 0.0) {\r\n const instance = new VAnimationInstance(/*container,*/ key, curve, setter);\r\n //instance.timeOffset = timeOffset;\r\n instance.time += timeOffset;\r\n this.add(container, key, instance);\r\n return instance;\r\n }\r\n /**\r\n * start に対してこちらは現在値を始点とした相対的なアニメーションを表現するのに使用する。\r\n */\r\n static startAt(container, key, start, target, duration, curve, setter, timeOffset = 0.0) {\r\n const instance = new VAnimationInstance(/*container,*/ key, new VEasingAnimationCurve(start, target, duration, curve), setter);\r\n //instance.timeOffset = timeOffset;\r\n instance.time += timeOffset;\r\n this.add(container, key, instance);\r\n return instance;\r\n }\r\n static add(container_, key, instance) {\r\n const container = container_;\r\n if (!container._animations_RE) {\r\n container._animations_RE = [];\r\n }\r\n const animations = container._animations_RE;\r\n (0, Common_1.assert)(animations);\r\n // 同一 key があればそこへ上書き設定\r\n for (let i = 0; i < animations.length; i++) {\r\n if (animations[i].key == key) {\r\n animations[i] = instance;\r\n return;\r\n }\r\n }\r\n // 無ければ新しく追加\r\n animations.push(instance);\r\n if (!this._containers.includes(container)) {\r\n this._containers.push(container);\r\n }\r\n }\r\n static stop(container_, key) {\r\n const container = container_;\r\n if (container._animations_RE) {\r\n const animations = container._animations_RE;\r\n for (let i = animations.length - 1; i >= 0; i--) {\r\n if (animations[i].key == key) {\r\n animations.splice(i, 1);\r\n }\r\n }\r\n }\r\n }\r\n static stopAll(container_) {\r\n const container = container_;\r\n if (container._animations_RE) {\r\n container._animations_RE = [];\r\n this._containers.mutableRemoveAll(x => x == container);\r\n }\r\n }\r\n static update() {\r\n const elapsedTime = 0.016;\r\n for (const container of this._containers) {\r\n const animations = container._animations_RE;\r\n if (animations) {\r\n for (const instance of animations) {\r\n instance.update(elapsedTime);\r\n }\r\n }\r\n }\r\n this.refresh();\r\n }\r\n static refresh() {\r\n for (let i = this._containers.length - 1; i >= 0; i--) {\r\n // この container のアニメーションはすべて終了している?\r\n let allFin = true;\r\n const animations = this._containers[i]._animations_RE;\r\n if (animations) {\r\n // for (const instance of animations) {\r\n // if (!instance.isFinished()) {\r\n // allFin = false;\r\n // break;\r\n // }\r\n // }\r\n for (let iInst = animations.length - 1; iInst >= 0; iInst--) {\r\n if (animations[iInst].isFinished()) {\r\n animations.splice(iInst, 1);\r\n }\r\n else {\r\n allFin = false;\r\n }\r\n }\r\n }\r\n // 更新対象から取り除く\r\n if (allFin) {\r\n this._containers.splice(i, 1);\r\n }\r\n }\r\n }\r\n}\r\nexports.VAnimation = VAnimation;\r\n//private static _animations: VAnimationInstance[] = [];\r\nVAnimation._containers = [];\r\n// declare namespace PIXI { \r\n// interface Container {\r\n// _animations_RE: (VAnimationInstance[] | undefined);\r\n// }\r\n// }\r\n// declare global {\r\n// interface Window {\r\n// _animationClocks_RE: (VAnimationInstance[] | undefined);\r\n// }\r\n// }\r\nconst _PIXI_Container_prototype_destroy = PIXI.Container.prototype.destroy;\r\nPIXI.Container.prototype.destroy = function (options) {\r\n VAnimation.stopAll(this);\r\n _PIXI_Container_prototype_destroy.call(this, options);\r\n};\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/animation/VAnimation.ts?"); /***/ }), /***/ "./ts/mr/view/animation/VEasing.ts": /*!*****************************************!*\ !*** ./ts/mr/view/animation/VEasing.ts ***! \*****************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\n// https://github.com/streamich/ts-easing\r\n// Unlicense — public domain.\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.easing = void 0;\r\nexports.easing = {\r\n // No easing, no acceleration\r\n linear: (t) => t,\r\n // Accelerates fast, then slows quickly towards end.\r\n quadratic: (t) => t * (-(t * t) * t + 4 * t * t - 6 * t + 4),\r\n // Overshoots over 1 and then returns to 1 towards end.\r\n cubic: (t) => t * (4 * t * t - 9 * t + 6),\r\n // Overshoots over 1 multiple times - wiggles around 1.\r\n elastic: (t) => t * (33 * t * t * t * t - 106 * t * t * t + 126 * t * t - 67 * t + 15),\r\n // Accelerating from zero velocity\r\n inQuad: (t) => t * t,\r\n // Decelerating to zero velocity\r\n outQuad: (t) => t * (2 - t),\r\n // Acceleration until halfway, then deceleration\r\n inOutQuad: (t) => t < .5 ? 2 * t * t : -1 + (4 - 2 * t) * t,\r\n // Accelerating from zero velocity\r\n inCubic: (t) => t * t * t,\r\n // Decelerating to zero velocity\r\n outCubic: (t) => (--t) * t * t + 1,\r\n // Acceleration until halfway, then deceleration\r\n inOutCubic: (t) => t < .5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1,\r\n // Accelerating from zero velocity\r\n inQuart: (t) => t * t * t * t,\r\n // Decelerating to zero velocity\r\n outQuart: (t) => 1 - (--t) * t * t * t,\r\n // Acceleration until halfway, then deceleration\r\n inOutQuart: (t) => t < .5 ? 8 * t * t * t * t : 1 - 8 * (--t) * t * t * t,\r\n // Accelerating from zero velocity\r\n inQuint: (t) => t * t * t * t * t,\r\n // Decelerating to zero velocity\r\n outQuint: (t) => 1 + (--t) * t * t * t * t,\r\n // Acceleration until halfway, then deceleration\r\n inOutQuint: (t) => t < .5 ? 16 * t * t * t * t * t : 1 + 16 * (--t) * t * t * t * t,\r\n // Accelerating from zero velocity\r\n inSine: (t) => -Math.cos(t * (Math.PI / 2)) + 1,\r\n // Decelerating to zero velocity\r\n outSine: (t) => Math.sin(t * (Math.PI / 2)),\r\n // Accelerating until halfway, then decelerating\r\n inOutSine: (t) => -(Math.cos(Math.PI * t) - 1) / 2,\r\n // Exponential accelerating from zero velocity\r\n inExpo: (t) => Math.pow(2, 10 * (t - 1)),\r\n // Exponential decelerating to zero velocity\r\n outExpo: (t) => -Math.pow(2, -10 * t) + 1,\r\n // Exponential accelerating until halfway, then decelerating\r\n inOutExpo: (t) => {\r\n t /= .5;\r\n if (t < 1)\r\n return Math.pow(2, 10 * (t - 1)) / 2;\r\n t--;\r\n return (-Math.pow(2, -10 * t) + 2) / 2;\r\n },\r\n // Circular accelerating from zero velocity\r\n inCirc: (t) => -Math.sqrt(1 - t * t) + 1,\r\n // Circular decelerating to zero velocity Moves VERY fast at the beginning and\r\n // then quickly slows down in the middle. This tween can actually be used\r\n // in continuous transitions where target value changes all the time,\r\n // because of the very quick start, it hides the jitter between target value changes.\r\n outCirc: (t) => Math.sqrt(1 - (t = t - 1) * t),\r\n // Circular acceleration until halfway, then deceleration\r\n inOutCirc: (t) => {\r\n t /= .5;\r\n if (t < 1)\r\n return -(Math.sqrt(1 - t * t) - 1) / 2;\r\n t -= 2;\r\n return (Math.sqrt(1 - t * t) + 1) / 2;\r\n }\r\n};\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/animation/VEasing.ts?"); /***/ }), /***/ "./ts/mr/view/dialogs/VDetailsDialog.ts": /*!**********************************************!*\ !*** ./ts/mr/view/dialogs/VDetailsDialog.ts ***! \**********************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VDetailsDialog = void 0;\r\nconst VDialog_1 = __webpack_require__(/*! ./VDialog */ \"./ts/mr/view/dialogs/VDialog.ts\");\r\nconst VDetailsWindow_1 = __webpack_require__(/*! ../window/windows/VDetailsWindow */ \"./ts/mr/view/window/windows/VDetailsWindow.ts\");\r\nclass VDetailsDialog extends VDialog_1.VDialog {\r\n constructor(model) {\r\n super(model);\r\n this.model = model;\r\n this._window = new VDetailsWindow_1.VDetailsWindow(model);\r\n this._window.onClose = () => this.handleClose();\r\n this.addWindow(this._window);\r\n }\r\n onCreate() {\r\n }\r\n onUpdate() {\r\n }\r\n handleClose() {\r\n SoundManager.playOk();\r\n this.cancel();\r\n }\r\n}\r\nexports.VDetailsDialog = VDetailsDialog;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/dialogs/VDetailsDialog.ts?"); /***/ }), /***/ "./ts/mr/view/dialogs/VDialog.ts": /*!***************************************!*\ !*** ./ts/mr/view/dialogs/VDialog.ts ***! \***************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VDialog = void 0;\r\nconst SDialog_1 = __webpack_require__(/*! ts/mr/system/SDialog */ \"./ts/mr/system/SDialog.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ts/mr/system/MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nclass VDialog {\r\n constructor(model) {\r\n this._created = false;\r\n this._started = false;\r\n this._windows = [];\r\n //_resultCallback: DialogResultCallback | undefined; // deprecated\r\n //_dialogResult: boolean = false;\r\n this._closing = false;\r\n this.model = model;\r\n }\r\n get scene() {\r\n return SceneManager._scene;\r\n }\r\n dialogContext() {\r\n return MRSystem_1.MRSystem.dialogContext;\r\n }\r\n commandContext() {\r\n return this.dialogContext().commandContext();\r\n }\r\n // NOTE: maindialog\r\n //protected openSubDialog(dialog: REDialog, result: LDialogResultCallback) {\r\n /** @deprecated use SDialog.openSubDialog */\r\n openSubDialog(dialog, onResult) {\r\n dialog._resultCallbackVisual = (model) => {\r\n const handled = onResult(model);\r\n if (!handled) {\r\n switch (model.resultAction) {\r\n case SDialog_1.SDialogAction.Submit:\r\n this.submit();\r\n break;\r\n case SDialog_1.SDialogAction.Cancel:\r\n //this.cancel();\r\n break;\r\n case SDialog_1.SDialogAction.CloseAllSubDialogs:\r\n if (MRSystem_1.MRSystem.dialogContext.dialogs().length >= 2) {\r\n this.closeAllSubDialogs();\r\n }\r\n break;\r\n }\r\n }\r\n };\r\n MRSystem_1.MRSystem.dialogContext.open(dialog);\r\n }\r\n //protected push(dialog: T, result: (model: T) => void) {\r\n // dialog._resultCallback = result;\r\n // REVisual.manager?._dialogNavigator.push(dialog);\r\n //}\r\n submit() {\r\n //this._dialogResult = true;\r\n this.model.submit();\r\n //REVisual.manager?._dialogNavigator.pop();\r\n //if (this._resultCallback) {\r\n // this._resultCallback(this);\r\n // }\r\n }\r\n cancel() {\r\n //this._dialogResult = false;\r\n this.model.cancel();\r\n //REVisual.manager?._dialogNavigator.pop();\r\n }\r\n closeAllSubDialogs() {\r\n this.model.closeAllSubDialogs();\r\n }\r\n // push されたあと、最初の onUpdate の前\r\n onCreate() {\r\n }\r\n // push または Sub が pop されてアクティブになった時\r\n onStart() {\r\n if (this._activeWindow) {\r\n this._activeWindow.activate();\r\n }\r\n }\r\n onUpdate() {\r\n }\r\n onClose() {\r\n }\r\n // SubDialog が push されたとき\r\n onStop() {\r\n if (this._activeWindow) {\r\n this._activeWindow.deactivate();\r\n }\r\n }\r\n onDestroy() {\r\n }\r\n get windowLayer() {\r\n return this.scene._windowLayer;\r\n }\r\n addWindow(window) {\r\n this.scene.addWindow(window);\r\n this._windows.push(window);\r\n }\r\n _removeWindow(window) {\r\n const windowLayer = this.scene._windowLayer;\r\n windowLayer.removeChild(window);\r\n }\r\n activateWindow(window) {\r\n if (this._activeWindow) {\r\n this._activeWindow.deactivate();\r\n }\r\n this._activeWindow = window;\r\n if (this._activeWindow) {\r\n this._activeWindow.activate();\r\n }\r\n }\r\n _destroy() {\r\n this.onDestroy();\r\n this._windows.forEach(x => {\r\n this._removeWindow(x);\r\n x.destroy();\r\n });\r\n }\r\n}\r\nexports.VDialog = VDialog;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/dialogs/VDialog.ts?"); /***/ }), /***/ "./ts/mr/view/dialogs/VDialogNavigator.ts": /*!************************************************!*\ !*** ./ts/mr/view/dialogs/VDialogNavigator.ts ***! \************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VDialogNavigator = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\n/**\r\n * SceneManager と同じく、スタックで Sub Dialog を管理するクラス。\r\n *\r\n * SceneManager でメニュー表示などを実装すると、ウィンドウが表示されたときには Scene_Map の表示情報はすべて破棄されている。\r\n * そのため、ウィンドウを表示したままキャラクターをアニメーションさせることができない。\r\n *\r\n * このクラスはその対策として、Scene_Map 内でウィンドウの遷移管理を行う。\r\n */\r\nclass VDialogNavigator {\r\n constructor() {\r\n this._destroyList = [];\r\n this._subDialogs = [];\r\n }\r\n get currentDialog() {\r\n if (this._nextScene)\r\n return this._nextScene; // STransferMapDialog を update を挟まずに処理したいので、_nextScene 優先。\r\n if (this._scene)\r\n return this._scene;\r\n return undefined;\r\n }\r\n get isEmpty() {\r\n return !this._scene && !this._nextScene && this._subDialogs.length == 0;\r\n }\r\n openDialog(dialog) {\r\n this.push(dialog);\r\n }\r\n closeDialog(context, model) {\r\n this.pop(model);\r\n }\r\n push(dialog) {\r\n if (this._scene) {\r\n this._subDialogs.push(this._scene);\r\n }\r\n this._nextScene = dialog;\r\n dialog._navigator = this;\r\n if (this._scene) {\r\n this._scene.onStop();\r\n }\r\n }\r\n pop(model) {\r\n if (this._nextScene) {\r\n this._nextScene = undefined;\r\n }\r\n else {\r\n (0, Common_1.assert)(this._scene);\r\n (0, Common_1.assert)(this._scene.model == model);\r\n this._nextScene = this._subDialogs.pop();\r\n this._scene.onStop();\r\n // 深い Dialog がまとめて閉じられるときは update を挟まずに複数の Dialog が同時に閉じられる。\r\n // この pop は多くの場合クリックやキャンセルキーのイベントハンドラから呼ばれるが、それは WindowLayer.update からの子要素のイテレート中に呼ばれる。\r\n // この時点で実際に destroy() からの removeChild() してしまうと、イテレータが壊れてしまう。\r\n // そのため、削除のタイミングをずらす。\r\n this._destroyList.push(this._scene);\r\n this.changeScene();\r\n }\r\n }\r\n clear() {\r\n this.destryDialogs();\r\n if (this._scene) {\r\n this._scene.onStop();\r\n this._scene.onClose();\r\n this._scene._destroy();\r\n }\r\n if (this._nextScene) {\r\n this._nextScene.onStop();\r\n this._nextScene.onClose();\r\n this._nextScene._destroy();\r\n }\r\n for (let i = this._subDialogs.length - 1; i >= 0; i--) {\r\n this._subDialogs[i].onStop();\r\n this._subDialogs[i].onClose();\r\n this._subDialogs[i]._destroy();\r\n }\r\n this._subDialogs = [];\r\n this._scene = undefined;\r\n this._nextScene = undefined;\r\n }\r\n update(context) {\r\n if (this._nextScene) {\r\n this.changeScene();\r\n }\r\n this.updateScene(context);\r\n }\r\n changeScene() {\r\n this._scene = this._nextScene;\r\n this._nextScene = undefined;\r\n if (this._scene) {\r\n if (!this._scene._created) {\r\n this._scene.onCreate();\r\n this._scene._created = true;\r\n }\r\n this._scene.onStart();\r\n }\r\n }\r\n updateScene(context) {\r\n if (this._scene) {\r\n this._scene.onUpdate();\r\n }\r\n }\r\n lateUpdate() {\r\n this.destryDialogs();\r\n }\r\n destryDialogs() {\r\n for (const d of this._destroyList) {\r\n d._destroy();\r\n }\r\n this._destroyList = [];\r\n }\r\n}\r\nexports.VDialogNavigator = VDialogNavigator;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/dialogs/VDialogNavigator.ts?"); /***/ }), /***/ "./ts/mr/view/dialogs/VEventExecutionDialog.ts": /*!*****************************************************!*\ !*** ./ts/mr/view/dialogs/VEventExecutionDialog.ts ***! \*****************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VEventExecutionDialog = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst DScript_1 = __webpack_require__(/*! ts/mr/data/DScript */ \"./ts/mr/data/DScript.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst Common_2 = __webpack_require__(/*! ts/mr/rmmz/Common */ \"./ts/mr/rmmz/Common.ts\");\r\nconst UMovement_1 = __webpack_require__(/*! ts/mr/utility/UMovement */ \"./ts/mr/utility/UMovement.ts\");\r\nconst VDialog_1 = __webpack_require__(/*! ./VDialog */ \"./ts/mr/view/dialogs/VDialog.ts\");\r\nclass VEventExecutionDialog extends VDialog_1.VDialog {\r\n constructor(model) {\r\n super(model);\r\n this.model = model;\r\n this._prelockDirection = 0;\r\n }\r\n onCreate() {\r\n let event = this.model.rmmzEvent;\r\n if (!event) { // TODO: deprecated\r\n event = $gameMap.event(this.model.rmmzEventId());\r\n }\r\n // TODO: とりあえず、既存の階段イベントが動かなくなるので暫定処置。\r\n // callCommand() 方式に統一したい。\r\n const data = new DScript_1.DScript(event.list());\r\n if (MRLively_1.MRLively.scriptManager.callCommand(this.model.owner, data, \"MRCommand-OnTalk\")) {\r\n }\r\n else {\r\n event.start();\r\n }\r\n // Game_Event.start() 相当の向き変更の実装\r\n if (event.list().length > 0) {\r\n if (event.isTriggerIn([Common_2.RmmzEventTriggerType.Button, Common_2.RmmzEventTriggerType.TouchFromPlayer, Common_2.RmmzEventTriggerType.TouchFromEvent])) {\r\n this._prelockDirection = this.model.owner.dir;\r\n this.model.owner.dir = UMovement_1.UMovement.getLookAtDir(this.model.owner, this.model.player);\r\n }\r\n }\r\n }\r\n onUpdate() {\r\n // マップ遷移後にもイベント実行を続けることもあるので、\r\n // $gameMap.event() は参照せずに $gameMap.isEventRunning() で実行中かを判断する。\r\n if (!$gameMap.isEventRunning()) {\r\n const entity = this.dialogContext().causeEntity();\r\n (0, Common_1.assert)(entity);\r\n this.submit();\r\n // Game_Event.unlock() 相当の向き変更の実装\r\n if (this._prelockDirection > 0) {\r\n this.model.owner.dir = this._prelockDirection;\r\n }\r\n }\r\n }\r\n}\r\nexports.VEventExecutionDialog = VEventExecutionDialog;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/dialogs/VEventExecutionDialog.ts?"); /***/ }), /***/ "./ts/mr/view/dialogs/VFeetDialog.ts": /*!*******************************************!*\ !*** ./ts/mr/view/dialogs/VFeetDialog.ts ***! \*******************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VFeetDialog = void 0;\r\nconst VDialog_1 = __webpack_require__(/*! ./VDialog */ \"./ts/mr/view/dialogs/VDialog.ts\");\r\nconst VFlexCommandWindow_1 = __webpack_require__(/*! ../window/windows/VFlexCommandWindow */ \"./ts/mr/view/window/windows/VFlexCommandWindow.ts\");\r\nconst VEntityCaptionWindow_1 = __webpack_require__(/*! ../window/windows/VEntityCaptionWindow */ \"./ts/mr/view/window/windows/VEntityCaptionWindow.ts\");\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst SDetailsDialog_1 = __webpack_require__(/*! ts/mr/system/dialogs/SDetailsDialog */ \"./ts/mr/system/dialogs/SDetailsDialog.ts\");\r\n/**\r\n * [足元]\r\n */\r\nclass VFeetDialog extends VDialog_1.VDialog {\r\n constructor(model) {\r\n super(model);\r\n this._model = model;\r\n const y = 100;\r\n const cw = 200;\r\n this._entityNameWindow = new VEntityCaptionWindow_1.VEntityCaptionWindow(this._model.item);\r\n this.addWindow(this._entityNameWindow);\r\n this._commandWindow = new VFlexCommandWindow_1.VFlexCommandWindow(new Rectangle(Graphics.boxWidth - cw, y, 200, 200));\r\n this._commandWindow.setupFromCommandList(this._model.makeActionList());\r\n this._commandWindow.addSystemCommand((0, Common_1.tr2)(\"説明\"), \"details\", () => this.handleDetails());\r\n this._commandWindow.setHandler(\"cancel\", () => this.cancel());\r\n this._commandWindow.refresh();\r\n this._commandWindow.open();\r\n this.addWindow(this._commandWindow);\r\n this.activateWindow(this._commandWindow);\r\n }\r\n handleDetails() {\r\n const model = new SDetailsDialog_1.SDetailsDialog(this._model.item);\r\n this.model.openSubDialog(model, (result) => {\r\n this.activateWindow(this._commandWindow);\r\n return true;\r\n });\r\n }\r\n}\r\nexports.VFeetDialog = VFeetDialog;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/dialogs/VFeetDialog.ts?"); /***/ }), /***/ "./ts/mr/view/dialogs/VItemListDialog.ts": /*!***********************************************!*\ !*** ./ts/mr/view/dialogs/VItemListDialog.ts ***! \***********************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VItemListDialog = void 0;\r\nconst LEquipmentUserBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LEquipmentUserBehavior */ \"./ts/mr/lively/behaviors/LEquipmentUserBehavior.ts\");\r\nconst VItemListDialogBase_1 = __webpack_require__(/*! ./VItemListDialogBase */ \"./ts/mr/view/dialogs/VItemListDialogBase.ts\");\r\nconst UInventory_1 = __webpack_require__(/*! ts/mr/utility/UInventory */ \"./ts/mr/utility/UInventory.ts\");\r\nclass VItemListDialog extends VItemListDialogBase_1.VItemListDialogBase {\r\n /**\r\n *\r\n * @param actorEntity\r\n * @param inventory\r\n *\r\n * actorEntity はアイテム使用者。\r\n * 必ずしも Inventory を持っている Entity ではない点に注意。\r\n * 足元に置いてある壺の中を覗いたときは、actorEntity は Player となる。\r\n */\r\n constructor(model) {\r\n super(model.inventory, model, VItemListDialogBase_1.VItemListMode.Use);\r\n this._model = model;\r\n const equipmentUser = this._model.actor.findEntityBehavior(LEquipmentUserBehavior_1.LEquipmentUserBehavior);\r\n if (equipmentUser) {\r\n this.itemListWindow.setEquipmentUser(equipmentUser);\r\n }\r\n }\r\n onCreate() {\r\n super.onCreate();\r\n }\r\n onUpdate() {\r\n if (Input.isTriggered(\"pagedown\")) {\r\n UInventory_1.UInventory.sort(this._model.inventory);\r\n this.itemListWindow.refresh();\r\n this.itemListWindow.playCursorSound();\r\n }\r\n }\r\n // onSelectedItemsChanged(items: LEntity[]): void {\r\n // this._model.setSelectedEntity(items[0]); // TODO: multi\r\n // }\r\n // override\r\n onMakeCommandList(window) {\r\n this.commandWindow.setupFromCommandList(this._model.makeActionList());\r\n super.onMakeCommandList(window);\r\n }\r\n}\r\nexports.VItemListDialog = VItemListDialog;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/dialogs/VItemListDialog.ts?"); /***/ }), /***/ "./ts/mr/view/dialogs/VItemListDialogBase.ts": /*!***************************************************!*\ !*** ./ts/mr/view/dialogs/VItemListDialogBase.ts ***! \***************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VItemListDialogBase = exports.VItemListMode = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst LIdentifyer_1 = __webpack_require__(/*! ts/mr/lively/LIdentifyer */ \"./ts/mr/lively/LIdentifyer.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst PluginParameters_1 = __webpack_require__(/*! ts/mr/PluginParameters */ \"./ts/mr/PluginParameters.ts\");\r\nconst SDetailsDialog_1 = __webpack_require__(/*! ts/mr/system/dialogs/SDetailsDialog */ \"./ts/mr/system/dialogs/SDetailsDialog.ts\");\r\nconst SNicknameDialog_1 = __webpack_require__(/*! ts/mr/system/dialogs/SNicknameDialog */ \"./ts/mr/system/dialogs/SNicknameDialog.ts\");\r\nconst VFlexCommandWindow_1 = __webpack_require__(/*! ../window/windows/VFlexCommandWindow */ \"./ts/mr/view/window/windows/VFlexCommandWindow.ts\");\r\nconst VItemListWindow_1 = __webpack_require__(/*! ../window/windows/VItemListWindow */ \"./ts/mr/view/window/windows/VItemListWindow.ts\");\r\nconst VDialog_1 = __webpack_require__(/*! ./VDialog */ \"./ts/mr/view/dialogs/VDialog.ts\");\r\nvar VItemListMode;\r\n(function (VItemListMode) {\r\n VItemListMode[VItemListMode[\"Use\"] = 0] = \"Use\";\r\n VItemListMode[VItemListMode[\"Selection\"] = 1] = \"Selection\";\r\n})(VItemListMode = exports.VItemListMode || (exports.VItemListMode = {}));\r\nclass VItemListDialogBase extends VDialog_1.VDialog {\r\n constructor(inventory, model, mode) {\r\n super(model);\r\n this.model = model;\r\n this._inventory = inventory;\r\n this._mode = mode;\r\n const y = 100;\r\n const cw = 200;\r\n this._itemListWindow = new VItemListWindow_1.VItemListWindow(new Rectangle(0, y, Graphics.boxWidth - cw, 400), model);\r\n this._itemListWindow.multipleSelectionEnabled = model.multipleSelectionEnabled;\r\n //this._itemListWindow.setInventory(this._inventory);\r\n this._itemListWindow.setHandler(\"ok\", () => this.handleItemSubmit());\r\n this._itemListWindow.setHandler(\"cancel\", () => this.handleItemCancel());\r\n this._itemListWindow.forceSelect(0);\r\n this.addWindow(this._itemListWindow);\r\n this.activateWindow(this._itemListWindow);\r\n this._itemListWindow.selectionChanged = () => {\r\n const item = this.model.items[this._itemListWindow.index()];\r\n if (item) {\r\n this.model.focusEntity(item);\r\n }\r\n //const items = this._itemListWindow.getSelectedItems();\r\n //this.model.focusEntity(items[0]); // TODO: multi\r\n };\r\n // Layout\r\n {\r\n const contentHeight = this._itemListWindow.itemHeight() * PluginParameters_1.paramInventoryItemsPerPage;\r\n this._itemListWindow.height = contentHeight + this._itemListWindow.padding * 2;\r\n this._itemListWindow.refresh();\r\n //this._itemListWindow.y = Graphics.boxHeight - this._itemListWindow.height;\r\n this._itemListWindow.y = 64;\r\n this._itemListWindow.createContents();\r\n this._itemListWindow.refresh();\r\n }\r\n // CommandWindow は最初は空。表示するとき、複数選択かどうかなどを考慮して Command を作る。\r\n this._commandWindow = new VFlexCommandWindow_1.VFlexCommandWindow(new Rectangle(Graphics.boxWidth - cw, this._itemListWindow.y, 200, 200));\r\n this.addWindow(this._commandWindow);\r\n }\r\n get itemListWindow() {\r\n return this._itemListWindow;\r\n }\r\n get commandWindow() {\r\n return this._commandWindow;\r\n }\r\n onCreate() {\r\n this.activateItemWindow();\r\n }\r\n onUpdate() {\r\n }\r\n onSelectionSubmit() {\r\n }\r\n onMakeCommandList(window) {\r\n if (!this.model.isMultiSelectMode) {\r\n if (true) {\r\n const owner = this._inventory.ownerEntity();\r\n const itemEntity = this.itemListWindow.selectedItem();\r\n const level = MRLively_1.MRLively.getCurrentIdentifyer().getEntityIdentificationLevel(owner, itemEntity);\r\n if (level == LIdentifyer_1.EntityIdentificationLevel.Unidentified) {\r\n window.addSystemCommand((0, Common_1.tr2)(\"名前\"), \"nickname\", () => this.handleNickname());\r\n }\r\n }\r\n window.addSystemCommand((0, Common_1.tr2)(\"説明\"), \"details\", () => this.handleDetails());\r\n }\r\n }\r\n activateCommandWindow() {\r\n this._commandWindow.refresh();\r\n this._commandWindow.openness = 255;\r\n this.activateWindow(this._commandWindow);\r\n }\r\n handleItemSubmit() {\r\n if (this._mode == VItemListMode.Use) {\r\n if (this._itemListWindow && this._commandWindow) {\r\n this._commandWindow.clear();\r\n this.onMakeCommandList(this._commandWindow);\r\n this._commandWindow.setHandler(\"cancel\", () => this.handleCommandCancel());\r\n this._commandWindow.fitHeight();\r\n this.activateCommandWindow();\r\n }\r\n }\r\n else if (this._mode == VItemListMode.Selection) {\r\n this.onSelectionSubmit();\r\n this.submit();\r\n }\r\n else {\r\n throw new Error(\"Unreachable.\");\r\n }\r\n }\r\n handleItemCancel() {\r\n this.cancel();\r\n }\r\n handleCommandCancel() {\r\n if (this._itemListWindow && this._commandWindow) {\r\n this.activateWindow(this._itemListWindow);\r\n this._commandWindow.openness = 0;\r\n }\r\n }\r\n handleNickname() {\r\n const owner = this._inventory.ownerEntity();\r\n const itemEntity = this.itemListWindow.selectedItem();\r\n const model = new SNicknameDialog_1.SNicknameDialog(owner, itemEntity);\r\n this.model.openSubDialog(model, (result) => {\r\n this._itemListWindow.refresh();\r\n this.activateCommandWindow();\r\n return true;\r\n });\r\n }\r\n handleDetails() {\r\n const itemEntity = this.itemListWindow.selectedItem();\r\n const model = new SDetailsDialog_1.SDetailsDialog(itemEntity);\r\n this.model.openSubDialog(model, (result) => {\r\n this.activateCommandWindow();\r\n return true;\r\n });\r\n }\r\n activateItemWindow() {\r\n if (this._itemListWindow) {\r\n this._itemListWindow.refresh();\r\n this._itemListWindow.activate();\r\n }\r\n }\r\n}\r\nexports.VItemListDialogBase = VItemListDialogBase;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/dialogs/VItemListDialogBase.ts?"); /***/ }), /***/ "./ts/mr/view/dialogs/VItemSelectionDialog.ts": /*!****************************************************!*\ !*** ./ts/mr/view/dialogs/VItemSelectionDialog.ts ***! \****************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VItemSelectionDialog = void 0;\r\nconst LEquipmentUserBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LEquipmentUserBehavior */ \"./ts/mr/lively/behaviors/LEquipmentUserBehavior.ts\");\r\nconst VItemListDialogBase_1 = __webpack_require__(/*! ./VItemListDialogBase */ \"./ts/mr/view/dialogs/VItemListDialogBase.ts\");\r\nclass VItemSelectionDialog extends VItemListDialogBase_1.VItemListDialogBase {\r\n /**\r\n *\r\n * @param actorEntity\r\n * @param inventory\r\n *\r\n * actorEntity はアイテム使用者。\r\n * 必ずしも Inventory を持っている Entity ではない点に注意。\r\n * 足元に置いてある壺の中を覗いたときは、actorEntity は Player となる。\r\n */\r\n constructor(model) {\r\n super(model.inventory, model, VItemListDialogBase_1.VItemListMode.Selection);\r\n this._model = model;\r\n const equipmentUser = this._model.entity().findEntityBehavior(LEquipmentUserBehavior_1.LEquipmentUserBehavior);\r\n if (equipmentUser) {\r\n this.itemListWindow.setEquipmentUser(equipmentUser);\r\n }\r\n }\r\n onCreate() {\r\n super.onCreate();\r\n }\r\n onUpdate() {\r\n super.onUpdate();\r\n }\r\n onSelectionSubmit() {\r\n this._model.focusEntity(this.itemListWindow.selectedItem());\r\n }\r\n}\r\nexports.VItemSelectionDialog = VItemSelectionDialog;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/dialogs/VItemSelectionDialog.ts?"); /***/ }), /***/ "./ts/mr/view/dialogs/VItemSellDialog.ts": /*!***********************************************!*\ !*** ./ts/mr/view/dialogs/VItemSellDialog.ts ***! \***********************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VItemSellDialog = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst VItemListDialogBase_1 = __webpack_require__(/*! ./VItemListDialogBase */ \"./ts/mr/view/dialogs/VItemListDialogBase.ts\");\r\nconst VItemListWindow_1 = __webpack_require__(/*! ../window/windows/VItemListWindow */ \"./ts/mr/view/window/windows/VItemListWindow.ts\");\r\nclass VItemSellDialog extends VItemListDialogBase_1.VItemListDialogBase {\r\n constructor(model) {\r\n super(model.inventory, model, VItemListDialogBase_1.VItemListMode.Use);\r\n this._model = model;\r\n this.itemListWindow.multipleSelectionEnabled = model.multipleSelectionEnabled;\r\n this.itemListWindow.priceTag = VItemListWindow_1.VItemListPriceTag.PurchasePrice;\r\n }\r\n onMakeCommandList(window) {\r\n const items = this._model.selectedEntities();\r\n window.addSystemCommand((0, Common_1.tr2)(\"売る\"), \"sell\", () => this.handleSell(items));\r\n super.onMakeCommandList(window);\r\n }\r\n handleSell(items) {\r\n SoundManager.playShop();\r\n this._model.setResultItems(items);\r\n this._model.submitSell();\r\n }\r\n}\r\nexports.VItemSellDialog = VItemSellDialog;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/dialogs/VItemSellDialog.ts?"); /***/ }), /***/ "./ts/mr/view/dialogs/VMenuDialog.ts": /*!*******************************************!*\ !*** ./ts/mr/view/dialogs/VMenuDialog.ts ***! \*******************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VMainMenuDialog = void 0;\r\nconst VMenuCommandWindow_1 = __webpack_require__(/*! ../window/windows/VMenuCommandWindow */ \"./ts/mr/view/window/windows/VMenuCommandWindow.ts\");\r\nconst VDialog_1 = __webpack_require__(/*! ./VDialog */ \"./ts/mr/view/dialogs/VDialog.ts\");\r\nconst VMainStatusWindow_1 = __webpack_require__(/*! ../window/windows/VMainStatusWindow */ \"./ts/mr/view/window/windows/VMainStatusWindow.ts\");\r\nconst VUIElement_1 = __webpack_require__(/*! ../ui/VUIElement */ \"./ts/mr/view/ui/VUIElement.ts\");\r\nconst UDialog_1 = __webpack_require__(/*! ts/mr/utility/UDialog */ \"./ts/mr/utility/UDialog.ts\");\r\nconst Scene_MRQuest_1 = __webpack_require__(/*! ts/mr/rmmz/Scene_MRQuest */ \"./ts/mr/rmmz/Scene_MRQuest.ts\");\r\nclass VMainMenuDialog extends VDialog_1.VDialog {\r\n constructor(model) {\r\n super(model);\r\n this._model = model;\r\n this._statusWindow = new VMainStatusWindow_1.VMainStatusWindow(VUIElement_1.VLayout.makeGridRect(0, 8, 12, 4));\r\n this._statusWindow.setEntity(this._model.entity());\r\n this.addWindow(this._statusWindow);\r\n }\r\n onCreate() {\r\n const y = 100;\r\n const cw = 200;\r\n this._commandWindow = new VMenuCommandWindow_1.VMenuCommandWindow(new Rectangle(0, y, cw, 240));\r\n this.addWindow(this._commandWindow);\r\n this._commandWindow.setHandler(\"item\", this.handleItem.bind(this));\r\n this._commandWindow.setHandler(\"feet\", this.handleFeet.bind(this));\r\n this._commandWindow.setHandler(\"cancel\", () => this.cancel());\r\n this._commandWindow.setHandler(\"save\", this.handleSave.bind(this));\r\n this._commandWindow.setHandler(\"suspend\", this.handleSuspend.bind(this));\r\n this._commandWindow.setHandler(\"quest\", this.handleQuest.bind(this));\r\n console.log(\"_windowLayer\", this.scene._windowLayer);\r\n }\r\n onStart() {\r\n var _a;\r\n (_a = this._commandWindow) === null || _a === void 0 ? void 0 : _a.activate();\r\n }\r\n handleItem() {\r\n UDialog_1.UDialog.postOpenInventoryDialog(this.commandContext(), this._model.entity(), dialog => { });\r\n }\r\n handleFeet() {\r\n if (!UDialog_1.UDialog.postOpenFeetDialog(this.commandContext(), this._model.entity(), dialog => { })) {\r\n this.cancel();\r\n }\r\n }\r\n handleSave() {\r\n SceneManager.push(Scene_Save);\r\n this.cancel();\r\n }\r\n handleSuspend() {\r\n throw new Error(\"Not implemented.\");\r\n }\r\n handleQuest() {\r\n SceneManager.push(Scene_MRQuest_1.Scene_MRQuest);\r\n }\r\n}\r\nexports.VMainMenuDialog = VMainMenuDialog;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/dialogs/VMenuDialog.ts?"); /***/ }), /***/ "./ts/mr/view/dialogs/VNicknameDialog.ts": /*!***********************************************!*\ !*** ./ts/mr/view/dialogs/VNicknameDialog.ts ***! \***********************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VNicknameDialog = void 0;\r\nconst VDialog_1 = __webpack_require__(/*! ./VDialog */ \"./ts/mr/view/dialogs/VDialog.ts\");\r\nconst VWindowHelper_1 = __webpack_require__(/*! ../window/VWindowHelper */ \"./ts/mr/view/window/VWindowHelper.ts\");\r\nconst VNicknameEditWindow_1 = __webpack_require__(/*! ../window/windows/VNicknameEditWindow */ \"./ts/mr/view/window/windows/VNicknameEditWindow.ts\");\r\n/**\r\n * 未識別アイテムの名前付け\r\n */\r\nclass VNicknameDialog extends VDialog_1.VDialog {\r\n constructor(model) {\r\n super(model);\r\n this._model = model;\r\n // createEditWindow\r\n {\r\n const rect = this.editWindowRect();\r\n this._editWindow = new VNicknameEditWindow_1.VNicknameEditWindow(rect);\r\n this._editWindow.setupFromEntity(this._model.item);\r\n this.addWindow(this._editWindow);\r\n }\r\n // createInputWindow\r\n {\r\n const rect = this.inputWindowRect();\r\n this._inputWindow = new Window_NameInput(rect);\r\n this._inputWindow.setEditWindow(this._editWindow);\r\n this._inputWindow.setHandler(\"ok\", () => this.handleInputOk());\r\n this.addWindow(this._inputWindow);\r\n }\r\n }\r\n editWindowRect() {\r\n const inputWindowHeight = VWindowHelper_1.VWindowHelper.calcWindowHeight(9, true);\r\n const padding = $gameSystem.windowPadding();\r\n const ww = 600;\r\n const wh = ImageManager.faceHeight + padding * 2;\r\n const wx = (Graphics.boxWidth - ww) / 2;\r\n const wy = (Graphics.boxHeight - (wh + inputWindowHeight + 8)) / 2;\r\n return new Rectangle(wx, wy, ww, wh);\r\n }\r\n inputWindowRect() {\r\n const wx = this._editWindow.x;\r\n const wy = this._editWindow.y + this._editWindow.height + 8;\r\n const ww = this._editWindow.width;\r\n const wh = VWindowHelper_1.VWindowHelper.calcWindowHeight(9, true);\r\n return new Rectangle(wx, wy, ww, wh);\r\n }\r\n handleInputOk() {\r\n // コアスクリプトが定義する name() が、 PIXI.Container.name と競合するので、any で回避する。\r\n const name = this._editWindow.name();\r\n this._model.setNickname(name);\r\n this.submit();\r\n }\r\n}\r\nexports.VNicknameDialog = VNicknameDialog;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/dialogs/VNicknameDialog.ts?"); /***/ }), /***/ "./ts/mr/view/dialogs/VPlayerDialog.ts": /*!*********************************************!*\ !*** ./ts/mr/view/dialogs/VPlayerDialog.ts ***! \*********************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VPlayerDialog = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ts/mr/system/MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst MRView_1 = __webpack_require__(/*! ../MRView */ \"./ts/mr/view/MRView.ts\");\r\nconst LUnitBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LUnitBehavior */ \"./ts/mr/lively/behaviors/LUnitBehavior.ts\");\r\nconst SMainMenuDialog_1 = __webpack_require__(/*! ts/mr/system/dialogs/SMainMenuDialog */ \"./ts/mr/system/dialogs/SMainMenuDialog.ts\");\r\nconst VDialog_1 = __webpack_require__(/*! ./VDialog */ \"./ts/mr/view/dialogs/VDialog.ts\");\r\nconst UMovement_1 = __webpack_require__(/*! ts/mr/utility/UMovement */ \"./ts/mr/utility/UMovement.ts\");\r\nconst LActivity_1 = __webpack_require__(/*! ts/mr/lively/activities/LActivity */ \"./ts/mr/lively/activities/LActivity.ts\");\r\nconst Helpers_1 = __webpack_require__(/*! ts/mr/system/Helpers */ \"./ts/mr/system/Helpers.ts\");\r\nconst LEquipmentUserBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LEquipmentUserBehavior */ \"./ts/mr/lively/behaviors/LEquipmentUserBehavior.ts\");\r\nconst LCommon_1 = __webpack_require__(/*! ts/mr/lively/LCommon */ \"./ts/mr/lively/LCommon.ts\");\r\nconst main_1 = __webpack_require__(/*! ts/main */ \"./ts/main.ts\");\r\nconst HMovement_1 = __webpack_require__(/*! ts/mr/lively/helpers/HMovement */ \"./ts/mr/lively/helpers/HMovement.ts\");\r\nconst PluginParameters_1 = __webpack_require__(/*! ts/mr/PluginParameters */ \"./ts/mr/PluginParameters.ts\");\r\nvar UpdateMode;\r\n(function (UpdateMode) {\r\n UpdateMode[UpdateMode[\"Normal\"] = 0] = \"Normal\";\r\n UpdateMode[UpdateMode[\"DirSelecting\"] = 1] = \"DirSelecting\";\r\n UpdateMode[UpdateMode[\"DiagonalMoving\"] = 2] = \"DiagonalMoving\";\r\n})(UpdateMode || (UpdateMode = {}));\r\nclass VPlayerDialog extends VDialog_1.VDialog {\r\n constructor(model) {\r\n super(model);\r\n this.MovingInputInterval = 5;\r\n this._updateMode = UpdateMode.Normal;\r\n this._waitCount = 0; // キーボード操作では 1 フレームでピッタリ斜め入力するのが難しいので、最後の入力から少し待てるようにする\r\n //private _dirSelecting: boolean = false;\r\n this._directionButtonPresseCount = 0;\r\n this._moveButtonPresseCount = 0;\r\n this._movingInputWaitCount = -1;\r\n this._crossDiagonalCount = 0; // \r\n this.model = model;\r\n }\r\n actionButton() {\r\n return \"ok\";\r\n }\r\n shortcutButton() {\r\n return \"pageup\";\r\n }\r\n dashButton() {\r\n return \"shift\";\r\n }\r\n directionButton() {\r\n return \"shift\";\r\n }\r\n isOffDirectionButton() {\r\n return this._directionButtonPresseCount < 0;\r\n }\r\n isDashButtonPressed() {\r\n return Input.isPressed(this.dashButton());\r\n }\r\n isMoveButtonPressed() {\r\n return this._moveButtonPresseCount > 0;\r\n }\r\n onStop() {\r\n this.endDirectionSelecting();\r\n }\r\n onUpdate() {\r\n this.updateInput();\r\n console.log(\"VPlayerDialog.onUpdate\", this._updateMode);\r\n const context = MRSystem_1.MRSystem.dialogContext;\r\n const entity = context.causeEntity();\r\n if (!entity)\r\n return;\r\n // 足踏み\r\n if (Input.isPressed(this.directionButton()) && Input.isPressed(this.actionButton())) {\r\n entity.getEntityBehavior(LUnitBehavior_1.LUnitBehavior)._fastforwarding = true;\r\n this.dialogContext().postActivity(LActivity_1.LActivity.make(entity).withConsumeAction(LCommon_1.LActionTokenConsumeType.MajorActed));\r\n this.model.submit();\r\n return;\r\n }\r\n // if (entity.immediatelyAfterAdjacentMoving) {\r\n // entity.immediatelyAfterAdjacentMoving = false;\r\n // const targetEntity = REGame.map.firstFeetEntity(entity);\r\n // if (targetEntity && !targetEntity.findEntityBehavior(LTrapBehavior)) {\r\n // const actions = targetEntity.queryReactions();\r\n // if (actions.length > 0) {\r\n // if (actions.includes(REBasics.actions.PickActionId) &&\r\n // !targetEntity._shopArticle.isSalling()) {\r\n // if (this._model.dashingEntry) {\r\n // context.commandContext().postMessage(tr2(\"%1 に乗った。\").format(UName.makeNameAsItem(targetEntity)));\r\n // }\r\n // else {\r\n // // 歩行移動時に足元に拾えるものがあれば取得試行\r\n // context.postActivity(LActivity.makePick(entity));\r\n // }\r\n // // コマンドチェーンを動かす\r\n // //context.postReopen();\r\n // }\r\n // else {\r\n // this.openSubDialog(new LFeetDialog(targetEntity), d => {\r\n // if (d.isSubmitted()) this._model.submit();\r\n // });\r\n // }\r\n // return;\r\n // }\r\n // }\r\n // }\r\n switch (this._updateMode) {\r\n case UpdateMode.Normal:\r\n this.updateNormal(context, entity);\r\n break;\r\n case UpdateMode.DirSelecting:\r\n this.updateDirSelecting(context, entity);\r\n break;\r\n case UpdateMode.DiagonalMoving:\r\n this.updateDiagonalMoving(context, entity);\r\n break;\r\n default:\r\n break;\r\n }\r\n }\r\n updateInput() {\r\n if (this._directionButtonPresseCount == 0) {\r\n if (Input.isTriggered(this.directionButton())) {\r\n // 向き関係は Dialog が開いた後、初めて押されたら、入力処理を受け付ける。\r\n // こうしておかないと、ダッシュでキー押しっぱなし → 離すで向き変更モードに入ってしまう。\r\n this._directionButtonPresseCount = 1;\r\n }\r\n }\r\n else {\r\n if (Input.isPressed(this.directionButton())) {\r\n this._directionButtonPresseCount++;\r\n }\r\n else if (this._directionButtonPresseCount < 0) {\r\n this._directionButtonPresseCount = 1;\r\n }\r\n else if (this._directionButtonPresseCount > 1) {\r\n this._directionButtonPresseCount = -1;\r\n }\r\n }\r\n if (this._moveButtonPresseCount == 0) {\r\n if (Input.isTriggered(\"left\") ||\r\n Input.isTriggered(\"right\") ||\r\n Input.isTriggered(\"up\") ||\r\n Input.isTriggered(\"down\")) {\r\n this._moveButtonPresseCount = 1;\r\n }\r\n if (!Input.isPressed(this.dashButton())) {\r\n this._moveButtonPresseCount = 1;\r\n }\r\n }\r\n else {\r\n if (Input.isTriggered(\"left\") ||\r\n Input.isTriggered(\"right\") ||\r\n Input.isTriggered(\"up\") ||\r\n Input.isTriggered(\"down\")) {\r\n this._moveButtonPresseCount++;\r\n }\r\n }\r\n if (this._movingInputWaitCount < 0) {\r\n if (Input.dir8 != 0) {\r\n this._movingInputWaitCount = this.MovingInputInterval;\r\n }\r\n }\r\n else if (Input.dir8 != 0) {\r\n this._movingInputWaitCount++;\r\n }\r\n else {\r\n this._movingInputWaitCount = 0;\r\n }\r\n // 斜め移動ボタン押しっぱなしの時は常時 DiagonalMoving にする。\r\n // 以前は updateNormal() の中で行っていたが、そこだと最初の onUpdate() で updateDiagonalMoving() に流れないため、移動がカクカクする。\r\n if (Input.isPressed(\"pagedown\")) {\r\n this._updateMode = UpdateMode.DiagonalMoving;\r\n }\r\n }\r\n updateNormal(context, entity) {\r\n var _a;\r\n let dir = Input.dir8;\r\n if (PluginParameters_1.paramTouchMoveEnabled && TouchInput.isTriggered()) {\r\n const x = $gameMap.canvasToMapX(TouchInput.x);\r\n const y = $gameMap.canvasToMapY(TouchInput.y);\r\n const activity = LActivity_1.LActivity.makeMoveToAdjacent(entity, HMovement_1.HMovement.offsetToDirectionSafety(x - entity.mx, y - entity.my))\r\n .withArgs({ type: LActivity_1.LDashType.PositionalDash, targetX: x, targetY: y })\r\n .withConsumeAction(LCommon_1.LActionTokenConsumeType.MinorActed);\r\n context.postActivity(activity);\r\n this.model.submit();\r\n return;\r\n }\r\n // 移動\r\n if (dir != 0 && this._movingInputWaitCount >= this.MovingInputInterval) {\r\n this.attemptMoveEntity(context, entity, dir);\r\n return;\r\n }\r\n // アクション\r\n else if (Input.isTriggered(this.actionButton())) {\r\n this.attemptFrontAction(context, entity);\r\n return;\r\n }\r\n else if (Input.isTriggered(this.shortcutButton())) {\r\n this.attemptShortcutAction(context, entity);\r\n return;\r\n }\r\n else if (this.isOffDirectionButton()) {\r\n this._updateMode = UpdateMode.DirSelecting;\r\n MRLively_1.MRLively.mapView.currentMap.increaseRevision();\r\n (_a = MRView_1.MRView.guideGrid) === null || _a === void 0 ? void 0 : _a.setVisible(true);\r\n context.postActivity(LActivity_1.LActivity.makeDirectionChange(entity, UMovement_1.UMovement.getNextAdjacentEntityDirCW(entity)));\r\n }\r\n else if (Input.isTriggered(\"menu\")) {\r\n SoundManager.playOk();\r\n this.openSubDialog(new SMainMenuDialog_1.SMainMenuDialog(entity), (d) => {\r\n if (d.isSubmitted) {\r\n //this.dialogContext().postActivity(LActivity.make(entity).withConsumeAction(LActionTokenType.Major));\r\n //this._model.submit();\r\n }\r\n return false;\r\n });\r\n return;\r\n }\r\n }\r\n endDirectionSelecting() {\r\n var _a;\r\n (0, Common_1.assert)(MRView_1.MRView.spriteSet2);\r\n const arrow = MRView_1.MRView.spriteSet2.directionArrow();\r\n (_a = MRView_1.MRView.guideGrid) === null || _a === void 0 ? void 0 : _a.setVisible(false);\r\n this._updateMode = UpdateMode.Normal;\r\n arrow.setDirection(0);\r\n }\r\n updateDirSelecting(context, entity) {\r\n (0, Common_1.assert)(MRView_1.MRView.entityVisualSet);\r\n (0, Common_1.assert)(MRView_1.MRView.spriteSet2);\r\n const visual = MRView_1.MRView.entityVisualSet.getEntityVisualByEntity(entity);\r\n const sprite = visual.getRmmzSprite();\r\n const arrow = MRView_1.MRView.spriteSet2.directionArrow();\r\n //arrow.setPosition(sprite.x, sprite.y);\r\n arrow.setDirection(entity.dir);\r\n // アクション\r\n if (Input.isTriggered(\"ok\")) {\r\n this.attemptFrontAction(context, entity);\r\n this.endDirectionSelecting();\r\n return;\r\n }\r\n else if (Input.isTriggered(this.shortcutButton())) {\r\n this.attemptShortcutAction(context, entity);\r\n return;\r\n }\r\n else if (this.isOffDirectionButton()) {\r\n this.endDirectionSelecting();\r\n }\r\n else if (Input.isTriggered(\"menu\")) {\r\n this.endDirectionSelecting();\r\n this.openSubDialog(new SMainMenuDialog_1.SMainMenuDialog(entity), (d) => {\r\n if (d.isSubmitted) {\r\n //this.dialogContext().postActivity(LActivity.make(entity).withConsumeAction(LActionTokenType.Major));\r\n //this._model.submit();\r\n }\r\n return false;\r\n });\r\n return;\r\n }\r\n else {\r\n if (this._waitCount > 0)\r\n this._waitCount--;\r\n if (this._waitCount <= 0 && Input.dir8 != 0 && Input.dir8 != entity.dir) {\r\n //context.closeDialog(false); // 行動消費無しで close\r\n context.postActivity(LActivity_1.LActivity.makeDirectionChange(entity, Input.dir8));\r\n MRLively_1.MRLively.mapView.currentMap.increaseRevision();\r\n this._waitCount = 10;\r\n }\r\n }\r\n }\r\n updateDiagonalMoving(context, entity) {\r\n var _a;\r\n (0, Common_1.assert)(MRView_1.MRView.entityVisualSet);\r\n (0, Common_1.assert)(MRView_1.MRView.spriteSet2);\r\n const visual = MRView_1.MRView.entityVisualSet.getEntityVisualByEntity(entity);\r\n const sprite = visual.getRmmzSprite();\r\n const arrow = MRView_1.MRView.spriteSet2.directionArrow();\r\n //arrow.setPosition(sprite.x, sprite.y);\r\n this._crossDiagonalCount++;\r\n if (this._crossDiagonalCount > 3) {\r\n (_a = MRView_1.MRView.spriteSet2) === null || _a === void 0 ? void 0 : _a.directionArrow().setCrossDiagonal(true);\r\n }\r\n if (Input.isPressed(\"pagedown\")) {\r\n const dir = Input.dir8;\r\n if (dir == 1 || dir == 3 || dir == 7 || dir == 9) {\r\n this.attemptMoveEntity(context, entity, dir);\r\n arrow.setCrossDiagonal(false);\r\n this._crossDiagonalCount = 0;\r\n }\r\n }\r\n else {\r\n arrow.setCrossDiagonal(false);\r\n this._crossDiagonalCount = 0;\r\n this._updateMode = UpdateMode.Normal;\r\n }\r\n }\r\n attemptMoveEntity(context, entity, dir) {\r\n // 向きは移動成否にかかわらず変える\r\n if (dir != 0) {\r\n // postActivity(LDirectionChangeActivity) で向きを変更する場合、コマンドチェーンを実行する必要がある。\r\n // 今はそこまで必要ではないので、直接変更してしまう。\r\n context.postActivity(LActivity_1.LActivity.makeDirectionChange(entity, dir));\r\n }\r\n if (this.isMoveButtonPressed() &&\r\n UMovement_1.UMovement.checkPassageToDir(entity, dir)) {\r\n const activity = LActivity_1.LActivity.makeMoveToAdjacent(entity, dir).withConsumeAction(LCommon_1.LActionTokenConsumeType.MinorActed);\r\n if (this.isDashButtonPressed()) {\r\n activity.withArgs({ type: LActivity_1.LDashType.StraightDash });\r\n }\r\n context.postActivity(activity);\r\n this.model.submit();\r\n // TODO: test\r\n //SceneManager._scene.executeAutosave();\r\n return true;\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n attemptFrontAction(context, entity) {\r\n // TODO: NPC 話かけ\r\n // 正面に、少なくとも敵対していない Entity がいれば、話しかけてみる\r\n const frontTarget = UMovement_1.UMovement.getFrontBlock(entity).getFirstEntity();\r\n if (frontTarget && !Helpers_1.Helpers.isHostile(entity, frontTarget)) {\r\n if (!!frontTarget.queryReactions().find(x => x.actionId == MRBasics_1.MRBasics.actions.talk)) {\r\n context.postActivity(LActivity_1.LActivity.makeTalk(entity).withConsumeAction(LCommon_1.LActionTokenConsumeType.MajorActed));\r\n this.model.submit();\r\n return true;\r\n }\r\n }\r\n // [通常攻撃] スキル発動\r\n context.postActivity(LActivity_1.LActivity.makePerformSkill(entity, main_1.MRData.system.skills.normalAttack).withConsumeAction(LCommon_1.LActionTokenConsumeType.MajorActed));\r\n this.model.submit();\r\n return true;\r\n }\r\n attemptShortcutAction(context, entity) {\r\n const equipmentUser = entity.getEntityBehavior(LEquipmentUserBehavior_1.LEquipmentUserBehavior);\r\n const item = equipmentUser.shortcutItem;\r\n if (item) {\r\n const activity1 = LActivity_1.LActivity.makePrimaryUse(entity, item).withConsumeAction();\r\n context.postActivity(activity1);\r\n this.model.submit();\r\n }\r\n return true;\r\n }\r\n}\r\nexports.VPlayerDialog = VPlayerDialog;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/dialogs/VPlayerDialog.ts?"); /***/ }), /***/ "./ts/mr/view/dialogs/VTransferMapDialog.ts": /*!**************************************************!*\ !*** ./ts/mr/view/dialogs/VTransferMapDialog.ts ***! \**************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VTransferMapDialog = void 0;\r\nconst VDialog_1 = __webpack_require__(/*! ./VDialog */ \"./ts/mr/view/dialogs/VDialog.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst RMMZHelper_1 = __webpack_require__(/*! ts/mr/rmmz/RMMZHelper */ \"./ts/mr/rmmz/RMMZHelper.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ts/mr/system/MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nclass VTransferMapDialog extends VDialog_1.VDialog {\r\n constructor(model) {\r\n super(model);\r\n this._model = model;\r\n console.trace();\r\n }\r\n onRmmzSetupMapCompleted() {\r\n const mapId = $gameMap.mapId();\r\n const transfaringInfo = this._model; //STransferMapDialog.current;\r\n transfaringInfo.performFloorTransfer(); // TODO: transferEntity でフラグ立った後すぐに performFloorTransfer() してるので、まとめていいかも\r\n // レコーディング開始\r\n MRLively_1.MRLively.recorder.startRecording();\r\n RMMZHelper_1.RMMZHelper.triggerOnStartEvent();\r\n // 新しいマップへの移動時は、遅くてもここで RMMZ 側の Map への更新をかけておく。\r\n // Game_Map.setup は抜けるとこの後する Game_Player の locate が行われるが、それまでにマップのサイズを確定させておく必要がある。\r\n // そうしないと、focusedEntity と Game_Player の位置同期がずれる。\r\n MRSystem_1.MRSystem.mapManager.attemptRefreshVisual();\r\n Common_1.Log.d(\"RMMZ map setup finished.\");\r\n this._model.submit();\r\n }\r\n}\r\nexports.VTransferMapDialog = VTransferMapDialog;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/dialogs/VTransferMapDialog.ts?"); /***/ }), /***/ "./ts/mr/view/dialogs/VWarehouseStoreDialog.ts": /*!*****************************************************!*\ !*** ./ts/mr/view/dialogs/VWarehouseStoreDialog.ts ***! \*****************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VWarehouseStoreDialog = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst VItemListDialogBase_1 = __webpack_require__(/*! ./VItemListDialogBase */ \"./ts/mr/view/dialogs/VItemListDialogBase.ts\");\r\nconst VWindowHelper_1 = __webpack_require__(/*! ../window/VWindowHelper */ \"./ts/mr/view/window/VWindowHelper.ts\");\r\nclass VWarehouseStoreDialog extends VItemListDialogBase_1.VItemListDialogBase {\r\n constructor(model) {\r\n super(model.inventory, model, VItemListDialogBase_1.VItemListMode.Use);\r\n this._model = model;\r\n this.itemListWindow.multipleSelectionEnabled = model.multipleSelectionEnabled;\r\n const inventory = model.warehouseInventory;\r\n const w = 200;\r\n const h = VWindowHelper_1.VWindowHelper.calcWindowHeight(2, false);\r\n this._capacityWindow = new Window_Help(new Rectangle(Graphics.boxWidth - w, Graphics.boxHeight - h, w, h));\r\n this._capacityWindow.setText((0, Common_1.tr2)(\"倉庫\") + `\\n${inventory.itemCount}/${inventory.capacity}`);\r\n this.addWindow(this._capacityWindow);\r\n }\r\n // override\r\n onMakeCommandList(window) {\r\n window.addSystemCommand((0, Common_1.tr2)(\"預ける\"), \"store\", () => this.handleStore());\r\n super.onMakeCommandList(window);\r\n }\r\n handleStore() {\r\n this._model.storeItems(this._model.selectedEntities());\r\n }\r\n}\r\nexports.VWarehouseStoreDialog = VWarehouseStoreDialog;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/dialogs/VWarehouseStoreDialog.ts?"); /***/ }), /***/ "./ts/mr/view/dialogs/VWarehouseWithdrawDialog.ts": /*!********************************************************!*\ !*** ./ts/mr/view/dialogs/VWarehouseWithdrawDialog.ts ***! \********************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VWarehouseWithdrawDialog = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst VItemListDialogBase_1 = __webpack_require__(/*! ./VItemListDialogBase */ \"./ts/mr/view/dialogs/VItemListDialogBase.ts\");\r\nconst VWindowHelper_1 = __webpack_require__(/*! ../window/VWindowHelper */ \"./ts/mr/view/window/VWindowHelper.ts\");\r\nclass VWarehouseWithdrawDialog extends VItemListDialogBase_1.VItemListDialogBase {\r\n constructor(model) {\r\n super(model.inventory, model, VItemListDialogBase_1.VItemListMode.Use);\r\n this._model = model;\r\n this.itemListWindow.multipleSelectionEnabled = model.multipleSelectionEnabled;\r\n const inventory = model.userInventory;\r\n const w = 200;\r\n const h = VWindowHelper_1.VWindowHelper.calcWindowHeight(2, false);\r\n this._capacityWindow = new Window_Help(new Rectangle(Graphics.boxWidth - w, Graphics.boxHeight - h, w, h));\r\n this._capacityWindow.setText((0, Common_1.tr2)(\"持ち物\") + `\\n${inventory.itemCount}/${inventory.capacity}`);\r\n this.addWindow(this._capacityWindow);\r\n }\r\n onMakeCommandList(window) {\r\n const items = this._model.selectedEntities();\r\n window.addSystemCommand((0, Common_1.tr)(\"引き出す\"), \"store\", () => this.handleWithdraw(items));\r\n super.onMakeCommandList(window);\r\n }\r\n handleWithdraw(items) {\r\n this._model.withdrawItems(items);\r\n }\r\n}\r\nexports.VWarehouseWithdrawDialog = VWarehouseWithdrawDialog;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/dialogs/VWarehouseWithdrawDialog.ts?"); /***/ }), /***/ "./ts/mr/view/fov/VSymmetricFovShadow.ts": /*!***********************************************!*\ !*** ./ts/mr/view/fov/VSymmetricFovShadow.ts ***! \***********************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VSymmetricFovShadow = void 0;\r\nconst DHelper_1 = __webpack_require__(/*! ts/mr/data/DHelper */ \"./ts/mr/data/DHelper.ts\");\r\nconst DSystem_1 = __webpack_require__(/*! ts/mr/data/DSystem */ \"./ts/mr/data/DSystem.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst Tilemap_1 = __webpack_require__(/*! ts/mr/rmmz/Tilemap */ \"./ts/mr/rmmz/Tilemap.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ts/mr/system/MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst SEditMapHelper_1 = __webpack_require__(/*! ts/mr/system/utils/SEditMapHelper */ \"./ts/mr/system/utils/SEditMapHelper.ts\");\r\nclass VSymmetricFovShadow {\r\n constructor(spriteSet) {\r\n var _a, _b;\r\n this._spriteSet = spriteSet;\r\n const width = (_a = $dataMap.width) !== null && _a !== void 0 ? _a : 1;\r\n const height = (_b = $dataMap.height) !== null && _b !== void 0 ? _b : 1;\r\n this._tilemapData = new Array(width * height * 4);\r\n this._fovAutoTileHelper = new SFovAutoTileHelper(this._tilemapData);\r\n this._nullAutoTileId = Tilemap.TILE_ID_A5 + 1;\r\n this._autoTileKind = DHelper_1.DHelpers.getAutotileKind(DHelper_1.DHelpers.TILE_ID_A2) + 15; // 床タイル15番目 (0スタート)\r\n this._tilemap = new Tilemap();\r\n this._tilemap.setRendererId(Tilemap_1.TilemapRendererId.Shadow);\r\n this._tilemap.tileWidth = $gameMap.tileWidth();\r\n this._tilemap.tileHeight = $gameMap.tileHeight();\r\n this._tilemap.setData(width, height, this._tilemapData);\r\n this._spriteSet.spritesetMap.addChild(this._tilemap);\r\n const bitmaps = [];\r\n const tilesetNames = [\"Outside_A1\", \"Outside_A2\", \"Outside_A3\", \"Outside_A4\", \"Outside_A5\", \"\", \"\", \"\", \"\"];\r\n for (const name of tilesetNames) {\r\n bitmaps.push(ImageManager.loadTileset(name));\r\n }\r\n this._tilemap.setBitmaps(bitmaps);\r\n // test\r\n // this._fovAutoTileHelper.putAutoTile(0, 0, 0, this._autoTileKind);\r\n // this._fovAutoTileHelper.putAutoTile(14, 22, 0, this._autoTileKind);\r\n // this._tilemap.refresh();\r\n }\r\n updateShadowTiles() {\r\n if (MRLively_1.MRLively.mapView.currentFloorId.floorInfo.fovSystem != DSystem_1.DFovSystem.SymmetricShadowcast)\r\n return;\r\n // デフォルトの Tilemap に同期する\r\n const defaultTilemap = this._spriteSet.spritesetMap._tilemap;\r\n this._tilemap.origin.x = defaultTilemap.origin.x;\r\n this._tilemap.origin.y = defaultTilemap.origin.y;\r\n const map = MRSystem_1.MRSystem.fovShadowMap;\r\n const w = map.width;\r\n const h = map.height;\r\n const z = 0;\r\n for (let y = 0; y < h; y++) {\r\n for (let x = 0; x < w; x++) {\r\n if (map.isVisible(x, y)) {\r\n this._fovAutoTileHelper.putAutoTile(x, y, z, this._nullAutoTileId);\r\n }\r\n else {\r\n this._fovAutoTileHelper.putAutoTile(x, y, z, this._autoTileKind);\r\n }\r\n }\r\n }\r\n //this._tilemap.refresh();\r\n }\r\n}\r\nexports.VSymmetricFovShadow = VSymmetricFovShadow;\r\nclass SFovAutoTileHelper extends SEditMapHelper_1.SEditMapHelper {\r\n constructor(tilemapData) {\r\n super();\r\n this.tilemapData = tilemapData;\r\n }\r\n get map() {\r\n return MRSystem_1.MRSystem.fovShadowMap;\r\n }\r\n onIsValidPos(x, y) {\r\n return this.map.isValid(x, y);\r\n }\r\n onGetTileId(x, y, z) {\r\n return this.tilemapData[(z * this.map.height + y) * this.map.width + x];\r\n }\r\n onSetTileId(x, y, z, tileId) {\r\n this.tilemapData[(z * this.map.height + y) * this.map.width + x] = tileId;\r\n }\r\n getSameKindTile(x, y, z, componentOrAutoTileKind) {\r\n if (!this.map.isValid(x, y))\r\n return true; // マップ範囲外は同種とすることで、境界外にも広がっているように見せる\r\n const tileId = this.onGetTileId(x, y, z);\r\n if (Tilemap.isAutotile(tileId) && Tilemap.getAutotileKind(tileId) == componentOrAutoTileKind) {\r\n return true;\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n}\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/fov/VSymmetricFovShadow.ts?"); /***/ }), /***/ "./ts/mr/view/rules/VSceneMapView.ts": /*!*******************************************!*\ !*** ./ts/mr/view/rules/VSceneMapView.ts ***! \*******************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VSceneMapView = void 0;\r\nclass VSceneMapView {\r\n constructor(scene) {\r\n this.scene = scene;\r\n }\r\n update() {\r\n }\r\n}\r\nexports.VSceneMapView = VSceneMapView;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/rules/VSceneMapView.ts?"); /***/ }), /***/ "./ts/mr/view/rules/default/VDefaultRule.ts": /*!**************************************************!*\ !*** ./ts/mr/view/rules/default/VDefaultRule.ts ***! \**************************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VLayoutDef = void 0;\r\nclass VLayoutDef {\r\n static get GoldFieldX() { return Graphics.boxWidth - 140; }\r\n static get MessageAreaX() {\r\n return VLayoutDef.FloorFieldWidth;\r\n }\r\n static get MessageAreaWidth() {\r\n return Graphics.boxWidth - VLayoutDef.MenuButtonWidth - VLayoutDef.FloorFieldWidth;\r\n }\r\n}\r\nexports.VLayoutDef = VLayoutDef;\r\n// フロア番号表示領域の幅\r\nVLayoutDef.FloorFieldWidth = 120;\r\nVLayoutDef.FloorFieldHeight = 40;\r\nVLayoutDef.FloorFieldX = 8;\r\nVLayoutDef.FloorFieldY = 10;\r\n// ゴールド表示領域\r\nVLayoutDef.GoldFieldWidth = 120;\r\nVLayoutDef.GoldFieldY = 42;\r\n// メニューボタンの幅\r\nVLayoutDef.MenuButtonWidth = 60;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/rules/default/VDefaultRule.ts?"); /***/ }), /***/ "./ts/mr/view/rules/default/VPartyInfoWindow.ts": /*!******************************************************!*\ !*** ./ts/mr/view/rules/default/VPartyInfoWindow.ts ***! \******************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VPartyInfoWindow = void 0;\r\nconst LInventoryBehavior_1 = __webpack_require__(/*! ts/mr/lively/entity/LInventoryBehavior */ \"./ts/mr/lively/entity/LInventoryBehavior.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst VFontHelper_1 = __webpack_require__(/*! ../../utils/VFontHelper */ \"./ts/mr/view/utils/VFontHelper.ts\");\r\nconst VDefaultRule_1 = __webpack_require__(/*! ./VDefaultRule */ \"./ts/mr/view/rules/default/VDefaultRule.ts\");\r\nclass VPartyInfoWindow extends Window_StatusBase {\r\n constructor(rect) {\r\n super(rect);\r\n this.frameVisible = false;\r\n this.openness = 255;\r\n this.backOpacity = 0;\r\n this.refresh();\r\n }\r\n itemWidth() {\r\n return Math.floor(this.innerWidth / 5);\r\n }\r\n itemRect(index) {\r\n const maxCols = this.maxCols();\r\n const itemHeight = this.itemHeight();\r\n const colSpacing = this.colSpacing();\r\n const rowSpacing = this.rowSpacing();\r\n const col = index % maxCols;\r\n const row = Math.floor(index / maxCols);\r\n const y = row * itemHeight + rowSpacing / 2 - this.scrollBaseY();\r\n const height = itemHeight - rowSpacing;\r\n const unitWidth = this.itemWidth();\r\n if (index == 0) {\r\n const itemWidth = unitWidth * 2;\r\n const x = col * itemWidth + colSpacing / 2 - this.scrollBaseX();\r\n const width = itemWidth - colSpacing;\r\n return new Rectangle(x, y, width, height);\r\n }\r\n else {\r\n const upperMargin = 32;\r\n const itemWidth = unitWidth;\r\n const x = col * itemWidth + colSpacing / 2 - this.scrollBaseX();\r\n const width = itemWidth - colSpacing;\r\n return new Rectangle(unitWidth + x, y + upperMargin, width, height - upperMargin);\r\n }\r\n }\r\n update() {\r\n super.update();\r\n // if ($gameTemp.isBattleRefreshRequested()) {\r\n // this.refresh();\r\n // }\r\n }\r\n refresh() {\r\n super.refresh();\r\n this.contents.clear();\r\n if (MRLively_1.MRLively.mapView.currentMap.floorId().isTacticsMap2) {\r\n this.drawFloorNumber(VDefaultRule_1.VLayoutDef.FloorFieldX, VDefaultRule_1.VLayoutDef.FloorFieldY, VDefaultRule_1.VLayoutDef.FloorFieldWidth, VDefaultRule_1.VLayoutDef.FloorFieldHeight, MRLively_1.MRLively.mapView.currentMap.floorId());\r\n }\r\n const entity = MRLively_1.MRLively.mapView.focusedEntity();\r\n if (!entity)\r\n return;\r\n const inventory = entity.findEntityBehavior(LInventoryBehavior_1.LInventoryBehavior);\r\n if (!inventory)\r\n return;\r\n this.drawGold(VDefaultRule_1.VLayoutDef.GoldFieldX, VDefaultRule_1.VLayoutDef.GoldFieldY, VDefaultRule_1.VLayoutDef.GoldFieldWidth, this.lineHeight(), inventory.gold());\r\n }\r\n drawFloorNumber(x, y, width, height, floorId) {\r\n const value = floorId.floorNumber;\r\n const unit = \"F\";\r\n this.changeTextColor(ColorManager.normalColor());\r\n this.contents.fontSize = $gameSystem.mainFontSize() + 16;\r\n const [w1, h1] = VFontHelper_1.VFontHelper.measureTextSize(this.contents, value.toString());\r\n this.drawText(value, x, y + height - h1, w1, \"left\");\r\n this.changeTextColor(ColorManager.systemColor());\r\n this.contents.fontSize = $gameSystem.mainFontSize();\r\n const [w2, h2] = VFontHelper_1.VFontHelper.measureTextSize(this.contents, unit);\r\n this.drawText(unit, x + w1 + 2, y + height - h2 - 2, w2, \"left\");\r\n }\r\n drawGold(x, y, width, height, gold) {\r\n this.drawCurrencyValue(gold, this.currencyUnit(), x, y, width);\r\n }\r\n currencyUnit() {\r\n return TextManager.currencyUnit;\r\n }\r\n}\r\nexports.VPartyInfoWindow = VPartyInfoWindow;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/rules/default/VPartyInfoWindow.ts?"); /***/ }), /***/ "./ts/mr/view/rules/default/VPartyStatusWindow.ts": /*!********************************************************!*\ !*** ./ts/mr/view/rules/default/VPartyStatusWindow.ts ***! \********************************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VPlayerStatusWindow2 = void 0;\r\nconst gaugeHeight = 6;\r\nclass VPlayerStatusWindow2 extends Window_BattleStatus {\r\n constructor() {\r\n super(new Rectangle(0, Graphics.boxHeight - 160, Graphics.boxWidth, 160)); // 画面全体を覆うとツクールデフォルトの MessageWindow などが見えなくなってしまう\r\n //this.frameVisible = true;\r\n this.frameVisible = false;\r\n this.openness = 255;\r\n this.backOpacity = 0;\r\n //this.visible = false;\r\n this.refresh();\r\n }\r\n itemWidth() {\r\n return Math.floor(this.innerWidth / 5);\r\n }\r\n itemRect(index) {\r\n const maxCols = this.maxCols();\r\n const itemHeight = this.itemHeight();\r\n const colSpacing = this.colSpacing();\r\n const rowSpacing = this.rowSpacing();\r\n const col = index % maxCols;\r\n const row = Math.floor(index / maxCols);\r\n const y = row * itemHeight + rowSpacing / 2 - this.scrollBaseY();\r\n const height = itemHeight - rowSpacing;\r\n const unitWidth = this.itemWidth();\r\n if (index == 0) {\r\n const itemWidth = unitWidth * 2;\r\n const x = col * itemWidth + colSpacing / 2 - this.scrollBaseX();\r\n const width = itemWidth - colSpacing;\r\n return new Rectangle(x, y, width, height);\r\n }\r\n else {\r\n const upperMargin = 32;\r\n const itemWidth = unitWidth;\r\n const x = col * itemWidth + colSpacing / 2 - this.scrollBaseX();\r\n const width = itemWidth - colSpacing;\r\n return new Rectangle(unitWidth + x, y + upperMargin, width, height - upperMargin);\r\n }\r\n }\r\n refresh() {\r\n super.refresh();\r\n // this.contents.clear();\r\n // this.placeBasicGauges($gameParty.members()[0], 0, 0);\r\n }\r\n // update() {\r\n // // this.refresh();\r\n // // if (MRLively.mapView.currentMap.floorId().isTacticsMap2 || MRLively.mapView.currentMap.floorId().isSafetyMap2) {\r\n // // this.visible = true;\r\n // // }\r\n // // else {\r\n // // this.visible = false;\r\n // // }\r\n // // this._levelLabel.update();\r\n // // this._floorLabel.update();\r\n // }\r\n nameX(rect) {\r\n return rect.x + rect.width - 132;\r\n // 128: Sprite_Gauge.prototype.bitmapWidth\r\n }\r\n ;\r\n basicGaugesX(rect) {\r\n return rect.x + rect.width - 132;\r\n // 128: Sprite_Gauge.prototype.bitmapWidth\r\n }\r\n drawItemImage(index) {\r\n if (index != 0)\r\n return;\r\n const actor = this.actor(index);\r\n const rect = this.itemRect(index);\r\n const width = ImageManager.faceWidth;\r\n const height = ImageManager.faceHeight;\r\n this.changePaintOpacity(actor.isBattleMember());\r\n this.drawActorFace(actor, rect.x + 1, rect.y + rect.height - height - 1, width, height);\r\n this.changePaintOpacity(true);\r\n }\r\n ;\r\n // override drawItem(index: number) {\r\n // this.drawItemImage(index);\r\n // this.drawItemStatus(index);\r\n // };\r\n drawItemStatus(index) {\r\n const actor = this.actor(index);\r\n const rect = this.itemRectWithPadding(index);\r\n const nameX = this.nameX(rect);\r\n const nameY = this.nameY(rect);\r\n const stateIconX = this.stateIconX(rect);\r\n const stateIconY = this.stateIconY(rect);\r\n const basicGaugesX = this.basicGaugesX(rect);\r\n const basicGaugesY = this.basicGaugesY(rect);\r\n this.placeTimeGauge(actor, nameX, nameY);\r\n this.placeActorName(actor, nameX, nameY);\r\n this.placeStateIcon(actor, stateIconX, stateIconY);\r\n this.placeBasicGauges(actor, basicGaugesX, basicGaugesY);\r\n if (index == 0) {\r\n const itemRect = this.itemRect(index);\r\n const containerWidth = ImageManager.faceWidth / 2;\r\n const containerHeight = 36;\r\n const padding = 2;\r\n const y = itemRect.y + itemRect.height - containerHeight - padding;\r\n const gaugeWidth = containerWidth - padding * 2;\r\n this.contents.fillRect(itemRect.x, y, ImageManager.faceWidth + 1, containerHeight, this.faceOverrayGaugeBackground());\r\n this.drawSmallGauge(itemRect.x + padding + 2, y - 2, gaugeWidth, TextManager.levelA, \"15\", 0.2, this.expGugeColor());\r\n this.drawSmallGauge(itemRect.x + containerWidth + padding + 1, y - 2, gaugeWidth, \"FP\", \"100\", 0.9, this.fpGaugeColor());\r\n }\r\n }\r\n drawSmallGauge(x, y, width, label, value, expRatio, gaugeColor) {\r\n const t1 = label;\r\n const t2 = value;\r\n const w1 = this.textWidth(t1);\r\n // Text\r\n this.setupLabelFont(this.contents);\r\n this.drawText(t1, x, y, w1, \"left\");\r\n this.setupValueFont(this.contents);\r\n this.drawText(t2, x + 2 + w1, y, width - w1, \"left\");\r\n // Gauge\r\n this.contents.fillRect(x, y + this.gaugeY(), width, gaugeHeight, ColorManager.gaugeBackColor());\r\n this.contents.fillRect(x + 1, y + this.gaugeY() + 1, width * expRatio - 2, gaugeHeight - 2, gaugeColor);\r\n }\r\n gaugeY() {\r\n return 30;\r\n }\r\n // Sprite_Gauge.prototype.setupLabelFont\r\n setupLabelFont(bitmap) {\r\n bitmap.fontFace = this.labelFontFace();\r\n bitmap.fontSize = this.labelFontSize();\r\n bitmap.textColor = this.labelColor();\r\n bitmap.outlineColor = this.labelOutlineColor();\r\n bitmap.outlineWidth = this.labelOutlineWidth();\r\n }\r\n // Sprite_Gauge.prototype.labelFontFace\r\n labelFontFace() {\r\n return $gameSystem.mainFontFace();\r\n }\r\n // Sprite_Gauge.prototype.labelFontSize\r\n labelFontSize() {\r\n return $gameSystem.mainFontSize() - 6;\r\n }\r\n // Sprite_Gauge.prototype.labelColor\r\n labelColor() {\r\n return ColorManager.systemColor();\r\n }\r\n ;\r\n // Sprite_Gauge.prototype.labelOutlineColor\r\n labelOutlineColor() {\r\n return ColorManager.outlineColor();\r\n }\r\n ;\r\n // Sprite_Gauge.prototype.labelOutlineWidth\r\n labelOutlineWidth() {\r\n return 3;\r\n }\r\n // Sprite_Gauge.prototype.setupValueFont\r\n setupValueFont(bitmap) {\r\n bitmap.fontFace = this.valueFontFace();\r\n bitmap.fontSize = this.valueFontSize();\r\n bitmap.textColor = this.valueColor();\r\n bitmap.outlineColor = this.valueOutlineColor();\r\n bitmap.outlineWidth = this.valueOutlineWidth();\r\n }\r\n // Sprite_Gauge.prototype.valueFontFace\r\n valueFontFace() {\r\n return $gameSystem.numberFontFace();\r\n }\r\n // Sprite_Gauge.prototype.valueFontSize\r\n valueFontSize() {\r\n return $gameSystem.mainFontSize() - 6;\r\n }\r\n // Sprite_Gauge.prototype.valueColor\r\n valueColor() {\r\n return ColorManager.normalColor();\r\n }\r\n // Sprite_Gauge.prototype.valueOutlineColor\r\n valueOutlineColor() {\r\n return \"rgba(0, 0, 0, 1)\";\r\n }\r\n // Sprite_Gauge.prototype.valueOutlineWidth\r\n valueOutlineWidth() {\r\n return 2;\r\n }\r\n faceOverrayGaugeBackground() {\r\n return \"rgba(0, 0, 0, 0.3)\";\r\n }\r\n expGugeColor() {\r\n return ColorManager.hpGaugeColor2();\r\n }\r\n fpGaugeColor() {\r\n return ColorManager.textColor(23);\r\n }\r\n}\r\nexports.VPlayerStatusWindow2 = VPlayerStatusWindow2;\r\nVPlayerStatusWindow2.HeaderHeight = 70;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/rules/default/VPartyStatusWindow.ts?"); /***/ }), /***/ "./ts/mr/view/rules/default/VSceneMapView_Default.ts": /*!***********************************************************!*\ !*** ./ts/mr/view/rules/default/VSceneMapView_Default.ts ***! \***********************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VSceneMapView_Default = void 0;\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst VMessageLogWindow_1 = __webpack_require__(/*! ../../window/windows/VMessageLogWindow */ \"./ts/mr/view/window/windows/VMessageLogWindow.ts\");\r\nconst VWindowHelper_1 = __webpack_require__(/*! ../../window/VWindowHelper */ \"./ts/mr/view/window/VWindowHelper.ts\");\r\nconst VSceneMapView_1 = __webpack_require__(/*! ../VSceneMapView */ \"./ts/mr/view/rules/VSceneMapView.ts\");\r\nconst VDefaultRule_1 = __webpack_require__(/*! ./VDefaultRule */ \"./ts/mr/view/rules/default/VDefaultRule.ts\");\r\nconst VPartyInfoWindow_1 = __webpack_require__(/*! ./VPartyInfoWindow */ \"./ts/mr/view/rules/default/VPartyInfoWindow.ts\");\r\nconst VPartyStatusWindow_1 = __webpack_require__(/*! ./VPartyStatusWindow */ \"./ts/mr/view/rules/default/VPartyStatusWindow.ts\");\r\nclass VSceneMapView_Default extends VSceneMapView_1.VSceneMapView {\r\n constructor(scene) {\r\n super(scene);\r\n this._partyInfoWindow = new VPartyInfoWindow_1.VPartyInfoWindow(this.partyInfoWindowRect());\r\n this._partyInfoWindow._isWindow = false;\r\n this.scene._windowLayer.addChildAt(this._partyInfoWindow, 0);\r\n this._logWindow = new VMessageLogWindow_1.VMessageLogWindow(MRLively_1.MRLively.messageHistory, this.messageWindowRect());\r\n this._logWindow.textPaddingX = VDefaultRule_1.VLayoutDef.MessageAreaX;\r\n this._logWindow.lineWidth = VDefaultRule_1.VLayoutDef.MessageAreaWidth;\r\n this._logWindow.setBackgroundType(1);\r\n this._logWindow._isWindow = false;\r\n this.scene._windowLayer.addChildAt(this._logWindow, 0);\r\n this._partyStatusWindow = new VPartyStatusWindow_1.VPlayerStatusWindow2();\r\n this.scene._windowLayer.addChildAt(this._partyStatusWindow, 0);\r\n this._partyStatusWindow.show();\r\n }\r\n update() {\r\n }\r\n partyInfoWindowRect() {\r\n // 画面全体を覆うとツクールデフォルトの MessageWindow などが見えなくなってしまう\r\n return new Rectangle(0, 0, Graphics.boxWidth, 160);\r\n }\r\n messageWindowRect() {\r\n const ww = Graphics.boxWidth;\r\n const wh = VWindowHelper_1.VWindowHelper.calcWindowHeight(2, false) + 8;\r\n const wx = 0;\r\n const wy = 0;\r\n return new Rectangle(wx, wy, ww, wh);\r\n }\r\n}\r\nexports.VSceneMapView_Default = VSceneMapView_Default;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/rules/default/VSceneMapView_Default.ts?"); /***/ }), /***/ "./ts/mr/view/sequels/AttackSequel.ts": /*!********************************************!*\ !*** ./ts/mr/view/sequels/AttackSequel.ts ***! \********************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VAttackSequel = void 0;\r\nconst Vector2_1 = __webpack_require__(/*! ts/mr/math/Vector2 */ \"./ts/mr/math/Vector2.ts\");\r\nconst Helpers_1 = __webpack_require__(/*! ts/mr/system/Helpers */ \"./ts/mr/system/Helpers.ts\");\r\nconst VSequel_1 = __webpack_require__(/*! ../VSequel */ \"./ts/mr/view/VSequel.ts\");\r\nclass VAttackSequel extends VSequel_1.VSequel {\r\n onUpdate(visual, context) {\r\n const entity = visual.entity();\r\n const offset = Helpers_1.Helpers.dirToTileOffset(entity.dir);\r\n visual.setPosition(Vector2_1.Vector2.add(context.startPosition(), Vector2_1.Vector2.mul(offset, 0.4)));\r\n if (context.frameCount() > 10) {\r\n visual.resetPosition();\r\n context.end();\r\n }\r\n }\r\n}\r\nexports.VAttackSequel = VAttackSequel;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/sequels/AttackSequel.ts?"); /***/ }), /***/ "./ts/mr/view/sequels/VAsleepSequel.ts": /*!*********************************************!*\ !*** ./ts/mr/view/sequels/VAsleepSequel.ts ***! \*********************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VAsleepSequel = void 0;\r\nconst VSequel_1 = __webpack_require__(/*! ../VSequel */ \"./ts/mr/view/VSequel.ts\");\r\nclass VAsleepSequel extends VSequel_1.VSequel {\r\n onUpdate(visual, context) {\r\n const event = visual.rmmzEvent();\r\n if (event) {\r\n event.setPattern(1);\r\n }\r\n }\r\n}\r\nexports.VAsleepSequel = VAsleepSequel;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/sequels/VAsleepSequel.ts?"); /***/ }), /***/ "./ts/mr/view/sequels/VBlowMoveSequel.ts": /*!***********************************************!*\ !*** ./ts/mr/view/sequels/VBlowMoveSequel.ts ***! \***********************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VBlowMoveSequel = void 0;\r\nconst Vector2_1 = __webpack_require__(/*! ts/mr/math/Vector2 */ \"./ts/mr/math/Vector2.ts\");\r\nconst VSequel_1 = __webpack_require__(/*! ../VSequel */ \"./ts/mr/view/VSequel.ts\");\r\n/**\r\n * 吹き飛ばされ移動。\r\n * 矢を撃つのとは別なので注意。\r\n */\r\nclass VBlowMoveSequel extends VSequel_1.VSequel {\r\n onUpdate(visual, context) {\r\n // 移動は直線距離ではなく X Y 個別に計算する。\r\n // 斜め移動時に速度が上がる問題であるが、複数の Entity が同時に移動するとき、\r\n // 軸平行・斜め問わず完了までの時間が合うようにしないと、一方の動きが遅延してしまう。\r\n const entity = visual.entity();\r\n const moveSpeed = 6; // RMMZ の基本移動速度\r\n const speed = Math.pow(2, moveSpeed) / 256;\r\n //const frameCount = 1.0 / speed; // 水平1Tile移動に何Frame必要?\r\n const velocity = Vector2_1.Vector2.mul(Vector2_1.Vector2.sub(new Vector2_1.Vector2(entity.mx, entity.my), context.startPosition()), speed);\r\n const d = Vector2_1.Vector2.sub(new Vector2_1.Vector2(entity.mx, entity.my), visual.position());\r\n if ((Math.abs(d.x) <= speed && Math.abs(d.y) <= speed) ||\r\n context.frameCount() > 30) { // 速度に何か異常があっても、時間経過で必ず終了させる\r\n visual.resetPosition();\r\n context.end();\r\n }\r\n else {\r\n //const v = Vector2.mul(Vector2.sign(d), speed);\r\n visual.setPosition(Vector2_1.Vector2.add(visual.position(), velocity));\r\n }\r\n }\r\n}\r\nexports.VBlowMoveSequel = VBlowMoveSequel;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/sequels/VBlowMoveSequel.ts?"); /***/ }), /***/ "./ts/mr/view/sequels/VCollapseSequel.ts": /*!***********************************************!*\ !*** ./ts/mr/view/sequels/VCollapseSequel.ts ***! \***********************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; eval("\r\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}));\r\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n});\r\nvar __importStar = (this && this.__importStar) || function (mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VCollapseSequel = void 0;\r\nconst PIXI = __importStar(__webpack_require__(/*! pixi.js */ \"./node_modules/pixi.js/lib/pixi.es.js\"));\r\nconst VSequel_1 = __webpack_require__(/*! ../VSequel */ \"./ts/mr/view/VSequel.ts\");\r\nclass VCollapseSequel extends VSequel_1.VSequel {\r\n onUpdate(visual, context) {\r\n const effectDuration = 24 - context.frameCount();\r\n const event = visual.rmmzEvent();\r\n if (event) {\r\n visual.setOpacity((effectDuration / 24.0));\r\n event.setBlendMode(PIXI.BLEND_MODES.ADD);\r\n }\r\n if (effectDuration <= 0) {\r\n context.end();\r\n }\r\n }\r\n}\r\nexports.VCollapseSequel = VCollapseSequel;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/sequels/VCollapseSequel.ts?"); /***/ }), /***/ "./ts/mr/view/sequels/VCommonStoppedSequel.ts": /*!****************************************************!*\ !*** ./ts/mr/view/sequels/VCommonStoppedSequel.ts ***! \****************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VCommonStoppedSequel = void 0;\r\nconst VSequel_1 = __webpack_require__(/*! ../VSequel */ \"./ts/mr/view/VSequel.ts\");\r\nclass VCommonStoppedSequel extends VSequel_1.VSequel {\r\n onUpdate(visual, context) {\r\n const event = visual.rmmzEvent();\r\n if (event) {\r\n event.setPattern(1);\r\n }\r\n }\r\n}\r\nexports.VCommonStoppedSequel = VCommonStoppedSequel;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/sequels/VCommonStoppedSequel.ts?"); /***/ }), /***/ "./ts/mr/view/sequels/VCrackSequel.ts": /*!********************************************!*\ !*** ./ts/mr/view/sequels/VCrackSequel.ts ***! \********************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VCrackSequel = void 0;\r\nconst SSoundManager_1 = __webpack_require__(/*! ts/mr/system/SSoundManager */ \"./ts/mr/system/SSoundManager.ts\");\r\nconst VSequel_1 = __webpack_require__(/*! ../VSequel */ \"./ts/mr/view/VSequel.ts\");\r\nclass VCrackSequel extends VSequel_1.VSequel {\r\n onUpdate(visual, context) {\r\n SSoundManager_1.SSoundManager.playSe({ name: \"Break\", volume: 80, pitch: 110, pan: 0 });\r\n context.end();\r\n }\r\n}\r\nexports.VCrackSequel = VCrackSequel;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/sequels/VCrackSequel.ts?"); /***/ }), /***/ "./ts/mr/view/sequels/VDownSequel.ts": /*!*******************************************!*\ !*** ./ts/mr/view/sequels/VDownSequel.ts ***! \*******************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VDownSequel = void 0;\r\nconst VSequel_1 = __webpack_require__(/*! ../VSequel */ \"./ts/mr/view/VSequel.ts\");\r\nclass VDownSequel extends VSequel_1.VSequel {\r\n onUpdate(visual, context) {\r\n const prefab = visual.entity().data.prefab();\r\n const event = visual.rmmzEvent();\r\n const image = prefab.downImage;\r\n if (image) {\r\n if (image.characterName !== undefined && image.characterIndex !== undefined) {\r\n event.setImage(image.characterName, image.characterIndex);\r\n }\r\n if (image.direction !== undefined)\r\n event.setDirection(image.direction);\r\n if (image.pattern !== undefined)\r\n event.setPattern(image.pattern);\r\n if (image.directionFix !== undefined)\r\n event.setDirectionFix(image.directionFix);\r\n if (image.stepAnime !== undefined)\r\n event.setStepAnime(image.stepAnime);\r\n if (image.walkAnime !== undefined)\r\n event.setWalkAnime(image.walkAnime);\r\n }\r\n }\r\n}\r\nexports.VDownSequel = VDownSequel;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/sequels/VDownSequel.ts?"); /***/ }), /***/ "./ts/mr/view/sequels/VDropSequel.ts": /*!*******************************************!*\ !*** ./ts/mr/view/sequels/VDropSequel.ts ***! \*******************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VDropSequel = void 0;\r\nconst Vector2_1 = __webpack_require__(/*! ts/mr/math/Vector2 */ \"./ts/mr/math/Vector2.ts\");\r\nconst Helpers_1 = __webpack_require__(/*! ts/mr/system/Helpers */ \"./ts/mr/system/Helpers.ts\");\r\nconst VSequel_1 = __webpack_require__(/*! ../VSequel */ \"./ts/mr/view/VSequel.ts\");\r\nconst DROP_TIME = 16;\r\nconst DROP_RADIUS = 0.2;\r\nclass VDropSequel extends VSequel_1.VSequel {\r\n onUpdate(visual, context) {\r\n var _a;\r\n const frameCount = context.frameCount();\r\n const entity = visual.entity();\r\n const sequel = context.sequel();\r\n const velocityX = (sequel.targetX() - context.startPosition().x) / DROP_TIME;\r\n const velocityY = (sequel.targetY() - context.startPosition().y) / DROP_TIME;\r\n const ratio = frameCount / DROP_TIME;\r\n let ox = 0;\r\n let oy = 0;\r\n const dir = (_a = context.sequel().args()) === null || _a === void 0 ? void 0 : _a.movingDir;\r\n if (dir) {\r\n const offset = Helpers_1.Helpers.dirToTileOffset(dir);\r\n ox = offset.x * ((1.0 - ratio) * DROP_RADIUS);\r\n oy = offset.y * ((1.0 - ratio) * DROP_RADIUS);\r\n }\r\n const pos = context.startPosition();\r\n //pos.y -= context.frameCount();\r\n const jy = Math.sin(Math.PI * ratio);\r\n visual.setPosition(new Vector2_1.Vector2((velocityX * frameCount) + (ox + pos.x), (velocityY * frameCount) + (oy + pos.y - jy)));\r\n if (frameCount > DROP_TIME) {\r\n visual.resetPosition();\r\n context.end();\r\n }\r\n }\r\n}\r\nexports.VDropSequel = VDropSequel;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/sequels/VDropSequel.ts?"); /***/ }), /***/ "./ts/mr/view/sequels/VEarthquake2Sequel.ts": /*!**************************************************!*\ !*** ./ts/mr/view/sequels/VEarthquake2Sequel.ts ***! \**************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VEarthquake2Sequel = void 0;\r\nconst VSequel_1 = __webpack_require__(/*! ../VSequel */ \"./ts/mr/view/VSequel.ts\");\r\nclass VEarthquake2Sequel extends VSequel_1.VSequel {\r\n onUpdate(visual, context) {\r\n const frameCount = context.frameCount();\r\n if (frameCount == 0) {\r\n $gameScreen.startShake(9, 9, 120);\r\n }\r\n if (frameCount > 120) {\r\n visual.resetPosition();\r\n context.end();\r\n }\r\n }\r\n}\r\nexports.VEarthquake2Sequel = VEarthquake2Sequel;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/sequels/VEarthquake2Sequel.ts?"); /***/ }), /***/ "./ts/mr/view/sequels/VEscapeSequel.ts": /*!*********************************************!*\ !*** ./ts/mr/view/sequels/VEscapeSequel.ts ***! \*********************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VEscapeSequel = void 0;\r\nconst VSequel_1 = __webpack_require__(/*! ../VSequel */ \"./ts/mr/view/VSequel.ts\");\r\nclass VEscapeSequel extends VSequel_1.VSequel {\r\n onUpdate(visual, context) {\r\n const frameCount = context.frameCount();\r\n const entity = visual.entity();\r\n const event = visual.rmmzEvent();\r\n if (frameCount == 0) {\r\n context.startAnimation(117);\r\n }\r\n if (frameCount == 60) {\r\n event.setTransparent(true);\r\n }\r\n if (frameCount > 120) {\r\n visual.resetPosition();\r\n context.end();\r\n }\r\n }\r\n}\r\nexports.VEscapeSequel = VEscapeSequel;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/sequels/VEscapeSequel.ts?"); /***/ }), /***/ "./ts/mr/view/sequels/VExplosionSequel.ts": /*!************************************************!*\ !*** ./ts/mr/view/sequels/VExplosionSequel.ts ***! \************************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VExplosionSequel = void 0;\r\nconst EFFECT_FRAME_COUNT = 100;\r\nclass VExplosionSequel {\r\n onUpdate(visual, context) {\r\n const effectDuration = EFFECT_FRAME_COUNT - context.frameCount();\r\n if (context.frameCount() == 0) {\r\n context.startAnimation(109);\r\n }\r\n const event = visual.rmmzEvent();\r\n if (event) {\r\n visual.setOpacity(effectDuration / EFFECT_FRAME_COUNT);\r\n //event.setBlendMode(PIXI.BLEND_MODES.ADD);\r\n }\r\n if (effectDuration <= 0) {\r\n context.end();\r\n }\r\n }\r\n}\r\nexports.VExplosionSequel = VExplosionSequel;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/sequels/VExplosionSequel.ts?"); /***/ }), /***/ "./ts/mr/view/sequels/VIdleSequel.ts": /*!*******************************************!*\ !*** ./ts/mr/view/sequels/VIdleSequel.ts ***! \*******************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VIdleSequel = void 0;\r\nconst VSequel_1 = __webpack_require__(/*! ../VSequel */ \"./ts/mr/view/VSequel.ts\");\r\nconst VSequelHelper_1 = __webpack_require__(/*! ./VSequelHelper */ \"./ts/mr/view/sequels/VSequelHelper.ts\");\r\nclass VIdleSequel extends VSequel_1.VSequel {\r\n //private _animationCount: number = 0;\r\n onUpdate(visual, context) {\r\n VSequelHelper_1.VSequelHelper.updateStepAnimPattern(visual);\r\n visual.resetPosition();\r\n }\r\n}\r\nexports.VIdleSequel = VIdleSequel;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/sequels/VIdleSequel.ts?"); /***/ }), /***/ "./ts/mr/view/sequels/VJumpSequel.ts": /*!*******************************************!*\ !*** ./ts/mr/view/sequels/VJumpSequel.ts ***! \*******************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VJumpSequel = void 0;\r\nconst VSequel_1 = __webpack_require__(/*! ../VSequel */ \"./ts/mr/view/VSequel.ts\");\r\n/*\r\n論理位置とMotion再生の順序について\r\n----------\r\n今の移動処理もそうなっているが、論理位置→Motion再生の方がよいだろう。\r\nというか、移動に関してはそうしないと、Motion再生時にどこからどこへ向かえばよいのかがわからない。\r\nMotionの引数として移動後の位置を渡す必要が出てきて、ちょっと余計な情報が増える。\r\n\r\nコアスクリプトもそうだし、他のアクション系のゲームの実装もそうだが、\r\n論理座標へ向かって物理座標を移動させる方が自然な気がする。\r\nなにより余計な引数が増えない分、Motion再生後の矛盾が発生しづらくなる。\r\n\r\n\r\n\r\n\r\n*/\r\nclass VJumpSequel extends VSequel_1.VSequel {\r\n constructor() {\r\n super(...arguments);\r\n this._moveSpeed = 4;\r\n this._jumpPeak = 0;\r\n this._jumpCount = 0;\r\n this._realX = 0;\r\n this._realY = 0;\r\n }\r\n onUpdate(visual, context) {\r\n const frameCount = context.frameCount();\r\n const event = visual.rmmzEvent();\r\n const entity = visual.entity();\r\n //context.unlockCamera();\r\n if (frameCount == 0) {\r\n this.jump(entity.mx - context.startPosition().x, entity.my - context.startPosition().y);\r\n this._realX = context.startPosition().x;\r\n this._realY = context.startPosition().y;\r\n }\r\n this._jumpCount--;\r\n this._realX = (this._realX * this._jumpCount + entity.mx) / (this._jumpCount + 1.0);\r\n this._realY = (this._realY * this._jumpCount + entity.my) / (this._jumpCount + 1.0);\r\n visual.setX(this._realX);\r\n visual.setY(this._realY - this.jumpHeight() / 40);\r\n if (this._jumpCount <= 0) {\r\n // end したフレームは、最後に $gamePlayer へ座標を同期する。\r\n // resetPosition() によってワープ先に Visual を移動させておかないと、\r\n // ワープで昇っていったすごく上にいる状態の Visual に $gamePlayer が同期してしまう。\r\n visual.resetPosition();\r\n context.end();\r\n }\r\n }\r\n jump(xPlus, yPlus) {\r\n // if (Math.abs(xPlus) > Math.abs(yPlus)) {\r\n // if (xPlus !== 0) {\r\n // this.setDirection(xPlus < 0 ? 4 : 6);\r\n // }\r\n // } else {\r\n // if (yPlus !== 0) {\r\n // this.setDirection(yPlus < 0 ? 8 : 2);\r\n // }\r\n // }\r\n // this._x += xPlus;\r\n // this._y += yPlus;\r\n const distance = Math.round(Math.sqrt(xPlus * xPlus + yPlus * yPlus));\r\n this._jumpPeak = 10 + distance - this._moveSpeed;\r\n this._jumpCount = this._jumpPeak * 2;\r\n // this.resetStopCount();\r\n // this.straighten();\r\n }\r\n ;\r\n jumpHeight() {\r\n return ((this._jumpPeak * this._jumpPeak - Math.pow(Math.abs(this._jumpCount - this._jumpPeak), 2)) / 2);\r\n }\r\n ;\r\n}\r\nexports.VJumpSequel = VJumpSequel;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/sequels/VJumpSequel.ts?"); /***/ }), /***/ "./ts/mr/view/sequels/VMoveSequel.ts": /*!*******************************************!*\ !*** ./ts/mr/view/sequels/VMoveSequel.ts ***! \*******************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.REVisualSequel_Move = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst Vector2_1 = __webpack_require__(/*! ts/mr/math/Vector2 */ \"./ts/mr/math/Vector2.ts\");\r\nconst VAnimation_1 = __webpack_require__(/*! ../animation/VAnimation */ \"./ts/mr/view/animation/VAnimation.ts\");\r\nconst VSequel_1 = __webpack_require__(/*! ../VSequel */ \"./ts/mr/view/VSequel.ts\");\r\nconst VSequelHelper_1 = __webpack_require__(/*! ./VSequelHelper */ \"./ts/mr/view/sequels/VSequelHelper.ts\");\r\n/**\r\n * 倍速移動など、1ターンに複数ブロックを移動する場合、その数だけ Sequel が生成される。\r\n * そうしないと、途中で立ち寄ったブロックを補完するようなアニメーションが表現できない。\r\n */\r\nclass REVisualSequel_Move extends VSequel_1.VSequel {\r\n onUpdate(visual, context) {\r\n if (context.isFastForward()) {\r\n // ダッシュ中は座標をそろえて即終了\r\n context.unlockCamera();\r\n visual.resetPosition();\r\n context.end();\r\n }\r\n else {\r\n const sequel = context.sequel();\r\n if (sequel.isFluidSequence()) {\r\n const frameCount = context.frameCount();\r\n if (frameCount == 0) {\r\n const moveSpeed = 4; // RMMZ の基本移動速度\r\n const speed = Math.pow(2, moveSpeed) / 256;\r\n const totalFrameCount = 1.0 / speed; // 水平1Tile移動に何Frame必要?\r\n const oneTileFrameCount = totalFrameCount / (sequel.relatedSequels().length + 1);\r\n this._curveX = new VAnimation_1.VKeyFrameAnimationCurve();\r\n this._curveY = new VAnimation_1.VKeyFrameAnimationCurve();\r\n const first = sequel;\r\n this._curveX.addFrame(0, first.startX());\r\n this._curveY.addFrame(0, first.startY());\r\n this._curveX.addFrame(oneTileFrameCount, first.targetX());\r\n this._curveY.addFrame(oneTileFrameCount, first.targetY());\r\n for (const [index, motion] of sequel.relatedSequels().entries()) {\r\n this._curveX.addFrame(oneTileFrameCount * (index + 2), motion.targetX());\r\n this._curveY.addFrame(oneTileFrameCount * (index + 2), motion.targetY());\r\n }\r\n }\r\n (0, Common_1.assert)(this._curveX);\r\n (0, Common_1.assert)(this._curveY);\r\n const x = this._curveX.evaluate(frameCount);\r\n const y = this._curveY.evaluate(frameCount);\r\n visual.setPosition(new Vector2_1.Vector2(x, y));\r\n if (frameCount >= this._curveX.lastFrameTime()) {\r\n context.end();\r\n }\r\n }\r\n else {\r\n // $gamePlayer と常時同期\r\n context.unlockCamera();\r\n const targetX = sequel.targetX(); //entity.x\r\n const targetY = sequel.targetY(); //entity.y\r\n VSequelHelper_1.VSequelHelper.updateStepAnimPattern(visual);\r\n // 移動は直線距離ではなく X Y 個別に計算する。\r\n // 斜め移動時に速度が上がる問題であるが、複数の Entity が同時に移動するとき、\r\n // 軸平行・斜め問わず完了までの時間が合うようにしないと、一方の動きが遅延してしまう。\r\n const entity = visual.entity();\r\n const moveSpeed = 4; // RMMZ の基本移動速度\r\n //const moveSpeed = 6; // \r\n const speed = Math.pow(2, moveSpeed) / 256;\r\n //const frameCount = 1.0 / speed; // 水平1Tile移動に何Frame必要?\r\n const velocity = Vector2_1.Vector2.mul(Vector2_1.Vector2.sub(new Vector2_1.Vector2(targetX, targetY), context.startPosition()), speed);\r\n const diff = Vector2_1.Vector2.sub(new Vector2_1.Vector2(targetX, targetY), visual.position());\r\n if ((Math.abs(diff.x) <= speed && Math.abs(diff.y) <= speed) ||\r\n context.frameCount() > 30) { // 速度に何か異常があっても、時間経過で必ず終了させる\r\n visual.setPosition(new Vector2_1.Vector2(targetX, targetY));\r\n context.end();\r\n }\r\n else {\r\n visual.setPosition(Vector2_1.Vector2.add(visual.position(), velocity));\r\n }\r\n }\r\n }\r\n }\r\n}\r\nexports.REVisualSequel_Move = REVisualSequel_Move;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/sequels/VMoveSequel.ts?"); /***/ }), /***/ "./ts/mr/view/sequels/VSequelHelper.ts": /*!*********************************************!*\ !*** ./ts/mr/view/sequels/VSequelHelper.ts ***! \*********************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VSequelHelper = void 0;\r\nclass VSequelHelper {\r\n /*\r\n public static updateCharacterImage(visual: REVisual_Entity): void {\r\n const entity = visual.entity();\r\n const event = visual.rmmzEvent();\r\n const visibility = visual.visibility();\r\n\r\n const charactorImage = visual.getCharacterImage(entity, visibility);\r\n if (charactorImage) {\r\n event.setImage(charactorImage.characterName, charactorImage.characterIndex);\r\n\r\n if (event.isDirectionFixed() != charactorImage.directionFix) {\r\n event.setDirection(charactorImage.direction);\r\n event.setDirectionFix(charactorImage.directionFix);\r\n }\r\n\r\n event.setStepAnime(charactorImage.stepAnime);\r\n event.setWalkAnime(charactorImage.walkAnime);\r\n if (!charactorImage.stepAnime && !charactorImage.walkAnime) {\r\n event.setPattern(charactorImage.pattern);\r\n }\r\n }\r\n\r\n if (entity._needVisualRefresh) {\r\n entity._needVisualRefresh = false;\r\n event.refresh();\r\n }\r\n\r\n event.setDirection(entity.dir);\r\n }\r\n */\r\n static updateStepAnimPattern(visual) {\r\n const event = visual.rmmzEvent();\r\n if (event && event.hasStepAnime()) {\r\n // Game_CharacterBase.updateAnimationCount\r\n event._animationCount++;\r\n // Game_CharacterBase.updateAnimation\r\n if (event._animationCount >= event.animationWait()) {\r\n // Game_CharacterBase.updatePattern\r\n event._pattern = (event._pattern + 1) % event.maxPattern();\r\n event._animationCount = 0;\r\n }\r\n }\r\n }\r\n}\r\nexports.VSequelHelper = VSequelHelper;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/sequels/VSequelHelper.ts?"); /***/ }), /***/ "./ts/mr/view/sequels/VStumbleSequel.ts": /*!**********************************************!*\ !*** ./ts/mr/view/sequels/VStumbleSequel.ts ***! \**********************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VStumbleSequel = void 0;\r\nconst VAnimation_1 = __webpack_require__(/*! ../animation/VAnimation */ \"./ts/mr/view/animation/VAnimation.ts\");\r\nconst VSequel_1 = __webpack_require__(/*! ../VSequel */ \"./ts/mr/view/VSequel.ts\");\r\nclass VStumbleSequel extends VSequel_1.VSequel {\r\n constructor() {\r\n super();\r\n this._curve = new VAnimation_1.VKeyFrameAnimationCurve();\r\n this._curve.addFrame(0, 0);\r\n this._curve.addFrame(2, Math.PI / 6);\r\n this._curve.addFrame(20, 0);\r\n }\r\n onUpdate(visual, context) {\r\n const frameCount = context.frameCount();\r\n const sprite = visual.rmmzSprite();\r\n if (!sprite)\r\n return;\r\n if (frameCount == 0) {\r\n AudioManager.playSe({ name: \"Damage3\", volume: 90, pitch: 100, pan: 0 });\r\n }\r\n sprite.rotation = this._curve.evaluate(frameCount) * VStumbleSequel.RotationSignTable[visual.entity().dir];\r\n if (frameCount > 60) {\r\n sprite.rotation = 0;\r\n visual.resetPosition();\r\n context.end();\r\n }\r\n }\r\n}\r\nexports.VStumbleSequel = VStumbleSequel;\r\nVStumbleSequel.RotationSignTable = [1, -1, 1, 1, -1, 1, 1, -1, -1, 1];\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/sequels/VStumbleSequel.ts?"); /***/ }), /***/ "./ts/mr/view/sequels/VUseItemSequel.ts": /*!**********************************************!*\ !*** ./ts/mr/view/sequels/VUseItemSequel.ts ***! \**********************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VUseItemSequel = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst LEntity_1 = __webpack_require__(/*! ts/mr/lively/entity/LEntity */ \"./ts/mr/lively/entity/LEntity.ts\");\r\nconst MRView_1 = __webpack_require__(/*! ../MRView */ \"./ts/mr/view/MRView.ts\");\r\nconst VSequel_1 = __webpack_require__(/*! ../VSequel */ \"./ts/mr/view/VSequel.ts\");\r\nconst VHelper_1 = __webpack_require__(/*! ../VHelper */ \"./ts/mr/view/VHelper.ts\");\r\nconst DROP_TIME = 30;\r\nconst DROP_RADIUS = 1.6;\r\nconst DROP_OFFSET_Y = -0.7;\r\nconst PLAYER_ROTATION_TIME = 16;\r\nconst PLAYER_JUMP_TIME = 12;\r\nconst PLAYER_JUMP_HEIGHT = 0.6;\r\nconst EPILOGUE_TIME = 8;\r\nconst DIRS4 = [\r\n 6, 8, 4, 2,\r\n];\r\nclass VUseItemSequel extends VSequel_1.VSequel {\r\n constructor() {\r\n super(...arguments);\r\n this._baseX = 0;\r\n this._baseY = 0;\r\n }\r\n onUpdate(visual, context) {\r\n const frameCount = context.frameCount();\r\n const self = visual.entity();\r\n const event = visual.rmmzEvent();\r\n const item = context.sequel().args();\r\n (0, Common_1.assert)(item instanceof LEntity_1.LEntity);\r\n (0, Common_1.assert)(MRView_1.MRView.spriteset);\r\n if (frameCount == 0) {\r\n const bitmap = ImageManager.loadSystem(\"IconSet\");\r\n this._itemSprite = new Sprite(bitmap);\r\n this._itemSprite.anchor.set(0.5, 0.5);\r\n MRView_1.MRView.spriteset._tilemap.addChild(this._itemSprite);\r\n this._baseX = event._realX;\r\n this._baseY = event._realY;\r\n const itemData = item.data;\r\n VHelper_1.VHelper.setIconFrame(this._itemSprite, itemData.display.iconIndex);\r\n this._itemVisual = this.findItemVisual(item);\r\n if (this._itemVisual) {\r\n this._itemVisual.visualTransparent = true;\r\n }\r\n }\r\n const ratio = frameCount / DROP_TIME;\r\n const jy = Math.sin(Math.PI * ratio) * DROP_RADIUS;\r\n if (this._itemSprite) {\r\n this._itemSprite.x = VHelper_1.VHelper.toScreenX(this._baseX);\r\n this._itemSprite.y = VHelper_1.VHelper.toScreenY(this._baseY + DROP_OFFSET_Y - jy);\r\n }\r\n /*\r\n if (frameCount == 0) {\r\n context.startAnimation(117);\r\n }\r\n\r\n if (frameCount == 60) {\r\n event.setTransparent(true);\r\n }\r\n */\r\n // アイコン投げ\r\n const rotationBeginTime = DROP_TIME - PLAYER_JUMP_TIME - PLAYER_ROTATION_TIME;\r\n if (frameCount >= rotationBeginTime) {\r\n const speed = 0.05;\r\n const r = Math.floor(((frameCount - rotationBeginTime) * speed) * 4) % 4;\r\n event.setDirection(DIRS4[r]);\r\n }\r\n // ジャンプ\r\n const jumpBeginTime = DROP_TIME - PLAYER_JUMP_TIME;\r\n if (frameCount >= jumpBeginTime) {\r\n const ratio = (frameCount - jumpBeginTime) / PLAYER_JUMP_TIME;\r\n const jy = Math.sin(Math.PI * ratio) * PLAYER_JUMP_HEIGHT;\r\n visual.setY(context.startPosition().y - jy);\r\n event.setDirection(2);\r\n }\r\n // 最後のちょい待ち\r\n if (frameCount > DROP_TIME) {\r\n visual.setY(context.startPosition().y);\r\n event.setDirection(2);\r\n if (this._itemSprite) {\r\n this._itemSprite.visible = false;\r\n }\r\n }\r\n if (frameCount >= DROP_TIME + EPILOGUE_TIME) {\r\n if (this._itemSprite) {\r\n MRView_1.MRView.spriteset._tilemap.removeChild(this._itemSprite);\r\n }\r\n if (this._itemVisual) {\r\n this._itemVisual.visualTransparent = false;\r\n }\r\n visual.resetPosition();\r\n context.end();\r\n }\r\n }\r\n findItemVisual(item) {\r\n if (!MRView_1.MRView.entityVisualSet)\r\n return undefined;\r\n const visual = MRView_1.MRView.entityVisualSet.findEntityVisualByEntity(item);\r\n return visual;\r\n }\r\n}\r\nexports.VUseItemSequel = VUseItemSequel;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/sequels/VUseItemSequel.ts?"); /***/ }), /***/ "./ts/mr/view/sequels/VWarpSequel.ts": /*!*******************************************!*\ !*** ./ts/mr/view/sequels/VWarpSequel.ts ***! \*******************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VWarpSequel = void 0;\r\nconst Vector2_1 = __webpack_require__(/*! ts/mr/math/Vector2 */ \"./ts/mr/math/Vector2.ts\");\r\nconst VSequel_1 = __webpack_require__(/*! ../VSequel */ \"./ts/mr/view/VSequel.ts\");\r\n/*\r\n論理位置とMotion再生の順序について\r\n----------\r\n今の移動処理もそうなっているが、論理位置→Motion再生の方がよいだろう。\r\nというか、移動に関してはそうしないと、Motion再生時にどこからどこへ向かえばよいのかがわからない。\r\nMotionの引数として移動後の位置を渡す必要が出てきて、ちょっと余計な情報が増える。\r\n\r\nコアスクリプトもそうだし、他のアクション系のゲームの実装もそうだが、\r\n論理座標へ向かって物理座標を移動させる方が自然な気がする。\r\nなにより余計な引数が増えない分、Motion再生後の矛盾が発生しづらくなる。\r\n\r\n\r\n\r\n\r\n*/\r\nclass VWarpSequel extends VSequel_1.VSequel {\r\n onUpdate(visual, context) {\r\n const frameCount = context.frameCount();\r\n //context.unlockCamera();\r\n visual.setPosition(new Vector2_1.Vector2(context.startPosition().x, context.startPosition().y - (frameCount * 0.5)));\r\n if (frameCount > 60) {\r\n // end したフレームは、最後に $gamePlayer へ座標を同期する。\r\n // resetPosition() によってワープ先に Visual を移動させておかないと、\r\n // ワープで昇っていったすごく上にいる状態の Visual に $gamePlayer が同期してしまう。\r\n visual.resetPosition();\r\n context.end();\r\n }\r\n }\r\n}\r\nexports.VWarpSequel = VWarpSequel;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/sequels/VWarpSequel.ts?"); /***/ }), /***/ "./ts/mr/view/sprites/VFloatingAnimationSprite.ts": /*!********************************************************!*\ !*** ./ts/mr/view/sprites/VFloatingAnimationSprite.ts ***! \********************************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VFloatingAnimationTargetSprite = void 0;\r\nclass VFloatingAnimationTargetSprite extends Sprite {\r\n get isPlaying() {\r\n return this.animationSprite ? this.animationSprite.isPlaying() : false;\r\n }\r\n}\r\nexports.VFloatingAnimationTargetSprite = VFloatingAnimationTargetSprite;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/sprites/VFloatingAnimationSprite.ts?"); /***/ }), /***/ "./ts/mr/view/sprites/VIconSprite.ts": /*!*******************************************!*\ !*** ./ts/mr/view/sprites/VIconSprite.ts ***! \*******************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VIconSprite = void 0;\r\nconst VHelper_1 = __webpack_require__(/*! ../VHelper */ \"./ts/mr/view/VHelper.ts\");\r\nclass VIconSprite extends Sprite {\r\n constructor(bitmap) {\r\n super(bitmap !== null && bitmap !== void 0 ? bitmap : ImageManager.loadSystem(\"IconSet\"));\r\n this.setIcon(0);\r\n }\r\n setIcon(iconIndex) {\r\n VHelper_1.VHelper.setIconFrame(this, iconIndex);\r\n if (iconIndex == 0)\r\n this.visible = false;\r\n else\r\n this.visible = true;\r\n }\r\n}\r\nexports.VIconSprite = VIconSprite;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/sprites/VIconSprite.ts?"); /***/ }), /***/ "./ts/mr/view/ui/VUIElement.ts": /*!*************************************!*\ !*** ./ts/mr/view/ui/VUIElement.ts ***! \*************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VUIContainer = exports.VUITextElement = exports.VUIElement = exports.VLayout = void 0;\r\nclass VLayout {\r\n static makeGridRect(gx, gy, gw, gh) {\r\n return new Rectangle(this.calcGridX(gx), this.calcGridY(gy), this.calcGridWidth(gw), this.calcGridHeight(gh));\r\n }\r\n static calcGridWidth(xs) {\r\n return xs * (Graphics.boxWidth / 12);\r\n }\r\n static calcGridHeight(xs) {\r\n return xs * (Graphics.boxHeight / 12);\r\n }\r\n static calcGridX(xs) {\r\n return xs * (Graphics.boxWidth / 12);\r\n }\r\n static calcGridY(xs) {\r\n return xs * (Graphics.boxHeight / 12);\r\n }\r\n static clamp(value, min, max) {\r\n return Math.min(Math.max(value, min), max);\r\n }\r\n ;\r\n static makeOffset(rect, x_, y_) {\r\n return { x: rect.x + x_, y: rect.y + y_, width: rect.width, height: rect.height };\r\n }\r\n /** 指定した矩形が収まるようにこの矩形を拡張します。 */\r\n static inflateIncludes(self, rect) {\r\n if (self.width == 0 && self.height == 0) {\r\n return rect;\r\n }\r\n else {\r\n const result = { x: 0, y: 0, width: 0, height: 0 };\r\n let dx1 = self.x;\r\n let dy1 = self.y;\r\n let dx2 = self.x + self.width;\r\n let dy2 = self.y + self.height;\r\n const sx1 = rect.x;\r\n const sy1 = rect.y;\r\n const sx2 = rect.x + rect.width;\r\n const sy2 = rect.y + rect.height;\r\n dx1 = Math.min(dx1, sx1);\r\n dy1 = Math.min(dy1, sy1);\r\n dx2 = Math.max(dx2, sx2);\r\n dy2 = Math.max(dy2, sy2);\r\n result.x = dx1;\r\n result.y = dy1;\r\n result.width = dx2 - dx1;\r\n result.height = dy2 - dy1;\r\n return result;\r\n }\r\n }\r\n}\r\nexports.VLayout = VLayout;\r\nclass VUIElement {\r\n constructor() {\r\n this._margin = {\r\n top: 0,\r\n right: 0,\r\n bottom: 0,\r\n left: 0,\r\n };\r\n this._padding = {\r\n top: 0,\r\n right: 0,\r\n bottom: 0,\r\n left: 0,\r\n };\r\n this._desiredWidth = 0;\r\n this._desiredHeight = 0;\r\n this._actualRect = {\r\n x: 0,\r\n y: 0,\r\n width: 0,\r\n height: 0,\r\n };\r\n // this._actualWidth = 0;\r\n // this._actualHeight = 0;\r\n this.row = 0;\r\n this.col = 0;\r\n this.rowSpan = 1;\r\n this.colSpan = 1;\r\n this.x = 0;\r\n this.y = 0;\r\n this.opacity = 1.0;\r\n }\r\n calcContentOuter() {\r\n return {\r\n top: this._margin.top + this._padding.top,\r\n right: this._margin.right + this._padding.right,\r\n bottom: this._margin.bottom + this._padding.bottom,\r\n left: this._margin.left + this._padding.left,\r\n };\r\n }\r\n margin(top, right, bottom, left) {\r\n if (right !== undefined && bottom !== undefined && left !== undefined) {\r\n this._margin.top = top;\r\n this._margin.right = right;\r\n this._margin.bottom = bottom;\r\n this._margin.left = left;\r\n }\r\n else if (right !== undefined) {\r\n this._margin.top = this._margin.bottom = top;\r\n this._margin.right = this._margin.left = right;\r\n }\r\n else {\r\n this._margin.top = this._margin.bottom = this._margin.right = this._margin.left = top;\r\n }\r\n return this;\r\n }\r\n getMargin() {\r\n return this._margin;\r\n }\r\n padding() {\r\n return this._padding;\r\n }\r\n setGrid(col, row, colSpan = 1, rowSpan = 1) {\r\n this.row = row;\r\n this.col = col;\r\n this.rowSpan = rowSpan;\r\n this.colSpan = colSpan;\r\n return this;\r\n }\r\n setOpacity(value) {\r\n this.opacity = value;\r\n return this;\r\n }\r\n addTo(container) {\r\n container.addChild(this);\r\n return this;\r\n }\r\n setDesiredSize(width, height) {\r\n this._desiredWidth = width;\r\n this._desiredHeight = height;\r\n }\r\n desiredWidth() {\r\n return this._desiredWidth;\r\n }\r\n desiredHeight() {\r\n return this._desiredHeight;\r\n }\r\n measure(context) {\r\n }\r\n arrange(finalArea) {\r\n const rect = {\r\n x: finalArea.x + this._margin.left,\r\n y: finalArea.y + this._margin.top,\r\n width: finalArea.width - this._margin.left - this._margin.right,\r\n height: finalArea.height - this._margin.top - this._margin.bottom\r\n };\r\n return this.arrangeOverride(rect);\r\n }\r\n arrangeOverride(finalArea) {\r\n this.setActualRect(finalArea);\r\n return finalArea;\r\n }\r\n setActualRect(rect) {\r\n this._actualRect = Object.assign({}, rect);\r\n this._actualRect.x += this.x;\r\n this._actualRect.y += this.y;\r\n }\r\n actualRect() {\r\n return this._actualRect;\r\n }\r\n // public actualWidth(): number {\r\n // return this._actualWidth;\r\n // }\r\n // public actualHeight(): number {\r\n // return this._actualHeight;\r\n // }\r\n draw(context) {\r\n }\r\n}\r\nexports.VUIElement = VUIElement;\r\nclass VUITextElement extends VUIElement {\r\n constructor(text) {\r\n super();\r\n this._text = text;\r\n }\r\n setText(value) {\r\n this._text = value;\r\n return this;\r\n }\r\n setColor(value) {\r\n this._color = value;\r\n return this;\r\n }\r\n measure(context) {\r\n const size = context.textSizeEx(this._text);\r\n const outer = this.calcContentOuter();\r\n this.setDesiredSize(size.width + outer.left + outer.right, size.height + outer.top + outer.bottom);\r\n }\r\n draw(context) {\r\n if (this.opacity > 0.0) {\r\n const rect = this.actualRect();\r\n if (this._color) {\r\n context.changeTextColor(this._color);\r\n }\r\n else {\r\n context.resetTextColor();\r\n }\r\n context.contents.paintOpacity = this.opacity * 255;\r\n context.drawText(this._text, rect.x, rect.y, rect.width, \"left\");\r\n //context.drawTextEx(this._text, rect.x, rect.y, rect.width);\r\n }\r\n }\r\n}\r\nexports.VUITextElement = VUITextElement;\r\nclass VUIContainer extends VUIElement {\r\n constructor() {\r\n super();\r\n this._children = [];\r\n }\r\n addChild(element) {\r\n this._children.push(element);\r\n return element;\r\n }\r\n children() {\r\n return this._children;\r\n }\r\n draw(context) {\r\n for (const child of this._children) {\r\n child.draw(context);\r\n }\r\n }\r\n}\r\nexports.VUIContainer = VUIContainer;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/ui/VUIElement.ts?"); /***/ }), /***/ "./ts/mr/view/ui/VUIGridLayout.ts": /*!****************************************!*\ !*** ./ts/mr/view/ui/VUIGridLayout.ts ***! \****************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VUIGridLayout = void 0;\r\nconst VUIElement_1 = __webpack_require__(/*! ./VUIElement */ \"./ts/mr/view/ui/VUIElement.ts\");\r\nvar VUIGridLayoutLengthType;\r\n(function (VUIGridLayoutLengthType) {\r\n /** 子要素のサイズに合わせる */\r\n VUIGridLayoutLengthType[VUIGridLayoutLengthType[\"Auto\"] = 0] = \"Auto\";\r\n /** サイズを直接指定する */\r\n VUIGridLayoutLengthType[VUIGridLayoutLengthType[\"Direct\"] = 1] = \"Direct\";\r\n /** レイアウト後、残りの領域を使う */\r\n VUIGridLayoutLengthType[VUIGridLayoutLengthType[\"Ratio\"] = 2] = \"Ratio\";\r\n})(VUIGridLayoutLengthType || (VUIGridLayoutLengthType = {}));\r\n;\r\nvar VUIGridLayoutRule;\r\n(function (VUIGridLayoutRule) {\r\n VUIGridLayoutRule[VUIGridLayoutRule[\"Box\"] = 0] = \"Box\";\r\n VUIGridLayoutRule[VUIGridLayoutRule[\"VerticalFlow\"] = 1] = \"VerticalFlow\";\r\n // 子要素を上詰めで配置する。\r\n // Row は Auto となり、Height 0 の Item は表示されない。\r\n VUIGridLayoutRule[VUIGridLayoutRule[\"HorizontalFlow\"] = 2] = \"HorizontalFlow\";\r\n})(VUIGridLayoutRule || (VUIGridLayoutRule = {}));\r\n;\r\nclass VUIGridLayoutDefinitionData {\r\n constructor(type) {\r\n // input data\r\n this.type = VUIGridLayoutLengthType.Auto;\r\n this.size = 0;\r\n this.minSize = 0;\r\n this.maxSize = 100000;\r\n // working data\r\n this.desiredSize = 0;\r\n this.actualOffset = 0; // 最終オフセット\r\n this.actualSize = 0; // 最終サイズ\r\n this.type = type;\r\n }\r\n getAvailableDesiredSize() {\r\n if (this.type == VUIGridLayoutLengthType.Auto) {\r\n return this.desiredSize;\r\n }\r\n else if (this.type == VUIGridLayoutLengthType.Direct) {\r\n return VUIElement_1.VLayout.clamp(this.size, this.minSize, this.maxSize);\r\n }\r\n else {\r\n return this.desiredSize;\r\n }\r\n }\r\n GetRatioSize() {\r\n return (this.size == 0) ? 1 : this.size;\r\n }\r\n AdjustActualSize() {\r\n this.actualSize = VUIElement_1.VLayout.clamp(this.actualSize, this.minSize, this.maxSize);\r\n }\r\n}\r\n;\r\nclass VUIGridLayout extends VUIElement_1.VUIContainer {\r\n constructor() {\r\n super();\r\n this.m_rule = VUIGridLayoutRule.VerticalFlow;\r\n this.m_rowDefinitions = [];\r\n this.m_columnDefinitions = [];\r\n }\r\n GetDefaultRowLengthType() {\r\n if (this.m_rule == VUIGridLayoutRule.VerticalFlow)\r\n return VUIGridLayoutLengthType.Auto;\r\n else\r\n return VUIGridLayoutLengthType.Ratio;\r\n }\r\n GetDefaultColumnLengthType() {\r\n if (this.m_rule == VUIGridLayoutRule.HorizontalFlow)\r\n return VUIGridLayoutLengthType.Auto;\r\n else\r\n return VUIGridLayoutLengthType.Ratio;\r\n }\r\n PrepareDefinitions(rowCount, colCount) {\r\n while (this.m_rowDefinitions.length < rowCount) {\r\n this.m_rowDefinitions.push(new VUIGridLayoutDefinitionData(this.GetDefaultRowLengthType()));\r\n }\r\n while (this.m_columnDefinitions.length < colCount) {\r\n this.m_columnDefinitions.push(new VUIGridLayoutDefinitionData(this.GetDefaultColumnLengthType()));\r\n }\r\n }\r\n measure(context) {\r\n // Measure layout and grid size.\r\n const children = this.children();\r\n let rowCount = 0;\r\n let colCount = 0;\r\n for (let i = 0; i < children.length; i++) {\r\n const child = children[i];\r\n child.measure(context);\r\n rowCount = Math.max(rowCount, child.row + 1);\r\n colCount = Math.max(colCount, child.col + 1);\r\n }\r\n // Allocate definitions\r\n this.PrepareDefinitions(rowCount, colCount);\r\n // Measure desired sizes per cells.\r\n for (let i = 0; i < children.length; i++) {\r\n const child = children[i];\r\n const row = this.m_rowDefinitions[child.row];\r\n const col = this.m_columnDefinitions[child.col];\r\n //const childDesiredSize = child->desiredSize;\r\n if (row.type == VUIGridLayoutLengthType.Auto || row.type == VUIGridLayoutLengthType.Ratio) {\r\n row.desiredSize = Math.max(row.desiredSize, child.desiredHeight());\r\n }\r\n if (col.type == VUIGridLayoutLengthType.Auto || col.type == VUIGridLayoutLengthType.Ratio) {\r\n col.desiredSize = Math.max(col.desiredSize, child.desiredWidth());\r\n }\r\n }\r\n // Aggregate DesiredSize of each cell to find DesiredSize of entire Grid\r\n let cellsDesiredWidth = 0;\r\n let cellsDesiredHeight = 0;\r\n for (const row of this.m_rowDefinitions) {\r\n cellsDesiredHeight += row.getAvailableDesiredSize();\r\n }\r\n for (const col of this.m_columnDefinitions) {\r\n cellsDesiredWidth += col.getAvailableDesiredSize();\r\n }\r\n this.setDesiredSize(cellsDesiredWidth, cellsDesiredHeight);\r\n }\r\n arrangeOverride(finalArea) {\r\n //const auto finalWidth = finalArea.Size();\r\n //const dtx::Thickness padding(0);\r\n // const margin = this.getMargin(); // TODO: ほんとは arrange の外側でやるべき\r\n // finalArea.x += margin.left;\r\n // finalArea.y += margin.top;\r\n // finalArea.width -= margin.left + margin.right;\r\n // finalArea.height -= margin.top + margin.bottom;\r\n const padding = this.padding();\r\n const childrenBoundSize = { width: finalArea.width - (padding.left + padding.right), height: finalArea.height - (padding.top + padding.bottom) };\r\n // Fix final size of 'Auto' and 'Direct', and count 'Ratio'\r\n const totalActualSize = { width: 0, height: 0 };\r\n let ratioRowCount = 0;\r\n let ratioColCount = 0;\r\n for (const row of this.m_rowDefinitions) {\r\n if (row.type == VUIGridLayoutLengthType.Auto || row.type == VUIGridLayoutLengthType.Direct) {\r\n row.actualSize = row.getAvailableDesiredSize();\r\n totalActualSize.height += row.actualSize;\r\n }\r\n else {\r\n ratioRowCount += row.GetRatioSize();\r\n }\r\n }\r\n for (const col of this.m_columnDefinitions) {\r\n if (col.type == VUIGridLayoutLengthType.Auto || col.type == VUIGridLayoutLengthType.Direct) {\r\n col.actualSize = col.getAvailableDesiredSize();\r\n totalActualSize.width += col.actualSize;\r\n }\r\n else {\r\n ratioColCount += col.GetRatioSize();\r\n }\r\n }\r\n // \"1*\" 分のセルの領域を計算する\r\n const ratioUnit = {\r\n width: (ratioColCount != 0) ? (childrenBoundSize.width - totalActualSize.width) / ratioColCount : 0,\r\n height: (ratioRowCount != 0) ? (childrenBoundSize.height - totalActualSize.height) / ratioRowCount : 0\r\n };\r\n ratioUnit.width = Math.max(0, ratioUnit.width);\r\n ratioUnit.height = Math.max(0, ratioUnit.height);\r\n // \"*\" 指定である Row/Column の最終サイズを確定させ、\r\n // 全セルのオフセット (位置) も確定させる\r\n const totalOffset = { x: 0, y: 0 };\r\n for (const row of this.m_rowDefinitions) {\r\n if (row.type == VUIGridLayoutLengthType.Ratio) {\r\n row.actualSize = ratioUnit.height * row.GetRatioSize();\r\n }\r\n row.AdjustActualSize();\r\n // Fix cell offset\r\n row.actualOffset = totalOffset.y;\r\n totalOffset.y += row.actualSize;\r\n }\r\n for (const col of this.m_columnDefinitions) {\r\n if (col.type == VUIGridLayoutLengthType.Ratio) {\r\n col.actualSize = ratioUnit.width * col.GetRatioSize();\r\n }\r\n col.AdjustActualSize();\r\n // Fix cell offset\r\n col.actualOffset = totalOffset.x;\r\n totalOffset.x += col.actualSize;\r\n }\r\n // 子要素の最終位置・サイズを確定させる\r\n let resultRect = { x: 0, y: 0, width: 0, height: 0 };\r\n const rowDefCount = (this.m_rowDefinitions.length);\r\n const colDefCount = (this.m_columnDefinitions.length);\r\n const children = this.children();\r\n for (let iChild = 0; iChild < children.length; iChild++) {\r\n const child = children[iChild];\r\n const rowIdx = child.row;\r\n const colIdx = child.col;\r\n let rowSpan = child.rowSpan;\r\n let colSpan = child.colSpan;\r\n rowSpan = Math.max(1, rowSpan); // 最低 1\r\n colSpan = Math.max(1, colSpan); // 最低 1\r\n rowSpan = Math.min(rowSpan, rowIdx + rowDefCount); // 最大値制限\r\n colSpan = Math.min(colSpan, colIdx + colDefCount); // 最大値制限\r\n // Span を考慮してサイズを確定\r\n const rect = { x: padding.left, y: padding.top, width: 0, height: 0 };\r\n {\r\n rect.y += this.m_rowDefinitions[rowIdx].actualOffset;\r\n for (let iRow = 0; iRow < rowSpan; iRow++) {\r\n rect.height += this.m_rowDefinitions[rowIdx + iRow].actualSize;\r\n }\r\n }\r\n {\r\n rect.x += this.m_columnDefinitions[colIdx].actualOffset;\r\n for (let iCol = 0; iCol < colSpan; iCol++) {\r\n rect.width += this.m_columnDefinitions[colIdx + iCol].actualSize;\r\n }\r\n }\r\n // Arrange\r\n const cr = VUIElement_1.VLayout.makeOffset(rect, finalArea.x, finalArea.y);\r\n //ArrangeItem(child, cr);\r\n child.arrange(cr);\r\n resultRect = VUIElement_1.VLayout.inflateIncludes(resultRect, cr);\r\n }\r\n return resultRect;\r\n }\r\n}\r\nexports.VUIGridLayout = VUIGridLayout;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/ui/VUIGridLayout.ts?"); /***/ }), /***/ "./ts/mr/view/ui/Window_Base.ts": /*!**************************************!*\ !*** ./ts/mr/view/ui/Window_Base.ts ***! \**************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nconst _Window_Base_update = Window_Base.prototype.update;\r\nWindow_Base.prototype.update = function () {\r\n _Window_Base_update.call(this);\r\n};\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/ui/Window_Base.ts?"); /***/ }), /***/ "./ts/mr/view/utils/VFontHelper.ts": /*!*****************************************!*\ !*** ./ts/mr/view/utils/VFontHelper.ts ***! \*****************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VFontHelper = void 0;\r\nclass VFontHelper {\r\n // .fontSize 設定済みであること\r\n static measureTextSize(bitmap, text, fontSize) {\r\n var _a;\r\n const context = bitmap.context;\r\n context.save();\r\n context.font = bitmap._makeFontNameText();\r\n if (fontSize !== undefined) {\r\n bitmap.fontSize = fontSize;\r\n }\r\n const metrics = context.measureText(text);\r\n context.restore();\r\n const height = metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent;\r\n const ow = (_a = bitmap.outlineWidth) !== null && _a !== void 0 ? _a : 0;\r\n return [Math.ceil(metrics.width + ow), Math.ceil(height + ow)];\r\n }\r\n}\r\nexports.VFontHelper = VFontHelper;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/utils/VFontHelper.ts?"); /***/ }), /***/ "./ts/mr/view/window/VWindowFactory.ts": /*!*********************************************!*\ !*** ./ts/mr/view/window/VWindowFactory.ts ***! \*********************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VWindowFactory = void 0;\r\nconst MRView_1 = __webpack_require__(/*! ../MRView */ \"./ts/mr/view/MRView.ts\");\r\nclass VWindowFactory {\r\n createWindowr(ctor, defaultRect) {\r\n let window = MRView_1.MRView.ext.onCreateWindow(ctor.name, defaultRect);\r\n if (!window) {\r\n window = new ctor(defaultRect);\r\n }\r\n return window;\r\n }\r\n}\r\nexports.VWindowFactory = VWindowFactory;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/window/VWindowFactory.ts?"); /***/ }), /***/ "./ts/mr/view/window/VWindowHelper.ts": /*!********************************************!*\ !*** ./ts/mr/view/window/VWindowHelper.ts ***! \********************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VWindowHelper = void 0;\r\nconst LItemBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LItemBehavior */ \"./ts/mr/lively/behaviors/LItemBehavior.ts\");\r\nconst UName_1 = __webpack_require__(/*! ts/mr/utility/UName */ \"./ts/mr/utility/UName.ts\");\r\nclass VWindowHelper {\r\n // Scene_Base.calcWindowHeight と同じ\r\n static calcWindowHeight(numLines, selectable) {\r\n if (selectable) {\r\n return Window_Selectable.prototype.fittingHeight(numLines);\r\n }\r\n else {\r\n return Window_Base.prototype.fittingHeight(numLines);\r\n }\r\n }\r\n static calcWindowSizeFromClinetSize(width, height) {\r\n //const pad = this.calcOuterPadding(window);\r\n return [width + this.DefaultPadding * 2, height + this.DefaultPadding * 2];\r\n }\r\n static calcOuterPadding(window) {\r\n const pad = window.padding;\r\n return [\r\n pad - window.origin.x,\r\n pad - window.origin.y\r\n ];\r\n }\r\n static drawEntityItemName(window, item, x, y, width, equipmentUser) {\r\n if (item) {\r\n const iconY = y + (window.lineHeight() - ImageManager.iconHeight) / 2;\r\n const nameX = x + ImageManager.iconWidth;\r\n const desc = UName_1.UName.makeNameAsItem(item);\r\n // State Icon\r\n {\r\n }\r\n // Item Icon\r\n // Name\r\n {\r\n const textMargin = ImageManager.iconWidth * 2 + 4;\r\n const itemWidth = Math.max(0, width - textMargin);\r\n window.resetTextColor();\r\n window.drawTextEx(desc, nameX, y, itemWidth);\r\n // 装備していればアイコンを表示する\r\n if (equipmentUser && equipmentUser.isEquipped(item)) {\r\n window.drawIcon(12, nameX, iconY);\r\n }\r\n }\r\n // 値札\r\n const itemBehavior = item.findEntityBehavior(LItemBehavior_1.LItemBehavior);\r\n if (itemBehavior && itemBehavior.shopStructureId() > 0) {\r\n const price = item.queryPrice();\r\n const text = price.sellingPrice.toString();\r\n const tw = window.textWidth(text) + 8;\r\n const size = window.textSizeEx(text);\r\n const th = size.height - 4;\r\n const ty = y + (window.lineHeight() - th) / 2;\r\n const tx = width - tw + 4;\r\n window.changeTextColor(ColorManager.textColor(29));\r\n window.drawRect(tx, ty, tw, th);\r\n window.drawTextEx(text, width - tw, ty, tw);\r\n }\r\n }\r\n }\r\n}\r\nexports.VWindowHelper = VWindowHelper;\r\nVWindowHelper.DefaultPadding = 12;\r\nVWindowHelper.LineHeight = 36; // Window_Base.prototype.lineHeight\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/window/VWindowHelper.ts?"); /***/ }), /***/ "./ts/mr/view/window/windows/VChallengeResultWindow.ts": /*!*************************************************************!*\ !*** ./ts/mr/view/window/windows/VChallengeResultWindow.ts ***! \*************************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VChallengeResultWindow = void 0;\r\nconst DTextManager_1 = __webpack_require__(/*! ts/mr/data/DTextManager */ \"./ts/mr/data/DTextManager.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nclass VChallengeResultWindow extends Window_Base {\r\n constructor() {\r\n super(new Rectangle(10, 10, 500, 400));\r\n this.openness = 0; // 初期状態では非表示\r\n this._text = \"VChallengeResultWindow\";\r\n this.refresh();\r\n }\r\n update() {\r\n super.update();\r\n if (!this.isOpen()) {\r\n if (MRLively_1.MRLively.challengeResultShowing) {\r\n this.open();\r\n }\r\n }\r\n else {\r\n if (this.isTriggered()) {\r\n MRLively_1.MRLively.challengeResultShowing = false;\r\n this.close();\r\n }\r\n }\r\n }\r\n refresh() {\r\n const rect = this.baseTextRect();\r\n this.contents.clear();\r\n const lh = this.itemHeight();\r\n const cw = 200;\r\n const m = 32;\r\n this.drawActorNameAndLevel(cw * 0, lh * 0, cw);\r\n this.drawScore(cw * 1 + m, lh * 0, cw);\r\n this.drawPlaytime(1000, cw * 1 + m, lh * 1, cw);\r\n this.drawResultSummary(cw * 0, lh * 2 + lh / 2, cw * 2);\r\n this.drawParam(TextManager.hp, \"87\", cw * 0, lh * 4, cw);\r\n this.drawParam(\"満腹度\", \"54%\", cw * 1 + m, lh * 4, cw);\r\n this.drawParam(TextManager.attack, \"8/8\", cw * 0, lh * 5, cw);\r\n this.drawParam(TextManager.exp, \"3225\", cw * 1 + m, lh * 5, cw);\r\n this._drawItem(\"カタナ+3\", 96, 0, lh * 7);\r\n this._drawItem(\"皮の盾\", 129, 0, lh * 8);\r\n }\r\n drawActorNameAndLevel(x, y, w) {\r\n const name = \"LRIKI\";\r\n const level = 15;\r\n this.drawText(name, x, y, w, \"left\");\r\n //this.changeTextColor(ColorManager.systemColor());\r\n this.drawText(`${TextManager.levelA} ${level}`, x, y, w, \"right\");\r\n //this.resetTextColor();\r\n //this.drawText(level, x, y, w, \"right\");\r\n }\r\n drawScore(x, y, w) {\r\n const score = 99999; // TODO:\r\n const width = 100;\r\n this.changeTextColor(ColorManager.systemColor());\r\n this.drawText(DTextManager_1.DTextManager.score, x, y, w, \"left\");\r\n this.resetTextColor();\r\n this.drawText(score, x, y, w, \"right\");\r\n }\r\n drawPlaytime(frameCount, x, y, w) {\r\n this.drawText(this.playtimeText(frameCount), x, y, w, \"right\");\r\n }\r\n drawResultSummary(x, y, w) {\r\n const text = \"\\\\c[2]緑燐の丘 \\\\c[0]を無事にクリアした!\";\r\n //const text = \"\\\\c[2]モンスター \\\\c[0]にぺしゃんこにされた。\"\r\n this.drawTextEx(text, x, y, w);\r\n }\r\n drawParam(name, value, x, y, w) {\r\n //const value = 87;\r\n this.changeTextColor(ColorManager.systemColor());\r\n this.drawText(name, x, y, w, \"left\");\r\n this.resetTextColor();\r\n this.drawText(value, x, y, w, \"right\");\r\n }\r\n _drawItem(name, icon, x, y) {\r\n this.drawIcon(icon, x, y);\r\n this.drawText(name, x + 34, y, 200, \"left\");\r\n }\r\n // Game_System.prototype.playtimeText\r\n playtimeText(frameCount) {\r\n const hour = Math.floor(frameCount / 60 / 60);\r\n const min = Math.floor(frameCount / 60) % 60;\r\n const sec = frameCount % 60;\r\n return hour.padZero(2) + \":\" + min.padZero(2) + \":\" + sec.padZero(2);\r\n }\r\n isTriggered() {\r\n return (Input.isRepeated(\"ok\") ||\r\n Input.isRepeated(\"cancel\") ||\r\n TouchInput.isRepeated());\r\n }\r\n drawItem() {\r\n }\r\n}\r\nexports.VChallengeResultWindow = VChallengeResultWindow;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/window/windows/VChallengeResultWindow.ts?"); /***/ }), /***/ "./ts/mr/view/window/windows/VDetailsWindow.ts": /*!*****************************************************!*\ !*** ./ts/mr/view/window/windows/VDetailsWindow.ts ***! \*****************************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VDetailsWindow = void 0;\r\nclass VDetailsWindow extends Window_Base {\r\n constructor(dialog) {\r\n super(new Rectangle(0, 64, Graphics.boxWidth, 400));\r\n this._dialog = dialog;\r\n //this.openness = 0; // 初期状態では非表示\r\n this.refresh();\r\n }\r\n isOpenAndActive() {\r\n return this.isOpen() && this.visible && this.active;\r\n }\r\n ;\r\n update() {\r\n if (this.isOpenAndActive()) {\r\n if (this.isTriggered()) {\r\n this.close();\r\n }\r\n }\r\n super.update();\r\n }\r\n close() {\r\n if (this.onClose) {\r\n this.onClose();\r\n }\r\n }\r\n refresh() {\r\n const rect = this.baseTextRect();\r\n this.contents.clear();\r\n const lineHeight = this.lineHeight();\r\n let y = 0;\r\n this.drawTextEx(this._dialog.summary, 0, y, 300);\r\n y += lineHeight * 2;\r\n this.drawTextEx(this._dialog.description, 0, y, 300);\r\n y += lineHeight;\r\n }\r\n isTriggered() {\r\n return (Input.isRepeated(\"ok\") ||\r\n Input.isRepeated(\"cancel\") ||\r\n TouchInput.isRepeated());\r\n }\r\n}\r\nexports.VDetailsWindow = VDetailsWindow;\r\n/*\r\n\r\nexport class VDetailsWindow extends VISelectableWindow {\r\n private _dialog: SDetailsDialog;\r\n onClose: (() => void) | undefined;\r\n\r\n constructor(dialog: SDetailsDialog) {\r\n super(new Rectangle(0, 64, Graphics.boxWidth, 400));\r\n this._dialog = dialog;\r\n //this.openness = 0; // 初期状態では非表示\r\n this.refresh();\r\n this.padding = 20;\r\n }\r\n \r\n override isOpenAndActive(): boolean {\r\n return this.isOpen() && this.visible && this.active;\r\n }\r\n\r\n override maxItems(): number {\r\n return this._dialog.descriptions.length;\r\n }\r\n\r\n update(): void {\r\n\r\n if (this.isOpenAndActive()) {\r\n if (this.isTriggered()) {\r\n this.close();\r\n }\r\n }\r\n super.update();\r\n }\r\n\r\n close(): void {\r\n if (this.onClose) {\r\n this.onClose();\r\n }\r\n }\r\n \r\n refresh(): void {\r\n super.refresh();\r\n const rect = this.baseTextRect();\r\n this.contents.clear();\r\n\r\n const width = this.contents.width;\r\n const lineHeight = this.lineHeight();\r\n\r\n let y = 0;\r\n y += this.drawEntityName(0, y, width).height;\r\n\r\n y += lineHeight / 2;\r\n\r\n ColorManager.itemBackColor1()\r\n\r\n //this.drawRect()\r\n\r\n this.drawTextEx(this._dialog.description, 0, y, 300); y += lineHeight;\r\n }\r\n\r\n override drawItem(index: number): void {\r\n const item = this._dialog.description[index];\r\n if (item) {\r\n const rect = this.itemLineRect(index);\r\n this.drawTextEx(item, rect.x, rect.y, rect.width);\r\n }\r\n };\r\n\r\n private drawEntityName(x: number, y: number, width: number): VUISize {\r\n const rect = this.baseTextRect();\r\n const height = this.lineHeight();\r\n this.drawHeadingRect(x, y, width, height, false, true);\r\n this.drawTextEx(this._dialog.summary, rect.x, rect.y, width);\r\n return { width: rect.width, height: rect.height }\r\n }\r\n\r\n private drawHeadingRect(x: number, y: number, width: number, height: number, topline: boolean, bottomline: boolean): void {\r\n this.contents.fillRect(x, y, width, height, ColorManager.itemBackColor1());\r\n if (topline) {\r\n this.contents.fillRect(x, y, width, 1, this.underlineColor());\r\n }\r\n if (bottomline) {\r\n this.contents.fillRect(x, y + height - 1, width, 1, this.underlineColor());\r\n }\r\n }\r\n\r\n private underlineColor(): string {\r\n return ColorManager.systemColor();\r\n }\r\n\r\n private isTriggered(): boolean {\r\n return (\r\n Input.isRepeated(\"ok\") ||\r\n Input.isRepeated(\"cancel\") ||\r\n TouchInput.isRepeated()\r\n );\r\n }\r\n}\r\n*/\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/window/windows/VDetailsWindow.ts?"); /***/ }), /***/ "./ts/mr/view/window/windows/VEntityCaptionWindow.ts": /*!***********************************************************!*\ !*** ./ts/mr/view/window/windows/VEntityCaptionWindow.ts ***! \***********************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VEntityCaptionWindow = void 0;\r\nconst VUIElement_1 = __webpack_require__(/*! ../../ui/VUIElement */ \"./ts/mr/view/ui/VUIElement.ts\");\r\nconst VWindowHelper_1 = __webpack_require__(/*! ../VWindowHelper */ \"./ts/mr/view/window/VWindowHelper.ts\");\r\nclass VEntityCaptionWindow extends Window_Base {\r\n constructor(entity) {\r\n super(VEntityCaptionWindow.getDefaultRect());\r\n const pad = this.padding;\r\n //this._clientArea.move(pad, pad);\r\n const ax = pad - this.origin.x;\r\n const ay = pad - this.origin.y;\r\n this._entity = entity;\r\n this.refresh();\r\n }\r\n static getDefaultRect() {\r\n const size = VWindowHelper_1.VWindowHelper.calcWindowSizeFromClinetSize(0, VWindowHelper_1.VWindowHelper.LineHeight);\r\n return new Rectangle(0, VUIElement_1.VLayout.calcGridY(3), VUIElement_1.VLayout.calcGridWidth(9), size[1]);\r\n }\r\n setEntity(entity) {\r\n this._entity = entity;\r\n this.refresh();\r\n }\r\n refresh() {\r\n const rect = this.baseTextRect();\r\n this.contents.clear();\r\n VWindowHelper_1.VWindowHelper.drawEntityItemName(this, this._entity, 0, 0, rect.width, undefined);\r\n //this.drawTextEx(this._text, rect.x, rect.y, rect.width);\r\n }\r\n}\r\nexports.VEntityCaptionWindow = VEntityCaptionWindow;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/window/windows/VEntityCaptionWindow.ts?"); /***/ }), /***/ "./ts/mr/view/window/windows/VFlexCommandWindow.ts": /*!*********************************************************!*\ !*** ./ts/mr/view/window/windows/VFlexCommandWindow.ts ***! \*********************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VFlexCommandWindow = void 0;\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\n/**\r\n * - [説明] など、Sub Dialog を開く Command\r\n * - [投げる] [置く] など、特定の Entity に対する Action の Command\r\n * - [あずける] など、システム的な Command\r\n *\r\n * add**() で追加し終わったら refresh() すること。\r\n */\r\nclass VFlexCommandWindow extends Window_Command {\r\n constructor(rect) {\r\n super(rect);\r\n this._commands = [];\r\n this.openness = 0;\r\n // Window_Command を利用する場合、コマンドリストは makeCommandList() で生成するべき。\r\n // しかしこのメソッドはベースのコンストラクタからも呼ばれるため、先に this._actions を初期化することができない。\r\n // そのためここで設定後、refresh() することでコマンドリストを再構築している。\r\n //this._actions = actions;\r\n this.refresh();\r\n }\r\n setupFromCommandList(commands) {\r\n this.clear();\r\n for (const command of commands) {\r\n if (command.isActivityCommand) {\r\n this.addActionCommand(command.actionId, command.displayName, `act#${command.actionId}`, command.activityCommandHandler);\r\n }\r\n else if (command.isSystemCommand) {\r\n this.addSystemCommand(command.displayName, command.systemCommandId, command.systemCommandIdHandler);\r\n }\r\n else {\r\n throw new Error(\"Unreachable.\");\r\n }\r\n }\r\n }\r\n addActionCommand(actionId, displayName, commandId, handler) {\r\n this._commands.push({\r\n actionId: actionId,\r\n displayText: displayName !== null && displayName !== void 0 ? displayName : MRData_1.MRData.skills[actionId].name,\r\n commandId: commandId,\r\n actionHandler: handler,\r\n systemHandler: undefined,\r\n });\r\n }\r\n addSystemCommand(text, commandId, systemHandler) {\r\n this._commands.push({\r\n actionId: 0,\r\n displayText: text,\r\n commandId: commandId,\r\n actionHandler: undefined,\r\n systemHandler: systemHandler,\r\n });\r\n }\r\n clear() {\r\n this._commands = [];\r\n this.refresh();\r\n }\r\n fitHeight() {\r\n this.height = this.fittingHeight(this._commands.length);\r\n }\r\n // override. 外部から再構築したいときは refresh を呼ぶこと。\r\n makeCommandList() {\r\n if (this._commands) {\r\n this._commands.forEach((x, i) => {\r\n if (x.actionId == 0) {\r\n this.addCommand(x.displayText, x.commandId, true, undefined);\r\n this.setHandler(x.commandId, () => {\r\n if (x.systemHandler) {\r\n x.systemHandler(x.commandId);\r\n }\r\n });\r\n }\r\n else {\r\n this.addCommand(x.displayText, x.commandId, true, undefined);\r\n this.setHandler(x.commandId, () => {\r\n if (x.actionHandler) {\r\n x.actionHandler(x.actionId);\r\n }\r\n });\r\n }\r\n });\r\n }\r\n //this.addCommand(TextManager.cancel, \"cancel\", true, undefined);\r\n }\r\n processOk() {\r\n super.processOk();\r\n }\r\n}\r\nexports.VFlexCommandWindow = VFlexCommandWindow;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/window/windows/VFlexCommandWindow.ts?"); /***/ }), /***/ "./ts/mr/view/window/windows/VFloorNameWindow.ts": /*!*******************************************************!*\ !*** ./ts/mr/view/window/windows/VFloorNameWindow.ts ***! \*******************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VFloorNameWindow = void 0;\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\n/**\r\n */\r\nclass VFloorNameWindow extends Window_Base {\r\n constructor(rect) {\r\n super(rect);\r\n this._showCount = 0;\r\n this.openness = 0;\r\n this.opacity = 0;\r\n this.contentsOpacity = 0;\r\n this._showCount = 0;\r\n }\r\n open() {\r\n this.refresh();\r\n this.openness = 255;\r\n this._showCount = 150;\r\n }\r\n close() {\r\n this._showCount = 0;\r\n this.openness = 0;\r\n }\r\n isEffectRunning() {\r\n return this._showCount > 0;\r\n }\r\n showCount() {\r\n return this._showCount;\r\n }\r\n update() {\r\n Window_Base.prototype.update.call(this);\r\n if (this._showCount > 0 && $gameMap.isNameDisplayEnabled()) {\r\n this.updateFadeIn();\r\n this._showCount--;\r\n }\r\n else {\r\n this.updateFadeOut();\r\n }\r\n }\r\n updateFadeIn() {\r\n this.contentsOpacity += 16;\r\n }\r\n updateFadeOut() {\r\n this.contentsOpacity -= 16;\r\n if (this.contentsOpacity <= 0) {\r\n this.close();\r\n }\r\n }\r\n refresh() {\r\n this.contents.clear();\r\n if ($gameMap.displayName()) {\r\n const floorId = MRLively_1.MRLively.mapView.currentMap.floorId();\r\n const floorInfo = floorId.floorInfo;\r\n const displayName = floorInfo.displayName ? floorInfo.displayName : $gameMap.displayName();\r\n const lines = displayName.format(floorId.floorNumber).split(\"\\\\n\");\r\n const height = this.lineHeight() * lines.length;\r\n const y = (this.innerHeight - height) / 2;\r\n const margin = 10;\r\n const width = this.innerWidth;\r\n this.drawBackground(0, y - margin, width, height + margin * 2);\r\n for (let i = 0; i < lines.length; i++) {\r\n this.drawText(lines[i], 0, y + i * this.lineHeight(), width, \"center\");\r\n }\r\n }\r\n }\r\n drawBackground(x, y, width, height) {\r\n const color1 = ColorManager.dimColor1();\r\n const color2 = ColorManager.dimColor2();\r\n const half = width / 2;\r\n this.contents.gradientFillRect(x, y, half, height, color2, color1, false);\r\n this.contents.gradientFillRect(x + half, y, half, height, color1, color2, false);\r\n }\r\n}\r\nexports.VFloorNameWindow = VFloorNameWindow;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/window/windows/VFloorNameWindow.ts?"); /***/ }), /***/ "./ts/mr/view/window/windows/VItemListWindow.ts": /*!******************************************************!*\ !*** ./ts/mr/view/window/windows/VItemListWindow.ts ***! \******************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VItemListWindow = exports.VItemListPriceTag = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst LItemBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LItemBehavior */ \"./ts/mr/lively/behaviors/LItemBehavior.ts\");\r\nconst UName_1 = __webpack_require__(/*! ts/mr/utility/UName */ \"./ts/mr/utility/UName.ts\");\r\nconst VSelectableWindow_1 = __webpack_require__(/*! ./VSelectableWindow */ \"./ts/mr/view/window/windows/VSelectableWindow.ts\");\r\n// export class VItemListWindowItem {\r\n// public entity: LEntity;\r\n// public selectedIndex: number | undefined;\r\n// constructor(item: LEntity) {\r\n// this.entity = item;\r\n// this.selectedIndex = undefined;\r\n// }\r\n// }\r\nvar VItemListPriceTag;\r\n(function (VItemListPriceTag) {\r\n VItemListPriceTag[VItemListPriceTag[\"None\"] = 0] = \"None\";\r\n VItemListPriceTag[VItemListPriceTag[\"SellingPrice\"] = 1] = \"SellingPrice\";\r\n VItemListPriceTag[VItemListPriceTag[\"PurchasePrice\"] = 2] = \"PurchasePrice\";\r\n})(VItemListPriceTag = exports.VItemListPriceTag || (exports.VItemListPriceTag = {}));\r\n/**\r\n */\r\nclass VItemListWindow extends VSelectableWindow_1.VISelectableWindow {\r\n constructor(rect, model) {\r\n super(rect);\r\n this._model = model;\r\n //this._items = [];\r\n this._pagenationEnabled = true;\r\n this._currentPageIndex = 0;\r\n this.multipleSelectionEnabled = false;\r\n this.priceTag = VItemListPriceTag.None;\r\n this.createPagenationArrowSprites();\r\n this.refresh();\r\n }\r\n ;\r\n get itemsParPage() {\r\n return Math.floor((this.contentsHeight() - this.padding * 2) / this.itemHeight());\r\n }\r\n get maxPageCount() {\r\n return Math.max(Math.floor((this._model.items.length - 1) / this.itemsParPage) + 1, 0);\r\n }\r\n getActualPriceTag(item) {\r\n if (this.priceTag != VItemListPriceTag.None) {\r\n return this.priceTag;\r\n }\r\n else {\r\n const itemBehavior = item.findEntityBehavior(LItemBehavior_1.LItemBehavior);\r\n if (itemBehavior && itemBehavior.shopStructureId() > 0) {\r\n return VItemListPriceTag.SellingPrice;\r\n }\r\n else {\r\n return VItemListPriceTag.None;\r\n }\r\n }\r\n }\r\n // public setInventory(inventory: LInventoryBehavior): void {\r\n // this._inventory = inventory;\r\n // this.refreshItems();\r\n // this.refresh();\r\n // }\r\n // public refreshItems(): void {\r\n // if (this._inventory) {\r\n // this._items = this._inventory.items.map(x => new VItemListWindowItem(x));\r\n // this.refresh();\r\n // }\r\n // }\r\n setEquipmentUser(equipmentUser) {\r\n this._equipmentUser = equipmentUser;\r\n }\r\n selectedItem() {\r\n const item = this._model.focusedEntity();\r\n // const item = this.itemAt(this.index());\r\n (0, Common_1.assert)(item);\r\n return item;\r\n //return item.entity;\r\n }\r\n // public isMultipleSelecting(): boolean {\r\n // return this._items.find(x => x.selectedIndex !== undefined) !== undefined;\r\n // }\r\n // public getSelectedItems(): LEntity[] {\r\n // const result: VItemListWindowItem[] = [];\r\n // // まずは複数選択状態の Item を探してみる\r\n // for (const item of this._items) {\r\n // if (item.selectedIndex !== undefined) {\r\n // result.push(item);\r\n // }\r\n // }\r\n // if (result.length == 0) {\r\n // // もしひとつも選択状態ないなら、カーソル位置の Item を返す\r\n // const item = this.itemAt(this.index());\r\n // return item ? [item.entity] : [];\r\n // }\r\n // else {\r\n // // 選択された順で返す\r\n // const items = result.sort((a, b) => {\r\n // assert(a.selectedIndex !== undefined);\r\n // assert(b.selectedIndex !== undefined);\r\n // return a.selectedIndex - b.selectedIndex;\r\n // });\r\n // return items.map(x => x.entity);\r\n // }\r\n // }\r\n // override\r\n maxCols() {\r\n return 1;\r\n }\r\n // override\r\n maxItems() {\r\n if (this._pagenationEnabled) {\r\n const left = this.itemsParPage * this._currentPageIndex;\r\n return Math.max(Math.min(this._model.items.length - left, this.itemsParPage), 0);\r\n }\r\n else {\r\n return this._model.items.length;\r\n }\r\n }\r\n // override\r\n isCurrentItemEnabled() {\r\n return this._model.items.length > 0;\r\n }\r\n // override\r\n // 表示を更新したいときに呼ぶ。選択状態までリセットされてほしくないので、この中でアイテムリストの再構築は行わない。\r\n // アイテムリストの再構築をしたいときは refreshItems() を使うこと。\r\n refresh() {\r\n super.refresh();\r\n this.refreshPagenationArrows();\r\n this.updatePagenationArrows();\r\n }\r\n // override\r\n drawAllItems() {\r\n if (this.maxItems() <= 0) {\r\n const rect = this.itemLineRect(0);\r\n this.drawText((0, Common_1.tr2)(\"なにも持っていない\"), rect.x, rect.y, 300, \"left\");\r\n }\r\n else {\r\n super.drawAllItems();\r\n }\r\n }\r\n // override\r\n drawItem(index) {\r\n const item = this._model.items[index];\r\n if (item) {\r\n const numberWidth = 0; //this.numberWidth();\r\n const rect = this.itemLineRect(index);\r\n this.changePaintOpacity(true);\r\n this.drawEntityItemName(index, rect.x, rect.y, rect.width - numberWidth);\r\n //this.drawItemNumber(item, rect.x, rect.y, rect.width);\r\n this.changePaintOpacity(true);\r\n }\r\n }\r\n // override\r\n update() {\r\n super.update();\r\n if (Input.isTriggered(\"pageup\")) {\r\n if (this.multipleSelectionEnabled) {\r\n this._model.toggleMultipeSelection();\r\n this.playCursorSound();\r\n this.paint();\r\n // const item = this.itemAt(this.index());\r\n // if (item) {\r\n // this.toggleItemSelection(item);\r\n // }\r\n }\r\n }\r\n }\r\n // override\r\n cursorRight(wrap) {\r\n if (this._pagenationEnabled) {\r\n const pageCount = this.maxPageCount;\r\n if (pageCount <= 1)\r\n return;\r\n this._currentPageIndex++;\r\n if (this._currentPageIndex >= pageCount) {\r\n this._currentPageIndex = 0;\r\n }\r\n this.correctSelectedIndex();\r\n this.refresh();\r\n this.playCursorSound();\r\n }\r\n else {\r\n super.cursorRight(wrap);\r\n }\r\n }\r\n // override\r\n cursorLeft(wrap) {\r\n if (this._pagenationEnabled) {\r\n const pageCount = this.maxPageCount;\r\n if (pageCount <= 1)\r\n return;\r\n this._currentPageIndex--;\r\n if (this._currentPageIndex < 0) {\r\n this._currentPageIndex = pageCount - 1;\r\n }\r\n this.correctSelectedIndex();\r\n this.refresh();\r\n this.playCursorSound();\r\n }\r\n else {\r\n super.cursorRight(wrap);\r\n }\r\n }\r\n // private toggleItemSelection(item: VItemListWindowItem): void {\r\n // if (item.selectedIndex === undefined) {\r\n // // 新しく選択する\r\n // let maxIndex = -1;\r\n // for (const item of this._items) {\r\n // if (item.selectedIndex !== undefined) {\r\n // maxIndex = Math.max(maxIndex, item.selectedIndex);\r\n // }\r\n // }\r\n // item.selectedIndex = maxIndex + 1;\r\n // }\r\n // else {\r\n // // 選択解除\r\n // const removeIndex = item.selectedIndex;\r\n // for (const item of this._items) {\r\n // if (item.selectedIndex !== undefined && item.selectedIndex > removeIndex) {\r\n // item.selectedIndex -= 1;\r\n // }\r\n // }\r\n // item.selectedIndex = undefined;\r\n // }\r\n // this.playCursorSound();\r\n // this.paint();\r\n // }\r\n correctSelectedIndex() {\r\n const max = this.maxItems();\r\n if (this.index() > max - 1) {\r\n this.select(max - 1);\r\n }\r\n }\r\n numberWidth() {\r\n return this.textWidth(\"000\");\r\n }\r\n // public itemAt(index: number): VItemListWindowItem | undefined {\r\n // if (this._items.length == 0) {\r\n // return undefined;\r\n // }\r\n // else if (this._pagenationEnabled) {\r\n // return this._items[this._currentPageIndex * this.itemsParPage + index];\r\n // }\r\n // else {\r\n // return this._items[index];\r\n // }\r\n // }\r\n // private makeItemList(): void {\r\n // }\r\n drawEntityItemName(index, x, y, width) {\r\n const item = this._model.items[index];\r\n if (item) {\r\n const entity = item;\r\n const iconY = y + (this.lineHeight() - ImageManager.iconHeight) / 2;\r\n const nameX = x + ImageManager.iconWidth;\r\n const desc = UName_1.UName.makeNameAsItem(entity);\r\n const selectedIndex = this._model.getItemSelectedIndex(item);\r\n if (selectedIndex >= 0) {\r\n const size = this.contents.fontSize;\r\n this.contents.fontSize = 16;\r\n this.drawText((selectedIndex + 1), x - 4, y - 6, 100, \"left\");\r\n this.contents.fontSize = size;\r\n }\r\n // State Icon\r\n {\r\n }\r\n // Item Icon\r\n // Name\r\n {\r\n const textMargin = ImageManager.iconWidth * 2 + 4;\r\n const itemWidth = Math.max(0, width - textMargin);\r\n this.resetTextColor();\r\n this.drawTextEx(desc, nameX, y, itemWidth);\r\n // 装備していればアイコンを表示する\r\n if (this._equipmentUser && (this._equipmentUser.isEquipped(entity) || this._equipmentUser.isShortcutEquipped(entity))) {\r\n this.drawIcon(12, nameX, iconY);\r\n }\r\n // メッキ状態アイコンを表示する\r\n if (entity.isStateAffected(MRData_1.MRData.system.states.plating)) {\r\n this.drawIcon(13, nameX, iconY);\r\n }\r\n }\r\n // 値札\r\n const priceTag = this.getActualPriceTag(entity);\r\n if (priceTag != VItemListPriceTag.None) {\r\n const price = entity.queryPrice();\r\n const value = (priceTag == VItemListPriceTag.SellingPrice) ? price.sellingPrice : price.purchasePrice;\r\n const text = value.toString();\r\n const tw = this.textWidth(text);\r\n const size = this.textSizeEx(text);\r\n const th = size.height - 4;\r\n // Label rect\r\n const labelPaddingV = 2; // Top & Bottom\r\n const labelPaddingH = 8; // Left & Right\r\n const labelH = this.lineHeight() - labelPaddingV * 2;\r\n const labelW = tw + labelPaddingH * 2;\r\n const labelX = x + width - labelW;\r\n const labelY = y + labelPaddingV;\r\n // Label backgroud\r\n this.changeTextColor(ColorManager.textColor(29));\r\n this.drawRect(labelX, labelY, labelW, labelH);\r\n const textPaddingV = 0; // Top & Bottom\r\n const textPaddingH = 8;\r\n const textY = y + textPaddingV;\r\n const textX = labelX + textPaddingH;\r\n this.drawTextEx(text, textX, textY, tw);\r\n }\r\n }\r\n }\r\n createPagenationArrowSprites() {\r\n this._leftArrowSprite = new Sprite(undefined);\r\n this.addChild(this._leftArrowSprite);\r\n this._rightArrowSprite = new Sprite(undefined);\r\n this.addChild(this._rightArrowSprite);\r\n }\r\n refreshPagenationArrows() {\r\n const w = this.width;\r\n const h = this.height;\r\n const p = 24;\r\n const q = p / 2;\r\n const sx = 96 + p;\r\n const sy = 24 + q;\r\n if (this._leftArrowSprite) {\r\n this._leftArrowSprite.bitmap = this.windowskin;\r\n this._leftArrowSprite.anchor.x = 0.5;\r\n this._leftArrowSprite.anchor.y = 0.5;\r\n this._leftArrowSprite.setFrame(sx, sy, q, p);\r\n this._leftArrowSprite.move(q, h / 2);\r\n }\r\n if (this._rightArrowSprite) {\r\n this._rightArrowSprite.bitmap = this.windowskin;\r\n this._rightArrowSprite.anchor.x = 0.5;\r\n this._rightArrowSprite.anchor.y = 0.5;\r\n this._rightArrowSprite.setFrame(sx + p + q, sy, q, p);\r\n this._rightArrowSprite.move(w - q, h / 2);\r\n }\r\n }\r\n updatePagenationArrows() {\r\n if (!this._leftArrowSprite)\r\n return;\r\n if (!this._rightArrowSprite)\r\n return;\r\n this._leftArrowSprite.visible = false;\r\n this._rightArrowSprite.visible = false;\r\n if (this._pagenationEnabled) {\r\n if (this._currentPageIndex > 0) {\r\n this._leftArrowSprite.visible = true;\r\n }\r\n if (this._currentPageIndex < this.maxPageCount - 1) {\r\n this._rightArrowSprite.visible = true;\r\n }\r\n }\r\n }\r\n}\r\nexports.VItemListWindow = VItemListWindow;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/window/windows/VItemListWindow.ts?"); /***/ }), /***/ "./ts/mr/view/window/windows/VMainStatusWindow.ts": /*!********************************************************!*\ !*** ./ts/mr/view/window/windows/VMainStatusWindow.ts ***! \********************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VMainStatusWindow = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst DTextManager_1 = __webpack_require__(/*! ts/mr/data/DTextManager */ \"./ts/mr/data/DTextManager.ts\");\r\nconst MRBasics_1 = __webpack_require__(/*! ts/mr/data/MRBasics */ \"./ts/mr/data/MRBasics.ts\");\r\nconst MRData_1 = __webpack_require__(/*! ts/mr/data/MRData */ \"./ts/mr/data/MRData.ts\");\r\nconst LEquipmentUserBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LEquipmentUserBehavior */ \"./ts/mr/lively/behaviors/LEquipmentUserBehavior.ts\");\r\nconst LExperienceBehavior_1 = __webpack_require__(/*! ts/mr/lively/behaviors/LExperienceBehavior */ \"./ts/mr/lively/behaviors/LExperienceBehavior.ts\");\r\nconst VAnimation_1 = __webpack_require__(/*! ../../animation/VAnimation */ \"./ts/mr/view/animation/VAnimation.ts\");\r\nconst VEasing_1 = __webpack_require__(/*! ../../animation/VEasing */ \"./ts/mr/view/animation/VEasing.ts\");\r\nconst VUIElement_1 = __webpack_require__(/*! ../../ui/VUIElement */ \"./ts/mr/view/ui/VUIElement.ts\");\r\nconst VUIGridLayout_1 = __webpack_require__(/*! ../../ui/VUIGridLayout */ \"./ts/mr/view/ui/VUIGridLayout.ts\");\r\nclass VMainStatusWindow extends Window_Base {\r\n constructor(rect) {\r\n super(rect);\r\n this._curve2 = new VAnimation_1.VEasingAnimationCurve(50, 0, 0.2, VEasing_1.easing.outQuad);\r\n this._curve1 = new VAnimation_1.VEasingAnimationCurve(0, 20, 0.5, VEasing_1.easing.outExpo);\r\n this._opacityCurve = new VAnimation_1.VEasingAnimationCurve(0, 1.0, 0.2, VEasing_1.easing.linear);\r\n this._initialY = 0;\r\n this._invalidateLayout = true;\r\n this._invalidateDraw = true;\r\n this._initialY = rect.y;\r\n //this.openness = 0; // 初期状態では非表示\r\n this._layout = new VUIGridLayout_1.VUIGridLayout().margin(10);\r\n this._weaponText = new VUIElement_1.VUITextElement(DTextManager_1.DTextManager.weaponStrength())\r\n .setGrid(0, 0)\r\n .setColor(this.systemColor())\r\n .addTo(this._layout);\r\n this._weaponValue = new VUIElement_1.VUITextElement(\"-\")\r\n .setGrid(1, 0)\r\n .margin(0, 0, 0, 10)\r\n .addTo(this._layout);\r\n this._shieldText = new VUIElement_1.VUITextElement(DTextManager_1.DTextManager.shieldStrength())\r\n .setGrid(2, 0)\r\n .setColor(this.systemColor())\r\n .addTo(this._layout);\r\n this._shieldValue = new VUIElement_1.VUITextElement(\"-\")\r\n .setGrid(3, 0)\r\n .margin(0, 0, 0, 10)\r\n .addTo(this._layout);\r\n this._fpText = new VUIElement_1.VUITextElement(DTextManager_1.DTextManager.param(MRBasics_1.MRBasics.params.fp))\r\n .setGrid(0, 1)\r\n .setColor(this.systemColor())\r\n .addTo(this._layout);\r\n this._fpValue = new VUIElement_1.VUITextElement(\"1/1\")\r\n .setGrid(1, 1)\r\n .margin(0, 0, 0, 10)\r\n .addTo(this._layout);\r\n this._powText = new VUIElement_1.VUITextElement(DTextManager_1.DTextManager.param(MRBasics_1.MRBasics.params.pow))\r\n .setGrid(2, 1)\r\n .setColor(this.systemColor())\r\n .addTo(this._layout);\r\n this._powValue = new VUIElement_1.VUITextElement(\"1/1\")\r\n .setGrid(3, 1)\r\n .margin(0, 0, 0, 10)\r\n .addTo(this._layout);\r\n const expTotal = TextManager.expTotal.format(TextManager.exp);\r\n this._expText = new VUIElement_1.VUITextElement(expTotal)\r\n .setGrid(0, 2)\r\n .setColor(this.systemColor())\r\n .addTo(this._layout);\r\n this._expValue = new VUIElement_1.VUITextElement(\"100\")\r\n .setGrid(1, 2)\r\n .margin(0, 0, 0, 10)\r\n .addTo(this._layout);\r\n // 次のレベルまで\r\n const expNext = TextManager.expNext.format(TextManager.level);\r\n this._nextexpText = new VUIElement_1.VUITextElement(expNext)\r\n .setGrid(2, 2)\r\n .setColor(this.systemColor())\r\n .addTo(this._layout);\r\n this._nextexpValue = new VUIElement_1.VUITextElement(\"100\")\r\n .setGrid(3, 2)\r\n .margin(0, 0, 0, 10)\r\n .addTo(this._layout);\r\n this._layout.children().forEach(e => e.opacity = 0.0);\r\n // VAnimation.start(this, \"window.opa\", this._curve1, v => {\r\n // this.opacity = (v / 20) * 255;\r\n // }, 0.0);\r\n // VAnimation.start(this, \"window.y\", this._curve2, v => {\r\n // this.y = this._initialY + v;\r\n // }, 0.0)\r\n VAnimation_1.VAnimation.startAt(this, \"window.o\", 0, 255, 0.3, VEasing_1.easing.outQuad, v => {\r\n this.opacity = v;\r\n }, 0.0);\r\n VAnimation_1.VAnimation.startAt(this, \"window.y\", this.y + 50, this.y, 0.3, VEasing_1.easing.outQuad, v => {\r\n this.y = v;\r\n }, 0.0)\r\n .then(() => {\r\n VAnimation_1.VAnimation.start(this, \"opacity\", this._opacityCurve, v => {\r\n this._layout.children().forEach(e => e.opacity = v);\r\n }, 0.0);\r\n const offset = -0.01;\r\n VAnimation_1.VAnimation.start(this, \"weapon.x\", this._curve1, v => {\r\n this._weaponText.x = this._weaponValue.x = v;\r\n this.invalidate();\r\n }, 0.0);\r\n VAnimation_1.VAnimation.start(this, \"shield.x\", this._curve1, v => {\r\n this._shieldText.x = this._shieldValue.x = v;\r\n this.invalidate();\r\n }, offset * 1);\r\n VAnimation_1.VAnimation.start(this, \"fp.x\", this._curve1, v => {\r\n this._fpText.x = this._fpValue.x = v;\r\n this.invalidate();\r\n }, offset * 2);\r\n VAnimation_1.VAnimation.start(this, \"pow.x\", this._curve1, v => {\r\n this._powText.x = this._powValue.x = v;\r\n this.invalidate();\r\n }, offset * 3);\r\n VAnimation_1.VAnimation.start(this, \"exp.x\", this._curve1, v => {\r\n this._expText.x = this._expValue.x = v;\r\n this.invalidate();\r\n }, offset * 4);\r\n VAnimation_1.VAnimation.start(this, \"nextexp.x\", this._curve1, v => {\r\n this._nextexpText.x = this._nextexpValue.x = v;\r\n this.invalidate();\r\n }, offset * 5);\r\n });\r\n this.invalidate();\r\n }\r\n setEntity(entity) {\r\n this._entity = entity;\r\n this.refresh();\r\n }\r\n invalidate() {\r\n this._invalidateLayout = true;\r\n this._invalidateDraw = true;\r\n }\r\n destroy() {\r\n VAnimation_1.VAnimation.startAt(this, \"window.o\", this.opacity, 0, 0.3, VEasing_1.easing.outQuad, v => {\r\n this.opacity = v;\r\n this._clientArea.opacity = v;\r\n });\r\n VAnimation_1.VAnimation.startAt(this, \"window.y\", this.y, this.y + 50, 0.3, VEasing_1.easing.outQuad, v => {\r\n this.y = v;\r\n }, 0.0)\r\n .then(() => {\r\n super.destroy();\r\n });\r\n }\r\n update() {\r\n super.update();\r\n if (this._invalidateLayout) {\r\n this.layout();\r\n this._invalidateLayout = false;\r\n }\r\n if (this._invalidateDraw) {\r\n this.draw();\r\n this._invalidateDraw = false;\r\n }\r\n }\r\n close() {\r\n super.close();\r\n if (this.onClose) {\r\n this.onClose();\r\n }\r\n }\r\n layout() {\r\n this._layout.measure(this);\r\n this._layout.arrange({ x: 0, y: 0, width: this.contents.width, height: this.contents.height });\r\n }\r\n refresh() {\r\n if (!this._entity)\r\n return;\r\n this.contents.clear();\r\n const equipmentUser = this._entity.findEntityBehavior(LEquipmentUserBehavior_1.LEquipmentUserBehavior);\r\n if (equipmentUser) {\r\n let atk = 0;\r\n let def = 0;\r\n for (const item of equipmentUser.equippedItemEntities()) {\r\n const data = item.data;\r\n (0, Common_1.assert)(data.equipment);\r\n atk += LEquipmentUserBehavior_1.LEquipmentUserBehavior.calcEquipmentParam(item, MRBasics_1.MRBasics.params.atk); //data.equipment.parameters[REBasics.params.atk];\r\n def += LEquipmentUserBehavior_1.LEquipmentUserBehavior.calcEquipmentParam(item, MRBasics_1.MRBasics.params.def); //data.equipment.parameters[REBasics.params.def];\r\n // item.iterateBehaviorsReverse(b => {\r\n // atk += b.onQueryIdealParamBase(REBasics.params.atk, atk);\r\n // def += b.onQueryIdealParamBase(REBasics.params.def, def);\r\n // console.log(\"ssss\", atk, def, b);\r\n // return true;\r\n // });\r\n }\r\n this._weaponValue.setText(atk.toString());\r\n this._shieldValue.setText(def.toString());\r\n }\r\n else {\r\n this._weaponValue.setText(\"-\");\r\n this._shieldValue.setText(\"-\");\r\n }\r\n // 満腹度\r\n const fpData = MRData_1.MRData.parameters[MRBasics_1.MRBasics.params.fp];\r\n const cfp = Math.ceil(fpData.makeDisplayValue(this._entity.getActualParam(MRBasics_1.MRBasics.params.fp)));\r\n const mfp = Math.ceil(fpData.makeDisplayValue(this._entity.getParamActualMax(MRBasics_1.MRBasics.params.fp)));\r\n this._fpValue.setText(`${cfp}/${mfp}`);\r\n // ちから\r\n const c = this._entity.getActualParam(MRBasics_1.MRBasics.params.pow);\r\n const m = this._entity.getParamActualMax(MRBasics_1.MRBasics.params.pow);\r\n this._powValue.setText(`${c}/${m}`);\r\n // 経験値\r\n const experienced = this._entity.findEntityBehavior(LExperienceBehavior_1.LExperienceBehavior);\r\n if (experienced) {\r\n this._expValue.setText(experienced.currentExp(this._entity).toString());\r\n this._nextexpValue.setText(experienced.nextLevelExp(this._entity).toString());\r\n }\r\n else {\r\n this._expValue.setText(\"-\");\r\n this._nextexpValue.setText(\"-\");\r\n }\r\n }\r\n draw() {\r\n this.contents.clear();\r\n this._layout.draw(this);\r\n }\r\n}\r\nexports.VMainStatusWindow = VMainStatusWindow;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/window/windows/VMainStatusWindow.ts?"); /***/ }), /***/ "./ts/mr/view/window/windows/VMenuCommandWindow.ts": /*!*********************************************************!*\ !*** ./ts/mr/view/window/windows/VMenuCommandWindow.ts ***! \*********************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VMenuCommandWindow = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst DTextManager_1 = __webpack_require__(/*! ts/mr/data/DTextManager */ \"./ts/mr/data/DTextManager.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst PluginParameters_1 = __webpack_require__(/*! ts/mr/PluginParameters */ \"./ts/mr/PluginParameters.ts\");\r\n/**\r\n */\r\nclass VMenuCommandWindow extends Window_Command {\r\n constructor(rect) {\r\n super(rect);\r\n }\r\n makeCommandList() {\r\n this.addCommand(TextManager.item, \"item\", true, undefined);\r\n //this.addCommand(tr2(\"その他\"), \"other\", true, undefined);\r\n if (MRLively_1.MRLively.mapView.currentMap.floorId().isSafetyMap2) {\r\n this.addCommand(DTextManager_1.DTextManager.save, \"save\", true, undefined);\r\n }\r\n else {\r\n this.addCommand((0, Common_1.tr2)(\"足元\"), \"feet\", true, undefined);\r\n if (PluginParameters_1.paramQuestSystem) {\r\n this.addCommand((0, Common_1.tr2)(\"クエスト\"), \"quest\", true, undefined);\r\n }\r\n if (PluginParameters_1.paramSuspendMenuEnabled) {\r\n this.addCommand((0, Common_1.tr2)(\"中断\"), \"suspend\", true, undefined);\r\n }\r\n }\r\n this.height = this.fittingHeight(this.maxItems());\r\n }\r\n}\r\nexports.VMenuCommandWindow = VMenuCommandWindow;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/window/windows/VMenuCommandWindow.ts?"); /***/ }), /***/ "./ts/mr/view/window/windows/VMessageLogWindow.ts": /*!********************************************************!*\ !*** ./ts/mr/view/window/windows/VMessageLogWindow.ts ***! \********************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VMessageLogWindow = void 0;\r\nconst Common_1 = __webpack_require__(/*! ts/mr/Common */ \"./ts/mr/Common.ts\");\r\nconst Math_1 = __webpack_require__(/*! ts/mr/math/Math */ \"./ts/mr/math/Math.ts\");\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\n/**\r\n */\r\nclass VMessageLogWindow extends Window_Base {\r\n constructor(message, rect) {\r\n super(rect);\r\n this._waitCount = 0;\r\n this._autoScroll = true;\r\n this._autoScrollCount = 0;\r\n this._autoScrollCountMax = 10;\r\n this._maxLines = 2;\r\n this._autoCloseCount = 0;\r\n this._autoCloseCountMax = 200;\r\n this._lineSpriteCache = [];\r\n this._textLines = [];\r\n this._autoCloseEnabled = true;\r\n this.textPaddingX = 4;\r\n this._message = message;\r\n this.openness = 0;\r\n this.initMembers();\r\n }\r\n ;\r\n initMembers() {\r\n this._waitCount = 0;\r\n this._autoCloseCount = 0;\r\n this._autoScrollCount = 0;\r\n }\r\n set autoCloseEnabled(value) {\r\n this._autoCloseEnabled = value;\r\n if (!this._autoCloseEnabled) {\r\n this.open();\r\n this.openness = 255;\r\n }\r\n }\r\n maxLines() {\r\n return this._maxLines;\r\n }\r\n //private lineHeight(): number {\r\n // return this.itemHeight();\r\n //}\r\n // override\r\n update() {\r\n if (!MRLively_1.MRLively.mapView.currentMap.floorId().isTacticsMap2)\r\n return;\r\n this.checkToNotClose();\r\n Window_Base.prototype.update.call(this);\r\n while (!this.isOpening() && !this.isClosing()) {\r\n if (this.updateWait()) {\r\n return;\r\n }\r\n else if (this.updateLoading()) {\r\n return;\r\n }\r\n else if (this.updateInput()) {\r\n return;\r\n }\r\n else if (this.updateAutoScroll()) {\r\n return;\r\n }\r\n else if (this.canScrollStart()) {\r\n this.startNewMessageAndScroll();\r\n }\r\n else {\r\n this.updateAutoClose();\r\n return;\r\n }\r\n }\r\n }\r\n checkToNotClose() {\r\n if (this._autoScroll) {\r\n if (this.isOpen() && this.isClosing() && this.doesContinue()) {\r\n this.open();\r\n }\r\n }\r\n }\r\n doesContinue() {\r\n // 今表示している終端行移行にもログ行が溜まっている場合は表示を続行したい\r\n return (this._message.hasText() &&\r\n this._message._lastViewLineIndex < this._message.texts().length - 1);\r\n }\r\n updateWait() {\r\n if (this._waitCount > 0) {\r\n this._waitCount--;\r\n return true;\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n updateLoading() {\r\n return false;\r\n }\r\n updateInput() {\r\n return false;\r\n }\r\n updateAutoScroll() {\r\n if (this._autoScrollCount > 0) {\r\n this._autoScrollCount--;\r\n const t = this._autoScrollCountMax - this._autoScrollCount;\r\n const dy = -(0, Math_1.linear)(t, 0, this.lineHeight(), this._autoScrollCountMax);\r\n this._textLines.forEach(line => {\r\n line.sprite.y = line.scrollStartY + dy;\r\n });\r\n if (this._autoScrollCount == 0) {\r\n // 1 Line scroll end\r\n const line = this._textLines.shift();\r\n (0, Common_1.assert)(line);\r\n this.releaseLineSprite(line.sprite);\r\n this._textLines[this._textLines.length - 1].sprite.visible = true;\r\n // スクロール完了時点の座標で、次回スクロール時の始点を確定する\r\n this._textLines.forEach(line => {\r\n line.scrollStartY = line.sprite.y;\r\n });\r\n this._autoCloseCount = this._autoCloseCountMax;\r\n return false;\r\n }\r\n else {\r\n return true;\r\n }\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n startNewMessageAndScroll() {\r\n var _a;\r\n const text = this._message.texts()[this._message._lastViewLineIndex + 1];\r\n const textState = this.createTextState(text, 0, 0, 0);\r\n textState.x = this.newLineX(textState);\r\n textState.startX = textState.x;\r\n textState.y = 0;\r\n textState.height = this.lineHeight(); //this.calcTextHeight(textState);\r\n const lineSprite = this.acquireLineSprite();\r\n (_a = lineSprite.bitmap) === null || _a === void 0 ? void 0 : _a.clear();\r\n //lineSprite.bitmap.drawText(text, 0, 0, 100, 30, \"left\");\r\n lineSprite.x = 0;\r\n lineSprite.height = textState.height;\r\n lineSprite.visible = true;\r\n // 新しい行スプライトの追加位置\r\n const lastSprite = (this._textLines.length > 0) ? this._textLines[this._textLines.length - 1].sprite : undefined;\r\n if (lastSprite) {\r\n lineSprite.y = lastSprite.y + lastSprite.height;\r\n }\r\n else {\r\n lineSprite.y = 0;\r\n }\r\n textState.sprite = lineSprite;\r\n textState.scrollStartY = lineSprite.y;\r\n this._textLines.push(textState);\r\n this._message._lastViewLineIndex++;\r\n if (this._textLines.length > this.maxLines()) {\r\n // Start scroll\r\n this._autoScrollCount = this._autoScrollCountMax;\r\n lineSprite.visible = false;\r\n }\r\n else {\r\n // 一度に複数行が add されたときに一度に表示せず、一行ずつすこし時間をおいて表示してみる\r\n this.startWait(10);\r\n this._autoCloseCount = this._autoCloseCountMax;\r\n }\r\n // Window_Message.updateMessage の処理\r\n {\r\n while (!this.isEndOfText(textState)) {\r\n this.processCharacter(textState);\r\n }\r\n this.flushTextState(textState);\r\n if (this.isEndOfText(textState) && !this.pause) {\r\n this.onEndOfText();\r\n }\r\n }\r\n this.open();\r\n }\r\n newLineX(textState) {\r\n return textState.rtl ? this.innerWidth - this.textPaddingX : this.textPaddingX;\r\n }\r\n canScrollStart() {\r\n return this.doesContinue() && this._autoScroll;\r\n }\r\n terminateMessage() {\r\n this.close();\r\n this._textLines.forEach(line => {\r\n this.releaseLineSprite(line.sprite);\r\n });\r\n this._textLines = [];\r\n }\r\n onEndOfText() {\r\n // Window_Message.onEndOfText() では選択肢など入力の開始処理を行っていたが、ここでは不要\r\n }\r\n // override\r\n processControlCharacter(textState, c) {\r\n Window_Base.prototype.processControlCharacter.call(this, textState, c);\r\n if (c === \"\\f\") {\r\n throw new Error(\"NewPage not supported.\");\r\n }\r\n }\r\n isEndOfText(textState) {\r\n return textState.index >= textState.text.length;\r\n }\r\n // override\r\n processEscapeCharacter(code, textState) {\r\n switch (code) {\r\n case \"C\": // override, textColor の対象を行 Sprite にする\r\n const bitmap = textState.sprite.bitmap;\r\n if (bitmap) {\r\n bitmap.textColor = ColorManager.textColor((this.obtainEscapeParam(textState)));\r\n }\r\n break;\r\n case \"$\":\r\n throw new Error(\"GoldWindow not supported.\");\r\n break;\r\n case \".\":\r\n this.startWait(15);\r\n break;\r\n case \"|\":\r\n this.startWait(60);\r\n break;\r\n case \"!\":\r\n throw new Error(\"StartPause not supported.\");\r\n break;\r\n case \">\":\r\n throw new Error(\"LineShowFast not supported.\");\r\n break;\r\n case \"<\":\r\n throw new Error(\"LineShowFast not supported.\");\r\n break;\r\n case \"^\":\r\n throw new Error(\"PauseSkip not supported.\");\r\n break;\r\n default:\r\n Window_Base.prototype.processEscapeCharacter.call(this, code, textState);\r\n break;\r\n }\r\n }\r\n // override\r\n // drawText() の対象を行 Sprite にする\r\n flushTextState(textState) {\r\n const text = textState.buffer;\r\n const rtl = textState.rtl;\r\n const width = this.textWidth(text);\r\n const height = textState.height;\r\n const x = rtl ? textState.x - width : textState.x;\r\n const y = textState.y;\r\n const bitmap = textState.sprite.bitmap;\r\n if (textState.drawing && bitmap) {\r\n bitmap.drawText(text, x, y, width, height, \"left\");\r\n }\r\n textState.x += rtl ? -width : width;\r\n textState.buffer = this.createTextBuffer(rtl);\r\n const outputWidth = Math.abs(textState.x - textState.startX);\r\n if (textState.outputWidth < outputWidth) {\r\n textState.outputWidth = outputWidth;\r\n }\r\n textState.outputHeight = y - textState.startY + height;\r\n }\r\n // override\r\n // drawIcon の対象を行 Sprite にする\r\n processDrawIcon(iconIndex, textState) {\r\n var _a;\r\n if (textState.drawing) {\r\n const x = textState.x + 2;\r\n const y = textState.y + 2;\r\n // Window_Base.prototype.drawIcon\r\n const bitmap = ImageManager.loadSystem(\"IconSet\");\r\n const pw = ImageManager.iconWidth;\r\n const ph = ImageManager.iconHeight;\r\n const sx = (iconIndex % 16) * pw;\r\n const sy = Math.floor(iconIndex / 16) * ph;\r\n (_a = textState.sprite.bitmap) === null || _a === void 0 ? void 0 : _a.blt(bitmap, sx, sy, pw, ph, x, y, pw, ph);\r\n }\r\n textState.x += ImageManager.iconWidth + 4;\r\n }\r\n startWait(count) {\r\n this._waitCount = count;\r\n }\r\n updateAutoClose() {\r\n if (!this._autoCloseEnabled)\r\n return;\r\n if (this._autoCloseCount > 0) {\r\n this._autoCloseCount--;\r\n if (this._autoCloseCount <= 0) {\r\n this.terminateMessage();\r\n }\r\n }\r\n }\r\n acquireLineSprite() {\r\n var _a, _b;\r\n if (this._lineSpriteCache.length > 0) {\r\n const sprite = this._lineSpriteCache.pop();\r\n (0, Common_1.assert)(sprite);\r\n (_a = sprite.bitmap) === null || _a === void 0 ? void 0 : _a.clear();\r\n return sprite;\r\n }\r\n else {\r\n const bitmap = new Bitmap((_b = this.lineWidth) !== null && _b !== void 0 ? _b : this.width, this.lineHeight());\r\n bitmap.fontSize = $gameSystem.mainFontSize();\r\n const sprite = new Sprite(bitmap);\r\n this._clientArea.addChild(sprite);\r\n return sprite;\r\n }\r\n }\r\n releaseLineSprite(sprite) {\r\n sprite.visible = false;\r\n this._lineSpriteCache.push(sprite);\r\n }\r\n}\r\nexports.VMessageLogWindow = VMessageLogWindow;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/window/windows/VMessageLogWindow.ts?"); /***/ }), /***/ "./ts/mr/view/window/windows/VMinimapWindow.ts": /*!*****************************************************!*\ !*** ./ts/mr/view/window/windows/VMinimapWindow.ts ***! \*****************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VMinimapWindow = void 0;\r\nconst MRLively_1 = __webpack_require__(/*! ts/mr/lively/MRLively */ \"./ts/mr/lively/MRLively.ts\");\r\nconst Tilemap_1 = __webpack_require__(/*! ts/mr/rmmz/Tilemap */ \"./ts/mr/rmmz/Tilemap.ts\");\r\nconst MRSystem_1 = __webpack_require__(/*! ts/mr/system/MRSystem */ \"./ts/mr/system/MRSystem.ts\");\r\nconst SView_1 = __webpack_require__(/*! ts/mr/system/SView */ \"./ts/mr/system/SView.ts\");\r\nclass VMinimapWindow extends Window_Base {\r\n constructor(rect) {\r\n var _a, _b;\r\n super(rect);\r\n this.setBackgroundType(2);\r\n //this._isWindow = false;\r\n this._initialUpdate = true;\r\n const width = (_a = $dataMap.width) !== null && _a !== void 0 ? _a : 1;\r\n const height = (_b = $dataMap.height) !== null && _b !== void 0 ? _b : 1;\r\n const depth = 4;\r\n const minimapData = new Array(width * height * 4);\r\n const x = 0;\r\n const y = 0;\r\n const z = 0;\r\n minimapData[(z * height + y) * width + x] = Tilemap.TILE_ID_A5 + 1;\r\n minimapData[(z * height + y) * width + x + 1] = Tilemap.TILE_ID_A5 + 1;\r\n this._minimapTilemap = new Tilemap();\r\n this._minimapTilemap.tileWidth = 12; //$gameMap.tileWidth();\r\n this._minimapTilemap.tileHeight = 12; //$gameMap.tileHeight();\r\n //this._minimapTilemap.setData($gameMap.width(), $gameMap.height(), $gameMap.data());\r\n this._minimapTilemap.setData(width, height, minimapData);\r\n this._minimapTilemap.horizontalWrap = $gameMap.isLoopHorizontal();\r\n this._minimapTilemap.verticalWrap = $gameMap.isLoopVertical();\r\n this._minimapTilemap.y = 0;\r\n this._minimapTilemap.scale.set(0.75, 0.75);\r\n //this._spritesetMap._baseSprite.addChild(this._minimapTilemap);\r\n //REVisual.scene._windowLayer.\r\n this.addChild(this._minimapTilemap);\r\n this._minimapTilemap.setRendererId(Tilemap_1.TilemapRendererId.Minimap);\r\n const bitmaps = [];\r\n const tilesetNames = [\"World_A1\", \"RE-Minimap_A2\", \"\", \"\", \"RE-Minimap_A5\", \"World_B\", \"World_C\", \"\", \"\"];\r\n for (const name of tilesetNames) {\r\n bitmaps.push(ImageManager.loadTileset(name));\r\n }\r\n this._minimapTilemap.setBitmaps(bitmaps);\r\n }\r\n get minimapData() {\r\n return MRSystem_1.MRSystem.minimapData;\r\n }\r\n update() {\r\n super.update();\r\n if (MRLively_1.MRLively.mapView.currentFloorId.isFieldMap) {\r\n this._minimapTilemap.visible = false;\r\n }\r\n else {\r\n this._minimapTilemap.visible = true;\r\n this.updateMinimap();\r\n }\r\n this._initialUpdate = false;\r\n }\r\n updateMinimap() {\r\n const minimap = this.minimapData;\r\n if (minimap.isTilemapResetNeeded() || this._initialUpdate) {\r\n this._minimapTilemap.setData(minimap.width(), minimap.height(), minimap.data());\r\n minimap.clearTilemapResetNeeded();\r\n }\r\n this._minimapTilemap.refresh();\r\n this._minimapTilemap.selfVisible = SView_1.SView.getTilemapView().visible;\r\n }\r\n}\r\nexports.VMinimapWindow = VMinimapWindow;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/window/windows/VMinimapWindow.ts?"); /***/ }), /***/ "./ts/mr/view/window/windows/VNicknameEditWindow.ts": /*!**********************************************************!*\ !*** ./ts/mr/view/window/windows/VNicknameEditWindow.ts ***! \**********************************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VNicknameEditWindow = void 0;\r\nclass VNicknameEditWindow extends Window_NameEdit {\r\n constructor(rect) {\r\n super(rect);\r\n }\r\n // Game_Actor ではなく Entity 用の setup。\r\n setupFromEntity(entity) {\r\n this._maxLength = 10;\r\n this._name = \"\";\r\n this._index = 0;\r\n this._defaultName = \"\";\r\n }\r\n // drawActorFace() しないようにする。\r\n refresh() {\r\n this.contents.clear();\r\n for (let i = 0; i < this._maxLength; i++) {\r\n this.drawUnderline(i);\r\n }\r\n for (let j = 0; j < this._name.length; j++) {\r\n this.drawChar(j);\r\n }\r\n const rect = this.itemRect(this._index);\r\n this.setCursorRect(rect.x, rect.y, rect.width, rect.height);\r\n }\r\n}\r\nexports.VNicknameEditWindow = VNicknameEditWindow;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/window/windows/VNicknameEditWindow.ts?"); /***/ }), /***/ "./ts/mr/view/window/windows/VQuestClassWindow.ts": /*!********************************************************!*\ !*** ./ts/mr/view/window/windows/VQuestClassWindow.ts ***! \********************************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VQuestClassWindow = void 0;\r\nclass VQuestClassWindow extends Window_Selectable {\r\n constructor(rect) {\r\n super(rect);\r\n this.refresh();\r\n }\r\n maxCols() {\r\n return 4;\r\n }\r\n maxItems() {\r\n return 4;\r\n }\r\n drawItem(index) {\r\n const rect = this.itemLineRect(index);\r\n this.drawIcon(100 + index, rect.x, rect.y);\r\n }\r\n}\r\nexports.VQuestClassWindow = VQuestClassWindow;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/window/windows/VQuestClassWindow.ts?"); /***/ }), /***/ "./ts/mr/view/window/windows/VQuestListWindow.ts": /*!*******************************************************!*\ !*** ./ts/mr/view/window/windows/VQuestListWindow.ts ***! \*******************************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VQuestListWindow = void 0;\r\nclass VQuestListWindow extends Window_Selectable {\r\n constructor(rect) {\r\n super(rect);\r\n this.refresh();\r\n }\r\n maxItems() {\r\n return 4;\r\n }\r\n drawItem(index) {\r\n const rect = this.itemLineRect(index);\r\n this.drawIcon(100 + index, rect.x, rect.y);\r\n }\r\n}\r\nexports.VQuestListWindow = VQuestListWindow;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/window/windows/VQuestListWindow.ts?"); /***/ }), /***/ "./ts/mr/view/window/windows/VSelectableWindow.ts": /*!********************************************************!*\ !*** ./ts/mr/view/window/windows/VSelectableWindow.ts ***! \********************************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.VISelectableWindow = void 0;\r\n/**\r\n * Window_Selectable に対して、MVP の仕組みで使う共通機能を追加したクラス。\r\n */\r\nclass VISelectableWindow extends Window_Selectable {\r\n constructor(rect) {\r\n super(rect);\r\n this.selectionChanged = () => { };\r\n }\r\n select(index) {\r\n super.select(index);\r\n if (this.selectionChanged) {\r\n this.selectionChanged();\r\n }\r\n }\r\n ;\r\n}\r\nexports.VISelectableWindow = VISelectableWindow;\r\n\n\n//# sourceURL=webpack://MysteryRogueSystem/./ts/mr/view/window/windows/VSelectableWindow.ts?"); /***/ }), /***/ "fs": /*!*********************!*\ !*** external "fs" ***! \*********************/ /***/ ((module) => { "use strict"; module.exports = require("fs"); /***/ }), /***/ "path": /*!***********************!*\ !*** external "path" ***! \***********************/ /***/ ((module) => { "use strict"; module.exports = require("path"); /***/ }), /***/ "url": /*!**********************!*\ !*** external "url" ***! \**********************/ /***/ ((module) => { "use strict"; module.exports = require("url"); /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ var cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? /******/ () => (module['default']) : /******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ /******/ /******/ // startup /******/ // Load entry module and return exports /******/ // This entry module is referenced by other modules so it can't be inlined /******/ var __webpack_exports__ = __webpack_require__("./ts/main.ts"); /******/ /******/ })() ;