From 0ecc6f224c80272630a44563531e448a0d585db6 Mon Sep 17 00:00:00 2001 From: Flugente Date: Fri, 7 Dec 2012 16:17:33 +0000 Subject: [PATCH] - taking prisoners is disabled in the palace and the royal bunker - improved surrender strength formula git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5715 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Overhead.cpp | 27 ++++++++------------------- Tactical/Soldier Control.cpp | 24 ++++++++++++++++++++++-- Tactical/Soldier Control.h | 1 + Utils/Text.h | 1 + Utils/_ChineseText.cpp | 1 + Utils/_DutchText.cpp | 1 + Utils/_EnglishText.cpp | 1 + Utils/_FrenchText.cpp | 1 + Utils/_GermanText.cpp | 1 + Utils/_ItalianText.cpp | 1 + Utils/_PolishText.cpp | 1 + Utils/_RussianText.cpp | 1 + Utils/_TaiwaneseText.cpp | 1 + 13 files changed, 41 insertions(+), 21 deletions(-) diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index e14437937..ddb4f4ee3 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -10061,12 +10061,8 @@ void PrisonerSurrenderMessageBoxCallBack( UINT8 ubExitValue ) { if( pSoldier->bActive && ( pSoldier->sSectorX == gWorldSectorX ) && ( pSoldier->sSectorY == gWorldSectorY ) && ( pSoldier->bSectorZ == gbWorldSectorZ) ) { - // if he's training teammates in this stat - if( ( pSoldier->stats.bLife >= OKLIFE ) && !(pSoldier->bSoldierFlagMask & SOLDIER_POW) ) - { - // player side counts double, to put more emphasize on overwhelming the enemy with mercs and not just militia - playersidestrength += 2; - } + // player side counts double, to put more emphasize on overwhelming the enemy with mercs and not just spamming militia + playersidestrength += 2 * pSoldier->GetSurrenderStrength(); } } @@ -10077,11 +10073,7 @@ void PrisonerSurrenderMessageBoxCallBack( UINT8 ubExitValue ) { if( pSoldier->bActive && ( pSoldier->sSectorX == gWorldSectorX ) && ( pSoldier->sSectorY == gWorldSectorY ) && ( pSoldier->bSectorZ == gbWorldSectorZ) ) { - // if he's training teammates in this stat - if( ( pSoldier->stats.bLife >= OKLIFE ) && !(pSoldier->bSoldierFlagMask & SOLDIER_POW) ) - { - ++playersidestrength; - } + playersidestrength += pSoldier->GetSurrenderStrength(); } } @@ -10092,11 +10084,7 @@ void PrisonerSurrenderMessageBoxCallBack( UINT8 ubExitValue ) { if( pSoldier->bActive && ( pSoldier->sSectorX == gWorldSectorX ) && ( pSoldier->sSectorY == gWorldSectorY ) && ( pSoldier->bSectorZ == gbWorldSectorZ) ) { - // if he's training teammates in this stat - if( ( pSoldier->stats.bLife >= OKLIFE ) && !(pSoldier->bSoldierFlagMask & SOLDIER_POW) ) - { - ++enemysidestrength; - } + enemysidestrength += pSoldier->GetSurrenderStrength(); } } @@ -10110,14 +10098,15 @@ void PrisonerSurrenderMessageBoxCallBack( UINT8 ubExitValue ) { if( pSoldier->bActive && ( pSoldier->sSectorX == gWorldSectorX ) && ( pSoldier->sSectorY == gWorldSectorY ) && ( pSoldier->bSectorZ == gbWorldSectorZ) ) { - // if he's training teammates in this stat - if( ( pSoldier->stats.bLife >= OKLIFE ) && !(pSoldier->bSoldierFlagMask & SOLDIER_POW) ) + if( pSoldier->stats.bLife >= OKLIFE ) { pSoldier->bSoldierFlagMask |= SOLDIER_POW; } } } } + else + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szPrisonerTextStr[STR_PRISONER_REFUSE_SURRENDER] ); } else { @@ -10131,7 +10120,7 @@ void PrisonerSurrenderMessageBoxCallBack( UINT8 ubExitValue ) // Flugente: offer the enemy the chance to surrender void HandleSurrenderOffer( SOLDIERTYPE* pSoldier ) { - // only for enemies... + // only against enemies... if ( !pSoldier || pSoldier->bTeam != ENEMY_TEAM ) return; diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 81fa9234e..7fafac120 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -15315,6 +15315,26 @@ BOOLEAN SOLDIERTYPE::CanProcessPrisoners() return FALSE; } +UINT32 SOLDIERTYPE::GetSurrenderStrength() +{ + if( this->stats.bLife < OKLIFE || this->flags.fMercAsleep || this->bCollapsed || (this->bSoldierFlagMask & SOLDIER_POW) ) + return 0; + + UINT32 value = 100 + 10 * EffectiveExpLevel( this ) + EffectiveStrength( this, FALSE ) + 3 * EffectiveMarksmanship( this) + EffectiveLeadership( this) / 4; + + ReducePointsForFatigue( this, &value ); + + value = (value * this->stats.bLife / this->stats.bLifeMax); + + // adjust for type of soldier + if ( this->ubSoldierClass == SOLDIER_CLASS_ELITE || this->ubSoldierClass == SOLDIER_CLASS_ELITE_MILITIA ) + value *= 1.5; + else if ( this->ubSoldierClass == SOLDIER_CLASS_ADMINISTRATOR || this->ubSoldierClass == SOLDIER_CLASS_GREEN_MILITIA ) + value *= 0.75; + + return value; +} + INT32 CheckBleeding( SOLDIERTYPE *pSoldier ) { INT8 bBandaged; //,savedOurTurn; @@ -16620,8 +16640,8 @@ BOOLEAN SOLDIERTYPE::PlayerSoldierStartTalking( UINT8 ubTargetID, BOOLEAN fValid DeductPoints( this, sAPCost, 0, UNTRIGGERED_INTERRUPT ); apsDeducted = TRUE; - // Flugente: if we are talking to an enemy, we have the option to offer them surrendering - if ( pTSoldier->bTeam == ENEMY_TEAM && gGameExternalOptions.fEnemyCanSurrender ) + // Flugente: if we are talking to an enemy, we have the option to offer them surrendering... but not on y levels >= 16 (no surrendering in the palace, as we have to kill, not capture, the queen) + if ( pTSoldier->bTeam == ENEMY_TEAM && gGameExternalOptions.fEnemyCanSurrender && gWorldSectorY < WORLD_MAP_X - 2 ) { HandleSurrenderOffer(pTSoldier); return( FALSE ); diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index 424df2b62..10377a6fb 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -1499,6 +1499,7 @@ public: // Flugente: prisoner system BOOLEAN CanProcessPrisoners(); + UINT32 GetSurrenderStrength(); ////////////////////////////////////////////////////////////////////////////// }; // SOLDIERTYPE; diff --git a/Utils/Text.h b/Utils/Text.h index a113fac90..9f317c320 100644 --- a/Utils/Text.h +++ b/Utils/Text.h @@ -738,6 +738,7 @@ enum STR_PRISONER_SENTTOSECTOR, STR_PRISONER_RELEASED, STR_PRISONER_ARMY_FREED_PRISON, + STR_PRISONER_REFUSE_SURRENDER, TEXT_NUM_PRISONER_STR }; diff --git a/Utils/_ChineseText.cpp b/Utils/_ChineseText.cpp index b7628c4be..f93a3a132 100644 --- a/Utils/_ChineseText.cpp +++ b/Utils/_ChineseText.cpp @@ -7498,6 +7498,7 @@ STR16 szPrisonerTextStr[]= L"Prisoners were sent to %s!", L"Prisoners have been released!", L"The army now occupies the prison in %s, the prisoners were freed!", + L"The enemy refuses to surrender!", }; #endif //CHINESE diff --git a/Utils/_DutchText.cpp b/Utils/_DutchText.cpp index a7396e00f..0e3cf7eaa 100644 --- a/Utils/_DutchText.cpp +++ b/Utils/_DutchText.cpp @@ -7491,6 +7491,7 @@ STR16 szPrisonerTextStr[]= L"Prisoners were sent to %s!", L"Prisoners have been released!", L"The army now occupies the prison in %s, the prisoners were freed!", + L"The enemy refuses to surrender!", }; #endif //DUTCH diff --git a/Utils/_EnglishText.cpp b/Utils/_EnglishText.cpp index b06862de5..529df244e 100644 --- a/Utils/_EnglishText.cpp +++ b/Utils/_EnglishText.cpp @@ -7478,6 +7478,7 @@ STR16 szPrisonerTextStr[]= L"Prisoners were sent to %s!", L"Prisoners have been released!", L"The army now occupies the prison in %s, the prisoners were freed!", + L"The enemy refuses to surrender!", }; #endif //ENGLISH diff --git a/Utils/_FrenchText.cpp b/Utils/_FrenchText.cpp index 2b6746545..21b041e5a 100644 --- a/Utils/_FrenchText.cpp +++ b/Utils/_FrenchText.cpp @@ -7465,6 +7465,7 @@ STR16 szPrisonerTextStr[]= L"Prisoners were sent to %s!", L"Prisoners have been released!", L"The army now occupies the prison in %s, the prisoners were freed!", + L"The enemy refuses to surrender!", }; #endif //FRENCH diff --git a/Utils/_GermanText.cpp b/Utils/_GermanText.cpp index da5569db2..7799b0afa 100644 --- a/Utils/_GermanText.cpp +++ b/Utils/_GermanText.cpp @@ -7305,6 +7305,7 @@ STR16 szPrisonerTextStr[]= L"Gefangene wurden nach %s geschickt!", L"Gefangene freigelassen!", L"Die Armee hat das Gefängnis in %s besetzt, die Gefangenen wurden befreit!", + L"Der Gegner weigert sich aufzugeben!", }; #endif //GERMAN diff --git a/Utils/_ItalianText.cpp b/Utils/_ItalianText.cpp index 0bbce29b6..d2c5b0148 100644 --- a/Utils/_ItalianText.cpp +++ b/Utils/_ItalianText.cpp @@ -7478,6 +7478,7 @@ STR16 szPrisonerTextStr[]= L"Prisoners were sent to %s!", L"Prisoners have been released!", L"The army now occupies the prison in %s, the prisoners were freed!", + L"The enemy refuses to surrender!", }; #endif //ITALIAN diff --git a/Utils/_PolishText.cpp b/Utils/_PolishText.cpp index fe61537c1..1600531f3 100644 --- a/Utils/_PolishText.cpp +++ b/Utils/_PolishText.cpp @@ -7492,6 +7492,7 @@ STR16 szPrisonerTextStr[]= L"Prisoners were sent to %s!", L"Prisoners have been released!", L"The army now occupies the prison in %s, the prisoners were freed!", + L"The enemy refuses to surrender!", }; #endif //POLISH diff --git a/Utils/_RussianText.cpp b/Utils/_RussianText.cpp index fa6f2db6c..28f678587 100644 --- a/Utils/_RussianText.cpp +++ b/Utils/_RussianText.cpp @@ -7444,6 +7444,7 @@ STR16 szPrisonerTextStr[]= L"Prisoners were sent to %s!", L"Prisoners have been released!", L"The army now occupies the prison in %s, the prisoners were freed!", + L"The enemy refuses to surrender!", }; #endif //RUSSIAN diff --git a/Utils/_TaiwaneseText.cpp b/Utils/_TaiwaneseText.cpp index 229869e76..879e4f663 100644 --- a/Utils/_TaiwaneseText.cpp +++ b/Utils/_TaiwaneseText.cpp @@ -7495,6 +7495,7 @@ STR16 szPrisonerTextStr[]= L"Prisoners were sent to %s!", L"Prisoners have been released!", L"The army now occupies the prison in %s, the prisoners were freed!", + L"The enemy refuses to surrender!", }; #endif //TAIWANESE