|
|
|
|
@ -154,29 +154,26 @@ void EnsureValidReadiedSpell(PlayerStruct &player)
|
|
|
|
|
|
|
|
|
|
bool CheckSpell(int id, spell_id sn, spell_type st, bool manaonly) |
|
|
|
|
{ |
|
|
|
|
bool result; |
|
|
|
|
|
|
|
|
|
#ifdef _DEBUG |
|
|
|
|
if (debug_mode_key_inverted_v) |
|
|
|
|
return true; |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
result = true; |
|
|
|
|
if (!manaonly && pcurs != CURSOR_HAND) { |
|
|
|
|
result = false; |
|
|
|
|
} else { |
|
|
|
|
if (st != RSPLTYPE_SKILL) { |
|
|
|
|
if (GetSpellLevel(id, sn) <= 0) { |
|
|
|
|
result = false; |
|
|
|
|
} else { |
|
|
|
|
auto &player = plr[id]; |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return player._pMana >= GetManaAmount(player, sn); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (st == RSPLTYPE_SKILL) { |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
|
if (GetSpellLevel(id, sn) <= 0) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
auto &player = plr[id]; |
|
|
|
|
|
|
|
|
|
return player._pMana >= GetManaAmount(player, sn); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void CastSpell(int id, int spl, int sx, int sy, int dx, int dy, int spllvl) |
|
|
|
|
@ -294,48 +291,42 @@ void DoResurrect(int pnum, int rid)
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void DoHealOther(int pnum, int rid) |
|
|
|
|
void DoHealOther(int pnum, uint16_t rid) |
|
|
|
|
{ |
|
|
|
|
int i, j, hp; |
|
|
|
|
|
|
|
|
|
if (pnum == myplr) { |
|
|
|
|
NewCursor(CURSOR_HAND); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ((DWORD)pnum >= MAX_PLRS || rid >= MAX_PLRS) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
auto &player = plr[pnum]; |
|
|
|
|
auto &target = plr[rid]; |
|
|
|
|
|
|
|
|
|
if ((char)rid != -1 && (target._pHitPoints >> 6) > 0) { |
|
|
|
|
hp = (GenerateRnd(10) + 1) << 6; |
|
|
|
|
|
|
|
|
|
for (i = 0; i < player._pLevel; i++) { |
|
|
|
|
hp += (GenerateRnd(4) + 1) << 6; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (j = 0; j < GetSpellLevel(pnum, SPL_HEALOTHER); ++j) { |
|
|
|
|
hp += (GenerateRnd(6) + 1) << 6; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (player._pClass == HeroClass::Warrior || player._pClass == HeroClass::Barbarian) { |
|
|
|
|
hp *= 2; |
|
|
|
|
} else if (player._pClass == HeroClass::Rogue || player._pClass == HeroClass::Bard) { |
|
|
|
|
hp += hp / 2; |
|
|
|
|
} else if (player._pClass == HeroClass::Monk) { |
|
|
|
|
hp *= 3; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
target._pHitPoints += hp; |
|
|
|
|
if ((target._pHitPoints >> 6) <= 0) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (target._pHitPoints > target._pMaxHP) { |
|
|
|
|
target._pHitPoints = target._pMaxHP; |
|
|
|
|
} |
|
|
|
|
int hp = (GenerateRnd(10) + 1) << 6; |
|
|
|
|
for (int i = 0; i < player._pLevel; i++) { |
|
|
|
|
hp += (GenerateRnd(4) + 1) << 6; |
|
|
|
|
} |
|
|
|
|
for (int i = 0; i < GetSpellLevel(pnum, SPL_HEALOTHER); i++) { |
|
|
|
|
hp += (GenerateRnd(6) + 1) << 6; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
target._pHPBase += hp; |
|
|
|
|
if (player._pClass == HeroClass::Warrior || player._pClass == HeroClass::Barbarian) { |
|
|
|
|
hp *= 2; |
|
|
|
|
} else if (player._pClass == HeroClass::Rogue || player._pClass == HeroClass::Bard) { |
|
|
|
|
hp += hp / 2; |
|
|
|
|
} else if (player._pClass == HeroClass::Monk) { |
|
|
|
|
hp *= 3; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (target._pHPBase > target._pMaxHPBase) { |
|
|
|
|
target._pHPBase = target._pMaxHPBase; |
|
|
|
|
} |
|
|
|
|
target._pHitPoints = std::min(target._pHitPoints + hp, target._pMaxHP); |
|
|
|
|
target._pHPBase = std::min(target._pHPBase + hp, target._pMaxHPBase); |
|
|
|
|
|
|
|
|
|
if (rid == myplr) { |
|
|
|
|
drawhpflag = true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|