Пример #1
0
    def check_kiho_eligibility(self, kiho):
        # check eligibility
        against_mastery     = 0

        is_monk, is_brotherhood = self.pc_is_monk    ()
        is_ninja                = self.pc_is_ninja   ()
        is_shugenja             = self.pc_is_shugenja()

        school_bonus        = 0
        relevant_ring       = models.ring_from_name(kiho.element)
        ring_rank           = self.pc.get_ring_rank(relevant_ring)

        if is_ninja:
            ninja_schools = [ x for x in self.pc.schools if x.has_tag('ninja') ]
            ninja_rank    = sum( [x.school_rank for x in ninja_schools ] )

        if is_monk:
            monk_schools = [ x for x in self.pc.schools if x.has_tag('monk') ]
            school_bonus = sum( [x.school_rank for x in monk_schools ] )

        against_mastery = school_bonus + ring_rank

        if is_brotherhood:
            return against_mastery >= kiho.mastery
        elif is_monk:
            return against_mastery >= kiho.mastery
        elif is_shugenja:
            return ring_rank >= kiho.mastery
        elif is_ninja:
            return ninja_rank >= kiho.mastery

        return False
Пример #2
0
 def check_ring_value():
     ring_id  = models.ring_from_name(kata.element)
     ring_val = self.pc.get_ring_rank(ring_id)
     return ring_val >= kata.mastery