From 08ed5cf378ba74ec632f608eb164d2b483a2d817 Mon Sep 17 00:00:00 2001 From: Flugente Date: Thu, 24 Jan 2019 21:38:42 +0000 Subject: [PATCH] - 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 --- Tactical/Item Types.h | 1 + Tactical/Items.cpp | 63 ++++++++++++++++++++++++------------------- 2 files changed, 37 insertions(+), 27 deletions(-) diff --git a/Tactical/Item Types.h b/Tactical/Item Types.h index 2d2190b0..937abcb6 100644 --- a/Tactical/Item Types.h +++ b/Tactical/Item Types.h @@ -1811,6 +1811,7 @@ typedef enum TRIPWIRE_ROLL, USE_ITEM_NEW, CANNIBALIZE, + LOSE_10_PERCENT, } MergeType; extern UINT16 Merge[MAXITEMS+1][6]; diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index e7c6e3fd..0899528c 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -5094,36 +5094,41 @@ BOOLEAN OBJECTTYPE::AttachObjectNAS( SOLDIERTYPE * pSoldier, OBJECTTYPE * pAttac switch( ubType ) { case USE_ITEM_NEW: - if( (*this)[subObject]->data.objectStatus >0 && usResult != NOTHING) { - CreateItem( usResult, 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 && 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 ) + if ( ( *this )[subObject]->data.objectStatus > 0 && usResult != NOTHING ) { - 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 (pSoldier && pSoldier->bTeam == gbPlayerNum) - pSoldier->DoMercBattleSound( BATTLE_SOUND_COOL1 ); + 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 ); + } + } + else + { + if ( pSoldier && pSoldier->bTeam == gbPlayerNum ) + pSoldier->DoMercBattleSound( BATTLE_SOUND_COOL1 ); + } + ApplyEquipmentBonuses( pSoldier ); + return TRUE; } - ApplyEquipmentBonuses(pSoldier); - return TRUE; + break; case USE_ITEM: case USE_ITEM_HARD: + case LOSE_10_PERCENT: // the merge will combine the two items if ( pSoldier ) { @@ -5143,6 +5148,11 @@ BOOLEAN OBJECTTYPE::AttachObjectNAS( SOLDIERTYPE * pSoldier, OBJECTTYPE * pAttac StatChange( pSoldier, MECHANAMT, 25, 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 @@ -5335,10 +5345,9 @@ BOOLEAN OBJECTTYPE::AttachObjectNAS( SOLDIERTYPE * pSoldier, OBJECTTYPE * pAttac //ReInitMergedItem(pSoldier, this, usOldItem, 0); } break; - // fall through - + case ELECTRONIC_MERGE: - if ( pSoldier ) + if ( ubType == ELECTRONIC_MERGE && pSoldier ) // coulda fallen through { iCheckResult = SkillCheck( pSoldier, ATTACHING_SPECIAL_ELECTRONIC_ITEM_CHECK, -30 ); if ( iCheckResult < 0 )