ZAB909 / ChapterMaster

13 stars 21 forks source link

Iron Halo, Storm Shield and Boarding Shield not providing HP bonus when equipped #190

Closed renatosilvatimebel closed 8 months ago

renatosilvatimebel commented 10 months ago

This is the captain of my X company, he has 95HP:

image

it remains with 95HP even that i equip any of Halo, SS and BS:

I think we have 2 issues here, one is the displayed value not being updated and the second one is the calculation itself specifically to the Iron Halo.

https://github.com/ZAB909/ChapterMaster/blob/baf62dbb15596cc3a2c293c5c5584072aec31199/scripts/scr_battle_roster/scr_battle_roster.gml#L383C18-L383C18

code is trying to find "Iron Halo" string in deploying_unit.wep2

shouldnt it be deploying_unit.gear instead?

I think the UI is not displaying the right value, but i also believe that Iron Halo is not giving its HP bonus at all in the HP calculation: if (deploying_unit.wep2[cooh, va] = "Iron Halo") then targ.marine_hp[targ.men] += 20;

image

GalacticChimp commented 10 months ago

I'll have some time in a few hours, so I'll take a look

OH296 commented 10 months ago

the problem is slightly deeper as now we have a max hp stat to contend with which is calculated off of constitution and traits and is calculated everytime we do things with the units hp to make sure it hasn't changed

    static max_health =function(){
        var max_h = 100 * (1+((constitution - 40)*0.025));
        if (mobility_item() == "Bike"){
            max_h *= 1.25;
        }
        return max_h
    };  

so to increase hp we have to increase the max_health stat first otherwise any increase to the hp that goes above the max_health will be removed and the health set to the max health level

OH296 commented 10 months ago

i was planning to solve this by unifying all the equipment into actual structures so we could just check the equipment stat of the given loadout and apply any modifiers to the max health. otherwise the only other way of doing it is hardcoding into the max_health function

OH296 commented 10 months ago

The problem actually goes deeper than this because at the moment all the battle roster and combat scripts creaet copys of the full marine array set and then update the main arrays with the battle results. Now that we have structs for marines this is redundant as we can just store a list of the marine structs in the combat and we don't have to worry about updating them with the battle results as structs are always copied by reference so when we apply battle effects they are always applied direclty yo the base struct.

OH296 commented 10 months ago

in summary the enemy here is hardcoding

GalacticChimp commented 10 months ago

yeah, I checked the code and it's like you say. My first idea was to add and remove buffs on equip/dequip, but I like your idea with equipment structs more

GalacticChimp commented 10 months ago

so this bug will have to wait until we finished adding structs, at least for equipment and marines

GalacticChimp commented 10 months ago

requires #191 before this can be fixed

OH296 commented 8 months ago

finished now the new weapon/equipment system is done

Blogaugis commented 8 months ago

I personally find boarding and storm shields giving HP as weird.

But If You want to have it - could it be possible to add a marine stat bonuses to equipment? Like in this case, making the boarding and storm shields give a bonus to constitution of the marine? It would also allow more interesting equipment in terms of mods, which tweak the stats of those who wear it. Oh, and artifacts - these definitely should be able to provide stat modifiers.

OH296 commented 8 months ago

I personally find boarding and storm shields giving HP as weird.

But If You want to have it - could it be possible to add a marine stat bonuses to equipment? Like in this case, making the boarding and storm shields give a bonus to constitution of the marine? It would also allow more interesting equipment in terms of mods, which tweak the stats of those who wear it. Oh, and artifacts - these definitely should be able to provide stat modifiers.

This is a matter of preference, imo flat boosts to health is a very common game mechanic in terms of functionality, the weigh up between additions to end parameter or additions to end stats depends on how you expect a gameplay mechanic to work. Adding to the constitution of the unit would mean that tests against a unit's base reliance or "grit" so to speak would be modified by the existence of a shield. Equally adding health is also inefficient as it means health later has to be healed and that health is a property of the equipment.