File: Garrison.focs.py

package info (click to toggle)
freeorion 0.5.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 194,940 kB
  • sloc: cpp: 186,508; python: 40,969; ansic: 1,164; xml: 719; makefile: 32; sh: 7
file content (156 lines) | stat: -rw-r--r-- 5,411 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
from focs._effects import (
    CurrentTurn,
    EffectsGroup,
    LocalCandidate,
    MinOf,
    NamedReal,
    OwnedBy,
    Planet,
    Population,
    SetMaxTroops,
    SetTroops,
    Source,
    Target,
    Value,
)
from focs._tech import *
from macros.base_prod import TECH_COST_MULTIPLIER, TROOPS_PER_POP
from macros.priorities import (
    AFTER_ALL_TARGET_MAX_METERS_PRIORITY,
    TARGET_AFTER_SCALING_PRIORITY,
    TARGET_EARLY_BEFORE_SCALING_PRIORITY,
)

Tech(
    name="DEF_GARRISON_1",
    description="DEF_GARRISON_1_DESC",
    short_description="TROOPS_SHORT_DESC",
    category="DEFENSE_CATEGORY",
    researchcost=9 * TECH_COST_MULTIPLIER,
    researchturns=3,
    tags=["PEDIA_DEFENSE_CATEGORY"],
    prerequisites=["DEF_ROOT_DEFENSE"],
    effectsgroups=[
        EffectsGroup(
            scope=Planet() & OwnedBy(empire=Source.Owner),
            stackinggroup="GARRISON_1_TROOPS_STACK",
            accountinglabel="DEF_TECH_ACCOUNTING_LABEL",
            priority=TARGET_AFTER_SCALING_PRIORITY,
            effects=SetMaxTroops(value=Value + NamedReal(name="GARRISON_1_MAX_TROOPS_FLAT", value=6)),
        ),
    ],
    graphic="icons/tech/troops.png",
)

Tech(
    name="DEF_GARRISON_2",
    description="DEF_GARRISON_2_DESC",
    short_description="TROOPS_SHORT_DESC",
    category="DEFENSE_CATEGORY",
    researchcost=25 * TECH_COST_MULTIPLIER,
    researchturns=5,
    tags=["PEDIA_DEFENSE_CATEGORY"],
    prerequisites=["DEF_GARRISON_1"],
    unlock=[
        Item(type=UnlockPolicy, name="PLC_CHECKPOINTS"),
        Item(type=UnlockPolicy, name="PLC_INSURGENCY"),
    ],
    effectsgroups=[
        EffectsGroup(
            scope=Planet()
            & OwnedBy(empire=Source.Owner)
            & (LocalCandidate.LastTurnConquered < CurrentTurn)
            & (LocalCandidate.LastTurnAttackedByShip < CurrentTurn),
            accountinglabel="DEF_TECH_ACCOUNTING_LABEL",
            priority=AFTER_ALL_TARGET_MAX_METERS_PRIORITY,
            effects=SetTroops(
                value=MinOf(
                    float, Value(Target.MaxTroops), Value + NamedReal(name="GARRISON_2_TROOPREGEN_FLAT", value=1)
                )
            ),
        ),
        EffectsGroup(
            scope=Planet() & OwnedBy(empire=Source.Owner) & Population(low=0.01),
            stackinggroup="GARRISON_2_TROOPS_STACK",
            accountinglabel="DEF_TECH_ACCOUNTING_LABEL",
            priority=TARGET_EARLY_BEFORE_SCALING_PRIORITY,
            effects=SetMaxTroops(
                value=Value
                + Target.Population * NamedReal(name="GARRISON_2_MAXTROOPS_PERPOP", value=2 * TROOPS_PER_POP)
            ),
        ),
    ],
    graphic="icons/tech/troops.png",
)

Tech(
    name="DEF_GARRISON_3",
    description="DEF_GARRISON_3_DESC",
    short_description="TROOPS_SHORT_DESC",
    category="DEFENSE_CATEGORY",
    researchcost=84 * TECH_COST_MULTIPLIER,
    researchturns=7,
    tags=["PEDIA_DEFENSE_CATEGORY"],
    prerequisites=["DEF_GARRISON_2"],
    effectsgroups=[
        EffectsGroup(
            scope=Planet()
            & OwnedBy(empire=Source.Owner)
            & (LocalCandidate.LastTurnConquered < CurrentTurn)
            & (LocalCandidate.LastTurnAttackedByShip < CurrentTurn),
            accountinglabel="DEF_TECH_ACCOUNTING_LABEL",
            priority=AFTER_ALL_TARGET_MAX_METERS_PRIORITY,
            effects=SetTroops(
                value=MinOf(
                    float, Value(Target.MaxTroops), Value + NamedReal(name="GARRISON_3_TROOPREGEN_FLAT", value=2)
                )
            ),
        ),
        EffectsGroup(
            scope=Planet() & OwnedBy(empire=Source.Owner),
            stackinggroup="GARRISON_3_TROOPS_STACK",
            accountinglabel="DEF_TECH_ACCOUNTING_LABEL",
            priority=TARGET_AFTER_SCALING_PRIORITY,
            effects=SetMaxTroops(value=Value + NamedReal(name="GARRISON_3_MAX_TROOPS_FLAT", value=18)),
        ),
    ],
    graphic="icons/tech/troops.png",
)

Tech(
    name="DEF_GARRISON_4",
    description="DEF_GARRISON_4_DESC",
    short_description="TROOPS_SHORT_DESC",
    category="DEFENSE_CATEGORY",
    researchcost=216 * TECH_COST_MULTIPLIER,
    researchturns=9,
    tags=["PEDIA_DEFENSE_CATEGORY"],
    prerequisites=["DEF_GARRISON_3"],
    unlock=Item(type=UnlockPolicy, name="PLC_MARTIAL_LAW"),
    effectsgroups=[
        EffectsGroup(
            scope=Planet()
            & OwnedBy(empire=Source.Owner)
            & (LocalCandidate.LastTurnConquered < CurrentTurn)
            & (LocalCandidate.LastTurnAttackedByShip < CurrentTurn),
            accountinglabel="DEF_TECH_ACCOUNTING_LABEL",
            priority=AFTER_ALL_TARGET_MAX_METERS_PRIORITY,
            effects=SetTroops(
                value=MinOf(
                    float, Value(Target.MaxTroops), Value + NamedReal(name="GARRISON_4_TROOPREGEN_FLAT", value=4)
                )
            ),
        ),
        EffectsGroup(
            scope=Planet() & OwnedBy(empire=Source.Owner) & Population(low=0.01),
            stackinggroup="GARRISON_4_TROOPS_STACK",
            accountinglabel="DEF_TECH_ACCOUNTING_LABEL",
            priority=TARGET_EARLY_BEFORE_SCALING_PRIORITY,
            effects=SetMaxTroops(
                value=Value
                + Target.Population * NamedReal(name="GARRISON_4_MAX_TROOPS_PERPOP", value=3 * TROOPS_PER_POP)
            ),
        ),
    ],
    graphic="icons/tech/troops.png",
)