home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Acao / kung_fu.swf / scripts / __Packages / com / KidFighting / objects / CCharacter.as next >
Encoding:
Text File  |  2006-06-13  |  31.4 KB  |  1,170 lines

  1. class com.KidFighting.objects.CCharacter extends com.KidFighting.objects.CObject
  2. {
  3.    var m_skillList;
  4.    var orgY;
  5.    var orgScale;
  6.    var updaterObj;
  7.    var _twnF;
  8.    var _twnX;
  9.    var _twnY;
  10.    var _performedSkill;
  11.    var crtHP;
  12.    var orgX;
  13.    var side;
  14.    var ani;
  15.    var isInvincible;
  16.    var maxHP;
  17.    var opponent;
  18.    var updater;
  19.    var jump;
  20.    var speed;
  21.    var onEnterFrame;
  22.    var invTimer;
  23.    var dispatchEvent;
  24.    var lbNormal = 1;
  25.    var lbR = 2;
  26.    var lbL = 3;
  27.    var lbDn = 4;
  28.    var lbDnGetup = 5;
  29.    var lbJp = 6;
  30.    var lbJpR = 7;
  31.    var lbJpL = 8;
  32.    var lbK1 = 9;
  33.    var lbK2 = 10;
  34.    var lbK3 = 11;
  35.    var lbDnK1 = 12;
  36.    var lbDnK2 = 13;
  37.    var lbDnK3 = 14;
  38.    var lbJpK1 = 15;
  39.    var lbJpK2 = 16;
  40.    var lbJpK3 = 17;
  41.    var lbJpRLK1 = 18;
  42.    var lbJpRLK2 = 19;
  43.    var lbJpRLK3 = 20;
  44.    var lbMidK1 = 21;
  45.    var lbMidK2 = 22;
  46.    var lbMidK3 = 23;
  47.    var lbP1 = 24;
  48.    var lbP2 = 25;
  49.    var lbP3 = 26;
  50.    var lbDnP1 = 27;
  51.    var lbDnP2 = 28;
  52.    var lbDnP3 = 29;
  53.    var lbJpP1 = 30;
  54.    var lbJpP2 = 31;
  55.    var lbJpP3 = 32;
  56.    var lbJpRLP1 = 33;
  57.    var lbJpRLP2 = 34;
  58.    var lbJpRLP3 = 35;
  59.    var lbMidP1 = 36;
  60.    var lbMidP2 = 37;
  61.    var lbMidP3 = 38;
  62.    var lbCatch = 39;
  63.    var lbCought = 40;
  64.    var lbThrown = 41;
  65.    var lbH1 = 42;
  66.    var lbH2 = 43;
  67.    var lbH3 = 44;
  68.    var lbDnH1 = 45;
  69.    var lbDnH2 = 46;
  70.    var lbDnH3 = 47;
  71.    var lbJpH1 = 48;
  72.    var lbJpH2 = 49;
  73.    var lbJpH3 = 50;
  74.    var lbJpRLH1 = 51;
  75.    var lbJpRLH2 = 52;
  76.    var lbJpRLH3 = 53;
  77.    var lbMidH1 = 54;
  78.    var lbMidH2 = 55;
  79.    var lbMidH3 = 56;
  80.    var lbHGetup = 57;
  81.    var lbHDie = 58;
  82.    var lbUpB = 59;
  83.    var lbMidB = 60;
  84.    var lbDnB = 61;
  85.    var lbWin = 62;
  86.    var lbLose = 63;
  87.    var lbS1 = 64;
  88.    var lbS2 = 65;
  89.    var lbS3 = 66;
  90.    var lbS4 = 67;
  91.    var lbS5 = 68;
  92.    var lbIntro = 71;
  93.    var direction = "";
  94.    var shadow = null;
  95.    var sex = "male";
  96.    var status = "normal";
  97.    static var _evt = mx.events.EventDispatcher;
  98.    static var __initBroadcaster = mx.transitions.BroadcasterMX.initialize(com.KidFighting.objects.CCharacter.prototype);
  99.    function CCharacter()
  100.    {
  101.       super();
  102.       mx.events.EventDispatcher.initialize(this);
  103.       this.m_skillList = {};
  104.       this.orgY = 325;
  105.       this.orgScale = 100;
  106.       this.updaterObj = {};
  107.       this._twnF = new ds.transitions.Tween(null,"_currentframe",null,1,1,1);
  108.       this._twnX = new ds.transitions.Tween(null,"_x",null,1,1,1);
  109.       this._twnY = new ds.transitions.Tween(null,"_y",null,1,1,1);
  110.       this.updaterObj.updater = this;
  111.       _global.MovieClip.addListener(this.updaterObj);
  112.    }
  113.    function performingSkill()
  114.    {
  115.       return this._performedSkill;
  116.    }
  117.    function get HP()
  118.    {
  119.       return this.crtHP;
  120.    }
  121.    function get skillList()
  122.    {
  123.       return this.m_skillList;
  124.    }
  125.    function setup(strSide)
  126.    {
  127.       if(strSide == "left" || strSide == "right")
  128.       {
  129.          if(strSide == "left")
  130.          {
  131.             this.orgX = 160;
  132.             this.side = 1;
  133.          }
  134.          else
  135.          {
  136.             this.orgX = 470;
  137.             this.side = -1;
  138.          }
  139.          if(this.shadow == undefined)
  140.          {
  141.             this.shadow = new com.KidFighting.objects.CShadow();
  142.             this.shadow.follow(this.ani);
  143.          }
  144.          this._twnX.obj = this.ani;
  145.          this._twnY.obj = this.ani;
  146.          this.status = "normal";
  147.          this.direction = "";
  148.          this.isInvincible = false;
  149.          for(var _loc2_ in this.m_skillList)
  150.          {
  151.             this.m_skillList[_loc2_].performing = false;
  152.          }
  153.          this._performedSkill = null;
  154.          this.crtHP = this.maxHP;
  155.          this.ani._x = this.orgX;
  156.          this.ani._y = this.orgY;
  157.          this.orgScale = 100;
  158.          this.ani._xscale = this.orgScale;
  159.          this.updateSide();
  160.          return true;
  161.       }
  162.       return false;
  163.    }
  164.    function freeze()
  165.    {
  166.       this.updaterObj.onEnterFrame = undefined;
  167.       if(this.status == "left" || this.status == "right")
  168.       {
  169.          this.movNormal();
  170.       }
  171.    }
  172.    function onceAni(lb, cb)
  173.    {
  174.       this._twnF.stop();
  175.       delete this._twnF.onMotionFinished;
  176.       this.ani.gotoAndStop(lb);
  177.       var _loc2_ = this.getInstance();
  178.       this._twnF.obj = _loc2_;
  179.       this._twnF.finish = this._twnF.duration = _loc2_._totalframes;
  180.       if(cb != undefined)
  181.       {
  182.          this._twnF.onMotionFinished = cb;
  183.       }
  184.       this._twnF.start();
  185.    }
  186.    function loopAni(lb)
  187.    {
  188.       delete this._twnF.onMotionFinished;
  189.       this._twnF.stop();
  190.       this.ani.gotoAndStop(lb);
  191.       this.getInstance().play();
  192.    }
  193.    function correctPosition()
  194.    {
  195.       if(Math.abs(this.ani._x - this.opponent.ani._x) < 30)
  196.       {
  197.          this.ani._x -= 30 * this.side;
  198.       }
  199.    }
  200.    function correctOffside()
  201.    {
  202.       if(this.ani._x > Stage.width - 50)
  203.       {
  204.          this.ani._x = Stage.width - 50;
  205.       }
  206.       else if(this.ani._x < 50)
  207.       {
  208.          this.ani._x = 50;
  209.       }
  210.    }
  211.    function updateSide(sd)
  212.    {
  213.       if(sd != undefined)
  214.       {
  215.          this.side = sd;
  216.       }
  217.       if(this.orgScale * this.side != this.ani._xscale)
  218.       {
  219.          this.ani._xscale = this.orgScale * this.side;
  220.       }
  221.    }
  222.    function startXTween(func, mov, step, cb)
  223.    {
  224.       this._twnX.stop();
  225.       mov;
  226.       if(this.ani._x + mov > Stage.width - 50)
  227.       {
  228.          mov = Stage.width - 50 - this.ani._x;
  229.       }
  230.       else if(this.ani._x + mov < 50)
  231.       {
  232.          mov = - (this.ani._x - 50);
  233.       }
  234.       var _loc3_ = this;
  235.       var callback = cb;
  236.       this._twnX.func = func;
  237.       this._twnX.begin = this.ani._x;
  238.       this._twnX.finish = this.ani._x + mov;
  239.       this._twnX.duration = step;
  240.       this._twnX.onMotionFinished = function()
  241.       {
  242.          callback();
  243.       };
  244.       this._twnX.start(true);
  245.    }
  246.    function startYTween(func, aim, step, cb)
  247.    {
  248.       this._twnY.stop();
  249.       this._twnY.func = func;
  250.       this._twnY.begin = this.ani._y;
  251.       this._twnY.finish = aim;
  252.       this._twnY.duration = step;
  253.       var _loc2_ = this;
  254.       this._twnY.callback = cb;
  255.       this._twnY.onMotionFinished = function(twn)
  256.       {
  257.          twn.callback();
  258.       };
  259.       this._twnY.start(true);
  260.    }
  261.    function addSkill(skl)
  262.    {
  263.       skl.owner = this;
  264.       this.m_skillList[skl.keys] = skl;
  265.    }
  266.    function getSkill(keyBuffer)
  267.    {
  268.       return this.m_skillList[keyBuffer];
  269.    }
  270.    function getSkillByName(name)
  271.    {
  272.       for(var _loc3_ in this.m_skillList)
  273.       {
  274.          if(this.m_skillList[_loc3_].name == name)
  275.          {
  276.             return this.m_skillList[_loc3_];
  277.          }
  278.       }
  279.       return null;
  280.    }
  281.    function randomGetSkill()
  282.    {
  283.       for(var _loc2_ in this.m_skillList)
  284.       {
  285.          if(random(5) == 2 && this.m_skillList[_loc2_].name != "Throw")
  286.          {
  287.             return this.m_skillList[_loc2_];
  288.          }
  289.       }
  290.       return this.m_skillList[0];
  291.    }
  292.    function movNormal()
  293.    {
  294.       if(this.crtHP > 0)
  295.       {
  296.          this.status = "normal";
  297.          this.direction = "";
  298.          this.updaterObj.onEnterFrame = undefined;
  299.          this.loopAni(this.lbNormal);
  300.          this.updateSide();
  301.       }
  302.    }
  303.    function movRight()
  304.    {
  305.       this.direction = this.status = "right";
  306.       if(this.side == 1)
  307.       {
  308.          this.loopAni(this.lbR);
  309.       }
  310.       else
  311.       {
  312.          this.loopAni(this.lbL);
  313.       }
  314.       this.updaterObj.onEnterFrame = function()
  315.       {
  316.          var _loc2_ = this.updater;
  317.          if(_loc2_.side == -1 || _loc2_.ani._x + _loc2_.speed < _loc2_.opponent.ani._x - 30 || _loc2_.opponent.status == "jump")
  318.          {
  319.             if(_loc2_.ani._x + _loc2_.speed < Stage.width - 50)
  320.             {
  321.                _loc2_.ani._x += _loc2_.speed;
  322.             }
  323.             else
  324.             {
  325.                _loc2_.ani._x = Stage.width - 50;
  326.             }
  327.          }
  328.          _loc2_.updateSide();
  329.       };
  330.    }
  331.    function movLeft()
  332.    {
  333.       this.direction = this.status = "left";
  334.       if(this.side == 1)
  335.       {
  336.          this.loopAni(this.lbL);
  337.       }
  338.       else
  339.       {
  340.          this.loopAni(this.lbR);
  341.       }
  342.       this.updaterObj.onEnterFrame = function()
  343.       {
  344.          var _loc2_ = this.updater;
  345.          if(_loc2_.side == 1 || _loc2_.ani._x - _loc2_.speed > _loc2_.opponent.ani._x + 30 || _loc2_.opponent.status == "jump")
  346.          {
  347.             if(_loc2_.ani._x > 50 + _loc2_.speed)
  348.             {
  349.                _loc2_.ani._x -= _loc2_.speed;
  350.             }
  351.             else
  352.             {
  353.                _loc2_.ani._x = 50;
  354.             }
  355.          }
  356.          _loc2_.updateSide();
  357.       };
  358.    }
  359.    function movDown()
  360.    {
  361.       this.status = "down";
  362.       this.direction = "down";
  363.       this.onceAni(this.lbDn);
  364.    }
  365.    function movStandUp()
  366.    {
  367.       this.status = "standup";
  368.       this.direction = "";
  369.       var o = this;
  370.       this.onceAni(this.lbDnGetup,function()
  371.       {
  372.          o.movNormal();
  373.       }
  374.       );
  375.       this.updateSide();
  376.    }
  377.    function movJump()
  378.    {
  379.       this.status = "jump";
  380.       this.direction = "up";
  381.       this.updateSide();
  382.       this.onceAni(this.lbJp);
  383.       var o = this;
  384.       var jumpStep = Math.round(this.jump / 15);
  385.       this.startYTween(mx.transitions.easing.Strong.easeOut,this.ani._y - this.jump,jumpStep,function()
  386.       {
  387.          o.startYTween(mx.transitions.easing.Regular.easeIn,o.orgY,jumpStep,function()
  388.          {
  389.             o.correctPosition();
  390.             o.correctOffside();
  391.             if(o.status != "hurt")
  392.             {
  393.                o.movNormal();
  394.             }
  395.          }
  396.          );
  397.       }
  398.       );
  399.    }
  400.    function movJumpRight()
  401.    {
  402.       this.status = "jump";
  403.       this.direction = "up";
  404.       if(this.side == 1)
  405.       {
  406.          this.onceAni(this.lbJpR);
  407.       }
  408.       else
  409.       {
  410.          this.onceAni(this.lbJpL);
  411.       }
  412.       this.updateSide();
  413.       var _loc2_ = 80 + this.speed * 3;
  414.       if(this.ani._x + _loc2_ > Stage.width - 51)
  415.       {
  416.          _loc2_ = Stage.width - 51 - this.ani._x;
  417.       }
  418.       var o = this;
  419.       var jumpStep = Math.round(this.jump / 15);
  420.       this.startXTween(null,_loc2_,jumpStep * 2);
  421.       this.startYTween(mx.transitions.easing.Strong.easeOut,this.ani._y - this.jump,jumpStep,function()
  422.       {
  423.          o.startYTween(mx.transitions.easing.Regular.easeIn,o.orgY,jumpStep,function()
  424.          {
  425.             o.correctPosition();
  426.             o.correctOffside();
  427.             if(o.status != "hurt")
  428.             {
  429.                o.movNormal();
  430.             }
  431.          }
  432.          );
  433.       }
  434.       );
  435.    }
  436.    function movJumpLeft()
  437.    {
  438.       this.status = "jump";
  439.       this.direction = "up";
  440.       if(this.side == 1)
  441.       {
  442.          this.onceAni(this.lbJpL);
  443.       }
  444.       else
  445.       {
  446.          this.onceAni(this.lbJpR);
  447.       }
  448.       this.updateSide();
  449.       var _loc2_ = 80 + this.speed * 3;
  450.       if(this.ani._x - _loc2_ < 50)
  451.       {
  452.          _loc2_ = this.ani._x - 50;
  453.       }
  454.       var o = this;
  455.       var jumpStep = Math.round(this.jump / 15);
  456.       this.startXTween(null,- _loc2_,jumpStep * 2);
  457.       this.startYTween(mx.transitions.easing.Strong.easeOut,this.ani._y - this.jump,jumpStep,function()
  458.       {
  459.          o.startYTween(mx.transitions.easing.Regular.easeIn,o.orgY,jumpStep,function()
  460.          {
  461.             o.correctPosition();
  462.             o.correctOffside();
  463.             if(o.status != "hurt")
  464.             {
  465.                o.movNormal();
  466.             }
  467.          }
  468.          );
  469.       }
  470.       );
  471.    }
  472.    function mtPower()
  473.    {
  474.       this.status = "punch";
  475.       this.direction = "";
  476.       this.updaterObj.onEnterFrame = function()
  477.       {
  478.          if(this.updater.hitTest())
  479.          {
  480.             delete this.onEnterFrame;
  481.          }
  482.       };
  483.       this.updateSide();
  484.       var o = this;
  485.       this.onceAni(this.lbP2,function()
  486.       {
  487.          o.movNormal();
  488.       }
  489.       );
  490.       ds.controls.SoundPlayer.playSound("BasicAttack_" + this.sex);
  491.    }
  492.    function mtKick()
  493.    {
  494.       this.status = "kick";
  495.       this.direction = "";
  496.       this.updaterObj.onEnterFrame = function()
  497.       {
  498.          if(this.updater.hitTest())
  499.          {
  500.             delete this.onEnterFrame;
  501.          }
  502.       };
  503.       this.updateSide();
  504.       var o = this;
  505.       this.onceAni(this.lbK2,function()
  506.       {
  507.          o.movNormal();
  508.       }
  509.       );
  510.       ds.controls.SoundPlayer.playSound("BasicAttack_" + this.sex);
  511.    }
  512.    function mtDownPower()
  513.    {
  514.       this.status = "punch";
  515.       this.direction = "down";
  516.       this.updaterObj.onEnterFrame = function()
  517.       {
  518.          if(this.updater.hitTest())
  519.          {
  520.             delete this.onEnterFrame;
  521.          }
  522.       };
  523.       this.updateSide();
  524.       var o = this;
  525.       this.onceAni(this.lbDnP2,function()
  526.       {
  527.          o.updaterObj.onEnterFrame = undefined;
  528.          if(o.direction == "down")
  529.          {
  530.             o.status = "down";
  531.             o.ani.gotoAndStop(o.lbDn);
  532.             o.getInstance().gotoAndStop(o.getInstance()._totalframes);
  533.          }
  534.          else
  535.          {
  536.             o.movStandUp();
  537.          }
  538.       }
  539.       );
  540.       ds.controls.SoundPlayer.playSound("BasicAttack_" + this.sex);
  541.    }
  542.    function mtDownKick()
  543.    {
  544.       this.status = "kick";
  545.       this.direction = "down";
  546.       this.updaterObj.onEnterFrame = function()
  547.       {
  548.          if(this.updater.hitTest())
  549.          {
  550.             delete this.onEnterFrame;
  551.          }
  552.       };
  553.       this.updateSide();
  554.       var o = this;
  555.       this.onceAni(this.lbDnK2,function()
  556.       {
  557.          o.updaterObj.onEnterFrame = undefined;
  558.          if(o.direction == "down")
  559.          {
  560.             o.status = "down";
  561.             o.ani.gotoAndStop(o.lbDn);
  562.             o.getInstance().gotoAndStop(o.getInstance()._totalframes);
  563.          }
  564.          else
  565.          {
  566.             o.movStandUp();
  567.          }
  568.       }
  569.       );
  570.       ds.controls.SoundPlayer.playSound("BasicAttack_" + this.sex);
  571.    }
  572.    function mtBlockUp(hurtEff)
  573.    {
  574.       this.startInvincible(0.1);
  575.       this.status = "block";
  576.       this.updateSide();
  577.       var o = this;
  578.       this.onceAni(this.lbUpB,function()
  579.       {
  580.          o.movNormal();
  581.       }
  582.       );
  583.       if(!this.isOnEdge())
  584.       {
  585.          this.startXTween(null,(- this.side) * (this.opponent.strength * 3),7);
  586.       }
  587.       else if(this.opponent.status != "skill" && this._performedSkill.type != "flyItem")
  588.       {
  589.          this.opponent.startXTween(null,this.side * (this.opponent.strength * 2),5);
  590.       }
  591.       ds.controls.SoundPlayer.playSound("Block");
  592.       if(hurtEff != "nothing")
  593.       {
  594.          com.KidFighting.EffectSys.generate(hurtEff,null,this,this.ani._x + 10 * this.side,this.ani._y - 45);
  595.       }
  596.    }
  597.    function mtBlockDown(hurtEff)
  598.    {
  599.       this.startInvincible(0.1);
  600.       this.status = "block";
  601.       var oldDirection = this.direction;
  602.       this.updateSide();
  603.       var o = this;
  604.       this.onceAni(this.lbDnB,function()
  605.       {
  606.          if(o.direction == oldDirection)
  607.          {
  608.             o.status = "down";
  609.             o.ani.gotoAndStop(o.lbDn);
  610.             o.getInstance().gotoAndStop(o.getInstance()._totalframes);
  611.          }
  612.          else
  613.          {
  614.             o.movStandUp();
  615.          }
  616.       }
  617.       );
  618.       if(!this.isOnEdge())
  619.       {
  620.          this.startXTween(null,(- this.side) * (this.opponent.strength * 3),7);
  621.       }
  622.       else if(this.opponent.status != "skill" && this._performedSkill.type != "flyItem")
  623.       {
  624.          this.opponent.startXTween(null,this.side * (this.opponent.strength * 2),5);
  625.       }
  626.       ds.controls.SoundPlayer.playSound("Block");
  627.       if(hurtEff != "nothing")
  628.       {
  629.          com.KidFighting.EffectSys.generate(hurtEff,null,this,this.ani._x + 10 * this.side,this.ani._y - 15);
  630.       }
  631.    }
  632.    function isOnEdge(off)
  633.    {
  634.       if(off == undefined)
  635.       {
  636.          off = 5;
  637.       }
  638.       if(this.ani._x < 50 + off || this.ani._x > Stage.width - (50 + off))
  639.       {
  640.          return true;
  641.       }
  642.       return false;
  643.    }
  644.    function mtBlastHurt(hurtEff)
  645.    {
  646.       this.updaterObj.onEnterFrame = undefined;
  647.       this.status = "thrown";
  648.       this.side = - this.opponent.side;
  649.       this.updateSide();
  650.       var o = this;
  651.       this.onceAni(this.lbThrown,function()
  652.       {
  653.          o.movNormal();
  654.          o.startInvincible(0.1);
  655.       }
  656.       );
  657.       this.startXTween(null,(- this.side) * (70 + this.opponent.strength * 5),6 + Math.abs(Math.round((o.orgY - o.ani._y) / 9)));
  658.       if(this.direction == "up" || this.status == "jump")
  659.       {
  660.          this._twnY.stop();
  661.          this.startYTween(null,this.ani._y - 10,6,function()
  662.          {
  663.             o.startYTween(null,o.orgY,Math.abs(Math.round((o.orgY - o.ani._y) / 9)),function()
  664.             {
  665.                o.correctPosition();
  666.                o.correctOffside();
  667.             }
  668.             );
  669.          }
  670.          );
  671.       }
  672.       if(this.isOnEdge())
  673.       {
  674.          if(this.opponent.status != "skill" && this._performedSkill.type != "flyItem")
  675.          {
  676.             this.opponent.startXTween(null,this.side * 30,7,null);
  677.          }
  678.       }
  679.       if(hurtEff != "nothing")
  680.       {
  681.          com.KidFighting.EffectSys.generate(hurtEff,null,this,this.ani._x + random(10) * this.side,this.ani._y - 30 - random(30));
  682.       }
  683.       ds.controls.SoundPlayer.playSound("ConnectedHit");
  684.    }
  685.    function startInvincible(time)
  686.    {
  687.       if(this.invTimer == undefined)
  688.       {
  689.          this.invTimer = new ds.controls.Timer();
  690.       }
  691.       this.isInvincible = true;
  692.       this.invTimer.stop();
  693.       this.invTimer.interval = time * 1000;
  694.       var o = this;
  695.       this.invTimer.func = function()
  696.       {
  697.          o.invTimer.stop();
  698.          o.isInvincible = false;
  699.       };
  700.       this.invTimer.start();
  701.    }
  702.    function mtHurtUp(hurtEff)
  703.    {
  704.       if(this.HP > 0)
  705.       {
  706.          var o = this;
  707.          this.status = "hurt";
  708.          if(!this.isOnEdge())
  709.          {
  710.             this.startXTween(null,(- this.side) * (this.opponent.strength * 5),7,null);
  711.          }
  712.          else if(this.opponent.status != "skill" && this._performedSkill.type != "flyItem")
  713.          {
  714.             this.opponent.startXTween(null,this.side * (this.opponent.strength * 3),7,null);
  715.          }
  716.          this.onceAni(this.lbH1,function()
  717.          {
  718.             o.movNormal();
  719.             o.startInvincible(0.1);
  720.          }
  721.          );
  722.          this.side = - this.opponent.side;
  723.          this.updateSide();
  724.          if(hurtEff != "nothing")
  725.          {
  726.             com.KidFighting.EffectSys.generate(hurtEff,null,this,this.ani._x + 10 * this.side,this.ani._y - 45);
  727.          }
  728.          ds.controls.SoundPlayer.playSound("ConnectedHit");
  729.       }
  730.       else
  731.       {
  732.          this.movLose();
  733.          if(hurtEff != "nothing")
  734.          {
  735.             com.KidFighting.EffectSys.generate(hurtEff,null,this,this.ani._x + 10 * this.side,this.ani._y - 45);
  736.          }
  737.          ds.controls.SoundPlayer.playSound("ConnectedHit");
  738.       }
  739.    }
  740.    function mtHurtDown(hurtEff)
  741.    {
  742.       if(this.HP > 0)
  743.       {
  744.          this.status = "hurt";
  745.          var o = this;
  746.          this.side = - this.opponent.side;
  747.          this.updateSide();
  748.          this.onceAni(this.lbH1,function()
  749.          {
  750.             o.movNormal();
  751.             o.startInvincible(0.1);
  752.          }
  753.          );
  754.          if(!this.isOnEdge())
  755.          {
  756.             this.startXTween(null,(- this.side) * (this.opponent.strength * 5),5);
  757.          }
  758.          else if(this.opponent.status != "skill" && this._performedSkill.type != "flyItem")
  759.          {
  760.             this.opponent.startXTween(null,this.side * (this.opponent.strength * 3),5);
  761.          }
  762.          if(hurtEff != "nothing")
  763.          {
  764.             com.KidFighting.EffectSys.generate(hurtEff,null,this,this.ani._x + 10 * this.side,this.ani._y - 15);
  765.          }
  766.          ds.controls.SoundPlayer.playSound("ConnectedHit");
  767.       }
  768.       else
  769.       {
  770.          this.movLose();
  771.          if(hurtEff != "nothing")
  772.          {
  773.             com.KidFighting.EffectSys.generate(hurtEff,null,this,this.ani._x + 10 * this.side,this.ani._y - 15);
  774.          }
  775.          ds.controls.SoundPlayer.playSound("ConnectedHit");
  776.       }
  777.    }
  778.    function mtCought()
  779.    {
  780.       this._twnX.stop();
  781.       this._twnY.stop();
  782.       this.updaterObj.onEnterFrame = undefined;
  783.       this.status = "cought";
  784.       this.direction = "";
  785.       this.ani._x = this.opponent.ani._x - this.side * 5;
  786.       this.ani._y = this.orgY - 15;
  787.       this.side = - this.opponent.side;
  788.       this.onceAni(this.lbCought);
  789.    }
  790.    function mtThrown()
  791.    {
  792.       this.updaterObj.onEnterFrame = undefined;
  793.       this.status = "thrown";
  794.       this.direction = "";
  795.       var o = this;
  796.       this.onceAni(this.lbThrown,function()
  797.       {
  798.          o.movNormal();
  799.          o.startInvincible(0.8);
  800.       }
  801.       );
  802.       this.startXTween(null,this.side * (100 + this.opponent.strength * 8),10);
  803.       this.startYTween(null,this.orgY,4);
  804.    }
  805.    function movLoseTimeOut()
  806.    {
  807.       this.status = "lose";
  808.       this.updateSide();
  809.       this.onceAni(this.lbLose);
  810.    }
  811.    function movLose()
  812.    {
  813.       if(this.status != "thrown")
  814.       {
  815.          this.updateSide();
  816.          this.onceAni(this.lbHDie);
  817.          this.startXTween(null,(- this.side) * (130 + this.opponent.strength * 10),10);
  818.       }
  819.       this.status = "lose";
  820.    }
  821.    function movWin()
  822.    {
  823.       this.status = "win";
  824.       this.onceAni(this.lbWin);
  825.    }
  826.    function movIntro()
  827.    {
  828.       this.status = "intro";
  829.       this.onceAni(this.lbIntro);
  830.    }
  831.    function destroy()
  832.    {
  833.       super.destroy();
  834.       this.shadow.destroy();
  835.    }
  836.    function getInstance()
  837.    {
  838.       return this.ani.getInstanceAtDepth(-16383);
  839.    }
  840.    function onPauseGame()
  841.    {
  842.       if(this._twnF.isPlaying)
  843.       {
  844.          this._twnF.stop();
  845.       }
  846.       if(this._twnX.isPlaying)
  847.       {
  848.          this._twnX.stop();
  849.       }
  850.       if(this._twnY.isPlaying)
  851.       {
  852.          this._twnY.stop();
  853.       }
  854.       this.getInstance().stop();
  855.       _global.MovieClip.removeListener(this.updaterObj);
  856.    }
  857.    function onResumeGame()
  858.    {
  859.       this._twnF.resume();
  860.       this._twnX.resume();
  861.       this._twnY.resume();
  862.       if(this.status == "normal")
  863.       {
  864.          this.getInstance().play();
  865.       }
  866.       _global.MovieClip.addListener(this.updaterObj);
  867.    }
  868.    function hitTest(aMc, hitEff, hitValue, blockHitEff, blockHitValue, isNoAni, aniFunc)
  869.    {
  870.       var _loc2_ = aMc != undefined ? aMc : this.getInstance().hitBlock;
  871.       hitEff = hitEff != undefined ? hitEff : "Hurt";
  872.       var _loc4_ = blockHitEff != undefined ? blockHitEff : "Block";
  873.       var _loc3_ = Boolean(isNoAni);
  874.       if(_loc2_ != undefined)
  875.       {
  876.          if(Boolean(_loc2_.hitTest(this.opponent.getInstance().hitBody)) && this.opponent.status != "hurt" && !this.opponent.isInvincible && this.opponent.status != "thrown")
  877.          {
  878.             if(this.ani.getDepth() < this.opponent.ani.getDepth())
  879.             {
  880.                this.ani.swapDepths(this.opponent.ani);
  881.             }
  882.             if(this.side == -1 && this.opponent.side == 1 && this.opponent.direction == "left" || this.side == 1 && this.opponent.side == -1 && this.opponent.direction == "right")
  883.             {
  884.                this.dispatchEvent({type:"onFightActivated",activer:this,getHurt:false,blockHitEff:_loc4_,blockHitValue:blockHitValue});
  885.                return -1;
  886.             }
  887.             this.dispatchEvent({type:"onFightActivated",activer:this,getHurt:true,hitEff:hitEff,hurtValue:hitValue,isNoAnimation:_loc3_,hurtFunc:aniFunc});
  888.             return 1;
  889.          }
  890.       }
  891.       return 0;
  892.    }
  893.    function doMotion(evtObj)
  894.    {
  895.       var _loc3_ = evtObj.motion;
  896.       var _loc5_ = evtObj.direction;
  897.       var _loc2_ = "";
  898.       var _loc6_ = undefined;
  899.       var _loc8_ = false;
  900.       if(_loc3_ == "win" || _loc3_ == "lose" || _loc3_ == "intro" || _loc3_ == "hurtUp" || _loc3_ == "hurtDown")
  901.       {
  902.          if(this.status == "skill" && !this._performedSkill.invincible)
  903.          {
  904.             this.setSkillMotionFinished(this._performedSkill);
  905.             _loc8_ = true;
  906.          }
  907.          else if(this.status != "thrown" && this.status != "hurt")
  908.          {
  909.             _loc8_ = true;
  910.          }
  911.       }
  912.       else if(this.status == "punch" || this.status == "kick")
  913.       {
  914.          if(_loc3_ == "down")
  915.          {
  916.             this.direction = "down";
  917.          }
  918.          else if(_loc3_ == "right" || _loc3_ == "left")
  919.          {
  920.             this.direction = "";
  921.          }
  922.       }
  923.       if(this.status == "down" && (_loc5_ == "left" || _loc5_ == "right"))
  924.       {
  925.          this.direction = _loc5_;
  926.       }
  927.       if(_loc8_ || this.status != "jump" && this.status != "punch" && this.status != "kick" && this.status != "hurt" && this.status != "cought" && this.status != "thrown" && this.status != "skill" && this.status != "block")
  928.       {
  929.          if(_loc3_ == "skill" && this.direction != "up")
  930.          {
  931.             if(this.status == "left" || this.status == "right" || this.status == "normal" || this.status == "down")
  932.             {
  933.                var _loc7_ = undefined;
  934.                if(evtObj.isPunch && evtObj.isKick)
  935.                {
  936.                   _loc7_ = this.getSkillByName("Throw");
  937.                }
  938.                else
  939.                {
  940.                   _loc7_ = this.getSkill(evtObj.skillKeys);
  941.                }
  942.                if(_loc7_ != null)
  943.                {
  944.                   _loc2_ = "doSkill";
  945.                   _loc6_ = _loc7_.name;
  946.                }
  947.                else if(evtObj.isPunch)
  948.                {
  949.                   if(this.status == "down")
  950.                   {
  951.                      _loc2_ = "mtDownPower";
  952.                   }
  953.                   else
  954.                   {
  955.                      _loc2_ = "mtPower";
  956.                   }
  957.                }
  958.                else if(evtObj.isKick)
  959.                {
  960.                   if(this.status == "down")
  961.                   {
  962.                      _loc2_ = "mtDownKick";
  963.                   }
  964.                   else
  965.                   {
  966.                      _loc2_ = "mtKick";
  967.                   }
  968.                }
  969.             }
  970.          }
  971.          else if(_loc3_ == "move")
  972.          {
  973.             if(_loc5_ == "right" && this.status != "right")
  974.             {
  975.                _loc2_ = "movRight";
  976.             }
  977.             else if(_loc5_ == "left" && this.status != "left")
  978.             {
  979.                _loc2_ = "movLeft";
  980.             }
  981.          }
  982.          else if(_loc3_ == "jump" && this.direction != "up")
  983.          {
  984.             if(_loc5_ == "right")
  985.             {
  986.                _loc2_ = "movJumpRight";
  987.             }
  988.             else if(_loc5_ == "left")
  989.             {
  990.                _loc2_ = "movJumpLeft";
  991.             }
  992.             else
  993.             {
  994.                _loc2_ = "movJump";
  995.             }
  996.          }
  997.          else if(_loc3_ == "down" && this.direction != "down" && this.status != "down")
  998.          {
  999.             _loc2_ = "movDown";
  1000.          }
  1001.          else if(_loc3_ == "hurtUp")
  1002.          {
  1003.             if(this.status != "hurt")
  1004.             {
  1005.                if(this.direction == "up" || this.status == "jump")
  1006.                {
  1007.                   _loc2_ = "mtBlastHurt";
  1008.                }
  1009.                else
  1010.                {
  1011.                   _loc2_ = "mtHurtUp";
  1012.                }
  1013.                _loc6_ = evtObj.hurtEff;
  1014.             }
  1015.          }
  1016.          else if(_loc3_ == "hurtDown")
  1017.          {
  1018.             if(this.status != "hurt")
  1019.             {
  1020.                if(this.direction == "up" || this.status == "jump")
  1021.                {
  1022.                   _loc2_ = "mtBlastHurt";
  1023.                }
  1024.                else
  1025.                {
  1026.                   _loc2_ = "mtHurtDown";
  1027.                }
  1028.                _loc6_ = evtObj.hurtEff;
  1029.             }
  1030.          }
  1031.          else if(_loc3_ == "blockUp")
  1032.          {
  1033.             if(this.status != "block")
  1034.             {
  1035.                _loc2_ = "mtBlockUp";
  1036.                _loc6_ = evtObj.hurtEff;
  1037.             }
  1038.          }
  1039.          else if(_loc3_ == "blockDown")
  1040.          {
  1041.             if(this.status != "block")
  1042.             {
  1043.                _loc2_ = "mtBlockDown";
  1044.                _loc6_ = evtObj.hurtEff;
  1045.             }
  1046.          }
  1047.          else if(_loc3_ != "cought")
  1048.          {
  1049.             if(_loc3_ != "thrown")
  1050.             {
  1051.                if(_loc3_ == "blastHurt")
  1052.                {
  1053.                   _loc2_ = "mtBlastHurt";
  1054.                   _loc6_ = evtObj.hurtEff;
  1055.                }
  1056.                else if(_loc3_ == "win")
  1057.                {
  1058.                   _loc2_ = "movWin";
  1059.                }
  1060.                else if(_loc3_ == "lose")
  1061.                {
  1062.                   if(this.crtHP > 0)
  1063.                   {
  1064.                      _loc2_ = "movLoseTimeOut";
  1065.                   }
  1066.                   else
  1067.                   {
  1068.                      _loc2_ = "movLose";
  1069.                   }
  1070.                }
  1071.                else if(_loc3_ == "intro")
  1072.                {
  1073.                   _loc2_ = "movIntro";
  1074.                }
  1075.                else if(_loc3_ == "normal")
  1076.                {
  1077.                   _loc2_ = "movNormal";
  1078.                }
  1079.                else if(_loc3_ == "nothing" && evtObj.isDirection)
  1080.                {
  1081.                   if(this.status == "left" || this.status == "right")
  1082.                   {
  1083.                      _loc2_ = "movNormal";
  1084.                   }
  1085.                   else if(this.status == "down")
  1086.                   {
  1087.                      _loc2_ = "movStandUp";
  1088.                   }
  1089.                }
  1090.             }
  1091.          }
  1092.          if(_loc2_ != "")
  1093.          {
  1094.             if(_loc2_ != "doSkill")
  1095.             {
  1096.                this.updaterObj.onEnterFrame = undefined;
  1097.             }
  1098.             this[_loc2_](_loc6_);
  1099.          }
  1100.       }
  1101.    }
  1102.    function doSkill(skl)
  1103.    {
  1104.       if(typeof skl == "string")
  1105.       {
  1106.          skl = this.getSkillByName(skl);
  1107.       }
  1108.       if(this._performedSkill != null)
  1109.       {
  1110.          return undefined;
  1111.       }
  1112.       if(skl.condition())
  1113.       {
  1114.          this.updaterObj.onEnterFrame = undefined;
  1115.          this.status = "skill";
  1116.          this.direction = "";
  1117.          var o = this;
  1118.          this.onceAni(skl.lable,function()
  1119.          {
  1120.             o.movNormal();
  1121.             o.correctPosition();
  1122.             o.correctOffside();
  1123.          }
  1124.          );
  1125.          this.setSkillMotionStarted(skl);
  1126.       }
  1127.    }
  1128.    function setSkillMotionStarted(skl)
  1129.    {
  1130.       if(skl.type != "call")
  1131.       {
  1132.          this._performedSkill = skl;
  1133.       }
  1134.       skl.perform();
  1135.    }
  1136.    function setSkillMotionFinished(skl)
  1137.    {
  1138.       if(this.status != "win" || this.status != "lose")
  1139.       {
  1140.          if(skl.performing)
  1141.          {
  1142.             this._twnF.stop();
  1143.             if(skl.effect != undefined)
  1144.             {
  1145.                skl.onMotionStopped();
  1146.             }
  1147.          }
  1148.          this._performedSkill = null;
  1149.       }
  1150.    }
  1151.    function getCoughtCondition()
  1152.    {
  1153.       if(this.HP > 0 && !this.isInvincible && this.status != "thrown" && this.status != "kick" && this.status != "punch" && this.status != "hurt" && this.direction != "up" && Math.abs(this.ani._x - this.opponent.ani._x) < 42)
  1154.       {
  1155.          if(this._performedSkill != null)
  1156.          {
  1157.             if(this._performedSkill.type == "self")
  1158.             {
  1159.                return false;
  1160.             }
  1161.          }
  1162.          return true;
  1163.       }
  1164.       return false;
  1165.    }
  1166.    function traceStatus()
  1167.    {
  1168.    }
  1169. }
  1170.