diff --git a/Tactical/Drugs And Alcohol.cpp b/Tactical/Drugs And Alcohol.cpp index 933550ef3..e58be6d8d 100644 --- a/Tactical/Drugs And Alcohol.cpp +++ b/Tactical/Drugs And Alcohol.cpp @@ -10,10 +10,11 @@ #include "points.h" #include "message.h" #include "GameSettings.h" // SANDRO - had to add this, dammit! -#include "Random.h" -#include "Text.h" -#include "Interface.h" -#include "Food.h" // added by Flugente + #include "Random.h" + #include "Text.h" + #include "Interface.h" + #include "Food.h" // added by Flugente + #include "Animation data.h" // added by Flugente for SoldierBodyTypes #endif //forward declarations of common classes to eliminate includes @@ -260,8 +261,8 @@ void HandleEndTurnDrugAdjustments( SOLDIERTYPE *pSoldier ) { UINT32 drugtestflag = (1 << cnt); // 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 ) + // omit DRUG_TYPE_REGENERATION, because that is checked afterwards separately + if ( cnt == DRUG_TYPE_REGENERATION ) continue; // If side effect aret is non-zero.... @@ -419,6 +420,97 @@ void HandleEndTurnDrugAdjustments( SOLDIERTYPE *pSoldier ) } } + // 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->bSoldierFlagMask &= ~SOLDIER_DRUGGED; @@ -568,3 +660,17 @@ BOOLEAN MercUnderTheInfluence( SOLDIERTYPE *pSoldier, UINT8 aDrugType ) return( FALSE ); } + +BOOLEAN MercDruggedButNotDrunk( SOLDIERTYPE *pSoldier ) +{ + for (UINT8 cnt = DRUG_TYPE_ADRENALINE; cnt < DRUG_TYPE_MAX; ++cnt) + { + if ( cnt == DRUG_TYPE_ALCOHOL ) + continue; + + if ( MercUnderTheInfluence(pSoldier, cnt) ) + return TRUE; + } + + return( FALSE ); +} diff --git a/Tactical/Drugs And Alcohol.h b/Tactical/Drugs And Alcohol.h index a983f70b9..581facb9e 100644 --- a/Tactical/Drugs And Alcohol.h +++ b/Tactical/Drugs And Alcohol.h @@ -35,7 +35,8 @@ enum { DRUG_TYPE_VISION, DRUG_TYPE_TUNNELVISION, DRUG_TYPE_LIFEDAMAGE, - DRUG_TYPE_CUREPOISON // 20 + DRUG_TYPE_CUREPOISON, // 20 + DRUG_TYPE_STUNANDKILL, }; // Flugente, 12-04-21 @@ -62,7 +63,7 @@ enum { #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_MISC_8 0x00200000 //2097152 +#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 @@ -99,5 +100,6 @@ INT8 GetDrunkLevel( SOLDIERTYPE *pSoldier ); INT32 EffectStatForBeingDrunk( SOLDIERTYPE *pSoldier, INT32 iStat ); BOOLEAN MercUnderTheInfluence( SOLDIERTYPE *pSoldier ); BOOLEAN MercUnderTheInfluence( SOLDIERTYPE *pSoldier, UINT8 aDrugType ); +BOOLEAN MercDruggedButNotDrunk( SOLDIERTYPE *pSoldier ); #endif diff --git a/Tactical/Faces.cpp b/Tactical/Faces.cpp index 2e65b50a4..603043c2a 100644 --- a/Tactical/Faces.cpp +++ b/Tactical/Faces.cpp @@ -2274,8 +2274,8 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE bNumRightIcons++; } - // Flugente: add the drug symbol for more drugs - if ( MercPtrs[ pFace->ubSoldierID ]->drugs.bDrugEffect[ DRUG_TYPE_ADRENALINE ] || MercPtrs[ pFace->ubSoldierID ]->drugs.bDrugEffect[ DRUG_TYPE_STRENGTH ] || MercPtrs[ pFace->ubSoldierID ]->drugs.bDrugEffect[ DRUG_TYPE_AGILITY ] || MercPtrs[ pFace->ubSoldierID ]->drugs.bDrugEffect[ DRUG_TYPE_DEXTERITY ] || MercPtrs[ pFace->ubSoldierID ]->drugs.bDrugEffect[ DRUG_TYPE_WISDOM ] ) + // Flugente: add drug symbol if drugged (without alcohol 'drug') + if ( MercDruggedButNotDrunk( MercPtrs[ pFace->ubSoldierID ] ) ) { DoRightIcon( uiRenderBuffer, pFace, sFaceX, sFaceY, bNumRightIcons, 7 ); bNumRightIcons++;