from app.functions.get_mutations import get_mutations
from app.functions.get_score_list import get_score_list
from app.functions.roll_dices import roll_dices


def roll_mutations(conscore, intscore):
    """
    :param conscore: modifier for physical mutation determination
    :param intscore: modifier for mental mutation determination
    :return: table of mutations (in json form)
    """
    mutations_table = {}

    mental_mutations_cnt = roll_dices(1, 4, False).get('result')
    physical_mutations_cnt = roll_dices(1, 4, False).get('result')
    mutations_table['count'] = {'mental': mental_mutations_cnt, 'physical': physical_mutations_cnt}

    mental_mutations_scores = get_score_list(mental_mutations_cnt, intscore)
    mutations_table['mental'] = get_mutations(mental_mutations_scores)

    physical_mutations_scores = get_score_list(physical_mutations_cnt, conscore)
    mutations_table['physical'] = get_mutations(physical_mutations_scores)

    return mutations_table
