rafalh / dashfaction

A community patch for the Red Faction (2001) FPS game
https://www.factionfiles.com/ff.php?action=file&id=6252
Mozilla Public License 2.0
61 stars 11 forks source link

Add critical hits to multiplayer #283

Open GooberRF opened 1 month ago

GooberRF commented 1 month ago

This PR adds critical hits to Dash servers optionally (default is off). This logic is inspired by Team Fortress 2, though it works a little differently. I wrote this feature in order to add a fun twist to the gameplay in the FactionFiles DM pub and it's generally been well received, so I thought I might as well PR it over so other server operators can try it out too if they wish.

Here's an explanation of the logic with default values:

Configurable items in dedicated_server.txt are:

    // Enable critical hits
    $DF Critical Hits: false
        // Sound used for hit notification
        +Sound ID: 35
        // Max sound packets per second - keep it low to save bandwidth
        +Rate Limit: 10
        // Duration of damage amp reward on a critical hit
        +Reward Duration: 1500
        // Percentage chance of a critical hit
        +Base Chance Percent: 0.1
        // Enable dynamic chance bonus based on damage dealt in current life
        +Use Dynamic Chance Bonus: true
        // Amount of damage to deal in current life for the max dynamic chance bonus (+ 0.1)
        +Dynamic Chance Damage Ceiling: 1200

Note: This PR does use the same RNG code as #271, but it is identical, so there should be no conflict in merging both of them.