001package com.fs.starfarer.api.combat;
002
003import org.lwjgl.util.vector.Vector2f;
004
005
006public interface ArmorGridAPI {
007        /**
008         * @return Armor value that the player sees in the game, on tooltips and such.
009         */
010        float getArmorRating();
011        
012        /**
013         * @return Actual per-cell maximum armor value. ~1/15th of the listed armor rating, due to how damage is distributed between cells.
014         */
015        float getMaxArmorInCell();
016        
017        /**
018         * 0,0 is lower left corner of the sprite.
019         * @return Armor value normalized to (0, 1).
020         */
021        float getArmorFraction(int cellX, int cellY);
022        
023        /**
024         * 0,0 is lower left corner of the sprite.
025         * @return Actual non-normalized armor value in cell.
026         */
027        float getArmorValue(int cellX, int cellY);
028        
029        /**
030         * @param cellX
031         * @param cellY
032         * @param value actual value, NOT fraction.
033         */
034        void setArmorValue(int cellX, int cellY, float value);
035        float[][] getGrid();
036        
037        /**
038         * Armor cell size, in pixels.
039         */
040        float getCellSize();
041        
042        
043        /**
044         * Number of cells above the center of the ship.
045         * 
046         * Use together with getCellSize() and ShipAPI.getLocation() to determine the cell at a given location.
047         * @return
048         */
049        int getAbove();
050        
051        /**
052         * Number of cells below the center of the ship.
053         * 
054         * Use together with getCellSize() and ShipAPI.getLocation() to determine the cell at a given location.
055         * @return
056         */
057        int getBelow();
058        
059        /**
060         * Number of cells right of the center of the ship.
061         * 
062         * Use together with getCellSize() and ShipAPI.getLocation() to determine the cell at a given location.
063         * @return
064         */
065        int getRightOf();
066        
067        /**
068         * Number of cells left of the center of the ship.
069         * 
070         * Use together with getCellSize() and ShipAPI.getLocation() to determine the cell at a given location.
071         * @return
072         */
073        int getLeftOf();
074        
075        /**
076         * @param loc absolute location in engine coordinates.
077         * @return null if loc is off the grid, array with {int cellX, int cellY} otherwise.
078         */
079        int [] getCellAtLocation(Vector2f loc);
080
081        Vector2f getLocation(int cellX, int cellY);
082
083        
084        /**
085         * Call this to prevent all weapons/engines on the ship from taking damage, ever.
086         */
087        void clearComponentMap();
088        void buildComponentMap();
089}
090
091
092
093
094
095
096