001package com.fs.starfarer.api.mission;
002
003import java.awt.Color;
004
005import com.fs.starfarer.api.campaign.PlanetAPI;
006import com.fs.starfarer.api.characters.PersonAPI;
007import com.fs.starfarer.api.combat.BattleCreationContext;
008import com.fs.starfarer.api.combat.BattleObjectiveAPI;
009import com.fs.starfarer.api.combat.EveryFrameCombatPlugin;
010import com.fs.starfarer.api.fleet.FleetGoal;
011import com.fs.starfarer.api.fleet.FleetMemberAPI;
012import com.fs.starfarer.api.fleet.FleetMemberType;
013
014/**
015 * Used by the MissionDefinition.java script to create the contents of a mission.
016 * 
017 * @author Alex Mosolov
018 *
019 * Copyright 2012 Fractal Softworks, LLC
020 */
021public interface MissionDefinitionAPI {
022
023        /**
024         * Set various parameters for a fleet. Must be called once each for FleetSide.PLAYER and FleetSide.ENEMY.
025         * Must be called before any ships are added to the fleet.
026         * @param side
027         * @param shipNamePrefix Prepended to any randomly picked ship names. "ISS", "HSS", etc.
028         * @param goal
029         * @param useDefaultAI For now, set true for side = ENEMY and false for side = PLAYER. Later, may supply custom AI.
030         */
031        public void initFleet(FleetSide side, String shipNamePrefix, FleetGoal goal, boolean useDefaultAI);
032        
033        /**
034         * Set various parameters for a fleet. Must be called once each for FleetSide.PLAYER and FleetSide.ENEMY.
035         * Must be called before any ships are added to the fleet.
036         * @param side
037         * @param shipNamePrefix Prepended to any randomly picked ship names. "ISS", "HSS", etc.
038         * @param goal
039         * @param useDefaultAI For now, set true for side = ENEMY and false for side = PLAYER. Later, may supply custom AI.
040         * @param commandRating Added to the pool of available command points.
041         */
042        public void initFleet(FleetSide side, String shipNamePrefix, FleetGoal goal, boolean useDefaultAI, int commandRating);
043        
044        
045        /**
046         * Add a ship variant to a fleet. The variant ID refers to one of the variants found in data/variants
047         * and data/variants/fighters.
048         * @param side
049         * @param variantId
050         * @param type
051         * @param isFlagship Set to true for the player's ship, false otherwise.
052         */
053        public FleetMemberAPI addToFleet(FleetSide side, String variantId, FleetMemberType type, boolean isFlagship);
054        
055        
056        /**
057         * Same as the other addToFleet method, except you can specify the ship's name.
058         * @param side
059         * @param variantId
060         * @param type
061         * @param shipName Full ship name, including prefix.
062         * @param isFlagship Set to true for the player's ship, false otherwise.
063         */
064        public FleetMemberAPI addToFleet(FleetSide side, String variantId, FleetMemberType type, String shipName, boolean isFlagship);
065        
066        
067        /**
068         * Indicates that losing the named ship causes immediate defeat for that side. Ship must have been added
069         * with an explicit name.
070         * @param shipName
071         */
072        public void defeatOnShipLoss(String shipName);
073        
074        /**
075         * Adds a line to the bulleted list under "Tactical Objectives" in the mission description.
076         * @param item Text, with no leading dash.
077         */
078        public void addBriefingItem(String item);
079        
080        /**
081         * Set a small blurb for the fleet that shows up on the mission detail and
082         * mission results screens to identify it. 
083         * @param side
084         * @param tagline
085         */
086        public void setFleetTagline(FleetSide side, String tagline);
087        
088        /**
089         * Initialize map with the given size. By convention, 0,0 should be at the center.
090         * In other words, -minX = maxX and -minY = maxY.
091         * @param minX in pixels.
092         * @param maxX in pixels.
093         * @param minY in pixels.
094         * @param maxY in pixels.
095         */
096        public void initMap(float minX, float maxX, float minY, float maxY);
097        
098        /**
099         * Adds a circular nebula to the map. The shape is slightly randomized.
100         * @param x
101         * @param y
102         * @param radius in pixels.
103         */
104        public void addNebula(float x, float y, float radius);
105        
106        /**
107         * Add a battlefield objective to the map.
108         * 
109         * @param x
110         * @param y
111         * @param type one of "comm_relay", "nav_buoy", or "sensor_array".
112         * @param importance
113         */
114        @Deprecated
115        public void addObjective(float x, float y, String type, BattleObjectiveAPI.Importance importance);
116        
117        /**
118         * Add a battlefield objective to the map.
119         * 
120         * @param x
121         * @param y
122         * @param type one of "comm_relay", "nav_buoy", or "sensor_array".
123         */
124        public void addObjective(float x, float y, String type);
125        
126        /**
127         * Add a planet or star to the map. 
128         * 
129         * @param x
130         * @param y
131         * @param radius
132         * @param type available types are defined in data/config/planets.json
133         * @param gravity Equal to maximum speed boost the planet provides to nearby ships.
134         */
135        public void addPlanet(float x, float y, float radius, String type, float gravity);
136        
137        
138        /**
139         * Add a planet or star to the map. 
140         * 
141         * @param x
142         * @param y
143         * @param radius
144         * @param type available types are defined in data/config/planets.json
145         * @param gravity Equal to maximum speed boost the planet provides to nearby ships.
146         * @param backgroundPlanet If true, planet is in the "background" and doesn't exert gravity or move relative to the viewport. x and y are then screen coordinates.
147         */
148        void addPlanet(float x, float y, float radius, String type, float gravity, boolean backgroundPlanet);
149        
150        
151        /**
152         * Bases the look of the planet on the PlanetAPI passed in. The look may have been altered dynamically
153         * using PlanetAPI.getSpec(), which would not be reflected by the planet's base type, as defined in planets.json.
154         * @param x
155         * @param y
156         * @param radius
157         * @param planet
158         * @param gravity
159         * @param backgroundPlanet
160         */
161        void addPlanet(float x, float y, float radius, PlanetAPI planet, float gravity, boolean backgroundPlanet);
162        
163        /**
164         * Background planets at 0,0 get rendered at the center of the screen when the view is at the center of the map.
165         * 
166         * The bgWidth and bgHeight determine how much off-center the planet moves at the edges of the map.
167         * @param bgWidth
168         * @param bgHeight
169         */
170        void setPlanetBgSize(float bgWidth, float bgHeight);
171        
172        /**
173         * Add an asteroid field to the map. An asteroid field is a band of asteroids moving in a direction
174         * across the map.
175         * @param x x coordinate of any point along the middle of the belt.
176         * @param y y coordinate of any point along the middle of the belt.
177         * @param angle direction, with 0 being to the right and 90 being up.
178         * @param width width of belt in pixels.
179         * @param minSpeed minimum speed of spawned asteroids.
180         * @param maxSpeed maximum speed of spawned asteroids.
181         * @param quantity approximate number of asteroids to keep in play as they're destroyed/move off map.
182         */
183        public void addAsteroidField(float x, float y, float angle, float width,
184                                                                 float minSpeed, float maxSpeed, int quantity);
185        
186        
187        public void addRingAsteroids(float x, float y, float angle, float width,
188                                        float minSpeed, float maxSpeed, int quantity);
189
190        
191        /**
192         * Returns the fleet point cost of a fighter wing or ship variant.
193         * @param id
194         * @return
195         */
196        public int getFleetPointCost(String id);
197
198        
199        public void addPlugin(EveryFrameCombatPlugin plugin);
200        public void setBackgroundSpriteName(String background);
201        public void addFleetMember(FleetSide side, FleetMemberAPI member);
202        
203        
204        /**
205         * Make the background animate the same way it does in hyperspace.
206         * @param hyperspaceMode
207         */
208        void setHyperspaceMode(boolean hyperspaceMode);
209
210        void setNebulaTex(String nebulaTex);
211        void setNebulaMapTex(String nebulaMapTex);
212
213        void setBackgroundGlowColor(Color backgroundGlowColor);
214
215        void initFleet(FleetSide side, String shipNamePrefix, FleetGoal goal,
216                        boolean useDefaultAI, int commandRating, int allyCommandRating);
217
218        BattleCreationContext getContext();
219
220        PersonAPI getDefaultCommander(FleetSide side);
221
222        boolean hasNebula();
223}
224
225
226
227
228