我来帮你解决这个问题。
根据你的代码描述,问题出在sort_heroes函数中。
在sort_heroes函数中,你使用了一个匿名函数作为compare函数,传入了三个参数:a,b和opponent。
但是,在get_faction_strength函数中,你只传入了两个参数:card和opponent。
所以,在sort_heroes函数中,b参数传入了undefined值,这导致了错误。
你应该修改get_faction_strength函数,传入三个参数:card,opponent和b(因为你在sort_heroes函数中使用了b参数)。
修改后的get_faction_strength函数如下:
function get_faction_strength(card,opponent,b)
{
var strength = 0;
if (card.Faction == obj_battle_manager.opponent.favored_faction)
{
strength = 1;
}
return strength;
}
这样就可以解决问题了。
评论 (0)