From 48178ea56f8ed72c1b027ed23ca285dcdd3caca1 Mon Sep 17 00:00:00 2001 From: Flugente Date: Sat, 4 Jul 2015 20:27:29 +0000 Subject: [PATCH] - Fix: CHANCE_SAY_ANNOYING_PHRASE wasn't used in english when spotting enemies - removed obsolete drug code - if health is changed by drugs, display that via damage floater git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7899 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Drugs And Alcohol.cpp | 585 ++------------------------------- Tactical/Drugs And Alcohol.h | 110 ------- Tactical/Weapons.h | 2 +- Tactical/opplist.cpp | 27 +- 4 files changed, 29 insertions(+), 695 deletions(-) diff --git a/Tactical/Drugs And Alcohol.cpp b/Tactical/Drugs And Alcohol.cpp index e8489e94..ab1e5a0d 100644 --- a/Tactical/Drugs And Alcohol.cpp +++ b/Tactical/Drugs And Alcohol.cpp @@ -21,7 +21,18 @@ //forward declarations of common classes to eliminate includes class OBJECTTYPE; -class SOLDIERTYPE; + +INT32 giDrunkModifier[] = +{ + 100, // Sober + 75, // Feeling good, + 65, // Bporderline + 50, // Drunk + 100, // HungOver +}; + +#define HANGOVER_AP_REDUCE 5 +#define HANGOVER_BP_REDUCE 200 BOOLEAN ApplyDrugs_New( SOLDIERTYPE *pSoldier, UINT16 usItem, UINT16 uStatusUsed ) { @@ -200,6 +211,9 @@ void HandleEndTurnDrugAdjustments_New( SOLDIERTYPE *pSoldier ) // some effects are handled here if ( pSoldier->newdrugs.size[DRUG_EFFECT_HP] ) { + // note the current hp + INT8 oldlife = pSoldier->stats.bLife; + // increase life pSoldier->stats.bLife = __min( pSoldier->stats.bLife + pSoldier->newdrugs.size[DRUG_EFFECT_HP], pSoldier->stats.bLifeMax ); @@ -219,6 +233,10 @@ void HandleEndTurnDrugAdjustments_New( SOLDIERTYPE *pSoldier ) // got to reduce amount of bleeding pSoldier->bBleeding = (pSoldier->stats.bLifeMax - pSoldier->stats.bLife); } + + // display health change next time we are in tactical + pSoldier->flags.fDisplayDamage = TRUE; + pSoldier->sDamage -= pSoldier->stats.bLife - oldlife; } pSoldier->bExtraStrength += pSoldier->newdrugs.size[DRUG_EFFECT_STR]; @@ -317,494 +335,6 @@ BOOLEAN DoesMercHavePersonality( SOLDIERTYPE *pSoldier, UINT8 aVal ) return FALSE; } -//------------------------------------------------------- - -/*UINT8 ubDrugTravelRate[] = { 4, 2 }; -UINT8 ubDrugWearoffRate[] = { 2, 2 }; -UINT8 ubDrugEffect[] = { 15, 8 }; -UINT8 ubDrugSideEffect[] = { 20, 10 }; -UINT8 ubDrugSideEffectRate[] = { 2, 1 };*/ - -INT32 giDrunkModifier[] = -{ - 100, // Sober - 75, // Feeling good, - 65, // Bporderline - 50, // Drunk - 100, // HungOver -}; - -#define HANGOVER_AP_REDUCE 5 -#define HANGOVER_BP_REDUCE 200 - - -/*BOOLEAN ApplyDrugs( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObject ) -{ - UINT32 ubDrugType; - INT8 bRegenPointsGained; - UINT16 usItem; - - usItem = pObject->usItem; - - // Determine what type of drug.... - ubDrugType = Item[usItem].drugtype; - - // If not a drug, return - if ( ubDrugType == 0 ) - { - return( FALSE ); - } - - // do switch for Larry!! - if ( pSoldier->ubProfile == LARRY_NORMAL ) - { - pSoldier = SwapLarrysProfiles( pSoldier ); - } - else if ( pSoldier->ubProfile == LARRY_DRUNK ) - { - gMercProfiles[ LARRY_DRUNK ].bNPCData = 0; - } - - BOOLEAN consumeitem = TRUE; - // if item is also a food item, don't use it up here, it will be consumed in ApplyFood, which will be called afterwards - UINT32 foodtype = Item[pObject->usItem].foodtype; - - // if not a food item, nothing to see here - if ( gGameOptions.fFoodSystem && foodtype > 0 ) - consumeitem = FALSE; - - // Flugente: we have to check for every single type of drug ( a drug applied may consist of several 'pure' drug types) - for (UINT8 i = DRUG_TYPE_ADRENALINE; i < DRUG_TYPE_MAX; ++i) - { - UINT32 drugtestflag = (1 << i); // comparing with this flag will determine the drug - - // we do not actually test for DRUG_REGENERATION, because that is checked afterwards separately - if ( (drugtestflag & DRUG_REGENERATION ) != 0 ) - continue; - - if ( (ubDrugType & drugtestflag) != 0 ) - { - // Add effects - pSoldier->AddDrugValues( i, Drug[i].ubDrugEffect, Drug[i].ubDrugTravelRate, Drug[i].ubDrugSideEffect ); - - // ATE: Make guy collapse from heart attack if too much stuff taken.... - if ( pSoldier->drugs.bDrugSideEffectRate[ i ] > ( Drug[i].ubDrugSideEffect * 3 ) ) - { - // Keel over... - DeductPoints( pSoldier, 0, 10000 ); - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // SANDRO - if our stat is damaged through facility event, make it healable - // Permanently lower certain stats... - if ( gGameOptions.fNewTraitSystem ) - { - // WISDOM decrease - if ( pSoldier->stats.bWisdom > 5 ) - { - pSoldier->ubCriticalStatDamage[ DAMAGED_STAT_WISDOM ] += 5; - pSoldier->stats.bWisdom -= 5; - } - else - { - pSoldier->ubCriticalStatDamage[ DAMAGED_STAT_WISDOM ] += (pSoldier->stats.bWisdom - 1); - pSoldier->stats.bWisdom = 1; - } - // DEXTERITY decrease - if ( pSoldier->stats.bDexterity > 5 ) - { - pSoldier->ubCriticalStatDamage[ DAMAGED_STAT_DEXTERITY ] += 5; - pSoldier->stats.bDexterity -= 5; - } - else - { - pSoldier->ubCriticalStatDamage[ DAMAGED_STAT_DEXTERITY ] += (pSoldier->stats.bDexterity - 1); - pSoldier->stats.bDexterity = 1; - } - // STRENGTH decrease - if ( pSoldier->stats.bStrength > 5 ) - { - pSoldier->ubCriticalStatDamage[ DAMAGED_STAT_STRENGTH ] += 5; - pSoldier->stats.bStrength -= 5; - } - else - { - pSoldier->ubCriticalStatDamage[ DAMAGED_STAT_STRENGTH ] += (pSoldier->stats.bStrength - 1); - pSoldier->stats.bStrength = 1; - } - // AGILITY decrease - if ( pSoldier->stats.bAgility > 5 ) - { - pSoldier->ubCriticalStatDamage[ DAMAGED_STAT_AGILITY ] += 5; - pSoldier->stats.bAgility -= 5; - } - else - { - pSoldier->ubCriticalStatDamage[ DAMAGED_STAT_AGILITY ] += (pSoldier->stats.bAgility - 1); - pSoldier->stats.bAgility = 1; - } - } - else // old system - { - pSoldier->stats.bAgility = __max(1, pSoldier->stats.bWisdom-5); - pSoldier->stats.bDexterity = __max(1, pSoldier->stats.bDexterity-5); - pSoldier->stats.bStrength = __max(1, pSoldier->stats.bStrength-5); - pSoldier->stats.bAgility = __max(1, pSoldier->stats.bAgility-5); - - // make those stats RED for a while... - // SANDRO - we don't need to do this with new system, as we simply show all damaged stats in red until healed - pSoldier->timeChanges.uiChangeWisdomTime = GetJA2Clock(); - pSoldier->usValueGoneUp &= ~( WIS_INCREASE ); - pSoldier->timeChanges.uiChangeDexterityTime = GetJA2Clock(); - pSoldier->usValueGoneUp &= ~( DEX_INCREASE ); - pSoldier->timeChanges.uiChangeStrengthTime = GetJA2Clock(); - pSoldier->usValueGoneUp &= ~( STRENGTH_INCREASE ); - pSoldier->timeChanges.uiChangeAgilityTime = GetJA2Clock(); - pSoldier->usValueGoneUp &= ~( AGIL_INCREASE ); - } - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - // export stat changes to profile - gMercProfiles[ pSoldier->ubProfile ].bWisdom = pSoldier->stats.bWisdom; - gMercProfiles[ pSoldier->ubProfile ].bDexterity = pSoldier->stats.bDexterity; - gMercProfiles[ pSoldier->ubProfile ].bStrength = pSoldier->stats.bStrength; - gMercProfiles[ pSoldier->ubProfile ].bAgility = pSoldier->stats.bAgility; - - // SANDRO - merc records - stat damaged - gMercProfiles[ pSoldier->ubProfile ].records.usTimesStatDamaged++; - } - - // Flugente: if this can cure a disease, do so - if ( Drug[i].ubDiseaseCure > 0 ) - { - // we cure exactly enough to cure an outbreak - // Drug[i].ubDiseaseCure - 1 - the xml value is simply one higher than the disease type, otherwise we couldn't identify disease 0 - pSoldier->AddDiseasePoints( Drug[i].ubDiseaseCure - 1, -Disease[Drug[i].ubDiseaseCure - 1].sInfectionPtsOutbreak ); - } - } - } - - if ( (ubDrugType & DRUG_REGENERATION) != 0 ) - { - // each use of a regen booster over 1, each day, reduces the effect - bRegenPointsGained = REGEN_POINTS_PER_BOOSTER * (*pObject)[0]->data.objectStatus / 100; - // are there fractional %s left over? - if ( ( (*pObject)[0]->data.objectStatus % (100 / REGEN_POINTS_PER_BOOSTER ) ) != 0 ) - { - // chance of an extra point - if ( PreRandom( 100 / REGEN_POINTS_PER_BOOSTER ) < (UINT32) ( (*pObject)[0]->data.objectStatus % (100 / REGEN_POINTS_PER_BOOSTER ) ) ) - { - ++bRegenPointsGained; - } - } - - bRegenPointsGained -= pSoldier->bRegenBoostersUsedToday; - if (bRegenPointsGained > 0) - { - // can't go above the points you get for a full boost - pSoldier->bRegenerationCounter = __min( pSoldier->bRegenerationCounter + bRegenPointsGained, REGEN_POINTS_PER_BOOSTER ); - } - pSoldier->bRegenBoostersUsedToday++; - - // set flag: we are on drugs - pSoldier->usSoldierFlagMask |= SOLDIER_DRUGGED; - } - - // increase drug counter if not alcoholic drug - if ( usItem != ALCOHOL && usItem != WINE && usItem != BEER ) - { - if ( gMercProfiles[ pSoldier->ubProfile ].ubNumTimesDrugUseInLifetime != 255 ) - { - gMercProfiles[ pSoldier->ubProfile ].ubNumTimesDrugUseInLifetime++; - } - } - - // ATE: use kit points... - if ( consumeitem ) - { - if ( usItem == ALCOHOL ) - UseKitPoints( pObject, 10, pSoldier ); - else if ( usItem == WINE ) - UseKitPoints( pObject, 20, pSoldier ); - else if ( usItem == BEER ) - UseKitPoints( pObject, 100, pSoldier ); - else - { - UINT16 ptsused = (*pObject)[0]->data.objectStatus; - - gCampaignStats.AddConsumption(CAMPAIGN_CONSUMED_MEDICAL, (FLOAT)(ptsused * Item[usItem].ubWeight / 100.0) ); - - // remove object - pObject->RemoveObjectsFromStack(1); - } - } - - if ( (ubDrugType & DRUG_ALCOHOL) ) - { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[ MSG_DRANK_SOME ], pSoldier->GetName(), ShortItemNames[ usItem ] ); - - // Flugente: dynamic opinions - HandleDynamicOpinionTeamDrinking( pSoldier ); - } - else - { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[ MSG_MERC_TOOK_DRUG ], pSoldier->GetName() ); - } - - // Dirty panel - fInterfacePanelDirty = DIRTYLEVEL2; - - if ( !consumeitem ) - ApplyFood( pSoldier, pObject, TRUE, TRUE ); - - return( TRUE ); -}*/ - -/*void HandleEndTurnDrugAdjustments( SOLDIERTYPE *pSoldier ) -{ - INT32 cnt, cnt2; - INT32 iNumLoops; - - // if were not on drugs, nothing to do here - if ( ( pSoldier->usSoldierFlagMask & SOLDIER_DRUGGED ) == 0 ) - return; - - // We test for every 'pure' drug separately - for (cnt = DRUG_TYPE_ADRENALINE; cnt < DRUG_TYPE_MAX; ++cnt) - { - // omit DRUG_TYPE_REGENERATION, because that is checked afterwards separately - if ( cnt == DRUG_TYPE_REGENERATION ) - continue; - - // If side effect aret is non-zero.... - if ( pSoldier->drugs.bDrugSideEffectRate[ cnt ] > 0 ) - { - // Subtract some... - pSoldier->drugs.bDrugSideEffect[ cnt ] -= pSoldier->drugs.bDrugSideEffectRate[ cnt ]; - - // If we're done, we're done! - if ( pSoldier->drugs.bDrugSideEffect[ cnt ] <= 0 ) - { - pSoldier->drugs.bDrugSideEffect[ cnt ] = 0; - pSoldier->drugs.bDrugSideEffectRate[ cnt ] = 0; - fInterfacePanelDirty = DIRTYLEVEL1; - } - } - - // IF drug rate is -ve, it's being worn off... - if ( pSoldier->drugs.bDrugEffectRate[ cnt ] < 0 ) - { - pSoldier->drugs.bDrugEffect[ cnt ] -= ( -1 * pSoldier->drugs.bDrugEffectRate[ cnt ] ); - - // Have we run out? - if ( pSoldier->drugs.bDrugEffect[ cnt ] <= 0 ) - { - pSoldier->drugs.bDrugEffect[ cnt ] = 0; - - // Dirty panel - fInterfacePanelDirty = DIRTYLEVEL2; - - // Start the bad news! - pSoldier->drugs.bDrugSideEffectRate[ cnt ] = Drug[cnt].ubDrugSideEffectRate; - - // The drug rate is 0 now too - pSoldier->drugs.bDrugEffectRate[ cnt ] = 0; - - // morale downer only if side effect exists and this effect is allowed for a drug - if ( Drug[cnt].ubDrugSideEffect > 0 && Drug[cnt].ubMoralBacklash > 0 ) - { - // Once for each 'level' of crash.... - iNumLoops = ( pSoldier->drugs.bDrugSideEffect[ cnt ] / Drug[cnt].ubDrugSideEffect ) + 1; - - for ( cnt2 = 0; cnt2 < iNumLoops; ++cnt2 ) - { - // OK, give a much BIGGER morale downer - if ( cnt == DRUG_TYPE_ALCOHOL ) - { - HandleMoraleEvent( pSoldier, MORALE_ALCOHOL_CRASH, pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ); - } - else - { - HandleMoraleEvent( pSoldier, MORALE_DRUGS_CRASH, pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ); - } - } - } - } - } - - // Add increase ineffect.... - if ( pSoldier->drugs.bDrugEffectRate[ cnt ] > 0 ) - { - // Seap some in.... - pSoldier->drugs.bFutureDrugEffect[ cnt ] -= pSoldier->drugs.bDrugEffectRate[ cnt ]; - pSoldier->drugs.bDrugEffect[ cnt ] += pSoldier->drugs.bDrugEffectRate[ cnt ]; - - // Refresh morale w/ new drug value... - RefreshSoldierMorale( pSoldier ); - - // Check if we need to stop 'adding' - if ( pSoldier->drugs.bFutureDrugEffect[ cnt ] <= 0 ) - { - pSoldier->drugs.bFutureDrugEffect[ cnt ] = 0; - // Change rate to -ve.. - pSoldier->drugs.bDrugEffectRate[ cnt ] = -Drug[cnt].ubDrugWearoffRate; - } - } - } - - if ( pSoldier->bRegenerationCounter > 0) - { - // increase life - pSoldier->stats.bLife = __min( pSoldier->stats.bLife + LIFE_GAIN_PER_REGEN_POINT, pSoldier->stats.bLifeMax ); - - //SANDRO - Insta-healable injury reduction - if( pSoldier->iHealableInjury > 0 ) - { - pSoldier->iHealableInjury = max(0, (pSoldier->iHealableInjury - (100 * LIFE_GAIN_PER_REGEN_POINT))); - } - - if ( pSoldier->stats.bLife == pSoldier->stats.bLifeMax ) - { - pSoldier->bBleeding = 0; - pSoldier->iHealableInjury = 0; - } - else if ( pSoldier->bBleeding + pSoldier->stats.bLife > pSoldier->stats.bLifeMax ) - { - // got to reduce amount of bleeding - pSoldier->bBleeding = (pSoldier->stats.bLifeMax - pSoldier->stats.bLife); - } - - // decrement counter - pSoldier->bRegenerationCounter--; - } - - // Flugente: always do the following checks. Thereby, if the effect runs out, our stats will be back to normal - //////////////// STRENGTH //////////////// - pSoldier->bExtraStrength = pSoldier->drugs.bDrugEffect[ DRUG_TYPE_STRENGTH ] - pSoldier->drugs.bDrugSideEffect[ DRUG_TYPE_STRENGTH ]; - - //////////////// DEXTERITY //////////////// - pSoldier->bExtraDexterity = pSoldier->drugs.bDrugEffect[ DRUG_TYPE_DEXTERITY ] - pSoldier->drugs.bDrugSideEffect[ DRUG_TYPE_DEXTERITY ]; - - //////////////// AGILITY //////////////// - pSoldier->bExtraAgility = pSoldier->drugs.bDrugEffect[ DRUG_TYPE_AGILITY ] - pSoldier->drugs.bDrugSideEffect[ DRUG_TYPE_AGILITY ]; - - //////////////// WISDOM //////////////// - pSoldier->bExtraWisdom = pSoldier->drugs.bDrugEffect[ DRUG_TYPE_WISDOM ] - pSoldier->drugs.bDrugSideEffect[ DRUG_TYPE_WISDOM ]; - - // if our sideeffect count is 1 (which should occur a while AFTER we took the drug), we suddenly become blind for a few turns... - if ( pSoldier->drugs.bDrugEffect[ DRUG_TYPE_BLIND ] == 0 && pSoldier->drugs.bDrugSideEffect[ DRUG_TYPE_BLIND ] == 1 ) - { - pSoldier->bBlindedCounter = 3; - } - - // if our sideeffect count is 1 (which should occur a while AFTER we took the drug), we get a heart-attack and get knocked out... - if ( pSoldier->drugs.bDrugEffect[ DRUG_TYPE_KNOCKOUT ] == 0 && pSoldier->drugs.bDrugSideEffect[ DRUG_TYPE_KNOCKOUT ] == 1 ) - { - // Keel over... - DeductPoints( pSoldier, 0, 20000 ); - } - - // if we have a life damaging effect, deduct life points - if ( pSoldier->drugs.bDrugEffect[ DRUG_TYPE_LIFEDAMAGE ] == 0 && pSoldier->drugs.bDrugSideEffect[ DRUG_TYPE_LIFEDAMAGE ] > 0 ) - { - pSoldier->EVENT_SoldierGotHit( 0, 10, 0, pSoldier->ubDirection, 320, NOBODY , FIRE_WEAPON_NO_SPECIAL, pSoldier->bAimShotLocation, 0, -1 ); - } - - // etorphine stuns while it lasts. It can also damage and possibly kill the target if overdosed. The dosage depends on our bodytype - if ( pSoldier->drugs.bDrugEffect[ DRUG_TYPE_STUNANDKILL ] ) - { - // Keel over... - DeductPoints( pSoldier, 0, 20000 ); - - UINT8 bodyweight = 10; - switch ( pSoldier->ubBodyType ) - { - case REGMALE: - case MANCIV: - bodyweight = 10; - break; - - case BIGMALE: - case STOCKYMALE: - bodyweight = 12; - break; - - case REGFEMALE: - bodyweight = 9; - break; - - case ADULTFEMALEMONSTER: - case AM_MONSTER: - bodyweight = 30; - break; - - case YAF_MONSTER: - case YAM_MONSTER: - bodyweight = 20; - break; - - case LARVAE_MONSTER: - bodyweight = 4; - break; - - case INFANT_MONSTER: - bodyweight = 10; - break; - - case QUEENMONSTER: - bodyweight = 100; - break; - - case FATCIV: - case MINICIV: - case DRESSCIV: - bodyweight = 8; - break; - - case HATKIDCIV: - case KIDCIV: - bodyweight = 4; - break; - - case CRIPPLECIV: - bodyweight = 7; - break; - - case COW: - bodyweight = 20; - break; - - case CROW: - bodyweight = 1; - break; - - case BLOODCAT: - bodyweight = 20; - break; - - case ROBOTNOWEAPON: - case HUMVEE: - case TANK_NW: - case TANK_NE: - case ELDORADO: - case ICECREAMTRUCK: - case JEEP: - // this should not happen anyway... - bodyweight = 100; - break; - } - - if ( pSoldier->drugs.bDrugEffect[ DRUG_TYPE_STUNANDKILL ] > bodyweight ) - { - if ( Chance( 10 * (pSoldier->drugs.bDrugEffect[ DRUG_TYPE_STUNANDKILL ] - bodyweight) ) ) - pSoldier->EVENT_SoldierGotHit( 0, 400, 0, pSoldier->ubDirection, 320, NOBODY , FIRE_WEAPON_NO_SPECIAL, pSoldier->bAimShotLocation, 0, -1 ); - } - } - - // if all drug effects have ended, delete flag - if ( !MercUnderTheInfluence(pSoldier) ) - pSoldier->usSoldierFlagMask &= ~SOLDIER_DRUGGED; -}*/ - void HandleAPEffectDueToDrugs( SOLDIERTYPE *pSoldier, INT16 *pubPoints ) { *pubPoints += pSoldier->newdrugs.size[DRUG_EFFECT_AP]; @@ -832,69 +362,11 @@ void HandleBPEffectDueToDrugs( SOLDIERTYPE *pSoldier, INT16 *psPointReduction ) } } -/*void HandleDamageResistanceEffectDueToDrugs( SOLDIERTYPE *pSoldier, INT32 *psPointReduction ) -{ - // Are we in a side effect or good effect? - if ( pSoldier->drugs.bDrugEffect[ DRUG_TYPE_RESISTANCE ] ) - { - // Adjust! - (*psPointReduction) += pSoldier->drugs.bDrugEffect[ DRUG_TYPE_RESISTANCE ]; - } - else if ( pSoldier->drugs.bDrugSideEffect[ DRUG_TYPE_RESISTANCE ] ) - { - // Adjust! - (*psPointReduction) -= pSoldier->drugs.bDrugSideEffect[ DRUG_TYPE_RESISTANCE ]; - } -}*/ - -/*INT8 GetDrunkLevel( SOLDIERTYPE *pSoldier ) -{ - INT8 bNumDrinks; - - // If we have a -ve effect ... - if ( pSoldier->drugs.bDrugEffect[ DRUG_TYPE_ALCOHOL ] == 0 && pSoldier->drugs.bDrugSideEffect[ DRUG_TYPE_ALCOHOL ] == 0 ) - { - return( SOBER ); - } - - if ( pSoldier->drugs.bDrugEffect[ DRUG_TYPE_ALCOHOL ] == 0 && pSoldier->drugs.bDrugSideEffect[ DRUG_TYPE_ALCOHOL ] != 0 ) - { - return( HUNGOVER ); - } - - // Calculate how many dinks we have had.... - bNumDrinks = ( pSoldier->drugs.bDrugEffect[ DRUG_TYPE_ALCOHOL ] / Drug[DRUG_TYPE_ALCOHOL].ubDrugEffect ); - - if ( bNumDrinks <= 3 ) - { - return( FEELING_GOOD ); - } - else if ( bNumDrinks <= 4 ) - { - return( BORDERLINE ); - } - else - { - return( DRUNK ); - } -}*/ - INT32 EffectStatForBeingDrunk( SOLDIERTYPE *pSoldier, INT32 iStat ) { return( ( iStat * giDrunkModifier[ GetDrunkLevel( pSoldier ) ] / 100 ) ); } -/*BOOLEAN MercUnderTheInfluence( SOLDIERTYPE *pSoldier ) -{ - for (UINT8 cnt = DRUG_TYPE_ADRENALINE; cnt < DRUG_TYPE_MAX; ++cnt) - { - if ( MercUnderTheInfluence(pSoldier, cnt) ) - return TRUE; - } - - return( FALSE ); -}*/ - BOOLEAN MercDruggedOrDrunk( SOLDIERTYPE *pSoldier ) { if ( pSoldier->newdrugs.drinkstaken ) @@ -906,25 +378,6 @@ BOOLEAN MercDruggedOrDrunk( SOLDIERTYPE *pSoldier ) return FALSE; } -/*BOOLEAN MercUnderTheInfluence( SOLDIERTYPE *pSoldier, UINT8 aDrugType ) -{ - // in case of wrong inout, stay safe - if ( aDrugType >= DRUG_TYPE_MAX ) - return( FALSE ); - - // Are we in a side effect or good effect? - if ( pSoldier->drugs.bDrugEffect[ aDrugType ] ) - return( TRUE ); - - if ( pSoldier->drugs.bDrugSideEffect[ aDrugType ] ) - return( TRUE ); - - if ( pSoldier->bRegenerationCounter > 0) - return( TRUE ); - - return( FALSE ); -}*/ - BOOLEAN MercDrugged( SOLDIERTYPE *pSoldier ) { return (pSoldier->usSoldierFlagMask & SOLDIER_DRUGGED); diff --git a/Tactical/Drugs And Alcohol.h b/Tactical/Drugs And Alcohol.h index b30ce916..3a24b93d 100644 --- a/Tactical/Drugs And Alcohol.h +++ b/Tactical/Drugs And Alcohol.h @@ -5,21 +5,7 @@ class DRUG_EFFECT { - /*bool operator==(const DRUG_EFFECT& other) - { - return ( effect == other.effect && - duration == other.duration && - size == other.size && - chance == other.chance); - } - - bool operator!=(const DRUG_EFFECT& other) - { - return !(*this == other); - }*/ - public: - UINT8 effect; UINT16 duration; INT16 size; @@ -82,108 +68,12 @@ INT8 GetDrunkLevel( SOLDIERTYPE *pSoldier ); BOOLEAN DoesMercHaveDisability( SOLDIERTYPE *pSoldier, UINT8 aVal ); BOOLEAN DoesMercHavePersonality( SOLDIERTYPE *pSoldier, UINT8 aVal ); -//---------------------------------------------------------------------------------------- - -/*#define SOBER 0 -#define FEELING_GOOD 1 -#define BORDERLINE 2 -#define DRUNK 3 -#define HUNGOVER 4 */ - -//#define REGEN_POINTS_PER_BOOSTER 4 -//#define LIFE_GAIN_PER_REGEN_POINT 10 - -//extern UINT8 gbPlayerNum; - -/*enum { - DRUG_TYPE_ADRENALINE = 0, - DRUG_TYPE_ALCOHOL, - DRUG_TYPE_REGENERATION, - DRUG_TYPE_RESISTANCE, - DRUG_TYPE_STRENGTH, - DRUG_TYPE_AGILITY, // 5 - DRUG_TYPE_DEXTERITY, - DRUG_TYPE_WISDOM, - DRUG_TYPE_PERCEPTION, - DRUG_TYPE_PSYCHO, - DRUG_TYPE_NERVOUS, // 10 - DRUG_TYPE_CLAUSTROPHOBIC, - DRUG_TYPE_HEATINTOLERANT, - DRUG_TYPE_FEAROFINSECTS, - DRUG_TYPE_FORGETFUL, - DRUG_TYPE_BLIND, // 15 - DRUG_TYPE_KNOCKOUT, - DRUG_TYPE_VISION, - DRUG_TYPE_TUNNELVISION, - DRUG_TYPE_LIFEDAMAGE, - DRUG_TYPE_CUREPOISON, // 20 // not used anymore! - DRUG_TYPE_STUNANDKILL, -}; - -// Flugente, 12-04-21 -// These flags determine the different types of 'pure' drugs that we have. Each one has specific effects and sideeffects -// Note that a consumable can be a combination of several different drugs -#define DRUG_ADRENALINE (1 << DRUG_TYPE_ADRENALINE) //0x00000001 //1 -#define DRUG_ALCOHOL (1 << DRUG_TYPE_ALCOHOL) //0x00000002 //2 -#define DRUG_REGENERATION (1 << DRUG_TYPE_REGENERATION) //0x00000004 //4 -#define DRUG_DAMAGERESISTANCE (1 << DRUG_TYPE_RESISTANCE) //0x00000008 //8 -#define DRUG_STRENGTH (1 << DRUG_TYPE_STRENGTH) //0x00000010 //16 -#define DRUG_AGILITY (1 << DRUG_TYPE_AGILITY) //0x00000020 //32 -#define DRUG_DEXTERITY (1 << DRUG_TYPE_DEXTERITY) //0x00000040 //64 -#define DRUG_WISDOM (1 << DRUG_TYPE_WISDOM) //0x00000080 //128 -#define DRUG_PERCEPTION (1 << DRUG_TYPE_PERCEPTION) //0x00000100 //256 -#define DRUG_PSYCHO (1 << DRUG_TYPE_PSYCHO) //0x00000200 //512 -#define DRUG_NERVOUS (1 << DRUG_TYPE_NERVOUS) //0x00000400 //1024 -#define DRUG_CLAUSTROPHOBIC (1 << DRUG_TYPE_CLAUSTROPHOBIC) //0x00000800 //2048 -#define DRUG_HEATINTOLERANT (1 << DRUG_TYPE_HEATINTOLERANT) //0x00001000 //4096 -#define DRUG_FEAROFINSECTS (1 << DRUG_TYPE_FEAROFINSECTS) //0x00002000 //8192 -#define DRUG_FORGETFUL (1 << DRUG_TYPE_FORGETFUL) //0x00004000 //16384 -#define DRUG_BLIND (1 << DRUG_TYPE_BLIND) //0x00008000 //32768 -#define DRUG_KNOCKOUT (1 << DRUG_TYPE_KNOCKOUT) //0x00010000 //65536 -#define DRUG_VISION (1 << DRUG_TYPE_VISION) //0x00020000 //131072 -#define DRUG_TUNNELVISION (1 << DRUG_TYPE_TUNNELVISION) //0x00040000 //262144 -#define DRUG_LIFEDAMAGE (1 << DRUG_TYPE_LIFEDAMAGE) //0x00080000 //524288 -#define DRUG_CUREPOISON (1 << DRUG_TYPE_CUREPOISON) //0x00100000 //1048576 -#define DRUG_STUNANDKILL (1 << DRUG_TYPE_STUNANDKILL) //0x00200000 //2097152 -#define DRUG_MISC_9 0x00400000 //4194304 -#define DRUG_MISC_10 0x00800000 //8388608 -#define DRUG_MISC_11 0x01000000 //16777216 -#define DRUG_MISC_12 0x02000000 //33554432 -#define DRUG_MISC_13 0x04000000 //67108864 -#define DRUG_MISC_14 0x08000000 //134217728 -#define DRUG_MISC_15 0x10000000 //268435456 -#define DRUG_MISC_16 0x20000000 //536870912 -#define DRUG_MISC_17 0x40000000 //1073741824 -#define DRUG_MISC_18 0x80000000 //2147483648*/ - -/*typedef struct -{ - UINT8 ubType; // type of drug: bit field - UINT8 ubDrugTravelRate; - UINT8 ubDrugWearoffRate; - UINT8 ubDrugEffect; - UINT8 ubDrugSideEffect; - UINT8 ubDrugSideEffectRate; - UINT8 ubMoralBacklash; - - UINT8 ubDiseaseCure; // this is a cure for disease x - 1. It will cure Disease[x].sInfectionPtsOutbreak points of disease. -} DRUGTYPE; - -//GLOBALS -extern DRUGTYPE Drug[DRUG_TYPE_MAX];*/ - -//BOOLEAN ApplyDrugs( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObject ); - //void HandleEndTurnDrugAdjustments( SOLDIERTYPE *pSoldier ); void HandleAPEffectDueToDrugs( SOLDIERTYPE *pSoldier, INT16 *pubPoints ); void HandleBPEffectDueToDrugs( SOLDIERTYPE *pSoldier, INT16 *psPoints ); -//void HandleDamageResistanceEffectDueToDrugs( SOLDIERTYPE *pSoldier, INT32 *psPoints ); -//INT8 GetDrunkLevel( SOLDIERTYPE *pSoldier ); INT32 EffectStatForBeingDrunk( SOLDIERTYPE *pSoldier, INT32 iStat ); -//BOOLEAN MercUnderTheInfluence( SOLDIERTYPE *pSoldier ); BOOLEAN MercDruggedOrDrunk( SOLDIERTYPE *pSoldier ); -//BOOLEAN MercUnderTheInfluence( SOLDIERTYPE *pSoldier, UINT8 aDrugType ); BOOLEAN MercDrugged( SOLDIERTYPE *pSoldier ); void HourlyDrugUpdate(); diff --git a/Tactical/Weapons.h b/Tactical/Weapons.h index d7402434..44cb0459 100644 --- a/Tactical/Weapons.h +++ b/Tactical/Weapons.h @@ -177,7 +177,7 @@ enum // -------- added by Flugente: various ammo flags -------- // flags used for various ammo properties (easier than adding 32 differently named variables). DO NOT CHANGE THEM, UNLESS YOU KNOW WHAT YOU ARE DOING!!! -#define AMMO_NEUROTOXIN 0x00000001 //1 // this ammo adds the cyanide drug effect to its target, killing it in a few turns +//#define AMMO_NEUROTOXIN 0x00000001 //1 // this ammo adds the cyanide drug effect to its target, killing it in a few turns // not used anymore #define AMMO_BLIND 0x00000002 //2 // this ammo will blind if it hits the head #define AMMO_ANTIMATERIEL 0x00000004 //4 // this ammo is anti-materiel, bullets can destroy structures /*#define CONCERTINA 0x00000008 //8 diff --git a/Tactical/opplist.cpp b/Tactical/opplist.cpp index 7e3a11b2..e424ff01 100644 --- a/Tactical/opplist.cpp +++ b/Tactical/opplist.cpp @@ -3439,7 +3439,7 @@ void BetweenTurnsVisibilityAdjustments(void) void SaySeenQuote( SOLDIERTYPE *pSoldier, BOOLEAN fSeenCreature, BOOLEAN fVirginSector, BOOLEAN fSeenJoey ) { - SOLDIERTYPE *pTeamSoldier; + SOLDIERTYPE *pTeamSoldier; UINT8 ubNumEnemies = 0; UINT8 ubNumAllies = 0; UINT32 cnt; @@ -3456,7 +3456,7 @@ void SaySeenQuote( SOLDIERTYPE *pSoldier, BOOLEAN fSeenCreature, BOOLEAN fVirgin { // Get total enemies. // Loop through all mercs in sector and count # of enemies - for ( cnt = 0; cnt < guiNumMercSlots; cnt++ ) + for ( cnt = 0; cnt < guiNumMercSlots; ++cnt ) { pTeamSoldier = MercSlots[ cnt ]; @@ -3464,13 +3464,13 @@ void SaySeenQuote( SOLDIERTYPE *pSoldier, BOOLEAN fSeenCreature, BOOLEAN fVirgin { if ( OK_ENEMY_MERC( pTeamSoldier ) ) { - ubNumEnemies++; + ++ubNumEnemies; } } } // OK, after this, check our guys - for ( cnt = 0; cnt < guiNumMercSlots; cnt++ ) + for ( cnt = 0; cnt < guiNumMercSlots; ++cnt ) { pTeamSoldier = MercSlots[ cnt ]; @@ -3480,7 +3480,7 @@ void SaySeenQuote( SOLDIERTYPE *pSoldier, BOOLEAN fSeenCreature, BOOLEAN fVirgin { if ( pTeamSoldier->aiData.bOppCnt >= ( ubNumEnemies / 2 ) ) { - ubNumAllies++; + ++ubNumAllies; } } } @@ -3496,13 +3496,10 @@ void SaySeenQuote( SOLDIERTYPE *pSoldier, BOOLEAN fSeenCreature, BOOLEAN fVirgin return; } - } - if ( fSeenCreature == 1 ) { - // Is this our first time seeing them? if ( gMercProfiles[ pSoldier->ubProfile ].ubMiscFlags & PROFILE_MISC_FLAG_HAVESEENCREATURE ) { @@ -3573,21 +3570,15 @@ void SaySeenQuote( SOLDIERTYPE *pSoldier, BOOLEAN fSeenCreature, BOOLEAN fVirgin // Flugente: no quotes on seeing enemy when covert if ( (pSoldier->usSoldierFlagMask & (SOLDIER_COVERT_CIV|SOLDIER_COVERT_SOLDIER) ) == 0 ) { -#ifdef ENGLISH - if ( Random( 100 ) < 30 ) + // Flugente: apparently the goal was to have mercs only announce enemies shorter occasionally + if ( Chance( gGameExternalOptions.iChanceSayAnnoyingPhrase ) ) { - pSoldier->DoMercBattleSound( BATTLE_SOUND_ENEMY ); + TacticalCharacterDialogue( pSoldier, QUOTE_SEE_ENEMY ); } else { - TacticalCharacterDialogue( pSoldier, QUOTE_SEE_ENEMY ); - //pSoldier->ubLastEnemyDetectedProvokingQuote = pSoldier->aiData.ubCaller; + pSoldier->DoMercBattleSound( BATTLE_SOUND_ENEMY ); } -#else - //ddd TacticalCharacterDialogue( pSoldier, QUOTE_SEE_ENEMY ); - if(Chance(gGameExternalOptions.iChanceSayAnnoyingPhrase) ) - TacticalCharacterDialogue( pSoldier, QUOTE_SEE_ENEMY ); -#endif } } }