45 public void advance(
float amount, CombatEngineAPI engine, BeamAPI beam) {
50 if (
numToSpawn <= 0 && beam.getDamageTarget() !=
null) {
51 float range = beam.getWeapon().getRange();
52 float length = beam.getLengthPrevFrame();
56 numToSpawn = (int) ((range - length) / perSpawn) + 1;
63 if (beam.getBrightness() >= 1f) {
74 float range = beam.getWeapon().getRange();
75 float length = beam.getLengthPrevFrame();
81 rangeToSpawnAt = range;
84 ShipAPI ship = beam.getSource();
86 boolean spawnedMine =
false;
87 if (length > rangeToSpawnAt - 10f) {
88 float angle = Misc.getAngleInDegrees(beam.getFrom(), beam.getRayEndPrevFrame());
89 Vector2f loc = Misc.getUnitVectorAtDegreeAngle(angle);
90 loc.scale(rangeToSpawnAt);
91 Vector2f.add(loc, beam.getFrom(), loc);
95 }
else if (beam.getDamageTarget() !=
null) {
97 float thickness = beam.getWidth();
98 engine.spawnEmpArcVisual(
arcFrom,
null, arcTo,
null, thickness, beam.getFringeColor(), Color.white);
117 public Vector2f
getNextArcLoc(CombatEngineAPI engine, BeamAPI beam,
float perSpawn) {
118 CombatEntityAPI target = beam.getDamageTarget();
121 arcFrom =
new Vector2f(beam.getRayEndPrevFrame());
128 float beamAngle = Misc.getAngleInDegrees(beam.getFrom(), beam.getRayEndPrevFrame());
129 float beamSourceToTarget = Misc.getAngleInDegrees(beam.getFrom(), target.getLocation());
133 spawnDir = Misc.getClosestTurnDirection(beamAngle, beamSourceToTarget);
135 boolean computeNextLoc =
false;
138 if (dist < perSpawn) {
140 computeNextLoc =
true;
143 if (!computeNextLoc) {
151 Vector2f targetLoc = target.getLocation();
152 float targetRadius = target.getCollisionRadius();
160 boolean hitShield = target.getShield() !=
null && target.getShield().isWithinArc(beam.getRayEndPrevFrame());
169 float prevAngle = Misc.getAngleInDegrees(targetLoc,
arcFrom);
170 float anglePerSegment = 360f * perSpawn / (3.14f * 2f * targetRadius);
171 if (anglePerSegment > 90f) anglePerSegment = 90f;
172 float angle = prevAngle + anglePerSegment *
spawnDir;
175 Vector2f arcTo = Misc.getUnitVectorAtDegreeAngle(angle);
176 arcTo.scale(targetRadius);
177 Vector2f.add(targetLoc, arcTo, arcTo);
182 actualRadius += 30f + 50f * (float) Math.random();
184 actualRadius += 30f + 50f * (float) Math.random();
193 arcTo = Misc.getUnitVectorAtDegreeAngle(angle);
194 arcTo.scale(actualRadius);
195 Vector2f.add(targetLoc, arcTo, arcTo);
203 public void spawnMine(ShipAPI source, Vector2f mineLoc) {
208 MissileAPI mine = (MissileAPI) engine.spawnProjectile(source,
null,
211 (
float) Math.random() * 360f,
null);
212 if (source !=
null) {
214 source, WeaponType.MISSILE,
false, mine.getDamage());
220 float fadeInTime = 0.05f;
221 mine.getVelocity().scale(0);
222 mine.fadeOutThenIn(fadeInTime);
229 mine.setFlightTime(mine.getMaxFlightTime() - liveTime);
230 mine.addDamagedAlready(source);