Jump to content

[bug]warrior execute spell


Guest truekush

Recommended Posts

Mangos Version: 9792

Custom Patches: None

SD2 Version: 1679

Database Name and Version : UDB Rev. 390

warrior execute spell

how its supposed to work: after useing the spell the caster is supposed to be left with only 10/100 rage

how it works: the caster is left with Full 100/100 rage

Link to comment
Share on other sites

This is caused by variable overflow in

m_caster->SetPower(POWER_RAGE,m_caster->GetPower(POWER_RAGE)-rage);

in it's spell effect as

m_caster->CastCustomSpell(unitTarget, 20647, &basePoints0, NULL, NULL, true, 0);

consumes 0.1 rage and therefore can GetPower(POWER_RAGE)-rage give you a negative number which is not suitable for uint32.

Link to comment
Share on other sites

Yeah, this is exactly what I've just written, no need to repeat :P

Anyway it can be simply fixed by converting to int32 and comparing to 0, like:

m_caster->SetPower(POWER_RAGE,int32(m_caster->GetPower(POWER_RAGE)-rage) > 0 ? m_caster->GetPower(POWER_RAGE)-rage : 0 );

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use