comparison Player.cpp @ 1272:19a4809e1da0

Player::DecreaseAttribute cleanup
author Grumpy7
date Sat, 15 Jun 2013 02:31:27 +0200
parents 5a3f48b370d5
children fbb7428fa58c
comparison
equal deleted inserted replaced
1271:5a3f48b370d5 1272:19a4809e1da0
6422 v2 = eAttribute + 7 * GetRace(); 6422 v2 = eAttribute + 7 * GetRace();
6423 pBaseValue = StatTable[0][v2].uBaseValue; 6423 pBaseValue = StatTable[0][v2].uBaseValue;
6424 pDroppedStep = StatTable[0][v2].uDroppedStep; 6424 pDroppedStep = StatTable[0][v2].uDroppedStep;
6425 uMinValue = pBaseValue - 2; 6425 uMinValue = pBaseValue - 2;
6426 pStep = StatTable[0][v2].uBaseStep; 6426 pStep = StatTable[0][v2].uBaseStep;
6427 switch ( eAttribute ) 6427 unsigned short* AttrToChange = nullptr;
6428 { 6428 switch ( eAttribute )
6429 case CHARACTER_ATTRIBUTE_STRENGTH: 6429 {
6430 if ( this->uMight <= pBaseValue ) 6430 case CHARACTER_ATTRIBUTE_STRENGTH:
6431 pStep = pDroppedStep; 6431 AttrToChange = &this->uMight;
6432 if ( this->uMight - pStep >= uMinValue ) 6432 break;
6433 this->uMight -= pStep; 6433 case CHARACTER_ATTRIBUTE_INTELLIGENCE:
6434 break; 6434 AttrToChange = &this->uIntelligence;
6435 case CHARACTER_ATTRIBUTE_INTELLIGENCE: 6435 break;
6436 if ( this->uIntelligence <= pBaseValue ) 6436 case CHARACTER_ATTRIBUTE_WILLPOWER:
6437 pStep = pDroppedStep; 6437 AttrToChange = &this->uWillpower;
6438 if ( this->uIntelligence - pStep >= uMinValue ) 6438 break;
6439 this->uIntelligence -= pStep; 6439 case CHARACTER_ATTRIBUTE_ENDURANCE:
6440 break; 6440 AttrToChange = &this->uEndurance;
6441 case CHARACTER_ATTRIBUTE_WILLPOWER: 6441 break;
6442 if ( this->uWillpower <= pBaseValue ) 6442 case CHARACTER_ATTRIBUTE_ACCURACY:
6443 pStep = pDroppedStep; 6443 AttrToChange = &this->uAccuracy;
6444 if ( this->uWillpower - pStep >= uMinValue ) 6444 break;
6445 this->uWillpower -= pStep; 6445 case CHARACTER_ATTRIBUTE_SPEED:
6446 break; 6446 AttrToChange = &this->uSpeed;
6447 case CHARACTER_ATTRIBUTE_ENDURANCE: 6447 break;
6448 if ( this->uEndurance <= pBaseValue ) 6448 case CHARACTER_ATTRIBUTE_LUCK:
6449 pStep = pDroppedStep; 6449 AttrToChange = &this->uLuck;
6450 if ( this->uEndurance - pStep >= uMinValue ) 6450 break;
6451 this->uEndurance -= pStep; 6451 }
6452 break; 6452 if ( *AttrToChange <= pBaseValue )
6453 case CHARACTER_ATTRIBUTE_ACCURACY: 6453 pStep = pDroppedStep;
6454 if ( this->uAccuracy <= pBaseValue ) 6454 if ( *AttrToChange - pStep >= uMinValue )
6455 pStep = pDroppedStep; 6455 *AttrToChange -= pStep;
6456 if ( this->uAccuracy - pStep >= uMinValue )
6457 this->uAccuracy -= pStep;
6458 break;
6459 case CHARACTER_ATTRIBUTE_SPEED:
6460 if ( this->uSpeed <= pBaseValue )
6461 pStep = pDroppedStep;
6462 if ( this->uSpeed - pStep >= uMinValue )
6463 this->uSpeed -= pStep;
6464 break;
6465 case CHARACTER_ATTRIBUTE_LUCK:
6466 if ( this->uLuck <= pBaseValue )
6467 pStep = pDroppedStep;
6468 if ( this->uLuck - pStep >= uMinValue )
6469 this->uLuck -= pStep;
6470 break;
6471 }
6472 } 6456 }
6473 6457
6474 //----- (004905F5) -------------------------------------------------------- 6458 //----- (004905F5) --------------------------------------------------------
6475 //signed int __thiscall PartyCreation_BtnPlusClick(Player *this, int eAttribute) 6459 //signed int __thiscall PartyCreation_BtnPlusClick(Player *this, int eAttribute)
6476 int Player::IncreaseAttribute(int eAttribute) 6460 int Player::IncreaseAttribute(int eAttribute)