sinzmise-cetastories 1.6.0-1717745487767 → 1.6.0-1717748990665

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. package/404/index.html +1 -1
  2. package/404.html +1 -1
  3. package/about/index.html +1 -1
  4. package/album/index.html +1 -1
  5. package/archives/2021/12/index.html +1 -1
  6. package/archives/2021/index.html +1 -1
  7. package/archives/2022/12/index.html +1 -1
  8. package/archives/2022/index.html +1 -1
  9. package/archives/2023/01/index.html +1 -1
  10. package/archives/2023/02/index.html +1 -1
  11. package/archives/2023/03/index.html +1 -1
  12. package/archives/2023/04/index.html +1 -1
  13. package/archives/2023/07/index.html +1 -1
  14. package/archives/2023/08/index.html +1 -1
  15. package/archives/2023/09/index.html +1 -1
  16. package/archives/2023/10/index.html +1 -1
  17. package/archives/2023/11/index.html +1 -1
  18. package/archives/2023/12/index.html +1 -1
  19. package/archives/2023/index.html +1 -1
  20. package/archives/2023/page/2/index.html +1 -1
  21. package/archives/2023/page/3/index.html +1 -1
  22. package/archives/2024/01/index.html +1 -1
  23. package/archives/2024/02/index.html +1 -1
  24. package/archives/2024/03/index.html +1 -1
  25. package/archives/2024/04/index.html +1 -1
  26. package/archives/2024/05/index.html +1 -1
  27. package/archives/2024/index.html +1 -1
  28. package/archives/2024/page/2/index.html +1 -1
  29. package/archives/index.html +1 -1
  30. package/archives/page/2/index.html +1 -1
  31. package/archives/page/3/index.html +1 -1
  32. package/archives/page/4/index.html +1 -1
  33. package/atom.xml +21 -21
  34. package/baidu_verify_codeva-NA6uDlCuZg.html +1 -1
  35. package/baidusitemap.xml +35 -35
  36. package/bangumis/index.html +1 -1
  37. package/bbs/index.html +1 -1
  38. package/cacheList.json +1 -1
  39. package/categories/index.html +1 -1
  40. package/categories//344/270/252/344/272/272/345/260/217/350/256/260/index.html +1 -1
  41. package/categories//344/270/252/344/272/272/345/260/217/350/256/260/page/2/index.html +1 -1
  42. package/categories//346/255/214/346/233/262/346/224/266/351/233/206/index.html +1 -1
  43. package/categories//346/270/270/346/210/217/347/233/270/345/205/263/index.html +1 -1
  44. package/categories//347/253/231/347/202/271/346/212/230/350/205/276/index.html +1 -1
  45. package/categories//347/253/231/347/202/271/346/212/230/350/205/276/page/2/index.html +1 -1
  46. package/categories//351/241/271/347/233/256/346/212/230/350/205/276/index.html +1 -1
  47. package/charts/index.html +1 -1
  48. package/comments/index.html +1 -1
  49. package/css/custom2.css +1 -0
  50. package/css/plane.css +1 -0
  51. package/essay/index.html +1 -1
  52. package/fcircle/index.html +1 -1
  53. package/google8073542809160a67.html +1 -1
  54. package/index.html +1 -1
  55. package/js/plane.js +1 -0
  56. package/link/index.html +1 -1
  57. package/music/index.html +1 -1
  58. package/package.json +1 -1
  59. package/page/2/index.html +1 -1
  60. package/page/3/index.html +1 -1
  61. package/page/4/index.html +1 -1
  62. package/posts/10021/index.html +1 -1
  63. package/posts/10045/index.html +1 -1
  64. package/posts/10996/index.html +1 -1
  65. package/posts/12779/index.html +1 -1
  66. package/posts/13624/index.html +1 -1
  67. package/posts/15748/index.html +1 -1
  68. package/posts/15842/index.html +1 -1
  69. package/posts/16107/index.html +1 -1
  70. package/posts/18063/index.html +1 -1
  71. package/posts/20412/index.html +1 -1
  72. package/posts/21375/index.html +1 -1
  73. package/posts/22945/index.html +1 -1
  74. package/posts/23021/index.html +1 -1
  75. package/posts/27531/index.html +1 -1
  76. package/posts/27762/index.html +1 -1
  77. package/posts/28536/index.html +1 -1
  78. package/posts/28733/index.html +1 -1
  79. package/posts/29196/index.html +1 -1
  80. package/posts/38917/index.html +1 -1
  81. package/posts/38964/index.html +1 -1
  82. package/posts/42487/index.html +1 -1
  83. package/posts/42580/index.html +1 -1
  84. package/posts/45875/index.html +1 -1
  85. package/posts/48762/index.html +1 -1
  86. package/posts/50710/index.html +1 -1
  87. package/posts/52677/index.html +1 -1
  88. package/posts/53662/index.html +1 -1
  89. package/posts/54386/index.html +1 -1
  90. package/posts/54481/index.html +1 -1
  91. package/posts/54787/index.html +1 -1
  92. package/posts/56467/index.html +1 -1
  93. package/posts/57692/index.html +1 -1
  94. package/posts/58203/index.html +1 -1
  95. package/posts/61417/index.html +1 -1
  96. package/posts/646/index.html +1 -1
  97. package/seas/index.html +1 -1
  98. package/sitemap.xml +45 -45
  99. package/tags/Flash/347/233/270/345/205/263/index.html +1 -1
  100. package/tags/Steam/346/270/270/346/210/217/index.html +1 -1
  101. package/tags/Windows/350/275/257/344/273/266/index.html +1 -1
  102. package/tags/index.html +1 -1
  103. package/tags//344/270/252/344/272/272/345/260/217/350/256/260/index.html +1 -1
  104. package/tags//344/270/252/344/272/272/345/260/217/350/256/260/page/2/index.html +1 -1
  105. package/tags//345/205/266/345/256/203/346/270/270/346/210/217/index.html +1 -1
  106. package/tags//346/202/254/346/265/256/345/256/240/347/211/251-/347/234/213/346/235/277/345/250/230/index.html +1 -1
  107. package/tags//346/255/214/346/233/262/346/224/266/351/233/206/index.html +1 -1
  108. package/tags//346/270/270/346/210/217/347/233/270/345/205/263/index.html +1 -1
  109. package/tags//347/253/231/347/202/271/345/272/225/351/203/250/351/255/224/346/224/271/index.html +1 -1
  110. package/tags//347/253/231/347/202/271/346/212/230/350/205/276/index.html +1 -1
  111. package/tags//347/253/231/347/202/271/346/212/230/350/205/276/page/2/index.html +1 -1
  112. package/tags//350/207/252/345/273/272/351/203/250/347/275/262/index.html +1 -1
  113. package/tags//351/241/265/351/235/242/351/255/224/346/224/271/index.html +1 -1
  114. package/tags//351/241/271/347/233/256/346/212/230/350/205/276/index.html +1 -1
  115. package/update/index.html +1 -1
  116. package/update.json +1 -1
package/js/plane.js ADDED
@@ -0,0 +1 @@
1
+ (function(window){var JSONP=function(){var t,e,s,i=0,n=this;return{get:function(a,o,h){for(s in e="?",o=o||{})o.hasOwnProperty(s)&&(e+=encodeURIComponent(s)+"="+encodeURIComponent(o[s])+"&");var r="json"+ ++i;return n[r]=function(t){h(t);try{delete n[r]}catch(t){}n[r]=null},function(e){var s=document.createElement("script"),i=!1;s.src=e,s.async=!0,s.onload=s.onreadystatechange=function(){i||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(i=!0,s.onload=s.onreadystatechange=null,s&&s.parentNode&&s.parentNode.removeChild(s))},t||(t=document.getElementsByTagName("head")[0])||(t=document.body),t.appendChild(s)}(a+e+"callback="+r),r}}}(),CORS={request:function(t,e,s){if(this.calledByExtension())return this._callbacks[this._callbackId++]=s,void window.postMessage(JSON.stringify({from:"kickassapp-page",url:t,type:"callApi",params:e}),"*");e=e||{};var i="?";for(key in e)e.hasOwnProperty(key)&&(i+=encodeURIComponent(key)+"="+encodeURIComponent(e[key])+"&");var n=new XMLHttpRequest;n.onreadystatechange=function(){4==n.readyState&&s(JSON.parse(n.responseText))},n.open("GET",t+i),n.withCredentials=!0,n.setRequestHeader("Content-Type","application/json"),n.send()},calledByExtension:function(){return!!document.getElementById("kickass-has-been-initialized-yes-yes-yes")},_callbacks:{},_callbackId:0};function getGlobalNamespace(){return window&&window.INSTALL_SCOPE?window.INSTALL_SCOPE:window}CORS.calledByExtension()&&window.addEventListener("message",(function(t){var e;try{e=JSON.parse(t.data)}catch(t){return}if("kickassapp-extension"===e.from&&"kickassapp-extension-version1"===e.sanityCheck){var s=e.payload;"response"===s.type?(CORS._callbacks[s.requestId](s.body),delete CORS._callbacks[s.requestId]):"destroy"===s.type&&window.KICKASSGAME.destroy()}}),!1);var Class=function(t){var e=function(){return e.$prototyping?this:"function"==typeof this.initialize?this.initialize.apply(this,arguments):void 0};for(var s in t.Extends&&(e.parent=t.Extends,t.Extends.$prototyping=!0,e.prototype=new t.Extends,t.Extends.$prototyping=!1),t)t.hasOwnProperty(s)&&(e.prototype[s]=t[s]);return e};"undefined"!=typeof exports&&(exports.Class=Class);var Vector=new Class({initialize:function(t,e){"object"==typeof t?(this.x=t.x,this.y=t.y):(this.x=t,this.y=e)},cp:function(){return new Vector(this.x,this.y)},mul:function(t){return this.x*=t,this.y*=t,this},mulNew:function(t){return new Vector(this.x*t,this.y*t)},div:function(t){return this.x/=t,this.y/=t,this},divNew:function(t){return new Vector(this.x/t,this.y/t)},add:function(t){return this.x+=t.x,this.y+=t.y,this},addNew:function(t){return new Vector(this.x+t.x,this.y+t.y)},sub:function(t){return this.x-=t.x,this.y-=t.y,this},subNew:function(t){return new Vector(this.x-t.x,this.y-t.y)},rotate:function(t){var e=this.x,s=this.y;return this.x=e*Math.cos(t)-Math.sin(t)*s,this.y=e*Math.sin(t)+Math.cos(t)*s,this},rotateNew:function(t){return this.cp().rotate(t)},setAngle:function(t){var e=this.len();return this.x=Math.cos(t)*e,this.y=Math.sin(t)*e,this},setAngleNew:function(t){return this.cp().setAngle(t)},setLength:function(t){var e=this.len();return e?this.mul(t/e):this.x=this.y=t,this},setLengthNew:function(t){return this.cp().setLength(t)},normalize:function(){var t=this.len();return 0==t||(this.x/=t,this.y/=t),this},normalizeNew:function(){return this.cp().normalize()},angle:function(){return Math.atan2(this.y,this.x)},collidesWith:function(t){return this.x>t.x&&this.y>t.y&&this.x<t.x+t.width&&this.y<t.y+t.height},len:function(){var t=Math.sqrt(this.x*this.x+this.y*this.y);return t<.005&&t>-.005?0:t},is:function(t){return"object"==typeof t&&this.x==t.x&&this.y==t.y},dot:function(t){return this.x*t.x+this.y*t.y},inTriangle:function(t,e,s){var i=s.subNew(t),n=e.subNew(t),a=p.subNew(t),o=i.dot(i),h=i.dot(n),r=i.dot(a),l=n.dot(n),c=n.dot(a),d=1/(o*l-h*h),u=(l*r-h*c)*d,m=(o*c-h*r)*d;return u>0&&m>0&&u+m<1},distanceFrom:function(t){return Math.sqrt(Math.pow(this.x-t.x,2),Math.pow(this.y-t.y,2))},toString:function(){return"[Vector("+this.x+", "+this.y+") angle: "+this.angle()+", length: "+this.len()+"]"}});"undefined"!=typeof exports&&(exports.Vector=Vector);var Rect=new Class({initialize:function(t,e,s,i){this.pos=new Vector(t,e),this.size={width:s,height:i}},hasPoint:function(t){return t.x>this.getLeft()&&t.x<this.getRight()&&t.y>this.getTop()&&t.y<this.getBottom()},setLeft:function(t){this.pos.x=t+this.size.width/2},setTop:function(t){this.pos.y=t+this.size.height/2},getLeft:function(){return this.pos.x-this.size.width/2},getTop:function(){return this.pos.y-this.size.height/2},getRight:function(){return this.pos.x+this.size.width/2},getBottom:function(){return this.pos.y+this.size.height/2},cp:function(){return new Rect(this.pos.x,this.pos.y,this.size.width,this.size.height)}});"undefined"!=typeof exports&&(exports.Rect=Rect);var Fx=new Class({initialize:function(){this.listeners=[],this.tweens={},this.running={}},addListener:function(t){this.listeners.push(t)},add:function(t,e){if((e=e||{}).duration=e.duration||500,e.transition=e.transition||Tween.Linear,e.repeats=void 0!==e.repeats&&e.repeats,!e.tweens){var s=e.start||0,i=void 0===e.end?1:e.end;e.tweens=[[s,i]]}this.tweens[t]=e},update:function(t){for(var e in t="number"==typeof t?t:now(),this.tweens)if(this.tweens.hasOwnProperty(e)){if(!this.running[e]){this.tweenStart(e,t);continue}var s=this.tweens[e],i=t-this.running[e].startTime;if(i>s.duration){this.tweenFinished(s,e);continue}for(var n,a=s.transition(i/s.duration),o=[],h=0;n=s.tweens[h];h++){var r=a*(n[1]-n[0])+n[0];o.push(r)}this.fire(e,o,a)}},tweenStart:function(t,e){this.running[t]={startTime:e};for(var s,i=[],n=0;s=this.tweens[t].tweens[n];n++)i.push(s[0]);this.fire(t,i,0)},tweenFinished:function(t,e){for(var s,i=[],n=0;s=t.tweens[n];n++)i.push(s[1]);if(this.fire(e,i,1),!t.repeats)return delete this.running[e],void delete this.tweens[e];this.tweenStart(e,now())},fire:function(t,e,s){for(var i,n=0;i=this.listeners[n];n++)i.set.call(i,t,e,s)}}),Tween={Linear:function(t){return t},Quadratic:function(t){return t*t},Quintic:function(t){return t*t*t},Shake:function(t){return Math.sin(t)}},GameGlobals={FPS:60,useAnimationFrame:!0,boids:{flockRadius:400,size:100},path:function(){return"https://kickassapp.com/"+Array.prototype.slice.call(arguments).join("")},hasCanvas:void 0!==document.createElement("canvas").getContext,bulletColor:"black"};function now(){return(new Date).getTime()}function bind(t,e){return function(){return e.apply(t,arguments)}}function each(t,e,s){if("function"==typeof t.forEach)return t.forEach(e,s),t;for(var i in t)t.hasOwnProperty(i)&&e.call(s||window,t[i],i);return t}function addEvent(t,e,s){t.addEventListener?t.addEventListener(e,s,!1):t.attachEvent&&(t["e"+e+s]=s,t[e+s]=function(){return t["e"+e+s](window.event)},t.attachEvent("on"+e,t[e+s]))}function removeEvent(t,e,s){t.removeEventListener?t.removeEventListener(e,s,!1):t.detachEvent&&(t.detachEvent("on"+e,t[e+s]),t[e+s]=null,t["e"+e+s]=null)}function stopEvent(t){t.stopPropogation&&t.stopPropogation(),t.preventDefault&&t.preventDefault(),t.returnValue=!1}function elementIsContainedIn(t,e){return element.contains?t.contains(e):!!(16&t.compareDocumentPosition(e))}function code(t){var e={38:"up",40:"down",37:"left",39:"right",27:"esc"};return e[t]?e[t]:String.fromCharCode(t)}function random(t,e){return Math.floor(Math.random()*(e-t+1)+t)}function getRect(t){if("function"==typeof t.getBoundingClientRect){var e=t.getBoundingClientRect(),s=window.pageXOffset,i=window.pageYOffset;return{width:e.width,height:e.height,left:e.left+s,top:e.top+i}}e={width:t.offsetWidth,height:t.offsetHeight,left:0,top:0};for(var n=t;n;)e.left+=n.offsetLeft,e.top+=n.offsetTop,n=n.offsetParent;return e}function getCompatElement(){var t=document;return t.compatMode&&"CSS1Compat"!=t.compatMode?t.body:t.documentElement}function getScrollSize(){var t=getCompatElement(),e={x:t.clientWidth,y:t.clientHeight},s=document.body;return{x:Math.max(t.scrollWidth,s.scrollWidth,e.x),y:Math.max(t.scrollHeight,s.scrollHeight,e.y)}}function getStyle(t,e){return t.style[e]?t.style[e]:t.currentStyle?t.currentStyle[e]:document.defaultView.getComputedStyle(t,null).getPropertyValue(e)}function setStyles(t,e){for(var s in e)if(e.hasOwnProperty(s)){var i=e[s];"number"==typeof i&&"opacity"!==s&&"zIndex"!==s&&(i+="px"),t.style[s]=i}}function hasClass(t,e){return t.className.match(new RegExp("(\\s|^)"+e+"(\\s|$)"))}function addClass(t,e){hasClass(t,e)||(t.className+=" "+e)}function removeClass(t,e){if(hasClass(t,e)){var s=new RegExp("(\\s|^)"+e+"(\\s|$)");t.className=t.className.replace(s," ")}}function cloneElement(t){return t.cloneNode(!0)}function newElement(t,e){var s=document.createElement(t);for(var i in e)e.hasOwnProperty(i)&&("styles"===i?setStyles(s,e[i]):s[i]=e[i]);return s}window.GameGlobals=GameGlobals,Array.prototype.indexOf||(Array.prototype.indexOf=function(t){if(null==this)throw new TypeError;var e=Object(this),s=e.length>>>0;if(0===s)return-1;var i=0;if(arguments.length>0&&((i=Number(arguments[1]))!=i?i=0:0!==i&&i!==1/0&&i!==-1/0&&(i=(i>0||-1)*Math.floor(Math.abs(i)))),i>=s)return-1;for(var n=i>=0?i:Math.max(s-Math.abs(i),0);n<s;n++)if(n in e&&e[n]===t)return n;return-1});var requestAnimFrame=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t,e){window.setTimeout(t,1e3/60)};function delay(t,e,s){return setTimeout(bind(s,e),t)}var KickAss=new Class({initialize:function(t){t&&t.mySite&&(this.mySite=t.mySite),this.players=[],this.elements=[],this.weaponClass=Weapons[1].cannonClass,this.scrollPos=new Vector(0,0),this.scrollSize=new Vector(0,0),this.windowSize={width:0,height:0},this.updateWindowInfo(),this.bulletManager=new BulletManager(this),this.bulletManager.updateEnemyIndex(),this.explosionManager=new ExplosionManager(this),this.ui=new UIManager(this),this.bombManager=new BombManager(this),this.menuManager=new MenuManager(this),this.menuManager.create(),void 0!==StatisticsManager&&(this.statisticsManager=new StatisticsManager(this)),this.sessionManager=new SessionManager(this),this.lastUpdate=now(),this.keyMap={},this.keydownEvent=bind(this,this.keydown),this.keyupEvent=bind(this,this.keyup),this.multiplier=10,this.isCampaign()?this.audioManager={explosion:new AudioManager(GameGlobals.path("static/sounds/game/explosion"),["mp3","ogg"]),shot:new AudioManager(GameGlobals.path("static/sounds/game/shot"),["mp3","ogg"])}:this.audioManager={},window.KickAssStyle&&"white"===window.KickAssStyle&&(GameGlobals.bulletColor="white"),addEvent(document,"keydown",this.keydownEvent),addEvent(document,"keyup",this.keyupEvent),addEvent(document,"keypress",this.keydownEvent)},begin:function(){this.addPlayer(),this.sessionManager.isPlaying=!0,GameGlobals.useAnimationFrame||(this.loopTimer=window.setInterval(bind(this,this.loop),1e3/GameGlobals.FPS)),GameGlobals.useAnimationFrame&&requestAnimFrame(bind(this,this.loop))},keydown:function(t){var e=code(t.keyCode);switch(this.keyMap[e]=!0,e){case"left":case"right":case"up":case"down":case"esc":case" ":stopEvent(t)}if("esc"===e)this.destroy()},keyup:function(t){var e=code(t.keyCode);switch(this.keyMap[e]=!1,e){case"left":case"right":case"up":case"down":case"esc":case" ":t.stopPropogation&&t.stopPropogation(),t.preventDefault&&t.preventDefault(),t.returnValue=!1}},loop:function(){var t=now(),e=(t-this.lastUpdate)/1e3;this.updateWindowInfo();for(var s,i=0;s=this.players[i];i++)s.update(e);this.bulletManager.update(e),this.bombManager.update(e),this.explosionManager.update(e),this.ui.update(e),this.statisticsManager&&this.statisticsManager.update(e),this.sessionManager.update(e),this.lastUpdate=t,GameGlobals.useAnimationFrame&&requestAnimFrame(bind(this,this.loop))},addPlayer:function(){var t=Ships.Standard;window.KICKASSSHIP&&window.KICKASSSHIP.points&&(t=KICKASSSHIP),this.mySite&&this.mySite.getShipConfig()&&(t=this.mySite.getShipConfig());var e=new Player(this);e.setShip(t),this.players.push(e),this.explosionManager.addExplosion(e.pos)},registerElement:function(t){if(!t)throw new Error("Can't register unexisting element.");this.elements.push(t)},unregisterElement:function(t){this.elements.splice(this.elements.indexOf(t),1)},isKickAssElement:function(t){for(var e,s=0;e=this.elements[s];s++)if(t===e||elementIsContainedIn(e,t))return!0;return!1},isKeyPressed:function(t){return!!this.keyMap[t]},updateWindowInfo:function(){var t=!!window.ActiveXObject&&"BackCompat"==document.compatMode;this.windowSize={width:document.documentElement.clientWidth,height:document.documentElement.clientHeight},t&&(this.windowSize.width=document.body.clientWidth,this.windowSize.height=document.body.clientHeight),this.menuManager&&this.menuManager.isVisible()&&(this.windowSize.height-=this.menuManager.getHeight()),this.scrollPos.x=window.pageXOffset||document.documentElement.scrollLeft,this.scrollPos.y=window.pageYOffset||document.documentElement.scrollTop,this.scrollSize=getScrollSize()},hideAll:function(){for(var t,e=0;t=this.elements[e];e++)t.style.visibility="hidden"},showAll:function(){for(var t,e=0;t=this.elements[e];e++)t.style.visibility="visible"},updateShips:function(t,e){e||this.ui.showMessage("You're now flying<br /><em>"+t.name+"<em>!!");for(var s,i=0;s=this.players[i];i++)s.setShip(t)},changeWeapon:function(t,e){this.weaponClass=t.cannonClass,e||this.ui.showMessage("Changed to "+t.name.toUpperCase()+"!!!!");for(var s,i=0;s=this.players[i];i++)s.setCannons(t.cannonClass)},changeWeaponById:function(t,e){Weapons[t]&&this.changeWeapon(Weapons[t],e)},flyOutPlayers:function(t,e){for(var s,i=0;s=this.players[i];i++)s.flyTo(t,-s.size.height),s.isBound=!1},flyInPlayers:function(){for(var t,e=0;t=this.players[e];e++)t.flyTo(t.pos.x,100,(function(){this.isBound=!0}))},newRank:function(t){this.ui.showMessage("OMG. You leveled up to: <strong>"+t+"</strong>!<br /><small>Be sure to check what cool new stuff you get in the menu.</small>")},fireBomb:function(){this.bombManager.blow()},destroy:function(){removeEvent(document,"keydown",this.keydownEvent),removeEvent(document,"keypress",this.keydownEvent),removeEvent(document,"keyup",this.keyupEvent);for(var t,e=0;t=this.players[e];e++)t.destroy();this.bulletManager.destroy(),this.explosionManager.destroy(),this.menuManager.destroy(),GameGlobals.useAnimationFrame||clearInterval(this.loopTimer),getGlobalNamespace().KICKASSGAME=!1,this.isCampaign()&&document.location.reload()},isCampaign:function(){return getGlobalNamespace().IS_CLOUDFLARE_GAME},isMySite:function(){return!!getGlobalNamespace().KICKASS_SITE_KEY},shouldShowAd:function(){return!this.mySite&&!this.isCampaign()},shouldShowMenu:function(){return!this.mySite&&!this.isCampaign()},shouldShowHowToImage:function(){return this.mySite||this.isCampaign()}});window.KickAss=KickAss;var StatisticsManager=new Class({initialize:function(t){this.game=t,this.data={},this.data.startedPlaying=now(),this.data.elementsDestroyed=0,this.data.shotsFired=0,this.data.distanceFlownInPixels=0,this.data.totalPointsThisSession=0,this.data.usedThrusters=0,this.lastUpdate=0},usedThrusters:function(){this.data.usedThrusters=1},increaseDistanceWithPixels:function(t){this.data.distanceFlownInPixels+=t},increasePointsGainedWithPoints:function(t){this.data.totalPointsThisSession+=t},addShotFired:function(){this.data.shotsFired++,this.game.audioManager.shot&&this.game.audioManager.shot.play()},addElementsDestroyed:function(){this.data.elementsDestroyed++},update:function(t){this.lastUpdate+=t,this.lastUpdate>.25&&(this.syncWithServer(),this.lastUpdate=0)},syncWithServer:function(){var t=[];for(var e in this.data)this.data.hasOwnProperty(e)&&t.push(e+":"+this.data[e]);this.game.menuManager.sendMessageToMenu("stats:!"+t.join("|"))}}),MySite=new Class({initialize:function(t){this.key=t},load:function(t){CORS.request(GameGlobals.path("mysite/api.json"),{site_key:this.key,url:document.location.toString()},bind(this,(function(e){e&&e.embed?(this.mySiteData=e.embed,t(!0)):t(!1)})))},install:function(){},getShipId:function(){return this.mySiteData&&this.mySiteData.settings.ship},getShipConfig:function(){return this.mySiteData&&this.mySiteData.settings.ship_config},getShareURL:function(){return this.mySiteData&&this.mySiteData.settings.share_url}}),Menu=new Class({initialize:function(t){this.game=t,this.size={height:300}},generate:function(t){this.container=document.createElement("div"),this.container.className="KICKASSELEMENT",this.container.id="kickass-profile-menu",t.appendChild(this.container);var e=getGlobalNamespace().KICKASSSHIPID||"";this.url=GameGlobals.path("intermediate_postmessage.html?url="+encodeURIComponent(getGlobalNamespace().KICKASSURL||document.location.href)+"&origin="+encodeURIComponent(document.location.href)+"&preship="+e+"&is_campaign="+(this.game.isCampaign()?"true":"")+"&is_mysite="+(this.game.isMySite()?"true":"")),this.isSocketReady=!1,this.socketIframe=document.createElement("iframe"),this.socketIframe.frameborder="0",this.socketIframe.className="KICKASSELEMENT",this.socketIframe.width="100%",this.socketIframe.height=this.size.height+"px",this.container.appendChild(this.socketIframe),this.menuOrigin="https://kickassapp.com/".replace(/\/$/,""),this.socketIframe.src=this.url,this.onMessage=bind(this,(function(t){if(t.origin===this.menuOrigin||t.origin===this.menuOrigin.replace("http://","https://")){var e=t.data;if("ready"!==e){var s=e.split(":!");if(2===s.length){var i=s.shift().replace(/^./g,(function(t){return t.charAt(0).toUpperCase()}));"function"==typeof this["messageType"+i]&&this["messageType"+i](s.join(":!"))}}else this.onGameReady()}else console.log("ignoring event from",t.origin)})),window.addEventListener("message",this.onMessage,!1),this.game.registerElement(this.container)},socketPostMessage:function(t){this.socketIframe.contentWindow.postMessage(t,this.menuOrigin)},onGameReady:function(){this.isSocketReady=!0,this.game.registerElement(this.container.getElementsByTagName("iframe")[0]),this.socketPostMessage("url:!"+(getGlobalNamespace().KICKASSURL||document.location.href)),this.game.statisticsManager&&this.game.statisticsManager.syncWithServer(),this.game.menuManager.onGameReady()},sendMessage:function(t){if(this.isSocketReady&&t!=this.lastMessage){try{this.socketPostMessage(t)}catch(t){}this.lastMessage=t}},messageTypeChangeShip:function(t){var e=(t=t.split(","))[0],s=(t[1],"initial"===t[2]);this.shipId!==e&&(s&&getGlobalNamespace().KICKASSSHIP||(this.shipId=e,CORS.request(GameGlobals.path("designer/ship/"+e+"/construction.json"),{ship_id:e,is_initial:s?"1":"0"},bind(this,(function(t){this.game.updateShips(t.data,s);try{window.focus()}catch(t){}}))),s||this.parent.hideMenu()))},messageTypeChangeWeapon:function(t,e){this.game.changeWeaponById(t,e)},messageTypeSetMultiplier:function(t){t=parseInt(t,10),!isNaN(t)&&t&&(this.game.multiplier=t)},messageTypeNewRank:function(t){this.game.newRank(t)},messageTypePlayerMessage:function(t){this.game.ui.showMessage(t)},destroy:function(){this.game.unregisterElement(this.container),this.game.unregisterElement(this.iframe),window.removeEventListener("message",this.onMessage,!1),this.container.parentNode.removeChild(this.container)}}),MenuManager=new Class({initialize:function(t){this.game=t,this.numPoints=0,getGlobalNamespace().KICKASS_INLINE_CSS||this.includeCSS(GameGlobals.path("css/menustyles.css"))},generateDefaults:function(){for(var t in Weapons)Weapons.hasOwnProperty(t)&&this.addWeapon(Weapons[t],t);this.hideBombMenu()},create:function(){this.container=document.createElement("div"),this.container.className="KICKASSELEMENT KICKASShidden "+(this.game.shouldShowMenu()?"":"KICKASSNOMENU"),this.container.id="kickass-menu",this.game.shouldShowMenu()?(this.container.style.bottom="-250px",this.container.style.display="none"):removeClass(this.container,"KICKASShidden"),getAppContainerElement().appendChild(this.container);this.container.innerHTML='<div id="kickass-howto-image" class="KICKASSELEMENT kickass-howto-invisible"></div><div id="kickass-pointstab" style="width: 200px;" class="KICKASSELEMENT"><div id="kickass-bomb-menu" class="KICKASSELEMENT KICKASShidden"><ul id="kickass-bomb-list" class="KICKASSELEMENT"></ul></div><div id="kickass-weapons-menu" class="KICKASSELEMENT KICKASShidden" style="display:none"><ul id="kickass-weapons-list" class="KICKASSELEMENT"></ul></div><div id="kickass-pointstab-wrapper" class="KICKASSELEMENT"><div id="kickass-points" class="KICKASSELEMENT">'+this.numPoints+'</div><div id="kickass-esctoquit" class="KICKASSELEMENT">Press esc to quit</div>'+this.getShareHTML()+"</div></div>",this.pointsTab=document.getElementById("kickass-pointstab"),this.pointsTabWrapper=document.getElementById("kickass-pointstab-wrapper"),this.points=document.getElementById("kickass-points"),this.escToQuit=document.getElementById("kickass-esctoquit"),this.howToImage=document.getElementById("kickass-howto-image"),this.weaponsMenu=document.getElementById("kickass-weapons-menu"),this.weaponsList=document.getElementById("kickass-weapons-list"),this.bombLink=document.getElementById("kickass-bomb-menu");for(var t=this.container.getElementsByTagName("*"),e=0;e<t.length;e++)this.game.registerElement(t[e]);this.game.registerElement(this.container),this.game.shouldShowMenu()?(this.menu=new Menu(this.game),this.menu.parent=this,this.menu.generate(this.container)):setTimeout(function(){this.onGameReady()}.bind(this),100),addEvent(this.bombLink,"click",bind(this,(function(t){stopEvent(t),this.game.fireBomb()}))),addEvent(this.pointsTabWrapper,"click",bind(this,this.toggleMenu)),addEvent(this.weaponsMenu,"click",bind(this,this.toggleWeaponsMenu)),this.generateDefaults()},getShareHTML:function(){return""},onGameReady:function(){this.container.style.display="block",this.game.shouldShowHowToImage()&&(setTimeout(bind(this,(function(){removeClass(this.howToImage,"kickass-howto-invisible")})),10),setTimeout(bind(this,(function(){addClass(this.howToImage,"kickass-howto-invisible")})),4e3))},navigateTo:function(t,e){e||this.showMenu(),this.menu&&this.menu.socketPostMessage("navigate:!"+t)},toggleMenu:function(){this.game.shouldShowMenu()?hasClass(this.container,"KICKASShidden")?this.showMenu():this.hideMenu():this.showMenu()},toggleWeaponsMenu:function(){hasClass(this.weaponsMenu,"KICKASShidden")?this.showWeaponsMenu():this.hideWeaponsMenu()},hideWeaponsMenu:function(){this.weaponsMenu.style.width="",addClass(this.weaponsMenu,"KICKASShidden")},showWeaponsMenu:function(){var t=this.weaponsMenu.getElementsByTagName("li");t=t[t.length-1],this.weaponsMenu.style.width=t.offsetLeft+t.offsetWidth-47+"px",removeClass(this.weaponsMenu,"KICKASShidden")},showMenu:function(){this.game.shouldShowMenu()&&(this.container.style.bottom="",removeClass(this.container,"KICKASShidden"))},hideMenu:function(){this.container.style.bottom="",addClass(this.container,"KICKASShidden")},showBombMenu:function(){this.bombLink.style.width=""},hideBombMenu:function(){this.bombLink.style.width="0px"},getHeight:function(){return this.container.clientHeight},isVisible:function(){return!hasClass(this.container,"KICKASShidden")},addPoints:function(t,e){var s=t*this.game.multiplier;this.numPoints+=s,this.points.innerHTML=this.numPoints,this.game.statisticsManager&&this.game.statisticsManager.increasePointsGainedWithPoints(s),this.game.ui.addPointsBubbleAt(e,s)},includeCSS:function(t){var e=document.createElement("link");e.rel="stylesheet",e.type="text/css",e.href=t,(document.head||document.body).appendChild(e)},sendMessageToMenu:function(t){this.menu&&this.menu.sendMessage(t)},addWeapon:function(t,e){var s=document.createElement("li");s.className="KICKASSELEMENT kickass-weapon-item",s.weapon=t,s.style.backgroundImage="url("+GameGlobals.path("css/gfx/kickass/weap-"+t.id+".png")+")",s.innerHTML='<span class="KICKASSELEMENT">'+t.name+"</span>",this.weaponsList.appendChild(s),addEvent(s,"click",bind(this,(function(s){stopEvent(s),this.changeWeapon(t),this.sendMessageToMenu("changeWeapon:!"+e)})))},changeWeapon:function(t){this.game.changeWeapon(t)},destroy:function(){for(var t=this.container.getElementsByTagName("*"),e=0;e<t.length;e++)this.game.unregisterElement(t[e]);this.game.unregisterElement(this.container),this.menu&&this.menu.destroy(),this.container.parentNode.removeChild(this.container)}}),UIManager=new Class({initialize:function(t){this.UNIQID=0,this.game=t,this.pointBubbles={},this.messages={},this.fx=new Fx,this.fx.addListener(this)},update:function(t){this.fx.update()},set:function(t,e,s){var i=t.split("-")[0],n=t.split("-")[1];if(this.pointBubbles[n]){var a=this.pointBubbles[n];a.style.top=e[0]+"px",a.style.opacity=e[1],1==s&&a.parentNode&&(a.parentNode.removeChild(a),delete this.pointBubbles[n])}else if(this.messages[n]&&"messagedown"==i){(o=this.messages[n]).style.top=e[0]+"px",1==s&&setTimeout(bind(this,(function(){this.fx.add("messageup-"+n,{tweens:[[e[0],-100]],transition:Tween.Quadratic,duration:300})})),o.staytime||4e3)}else if(this.messages[n]&&"messageup"==i){var o;(o=this.messages[n]).style.top=e[0]+"px",1==s&&(o.parentNode.removeChild(o),delete this.messages[n])}},addPointsBubbleAt:function(t,e){var s="bubble"+this.UNIQID++,i=this.game.scrollPos.y+t.y,n=newElement("span",{innerHTML:e,className:"KICKASSELEMENT",styles:{position:"absolute",font:"20px Arial",fontWeight:"bold",opacity:"1",color:"black",textShadow:"#fff 1px 1px 3px",top:i,zIndex:"10000000"}});n.style.left=t.x-n.offsetWidth/2+"px",getAppContainerElement().appendChild(n),this.pointBubbles[s]=n,this.fx.add("bubble-"+s,{tweens:[[i,i-15],[1,0]]})},showMessage:function(t,e){e=e||!1;var s=this.UNIQID++,i=newElement("div",{innerHTML:t,className:"KICKASSELEMENT",id:"kickass-message-"+s,styles:{position:"fixed",top:-100,left:"50%",marginLeft:-150,width:300,background:"#222",opacity:.8,padding:"10px",color:"#fff",textAlign:"center",borderRadius:15,font:"20px Arial",fontWeight:"bold",zIndex:"10000000"}});i.staytime=e,getAppContainerElement().appendChild(i);var n=this.getLowestBubbleY();return i.kickassto=n,this.fx.add("messagedown-"+s,{duration:300,tweens:[[-100,n]],transition:Tween.Quadratic}),this.messages[s]=i,i},getLowestBubbleY:function(){var t=100;for(var e in this.messages)this.messages.hasOwnProperty(e)&&(t=Math.max(this.messages[e].kickassto+this.messages[e].offsetHeight+10,t));return t}}),AudioManager=new Class({initialize:function(t,e){if(this.src=t,this.formats=e,channels=8,this.supportsAudio=void 0!==document.createElement("audio").play,this.supportsAudio){this.numChannels=channels,this.channels=[];for(var s=0;s<this.numChannels;s++)this.channels.push({isPlaying:!1,element:this.prepareElement(this.buildAudioElement())})}},buildAudioElement:function(){for(var t,e={ogg:"audio/ogg",mp3:"audio/mpeg"},s=document.createElement("audio"),i=0;t=this.formats[i];i++){var n=document.createElement("source");n.src=this.src+"."+t,n.type=e[t],s.appendChild(n)}return s},prepareElement:function(t){if(void 0===t.addEventListener)return t;var e=this;return t.addEventListener("ended",(function(s){e.audioEnded(t)}),!1),t},audioEnded:function(t){for(var e,s=0;e=this.channels[s];s++)e.element===t&&(e.isPlaying=!1)},play:function(){if(this.supportsAudio)for(var t,e=0;t=this.channels[e];e++)if(!t.isPlaying)return t.isPlaying=!0,void("function"==typeof t.element.play&&t.element.play())}}),Ships={Standard:{points:[[-10,10],[0,-15],[10,10]],thrusters:[{s:{w:20,h:7},p:{x:0,y:14},a:0}],cannons:[{p:{x:0,y:-15},a:0}]}},PLAYERIDS=0,Player=new Class({initialize:function(t){this.id=PLAYERIDS++,this.game=t,this.tween=!1,this.isBound=!0,this.pos=new Vector(1630,217),this.vel=new Vector(0,0),this.acc=new Vector(0,0),this.dir=new Vector(0,1),this.currentRotation=0,this.isBroken=!1,this.lineOffsets=[],this.deadTime=0,this.friction=.95,this.terminalVelocity=2e3,this.lastPos=new Vector(0,0)},setShip:function(t){this.ship=t,this.verts=[];for(var e,s=0;e=this.ship.points[s];s++)this.verts.push(new Vector(e[0],e[1]));this.verts.push(this.verts[0]),this.thrusters=[],this.cannons=[],this.addThrusters(this.ship.thrusters),this.addCannons(this.ship.cannons),this.size=this.getSizeFromVertsAndObjects(),this.bounds=this.calculateBounds(),this.sheet&&this.sheet.destroy(),this.sheet=new Sheet(new Rect(100,100,this.bounds.x,this.bounds.y)),this.forceRedraw=!0},setCannons:function(t){for(var e,s=[],i=0;e=this.cannons[i];i++){var n=new t(this,this.game,e.pos.x,e.pos.y,e.angle);s.push(n),e.destroy()}this.cannons=s},addThrusters:function(t){for(var e,s=0;e=t[s];s++){var i=new Thruster(e);this.thrusters.push(i)}},addCannons:function(t){for(var e,s=0;e=t[s];s++){var i=new(WeaponMap[e.m]||WeaponMap.cannon).cannonClass(this,this.game,e.p.x,e.p.y,e.a);i.player=this,i.game=this.game,this.cannons.push(i)}},update:function(t){if(this.isBroken){if(!this.lineOffsets.length)for(var e=0;e<this.verts.length-1;e++)this.lineOffsets[e]={pos:new Vector(0,0),dir:new Vector(1,1).setAngle(2*Math.PI*Math.random())};for(e=0;e<this.lineOffsets.length;e++)this.lineOffsets[e].pos.add(this.lineOffsets[e].dir.cp().setLength(50).mul(t));return this.sheet.clear(),this.sheet.setAngle(this.dir.angle()),this.sheet.setPosition(this.pos),this.sheet.drawBrokenPlayer(this.verts,this.lineOffsets),void(now()-this.deadTime>1e3&&(this.isBroken=!1,this.lineOffsets=[],this.randomPos()))}this.tween||(this.game.isKeyPressed("left")||this.game.isKeyPressed("right")?(this.game.isKeyPressed("left")&&this.rotateLeft(t),this.game.isKeyPressed("right")&&this.rotateRight(t)):this.stopRotate(),this.game.isKeyPressed("up")?this.activateThrusters():this.stopThrusters()),this.game.isKeyPressed(" ")?(this.isShooting=!0,this.isBroken||this.shootPressed()):this.isShooting&&(this.isShooting=!1,this.shootReleased()),this.currentRotation&&this.dir.setAngle(this.dir.angle()+this.currentRotation*t);var s=this.acc.mulNew(t).sub(this.vel.mulNew(t*this.friction));this.vel.add(s),this.vel.len()>this.terminalVelocity&&this.vel.setLength(this.terminalVelocity);var i=this.vel.mulNew(t);this.pos.add(i),this.game.statisticsManager&&this.game.statisticsManager.increaseDistanceWithPixels(i.len());var n=!this.acc.is({x:0,y:0});for(e=0;a=this.thrusters[e];e++)a.setIsShown(n),a.update(t);if(this.isBound&&this.checkBounds(),!this.lastPos.is(this.pos)||this.currentRotation||this.forceRedraw){if(this.forceRedraw=!1,this.sheet.clear(),this.sheet.setAngle(this.dir.angle()+Math.PI/2),this.sheet.setPosition(this.pos),n){var a;for(e=0;a=this.thrusters[e];e++)a.drawTo(this.sheet)}this.sheet.drawPlayer(this.verts),this.lastPos=this.pos.cp()}var o;for(e=0;o=this.cannons[e];e++)o.update(t)},randomPos:function(){var t=this.game.windowSize.width,e=this.game.windowSize.height;this.pos=new Vector(random(0,t),random(0,e))},checkBounds:function(){if(!this.tween){var t=this.game.windowSize.width,e=this.game.windowSize.height,s=this.pos.x+this.sheet.rect.size.width/2,i=this.pos.y+this.sheet.rect.size.height/2;s>t?(window.scrollTo(this.game.scrollPos.x+50,this.game.scrollPos.y),this.pos.x=0):this.pos.x<0&&(window.scrollTo(this.game.scrollPos.x-50,this.game.scrollPos.y),this.pos.x=t-this.sheet.rect.size.width/2),i>e?(window.scrollTo(this.game.scrollPos.x,this.game.scrollPos.y+.75*e),this.pos.y=0):this.pos.y<0&&(window.scrollTo(this.game.scrollPos.x,this.game.scrollPos.y-.75*e),this.pos.y=e-this.sheet.rect.size.height/2)}},inRect:function(t){for(var e,s=!1,i=0;e=this.verts[i];i++)t.hasPoint(new Vector(e.x+this.pos.x,e.y+this.pos.y))&&(s=!0);return s},hit:function(t){this.isBroken||(this.isBroken=!0,this.deadTime=now())},activateThrusters:function(){this.game.statisticsManager&&this.game.statisticsManager.usedThrusters(),this.acc=new Vector(500,0).setAngle(this.dir.angle())},stopThrusters:function(){this.acc=new Vector(0,0)},rotateLeft:function(t){this.currentRotation=Math.max(2*-Math.PI,this.currentRotation-10*Math.PI*t)},rotateRight:function(t){this.currentRotation=Math.min(2*Math.PI,this.currentRotation+10*Math.PI*t)},stopRotate:function(){this.currentRotation=0},getSizeFromVertsAndObjects:function(){for(var t,e=0,s=0;t=this.verts[s];s++)e=Math.max(e,new Vector(t).len());var i;for(s=0;i=this.thrusters[s];s++){var n=new Vector(i.pos.x-i.size.width/2,i.pos.y-i.size.height/2).rotate(i.angle),a=new Vector(i.pos.x+i.size.width/2,i.pos.y-i.size.height/2).rotate(i.angle),o=new Vector(i.pos.x-i.size.width/2,i.pos.y+i.size.height/2).rotate(i.angle),h=new Vector(i.pos.x+i.size.width/2,i.pos.y+i.size.height/2).rotate(i.angle);e=Math.max(e,n.len(),a.len(),o.len(),h.len())}return{width:2*e,height:2*e}},calculateBounds:function(){return{x:1*Math.max(this.size.width,this.size.height),y:1*Math.max(this.size.height,this.size.width)}},shootPressed:function(){for(var t,e=0;t=this.cannons[e];e++)t.shootPressed()},shootReleased:function(){for(var t,e=0;t=this.cannons[e];e++)t.shootReleased()},flyTo:function(t,e,s){this.tween={start:{pos:this.pos.cp(),dir:this.dir.cp()},to:new Vector(t,e),callback:s||function(){}},this.tween.time=this.getTimeforTween()},destroy:function(){this.sheet.destroy()}}),Thruster=new Class({initialize:function(t,e){this.pos=new Vector(t.p),this.size={width:t.s.w,height:t.s.h},this.angle=t.a||0,this.ship=e,this.isShown=!1,this.flameY=1,this.fx=new Fx,this.fx.addListener(this),this.flames={r:[],y:[]},this.lastFrameUpdate=0,this.generateFlames()},update:function(t){this.fx.update(),now()-this.lastFrameUpdate>1e3/60&&this.generateFlames()},set:function(t,e){if("flames"===t)this.flameY=e},setIsShown:function(t){!this.isShown&&t&&(this.flameY=0,this.generateFlames(),this.fx.add("flames",{start:this.flameY,end:1,duration:250,transition:Tween.Quintic})),this.isShown=t},drawTo:function(t){t.drawFlames(this.flames,this.angle)},generateFlames:function(){var t=this.size.width,e=.05*this.size.width,s=.8*this.size.width,i=.1*s,n=t/2,a=s/2,o=(this.size.height,this.pos.x),h=this.pos.y-this.size.height/2;function r(t,e){return new Vector(t,e)}this.flames.r=[r(-n+o,h)],this.flames.y=[r(-a+o,h)],this.flames.self=this;for(var l=0;l<t;l+=e)this.flames.r.push(r(l-n+o,this.flameY*random(.7*this.size.height,this.size.height)+h));this.flames.r.push(r(n+o,h));for(l=0;l<s;l+=i)this.flames.y.push(r(l-a+o,this.flameY*random(.4*this.size.height,.7*this.size.height)+h));this.flames.y.push(r(a+o,h)),this.lastFrameUpdate=now();for(var c=r(o,h),d=0;u=this.flames.r[d];d++)u.sub(c).rotate(this.angle).add(c);var u;for(d=0;u=this.flames.y[d];d++)u.sub(c).rotate(this.angle).add(c)}}),BombManager=new Class({initialize:function(t){this.game=t,this.bombShowDelay=30,this.nextBomb=this.bombShowDelay},update:function(t){this.game.isKeyPressed("F")&&this.isReady()&&this.blow(),-1!==this.nextBomb&&this.game.sessionManager.isPlaying&&(this.nextBomb-=t,this.nextBomb<0&&(this.game.menuManager.showBombMenu(),this.nextBomb=-1,this.game.ui.showMessage("BOMB IS READY<br />(lower right corner or F)")))},blow:function(){var t=this.game.ui.showMessage("3...",5e3);delay(1e3,(function(){t.innerHTML="2..."}),this),delay(2e3,(function(){t.innerHTML="1..."}),this),delay(3e3,(function(){t.innerHTML="boom"}),this),delay(3e3,this.blowStuffUp,this),this.nextBomb=this.bombShowDelay},blowStuffUp:function(){this.game.bulletManager.updateEnemyIndex();for(var t,e=this.game.bulletManager.enemyIndex,s=0;(t=e[s])&&s<10;s++){var i=getRect(t),n=new Vector(i.left+i.width/2,i.top+i.height/2);this.game.explosionManager.addExplosion(n,t,MegaParticleExplosion),t.parentNode.removeChild(t)}this.game.menuManager.hideBombMenu(),this.nextBomb=this.bombShowDelay},isReady:function(){return-1===this.nextBomb}}),ELEMENTSTHATARENOTTOBEINCLUDED=["BR","SCRIPT","STYLE","TITLE","META","HEAD","OPTION","OPTGROUP","LINK"],ELEMENTSIZETHRESHOLD=5,BulletManager=new Class({initialize:function(t){this.game=t,this.lastBlink=0,this.blinkActive=!1,this.enemyIndex=[],this.updateDelay=2.5,this.nextUpdate=this.updateDelay},update:function(t){this.game.isKeyPressed("B")?this.blink():this.blinkActive&&this.endBlink(),this.nextUpdate-=t,this.nextUpdate<0&&this.updateEnemyIndex()},blink:function(){if(now()-this.lastBlink>250){for(var t,e=0;t=this.enemyIndex[e];e++)this.blinkActive?t.style.outline=t.KICKASSOLDBORDER:t.style.outline="1px solid red";this.blinkActive=!this.blinkActive,this.lastBlink=now(),this.blinkActive||this.updateEnemyIndex()}},endBlink:function(){for(var t,e=0;t=this.enemyIndex[e];e++)t.style.outline=t.KICKASSOLDBORDER;this.lastBlink=0,this.blinkActive=!1},updateEnemyIndex:function(){var t=document.getElementsByTagName("*");this.enemyIndex=[];for(var e,s=0;e=t[s];s++)this.isDestroyable(e)&&(this.enemyIndex.push(e),e.KICKASSOLDBORDER=e.style.outline||document.defaultView.getComputedStyle(e,null).outline);this.nextUpdate=this.updateDelay},isDestroyable:function(t,e){if(this.shouldIgnoreElement(t,e))return!1;for(var s,i=0;s=t.childNodes[i];i++)if(1===s.nodeType&&-1===ELEMENTSTHATARENOTTOBEINCLUDED.indexOf(s.tagName)&&s.offsetWidth>=ELEMENTSIZETHRESHOLD&&s.offsetHeight>=ELEMENTSIZETHRESHOLD&&"hidden"!==document.defaultView.getComputedStyle(s,null).visibility)return!1;return!0},isDestroyableFromCollision:function(t){return this.isDestroyable(t,!0)},shouldIgnoreElement:function(t,e){return 1!==t.nodeType||(t==document.documentElement||t==document.body||(-1!==ELEMENTSTHATARENOTTOBEINCLUDED.indexOf(t.tagName)||("hidden"==t.style.visibility||"none"==t.style.display||("string"==typeof t.className&&-1!=t.className.indexOf("KICKASSELEMENT")||(!e&&(t.offsetWidth<ELEMENTSIZETHRESHOLD||t.offsetHeight<ELEMENTSIZETHRESHOLD)||((t.offsetLeft<0||t.offsetTop<0)&&((s=getRect(t)).left+s.width<0||s.top+s.height<0)||(s||(s=getRect(t)),s.top>=this.game.scrollSize.y)))))));var s},destroy:function(){for(var t in this.bullets)if(this.bullets.hasOwnProperty(t))for(var e,s=0;e=this.bullets[t][s];s++)e.destroy();this.bullets={}}}),SessionManager=new Class({initialize:function(t){this.game=t,this.isPlaying=!1},update:function(t){this.isPlaying&&0==this.game.bulletManager.enemyIndex.length&&this.weHaveWon()},weHaveWon:function(){this.isPlaying=!1,this.game.ui.showMessage("You're done!"),this.game.isCampaign()?(this.game.menuManager.showMenu(),this.game.menuManager.navigateTo("highscores")):this.game.menuManager.showMenu(),this.game.menuManager.sendMessageToMenu("gameFinished:!")}}),ExplosionManager=new Class({initialize:function(t){this.game=t,this.explosions=[]},update:function(t){for(var e,s=now(),i=0;e=this.explosions[i];i++)s-e.bornAt>(e.ttl||500)?(e.destroy(),this.explosions.splice(i,1)):e.update(t)},addExplosion:function(t,e,s){var i=new(s=s||ParticleExplosion)(t,e);i.game=this.game,i.checkBounds(),this.explosions.push(i),this.game.audioManager.explosion&&this.game.audioManager.explosion.play()},destroy:function(){for(var t,e=0;t=this.explosions[e];e++)t.destroy();this.explosions=[]}}),Cannon=new Class({initialize:function(t,e,s,i,n){this.player=t,this.game=e,this.pos=new Vector(s,i),this.angle=n||0},shootPressed:function(){},shootReleased:function(){},checkCollisions:function(){},getExplosionClass:function(){return ParticleExplosion},update:function(t){this.game.hideAll(),this.checkCollisions(t),this.game.showAll()},checkCollision:function(t){var e=t.checkCollision();return!!e&&(this.game.explosionManager.addExplosion(t.pos,e,this.getExplosionClass()),this.game.menuManager.addPoints(Math.min(e.getElementsByTagName("*").length+1,100),t.pos),e.isShot||e.parentNode.removeChild(e),this.game.statisticsManager&&this.game.statisticsManager.addElementsDestroyed(),!0)},createBullet:function(t){var e=new t(this.getABulletPos(),this.getABulletDir());return e.game=this.game,e.manager=this,e.initCanvas(),e.vel.add(e.vel.cp().setLength(this.player.vel.len())),e},getABulletPos:function(){return this.player.pos.cp().add(this.pos.cp().rotate(this.player.dir.angle()+Math.PI/2))},getABulletDir:function(){return this.player.dir.cp().rotate(this.angle)},destroy:function(){}}),LaserCannon=new Class({Extends:Cannon,initialize:function(t,e,s,i,n){Cannon.prototype.initialize.apply(this,arguments),this.lasers=[]},getExplosionClass:function(){return SplitExplosion},update:function(t){this.lasers.length&&(this.removeOld(),Cannon.prototype.update.call(this,t))},checkCollisions:function(t){for(var e,s=0;e=this.lasers[s];s++)e.update(t),this.checkCollision(e)},removeOld:function(){for(var t,e=0;t=this.lasers[e];e++)t.outOfBounds&&(t.destroy(),this.lasers.splice(e,1))},shootPressed:function(){this.lasers.length>5||now()-this.lastFired<500||(this.lastFired=now(),this.game.statisticsManager&&this.game.statisticsManager.addShotFired(),this.lasers.push(this.createBullet(LaserBullet)))},destroy:function(){if(this.lasers.length){for(var t,e=0;t=this.lasers[e];e++)t.destroy();this.lasers=[]}}}),BallCannon=new Class({Extends:Cannon,initialize:function(){Cannon.prototype.initialize.apply(this,arguments),this.lastFired=0,this.bullets=[]},getExplosionClass:function(){return ParticleExplosion},update:function(t){this.bullets.length&&(this.removeOld(),Cannon.prototype.update.call(this,t))},removeOld:function(){for(var t,e=now(),s=0;t=this.bullets[s];s++)e-t.bornAt>2e3&&(t.destroy(),this.bullets.splice(s,1))},checkCollisions:function(t){for(var e,s=0;e=this.bullets[s];s++)e.update(t),this.checkCollision(e)&&(e.destroy(),this.bullets.splice(s,1))},shootPressed:function(){now()-this.lastFired<200||(this.lastFired=now(),this.addBullet(),this.game.statisticsManager&&this.game.statisticsManager.addShotFired())},addBullet:function(){this.bullets.length>7&&(this.bullets[0].destroy(),this.bullets.shift());var t=this.createBullet(Bullet);this.bullets.push(t)},destroy:function(){for(var t,e=0;t=this.bullets[e];e++)t.destroy();this.bullets=[]}}),Bullet=new Class({initialize:function(t,e){this.pos=t.cp(),this.dir=e,this.vel=new Vector(500,500),this.bornAt=now()},initCanvas:function(){this.sheet=new Sheet(new Rect(this.pos.x,this.pos.y,5,5)),this.sheet.drawBullet()},draw:function(){this.sheet.setPosition(this.pos)},update:function(t){this.pos.add(this.vel.setAngle(this.dir.angle()).mulNew(t)),this.checkBounds(),this.draw()},checkCollision:function(){var t=document.elementFromPoint(this.pos.x,this.pos.y);return t&&3==t.nodeType&&(t=t.parentNode),!(!t||!this.game.bulletManager.isDestroyableFromCollision(t))&&t},checkBounds:function(){var t=this.game.windowSize.width,e=this.game.windowSize.height,s=this.pos.x+this.sheet.rect.size.width/2,i=this.pos.y+this.sheet.rect.size.height/2;s>t?this.pos.x=0:this.pos.x<0&&(this.pos.x=t-this.sheet.rect.size.width/2),i>e?this.pos.y=0:this.pos.y<0&&(this.pos.y=e-this.sheet.rect.size.height/2)},destroy:function(){this.sheet.destroy()}}),LaserBullet=new Class({Extends:Bullet,initialize:function(){Bullet.prototype.initialize.apply(this,arguments),this.vel=new Vector(750,750),this.lastDrawPos=this.pos.cp()},initCanvas:function(){var t=Math.max(GameGlobals.laserImage.width,GameGlobals.laserImage.height);this.sheet=new Sheet(new Rect(0,0,t,t))},update:function(t){Bullet.prototype.update.apply(this,arguments)},draw:function(){this.sheet.drawLaser(this.pos,this.dir),this.lastDrawPos=this.pos.cp()},checkBounds:function(){var t=this.game.windowSize.width,e=this.game.windowSize.height,s=this.pos.x+this.sheet.rect.size.width/2,i=this.pos.y+this.sheet.rect.size.height/2;(s>t||this.pos.x<0)&&(this.outOfBounds=!0),(i>e||this.pos.y<0)&&(this.outOfBounds=!0)},destroy:function(){this.sheet.destroy()}});GameGlobals.laserImage=document.createElement("img"),GameGlobals.laserImage.src=GameGlobals.path("css/gfx/kickass/laser.png");var Explosion=new Class({initialize:function(t,e){this.bornAt=now(),this.pos=t.cp()},update:function(t){},checkBounds:function(){},destroy:function(){}}),ParticleExplosion=new Class({Extends:Explosion,initialize:function(t,e){Explosion.prototype.initialize.apply(this,arguments),this.particleVel=new Vector(150,0),this.particles=[],this.generateParticles(),this.sheet=new Sheet(new Rect(t.x,t.y,250,250))},update:function(t){for(var e,s=0;e=this.particles[s];s++)e.pos.add(e.vel.mulNew(t).mul(random(.5,1)).setAngle(e.dir.angle()));this.sheet.clear(),this.sheet.drawExplosion(this.particles)},generateParticles:function(){for(var t=0,e=GameGlobals.hasCanvas?40:10;t<e;t++)this.particles.push({dir:new Vector(random(0,20)-10,random(0,20)-10).normalize(),vel:this.particleVel.cp(),pos:new Vector(0,0),color:["yellow","red"][random(0,1)]})},checkBounds:function(){var t=this.sheet.rect.getRight(),e=this.sheet.rect.getBottom(),s=this.game.windowSize.width,i=this.game.windowSize.height;t>s&&(this.pos.x-=t-s),e>i&&(this.pos.y-=e-i),this.sheet.setPosition(this.pos)},destroy:function(){this.sheet.destroy()}}),MegaParticleExplosion=new Class({Extends:ParticleExplosion,initialize:function(t,e){Explosion.prototype.initialize.apply(this,arguments),this.particleVel=new Vector(200,0),this.particles=[],this.generateParticles(),this.sheet=new Sheet(new Rect(t.x,t.y,500,500)),this.ttl=2e3,this.generationDelay=.6,this.generationTimes=2,this.nextGenerate=this.generationDelay},update:function(t){this.nextGenerate-=t,this.nextGenerate<=0&&this.generationTimes>0&&(this.nextGenerate=this.generationDelay,this.generateParticles(),this.generationTimes--),ParticleExplosion.prototype.update.call(this,t)}}),SplitExplosion=new Class({Extends:Explosion,initialize:function(t,e){e&&(Explosion.prototype.initialize.apply(this,arguments),this.element=e,this.fx=new Fx,this.fx.addListener(this),this.start())},update:function(t){this.element&&this.fx.update()},set:function(t,e){},start:function(){var t=this.createClones(),e=t[0],s=t[1],i="rotate(-"+random(30,50)+"deg) translate(-100px, 40px)",n="rotate("+random(30,50)+"deg) translate(100px, 40px)";setStyles(e,{transform:i}),setStyles(s,{transform:n}),this.left=e,this.right=s,this.fx.add("opacity",{start:1,end:.5,duration:500})},createClones:function(){var t=getRect(this.element),e=this.createContainer(t),s=this.createContainer(t),i=cloneElement(this.element),n=cloneElement(this.element);addClass(i,"KICKASSELEMENT"),addClass(n,"KICKASSELEMENT");var a={margin:0,overflow:"hidden"};return setStyles(i,a),setStyles(n,a),e.appendChild(i),s.appendChild(n),s.style.left=t.left+t.width/2+"px",s.scrollLeft+=t.width/2,this.element.style.opacity=0,this.element.style.visibility="hidden",this.element.style.display="none",each([e,s],(function(t){t.style.transition="transform 500ms ease-in"}))},createContainer:function(t){var e=document.createElement("div");return setStyles(e,{position:"absolute",left:t.left,top:t.top,width:.5*t.width,height:t.height,overflow:"hidden"}),getAppContainerElement().appendChild(e),e},destroy:function(){try{this.left.parentNode.removeChild(this.left),this.right.parentNode.removeChild(this.right),this.element.parentNode.removeChild(this.element)}catch(t){}}}),Weapons={1:{name:"Cannon",id:"cannon",cannonClass:BallCannon},2:{name:"Laser",id:"laser",cannonClass:LaserCannon}},WeaponMap={cannon:Weapons[1],laser:Weapons[2]},SheetCanvas=new Class({initialize:function(rect){with(this.canvas=document.createElement("canvas"),this.canvas.className="KICKASSELEMENT",this.canvas.style)position="absolute",zIndex="1000000";GameGlobals.kickass.registerElement(this.canvas),this.canvas.getContext&&(this.ctx=this.canvas.getContext("2d")),this.rect=rect,this.angle=0,this.updateCanvas(),getAppContainerElement().appendChild(this.canvas)},tracePoly:function(t){if(t[0]){this.ctx.save(),this.ctx.translate(this.rect.size.width/2,this.rect.size.height/2),this.ctx.rotate(this.angle),this.ctx.beginPath(),this.ctx.moveTo(t[0].x,t[0].y);for(var e=0;e<t.length;e++)this.ctx.lineTo(t[e].x,t[e].y);this.ctx.restore()}},setAngle:function(t){this.angle=t},updateCanvas:function(){this.canvas.width!=this.rect.size.width&&(this.canvas.width=this.rect.size.width),this.canvas.height!=this.rect.size.height&&(this.canvas.height=this.rect.size.height),this.canvas.style.left=GameGlobals.kickass.scrollPos.x+(this.rect.pos.x-this.rect.size.width/2)+"px",this.canvas.style.top=GameGlobals.kickass.scrollPos.y+(this.rect.pos.y-this.rect.size.height/2)+"px"},drawLine:function(t,e,s,i){this.ctx.save(),this.ctx.translate(this.rect.size.width/2,this.rect.size.height/2),this.ctx.beginPath(),this.ctx.moveTo(t,e),this.ctx.lineTo(s,i),this.ctx.closePath(),this.ctx.stroke(),this.ctx.restore()},drawCircle:function(t,e){e=e||{x:0,y:0},this.ctx.save(),this.ctx.translate(this.rect.size.width/2,this.rect.size.height/2),e&&this.ctx.translate(e.x,e.y),this.ctx.beginPath(),this.ctx.arc(0,0,t,0,2*Math.PI,!0),this.ctx.fill(),this.ctx.closePath(),this.ctx.restore()},drawRect:function(t,e,s,i){this.ctx.save(),this.ctx.translate(this.rect.size.width/2,this.rect.size.height/2),this.ctx.translate(t,e),this.ctx.fillRect(t,e,s,i),this.ctx.restore(),this.ctx.fill()},drawImageFull:function(t){this.ctx.drawImage(t,0,0,this.rect.size.width,this.rect.size.height)},drawImage:function(t,e,s){this.ctx.save(),this.ctx.translate(this.rect.size.width/2+e,this.rect.size.height/2+s),this.ctx.rotate(this.angle),this.ctx.drawImage(t,0,-11),this.ctx.restore()},setFillColor:function(t){this.ctx.fillStyle=t},setStrokeColor:function(t){this.ctx.strokeStyle=t},setLineWidth:function(t){this.ctx.lineWidth=t},fillPath:function(){this.ctx.fill()},strokePath:function(){this.ctx.stroke()},clear:function(){this.ctx.clearRect(0,0,this.rect.size.width,this.rect.size.height)},destroy:function(){GameGlobals.kickass.unregisterElement(this.canvas),this.canvas.parentNode.removeChild(this.canvas)}}),Sheet=new Class({initialize:function(t){this.rect=t,this.drawer=new SheetCanvas(t)},clear:function(){this.drawer.clear()},setPosition:function(t){this.rect.pos=t.cp(),this.drawer.rect=this.rect,this.drawer.updateCanvas()},setAngle:function(t){this.drawer.setAngle(t)},drawPlayer:function(t){this.drawer.setFillColor("white"),this.drawer.setStrokeColor("black"),this.drawer.setLineWidth(1.5),this.drawer.tracePoly(t),this.drawer.fillPath(),this.drawer.tracePoly(t),this.drawer.strokePath()},drawBrokenPlayer:function(t,e){this.drawer.setStrokeColor("black"),this.drawer.setLineWidth(1.5);for(var s,i=1,n=t[0];s=t[i];i++,n=s){var a=e[i-1];this.drawer.drawLine(n.x+a.pos.x,n.x+a.pos.y,s.x+a.pos.x,s.y+a.pos.y)}},drawFlames:function(t,e){this.drawer.setLineWidth(1.5),this.drawer.setFillColor("red"),this.drawer.tracePoly(t.r),this.drawer.fillPath(),this.drawer.setFillColor("yellow"),this.drawer.tracePoly(t.y),this.drawer.fillPath()},drawBullet:function(){this.drawer.setFillColor(GameGlobals.bulletColor),this.drawer.drawCircle(2.5)},drawExplosion:function(t){for(var e,s=0;e=t[s];s++)this.drawer.setFillColor(e.color),this.drawer.drawRect(e.pos.x,e.pos.y,3,3)},drawFace:function(t){this.drawer.drawImageFull(t)},drawLaser:function(t,e){this.clear(),this.setPosition(t),this.drawer.setAngle(e.angle()),this.drawer.drawImage(GameGlobals.laserImage,0,0)},transformToSheetCoordinates:function(t){return t.cp().sub(new Vector(this.rect.size.width/2,this.rect.size.height/2))},destroy:function(){this.drawer.destroy()}}),namespace=getGlobalNamespace(),initKickAss=function(){if(namespace.KICKASSGAME)namespace.KICKASSGAME.addPlayer();else if(namespace.KICKASS_SITE_KEY){var t=new MySite(namespace.KICKASS_SITE_KEY);t.load((function(e){namespace.KICKASSGAME=GameGlobals.kickass=new KickAss({mySite:!!e&&t}),namespace.KICKASSGAME.begin()}))}else namespace.KICKASSGAME=GameGlobals.kickass=new KickAss,namespace.KICKASSGAME.begin()};function getAppContainerElement(){return namespace.KICKASS_CONTAINER_ELEMENT?document.getElementById(namespace.KICKASS_CONTAINER_ELEMENT):document.body}namespace.LAZYLOAD_KICKASS?window.startBrowserBlaster=initKickAss:initKickAss()})("undefined"!=typeof exports?exports:window);