Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. function NG_mapCellsEachItem(item, cell) {
  3.    
  4.     _ctu[item] = isWeapon(item) ?
  5.         getCellsToUseWeapon(item, _enemy) :
  6.         getCellsToUseChip(item, _enemy)
  7.     ;
  8.    
  9.     _pl[item] =
  10.         NG_getPathLength(
  11.             _nctu[item] = NG_getNearestCellFromCell(_ctu[item], cell),
  12.             cell
  13.         )
  14.     ;
  15. }
  16.  
  17. function NG_mapCells(attaques, fonction) {
  18.  
  19.     var dbg = false;
  20.     var cell = getCell();
  21.    
  22.     _ctu = [];
  23.     _nctu = [];
  24.     _pl = [];
  25.     _cache_pathLengths = [];
  26.    
  27.     arrayIter(attaques, function(item) {
  28.        
  29.         NG_mapCellsEachItem(item, cell);
  30.        
  31.         if(_nctu[item]==null) {
  32.             if(dbg) debug("NG_mapCells> No cell to use");
  33.             return;
  34.         }
  35.  
  36.         if(_pl[item]==null) {
  37.             if(dbg) debug("NG_mapCells> No distance");
  38.             return;
  39.         }
  40.    
  41.         return fonction(item);
  42.     });
  43. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement