Exemplo n.º 1
0
 def _get_effective_rate(self, test_rate):
     num_success = 0
     num_tests = 100000
     for _ in xrange(num_tests):
         if utils.simulate_chance(test_rate):
             num_success += 1
     return float(num_success) * 100 / num_tests
 def receive_spook(self, spook_rate, spook_power):
     """
     Receive a spook attack with the given rate and power
     :param spook_rate: int percentage of spook success
     :param spook_power: reduction to player's attack and defense if spook succeeds
     :return: True if spook succeeds
     """
     spook_success = False
     if simulate_chance(spook_rate):
         self._initialize_spook(spook_power)
         spook_success = True
     return spook_success