/
Defense.focs.py
99 lines (94 loc) · 3.6 KB
/
Defense.focs.py
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
from common.base_prod import TECH_COST_MULTIPLIER
from common.misc import (
PLANET_DEFENSE_FACTOR,
PLANET_SHIELD_FACTOR,
SYSTEM_MINES_DAMAGE_FACTOR,
)
from common.priorities import AFTER_ALL_TARGET_MAX_METERS_PRIORITY
from techs.defense.mines import EG_SYSTEM_MINES
Tech(
name="DEF_ROOT_DEFENSE",
description="DEF_ROOT_DEFENSE_DESC",
short_description="TROOPS_SHORT_DESC",
category="DEFENSE_CATEGORY",
researchcost=1,
researchturns=1,
tags=["PEDIA_DEFENSE_CATEGORY"],
effectsgroups=[
EffectsGroup(
scope=Planet() & OwnedBy(empire=Source.Owner),
stackinggroup="PLANET_SHIELDS_STACK_ROOT",
effects=SetMaxShield(value=Value + 1, accountinglabel="DEF_ROOT_DEFENSE"),
),
EffectsGroup( # base regeneration of troops, defense and shields if not attacked
scope=Planet()
& OwnedBy(empire=Source.Owner)
& (LocalCandidate.LastTurnAttackedByShip < CurrentTurn)
& (LocalCandidate.LastTurnConquered < CurrentTurn),
priority=AFTER_ALL_TARGET_MAX_METERS_PRIORITY,
effects=[
SetShield(value=MinOf(float, Value + PLANET_SHIELD_FACTOR, Value(Target.MaxShield))),
SetDefense(value=MinOf(float, Value + PLANET_DEFENSE_FACTOR, Value(Target.MaxDefense))),
SetTroops(value=MinOf(float, Value + 1, Value(Target.MaxTroops))),
],
),
EffectsGroup( # set minimum troops for just-colonized planets
scope=Planet() & OwnedBy(empire=Source.Owner) & (LocalCandidate.LastTurnColonized == CurrentTurn),
priority=AFTER_ALL_TARGET_MAX_METERS_PRIORITY,
effects=SetTroops(
value=MinOf(float, NamedRealLookup(name="IMPERIAL_GARRISON_MAX_TROOPS_FLAT"), Value(Target.MaxTroops))
),
),
],
graphic="",
)
Tech(
name="DEF_PLANET_CLOAK",
description="DEF_PLANET_CLOAK_DESC",
short_description="BUILDING_UNLOCK_SHORT_DESC",
category="DEFENSE_CATEGORY",
researchcost=9999 * TECH_COST_MULTIPLIER,
researchturns=9999,
unresearchable=True,
tags=["PEDIA_DEFENSE_CATEGORY"],
prerequisites="SPY_STEALTH_3",
unlock=Item(type=UnlockBuilding, name="BLD_PLANET_CLOAK"),
)
Tech(
name="DEF_SYST_DEF_MINE_1",
description="DEF_SYST_DEF_MINE_1_DESC",
short_description="DEFENSE_SHORT_DESC",
category="DEFENSE_CATEGORY",
researchcost=120 * TECH_COST_MULTIPLIER,
researchturns=4,
tags=["PEDIA_DEFENSE_CATEGORY"],
prerequisites="DEF_DEFENSE_NET_1",
effectsgroups=[
EG_SYSTEM_MINES(2 * SYSTEM_MINES_DAMAGE_FACTOR, 75, "EMPIRE")
], # Priority deliberately not a macro and before all priority macros
graphic="icons/tech/system_defense_mines.png",
)
Tech(
name="DEF_SYST_DEF_MINE_2",
description="DEF_SYST_DEF_MINE_2_DESC",
short_description="DEFENSE_SHORT_DESC",
category="DEFENSE_CATEGORY",
researchcost=240 * TECH_COST_MULTIPLIER,
researchturns=6,
tags=["PEDIA_DEFENSE_CATEGORY"],
prerequisites="DEF_SYST_DEF_MINE_1",
effectsgroups=[EG_SYSTEM_MINES(6 * SYSTEM_MINES_DAMAGE_FACTOR, 65, "EMPIRE")],
graphic="icons/tech/system_defense_mines.png",
)
Tech(
name="DEF_SYST_DEF_MINE_3",
description="DEF_SYST_DEF_MINE_3_DESC",
short_description="DEFENSE_SHORT_DESC",
category="DEFENSE_CATEGORY",
researchcost=500 * TECH_COST_MULTIPLIER,
researchturns=8,
tags=["PEDIA_DEFENSE_CATEGORY"],
prerequisites="DEF_SYST_DEF_MINE_2",
effectsgroups=[EG_SYSTEM_MINES(14 * SYSTEM_MINES_DAMAGE_FACTOR, 60, "EMPIRE")],
graphic="icons/tech/system_defense_mines.png",
)