Fleet Movement - AkhRani/Bellow GitHub Wiki
Handling the arrival of fleets at their destinations: When a fleet arrives at its destination, it can trigger several events.
- The fleet may merge with other fleets arriving this turn or already in orbit at the destination.
- Combat may occur.
- The fleet owner's information about the planet will be updated.
- If the player has not explored this planet before, a notification will be queued.
- If this is the first player to explore a planet with artifacts, the player will be awarded a technology and a notification will be queued.
Trying to figure out which classes are responsible for which parts of this logic.
- StarSystems track "nearby" (orbiting and incoming) fleets.
- Arriving fleet queries system for nearby player fleet and calls owner.PendingMerge(id1, id2) or system.AddNearby(player, id1)
- After all fleets are moved, player merges fleets and updates fleet collection. Approaching fleets will merge into orbiting fleets, if possible.
- After all players have moved, game scans systems for conflict situations and resolves conflicts. Surviving fleets transition from "Approaching" to either "Retreating" or "Arriving" as a result of combat (or the lack thereof). Orbiting fleets may transition to "Retreating".
- Player scans fleets for "Arriving" status. Arriving fleets transition to orbiting and call owner.Explore(system).
Partial implementation as of 10-23-2015
- Game calls MoveFleets for each player, which calls Move for each owned fleet. Fleets that reach their destination are put into the "Arriving" state.
- Game calls HandleFleetArrival for each player, which calls Arrive for each owned fleet. Fleets in the "Arriving" state transition to orbiting and call Player::Explore.