Skip to content

ProjectileInfo

Bases: Enum

This enum class provides information about the projectiles in the game. Information about the following properties of a projectile is found in this class:

  • Projectile ID
  • The units that use the projectile

Methods

Examples

Source code in AoE2ScenarioParser/datasets/projectiles.py
 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
class ProjectileInfo(Enum):
    """
    This enum class provides information about the projectiles in the game. Information about the following properties
    of a projectile is found in this class:

     - Projectile ID
     - The units that use the projectile

    **Methods**



    **Examples**






    """

    @property
    def ID(self) -> int:
        """
        Returns:
            The ID of the specified projectile unit
        """
        return self.value[0]

    @property
    def USED_BY(self) -> tuple[int]:
        """
        Returns:
            A tuple of unit IDs that use the specified projectile unit
        """
        return self.value[1]

    @classmethod
    def from_id(cls, projectile_id: int) -> ProjectileInfo:
        """
        Get the ProjectileInfo object from its ID

        Args:
            projectile_id: The ID of the projectile to get the ProjectileInfo of

        Returns:
            A ProjectileInfo object of the specified projectile ID
        """
        if type(projectile_id) is not int:
            raise TypeError(f"from_id expected int, got {type(projectile_id)}")
        if projectile_id == -1:
            raise ValueError("-1 is not a valid projectile ID")

        for projectile in cls._member_map_.values():
            if projectile.value[0] == projectile_id:
                return projectile

        raise KeyError(f"A projectile unit with ID '{projectile_id}' was not found in the dataset")

    @staticmethod
    def get_unit_projectile(unit_const: int, has_chemistry: bool = False, secondary: bool = False) -> ProjectileInfo:

        """
        Get the projectile object based on unit const

        Args:
            unit_const: The unit to find the projectile of
            has_chemistry: If you want the fire (chemistry) version (if it exists)
            secondary: If you want the secondary projectile version (if it exists)

        Returns:
            The ProjectileInfo corresponding to the given unit and params or None if nothing was found
        """

        if type(unit_const) is not int:
            raise TypeError(f"unit const expected int, got {type(unit_const)}")
        if unit_const < 0:
            raise ValueError(f"{unit_const} is not a valid unit constant")

        projectile = "secondary" if secondary else "primary"
        fire = "_fire" if has_chemistry else ""
        projectile_id = _unit_projectile_info.get(str(unit_const), {}).get(projectile + fire, -1)

        return ProjectileInfo.from_id(projectile_id) if projectile_id != -1 else None

    ARROW = 9, ()
    VOL = 54, (71, 109, 141, 142, 484, 597, 617, 621)
    ARROW1 = 97, ()
    SLINGER = 187, (185, 1075)
    CATST = 242, ()
    CATSF = 244, ()
    BOLTX = 245, ()
    BOLTF = 246, ()
    ARROW2 = 312, ()
    TREBST = 313, ()
    MANGST = 314, ()
    ARROW3 = 315, ()
    ARROW4 = 316, ()
    ARROW5 = 317, ()
    ARROW6 = 318, ()
    ARROW7 = 319, ()
    ARROW8 = 320, ()
    ARROW9 = 321, ()
    ARROW10 = 322, ()
    CATST1 = 323, ()
    CATST2 = 324, ()
    CATST3 = 325, ()
    CATST4 = 326, ()
    CATST5 = 327, ()
    VOL_FIRE = 328, (71, 109, 141, 142, 484, 597, 617, 621)
    ARW_FLM = 360, ()
    ARC = 363, (4, 158, 571)
    CROSSBOWMAN = 364, (24, 493, 866, 868, 926, 930, 1072, 1106, 1166, 1294, 1297)
    CRS = 365, (7,)
    HCS = 366, (6, 583, 596, 1010, 1012, 1036, 1079, 1155)
    SCORPION = 367, (279,)
    BOMBARD_CANNON = 368, (36, 644, 650, 1709)
    MANGONEL_SECONDARY = 369, (280, 550, 588)
    TREBUCHET = 371, (42, 682, 683, 1690)
    GAL = 372, (21,)
    WAR_GALLEY = 373, (442, 827, 829)
    CANNON_GALLEON = 374, (420, 691)
    COM_FIRE = 375, (24, 493, 866, 868, 926, 930, 1072, 1106, 1166, 1294, 1297)
    CRS_FIRE = 376, (7,)
    HCS_FIRE = 377, (6, 583, 596, 1010, 1012, 1036, 1079, 1155)
    SCORPION_FIRE = 378, (279,)
    GUNPOWDER_PRIMARY = 380, (5, 46, 52, 203, 425, 427, 557, 748, 771, 773, 1068)
    BOLTXF = 381, ()
    BOLTF1 = 385, ()
    MNG_FLM = 462, ()
    ARC_FIRE = 466, (4, 158, 571)
    MANGONEL_SECONDARY_FIRE = 468, (280, 550, 588)
    TREBUCHET_FIRE = 469, (42, 682, 683, 1690)
    GALLEY_FIRE = 470, (21,)
    WAR_GALLEY_FIRE = 471, (442, 827, 829)
    HAR_FIRE = 475, (11, 39, 172, 561, 577, 731, 1007, 1009, 1034, 1231, 1233, 1259, 1260, 1261, 1269, 1275, 1276)
    HHA_FIRE = 476, (437, 474, 698, 943, 1267, 1303)
    HAR = 477, (11, 39, 172, 561, 577, 731, 1007, 1009, 1034, 1231, 1233, 1259, 1260, 1261, 1269, 1275, 1276)
    HHA = 478, (437, 474, 698, 943, 1267, 1303)
    T_ARO = 485, ()
    WTN = 503, ()
    ARROW_GUARD_TOWER = 504, (79, 234, 235, 566, 785, 1665)
    KEP = 505, (79, 234, 235, 684, 685, 785, 1102, 1665)
    BTW = 506, (236,)
    ACA = 507, (492, 642, 686, 1182)
    DROMON = 508, (1795,)
    VIL = 509, (122, 216)
    CKN = 510, (73, 559, 1073, 1231, 1233, 1260)
    LONGBOWMAN = 511, (8, 200, 530, 763, 765, 850, 1069, 1129, 1131)
    LBT = 512, (45, 47, 51, 106, 133, 250, 533, 778, 885, 1189)
    MSU = 513, ()
    MPC = 514, ()
    TAX = 515, (165, 281, 424, 426, 531, 931, 1298)
    WTN_FIRE = 516, ()
    GTW_FIRE = 517, (79, 234, 235, 566, 785, 1665)
    KEP_FIRE = 518, (79, 234, 235, 684, 685, 785, 1102, 1665)
    ACA_FIRE = 519, (492, 642, 686, 1182)
    DROMON_FIRE = 520, (1795,)
    VIL_FIRE = 521, (122, 216)
    CKN_FIRE = 522, (73, 559, 1073, 1231, 1233, 1260)
    LBM_FIRE = 523, (8, 200, 530, 763, 765, 850, 1069, 1129, 1131)
    LBT_FIRE = 524, (45, 47, 51, 106, 133, 250, 533, 778, 885, 1189)
    MPC_FIRE = 525, ()
    MSU_FIRE = 526, ()
    FRG = 537, ()
    HFG = 538, ()
    SGY = 540, (539,)
    SGY_FIRE = 541, (539,)
    ONAGER = 551, ()
    ONAGER_FIRE = 552, ()
    HEAVY_SCORPION = 627, (542,)
    HEAVY_SCORPION_FIRE = 628, (542,)
    MANGONEL_PRIMARY = 656, (280, 550, 588)
    GP1 = 657, ()
    MANGONEL_PRIMARY_FIRE = 658, (280, 550, 588)
    FIRE_SHIP = 676, (188, 190, 529, 532, 938, 1103, 1302)
    MLK = 736, (282, 556, 929, 1296)
    CST = 746, (33, 82, 445, 1251)
    CST_FIRE = 747, (33, 82, 445, 1251)
    CGX = 767, (831, 832, 844, 1631)
    STW = 786, ()
    STW_FIRE = 787, ()
    KNIFE = 1055, (1013, 1015, 1066)
    CVB = 1057, (1004, 1006)
    CVB_FIRE = 1058, (1004, 1006)
    LBOL = 1111, ()
    LBOL_FIRE = 1112, ()
    HEAVY_SCORPION_UNUSED = 1113, ()
    HEAVY_SCORPION_FIRE_UNUSED = 1114, ()
    GUNPOWDER_SECONDARY = 1119, (203, 1733)
    BALLISTA_ELEPHANT = 1167, (1120, 1122)
    BALLISTA_ELEPHANT_FIRE = 1168, (1120, 1122)
    ARAMBAI = 1169, (1126, 1128)
    ARAMBAI_FIRE = 1170, (1126, 1128)
    SHCOW = 1223, ()
    LASER = 1595, (1222, 1577)
    HUSSITE_WAGON = 1733, (1704, 1706)
    CHAKRAM = 1756, (1741, 1743)
    THRSD = 1779, (1750,)
    THRSD_FIRE = 1780, (1750,)
    ELEAR = 1781, (873, 875)
    ELEAR_FIRE = 1782, (873, 875)
    ORGAN_GUN = 1789, (1001, 1003)
    DROMON_GREEK_FIRE = 1798, (1795,)
    CITADELS = 1830, ()
    SVT = 1867, (79, 234, 235, 566, 785, 1665, 684, 685, 1102)
    SVT_FIRE = 1868, (79, 234, 235, 566, 785, 1665, 684, 685, 1102)

Attributes

ACA = (507, (492, 642, 686, 1182)) class-attribute instance-attribute

Value: (507, (492, 642, 686, 1182))

ACA_FIRE = (519, (492, 642, 686, 1182)) class-attribute instance-attribute

Value: (519, (492, 642, 686, 1182))

ARAMBAI = (1169, (1126, 1128)) class-attribute instance-attribute

Value: (1169, (1126, 1128))

ARAMBAI_FIRE = (1170, (1126, 1128)) class-attribute instance-attribute

Value: (1170, (1126, 1128))

ARC = (363, (4, 158, 571)) class-attribute instance-attribute

Value: (363, (4, 158, 571))

ARC_FIRE = (466, (4, 158, 571)) class-attribute instance-attribute

Value: (466, (4, 158, 571))

ARROW = (9, ()) class-attribute instance-attribute

Value: (9, ())

ARROW1 = (97, ()) class-attribute instance-attribute

Value: (97, ())

ARROW10 = (322, ()) class-attribute instance-attribute

Value: (322, ())

ARROW2 = (312, ()) class-attribute instance-attribute

Value: (312, ())

ARROW3 = (315, ()) class-attribute instance-attribute

Value: (315, ())

ARROW4 = (316, ()) class-attribute instance-attribute

Value: (316, ())

ARROW5 = (317, ()) class-attribute instance-attribute

Value: (317, ())

ARROW6 = (318, ()) class-attribute instance-attribute

Value: (318, ())

ARROW7 = (319, ()) class-attribute instance-attribute

Value: (319, ())

ARROW8 = (320, ()) class-attribute instance-attribute

Value: (320, ())

ARROW9 = (321, ()) class-attribute instance-attribute

Value: (321, ())

ARROW_GUARD_TOWER = (504, (79, 234, 235, 566, 785, 1665)) class-attribute instance-attribute

Value: (504, (79, 234, 235, 566, 785, 1665))

ARW_FLM = (360, ()) class-attribute instance-attribute

Value: (360, ())

BALLISTA_ELEPHANT = (1167, (1120, 1122)) class-attribute instance-attribute

Value: (1167, (1120, 1122))

BALLISTA_ELEPHANT_FIRE = (1168, (1120, 1122)) class-attribute instance-attribute

Value: (1168, (1120, 1122))

BOLTF = (246, ()) class-attribute instance-attribute

Value: (246, ())

BOLTF1 = (385, ()) class-attribute instance-attribute

Value: (385, ())

BOLTX = (245, ()) class-attribute instance-attribute

Value: (245, ())

BOLTXF = (381, ()) class-attribute instance-attribute

Value: (381, ())

BOMBARD_CANNON = (368, (36, 644, 650, 1709)) class-attribute instance-attribute

Value: (368, (36, 644, 650, 1709))

BTW = (506, (236,)) class-attribute instance-attribute

Value: (506, (236,))

CANNON_GALLEON = (374, (420, 691)) class-attribute instance-attribute

Value: (374, (420, 691))

CATSF = (244, ()) class-attribute instance-attribute

Value: (244, ())

CATST = (242, ()) class-attribute instance-attribute

Value: (242, ())

CATST1 = (323, ()) class-attribute instance-attribute

Value: (323, ())

CATST2 = (324, ()) class-attribute instance-attribute

Value: (324, ())

CATST3 = (325, ()) class-attribute instance-attribute

Value: (325, ())

CATST4 = (326, ()) class-attribute instance-attribute

Value: (326, ())

CATST5 = (327, ()) class-attribute instance-attribute

Value: (327, ())

CGX = (767, (831, 832, 844, 1631)) class-attribute instance-attribute

Value: (767, (831, 832, 844, 1631))

CHAKRAM = (1756, (1741, 1743)) class-attribute instance-attribute

Value: (1756, (1741, 1743))

CITADELS = (1830, ()) class-attribute instance-attribute

Value: (1830, ())

CKN = (510, (73, 559, 1073, 1231, 1233, 1260)) class-attribute instance-attribute

Value: (510, (73, 559, 1073, 1231, 1233, 1260))

CKN_FIRE = (522, (73, 559, 1073, 1231, 1233, 1260)) class-attribute instance-attribute

Value: (522, (73, 559, 1073, 1231, 1233, 1260))

COM_FIRE = (375, (24, 493, 866, 868, 926, 930, 1072, 1106, 1166, 1294, 1297)) class-attribute instance-attribute

Value: (375, (24, 493, 866, 868, 926, 930, 1072, 1106, 1166, 1294, 1297))

CROSSBOWMAN = (364, (24, 493, 866, 868, 926, 930, 1072, 1106, 1166, 1294, 1297)) class-attribute instance-attribute

Value: (364, (24, 493, 866, 868, 926, 930, 1072, 1106, 1166, 1294, 1297))

CRS = (365, (7,)) class-attribute instance-attribute

Value: (365, (7,))

CRS_FIRE = (376, (7,)) class-attribute instance-attribute

Value: (376, (7,))

CST = (746, (33, 82, 445, 1251)) class-attribute instance-attribute

Value: (746, (33, 82, 445, 1251))

CST_FIRE = (747, (33, 82, 445, 1251)) class-attribute instance-attribute

Value: (747, (33, 82, 445, 1251))

CVB = (1057, (1004, 1006)) class-attribute instance-attribute

Value: (1057, (1004, 1006))

CVB_FIRE = (1058, (1004, 1006)) class-attribute instance-attribute

Value: (1058, (1004, 1006))

DROMON = (508, (1795,)) class-attribute instance-attribute

Value: (508, (1795,))

DROMON_FIRE = (520, (1795,)) class-attribute instance-attribute

Value: (520, (1795,))

DROMON_GREEK_FIRE = (1798, (1795,)) class-attribute instance-attribute

Value: (1798, (1795,))

ELEAR = (1781, (873, 875)) class-attribute instance-attribute

Value: (1781, (873, 875))

ELEAR_FIRE = (1782, (873, 875)) class-attribute instance-attribute

Value: (1782, (873, 875))

FIRE_SHIP = (676, (188, 190, 529, 532, 938, 1103, 1302)) class-attribute instance-attribute

Value: (676, (188, 190, 529, 532, 938, 1103, 1302))

FRG = (537, ()) class-attribute instance-attribute

Value: (537, ())

GAL = (372, (21,)) class-attribute instance-attribute

Value: (372, (21,))

GALLEY_FIRE = (470, (21,)) class-attribute instance-attribute

Value: (470, (21,))

GP1 = (657, ()) class-attribute instance-attribute

Value: (657, ())

GTW_FIRE = (517, (79, 234, 235, 566, 785, 1665)) class-attribute instance-attribute

Value: (517, (79, 234, 235, 566, 785, 1665))

GUNPOWDER_PRIMARY = (380, (5, 46, 52, 203, 425, 427, 557, 748, 771, 773, 1068)) class-attribute instance-attribute

Value: (380, (5, 46, 52, 203, 425, 427, 557, 748, 771, 773, 1068))

GUNPOWDER_SECONDARY = (1119, (203, 1733)) class-attribute instance-attribute

Value: (1119, (203, 1733))

HAR = (477, (11, 39, 172, 561, 577, 731, 1007, 1009, 1034, 1231, 1233, 1259, 1260, 1261, 1269, 1275, 1276)) class-attribute instance-attribute

Value: (477, (11, 39, 172, 561, 577, 731, 1007, 1009, 1034, 1231, 1233, 1259, 1260, 1261, 1269, 1275, 1276))

HAR_FIRE = (475, (11, 39, 172, 561, 577, 731, 1007, 1009, 1034, 1231, 1233, 1259, 1260, 1261, 1269, 1275, 1276)) class-attribute instance-attribute

Value: (475, (11, 39, 172, 561, 577, 731, 1007, 1009, 1034, 1231, 1233, 1259, 1260, 1261, 1269, 1275, 1276))

HCS = (366, (6, 583, 596, 1010, 1012, 1036, 1079, 1155)) class-attribute instance-attribute

Value: (366, (6, 583, 596, 1010, 1012, 1036, 1079, 1155))

HCS_FIRE = (377, (6, 583, 596, 1010, 1012, 1036, 1079, 1155)) class-attribute instance-attribute

Value: (377, (6, 583, 596, 1010, 1012, 1036, 1079, 1155))

HEAVY_SCORPION = (627, (542,)) class-attribute instance-attribute

Value: (627, (542,))

HEAVY_SCORPION_FIRE = (628, (542,)) class-attribute instance-attribute

Value: (628, (542,))

HEAVY_SCORPION_FIRE_UNUSED = (1114, ()) class-attribute instance-attribute

Value: (1114, ())

HEAVY_SCORPION_UNUSED = (1113, ()) class-attribute instance-attribute

Value: (1113, ())

HFG = (538, ()) class-attribute instance-attribute

Value: (538, ())

HHA = (478, (437, 474, 698, 943, 1267, 1303)) class-attribute instance-attribute

Value: (478, (437, 474, 698, 943, 1267, 1303))

HHA_FIRE = (476, (437, 474, 698, 943, 1267, 1303)) class-attribute instance-attribute

Value: (476, (437, 474, 698, 943, 1267, 1303))

HUSSITE_WAGON = (1733, (1704, 1706)) class-attribute instance-attribute

Value: (1733, (1704, 1706))

ID: int property

Type: int

Returns:

Type Description
int

The ID of the specified projectile unit

KEP = (505, (79, 234, 235, 684, 685, 785, 1102, 1665)) class-attribute instance-attribute

Value: (505, (79, 234, 235, 684, 685, 785, 1102, 1665))

KEP_FIRE = (518, (79, 234, 235, 684, 685, 785, 1102, 1665)) class-attribute instance-attribute

Value: (518, (79, 234, 235, 684, 685, 785, 1102, 1665))

KNIFE = (1055, (1013, 1015, 1066)) class-attribute instance-attribute

Value: (1055, (1013, 1015, 1066))

LASER = (1595, (1222, 1577)) class-attribute instance-attribute

Value: (1595, (1222, 1577))

LBM_FIRE = (523, (8, 200, 530, 763, 765, 850, 1069, 1129, 1131)) class-attribute instance-attribute

Value: (523, (8, 200, 530, 763, 765, 850, 1069, 1129, 1131))

LBOL = (1111, ()) class-attribute instance-attribute

Value: (1111, ())

LBOL_FIRE = (1112, ()) class-attribute instance-attribute

Value: (1112, ())

LBT = (512, (45, 47, 51, 106, 133, 250, 533, 778, 885, 1189)) class-attribute instance-attribute

Value: (512, (45, 47, 51, 106, 133, 250, 533, 778, 885, 1189))

LBT_FIRE = (524, (45, 47, 51, 106, 133, 250, 533, 778, 885, 1189)) class-attribute instance-attribute

Value: (524, (45, 47, 51, 106, 133, 250, 533, 778, 885, 1189))

LONGBOWMAN = (511, (8, 200, 530, 763, 765, 850, 1069, 1129, 1131)) class-attribute instance-attribute

Value: (511, (8, 200, 530, 763, 765, 850, 1069, 1129, 1131))

MANGONEL_PRIMARY = (656, (280, 550, 588)) class-attribute instance-attribute

Value: (656, (280, 550, 588))

MANGONEL_PRIMARY_FIRE = (658, (280, 550, 588)) class-attribute instance-attribute

Value: (658, (280, 550, 588))

MANGONEL_SECONDARY = (369, (280, 550, 588)) class-attribute instance-attribute

Value: (369, (280, 550, 588))

MANGONEL_SECONDARY_FIRE = (468, (280, 550, 588)) class-attribute instance-attribute

Value: (468, (280, 550, 588))

MANGST = (314, ()) class-attribute instance-attribute

Value: (314, ())

MLK = (736, (282, 556, 929, 1296)) class-attribute instance-attribute

Value: (736, (282, 556, 929, 1296))

MNG_FLM = (462, ()) class-attribute instance-attribute

Value: (462, ())

MPC = (514, ()) class-attribute instance-attribute

Value: (514, ())

MPC_FIRE = (525, ()) class-attribute instance-attribute

Value: (525, ())

MSU = (513, ()) class-attribute instance-attribute

Value: (513, ())

MSU_FIRE = (526, ()) class-attribute instance-attribute

Value: (526, ())

ONAGER = (551, ()) class-attribute instance-attribute

Value: (551, ())

ONAGER_FIRE = (552, ()) class-attribute instance-attribute

Value: (552, ())

ORGAN_GUN = (1789, (1001, 1003)) class-attribute instance-attribute

Value: (1789, (1001, 1003))

SCORPION = (367, (279,)) class-attribute instance-attribute

Value: (367, (279,))

SCORPION_FIRE = (378, (279,)) class-attribute instance-attribute

Value: (378, (279,))

SGY = (540, (539,)) class-attribute instance-attribute

Value: (540, (539,))

SGY_FIRE = (541, (539,)) class-attribute instance-attribute

Value: (541, (539,))

SHCOW = (1223, ()) class-attribute instance-attribute

Value: (1223, ())

SLINGER = (187, (185, 1075)) class-attribute instance-attribute

Value: (187, (185, 1075))

STW = (786, ()) class-attribute instance-attribute

Value: (786, ())

STW_FIRE = (787, ()) class-attribute instance-attribute

Value: (787, ())

SVT = (1867, (79, 234, 235, 566, 785, 1665, 684, 685, 1102)) class-attribute instance-attribute

Value: (1867, (79, 234, 235, 566, 785, 1665, 684, 685, 1102))

SVT_FIRE = (1868, (79, 234, 235, 566, 785, 1665, 684, 685, 1102)) class-attribute instance-attribute

Value: (1868, (79, 234, 235, 566, 785, 1665, 684, 685, 1102))

TAX = (515, (165, 281, 424, 426, 531, 931, 1298)) class-attribute instance-attribute

Value: (515, (165, 281, 424, 426, 531, 931, 1298))

THRSD = (1779, (1750,)) class-attribute instance-attribute

Value: (1779, (1750,))

THRSD_FIRE = (1780, (1750,)) class-attribute instance-attribute

Value: (1780, (1750,))

TREBST = (313, ()) class-attribute instance-attribute

Value: (313, ())

TREBUCHET = (371, (42, 682, 683, 1690)) class-attribute instance-attribute

Value: (371, (42, 682, 683, 1690))

TREBUCHET_FIRE = (469, (42, 682, 683, 1690)) class-attribute instance-attribute

Value: (469, (42, 682, 683, 1690))

T_ARO = (485, ()) class-attribute instance-attribute

Value: (485, ())

USED_BY: tuple[int] property

Type: tuple[int]

Returns:

Type Description
tuple[int]

A tuple of unit IDs that use the specified projectile unit

VIL = (509, (122, 216)) class-attribute instance-attribute

Value: (509, (122, 216))

VIL_FIRE = (521, (122, 216)) class-attribute instance-attribute

Value: (521, (122, 216))

VOL = (54, (71, 109, 141, 142, 484, 597, 617, 621)) class-attribute instance-attribute

Value: (54, (71, 109, 141, 142, 484, 597, 617, 621))

VOL_FIRE = (328, (71, 109, 141, 142, 484, 597, 617, 621)) class-attribute instance-attribute

Value: (328, (71, 109, 141, 142, 484, 597, 617, 621))

WAR_GALLEY = (373, (442, 827, 829)) class-attribute instance-attribute

Value: (373, (442, 827, 829))

WAR_GALLEY_FIRE = (471, (442, 827, 829)) class-attribute instance-attribute

Value: (471, (442, 827, 829))

WTN = (503, ()) class-attribute instance-attribute

Value: (503, ())

WTN_FIRE = (516, ()) class-attribute instance-attribute

Value: (516, ())

Functions


def from_id(...) classmethod

Get the ProjectileInfo object from its ID

Parameters:

Name Type Description Default
projectile_id int

The ID of the projectile to get the ProjectileInfo of

required

Returns:

Type Description
ProjectileInfo

A ProjectileInfo object of the specified projectile ID

Source code in AoE2ScenarioParser/datasets/projectiles.py
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
@classmethod
def from_id(cls, projectile_id: int) -> ProjectileInfo:
    """
    Get the ProjectileInfo object from its ID

    Args:
        projectile_id: The ID of the projectile to get the ProjectileInfo of

    Returns:
        A ProjectileInfo object of the specified projectile ID
    """
    if type(projectile_id) is not int:
        raise TypeError(f"from_id expected int, got {type(projectile_id)}")
    if projectile_id == -1:
        raise ValueError("-1 is not a valid projectile ID")

    for projectile in cls._member_map_.values():
        if projectile.value[0] == projectile_id:
            return projectile

    raise KeyError(f"A projectile unit with ID '{projectile_id}' was not found in the dataset")

def get_unit_projectile(...) staticmethod

Get the projectile object based on unit const

Parameters:

Name Type Description Default
unit_const int

The unit to find the projectile of

required
has_chemistry bool

If you want the fire (chemistry) version (if it exists)

False
secondary bool

If you want the secondary projectile version (if it exists)

False

Returns:

Type Description
ProjectileInfo

The ProjectileInfo corresponding to the given unit and params or None if nothing was found

Source code in AoE2ScenarioParser/datasets/projectiles.py
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
@staticmethod
def get_unit_projectile(unit_const: int, has_chemistry: bool = False, secondary: bool = False) -> ProjectileInfo:

    """
    Get the projectile object based on unit const

    Args:
        unit_const: The unit to find the projectile of
        has_chemistry: If you want the fire (chemistry) version (if it exists)
        secondary: If you want the secondary projectile version (if it exists)

    Returns:
        The ProjectileInfo corresponding to the given unit and params or None if nothing was found
    """

    if type(unit_const) is not int:
        raise TypeError(f"unit const expected int, got {type(unit_const)}")
    if unit_const < 0:
        raise ValueError(f"{unit_const} is not a valid unit constant")

    projectile = "secondary" if secondary else "primary"
    fire = "_fire" if has_chemistry else ""
    projectile_id = _unit_projectile_info.get(str(unit_const), {}).get(projectile + fire, -1)

    return ProjectileInfo.from_id(projectile_id) if projectile_id != -1 else None