Example #1
0
    def execute(self):
        stat_roll = self.get_roll_value_for_stat()
        skill_roll = self.get_roll_value_for_skill()
        diff_adj = self.get_roll_value_for_rating()

        # Flub rolls are botched rolls.
        if self.is_flub:
            self.raw_roll = 1
        else:
            self.raw_roll = randint(1, 100)

        # Unlike SimpleRoll, SpoofRoll does not take knacks into account.
        # (NPCs generally don't have knacks)
        self.result_value = self.raw_roll + stat_roll + skill_roll - diff_adj

        # GMCheck rolls don't crit/botch by default
        if self.can_crit or self.is_flub:
            self.natural_roll_type = self.check_for_crit_or_botch()
        else:
            self.natural_roll_type = None

        # If the result is a flub, get the failed roll objects and pick one
        # at random for our resulting roll.
        if self.is_flub:
            fail_rolls = self._get_fail_rolls()
            self.roll_result_object = choice(fail_rolls)
        else:
            self.roll_result_object = RollResult.get_instance_for_roll(
                self.result_value, natural_roll_type=self.natural_roll_type)

        self.result_message = self.roll_result_object.render(
            **self.get_context())
Example #2
0
 def execute(self):
     """Does the actual roll"""
     self.raw_roll = randint(1, 100)
     val = self.get_roll_value_for_traits()
     val += self.get_roll_value_for_knack()
     val -= self.get_roll_value_for_rating()
     val += self.raw_roll
     self.result_value = val
     # we use our raw roll and modified toll to determine if our roll is special
     self.natural_roll_type = self.check_for_crit_or_botch()
     self.roll_result_object = RollResult.get_instance_for_roll(
         val, natural_roll_type=self.natural_roll_type)
     self.result_message = self.roll_result_object.render(
         **self.get_context())
Example #3
0
    def execute(self):
        self.raw_roll = randint(1, 100)

        # Get retainer's roll values; they don't have knacks
        # so those are ignored here.
        stat_val = self.get_roll_value_for_stat()
        skill_val = self.get_roll_value_for_skill()
        rating_val = self.get_roll_value_for_rating()

        self.result_value = self.raw_roll + stat_val + skill_val - rating_val

        self.natural_roll_type = self.check_for_crit_or_botch()
        self.roll_result_object = RollResult.get_instance_for_roll(
            self.result_value, natural_roll_type=self.natural_roll_type)

        self.result_message = self.roll_result_object.render(
            **self.get_context())
Example #4
0
 def _get_fail_rolls(self):
     rolls = RollResult.get_all_cached_instances()
     if not rolls:
         return RollResult.objects.filter(value__lt=0)
     else:
         return [obj for obj in rolls if obj.value < 0]