Fix pvp bugs (#612)

Fixed:
Dives dealing 0 knockback
Breakdances not dealing damage
Rollout invincibility bleeding into classic
This commit is contained in:
Sunk 2025-01-05 21:23:07 -05:00 committed by GitHub
parent 8caeeade67
commit a1746ab9cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -671,9 +671,9 @@ u32 determine_knockback_action(struct MarioState *m, UNUSED s32 arg) {
// set knockback very high when dealing with player attacks
if (m->interactObj != NULL && (m->interactObj->oInteractType & INTERACT_PLAYER) && terrainIndex != 2) {
f32 scaler = 1;
f32 scaler = 1.0f;
s8 hasBeenPunched = FALSE;
#define IF_REVAMPED_PVP(is, isNot) gServerSettings.pvpType == PLAYER_PVP_REVAMPED ? (is) : (isNot);
#define IF_REVAMPED_PVP(is, isNot) (gServerSettings.pvpType == PLAYER_PVP_REVAMPED ? (is) : (isNot));
for (s32 i = 0; i < MAX_PLAYERS; i++) {
struct MarioState* m2 = &gMarioStates[i];
if (!is_player_active(m2)) { continue; }
@ -681,7 +681,7 @@ u32 determine_knockback_action(struct MarioState *m, UNUSED s32 arg) {
if (m2->marioObj != m->interactObj) { continue; }
// Redundent check in case the kicking flag somehow gets missed
if (m2->action == ACT_JUMP_KICK || m2->flags & MARIO_KICKING) { scaler = IF_REVAMPED_PVP(1.85f, 2.0f); }
else if (m2->action == ACT_DIVE) { scaler = 1 + IF_REVAMPED_PVP(m2->forwardVel * 0.005f, 0); }
else if (m2->action == ACT_DIVE) { scaler = 1.0f + IF_REVAMPED_PVP(m2->forwardVel * 0.005f, 0.0f); }
else if ((m2->flags & MARIO_PUNCHING)) { scaler = IF_REVAMPED_PVP(0.18f, 1.0f); hasBeenPunched = gServerSettings.pvpType == PLAYER_PVP_REVAMPED; }
if (m2->flags & MARIO_METAL_CAP) { scaler *= 1.25f; }
break;
@ -1372,7 +1372,8 @@ u8 passes_pvp_interaction_checks(struct MarioState* attacker, struct MarioState*
|| attacker->action == ACT_FORWARD_ROLLOUT || attacker->action == ACT_BACKWARD_ROLLOUT);
u8 isVictimIntangible = (victim->action & ACT_FLAG_INTANGIBLE);
u8 isVictimGroundPounding = (victim->action == ACT_GROUND_POUND) && (victim->actionState != 0);
u8 isVictimInRolloutFlip = (victim->action == ACT_FORWARD_ROLLOUT || victim->action == ACT_BACKWARD_ROLLOUT) && (victim->actionState == 1);
u8 isVictimInRolloutFlip = gServerSettings.pvpType == PLAYER_PVP_REVAMPED &&
((victim->action == ACT_FORWARD_ROLLOUT || victim->action == ACT_BACKWARD_ROLLOUT) && (victim->actionState == 1));
if (victim->knockbackTimer != 0) {
return false;
}
@ -1381,8 +1382,6 @@ u8 passes_pvp_interaction_checks(struct MarioState* attacker, struct MarioState*
(attacker->action == ACT_PUNCHING || attacker->action == ACT_MOVE_PUNCHING) &&
(victim->action == ACT_SOFT_BACKWARD_GROUND_KB || victim->action == ACT_SOFT_FORWARD_GROUND_KB)) {
return true;
} else if (attacker->flags & MARIO_TRIPPING) {
return false;
}
return (!isInvulnerable && !isIgnoredAttack && !isAttackerInvulnerable && !isVictimIntangible && !isVictimGroundPounding && !isVictimInRolloutFlip);