mirror of
https://github.com/1dot13/source.git
synced 2026-09-02 14:36:06 +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
|
// 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
|
||||||
//////////////// STRENGTH ////////////////
|
if ( pSoldier->bTeam == gbPlayerNum)
|
||||||
// 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 ];
|
|
||||||
|
|
||||||
// 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);
|
|
||||||
|
|
||||||
pSoldier->stats.bStrength = (INT8)newstrength;
|
|
||||||
|
|
||||||
if ( strengthmodifier > 0 )
|
|
||||||
{
|
{
|
||||||
pSoldier->timeChanges.uiChangeStrengthTime = GetJA2Clock();
|
//////////////// STRENGTH ////////////////
|
||||||
pSoldier->usValueGoneUp |= ( STRENGTH_INCREASE );
|
// strength we would normally have right now
|
||||||
}
|
INT8 strength = gMercProfiles[ pSoldier->ubProfile ].bStrength - pSoldier->ubCriticalStatDamage[ DAMAGED_STAT_STRENGTH ];
|
||||||
else if ( strengthmodifier < 0 )
|
|
||||||
{
|
|
||||||
pSoldier->timeChanges.uiChangeStrengthTime = GetJA2Clock();
|
|
||||||
pSoldier->usValueGoneUp &= ~( STRENGTH_INCREASE );
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////// DEXTERITY ////////////////
|
INT8 strengthmodifier = pSoldier->drugs.bDrugEffect[ DRUG_TYPE_STRENGTH ] - pSoldier->drugs.bDrugSideEffect[ DRUG_TYPE_STRENGTH ];
|
||||||
// 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 ];
|
// 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)
|
UINT32 newstrength = max(1, strength + strengthmodifier);
|
||||||
dexteritymodifier = min(25, dexteritymodifier);
|
newstrength = min(126, newstrength);
|
||||||
|
|
||||||
UINT32 newdexterity = max(1, dexterity + dexteritymodifier);
|
pSoldier->stats.bStrength = (INT8)newstrength;
|
||||||
newdexterity = min(126, newdexterity);
|
|
||||||
|
|
||||||
pSoldier->stats.bDexterity = newdexterity;
|
if ( strengthmodifier > 0 )
|
||||||
|
{
|
||||||
|
pSoldier->timeChanges.uiChangeStrengthTime = GetJA2Clock();
|
||||||
|
pSoldier->usValueGoneUp |= ( STRENGTH_INCREASE );
|
||||||
|
}
|
||||||
|
else if ( strengthmodifier < 0 )
|
||||||
|
{
|
||||||
|
pSoldier->timeChanges.uiChangeStrengthTime = GetJA2Clock();
|
||||||
|
pSoldier->usValueGoneUp &= ~( STRENGTH_INCREASE );
|
||||||
|
}
|
||||||
|
|
||||||
if ( dexteritymodifier > 0 )
|
//////////////// DEXTERITY ////////////////
|
||||||
{
|
// dexterity we would normally have right now
|
||||||
pSoldier->timeChanges.uiChangeDexterityTime = GetJA2Clock();
|
INT8 dexterity = gMercProfiles[ pSoldier->ubProfile ].bDexterity - pSoldier->ubCriticalStatDamage[ DAMAGED_STAT_DEXTERITY ];
|
||||||
pSoldier->usValueGoneUp |= ( DEX_INCREASE );
|
|
||||||
}
|
|
||||||
else if ( dexteritymodifier < 0 )
|
|
||||||
{
|
|
||||||
pSoldier->timeChanges.uiChangeDexterityTime = GetJA2Clock();
|
|
||||||
pSoldier->usValueGoneUp &= ~( DEX_INCREASE );
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////// AGILITY ////////////////
|
INT8 dexteritymodifier = pSoldier->drugs.bDrugEffect[ DRUG_TYPE_DEXTERITY ] - pSoldier->drugs.bDrugSideEffect[ DRUG_TYPE_DEXTERITY ];
|
||||||
// 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 ];
|
// 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)
|
UINT32 newdexterity = max(1, dexterity + dexteritymodifier);
|
||||||
agilitymodifier = min(25, agilitymodifier);
|
newdexterity = min(126, newdexterity);
|
||||||
|
|
||||||
UINT32 newagility = max(1, agility + agilitymodifier);
|
pSoldier->stats.bDexterity = newdexterity;
|
||||||
newagility = min(126, newagility);
|
|
||||||
|
|
||||||
pSoldier->stats.bAgility = newagility;
|
if ( dexteritymodifier > 0 )
|
||||||
|
{
|
||||||
|
pSoldier->timeChanges.uiChangeDexterityTime = GetJA2Clock();
|
||||||
|
pSoldier->usValueGoneUp |= ( DEX_INCREASE );
|
||||||
|
}
|
||||||
|
else if ( dexteritymodifier < 0 )
|
||||||
|
{
|
||||||
|
pSoldier->timeChanges.uiChangeDexterityTime = GetJA2Clock();
|
||||||
|
pSoldier->usValueGoneUp &= ~( DEX_INCREASE );
|
||||||
|
}
|
||||||
|
|
||||||
if ( agilitymodifier > 0 )
|
//////////////// AGILITY ////////////////
|
||||||
{
|
// agility we would normally have right now
|
||||||
pSoldier->timeChanges.uiChangeAgilityTime = GetJA2Clock();
|
INT8 agility = gMercProfiles[ pSoldier->ubProfile ].bAgility - pSoldier->ubCriticalStatDamage[ DAMAGED_STAT_AGILITY ];
|
||||||
pSoldier->usValueGoneUp |= ( AGIL_INCREASE );
|
|
||||||
}
|
|
||||||
else if ( agilitymodifier < 0 )
|
|
||||||
{
|
|
||||||
pSoldier->timeChanges.uiChangeAgilityTime = GetJA2Clock();
|
|
||||||
pSoldier->usValueGoneUp &= ~( AGIL_INCREASE );
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////// WISDOM ////////////////
|
INT8 agilitymodifier = pSoldier->drugs.bDrugEffect[ DRUG_TYPE_AGILITY ] - pSoldier->drugs.bDrugSideEffect[ DRUG_TYPE_AGILITY ];
|
||||||
// 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 ];
|
// 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)
|
UINT32 newagility = max(1, agility + agilitymodifier);
|
||||||
wisdommodifier = min(25, wisdommodifier);
|
newagility = min(126, newagility);
|
||||||
|
|
||||||
UINT32 newwisdom = max(1, wisdom + wisdommodifier);
|
pSoldier->stats.bAgility = newagility;
|
||||||
newwisdom = min(126, newwisdom);
|
|
||||||
|
|
||||||
pSoldier->stats.bWisdom = newwisdom;
|
if ( agilitymodifier > 0 )
|
||||||
|
{
|
||||||
|
pSoldier->timeChanges.uiChangeAgilityTime = GetJA2Clock();
|
||||||
|
pSoldier->usValueGoneUp |= ( AGIL_INCREASE );
|
||||||
|
}
|
||||||
|
else if ( agilitymodifier < 0 )
|
||||||
|
{
|
||||||
|
pSoldier->timeChanges.uiChangeAgilityTime = GetJA2Clock();
|
||||||
|
pSoldier->usValueGoneUp &= ~( AGIL_INCREASE );
|
||||||
|
}
|
||||||
|
|
||||||
if ( wisdommodifier > 0 )
|
//////////////// WISDOM ////////////////
|
||||||
{
|
// wisdom we would normally have right now
|
||||||
pSoldier->timeChanges.uiChangeWisdomTime = GetJA2Clock();
|
INT8 wisdom = gMercProfiles[ pSoldier->ubProfile ].bWisdom - pSoldier->ubCriticalStatDamage[ DAMAGED_STAT_WISDOM ];
|
||||||
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...
|
INT8 wisdommodifier = pSoldier->drugs.bDrugEffect[ DRUG_TYPE_WISDOM ] - pSoldier->drugs.bDrugSideEffect[ DRUG_TYPE_WISDOM ];
|
||||||
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...
|
// cap modifier at 25, as currently stats cant go above 127 (INT8)
|
||||||
if ( pSoldier->drugs.bDrugEffect[ DRUG_TYPE_KNOCKOUT ] == 0 && pSoldier->drugs.bDrugSideEffect[ DRUG_TYPE_KNOCKOUT ] == 1 )
|
wisdommodifier = min(25, wisdommodifier);
|
||||||
{
|
|
||||||
// Keel over...
|
UINT32 newwisdom = max(1, wisdom + wisdommodifier);
|
||||||
DeductPoints( pSoldier, 0, 20000 );
|
newwisdom = min(126, 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 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 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,8 @@
|
|||||||
#define REGEN_POINTS_PER_BOOSTER 4
|
#define REGEN_POINTS_PER_BOOSTER 4
|
||||||
#define LIFE_GAIN_PER_REGEN_POINT 10
|
#define LIFE_GAIN_PER_REGEN_POINT 10
|
||||||
|
|
||||||
|
extern UINT8 gbPlayerNum;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
DRUG_TYPE_ADRENALINE = 0,
|
DRUG_TYPE_ADRENALINE = 0,
|
||||||
DRUG_TYPE_ALCOHOL,
|
DRUG_TYPE_ALCOHOL,
|
||||||
|
|||||||
+1
-1
@@ -541,7 +541,7 @@ itemEndElementHandle(void *userData, const XML_Char *name)
|
|||||||
else if(strcmp(name, "AvailableAttachmentPoint") == 0)
|
else if(strcmp(name, "AvailableAttachmentPoint") == 0)
|
||||||
{
|
{
|
||||||
pData->curElement = ELEMENT;
|
pData->curElement = ELEMENT;
|
||||||
pData->curItem.ulAvailableAttachmentPoint = (UINT64) atof(pData->szCharData);
|
pData->curItem.ulAvailableAttachmentPoint |= (UINT64) atof(pData->szCharData);
|
||||||
}
|
}
|
||||||
else if(strcmp(name, "AttachmentPoint") == 0)
|
else if(strcmp(name, "AttachmentPoint") == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user