No edit summary
No edit summary
 
(One intermediate revision by one other user not shown)
Line 191: Line 191:
| SNOW_WELD || 0
| SNOW_WELD || 0
|-
|-
| BRIDGE1 || 0
| STREET || 0
|-
|-
| BRIDGE2 || 0
| STREET1 || 0
|-
|-
| BRIDGE3 || 0
| TELEPORTTILE || 0
|-
|-
| BEACH || 0
| WALL || 0
|-
|-
| BEACH || 0
| WASTELAND || 2
|-
|-
| BEACH || 0
| WASTE_DESTROYEDWELD || 1
|-
|-
| BRIDGE1 || 0
| WASTE_FOREST || 3
|-
|-
| BRIDGE2 || 0
| WASTE_MOUNTAIN || 4
|-
|-
| BRIDGE3 || 0
| WASTE_PATH || 0
|-
|-
| BEACH || 0
| WASTE_PIPELINE || 0
|-
|-
| BEACH || 0
| WASTE_RUIN || 1
|-
| WASTE_WASTELAND || 2
|-
| WASTE_WELD || 0
|-
| WEAKWALL || 0
|-
| WELD || 0
|-
| BASEBRIDGE || 0
|-
| BASEDESTROYEDWELD || 1
|-
| BASEFOREST || 3
|-
| BASEMOUNTAIN || 4
|-
| BASEPIPELINE || 0
|-
| BASERUIN || 1
|-
| BASESTREET || 0
|-
| BASEWASTELAND || 2
|-
| BASEWELD || 0
 
[[Category:Modding tutorials]]

Latest revision as of 04:08, 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
STREET 0
STREET1 0
TELEPORTTILE 0
WALL 0
WASTELAND 2
WASTE_DESTROYEDWELD 1
WASTE_FOREST 3
WASTE_MOUNTAIN 4
WASTE_PATH 0
WASTE_PIPELINE 0
WASTE_RUIN 1
WASTE_WASTELAND 2
WASTE_WELD 0
WEAKWALL 0
WELD 0
BASEBRIDGE 0
BASEDESTROYEDWELD 1
BASEFOREST 3
BASEMOUNTAIN 4
BASEPIPELINE 0
BASERUIN 1
BASESTREET 0
BASEWASTELAND 2
BASEWELD 0