Open unsupo opened 6 years ago
Fleet saving is very important. Still to do with this is testing and working on the mission sendfleet to incorporate different speeds and adding resources to fleet.
Algorithm: Get fleet movements, filter by fleets who's owner isn't you and who's mission is attacking, also filter by fleets which have more than just probes and/or colony ships in them. Then sort by date which they arrive on your planet. Then go to the planet which is being attacked and then go to the fleet page. If the enemy fleet lands within 10 minutes, then: if you have ships, then: if you have a moon, then set the coordinates to your moon and mission to deployment else if you have colonies then send it to a colonies moon, if you have no colony moons then send it to a colony and set mission to deployment. else get a target based off a last successful attack or an inactive target then send the fleet with all your resources and all your ships at speed 1.
if you have no ships then spend all your resources
i'd imagine you'd first try to send everything away, then spend remaining resources check how long until the attacking fleet will land on your planet. if attacking fleet is less than say... 5 minutes away then go to Fleet Page send all ships and resources at 10% speed to: if you have a moon, send it to your moon, if you have another colony send it to your colony, otherwise get an inactive planet and send it to that planet save that fleet to be recalled later. if remaining resources greater than a certain amount say... 10k metal then spend it all until fleet arrives. Metal on rocket launchers, crystal on espionage probes, just spend it all
prevent this algorithm from running if only probe tries to attack. // If your espionage is high enough to see attacking fleet then check that, // otherwise ignore if less than a minute is left before attacking fleet arrives.