36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
from app.functions.roll_dices import roll_dices
|
|
from app.tables.mentattack import MentalAttackMatrix
|
|
|
|
|
|
def roll_mental_attack(ams, dms, modifier):
|
|
|
|
result = {}
|
|
mam = MentalAttackMatrix()
|
|
needed = mam.get_attack_score(ams, dms)
|
|
result["needed"] = needed
|
|
outcome = None
|
|
if needed < 2:
|
|
outcome = "Automatic Success!"
|
|
elif needed > 20:
|
|
outcome = "Absolutely No Chance!"
|
|
else:
|
|
raw_roll = roll_dices(1, 20, False).get('result')
|
|
if modifier != 0:
|
|
result["original-roll"] = raw_roll
|
|
result["modifier"] = modifier
|
|
rolled = raw_roll + modifier # negative modifiers will subtract themselves naturally
|
|
result["adjusted-roll"] = rolled
|
|
else:
|
|
rolled = raw_roll
|
|
result["original-roll"] = rolled
|
|
|
|
if (rolled >= 20) and (needed <= 16):
|
|
outcome = "Devastating Success!"
|
|
elif needed <= rolled:
|
|
outcome = "Attack Successful!"
|
|
elif needed > rolled:
|
|
outcome = "Attack Failed!"
|
|
|
|
result["outcome"] = outcome
|
|
return result
|