var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = 
{
    "init": function () {

	console.log("插件编写测试");

	this._afterLoadResources = function () {
		// 本函数将在所有资源加载完毕后，游戏开启前被执行
		// 可以在这个函数里面对资源进行一些操作。
		// 若需要进行切分图片，可以使用 core.splitImage() 函数，或直接在全塔属性-图片切分中操作
		// 

		core.ui.statusBar.init();
	}

	// 可以在任何地方（如afterXXX或自定义脚本事件）调用函数，方法为 core.plugin.xxx();
	// 从V2.6开始，插件中用this.XXX方式定义的函数也会被转发到core中，详见文档-脚本-函数的转发。
},
    "resizeTo11": function () {
	if (main.mode == 'editor') {
		return;
	}

	// 在不修改libs的情况下将页面适配为11x11
	core.__SIZE__ = 11;
	core.__PIXELS__ = core.__SIZE__ * 32;
	core.__HALF_SIZE__ = 5;
	// core.bigmap.width = core.__SIZE__;
	// core.bigmap.height = core.__SIZE__;
	core.actions.SIZE = core.__SIZE__;
	core.actions.HSIZE = core.__HALF_SIZE__;
	core.actions.LAST = core.__SIZE__ - 1;
	core.actions.CHOICES_LEFT = 3;
	core.actions.CHOICES_RIGHT = core.actions.LAST - core.actions.CHOICES_LEFT;
	core.ui.SIZE = core.__SIZE__;
	core.ui.HSIZE = core.__HALF_SIZE__;
	core.ui.LAST = core.__SIZE__ - 1;
	core.ui.PIXEL = core.__PIXELS__;
	core.ui.HPIXEL = core.__PIXELS__ / 2;
},
    "statusBar": function () {
	main.dom.floorMsgGroup.style.display = 'none';
	main.dom.statusBar.style.display = 'none';
	main.dom.toolBar.style.display = 'none';

	var outerBackground = document.createElement('canvas');
	outerBackground.style.position = 'absolute';
	outerBackground.style.zIndex = 5;
	outerBackground.width = 640;
	outerBackground.height = 422;
	outerBackground.id = 'outerBackground';
	main.dom.outerBackground = outerBackground;
	main.dom.startPanel.insertAdjacentElement('afterend', outerBackground);

	var outerUI = document.createElement('canvas');
	outerUI.style.position = 'absolute';
	outerUI.style.zIndex = 165;
	outerUI.width = 640;
	outerUI.height = 422;
	outerUI.id = 'outerUI';
	main.dom.outerUI = outerUI;
	outerBackground.insertAdjacentElement('afterend', outerUI);
	setTimeout(function () {
		// Should be executed immediately after init()
		main.canvas.outerUI = outerUI.getContext('2d');
	});
	outerUI.onclick = function (e) {
		try {
			e.preventDefault();
			if (!core.isPlaying()) return false;
			var left = core.dom.gameGroup.offsetLeft + 3;
			var top = core.dom.gameGroup.offsetTop + 3;
			var px = parseInt((e.clientX - left) / core.domStyle.scale),
				py = parseInt((e.clientY - top) / core.domStyle.scale);
			core.ui.statusBar.onclick(px, py);
		} catch (ee) {
			main.log(ee);
		}
	}

	var _resize_gameGroup = function (obj) {
		var gameGroup = core.dom.gameGroup;
		gameGroup.style.width = obj.totalWidth + "px";
		gameGroup.style.height = obj.totalHeight + "px";
		gameGroup.style.left = (obj.clientWidth - obj.totalWidth) / 2 + "px";
		gameGroup.style.top = (obj.clientHeight - obj.totalHeight) / 2 + "px";

		core.dom.musicBtn.style.right = (obj.clientWidth - obj.totalWidth) / 2 + "px";
		core.dom.musicBtn.style.bottom = (obj.clientHeight - obj.totalHeight) / 2 - 27 + "px";
		core.dom.enlargeBtn.style.right = (obj.clientWidth - obj.totalWidth) / 2 + 31 + "px";
		core.dom.enlargeBtn.style.bottom = (obj.clientHeight - obj.totalHeight) / 2 - 27 + "px";

		main.dom.startBackground.src = main.styles.startBackground;
	}

	var _resize_canvas = function (obj) {
		main.dom.outerBackground.style.width = obj.totalWidth + 'px';
		main.dom.outerBackground.style.height = obj.totalHeight + 'px';
		main.dom.outerUI.style.width = obj.totalWidth + 'px';
		main.dom.outerUI.style.height = obj.totalHeight + 'px';

		var innerSize = (obj.canvasWidth * core.domStyle.scale) + "px";
		for (var i = 0; i < core.dom.gameCanvas.length; ++i)
			core.dom.gameCanvas[i].style.width = core.dom.gameCanvas[i].style.height = innerSize;
		core.dom.gif.style.width = core.dom.gif.style.height = innerSize;
		core.dom.gif2.style.width = core.dom.gif2.style.height = innerSize;
		core.dom.gameDraw.style.width = core.dom.gameDraw.style.height = innerSize;
		core.dom.gameDraw.style.top = obj.borderHeight * core.domStyle.scale + "px";
		core.dom.gameDraw.style.right = (obj.borderWidth + obj.barWidth + 1) * core.domStyle.scale + "px";

		// resize bigmap
		core.bigmap.canvas.forEach(function (cn) {
			var ratio = core.canvas[cn].canvas.hasAttribute('isHD') ? core.domStyle.ratio : 1;
			core.canvas[cn].canvas.style.width = core.canvas[cn].canvas.width / ratio * core.domStyle.scale + "px";
			core.canvas[cn].canvas.style.height = core.canvas[cn].canvas.height / ratio * core.domStyle.scale + "px";
		});
		// resize dynamic canvas
		for (var name in core.dymCanvas) {
			var ctx = core.dymCanvas[name],
				canvas = ctx.canvas;
			var ratio = canvas.hasAttribute('isHD') ? core.domStyle.ratio : 1;
			canvas.style.width = canvas.width / ratio * core.domStyle.scale + "px";
			canvas.style.height = canvas.height / ratio * core.domStyle.scale + "px";
			canvas.style.left = parseFloat(canvas.getAttribute("_left")) * core.domStyle.scale + "px";
			canvas.style.top = parseFloat(canvas.getAttribute("_top")) * core.domStyle.scale + "px";
		}
		// resize next
		main.dom.next.style.width = main.dom.next.style.height = 5 * core.domStyle.scale + "px";
		main.dom.next.style.borderBottomWidth = main.dom.next.style.borderRightWidth = 4 * core.domStyle.scale + "px";

	}

	core.control.resize = function () {
		if (main.mode == 'editor') return;

		var clientWidth = main.dom.body.clientWidth,
			clientHeight = main.dom.body.clientHeight;
		var canvasWidth = core.__PIXELS__,
			barWidth = 125;
		var borderWidth = 19,
			borderHeight = 24,
			infoBarHeight = 22;

		var horizontalMaxRatio = clientHeight / (canvasWidth + infoBarHeight + 2 * borderHeight);

		core.domStyle.isVertical = false;
		core.domStyle.availableScale = [];
		[1, 1.25, 1.5, 1.75, 2].forEach(function (v) {
			if (clientWidth >= v * (canvasWidth + barWidth * 2 + borderWidth * 2) && horizontalMaxRatio >= v) {
				core.domStyle.availableScale.push(v);
			}
		});

		if (core.domStyle.availableScale.indexOf(core.domStyle.scale) < 0) {
			core.domStyle.scale = Math.min(1, horizontalMaxRatio);
		} else if (core.getLocalStorage('scale') == null && core.domStyle.availableScale.length >= 2) {
			core.domStyle.scale = core.domStyle.availableScale[core.domStyle.availableScale.length - 2];
			core.setLocalStorage('scale', core.domStyle.scale);
		}

		var totalWidth = (canvasWidth + 2 * barWidth + 2 * borderWidth) * core.domStyle.scale;
		var totalHeight = (canvasWidth + 2 * borderHeight + infoBarHeight) * core.domStyle.scale;

		var obj = {
			clientWidth: clientWidth,
			clientHeight: clientHeight,
			canvasWidth: canvasWidth,
			barWidth: barWidth,
			borderWidth: borderWidth,
			borderHeight: borderHeight,
			infoBarHeight: infoBarHeight,
			totalWidth: totalWidth,
			totalHeight: totalHeight,
			globalAttribute: core.status.globalAttribute || core.initStatus.globalAttribute,
		};

		_resize_gameGroup(obj);
		_resize_canvas(obj);

		if (core.status.automaticRoute == null) core.status.automaticRoute = {};
		core.control.setViewport(32, 32);
		core.updateStatusBar();
	}

	function statusBar() {
		this.itemMx = [
			["book", "wand", "fly"],
			["cross", "superPotion", "pickaxe"],
			["bomb", "centerFly", "upFly"],
			["downFly", "knife", "snow"],
			["bigKey", "earthquake", "coin"],
			["Heros", "Skills", "Pows"]
		];
	}

	statusBar.prototype.init = function () {
		var bgctx = document.getElementById("outerBackground").getContext("2d");
		var bg = core.material.images.images["statusBackground.jpg"];
		if (core.status.hero && flags.turn2)
			bg = core.material.images.images["statusBackground2.jpg"];
		bgctx.drawImage(bg, 0, 0, 640, 400);
		bgctx.fillStyle = "#676767";
		bgctx.fillRect(0, 400, 640, 22);
		core.setTextAlign('outerUI', 'center');

		this.toolbarAction = [
			[main.core.openKeyBoard, main.core.openQuickShop, function () { core.insertAction([{ type: "insert", name: "游戏说明" }]); }],
			[main.core.save, main.core.load, main.core.openSettings]
		];
		this.replayAction = [
			[core.triggerReplay, core.stopReplay, core.rewindReplay],
			[core.speedDownReplay, core.speedUpReplay, core.saveReplay]
		];
	}

	statusBar.prototype.update = function () {
		this._update_props();
		this._update_items();
		this._update_equips();
		this._update_keys();
		this._update_infoWindow();
		this._update_my();
	}

	statusBar.prototype._update_my = function () {
		if (flags.update == 1) {
			core.setAlpha("outerUI", 0.3)
			core.fillRoundRect("outerUI", 10, 5, 100, 60, 5, '#ff8080')
			core.setAlpha("outerUI", 1)
			core.strokeRoundRect("outerUI", 10, 5, 100, 60, 5, '#ff8080', 3)
			core.fillBoldText("outerUI", '楼传界面', 10 + 50, 5 + 40, '#ff8080', '#808080', "bold 20px Verdana")
		}
		if (flags.update == 2) {
			core.setAlpha("outerUI", 0.3)
			core.fillRoundRect("outerUI", 10, 75, 100, 90, 5, '#ff8080')
			core.setAlpha("outerUI", 1)
			core.strokeRoundRect("outerUI", 10, 75, 100, 90, 5, '#ff8080', 3)
			core.fillBoldText("outerUI", '技能升级', 10 + 50, 75 + 40, '#ff8080', '#808080', "bold 20px Verdana")
		}
		if (flags.update == 3) {
			core.setAlpha("outerUI", 0.3)
			core.fillRoundRect("outerUI", 520, 5, 105, 120, 5, '#ff8080')
			core.setAlpha("outerUI", 1)
			core.strokeRoundRect("outerUI", 520, 5, 105, 120, 5, '#ff8080', 3)
			core.fillBoldText("outerUI", '切换角色', 520 + 50, 5 + 40, '#ff8080', '#808080', "bold 20px Verdana")
		}
		if (flags.update == 4) {
			core.setAlpha("outerUI", 0.3)
			core.fillRoundRect("outerUI", 520, 140, 105, 65, 5, '#ff8080')
			core.setAlpha("outerUI", 1)
			core.strokeRoundRect("outerUI", 520, 140, 105, 65, 5, '#ff8080', 3)
			core.fillBoldText("outerUI", '出售钥匙', 520 + 50, 140 + 40, '#ff8080', '#808080', "bold 20px Verdana")
		}
		if (flags.update == 5) {
			core.setAlpha("outerUI", 0.3)
			core.fillRoundRect("outerUI", 520, 220, 105, 85, 5, '#ff8080')
			core.setAlpha("outerUI", 1)
			core.strokeRoundRect("outerUI", 520, 220, 105, 85, 5, '#ff8080', 3)
			core.fillBoldText("outerUI", '自动拾取', 520 + 50, 230 + 40, '#ff8080', '#808080', "bold 20px Verdana")
		}
	}

	// 更新属性
	statusBar.prototype._update_props = function (updatedFloorTitle) {
		core.clearMap("outerUI", 10, 10, 105, 160);
		var tc = "#E1E1E1";
		core.setFont("outerUI", 'bold 16px Verdana');
		// 设置楼层名
		if (!updatedFloorTitle && core.status.floorId) {
			updatedFloorTitle = core.status.maps[core.status.floorId].title;
		}
		if (flags.turn2) {
			updatedFloorTitle = '魔塔 第' + core.floorIds.indexOf(core.status.floorId) + '层';
			/*for (var i in core.floorIds) {
				//console.log('MT' + i)
				if (core.floorIds[i] == core.status.floorId)
					updatedFloorTitle = '魔塔 第' + core.floorIds.indexOf(core.status.floorId) + '层';
			}*/
		}
		if (updatedFloorTitle) {
			core.fillText("outerUI", updatedFloorTitle, 62, 61, tc);
		}
		//难度
		if (flags.turn2) {
			core.fillText("outerUI", '第 ' + (flags.turn2 + 1) + ' 周目', 62, 31, tc);
		} else if (flags.harddddd)
			core.fillText("outerUI", '普通模式', 62, 31, tc);
		else
			core.fillText("outerUI", '简单模式', 62, 31, tc);

		var statusList = ['hp', 'atk', 'def', 'money'];
		var curh = 93;
		core.setTextAlign('outerUI', 'right');
		statusList.forEach(function (item) {
			// 四舍五入
			core.status.hero[item] = Math.round(core.status.hero[item]);
			// 大数据格式化
			core.fillText("outerUI", core.formatBigNumber(core.getRealStatus(item)), 110, curh, tc);
			curh += 24;
		});

		core.setTextAlign('outerUI', 'center');
	}

	statusBar.prototype._update_items = function () {
		core.clearMap("outerUI", 10, 180, 105, 185 + 20);
		for (var i = 0; i < this.itemMx.length; i++) {
			for (var j = 0; j < this.itemMx[i].length; j++) {
				var item = this.itemMx[i][j];
				if (core.hasItem(item)) {
					var icon = core.material.icons.items[item],
						image = core.material.images.items;
					var posx = 13 + j * 33,
						posy = 190 + i * 32;
					if (core.inArray(flags.skill1, "破墙镐精通") && item === 'pickaxe')
						core.drawImage('outerUI', 'pickaxeSp.png', 0, 0, 32, 32, posx, posy, 32, 32);
					else if (core.inArray(flags.skill1, "炸弹精通") && item === 'bomb')
						core.drawImage('outerUI', 'boomSp.png', 0, 0, 32, 32, posx, posy, 32, 32);
					else if (flags.turn2 && item === 'wand')
						core.drawIcon('outerUI', 'SuperBall', posx, posy, 32, 32);
					else if (item === 'Skills') {
						if (flags.theHero == 'child')
							core.drawImage('outerUI', 'levelup1.png', 0, 0, 32, 32, posx, posy, 32, 32);
						else if (flags.theHero == 'thief')
							core.drawImage('outerUI', 'levelup2.png', 0, 0, 32, 32, posx, posy, 32, 32);
						else if (flags.theHero == 'woman')
							core.drawImage('outerUI', 'levelup3.png', 0, 0, 32, 32, posx, posy, 32, 32);
						else if (flags.theHero == 'man')
							core.drawImage('outerUI', 'levelup4.png', 0, 0, 32, 32, posx, posy, 32, 32);
						else if (flags.theHero == 'princess')
							core.drawImage('outerUI', 'levelup5.png', 0, 0, 32, 32, posx, posy, 32, 32);
						else if (flags.theHero == 'fairy')
							core.drawImage('outerUI', 'levelup6.png', 0, 0, 32, 32, posx, posy, 32, 32);
					} else if (item === 'Pows') {
						if (flags.theHero == 'child' && core.inArray(flags.skill1, "超·觉醒") && core.hasItem('POW1'))
							core.drawImage('outerUI', 'POW1.png', 0, 0, 32, 32, posx, posy, 32, 32);
						else if (flags.theHero == 'thief' && core.inArray(flags.skill1, "大崩坏") && core.hasItem('POW2'))
							core.drawImage('outerUI', 'POW2.png', 0, 0, 32, 32, posx, posy, 32, 32);
						else if (flags.theHero == 'woman' && core.inArray(flags.skill1, "渎神") && core.hasItem('POW3'))
							core.drawImage('outerUI', 'POW3.png', 0, 0, 32, 32, posx, posy, 32, 32);
						else if (flags.theHero == 'man' && core.inArray(flags.skill1, "大退化术") && core.hasItem('POW4'))
							core.drawImage('outerUI', 'POW4.png', 0, 0, 32, 32, posx, posy, 32, 32);
						else if (flags.theHero == 'princess' && core.inArray(flags.skill1, "女武神") && core.hasItem('POW5'))
							core.drawImage('outerUI', 'POW5.png', 0, 0, 32, 32, posx, posy, 32, 32);
						else if (flags.theHero == 'fairy' && core.inArray(flags.skill1, "天国の门") && core.hasItem('POW6'))
							core.drawImage('outerUI', 'POW6.png', 0, 0, 32, 32, posx, posy, 32, 32);
					} else
						core.drawImage('outerUI', image, 0, 32 * icon, 32, 32, posx, posy, 32, 32);
					if (core.inArray(["downFly", "upFly", "centerFly", "superPotion", "pickaxe", "bomb"], item) && core.itemCount(item) > 1)
						core.fillText('outerUI', core.itemCount(item), posx + 25, posy + 28, '#FFFFFF', "bold 12px Verdana");

					if (item === 'Skills' && hero.money >= Math.max(0, 20 + 10 * flags.lv * (flags.lv - 1) - flags.manmoney)) {
						core.drawImage('outerUI', 'canUp.png', 0, 0, 32, 32, posx, posy, 32, 32);
						core.drawMyCircle('outerUI', posx + 5, posy + 5);
					}

					// if (this.selectId == item)
					//     core.strokeRect('outerUI', posx + 17, posy - 4, 40, 40, '#FFD700');
				}
			}
		}
	}

	statusBar.prototype._update_equips = function () {
		var atk = 0;
		var def = 0;
		if (flags.theHero == 'child') {
			if (core.inArray(flags.skill1, "剑御者I"))
				atk += 10;
			if (core.inArray(flags.skill1, "剑御者II"))
				atk += 20;
			if (core.inArray(flags.skill1, "剑御者III"))
				atk += 40;
			if (core.inArray(flags.skill1, "盾御者I"))
				def += 20;
			if (core.inArray(flags.skill1, "盾御者II"))
				def += 40;
			if (core.inArray(flags.skill1, "盾御者III"))
				def += 80;
		}
		core.clearMap("outerUI", 525, 10, 105, 95 + 30);
		core.setFont("outerUI", 'bold 16px Verdana');
		var drawEquip = function (baseX, baseY, id, color, back) {
			if (!id) core.fillText("outerUI", back, baseX + 50, baseY + 22, color);
			else {
				core.fillText("outerUI", core.material.items[id].name, baseX + 32, baseY + 22 - 10, color);
				if (color === "#FFCFAE" && baseY == 48) {
					if (flags.nowWeapon)
						core.fillText("outerUI", Math.ceil(Number(core.material.items[flags.nowWeapon].canUseItemEffect) / 10) + atk + "攻", baseX + 32, baseY + 22 + 10, color);
					else
						core.fillText("outerUI", "0攻", baseX + 32, baseY + 22 + 20, color);
				}
				if (color === "#FFCFAE" && baseY == 96) {
					if (flags.nowWeapon)
						core.fillText("outerUI", (Math.ceil(Number(core.material.items[flags.nowWeapon].canUseItemEffect) / 10) + atk) / 2 + "攻", baseX + 32, baseY + 22 + 10, color);
					else
						core.fillText("outerUI", "0攻", baseX + 32, baseY + 22 + 20, color);
				}
				if (color === "#D1CEFF") {
					if (flags.nowShield)
						core.fillText("outerUI", Math.ceil(Number(core.material.items[flags.nowShield].canUseItemEffect) / 10) + def + "防", baseX + 32, baseY + 22 + 10, color);
					else
						core.fillText("outerUI", "0防", baseX + 32, baseY + 22 + 20, color);
				}
				var icon = core.material.icons.items[id];
				core.drawImage('outerUI', core.material.images.items, 0, 32 * icon, 32, 32, baseX + 64, baseY, 32, 32);
			}
		}
		drawEquip(525, 48, core.getFlag("nowWeapon"), "#FFCFAE", "无武器");
		if (flags.theHero === 'thief' && core.inArray(flags.skill1, "双刀流"))
			drawEquip(525, 96, core.getFlag("nowShield"), "#FFCFAE", "无武器");
		else
			drawEquip(525, 96, core.getFlag("nowShield"), "#D1CEFF", "无防具");

		core.fillText("outerUI", hero.name, 575 - 18, 32, '#E1E1E1');
		var heroid = ['child', 'thief', 'woman', 'man', 'princess', 'fairy']
		var iconskill = ['神剑战士', '怪盗杰克', '炼金术士', '传奇法师', '最终兵器', '湖中仙女']
		var icon = '';
		for (var i in heroid) {
			if (flags.theHero == heroid[i] && core.inArray(flags.skill1, iconskill[i]))
				icon = '2';
		}
		core.drawImage('outerUI', flags.theHero + icon + '.png', 0, 0, 32, 18, 575 + 14, 32 - 16, 32, 18);
	}

	statusBar.prototype._update_keys = function () {
		core.clearMap("outerUI", 525, 140, 105, 75);
		if (core.itemCount('yellowKey') + core.itemCount('blueKey') + core.itemCount('redKey') < 28) {
			var todraw = [],
				keyList = ['yellowKey', 'blueKey', 'redKey'];
			keyList.forEach(function (key, i) {
				todraw[i] = core.itemCount(key);
			});
			var baseX = 528,
				baseY = 142,
				dn = 2,
				dc = 0;
			while (dn >= 0 && dc < 28) {
				if (todraw[dn]) {
					this.drawKey(keyList[dn], baseX + (dc % 7) * 14, baseY + parseInt(dc / 7) * 17);
					todraw[dn]--, dc++;
				} else dn--;
			}
		} else {
			core.setTextAlign('outerUI', 'left');
			core.drawIcon('outerUI', "yellowKey", 528, 142, 25, 25);
			core.drawIcon('outerUI', "blueKey", 528, 142 + 20, 25, 25);
			core.drawIcon('outerUI', "redKey", 528, 142 + 40, 25, 25);
			core.fillText("outerUI", '×' + core.itemCount('yellowKey'), 505 + 50, 140 + 20, "#FFCFAE")
			core.fillText("outerUI", '×' + core.itemCount('blueKey'), 505 + 50, 140 + 40, "#D1CEFF")
			core.fillText("outerUI", '×' + core.itemCount('redKey'), 505 + 50, 140 + 60, "#FF8080")
			core.setTextAlign('outerUI', "center");
		}
	}

	statusBar.prototype.drawKey = function (key, x, y) {
		var sx = 3,
			sy = 0;
		if (key == "blueKey") sx += 16;
		else if (key == "yellowKey") sy += 16;
		core.drawImage("outerUI", core.statusBar.icons.keys, sx, sy, 10, 16, x, y, 10, 16);
	}

	statusBar.prototype._update_infoWindow = function () {
		core.clearMap("outerUI", 525, 220, 105, 100);
		this.selectedItem = null;
	}

	statusBar.prototype.showInfo = function (itemId) {
		core.clearMap("outerUI", 525, 220, 105, 100);
		if (itemId === 'wand' && flags.turn2) {
			itemId = 'SuperBall';
		}
		if (itemId === 'Pows') {
			if (flags.theHero == 'child' && core.inArray(flags.skill1, "超·觉醒") && core.hasItem('POW1')) {
				itemId = 'POW1';
				core.addItem(itemId, -1);
			} else if (flags.theHero == 'thief' && core.inArray(flags.skill1, "大崩坏") && core.hasItem('POW2')) {
				itemId = 'POW2';
				core.addItem(itemId, -1);
			} else if (flags.theHero == 'woman' && core.inArray(flags.skill1, "渎神") && core.hasItem('POW3')) {
				itemId = 'POW3';
				core.addItem(itemId, -1);
			} else if (flags.theHero == 'man' && core.inArray(flags.skill1, "大退化术") && core.hasItem('POW4')) {
				itemId = 'POW4';
				core.addItem(itemId, -1);
			} else if (flags.theHero == 'princess' && core.inArray(flags.skill1, "女武神") && core.hasItem('POW5')) {
				itemId = 'POW5';
				core.addItem(itemId, -1);
			} else if (flags.theHero == 'fairy' && core.inArray(flags.skill1, "天国の门") && core.hasItem('POW6')) {
				itemId = 'POW6';
				core.addItem(itemId, -1);
			} else
				return;
		}
		var icon = core.material.icons.items[itemId];
		core.fillText("outerUI", core.material.items[itemId].name, 525 + 32, 220 + 25, "#D1CEFF");
		core.drawImage('outerUI', core.material.images.items, 0, 32 * icon, 32, 32, 525 + 64, 224, 32, 32);
		core.ui.drawTextContent("outerUI", core.material.items[itemId].text, {
			left: 526,
			top: 256,
			maxWidth: 105,
			color: "#D1CEFF"
		});
		this.selectedItem = itemId;
	}

	statusBar.prototype._update_toolBox = function () {
		core.clearMap("outerUI", 520, 310, 115, 80);
		var tools = [];
		if (core.isReplaying()) {
			tools = [
				[core.status.replay.pausing ? "play" : "pause", "stop", "rewind"],
				["speedDown", "speedUp", "save"],
			]
		} else {
			tools = [
				["keyboard", "shop", "help"],
				["save", "load", "settings"],
			]
		}
		for (var i = 0; i < tools.length; i++) {
			for (var j = 0; j < tools[i].length; j++) {
				core.drawIcon("outerUI", tools[i][j], 525 + j * 34, 318 + i * 34, 32, 32);
			}
		}
	}

	statusBar.prototype.onclick = function (x, y) {
		//console.log("x:" + x + ",y:" + y)
		if (x >= 10 && x <= 10 + 32 && y >= 188 && y <= 188 + 32) {
			if (core.status.event.id == 'viewMaps') {
				core.openBook(false);
				return;
			} else if (core.status.event.id == 'book') {
				actions.prototype._keyUpBook(88);
				return;
			}
		}
		if (x <= 112 && x >= 13 && y <= 380 && y >= 190) {
			if (core.isReplaying() || core.status.lockControl || core.isMoving()) return;
			var itemId = this.itemMx[parseInt((y - 190) / 32)][parseInt((x - 13) / 33)];
			if (!core.hasItem(itemId)) return;
			if (core.material.items[itemId].cls == "constants") {
				switch (itemId) {
				case "book":
					core.openBook(true);
					break;
				case "fly":
					core.useFly(true);
					break;
				case "wand": {
					if (!flags.turn2) {
						core.useItem("wand");
					} else {
						core.useItem("SuperBall");
					}
				}
				break;
				case "snow":
					core.useItem("snow");
					break;
				case "Heros":
					core.useItem("Heros");
					break;
				case "Skills":
					core.useItem("Skills");
					break;
				case "Pows": {
					if (flags.theHero == 'child' && core.inArray(flags.skill1, "超·觉醒") && core.hasItem('POW1'))
						core.useItem("POW1");
					else if (flags.theHero == 'thief' && core.inArray(flags.skill1, "大崩坏") && core.hasItem('POW2'))
						core.useItem("POW2");
					else if (flags.theHero == 'woman' && core.inArray(flags.skill1, "渎神") && core.hasItem('POW3'))
						core.useItem("POW3");
					else if (flags.theHero == 'man' && core.inArray(flags.skill1, "大退化术") && core.hasItem('POW4'))
						core.useItem("POW4");
					else if (flags.theHero == 'princess' && core.inArray(flags.skill1, "女武神") && core.hasItem('POW5'))
						core.useItem("POW5");
					else if (flags.theHero == 'fairy' && core.inArray(flags.skill1, "天国の门") && core.hasItem('POW6'))
						core.useItem("POW6");
				}
				break;
				default:
					this.showInfo(itemId);
				}
			} else if (itemId != this.selectedItem) {
				this.showInfo(itemId);
			} else {
				switch (itemId) {
				case "centerFly":
					core.ui._drawCenterFly();
					break;
				default:
					core.useItem(itemId);
				}
			}
			this.showInfo(itemId);
			return;
		}
		if (x <= 625 && x >= 525 && y <= 382 && y >= 317) {
			//console.log(111)
			var row = parseInt((x - 525) / 32),
				col = parseInt((y - 317) / 32);
			if (core.isReplaying()) {
				this.replayAction[col][row].call(core);
			} else if (core.isPlaying()) {
				//console.log(col + ',' + row)
				if (col != 0 || row == 0 || core.status.event.id == null)
					this.toolbarAction[col][row].call(core, true);
				if (col == 0 && row == 1)
					core.status.route.push("key:86");
			}
			return;
		}
		if (x >= 520 && x <= 625 && y >= 140 && y <= 205) {
			if (core.status.event.id === 'mySellKey')
				core.quit_mySellKey();
			else if (!core.status.lockControl)
				core.mySellKey();
			return;
		}
		if (x >= 520 && x <= 625 && y >= 220 && y <= 305) {
			core.autoGetItem();
			core.status.route.push("key:32");
			return;
		}
		if (x >= 10 && x <= 110 && y >= 75 && y <= 165) {
			if (core.hasItem('Skills')) {
				if (core.status.event.id === 'myskilltree')
					core.quit_myskilltree();
				else if (!core.status.lockControl)
					core.myskilltree();
			}
			return;
		}
		if (x >= 520 && x <= 625 && y >= 5 && y <= 125) {
			if (core.hasItem('Heros')) {
				if (core.status.event.id === 'mychangeHero')
					core.quit_mychangeHero();
				else if (!core.status.lockControl)
					core.mychangeHero();
			}
			return;
		}
		if (x >= 10 && x <= 110 && y >= 5 && y <= 65) {
			if (!core.status.lockControl) {
				if (core.canMoveFloor())
					core.ui._drawViewMaps(core.floorIds.indexOf(core.status.floorId))
				else
					core.drawTip('因为无法瞬移到楼梯口，无法打开预览')
			} else if (core.status.event.id == 'viewMaps') {
				core.clearMap('data');
				core.playSound('取消');
				core.ui.closePanel();
			}
			/*if (core.hasItem('fly')) {
				if (core.status.event.id === 'fly')
					core.useFly(true);
				else if (!core.status.lockControl) {
					core.useFly(true);
				}
			} else {
				core.ui._drawViewMaps(core.floorIds.indexOf(core.status.floorId))
			}*/
			return;
		}
	}

	statusBar.prototype.print = function (text, cnt) {
		if (!text) {
			var _this = this;
			setTimeout(function () {
				if (!_this.infocnt) core.clearMap("outerUI", 0, 400, 640, 22);
			}, 200);
			this.infocnt = 0;
			return;
		}
		core.clearMap("outerUI", 0, 400, 640, 22);
		core.setFont("outerUI", 'bold 16px Verdana');
		core.setTextAlign('outerUI', 'left');
		core.fillText("outerUI", text, 10, 416, "#E1E1E1");
		core.setTextAlign('outerUI', 'center');
		this.infocnt = cnt || 1;
	}

	statusBar.prototype.infoRules = [
		{ id: "lava", text: "岩浆好热啊!" },
		{ id: "upFloor", text: "你看到了楼梯" },
		{ id: "downFloor", text: "你看到了楼梯" },
		{ id: "blueShop", text: "你看到了一个祭坛" },
		{ id: "man", text: "你看到了一个老人" },
		{ id: "woman", text: "你看到了一个商人" },
		{ id: "fairy", text: "你看到了一个妖精" },
		{ id: "thief", text: "你看到了一个小偷" },
	]

	statusBar.prototype.printEnvironmentInfo = function () {
		if (!this.infocnt) {
			var ids = [];
			for (var i in core.status.thisMap.blocks) {
				var block = core.status.thisMap.blocks[i];
				if (!block.disable && core.nearHero(block.x, block.y)) ids.push(block.event.id);
			}
			for (var i in this.infoRules) {
				if (ids.indexOf(this.infoRules[i].id) >= 0) {
					this.print(this.infoRules[i].text);
					return;
				}
			}
		}
	}

	statusBar.prototype.clearInfo = function (etype) {
		if (this.infocnt == 1) this.print();
		else if (this.infocnt > 1) this.infocnt--;
	}

	core.ui.statusBar = new statusBar();

	core.control.clearStatusBar = function () {
		core.clearMap("outerUI");
	}
	// init() called in `afterLoadResources`.
},
    "override": function () {

	core.statusBar.icons = {
		'floor': 0,
		'name': null,
		'lv': 1,
		'hpmax': 2,
		'hp': 3,
		'atk': 4,
		'def': 5,
		'mdef': 6,
		'money': 7,
		'experience': 8,
		'up': 9,
		'book': 10,
		'fly': 11,
		'toolbox': 12,
		'keyboard': 13,
		'shop': 14,
		'save': 15,
		'load': 16,
		'settings': 17,
		'play': 18,
		'pause': 19,
		'stop': 20,
		'speedDown': 21,
		'speedUp': 22,
		'rewind': 23,
		'equipbox': 24,
		'mana': 25,
		'skill': 26,
		'paint': 27,
		'erase': 28,
		'empty': 29,
		'exit': 30,
		'btn1': 31,
		'btn2': 32,
		'btn3': 33,
		'btn4': 34,
		'btn5': 35,
		'btn6': 36,
		'btn7': 37,
		'btn8': 38,
		'keys': 39,
		'help': 40,
		'battle': 41,
		'thunder': 42
	};

	core.actions._clickCenterFly = function (x, y) {
		var posX = core.status.event.data.posX,
			posY = core.status.event.data.posY;
		core.ui.closePanel();
		if (x == posX && y == posY) {
			if (core.canUseItem('centerFly')) {
				core.useItem('centerFly');
			} else {
				core.drawTip('当前不能使用中心对称飞行器');
			}
		} else core.drawTip('取消使用');
	}

	var _clickSL = core.actions._clickSL;
	core.actions._clickSL = function (x, y) {
		var page = core.status.event.data.page,
			offset = core.status.event.data.offset;
		var index = page * 10 + offset;

		// 上一页
		if ((x == this.HSIZE - 1 || x == this.HSIZE - 2) && y == this.LAST) {
			core.ui._drawSLPanel(10 * (page - 1) + offset);
			return;
		}
		// 下一页
		if ((x == this.HSIZE + 1 || x == this.HSIZE + 2) && y == this.LAST) {
			core.ui._drawSLPanel(10 * (page + 1) + offset);
			return;
		}
		if ((x == this.HSIZE - 3 || x == this.HSIZE + 3) && y == this.LAST) {
			return;
		}
		_clickSL.call(this, x, y);
	}

	var _sys_longClick_lockControl = core.actions._sys_longClick_lockControl;
	core.actions._sys_longClick_lockControl = function (x, y) {
		if (!core.status.lockControl) return false;

		// 长按SL上下页快速翻页
		if (["save", "load", "replayLoad", "replayRemain"].indexOf(core.status.event.id) >= 0) {
			if (y == this.LAST && x <= this.HSIZE + 3 && x >= this.HSIZE - 3) {
				core.actions._clickSL(x, y);
				return true;
			}
		}
		return _sys_longClick_lockControl.call(this, x, y);
	}
	core.registerAction('longClick', '_sys_longClick_lockControl', core.actions._sys_longClick_lockControl, 50);

	core.control._moveHero_moving = function () {
		core.status.heroStop = false;
		core.status.automaticRoute.moveDirectly = false;
		var move = function () {
			if (!core.status.heroStop) {
				if (core.hasFlag('debug') && core.status.ctrlDown) {
					if (core.status.heroMoving != 0) return;
					// 检测是否穿出去
					var nx = core.nextX(),
						ny = core.nextY();
					if (nx < 1 || nx >= core.bigmap.width - 1 || ny < 1 || ny >= core.bigmap.height - 1) return;
					core.eventMoveHero([core.getHeroLoc('direction')], core.values.moveSpeed, move);
				} else {
					core.moveAction();
					setTimeout(move, 50);
				}
			}
		}
		move();
	}

	core.control._drawHero_updateViewport = function (x, y, offset) {}

	var _drawThumbnail_drawTempCanvas = core.maps._drawThumbnail_drawTempCanvas;
	core.maps._drawThumbnail_drawTempCanvas = function (floorId, blocks, options) {
		if (main.mode == 'editor') {
			_drawThumbnail_drawTempCanvas.call(this, floorId, blocks, options);
			return;
		}

		var width = core.floors[floorId].width;
		var height = core.floors[floorId].height;
		// 绘制到tempCanvas上面
		var tempCanvas = core.bigmap.tempCanvas;
		options.v2 = false;
		tempCanvas.canvas.width = width * 32;
		tempCanvas.canvas.height = height * 32;
		options.ctx = tempCanvas;

		var hasHero = core.status.hero != null,
			flags = null;
		if (options.flags) {
			if (!hasHero) core.status.hero = {};
			flags = core.status.hero.flags;
			core.status.hero.flags = options.flags;
		}
		this._drawThumbnail_realDrawTempCanvas(floorId, blocks, options);

		if (!hasHero) delete core.status.hero;
		else if (flags != null) core.status.hero.flags = flags;
		tempCanvas.setTransform(1, 0, 0, 1, 0, 0);
	}

	var _drawThumbnail_drawToTarget = core.maps._drawThumbnail_drawToTarget;
	core.maps._drawThumbnail_drawToTarget = function (floorId, options) {
		if (main.mode == 'editor') {
			_drawThumbnail_drawToTarget.call(this, floorId, options);
			return;
		}

		var ctx = core.getContextByName(options.ctx);
		if (ctx == null) return;
		var x = options.x || 0,
			y = options.y || 0,
			size = options.size || core.__PIXELS__;
		var tempCanvas = core.bigmap.tempCanvas;
		core.drawImage(ctx, tempCanvas.canvas, 32, 32, core.__PIXELS__, core.__PIXELS__, x, y, size, size);
	}

	var _drawWindowSkin = core.ui.drawWindowSkin;
	core.ui.drawWindowSkin = function (background, ctx, x, y, w, h, direction, px, py) {
		_drawWindowSkin.call(this, background, ctx, x, y, w, h, direction, px, py);

		var c = parseInt(w / 2);
		core.drawImage(ctx, background, 160, 90, 16, 6, x + c - 8, y, 16, 6);
	}

	var _drawPagination = ui.prototype.drawPagination;
	core.ui.drawPagination = function (page, totalPage, y) {
		if (["save", "load", "replayLoad", "replayRemain", "replaySince"].indexOf(core.status.event.id) >= 0) {
			if (totalPage <= 1) return;
			if (y == null) y = this.LAST;

			core.setFillStyle('ui', '#DDDDDD');
			var length = core.calWidth('ui', page, this._buildFont(15, true));

			core.setTextAlign('ui', 'left');
			core.fillText('ui', page, parseInt((this.PIXEL - length) / 2), y * 32 + 19);

			core.setTextAlign('ui', 'center');
			if (page > 1)
				core.fillText('ui', '上一页', this.HPIXEL - 48, y * 32 + 19);
			if (page < totalPage)
				core.fillText('ui', '下一页', this.HPIXEL + 48, y * 32 + 19);
			return;
		}
		_drawPagination.call(this, page, totalPage, y);
	}

	core.ui._drawCenterFly = function () {
		core.lockControl();
		core.status.event.id = 'centerFly';
		var fillstyle = 'rgba(255,0,0,0.5)';
		if (core.canUseItem('centerFly')) fillstyle = 'rgba(0,255,0,0.5)';
		var toX = core.bigmap.width - 1 - core.getHeroLoc('x'),
			toY = core.bigmap.height - 1 - core.getHeroLoc('y');
		this.clearUI();
		core.fillRect('ui', 0, 0, this.PIXEL, this.PIXEL, '#000000');
		core.drawThumbnail(null, null, { heroLoc: core.status.hero.loc, heroIcon: core.status.hero.image, ctx: 'ui', centerX: toX, centerY: toY });
		var offsetX = 1,
			offsetY = 1;
		core.fillRect('ui', (toX - offsetX) * 32, (toY - offsetY) * 32, 32, 32, fillstyle);
		core.status.event.data = { "x": toX, "y": toY, "posX": toX - offsetX, "posY": toY - offsetY };
		core.playSound('打开界面');
		core.drawTip("请确认当前" + core.material.items['centerFly'].name + "的位置", 'centerFly');
		return;
	}

	core.ui.drawHelp = function () {
		core.clearUI();
		core.status.event.id = 'help';
		core.lockControl();
		core.setAlpha('ui', 1);
		core.fillRect('ui', 0, 0, this.PIXEL, this.PIXEL, '#FFFFFF');
		core.drawImage('ui', core.material.images.keyboard, 0, 0, 416, 416, 0, 0, 352, 352);
	}

	core.actions._getClickLoc = function (x, y) {
		var size = 32 * core.domStyle.scale;
		var left = main.dom.gameDraw.offsetLeft + main.dom.gameGroup.offsetLeft;
		var top = main.dom.gameDraw.offsetTop + main.dom.gameGroup.offsetTop;
		var loc = { 'x': Math.max(x - left, 0), 'y': Math.max(y - top, 0), 'size': size };
		return loc;
	}

	/*core.enemys.getDamageString = function (enemy, x, y, floorId) {
		if (typeof enemy == 'string') enemy = core.material.enemys[enemy];
		var damage = this.getDamage(enemy, x, y, floorId);

		var color = '#000000';

		if (damage == null) {
			damage = "???";
			color = '#FF2222';
		} else {
			if (core.hasFlag('addhp')) {
				if (damage < core.status.hero.hp) color = '#11FF11';
				else color = '#FF2222';
			} else if (damage <= 0) color = '#11FF11';
			else if (damage < core.status.hero.hp / 3) color = '#FFFFFF';
			else if (damage < core.status.hero.hp * 2 / 3) color = '#FFFF00';
			else if (damage < core.status.hero.hp) color = '#FF9933';
			else color = '#FF2222';

			damage = core.formatBigNumber(damage, true);
			if (core.enemys.hasSpecial(enemy, 19))
				damage += "+";
			if (core.enemys.hasSpecial(enemy, 21))
				damage += "-";
			if (core.enemys.hasSpecial(enemy, 11))
				damage += "^";
		}

		return {
			"damage": damage,
			"color": color
		};
	}

	core.ui._drawBook_drawDamage = function (index, enemy, offset, position) {
		core.setTextAlign('ui', 'center');
		var damage = enemy.damage,
			color = '#FFFF00';
		if (damage == null) {
			damage = '不可攻击';
			color = '#FF2222';
		}
		if (damage == 0) {
			damage = '无危险';
			color = '#11FF11';
		} else {
			if (damage >= core.status.hero.hp) color = '#FF2222';
			else if (damage >= core.status.hero.hp * 2 / 3) color = '#FF9933';
			else if (damage <= 0) color = '#11FF11';
			damage = core.formatBigNumber(damage);
			if (core.enemys.hasSpecial(enemy, 19)) damage += "+";
			if (core.enemys.hasSpecial(enemy, 21)) damage += "-";
			if (core.enemys.hasSpecial(enemy, 11)) damage += "^";
		}
		if (enemy.notBomb) damage += "[b]";
		core.fillText('ui', damage, offset, position, color, this._buildFont(13, true));
	}*/

	core.control.checkBlock = function () {
		var x = core.getHeroLoc('x'),
			y = core.getHeroLoc('y'),
			loc = x + "," + y;
		var damage = core.status.checkBlock.damage[loc];
		if (damage) {
			core.status.hero.hp -= damage;
			core.drawTip("你没有神圣盾不能防御，受到 " + damage + " 点魔法伤害");
			core.playSound('zone.mp3');

			if (core.getBlockCls(x, y - 1) == "enemys" && (core.getEnemyInfo(core.getBlockId(x, y - 1)).special == 15 || core.getEnemyInfo(core.getBlockId(x, y - 1)).special == 18)) {
				core.drawImage("animate", core.statusBar.icons.thunder, 0, 0, 32, 32, (x - 1) * 32, (y - 1) * 32, 32, 32, 1.57079632679);
			}

			if (core.getBlockCls(x - 1, y) == "enemys" && (core.getEnemyInfo(core.getBlockId(x - 1, y)).special == 15 || core.getEnemyInfo(core.getBlockId(x - 1, y)).special == 18)) {
				core.drawImage("animate", core.statusBar.icons.thunder, 0, 0, 32, 32, (x - 1) * 32, (y - 1) * 32, 32, 32, 0);
				//console.log(2);
			}

			if (core.getBlockCls(x + 1, y) == "enemys" && (core.getEnemyInfo(core.getBlockId(x + 1, y)).special == 15 || core.getEnemyInfo(core.getBlockId(x + 1, y)).special == 18)) {
				core.drawImage("animate", core.statusBar.icons.thunder, 0, 0, 32, 32, (x - 1) * 32, (y - 1) * 32, 32, 32, 3.14159265359);
				//console.log(3);
			}

			if (core.getBlockCls(x, y + 1) == "enemys" && (core.getEnemyInfo(core.getBlockId(x, y + 1)).special == 15 || core.getEnemyInfo(core.getBlockId(x, y + 1)).special == 18)) {
				core.drawImage("animate", core.statusBar.icons.thunder, 0, 0, 32, 32, (x - 1) * 32, (y - 1) * 32, 32, 32, 4.71238898038);
				//console.log(4);
			}

			if (core.getBlockCls(x, y - 1) == "enemys" && core.getEnemyInfo(core.getBlockId(x, y - 1)).special == 16 && core.getBlockCls(x, y + 1) == "enemys" && (core.getEnemyInfo(core.getBlockId(x, y + 1)).special == 16)) {
				core.drawImage("animate", core.statusBar.icons.thunder, 0, 0, 32, 32, (x - 1) * 32, (y - 1) * 32, 32, 32, 1.57079632679);
				core.drawImage("animate", core.statusBar.icons.thunder, 0, 0, 32, 32, (x - 1) * 32, (y - 1) * 32, 32, 32, 4.71238898038);
			}

			if (core.getBlockCls(x - 1, y) == "enemys" && core.getEnemyInfo(core.getBlockId(x - 1, y)).special == 16 && core.getBlockCls(x + 1, y) == "enemys" && (core.getEnemyInfo(core.getBlockId(x + 1, y)).special == 16)) {
				core.drawImage("animate", core.statusBar.icons.thunder, 0, 0, 32, 32, (x - 1) * 32, (y - 1) * 32, 32, 32, 0);
				core.drawImage("animate", core.statusBar.icons.thunder, 0, 0, 32, 32, (x - 1) * 32, (y - 1) * 32, 32, 32, 3.14159265359);
			}

			setTimeout(function () {
				core.clearMap("animate", (x - 1) * 32, (y - 1) * 32, 32, 32);
			}, 100);

			this._checkBlock_disableQuickShop();
			core.status.hero.statistics.extraDamage += damage;
			if (core.status.hero.hp <= 0) {
				core.status.hero.hp = 0;
				core.updateStatusBar();
				core.events.lose();
				return;
			} else {
				core.updateStatusBar();
			}
		}
		this._checkBlock_ambush(core.status.checkBlock.ambush[loc]);
		this._checkBlock_repulse(core.status.checkBlock.repulse[loc]);
	}

	core.registerSystemEvent("man", function (data, callback) {
		var a = parseInt(core.status.floorId.substring(2));
		var b = core.nextX();
		var c = core.nextY();
		core.insertAction([
			{ "type": "insert", "name": "对话", "args": [a, b, c, 0] },
		]);
		//console.log(data);
		if (callback) callback();
	});

	core.registerSystemEvent("woman", function (data, callback) {
		var name = core.status.floorId + '@' + core.nextX() + '@' + core.nextY() + '@' + 'A';
		if (core.getFlag(name, 0) == 1) {
			var a = parseInt(core.status.floorId.substring(2));
			var b = core.nextX();
			var c = core.nextY();
			core.insertAction([
				{ "type": "insert", "name": "对话", "args": [a, b, c, 1] },
			]);
		} else {
			core.insertAction([
				{ "type": "insert", "name": "商人", "args": [0] },
			]);
		}
		//console.log(data);
		if (callback) callback();
	});

	core.registerSystemEvent("specialwall", function (data, callback) {
		if (data.event.id == 'whiteWall' || core.getFlag('talking') > 0) {
			var cando = 0;
			if (core.inArray(flags.skill1, "窃贼诡道I") && core.status.thisMap.ratio <= 1) {
				if (flags.theHero == 'thief')
					cando = 1;
				else if (flags.Allstatus[1].unlock == true && flags.Allstatus[1].hp > 0)
					cando = 2;
			} else if (core.inArray(flags.skill1, "窃贼诡道II") && core.status.thisMap.ratio <= 3) {
				if (flags.theHero == 'thief')
					cando = 1;
				else if (flags.Allstatus[1].unlock == true && flags.Allstatus[1].hp > 0)
					cando = 2;
			} else if (core.inArray(flags.skill1, "窃贼诡道III") && core.status.thisMap.ratio <= 5) {
				if (flags.theHero == 'thief')
					cando = 1;
				else if (flags.Allstatus[1].unlock == true && flags.Allstatus[1].hp > 0)
					cando = 2;
			} else
				core.drawTip("需要盗贼技能开墙", null, true);
			if (cando) {
				core.addPop(32 * data.x - 32, 32 * data.y - 32, core.getBlockId(data.x, data.y));
				core.removeBlock(data.x, data.y);
				//core.insertAction({ 'type': 'openDoor', loc: [data.x, data.y] });
			}
			if (cando > 1) {
				flags.Allstatus[1].x = data.x
				flags.Allstatus[1].y = data.y
				flags.Allstatus[1].f = core.status.floorId;
				core.drawHero();
			}
			if (data.event.id != 'whiteWall') {
				core.setFlag('end', 1);
			}
			core.setFlag('talking', 0); //穿墙之后不能再次穿墙
		}
		//console.log(data);
		if (callback) callback();
	});

	core.registerSystemEvent("fakeWall", function (data, callback) {
		if (data.event.id == 'blueWall') {
			var cando = 0;
			if (core.inArray(flags.skill1, "窃贼诡道I") && core.status.thisMap.ratio <= 1) {
				if (flags.theHero == 'thief')
					cando = 1;
				else if (flags.Allstatus[1].unlock == true && flags.Allstatus[1].hp > 0)
					cando = 2;
			} else if (core.inArray(flags.skill1, "窃贼诡道II") && core.status.thisMap.ratio <= 3) {
				if (flags.theHero == 'thief')
					cando = 1;
				else if (flags.Allstatus[1].unlock == true && flags.Allstatus[1].hp > 0)
					cando = 2;
			} else if (core.inArray(flags.skill1, "窃贼诡道III") && core.status.thisMap.ratio <= 5) {
				if (flags.theHero == 'thief')
					cando = 1;
				else if (flags.Allstatus[1].unlock == true && flags.Allstatus[1].hp > 0)
					cando = 2;
			} else
				core.drawTip("需要盗贼技能开墙", null, true);
			if (cando) {
				core.addPop(32 * data.x - 32, 32 * data.y - 32, core.getBlockId(data.x, data.y));
				core.removeBlock(data.x, data.y);
				//core.insertAction({ 'type': 'openDoor', loc: [data.x, data.y] });
			}
			if (cando > 1) {
				flags.Allstatus[1].x = data.x
				flags.Allstatus[1].y = data.y
				flags.Allstatus[1].f = core.status.floorId;
				core.drawHero();
			}

		}
		//console.log(data);
		if (callback) callback();
	});

	core.ui._drawWindowSelector = function (background, x, y, w, h) {
		w = Math.round(w) + 48;
		h = Math.round(h);
		var ctx = core.ui.createCanvas("_selector", x - 24, y, w, h, 165);
		ctx.canvas.id = '';
		this._drawSelector(ctx, background, w, h);
	}

	core.ui._drawSelector = function (ctx, background, w, h, left, top) {
		left = left || 0;
		top = top || 0;
		ctx = this.getContextByName(ctx);
		if (!ctx) return;
		if (typeof background == 'string')
			background = core.material.images.images[background];
		if (!(background instanceof Image)) return;
		// badge
		ctx.drawImage(background, 132, 68, 24, 24, left + 4, top + 4, 24, 24);
		ctx.drawImage(background, 132, 68, 24, 24, w - left - 28, top + 4, 24, 24);
	}

	core.ui.drawTip = function (text, id, clear) {
		core.ui.statusBar.print(text);
	}

	core.ui.clearMap = function (name, x, y, width, height) {
		if (name == 'all') {
			for (var m in core.canvas) {
				core.canvas[m].clearRect(0, 0, core.bigmap.width * 32, core.bigmap.height * 32);
			}
			core.clearMap("outerUI");
			core.dom.gif.innerHTML = "";
			core.removeGlobalAnimate();
		} else {
			var ctx = this.getContextByName(name);
			if (ctx) ctx.clearRect(x || 0, y || 0, width || ctx.canvas.width, height || ctx.canvas.height);
		}
	}

	core.control._updateStatusBar_setToolboxIcon = function () {
		core.ui.statusBar._update_toolBox();
	}

	/*var _changeFloor_getInfo = core.events._changeFloor_getInfo;
	core.events._changeFloor_getInfo = function (floorId, stair, heroLoc, time) {
		var info = _changeFloor_getInfo.call(this, floorId, stair, heroLoc, time);
		if (info == null) return null;
		info.time = 0;
		info.origin = floorId;
		return info;
	}*/

	core.events._changeFloor_afterChange = function (info, callback) {
		if (!info.locked) core.unlockControl();
		core.status.replay.animate = false;
		core.events.afterChangeFloor(info.floorId);

		if (info.origin == ':before') core.ui.statusBar.print('走下了楼梯')
		else if (info.origin == ':next') core.ui.statusBar.print('登上了楼梯')
		if (callback) callback();
	}

	if (window.jsinterface && window.jsinterface.requestLandscape) {
		window.jsinterface.requestLandscape();
	}
},
    "shop": function () {
	// 【全局商店】相关的功能
	// 
	// 打开一个全局商店
	// shopId：要打开的商店id；noRoute：是否不计入录像
	this.openShop = function (shopId, noRoute) {
		var shop = core.status.shops[shopId];
		// Step 1: 检查能否打开此商店
		if (!this.canOpenShop(shopId)) {
			core.drawTip("该商店尚未开启");
			return false;
		}

		// Step 2: （如有必要）记录打开商店的脚本事件
		if (!noRoute) {
			core.status.route.push("shop:" + shopId);
		}

		// Step 3: 检查道具商店 or 公共事件
		if (shop.item) {
			if (core.openItemShop) {
				core.openItemShop(shopId);
			} else {
				core.playSound('操作失败');
				core.insertAction("道具商店插件不存在！请检查是否存在该插件！");
			}
			return;
		}
		if (shop.commonEvent) {
			core.insertCommonEvent(shop.commonEvent, shop.args);
			return;
		}

		_shouldProcessKeyUp = true;

		// Step 4: 执行标准公共商店    
		core.insertAction(this._convertShop(shop));
		return true;
	}

	////// 将一个全局商店转变成可预览的公共事件 //////
	this._convertShop = function (shop) {
		return [
			{ "type": "function", "function": "function() {core.addFlag('@temp@shop', 1);}" },
			{
				"type": "while",
				"condition": "true",
				"data": [
					// 检测能否访问该商店
					{
						"type": "if",
						"condition": "core.isShopVisited('" + shop.id + "')",
						"true": [
							// 可以访问，直接插入执行效果
							{ "type": "function", "function": "function() { core.plugin._convertShop_replaceChoices('" + shop.id + "', false) }" },
						],
						"false": [
							// 不能访问的情况下：检测能否预览
							{
								"type": "if",
								"condition": shop.disablePreview,
								"true": [
									// 不可预览，提示并退出
									{ "type": "playSound", "name": "操作失败" },
									"当前无法访问该商店！",
									{ "type": "break" },
								],
								"false": [
									// 可以预览：将商店全部内容进行替换
									{ "type": "tip", "text": "当前处于预览模式，不可购买" },
									{ "type": "function", "function": "function() { core.plugin._convertShop_replaceChoices('" + shop.id + "', true) }" },
								]
							}
						]
					}
				]
			},
			{ "type": "function", "function": "function() {core.addFlag('@temp@shop', -1);}" }
		];
	}

	this._convertShop_replaceChoices = function (shopId, previewMode) {
		var shop = core.status.shops[shopId];
		var choices = (shop.choices || []).filter(function (choice) {
			if (choice.condition == null || choice.condition == '') return true;
			try { return core.calValue(choice.condition); } catch (e) { return true; }
		}).map(function (choice) {
			var ableToBuy = core.calValue(choice.need);
			return {
				"text": choice.text,
				"icon": choice.icon,
				"color": ableToBuy && !previewMode ? choice.color : [153, 153, 153, 1],
				"action": ableToBuy && !previewMode ? [{ "type": "playSound", "name": "商店" }].concat(choice.action) : [
					{ "type": "playSound", "name": "操作失败" },
					{ "type": "tip", "text": previewMode ? "预览模式下不可购买" : "购买条件不足" }
				]
			};
		}).concat({ "text": "离开", "action": [{ "type": "playSound", "name": "取消" }, { "type": "break" }] });
		core.insertAction({ "type": "choices", "text": shop.text, "choices": choices });
	}

	/// 是否访问过某个快捷商店
	this.isShopVisited = function (id) {
		if (!core.hasFlag("__shops__")) core.setFlag("__shops__", {});
		var shops = core.getFlag("__shops__");
		if (!shops[id]) shops[id] = {};
		return shops[id].visited;
	}

	/// 当前应当显示的快捷商店列表
	this.listShopIds = function () {
		return Object.keys(core.status.shops).filter(function (id) {
			return core.isShopVisited(id) || !core.status.shops[id].mustEnable;
		});
	}

	/// 是否能够打开某个商店
	this.canOpenShop = function (id) {
		if (this.isShopVisited(id)) return true;
		var shop = core.status.shops[id];
		if (shop.item || shop.commonEvent || shop.mustEnable) return false;
		return true;
	}

	/// 启用或禁用某个快捷商店
	this.setShopVisited = function (id, visited) {
		if (!core.hasFlag("__shops__")) core.setFlag("__shops__", {});
		var shops = core.getFlag("__shops__");
		if (!shops[id]) shops[id] = {};
		if (visited) shops[id].visited = true;
		else delete shops[id].visited;
	}

	/// 能否使用快捷商店
	this.canUseQuickShop = function (id) {
		// 如果返回一个字符串，表示不能，字符串为不能使用的提示
		// 返回null代表可以使用

		// 检查当前楼层的canUseQuickShop选项是否为false
		if (core.status.thisMap.canUseQuickShop === false)
			return '当前楼层不能使用快捷商店。';
		return null;
	}

	var _shouldProcessKeyUp = true;

	/// 允许商店X键退出
	core.registerAction('keyUp', 'shops', function (keycode) {
		if (!core.status.lockControl || core.status.event.id != 'action') return false;
		if ((keycode == 13 || keycode == 32) && !_shouldProcessKeyUp) {
			_shouldProcessKeyUp = true;
			return true;
		}

		if (!core.hasFlag("@temp@shop") || core.status.event.data.type != 'choices') return false;
		var data = core.status.event.data.current;
		var choices = data.choices;
		var topIndex = core.actions._getChoicesTopIndex(choices.length);
		if (keycode == 88 || keycode == 27) { // X, ESC
			core.actions._clickAction(core.actions.HSIZE, topIndex + choices.length - 1);
			return true;
		}
		return false;
	}, 60);

	/// 允许长按空格或回车连续执行操作
	core.registerAction('keyDown', 'shops', function (keycode) {
		if (!core.status.lockControl || !core.hasFlag("@temp@shop") || core.status.event.id != 'action') return false;
		if (core.status.event.data.type != 'choices') return false;
		var data = core.status.event.data.current;
		var choices = data.choices;
		var topIndex = core.actions._getChoicesTopIndex(choices.length);
		if (keycode == 13 || keycode == 32) { // Space, Enter
			core.actions._clickAction(core.actions.HSIZE, topIndex + core.status.event.selection);
			_shouldProcessKeyUp = false;
			return true;
		}
		return false;
	}, 60);

	// 允许长按屏幕连续执行操作
	core.registerAction('longClick', 'shops', function (x, y, px, py) {
		if (!core.status.lockControl || !core.hasFlag("@temp@shop") || core.status.event.id != 'action') return false;
		if (core.status.event.data.type != 'choices') return false;
		var data = core.status.event.data.current;
		var choices = data.choices;
		var topIndex = core.actions._getChoicesTopIndex(choices.length);
		if (x >= core.actions.CHOICES_LEFT && x <= core.actions.CHOICES_RIGHT && y >= topIndex && y < topIndex + choices.length) {
			core.actions._clickAction(x, y);
			return true;
		}
		return false;
	}, 60);
},
    "角色栏": function () {
	// 在此增加新插件


	core.myquickchange = function (i) {
		var heroid = ['child', 'thief', 'woman', 'man', 'princess', 'fairy'];
		if (flags.Allstatus[i].unlock == true && flags.Allstatus[i].hp > 0) {
			if (!core.canMoveFloor() && !core.canMoveTheHero(i)) {
				core.drawTip('当前角色与所选角色或楼梯不连通')
				return;
			}
			core.mychangeHero();
			flags.theHeroUI = Number(i);
			core.enter_mychangeHero(null, 666);
		} else if (flags.Allstatus[i].unlock == false) {
			var unlocktext;
			if (i == 0)
				unlocktext = ',开局解锁';
			else if (i == 1)
				unlocktext = ',2层监狱对话解锁';
			else if (i == 2)
				unlocktext = ',12层右上角挖暗墙解锁';
			else if (i == 3)
				unlocktext = ',27层对话解锁';
			else if (i == 4)
				unlocktext = ',26层解救公主解锁';
			else if (i == 5)
				unlocktext = ',二周目解锁';
			core.drawTip('角色未解锁' + unlocktext);
		} else if (flags.Allstatus[i].hp <= 0)
			core.drawTip('角色已阵亡')
	}

	core.mychangeHero = function () {

		//if (core.isReplaying()) return;


		core.status.holdingKeys = []; ///清空按下的键
		core.lockControl();
		core.status.event.id = 'mychangeHero';
		flags.theHeroUI = flags.theHero;
		var heroid = ['child', 'thief', 'woman', 'man', 'princess', 'fairy']
		for (var i = 0; i < 6; i++) {
			if (flags.theHeroUI === heroid[i])
				flags.theHeroUI = Number(i);
		}
		var i = flags.theHeroUI;
		flags.Allstatus[i].name = hero.name;
		//flags.Allstatus[i].hp = hero.hp;
		//flags.Allstatus[i].atk = hero.atk;
		//flags.Allstatus[i].def = hero.def;
		flags.Allstatus[i].lv = flags.lv;
		flags.Allstatus[i].p = flags.skillpoint;
		flags.Allstatus[i].x = hero.loc.x;
		flags.Allstatus[i].y = hero.loc.y;
		flags.Allstatus[i].f = core.status.floorId;
		flags.Allstatus[i].sword = flags.nowWeapon;
		flags.Allstatus[i].shield = flags.nowShield;
		core.mychangeHero_draw(); ///重绘页面

	}
	core.quit_mychangeHero = function () {
		if (!core.isReplaying()) {
			for (var i in flags.Allstatus) {
				if (flags.Allstatus[i].name === hero.name)
					flags.theHeroUI = Number(i);
			}
			if (flags.Allstatus[flags.theHeroUI].hp == 0) {
				core.drawTip('当前角色已阵亡')
				return;
			}
		}
		core.clearUI();
		core.status.event.id = null;
		core.unlockControl();
		//if (core.isReplaying())
		//	core.replay();
	}
	core.canMoveTheHero = function (i) {
		var canmove = false;
		if (core.canMoveDirectly(flags.Allstatus[i].x, flags.Allstatus[i].y) >= 0)
			canmove = true;
		return canmove
	}
	core.enter_mychangeHero = function (useF, quick) {
		//console.log(quick)
		var heroid = ['child', 'thief', 'woman', 'man', 'princess', 'fairy']
		var i = flags.theHeroUI;
		if (flags.Allstatus[i].unlock == true && flags.Allstatus[i].hp > 0) {
			if (!core.canMoveFloor() && !core.canMoveTheHero(i) && hero.hp > 0) {
				core.drawTip('当前角色与所选角色或楼梯不连通')
				return;
			}
			if ((flags.Allstatus[i].f !== core.status.floorId) || (hero.hp <= 0)) {
				core.addPopMove(32 * hero.loc.x - 16, 32 * hero.loc.y - 16, 32 * flags.Allstatus[i].x - 16, 32 * flags.Allstatus[i].y - 16)
				hero.loc.x = flags.Allstatus[i].x;
				hero.loc.y = flags.Allstatus[i].y;
			} else {
				core.addPopMove(32 * flags.Allstatus[i].x - 16, 32 * flags.Allstatus[i].y - 16, 32 * hero.loc.x - 16, 32 * hero.loc.y - 16)
				flags.Allstatus[i].x = hero.loc.x;
				flags.Allstatus[i].y = hero.loc.y;
			}
			hero.name = flags.Allstatus[i].name;
			hero.hp = flags.Allstatus[i].hp;
			hero.atk = flags.Allstatus[i].atk;
			hero.def = flags.Allstatus[i].def;
			flags.lv = flags.Allstatus[i].lv;
			flags.skillpoint = flags.Allstatus[i].p;
			flags.nowWeapon = flags.Allstatus[i].sword;
			flags.nowShield = flags.Allstatus[i].shield;
			flags.theHero = heroid[i];
			var iconskill = ['神剑战士', '怪盗杰克', '炼金术士', '传奇法师', '最终兵器', '湖中仙女']
			var icon = '';
			if (core.inArray(flags.skill1, iconskill[i]))
				icon = '2';
			core.setHeroIcon(flags.theHero + icon + '.png');
			if (flags.theHero === 'child') {
				flags.redG_use = flags.redG;
				flags.blueG_use = flags.blueG;
				flags.Potion_use = flags.Potion;
			} else {
				flags.redG_use = 0;
				flags.blueG_use = 0;
				flags.Potion_use = 0;
			}
			if (!core.isReplaying()) {
				if (flags.Allstatus[i].f !== core.status.floorId)
					core.changeFloor(flags.Allstatus[i].f);
				else
					core.updateStatusBar();
			}
			core.quit_mychangeHero();
			core.status.route.push('hero:' + flags.theHeroUI + ':' + quick)
			core.myFiveRedKing()
			//core.insertCommonEvent('换人', true);
			//flags.Allstatus[i].f = null;
			if (useF) {
				//core.updateStatusBar();
				core.myskilltree();
			}
		} else if (flags.Allstatus[i].unlock == false) {
			var unlocktext;
			if (i == 0)
				unlocktext = ',开局解锁';
			else if (i == 1)
				unlocktext = ',2层监狱对话解锁';
			else if (i == 2)
				unlocktext = ',12层右上角挖暗墙解锁';
			else if (i == 3)
				unlocktext = ',27层对话解锁';
			else if (i == 4)
				unlocktext = ',26层解救公主解锁';
			else if (i == 5)
				unlocktext = ',二周目解锁';
			core.drawTip('角色未解锁' + unlocktext);
		} else if (flags.Allstatus[i].hp <= 0)
			if (core.itemCount('superPotion') >= 1) {
				var heroname = ['勇者', '盗贼', '商人', '贤者', '公主', '妖精']
				flags.fhbwdar = { i: i, name: heroname[i] };
				core.insertCommonEvent('复活吧我的爱人');
			} else
				core.drawTip('角色已阵亡');
	}

	core.mychangeHero_draw = function () {
		core.clearUI();
		//首先绘制背景
		core.clearMap('ui');
		core.drawWindowSkin('winskin.png', 'ui', 15, 15, 352 - 30, 352 - 30);
		core.setTextAlign('ui', 'center');
		core.fillText('ui', "切换角色", 352 / 2, 40, '#E1E1E1', 'bold 22px Verdana');
		core.fillText('ui', "快捷键Q", 352 / 2 + 110, 40, '#888888', 'bold 18px Verdana');
		core.fillText('ui', "——点击任意处退出（X）——", 352 / 2, 325, '#E1E1E1', 'bold 14px Verdana');
		var heroid = ['child', 'thief', 'woman', 'man', 'princess', 'fairy']
		for (var i = 0; i < 6; i++) {
			if (flags.Allstatus[i].unlock == false || flags.Allstatus[i].hp <= 0) {
				core.setFilter('ui', 'grayscale(100%)');
			}
			var x = 15 + 90 * (i % 3);
			var y = 20 + 140 * (Math.floor(i / 3));
			core.fillRoundRect('ui', 30 + x, 30 + y, 80, 120, 5, "#444444");
			var iconskill = ['神剑战士', '怪盗杰克', '炼金术士', '传奇法师', '最终兵器', '湖中仙女']
			var icon = '';
			if (core.inArray(flags.skill1, iconskill[i]))
				icon = '2';
			core.drawImage('ui', heroid[i] + icon + '.png', 0, 0, 32, 32, 54 + x, 35 + y, 32, 32);
			if (hero.money >= Math.max(0, 20 + 10 * flags.Allstatus[i].lv * (flags.Allstatus[i].lv - 1) - flags.manmoney) && flags.Allstatus[i].unlock == true && flags.Allstatus[i].hp > 0) {
				core.drawImage('ui', 'canUp.png', 0, 0, 32, 32, 54 + x, 35 + y, 32, 32);
				core.drawMyCircle('ui', 54 + x, 35 + y);
			}
			core.drawIcon('ui', 'hp', 30 + x, 80 + y, 25, 25);
			core.drawIcon('ui', 'atk', 30 + x, 100 + y, 25, 25);
			core.drawIcon('ui', 'def', 30 + x, 120 + y, 25, 25);
			core.drawLine('ui', 60 + x, 82 + y, 30 + x + 80, 82 + y, '#676767', 2);
			core.drawLine('ui', 60 + x, 102 + y, 30 + x + 80, 102 + y, '#676767', 2);
			core.drawLine('ui', 60 + x, 122 + y, 30 + x + 80, 122 + y, '#676767', 2);
			core.drawLine('ui', 60 + x, 142 + y, 30 + x + 80, 142 + y, '#676767', 2);
			core.setTextAlign('ui', 'right');
			var lv = flags.Allstatus[i].lv;
			var hp = flags.Allstatus[i].hp;
			var atk = flags.Allstatus[i].atk;
			var def = flags.Allstatus[i].def;
			core.fillText('ui', 'Lv.' + lv, 110 + x, 80 + y, '#E1E1E1', 'bold 16px Verdana');
			core.fillText('ui', hp, 110 + x, 100 + y, '#E1E1E1', 'bold 16px Verdana');
			core.fillText('ui', atk, 110 + x, 120 + y, '#E1E1E1', 'bold 16px Verdana');
			core.fillText('ui', def, 110 + x, 140 + y, '#E1E1E1', 'bold 16px Verdana');
			core.setTextAlign('ui', 'left');
			if (flags.theHeroUI == i) {
				core.strokeRoundRect('ui', 30 + x, 30 + y, 80, 120, 5, "#aaaadd", 2);
				core.fillRoundRect('ui', 30 + x, 30 + y, 20, 15, 5, "#8888bb");
				core.strokeRoundRect('ui', 30 + x, 30 + y, 20, 15, 5, "#aaaadd", 2);
				core.fillText('ui', "√", 30 + x, 42 + y, '#FFFFFF', 'bold 16px Verdana');
			}
			core.setFilter('ui', '');
			if (flags.Allstatus[i].unlock == false)
				core.drawImage('ui', 'unlock.png', 0, 0, 100, 200, 30 + x - 10, 42 + y - 50, 100, 200);
			else if (flags.Allstatus[i].hp <= 0)
				core.drawImage('ui', 'dead.png', 0, 0, 100, 200, 30 + x - 10, 42 + y - 50, 100, 200);
		}
	}



	control.prototype._drawHero_draw = function (direction, x, y, status, offset, frame) {
		core.setAlpha('hero', 0.5);
		var heroid = ['child', 'thief', 'woman', 'man', 'princess', 'fairy']
		for (var i in flags.Allstatus) {
			var iconskill = ['神剑战士', '怪盗杰克', '炼金术士', '传奇法师', '最终兵器', '湖中仙女']
			var icon = '';
			if (core.inArray(flags.skill1, iconskill[i]))
				icon = '2';
			if (heroid[i] != flags.theHero && flags.Allstatus[i].f === core.status.floorId && flags.Allstatus[i].unlock == true && flags.Allstatus[i].hp > 0)
				core.drawIcon('hero', heroid[i] + icon, 32 * flags.Allstatus[i].x - 32, 32 * flags.Allstatus[i].y - 32, 32, 32, core.status.globalAnimateStatus % 2);
		}
		core.setAlpha('hero', 1);
		offset = offset || { x: 0, y: 0, offset: 0, px: 0, py: 0 };
		var opacity = core.setAlpha('hero', core.getFlag('__heroOpacity__', 1))
		this._drawHero_getDrawObjs(direction, x, y, status, offset).forEach(function (block) {
			core.drawImage('hero', block.img, (block.heroIcon[block.status] + (frame || 0)) % 4 * block.width,
				block.heroIcon.loc * block.height, block.width, block.height,
				block.posx + (32 - block.width) / 2, block.posy + 32 - block.height, block.width, block.height);
		});
		var atk = 0;
		if (flags.theHero === 'princess' && flags.Valkyrie > 0) {
			if (flags.Allstatus[0].f == core.status.floorId && flags.Allstatus[0].unlock == true && flags.Allstatus[0].hp > 0)
				atk += flags.Allstatus[0].atk;
			if (flags.Allstatus[1].f == core.status.floorId && flags.Allstatus[1].unlock == true && flags.Allstatus[1].hp > 0)
				atk += flags.Allstatus[1].atk;
			if (flags.Allstatus[2].f == core.status.floorId && flags.Allstatus[2].unlock == true && flags.Allstatus[2].hp > 0)
				atk += flags.Allstatus[2].atk;
			if (flags.Allstatus[3].f == core.status.floorId && flags.Allstatus[3].unlock == true && flags.Allstatus[3].hp > 0)
				atk += flags.Allstatus[3].atk;
			if (flags.Allstatus[5].f == core.status.floorId && flags.Allstatus[5].unlock == true && flags.Allstatus[5].hp > 0)
				atk += flags.Allstatus[5].atk;
		}
		if (flags.theHero === 'princess' && core.inArray(flags.skill1, "守护骑士") && flags.Allstatus[0].f == core.status.floorId && flags.Allstatus[0].unlock == true && flags.Allstatus[0].hp > 0) {
			atk += flags.Allstatus[0].atk;
		}
		if (atk > 0) {
			var x0 = 0;
			var y0 = 0;
			if (x == 1)
				x0 = 20;
			if (y === 1)
				y0 = 48;
			core.drawIcon('hero', 'atk', core.status.heroCenter.px - 48 - 8 - 20 + x0, core.status.heroCenter.py - 64 - 8 + y0, 32, 32);
			core.fillText('hero', '+' + atk, core.status.heroCenter.px - 48 - 8 + x0, core.status.heroCenter.py - 64 - 8 + 20 + y0, '#E1E1E1', 'bold 16px Verdana');
		}
		if (flags.xixue > 0) {
			core.setAlpha('hero', 0.7);
			core.drawImage('hero', 'skill12.png', 0, 0, 32, 32, core.status.heroCenter.px - 48, core.status.heroCenter.py - 48, 32, 32)
		}
		core.setAlpha('hero', opacity);
	}



	this.mychangeHero_keyDown = function (keycode) {
		if (core.status.event.id !== 'mychangeHero') return false;

		if (keycode == 37) {
			if (flags.theHeroUI > 0)
				flags.theHeroUI -= 1;
		} else if (keycode == 39) {
			if (flags.theHeroUI < 5)
				flags.theHeroUI += 1;
		} else if (keycode == 38) {
			if (flags.theHeroUI > 3)
				flags.theHeroUI -= 3;
			else
				flags.theHeroUI = 0;
		} else if (keycode == 40) {
			if (flags.theHeroUI < 2)
				flags.theHeroUI += 3;
			else
				flags.theHeroUI = 5;
		}

		core.mychangeHero_draw(); ///重绘页面

		return true;
	}

	core.registerAction('keyDown', 'mychangeHero', 'mychangeHero_keyDown', 100);

	var mychangeHero = function (keycode) {
		if (core.status.event.id !== 'mychangeHero') return false;

		if (keycode == 32 || keycode == 13 || keycode == 67) { //c\space\enter
			core.enter_mychangeHero();
		}
		if (keycode == 88 || keycode == 81 || keycode == 27) { ////x、q和Esc退出
			core.quit_mychangeHero();
		}
		if (keycode == 70) { ///技能树
			//core.quit_mychangeHero();
			core.enter_mychangeHero(true);
			//core.myskilltree();
		}
		if (keycode >= 49 && keycode <= 54) { ////数字键快捷切换
			flags.theHeroUI = keycode - 49;
			core.mychangeHero_draw(); ///重绘页面
			core.enter_mychangeHero();
		}
		return true; ///全部拦截
	};
	core.registerAction('keyUp', 'mychangeHero', mychangeHero, 100);

	this.mychangeHero_onmove = function (x, y, px, py) {
		if (core.status.event.id !== 'mychangeHero') return false;


		var boxX = Math.floor((px - 45) / 90), //点击盒子坐标
			boxY = Math.floor((py - 50) / 140);
		if (px < boxX * 90 + 45 || px > boxX * 90 + 45 + 80 || py < boxY * 140 + 50 || py > boxY * 140 + 50 + 120) return false;
		if (boxX < 0 || boxX > 2 || boxY < 0 || boxY > 1) return false;
		var i = boxX + boxY * 3;
		if (i >= 0 && i <= 5 && i !== flags.theHeroUI) {
			flags.theHeroUI = Number(i);
			core.mychangeHero_draw(); ///重绘页面
			//console.log(boxX + ',' + boxY + ',' + px + ',' + py);
		}

		return true;
	}
	core.registerAction('onmove', 'mychangeHero', 'mychangeHero_onmove', 100);

	core.registerAction('onclick', 'mychangeHero', function (x, y, px, py) {
		if (core.status.event.id !== 'mychangeHero') return false;

		//console.log(boxX + ',' + boxY + ',' + px + ',' + py);
		if (px < 45 || px > 352 - 45 || py < 50 || py > 352 - 50) {
			core.quit_mychangeHero();
		} else {
			var boxX = Math.floor((px - 45) / 90), //点击盒子坐标
				boxY = Math.floor((py - 50) / 140);
			if (px < boxX * 90 + 45 || px > boxX * 90 + 45 + 80 || py < boxY * 140 + 50 || py > boxY * 140 + 50 + 120) return false;
			if (boxX < 0 || boxX > 5 || boxY < 0 || boxY > 1) return false;
			var i = boxX + boxY * 3;
			if (i >= 0 && i <= 5) {
				flags.theHeroUI = Number(i);
				core.mychangeHero_draw();
				core.enter_mychangeHero();
				/*if (i === flags.theHeroUI)
					core.enter_mychangeHero();
				else if (i !== flags.theHeroUI) {
					flags.theHeroUI = i;
					core.mychangeHero_draw(); ///重绘页面
				}*/
			}

		}
		return true;

	}, 100);



},
    "宝石血瓶数值": function () {
	// 在此增加新插件
	/* 宝石血瓶左下角显示数值
	 * 需要将 变量：itemDetail改为true才可正常运行
	 * 请尽量减少勇士的属性数量，否则可能会出现严重卡顿（划掉，现在你放一万个属性也不会卡）
	 * 注意：这里的属性必须是core.status.hero里面的，flag无法显示
	 * 如果不想显示，可以core.setFlag("itemDetail", false);
	 * 然后再core.getItemDetail();
	 * 如有bug在大群或造塔群@古祠
	 */

	// 忽略的道具
	const ignore = ['superPotion'];

	// 取消注释下面这句可以减少超大地图的判定。
	// 如果地图宝石过多，可能会略有卡顿，可以尝试取消注释下面这句话来解决。
	core.bigmap.threshold = 256;
	const origin = core.control.updateStatusBar;
	core.updateStatusBar = core.control.updateStatusBar = function () {
		if (core.getFlag('__statistics__')) return;
		else return origin.apply(core.control, arguments);
	}

	core.control.updateDamage = function (floorId, ctx) {
		floorId = floorId || core.status.floorId;
		if (!floorId || core.status.gameOver || main.mode != 'play') return;
		const onMap = ctx == null;

		// 没有怪物手册
		if (!core.hasItem('book')) return;
		core.status.damage.posX = core.bigmap.posX;
		core.status.damage.posY = core.bigmap.posY;
		if (!onMap) {
			const width = core.floors[floorId].width,
				height = core.floors[floorId].height;
			// 地图过大的缩略图不绘制显伤
			if (width * height > core.bigmap.threshold) return;
		}
		this._updateDamage_damage(floorId, onMap);
		this._updateDamage_extraDamage(floorId, onMap);
		core.getItemDetail(floorId); // 宝石血瓶详细信息
		this.drawDamage(ctx);
	};
	// 获取宝石信息 并绘制
	this.getItemDetail = function (floorId) {
		if (!core.getFlag('itemDetail')) return;
		floorId = floorId ?? core.status.thisMap.floorId;
		let diff = {};
		const before = core.status.hero;
		const hero = core.clone(core.status.hero);
		const handler = {
			set(target, key, v) {
				diff[key] = v - (target[key] || 0);
				if (!diff[key]) diff[key] = void 0;
				return true;
			}
		};
		core.status.hero = new Proxy(hero, handler);
		core.status.maps[floorId].blocks.forEach(function (block) {
			if (
				block.event.cls !== 'items' ||
				ignore.includes(block.event.id) ||
				block.disable
			)
				return;
			const x = block.x,
				y = block.y;
			// v2优化，只绘制范围内的部分
			if (core.bigmap.v2) {
				if (
					x < core.bigmap.posX - core.bigmap.extend ||
					x > core.bigmap.posX + core._WIDTH_ + core.bigmap.extend ||
					y < core.bigmap.posY - core.bigmap.extend ||
					y > core.bigmap.posY + core._HEIGHT_ + core.bigmap.extend
				) {
					return;
				}
			}
			diff = {};
			const id = block.event.id;
			const item = core.material.items[id];
			if (item.cls === 'equips') {
				// 装备也显示
				const diff = item.equip.value ?? {};
				const per = item.equip.percentage ?? {};
				for (const name in per) {
					diff[name + 'per'] = per[name].toString() + '%';
				}
				drawItemDetail(diff, x, y);
				return;
			}
			// 跟数据统计原理一样 执行效果 前后比较
			core.setFlag('__statistics__', true);
			try {
				eval(item.itemEffect);
			} catch (error) {}
			drawItemDetail(diff, x, y);
		});
		core.status.hero = before;
		window.hero = before;
		window.flags = before.flags;
	};

	// 绘制
	function drawItemDetail(diff, x, y) {
		const px = 32 * x + 2,
			py = 32 * y + 30;
		let content = '';
		// 获得数据和颜色
		let i = 0;
		for (const name in diff) {
			if (!diff[name]) continue;
			let color = '#fff';

			if (typeof diff[name] === 'number')
				content = core.formatBigNumber(diff[name], true);
			else content = diff[name];
			switch (name) {
			case 'atk':
			case 'atkper':
				color = '#FF7A7A';
				break;
			case 'def':
			case 'defper':
				color = '#00E6F1';
				break;
			case 'mdef':
			case 'mdefper':
				color = '#6EFF83';
				break;
			case 'hp':
				color = '#A4FF00';
				break;
			case 'hpmax':
			case 'hpmaxper':
				color = '#F9FF00';
				break;
			case 'mana':
				color = '#c66';
				break;
			case 'money':
				color = '#ffe400';
				break;
			}
			// 绘制
			core.status.damage.data.push({
				text: content,
				px: px,
				py: py - 10 * i,
				color: color
			});
			i++;
		}
	}
},
    "技能树": function () {
	// 在此增加新插件

	var childskill = [{
		name: "勇者の证",
		id: "levelup1",
		text: "等级+1,生命+50,\\r[#FFCFAE]攻击+2\\r,\\r[#D1CEFF]防御+2\\r,技能点+1",
		x: 50,
		y: 170,
		p: 0,
		c: 0,
		need: null
	}, {
		name: "剑御者III",
		id: "swordskill",
		text: "勇者装备武器后\\r[#FFCFAE]攻击+40",
		x: 94,
		y: 170,
		p: 3,
		c: 2,
		need: "剑御者II"
	}, {
		name: "盾御者III",
		id: "shieldskill",
		text: "勇者装备盾牌后\\r[#D1CEFF]防御+80",
		x: 138,
		y: 170,
		p: 3,
		c: 2,
		need: "盾御者II"
	}, {
		name: "赤玉の加护III",
		id: "redGem",
		text: "勇者拾取50层以下红宝石效果翻倍",
		x: 182,
		y: 170,
		p: 1,
		c: 4,
		need: "赤玉の加护II"
	}, {
		name: "青玉の加护III",
		id: "blueGem",
		text: "勇者拾取50层以下蓝宝石效果翻倍",
		x: 226,
		y: 170,
		p: 1,
		c: 4,
		need: "青玉の加护II"
	}, {
		name: "超·回复III",
		id: "Potion",
		text: "勇者拾取50层以下血瓶效果提升50%",
		x: 270,
		y: 170,
		p: 1,
		c: 3,
		need: "超·回复II"
	}, {
		name: "超·觉醒",
		id: "POW1",
		text: "限定技，当前生命和\\r[#FFCFAE]攻击\\r翻倍",
		x: 50,
		y: 220,
		p: 5,
		c: 5,
		need: null
	}, {
		name: "剑御者II",
		id: "swordskill",
		text: "勇者装备武器后\\r[#FFCFAE]攻击+20",
		x: 94,
		y: 220,
		p: 2,
		c: 3,
		need: "剑御者I"
	}, {
		name: "盾御者II",
		id: "shieldskill",
		text: "勇者装备盾牌后\\r[#D1CEFF]防御+40",
		x: 138,
		y: 220,
		p: 2,
		c: 3,
		need: "盾御者I"
	}, {
		name: "赤玉の加护II",
		id: "redGem",
		text: "勇者拾取30层以下红宝石效果翻倍",
		x: 182,
		y: 220,
		p: 1,
		c: 4,
		need: "赤玉の加护I"
	}, {
		name: "青玉の加护II",
		id: "blueGem",
		text: "勇者拾取30层以下蓝宝石效果翻倍",
		x: 226,
		y: 220,
		p: 1,
		c: 4,
		need: "青玉の加护I"
	}, {
		name: "超·回复II",
		id: "Potion",
		text: "勇者拾取30层以下血瓶效果提升50%",
		x: 270,
		y: 220,
		p: 1,
		c: 2,
		need: "超·回复I"
	}, {
		name: "神剑战士",
		id: "child2",
		text: "通关时分数+10000",
		x: 50,
		y: 270,
		p: 0,
		c: 5,
		need: null
	}, {
		name: "剑御者I",
		id: "swordskill",
		text: "勇者装备武器后\\r[#FFCFAE]攻击+10",
		x: 94,
		y: 270,
		p: 1,
		c: 4,
		need: null
	}, {
		name: "盾御者I",
		id: "shieldskill",
		text: "勇者装备盾牌后\\r[#D1CEFF]防御+20",
		x: 138,
		y: 270,
		p: 1,
		c: 3,
		need: null
	}, {
		name: "赤玉の加护I",
		id: "redGem",
		text: "勇者拾取10层以下红宝石效果翻倍",
		x: 182,
		y: 270,
		p: 1,
		c: 4,
		need: null
	}, {
		name: "青玉の加护I",
		id: "blueGem",
		text: "勇者拾取10层以下蓝宝石效果翻倍",
		x: 226,
		y: 270,
		p: 1,
		c: 4,
		need: null
	}, {
		name: "超·回复I",
		id: "Potion",
		text: "勇者拾取10层以下血瓶效果提升50%",
		x: 270,
		y: 270,
		p: 1,
		c: 1,
		need: null
	}]


	var thiefskill = [{
		name: "盗贼の证",
		id: "levelup2",
		text: "等级+1,生命+30,\\r[#FFCFAE]攻击+3\\r,\\r[#D1CEFF]防御+1\\r,技能点+1",
		x: 50,
		y: 170,
		p: 0,
		need: null
	}, {
		name: "阿修罗",
		id: "as",
		text: "盗贼战斗时每回合二连击",
		x: 94,
		y: 170,
		p: 5,
		c: 3,
		need: "幽灵一击"
	}, {
		name: "破墙镐精通",
		id: "pickaxeSp",
		text: "盗贼使用破墙镐的范围大幅增加，破坏同行同列所有墙壁",
		x: 138,
		y: 170,
		p: 2,
		c: 3,
		need: "破墙镐增加"
	}, {
		name: "炸弹精通",
		id: "boomSp",
		text: "盗贼对免炸敌人(除魔王外)使用炸弹可使其所有属性减半",
		x: 182,
		y: 170,
		p: 2,
		c: 3,
		need: "炸弹增加"
	}, {
		name: "撬锁精通III",
		id: "redDoor",
		text: "盗贼开启红门不需要钥匙",
		x: 226,
		y: 170,
		p: 3,
		c: 3,
		need: "撬锁精通II"
	}, {
		name: "窃贼诡道III",
		id: "thiefPic",
		text: "盗贼可以开启50层以下暗墙",
		x: 270,
		y: 170,
		p: 1,
		c: 4,
		need: "窃贼诡道II"
	}, {
		name: "大崩坏",
		id: "POW2",
		text: "限定技，破坏上层、本层、下层所有墙壁，并显示隐藏的楼梯",
		x: 50,
		y: 220,
		p: 5,
		c: 3,
		need: null
	}, {
		name: "幽灵一击",
		id: "shadow",
		text: "盗贼战斗时额外先攻一回合,本回合攻击无视防御",
		x: 94,
		y: 220,
		p: 1,
		c: 3,
		need: "双刀流"
	}, {
		name: "撬锁精通II",
		id: "blueDoor",
		text: "盗贼开启蓝门不需要钥匙",
		x: 226,
		y: 220,
		p: 3,
		c: 3,
		need: "撬锁精通I"
	}, {
		name: "窃贼诡道II",
		id: "thiefPic",
		text: "盗贼可以开启30层以下暗墙",
		x: 270,
		y: 220,
		p: 1,
		c: 5,
		need: "窃贼诡道I"
	}, {
		name: "怪盗杰克",
		id: "thief2",
		text: "通关时分数+10000",
		x: 50,
		y: 270,
		p: 0,
		c: 5,
		need: null
	}, {
		name: "双刀流",
		id: "thiefAtk",
		text: "盗贼可额外获得主武器一半的攻击力，不再装备盾牌",
		x: 94,
		y: 270,
		p: 1,
		c: 3,
		need: null
	}, {
		name: "破墙镐增加",
		id: "pickaxe",
		text: "获得一把破墙镐",
		x: 138,
		y: 270,
		p: 1,
		c: 3,
		need: null
	}, {
		name: "炸弹增加",
		id: "boom",
		text: "获得一颗炸弹",
		x: 182,
		y: 270,
		p: 1,
		c: 3,
		need: null
	}, {
		name: "撬锁精通I",
		id: "yellowDoor",
		text: "盗贼开启黄门不需要钥匙",
		x: 226,
		y: 270,
		p: 3,
		c: 5,
		need: null
	}, {
		name: "窃贼诡道I",
		id: "thiefPic",
		text: "盗贼可以开启10层以下暗墙",
		x: 270,
		y: 270,
		p: 1,
		c: 5,
		need: null
	}]

	var womanskill = [{
		name: "商人の证",
		id: "levelup3",
		text: "等级+1,生命+30,\\r[#FFCFAE]攻击+1\\r,\\r[#D1CEFF]防御+1\\r,技能点+1",
		x: 50,
		y: 170,
		p: 0,
		need: null
	}, {
		name: "贪婪II",
		id: "badman3",
		text: "卖出装备时商人获取其一半属性",
		x: 94,
		y: 170,
		p: 1,
		c: 3,
		need: "秘宝の卖价"
	}, {
		name: "贪婪I",
		id: "badman2",
		text: "卖出宝石和血瓶时商人获取同等属性",
		x: 138,
		y: 170,
		p: 1,
		c: 3,
		need: "血瓶の卖价"
	}, {
		name: "钥匙の卖价III",
		id: "redKey",
		text: "红钥匙卖出价格翻倍",
		x: 182,
		y: 170,
		p: 2,
		c: 2,
		need: "钥匙の卖价II"
	}, {
		name: "诈骗III",
		id: "badman",
		text: "商人与其他50层以下商人交易时可选择诈骗，获取其提出\\r[#ffe888]金币\\r和道具",
		x: 226,
		y: 170,
		p: 1,
		c: 4,
		need: "诈骗II"
	}, {
		name: "偷税III",
		id: "shop",
		text: "所有队员供奉所需\\r[#ffe888]金币\\r降低30%",
		x: 270,
		y: 170,
		p: 3,
		c: 5,
		need: "偷税II"
	}, {
		name: "渎神",
		id: "POW3",
		text: "限定技，贪婪之神的供奉所需\\r[#ffe888]金币\\r重置",
		x: 50,
		y: 220,
		p: 5,
		c: 5,
		need: null
	}, {
		name: "秘宝の卖价",
		id: "items",
		text: "特殊宝物卖出价格翻倍，手册、楼传和记事本不可卖出",
		x: 94,
		y: 220,
		p: 1,
		c: 4,
		need: "装备の卖价"
	}, {
		name: "血瓶の卖价",
		id: "woman_Potion",
		text: "血瓶卖出价格翻倍",
		x: 138,
		y: 220,
		p: 1,
		c: 4,
		need: "宝石の卖价"
	}, {
		name: "钥匙の卖价II",
		id: "blueKey",
		text: "蓝钥匙卖出价格翻倍",
		x: 182,
		y: 220,
		p: 2,
		c: 3,
		need: "钥匙の卖价I"
	}, {
		name: "诈骗II",
		id: "badman",
		text: "商人与其他30层以下商人交易时可选择诈骗，获取其提出\\r[#ffe888]金币\\r和道具",
		x: 226,
		y: 220,
		p: 1,
		c: 4,
		need: "诈骗I"
	}, {
		name: "偷税II",
		id: "shop",
		text: "所有队员供奉所需\\r[#ffe888]金币\\r降低20%",
		x: 270,
		y: 220,
		p: 2,
		c: 5,
		need: "偷税I"
	}, {
		name: "炼金术士",
		id: "woman2",
		text: "通关时分数+10000",
		x: 50,
		y: 270,
		p: 0,
		c: 5,
		need: null
	}, {
		name: "装备の卖价",
		id: "equip",
		text: "武器和盾牌的卖出价格翻倍",
		x: 94,
		y: 270,
		p: 1,
		c: 3,
		need: null
	}, {
		name: "宝石の卖价",
		id: "Gem",
		text: "宝石卖出价格翻倍",
		x: 138,
		y: 270,
		p: 1,
		c: 2,
		need: null
	}, {
		name: "钥匙の卖价I",
		id: "yellowKey",
		text: "黄钥匙卖出价格翻倍",
		x: 182,
		y: 270,
		p: 2,
		c: 1,
		need: null
	}, {
		name: "诈骗I",
		id: "badman",
		text: "商人与其他10层以下商人交易时可选择诈骗，获取其提出\\r[#ffe888]金币\\r和道具",
		x: 226,
		y: 270,
		p: 1,
		c: 3,
		need: null
	}, {
		name: "偷税I",
		id: "shop",
		text: "所有队员供奉所需\\r[#ffe888]金币\\r降低10%",
		x: 270,
		y: 270,
		p: 1,
		c: 5,
		need: null
	}]

	var manskill = [{
		name: "贤者の证",
		id: "levelup4",
		text: "等级+1,生命+30,\\r[#FFCFAE]攻击+2\\r,\\r[#D1CEFF]防御+1\\r,技能点+1",
		x: 50,
		y: 170,
		p: 0,
		need: null
	}, {
		name: "大祭司",
		id: "djs",
		text: "贤者在商店加点时获取双倍属性",
		x: 94,
		y: 170,
		p: 3,
		c: 2,
		need: "巫师"
	}, {
		name: "先知",
		id: "xz",
		text: "所有商店加点变为5区效果",
		x: 138,
		y: 170,
		p: 3,
		c: 2,
		need: "法术破坏"
	}, {
		name: "大贤者III",
		id: "BigMan1",
		text: "其他角色升级所需\\r[#ffe888]金币-20",
		x: 182,
		y: 170,
		p: 1,
		c: 3,
		need: "大贤者II"
	}, {
		name: "大贤者VI",
		id: "BigMan2",
		text: "其他角色升级所需\\r[#ffe888]金币-50",
		x: 226,
		y: 170,
		p: 1,
		c: 3,
		need: "大贤者V"
	}, {
		name: "大贤者IX",
		id: "BigMan3",
		text: "其他角色升级所需\\r[#ffe888]金币-100",
		x: 270,
		y: 170,
		p: 1,
		c: 3,
		need: "大贤者VIII"
	}, {
		name: "大退化术",
		id: "POW4",
		text: "限定技，将本层能破防的怪物变成绿色史莱姆，对大法师、魔王无效",
		x: 50,
		y: 220,
		p: 5,
		c: 5,
		need: null
	}, {
		name: "大贤者II",
		id: "BigMan1",
		text: "其他角色升级所需\\r[#ffe888]金币-15",
		x: 182,
		y: 220,
		p: 1,
		c: 3,
		need: "大贤者I"
	}, {
		name: "大贤者V",
		id: "BigMan2",
		text: "其他角色升级所需\\r[#ffe888]金币-40",
		x: 226,
		y: 220,
		p: 1,
		c: 3,
		need: "大贤者IV"
	}, {
		name: "大贤者VIII",
		id: "BigMan3",
		text: "其他角色升级所需\\r[#ffe888]金币-80",
		x: 270,
		y: 220,
		p: 1,
		c: 3,
		need: "大贤者VII"
	}, {
		name: "传奇法师",
		id: "man2",
		text: "通关时分数+10000",
		x: 50,
		y: 270,
		p: 0,
		c: 5,
		need: null
	}, {
		name: "巫师",
		id: "magic",
		text: "贤者攻击时无视防御",
		x: 94,
		y: 270,
		p: 3,
		c: 4,
		need: null
	}, {
		name: "法术破坏",
		id: "magicNo",
		text: "所有角色战斗时无视特技，仅限连击、先攻、魔攻、坚固、吸血",
		x: 138,
		y: 270,
		p: 3,
		c: 3,
		need: null
	}, {
		name: "大贤者I",
		id: "BigMan1",
		text: "其他角色升级所需\\r[#ffe888]金币-10",
		x: 182,
		y: 270,
		p: 1,
		c: 3,
		need: null
	}, {
		name: "大贤者IV",
		id: "BigMan2",
		text: "其他角色升级所需\\r[#ffe888]金币-30",
		x: 226,
		y: 270,
		p: 1,
		c: 3,
		need: "大贤者III"
	}, {
		name: "大贤者VII",
		id: "BigMan3",
		text: "其他角色升级所需\\r[#ffe888]金币-60",
		x: 270,
		y: 270,
		p: 1,
		c: 3,
		need: "大贤者VI"
	}]

	var princessskill = [{
		name: "公主の证",
		id: "levelup5",
		text: "等级+1,生命+20,\\r[#FFCFAE]攻击+2\\r,\\r[#D1CEFF]防御+2\\r,技能点+1",
		x: 50,
		y: 170,
		p: 0,
		need: null
	}, {
		name: "神女の泪III",
		id: "p_woter",
		text: "获得一瓶圣水",
		x: 270,
		y: 170,
		p: 1,
		c: 3,
		need: "神女の泪II"
	}, {
		name: "女武神",
		id: "POW5",
		text: "限定技，下次战斗时公主附加同楼层所有队友攻击，习得守护骑士时增加勇者攻击可计算两次",
		x: 50,
		y: 220,
		p: 5,
		c: 5,
		need: null
	}, {
		name: "守护骑士",
		id: "p_battle",
		text: "与勇者在同一层时，公主战斗时附加勇者的攻击",
		x: 94,
		y: 220,
		p: 3,
		c: 5,
		need: null
	}, {
		name: "神圣净化",
		id: "p_shield",
		text: "领域魔法攻击对公主无效",
		x: 138,
		y: 220,
		p: 3,
		c: 2,
		need: null
	}, {
		name: "群星庇护",
		id: "p_mdef",
		text: "公主战斗时免疫一回合攻击",
		x: 182,
		y: 220,
		p: 3,
		c: 4,
		need: null
	}, {
		name: "恶魔克星",
		id: "p_boss",
		text: "公主战斗时对区域头目、魔王和大法师伤害加倍",
		x: 226,
		y: 220,
		p: 3,
		c: 5,
		need: null
	}, {
		name: "神女の泪II",
		id: "p_woter",
		text: "获得一瓶圣水",
		x: 270,
		y: 220,
		p: 1,
		c: 4,
		need: "神女の泪I"
	}, {
		name: "最终兵器",
		id: "princess2",
		text: "通关时分数+10000",
		x: 50,
		y: 270,
		p: 0,
		c: 5,
		need: null
	}, {
		name: "神女の泪I",
		id: "p_woter",
		text: "获得一瓶圣水",
		x: 270,
		y: 270,
		p: 1,
		c: 5,
		need: null
	}]

	var fairyskill = [{
		name: "妖精の证",
		id: "levelup6",
		text: "等级+1,生命+10,\\r[#FFCFAE]攻击+1\\r,\\r[#D1CEFF]防御+1\\r,技能点+1",
		x: 50,
		y: 170,
		p: 0,
		need: null
	}, {
		name: "护心の镜",
		id: "fairyShield",
		text: "妖精在战斗时最多受到777点伤害",
		x: 94,
		y: 170,
		p: 5,
		c: 3,
		need: "魅惑の瞳"
	}, {
		name: "镜像の翼III",
		id: "fairyCenterFly",
		text: "获得一件中心对称飞行器",
		x: 270,
		y: 170,
		p: 1,
		c: 2,
		need: "镜像の翼II"
	}, {
		name: "天国の门",
		id: "POW6",
		text: "限定技，直接前进到49层",
		x: 50,
		y: 220,
		p: 5,
		c: 5,
		need: null
	}, {
		name: "幻影の羽",
		id: "fairyFly",
		text: "妖精移动无视墙壁、星空",
		x: 138,
		y: 220,
		p: 3,
		c: 5,
		need: null
	}, {
		name: "降临の翼",
		id: "fairyDown",
		text: "获得一件下楼器",
		x: 182,
		y: 220,
		p: 3,
		c: 3,
		need: null
	}, {
		name: "飞升の翼",
		id: "fairyUp",
		text: "获得一件上楼器",
		x: 226,
		y: 220,
		p: 3,
		c: 3,
		need: null
	}, {
		name: "镜像の翼II",
		id: "fairyCenterFly",
		text: "获得一件中心对称飞行器",
		x: 270,
		y: 220,
		p: 1,
		c: 2,
		need: "镜像の翼I"
	}, {
		name: "湖中仙女",
		id: "fairy2",
		text: "通关时分数+10000",
		x: 50,
		y: 270,
		p: 0,
		c: 5,
		need: null
	}, {
		name: "魅惑の瞳",
		id: "fairyEyes",
		text: "妖精战斗7回合后直接胜利，对魔王和大法师无效",
		x: 94,
		y: 270,
		p: 3,
		c: 5,
		need: null
	}, {
		name: "镜像の翼I",
		id: "fairyCenterFly",
		text: "获得一件中心对称飞行器",
		x: 270,
		y: 270,
		p: 1,
		c: 2,
		need: null
	}]

	core.myskilltree = function () {
		//if (core.isReplaying()) return;
		core.status.holdingKeys = []; ///清空按下的键
		core.lockControl();
		flags.theSkillUI = 0;
		core.status.event.id = 'myskilltree';
		if (flags.theHero === 'child')
			flags.heroskill = childskill;
		else if (flags.theHero === 'thief')
			flags.heroskill = thiefskill;
		else if (flags.theHero === 'woman')
			flags.heroskill = womanskill;
		else if (flags.theHero === 'man')
			flags.heroskill = manskill;
		else if (flags.theHero === 'princess')
			flags.heroskill = princessskill;
		else if (flags.theHero === 'fairy')
			flags.heroskill = fairyskill;

		core.myskilltree_draw(); ///重绘页面
	}

	core.quit_myskilltree = function () {
		core.clearUI();
		core.status.event.id = null;
		core.unlockControl();
		if (core.isReplaying())
			core.replay();
	}

	core.enter_myskilltree = function () {
		var i = flags.theSkillUI;
		if (i > 0) {
			if (core.inArray(flags.skill1, flags.heroskill[i].name)) {
				core.drawTip(flags.heroskill[i].name + ' 已经学会了');
			} else if (core.inArray(['超·觉醒', '大崩坏', '渎神', '大退化术', '女武神', '天国の门'], flags.heroskill[i].name) && flags.lv < 10) {
				core.drawTip('等级不足');
			} else if (core.inArray(['神剑战士', '怪盗杰克', '炼金术士', '传奇法师', '最终兵器', '湖中仙女'], flags.heroskill[i].name) && flags.lv < 15) {
				core.drawTip('等级不足');
			} else if (flags.heroskill[i].need != null && !core.inArray(flags.skill1, flags.heroskill[i].need))
				core.drawTip('未学会前置技能:' + flags.heroskill[i].need);
			else if (flags.heroskill[i].p > flags.skillpoint) {
				core.drawTip('技能点不足');
			} else {
				flags.skillpoint -= flags.heroskill[i].p;
				flags.skill1.push(flags.heroskill[i].name);
				core.drawTip('习得：' + flags.heroskill[i].name);
				core.addskillitem(flags.heroskill[i].name);
				core.status.route.push('skill:' + i)
			}
		} else {
			if (hero.money < core.upneedmoney()) {
				core.drawTip('金币不足');
			} else {
				hero.money -= core.upneedmoney();
				core.drawTip('等级已提升');
				flags.lv++;
				flags.skillpoint++;
				core.uphero();
				core.updateStatusBar();
				core.status.route.push('skill:' + i)
			}
		}
		core.myskilltree_draw(); ///重绘页面
	}

	core.uphero = function () {
		if (flags.theHero === 'child') {
			hero.hp += 50;
			hero.atk += 2;
			hero.def += 2;
		} else if (flags.theHero === 'thief') {
			hero.hp += 30;
			hero.atk += 3;
			hero.def += 1;
		} else if (flags.theHero === 'woman') {
			hero.hp += 30;
			hero.atk += 1;
			hero.def += 1;
		} else if (flags.theHero === 'man') {
			hero.hp += 30;
			hero.atk += 2;
			hero.def += 1;
		} else if (flags.theHero === 'princess') {
			hero.hp += 20;
			hero.atk += 2;
			hero.def += 2;
		} else if (flags.theHero === 'fairy') {
			hero.hp += 10;
			hero.atk += 1;
			hero.def += 1;
		}
	}

	core.addskillitem = function (name) {
		if (name === '破墙镐增加')
			core.getItem('pickaxe');
		else if (name === '炸弹增加')
			core.getItem('bomb');
		else if (name === '神女の泪III')
			core.getItem('superPotion');
		else if (name === '神女の泪II')
			core.getItem('superPotion');
		else if (name === '神女の泪I')
			core.getItem('superPotion');
		else if (name === '降临の翼')
			core.getItem('downFly');
		else if (name === '飞升の翼')
			core.getItem('upFly');
		else if (name === '镜像の翼III')
			core.getItem('centerFly');
		else if (name === '镜像の翼II')
			core.getItem('centerFly');
		else if (name === '镜像の翼I')
			core.getItem('centerFly');
		else if (name === '赤玉の加护III')
			flags.redG = 5;
		else if (name === '赤玉の加护II')
			flags.redG = 3;
		else if (name === '赤玉の加护I')
			flags.redG = 1;
		else if (name === '青玉の加护III')
			flags.blueG = 5;
		else if (name === '青玉の加护II')
			flags.blueG = 3;
		else if (name === '青玉の加护I')
			flags.blueG = 1;
		else if (name === '超·回复III')
			flags.Potion = 5;
		else if (name === '超·回复II')
			flags.Potion = 3;
		else if (name === '超·回复I')
			flags.Potion = 1;
		else if (name === '诈骗III')
			flags.zhapian = 5;
		else if (name === '诈骗II')
			flags.zhapian = 3;
		else if (name === '诈骗I')
			flags.zhapian = 1;
		else if (name === '偷税III')
			flags.womanmoney -= 0.3;
		else if (name === '偷税II')
			flags.womanmoney -= 0.2;
		else if (name === '偷税I')
			flags.womanmoney -= 0.1;
		else if (name === '大贤者IX')
			flags.manmoney += 100;
		else if (name === '大贤者VIII')
			flags.manmoney += 80;
		else if (name === '大贤者VII')
			flags.manmoney += 60;
		else if (name === '大贤者VI')
			flags.manmoney += 50;
		else if (name === '大贤者V')
			flags.manmoney += 40;
		else if (name === '大贤者IV')
			flags.manmoney += 30;
		else if (name === '大贤者III')
			flags.manmoney += 20;
		else if (name === '大贤者II')
			flags.manmoney += 15;
		else if (name === '大贤者I')
			flags.manmoney += 10;

		if (name === '先知') {
			//console.log('aaa')
			flags.ratio = 5;
		}

		if (name === '剑御者I' && flags.nowWeapon != null)
			hero.atk += 10;
		else if (name === '剑御者II' && flags.nowWeapon != null)
			hero.atk += 20;
		else if (name === '剑御者III' && flags.nowWeapon != null)
			hero.atk += 40;

		if (name === '盾御者I' && flags.nowShield != null)
			hero.def += 20;
		else if (name === '盾御者II' && flags.nowShield != null)
			hero.def += 40;
		else if (name === '盾御者III' && flags.nowShield != null)
			hero.def += 80;

		if (name === '双刀流') {
			if (flags.nowShield) {
				hero.def -= Math.ceil(Number(core.material.items[flags.nowShield].canUseItemEffect) / 10);
				core.setBlock(flags.nowShield, hero.loc.x, hero.loc.y)
				flags.nowShield = null;
			}
			if (flags.nowWeapon) {
				hero.atk += Math.ceil(Number(core.material.items[flags.nowWeapon].canUseItemEffect) / 10) / 2;
				flags.nowShield = flags.nowWeapon;
			}
		}

		if (name === '超·觉醒')
			core.addItem('POW1');
		else if (name === '大崩坏')
			core.addItem('POW2');
		else if (name === '渎神')
			core.addItem('POW3');
		else if (name === '大退化术')
			core.addItem('POW4');
		else if (name === '女武神')
			core.addItem('POW5');
		else if (name === '天国の门')
			core.addItem('POW6');

		if (core.inArray(['神剑战士', '怪盗杰克', '炼金术士', '传奇法师', '最终兵器', '湖中仙女'], name)) {
			flags.mark += 10000;
			core.setHeroIcon(flags.theHero + '2.png');
		}

		core.updateStatusBar();
		core.drawHero();

		if (flags.theHero === 'child') {
			flags.redG_use = flags.redG;
			flags.blueG_use = flags.blueG;
			flags.Potion_use = flags.Potion;
			core.getItemDetail();
			core.redrawMap();
		}
	}

	core.myskilltree_draw = function () {
		core.clearUI();
		//首先绘制背景
		core.clearMap('ui');
		core.drawWindowSkin('winskin.png', 'ui', 15, 15, 352 - 30, 352 - 30);
		core.setTextAlign('ui', 'center');
		core.fillText('ui', "角色升级", 352 / 2, 40, '#E1E1E1', 'bold 22px Verdana');
		core.fillText('ui', "快捷键F", 352 / 2 + 110, 40, '#888888', 'bold 18px Verdana');
		core.fillText('ui', "——点击任意处退出（X）——", 352 / 2, 325, '#E1E1E1', 'bold 14px Verdana');
		core.fillRoundRect('ui', 50, 50, 32, 32, 4, "#444444");
		core.strokeRoundRect('ui', 50 - 2, 50 - 2, 36, 36, 4, "#444444", 1)
		var heroStatus
		var heroStatusAll = [{
			name: '勇者',
			id: 'child'
		}, {
			name: '盗贼',
			id: 'thief'
		}, {
			name: '商人',
			id: 'woman'
		}, {
			name: '贤者',
			id: 'man'
		}, {
			name: '公主',
			id: 'princess'
		}, {
			name: '妖精',
			id: 'fairy'
		}];
		var heroid = ['child', 'thief', 'woman', 'man', 'princess', 'fairy']
		var iconskill = ['神剑战士', '怪盗杰克', '炼金术士', '传奇法师', '最终兵器', '湖中仙女']
		var icon = '';
		for (var j in heroid) {
			if (flags.theHero === heroid[j]) {
				heroStatus = heroStatusAll[j];
				if (core.inArray(flags.skill1, iconskill[j]))
					icon = '2';
			}
		}
		core.drawImage('ui', flags.theHero + icon + '.png', 0, 0, 32, 32, 50, 50, 32, 32);
		core.setTextAlign('ui', 'left');
		core.fillText('ui', "Lv." + flags.lv, 45, 100, '#E1E1E1', 'bold 16px Verdana');
		core.fillText('ui', heroStatus.name, 50, 120, '#E1E1E1', 'bold 16px Verdana');
		core.strokeRoundRect('ui', 40, 160, 352 - 80, 152, 4, "#444444", 1);

		var highLine = 0;
		for (var h in flags.heroskill) {
			if (flags.heroskill[h].x == 94)
				highLine += 1;
			else if (flags.heroskill[h].x == 138)
				highLine += 10;
			else if (flags.heroskill[h].x == 182)
				highLine += 100;
			else if (flags.heroskill[h].x == 226)
				highLine += 1000;
			else if (flags.heroskill[h].x == 270)
				highLine += 10000;
		}
		if (highLine / 10000 >= 2) {
			core.drawLine('ui', 270 + 16 - 4, 170 + 16, 270 + 16 - 4, 270 + 16, "#444444", 1);
			core.drawLine('ui', 270 + 16 + 4, 170 + 16, 270 + 16 + 4, 270 + 16, "#444444", 1);
			core.drawLine('ui', 270 + 16, 170 + 16, 270 + 16, 270 + 16, "#444444", 4);
		}
		if ((highLine % 10000) / 1000 >= 2) {
			core.drawLine('ui', 226 + 16 - 4, 170 + 16, 226 + 16 - 4, 270 + 16, "#444444", 1);
			core.drawLine('ui', 226 + 16 + 4, 170 + 16, 226 + 16 + 4, 270 + 16, "#444444", 1);
			core.drawLine('ui', 226 + 16, 170 + 16, 226 + 16, 270 + 16, "#444444", 4);
		}
		if ((highLine % 1000) / 100 >= 2) {
			core.drawLine('ui', 182 + 16 - 4, 170 + 16, 182 + 16 - 4, 270 + 16, "#444444", 1);
			core.drawLine('ui', 182 + 16 + 4, 170 + 16, 182 + 16 + 4, 270 + 16, "#444444", 1);
			core.drawLine('ui', 182 + 16, 170 + 16, 182 + 16, 270 + 16, "#444444", 4);
		}
		if ((highLine % 100) / 10 >= 2) {
			core.drawLine('ui', 138 + 16 - 4, 170 + 16, 138 + 16 - 4, 270 + 16, "#444444", 1);
			core.drawLine('ui', 138 + 16 + 4, 170 + 16, 138 + 16 + 4, 270 + 16, "#444444", 1);
			core.drawLine('ui', 138 + 16, 170 + 16, 138 + 16, 270 + 16, "#444444", 4);
		}
		if ((highLine % 10) / 1 >= 2) {
			core.drawLine('ui', 94 + 16 - 4, 170 + 16, 94 + 16 - 4, 270 + 16, "#444444", 1);
			core.drawLine('ui', 94 + 16 + 4, 170 + 16, 94 + 16 + 4, 270 + 16, "#444444", 1);
			core.drawLine('ui', 94 + 16, 170 + 16, 94 + 16, 270 + 16, "#444444", 4);
		}

		for (var i in flags.heroskill) {
			var x = flags.heroskill[i].x;
			var y = flags.heroskill[i].y;
			core.fillRoundRect('ui', x, y, 32, 32, 4, "#444444");
			core.strokeRoundRect('ui', x - 2, y - 2, 36, 36, 4, "#444444", 1)
			if (core.inArray(flags.skill1, flags.heroskill[i].name)) {
				//core.fillRoundRect('ui', x, y, 32, 32, 4, "#b1b1b1");
				core.strokeRoundRect('ui', x - 2, y - 2, 36, 36, 4, "#ccccff", 1);

			} else if (flags.heroskill[i].need != null && !core.inArray(flags.skill1, flags.heroskill[i].need)) {
				//core.fillRoundRect('ui', x, y, 32, 32, 4, "#573b3b");
				//core.strokeRoundRect('ui', x - 2, y - 2, 36, 36, 4, "#ff8888", 1);
				core.setFilter('ui', 'brightness(0%)');
				core.setAlpha('ui', 0.4);
			} else {
				core.setFilter('ui', 'brightness(50%)grayscale(70%)');
				core.setAlpha('ui', 0.7);
			}
			core.drawImage('ui', flags.heroskill[i].id + '.png', 0, 0, 32, 32, x, y, 32, 32);
			//if (flags.heroskill[i].name.indexOf('卖价') != -1)
			//	core.drawImage('ui', 'money.png', 0, 0, 32, 32, x, y, 32, 32);
			var Ilength = ['IX', 'VIII', 'VII', 'VI', 'IV', 'V', 'III', 'II', 'I'];
			var has = false;
			for (var n in Ilength) {
				if (flags.heroskill[i].name.indexOf(Ilength[n]) != -1 && !has) {
					core.drawImage('ui', Ilength[n] + '.png', 0, 0, 32, 32, x, y, 32, 32);
					has = true;
				}
			}
			core.setFilter('ui', '');
			core.setAlpha('ui', 1);
			var canup = true;

			if (i > 0) {
				if (core.inArray(flags.skill1, flags.heroskill[i].name)) {
					canup = false
				} else if (core.inArray(['超·觉醒', '大崩坏', '渎神', '大退化术', '女武神', '天国の门'], flags.heroskill[i].name) && flags.lv < 10) {
					canup = false
				} else if (core.inArray(['神剑战士', '怪盗杰克', '炼金术士', '传奇法师', '最终兵器', '湖中仙女'], flags.heroskill[i].name) && flags.lv < 15) {
					canup = false
				} else if (flags.heroskill[i].need != null && !core.inArray(flags.skill1, flags.heroskill[i].need))
					canup = false
				else if (flags.heroskill[i].p > flags.skillpoint) {
					canup = false
				}
			} else {
				if (hero.money < core.upneedmoney())
					canup = false
			}

			if (canup) {
				core.drawMyCircle('ui', x + 5, y + 5);
				if (i == 0)
					core.drawImage('ui', 'canUp.png', 0, 0, 32, 32, x, y, 32, 32);
			}

			if (flags.theSkillUI == i) {

				core.strokeRoundRect('ui', x - 2, y - 2, 36, 36, 4, "#ffff80", 1);
				core.fillPolygon('ui', [
					[x + 2, y + 16],
					[x - 2, y + 16 + 4],
					[x - 2, y + 16 - 4]
				], "#ffff80");
				core.fillPolygon('ui', [
					[x + 32 - 2, y + 16],
					[x + 32 + 2, y + 16 + 4],
					[x + 32 + 2, y + 16 - 4]
				], "#ffff80");
			}


		}
		core.strokeRoundRect('ui', 100, 50 - 2, 352 - 100 - 40, 80, 4, "#444444", 1);
		core.fillRoundRect('ui', 102, 50, 352 - 100 - 40 - 4, 80 - 4, 4, "#444444");
		core.strokeRoundRect('ui', 40, 133 - 2, 352 - 80, 25, 4, "#444444", 1);
		core.fillRoundRect('ui', 42, 133, 352 - 80 - 4, 25 - 4, 4, "#444444");
		var k = flags.theSkillUI; {
			core.fillText('ui', flags.heroskill[k].name, 106, 50 + 20, '#E1E1E1', 'bold 16px Verdana');

			//core.fillText('ui', flags.heroskill[k].text, 106, 50 + 20 + 20, '#E1E1E1', 'bold 12px Verdana');
			var text = flags.heroskill[k].text;
			var height = null;
			var max_height = 110;
			if (text) {
				for (var fontSize = 17; fontSize >= 9; fontSize -= 2) {
					var config = { left: 106, top: 50 + 20 + 20 - 12, fontSize: 12, maxWidth: 352 - 100 - 40 - 4, bold: true, color: "#E1E1E1" };
					height = 42 + core.getTextContentHeight(text, config);
					if (height < max_height || fontSize == 9) {
						core.drawTextContent('ui', text, config);
						break;
					}
				}
			}


			core.drawLine('ui', 100, 54 + 20, 312, 56 + 20, '#676767', 1);
			core.fillText('ui', '技能点：' + flags.skillpoint, 44, 150 - 2, '#E1E1E1', 'bold 12px Verdana');
			var col = "\\r[#E1E1E1]"
			if (k > 0) {
				var star = ''
				for (var l = 0; l < flags.heroskill[k].c; l++)
					star += '★';
				star += '\\r[#808080]'
				for (var l = flags.heroskill[k].c; l < 5; l++)
					star += '☆';
				core.fillText('ui', '推荐度：' + star, 119, 150 - 2, '#E1E1E1', 'bold 12px Verdana');
				if (flags.heroskill[k].p > flags.skillpoint)
					col = '\\r[#ff8888]';
			} else {
				if (hero.money < core.upneedmoney())
					col = '\\r[#ff8888]';
			}
			core.setTextAlign('ui', 'right');
			if (core.inArray(flags.skill1, flags.heroskill[k].name))
				core.fillText('ui', '已习得', 304, 50 + 20, '#E1E1E1', 'bold 16px Verdana');
			else
				core.fillText('ui', '未习得', 304, 50 + 20, '#888888', 'bold 16px Verdana');
			if (flags.heroskill[k].need != null && !core.inArray(flags.skill1, flags.heroskill[k].need))
				core.fillText('ui', '需要前置技能:' + flags.heroskill[k].need, 304, 50 + 70, '#E1E1E1', 'bold 12px Verdana');
			else if (!core.inArray(flags.skill1, flags.heroskill[k].name) && core.inArray(['超·觉醒', '大崩坏', '渎神', '大退化术', '女武神', '天国の门'], flags.heroskill[k].name))
				core.fillText('ui', '需要10级才能学习', 304, 50 + 70, '#E1E1E1', 'bold 12px Verdana');
			else if (!core.inArray(flags.skill1, flags.heroskill[k].name) && core.inArray(['神剑战士', '怪盗杰克', '炼金术士', '传奇法师', '最终兵器', '湖中仙女'], flags.heroskill[k].name))
				core.fillText('ui', '需要15级才能学习', 304, 50 + 70, '#E1E1E1', 'bold 12px Verdana');
			else if (!core.inArray(flags.skill1, flags.heroskill[k].name) || k == 0)
				core.fillText('ui', '再次点击图标升级(Enter)', 304, 50 + 70, '#E1E1E1', 'bold 12px Verdana');
			if (k > 0)
				core.fillText('ui', '需要点数：' + col + flags.heroskill[k].p, 304, 150 - 2, '#E1E1E1', 'bold 12px Verdana');
			else
				core.fillText('ui', '需要金币：' + col + (core.upneedmoney()), 304, 150 - 2, '#E1E1E1', 'bold 12px Verdana');
		}

	}

	core.upneedmoney = function () {
		if (flags.theHero != 'man')
			return (Math.max(0, 20 + 10 * flags.lv * (flags.lv - 1) - flags.manmoney));
		else
			return (Math.max(0, 20 + 10 * flags.lv * (flags.lv - 1) - 405));
	}

	core.drawMyCircle = function (ctx, x, y) {
		core.fillCircle(ctx, x, y, 2, '#fe6060');
		core.fillCircle(ctx, x - 3, y - 3, 1, '#ffffff');
		core.strokeCircle(ctx, x, y, 5, '#fe6060', 1);
		//core.fillText(ctx, '可升级', x, y + 32, '#E1E1E1', 'bold 12px Verdana');
	}

	this.myskilltree_keyDown = function (keycode) {
		if (core.status.event.id !== 'myskilltree') return false;

		var done = false

		if (keycode == 37) {
			if (flags.theSkillUI > 0)
				flags.theSkillUI -= 1;
		} else if (keycode == 39) {
			if (flags.theSkillUI < flags.heroskill.length - 1)
				flags.theSkillUI += 1;
		} else if (keycode == 38) {
			for (var j in flags.heroskill) {
				if (flags.heroskill[j].x == flags.heroskill[flags.theSkillUI].x && flags.heroskill[j].y == flags.heroskill[flags.theSkillUI].y - 50) {
					if (!done) {
						flags.theSkillUI = Number(j);
						done = true;
					}
				}

			}
			for (var j in flags.heroskill) {
				if (flags.heroskill[j].x == flags.heroskill[flags.theSkillUI].x && flags.heroskill[j].y == flags.heroskill[flags.theSkillUI].y - 100) {
					if (!done) {
						flags.theSkillUI = Number(j);
						done = true;
					}
				}

			}
			if (!done)
				flags.theSkillUI = 0;
		} else if (keycode == 40) {
			for (var j in flags.heroskill) {
				if (flags.heroskill[j].x == flags.heroskill[flags.theSkillUI].x && flags.heroskill[j].y == flags.heroskill[flags.theSkillUI].y + 50) {
					if (!done) {
						flags.theSkillUI = Number(j);
						done = true;
					}
				}

			}
			for (var j in flags.heroskill) {
				if (flags.heroskill[j].x == flags.heroskill[flags.theSkillUI].x && flags.heroskill[j].y == flags.heroskill[flags.theSkillUI].y + 100) {
					if (!done) {
						flags.theSkillUI = Number(j);
						done = true;
					}
				}

			}
			if (!done)
				flags.theSkillUI = flags.heroskill.length - 1;
		}

		core.myskilltree_draw(); ///重绘页面

		return true;
	}
	core.registerAction('keyDown', 'myskilltree', 'myskilltree_keyDown', 100);

	var myskilltree = function (keycode) {
		if (core.status.event.id !== 'myskilltree') return false;

		if (keycode == 32 || keycode == 13 || keycode == 67) { //c\space\enter
			core.enter_myskilltree();
		}
		if (keycode == 88 || keycode == 70 || keycode == 27) { ////x、q和Esc退出
			core.quit_myskilltree();
		}
		if (keycode == 81) { //切换角色
			core.quit_myskilltree();
			core.mychangeHero();
		}
		return true; ///全部拦截
	};
	core.registerAction('keyUp', 'myskilltree', myskilltree, 100);

	this.myskilltree_onmove = function (x, y, px, py) {
		if (core.status.event.id !== 'myskilltree') return false;


		var boxX = Math.floor((px - 50) / 44), //点击盒子坐标
			boxY = Math.floor((py - 170) / 50);
		if (px < boxX * 44 + 50 || px > boxX * 44 + 50 + 36 || py < boxY * 50 + 170 || py > boxY * 50 + 170 + 36) return false;
		if (boxX < 0 || boxX > 5 || boxY < 0 || boxY > 2) return false;
		var i = boxX + boxY * 6;
		if (i >= 0 && i <= 18) {
			{
				for (var j in flags.heroskill) {
					if (flags.heroskill[j].x == boxX * 44 + 50 && flags.heroskill[j].y == boxY * 50 + 170 && j != flags.theSkillUI) {
						flags.theSkillUI = Number(j);
						core.myskilltree_draw(); ///重绘页面
						//console.log(boxX + ',' + boxY + ',' + px + ',' + py);
					}
				}

			}

		}

		return true;
	}
	core.registerAction('onmove', 'myskilltree', 'myskilltree_onmove', 100);

	core.registerAction('onclick', 'myskilltree', function (x, y, px, py) {
		if (core.status.event.id !== 'myskilltree') return false;

		//console.log(boxX + ',' + boxY + ',' + px + ',' + py);
		if (px < 45 || px > 352 - 45 || py < 50 || py > 352 - 50) {
			core.quit_myskilltree();
		} else {
			var boxX = Math.floor((px - 50) / 44), //点击盒子坐标
				boxY = Math.floor((py - 170) / 50);
			if (px < boxX * 44 + 50 || px > boxX * 44 + 50 + 36 || py < boxY * 50 + 170 || py > boxY * 50 + 170 + 36) return false;
			if (boxX < 0 || boxX > 5 || boxY < 0 || boxY > 2) return false;
			var i = boxX + boxY * 6;
			if (i >= 0 && i <= 18) {
				{
					for (var j in flags.heroskill) {
						if (flags.heroskill[j].x == boxX * 44 + 50 && flags.heroskill[j].y == boxY * 50 + 170) {
							if (j == flags.theSkillUI)
								core.enter_myskilltree();
							else if (j != flags.theSkillUI) {
								flags.theSkillUI = Number(j);
								core.myskilltree_draw(); ///重绘页面
							}
							//console.log(boxX + ',' + boxY + ',' + px + ',' + py);
						}
					}

				}

			}


		}
		return true;

	}, 100);

},
    "技能": function () {
	// 在此增加新插件

	//封印
	core.myFiveRedKing = function () {
		if (!flags.redKing2) return;
		if (core.status.floorId == 'MT50') {
			var E1 = false,
				E2 = false,
				E3 = false,
				E4 = false;
			for (var i in flags.Allstatus) {
				var x = flags.Allstatus[i].x,
					y = flags.Allstatus[i].y,
					f = flags.Allstatus[i].f;
				if (x == 5 && y == 4 && f == 'MT50')
					E1 = true;
				if (x == 7 && y == 4 && f == 'MT50')
					E2 = true;
				if (x == 5 && y == 6 && f == 'MT50')
					E3 = true;
				if (x == 7 && y == 6 && f == 'MT50')
					E4 = true;
			}
			var x = hero.loc.x,
				y = hero.loc.y,
				f = core.status.floorId;
			if (x == 5 && y == 4 && f == 'MT50')
				E1 = true;
			if (x == 7 && y == 4 && f == 'MT50')
				E2 = true;
			if (x == 5 && y == 6 && f == 'MT50')
				E3 = true;
			if (x == 7 && y == 6 && f == 'MT50')
				E4 = true;
			if (E1 && E2 && E3 && E4 && !flags.point5) {
				//console.log(111)
				if (flags.harddddd) {
					core.material.enemys.redKing.hp = 8000;
					core.material.enemys.redKing.atk = 5000;
					core.material.enemys.redKing.def = 1000;
				} else {
					core.material.enemys.redKing.hp = 800;
					core.material.enemys.redKing.atk = 500;
					core.material.enemys.redKing.def = 100;
				}
				core.updateStatusBar();
				flags.point5 = true;
				if (!core.isReplaying())
					core.insertCommonEvent('封印');

			} else if ((!E1 || !E2 || !E3 || !E4) && flags.point5) {
				//console.log(222)
				if (flags.harddddd) {
					core.material.enemys.redKing.hp = 80000;
					core.material.enemys.redKing.atk = 50000;
					core.material.enemys.redKing.def = 10000;
				} else {
					core.material.enemys.redKing.hp = 8000;
					core.material.enemys.redKing.atk = 5000;
					core.material.enemys.redKing.def = 1000;
				}
				core.updateStatusBar();
				flags.point5 = false;
				if (!core.isReplaying())
					core.insertCommonEvent('封印');
			}

		}
	}

	events.prototype._changeFloor_getInfo = function (floorId, stair, heroLoc, time) {
		//console.log(111)
		floorId = floorId || core.status.floorId;
		if (floorId == ':before') {
			var index = core.floorIds.indexOf(core.status.floorId);
			if (index > 0) {
				if (core.floorIds[core.floorIds.indexOf(core.status.floorId) - 1] !== 'MT44')
					floorId = core.floorIds[index - 1];
				else
					floorId = core.floorIds[index - 2];
			} else floorId = core.status.floorId;
		} else if (floorId == ':next') {
			var index = core.floorIds.indexOf(core.status.floorId);
			if (index < core.floorIds.length - 1) {
				if (core.floorIds[core.floorIds.indexOf(core.status.floorId) + 1] !== 'MT44')
					floorId = core.floorIds[index + 1];
				else
					floorId = core.floorIds[index + 2];
			} else floorId = core.status.floorId;
		} else if (floorId == ':now') {
			floorId = core.status.floorId;
		}
		if (!core.status.maps[floorId]) {
			main.log("不存在的楼层：" + floorId);
			return null;
		}

		if (main.mode != 'play' || core.isReplaying()) time = 0;
		if (time == null) time = core.values.floorChangeTime;
		time /= 20;

		return {
			floorId: floorId,
			time: time,
			heroLoc: core.clone(this._changeFloor_getHeroLoc(floorId, stair, heroLoc))
		};
	}
	var _changeFloor_getInfo = core.events._changeFloor_getInfo;
	core.events._changeFloor_getInfo = function (floorId, stair, heroLoc, time) {
		var info = _changeFloor_getInfo.call(this, floorId, stair, heroLoc, time);
		if (info == null) return null;
		info.time = 0;
		info.origin = floorId;
		return info;
	}
	items.prototype.getItemEffect = function (itemId, itemNum) {
		var itemCls = core.material.items[itemId].cls;
		// 消耗品
		if (itemCls === 'items' || (flags.theHero === 'woman' && !core.inArray(['book', 'fly', 'wand'], itemId))) {
			var curr_hp = core.status.hero.hp;
			var itemEffect = core.material.items[itemId].itemEffect;
			if (itemEffect) {
				try {
					for (var i = 0; i < itemNum; ++i)
						eval(itemEffect);
				} catch (e) {
					main.log(e);
				}
			}
			core.status.hero.statistics.hp += core.status.hero.hp - curr_hp;

			var useItemEvent = core.material.items[itemId].useItemEvent;
			if (useItemEvent) {
				try {
					core.insertAction(useItemEvent);
				} catch (e) {
					main.log(e);
				}
			}
			core.updateStatusBar();
		} else {
			core.addItem(itemId, itemNum);
		}
	}

	////// 获得某个物品 //////
	events.prototype.getItem = function (id, num, x, y, isGentleClick, callback) {
		var notsell = ['book', 'fly', 'wand', 'SuperBall', 'SuperBall2', 'level1', 'level2', 'level3', 'level4', 'level5', 'level6']
		var Shield = ['shield1', 'shield2', 'shield3', 'shield4', 'shield5'];
		if (flags.theHero === 'thief' && core.inArray(Shield, id) && core.inArray(flags.skill1, "双刀流"))
			return;
		var double = 1;
		var Equips = ['sword1', 'sword2', 'sword3', 'sword4', 'sword5', 'shield1', 'shield2', 'shield3', 'shield4', 'shield5'];
		var Potions = ['redPotion', 'bluePotion'];
		var Gems = ['redGem', 'blueGem'];
		var Tools = ["cross", "superPotion", "pickaxe", "bomb", "centerFly", "upFly", "downFly", "knife", "snow", "bigKey", "earthquake", "coin"]
		if (core.inArray(Equips, id) && flags.theHero == 'woman' && core.inArray(flags.skill1, "装备の卖价"))
			double = 2;
		if (core.inArray(Potions, id) && flags.theHero == 'woman' && core.inArray(flags.skill1, "血瓶の卖价"))
			double = 2;
		if (core.inArray(Gems, id) && flags.theHero == 'woman' && core.inArray(flags.skill1, "宝石の卖价"))
			double = 2;
		if (id === 'redKey' && flags.theHero == 'woman' && core.inArray(flags.skill1, "钥匙の卖价III"))
			double = 2;
		if (id === 'blueKey' && flags.theHero == 'woman' && core.inArray(flags.skill1, "钥匙の卖价II"))
			double = 2;
		if (id === 'yellowKey' && flags.theHero == 'woman' && core.inArray(flags.skill1, "钥匙の卖价I"))
			double = 2;
		if (core.inArray(Tools, id) && flags.theHero == 'woman' && core.inArray(flags.skill1, "秘宝の卖价"))
			double = 2;
		if (core.inArray(Gems, id) || core.inArray(Potions, id))
			double *= core.status.thisMap.ratio;
		if (core.inArray(Equips, id))
			double *= 2.5;
		var Sellmoney = 0;
		if (core.inArray(Tools, id) && id !== 'coin')
			Sellmoney = 1000;
		else if (id === 'coin')
			Sellmoney = 10000;
		else
			Sellmoney = Number(core.material.items[id].canUseItemEffect);

		if (num == null) num = 1;
		var itemCls = core.material.items[id].cls;
		core.removeBlock(x, y);
		core.items.getItemEffect(id, num);

		var Swords = ['sword1', 'sword2', 'sword3', 'sword4', 'sword5'];
		if (flags.theHero !== 'woman' && core.inArray(Swords, id)) {
			core.setBlock(flags.nowWeapon, hero.loc.x, hero.loc.y)
			flags.nowWeapon = id;
			if (flags.theHero === 'thief' && core.inArray(flags.skill1, "双刀流"))
				flags.nowShield = id;
			core.updateStatusBar();
		}

		if (flags.theHero !== 'woman' && core.inArray(Shield, id)) {
			core.setBlock(flags.nowShield, hero.loc.x, hero.loc.y)
			flags.nowShield = id;
			core.updateStatusBar();
		}

		var text = '获得 ' + core.material.items[id].name;
		if (num > 1) text += "x" + num;
		if (itemCls === 'items' && num == 1) text += core.items.getItemEffectTip(id);

		if (flags.theHero !== 'woman' || core.inArray(notsell, id))
			core.drawTip(text, id);
		else if (core.inArray(flags.skill1, "贪婪I") && (core.inArray(Gems, id) || core.inArray(Potions, id)))
			core.drawTip("卖出" + core.material.items[id].name + ',获得' + Sellmoney * double + '金币' + core.items.getItemEffectTip(id), id);
		else if (core.inArray(flags.skill1, "贪婪II") && core.inArray(Equips, id))
			core.drawTip("卖出" + core.material.items[id].name + ',获得' + Sellmoney * double + '金币' + core.items.getItemEffectTip(id), id);
		else
			core.drawTip("卖出" + core.material.items[id].name + ',获得' + Sellmoney * double + '金币', id);
		if (Sellmoney > 0)
			flags.mmm += Sellmoney * double;

		// --- 首次获得道具的提示
		if (!core.hasFlag("__itemHint__")) core.setFlag("__itemHint__", []);
		var itemHint = core.getFlag("__itemHint__");
		if (core.flags.itemFirstText && itemHint.indexOf(id) < 0 && itemCls != 'items') {
			var hint = core.material.items[id].text || "该道具暂无描述";
			try {
				hint = core.replaceText(hint);
			} catch (e) {}
			if (!core.status.event.id || core.status.event.id == 'action') {
				core.insertAction("\t[" + core.material.items[id].name + "," + id + "]" + hint + "\n" +
					(id.endsWith('Key') ? "（钥匙类道具，遇到对应的门时自动打开）" :
						itemCls == 'tools' ? "（消耗类道具，请按T在道具栏使用）" :
						itemCls == 'constants' ? "（永久类道具，请按T在道具栏使用）" :
						itemCls == 'equips' ? "（装备类道具，请按Q在装备栏进行装备）" : ""));
			}
			itemHint.push(id);
		}

		this.afterGetItem(id, x, y, isGentleClick);
		if (callback) callback();
	}

	//盗贼开门
	events.prototype._openDoor_check = function (block, x, y, needKey) {
		var clearAndReturn = function () {
			core.clearContinueAutomaticRoute();
			return false;
		}

		if (block == null || block.event == null) return clearAndReturn();
		var id = block.event.id;

		// 是否存在门或暗墙
		if (core.material.icons.animates[id] == null && core.material.icons.npc48[id] == null) {
			return clearAndReturn();
		}

		if (id == 'steelDoor' && core.flags.steelDoorWithoutKey)
			needKey = false;
		var thief = 0;
		if (core.inArray(flags.skill1, "撬锁精通I") && id == "yellowDoor") {
			if (flags.theHero == 'thief')
				thief = 1;
			else if (flags.Allstatus[1].unlock == true && flags.Allstatus[1].hp > 0) {
				thief = 2;
			}
		}

		if (core.inArray(flags.skill1, "撬锁精通II") && id == "blueDoor") {
			if (flags.theHero == 'thief')
				thief = 1;
			else if (flags.Allstatus[1].unlock == true && flags.Allstatus[1].hp > 0) {
				thief = 2;
			}
		}
		if (core.inArray(flags.skill1, "撬锁精通III") && id == "redDoor") {
			if (flags.theHero == 'thief')
				thief = 1;
			else if (flags.Allstatus[1].unlock == true && flags.Allstatus[1].hp > 0) {
				thief = 2;
			}
		}

		var doorInfo = block.event.doorInfo;
		if (doorInfo == null) return clearAndReturn();
		// Check all keys
		var keyInfo = doorInfo.keys || {};
		if (needKey && !thief) {
			for (var keyName in keyInfo) {
				var keyValue = keyInfo[keyName];
				if (keyName.endsWith(':o')) keyName = keyName.substring(0, keyName.length - 2);

				//console.log(keyName)

				// --- 如果是一个不存在的道具，则直接认为无法开启
				if (!core.material.items[keyName]) {
					core.stopSound();
					core.playSound('操作失败');
					core.drawTip("无法开启此门");
					return clearAndReturn();
				}
				if (core.itemCount(keyName) < keyValue) {
					core.stopSound();
					core.playSound('操作失败');
					if (id == "whiteWall" || id == "blueWall")
						core.drawTip("需要盗贼技能开墙", null, true);
					else
						core.drawTip("你的" + ((core.material.items[keyName] || {}).name || "钥匙") + "不足！", null, true);
					return false;
				}
			}
			if (!core.status.event.id) core.autosave(true);
			for (var keyName in keyInfo) {
				if (!keyName.endsWith(':o')) core.removeItem(keyName, keyInfo[keyName]);
			}
		}
		if (thief) {
			if (!core.status.event.id) core.autosave(true);
			if (thief > 1) {
				flags.Allstatus[1].x = core.nextX()
				flags.Allstatus[1].y = core.nextY()
				flags.Allstatus[1].f = core.status.floorId;
			}
		}
		core.playSound(doorInfo.openSound);
		return true;
	}

	//妖精穿墙////// 某个点是否不可通行 //////
	maps.prototype.noPass = function (x, y, floorId) {
		var block = core.getBlock(x, y, floorId);
		if (block == null) return false;
		if (flags.theHero == 'fairy' && core.inArray(flags.skill1, "幻影の羽") && core.inArray(['yellowWall', 'whiteWall', 'blueWall', 'star'], block.event.id))
			return false;
		if (block && block.event.cls == 'enemys' && core.enemys.canBattle(core.getBlockId(x, y), x, y))
			return false;
		if (core.status.thisMap) {
			if (block && (block.event.id === 'whiteWall' || block.event.id === 'blueWall')) {
				var cando = 0;
				if (core.inArray(flags.skill1, "窃贼诡道I") && core.status.thisMap.ratio <= 1) {
					if (flags.theHero == 'thief')
						cando = 1;
					else if (flags.Allstatus[1].unlock == true && flags.Allstatus[1].hp > 0)
						cando = 2;
				} else if (core.inArray(flags.skill1, "窃贼诡道II") && core.status.thisMap.ratio <= 3) {
					if (flags.theHero == 'thief')
						cando = 1;
					else if (flags.Allstatus[1].unlock == true && flags.Allstatus[1].hp > 0)
						cando = 2;
				} else if (core.inArray(flags.skill1, "窃贼诡道III") && core.status.thisMap.ratio <= 5) {
					if (flags.theHero == 'thief')
						cando = 1;
					else if (flags.Allstatus[1].unlock == true && flags.Allstatus[1].hp > 0)
						cando = 2;
				}
				if (cando)
					return false;
				else
					return true;
			}
		}
		return block.event.noPass;
	}

	////// 战斗 //////
	events.prototype.battle = function (id, x, y, force, callback) {
		core.saveAndStopAutomaticRoute();
		id = id || core.getBlockId(x, y);
		if (!id) return core.clearContinueAutomaticRoute(callback);
		// 非强制战斗
		if (!core.enemys.canBattle(id, x, y) && !force && !core.status.event.id) {
			core.stopSound();
			core.playSound('操作失败');
			core.drawTip("你打不过此怪物！", id);
			return core.clearContinueAutomaticRoute(callback);
		}
		// 自动存档
		//if (!core.status.event.id) core.autosave(true);
		// 战前事件
		if (!this.beforeBattle(id, x, y))
			return core.clearContinueAutomaticRoute(callback);
		// 战后事件
		this.afterBattle(id, x, y);
		if (callback) callback();
	}

	events.prototype._sys_battle = function (data, callback) {
		// 检查是否需要改变朝向
		/* if (data.x == core.nextX() && data.y == core.nextY()) {
		    var dir = core.turnDirection(":back");
		    var id = data.event.id, toId = (data.event.faceIds || {})[dir];
		    if (toId && id != toId) {
		        var number = core.getNumberById(toId);
		        if (number > 0)
		            core.setBlock(number, data.x, data.y);
		    }
		} */

		// 检查战前事件
		var beforeBattle = [];
		core.push(beforeBattle, core.floors[core.status.floorId].beforeBattle[data.x + "," + data.y]);
		core.push(beforeBattle, (core.material.enemys[data.event.id] || {}).beforeBattle);
		if (beforeBattle.length > 0) {
			core.push(beforeBattle, [{ "type": "battle", "x": data.x, "y": data.y }]);
			core.clearContinueAutomaticRoute();

			// 自动存档
			var inAction = core.status.event.id == 'action';
			if (inAction) {
				core.insertAction(beforeBattle, data.x, data.y);
				core.doAction();
			} else {
				core.autosave(true);
				core.insertAction(beforeBattle, data.x, data.y, callback);
			}
		} else {
			this.battle(data.event.id, data.x, data.y, false, callback);
		}
	}

	control.prototype.moveHero = function (direction, callback) {
		// 如果正在移动，直接return
		if (core.status.heroMoving != 0) return;
		if (core.isset(direction))
			core.setHeroLoc('direction', direction);

		if (callback) return this.moveAction(callback);
		this._moveHero_moving();
	}

	////// 实际每一步的行走过程 //////
	control.prototype.moveAction = function (callback) {
		if (core.status.heroMoving > 0) return;
		var noPass = core.noPass(core.nextX(), core.nextY()),
			canMove = core.canMoveHero();
		//console.log("x:" + core.nextX() + ",y:" + core.nextY())
		if (core.getBlockCls(core.nextX(), core.nextY()) == 'enemys' && core.enemys.canBattle(core.getBlockId(core.nextX(), core.nextY()), core.nextX(), core.nextY()) && !core.status.event.id) {
			//console.log(11)
			core.autosave();
		}
		// 下一个点如果不能走
		if (noPass || !canMove) return this._moveAction_noPass(canMove, callback);
		this._moveAction_moving(callback);
	}

	maps.prototype._automaticRoute_deepAdd = function (x, y, blocks) {
		// 判定每个可通行点的损耗值，越高越应该绕路
		var deepAdd = 1;
		var block = blocks[x + "," + y];
		if (block && !block.disable) {
			var id = block.event.id;
			// 绕过亮灯
			if (id == "light") deepAdd += 100;
			// 绕过路障
			if (id.endsWith("Net") && !core.hasFlag(id.substring(0, id.length - 3))) deepAdd += 100;
			// 绕过血瓶和绿宝石
			if (core.hasFlag('__potionNoRouting__') && (id.endsWith("Potion") || id == 'greenGem')) deepAdd += 100;
			//绕怪
			if (block.event.cls == 'enemys')
				deepAdd += 100;
			// 绕过传送点
			if (block.event.trigger == 'changeFloor') deepAdd += 10;
		}
		// 绕过存在伤害的地方
		deepAdd += (core.status.checkBlock.damage[x + "," + y] || 0) * 100;
		// 绕过捕捉
		if (core.status.checkBlock.ambush[x + "," + y]) deepAdd += 1000;
		return deepAdd;
	}

	ui.prototype._getTitleAndIcon = function (content) {
		var title = null,
			image = null,
			icon = null,
			height = 32,
			animate = 1;
		var bigImage = null,
			face = null;
		content = content.replace(/(\t|\\t)\[(([^\],]+),)?([^\],]+)\]/g, function (s0, s1, s2, s3, s4) {
			if (s4) {
				var iconskill = ['神剑战士', '怪盗杰克', '炼金术士', '传奇法师', '最终兵器', '湖中仙女']
				var heroid = ['child', 'thief', 'woman', 'man', 'princess', 'fairy']
				if (core.inArray(heroid, s4)) {
					for (var t in heroid) {
						if (s4 === heroid[t] && core.inArray(flags.skill1, iconskill[t]))
							s4 += 2;
					}
				}
				if (s4 == 'hero') {
					title = core.status.hero.name;
					image = core.material.images.hero;
					icon = 0;
					var w = core.material.icons.hero.width || 32;
					height = 32 * core.material.icons.hero.height / w;
				} else if (s4.endsWith(".png")) {
					s4 = core.getMappedName(s4);
					image = core.material.images.images[s4];
				} else {
					var blockInfo = core.getBlockInfo(s4);
					if (blockInfo != null) {
						if (blockInfo.name) title = blockInfo.name;
						bigImage = blockInfo.bigImage;
						face = blockInfo.face;
						image = blockInfo.image;
						icon = blockInfo.posY;
						height = bigImage == null ? blockInfo.height : 32;
						animate = blockInfo.animate;
					} else title = s4;
				}
			}
			if (s3 != null) {
				title = s3;
				if (title == 'null') title = null;
			}
			return "";
		});
		return {
			content: content,
			title: title,
			image: image,
			icon: icon,
			height: height,
			animate: animate,
			bigImage: bigImage,
			face: face,
		};
	}

	events.prototype._changeFloor_playSound = function () {
		// 播放换层音效
		if (core.hasFlag('__fromLoad__')) // 是否是读档造成的切换
			core.playSound('读档');
		else if (core.hasFlag('__isFlying__')) // 是否是楼传造成的切换
			core.playSound('飞行器');
		else if (!flags.nosound)
			core.playSound('上下楼');
	}
},
    "允许瞬移楼梯": function () {
	// 在此增加新插件


	core.canMoveFloor = function () {
		var canmove = false;
		var up = false;
		var down = false;
		for (var index in core.status.thisMap.blocks) {
			var block = core.status.thisMap.blocks[index];
			if (!block.disable && block.event.id == 'upFloor') {
				up = true;
			}
			if (!block.disable && block.event.id == 'downFloor') {
				down = true;
			}
		}
		if (core.status.thisMap.upFloor != null && up) {
			if (core.canMoveDirectly(core.status.thisMap.upFloor[0], core.status.thisMap.upFloor[1]) >= 0)
				canmove = true;
		}
		if (core.status.thisMap.downFloor != null && down) {
			if (core.canMoveDirectly(core.status.thisMap.downFloor[0], core.status.thisMap.downFloor[1]) >= 0)
				canmove = true;
		}
		return canmove
	}

	////// 点击楼层传送器时的打开操作 //////
	events.prototype.useFly = function (fromUserAction) {
		if (core.isReplaying()) return;
		if (!core.status.maps[core.status.floorId].canFlyFrom) {
			core.drawTip(core.material.items['fly'].name + "好像失效了", 'fly');
			return;
		}
		// 从“浏览地图”页面：尝试直接传送到该层
		if (core.status.event.id == 'viewMaps') {
			if (!core.hasItem('fly')) {
				core.playSound('操作失败');
				core.drawTip('你没有' + core.material.items['fly'].name, 'fly');
			} else if (flags.cannotFly) {
				core.playSound('操作失败');
				core.drawTip('无法传送到当前层', 'fly');
			} else {
				core.flyTo(core.status.event.data.floorId);
			}
			return;
		}

		if (!this._checkStatus('fly', fromUserAction, true)) return;
		//if (core.flags.flyNearStair && !core.nearStair()) 
		if (!core.canMoveFloor()) {
			core.playSound('操作失败');
			core.drawTip("允许瞬移到楼梯边才能使用" + core.material.items['fly'].name, 'fly');
			core.unlockControl();
			core.status.event.data = null;
			core.status.event.id = null;
			return;
		}
		if (flags.cannotFly) {
			core.playSound('操作失败');
			core.drawTip(core.material.items['fly'].name + "好像失效了", 'fly');
			core.unlockControl();
			core.status.event.data = null;
			core.status.event.id = null;
			return;
		}
		core.playSound('打开界面');
		core.useItem('fly', true);
		return;
	}

	////// 点击快捷商店按钮时的打开操作 //////
	events.prototype.openQuickShop = function (fromUserAction) {
		if (!flags.ratio) {
			core.playSound('操作失败');
			core.drawTip("没有访问过商店！");
			return;
		}
		if (core.canMoveFloor())
			core.insertCommonEvent('商店')
		else core.drawTip("允许瞬移到楼梯边才能使用快捷商店");
		/*if (core.isReplaying()) return;

		if (Object.keys(core.status.shops).length == 0) {
			core.playSound('操作失败');
			core.drawTip("本游戏没有快捷商店！");
			return;
		}

		// --- 如果只有一个商店，则直接打开之
		if (Object.keys(core.status.shops).length == 1) {
			var shopId = Object.keys(core.status.shops)[0];
			if (core.status.event.id != null) return;
			if (!core.canOpenShop(shopId)) {
				core.playSound('操作失败');
				core.drawTip("当前无法打开快捷商店！");
				return;
			}
			var message = core.canUseQuickShop(shopId);
			if (message != null) {
				core.playSound('操作失败');
				core.drawTip(message);
				return;
			}
			core.openShop(shopId, false);
			return;
		}

		if (!this._checkStatus('selectShop', fromUserAction)) return;
		core.ui._drawQuickShop();*/
	}

},
    "隐身": function () {
	var Oct = ['E340', 'E341', 'E342', 'E343', 'E344', 'E345', 'E346', 'E347', 'E354', 'E355', 'E356', 'E357', 'E358', 'E359', 'E360', 'E361'];
	var stealth = ['whiteKing2', 'swordsman2', 'zombieKnight2', 'skeletonSoilder2'];
	// 在此增加新插件
	control.prototype._updateDamage_damage = function (floorId, onMap) {
		core.status.damage.data = [];
		if (!core.flags.displayEnemyDamage && !core.flags.displayExtraDamage) return;

		core.extractBlocks(floorId);
		core.status.maps[floorId].blocks.forEach(function (block) {
			var x = block.x,
				y = block.y;

			// v2优化，只绘制范围内的部分
			if (onMap && core.bigmap.v2) {
				if (x < core.bigmap.posX - core.bigmap.extend || x > core.bigmap.posX + core.__SIZE__ + core.bigmap.extend ||
					y < core.bigmap.posY - core.bigmap.extend || y > core.bigmap.posY + core.__SIZE__ + core.bigmap.extend) {
					return;
				}
			}

			if (!block.disable && block.event.cls.indexOf('enemy') == 0 && block.event.displayDamage !== false && !core.inArray(stealth, block.event.id) && !core.inArray(Oct, block.event.id)) {
				if (core.flags.displayEnemyDamage) {
					var damageString = core.enemys.getDamageString(block.event.id, x, y, floorId);
					core.status.damage.data.push({ text: damageString.damage, px: 32 * x + 1, py: 32 * (y + 1) - 1, color: damageString.color });
				}
				if (core.flags.displayCritical) {
					var critical = core.enemys.nextCriticals(block.event.id, 1, x, y, floorId);
					critical = core.formatBigNumber((critical[0] || [])[0], true);
					if (critical == '???') critical = '?';
					if (critical > 0 && critical <= 9)
						core.status.damage.data.push({ text: critical, px: 32 * x + 1, py: 32 * (y + 1) - 11, color: '#ff6060' });
					else if (critical > 0 && critical <= 99)
						core.status.damage.data.push({ text: critical, px: 32 * x + 1, py: 32 * (y + 1) - 11, color: '#f2ff60' });
				}
			}
		});
	}

	enemys.prototype._getCurrentEnemys_addEnemy = function (enemyId, enemys, used, x, y, floorId) {
		var enemy = this._getCurrentEnemys_getEnemy(enemyId);
		if (enemy == null) return;
		if (core.inArray(Oct, enemy.id)) return null;
		var id = enemy.id;

		var enemyInfo = this.getEnemyInfo(enemy, null, null, null, floorId);
		var locEnemyInfo = this.getEnemyInfo(enemy, null, x, y, floorId);

		if (!core.flags.enableEnemyPoint ||
			(locEnemyInfo.atk == enemyInfo.atk && locEnemyInfo.def == enemyInfo.def && locEnemyInfo.hp == enemyInfo.hp)) {
			x = null;
			y = null;
		} else {
			// 检查enemys里面是否使用了存在的内容
			for (var i = 0; i < enemys.length; ++i) {
				var one = enemys[i];
				if (id == one.id && one.locs != null &&
					locEnemyInfo.atk == one.atk && locEnemyInfo.def == one.def && locEnemyInfo.hp == one.hp) {
					one.locs.push([x, y]);
					return;
				}
			}
			enemyInfo = locEnemyInfo;
		}
		var id = enemy.id + ":" + x + ":" + y;
		if (used[id]) return;
		used[id] = true;

		var specialText = core.enemys.getSpecialText(enemy);
		var specialColor = core.enemys.getSpecialColor(enemy);

		var critical = this.nextCriticals(enemy, 1, x, y, floorId);
		if (critical.length > 0) critical = critical[0];

		var e = core.clone(enemy);
		for (var v in enemyInfo) {
			e[v] = enemyInfo[v];
		}
		if (x != null && y != null) {
			e.locs = [
				[x, y]
			];
		}
		e.name = core.getEnemyValue(enemy, 'name', x, y, floorId);
		e.specialText = specialText;
		e.specialColor = specialColor;
		e.damage = this.getDamage(enemy, x, y, floorId);
		e.critical = critical[0];
		e.criticalDamage = critical[1];
		e.defDamage = this._getCurrentEnemys_addEnemy_defDamage(enemy, x, y, floorId);
		enemys.push(e);
	}

	enemys.prototype.getDamageString = function (enemy, x, y, floorId) {
		if (typeof enemy == 'string') enemy = core.material.enemys[enemy];
		var damage = this.getDamage(enemy, x, y, floorId);

		var color = '#000000';

		if (damage == null) {
			damage = "✘";
			color = '#FF2222';
		} else {
			if (damage <= 0) color = '#aaffaa';
			else if (damage < core.status.hero.hp / 3) color = '#FFFFFF';
			else if (damage < core.status.hero.hp * 2 / 3) color = '#FFFF00';
			else if (damage < core.status.hero.hp) color = '#FF9933';
			else color = '#FF2222';

			damage = core.formatBigNumber(damage, true);
			if (core.enemys.hasSpecial(enemy, 19))
				damage += "+";
			if (core.enemys.hasSpecial(enemy, 21))
				damage += "-";
			if (core.enemys.hasSpecial(enemy, 11) && !core.inArray(flags.skill1, "法术破坏"))
				damage += "^";
		}
		if (damage == 0) {
			damage = '✔';
		}
		if (flags.my_grayscaleAllcanvas)
			color = '#FFFFFF'
		return {
			"damage": damage,
			"color": color
		};
	}
	ui.prototype._drawBook_drawDamage = function (index, enemy, offset, position) {
		core.setTextAlign('ui', 'center');
		var damage = enemy.damage,
			color = '#FFFF00';
		if (damage == null) {
			damage = '无法战斗';
			color = '#FF2222';
		} else {
			if (damage >= core.status.hero.hp) color = '#FF2222';
			else if (damage >= core.status.hero.hp * 2 / 3) color = '#FF9933';
			else if (damage <= 0) color = '#11FF11';
			damage = core.formatBigNumber(damage);
			if (core.enemys.hasSpecial(enemy, 19)) damage += "+";
			if (core.enemys.hasSpecial(enemy, 21)) damage += "-";
			if (core.enemys.hasSpecial(enemy, 11) && !core.inArray(flags.skill1, "法术破坏")) damage += "^";
		}
		if (enemy.notBomb) damage += "[b]";
		core.fillText('ui', damage, offset, position, color, this._buildFont(13, true));
	}

	/*control.prototype._updateDamage_damage = function (floorId, onMap) {
		core.status.damage.data = [];
		if (!core.flags.displayEnemyDamage && !core.flags.displayExtraDamage) return;

		core.extractBlocks(floorId);
		core.status.maps[floorId].blocks.forEach(function (block) {
			var x = block.x,
				y = block.y;

			// v2优化，只绘制范围内的部分
			if (onMap && core.bigmap.v2) {
				if (x < core.bigmap.posX - core.bigmap.extend || x > core.bigmap.posX + core._WIDTH_ + core.bigmap.extend ||
					y < core.bigmap.posY - core.bigmap.extend || y > core.bigmap.posY + core._HEIGHT_ + core.bigmap.extend) {
					return;
				}
			}

			if (!flags.undamage && block.event.id.indexOf('SDE') != 0) {
				if (!block.disable && block.event.cls.indexOf('enemy') == 0 && block.event.displayDamage !== false) {
					if (core.flags.displayEnemyDamage) {
						var damageString = core.enemys.getDamageString(block.event.id, x, y, floorId);
						core.status.damage.data.push({ text: damageString.damage, px: 32 * x + 1, py: 32 * (y + 1) - 1, color: damageString.color });
					}
					if (core.flags.displayCritical) {
						var critical = core.enemys.nextCriticals(block.event.id, 1, x, y, floorId);
						critical = core.formatBigNumber((critical[0] || [])[0], true);
						if (critical == '???') critical = '?';
						if (critical > 0 && critical <= 9)
							core.status.damage.data.push({ text: critical, px: 32 * x + 1, py: 32 * (y + 1) - 11, color: '#ff6060' });
						else if (critical > 0 && critical <= 20)
							core.status.damage.data.push({ text: critical, px: 32 * x + 1, py: 32 * (y + 1) - 11, color: '#f2ff60' });
					}
				}
			}
		});
	}*/

},
    "卖钥匙": function () {

	var sellKey = [{
		name: '钥匙の卖价I',
		text: '黄钥匙',
		text2: '黄钥匙卖出价格翻倍',
		id: 'yellowKey',
		key: 'yellowKey',
		count: null,
		x: 50,
		y: 170,
	}, {
		name: '出售1把黄钥匙',
		text: '黄钥匙',
		id: '1',
		key: 'yellowKey',
		count: 1,
		x: 94,
		y: 170,
	}, {
		name: '出售5把黄钥匙',
		text: '黄钥匙',
		text2: '黄钥匙不足5把则出售全部',
		id: '5',
		key: 'yellowKey',
		count: 5,
		x: 138,
		y: 170,
	}, {
		name: '出售10把黄钥匙',
		text: '黄钥匙',
		id: '10',
		text2: '黄钥匙不足10把则出售全部',
		key: 'yellowKey',
		count: 10,
		x: 182,
		y: 170,
	}, {
		name: '出售全部黄钥匙',
		text: '黄钥匙',
		id: '全部',
		key: 'yellowKey',
		count: 999,
		x: 226,
		y: 170,
	}, {
		name: '一键卖出',
		text: '三色钥匙',
		text2: '出售全部的三色钥匙',
		id: '一键卖出',
		key: 'yellowKey',
		count: null,
		x: 270,
		y: 170,
	}, {
		name: '钥匙の卖价II',
		id: 'blueKey',
		text: '蓝钥匙',
		text2: '蓝钥匙卖出价格翻倍',
		key: 'blueKey',
		count: null,
		x: 50,
		y: 220,
	}, {
		name: '出售1把蓝钥匙',
		text: '蓝钥匙',
		key: 'blueKey',
		count: 1,
		id: '1',
		x: 94,
		y: 220,
	}, {
		name: '出售5把蓝钥匙',
		text: '蓝钥匙',
		text2: '蓝钥匙不足5把则出售全部',
		key: 'blueKey',
		count: 5,
		id: '5',
		x: 138,
		y: 220,
	}, {
		name: '出售10把蓝钥匙',
		text: '蓝钥匙',
		text2: '蓝钥匙不足10把则出售全部',
		key: 'blueKey',
		count: 10,
		id: '10',
		x: 182,
		y: 220,
	}, {
		name: '出售全部蓝钥匙',
		text: '蓝钥匙',
		key: 'blueKey',
		count: 999,
		id: '全部',
		x: 226,
		y: 220,
	}, {
		name: '一键卖出',
		text: '三色钥匙',
		text2: '出售全部的三色钥匙',
		id: '一键卖出',
		key: 'yellowKey',
		count: null,
		x: 270,
		y: 220,
	}, {
		name: '钥匙の卖价III',
		id: 'redKey',
		text: '红钥匙',
		text2: '红钥匙卖出价格翻倍',
		key: 'redKey',
		count: null,
		x: 50,
		y: 270,
	}, {
		name: '出售1把红钥匙',
		text: '红钥匙',
		key: 'redKey',
		count: 1,
		id: '1',
		x: 94,
		y: 270,
	}, {
		name: '出售5把红钥匙',
		text: '红钥匙',
		text2: '红钥匙不足5把则出售全部',
		key: 'redKey',
		count: 5,
		id: '5',
		x: 138,
		y: 270,
	}, {
		name: '出售10把红钥匙',
		text: '红钥匙',
		text2: '红钥匙不足10把则出售全部',
		key: 'redKey',
		count: 10,
		id: '10',
		x: 182,
		y: 270,
	}, {
		name: '出售全部红钥匙',
		text: '红钥匙',
		key: 'redKey',
		count: 999,
		id: '全部',
		x: 226,
		y: 270,
	}, {
		name: '一键卖出',
		text: '三色钥匙',
		text2: '出售全部的三色钥匙',
		id: '一键卖出',
		key: 'yellowKey',
		count: null,
		x: 270,
		y: 270,
	}]

	// 在此增加新插件
	core.mySellKey = function () {
		//if (core.isReplaying()) return;
		if (flags.Allstatus[2].unlock != true || flags.Allstatus[2].hp <= 0) {
			core.drawTip('商人角色未解锁或已阵亡')
			return;
		}
		core.status.holdingKeys = []; ///清空按下的键
		core.lockControl();
		flags.theSellUI = flags.theSellUI || 0;
		core.status.event.id = 'mySellKey';
		core.mySellKey_draw(); ///重绘页面
	}

	core.quit_mySellKey = function () {
		core.clearUI();
		core.status.event.id = null;
		core.unlockControl();
		if (core.isReplaying())
			core.replay();
	}

	core.enter_mySellKey = function () {
		var i = flags.theSellUI;

		if (sellKey[i].name != '钥匙の卖价I' && sellKey[i].name != '钥匙の卖价II' && sellKey[i].name != '钥匙の卖价III') {
			var money = 0;
			var count = 0;
			var double = 1;
			if (sellKey[i].text == '黄钥匙') {
				if (core.inArray(flags.skill1, "钥匙の卖价I"))
					double = 2
				money = 50 * Math.min(core.itemCount('yellowKey'), sellKey[i].count) * double;
				count = Math.min(core.itemCount('yellowKey'), sellKey[i].count);
			}
			if (sellKey[i].text == '蓝钥匙') {
				if (core.inArray(flags.skill1, "钥匙の卖价II"))
					double = 2
				money = 100 * Math.min(core.itemCount('blueKey'), sellKey[i].count) * double;
				count = Math.min(core.itemCount('blueKey'), sellKey[i].count);
			}
			if (sellKey[i].text == '红钥匙') {
				if (core.inArray(flags.skill1, "钥匙の卖价III"))
					double = 2
				money = 250 * Math.min(core.itemCount('redKey'), sellKey[i].count) * double;
				count = Math.min(core.itemCount('redKey'), sellKey[i].count);
			}
			if (sellKey[i].text == '三色钥匙') {
				if (core.inArray(flags.skill1, "钥匙の卖价I"))
					double = 2
				money += 50 * core.itemCount('yellowKey') * double;
				count += core.itemCount('yellowKey')
				double = 1
				if (core.inArray(flags.skill1, "钥匙の卖价II"))
					double = 2
				money += 100 * core.itemCount('blueKey') * double;
				count += core.itemCount('blueKey')
				double = 1
				if (core.inArray(flags.skill1, "钥匙の卖价III"))
					double = 2
				money += 250 * core.itemCount('redKey') * double;
				count += core.itemCount('redKey')
			}
			if (count == 0) {
				core.drawTip(sellKey[i].text + '不足');
			} else {
				hero.money += money;
				core.drawTip('卖出' + sellKey[i].text + ',获得' + money + '金币');
				if (sellKey[i].text == '三色钥匙') {
					core.addItem("yellowKey", -1 * core.itemCount('yellowKey'));
					core.addItem("blueKey", -1 * core.itemCount('blueKey'));
					core.addItem("redKey", -1 * core.itemCount('redKey'));
				} else
					core.addItem(sellKey[i].key, -1 * count);

				core.status.route.push('sellKey:' + i)
			}

		}

		core.mySellKey_draw(); ///重绘页面
	}


	core.mySellKey_draw = function () {
		core.clearUI();
		//首先绘制背景
		core.clearMap('ui');
		core.drawWindowSkin('winskin.png', 'ui', 15, 15, 352 - 30, 352 - 30);
		core.setTextAlign('ui', 'center');
		core.fillText('ui', "出售钥匙", 352 / 2, 40, '#E1E1E1', 'bold 22px Verdana');
		core.fillText('ui', "快捷键T", 352 / 2 + 110, 40, '#888888', 'bold 18px Verdana');
		core.fillText('ui', "——点击任意处退出（X）——", 352 / 2, 325, '#E1E1E1', 'bold 14px Verdana');
		core.fillRoundRect('ui', 50, 50, 32, 32, 4, "#444444");
		core.strokeRoundRect('ui', 50 - 2, 50 - 2, 36, 36, 4, "#444444", 1)
		core.drawImage('ui', 'woman' + '.png', 0, 0, 32, 32, 50, 50, 32, 32);
		core.setTextAlign('ui', 'left');
		core.fillText('ui', "Lv." + flags.Allstatus[2].lv, 45, 100, '#E1E1E1', 'bold 16px Verdana');
		core.fillText('ui', '商人', 50, 120, '#E1E1E1', 'bold 16px Verdana');
		core.strokeRoundRect('ui', 40, 160, 352 - 80, 152, 4, "#444444", 1);

		core.drawLine('ui', 50 + 16, 170 + 16 - 4, 270 + 16, 170 + 16 - 4, "#444444", 1);
		core.drawLine('ui', 50 + 16, 170 + 16 + 4, 270 + 16, 170 + 16 + 4, "#444444", 1);
		core.drawLine('ui', 50 + 16, 170 + 16, 270 + 16, 170 + 16, "#444444", 4);
		core.drawLine('ui', 50 + 16, 220 + 16 - 4, 270 + 16, 220 + 16 - 4, "#444444", 1);
		core.drawLine('ui', 50 + 16, 220 + 16 + 4, 270 + 16, 220 + 16 + 4, "#444444", 1);
		core.drawLine('ui', 50 + 16, 220 + 16, 270 + 16, 220 + 16, "#444444", 4);
		core.drawLine('ui', 50 + 16, 270 + 16 - 4, 270 + 16, 270 + 16 - 4, "#444444", 1);
		core.drawLine('ui', 50 + 16, 270 + 16 + 4, 270 + 16, 270 + 16 + 4, "#444444", 1);
		core.drawLine('ui', 50 + 16, 270 + 16, 270 + 16, 270 + 16, "#444444", 4);

		for (var i in sellKey) {
			var x = sellKey[i].x;
			var y = sellKey[i].y;
			if (x != 270) {
				core.fillRoundRect('ui', x, y, 32, 32, 4, "#444444");
				core.strokeRoundRect('ui', x - 2, y - 2, 36, 36, 4, "#444444", 1)
				core.setTextAlign('ui', 'center');
				if (sellKey[i].x == 50) {
					if (core.inArray(flags.skill1, sellKey[i].name)) {
						core.strokeRoundRect('ui', x - 2, y - 2, 36, 36, 4, "#ccccff", 1);
					} else {
						core.setFilter('ui', 'brightness(50%)grayscale(70%)');
						core.setAlpha('ui', 0.7);
					}
					core.drawImage('ui', sellKey[i].id + '.png', 0, 0, 32, 32, x, y, 32, 32);
					core.setFilter('ui', '');
					core.setAlpha('ui', 1);
				} else
					core.fillText('ui', sellKey[i].id, x + 16, y + 20, '#E1E1E1', 'bold 14px Verdana');

				if (flags.theSellUI == i) {

					core.strokeRoundRect('ui', x - 2, y - 2, 36, 36, 4, "#ffff80", 1);
					core.fillPolygon('ui', [
						[x + 2, y + 16],
						[x - 2, y + 16 + 4],
						[x - 2, y + 16 - 4]
					], "#ffff80");
					core.fillPolygon('ui', [
						[x + 32 - 2, y + 16],
						[x + 32 + 2, y + 16 + 4],
						[x + 32 + 2, y + 16 - 4]
					], "#ffff80");
				}
			} else if (y == 170) {
				core.fillRoundRect('ui', x, y, 32, 32 + 100, 4, "#444444");
				core.strokeRoundRect('ui', x - 2, y - 2, 36, 36 + 100, 4, "#444444", 1);
				core.setTextAlign('ui', 'center');
				core.fillText('ui', '一', x + 16, y + 20, '#E1E1E1', 'bold 14px Verdana');
				core.fillText('ui', '键', x + 16, y + 20 + 33, '#E1E1E1', 'bold 14px Verdana');
				core.fillText('ui', '卖', x + 16, y + 20 + 66, '#E1E1E1', 'bold 14px Verdana');
				core.fillText('ui', '出', x + 16, y + 20 + 100, '#E1E1E1', 'bold 14px Verdana');
				if (flags.theSellUI == 5 || flags.theSellUI == 11 || flags.theSellUI == 17) {
					core.strokeRoundRect('ui', x - 2, y - 2, 36, 36 + 100, 4, "#ffff80", 1);
					core.fillPolygon('ui', [
						[x + 2, y + 16 + (flags.theSellUI - 5) / 6 * 50],
						[x - 2, y + 16 + 4 + (flags.theSellUI - 5) / 6 * 50],
						[x - 2, y + 16 - 4 + (flags.theSellUI - 5) / 6 * 50]
					], "#ffff80");
					core.fillPolygon('ui', [
						[x + 32 - 2, y + 16 + (flags.theSellUI - 5) / 6 * 50],
						[x + 32 + 2, y + 16 + 4 + (flags.theSellUI - 5) / 6 * 50],
						[x + 32 + 2, y + 16 - 4 + (flags.theSellUI - 5) / 6 * 50]
					], "#ffff80");
				}
			}


		}
		core.setTextAlign('ui', 'left');
		core.strokeRoundRect('ui', 100, 50 - 2, 352 - 100 - 40, 80, 4, "#444444", 1);
		core.fillRoundRect('ui', 102, 50, 352 - 100 - 40 - 4, 80 - 4, 4, "#444444");
		core.strokeRoundRect('ui', 40, 133 - 2, 352 - 80, 25, 4, "#444444", 1);
		core.fillRoundRect('ui', 42, 133, 352 - 80 - 4, 25 - 4, 4, "#444444");

		var k = flags.theSellUI;

		core.fillText('ui', sellKey[k].name, 106, 50 + 20, '#E1E1E1', 'bold 16px Verdana');

		//core.fillText('ui', sellKey[k].text, 106, 50 + 20 + 20, '#E1E1E1', 'bold 12px Verdana');
		var text = sellKey[k].text2;
		var height = null;
		var max_height = 110;
		if (text) {
			for (var fontSize = 17; fontSize >= 9; fontSize -= 2) {
				var config = { left: 106, top: 50 + 20 + 20 - 12, fontSize: 12, maxWidth: 352 - 100 - 40 - 4, bold: true, color: "#E1E1E1" };
				height = 42 + core.getTextContentHeight(text, config);
				if (height < max_height || fontSize == 9) {
					core.drawTextContent('ui', text, config);
					break;
				}
			}
		}
		core.drawLine('ui', 100, 54 + 20, 312, 56 + 20, '#676767', 1);

		//var keys = ["yellowKey", "blueKey", "redKey"]

		var money = 0;
		var double = 1;
		if (sellKey[k].text == '黄钥匙') {
			if (core.inArray(flags.skill1, "钥匙の卖价I"))
				double = 2
			money = 50 * Math.min(core.itemCount('yellowKey'), sellKey[k].count) * double;
		}
		if (sellKey[k].text == '蓝钥匙') {
			if (core.inArray(flags.skill1, "钥匙の卖价II"))
				double = 2
			money = 100 * Math.min(core.itemCount('blueKey'), sellKey[k].count) * double;
		}
		if (sellKey[k].text == '红钥匙') {
			if (core.inArray(flags.skill1, "钥匙の卖价III"))
				double = 2
			money = 250 * Math.min(core.itemCount('redKey'), sellKey[k].count) * double;
		}
		if (sellKey[k].text == '三色钥匙') {
			if (core.inArray(flags.skill1, "钥匙の卖价I"))
				double = 2
			money += 50 * core.itemCount('yellowKey') * double;
			double = 1
			if (core.inArray(flags.skill1, "钥匙の卖价II"))
				double = 2
			money += 100 * core.itemCount('blueKey') * double;
			double = 1
			if (core.inArray(flags.skill1, "钥匙の卖价III"))
				double = 2
			money += 250 * core.itemCount('redKey') * double;
			core.fillText('ui', '已有' + sellKey[k].text + ':' + (core.itemCount('yellowKey') + core.itemCount('blueKey') + core.itemCount('redKey')) + '把', 44, 150 - 2, '#E1E1E1', 'bold 12px Verdana');
		} else
			core.fillText('ui', '已有' + sellKey[k].text + ':' + core.itemCount(sellKey[k].key) + '把', 44, 150 - 2, '#E1E1E1', 'bold 12px Verdana');

		core.setTextAlign('ui', 'right');
		if (sellKey[k].name != '钥匙の卖价I' && sellKey[k].name != '钥匙の卖价II' && sellKey[k].name != '钥匙の卖价III') {
			core.fillText('ui', '再次点击图标出售(Enter)', 304, 50 + 70, '#E1E1E1', 'bold 12px Verdana');
			core.fillText('ui', '卖出获得金币：' + money, 304, 150 - 2, '#E1E1E1', 'bold 12px Verdana');
		} else {
			if (core.inArray(flags.skill1, sellKey[k].name))
				core.fillText('ui', '已习得', 304, 50 + 20, '#E1E1E1', 'bold 16px Verdana');
			else
				core.fillText('ui', '未习得', 304, 50 + 20, '#888888', 'bold 16px Verdana');
		}
	}


	this.mySellKey_keyDown = function (keycode) {
		if (core.status.event.id !== 'mySellKey') return false;

		var done = false

		if (keycode == 37) {
			if (flags.theSellUI > 0)
				flags.theSellUI -= 1;
		} else if (keycode == 39) {
			if (flags.theSellUI < sellKey.length - 1)
				flags.theSellUI += 1;
		} else if (keycode == 38) {
			for (var j in sellKey) {
				if (sellKey[j].x == sellKey[flags.theSellUI].x && sellKey[j].y == sellKey[flags.theSellUI].y - 50) {
					if (!done) {
						flags.theSellUI = Number(j);
						done = true;
					}
				}

			}
			for (var j in sellKey) {
				if (sellKey[j].x == sellKey[flags.theSellUI].x && sellKey[j].y == sellKey[flags.theSellUI].y - 100) {
					if (!done) {
						flags.theSellUI = Number(j);
						done = true;
					}
				}

			}
			if (!done)
				flags.theSellUI = 0;
		} else if (keycode == 40) {
			for (var j in sellKey) {
				if (sellKey[j].x == sellKey[flags.theSellUI].x && sellKey[j].y == sellKey[flags.theSellUI].y + 50) {
					if (!done) {
						flags.theSellUI = Number(j);
						done = true;
					}
				}

			}
			for (var j in sellKey) {
				if (sellKey[j].x == sellKey[flags.theSellUI].x && sellKey[j].y == sellKey[flags.theSellUI].y + 100) {
					if (!done) {
						flags.theSellUI = Number(j);
						done = true;
					}
				}

			}
			if (!done)
				flags.theSellUI = sellKey.length - 1;
		}

		core.mySellKey_draw(); ///重绘页面

		return true;
	}
	core.registerAction('keyDown', 'mySellKey', 'mySellKey_keyDown', 100);

	var mySellKey = function (keycode) {
		if (core.status.event.id !== 'mySellKey') return false;

		if (keycode == 32 || keycode == 13 || keycode == 67) { //c\space\enter
			core.enter_mySellKey();
		}
		if (keycode == 88 || keycode == 84 || keycode == 27) { ////x、q和Esc退出
			core.quit_mySellKey();
		}
		return true; ///全部拦截
	};
	core.registerAction('keyUp', 'mySellKey', mySellKey, 100);

	this.mySellKey_onmove = function (x, y, px, py) {
		if (core.status.event.id !== 'mySellKey') return false;

		//console.log(px + ',' + py);
		var boxX = Math.floor((px - 50) / 44), //点击盒子坐标
			boxY = Math.floor((py - 170) / 50);
		if (px < boxX * 44 + 50 || px > boxX * 44 + 50 + 36 || py < boxY * 50 + 170 || py > boxY * 50 + 170 + 36) return false;
		if (boxX < 0 || boxX > 5 || boxY < 0 || boxY > 2) return false;
		var i = boxX + boxY * 6;
		if (i >= 0 && i <= 18) {
			{
				for (var j in sellKey) {
					if (sellKey[j].x == boxX * 44 + 50 && sellKey[j].y == boxY * 50 + 170 && j != flags.theSellUI) {
						flags.theSellUI = Number(j);
						core.mySellKey_draw(); ///重绘页面
						//console.log(boxX + ',' + boxY + ',' + px + ',' + py);
					}
				}

			}

		}

		return true;
	}
	core.registerAction('onmove', 'mySellKey', 'mySellKey_onmove', 100);

	core.registerAction('onclick', 'mySellKey', function (x, y, px, py) {
		if (core.status.event.id !== 'mySellKey') return false;

		//console.log(boxX + ',' + boxY + ',' + px + ',' + py);
		if (px < 45 || px > 352 - 45 || py < 50 || py > 352 - 50) {
			core.quit_mySellKey();
		} else {
			var boxX = Math.floor((px - 50) / 44), //点击盒子坐标
				boxY = Math.floor((py - 170) / 50);
			if (px < boxX * 44 + 50 || px > boxX * 44 + 50 + 36 || py < boxY * 50 + 170 || py > boxY * 50 + 170 + 36) return false;
			if (boxX < 0 || boxX > 5 || boxY < 0 || boxY > 2) return false;
			var i = boxX + boxY * 6;
			if (i >= 0 && i <= 18) {
				{
					for (var j in sellKey) {
						if (sellKey[j].x == boxX * 44 + 50 && sellKey[j].y == boxY * 50 + 170) {
							if (j == flags.theSellUI)
								core.enter_mySellKey();
							else if (j != flags.theSellUI) {
								flags.theSellUI = Number(j);
								core.mySellKey_draw(); ///重绘页面
							}
							//console.log(boxX + ',' + boxY + ',' + px + ',' + py);
						}
					}

				}

			}


		}
		return true;

	}, 100);


},
    "楼传": function () {
	// 在此增加新插件
	////// 绘制楼层传送器 //////
	ui.prototype.drawFly = function (page) {
		core.status.event.data = page;
		var floorId = core.floorIds[page];
		var title = core.status.maps[floorId].title;
		core.clearMap('ui');
		core.drawWindowSkin('winskin.png', 'ui', 0, 0, 352, 352);
		//core.setAlpha('ui', 0.85);
		//core.fillRect('ui', 0, 0, this.PIXEL, this.PIXEL, '#000000');
		//core.setAlpha('ui', 1);
		/*core.setTextAlign('ui', 'center');
		core.fillText('ui', '楼层跳跃', this.HPIXEL, 60, '#FFFFFF', this._buildFont(28, true));
		core.fillText('ui', '返回游戏', this.HPIXEL, this.PIXEL - 13, null, this._buildFont(15, true))
		core.setTextAlign('ui', 'right');
		core.fillText('ui', '浏览地图时也', this.PIXEL - 10, this.PIXEL - 23, '#aaaaaa', this._buildFont(10, false));
		core.fillText('ui', '可楼层跳跃！', this.PIXEL - 10, this.PIXEL - 11, null, this._buildFont(10, false));
		core.setTextAlign('ui', 'center');
*/
		/*var middle = this.HPIXEL + 39;

		// 换行
		var lines = core.splitLines('ui', title, 120, this._buildFont(19, true));
		var start_y = middle - (lines.length - 1) * 11;
		for (var i in lines) {
			core.fillText('ui', lines[i], this.PIXEL - 60, start_y, '#FFFFFF');
			start_y += 22;
		}
*/
		// core.fillText('ui', title, this.PIXEL - 60, this.HPIXEL + 39, null, this._buildFont(19, true));
		/*
				if (core.actions._getNextFlyFloor(1) != page) {
					core.fillText('ui', '▲', this.PIXEL - 60, middle - 64, null, this._buildFont(17, false));
					core.fillText('ui', '▲', this.PIXEL - 60, middle - 96);
					core.fillText('ui', '▲', this.PIXEL - 60, middle - 96 - 7);
				}
				if (core.actions._getNextFlyFloor(-1) != page) {
					core.fillText('ui', '▼', this.PIXEL - 60, middle + 64, null, this._buildFont(17, false));
					core.fillText('ui', '▼', this.PIXEL - 60, middle + 96);
					core.fillText('ui', '▼', this.PIXEL - 60, middle + 96 + 7);
				}
				*/
		////这是人写出来的东西？
		core.setTextAlign('ui', 'center');
		var size = this.PIXEL * 3 / 4; //- 143 + 60;
		core.fillRoundRect('ui', 15 + 58 - 2, 288 - 2, size + 4 - 58, 50 + 4, 4, '#444444');
		core.strokeRoundRect('ui', 15 + 58 - 4, 288 - 4, size + 8 - 58, 50 + 8, 4, "#444444", 1)
		for (var x = 0; x < 10; x++)
			for (var y = 0; y < 5; y++) {
				if (!core.inArray([10, 20, 30, 40, 49, 50], x + y * 10 + 1)) {
					//core.drawLine('ui', 58 + x * 21 + 25, 327 - y * 10 + 6 + 3, 58 + x * 21 + 21 + 25, 327 - y * 10 + 6 + 3, '#242424', 1);
					//core.drawLine('ui', 58 + x * 21 + 25, 327 - y * 10 + 6 - 3, 58 + x * 21 + 21 + 25, 327 - y * 10 + 6 - 3, '#242424', 1);
					core.drawLine('ui', 58 + x * 21 + 25, 327 - y * 10 + 6, 58 + x * 21 + 21 + 25, 327 - y * 10 + 6, '#242424', 2);
				}
				if (page - 1 == x + y * 10)
					core.drawImage('ui', 'fly_p.png', 0, 0, 50, 12, 58 + x * 21, 327 - y * 10, 50, 12);
				else if (x + y * 10 + 1 == 50)
					core.drawImage('ui', 'fly_p_r.png', 0, 0, 50, 12, 58 + x * 21, 327 - y * 10, 50, 12);
				else if (!core.status.maps[core.floorIds[x + y * 10 + 1]].canFlyTo || !core.hasVisitedFloor(core.floorIds[x + y * 10 + 1]))
					core.drawImage('ui', 'fly_p_b.png', 0, 0, 50, 12, 58 + x * 21, 327 - y * 10, 50, 12);
				else
					core.drawImage('ui', 'fly_p_w.png', 0, 0, 50, 12, 58 + x * 21, 327 - y * 10, 50, 12);
			}
		core.fillRoundRect('ui', 15 - 2, 15 - 2, size + 4, size + 4, 4, '#444444');
		core.strokeRoundRect('ui', 15 - 4, 15 - 4, size + 8, size + 8, 4, "#444444", 1)
		core.drawThumbnail(floorId, null, { ctx: 'ui', x: 15, y: 15, size: size, damage: true });
		core.setTextAlign('ui', 'right');
		core.fillText('ui', (page) + '层', 288 + 12 + 37, 15 + 58 + 58 + 23, '#FFFFFF', this._buildFont(20, true))
		////这是人写出来的东西？
		//
		core.setTextAlign('ui', 'center');
		core.fillRoundRect('ui', 15 - 2, 288 - 2, 50 + 4, 50 + 4, 4, '#444444');
		core.strokeRoundRect('ui', 15 - 4, 288 - 4, 50 + 8, 50 + 8, 4, "#444444", 1)
		core.fillText('ui', '楼传', 15 + 12 + 10, 288 + 20, '#FFFFFF', this._buildFont(20, true))
		core.fillText('ui', '预览', 15 + 38 - 10, 288 + 46, '#909090', this._buildFont(18, true))
		core.fillRoundRect('ui', 288 - 2, 15 - 2, 50 + 4, 50 + 4, 4, '#444444');
		core.strokeRoundRect('ui', 288 - 4, 15 - 4, 50 + 8, 50 + 8, 4, "#444444", 1)
		core.fillText('ui', '上', 288 + 12, 15 + 20, '#FFFFFF', this._buildFont(20, true))
		core.fillText('ui', '翻', 288 + 38, 15 + 46, '#FFFFFF', this._buildFont(20, true))
		core.fillRoundRect('ui', 288 - 2, 15 + 58 - 2, 50 + 4, 50 + 4, 4, '#444444');
		core.strokeRoundRect('ui', 288 - 4, 15 + 58 - 4, 50 + 8, 50 + 8, 4, "#444444", 1)
		core.fillText('ui', '上', 288 + 12, 15 + 58 + 20, '#FFFFFF', this._buildFont(20, true))
		core.fillText('ui', '楼', 288 + 38, 15 + 58 + 46, '#FFFFFF', this._buildFont(20, true))
		core.fillRoundRect('ui', 288 - 2, 230 - 58 - 2, 50 + 4, 50 + 4, 4, '#444444');
		core.strokeRoundRect('ui', 288 - 4, 230 - 58 - 4, 50 + 8, 50 + 8, 4, "#444444", 1)
		core.fillText('ui', '下', 288 + 12, 230 - 58 + 20, '#FFFFFF', this._buildFont(20, true))
		core.fillText('ui', '楼', 288 + 38, 230 - 58 + 46, '#FFFFFF', this._buildFont(20, true))
		core.fillRoundRect('ui', 288 - 2, 230 - 2, 50 + 4, 50 + 4, 4, '#444444');
		core.strokeRoundRect('ui', 288 - 4, 230 - 4, 50 + 8, 50 + 8, 4, "#444444", 1)
		core.fillText('ui', '下', 288 + 12, 230 + 20, '#FFFFFF', this._buildFont(20, true))
		core.fillText('ui', '翻', 288 + 38, 230 + 46, '#FFFFFF', this._buildFont(20, true))
		core.fillRoundRect('ui', 288 - 2, 288 - 2, 50 + 4, 50 + 4, 4, '#444444');
		core.strokeRoundRect('ui', 288 - 4, 288 - 4, 50 + 8, 50 + 8, 4, "#444444", 1)
		core.fillText('ui', '返', 288 + 12, 288 + 20, '#FFFFFF', this._buildFont(20, true))
		core.fillText('ui', '回', 288 + 38, 288 + 46, '#FFFFFF', this._buildFont(20, true))
		//core.strokeRect('ui', 20, 100, size, size, '#FFFFFF', 4);
		//core.drawThumbnail(floorId, null, { ctx: 'ui', x: 20, y: 100, size: size, damage: true });
	}

	ui.prototype._drawViewMaps_drawHint = function () {
		if (!core.canMoveFloor()) {
			core.drawTip('因为无法瞬移到楼梯口，无法打开预览')
			return
		}
		core.playSound('打开界面');
		core.fillRect('ui', 0, 0, this.PIXEL, this.PIXEL, 'rgba(0,0,0,0.7)');
		core.setTextAlign('ui', 'center');
		var stroke = function (left, top, width, height, fillStyle, lineWidth) {
			core.strokeRect('ui', left + 2, top + 2, width - 4, height - 4, fillStyle, lineWidth);
		}

		var perpx = this.PIXEL / 5,
			cornerpx = perpx * 3 / 4;
		stroke(perpx, 0, 3 * perpx, perpx, core.status.globalAttribute.selectColor, 4); // up
		stroke(0, perpx, perpx, 3 * perpx); // left
		stroke(perpx, 4 * perpx, 3 * perpx, perpx); // down
		stroke(4 * perpx, perpx, perpx, 3 * perpx); // right
		stroke(perpx, perpx, 3 * perpx, perpx); // prev
		stroke(perpx, 3 * perpx, 3 * perpx, perpx); // next
		stroke(0, 0, cornerpx, cornerpx); // left top
		stroke(this.PIXEL - cornerpx, 0, cornerpx, cornerpx); // right top
		stroke(0, this.PIXEL - cornerpx, cornerpx, cornerpx); // left bottom;

		core.setTextBaseline('ui', 'middle');
		core.fillText('ui', "上移地图 [W]", this.HPIXEL, perpx / 2, core.status.globalAttribute.selectColor, '20px Arial');
		core.fillText('ui', "下移地图 [S]", this.HPIXEL, this.PIXEL - perpx / 2);
		core.fillText('ui', 'V', cornerpx / 2, cornerpx / 2);
		core.fillText('ui', 'Z', this.PIXEL - cornerpx / 2, cornerpx / 2);
		core.fillText('ui', 'B', cornerpx / 2, this.PIXEL - cornerpx / 2);

		var top = this.HPIXEL - 66,
			left = perpx / 2,
			right = this.PIXEL - left;
		var lt = ["左", "移", "地", "图", "[A]"],
			rt = ["右", "移", "地", "图", "[D]"];
		for (var i = 0; i < 5; ++i) {
			core.fillText("ui", lt[i], left, top + 32 * i);
			core.fillText("ui", rt[i], right, top + 32 * i);
		}
		core.fillText('ui', "前张地图 [▲ / PGUP]", this.HPIXEL, perpx * 1.5);
		core.fillText('ui', "后张地图 [▼ / PGDN]", this.HPIXEL, this.PIXEL - perpx * 1.5);

		core.fillText('ui', "退出 [ESC / ENTER]", this.HPIXEL, this.HPIXEL);
		core.fillText('ui', "[X] 可查看" + core.material.items['book'].name + "   [G] 可使用" + core.material.items.fly.name, this.HPIXEL, this.HPIXEL + 32, null, '12px Arial');

		core.setTextBaseline('ui', 'alphabetic');
	}

	////// 绘制浏览地图界面 //////
	ui.prototype._drawViewMaps = function (index, x, y) {
		if (!core.canMoveFloor() && index == null) {
			core.drawTip('因为无法瞬移到楼梯口，无法打开预览')
			return
		}
		core.lockControl();
		core.status.event.id = 'viewMaps';
		this.clearUI();
		//console.log(index)
		if (index == null) return this._drawViewMaps_drawHint();
		core.animateFrame.tip = null;
		core.status.checkBlock.cache = {};
		var data = this._drawViewMaps_buildData(index, x, y);
		//core.fillRect('ui', 0, 0, this.PIXEL, this.PIXEL, '#000000');
		//core.drawThumbnail(data.floorId, null, { damage: data.damage, ctx: 'ui', centerX: data.x, centerY: data.y, all: data.all });
		//
		core.drawWindowSkin('winskin.png', 'ui', 0, 0, 352, 352);


		var page = core.status.event.data.index;

		core.setTextAlign('ui', 'center');
		var size = this.PIXEL * 3 / 4; //- 143 + 60;
		core.fillRoundRect('ui', 15 + 58 - 2, 288 - 2, size + 4 - 58, 50 + 4, 4, '#444444');
		core.strokeRoundRect('ui', 15 + 58 - 4, 288 - 4, size + 8 - 58, 50 + 8, 4, "#444444", 1)
		var turn2 = 0;
		//if (flags.turn2)
		//	turn2 = 51;
		//console.log(core.status.maps[core.floorIds[page]].floorId)
		for (var x = 0; x < 10; x++)
			for (var y = 0; y < 5; y++) {
				if (!core.inArray([10, 20, 30, 40, 49, 50], x + y * 10 + 1) && core.status.maps[core.floorIds[x + y * 10 + 1]]?.floorId != 'MT44' && core.status.maps[core.floorIds[x + y * 10 + 2]]?.floorId != 'MT44') {
					core.drawLine('ui', 58 + x * 21 + 25, 327 - y * 10 + 6, 58 + x * 21 + 21 + 25, 327 - y * 10 + 6, '#242424', 2);
				}
				if (page - 1 == x + y * 10 + turn2)
					core.drawImage('ui', 'fly_p.png', 0, 0, 50, 12, 58 + x * 21, 327 - y * 10, 50, 12);
				else if (x + y * 10 + 1 == 50 + turn2)
					core.drawImage('ui', 'fly_p_r.png', 0, 0, 50, 12, 58 + x * 21, 327 - y * 10, 50, 12);
				else if (!core.status.maps[core.floorIds[x + y * 10 + 1]].canFlyTo || !core.hasVisitedFloor(core.floorIds[x + y * 10 + 1]))
					core.drawImage('ui', 'fly_p_b.png', 0, 0, 50, 12, 58 + x * 21, 327 - y * 10, 50, 12);
				else
					core.drawImage('ui', 'fly_p_w.png', 0, 0, 50, 12, 58 + x * 21, 327 - y * 10, 50, 12);
			}
		core.fillRoundRect('ui', 15 - 2, 15 - 2, size + 4, size + 4, 4, '#444444');
		core.strokeRoundRect('ui', 15 - 4, 15 - 4, size + 8, size + 8, 4, "#444444", 1)
		core.drawThumbnail(data.floorId, null, { damage: data.damage, ctx: 'ui', x: 15, y: 15, size: size, all: data.all });
		if (!core.status.maps[core.floorIds[page]].canFlyTo || !core.hasVisitedFloor(core.floorIds[page]))
			core.drawImage('ui', 'lock.png', 0, 0, size, size, 15, 15, size, size);
		core.setTextAlign('ui', 'right');
		core.fillText('ui', (page - turn2) + '层', 288 + 12 + 37, 15 + 58 + 58 + 23, '#FFFFFF', this._buildFont(20, true))
		core.setTextAlign('ui', 'center');
		core.fillRoundRect('ui', 15 - 2, 288 - 2, 50 + 4, 50 + 4, 4, '#444444');
		core.strokeRoundRect('ui', 15 - 4, 288 - 4, 50 + 8, 50 + 8, 4, "#444444", 1)
		if (!core.status.maps[core.floorIds[page]].canFlyTo || !core.hasVisitedFloor(core.floorIds[page])) {
			core.fillText('ui', '楼传', 15 + 12 + 10, 288 + 20, '#909090', this._buildFont(18, true))
			core.fillText('ui', '预览', 15 + 38 - 10, 288 + 46, '#FFFFFF', this._buildFont(20, true))
		} else {
			core.fillText('ui', '楼传', 15 + 12 + 10, 288 + 20, '#FFFFFF', this._buildFont(20, true))
			core.fillText('ui', '预览', 15 + 38 - 10, 288 + 46, '#909090', this._buildFont(18, true))
		}
		core.fillRoundRect('ui', 288 - 2, 15 - 2, 50 + 4, 50 + 4, 4, '#444444');
		core.strokeRoundRect('ui', 288 - 4, 15 - 4, 50 + 8, 50 + 8, 4, "#444444", 1)
		core.fillText('ui', '上', 288 + 12, 15 + 20, '#FFFFFF', this._buildFont(20, true))
		core.fillText('ui', '翻', 288 + 38, 15 + 46, '#FFFFFF', this._buildFont(20, true))
		core.fillRoundRect('ui', 288 - 2, 15 + 58 - 2, 50 + 4, 50 + 4, 4, '#444444');
		core.strokeRoundRect('ui', 288 - 4, 15 + 58 - 4, 50 + 8, 50 + 8, 4, "#444444", 1)
		core.fillText('ui', '上', 288 + 12, 15 + 58 + 20, '#FFFFFF', this._buildFont(20, true))
		core.fillText('ui', '楼', 288 + 38, 15 + 58 + 46, '#FFFFFF', this._buildFont(20, true))
		core.fillRoundRect('ui', 288 - 2, 230 - 58 - 2, 50 + 4, 50 + 4, 4, '#444444');
		core.strokeRoundRect('ui', 288 - 4, 230 - 58 - 4, 50 + 8, 50 + 8, 4, "#444444", 1)
		core.fillText('ui', '下', 288 + 12, 230 - 58 + 20, '#FFFFFF', this._buildFont(20, true))
		core.fillText('ui', '楼', 288 + 38, 230 - 58 + 46, '#FFFFFF', this._buildFont(20, true))
		core.fillRoundRect('ui', 288 - 2, 230 - 2, 50 + 4, 50 + 4, 4, '#444444');
		core.strokeRoundRect('ui', 288 - 4, 230 - 4, 50 + 8, 50 + 8, 4, "#444444", 1)
		core.fillText('ui', '下', 288 + 12, 230 + 20, '#FFFFFF', this._buildFont(20, true))
		core.fillText('ui', '翻', 288 + 38, 230 + 46, '#FFFFFF', this._buildFont(20, true))
		core.fillRoundRect('ui', 288 - 2, 288 - 2, 50 + 4, 50 + 4, 4, '#444444');
		core.strokeRoundRect('ui', 288 - 4, 288 - 4, 50 + 8, 50 + 8, 4, "#444444", 1)
		core.fillText('ui', '返', 288 + 12, 288 + 20, '#FFFFFF', this._buildFont(20, true))
		core.fillText('ui', '回', 288 + 38, 288 + 46, '#FFFFFF', this._buildFont(20, true))

		//
		core.clearMap('data');
		core.setTextAlign('data', 'left');
		core.setFont('data', '16px Arial');
		var text = core.status.maps[data.floorId].title;
		if (!data.all && (data.mw > this.SIZE || data.mh > this.SIZE))
			text += " [" + (data.x - this.HSIZE) + "," + (data.y - this.HSIZE) + "]";
		if (core.markedFloorIds[data.floorId])
			text += " （已标记）";
		var textX = 16,
			textY = 18,
			width = textX + core.calWidth('data', text) + 16,
			height = 42;
		//core.fillRect('data', 5, 5, width, height, 'rgba(0,0,0,0.4)');
		//core.fillText('data', text, textX + 5, textY + 15, 'rgba(255,255,255,0.6)');
	}

	ui.prototype._drawBook_drawBackground = function () {
		core.setAlpha('ui', 1);
		core.setFillStyle('ui', core.material.groundPattern);
		core.fillRect('ui', 0, 0, this.PIXEL, this.PIXEL);

		core.setAlpha('ui', 0.6);
		core.setFillStyle('ui', '#000000');
		core.fillRect('ui', 0, 0, this.PIXEL, this.PIXEL);
		core.drawWindowSkin('winskin.png', 'ui', 0, 0, 352, 352);
	}
},
    "pop": function () {
	// 在此增加新插件
	function pop() {
		var ctx = core.getContextByName('pop');
		if (!ctx) ctx = core.createCanvas('pop', 0, 0, core.__PIXELS__, core.__PIXELS__, 171);
		core.clearMap(ctx);
		//	if (core.status.pop && core.status.pop[0] == null)
		//		core.deleteCanvas('pop');

		if (core.status.replay.speed <= 3 && !flags.stopPop) {
			var list = core.status.pop || [];
			var count = 0;
			list.forEach(function (one) {
				// 由frame计算出dy
				var dy = 6 - one.frame * 0.2;
				var dx = one.speed;


				if (one.speed < 0 && one.speed >= -2) {
					dx = 0;
					dy = 0;
				}

				dx *= one.direction;
				one.py -= dy;
				one.px += dx;
				var name = ['勇者', '盗贼', '商人', '贤者', '公主', '妖精']
				var iconskill = ['神剑战士', '怪盗杰克', '炼金术士', '传奇法师', '最终兵器', '湖中仙女']
				var heroid = ['child', 'thief', 'woman', 'man', 'princess', 'fairy']
				for (var i in name) {
					if (one.value == name[i]) {
						if (core.inArray(flags.skill1, iconskill[i]))
							one.value = heroid[i] + '2';
						else
							one.value = heroid[i];
					}
				}
				one.frame++;
				// 绘制
				if (one.speed === -1) ///不需要击飞
				{
					one.frame += 60;
					one.speed--;
				} else if (one.speed === -2) {
					core.setFilter(ctx, 'brightness(' + Math.max(280 - 2 * one.frame, 100) + '%)');
				} else if (one.speed > 0)
					core.setFilter(ctx, 'brightness(' + Math.max(160 - 2 * one.frame, 100) + '%)');
				if (one.frame >= 60) core.setAlpha(ctx, 3 - one.frame / 30);
				else core.setAlpha(ctx, 1);


				if (core.getBlockById(one.value).event.cls === 'npc48')
					core.drawIcon(ctx, one.value, one.px, one.py - 16, 32, 48);
				else {
					var blockInfo = core.getBlockInfo(one.value) || {};
					if (blockInfo.bigImage) /////大怪物
						core.drawImage(ctx, blockInfo.bigImage, 0, 0, 96, 96, one.px - 32, one.py - 64, 96, 96);
					else
						core.drawIcon(ctx, one.value, one.px, one.py, 32, 32);
				}


				if (one.frame >= 90) count++;
			});
			if (count > 0) list.splice(0, count);
		}
	}

	function popitem() { ////拾取道具
		var ctxitem = core.getContextByName('popitem');
		if (!ctxitem) ctxitem = core.createCanvas('popitem', 0, 0, core.__PIXELS__, core.__PIXELS__, 172);
		core.clearMap(ctxitem);
		//	if (core.status.popitem && core.status.popitem[0] == null)
		//		core.deleteCanvas('popitem');

		if (core.status.replay.speed <= 3) {
			var list = core.status.popitem || [];
			var count = 0;
			list.forEach(function (one) {
				// 由frame计算出dy
				if (!one.enemy) {
					var dy = one.speed;
					var dx = 0;
					one.py -= dy;
					one.px += dx;
				} else {
					var dy = 15 * one.speed;
					var dx = 15 * one.speed;
					dx *= one.directionx;
					dy *= one.directiony;
					one.py += dy;
					one.px += dx;
				}
				one.frameitem++;
				// 绘制		
				if (one.enemy) {
					core.setFilter(ctxitem, 'brightness(' + Math.max(160 - 2 * one.frameitem, 100) + '%)');
				}
				if (one.frameitem >= 0)
					core.setAlpha(ctxitem, 1 - one.frameitem / 30);
				var blockInfo = core.getBlockInfo(one.value) || {};
				if (blockInfo.bigImage) /////大怪物
					core.drawImage(ctxitem, blockInfo.bigImage, 0, 0, 96, 96, one.px - 32, one.py - 64, 96, 96);
				else
					core.drawIcon(ctxitem, one.value, one.px, one.py, 32, 32);
				if (one.frameitem >= 30) count++;
			});
			if (count > 0) list.splice(0, count);
		}
	}

	function popMove() {
		var ctx = core.getContextByName('popMove');
		if (!ctx) ctx = core.createCanvas('popMove', 0, 0, core.__PIXELS__, core.__PIXELS__, 71);
		core.clearMap(ctx);
		if (core.status.replay.speed <= 3 && !flags.stopPop) {
			var list = core.status.popMove || [];
			var count = 0;
			list.forEach(function (one) {
				// 由frame计算出dy

				one.frame++;
				// 绘制

				if (one.frame >= 0) core.setAlpha(ctx, 1 - one.frame / 30);
				else core.setAlpha(ctx, 1);

				var length = Math.sqrt(Math.pow((one.px2 - one.px), 2) + Math.pow((one.py2 - one.py), 2));
				//console.log(length)
				var li = (length / 16)
				var lx = (one.px2 - one.px) / li
				var ly = (one.py2 - one.py) / li
				for (var i = 0; i < li; i += 1) {
					core.setAlpha(ctx, (1 - one.frame / 30) * ((i / li) * 0.8 + 0.2));
					core.drawLine('popMove', one.px + i * lx, one.py + i * ly, one.px + ((i + 0.5) * lx), one.py + ((i + 0.5) * ly), '#E1E1E1', 6);
					if (i == 0)
						core.strokeCircle('popMove', one.px, one.py, 6, '#E1E1E1', 3);
				}
				core.strokeCircle('popMove', one.px2, one.py2, 6, '#E1E1E1', 3);
				core.strokeCircle('popMove', one.px2, one.py2, 6 + 16 * one.frame / 30, '#E1E1E1', 6 * (1 - one.frame / 30));
				//core.drawLine('popMove', one.px, one.py, one.px2, one.py2, '#E1E1E1', 6);


				if (one.frame >= 30) count++;
			});
			if (count > 0) list.splice(0, count);
		}
	}

	if (!main.replayChecking) {
		core.registerAnimationFrame('pop', true, pop);
		core.registerAnimationFrame('popitem', true, popitem);
		core.registerAnimationFrame('popMove', true, popMove);
	}
	/** 添加弹出内容 */
	this.addPop = function (px, py, value, direction, speed, frame) {
		var data = { px: px, py: py, value: value, direction: direction || Math.floor(Math.random() + 0.5) - 0.5, speed: speed || 10 * Math.random(), frame: frame || 0 };
		if (core.status.replay.speed <= 3) {
			if (!core.status.pop) core.status.pop = [data];
			else core.status.pop.push(data);
		}
	}
	this.addItemPop = function (px, py, value, speed, directionx, directiony, enemy, frameitem) {
		var data = { px: px, py: py, value: value, speed: speed || (Math.random() - 0.5), directionx: directionx || (Math.random() - 0.5), directiony: directiony || (Math.random() - 0.5), enemy: enemy, frameitem: frameitem || 0 };
		if (core.status.replay.speed <= 3) {
			if (!core.status.popitem) core.status.popitem = [data];
			else core.status.popitem.push(data);
		}
	}

	this.addPopMove = function (px, py, px2, py2, frame) {
		var data = { px: px, py: py, px2: px2, py2: py2, frame: frame || 0 };
		if (core.status.replay.speed <= 3) {
			if (!core.status.popMove) core.status.popMove = [data];
			else core.status.popMove.push(data);
		}
	}

},
    "逆塔": function () {
	// 在此增加新插件

	var Sword = ['sword1', 'sword2', null, 'sword3', 'sword4'];
	var Shield = ['shield1', 'shield2', null, 'shield3', 'shield4'];
	var R1_mon = ['greenSlime', 'redSlime', 'bat', 'bluePriest', 'skeleton', 'skeleton', 'skeletonSoilder', 'yellowGuard', 'greenSlime', 'redSlime', 'blueGuard', 'skeletonSoilder2', 'octopus', 'magicDragon2'];
	var R2_mon = ['blackSlime', 'blackSlime', 'bigBat', 'redPriest', 'zombie', 'zombie', 'zombieKnight', 'rock', 'bat', 'yellowGuard', 'blueGuard', 'zombieKnight2', 'octopus', 'magicDragon2'];
	var R4_mon = ['slimeMan', 'slimeMan', 'ghostSkeleton', 'soldier', 'blueGuard', 'ghostSkeleton', 'swordsman', 'redKnight', 'zombie', 'zombieKnight', 'redGuard', 'swordsman2', 'octopus2', 'magicDragon'];
	var R5_mon = ['slimelord', 'slimelord', 'redBat', 'brownWizard', 'blackKing', 'redWizard', 'whiteKing', 'darkKnight', 'slimelord', 'slimelord', 'redGuard', 'whiteKing2', 'octopus2', 'magicDragon'];

	core.myIntoTower2 = function () {
		/*for (var i = 0; i <= 50; i++) {
			core.setFloorInfo('cannotViewMap', true, 'MT' + i);
			core.setFloorInfo('cannotViewMap', false, 'HT' + i);
		}
		core.changeFloor('HT1', null, { x: 6, y: 11 });*/
		flags.turn2++;
		core.mysetstatuscolor();
		flags.turnAtk = flags.Allstatus[0].atk;
		flags.turnDef = flags.Allstatus[0].def;
		hero.hp = 1000;
		hero.atk = 10;
		hero.def = 10;
		hero.money = 0;
		flags.nowWeapon = null;
		flags.nowShield = null;
		//core.addItem('yellowKey', 5);
		//core.addItem('blueKey', 3);
		//core.addItem('redKey', 1);
		flags.Allstatus = [
			{ name: '勇者', hp: 1000, atk: 10, def: 10, lv: 1, p: 1, x: 6, y: 11, f: "MT1", sword: null, shield: null, unlock: true },
			{ name: '盗贼', hp: 500, atk: 15, def: 5, lv: 1, p: 1, x: 6, y: 11, f: "MT1", sword: null, shield: null, unlock: true },
			{ name: '商人', hp: 400, atk: 5, def: 12, lv: 1, p: 1, x: 6, y: 11, f: "MT1", sword: null, shield: null, unlock: true },
			{ name: '贤者', hp: 400, atk: 12, def: 5, lv: 1, p: 1, x: 6, y: 11, f: "MT1", sword: null, shield: null, unlock: true },
			{ name: '公主', hp: 400, atk: 8, def: 8, lv: 1, p: 1, x: 6, y: 11, f: "MT1", sword: null, shield: null, unlock: true },
			{ name: '妖精', hp: 100, atk: 1, def: 1, lv: 1, p: 1, x: 6, y: 11, f: "MT1", sword: null, shield: null, unlock: true },
		]
		//flags.theSuper_p = [0, 0, 0, 0, 0, 0]

		core.status.hero.items.tools = {};
		core.status.hero.items.constants = {};
		core.myremoveflag()
		core.myresetflag()
		//战车
		flags.Allstatus[0].atk += Math.floor(flags.turnAtk * flags.super_m * 0.01);
		flags.Allstatus[0].def += Math.floor(flags.turnDef * flags.super_m * 0.01);
		if (flags.theHero === 'child') {
			hero.atk += Math.floor(flags.turnAtk * flags.super_m * 0.01);
			hero.def += Math.floor(flags.turnDef * flags.super_m * 0.01);
		}
		for (var j in flags.Allstatus) {
			flags.Allstatus[j].atk += flags.super_atk;
			flags.Allstatus[j].def += flags.super_atk;
		}
		hero.atk += flags.super_atk;
		hero.def += flags.super_atk;
		//节制
		core.addItem('yellowKey', flags.super_key);
		core.addItem('blueKey', flags.super_key);
		core.addItem('redKey', flags.super_key);
		//恶魔
		hero.money += 500 * flags.super_money;
		//隐者
		for (var j in flags.Allstatus) {
			flags.Allstatus[j].p += flags.super_sp;
		}
		flags.skillpoint += flags.super_sp;
		flags.Hermit_p += flags.super_sp;

		core.addItem('Heros');
		core.addItem('Skills');
		core.addItem('Pows');
		core.addItem('book');
		core.addItem('fly');
		core.addItem('wand')
		if (flags.turn2 > 1)
			core.addItem('SuperBall')
		core.addItem('I300')
		core.drawHero();
		core.updateStatusBar();
	}

	core.myremoveflag = function () { //随【世界】重置

		flags.__visited__ = { 'MT1': true }
		if (!core.hasItem('SuperBall'))
			core.setBlock('SuperBall2', 7, 10, 'MT1');
		else
			core.removeBlock(7, 10, 'MT1')
		core.setBlock('level1', 2, 11, 'MT1');
		core.setBlock('level2', 3, 7, 'MT2');
		core.setBlock('level4', 6, 1, 'MT27');
		core.setBlock('level5', 6, 6, 'MT26');
		core.setBlock('level6', 4, 9, 'MT5');
		core.removeBlock(1, 9, 'MT1')
		core.removeBlock(5, 9, 'MT3');
		core.removeBlock(1, 5, 'MT4')
		core.removeBlock(11, 10, 'MT5')
		core.removeBlock(9, 11, 'MT14')
		core.removeBlock(5, 8, 'MT15')
		core.removeBlock(6, 6, 'MT24')
		core.removeBlock(5, 9, 'MT30')
		core.removeBlock(11, 11, 'MT32')
		core.removeBlock(7, 11, 'MT35')
		core.removeBlock(6, 11, 'MT40')
		core.removeBlock(2, 11, 'MT43')
		core.removeBlock(11, 11, 'MT44')
		core.removeBlock(7, 7, 'MT48')
		core.removeBlock(11, 11, 'MT49')

		core.removeFlag(2);
		core.removeFlag(03);
		core.removeFlag(8);
		core.removeFlag(10);
		core.removeFlag(11);
		core.removeFlag(12);
		core.removeFlag(14);
		core.removeFlag(20);
		core.removeFlag(32);
		core.removeFlag(33);
		core.removeFlag(34);
		core.removeFlag(38);
		core.removeFlag(39);
		core.removeFlag(40);
		core.removeFlag(41);
		core.removeFlag(43);
		core.removeFlag(44);
		core.removeFlag(171);
		core.removeFlag(172);
		core.removeFlag(173);
		core.removeFlag(174);
		core.removeFlag(402);
		core.removeFlag(451);
		core.removeFlag(452);
		core.removeFlag(491);
		core.removeFlag(492);
		core.removeFlag(493);
		core.removeFlag(494);
		core.removeFlag(495);
		core.removeFlag('centerFly');
		core.removeFlag('炸弹不开门');
		core.removeFlag('ratio');
		flags.spaceDoor = 0;
		flags.redKing2 = false
		flags.point5 = false
		flags.times1 = 1;
	}
	core.myresetflag = function () { //随周目重置，不随【世界】重置
		flags.mark = 0; //分数
		flags.lv = 1; //等级
		flags.skillpoint = 1; //技能点
		flags.zhapian = 0; //诈骗技能系数
		flags.womanmoney = 1 //偷税技能系数
		flags.manmoney = 0; //大贤者技能系数
		flags.redG_use = 0;
		flags.redG = 0; //赤玉加护
		flags.blueG = 0;
		flags.blueG_use = 0; //青玉加护
		flags.Potion = 0;
		flags.Potion_use = 0; //超回复
		flags.spaceDoor = 0; //24层开启
		flags.theSuper_p = [0, 0, 0, 0, 0, 0]; //超级点数
		flags.Hermit_p = 0; //额外技能点
		flags.ballz = 0
		flags.Valkyrie = 0
	}

	core.mysetstatuscolor = function () {
		var bgctx = document.getElementById("outerBackground").getContext("2d");
		var bg = core.material.images.images["statusBackground.jpg"];
		if (core.status.hero && flags.turn2) bg = core.material.images.images["statusBackground" + ((flags.turn2) % 6 + 1) + ".jpg"];
		if (core.status.hero && flags.harddddd) bg = core.material.images.images["statusBackground0.jpg"];
		bgctx.drawImage(bg, 0, 0, 640, 400);
		//bgctx.fillStyle = "#676767";
		//bgctx.fillRect(0, 400, 640, 22);
	}

	core.mysetRatio = function () {
		for (var i = 1; i <= 48; i++) {
			if (i < 21 || i > 30) {
				var ratio = Math.ceil(i / 10);
				core.setFloorInfo('ratio', ratio, core.floorIds[i]);
				for (var x = 1; x <= 11; x++)
					for (var y = 1; y <= 11; y++) {
						var block = core.getBlock(x, y, core.floorIds[i])
						if (block) {
							if (core.inArray(Sword, block.event.id)) {
								core.setBlock(Sword[ratio - 1], x, y, core.floorIds[i])
							}
							if (core.inArray(Shield, block.event.id)) {
								core.setBlock(Shield[ratio - 1], x, y, core.floorIds[i])
							}
							if (block.event.cls == 'enemys') {
								core.mysetMon(ratio, x, y, core.floorIds[i])
							}
						}
					}
			}
		}
	}

	core.mysetMon = function (ratio, x, y, f) {
		if (y == 4 && f == 'MT41') return;
		if (f == 'MT44') return;
		if ((y == 5 || y == 3) && f == 'MT45') return;
		if (x <= 5 && y >= 6 && f == 'MT46') return;
		//if (x == 1 && f == 'MT47') return;
		if ((x == 7 || x == 9) && f == 'MT48') return;

		var block = core.getBlock(x, y, f);
		var ori = f.slice(2);
		var ori_ratio = Math.ceil(ori / 10);
		//console.log(ori)

		if (block.event.id == 'octopus' && ratio >= 4) {
			core.setBlock('E354', x - 1, y - 2, f);
			core.setBlock('E355', x, y - 2, f);
			core.setBlock('E356', x + 1, y - 2, f);
			core.setBlock('E357', x - 1, y - 1, f);
			core.setBlock('E358', x, y - 1, f);
			core.setBlock('E359', x + 1, y - 1, f);
			core.setBlock('E360', x - 1, y, f);
			core.setBlock('E361', x + 1, y, f);
		}
		if (block.event.id == 'magicDragon' && ratio <= 2) {
			core.setBlock('N362', x - 1, y - 2, f);
			core.setBlock('N363', x, y - 2, f);
			core.setBlock('N364', x + 1, y - 2, f);
			core.setBlock('N365', x - 1, y - 1, f);
			core.setBlock('N366', x, y - 1, f);
			core.setBlock('N367', x + 1, y - 1, f);
			core.setBlock('N368', x - 1, y, f);
			core.setBlock('N369', x + 1, y, f);
		}
		var i
		if (ori_ratio == 1) {
			for (var j in R1_mon) {
				if (R1_mon[j] == block.event.id)
					i = j;
			}
		}
		if (ori_ratio == 2) {
			for (var j in R2_mon) {
				if (R2_mon[j] == block.event.id)
					i = j;
			}
		}
		if (ori_ratio == 4) {
			for (var j in R4_mon) {
				if (R4_mon[j] == block.event.id)
					i = j;
			}
		}
		if (ori_ratio == 5) {
			for (var j in R5_mon) {
				if (R5_mon[j] == block.event.id)
					i = j;
			}
		}
		if (ratio == 1)
			core.setBlock(R1_mon[i], x, y, f);
		else if (ratio == 2)
			core.setBlock(R2_mon[i], x, y, f);
		else if (ratio == 4)
			core.setBlock(R4_mon[i], x, y, f);
		else if (ratio == 5)
			core.setBlock(R5_mon[i], x, y, f);
	}

	core.myrandtemp = function (temp) {
		//var arr1 = [1, 2, 3, 4, 5, 6, 7];
		var out = [];
		while (temp.length) {
			var index = parseInt(core.rand() * temp.length);
			out = out.concat(temp.splice(index, 1));
		}
		//console.log(out);
		return out
	}

	core.mysetFloor = function () {
		var Sword_F = core.myrandtemp(['MT5', 'MT17', 'MT33', 'MT48']);
		var Shield_F = core.myrandtemp(['MT9', 'MT11', 'MT38', 'MT43']);
		var Shop_F = core.myrandtemp(['MT4', 'MT12', 'MT32', 'MT46']);
		var RedKey_F = core.myrandtemp(['MT8', 'MT14', 'MT34']);
		var region1 = ['MT1'];
		var region2 = [];
		var region3 = ['MT21', 'MT22', 'MT23', 'MT24', 'MT25', 'MT26', 'MT27', 'MT28', 'MT29', 'MT30'];
		var region4 = [];
		var region5 = [];
		var comon = core.myrandtemp(['MT2', 'MT3', 'MT6', 'MT7', 'MT13', 'MT15', 'MT16', 'MT18', 'MT31', 'MT35', 'MT36', 'MT37', 'MT39', 'MT41', 'MT44', 'MT45', 'MT47']);

		var Allspecial = [Sword_F, Shield_F, Shop_F, RedKey_F];
		var randregion = [
			[null, null, null, null, null, null, null, null],
			[null, null, null, null, null, null, null, null, 'MT19'],
			[null, null, null, null, null, null, null, null, null],
			[null, null, null, null, null, null, null, 'MT42']
		];
		for (var i in Allspecial) {
			for (var j in Allspecial[i])
				randregion[i][j] = Allspecial[j][i]
		}
		if (randregion[3][2] == 'MT32') {
			randregion[3][2] = randregion[2][2];
			randregion[2][2] = 'MT32';
		}
		var k = 0;
		for (var i in randregion) {
			for (var j in randregion[i]) {
				if (randregion[i][j] == null) {
					randregion[i][j] = comon[k];
					k++;
				}
			}
		}
		for (var i in randregion)
			randregion[i] = core.myrandtemp(randregion[i]);
		region1 = region1.concat(randregion[0]).concat('MT10');
		region2 = region2.concat(randregion[1]).concat('MT20');
		region4 = region4.concat(randregion[2]).concat('MT40');
		region5 = region5.concat(randregion[3]).concat('MT49', 'MT50');
		var Allregion = ['MT0'].concat(region1).concat(region2).concat(region3).concat(region4).concat(region5);
		core.floorIds = Allregion;
		flags.myfloorIds = Allregion;
		core.mysetRatio();
		/*var HT = [];
		for (var i = 1; i <= 50; i++) HT.push('HT' + i);
		for (var i = 0; i <= 50; i++)
			for (var x = 1; x <= 11; x++)
				for (var y = 1; y <= 11; y++) {
					core.setBlock(core.getBlockId(x, y, Allregion[i]), x, y, HT[i])
				}*/
	}

},
    "水晶球": function () {
	// 在此增加新插件

	var ccc = [
		['战车', '力量', '月亮', '审判'],
		['节制', '魔术师', '高塔', '正义'],
		['恶魔', '太阳', '皇帝', '倒吊人'],
		['隐者', '愚者', '死神', '教皇'],
		['女祭司', '星星', '女皇'],
		['命运之轮', '世界', '恋人']
	]
	///女皇、教皇、恋人、正义、审判、倒吊人
	core.myrandSuper = function (end) {
		var Super1 = [{
				name: '力量',
				text: '勇者当前\\r[#FFCFAE]攻击\\r翻倍',
				id: 'skill8',
				point: 1
			},
			{
				name: '月亮',
				text: '将本层宝石、血瓶、钥匙和门染成蓝色',
				id: 'skill18',
				point: 5
			}, {
				name: '审判',
				text: '将周围怪物的全属性减半,对魔王无效',
				id: 'skill20',
				point: 3
			}
		];
		var Super2 = [{
			name: '魔术师',
			text: '开启本层所有‘门’',
			id: 'skill1',
			point: 10
		}, {
			name: '高塔',
			text: '破坏本层所有墙壁，并显示隐藏的楼梯',
			id: 'skill16',
			point: 1
		}, {
			name: '正义',
			text: '窃取周围怪物的金币，受到幸运金币加成',
			id: 'skill11',
			point: 5
		}];
		var Super3 = [{
			name: '太阳',
			text: '将本层宝石、血瓶、钥匙和门染成红色',
			id: 'skill19',
			point: 5
		}, {
			name: '皇帝',
			text: '贪婪之神供奉次数降低9次',
			id: 'skill4',
			point: 3
		}, {
			name: '倒吊人',
			text: '下次战斗的伤害改为恢复生命',
			id: 'skill12',
			point: 3
		}];
		var Super4 = [{
			name: '愚者',
			text: '重置所有角色的技能点',
			id: 'skill0',
			point: 1
		}, {
			name: '教皇',
			text: '当前角色等级提升10',
			id: 'skill5',
			point: 1
		}, {
			name: '死神',
			text: '将本层能破防的怪物变成骷髅人，对大法师、魔王无效',
			id: 'skill13',
			point: 1
		}]
		var Super5 = [{
			name: '女皇',
			text: '勇者当前血量翻倍',
			id: 'skill2',
			point: 1
		}, {
			name: '星星',
			text: '将本层血瓶变成对应颜色宝石',
			id: 'skill17',
			point: 5
		}];
		var Super6 = [{
			name: '恋人',
			text: '无视障碍将所有队友召集到当前位置',
			id: 'skill6',
			point: 10
		}, {
			name: '世界',
			text: '随机重置所有楼层并回到1层',
			id: 'skill21',
			point: 1
		}];
		var Super = [{
				name: '战车',
				text: '每周目开始勇者继承上周目1%攻防,所有角色\\r[#FFCFAE]攻击+5\\r,\\r[#D1CEFF]防御+5\\r',
				id: 'skill7',
				point: 0,
				x: 50,
				y: 170
			}, {
				name: '节制',
				text: '每周目开始获得各1把三色钥匙',
				id: 'skill14',
				point: 0,
				x: 94,
				y: 170
			},
			{
				name: '恶魔',
				text: '每周目开始获得\\r[#ffe888]500金币',
				id: 'skill15',
				point: 0,
				x: 138,
				y: 170
			},
			{
				name: '隐者',
				text: '每周目开始所有角色获得额外的1点技能点',
				id: 'skill9',
				point: 0,
				x: 182,
				y: 170
			},
			{
				name: '女祭司',
				text: '敌人全属性-30%',
				id: 'skill3',
				point: 0,
				x: 226,
				y: 170
			}, {
				name: '命运之轮',
				text: '敌人全属性+50%，通关得分×(+1)',
				id: 'skill10',
				point: 0,
				x: 270,
				y: 170
			}

		]
		flags.Super = Super;
		flags.allSuper = [];
		/*var supertemp = core.myrandtemp(Super);
		for (var i = 0; i <= 5; i++)
			flags.allSuper[i] = supertemp[i];*/
		if (end)
			flags.allSuper = Super;
		else {
			flags.allSuper[0] = core.myrandtemp(Super1)[0];
			flags.allSuper[1] = core.myrandtemp(Super2)[0];
			flags.allSuper[2] = core.myrandtemp(Super3)[0];
			flags.allSuper[3] = core.myrandtemp(Super4)[0];
			flags.allSuper[4] = core.myrandtemp(Super5)[0];
			flags.allSuper[5] = core.myrandtemp(Super6)[0];
		}
		for (var i in flags.allSuper)
			flags.allSuper[i].y = 170
		flags.allSuper[0].x = 50;
		flags.allSuper[1].x = 94;
		flags.allSuper[2].x = 138;
		flags.allSuper[3].x = 182;
		flags.allSuper[4].x = 226;
		flags.allSuper[5].x = 270;

		for (var i in flags.theSuper_p)
			flags.theSuper_p[i] = flags.allSuper[i].point;

		flags.allSuper0 = flags.allSuper
	}

	core.mySuper = function () {
		if (!flags.turn2) return;

		core.status.holdingKeys = []; ///清空按下的键
		core.lockControl();
		flags.theSuper = flags.theSuper || 0;
		core.status.event.id = 'mySuper';
		core.mySuper_draw(); ///重绘页面
	}

	core.quit_mySuper = function () {
		core.clearUI();
		core.status.event.id = null;
		core.unlockControl();
		if (core.isReplaying())
			core.replay();
	}

	core.enter_mySuper = function () {
		var i = flags.theSuper;
		//console.log(i)
		//if ((flags.allMark || 0) >= 10000 * flags.theSuper_p[i])
		if ((!flags.ballz && flags.theSuper_p[i] > 0) || (flags.ballz && flags.allMark > 10000 * flags.theSuper_p2[i])) {
			var cannot = false
			if (flags.allSuper[i].name == '愚者') {
				core.S_myskill0();
				core.updateStatusBar();
			} else if (flags.allSuper[i].name == '力量') {
				flags.Allstatus[0].atk *= 2;
				if (flags.theHero === 'child')
					hero.atk *= 2;
				core.updateStatusBar();
			} else if (flags.allSuper[i].name == '女皇') {
				flags.Allstatus[0].hp *= 2;
				if (flags.theHero === 'child')
					hero.hp *= 2;
				core.updateStatusBar();
			} else if (flags.allSuper[i].name == '战车') {
				flags.super_m += 1;
				flags.Allstatus[0].atk += Math.floor(flags.turnAtk * 0.01);
				flags.Allstatus[0].def += Math.floor(flags.turnDef * 0.01);
				if (flags.theHero === 'child') {
					hero.atk += Math.floor(flags.turnAtk * 0.01);
					hero.def += Math.floor(flags.turnDef * 0.01);
				}
				for (var j in flags.Allstatus) {
					flags.Allstatus[j].atk += 5;
					flags.Allstatus[j].def += 5;
				}
				hero.atk += 5;
				hero.def += 5;
				flags.super_atk += 5;
				core.updateStatusBar();
			} else if (flags.allSuper[i].name == '魔术师') {
				core.S_myskill1();
			} else if (flags.allSuper[i].name == '高塔') {
				core.S_myskill16();
			} else if (flags.allSuper[i].name == '正义') {
				if (core.S_myskill11() == false)
					cannot = true;
			} else if (flags.allSuper[i].name == '恋人') {
				if (!core.getBlock(hero.loc.x, hero.loc.y))
					core.S_myskill6();
				else {
					core.playSound('操作失败');
					core.drawTip('当前位置有障碍物')
					cannot = true;
				}
			} else if (flags.allSuper[i].name == '皇帝') {
				flags.times1 = Math.max(flags.times1 - 9, 1)
			} else if (flags.allSuper[i].name == '教皇') {
				for (var p = 1; p <= 10; p++) {
					flags.lv++;
					flags.skillpoint++;
					core.uphero();
				}
				core.updateStatusBar();
			} else if (flags.allSuper[i].name == '倒吊人') {
				if (!flags.xixue) {
					flags.xixue = 1;
					core.drawHero();
					core.updateStatusBar();
				} else {
					core.playSound('操作失败');
					core.drawTip('当前已激活倒吊人')
					cannot = true;
				}
			} else if (flags.allSuper[i].name == '节制') {
				core.addItem('yellowKey', 1);
				core.addItem('blueKey', 1);
				core.addItem('redKey', 1);
				flags.super_key += 1;
				core.updateStatusBar();
			} else if (flags.allSuper[i].name == '恶魔') {
				hero.money += 500;
				flags.super_money += 1;
				core.updateStatusBar();
			} else if (flags.allSuper[i].name == '死神') {
				core.S_myskill13();
			} else if (flags.allSuper[i].name == '审判') {
				if (core.S_myskill20() == false)
					cannot = true
			} else if (flags.allSuper[i].name == '隐者') {
				for (var j in flags.Allstatus) {
					flags.Allstatus[j].p += 1;
				}
				flags.skillpoint += 1;
				flags.Hermit_p += 1;
				flags.super_sp += 1;
				core.updateStatusBar();
			} else if (flags.allSuper[i].name == '女祭司') {
				flags.super_n++;
				core.updateStatusBar();
			} else if (flags.allSuper[i].name == '命运之轮') {
				flags.super_hp += 1;
				core.updateStatusBar();
			} else if (flags.allSuper[i].name == '星星') {
				core.S_myskill17();
			} else if (flags.allSuper[i].name == '月亮') {
				core.S_myskill18();
			} else if (flags.allSuper[i].name == '太阳') {
				core.S_myskill19();
			} else if (flags.allSuper[i].name == '世界') {
				//flags.allMark -= 10000 * flags.theSuper_p[i];
				flags.theSuper_p[i]--;
				core.status.route.push('mySuper:' + i)
				for (var x = 1; x <= 11; x++)
					for (var y = 1; y <= 11; y++) { core.addPop(32 * x - 32, 32 * y - 32, core.getBlockId(x, y)); }
				for (var i in flags.Allstatus) { core.addPop(32 * flags.Allstatus[i].x - 32, 32 * flags.Allstatus[i].y - 32, flags.Allstatus[i].name); }
				for (var i = 0; i <= 50; i++) core.resetMap('MT' + i);
				core.mysetFloor();
				core.myremoveflag();
				if (!core.isReplaying())
					core.changeFloor('MT1', null, { x: 6, y: 11 });
				cannot = true
				//core.insertCommonEvent('世界', null, null, null, null, true);
			}
			if (!cannot) {
				if (flags.ballz) {
					flags.allMark -= 10000 * flags.theSuper_p2[i];
					flags.theSuper_p2[i]++;
				} else
					flags.theSuper_p[i]--;
				if (flags.allSuper[i].name !== '正义')
					core.drawTip(flags.allSuper[i].name + ' 使用成功')
				core.status.route.push('mySuper:' + i)
			}
		} else {
			if (flags.ballz)
				core.drawTip('累计分数不足')
			else
				core.drawTip('剩余次数不足')
		}
		core.mySuper_draw(); ///重绘页面
	}

	core.mySuper_draw = function () {
		core.clearUI();
		//首先绘制背景
		core.clearMap('ui');
		core.drawWindowSkin('winskin.png', 'ui', 15, 15, 352 - 30, 352 - 30);
		core.setTextAlign('ui', 'center');
		core.fillText('ui', "祝福许愿", 352 / 2, 40, '#E1E1E1', 'bold 22px Verdana');
		core.fillText('ui', "快捷键Y", 352 / 2 + 110, 40, '#888888', 'bold 18px Verdana');
		core.fillText('ui', "——点击任意处退出（X）——", 352 / 2, 325, '#E1E1E1', 'bold 14px Verdana');
		core.fillRoundRect('ui', 50, 50, 32, 32, 4, "#444444");
		core.strokeRoundRect('ui', 50 - 2, 50 - 2, 36, 36, 4, "#444444", 1)
		//core.drawImage('ui', 'Superball' + '.png', 0, 0, 32, 32, 50, 50, 32, 32);
		if (flags.ballz)
			core.drawIcon('ui', 'SuperBall2', 50, 50, 32, 32);
		else
			core.drawIcon('ui', 'SuperBall', 50, 50, 32, 32);
		core.setTextAlign('ui', 'left');
		//core.fillText('ui', "Lv." + flags.Allstatus[2].lv, 45, 100, '#E1E1E1', 'bold 16px Verdana');
		if (flags.ballz)
			core.fillText('ui', '永久天赋', 40, 110, '#E1E1E1', 'bold 14px Verdana');
		else
			core.fillText('ui', '特殊技能', 40, 110, '#E1E1E1', 'bold 14px Verdana');
		core.strokeRoundRect('ui', 40, 160, 352 - 80, 52, 4, "#444444", 1);
		for (var i in flags.allSuper) {
			var x = flags.allSuper[i].x;
			var y = flags.allSuper[i].y;

			core.fillRoundRect('ui', x, y, 32, 32, 4, "#444444");
			core.strokeRoundRect('ui', x - 2, y - 2, 36, 36, 4, "#444444", 1)
			core.setTextAlign('ui', 'center'); {
				/*if (core.inArray(flags.skill1, Super[i].name)) {
					core.strokeRoundRect('ui', x - 2, y - 2, 36, 36, 4, "#ccccff", 1);
				} else {
					core.setFilter('ui', 'brightness(50%)grayscale(70%)');
					core.setAlpha('ui', 0.7);
				}*/
				if ((!flags.ballz && flags.theSuper_p[i] <= 0) || flags.ballz && flags.theSuper_p2[i] <= 0) {
					core.setFilter('ui', 'brightness(50%)grayscale(70%)');
					core.setAlpha('ui', 0.7);
				}
				core.drawImage('ui', flags.allSuper[i].id + '.png', 0, 0, 32, 32, x, y, 32, 32);
				core.setFilter('ui', '');
				core.setAlpha('ui', 1);
			}

			if (flags.theSuper == i) {

				core.strokeRoundRect('ui', x - 2, y - 2, 36, 36, 4, "#ffff80", 1);
				core.fillPolygon('ui', [
					[x + 2, y + 16],
					[x - 2, y + 16 + 4],
					[x - 2, y + 16 - 4]
				], "#ffff80");
				core.fillPolygon('ui', [
					[x + 32 - 2, y + 16],
					[x + 32 + 2, y + 16 + 4],
					[x + 32 + 2, y + 16 - 4]
				], "#ffff80");
			}

			core.setTextAlign('ui', 'left');
			core.strokeRoundRect('ui', 100, 50 - 2, 352 - 100 - 40, 80, 4, "#444444", 1);
			core.fillRoundRect('ui', 102, 50, 352 - 100 - 40 - 4, 80 - 4, 4, "#444444");
			core.strokeRoundRect('ui', 40, 133 - 2, 352 - 80, 25, 4, "#444444", 1);
			core.fillRoundRect('ui', 42, 133, 352 - 80 - 4, 25 - 4, 4, "#444444");
			core.strokeRoundRect('ui', 40, 160 + 50 + 6, 352 - 80, 52 + 50 - 6, 4, "#444444", 1);
			core.fillRoundRect('ui', 40 + 2, 160 + 50 + 6 + 2, 352 - 80 - 4, 52 + 50 - 6 - 4, 4, "#444444");
			core.drawLine('ui', 100, 54 + 20, 312, 56 + 20, '#676767', 1);

			var k = flags.theSuper;

			core.fillText('ui', flags.allSuper[k].name, 106, 50 + 20, '#E1E1E1', 'bold 16px Verdana');

			//core.fillText('ui', Super[k].text, 106, 50 + 20 + 20, '#E1E1E1', 'bold 12px Verdana');
			var text = flags.allSuper[k].text;
			var height = null;
			var max_height = 110;
			if (text) {
				for (var fontSize = 17; fontSize >= 9; fontSize -= 2) {
					var config = { left: 106, top: 50 + 20 + 20 - 12, fontSize: 12, maxWidth: 352 - 100 - 40 - 4, bold: true, color: "#E1E1E1" };
					height = 42 + core.getTextContentHeight(text, config);
					if (height < max_height || fontSize == 9) {
						core.drawTextContent('ui', text, config);
						break;
					}
				}
			}

			if (flags.ballz)
				core.fillText('ui', '累计分数:' + (core.formatBigNumber(flags.allMark) || 0), 44, 150 - 2, '#E1E1E1', 'bold 12px Verdana');
			else
				core.fillText('ui', '按[Z]或点击上方水晶球图标切换至永久天赋', 44, 150 - 2, '#E1E1E1', 'bold 12px Verdana');
			core.setTextAlign('ui', 'right');
			core.fillText('ui', '再次点击图标激活(Enter)', 304, 50 + 70, '#E1E1E1', 'bold 12px Verdana');
			var col = '\\r[#E1E1E1]';
			if ((flags.allMark || 0) < 10000 * flags.theSuper_p2[flags.theSuper])
				col = '\\r[#ff8888]';
			if (flags.ballz)
				core.fillText('ui', '消耗分数：' + col + core.formatBigNumber(10000 * flags.theSuper_p2[flags.theSuper]), 304, 150 - 2, '#E1E1E1', 'bold 12px Verdana');
			//core.fillText('ui', '该祝福免费使用', 304, 150 - 2, '#E1E1E1', 'bold 12px Verdana');
			if (flags.ballz)
				core.fillText('ui', '激活次数:' + flags.theSuper_p2[flags.theSuper], 304, 50 + 20, flags.theSuper_p2[flags.theSuper] > 0 ? '#E1E1E1' : '#888888', 'bold 16px Verdana');
			else
				core.fillText('ui', '剩余次数:' + flags.theSuper_p[flags.theSuper], 304, 50 + 20, flags.theSuper_p[flags.theSuper] > 0 ? '#E1E1E1' : '#ff8888', 'bold 16px Verdana');
			core.setTextAlign('ui', 'left');



			if (flags.super_atk > 0)
				core.fillText('ui', '每周目开始所有角色\\r[#FFCFAE]攻击+' + flags.super_atk + '\\r,\\r[#D1CEFF]防御+' + flags.super_atk + '\\r', 44, 245, '#E1E1E1', 'bold 12px Verdana');
			else
				core.fillText('ui', '每周目开始所有角色攻击+0,防御+0', 44, 245, '#888888', 'bold 12px Verdana');
			if (flags.super_key > 0)
				core.fillText('ui', '每周目开始获得各' + flags.super_key + '把三色钥匙', 44, 260, '#E1E1E1', 'bold 12px Verdana');
			else
				core.fillText('ui', '每周目开始获得各0把三色钥匙', 44, 260, '#888888', 'bold 12px Verdana');
			if (flags.super_money > 0)
				core.fillText('ui', '每周目开始获得\\r[#ffe888]' + (500 * flags.super_money) + '金币\\r', 44, 275, '#E1E1E1', 'bold 12px Verdana');
			else
				core.fillText('ui', '每周目开始获得0金币', 44, 275, '#888888', 'bold 12px Verdana');
			if (flags.super_sp > 0)
				core.fillText('ui', '每周目开始所有角色获得额外的\\r[#ffffff]' + (1 * flags.super_sp) + '\\r点技能点', 44, 290, '#E1E1E1', 'bold 12px Verdana');
			else
				core.fillText('ui', '每周目开始所有角色获得额外的0点技能点', 44, 290, '#888888', 'bold 12px Verdana');
			if (flags.super_hp > 0)
				core.fillText('ui', '敌人全属性+' + (flags.turn2 * 100 + flags.super_hp * 50 - flags.super_n * 30) + '%，通关得分×' + (flags.super_hp + 1), 44, 290 + 15, '#E1E1E1', 'bold 12px Verdana');
			else
				core.fillText('ui', '敌人全属性+' + (flags.turn2 * 100 - flags.super_n * 30) + '%，通关得分×1', 44, 290 + 15, '#888888', 'bold 12px Verdana');
			if (flags.super_m > 0)
				core.fillText('ui', '每周目开始勇者继承上周目' + (flags.super_m) + '%攻防', 44, 230, '#E1E1E1', 'bold 12px Verdana');
			else
				core.fillText('ui', '每周目开始勇者继承上周目0%攻防', 44, 230, '#888888', 'bold 12px Verdana');
			/*	if (flags.theSuper_p[5] > 0)
					core.fillText('ui', '已重置楼层\\r[#ffffff]' + (1 * flags.theSuper_p[5]) + '\\r次', 44, 290 + 15, '#E1E1E1', 'bold 12px Verdana');
				else
					core.fillText('ui', '已重置楼层0次', 44, 290 + 15, '#888888', 'bold 12px Verdana');*/

		}
	}

	this.mySuper_keyDown = function (keycode) {
		if (core.status.event.id !== 'mySuper') return false;

		var done = false

		if (keycode == 37) {
			if (flags.theSuper > 0)
				flags.theSuper -= 1;
		} else if (keycode == 39) {
			if (flags.theSuper < flags.allSuper.length - 1)
				flags.theSuper += 1;
		} else if (keycode == 38) {
			for (var j in flags.allSuper) {
				if (flags.allSuper[j].x == flags.allSuper[flags.theSuper].x && flags.allSuper[j].y == flags.allSuper[flags.theSuper].y - 50) {
					if (!done) {
						flags.theSuper = Number(j);
						done = true;
					}
				}

			}
			for (var j in flags.allSuper) {
				if (flags.allSuper[j].x == flags.allSuper[flags.theSuper].x && flags.allSuper[j].y == flags.allSuper[flags.theSuper].y - 100) {
					if (!done) {
						flags.theSuper = Number(j);
						done = true;
					}
				}

			}
			if (!done)
				flags.theSuper = 0;
		} else if (keycode == 40) {
			for (var j in flags.allSuper) {
				if (flags.allSuper[j].x == flags.allSuper[flags.theSuper].x && flags.allSuper[j].y == flags.allSuper[flags.theSuper].y + 50) {
					if (!done) {
						flags.theSuper = Number(j);
						done = true;
					}
				}

			}
			for (var j in flags.allSuper) {
				if (flags.allSuper[j].x == flags.allSuper[flags.theSuper].x && flags.allSuper[j].y == flags.allSuper[flags.theSuper].y + 100) {
					if (!done) {
						flags.theSuper = Number(j);
						done = true;
					}
				}

			}
			if (!done)
				flags.theSuper = flags.allSuper.length - 1;
		}

		if (keycode == 90) {
			if (!flags.ballz) {
				flags.allSuper = flags.Super;
				flags.ballz = 1;
			} else {
				flags.allSuper = flags.allSuper0;
				flags.ballz = 0
			}
			core.status.route.push("ballz");
		}

		core.mySuper_draw(); ///重绘页面

		return true;
	}

	core.registerAction('keyDown', 'mySuper', 'mySuper_keyDown', 100);

	var mySuper = function (keycode) {
		if (core.status.event.id !== 'mySuper') return false;

		if (keycode == 32 || keycode == 13 || keycode == 67) { //c\space\enter
			core.enter_mySuper();
		}
		if (keycode == 88 || keycode == 89 || keycode == 27) { ////x、y和Esc退出
			core.quit_mySuper();
		}
		return true; ///全部拦截
	};
	core.registerAction('keyUp', 'mySuper', mySuper, 100);


	this.mySuper_onmove = function (x, y, px, py) {
		if (core.status.event.id !== 'mySuper') return false;

		//console.log(px + ',' + py);
		var boxX = Math.floor((px - 50) / 44), //点击盒子坐标
			boxY = Math.floor((py - 170) / 50);
		if (px < boxX * 44 + 50 || px > boxX * 44 + 50 + 36 || py < boxY * 50 + 170 || py > boxY * 50 + 170 + 36) return false;
		if (boxX < 0 || boxX > 5 || boxY < 0 || boxY > 2) return false;
		var i = boxX + boxY * 6;
		if (i >= 0 && i <= 6) {
			{
				for (var j in flags.allSuper) {
					if (flags.allSuper[j].x == boxX * 44 + 50 && flags.allSuper[j].y == boxY * 50 + 170 && j != flags.theSuper) {
						flags.theSuper = Number(j);
						core.mySuper_draw(); ///重绘页面
						//console.log(boxX + ',' + boxY + ',' + px + ',' + py);
					}
				}

			}

		}

		return true;
	}
	core.registerAction('onmove', 'mySuper', 'mySuper_onmove', 100);

	core.registerAction('onclick', 'mySuper', function (x, y, px, py) {
		if (core.status.event.id !== 'mySuper') return false;

		//console.log(px + ',' + py);
		if (px >= 45 && px <= 100 && py >= 45 && py <= 130) {
			if (!flags.ballz) {
				flags.allSuper = flags.Super;
				flags.ballz = 1;
			} else {
				flags.allSuper = flags.allSuper0;
				flags.ballz = 0
			}
			core.status.route.push("ballz");
			core.mySuper_draw(); ///重绘页面
		} else if (px < 45 || px > 352 - 45 || py < 50 || py > 352 - 50) {
			core.quit_mySuper();
		} else {
			var boxX = Math.floor((px - 50) / 44), //点击盒子坐标
				boxY = Math.floor((py - 170) / 50);
			if (px < boxX * 44 + 50 || px > boxX * 44 + 50 + 36 || py < boxY * 50 + 170 || py > boxY * 50 + 170 + 36) return false;
			if (boxX < 0 || boxX > 5 || boxY < 0 || boxY > 2) return false;
			var i = boxX + boxY * 6;
			if (i >= 0 && i <= 6) {
				{
					for (var j in flags.allSuper) {
						if (flags.allSuper[j].x == boxX * 44 + 50 && flags.allSuper[j].y == boxY * 50 + 170) {
							if (j == flags.theSuper)
								core.enter_mySuper();
							else if (j != flags.theSuper) {
								flags.theSuper = Number(j);
								core.mySuper_draw(); ///重绘页面
							}
							//console.log(boxX + ',' + boxY + ',' + px + ',' + py);
						}
					}

				}

			}


		}
		return true;

	}, 100);

},
    "技能2": function () {
	// 在此增加新插件
	core.S_myskill0 = function () { //愚者
		if (core.inArray(flags.skill1, "双刀流") && flags.Allstatus[1].shield) {
			if (flags.theHero === 'thief') {
				flags.nowShield = null;
				hero.atk -= Math.ceil(Number(core.material.items[flags.Allstatus[1].shield].canUseItemEffect) / 10) * 0.5;
			}
			flags.Allstatus[1].atk -= Math.ceil(Number(core.material.items[flags.Allstatus[1].shield].canUseItemEffect) / 10) * 0.5;
			flags.Allstatus[1].shield = null //双刀流
		}

		for (var i in flags.Allstatus) {
			flags.Allstatus[i].p = flags.Allstatus[i].lv + flags.Hermit_p;
		}
		flags.skillpoint = flags.lv + flags.Hermit_p;
		flags.skill1 = ["勇者の证", "盗贼の证", "商人の证", "贤者の证", "公主の证", "妖精の证"]
		flags.zhapian = 0; //诈骗技能系数
		flags.womanmoney = 1 //偷税技能系数
		flags.manmoney = 0; //大贤者技能系数
		flags.redG_use = 0;
		flags.redG = 0; //赤玉加护
		flags.blueG = 0;
		flags.blueG_use = 0; //青玉加护
		flags.Potion = 0;
		flags.Potion_use = 0; //超回复



	}
	core.S_myskill1 = function () { //魔术师
		if (!core.isReplaying()) {
			var actions = core.searchBlock("*Door").map(function (block) {
				return { "type": "openDoor", "loc": [block.x, block.y], "async": true };
			});
			actions.push({ "type": "waitAsync" });
			//actions.push({ "type": "tip", "text": core.material.items[itemId].name + "使用成功" });
			core.insertAction(actions);
		} else {
			var door = core.searchBlock("*Door");
			for (var i in door) {
				core.removeBlock(door[i].x, door[i].y, door[i].floorId);
			}
		}
	}

	core.S_myskill6 = function () { //恋人
		for (var i in flags.Allstatus) {
			flags.Allstatus[i].x = hero.loc.x;
			flags.Allstatus[i].y = hero.loc.y;
		}
		core.drawHero();
	}

	core.S_myskill11 = function () { //正义
		var scan = core.utils.scan;
		var theifList = [];
		var money = 0;
		var theif = function (x, y) {
			theifList.push([x, y]);
			var id = core.getBlockId(x, y),
				enemy = core.material.enemys[id];
			var coin = 1;
			if (core.hasItem('coin'))
				coin = 2;
			money += (core.getEnemyValue(enemy, 'money', x, y) || 0) * coin;
			core.setEnemyOnPoint(x, y, null, 'money', 0, '*=');

		}
		for (var direction in scan) {
			var delta = scan[direction];
			theif(core.getHeroLoc('x') + delta.x, core.getHeroLoc('y') + delta.y);
		}
		if (money == 0) {
			core.playSound('操作失败');
			core.drawTip('什么都没偷到。')
			return false
		} else {
			hero.money += money;
			core.drawTip('正义 使用成功,偷到' + money + '金币。');
			core.updateStatusBar();
		}
	}
	core.S_myskill20 = function () { //审判
		var scan = core.utils.scan;
		var knifeList = [];
		var canBombBoss = function (x, y) {
			//console.log(111)
			var block = core.getBlock(x, y);
			if (block == null || block.disable || block.event.cls.indexOf('enemy') != 0) return false;
			var enemy = core.material.enemys[block.event.id];
			var isEndBoss = false;
			if (block.event.id === 'swordEmperor' || block.event.id === 'redKing')
				isEndBoss = true;
			return enemy && !isEndBoss;
		};
		var knife = function (x, y) {
			if (!canBombBoss(x, y))
				return;
			knifeList.push([x, y]);
			var id = core.getBlockId(x, y),
				enemy = core.material.enemys[id];
			core.setEnemyOnPoint(x, y, null, 'hp', 0.5, '*=');
			core.setEnemyOnPoint(x, y, null, 'atk', 0.5, '*=');
			core.setEnemyOnPoint(x, y, null, 'def', 0.5, '*=');

		}
		for (var direction in scan) {
			var delta = scan[direction];
			knife(core.getHeroLoc('x') + delta.x, core.getHeroLoc('y') + delta.y);
		}
		if (knifeList.length == 0) {
			core.playSound('操作失败');
			core.drawTip('周围没有可使用的怪物。')
			return false
		}
	}

	core.S_myskill13 = function () { //死神
		var indexes = [];
		for (var index in core.status.thisMap.blocks) {
			var block = core.status.thisMap.blocks[index];
			if (!block.disable && block.event.cls === 'enemys' && block.event.id != 'blackMagician' && block.event.id != 'swordEmperor' && block.event.id != 'redKing') {
				indexes.push({ x: block.x, y: block.y, id: block.event.id });
			}
		}
		for (var i in indexes) {
			if ((core.inArray(flags.skill1, "巫师") && flags.theHero === 'man') || (flags.Allstatus[3].atk > core.enemys.getEnemyInfo(indexes[i].id, null, indexes[i].x, indexes[i].y).def)) {
				core.setBlock('skeleton', indexes[i].x, indexes[i].y)
				if (indexes[i].id == 'magicDragon' || indexes[i].id == 'magicDragon2' || indexes[i].id == 'greenKing') {
					core.removeBlock(indexes[i].x - 1, indexes[i].y - 2);
					core.removeBlock(indexes[i].x - 1, indexes[i].y - 1);
					core.removeBlock(indexes[i].x - 1, indexes[i].y);
					core.removeBlock(indexes[i].x, indexes[i].y - 2);
					core.removeBlock(indexes[i].x, indexes[i].y - 1);
					//core.removeBlock(indexes[i].x, indexes[i].y);
					core.removeBlock(indexes[i].x + 1, indexes[i].y - 2);
					core.removeBlock(indexes[i].x + 1, indexes[i].y - 1);
					core.removeBlock(indexes[i].x + 1, indexes[i].y);
				}
			}
		}
		core.redrawMap();
	}

	core.S_myskill16 = function () { //高塔
		var indexes = [];
		var pops = [];
		var findexes = [];
		for (var index in core.status.thisMap.blocks) {
			var block = core.status.thisMap.blocks[index];
			if (block.x >= 1 && block.x <= 11 && block.y >= 1 && block.y <= 11) {
				if (!block.disable && block.event.canBreak) {
					indexes.push(index);
					pops.push({ x: block.x, y: block.y });
				}
				if (block.disable && (block.event.id == 'upFloor' || block.event.id == 'downFloor')) {
					findexes.push({ x: block.x, y: block.y });
				}
			}
		}
		for (var i in pops) {
			core.addPop(32 * pops[i].x - 32, 32 * pops[i].y - 32, core.getBlockId(pops[i].x, pops[i].y));
		}
		core.removeBlockByIndexes(indexes);
		for (var i in findexes) {
			core.showBlock(findexes[i].x, findexes[i].y, findexes[i].f)
		}
		core.redrawMap();
		core.playSound('door.mp3');
	}

	core.S_myskill17 = function () { //星星
		for (var index in core.status.thisMap.blocks) {
			var block = core.status.thisMap.blocks[index];
			if (block?.event?.id === 'redPotion')
				core.setBlock('redGem', block.x, block.y);
			if (block?.event?.id === 'bluePotion')
				core.setBlock('blueGem', block.x, block.y);
		}
	}
	core.S_myskill18 = function () { //月亮
		for (var index in core.status.thisMap.blocks) {
			var block = core.status.thisMap.blocks[index];
			if (block?.event?.id === 'redGem')
				core.setBlock('blueGem', block.x, block.y);
			if (block?.event?.id === 'redPotion')
				core.setBlock('bluePotion', block.x, block.y);
			if (block?.event?.id === 'yellowKey' || block?.event?.id === 'redKey')
				core.setBlock('blueKey', block.x, block.y);
			if (block?.event?.id === 'yellowDoor' || block?.event?.id === 'redDoor')
				core.setBlock('blueDoor', block.x, block.y);
		}
	}
	core.S_myskill19 = function () { //太阳
		for (var index in core.status.thisMap.blocks) {
			var block = core.status.thisMap.blocks[index];
			if (block?.event?.id === 'blueGem')
				core.setBlock('redGem', block.x, block.y);
			if (block?.event?.id === 'bluePotion')
				core.setBlock('redPotion', block.x, block.y);
			if (block?.event?.id === 'yellowKey' || block?.event?.id === 'blueKey')
				core.setBlock('redKey', block.x, block.y);
			if (block?.event?.id === 'yellowDoor' || block?.event?.id === 'blueDoor')
				core.setBlock('redDoor', block.x, block.y);
		}
	}
},
    "极难": function () {
	// 在此增加新插件
	core.mysetmonskill = function () {
		core.material.enemys.bluePriest.special = 2; //初级珐师
		core.material.enemys.redPriest.special = 2; //高级珐师
		core.material.enemys.brownWizard.special = [2, 15]; //初级巫师
		core.material.enemys.redWizard.special = [2, 15]; //高级巫师
		core.material.enemys.blackKing.special = [2, 18]; //阻击高级巫师
		core.material.enemys.whiteKing.special = [2, 16]; //魔法警卫
		core.material.enemys.blackMagician.special = 2; //大法师
		core.material.enemys.swordEmperor.special = 2; //魔王1
		core.material.enemys.redKing.special = 2; //魔王2
		core.material.enemys.rock.special = 3; //石怪
		core.material.enemys.swordsman.special = 4; //双手剑士
		core.material.enemys.redBat.special = 11; //吸血蝙蝠
		core.material.enemys.vampire.special = 11; //吸血鬼
	}
	core.heros_die = function () {
		if (!core.isReplaying()) {
			core.mychangeHero();
			for (var i in flags.Allstatus) {
				if (flags.Allstatus[i].name === hero.name)
					flags.theHeroUI = Number(i);
			}
			hero.hp = 0;
			flags.Allstatus[flags.theHeroUI].hp = 0;
			core.mychangeHero_draw(); ///重绘页面
		} else {
			for (var i in flags.Allstatus) {
				if (flags.Allstatus[i].name === hero.name)
					flags.theHeroUI = Number(i);
			}
			hero.hp = 0;
			flags.Allstatus[flags.theHeroUI].hp = 0;

		}
	}
	core.fhbwdar = function (i) {
		core.addItem('superPotion', -1);
		flags.Allstatus[i].hp = 500;
		flags.Allstatus[i].x = hero.loc.x;
		flags.Allstatus[i].y = hero.loc.y;
		flags.Allstatus[i].f = core.status.floorId;
		//core.addPopMove(32 * core.status.hero.loc.x - 16, 32 * core.status.hero.loc.y - 16, 32 * core.status.hero.loc.x - 16, 32 * core.status.hero.loc.y - 16)
		if (flags.Allstatus[i].name == hero.name)
			hero.hp = 500;
		//if (!core.isReplaying())
		core.drawTip(flags.fhbwdar.name + '复活了');
		core.removeFlag('fhbwdar');
		core.status.route.push('fhbwdar:' + i)
		if (!core.isReplaying())
			core.myquickchange(i)
		/*var heroname = ['勇者', '盗贼', '商人', '贤者', '公主', '妖精']
		flags.fhbwdar = heroname[i];
		core.insertCommonEvent('复活吧我的爱人');*/
	}
},
    "自动拾取": function () {
	// 在此增加新插件
},
    "自动拾取2": function () {
	var enable = true;
	if (!enable) return;
	// 
	// var noUpdate = false;
	////// 更新状态栏 ////// 不建议状态栏刷新后触发 容易导致录像不一致的问题
	//control.prototype.updateStatusBar = function (doNotCheckAutoEvents) {
	//	if (!core.isPlaying()) return;
	//	if (noUpdate) return;
	//	noUpdate = true;
	//	core.autoGetItem();
	//	noUpdate = false;
	//	this.controldata.updateStatusBar();
	//	if (!doNotCheckAutoEvents) core.checkAutoEvents();
	//	this._updateStatusBar_setToolboxIcon();
	//	core.clearRouteFolding();
	//}

	////// 每移动一格后执行的事件 //////
	control.prototype.moveOneStep = function (callback) {
		//core.autoGetItem();
		return this.controldata.moveOneStep(callback);
	}

	function bfsFlood(sx, sy, blockfn) {
		var canMoveArray = core.generateMovableArray();
		var blocksObj = core.getMapBlocksObj();
		var bgMap = core.getBgMapArray();

		var visited = [],
			queue = [];
		visited[sx + "," + sy] = 0;
		queue.push(sx + "," + sy);

		while (queue.length > 0) {
			var now = queue.shift().split(","),
				x = ~~now[0],
				y = ~~now[1];
			for (var direction in core.utils.scan) {
				if (!core.inArray(canMoveArray[x][y], direction)) continue;
				var nx = x + core.utils.scan[direction].x,
					ny = y + core.utils.scan[direction].y,
					nindex = nx + "," + ny;
				if (visited[nindex]) continue;
				if (core.onSki(bgMap[ny][nx])) continue;
				if (blockfn && !blockfn(blocksObj, nx, ny)) continue;
				visited[nindex] = visited[now] + 1;
				queue.push(nindex);
			}
		}
	}

	function attractAnimate() {
		var name = 'attractAnimate';
		var isPlaying = false;
		this.nodes = [];

		this.add = function (id, x, y, callback) {
			this.nodes.push({ id: id, x: x, y: y, callback: callback });
		}
		this.start = function () {
			if (isPlaying) return;
			isPlaying = true;
			core.registerAnimationFrame(name, true, this.update);
			this.ctx = core.createCanvas(name, 0, 0, core.__PIXELS__, core.__PIXELS__, 120);
		}
		this.remove = function () {
			core.unregisterAnimationFrame(name);
			core.deleteCanvas(name);
			isPlaying = false;
		}
		this.clear = function () {
			this.nodes = [];
			this.remove();
		}
		var lastTime = -1;
		var self = this;
		this.update = function (timeStamp) {
			if (lastTime < 0) lastTime = timeStamp;
			if (timeStamp - lastTime < 20) return;
			lastTime = timeStamp;
			core.clearMap(name);
			var cx = core.status.heroCenter.px - 16 - 32,
				cy = core.status.heroCenter.py - 16 - 32;
			var thr = 5; //缓动比例倒数 越大移动越慢
			self.nodes.forEach(function (n) {
				var dx = cx - n.x,
					dy = cy - n.y;
				if (Math.abs(dx) <= thr && Math.abs(dy) <= thr) {
					n.dead = true;
				} else {
					n.x += ~~(dx / thr);
					n.y += ~~(dy / thr);
				}
				core.drawIcon(name, n.id, n.x, n.y, 32, 32);
			});
			self.nodes = self.nodes.filter(function (n) {
				if (n.dead && n.callback) {
					n.callback();
				}
				return !n.dead;
			});
			if (self.nodes.length == 0)
				self.remove();
		}
	}


	var animateHwnd = new attractAnimate();

	this.stopAttractAnimate = function () {
		animateHwnd.clear();
	}

	this.autoGetItem = function () {
		var canGetItems = {};
		if (!core.status.floorId || !core.status.checkBlock.damage || core.status.event.id == 'action' || core.status.lockControl) return;

		bfsFlood(core.getHeroLoc('x'), core.getHeroLoc('y'), function (blockMap, x, y) {
			var Equips = ['sword1', 'sword2', 'sword3', 'sword4', 'sword5', 'shield1', 'shield2', 'shield3', 'shield4', 'shield5'];
			var idx = x + ',' + y;
			if (idx in canGetItems) return false;
			var blk = blockMap[idx];
			var isItem = (blk && !blk.disable && !core.isMapBlockDisabled(core.status.floorId, blk.x, blk.y) && blk.event.cls == 'items' && blk.event.trigger == 'getItem' && !core.inArray(Equips, blk.event.id))
			var isEnemy = (blk && !blk.disable && !core.isMapBlockDisabled(core.status.floorId, blk.x, blk.y) && blk.event.cls == 'enemys' && blk.event.trigger == 'battle')
			var isDoor = (blk && !blk.disable && !core.isMapBlockDisabled(core.status.floorId, blk.x, blk.y) && blk.event.cls == 'animates' && (blk.event.trigger == 'openDoor' || blk.event.id == 'lava'))
			var floor = core.floors[core.status.floorId];
			var hasEvent =
				(isEnemy && has(floor.afterBattle[idx])) ||
				(isEnemy && has(floor.beforeBattle[idx])) ||
				(isEnemy && has(floor.events[idx])) ||
				(isItem && has(floor.afterGetItem[idx])) ||
				(isDoor && has(floor.afterOpenDoor[idx]));
			if (isEnemy) {
				var e_damage = core.getDamageInfo(core.getBlock(x, y).event.id, void 0, x, y)?.damage
				if (e_damage !== 0)
					isEnemy = false;
			}
			if (isDoor) {
				isDoor = false;
				if (core.inArray(flags.skill1, "撬锁精通I") && blk.event.id === 'yellowDoor')
					isDoor = true;
				if (core.inArray(flags.skill1, "撬锁精通II") && blk.event.id === 'blueDoor')
					isDoor = true;
				if (core.inArray(flags.skill1, "撬锁精通III") && blk.event.id === 'redDoor')
					isDoor = true;
				if (core.hasItem('snow') && blk.event.id === 'lava')
					isDoor = true;
			}
			//hasEvent = false
			//console.log(isItem)
			if (!hasEvent && (isItem || isEnemy || isDoor)) {
				canGetItems[idx] = { x: x, y: y, id: blk.event.id };
				return !core.status.checkBlock.damage[idx] && !core.status.checkBlock.ambush[idx];
			}
			return core.maps._canMoveDirectly_checkNextPoint(blockMap, x, y);
		});
		for (var k in canGetItems) {
			var x = canGetItems[k].x,
				y = canGetItems[k].y,
				id = canGetItems[k].id;
			if (core.getBlock(x, y).event.cls == 'enemys') {
				if (core.status.replay.speed <= 3)
					core.addPop(x * 32 - 32, y * 32 - 32, core.getBlock(x, y).event.id, 1);
				core.trigger(x, y);
			} else if (core.getBlock(x, y).event.cls == 'animates') {
				if (core.status.replay.speed <= 3)
					core.addPop(x * 32 - 32, y * 32 - 32, core.getBlock(x, y).event.id, 1);
				core.removeBlock(x, y);
			} else if (core.getBlock(x, y).event.cls == 'items') {
				if (core.status.replay.speed <= 3)
					core.addItemPop(x * 32 - 32, y * 32 - 32, core.getBlock(x, y).event.id, 1);
				core.trigger(x, y);
			}

			//animateHwnd.add(id, x * 32 - 32, y * 32 - 32);
		}
		//animateHwnd.start();
	}

	function has(v) {
		return v !== null && v !== undefined;
	}



	control.prototype._replayAction_moveDirectly = function (action) {
		if (action.indexOf("move:") != 0) return false;
		// 忽略连续的瞬移事件；如果大地图某一边超过计算范围则不合并
		// if (!core.hasFlag('poison') && core.status.thisMap.width < 2 * core.bigmap.extend + core.__SIZE__
		//     && core.status.thisMap.height < 2 * core.bigmap.extend + core.__SIZE__) {
		//     while (core.status.replay.toReplay.length>0 &&
		//         core.status.replay.toReplay[0].indexOf('move:')==0) {
		//             core.status.route.push(action);
		//             action = core.status.replay.toReplay.shift();
		//     }
		// }

		var pos = action.substring(5).split(":");
		var x = parseInt(pos[0]),
			y = parseInt(pos[1]);
		var nowx = core.getHeroLoc('x'),
			nowy = core.getHeroLoc('y');
		var ignoreSteps = core.canMoveDirectly(x, y);
		if (!core.moveDirectly(x, y, ignoreSteps)) return false;
		if (core.status.replay.speed == 24) {
			core.replay();
			return true;
		}

		core.ui.drawArrow('ui', 32 * nowx + 16 - core.bigmap.offsetX, 32 * nowy + 16 - core.bigmap.offsetY,
			32 * x + 16 - core.bigmap.offsetX, 32 * y + 16 - core.bigmap.offsetY, '#FF0000', 3);
		var timeout = this.__replay_getTimeout();
		if (ignoreSteps < 10) timeout = timeout * ignoreSteps / 10;
		setTimeout(function () {
			core.clearMap('ui');
			core.replay();
		}, timeout);
		return true;
	}
}
}