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

Function ModifyPlrVit

Source/player.cpp:4008–4039  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4006}
4007
4008void ModifyPlrVit(int p, int l)
4009{
4010 int max, ms;
4011
4012 if ((DWORD)p >= MAX_PLRS) {
4013 app_fatal("ModifyPlrVit: illegal player %d", p);
4014 }
4015
4016 max = MaxStats[plr[p]._pClass][ATTRIB_VIT];
4017 if (plr[p]._pBaseVit + l > max) {
4018 l = max - plr[p]._pBaseVit;
4019 }
4020
4021 plr[p]._pVitality += l;
4022 plr[p]._pBaseVit += l;
4023
4024 ms = l << 6;
4025 if (plr[p]._pClass == PC_WARRIOR) {
4026 ms <<= 1;
4027 }
4028
4029 plr[p]._pHPBase += ms;
4030 plr[p]._pMaxHPBase += ms;
4031 plr[p]._pHitPoints += ms;
4032 plr[p]._pMaxHP += ms;
4033
4034 CalcPlrInv(p, TRUE);
4035
4036 if (p == myplr) {
4037 NetSendCmdParam1(FALSE, CMD_SETVIT, plr[p]._pBaseVit);
4038 }
4039}
4040
4041void SetPlayerHitPoints(int pnum, int val)
4042{

Callers 4

OperateShrineFunction · 0.85
OperateFountainsFunction · 0.85
On_ADDVITFunction · 0.85
UseItemFunction · 0.85

Calls 3

app_fatalFunction · 0.85
CalcPlrInvFunction · 0.85
NetSendCmdParam1Function · 0.85

Tested by

no test coverage detected