Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,9 @@ This page lists all the individual contributions to the project by their author.
- Return warhead
- `ElectricAssault` weapons can now auto acquire allies' overpowerable defenses
- **NaotoYuuki** - Vertical & meteor trajectory projectile prototypes
- **handama** - AI script action to `16005 Jump Back To Previous Script`
- **handama**:
- AI script action to `16005 Jump Back To Previous Script`
- Fix AI team recruitment inconsistency causing underfilled teams
- **TaranDahl (航味麻酱)**:
- Skirmish AI "sell all buildings and set all technos to hunt" behavior dehardcode
- Skirmish AI "gather when MCV deploy" behavior dehardcode
Expand Down
2 changes: 1 addition & 1 deletion YRpp
Submodule YRpp updated 2 files
+29 −1 AStarClass.h
+10 −0 YRMathVector.h
1 change: 1 addition & 0 deletions docs/AI-Scripting-and-Mapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ This page describes all AI scripting and mapping related additions and changes i
- Teams spawned by trigger action 7,80,107 can use IFV and opentopped logic normally.
- If a pre-placed building has a `NaturalParticleSystem`, it used to always be created when the game starts. This has been removed.
- Superweapons used by AI for script actions `56 Chronoshift to Building`, `57 Chronoshift to a Target Type` and `10104 Chronoshift to Enemy Base` can now be explicitly set via `[General] -> AIChronoSphereSW` & `AIChronoWarpSW` respectively. If `AIChronoSphereSW` is set but `AIChronoWarpSW` is not, game will check former's `SW.PostDependent` for a second superweapon to use. Otherwise if not set, last superweapon listed in `[SuperWeaponTypes]` with `Type=ChronoSphere` or `Type=ChronoWarp` will be used, respectively.
- Fixed AI team recruitment inconsistency causing underfilled teams.

### Increased Overlay Limit

Expand Down
1 change: 1 addition & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,7 @@ Vanilla fixes:
- Enabled playing ingame movie in non-campaign modes (i.e. trigger action `100 Play Sidebar Movie...` and `117 Play Sidebar Movie and pause...`) (by TaranDahl)
- `ElectricAssault` weapons can now auto acquire allies' overpowerable defenses (by Ollerus)
- Fixed the issue that the time for units in the area guard mission to reacquire targets after eliminating the target is significantly longer than that in other missions (by TaranDahl)
- Fixed AI team recruitment inconsistency causing underfilled teams (by handama)
Phobos fixes:
- Fixed the bug that `AllowAirstrike=no` cannot completely prevent air strikes from being launched against it (by NetsuNegi)
Expand Down
29 changes: 28 additions & 1 deletion src/Ext/Techno/Body.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "Body.h"
#include "Body.h"

#include <JumpjetLocomotionClass.h>

Expand Down Expand Up @@ -884,6 +884,33 @@ void TechnoExt::ClickedApproachObject(FootClass* pThis, ObjectClass* pObject)
event.AddEvent();
}

bool TechnoExt::CanBeRecruitedFix(FootClass* pThis, HouseClass* pHouse)
{
const bool inTeam = pThis->Team != nullptr;
const bool available = pThis->IsAlive && pThis->Health > 0 && !pThis->InLimbo;
const bool wrongOwner = pThis->Owner != pHouse;

if (inTeam || !available || wrongOwner)
return false;

const bool canRecruit = pThis->RecruitableA && pThis->RecruitableB;
if (!canRecruit)
return false;

const Mission mission = pThis->GetCurrentMission();

if (!MissionClass::IsRecruitableMission(mission))
return false;

const bool validState =
!(pThis->ShouldEnterAbsorber || pThis->ShouldEnterOccupiable || pThis->ShouldGarrisonStructure) &&
pThis->DrainTarget == nullptr &&
!pThis->BunkerLinkedItem &&
pThis->LocomotorSource == nullptr;

return validState;
}

bool TechnoExt::EjectRandomly(FootClass* pEjectee, const CoordStruct& coords, int distance, bool select)
{
std::vector<CoordStruct> usableCoords;
Expand Down
3 changes: 2 additions & 1 deletion src/Ext/Techno/Body.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma once
#pragma once

#include <Ext/TechnoType/Body.h>
#include <Utilities/Container.h>
Expand Down Expand Up @@ -310,6 +310,7 @@ class TechnoExt
static bool SimpleDeployerAllowedToDeploy(UnitClass* pThis, bool defaultValue, bool alwaysCheckLandTypes);
static void ShowPromoteAnim(TechnoClass* pThis);
static void ClickedApproachObject(FootClass* pThis, ObjectClass* pObject);
static bool CanBeRecruitedFix(FootClass* pThis, HouseClass* pHouse);

static bool EjectRandomly(FootClass* pEjectee, const CoordStruct& coords, int distance, bool select);
static bool EjectSurvivor(FootClass* pSurvivor, CoordStruct coords, bool select);
Expand Down
12 changes: 12 additions & 0 deletions src/Ext/Techno/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1972,6 +1972,18 @@ DEFINE_HOOK(0x4D4B43, FootClass_Mission_Capture, 0x6)
return LosesDestination;
}

DEFINE_HOOK(0x4DA230, FootClass_CanBeRecruited, 0x5)
{
enum { SkipGameCode = 0x4DA294 };

GET(FootClass*, pThis, ECX);
GET_STACK(HouseClass*, pHouse, 0x4);

R->AL(TechnoExt::CanBeRecruitedFix(pThis, pHouse));

return SkipGameCode;
}

#pragma region DynamicSight

DEFINE_HOOK(0x41AE00, AircraftClass_See_DynamicSight, 0x6)
Expand Down
Loading