From 7a7f5549080ea195fca88c5d443cd0e1a3fb38f3 Mon Sep 17 00:00:00 2001 From: Sevenfm Date: Fri, 15 Oct 2021 04:49:17 +0000 Subject: [PATCH] Fix/change: the hospital now checks for mercs with damaged stats in addition to damaged health. in addition, the hospital now charges money to heal damaged stats (by rftr). Minor fixes for quest debug log. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9180 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Strategic/Quests.cpp | 3 ++- Strategic/strategicmap.cpp | 2 +- Tactical/Interface Dialogue.cpp | 12 +++++++++--- TacticalAI/NPC.cpp | 2 +- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Strategic/Quests.cpp b/Strategic/Quests.cpp index 4284ec68..d8fea66d 100644 --- a/Strategic/Quests.cpp +++ b/Strategic/Quests.cpp @@ -31,6 +31,7 @@ #include "Assignments.h" #include "strategic.h" #include "Strategic Event Handler.h" + #include "Soldier Control.h" #endif #include "BobbyRMailOrder.h" @@ -290,7 +291,7 @@ UINT32 NumWoundedMercsNearby( UINT8 ubProfileID ) { pSoldier = MercSlots[ uiLoop ]; - if ( pSoldier && pSoldier->bTeam == gbPlayerNum && pSoldier->stats.bLife > 0 && pSoldier->stats.bLife < pSoldier->stats.bLifeMax && pSoldier->bAssignment != ASSIGNMENT_HOSPITAL + if ( pSoldier && pSoldier->bTeam == gbPlayerNum && pSoldier->stats.bLife > 0 && (pSoldier->stats.bLife < pSoldier->stats.bLifeMax || NumberOfDamagedStats(pSoldier) > 0) && pSoldier->bAssignment != ASSIGNMENT_HOSPITAL && pSoldier->sSectorX == pNPC->sSectorX && pSoldier->sSectorY == pNPC->sSectorY && pSoldier->bSectorZ == pNPC->bSectorZ ) { if (PythSpacesAway( sGridNo, pSoldier->sGridNo ) <= HOSPITAL_PATIENT_DISTANCE) diff --git a/Strategic/strategicmap.cpp b/Strategic/strategicmap.cpp index c74d0244..cded1780 100644 --- a/Strategic/strategicmap.cpp +++ b/Strategic/strategicmap.cpp @@ -3170,7 +3170,7 @@ BOOLEAN EnterSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) //Save to tempfile SaveWorldItemsToTempItemFile( sSectorX, sSectorY, (INT8)bSectorZ, guiNumWorldItems, gWorldItems ); - DebugQuestInfo(String("--- Enter Sector %s%s Level %d ---", pVertStrings[sSectorY], pHortStrings[sSectorX], bSectorZ)); + DebugQuestInfo(String("Enter Sector %s%s Level %d", pVertStrings[sSectorY], pHortStrings[sSectorX], bSectorZ)); return TRUE; //because the map was loaded. } diff --git a/Tactical/Interface Dialogue.cpp b/Tactical/Interface Dialogue.cpp index 62e4e3fa..9644aab3 100644 --- a/Tactical/Interface Dialogue.cpp +++ b/Tactical/Interface Dialogue.cpp @@ -1,4 +1,3 @@ - #ifdef PRECOMPILEDHEADERS #include "Tactical All.h" #include "PreBattle Interface.h" @@ -75,6 +74,7 @@ #include "Map Screen Helicopter.h" #include "Cheats.h" #include "Overhead.h" + #include "Soldier Control.h" #endif #include "LuaInitNPCs.h" @@ -3729,7 +3729,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) { // Are we in this sector, On the current squad? - if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife > 0 && pSoldier->stats.bLife < pSoldier->stats.bLifeMax && pSoldier->bAssignment != ASSIGNMENT_HOSPITAL && PythSpacesAway( pSoldier->sGridNo, pSoldier2->sGridNo ) < HOSPITAL_PATIENT_DISTANCE ) + if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife > 0 && (pSoldier->stats.bLife < pSoldier->stats.bLifeMax || NumberOfDamagedStats(pSoldier) > 0) && pSoldier->bAssignment != ASSIGNMENT_HOSPITAL && PythSpacesAway( pSoldier->sGridNo, pSoldier2->sGridNo ) < HOSPITAL_PATIENT_DISTANCE ) { SetSoldierAssignment( pSoldier, ASSIGNMENT_HOSPITAL, 0, 0, 0 ); TriggerNPCRecord( pSoldier->ubProfile, 2 ); @@ -4520,6 +4520,12 @@ UINT32 CalcPatientMedicalCost( SOLDIERTYPE * pSoldier ) uiCost = 10 * ( pSoldier->stats.bLifeMax - pSoldier->stats.bLife ); + for (UINT8 index = 0; index < NUM_DAMAGABLE_STATS; ++index) + { + // charge additional $150 for every damaged stat point + uiCost += (150 * pSoldier->ubCriticalStatDamage[index]); + } + if ( pSoldier->stats.bLife < OKLIFE ) { // charge additional $25 for every point below OKLIFE he is @@ -4577,7 +4583,7 @@ UINT32 CalcMedicalCost( UINT8 ubId ) pSoldier = MercPtrs[ cnt ]; if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife > 0 && pSoldier->bAssignment != ASSIGNMENT_HOSPITAL ) { - if ( pSoldier->stats.bLife < pSoldier->stats.bLifeMax ) + if ( pSoldier->stats.bLife < pSoldier->stats.bLifeMax || NumberOfDamagedStats(pSoldier) > 0) { if (PythSpacesAway( sGridNo, pSoldier->sGridNo ) <= HOSPITAL_PATIENT_DISTANCE) { diff --git a/TacticalAI/NPC.cpp b/TacticalAI/NPC.cpp index 41b5e900..3a501194 100644 --- a/TacticalAI/NPC.cpp +++ b/TacticalAI/NPC.cpp @@ -1934,7 +1934,7 @@ void Converse( UINT8 ubNPC, UINT8 ubMerc, INT8 bApproach, UINT32 uiApproachData SOLDIERTYPE * pNPC; BOOLEAN fAttemptingToGiveItem; - DebugQuestInfo(String("Converse: merc <%d> to NPC <%d> %d data %d", ubMerc, ubNPC, bApproach, uiApproachData)); + DebugQuestInfo(String("Converse: merc <%d> to NPC <%d> approach %d data %d", ubMerc, ubNPC, bApproach, uiApproachData)); // we have to record whether an item is being given in order to determine whether, // in the case where the approach is overridden, we need to return the item to the