- New mergetype 15: works like mergetype 6 but lowers status of firstItemIndex by 10%

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8650 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2019-01-24 21:38:42 +00:00
parent 253db89460
commit 08ed5cf378
2 changed files with 37 additions and 27 deletions
+1
View File
@@ -1811,6 +1811,7 @@ typedef enum
TRIPWIRE_ROLL, TRIPWIRE_ROLL,
USE_ITEM_NEW, USE_ITEM_NEW,
CANNIBALIZE, CANNIBALIZE,
LOSE_10_PERCENT,
} MergeType; } MergeType;
extern UINT16 Merge[MAXITEMS+1][6]; extern UINT16 Merge[MAXITEMS+1][6];
+35 -26
View File
@@ -5094,36 +5094,41 @@ BOOLEAN OBJECTTYPE::AttachObjectNAS( SOLDIERTYPE * pSoldier, OBJECTTYPE * pAttac
switch( ubType ) switch( ubType )
{ {
case USE_ITEM_NEW: case USE_ITEM_NEW:
if( (*this)[subObject]->data.objectStatus >0 && usResult != NOTHING)
{ {
CreateItem( usResult, 100, &gTempObject ); if ( ( *this )[subObject]->data.objectStatus > 0 && usResult != NOTHING )
if ( !AutoPlaceObject( pSoldier, &gTempObject, FALSE ) )
AddItemToPool( pSoldier->sGridNo, &gTempObject, 1, 0, 0, -1 );
(*this)[subObject]->data.objectStatus--;
}
if( (*this)[subObject]->data.objectStatus >0 && usResult2 != NOTHING )
{
CreateItem( usResult2, 100, &gTempObject );
if ( !AutoPlaceObject( pSoldier, &gTempObject, FALSE ) )
AddItemToPool( pSoldier->sGridNo, &gTempObject, 1, 0, 0, -1 );
(*this)[subObject]->data.objectStatus--;
}
if( (*this)[subObject]->data.objectStatus == 0 )
{
this->RemoveObjectsFromStack(1);
if ( pSoldier && pSoldier->bTeam == gbPlayerNum )
{ {
pSoldier->DoMercBattleSound( BATTLE_SOUND_CURSE1 ); CreateItem( usResult, 100, &gTempObject );
if ( !AutoPlaceObject( pSoldier, &gTempObject, FALSE ) )
AddItemToPool( pSoldier->sGridNo, &gTempObject, 1, 0, 0, -1 );
( *this )[subObject]->data.objectStatus--;
} }
} else if ( ( *this )[subObject]->data.objectStatus > 0 && usResult2 != NOTHING )
{ {
if (pSoldier && pSoldier->bTeam == gbPlayerNum) CreateItem( usResult2, 100, &gTempObject );
pSoldier->DoMercBattleSound( BATTLE_SOUND_COOL1 ); if ( !AutoPlaceObject( pSoldier, &gTempObject, FALSE ) )
AddItemToPool( pSoldier->sGridNo, &gTempObject, 1, 0, 0, -1 );
( *this )[subObject]->data.objectStatus--;
}
if ( ( *this )[subObject]->data.objectStatus == 0 )
{
this->RemoveObjectsFromStack( 1 );
if ( pSoldier && pSoldier->bTeam == gbPlayerNum )
{
pSoldier->DoMercBattleSound( BATTLE_SOUND_CURSE1 );
}
}
else
{
if ( pSoldier && pSoldier->bTeam == gbPlayerNum )
pSoldier->DoMercBattleSound( BATTLE_SOUND_COOL1 );
}
ApplyEquipmentBonuses( pSoldier );
return TRUE;
} }
ApplyEquipmentBonuses(pSoldier); break;
return TRUE;
case USE_ITEM: case USE_ITEM:
case USE_ITEM_HARD: case USE_ITEM_HARD:
case LOSE_10_PERCENT:
// the merge will combine the two items // the merge will combine the two items
if ( pSoldier ) if ( pSoldier )
{ {
@@ -5143,6 +5148,11 @@ BOOLEAN OBJECTTYPE::AttachObjectNAS( SOLDIERTYPE * pSoldier, OBJECTTYPE * pAttac
StatChange( pSoldier, MECHANAMT, 25, FALSE ); StatChange( pSoldier, MECHANAMT, 25, FALSE );
StatChange( pSoldier, WISDOMAMT, 5, FALSE ); StatChange( pSoldier, WISDOMAMT, 5, FALSE );
} }
else if ( ubType == LOSE_10_PERCENT )
{
// lose 10% status
( *pAttachment )[0]->data.objectStatus = max( 0, ( *pAttachment )[0]->data.objectStatus - 10 );
}
//Madd: note that use_item cannot produce two different items!!! so it doesn't use usResult2 //Madd: note that use_item cannot produce two different items!!! so it doesn't use usResult2
@@ -5335,10 +5345,9 @@ BOOLEAN OBJECTTYPE::AttachObjectNAS( SOLDIERTYPE * pSoldier, OBJECTTYPE * pAttac
//ReInitMergedItem(pSoldier, this, usOldItem, 0); //ReInitMergedItem(pSoldier, this, usOldItem, 0);
} }
break; break;
// fall through
case ELECTRONIC_MERGE: case ELECTRONIC_MERGE:
if ( pSoldier ) if ( ubType == ELECTRONIC_MERGE && pSoldier ) // coulda fallen through
{ {
iCheckResult = SkillCheck( pSoldier, ATTACHING_SPECIAL_ELECTRONIC_ITEM_CHECK, -30 ); iCheckResult = SkillCheck( pSoldier, ATTACHING_SPECIAL_ELECTRONIC_ITEM_CHECK, -30 );
if ( iCheckResult < 0 ) if ( iCheckResult < 0 )