// parameter 1 is the upper case monster name to address stacking group and
//             used ship design.
// parameter 2 is the lower case monster name to select the sit rep monster
//             icon.
// parameter 3 is the monster spawn probability
MONSTER_NEST
'''
        EffectsGroup
            scope = Source
            activation = And [
                ((GameRule name = "RULE_NESTS_ALWAYS_SPAWN_WILD") = 0)
                Planet
                OwnedBy affiliation = AnyEmpire
                OwnerHasTech name = "SHP_DOMESTIC_MONSTER"
                Random probability = @3@ * (GameRule name = "RULE_DOMESTIC_NEST_MONSTER_SPAWN_FACTOR")
                Not Contains And [ Building name = "BLD_NEST_ERADICATOR" OwnedBy empire = Source.Owner ]
            ]
            stackinggroup = "@1@_NEST_STACK"  // groups with BLD_NEST_ERADICATOR
            priority = [[DEFAULT_PRIORITY]]   // eradication is going to happen earlier to prevent monster spawn
            effects = [
                CreateShip designname = "SM_@1@_1" empire = Source.Owner
                GenerateSitRepMessage
                    message = "EFFECT_TAME_MONSTER_HATCHED"
                    label = "EFFECT_TAME_MONSTER_HATCHED_LABEL"
                    icon = "icons/monsters/@2@-1.png"
                    parameters = [
                        tag = "planet" data = Source.ID
                        tag = "predefinedshipdesign" data = "SM_@1@_1"
                    ]
                    empire = Source.Owner
            ]
        EffectsGroup
            scope = Source
            activation = And [
                Planet
                Turn low = 10
                Or [
                    Unowned
                    ((GameRule name = "RULE_NESTS_ALWAYS_SPAWN_WILD") > 0)
                ]
                Random probability = 0.12 * (GameRule name = "RULE_WILD_NEST_MONSTER_SPAWN_FACTOR") * GalaxyMonsterFrequency / 2.0
                Not Contains And [ Building name = "BLD_NEST_ERADICATOR" OwnedBy empire = Source.Owner ]
            ]
            stackinggroup = "@1@_NEST_STACK"  // groups with BLD_NEST_ERADICATOR
            priority = [[DEFAULT_PRIORITY]]   // eradication is going to happen earlier to prevent monster spawn
            effects = CreateShip designname = "SM_@1@_1"
'''

#include "/scripting/macros/priorities.macros"
