mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
Bugfix from Flugente: enemies collapsing
-during the drug upkeep, the strength value of the soldiers was set to 1, which is why they were exhausted very fast by what little inventory they had Also - Now we read in (and OR together) a variable number of AvailableAttachmentPoint tags from items.xml. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5238 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -358,118 +358,121 @@ void HandleEndTurnDrugAdjustments( SOLDIERTYPE *pSoldier )
|
||||
}
|
||||
|
||||
// Flugente: always do the following checks. Thereby, if the effect runs out, our stats will be back to normal
|
||||
// only do the checks for the player team, as soldiers do not have a gMercProfiles
|
||||
if ( pSoldier->bTeam == gbPlayerNum)
|
||||
{
|
||||
//////////////// STRENGTH ////////////////
|
||||
// strength we would normally have right now
|
||||
INT8 strength = gMercProfiles[ pSoldier->ubProfile ].bStrength - pSoldier->ubCriticalStatDamage[ DAMAGED_STAT_STRENGTH ];
|
||||
|
||||
//////////////// STRENGTH ////////////////
|
||||
// strength we would normally have right now
|
||||
INT8 strength = gMercProfiles[ pSoldier->ubProfile ].bStrength - pSoldier->ubCriticalStatDamage[ DAMAGED_STAT_STRENGTH ];
|
||||
INT8 strengthmodifier = pSoldier->drugs.bDrugEffect[ DRUG_TYPE_STRENGTH ] - pSoldier->drugs.bDrugSideEffect[ DRUG_TYPE_STRENGTH ];
|
||||
|
||||
INT8 strengthmodifier = pSoldier->drugs.bDrugEffect[ DRUG_TYPE_STRENGTH ] - pSoldier->drugs.bDrugSideEffect[ DRUG_TYPE_STRENGTH ];
|
||||
// cap modifier at 25, as currently stats cant go above 127 (INT8)
|
||||
strengthmodifier = min(25, strengthmodifier);
|
||||
|
||||
// cap modifier at 25, as currently stats cant go above 127 (INT8)
|
||||
strengthmodifier = min(25, strengthmodifier);
|
||||
|
||||
UINT32 newstrength = max(1, strength + strengthmodifier);
|
||||
newstrength = min(126, newstrength);
|
||||
UINT32 newstrength = max(1, strength + strengthmodifier);
|
||||
newstrength = min(126, newstrength);
|
||||
|
||||
pSoldier->stats.bStrength = (INT8)newstrength;
|
||||
pSoldier->stats.bStrength = (INT8)newstrength;
|
||||
|
||||
if ( strengthmodifier > 0 )
|
||||
{
|
||||
pSoldier->timeChanges.uiChangeStrengthTime = GetJA2Clock();
|
||||
pSoldier->usValueGoneUp |= ( STRENGTH_INCREASE );
|
||||
}
|
||||
else if ( strengthmodifier < 0 )
|
||||
{
|
||||
pSoldier->timeChanges.uiChangeStrengthTime = GetJA2Clock();
|
||||
pSoldier->usValueGoneUp &= ~( STRENGTH_INCREASE );
|
||||
}
|
||||
if ( strengthmodifier > 0 )
|
||||
{
|
||||
pSoldier->timeChanges.uiChangeStrengthTime = GetJA2Clock();
|
||||
pSoldier->usValueGoneUp |= ( STRENGTH_INCREASE );
|
||||
}
|
||||
else if ( strengthmodifier < 0 )
|
||||
{
|
||||
pSoldier->timeChanges.uiChangeStrengthTime = GetJA2Clock();
|
||||
pSoldier->usValueGoneUp &= ~( STRENGTH_INCREASE );
|
||||
}
|
||||
|
||||
//////////////// DEXTERITY ////////////////
|
||||
// dexterity we would normally have right now
|
||||
INT8 dexterity = gMercProfiles[ pSoldier->ubProfile ].bDexterity - pSoldier->ubCriticalStatDamage[ DAMAGED_STAT_DEXTERITY ];
|
||||
//////////////// DEXTERITY ////////////////
|
||||
// dexterity we would normally have right now
|
||||
INT8 dexterity = gMercProfiles[ pSoldier->ubProfile ].bDexterity - pSoldier->ubCriticalStatDamage[ DAMAGED_STAT_DEXTERITY ];
|
||||
|
||||
INT8 dexteritymodifier = pSoldier->drugs.bDrugEffect[ DRUG_TYPE_DEXTERITY ] - pSoldier->drugs.bDrugSideEffect[ DRUG_TYPE_DEXTERITY ];
|
||||
INT8 dexteritymodifier = pSoldier->drugs.bDrugEffect[ DRUG_TYPE_DEXTERITY ] - pSoldier->drugs.bDrugSideEffect[ DRUG_TYPE_DEXTERITY ];
|
||||
|
||||
// cap modifier at 25, as currently stats cant go above 127 (INT8)
|
||||
dexteritymodifier = min(25, dexteritymodifier);
|
||||
// cap modifier at 25, as currently stats cant go above 127 (INT8)
|
||||
dexteritymodifier = min(25, dexteritymodifier);
|
||||
|
||||
UINT32 newdexterity = max(1, dexterity + dexteritymodifier);
|
||||
newdexterity = min(126, newdexterity);
|
||||
UINT32 newdexterity = max(1, dexterity + dexteritymodifier);
|
||||
newdexterity = min(126, newdexterity);
|
||||
|
||||
pSoldier->stats.bDexterity = newdexterity;
|
||||
pSoldier->stats.bDexterity = newdexterity;
|
||||
|
||||
if ( dexteritymodifier > 0 )
|
||||
{
|
||||
pSoldier->timeChanges.uiChangeDexterityTime = GetJA2Clock();
|
||||
pSoldier->usValueGoneUp |= ( DEX_INCREASE );
|
||||
}
|
||||
else if ( dexteritymodifier < 0 )
|
||||
{
|
||||
pSoldier->timeChanges.uiChangeDexterityTime = GetJA2Clock();
|
||||
pSoldier->usValueGoneUp &= ~( DEX_INCREASE );
|
||||
}
|
||||
if ( dexteritymodifier > 0 )
|
||||
{
|
||||
pSoldier->timeChanges.uiChangeDexterityTime = GetJA2Clock();
|
||||
pSoldier->usValueGoneUp |= ( DEX_INCREASE );
|
||||
}
|
||||
else if ( dexteritymodifier < 0 )
|
||||
{
|
||||
pSoldier->timeChanges.uiChangeDexterityTime = GetJA2Clock();
|
||||
pSoldier->usValueGoneUp &= ~( DEX_INCREASE );
|
||||
}
|
||||
|
||||
//////////////// AGILITY ////////////////
|
||||
// agility we would normally have right now
|
||||
INT8 agility = gMercProfiles[ pSoldier->ubProfile ].bAgility - pSoldier->ubCriticalStatDamage[ DAMAGED_STAT_AGILITY ];
|
||||
//////////////// AGILITY ////////////////
|
||||
// agility we would normally have right now
|
||||
INT8 agility = gMercProfiles[ pSoldier->ubProfile ].bAgility - pSoldier->ubCriticalStatDamage[ DAMAGED_STAT_AGILITY ];
|
||||
|
||||
INT8 agilitymodifier = pSoldier->drugs.bDrugEffect[ DRUG_TYPE_AGILITY ] - pSoldier->drugs.bDrugSideEffect[ DRUG_TYPE_AGILITY ];
|
||||
INT8 agilitymodifier = pSoldier->drugs.bDrugEffect[ DRUG_TYPE_AGILITY ] - pSoldier->drugs.bDrugSideEffect[ DRUG_TYPE_AGILITY ];
|
||||
|
||||
// cap modifier at 25, as currently stats cant go above 127 (INT8)
|
||||
agilitymodifier = min(25, agilitymodifier);
|
||||
// cap modifier at 25, as currently stats cant go above 127 (INT8)
|
||||
agilitymodifier = min(25, agilitymodifier);
|
||||
|
||||
UINT32 newagility = max(1, agility + agilitymodifier);
|
||||
newagility = min(126, newagility);
|
||||
UINT32 newagility = max(1, agility + agilitymodifier);
|
||||
newagility = min(126, newagility);
|
||||
|
||||
pSoldier->stats.bAgility = newagility;
|
||||
pSoldier->stats.bAgility = newagility;
|
||||
|
||||
if ( agilitymodifier > 0 )
|
||||
{
|
||||
pSoldier->timeChanges.uiChangeAgilityTime = GetJA2Clock();
|
||||
pSoldier->usValueGoneUp |= ( AGIL_INCREASE );
|
||||
}
|
||||
else if ( agilitymodifier < 0 )
|
||||
{
|
||||
pSoldier->timeChanges.uiChangeAgilityTime = GetJA2Clock();
|
||||
pSoldier->usValueGoneUp &= ~( AGIL_INCREASE );
|
||||
}
|
||||
if ( agilitymodifier > 0 )
|
||||
{
|
||||
pSoldier->timeChanges.uiChangeAgilityTime = GetJA2Clock();
|
||||
pSoldier->usValueGoneUp |= ( AGIL_INCREASE );
|
||||
}
|
||||
else if ( agilitymodifier < 0 )
|
||||
{
|
||||
pSoldier->timeChanges.uiChangeAgilityTime = GetJA2Clock();
|
||||
pSoldier->usValueGoneUp &= ~( AGIL_INCREASE );
|
||||
}
|
||||
|
||||
//////////////// WISDOM ////////////////
|
||||
// wisdom we would normally have right now
|
||||
INT8 wisdom = gMercProfiles[ pSoldier->ubProfile ].bWisdom - pSoldier->ubCriticalStatDamage[ DAMAGED_STAT_WISDOM ];
|
||||
//////////////// WISDOM ////////////////
|
||||
// wisdom we would normally have right now
|
||||
INT8 wisdom = gMercProfiles[ pSoldier->ubProfile ].bWisdom - pSoldier->ubCriticalStatDamage[ DAMAGED_STAT_WISDOM ];
|
||||
|
||||
INT8 wisdommodifier = pSoldier->drugs.bDrugEffect[ DRUG_TYPE_WISDOM ] - pSoldier->drugs.bDrugSideEffect[ DRUG_TYPE_WISDOM ];
|
||||
INT8 wisdommodifier = pSoldier->drugs.bDrugEffect[ DRUG_TYPE_WISDOM ] - pSoldier->drugs.bDrugSideEffect[ DRUG_TYPE_WISDOM ];
|
||||
|
||||
// cap modifier at 25, as currently stats cant go above 127 (INT8)
|
||||
wisdommodifier = min(25, wisdommodifier);
|
||||
// cap modifier at 25, as currently stats cant go above 127 (INT8)
|
||||
wisdommodifier = min(25, wisdommodifier);
|
||||
|
||||
UINT32 newwisdom = max(1, wisdom + wisdommodifier);
|
||||
newwisdom = min(126, newwisdom);
|
||||
UINT32 newwisdom = max(1, wisdom + wisdommodifier);
|
||||
newwisdom = min(126, newwisdom);
|
||||
|
||||
pSoldier->stats.bWisdom = newwisdom;
|
||||
pSoldier->stats.bWisdom = newwisdom;
|
||||
|
||||
if ( wisdommodifier > 0 )
|
||||
{
|
||||
pSoldier->timeChanges.uiChangeWisdomTime = GetJA2Clock();
|
||||
pSoldier->usValueGoneUp |= ( WIS_INCREASE );
|
||||
}
|
||||
else if ( wisdommodifier < 0 )
|
||||
{
|
||||
pSoldier->timeChanges.uiChangeWisdomTime = GetJA2Clock();
|
||||
pSoldier->usValueGoneUp &= ~( WIS_INCREASE );
|
||||
}
|
||||
if ( wisdommodifier > 0 )
|
||||
{
|
||||
pSoldier->timeChanges.uiChangeWisdomTime = GetJA2Clock();
|
||||
pSoldier->usValueGoneUp |= ( WIS_INCREASE );
|
||||
}
|
||||
else if ( wisdommodifier < 0 )
|
||||
{
|
||||
pSoldier->timeChanges.uiChangeWisdomTime = GetJA2Clock();
|
||||
pSoldier->usValueGoneUp &= ~( WIS_INCREASE );
|
||||
}
|
||||
|
||||
// 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 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 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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#define REGEN_POINTS_PER_BOOSTER 4
|
||||
#define LIFE_GAIN_PER_REGEN_POINT 10
|
||||
|
||||
extern UINT8 gbPlayerNum;
|
||||
|
||||
enum {
|
||||
DRUG_TYPE_ADRENALINE = 0,
|
||||
DRUG_TYPE_ALCOHOL,
|
||||
|
||||
+1
-1
@@ -541,7 +541,7 @@ itemEndElementHandle(void *userData, const XML_Char *name)
|
||||
else if(strcmp(name, "AvailableAttachmentPoint") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curItem.ulAvailableAttachmentPoint = (UINT64) atof(pData->szCharData);
|
||||
pData->curItem.ulAvailableAttachmentPoint |= (UINT64) atof(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "AttachmentPoint") == 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user