Skip to content

Commit 43ad80b

Browse files
authored
Merge pull request #126 from KSneijders/dev
v0.8.0
2 parents 1571bd7 + 392502b commit 43ad80b

13 files changed

Lines changed: 9783 additions & 46 deletions

File tree

AoE2ScenarioParser/datasets/effects.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ class EffectId(IntEnum):
175175
- instruction_panel_position
176176
- play_sound
177177
- message
178-
- sound_name"""
178+
- sound_name
179+
- use_tag_color_for_icon"""
179180
CLEAR_INSTRUCTIONS = 21
180181
"""Attributes for the **clear_instructions** effect are: \n
181182
- instruction_panel_position"""
@@ -928,7 +929,8 @@ class EffectId(IntEnum):
928929
- quantity
929930
- quantity_float
930931
- armour_attack_class
931-
932+
- object_filter
933+
932934
This effect was added in: 1.55 & Trigger Version 4.5
933935
"""
934936
MODIFY_OBJECT_ATTRIBUTE_BY_VARIABLE = 106
@@ -989,6 +991,14 @@ class EffectId(IntEnum):
989991
990992
This effect was added in: 1.57 & Trigger Version 4.6
991993
"""
994+
MIRROR_DIPLOMACY = 109
995+
"""Attributes for the **mirror_diplomacy** effect are: \n
996+
- source_player
997+
- target_player
998+
- enabled
999+
1000+
This effect was added in: 1.57 & Trigger Version 4.6
1001+
"""
9921002

9931003

9941004
empty_attributes = {
@@ -1069,6 +1079,8 @@ class EffectId(IntEnum):
10691079
"wall_y1": -1,
10701080
"wall_x2": -1,
10711081
"wall_y2": -1,
1082+
"object_filter": -1,
1083+
"use_tag_color_for_icon": -1,
10721084
"message": "",
10731085
"sound_name": "",
10741086
"selected_object_ids": -1,

AoE2ScenarioParser/datasets/trigger_lists/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,4 @@
4242
from .disable_unit_flag import DisableUnitFlag
4343
from .attack_priority import AttackPriority
4444
from .local_technology import LocalTechnology
45+
from .object_modify_attribute_state import ObjectModifyAttributeState
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from __future__ import annotations
2+
3+
from AoE2ScenarioParser.datasets.dataset_enum import _DataSetIntEnums
4+
5+
6+
class ObjectModifyAttributeState(_DataSetIntEnums):
7+
"""
8+
This enum class provides the integer values used to reference the modification state of a unit used in the
9+
modify object attribute effect.
10+
11+
**Examples**
12+
13+
>>> ObjectModifyAttributeState.NOT_MODIFIED
14+
<ObjectModifyAttributeState.NOT_MODIFIED: 1>
15+
"""
16+
ALL = 0
17+
NOT_MODIFIED = 1
18+
MODIFIED = 2

AoE2ScenarioParser/objects/data_objects/effect.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ class Effect(AoE2Object, TriggerComponent):
113113
RetrieverObjectLink("wall_y1", support=Support(since=1.57)),
114114
RetrieverObjectLink("wall_x2", support=Support(since=1.57)),
115115
RetrieverObjectLink("wall_y2", support=Support(since=1.57)),
116+
RetrieverObjectLink("object_filter", support=Support(since=1.58)),
117+
RetrieverObjectLink("use_tag_color_for_icon", support=Support(since=1.58)),
116118
RetrieverObjectLink("message", commit_callback=_add_trail_if_string_attr_is_used_in_effect),
117119
RetrieverObjectLink("sound_name", commit_callback=_add_trail_if_string_attr_is_used_in_effect),
118120
RetrieverObjectLink("selected_object_ids"),
@@ -203,6 +205,8 @@ def __init__(
203205
wall_y1: int = None,
204206
wall_x2: int = None,
205207
wall_y2: int = None,
208+
object_filter: int = None,
209+
use_tag_color_for_icon: bool = None,
206210
message: str = None,
207211
sound_name: str = None,
208212
selected_object_ids: List[int] = None,
@@ -339,6 +343,8 @@ def __init__(
339343
self.wall_y1: int = wall_y1
340344
self.wall_x2: int = wall_x2
341345
self.wall_y2: int = wall_y2
346+
self.object_filter: int = object_filter
347+
self.use_tag_color_for_icon: bool = use_tag_color_for_icon
342348
self.message: str = message
343349
self.sound_name: str = sound_name
344350
self.selected_object_ids: List[int] = selected_object_ids

AoE2ScenarioParser/objects/support/attr_presentation.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
ButtonLocation, PanelLocation, TimeUnit, VisibilityState, DifficultyLevel, TechnologyState, Comparison, \
1313
ObjectAttribute, ObjectType, ObjectClass, TerrainRestrictions, HeroStatusFlag, BlastLevel, \
1414
DamageClass, Hotkey, ColorMood, ObjectState, ActionType, VictoryTimerType, Attribute, ProjectileSmartMode, \
15-
DecisionOption
15+
DecisionOption, ObjectModifyAttributeState
1616
from AoE2ScenarioParser.helper.helper import get_enum_from_unit_const
1717
from AoE2ScenarioParser.helper.list_functions import listify
1818
from AoE2ScenarioParser.helper.pretty_format import pretty_format_name
@@ -107,6 +107,7 @@ def format_unit(u: 'Unit') -> str:
107107
"ActionType": ActionType,
108108
"VictoryTimerType": VictoryTimerType,
109109
"DecisionOption": DecisionOption,
110+
"ObjectModifyAttributeState": ObjectModifyAttributeState,
110111
}
111112

112113
_other = {

AoE2ScenarioParser/objects/support/new_effect.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ def display_instructions(
391391
play_sound: int | None = None,
392392
message: str | None = None,
393393
sound_name: str | None = None,
394+
use_tag_color_for_icon: bool | None = None,
394395
) -> Effect:
395396
return self._trigger_ref._add_effect(
396397
EffectId.DISPLAY_INSTRUCTIONS,
@@ -402,6 +403,7 @@ def display_instructions(
402403
play_sound=play_sound,
403404
message=message,
404405
sound_name=sound_name,
406+
use_tag_color_for_icon=use_tag_color_for_icon,
405407
)
406408

407409
def clear_instructions(
@@ -2018,6 +2020,7 @@ def modify_object_attribute(
20182020
quantity: int | float | None = None,
20192021
armour_attack_quantity: int | None = None,
20202022
armour_attack_class: int | None = None,
2023+
object_filter: int | None = None,
20212024
):
20222025
if (armour_attack_quantity is not None or armour_attack_class is not None) and quantity is not None:
20232026
raise ValueError("Cannot use 'armour_attack' attributes together with the 'quantity' attribute.")
@@ -2037,6 +2040,7 @@ def modify_object_attribute(
20372040
quantity=quantity,
20382041
armour_attack_quantity=armour_attack_quantity,
20392042
armour_attack_class=armour_attack_class,
2043+
object_filter=object_filter,
20402044
)
20412045

20422046
def modify_object_attribute_by_variable(
@@ -2147,3 +2151,16 @@ def build_object(
21472151
issue_group_command=issue_group_command,
21482152
queue_action=queue_action,
21492153
)
2154+
2155+
def mirror_diplomacy(
2156+
self,
2157+
source_player: int | None = None,
2158+
target_player: int | None = None,
2159+
enabled: bool | None = None,
2160+
) -> Effect:
2161+
return self._trigger_ref._add_effect(
2162+
EffectId.MIRROR_DIPLOMACY,
2163+
source_player=source_player,
2164+
target_player=target_player,
2165+
enabled=enabled,
2166+
)

AoE2ScenarioParser/versions/DE/v1.57/structure.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1749,7 +1749,7 @@
17491749
"type": "s32",
17501750
"default": 0
17511751
},
1752-
"static_value_75": {
1752+
"static_value_81": {
17531753
"type": "s32",
17541754
"default": 81
17551755
},

0 commit comments

Comments
 (0)