Commit Graph

154 Commits

Author SHA1 Message Date
Andre Mohren
81e1b39bb9 Made PowerManager optional for traits who do not require it. 2018-07-26 14:02:42 +01:00
Paul Chote
cce9b06a40 Move SupportPowerDecisions to a single parent node.
This is required before we can force all trait
properties to match a TraitInfo-defined field.
2018-06-15 17:24:00 +02:00
reaperrr
e2979658a2 Extract AI support power handling to AISupportPowerManager 2018-05-21 16:41:53 +02:00
reaperrr
5364515004 Don't pass movement class via IsPassable directly
Let IsPassable get that info from the locomotor instead.
2018-05-03 10:49:21 +02:00
reaperrr
81343926b6 Split Locomotor trait from Mobile
Add GrantConditionOn*Layer traits

This allows to
- drop some booleans from Locomotor
- drop a good part of the subterranean- and jumpjet-specific code/hacks from Mobile
- grant more than 1 condition per layer type (via multiple traits)
- easily add more traits of this kind for other layers
2018-05-03 10:49:21 +02:00
reaperrr
7ca9aa5e0b Make INotifyDamage require explicit implementation 2018-04-29 11:59:49 +01:00
Paul Chote
da29250711 Move PlayerResources to Mods.Common. 2018-04-28 20:42:10 +02:00
reaperrr
4f651c2f88 Remove HarvesterInfo look-up from HackyAI 2018-04-06 20:16:36 +02:00
reaperrr
5276636598 Extract a HarvesterManager from HackyAI
This takes action when AI harvesters don't find ore near the base or became idle for some other reason.
2018-04-06 20:16:36 +02:00
reaperrr
82867b6c3a Move some stuff from HackyAI to new AIUtils 2018-04-06 20:16:36 +02:00
Michael Silber
6b24271a17 Pass ActorInfo through building-placement-validation code. 2018-03-21 12:53:50 +01:00
RoosterDragon
5bd5a384b7 Use a BitSet for representing target types.
- Rename Bits<T> to BitSet<T>.
- Implement set based helpers for BitSet<T>.
- When representing TargetTypes of ITargetable in various traits, use a BitSet<TargetableType> instead of HashSet<string> for better performance & reduced memory usage.
- Fix FieldLoader to trim input values when generating a BitSet<T>.
- Require T in BitSet<T> and BitSetAllocator<T> to be a class since it's just a marker value. This allows the JIT to instantiate generic code for these classes once, as they don't benefit from specialized code for T. (Typically JITs will generate shared code for all reference types, and unique code for every value type encountered).
2018-03-21 12:07:44 +01:00
reaperrr
c5f9d6ff2d Add more configurability to AI MinimumExcessPower logic
Allows to scale the targeted minimum excess with building count as well as define a maximum cap to avoid overproducing powerplants.
2018-02-27 19:47:00 +01:00
Guido L
21472f2cc6 HackyAI: Refactor and remove duplicated logic. 2018-02-21 21:34:00 +01:00
Arular101
8a60918841 Update copyright notice year to 2018 2018-01-17 00:47:34 +01:00
Arular101
24b7f7a23f Cast to long to avoid overflow when multiplying by the health (part 2) 2018-01-13 17:32:34 +01:00
Arular101
30acee38c9 Cast to long to avoid overflow when multiplying by the health 2018-01-13 17:32:34 +01:00
GSonderling
69e6e033a6 AI will now defend MCV as if it was a harvester or a building.
Adjusted comments.
2018-01-04 22:11:43 +01:00
Mustafa Alperen Seki
841c873276 Fix Crash when Mcv: UnitsCommonName is empty. 2017-12-28 11:36:44 +00:00
reaperrr
3d4095cffd Make sure AttackOrFlee returns Attack when it makes sense
Not listing enemy "NearDead" and own relative atk power "Strong" here looked wrong, and might've resulted in no decision being made.
2017-12-28 11:00:18 +00:00
reaperrr
104148378f Remove some redundancy in AttackOrFleeFuzzy 2017-12-28 11:00:18 +00:00
reaperrr
6b567722b8 Factor number of bursts plus ReloadDelay into AttackOrFleeFuzzy.RelativePower 2017-12-28 11:00:18 +00:00
reaperrr
a4595af1e3 Make AttackOrFleeFuzzy consider all DamageWarheads instead of only the first 2017-12-28 11:00:18 +00:00
reaperrr
382c0b5f1d Make AI StateBase.CanAttackTarget only return true on valid armaments that are also enabled 2017-12-28 10:40:31 +00:00
reaperrr
e6835cef6e Replace some .Any checks with explicit .Count checks in AI 2017-12-28 10:40:31 +00:00
reaperrr
3fe808e0fb Make Ground and Navy AI squads look for enabled (instead of any) targetables 2017-12-28 10:40:31 +00:00
reaperrr
6de90b02d0 Unhardcode various AI squad radii 2017-12-28 10:40:31 +00:00
Paul Chote
2ad42b6a7e Account for visibility when selecting AI superweapon targets. 2017-12-22 02:33:25 +01:00
reaperrr
85c54e04d9 Replace LINQ in AirStates.CountAntiAirUnits 2017-12-17 21:18:44 +00:00
reaperrr
3aa8b3ae29 Remove unit.IsDisabled check from AirStates 2017-12-17 21:18:44 +00:00
reaperrr
85c5259361 Fix AI crashing when trying to make parachuted harvester search map for resources while mid-air 2017-12-11 01:55:18 +01:00
reaperrr
b5ffe17d60 Make AI skip harvester orders if map has no resources 2017-12-11 01:55:18 +01:00
reaperrr
9ad0d78cdd Make the AI only consider harvesters 'idle' if last resource search failed
Otherwise the AI would consider the harvester 'idle' in too many situations.
This way, the AI now only uses its own resource search algorithm if the next resource patch is too far away for the FindResources activity to find it.
2017-12-11 01:55:18 +01:00
reaperrr
4d553900cf Move up harv.IsEmpty check in HackyAI
This is a fairly cheap check, so we should perform it before the activity checks
2017-12-11 01:55:18 +01:00
Forcecore
c762453607 (External)Capturable are now conditional 2017-11-15 13:54:15 +02:00
reaperrr
d602ec6485 Rename SelfReloads to AutoReloads 2017-11-12 19:48:06 +00:00
reaperrr
6f95080aa4 Add ReloadAmmoPool and adapt AmmoPool
Refactored and simplified Rearm activity.
Uses local Reload now.

Removed AmmoPool.SelfReloads.
2017-11-12 19:48:06 +00:00
Paul Chote
1376ad674e Remove Player.CanViewActor and .CanTargetActor. 2017-11-03 09:56:00 +01:00
Paul Chote
d967c564a2 Remove TargetActor and TargetLocation from order issuing. 2017-10-15 19:07:46 +02:00
reaperrr
28e1f391e0 Make ITick require explicit implementation 2017-09-16 15:51:37 +02:00
abcdefg30
d99a472456 Fix HackyAI trying to deploy undeployable actors 2017-09-16 11:01:53 +01:00
reaperrr
08aaa998aa Fix AI BuildingLimits
The AI BaseBuilder would allow building a structure not only when the current number was lower, but also of it was equal to the limit, which allowed the AI to build one too much of every building.
2017-09-15 19:31:57 +01:00
Forcecore
8027bed6b2 Separated ship squad from ground unit squad
Just like aircrafts are independent from ground squads.
2017-09-13 23:31:26 +02:00
Forcecore
739d0c0bb2 Disabled Ground squads finding targets individually
* Now they will tend to focus fire.
* Provides performance when when the AI designer implements better
  (and complex) target selection code
2017-08-25 23:13:26 +02:00
abcdefg30
4ce2e82ff0 AI States style fixes and minor polish 2017-08-17 23:25:51 +01:00
reaperrr
879ab2ac1f Remove redundant Disposed checks
IsDead returns true if Disposed is true.
2017-08-05 18:31:15 +02:00
Paul Chote
afd8b9ab86 Rework harvester resource claiming:
* Maintains lists of claims, and only restricts
   reservations for friendly units.
 * Removes OnNotifyResourceClaimLost; it's not
   clear whether that is still useful, and it
   prevents future necessary cleanups.
 * Moves other code without changing behaviour.

This fixed stale claims from dead units and enemy
claims from preventing otherwise valid harvest
activities.
2017-07-18 01:09:19 +02:00
Paul Chote
b0906e1836 Add a bot type identifier. 2017-07-07 21:31:45 +01:00
Zimmermann Gyula
0d2d17d2fb Fix the AI acting the same at game restart. 2017-05-13 19:08:20 +01:00
Forcecore
7588d6708b HackyAI now builds refinery near ore. 2017-03-09 09:42:56 -06:00