MCPcopy Create free account
hub / github.com/diasurgical/DevilutionX / OperateShrineHidden

Function OperateShrineHidden

Source/objects.cpp:2381–2426  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2379}
2380
2381void OperateShrineHidden(Player &player)
2382{
2383 if (&player != MyPlayer)
2384 return;
2385
2386 int cnt = 0;
2387 for (const auto &item : player.InvBody) {
2388 if (!item.isEmpty())
2389 cnt++;
2390 }
2391 if (cnt > 0) {
2392 for (auto &item : player.InvBody) {
2393 if (!item.isEmpty()
2394 && item._iMaxDur != DUR_INDESTRUCTIBLE
2395 && item._iMaxDur != 0) {
2396 item._iDurability += 10;
2397 item._iMaxDur += 10;
2398 if (item._iDurability > item._iMaxDur)
2399 item._iDurability = item._iMaxDur;
2400 }
2401 }
2402 while (true) {
2403 cnt = 0;
2404 for (auto &item : player.InvBody) {
2405 if (!item.isEmpty() && item._iMaxDur != DUR_INDESTRUCTIBLE && item._iMaxDur != 0) {
2406 cnt++;
2407 }
2408 }
2409 if (cnt == 0)
2410 break;
2411 int r = GenerateRnd(NUM_INVLOC);
2412 if (player.InvBody[r].isEmpty() || player.InvBody[r]._iMaxDur == DUR_INDESTRUCTIBLE || player.InvBody[r]._iMaxDur == 0)
2413 continue;
2414
2415 player.InvBody[r]._iDurability -= 20;
2416 player.InvBody[r]._iMaxDur -= 20;
2417 if (player.InvBody[r]._iDurability <= 0)
2418 player.InvBody[r]._iDurability = 1;
2419 if (player.InvBody[r]._iMaxDur <= 0)
2420 player.InvBody[r]._iMaxDur = 1;
2421 break;
2422 }
2423 }
2424
2425 InitDiabloMsg(EMSG_SHRINE_HIDDEN);
2426}
2427
2428void OperateShrineGloomy(Player &player)
2429{

Callers 1

OperateShrineFunction · 0.85

Calls 3

GenerateRndFunction · 0.85
InitDiabloMsgFunction · 0.85
isEmptyMethod · 0.80

Tested by

no test coverage detected