private Point3 getRandomCellInEffectArea(final FightMap fightMap) {
   final AreaOfEffect areaOfEffect = ((WakfuEffect) this.m_genericEffect).getAreaOfEffect();
   if (areaOfEffect.getType() == AreaOfEffectEnum.EMPTY) {
     return fightMap.getInsideRandomCell();
   }
   final Direction8 dir = this.m_caster.getDirection();
   final Point3 casterCell = this.m_caster.getPosition();
   final Iterable<int[]> iterable =
       ((WakfuEffect) this.m_genericEffect)
           .getAreaOfEffect()
           .getCells(
               this.m_targetCell.getX(),
               this.m_targetCell.getY(),
               this.m_targetCell.getZ(),
               casterCell.getX(),
               casterCell.getY(),
               casterCell.getZ(),
               dir);
   final ArrayList<int[]> cells = new ArrayList<int[]>();
   for (final int[] next : iterable) {
     final int cellX = next[0];
     final int cellY = next[1];
     if (!fightMap.isInMap(cellX, cellY)) {
       continue;
     }
     if (!fightMap.isInside(cellX, cellY)) {
       continue;
     }
     final short cellHeight = fightMap.getCellHeight(cellX, cellY);
     if (cellHeight == -32768) {
       continue;
     }
     cells.add(next);
   }
   if (cells.isEmpty()) {
     EnutrofDepositPlacement.m_logger.error(
         (Object)
             ("Pas de cellule trouvee pour le spawn d'un gisement " + areaOfEffect.getType()));
     return null;
   }
   return new Point3(cells.get(MathHelper.random(cells.size())));
 }
 private Point3 getRandomCell(final FightMap fightMap) {
   Point3 cell = null;
   for (int i = 0; i < 3; ++i) {
     cell = this.getRandomCellInEffectArea(fightMap);
     if (cell != null) {
       cell.setZ(fightMap.getCellHeight(cell.getX(), cell.getY()));
       final int path = this.getPathToCellValidity(fightMap, cell);
       if (path == -1) {
         cell = null;
       } else {
         if (this.cellAlreadyContainsCasterDeposit(cell)) {
           cell = null;
         }
         if (cell != null) {
           return cell;
         }
       }
     }
   }
   return cell;
 }
 @Override
 public long getLongValue(
     final Object criterionUser,
     final Object criterionTarget,
     final Object criterionContent,
     final Object criterionContext) {
   if (criterionContext == null) {
     throw new CriteriaExecutionException("Pas de contexte...");
   }
   final AbstractFight<?> fight = CriteriaUtils.getFight(criterionUser, criterionContext);
   if (fight == null) {
     throw new CriteriaExecutionException("Impossible de r\u00e9cup\u00e9rer le combat");
   }
   this.hook(criterionUser, criterionTarget, criterionContext, criterionContent);
   final CriterionUser user =
       CriteriaUtils.getTargetCriterionUserFromParameters(
           false, criterionUser, criterionTarget, criterionContext, criterionContent);
   Point3 center = null;
   CriterionUser targetCharacter = null;
   if (!this.m_target) {
     if (user != null) {
       center = user.getPosition();
     }
   } else if (criterionTarget instanceof Point3) {
     center = (Point3) criterionTarget;
   } else {
     targetCharacter =
         CriteriaUtils.getTargetCriterionUserFromParameters(
             true, criterionUser, criterionTarget, criterionContext, criterionContent);
     if (targetCharacter != null) {
       center = targetCharacter.getPosition();
     }
   }
   if (center == null) {
     return 0L;
   }
   final Collection<? extends EffectUser> fighters = this.getFighters(fight, user);
   final Iterator<? extends EffectUser> it = fighters.iterator();
   while (it.hasNext()) {
     final EffectUser fighter = (EffectUser) it.next();
     if (fighter.isActiveProperty(FightPropertyType.CANNOT_BE_EFFECT_TARGET)) {
       it.remove();
     }
   }
   final long maxRange =
       this.m_maxRange.getLongValue(
           criterionUser, criterionTarget, criterionContent, criterionContext);
   if (maxRange <= 0L) {
     return super.getSign() * fighters.size();
   }
   final long minRange =
       (this.m_minRange == null)
           ? 0L
           : this.m_minRange.getLongValue(
               criterionUser, criterionTarget, criterionContent, criterionContext);
   final boolean inLine =
       this.m_inLine != null
           && this.m_inLine.isValid(
               criterionUser, criterionTarget, criterionContent, criterionContext);
   final boolean testLoS =
       this.m_testLoS != null
           && this.m_testLoS.isValid(
               criterionUser, criterionTarget, criterionContent, criterionContext);
   long value = 0L;
   for (final EffectUser fighter2 : fighters) {
     int distanceBetweenUserAndFighter;
     if (targetCharacter != null) {
       distanceBetweenUserAndFighter =
           DistanceUtils.getIntersectionDistance(fighter2, targetCharacter);
     } else {
       distanceBetweenUserAndFighter = DistanceUtils.getIntersectionDistance(fighter2, center);
     }
     if (distanceBetweenUserAndFighter <= maxRange && distanceBetweenUserAndFighter >= minRange) {
       final Point3 fighterPosition = fighter2.getPosition();
       if (inLine
           && center.getX() != fighterPosition.getX()
           && center.getY() != fighterPosition.getY()) {
         continue;
       }
       if (testLoS) {
         final FightMap fightMap = fight.getFightMap();
         final LineOfSightChecker losChecker = LineOfSightChecker.checkOut();
         losChecker.setTopologyMapInstanceSet(fightMap);
         losChecker.setStartPoint(center.getX(), center.getY(), center.getZ());
         losChecker.setEndPoint(
             fighterPosition.getX(), fighterPosition.getY(), fighterPosition.getZ());
         if (!losChecker.checkLOS()) {
           continue;
         }
       }
       ++value;
     }
   }
   return super.getSign() * value;
 }