Hull
    name = "SH_TREE_BODY"
    description = "SH_TREE_BODY_DESC"
    speed = 0
    fuel = 0
    NoDefaultFuelEffect
    stealth = 5
    structure = 5
    slots = [
        Slot type = External position = (0.30, 0.15)
        Slot type = External position = (0.60, 0.15)
        Slot type = Internal position = (0.45, 0.5)
    ]
    buildcost = 1
    buildtime = 2
    Unproducible
    tags = [ "PEDIA_HULL_MONSTER_TREE" ]
    location = All
    effectsgroups = [
        [[MODERATE_VISION]]
        [[MONSTER_SHIELD_REGENERATION]]

        EffectsGroup    // remove self and recreate on first turn, so that trees start with age 0, and thus low initial health, instead of having thousands of structure at start of game
            scope = Source
            activation = Turn high = 2
            effects = [
                CreateShip designname = "SM_TREE"
                Destroy
            ]

        EffectsGroup    // grow larger / stronger / more krill capacity with age
            scope = Source
            accountinglabel = "AGE_BONUS"
            effects = [
                SetMaxStructure value = Value + Source.Age * 3 * [[SHIP_STRUCTURE_FACTOR]]
                SetMaxCapacity partname = "FT_HANGAR_KRILL" value = Source.Age
            ]

        EffectsGroup    // regeneration
            scope = Source
            activation = Turn low = LocalCandidate.System.LastTurnBattleHere + 1
            effects = SetStructure value = Value + 7 * [[SHIP_STRUCTURE_FACTOR]]

        EffectsGroup    // krill swarm (re)growth
            scope = Source
            effects = SetCapacity partname = "FT_HANGAR_KRILL" value = Value + 1

        EffectsGroup    // spawn floaters to reproduce
            scope = Source
            activation = Random probability = 0.03
            stackinggroup = "TREE_GROWTH"
            effects = CreateShip designname = "SM_FLOATER"

        EffectsGroup
            scope = And [
                Object id = Source.FleetID
                Fleet
            ]
            effects = SetObstructive
    ]
    icon = ""
    graphic = "icons/monsters/tree.png"

#include "monster.macros"

#include "../ship_hulls.macros"

#include "/scripting/macros/misc.macros"
