Advertisement
yatoxnakadashi

Untitled

Mar 30th, 2023 (edited)
384
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Decompiled using JPEXS Free Flash Decompiler. The interesting function is com_thinking().
  2.  
  3. class dw.Game
  4. {
  5.    var XMAX = 32;
  6.    var YMAX = 28;
  7.    var pmax = 7;
  8.    var user = 0;
  9.    var put_dice = 3;
  10.    var STOCK_MAX = 64;
  11.    function Game()
  12.    {
  13.       var _loc2_ = undefined;
  14.       var _loc3_ = undefined;
  15.       this.AREA_MAX = 32;
  16.       this.adat = new Array(32);
  17.       this.player = new Array(8);
  18.       this.jun = new Array(8);
  19.       this.cel_max = this.XMAX * this.YMAX;
  20.       this.cel = new Array(this.cel_max);
  21.       this.num = new Array(this.cel_max);
  22.       this.rcel = new Array(this.cel_max);
  23.       _loc2_ = 0;
  24.       while(_loc2_ < this.cel_max)
  25.       {
  26.          this.num[_loc2_] = _loc2_;
  27.          _loc2_ = _loc2_ + 1;
  28.       }
  29.       this.join = new Array(this.cel_max);
  30.       _loc2_ = 0;
  31.       while(_loc2_ < this.cel_max)
  32.       {
  33.          this.join[_loc2_] = new dw.JoinData();
  34.          _loc3_ = 0;
  35.          while(_loc3_ < 6)
  36.          {
  37.             this.join[_loc2_].dir[_loc3_] = this.next_cel(_loc2_,_loc3_);
  38.             _loc3_ = _loc3_ + 1;
  39.          }
  40.          _loc2_ = _loc2_ + 1;
  41.       }
  42.    }
  43.    function start_game()
  44.    {
  45.       var _loc2_ = undefined;
  46.       _loc2_ = 0;
  47.       while(_loc2_ < 8)
  48.       {
  49.          this.jun[_loc2_] = _loc2_;
  50.          _loc2_ = _loc2_ + 1;
  51.       }
  52.       _loc2_ = 0;
  53.       while(_loc2_ < this.pmax)
  54.       {
  55.          var _loc3_ = Math.floor(Math.random() * this.pmax);
  56.          var _loc4_ = this.jun[_loc2_];
  57.          this.jun[_loc2_] = this.jun[_loc3_];
  58.          this.jun[_loc3_] = _loc4_;
  59.          _loc2_ = _loc2_ + 1;
  60.       }
  61.       this.ban = 0;
  62.       _loc2_ = 0;
  63.       while(_loc2_ < 8)
  64.       {
  65.          this.player[_loc2_] = new dw.PlayerData();
  66.          _loc2_ = _loc2_ + 1;
  67.       }
  68.       _loc2_ = 0;
  69.       while(_loc2_ < 8)
  70.       {
  71.          this.set_area_tc(_loc2_);
  72.          _loc2_ = _loc2_ + 1;
  73.       }
  74.       this.his = new Array();
  75.       this.his_c = 0;
  76.       this.his_arm = new Array(this.AREA_MAX);
  77.       this.his_dice = new Array(this.AREA_MAX);
  78.       _loc2_ = 0;
  79.       while(_loc2_ < this.AREA_MAX)
  80.       {
  81.          this.his_arm[_loc2_] = this.adat[_loc2_].arm;
  82.          this.his_dice[_loc2_] = this.adat[_loc2_].dice;
  83.          _loc2_ = _loc2_ + 1;
  84.       }
  85.    }
  86.    function get_pn()
  87.    {
  88.       return this.jun[this.ban];
  89.    }
  90.    function make_map()
  91.    {
  92.       var _loc2_ = undefined;
  93.       var _loc3_ = undefined;
  94.       var _loc6_ = undefined;
  95.       var _loc12_ = undefined;
  96.       var _loc22_ = undefined;
  97.       _loc2_ = 0;
  98.       while(_loc2_ < this.cel_max)
  99.       {
  100.          var _loc19_ = Math.floor(Math.random() * this.cel_max);
  101.          var _loc23_ = this.num[_loc2_];
  102.          this.num[_loc2_] = this.num[_loc19_];
  103.          this.num[_loc19_] = _loc23_;
  104.          _loc2_ = _loc2_ + 1;
  105.       }
  106.       _loc2_ = 0;
  107.       while(_loc2_ < this.cel_max)
  108.       {
  109.          this.cel[_loc2_] = 0;
  110.          this.rcel[_loc2_] = 0;
  111.          _loc2_ = _loc2_ + 1;
  112.       }
  113.       _loc22_ = 1;
  114.       this.rcel[Math.floor(Math.random() * this.cel_max)] = 1;
  115.       while(true)
  116.       {
  117.          var _loc4_ = undefined;
  118.          var _loc14_ = 9999;
  119.          _loc2_ = 0;
  120.          while(_loc2_ < this.cel_max)
  121.          {
  122.             if(this.cel[_loc2_] <= 0)
  123.             {
  124.                if(this.num[_loc2_] <= _loc14_)
  125.                {
  126.                   if(this.rcel[_loc2_] != 0)
  127.                   {
  128.                      _loc14_ = this.num[_loc2_];
  129.                      _loc4_ = _loc2_;
  130.                   }
  131.                }
  132.             }
  133.             _loc2_ = _loc2_ + 1;
  134.          }
  135.          if(_loc14_ == 9999)
  136.          {
  137.             break;
  138.          }
  139.          var _loc21_ = this.percolate(_loc4_,8,_loc22_);
  140.          if(_loc21_ == 0)
  141.          {
  142.             break;
  143.          }
  144.          _loc22_ = _loc22_ + 1;
  145.          if(_loc22_ >= this.AREA_MAX)
  146.          {
  147.             break;
  148.          }
  149.       }
  150.       _loc2_ = 0;
  151.       while(_loc2_ < this.cel_max)
  152.       {
  153.          if(this.cel[_loc2_] <= 0)
  154.          {
  155.             var _loc10_ = 0;
  156.             var _loc16_ = 0;
  157.             _loc6_ = 0;
  158.             while(_loc6_ < 6)
  159.             {
  160.                _loc4_ = this.join[_loc2_].dir[_loc6_];
  161.                if(_loc4_ >= 0)
  162.                {
  163.                   if(this.cel[_loc4_] == 0)
  164.                   {
  165.                      _loc10_ = 1;
  166.                   }
  167.                   else
  168.                   {
  169.                      _loc16_ = this.cel[_loc4_];
  170.                   }
  171.                }
  172.                _loc6_ = _loc6_ + 1;
  173.             }
  174.             if(_loc10_ == 0)
  175.             {
  176.                this.cel[_loc2_] = _loc16_;
  177.             }
  178.          }
  179.          _loc2_ = _loc2_ + 1;
  180.       }
  181.       _loc2_ = 0;
  182.       while(_loc2_ < this.AREA_MAX)
  183.       {
  184.          this.adat[_loc2_] = new dw.AreaData();
  185.          _loc2_ = _loc2_ + 1;
  186.       }
  187.       _loc2_ = 0;
  188.       while(_loc2_ < this.cel_max)
  189.       {
  190.          _loc22_ = this.cel[_loc2_];
  191.          if(_loc22_ > 0)
  192.          {
  193.             this.adat[_loc22_].size = this.adat[_loc22_].size + 1;
  194.          }
  195.          _loc2_ = _loc2_ + 1;
  196.       }
  197.       _loc2_ = 1;
  198.       while(_loc2_ < this.AREA_MAX)
  199.       {
  200.          if(this.adat[_loc2_].size <= 5)
  201.          {
  202.             this.adat[_loc2_].size = 0;
  203.          }
  204.          _loc2_ = _loc2_ + 1;
  205.       }
  206.       _loc2_ = 0;
  207.       while(_loc2_ < this.cel_max)
  208.       {
  209.          _loc22_ = this.cel[_loc2_];
  210.          if(this.adat[_loc22_].size == 0)
  211.          {
  212.             this.cel[_loc2_] = 0;
  213.          }
  214.          _loc2_ = _loc2_ + 1;
  215.       }
  216.       _loc2_ = 1;
  217.       while(_loc2_ < this.AREA_MAX)
  218.       {
  219.          this.adat[_loc2_].left = this.XMAX;
  220.          this.adat[_loc2_].right = -1;
  221.          this.adat[_loc2_].top = this.YMAX;
  222.          this.adat[_loc2_].bottom = -1;
  223.          this.adat[_loc2_].len_min = 9999;
  224.          _loc2_ = _loc2_ + 1;
  225.       }
  226.       _loc12_ = 0;
  227.       _loc2_ = 0;
  228.       while(_loc2_ < this.YMAX)
  229.       {
  230.          _loc3_ = 0;
  231.          while(_loc3_ < this.XMAX)
  232.          {
  233.             _loc22_ = this.cel[_loc12_];
  234.             if(_loc22_ > 0)
  235.             {
  236.                if(_loc3_ < this.adat[_loc22_].left)
  237.                {
  238.                   this.adat[_loc22_].left = _loc3_;
  239.                }
  240.                if(_loc3_ > this.adat[_loc22_].right)
  241.                {
  242.                   this.adat[_loc22_].right = _loc3_;
  243.                }
  244.                if(_loc2_ < this.adat[_loc22_].top)
  245.                {
  246.                   this.adat[_loc22_].top = _loc2_;
  247.                }
  248.                if(_loc2_ > this.adat[_loc22_].bottom)
  249.                {
  250.                   this.adat[_loc22_].bottom = _loc2_;
  251.                }
  252.             }
  253.             _loc12_ = _loc12_ + 1;
  254.             _loc3_ = _loc3_ + 1;
  255.          }
  256.          _loc2_ = _loc2_ + 1;
  257.       }
  258.       _loc2_ = 1;
  259.       while(_loc2_ < this.AREA_MAX)
  260.       {
  261.          this.adat[_loc2_].cx = Math.floor((this.adat[_loc2_].left + this.adat[_loc2_].right) / 2);
  262.          this.adat[_loc2_].cy = Math.floor((this.adat[_loc2_].top + this.adat[_loc2_].bottom) / 2);
  263.          _loc2_ = _loc2_ + 1;
  264.       }
  265.       _loc12_ = 0;
  266.       var _loc8_ = undefined;
  267.       var _loc7_ = undefined;
  268.       var _loc11_ = undefined;
  269.       _loc2_ = 0;
  270.       while(_loc2_ < this.YMAX)
  271.       {
  272.          _loc3_ = 0;
  273.          while(_loc3_ < this.XMAX)
  274.          {
  275.             _loc22_ = this.cel[_loc12_];
  276.             if(_loc22_ > 0)
  277.             {
  278.                _loc8_ = this.adat[_loc22_].cx - _loc3_;
  279.                if(_loc8_ < 0)
  280.                {
  281.                   _loc8_ = - _loc8_;
  282.                }
  283.                _loc7_ = this.adat[_loc22_].cy - _loc2_;
  284.                if(_loc7_ < 0)
  285.                {
  286.                   _loc7_ = - _loc7_;
  287.                }
  288.                _loc11_ = _loc8_ + _loc7_;
  289.                _loc10_ = 0;
  290.                _loc6_ = 0;
  291.                while(_loc6_ < 6)
  292.                {
  293.                   _loc4_ = this.join[_loc12_].dir[_loc6_];
  294.                   if(_loc4_ > 0)
  295.                   {
  296.                      var _loc5_ = this.cel[_loc4_];
  297.                      if(_loc5_ != _loc22_)
  298.                      {
  299.                         _loc10_ = 1;
  300.                         this.adat[_loc22_].join[_loc5_] = 1;
  301.                      }
  302.                   }
  303.                   _loc6_ = _loc6_ + 1;
  304.                }
  305.                if(_loc10_)
  306.                {
  307.                   _loc11_ += 4;
  308.                }
  309.                if(_loc11_ < this.adat[_loc22_].len_min)
  310.                {
  311.                   this.adat[_loc22_].len_min = _loc11_;
  312.                   this.adat[_loc22_].cpos = _loc2_ * this.XMAX + _loc3_;
  313.                }
  314.             }
  315.             _loc12_ = _loc12_ + 1;
  316.             _loc3_ = _loc3_ + 1;
  317.          }
  318.          _loc2_ = _loc2_ + 1;
  319.       }
  320.       _loc2_ = 0;
  321.       while(_loc2_ < this.AREA_MAX)
  322.       {
  323.          this.adat[_loc2_].arm = -1;
  324.          _loc2_ = _loc2_ + 1;
  325.       }
  326.       var _loc18_ = 0;
  327.       var _loc20_ = new Array(this.AREA_MAX);
  328.       while(true)
  329.       {
  330.          _loc12_ = 0;
  331.          _loc2_ = 1;
  332.          while(_loc2_ < this.AREA_MAX)
  333.          {
  334.             if(this.adat[_loc2_].size != 0)
  335.             {
  336.                if(this.adat[_loc2_].arm < 0)
  337.                {
  338.                   _loc20_[_loc12_] = _loc2_;
  339.                   _loc12_ = _loc12_ + 1;
  340.                }
  341.             }
  342.             _loc2_ = _loc2_ + 1;
  343.          }
  344.          if(_loc12_ == 0)
  345.          {
  346.             break;
  347.          }
  348.          _loc22_ = _loc20_[Math.floor(Math.random() % _loc12_)];
  349.          this.adat[_loc22_].arm = _loc18_;
  350.          _loc18_ = _loc18_ + 1;
  351.          if(_loc18_ >= this.pmax)
  352.          {
  353.             _loc18_ = 0;
  354.          }
  355.       }
  356.       this.chk = new Array(this.AREA_MAX);
  357.       _loc2_ = 0;
  358.       while(_loc2_ < this.AREA_MAX)
  359.       {
  360.          this.chk[_loc2_] = 0;
  361.          _loc2_ = _loc2_ + 1;
  362.       }
  363.       _loc2_ = 0;
  364.       while(_loc2_ < this.cel_max)
  365.       {
  366.          var _loc9_ = this.cel[_loc2_];
  367.          if(_loc9_ != 0)
  368.          {
  369.             if(!this.chk[_loc9_])
  370.             {
  371.                _loc6_ = 0;
  372.                while(_loc6_ < 6)
  373.                {
  374.                   if(this.chk[_loc9_])
  375.                   {
  376.                      break;
  377.                   }
  378.                   var _loc13_ = this.join[_loc2_].dir[_loc6_];
  379.                   if(_loc13_ >= 0)
  380.                   {
  381.                      if(this.cel[_loc13_] != _loc9_)
  382.                      {
  383.                         this.set_area_line(_loc2_,_loc6_);
  384.                         this.chk[_loc9_] = 1;
  385.                      }
  386.                   }
  387.                   _loc6_ = _loc6_ + 1;
  388.                }
  389.             }
  390.          }
  391.          _loc2_ = _loc2_ + 1;
  392.       }
  393.       var _loc24_ = 0;
  394.       _loc2_ = 1;
  395.       while(_loc2_ < this.AREA_MAX)
  396.       {
  397.          if(this.adat[_loc2_].size > 0)
  398.          {
  399.             _loc24_ = _loc24_ + 1;
  400.             this.adat[_loc2_].dice = 1;
  401.          }
  402.          _loc2_ = _loc2_ + 1;
  403.       }
  404.       _loc24_ *= this.put_dice - 1;
  405.       var _loc15_ = 0;
  406.       _loc2_ = 0;
  407.       while(_loc2_ < _loc24_)
  408.       {
  409.          var _loc17_ = new Array(this.AREA_MAX);
  410.          _loc12_ = 0;
  411.          _loc3_ = 1;
  412.          while(_loc3_ < this.AREA_MAX)
  413.          {
  414.             if(this.adat[_loc3_].size != 0)
  415.             {
  416.                if(this.adat[_loc3_].arm == _loc15_)
  417.                {
  418.                   if(this.adat[_loc3_].dice < 8)
  419.                   {
  420.                      _loc17_[_loc12_] = _loc3_;
  421.                      _loc12_ = _loc12_ + 1;
  422.                   }
  423.                }
  424.             }
  425.             _loc3_ = _loc3_ + 1;
  426.          }
  427.          if(_loc12_ == 0)
  428.          {
  429.             break;
  430.          }
  431.          _loc22_ = _loc17_[Math.floor(Math.random() * _loc12_)];
  432.          this.adat[_loc22_].dice = this.adat[_loc22_].dice + 1;
  433.          _loc15_ = _loc15_ + 1;
  434.          if(_loc15_ >= this.pmax)
  435.          {
  436.             _loc15_ = 0;
  437.          }
  438.          _loc2_ = _loc2_ + 1;
  439.       }
  440.       _loc2_ = 0;
  441.       while(_loc2_ < this.AREA_MAX)
  442.       {
  443.          _loc2_ = _loc2_ + 1;
  444.       }
  445.    }
  446.    function percolate(pt, cmax, an)
  447.    {
  448.       if(cmax < 3)
  449.       {
  450.          cmax = 3;
  451.       }
  452.       var _loc2_ = undefined;
  453.       var _loc11_ = undefined;
  454.       var _loc3_ = undefined;
  455.       var _loc6_ = pt;
  456.       this.next_f = new Array(this.cel_max);
  457.       _loc2_ = 0;
  458.       while(_loc2_ < this.cel_max)
  459.       {
  460.          this.next_f[_loc2_] = 0;
  461.          _loc2_ = _loc2_ + 1;
  462.       }
  463.       var _loc7_ = 0;
  464.       while(true)
  465.       {
  466.          this.cel[_loc6_] = an;
  467.          _loc7_ = _loc7_ + 1;
  468.          _loc2_ = 0;
  469.          while(_loc2_ < 6)
  470.          {
  471.             var _loc4_ = this.join[_loc6_].dir[_loc2_];
  472.             if(_loc4_ >= 0)
  473.             {
  474.                this.next_f[_loc4_] = 1;
  475.             }
  476.             _loc2_ = _loc2_ + 1;
  477.          }
  478.          var _loc5_ = 9999;
  479.          _loc2_ = 0;
  480.          while(_loc2_ < this.cel_max)
  481.          {
  482.             if(this.next_f[_loc2_] != 0)
  483.             {
  484.                if(this.cel[_loc2_] <= 0)
  485.                {
  486.                   if(this.num[_loc2_] <= _loc5_)
  487.                   {
  488.                      _loc5_ = this.num[_loc2_];
  489.                      _loc6_ = _loc2_;
  490.                   }
  491.                }
  492.             }
  493.             _loc2_ = _loc2_ + 1;
  494.          }
  495.          if(_loc5_ == 9999)
  496.          {
  497.             break;
  498.          }
  499.          if(_loc7_ >= cmax)
  500.          {
  501.             break;
  502.          }
  503.       }
  504.       _loc2_ = 0;
  505.       while(_loc2_ < this.cel_max)
  506.       {
  507.          if(this.next_f[_loc2_] != 0)
  508.          {
  509.             if(this.cel[_loc2_] <= 0)
  510.             {
  511.                this.cel[_loc2_] = an;
  512.                _loc7_ = _loc7_ + 1;
  513.                _loc3_ = 0;
  514.                while(_loc3_ < 6)
  515.                {
  516.                   _loc4_ = this.join[_loc2_].dir[_loc3_];
  517.                   if(_loc4_ >= 0)
  518.                   {
  519.                      this.rcel[_loc4_] = 1;
  520.                   }
  521.                   _loc3_ = _loc3_ + 1;
  522.                }
  523.             }
  524.          }
  525.          _loc2_ = _loc2_ + 1;
  526.       }
  527.       return _loc7_;
  528.    }
  529.    function set_area_line(old_cel, old_dir)
  530.    {
  531.       var _loc4_ = old_cel;
  532.       var _loc2_ = old_dir;
  533.       var _loc7_ = this.cel[_loc4_];
  534.       var _loc6_ = 0;
  535.       this.adat[_loc7_].line_cel[_loc6_] = _loc4_;
  536.       this.adat[_loc7_].line_dir[_loc6_] = _loc2_;
  537.       _loc6_ = _loc6_ + 1;
  538.       var _loc5_ = 0;
  539.       while(_loc5_ < 100)
  540.       {
  541.          _loc2_ = _loc2_ + 1;
  542.          if(_loc2_ >= 6)
  543.          {
  544.             _loc2_ = 0;
  545.          }
  546.          var _loc3_ = this.join[_loc4_].dir[_loc2_];
  547.          if(_loc3_ >= 0)
  548.          {
  549.             if(this.cel[_loc3_] == _loc7_)
  550.             {
  551.                _loc4_ = _loc3_;
  552.                _loc2_ -= 2;
  553.                if(_loc2_ < 0)
  554.                {
  555.                   _loc2_ += 6;
  556.                }
  557.             }
  558.          }
  559.          this.adat[_loc7_].line_cel[_loc6_] = _loc4_;
  560.          this.adat[_loc7_].line_dir[_loc6_] = _loc2_;
  561.          _loc6_ = _loc6_ + 1;
  562.          if(_loc4_ == old_cel && _loc2_ == old_dir)
  563.          {
  564.             break;
  565.          }
  566.          _loc5_ = _loc5_ + 1;
  567.       }
  568.    }
  569.    function next_cel(opos, dir)
  570.    {
  571.       var _loc8_ = opos % this.XMAX;
  572.       var _loc7_ = Math.floor(opos / this.XMAX);
  573.       var _loc4_ = _loc7_ % 2;
  574.       var _loc2_ = 0;
  575.       var _loc3_ = 0;
  576.       switch(dir)
  577.       {
  578.          case 0:
  579.             _loc2_ = !_loc4_ ? 0 : 1;
  580.             _loc3_ = -1;
  581.             break;
  582.          case 1:
  583.             _loc2_ = 1;
  584.             break;
  585.          case 2:
  586.             _loc2_ = !_loc4_ ? 0 : 1;
  587.             _loc3_ = 1;
  588.             break;
  589.          case 3:
  590.             _loc2_ = !_loc4_ ? -1 : 0;
  591.             _loc3_ = 1;
  592.             break;
  593.          case 4:
  594.             _loc2_ = -1;
  595.             break;
  596.          case 5:
  597.             _loc2_ = !_loc4_ ? -1 : 0;
  598.             _loc3_ = -1;
  599.       }
  600.       var _loc6_ = _loc8_ + _loc2_;
  601.       var _loc5_ = _loc7_ + _loc3_;
  602.       if(_loc6_ < 0 || _loc5_ < 0 || _loc6_ >= this.XMAX || _loc5_ >= this.YMAX)
  603.       {
  604.          return -1;
  605.       }
  606.       return _loc5_ * this.XMAX + _loc6_;
  607.    }
  608.    function set_area_tc(pn)
  609.    {
  610.       this.player[pn].area_tc = 0;
  611.       var _loc2_ = undefined;
  612.       var _loc3_ = undefined;
  613.       this.chk = new Array(this.AREA_MAX);
  614.       _loc2_ = 0;
  615.       while(_loc2_ < this.AREA_MAX)
  616.       {
  617.          this.chk[_loc2_] = _loc2_;
  618.          _loc2_ = _loc2_ + 1;
  619.       }
  620.       while(true)
  621.       {
  622.          var _loc4_ = 0;
  623.          _loc2_ = 1;
  624.          while(_loc2_ < this.AREA_MAX)
  625.          {
  626.             if(this.adat[_loc2_].size != 0)
  627.             {
  628.                if(this.adat[_loc2_].arm == pn)
  629.                {
  630.                   _loc3_ = 1;
  631.                   while(_loc3_ < this.AREA_MAX)
  632.                   {
  633.                      if(this.adat[_loc3_].size != 0)
  634.                      {
  635.                         if(this.adat[_loc3_].arm == pn)
  636.                         {
  637.                            if(this.adat[_loc2_].join[_loc3_] != 0)
  638.                            {
  639.                               if(this.chk[_loc3_] != this.chk[_loc2_])
  640.                               {
  641.                                  if(this.chk[_loc2_] > this.chk[_loc3_])
  642.                                  {
  643.                                     this.chk[_loc2_] = this.chk[_loc3_];
  644.                                  }
  645.                                  else
  646.                                  {
  647.                                     this.chk[_loc3_] = this.chk[_loc2_];
  648.                                  }
  649.                                  _loc4_ = 1;
  650.                                  break;
  651.                               }
  652.                            }
  653.                         }
  654.                      }
  655.                      _loc3_ = _loc3_ + 1;
  656.                   }
  657.                   if(_loc4_)
  658.                   {
  659.                      break;
  660.                   }
  661.                }
  662.             }
  663.             _loc2_ = _loc2_ + 1;
  664.          }
  665.          if(_loc4_ == 0)
  666.          {
  667.             break;
  668.          }
  669.       }
  670.       this.tc = new Array(this.AREA_MAX);
  671.       _loc2_ = 0;
  672.       while(_loc2_ < this.AREA_MAX)
  673.       {
  674.          this.tc[_loc2_] = 0;
  675.          _loc2_ = _loc2_ + 1;
  676.       }
  677.       _loc2_ = 1;
  678.       while(_loc2_ < this.AREA_MAX)
  679.       {
  680.          if(this.adat[_loc2_].size != 0)
  681.          {
  682.             if(this.adat[_loc2_].arm == pn)
  683.             {
  684.                this.tc[this.chk[_loc2_]]++;
  685.             }
  686.          }
  687.          _loc2_ = _loc2_ + 1;
  688.       }
  689.       var _loc6_ = 0;
  690.       _loc2_ = 0;
  691.       while(_loc2_ < this.AREA_MAX)
  692.       {
  693.          if(this.tc[_loc2_] > _loc6_)
  694.          {
  695.             _loc6_ = this.tc[_loc2_];
  696.          }
  697.          _loc2_ = _loc2_ + 1;
  698.       }
  699.       this.player[pn].area_tc = _loc6_;
  700.    }
  701.    function com_thinking()
  702.    {
  703.       var _loc2_ = undefined;
  704.       var _loc3_ = undefined;
  705.       _loc2_ = 0;
  706.       while(_loc2_ < 8)
  707.       {
  708.          this.player[_loc2_].area_c = 0;
  709.          this.player[_loc2_].dice_c = 0;
  710.          _loc2_ = _loc2_ + 1;
  711.       }
  712.       var _loc11_ = 0;
  713.       _loc2_ = 1;
  714.       while(_loc2_ < this.AREA_MAX)
  715.       {
  716.          if(this.adat[_loc2_].size != 0)
  717.          {
  718.             var _loc10_ = this.adat[_loc2_].arm;
  719.             this.player[_loc10_].area_c = this.player[_loc10_].area_c + 1;
  720.             this.player[_loc10_].dice_c += this.adat[_loc2_].dice;
  721.             _loc11_ += this.adat[_loc2_].dice;
  722.          }
  723.          _loc2_ = _loc2_ + 1;
  724.       }
  725.       _loc2_ = 0;
  726.       while(_loc2_ < 8)
  727.       {
  728.          this.player[_loc2_].dice_jun = _loc2_;
  729.          _loc2_ = _loc2_ + 1;
  730.       }
  731.       _loc2_ = 0;
  732.       while(_loc2_ < 7)
  733.       {
  734.          _loc3_ = _loc2_ + 1;
  735.          while(_loc3_ < 8)
  736.          {
  737.             if(this.player[_loc2_].dice_c < this.player[_loc3_].dice_c)
  738.             {
  739.                var _loc7_ = this.player[_loc2_].dice_jun;
  740.                this.player[_loc2_].dice_jun = this.player[_loc3_].dice_jun;
  741.                this.player[_loc3_].dice_jun = _loc7_;
  742.             }
  743.             _loc3_ = _loc3_ + 1;
  744.          }
  745.          _loc2_ = _loc2_ + 1;
  746.       }
  747.       var _loc5_ = -1;
  748.       _loc2_ = 0;
  749.       while(_loc2_ < 8)
  750.       {
  751.          if(this.player[_loc2_].dice_c > _loc11_ * 2 / 5)
  752.          {
  753.             _loc5_ = _loc2_;
  754.          }
  755.          _loc2_ = _loc2_ + 1;
  756.       }
  757.       this.list_from = new Array(this.AREA_MAX * this.AREA_MAX);
  758.       this.list_to = new Array(this.AREA_MAX * this.AREA_MAX);
  759.       var _loc6_ = 0;
  760.       var _loc9_ = this.jun[this.ban];
  761.       _loc2_ = 1;
  762.       while(_loc2_ < this.AREA_MAX)
  763.       {
  764.          if(this.adat[_loc2_].size != 0)
  765.          {
  766.             if(this.adat[_loc2_].arm == _loc9_)
  767.             {
  768.                if(this.adat[_loc2_].dice > 1)
  769.                {
  770.                   _loc3_ = 1;
  771.                   for(; _loc3_ < this.AREA_MAX; _loc3_ = _loc3_ + 1)
  772.                   {
  773.                      if(this.adat[_loc3_].size != 0)
  774.                      {
  775.                         if(this.adat[_loc3_].arm != _loc9_)
  776.                         {
  777.                            if(this.adat[_loc2_].join[_loc3_] != 0)
  778.                            {
  779.                               if(_loc5_ >= 0)
  780.                               {
  781.                                  if(this.adat[_loc2_].arm != _loc5_ && this.adat[_loc3_].arm != _loc5_)
  782.                                  {
  783.                                     continue;
  784.                                  }
  785.                               }
  786.                               if(this.adat[_loc3_].dice <= this.adat[_loc2_].dice)
  787.                               {
  788.                                  if(this.adat[_loc3_].dice == this.adat[_loc2_].dice)
  789.                                  {
  790.                                     var _loc8_ = this.adat[_loc3_].arm;
  791.                                     var _loc4_ = 0;
  792.                                     if(this.player[_loc9_].dice_jun == 0)
  793.                                     {
  794.                                        _loc4_ = 1;
  795.                                     }
  796.                                     if(this.player[_loc8_].dice_jun == 0)
  797.                                     {
  798.                                        _loc4_ = 1;
  799.                                     }
  800.                                     if(Math.random() * 10 > 1)
  801.                                     {
  802.                                        _loc4_ = 1;
  803.                                     }
  804.                                     if(_loc4_ == 0)
  805.                                     {
  806.                                        continue;
  807.                                     }
  808.                                  }
  809.                                  this.list_from[_loc6_] = _loc2_;
  810.                                  this.list_to[_loc6_] = _loc3_;
  811.                                  _loc6_ = _loc6_ + 1;
  812.                               }
  813.                            }
  814.                         }
  815.                      }
  816.                   }
  817.                }
  818.             }
  819.          }
  820.          _loc2_ = _loc2_ + 1;
  821.       }
  822.       if(_loc6_ == 0)
  823.       {
  824.          return 0;
  825.       }
  826.       var _loc12_ = Math.floor(Math.random() * _loc6_);
  827.       this.area_from = this.list_from[_loc12_];
  828.       this.area_to = this.list_to[_loc12_];
  829.    }
  830.    function set_his(from, to, res)
  831.    {
  832.       this.his[this.his_c] = new dw.HistoryData();
  833.       this.his[this.his_c].from = from;
  834.       this.his[this.his_c].to = to;
  835.       this.his[this.his_c].res = res;
  836.       this.his_c = this.his_c + 1;
  837.    }
  838. }
  839.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement