[pre lang="ruby"]# Waterbound 水生事件 1.0 (3/23/15) -by avarisc #
# * 为事件添加一个注释 "[waterbound]" (不包括引号)
# 该事件就能在水中行走,且不能在陆地中行走.
# 条款: 公开发布. 尽情使用.
#==============================================================================#
class Game_Event < Game_Character
def check_waterbound(page)
command_list = page.list
(0..command_list.length - 2).each {|k|
command = command_list[k]
next if command.code != 108
@waterbound = true if command.parameters[0][/waterbound/]
}
end
alias refresh_waterbound_game_character refresh
def refresh
refresh_waterbound_game_character
@waterbound = false
if @page then check_waterbound(@page) end
end
end
class Game_CharacterBase
alias map_passable_waterbound_game_characterbase? :map_passable?
def map_passable?(x, y, d)
return $game_map.boat_passable?(x, y) if @waterbound
return map_passable_waterbound_game_characterbase?(x, y, d)
end
end[/pre]