void HUDInterface::AddUpgrade ( char upgrade ) { if ( !IsUpgradeVisible (upgrade) ) { int insertedAt = -1; for ( int i = 0; i < 8; ++i ) { if ( visibleUpgrades[i] == 0 ) { visibleUpgrades [i] = upgrade; insertedAt = i; break; } } if ( insertedAt == -1 ) return; HUDInterfaceUpgrade *theUpgrade = GetUpgrade(upgrade); if ( theUpgrade ) { int xPos = 195 + 27 * insertedAt; int screenh = app->GetOptions ()->GetOptionValue ( "graphics_screenheight" ); EclRegisterButton ( 60, screenh - 42, 24, 24, theUpgrade->name, theUpgrade->tooltip, theUpgrade->buttonName ); button_assignbitmaps ( theUpgrade->buttonName, theUpgrade->buttonFilename, theUpgrade->buttonFilename_h, theUpgrade->buttonFilename_c ); EclRegisterButtonCallbacks ( theUpgrade->buttonName, ToolbarButtonDraw, theUpgrade->callback, button_click, button_highlight ); EclRegisterMovement ( theUpgrade->buttonName, xPos, screenh - 42, 700 ); } } }
bool HUDInterface::IsUpgradeVisible ( char upgrade ) { int visible = 0; for ( int i = 0; i < 8; ++i ) if ( visibleUpgrades[i] == upgrade ) { visible++; break; } HUDInterfaceUpgrade *theUpgrade = GetUpgrade(upgrade); if ( theUpgrade && EclGetButton ( theUpgrade->buttonName ) ) visible++; return ( visible == 2 ); }
void CStdItemSpecial::UpgradeRandomItem(BYTE* btValue, WORD &nDura, WORD &nDuraMax)//_LPTMAKEITEMRCD lpMakeItemRcd) { int nUpgrade, nIncp, nVal; switch (btType) { case 0: // 무기 { // 파괴 옵션 nUpgrade = GetUpgrade(12, 15); if (rand() % 15 == 0) btValue[0] = 1 + nUpgrade; // DC // 공격 속도 nUpgrade = GetUpgrade(12, 15); if (rand() % 20 == 0) { nIncp = (int)((1 + nUpgrade) / 3); if (nIncp > 0) { if (rand() % 3 != 0) btValue[6] = nIncp; // 공격 속도 (-) else btValue[6] = 10 + nIncp; // 공격 속도 (+) } } // 마력 nUpgrade = GetUpgrade(12, 15); if (rand() % 15 == 0) btValue[1] = 1 + nUpgrade; // MC // 도력 nUpgrade = GetUpgrade(12, 15); if (rand() % 15 == 0) btValue[2] = 1 + nUpgrade; // SC // 정확 nUpgrade = GetUpgrade(12, 15); if (rand() % 24 == 0) btValue[5] = 1 + ((int)nUpgrade / 2); // 정확 (+) // 내구 nUpgrade = GetUpgrade(12, 12); if (rand() % 3 < 2) { nVal = (1 + nUpgrade) * 2000; nDuraMax = _MIN(65000, nDuraMax + nVal); nDura = _MIN(65000, nDura + nVal); } // 강도 nUpgrade = GetUpgrade(12, 15); if (rand() % 10 == 0) btValue[7] = 1 + ((int)nUpgrade / 2); break; } case 1: // 방어구류 { //방어 nUpgrade = GetUpgrade(6, 15); if (rand() % 40 == 0) btValue[0] = 1 + nUpgrade; // AC //마항 nUpgrade = GetUpgrade(6, 15); if (rand() % 40 == 0) btValue[1] = 1 + nUpgrade; // MAC //파괴 nUpgrade = GetUpgrade(6, 20); if (rand() % 40 == 0) btValue[2] = 1 + nUpgrade; // DC //마법 nUpgrade = GetUpgrade(6, 20); if (rand() % 40 == 0) btValue[3] = 1 + nUpgrade; // MC //도력 nUpgrade = GetUpgrade(6, 20); if (rand() % 40 == 0) btValue[4] = 1 + nUpgrade; // SC //내구 nUpgrade = GetUpgrade(6, 10); if (rand() % 8 < 6) { nVal = (1 + nUpgrade) * 2000; nDuraMax = _MIN(65000, nDuraMax + nVal); nDura = _MIN(65000, nDura + nVal); } break; } case 2: // 반지, 팔지, 목걸이 { // 정확 nUpgrade = GetUpgrade(6, 30); if (rand() % 60 == 0) btValue[0] = 1 + nUpgrade; // AC(HIT) //민첩 nUpgrade = GetUpgrade(6, 30); if (rand() % 60 == 0) btValue[1] = 1 + nUpgrade; // MAC(SPEED) //파괴 nUpgrade = GetUpgrade(6, 20); if (rand() % 30 == 0) btValue[2] = 1 + nUpgrade; // DC //마법 nUpgrade = GetUpgrade(6, 20); if (rand() % 30 == 0) btValue[3] = 1 + nUpgrade; // MC //도력 nUpgrade = GetUpgrade(6, 20); if (rand() % 30 == 0) btValue[4] = 1 + nUpgrade; // SC //내구 nUpgrade = GetUpgrade(6, 12); if (rand() % 20 < 15) { nVal = (1 + nUpgrade) * 1000; nDuraMax = _MIN(65000, nDuraMax + nVal); nDura = _MIN(65000, nDura + nVal); } break; } } }