BibliothecaDAO / eternum

onchain eternal game
https://alpha-eternum.realms.world
MIT License
36 stars 30 forks source link

Update troop count after battle or pillage #956

Closed credence0x closed 3 weeks ago

credence0x commented 3 weeks ago

User description


PR Type

Enhancement, Bug fix


Description


Changes walkthrough ๐Ÿ“

Relevant files
Enhancement
contractComponents.ts
Update troop properties and battle types in contract components.

client/src/dojo/contractComponents.ts
  • Changed troops properties from Number to BigInt.
  • Added attack_army_lifetime and defence_army_lifetime properties.
  • Updated custom types and battle types to use u64 instead of u32.
  • +47/-13 
    contracts.cairo
    Enhance combat system with lifetime tracking and health checks.

    contracts/src/systems/combat/contracts.cairo
  • Updated army health and troop count during battles.
  • Added attack_army_lifetime and defence_army_lifetime properties.
  • Added health sanity checks and reset functions.
  • Updated battle state and troop count calculations.
  • +193/-40
    combat.cairo
    Update troop properties and add reset function in combat model.

    contracts/src/models/combat.cairo
  • Changed Troops properties from u32 to u64.
  • Added reset_count_and_health function.
  • Updated health manipulation functions.
  • +47/-15 
    Bug fix
    utils.tsx
    Fix type conversion in currencyFormat function.                   

    client/src/ui/utils/utils.tsx - Converted `num` to `Number` in `currencyFormat` function.
    +1/-1     
    Configuration changes
    manifest.json
    Update manifest with new class hashes and properties.       

    contracts/manifests/dev/manifest.json
  • Updated block numbers and class hashes.
  • Added attack_army_lifetime and defence_army_lifetime properties.
  • Changed troops properties from u32 to u64.
  • +269/-20
    manifest.toml
    Update manifest with new class hashes and properties.       

    contracts/manifests/dev/manifest.toml
  • Updated block numbers and class hashes.
  • Added attack_army_lifetime and defence_army_lifetime properties.
  • +38/-11 

    ๐Ÿ’ก PR-Agent usage: Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    vercel[bot] commented 3 weeks ago

    The latest updates on your projects. Learn more about Vercel for Git โ†—๏ธŽ

    Name Status Preview Comments Updated (UTC)
    eternum โŒ Failed (Inspect) Jun 19, 2024 11:56am
    github-actions[bot] commented 3 weeks ago

    PR Reviewer Guide ๐Ÿ”

    โฑ๏ธ Estimated effort to review [1-5] 4
    ๐Ÿงช Relevant tests No
    ๐Ÿ”’ Security concerns No
    โšก Key issues to review Type Conversion:
    The PR includes changes from Number to BigInt and u32 to u64 for troop counts and other related properties. Ensure that all related calculations, especially those involving arithmetic operations, properly handle these new types without loss of precision or overflow issues.
    Data Consistency:
    The introduction of attack_army_lifetime and defence_army_lifetime properties requires careful handling to ensure that these values are consistently updated wherever troop counts are modified. Review all logic paths to ensure that lifetime values are correctly maintained in sync with current troop counts.
    Health Calculation Changes:
    Modifications in health calculation methods (e.g., decrease_current_by replacing decrease_by) need thorough testing to ensure they behave as expected under all conditions, particularly edge cases like health reaching zero or partial health deductions.
    github-actions[bot] commented 3 weeks ago

    Failed to generate code suggestions for PR