Commit 1f985569 authored by 神楽坂玲奈's avatar 神楽坂玲奈

iduel replay,支持从iduel对战中复制出来的战报

parent 8f49dcd4
#encoding: UTF-8
class Replay
Delimiter = /^.+?\(\d+\)\(\d+:\d+:\d+\): (?:\r)?\n /
Player_Filter = /^(.+?)\((\d+)\)\(\d+:\d+:\d+\): (?:\r)?\n \[\d+\] ◎→/
Opponent_Filter =/^(.+?)\((\d+)\)\(\d+:\d+:\d+\): (?:\r)?\n \[\d+\] ●→/
Delimiter = /^.+?\(\d+\)(?:\(\d+:\d+:\d+\))?(?:: |:)\n ?/
Player_Filter = /^(.+?)\((\d+)\)(?:\(\d+:\d+:\d+\))?(?:: |:)\n ?\[\d+\] ◎→/
Opponent_Filter =/^(.+?)\((\d+)\)(?:\(\d+:\d+:\d+\))?(?:: |:)\n ?\[\d+\] ●→/
attr_accessor :room, :player1, :player2, :actions
def add(action)
# user = action.from_player ? $game.player1 : $game.player2
......@@ -25,10 +25,11 @@ class Replay
result.player2 = User.new(1, "对手")
end
result.actions = contents.split(Delimiter).collect do |action_str|
action_str.chomp!
action_str.strip!
next if action_str.empty?
action = Action.parse action_str
Game_Event::Action.new(action, action_str)
end
end.compact
$game.room = result.room = Room.new(0, "Replay", result.player1, result.player2)
result
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment