mirror of
https://github.com/1dot13/source.git
synced 2026-09-16 14:47:17 +02:00
Fixes issues with AP costs for aimed melee attack that allowed to make such attack even without required action points. Note for coders - #defines using conditionals needs to be in parenthesis, otherwise they won't work properly when used in conditionals - which was the case here on many places. (SANDRO catched only few of them. His fixes are reverted since the fix is now in #define itself) (by Shadooow)
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9020 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+16
-29
@@ -1671,7 +1671,7 @@ UINT8 HandleKnifeCursor( SOLDIERTYPE *pSoldier, INT32 sGridNo, BOOLEAN fActivate
|
|||||||
// Calculate action points
|
// Calculate action points
|
||||||
if ( gTacticalStatus.uiFlags & TURNBASED && (gTacticalStatus.uiFlags & INCOMBAT) )
|
if ( gTacticalStatus.uiFlags & TURNBASED && (gTacticalStatus.uiFlags & INCOMBAT) )
|
||||||
{
|
{
|
||||||
gsCurrentActionPoints = CalcTotalAPsToAttack( pSoldier, sGridNo, TRUE, (INT8)(pSoldier->aiData.bShownAimTime ) );
|
gsCurrentActionPoints = CalcTotalAPsToAttack( pSoldier, sGridNo, TRUE, (INT8)(pSoldier->aiData.bShownAimTime / 2) );
|
||||||
gfUIDisplayActionPoints = TRUE;
|
gfUIDisplayActionPoints = TRUE;
|
||||||
gfUIDisplayActionPointsCenter = TRUE;
|
gfUIDisplayActionPointsCenter = TRUE;
|
||||||
|
|
||||||
@@ -1686,8 +1686,7 @@ UINT8 HandleKnifeCursor( SOLDIERTYPE *pSoldier, INT32 sGridNo, BOOLEAN fActivate
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SANDRO - changed this
|
bFutureAim = (INT8)( REFINE_KNIFE_2 );
|
||||||
bFutureAim = (INT8)( gGameExternalOptions.fEnhancedCloseCombatSystem ? gSkillTraitValues.ubModifierForAPsAddedOnAimedBladedAttackes : REFINE_KNIFE_2 );
|
|
||||||
|
|
||||||
sAPCosts = CalcTotalAPsToAttack( pSoldier, sGridNo, TRUE, (INT8)(bFutureAim / 2) );
|
sAPCosts = CalcTotalAPsToAttack( pSoldier, sGridNo, TRUE, (INT8)(bFutureAim / 2) );
|
||||||
|
|
||||||
@@ -1721,7 +1720,6 @@ UINT8 HandleKnifeCursor( SOLDIERTYPE *pSoldier, INT32 sGridNo, BOOLEAN fActivate
|
|||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////
|
||||||
// SANDRO - slightly changed the formula here
|
|
||||||
if( pSoldier->aiData.bShownAimTime == REFINE_KNIFE_1 )
|
if( pSoldier->aiData.bShownAimTime == REFINE_KNIFE_1 )
|
||||||
{
|
{
|
||||||
if ( gfDisplayFullCountRing )
|
if ( gfDisplayFullCountRing )
|
||||||
@@ -1737,7 +1735,7 @@ UINT8 HandleKnifeCursor( SOLDIERTYPE *pSoldier, INT32 sGridNo, BOOLEAN fActivate
|
|||||||
return( KNIFE_NOGO_AIM1_UICURSOR );
|
return( KNIFE_NOGO_AIM1_UICURSOR );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( pSoldier->aiData.bShownAimTime == ( gGameExternalOptions.fEnhancedCloseCombatSystem ? gSkillTraitValues.ubModifierForAPsAddedOnAimedBladedAttackes : REFINE_KNIFE_2 ) )
|
else if( pSoldier->aiData.bShownAimTime == REFINE_KNIFE_2 )
|
||||||
{
|
{
|
||||||
if ( gfDisplayFullCountRing )
|
if ( gfDisplayFullCountRing )
|
||||||
{
|
{
|
||||||
@@ -1804,7 +1802,7 @@ UINT8 HandlePunchCursor( SOLDIERTYPE *pSoldier, INT32 sGridNo, BOOLEAN fActivate
|
|||||||
// Calculate action points
|
// Calculate action points
|
||||||
if ( gTacticalStatus.uiFlags & TURNBASED )
|
if ( gTacticalStatus.uiFlags & TURNBASED )
|
||||||
{
|
{
|
||||||
gsCurrentActionPoints = CalcTotalAPsToAttack( pSoldier, sGridNo, TRUE, (INT8)(pSoldier->aiData.bShownAimTime ) );
|
gsCurrentActionPoints = CalcTotalAPsToAttack( pSoldier, sGridNo, TRUE, (INT8)(pSoldier->aiData.bShownAimTime / 2) );
|
||||||
gfUIDisplayActionPoints = TRUE;
|
gfUIDisplayActionPoints = TRUE;
|
||||||
gfUIDisplayActionPointsCenter = TRUE;
|
gfUIDisplayActionPointsCenter = TRUE;
|
||||||
|
|
||||||
@@ -1845,15 +1843,13 @@ UINT8 HandlePunchCursor( SOLDIERTYPE *pSoldier, INT32 sGridNo, BOOLEAN fActivate
|
|||||||
PlayJA2Sample( TARG_REFINE_BEEP, RATE_11025, MIDVOLUME, 1, MIDDLEPAN );
|
PlayJA2Sample( TARG_REFINE_BEEP, RATE_11025, MIDVOLUME, 1, MIDDLEPAN );
|
||||||
}
|
}
|
||||||
|
|
||||||
// SANDRO - make aimed punch less expensive for APS
|
pSoldier->aiData.bShownAimTime = REFINE_PUNCH_2;
|
||||||
pSoldier->aiData.bShownAimTime = (gGameExternalOptions.fEnhancedCloseCombatSystem ? gSkillTraitValues.ubModifierForAPsAddedOnAimedPunches : REFINE_PUNCH_2);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////
|
||||||
// SANDRO - slightly changed the formula here
|
|
||||||
if( pSoldier->aiData.bShownAimTime == REFINE_PUNCH_1)
|
if( pSoldier->aiData.bShownAimTime == REFINE_PUNCH_1)
|
||||||
{
|
{
|
||||||
if ( gfDisplayFullCountRing )
|
if ( gfDisplayFullCountRing )
|
||||||
@@ -1869,7 +1865,7 @@ UINT8 HandlePunchCursor( SOLDIERTYPE *pSoldier, INT32 sGridNo, BOOLEAN fActivate
|
|||||||
return( ACTION_PUNCH_NOGO_AIM1_UICURSOR );
|
return( ACTION_PUNCH_NOGO_AIM1_UICURSOR );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( pSoldier->aiData.bShownAimTime == (gGameExternalOptions.fEnhancedCloseCombatSystem ? gSkillTraitValues.ubModifierForAPsAddedOnAimedPunches : REFINE_PUNCH_2) )
|
else if ( pSoldier->aiData.bShownAimTime == REFINE_PUNCH_2 )
|
||||||
{
|
{
|
||||||
if ( gfDisplayFullCountRing )
|
if ( gfDisplayFullCountRing )
|
||||||
{
|
{
|
||||||
@@ -2540,9 +2536,6 @@ void HandleRightClickAdjustCursor( SOLDIERTYPE *pSoldier, INT32 usMapPos )
|
|||||||
SOLDIERTYPE *pTSoldier;
|
SOLDIERTYPE *pTSoldier;
|
||||||
INT32 sGridNo;
|
INT32 sGridNo;
|
||||||
INT8 bTargetLevel;
|
INT8 bTargetLevel;
|
||||||
// SANDRO - added these two
|
|
||||||
INT8 bAimTimeAddedForPunch = 2;
|
|
||||||
INT8 bAimTimeAddedForKnife = 2;
|
|
||||||
|
|
||||||
|
|
||||||
usInHand = pSoldier->inv[HANDPOS].usItem;
|
usInHand = pSoldier->inv[HANDPOS].usItem;
|
||||||
@@ -2756,23 +2749,20 @@ void HandleRightClickAdjustCursor( SOLDIERTYPE *pSoldier, INT32 usMapPos )
|
|||||||
|
|
||||||
case PUNCHCURS:
|
case PUNCHCURS:
|
||||||
|
|
||||||
// SANDRO - changed the formula here to make aimed punch less expensive for APS
|
bFutureAim = (INT8)( pSoldier->aiData.bShownAimTime + REFINE_PUNCH_2);
|
||||||
bAimTimeAddedForPunch = (gGameExternalOptions.fEnhancedCloseCombatSystem ? gSkillTraitValues.ubModifierForAPsAddedOnAimedPunches : REFINE_PUNCH_2);
|
|
||||||
|
|
||||||
bFutureAim = (INT8)( pSoldier->aiData.bShownAimTime + bAimTimeAddedForPunch );
|
if ( bFutureAim <= REFINE_PUNCH_2)
|
||||||
|
|
||||||
if ( bFutureAim <= bAimTimeAddedForPunch )
|
|
||||||
{
|
{
|
||||||
sAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, (INT8)(bFutureAim / 2) );
|
sAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, (INT8)(bFutureAim / 2) );
|
||||||
|
|
||||||
// Determine if we can afford!
|
// Determine if we can afford!
|
||||||
if ( EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) )
|
if ( EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) )
|
||||||
{
|
{
|
||||||
pSoldier->aiData.bShownAimTime+= bAimTimeAddedForPunch;
|
pSoldier->aiData.bShownAimTime+= REFINE_PUNCH_2;
|
||||||
|
|
||||||
if ( pSoldier->aiData.bShownAimTime > bAimTimeAddedForPunch )
|
if ( pSoldier->aiData.bShownAimTime > REFINE_PUNCH_2)
|
||||||
{
|
{
|
||||||
pSoldier->aiData.bShownAimTime = bAimTimeAddedForPunch;
|
pSoldier->aiData.bShownAimTime = REFINE_PUNCH_2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Else - goto first level!
|
// Else - goto first level!
|
||||||
@@ -2806,23 +2796,20 @@ void HandleRightClickAdjustCursor( SOLDIERTYPE *pSoldier, INT32 usMapPos )
|
|||||||
|
|
||||||
case KNIFECURS:
|
case KNIFECURS:
|
||||||
|
|
||||||
// SANDRO - changed the formula here to make aimed blade attack less expensive for APS
|
bFutureAim = (INT8)( pSoldier->aiData.bShownAimTime + REFINE_KNIFE_2);
|
||||||
bAimTimeAddedForKnife = (gGameExternalOptions.fEnhancedCloseCombatSystem ? gSkillTraitValues.ubModifierForAPsAddedOnAimedBladedAttackes : REFINE_KNIFE_2);
|
|
||||||
|
|
||||||
bFutureAim = (INT8)( pSoldier->aiData.bShownAimTime + bAimTimeAddedForKnife );
|
if ( bFutureAim <= REFINE_KNIFE_2)
|
||||||
|
|
||||||
if ( bFutureAim <= bAimTimeAddedForKnife )
|
|
||||||
{
|
{
|
||||||
sAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, (INT8)(bFutureAim / 2) );
|
sAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, (INT8)(bFutureAim / 2) );
|
||||||
|
|
||||||
// Determine if we can afford!
|
// Determine if we can afford!
|
||||||
if ( EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) )
|
if ( EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) )
|
||||||
{
|
{
|
||||||
pSoldier->aiData.bShownAimTime+= bAimTimeAddedForKnife;
|
pSoldier->aiData.bShownAimTime+= REFINE_KNIFE_2;
|
||||||
|
|
||||||
if ( pSoldier->aiData.bShownAimTime > bAimTimeAddedForKnife )
|
if ( pSoldier->aiData.bShownAimTime > REFINE_KNIFE_2)
|
||||||
{
|
{
|
||||||
pSoldier->aiData.bShownAimTime = bAimTimeAddedForKnife;
|
pSoldier->aiData.bShownAimTime = REFINE_KNIFE_2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Else - goto first level!
|
// Else - goto first level!
|
||||||
|
|||||||
Reference in New Issue
Block a user