def recover(self,
             min_amount,
             max_amount,
             target_type,
             player_threshold=None):
     target = targets_to_str([target_type])
     if player_threshold and player_threshold != 100:
         return capitalize_first(
             '{:s} recover {:s} HP when below {}% HP'.format(
                 target, minmax(min_amount, max_amount, True),
                 player_threshold))
     else:
         return capitalize_first('{:s} recover {:s} HP'.format(
             target, minmax(min_amount, max_amount, True)))
示例#2
0
 def recover(self,
             min_amount,
             max_amount,
             target_type,
             player_threshold=None):
     target = targets_to_str([target_type])
     if player_threshold and player_threshold != 100:
         return "({}{}%HP{}{})".format(emoji_dict['recover'],
                                       minmax(min_amount, max_amount),
                                       emoji_dict['to'],
                                       capitalize_first(target))
     else:
         return "({}{}%HP{}{})".format(emoji_dict['recover'],
                                       minmax(min_amount, max_amount),
                                       emoji_dict['to'],
                                       capitalize_first(target))
 def debuff(self, d_type, amount, unit, turns):
     amount = amount or 0
     if amount % 1 != 0:
         human_fix_logger.error(
             'Amount {} will be truncated. Change debuff'.format(amount))
     unit = UNITS[unit]
     turns = turns or 0
     type_text = capitalize_first(STATUSES[d_type] or '')
     turn_text = noun_count('turn', turns)
     return '{:s} {:.0f}{:s} for {:s}'.format(type_text, amount, unit,
                                              turn_text)
示例#4
0
 def condition(self, chance, hp=None, one_time=False):
     output = []
     if 0 < chance < 100 and not one_time:
         output.append('{:d}% chance'.format(chance))
     if hp:
         output.append('when < {:d}% HP'.format(hp))
     if one_time:
         if len(output) > 0:
             output.append(', one-time use')
         else:
             output.append('one-time use')
     return capitalize_first(' '.join(output)) if len(output) > 0 else None
    def fmt_stats_type_attr_bonus(self,
                                  ls,
                                  reduce_join_txt='; ',
                                  skip_attr_all=True,
                                  atk=None,
                                  rcv=None,
                                  types=None,
                                  attributes=None,
                                  hp=None,
                                  shield=None,
                                  reduction_attributes=None):
        types = types or getattr(ls, 'types', [])
        attributes = attributes or getattr(ls, 'attributes', [])
        hp_mult = hp or getattr(ls, 'hp', 1)
        # TODO: maybe we can just move min_atk and min_rcv in here
        # TODO: had to add all these getattr because this is being used in the active
        #       skill parser as well, is this right?
        atk_mult = atk or getattr(ls, 'atk', 1)
        rcv_mult = rcv or getattr(ls, 'rcv', 1)
        damage_reduct = shield or getattr(ls, 'shield', 0)
        reduct_att = reduction_attributes or getattr(
            ls, 'reduction_attributes', [])

        skill_text = self.fmt_multiplier_text(hp_mult, atk_mult, rcv_mult)
        if skill_text:

            for_skill_text = ''
            if types:
                for_skill_text += ' {} type'.format(self.typing_to_str(types))

            is_attr_all = len(attributes) in [0, 5]
            should_skip_attr = is_attr_all and skip_attr_all

            if attributes and not should_skip_attr:
                if for_skill_text:
                    for_skill_text += ' and'
                color_text = 'all' if len(
                    attributes) == 5 else self.attributes_to_str(attributes)
                for_skill_text += ' ' + color_text + ' Att.'

            if for_skill_text:
                skill_text += ' for' + for_skill_text

        reduct_text = self.fmt_reduct_text(damage_reduct, reduct_att)
        if reduct_text:
            if skill_text:
                skill_text += reduce_join_txt
            if not skill_text or ';' in reduce_join_txt:
                reduct_text = capitalize_first(reduct_text)
            skill_text += reduct_text

        return skill_text
示例#6
0
 def debuff(self, d_type, amount, unit, turns):
     amount = amount or 0
     if amount % 1 != 0:
         human_fix_logger.error(
             'Amount {} will be truncated. Change debuff'.format(amount))
     unit = UNITS[unit]
     turns = turns or 0
     type_text = capitalize_first(STATUSES[d_type] or '')
     if d_type == Status.movetime:
         if amount > 100:
             type_text = emoji_dict['movetime_buff']
     elif d_type == Status.rcv:
         if amount > 100:
             type_text = emoji_dict['rcv_buff']
     return '({:s} {:.0f}{:s} for {})'.format(type_text, amount, unit,
                                              turns)
 def _line_change_convert(self, lines, index):
     skill_text = []
     # TODO: simplify this
     lines = [(index[line.index], self.attributes_to_str(line.attrs))
              for line in lines]
     skip = 0
     for c, line in enumerate(lines):
         if skip:
             skip -= 1
             continue
         elif c == len(lines) - 1 or lines[c + 1][1] != line[1]:
             skill_text.append('change {} to {} orbs'.format(*line))
         else:
             while c + skip < len(lines) and lines[c + skip][1] == line[1]:
                 skip += 1
             formatted = ' and '.join(map(lambda l: l[0],
                                          lines[c:c + skip]))
             skill_text.append("change {} to {} orbs".format(
                 formatted, line[1]))
             skip -= 1
     return capitalize_first(' and '.join(skill_text))