This code runs after we've determined that the attacker hit outside our blocking box.
Read this first if you haven't yet.
Short summary: Blocking box blocks for sure.
So this is what matters when we know that we are not attacking and the saber hit somewhere on the front or side-ish of our character, ready to defend.
Original baseJK code:
Code: Select all
if (attackStr == FORCE_LEVEL_3)
{
if (self->client->ps.fd.forcePowerLevel[FP_SABERDEFEND] >= FORCE_LEVEL_3)
{
if (Q_irand(1, 10) < 3)
{
return 0;
}
}
else
{
return 0;
}
}
(if he hits outside my invisible blocking box, hence this code runs)
- If attacker uses red style...
- Then, if I have full saber defense (you always have in NF gametype), generate random number from 1 to 10. If it's below 3, I can't block.
- If I don't have full saber defense, I can't block.
Code: Select all
if (attackStr == FORCE_LEVEL_2 && Q_irand(1, 10) < 3)
{
if (self->client->ps.fd.forcePowerLevel[FP_SABERDEFEND] >= FORCE_LEVEL_3)
{
//do nothing for now
}
else if (self->client->ps.fd.forcePowerLevel[FP_SABERDEFEND] >= FORCE_LEVEL_2)
{
if (Q_irand(1, 10) < 5)
{
return 0;
}
}
else
{
return 0;
}
}
- If attacker uses yellow style
- Generate random number from 1 to 10, if it's below 3, continue (otherwise, I can block for sure):
- If I have full saber defense, I can block
- If I only have saber defense 2, I have 40% chance of failure
- If defense 1 or below, fail.
Code: Select all
if (attackStr == FORCE_LEVEL_1 && !self->client->ps.fd.forcePowerLevel[FP_SABERDEFEND] &&
Q_irand(1, 40) < 3)
{ //if I have no defense level at all then I might be unable to block a level 1 attack (but very rarely)
return 0;
}
Conclusion:
In the NF gametype, you can always block attacks hitting the front of your character (and about to the middle of the sides), UNLESS the attacker uses red style, in which case there's a 20% chance to fail.