Esempio n. 1
0
    def attribute_match_convert(self, ls):

        min_attr = ls.min_attr
        max_attr = getattr(ls, 'max_attr', min_attr)
        attr = multi_getattr(ls, 'match_attributes', 'attributes')
        min_mult = getattr(ls, 'min_atk', ls.atk)
        min_rcv_mult = getattr(ls, 'min_rcv', ls.rcv)
        max_mult = getattr(ls, 'max_atk', ls.atk)

        skill_text = self.fmt_stats_type_attr_bonus(ls,
                                                    reduce_join_txt=' and ',
                                                    skip_attr_all=True,
                                                    atk=min_mult,
                                                    rcv=min_rcv_mult)

        if attr == [0, 1, 2, 3, 4]:
            skill_text += ' when matching {} or more colors'.format(min_attr)
            if max_mult > min_mult:
                skill_text += ' up to {}x at {} colors'.format(
                    fmt_mult(max_mult), max_attr)
        elif attr == [0, 1, 2, 3, 4, 5]:
            skill_text += ' when matching {} or more colors ({}+heal)'.format(
                min_attr, min_attr - 1)
            if max_mult > min_mult:
                skill_text += ' up to {}x at 5 colors+heal'.format(
                    fmt_mult(max_mult), min_attr - 1)
        elif min_attr == max_attr and len(attr) > min_attr:
            attr_text = self.attributes_format(attr)
            skill_text += ' when matching ' + str(
                min_attr) + '+ of {} at once'.format(attr_text)
        else:
            attr_text = self.attributes_format(attr)
            skill_text += ' when matching {} at once'.format(attr_text)

        return skill_text
Esempio n. 2
0
    def passive_stats_type_atk_all_hp_convert(self, ls):
        hp_pct = fmt_mult((1 - ls.hp) * 100)
        atk_mult = fmt_mult(ls.atk)
        skill_text = 'Reduce total HP by ' + hp_pct + '%; ' + atk_mult + 'x ATK for '
        for i in ls.types[:-1]:
            skill_text += self.TYPES[i] + ', '
        skill_text += self.TYPES[int(ls.types[-1])] + ' type'

        return skill_text
Esempio n. 3
0
    def counter_attack_convert(self, ls):
        attribute = self.ATTRIBUTES[ls.attributes[0]]
        if ls.chance == 1:
            skill_text = fmt_mult(ls.multiplier) + \
                         'x ' + attribute + ' counterattack'
        else:
            mult = str(ls.multiplier).rstrip('0').rstrip('.')
            skill_text = fmt_mult(
                ls.chance * 100
            ) + '% chance to counterattack with ' + mult + 'x ' + attribute + ' damage'

        return skill_text
Esempio n. 4
0
    def dual_threshold_stats_convert(self, ls):
        c1 = AttributeDict({
            'attributes': ls.attributes,
            'types': ls.types,
            'threshold': ls.threshold_1,
            'above': ls.threshold_type_1 == ThresholdType.ABOVE,
            'hp': ls.hp,
            'atk': ls.atk_1,
            'rcv': getattr(ls, 'rcv_1', ls.rcv),
            'shield': getattr(ls, 'shield_1', ls.shield),
        })

        c2 = AttributeDict({
            'attributes': ls.attributes,
            'types': ls.types,
            'threshold': ls.threshold_2,
            'above': ls.threshold_type_2 == ThresholdType.ABOVE,
            'hp': ls.hp,
            'atk': ls.atk_2,
            'rcv': getattr(ls, 'rcv_2', ls.rcv),
            'shield': getattr(ls, 'shield_2', ls.shield),
        })

        # TODO: this could use some cleanup
        skill_text = ''
        if c1.atk != 0 or c1.rcv != 1 or c1.shield != 0:
            if c1.atk == 0:
                c1.atk = 1
            if c1.threshold == 1:
                skill_text = self.fmt_stats_type_attr_bonus(
                    c1, reduce_join_txt=' and ', skip_attr_all=True)
                skill_text += ' when HP is full' if c1.above else ' when HP is not full'
            else:
                skill_text = self.fmt_stats_type_attr_bonus(
                    c1, reduce_join_txt=' and ', skip_attr_all=True)
                skill_text += ' when above ' if c1.above else ' when below '
                skill_text += fmt_mult(c1.threshold * 100) + '% HP'

        if c2.threshold != 0:
            if skill_text != '':
                skill_text += '; '
            if c2.threshold == 1:
                skill_text += self.fmt_stats_type_attr_bonus(
                    c2, reduce_join_txt=' and ', skip_attr_all=True)
                skill_text += ' when HP is full' if c2.above else ' when HP is not full'
            else:
                skill_text += self.fmt_stats_type_attr_bonus(
                    c2, reduce_join_txt=' and ', skip_attr_all=True)
                skill_text += ' when above ' if c2.above else ' when below '
                skill_text += fmt_mult(c2.threshold * 100) + '% HP'

        return skill_text
Esempio n. 5
0
    def color_cross_convert(self, ls):
        if len(ls.crosses) == 1:
            skill_text = fmt_mult(ls.crosses[0].atk) + 'x ATK for each cross of 5 ' + \
                         self.ATTRIBUTES[ls.crosses[0].attribute] + ' orbs'

        else:
            skill_text = fmt_mult(
                ls.crosses[0].atk) + 'x ATK for each cross of 5 '
            for i in range(0, len(ls.crosses))[:-1]:
                skill_text += self.ATTRIBUTES[ls.crosses[i].attribute] + ', '
            skill_text += self.ATTRIBUTES[ls.crosses[-1].attribute] + ' orbs'

        return skill_text
Esempio n. 6
0
    def orb_remain_convert(self, ls):
        skill_text = self.fmt_stats_type_attr_bonus(ls, atk=ls.min_atk)
        if skill_text:
            print('got one!')
            skill_text += '; '

        if ls.base_atk not in [0, 1]:
            skill_text += fmt_mult(ls.base_atk) + 'x ATK when there are ' + \
                          str(ls.orb_count) + ' or fewer orbs remaining'
            if ls.bonus_atk != 0:
                skill_text += ' up to ' + fmt_mult(
                    ls.atk) + 'x ATK when 0 orbs left'

        return skill_text
Esempio n. 7
0
    def mass_match_convert(self, ls):
        min_count = ls.min_count
        max_count = getattr(ls, 'max_count', 0)

        min_atk_mult = getattr(ls, 'min_atk', ls.atk)
        min_rcv_mult = getattr(ls, 'min_rcv', ls.rcv)
        max_atk = ls.atk
        attributes = multi_getattr(ls, 'match_attributes', 'attributes')

        skill_text = self.fmt_stats_type_attr_bonus(ls,
                                                    reduce_join_txt=' and ',
                                                    skip_attr_all=True,
                                                    atk=min_atk_mult,
                                                    rcv=min_rcv_mult)

        skill_text += ' when matching ' + str(min_count)
        if max_count != min_count:
            skill_text += ' or more connected'

        skill_text += self.fmt_multi_attr(attributes) + ' orbs'

        if max_count != min_count and max_count > 0:
            skill_text += ' up to {}x at {} orbs'.format(
                fmt_mult(max_atk), max_count)

        return skill_text
Esempio n. 8
0
    def multi_attribute_match_convert(self, ls):
        attributes = multi_getattr(ls, 'match_attributes', 'attributes')
        if not attributes:
            return ''

        min_atk_mult = multi_getattr(ls, 'min_atk', 'atk')
        min_rcv_mult = multi_getattr(ls, 'min_rcv', 'rcv')
        min_match = multi_getattr(ls, 'min_attr', 'min_combo', 'min_match')
        max_mult = multi_getattr(ls, 'max_atk', 'atk')

        skill_text = self.fmt_stats_type_attr_bonus(ls,
                                                    reduce_join_txt=' and ',
                                                    skip_attr_all=True,
                                                    atk=min_atk_mult,
                                                    rcv=min_rcv_mult)

        if all(x == attributes[0] for x in attributes):
            match_or_more = len(attributes) == min_match
            skill_text += ' when matching {}'.format(min_match)
            if match_or_more:
                skill_text += '+'
            try:
                skill_text += ' {} combos'.format(
                    self.ATTRIBUTES[attributes[0]])
            except Exception as ex:
                print(ex)
            if not match_or_more:
                skill_text += ', up to {}x at {} {} combos'.format(
                    fmt_mult(max_mult), len(attributes),
                    self.ATTRIBUTES[attributes[0]])

        else:
            min_colors = '+'.join(
                [self.ATTRIBUTES[a] for a in attributes[:min_match]])
            skill_text += ' when matching {}'.format(min_colors)
            if len(attributes) > min_match:
                alt_colors = '+'.join(
                    [self.ATTRIBUTES[a] for a in attributes[1:min_match + 1]])
                skill_text += '({})'.format(alt_colors)

            if max_mult > min_atk_mult:
                all_colors = '+'.join([self.ATTRIBUTES[a] for a in attributes])
                skill_text += ' up to {}x when matching {}'.format(
                    fmt_mult(max_mult), all_colors)

        return skill_text
Esempio n. 9
0
    def bonus_time_convert(self, ls):
        skill_text = self.fmt_stats_type_attr_bonus(ls)

        if ls.time:
            if skill_text:
                skill_text += '; '

            skill_text += 'Increase orb movement time by ' + fmt_mult(
                ls.time) + ' seconds'

        return skill_text
Esempio n. 10
0
 def threshold_stats_convert(self, ls):
     above = ls.threshold_type == ThresholdType.ABOVE
     skill_text = self.fmt_stats_type_attr_bonus(ls,
                                                 reduce_join_txt=' and ',
                                                 skip_attr_all=True)
     if ls.threshold != 1:
         skill_text += ' when above ' if above else ' when below '
         skill_text += fmt_mult(ls.threshold * 100) + '% HP'
     else:
         skill_text += ' when '
         skill_text += 'HP is full' if above else 'HP is not full'
     return skill_text
Esempio n. 11
0
    def combo_match_convert(self, ls):
        min_combos = ls.min_combos
        max_combos = getattr(ls, 'max_combos', min_combos)
        min_atk_mult = getattr(ls, 'min_atk', ls.atk)
        min_rcv_mult = getattr(ls, 'min_rcv', ls.rcv)

        if ls.atk == 1 and ls.rcv == 1 and min_combos == 0:
            return None

        skill_text = self.fmt_stats_type_attr_bonus(ls,
                                                    reduce_join_txt=' and ',
                                                    skip_attr_all=True,
                                                    atk=min_atk_mult,
                                                    rcv=min_rcv_mult)
        skill_text += ' when {} or more combos'.format(min_combos)

        if min_combos != max_combos:
            skill_text += ' up to {}x at {} combos'.format(
                fmt_mult(ls.atk), max_combos)

        return skill_text
Esempio n. 12
0
    def dual_passive_stat_convert(self, ls):
        c1 = AttributeDict({
            'attributes': getattr(ls, 'attributes_1', []),
            'types': getattr(ls, 'types_1', []),
            'hp': ls.hp_1,
            'atk': ls.atk_1,
            'rcv': ls.rcv_1,
            'shield': 0,
        })
        c2 = AttributeDict({
            'attributes': getattr(ls, 'attributes_2', []),
            'types': getattr(ls, 'types_2', []),
            'hp': ls.hp_2,
            'atk': ls.atk_2,
            'rcv': ls.rcv_2,
            'shield': 0,
        })
        skill_text = self.fmt_stats_type_attr_bonus(
            c1) + '; ' + self.fmt_stats_type_attr_bonus(c2)
        if not c1.types and not c1.types and c1.atk != 1 and c2.atk != 1:
            skill_text += '; ' + fmt_mult(
                ls.atk) + 'x ATK for allies with both Att.'

        return skill_text
Esempio n. 13
0
 def rank_exp_rate_convert(self, ls):
     skill_text = fmt_mult(ls.multiplier) + 'x Rank EXP'
     return skill_text
Esempio n. 14
0
 def heal_on_convert(self, ls):
     skill_text = fmt_mult(
         ls.multiplier) + 'x RCV additional heal when matching orbs'
     return skill_text
Esempio n. 15
0
 def egg_drop_convert(self, ls):
     skill_text = fmt_mult(ls.multiplier) + 'x Egg Drop rate'
     return skill_text
Esempio n. 16
0
 def five_orb_one_enhance_convert(self, ls):
     skill_text = fmt_mult(
         ls.atk
     ) + 'x ATK for matched Att. when matching 5 Orbs with 1+ enhanced'
     return skill_text
Esempio n. 17
0
 def heart_tpa_stats_convert(self, ls):
     skill_text = fmt_mult(ls.rcv) + 'x RCV when matching 4 Heal orbs'
     return skill_text
Esempio n. 18
0
 def after_attack_convert(self, ls):
     skill_text = fmt_mult(
         ls.multiplier) + 'x ATK additional damage when matching orbs'
     return skill_text
Esempio n. 19
0
 def coin_drop_convert(self, ls):
     skill_text = fmt_mult(ls.multiplier) + 'x Coin Drop rate'
     return skill_text
Esempio n. 20
0
 def exact_combo_convert(self, ls):
     skill_text = fmt_mult(ls.atk) + 'x ATK when exactly ' + str(
         ls.combos) + ' combos'
     return skill_text