4 new tags in Items.xml that modify skill checks. (by JMich)

- LockPickModifier modifies the lockpick chance by a specific number. If the number is positive, it is proportional to the locksmith kit's status, if the number is negative, it will always be the same. Tag is ignored if the item isn't a LocksmithKit. FindLocksmithKit should return the one that gives the biggest bonus, but it may have trouble with stacked lockpicks. Hovering over the "Locksmith Kit" icon in UDB should tell you how much of a bonus (or penalty) that item gives you.

- CrowbarModifier increases your chances to force open by using a crowbar by the number indicated. Default vanilla crowbar has a bonus of 20, so an item with a bonus of 10 will be worse than a crowbar (but possibly smaller). FindUsableCrowbar should return the item with the biggest bonus. Tag is ignored if the item isn't a Crowbar. Hovering over the "Crowbar" Icon in UDB should tell you by how much your chances are improved, though if the item is also a weapon, the icon isn't visible.

- RepairModifier modifies a toolkit's effectiveness by that percentage. If you try to repair with a shoddy toolkit that has a RepairModifier of -20, you'll be 80% as effective, while repairing with an excellent toolkit that has a RepairModifier of 20 means you are 120% as effective. When checking if you have a toolkit at hand, it should select the one with the biggest bonus. Tag is ignored if item isn't also a Toolkit. Hovering over the "Toolkit" icon in UDB should tell you how effective the repair kit is.

- DisarmModifier increases your chances to disarm a trap by the indicated amount, modified by the Diffusal Kit's status. The FindDisarmKit should return the item with the biggest bonus, though it uses the top item in a stack. Currently using the "Wirecutters" icon in UDB, hovering over it should tell you by how much your trap disarm chance is improved.


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5472 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2012-08-14 15:04:02 +00:00
parent 21dd880240
commit cde4ce4229
17 changed files with 275 additions and 120 deletions
+20 -4
View File
@@ -2336,7 +2336,8 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr
//////////////////// LOCKSMITH'S KIT
if (Item[ gpItemDescObject->usItem ].locksmithkit)
{
swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 10 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 10 ]);
swprintf( pStr, L"%s%s%d", szUDBGenSecondaryStatsTooltipText[ 10 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 10 ], (Item[ gpItemDescObject->usItem ].LockPickModifier > 0 ?
( Item[ gpItemDescObject->usItem ].LockPickModifier * (*gpItemDescObject)[0]->data.objectStatus / 100 ) : Item[ gpItemDescObject->usItem ].LockPickModifier ) );
SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr );
MSYS_EnableRegion( &gUDBFasthelpRegions[ iFirstDataRegion + cnt ] );
cnt++;
@@ -2354,13 +2355,13 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr
//////////////////// CROWBAR
if (Item[ gpItemDescObject->usItem ].crowbar)
{
swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 12 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 12 ]);
swprintf( pStr, L"%s%s%d", szUDBGenSecondaryStatsTooltipText[ 12 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 12 ], Item[ gpItemDescObject->usItem ].CrowbarModifier );
SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr );
MSYS_EnableRegion( &gUDBFasthelpRegions[ iFirstDataRegion + cnt ] );
cnt++;
}
//////////////////// CROWBAR
//////////////////// METAL DETECTOR
if (Item[ gpItemDescObject->usItem ].metaldetector)
{
swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 13 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 13 ]);
@@ -2408,7 +2409,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr
//////////////////// TOOLKIT
if (Item[ gpItemDescObject->usItem ].toolkit)
{
swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 18 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 18 ]);
swprintf( pStr, L"%s%s%d", szUDBGenSecondaryStatsTooltipText[ 18 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 18 ], Item[ gpItemDescObject->usItem ].RepairModifier );
SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr );
MSYS_EnableRegion( &gUDBFasthelpRegions[ iFirstDataRegion + cnt ] );
cnt++;
@@ -2507,6 +2508,14 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr
cnt++;
}
}
///////////////////// DEFUSAL KIT
if ( Item[gpItemDescObject->usItem].DisarmModifier > 0)
{
swprintf( pStr, L"%s%s%d", szUDBGenSecondaryStatsTooltipText[ 30 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 30 ], Item[gpItemDescObject->usItem].DisarmModifier);
SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr );
MSYS_EnableRegion( &gUDBFasthelpRegions[ iFirstDataRegion + cnt ] );
cnt++;
}
}
//////////////////////////////////////////////////////
@@ -5530,6 +5539,13 @@ void DrawSecondaryStats( OBJECTTYPE * gpItemDescObject )
cnt++;
}
}
////////////////// DEFUSAL KIT
//JMich_SkillsModifiers: Still needs a picture, currently using the wirecutters.
if ( Item[gpItemDescObject->usItem].DisarmModifier > 0 )
{
BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 11, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL );
cnt++;
}
}
void DrawWeaponValues( OBJECTTYPE * gpItemDescObject )
+6
View File
@@ -1012,6 +1012,12 @@ typedef struct
// Flugente: food type
UINT32 foodtype;
//JMich_SkillModifiers: Adding new skill modifiers
INT8 LockPickModifier;
UINT8 CrowbarModifier;
UINT8 DisarmModifier;
INT8 RepairModifier;
} INVTYPE;
// CHRISL: Added new structures to handle LBE gear and the two new XML files that will be needed to deal
+51 -7
View File
@@ -11566,18 +11566,22 @@ INT8 FindCannon( SOLDIERTYPE * pSoldier )
INT8 FindUsableCrowbar( SOLDIERTYPE * pSoldier )
{
INT8 bLoop;
//JMich_SkillModifiers: Adding a bonus check, to return the best crowbar, and modifying the return value.
INT8 bLoop, bonus, FoundCrowbar;
FoundCrowbar = NO_SLOT;
bonus = -101;
for (bLoop = 0; bLoop < (INT8) pSoldier->inv.size(); bLoop++)
{
if (pSoldier->inv[bLoop].exists() == true) {
if ( Item[pSoldier->inv[bLoop].usItem].crowbar && pSoldier->inv[bLoop][0]->data.objectStatus >= USABLE )
if ( Item[pSoldier->inv[bLoop].usItem].crowbar && pSoldier->inv[bLoop][0]->data.objectStatus >= USABLE && Item[pSoldier->inv[bLoop].usItem].CrowbarModifier > bonus)
{
return( bLoop );
bonus = Item[pSoldier->inv[bLoop].usItem].CrowbarModifier;
FoundCrowbar = bLoop;
}
}
}
return( NO_SLOT );
return( FoundCrowbar );
}
OBJECTTYPE* FindAttachedBatteries( OBJECTTYPE * pObj )
@@ -11652,20 +11656,60 @@ INT8 FindCamoKit( SOLDIERTYPE * pSoldier )
}
return( NO_SLOT );
}
//JMich_SkillModifiers: Adding a function to see if we have an item with disarm bonus
INT8 FindDisarmKit( SOLDIERTYPE * pSoldier )
{
INT8 bLoop, bonus, FoundKit;
FoundKit = NO_SLOT;
bonus = 0;
for (bLoop = 0; bLoop < (INT8) pSoldier->inv.size(); bLoop++)
{
if (pSoldier->inv[bLoop].exists() == true) {
if ( ( ( Item[pSoldier->inv[bLoop].usItem].DisarmModifier * pSoldier->inv[bLoop][0]->data.objectStatus ) / 100 ) > bonus )
{
bonus = Item[pSoldier->inv[bLoop].usItem].DisarmModifier * pSoldier->inv[bLoop][0]->data.objectStatus / 100;;
FoundKit = bLoop;
}
}
}
return( FoundKit );
}
INT8 FindLocksmithKit( SOLDIERTYPE * pSoldier )
{
INT8 bLoop;
//JMich_SkillModifiers: Adding a bonus check, to return the best LocksmithKit, and modifying the return value.
INT8 bLoop, bonus, FoundKit;
FoundKit = NO_SLOT;
bonus = -101;
for (bLoop = 0; bLoop < (INT8) pSoldier->inv.size(); bLoop++)
{
if (pSoldier->inv[bLoop].exists() == true) {
if (Item[pSoldier->inv[bLoop].usItem].locksmithkit )
{
return( bLoop );
//JMich_SkillModifiers: If the locksmith kit has a bonus, reduce it based on the status, so we use the best bonus.
if (Item[pSoldier->inv[bLoop].usItem].LockPickModifier > 0 )
{
if ( ( Item[pSoldier->inv[bLoop].usItem].LockPickModifier * pSoldier->inv[bLoop][0]->data.objectStatus / 100 ) > bonus )
{
bonus = ( Item[pSoldier->inv[bLoop].usItem].LockPickModifier * pSoldier->inv[bLoop][0]->data.objectStatus / 100 );
FoundKit = bLoop;
}
}
//JMich_SkillModifiers: If on the other hand the locksmith is a shoddy one, keep that penalty regardless of status.
else
{
if ( Item[pSoldier->inv[bLoop].usItem].LockPickModifier > bonus )
{
bonus = Item[pSoldier->inv[bLoop].usItem].LockPickModifier;
FoundKit = bLoop;
}
}
}
}
}
return( NO_SLOT );
return( FoundKit );
}
INT8 FindWalkman( SOLDIERTYPE * pSoldier )
{
+1
View File
@@ -384,6 +384,7 @@ BOOLEAN IsRemoteDetonatorAttached( OBJECTTYPE * pObj ); // Flugente: no more ne
OBJECTTYPE* FindAttachedBatteries( OBJECTTYPE * pObj );
INT8 FindMedKit( SOLDIERTYPE * pSoldier );
INT8 FindFirstAidKit( SOLDIERTYPE * pSoldier );
INT8 FindDisarmKit( SOLDIERTYPE * pSoldier ); //JMich_SkillsModifiers: Added function to check for disarm bonus
INT8 FindLocksmithKit( SOLDIERTYPE * pSoldier );
INT8 FindCamoKit( SOLDIERTYPE * pSoldier );
INT8 FindWalkman( SOLDIERTYPE * pSoldier );
+33 -4
View File
@@ -256,7 +256,6 @@ INT32 SkillCheck( SOLDIERTYPE * pSoldier, INT8 bReason, INT8 bChanceMod )
INT32 iSkill;
INT32 iChance, iReportChance;
INT32 iRoll, iMadeItBy;
INT8 bSlot;
INT32 iLoop;
SOLDIERTYPE * pTeamSoldier;
INT8 bBuddyIndex;
@@ -268,6 +267,7 @@ INT32 SkillCheck( SOLDIERTYPE * pSoldier, INT8 bReason, INT8 bChanceMod )
{
case LOCKPICKING_CHECK:
case ELECTRONIC_LOCKPICKING_CHECK:
INT8 bSlot;
fForceDamnSound = TRUE;
@@ -321,7 +321,16 @@ INT32 SkillCheck( SOLDIERTYPE * pSoldier, INT8 bReason, INT8 bChanceMod )
// this should never happen, but might as well check...
iSkill = 0;
}
iSkill = iSkill * pSoldier->inv[bSlot][0]->data.objectStatus / 100;
else
{
//JMich_SkillsModifiers: Modifying the skill by the bonus from the lockpick, then reducing due to status
iSkill += Item[pSoldier->inv[bSlot].usItem].LockPickModifier;
}
//JMich_SkillsModifiers: If skill goes negative due to crappy lockpicks, the status of them doesn't matter.
if (iSkill > 0)
{
iSkill = (iSkill * pSoldier->inv[bSlot][0]->data.objectStatus) / 100;
}
break;
case ATTACHING_DETONATOR_CHECK:
case ATTACHING_REMOTE_DETONATOR_CHECK:
@@ -420,10 +429,15 @@ INT32 SkillCheck( SOLDIERTYPE * pSoldier, INT8 bReason, INT8 bChanceMod )
break;
}
}
iSkill += EffectiveDexterity( pSoldier, FALSE ) * 2;
iSkill += EffectiveExpLevel( pSoldier ) * 10;
iSkill = iSkill / 10; // bring the value down to a percentage
//JMich_SkillModifiers: Adding a Disarm Trap bonus
bSlot = FindDisarmKit( pSoldier);
if (bSlot != NO_SLOT)
{
iSkill += Item[pSoldier->inv[bSlot].usItem].DisarmModifier * pSoldier->inv[bSlot][0]->data.objectStatus / 100;
}
// SANDRO - STOMP traits - Demolitions trait removing traps bonus
if ( gGameOptions.fNewTraitSystem )
@@ -468,6 +482,12 @@ INT32 SkillCheck( SOLDIERTYPE * pSoldier, INT8 bReason, INT8 bChanceMod )
iSkill += EffectiveDexterity( pSoldier, FALSE ) * 2;
iSkill += EffectiveExpLevel( pSoldier ) * 10;
iSkill = iSkill / 10; // bring the value down to a percentage
//JMich_SkillModifiers: Adding a Disarm Trap bonus
bSlot = FindDisarmKit( pSoldier);
if (bSlot != NO_SLOT)
{
iSkill += Item[pSoldier->inv[bSlot].usItem].DisarmModifier * pSoldier->inv[bSlot][0]->data.objectStatus / 100;
}
// penalty based on poor wisdom
iSkill -= (100 - EffectiveWisdom( pSoldier ) ) / 5;
@@ -495,7 +515,16 @@ INT32 SkillCheck( SOLDIERTYPE * pSoldier, INT8 bReason, INT8 bChanceMod )
case OPEN_WITH_CROWBAR:
// Add for crowbar...
iSkill = EffectiveStrength( pSoldier, FALSE ) + 20;
//JMich_SkillModifiers: Changing the +20 to the crowbar's bonus.
bSlot = FindUsableCrowbar( pSoldier );
if (bSlot != NO_SLOT)
{
iSkill = EffectiveStrength( pSoldier, FALSE ) + Item[pSoldier->inv[bSlot].usItem].CrowbarModifier;
}
else //how are we trying to force with a crowbar, without having one??
{
iSkill = 0;
}
fForceDamnSound = TRUE;
break;