dice: more syncs from the fork, returning more about a result

Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
This commit is contained in:
2026-07-24 09:30:44 -05:00
parent 915afbf5ec
commit 76b669be07
3 changed files with 7 additions and 6 deletions
+2 -3
View File
@@ -107,8 +107,6 @@ def cypher_result(difficulty: int, modifier: int, is_attack: bool, stat: str, co
detail_str = f"14(res. {result_lvl} (d20={result}) vs. {stat} difficulty {diff_level} ({modded_diff}))"
else:
detail_str = f"(res. {result_lvl} (d20={result}) vs. {stat} difficulty {diff_level} ({modded_diff}))"
return f"{display_comment} {result_str} {detail_str}"
else:
# we don't know the difficulty, so don't know success or not
if beats is not None:
@@ -136,7 +134,8 @@ def cypher_result(difficulty: int, modifier: int, is_attack: bool, stat: str, co
else:
detail_str = f"(res. {result_lvl}{modded_diff} (d20={result}) vs. {stat})"
return f"{display_comment} {result_str} {detail_str}"
return (result, beats, success, effect, neg_effect, result_lvl, diff_level,
f"{display_comment} {result_str} {detail_str}")
def generic_roll(keep, dice, size):
+4 -2
View File
@@ -129,7 +129,8 @@ class DiceRoller(object):
comment = f"{p[5].strip()} {p[6].strip()}"
else:
comment = f"{p[5].strip()}"
p[0] = dice.lib.cypher_result(difficulty, mod, is_attack, stat=stat, comment=comment, ircify=self.ircify)
_, _, _, _, _, _, _, p[0] = dice.lib.cypher_result(difficulty, mod, is_attack, stat=stat,
comment=comment, ircify=self.ircify)
output = p[0]
def p_cypher_graduated_task_roll(self, p):
@@ -144,7 +145,8 @@ class DiceRoller(object):
comment = f"{p[3].strip()} {p[4].strip()}"
else:
comment = f"{p[3].strip()}"
p[0] = dice.lib.cypher_result(None, mod, is_attack, stat=stat, comment=comment, ircify=self.ircify)
_, _, _, _, _, _, _, p[0] = dice.lib.cypher_result(None, mod, is_attack, stat=stat,
comment=comment, ircify=self.ircify)
output = p[0]
def p_comment(self, p):
+1 -1
View File
@@ -132,5 +132,5 @@ class CypherRollStringTestCase(TestCase):
def test_simple_result(self):
"""Test the basics of string output."""
with mock.patch('random.SystemRandom.randint', return_value=10):
result = dice.lib.cypher_result(3, 0, False, "Might", "")
_, _, _, _, _, _, _, result = dice.lib.cypher_result(3, 0, False, "Might", "")
self.assertEqual(result, "task succeeded! (res. 3 (d20=10) vs. Might difficulty 3 (3))")