Mercurial > mm7
comparison Player.cpp @ 1324:78f0f74eab1d
GetActual(stat) functions changed to similar code
author | Grumpy7 |
---|---|
date | Tue, 02 Jul 2013 00:39:26 +0200 |
parents | 0665a061132b |
children | d9e4c0bbb2d2 |
comparison
equal
deleted
inserted
replaced
1323:bfde0563ecdc | 1324:78f0f74eab1d |
---|---|
2400 } | 2400 } |
2401 | 2401 |
2402 //----- (0048C93C) -------------------------------------------------------- | 2402 //----- (0048C93C) -------------------------------------------------------- |
2403 int Player::GetActualMight() | 2403 int Player::GetActualMight() |
2404 { | 2404 { |
2405 Player *v1; // esi@1 | 2405 uint uActualAge = GetBaseAge() + this->sAgeModifier; |
2406 unsigned int v2; // eax@1 | 2406 uint uAgeingMultiplier = 100; |
2407 signed int v3; // ecx@1 | 2407 for (uint i = 0; i < 4; ++i) |
2408 signed int v4; // ebx@4 | 2408 if (uActualAge >= pAgeingTable[i]) |
2409 int v5; // edi@5 | 2409 uAgeingMultiplier = pAgeingStrengthMultiplier[i]; |
2410 int v6; // ST14_4@5 | 2410 else break; |
2411 | 2411 |
2412 v1 = this; | 2412 auto uConditionMult = pConditionStrengthMultiplier[GetMajorConditionIdx()]; |
2413 v2 = this->sAgeModifier + GetBaseAge(); | 2413 return uConditionMult * uAgeingMultiplier * uMight / 100 / 100 |
2414 v3 = 0; | 2414 + GetMagicalBonus(CHARACTER_ATTRIBUTE_STRENGTH) |
2415 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | 2415 + GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH, 0) |
2416 { | 2416 + uMightBonus; |
2417 ++v3; | |
2418 if ( v3 >= 4 ) | |
2419 { | |
2420 v4 = 100; | |
2421 goto LABEL_5; | |
2422 } | |
2423 } | |
2424 v4 = pAgeingStrengthMultiplier[v3]; | |
2425 LABEL_5: | |
2426 v5 = pConditionStrengthMultiplier[GetMajorConditionIdx()]; | |
2427 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH, 0); | |
2428 return v5 * v4 * v1->uMight / 100 / 100 + GetMagicalBonus((CHARACTER_ATTRIBUTE_TYPE)0) + v6 + v1->uMightBonus; | |
2429 } | 2417 } |
2430 | 2418 |
2431 //----- (0048C9C2) -------------------------------------------------------- | 2419 //----- (0048C9C2) -------------------------------------------------------- |
2432 int Player::GetActualIntelligence() | 2420 int Player::GetActualIntelligence() |
2433 { | 2421 { |
2434 Player *v1; // esi@1 | 2422 uint uActualAge = GetBaseAge() + this->sAgeModifier; |
2435 unsigned int sAge; // eax@1 | 2423 uint uAgeingMultiplier = 100; |
2436 signed int uAgeLevel; // ecx@1 | 2424 for (uint i = 0; i < 4; ++i) |
2437 signed int v4; // ebx@4 | 2425 if (uActualAge >= pAgeingTable[i]) |
2438 int v5; // edi@5 | 2426 uAgeingMultiplier = pAgeingIntelligenceMultiplier[i]; |
2439 int v6; // ebp@5 | 2427 else break; |
2440 | 2428 |
2441 v1 = this; | 2429 auto uConditionMult = pConditionIntelligenceMultiplier[GetMajorConditionIdx()]; |
2442 sAge = this->sAgeModifier + GetBaseAge(); | 2430 return uConditionMult * uAgeingMultiplier * uIntelligence / 100 / 100 |
2443 uAgeLevel = 0; | |
2444 while ( (signed int)sAge >= (signed int)pAgeingTable[uAgeLevel] ) | |
2445 { | |
2446 ++uAgeLevel; | |
2447 if ( uAgeLevel >= 4 ) | |
2448 { | |
2449 v4 = 100; | |
2450 goto LABEL_5; | |
2451 } | |
2452 } | |
2453 v4 = pAgeingIntelligenceMultiplier[uAgeLevel]; | |
2454 LABEL_5: | |
2455 v5 = pConditionIntelligenceMultiplier[GetMajorConditionIdx()]; | |
2456 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE, 0); | |
2457 return v5 * v4 * v1->uIntelligence / 100 / 100 | |
2458 + GetMagicalBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE) | 2431 + GetMagicalBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE) |
2459 + v6 | 2432 + GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE, 0) |
2460 + v1->uIntelligenceBonus; | 2433 + uIntelligenceBonus; |
2461 } | 2434 } |
2462 | 2435 |
2463 //----- (0048CA3F) -------------------------------------------------------- | 2436 //----- (0048CA3F) -------------------------------------------------------- |
2464 int Player::GetActualWillpower() | 2437 int Player::GetActualWillpower() |
2465 { | 2438 { |
2466 int v5; // edi@5 | |
2467 | |
2468 uint uActualAge = GetBaseAge() + sAgeModifier; | 2439 uint uActualAge = GetBaseAge() + sAgeModifier; |
2469 uint uAgeingMultiplier = 100; | 2440 uint uAgeingMultiplier = 100; |
2470 for (uint i = 0; i < 4; ++i) | 2441 for (uint i = 0; i < 4; ++i) |
2471 if (uActualAge >= pAgeingTable[i]) | 2442 if (uActualAge >= pAgeingTable[i]) |
2472 uAgeingMultiplier = pAgeingWillpowerMultiplier[i]; | 2443 uAgeingMultiplier = pAgeingWillpowerMultiplier[i]; |
2473 else break; | 2444 else break; |
2474 | 2445 |
2475 v5 = pConditionWillpowerMultiplier[GetMajorConditionIdx()]; | 2446 auto uConditionMult = pConditionWillpowerMultiplier[GetMajorConditionIdx()]; |
2476 return v5 * uAgeingMultiplier * uWillpower / 100 / 100 | 2447 return uConditionMult * uAgeingMultiplier * uWillpower / 100 / 100 |
2477 + GetMagicalBonus(CHARACTER_ATTRIBUTE_WILLPOWER) | 2448 + GetMagicalBonus(CHARACTER_ATTRIBUTE_WILLPOWER) |
2478 + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER, 0) | 2449 + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER, 0) |
2479 + uWillpowerBonus; | 2450 + uWillpowerBonus; |
2480 } | 2451 } |
2481 | 2452 |
2488 if (uActualAge >= pAgeingTable[i]) | 2459 if (uActualAge >= pAgeingTable[i]) |
2489 uAgeingMultiplier = pAgeingEnduranceMultiplier[i]; | 2460 uAgeingMultiplier = pAgeingEnduranceMultiplier[i]; |
2490 else break; | 2461 else break; |
2491 | 2462 |
2492 auto uConditionMult = pConditionEnduranceMultiplier[GetMajorConditionIdx()]; | 2463 auto uConditionMult = pConditionEnduranceMultiplier[GetMajorConditionIdx()]; |
2493 auto uItemBonus = GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0); | |
2494 return uConditionMult * uAgeingMultiplier * uEndurance / 100 / 100 | 2464 return uConditionMult * uAgeingMultiplier * uEndurance / 100 / 100 |
2495 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ENDURANCE) | 2465 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ENDURANCE) |
2496 + uItemBonus | 2466 + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) |
2497 + uEnduranceBonus; | 2467 + uEnduranceBonus; |
2498 } | 2468 } |
2499 | 2469 |
2500 //----- (0048CB39) -------------------------------------------------------- | 2470 //----- (0048CB39) -------------------------------------------------------- |
2501 int Player::GetActualAccuracy() | 2471 int Player::GetActualAccuracy() |
2502 { | 2472 { |
2503 Player *v1; // esi@1 | 2473 |
2504 unsigned int v2; // eax@1 | 2474 uint uActualAge = this->sAgeModifier + GetBaseAge(); |
2505 signed int v3; // ecx@1 | 2475 uint uAgeingMultiplier = 100; |
2506 signed int v4; // ebx@4 | 2476 for (uint i = 0; i < 4; ++i) |
2507 int v5; // edi@5 | 2477 if (uActualAge >= pAgeingTable[i]) |
2508 int v6; // ebp@5 | 2478 uAgeingMultiplier = pAgeingAccuracyMultiplier[i]; |
2509 | 2479 else break; |
2510 v1 = this; | 2480 |
2511 v2 = this->sAgeModifier + GetBaseAge(); | 2481 auto uConditionMult = pConditionAccuracyMultiplier[GetMajorConditionIdx()]; |
2512 v3 = 0; | 2482 return uConditionMult * uAgeingMultiplier * uAccuracy / 100 / 100 |
2513 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2514 { | |
2515 ++v3; | |
2516 if ( v3 >= 4 ) | |
2517 { | |
2518 v4 = 100; | |
2519 goto LABEL_5; | |
2520 } | |
2521 } | |
2522 v4 = pAgeingAccuracyMultiplier[v3]; | |
2523 LABEL_5: | |
2524 v5 = pConditionAccuracyMultiplier[GetMajorConditionIdx()]; | |
2525 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY, 0); | |
2526 return v5 * v4 * v1->uAccuracy / 100 / 100 | |
2527 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ACCURACY) | 2483 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ACCURACY) |
2528 + v6 | 2484 + GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY, 0) |
2529 + v1->uAccuracyBonus; | 2485 + uAccuracyBonus; |
2530 } | 2486 } |
2531 | 2487 |
2532 //----- (0048CBB6) -------------------------------------------------------- | 2488 //----- (0048CBB6) -------------------------------------------------------- |
2533 int Player::GetActualSpeed() | 2489 int Player::GetActualSpeed() |
2534 { | 2490 { |
2535 Player *v1; // esi@1 | 2491 uint uActualAge = this->sAgeModifier + GetBaseAge(); |
2536 unsigned int v2; // eax@1 | 2492 uint uAgeingMultiplier = 100; |
2537 signed int v3; // ecx@1 | 2493 for (uint i = 0; i < 4; ++i) |
2538 signed int v4; // ebx@4 | 2494 if (uActualAge >= pAgeingTable[i]) |
2539 int v5; // edi@5 | 2495 uAgeingMultiplier = pAgeingSpeedMultiplier[i]; |
2540 int v6; // ebp@5 | 2496 else break; |
2541 | 2497 |
2542 v1 = this; | 2498 auto uConditionMult = pConditionSpeedMultiplier[GetMajorConditionIdx()]; |
2543 v2 = this->sAgeModifier + GetBaseAge(); | 2499 return uConditionMult * uAgeingMultiplier * uSpeed / 100 / 100 |
2544 v3 = 0; | |
2545 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2546 { | |
2547 ++v3; | |
2548 if ( v3 >= 4 ) | |
2549 { | |
2550 v4 = 100; | |
2551 goto LABEL_5; | |
2552 } | |
2553 } | |
2554 v4 = pAgeingSpeedMultiplier[v3]; | |
2555 LABEL_5: | |
2556 v5 = pConditionSpeedMultiplier[GetMajorConditionIdx()]; | |
2557 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED, 0); | |
2558 return v5 * v4 * v1->uSpeed / 100 / 100 | |
2559 + GetMagicalBonus(CHARACTER_ATTRIBUTE_SPEED) | 2500 + GetMagicalBonus(CHARACTER_ATTRIBUTE_SPEED) |
2560 + v6 | 2501 + GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED, 0) |
2561 + v1->uSpeedBonus; | 2502 + uSpeedBonus; |
2562 } | 2503 } |
2563 | 2504 |
2564 //----- (0048CC33) -------------------------------------------------------- | 2505 //----- (0048CC33) -------------------------------------------------------- |
2565 int Player::GetActualLuck() | 2506 int Player::GetActualLuck() |
2566 { | 2507 { |
2567 signed int curr_age; // eax@7 | |
2568 signed int i; // ecx@7 | |
2569 signed int age_luck_pc; // ebx@10 | |
2570 int condition_luck_pc; // edi@11 | |
2571 int items_luck_bonus; // ebp@11 | |
2572 signed int npc_luck_bonus; // [sp+10h] [bp-4h]@1 | 2508 signed int npc_luck_bonus; // [sp+10h] [bp-4h]@1 |
2573 signed int magic_luck_bonus; // [sp+10h] [bp-4h]@1 | |
2574 int full_luck; | |
2575 | 2509 |
2576 npc_luck_bonus = 0; | 2510 npc_luck_bonus = 0; |
2577 if ( CheckHiredNPCSpeciality(Fool) ) | 2511 if ( CheckHiredNPCSpeciality(Fool) ) |
2578 npc_luck_bonus = 5; | 2512 npc_luck_bonus = 5; |
2579 if ( CheckHiredNPCSpeciality(ChimneySweep) ) | 2513 if ( CheckHiredNPCSpeciality(ChimneySweep) ) |
2580 npc_luck_bonus += 20; | 2514 npc_luck_bonus += 20; |
2581 if ( CheckHiredNPCSpeciality(Psychic) ) | 2515 if ( CheckHiredNPCSpeciality(Psychic) ) |
2582 npc_luck_bonus += 10; | 2516 npc_luck_bonus += 10; |
2583 curr_age = sAgeModifier + GetBaseAge(); | 2517 |
2584 i = 0; | 2518 uint uActualAge = this->sAgeModifier + GetBaseAge(); |
2585 while ( curr_age >= pAgeingTable[i] ) | 2519 uint uAgeingMultiplier = 100; |
2586 { | 2520 for (uint i = 0; i < 4; ++i) |
2587 ++i; | 2521 if (uActualAge >= pAgeingTable[i]) |
2588 if ( i >= 4 ) | 2522 uAgeingMultiplier = pAgeingLuckMultiplier[i]; |
2589 break; | 2523 else break; |
2590 } | 2524 |
2591 if (i < 4) | 2525 auto uConditionMult = pConditionLuckMultiplier[GetMajorConditionIdx()]; |
2592 age_luck_pc = pAgeingLuckMultiplier[i]; | 2526 return uConditionMult * uAgeingMultiplier * uLuck / 100 / 100 |
2593 else | 2527 + GetMagicalBonus(CHARACTER_ATTRIBUTE_LUCK) |
2594 age_luck_pc = 100; | 2528 + GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0) |
2595 | 2529 + uLuckBonus |
2596 condition_luck_pc = pConditionLuckMultiplier[GetMajorConditionIdx()]; | 2530 + npc_luck_bonus; |
2597 items_luck_bonus = GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); | |
2598 magic_luck_bonus = GetMagicalBonus(CHARACTER_ATTRIBUTE_LUCK); | |
2599 full_luck = magic_luck_bonus + items_luck_bonus + npc_luck_bonus+ uLuckBonus | |
2600 + condition_luck_pc * age_luck_pc * uLuck / 100 / 100; | |
2601 return full_luck; | |
2602 } | 2531 } |
2603 | 2532 |
2604 //----- (0048CCF5) -------------------------------------------------------- | 2533 //----- (0048CCF5) -------------------------------------------------------- |
2605 int Player::GetActualAttack(int a2) | 2534 int Player::GetActualAttack(int a2) |
2606 { | 2535 { |
7922 { | 7851 { |
7923 v9 = &this->pInventoryItems[i]; | 7852 v9 = &this->pInventoryItems[i]; |
7924 if (v9->uItemID == 615) | 7853 if (v9->uItemID == 615) |
7925 break; | 7854 break; |
7926 } | 7855 } |
7927 if (v9 != NULL || v9->uItemID != 615) | 7856 if (v9 != NULL && v9->uItemID != 615) |
7928 { | 7857 { |
7929 v10 = (int)((char *)this + 36 * 138); //originally 36 * v8. the code got to this condition only if v8 was equal to 138 | 7858 v10 = (int)((char *)this + 36 * 138); //originally 36 * v8. the code got to this condition only if v8 was equal to 138 |
7930 *(int *)(v10 + 532) = 601; | 7859 *(int *)(v10 + 532) = 601; |
7931 *(char *)(v10 + 558) = currPlayerId + 1; | 7860 *(char *)(v10 + 558) = currPlayerId + 1; |
7932 } | 7861 } |