(Created page with "Terrains in the game can be modified. Terrains in the game can be manipulated by creating by coding it Example <syntaxhighlight lang="javascript"> This is for certain terrains type this.wilderness = ["DESERT_FOREST", "DESERT_FOREST1", "DESERT_ROCK", "DESERT_TRY_RIVER", "FOREST", "FOREST1", "FOREST2", "FORES...")
 
No edit summary
Line 148: Line 148:
|-
|-
| MOUNTAIN || 4
| MOUNTAIN || 4
|-
| BRIDGE3 || 0
|-
|-
| PIPELINE || 0
| PIPELINE || 0
Line 169: Line 167:
| RUIN || 1
| RUIN || 1
|-
|-
| BRIDGE1 || 0
| SEA || 0
|-
|-
| BRIDGE2 || 0
| SNOW || 1
|-
|-
| BRIDGE3 || 0
| SNOW_DESTROYEDWELD || 1
|-
|-
| BEACH || 0
| SNOW_FOREST || 3
|-
|-
| BEACH || 0
| SNOW_FOREST1 || 3
|-
|-
| BEACH || 0
| SNOW_FOREST2 || 3
|-
|-
| BRIDGE1 || 0
| SNOW_MOUNTAIN || 4
|-
|-
| BRIDGE2 || 0
| SNOW_PIPELINE || 0
|-
|-
| BRIDGE3 || 0
| SNOW_RUIN || 1
|-
|-
| BEACH || 0
| SNOW_STREET || 0
|-
|-
| BEACH || 0
| SNOW_WASTELAND || 2
|-
|-
| BEACH || 0
| SNOW_WELD || 0
|-
|-
| BRIDGE1 || 0
| BRIDGE1 || 0

Revision as of 03:44, 26 November 2023

Terrains in the game can be modified. Terrains in the game can be manipulated by creating by coding it

Example

This is for certain terrains type
    this.wilderness = ["DESERT_FOREST",
                       "DESERT_FOREST1",
                       "DESERT_ROCK",
                       "DESERT_TRY_RIVER",
                       "FOREST",
                       "FOREST1",
                       "FOREST2",
                       "FOREST3",
                       "RIVER",
                       "MOUNTAIN",
                       "SNOW_FOREST",
                       "SNOW_FOREST1",
                       "SNOW_FOREST2",
                       "SNOW_MOUNTAIN",
                       "WASTE_FOREST",
                       "PLAINS",
                       "WASTE_MOUNTAIN"];

    this.isWildernessTile = function(x, y, map)
    {
        if (map !== null)
        {
            if (map.onMap(x, y))
            {
                var terrain = map.getTerrain(x, y);
                var id = terrain.getID();
                if (CO_TEST.wilderness.includes(id))
                {
                    return true;
                }
            }
        }
        return false;
    };

    this.getTerrainDefenseModifier = function(co, unit, posX, posY, map)
    {
        if (CO.isActive(co))
        {
            if (CO.isActive(co))
            {
                if (CO_TEST.isWildernessTile(posX, posY, map))
                {
                    switch (co.getPowerMode())
                    {
                    case GameEnums.PowerMode_Tagpower:
                    case GameEnums.PowerMode_Superpower:
                        return CO_TEST.superPowerTerrainBonus;
                    case GameEnums.PowerMode_Power:
                        return 5;
                    default:
                        if (co.inCORange(Qt.point(posX, posY), unit))
                        {
                            return CO_TEST.d2dCoZoneTerrainBonus;
                        }
                        else
                        {
                            return CO_TEST.d2dTerrainBonus;
                        }
                    }
                }
            }
        }
        return 0;
    };
or if you want it to be global
    this.getTerrainDefenseModifier = function(co, unit, posX, posY, map)
    {
        if (CO.isActive(co))
        {
            switch (co.getPowerMode())
            {
            case GameEnums.PowerMode_Tagpower:
            case GameEnums.PowerMode_Superpower:
                return map.getTerrain(posX, posY).getBaseDefense() * CO_TEST.superPowerTerrainDefenseModifier;
            case GameEnums.PowerMode_Power:
                return 3;
            default:
                return 0;
            }
        }
        return 0;
    };
Available Terrains
Terrain name Terrain stars!
BEACH 0
BRIDGE1 0
BRIDGE2 0
BRIDGE3 0
CREEPER 0
DESERT 1
DESERT_DESTROYEDWELD 1
DESERT_FOREST 3
DESERT_FOREST1 3
DESERT_PATH 0
DESERT_PATH1 0
DESERT_PIPELINE 0
DESERT_ROCK 4
DESERT_RUIN 1
DESERT_TRY_RIVER 0
DESERT_WASTELAND 2
DESERT_WELD 0
DESTROYEDWELD 1
FIRE 0
FOG 1
FOREST 3
FOREST1 3
FOREST2 3
FOREST3 3
LAKE 0
METEOR 0
MOUNTAIN 4
PIPELINE 0
PLAINS 1
PLAINS_DESTROYED 1
PLAINS_PLASMA 0
PLASMA 0
REAF 2
RIVER 0
ROUGH_SEA 2
RUIN 1
SEA 0
SNOW 1
SNOW_DESTROYEDWELD 1
SNOW_FOREST 3
SNOW_FOREST1 3
SNOW_FOREST2 3
SNOW_MOUNTAIN 4
SNOW_PIPELINE 0
SNOW_RUIN 1
SNOW_STREET 0
SNOW_WASTELAND 2
SNOW_WELD 0
BRIDGE1 0
BRIDGE2 0
BRIDGE3 0
BEACH 0
BEACH 0
BEACH 0
BRIDGE1 0
BRIDGE2 0
BRIDGE3 0
BEACH 0
BEACH 0