def check_past_death_threshold(self): """ Returns whether our character is past the threshold where we should check for death. """ check = get_check_by_name(DEATH_SAVE) return check.should_trigger(self)
def test_harm(self, mock_check_randint, mock_damage_randint, mock_armor): self.setup_cmd(check_commands.CmdHarm, self.char2) mock_damage_randint.return_value = 110 mock_armor.return_value = 125 self.char1.traits.set_other_value("armor_class", 25) mock_check_randint.return_value = 500 self.call_cmd("foo", "Could not find 'foo'.") self.call_cmd(f"{self.char1}", "No damage rating found by that name.") self.call_cmd(f"{self.char1}=severe", "You may only harm others if GMing an event.") self.char2.permissions.add("builders") self.assertTrue(self.char.conscious) self.assertEqual(self.char.damage, 0) self.call_cmd( f"{self.char1}=severe", "Inflicting severe on Char.|" "Char checks 'permanent wound save' at hard. Critical Success! " "Char is inhumanly successful in a way that defies expectations.|" "Despite the terrible damage, Char does not take a permanent wound.|" "Char checks 'unconsciousness save' at daunting. Critical Success! " "Char is inhumanly successful in a way that defies expectations.|" "Char remains capable of fighting.", ) self.assertEqual(self.char.damage, 60) mock_check_randint.return_value = 50 self.call_cmd( f"{self.char1}=severe", "Inflicting severe on Char.|" "Char checks 'death save' at hard. Char is marginally successful.|" "Char remains alive, but close to death.|" "Char is incapacitated and falls unconscious.|" "Char checks 'permanent wound save' at hard. Char fails.|" "Char has suffered a serious wound!", ) self.assertFalse(self.char.conscious) self.assertEqual(self.char.damage, 120) self.assertEqual( str(get_check_by_name(DEATH_SAVE).dice_system), "Add Values Together: [Use the Highest Value: [luck, willpower], armor_class, stamina]", )
def check_past_permanent_wound_threshold(self, damage): check = get_check_by_name(PERMANENT_WOUND_SAVE) percent_damage = (damage * 100.0) / self.max_hp return check.should_trigger(self, percent_damage=percent_damage)
def check_past_unconsciousness_threshold(self): check = get_check_by_name(UNCON_SAVE) return check.should_trigger(self)