diff --git a/Laptop/IMP Background.cpp b/Laptop/IMP Background.cpp index d04a33fe..c6019fa1 100644 --- a/Laptop/IMP Background.cpp +++ b/Laptop/IMP Background.cpp @@ -491,6 +491,10 @@ void AssignBackgroundHelpText( UINT8 ubNumber, MOUSE_REGION* pMouseregion ) // ability description for ( UINT8 i = 0; i < BACKGROUND_FLAG_MAX; ++i) { + // some properties are hidden + if ( ((UINT64)1 << i) & BACKGROUND_HIDDEN_FLAGS ) + continue; + if ( zBackground[ ubNumber ].uiFlags & ((UINT64)1 << i) ) { swprintf(atStr, szBackgroundText_Flags[ i ] ); @@ -589,6 +593,12 @@ BOOLEAN IsBackGroundAllowed( UINT8 ubNumber ) if ( !ubNumber ) return FALSE; + // some backgrounds are only allowed to specific genders. Set both to forbid a background from ever showing up in IMP creation (for merc-specific backgrounds) + if ( fCharacterIsMale && zBackground[ ubNumber ].uiFlags & BACKGROUND_NO_MALE ) + return FALSE; + else if ( !fCharacterIsMale && zBackground[ ubNumber ].uiFlags & BACKGROUND_NO_FEMALE ) + return FALSE; + if ( SkillsList[0] == HEAVY_WEAPONS_NT || SkillsList[1] == HEAVY_WEAPONS_NT || SkillsList[2] == HEAVY_WEAPONS_NT ) { if ( zBackground[ ubNumber ].value[BG_ARTILLERY] > 0 ) diff --git a/Tactical/Interface.h b/Tactical/Interface.h index 10de1f50..20de5a63 100644 --- a/Tactical/Interface.h +++ b/Tactical/Interface.h @@ -129,6 +129,7 @@ enum { BG_MECHANICAL, BG_EXPLOSIVE_ASSIGN, BG_MEDICAL, + BG_WISDOM, // ap modifiers for non-sector related tasks BG_HEIGHT, @@ -181,6 +182,7 @@ enum { // various BG_BONUS_BREACHINGCHARGE, + BG_PERC_CTH_CREATURE, BG_MAX, }; @@ -196,7 +198,7 @@ typedef struct INT16 value[BG_MAX]; // property values } BACKGROUND_VALUES; -#define NUM_BACKGROUND 100 +#define NUM_BACKGROUND 200 extern BACKGROUND_VALUES zBackground[NUM_BACKGROUND]; diff --git a/Tactical/SkillCheck.cpp b/Tactical/SkillCheck.cpp index 08db1386..6d1888d1 100644 --- a/Tactical/SkillCheck.cpp +++ b/Tactical/SkillCheck.cpp @@ -68,6 +68,8 @@ INT16 EffectiveWisdom( SOLDIERTYPE * pSoldier) iEffWisdom = EffectStatForBeingDrunk( pSoldier, iEffWisdom ); + iEffWisdom = (iEffWisdom * (100 + pSoldier->GetBackgroundValue(BG_WISDOM))) / 100; + return( (INT16) iEffWisdom ); } diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index 85c37cce..d3bc1ba6 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -401,10 +401,13 @@ enum #define BACKGROUND_TRAPLEVEL 0x0000000000000010 //16 // trap level +1 #define BACKGROUND_CORRUPTIONSPREAD 0x0000000000000020 //32 // spreads corruption to others - not used in trunk! -//#define BACKGROUND_XENOPHOBIC 0x0000000000000040 //64 // arrogant towards others without this background -//#define BACKGROUND_CAPITULATION 0x0000000000000080 //128 // if present, the team's surrender strength is higher +#define BACKGROUND_NO_MALE 0x0000000000000040 //64 // background cannot be selected by males (IMP creation) +#define BACKGROUND_NO_FEMALE 0x0000000000000080 //128 // background cannot be selected by females (IMP creation) -#define BACKGROUND_FLAG_MAX 6 // number of flagged backgrounds - keep this updated, or properties will get lost! +#define BACKGROUND_FLAG_MAX 8 // number of flagged backgrounds - keep this updated, or properties will get lost! + +// some properties are hidden (forbid background in MP creation) +#define BACKGROUND_HIDDEN_FLAGS (BACKGROUND_NO_MALE|BACKGROUND_NO_FEMALE) // Flugente: types of multi-turn actions enum diff --git a/Tactical/Weapons.cpp b/Tactical/Weapons.cpp index a3ec2b0f..414f1fed 100644 --- a/Tactical/Weapons.cpp +++ b/Tactical/Weapons.cpp @@ -5181,14 +5181,15 @@ if (gGameExternalOptions.fUseNewCTHCalculation) // apply bonus from traits // Flugente: moved trait modifiers into a member function - if(gGameOptions.fNewTraitSystem) - { - UINT8 targetprofile = NOBODY; - if ( pTarget && pTarget->ubProfile != NOBODY ) - targetprofile = pTarget->ubProfile; + UINT8 targetprofile = NOBODY; + if ( pTarget && pTarget->ubProfile != NOBODY ) + targetprofile = pTarget->ubProfile; - fAimModifier += pSoldier->GetTraitCTHModifier( usInHand, ubAimTime, targetprofile ); - } + fAimModifier += pSoldier->GetTraitCTHModifier( usInHand, ubAimTime, targetprofile ); + + // Flugente: backgrounds + if ( pTarget && pTarget->bTeam == CREATURE_TEAM ) + fAimModifier += pSoldier->GetBackgroundValue(BG_PERC_CTH_CREATURE); // get aimbonus from target fAimModifier += CalcNewChanceToHitAimTargetBonus(pSoldier, pTarget, sGridNo, iRange, ubAimPos, fCantSeeTarget); @@ -5357,6 +5358,10 @@ else iTraitModifier = pSoldier->GetTraitCTHModifier( usInHand, ubAimTime, targetprofile ); + // Flugente: backgrounds + if ( pTarget && pTarget->bTeam == CREATURE_TEAM ) + iTraitModifier += pSoldier->GetBackgroundValue(BG_PERC_CTH_CREATURE); + // SHOOTING AT SAME TARGET AGAIN if (sGridNo == pSoldier->sLastTarget ) iBaseModifier += (FLOAT)gGameCTHConstants.BASE_SAME_TARGET; @@ -6088,7 +6093,7 @@ else // Impose global limits. // Flugente: backgrounds - iChance = min(iChance, gGameExternalOptions.ubMaximumCTH + (UINT8)(pSoldier->GetBackgroundValue(BG_PERC_CTH_MAX)) ); + iChance = min(iChance, min(100, gGameExternalOptions.ubMaximumCTH + (UINT8)(pSoldier->GetBackgroundValue(BG_PERC_CTH_MAX))) ); iChance = __max(iChance, gGameExternalOptions.ubMinimumCTH); return (iChance); @@ -6920,6 +6925,10 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTime, targetprofile = pTarget->ubProfile; iChance += pSoldier->GetTraitCTHModifier( usInHand, ubAimTime, targetprofile ); + + // Flugente: backgrounds + if ( pTarget && pTarget->bTeam == CREATURE_TEAM ) + iChance += pSoldier->GetBackgroundValue(BG_PERC_CTH_CREATURE); ///////////////////////////////////////////////////////////////////////////////////// @@ -7452,7 +7461,7 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTime, // iChance = MAXCHANCETOHIT; // Flugente: backgrounds - iChance = min(iChance, gGameExternalOptions.ubMaximumCTH + (UINT8)(pSoldier->GetBackgroundValue(BG_PERC_CTH_MAX)) ); + iChance = min(iChance, min(100, gGameExternalOptions.ubMaximumCTH + (UINT8)(pSoldier->GetBackgroundValue(BG_PERC_CTH_MAX))) ); } ///////////////////////////////////////////////////////////////////////////////////// diff --git a/Tactical/XML_Background.cpp b/Tactical/XML_Background.cpp index c29eaf2e..b53ced2c 100644 --- a/Tactical/XML_Background.cpp +++ b/Tactical/XML_Background.cpp @@ -80,6 +80,7 @@ backgroundStartElementHandle(void *userData, const XML_Char *name, const XML_Cha strcmp(name, "dexterity") == 0 || strcmp(name, "mechanical") == 0 || strcmp(name, "medical") == 0 || + strcmp(name, "wisdom") == 0 || strcmp(name, "explosives") == 0 || strcmp(name, "leadership") == 0 || strcmp(name, "marksmanship") == 0 || @@ -116,12 +117,15 @@ backgroundStartElementHandle(void *userData, const XML_Char *name, const XML_Cha strcmp(name, "approach_threaten") == 0 || strcmp(name, "approach_recruit") == 0 || strcmp(name, "breachingcharge") == 0 || + strcmp(name, "cth_vs_creatures") == 0 || strcmp(name, "druguse") == 0 || strcmp(name, "xenophobic") == 0 || strcmp(name, "corruptionspread") == 0 || strcmp(name, "level_underground") == 0 || strcmp(name, "scrounging") == 0 || - strcmp(name, "traplevel") == 0 )) + strcmp(name, "traplevel") == 0 || + strcmp(name, "no_male") == 0 || + strcmp(name, "no_female") == 0 )) { pData->curElement = ELEMENT_PROPERTY; @@ -294,6 +298,11 @@ backgroundEndElementHandle(void *userData, const XML_Char *name) pData->curElement = ELEMENT; pData->curBackground.value[BG_MEDICAL] = min(XML_BACKGROUND_STAT_MAX, max(-XML_BACKGROUND_STAT_MAX, (INT8) atol(pData->szCharData) )); } + else if(strcmp(name, "wisdom") == 0) + { + pData->curElement = ELEMENT; + pData->curBackground.value[BG_WISDOM] = min(XML_BACKGROUND_STAT_MAX, max(-XML_BACKGROUND_STAT_MAX, (INT8) atol(pData->szCharData) )); + } else if(strcmp(name, "explosives") == 0) { pData->curElement = ELEMENT; @@ -474,6 +483,11 @@ backgroundEndElementHandle(void *userData, const XML_Char *name) pData->curElement = ELEMENT; pData->curBackground.value[BG_BONUS_BREACHINGCHARGE] = min(100, max(-100, (INT16) atol(pData->szCharData) )); } + else if(strcmp(name, "cth_vs_creatures") == 0) + { + pData->curElement = ELEMENT; + pData->curBackground.value[BG_PERC_CTH_CREATURE] = min(20, max(-20, (INT16) atol(pData->szCharData) )); + } else if(strcmp(name, "druguse") == 0) { pData->curElement = ELEMENT; @@ -504,6 +518,16 @@ backgroundEndElementHandle(void *userData, const XML_Char *name) pData->curElement = ELEMENT; pData->curBackground.uiFlags |= (UINT16) atol(pData->szCharData) ? BACKGROUND_TRAPLEVEL : 0; } + else if(strcmp(name, "no_male") == 0) + { + pData->curElement = ELEMENT; + pData->curBackground.uiFlags |= (UINT16) atol(pData->szCharData) ? BACKGROUND_NO_MALE : 0; + } + else if(strcmp(name, "no_female") == 0) + { + pData->curElement = ELEMENT; + pData->curBackground.uiFlags |= (UINT16) atol(pData->szCharData) ? BACKGROUND_NO_FEMALE : 0; + } pData->maxReadDepth--; } diff --git a/Utils/_ChineseText.cpp b/Utils/_ChineseText.cpp index 993175a4..24351106 100644 --- a/Utils/_ChineseText.cpp +++ b/Utils/_ChineseText.cpp @@ -7614,6 +7614,8 @@ STR16 szBackgroundText_Flags[]= L" +1 traplevel to planted bombs\n", L" spreads corruption to nearby mercs\n", + L" female only", // won't show up, text exists for compatibility reasons + L" male only", // won't show up, text exists for compatibility reasons }; // TODO.Translate @@ -7636,6 +7638,7 @@ STR16 szBackgroundText_Value[]= L" %s%d%% mechanical stat\n", L" %s%d%% explosives stat\n", L" %s%d%% medical stat\n", + L" %s%d%% wisdom stat\n", L" %s%d%% APs on rooftops\n", L" %s%d%% APs needed to swim\n", @@ -7682,6 +7685,7 @@ STR16 szBackgroundText_Value[]= L" %s%d%% effectiveness to recruit approach\n", L" %s%d%% chance of success with door breaching charges\n", + L" %s%d%% cth with firearms against creatures\n", }; #endif //CHINESE diff --git a/Utils/_DutchText.cpp b/Utils/_DutchText.cpp index 6d3e84cd..70273bee 100644 --- a/Utils/_DutchText.cpp +++ b/Utils/_DutchText.cpp @@ -7613,6 +7613,8 @@ STR16 szBackgroundText_Flags[]= L" +1 traplevel to planted bombs\n", L" spreads corruption to nearby mercs\n", + L" female only", // won't show up, text exists for compatibility reasons + L" male only", // won't show up, text exists for compatibility reasons }; // TODO.Translate @@ -7635,6 +7637,7 @@ STR16 szBackgroundText_Value[]= L" %s%d%% mechanical stat\n", L" %s%d%% explosives stat\n", L" %s%d%% medical stat\n", + L" %s%d%% wisdom stat\n", L" %s%d%% APs on rooftops\n", L" %s%d%% APs needed to swim\n", @@ -7681,6 +7684,7 @@ STR16 szBackgroundText_Value[]= L" %s%d%% effectiveness to recruit approach\n", L" %s%d%% chance of success with door breaching charges\n", + L" %s%d%% cth with firearms against creatures\n", }; #endif //DUTCH diff --git a/Utils/_EnglishText.cpp b/Utils/_EnglishText.cpp index f951c3e4..3e0277da 100644 --- a/Utils/_EnglishText.cpp +++ b/Utils/_EnglishText.cpp @@ -7598,6 +7598,8 @@ STR16 szBackgroundText_Flags[]= L" +1 traplevel to planted bombs\n", L" spreads corruption to nearby mercs\n", + L" female only", // won't show up, text exists for compatibility reasons + L" male only", // won't show up, text exists for compatibility reasons }; STR16 szBackgroundText_Value[]= @@ -7619,6 +7621,7 @@ STR16 szBackgroundText_Value[]= L" %s%d%% mechanical stat\n", L" %s%d%% explosives stat\n", L" %s%d%% medical stat\n", + L" %s%d%% wisdom stat\n", L" %s%d%% APs on rooftops\n", L" %s%d%% APs needed to swim\n", @@ -7665,6 +7668,7 @@ STR16 szBackgroundText_Value[]= L" %s%d%% effectiveness to recruit approach\n", L" %s%d%% chance of success with door breaching charges\n", + L" %s%d%% cth with firearms against creatures\n", }; #endif //ENGLISH diff --git a/Utils/_FrenchText.cpp b/Utils/_FrenchText.cpp index 044fa6cb..da369dad 100644 --- a/Utils/_FrenchText.cpp +++ b/Utils/_FrenchText.cpp @@ -7597,6 +7597,8 @@ STR16 szBackgroundText_Flags[]= L" +1 traplevel to planted bombs\n", L" spreads corruption to nearby mercs\n", + L" female only", // won't show up, text exists for compatibility reasons + L" male only", // won't show up, text exists for compatibility reasons }; // TODO.Translate @@ -7619,6 +7621,7 @@ STR16 szBackgroundText_Value[]= L" %s%d%% mechanical stat\n", L" %s%d%% explosives stat\n", L" %s%d%% medical stat\n", + L" %s%d%% wisdom stat\n", L" %s%d%% APs on rooftops\n", L" %s%d%% APs needed to swim\n", @@ -7665,6 +7668,7 @@ STR16 szBackgroundText_Value[]= L" %s%d%% effectiveness to recruit approach\n", L" %s%d%% chance of success with door breaching charges\n", + L" %s%d%% cth with firearms against creatures\n", }; #endif //FRENCH diff --git a/Utils/_GermanText.cpp b/Utils/_GermanText.cpp index c34e9e22..c3839b5c 100644 --- a/Utils/_GermanText.cpp +++ b/Utils/_GermanText.cpp @@ -7422,6 +7422,8 @@ STR16 szBackgroundText_Flags[]= L" +1 traplevel to planted bombs\n", L" spreads corruption to nearby mercs\n", + L" female only", // won't show up, text exists for compatibility reasons + L" male only", // won't show up, text exists for compatibility reasons }; // TODO.Translate @@ -7444,6 +7446,7 @@ STR16 szBackgroundText_Value[]= L" %s%d%% mechanical stat\n", L" %s%d%% explosives stat\n", L" %s%d%% medical stat\n", + L" %s%d%% wisdom stat\n", L" %s%d%% APs on rooftops\n", L" %s%d%% APs needed to swim\n", @@ -7490,6 +7493,7 @@ STR16 szBackgroundText_Value[]= L" %s%d%% effectiveness to recruit approach\n", L" %s%d%% chance of success with door breaching charges\n", + L" %s%d%% cth with firearms against creatures\n", }; #endif //GERMAN diff --git a/Utils/_ItalianText.cpp b/Utils/_ItalianText.cpp index 596ba362..b07b1437 100644 --- a/Utils/_ItalianText.cpp +++ b/Utils/_ItalianText.cpp @@ -7600,8 +7600,11 @@ STR16 szBackgroundText_Flags[]= L" +1 traplevel to planted bombs\n", L" spreads corruption to nearby mercs\n", + L" female only", // won't show up, text exists for compatibility reasons + L" male only", // won't show up, text exists for compatibility reasons }; +// TODO.Translate STR16 szBackgroundText_Value[]= { L" %s%d%% APs in polar sectors\n", @@ -7621,6 +7624,7 @@ STR16 szBackgroundText_Value[]= L" %s%d%% mechanical stat\n", L" %s%d%% explosives stat\n", L" %s%d%% medical stat\n", + L" %s%d%% wisdom stat\n", L" %s%d%% APs on rooftops\n", L" %s%d%% APs needed to swim\n", @@ -7667,6 +7671,7 @@ STR16 szBackgroundText_Value[]= L" %s%d%% effectiveness to recruit approach\n", L" %s%d%% chance of success with door breaching charges\n", + L" %s%d%% cth with firearms against creatures\n", }; #endif //ITALIAN diff --git a/Utils/_PolishText.cpp b/Utils/_PolishText.cpp index 0216702a..c4ad4d94 100644 --- a/Utils/_PolishText.cpp +++ b/Utils/_PolishText.cpp @@ -7619,6 +7619,8 @@ STR16 szBackgroundText_Flags[]= L" +1 traplevel to planted bombs\n", L" spreads corruption to nearby mercs\n", + L" female only", // won't show up, text exists for compatibility reasons + L" male only", // won't show up, text exists for compatibility reasons }; // TODO.Translate @@ -7641,6 +7643,7 @@ STR16 szBackgroundText_Value[]= L" %s%d%% mechanical stat\n", L" %s%d%% explosives stat\n", L" %s%d%% medical stat\n", + L" %s%d%% wisdom stat\n", L" %s%d%% APs on rooftops\n", L" %s%d%% APs needed to swim\n", @@ -7687,6 +7690,7 @@ STR16 szBackgroundText_Value[]= L" %s%d%% effectiveness to recruit approach\n", L" %s%d%% chance of success with door breaching charges\n", + L" %s%d%% cth with firearms against creatures\n", }; #endif //POLISH diff --git a/Utils/_RussianText.cpp b/Utils/_RussianText.cpp index ab0329dd..52f2df4a 100644 --- a/Utils/_RussianText.cpp +++ b/Utils/_RussianText.cpp @@ -7599,6 +7599,8 @@ STR16 szBackgroundText_Flags[]= L" +1 traplevel to planted bombs\n", L" spreads corruption to nearby mercs\n", + L" female only", // won't show up, text exists for compatibility reasons + L" male only", // won't show up, text exists for compatibility reasons }; // TODO.Translate @@ -7621,6 +7623,7 @@ STR16 szBackgroundText_Value[]= L" %s%d%% mechanical stat\n", L" %s%d%% explosives stat\n", L" %s%d%% medical stat\n", + L" %s%d%% wisdom stat\n", L" %s%d%% APs on rooftops\n", L" %s%d%% APs needed to swim\n", @@ -7667,6 +7670,7 @@ STR16 szBackgroundText_Value[]= L" %s%d%% effectiveness to recruit approach\n", L" %s%d%% chance of success with door breaching charges\n", + L" %s%d%% cth with firearms against creatures\n", }; #endif //RUSSIAN diff --git a/Utils/_TaiwaneseText.cpp b/Utils/_TaiwaneseText.cpp index cce6dd3e..3e1f6c59 100644 --- a/Utils/_TaiwaneseText.cpp +++ b/Utils/_TaiwaneseText.cpp @@ -7617,6 +7617,8 @@ STR16 szBackgroundText_Flags[]= L" +1 traplevel to planted bombs\n", L" spreads corruption to nearby mercs\n", + L" female only", // won't show up, text exists for compatibility reasons + L" male only", // won't show up, text exists for compatibility reasons }; // TODO.Translate @@ -7639,6 +7641,7 @@ STR16 szBackgroundText_Value[]= L" %s%d%% mechanical stat\n", L" %s%d%% explosives stat\n", L" %s%d%% medical stat\n", + L" %s%d%% wisdom stat\n", L" %s%d%% APs on rooftops\n", L" %s%d%% APs needed to swim\n", @@ -7685,6 +7688,7 @@ STR16 szBackgroundText_Value[]= L" %s%d%% effectiveness to recruit approach\n", L" %s%d%% chance of success with door breaching charges\n", + L" %s%d%% cth with firearms against creatures\n", }; #endif //TAIWANESE