added new disability "Self-Harming"

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8359 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2017-01-11 22:32:33 +00:00
parent 322d307980
commit 4d48876c1f
20 changed files with 160 additions and 0 deletions
+10
View File
@@ -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
+84
View File
@@ -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()
{
+1
View File
@@ -331,6 +331,7 @@ typedef enum
SHORTSIGHTED,
HEMOPHILIAC,
AFRAID_OF_HEIGHTS,
SELF_HARM,
NUM_DISABILITIES
} PersonalityTrait;
+1
View File
@@ -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[];
+7
View File
@@ -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[]=
{
+7
View File
@@ -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[]=
+7
View File
@@ -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[]=
{
+7
View File
@@ -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[]=
{
+7
View File
@@ -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[]=
{
+7
View File
@@ -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[]=
+1
View File
@@ -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[]=
+1
View File
@@ -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.",
};
+1
View File
@@ -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[]=
+1
View File
@@ -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.",
};
+1
View File
@@ -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[]=
+1
View File
@@ -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.",
};
+1
View File
@@ -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.",
};
+1
View File
@@ -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[]=
+7
View File
@@ -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[]=
{
+7
View File
@@ -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[]=
{