001package com.fs.starfarer.api.campaign;
002
003import java.util.List;
004
005import org.lwjgl.util.vector.Vector2f;
006
007import com.fs.starfarer.api.Script;
008import com.fs.starfarer.api.campaign.CampaignEventListener.FleetDespawnReason;
009import com.fs.starfarer.api.campaign.ai.CampaignFleetAIAPI;
010import com.fs.starfarer.api.campaign.listeners.FleetEventListener;
011import com.fs.starfarer.api.characters.MutableCharacterStatsAPI;
012import com.fs.starfarer.api.characters.PersonAPI;
013import com.fs.starfarer.api.fleet.FleetLogisticsAPI;
014import com.fs.starfarer.api.fleet.FleetMemberAPI;
015import com.fs.starfarer.api.fleet.FleetMemberViewAPI;
016import com.fs.starfarer.api.fleet.MutableFleetStatsAPI;
017
018/**
019 * @author Alex Mosolov
020 *
021 * Copyright 2012 Fractal Softworks, LLC
022 */
023public interface CampaignFleetAPI extends SectorEntityToken, FleetOrStubAPI {
024
025        /**
026         * @return whether the fleet's LocationAPI is the same one the player's fleet is currently in.
027         */
028        boolean isInCurrentLocation();
029        boolean isInHyperspace();
030        
031        /**
032         * Use this to set the location. DO NOT use getLocation().x = <new x> etc, that won't work.
033         * @param x
034         * @param y
035         */
036        void setLocation(float x, float y);
037        
038        //boolean isAlive();
039        
040        void despawn();
041        void despawn(FleetDespawnReason reason, Object param);
042        
043        void addAssignment(FleetAssignment assignment, SectorEntityToken target, float maxDurationInDays);
044        void addAssignment(FleetAssignment assignment, SectorEntityToken target, float maxDurationInDays, Script onCompletion);
045        void addAssignment(FleetAssignment assignment, SectorEntityToken target, float maxDurationInDays, String actionText);
046        void addAssignment(FleetAssignment assignment, SectorEntityToken target, float maxDurationInDays, String actionText, Script onCompletion);
047        void clearAssignments();
048        void setPreferredResupplyLocation(SectorEntityToken token);
049        
050        
051        //FactionAPI getFaction();
052        Vector2f getVelocity();
053        
054        /* (non-Javadoc)
055         * Do not use to set the location, it won't work.
056         * 
057         * Use setLocation instead.
058         * @see com.fs.starfarer.api.campaign.SectorEntityToken#getLocation()
059         */
060        Vector2f getLocation();
061        
062        FleetLogisticsAPI getLogistics();
063        
064        LocationAPI getContainingLocation();
065        
066        PersonAPI getCommander();
067        MutableCharacterStatsAPI getCommanderStats();
068        FleetMemberAPI getFlagship();
069        boolean isPlayerFleet();
070        
071        FleetDataAPI getFleetData();
072//      List<FleetMemberAPI> getMembersListCopy();
073//      List<FleetMemberAPI> getCombatReadyMembersListCopy();
074//      int getFleetPoints();
075//      void addFleetMember(FleetMemberAPI member);
076//      void removeFleetMember(FleetMemberAPI member);
077        
078        void removeFleetMemberWithDestructionFlash(FleetMemberAPI member);
079        
080        void setName(String name);
081        float getTotalSupplyCostPerDay();
082        int getNumCapitals();
083        int getNumCruisers();
084        int getNumDestroyers();
085        int getNumFrigates();
086        int getNumFighters();
087        /**
088         * Updates numCapitals/numCruisers/etc
089         */
090        void updateCounts();
091        
092        float getTravelSpeed();
093        
094        CampaignFleetAIAPI getAI();
095
096        int getFleetPoints();
097
098        String getNameWithFaction();
099        String getName();
100        
101        
102        /**
103         * @return true if the fleet is not empty and doesn't consist entirely of fighter wings.
104         */
105        boolean isValidPlayerFleet();
106
107        void setNoEngaging(float seconds);
108
109        MutableFleetStatsAPI getStats();
110
111        
112        /**
113         * Used by the AI to control the fleet as well, so it's not a reliable way to
114         * order a fleet around as the AI will be calling this method every frame.
115         * @param x
116         * @param y
117         */
118        void setMoveDestination(float x, float y);
119        
120        /**
121         * Overrides AI and player input.
122         * @param x
123         * @param y
124         */
125        void setMoveDestinationOverride(float x, float y);
126        
127        /**
128         * The fleet is trying to interact with this entity - i.e. engage an enemy fleet, use a wormhole, etc.
129         * @return
130         */
131        SectorEntityToken getInteractionTarget();
132        
133        void setInteractionTarget(SectorEntityToken target);
134        
135        boolean isInHyperspaceTransition();
136        
137        
138        /**
139         * Turns off supplies/fuel use, accidents, and ship crew requirements. Locks the LR to 100%.
140         * @param aiMode
141         */
142        void setAIMode(boolean aiMode);
143        boolean isAIMode();
144        
145        
146        /**
147         * fighter, frigate: 1
148         * destroyer: 2
149         * cruiser: 3
150         * capital: 5
151         * @return
152         */
153        int getFleetSizeCount();
154        
155        
156        void setNoFactionInName(boolean noFactionInName);
157        boolean isNoFactionInName();
158        void setCommander(PersonAPI commander);
159        
160        
161        /**
162         * Makes sure the fleet's capacities, crew levels, etc match the fleet composition and cargo.
163         * Also reapplies any fleet buffs, effects of hullmods, skills, etc. 
164         */
165        void forceSync();
166        
167        /**
168         * True if the player's transponder is on, or it has seen the player with the transponder on and
169         * hasn't lost track of them since that point.
170         * @return
171         */
172        boolean knowsWhoPlayerIs();
173        
174        
175        /**
176         * Eventually falls back to faction.isHostile(), but may return true if there's hostility
177         * due to MakeOtherFleetHostile true, a captain's relationship to the player/other captain, etc.
178         * @param other
179         * @return
180         */
181        boolean isHostileTo(SectorEntityToken other);
182        
183        
184        
185        /**
186         * Returns the "view" of the fleet member in the campaign - i.e. the little ships flying around.
187         * Not every fleet member necessarily has a view.
188         * Fleets don't have any member views when they're not currently visible to the player.
189         * @return
190         */
191        List<FleetMemberViewAPI> getViews();
192        
193        /**
194         * Returns the "view" of the fleet member in the campaign - i.e. the little ships flying around.
195         * Not every fleet member necessarily has a view.
196         * Fleets don't have any member views when they're not currently visible to the player.
197         * @return
198         */
199        FleetMemberViewAPI getViewForMember(FleetMemberAPI member);
200        
201        
202        /**
203         * Current burn level - not maximum, but how fast it's currently going.
204         * @return
205         */
206        float getCurrBurnLevel();
207        
208        /**
209         * In pixels per second, not per day.
210         */
211        void setVelocity(float x, float y);
212        
213        
214        /**
215         * In pixels per second, not per day.
216         * @return
217         */
218        float getAcceleration();
219        void setFaction(String factionId, boolean includeCaptains);
220        BattleAPI getBattle();
221        void setBattle(BattleAPI battle);
222        
223        void setAI(CampaignFleetAIAPI campaignFleetAI);
224        String getNameWithFactionKeepCase();
225        boolean isFriendlyTo(SectorEntityToken other);
226        float getBaseSensorRangeToDetect(float sensorProfile);
227        
228        Boolean isDoNotAdvanceAI();
229        void setDoNotAdvanceAI(Boolean doNotAdvanceAI);
230        List<FleetMemberAPI> getMembersWithFightersCopy();
231        
232//      FleetStubAPI getStub();
233//      void setStub(FleetStubAPI stub);
234//      
235//      boolean isConvertToStub();
236//      void setConvertToStub(boolean convertToStub);
237        
238        void setNullAIActionText(String nullAIActionText);
239        String getNullAIActionText();
240        
241        void setStationMode(Boolean stationMode);
242        boolean isStationMode();
243        Boolean wasMousedOverByPlayer();
244        void setWasMousedOverByPlayer(Boolean wasMousedOverByPlayer);
245        boolean isDespawning();
246        Vector2f getMoveDestination();
247        List<FleetEventListener> getEventListeners();
248        
249        FleetInflater getInflater();
250        void setInflater(FleetInflater inflater);
251        void inflateIfNeeded();
252        void deflate();
253        boolean isEmpty();
254        Boolean getForceNoSensorProfileUpdate();
255        void setForceNoSensorProfileUpdate(Boolean forceNoSensorProfileUpdate);
256        
257        boolean isInflated();
258        void setInflated(Boolean inflated);
259        Boolean isNoAutoDespawn();
260        void setNoAutoDespawn(Boolean noAutoDespawn);
261        void addAssignment(FleetAssignment assignment, SectorEntityToken target,
262                        float maxDurationInDays, String actionText, boolean addTimeToNext,
263                        Script onStart, Script onCompletion);
264        
265        boolean isHidden();
266        void setHidden(Boolean hidden);
267        Boolean getAbortDespawn();
268        void setAbortDespawn(Boolean abortDespawn);
269        
270        
271        /**
272         * Sum of Misc.getMemberStrength(member, true, true, true) for all members. Cached and
273         * updated as needed.
274         * @return
275         */
276        float getEffectiveStrength();
277        int getNumMembersFast();
278        
279        void goSlowOneFrame(boolean stop);
280        boolean wasSlowMoving();
281        int getNumShips();
282        void updateFleetView();
283        
284        /**
285         * Only works for the player fleet.
286         * @return
287         */
288        boolean hasShipsWithUniqueSig();
289        boolean getGoSlowStop();
290        void goSlowOneFrame();
291        boolean getGoSlowOneFrame();
292        Vector2f getVelocityFromMovementModule();
293        void fadeOutIndicator();
294        void fadeInIndicator();
295        void forceOutIndicator();
296}
297
298
299
300
301
302