Mercurial > mm7
changeset 1080:9456f2ed5ff9
getskillbonus continue cleaning
author | Gloval |
---|---|
date | Sat, 25 May 2013 23:50:56 +0400 |
parents | 2210109f280d |
children | 6ea7c693a1cf |
files | Items.h Player.cpp Player.h mm7_3.cpp mm7_4.cpp mm7_6.cpp |
diffstat | 6 files changed, 139 insertions(+), 124 deletions(-) [+] |
line wrap: on
line diff
--- a/Items.h Sat May 25 18:46:48 2013 +0100 +++ b/Items.h Sat May 25 23:50:56 2013 +0400 @@ -82,8 +82,11 @@ ITEM_ARTICACT_GOVERNONS_ARMOR = 504,//1F8 ITEM_ARTIFACT_YORUBA = 505,//1F9 ITEM_ARTIFACT_SPLITTER = 506,//1FA + ITEM_ARTIFACT_GHOULSBANE = 507,//1FA + ITEM_ARTEFACT_ULLYSES =510, ITEM_ARTIFACT_LEAGUE_BOOTS = 512,//200 ITEM_RELIC_HARECS_LEATHER = 516,//204 + ITEM_RELIC_KELEBRIM = 520,//208 ITEM_RELIC_TALEDONS_HELM = 521,//209 ITEM_RELIC_SCHOLARS_CAP = 522,//20A ITEM_RELIC_PHYNAXIAN_CROWN = 523,//20B @@ -114,8 +117,8 @@ EQUIP_HELMET = 5, EQUIP_BELT = 6, EQUIP_CLOAK = 7, - EQUIP_GAUNTLETS = 8, - EQUIP_BOOTS = 9, + EQUIP_BOOTS = 8, + EQUIP_GAUNTLETS = 9, EQUIP_RING = 10, EQUIP_AMULET = 11, EQUIP_WAND = 12, @@ -123,6 +126,7 @@ EQUIP_POTION = 14, EQUIP_SPELL_SCROLL = 15, EQUIP_BOOK = 16, + EQIUP_ANY = 16, EQUIP_MESSAGE_SCROLL = 17, EQUIP_GOLD = 18, EQUIP_GEM = 19,
--- a/Player.cpp Sat May 25 18:46:48 2013 +0100 +++ b/Player.cpp Sat May 25 23:50:56 2013 +0400 @@ -1085,7 +1085,8 @@ PlaySound((PlayerSpeech)25, 0); break; case Condition_Sleep: - if ( a3 == 1 &&(HasEnchantedItemEquipped(22)||WearsItem(505, 3))) + if ( a3 == 1 &&(HasEnchantedItemEquipped(22)|| + WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR))) return 0; break; @@ -1098,7 +1099,9 @@ case Condition_Insane: if ( a3 == 1 - && (HasEnchantedItemEquipped(19) || WearsItem(505, 3) || WearsItem(530, 6)) ) + && (HasEnchantedItemEquipped(19) || + WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR) || + WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_BELT)) ) return 0; PlaySound((PlayerSpeech)29, 0); @@ -1115,8 +1118,8 @@ pParty->pPartyBuffs[13].Reset(); } if ( HasEnchantedItemEquipped(21) - || WearsItem(505, 3) - || WearsItem(530, 6) ) + || WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR) + || WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_BELT) ) //goto LABEL_76; return 0; } @@ -1138,7 +1141,9 @@ return 0; } - if ( HasEnchantedItemEquipped(18) ||WearsItem(505, 3) || WearsItem(530, 6) ) + if ( HasEnchantedItemEquipped(18) || + WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR) || + WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_BELT) ) return 0; } PlaySound((PlayerSpeech)28, 0); @@ -1154,7 +1159,10 @@ return 0; } - if ( HasEnchantedItemEquipped(20)|| WearsItem(505, 3)|| WearsItem(507, 16)||WearsItem(530, 6)) + if ( HasEnchantedItemEquipped(20)|| + WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR)|| + WearsItem(ITEM_ARTIFACT_GHOULSBANE, EQIUP_ANY)|| + WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_BELT)) return 0; } break; @@ -1180,7 +1188,10 @@ case Condition_Pertified: if ( a3 == 1 &&((pParty->pPartyBuffs[13].uExpireTime > 0i64) - || HasEnchantedItemEquipped(23)|| WearsItem(520, 16) || WearsItem(505, 3) || WearsItem(530, 6)) ) + || HasEnchantedItemEquipped(23)|| + WearsItem(ITEM_RELIC_KELEBRIM, EQIUP_ANY) || + WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR) || + WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_BELT)) ) return 0; PlaySound((PlayerSpeech)34, 0); @@ -3249,7 +3260,7 @@ { auto i = pEquipment.pIndices[uEquipIndex]; if (i) - return ~(pInventoryItems[i - 1].uAttributes & ITEM_BROKEN); + return ~(pOwnItems[i - 1].uAttributes & ITEM_BROKEN); else return false; } @@ -3260,7 +3271,7 @@ for (uint i = 0; i < 16; ++i) { if (HasItemEquipped((ITEM_EQUIP_TYPE)i) && - pInventoryItems[i].uSpecEnchantmentType == uEnchantment) + pOwnItems[pEquipment.pIndices[i]-1].uSpecEnchantmentType == uEnchantment) // *(int *)&this->field_1F6[36 * pEquipment[i] + 6] != uEnchantment) return true; } @@ -3268,16 +3279,16 @@ } //----- (0048D709) -------------------------------------------------------- -bool Player::WearsItem(int a1, signed int a2) -{ +bool Player::WearsItem( int item_id, ITEM_EQUIP_TYPE equip_type ) + { int v6; // esi@5 - if ( a2 >= 16 ) + if ( equip_type >= 16 ) { v6 = 0; while ( !HasItemEquipped((ITEM_EQUIP_TYPE)v6) - || *(int *)&this->pInventoryItems[pEquipment.pIndices[v6] - 1].uItemID != a1 ) + || this->pInventoryItems[pEquipment.pIndices[v6] - 1].uItemID != item_id ) { ++v6; if ( (signed int)v6 >= 16 ) @@ -3285,7 +3296,7 @@ } return 1; } - if ( HasItemEquipped((ITEM_EQUIP_TYPE)a2) && pInventoryItems[pEquipment.pIndices[a2 - 1]].uItemID == a1 ) + if ( HasItemEquipped(equip_type) && pInventoryItems[pEquipment.pIndices[equip_type - 1]].uItemID == item_id ) return 1; return 0; } @@ -5690,7 +5701,7 @@ int v67; // [sp+18h] [bp-14h]@104 int v68; // [sp+1Ch] [bp-10h]@69 PlayerEquipment *v69; // [sp+20h] [bp-Ch]@1 - int v70; // [sp+24h] [bp-8h]@1 + int skill_bonus; // [sp+24h] [bp-8h]@1 ITEM_EQUIP_TYPE v71; // [sp+28h] [bp-4h]@1 int a1; // [sp+34h] [bp+8h]@21 int a1a; // [sp+34h] [bp+8h]@74 @@ -5700,7 +5711,7 @@ int lvl_avl[4]; v2 = this; - v70 = 0; + skill_bonus = 0; v69 = 0; multiplier =0; arm_bonus =0; @@ -5809,7 +5820,7 @@ for ( i = 0; i < (signed int)v52; ++i ) { if ( lvl_avl[i] ) - v70 += v53; + skill_bonus += v53; } } @@ -5829,24 +5840,105 @@ for ( j = 0; j < (signed int)v57; ++j ) { if ( lvl_avl[j] ) - v70 += v58; + skill_bonus += v58; } } - return v70; + return skill_bonus; } + if (a2 == CHARACTER_ATTRIBUTE_ATTACK) + { + + if ( v2->IsUnarmed() == 1 ) + { + v33 = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); + v34 = v33; + if ( !v33 ) + return skill_bonus; + if ( SkillToMastery(v33) >= 3 ) + multiplier = 2; + else + multiplier=1; + v30 = multiplier * (v34 & 0x3F); + return arm_bonus + v30; + } + v35 = (ITEM_EQUIP_TYPE)0; + v68 = 0; + for (i=0; i<16 ; ++i) + { + if ( v2->HasItemEquipped((ITEM_EQUIP_TYPE)i) ) + { + v37 = v2->pEquipment.pIndices[i]-1; + if ( pItemsTable->pItems[v37].uEquipType <= EQUIP_MAIN_HAND) + break; + } + } + if ( i >= 16 ) + return skill_bonus; + + v38 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v37].uSkillType; + a1a = v2->GetActualSkillLevel(v38); + v39= SkillToMastery(a1a); + v71 = (ITEM_EQUIP_TYPE)0; + switch (v38) + { + case PLAYER_SKILL_STAFF: + v71 = (ITEM_EQUIP_TYPE)1; + if ( v39 == 4 ) + { + v40 = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); + v41 = v40; + + if ( v40 ) + { + if ( SkillToMastery(v40) >= 3 ) + multiplier = 2; + else + multiplier=1; + v68 = multiplier * (v41 & 0x3F); + } + } + break; + case PLAYER_SKILL_SWORD: + case PLAYER_SKILL_DAGGER: + case PLAYER_SKILL_AXE: + case PLAYER_SKILL_SPEAR: + case PLAYER_SKILL_MACE: + v71 = (ITEM_EQUIP_TYPE)1; + break; + case PLAYER_SKILL_BLASTER: + + switch (v39) + { + case 0: multiplier=1; break; + case 1: multiplier=3; break; + case 3: multiplier=3; break; + case 4: multiplier=5; break; + } + v5 = multiplier; + return v5 * (a1a & 0x3F); + break; + } + + + + v30 = v68 + v71 * (a1a & 0x3F); + return (int)((char *)v69 + v30); + + } + + if ( a2 != 9 ) { - if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) - { + if ( a2 <= CHARACTER_ATTRIBUTE_ATTACK ) - return v70; + return skill_bonus; if ( a2 > CHARACTER_ATTRIBUTE_MELEE_DMG_MAX ) { if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) - return v70; + return skill_bonus; v71 = (ITEM_EQUIP_TYPE)0; v9 = &v2->pEquipment; while ( 1 ) @@ -5866,7 +5958,7 @@ v71 = (ITEM_EQUIP_TYPE)((int)v71 + 1); v9 = (PlayerEquipment *)((char *)v9 + 4); if ( (signed int)v71 >= 16 ) - return v70; + return skill_bonus; } v14 = a1; v15 = 1; @@ -5889,7 +5981,7 @@ LOBYTE(v18) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); v14 = v18; if ( !v18 ) - return v70; + return skill_bonus; v15 = 0; v19 = SkillToMastery(v18); if ( (signed int)v19 < 3 ) @@ -5917,7 +6009,7 @@ } v20 = (ITEM_EQUIP_TYPE)((int)v20 + 1); if ( (signed int)v20 >= 16 ) - return v70; + return skill_bonus; } v71 = (ITEM_EQUIP_TYPE)0; v23 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v22].uSkillType; @@ -5979,89 +6071,8 @@ v71 = (ITEM_EQUIP_TYPE)1; goto LABEL_55; } - if ( v2->IsUnarmed() == 1 ) - { - LOBYTE(v33) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); - v34 = v33; - if ( !v33 ) - return v70; - if ( (signed int)SkillToMastery(v33) >= 3 ) - v5 = 2; - v30 = v5 * (v34 & 0x3F); - return (int)((char *)v69 + v30); - } - v35 = (ITEM_EQUIP_TYPE)0; - v68 = 0; - while ( 1 ) - { - if ( v2->HasItemEquipped(v35) ) - { - v37 = v2->pInventoryItems[v35].uItemID; - if ( pItemsTable->pItems[v37].uEquipType <= 1u ) - break; - } - v35 = (ITEM_EQUIP_TYPE)((int)v35 + 1); - if ( (signed int)v35 >= 16 ) - return v70; - } - v38 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v37].uSkillType; - LOBYTE(v39) = v2->GetActualSkillLevel(v38); - a1a = v39; - SkillToMastery(v39); - v71 = (ITEM_EQUIP_TYPE)0; - if ( v38 ) - { - if ( (signed int)v38 > 0 ) - { - if ( (signed int)v38 <= 4 || v38 == 6 ) - { - v71 = (ITEM_EQUIP_TYPE)1; - } - else - { - if ( v38 == 7 ) - { - if ( (signed int)SkillToMastery(a1a) < 4 ) - { - if ( (signed int)SkillToMastery(a1a) < 3 ) - { - if ( (signed int)SkillToMastery(a1a) < 2 ) - return v5 * (a1a & 0x3F); - v63 = 2; - } - else - { - v63 = 3; - } - } - else - { - v63 = 5; - } - v5 = v63; - return v5 * (a1a & 0x3F); - } - } - } - } - else - { - v71 = (ITEM_EQUIP_TYPE)1; - if ( (signed int)SkillToMastery(a1a) >= 4 ) - { - LOBYTE(v40) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); - v41 = v40; - if ( v40 ) - { - if ( (signed int)SkillToMastery(v40) >= 3 ) - v5 = 2; - v68 = v5 * (v41 & 0x3F); - } - } - } - v30 = v68 + v71 * (a1a & 0x3F); - return (int)((char *)v69 + v30); - } + + }
--- a/Player.h Sat May 25 18:46:48 2013 +0100 +++ b/Player.h Sat May 25 23:50:56 2013 +0400 @@ -511,7 +511,7 @@ bool IsUnarmed(); bool HasItemEquipped(ITEM_EQUIP_TYPE uEquipIndex); bool HasEnchantedItemEquipped(int uEnchantment); - bool WearsItem(int a1, signed int a2); + bool WearsItem(int item_id, ITEM_EQUIP_TYPE equip_type); bool StealFromShop(struct ItemGen *a2, int a3, int a4, int a5, int *a6); int StealFromActor(unsigned int uActorID, int _steal_perm, int reputation); void Heal(int amount);
--- a/mm7_3.cpp Sat May 25 18:46:48 2013 +0100 +++ b/mm7_3.cpp Sat May 25 23:50:56 2013 +0400 @@ -1632,10 +1632,10 @@ if (!pParty->FeatherFallActive()) { bFeatherFall = false; - if (!pParty->pPlayers[0].WearsItem(ITEM_ARTIFACT_LADYS_ESCORT, 16) && // grants feather fall - !pParty->pPlayers[1].WearsItem(ITEM_ARTIFACT_LADYS_ESCORT, 16) && - !pParty->pPlayers[2].WearsItem(ITEM_ARTIFACT_LADYS_ESCORT, 16) && - !pParty->pPlayers[3].WearsItem(ITEM_ARTIFACT_LADYS_ESCORT, 16)) + if (!pParty->pPlayers[0].WearsItem(ITEM_ARTIFACT_LADYS_ESCORT, EQIUP_ANY) && // grants feather fall + !pParty->pPlayers[1].WearsItem(ITEM_ARTIFACT_LADYS_ESCORT, EQIUP_ANY) && + !pParty->pPlayers[2].WearsItem(ITEM_ARTIFACT_LADYS_ESCORT, EQIUP_ANY) && + !pParty->pPlayers[3].WearsItem(ITEM_ARTIFACT_LADYS_ESCORT, EQIUP_ANY)) { fall_start = pParty->uFallStartY; } @@ -1656,7 +1656,7 @@ else for (uint i = 0; i < 4; ++i) { // receive falling damage auto player = pParty->pPlayers + i; - if (!player->HasEnchantedItemEquipped(72) && !player->WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, 8)) + if (!player->HasEnchantedItemEquipped(72) && !player->WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS)) { player->ReceiveDamage((pParty->uFallStartY - party_z) * (0.1f * player->GetMaxHealth()) / 256, DMGT_PHISYCAL); v10 = (double)(20 - player->GetParameterBonus(player->GetActualEndurance())) * flt_6BE3A4_debug_recmod1 * 2.133333333333333; @@ -1829,7 +1829,7 @@ v41 = &pPlayers[1]; do { - if ( !(*v41)->HasEnchantedItemEquipped(72) && !(*v41)->WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, 8) ) + if ( !(*v41)->HasEnchantedItemEquipped(72) && !(*v41)->WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS) ) //was 8 (*v41)->PlayEmotion(CHARACTER_EXPRESSION_SCARED, 0); ++v41; } @@ -2257,7 +2257,7 @@ goto LABEL_9; }*/ for (int i = 0; i < 4; ++i) - if (pParty->pPlayers[i].WearsItem(536, 16)) // seems like flying boots + if (pParty->pPlayers[i].WearsItem(ITEM_ARTIFACT_LADYS_ESCORT, EQIUP_ANY)) // seems like flying boots { bFeatherFall = 1; break; @@ -2295,7 +2295,7 @@ { auto player = pParty->pPlayers + _i; - if ( !player->HasEnchantedItemEquipped(72) && !player->WearsItem(529, 8) ) + if ( !player->HasEnchantedItemEquipped(72) && !player->WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS) ) { player->ReceiveDamage( (signed int)((pParty->uFallStartY - pZ) * (unsigned __int64)(player->GetMaxHealth() / 10)) / 256, @@ -2733,7 +2733,7 @@ for (int i = 0; i < 4; ++i) { auto player = pParty->pPlayers + i; - if (!player->HasEnchantedItemEquipped(72) && !player->WearsItem(529, 8) && player->CanAct()) + if (!player->HasEnchantedItemEquipped(72) && !player->WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS) && player->CanAct()) player->PlaySound(SPEECH_66, 0); } }
--- a/mm7_4.cpp Sat May 25 18:46:48 2013 +0100 +++ b/mm7_4.cpp Sat May 25 23:50:56 2013 +0400 @@ -2382,7 +2382,7 @@ viewparams->bRedrawGameUI = 1; while ( 1 ) { - if ( pPlayers[v12]->WearsItem(516, 3) + if ( pPlayers[v12]->WearsItem(ITEM_RELIC_HARECS_LEATHER, EQUIP_ARMOUR) || pPlayers[v12]->HasEnchantedItemEquipped(71) || pPlayers[v12]->pPlayerBuffs[23].uExpireTime > 0 ) {
--- a/mm7_6.cpp Sat May 25 18:46:48 2013 +0100 +++ b/mm7_6.cpp Sat May 25 23:50:56 2013 +0400 @@ -2829,7 +2829,7 @@ pSpellSprite.spell_id = pCastSpell->spellnum; pSpellSprite.spell_skill = v731; pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); - if ( pPlayer->WearsItem(510, 2) ) + if ( pPlayer->WearsItem(ITEM_ARTEFACT_ULLYSES, EQUIP_BOW) ) pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(0xBD6u); pSpellSprite.vPosition.x = pParty->vPosition.x; pSpellSprite.vPosition.y = pParty->vPosition.y; @@ -6750,7 +6750,7 @@ Vec3_int_::Normalize(&a3.x, &a3.y, &a3.z); DamageMonsterFromParty(PID(OBJECT_Player, uActiveCharacter - 1), target_id, &a3); - if (player->WearsItem(ITEM_ARTIFACT_SPLITTER, 1) || player->WearsItem(ITEM_ARTIFACT_SPLITTER, 0)) + if (player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_MAIN_HAND) || player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_OFF_HAND)) _42FA66_do_explosive_impact( actor->vPosition.x, actor->vPosition.y,