Skip to content

Commit

Permalink
Merge pull request #1663 from heinezen/fix/de2_conversion
Browse files Browse the repository at this point in the history
Fix DE2 conversion for 'The Mountain Royals' expansion
  • Loading branch information
TheJJ authored Jul 30, 2024
2 parents 25199df + 6d15023 commit 626ff0f
Show file tree
Hide file tree
Showing 14 changed files with 168 additions and 91 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020-2023 the openage authors. See copying.md for legal info.
# Copyright 2020-2024 the openage authors. See copying.md for legal info.
#
# pylint: disable=too-few-public-methods

Expand Down Expand Up @@ -40,7 +40,7 @@ def _get_aoe2_base(cls, full_data_set: GenieObjectContainer) -> Modpack:

mod_def = modpack.get_info()

mod_def.set_info("de2_base", "0.5.1", versionstr="1.0c", repo="openage")
mod_def.set_info("de2_base", "0.6.0", versionstr="Update 118476+", repo="openage")

mod_def.add_include("data/**")

Expand Down
3 changes: 3 additions & 0 deletions openage/convert/processor/conversion/de2/nyan_subprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,9 @@ def building_line_to_game_entity(building_line: GenieBuildingLineGroup) -> None:
abilities_set.append(AoCAbilitySubprocessor.terrain_requirement_ability(building_line))
abilities_set.append(AoCAbilitySubprocessor.visibility_ability(building_line))

if building_line.get_head_unit()["speed"].value > 0:
abilities_set.append(AoCAbilitySubprocessor.move_ability(building_line))

# Config abilities
if building_line.is_creatable():
abilities_set.append(AoCAbilitySubprocessor.constructable_ability(building_line))
Expand Down
5 changes: 4 additions & 1 deletion openage/convert/processor/conversion/de2/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,10 @@ def create_extra_building_lines(full_data_set: GenieObjectContainer) -> None:
process.
:type full_data_set: class: ...dataformat.aoc.genie_object_container.GenieObjectContainer
"""
extra_units = (1734,) # Folwark
extra_units = (
1734, # Folwark
1808, # Mule Cart
)

for unit_id in extra_units:
building_line = GenieBuildingLineGroup(unit_id, full_data_set)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020-2023 the openage authors. See copying.md for legal info.
# Copyright 2020-2024 the openage authors. See copying.md for legal info.
#
# pylint: disable=too-many-locals,too-many-branches

Expand Down Expand Up @@ -155,7 +155,11 @@ class DE2TechSubprocessor:
267: DE2UpgradeResourceSubprocessor.forager_wood_gather_upgrade,
268: DE2UpgradeResourceSubprocessor.resource_decay_upgrade,
269: DE2UpgradeResourceSubprocessor.tech_reward_upgrade,
272: DE2UpgradeResourceSubprocessor.cliff_defense_upgrade,
273: DE2UpgradeResourceSubprocessor.elevation_defense_upgrade,
274: DE2UpgradeResourceSubprocessor.chieftains_upgrade,
280: DE2UpgradeResourceSubprocessor.conversion_range_upgrade,
282: DE2UpgradeResourceSubprocessor.unknown_recharge_rate_upgrade,
}

@classmethod
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020-2023 the openage authors. See copying.md for legal info.
# Copyright 2020-2024 the openage authors. See copying.md for legal info.
#
# pylint: disable=too-many-locals,too-many-lines,too-many-statements,too-many-public-methods,invalid-name
#
Expand Down Expand Up @@ -123,6 +123,31 @@ def cliff_attack_upgrade(

return patches

@staticmethod
def cliff_defense_upgrade(
converter_group: ConverterObjectGroup,
value: typing.Union[int, float],
operator: MemberOperator,
team: bool = False
) -> list[ForwardRef]:
"""
Creates a patch for the cliff defense multiplier effect (ID: 272).
:param converter_group: Tech/Civ that gets the patch.
:type converter_group: ...dataformat.converter_object.ConverterObjectGroup
:param value: Value used for patching the member.
:type value: MemberOperator
:param operator: Operator used for patching the member.
:type operator: MemberOperator
:returns: The forward references for the generated patches.
:rtype: list
"""
patches = []

# TODO: Implement

return patches

@staticmethod
def conversion_min_adjustment_upgrade(
converter_group: ConverterObjectGroup,
Expand Down Expand Up @@ -258,6 +283,31 @@ def conversion_building_chance_upgrade(

return patches

@staticmethod
def conversion_range_upgrade(
converter_group: ConverterObjectGroup,
value: typing.Union[int, float],
operator: MemberOperator,
team: bool = False
) -> list[ForwardRef]:
"""
Creates a patch for the conversion range modifer (ID: 280).
:param converter_group: Tech/Civ that gets the patch.
:type converter_group: ...dataformat.converter_object.ConverterObjectGroup
:param value: Value used for patching the member.
:type value: MemberOperator
:param operator: Operator used for patching the member.
:type operator: MemberOperator
:returns: The forward references for the generated patches.
:rtype: list
"""
patches = []

# TODO: Implement

return patches

@staticmethod
def cuman_tc_upgrade(
converter_group: ConverterObjectGroup,
Expand Down Expand Up @@ -441,6 +491,31 @@ def elevation_attack_upgrade(

return patches

@staticmethod
def elevation_defense_upgrade(
converter_group: ConverterObjectGroup,
value: typing.Union[int, float],
operator: MemberOperator,
team: bool = False
) -> list[ForwardRef]:
"""
Creates a patch for the elevation defense multiplier effect (ID: 273).
:param converter_group: Tech/Civ that gets the patch.
:type converter_group: ...dataformat.converter_object.ConverterObjectGroup
:param value: Value used for patching the member.
:type value: MemberOperator
:param operator: Operator used for patching the member.
:type operator: MemberOperator
:returns: The forward references for the generated patches.
:rtype: list
"""
patches = []

# TODO: Implement

return patches

@staticmethod
def feitoria_gold_upgrade(
converter_group: ConverterObjectGroup,
Expand Down Expand Up @@ -851,6 +926,31 @@ def trade_food_bonus_upgrade(

return patches

@staticmethod
def unknown_recharge_rate_upgrade(
converter_group: ConverterObjectGroup,
value: typing.Union[int, float],
operator: MemberOperator,
team: bool = False
) -> list[ForwardRef]:
"""
Creates a patch for the unknown recharge rate bonus effect (ID: 282).
:param converter_group: Tech/Civ that gets the patch.
:type converter_group: ...dataformat.converter_object.ConverterObjectGroup
:param value: Value used for patching the member.
:type value: MemberOperator
:param operator: Operator used for patching the member.
:type operator: MemberOperator
:returns: The forward references for the generated patches.
:rtype: list
"""
patches = []

# TODO: Implement

return patches

@staticmethod
def workshop_food_gen_upgrade(
converter_group: ConverterObjectGroup,
Expand Down
1 change: 0 additions & 1 deletion openage/convert/service/init/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
add_py_modules(
__init__.py
api_export_required.py
changelog.py
conversion_required.py
modpack_search.py
mount_asset_dirs.py
Expand Down
2 changes: 1 addition & 1 deletion openage/convert/service/init/api_export_required.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

def api_export_required(asset_dir: UnionPath) -> bool:
"""
Returns true if the openage nyan API modpack cannot be found.
Returns true if the openage nyan API modpack cannot be found or is outdated.
TODO: Remove once the API modpack is generated by default.
Expand Down
69 changes: 0 additions & 69 deletions openage/convert/service/init/changelog.py

This file was deleted.

14 changes: 9 additions & 5 deletions openage/convert/service/init/modpack_search.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023-2023 the openage authors. See copying.md for legal info.
# Copyright 2023-2024 the openage authors. See copying.md for legal info.

"""
Search for and enumerate openage modpacks.
Expand Down Expand Up @@ -86,17 +86,21 @@ def query_modpack(proposals: set[str]) -> str:
Query interactively for a modpack from a selection of proposals.
"""
print("\nPlease select a modpack before starting.")
print("Insert the index of one of the proposals (Default = 0):")
print("Enter the index of one of the proposals (Default = 0):")

proposals = sorted(proposals)
for index, proposal in enumerate(proposals):
print(f"({index}) {proposal}")

user_selection = input("> ")
if user_selection.isdecimal() and int(user_selection) < len(proposals):
selection = proposals[int(user_selection)]
if user_selection == "":
selection = proposals[0]

else:
selection = proposals[0]
while not (user_selection.isdecimal() and int(user_selection) < len(proposals)):
print(f"'{user_selection}' is not a valid index. Please try again.")
user_selection = input("> ")

selection = proposals[int(user_selection)]

return selection
10 changes: 5 additions & 5 deletions openage/convert/tool/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from ..service.debug_info import debug_gamedata_format
from ..service.debug_info import debug_string_resources, \
debug_registered_graphics, debug_modpack, debug_execution_time
from ..service.init.changelog import (ASSET_VERSION)
from ..service.read.gamedata import get_gamespec
from ..service.read.palette import get_palettes
from ..service.read.register_media import get_existing_graphics
Expand All @@ -40,8 +39,6 @@ def convert(args: Namespace) -> None:
# clean args (set by convert_metadata for convert_media)
del args.palettes

info(f"asset conversion complete; asset version: {ASSET_VERSION}", )


def convert_metadata(args: Namespace) -> None:
"""
Expand Down Expand Up @@ -105,8 +102,11 @@ def convert_metadata(args: Namespace) -> None:
ModpackExporter.export(modpack, args)
debug_modpack(args.debugdir, args.debug_info, modpack)

export_end = timeit.default_timer()
info("Finished modpack export (%.2f seconds)", export_end - export_start)
export_end = timeit.default_timer()
info("Finished export of modpack '%s' v%s (%.2f seconds)",
modpack.info.packagename,
modpack.info.version,
export_end - export_start)

stages_time = {
"read": read_end - read_start,
Expand Down
Loading

0 comments on commit 626ff0f

Please sign in to comment.