Skip to content

Commit

Permalink
Yet again.
Browse files Browse the repository at this point in the history
Yeah, should be like this. (1 / a) * b is the same as b / a
  • Loading branch information
Phatcat committed Oct 10, 2016
1 parent 951ed32 commit cc5ddcf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/game/SpellEffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3773,7 +3773,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx)
// but own calculation say 0.385 gives at most one point difference to published values
// calculation should really be; ((damage + 0.385 * BonusSpellDamage) * 0.1 * weaponSpeed)
// base damage is multiplied by 10 in spell.dbc so we have to multiply the coefficients by 10 and then divide the whole bracket by 10.
float weaponSpeed = (m_CastItem->GetProto()->Delay / IN_MILLISECONDS) * m_CastItem->GetProto()->Delay;
float weaponSpeed = m_CastItem->GetProto()->Delay / IN_MILLISECONDS;
int32 totalDamage = (damage + 3.85f * m_caster->SpellBaseDamageBonusDone(GetSpellSchoolMask(m_spellInfo))) * 0.01 * weaponSpeed;

m_caster->CastCustomSpell(unitTarget, 10444, &totalDamage, nullptr, nullptr, true, m_CastItem);
Expand Down

9 comments on commit cc5ddcf

@DomGries
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasnt it (b/a)*b which is b^2/a and not b/a

@killerwife
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, you are right stfx.

@Phatcat
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Phatcat
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also how would that calculation make ANY sense whatsoever? delay * delay?

@killerwife
Copy link
Contributor

@killerwife killerwife commented on cc5ddcf Oct 11, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Phatcat Problem is that it still is not the same. Delay is not Float but UINT32, previously it was 1.0f * delay / mili, which means you were doing float division but now you are doing integer division. Either add (float) and brackets around delay or revert it to the previous state. Currently the expression is converted to float AFTER doing calculations, if I recall C basics correctly.

@Phatcat
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but that's a whole other issue isn't it? one completely unrelated to what stfx is saying, so it's not a counter argument to what I just said, it's a whole other problem altogether.

Also, I am not changing this 'on a huntch' - either be sure of what you're saying or be sure that it's still bugged.

@DomGries
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I only looked at this commit. If both delay and in_milliseconds are integers then killerwife is correct that it now discards decimal digits.

@Phatcat
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, that I will change, not trying to be difficult.
I did not know that, but I am glad that I do now, thanks for educating me on this; because that's what's cmangos is about, right? teaching and encouraging eachother, right?

@DomGries
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is why we give constructive feedback.

Please sign in to comment.