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

feat: custom stat scaling property for weapons #73

Draft
wants to merge 1 commit into
base: release/0.10.0.0
Choose a base branch
from

Conversation

EttyKitty
Copy link
Owner

@EttyKitty EttyKitty commented Nov 4, 2024

Summary by Sourcery

New Features:

  • Weapons now have a "stat_scaling" property that allows their stats to be influenced by the character's stats.

@EttyKitty EttyKitty changed the base branch from compile/main to release/0.10.0.0 November 4, 2024 22:36
@EttyKitty EttyKitty changed the title First iteration of stat scaling system for weapons feat: custom stat scaling proprety for weapons Nov 4, 2024
@EttyKitty EttyKitty changed the title feat: custom stat scaling proprety for weapons feat: custom stat scaling property for weapons Nov 4, 2024
@EttyKitty EttyKitty added PR: Major Coding Big enough to possibly clash with other PRs PR: Feature Adds something new and removed PR: Major Coding Big enough to possibly clash with other PRs labels Nov 4, 2024
@OH296
Copy link

OH296 commented Nov 4, 2024

rebase onto #64 before continuing with this or we will have issues as i've moved the equipment struct to it's own file

@EttyKitty
Copy link
Owner Author

@sourcery-ai review

Copy link

sourcery-ai bot commented Dec 19, 2024

Reviewer's Guide by Sourcery

This pull request introduces a new stat scaling property for weapons. This property allows weapons to scale their stats based on the marine's stats. The changes involve adding a new stat_scaling property to the equipment_struct and modifying the TTRPG_stats function to calculate the stat bonus based on the new property. The stat_scaling property is a struct that maps stat names to scaling values. The get_weapon_stat_bonus function calculates the total stat bonus by multiplying the scaling value by the marine's stat value for each stat in the stat_scaling struct.

Sequence diagram for weapon stat bonus calculation

sequenceDiagram
    participant Marine as TTRPG_stats
    participant Weapon as equipment_struct

    Marine->>Marine: melee_attack(weapon_slot)
    Marine->>Marine: get_weapon_one_data()
    Marine->>Marine: get_weapon_two_data()
    Marine->>Marine: get_weapon_stat_bonus(weapon1)
    activate Marine
    Marine->>Weapon: access stat_scaling
    Weapon-->>Marine: return scaling values
    Marine->>Marine: calculate stat bonus
    deactivate Marine
    Marine->>Marine: get_weapon_stat_bonus(weapon2)
    activate Marine
    Marine->>Weapon: access stat_scaling
    Weapon-->>Marine: return scaling values
    Marine->>Marine: calculate stat bonus
    deactivate Marine
    Marine->>Marine: update melee_att
Loading

Class diagram showing weapon stat scaling changes

classDiagram
    class equipment_struct {
        +String type
        +Number hp_mod
        +String description
        +Number damage_resistance_mod
        +Number ranged_mod
        +Number melee_mod
        +Number armour_value
        +Number attack
        +Number melee_hands
        +Number ranged_hands
        +Number ammo
        +Number range
        +Number spli
        +Number arp
        +StatScaling stat_scaling
        +equipment_struct(item_data, core_type, quality)
    }

    class TTRPG_stats {
        +Number ranged_att
        +Number melee_att
        +Number weapon_skill
        +Number strength
        +melee_attack(weapon_slot)
        +get_weapon_stat_bonus(weapon)
    }

    class StatScaling {
        +Number strength
        +Number dexterity
    }

    equipment_struct -- StatScaling
    TTRPG_stats ..> equipment_struct : uses

    note for StatScaling "New struct for weapon stat scaling"
    note for TTRPG_stats "Added get_weapon_stat_bonus method"
Loading

File-Level Changes

Change Details Files
Added a new stat_scaling property to the equipment_struct.
  • Added a stat_scaling field to the global.weapons struct for the "Chainsword" weapon.
  • Added the stat_scaling property to the equipment_struct constructor.
scripts/scr_weapon/scr_weapon.gml
Implemented the stat scaling logic in the TTRPG_stats function.
  • Added a new get_weapon_stat_bonus function that calculates the stat bonus from a weapon based on the marine's stats.
  • Modified the melee_attack and ranged_attack functions to include the stat bonus from weapons.
scripts/scr_marine_struct/scr_marine_struct.gml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @EttyKitty - I've reviewed your changes - here's some feedback:

Overall Comments:

  • The get_weapon_stat_bonus function uses undefined variables 'stats' and 'stat_name' - these should be '_stats' and '_stat_name' to match the loop variable names
  • Consider removing or updating the commented out explanation string code rather than leaving it as comments
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

explanation_string += " Base: +10%#";
explanation_string += string_concat(" WSxSTR: ", format_number_with_sign(round((((weapon_skill/100)*(strength/20))-1)*100)), "%#");
explanation_string += string_concat(" EXP: ", format_number_with_sign(round((experience()/1000)*100)), "%#");
var explanation_string = "1";
Copy link

Choose a reason for hiding this comment

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

issue (bug_risk): Hardcoded "1" value appears to be temporary debug code

The explanation string construction was commented out and replaced with a hardcoded "1". This might affect game feedback and debugging capabilities.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: Balance PR: Feature Adds something new
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants