예제 #1
0
    def get_patches(cls,
                    converter_group: ConverterObjectGroup) -> list[ForwardRef]:
        """
        Returns the patches for a converter group, depending on the type
        of its effects.
        """
        patches = []
        effects = converter_group.get_effects()
        for effect in effects:
            type_id = effect.get_type()

            if type_id in (0, 4, 5):
                patches.extend(
                    cls.attribute_modify_effect(converter_group, effect))

            elif type_id == 1:
                patches.extend(
                    cls.resource_modify_effect(converter_group, effect))

            elif type_id == 2:
                # Enabling/disabling units: Handled in creatable conditions
                pass

            elif type_id == 3:
                patches.extend(cls.upgrade_unit_effect(converter_group,
                                                       effect))

        return patches
예제 #2
0
    def get_patches(cls,
                    converter_group: ConverterObjectGroup) -> list[ForwardRef]:
        """
        Returns the patches for a converter group, depending on the type
        of its effects.
        """
        patches = []
        dataset = converter_group.data
        team_bonus = False

        if isinstance(converter_group, CivTeamBonus):
            effects = converter_group.get_effects()

            # Change converter group here, so that the Civ object gets the patches
            converter_group = dataset.civ_groups[
                converter_group.get_civilization_id()]
            team_bonus = True

        elif isinstance(converter_group, CivBonus):
            effects = converter_group.get_effects()

            # Change converter group here, so that the Civ object gets the patches
            converter_group = dataset.civ_groups[
                converter_group.get_civilization_id()]

        else:
            effects = converter_group.get_effects()

        team_effect = False
        for effect in effects:
            type_id = effect.get_type()

            if team_bonus or type_id in (10, 11, 12, 13, 14, 15, 16):
                team_effect = True
                type_id -= 10

            if type_id in (0, 4, 5):
                patches.extend(
                    cls.attribute_modify_effect(converter_group,
                                                effect,
                                                team=team_effect))

            elif type_id in (1, 6):
                patches.extend(
                    cls.resource_modify_effect(converter_group,
                                               effect,
                                               team=team_effect))

            elif type_id == 2:
                # Enabling/disabling units: Handled in creatable conditions
                pass

            elif type_id == 3:
                patches.extend(
                    AoCTechSubprocessor.upgrade_unit_effect(
                        converter_group, effect))

            elif type_id == 101:
                patches.extend(
                    AoCTechSubprocessor.tech_cost_modify_effect(
                        converter_group, effect, team=team_effect))

            elif type_id == 102:
                # Tech disable: Only used for civ tech tree
                pass

            elif type_id == 103:
                patches.extend(
                    AoCTechSubprocessor.tech_time_modify_effect(
                        converter_group, effect, team=team_effect))

            team_effect = False

        return patches