MCPcopy Create free account
hub / github.com/diasurgical/devilution / DoRecharge

Function DoRecharge

Source/items.cpp:2574–2595  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2572}
2573
2574void DoRecharge(int pnum, int cii)
2575{
2576 PlayerStruct *p;
2577 ItemStruct *pi;
2578 int r;
2579
2580 p = &plr[pnum];
2581 if (cii >= NUM_INVLOC) {
2582 pi = &p->InvList[cii - NUM_INVLOC];
2583 } else {
2584 pi = &p->InvBody[cii];
2585 }
2586 if (pi->_itype == ITYPE_STAFF && pi->_iSpell) {
2587 r = spelldata[pi->_iSpell].sBookLvl;
2588 r = random_(38, p->_pLevel / r) + 1;
2589 RechargeItem(pi, r);
2590 CalcPlrInv(pnum, TRUE);
2591 }
2592
2593 if (pnum == myplr)
2594 SetCursor_(CURSOR_HAND);
2595}
2596
2597void RechargeItem(ItemStruct *i, int r)
2598{

Callers 1

TryIconCursFunction · 0.85

Calls 4

random_Function · 0.85
RechargeItemFunction · 0.85
CalcPlrInvFunction · 0.85
SetCursor_Function · 0.85

Tested by

no test coverage detected