@Override
  public void onBulletHitBullet(BulletHitBulletEvent event) {
    Point2D bulletPosition = new Point2D.Double(event.getBullet().getX(), event.getBullet().getY());

    GBulletFiredEvent hittedWave = null;
    for (GBulletFiredEvent wave : waves.getWaves()) {
      if (Math.abs(
              bulletPosition.distance(wave.getFiringPosition())
                  - ((getTime() - wave.getFiringTime()) * event.getBullet().getVelocity()))
          < 20) {
        hittedWave = wave;
        break;
      }
    }

    if (hittedWave == null) return;

    double firingOffset =
        org.pattern.utils.Utils.firingOffset(
            hittedWave.getFiringPosition(), hittedWave.getTargetPosition(), bulletPosition);
    double mae = firingOffset > 0 ? hittedWave.getMaxMAE() : hittedWave.getMinMAE();
    double gf = firingOffset > 0 ? firingOffset / mae : -firingOffset / mae;

    storages.get(event.getBullet().getName()).visit(gf);
    waves.getWaves().remove(hittedWave);
    return;
  }
Example #2
0
  public void onBulletHitBullet(BulletHitBulletEvent e) {
    ScanLog.onBulletHitBullet(e);

    processBulletReturnFiringWave(e.getHitBullet(), e.getTime());

    _weightedEnemyShotsFired--;
    _weightedEnemyShotsFiredThisRound--;
    //        	(firingDistance
    //        		/ DUtils.bulletVelocity(e.getBullet().getPower()))
    //        	/ (TYPICAL_DISTANCE / POWER_TWO_BULLET_VELOCITY);
  }