001package com.fs.starfarer.api.combat;
002
003import java.util.EnumSet;
004import java.util.Set;
005
006import java.awt.Color;
007
008import org.json.JSONObject;
009import org.lwjgl.util.vector.Vector2f;
010
011import com.fs.starfarer.api.graphics.SpriteAPI;
012import com.fs.starfarer.api.loading.MissileSpecAPI;
013import com.fs.starfarer.api.loading.WeaponSpecAPI;
014
015
016public interface MissileAPI extends DamagingProjectileAPI {
017        boolean isFizzling();
018        void flameOut();
019        
020        ShipEngineControllerAPI getEngineController();
021        
022        
023        /**
024         * Only should be called if the AI needs to be changed dynamically. Otherwise,
025         * use ModPlugin.pickMissileAI() instead.
026         * @param ai
027         */
028        void setMissileAI(MissileAIPlugin ai);
029        
030        /**
031         * Does NOT return the same ai passed in to setShipAI(), but a wrapper around it.
032         * Can be used to save/restore the AI. 
033         * @return
034         */
035        MissileAIPlugin getMissileAI();
036        
037        
038        
039        /**
040         * Should only be used by a MissileAIPlugin.
041         * @param command type of the command. Only movement-related ShipCommands have any effect.
042         */
043        void giveCommand(ShipCommand command);
044        
045        boolean isFlare();
046        
047        SpriteAPI getSpriteAPI();
048        
049        float getAcceleration();
050        float getMaxSpeed();
051        float getMaxTurnRate();
052        float getTurnAcceleration();
053        
054        float getMaxFlightTime();
055        
056        
057        float getFlightTime();
058        void setFlightTime(float flightTime);
059        boolean isGuided();
060        boolean isArmed();
061        float getArmingTime();
062        void setArmingTime(float armingTime);
063        /**
064         * Setting to false has no effect on missiles whose dudProbabilityOnFlameout is false, as those are
065         * considered conceptually incapable of being duds/disarmed.
066         * @param armedWhileFizzling
067         */
068        void setArmedWhileFizzling(boolean armedWhileFizzling);
069        boolean isArmedWhileFizzling();
070        
071        /**
072         * Number of times a missile will ignore being hit by an system EMP *arc* (not emp damage) instead of flaming out.
073         * @param empResistance
074         */
075        void setEmpResistance(int empResistance);
076        int getEmpResistance();
077        void decrEMPResistance();
078        
079        /**
080         * Useful for missiles that change position using a script. Call twice - once before the missile
081         * is moved, and once when it has moved to its new location.
082         */
083        void interruptContrail();
084        void fadeOutThenIn(float inDur);
085        float getTimeSinceFizzling();
086        void setTimeSinceFizzling(float timeSinceFizzling);
087        
088        /**
089         * Just data flags, WILL NOT actually make the missile a mine/adjust mine properties/etc.
090         * @return
091         */
092        boolean isMine();
093        
094        /**
095         * Just data flags, WILL NOT actually make the missile a mine/adjust mine properties/etc.
096         * @return
097         */
098        void setMine(boolean isMine);
099        
100        /**
101         * Just data flags, WILL NOT actually make the missile a mine/adjust mine properties/etc.
102         * @return
103         */
104        void setMineExplosionRange(float mineExplosionRange);
105        
106        /**
107         * Just data flags, WILL NOT actually make the missile a mine/adjust mine properties/etc.
108         * @return
109         */
110        boolean isMinePrimed();
111        
112        /**
113         * Just data flags, WILL NOT actually make the missile a mine/adjust mine properties/etc.
114         * @return
115         */
116        float getMineExplosionRange();
117        
118        /**
119         * Just data flags, WILL NOT actually make the missile a mine/adjust mine properties/etc.
120         * @return
121         */
122        void setMinePrimed(boolean isMinePrimed);
123        
124        /**
125         * Just data flags, WILL NOT actually make the missile a mine/adjust mine properties/etc.
126         * @return
127         */
128        float getUntilMineExplosion();
129        
130        /**
131         * Just data flags, WILL NOT actually make the missile a mine/adjust mine properties/etc.
132         * @return
133         */
134        void setUntilMineExplosion(float untilMineExplosion);
135        void setJitter(Object source, Color color, float intensity, int copies, float range);
136        void setJitter(Object source, Color color, float intensity, int copies, float minRange, float range);
137        float getCurrentBaseAlpha();
138        float getGlowRadius();
139        void setGlowRadius(float glowRadius);
140        boolean isRenderGlowAbove();
141        void setRenderGlowAbove(boolean renderGlowAbove);
142        void setShineBrightness(float brightness);
143        
144        boolean isMirv();
145        float getMirvWarheadDamage();
146        float getMirvWarheadEMPDamage();
147        int getMirvNumWarheads();
148        DamageType getMirvWarheadDamageType();
149        JSONObject getBehaviorSpecParams();
150        boolean isDecoyFlare();
151        void resetEngineGlowBrightness();
152        float getECCMChance();
153        WeaponSpecAPI getWeaponSpec();
154        void setWeaponSpec(String weaponId);
155        
156        
157        /**
158         * Returns the AI that was passed in to setMissileAI(). getMissileAI() returns an internal wrapper around that.
159         * @return
160         */
161        MissileAIPlugin getUnwrappedMissileAI();
162        
163        
164        Object getParamAboutToApplyDamage();
165        void setParamAboutToApplyDamage(Object param);
166        MissileSpecAPI getSpec();
167        EnumSet<CombatEngineLayers> getActiveLayers();
168        
169        boolean isForceAlwaysArmed();
170        void setForceAlwaysArmed(boolean forceAlwaysArmed);
171        boolean didDamage();
172        boolean isNoMineFFConcerns();
173        void setNoMineFFConcerns(boolean noFFConcerns);
174        float getEccmChanceOverride();
175        void setEccmChanceOverride(float eccmChanceOverride);
176        float getEccmChanceBonus();
177        void setEccmChanceBonus(float eccmChanceBonus);
178        void setSource(ShipAPI source);
179        ShipAPI getSourceAPI();
180        boolean isNoFlameoutOnFizzling();
181        void setNoFlameoutOnFizzling(boolean noFlameoutOnFizzling);
182        DamagingProjectileAPI explode();
183        float getMaxRange();
184        void setMaxRange(float maxRange);
185        void setMaxFlightTime(float maxFlightTime);
186        float getSpriteAlphaOverride();
187        void setSpriteAlphaOverride(float spriteAlphaOverride);
188        
189        /**
190         * Location it spawned at, used to fizzle out if fizzling is range-based.
191         * @return
192         */
193        Vector2f getStart();
194        void setStart(Vector2f start);
195        MutableShipStatsAPI getEngineStats();
196        void setFizzleTime(float fizzleTime);
197        void setFadeTime(float fadeTime);
198        void setNoGlowTime(float noGlowTime);
199        Color getDestroyedExplosionColorOverride();
200        void setDestroyedExplosionColorOverride(Color destroyedExplosionColorOverride);
201        float getEtaModifier();
202        void setEtaModifier(float etaModifier);
203        float getGuidanceBonus();
204        boolean isDoNotFlareEnginesWhenStrafingOrDecelerating();
205        void setDoNotFlareEnginesWhenStrafingOrDecelerating(boolean doNotFlare);
206        void setDidDamage(boolean didDamage);
207        void updateMaxSpeed();
208        Set<String> getTags();
209        void addTag(String tag);
210        boolean hasTag(String tag);
211        void removeTag(String tag);
212        
213        // always null anyway
214        //MutableShipStatsAPI getStats();
215}
216