21 lines
680 B
Python
21 lines
680 B
Python
from typing import Tuple
|
|
|
|
from models.item import Item
|
|
|
|
def sanctify(solved_items: [Item]) -> Tuple[list]:
|
|
enemy_ids = []
|
|
|
|
# get all enemies
|
|
for item in solved_items:
|
|
# if the item is already an an enemy
|
|
# then it's enemy is sacred
|
|
if item.id not in enemy_ids:
|
|
# if it has enemies, check if it exists as part of the solved items
|
|
for enemy_id in item.enemies:
|
|
# if it does, it's a true enemy
|
|
if enemy_id in (i.id for i in solved_items):
|
|
enemy_ids.append(enemy_id)
|
|
|
|
sacred_ids = [i.id for i in solved_items if i.id not in enemy_ids]
|
|
|
|
return sacred_ids, enemy_ids |