File: Network.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 (103 lines) | stat: -rw-r--r-- 3,120 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
from focs._effects import (
    EffectsGroup,
    MaxOf,
    OwnedBy,
    Planet,
    SetDefense,
    SetMaxDefense,
    Source,
    Target,
    Value,
)
from focs._tech import *
from macros.base_prod import TECH_COST_MULTIPLIER
from macros.misc import PLANET_DEFENSE_FACTOR
from macros.priorities import DEFAULT_PRIORITY


def EG_DEFENSE_NET(multiplier: int, stack_postfix: str):
    return EffectsGroup(
        scope=Planet() & OwnedBy(empire=Source.Owner),
        stackinggroup="DEFENSE_NET_STACK_" + stack_postfix,
        accountinglabel="DEF_TECH_ACCOUNTING_LABEL",
        priority=DEFAULT_PRIORITY,
        effects=SetMaxDefense(value=Value + (multiplier * PLANET_DEFENSE_FACTOR)),
    )


Tech(
    name="DEF_DEFENSE_NET_1",
    description="DEF_DEFENSE_NET_1_DESC",
    short_description="DEFENSE_SHORT_DESC",
    category="DEFENSE_CATEGORY",
    researchcost=30 * TECH_COST_MULTIPLIER,
    researchturns=3,
    tags=["PEDIA_DEFENSE_CATEGORY"],
    prerequisites=["DEF_ROOT_DEFENSE"],
    effectsgroups=[EG_DEFENSE_NET(5, "1")],
    graphic="icons/tech/defense.png",
)

Tech(
    name="DEF_DEFENSE_NET_2",
    description="DEF_DEFENSE_NET_2_DESC",
    short_description="DEFENSE_SHORT_DESC",
    category="DEFENSE_CATEGORY",
    researchcost=96 * TECH_COST_MULTIPLIER,
    researchturns=4,
    tags=["PEDIA_DEFENSE_CATEGORY"],
    prerequisites=["DEF_DEFENSE_NET_1"],
    effectsgroups=[EG_DEFENSE_NET(15, "2")],
    graphic="icons/tech/defense.png",
)

Tech(
    name="DEF_DEFENSE_NET_3",
    description="DEF_DEFENSE_NET_3_DESC",
    short_description="DEFENSE_SHORT_DESC",
    category="DEFENSE_CATEGORY",
    researchcost=240 * TECH_COST_MULTIPLIER,
    researchturns=6,
    tags=["PEDIA_DEFENSE_CATEGORY"],
    prerequisites=["DEF_DEFENSE_NET_2"],
    effectsgroups=[EG_DEFENSE_NET(25, "3")],
    graphic="icons/tech/defense.png",
)

Tech(
    name="DEF_DEFENSE_NET_REGEN_1",
    description="DEF_DEFENSE_NET_REGEN_1_DESC",
    short_description="DEFENSE_SHORT_DESC",
    category="DEFENSE_CATEGORY",
    researchcost=120 * TECH_COST_MULTIPLIER,
    researchturns=6,
    tags=["PEDIA_DEFENSE_CATEGORY"],
    prerequisites=["DEF_DEFENSE_NET_2"],
    effectsgroups=[
        EffectsGroup(
            scope=Planet() & OwnedBy(empire=Source.Owner),
            accountinglabel="DEF_TECH_ACCOUNTING_LABEL",
            effects=SetDefense(value=Value + 0.1 * Target.MaxDefense),
        )
    ],
    graphic="icons/tech/defense_regeneration.png",
)

Tech(
    name="DEF_DEFENSE_NET_REGEN_2",
    description="DEF_DEFENSE_NET_REGEN_2_DESC",
    short_description="DEFENSE_SHORT_DESC",
    category="DEFENSE_CATEGORY",
    researchcost=240 * TECH_COST_MULTIPLIER,
    researchturns=8,
    tags=["PEDIA_DEFENSE_CATEGORY"],
    prerequisites=["DEF_DEFENSE_NET_REGEN_1"],
    effectsgroups=[
        EffectsGroup(
            scope=Planet() & OwnedBy(empire=Source.Owner),
            accountinglabel="DEF_TECH_ACCOUNTING_LABEL",
            effects=SetDefense(value=Value + MaxOf(float, 0.1 * Target.MaxDefense, 0.25 * Target.Construction)),
        )
    ],
    graphic="icons/tech/defense_regeneration.png",
)