comparison Player.cpp @ 1064:655fde266d96

GetSkillBonus cleaning in progress
author Gloval
date Fri, 24 May 2013 08:16:36 +0400
parents efe228ab5003
children 938af16d5b88
comparison
equal deleted inserted replaced
1059:0e0f1192aa57 1064:655fde266d96
5405 } 5405 }
5406 5406
5407 //----- (0048F882) -------------------------------------------------------- 5407 //----- (0048F882) --------------------------------------------------------
5408 int Player::GetActualSkillLevel( PLAYER_SKILL_TYPE uSkillType ) 5408 int Player::GetActualSkillLevel( PLAYER_SKILL_TYPE uSkillType )
5409 { 5409 {
5410 signed int v2; // esi@1 5410 signed int bonus_value; // esi@1
5411 unsigned __int16 v3; // ax@126 5411 unsigned __int16 skill_value; // ax@126
5412 char result; // al@127 5412 int result; // al@127
5413 unsigned int v5; // [sp-4h] [bp-14h]@13
5414 signed int v6; // [sp-4h] [bp-14h]@27
5415 //unsigned int v7; // [sp-4h] [bp-14h]@35
5416 CHARACTER_ATTRIBUTE_TYPE v8; // [sp-4h] [bp-14h]@68
5417 //Player *v9; // [sp+Ch] [bp-4h]@1
5418 5413
5419 v2 = 0; 5414 bonus_value = 0;
5420 switch (uSkillType) 5415 switch (uSkillType)
5421 { 5416 {
5422 case PLAYER_SKILL_MONSTER_ID: 5417 case PLAYER_SKILL_MONSTER_ID:
5423 { 5418 {
5424 if ( CheckHiredNPCSpeciality(Hunter) ) 5419 if ( CheckHiredNPCSpeciality(Hunter) )
5425 v2 = 6; 5420 bonus_value = 6;
5426 if ( CheckHiredNPCSpeciality(Sage) ) 5421 if ( CheckHiredNPCSpeciality(Sage) )
5427 v2 += 6; 5422 bonus_value += 6;
5428 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID, 0); 5423 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID, 0);
5429 } 5424 }
5430 break; 5425 break;
5431 5426
5432 case PLAYER_SKILL_ARMSMASTER: 5427 case PLAYER_SKILL_ARMSMASTER:
5433 { 5428 {
5434 if ( CheckHiredNPCSpeciality(Armsmaster) ) 5429 if ( CheckHiredNPCSpeciality(Armsmaster) )
5435 v2 = 2; 5430 bonus_value = 2;
5436 if ( CheckHiredNPCSpeciality(Weaponsmaster) ) 5431 if ( CheckHiredNPCSpeciality(Weaponsmaster) )
5437 v2 += 3; 5432 bonus_value += 3;
5438 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER, 0); 5433 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER, 0);
5439 } 5434 }
5440 break; 5435 break;
5441 5436
5442 case PLAYER_SKILL_STEALING: 5437 case PLAYER_SKILL_STEALING:
5443 { 5438 {
5444 if (CheckHiredNPCSpeciality(Burglar)) 5439 if (CheckHiredNPCSpeciality(Burglar))
5445 v2 = 8; 5440 bonus_value = 8;
5446 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_STEALING, 0); 5441 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_STEALING, 0);
5447 } 5442 }
5448 break; 5443 break;
5449 5444
5450 5445
5451 case PLAYER_SKILL_ALCHEMY: 5446 case PLAYER_SKILL_ALCHEMY:
5452 { 5447 {
5453 if ( CheckHiredNPCSpeciality(Herbalist) ) 5448 if ( CheckHiredNPCSpeciality(Herbalist) )
5454 v2 = 4; 5449 bonus_value = 4;
5455 if ( CheckHiredNPCSpeciality(Apothecary) ) 5450 if ( CheckHiredNPCSpeciality(Apothecary) )
5456 v2 += 8; 5451 bonus_value += 8;
5457 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ALCHEMY, 0); 5452 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ALCHEMY, 0);
5458 } 5453 }
5459 break; 5454 break;
5460 5455
5461 case PLAYER_SKILL_LEARNING: 5456 case PLAYER_SKILL_LEARNING:
5462 { 5457 {
5463 if ( CheckHiredNPCSpeciality(Teacher) ) 5458 if ( CheckHiredNPCSpeciality(Teacher) )
5464 v2 = 10; 5459 bonus_value = 10;
5465 if ( CheckHiredNPCSpeciality(Instructor) ) 5460 if ( CheckHiredNPCSpeciality(Instructor) )
5466 v2 += 15; 5461 bonus_value += 15;
5467 if ( CheckHiredNPCSpeciality(Scholar) ) 5462 if ( CheckHiredNPCSpeciality(Scholar) )
5468 v2 += 5; 5463 bonus_value += 5;
5469 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LEARNING, 0); 5464 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LEARNING, 0);
5470 } 5465 }
5471 break; 5466 break;
5472 5467
5473 case PLAYER_SKILL_UNARMED: 5468 case PLAYER_SKILL_UNARMED:
5474 { 5469 {
5475 if (CheckHiredNPCSpeciality(Monk) ) 5470 if (CheckHiredNPCSpeciality(Monk) )
5476 v2 = 2; 5471 bonus_value = 2;
5477 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_UNARMED, 0); 5472 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_UNARMED, 0);
5478 } 5473 }
5479 break; 5474 break;
5480 5475
5481 case PLAYER_SKILL_DODGE: 5476 case PLAYER_SKILL_DODGE:
5482 { 5477 {
5483 if ( CheckHiredNPCSpeciality(Monk) ) 5478 if ( CheckHiredNPCSpeciality(Monk) )
5484 v2 = 2; 5479 bonus_value = 2;
5485 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DODGE, 0); 5480 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DODGE, 0);
5486 } 5481 }
5487 break; 5482 break;
5488 5483
5489 case PLAYER_SKILL_BOW: 5484 case PLAYER_SKILL_BOW:
5490 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BOW, 0); 5485 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BOW, 0);
5491 break; 5486 break;
5492 case PLAYER_SKILL_SHIELD: 5487 case PLAYER_SKILL_SHIELD:
5493 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SHIELD, 0); 5488 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SHIELD, 0);
5494 break; 5489 break;
5495 5490
5496 case PLAYER_SKILL_EARTH: 5491 case PLAYER_SKILL_EARTH:
5497 if ( CheckHiredNPCSpeciality(Apprentice) ) 5492 if ( CheckHiredNPCSpeciality(Apprentice) )
5498 v2 = 2; 5493 bonus_value = 2;
5499 if ( CheckHiredNPCSpeciality(Mystic) ) 5494 if ( CheckHiredNPCSpeciality(Mystic) )
5500 v2 += 3; 5495 bonus_value += 3;
5501 if ( CheckHiredNPCSpeciality(Spellmaster) ) 5496 if ( CheckHiredNPCSpeciality(Spellmaster) )
5502 v2 += 4; 5497 bonus_value += 4;
5503 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) 5498 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() )
5504 v2 += 3; 5499 bonus_value += 3;
5505 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_EARTH, 0); 5500 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_EARTH, 0);
5506 break; 5501 break;
5507 case PLAYER_SKILL_FIRE: 5502 case PLAYER_SKILL_FIRE:
5508 if ( CheckHiredNPCSpeciality(Apprentice) ) 5503 if ( CheckHiredNPCSpeciality(Apprentice) )
5509 v2 = 2; 5504 bonus_value = 2;
5510 if ( CheckHiredNPCSpeciality(Mystic) ) 5505 if ( CheckHiredNPCSpeciality(Mystic) )
5511 v2 += 3; 5506 bonus_value += 3;
5512 if ( CheckHiredNPCSpeciality(Spellmaster) ) 5507 if ( CheckHiredNPCSpeciality(Spellmaster) )
5513 v2 += 4; 5508 bonus_value += 4;
5514 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) 5509 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() )
5515 v2 += 3; 5510 bonus_value += 3;
5516 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_FIRE, 0); 5511 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_FIRE, 0);
5517 break; 5512 break;
5518 case PLAYER_SKILL_AIR: 5513 case PLAYER_SKILL_AIR:
5519 if ( CheckHiredNPCSpeciality(Apprentice) ) 5514 if ( CheckHiredNPCSpeciality(Apprentice) )
5520 v2 = 2; 5515 bonus_value = 2;
5521 if ( CheckHiredNPCSpeciality(Mystic) ) 5516 if ( CheckHiredNPCSpeciality(Mystic) )
5522 v2 += 3; 5517 bonus_value += 3;
5523 if ( CheckHiredNPCSpeciality(Spellmaster) ) 5518 if ( CheckHiredNPCSpeciality(Spellmaster) )
5524 v2 += 4; 5519 bonus_value += 4;
5525 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) 5520 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() )
5526 v2 += 3; 5521 bonus_value += 3;
5527 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_AIR, 0); 5522 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_AIR, 0);
5528 break; 5523 break;
5529 case PLAYER_SKILL_WATER: 5524 case PLAYER_SKILL_WATER:
5530 if ( CheckHiredNPCSpeciality(Apprentice) ) 5525 if ( CheckHiredNPCSpeciality(Apprentice) )
5531 v2 = 2; 5526 bonus_value = 2;
5532 if ( CheckHiredNPCSpeciality(Mystic) ) 5527 if ( CheckHiredNPCSpeciality(Mystic) )
5533 v2 += 3; 5528 bonus_value += 3;
5534 if ( CheckHiredNPCSpeciality(Spellmaster) ) 5529 if ( CheckHiredNPCSpeciality(Spellmaster) )
5535 v2 += 4; 5530 bonus_value += 4;
5536 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) 5531 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() )
5537 v2 += 3; 5532 bonus_value += 3;
5538 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_WATER, 0); 5533 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_WATER, 0);
5539 break; 5534 break;
5540 case PLAYER_SKILL_SPIRIT: 5535 case PLAYER_SKILL_SPIRIT:
5541 if ( CheckHiredNPCSpeciality(Acolyte2) ) 5536 if ( CheckHiredNPCSpeciality(Acolyte2) )
5542 v2 = 2; 5537 bonus_value = 2;
5543 if ( CheckHiredNPCSpeciality(Initiate) ) 5538 if ( CheckHiredNPCSpeciality(Initiate) )
5544 v2 += 3; 5539 bonus_value += 3;
5545 if ( CheckHiredNPCSpeciality(Prelate) ) 5540 if ( CheckHiredNPCSpeciality(Prelate) )
5546 v2 += 4; 5541 bonus_value += 4;
5547 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SPIRIT, 0); 5542 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SPIRIT, 0);
5548 break; 5543 break;
5549 case PLAYER_SKILL_MIND: 5544 case PLAYER_SKILL_MIND:
5550 if ( CheckHiredNPCSpeciality(Acolyte2) ) 5545 if ( CheckHiredNPCSpeciality(Acolyte2) )
5551 v2 = 2; 5546 bonus_value = 2;
5552 if ( CheckHiredNPCSpeciality(Initiate) ) 5547 if ( CheckHiredNPCSpeciality(Initiate) )
5553 v2 += 3; 5548 bonus_value += 3;
5554 if ( CheckHiredNPCSpeciality(Prelate) ) 5549 if ( CheckHiredNPCSpeciality(Prelate) )
5555 v2 += 4; 5550 bonus_value += 4;
5556 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MIND, 0); 5551 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MIND, 0);
5557 break; 5552 break;
5558 case PLAYER_SKILL_BODY: 5553 case PLAYER_SKILL_BODY:
5559 if ( CheckHiredNPCSpeciality(Acolyte2) ) 5554 if ( CheckHiredNPCSpeciality(Acolyte2) )
5560 v2 = 2; 5555 bonus_value = 2;
5561 if ( CheckHiredNPCSpeciality(Initiate) ) 5556 if ( CheckHiredNPCSpeciality(Initiate) )
5562 v2 += 3; 5557 bonus_value += 3;
5563 if ( CheckHiredNPCSpeciality(Prelate) ) 5558 if ( CheckHiredNPCSpeciality(Prelate) )
5564 v2 += 4; 5559 bonus_value += 4;
5565 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BODY, 0); 5560 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BODY, 0);
5566 break; 5561 break;
5567 case PLAYER_SKILL_LIGHT: 5562 case PLAYER_SKILL_LIGHT:
5568 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LIGHT, 0); 5563 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LIGHT, 0);
5569 break; 5564 break;
5570 case PLAYER_SKILL_DARK: 5565 case PLAYER_SKILL_DARK:
5571 { 5566 {
5572 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DARK, 0); 5567 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DARK, 0);
5573 } 5568 }
5574 break; 5569 break;
5575 5570
5576 case PLAYER_SKILL_MERCHANT: 5571 case PLAYER_SKILL_MERCHANT:
5577 { 5572 {
5578 if ( CheckHiredNPCSpeciality(Trader) ) 5573 if ( CheckHiredNPCSpeciality(Trader) )
5579 v2 = 4; 5574 bonus_value = 4;
5580 if ( CheckHiredNPCSpeciality(Merchant) ) 5575 if ( CheckHiredNPCSpeciality(Merchant) )
5581 v2 += 6; 5576 bonus_value += 6;
5582 if ( CheckHiredNPCSpeciality(Gypsy) ) 5577 if ( CheckHiredNPCSpeciality(Gypsy) )
5583 v2 += 3; 5578 bonus_value += 3;
5584 if ( CheckHiredNPCSpeciality(Duper) ) 5579 if ( CheckHiredNPCSpeciality(Duper) )
5585 v2 += 8; 5580 bonus_value += 8;
5586 } 5581 }
5587 break; 5582 break;
5588 5583
5589 case PLAYER_SKILL_PERCEPTION: 5584 case PLAYER_SKILL_PERCEPTION:
5590 { 5585 {
5591 if ( CheckHiredNPCSpeciality(Scout) ) 5586 if ( CheckHiredNPCSpeciality(Scout) )
5592 v2 = 6; 5587 bonus_value = 6;
5593 if ( CheckHiredNPCSpeciality(Psychic) ) 5588 if ( CheckHiredNPCSpeciality(Psychic) )
5594 v2 += 5; 5589 bonus_value += 5;
5595 } 5590 }
5596 break; 5591 break;
5597 5592
5598 case PLAYER_SKILL_ITEM_ID: 5593 case PLAYER_SKILL_ITEM_ID:
5599 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ITEM_ID, 0); 5594 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ITEM_ID, 0);
5600 break; 5595 break;
5601 case PLAYER_SKILL_MEDITATION: 5596 case PLAYER_SKILL_MEDITATION:
5602 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MEDITATION, 0); 5597 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MEDITATION, 0);
5603 break; 5598 break;
5604 case PLAYER_SKILL_TRAP_DISARM: 5599 case PLAYER_SKILL_TRAP_DISARM:
5605 { 5600 {
5606 if ( CheckHiredNPCSpeciality(Tinker) ) 5601 if ( CheckHiredNPCSpeciality(Tinker) )
5607 v2 = 4; 5602 bonus_value = 4;
5608 if ( CheckHiredNPCSpeciality(Locksmith) ) 5603 if ( CheckHiredNPCSpeciality(Locksmith) )
5609 v2 += 6; 5604 bonus_value += 6;
5610 if ( CheckHiredNPCSpeciality(Burglar) ) 5605 if ( CheckHiredNPCSpeciality(Burglar) )
5611 v2 += 8; 5606 bonus_value += 8;
5612 v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM, 0); 5607 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM, 0);
5613 } 5608 }
5614 break; 5609 break;
5615 } 5610 }
5616 5611
5617 v3 = pActiveSkills[uSkillType]; 5612 skill_value = pActiveSkills[uSkillType];
5618 if ( v2 + (v3 & 0x3F) < 60 ) 5613 if ( bonus_value + (skill_value & 0x3F) < 60 )
5619 result = v2 + v3; 5614 result = bonus_value + skill_value;
5620 else 5615 else
5621 result = v3 & 0xFFFC | 0x3C; //al 5616 result = skill_value & 0xFFFC | 0x3C; //al
5622 return result; 5617 return result;
5623 } 5618 }
5624 5619
5625 //----- (0048FC00) -------------------------------------------------------- 5620 //----- (0048FC00) --------------------------------------------------------
5626 int Player::GetSkillBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) 5621 int Player::GetSkillBonus(enum CHARACTER_ATTRIBUTE_TYPE a2)
5627 { 5622 {
5623
5624
5625
5628 Player *v2; // esi@1 5626 Player *v2; // esi@1
5629 int v3; // eax@1 5627 int armmaster_skill; // eax@1
5630 char v4; // di@1 5628 char v4; // di@1
5631 signed int v5; // ebx@1 5629 signed int v5; // ebx@1
5632 unsigned int v6; // eax@2 5630 unsigned int armaster_mastery; // eax@2
5633 unsigned __int8 v7; // sf@5 5631 unsigned __int8 v7; // sf@5
5634 unsigned __int8 v8; // of@5 5632 unsigned __int8 v8; // of@5
5635 PlayerEquipment *v9; // ebx@19 5633 PlayerEquipment *v9; // ebx@19
5636 Player *v10; // ecx@20 5634 Player *v10; // ecx@20
5637 PLAYER_SKILL_TYPE v11; // edi@21 5635 PLAYER_SKILL_TYPE v11; // edi@21
5680 unsigned __int16 v55; // ax@118 5678 unsigned __int16 v55; // ax@118
5681 char v56; // si@118 5679 char v56; // si@118
5682 unsigned int v57; // eax@118 5680 unsigned int v57; // eax@118
5683 int v58; // esi@121 5681 int v58; // esi@121
5684 signed int j; // ecx@121 5682 signed int j; // ecx@121
5685 int v60; // edi@126 5683 int base_value; // edi@126
5686 int v61; // eax@126 5684 int attrib_modif; // eax@126
5687 signed int v62; // [sp-4h] [bp-30h]@26 5685 signed int v62; // [sp-4h] [bp-30h]@26
5688 signed int v63; // [sp-4h] [bp-30h]@80 5686 signed int v63; // [sp-4h] [bp-30h]@80
5689 int v64; // [sp+Ch] [bp-20h]@104 5687 int v64; // [sp+Ch] [bp-20h]@104
5690 int v65; // [sp+10h] [bp-1Ch]@104 5688 int v65; // [sp+10h] [bp-1Ch]@104
5691 int v66; // [sp+14h] [bp-18h]@104 5689 int v66; // [sp+14h] [bp-18h]@104
5695 int v70; // [sp+24h] [bp-8h]@1 5693 int v70; // [sp+24h] [bp-8h]@1
5696 ITEM_EQUIP_TYPE v71; // [sp+28h] [bp-4h]@1 5694 ITEM_EQUIP_TYPE v71; // [sp+28h] [bp-4h]@1
5697 int a1; // [sp+34h] [bp+8h]@21 5695 int a1; // [sp+34h] [bp+8h]@21
5698 int a1a; // [sp+34h] [bp+8h]@74 5696 int a1a; // [sp+34h] [bp+8h]@74
5699 signed int a1b; // [sp+34h] [bp+8h]@94 5697 signed int a1b; // [sp+34h] [bp+8h]@94
5698 int multiplier;
5699 int arm_bonus;
5700 int lvl_avl[4];
5700 5701
5701 v2 = this; 5702 v2 = this;
5702 v70 = 0; 5703 v70 = 0;
5703 v69 = 0; 5704 v69 = 0;
5705 multiplier =0;
5706 arm_bonus =0;
5704 v71 = (ITEM_EQUIP_TYPE)0; 5707 v71 = (ITEM_EQUIP_TYPE)0;
5705 LOBYTE(v3) = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER); 5708 armmaster_skill = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER);
5706 v4 = v3; 5709 v4 = armmaster_skill;
5707 v5 = 1; 5710 v5 = 1;
5708 if ( v3 ) 5711 if ( armmaster_skill )
5709 { 5712 {
5710 v6 = SkillToMastery(v3); 5713 armaster_mastery = SkillToMastery(armmaster_skill);
5711 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) 5714 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS )
5712 { 5715 {
5713 if ( (signed int)v6 >= 4 ) 5716 if ( armaster_mastery == 4 )
5714 goto LABEL_4; 5717 multiplier =2;
5715 v8 = __OFSUB__(v6, 3); 5718 else if ( armaster_mastery == 3 )
5716 v7 = ((v6 - 3) & 0x80000000u) != 0; 5719 multiplier =1;
5717 } 5720 }
5718 else 5721 else if ( a2 == CHARACTER_ATTRIBUTE_ATTACK )
5719 { 5722 {
5720 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) 5723 if ( armaster_mastery == 4 )
5721 goto LABEL_11; 5724 multiplier =2;
5722 if ( (signed int)v6 >= 4 ) 5725 else if ( armaster_mastery >= 2 )
5723 { 5726 multiplier =1;
5724 LABEL_4: 5727 }
5725 v71 = (ITEM_EQUIP_TYPE)2; 5728 arm_bonus=(armmaster_skill&0x3F)*multiplier;
5726 LABEL_11: 5729 }
5727 v69 = (PlayerEquipment *)(v71 * (v4 & 0x3F)); 5730
5728 goto LABEL_12; 5731
5729 }
5730 v8 = __OFSUB__(v6, 2);
5731 v7 = ((v6 - 2) & 0x80000000u) != 0;
5732 }
5733 if ( !(v7 ^ v8) )
5734 v71 = (ITEM_EQUIP_TYPE)1;
5735 goto LABEL_11;
5736 }
5737 LABEL_12:
5738 if ( a2 == CHARACTER_ATTRIBUTE_HEALTH ) 5732 if ( a2 == CHARACTER_ATTRIBUTE_HEALTH )
5739 { 5733 {
5740 v60 = pBaseHealthPerLevelByClass[v2->classType]; 5734 base_value = pBaseHealthPerLevelByClass[classType];
5741 v61 = v2->GetBodybuilding(); 5735 attrib_modif = GetBodybuilding();
5742 return v60 * v61; 5736 return base_value * attrib_modif;
5743 } 5737 }
5744 if ( a2 == CHARACTER_ATTRIBUTE_MANA ) 5738 if ( a2 == CHARACTER_ATTRIBUTE_MANA )
5745 { 5739 {
5746 v60 = pBaseManaPerLevelByClass[v2->classType]; 5740 base_value = pBaseManaPerLevelByClass[classType];
5747 v61 = v2->GetMeditation(); 5741 attrib_modif = GetMeditation();
5748 return v60 * v61; 5742 return base_value * attrib_modif;
5749 } 5743 }
5744 if ( a2 == CHARACTER_ATTRIBUTE_AC_BONUS )
5745 {
5746 a1b = 0;
5747 v71 = (ITEM_EQUIP_TYPE)0;
5748
5749 for (j=0; j<16; ++j)
5750 {
5751 if (pEquipment.pIndices[j]&&(!pOwnItems[ pEquipment.pIndices[j]].Broken()))
5752 {
5753 int curr_item =pOwnItems[pEquipment.pIndices[j]].uItemID;
5754 v44=pItemsTable->pItems[curr_item].uSkillType;
5755 switch (v44)
5756 {
5757
5758 case PLAYER_SKILL_STAFF:
5759
5760 lvl_avl[0]=0;
5761 lvl_avl[1]=1;
5762 lvl_avl[2]=0;
5763 lvl_avl[3]=0;
5764 break;
5765 case PLAYER_SKILL_SWORD:
5766 case PLAYER_SKILL_SPEAR:
5767 lvl_avl[0]=0;
5768 lvl_avl[1]=0;
5769 lvl_avl[2]=0;
5770 lvl_avl[3]=1;
5771 break;
5772 case PLAYER_SKILL_SHIELD:
5773 a1b = 1;
5774 lvl_avl[0]=1;
5775 lvl_avl[1]=0;
5776 lvl_avl[2]=1;
5777 lvl_avl[3]=0;
5778 break;
5779 case PLAYER_SKILL_LEATHER:
5780 v71 = (ITEM_EQUIP_TYPE)1;
5781 lvl_avl[0]=1;
5782 lvl_avl[1]=0;
5783 lvl_avl[2]=1;
5784 lvl_avl[3]=0;
5785
5786 break;
5787 case PLAYER_SKILL_CHAIN:
5788 a1b = 1;
5789 lvl_avl[0]=1;
5790 lvl_avl[1]=0;
5791 lvl_avl[2]=0;
5792 lvl_avl[3]=0;
5793 break;
5794 case PLAYER_SKILL_PLATE:
5795 a1b = 1;
5796 lvl_avl[0]=1;
5797 lvl_avl[1]=0;
5798 lvl_avl[2]=0;
5799 lvl_avl[3]=0;
5800 break;
5801 default:
5802 continue;
5803 }
5804
5805 v50= GetActualSkillLevel((PLAYER_SKILL_TYPE)v44);
5806 v51 = v50;
5807 v52 = SkillToMastery(v50);
5808 v53 = v51 & 0x3F;
5809 for ( i = 0; i < (signed int)v52; ++i )
5810 {
5811 if ( lvl_avl[i] )
5812 v70 += v53;
5813 }
5814
5815 }
5816 }
5817
5818 lvl_avl[0]=1;
5819 lvl_avl[1]=1;
5820 lvl_avl[2]=1;
5821 lvl_avl[3]=0;
5822
5823 v55 = GetActualSkillLevel(PLAYER_SKILL_DODGE);
5824 v56 = v55;
5825 v57 = SkillToMastery(v55);
5826 if ( !a1b && (!v71 || v57 == 4) )
5827 {
5828 v58 = v56 & 0x3F;
5829 for ( j = 0; j < (signed int)v57; ++j )
5830 {
5831 if ( lvl_avl[i] )
5832 v70 += v58;
5833 }
5834 }
5835 return v70;
5836
5837
5838 }
5839
5750 if ( a2 != 9 ) 5840 if ( a2 != 9 )
5751 { 5841 {
5752 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) 5842 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK )
5753 { 5843 {
5754 if ( a2 <= CHARACTER_ATTRIBUTE_ATTACK ) 5844 if ( a2 <= CHARACTER_ATTRIBUTE_ATTACK )
5904 v68 = 0; 5994 v68 = 0;
5905 while ( 1 ) 5995 while ( 1 )
5906 { 5996 {
5907 if ( v2->HasItemEquipped(v35) ) 5997 if ( v2->HasItemEquipped(v35) )
5908 { 5998 {
5909 v37 = *(int *)&v2->pInventoryItems[v35].uItemID; 5999 v37 = v2->pInventoryItems[v35].uItemID;
5910 if ( pItemsTable->pItems[v37].uEquipType <= 1u ) 6000 if ( pItemsTable->pItems[v37].uEquipType <= 1u )
5911 break; 6001 break;
5912 } 6002 }
5913 v35 = (ITEM_EQUIP_TYPE)((int)v35 + 1); 6003 v35 = (ITEM_EQUIP_TYPE)((int)v35 + 1);
5914 if ( (signed int)v35 >= 16 ) 6004 if ( (signed int)v35 >= 16 )
5970 } 6060 }
5971 } 6061 }
5972 v30 = v68 + v71 * (a1a & 0x3F); 6062 v30 = v68 + v71 * (a1a & 0x3F);
5973 return (int)((char *)v69 + v30); 6063 return (int)((char *)v69 + v30);
5974 } 6064 }
5975 a1b = 0; 6065
5976 v71 = (ITEM_EQUIP_TYPE)0;
5977 v68 = 16;
5978 v69 = &v2->pEquipment;
5979 do
5980 {
5981 if ( !v69->uShield || (v42 = (int)((char *)v2 + 36 * v69->uShield), *(char *)(v42 + 516) & 2) )
5982 goto LABEL_117;
5983 v43 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[*(int *)(v42 + 496)].uSkillType;
5984 v44 = pItemsTable->pItems[*(int *)(v42 + 496)].uSkillType;
5985 if ( !v44 )
5986 {
5987 v64 = 0;
5988 v65 = 1;
5989 LABEL_111:
5990 v66 = 0;
5991 goto LABEL_112;
5992 }
5993 v45 = v44 - 1;
5994 if ( !v45 || (v46 = v45 - 3) == 0 )
5995 {
5996 v64 = 0;
5997 v65 = 0;
5998 v66 = 0;
5999 v67 = 1;
6000 goto LABEL_113;
6001 }
6002 v47 = v46 - 4;
6003 if ( v47 )
6004 {
6005 v48 = v47 - 1;
6006 if ( v48 )
6007 {
6008 v49 = v48 - 1;
6009 if ( v49 )
6010 {
6011 if ( v49 != 1 )
6012 goto LABEL_117;
6013 a1b = 1;
6014 v64 = 1;
6015 v65 = 0;
6016 v66 = 0;
6017 v67 = 0;
6018 goto LABEL_113;
6019 }
6020 a1b = 1;
6021 v64 = 1;
6022 v65 = 0;
6023 goto LABEL_111;
6024 }
6025 v71 = (ITEM_EQUIP_TYPE)1;
6026 }
6027 else
6028 {
6029 a1b = 1;
6030 }
6031 v64 = 1;
6032 v65 = 0;
6033 v66 = 1;
6034 LABEL_112:
6035 v67 = 0;
6036 LABEL_113:
6037 LOBYTE(v50) = v2->GetActualSkillLevel(v43);
6038 v51 = v50;
6039 v52 = SkillToMastery(v50);
6040 v53 = v51 & 0x3F;
6041 for ( i = 0; i < (signed int)v52; ++i )
6042 {
6043 if ( *(&v64 + i) )
6044 v70 += v53;
6045 }
6046 LABEL_117:
6047 v69 = (PlayerEquipment *)((char *)v69 + 4);
6048 --v68;
6049 }
6050 while ( v68 );
6051 v64 = 1;
6052 v65 = 1;
6053 v66 = 1;
6054 v67 = 0;
6055 LOBYTE(v55) = v2->GetActualSkillLevel(PLAYER_SKILL_DODGE);
6056 v56 = v55;
6057 v57 = SkillToMastery(v55);
6058 if ( !a1b && (!v71 || v57 == 4) )
6059 {
6060 v58 = v56 & 0x3F;
6061 for ( j = 0; j < (signed int)v57; ++j )
6062 {
6063 if ( *(&v64 + j) )
6064 v70 += v58;
6065 }
6066 }
6067 return v70;
6068 } 6066 }
6069 6067
6070 //----- (00490109) -------------------------------------------------------- 6068 //----- (00490109) --------------------------------------------------------
6071 // faces are: 0 1 2 3 human males 6069 // faces are: 0 1 2 3 human males
6072 // 4 5 6 7 human females 6070 // 4 5 6 7 human females