mirror of
https://github.com/1dot13/source.git
synced 2026-07-29 13:52:17 +02:00
- Bugfix: The name-tag in Drugs.xml made the drug system not working (by Flugente)
- New drug effect: cyanide damages life as a sideeffect. Currently doesn't kill, but lets you lose consciousness. (by Flugente) git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5263 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -473,6 +473,23 @@ void HandleEndTurnDrugAdjustments( SOLDIERTYPE *pSoldier )
|
||||
// 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 )
|
||||
{
|
||||
if ( pSoldier->stats.bLife > OKLIFE )
|
||||
{
|
||||
INT8 lifepointdamage = pSoldier->drugs.bDrugSideEffect[ DRUG_TYPE_LIFEDAMAGE ];
|
||||
|
||||
INT8 applieddamage = pSoldier->stats.bLife;
|
||||
|
||||
pSoldier->stats.bLife = max(OKLIFE - 1, pSoldier->stats.bLife - lifepointdamage);
|
||||
|
||||
applieddamage -= pSoldier->stats.bLife;
|
||||
|
||||
pSoldier->iHealableInjury += (applieddamage * 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,8 @@ enum {
|
||||
DRUG_TYPE_BLIND, // 15
|
||||
DRUG_TYPE_KNOCKOUT,
|
||||
DRUG_TYPE_VISION,
|
||||
DRUG_TYPE_TUNNELVISION
|
||||
DRUG_TYPE_TUNNELVISION,
|
||||
DRUG_TYPE_LIFEDAMAGE
|
||||
};
|
||||
|
||||
// Flugente, 12-04-21
|
||||
@@ -58,7 +59,7 @@ enum {
|
||||
#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_MISC_6 0x00080000 //524288
|
||||
#define DRUG_LIFEDAMAGE (1 << DRUG_TYPE_LIFEDAMAGE) //0x00080000 //524288
|
||||
#define DRUG_MISC_7 0x00100000 //1048576
|
||||
#define DRUG_MISC_8 0x00200000 //2097152
|
||||
#define DRUG_MISC_9 0x00400000 //4194304
|
||||
|
||||
@@ -48,6 +48,7 @@ drugsStartElementHandle(void *userData, const XML_Char *name, const XML_Char **a
|
||||
}
|
||||
else if(pData->curElement == ELEMENT &&
|
||||
(strcmp(name, "ubType") == 0 ||
|
||||
strcmp(name, "name") == 0 ||
|
||||
strcmp(name, "ubDrugTravelRate") == 0 ||
|
||||
strcmp(name, "ubDrugWearoffRate") == 0 ||
|
||||
strcmp(name, "ubDrugEffect") == 0 ||
|
||||
@@ -95,7 +96,8 @@ drugsEndElementHandle(void *userData, const XML_Char *name)
|
||||
{
|
||||
pData->curElement = ELEMENT_LIST;
|
||||
|
||||
if(pData->curDrugs.ubType < pData->maxArraySize && pData->curDrugs.ubType > 0) // do not write the first item into our array
|
||||
// we do NOT want to read the first entry -> move stuff by 1
|
||||
if(pData->curDrugs.ubType < pData->maxArraySize + 1 && pData->curDrugs.ubType > 0) // do not write the first item into our array
|
||||
{
|
||||
pData->curArray[pData->curDrugs.ubType - 1] = pData->curDrugs; //write the drugs into the table
|
||||
}
|
||||
@@ -105,6 +107,11 @@ drugsEndElementHandle(void *userData, const XML_Char *name)
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDrugs.ubType = (UINT8) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "name") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
// not needed, but its there :-(
|
||||
}
|
||||
else if(strcmp(name, "ubDrugTravelRate") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
|
||||
Reference in New Issue
Block a user