card.py 文件源码

python
阅读 114 收藏 0 点赞 0 评论 0

项目:LLSIF-AutoTeamBuilder 作者: Joshua1989 项目源码 文件源码
def card_strength(self, include_gem=True):
        # Base attribute value from naked card
        base_attr = np.array([getattr(self, attr.lower()) for attr in attr_list], dtype=float)
        # Bonus from bond
        bond_bonus = np.array([self.bond*(attr==self.main_attr) for attr in attr_list], dtype=float)
        # Compute card-only attribute: base+bond
        card_only_attr = base_attr + bond_bonus
        if not include_gem:
            strength = np.array(card_only_attr, dtype=int).tolist()
        else:
            gem_type_list = ['Kiss', 'Perfume', 'Ring', 'Cross']
            gem_matrix = {gem_type:np.zeros(3) for gem_type in gem_type_list}
            for gem in self.equipped_gems:
                gem_type = gem.name.split()[1]
                if gem_type in gem_type_list:
                    gem_matrix[gem_type][attr_list.index(gem.attribute)] = gem.value / 100**(gem.effect=='attr_boost')
            strength = card_only_attr.copy()
            for gem_type in gem_type_list:
                if gem_type in ['Kiss', 'Perfume']:
                    strength += gem_matrix[gem_type]
                elif gem_type in ['Ring', 'Cross']:
                    strength += np.ceil(card_only_attr*gem_matrix[gem_type])
            strength = np.array(strength, dtype=int)
        return {k.lower()+'*':v for k,v in zip(attr_list, strength)}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号