25 public void advance(
float amount, CombatEngineAPI engine, BeamAPI beam) {
26 if (beam.getBrightness() < 1f ||
done)
return;
27 float range = beam.getWeapon().getRange();
28 float length = beam.getLengthPrevFrame();
30 if (length > range - 10f || beam.getDamageTarget() !=
null) {
34 Vector2f loc = beam.getRayEndPrevFrame();
39 color = Misc.scaleAlpha(color, a);
40 undercolor = Misc.scaleAlpha(undercolor, a);
43 float dur = beam.getWeapon().getSpec().getBurstDuration() + beam.getWeapon().getSpec().getBeamChargedownTime();
48 Vector2f vel =
new Vector2f();
49 if (beam.getDamageTarget() !=
null) {
50 vel.set(beam.getDamageTarget().getVelocity());
57 public void spawnHitDarkening(Color color, Color undercolor, Vector2f point, Vector2f vel,
float size,
float baseDuration) {
59 if (!engine.getViewport().isNearViewport(point, 100f + size * 2f))
return;
64 for (
int i = 0; i < 5; i++) {
65 float dur = baseDuration + baseDuration * (float) Math.random();
69 Vector2f pt = Misc.getPointWithinRadius(point, nSize * 0.5f);
70 Vector2f v = Misc.getUnitVectorAtDegreeAngle((
float) Math.random() * 360f);
71 v.scale(nSize + nSize * (
float) Math.random() * 0.5f);
73 Vector2f.add(vel, v, v);
75 float maxSpeed = nSize * 1.5f * 0.2f;
76 float minSpeed = nSize * 1f * 0.2f;
77 float overMin = v.length() - minSpeed;
79 float durMult = 1f - overMin / (maxSpeed - minSpeed);
80 if (durMult < 0.1f) durMult = 0.1f;
81 dur *= 0.5f + 0.5f * durMult;
83 engine.addNegativeNebulaParticle(pt, v, nSize * 1f, 2f,
84 0.5f / dur, 0f, dur, c);
87 float dur = baseDuration;
90 for (
int i = 0; i < 12; i++) {
91 Vector2f loc =
new Vector2f(point);
92 loc = Misc.getPointWithinRadius(loc, size * 1f);
93 float s = size * 3f * (0.5f + (float) Math.random() * 0.5f);
94 engine.addNebulaParticle(loc, vel, s, 1.5f, rampUp, 0f, dur, c);
107 public void spawnMine(ShipAPI source, Vector2f mineLoc) {
112 MissileAPI mine = (MissileAPI) engine.spawnProjectile(source,
null,
113 "riftlance_minelayer",
115 (
float) Math.random() * 360f,
null);
116 if (source !=
null) {
118 source, WeaponType.MISSILE,
false, mine.getDamage());
124 float fadeInTime = 0.05f;
125 mine.getVelocity().scale(0);
126 mine.fadeOutThenIn(fadeInTime);
133 mine.setFlightTime(mine.getMaxFlightTime() - liveTime);
134 mine.addDamagedAlready(source);
135 mine.setNoMineFFConcerns(
true);