Skip to content

Commit

Permalink
add tempered affix detection (d4lfteam#219)
Browse files Browse the repository at this point in the history
  • Loading branch information
aeon0 authored May 17, 2024
1 parent 97952c7 commit 7457cb3
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 2 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/item/descr/texture.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def find_affix_bullets(img_item_descr: np.ndarray, sep_short_match: TemplateMatc
"affix_bullet_point_medium",
"greater_affix_bullet_point_medium",
"rerolled_bullet_point_medium",
"tempered_affix_bullet_point_medium",
],
img_item_descr,
0.85,
Expand All @@ -41,6 +42,7 @@ def find_affix_bullets(img_item_descr: np.ndarray, sep_short_match: TemplateMatc
"affix_bullet_point",
"greater_affix_bullet_point",
"rerolled_bullet_point",
"tempered_affix_bullet_point",
],
img_item_descr,
0.85,
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/vision_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def vision_mode():
match = True
last_top_left_corner = top_left_corner
last_center = item_center
item_descr = read_descr(rarity, cropped_descr, False)
item_descr = read_descr(rarity, cropped_descr, True)
if item_descr is None:
last_center = None
last_top_left_corner = None
Expand Down
Binary file added test/assets/item/read_descr_tempered_1080p.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion test/config/ui_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ def test_colors():


def test_templates():
assert len(ResManager().templates) == 29
assert len(ResManager().templates) == 30
20 changes: 20 additions & 0 deletions test/item/read_descr_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,26 @@
rarity=ItemRarity.Magic,
),
),
(
(1920, 1080),
f"{BASE_PATH}/read_descr_tempered_1080p.png",
Item(
affixes=[
Affix("intelligence", 37),
Affix("life_per_second", 12),
Affix("damage", 11),
Affix("resource_cost_reduction", 6),
],
inherent=[
Affix("resistance_to_all_elements", 3.5),
Affix("poison_resistance", 3.5),
],
item_type=ItemType.Ring,
power=403,
rarity=ItemRarity.Legendary,
codex_upgrade=True,
),
),
],
)
def test_read_descr(img_res: tuple[int, int], input_img: str, expected_item: Item):
Expand Down

0 comments on commit 7457cb3

Please sign in to comment.