001package com.fs.starfarer.api.impl.campaign.enc; 002 003import com.fs.starfarer.api.impl.campaign.DebugFlags; 004import com.fs.starfarer.api.impl.campaign.terrain.HyperspaceAbyssPluginImpl; 005import com.fs.starfarer.api.impl.campaign.terrain.HyperspaceAbyssPluginImpl.AbyssalEPData; 006 007public class AbyssalFrequencies { 008 009 public static float NO_ABYSS_ENCOUNTER_MULT = 10f; 010 011 public static float DWELLER_FREQ_MIN = 3f; 012 public static float DWELLER_FREQ_MAX = 10f; 013 014 public static float LIGHT_FREQ = 10f; 015 public static float ROGUE_REGULAR_FREQ = 5f; 016 public static float ROGUE_HINTS_FREQ = 5f; 017 018 public static float getNoAbyssalEncounterFrequency(EncounterManager manager, EncounterPoint point) { 019 if (!HyperspaceAbyssPluginImpl.EP_TYPE_ABYSSAL.equals(point.type)) return 0f; 020 021 float total = 0f; 022 for (EPEncounterCreator c : EncounterManager.CREATORS) { 023 if (!(c instanceof AbyssalNoEPEC)) { 024 // non-abyssal creators should return 0 for abyssal points 025 float f = c.getFrequencyForPoint(manager, point); 026 total += f; 027 } 028 } 029 030 total *= NO_ABYSS_ENCOUNTER_MULT; 031 032 return Math.min(10000f, Math.max(100f, total)); 033 } 034 035 public static boolean isPointSuited(EncounterPoint point, boolean allowNearStar, float depthRequired) { 036 if (!HyperspaceAbyssPluginImpl.EP_TYPE_ABYSSAL.equals(point.type)) return false; 037 AbyssalEPData data = (AbyssalEPData) point.custom; 038 if (data.depth < depthRequired) return false; 039 if (!allowNearStar && data.nearest != null) return false; 040 return true; 041 } 042 043 public static float getAbyssalLightFrequency(EncounterManager manager, EncounterPoint point) { 044 if (!isPointSuited(point, false, HyperspaceAbyssPluginImpl.DEPTH_THRESHOLD_FOR_ABYSSAL_LIGHT)) { 045 return 0f; 046 } 047 return LIGHT_FREQ; 048 } 049 050 public static float getAbyssalLightDwellerFrequency(EncounterManager manager, EncounterPoint point) { 051 if (!isPointSuited(point, false, HyperspaceAbyssPluginImpl.DEPTH_THRESHOLD_FOR_DWELLER_LIGHT)) { 052 return 0f; 053 } 054 055 AbyssalEPData data = (AbyssalEPData) point.custom; 056 float f = DWELLER_FREQ_MIN; 057 f += (DWELLER_FREQ_MAX - DWELLER_FREQ_MIN) * 058 (data.depth - HyperspaceAbyssPluginImpl.DEPTH_THRESHOLD_FOR_DWELLER_LIGHT) * 0.33f; 059 if (f > DWELLER_FREQ_MAX) f = DWELLER_FREQ_MAX; 060 return f; 061 } 062 063 public static float getAbyssalRogueStellarObjectFrequency(EncounterManager manager, EncounterPoint point) { 064 if (!isPointSuited(point, false, HyperspaceAbyssPluginImpl.DEPTH_THRESHOLD_FOR_ABYSSAL_STELLAR_OBJECT)) { 065 return 0f; 066 } 067 return ROGUE_REGULAR_FREQ; 068 } 069 070 public static float getAbyssalRogueStellarObjectDireHintsFrequency(EncounterManager manager, EncounterPoint point) { 071 if (!isPointSuited(point, false, HyperspaceAbyssPluginImpl.DEPTH_THRESHOLD_FOR_ABYSSAL_STELLAR_OBJECT)) { 072 return 0f; 073 } 074 if (DebugFlags.ABYSSAL_GHOST_SHIPS_DEBUG) { 075 return 1000000000f; 076 } 077 return ROGUE_HINTS_FREQ; 078 } 079 080 081 082} 083 084 085 086 087