Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Critical hits are not being calculated for melee attacks #252

Closed
jlcvp opened this issue Apr 27, 2017 · 9 comments
Closed

Critical hits are not being calculated for melee attacks #252

jlcvp opened this issue Apr 27, 2017 · 9 comments
Assignees

Comments

@jlcvp
Copy link
Collaborator

jlcvp commented Apr 27, 2017

#235 doesn't completely fixed the critical hit calculations. There's a bug where normal melee attacks are not triggering critical damage. I suspect the error is the damage type check on Combat::doCombat methods before calling Player::doCriticalDamage

@jlcvp jlcvp changed the title Critical hits are not being calculated in melee attacks Critical hits are not being calculated for melee attacks Apr 28, 2017
@joseluis2g
Copy link

what you mean with normal melee attacks?

@jlcvp
Copy link
Collaborator Author

jlcvp commented May 3, 2017

@joseluis2g knight auto-attack hit (without elemental damage on weapon)

@joseluis2g
Copy link

yeah I tested it, and not its not the combat type, I did some modifications adding the critical function to combatheal and now when you use runes it only hit a few creatures.

@Schiffers
Copy link

Schiffers commented May 28, 2017

hello folks, I do something and now the hits is calculated:
in combat.cpp
void Combat::CombatHealthFunc(Creature* caster, Creature* target, const CombatParams& params, void* data)
above
Player* targetPlayer = target->getPlayer();
add

Player* casterPlayer = caster->getPlayer();
if (casterPlayer) {
	casterPlayer->doCriticalDamage(damage);
}

but with this cause crash here, someone can test it?

@joseluis2g
Copy link

before this

if (g_game.combatChangeHealth(caster, target, damage)) {

add this

if (caster && caster->getPlayer()) {
		caster->getPlayer()->doCriticalDamage(damage);
}

@Schiffers
Copy link

I'll compile it now, did you tested?
I'm almost sure that will crash here, always the caster is null, using the mvs debbuger show something like it
caster = 0x0000000000 as it is invalid, don't find the variable

@joseluis2g
Copy link

joseluis2g commented May 28, 2017

you call caster and you do not check if it exist

if (casterPlayer) {

should be

if (caster && casterPlayer) {

:)

edit:
actually it should be like this

if (caster) {
	Player* casterPlayer = caster->getPlayer();
	if (casterPlayer) {
		casterPlayer->doCriticalDamage(damage);
	}
}

@Schiffers
Copy link

Schiffers commented May 28, 2017

@joseluis2g sure, I'm compile, could you add me on skype to we trade some ideas?

@joseluis2g
Copy link

im at discord, I dont know why but my skype isnt working :/
im discord id is Streamside#8347

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants