144 Commits

Author SHA1 Message Date
Dan Albert
17c19d453b Factor out Coalition from Game. 2021-07-13 14:29:40 -07:00
Dan Albert
9de08dc83f Update to latest pydcs.
This includes the basics that we need to get type checking for pydcs
calls.

Type checking has been disabled in a few monkey-patching cases. Patches
ought to be sent upstream (or in the case of dead unit tracking,
replaced with a better model).
2021-07-11 13:37:17 -07:00
Dan Albert
53f6a0b32b Fix some typing in preparation for pydcs types.
Not complete, but progress.
2021-07-08 23:23:05 -07:00
Dan Albert
fb9a0fe833 Flesh out typing information, enforce. 2021-07-07 17:41:29 -07:00
Simon Clark
963ab38b2e Refactor the mod select changes, re-add accidentally deleted factions. 2021-06-21 01:16:48 +01:00
Dan Albert
09704b6f37 Add a wrapper type for ground unit info. 2021-06-17 22:09:17 -07:00
Dan Albert
7170a7b302 Fix spawning unused aircraft.
These are assigned a squadron even though they're unused as a hack. We
need to tolerate these aircraft having no pilot assigned since that's
the desired case for unused aircraft (though only happens when the
squadron runs out of pilots, which should be fixed).
2021-06-16 20:11:36 -07:00
Dan Albert
ef35ad90b8 Remove one user of UNIT_BY_TASK. 2021-06-07 18:01:31 -07:00
Dan Albert
96cdea2a94 Load two units per cargo plane.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1029
2021-06-05 12:21:34 -07:00
Dan Albert
558502d8ea Convert flight creator to pilot roster.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1143
2021-06-04 17:01:29 -07:00
Dan Albert
1521f0a9b1 Add on-leave toggle for pilots.
Pilots on leave will not be assignable to any flights (but will not be
unassigned from any already scheduled this turn).

https://github.com/dcs-liberation/dcs_liberation/issues/276
2021-05-27 17:09:09 -07:00
Dan Albert
28f20d47d3 Add player pilot invulnerability option.
https://github.com/dcs-liberation/dcs_liberation/issues/276
2021-05-27 01:40:23 -07:00
Dan Albert
8b8d1e87e7 Track missions flown for each pilot.
https://github.com/dcs-liberation/dcs_liberation/issues/276
2021-05-26 19:04:06 -07:00
Dan Albert
cd6de191d1 Track pilot deaths.
https://github.com/dcs-liberation/dcs_liberation/issues/276
2021-05-26 18:54:07 -07:00
Dan Albert
2b8dfc9dbc Stop counting neutral base captures in status.
These had no effect but were being counted on the waiting for mission
results page. Cleaned up the implementation a bunch while I was here.

Fixes https://github.com/Khopa/dcs_liberation/issues/1037
2021-04-26 17:54:32 -07:00
Dan Albert
7e40d58d04 Add cargo ships to the sim, track kills.
Not targetable yet.

https://github.com/Khopa/dcs_liberation/issues/826
2021-04-25 14:12:59 -07:00
Dan Albert
4069074f41 Move unit delivery out of an unrelated file.
Historically this inherited from Event but there was no reason for that.
That's gone now. Finish the separation and move the unit order tracking
class out of the combat results reaction class's file.
2021-04-22 22:15:45 -07:00
Dan Albert
29b70b3247 Track airlift cargo kills.
https://github.com/Khopa/dcs_liberation/issues/825
2021-04-22 19:22:41 -07:00
Dan Albert
6cffc47f3c Clean up convoy code. 2021-04-20 22:21:42 -07:00
Dan Albert
81d5cddac9 Remove weird single-CP supply route edge case.
A CP with a factory would be able to supply itself, but was not in a
supply route if it was the only connected friendly CP. When the player
starts with only one base against an enemy base this meant that it was
in no supply route, causing it to not be a recruitment location or a
place to buy more than a reserve of vehicles automatically.
2021-04-19 17:15:41 -07:00
Dan Albert
30bf4542f0 Special case turn 0 for recruitment.
We want there to be units on the front line on turn 1 regardless of
factory locations, so bypass the recruitment restrictions on turn 0.

https://github.com/Khopa/dcs_liberation/issues/986
2021-04-19 00:03:47 -07:00
Dan Albert
56fc2986e9 Automate transfers from factories.
The purchase system will seek out a source for its units when the
purchase is completed. If no source is available the order will be
refunded. Orders with no source available are prevented, so this only
happens when the source was cut off from the destination during the
turn.

There's still some funkiness going on with the first turn (but possibly
only when the first turn includes a cheat to capture) where the AI buys
a ton of units somewhere other than the front line. First turn behavior
should probably be different anyway, with the first turn allowing
purchases anywhere to avoid empty front lines while troops reinforce if
the front line isn't a factory.

https://github.com/Khopa/dcs_liberation/issues/986
2021-04-18 23:22:30 -07:00
Dan Albert
5e054cfc77 Disallow selling ground units.
Ground units should be transferred to a new location, not sold and
repurchased.

https://github.com/Khopa/dcs_liberation/issues/823
2021-04-18 16:32:02 -07:00
Dan Albert
65ed110ab7 Track convoy kills.
https://github.com/Khopa/dcs_liberation/issues/824
2021-04-18 16:22:51 -07:00
Dan Albert
a47bef1f13 Blacken. 2021-02-12 20:10:45 -08:00
Dan Albert
d8c94f5ece Transfer pending purchases forward along capture.
Fixes https://github.com/Khopa/dcs_liberation/issues/828.
2021-02-12 13:45:01 -08:00
Simon Clark
7c3f7d4b8e Addresses review comments. 2021-01-05 09:42:05 +00:00
SimonC6R
03a29aeedf Type annotations. 2021-01-05 00:31:54 +00:00
SimonC6R
ab2046a2c2 Refactor the sell unit changes as requested.
It works more simply now, and also doesn't immediately sell the unit.

Also adds a matching UI dialog popup for selling too many ground units.
2021-01-05 00:26:40 +00:00
Dan Albert
9671542bdf Decouple unit deliveries and conflict events.
Fixes https://github.com/Khopa/dcs_liberation/issues/692 and lets us
clean up the interface quite a bit.
2021-01-01 13:48:23 -08:00
Dan Albert
de325c1208 Refunding unfulfilled orders on capture.
Fixes https://github.com/Khopa/dcs_liberation/issues/682
2021-01-01 13:23:58 -08:00
Dan Albert
436725b38e Don't award base capture bonuses.
If anything we should be granting the loser extra income so they can
recover. For now just remove.
2020-12-27 19:52:42 -08:00
Dan Albert
d3b1f6110f Don't show repaired TGOs as dead.
We were never resetting the dead state for repaired SAMs. Rather than
tracking that manually, determine liveness from the number of units left
alive.

For building objectives where the group is not assigned to the TGO until
*mission* generation time we still need manual tracking.
2020-12-26 16:19:41 -08:00
Dan Albert
edfaaacd04 Determine player vs enemy early in debriefing.
This way the results of committing the debriefing can't alter the view
of the debriefing. It looks like it was probably that case that
debriefing information displays (but not the committed results) would be
incorrect after a base capture because the results might be shown after
the results were committed.

Maybe fixes https://github.com/Khopa/dcs_liberation/issues/513
2020-12-06 20:20:08 -08:00
Dan Albert
d519aa1dad Move the AI to the normal procurement system.
The procurement AI now uses the same system as the players. Orders are
placed and take a turn to fulfill.

This has a few advantages:

* We no longer need special case purchase logic for the turn 0
  population of opfor airbases.
* Players using auto-purchase can cancel orders they don't like.
2020-12-05 22:41:05 -08:00
Dan Albert
b8e64d4369 Revert "Revert "Migrate buildings and TGOs to unit map.""
With fixed tracking for TGO groups and fortification "buildings".

Fixes https://github.com/Khopa/dcs_liberation/issues/485

This reverts commit 72ac8ca8724573efa14e5d15880b697aaaa4eacd.
2020-12-05 14:26:16 -08:00
Dan Albert
72ac8ca872 Revert "Migrate buildings and TGOs to unit map."
Not registering kills correctly. It was in my limited testing, so need
to dig deeper.

https://github.com/Khopa/dcs_liberation/issues/494

This reverts commit 90697194a1a4ca67b53eb7b4056e4f7f5416ac58.
2020-12-04 23:57:58 -08:00
Dan Albert
90697194a1 Migrate buildings and TGOs to unit map.
Fixes https://github.com/Khopa/dcs_liberation/issues/485.
2020-12-04 01:10:18 -08:00
Dan Albert
4f37610dfb Convert front line units to UnitMap.
https://github.com/Khopa/dcs_liberation/issues/485
2020-12-01 01:25:51 -08:00
Dan Albert
80bc9d6b23 Support reparing damaged runways.
Repairing a damaged runway costs $100M and takes 4 turns (one day). The
AI will always repair runways if they can afford it. if a runway is
damaged again during the repair the process must begin again.

Runways are still operational despite what the UI says. Preventing the
player and AI from using damaged runways (except for with helicopters
and harriers) is next.
2020-11-25 18:07:51 -08:00
Dan Albert
0c4e920af3 Handle runway damage in the debrief.
Apparently we were already getting this info because it's a unit like
any other according to the event system, so if runways were actually
sufficiently damaged we'd emit a ton of exceptions.

This doesn't do anything yet, but tracks the damage state. Will add the
ability to repair them next, and then finally make the damage render the
runway inoperable.
2020-11-25 13:12:46 -08:00
walterroach
34a7a37409 Operation refactor cleanup
Fix bug in closest cp algorithm
2020-11-23 22:27:12 -06:00
walterroach
967574820f Remove unused conflictgen globals
Remove unused  `Conflict` properties

mypy fixes

Cleanup
2020-11-23 18:14:25 -06:00
walterroach
da17d1e5d1 Change Operation to a static class
Removed always True "event successful"

Add `AirWarEvent` as the primary game `Event` applied to every miz

Cleanup of `FrontLineAttackEvent`

Change `Operation.is_awacs_enabled` to two bools for each side red/blue
Currently controlled by whether an AWACs is available for the faction
(and only ever true for Blue)
2020-11-23 18:14:25 -06:00
Dan Albert
493e53c28f Perform aircraft transfers at the end of the turn. 2020-11-22 18:44:16 -08:00
Dan Albert
f6fad30852 Add unit name -> Liberation object map.
Generated units are added to this during mission generation so we can
map destroyed units back to the data that generated them. Currently only
implemented for aircraft as a proof of concept.
2020-11-21 21:01:46 -08:00
walterroach
f6e0dbbb6a operation refactoring 2020-11-21 17:00:22 -06:00
walterroach
316f73138c Merge branch 'develop' into frontline 2020-11-21 11:19:31 -06:00
Dan Albert
0d95716545 Correct type annotations. 2020-11-20 21:40:31 -08:00
walterroach
edd02d9dd6 Merge branch 'develop' into frontline 2020-11-20 20:32:50 -06:00