class Game_Actor # 仅为示例,请勿模仿! def <=> other return unless other.respond_to? :name name <=> other.name end end $game_party.actors.sort # 角色都按照名字排序了 case actor_id when Float "ID是小数" when 1, 2 "主角" when 3..8 "酱油" when lambda { |id| id.even? } "ID是偶数" else "" end