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

Function ModifyPlrMag

Source/player.cpp:3947–3980  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3945}
3946
3947void ModifyPlrMag(int p, int l)
3948{
3949 int max, ms;
3950
3951 if ((DWORD)p >= MAX_PLRS) {
3952 app_fatal("ModifyPlrMag: illegal player %d", p);
3953 }
3954
3955 max = MaxStats[plr[p]._pClass][ATTRIB_MAG];
3956 if (plr[p]._pBaseMag + l > max) {
3957 l = max - plr[p]._pBaseMag;
3958 }
3959
3960 plr[p]._pMagic += l;
3961 plr[p]._pBaseMag += l;
3962
3963 ms = l << 6;
3964 if (plr[p]._pClass == PC_SORCERER) {
3965 ms <<= 1;
3966 }
3967
3968 plr[p]._pMaxManaBase += ms;
3969 plr[p]._pMaxMana += ms;
3970 if (!(plr[p]._pIFlags & ISPL_NOMANA)) {
3971 plr[p]._pManaBase += ms;
3972 plr[p]._pMana += ms;
3973 }
3974
3975 CalcPlrInv(p, TRUE);
3976
3977 if (p == myplr) {
3978 NetSendCmdParam1(FALSE, CMD_SETMAG, plr[p]._pBaseMag);
3979 }
3980}
3981
3982void ModifyPlrDex(int p, int l)
3983{

Callers 4

OperateShrineFunction · 0.85
OperateFountainsFunction · 0.85
On_ADDMAGFunction · 0.85
UseItemFunction · 0.85

Calls 3

app_fatalFunction · 0.85
CalcPlrInvFunction · 0.85
NetSendCmdParam1Function · 0.85

Tested by

no test coverage detected