001package com.fs.starfarer.api.combat;
002
003import java.util.List;
004
005import org.lwjgl.util.vector.Vector2f;
006
007import com.fs.starfarer.api.loading.DamagingExplosionSpec;
008import com.fs.starfarer.api.loading.ProjectileSpawnType;
009import com.fs.starfarer.api.loading.ProjectileSpecAPI;
010
011public interface DamagingProjectileAPI extends CombatEntityAPI {
012        
013        DamageType getDamageType();
014        float getDamageAmount();
015        
016        /**
017         * Does not include damage reduction from projectile fading out or having done damage
018         * @return
019         */
020        float getBaseDamageAmount();
021        float getEmpAmount();
022        
023        
024        void setDamageAmount(float damage);
025        
026        
027        /**
028         * @return Weapon that fired this projectile. Can be null (for example, if spawned without one via the API).
029         */
030        WeaponAPI getWeapon();
031
032        /**
033         * Whether the projectile already did its damage and is now fading out.
034         * @return
035         */
036        boolean didDamage();
037        
038        /**
039         * @return What the damage was dealt to, once didDamage() returns true. Can be null.
040         */
041        CombatEntityAPI getDamageTarget();
042        
043        String getProjectileSpecId();
044        
045        
046        /**
047         * Generally a ShipAPI for the ship that ultimately fired this weapon. Can be null.
048         * 
049         * Projectiles can't hit their source, except for fizzled-out missiles.
050         * 
051         * @return
052         */
053        ShipAPI getSource();
054        void setSource(ShipAPI source);
055        
056        /**
057         * @return whether the projectile has started fading out due to exceeding its maximum range.
058         */
059        boolean isFading();
060        
061        ProjectileSpawnType getSpawnType();
062        
063        
064        /**
065         * Time the projectile has been alive.
066         * @return
067         */
068        float getElapsed();
069        
070        
071        DamageAPI getDamage();
072        
073        boolean isFromMissile();
074        
075        /**
076         * Should be set to true for BALLISTIC, BALLISTIC_AS_BEAM, and PLASMA_SHOT projectiles 
077         * spawned from a missile.
078         * Needed for incoming damage evaluation AI to function properly in these cases.
079         * @param fromMissile
080         */
081        void setFromMissile(boolean fromMissile);
082        
083        
084        /**
085         * Only supported by damaging explosions, not @Override
086        other types of projectiles.
087         * @param c
088         */
089        void removeDamagedAlready(CombatEntityAPI c);
090        
091        /**
092         * Only supported by damaging explosions, not other types of projectiles.
093         * @param c
094         */
095        void addDamagedAlready(CombatEntityAPI c);
096
097        /**
098         * Projectile movement is entirely defined by moveSpeed and facing. The actual velocity is ignored by the engine.
099         * @return
100         */
101        float getMoveSpeed();
102        Vector2f getSpawnLocation();
103        ProjectileSpecAPI getProjectileSpec();
104        float getBrightness();
105        
106        /**
107         * Only non-null for "moving ray" and "ballistic projectile" type projectiles, not missiles/plasma shots/etc.
108         * @return
109         */
110        Vector2f getTailEnd();
111        List<CombatEntityAPI> getDamagedAlready();
112
113        default DamagingExplosionSpec getExplosionSpecIfExplosion() { return null; }
114}
115
116