Robosturm / Commander_Wars

The aim of this project is to create an Advance Wars Clone with a lot of additions customizations and modding support. For Contact Inforamtion see the wiki page. Take a view on the game.
https://github.com/Robosturm/Commander_Wars/releases
GNU Lesser General Public License v3.0
213 stars 33 forks source link

getFirerangeModifier Affects the Range of Direct-Attack Units, But getMinFirerangeModifier Does Not #1766

Closed FruityGumGuiltyFruit closed 6 months ago

FruityGumGuiltyFruit commented 6 months ago

Is your feature request related to a problem? Please describe. I noticed that getFirerangeModifier can increase or decrease the max range of all units, but getMinFirerangeModifier only increases the minimum range of indirect-attack units.

Describe the solution you'd like Direct-attack attack units should also be effected by getMinFirerangeModifier.

Additional context Here is a CO with the code below. image image image

this.getFirerangeModifier = function(co, unit, posX, posY, map)
{
    if (CO.isActive(co))
    {
        if (co.getPowerMode() === GameEnums.PowerMode_Superpower ||
                co.getPowerMode() === GameEnums.PowerMode_Tagpower)
        {
            return 3;
        }
        else if (co.getPowerMode() === GameEnums.PowerMode_Power)
        {
            return 2;
        }
        else if (map === null ||
                 (map !== null && map.getGameRules().getCoGlobalD2D()))
        {
            return 1;
        }
    }
    return 0;
};

this.getMinFirerangeModifier = function(co, unit, posX, posY, map)
{
    if (CO.isActive(co))
    {
        if (co.getPowerMode() === GameEnums.PowerMode_Superpower ||
                co.getPowerMode() === GameEnums.PowerMode_Tagpower)
        {
            return 3;
        }
        else if (co.getPowerMode() === GameEnums.PowerMode_Power)
        {
            return 2;
        }
        else if (map === null ||
                 (map !== null && map.getGameRules().getCoGlobalD2D()))
        {
            return 1;
        }
    }
    return 0;
};
Robosturm commented 6 months ago

You're screenshots don't show that it doesn't work and accprding to the code. It's not prevented either. My guess is direct units can always move and fire. And you're code just gives the infantry move and fire with a 2 range attack which is proably shown by the attack range