diff --git a/Laptop/email.cpp b/Laptop/email.cpp index d13256dc..fe37d9ea 100644 --- a/Laptop/email.cpp +++ b/Laptop/email.cpp @@ -4138,6 +4138,16 @@ void HandleIMPCharProfileResultsMessage( void) AddEmailRecordToList( pString ); } + else if ( gMercProfiles[iCurrentIMPSlot].bDisability == SELF_HARM ) + { + swprintf( pString, gzIMPDisabilityTraitEmailTextSelfHarm[0] ); + + AddEmailRecordToList( pString ); + + swprintf( pString, gzIMPDisabilityTraitEmailTextSelfHarm[1] ); + + AddEmailRecordToList( pString ); + } else { // personality tick diff --git a/Strategic/Hourly Update.cpp b/Strategic/Hourly Update.cpp index c31ba207..cac65d72 100644 --- a/Strategic/Hourly Update.cpp +++ b/Strategic/Hourly Update.cpp @@ -23,6 +23,7 @@ #include "Drugs And Alcohol.h" // added by Flugente for HourlyDrugUpdate() #include "Interface.h" // added by Flugente #include "SkillCheck.h" // added by Flugente + #include "Isometric Utils.h" // added by Flugente for NOWHERE #endif #include "Luaglobal.h" @@ -45,6 +46,7 @@ void HourlyQuestUpdate(); void HourlyLarryUpdate(); void HourlySmokerUpdate(); +void HourlyDisabilityUpdate(); void HourlyStealUpdate(); // Flugente: certain characters might steal equipment (backgrounds) void HourlySnitchUpdate(); // anv: decreasing cooldown after exposition @@ -121,6 +123,8 @@ CHAR16 zString[128]; HourlySmokerUpdate( ); + HourlyDisabilityUpdate(); + HourlyStealUpdate(); HourlySnitchUpdate(); @@ -550,6 +554,86 @@ void HourlySmokerUpdate( ) } } +void HourlyDisabilityUpdate( ) +{ + SOLDIERTYPE* pSoldier = NULL; + SOLDIERTYPE* pOtherSoldier = NULL; + + for ( UINT32 cnt = gTacticalStatus.Team[OUR_TEAM].bFirstID; cnt <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++cnt ) + { + pSoldier = MercPtrs[cnt]; + + if ( pSoldier && pSoldier->bActive && !pSoldier->flags.fMercAsleep ) + { + // possibl self-harm + if ( Chance(20) && DoesMercHaveDisability( pSoldier, SELF_HARM ) ) + { + // don't do this if we are at low health, or in combat, or travelling, or a patient or doctor + // only do this if we are rather healed + if ( pSoldier->stats.bLife >= OKLIFE && pSoldier->stats.bLifeMax > 0 && (FLOAT)(pSoldier->stats.bLife) / (FLOAT)(pSoldier->stats.bLifeMax) > 0.9f + && !pSoldier->flags.fBetweenSectors && !gTacticalStatus.fEnemyInSector + && !IS_PATIENT( pSoldier->bAssignment ) && pSoldier->bAssignment != IN_TRANSIT ) + { + // anv: snitches stop mercs from getting wasted + BOOLEAN fSnitchStoppedBehaviour = FALSE; + for ( INT32 cnt2 = gTacticalStatus.Team[OUR_TEAM].bFirstID; cnt2 <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++cnt2 ) + { + pOtherSoldier = MercPtrs[cnt2]; + + // note - snitches stop others, but can get wasted themselves (if they have drug use specifically set in background...) + if ( pOtherSoldier && !pOtherSoldier->flags.fBetweenSectors && pOtherSoldier->bActive && !pOtherSoldier->flags.fMercAsleep && pSoldier->ubProfile != pOtherSoldier->ubProfile ) + { + if ( ProfileHasSkillTrait( pOtherSoldier->ubProfile, SNITCH_NT ) && !(pSoldier->usSoldierFlagMask2 & SOLDIER_PREVENT_MISBEHAVIOUR_OFF) ) + { + if ( pSoldier->sSectorX == pOtherSoldier->sSectorX && pSoldier->sSectorY == pOtherSoldier->sSectorY && pSoldier->bSectorZ == pOtherSoldier->bSectorZ ) + { + UINT16 bPreventChance = (EffectiveLeadership( pOtherSoldier ) + EffectiveExpLevel( pOtherSoldier ) / 2); + if ( gGameOptions.fNewTraitSystem ) + { + bPreventChance += 25 * NUM_SKILL_TRAITS( pOtherSoldier, SQUADLEADER_NT ); + bPreventChance -= 25 * NUM_SKILL_TRAITS( pSoldier, STEALTHY_NT ); + } + else + { + bPreventChance -= 25 * NUM_SKILL_TRAITS( pSoldier, STEALTHY_OT ); + } + + // keep 1% chance no matter what + bPreventChance = max( 0, min( 99, bPreventChance ) ); + if ( Chance( bPreventChance ) ) + { + // merc is not amused by being prevented + HandleMoraleEvent( pSoldier, MORALE_PREVENTED_MISBEHAVIOUR, pSoldier->sSectorX, pSoldier->sSectorX, pSoldier->bSectorZ ); + // also here would be a place for dynamic relationship decrease between them + // Flugente: then lets do that, shall we? + AddOpinionEvent( pSoldier->ubProfile, pOtherSoldier->ubProfile, OPINIONEVENT_SNITCHINTERFERENCE ); + + fSnitchStoppedBehaviour = TRUE; + continue; + } + } + } + } + } + + if ( !fSnitchStoppedBehaviour ) + { + // take damage, but not bleeding damage (otherwise we'd constantly have to check in on this merc and manually bandage them, which is tedious) + INT8 oldbleeding = pSoldier->bBleeding; + + pSoldier->SoldierTakeDamage( 0, 1, 0, TAKE_DAMAGE_BLADE, pSoldier->ubID, NOWHERE, 0, FALSE ); + + pSoldier->bBleeding = oldbleeding; + + // Flugente: dynamic opinions + HandleDynamicOpinionChange( pSoldier, OPINIONEVENT_ANNOYINGDISABILITY, TRUE, TRUE ); + } + } + } + } + } +} + // anv: decrease exposed snitch cooldown (for simplified exposition handling) void HourlySnitchUpdate() { diff --git a/Tactical/soldier profile type.h b/Tactical/soldier profile type.h index fc85c2fa..4750c603 100644 --- a/Tactical/soldier profile type.h +++ b/Tactical/soldier profile type.h @@ -331,6 +331,7 @@ typedef enum SHORTSIGHTED, HEMOPHILIAC, AFRAID_OF_HEIGHTS, + SELF_HARM, NUM_DISABILITIES } PersonalityTrait; diff --git a/Utils/Text.h b/Utils/Text.h index 9f9bf259..6cba8bf4 100644 --- a/Utils/Text.h +++ b/Utils/Text.h @@ -346,6 +346,7 @@ extern STR16 gzIMPDisabilityTraitEmailTextDeaf[]; // added by Flugente extern STR16 gzIMPDisabilityTraitEmailTextShortSighted[]; extern STR16 gzIMPDisabilityTraitEmailTextHemophiliac[]; // added by Flugente extern STR16 gzIMPDisabilityTraitEmailTextAfraidOfHeights[]; // added by Flugente +extern STR16 gzIMPDisabilityTraitEmailTextSelfHarm[]; // added by Flugente extern STR16 sEnemyTauntsFireGun[]; extern STR16 sEnemyTauntsFireLauncher[]; extern STR16 sEnemyTauntsThrow[]; diff --git a/Utils/_ChineseText.cpp b/Utils/_ChineseText.cpp index dc1c824e..9713996e 100644 --- a/Utils/_ChineseText.cpp +++ b/Utils/_ChineseText.cpp @@ -7834,6 +7834,7 @@ STR16 gzIMPDisabilityTraitText[]= L"近视眼", //L"Shortsighted", L"血友病",//L"Hemophiliac", L"Fear of Heights", // TODO.Translate + L"Self-Harming", L"I.M.P. 性格缺陷", }; @@ -7861,6 +7862,12 @@ STR16 gzIMPDisabilityTraitEmailTextAfraidOfHeights[]= // TODO.Translate L"You prefer missions where you don't have to scale tall buildings or mountains. We recommend conquering the Netherlands.", }; +STR16 gzIMPDisabilityTraitEmailTextSelfHarm[] = +{ + L"Might want to make sure your knives are always clean.", + L"You have some issues with knives. Not that you tend to avoid them, quite the opposite, really.", +}; + // HEADROCK HAM 3.6: Error strings for assigning a merc to a facility STR16 gzFacilityErrorMessage[]= { diff --git a/Utils/_DutchText.cpp b/Utils/_DutchText.cpp index d5d4e568..0f820f9f 100644 --- a/Utils/_DutchText.cpp +++ b/Utils/_DutchText.cpp @@ -7847,6 +7847,7 @@ STR16 gzIMPDisabilityTraitText[]= L"Shortsighted", L"Hemophiliac", // TODO.Translate L"Fear of Heights", + L"Self-Harming", L"I.M.P. Disabilities", }; @@ -7874,6 +7875,12 @@ STR16 gzIMPDisabilityTraitEmailTextAfraidOfHeights[]= // TODO.Translate L"You prefer missions where you don't have to scale tall buildings or mountains. We recommend conquering the Netherlands.", }; +STR16 gzIMPDisabilityTraitEmailTextSelfHarm[] = +{ + L"Might want to make sure your knives are always clean.", + L"You have some issues with knives. Not that you tend to avoid them, quite the opposite, really.", +}; + // TODO.Translate // HEADROCK HAM 3.6: Error strings for assigning a merc to a facility STR16 gzFacilityErrorMessage[]= diff --git a/Utils/_EnglishText.cpp b/Utils/_EnglishText.cpp index c251fe12..a3820dea 100644 --- a/Utils/_EnglishText.cpp +++ b/Utils/_EnglishText.cpp @@ -7835,6 +7835,7 @@ STR16 gzIMPDisabilityTraitText[]= L"Shortsighted", L"Hemophiliac", L"Fear of Heights", + L"Self-Harming", L"I.M.P. Disabilities", }; @@ -7862,6 +7863,12 @@ STR16 gzIMPDisabilityTraitEmailTextAfraidOfHeights[]= L"You prefer missions where you don't have to scale tall buildings or mountains. We recommend conquering the Netherlands.", }; +STR16 gzIMPDisabilityTraitEmailTextSelfHarm[] = +{ + L"Might want to make sure your knives are always clean.", + L"You have some issues with knives. Not that you tend to avoid them, quite the opposite, really.", +}; + // HEADROCK HAM 3.6: Error strings for assigning a merc to a facility STR16 gzFacilityErrorMessage[]= { diff --git a/Utils/_FrenchText.cpp b/Utils/_FrenchText.cpp index 695aeebb..f34cfb40 100644 --- a/Utils/_FrenchText.cpp +++ b/Utils/_FrenchText.cpp @@ -7841,6 +7841,7 @@ STR16 gzIMPDisabilityTraitText[]= L"Mauvaise vue", L"Hemophiliac", // TODO.Translate L"Fear of Heights", + L"Self-Harming", L"IMP : Handicaps", }; @@ -7868,6 +7869,12 @@ STR16 gzIMPDisabilityTraitEmailTextAfraidOfHeights[]= // TODO.Translate L"You prefer missions where you don't have to scale tall buildings or mountains. We recommend conquering the Netherlands.", }; +STR16 gzIMPDisabilityTraitEmailTextSelfHarm[] = +{ + L"Might want to make sure your knives are always clean.", + L"You have some issues with knives. Not that you tend to avoid them, quite the opposite, really.", +}; + // HEADROCK HAM 3.6: Error strings for assigning a merc to a facility STR16 gzFacilityErrorMessage[]= { diff --git a/Utils/_GermanText.cpp b/Utils/_GermanText.cpp index a200b75a..a952aff0 100644 --- a/Utils/_GermanText.cpp +++ b/Utils/_GermanText.cpp @@ -7668,6 +7668,7 @@ STR16 gzIMPDisabilityTraitText[]= L"Kurzsichtigkeit", L"Bluter", L"Höhenangst" + L"Selbstverletzend", L"Ihre größte Schwäche", }; @@ -7695,6 +7696,12 @@ STR16 gzIMPDisabilityTraitEmailTextAfraidOfHeights[]= // TODO.Translate L"You prefer missions where you don't have to scale tall buildings or mountains. We recommend conquering the Netherlands.", }; +STR16 gzIMPDisabilityTraitEmailTextSelfHarm[] = +{ + L"Might want to make sure your knives are always clean.", + L"You have some issues with knives. Not that you tend to avoid them, quite the opposite, really.", +}; + // HEADROCK HAM 3.6: Error strings for assigning a merc to a facility STR16 gzFacilityErrorMessage[]= { diff --git a/Utils/_ItalianText.cpp b/Utils/_ItalianText.cpp index 60c8d0b7..a06da897 100644 --- a/Utils/_ItalianText.cpp +++ b/Utils/_ItalianText.cpp @@ -7837,6 +7837,7 @@ STR16 gzIMPDisabilityTraitText[]= L"Shortsighted", L"Hemophiliac", // TODO.Translate L"Fear of Heights", + L"Self-Harming", L"I.M.P. Disabilities", }; @@ -7864,6 +7865,12 @@ STR16 gzIMPDisabilityTraitEmailTextAfraidOfHeights[]= // TODO.Translate L"You prefer missions where you don't have to scale tall buildings or mountains. We recommend conquering the Netherlands.", }; +STR16 gzIMPDisabilityTraitEmailTextSelfHarm[] = +{ + L"Might want to make sure your knives are always clean.", + L"You have some issues with knives. Not that you tend to avoid them, quite the opposite, really.", +}; + // TODO.Translate // HEADROCK HAM 3.6: Error strings for assigning a merc to a facility STR16 gzFacilityErrorMessage[]= diff --git a/Utils/_Ja25ChineseText.cpp b/Utils/_Ja25ChineseText.cpp index a58715b5..bc0541fd 100644 --- a/Utils/_Ja25ChineseText.cpp +++ b/Utils/_Ja25ChineseText.cpp @@ -479,6 +479,7 @@ STR16 gzIMPDisabilitiesHelpTexts[]= L"减少视力范围", // L"Reduced sight range.", L"大大增加的流血速度.", //L"Drastically increased bleeding.", L"Performance suffers while on a rooftop.", // TODO.Translate + L"Occasionally harms self.", }; STR16 gzIMPProfileCostText[]= diff --git a/Utils/_Ja25DutchText.cpp b/Utils/_Ja25DutchText.cpp index a77d2cda..277aafd3 100644 --- a/Utils/_Ja25DutchText.cpp +++ b/Utils/_Ja25DutchText.cpp @@ -478,6 +478,7 @@ STR16 gzIMPDisabilitiesHelpTexts[]= L"Reduced sight range.", L"Drastically increased bleeding.", // TODO.Translate L"Performance suffers while on a rooftop.", // TODO.Translate + L"Occasionally harms self.", }; diff --git a/Utils/_Ja25EnglishText.cpp b/Utils/_Ja25EnglishText.cpp index 21fb3212..2c9b57b2 100644 --- a/Utils/_Ja25EnglishText.cpp +++ b/Utils/_Ja25EnglishText.cpp @@ -479,6 +479,7 @@ STR16 gzIMPDisabilitiesHelpTexts[]= L"Reduced sight range.", L"Drastically increased bleeding.", L"Performance suffers while on a rooftop.", + L"Occasionally harms self.", }; STR16 gzIMPProfileCostText[]= diff --git a/Utils/_Ja25FrenchText.cpp b/Utils/_Ja25FrenchText.cpp index 482f91fe..a420f67a 100644 --- a/Utils/_Ja25FrenchText.cpp +++ b/Utils/_Ja25FrenchText.cpp @@ -478,6 +478,7 @@ STR16 gzIMPDisabilitiesHelpTexts[]= L"Distance de vision réduit.", L"Drastically increased bleeding.", // TODO.Translate L"Performance suffers while on a rooftop.", // TODO.Translate + L"Occasionally harms self.", }; diff --git a/Utils/_Ja25GermanText.cpp b/Utils/_Ja25GermanText.cpp index 4d680760..7a5a2898 100644 --- a/Utils/_Ja25GermanText.cpp +++ b/Utils/_Ja25GermanText.cpp @@ -480,6 +480,7 @@ STR16 gzIMPDisabilitiesHelpTexts[]= L"Geringere Sichtweite.", L"Drastically increased bleeding.", // TODO.Translate L"Performance suffers while on a rooftop.", // TODO.Translate + L"Occasionally harms self.", }; STR16 gzIMPProfileCostText[]= diff --git a/Utils/_Ja25ItalianText.cpp b/Utils/_Ja25ItalianText.cpp index 642f0473..b5215d4a 100644 --- a/Utils/_Ja25ItalianText.cpp +++ b/Utils/_Ja25ItalianText.cpp @@ -476,6 +476,7 @@ STR16 gzIMPDisabilitiesHelpTexts[]= L"Reduced sight range.", L"Drastically increased bleeding.", // TODO.Translate L"Performance suffers while on a rooftop.", // TODO.Translate + L"Occasionally harms self.", }; diff --git a/Utils/_Ja25PolishText.cpp b/Utils/_Ja25PolishText.cpp index 44d1a171..2a203131 100644 --- a/Utils/_Ja25PolishText.cpp +++ b/Utils/_Ja25PolishText.cpp @@ -478,6 +478,7 @@ STR16 gzIMPDisabilitiesHelpTexts[]= L"Reduced sight range.", L"Drastically increased bleeding.", // TODO.Translate L"Performance suffers while on a rooftop.", // TODO.Translate + L"Occasionally harms self.", }; diff --git a/Utils/_Ja25RussianText.cpp b/Utils/_Ja25RussianText.cpp index cfca3c3d..c0c581f6 100644 --- a/Utils/_Ja25RussianText.cpp +++ b/Utils/_Ja25RussianText.cpp @@ -479,6 +479,7 @@ STR16 gzIMPDisabilitiesHelpTexts[]= L"Сниженная дальность видимости.", L"Drastically increased bleeding.", // TODO.Translate L"Performance suffers while on a rooftop.", // TODO.Translate + L"Occasionally harms self.", }; STR16 gzIMPProfileCostText[]= diff --git a/Utils/_PolishText.cpp b/Utils/_PolishText.cpp index 7d99d1ec..f4daed38 100644 --- a/Utils/_PolishText.cpp +++ b/Utils/_PolishText.cpp @@ -7852,6 +7852,7 @@ STR16 gzIMPDisabilityTraitText[]= L"Shortsighted", L"Hemophiliac", // TODO.Translate L"Fear of Heights", + L"Self-Harming", L"Niepełnosprawności I.M.P.-a", }; @@ -7879,6 +7880,12 @@ STR16 gzIMPDisabilityTraitEmailTextAfraidOfHeights[]= // TODO.Translate L"You prefer missions where you don't have to scale tall buildings or mountains. We recommend conquering the Netherlands.", }; +STR16 gzIMPDisabilityTraitEmailTextSelfHarm[] = +{ + L"Might want to make sure your knives are always clean.", + L"You have some issues with knives. Not that you tend to avoid them, quite the opposite, really.", +}; + // HEADROCK HAM 3.6: Error strings for assigning a merc to a facility STR16 gzFacilityErrorMessage[]= { diff --git a/Utils/_RussianText.cpp b/Utils/_RussianText.cpp index 6fa56513..a39ad1f2 100644 --- a/Utils/_RussianText.cpp +++ b/Utils/_RussianText.cpp @@ -7835,6 +7835,7 @@ STR16 gzIMPDisabilityTraitText[]= L"Близорукий", L"Hemophiliac", // TODO.Translate L"Fear of Heights", + L"Self-Harming", L"I.M.P.: Недостатки", //I.M.P. Disabilities }; @@ -7862,6 +7863,12 @@ STR16 gzIMPDisabilityTraitEmailTextAfraidOfHeights[]= // TODO.Translate L"You prefer missions where you don't have to scale tall buildings or mountains. We recommend conquering the Netherlands.", }; +STR16 gzIMPDisabilityTraitEmailTextSelfHarm[] = +{ + L"Might want to make sure your knives are always clean.", + L"You have some issues with knives. Not that you tend to avoid them, quite the opposite, really.", +}; + // HEADROCK HAM 3.6: Error strings for assigning a merc to a facility STR16 gzFacilityErrorMessage[]= {