but when removing enemy constraints
This commit is contained in:
@ -3,21 +3,19 @@ from typing import Tuple
|
||||
from models.item import Item
|
||||
|
||||
def sanctify(solved_items: [Item]) -> Tuple[list]:
|
||||
sacred_ids = []
|
||||
enemy_ids = []
|
||||
|
||||
# get all enemies
|
||||
for item in solved_items:
|
||||
# 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 (item.id for item in solved_items):
|
||||
enemy_ids.append(enemy_id)
|
||||
# remove enemy from solved items,
|
||||
# lest it has this sacred item added to enemies
|
||||
solved_items = [i for i in solved_items if i.id != enemy_id]
|
||||
# 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)
|
||||
|
||||
# the item is cleansed, now it's sacred
|
||||
sacred_ids.append(item.id)
|
||||
sacred_ids = [i.id for i in solved_items if i.id not in enemy_ids]
|
||||
|
||||
return sacred_ids, enemy_ids
|
Reference in New Issue
Block a user