function items(){}items.prototype.init=function(){this.items={yellowKey:{cls:"keys",name:"黄钥匙"},blueKey:{cls:"keys",name:"蓝钥匙"},redKey:{cls:"keys",name:"红钥匙"},redJewel:{cls:"items",name:"红宝石"},blueJewel:{cls:"items",name:"蓝宝石"},greenJewel:{cls:"items",name:"绿宝石"},yellowJewel:{cls:"items",name:"黄宝石"},redPotion:{cls:"items",name:"红血瓶"},bluePotion:{cls:"items",name:"蓝血瓶"},yellowPotion:{cls:"items",name:"黄血瓶"},greenPotion:{cls:"items",name:"绿血瓶"},sword1:{cls:"items",name:"铁剑"},sword2:{cls:"items",name:"银剑"},sword3:{cls:"items",name:"骑士剑"},sword4:{cls:"items",name:"圣剑"},sword5:{cls:"items",name:"神圣剑"},shield1:{cls:"items",name:"铁盾"},shield2:{cls:"items",name:"银盾"},shield3:{cls:"items",name:"骑士盾"},shield4:{cls:"items",name:"圣盾"},shield5:{cls:"items",name:"神圣盾"},superPotion:{cls:"items",name:"圣水"},bigKey:{cls:"items",name:"钥匙盒"},greenKey:{cls:"tools",name:"绿钥匙",text:"可以打开一扇绿门"},steelKey:{cls:"tools",name:"铁门钥匙",text:"可以打开一扇铁门"},book:{cls:"constants",name:"怪物手册",text:"可以查看当前楼层各怪物属性。"},fly:{cls:"constants",name:"楼层传送器",text:"可以自由往来去过的楼层。"},coin:{cls:"constants",name:"幸运金币",text:"持有时打败怪物可得双倍金币"},snow:{cls:"constants",name:"冰冻徽章",text:"可以将面前的一块熔岩变成平地"},cross:{cls:"constants",name:"十字架",text:"持有后无视怪物的无敌属性"},pickaxe:{cls:"tools",name:"破墙镐",text:"可以破坏勇士四周的墙。"},icePickaxe:{cls:"tools",name:"破冰稿",text:"可以破坏勇士面前的一堵冰墙。"},bomb:{cls:"tools",name:"炸弹",text:"可以炸掉勇士四周的怪物。"},centerFly:{cls:"tools",name:"中心对称飞行器",text:"可以飞向当前楼层中心对称的位置。"},upFly:{cls:"tools",name:"上楼器",text:"可以飞往楼上的相同位置。"},downFly:{cls:"tools",name:"下楼器",text:"可以飞往楼下的相同位置。"},earthquake:{cls:"tools",name:"地震卷轴",text:"可以破坏当前层的所有墙"}}};items.prototype.getItems=function(a){if(a==undefined){return this.items}return this.items[itemsName]};main.instance.items=new items();items.prototype.useItem=function(b){if(!this.canUseItem(b)){return}var a=core.material.items[b].cls;if(a=="constants"){if(b=="book"){core.ui.drawEnemyBook(1)}if(b=="fly"){core.ui.drawFly(core.status.hero.flyRange.indexOf(core.status.floorId))}}if(a=="tools"){core.status.hero.items[a][b]--;if(b=="earthquake"||b=="bomb"||b=="pickaxe"){core.removeBlockByIds(core.status.floorId,core.status.event.data);core.drawMap(core.status.floorId,function(){core.drawHero(core.getHeroLoc("direction"),core.getHeroLoc("x"),core.getHeroLoc("y"),"stop");core.updateFg();core.drawTip(core.material.items[b].name+"使用成功");if(b=="bomb"&&core.flags.bombTrigger){core.events.afterBattle()}})}if(b=="centerFly"){core.clearMap("hero",0,0,416,416);core.setHeroLoc("x",core.status.event.data.x);core.setHeroLoc("y",core.status.event.data.y);core.drawHero(core.getHeroLoc("direction"),core.getHeroLoc("x"),core.getHeroLoc("y"),"stop");core.drawTip(core.material.items[b].name+"使用成功")}if(b=="upFly"||b=="downFly"){core.changeFloor(core.status.event.data.id,null,{direction:core.status.hero.loc.direction,x:core.status.event.data.x,y:core.status.event.data.y},function(){core.drawTip(core.material.items[b].name+"使用成功")})}if(core.status.hero.items[a][b]==0){delete core.status.hero.items[a][b]}}};items.prototype.canUseItem=function(k){if(!core.hasItem(k)){return false}var e=core.material.items[k].cls;if(k=="book"){return true}if(k=="fly"){return core.status.hero.flyRange.indexOf(core.status.floorId)>=0}if(k=="pickaxe"){var b=[];for(var h in core.status.thisMap.blocks){var g=core.status.thisMap.blocks[h];if(core.isset(g.event)&&g.event.id=="yellowWall"){if(core.flags.picaxeFourDirections){if(Math.abs(g.x-core.status.hero.loc.x)+Math.abs(g.y-core.status.hero.loc.y)<=1){b.push(h)}}else{var o={up:{x:0,y:-1},left:{x:-1,y:0},down:{x:0,y:1},right:{x:1,y:0}};if(g.x==core.status.hero.loc.x+o[core.status.hero.loc.direction].x&&g.y==core.status.hero.loc.y+o[core.status.hero.loc.direction].y){b.push(h)}}}}if(b.length>0){core.status.event.data=b;return true}return false}if(k=="bomb"){var b=[];for(var h in core.status.thisMap.blocks){var g=core.status.thisMap.blocks[h];if(core.isset(g.event)&&g.event.cls=="enemys"&&Math.abs(g.x-core.status.hero.loc.x)+Math.abs(g.y-core.status.hero.loc.y)<=1){var f=core.material.enemys[g.event.id];if(core.isset(f.bomb)&&!f.bomb){continue}b.push(h)}}if(b.length>0){core.status.event.data=b;return true}return false}if(k=="earthquake"){var b=[];for(var h in core.status.thisMap.blocks){var g=core.status.thisMap.blocks[h];if(core.isset(g.event)&&(g.event.id=="yellowWall"||g.event.id=="blueWall"||g.event.id=="whiteWall")){b.push(h)}}if(b.length>0){core.status.event.data=b;return true}return false}if(k=="centerFly"){var l=12-core.getHeroLoc("x"),j=12-core.getHeroLoc("y");var a=core.status.thisMap.blocks;for(var n=0;n