コード例 #1
0
 @Override
 protected void executeOverride(final RunningEffect triggerRE, final boolean trigger) {
   if (!this.isValueComputationEnabled()) {
     return;
   }
   if (this.m_caster == null || !(this.m_caster instanceof BasicCharacterInfo)) {
     return;
   }
   if (this.m_nbDepositMin <= 0) {
     return;
   }
   final List<AbstractDepositEffectArea> depositAreas =
       StaticEffectAreaManager.getInstance().getDepositAreas();
   final short casterLevel = ((BasicCharacterInfo) this.m_caster).getLevel();
   final int roll = MathHelper.random(100);
   boolean rareIsDiscovered = false;
   if (roll < this.m_discoverRareDepositPercentage) {
     rareIsDiscovered = true;
   }
   int nbDeposit = MathHelper.random(this.m_nbDepositMin, this.m_nbDepositMax + 1);
   if (rareIsDiscovered) {
     this.spawnRareDeposit(depositAreas, casterLevel);
     --nbDeposit;
   }
   for (int i = 0; i < nbDeposit; ++i) {
     this.spawnDeposit(depositAreas, casterLevel);
   }
 }
コード例 #2
0
 private void spawnDeposit(
     final List<AbstractDepositEffectArea> depositAreas, final short casterLevel) {
   final int roll = MathHelper.random(100);
   AbstractDepositEffectArea deposit = null;
   for (int i = 0, n = depositAreas.size(); i < n; ++i) {
     final AbstractDepositEffectArea area = depositAreas.get(i);
     if (deposit == null) {
       deposit = area;
     } else if ((roll < deposit.getDepositLevel() && roll > area.getDepositLevel())
         || (roll > area.getDepositLevel()
             && area.getDepositLevel() > deposit.getDepositLevel())) {
       deposit = area;
     }
   }
   this.spawnDeposit((int) deposit.getBaseId());
 }
コード例 #3
0
 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())));
 }