1 |
- __manifest={launch:"js/demoncastle",title:"魔兽城堡",sizes:[[320,480]],description:"恶魔入侵,赶快拿起宝剑杀敌!抵抗恶魔,保护城堡!",shortName:"魔兽城堡",orientation:"portrait",favicon:"media/images/favicon.ico",icons:{114:"media/images/icons/114.png"},version:"1.6.1"};__intl={LOADING:"加载中",HIGH_SCORE:"最高分:",PLAY:"开始游戏",READY:"准备",NEW_HIGH_SCORE:"新的最高纪录!",PAUSED:"游戏暂停",YOUR_SCORE:"你的分数:",PLAY_SOUND:"打开声音",QUIT:"退出游戏",CONTINUE:"继续游戏",GAME_OVER:"游戏结束",MONSTERS_SLAIN:"消灭怪物:",PLAY_AGAIN:"再玩一次"};var requirejs,require,define;(function(e){function t(e,t){var n=t&&t.split("/"),r=l.map,i=r&&r["*"]||{},s,o,u,a,f,c;if(e&&"."===e.charAt(0)&&t){n=n.slice(0,n.length-1);e=n.concat(e.split("/"));for(f=0;s=e[f];f++)if("."===s)e.splice(f,1),f-=1;else if(".."===s){if(1===f&&(".."===e[2]||".."===e[0]))return!0;0<f&&(e.splice(f-1,2),f-=2)}e=e.join("/")}if((n||i)&&r)for(s=e.split("/"),f=s.length;0<f;f-=1){o=s.slice(0,f).join("/");if(n)for(c=n.length;0<c;c-=1)if(u=r[n.slice(0,c).join("/")])if(u=u[o]){a=u;break}if(a=a||i[o]){s.splice(0,f,a);e=s.join("/");break}}return e}function n(t,n){return function(){return d.apply(e,h.call(arguments,0).concat([t,n]))}}function r(e){return function(n){return t(n,e)}}function i(e){return function(t){a[e]=t}}function s(t){if(f.hasOwnProperty(t)){var n=f[t];delete f[t];c[t]=!0;p.apply(e,n)}if(!a.hasOwnProperty(t))throw Error("No "+t);return a[t]}function o(e,n){var i,o,u=e.indexOf("!");return-1!==u?(i=t(e.slice(0,u),n),e=e.slice(u+1),o=s(i),o&&o.normalize?e=o.normalize(e,r(n)):e=t(e,n)):e=t(e,n),{f:i?i+"!"+e:e,n:e,p:o}}function u(e){return function(){return l&&l.config&&l.config[e]||{}}}var a={},f={},l={},c={},h=[].slice,p,d;p=function(t,r,l,h){var p=[],d,v,m,g,y;h=h||t;if("function"==typeof l){r=!r.length&&l.length?["require","exports","module"]:r;for(y=0;y<r.length;y++)if(g=o(r[y],h),m=g.f,"require"===m)p[y]=n(t);else if("exports"===m)p[y]=a[t]={},d=!0;else if("module"===m)v=p[y]={id:t,uri:"",exports:a[t],config:u(t)};else if(a.hasOwnProperty(m)||f.hasOwnProperty(m))p[y]=s(m);else if(g.p)g.p.load(g.n,n(h,!0),i(m),{}),p[y]=a[m];else if(!c[m])throw Error(t+" missing "+m);r=l.apply(a[t],p);t&&(v&&v.exports!==e&&v.exports!==a[t]?a[t]=v.exports:r===e&&d||(a[t]=r))}else t&&(a[t]=l)};requirejs=require=d=function(t,n,r,i){return"string"==typeof t?s(o(t,n).f):(t.splice||(l=t,n.splice?(t=n,n=r,r=null):t=e),n=n||function(){},i?p(e,t,n,r):setTimeout(function(){p(e,t,n,r)},15),d)};d.config=function(e){return l=e,d};define=function(e,t,n){t.splice||(n=t,t=[]);f[e]=[e,t,n]};define.amd={jQuery:!0}})();define("../djinn/lib/almond",function(){});var djinn={version:"2.6.4"},bind=function(e,t){return"string"==typeof t&&(t=e[t]),function(){t.apply(e,arguments)}},clone=function(e){return JSON.parse(JSON.stringify(e))},merge=function(){for(var e={},t=arguments.length-1;0<=t;--t){var n=arguments[t];if("object"==typeof n)for(var r in n)n[r]&&e[r]&&"function"!=typeof n[r].concat&&"object"==typeof n[r]&&"object"==typeof e[r]?e[r]=arguments.callee(n[r],e[r]):e[r]=n[r]}return e},sprintf=function(e){for(var t=1,n=arguments.length;t<n;++t)e=e.replace(/%s/,arguments[t]);return e};if("undefined"==typeof requestAnimationFrame)var requestAnimationFrame=window.mozRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame||window.webkitRequestAnimationFrame||function(e){setTimeout(function(){e(Date.now())},17)};var logger="undefined"!=typeof console?console:{error:function(){},info:function(){},log:function(){},warn:function(){}};"function"!=typeof logger.info&&(logger.info=logger.log);define("djinn/global",function(){});define("djinn/Class",[],function(){var e=!1,t=/\b_super\b/,n=function(){};return n.extend=function(n){var r=this.prototype;e=!0;var i=new this;e=!1;for(var s in n)i[s]="function"==typeof n[s]&&"function"==typeof r[s]&&t.test(n[s])?function(e,t){return function(){var n=this._super;this._super=r[e];var i=t.apply(this,arguments);return this._super=n,i}}(s,n[s]):n[s];s=function(){!e&&this.init&&this.init.apply(this,arguments)};return s.prototype=i,s.prototype.constructor=s,s.extend=arguments.callee,s},n});define("djinn/Emitter",["djinn/Class"],function(e){return e.extend({init:function(e){this._listenerKey=0;this._listeners={}},fire:function(e,t){for(var n in this._listeners){var r=this._listeners[n];if(r.eventName==e)if(r.method)r.method.apply(r.context,t);else if(r.methodName){var i=r.context[r.methodName];if("function"!=typeof i)throw"Could not find method: "+r.methodName;i.apply(r.context,t)}}},on:function(e){var t={eventName:e};if(2==arguments.length)t.method=arguments[1];else{t.context=arguments[1];var n=arguments[2];"string"==typeof n?t.methodName=n:t.method=n}return this._listeners[++this._listenerKey]=t,this},off:function(e){var t=null,n;for(n in this._listeners){var r=this._listeners[n];if(r.eventName==e)if(2==arguments.length){if(r.method==arguments[1]){t=n;break}}else if(arguments[1]==r.context){var i=arguments[2];if("string"==typeof i){if(i==r.methodName){t=n;break}}else if(r.method=i,i==r.method){t=n;break}}}return null!==t&&delete this._listeners[t],this},remove:function(){this._listeners=null}})});define("djinn/math/core",{twoPi:2*Math.PI,random:function(e,t){return e instanceof Array?arguments.callee(0,e.length-1):Math.round(Math.random()*(t-e))+e},clamp:function(e,t,n){return Math.min(Math.max(e,t),n)},intersects:function(e,t){return e.x<t.x+t.width&&t.x<e.x+e.width&&e.y<t.y+t.height&&t.y<e.y+e.height},pointInRect:function(e,t){return e.x>t.x&&e.y>t.y&&e.x<t.x+t.width&&e.y<t.y+t.height},round:function(e,t){var n=Math.pow(10,t);return Math.round(e*n)/n}});define("djinn/utils/transitions",[],function(){var e={linear:function(e,t,n,r){return n*e/r+t},easeIn:function(e,t,n,r){return n*(e/=r)*e+t},easeOut:function(e,t,n,r){return-n*(e/=r)*(e-2)+t},easeBoth:function(e,t,n,r){return 1>(e/=r/2)?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t},inStrong:function(e,t,n,r){return n*(e/=r)*e*e*e+t},outStrong:function(e,t,n,r){return-n*((e=e/r-1)*e*e*e-1)+t},bothStrong:function(e,t,n,r){return 1>(e/=r/2)?n/2*e*e*e*e+t:-n/2*((e-=2)*e*e*e-2)+t},elasticIn:function(e,t,n,r,i,s){if(0==e)return t;if(1==(e/=r))return t+n;s||(s=.3*r);!i||i<Math.abs(n)?(i=n,n=s/4):n=s/(2*Math.PI)*Math.asin(n/i);return-(i*Math.pow(2,10*(e-=1))*Math.sin(2*(e*r-n)*Math.PI/s))+t},elasticOut:function(e,t,n,r,i,s){if(0==e)return t;if(1==(e/=r))return t+n;s||(s=.3*r);if(!i||i<Math.abs(n)){i=n;var o=s/4}else o=s/(2*Math.PI)*Math.asin(n/i);return i*Math.pow(2,-10*e)*Math.sin(2*(e*r-o)*Math.PI/s)+n+t},elasticBoth:function(e,t,n,r,i,s){if(0==e)return t;if(2==(e/=r/2))return t+n;s||(s=.3*r*1.5);if(!i||i<Math.abs(n)){i=n;var o=s/4}else o=s/(2*Math.PI)*Math.asin(n/i);return 1>e?-.5*i*Math.pow(2,10*(e-=1))*Math.sin(2*(e*r-o)*Math.PI/s)+t:i*Math.pow(2,-10*(e-=1))*Math.sin(2*(e*r-o)*Math.PI/s)*.5+n+t},backIn:function(e,t,n,r,i){return void 0===i&&(i=1.70158),n*(e/=r)*e*((i+1)*e-i)+t},backOut:function(e,t,n,r,i){return void 0===i&&(i=1.70158),n*((e=e/r-1)*e*((i+1)*e+i)+1)+t},backBoth:function(e,t,n,r,i){return void 0===i&&(i=1.70158),1>(e/=r/2)?n/2*e*e*(((i*=1.525)+1)*e-i)+t:n/2*((e-=2)*e*(((i*=1.525)+1)*e+i)+2)+t},bounceIn:function(t,n,r,i){return r-e.bounceOut(i-t,0,r,i)+n},bounceOut:function(e,t,n,r){return(e/=r)<1/2.75?7.5625*n*e*e+t:e<2/2.75?n*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?n*(7.5625*(e-=2.25/2.75)*e+.9375)+t:n*(7.5625*(e-=2.625/2.75)*e+.984375)+t},bounceBoth:function(t,n,r,i){return t<i/2?.5*e.bounceIn(2*t,0,r,i)+n:.5*e.bounceOut(2*t-i,0,r,i)+.5*r+n}};return e});define("djinn/utils/viewEffects",["djinn/math/core","djinn/utils/transitions"],function(e,t){return{alert:function(e,n,r){n=n||{};var i=e.z;e.z=Infinity;e.tween({scale:n.scale||1.5},(n.duration||500)/2,t.easeBoth,function(){n.midCallback&&n.midCallback()}).tween({scale:1},(n.duration||500)/2,t.easeBoth,function(){e.z=i;r&&r()})},burst:function(e,n,r){e.opacity=0;e.scale=.5;e.tween({opacity:1,rotation:Math.PI/2,scale:1.5},100,t.linear).tween({opacity:0},100,t.linear,function(){r&&r()})},buttonPress:function(e,n,r){e.tween({y:e.y+e.height/10},50,t.linear).tween({y:e.y},50,t.linear,r)},fadeOut:function(e,n,r){n=n||{};e.tween({opacity:0},n.duration||1e3,t.linear,r)},fadeIn:function(e,n,r){n=n||{};e.tween({opacity:1},n.duration||1e3,t.linear,r)},popIn:function(n,r,i){r=r||{};var s=1==e.random(1,2)?2:-2,s=e.clamp(n.x+n.width*s,0,n.parent.width-n.width),o=n.y;n.opacity=r.opacity||0;n.scale=r.scale||.5;n.y+=n.height/2;n.tween({opacity:1,scale:1,x:s,y:o},200,t.linear).tween({scale:1.25},50,t.linear).tween({scale:1},50,t.linear,i)},popOut:function(e,n,r){e.opacity=1;e.tween({scale:.75},50,t.linear).tween({opacity:0,scale:2},250,t.linear,r)},shake:function(e,t,n){e.completeTween();t=t||{};var r=t.iterations||10,i=(t.duration||250)/r;t=t.violence||6;for(var s=e.x,o=e.y,u=0;u<r;++u)e.tween({x:e.x+t*(u%2?1:-1)},i);e.delayTween(0,function(){e.x=s;e.y=o;n&&n()})},vibrate:function(t,n,r){t.completeTween();n=n||{};var i=n.iterations||10,s=(n.duration||250)/i;n=n.violence||6;for(var o=t.x,u=t.y,a=0;a<i;++a)t.tween({x:t.x+e.random(-n,n),y:t.y+e.random(-n,n)},s);t.delayTween(0,function(){t.x=o;t.y=u;r&&r()})}}});define("djinn/manifest",[],function(){return __manifest});define("djinn/globalTimer",["djinn/Emitter"],function(e){return new(e.extend({init:function(e){this._super(e);this.running=!1;this._lastUpdate=this.fps=0;this._tickHistory=[]},start:function(){this.running=!0;this._lastUpdate=Date.now();this._requestFrame()},stop:function(){this.running=!1},_requestFrame:function(){this.running&&requestAnimationFrame(bind(this,"_update"))},_update:function(e){var t=e-this._lastUpdate;1e3<t&&(logger.warn("Dropping large tick: "+t),t=1);this._recordTick(t);this.fire("tick",[t]);this._lastUpdate=e;this._requestFrame()},_recordTick:function(e){e=this._tickHistory.push(e);if(50<e){for(var t=0,n=0;n<e;++n)t+=this._tickHistory[n];this.fps=~~(1e3/(t/e));this._tickHistory=[]}}}))});define("djinn/Timer",["djinn/Emitter","djinn/globalTimer"],function(e,t){return e.extend({init:function(e){this._super();this._loops=this._elapsed=0;this._running=!1;this._tickHost=t;"number"==typeof e?this.interval=e:"object"==typeof e?(this.interval=Number(e.interval||1e3),this._tickHost=e.tickHost||this._tickHost):this.interval=1e3;Object.defineProperty(this,"elapsed",{get:function(){return this._elapsed}});Object.defineProperty(this,"percentComplete",{get:function(){return this._elapsed/this.interval*100}});Object.defineProperty(this,"running",{get:function(){return this._running},set:function(e){e?this.start():this.stop()}})},reset:function(){return this.start()},start:function(e){return void 0!==e&&(this.interval=e),this._elapsed=0,this._running||(this._tickHost.on("tick",this,"_update"),this._running=!0),this},stop:function(){return this._running&&(this._tickHost.off("tick",this,"_update"),this._running=!1),this},_update:function(e){this._elapsed+=e;this._elapsed>=this.interval&&(this._elapsed=0,++this._loops,this.fire("elapsed",[this._loops]))}})});define("djinn/XHR",[],function(){return function(e,t,n,r){n=n||{};var i="",s=new XMLHttpRequest;s.open(e,t,!0);if("POST"==e.toUpperCase()){for(var o in r)if("object"==typeof r[o]&&r[o].length)for(e=0,t=r[o].length;e<t;++e)i+=sprintf("%s[]=%s&",o,encodeURIComponent(r[o][e]));else i+=sprintf("%s=%s&",o,encodeURIComponent(r[o]));s.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8")}else s.setRequestHeader("Content-Type","application/x-javascript");s.onreadystatechange=function(){4==s.readyState&&(n.complete&&n.complete(s),200==s.status?n.success&&n.success(s.responseText):n.error&&n.error(s.status))};s.send(i||null)}});define("djinn/client",["djinn/Emitter","djinn/manifest"],function(e,t){return new(e.extend({init:function(e){this._super(e);e=navigator.userAgent;this.pixelRatio=window.devicePixelRatio||1;this.isBrowser=document&&"function"==typeof document.getElementsByTagName;this.isTouch="undefined"!=typeof window.ontouchstart||!this.isBrowser;this.isIPhone=/iPhone OS/.test(e);this.isIPad=/iPad/.test(e);this.isIOS=this.isIPhone||this.isIPad;this.isAndroid=/Android/.test(e);this.isFullScreen=!0===window.navigator.standalone;Object.defineProperty(this,"orientation",{get:function(){switch(window.orientation){case 0:return"portrait";case-90:case 90:return"landscape";default:return"both"==t.orientation?this.width>this.height?"landscape":"portrait":t.orientation}}});this._cacheDimensions();this._updateSize();if(this.isTouch){e=bind(this,function(e){this._hideAddressBar()});for(var n=["touchstart","touchmove","touchend"],r=0,i=n.length;r<i;++r)addEventListener(n[r],e,!1)}addEventListener("load",bind(this,"_load"),!1);addEventListener("resize",bind(this,"_resize"),!1);addEventListener("orientationchange",bind(this,"_resize"),!1);setInterval(bind(this,"_resize"),2e3)},_load:function(){this._hideAddressBar()},_cacheDimensions:function(){this._dimensions={orientation:window.orientation,width:window.innerWidth,height:window.innerHeight}},_haveDimensionsChanged:function(){var e=this._dimensions;return e.orientation!=window.orientation||e.width!=window.innerWidth||e.height!=window.innerHeight},_updateSize:function(){this.isTouch&&(this.isAndroid||this.isIPhone)?(this.width=window.innerWidth,this.isAndroid?(document.body.style.height=window.innerHeight+"px",this.height=window.innerHeight,document.body.style.height=this.height+"px"):this.isIPhone&&("portrait"==this.orientation?this.height=window.screen.height:this.height=window.screen.width,this.height-=20,this.isFullScreen||(this.height-="portrait"==this.orientation?44:32))):(this.width=window.innerWidth,this.height=window.innerHeight);logger.info("[client._updateSize] "+this.width+"x"+this.height)},_hideAddressBar:function(){this.isTouch&&setTimeout(function(){window.scrollTo(0,1)},1)},_resize:function(){this._haveDimensionsChanged()&&(logger.info(["_resize",this.orientation,window.innerWidth+"x"+window.innerHeight].join(", ")),this._cacheDimensions(),this._updateSize(),this._hideAddressBar(),this.fire("orientationChange"))}}))});define("djinn/assets",["djinn/client","djinn/XHR","djinn/manifest"],function(e,t,n){var r={},i={image:["png","jpg","jpeg","gif"],audio:["mp3","ogg"],font:["ttf"],json:["json"]},s={image:function(t,r,i){var s=new Image;s.onload=function(){s.ready=!0;r&&r(t,s)};s.onerror=function(){i&&i(t,s)};e.isBrowser&&"data:"!=t.substring(0,5)&&(t=t+"?v="+n.version);return s.src=t,s},audio:function(t,n){var r=new Audio;return r.canPlayType("audio/mpeg")?(e.isBrowser?(r.addEventListener("canplay",function(){r.ready=!0;n&&n(t,r)},!1),r.src=t):(r.src=t,r.load(),r.ready=!0,n&&n(t,r)),r):(logger.warn("No mp3 support: "+t),n&&n(t,null),null)},font:function(e,t){var n=/^.*\/([^\.]+)\.ttf$/.exec(e)[1],n=sprintf("@font-face { font-family: '%s'; src: url('%s'); }",n,e),r=document.createElement("style");return r&&(r.innerHTML=n,document.body.appendChild(r)),t&&t(e,null),null},data:function(e,n){return t("GET",e,{complete:function(t){n&&n(e,t.responseText)}}),""},json:function(e,t){return s.data(e,function(e,n){var r=JSON.parse(n);t&&t(e,r)}),{}}},o={};return o.cacheImage=function(e,t){r[e]=s.image(t)},o.load=function(e,t,n){if(e){"string"==typeof e&&(e=[e]);for(var i=e.length,u=0,a=function(e,s){r[e]=s;++u;var o=u/i;n&&n(e,s,u,i,o);u>=i&&t&&t()},f=function(e,t){logger.error("Failed to load asset: "+e);a(e,t)},l=0,c=e.length;l<c;++l){var h=e[l];if("string"!=typeof h||0>=h.length)logger.info("[assets.load] Skipping empty asset path"),--i;var p=o.inferAssetType(h);r[h]=(0,s[p])(h,a,f)}}},o.unload=function(e){"string"==typeof e&&(e=[e]);for(var t=0,n=e.length;t<n;++t)delete r[e[t]]},o.get=function(e){return"undefined"==typeof r[e]&&(logger.warn("On-the-fly asset load: "+e),o.load(e)),r[e]},o.inferAssetType=function(e){e=(e=e.match(/\.(.+)/))?e[1].toLowerCase():"";for(var t in i)if(-1!=i[t].indexOf(e))return t;return"data"},o});define("djinn/stage",["djinn/Emitter","djinn/client","djinn/math/core","djinn/manifest"],function(e,t,n,r){var i=null,s=null,o=1,u=[],a=!1,f=["touchstart","touchmove","touchend"],l=["mousedown","mousemove","mouseup"];return new(e.extend({init:function(e){this._super(e);this.eraseBeforeRender=!1;this._maxScale=Infinity;Object.defineProperty(this,"canFullScreen",{get:function(){return"function"==typeof document.webkitCancelFullScreen}});Object.defineProperty(this,"isFullScreen",{get:function(){return document.webkitIsFullScreen}});Object.defineProperty(this,"maxScale",{get:function(){return this._maxScale},set:function(e){this._maxScale=e;this._autoSize()}});Object.defineProperty(this,"width",{get:function(){return i.width}});Object.defineProperty(this,"height",{get:function(){return i.height}});i=document.createElement("canvas");i.width=t.width;i.height=t.height;i.style.position="absolute";i.style.left=0;i.style.top=0;this._initInput();e=document.body;t.isBrowser&&(e=document.getElementById(r.gameContainer)||e);e.appendChild(i);t._hideAddressBar();s=i.getContext("2d");t.on("orientationChange",this,"_autoSize")},matchSize:function(e){if(e&&0!==e.length){for(var n=null,r=Infinity,s=0,o=e.length;s<o;++s){var u=Math.min(e[s][0],e[s][1]),a=Math.max(e[s][0],e[s][1]),f=Math.min(t.width,t.height),l=Math.max(t.width,t.height),f=Math.abs(u*a-f*l);f<r&&(n=[u,a],r=f)}i.width=n[0];i.height=n[1];this._autoSize()}else logger.warn("[stage] sizes needs to be set in manifest",e)},localizePoint:function(e,t){return{x:Math.round(1/o*(e-i.offsetLeft)),y:Math.round(1/o*(t-i.offsetTop))}},renderView:function(e){this.eraseBeforeRender&&s.clearRect(0,0,i.width,i.height);e.preRender(s)},createBuffer:function(e,t){var n=document.createElement("canvas");return n.width=Number(e),n.height=Number(t),n.style.display="none",n},getInputEvents:function(){var e=u;return u=[],e},requestFullScreen:function(){document.body.webkitRequestFullScreen()},cancelFullScreen:function(){document.webkitCancelFullScreen()},_getEventType:function(e){switch(e.type){case"touchstart":case"mousedown":return"inputStart";case"touchmove":case"mousemove":return"inputMove";case"touchend":case"mouseup":return"inputEnd"}},_handleInputEvent:function(e){var n=-1,r=0,i=0;t.isTouch?(i="touchend"===e.type?e.changedTouches[0]:e.touches[0],n=i.identifier,r=i.pageX,i=i.pageY):(r=e.pageX,i=e.pageY);e={id:n,type:this._getEventType(e),point:this.localizePoint(r,i)};u.push(e);this.fire(e.type,[e]);!a&&this.fire("initialInput");a=!0},_initInput:function(){for(var e=t.isTouch?f:l,n=0,r=e.length;n<r;++n)i.addEventListener(e[n],bind(this,"_handleInputEvent"),!1)},_autoSize:function(){var e=Math.min(i.width,i.height),r=Math.max(i.width,i.height);i.width="portrait"==t.orientation?e:r;i.height="portrait"==t.orientation?r:e;o=Math.min(t.width/i.width,t.height/i.height);o=n.clamp(o,0,this.maxScale);logger.info(sprintf("[stage._autoSize] %sx%s (%s)",i.width,i.height,o));t.isIOS?(logger.info("Using 3D scaling"),e="scale3d("+o+", "+o+", 1)"):e="scale("+o+")";i.style.webkitTransformOrigin="0 0";i.style.webkitTransform=e;i.style.MozTransformOrigin="0 0";i.style.MozTransform=e;i.style.msTransformOrigin="0 0";i.style.msTransform=e;i.style.left=t.width/2-i.width*o/2+"px";i.style.top=t.height/2-i.height*o/2+"px";this.fire("resize")}}))});define("djinn/View","djinn/Emitter djinn/utils/transitions djinn/assets djinn/math/core djinn/Timer djinn/stage".split(" "),function(e,t,n,r,i,s){var o=0,u=e.extend({_initGetSet:function(){Object.defineProperty(this,"right",{get:function(){return this.x+this.width},set:function(e){this.x=e-this.width}});Object.defineProperty(this,"bottom",{get:function(){return this.y+this.height},set:function(e){this.y=e-this.height}});Object.defineProperty(this,"z",{get:function(){return this._z},set:function(e){this._z=e;this.parent&&(this.parent.needsResort=!0)}});Object.defineProperty(this,"image",{set:function(e){this._image=n.get(e)}});Object.defineProperty(this,"center",{get:function(){return{x:this.x+this.width/2,y:this.y+this.height/2}}});Object.defineProperty(this,"boundingBox",{get:function(){var e=this._boundingBox;return null==e?{x:this.x,y:this.y,width:this.width,height:this.height}:{x:this.x+e.x,y:this.y+e.y,width:e.width,height:e.height}},set:function(e){this._boundingBox=e}});Object.defineProperty(this,"compositeOpacity",{get:function(){return this.opacity*(this.parent?this.parent.compositeOpacity:1)}});Object.defineProperty(this,"layouts",{set:function(e){this._layouts=e;this._initLayouts()}});Object.defineProperty(this,"canReact",{get:function(){return this.acceptInputEvents&&this.visible&&!this.paused}});Object.defineProperty(this,"absolutePosition",{get:function(){for(var e=this.x,t=this.y,n=this;n.parent instanceof u;)n=n.parent,e+=n.x,t+=n.y;return{x:e,y:t}}})},init:function(e){this._initGetSet();var t=++o;e=merge(e,{parent:null,id:t,tag:"View_"+t,x:0,y:0,z:1,anchorX:null,anchorY:null,boundingBox:null,acceptInputEvents:!1,captureInputEvents:!0,cancelInputEvents:!1,debug:!1,layouts:null,rotation:0,clip:!1,width:0,height:0,scale:1,visible:!0,opacity:1,backgroundColor:null,image:null,imageX:0,imageY:0,paused:!1,tickSpeed:1,flipHorizontal:!1,flipVertical:!1});e.parent&&(e.width=e.width||e.parent.width,e.height=e.height||e.parent.height);this._super(e);this.id=e.id;this.tag=e.tag;this.x=Number(e.x);this.y=Number(e.y);this._z=Number(e.z);this.anchorX=Number(e.anchorX||e.width/2);this.anchorY=Number(e.anchorY||e.height/2);this.rotation=Number(e.rotation);this.boundingBox=e.boundingBox;this.width=Number(e.width);this.height=Number(e.height);this.scale=Number(e.scale);this.visible=Boolean(e.visible);this.opacity=Number(e.opacity);this.clip=Boolean(e.clip);this.backgroundColor=e.backgroundColor;this._image=null;this.imageX=Number(e.imageX);this.imageY=Number(e.imageY);this.flipHorizontal=e.flipHorizontal;this.flipVertical=e.flipVertical;this.acceptInputEvents=Boolean(e.acceptInputEvents);this.captureInputEvents=Boolean(e.captureInputEvents);this.cancelInputEvents=Boolean(e.cancelInputEvents);this.paused=Boolean(e.paused);this.tickSpeed=Number(e.tickSpeed);this.debug=Boolean(e.debug);this.children=[];this._removedChildren=[];this.needsReflow=this.needsResort=!1;this.layouts=e.layouts;this._tweenQueue=[];e.image&&(this.image=e.image);e.parent&&e.parent.addChild(this)},set:function(e){for(var t in e)this[t]=e[t]},addChild:function(e){e.parent&&e.removeFromParent();e.parent=this;this.children.push(e);this.sortChildren()},removeChild:function(e){e.parent==this&&-1==this._removedChildren.indexOf(e)&&(e.parent=null,this._removedChildren.push(e))},getChildByTag:function(e){for(var t=0,n=this.children.length;t<n;++t){var r=this.children[t];if(r.tag==e)return r}return null},removeFromParent:function(){this.parent&&this.parent.removeChild(this);this.fire("removedFromParent",[this])},sortChildren:function(){this.children.sort(function(e,t){return e.z==t.z?e.id-t.id:e.z-t.z})},reflow:function(){this.debug&&logger.info(this.tag+": Reflow");var e=this._getCurrentLayout();null!=e&&this.applyLayout(e);for(var e=0,t=this.children.length;e<t;++e)this.children[e].reflow()},applyLayout:function(e){this.set(e.conf);e.align&&this.align.apply(this,e.align);for(var t=0,n=this.children.length;t<n;++t){var r=this.children[t];e.children&&e.children[r.tag]&&r.applyLayout(e.children[r.tag])}},show:function(){this.visible=!0},hide:function(){this.visible=!1},toggle:function(){this.visible=!this.visible},intersects:function(e){return e instanceof u?r.intersects(e.boundingBox,this.boundingBox):e.width?r.intersects(e,this.boundingBox):r.pointInRect(e,this.boundingBox)},createBoundTimer:function(e,t){var n=new i({interval:e,tickHost:this});return n.on("elapsed",this,t),n},react:function(e){if(this.canReact){if(this.captureInputEvents){for(var t={x:e.point.x-this.x,y:e.point.y-this.y},n=this.children.length-1;0<=n;--n){var r=this.children[n];if(r.canReact&&r.intersects(t)&&(e.point.x=t.x,e.point.y=t.y,r.react(e),!0===e.cancel))return}e.target||(e.target=this);e.point.x=t.x;e.point.y=t.y;this.fire(e.type,[e]);"inputStart"===e.type?this._inputStartID=e.id:"inputEnd"===e.type&&this._inputStartID===e.id&&(this.fire("inputPress",[e]),delete this._inputStartID)}this.cancelInputEvents&&(e.cancel=!0)}},preTick:function(e){if(!this.paused&&this.visible){e*=this.tickSpeed;for(var t=0,n=this._removedChildren.length;t<n;++t){var r=this._removedChildren[t],i=this.children.indexOf(r);-1!=i?this.children.splice(i,1):logger.warn("Tried to remove non-child "+r.tag+" from "+this.tag)}this._removedChildren.splice(0,n);this.needsResort&&(this.sortChildren(),this.needsResort=!1);this.needsReflow&&(this.debug&&logger.info(this.tag+": Needs reflow"),this.reflow(),this.needsReflow=!1);this._updateTween(e);this.tick&&this.tick(e);this.fire("tick",[e]);t=0;for(n=this.children.length;t<n;++t)r=this.children[t],-1===this._removedChildren.indexOf(r)&&r.preTick(e)}},preRender:function(e){if(this.visible&&!(0>=this.opacity)){var t=~~this.x,n=~~this.y;e.save();e.translate(t+this.anchorX,n+this.anchorY);e.globalAlpha=this.compositeOpacity;0!=this.rotation&&e.rotate(this.rotation);1!=this.scale&&e.scale(this.scale,this.scale);(this.flipHorizontal||this.flipVertical)&&e.scale(this.flipHorizontal?-1:1,this.flipVertical?-1:1);e.translate(-this.anchorX,-this.anchorY);this.clip&&(e.beginPath(),e.rect(0,0,this.width,this.height),e.clip());this.render&&0<this.width&&0<this.height&&(this.render(e),this.debug&&this._renderDebug(e));t=0;for(n=this.children.length;t<n;++t){var r=this.children[t];-1===this._removedChildren.indexOf(r)&&r.preRender(e)}e.restore()}},render:function(e){this._image&&this._image.ready?e.drawImage(this._image,this.imageX,this.imageY,this.width,this.height,0,0,this.width,this.height):this.backgroundColor&&(e.fillStyle=this.backgroundColor,e.fillRect(0,0,this.width,this.height))},align:function(e,t,n,r){if(this.parent){if(void 0!==e&&null!==e){switch(e){case"left":this.x=0;break;case"right":this.right=this.parent.width;break;case"center":this.x=this.parent.width/2-this.width/2}this.x+=n||0}if(void 0!==t&&null!==t){switch(t){case"top":this.y=0;break;case"bottom":this.y=this.parent.height-this.height;break;case"center":this.y=this.parent.height/2-this.height/2}this.y+=r||0}return this}},centerOn:function(e,t,n){e.width=e.width||1;e.height=e.height||1;var r=e.y+e.height/2;return this.x=e.x+e.width/2-this.width/2+(t||0),this.y=r-this.height/2+(n||0),this},centerAnchor:function(){return this.anchorX=this.width/2,this.anchorY=this.height/2,this},tween:function(e,n,r,i){if(null!=e)for(var s in e){var o=e[s];"object"!=typeof o&&(e[s]={from:null,to:o})}return this._tweenQueue.push({properties:e,duration:isNaN(n)?1e3:n,transition:r||t.linear,callback:i||null,elapsed:0}),this.visible||(logger.warn(this.tag+": Auto-completing tween because this view is invisible"),this.completeTween()),this},delayTween:function(e,t){return this.tween(null,e,null,t)},cancelTween:function(){return this._tweenQueue=[],this},completeTween:function(){for(var e=this._tweenQueue.length,t=this._tweenQueue.splice(0,e),n=0;n<e;++n){var r=t[n],i;for(i in r.properties)this[i]=r.properties[i].to;r.callback&&r.callback()}},_updateTween:function(e){if(!(1>this._tweenQueue.length)){var t=this._tweenQueue[0];t.elapsed+=e;if(null===t.properties)t.elapsed>=t.duration&&(this._tweenQueue.shift(),t.callback&&t.callback());else{e=Math.ceil(t.duration/e);var n=Math.floor(t.elapsed/t.duration*e);if(n>=e){for(var r in t.properties)this[r]=t.properties[r].to;this._tweenQueue.shift();t.callback&&t.callback()}else for(r in t.properties){var i=t.properties[r];null==i.from&&(i.from=this[r]);i=t.transition(n,i.from,i.to-i.from,e);this[r]=i}}}},_getCurrentLayout:function(){var e=s.width+"x"+s.height;return this._layouts&&this._layouts[e]?this._layouts[e]:null},_initLayouts:function(){if(null!=this._layouts){var e=this._layouts.init,t=e?e.conf||{}:{},n=this._getCurrentLayout();n&&n.conf&&(t=merge(n.conf,t));this.set(t);if(e&&e.children)for(var r in e.children){var n=e.children[r],i=n.conf||{},s=this._getCurrentLayout(),t=null;null!=s&&s.children&&s.children[r]&&(t=s.children[r],i=merge(t.conf,i));n=new(n.ctor||u)(merge({parent:this,tag:r},i));t&&t.align&&n.align.apply(n,t.align)}this.reflow()}},_renderDebug:function(e){e.lineWidth=1;var t=this.boundingBox,n=t.x-this.x,r=t.y-this.y;e.fillStyle="rgba(255, 0, 0, 0.15)";e.fillRect(n,r,t.width,t.height);e.strokeStyle="rgb(255, 0, 0)";e.strokeRect(n,r,t.width,t.height);e.strokeStyle="rgb(0, 0, 255)";e.strokeRect(0,0,this.width,this.height)}});return u.transitions=t,u});define("djinn/helpers/RotateDeviceView",["djinn/View"],function(e){return e.extend({init:function(t){t=merge(t,{visible:!1,z:Infinity,backgroundColor:"rgb(255, 255, 255)"});this._super(t);this._rotateView=(new e({parent:this,width:250,height:250,image:"__rotateImage"})).align("center","center")},reflow:function(){this.width=this.parent.width;this.height=this.parent.height;this._rotateView.align("center","center");this._super()}})});define("djinn/ui/ProgressBar",["djinn/View"],function(e){return e.extend({init:function(e){e=merge(e,{progress:0});this._super(e);this.progress=Number(e.progress)},render:function(e){this._super(e);var t=this.width*this.progress;e.fillStyle="rgb(100, 100, 100)";e.fillRect(0,0,t,this.height);e.lineWidth=2;e.strokeStyle="rgb(230, 230, 230)";e.strokeRect(0,0,this.width,this.height)}})});define("djinn/TextView",["djinn/View","djinn/client"],function(e,t){var n=e.extend({init:function(e){Object.defineProperty(this,"text",{get:function(){return this._rawText},set:function(e){this._lineBuffer=null;this._rawText=e?String(e):null}});e=merge(e,n.defaults);e.parent&&(!e.width||1>e.width)&&(e.width=e.parent.width);if(!e.height||1>e.height)e.height=e.fontSize;this._super(e);this._lineBuffer=null;this.fontSize=Number(e.fontSize);this.fontFamily=e.fontFamily;this.color=e.color;this.shadowColor=e.shadowColor;this.strokeColor=e.strokeColor;this.strokeWidth=e.strokeWidth;this.textAlign=e.textAlign;this.verticalAlign=e.verticalAlign;this.text=e.text},render:function(e){this._super(e);if(!(void 0===this.text||null===this.text||1>this.text.length)){null==this._lineBuffer&&this._bufferLines(this.text,e);var n=drawY=0;"center"==this.textAlign&&(n=this.width/2);"right"==this.textAlign&&(n=this.width);"middle"==this.verticalAlign&&(drawY=this.height/2);this._applyContextSettings(e);for(var r=0,i=this._lineBuffer.length;r<i;++r){var s=drawY+r*this.fontSize,o=this._lineBuffer[r];this.shadowColor&&(e.fillStyle=this.shadowColor,e.fillText(o,n+1,s+1));!t.isTouch&&this.strokeColor&&this.strokeWidth&&(e.lineWidth=this.strokeWidth,e.strokeStyle=this.strokeColor,e.strokeText(o,n,s));e.fillStyle=this.color;e.fillText(o,n,s)}}},_applyContextSettings:function(e){e.font=this.fontSize+"px "+this.fontFamily;e.textAlign=this.textAlign;e.textBaseline=this.verticalAlign},_bufferLines:function(e,t){e=String(e);this._lineBuffer=[];this._applyContextSettings(t);for(var n=e.split(" "),r=0,i=0,s=n.length;i<s;++i){var o=this._lineBuffer[r]||"",u=0<o.length?o+" "+n[i]:n[i];0<o.length&&t.measureText(u).width>this.width?(++r,this._lineBuffer[r]=n[i]):this._lineBuffer[r]=u}}});return n.defaults={fontSize:20,fontFamily:"Helvetica, Arial, Verdana, Microsoft Yahei, 微软雅黑, STXihei, 华文细黑, sans-serif",color:"rgb(0, 0, 0)",textAlign:"left",verticalAlign:"top",text:""},n});define("djinn/helpers/LoadingScreen","djinn/manifest djinn/assets djinn/View djinn/TextView djinn/ui/ProgressBar djinn/utils/viewEffects".split(" "),function(e,t,n,r,i,s){var o=merge(e.splash,{fadeDuration:1,displayDuration:0,backgroundColor:"rgb(0, 0, 0)",imageWidth:100,imageHeight:100});return n.extend({init:function(e){Object.defineProperty(this,"loadingProgress",{set:function(e){this._loadingBar.progress=e;this._loadingText.text="LOADING: "+~~(100*e)+"%"}});e=merge({tag:"LoadingScreen",acceptInputEvents:!0,cancelInputEvents:!0,visible:!1,backgroundColor:o.backgroundColor,z:Infinity},e);this._super(e);o.image&&(t.load(o.image),this._splashImage=(new n({parent:this,image:o.image,width:o.imageWidth,height:o.imageHeight})).align("center","center"));e=.05*this.height;this._loadingBar=(new i({parent:this,visible:!1,width:.8*this.width,height:e})).align("center","bottom",0,-e);this._loadingText=(new r({parent:this,visible:!1,text:"LOADING",textAlign:"center",verticalAlign:"middle",color:"rgb(255, 255, 255)",fontSize:~~(.75*e),height:e})).align("center","bottom",0,-e);this._uiDelayTimer=this.createBoundTimer(500,bind(this,"_onDelayElapsed"));this.on("inputStart",this,"_onInputStart")},show:function(e){this.set({opacity:0,visible:!0});s.fadeIn(this,{duration:o.fadeDuration});this.delayTween(o.displayDuration,function(){e&&e()});this._uiDelayTimer.start()},hide:function(e){this.acceptInputEvents=!1;s.fadeOut(this,{duration:o.fadeDuration},bind(this,function(){this.visible=!1;e&&e()}))},_onDelayElapsed:function(){this._uiDelayTimer.stop();1>this._loadingBar.progress&&(this._loadingText.visible=!0,this._loadingBar.visible=!0)},_onInputStart:function(e){this._onDelayElapsed();this.completeTween()}})});define("djinn/Game","djinn/Emitter djinn/globalTimer djinn/client djinn/stage djinn/View djinn/TextView djinn/helpers/RotateDeviceView djinn/helpers/LoadingScreen djinn/manifest djinn/assets".split(" "),function(e,t,n,r,i,s,o,u,a,f){return e.extend({init:function(e){e=merge(e,{showLoadingScreen:!1});this._super(e);this.showLoadingScreen=e.showLoadingScreen;this._splashFinished=!1;this._loadingProgress=0;this.view=new i({tag:"GameRootView",acceptInputEvents:!0,width:r.width,height:r.height});r.on("resize",this,"_onStageResize");"both"!=a.orientation&&(this._rotateDeviceView=new o({parent:this.view}),e=bind(this,function(){a.orientation!=n.orientation?this._rotateDeviceView.show():this._rotateDeviceView.hide()}),n.on("orientationChange",e),e());this._loadingScreen=new u({parent:this.view,visible:!1})},run:function(){t.on("tick",this,"_update");t.start();this.showLoadingScreen&&(r.eraseBeforeRender=!0,this._loadingScreen.show(bind(this,"_onSplashFinish")))},stop:function(){t.stop();t.off("tick",this)},preloadAssets:function(e){f.load(e,bind(this,"_onLoadComplete"),bind(this,"_onLoadProgress"))},_onLoadProgress:function(e,t,n,r,i){this._loadingProgress=i;this._loadingScreen.loadingProgress=this._loadingProgress;this._checkGameReady()},_onLoadComplete:function(){this.fire("load")},_update:function(e){this._react();this.view.preTick(e);this._render()},_react:function(){for(var e=r.getInputEvents(),t=e.length,n=0;n<t;++n)this.view.react(e[n])},_render:function(){r.renderView(this.view)},_onStageResize:function(){this.view.width=r.width;this.view.height=r.height;this.view.reflow()},_onSplashFinish:function(){this._splashFinished=!0;this._checkGameReady()},_checkGameReady:function(){this._splashFinished&&1===this._loadingProgress&&this._loadingScreen.hide(bind(this,function(){r.eraseBeforeRender=!1;this.fire("ready")}))}})});define("djinn/intl",[],function(){var e=__intl||{};return{get:function(t){return e[t]?1==arguments.length?e[t]:(arguments[0]=e[t],sprintf.apply(arguments,arguments)):sprintf("[undefined intl: %s]",t)}}});define("djinn/Model",["djinn/Emitter"],function(e){return e.extend({init:function(e){this._super(e);this.persists=!1;this.storageKey=null;this.attributes=e||{}},add:function(e,t){var n=this.get(e),n=n+Number(t);this.set(e,n)},has:function(e){return this.attributes.hasOwnProperty(e)},set:function(e,t,n){if("string"==typeof e){var r={};r[e]=t;this._set(r,n)}else this._set(e,t)},get:function(e,t){return this.has(e)?this.attributes[e]:t},load:function(){var e=localStorage.getItem(this.storageKey);return e?(e=JSON.parse(e),this.set(e,{nosave:!0}),this.fire("load"),!0):!1},save:function(){if(!this.persists)return!1;if(null==this.storageKey)return logger.warn("No .storageKey specified. Cannot save model."),!1;var e=JSON.stringify(this.attributes);try{localStorage.setItem(this.storageKey,e)}catch(t){logger.error("Failed to set localStorage! Quota exceeded?")}return!0},_set:function(e,t){t=t||{};for(var n in e){var r=this.attributes[n];this.attributes[n]=e[n];!0!==t.silent&&this.fire("changed:"+n,[{target:this,oldValue:r,newValue:e[n]}])}!0!==t.nosave&&this.save();!0!==t.silent&&this.fire("changed",[{target:this}])}})});define("js/model/GameModel",["djinn/Model","djinn/math/core","djinn/manifest"],function(e,t,n){return new(e.extend({init:function(e){this._super({highScore:10,soundEnabled:!0});this.persists=!0;this.storageKey=n.shortName;this.load();this.MAX_PLAYER_HEALTH=5;this.WEAPON_DURATION=2e4},equipWeapon:function(e){this.fire("gotWeapon",[e])},healPlayer:function(e){this.playerHealth+=e;this.playerHealth=t.clamp(this.playerHealth,0,this.MAX_PLAYER_HEALTH);this.fire("playerHealed",[this.playerHealth])},hitPlayer:function(e){this.playerHealth-=e;this.playerHealth=t.clamp(this.playerHealth,0,this.MAX_PLAYER_HEALTH);this.fire("playerDamaged")},isPlayerHurt:function(){return this.playerHealth<this.MAX_PLAYER_HEALTH},reset:function(){this.playerHealth=this.MAX_PLAYER_HEALTH}}))});define("djinn/math/Vector2",["djinn/Class"],function(e){var t=e.extend({init:function(e,t){return void 0===e&&(e={x:0,y:0}),"number"==typeof e?(this.x=Number(e),this.y=Number(t)):void 0===e.angle?(this.x=Number(e.x||0),this.y=Number(e.y||0)):(this.x=e.magnitude*Math.cos(e.angle),this.y=e.magnitude*Math.sin(e.angle)),Object.defineProperty(this,"angle",{get:function(){return Math.atan2(this.y,this.x)}}),Object.defineProperty(this,"heading",{get:function(){return Math.atan2(this.x,-this.y)}}),this},add:function(e){return this.x+=e.x,this.y+=e.y,this},clone:function(){return new this.constructor({x:this.x,y:this.y})},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},getUnitVector:function(){return new t({angle:this.angle,magnitude:1})},magnitude:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},minus:function(e){return new t({x:this.x-e.x,y:this.y-e.y})},normalize:function(){var e=this.magnitude();return 0===e?this:this.scale(1/e)},scale:function(e){return this.x*=e,this.y*=e,this},subtract:function(e){return this.x-=e.x,this.y-=e.y,this},toAngle:function(){return 180/Math.PI*this.heading}});return t.makeFromHeading=function(e,n){n=Number(n)||1;return new t({x:Math.sin(e)*n,y:-Math.cos(e)*n})},t});define("djinn/Sprite",["djinn/View"],function(e){return e.extend({init:function(e){Object.defineProperty(this,"currentAnimation",{get:function(){return this._currentAnim}});Object.defineProperty(this,"tickSpeed",{get:function(){return this._tickSpeed||1},set:function(e){this._animating&&(this._frameElapsed*=e/(this._tickSpeed||1));this._tickSpeed=e}});e=merge(e,{animations:{}});this._super(e);this._animations=e.animations;this._animating=!1;this._currentAnim=null;this._frameIndex=this._frameElapsed=0;for(var t in this._animations)this._animations[t]=merge(this._animations[t],{frames:[],frameRate:12,flipHorizontal:!1,flipVertical:!1,loop:!0})},tick:function(e){if(this._animating&&this._currentAnim){var t=this._animations[this._currentAnim];void 0===t&&logger.warn("Animation not defined: ",this._currentAnim);this._frameElapsed+=e;this._frameElapsed>=1e3/t.frameRate&&(this._frameElapsed=0,++this._frameIndex,e=t.frames.length-1,this._frameIndex>e&&(0==t.loop?(this._frameIndex=e,this._animating=!1,this.fire("animationEnd")):this._frameIndex=0))}},render:function(e){if(this._currentAnim){var t=this._animations[this._currentAnim],n=t.frames[this._frameIndex],r=n[0],n=n[1];this._image&&this._image.ready&&((t.flipHorizontal||t.flipVertical)&&e.scale(t.flipHorizontal?-1:1,t.flipVertical?-1:1),r+this.width>this._image.width||n+this.height>this._image.height?logger.warn("Invalid sprite coordinates!"):e.drawImage(this._image,r,n,this.width,this.height,0,0,this.width,this.height))}else this._super(e)},playAnimation:function(e,t){if(this._currentAnim!=e||!1!==t)this._animating=!0,this._currentAnim=e,this._frameElapsed=this._frameIndex=0}})});define("js/data/weapons",{axe:{bounce:!0,damage:10,interval:200,rotate:!0,speed:250},axe2:{bounce:!0,damage:15,interval:250,rotate:!0,speed:300},axe3:{bounce:!0,damage:20,interval:250,rotate:!0,sound:"xamAttackIce",speed:300},spear:{damage:10,interval:400,speed:600},spear2:{damage:15,interval:300,speed:700},spear3:{damage:20,interval:250,speed:800},sword:{damage:10,interval:400,speed:250},sword2:{damage:15,interval:250,speed:300},sword3:{damage:20,interval:200,sound:"xamAttackFire",speed:500},runeforge:{damage:30,interval:150,sound:"xamAttackFire",speed:750}});define("js/view/DifficultyView",["djinn/View"],function(e){return e.extend({init:function(e){e=merge(e,{opacity:.5});this._super(e)},render:function(e){e.fillStyle="rgb(0, 0, 0)";e.fillRect(this.center.x-50,this.center.y-50,100,100);e.fillStyle="rgb(250, 250, 0)";e.fillRect(this.center.x-50,this.center.y+50,100,-(this.difficulty.value/100*100));e.font="20px Helvetica, Arial, Verdana, Microsoft Yahei, 微软雅黑, STXihei, 华文细黑, sans-serif";e.textAlign="center";e.fillText(Math.round(this.difficulty.value),this.center.x,this.center.y);var t=(this.difficulty.rateOfIncrease-1.6)/1.6;e.fillStyle="rgb(250, 0, 0)";e.fillRect(this.center.x-50-10,this.center.y+50,10,-(100*t));t=Math.sin(this.difficulty.fluctuation);e.fillStyle="rgb(0, 0, 250)";e.fillRect(this.center.x+50,this.center.y,10,50*t)}})});define("js/view/viewData",{width:320,height:480,backgroundColor:"rgb(10, 10, 10)",color:"rgb(240, 240, 240)",margin:10,fontFamily:"Helvetica, Arial, Verdana, Microsoft Yahei, 微软雅黑, STXihei, 华文细黑, sans-serif",fontSize:16,shadowColor:"rgb(10, 10, 10)",targetMaxY:346,numbers:{fontFamily:"Helvetica, Arial, Verdana, Microsoft Yahei, 微软雅黑, STXihei, 华文细黑, sans-serif",strokeColor:"rgb(10, 10, 10)",strokeWidth:3},bars:{backgroundColor:"rgba(10, 10, 10, 0.75)",getColor:function(e){return.25>=e?"rgb(250, 30, 37)":.5>=e?"rgb(233, 116, 28)":"rgb(64, 188, 63)"},height:6},objects:{image:"media/images/objects.png",width:32,height:32,types:{heart:{imageX:128,imageY:0},starburst:{imageX:160,imageY:0,z:3},axe:{imageX:0,imageY:64},axe2:{imageX:32,imageY:64},axe3:{imageX:64,imageY:64},spear:{imageX:0,imageY:32},spear2:{imageX:32,imageY:32},spear3:{imageX:64,imageY:32},sword:{imageX:0,imageY:0},sword2:{imageX:32,imageY:0},sword3:{imageX:64,imageY:0},runeforge:{imageX:92,imageY:0}}},modal:{image:"media/images/modal.png",offsetX:4,width:264,height:264},titleScreen:{image:"media/images/title_bg.png",title:{image:"media/images/title.png",y:24,width:316,height:142},highScore:{fontSize:18,valueFontSize:48,x:95,y:220},button:{x:196,y:316},monsters:{image:"media/images/title_monsters.png",x:38,width:246,height:94}},button:{image:"media/images/button.png",color:"rgb(240, 240, 240)",width:118,height:56},battleScreen:{fontSize:48,painColor:"rgb(211, 43, 48)",wallY:320,headerPanel:{image:"media/images/header_panel.png",width:320,height:64,z:3},pauseButton:{image:"media/images/pause.png",margin:4,width:40,height:40},progressBar:{image:"media/images/bar_filler.png",x:20,y:52,z:4,width:280,height:8},battleField:{image:"media/images/battle_field.png",width:320,height:416},equippedWeapon:{backgroundColor:"rgba(0, 0, 0, 0.75)",x:214,y:4,width:40,height:40},lever:{image:"media/images/lever.png",margin:-4,width:80,height:56}},overlay:{z:5},xam:{image:"media/images/xam.png",y:314,z:2,width:32,height:32,animations:{up:{frameRate:5,frames:[[0,0],[32,0]]},upPain:{frameRate:5,frames:[[0,96],[32,96]]},left:{frameRate:5,frames:[[0,32],[32,32]]},leftPain:{frameRate:5,frames:[[0,128],[32,128]]},right:{frameRate:5,frames:[[0,64],[32,64]]},rightPain:{frameRate:5,frames:[[0,160],[32,160]]},death:{frameRate:4,frames:[[0,192],[32,192],[64,192]],loop:!1}}},spawnPoints:{small:[32,64,128,160,224,256],large:[32,128,224]},monster:{bat:{image:"media/images/monsters/bat.png"},demoblin:{image:"media/images/monsters/demoblin.png"},flamingSkull:{image:"media/images/monsters/flaming_skull.png"},gel:{image:"media/images/monsters/gel.png"},goblin:{image:"media/images/monsters/goblin.png"},wizard:{image:"media/images/monsters/wizard.png"},owlbear:{image:"media/images/monsters/owlbear.png"},cyclops:{image:"media/images/monsters/cyclops.png"},dragon:{image:"media/images/monsters/green_dragon.png"},width:32,height:32,largeWidth:64,largeHeight:64,getAnimations:function(e,t){return{down:{frameRate:5,frames:[[0,0],[e,0]]},up:{frameRate:5,frames:[[0,t],[e,t]]},downPain:{frameRate:5,frames:[[0,3*t],[e,3*t]]},upPain:{frameRate:5,frames:[[0,4*t],[e,4*t]]},idle:{frameRate:0,frames:[[0,0]]},idlePain:{frameRate:0,frames:[[0,3*t]]},death:{frameRate:3,frames:[[0,6*t],[e,6*t],[2*e,6*t]],loop:!1}}}},gameOverScreen:{color:"rgb(216, 200, 161)",padding:20,header:{fontSize:32},monstersSlain:{fontSize:20,y:70},monstersSlainValue:{y:85},debugMode:{fontSize:20,y:120},highScore:{y:132},button:{image:"media/images/buttons_colored_narrow.png",quitImageY:112,y:174,width:98,height:56},highScoreDragon:{image:"media/images/high_score_dragon.png",x:220,y:20,z:2,width:116,height:132}},settingsScreen:{color:"rgb(216, 200, 161)",padding:20,header:{fontSize:32},yourScore:{fontSize:16,y:70},highScore:{fontSize:16,y:95},playSound:{fontSize:24,y:125,width:132,height:38},button:{image:"media/images/buttons_colored_narrow.png",quitImageY:112,y:174,width:98,height:56}},checkbox:{color:"rgb(216, 200, 161)",image:"media/images/checkbox.png",width:38,height:38},health:{between:6,margin:8}});define("js/data/monsters",["djinn/math/Vector2","djinn/Timer","djinn/math/core","../view/viewData"],function(e,t,n,r){return{bat:{bounce:!0,health:10,damage:1,init:function(){this.velocity=new e(n.random(-10,10),50);this._changeDirectionTimer=(new t(500)).on("elapsed",bind(this,function(){this.velocity=new e(n.random(-50,50),n.random(10,100));this._changeDirectionTimer.start(n.random(500,5e3))})).start()},tick:function(e){this.x<r.margin?(this.velocity.x=-this.velocity.x,this.x=r.margin):this.right>r.width-r.margin&&(this.velocity.x=-this.velocity.x,this.right=r.width-r.margin);this.y<-this.height&&(this.velocity.y=-this.velocity.y,this.y=-this.height)}},goblin:{health:15,damage:1,init:function(){this.velocity=new e(0,120)}},demoblin:{health:50,damage:1,init:function(){this.velocity=new e(0,75)}},flamingSkull:{bounce:!0,health:30,damage:1,init:function(){var t=n.random(100,200)*(n.random(0,1)||-1);this.velocity=new e(t,n.random(40,60))},tick:function(e){this.x<r.margin?(this.velocity.x=-this.velocity.x,this.x=r.margin):this.right>r.width-r.margin&&(this.velocity.x=-this.velocity.x,this.right=r.width-r.margin)}},gel:{bounce:!0,health:30,damage:1,init:function(){this.velocity=new e(n.random(-50,50),50)},onHit:function(){this.velocity=new e(n.random(-50,50),-200)},tick:function(e){this.x<r.margin?(this.velocity.x=-this.velocity.x,this.x=r.margin):this.right>r.width-r.margin&&(this.velocity.x=-this.velocity.x,this.right=r.width-r.margin);this.y<-this.height&&(this.velocity.y=-this.velocity.y,this.y=-this.height)}},wizard:{health:40,damage:1,init:function(){this._radians=0;this._startX=this.x;this.velocity=new e(0,50);this._radius=25;this._tickMod=300},tick:function(e){this._radians+=e/this._tickMod;this._radians>=2*Math.PI&&(this._radians-=2*Math.PI);this.x=this._startX+Math.sin(this._radians)*this._radius;this.y<-this.height&&(this.velocity.y=-this.velocity.y,this.y=-this.height)}},owlbear:{size:"large",health:60,damage:1,init:function(){this.velocity=new e(0,80)}},cyclops:{size:"large",health:80,damage:1,init:function(){this.velocity=new e(0,60)}},dragon:{size:"large",health:150,damage:1,init:function(){this.velocity=new e(0,60)}}}});define("js/view/ProgressBar",["djinn/View","djinn/intl","../model/GameModel","./viewData"],function(e,t,n,r){return e.extend({init:function(e){e=merge({image:r.battleScreen.progressBar.image,x:r.battleScreen.progressBar.x,y:r.battleScreen.progressBar.y,z:r.battleScreen.progressBar.z,width:r.battleScreen.progressBar.width,height:r.battleScreen.progressBar.height},e);this._super(e);this.monstersSlain=0},increment:function(){this.monstersSlain+=1;this._update()},reset:function(){this._gotNewHighScore=!1;this.monstersSlain=this.imageY=0;this._update()},_update:function(){var e=Math.min(this.monstersSlain/n.get("highScore"),1);this.width=r.battleScreen.progressBar.width*e;this.imageY=1==e?this.height:0;!this._gotNewHighScore&&1==e&&(this._gotNewHighScore=!0,this.fire("newHighScore"))}})});define("js/view/WeaponView",["djinn/View","djinn/math/Vector2","../data/weapons","./viewData"],function(e,t,n,r){return e.extend({init:function(e){e=merge({image:r.objects.image,width:r.objects.width,height:r.objects.height},e);this._super(e);this._data=n[e.type];this.bounce=this._data.bounce;this.damage=this._data.damage;this.speed=this._data.speed;var t=r.objects.types;this.imageX=t[e.type].imageX;this.imageY=t[e.type].imageY;this.velocity=e.targetVector.scale(this.speed||0);this.rotation=e.targetVector.heading},tick:function(e){e/=1e3;this._data.rotate&&(this.rotation-=.2,0>this.rotation&&(this.rotation+=2*Math.PI));this.velocity&&(this.x+=this.velocity.x*e,this.y+=this.velocity.y*e)}})});define("js/view/HighScoreDragonView",["djinn/View","djinn/math/core","djinn/utils/transitions","./viewData"],function(e,t,n,r){return e.extend({init:function(e){e=merge({image:r.gameOverScreen.highScoreDragon.image,anchorY:r.gameOverScreen.highScoreDragon.height/5,width:r.gameOverScreen.highScoreDragon.width,height:r.gameOverScreen.highScoreDragon.height,x:r.gameOverScreen.highScoreDragon.x,y:r.gameOverScreen.highScoreDragon.y,z:r.gameOverScreen.highScoreDragon.z},e);this._super(e);this._sway()},_sway:function(){if(this.visible){var e=Math.PI/16;this.tween({rotation:-e},4e3,n.easeBoth).tween({rotation:e},4e3,n.easeBoth,bind(this,"_sway"))}}})});define("js/view/polish",["djinn/math/core","djinn/utils/transitions","./viewData"],function(e,t,n){return{burst:function(e,n){e.opacity=0;e.scale=.5;e.tween({opacity:1,rotation:Math.PI/2,scale:1.5},100,t.linear).tween({opacity:0},100,t.linear,function(){n&&n()})},buttonPress:function(e,n){e.tween({y:e.y+e.height/10},50,t.linear).tween({y:e.y},50,t.linear,n)},fadeOut:function(e,n,r){e.tween({opacity:0},n,t.linear,r)},fadeIn:function(e,n,r){e.tween({opacity:1},n,t.linear,r)},hover:function(e){var t=e.y;e.tick=function(e){void 0===this._radians&&(this._radians=0);this._radians+=e/300;this._radians>=2*Math.PI&&(this._radians-=2*Math.PI);this.y=t+2*Math.sin(this._radians)}},popIn:function(r,i,s,o){var u=1==e.random(1,2)?2:-2,u=e.clamp(r.x+r.width*u,0,n.width-r.width),a=r.y;r.opacity=s||0;r.scale=i||.5;r.y+=r.height/2;r.tween({opacity:1,scale:1,x:u,y:a},200,t.linear).tween({scale:1.25},50,t.linear).tween({scale:1},50,t.linear,o)},popOut:function(e,n,r,i){e.opacity=1;e.tween({scale:.75},50,t.linear).tween({opacity:0,scale:2},250,t.linear,i)},vibrate:function(t,n,r,i,s){t.completeTween();r=r||10;i=(i||250)/r;n=n||6;for(var o=t.x,u=t.y,a=0;a<r;++a)t.tween({x:t.x+e.random(-n,n),y:t.y+e.random(-n,n)},i);t.delayTween(0,function(){t.x=o;t.y=u;s&&s()})}}});define("js/view/ButtonView",["djinn/View","djinn/TextView","djinn/utils/transitions","./polish","./viewData"],function(e,t,n,r,i){return e.extend({init:function(e){e=merge(e,{acceptInputEvents:!0,image:i.button.image,width:i.button.width,height:i.button.height});this._super(e);this._enabled=!0;this.imageY=this._defaultImageY=e.defaultImageY||0;this._textView=(new t({parent:this,text:e.text,color:i.button.color,textAlign:"center",verticalAlign:"middle",height:this.height})).align("center","center");this.on("inputStart",this,"_onInputStart");Object.defineProperty(this,"text",{set:function(e){this._textView.text=e}})},enable:function(){return this._enabled=!0,this.imageY=this._defaultImageY,this},disable:function(){return this._enabled=!1,this.imageY=this.height,this},_onInputStart:function(){this._enabled&&r.buttonPress(this,bind(this,function(){this.fire("pressed")}))}})});define("js/view/GameOverScreen","djinn/View djinn/TextView djinn/utils/transitions djinn/intl ../model/GameModel ./ButtonView ./HighScoreDragonView ./viewData".split(" "),function(e,t,n,r,i,s,o,u){return e.extend({init:function(n){n=merge({acceptInputEvents:!0,width:u.width,height:u.height},n);this._super(n);this.monstersSlain=this._monstersSlainDisplay=0;this._radians=0;this._modalView=(new e({acceptInputEvents:!0,parent:this,image:u.modal.image,width:u.modal.width,height:u.modal.height})).align("center","center",u.modal.offsetX);this._modalStartY=this._modalView.y;this._gameOverText=(new t({parent:this._modalView,text:r.get("GAME_OVER"),color:u.gameOverScreen.color,fontSize:u.gameOverScreen.header.fontSize,textAlign:"center",y:u.gameOverScreen.padding})).align("center");this._monstersSlainText=(new t({parent:this._modalView,text:r.get("MONSTERS_SLAIN"),color:u.gameOverScreen.color,textAlign:"center",y:u.gameOverScreen.monstersSlain.y})).align("center");this._monstersSlainValueText=(new t({parent:this._modalView,textAlign:"center",fontFamily:u.numbers.fontFamily,fontSize:u.gameOverScreen.header.fontSize,strokeColor:u.numbers.strokeColor,strokeWidth:u.numbers.strokeWidth,y:u.gameOverScreen.monstersSlainValue.y})).align("center");this._highScoreText=(new t({parent:this._modalView,color:u.gameOverScreen.color,textAlign:"center",y:u.gameOverScreen.highScore.y})).align("center").on("inputStart",this,"_onHighScoreTextPressedForSomeReason");n=u.gameOverScreen.button;var i=u.margin/2;this._quitButton=(new s({parent:this._modalView,image:n.image,text:r.get("QUIT"),defaultImageY:n.quitImageY,x:this._modalView.width/2-n.width-i,y:n.y,width:n.width,height:n.height})).on("pressed",this,"_onPressedQuit");this._continueButton=(new s({parent:this._modalView,image:n.image,text:r.get("PLAY_AGAIN"),x:this._modalView.width/2+i,y:u.gameOverScreen.button.y,width:n.width,height:n.height})).on("pressed",this,"_onPressedContinue");this._highScoreDragonView=new o({parent:this,visible:!1})},_onHighScoreTextPressedForSomeReason:function(){this._highScoreDragonView.toggle()},_onPressedContinue:function(){this._continueButton.disable();this.fire("pressedContinue")},_onPressedQuit:function(){this._quitButton.disable();this.fire("pressedQuit")},show:function(){this._modalView.y=-this._modalView.height;this._monstersSlainText.opacity=0;this._monstersSlainValueText.hide();this._highScoreText.opacity=0;this.gotNewHighScore?this._highScoreText.text=r.get("NEW_HIGH_SCORE"):(this._highScoreText.scale=1,this._highScoreText.text=r.get("HIGH_SCORE")+" "+i.get("highScore"));this._continueButton.enable();this._quitButton.enable();this._highScoreDragonView.hide();this._super();this._modalView.tween({y:this._modalStartY},1e3,n.bounceOut,bind(this,function(){this._monstersSlainText.tween({opacity:1},500,n.linear);this._highScoreText.tween({opacity:1},500,n.linear,bind(this,function(){this._monstersSlainDisplay=0;this._monstersSlainValueText.text=0;this._monstersSlainValueText.show();/*Play68.shareFriend("highScore")*/}))}))},hide:function(e){var t=this._super;this._modalView.tween({y:-this._modalView.height},500,n.easeIn,function(){t();e&&e()})},tick:function(e){this._super&&this._super(e);this.visible&&this._monstersSlainDisplay<this.monstersSlain&&(this._monstersSlainDisplay+=Math.round(e/20),this._monstersSlainDisplay=Math.min(this._monstersSlainDisplay,this.monstersSlain),this._monstersSlainValueText.text=this._monstersSlainDisplay);this.gotNewHighScore&&(this._radians+=e/100,this._radians>2*Math.PI&&(this._radians-=2*Math.PI),this._highScoreText.scale=1.5+Math.sin(this._radians)/10)}})});define("js/view/HealthView",["djinn/View","djinn/utils/transitions","../model/GameModel","./polish","./viewData"],function(e,t,n,r,i){return e.extend({init:function(t){t=merge({width:i.width,height:i.height},t);this._super(t);this._maxHealth=n.MAX_PLAYER_HEALTH;this._heartViews=[];t=i.objects.width+i.health.between;for(var r=0;r<this._maxHealth;++r)this._heartViews.push(new e({parent:this,image:i.objects.image,imageX:i.objects.types.heart.imageX,imageY:i.objects.types.heart.imageY,x:i.margin+t*r,y:i.margin,width:i.objects.width,height:i.objects.height}))},heal:function(e){this._update(e)},reset:function(){for(var e=0;e<this._maxHealth;++e)this._heartViews[e].opacity=1,this._heartViews[e].scale=1},takeDamage:function(e){this._update(e)},_update:function(e){for(var r=0;r<n.MAX_PLAYER_HEALTH;++r){var i=this._heartViews[r];i.cancelTween();r<e?i.tween({opacity:1,scale:1},100,t.linear):i.tween({opacity:0,scale:.5},100,t.linear)}}})});define("js/view/PauseButton",["djinn/View","djinn/utils/transitions","./polish","./viewData"],function(e,t,n,r){return e.extend({init:function(e){var t=r.battleScreen.pauseButton;e=merge({image:t.image,width:t.width,height:t.height},e);this._super(e);this._enabled=!0;Object.defineProperty(this,"enabled",{set:function(e){this.imageY=(this._enabled=e)?0:this.height}});this.on("inputStart",this,"_onInputStart")},_onInputStart:function(e){e.cancel=!0;this._enabled&&n.buttonPress(this,bind(this,function(){this.fire("pressed")}))}})});define("js/view/StarburstView",["djinn/View","./polish","./viewData"],function(e,t,n){return e.extend({init:function(e){var r=n.objects;e=merge({image:r.image,imageX:r.types.starburst.imageX,imageY:r.types.starburst.imageY,width:r.width,height:r.height,z:r.types.starburst.z},e);this._super(e);t.burst(this,bind(this,function(){this.removeFromParent()}))}})});define("js/view/EquippedWeaponView",["djinn/View","djinn/utils/transitions","../model/GameModel","./polish","./viewData"],function(e,t,n,r,i){return e.extend({init:function(t){var r=i.battleScreen.equippedWeapon;t=merge({backgroundColor:r.backgroundColor,clip:!0,x:r.x,y:r.y,width:r.width,height:r.height},t);this._super(t);this._depletedTimer=this.createBoundTimer(n.WEAPON_DURATION,"_onDepletedElapsed");this._barFillView=new e({parent:this,width:r.width,height:r.height});this._objectView=(new e({parent:this,image:i.objects.image,width:i.objects.width,height:i.objects.height})).align("center","center")},_onDepletedElapsed:function(){this._depletedTimer.stop();this.hide();this.fire("depleted")},equipWeapon:function(e){if(!(-1<["axe","spear","sword"].indexOf(e))){var t=i.objects.types;this._objectView.imageX=t[e].imageX;this._objectView.imageY=t[e].imageY;this._depletedTimer.start();this.show()}},tick:function(){var e=this._depletedTimer.percentComplete/100,t=this.height*e;this._barFillView.backgroundColor=i.bars.getColor(1-e);this._barFillView.y=t}})});define("js/SoundIOS",["djinn/Emitter","djinn/Timer","./model/GameModel"],function(e,t,n){return new(e.extend({init:function(){this._super();this.enabled=n.get("soundEnabled");this._audioNode=null;this._stopAudioTimer=(new t).on("elapsed",this,"_onStopAudioTimerElapsed");this._sounds={celebrate:{start:16,duration:.75},equip:{start:56,duration:.4},input:{start:40,duration:.5},monsterDies:{start:32,duration:.75},monsterDiesLarge:{start:24,duration:.75},pause:{start:40,duration:.5},xamDies:{start:8,duration:3.9},xamPain:{start:0,duration:.4}}},load:function(){var e=new Audio;e.src="media/sound_effects/audio_sheet.mp3";e.play();e.pause();this._audioNode=e},_onStopAudioTimerElapsed:function(){this._audioNode.pause();this._stopAudioTimer.stop()},play:function(e){if(this.enabled)if(this._audioNode)try{if(e in this._sounds){var t=this._sounds[e];this._audioNode.pause();this._audioNode.currentTime=t.start;this._audioNode.play();this._stopAudioTimer.start(1e3*t.duration)}}catch(n){logger.warn("SoundIOS.play() caught an error: "+n)}else logger.warn("SoundIOS: iOS audio not ready yet")},stop:function(){this._onStopAudioTimerElapsed()}}))});define("js/Sound",["djinn/Emitter","djinn/client","./SoundIOS","./model/GameModel"],function(e,t,n,r){e=e.extend({init:function(){this._super();this.enabled=r.get("soundEnabled");this._audioNodes={};this._sounds={}},load:function(){for(var e in this._sounds){var t=this._sounds[e],n=new Audio,r=n;n.loaded=!0;r.oncanplaythrough=void 0;n.src=t;this._audioNodes[e]=n}},play:function(e,t){if(this.enabled){var n=this._audioNodes[e];if(n&&n.loaded){try{n.currentTime=0,n.loop="music"==e}catch(r){logger.warn("[sound.play] audioNode.currentTime error: "+r)}n.play()}}},stop:function(e){var t=this._audioNodes[e];if(t&&t.loaded)try{t.pause()}catch(n){logger.warn("[sound.stop] error: "+n)}else logger.warn("[sound.stop] key '"+e+"' not ready yet")}});return e=new e,t.isTouch?n:e});define("js/view/TitleScreen","djinn/View djinn/TextView djinn/utils/transitions djinn/intl ../Sound ../model/GameModel ./ButtonView ./polish ./viewData djinn/manifest".split(" "),function(e,t,n,r,i,s,o,u,a,f){return e.extend({init:function(n){n=merge({acceptInputEvents:!0,image:a.titleScreen.image,width:a.width,height:a.height},n);this._super(n);this._titleView=(new e({parent:this,image:a.titleScreen.title.image,x:a.titleScreen.title.x,width:a.titleScreen.title.width,height:a.titleScreen.title.height})).align("center");this._highScoreText=new t({parent:this,text:r.get("HIGH_SCORE"),fontFamily:a.numbers.fontFamily,fontSize:a.titleScreen.highScore.fontSize,shadowColor:null,strokeColor:a.numbers.strokeColor,strokeWidth:a.numbers.strokeWidth,textAlign:"center",x:a.titleScreen.highScore.x,y:a.titleScreen.highScore.y});this._highScoreValueText=new t({parent:this,fontFamily:a.numbers.fontFamily,fontSize:a.titleScreen.highScore.valueFontSize,shadowColor:null,strokeColor:a.numbers.strokeColor,strokeWidth:a.numbers.strokeWidth,textAlign:"center",x:a.titleScreen.highScore.x,y:a.titleScreen.highScore.y+this._highScoreText.height});this.buttonView=(new o({parent:this,text:r.get("LOADING"),y:a.titleScreen.button.y})).disable();this.buttonView.on("pressed",bind(this,function(){i.play("input");this.buttonView.disable();this.fire("playButton")}));this._monstersView=new e({parent:this,image:a.titleScreen.monsters.image,x:a.titleScreen.monsters.x,width:a.titleScreen.monsters.width,height:a.titleScreen.monsters.height});(new t({parent:this,text:sprintf(r.get("COPYRIGHT"),f.version),textAlign:"center"})).align("center","top",null,a.margin/2);s.on("changed:highScore",this,"_update");this._update()},doneLoading:function(){this.buttonView.text=r.get("PLAY");this.buttonView.enable();},show:function(){this.opacity=0;this._monstersView.y=a.height;this._titleView.y=-this._titleView.height;this.buttonView.enable();this.buttonView.x=a.width;this._highScoreText.opacity=0;this._highScoreValueText.opacity=0;u.fadeIn(this,500,bind(this,function(){this._monstersView.tween({y:a.height-this._monstersView.height},1e3,n.easeOut,bind(this,function(){this._titleView.tween({y:a.titleScreen.title.y},1e3,n.bounceOut);this._highScoreText.tween({opacity:1},1e3);this._highScoreValueText.tween({opacity:1},1e3);this.buttonView.tween({x:a.titleScreen.button.x},1e3,n.easeOut)}))}));this._super()},_update:function(){this._highScoreValueText.text=s.get("highScore")}})});define("js/view/XamView","djinn/Sprite djinn/Timer djinn/utils/transitions djinn/math/core djinn/math/Vector2 ../Sound ../data/weapons ./viewData".split(" "),function(e,t,n,r,i,s,o,u){return e.extend({init:function(e){e=merge({image:u.xam.image,y:u.xam.y,z:u.xam.z,width:u.xam.width,height:u.xam.height,animations:u.xam.animations},e);this._super(e);this.controlScheme="move";this.alive=!0;this.invincible=!1;this.target=null;this.speed=200;this._attackTimer=(new t).on("elapsed",this,"_onAttackTimerElapsed");this._invincibleTimer=(new t(1e3)).on("elapsed",this,"_onInvincibleTimerElapsed");this._painFlickerTimer=(new t(80)).on("elapsed",this,"_onPainFlickerElapsed");this._painResetTimer=(new t(1e3)).on("elapsed",this,"_onPainResetElapsed")},attack:function(){if(this.target){s.play(o[this.weapon].sound||"xamAttack");this.canAttack=!1;this._attackTimer.reset();switch(this.controlScheme){case"aim":var e=new i(this.target);e.subtract(this.center).normalize();var t=-(Math.PI/2)+.25,n=Math.PI/2-.25,r=e.heading;r<t?e=i.makeFromHeading(t):r>n&&(e=i.makeFromHeading(n));break;case"move":o[this.weapon].bounce?(this._weaponToggle=!this._weaponToggle,e=new i({x:this.center.x+(this._weaponToggle?-this.width:this.width),y:this.center.y-3*this.height})):e=new i({x:this.center.x,y:this.center.y-this.height}),e.subtract(this.center).normalize()}this.fire("attack",[e])}},enter:function(){var e=u.width/2;this.playAnimation(this.x<e?"right":"left");this.tween({x:e-this.width/2},1500,n.linear,bind(this,function(){this.playAnimation("up")}))},hasBaseWeapon:function(){return-1!=["sword","axe","spear"].indexOf(this.weapon)},equipWeapon:function(e){this.weapon=e;this._attackTimer.start(o[e].interval)},_onAttackTimerElapsed:function(){this.canAttack=!0},_onInvincibleTimerElapsed:function(){this.invincible=!1},_onPainFlickerElapsed:function(){this._inPain&&(this._showPain=!this._showPain);this.playAnimation(this.currentAnimation)},_onPainResetElapsed:function(){this._painFlickerTimer.stop();this._painResetTimer.stop();this._showPain=this._inPain=!1;this.playAnimation(this.currentAnimation)},playAnimation:function(e,t){this._inPain&&this._showPain?null===e.match(/Pain/)&&(e+="Pain"):e=e.replace(/Pain/,"");this._super(e,t)},reset:function(){this.canAttack=this.alive=!0;this.invincible=this._showPain=this._inPain=!1;this.target=null;this.x=1==r.random(1,2)?-this.width:u.width;this.equipWeapon("sword")},takeDamage:function(e){1>e?(s.play("xamDies"),this.alive=!1,this._inPain=!1,this._showPain=!1,this.playAnimation("death")):(s.play("xamPain"),this.invincible=!0,this._invincibleTimer.start(),this._inPain=!0,this._showPain=!0,this._painFlickerTimer.start(),this._painResetTimer.start(),this.playAnimation(this.currentAnimation))},tick:function(e){this._super(e);if(this.alive&&this.target&&(this.canAttack&&this.attack(),"move"==this.controlScheme)){var t=this.center.x-this.target.x,n=Math.abs(t);n>=u.margin?this.playAnimation(0<t?"left":"right",!1):this.playAnimation("up",!1);5<=n?(e/=1e3,0<t?this.x-=e*this.speed:0>t&&(this.x+=e*this.speed)):this.x=this.target.x-this.width/2}}})});define("js/view/MonsterView","djinn/Sprite djinn/math/Vector2 djinn/utils/transitions ../Sound ../model/GameModel ../data/monsters ./polish ./viewData".split(" "),function(e,t,n,r,i,s,o,u){return e.extend({init:function(e){this._data=s[e.type];if("large"==this._data.size)var t=u.monster.largeWidth,n=u.monster.largeHeight;else t=u.monster.width,n=u.monster.height;e=merge({image:u.monster[e.type].image,y:-n,width:t,height:n,animations:u.monster.getAnimations(t,n)},e);this._super(e);this._data=s[e.type];this._health=this._data.health;this._data.init&&this._data.init.apply(this);this.alive=!0;this.rotVelocity={x:0,y:0};this.speed=150;this.playAnimation("down")},attack:function(){i.hitPlayer(this._data.damage);this._bounceBack()},_bounceBack:function(){this._data.bounce?this.velocity.y*=-1:this.rotVelocity.y="large"==this._data.size?-450:-350},hit:function(e){this._health-=e;if(0<this._health){if(!this._inPain){this._inPain=!0;r.play(this._data.painSound||"monsterPain");var t=this.currentAnimation;null===t.match(/Pain/)&&this.playAnimation(t+"Pain");if(this._data.onHit)this._data.onHit.apply(this,[e]);else{var n=this.velocity;this.velocity={x:0,y:0}}this.delayTween(200,bind(this,function(){this._data.onHit||(this._inPain=!1,this.velocity=n);this.playAnimation(t)}))}return!1}return this.kill(),!0},kill:function(){this.alive=!1;this.velocity={x:0,y:0};this.cancelTween();this.playAnimation("death");this.delayTween(1e3,bind(this,function(){o.fadeOut(this,500,bind(this,function(){this.removeFromParent()}))}));"large"==this._data.size?r.play("monsterDiesLarge"):r.play("monsterDies")},render:function(e){this._super(e);if(this.alive&&this._health<this._data.health){var t=this._health/this._data.health;e.fillStyle=u.bars.backgroundColor;e.fillRect(-1,this.height,this.width+2,u.bars.height);e.fillStyle=u.bars.getColor(t);e.fillRect(0,this.height+1,this.width*t,u.bars.height-2)}},tick:function(e){this._super(e);if(this.alive){this._data.tick&&this._data.tick.apply(this,[e]);var t=e/1e3;this.velocity&&(this.x+=this.velocity.x*t,this.y+=this.velocity.y*t);0>this.rotVelocity.y&&(this.y+=this.rotVelocity.y*t,this.rotVelocity.y+=e/2,0<this.rotVelocity.y&&(this.rotVelocity.y=0));this.bottom>u.battleScreen.wallY&&(this.bottom=u.battleScreen.wallY,this._bounceBack())}},wander:function(){this.velocity.y=0;this.playAnimation("idle");this.delayTween(1500,bind(this,function(){this.velocity.y=-(this.speed/5);this.playAnimation("up")}))}})});define("js/view/LootView","djinn/View djinn/TextView djinn/utils/transitions ../Sound ../model/GameModel ./polish ./viewData".split(" "),function(e,t,n,r,i,s,o){return e.extend({init:function(e){e=merge({image:o.objects.image,imageX:o.objects.types[e.type].imageX,imageY:o.objects.types[e.type].imageY,width:o.objects.width,height:o.objects.height},e);this._super(e);this._type=e.type;e.creator&&this.centerOn(e.creator);0>this.y&&(this.y=0);s.popIn(this,null,null,bind(this,function(){s.hover(this);this.numFlashes=1;this.delayTween(1e3);for(var e=0;20>e;++e)this.delayTween(6*(30-e),bind(this,function(){this.opacity=1==this.opacity?0:1;20==++this.numFlashes&&(this.expired=!0)}))}))},collect:function(){if(!this.collected){this.collected=!0;switch(this._type){case"heart":i.healPlayer(1);break;default:r.play("equip"),i.equipWeapon(this._type)}this.cancelTween();s.popOut(this,null,null,bind(this,function(){this.expired=!0}))}}})});define("js/view/BattleScreen","djinn/View djinn/TextView djinn/math/core djinn/utils/transitions djinn/intl ../Sound ../model/GameModel ../data/monsters ./ProgressBar ./XamView ./WeaponView ./MonsterView ./LootView ./HealthView ./DifficultyView ./PauseButton ./StarburstView ./EquippedWeaponView ./polish ./viewData".split(" "),function(e,t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b){return e.extend({init:function(n){n=merge({acceptInputEvents:!0,width:b.width,height:b.height},n);this._super(n);this._combo=0;this.paused=this.running=!1;this._spawnTimer=this.createBoundTimer(0,"_onSpawnTimerElapsed");this._spawnCount=1;n=new e({acceptInputEvents:!0,parent:this,image:b.battleScreen.headerPanel.image,z:b.battleScreen.headerPanel.z,width:b.battleScreen.headerPanel.width,height:b.battleScreen.headerPanel.height});this._healthView=new p({parent:n});this._equippedWeaponView=(new g({parent:n,visible:!1,width:b.width,height:b.height,z:100})).on("depleted",this,"_onEquippedWeaponDepleted");var r=b.battleScreen.pauseButton;this._pauseButton=(new v({acceptInputEvents:!0,parent:n})).align("right","top",-r.margin,r.margin);this._progressBar=(new a({parent:n})).on("newHighScore",this,"_onNewHighScore");this._battleFieldView=(new e({parent:this,image:b.battleScreen.battleField.image,width:b.battleScreen.battleField.width,height:b.battleScreen.battleField.height})).align(null,"bottom");this._messageText=(new t({parent:this,fontSize:b.battleScreen.fontSize,textAlign:"center",visible:!1})).align("center","center");this._xamView=(new f({parent:this._battleFieldView})).on("attack",this,"_onXamAttack");this._leverView=(new e({parent:this._battleFieldView,image:b.battleScreen.lever.image,width:b.battleScreen.lever.width,height:b.battleScreen.lever.height})).align("center","bottom",null,b.battleScreen.lever.margin);this._difficultyView=new d({parent:this,visible:!1,width:b.width,height:b.height,z:100});this._overlayView=new e({parent:this,backgroundColor:b.battleScreen.painColor,opacity:0,width:this.width,height:this.height});this._overlayView.tick=function(e){0<this.opacity&&(this.opacity-=e/800)};this.on("inputStart",this,"_onInputStart");this.on("inputMove",this,"_onInputMove");this.on("inputEnd",this,"_onInputEnd");this._pauseButton.on("pressed",this,"_onPressedPause");o.on("gotWeapon",this,"_onGotWeapon");o.on("playerDamaged",this,"_onPlayerDamaged");o.on("playerHealed",this,"_onPlayerHealed")},_clampInput:function(e){return{x:n.clamp(e.x,b.margin,b.width-b.margin),y:this._xamView.y-this._xamView.height}},_forEach:function(e,t){for(var n in e)t(e[n])},_getComputedDifficulty:function(){return this._difficulty.value},_getMonsterSpawnPoint:function(e){e=b.spawnPoints[e||"small"];return e[n.random(e)]},_getMonsterType:function(){var e=this._getComputedDifficulty(),e=20>e?["bat","goblin","demoblin"]:50>e?["demoblin","flamingSkull","gel","goblin","owlbear"]:70>e?"bat demoblin flamingSkull gel goblin wizard owlbear cyclops".split(" "):90>e?["demoblin","flamingSkull","wizard","owlbear","cyclops"]:100>e?["flamingSkull","gel","wizard","owlbear","cyclops"]:["dragon"];return e[n.random(0,e.length-1)]},_getNextSpawnTime:function(){var e=this._getComputedDifficulty();return 25>e?n.random(1500,2e3):50>e?n.random(1e3,1500):90>e?n.random(750,1250):n.random(500,1e3)},_getRandomWeaponType:function(){var e=this._xamView.weapon,t=e.replace(/\d/,""),r=Number(e.substr(-1));if("runeforge"==e)return null;isNaN(r)?(r=["axe","spear","sword"],t=r.indexOf(t),r[t]+="2",r.push(e+"2")):r=3==r?[e,e,"runeforge"]:[e,t+String(r+1)];return r[n.random(r)]},_makeDamageStarburst:function(e){(new m({parent:this._battleFieldView})).centerOn(e)},_onEquippedWeaponDepleted:function(){var e=["axe","spear","sword"];this._xamView.equipWeapon(e[n.random(e)])},_resetDifficulty:function(e){this._difficulty.fluctuation=0;this._difficulty.rateOfIncrease=1.6;this._difficulty.value=e||0},_onXamAttack:function(e){e&&(e=(new l({parent:this._battleFieldView,targetVector:e,type:this._xamView.weapon})).centerOn(this._xamView),this._weaponViews[e.id]=e)},_onInputStart:function(e){if(this._acceptInput){this._inputStarted=!0;var t=this._clampInput(e.point);this._xamView.target=t;this._updateLever(e.point)}},_onInputMove:function(e){if(this._acceptInput&&this._inputStarted){var t=this._clampInput(e.point);this._xamView.target=t;this._updateLever(e.point)}},_onInputEnd:function(e){this._inputStarted=!1;this._xamView.target=null},_onGotWeapon:function(e){this._equippedWeaponView.equipWeapon(e);this._xamView.equipWeapon(e)},_onNewHighScore:function(){this._showNewHighScoreText()},_onPlayerDamaged:function(){this._spawnTimer.start(2e3);this._xamView.takeDamage(o.playerHealth);this._healthView.takeDamage(o.playerHealth);this._difficulty.rateOfIncrease=1.6;this._difficulty.rateOfIncrease+=(o.MAX_PLAYER_HEALTH-o.playerHealth)/o.MAX_PLAYER_HEALTH*1.6;this._comboBreaker();y.vibrate(this);this._overlayView.opacity=.6;1>o.playerHealth&&(s.stop("music"),this._pauseButton.enabled=!1,this._leverView.imageY=this._leverView.height,this._acceptInput=!1,this._spawnTimer.stop(),this._forEach(this._monsterViews,function(e){e.alive&&e.wander()}),this._equippedWeaponView.hide(),this.fire("gameOver",[this._progressBar.monstersSlain]))},_onPlayerHealed:function(e){this._healthView.heal(e)},reset:function(){o.reset();this.running=this.paused=!1;this._spawnCount=1;this._combo=0;this._progressBar.reset();this._xamView.reset();this._healthView.reset();this._leverView.align("center");this._leverView.imageY=this._leverView.height;this._pauseButton.enabled=!1;this._equippedWeaponView.hide();this._difficulty=this._difficultyView.difficulty={fluctuation:0,rateOfIncrease:1.6,value:1};this._forEach(this._weaponViews,bind(this,function(e){e.removeFromParent();delete this._weaponViews[e.id]}));this._weaponViews={};this._forEach(this._monsterViews,bind(this,function(e){e.removeFromParent();delete this._monsterViews[e.id]}));this._monsterViews={};this._forEach(this._lootViews,bind(this,function(e){e.removeFromParent();delete this._lootViews[e.id]}));this._lootViews={}},_onSpawnTimerElapsed:function(){if(this._acceptInput){for(var e=0;e<this._spawnCount;++e)this._spawnMonster();100<=this._difficulty.value&&(this._resetDifficulty(n.random(25,50)),++this._spawnCount);e=this._getNextSpawnTime();this._spawnTimer.start(e)}},pause:function(){this.paused=!1;this.togglePause()},togglePause:function(){this.paused=!this.paused;this.running=!this.paused;this._pauseButton.enabled=!this.paused;this._acceptInput=this.paused?!1:!0;this._leverView.imageY=this._acceptInput?0:this._leverView.height;s.play(this.paused?"pause":"unpause");this.paused?s.stop("music"):s.play("music")},_onPressedPause:function(e){this.paused||this.fire("pressedPause",[this._progressBar.monstersSlain])},render:function(e){this._super(e)},_showReadyText:function(e){var t=this._messageText;t.opacity=0;t.scale=5;t.text=i.get("READY");t.show();e&&t.delayTween(e);t.tween({opacity:1,scale:1},500);t.delayTween(1500);t.tween({opacity:0,scale:.1},500,r.linear,function(){t.hide()})},_showNewHighScoreText:function(){s.play("celebrate");var e=this._messageText;e.opacity=0;e.scale=0;e.text=i.get("NEW_HIGH_SCORE");e.show();e.tween({opacity:1,scale:.7},500).delayTween(1e3).tween({opacity:0,scale:1},500,r.linear,function(){e.hide()})},_spawnLoot:function(e){var t,r=this._xamView.hasBaseWeapon()?3:5;1===n.random(1,r)?t=this._getRandomWeaponType():o.isPlayerHurt()&&1===n.random(1,10)&&(t="heart");t&&(e=new h({parent:this._battleFieldView,creator:e,type:t}),this._lootViews[e.id]=e)},_spawnMonster:function(){var e=this._getMonsterType(),e=new c({parent:this._battleFieldView,type:e,x:this._getMonsterSpawnPoint(u[e].size)});this._monsterViews[e.id]=e},tick:function(e){if(this._acceptInput){this._updateDifficulty(e);this._forEach(this._weaponViews,bind(this,function(e){if(e.bounce)0>=e.x?(e.x=0,e.velocity.x*=-1):e.x>=b.width-e.width&&(e.x=b.width-e.width,e.velocity.x*=-1),e.y<=-e.height&&(delete this._weaponViews[e.id],e.removeFromParent(),this._comboBreaker());else if(e.x<=-e.width||e.x>=b.width||e.y<=-e.height)delete this._weaponViews[e.id],e.removeFromParent(),this._comboBreaker()}));this._forEach(this._lootViews,bind(this,function(e){this._forEach(this._weaponViews,bind(this,function(t){e&&n.intersects(e,t)&&e.collect()}));e.expired&&(e.removeFromParent(),delete this._lootViews[e.id])}));var t=0;this._forEach(this._monsterViews,bind(this,function(e){++t;this._xamView.alive&&!this._xamView.invincible&&e.y>=b.battleScreen.wallY-e.height&&(e.attack(),this._makeDamageStarburst({x:e.center.x,y:e.center.y+e.height/2}));this._forEach(this._weaponViews,bind(this,function(t){if(e&&n.intersects(e,t)){var r=t.damage;delete this._weaponViews[t.id];t.removeFromParent();this._makeDamageStarburst(e.center);e.hit(r)&&(this._spawnLoot(e),delete this._monsterViews[e.id],this._incrementCombo(),this._progressBar.increment())}}))}));1>t&&(this._spawnTimer.reset(),this._spawnMonster())}},start:function(){s.play("");this.running=!0;this._xamView.enter();this._showReadyText(500);this._spawnTimer.start(2500);this.delayTween(2500,bind(this,function(){this._acceptInput=!0;this._leverView.imageY=0;this._pauseButton.enabled=!0}))},_updateDifficulty:function(e){var t=this._difficulty.fluctuation,t=t+e/2e3;t>=2*Math.PI&&(t-=2*Math.PI);this._difficulty.fluctuation=t;this._difficulty.value+=e/1e3*this._difficulty.rateOfIncrease;this._difficulty.value=n.clamp(this._difficulty.value,1,100);this._difficultyView.difficulty=this._difficulty},_updateLever:function(e){this._leverView.x=n.clamp(e.x-this._leverView.width/2,b.margin,b.width-b.margin-this._leverView.width)},_comboBreaker:function(){this._combo=0},hide:function(){this.running=!1;this._super()},_incrementCombo:function(){++this._combo}})});define("js/view/CheckboxView","djinn/View djinn/TextView djinn/utils/transitions ../Sound ./polish ./viewData ../model/GameModel".split(" "),function(e,t,n,r,i,s,o){return e.extend({init:function(e){var n=s.checkbox;this._super(merge(e,{acceptInputEvents:!0}));this._checked=r.enabled;this._imageView=new t({parent:this,image:n.image,imageY:this._checked?0:n.height,width:n.width,height:n.height});this._textView=new t({parent:this,text:e.text,color:s.checkbox.color,verticalAlign:"middle",x:this._imageView.right+s.margin,y:this.height/2-s.margin/2});this.on("inputStart",this,"_onInputStart");Object.defineProperty(this,"text",{set:function(e){this._textView.text=e}})},_onInputStart:function(){i.buttonPress(this._imageView,bind(this,function(){this._checked=!this._checked;this._imageView.imageY=this._checked?0:this._imageView.height;r.enabled=this._checked;o.set("soundEnabled",r.enabled);this.fire("check")}))}})});define("js/view/SettingsScreen","djinn/View djinn/TextView djinn/utils/transitions djinn/intl ../Sound ../model/GameModel ./ButtonView ./CheckboxView ./viewData".split(" "),function(e,t,n,r,i,s,o,u,a){return e.extend({init:function(n){n=merge({acceptInputEvents:!0,width:a.width,height:a.height},n);this._super(n);this._modalView=(new e({acceptInputEvents:!0,parent:this,image:a.modal.image,width:a.modal.width,height:a.modal.height})).align("center","center",a.modal.offsetX);this._modalStartY=this._modalView.y;this._settingsText=(new t({parent:this._modalView,text:r.get("PAUSED"),color:a.settingsScreen.color,fontSize:a.settingsScreen.header.fontSize,textAlign:"center",y:a.settingsScreen.padding})).align("center");this._yourScoreText=(new t({parent:this._modalView,color:a.settingsScreen.color,fontSize:a.settingsScreen.yourScore.fontSize,textAlign:"center",y:a.settingsScreen.yourScore.y})).align("center");this._highScoreText=(new t({parent:this._modalView,color:a.settingsScreen.color,fontSize:a.settingsScreen.highScore.fontSize,textAlign:"center",y:a.settingsScreen.highScore.y})).align("center");n=a.settingsScreen.button;var i=a.margin/2;this._quitButton=(new o({parent:this._modalView,image:n.image,text:r.get("QUIT"),defaultImageY:n.quitImageY,x:this._modalView.width/2-n.width-i,y:n.y,width:n.width,height:n.height})).on("pressed",this,"_onPressedQuit");this._continueButton=(new o({parent:this._modalView,image:n.image,text:r.get("CONTINUE"),x:this._modalView.width/2+i,y:a.settingsScreen.button.y,width:n.width,height:n.height})).on("pressed",this,"_onPressedContinue")},_onPressPlaySound:function(){logger.log("toggle sound")},_onPressedContinue:function(){i.play("input");this._continueButton.disable();this.fire("continue")},_onPressedQuit:function(){i.play("input");this._quitButton.disable();this.fire("quit")},show:function(e){this._modalView.y=-this._modalView.height;this._quitButton.enable();this._continueButton.enable();this._yourScoreText.text=r.get("YOUR_SCORE")+" "+e;this._highScoreText.text=r.get("HIGH_SCORE")+" "+s.get("highScore");this._super();this._modalView.tween({y:this._modalStartY},500,n.easeOut)},hide:function(e){var t=this._super;this._modalView.tween({y:-this._modalView.height},500,n.easeIn,function(){t();e&&e()})},tick:function(e){this._super&&this._super(e)}})});define("js/OnslaughtDefense","djinn/Game djinn/View djinn/TextView djinn/globalTimer djinn/assets djinn/client djinn/stage djinn/intl ./model/GameModel ./view/TitleScreen ./view/BattleScreen ./view/GameOverScreen ./view/SettingsScreen ./view/polish ./view/viewData ./Sound".split(" "),function(e,t,n,r,i,s,o,u,a,f,l,c,h,p,d,v){return e.extend({init:function(e){this._super(merge(e,{showFPS:!1,eraseBeforeRender:!1}));n.defaults.color=d.color;n.defaults.fontFamily=d.fontFamily;n.defaults.fontSize=d.fontSize;n.defaults.shadowColor=d.shadowColor;s.on("orientationChange",this,"_updateOrientation");(new n({parent:this.view,text:u.get("LOADING"),textAlign:"center"})).align("center","center");i.load([d.titleScreen.image,d.titleScreen.title.image,d.titleScreen.monsters.image,d.button.image],bind(this,function(){this._preloadImages();this._makeViews();this._updateOrientation();this._titleScreen.show();!s.isIOS&&v.load()}));s.isIOS&&o.on("initialInput",function(){v.load()})},_makeViews:function(){var e=new t({acceptInputEvents:!0,parent:this.view,clip:!0,backgroundColor:d.backgroundColor,width:d.width,height:d.height});this._battleScreen=(new l({parent:e,visible:!1})).on("gameOver",this,"_onGameOver").on("pressedPause",this,"_onPressedPause");this._gameOverScreen=(new c({parent:e,visible:!1})).on("pressedContinue",this,"_onPressedGameOverContinue").on("pressedQuit",this,"_onPressedGameOverQuit");this._settingsScreen=(new h({parent:e,visible:!1})).on("quit",this,"_onPressedSettingsQuit").on("continue",this,"_onPressedSettingsContinue");this._titleScreen=(new f({parent:e,opacity:0})).on("playButton",this,"_onPressedPlay")},_onGameOver:function(e){this._gameOverScreen.delayTween(500,bind(this,function(){/*play68_submitScore(e);Play68.setRankingScoreDesc(e);*/var t=a.get("highScore");this._gameOverScreen.gotNewHighScore=e>t;this._gameOverScreen.monstersSlain=e;this._gameOverScreen.opacity=1;this._gameOverScreen.show();e>t&&a.set("highScore",e)}))},_onPressedGameOverContinue:function(){p.fadeOut(this._battleScreen,250);this._battleScreen.reset();this._gameOverScreen.hide(bind(this,function(){this._gameOverScreen.hide();this._battleScreen.show();p.fadeIn(this._battleScreen,500,bind(this,function(){this._battleScreen.start()}))}))},_onPressedGameOverQuit:function(){p.fadeOut(this._battleScreen,250);this._gameOverScreen.hide(bind(this,function(){this._titleScreen.show()}))},_onPressedSettingsQuit:function(){p.fadeOut(this._battleScreen,250);this._settingsScreen.hide(bind(this,function(){this._titleScreen.show()}))},_onPressedSettingsContinue:function(){this._settingsScreen.hide(bind(this,function(){this._battleScreen.togglePause()}))},_onPressedPause:function(e){this._battleScreen.togglePause();this._settingsScreen.show(e)},_onPressedPlay:function(){p.fadeOut(this._battleScreen,250);this._battleScreen.reset();p.fadeOut(this._titleScreen,500,bind(this,function(){this._titleScreen.hide();this._battleScreen.show();p.fadeIn(this._battleScreen,500,bind(this,function(){this._battleScreen.start()}))}))},_preloadImages:function(){i.load("media/images/bar_filler.png media/images/battle_field.png media/images/buttons_colored_narrow.png media/images/header_panel.png media/images/high_score_dragon.png media/images/lever.png media/images/modal.png media/images/objects.png media/images/pause.png media/images/xam.png media/images/checkbox.png media/images/monsters/bat.png media/images/monsters/demoblin.png media/images/monsters/flaming_skull.png media/images/monsters/gel.png media/images/monsters/goblin.png media/images/monsters/wizard.png media/images/monsters/owlbear.png media/images/monsters/cyclops.png media/images/monsters/green_dragon.png".split(" "),bind(this,function(){this._titleScreen.doneLoading()}))},_updateOrientation:function(){"portrait"!=s.orientation&&this._battleScreen.running&&(this._settingsScreen.show(),this._battleScreen.pause())}})});require(["djinn/global","djinn/manifest","djinn/assets","djinn/stage"],function(e,t,n,r){n.cacheImage("__rotateImage","data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgFBQUGBQgGBggLBwYHCw0KCAgKDQ8MDA0MDA8RDA0NDQ0MEQ8REhMSEQ8XFxkZFxciISEhIiYmJiYmJiYmJib/2wBDAQgJCRAOEB0UFB0gGhUaICYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJib/wAARCAD6APo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YRSUYrckgPQAAAAAAAAAAAAAAAAAAAAAAAAAAAVbSu2pUrunVglGVZNzy4tNbfjA0oAAAAlYbh1a/uFSprorJ1J8Ix/wD24C6WlrRtKEaFGOrCPlb4t9oGUAAAAAAAAAAAAAAAAAAAAAAAAAAABtJZvct4FHxXEJ395Ks9lNdGmuqKezxsCIAAAfdGlOtVhSprOdRqMV2sC8YfYUbG2jQpcNs5cZS4tgSAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPJJSTT3NZMCh3ls7a6q27ebpycc+tcGBhAAANrozbd2xOM2s40Iufj9avOBbgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADVYlo9b31x6I7o6U5JKeSTTy2JgR46IW6fSuJtdiS/eB7PRG0a6FepF8c0n+4CPU0Qq7e53EX1KUWvM2BscEwWWHd0nUmqlSpkuitiS7/AFgbMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//Z");r.matchSize(t.sizes);require(["js/OnslaughtDefense"],function(e){(new e).run()})})
|